From fd7038b8537aa2475c40ef719cfb3cf766567244 Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Wed, 6 May 2026 23:44:13 +0200 Subject: [PATCH] yes --- .../layout_binding_order.amber | 73 + ...hader_reuse_differing_layout_compute.amber | 59 + ...ader_reuse_differing_layout_graphics.amber | 106 + ...terminant_compute_fp16_32bit_mat_3x3.amber | 112 + ...terminant_compute_fp16_32bit_mat_4x4.amber | 122 + .../determinant_compute_fp16_mat_3x3.amber | 131 + .../determinant_compute_fp16_mat_4x4.amber | 141 + .../determinant_compute_fp64_mat_3x3.amber | 127 + .../determinant_compute_fp64_mat_4x4.amber | 137 + .../determinant_highp_mat_3x3.amber | 126 + .../determinant_highp_mat_4x4.amber | 133 + .../inverse_compute_fp16_32bit_mat_3x3.amber | 122 + .../inverse_compute_fp16_32bit_mat_4x4.amber | 132 + .../inverse_compute_fp16_mat_3x3.amber | 131 + .../inverse_compute_fp16_mat_4x4.amber | 141 + .../inverse_compute_fp64_mat_3x3.amber | 127 + .../inverse_compute_fp64_mat_4x4.amber | 137 + .../square_matrix/inverse_highp_mat_3x3.amber | 126 + .../square_matrix/inverse_highp_mat_4x4.amber | 136 + .../combined_operations/negintdivand.amber | 53 + vulkan/amber/combined_operations/notxor.amber | 50 + .../compute/atomic_barrier_sum_small.amber | 58 + .../amber/compute/branch_past_barrier.amber | 98 + vulkan/amber/compute/pk-immediate.amber | 1269 + vulkan/amber/compute/pkadd-immediate.amber | 77 + .../compute/vec2_nclamp_nan_component.amber | 118 + vulkan/amber/compute/webgl_spirv_loop.amber | 89 + .../copy_memory_basic.amber | 124 + .../copy_memory_two_invocations.amber | 180 + .../copy_memory_variable_pointers.amber | 202 + .../zero_ext_block.amber | 106 + .../zero_ext_block_with_offset.amber | 128 + .../zero_ext_other_block.amber | 111 + vulkan/amber/compute/write_ssbo_array.amber | 53 + .../workgroup_size_128.amber | 55 + .../workgroup_size_2x8x8.amber | 59 + .../workgroup_size_4x4x8.amber | 59 + .../workgroup_size_4x8x4.amber | 59 + .../workgroup_size_8x2x8.amber | 59 + .../workgroup_size_8x4x4.amber | 59 + .../workgroup_size_8x8x2.amber | 59 + vulkan/amber/crash_test/divbyzero_comp.amber | 87 + vulkan/amber/crash_test/divbyzero_frag.amber | 136 + vulkan/amber/crash_test/divbyzero_geom.amber | 126 + vulkan/amber/crash_test/divbyzero_tesc.amber | 146 + vulkan/amber/crash_test/divbyzero_tese.amber | 149 + vulkan/amber/crash_test/divbyzero_vert.amber | 106 + vulkan/amber/depth/bias_fs_clamp.amber | 76 + vulkan/amber/depth/bias_outside_range.amber | 74 + .../depth/bias_outside_range_fs_clamp.amber | 74 + ..._outside_range_fs_clamp_unrestricted.amber | 75 + vulkan/amber/depth/ez_fs_clamp.amber | 77 + vulkan/amber/depth/fs_clamp.amber | 75 + vulkan/amber/depth/out_of_range.amber | 66 + .../depth/out_of_range_unrestricted.amber | 67 + .../depth_bias_patch_list_tri_fill.amber | 224 + .../depth_bias_patch_list_tri_line.amber | 225 + .../depth_bias_patch_list_tri_point.amber | 225 + .../depth_bias_triangle_list_fill.amber | 179 + .../depth_bias_triangle_list_line.amber | 181 + .../depth_bias_triangle_list_point.amber | 182 + vulkan/amber/draw/misc/flat_b_sat_error.amber | 51 + ...r11-ufloat-pack32-highp-output-float.amber | 241 + ...1r11-ufloat-pack32-highp-output-vec2.amber | 241 + .../array/b10g11r11-ufloat-pack32-highp.amber | 241 + ...1-ufloat-pack32-mediump-output-float.amber | 241 + ...11-ufloat-pack32-mediump-output-vec2.amber | 241 + .../b10g11r11-ufloat-pack32-mediump.amber | 241 + .../b8g8r8a8-unorm-highp-output-vec2.amber | 241 + .../b8g8r8a8-unorm-highp-output-vec3.amber | 241 + .../array/b8g8r8a8-unorm-highp.amber | 241 + .../b8g8r8a8-unorm-mediump-output-vec2.amber | 241 + .../b8g8r8a8-unorm-mediump-output-vec3.amber | 241 + .../array/b8g8r8a8-unorm-mediump.amber | 241 + .../r16g16-sfloat-highp-output-float.amber | 241 + .../array/r16g16-sfloat-highp.amber | 241 + .../r16g16-sfloat-mediump-output-float.amber | 241 + .../array/r16g16-sfloat-mediump.amber | 241 + .../array/r32-sfloat-highp.amber | 241 + .../array/r32-sfloat-mediump.amber | 241 + ...32g32b32a32-sfloat-highp-output-vec2.amber | 241 + ...32g32b32a32-sfloat-highp-output-vec3.amber | 241 + .../array/r32g32b32a32-sfloat-highp.amber | 241 + ...g32b32a32-sfloat-mediump-output-vec2.amber | 241 + ...g32b32a32-sfloat-mediump-output-vec3.amber | 241 + .../array/r32g32b32a32-sfloat-mediump.amber | 241 + .../array/r8g8-uint-highp-output-uint.amber | 241 + .../array/r8g8-uint-highp.amber | 241 + .../array/r8g8-uint-mediump-output-uint.amber | 241 + .../array/r8g8-uint-mediump.amber | 241 + .../shuffle/inputs-outputs-mod.amber | 317 + .../shuffle/inputs-outputs.amber | 136 + .../shader_invocation/helper_invocation.amber | 193 + .../helper_invocation_volatile.amber | 193 + ...helper_invocation_volatile_mem_model.amber | 194 + ...ccess-new-vector-inside-if-condition.amber | 110 + .../always-discarding-function.amber | 384 + .../always-false-if-in-do-while.amber | 206 + .../always-false-if-with-discard-return.amber | 154 + .../arr-value-set-to-arr-value-squared.amber | 436 + ...array-idx-multiplied-by-for-loop-idx.amber | 298 + ...ssign-array-value-to-another-array-2.amber | 301 + .../assign-array-value-to-another-array.amber | 248 + .../barrier-in-loop-with-break.amber | 199 + .../break-in-do-while-with-nested-if.amber | 175 + .../call-function-with-discard.amber | 165 + .../graphicsfuzz/call-if-while-switch.amber | 196 + .../graphicsfuzz/color-set-in-for-loop.amber | 153 + .../graphicsfuzz/color-write-in-loop.amber | 195 + .../complex-nested-loops-and-call.amber | 320 + ...conditional-return-in-infinite-while.amber | 193 + .../graphicsfuzz/continue-and-merge.amber | 86 + .../control-flow-in-function.amber | 852 + .../graphicsfuzz/control-flow-switch.amber | 242 + .../graphicsfuzz/cosh-return-inf-unused.amber | 348 + .../graphicsfuzz/cov-access-array-dot.amber | 239 + .../cov-analysis-reachable-from-many.amber | 219 + .../cov-and-even-numbers-from-fragcoord.amber | 228 + .../graphicsfuzz/cov-apfloat-acos-ldexp.amber | 148 + .../cov-apfloat-determinant-for-if.amber | 225 + .../cov-apfloat-determinant.amber | 169 + .../graphicsfuzz/cov-apfloat-mix-nan.amber | 251 + .../graphicsfuzz/cov-apfloat-mod-zero.amber | 208 + .../cov-apfloat-module-small-number.amber | 223 + .../cov-apfloat-negative-step-func.amber | 197 + .../cov-apfloat-reflect-denorm.amber | 238 + .../cov-apfloat-sinh-negative-log2.amber | 206 + .../amber/graphicsfuzz/cov-apfloat-tanh.amber | 136 + .../cov-apfloat-undefined-matrix-mul.amber | 355 + .../cov-apfloat-unpackunorm-loop.amber | 188 + .../cov-array-accesses-clamp.amber | 239 + ...ast-bool-float-div-by-zero-no-effect.amber | 261 + ...cov-array-copies-loops-with-limiters.amber | 569 + ...t-element-condition-negative-modulus.amber | 287 + .../cov-asin-undefined-smoothstep.amber | 257 + .../graphicsfuzz/cov-atan-trunc-vec4.amber | 214 + .../cov-basic-block-discard-in-function.amber | 200 + vulkan/amber/graphicsfuzz/cov-bitcount.amber | 252 + .../cov-bitfieldExtract-undefined.amber | 176 + .../cov-bitfieldinsert-undefined.amber | 303 + ...v-bitfieldreverse-left-shift-findmsb.amber | 179 + ...bitfieldreverse-loop-limit-underflow.amber | 199 + ...itwise-and-variable-and-its-negation.amber | 174 + ...ov-bitwise-inverse-uniform-condition.amber | 227 + ...m-zero-tenth-bit-loop-limit-find-lsb.amber | 201 + ...itwise-shift-right-always-select-one.amber | 192 + ...hift-right-full-bits-no-effect-clamp.amber | 150 + ...cov-blockfrequency-several-for-loops.amber | 310 + ...v-branch-probability-identity-matrix.amber | 406 + .../cov-cast-float-to-int-and-back.amber | 157 + ...amp-loop-limit-increment-float-array.amber | 253 + ...-clamp-lower-limit-from-always-false.amber | 196 + .../cov-clamp-min-bitcount-uniform.amber | 222 + ...v-clamp-value-and-min-select-uniform.amber | 206 + ...tor-component-condition-using-matrix.amber | 294 + ...v-clamp-vector-element-ceil-negative.amber | 202 + ...lamp-vector-variable-negative-offset.amber | 209 + .../cov-clear-yz-inside-condition.amber | 230 + ...utput-undefined-in-unexecuted-branch.amber | 413 + ...r-overwrite-identity-matrix-multiply.amber | 192 + .../cov-combine-and-or-xor-gt-lt.amber | 215 + ...v-condition-bitfield-extract-integer.amber | 151 + ...-clamp-min-from-uniform-never-larger.amber | 201 + ...-increment-zero-to-one-divide-by-two.amber | 185 + ...cov-condition-loop-index-bitwise-not.amber | 204 + ...condition-matrix-determinant-uniform.amber | 208 + .../cov-conditional-discard-inside-loop.amber | 241 + ...s-index-array-one-divided-by-findlsb.amber | 298 + ...const-folding-bitfieldinsert-div-one.amber | 224 + .../cov-const-folding-ceil-vec4.amber | 142 + ...cov-const-folding-clamp-inside-while.amber | 142 + .../cov-const-folding-clamp-max.amber | 122 + .../cov-const-folding-clamp-min.amber | 133 + .../cov-const-folding-clamp-vs-original.amber | 136 + .../cov-const-folding-clamp.amber | 141 + .../cov-const-folding-det-identity.amber | 152 + ...cov-const-folding-dot-condition-true.amber | 109 + .../cov-const-folding-dot-determinant.amber | 104 + .../cov-const-folding-gte-const-first.amber | 134 + .../cov-const-folding-min-as-loop-range.amber | 217 + .../cov-const-folding-mod-one-one-lte.amber | 147 + .../cov-const-folding-pow-large-exp.amber | 200 + .../cov-const-folding-same-condition.amber | 173 + .../cov-const-folding-sinh-inf.amber | 147 + .../cov-const-folding-vector-shuffle.amber | 145 + .../cov-constant-folding-atan-over-tanh.amber | 109 + .../cov-constants-combine-add-sub.amber | 265 + .../cov-constants-mix-uniform.amber | 142 + ...ontinue-break-discard-return-in-loop.amber | 226 + ...nested-loop-replace-identical-values.amber | 361 + ...-output-color-swizzle-array-indexing.amber | 153 + .../cov-copy-prop-arrays-no-stores.amber | 158 + .../cov-copy-prop-arrays-param-uniform.amber | 299 + .../cov-cosh-clamped-to-one.amber | 162 + .../cov-cumulate-loops-unreachable.amber | 483 + ...ombiner-clamp-undefined-access-array.amber | 247 + ...ze-vector-types-xyz-swizzle-for-loop.amber | 218 + .../cov-dag-combiner-findmsb-loop.amber | 216 + .../cov-dag-combiner-glf_color.amber | 277 + .../cov-dag-combiner-increment-color.amber | 179 + ...ov-dag-combiner-loop-bitfieldreverse.amber | 192 + .../cov-dag-combiner-neg-div-pow2.amber | 203 + .../cov-dag-combiner-same-cond-nested.amber | 236 + .../cov-dead-branch-func-return-arg.amber | 330 + .../cov-dead-code-unreachable-merge.amber | 248 + ...ecrement-vector-elements-clamp-index.amber | 280 + ...ive-uniform-vector-global-loop-count.amber | 288 + ...escending-loop-index-temporary-array.amber | 278 + ...-descending-loop-min-max-always-zero.amber | 224 + ...nt-uninitialized-matrix-never-chosen.amber | 238 + .../cov-dfdx-dfdy-after-nested-loops.amber | 1136 + ...-condition-loop-same-condition-again.amber | 300 + ...-divide-matrix-transpose-by-constant.amber | 128 + ...o-while-loop-until-uniform-lt-itself.amber | 260 + ...nested-loops-increment-array-element.amber | 470 + ...o-while-switch-case-bitcount-findmsb.amber | 209 + .../cov-double-if-true-in-loop.amber | 216 + ...ion-fragcoord-cast-ivec2-bitwise-and.amber | 169 + ...p-array-element-increment-never-read.amber | 379 + ...y-loop-minus-one-modulo-variable-one.amber | 248 + ...-pixel-location-negate-not-equal-one.amber | 179 + vulkan/amber/graphicsfuzz/cov-exp2-two.amber | 108 + ...uniform-vec2-to-vec3-matrix-multiply.amber | 223 + ...d-msb-input-either-zero-or-minus-one.amber | 208 + .../cov-findlsb-division-by-zero.amber | 248 + .../cov-float-array-init-pow.amber | 222 + .../cov-fold-and-in-for-loop-range.amber | 172 + .../cov-fold-bitwise-and-zero.amber | 125 + .../cov-fold-bitwise-or-full-mask.amber | 126 + .../graphicsfuzz/cov-fold-bitwise-xor.amber | 117 + .../cov-fold-logical-and-const-variable.amber | 107 + .../cov-fold-logical-and-constant.amber | 148 + .../cov-fold-logical-or-constant.amber | 107 + .../cov-fold-negate-min-int-value.amber | 139 + .../cov-fold-negate-variable.amber | 109 + .../graphicsfuzz/cov-fold-shift-gte32.amber | 253 + .../cov-fold-shift-right-arithmetic.amber | 110 + .../graphicsfuzz/cov-fold-switch-udiv.amber | 113 + .../cov-folding-clamp-cmp-const-first.amber | 155 + .../cov-folding-merge-add-sub-uniform.amber | 127 + .../cov-folding-rules-construct-extract.amber | 159 + .../cov-folding-rules-dot-extract.amber | 127 + .../cov-folding-rules-dot-no-extract.amber | 128 + .../cov-folding-rules-merge-add-sub.amber | 141 + .../cov-folding-rules-merge-div-mul.amber | 138 + .../cov-folding-rules-merge-divs.amber | 136 + .../cov-folding-rules-merge-mul-div.amber | 138 + .../cov-folding-rules-merge-sub-add.amber | 159 + .../cov-folding-rules-merge-sub-sub.amber | 160 + .../cov-folding-rules-merge-var-sub.amber | 156 + ...cov-folding-rules-mix-uniform-weight.amber | 152 + .../cov-folding-rules-negate-div.amber | 130 + .../cov-folding-rules-negate-sub.amber | 134 + .../cov-folding-rules-redundant-mix.amber | 129 + .../cov-folding-rules-shuffle-extract.amber | 131 + .../cov-folding-rules-shuffle-mix.amber | 151 + .../cov-folding-rules-split-vector-init.amber | 116 + .../cov-folding-rules-vec-mix-uniform.amber | 155 + .../cov-for-array-initializing-modulo.amber | 185 + ...shift-right-integer-comparison-break.amber | 209 + ...for-loop-min-increment-array-element.amber | 236 + ...op-start-negative-increment-variable.amber | 244 + .../cov-for-loop-struct-as-iterator.amber | 226 + .../cov-for-switch-fallthrough.amber | 203 + .../cov-fract-asin-undefined-never-used.amber | 202 + .../cov-fract-smoothstep-undefined.amber | 191 + .../cov-fract-trunc-always-zero.amber | 190 + ...ditions-function-loop-global-counter.amber | 534 + .../cov-fragcoord-and-one-or-same-value.amber | 189 + ...se-and-loop-reduce-value-index-array.amber | 252 + .../cov-fragcoord-bitwise-not.amber | 184 + .../cov-fragcoord-clamp-array-access.amber | 293 + ...ver-return-index-array-using-uniform.amber | 284 + ...agcoord-integer-loop-reduce-to-range.amber | 207 + ...egative-decrease-sum-first-iteration.amber | 250 + ...ction-global-loop-counter-simplified.amber | 390 + .../graphicsfuzz/cov-fragcoord-multiply.amber | 250 + .../cov-fragcoord-select-always-one.amber | 219 + ...ays-return-negative-bitfield-extract.amber | 358 + ...ment-uniform-float-loop-never-return.amber | 257 + ...ion-call-twice-clamp-global-variable.amber | 291 + ...argument-one-always-return-minus-one.amber | 182 + ...tion-clamp-min-identical-shift-right.amber | 192 + ...unction-divide-argument-until-lt-one.amber | 291 + .../cov-function-find-lsb-ivec2-one.amber | 174 + ...on-fragcoord-condition-always-return.amber | 292 + ...n-global-loop-counter-sample-texture.amber | 605 + ...ables-fragcoord-condition-call-twice.amber | 314 + ...unction-index-array-redundant-clamps.amber | 207 + ...function-infinite-loop-always-return.amber | 219 + ...nite-loop-return-identical-condition.amber | 266 + .../cov-function-large-array-max-clamp.amber | 228 + ...e-loop-always-return-first-iteration.amber | 322 + ...break-argument-lte-global-loop-bound.amber | 267 + ...check-determinant-zero-return-vector.amber | 257 + .../cov-function-loop-clamp-no-effect.amber | 302 + ...ondition-constant-array-always-false.amber | 346 + ...n-loop-condition-uniform-shift-right.amber | 287 + ...dition-variable-less-than-min-itself.amber | 268 + ...py-array-elements-based-on-arguments.amber | 396 + ...ponents-infinite-loop-never-executed.amber | 274 + ...nditions-multiple-times-struct-array.amber | 367 + ...witch-increment-array-element-return.amber | 288 + ...tion-loop-variable-multiplied-unused.amber | 236 + ...ops-vector-mul-matrix-never-executed.amber | 590 + ...tion-max-all-ones-select-always-true.amber | 242 + ...ical-integer-division-multiplication.amber | 231 + ...ction-min-integer-large-shift-unused.amber | 151 + ...ultiple-loops-compare-integer-return.amber | 275 + ...unction-nested-do-whiles-looped-once.amber | 288 + ...sted-loops-break-early-never-discard.amber | 437 + ...sted-loops-limit-uniform-xor-uniform.amber | 355 + ...on-parameter-zero-divided-by-uniform.amber | 232 + .../cov-function-round-unpack-half-2x16.amber | 201 + ...-field-zero-loop-reset-first-element.amber | 399 + ...-struct-int-array-loop-check-element.amber | 292 + ...nt-clamp-transpose-identity-matrices.amber | 223 + .../cov-function-trivial-switch-case.amber | 112 + ...using-arguments-array-element-copies.amber | 335 + ...t-left-index-array-with-return-value.amber | 179 + .../cov-function-unpack-unorm-2x16-one.amber | 230 + ...op-iteration-icrement-global-counter.amber | 214 + ...function-variable-plus-one-minus-one.amber | 168 + .../cov-function-vec2-never-discard.amber | 263 + ...ested-loops-called-from-nested-loops.amber | 792 + ...ov-global-loop-bound-true-logical-or.amber | 213 + ...y-struct-field-set-int-array-element.amber | 389 + ...teger-condition-large-array-elements.amber | 346 + ...unter-exhaust-calling-function-twice.amber | 478 + ...cov-global-loop-counter-findlsb-zero.amber | 257 + ...loop-counter-float-accumulate-matrix.amber | 434 + ...op-function-call-inside-never-called.amber | 410 + ...obal-loop-counter-main-function-call.amber | 240 + ...obal-loop-counter-multiply-one-minus.amber | 200 + ...read-past-matrix-size-never-executed.amber | 313 + ...t-one-or-zero-never-greater-than-one.amber | 235 + ...ray-element-once-index-using-findmsb.amber | 390 + ...obal-loop-counter-squared-comparison.amber | 193 + ...ple-loop-condition-set-array-element.amber | 299 + ...cov-if-conversion-identical-branches.amber | 152 + .../cov-if-switch-fallthrough.amber | 208 + .../graphicsfuzz/cov-if-true-continue.amber | 240 + ...ue-discard-in-do-while-never-reached.amber | 202 + .../cov-if-true-float-bits-to-int-one.amber | 115 + .../cov-inc-array-element-loop-lsb.amber | 286 + .../cov-inc-inside-switch-and-for.amber | 172 + .../cov-increment-array-element-in-loop.amber | 252 + ...-increment-array-element-usub-borrow.amber | 299 + .../cov-increment-float-in-loop-abs.amber | 239 + ...crement-global-counter-loop-function.amber | 258 + .../cov-increment-inside-clamp.amber | 188 + ...increment-int-loop-counter-mod-array.amber | 214 + .../cov-increment-multiple-integers.amber | 261 + ...y-element-check-index-from-fragcoord.amber | 327 + ...ncrement-vector-array-matrix-element.amber | 250 + ...nt-vector-component-with-matrix-copy.amber | 254 + ...ent-vector-function-call-conditional.amber | 309 + ...x-array-using-uniform-bitwise-or-one.amber | 224 + ...ger-array-variable-divided-by-itself.amber | 234 + .../cov-inline-pass-empty-block.amber | 150 + .../cov-inline-pass-nested-loops.amber | 212 + .../cov-inline-pass-return-in-loop.amber | 165 + .../cov-inline-pass-unreachable-func.amber | 156 + ...cov-inst-combine-add-sub-determinant.amber | 230 + ...st-combine-add-sub-increase-negative.amber | 264 + .../cov-inst-combine-add-sub-ldexp.amber | 227 + ...ov-inst-combine-add-sub-neg-func-arg.amber | 266 + ...ov-inst-combine-add-sub-pre-increase.amber | 273 + ...ombine-and-or-xor-for-bitfieldinsert.amber | 138 + ...-inst-combine-and-or-xor-pack-unpack.amber | 288 + .../cov-inst-combine-and-or-xor-switch.amber | 235 + .../cov-inst-combine-and-or-xor-xor-add.amber | 203 + ...ne-compares-combine-select-uaddcarry.amber | 333 + .../cov-inst-combine-compares-isnan.amber | 151 + .../cov-inst-combine-compares-ldexp.amber | 188 + ...combine-compares-pre-increment-clamp.amber | 266 + ...mbine-compares-ternary-vector-access.amber | 216 + ...v-inst-combine-compares-while-modulo.amber | 201 + ...-mul-div-rem-if-undefined-divide-mix.amber | 264 + .../cov-inst-combine-pack-unpack.amber | 290 + ...nst-combine-select-findlsb-uaddcarry.amber | 415 + ...nst-combine-shifts-bitfield-bitcount.amber | 161 + ...v-inst-combine-shifts-left-shift-for.amber | 212 + ...ov-inst-combine-shifts-mix-mix-clamp.amber | 313 + ...ombine-simplify-demanded-pack-unpack.amber | 281 + ...plify-demanded-packsnorm-unpackunorm.amber | 280 + ...bine-simplify-demanded-switch-or-xor.amber | 178 + .../cov-inst-combine-vector-ops-asin.amber | 253 + .../cov-inst-peephole-optimizer-acosh.amber | 220 + .../cov-inst-value-tracking-inversesqrt.amber | 146 + .../cov-instr-emitter-pow-asinh.amber | 202 + .../cov-instr-info-det-mat-min.amber | 338 + ...ruction-simplify-atanh-log-undefined.amber | 192 + ...ov-instruction-simplify-bit-shifting.amber | 161 + ...ov-instruction-simplify-inclusive-or.amber | 188 + ...lls-for-compare-function-call-result.amber | 558 + ...truction-simplify-mod-acos-undefined.amber | 190 + ...truction-simplify-mod-sqrt-undefined.amber | 190 + .../cov-instruction-simplify-sqrt.amber | 182 + .../cov-instructions-first-value-phi.amber | 405 + ...-instructions-for-if-less-than-equal.amber | 199 + .../cov-int-div-round-to-zero.amber | 171 + ...cov-int-full-bits-divide-by-two-loop.amber | 199 + ...nitialize-from-multiple-large-arrays.amber | 2287 ++ ...le-increased-condition-array-element.amber | 232 + ...-one-increased-before-indexing-array.amber | 597 + .../cov-integer-modulo-negative.amber | 204 + ...v-integer-variable-or-with-inversion.amber | 183 + .../cov-intervalmap-set-stop.amber | 264 + ...calls-value-tracking-findmsb-incr-if.amber | 250 + .../cov-irbuilder-matrix-cell-uniform.amber | 141 + .../cov-isnan-asinh-clamp-always-zero.amber | 290 + ...orm-float-shift-right-add-components.amber | 202 + ...cov-ivec-shift-right-by-large-number.amber | 196 + ...xit-early-set-iterator-array-element.amber | 252 + ...d-loops-set-ivec-index-component-sum.amber | 262 + ...eak-early-condition-iterator-divided.amber | 292 + ...loop-multiply-integer-by-uniform-one.amber | 252 + ...e-conditions-return-discard-continue.amber | 924 + ...ned-divided-fragcoord-never-executed.amber | 221 + ...cov-ldexp-undefined-mat-vec-multiply.amber | 200 + .../cov-left-shift-array-access.amber | 176 + .../cov-left-shift-right-shift-compare.amber | 169 + .../cov-liveinterval-different-dest.amber | 242 + .../cov-loop-abs-multiply-offset.amber | 240 + ...bitfield-insert-undefined-never-read.amber | 316 + ...-array-element-copy-index-clamp-sign.amber | 283 + ...array-index-decrement-never-negative.amber | 312 + ...ruct-field-index-array-with-uniforms.amber | 301 + ...er-first-iteration-set-array-element.amber | 363 + ...-loop-break-floor-nan-never-executed.amber | 191 + ...ov-loop-break-fragcoord-x-empty-loop.amber | 229 + ...ov-loop-clamp-to-one-empty-condition.amber | 250 + ...-bitfield-extract-set-array-elements.amber | 354 + ...cov-loop-condition-clamp-vec-of-ones.amber | 293 + ...condition-constant-struct-field-data.amber | 232 + ...ition-divide-by-uniform-always-false.amber | 262 + .../cov-loop-condition-double-negate.amber | 251 + ...filter-some-iterations-never-discard.amber | 191 + ...ment-integer-fallback-global-counter.amber | 238 + ...-condition-logical-or-never-iterated.amber | 192 + ...ct-vec4-from-vec4-clamp-same-min-max.amber | 279 + ...ov-loop-decrease-integer-never-break.amber | 169 + ...ector-component-only-first-iteration.amber | 211 + ...tor-components-assign-multiple-times.amber | 236 + .../cov-loop-dfdx-constant-divide.amber | 261 + ...vide-uninitialized-vector-min-unused.amber | 236 + ...ions-sampler-struct-integer-variable.amber | 270 + ...nd-lsb-eight-fragcoord-never-discard.amber | 283 + .../cov-loop-findmsb-findlsb.amber | 222 + ...v-loop-fragcoord-identical-condition.amber | 242 + ...loop-function-call-negative-argument.amber | 430 + ...on-call-vector-matrix-multiplication.amber | 271 + ...obal-counter-break-set-ivec-elements.amber | 235 + ...er-increment-iterator-select-uniform.amber | 337 + ...ondition-uniform-copy-array-elements.amber | 271 + ...increment-array-elements-clamp-index.amber | 365 + ...array-index-array-usuborrow-feedback.amber | 334 + ...rement-integer-findmsb-minus-uniform.amber | 237 + ...ement-integer-set-output-color-break.amber | 150 + ...-element-break-after-first-iteration.amber | 307 + ...op-increment-or-divide-by-loop-index.amber | 215 + ...v-loop-index-array-max-negative-zero.amber | 252 + .../cov-loop-integer-half-minus-one.amber | 184 + .../cov-loop-iterator-bitwise-negate.amber | 208 + ...-loop-iterator-limit-xor-and-unifrom.amber | 231 + ...lus-one-variable-outside-index-array.amber | 244 + ...tart-select-uniform-negative-integer.amber | 267 + ...loop-iterator-start-shift-left-right.amber | 208 + ...rge-array-index-clamp-negative-value.amber | 707 + .../cov-loop-limiter-min-findlsb.amber | 202 + ...uniform-bitwise-and-one-always-break.amber | 171 + .../graphicsfuzz/cov-loop-logical-xor.amber | 165 + .../cov-loop-max-divide-integer-by-ten.amber | 204 + ...clamp-increment-only-first-iteration.amber | 695 + ...erator-variables-copy-array-elements.amber | 376 + ...r-iterated-constant-vector-condition.amber | 256 + ...write-sample-texture-as-color-output.amber | 295 + ...oop-read-array-index-from-array-data.amber | 204 + ...eplace-output-color-restore-original.amber | 223 + ...v-loop-returns-behind-true-and-false.amber | 228 + ...v-loop-sampled-texel-integer-counter.amber | 312 + ...v-loop-set-vector-components-pow-two.amber | 274 + ...-start-fragcoord-while-iterates-once.amber | 287 + ...ch-case-invalid-color-never-executed.amber | 199 + ...-from-one-switch-case-never-executed.amber | 215 + ...rray-field-set-value-self-dependency.amber | 409 + .../cov-loop-switch-discard-never-hit.amber | 245 + ...ators-increment-array-empty-do-while.amber | 302 + .../cov-loop-variable-less-than-itself.amber | 294 + .../cov-loop-with-two-integers.amber | 267 + ...ns-fragcoord-always-false-floats-one.amber | 365 + .../cov-loops-same-code-outside-loop.amber | 344 + ...ne-basic-block-for-for-for-less-than.amber | 337 + .../cov-machine-scheduler-for-if-pow.amber | 302 + .../cov-machinevaluetype-one-iter-loop.amber | 177 + .../cov-matching-conditions-break.amber | 247 + ...-matching-if-always-true-inside-loop.amber | 297 + .../cov-matrix-double-transpose.amber | 181 + .../cov-matrix-mult-round-even-asinh.amber | 239 + .../cov-matrix-square-mul-with-vector.amber | 184 + .../cov-max-clamp-same-minval.amber | 135 + .../graphicsfuzz/cov-max-min-less-than.amber | 165 + .../cov-mem-pass-sum-struct-members.amber | 330 + .../cov-mem-pass-unused-component.amber | 169 + .../cov-merge-return-condition-twice.amber | 195 + ...tical-uint-uniform-check-highest-bit.amber | 146 + .../cov-min-identical-uint-uniform.amber | 255 + ...-intbitstofloat-undefined-never-used.amber | 195 + ...n-negative-constant-always-below-one.amber | 175 + ...nested-loop-same-value-for-variables.amber | 446 + ...cov-min-vec2-transpose-mat2-identity.amber | 192 + ...g-return-value-function-never-called.amber | 230 + ...x-uninitialized-float-never-selected.amber | 137 + ...ized-vector-select-only-defined-data.amber | 180 + vulkan/amber/graphicsfuzz/cov-mod-acosh.amber | 193 + .../cov-mod-uint-bits-float.amber | 149 + .../graphicsfuzz/cov-modf-clamp-for.amber | 280 + .../cov-modf-integer-to-private.amber | 106 + .../cov-modulo-zero-never-executed.amber | 244 + ...ns-false-never-return-sample-texture.amber | 291 + ...ons-never-return-color-uninitialized.amber | 254 + ...ltiple-functions-global-never-change.amber | 666 + ...ion-always-false-global-loop-counter.amber | 277 + ...-loops-global-counter-write-matrices.amber | 1056 + ...er-bitwise-or-uniform-increment-loop.amber | 200 + ...d-functions-accumulate-global-matrix.amber | 399 + ...-compare-fragcood-length-zero-vector.amber | 354 + ...ons-loop-assign-global-array-element.amber | 298 + ...nctions-struct-arrays-vector-lengths.amber | 498 + ...unctions-vec4-array-element-argument.amber | 308 + ...op-continue-inner-copy-array-element.amber | 425 + ...sted-loop-decrease-vector-components.amber | 278 + ...p-initializer-value-increased-inside.amber | 289 + ...-array-index-using-vector-components.amber | 398 + ...greater-than-increment-array-element.amber | 315 + ...-undefined-smoothstep-never-executed.amber | 301 + ...oops-array-choose-red-last-iteration.amber | 284 + ...nts-from-matrix-no-negative-indexing.amber | 361 + ...sh-constant-increment-global-counter.amber | 217 + ...loops-copy-array-elements-skip-first.amber | 465 + ...nested-loops-decrease-ivec-component.amber | 243 + ...y-matrix-element-global-loop-counter.amber | 298 + ...n-rates-function-copy-array-elements.amber | 326 + ...-divide-integer-constant-always-zero.amber | 228 + ...oops-float-array-select-by-fragcoord.amber | 690 + ...ps-float-bits-to-int-increment-array.amber | 449 + ...ps-fragcoord-conditions-empty-blocks.amber | 224 + ...agcoord-never-return-descending-loop.amber | 327 + ...global-counter-func-set-struct-field.amber | 358 + ...bal-counter-increment-single-element.amber | 331 + ...op-counter-do-while-accumulate-float.amber | 665 + ...nter-fragcoord-negative-always-false.amber | 313 + ...global-loop-counter-index-array-vec2.amber | 598 + ...bal-loop-counter-iterator-dependency.amber | 310 + ...oop-counter-output-color-from-backup.amber | 262 + ...oop-counter-reached-second-iteration.amber | 309 + ...tical-iterator-names-multiply-divide.amber | 268 + ...terators-compare-same-array-elements.amber | 330 + ...d-loops-increase-integer-dot-product.amber | 272 + ...s-inner-loop-min-copy-array-elements.amber | 311 + ...d-loops-iterator-times-two-while-min.amber | 256 + ...loops-never-change-array-element-one.amber | 344 + ...cov-nested-loops-redundant-condition.amber | 289 + ...s-return-inside-while-never-executed.amber | 230 + ...nested-loops-sample-opposite-corners.amber | 578 + ...oops-select-starting-value-fragcoord.amber | 312 + ...s-set-struct-data-verify-in-function.amber | 845 + ...ubstract-matrix-element-change-float.amber | 360 + ...oops-switch-add-zero-matrix-elements.amber | 487 + ...-fallthrough-increment-array-element.amber | 308 + ...orary-copy-output-color-index-matrix.amber | 404 + ...ion-integer-range-increment-variable.amber | 312 + ...-min-iterator-condition-always-false.amber | 320 + ...nction-set-inner-struct-field-return.amber | 262 + .../graphicsfuzz/cov-nir-array-access.amber | 365 + ...ge-constants-for-clamp-vector-access.amber | 232 + ...opt-loop-unroll-if-if-if-if-do-while.amber | 250 + .../cov-not-clamp-matrix-access.amber | 252 + ...ion-fragcoord-cast-ivec2-bitwise-and.amber | 169 + ...one-bitwise-and-bitwise-or-full-bits.amber | 235 + ...e-minus-clamp-always-one-cast-to-int.amber | 170 + ...optimize-phis-for-for-do-while-if-if.amber | 293 + .../graphicsfuzz/cov-optimize-phis-for.amber | 545 + .../cov-packhalf-unpackunorm.amber | 293 + .../cov-pattern-match-signum.amber | 156 + .../cov-pattern-match-single-bit.amber | 128 + ...mizer-target-instr-info-for-if-if-if.amber | 276 + ...e-uniform-vector-constant-one-vector.amber | 193 + .../cov-pow-identical-value-sqrt.amber | 238 + ...ed-result-condition-with-always-true.amber | 223 + .../graphicsfuzz/cov-pow-undefined.amber | 171 + .../graphicsfuzz/cov-rcp-negative-int.amber | 160 + .../cov-read-matrix-push-constant.amber | 204 + .../cov-reciprocal-var-minus-one.amber | 160 + ...ov-reduce-load-array-replace-extract.amber | 183 + .../cov-reduce-load-replace-extract.amber | 228 + ...t-instr-info-for-discard-for-discard.amber | 247 + ...tialize-matrix-after-undefined-value.amber | 278 + ...ov-repeating-conditions-fract-unused.amber | 230 + .../cov-replace-copy-object.amber | 276 + .../cov-return-after-do-while.amber | 168 + .../cov-return-after-first-iteration.amber | 236 + ...n-partly-undefined-vector-from-array.amber | 224 + ...ov-sample-texture-hundred-iterations.amber | 280 + .../cov-sampler-as-function-argument.amber | 236 + ...led-number-nested-loops-array-access.amber | 545 + .../cov-scaled-number-nested-loops.amber | 381 + .../cov-schedule-dag-rrlist-mix-log-cos.amber | 180 + ...-selection-dag-assign-back-and-forth.amber | 139 + .../cov-selection-dag-inverse-clamp.amber | 194 + .../cov-selection-dag-lt-gt.amber | 198 + .../cov-selection-dag-same-cond-twice.amber | 140 + ...lements-to-uniform-check-value-break.amber | 345 + ...tput-color-function-call-nested-loop.amber | 248 + .../cov-set-vector-cos-fragcoord.amber | 273 + .../cov-sign-array-access-uaddcarry.amber | 233 + .../cov-simplification-unused-struct.amber | 283 + .../cov-simplification-while-inside-for.amber | 200 + .../cov-simplify-clamp-max-itself.amber | 207 + ...implify-combine-compares-max-max-one.amber | 159 + .../cov-simplify-component-uniform-idx.amber | 167 + .../cov-simplify-div-by-uint-one.amber | 135 + .../cov-simplify-for-bitwise-condition.amber | 193 + .../cov-simplify-ldexp-exponent-zero.amber | 132 + .../cov-simplify-max-multiplied-values.amber | 261 + .../graphicsfuzz/cov-simplify-modulo-1.amber | 180 + .../cov-simplify-mul-identity.amber | 148 + .../cov-simplify-not-less-than-neg.amber | 143 + ...mplify-right-shift-greater-than-zero.amber | 150 + .../cov-simplify-select-fragcoord.amber | 147 + .../graphicsfuzz/cov-simplify-sign-cosh.amber | 139 + .../cov-simplify-smoothstep-undef.amber | 188 + .../cov-sin-mul-mat-mat-mul-vec-mat.amber | 272 + .../cov-single-block-elim-self-assign.amber | 205 + .../cov-single-store-elim-assume-store.amber | 215 + .../amber/graphicsfuzz/cov-sinh-ldexp.amber | 241 + ...-most-uniform-value-check-data-break.amber | 301 + .../cov-ssa-rewrite-case-with-default.amber | 183 + vulkan/amber/graphicsfuzz/cov-step-sinh.amber | 114 + ...ivec-negative-modulus-empty-function.amber | 302 + ...ruct-float-array-mix-uniform-vectors.amber | 304 + ...struct-int-array-select-uniform-ivec.amber | 305 + ...-sum-uniform-vector-components-round.amber | 225 + ...fallthrough-variable-from-first-case.amber | 412 + .../cov-tail-duplicator-for-for-for.amber | 265 + .../cov-tail-duplicator-infinite-loops.amber | 275 + .../cov-target-lowering-dfdx-cos.amber | 154 + ...ares-struct-array-clamp-function-cal.amber | 417 + .../cov-texel-double-negation.amber | 289 + .../graphicsfuzz/cov-transpose-multiply.amber | 129 + .../cov-trunc-fract-always-zero.amber | 200 + ...ements-infinite-loops-never-executed.amber | 857 + ...truct-array-element-return-from-loop.amber | 318 + ...nter-clamp-ivec-elements-index-array.amber | 394 + ...t-right-zero-increment-array-element.amber | 350 + ...lobal-counter-break-square-threshold.amber | 296 + .../cov-two-loops-never-iterated.amber | 215 + ...s-switch-case-matrix-array-increment.amber | 571 + .../cov-types-return-in-main-never-hit.amber | 156 + ...cov-uadd-carry-bit-count-index-array.amber | 295 + .../cov-ucarryadd-one-and-one.amber | 188 + .../cov-undefined-inversesqrt-reflect.amber | 225 + .../cov-uniform-vector-copy.amber | 250 + ...tion-argument-mod-increment-integers.amber | 324 + ...es-passed-to-function-never-executed.amber | 291 + .../cov-unpack-unorm-mix-always-one.amber | 238 + ...v-unused-access-past-matrix-elements.amber | 315 + .../cov-unused-matrix-copy-inside-loop.amber | 327 + .../cov-val-cfg-case-fallthrough.amber | 154 + ...bine-select-value-tracking-flip-bits.amber | 205 + ...mbine-simplify-one-mod-loop-iterator.amber | 206 + .../cov-value-tracking-const-dfdy.amber | 113 + ...ant-fold-refraction-dfxd-determinant.amber | 282 + .../cov-value-tracking-inclusive-or.amber | 160 + .../cov-value-tracking-known-nonzero.amber | 213 + ...v-value-tracking-max-uintbitstofloat.amber | 211 + ...ng-selection-dag-negation-clamp-loop.amber | 434 + .../cov-value-tracking-uniform-incident.amber | 164 + ...variable-copy-in-function-tex-sample.amber | 321 + .../cov-vec2-dot-max-uniform.amber | 189 + .../cov-vec2-dot-minus-negative-zero.amber | 196 + .../cov-vec2-duplicate-min-always-half.amber | 201 + .../cov-vector-dce-inc-unused-comp.amber | 166 + .../cov-vector-dce-unused-component.amber | 121 + ...-vector-illegal-index-never-executed.amber | 240 + .../graphicsfuzz/cov-vector-log2-cosh.amber | 114 + .../cov-wrap-op-kill-for-loop.amber | 195 + .../cov-wrap-op-kill-two-branches.amber | 242 + ...ov-write-past-matrix-elements-unused.amber | 249 + .../cov-x86-instr-info-determinant-min.amber | 280 + ...86-isel-lowering-apfloat-nan-cos-cos.amber | 215 + ...6-isel-lowering-determinant-exp-acos.amber | 206 + ...ing-machine-value-type-uint-to-float.amber | 225 + ...86-isel-lowering-negative-left-shift.amber | 311 + ...lection-dag-struct-array-clamp-index.amber | 224 + .../create-color-in-do-while-for-loop.amber | 287 + .../graphicsfuzz/dead-barriers-in-loops.amber | 314 + .../amber/graphicsfuzz/dead-struct-init.amber | 114 + .../disc-and-add-in-func-in-loop.amber | 196 + .../discard-continue-return.amber | 179 + .../discard-in-array-manipulating-loop.amber | 164 + .../discard-in-loop-in-function.amber | 180 + .../amber/graphicsfuzz/discard-in-loop.amber | 162 + .../discards-in-control-flow.amber | 170 + .../graphicsfuzz/do-while-false-if.amber | 221 + .../graphicsfuzz/do-while-false-loops.amber | 199 + .../graphicsfuzz/do-while-if-return.amber | 231 + .../do-while-loop-in-conditionals.amber | 130 + .../do-while-with-always-true-if.amber | 193 + .../do-while-with-if-condition.amber | 208 + .../early-return-and-barrier.amber | 148 + .../graphicsfuzz/find-msb-from-lsb.amber | 191 + .../graphicsfuzz/flag-always-false-if.amber | 299 + .../for-condition-always-false.amber | 150 + .../graphicsfuzz/for-loop-with-return.amber | 148 + .../for-with-ifs-and-return.amber | 154 + .../frag-coord-func-call-and-ifs.amber | 350 + .../fragcoord-control-flow-2.amber | 186 + .../graphicsfuzz/fragcoord-control-flow.amber | 327 + .../function-with-float-comparison.amber | 486 + .../function-with-uniform-return.amber | 199 + .../graphicsfuzz/global-array-loops.amber | 404 + vulkan/amber/graphicsfuzz/if-and-switch.amber | 169 + .../increment-value-in-nested-for-loop.amber | 413 + vulkan/amber/graphicsfuzz/index.txt | 757 + .../injection-switch-as-comparison.amber | 215 + .../amber/graphicsfuzz/int-mat2-struct.amber | 196 + .../graphicsfuzz/loop-call-discard.amber | 333 + .../graphicsfuzz/loop-dead-if-loop.amber | 266 + .../amber/graphicsfuzz/loop-nested-ifs.amber | 186 + .../graphicsfuzz/loops-breaks-returns.amber | 239 + .../loops-ifs-continues-call.amber | 294 + .../mat-array-deep-control-flow.amber | 189 + .../graphicsfuzz/mat-array-distance.amber | 192 + .../amber/graphicsfuzz/mat-mul-in-loop.amber | 175 + .../matrices-and-return-in-loop.amber | 153 + .../max-mix-conditional-discard.amber | 175 + vulkan/amber/graphicsfuzz/mix-floor-add.amber | 109 + vulkan/amber/graphicsfuzz/modf-gl-color.amber | 85 + .../graphicsfuzz/modf-temp-modf-color.amber | 90 + .../nested-for-break-mat-color.amber | 232 + .../nested-for-loops-switch-fallthrough.amber | 557 + .../nested-for-loops-with-return.amber | 198 + .../nested-ifs-and-return-in-for-loop.amber | 174 + .../graphicsfuzz/nested-loops-switch.amber | 305 + .../nested-switch-break-discard.amber | 161 + .../amber/graphicsfuzz/one-sized-array.amber | 205 + vulkan/amber/graphicsfuzz/pow-vec4.amber | 104 + .../return-before-writing-wrong-color.amber | 162 + .../return-float-from-while-loop.amber | 190 + .../return-in-loop-in-function.amber | 184 + .../return-inside-loop-in-function.amber | 223 + .../returned-boolean-in-vector.amber | 231 + ...et-color-in-one-iteration-while-loop.amber | 222 + .../graphicsfuzz/similar-nested-ifs.amber | 252 + .../graphicsfuzz/smoothstep-after-loop.amber | 130 + .../graphicsfuzz/spv-access-chains.amber | 1307 + .../graphicsfuzz/spv-composite-phi.amber | 539 + .../amber/graphicsfuzz/spv-composite2.amber | 301 + .../amber/graphicsfuzz/spv-composites.amber | 665 + .../amber/graphicsfuzz/spv-copy-object.amber | 1308 + .../spv-dead-break-and-unroll.amber | 1316 + .../graphicsfuzz/spv-declare-bvec4.amber | 601 + .../spv-double-branch-to-same-block.amber | 1231 + .../spv-double-branch-to-same-block2.amber | 452 + .../spv-double-branch-to-same-block3.amber | 1235 + .../spv-load-from-frag-color.amber | 1452 + .../spv-null-in-phi-and-unroll.amber | 452 + ...rcation-Os-mutate-var-vector-shuffle.amber | 446 + ...bubblesort-flag-complex-conditionals.amber | 650 + ...O-mutate-composite-construct-extract.amber | 329 + ...e-colorgrid-modulo-O-move-block-down.amber | 536 + .../spv-stable-maze-O-dead-code.amber | 965 + .../spv-stable-maze-O-memory-accesses.amber | 966 + ...v-stable-maze-flatten-copy-composite.amber | 2011 ++ ...table-mergesort-O-prop-up-mutate-var.amber | 1266 + .../spv-stable-mergesort-dead-code.amber | 1216 + ...ort-flatten-selection-dead-continues.amber | 2056 ++ ...ble-mergesort-func-inline-mutate-var.amber | 1947 ++ .../spv-stable-orbit-O-mutate-variable.amber | 418 + ...orbit-Os-access-chain-mutate-pointer.amber | 614 + ...stable-pillars-O-op-select-to-op-phi.amber | 1011 + ...e-pillars-volatile-nontemporal-store.amber | 733 + .../spv-stable-quicksort-dontinline.amber | 1049 + .../spv-stable-quicksort-mat-func-param.amber | 1057 + ...rects-Os-mutate-var-push-through-var.amber | 688 + ...able-sampler-loop-extra-instructions.amber | 398 + ...-sampler-polar-simple-O-access-chain.amber | 369 + ...arysearch-tree-false-if-discard-loop.amber | 2115 ++ ...search-tree-fragcoord-less-than-zero.amber | 1195 + ...earch-tree-nested-if-and-conditional.amber | 1267 + ...rch-tree-with-loop-read-write-global.amber | 1340 + ...tz-push-constant-with-nested-min-max.amber | 551 + ...d-modulo-double-always-false-discard.amber | 702 + ...d-modulo-float-mat-determinant-clamp.amber | 689 + ...rid-modulo-injected-conditional-true.amber | 661 + ...id-modulo-true-conditional-divided-1.amber | 626 + ...-modulo-true-conditional-simple-loop.amber | 702 + ...rgrid-modulo-vec3-values-from-matrix.amber | 663 + ...gesort-clamped-conditional-bit-shift.amber | 1606 ++ ...ergesort-for-always-false-if-discard.amber | 1236 + .../stable-mergesort-reversed-for-loop.amber | 1555 ++ ...icksort-conditional-bitwise-or-clamp.amber | 1314 + ...le-quicksort-for-loop-with-injection.amber | 1438 + ...table-quicksort-if-false-else-return.amber | 1737 ++ .../stable-quicksort-max-value-as-index.amber | 1442 + ...rects-vec4-clamp-conditional-min-mix.amber | 742 + .../stable-triangle-array-nested-loop.amber | 896 + ...table-triangle-clamp-conditional-mix.amber | 745 + ...gle-nested-conditional-clamped-float.amber | 766 + ...triangle-nested-for-loop-and-true-if.amber | 771 + ...struct-and-unreachable-infinite-loop.amber | 207 + .../struct-array-data-as-loop-iterator.amber | 284 + .../graphicsfuzz/struct-array-index.amber | 198 + .../graphicsfuzz/struct-controlled-loop.amber | 207 + .../struct-used-as-temporary.amber | 117 + .../graphicsfuzz/switch-if-discard.amber | 140 + .../switch-inside-while-always-return.amber | 172 + .../graphicsfuzz/switch-loop-switch-if.amber | 241 + .../switch-with-empty-if-false.amber | 115 + .../switch-with-fall-through-cases.amber | 202 + .../swizzle-struct-init-min.amber | 157 + .../transpose-rectangular-matrix.amber | 152 + .../graphicsfuzz/two-2-iteration-loops.amber | 331 + .../two-for-loops-with-barrier-function.amber | 291 + .../graphicsfuzz/two-loops-mat-add.amber | 273 + .../amber/graphicsfuzz/two-loops-matrix.amber | 212 + .../graphicsfuzz/two-loops-set-struct.amber | 206 + .../graphicsfuzz/two-loops-with-break.amber | 217 + .../graphicsfuzz/two-nested-do-whiles.amber | 252 + .../two-nested-for-loops-with-returns.amber | 211 + .../two-nested-infinite-loops-discard.amber | 209 + .../undefined-assign-in-infinite-loop.amber | 164 + .../undefined-integer-in-function.amber | 231 + .../uninit-element-cast-in-loop.amber | 180 + .../uninitialized-var-decrement-and-add.amber | 133 + .../unreachable-barrier-in-loops.amber | 373 + .../unreachable-continue-statement.amber | 182 + .../unreachable-discard-statement-in-if.amber | 189 + .../unreachable-discard-statement.amber | 198 + .../unreachable-loops-in-switch.amber | 193 + .../graphicsfuzz/unreachable-loops.amber | 166 + .../unreachable-return-in-loop.amber | 150 + ...nreachable-switch-case-with-discards.amber | 228 + .../uv-value-comparison-as-boolean.amber | 167 + vulkan/amber/graphicsfuzz/vec2-modf.amber | 129 + ...ector-values-multiplied-by-fragcoord.amber | 311 + .../vectors-and-discard-in-function.amber | 179 + .../while-function-always-false.amber | 166 + .../graphicsfuzz/while-inside-switch.amber | 169 + .../graphicsfuzz/write-before-break.amber | 342 + .../graphicsfuzz/write-red-after-search.amber | 1065 + .../graphicsfuzz/write-red-in-loop-nest.amber | 323 + .../wrong-color-in-always-false-if.amber | 151 + vulkan/amber/ldexp/README.TXT | 63 + vulkan/amber/ldexp/exp64_needed_fixes.txt | 9 + vulkan/amber/ldexp/gen_amber.py | 168 + vulkan/amber/ldexp/gen_shaders.py | 44 + vulkan/amber/ldexp/gen_spv.sh | 4 + vulkan/amber/ldexp/gen_spvasm.sh | 4 + vulkan/amber/ldexp/glsl_fails.txt | 9 + .../amber/ldexp/ldexp_f16vec2_i16vec2.amber | 307 + vulkan/amber/ldexp/ldexp_f16vec2_i16vec2.glsl | 29 + .../ldexp/ldexp_f16vec2_i16vec2.glsl.spv | Bin 0 -> 1996 bytes .../ldexp_f16vec2_i16vec2.glsl.spv.spvasm | 129 + .../amber/ldexp/ldexp_f16vec2_i32vec2.amber | 304 + vulkan/amber/ldexp/ldexp_f16vec2_i32vec2.glsl | 29 + .../ldexp/ldexp_f16vec2_i32vec2.glsl.spv | Bin 0 -> 1972 bytes .../ldexp_f16vec2_i32vec2.glsl.spv.spvasm | 127 + .../amber/ldexp/ldexp_f16vec2_i64vec2.amber | 307 + vulkan/amber/ldexp/ldexp_f16vec2_i64vec2.glsl | 29 + .../ldexp/ldexp_f16vec2_i64vec2.glsl.spv | Bin 0 -> 1996 bytes .../ldexp_f16vec2_i64vec2.glsl.spv.spvasm | 129 + vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.amber | 311 + vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.glsl | 29 + .../amber/ldexp/ldexp_f16vec2_i8vec2.glsl.spv | Bin 0 -> 2048 bytes .../ldexp_f16vec2_i8vec2.glsl.spv.spvasm | 132 + .../amber/ldexp/ldexp_f16vec4_i16vec4.amber | 307 + vulkan/amber/ldexp/ldexp_f16vec4_i16vec4.glsl | 29 + .../ldexp/ldexp_f16vec4_i16vec4.glsl.spv | Bin 0 -> 1996 bytes .../ldexp_f16vec4_i16vec4.glsl.spv.spvasm | 129 + .../amber/ldexp/ldexp_f16vec4_i32vec4.amber | 304 + vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.glsl | 29 + .../ldexp/ldexp_f16vec4_i32vec4.glsl.spv | Bin 0 -> 1972 bytes .../ldexp_f16vec4_i32vec4.glsl.spv.spvasm | 127 + .../amber/ldexp/ldexp_f16vec4_i64vec4.amber | 307 + vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.glsl | 29 + .../ldexp/ldexp_f16vec4_i64vec4.glsl.spv | Bin 0 -> 1996 bytes .../ldexp_f16vec4_i64vec4.glsl.spv.spvasm | 129 + vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.amber | 311 + vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.glsl | 29 + .../amber/ldexp/ldexp_f16vec4_i8vec4.glsl.spv | Bin 0 -> 2048 bytes .../ldexp_f16vec4_i8vec4.glsl.spv.spvasm | 132 + .../amber/ldexp/ldexp_f32vec2_i16vec2.amber | 306 + vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.glsl | 29 + .../ldexp/ldexp_f32vec2_i16vec2.glsl.spv | Bin 0 -> 2004 bytes .../ldexp_f32vec2_i16vec2.glsl.spv.spvasm | 129 + .../amber/ldexp/ldexp_f32vec2_i32vec2.amber | 299 + vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.glsl | 29 + .../ldexp/ldexp_f32vec2_i32vec2.glsl.spv | Bin 0 -> 1928 bytes .../ldexp_f32vec2_i32vec2.glsl.spv.spvasm | 124 + .../amber/ldexp/ldexp_f32vec2_i64vec2.amber | 302 + vulkan/amber/ldexp/ldexp_f32vec2_i64vec2.glsl | 29 + .../ldexp/ldexp_f32vec2_i64vec2.glsl.spv | Bin 0 -> 1968 bytes .../ldexp_f32vec2_i64vec2.glsl.spv.spvasm | 127 + vulkan/amber/ldexp/ldexp_f32vec2_i8vec2.amber | 305 + vulkan/amber/ldexp/ldexp_f32vec2_i8vec2.glsl | 29 + .../amber/ldexp/ldexp_f32vec2_i8vec2.glsl.spv | Bin 0 -> 2004 bytes .../ldexp_f32vec2_i8vec2.glsl.spv.spvasm | 129 + .../amber/ldexp/ldexp_f32vec4_i16vec4.amber | 306 + vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.glsl | 29 + .../ldexp/ldexp_f32vec4_i16vec4.glsl.spv | Bin 0 -> 2004 bytes .../ldexp_f32vec4_i16vec4.glsl.spv.spvasm | 129 + .../amber/ldexp/ldexp_f32vec4_i32vec4.amber | 299 + vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.glsl | 29 + .../ldexp/ldexp_f32vec4_i32vec4.glsl.spv | Bin 0 -> 1928 bytes .../ldexp_f32vec4_i32vec4.glsl.spv.spvasm | 124 + .../amber/ldexp/ldexp_f32vec4_i64vec4.amber | 302 + vulkan/amber/ldexp/ldexp_f32vec4_i64vec4.glsl | 29 + .../ldexp/ldexp_f32vec4_i64vec4.glsl.spv | Bin 0 -> 1968 bytes .../ldexp_f32vec4_i64vec4.glsl.spv.spvasm | 127 + vulkan/amber/ldexp/ldexp_f32vec4_i8vec4.amber | 305 + vulkan/amber/ldexp/ldexp_f32vec4_i8vec4.glsl | 29 + .../amber/ldexp/ldexp_f32vec4_i8vec4.glsl.spv | Bin 0 -> 2004 bytes .../ldexp_f32vec4_i8vec4.glsl.spv.spvasm | 129 + .../amber/ldexp/ldexp_f64vec2_i16vec2.amber | 308 + vulkan/amber/ldexp/ldexp_f64vec2_i16vec2.glsl | 29 + .../ldexp/ldexp_f64vec2_i16vec2.glsl.spv | Bin 0 -> 2012 bytes .../ldexp_f64vec2_i16vec2.glsl.spv.spvasm | 130 + .../amber/ldexp/ldexp_f64vec2_i32vec2.amber | 300 + vulkan/amber/ldexp/ldexp_f64vec2_i32vec2.glsl | 29 + .../ldexp/ldexp_f64vec2_i32vec2.glsl.spv | Bin 0 -> 1936 bytes .../ldexp_f64vec2_i32vec2.glsl.spv.spvasm | 125 + .../amber/ldexp/ldexp_f64vec2_i64vec2.amber | 304 + vulkan/amber/ldexp/ldexp_f64vec2_i64vec2.glsl | 29 + .../ldexp/ldexp_f64vec2_i64vec2.glsl.spv | Bin 0 -> 1976 bytes .../ldexp_f64vec2_i64vec2.glsl.spv.spvasm | 128 + vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.amber | 307 + vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.glsl | 29 + .../amber/ldexp/ldexp_f64vec2_i8vec2.glsl.spv | Bin 0 -> 2012 bytes .../ldexp_f64vec2_i8vec2.glsl.spv.spvasm | 130 + .../amber/ldexp/ldexp_f64vec4_i16vec4.amber | 308 + vulkan/amber/ldexp/ldexp_f64vec4_i16vec4.glsl | 29 + .../ldexp/ldexp_f64vec4_i16vec4.glsl.spv | Bin 0 -> 2012 bytes .../ldexp_f64vec4_i16vec4.glsl.spv.spvasm | 130 + .../amber/ldexp/ldexp_f64vec4_i32vec4.amber | 300 + vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.glsl | 29 + .../ldexp/ldexp_f64vec4_i32vec4.glsl.spv | Bin 0 -> 1936 bytes .../ldexp_f64vec4_i32vec4.glsl.spv.spvasm | 125 + .../amber/ldexp/ldexp_f64vec4_i64vec4.amber | 304 + vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.glsl | 29 + .../ldexp/ldexp_f64vec4_i64vec4.glsl.spv | Bin 0 -> 1976 bytes .../ldexp_f64vec4_i64vec4.glsl.spv.spvasm | 128 + vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.amber | 307 + vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.glsl | 29 + .../amber/ldexp/ldexp_f64vec4_i8vec4.glsl.spv | Bin 0 -> 2012 bytes .../ldexp_f64vec4_i8vec4.glsl.spv.spvasm | 130 + vulkan/amber/ldexp/ldexp_float16_int16.amber | 305 + vulkan/amber/ldexp/ldexp_float16_int32.amber | 302 + vulkan/amber/ldexp/ldexp_float16_int64.amber | 305 + vulkan/amber/ldexp/ldexp_float16_int8.amber | 308 + .../amber/ldexp/ldexp_float16_t_int16_t.glsl | 29 + .../ldexp/ldexp_float16_t_int16_t.glsl.spv | Bin 0 -> 1964 bytes .../ldexp_float16_t_int16_t.glsl.spv.spvasm | 127 + .../amber/ldexp/ldexp_float16_t_int32_t.glsl | 29 + .../ldexp/ldexp_float16_t_int32_t.glsl.spv | Bin 0 -> 1940 bytes .../ldexp_float16_t_int32_t.glsl.spv.spvasm | 125 + .../amber/ldexp/ldexp_float16_t_int64_t.glsl | 29 + .../ldexp/ldexp_float16_t_int64_t.glsl.spv | Bin 0 -> 1964 bytes .../ldexp_float16_t_int64_t.glsl.spv.spvasm | 127 + .../amber/ldexp/ldexp_float16_t_int8_t.glsl | 29 + .../ldexp/ldexp_float16_t_int8_t.glsl.spv | Bin 0 -> 2000 bytes .../ldexp_float16_t_int8_t.glsl.spv.spvasm | 129 + vulkan/amber/ldexp/ldexp_float32_int16.amber | 303 + vulkan/amber/ldexp/ldexp_float32_int32.amber | 297 + vulkan/amber/ldexp/ldexp_float32_int64.amber | 299 + vulkan/amber/ldexp/ldexp_float32_int8.amber | 302 + .../amber/ldexp/ldexp_float32_t_int16_t.glsl | 29 + .../ldexp/ldexp_float32_t_int16_t.glsl.spv | Bin 0 -> 1956 bytes .../ldexp_float32_t_int16_t.glsl.spv.spvasm | 126 + .../amber/ldexp/ldexp_float32_t_int32_t.glsl | 29 + .../ldexp/ldexp_float32_t_int32_t.glsl.spv | Bin 0 -> 1896 bytes .../ldexp_float32_t_int32_t.glsl.spv.spvasm | 122 + .../amber/ldexp/ldexp_float32_t_int64_t.glsl | 29 + .../ldexp/ldexp_float32_t_int64_t.glsl.spv | Bin 0 -> 1920 bytes .../ldexp_float32_t_int64_t.glsl.spv.spvasm | 124 + .../amber/ldexp/ldexp_float32_t_int8_t.glsl | 29 + .../ldexp/ldexp_float32_t_int8_t.glsl.spv | Bin 0 -> 1956 bytes .../ldexp_float32_t_int8_t.glsl.spv.spvasm | 126 + vulkan/amber/ldexp/ldexp_float64_int16.amber | 305 + vulkan/amber/ldexp/ldexp_float64_int32.amber | 298 + vulkan/amber/ldexp/ldexp_float64_int64.amber | 301 + vulkan/amber/ldexp/ldexp_float64_int8.amber | 304 + .../amber/ldexp/ldexp_float64_t_int16_t.glsl | 29 + .../ldexp/ldexp_float64_t_int16_t.glsl.spv | Bin 0 -> 1964 bytes .../ldexp_float64_t_int16_t.glsl.spv.spvasm | 127 + .../amber/ldexp/ldexp_float64_t_int32_t.glsl | 29 + .../ldexp/ldexp_float64_t_int32_t.glsl.spv | Bin 0 -> 1904 bytes .../ldexp_float64_t_int32_t.glsl.spv.spvasm | 123 + .../amber/ldexp/ldexp_float64_t_int64_t.glsl | 29 + .../ldexp/ldexp_float64_t_int64_t.glsl.spv | Bin 0 -> 1928 bytes .../ldexp_float64_t_int64_t.glsl.spv.spvasm | 125 + .../amber/ldexp/ldexp_float64_t_int8_t.glsl | 29 + .../ldexp/ldexp_float64_t_int8_t.glsl.spv | Bin 0 -> 1964 bytes .../ldexp_float64_t_int8_t.glsl.spv.spvasm | 127 + vulkan/amber/ldexp/template.amber | 50 + vulkan/amber/ldexp/template.glsl | 29 + .../permuted_index/barrier.amber | 87 + .../permuted_index/release_acquire.amber | 78 + .../release_acquire_atomic_payload.amber | 78 + .../unexecuted_oob_overflow.amber | 105 + .../unexecuted_oob_underflow.amber | 105 + .../restart_disabled_line_list_uint16.amber | 94 + .../restart_disabled_line_list_uint8.amber | 95 + ...bled_line_list_with_adjacency_uint16.amber | 113 + ...abled_line_list_with_adjacency_uint8.amber | 114 + .../restart_disabled_line_strip_uint16.amber | 92 + .../restart_disabled_line_strip_uint8.amber | 94 + ...led_line_strip_with_adjacency_uint16.amber | 111 + ...bled_line_strip_with_adjacency_uint8.amber | 113 + .../restart_disabled_patch_list_uint16.amber | 132 + .../restart_disabled_patch_list_uint8.amber | 136 + .../restart_disabled_point_list_uint16.amber | 102 + .../restart_disabled_point_list_uint8.amber | 103 + ...restart_disabled_triangle_fan_uint16.amber | 92 + .../restart_disabled_triangle_fan_uint8.amber | 94 + ...estart_disabled_triangle_list_uint16.amber | 94 + ...restart_disabled_triangle_list_uint8.amber | 95 + ..._triangle_list_with_adjacency_uint16.amber | 113 + ...d_triangle_list_with_adjacency_uint8.amber | 114 + ...start_disabled_triangle_strip_uint16.amber | 92 + ...estart_disabled_triangle_strip_uint8.amber | 94 + ...triangle_strip_with_adjacency_uint16.amber | 111 + ..._triangle_strip_with_adjacency_uint8.amber | 113 + .../amber/pipeline/layer_read_from_frag.amber | 62 + .../centroid.amber | 84 + .../offset.amber | 85 + .../sample.amber | 84 + vulkan/amber/pipeline/position_to_ssbo.amber | 43 + .../pipeline/primitive_id_from_tess.amber | 114 + .../pipeline/reinterpolate_at_centroid.amber | 52 + .../pipeline/reinterpolate_at_sample.amber | 52 + .../rasterization/depth_bias/d16_unorm.amber | 186 + .../depth_bias/d16_unorm_constant_one.amber | 232 + .../d16_unorm_constant_one_greater.amber | 104 + .../d16_unorm_constant_one_less.amber | 104 + .../depth_bias/d16_unorm_slope.amber | 232 + .../rasterization/depth_bias/d24_unorm.amber | 186 + .../depth_bias/d24_unorm_constant_one.amber | 232 + .../d24_unorm_constant_one_greater.amber | 104 + .../d24_unorm_constant_one_less.amber | 104 + .../rasterization/depth_bias/d32_sfloat.amber | 153 + .../depth_bias/d32_sfloat_constant_one.amber | 232 + .../d32_sfloat_constant_one_greater.amber | 104 + .../d32_sfloat_constant_one_less.amber | 104 + .../line_continuity/line-strip.amber | 188 + .../line_continuity/polygon-mode-lines.amber | 193 + vulkan/amber/ray_tracing/barycentrics.amber | 111 + vulkan/amber/ray_tracing/basic.amber | 110 + vulkan/amber/ray_tracing/basic2.amber | 202 + vulkan/amber/ray_tracing/basic_lib.amber | 156 + .../ray_tracing/different-payload-sizes.amber | 87 + vulkan/amber/ray_tracing/divergent-as.amber | 102 + .../ray_tracing/flags-accept-first.amber | 89 + vulkan/amber/ray_tracing/flags-culling.amber | 114 + .../ray_tracing/flags-force-non-opaque.amber | 80 + .../ray_tracing/flags-force-opaque.amber | 76 + .../amber/ray_tracing/flags-skip-chit.amber | 74 + vulkan/amber/ray_tracing/rt-sample.amber | 112 + .../maximal/fragment/demote_entire_quad.amber | 127 + .../fragment/demote_half_quad_backslash.amber | 127 + .../fragment/demote_half_quad_bottom.amber | 127 + .../fragment/demote_half_quad_left.amber | 127 + .../fragment/demote_half_quad_right.amber | 127 + .../fragment/demote_half_quad_slash.amber | 127 + .../fragment/demote_half_quad_top.amber | 127 + .../maximal/fragment/demote_invocation.amber | 127 + .../fragment/terminate_invocation.amber | 81 + ...rray-stride-larger-than-element-size.amber | 209 + .../compute/mul_extended/signed_16bit.amber | 352 + .../compute/mul_extended/signed_32bit.amber | 347 + .../compute/mul_extended/signed_64bit.amber | 351 + .../compute/mul_extended/signed_8bit.amber | 352 + .../compute/mul_extended/unsigned_16bit.amber | 352 + .../compute/mul_extended/unsigned_32bit.amber | 347 + .../compute/mul_extended/unsigned_64bit.amber | 351 + .../compute/mul_extended/unsigned_8bit.amber | 352 + .../compute/ptr_access_chain/workgroup.amber | 120 + .../workgroup_bad_stride.amber | 120 + .../uint_sgreaterthan.amber | 69 + .../uint_sgreaterthanequal.amber | 69 + .../signed_int_compare/uint_slessthan.amber | 69 + .../uint_slessthanequal.amber | 69 + .../compute/signed_op/glsl_int_findumsb.amber | 76 + .../compute/signed_op/glsl_int_uclamp.amber | 97 + .../compute/signed_op/glsl_int_umax.amber | 91 + .../compute/signed_op/glsl_int_umin.amber | 91 + .../signed_op/glsl_uint_findsmsb.amber | 74 + .../compute/signed_op/glsl_uint_sabs.amber | 74 + .../compute/signed_op/glsl_uint_sclamp.amber | 94 + .../compute/signed_op/glsl_uint_smax.amber | 83 + .../compute/signed_op/glsl_uint_smin.amber | 83 + .../compute/signed_op/glsl_uint_ssign.amber | 74 + .../compute/signed_op/int_atomicumax.amber | 76 + .../compute/signed_op/int_atomicumin.amber | 76 + .../compute/signed_op/int_ugreaterthan.amber | 94 + .../signed_op/int_ugreaterthanequal.amber | 94 + .../compute/signed_op/int_ulessthan.amber | 94 + .../signed_op/int_ulessthanequal.amber | 94 + .../compute/signed_op/uint_atomicsmax.amber | 74 + .../compute/signed_op/uint_atomicsmin.amber | 73 + .../compute/signed_op/uint_sdiv.amber | 82 + .../compute/signed_op/uint_smulextended.amber | 102 + .../compute/signed_op/uint_snegate.amber | 73 + .../compute/signed_op/uint_umulextended.amber | 100 + .../switch/switch-case-to-merge-block.amber | 117 + .../undef/undefined_constant_composite.amber | 135 + .../undefined_spec_constant_composite.amber | 155 + .../unreachable-switch-merge-in-loop.amber | 150 + .../vector_shuffle/vector_shuffle.amber | 84 + .../comparison/frexpstruct_1_comp.amber | 211 + .../comparison/frexpstruct_1_frag.amber | 283 + .../comparison/frexpstruct_1_geom.amber | 425 + .../comparison/frexpstruct_1_tesc.amber | 581 + .../comparison/frexpstruct_1_tese.amber | 537 + .../comparison/frexpstruct_1_vert.amber | 330 + .../comparison/frexpstruct_2_comp.amber | 215 + .../comparison/frexpstruct_2_frag.amber | 288 + .../comparison/frexpstruct_2_geom.amber | 431 + .../comparison/frexpstruct_2_tesc.amber | 589 + .../comparison/frexpstruct_2_tese.amber | 542 + .../comparison/frexpstruct_2_vert.amber | 335 + .../comparison/frexpstruct_3_comp.amber | 215 + .../comparison/frexpstruct_3_frag.amber | 288 + .../comparison/frexpstruct_3_geom.amber | 431 + .../comparison/frexpstruct_3_tesc.amber | 587 + .../comparison/frexpstruct_3_tese.amber | 541 + .../comparison/frexpstruct_3_vert.amber | 336 + .../comparison/frexpstruct_4_comp.amber | 215 + .../comparison/frexpstruct_4_frag.amber | 267 + .../comparison/frexpstruct_4_geom.amber | 408 + .../comparison/frexpstruct_4_tesc.amber | 563 + .../comparison/frexpstruct_4_tese.amber | 519 + .../comparison/frexpstruct_4_vert.amber | 313 + .../float32/comparison/grid_vertices.txt | 1297 + .../instruction/float32/comparison/input.txt | 444 + .../comparison/modfstruct_1_comp.amber | 195 + .../comparison/modfstruct_1_frag.amber | 278 + .../comparison/modfstruct_1_geom.amber | 421 + .../comparison/modfstruct_1_tesc.amber | 576 + .../comparison/modfstruct_1_tese.amber | 532 + .../comparison/modfstruct_1_vert.amber | 323 + .../comparison/modfstruct_2_comp.amber | 198 + .../comparison/modfstruct_2_frag.amber | 282 + .../comparison/modfstruct_2_geom.amber | 425 + .../comparison/modfstruct_2_tesc.amber | 583 + .../comparison/modfstruct_2_tese.amber | 536 + .../comparison/modfstruct_2_vert.amber | 327 + .../comparison/modfstruct_3_comp.amber | 198 + .../comparison/modfstruct_3_frag.amber | 282 + .../comparison/modfstruct_3_geom.amber | 425 + .../comparison/modfstruct_3_tesc.amber | 581 + .../comparison/modfstruct_3_tese.amber | 535 + .../comparison/modfstruct_3_vert.amber | 328 + .../comparison/modfstruct_4_comp.amber | 198 + .../comparison/modfstruct_4_frag.amber | 261 + .../comparison/modfstruct_4_geom.amber | 402 + .../comparison/modfstruct_4_tesc.amber | 557 + .../comparison/modfstruct_4_tese.amber | 513 + .../comparison/modfstruct_4_vert.amber | 305 + .../function_params/sampler_param.amber | 130 + .../early_and_late_fragment/depth_equal.amber | 155 + .../depth_greater.amber | 155 + .../depth_greater_or_equal.amber | 155 + .../early_and_late_fragment/depth_less.amber | 155 + .../depth_less_or_equal.amber | 155 + .../depth_not_equal.amber | 155 + .../graphics/early_fragment/depth_equal.amber | 150 + .../early_fragment/depth_greater.amber | 151 + .../depth_greater_or_equal.amber | 150 + .../graphics/early_fragment/depth_less.amber | 151 + .../early_fragment/depth_less_or_equal.amber | 150 + .../early_fragment/depth_not_equal.amber | 150 + .../execution_mode/depthgreater_0.amber | 145 + .../execution_mode/depthgreater_1.amber | 145 + .../execution_mode/depthgreater_2.amber | 145 + .../execution_mode/depthgreater_3.amber | 145 + .../execution_mode/depthgreater_4.amber | 145 + .../graphics/execution_mode/depthless_0.amber | 145 + .../graphics/execution_mode/depthless_1.amber | 145 + .../graphics/execution_mode/depthless_2.amber | 145 + .../graphics/execution_mode/depthless_3.amber | 145 + .../graphics/execution_mode/depthless_4.amber | 145 + .../execution_mode/depthunchanged_0.amber | 153 + .../execution_mode/depthunchanged_1.amber | 153 + .../execution_mode/depthunchanged_2.amber | 145 + .../execution_mode/depthunchanged_3.amber | 145 + .../mixedrelaxedprecisionoperands.amber | 1436 + .../image_query/samples_storage.amber | 89 + .../entrypoint/comp_pc_entry_point.amber | 79 + .../entrypoint/comp_ssbo_entry_point.amber | 84 + .../entrypoint/comp_ubo_entry_point.amber | 87 + .../comp_workgroup_entry_point.amber | 94 + .../entrypoint/frag_pc_entry_point.amber | 57 + .../entrypoint/frag_ssbo_entry_point.amber | 62 + .../entrypoint/frag_ubo_entry_point.amber | 60 + .../entrypoint/geom_pc_entry_point.amber | 148 + .../entrypoint/geom_ssbo_entry_point.amber | 150 + .../entrypoint/geom_ubo_entry_point.amber | 151 + .../entrypoint/tess_con_pc_entry_point.amber | 192 + .../tess_con_ssbo_entry_point.amber | 196 + .../entrypoint/tess_con_ubo_entry_point.amber | 195 + .../entrypoint/tess_eval_pc_entry_point.amber | 210 + .../tess_eval_ssbo_entry_point.amber | 213 + .../tess_eval_ubo_entry_point.amber | 213 + .../entrypoint/vert_pc_entry_point.amber | 156 + .../entrypoint/vert_ssbo_entry_point.amber | 99 + .../entrypoint/vert_ubo_entry_point.amber | 99 + .../hlsl_functionality1/counter_buffer.amber | 104 + .../hlsl_functionality1/decorate_string.amber | 106 + .../member_decorate_string.amber | 123 + .../loop_control/iteration_multiple.amber | 118 + .../loop_control/max_iterations.amber | 118 + .../loop_control/min_iterations.amber | 118 + .../spirv1p4/loop_control/partial_count.amber | 118 + .../spirv1p4/loop_control/peel_count.amber | 118 + .../nonwritable/function_2_nonwritable.amber | 92 + .../nonwritable/function_nonwritable.amber | 111 + .../non_main_function_nonwritable.amber | 45 + .../nonwritable/private_2_nonwritable.amber | 93 + .../nonwritable/private_nonwritable.amber | 111 + .../different_matrix_layout.amber | 59 + .../different_matrix_strides.amber | 59 + ...nested_arrays_different_inner_stride.amber | 84 + ...nested_arrays_different_outer_stride.amber | 77 + .../nested_arrays_different_strides.amber | 84 + .../opcopylogical/same_array_two_ids.amber | 58 + .../opcopylogical/same_struct_two_ids.amber | 53 + .../spirv1p4/opcopylogical/ssbo_to_ubo.amber | 94 + .../two_arrays_different_stride_1.amber | 58 + .../two_arrays_different_stride_2.amber | 58 + .../spirv1p4/opcopylogical/ubo_to_ssbo.amber | 96 + .../opcopymemory/different_alignments.amber | 61 + .../no_source_access_operands.amber | 62 + .../no_target_access_operands.amber | 62 + .../opptrdiff/ssbo_comparisons_diff.amber | 171 + .../variable_pointers_vars_ssbo_2_diff.amber | 153 + .../variable_pointers_vars_ssbo_diff.amber | 141 + .../variable_pointers_vars_wg_diff.amber | 126 + .../opptrdiff/wg_comparisons_diff.amber | 155 + .../opptrequal/different_ssbos_equal.amber | 110 + .../opptrequal/different_wgs_equal.amber | 105 + .../null_comparisons_ssbo_equal.amber | 86 + .../null_comparisons_wg_equal.amber | 82 + .../simple_variable_pointers_ptr_equal.amber | 121 + .../opptrequal/ssbo_comparisons_equal.amber | 174 + .../variable_pointers_ssbo_2_equal.amber | 130 + .../variable_pointers_ssbo_equal.amber | 110 + .../variable_pointers_vars_ssbo_equal.amber | 136 + .../variable_pointers_vars_wg_equal.amber | 122 + .../variable_pointers_wg_equal.amber | 95 + .../opptrequal/wg_comparisons_equal.amber | 157 + .../different_ssbos_not_equal.amber | 110 + .../different_wgs_not_equal.amber | 107 + .../null_comparisons_ssbo_not_equal.amber | 87 + .../null_comparisons_wg_not_equal.amber | 83 + ...mple_variable_pointers_ptr_not_equal.amber | 121 + .../ssbo_comparisons_not_equal.amber | 174 + .../variable_pointers_ssbo_2_not_equal.amber | 131 + .../variable_pointers_ssbo_not_equal.amber | 112 + ...ariable_pointers_vars_ssbo_not_equal.amber | 136 + .../variable_pointers_vars_wg_not_equal.amber | 122 + .../variable_pointers_wg_not_equal.amber | 95 + .../wg_comparisons_not_equal.amber | 159 + .../spirv1p4/opselect/array_select.amber | 66 + .../opselect/array_stride_select.amber | 74 + .../opselect/nested_array_select.amber | 75 + .../opselect/nested_struct_select.amber | 74 + .../spirv1p4/opselect/scalar_select.amber | 78 + .../opselect/ssbo_pointers_2_select.amber | 81 + .../opselect/ssbo_pointers_select.amber | 74 + .../spirv1p4/opselect/struct_select.amber | 129 + .../opselect/vector_element_select.amber | 64 + .../spirv1p4/opselect/vector_select.amber | 128 + .../opselect/wg_pointers_2_select.amber | 85 + .../opselect/wg_pointers_select.amber | 87 + .../uconvert/spec_const_opt_extend_16.amber | 48 + .../spec_const_opt_extend_16_64_bit.amber | 47 + ...c_const_opt_extend_251658240_64_bits.amber | 47 + .../spec_const_opt_extend_61440.amber | 48 + .../uconvert/spec_const_opt_truncate_16.amber | 51 + .../spec_const_opt_truncate_16_64_bit.amber | 47 + .../spec_const_opt_truncate_983040.amber | 50 + .../spec_const_opt_zero_extend_n4096.amber | 50 + .../partially_active_uniform_id.amber | 72 + .../uniformid/subgroup_cfg_uniform_id.amber | 75 + .../spirv1p4/uniformid/subgroup_uniform.amber | 66 + .../uniformid/workgroup_cfg_uniform_id.amber | 74 + .../uniformid/workgroup_uniform.amber | 65 + .../spirv1p4/wrap/no_signed_wrap.amber | 47 + .../spirv1p4/wrap/no_unsigned_wrap.amber | 47 + .../no_image_atomic.amber | 169 + .../terminate_invocation/no_image_store.amber | 168 + .../no_null_pointer_load.amber | 189 + .../no_null_pointer_store.amber | 189 + .../no_out_of_bounds_atomic.amber | 198 + .../no_out_of_bounds_load.amber | 195 + .../no_out_of_bounds_store.amber | 194 + .../no_output_write.amber | 163 + .../no_output_write_before_terminate.amber | 162 + .../terminate_invocation/no_ssbo_atomic.amber | 176 + .../terminate_invocation/no_ssbo_store.amber | 174 + .../ssbo_atomic_before_terminate.amber | 174 + .../ssbo_store_before_terminate.amber | 173 + .../subgroup_ballot.amber | 230 + .../terminate_invocation/subgroup_vote.amber | 180 + .../terminate_invocation/terminate_loop.amber | 176 + .../subgroup_reconverge_discard00.amber | 84 + .../large/subgroup_reconverge00.amber | 76 + .../large/subgroup_reconverge01.amber | 75 + .../large/subgroup_reconverge02.amber | 77 + .../large/subgroup_reconverge03.amber | 77 + .../large/subgroup_reconverge04.amber | 78 + .../large/subgroup_reconverge05.amber | 78 + .../large/subgroup_reconverge06.amber | 83 + .../large/subgroup_reconverge07.amber | 82 + .../large/subgroup_reconverge08.amber | 79 + .../large/subgroup_reconverge09.amber | 86 + .../large/subgroup_reconverge10.amber | 86 + .../large/subgroup_reconverge11.amber | 87 + .../large/subgroup_reconverge12.amber | 86 + .../large/subgroup_reconverge13.amber | 86 + .../large/subgroup_reconverge14.amber | 84 + .../large/subgroup_reconverge15.amber | 95 + .../large/subgroup_reconverge16.amber | 89 + .../large/subgroup_reconverge17.amber | 80 + .../large/subgroup_reconverge18.amber | 84 + .../large/subgroup_reconverge19.amber | 88 + .../large/subgroup_reconverge20.amber | 133 + .../large/subgroup_reconverge_partial00.amber | 77 + .../large/subgroup_reconverge_partial01.amber | 75 + .../large/subgroup_reconverge_partial02.amber | 77 + .../large/subgroup_reconverge_partial03.amber | 77 + .../large/subgroup_reconverge_partial04.amber | 78 + .../large/subgroup_reconverge_partial05.amber | 78 + .../large/subgroup_reconverge_partial06.amber | 83 + .../large/subgroup_reconverge_partial07.amber | 82 + .../large/subgroup_reconverge_partial08.amber | 79 + .../large/subgroup_reconverge_partial09.amber | 86 + .../large/subgroup_reconverge_partial10.amber | 87 + .../large/subgroup_reconverge_partial11.amber | 87 + .../large/subgroup_reconverge_partial12.amber | 86 + .../large/subgroup_reconverge_partial13.amber | 86 + .../large/subgroup_reconverge_partial14.amber | 84 + .../large/subgroup_reconverge_partial15.amber | 95 + .../large/subgroup_reconverge_partial16.amber | 89 + .../large/subgroup_reconverge_partial17.amber | 80 + .../large/subgroup_reconverge_partial18.amber | 84 + .../large/subgroup_reconverge_partial19.amber | 88 + .../large/subgroup_reconverge_partial20.amber | 132 + .../large_control/subgroup_reconverge00.amber | 87 + .../large_control/subgroup_reconverge01.amber | 86 + .../large_control/subgroup_reconverge02.amber | 88 + .../large_control/subgroup_reconverge03.amber | 88 + .../large_control/subgroup_reconverge04.amber | 89 + .../large_control/subgroup_reconverge05.amber | 89 + .../large_control/subgroup_reconverge06.amber | 94 + .../large_control/subgroup_reconverge07.amber | 93 + .../large_control/subgroup_reconverge08.amber | 90 + .../large_control/subgroup_reconverge09.amber | 97 + .../large_control/subgroup_reconverge10.amber | 97 + .../large_control/subgroup_reconverge11.amber | 98 + .../large_control/subgroup_reconverge12.amber | 97 + .../large_control/subgroup_reconverge13.amber | 97 + .../large_control/subgroup_reconverge14.amber | 95 + .../large_control/subgroup_reconverge15.amber | 106 + .../large_control/subgroup_reconverge16.amber | 100 + .../large_control/subgroup_reconverge17.amber | 91 + .../large_control/subgroup_reconverge18.amber | 95 + .../large_control/subgroup_reconverge19.amber | 99 + .../large_control/subgroup_reconverge20.amber | 144 + .../subgroup_reconverge_partial00.amber | 88 + .../subgroup_reconverge_partial01.amber | 86 + .../subgroup_reconverge_partial02.amber | 88 + .../subgroup_reconverge_partial03.amber | 88 + .../subgroup_reconverge_partial04.amber | 89 + .../subgroup_reconverge_partial05.amber | 89 + .../subgroup_reconverge_partial06.amber | 94 + .../subgroup_reconverge_partial07.amber | 93 + .../subgroup_reconverge_partial08.amber | 90 + .../subgroup_reconverge_partial09.amber | 97 + .../subgroup_reconverge_partial10.amber | 98 + .../subgroup_reconverge_partial11.amber | 98 + .../subgroup_reconverge_partial12.amber | 97 + .../subgroup_reconverge_partial13.amber | 97 + .../subgroup_reconverge_partial14.amber | 95 + .../subgroup_reconverge_partial15.amber | 106 + .../subgroup_reconverge_partial16.amber | 100 + .../subgroup_reconverge_partial17.amber | 91 + .../subgroup_reconverge_partial18.amber | 95 + .../subgroup_reconverge_partial19.amber | 99 + .../subgroup_reconverge_partial20.amber | 143 + .../small/small_subgroup_reconverge00.amber | 77 + .../small/small_subgroup_reconverge01.amber | 75 + .../small/small_subgroup_reconverge02.amber | 77 + .../small/small_subgroup_reconverge03.amber | 77 + .../small/small_subgroup_reconverge04.amber | 78 + .../small/small_subgroup_reconverge05.amber | 78 + .../small/small_subgroup_reconverge06.amber | 83 + .../small/small_subgroup_reconverge07.amber | 82 + .../small/small_subgroup_reconverge08.amber | 79 + .../small/small_subgroup_reconverge09.amber | 86 + .../small/small_subgroup_reconverge10.amber | 86 + .../small/small_subgroup_reconverge11.amber | 87 + .../small/small_subgroup_reconverge12.amber | 85 + .../small/small_subgroup_reconverge13.amber | 86 + .../small/small_subgroup_reconverge14.amber | 84 + .../small/small_subgroup_reconverge15.amber | 95 + .../small/small_subgroup_reconverge16.amber | 89 + .../small/small_subgroup_reconverge17.amber | 80 + .../small/small_subgroup_reconverge18.amber | 84 + .../small/small_subgroup_reconverge19.amber | 88 + .../small/small_subgroup_reconverge20.amber | 133 + .../small_subgroup_reconverge_partial00.amber | 77 + .../small_subgroup_reconverge_partial01.amber | 75 + .../small_subgroup_reconverge_partial02.amber | 77 + .../small_subgroup_reconverge_partial03.amber | 77 + .../small_subgroup_reconverge_partial04.amber | 78 + .../small_subgroup_reconverge_partial05.amber | 78 + .../small_subgroup_reconverge_partial06.amber | 83 + .../small_subgroup_reconverge_partial07.amber | 82 + .../small_subgroup_reconverge_partial08.amber | 79 + .../small_subgroup_reconverge_partial09.amber | 86 + .../small_subgroup_reconverge_partial10.amber | 87 + .../small_subgroup_reconverge_partial11.amber | 87 + .../small_subgroup_reconverge_partial12.amber | 86 + .../small_subgroup_reconverge_partial13.amber | 86 + .../small_subgroup_reconverge_partial14.amber | 84 + .../small_subgroup_reconverge_partial15.amber | 95 + .../small_subgroup_reconverge_partial16.amber | 89 + .../small_subgroup_reconverge_partial17.amber | 80 + .../small_subgroup_reconverge_partial18.amber | 84 + .../small_subgroup_reconverge_partial19.amber | 88 + .../small_subgroup_reconverge_partial20.amber | 132 + .../small_subgroup_reconverge00.amber | 88 + .../small_subgroup_reconverge01.amber | 86 + .../small_subgroup_reconverge02.amber | 88 + .../small_subgroup_reconverge03.amber | 88 + .../small_subgroup_reconverge04.amber | 89 + .../small_subgroup_reconverge05.amber | 89 + .../small_subgroup_reconverge06.amber | 94 + .../small_subgroup_reconverge07.amber | 93 + .../small_subgroup_reconverge08.amber | 90 + .../small_subgroup_reconverge09.amber | 97 + .../small_subgroup_reconverge10.amber | 97 + .../small_subgroup_reconverge11.amber | 98 + .../small_subgroup_reconverge12.amber | 96 + .../small_subgroup_reconverge13.amber | 97 + .../small_subgroup_reconverge14.amber | 95 + .../small_subgroup_reconverge15.amber | 106 + .../small_subgroup_reconverge16.amber | 100 + .../small_subgroup_reconverge17.amber | 91 + .../small_subgroup_reconverge18.amber | 95 + .../small_subgroup_reconverge19.amber | 99 + .../small_subgroup_reconverge20.amber | 144 + .../small_subgroup_reconverge_partial00.amber | 88 + .../small_subgroup_reconverge_partial01.amber | 86 + .../small_subgroup_reconverge_partial02.amber | 88 + .../small_subgroup_reconverge_partial03.amber | 88 + .../small_subgroup_reconverge_partial04.amber | 89 + .../small_subgroup_reconverge_partial05.amber | 89 + .../small_subgroup_reconverge_partial06.amber | 94 + .../small_subgroup_reconverge_partial07.amber | 93 + .../small_subgroup_reconverge_partial08.amber | 90 + .../small_subgroup_reconverge_partial09.amber | 97 + .../small_subgroup_reconverge_partial10.amber | 98 + .../small_subgroup_reconverge_partial11.amber | 98 + .../small_subgroup_reconverge_partial12.amber | 97 + .../small_subgroup_reconverge_partial13.amber | 97 + .../small_subgroup_reconverge_partial14.amber | 95 + .../small_subgroup_reconverge_partial15.amber | 106 + .../small_subgroup_reconverge_partial16.amber | 100 + .../small_subgroup_reconverge_partial17.amber | 91 + .../small_subgroup_reconverge_partial18.amber | 95 + .../small_subgroup_reconverge_partial19.amber | 99 + .../small_subgroup_reconverge_partial20.amber | 143 + .../tess_factor_barrier_bug.amber | 132 + .../a2b10g10r10-snorm-pack32.amber | 51 + .../a2r10g10b10-snorm-pack32.amber | 51 + .../snorm_clamp/a8b8g8r8-snorm-pack32.amber | 51 + .../conversion/snorm_clamp/b8g8r8-snorm.amber | 50 + .../snorm_clamp/b8g8r8a8-snorm.amber | 50 + .../conversion/snorm_clamp/r16-snorm.amber | 50 + .../conversion/snorm_clamp/r16g16-snorm.amber | 50 + .../snorm_clamp/r16g16b16-snorm.amber | 50 + .../snorm_clamp/r16g16b16a16-snorm.amber | 50 + .../conversion/snorm_clamp/r8-snorm.amber | 50 + .../conversion/snorm_clamp/r8g8-snorm.amber | 50 + .../conversion/snorm_clamp/r8g8b8-snorm.amber | 50 + .../snorm_clamp/r8g8b8a8-snorm.amber | 50 + .../b10g11r11-ufloat-pack32.amber | 73 + .../atomic/storage_image_r32i.amber | 98 + .../atomic/storage_image_r32ui.amber | 98 + .../atomic/storage_image_r64i.amber | 101 + .../atomic/storage_image_r64ui.amber | 90 + .../invalidsampleindex/sample_count_16.amber | 89 + .../invalidsampleindex/sample_count_2.amber | 87 + .../invalidsampleindex/sample_count_32.amber | 89 + .../invalidsampleindex/sample_count_4.amber | 89 + .../invalidsampleindex/sample_count_64.amber | 89 + .../invalidsampleindex/sample_count_8.amber | 89 + .../shadow/texel_replacement/d32_sfloat.amber | 51 + .../texture/subgroup_lod/texel_fetch.amber | 105 + .../texture/subgroup_lod/texture_grad.amber | 90 + .../texture/subgroup_lod/texture_lod.amber | 103 + .../packed/a2b10g10r10-uint-pack32.amber | 56 + .../packed/a2b10g10r10-unorm-pack32.amber | 56 + .../uniform/packed/a8b8g8r8-sint-pack32.amber | 56 + .../packed/a8b8g8r8-snorm-pack32.amber | 56 + .../uniform/packed/a8b8g8r8-uint-pack32.amber | 56 + .../packed/a8b8g8r8-unorm-pack32.amber | 56 + .../packed/b10g11r11-ufloat-pack32.amber | 56 + .../uniform/snorm/b8g8r8-snorm.amber | 96 + .../uniform/snorm/b8g8r8a8-snorm.amber | 98 + .../uniform/snorm/r16-snorm.amber | 88 + .../uniform/snorm/r16g16-snorm.amber | 90 + .../uniform/snorm/r16g16b16-snorm.amber | 91 + .../uniform/snorm/r16g16b16a16-snorm.amber | 93 + .../texel_buffer/uniform/snorm/r8-snorm.amber | 92 + .../uniform/snorm/r8g8-snorm.amber | 95 + .../uniform/snorm/r8g8b8-snorm.amber | 96 + .../uniform/snorm/r8g8b8a8-snorm.amber | 98 + .../uniform/srgb/b8g8r8_srgb.amber | 102 + .../uniform/srgb/b8g8r8a8_srgb.amber | 110 + .../texel_buffer/uniform/srgb/r8_srgb.amber | 102 + .../texel_buffer/uniform/srgb/r8g8_srgb.amber | 102 + .../uniform/srgb/r8g8b8_srgb.amber | 104 + .../uniform/srgb/r8g8b8a8_srgb.amber | 110 + .../texture/texel_offset/texel_offset.amber | 58 + .../data/copy_memory_indirect/sample_text.txt | 25 + .../data/gdeflate/compressed_17k_level_0.gdef | 45 + .../gdeflate/compressed_17k_level_12.gdef | Bin 0 -> 4076 bytes .../data/gdeflate/compressed_17k_level_6.gdef | Bin 0 -> 4224 bytes .../data/gdeflate/compressed_64k_level_0.gdef | 173 + .../gdeflate/compressed_64k_level_12.gdef | Bin 0 -> 8736 bytes .../data/gdeflate/compressed_64k_level_6.gdef | Bin 0 -> 9316 bytes vulkan/data/gdeflate/decompressed_17k.gdef | 45 + vulkan/data/gdeflate/decompressed_64k.gdef | 173 + vulkan/data/geometry/position.png | Bin 0 -> 1772 bytes .../ScratchSpace.comp | 2167 ++ .../ScratchSpace.comp.spvasm | 22585 ++++++++++++++++ vulkan/draw/ConcurrentPayload.comp | 16 + vulkan/draw/NegateData.comp | 18 + vulkan/draw/VertexFetch.frag | 7 + vulkan/draw/VertexFetch.vert | 19 + vulkan/draw/VertexFetchCount.frag | 14 + vulkan/draw/VertexFetchCount.vert | 26 + vulkan/draw/VertexFetchInstanceIndex.vert | 19 + vulkan/draw/VertexFetchInstanced.vert | 23 + .../VertexFetchInstancedFirstInstance.vert | 23 + .../draw/VertexFetchShaderDrawParameters.vert | 26 + ...rtexFetchShaderDrawParametersBaseInst.vert | 26 + ...rtexFetchShaderDrawParametersBaseVert.vert | 20 + ...texFetchShaderDrawParametersDrawIndex.vert | 26 + vulkan/dynamic_state/VertexFetch.frag | 10 + vulkan/dynamic_state/VertexFetch.mesh | 33 + vulkan/dynamic_state/VertexFetch.vert | 13 + vulkan/dynamic_state/VertexFetchLines.mesh | 33 + .../VertexFetchViewportArray.mesh | 34 + vulkan/dynamic_state/ViewportArray.geom | 18 + vulkan/glsl/440/linkage.test | 312 + vulkan/video/frame_checksums.py | 144 + vulkan/video/frame_checksums_ffmpeg.py | 157 + 1574 files changed, 365439 insertions(+) create mode 100644 vulkan/amber/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order.amber create mode 100644 vulkan/amber/binding_model/dynamic_offset/shader_reuse_differing_layout_compute.amber create mode 100644 vulkan/amber/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_32bit_mat_3x3.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_32bit_mat_4x4.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_mat_3x3.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_mat_4x4.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp64_mat_3x3.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp64_mat_4x4.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/determinant_highp_mat_3x3.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/determinant_highp_mat_4x4.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_32bit_mat_3x3.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_32bit_mat_4x4.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_mat_3x3.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_mat_4x4.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp64_mat_3x3.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp64_mat_4x4.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/inverse_highp_mat_3x3.amber create mode 100644 vulkan/amber/builtin/precision/square_matrix/inverse_highp_mat_4x4.amber create mode 100644 vulkan/amber/combined_operations/negintdivand.amber create mode 100644 vulkan/amber/combined_operations/notxor.amber create mode 100644 vulkan/amber/compute/atomic_barrier_sum_small.amber create mode 100644 vulkan/amber/compute/branch_past_barrier.amber create mode 100644 vulkan/amber/compute/pk-immediate.amber create mode 100644 vulkan/amber/compute/pkadd-immediate.amber create mode 100644 vulkan/amber/compute/vec2_nclamp_nan_component.amber create mode 100644 vulkan/amber/compute/webgl_spirv_loop.amber create mode 100644 vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_basic.amber create mode 100644 vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_two_invocations.amber create mode 100644 vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_variable_pointers.amber create mode 100644 vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block.amber create mode 100644 vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block_with_offset.amber create mode 100644 vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_other_block.amber create mode 100644 vulkan/amber/compute/write_ssbo_array.amber create mode 100644 vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_128.amber create mode 100644 vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_2x8x8.amber create mode 100644 vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_4x4x8.amber create mode 100644 vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_4x8x4.amber create mode 100644 vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_8x2x8.amber create mode 100644 vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_8x4x4.amber create mode 100644 vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_8x8x2.amber create mode 100644 vulkan/amber/crash_test/divbyzero_comp.amber create mode 100644 vulkan/amber/crash_test/divbyzero_frag.amber create mode 100644 vulkan/amber/crash_test/divbyzero_geom.amber create mode 100644 vulkan/amber/crash_test/divbyzero_tesc.amber create mode 100644 vulkan/amber/crash_test/divbyzero_tese.amber create mode 100644 vulkan/amber/crash_test/divbyzero_vert.amber create mode 100644 vulkan/amber/depth/bias_fs_clamp.amber create mode 100644 vulkan/amber/depth/bias_outside_range.amber create mode 100644 vulkan/amber/depth/bias_outside_range_fs_clamp.amber create mode 100644 vulkan/amber/depth/bias_outside_range_fs_clamp_unrestricted.amber create mode 100644 vulkan/amber/depth/ez_fs_clamp.amber create mode 100644 vulkan/amber/depth/fs_clamp.amber create mode 100644 vulkan/amber/depth/out_of_range.amber create mode 100644 vulkan/amber/depth/out_of_range_unrestricted.amber create mode 100644 vulkan/amber/draw/depth_bias/depth_bias_patch_list_tri_fill.amber create mode 100644 vulkan/amber/draw/depth_bias/depth_bias_patch_list_tri_line.amber create mode 100644 vulkan/amber/draw/depth_bias/depth_bias_patch_list_tri_point.amber create mode 100644 vulkan/amber/draw/depth_bias/depth_bias_triangle_list_fill.amber create mode 100644 vulkan/amber/draw/depth_bias/depth_bias_triangle_list_line.amber create mode 100644 vulkan/amber/draw/depth_bias/depth_bias_triangle_list_point.amber create mode 100644 vulkan/amber/draw/misc/flat_b_sat_error.amber create mode 100644 vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-highp-output-float.amber create mode 100644 vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-highp-output-vec2.amber create mode 100644 vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-highp.amber create mode 100644 vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-mediump-output-float.amber create mode 100644 vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-mediump-output-vec2.amber create mode 100644 vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-mediump.amber create mode 100644 vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-highp-output-vec2.amber create mode 100644 vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-highp-output-vec3.amber create mode 100644 vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-highp.amber create mode 100644 vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-mediump-output-vec2.amber create mode 100644 vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-mediump-output-vec3.amber create mode 100644 vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-mediump.amber create mode 100644 vulkan/amber/draw/output_location/array/r16g16-sfloat-highp-output-float.amber create mode 100644 vulkan/amber/draw/output_location/array/r16g16-sfloat-highp.amber create mode 100644 vulkan/amber/draw/output_location/array/r16g16-sfloat-mediump-output-float.amber create mode 100644 vulkan/amber/draw/output_location/array/r16g16-sfloat-mediump.amber create mode 100644 vulkan/amber/draw/output_location/array/r32-sfloat-highp.amber create mode 100644 vulkan/amber/draw/output_location/array/r32-sfloat-mediump.amber create mode 100644 vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-highp-output-vec2.amber create mode 100644 vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-highp-output-vec3.amber create mode 100644 vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-highp.amber create mode 100644 vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-mediump-output-vec2.amber create mode 100644 vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-mediump-output-vec3.amber create mode 100644 vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-mediump.amber create mode 100644 vulkan/amber/draw/output_location/array/r8g8-uint-highp-output-uint.amber create mode 100644 vulkan/amber/draw/output_location/array/r8g8-uint-highp.amber create mode 100644 vulkan/amber/draw/output_location/array/r8g8-uint-mediump-output-uint.amber create mode 100644 vulkan/amber/draw/output_location/array/r8g8-uint-mediump.amber create mode 100644 vulkan/amber/draw/output_location/shuffle/inputs-outputs-mod.amber create mode 100644 vulkan/amber/draw/output_location/shuffle/inputs-outputs.amber create mode 100644 vulkan/amber/draw/shader_invocation/helper_invocation.amber create mode 100644 vulkan/amber/draw/shader_invocation/helper_invocation_volatile.amber create mode 100644 vulkan/amber/draw/shader_invocation/helper_invocation_volatile_mem_model.amber create mode 100644 vulkan/amber/graphicsfuzz/access-new-vector-inside-if-condition.amber create mode 100644 vulkan/amber/graphicsfuzz/always-discarding-function.amber create mode 100644 vulkan/amber/graphicsfuzz/always-false-if-in-do-while.amber create mode 100644 vulkan/amber/graphicsfuzz/always-false-if-with-discard-return.amber create mode 100644 vulkan/amber/graphicsfuzz/arr-value-set-to-arr-value-squared.amber create mode 100644 vulkan/amber/graphicsfuzz/array-idx-multiplied-by-for-loop-idx.amber create mode 100644 vulkan/amber/graphicsfuzz/assign-array-value-to-another-array-2.amber create mode 100644 vulkan/amber/graphicsfuzz/assign-array-value-to-another-array.amber create mode 100644 vulkan/amber/graphicsfuzz/barrier-in-loop-with-break.amber create mode 100644 vulkan/amber/graphicsfuzz/break-in-do-while-with-nested-if.amber create mode 100644 vulkan/amber/graphicsfuzz/call-function-with-discard.amber create mode 100644 vulkan/amber/graphicsfuzz/call-if-while-switch.amber create mode 100644 vulkan/amber/graphicsfuzz/color-set-in-for-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/color-write-in-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/complex-nested-loops-and-call.amber create mode 100644 vulkan/amber/graphicsfuzz/conditional-return-in-infinite-while.amber create mode 100644 vulkan/amber/graphicsfuzz/continue-and-merge.amber create mode 100644 vulkan/amber/graphicsfuzz/control-flow-in-function.amber create mode 100644 vulkan/amber/graphicsfuzz/control-flow-switch.amber create mode 100644 vulkan/amber/graphicsfuzz/cosh-return-inf-unused.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-access-array-dot.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-analysis-reachable-from-many.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-and-even-numbers-from-fragcoord.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-apfloat-acos-ldexp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-apfloat-determinant-for-if.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-apfloat-determinant.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-apfloat-mix-nan.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-apfloat-mod-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-apfloat-module-small-number.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-apfloat-negative-step-func.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-apfloat-reflect-denorm.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-apfloat-sinh-negative-log2.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-apfloat-tanh.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-apfloat-undefined-matrix-mul.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-apfloat-unpackunorm-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-array-accesses-clamp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-array-cast-bool-float-div-by-zero-no-effect.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-array-copies-loops-with-limiters.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-array-set-element-condition-negative-modulus.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-asin-undefined-smoothstep.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-atan-trunc-vec4.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-basic-block-discard-in-function.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-bitcount.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-bitfieldExtract-undefined.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-bitfieldinsert-undefined.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-bitfieldreverse-left-shift-findmsb.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-bitwise-and-variable-and-its-negation.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-bitwise-inverse-uniform-condition.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-bitwise-or-uniform-zero-tenth-bit-loop-limit-find-lsb.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-bitwise-shift-right-always-select-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-bitwise-shift-right-full-bits-no-effect-clamp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-blockfrequency-several-for-loops.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-branch-probability-identity-matrix.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-cast-float-to-int-and-back.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-clamp-loop-limit-increment-float-array.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-clamp-lower-limit-from-always-false.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-clamp-min-bitcount-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-clamp-value-and-min-select-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-clamp-vector-element-ceil-negative.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-clamp-vector-variable-negative-offset.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-clear-yz-inside-condition.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-combine-and-or-xor-gt-lt.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-condition-bitfield-extract-integer.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-condition-clamp-min-from-uniform-never-larger.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-condition-increment-zero-to-one-divide-by-two.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-condition-loop-index-bitwise-not.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-condition-matrix-determinant-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-conditional-discard-inside-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-conditions-empty-blocks-index-array-one-divided-by-findlsb.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-bitfieldinsert-div-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-ceil-vec4.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-clamp-inside-while.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-clamp-max.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-clamp-min.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-clamp-vs-original.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-clamp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-det-identity.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-dot-condition-true.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-dot-determinant.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-gte-const-first.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-min-as-loop-range.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-mod-one-one-lte.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-pow-large-exp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-same-condition.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-sinh-inf.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-const-folding-vector-shuffle.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-constant-folding-atan-over-tanh.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-constants-combine-add-sub.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-constants-mix-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-continue-break-discard-return-in-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-copy-array-elements-except-first-nested-loop-replace-identical-values.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-copy-output-color-swizzle-array-indexing.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-copy-prop-arrays-no-stores.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-copy-prop-arrays-param-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-cosh-clamped-to-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-cumulate-loops-unreachable.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-dag-combiner-findmsb-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-dag-combiner-glf_color.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-dag-combiner-increment-color.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-dag-combiner-neg-div-pow2.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-dag-combiner-same-cond-nested.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-dead-branch-func-return-arg.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-dead-code-unreachable-merge.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-decrement-vector-elements-clamp-index.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-descending-loop-index-temporary-array.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-descending-loop-min-max-always-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-determinant-uninitialized-matrix-never-chosen.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-dfdx-dfdy-after-nested-loops.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-discard-condition-loop-same-condition-again.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-divide-matrix-transpose-by-constant.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-do-while-loop-until-uniform-lt-itself.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-do-while-negative-iterator-nested-loops-increment-array-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-do-while-switch-case-bitcount-findmsb.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-double-if-true-in-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-double-negation-fragcoord-cast-ivec2-bitwise-and.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-dummy-function-loop-array-element-increment-never-read.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-enable-bits-pixel-location-negate-not-equal-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-exp2-two.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-extend-uniform-vec2-to-vec3-matrix-multiply.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-find-msb-input-either-zero-or-minus-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-findlsb-division-by-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-float-array-init-pow.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fold-and-in-for-loop-range.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fold-bitwise-and-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fold-bitwise-or-full-mask.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fold-bitwise-xor.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fold-logical-and-const-variable.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fold-logical-and-constant.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fold-logical-or-constant.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fold-negate-min-int-value.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fold-negate-variable.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fold-shift-gte32.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fold-shift-right-arithmetic.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fold-switch-udiv.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-clamp-cmp-const-first.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-merge-add-sub-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-construct-extract.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-dot-extract.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-dot-no-extract.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-merge-add-sub.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-merge-div-mul.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-merge-divs.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-merge-mul-div.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-merge-sub-add.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-merge-sub-sub.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-merge-var-sub.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-mix-uniform-weight.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-negate-div.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-negate-sub.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-redundant-mix.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-shuffle-extract.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-shuffle-mix.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-split-vector-init.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-folding-rules-vec-mix-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-for-array-initializing-modulo.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-for-loop-condition-one-shift-right-integer-comparison-break.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-for-loop-min-increment-array-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-for-loop-start-negative-increment-variable.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-for-loop-struct-as-iterator.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-for-switch-fallthrough.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fract-asin-undefined-never-used.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fract-smoothstep-undefined.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fract-trunc-always-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fragcood-multiple-conditions-function-loop-global-counter.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fragcoord-and-one-or-same-value.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fragcoord-bitwise-and-loop-reduce-value-index-array.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fragcoord-bitwise-not.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fragcoord-clamp-array-access.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fragcoord-conditions-never-return-index-array-using-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fragcoord-integer-loop-reduce-to-range.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fragcoord-loop-limit-negative-decrease-sum-first-iteration.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fragcoord-multiple-conditions-function-global-loop-counter-simplified.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fragcoord-multiply.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-fragcoord-select-always-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-always-return-negative-bitfield-extract.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-argument-uniform-float-loop-never-return.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-call-twice-clamp-global-variable.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-check-argument-one-always-return-minus-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-clamp-min-identical-shift-right.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-divide-argument-until-lt-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-find-lsb-ivec2-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-fragcoord-condition-always-return.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-global-loop-counter-sample-texture.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-global-variables-fragcoord-condition-call-twice.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-index-array-redundant-clamps.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-infinite-loop-always-return.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-infinite-loop-return-identical-condition.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-large-array-max-clamp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-large-loop-always-return-first-iteration.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-large-loop-break-argument-lte-global-loop-bound.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-loop-check-determinant-zero-return-vector.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-loop-clamp-no-effect.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-loop-condition-constant-array-always-false.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-loop-condition-uniform-shift-right.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-loop-condition-variable-less-than-min-itself.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-loop-copy-array-elements-based-on-arguments.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-loop-modify-ivec-components-infinite-loop-never-executed.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-loop-same-conditions-multiple-times-struct-array.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-loop-switch-increment-array-element-return.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-loop-variable-multiplied-unused.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-loops-vector-mul-matrix-never-executed.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-max-all-ones-select-always-true.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-min-identical-integer-division-multiplication.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-min-integer-large-shift-unused.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-multiple-loops-compare-integer-return.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-nested-do-whiles-looped-once.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-nested-loops-break-early-never-discard.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-nested-loops-limit-uniform-xor-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-parameter-zero-divided-by-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-round-unpack-half-2x16.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-set-struct-field-zero-loop-reset-first-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-struct-int-array-loop-check-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-switch-case-constant-clamp-transpose-identity-matrices.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-trivial-switch-case.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-two-loops-limit-using-arguments-array-element-copies.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-undefined-shift-left-index-array-with-return-value.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-unpack-unorm-2x16-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-unused-argument-single-loop-iteration-icrement-global-counter.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-variable-plus-one-minus-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-vec2-never-discard.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-function-with-nested-loops-called-from-nested-loops.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-bound-true-logical-or.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-count-array-struct-field-set-int-array-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-counter-accumulate-integer-condition-large-array-elements.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-counter-exhaust-calling-function-twice.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-counter-findlsb-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-counter-for-loop-function-call-inside-never-called.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-counter-main-function-call.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-counter-multiply-one-minus.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-counter-read-past-matrix-size-never-executed.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-counter-select-one-or-zero-never-greater-than-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-counter-set-array-element-once-index-using-findmsb.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-counter-squared-comparison.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-global-loop-counter-texture-sample-loop-condition-set-array-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-if-conversion-identical-branches.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-if-switch-fallthrough.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-if-true-continue.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-if-true-float-bits-to-int-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inc-array-element-loop-lsb.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inc-inside-switch-and-for.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-increment-array-element-in-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-increment-array-element-usub-borrow.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-increment-float-in-loop-abs.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-increment-global-counter-loop-function.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-increment-inside-clamp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-increment-int-loop-counter-mod-array.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-increment-multiple-integers.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-increment-one-array-element-check-index-from-fragcoord.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-increment-vector-array-matrix-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-increment-vector-component-with-matrix-copy.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-increment-vector-function-call-conditional.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-index-array-using-uniform-bitwise-or-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-initialize-integer-array-variable-divided-by-itself.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inline-pass-empty-block.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inline-pass-nested-loops.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inline-pass-return-in-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inline-pass-unreachable-func.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-determinant.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-increase-negative.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-ldexp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-pre-increase.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-for-bitfieldinsert.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-switch.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-compares-combine-select-uaddcarry.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-compares-isnan.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-compares-ldexp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-compares-while-modulo.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-pack-unpack.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-select-findlsb-uaddcarry.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-shifts-bitfield-bitcount.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-shifts-left-shift-for.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-combine-vector-ops-asin.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-peephole-optimizer-acosh.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-inst-value-tracking-inversesqrt.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-instr-emitter-pow-asinh.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-instr-info-det-mat-min.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-instruction-simplify-atanh-log-undefined.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-instruction-simplify-bit-shifting.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-instruction-simplify-inclusive-or.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-instruction-simplify-sqrt.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-instructions-first-value-phi.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-instructions-for-if-less-than-equal.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-int-div-round-to-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-int-full-bits-divide-by-two-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-int-initialize-from-multiple-large-arrays.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-integer-constant-mod-variable-increased-condition-array-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-integer-minus-one-increased-before-indexing-array.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-integer-modulo-negative.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-integer-variable-or-with-inversion.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-intervalmap-set-stop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-ir-builder-constant-fold-inst-combine-calls-value-tracking-findmsb-incr-if.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-irbuilder-matrix-cell-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-isnan-asinh-clamp-always-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-ivec-from-uniform-float-shift-right-add-components.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-ivec-shift-right-by-large-number.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-large-for-loop-exit-early-set-iterator-array-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-large-int-array-nested-loops-set-ivec-index-component-sum.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-large-loop-break-early-condition-iterator-divided.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-large-loop-multiply-integer-by-uniform-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-large-number-of-false-conditions-return-discard-continue.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-ldexp-exponent-undefined-divided-fragcoord-never-executed.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-left-shift-array-access.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-left-shift-right-shift-compare.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-liveinterval-different-dest.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-abs-multiply-offset.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-array-element-bitfield-insert-undefined-never-read.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-array-element-copy-index-clamp-sign.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-array-index-decrement-never-negative.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-array-struct-field-index-array-with-uniforms.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-break-after-first-iteration-set-array-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-break-floor-nan-never-executed.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-break-fragcoord-x-empty-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-clamp-to-one-empty-condition.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-condition-bitfield-extract-set-array-elements.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-condition-clamp-vec-of-ones.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-condition-constant-struct-field-data.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-condition-divide-by-uniform-always-false.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-condition-double-negate.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-condition-filter-some-iterations-never-discard.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-condition-increment-integer-fallback-global-counter.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-condition-logical-or-never-iterated.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-construct-vec4-from-vec4-clamp-same-min-max.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-decrease-integer-never-break.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-decrease-vector-component-only-first-iteration.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-decrease-vector-components-assign-multiple-times.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-dfdx-constant-divide.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-divide-uninitialized-vector-min-unused.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-exit-conditions-sampler-struct-integer-variable.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-find-lsb-eight-fragcoord-never-discard.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-findmsb-findlsb.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-fragcoord-identical-condition.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-function-call-negative-argument.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-function-call-vector-matrix-multiplication.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-global-counter-break-set-ivec-elements.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-global-counter-increment-iterator-select-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-increase-iterator-condition-uniform-copy-array-elements.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-increment-array-elements-clamp-index.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-increment-array-index-array-usuborrow-feedback.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-increment-integer-findmsb-minus-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-increment-integer-set-output-color-break.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-index-array-max-negative-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-integer-half-minus-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-iterator-bitwise-negate.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-iterator-limit-xor-and-unifrom.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-iterator-plus-one-variable-outside-index-array.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-iterator-start-select-uniform-negative-integer.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-iterator-start-shift-left-right.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-large-array-index-clamp-negative-value.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-limiter-min-findlsb.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-limiter-uniform-bitwise-and-one-always-break.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-logical-xor.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-max-divide-integer-by-ten.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-min-max-clamp-increment-only-first-iteration.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-multiple-iterator-variables-copy-array-elements.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-never-iterated-constant-vector-condition.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-overwrite-sample-texture-as-color-output.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-read-array-index-from-array-data.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-replace-output-color-restore-original.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-returns-behind-true-and-false.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-sampled-texel-integer-counter.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-set-vector-components-pow-two.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-start-fragcoord-while-iterates-once.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-start-from-one-switch-case-invalid-color-never-executed.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-start-from-one-switch-case-never-executed.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-struct-array-field-set-value-self-dependency.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-switch-discard-never-hit.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-two-iterators-increment-array-empty-do-while.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-variable-less-than-itself.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loop-with-two-integers.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loops-and-conditions-fragcoord-always-false-floats-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-loops-same-code-outside-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-machine-scheduler-for-if-pow.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-machinevaluetype-one-iter-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-matching-conditions-break.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-matching-if-always-true-inside-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-matrix-double-transpose.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-matrix-mult-round-even-asinh.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-matrix-square-mul-with-vector.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-max-clamp-same-minval.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-max-min-less-than.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-mem-pass-sum-struct-members.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-mem-pass-unused-component.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-merge-return-condition-twice.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-min-identical-uint-uniform-check-highest-bit.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-min-identical-uint-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-min-negative-constant-always-below-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-min-nested-loop-same-value-for-variables.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-min-vec2-transpose-mat2-identity.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-missing-return-value-function-never-called.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-mix-uninitialized-float-never-selected.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-mix-uninitialized-vector-select-only-defined-data.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-mod-acosh.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-mod-uint-bits-float.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-modf-clamp-for.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-modf-integer-to-private.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-modulo-zero-never-executed.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-multiple-fragcoord-conditions-false-never-return-sample-texture.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-multiple-fragcoord-conditions-never-return-color-uninitialized.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-multiple-functions-global-never-change.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-multiple-loops-same-condition-always-false-global-loop-counter.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-negative-integer-bitwise-or-uniform-increment-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-functions-accumulate-global-matrix.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-functions-compare-fragcood-length-zero-vector.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-functions-loop-assign-global-array-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-functions-struct-arrays-vector-lengths.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-functions-vec4-array-element-argument.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loop-continue-inner-copy-array-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loop-decrease-vector-components.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loop-initializer-value-increased-inside.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loop-large-array-index-using-vector-components.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loop-not-greater-than-increment-array-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-array-choose-red-last-iteration.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-assign-vector-elements-from-matrix-no-negative-indexing.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-clamp-ivec-push-constant-increment-global-counter.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-copy-array-elements-skip-first.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-decrease-ivec-component.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-decrease-vector-component-by-matrix-element-global-loop-counter.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-different-iteration-rates-function-copy-array-elements.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-divide-integer-constant-always-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-float-array-select-by-fragcoord.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-float-bits-to-int-increment-array.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-fragcoord-conditions-empty-blocks.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-fragcoord-never-return-descending-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-global-counter-func-set-struct-field.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-global-counter-increment-single-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-fragcoord-negative-always-false.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-index-array-vec2.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-iterator-dependency.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-output-color-from-backup.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-reached-second-iteration.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-identical-iterator-names-multiply-divide.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-identical-iterators-compare-same-array-elements.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-increase-integer-dot-product.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-inner-loop-min-copy-array-elements.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-iterator-times-two-while-min.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-never-change-array-element-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-redundant-condition.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-return-inside-while-never-executed.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-sample-opposite-corners.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-select-starting-value-fragcoord.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-set-struct-data-verify-in-function.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-substract-matrix-element-change-float.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-switch-add-zero-matrix-elements.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-switch-case-fallthrough-increment-array-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-temporary-copy-output-color-index-matrix.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-while-condition-integer-range-increment-variable.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-loops-while-min-iterator-condition-always-false.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nested-structs-function-set-inner-struct-field-return.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nir-array-access.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-not-clamp-matrix-access.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-nouble-negation-fragcoord-cast-ivec2-bitwise-and.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-one-bitwise-and-bitwise-or-full-bits.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-optimize-phis-for.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-packhalf-unpackunorm.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-pattern-match-signum.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-pattern-match-single-bit.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-pow-distance-uniform-vector-constant-one-vector.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-pow-identical-value-sqrt.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-pow-undefined.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-rcp-negative-int.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-read-matrix-push-constant.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-reciprocal-var-minus-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-reduce-load-array-replace-extract.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-reduce-load-replace-extract.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-repeating-conditions-fract-unused.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-replace-copy-object.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-return-after-do-while.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-return-after-first-iteration.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-return-partly-undefined-vector-from-array.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-sample-texture-hundred-iterations.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-sampler-as-function-argument.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-scaled-number-nested-loops-array-access.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-scaled-number-nested-loops.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-selection-dag-assign-back-and-forth.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-selection-dag-inverse-clamp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-selection-dag-lt-gt.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-selection-dag-same-cond-twice.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-set-array-elements-to-uniform-check-value-break.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-set-output-color-function-call-nested-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-set-vector-cos-fragcoord.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-sign-array-access-uaddcarry.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplification-unused-struct.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplification-while-inside-for.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-clamp-max-itself.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-combine-compares-max-max-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-component-uniform-idx.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-div-by-uint-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-for-bitwise-condition.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-ldexp-exponent-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-max-multiplied-values.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-modulo-1.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-mul-identity.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-not-less-than-neg.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-right-shift-greater-than-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-select-fragcoord.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-sign-cosh.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-simplify-smoothstep-undef.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-single-block-elim-self-assign.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-single-store-elim-assume-store.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-sinh-ldexp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-small-array-overwrite-most-uniform-value-check-data-break.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-ssa-rewrite-case-with-default.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-step-sinh.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-struct-array-ivec-negative-modulus-empty-function.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-struct-int-array-select-uniform-ivec.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-sum-uniform-vector-components-round.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-switch-fallthrough-variable-from-first-case.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-tail-duplicator-for-for-for.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-tail-duplicator-infinite-loops.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-target-lowering-dfdx-cos.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-texel-double-negation.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-transpose-multiply.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-trunc-fract-always-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-two-functions-loops-copy-elements-infinite-loops-never-executed.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-two-functions-modify-struct-array-element-return-from-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-two-loops-global-loop-counter-clamp-ivec-elements-index-array.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-two-loops-global-loop-counter-shift-right-zero-increment-array-element.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-two-loops-increment-integer-global-counter-break-square-threshold.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-two-loops-never-iterated.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-two-nested-loops-switch-case-matrix-array-increment.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-types-return-in-main-never-hit.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-uadd-carry-bit-count-index-array.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-ucarryadd-one-and-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-undefined-inversesqrt-reflect.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-uniform-vector-copy.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-uniform-vector-function-argument-mod-increment-integers.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-unpack-unorm-mix-always-one.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-unused-access-past-matrix-elements.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-unused-matrix-copy-inside-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-val-cfg-case-fallthrough.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-value-tracking-const-dfdy.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-value-tracking-constant-fold-refraction-dfxd-determinant.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-value-tracking-inclusive-or.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-value-tracking-known-nonzero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-value-tracking-max-uintbitstofloat.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-value-tracking-uniform-incident.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-variable-copy-in-function-tex-sample.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-vec2-dot-max-uniform.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-vec2-dot-minus-negative-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-vec2-duplicate-min-always-half.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-vector-dce-inc-unused-comp.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-vector-dce-unused-component.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-vector-illegal-index-never-executed.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-vector-log2-cosh.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-wrap-op-kill-for-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-wrap-op-kill-two-branches.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-write-past-matrix-elements-unused.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-x86-instr-info-determinant-min.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-determinant-exp-acos.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift.amber create mode 100644 vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index.amber create mode 100644 vulkan/amber/graphicsfuzz/create-color-in-do-while-for-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/dead-barriers-in-loops.amber create mode 100644 vulkan/amber/graphicsfuzz/dead-struct-init.amber create mode 100644 vulkan/amber/graphicsfuzz/disc-and-add-in-func-in-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/discard-continue-return.amber create mode 100644 vulkan/amber/graphicsfuzz/discard-in-array-manipulating-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/discard-in-loop-in-function.amber create mode 100644 vulkan/amber/graphicsfuzz/discard-in-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/discards-in-control-flow.amber create mode 100644 vulkan/amber/graphicsfuzz/do-while-false-if.amber create mode 100644 vulkan/amber/graphicsfuzz/do-while-false-loops.amber create mode 100644 vulkan/amber/graphicsfuzz/do-while-if-return.amber create mode 100644 vulkan/amber/graphicsfuzz/do-while-loop-in-conditionals.amber create mode 100644 vulkan/amber/graphicsfuzz/do-while-with-always-true-if.amber create mode 100644 vulkan/amber/graphicsfuzz/do-while-with-if-condition.amber create mode 100644 vulkan/amber/graphicsfuzz/early-return-and-barrier.amber create mode 100644 vulkan/amber/graphicsfuzz/find-msb-from-lsb.amber create mode 100644 vulkan/amber/graphicsfuzz/flag-always-false-if.amber create mode 100644 vulkan/amber/graphicsfuzz/for-condition-always-false.amber create mode 100644 vulkan/amber/graphicsfuzz/for-loop-with-return.amber create mode 100644 vulkan/amber/graphicsfuzz/for-with-ifs-and-return.amber create mode 100644 vulkan/amber/graphicsfuzz/frag-coord-func-call-and-ifs.amber create mode 100644 vulkan/amber/graphicsfuzz/fragcoord-control-flow-2.amber create mode 100644 vulkan/amber/graphicsfuzz/fragcoord-control-flow.amber create mode 100644 vulkan/amber/graphicsfuzz/function-with-float-comparison.amber create mode 100644 vulkan/amber/graphicsfuzz/function-with-uniform-return.amber create mode 100644 vulkan/amber/graphicsfuzz/global-array-loops.amber create mode 100644 vulkan/amber/graphicsfuzz/if-and-switch.amber create mode 100644 vulkan/amber/graphicsfuzz/increment-value-in-nested-for-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/index.txt create mode 100644 vulkan/amber/graphicsfuzz/injection-switch-as-comparison.amber create mode 100644 vulkan/amber/graphicsfuzz/int-mat2-struct.amber create mode 100644 vulkan/amber/graphicsfuzz/loop-call-discard.amber create mode 100644 vulkan/amber/graphicsfuzz/loop-dead-if-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/loop-nested-ifs.amber create mode 100644 vulkan/amber/graphicsfuzz/loops-breaks-returns.amber create mode 100644 vulkan/amber/graphicsfuzz/loops-ifs-continues-call.amber create mode 100644 vulkan/amber/graphicsfuzz/mat-array-deep-control-flow.amber create mode 100644 vulkan/amber/graphicsfuzz/mat-array-distance.amber create mode 100644 vulkan/amber/graphicsfuzz/mat-mul-in-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/matrices-and-return-in-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/max-mix-conditional-discard.amber create mode 100644 vulkan/amber/graphicsfuzz/mix-floor-add.amber create mode 100644 vulkan/amber/graphicsfuzz/modf-gl-color.amber create mode 100644 vulkan/amber/graphicsfuzz/modf-temp-modf-color.amber create mode 100644 vulkan/amber/graphicsfuzz/nested-for-break-mat-color.amber create mode 100644 vulkan/amber/graphicsfuzz/nested-for-loops-switch-fallthrough.amber create mode 100644 vulkan/amber/graphicsfuzz/nested-for-loops-with-return.amber create mode 100644 vulkan/amber/graphicsfuzz/nested-ifs-and-return-in-for-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/nested-loops-switch.amber create mode 100644 vulkan/amber/graphicsfuzz/nested-switch-break-discard.amber create mode 100644 vulkan/amber/graphicsfuzz/one-sized-array.amber create mode 100644 vulkan/amber/graphicsfuzz/pow-vec4.amber create mode 100644 vulkan/amber/graphicsfuzz/return-before-writing-wrong-color.amber create mode 100644 vulkan/amber/graphicsfuzz/return-float-from-while-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/return-in-loop-in-function.amber create mode 100644 vulkan/amber/graphicsfuzz/return-inside-loop-in-function.amber create mode 100644 vulkan/amber/graphicsfuzz/returned-boolean-in-vector.amber create mode 100644 vulkan/amber/graphicsfuzz/set-color-in-one-iteration-while-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/similar-nested-ifs.amber create mode 100644 vulkan/amber/graphicsfuzz/smoothstep-after-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-access-chains.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-composite-phi.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-composite2.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-composites.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-copy-object.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-dead-break-and-unroll.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-declare-bvec4.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-double-branch-to-same-block.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-double-branch-to-same-block2.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-double-branch-to-same-block3.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-load-from-frag-color.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-null-in-phi-and-unroll.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-maze-O-dead-code.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-maze-O-memory-accesses.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-maze-flatten-copy-composite.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-mergesort-dead-code.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-orbit-O-mutate-variable.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-quicksort-dontinline.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-quicksort-mat-func-param.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-sampler-loop-extra-instructions.amber create mode 100644 vulkan/amber/graphicsfuzz/spv-stable-sampler-polar-simple-O-access-chain.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-mergesort-for-always-false-if-discard.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-mergesort-reversed-for-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-quicksort-for-loop-with-injection.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-quicksort-if-false-else-return.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-quicksort-max-value-as-index.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-triangle-array-nested-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-triangle-clamp-conditional-mix.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-triangle-nested-conditional-clamped-float.amber create mode 100644 vulkan/amber/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if.amber create mode 100644 vulkan/amber/graphicsfuzz/struct-and-unreachable-infinite-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/struct-array-data-as-loop-iterator.amber create mode 100644 vulkan/amber/graphicsfuzz/struct-array-index.amber create mode 100644 vulkan/amber/graphicsfuzz/struct-controlled-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/struct-used-as-temporary.amber create mode 100644 vulkan/amber/graphicsfuzz/switch-if-discard.amber create mode 100644 vulkan/amber/graphicsfuzz/switch-inside-while-always-return.amber create mode 100644 vulkan/amber/graphicsfuzz/switch-loop-switch-if.amber create mode 100644 vulkan/amber/graphicsfuzz/switch-with-empty-if-false.amber create mode 100644 vulkan/amber/graphicsfuzz/switch-with-fall-through-cases.amber create mode 100644 vulkan/amber/graphicsfuzz/swizzle-struct-init-min.amber create mode 100644 vulkan/amber/graphicsfuzz/transpose-rectangular-matrix.amber create mode 100644 vulkan/amber/graphicsfuzz/two-2-iteration-loops.amber create mode 100644 vulkan/amber/graphicsfuzz/two-for-loops-with-barrier-function.amber create mode 100644 vulkan/amber/graphicsfuzz/two-loops-mat-add.amber create mode 100644 vulkan/amber/graphicsfuzz/two-loops-matrix.amber create mode 100644 vulkan/amber/graphicsfuzz/two-loops-set-struct.amber create mode 100644 vulkan/amber/graphicsfuzz/two-loops-with-break.amber create mode 100644 vulkan/amber/graphicsfuzz/two-nested-do-whiles.amber create mode 100644 vulkan/amber/graphicsfuzz/two-nested-for-loops-with-returns.amber create mode 100644 vulkan/amber/graphicsfuzz/two-nested-infinite-loops-discard.amber create mode 100644 vulkan/amber/graphicsfuzz/undefined-assign-in-infinite-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/undefined-integer-in-function.amber create mode 100644 vulkan/amber/graphicsfuzz/uninit-element-cast-in-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/uninitialized-var-decrement-and-add.amber create mode 100644 vulkan/amber/graphicsfuzz/unreachable-barrier-in-loops.amber create mode 100644 vulkan/amber/graphicsfuzz/unreachable-continue-statement.amber create mode 100644 vulkan/amber/graphicsfuzz/unreachable-discard-statement-in-if.amber create mode 100644 vulkan/amber/graphicsfuzz/unreachable-discard-statement.amber create mode 100644 vulkan/amber/graphicsfuzz/unreachable-loops-in-switch.amber create mode 100644 vulkan/amber/graphicsfuzz/unreachable-loops.amber create mode 100644 vulkan/amber/graphicsfuzz/unreachable-return-in-loop.amber create mode 100644 vulkan/amber/graphicsfuzz/unreachable-switch-case-with-discards.amber create mode 100644 vulkan/amber/graphicsfuzz/uv-value-comparison-as-boolean.amber create mode 100644 vulkan/amber/graphicsfuzz/vec2-modf.amber create mode 100644 vulkan/amber/graphicsfuzz/vector-values-multiplied-by-fragcoord.amber create mode 100644 vulkan/amber/graphicsfuzz/vectors-and-discard-in-function.amber create mode 100644 vulkan/amber/graphicsfuzz/while-function-always-false.amber create mode 100644 vulkan/amber/graphicsfuzz/while-inside-switch.amber create mode 100644 vulkan/amber/graphicsfuzz/write-before-break.amber create mode 100644 vulkan/amber/graphicsfuzz/write-red-after-search.amber create mode 100644 vulkan/amber/graphicsfuzz/write-red-in-loop-nest.amber create mode 100644 vulkan/amber/graphicsfuzz/wrong-color-in-always-false-if.amber create mode 100644 vulkan/amber/ldexp/README.TXT create mode 100644 vulkan/amber/ldexp/exp64_needed_fixes.txt create mode 100755 vulkan/amber/ldexp/gen_amber.py create mode 100755 vulkan/amber/ldexp/gen_shaders.py create mode 100755 vulkan/amber/ldexp/gen_spv.sh create mode 100755 vulkan/amber/ldexp/gen_spvasm.sh create mode 100644 vulkan/amber/ldexp/glsl_fails.txt create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i16vec2.amber create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i16vec2.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i16vec2.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i16vec2.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i32vec2.amber create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i32vec2.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i32vec2.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i32vec2.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i64vec2.amber create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i64vec2.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i64vec2.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i64vec2.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.amber create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i16vec4.amber create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i16vec4.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i16vec4.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i16vec4.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.amber create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.amber create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.amber create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.amber create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.amber create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i64vec2.amber create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i64vec2.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i64vec2.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i64vec2.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i8vec2.amber create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i8vec2.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i8vec2.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f32vec2_i8vec2.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.amber create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.amber create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i64vec4.amber create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i64vec4.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i64vec4.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i64vec4.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i8vec4.amber create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i8vec4.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i8vec4.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f32vec4_i8vec4.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i16vec2.amber create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i16vec2.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i16vec2.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i16vec2.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i32vec2.amber create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i32vec2.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i32vec2.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i32vec2.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i64vec2.amber create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i64vec2.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i64vec2.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i64vec2.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.amber create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i16vec4.amber create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i16vec4.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i16vec4.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i16vec4.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.amber create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.amber create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.amber create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.glsl create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_float16_int16.amber create mode 100644 vulkan/amber/ldexp/ldexp_float16_int32.amber create mode 100644 vulkan/amber/ldexp/ldexp_float16_int64.amber create mode 100644 vulkan/amber/ldexp/ldexp_float16_int8.amber create mode 100644 vulkan/amber/ldexp/ldexp_float16_t_int16_t.glsl create mode 100644 vulkan/amber/ldexp/ldexp_float16_t_int16_t.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_float16_t_int16_t.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_float16_t_int32_t.glsl create mode 100644 vulkan/amber/ldexp/ldexp_float16_t_int32_t.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_float16_t_int32_t.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_float16_t_int64_t.glsl create mode 100644 vulkan/amber/ldexp/ldexp_float16_t_int64_t.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_float16_t_int64_t.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_float16_t_int8_t.glsl create mode 100644 vulkan/amber/ldexp/ldexp_float16_t_int8_t.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_float16_t_int8_t.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_float32_int16.amber create mode 100644 vulkan/amber/ldexp/ldexp_float32_int32.amber create mode 100644 vulkan/amber/ldexp/ldexp_float32_int64.amber create mode 100644 vulkan/amber/ldexp/ldexp_float32_int8.amber create mode 100644 vulkan/amber/ldexp/ldexp_float32_t_int16_t.glsl create mode 100644 vulkan/amber/ldexp/ldexp_float32_t_int16_t.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_float32_t_int16_t.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_float32_t_int32_t.glsl create mode 100644 vulkan/amber/ldexp/ldexp_float32_t_int32_t.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_float32_t_int32_t.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_float32_t_int64_t.glsl create mode 100644 vulkan/amber/ldexp/ldexp_float32_t_int64_t.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_float32_t_int64_t.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_float32_t_int8_t.glsl create mode 100644 vulkan/amber/ldexp/ldexp_float32_t_int8_t.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_float32_t_int8_t.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_float64_int16.amber create mode 100644 vulkan/amber/ldexp/ldexp_float64_int32.amber create mode 100644 vulkan/amber/ldexp/ldexp_float64_int64.amber create mode 100644 vulkan/amber/ldexp/ldexp_float64_int8.amber create mode 100644 vulkan/amber/ldexp/ldexp_float64_t_int16_t.glsl create mode 100644 vulkan/amber/ldexp/ldexp_float64_t_int16_t.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_float64_t_int16_t.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_float64_t_int32_t.glsl create mode 100644 vulkan/amber/ldexp/ldexp_float64_t_int32_t.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_float64_t_int32_t.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_float64_t_int64_t.glsl create mode 100644 vulkan/amber/ldexp/ldexp_float64_t_int64_t.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_float64_t_int64_t.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/ldexp_float64_t_int8_t.glsl create mode 100644 vulkan/amber/ldexp/ldexp_float64_t_int8_t.glsl.spv create mode 100644 vulkan/amber/ldexp/ldexp_float64_t_int8_t.glsl.spv.spvasm create mode 100644 vulkan/amber/ldexp/template.amber create mode 100644 vulkan/amber/ldexp/template.glsl create mode 100644 vulkan/amber/memory_model/message_passing/permuted_index/barrier.amber create mode 100644 vulkan/amber/memory_model/message_passing/permuted_index/release_acquire.amber create mode 100644 vulkan/amber/memory_model/message_passing/permuted_index/release_acquire_atomic_payload.amber create mode 100644 vulkan/amber/non_robust_buffer_access/unexecuted_oob_overflow.amber create mode 100644 vulkan/amber/non_robust_buffer_access/unexecuted_oob_underflow.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_uint16.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_uint8.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_with_adjacency_uint16.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_with_adjacency_uint8.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_uint16.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_uint8.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_with_adjacency_uint16.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_with_adjacency_uint8.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_patch_list_uint16.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_patch_list_uint8.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_point_list_uint16.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_point_list_uint8.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_fan_uint16.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_fan_uint8.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_uint16.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_uint8.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_with_adjacency_uint16.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_with_adjacency_uint8.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_uint16.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_uint8.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_with_adjacency_uint16.amber create mode 100644 vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_with_adjacency_uint8.amber create mode 100644 vulkan/amber/pipeline/layer_read_from_frag.amber create mode 100644 vulkan/amber/pipeline/nonuniform_interpolant_indexing/centroid.amber create mode 100644 vulkan/amber/pipeline/nonuniform_interpolant_indexing/offset.amber create mode 100644 vulkan/amber/pipeline/nonuniform_interpolant_indexing/sample.amber create mode 100644 vulkan/amber/pipeline/position_to_ssbo.amber create mode 100644 vulkan/amber/pipeline/primitive_id_from_tess.amber create mode 100644 vulkan/amber/pipeline/reinterpolate_at_centroid.amber create mode 100644 vulkan/amber/pipeline/reinterpolate_at_sample.amber create mode 100644 vulkan/amber/rasterization/depth_bias/d16_unorm.amber create mode 100644 vulkan/amber/rasterization/depth_bias/d16_unorm_constant_one.amber create mode 100644 vulkan/amber/rasterization/depth_bias/d16_unorm_constant_one_greater.amber create mode 100644 vulkan/amber/rasterization/depth_bias/d16_unorm_constant_one_less.amber create mode 100644 vulkan/amber/rasterization/depth_bias/d16_unorm_slope.amber create mode 100644 vulkan/amber/rasterization/depth_bias/d24_unorm.amber create mode 100644 vulkan/amber/rasterization/depth_bias/d24_unorm_constant_one.amber create mode 100644 vulkan/amber/rasterization/depth_bias/d24_unorm_constant_one_greater.amber create mode 100644 vulkan/amber/rasterization/depth_bias/d24_unorm_constant_one_less.amber create mode 100644 vulkan/amber/rasterization/depth_bias/d32_sfloat.amber create mode 100644 vulkan/amber/rasterization/depth_bias/d32_sfloat_constant_one.amber create mode 100644 vulkan/amber/rasterization/depth_bias/d32_sfloat_constant_one_greater.amber create mode 100644 vulkan/amber/rasterization/depth_bias/d32_sfloat_constant_one_less.amber create mode 100644 vulkan/amber/rasterization/line_continuity/line-strip.amber create mode 100644 vulkan/amber/rasterization/line_continuity/polygon-mode-lines.amber create mode 100644 vulkan/amber/ray_tracing/barycentrics.amber create mode 100644 vulkan/amber/ray_tracing/basic.amber create mode 100644 vulkan/amber/ray_tracing/basic2.amber create mode 100644 vulkan/amber/ray_tracing/basic_lib.amber create mode 100644 vulkan/amber/ray_tracing/different-payload-sizes.amber create mode 100644 vulkan/amber/ray_tracing/divergent-as.amber create mode 100644 vulkan/amber/ray_tracing/flags-accept-first.amber create mode 100644 vulkan/amber/ray_tracing/flags-culling.amber create mode 100644 vulkan/amber/ray_tracing/flags-force-non-opaque.amber create mode 100644 vulkan/amber/ray_tracing/flags-force-opaque.amber create mode 100644 vulkan/amber/ray_tracing/flags-skip-chit.amber create mode 100644 vulkan/amber/ray_tracing/rt-sample.amber create mode 100644 vulkan/amber/reconvergence/maximal/fragment/demote_entire_quad.amber create mode 100644 vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_backslash.amber create mode 100644 vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_bottom.amber create mode 100644 vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_left.amber create mode 100644 vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_right.amber create mode 100644 vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_slash.amber create mode 100644 vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_top.amber create mode 100644 vulkan/amber/reconvergence/maximal/fragment/demote_invocation.amber create mode 100644 vulkan/amber/reconvergence/maximal/fragment/terminate_invocation.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_16bit.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_32bit.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_64bit.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_8bit.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_16bit.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_32bit.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_64bit.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_8bit.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/ptr_access_chain/workgroup.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/ptr_access_chain/workgroup_bad_stride.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_findumsb.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_umax.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_umin.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_findsmsb.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_ssign.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_atomicumax.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_atomicumin.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ugreaterthan.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ugreaterthanequal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ulessthan.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ulessthanequal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_atomicsmax.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_atomicsmin.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_sdiv.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_smulextended.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_snegate.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_umulextended.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/switch/switch-case-to-merge-block.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/undef/undefined_constant_composite.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/undef/undefined_spec_constant_composite.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/unreachable/unreachable-switch-merge-in-loop.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/compute/vector_shuffle/vector_shuffle.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_comp.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_geom.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_tesc.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_tese.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_vert.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_comp.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_frag.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_geom.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_tesc.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_tese.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_vert.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_comp.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_frag.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_geom.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_tesc.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_tese.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_vert.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_comp.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_frag.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_geom.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_tesc.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_tese.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_vert.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/grid_vertices.txt create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/input.txt create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_comp.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_frag.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_geom.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_tesc.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_tese.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_vert.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_comp.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_frag.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_geom.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_tesc.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_tese.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_vert.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_comp.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_frag.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_geom.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_tesc.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_tese.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_vert.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_comp.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_frag.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_geom.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_tesc.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_tese.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_vert.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/function_params/sampler_param.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_greater.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_greater_or_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_less.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_less_or_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_greater.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_greater_or_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_less.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_0.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_3.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_4.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_0.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_1.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_2.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_3.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_4.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_1.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/graphics/fragment/mixedrelaxedprecisionoperands.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/image_query/samples_storage.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_pc_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_ssbo_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_ubo_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_workgroup_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/frag_pc_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/frag_ssbo_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/frag_ubo_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/geom_pc_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/geom_ssbo_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/geom_ubo_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_con_pc_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_con_ssbo_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_con_ubo_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_eval_pc_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_eval_ssbo_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_eval_ubo_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/vert_pc_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/vert_ssbo_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/vert_ubo_entry_point.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/counter_buffer.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/member_decorate_string.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/iteration_multiple.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/max_iterations.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/min_iterations.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/partial_count.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/peel_count.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/function_2_nonwritable.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/function_nonwritable.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/non_main_function_nonwritable.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/private_2_nonwritable.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/private_nonwritable.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/different_matrix_layout.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/different_matrix_strides.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/nested_arrays_different_inner_stride.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/nested_arrays_different_outer_stride.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/nested_arrays_different_strides.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/same_array_two_ids.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/same_struct_two_ids.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/ssbo_to_ubo.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/two_arrays_different_stride_1.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/two_arrays_different_stride_2.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/ubo_to_ssbo.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopymemory/different_alignments.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopymemory/no_source_access_operands.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopymemory/no_target_access_operands.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/ssbo_comparisons_diff.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/variable_pointers_vars_ssbo_2_diff.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/variable_pointers_vars_ssbo_diff.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/variable_pointers_vars_wg_diff.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/wg_comparisons_diff.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/different_ssbos_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/different_wgs_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/null_comparisons_ssbo_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/null_comparisons_wg_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/simple_variable_pointers_ptr_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/ssbo_comparisons_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_ssbo_2_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_ssbo_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_vars_ssbo_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_vars_wg_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_wg_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/wg_comparisons_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/different_ssbos_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/different_wgs_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/null_comparisons_ssbo_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/null_comparisons_wg_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/simple_variable_pointers_ptr_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/ssbo_comparisons_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_ssbo_2_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_ssbo_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_vars_ssbo_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_vars_wg_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_wg_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/wg_comparisons_not_equal.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/array_select.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/array_stride_select.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/nested_array_select.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/nested_struct_select.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/scalar_select.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/ssbo_pointers_2_select.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/ssbo_pointers_select.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/struct_select.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/vector_element_select.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/vector_select.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/wg_pointers_2_select.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/wg_pointers_select.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_16.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_16_64_bit.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_251658240_64_bits.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_61440.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_truncate_16.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_truncate_16_64_bit.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_truncate_983040.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_zero_extend_n4096.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/partially_active_uniform_id.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/subgroup_cfg_uniform_id.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/subgroup_uniform.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/workgroup_cfg_uniform_id.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/workgroup_uniform.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/wrap/no_signed_wrap.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/spirv1p4/wrap/no_unsigned_wrap.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_image_atomic.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_image_store.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_null_pointer_load.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_null_pointer_store.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_out_of_bounds_atomic.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_out_of_bounds_load.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_out_of_bounds_store.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_output_write.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_ssbo_atomic.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_ssbo_store.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/ssbo_atomic_before_terminate.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/subgroup_ballot.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/subgroup_vote.amber create mode 100644 vulkan/amber/spirv_assembly/instruction/terminate_invocation/terminate_loop.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge00.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge01.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge02.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge03.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge04.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge05.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge06.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge07.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge08.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge09.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge10.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge11.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge12.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge13.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge14.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge15.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge16.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge17.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge18.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge19.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge20.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial00.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial01.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial02.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial03.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial04.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial05.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial06.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial07.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial08.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial09.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial10.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial11.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial12.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial13.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial14.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial15.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial16.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial17.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial18.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial19.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial20.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge00.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge01.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge02.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge03.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge04.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge05.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge06.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge07.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge08.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge09.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge10.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge11.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge12.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge13.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge14.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge15.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge16.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge17.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge18.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge19.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge20.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial00.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial01.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial02.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial03.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial04.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial05.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial06.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial07.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial08.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial09.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial10.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial11.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial12.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial13.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial14.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial15.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial16.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial17.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial18.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial19.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial20.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge00.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge01.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge02.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge03.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge04.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge05.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge06.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge07.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge08.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge09.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge10.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge11.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge12.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge13.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge14.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge15.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge16.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge17.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge18.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge19.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge20.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial00.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial01.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial02.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial03.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial04.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial05.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial06.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial07.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial08.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial09.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial10.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial11.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial12.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial13.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial14.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial15.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial16.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial17.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial18.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial19.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial20.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge00.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge01.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge02.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge03.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge04.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge05.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge06.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge07.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge08.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge09.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge10.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge11.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge12.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge13.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge14.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge15.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge16.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge17.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge18.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge19.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge20.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial00.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial01.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial02.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial03.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial04.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial05.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial06.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial07.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial08.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial09.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial10.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial11.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial12.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial13.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial14.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial15.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial16.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial17.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial18.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial19.amber create mode 100644 vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial20.amber create mode 100644 vulkan/amber/tessellation/tess_factor_barrier_bug.amber create mode 100644 vulkan/amber/texture/conversion/snorm_clamp/a2b10g10r10-snorm-pack32.amber create mode 100644 vulkan/amber/texture/conversion/snorm_clamp/a2r10g10b10-snorm-pack32.amber create mode 100644 vulkan/amber/texture/conversion/snorm_clamp/a8b8g8r8-snorm-pack32.amber create mode 100644 vulkan/amber/texture/conversion/snorm_clamp/b8g8r8-snorm.amber create mode 100644 vulkan/amber/texture/conversion/snorm_clamp/b8g8r8a8-snorm.amber create mode 100644 vulkan/amber/texture/conversion/snorm_clamp/r16-snorm.amber create mode 100644 vulkan/amber/texture/conversion/snorm_clamp/r16g16-snorm.amber create mode 100644 vulkan/amber/texture/conversion/snorm_clamp/r16g16b16-snorm.amber create mode 100644 vulkan/amber/texture/conversion/snorm_clamp/r16g16b16a16-snorm.amber create mode 100644 vulkan/amber/texture/conversion/snorm_clamp/r8-snorm.amber create mode 100644 vulkan/amber/texture/conversion/snorm_clamp/r8g8-snorm.amber create mode 100644 vulkan/amber/texture/conversion/snorm_clamp/r8g8b8-snorm.amber create mode 100644 vulkan/amber/texture/conversion/snorm_clamp/r8g8b8a8-snorm.amber create mode 100644 vulkan/amber/texture/conversion/ufloat_negative_values/b10g11r11-ufloat-pack32.amber create mode 100644 vulkan/amber/texture/multisample/atomic/storage_image_r32i.amber create mode 100644 vulkan/amber/texture/multisample/atomic/storage_image_r32ui.amber create mode 100644 vulkan/amber/texture/multisample/atomic/storage_image_r64i.amber create mode 100644 vulkan/amber/texture/multisample/atomic/storage_image_r64ui.amber create mode 100644 vulkan/amber/texture/multisample/invalidsampleindex/sample_count_16.amber create mode 100644 vulkan/amber/texture/multisample/invalidsampleindex/sample_count_2.amber create mode 100644 vulkan/amber/texture/multisample/invalidsampleindex/sample_count_32.amber create mode 100644 vulkan/amber/texture/multisample/invalidsampleindex/sample_count_4.amber create mode 100644 vulkan/amber/texture/multisample/invalidsampleindex/sample_count_64.amber create mode 100644 vulkan/amber/texture/multisample/invalidsampleindex/sample_count_8.amber create mode 100644 vulkan/amber/texture/shadow/texel_replacement/d32_sfloat.amber create mode 100644 vulkan/amber/texture/subgroup_lod/texel_fetch.amber create mode 100644 vulkan/amber/texture/subgroup_lod/texture_grad.amber create mode 100644 vulkan/amber/texture/subgroup_lod/texture_lod.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/packed/a2b10g10r10-uint-pack32.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/packed/a2b10g10r10-unorm-pack32.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-sint-pack32.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-snorm-pack32.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-uint-pack32.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-unorm-pack32.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/packed/b10g11r11-ufloat-pack32.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/snorm/b8g8r8-snorm.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/snorm/b8g8r8a8-snorm.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/snorm/r16-snorm.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/snorm/r16g16-snorm.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/snorm/r16g16b16-snorm.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/snorm/r16g16b16a16-snorm.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/snorm/r8-snorm.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/snorm/r8g8-snorm.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/snorm/r8g8b8-snorm.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/snorm/r8g8b8a8-snorm.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8_srgb.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8a8_srgb.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/srgb/r8_srgb.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8_srgb.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8_srgb.amber create mode 100644 vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8a8_srgb.amber create mode 100644 vulkan/amber/texture/texel_offset/texel_offset.amber create mode 100644 vulkan/data/copy_memory_indirect/sample_text.txt create mode 100644 vulkan/data/gdeflate/compressed_17k_level_0.gdef create mode 100644 vulkan/data/gdeflate/compressed_17k_level_12.gdef create mode 100644 vulkan/data/gdeflate/compressed_17k_level_6.gdef create mode 100644 vulkan/data/gdeflate/compressed_64k_level_0.gdef create mode 100644 vulkan/data/gdeflate/compressed_64k_level_12.gdef create mode 100644 vulkan/data/gdeflate/compressed_64k_level_6.gdef create mode 100644 vulkan/data/gdeflate/decompressed_17k.gdef create mode 100644 vulkan/data/gdeflate/decompressed_64k.gdef create mode 100644 vulkan/data/geometry/position.png create mode 100644 vulkan/device_generated_commands/ScratchSpace.comp create mode 100644 vulkan/device_generated_commands/ScratchSpace.comp.spvasm create mode 100644 vulkan/draw/ConcurrentPayload.comp create mode 100644 vulkan/draw/NegateData.comp create mode 100644 vulkan/draw/VertexFetch.frag create mode 100644 vulkan/draw/VertexFetch.vert create mode 100644 vulkan/draw/VertexFetchCount.frag create mode 100644 vulkan/draw/VertexFetchCount.vert create mode 100644 vulkan/draw/VertexFetchInstanceIndex.vert create mode 100644 vulkan/draw/VertexFetchInstanced.vert create mode 100644 vulkan/draw/VertexFetchInstancedFirstInstance.vert create mode 100644 vulkan/draw/VertexFetchShaderDrawParameters.vert create mode 100644 vulkan/draw/VertexFetchShaderDrawParametersBaseInst.vert create mode 100644 vulkan/draw/VertexFetchShaderDrawParametersBaseVert.vert create mode 100644 vulkan/draw/VertexFetchShaderDrawParametersDrawIndex.vert create mode 100644 vulkan/dynamic_state/VertexFetch.frag create mode 100644 vulkan/dynamic_state/VertexFetch.mesh create mode 100644 vulkan/dynamic_state/VertexFetch.vert create mode 100644 vulkan/dynamic_state/VertexFetchLines.mesh create mode 100644 vulkan/dynamic_state/VertexFetchViewportArray.mesh create mode 100644 vulkan/dynamic_state/ViewportArray.geom create mode 100644 vulkan/video/frame_checksums.py create mode 100644 vulkan/video/frame_checksums_ffmpeg.py diff --git a/vulkan/amber/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order.amber b/vulkan/amber/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order.amber new file mode 100644 index 0000000..8f3ea8b --- /dev/null +++ b/vulkan/amber/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order.amber @@ -0,0 +1,73 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER compute compute_shader GLSL +#version 430 + +layout(set = 0, binding = 0) readonly uniform block0 +{ + int data0; +}; + +layout(set = 0, binding = 1) readonly uniform block1 +{ + int data1; +}; + +layout(set = 0, binding = 2) readonly uniform block2 +{ + int data2; +}; + +layout(set = 0, binding = 3) buffer result +{ + int res0; + int res1; + int res2; +}; + +void main() +{ + res0 = data0; + res1 = data1; + res2 = data2; +} +END + +# Here the size is in terms of items. +BUFFER buf0 DATA_TYPE int32 SIZE 1024 SERIES_FROM 0 INC_BY 1 +BUFFER buf1 DATA_TYPE int32 SIZE 1024 SERIES_FROM 1 INC_BY 1 +BUFFER buf2 DATA_TYPE int32 SIZE 1024 SERIES_FROM 2 INC_BY 1 +BUFFER result DATA_TYPE int32 DATA +0 0 0 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + # Note the binding order. The offsets below are in byte offsets. + BIND BUFFER buf0 AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 2 OFFSET 0 + BIND BUFFER buf1 AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 0 OFFSET 1024 + BIND BUFFER buf2 AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 1 OFFSET 2048 + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN pipeline 1 1 1 + +# Offset of 1024/4 = 256 items plus one since the series started from one. +EXPECT result IDX 0 EQ 257 +# Offset of 2048/4 = 512 items plus two since the series started from two. +EXPECT result IDX 4 EQ 514 +EXPECT result IDX 8 EQ 0 diff --git a/vulkan/amber/binding_model/dynamic_offset/shader_reuse_differing_layout_compute.amber b/vulkan/amber/binding_model/dynamic_offset/shader_reuse_differing_layout_compute.amber new file mode 100644 index 0000000..6a3d309 --- /dev/null +++ b/vulkan/amber/binding_model/dynamic_offset/shader_reuse_differing_layout_compute.amber @@ -0,0 +1,59 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER compute compute_shader GLSL +#version 430 + +layout(set = 0, binding = 1) buffer block0 +{ + vec4 data; +}; + +void main() +{ + data = vec4(1, 2, 3, 4); +} +END + +BUFFER buf_unused DATA_TYPE vec4 DATA +0.0 0.0 0.0 0.0 +1.0 1.0 1.0 1.0 +2.0 2.0 2.0 2.0 +END + +# The Vulkan spec lists the maximum value of minStorageBufferOffsetAlignment +# (i.e. the maximum possible alignment requirement) as 256 bytes. +# Allocate enough space to hold one vec4 (each 16 bytes) +# after the alignment (256 / 16 + 1). +BUFFER buf DATA_TYPE vec4 SIZE 17 FILL 0.0 + +PIPELINE compute pipeline0 + ATTACH compute_shader + + BIND BUFFER buf_unused AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 0 OFFSET 0 + BIND BUFFER buf AS storage_dynamic DESCRIPTOR_SET 0 BINDING 1 OFFSET 0 +END + +PIPELINE compute pipeline1 + ATTACH compute_shader + + BIND BUFFER buf AS storage_dynamic DESCRIPTOR_SET 0 BINDING 1 OFFSET 256 +END + +RUN pipeline0 1 1 1 +RUN pipeline1 1 1 1 + +EXPECT buf IDX 0 EQ 1.0 2.0 3.0 4.0 +EXPECT buf IDX 256 EQ 1.0 2.0 3.0 4.0 diff --git a/vulkan/amber/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics.amber b/vulkan/amber/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics.amber new file mode 100644 index 0000000..ef28bc0 --- /dev/null +++ b/vulkan/amber/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics.amber @@ -0,0 +1,106 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vtex_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; +layout(location = 0) out vec4 frag_color; + +layout(set = 0, binding = 1) readonly uniform block0 +{ + vec4 in_color; +}; + +void main() +{ + gl_Position = position; + frag_color = in_color; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) in vec4 frag_color; +layout(location = 0) out vec4 final_color; + +void main() +{ + final_color = frag_color; +} +END + +BUFFER buf_unused DATA_TYPE vec4 DATA +0.0 0.0 0.0 0.0 +1.0 1.0 1.0 1.0 +2.0 2.0 2.0 2.0 +END + +# The Vulkan spec lists the maximum value of minStorageBufferOffsetAlignment +# (i.e. the maximum possible alignment requirement) as 256 bytes. +# Meaningful data is placed at this offset. +BUFFER buf DATA_TYPE vec4 DATA +1.0 0.0 0.0 1.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 +0.0 1.0 0.0 1.0 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline0 + ATTACH vtex_shader + ATTACH frag_shader + + BIND BUFFER buf_unused AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 0 OFFSET 0 + BIND BUFFER buf AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 1 OFFSET 0 + BIND BUFFER framebuffer AS color LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 +END + +PIPELINE graphics pipeline1 + ATTACH vtex_shader + ATTACH frag_shader + + BIND BUFFER buf AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 1 OFFSET 256 + BIND BUFFER framebuffer AS color LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 +END + +CLEAR_COLOR pipeline0 0 0 0 255 +CLEAR pipeline0 +RUN pipeline0 DRAW_RECT POS 0 0 SIZE 128 128 +RUN pipeline1 DRAW_RECT POS 128 128 SIZE 128 128 + +EXPECT framebuffer IDX 0 0 SIZE 128 128 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 128 0 SIZE 128 128 EQ_RGBA 0 0 0 255 +EXPECT framebuffer IDX 128 128 SIZE 128 128 EQ_RGBA 0 255 0 255 +EXPECT framebuffer IDX 0 128 SIZE 128 128 EQ_RGBA 0 0 0 255 diff --git a/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_32bit_mat_3x3.amber b/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_32bit_mat_3x3.amber new file mode 100644 index 0000000..e050248 --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_32bit_mat_3x3.amber @@ -0,0 +1,112 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Matrix 3x3 determinant precision test 16bit + +DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class +DEVICE_EXTENSION VK_KHR_16bit_storage +DEVICE_FEATURE Float16Int8Features.shaderFloat16 + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + mat3 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + float detM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + f16mat3 matIn = f16mat3(matIns[ndx]); + float16_t det16bit = determinant(matIn); + detM[ndx] = uintBitsToFloat(packFloat2x16(f16vec2(det16bit, -1.0))); + } +} +END + +BUFFER bufIn DATA_TYPE mat3x3 DATA + 1.0 5.0 3.0 + 2.0 4.0 7.0 + 4.0 6.0 2.0 + + 1.0 0.0 1.0 + 0.0 0.0 1.0 + 1.0 1.0 1.0 + + -0.00400161743164062 -2.900390625 -41 + -0.419921875 0.00490188598632812 -0.016998291015625 + -0.7001953125 0.00500106811523438 -0.00259971618652344 + + -0.140000000596046 0.00109999999403954 -0.399999976158142 + -32 1.80000007152557 -0.046000003814697 + 5 0.00500000035390258 -27 + + -4.0234375 1.2275390625 21.125 + 5.73828125 90.5625 -60.4375 + -2.1484375 -1.27734375 -1.951171875 + + 6 4.80078125 0.1500244140625 + -100 3.599609375 3.099609375 + -50 0.040008544921875 80 + + 24.171875 2.798828125 0.82958984375 + -9.703125 1.1630859375 -17.46875 + -1.3828125 -4.83984375 3.56640625 + + -1.615234375 5.9296875 1.181640625 + 1.7802734375 19.1875 4.7578125 + 52.8125 -1.1171875 1.1513671875 + + 3.17578125 -2.3984375 4.12890625 + 1.3818359375 5.53125 1.8154296875 + -16.40625 -1.8486328125 0.95263671875 + + 1.615234375 0.62890625 2.73828125 + -0.9716796875 -18.828125 3.509765625 + -8.015625 3.5703125 5.98046875 +END + +BUFFER bufOut DATA_TYPE float SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT bufOut IDX 0 TOLERANCE 0.00000762939453125 EQ -0.00783267617225647 +EXPECT bufOut IDX 4 TOLERANCE 0.00000762939453125 EQ -0.00785732269287109 +EXPECT bufOut IDX 8 TOLERANCE 0.00000762939453125 EQ -0.00785386469215155 +EXPECT bufOut IDX 12 TOLERANCE 0.00000762939453125 EQ -0.00782984681427479 +EXPECT bufOut IDX 16 TOLERANCE 0.00000762939453125 EQ -0.00783849507570267 +EXPECT bufOut IDX 20 TOLERANCE 0.00000762939453125 EQ -0.00784130394458771 +EXPECT bufOut IDX 24 TOLERANCE 0.00000762939453125 EQ -0.00786752626299858 +EXPECT bufOut IDX 28 TOLERANCE 0.00000762939453125 EQ -0.00783427059650421 +EXPECT bufOut IDX 32 TOLERANCE 0.00000762939453125 EQ -0.00783521682024002 +EXPECT bufOut IDX 36 TOLERANCE 0.00000762939453125 EQ -0.00786614231765270 \ No newline at end of file diff --git a/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_32bit_mat_4x4.amber b/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_32bit_mat_4x4.amber new file mode 100644 index 0000000..c6975d7 --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_32bit_mat_4x4.amber @@ -0,0 +1,122 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Matrix 4x4 determinant precision test 16bit + +DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class +DEVICE_EXTENSION VK_KHR_16bit_storage +DEVICE_FEATURE Float16Int8Features.shaderFloat16 + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + mat4 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + float detM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + f16mat4 matIn = f16mat4(matIns[ndx]); + float16_t det16bit = determinant(matIn); + detM[ndx] = uintBitsToFloat(packFloat2x16(f16vec2(det16bit, -1.0))); + } +} +END + +BUFFER bufIn DATA_TYPE mat4x4 DATA + -1.0 1.0 4.0 2.0 + 2.0 -1.0 2.0 5.0 + 1.0 2.0 3.0 4.0 + 3.0 4.0 -1.0 2.0 + + 1.0 0.0 0.0 0.0 + 0.0 0.0 1.0 0.0 + 0.0 1.0 0.0 0.0 + 0.0 0.0 0.0 1.0 + + -0.08837890625 0.1569824219 0.001299858093 0.2451171875 + 0.0380859375 0.7124023438 -0.003200531006 0.9111328125 + 0.07598876953 0.09777832031 -1.060546875 1.904296875 + -0.4968261719 1.595703125 0.01309967041 -2.6953125 + + 42 0.3000488281 -0.04800415039 -270 + 15 4.80078125 -4.8984375 -41 + -0.1800537109 -0.7001953125 -0.02299499512 0.3701171875 + -0.000500202179 -0.002799987793 -0.7998046875 -0.2900390625 + + 500 -3.599609375 -15 37 + 2.900390625 -0.4699707031 3.19921875 4.69921875 + 0.09997558594 0.04400634766 0.005001068115 -0.02799987793 + -48 19 -1.099609375 0.03799438477 + + -17 -1100 -100 -0.01800537109 + 6 43 -3.099609375 20 + -2.30078125 0.002700805664 -0.000500202179 -1.900390625 + 0.3601074219 0.3100585938 -0.00479888916 0.02699279785 + + -3.384765625 3.154296875 -9.8671875 1.489257812 + -1.336914062 1.853515625 13.1875 4.7734375 + -2.580078125 54.8125 -5.62890625 -1.877929688 + -0.7348632812 -1.95703125 1.390625 5.82421875 + + -1.60546875 -18.71875 -2.263671875 2.4296875 + -2.67578125 -7.33984375 226.5 3.841796875 + 9.5234375 -3.541015625 -2.8828125 1.755859375 + 1.602539062 1.243164062 10.6796875 -0.7749023438 + + 25.703125 1.28125 2.548828125 -2.83203125 + -1.983398438 -2.9296875 -6.0625 -1.15625 + -2.45703125 -39.84375 0.8330078125 -4.12109375 + 0.814453125 0.6962890625 3.279296875 -2.87109375 + + -13.421875 -1.57421875 4.17578125 4.421875 + -1.33300781 2.875 -5.18359375 1.84960938 + -1.30273438 -5.03125 -0.909179688 1.53710938 + -17.03125 1.13378906 2.16601562 -1.44628906 +END + +BUFFER bufOut DATA_TYPE float SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT bufOut IDX 0 TOLERANCE 0.00000762939453125 EQ -0.007861733437 +EXPECT bufOut IDX 4 TOLERANCE 0.00000762939453125 EQ -0.007857322693 +EXPECT bufOut IDX 8 TOLERANCE 0.00000762939453125 EQ -0.007855851203 +EXPECT bufOut IDX 12 TOLERANCE 0.00000762939453125 EQ -0.007836524397 +EXPECT bufOut IDX 16 TOLERANCE 0.00000762939453125 EQ -0.007867698558 +EXPECT bufOut IDX 20 TOLERANCE 0.00000762939453125 EQ -0.007838701829 +EXPECT bufOut IDX 24 TOLERANCE 0.00000762939453125 EQ -0.007839817554 +EXPECT bufOut IDX 28 TOLERANCE 0.00000762939453125 EQ -0.007841326296 +EXPECT bufOut IDX 32 TOLERANCE 0.00000762939453125 EQ -0.007840413600 +EXPECT bufOut IDX 36 TOLERANCE 0.00000762939453125 EQ -0.007868356071 \ No newline at end of file diff --git a/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_mat_3x3.amber b/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_mat_3x3.amber new file mode 100644 index 0000000..8110836 --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_mat_3x3.amber @@ -0,0 +1,131 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Matrix 3x3 determinant precision test 16bit + +DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class +DEVICE_EXTENSION VK_KHR_16bit_storage +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + f16mat3 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + float16_t detM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + f16mat3 matIn = matIns[ndx]; + detM[ndx] = determinant(matIn); + } +} +END + +BUFFER bufIn DATA_TYPE mat3x3 DATA + 1.0 5.0 3.0 + 2.0 4.0 7.0 + 4.0 6.0 2.0 + + 1.0 0.0 1.0 + 0.0 0.0 1.0 + 1.0 1.0 1.0 + + -0.00400000019 -2.9000001 -41.0 + -0.419999987 0.00490000006 -0.0170000009 + -0.699999988 0.00500000035 -0.00260000001 + + -0.140000000596046 0.00109999999403954 -0.399999976158142 + -32.0 1.80000007152557 -0.046000003814697 + 5.0 0.00500000035390258 -27.0 + + -4.0233599 1.22770872 21.1278195 + 5.73735199 90.5568627 -60.4349515 + -2.14830406 -1.27748196 -1.95159347 + + 6.0 4.80000019073486 0.149999991059303 + -100.0 3.60000014305115 3.10000014305115 + -50.0 0.0399999991059303 80.0 + + 24.1753959 2.79813019 0.829575022 + -9.7064469 1.16276185 -17.4720435 + -1.38314259 -4.84031414 3.56710072 + + -1.61521246 5.92810797 1.18125284 + 1.78069006 19.186389 4.75964561 + 52.7974026 -1.11742044 1.15160604 + + 3.17625232 -2.39810968 4.12844617 + 1.38140651 5.53174748 1.81531844 + -16.4044715 -1.84897984 0.952559261 + + 1.61552133 0.62901187 2.73753558 + -0.971753372 -18.8233818 3.51006655 + -8.01648116 3.5704698 5.98052632 +END + +BUFFER bufOut DATA_TYPE float16 SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +# Decimals between 64 and 128: 0.0625 +EXPECT bufOut IDX 0 TOLERANCE 0.0625 EQ 74 + +# Decimals between 0.5 and 1: 0.00048828125 +EXPECT bufOut IDX 2 TOLERANCE 0.00048828125 EQ -1 + +# Decimals between 0.0625 and 0.125: 0.0002441406 +EXPECT bufOut IDX 4 TOLERANCE 0.0002441406 EQ -0.0858154296875 + +# Decimals between 8 and 16: 0.03125 +EXPECT bufOut IDX 6 TOLERANCE 0.03125 EQ 9.5156 + +# Integers between 4096 and 8192: 4 +EXPECT bufOut IDX 8 TOLERANCE 4.0 EQ 5140 + +# Integers between 32768 and 65536: 128 +EXPECT bufOut IDX 10 TOLERANCE 128 EQ 39424 + +# Decimals between 1024 and 2048: 4.0 +EXPECT bufOut IDX 12 TOLERANCE 4.0 EQ -1739.0 + +# Decimals between 128 and 256: 2.0 +EXPECT bufOut IDX 14 TOLERANCE 2.0 EQ 234.75 + +# Decimals between 256 and 512: 0.25 +EXPECT bufOut IDX 16 TOLERANCE 0.5 EQ 465.25 + +# Decimals between 512 and 1024: 1.0 +EXPECT bufOut IDX 18 TOLERANCE 1.0 EQ -638.0 \ No newline at end of file diff --git a/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_mat_4x4.amber b/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_mat_4x4.amber new file mode 100644 index 0000000..2915b01 --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp16_mat_4x4.amber @@ -0,0 +1,141 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Matrix 4x4 determinant precision test 16bit + +DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class +DEVICE_EXTENSION VK_KHR_16bit_storage +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + f16mat4 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + float16_t detM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + f16mat4 matIn = matIns[ndx]; + detM[ndx] = determinant(matIn); + } +} +END + +BUFFER bufIn DATA_TYPE mat4x4 DATA + -1.0 1.0 4.0 2.0 + 2.0 -1.0 2.0 5.0 + 1.0 2.0 3.0 4.0 + 3.0 4.0 -1.0 2.0 + + 1.0 0.0 0.0 0.0 + 0.0 0.0 1.0 0.0 + 0.0 1.0 0.0 0.0 + 0.0 0.0 0.0 1.0 + + -0.08837890625 0.1569824219 0.001299858093 0.2451171875 + 0.0380859375 0.7124023438 -0.003200531006 0.9111328125 + 0.07598876953 0.09777832031 -1.060546875 1.904296875 + -0.4968261719 1.595703125 0.01309967041 -2.6953125 + + 0.55322265625 -2.6953125 -12.75 -0.381103515625 + -0.473876953125 -0.014030456543 -4.9140625 -9.59375 + -1.083984375 0.62841796875 0.067443847656 -4.7734375 + -0.062286376953 -0.58935546875 -0.143798828125 0.4453125 + + 14.4765625 -4.6953125 -5.40625 2.572265625 + -3.298828125 9.1796875 2.822265625 6.46484375 + 3.6953125 3.67578125 -3.779296875 4.26953125 + -7.3828125 5.45703125 -7.4921875 3.99609375 + + -17 -1100 -100 -0.01800537109 + 6 43 -3.099609375 20 + -2.30078125 0.002700805664 -0.000500202179 -1.900390625 + 0.3601074219 0.3100585938 -0.00479888916 0.02699279785 + + -3.384765625 3.154296875 -9.8671875 1.489257812 + -1.336914062 1.853515625 13.1875 4.7734375 + -2.580078125 54.8125 -5.62890625 -1.877929688 + -0.7348632812 -1.95703125 1.390625 5.82421875 + + -1.60546875 -18.71875 -2.263671875 2.4296875 + -2.67578125 -7.33984375 226.5 3.841796875 + 9.5234375 -3.541015625 -2.8828125 1.755859375 + 1.602539062 1.243164062 10.6796875 -0.7749023438 + + 25.703125 1.28125 2.548828125 -2.83203125 + -1.983398438 -2.9296875 -6.0625 -1.15625 + -2.45703125 -39.84375 0.8330078125 -4.12109375 + 0.814453125 0.6962890625 3.279296875 -2.87109375 + + -13.421875 -1.57421875 4.17578125 4.421875 + -1.33300781 2.875 -5.18359375 1.84960938 + -1.30273438 -5.03125 -0.909179688 1.53710938 + -17.03125 1.13378906 2.16601562 -1.44628906 +END + +BUFFER bufOut DATA_TYPE float16 SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +# Decimals between 16 and 32: 0.015625 +EXPECT bufOut IDX 0 TOLERANCE 0.015625 EQ -26.0 + +# Decimals between 0.5 and 1: 0.00048828125 +EXPECT bufOut IDX 2 TOLERANCE 0.00048828125 EQ -1.0 + +# Decimals between 0.25 and 0.5: 0.00146484375 +EXPECT bufOut IDX 4 TOLERANCE 0.00146484375 EQ -0.3641016781 + +# Decimals between 32 and 64: 0.25 +EXPECT bufOut IDX 6 TOLERANCE 0.25 EQ 46.3125 + +# Decimals between 1024 and 2048: 12.0 +EXPECT bufOut IDX 8 TOLERANCE 12.0 EQ -1840 + +# Integers between 4096 and 8192: 24 +EXPECT bufOut IDX 10 TOLERANCE 24 EQ 6036 + +# Integers between 8192 and 16384: 64 +EXPECT bufOut IDX 12 TOLERANCE 64 EQ 13472 + +# Integers between 32768 and 65536: 128 +EXPECT bufOut IDX 14 TOLERANCE 128 EQ 40192 + +# Integers between 16384 and 32768: 96 +EXPECT bufOut IDX 16 TOLERANCE 96 EQ 20800 + +# Integers between 2048 and 4096: 8 +EXPECT bufOut IDX 18 TOLERANCE 8 EQ -3212 diff --git a/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp64_mat_3x3.amber b/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp64_mat_3x3.amber new file mode 100644 index 0000000..be69f94 --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp64_mat_3x3.amber @@ -0,0 +1,127 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Matrix 3x3 determinant precision test 64bit + +DEVICE_FEATURE shaderFloat64 + +SHADER compute compute_shader GLSL +#version 450 + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + dmat3 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + double detM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + dmat3 matIn = matIns[ndx]; + detM[ndx] = determinant(matIn); + } +} +END + +BUFFER bufIn DATA_TYPE mat3x3 DATA + 1.0 5.0 3.0 + 2.0 4.0 7.0 + 4.0 6.0 2.0 + + 1.0 0.0 1.0 + 0.0 0.0 1.0 + 1.0 1.0 1.0 + + -0.00400000019 -2.9000001 -41.0 + -0.419999987 0.00490000006 -0.0170000009 + -0.699999988 0.00500000035 -0.00260000001 + + -0.140000000596046 0.00109999999403954 -0.399999976158142 + -32.0 1.80000007152557 -0.046000003814697 + 5.0 0.00500000035390258 -27.0 + + -1.39999997615814 -0.449999988079071 -0.0 + 260.0 0.399999976158142 90.0 + -3.40000009536743 -0.419999986886978 -40.0 + + 6.0 4.80000019073486 0.149999991059303 + -100.0 3.60000014305115 3.10000014305115 + -50.0 0.0399999991059303 80.0 + + -16132.9695 59037.9967 -24574.7252 + 35850.322 46793.3449 -328946.914 + -22869.431 26404.5123 21301.7202 + + -251.256059 -18.9422633 -28.2466605 + -27.4345721 77.0803571 27.8791292 + -41.9989703 31.9438685 -44.1174942 + + -1690.54461 -17438.4039 -1783.23503 + -2073.71794 23603.1964 -51459.9156 + -1908.4221 3618.75624 3788.92769 + + -16.8431843 84.5075181 -18.2598076 + -14.9214002 -84.4076786 -15.1675014 + 21.3443665 -146.383183 -48.9589896 +END + +BUFFER bufOut DATA_TYPE double SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +# Decimals between 64 and 128: 1.421085472e-14 +EXPECT bufOut IDX 0 TOLERANCE 0.000000000000014210855 EQ 74 + +# Decimals between 0.5 and 1: 2.220446049e-16 +EXPECT bufOut IDX 8 TOLERANCE 0.0000000000000002220446 EQ -1 + +# Decimals between 0.0625 and 0.125: 2.775557562e-17 +EXPECT bufOut IDX 16 TOLERANCE 0.000000000000000222044605 EQ -0.085873487391295 + +# Decimals between 8 and 16: 1.776356839e-15 +EXPECT bufOut IDX 24 TOLERANCE 0.0000000000000017763569 EQ 9.5173150336492971682352 + +# Decimals between 4096 and 8192: 9.094947018e-13 +EXPECT bufOut IDX 32 TOLERANCE 0.000000000001818989403546 EQ -4572.819874970912419629875268 + +# Decimals between 32768 and 65536: 7.275957614e-12 +EXPECT bufOut IDX 40 TOLERANCE 0.0000000000072759576141834259 EQ 39409.657530142280652696 + +# Decimals between 1.407374884e+14 and 2.814749767e+14: 0.03125 +EXPECT bufOut IDX 48 TOLERANCE 0.125 EQ 193279112353655.781250 + +# Decimals between 1048576 and 2097152: 2.328306437e-10 +EXPECT bufOut IDX 56 TOLERANCE 0.00000000023283064365387 EQ 1056597.50481621926485282276659 + +# Decimals between 0.000244140625 and 0.00048828125: 0.00048828125 +EXPECT bufOut IDX 64 TOLERANCE 0.00048828125000000001 EQ -2382539145823.611328125 + +# Decimals between 131072 and 262144: 2.910383046e-11 +EXPECT bufOut IDX 72 TOLERANCE 0.00000000002910383046 EQ -194083.93092791094919429 diff --git a/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp64_mat_4x4.amber b/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp64_mat_4x4.amber new file mode 100644 index 0000000..e9fd0d3 --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/determinant_compute_fp64_mat_4x4.amber @@ -0,0 +1,137 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Matrix 4x4 determinant precision test 64bit + +DEVICE_FEATURE shaderFloat64 + +SHADER compute compute_shader GLSL +#version 450 + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + dmat4 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + double detM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + dmat4 matIn = matIns[ndx]; + detM[ndx] = determinant(matIn); + } +} +END + +BUFFER bufIn DATA_TYPE mat4x4 DATA + -1.0 1.0 4.0 2.0 + 2.0 -1.0 2.0 5.0 + 1.0 2.0 3.0 4.0 + 3.0 4.0 -1.0 2.0 + + 1.0 0.0 0.0 0.0 + 0.0 0.0 1.0 0.0 + 0.0 1.0 0.0 0.0 + 0.0 0.0 0.0 1.0 + + -0.0883788988 0.156982005 0.00129985996 0.245116994 + 0.0380859002 0.712401986 -0.00320053007 0.911132991 + 0.0759887993 0.097778298 -1.06054997 1.90429997 + -0.496825993 1.59570003 0.0130997002 -2.69531012 + + 42.0 0.300049007 -0.0480041988 -270.0 + 15.0 4.80077982 -4.89843988 -41.0 + -0.180053994 -0.700195014 -0.0229950007 0.370117009 + -0.000500202004 -0.00279998989 -0.799804986 -0.290039003 + + 500.0 -3.5999999 -15.0 37.0 + 2.9000001 -0.469999999 3.20000005 4.69999981 + 0.100000001 0.0439999998 0.00499999989 -0.0280000009 + -48.0 19.0 -1.10000002 0.0379999988 + + -17.0 -1100.0 -100.0 -0.0180054009 + 6.0 43.0 -3.09961009 20.0 + -2.30078006 0.00270081009 -0.000500202004 -1.90039003 + 0.360107005 0.310059011 -0.00479889009 0.026992799 + + 19.623375 16.395330 23.824263 16.653233 + -28.074343 -23.819447 24.132942 52.970188 + -19.421518 -22.756260 -17.654331 -18.975327 + 16.584002 19.627544 18.864560 20.070559 + + -0.00622151 -0.006746047 -0.002207905 -0.02056567 + -0.030076593 -0.0267689 0.01095024 -0.09132 + -0.01297636 0.04533594 -0.01379582 -0.01475323 + -0.004602736 -0.01200175 0.01090538 0.02836178 + + -0.0119948 -0.03789127 -0.00611719 0.0448515 + 0.04644695 -0.02320256 -0.03514489 -1.3571429 + -0.03181969 0.008329804 0.13061533 0.287190083 + -0.0098646 -0.587016575 0.040482634 -0.66131907 + + -49.9153838 -21.0593973 -46.518005 59.6618775 + -32.0837048 -15.4093261 22.1520919 32.4487472 + -18.0335364 19.6343962 40.2818031 -16.6847517 + 30.3650256 430.773516 335.057641 84.5618449 +END + +BUFFER bufOut DATA_TYPE double SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +# Decimals between 16 and 32: 3.552713679e-15 +EXPECT bufOut IDX 0 EQ -26 + +# Decimals between 0.5 and 1: 2.220446049e-16 +EXPECT bufOut IDX 8 EQ -1 + +# Decimals between 0.25 and 0.5: 1.110223025e-16 +EXPECT bufOut IDX 16 EQ -0.364101678133011 + +# Decimals between 1024 and 2048: 2.273736754e-13 +EXPECT bufOut IDX 24 EQ 1219.946419379439168064366576570556410934016 + +# Decimals between 1024 and 2048: 2.273736754e-13 +EXPECT bufOut IDX 32 EQ -1924.85973816225951203237126921896020732 + +# Decimals between 4096 and 8192: 9.094947018e-13 +EXPECT bufOut IDX 40 EQ 6034.51084090743653255911117932092367232645 + +# Decimals between 8192 and 16384: 1.818989404e-12 +EXPECT bufOut IDX 48 EQ -10978.146941518156549970360707 + +# Decimals between 2.384185791e-07 and 4.768371582e-07: 1.058791184e-22 +EXPECT bufOut IDX 56 EQ 0.0000003679074841726843985005892741 + +# Decimals between 0.0009765625 and 0.001953125: 4.33680869e-19 +EXPECT bufOut IDX 64 EQ 0.0009920748085783632901867328594585 + +# Decimals between 4194304 and 8388608: 7.450580597e-09 +EXPECT bufOut IDX 72 EQ 47256976.9201866878572731957034908014 \ No newline at end of file diff --git a/vulkan/amber/builtin/precision/square_matrix/determinant_highp_mat_3x3.amber b/vulkan/amber/builtin/precision/square_matrix/determinant_highp_mat_3x3.amber new file mode 100644 index 0000000..6681c20 --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/determinant_highp_mat_3x3.amber @@ -0,0 +1,126 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Matrix 3x3 determinant precision test float32_t + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_float32 : enable + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + f32mat3 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + float32_t detM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + f32mat3 matIn = matIns[ndx]; + detM[ndx] = determinant(matIn); + } +} +END + +BUFFER bufIn DATA_TYPE mat3x3 DATA + 1.0 5.0 3.0 + 2.0 4.0 7.0 + 4.0 6.0 2.0 + + 1.0 0.0 1.0 + 0.0 0.0 1.0 + 1.0 1.0 1.0 + + -0.00400000019 -2.9000001 -41.0 + -0.419999987 0.00490000006 -0.0170000009 + -0.699999988 0.00500000035 -0.00260000001 + + -0.140000000596046 0.00109999999403954 -0.399999976158142 + -32.0 1.80000007152557 -0.046000003814697 + 5.0 0.00500000035390258 -27.0 + + -1.39999997615814 -0.449999988079071 -0.0 + 260.0 0.399999976158142 90.0 + -3.40000009536743 -0.419999986886978 -40.0 + + 6.0 4.80000019073486 0.149999991059303 + -100.0 3.60000014305115 3.10000014305115 + -50.0 0.0399999991059303 80.0 + + -16132.9695 59037.9967 -24574.7252 + 35850.322 46793.3449 -328946.914 + -22869.431 26404.5123 21301.7202 + + -251.256059 -18.9422633 -28.2466605 + -27.4345721 77.0803571 27.8791292 + -41.9989703 31.9438685 -44.1174942 + + -1690.54461 -17438.4039 -1783.23503 + -2073.71794 23603.1964 -51459.9156 + -1908.4221 3618.75624 3788.92769 + + -16.8431843 84.5075181 -18.2598076 + -14.9214002 -84.4076786 -15.1675014 + 21.3443665 -146.383183 -48.9589896 +END + +BUFFER bufOut DATA_TYPE float SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +# Decimals between 64 and 128: 7.629394531e-06 +EXPECT bufOut IDX 0 TOLERANCE 0.0000076293945 EQ 74 + +# Decimals between 0.5 and 1: 1.192092896e-07 +EXPECT bufOut IDX 4 TOLERANCE 0.00000011920929 EQ -1 + +# Decimals between 0.0625 and 0.125: 1.490116119e-08 +EXPECT bufOut IDX 8 TOLERANCE 0.00000011920928955078125 EQ -0.0858734846115112 + +# Decimals between 8 and 16: 0.00000190734864 +EXPECT bufOut IDX 12 TOLERANCE 0.00000190734864 EQ 9.51731491088867 + +# Decimals between 4096 and 8192: 0.00048828125 +EXPECT bufOut IDX 16 TOLERANCE 0.00048828125 EQ -4572.8198749709125947182780748699 + +# Decimals between 32768 and 65536: 0.00390625 +EXPECT bufOut IDX 20 TOLERANCE 0.00390625 EQ 39409.657530142280691 + +# Integers between 1.407374884e+14 and 2.814749767e+14: 16777216 +EXPECT bufOut IDX 24 TOLERANCE 100663296 EQ 193279131910144 + +# Decimals between 1048576 and 2097152: 0.250 +EXPECT bufOut IDX 28 TOLERANCE 0.250 EQ 1056597.5 + +# Integers between 2.199023256e+12 and 4.398046511e+12: 524288 +EXPECT bufOut IDX 32 TOLERANCE 1048576 EQ -2382539145824 + +# Decimals between 131072 and 262144: 0.015625 +EXPECT bufOut IDX 36 TOLERANCE 0.03125 EQ -194083.90625 \ No newline at end of file diff --git a/vulkan/amber/builtin/precision/square_matrix/determinant_highp_mat_4x4.amber b/vulkan/amber/builtin/precision/square_matrix/determinant_highp_mat_4x4.amber new file mode 100644 index 0000000..d9f613c --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/determinant_highp_mat_4x4.amber @@ -0,0 +1,133 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Matrix 4x4 determinant precision test float32_t + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_float32 : enable + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + f32mat4 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + float32_t detM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + f32mat4 matIn = matIns[ndx]; + detM[ndx] = determinant(matIn); + } +} +END + +BUFFER bufIn DATA_TYPE mat4x4 DATA + -1.0 1.0 4.0 2.0 + 2.0 -1.0 2.0 5.0 + 1.0 2.0 3.0 4.0 + 3.0 4.0 -1.0 2.0 + + 1.0 0.0 0.0 0.0 + 0.0 0.0 1.0 0.0 + 0.0 1.0 0.0 0.0 + 0.0 0.0 0.0 1.0 + + -0.0883788988 0.156982005 0.00129985996 0.245116994 + 0.0380859002 0.712401986 -0.00320053007 0.911132991 + 0.0759887993 0.097778298 -1.06054997 1.90429997 + -0.496825993 1.59570003 0.0130997002 -2.69531012 + + 42 0.30004900694 -0.04800419882 -270 + 15 4.80077981949 -4.89843988419 -41 + -0.1800539941 -0.70019501448 -0.02299500071 0.37011700869 + -0.000500202 -0.00279998989 -0.79980498552 -0.2900390029 + + 500.0 -3.5999999 -15.0 37.0 + 2.9000001 -0.469999999 3.20000005 4.69999981 + 0.100000001 0.0439999998 0.00499999989 -0.0280000009 + -48.0 19.0 -1.10000002 0.0379999988 + + -17.0 -1100.0 -100.0 -0.0180054009 + 6.0 43.0 -3.09961009 20.0 + -2.30078006 0.00270081009 -0.000500202 -1.90039003 + 0.360107005 0.310059011 -0.00479889009 0.026992799 + + 19.623375 16.395330 23.824263 16.653233 + -28.074343 -23.819447 24.132942 52.970188 + -19.421518 -22.756260 -17.654331 -18.975327 + 16.584002 19.627544 18.864560 20.070559 + + -0.00622151 -0.006746047 -0.002207905 -0.02056567 + -0.030076593 -0.0267689 0.01095024 -0.09132 + -0.01297636 0.04533594 -0.01379582 -0.01475323 + -0.004602736 -0.01200175 0.01090538 0.02836178 + + -0.0119948 -0.03789127 -0.00611719 0.0448515 + 0.04644695 -0.02320256 -0.03514489 -1.3571429 + -0.03181969 0.008329804 0.13061533 0.287190083 + -0.0098646 -0.587016575 0.040482634 -0.66131907 + + -49.9153838 -21.0593973 -46.518005 59.6618775 + -32.0837048 -15.4093261 22.1520919 32.4487472 + -18.0335364 19.6343962 40.2818031 -16.6847517 + 30.3650256 430.773516 335.057641 84.5618449 +END + +BUFFER bufOut DATA_TYPE float SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT bufOut IDX 0 EQ -26 +EXPECT bufOut IDX 4 EQ -1 + +# Decimals between 0.25 and 0.5: 2.384185791e-07 +EXPECT bufOut IDX 8 TOLERANCE 0.000030517578125 EQ -0.364101678133011 + +# Decimals between 1024 and 2048: 0.00048828125 +EXPECT bufOut IDX 12 TOLERANCE 0.00048828125 EQ 1219.946419379439168064366576570556410934016 + +# Decimals between 1024 and 2048: 0.001220703125 +EXPECT bufOut IDX 16 TOLERANCE 0.001220703125 EQ -1924.85973816225951203237126921896020732 + +# Decimals between 4096 and 8192: 0.0048828125 +EXPECT bufOut IDX 20 TOLERANCE 0.0048828125 EQ 6034.51084090743653255911117932092367232645 + +# Decimals between 8192 and 16384: 0.0009765625 +EXPECT bufOut IDX 24 TOLERANCE 0.0625 EQ -10978.146941518156549970360707 + +# Decimals between 2.384185791e-07 and 4.768371582e-07: 4.768371582e-07 +EXPECT bufOut IDX 28 TOLERANCE 0.00000047683716 EQ 0.0000003679074841726843985005892741 + +# Decimals between 0.0009765625 and 0.001953125: 0.000061035156 +EXPECT bufOut IDX 32 TOLERANCE 0.000061035156 EQ 0.0009920748085783632901867328594585 + +# Decimal between 4194304 and 8388608: 20 +EXPECT bufOut IDX 36 TOLERANCE 20 EQ 47256980 \ No newline at end of file diff --git a/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_32bit_mat_3x3.amber b/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_32bit_mat_3x3.amber new file mode 100644 index 0000000..7fe4d54 --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_32bit_mat_3x3.amber @@ -0,0 +1,122 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Matrix 3x3 inverse precision test 16bit + +DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class +DEVICE_EXTENSION VK_KHR_16bit_storage +DEVICE_FEATURE Float16Int8Features.shaderFloat16 + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + mat3 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + mat3 invOutM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + f16mat3 matIn_16 = f16mat3(matIns[ndx]); + f16mat3 matInv_16 = inverse(matIn_16); + + f16mat3 transMat_16 = f16mat3(vec3(matIn_16[0][0], matIn_16[1][0], matIn_16[2][0]), + vec3(matIn_16[0][1], matIn_16[1][1], matIn_16[2][1]), + vec3(matIn_16[0][2], matIn_16[1][2], matIn_16[2][2])); + + for (int row = 0; row < 3; row++) + { + for (int col = 0; col < 3; col++) + { + invOutM[ndx][row][col] = uintBitsToFloat(packFloat2x16(f16vec2(matInv_16[row][col], -1.0))); + } + } + } +} +END + +BUFFER bufIn DATA_TYPE mat3x3 DATA + 1.0 5.0 3.0 + 2.0 4.0 7.0 + 4.0 6.0 2.0 + + 1.0 0.0 1.0 + 0.0 0.0 1.0 + 1.0 1.0 1.0 + + -0.00400161743164062 -2.900390625 -41 + -0.419921875 0.00490188598632812 -0.016998291015625 + -0.7001953125 0.00500106811523438 -0.00259971618652344 + + -0.140000000596046 0.00109999999403954 -0.399999976158142 + -32 1.80000007152557 -0.046000003814697 + 5 0.00500000035390258 -27 + + -4.0234375 1.2275390625 21.125 + 5.73828125 90.5625 -60.4375 + -2.1484375 -1.27734375 -1.951171875 + + 1.71191406 -6.6796875 3.72460938 + 4.828125 0.152832031 0.327636719 + -0.126586914 1.70605469 0.860351562 + + 24.171875 2.798828125 0.82958984375 + -9.703125 1.1630859375 -17.46875 + -1.3828125 -4.83984375 3.56640625 + + -1.615234375 5.9296875 1.181640625 + 1.7802734375 19.1875 4.7578125 + 52.8125 -1.1171875 1.1513671875 + + 3.17578125 -2.3984375 4.12890625 + 1.3818359375 5.53125 1.8154296875 + -16.40625 -1.8486328125 0.95263671875 + + 1.615234375 0.62890625 2.73828125 + -0.9716796875 -18.828125 3.509765625 + -8.015625 3.5703125 5.98046875 +END + +BUFFER bufOut DATA_TYPE mat3x3 SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 +EXPECT bufOut IDX 0 TOLERANCE 0.00000762939453125 EQ -0.0078562144190073 -0.00782368611544371 -0.00782512966543436 -0.00782518088817596 -0.00785453896969557 -0.00785134267061949 -0.0078532500192523 -0.00782443396747112 -0.00785379111766815 +EXPECT bufOut IDX 48 TOLERANCE 0.00000762939453125 EQ -0.00782680511474609 -0.00785732269287109 -0.007843017578125 -0.00785732269287109 -0.007843017578125 -0.00782680511474609 -0.007843017578125 -0.00782680511474609 -0.007843017578125 +EXPECT bufOut IDX 96 TOLERANCE 0.00000762939453125 EQ -0.00784752238541842 -0.00782798510044813 -0.00785871222615242 -0.0078544681891799 -0.0078347260132432 -0.00786453858017921 -0.00785158388316631 -0.00786159280687571 -0.00783040374517441 +EXPECT bufOut IDX 144 TOLERANCE 0.00000762939453125 EQ -0.00785949360579252 -0.00781868956983089 -0.00782319065183401 -0.00786344427615404 -0.0078260563313961 -0.00782713387161493 -0.00785725098103285 -0.00781663320958614 -0.00785203743726015 +EXPECT bufOut IDX 192 TOLERANCE 0.00000762939453125 EQ -0.00785310473293066 -0.00784990470856428 -0.00785593315958977 -0.00782180111855268 -0.00782043673098087 -0.0078520905226469 -0.00782219227403402 -0.00784830655902624 -0.00785365328192711 +EXPECT bufOut IDX 240 TOLERANCE 0.00000762939453125 EQ -0.00785053987056017 -0.00782458204776049 -0.00785305164754391 -0.00785365793853998 -0.00782210659235716 -0.00782508961856365 -0.0078240754082799 -0.00785269215703011 -0.00782596692442894 +EXPECT bufOut IDX 288 TOLERANCE 0.00000762939453125 EQ -0.00782249309122562 -0.00782015733420849 -0.00782187841832638 -0.00785263068974018 -0.00785313174128532 -0.00785532407462597 -0.00785235036164522 -0.00785354617983103 -0.00785256922245026 +EXPECT bufOut IDX 336 TOLERANCE 0.00000762939453125 EQ -0.00782382301986217 -0.00785266328603029 -0.00782157573848963 -0.00782686658203602 -0.00785550847649574 -0.00782235898077488 -0.0078593110665679 -0.00782712083309889 -0.00785486306995153 +EXPECT bufOut IDX 384 TOLERANCE 0.00000762939453125 EQ -0.00782125908881426 -0.00785109400749207 -0.0078533822670579 -0.00785357225686312 -0.00782414898276329 -0.00784495379775763 -0.00782443396747112 -0.0078235175460577 -0.00782245025038719 +EXPECT bufOut IDX 432 TOLERANCE 0.00000762939453125 EQ -0.00782448425889015 -0.00785084161907434 -0.00785383861511946 -0.00782214943319559 -0.00785311032086611 -0.00782076641917229 -0.00782483350485563 -0.0078211622312665 -0.00782250612974167 \ No newline at end of file diff --git a/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_32bit_mat_4x4.amber b/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_32bit_mat_4x4.amber new file mode 100644 index 0000000..d38c9b6 --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_32bit_mat_4x4.amber @@ -0,0 +1,132 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Matrix 4x4 inverse precision test 16bit storage 32bit + +DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class +DEVICE_EXTENSION VK_KHR_16bit_storage +DEVICE_FEATURE Float16Int8Features.shaderFloat16 + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + mat4 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + mat4 invOutM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + f16mat4 matIn_16 = f16mat4(matIns[ndx]); + f16mat4 matInv_16 = inverse(matIn_16); + + for (int row = 0; row < 4; row++) + { + for (int col = 0; col < 4; col++) + { + invOutM[ndx][row][col] = uintBitsToFloat(packFloat2x16(f16vec2(matInv_16[row][col], float16_t(-1.0)))); + + // Some GPUs are handling -0.0 as 0.0 when others don't. + if (matInv_16[row][col] == -0.0) invOutM[ndx][row][col] = uintBitsToFloat(packFloat2x16(f16vec2(0.0, float16_t(-1.0)))); + } + } + } +} +END + +BUFFER bufIn DATA_TYPE mat4x4 DATA + -1.0 1.0 4.0 2.0 + 2.0 -1.0 2.0 5.0 + 1.0 2.0 3.0 4.0 + 3.0 4.0 -1.0 2.0 + + 1.0 0.0 0.0 0.0 + 0.0 0.0 1.0 0.0 + 0.0 1.0 0.0 0.0 + 0.0 0.0 0.0 1.0 + + -0.08837890625 0.1569824219 0.001299858093 0.2451171875 + 0.0380859375 0.7124023438 -0.003200531006 0.9111328125 + 0.07598876953 0.09777832031 -1.060546875 1.904296875 + -0.4968261719 1.595703125 0.01309967041 -2.6953125 + + 42 0.3000488281 -0.04800415039 -270 + 15 4.80078125 -4.8984375 -41 + -0.1800537109 -0.7001953125 -0.02299499512 0.3701171875 + -0.000500202179 -0.002799987793 -0.7998046875 -0.2900390625 + + 500 -3.599609375 -15 37 + 2.900390625 -0.4699707031 3.19921875 4.69921875 + 0.09997558594 0.04400634766 0.005001068115 -0.02799987793 + -48 19 -1.099609375 0.03799438477 + + -17 -1100 -100 -0.01800537109 + 6 43 -3.099609375 20 + -2.30078125 0.002700805664 -0.000500202179 -1.900390625 + 0.3601074219 0.3100585938 -0.00479888916 0.02699279785 + + -3.384765625 3.154296875 -9.8671875 1.489257812 + -1.336914062 1.853515625 13.1875 4.7734375 + -2.580078125 54.8125 -5.62890625 -1.877929688 + -0.7348632812 -1.95703125 1.390625 5.82421875 + + 0.033935546875 0.0477600097656 -0.0791015625 0.40380859375 + 0.0431823730469 0.0899047851563 0.033966064453 -0.00238609313965 + 0.10986328125 -0.4140625 0.184326171875 -0.00595855712891 + -7.19921875 0.0353088378906 -0.020690917969 -0.02047729492188 + + -11.9375 3.626953125 1.5517578125 -2.2109375 + 0.9501953125 3.873046875 2.546875 5.64453125 + 9.3515625 -1.462890625 -1.759765625 1.2939453125 + 5.953125 -8.5546875 -1.806640625 -2.95703125 + + -13.421875 -1.57421875 4.17578125 4.421875 + -1.33300781 2.875 -5.18359375 1.84960938 + -1.30273438 -5.03125 -0.909179688 1.53710938 + -17.03125 1.13378906 2.16601562 -1.44628906 +END + +BUFFER bufOut DATA_TYPE mat4x4 SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT bufOut IDX 0 TOLERANCE 0.00000762939453125 EQ -0.00782783236 -0.00782695226 -0.00785884447 -0.0078271348 -0.0078559285 -0.0078559285 -0.00782629196 -0.00785431452 -0.00782746542 -0.00782621838 -0.00785833132 -0.00782643817 -0.00785790943 -0.00785658881 -0.00782788731 -0.0078571029 +EXPECT bufOut IDX 64 TOLERANCE 0.00000762939453125 EQ -0.007826805115 -0.0078125 -0.0078125 -0.0078125 -0.0078125 -0.0078125 -0.007826805115 -0.0078125 -0.0078125 -0.007826805115 -0.0078125 -0.0078125 -0.0078125 -0.0078125 -0.0078125 -0.007826805115 +EXPECT bufOut IDX 128 TOLERANCE 0.00000762939453125 EQ -0.00786039233 -0.00782793667 -0.00785188843 -0.007854064 -0.0078573348 -0.00782684796 -0.00784798525 -0.00782493595 -0.00782715902 -0.00782603491 -0.00785722211 -0.00785577018 -0.00782700069 -0.00782439206 -0.0078483494 -0.00785503723 +EXPECT bufOut IDX 192 TOLERANCE 0.00000762939453125 EQ -0.00785167329 -0.0078239264 -0.00782650989 -0.00785690639 -0.00781713333 -0.00785195641 -0.00785787124 -0.00782433804 -0.00781839062 -0.00785044394 -0.00785288401 -0.0078575192 -0.00785028189 -0.00782130379 -0.00782398041 -0.00785440393 +EXPECT bufOut IDX 256 TOLERANCE 0.00000762939453125 EQ -0.007817515172 -0.007817740552 -0.007827628404 -0.007849726826 -0.007818487473 -0.007821098901 -0.007829193957 -0.007822289132 -0.007850944996 -0.007824616507 -0.007830985822 -0.007853064686 -0.007819803432 -0.007823077962 -0.007861092687 -0.007822276093 +EXPECT bufOut IDX 320 TOLERANCE 0.00000762939453125 EQ -0.007815311663 -0.007851086557 -0.007853861898 -0.00782796368 -0.007846281864 -0.007820436731 -0.007823815569 -0.007825960405 -0.007850256748 -0.007854256779 -0.007857577875 -0.007859832607 -0.007846044376 -0.007820869796 -0.007856068201 -0.007858723402 +EXPECT bufOut IDX 384 TOLERANCE 0.00000762939453125 EQ -0.007855568081 -0.007855271921 -0.007822129875 -0.00782499183 -0.007851642556 -0.007850030437 -0.00782134477 -0.007820996456 -0.007851278409 -0.007823110558 -0.007849549875 -0.007853295654 -0.007852789946 -0.007853059098 -0.007820624858 -0.007824704051 +EXPECT bufOut IDX 448 TOLERANCE 0.00000762939453125 EQ -0.007851495408 -0.007852491923 -0.007852577604 -0.007855524309 -0.007822327316 -0.007830150425 -0.007858371362 -0.007822272368 -0.007824943401 -0.007831288502 -0.007829180919 -0.007824919187 -0.007828950882 -0.007828669623 -0.007827216759 -0.007823087275 +EXPECT bufOut IDX 512 TOLERANCE 0.00000762939453125 EQ -0.007829133421 -0.007827866822 -0.007829137146 -0.007827980444 -0.007828807458 -0.007827293128 -0.007828824222 -0.007827327587 -0.007830743678 -0.007829512469 -0.007830690593 -0.007829671726 -0.007860678248 -0.007859318517 -0.007860636339 -0.0078594964 +EXPECT bufOut IDX 576 TOLERANCE 0.00000762939453125 EQ -0.00784824509 -0.00785185397 -0.0078520542 -0.00785325561 -0.00782216899 -0.00782270823 -0.00785490777 -0.00785175525 -0.00782322045 -0.0078544952 -0.00785419904 -0.00785290636 -0.00782421976 -0.00782327354 -0.00785262417 -0.00785450544 \ No newline at end of file diff --git a/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_mat_3x3.amber b/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_mat_3x3.amber new file mode 100644 index 0000000..d03d9ab --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_mat_3x3.amber @@ -0,0 +1,131 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Matrix 3x3 inverse precision test 16bit + +DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class +DEVICE_EXTENSION VK_KHR_16bit_storage +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + f16mat3 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + f16mat3 invOutM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + f16mat3 matIn = matIns[ndx]; + invOutM[ndx] = inverse(matIn); + } +} +END + +BUFFER bufIn DATA_TYPE mat3x3 DATA + 1.0 5.0 3.0 + 2.0 4.0 7.0 + 4.0 6.0 2.0 + + 1.0 0.0 1.0 + 0.0 0.0 1.0 + 1.0 1.0 1.0 + + -0.00400161743164062 -2.900390625 -41 + -0.419921875 0.00490188598632812 -0.016998291015625 + -0.7001953125 0.00500106811523438 -0.00259971618652344 + + -0.140000000596046 0.00109999999403954 -0.399999976158142 + -32 1.80000007152557 -0.046000003814697 + 5 0.00500000035390258 -27 + + -4.0234375 1.2275390625 21.125 + 5.73828125 90.5625 -60.4375 + -2.1484375 -1.27734375 -1.951171875 + + 1.71191406 -6.6796875 3.72460938 + 4.828125 0.152832031 0.327636719 + -0.126586914 1.70605469 0.860351562 + + 24.171875 2.798828125 0.82958984375 + -9.703125 1.1630859375 -17.46875 + -1.3828125 -4.83984375 3.56640625 + + -1.615234375 5.9296875 1.181640625 + 1.7802734375 19.1875 4.7578125 + 52.8125 -1.1171875 1.1513671875 + + 3.17578125 -2.3984375 4.12890625 + 1.3818359375 5.53125 1.8154296875 + -16.40625 -1.8486328125 0.95263671875 + + 1.615234375 0.62890625 2.73828125 + -0.9716796875 -18.828125 3.509765625 + -8.015625 3.5703125 5.98046875 +END + +BUFFER bufOut DATA_TYPE mat3x3 SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +# Decimals between 0.25 and 0.5: 0.000244140625 +EXPECT bufOut IDX 0 TOLERANCE 0.000244140625 EQ -0.45947265625 0.10809326171875 0.310791015625 0.32421875 -0.1351318359375 -0.0135116577148438 -0.054046630859375 0.189208984375 -0.0810546875 + +# Decimals between 0.5 and 1: 0.00048828125 +EXPECT bufOut IDX 24 TOLERANCE 0.00048828125 EQ 1.0 -1.0 0.0 -1.0 0.0 1.0 0.0 1.0 0.0 + +# Decimals between 256 and 512: 0.25 +EXPECT bufOut IDX 48 TOLERANCE 0.25 EQ -0.000839710235595703 2.47265625 -2.908203125 -0.125732421875 333.75 -200.125 -0.0154953002929688 -23.609375 14.15625 + +# Decimals between 64 and 128: 0.25 +EXPECT bufOut IDX 72 TOLERANCE 0.25 EQ -5.10546875 0.00291061401367188 0.07562255859375 -90.8125 0.607421875 1.3447265625 -0.96240234375 0.000651359558105469 -0.0227813720703125 + +# Decimals between 0.25 and 0.5: 0.000244140625 +EXPECT bufOut IDX 96 TOLERANCE 0.000244140625 EQ -0.04931640625 -0.0047760009765625 -0.385986328125 0.0273895263672 0.0103378295898438 -0.023681640625 0.036346435546875 -0.00150966644287109 -0.07208251953125 + +# Decimals between 0.5 and 1: 0.00048828125 +EXPECT bufOut IDX 120 TOLERANCE 0.00048828125 EQ -0.0073711 0.20852935 -0.04752852 -0.07230215 0.03351298 0.300247073 0.14224312 -0.03575948 0.560298204 + +# Decimals between 0.125 and 0.25: 0.000244140625 +EXPECT bufOut IDX 144 TOLERANCE 0.000244140625 EQ 0.0462192446 0.00804401748 0.028658431 -0.03377546 -0.05020383 -0.2381591796875 -0.0279215015 -0.0650251061 -0.0317565352 + +# Decimals between 4 and 8: 0.00390625 +EXPECT bufOut IDX 168 TOLERANCE 0.03125 EQ 0.117026463 -0.0347934514 0.0236943774 1.06405377 -0.274251282 0.0417966172 -4.3359375 1.32951331 -0.177455068 + +# Decimals between 0.125 and 0.25: 0.0001220703125 +EXPECT bufOut IDX 192 TOLERANCE 0.0001220703125 EQ 0.0185089111 -0.0114746094 -0.0583496094 -0.0667114258 0.151855469 -0.000134825706 0.189208984 0.0969848633 0.0447998047 + +# Decimals between 0.125 and 0.25: 0.0001220703125 +EXPECT bufOut IDX 216 TOLERANCE 0.0001220703125 EQ 0.19580078125 -0.00940704345703125 -0.08416748046875 0.034942626953125 -0.049468994140625 0.013031005859375 0.2415771484375 0.0169219970703125 0.046630859375 \ No newline at end of file diff --git a/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_mat_4x4.amber b/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_mat_4x4.amber new file mode 100644 index 0000000..79628a4 --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp16_mat_4x4.amber @@ -0,0 +1,141 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Matrix 4x4 inverse precision test 16bit + +DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class +DEVICE_EXTENSION VK_KHR_16bit_storage +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + f16mat4 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + f16mat4 invOutM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + f16mat4 matIn = matIns[ndx]; + invOutM[ndx] = inverse(matIn); + } +} +END + +BUFFER bufIn DATA_TYPE mat4x4 DATA + -1.0 1.0 4.0 2.0 + 2.0 -1.0 2.0 5.0 + 1.0 2.0 3.0 4.0 + 3.0 4.0 -1.0 2.0 + + 1.0 0.0 0.0 0.0 + 0.0 0.0 1.0 0.0 + 0.0 1.0 0.0 0.0 + 0.0 0.0 0.0 1.0 + + -0.08837890625 0.1569824219 0.001299858093 0.2451171875 + 0.0380859375 0.7124023438 -0.003200531006 0.9111328125 + 0.07598876953 0.09777832031 -1.060546875 1.904296875 + -0.4968261719 1.595703125 0.01309967041 -2.6953125 + + 0.55322265625 -2.6953125 -12.75 -0.381103515625 + -0.473876953125 -0.014030456543 -4.9140625 -9.59375 + -1.083984375 0.62841796875 0.067443847656 -4.7734375 + -0.062286376953 -0.58935546875 -0.143798828125 0.4453125 + + 1.4853515625 -2.931640625 1.3818359375 -0.9482421875 + 2.982421875 -1.16796875 7.4765625 20.65625 + -0.56103515625 -7.1171875 -0.58251953125 1.0693359375 + -1.5810546875 -1.5830078125 -1.8076171875 1.96484375 + + -1.4775390625 1.4267578125 1.8896484375 2.62890625 + -1.8427734375 0.7919921875 -1.4306640625 -12.484375 + 1.6396484375 0.90087890625 2.03515625 -3.99609375 + 2.546875 -1.283203125 2.072265625 4.1953125 + + 2.005859375 -2.0625 0.92626953125 3.67578125 + 2.537109375 1.9208984375 -2.193359375 -1.509765625 + -1.798828125 2.2578125 -1.5361328125 1.109375 + -3.798828125 0.85205078125 1.3095703125 -1.6298828125 + + 0.033935546875 0.0477600097656 -0.0791015625 0.40380859375 + 0.0431823730469 0.0899047851563 0.033966064453 -0.00238609313965 + 0.10986328125 -0.4140625 0.184326171875 -0.00595855712891 + -7.19921875 0.0353088378906 -0.020690917969 -0.02047729492188 + + -0.802734375 -0.587402344 -1.73046875 -2.11523438 + -3.34765625 -1.0625 0.406738281 -0.0211181641 + -4.3359375 -0.0816650391 -0.0436706543 -0.794921875 + -0.424560547 27.515625 2.55273438 -6.546875 + + 0.014717102051 1.111328125 -0.36279296875 0.826171875 + 0.47705078125 0.251220703125 -0.47119140625 2.8125 + -33.34375 -0.074096679688 0.215087890625 -3.392578125 + 0.32373046875 -0.166748046875 0.0095901489258 0.428955078125 +END + +BUFFER bufOut DATA_TYPE mat4x4 SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +# Decimals between 2 and 4: 0.001953125 +EXPECT bufOut IDX 0 TOLERANCE 0.001953125 EQ 2.15234375 1.153320312 -3.19140625 1.345703125 -0.3845214844 -0.3845214844 0.73046875 -0.1153564453 1.69140625 0.6923828125 -2.115234375 0.8076171875 -1.615234375 -0.615234375 2.26953125 -0.884277343 + +# Decimals between 0.5 and 1: 0.00048828125 +EXPECT bufOut IDX 32 TOLERANCE 0.00048828125 EQ 1.0 0.0 -0.0 0.0 -0.0 -0.0 1.0 -0.0 -0.0 1.0 -0.0 0.0 0.0 -0.0 0.0 1.0 + +# Decimals between 8 and 16: 0.015625 +EXPECT bufOut IDX 64 TOLERANCE 0.015625 EQ -9.75 2.373046875 -0.02033996582 -0.09899902344 -1.012695312 1.044921875 -0.001180648804 0.2600097656 1.372070312 0.5961914062 -0.947265625 -0.3430175781 1.205078125 0.1840820312 -0.001552581787 -0.2004394531 + +# Decimals between 1 and 2: 0.0009765625 +EXPECT bufOut IDX 96 TOLERANCE 0.00390625 EQ -0.25830078125 0.65869140625 -1.328125 -0.25 0.1091918945312 -0.223876953125 0.263427734375 -1.9091796875 -0.114807128906 0.081237792969 -0.117004394531 0.39819335938 0.071411132813 -0.17797851563 0.125 -0.188720703125 + +# Decimals between 2 and 4: 0.03125 +EXPECT bufOut IDX 128 TOLERANCE 0.03125 EQ 2.904296875 -0.028793334961 -1.787109375 2.67578125 0.0009551048279 0.002325057983 -0.154663085938 0.06018066406 -2.150390625 0.057708740234 1.4150390625 -2.4140625 0.359619140625 0.031829833984 -0.262451171875 0.490966796875 + +# Decimals between 0.5 and 1: 0.00048828125 +EXPECT bufOut IDX 160 TOLERANCE 0.001953125 EQ -0.3486328125 -0.2998046875 0.40576171875 -0.287841796875 -0.1229248046875 -0.4833984375 0.58935546875 -0.80029296875 0.343505859375 0.265380859375 -0.114685058594 0.46508789063 0.004291534424 -0.096862792969 -0.009376525879 -0.061584472656 + +# Decimals between 1 and 2: 0.00390625 +EXPECT bufOut IDX 192 TOLERANCE 0.00390625 EQ 0.363037109375 0.443603515625 -0.158935546875 0.2998046875 0.76513671875 0.86279296875 0.046173095703 0.9580078125 0.89794921875 0.78125 -0.26708984375 1.123046875 0.276611328125 0.045043945313 0.179931640625 0.09088134765625 + +# Decimals between 8 and 16: 0.0078125 +EXPECT bufOut IDX 224 TOLERANCE 0.0078125 EQ -0.007389068603516 -0.015106201172 -0.0160217285156 -0.1392822265625 0.0204010009766 6.03515625 -1.1005859375 0.01950073242 0.130981445313 13.6171875 2.984375 0.12780761719 2.5 1.955078125 0.7158203125 0.034423828125 + +# Decimals between 4 and 8: 0.00390625 +EXPECT bufOut IDX 256 TOLERANCE 0.015625 EQ 0.185058594 0.563476563 -0.702148438 0.023651123 -0.302001953 -1.12011719 0.921875 -0.0106582642 0.680664063 4.0078125 -3.23632813 0.159667969 -1.015625 -3.1796875 2.65625 -0.13659668 + +# Decimals between 16 and 32: 0.250 +EXPECT bufOut IDX 288 TOLERANCE 0.250 EQ -0.04522705078125 0.0146484375 -0.0323791503906 -0.264892578125 2.169921875 -1.52734375 0.0387878417969 6.15234375 5.609375 -5.765625 0.197387695313 28.546875 0.75244140625 -0.47607421875 0.035095214844 4.28125 \ No newline at end of file diff --git a/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp64_mat_3x3.amber b/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp64_mat_3x3.amber new file mode 100644 index 0000000..8e90a12 --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp64_mat_3x3.amber @@ -0,0 +1,127 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Matrix 3x3 inverse precision test 64bit + +DEVICE_FEATURE shaderFloat64 + +SHADER compute compute_shader GLSL +#version 450 + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + dmat3 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + dmat3 invOutM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES ; ndx++) + { + dmat3 matIn = matIns[ndx]; + invOutM[ndx] = inverse(matIn); + } +} +END + +BUFFER bufIn DATA_TYPE mat3x3 DATA + 1.0 5.0 3.0 + 2.0 4.0 7.0 + 4.0 6.0 2.0 + + 1.0 0.0 1.0 + 0.0 0.0 1.0 + 1.0 1.0 1.0 + + -0.00400000019 -2.9000001 -41.0 + -0.419999987 0.00490000006 -0.0170000009 + -0.699999988 0.00500000035 -0.00260000001 + + -0.140000000596046 0.00109999999403954 -0.399999976158142 + -32.0 1.80000007152557 -0.046000003814697 + 5.0 0.00500000035390258 -27.0 + + -1.39999997615814 -0.449999988079071 -0.0 + 260.0 0.399999976158142 90.0 + -3.40000009536743 -0.419999986886978 -40.0 + + 6.0 4.80000019073486 0.149999991059303 + -100.0 3.60000014305115 3.10000014305115 + -50.0 0.0399999991059303 80.0 + + -16132.9695 59037.9967 -24574.7252 + 35850.322 46793.3449 -328946.914 + -22869.431 26404.5123 21301.7202 + + -251.256059 -18.9422633 -28.2466605 + -27.4345721 77.0803571 27.8791292 + -41.9989703 31.9438685 -44.1174942 + + -1690.54461 -17438.4039 -1783.23503 + -2073.71794 23603.1964 -51459.9156 + -1908.4221 3618.75624 3788.92769 + + -16.8431843 84.5075181 -18.2598076 + -14.9214002 -84.4076786 -15.1675014 + 21.3443665 -146.383183 -48.9589896 +END + +BUFFER bufOut DATA_TYPE mat3x3 SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +# Decimals between 0.25 and 0.5: 1.110223025e-16 +EXPECT bufOut IDX 0 TOLERANCE 0.00000001490116119384765625 EQ -0.459459459459459 0.108108108108108 0.310810810810811 0.324324324324324 -0.135135135135135 -0.0135135135135135 -0.0540540540540541 0.189189189189189 -0.0810810810810811 + +# Decimals between 0.5 and 1.0: 2.220446049e-16 +EXPECT bufOut IDX 96 TOLERANCE 0.0000000000000002220446 EQ 1.000000000000000 -1.000000000000000 0.000000000000000 -1.000000000000000 0.000000000000000 1.000000000000000 0.000000000000000 1.000000000000000 0.000000000000000 + +# Decimals between 256 and 512: 5.684341886e-14 +EXPECT bufOut IDX 192 TOLERANCE 0.00000762939453125 EQ -0.000841470545102439 2.47503648792707 -2.9135885169066 -0.125859573005947 334.212455786544 -200.526751505131 -0.0154878990198647 -23.6396598865523 14.1838842383457 + +# Decimals between 64 and 128: 1.421085472e-14 +EXPECT bufOut IDX 288 TOLERANCE 0.000003814697265625 EQ -5.10645825627567 0.00291048470275283 0.0756462703131625 -90.806072612235 0.607314129714973 1.34424038620833 -0.962456358391705 0.000651444236195151 -0.0227795350380524 + +# Decimals between 2 and 4: 4.440892099e-16 +EXPECT bufOut IDX 384 TOLERANCE 0.00000095367431640625 EQ -0.0047673 0.0039363 0.00885668 -2.20739 -0.0122463 -0.0275541 0.0235828 -0.000206 -0.0254635 + +# Decimals between 0.125 and 0.25: 5.551115123e-17 +EXPECT bufOut IDX 480 TOLERANCE 0.0000000037252902984619140625 EQ 0.00730470678585512 -0.00974365269512521 0.0003638702045530 0.199062882238475 0.0123700643838874 -0.000852582899157852 0.00446591030226492 -0.00609596796650696 0.0127278451692857 + +# Decimals between 6.103515625e-05 and 0.0001220703125: 2.710505431e-20 +EXPECT bufOut IDX 576 TOLERANCE 0.0000000000582076609134674072265625 EQ 0.0000500957 -9.86394e-6 -0.0000945288 0.000034971 -4.68581e-6 -0.0000320154 0.0000104344 -4.78159e-6 -0.0000148565 + +# Decimals between 0.015625 and 0.03125: 2.328306437e-10 +EXPECT bufOut IDX 672 TOLERANCE 0.00000000186264514923095703125 EQ -0.0040613 -0.0016448958 0.0015608298 -0.00225368627 0.00936823816 0.00736300733 0.00223446417 0.0083491074 -0.0188213388 + +# Decimals between 0.000244140625 and 0.00048828125: 1.084202172e-19 +EXPECT bufOut IDX 768 TOLERANCE 0.0000000000072759576141834259033203125 EQ -0.000115696606951049 -2.50236218021531e-05 -0.000394314125406909 -4.45173829379519e-05 4.11683327090298e-06 3.49615898742737e-05 -1.57565435895695e-05 -1.65359315572978e-05 3.19258500321063e-05 + +# Decimals between 0.03125 and 0.0625: 1.387778781e-1 +EXPECT bufOut IDX 864 TOLERANCE 0.000000000931322574615478515625 EQ -0.00985268340612319 -0.0350896203754492 0.0145454384440486 0.00543206941934669 -0.00625692866381362 -8.75542619249871e-05 -0.0205368392142981 0.00340986236312195 -0.0138221880175656 \ No newline at end of file diff --git a/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp64_mat_4x4.amber b/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp64_mat_4x4.amber new file mode 100644 index 0000000..3732ac6 --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/inverse_compute_fp64_mat_4x4.amber @@ -0,0 +1,137 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Matrix 4x4 inverse precision test 64bit + +DEVICE_FEATURE shaderFloat64 + +SHADER compute compute_shader GLSL +#version 450 + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + dmat4 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + dmat4 invOutM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + dmat4 matIn = matIns[ndx]; + invOutM[ndx] = inverse(matIn); + } +} +END + +BUFFER bufIn DATA_TYPE mat4x4 DATA + -1.0 1.0 4.0 2.0 + 2.0 -1.0 2.0 5.0 + 1.0 2.0 3.0 4.0 + 3.0 4.0 -1.0 2.0 + + 1.0 0.0 0.0 0.0 + 0.0 0.0 1.0 0.0 + 0.0 1.0 0.0 0.0 + 0.0 0.0 0.0 1.0 + + -0.0883788988 0.156982005 0.00129985996 0.245116994 + 0.0380859002 0.712401986 -0.00320053007 0.911132991 + 0.0759887993 0.097778298 -1.06054997 1.90429997 + -0.496825993 1.59570003 0.0130997002 -2.69531012 + + 42.0 0.300049007 -0.0480041988 -270.0 + 15.0 4.80077982 -4.89843988 -41.0 + -0.180053994 -0.700195014 -0.0229950007 0.370117009 + -0.000500202004 -0.00279998989 -0.799804986 -0.290039003 + + 500.0 -3.5999999 -15.0 37.0 + 2.9000001 -0.469999999 3.20000005 4.69999981 + 0.100000001 0.0439999998 0.00499999989 -0.0280000009 + -48.0 19.0 -1.10000002 0.0379999988 + + -17.0 -1100.0 -100.0 -0.0180054009 + 6.0 43.0 -3.09961009 20.0 + -2.30078006 0.00270081009 -0.000500202004 -1.90039003 + 0.360107005 0.310059011 -0.00479889009 0.026992799 + + 19.623375 16.39533 23.824263 16.653233 + -28.074343 -23.819447 24.132942 52.970188 + -19.421518 -22.75626 -17.654331 -18.975327 + 16.584002 19.627544 18.86456 20.070559 + + -0.00622151 -0.006746047 -0.002207905 -0.02056567 + -0.030076593 -0.0267689 0.01095024 -0.09132 + -0.01297636 0.04533594 -0.01379582 -0.01475323 + -0.004602736 -0.01200175 0.01090538 0.02836178 + + -0.0119948 -0.03789127 -0.00611719 0.0448515 + 0.04644695 -0.02320256 -0.03514489 -1.3571429 + -0.03181969 0.008329804 0.13061533 0.287190083 + -0.0098646 -0.587016575 0.040482634 -0.66131907 + + -49.9153838 -21.0593973 -46.518005 59.6618775 + -32.0837048 -15.4093261 22.1520919 32.4487472 + -18.0335364 19.6343962 40.2818031 -16.6847517 + 30.3650256 430.773516 335.057641 84.5618449 +END + +BUFFER bufOut DATA_TYPE mat4x4 SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +# Decimals between 2 and 4: 4.440892099e-16 +EXPECT bufOut IDX 0 TOLERANCE 0.00000000000000710542735760100186 EQ 2.15384615384615 1.15384615384615 -3.19230769230769 1.34615384615385 -0.384615384615385 -0.384615384615385 0.730769230769231 -0.115384615384615 1.69230769230769 0.692307692307692 -2.11538461538462 0.807692307692308 -1.61538461538462 -0.615384615384615 2.26923076923077 -0.884615384615385 + +# Decimals between 0.5 and 1.0: 0.0000000000000002220446 +EXPECT bufOut IDX 128 TOLERANCE 0.0000000000000002220446 EQ 1.0 0.0 -0.0 0.0 -0.0 -0.0 1.0 -0.0 -0.0 1.0 -0.0 0.0 0.0 -0.0 0.0 1.0 + +# Decimals between 8 and 16: 1.776356839e-15 +EXPECT bufOut IDX 256 TOLERANCE 0.000000007450580596923828125 EQ -9.75322042297396 2.37362669506961 -0.0203394530868922 -0.0989581486481695 -1.0131389710321 1.04449191609472 -0.0011809602441171 0.260112762891842 1.37084022691543 0.596282636661557 -0.947263307771321 -0.34302712111187 1.20466476455649 0.183736729275728 -0.0015538674496792 -0.200446926096048 + +# Decimals between 1 and 2: 2.220446049e-16 +EXPECT bufOut IDX 384 TOLERANCE 0.00000000000181898940354585647583 EQ -0.0168082262776781 0.123847447583787 0.845064654490972 -0.781796418016029 0.000907236655202418 -0.0214464697685848 -1.57553538794179 0.176593208909395 0.00229837480280809 -0.0069804435848272 -0.0420508721648504 -1.20648171174332 -0.00631771711054083 0.0192425662857938 0.129711097327777 -0.121202025006464 + +# Decimals between 16 and 32: 3.5527136788005e-15 +EXPECT bufOut IDX 512 TOLERANCE 0.0000000004656612873077392578125 EQ 0.00122987857225808 0.00145957456303611 1.86470139545162 -0.00404912096004867 0.00249933594563608 0.0158962240900459 6.02465865825882 0.0395465186691528 -0.0102730364056489 0.213239063972644 22.1535058435922 -0.0479744643638987 0.00648548045816656 0.068270948196751 -15.6313334993716 0.0391165129190096 + +# Decimals between 4 and 8: 8.88178419700125e-16 +EXPECT bufOut IDX 640 TOLERANCE 0.00000000000011368683772161602974 EQ 0.000238085731463758 -0.0114304516192027 -0.0857740260025005 2.4306191945853 -0.000347720953516649 0.0103370417145577 0.11670327707534 0.55698740526991 -0.00621549239111256 -0.111766781742911 -1.26907850541629 -6.53953732454563 -0.000287105815868867 0.013882823578604 -0.421862264930753 -2.94020947346056 + +# Decimals between 1 and 2: 2.22044604925031e-16 +EXPECT bufOut IDX 768 TOLERANCE 0.00000011920928955078125 EQ 0.22197487066158 0.0627796669270416 -1.12460329782432 -1.41310290500685 -0.199278624919562 -0.0578498036488017 0.7983216215877 1.07278337806842 -0.0342149904508372 -0.0442669501414111 0.796169929879291 0.897942286097494 0.0436245457899835 0.0463060337079045 -0.599787221967382 -0.67564075745427 + +# Decimals between 128 and 256: 2.8421709430404e-14 +EXPECT bufOut IDX 896 TOLERANCE 0.0000152587890625 EQ -97.8582306683738 7.50313409032798 -26.117002447926 -60.3856322136104 -82.695723129405 12.7396454583607 14.2170727020725 -11.5493732825903 -212.810493696114 47.1129797451719 -5.26643151068638 -5.35685515626948 30.9525814487582 -11.5067517547609 3.8027416400152 22.6313978536399 + +# Decimals between 64 and 128: 1.4210854715202e-14 +EXPECT bufOut IDX 1024 TOLERANCE 0.000030517578125 EQ -97.2800533563974 -8.23035776027672 -8.77895032397699 6.48006076837222 3.74299952199471 1.33217195402097 1.1478907969006 -1.98150298411366 -17.4712271583937 0.21160530699481 6.51915413939454 1.21189159726794 -2.9408727618766 -1.04677382190551 -0.488897983374369 0.224267616554392 + +# Decimals between 0.015625 and 0.03125: 6.93889390390723e-18 +EXPECT bufOut IDX 1152 TOLERANCE 0.0000000004656612873077392578125 EQ -0.0144786923213069 0.00890167299753732 -0.0295976160434387 0.000959640183872229 0.0106194358175128 -0.0196777493008321 0.00855626441807592 0.00174667416324874 -0.0120823932867626 0.0203594452563112 -0.00236542194194121 0.000245421422141454 -0.00102442951500001 0.0163757783054787 -0.0235866074689415 0.00161076438254641 \ No newline at end of file diff --git a/vulkan/amber/builtin/precision/square_matrix/inverse_highp_mat_3x3.amber b/vulkan/amber/builtin/precision/square_matrix/inverse_highp_mat_3x3.amber new file mode 100644 index 0000000..f9ad16d --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/inverse_highp_mat_3x3.amber @@ -0,0 +1,126 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Matrix 3x3 inverse precision test float32_t + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_float32 : enable + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + f32mat3 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + f32mat3 invOutM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + f32mat3 matIn = matIns[ndx]; + invOutM[ndx] = inverse(matIn); + } +} +END + +BUFFER bufIn DATA_TYPE mat3x3 DATA + 1.0 5.0 3.0 + 2.0 4.0 7.0 + 4.0 6.0 2.0 + + 1.0 0.0 1.0 + 0.0 0.0 1.0 + 1.0 1.0 1.0 + + -0.00400000019 -2.9000001 -41.0 + -0.419999987 0.00490000006 -0.0170000009 + -0.699999988 0.00500000035 -0.00260000001 + + -0.140000000596046 0.00109999999403954 -0.399999976158142 + -32.0 1.80000007152557 -0.046000003814697 + 5.0 0.00500000035390258 -27.0 + + -1.39999997615814 -0.449999988079071 -0.0 + 260.0 0.399999976158142 90.0 + -3.40000009536743 -0.419999986886978 -40.0 + + 6.0 4.80000019073486 0.149999991059303 + -100.0 3.60000014305115 3.10000014305115 + -50.0 0.0399999991059303 80.0 + + -16132.9695 59037.9967 -24574.7252 + 35850.322 46793.3449 -328946.914 + -22869.431 26404.5123 21301.7202 + + -251.256059 -18.9422633 -28.2466605 + -27.4345721 77.0803571 27.8791292 + -41.9989703 31.9438685 -44.1174942 + + -1690.54461 -17438.4039 -1783.23503 + -2073.71794 23603.1964 -51459.9156 + -1908.4221 3618.75624 3788.92769 + + -16.8431843 84.5075181 -18.2598076 + -14.9214002 -84.4076786 -15.1675014 + 21.3443665 -146.383183 -48.9589896 +END + +BUFFER bufOut DATA_TYPE mat3x3 SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +# Decimals between 0.25 and 0.5: 5.960464478e-08 +EXPECT bufOut IDX 0 TOLERANCE 0.000000059604644775390625 EQ -0.459459483623505 0.10810811072588 0.310810804367065 0.32432433962822 -0.135135143995285 -0.013513513840735 -0.0540540553629398 0.189189195632935 -0.0810810849070549 + +# Decimals between 0.5 and 1: 1.192092896e-07 +EXPECT bufOut IDX 48 TOLERANCE 0.00000011920929 EQ 1.0000000 -1.0000000 0.0000000 -1.0000000 0.0000000 1.000000 0.0000000 1.0000000 0.0000000 + +# Decimals between 256 and 512: 0.000030517578 +EXPECT bufOut IDX 96 TOLERANCE 0.0001220703125 EQ -0.000841470318846405 2.47503590583801 -2.91358804702759 -0.125859543681145 334.21240234375 -200.526702880859 -0.0154878990724683 -23.6396560668945 14.1838817596436 + +# Decimals between 64 and 128: 0.0000152587890625 +EXPECT bufOut IDX 144 TOLERANCE 0.0000152587890625 EQ -5.10645771026611 0.002910484559834 0.0756462663412094 -90.8060684204102 0.607314109802246 1.34424042701721 -0.962456285953522 0.000651444192044437 -0.0227795336395502 + +# Decimals between 2 and 4: 2.384185791e-07 +EXPECT bufOut IDX 192 TOLERANCE 0.00000095367431640625 EQ -0.0047673 0.0039363 0.00885668 -2.20739 -0.0122463 -0.0275541 0.0235828 -0.000206 -0.0254635 + +# Decimals between 0.125 and 0.25: 2.980232239e-08 +EXPECT bufOut IDX 240 TOLERANCE 0.000000029802322 EQ 0.00730470707640052 -0.0097436523064971 0.000363870232831687 0.199062883853912 0.0123700648546219 -0.000852582859806716 0.00446591060608625 -0.00609596818685532 0.0127278454601765 + +# Decimals between 6.103515625e-05 and 0.0001220703125: 0.000000000116415322 +EXPECT bufOut IDX 288 TOLERANCE 0.000000000116415322 EQ 0.0000500957 -9.86394e-6 -0.0000945288 0.000034971 -4.68581e-6 -0.0000320154 0.0000104344 -4.78159e-6 -0.0000148565 + +# Decimals between 0.015625 and 0.03125: 3.725290298e-09 +EXPECT bufOut IDX 336 TOLERANCE 0.0000000037252903 EQ -0.0040613 -0.0016448958 0.0015608298 -0.00225368627 0.00936823816 0.00736300733 0.00223446417 0.0083491074 -0.0188213388 + +# Decimals between 0.000244140625 and 0.00048828125: 5.820766091e-11 +EXPECT bufOut IDX 384 TOLERANCE 0.000000000058207661 EQ -0.000115696606951049 -2.50236218021531e-05 -0.000394314125406909 -4.45173829379519e-05 4.11683327090298e-06 3.49615898742737e-05 -1.57565435895695e-05 -1.65359315572978e-05 3.19258500321063e-05 + +# Decimals between 0.03125 and 0.0625: 7.450580597e-09 +EXPECT bufOut IDX 432 TOLERANCE 0.0000000074505806 EQ -0.00985268340612319 -0.0350896203754492 0.0145454384440486 0.00543206941934669 -0.00625692866381362 -8.75542619249871e-05 -0.0205368392142981 0.00340986236312195 -0.0138221880175656 \ No newline at end of file diff --git a/vulkan/amber/builtin/precision/square_matrix/inverse_highp_mat_4x4.amber b/vulkan/amber/builtin/precision/square_matrix/inverse_highp_mat_4x4.amber new file mode 100644 index 0000000..517d712 --- /dev/null +++ b/vulkan/amber/builtin/precision/square_matrix/inverse_highp_mat_4x4.amber @@ -0,0 +1,136 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Matrix 4x4 inverse precision test float32_t + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_float32 : enable + +const int NUMMATRICES = 10; + +layout(set = 0, binding = 0) buffer block0 +{ + f32mat4 matIns[NUMMATRICES]; +}; + +layout(set = 0, binding = 1) buffer block1 +{ + f32mat4 invOutM[NUMMATRICES]; +}; + +void main() +{ + for (int ndx = 0; ndx < NUMMATRICES; ndx++) + { + f32mat4 matIn = matIns[ndx]; + invOutM[ndx] = inverse(matIn); + } +} +END + +BUFFER bufIn DATA_TYPE mat4x4 DATA + -1.0 1.0 4.0 2.0 + 2.0 -1.0 2.0 5.0 + 1.0 2.0 3.0 4.0 + 3.0 4.0 -1.0 2.0 + + 1.0 0.0 0.0 0.0 + 0.0 0.0 1.0 0.0 + 0.0 1.0 0.0 0.0 + 0.0 0.0 0.0 1.0 + + -0.0883788988 0.156982005 0.00129985996 0.245116994 + 0.0380859002 0.712401986 -0.00320053007 0.911132991 + 0.0759887993 0.097778298 -1.06054997 1.90429997 + -0.496825993 1.59570003 0.0130997002 -2.69531012 + + 42.0 0.300049007 -0.0480041988 -270.0 + 15.0 4.80077982 -4.89843988 -41.0 + -0.180053994 -0.700195014 -0.0229950007 0.370117009 + -0.000500202004 -0.00279998989 -0.799804986 -0.290039003 + + 500.0 -3.5999999 -15.0 37.0 + 2.9000001 -0.469999999 3.20000005 4.69999981 + 0.100000001 0.0439999998 0.00499999989 -0.0280000009 + -48.0 19.0 -1.10000002 0.0379999988 + + -17.0 -1100.0 -100.0 -0.0180054009 + 6.0 43.0 -3.09961009 20.0 + -2.30078006 0.00270081009 -0.000500202004 -1.90039003 + 0.360107005 0.310059011 -0.00479889009 0.026992799 + + 19.62337494 16.39533043 23.82426262 16.65323257 + -28.07434273 -23.81944656 24.1329422 52.97018814 + -19.42151833 -22.75625992 -17.65433121 -18.97532654 + 16.58400154 19.6275444 18.86455917 20.07055855 + + -0.00622151 -0.006746047 -0.002207905 -0.02056567 + -0.030076593 -0.0267689 0.01095024 -0.09132 + -0.01297636 0.04533594 -0.01379582 -0.01475323 + -0.004602736 -0.01200175 0.01090538 0.02836178 + + -0.0119948 -0.03789127 -0.00611719 0.0448515 + 0.04644695 -0.02320256 -0.03514489 -1.3571429 + -0.03181969 0.008329804 0.13061533 0.287190083 + -0.0098646 -0.587016575 0.040482634 -0.66131907 + + -49.9153838 -21.0593973 -46.518005 59.6618775 + -32.0837048 -15.4093261 22.1520919 32.4487472 + -18.0335364 19.6343962 40.2818031 -16.6847517 + 30.3650256 430.773516 335.057641 84.5618449 +END + +BUFFER bufOut DATA_TYPE mat4x4 SIZE 10 FILL 0.0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +# Decimals between 2.0 and 4.0: 2.384185791e-07 +EXPECT bufOut IDX 0 TOLERANCE 0.0000002384185791015625 EQ 2.15384626 1.15384614 -3.19230771 1.34615386 -0.384615391 -0.384615391 0.730769277 -0.115384623 1.69230771 0.692307711 -2.11538458 0.807692349 -1.6153847 -0.615384638 2.26923084 -0.884615421 + +# Decimal between 0.5 and 1.0: 1.192092896e-07 +EXPECT bufOut IDX 64 TOLERANCE 0.00000011920928955078125 EQ 1.0 0.0 -0.0 0.0 -0.0 -0.0 1.0 -0.0 -0.0 1.0 -0.0 0.0 0.0 -0.0 0.0 1.0 + +# Decimals between 8.0 and 16.0: 9.536743164e-07 +EXPECT bufOut IDX 128 TOLERANCE 0.00000095367432 EQ -9.75322056 2.37362671 -0.0203394517 -0.0989581347 -1.01313901 1.04449189 -0.00118096021 0.260112733 1.37084019 0.596282601 -0.947263181 -0.343027145 1.20466483 0.183736786 -0.00155386783 -0.200446919 + +# Decimals between 1.0 and 2.0: 1.192092896e-07 +EXPECT bufOut IDX 192 TOLERANCE 0.0000019073486328125 EQ -0.0168082286 0.12384747 0.845064819 -0.781796575 0.000907236419 -0.0214464739 -1.57553554 0.176593229 0.00229837489 -0.00698044337 -0.0420508794 -1.2064817 -0.00631771749 0.0192425679 0.129711106 -0.121202044 + +# Decimals between 16.0 and 32.0: 0.00000762939453125 +EXPECT bufOut IDX 256 TOLERANCE 0.00000762939453125 EQ 0.00122987852 0.00145957421 1.86470127 -0.00404912047 0.00249933568 0.0158962216 6.0246582 0.0395465195 -0.0102730356 0.213239029 22.1535034 -0.0479744636 0.00648548035 0.0682709441 -15.6313314 0.039116513 + +# Decimals between 8.0 and 16.0: 4.768371582e-07 +EXPECT bufOut IDX 320 TOLERANCE 0.0000019073486328125 EQ 0.000238085719 -0.0114304526 -0.0857740417 2.43061924 -0.000347720925 0.0103370408 0.116703264 0.556987405 -0.00621549273 -0.111766778 -1.26907849 -6.53953838 -0.000287105795 0.0138828233 -0.421862274 -2.94020963 + +# Decimals between 1.0 and 2.0: 1.192092896e-07 +EXPECT bufOut IDX 384 TOLERANCE 0.0000152587890625 EQ 0.221975565 0.06277982891 -1.124607801 -1.41310823 -0.1992791891 -0.05785009637 0.7983245254 1.072786927 -0.03421511874 -0.04426704347 0.7961731553 0.8979454637 0.04362447187 0.04630630091 -0.5997895598 -0.6756432652 + +# Decimal between 128.0 and 256.0: 1.525878906e-05 +EXPECT bufOut IDX 448 TOLERANCE 0.000030517578125 EQ -97.8582306683738 7.50313409032798 -26.11700244793 -60.3856322136104 -82.695723129405 12.73964545836 14.21707270207 -11.54937328259 -212.810493696114 47.112979745172 -5.26643151068 -5.356855156269 30.9525814487582 -11.506751754761 3.802741640015 22.63139785364 + +# Decimal between 64.0 and 128.0: 0.000030517578125 +EXPECT bufOut IDX 512 TOLERANCE 0.000030517578125 EQ -97.2800533563974 -8.23035776027672 -8.778950323977 6.4800607683722 3.742999521995 1.33217195402 1.1478907969 -1.981502984114 -17.471227158394 0.211605306995 6.51915413939 1.211891597268 -2.9408727618766 -1.046773821906 -0.488897983374 0.22426761655 + +# Decimal between 0.015625 and 0.03125: 3.814697266e-06 +EXPECT bufOut IDX 576 TOLERANCE 0.00000762939453125 EQ -0.0144786923213 0.00890167299754 -0.029597616043 0.0009596401839 0.010619435818 -0.0196777493 0.00855626442 0.001746674163 -0.012082393287 0.020359445256 -0.00236542194 0.000245421422 -0.001024429515 0.016375778305 -0.023586607469 0.00161076438 \ No newline at end of file diff --git a/vulkan/amber/combined_operations/negintdivand.amber b/vulkan/amber/combined_operations/negintdivand.amber new file mode 100644 index 0000000..187a8e2 --- /dev/null +++ b/vulkan/amber/combined_operations/negintdivand.amber @@ -0,0 +1,53 @@ +#!amber +# Copyright 2020 The Amber Authors. +# Copyright 2020 The Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; +layout(location = 1) out vec4 frag_color; + +void main() { + gl_Position = position; + frag_color = position * 0.5; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +layout(location = 1) in vec4 frag_color; +void main() { + ivec2 iv = ivec2(frag_color.xy * 256); + if (((iv.y / 2) & 64) == 64) + color_out = vec4(1, 0, 0, 1); + else + color_out = vec4(0, 1, 1, 1); +} +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 +EXPECT framebuffer IDX 0 220 SIZE 30 30 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 0 0 SIZE 30 30 EQ_RGBA 255 0 0 255 + diff --git a/vulkan/amber/combined_operations/notxor.amber b/vulkan/amber/combined_operations/notxor.amber new file mode 100644 index 0000000..9face26 --- /dev/null +++ b/vulkan/amber/combined_operations/notxor.amber @@ -0,0 +1,50 @@ +#!amber + +# Copyright 2020 Valve Corporation. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 450 +layout(push_constant, std430) uniform PushConstants { + uint op1; + uint op2; +} pushConstants; +layout(location=0) out vec4 out_color; +void main() +{ + out_color = vec4(~(pushConstants.op1^pushConstants.op2)); +} +END + +BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM +BUFFER push_constants DATA_TYPE uint32 STD430 DATA +0xaaaaaaab +0x55555555 +END + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER push_constants AS push_constant +END + +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_RECT POS 0 0 SIZE 16 16 +EXPECT framebuffer0 IDX 0 0 SIZE 16 16 EQ_RGBA 255 255 255 255 diff --git a/vulkan/amber/compute/atomic_barrier_sum_small.amber b/vulkan/amber/compute/atomic_barrier_sum_small.amber new file mode 100644 index 0000000..063141e --- /dev/null +++ b/vulkan/amber/compute/atomic_barrier_sum_small.amber @@ -0,0 +1,58 @@ +#!amber +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# The purpose of this test is to check the behavior of workgroup atomics in +# combination with barriers. +# This is known to cause issues on the mobile devices given the CTS failures +# for webgpu +# See: crbug.com/42241359 + +SHADER compute workgroup_shared_atomic_shader GLSL +#version 430 + +layout(local_size_x = 3, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block1 { + uint ssbo_write[]; +}; + +shared uint wg_shared; + +void main() { + if( gl_LocalInvocationID.x == 0){ + atomicExchange(wg_shared, 7); + } + + barrier(); + atomicAdd(wg_shared,1); + barrier(); + + if(gl_LocalInvocationID.x == 0) { + ssbo_write[0] = atomicExchange(wg_shared,0); + } +} +END + +BUFFER buf_uint DATA_TYPE uint32 SIZE 16 FILL 123 + +PIPELINE compute pipeline + ATTACH workgroup_shared_atomic_shader + BIND BUFFER buf_uint AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 1 1 1 + +EXPECT buf_uint IDX 0 EQ 10 diff --git a/vulkan/amber/compute/branch_past_barrier.amber b/vulkan/amber/compute/branch_past_barrier.amber new file mode 100644 index 0000000..2ecfead --- /dev/null +++ b/vulkan/amber/compute/branch_past_barrier.amber @@ -0,0 +1,98 @@ +#!amber + +# Test barriers insude control-flow which is sometimes uniform and sometimes non-uniform. This is +# valid provided the barrier is never executed when the control-flow is non-uniform. To do this we +# have 2 conditions, which generate 3 possible paths. The first workgroup chooses non-uniformly +# between the two paths which don't reach the barrier, while the second workgroup uniformly chooses +# the path with the barrier. The barrier path does some simple operations through shared memory in +# order to prevent compilers removing the barrier altogether. +# +# TODO: On implementations that use a subgroup size of 128 the barrier is still equivalent to a subgroup +# barrier, so the difference between uniform and non-uniform control won't make a difference. We should +# force the minimum subgroup size or something. + +SHADER compute compute_shader GLSL +#version 310 es + +layout(local_size_x = 128) in; + +layout(set=0, binding = 0) buffer B { + uint a1[64]; + uint a2[64]; + + uint x; +} b; + +layout(set=0, binding=1) buffer C { + uint y[256]; +} c; + +shared uint s[128]; + +void main() { + uint l = b.x; + + /* To save us having enormous buffers, force each workgroup to consume only 32 slots */ + uint a_idx = (gl_LocalInvocationIndex & 31u) + 32u * gl_WorkGroupID.x; + + if (b.a1[a_idx] == 0u) { + l = 2u; + } else { + if (b.a2[a_idx] == 0u) { + l = 3u; + } else { + /* In order for the barrier to be required, reverse the values of a2 through shared memory. + If the subgroup is as large as the workgroup here then the barrier can still be removed, + so the test should make sure that doesn't happen. */ + s[gl_LocalInvocationIndex] = l + b.a2[a_idx]; + + barrier(); + + l = s[127u - gl_LocalInvocationIndex]; + } + } + + c.y[gl_GlobalInvocationID.x] = l; +} +END + +BUFFER input_buf DATA_TYPE uint32 DATA +# First 32 values are used by WG 0 to select the non-uniform path. Second 32 are uniform for WG 1. +0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +0 0 0 0 2 0 0 0 7 0 3 0 9 0 1 0 0 0 5 0 0 0 0 0 8 0 2 0 7 0 0 0 1 1 1 1 2 1 1 1 7 1 3 1 9 1 1 1 1 1 5 1 1 1 1 1 8 1 2 1 7 1 1 1 +# b.x at the end. A random number. +42 +END + +BUFFER res_buf DATA_TYPE uint32 DATA +# Initialise result to a value not stored in the test so that every lane must write the correct value to pass. +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +END + +BUFFER reference_buffer DATA_TYPE uint32 DATA +# First workgroup hits either the l = 2 or l = 3 paths non-uniformly. +2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 +2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 +2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 +2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 +# Second workgroup has uniform control flow past the barrier. Result is 42 + b.a2, reversed through shared memory. +43 43 43 49 43 44 43 50 43 43 43 43 43 47 43 43 43 43 43 51 43 45 43 49 43 43 43 44 43 43 43 43 +43 43 43 49 43 44 43 50 43 43 43 43 43 47 43 43 43 43 43 51 43 45 43 49 43 43 43 44 43 43 43 43 +43 43 43 49 43 44 43 50 43 43 43 43 43 47 43 43 43 43 43 51 43 45 43 49 43 43 43 44 43 43 43 43 +43 43 43 49 43 44 43 50 43 43 43 43 43 47 43 43 43 43 43 51 43 45 43 49 43 43 43 44 43 43 43 43 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER input_buf AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER res_buf AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +# Spawn 2 workgroups, one with non-uniform control flow, the other with a barrier. +RUN pipeline 2 1 1 + +EXPECT res_buf EQ_BUFFER reference_buffer diff --git a/vulkan/amber/compute/pk-immediate.amber b/vulkan/amber/compute/pk-immediate.amber new file mode 100644 index 0000000..a8a2212 --- /dev/null +++ b/vulkan/amber/compute/pk-immediate.amber @@ -0,0 +1,1269 @@ +#!amber +# Copyright (c) 2024 The Khronos Group Inc. +# Copyright (c) 2024 AMD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Immediate/inline arguments to packed 16-bit operations might handled +# incorrectly in the compiler backend. + +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE shaderInt16 +DEVICE_PROPERTY FloatControlsProperties.shaderDenormPreserveFloat16 + +# SPIR-V code below generated from following GLSL source and extended with +# OpCapability DenormPreserve +# OpExtension "SPV_KHR_float_controls" +# OpExecutionMode %4 DenormPreserve 16 +# +# #version 460 +# #extension GL_EXT_shader_16bit_storage : require +# #extension GL_EXT_shader_explicit_arithmetic_types : require +# +# layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; +# +# layout(set = 0, binding = 0) buffer Result1 { +# f16vec2 fp16[]; +# }; +# +# layout(set = 0, binding = 1) buffer Result2 { +# i16vec2 i16[]; +# }; +# +# layout(set = 0, binding = 2) uniform Constants { +# uvec3 bound; +# } consts; +# +# void main() { +# if (any(greaterThanEqual(gl_GlobalInvocationID, consts.bound))) +# return; +# +# ivec2 id32 = ivec2(gl_GlobalInvocationID.xy); +# int idx = id32.y * 8 + id32.x; +# +# fp16[idx + 0] += f16vec2(1.0, 1.0); +# fp16[idx + 1] += f16vec2(-1.0, -1.0); +# fp16[idx + 2] += f16vec2(0.5, 0.5); +# fp16[idx + 3] += f16vec2(-0.5, -0.5); +# fp16[idx + 4] += f16vec2(2.0, 2.0); +# fp16[idx + 5] += f16vec2(-2.0, -2.0); +# fp16[idx + 6] += f16vec2(4.0, 4.0); +# fp16[idx + 7] += f16vec2(-4.0, -4.0); +# fp16[idx + 8] += int16BitsToHalf(i16vec2(0x3118, 0x3118)); // 1/2pi +# +# fp16[idx + 9] += f16vec2(1.0, 0.0); +# fp16[idx + 10] += f16vec2(0.0, 1.0); +# fp16[idx + 11] += f16vec2(1.0, -1.0); +# fp16[idx + 12] += f16vec2(-1.0, 1.0); +# +# float16_t int1 = int16BitsToHalf(1s); +# float16_t int17 = int16BitsToHalf(17s); +# float16_t int64 = int16BitsToHalf(64s); +# fp16[idx + 13] += f16vec2(int1, 0); +# fp16[idx + 14] += f16vec2(int1, int1); +# fp16[idx + 15] += f16vec2(0, int1); +# fp16[idx + 16] += f16vec2(int17, 0); +# fp16[idx + 17] += f16vec2(int17, int17); +# fp16[idx + 18] += f16vec2(0, int17); +# fp16[idx + 19] += f16vec2(int64, 0); +# fp16[idx + 20] += f16vec2(int64, int64); +# fp16[idx + 21] += f16vec2(0, int64); +# +# fp16[idx + 22] -= f16vec2(1.0, 1.0); +# fp16[idx + 23] -= f16vec2(0.0, 1.0); +# fp16[idx + 24] -= f16vec2(1.0, 0.0); +# +# f16vec2 a = fp16[idx + 29]; +# fp16[idx + 25] = fma(f16vec2(2.0, 2.0), a, fp16[idx + 25]); +# fp16[idx + 26] = fma(f16vec2(0.0, 2.0), a, fp16[idx + 26]); +# fp16[idx + 27] = fma(f16vec2(2.0, 0.0), a, fp16[idx + 27]); +# fp16[idx + 28] = fma(f16vec2(2.0, 1.0), a, fp16[idx + 28]); +# +# fp16[idx + 29] *= f16vec2(2.0, 2.0); +# fp16[idx + 30] *= f16vec2(0.0, 2.0); +# fp16[idx + 31] *= f16vec2(2.0, 0.0); +# fp16[idx + 32] *= f16vec2(2.0, 1.0); +# +# i16[idx + 33] += i16vec2(1, 1); +# i16[idx + 34] += i16vec2(1, 0); +# i16[idx + 35] += i16vec2(0, 1); +# i16[idx + 36] += i16vec2(64, 64); +# i16[idx + 37] += i16vec2(-16, -16); +# +# i16[idx + 38] += i16vec2(0x3800, 0); // fp16 0.5 +# i16[idx + 39] += i16vec2(0, 0x3800); // fp16 0.5 +# i16[idx + 40] += i16vec2(0x3800, 0x3800); // fp16 0.5 +# i16[idx + 41] += i16vec2(0, 0x3f00); // fp32 0.5 +# i16[idx + 42] += i16vec2(0x3f00, 0); // fp32 0.5 +# i16[idx + 43] += i16vec2(0x3f00, 0x3f00); // fp32 0.5 +# i16[idx + 44] += i16vec2(0xb800, 0); // fp16 -0.5 +# i16[idx + 45] += i16vec2(0, 0xbf00); // fp32 -0.5 +# i16[idx + 46] += i16vec2(0x3c00, 0); // fp16 1.0 +# i16[idx + 47] += i16vec2(0, 0x3f80); // fp32 1.0 +# i16[idx + 48] += i16vec2(0xbc00, 0); // fp16 -1.0 +# i16[idx + 49] += i16vec2(0, 0xbf80); // fp32 -1.0 +# i16[idx + 50] += i16vec2(0x4000, 0); // fp16 2.0 +# i16[idx + 51] += i16vec2(0, 0x4000); // fp32 2.0 +# i16[idx + 52] += i16vec2(0xc000, 0); // fp16 -2.0 +# i16[idx + 53] += i16vec2(0, 0xc000); // fp32 -2.0 +# i16[idx + 54] += i16vec2(0x4400, 0); // fp16 4.0 +# i16[idx + 55] += i16vec2(0, 0x4080); // fp32 4.0 +# i16[idx + 56] += i16vec2(0xc400, 0); // fp16 -4.0 +# i16[idx + 57] += i16vec2(0, 0xc080); // fp32 -4.0 +# i16[idx + 58] += i16vec2(0x3118, 0); // fp16 1/2pi +# i16[idx + 59] += i16vec2(0, 0x3118); // fp16 1/2pi +# i16[idx + 60] += i16vec2(0x3118, 0x3118); // fp16 1/2pi +# i16[idx + 61] += i16vec2(0xf983, 0x3e22); // fp32 1/2pi +# i16[idx + 62] += i16vec2(0x3e22, 0xf983); +# i16[idx + 63] += i16vec2(0x3e22, 0x3e22); +# i16[idx + 64] += i16vec2(0xf983, 0xf983); +# i16[idx + 65] += i16vec2(0x3e22, 0); +# i16[idx + 66] += i16vec2(0xf983, 0); +# i16[idx + 67] += i16vec2(-2, -1); +# i16[idx + 68] += i16vec2(-1, -2); +# i16[idx + 69] += i16vec2(12, 20); +# +# i16[idx + 70] -= i16vec2(0x3800, 0); // fp16 0.5 +# i16[idx + 71] -= i16vec2(0, 0x3800); // fp16 0.5 +# i16[idx + 72] -= i16vec2(0x3800, 0x3800); // fp16 0.5 +# i16[idx + 73] -= i16vec2(0, 0x3f00); // fp32 0.5 +# i16[idx + 74] -= i16vec2(0x3f00, 0); // fp32 0.5 +# i16[idx + 75] -= i16vec2(0x3f00, 0x3f00); // fp32 0.5 +# i16[idx + 76] -= i16vec2(0xb800, 0); // fp16 -0.5 +# i16[idx + 77] -= i16vec2(0, 0xbf00); // fp32 -0.5 +# i16[idx + 78] -= i16vec2(0x3c00, 0); // fp16 1.0 +# i16[idx + 79] -= i16vec2(0, 0x3f80); // fp32 1.0 +# i16[idx + 80] -= i16vec2(0xbc00, 0); // fp16 -1.0 +# i16[idx + 81] -= i16vec2(0, 0xbf80); // fp32 -1.0 +# i16[idx + 82] -= i16vec2(0x4000, 0); // fp16 2.0 +# i16[idx + 83] -= i16vec2(0, 0x4000); // fp32 2.0 +# i16[idx + 84] -= i16vec2(0xc000, 0); // fp16 -2.0 +# i16[idx + 85] -= i16vec2(0, 0xc000); // fp32 -2.0 +# i16[idx + 86] -= i16vec2(0x4400, 0); // fp16 4.0 +# i16[idx + 87] -= i16vec2(0, 0x4080); // fp32 4.0 +# i16[idx + 88] -= i16vec2(0xc400, 0); // fp16 -4.0 +# i16[idx + 89] -= i16vec2(0, 0xc080); // fp32 -4.0 +# i16[idx + 90] -= i16vec2(0x3118, 0); // fp16 1/2pi +# i16[idx + 91] -= i16vec2(0, 0x3118); // fp16 1/2pi +# i16[idx + 92] -= i16vec2(0x3118, 0x3118); // fp16 1/2pi +# i16[idx + 93] -= i16vec2(0xf983, 0x3e22); // fp32 1/2pi +# i16[idx + 94] -= i16vec2(0x3e22, 0xf983); +# i16[idx + 95] -= i16vec2(0x3e22, 0x3e22); +# i16[idx + 96] -= i16vec2(0xf983, 0xf983); +# i16[idx + 97] -= i16vec2(0x3e22, 0); +# i16[idx + 98] -= i16vec2(0xf983, 0); +# i16[idx + 99] -= i16vec2(-2, -1); +# i16[idx + 100] -= i16vec2(-1, -2); +# i16[idx + 101] -= i16vec2(12, 20); +# +# i16[idx + 102] -= i16vec2(-1, -1); +# } + +SHADER compute compute_shader SPIRV-ASM + OpCapability Shader + OpCapability Float16 + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpCapability DenormPreserve + OpExtension "SPV_KHR_float_controls" + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %4 "main" %9 + OpExecutionMode %4 DenormPreserve 16 + OpExecutionMode %4 LocalSize 8 8 1 + OpDecorate %9 BuiltIn GlobalInvocationId + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 2 + OpDecorate %46 ArrayStride 4 + OpMemberDecorate %47 0 Offset 0 + OpDecorate %47 BufferBlock + OpDecorate %49 DescriptorSet 0 + OpDecorate %49 Binding 0 + OpDecorate %358 ArrayStride 4 + OpMemberDecorate %359 0 Offset 0 + OpDecorate %359 BufferBlock + OpDecorate %361 DescriptorSet 0 + OpDecorate %361 Binding 1 + OpDecorate %913 BuiltIn WorkgroupSize + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypeVector %6 3 + %8 = OpTypePointer Input %7 + %9 = OpVariable %8 Input + %11 = OpTypeStruct %7 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypePointer Uniform %7 + %19 = OpTypeBool + %20 = OpTypeVector %19 3 + %26 = OpTypeVector %14 2 + %27 = OpTypePointer Function %26 + %29 = OpTypeVector %6 2 + %33 = OpTypePointer Function %14 + %35 = OpConstant %6 1 + %38 = OpConstant %14 8 + %40 = OpConstant %6 0 + %44 = OpTypeFloat 16 + %45 = OpTypeVector %44 2 + %46 = OpTypeRuntimeArray %45 + %47 = OpTypeStruct %46 + %48 = OpTypePointer Uniform %47 + %49 = OpVariable %48 Uniform + %52 = OpConstant %44 0x1p+0 + %53 = OpConstantComposite %45 %52 %52 + %54 = OpTypePointer Uniform %45 + %60 = OpConstant %14 1 + %62 = OpConstant %44 -0x1p+0 + %63 = OpConstantComposite %45 %62 %62 + %69 = OpConstant %14 2 + %71 = OpConstant %44 0x1p-1 + %72 = OpConstantComposite %45 %71 %71 + %78 = OpConstant %14 3 + %80 = OpConstant %44 -0x1p-1 + %81 = OpConstantComposite %45 %80 %80 + %87 = OpConstant %14 4 + %89 = OpConstant %44 0x1p+1 + %90 = OpConstantComposite %45 %89 %89 + %96 = OpConstant %14 5 + %98 = OpConstant %44 -0x1p+1 + %99 = OpConstantComposite %45 %98 %98 + %105 = OpConstant %14 6 + %107 = OpConstant %44 0x1p+2 + %108 = OpConstantComposite %45 %107 %107 + %114 = OpConstant %14 7 + %116 = OpConstant %44 -0x1p+2 + %117 = OpConstantComposite %45 %116 %116 + %124 = OpTypeInt 16 1 + %125 = OpTypeVector %124 2 + %126 = OpConstant %124 12568 + %127 = OpConstantComposite %125 %126 %126 + %134 = OpConstant %14 9 + %136 = OpConstant %44 0x0p+0 + %137 = OpConstantComposite %45 %52 %136 + %143 = OpConstant %14 10 + %145 = OpConstantComposite %45 %136 %52 + %151 = OpConstant %14 11 + %153 = OpConstantComposite %45 %52 %62 + %159 = OpConstant %14 12 + %161 = OpConstantComposite %45 %62 %52 + %166 = OpTypePointer Function %44 + %168 = OpConstant %124 1 + %171 = OpConstant %124 17 + %174 = OpConstant %124 64 + %177 = OpConstant %14 13 + %186 = OpConstant %14 14 + %196 = OpConstant %14 15 + %205 = OpConstant %14 16 + %214 = OpConstant %14 17 + %224 = OpConstant %14 18 + %233 = OpConstant %14 19 + %242 = OpConstant %14 20 + %252 = OpConstant %14 21 + %261 = OpConstant %14 22 + %268 = OpConstant %14 23 + %275 = OpConstant %14 24 + %281 = OpTypePointer Function %45 + %284 = OpConstant %14 29 + %289 = OpConstant %14 25 + %299 = OpConstant %14 26 + %301 = OpConstantComposite %45 %136 %89 + %310 = OpConstant %14 27 + %312 = OpConstantComposite %45 %89 %136 + %321 = OpConstant %14 28 + %323 = OpConstantComposite %45 %89 %52 + %338 = OpConstant %14 30 + %345 = OpConstant %14 31 + %352 = OpConstant %14 32 + %358 = OpTypeRuntimeArray %125 + %359 = OpTypeStruct %358 + %360 = OpTypePointer Uniform %359 + %361 = OpVariable %360 Uniform + %363 = OpConstant %14 33 + %365 = OpConstantComposite %125 %168 %168 + %366 = OpTypePointer Uniform %125 + %372 = OpConstant %14 34 + %374 = OpConstant %124 0 + %375 = OpConstantComposite %125 %168 %374 + %381 = OpConstant %14 35 + %383 = OpConstantComposite %125 %374 %168 + %389 = OpConstant %14 36 + %391 = OpConstantComposite %125 %174 %174 + %397 = OpConstant %14 37 + %399 = OpConstant %124 -16 + %400 = OpConstantComposite %125 %399 %399 + %406 = OpConstant %14 38 + %408 = OpConstant %124 14336 + %409 = OpConstantComposite %125 %408 %374 + %415 = OpConstant %14 39 + %417 = OpConstantComposite %125 %374 %408 + %423 = OpConstant %14 40 + %425 = OpConstantComposite %125 %408 %408 + %431 = OpConstant %14 41 + %433 = OpConstant %124 16128 + %434 = OpConstantComposite %125 %374 %433 + %440 = OpConstant %14 42 + %442 = OpConstantComposite %125 %433 %374 + %448 = OpConstant %14 43 + %450 = OpConstantComposite %125 %433 %433 + %456 = OpConstant %14 44 + %458 = OpConstant %124 -18432 + %459 = OpConstantComposite %125 %458 %374 + %465 = OpConstant %14 45 + %467 = OpConstant %124 -16640 + %468 = OpConstantComposite %125 %374 %467 + %474 = OpConstant %14 46 + %476 = OpConstant %124 15360 + %477 = OpConstantComposite %125 %476 %374 + %483 = OpConstant %14 47 + %485 = OpConstant %124 16256 + %486 = OpConstantComposite %125 %374 %485 + %492 = OpConstant %14 48 + %494 = OpConstant %124 -17408 + %495 = OpConstantComposite %125 %494 %374 + %501 = OpConstant %14 49 + %503 = OpConstant %124 -16512 + %504 = OpConstantComposite %125 %374 %503 + %510 = OpConstant %14 50 + %512 = OpConstant %124 16384 + %513 = OpConstantComposite %125 %512 %374 + %519 = OpConstant %14 51 + %521 = OpConstantComposite %125 %374 %512 + %527 = OpConstant %14 52 + %529 = OpConstant %124 -16384 + %530 = OpConstantComposite %125 %529 %374 + %536 = OpConstant %14 53 + %538 = OpConstantComposite %125 %374 %529 + %544 = OpConstant %14 54 + %546 = OpConstant %124 17408 + %547 = OpConstantComposite %125 %546 %374 + %553 = OpConstant %14 55 + %555 = OpConstant %124 16512 + %556 = OpConstantComposite %125 %374 %555 + %562 = OpConstant %14 56 + %564 = OpConstant %124 -15360 + %565 = OpConstantComposite %125 %564 %374 + %571 = OpConstant %14 57 + %573 = OpConstant %124 -16256 + %574 = OpConstantComposite %125 %374 %573 + %580 = OpConstant %14 58 + %582 = OpConstantComposite %125 %126 %374 + %588 = OpConstant %14 59 + %590 = OpConstantComposite %125 %374 %126 + %596 = OpConstant %14 60 + %603 = OpConstant %14 61 + %605 = OpConstant %124 -1661 + %606 = OpConstant %124 15906 + %607 = OpConstantComposite %125 %605 %606 + %613 = OpConstant %14 62 + %615 = OpConstantComposite %125 %606 %605 + %621 = OpConstant %14 63 + %623 = OpConstantComposite %125 %606 %606 + %629 = OpConstant %14 64 + %631 = OpConstantComposite %125 %605 %605 + %637 = OpConstant %14 65 + %639 = OpConstantComposite %125 %606 %374 + %645 = OpConstant %14 66 + %647 = OpConstantComposite %125 %605 %374 + %653 = OpConstant %14 67 + %655 = OpConstant %124 -2 + %656 = OpConstant %124 -1 + %657 = OpConstantComposite %125 %655 %656 + %663 = OpConstant %14 68 + %665 = OpConstantComposite %125 %656 %655 + %671 = OpConstant %14 69 + %673 = OpConstant %124 12 + %674 = OpConstant %124 20 + %675 = OpConstantComposite %125 %673 %674 + %681 = OpConstant %14 70 + %688 = OpConstant %14 71 + %695 = OpConstant %14 72 + %702 = OpConstant %14 73 + %709 = OpConstant %14 74 + %716 = OpConstant %14 75 + %723 = OpConstant %14 76 + %730 = OpConstant %14 77 + %737 = OpConstant %14 78 + %744 = OpConstant %14 79 + %751 = OpConstant %14 80 + %758 = OpConstant %14 81 + %765 = OpConstant %14 82 + %772 = OpConstant %14 83 + %779 = OpConstant %14 84 + %786 = OpConstant %14 85 + %793 = OpConstant %14 86 + %800 = OpConstant %14 87 + %807 = OpConstant %14 88 + %814 = OpConstant %14 89 + %821 = OpConstant %14 90 + %828 = OpConstant %14 91 + %835 = OpConstant %14 92 + %842 = OpConstant %14 93 + %849 = OpConstant %14 94 + %856 = OpConstant %14 95 + %863 = OpConstant %14 96 + %870 = OpConstant %14 97 + %877 = OpConstant %14 98 + %884 = OpConstant %14 99 + %891 = OpConstant %14 100 + %898 = OpConstant %14 101 + %905 = OpConstant %14 102 + %907 = OpConstantComposite %125 %656 %656 + %912 = OpConstant %6 8 + %913 = OpConstantComposite %7 %912 %912 %35 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %28 = OpVariable %27 Function + %34 = OpVariable %33 Function + %167 = OpVariable %166 Function + %170 = OpVariable %166 Function + %173 = OpVariable %166 Function + %282 = OpVariable %281 Function + %10 = OpLoad %7 %9 + %17 = OpAccessChain %16 %13 %15 + %18 = OpLoad %7 %17 + %21 = OpUGreaterThanEqual %20 %10 %18 + %22 = OpAny %19 %21 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + OpReturn + %24 = OpLabel + %30 = OpLoad %7 %9 + %31 = OpVectorShuffle %29 %30 %30 0 1 + %32 = OpBitcast %26 %31 + OpStore %28 %32 + %36 = OpAccessChain %33 %28 %35 + %37 = OpLoad %14 %36 + %39 = OpIMul %14 %37 %38 + %41 = OpAccessChain %33 %28 %40 + %42 = OpLoad %14 %41 + %43 = OpIAdd %14 %39 %42 + OpStore %34 %43 + %50 = OpLoad %14 %34 + %51 = OpIAdd %14 %50 %15 + %55 = OpAccessChain %54 %49 %15 %51 + %56 = OpLoad %45 %55 + %57 = OpFAdd %45 %56 %53 + %58 = OpAccessChain %54 %49 %15 %51 + OpStore %58 %57 + %59 = OpLoad %14 %34 + %61 = OpIAdd %14 %59 %60 + %64 = OpAccessChain %54 %49 %15 %61 + %65 = OpLoad %45 %64 + %66 = OpFAdd %45 %65 %63 + %67 = OpAccessChain %54 %49 %15 %61 + OpStore %67 %66 + %68 = OpLoad %14 %34 + %70 = OpIAdd %14 %68 %69 + %73 = OpAccessChain %54 %49 %15 %70 + %74 = OpLoad %45 %73 + %75 = OpFAdd %45 %74 %72 + %76 = OpAccessChain %54 %49 %15 %70 + OpStore %76 %75 + %77 = OpLoad %14 %34 + %79 = OpIAdd %14 %77 %78 + %82 = OpAccessChain %54 %49 %15 %79 + %83 = OpLoad %45 %82 + %84 = OpFAdd %45 %83 %81 + %85 = OpAccessChain %54 %49 %15 %79 + OpStore %85 %84 + %86 = OpLoad %14 %34 + %88 = OpIAdd %14 %86 %87 + %91 = OpAccessChain %54 %49 %15 %88 + %92 = OpLoad %45 %91 + %93 = OpFAdd %45 %92 %90 + %94 = OpAccessChain %54 %49 %15 %88 + OpStore %94 %93 + %95 = OpLoad %14 %34 + %97 = OpIAdd %14 %95 %96 + %100 = OpAccessChain %54 %49 %15 %97 + %101 = OpLoad %45 %100 + %102 = OpFAdd %45 %101 %99 + %103 = OpAccessChain %54 %49 %15 %97 + OpStore %103 %102 + %104 = OpLoad %14 %34 + %106 = OpIAdd %14 %104 %105 + %109 = OpAccessChain %54 %49 %15 %106 + %110 = OpLoad %45 %109 + %111 = OpFAdd %45 %110 %108 + %112 = OpAccessChain %54 %49 %15 %106 + OpStore %112 %111 + %113 = OpLoad %14 %34 + %115 = OpIAdd %14 %113 %114 + %118 = OpAccessChain %54 %49 %15 %115 + %119 = OpLoad %45 %118 + %120 = OpFAdd %45 %119 %117 + %121 = OpAccessChain %54 %49 %15 %115 + OpStore %121 %120 + %122 = OpLoad %14 %34 + %123 = OpIAdd %14 %122 %38 + %128 = OpBitcast %45 %127 + %129 = OpAccessChain %54 %49 %15 %123 + %130 = OpLoad %45 %129 + %131 = OpFAdd %45 %130 %128 + %132 = OpAccessChain %54 %49 %15 %123 + OpStore %132 %131 + %133 = OpLoad %14 %34 + %135 = OpIAdd %14 %133 %134 + %138 = OpAccessChain %54 %49 %15 %135 + %139 = OpLoad %45 %138 + %140 = OpFAdd %45 %139 %137 + %141 = OpAccessChain %54 %49 %15 %135 + OpStore %141 %140 + %142 = OpLoad %14 %34 + %144 = OpIAdd %14 %142 %143 + %146 = OpAccessChain %54 %49 %15 %144 + %147 = OpLoad %45 %146 + %148 = OpFAdd %45 %147 %145 + %149 = OpAccessChain %54 %49 %15 %144 + OpStore %149 %148 + %150 = OpLoad %14 %34 + %152 = OpIAdd %14 %150 %151 + %154 = OpAccessChain %54 %49 %15 %152 + %155 = OpLoad %45 %154 + %156 = OpFAdd %45 %155 %153 + %157 = OpAccessChain %54 %49 %15 %152 + OpStore %157 %156 + %158 = OpLoad %14 %34 + %160 = OpIAdd %14 %158 %159 + %162 = OpAccessChain %54 %49 %15 %160 + %163 = OpLoad %45 %162 + %164 = OpFAdd %45 %163 %161 + %165 = OpAccessChain %54 %49 %15 %160 + OpStore %165 %164 + %169 = OpBitcast %44 %168 + OpStore %167 %169 + %172 = OpBitcast %44 %171 + OpStore %170 %172 + %175 = OpBitcast %44 %174 + OpStore %173 %175 + %176 = OpLoad %14 %34 + %178 = OpIAdd %14 %176 %177 + %179 = OpLoad %44 %167 + %180 = OpCompositeConstruct %45 %179 %136 + %181 = OpAccessChain %54 %49 %15 %178 + %182 = OpLoad %45 %181 + %183 = OpFAdd %45 %182 %180 + %184 = OpAccessChain %54 %49 %15 %178 + OpStore %184 %183 + %185 = OpLoad %14 %34 + %187 = OpIAdd %14 %185 %186 + %188 = OpLoad %44 %167 + %189 = OpLoad %44 %167 + %190 = OpCompositeConstruct %45 %188 %189 + %191 = OpAccessChain %54 %49 %15 %187 + %192 = OpLoad %45 %191 + %193 = OpFAdd %45 %192 %190 + %194 = OpAccessChain %54 %49 %15 %187 + OpStore %194 %193 + %195 = OpLoad %14 %34 + %197 = OpIAdd %14 %195 %196 + %198 = OpLoad %44 %167 + %199 = OpCompositeConstruct %45 %136 %198 + %200 = OpAccessChain %54 %49 %15 %197 + %201 = OpLoad %45 %200 + %202 = OpFAdd %45 %201 %199 + %203 = OpAccessChain %54 %49 %15 %197 + OpStore %203 %202 + %204 = OpLoad %14 %34 + %206 = OpIAdd %14 %204 %205 + %207 = OpLoad %44 %170 + %208 = OpCompositeConstruct %45 %207 %136 + %209 = OpAccessChain %54 %49 %15 %206 + %210 = OpLoad %45 %209 + %211 = OpFAdd %45 %210 %208 + %212 = OpAccessChain %54 %49 %15 %206 + OpStore %212 %211 + %213 = OpLoad %14 %34 + %215 = OpIAdd %14 %213 %214 + %216 = OpLoad %44 %170 + %217 = OpLoad %44 %170 + %218 = OpCompositeConstruct %45 %216 %217 + %219 = OpAccessChain %54 %49 %15 %215 + %220 = OpLoad %45 %219 + %221 = OpFAdd %45 %220 %218 + %222 = OpAccessChain %54 %49 %15 %215 + OpStore %222 %221 + %223 = OpLoad %14 %34 + %225 = OpIAdd %14 %223 %224 + %226 = OpLoad %44 %170 + %227 = OpCompositeConstruct %45 %136 %226 + %228 = OpAccessChain %54 %49 %15 %225 + %229 = OpLoad %45 %228 + %230 = OpFAdd %45 %229 %227 + %231 = OpAccessChain %54 %49 %15 %225 + OpStore %231 %230 + %232 = OpLoad %14 %34 + %234 = OpIAdd %14 %232 %233 + %235 = OpLoad %44 %173 + %236 = OpCompositeConstruct %45 %235 %136 + %237 = OpAccessChain %54 %49 %15 %234 + %238 = OpLoad %45 %237 + %239 = OpFAdd %45 %238 %236 + %240 = OpAccessChain %54 %49 %15 %234 + OpStore %240 %239 + %241 = OpLoad %14 %34 + %243 = OpIAdd %14 %241 %242 + %244 = OpLoad %44 %173 + %245 = OpLoad %44 %173 + %246 = OpCompositeConstruct %45 %244 %245 + %247 = OpAccessChain %54 %49 %15 %243 + %248 = OpLoad %45 %247 + %249 = OpFAdd %45 %248 %246 + %250 = OpAccessChain %54 %49 %15 %243 + OpStore %250 %249 + %251 = OpLoad %14 %34 + %253 = OpIAdd %14 %251 %252 + %254 = OpLoad %44 %173 + %255 = OpCompositeConstruct %45 %136 %254 + %256 = OpAccessChain %54 %49 %15 %253 + %257 = OpLoad %45 %256 + %258 = OpFAdd %45 %257 %255 + %259 = OpAccessChain %54 %49 %15 %253 + OpStore %259 %258 + %260 = OpLoad %14 %34 + %262 = OpIAdd %14 %260 %261 + %263 = OpAccessChain %54 %49 %15 %262 + %264 = OpLoad %45 %263 + %265 = OpFSub %45 %264 %53 + %266 = OpAccessChain %54 %49 %15 %262 + OpStore %266 %265 + %267 = OpLoad %14 %34 + %269 = OpIAdd %14 %267 %268 + %270 = OpAccessChain %54 %49 %15 %269 + %271 = OpLoad %45 %270 + %272 = OpFSub %45 %271 %145 + %273 = OpAccessChain %54 %49 %15 %269 + OpStore %273 %272 + %274 = OpLoad %14 %34 + %276 = OpIAdd %14 %274 %275 + %277 = OpAccessChain %54 %49 %15 %276 + %278 = OpLoad %45 %277 + %279 = OpFSub %45 %278 %137 + %280 = OpAccessChain %54 %49 %15 %276 + OpStore %280 %279 + %283 = OpLoad %14 %34 + %285 = OpIAdd %14 %283 %284 + %286 = OpAccessChain %54 %49 %15 %285 + %287 = OpLoad %45 %286 + OpStore %282 %287 + %288 = OpLoad %14 %34 + %290 = OpIAdd %14 %288 %289 + %291 = OpLoad %45 %282 + %292 = OpLoad %14 %34 + %293 = OpIAdd %14 %292 %289 + %294 = OpAccessChain %54 %49 %15 %293 + %295 = OpLoad %45 %294 + %296 = OpExtInst %45 %1 Fma %90 %291 %295 + %297 = OpAccessChain %54 %49 %15 %290 + OpStore %297 %296 + %298 = OpLoad %14 %34 + %300 = OpIAdd %14 %298 %299 + %302 = OpLoad %45 %282 + %303 = OpLoad %14 %34 + %304 = OpIAdd %14 %303 %299 + %305 = OpAccessChain %54 %49 %15 %304 + %306 = OpLoad %45 %305 + %307 = OpExtInst %45 %1 Fma %301 %302 %306 + %308 = OpAccessChain %54 %49 %15 %300 + OpStore %308 %307 + %309 = OpLoad %14 %34 + %311 = OpIAdd %14 %309 %310 + %313 = OpLoad %45 %282 + %314 = OpLoad %14 %34 + %315 = OpIAdd %14 %314 %310 + %316 = OpAccessChain %54 %49 %15 %315 + %317 = OpLoad %45 %316 + %318 = OpExtInst %45 %1 Fma %312 %313 %317 + %319 = OpAccessChain %54 %49 %15 %311 + OpStore %319 %318 + %320 = OpLoad %14 %34 + %322 = OpIAdd %14 %320 %321 + %324 = OpLoad %45 %282 + %325 = OpLoad %14 %34 + %326 = OpIAdd %14 %325 %321 + %327 = OpAccessChain %54 %49 %15 %326 + %328 = OpLoad %45 %327 + %329 = OpExtInst %45 %1 Fma %323 %324 %328 + %330 = OpAccessChain %54 %49 %15 %322 + OpStore %330 %329 + %331 = OpLoad %14 %34 + %332 = OpIAdd %14 %331 %284 + %333 = OpAccessChain %54 %49 %15 %332 + %334 = OpLoad %45 %333 + %335 = OpFMul %45 %334 %90 + %336 = OpAccessChain %54 %49 %15 %332 + OpStore %336 %335 + %337 = OpLoad %14 %34 + %339 = OpIAdd %14 %337 %338 + %340 = OpAccessChain %54 %49 %15 %339 + %341 = OpLoad %45 %340 + %342 = OpFMul %45 %341 %301 + %343 = OpAccessChain %54 %49 %15 %339 + OpStore %343 %342 + %344 = OpLoad %14 %34 + %346 = OpIAdd %14 %344 %345 + %347 = OpAccessChain %54 %49 %15 %346 + %348 = OpLoad %45 %347 + %349 = OpFMul %45 %348 %312 + %350 = OpAccessChain %54 %49 %15 %346 + OpStore %350 %349 + %351 = OpLoad %14 %34 + %353 = OpIAdd %14 %351 %352 + %354 = OpAccessChain %54 %49 %15 %353 + %355 = OpLoad %45 %354 + %356 = OpFMul %45 %355 %323 + %357 = OpAccessChain %54 %49 %15 %353 + OpStore %357 %356 + %362 = OpLoad %14 %34 + %364 = OpIAdd %14 %362 %363 + %367 = OpAccessChain %366 %361 %15 %364 + %368 = OpLoad %125 %367 + %369 = OpIAdd %125 %368 %365 + %370 = OpAccessChain %366 %361 %15 %364 + OpStore %370 %369 + %371 = OpLoad %14 %34 + %373 = OpIAdd %14 %371 %372 + %376 = OpAccessChain %366 %361 %15 %373 + %377 = OpLoad %125 %376 + %378 = OpIAdd %125 %377 %375 + %379 = OpAccessChain %366 %361 %15 %373 + OpStore %379 %378 + %380 = OpLoad %14 %34 + %382 = OpIAdd %14 %380 %381 + %384 = OpAccessChain %366 %361 %15 %382 + %385 = OpLoad %125 %384 + %386 = OpIAdd %125 %385 %383 + %387 = OpAccessChain %366 %361 %15 %382 + OpStore %387 %386 + %388 = OpLoad %14 %34 + %390 = OpIAdd %14 %388 %389 + %392 = OpAccessChain %366 %361 %15 %390 + %393 = OpLoad %125 %392 + %394 = OpIAdd %125 %393 %391 + %395 = OpAccessChain %366 %361 %15 %390 + OpStore %395 %394 + %396 = OpLoad %14 %34 + %398 = OpIAdd %14 %396 %397 + %401 = OpAccessChain %366 %361 %15 %398 + %402 = OpLoad %125 %401 + %403 = OpIAdd %125 %402 %400 + %404 = OpAccessChain %366 %361 %15 %398 + OpStore %404 %403 + %405 = OpLoad %14 %34 + %407 = OpIAdd %14 %405 %406 + %410 = OpAccessChain %366 %361 %15 %407 + %411 = OpLoad %125 %410 + %412 = OpIAdd %125 %411 %409 + %413 = OpAccessChain %366 %361 %15 %407 + OpStore %413 %412 + %414 = OpLoad %14 %34 + %416 = OpIAdd %14 %414 %415 + %418 = OpAccessChain %366 %361 %15 %416 + %419 = OpLoad %125 %418 + %420 = OpIAdd %125 %419 %417 + %421 = OpAccessChain %366 %361 %15 %416 + OpStore %421 %420 + %422 = OpLoad %14 %34 + %424 = OpIAdd %14 %422 %423 + %426 = OpAccessChain %366 %361 %15 %424 + %427 = OpLoad %125 %426 + %428 = OpIAdd %125 %427 %425 + %429 = OpAccessChain %366 %361 %15 %424 + OpStore %429 %428 + %430 = OpLoad %14 %34 + %432 = OpIAdd %14 %430 %431 + %435 = OpAccessChain %366 %361 %15 %432 + %436 = OpLoad %125 %435 + %437 = OpIAdd %125 %436 %434 + %438 = OpAccessChain %366 %361 %15 %432 + OpStore %438 %437 + %439 = OpLoad %14 %34 + %441 = OpIAdd %14 %439 %440 + %443 = OpAccessChain %366 %361 %15 %441 + %444 = OpLoad %125 %443 + %445 = OpIAdd %125 %444 %442 + %446 = OpAccessChain %366 %361 %15 %441 + OpStore %446 %445 + %447 = OpLoad %14 %34 + %449 = OpIAdd %14 %447 %448 + %451 = OpAccessChain %366 %361 %15 %449 + %452 = OpLoad %125 %451 + %453 = OpIAdd %125 %452 %450 + %454 = OpAccessChain %366 %361 %15 %449 + OpStore %454 %453 + %455 = OpLoad %14 %34 + %457 = OpIAdd %14 %455 %456 + %460 = OpAccessChain %366 %361 %15 %457 + %461 = OpLoad %125 %460 + %462 = OpIAdd %125 %461 %459 + %463 = OpAccessChain %366 %361 %15 %457 + OpStore %463 %462 + %464 = OpLoad %14 %34 + %466 = OpIAdd %14 %464 %465 + %469 = OpAccessChain %366 %361 %15 %466 + %470 = OpLoad %125 %469 + %471 = OpIAdd %125 %470 %468 + %472 = OpAccessChain %366 %361 %15 %466 + OpStore %472 %471 + %473 = OpLoad %14 %34 + %475 = OpIAdd %14 %473 %474 + %478 = OpAccessChain %366 %361 %15 %475 + %479 = OpLoad %125 %478 + %480 = OpIAdd %125 %479 %477 + %481 = OpAccessChain %366 %361 %15 %475 + OpStore %481 %480 + %482 = OpLoad %14 %34 + %484 = OpIAdd %14 %482 %483 + %487 = OpAccessChain %366 %361 %15 %484 + %488 = OpLoad %125 %487 + %489 = OpIAdd %125 %488 %486 + %490 = OpAccessChain %366 %361 %15 %484 + OpStore %490 %489 + %491 = OpLoad %14 %34 + %493 = OpIAdd %14 %491 %492 + %496 = OpAccessChain %366 %361 %15 %493 + %497 = OpLoad %125 %496 + %498 = OpIAdd %125 %497 %495 + %499 = OpAccessChain %366 %361 %15 %493 + OpStore %499 %498 + %500 = OpLoad %14 %34 + %502 = OpIAdd %14 %500 %501 + %505 = OpAccessChain %366 %361 %15 %502 + %506 = OpLoad %125 %505 + %507 = OpIAdd %125 %506 %504 + %508 = OpAccessChain %366 %361 %15 %502 + OpStore %508 %507 + %509 = OpLoad %14 %34 + %511 = OpIAdd %14 %509 %510 + %514 = OpAccessChain %366 %361 %15 %511 + %515 = OpLoad %125 %514 + %516 = OpIAdd %125 %515 %513 + %517 = OpAccessChain %366 %361 %15 %511 + OpStore %517 %516 + %518 = OpLoad %14 %34 + %520 = OpIAdd %14 %518 %519 + %522 = OpAccessChain %366 %361 %15 %520 + %523 = OpLoad %125 %522 + %524 = OpIAdd %125 %523 %521 + %525 = OpAccessChain %366 %361 %15 %520 + OpStore %525 %524 + %526 = OpLoad %14 %34 + %528 = OpIAdd %14 %526 %527 + %531 = OpAccessChain %366 %361 %15 %528 + %532 = OpLoad %125 %531 + %533 = OpIAdd %125 %532 %530 + %534 = OpAccessChain %366 %361 %15 %528 + OpStore %534 %533 + %535 = OpLoad %14 %34 + %537 = OpIAdd %14 %535 %536 + %539 = OpAccessChain %366 %361 %15 %537 + %540 = OpLoad %125 %539 + %541 = OpIAdd %125 %540 %538 + %542 = OpAccessChain %366 %361 %15 %537 + OpStore %542 %541 + %543 = OpLoad %14 %34 + %545 = OpIAdd %14 %543 %544 + %548 = OpAccessChain %366 %361 %15 %545 + %549 = OpLoad %125 %548 + %550 = OpIAdd %125 %549 %547 + %551 = OpAccessChain %366 %361 %15 %545 + OpStore %551 %550 + %552 = OpLoad %14 %34 + %554 = OpIAdd %14 %552 %553 + %557 = OpAccessChain %366 %361 %15 %554 + %558 = OpLoad %125 %557 + %559 = OpIAdd %125 %558 %556 + %560 = OpAccessChain %366 %361 %15 %554 + OpStore %560 %559 + %561 = OpLoad %14 %34 + %563 = OpIAdd %14 %561 %562 + %566 = OpAccessChain %366 %361 %15 %563 + %567 = OpLoad %125 %566 + %568 = OpIAdd %125 %567 %565 + %569 = OpAccessChain %366 %361 %15 %563 + OpStore %569 %568 + %570 = OpLoad %14 %34 + %572 = OpIAdd %14 %570 %571 + %575 = OpAccessChain %366 %361 %15 %572 + %576 = OpLoad %125 %575 + %577 = OpIAdd %125 %576 %574 + %578 = OpAccessChain %366 %361 %15 %572 + OpStore %578 %577 + %579 = OpLoad %14 %34 + %581 = OpIAdd %14 %579 %580 + %583 = OpAccessChain %366 %361 %15 %581 + %584 = OpLoad %125 %583 + %585 = OpIAdd %125 %584 %582 + %586 = OpAccessChain %366 %361 %15 %581 + OpStore %586 %585 + %587 = OpLoad %14 %34 + %589 = OpIAdd %14 %587 %588 + %591 = OpAccessChain %366 %361 %15 %589 + %592 = OpLoad %125 %591 + %593 = OpIAdd %125 %592 %590 + %594 = OpAccessChain %366 %361 %15 %589 + OpStore %594 %593 + %595 = OpLoad %14 %34 + %597 = OpIAdd %14 %595 %596 + %598 = OpAccessChain %366 %361 %15 %597 + %599 = OpLoad %125 %598 + %600 = OpIAdd %125 %599 %127 + %601 = OpAccessChain %366 %361 %15 %597 + OpStore %601 %600 + %602 = OpLoad %14 %34 + %604 = OpIAdd %14 %602 %603 + %608 = OpAccessChain %366 %361 %15 %604 + %609 = OpLoad %125 %608 + %610 = OpIAdd %125 %609 %607 + %611 = OpAccessChain %366 %361 %15 %604 + OpStore %611 %610 + %612 = OpLoad %14 %34 + %614 = OpIAdd %14 %612 %613 + %616 = OpAccessChain %366 %361 %15 %614 + %617 = OpLoad %125 %616 + %618 = OpIAdd %125 %617 %615 + %619 = OpAccessChain %366 %361 %15 %614 + OpStore %619 %618 + %620 = OpLoad %14 %34 + %622 = OpIAdd %14 %620 %621 + %624 = OpAccessChain %366 %361 %15 %622 + %625 = OpLoad %125 %624 + %626 = OpIAdd %125 %625 %623 + %627 = OpAccessChain %366 %361 %15 %622 + OpStore %627 %626 + %628 = OpLoad %14 %34 + %630 = OpIAdd %14 %628 %629 + %632 = OpAccessChain %366 %361 %15 %630 + %633 = OpLoad %125 %632 + %634 = OpIAdd %125 %633 %631 + %635 = OpAccessChain %366 %361 %15 %630 + OpStore %635 %634 + %636 = OpLoad %14 %34 + %638 = OpIAdd %14 %636 %637 + %640 = OpAccessChain %366 %361 %15 %638 + %641 = OpLoad %125 %640 + %642 = OpIAdd %125 %641 %639 + %643 = OpAccessChain %366 %361 %15 %638 + OpStore %643 %642 + %644 = OpLoad %14 %34 + %646 = OpIAdd %14 %644 %645 + %648 = OpAccessChain %366 %361 %15 %646 + %649 = OpLoad %125 %648 + %650 = OpIAdd %125 %649 %647 + %651 = OpAccessChain %366 %361 %15 %646 + OpStore %651 %650 + %652 = OpLoad %14 %34 + %654 = OpIAdd %14 %652 %653 + %658 = OpAccessChain %366 %361 %15 %654 + %659 = OpLoad %125 %658 + %660 = OpIAdd %125 %659 %657 + %661 = OpAccessChain %366 %361 %15 %654 + OpStore %661 %660 + %662 = OpLoad %14 %34 + %664 = OpIAdd %14 %662 %663 + %666 = OpAccessChain %366 %361 %15 %664 + %667 = OpLoad %125 %666 + %668 = OpIAdd %125 %667 %665 + %669 = OpAccessChain %366 %361 %15 %664 + OpStore %669 %668 + %670 = OpLoad %14 %34 + %672 = OpIAdd %14 %670 %671 + %676 = OpAccessChain %366 %361 %15 %672 + %677 = OpLoad %125 %676 + %678 = OpIAdd %125 %677 %675 + %679 = OpAccessChain %366 %361 %15 %672 + OpStore %679 %678 + %680 = OpLoad %14 %34 + %682 = OpIAdd %14 %680 %681 + %683 = OpAccessChain %366 %361 %15 %682 + %684 = OpLoad %125 %683 + %685 = OpISub %125 %684 %409 + %686 = OpAccessChain %366 %361 %15 %682 + OpStore %686 %685 + %687 = OpLoad %14 %34 + %689 = OpIAdd %14 %687 %688 + %690 = OpAccessChain %366 %361 %15 %689 + %691 = OpLoad %125 %690 + %692 = OpISub %125 %691 %417 + %693 = OpAccessChain %366 %361 %15 %689 + OpStore %693 %692 + %694 = OpLoad %14 %34 + %696 = OpIAdd %14 %694 %695 + %697 = OpAccessChain %366 %361 %15 %696 + %698 = OpLoad %125 %697 + %699 = OpISub %125 %698 %425 + %700 = OpAccessChain %366 %361 %15 %696 + OpStore %700 %699 + %701 = OpLoad %14 %34 + %703 = OpIAdd %14 %701 %702 + %704 = OpAccessChain %366 %361 %15 %703 + %705 = OpLoad %125 %704 + %706 = OpISub %125 %705 %434 + %707 = OpAccessChain %366 %361 %15 %703 + OpStore %707 %706 + %708 = OpLoad %14 %34 + %710 = OpIAdd %14 %708 %709 + %711 = OpAccessChain %366 %361 %15 %710 + %712 = OpLoad %125 %711 + %713 = OpISub %125 %712 %442 + %714 = OpAccessChain %366 %361 %15 %710 + OpStore %714 %713 + %715 = OpLoad %14 %34 + %717 = OpIAdd %14 %715 %716 + %718 = OpAccessChain %366 %361 %15 %717 + %719 = OpLoad %125 %718 + %720 = OpISub %125 %719 %450 + %721 = OpAccessChain %366 %361 %15 %717 + OpStore %721 %720 + %722 = OpLoad %14 %34 + %724 = OpIAdd %14 %722 %723 + %725 = OpAccessChain %366 %361 %15 %724 + %726 = OpLoad %125 %725 + %727 = OpISub %125 %726 %459 + %728 = OpAccessChain %366 %361 %15 %724 + OpStore %728 %727 + %729 = OpLoad %14 %34 + %731 = OpIAdd %14 %729 %730 + %732 = OpAccessChain %366 %361 %15 %731 + %733 = OpLoad %125 %732 + %734 = OpISub %125 %733 %468 + %735 = OpAccessChain %366 %361 %15 %731 + OpStore %735 %734 + %736 = OpLoad %14 %34 + %738 = OpIAdd %14 %736 %737 + %739 = OpAccessChain %366 %361 %15 %738 + %740 = OpLoad %125 %739 + %741 = OpISub %125 %740 %477 + %742 = OpAccessChain %366 %361 %15 %738 + OpStore %742 %741 + %743 = OpLoad %14 %34 + %745 = OpIAdd %14 %743 %744 + %746 = OpAccessChain %366 %361 %15 %745 + %747 = OpLoad %125 %746 + %748 = OpISub %125 %747 %486 + %749 = OpAccessChain %366 %361 %15 %745 + OpStore %749 %748 + %750 = OpLoad %14 %34 + %752 = OpIAdd %14 %750 %751 + %753 = OpAccessChain %366 %361 %15 %752 + %754 = OpLoad %125 %753 + %755 = OpISub %125 %754 %495 + %756 = OpAccessChain %366 %361 %15 %752 + OpStore %756 %755 + %757 = OpLoad %14 %34 + %759 = OpIAdd %14 %757 %758 + %760 = OpAccessChain %366 %361 %15 %759 + %761 = OpLoad %125 %760 + %762 = OpISub %125 %761 %504 + %763 = OpAccessChain %366 %361 %15 %759 + OpStore %763 %762 + %764 = OpLoad %14 %34 + %766 = OpIAdd %14 %764 %765 + %767 = OpAccessChain %366 %361 %15 %766 + %768 = OpLoad %125 %767 + %769 = OpISub %125 %768 %513 + %770 = OpAccessChain %366 %361 %15 %766 + OpStore %770 %769 + %771 = OpLoad %14 %34 + %773 = OpIAdd %14 %771 %772 + %774 = OpAccessChain %366 %361 %15 %773 + %775 = OpLoad %125 %774 + %776 = OpISub %125 %775 %521 + %777 = OpAccessChain %366 %361 %15 %773 + OpStore %777 %776 + %778 = OpLoad %14 %34 + %780 = OpIAdd %14 %778 %779 + %781 = OpAccessChain %366 %361 %15 %780 + %782 = OpLoad %125 %781 + %783 = OpISub %125 %782 %530 + %784 = OpAccessChain %366 %361 %15 %780 + OpStore %784 %783 + %785 = OpLoad %14 %34 + %787 = OpIAdd %14 %785 %786 + %788 = OpAccessChain %366 %361 %15 %787 + %789 = OpLoad %125 %788 + %790 = OpISub %125 %789 %538 + %791 = OpAccessChain %366 %361 %15 %787 + OpStore %791 %790 + %792 = OpLoad %14 %34 + %794 = OpIAdd %14 %792 %793 + %795 = OpAccessChain %366 %361 %15 %794 + %796 = OpLoad %125 %795 + %797 = OpISub %125 %796 %547 + %798 = OpAccessChain %366 %361 %15 %794 + OpStore %798 %797 + %799 = OpLoad %14 %34 + %801 = OpIAdd %14 %799 %800 + %802 = OpAccessChain %366 %361 %15 %801 + %803 = OpLoad %125 %802 + %804 = OpISub %125 %803 %556 + %805 = OpAccessChain %366 %361 %15 %801 + OpStore %805 %804 + %806 = OpLoad %14 %34 + %808 = OpIAdd %14 %806 %807 + %809 = OpAccessChain %366 %361 %15 %808 + %810 = OpLoad %125 %809 + %811 = OpISub %125 %810 %565 + %812 = OpAccessChain %366 %361 %15 %808 + OpStore %812 %811 + %813 = OpLoad %14 %34 + %815 = OpIAdd %14 %813 %814 + %816 = OpAccessChain %366 %361 %15 %815 + %817 = OpLoad %125 %816 + %818 = OpISub %125 %817 %574 + %819 = OpAccessChain %366 %361 %15 %815 + OpStore %819 %818 + %820 = OpLoad %14 %34 + %822 = OpIAdd %14 %820 %821 + %823 = OpAccessChain %366 %361 %15 %822 + %824 = OpLoad %125 %823 + %825 = OpISub %125 %824 %582 + %826 = OpAccessChain %366 %361 %15 %822 + OpStore %826 %825 + %827 = OpLoad %14 %34 + %829 = OpIAdd %14 %827 %828 + %830 = OpAccessChain %366 %361 %15 %829 + %831 = OpLoad %125 %830 + %832 = OpISub %125 %831 %590 + %833 = OpAccessChain %366 %361 %15 %829 + OpStore %833 %832 + %834 = OpLoad %14 %34 + %836 = OpIAdd %14 %834 %835 + %837 = OpAccessChain %366 %361 %15 %836 + %838 = OpLoad %125 %837 + %839 = OpISub %125 %838 %127 + %840 = OpAccessChain %366 %361 %15 %836 + OpStore %840 %839 + %841 = OpLoad %14 %34 + %843 = OpIAdd %14 %841 %842 + %844 = OpAccessChain %366 %361 %15 %843 + %845 = OpLoad %125 %844 + %846 = OpISub %125 %845 %607 + %847 = OpAccessChain %366 %361 %15 %843 + OpStore %847 %846 + %848 = OpLoad %14 %34 + %850 = OpIAdd %14 %848 %849 + %851 = OpAccessChain %366 %361 %15 %850 + %852 = OpLoad %125 %851 + %853 = OpISub %125 %852 %615 + %854 = OpAccessChain %366 %361 %15 %850 + OpStore %854 %853 + %855 = OpLoad %14 %34 + %857 = OpIAdd %14 %855 %856 + %858 = OpAccessChain %366 %361 %15 %857 + %859 = OpLoad %125 %858 + %860 = OpISub %125 %859 %623 + %861 = OpAccessChain %366 %361 %15 %857 + OpStore %861 %860 + %862 = OpLoad %14 %34 + %864 = OpIAdd %14 %862 %863 + %865 = OpAccessChain %366 %361 %15 %864 + %866 = OpLoad %125 %865 + %867 = OpISub %125 %866 %631 + %868 = OpAccessChain %366 %361 %15 %864 + OpStore %868 %867 + %869 = OpLoad %14 %34 + %871 = OpIAdd %14 %869 %870 + %872 = OpAccessChain %366 %361 %15 %871 + %873 = OpLoad %125 %872 + %874 = OpISub %125 %873 %639 + %875 = OpAccessChain %366 %361 %15 %871 + OpStore %875 %874 + %876 = OpLoad %14 %34 + %878 = OpIAdd %14 %876 %877 + %879 = OpAccessChain %366 %361 %15 %878 + %880 = OpLoad %125 %879 + %881 = OpISub %125 %880 %647 + %882 = OpAccessChain %366 %361 %15 %878 + OpStore %882 %881 + %883 = OpLoad %14 %34 + %885 = OpIAdd %14 %883 %884 + %886 = OpAccessChain %366 %361 %15 %885 + %887 = OpLoad %125 %886 + %888 = OpISub %125 %887 %657 + %889 = OpAccessChain %366 %361 %15 %885 + OpStore %889 %888 + %890 = OpLoad %14 %34 + %892 = OpIAdd %14 %890 %891 + %893 = OpAccessChain %366 %361 %15 %892 + %894 = OpLoad %125 %893 + %895 = OpISub %125 %894 %665 + %896 = OpAccessChain %366 %361 %15 %892 + OpStore %896 %895 + %897 = OpLoad %14 %34 + %899 = OpIAdd %14 %897 %898 + %900 = OpAccessChain %366 %361 %15 %899 + %901 = OpLoad %125 %900 + %902 = OpISub %125 %901 %675 + %903 = OpAccessChain %366 %361 %15 %899 + OpStore %903 %902 + %904 = OpLoad %14 %34 + %906 = OpIAdd %14 %904 %905 + %908 = OpAccessChain %366 %361 %15 %906 + %909 = OpLoad %125 %908 + %910 = OpISub %125 %909 %907 + %911 = OpAccessChain %366 %361 %15 %906 + OpStore %911 %910 + OpReturn + OpFunctionEnd +END + +BUFFER result DATA_TYPE uint32 DATA +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 0..15 +0 0 0 0 0 0 0 0 0 0 0 0 0 # 16..28 +0x3c003c00 0x3c003c00 0x3c003c00 0x3c003c00 # 29..32 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 33..47 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 48..63 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 64..79 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 80..95 +0 0 0 0 0 0 0 # 96..102 +END + +BUFFER constants DATA_TYPE uint32 DATA +1 1 1 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER constants AS uniform DESCRIPTOR_SET 0 BINDING 2 +END + +RUN pipeline 1 1 1 + +# Amber bug and/or misleading behavior: index must be given in bytes +EXPECT result IDX 0 EQ 0x3c003c00 0xbc00bc00 0x38003800 0xb800b800 0x40004000 0xc000c000 0x44004400 0xc400c400 0x31183118 +EXPECT result IDX 36 EQ 0x00003c00 0x3c000000 0xbc003c00 0x3c00bc00 +EXPECT result IDX 52 EQ 0x00000001 0x00010001 0x00010000 0x00000011 0x00110011 0x00110000 0x00000040 0x00400040 0x00400000 +EXPECT result IDX 88 EQ 0xbc00bc00 0xbc000000 0x0000bc00 +EXPECT result IDX 100 EQ 0x40004000 0x40000000 0x00004000 0x3c004000 +EXPECT result IDX 116 EQ 0x40004000 0x40000000 0x00004000 0x3c004000 +EXPECT result IDX 132 EQ 0x00010001 0x00000001 0x00010000 0x00400040 0xfff0fff0 +EXPECT result IDX 152 EQ 0x00003800 0x38000000 0x38003800 0x3f000000 0x00003f00 0x3f003f00 0x0000b800 0xbf000000 +EXPECT result IDX 184 EQ 0x00003c00 0x3f800000 0x0000bc00 0xbf800000 0x00004000 0x40000000 0x0000c000 0xc0000000 +EXPECT result IDX 216 EQ 0x00004400 0x40800000 0x0000c400 0xc0800000 0x00003118 0x31180000 0x31183118 0x3e22f983 0xf9833e22 0x3e223e22 +EXPECT result IDX 256 EQ 0xf983f983 0x00003e22 0x0000f983 0xfffffffe 0xfffeffff 0x0014000c 0x0000c800 0xc8000000 +EXPECT result IDX 288 EQ 0xc800c800 0xc1000000 0x0000c100 0xc100c100 0x00004800 0x41000000 0x0000c400 0xc0800000 +EXPECT result IDX 320 EQ 0x00004400 0x40800000 0x0000c000 0xc0000000 0x00004000 0x40000000 0x0000bc00 0xbf800000 +EXPECT result IDX 352 EQ 0x00003c00 0x3f800000 0x0000cee8 0xcee80000 0xcee8cee8 0xc1de067d 0x067dc1de 0xc1dec1de +EXPECT result IDX 384 EQ 0x067d067d 0x0000c1de 0x0000067d 0x00010002 0x00020001 0xffecfff4 0x00010001 diff --git a/vulkan/amber/compute/pkadd-immediate.amber b/vulkan/amber/compute/pkadd-immediate.amber new file mode 100644 index 0000000..b6f4f3d --- /dev/null +++ b/vulkan/amber/compute/pkadd-immediate.amber @@ -0,0 +1,77 @@ +#!amber +# Copyright (c) 2024 The Khronos Group Inc. +# Copyright (c) 2024 AMD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Immediate/inline arguments to packed 16-bit operations might handled +# incorrectly in the compiler backend. + +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE shaderInt16 + +SHADER compute compute_shader GLSL +#version 460 +#extension GL_EXT_shader_16bit_storage : require +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require + +layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +struct Output { + i16vec2 nw; + i16vec2 n; + i16vec2 ne; + i16vec2 w; + i16vec2 e; + i16vec2 sw; + i16vec2 s; + i16vec2 se; +}; + +layout(set = 0, binding = 0) buffer Result { + Output arr[]; +} result; + +void main() { + ivec2 id32 = ivec2(gl_LocalInvocationID.xy); + i16vec2 id16 = i16vec2(gl_LocalInvocationID.xy); + + int idx = id32.y * 8 + id32.x; + + result.arr[idx].nw = id16 + i16vec2(-1s, 1s); + result.arr[idx].n = id16 + i16vec2( 0s, 1s); + result.arr[idx].ne = id16 + i16vec2( 1s, 1s); + result.arr[idx].w = id16 + i16vec2(-1s, 0s); + result.arr[idx].e = id16 + i16vec2( 1s, 0s); + result.arr[idx].sw = id16 + i16vec2(-1s, -1s); + result.arr[idx].s = id16 + i16vec2( 0s, -1s); + result.arr[idx].se = id16 + i16vec2( 1s, -1s); +} +END + +BUFFER result DATA_TYPE int16 SIZE 1024 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 1 1 1 + +# Amber bug and/or misleading behavior: index must be given in bytes +EXPECT result IDX 0 EQ -1 1 0 1 1 1 -1 0 1 0 -1 -1 0 -1 1 -1 +EXPECT result IDX 32 EQ 0 1 1 1 2 1 0 0 2 0 0 -1 1 -1 2 -1 +EXPECT result IDX 64 EQ 1 1 2 1 3 1 1 0 3 0 1 -1 2 -1 3 -1 +EXPECT result IDX 256 EQ -1 2 0 2 1 2 -1 1 1 1 -1 0 0 0 1 0 +EXPECT result IDX 288 EQ 0 2 1 2 2 2 0 1 2 1 0 0 1 0 2 0 diff --git a/vulkan/amber/compute/vec2_nclamp_nan_component.amber b/vulkan/amber/compute/vec2_nclamp_nan_component.amber new file mode 100644 index 0000000..70682f1 --- /dev/null +++ b/vulkan/amber/compute/vec2_nclamp_nan_component.amber @@ -0,0 +1,118 @@ +#!amber +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# The purpose of this test is to check the nan behavior of NClamp +# NClamp will be called on vec2(nan, 1.0) with the low=0.0 and high = 1.0 +# The y component of the vec2 will be checked and should remain 1.0 +# +# crbug.com/407109052 +# +# fn compute() -> f32 { +# var k = 0.0; +# var x = vec2(k/0.0, 1.0); +# var p = clamp(x, vec2(0), vec2(1)); +# return p.y; +# } +# +# @group(0) @binding(0) var _shader_output: array; +# +# @compute @workgroup_size(1) fn _computeSomething() { +# _shader_output[0] = compute(); +# } +# + +SHADER compute dawn_entry_point SPIRV-ASM +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 1 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_storage_buffer_storage_class" + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %_computeSomething "main" + OpExecutionMode %_computeSomething LocalSize 1 1 1 + OpMemberName %_shader_output_block_tint_explicit_layout 0 "inner" + OpName %_shader_output_block_tint_explicit_layout "_shader_output_block_tint_explicit_layout" + OpName %compute "compute" + OpName %k "k" + OpName %x "x" + OpName %p "p" + OpName %_computeSomething "_computeSomething" + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_shader_output_block_tint_explicit_layout 0 Offset 0 + OpDecorate %_shader_output_block_tint_explicit_layout Block + OpDecorate %1 DescriptorSet 0 + OpDecorate %1 Binding 0 + OpDecorate %1 Coherent + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float +%_shader_output_block_tint_explicit_layout = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__shader_output_block_tint_explicit_layout = OpTypePointer StorageBuffer %_shader_output_block_tint_explicit_layout + %1 = OpVariable %_ptr_StorageBuffer__shader_output_block_tint_explicit_layout StorageBuffer + %7 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %22 = OpConstantNull %v2float + %23 = OpConstantComposite %v2float %float_1 %float_1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %void = OpTypeVoid + %31 = OpTypeFunction %void +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %compute = OpFunction %float None %7 + %8 = OpLabel + %k = OpVariable %_ptr_Function_float Function + %x = OpVariable %_ptr_Function_v2float Function + %p = OpVariable %_ptr_Function_v2float Function + OpStore %k %float_0 + %12 = OpLoad %float %k None + %13 = OpFDiv %float %12 %float_0 + %15 = OpCompositeConstruct %v2float %13 %float_1 + OpStore %x %15 + %19 = OpLoad %v2float %x None + %20 = OpExtInst %v2float %21 NClamp %19 %22 %23 + OpStore %p %20 + %25 = OpAccessChain %_ptr_Function_float %p %uint_1 + %28 = OpLoad %float %25 None + OpReturnValue %28 + OpFunctionEnd +%_computeSomething = OpFunction %void None %31 + %32 = OpLabel + %33 = OpAccessChain %_ptr_StorageBuffer_float %1 %uint_0 %int_0 + %38 = OpFunctionCall %float %compute + OpStore %33 %38 None + OpReturn + OpFunctionEnd +END + +BUFFER buf_float DATA_TYPE float SIZE 1000 FILL 777.0 + +PIPELINE compute pipeline + ATTACH dawn_entry_point + BIND BUFFER buf_float AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 1 1 1 + +EXPECT buf_float IDX 0 EQ 1.0 diff --git a/vulkan/amber/compute/webgl_spirv_loop.amber b/vulkan/amber/compute/webgl_spirv_loop.amber new file mode 100644 index 0000000..2a28cee --- /dev/null +++ b/vulkan/amber/compute/webgl_spirv_loop.amber @@ -0,0 +1,89 @@ +#!amber +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %flow_block "flow_block" + OpMemberName %flow_block 0 "inner" + OpName %flow "flow" + OpName %main "main" + OpName %LOOP_COUNTER "LOOP_COUNTER" + OpDecorate %flow_block Block + OpMemberDecorate %flow_block 0 Offset 0 + OpDecorate %_arr_uint_uint_2 ArrayStride 4 + OpDecorate %flow DescriptorSet 0 + OpDecorate %flow Binding 0 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 + %flow_block = OpTypeStruct %_arr_uint_uint_2 +%_ptr_StorageBuffer_flow_block = OpTypePointer StorageBuffer %flow_block + %flow = OpVariable %_ptr_StorageBuffer_flow_block StorageBuffer + %void = OpTypeVoid + %7 = OpTypeFunction %void + %11 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %main = OpFunction %void None %7 + %10 = OpLabel +%LOOP_COUNTER = OpVariable %_ptr_Function_uint Function %11 + OpStore %LOOP_COUNTER %11 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %15 %16 None + OpBranch %17 + %17 = OpLabel + %20 = OpAccessChain %_ptr_StorageBuffer_uint %flow %uint_0 %11 + %21 = OpAccessChain %_ptr_StorageBuffer_uint %flow %uint_0 %11 + %22 = OpLoad %uint %21 + %24 = OpIAdd %uint %22 %uint_1 + OpStore %20 %24 + %25 = OpLoad %uint %LOOP_COUNTER + %26 = OpUGreaterThanEqual %bool %25 %uint_1 + OpSelectionMerge %28 None + OpBranchConditional %26 %29 %28 + %29 = OpLabel + %30 = OpAccessChain %_ptr_StorageBuffer_uint %flow %uint_0 %uint_1 + %31 = OpAccessChain %_ptr_StorageBuffer_uint %flow %uint_0 %uint_1 + %32 = OpLoad %uint %31 + %33 = OpIAdd %uint %32 %uint_1 + OpStore %30 %33 + OpBranch %15 + %28 = OpLabel + %34 = OpLoad %uint %LOOP_COUNTER + %35 = OpIAdd %uint %34 %uint_1 + OpStore %LOOP_COUNTER %35 + OpBranch %16 + %16 = OpLabel + OpBranch %14 + %15 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER buf0 DATA_TYPE uint32 DATA 0 0 END + +BUFFER expected0 DATA_TYPE uint32 DATA 2 1 END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER buf0 AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 1 1 1 + +#EXPECT buf0 IDX 0 EQ 2 +#EXPECT buf0 IDX 4 EQ 1 + +EXPECT buf0 EQ_BUFFER expected0 diff --git a/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_basic.amber b/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_basic.amber new file mode 100644 index 0000000..f2edf53 --- /dev/null +++ b/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_basic.amber @@ -0,0 +1,124 @@ +#!amber +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_spirv_1_4 +DEVICE_EXTENSION VK_KHR_workgroup_memory_explicit_layout + +SHADER compute compute_shader SPIRV-ASM + +OpCapability Shader +OpCapability WorkgroupMemoryExplicitLayoutKHR +OpExtension "SPV_KHR_workgroup_memory_explicit_layout" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %input_buffer_0 %input_buffer_1 %output_buffer %wg %half_wg_0 %half_wg_1 +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %buffer_type Block +OpDecorate %half_buffer_type Block +OpDecorate %other_half_buffer_type Block +OpMemberDecorate %buffer_type 0 Offset 0 +OpDecorate %array ArrayStride 4 +OpMemberDecorate %half_buffer_type 0 Offset 0 +OpMemberDecorate %other_half_buffer_type 0 Offset 64 +OpDecorate %half_array ArrayStride 4 +OpDecorate %input_buffer_0 DescriptorSet 0 +OpDecorate %input_buffer_0 Binding 0 +OpDecorate %input_buffer_1 DescriptorSet 0 +OpDecorate %input_buffer_1 Binding 1 +OpDecorate %output_buffer DescriptorSet 0 +OpDecorate %output_buffer Binding 2 +OpDecorate %wg Aliased +OpDecorate %half_wg_0 Aliased +OpDecorate %half_wg_1 Aliased + +%uint = OpTypeInt 32 0 +%const_uint_0 = OpConstant %uint 0 +%const_uint_16 = OpConstant %uint 16 +%const_uint_32 = OpConstant %uint 32 +%const_uint_64 = OpConstant %uint 64 + +%void = OpTypeVoid +%main_type = OpTypeFunction %void +%array = OpTypeArray %uint %const_uint_32 +%half_array = OpTypeArray %uint %const_uint_16 +%half_array_wg_ptr = OpTypePointer Workgroup %half_array +%half_array_sb_ptr = OpTypePointer StorageBuffer %half_array +%buffer_type = OpTypeStruct %array +%half_buffer_type = OpTypeStruct %half_array +%other_half_buffer_type = OpTypeStruct %half_array +%input_buffer_0_ptr = OpTypePointer StorageBuffer %half_buffer_type +%input_buffer_1_ptr = OpTypePointer StorageBuffer %half_buffer_type +%output_buffer_ptr = OpTypePointer StorageBuffer %buffer_type +%wg_ptr = OpTypePointer Workgroup %buffer_type +%half_wg_0_ptr = OpTypePointer Workgroup %half_buffer_type +%half_wg_1_ptr = OpTypePointer Workgroup %other_half_buffer_type + +;;; Workgroup has a block covering the entire memory and another two +;;; blocks covering each half of the former. + +%wg = OpVariable %wg_ptr Workgroup +%half_wg_0 = OpVariable %half_wg_0_ptr Workgroup +%half_wg_1 = OpVariable %half_wg_1_ptr Workgroup + +%input_buffer_0 = OpVariable %input_buffer_0_ptr StorageBuffer +%input_buffer_1 = OpVariable %input_buffer_1_ptr StorageBuffer +%output_buffer = OpVariable %output_buffer_ptr StorageBuffer + +%main = OpFunction %void None %main_type +%entry = OpLabel + +;;; Copy first input into half of the workgroup memory. Because the +;;; whole types match here, we can afford to copy the Variables +;;; directly. + +OpCopyMemory %half_wg_0 %input_buffer_0 + +;;; Then copy the second input into the other half of Workgroup +;;; memory, use OpAccessChain to extract the array pointers (what we +;;; are copying), since the whole types don't match (different Offsets +;;; in the block struct). + +%a = OpAccessChain %half_array_wg_ptr %half_wg_1 %const_uint_0 +%b = OpAccessChain %half_array_sb_ptr %input_buffer_1 %const_uint_0 +OpCopyMemory %a %b + +;;; The two halves of Workgroup memory were filled, now copy the large +;;; Workgroup block that alias the halves into the output. + +OpCopyMemory %output_buffer %wg + +OpReturn +OpFunctionEnd + +END + +BUFFER input_buffer_0 DATA_TYPE uint32 SIZE 16 SERIES_FROM 1 INC_BY 1 +BUFFER input_buffer_1 DATA_TYPE uint32 SIZE 16 SERIES_FROM 17 INC_BY 1 + +BUFFER output_buffer DATA_TYPE uint32 SIZE 32 FILL 99 + +BUFFER expected_buffer DATA_TYPE uint32 SIZE 32 SERIES_FROM 1 INC_BY 1 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER input_buffer_0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER input_buffer_1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN pipeline 1 1 1 + +EXPECT output_buffer EQ_BUFFER expected_buffer diff --git a/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_two_invocations.amber b/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_two_invocations.amber new file mode 100644 index 0000000..385f5f4 --- /dev/null +++ b/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_two_invocations.amber @@ -0,0 +1,180 @@ +#!amber +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_spirv_1_4 +DEVICE_EXTENSION VK_KHR_workgroup_memory_explicit_layout + +SHADER compute compute_shader SPIRV-ASM + +OpCapability Shader +OpCapability WorkgroupMemoryExplicitLayoutKHR +OpExtension "SPV_KHR_workgroup_memory_explicit_layout" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %index %push_constants %input_buffer_0 %input_buffer_1 %output_buffer %wg %half_wg_0 %half_wg_1 +OpExecutionMode %main LocalSize 32 4 1 + +OpDecorate %index BuiltIn LocalInvocationIndex +OpDecorate %buffer_type Block +OpDecorate %half_buffer_type Block +OpDecorate %other_half_buffer_type Block +OpMemberDecorate %buffer_type 0 Offset 0 +OpDecorate %array ArrayStride 4 +OpMemberDecorate %half_buffer_type 0 Offset 0 +OpMemberDecorate %other_half_buffer_type 0 Offset 64 +OpDecorate %half_array ArrayStride 4 +OpDecorate %input_buffer_0 DescriptorSet 0 +OpDecorate %input_buffer_0 Binding 0 +OpDecorate %input_buffer_1 DescriptorSet 0 +OpDecorate %input_buffer_1 Binding 1 +OpDecorate %output_buffer DescriptorSet 0 +OpDecorate %output_buffer Binding 2 +OpDecorate %wg Aliased +OpDecorate %half_wg_0 Aliased +OpDecorate %half_wg_1 Aliased +OpMemberDecorate %push_constants_type 0 Offset 0 +OpMemberDecorate %push_constants_type 1 Offset 4 +OpDecorate %push_constants_type Block + +%uint = OpTypeInt 32 0 +%const_uint_0 = OpConstant %uint 0 +%const_uint_1 = OpConstant %uint 1 +%const_uint_2 = OpConstant %uint 2 +%const_uint_16 = OpConstant %uint 16 +%const_uint_32 = OpConstant %uint 32 +%const_uint_64 = OpConstant %uint 64 +%const_uint_128 = OpConstant %uint 128 +%uint_input_ptr = OpTypePointer Input %uint +%uint_pc_ptr = OpTypePointer PushConstant %uint + +%bool = OpTypeBool +%void = OpTypeVoid +%main_type = OpTypeFunction %void +%array = OpTypeArray %uint %const_uint_32 +%half_array = OpTypeArray %uint %const_uint_16 +%half_array_wg_ptr = OpTypePointer Workgroup %half_array +%half_array_sb_ptr = OpTypePointer StorageBuffer %half_array +%buffer_type = OpTypeStruct %array +%half_buffer_type = OpTypeStruct %half_array +%other_half_buffer_type = OpTypeStruct %half_array +%input_buffer_0_ptr = OpTypePointer StorageBuffer %half_buffer_type +%input_buffer_1_ptr = OpTypePointer StorageBuffer %half_buffer_type +%output_buffer_ptr = OpTypePointer StorageBuffer %buffer_type +%wg_ptr = OpTypePointer Workgroup %buffer_type +%half_wg_0_ptr = OpTypePointer Workgroup %half_buffer_type +%half_wg_1_ptr = OpTypePointer Workgroup %other_half_buffer_type +%push_constants_type = OpTypeStruct %uint %uint +%push_constants_type_ptr = OpTypePointer PushConstant %push_constants_type + +;;; Workgroup has a block covering the entire memory and another two +;;; blocks covering each half of the former. + +%wg = OpVariable %wg_ptr Workgroup +%half_wg_0 = OpVariable %half_wg_0_ptr Workgroup +%half_wg_1 = OpVariable %half_wg_1_ptr Workgroup + +%input_buffer_0 = OpVariable %input_buffer_0_ptr StorageBuffer +%input_buffer_1 = OpVariable %input_buffer_1_ptr StorageBuffer +%output_buffer = OpVariable %output_buffer_ptr StorageBuffer + +%index = OpVariable %uint_input_ptr Input +%push_constants = OpVariable %push_constants_type_ptr PushConstant + +%main = OpFunction %void None %main_type +%entry = OpLabel + +;;; Look up in the push constants values a and b that will be use to select +;;; which invocation will do the work. + +%index_val = OpLoad %uint %index +%first_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_0 +%second_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_1 +%first = OpLoad %uint %first_ptr +%second = OpLoad %uint %second_ptr +%is_first = OpIEqual %bool %index_val %first +%is_second = OpIEqual %bool %index_val %second + +;;; Copy first input into half of the workgroup memory. Because the +;;; whole types match here, we can afford to copy the Variables +;;; directly. Only the first invocation specified will do that. + +OpSelectionMerge %after_first_copy None +OpBranchConditional %is_first %first_copy %after_first_copy +%first_copy = OpLabel + +OpCopyMemory %half_wg_0 %input_buffer_0 + +OpBranch %after_first_copy +%after_first_copy = OpLabel + +;;; Then copy the second input into the other half of Workgroup +;;; memory, use OpAccessChain to extract the array pointers (what we +;;; are copying), since the whole types don't match (different Offsets +;;; in the block struct). Only the second invocation specified will +;;; do that. + +OpSelectionMerge %after_second_copy None +OpBranchConditional %is_second %second_copy %after_second_copy +%second_copy = OpLabel + +%a = OpAccessChain %half_array_wg_ptr %half_wg_1 %const_uint_0 +%b = OpAccessChain %half_array_sb_ptr %input_buffer_1 %const_uint_0 +OpCopyMemory %a %b + +OpBranch %after_second_copy +%after_second_copy = OpLabel + +OpControlBarrier %const_uint_2 %const_uint_2 %const_uint_0 + +;;; The two halves of Workgroup memory were filled, now copy the large +;;; Workgroup block that alias the halves into the output. Only the first +;;; invocation specified will do that. + +OpSelectionMerge %after_third_copy None +OpBranchConditional %is_first %third_copy %after_third_copy +%third_copy = OpLabel + +OpCopyMemory %output_buffer %wg + +OpBranch %after_third_copy +%after_third_copy = OpLabel + +OpReturn +OpFunctionEnd + +END + +BUFFER input_buffer_0 DATA_TYPE uint32 SIZE 16 SERIES_FROM 1 INC_BY 1 +BUFFER input_buffer_1 DATA_TYPE uint32 SIZE 16 SERIES_FROM 17 INC_BY 1 + +BUFFER output_buffer DATA_TYPE uint32 SIZE 32 FILL 99 + +BUFFER expected_buffer DATA_TYPE uint32 SIZE 32 SERIES_FROM 1 INC_BY 1 + +BUFFER const_buf DATA_TYPE uint32 DATA +30 90 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER const_buf AS push_constant + BIND BUFFER input_buffer_0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER input_buffer_1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN pipeline 4 1 1 + +EXPECT output_buffer EQ_BUFFER expected_buffer diff --git a/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_variable_pointers.amber b/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_variable_pointers.amber new file mode 100644 index 0000000..18e84d5 --- /dev/null +++ b/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_variable_pointers.amber @@ -0,0 +1,202 @@ +#!amber +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE VariablePointerFeatures.variablePointers +DEVICE_EXTENSION VK_EXT_descriptor_indexing +DEVICE_EXTENSION VK_KHR_spirv_1_4 +DEVICE_EXTENSION VK_KHR_workgroup_memory_explicit_layout + +SHADER compute compute_shader SPIRV-ASM + +OpCapability Shader +OpCapability WorkgroupMemoryExplicitLayoutKHR +OpCapability VariablePointers +OpCapability ShaderNonUniform +OpExtension "SPV_KHR_workgroup_memory_explicit_layout" +OpExtension "SPV_EXT_descriptor_indexing" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %index %push_constants %input_buffer_0 %input_buffer_1 %output_buffer %wg %half_wg_0 %half_wg_1 +OpExecutionMode %main LocalSize 32 4 1 + +OpDecorate %index BuiltIn LocalInvocationIndex +OpDecorate %buffer_type Block +OpDecorate %half_buffer_type Block +OpDecorate %other_half_buffer_type Block +OpMemberDecorate %buffer_type 0 Offset 0 +OpDecorate %array ArrayStride 4 +OpMemberDecorate %half_buffer_type 0 Offset 0 +OpMemberDecorate %other_half_buffer_type 0 Offset 64 +OpDecorate %half_array ArrayStride 4 +OpDecorate %input_buffer_0 DescriptorSet 0 +OpDecorate %input_buffer_0 Binding 0 +OpDecorate %input_buffer_1 DescriptorSet 0 +OpDecorate %input_buffer_1 Binding 1 +OpDecorate %output_buffer DescriptorSet 0 +OpDecorate %output_buffer Binding 2 +OpDecorate %wg Aliased +OpDecorate %half_wg_0 Aliased +OpDecorate %half_wg_1 Aliased +OpMemberDecorate %push_constants_type 0 Offset 0 +OpMemberDecorate %push_constants_type 1 Offset 4 +OpDecorate %push_constants_type Block +OpDecorate %src NonUniform + +%uint = OpTypeInt 32 0 +%const_uint_0 = OpConstant %uint 0 +%const_uint_1 = OpConstant %uint 1 +%const_uint_2 = OpConstant %uint 2 +%const_uint_16 = OpConstant %uint 16 +%const_uint_32 = OpConstant %uint 32 +%const_uint_64 = OpConstant %uint 64 +%const_uint_128 = OpConstant %uint 128 +%uint_input_ptr = OpTypePointer Input %uint +%uint_pc_ptr = OpTypePointer PushConstant %uint + +%bool = OpTypeBool +%void = OpTypeVoid +%main_type = OpTypeFunction %void +%array = OpTypeArray %uint %const_uint_32 +%half_array = OpTypeArray %uint %const_uint_16 +%half_array_wg_ptr = OpTypePointer Workgroup %half_array +%half_array_sb_ptr = OpTypePointer StorageBuffer %half_array +%buffer_type = OpTypeStruct %array +%half_buffer_type = OpTypeStruct %half_array +%other_half_buffer_type = OpTypeStruct %half_array +%input_buffer_0_ptr = OpTypePointer StorageBuffer %half_buffer_type +%input_buffer_1_ptr = OpTypePointer StorageBuffer %half_buffer_type +%output_buffer_ptr = OpTypePointer StorageBuffer %buffer_type +%wg_ptr = OpTypePointer Workgroup %buffer_type +%half_wg_0_ptr = OpTypePointer Workgroup %half_buffer_type +%half_wg_1_ptr = OpTypePointer Workgroup %other_half_buffer_type +%push_constants_type = OpTypeStruct %uint %uint +%push_constants_type_ptr = OpTypePointer PushConstant %push_constants_type +%null_src = OpConstantNull %half_array_sb_ptr + +;;; Workgroup has a block covering the entire memory and another two +;;; blocks covering each half of the former. + +%wg = OpVariable %wg_ptr Workgroup +%half_wg_0 = OpVariable %half_wg_0_ptr Workgroup +%half_wg_1 = OpVariable %half_wg_1_ptr Workgroup + +%input_buffer_0 = OpVariable %input_buffer_0_ptr StorageBuffer +%input_buffer_1 = OpVariable %input_buffer_1_ptr StorageBuffer +%output_buffer = OpVariable %output_buffer_ptr StorageBuffer + +%index = OpVariable %uint_input_ptr Input +%push_constants = OpVariable %push_constants_type_ptr PushConstant + +%main = OpFunction %void None %main_type +%entry = OpLabel + +;;; Look up in the push constants values a and b that will be use to select +;;; which invocation will do the work. + +%index_val = OpLoad %uint %index +%first_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_0 +%second_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_1 +%first = OpLoad %uint %first_ptr +%second = OpLoad %uint %second_ptr +%is_first = OpIEqual %bool %index_val %first +%is_second = OpIEqual %bool %index_val %second +%is_first_or_second = OpLogicalOr %bool %is_first %is_second + +;;; Set the values for %dst using Select. + +%ptr_to_array_wg_0 = OpAccessChain %half_array_wg_ptr %half_wg_0 %const_uint_0 +%ptr_to_array_wg_1 = OpAccessChain %half_array_wg_ptr %half_wg_1 %const_uint_0 +%dst = OpSelect %half_array_wg_ptr %is_first %ptr_to_array_wg_0 %ptr_to_array_wg_1 + +;;; Set the values for %src using OpPhi. + +OpSelectionMerge %after_src_choice None +OpBranchConditional %is_first %src_for_first %next + +%src_for_first = OpLabel +%first_src = OpAccessChain %half_array_sb_ptr %input_buffer_0 %const_uint_0 +OpBranch %after_src_choice + +%next = OpLabel +OpSelectionMerge %merge_inner None +OpBranchConditional %is_second %src_for_second %src_is_null + +%src_for_second = OpLabel +%second_src = OpAccessChain %half_array_sb_ptr %input_buffer_1 %const_uint_0 +OpBranch %merge_inner + +%src_is_null = OpLabel +OpBranch %merge_inner + +%merge_inner = OpLabel +%inner_src = OpPhi %half_array_sb_ptr %second_src %src_for_second %null_src %src_is_null +OpBranch %after_src_choice + +%after_src_choice = OpLabel +%src = OpPhi %half_array_sb_ptr %first_src %src_for_first %inner_src %merge_inner + +;;; The first and second invocations identified will copy from src to +;;; dst. + +OpSelectionMerge %after_var_copy None +OpBranchConditional %is_first_or_second %var_copy %after_var_copy + +%var_copy = OpLabel +OpCopyMemory %dst %src +OpBranch %after_var_copy + +%after_var_copy = OpLabel + +OpControlBarrier %const_uint_2 %const_uint_2 %const_uint_0 + +;;; The two halves of Workgroup memory were filled, now copy the large +;;; Workgroup block that alias the halves into the output. Only the first +;;; invocation specified will do that. + +OpSelectionMerge %after_output_copy None +OpBranchConditional %is_first %output_copy %after_output_copy + +%output_copy = OpLabel +OpCopyMemory %output_buffer %wg +OpBranch %after_output_copy + +%after_output_copy = OpLabel +OpReturn +OpFunctionEnd + +END + +BUFFER input_buffer_0 DATA_TYPE uint32 SIZE 16 SERIES_FROM 1 INC_BY 1 +BUFFER input_buffer_1 DATA_TYPE uint32 SIZE 16 SERIES_FROM 17 INC_BY 1 + +BUFFER output_buffer DATA_TYPE uint32 SIZE 32 FILL 99 + +BUFFER expected_buffer DATA_TYPE uint32 SIZE 32 SERIES_FROM 1 INC_BY 1 + +BUFFER const_buf DATA_TYPE uint32 DATA +30 90 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER const_buf AS push_constant + BIND BUFFER input_buffer_0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER input_buffer_1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN pipeline 4 1 1 + +EXPECT output_buffer EQ_BUFFER expected_buffer diff --git a/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block.amber b/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block.amber new file mode 100644 index 0000000..a5ce320 --- /dev/null +++ b/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block.amber @@ -0,0 +1,106 @@ +#!amber +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_spirv_1_4 +DEVICE_EXTENSION VK_KHR_workgroup_memory_explicit_layout +DEVICE_EXTENSION VK_KHR_zero_initialize_workgroup_memory + +SHADER compute compute_shader SPIRV-ASM + +OpCapability Shader +OpCapability WorkgroupMemoryExplicitLayoutKHR +OpExtension "SPV_KHR_workgroup_memory_explicit_layout" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %index %push_constants %output_buffer %wg +OpExecutionMode %main LocalSize 32 4 1 + +OpDecorate %index BuiltIn LocalInvocationIndex +OpDecorate %buffer_type Block +OpMemberDecorate %buffer_type 0 Offset 0 +OpDecorate %array ArrayStride 4 +OpDecorate %output_buffer DescriptorSet 0 +OpDecorate %output_buffer Binding 1 +OpDecorate %wg Aliased +OpMemberDecorate %push_constants_type 0 Offset 0 +OpDecorate %push_constants_type Block + +%uint = OpTypeInt 32 0 +%const_uint_0 = OpConstant %uint 0 +%const_uint_32 = OpConstant %uint 32 +%uint_input_ptr = OpTypePointer Input %uint +%uint_pc_ptr = OpTypePointer PushConstant %uint + +%bool = OpTypeBool +%void = OpTypeVoid +%main_type = OpTypeFunction %void +%array = OpTypeArray %uint %const_uint_32 +%buffer_type = OpTypeStruct %array +%output_buffer_ptr = OpTypePointer StorageBuffer %buffer_type +%wg_ptr = OpTypePointer Workgroup %buffer_type +%push_constants_type = OpTypeStruct %uint +%push_constants_type_ptr = OpTypePointer PushConstant %push_constants_type +%null_buffer = OpConstantNull %buffer_type + +;;; Workgroup variable has a "null initializer". + +%wg = OpVariable %wg_ptr Workgroup %null_buffer +%output_buffer = OpVariable %output_buffer_ptr StorageBuffer + +%index = OpVariable %uint_input_ptr Input +%push_constants = OpVariable %push_constants_type_ptr PushConstant + +%main = OpFunction %void None %main_type +%entry = OpLabel + +;;; Look up in the push constant to select which invocation will do +;;; the work. + +%index_val = OpLoad %uint %index +%worker_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_0 +%worker = OpLoad %uint %worker_ptr +%is_worker = OpIEqual %bool %index_val %worker + +OpSelectionMerge %after_copy None +OpBranchConditional %is_worker %copy %after_copy +%copy = OpLabel + +OpCopyMemory %output_buffer %wg + +OpBranch %after_copy +%after_copy = OpLabel + +OpReturn +OpFunctionEnd + +END + +BUFFER output_buffer DATA_TYPE uint32 SIZE 32 FILL 99 + +BUFFER expected_buffer DATA_TYPE uint32 SIZE 32 FILL 0 + +BUFFER const_buf DATA_TYPE uint32 DATA +30 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER const_buf AS push_constant + BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 4 1 1 + +EXPECT output_buffer EQ_BUFFER expected_buffer diff --git a/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block_with_offset.amber b/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block_with_offset.amber new file mode 100644 index 0000000..377f666 --- /dev/null +++ b/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block_with_offset.amber @@ -0,0 +1,128 @@ +#!amber +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_spirv_1_4 +DEVICE_EXTENSION VK_KHR_workgroup_memory_explicit_layout +DEVICE_EXTENSION VK_KHR_zero_initialize_workgroup_memory + +SHADER compute compute_shader SPIRV-ASM + +OpCapability Shader +OpCapability WorkgroupMemoryExplicitLayoutKHR +OpExtension "SPV_KHR_workgroup_memory_explicit_layout" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %index %push_constants %output_buffer %wg %offset_wg +OpExecutionMode %main LocalSize 32 4 1 + +OpDecorate %index BuiltIn LocalInvocationIndex +OpDecorate %buffer_type Block +OpDecorate %offset_buffer_type Block +OpMemberDecorate %buffer_type 0 Offset 0 +OpMemberDecorate %offset_buffer_type 0 Offset 64 +OpDecorate %array ArrayStride 4 +OpDecorate %output_buffer DescriptorSet 0 +OpDecorate %output_buffer Binding 1 +OpDecorate %wg Aliased +OpDecorate %offset_wg Aliased +OpMemberDecorate %push_constants_type 0 Offset 0 +OpDecorate %push_constants_type Block + +%uint = OpTypeInt 32 0 +%const_uint_0 = OpConstant %uint 0 +%const_uint_32 = OpConstant %uint 32 +%uint_input_ptr = OpTypePointer Input %uint +%uint_pc_ptr = OpTypePointer PushConstant %uint + +%bool = OpTypeBool +%void = OpTypeVoid +%main_type = OpTypeFunction %void +%array = OpTypeArray %uint %const_uint_32 +%buffer_type = OpTypeStruct %array +%offset_buffer_type = OpTypeStruct %array +%output_buffer_ptr = OpTypePointer StorageBuffer %buffer_type +%wg_ptr = OpTypePointer Workgroup %buffer_type +%offset_wg_ptr = OpTypePointer Workgroup %offset_buffer_type +%push_constants_type = OpTypeStruct %uint +%push_constants_type_ptr = OpTypePointer PushConstant %push_constants_type +%null_offset_buffer = OpConstantNull %offset_buffer_type + +;;; One variable has a "null initializer" and the other not. + +%wg = OpVariable %wg_ptr Workgroup +%offset_wg = OpVariable %offset_wg_ptr Workgroup %null_offset_buffer +%output_buffer = OpVariable %output_buffer_ptr StorageBuffer + +%index = OpVariable %uint_input_ptr Input +%push_constants = OpVariable %push_constants_type_ptr PushConstant + +%main = OpFunction %void None %main_type +%entry = OpLabel + +;;; Look up in the push constant to select which invocation will do +;;; the work. + +%index_val = OpLoad %uint %index +%worker_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_0 +%worker = OpLoad %uint %worker_ptr +%is_worker = OpIEqual %bool %index_val %worker + +OpSelectionMerge %after_copy None +OpBranchConditional %is_worker %copy %after_copy +%copy = OpLabel + +;;; Copying variable to output. Because the aliasing at least half of +;;; it should be zero initialized. + +OpCopyMemory %output_buffer %wg + +OpBranch %after_copy +%after_copy = OpLabel + +OpReturn +OpFunctionEnd + +END + +BUFFER output_buffer DATA_TYPE uint32 SIZE 32 FILL 99 + +BUFFER const_buf DATA_TYPE uint32 DATA +30 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER const_buf AS push_constant + BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 4 1 1 + +EXPECT output_buffer IDX 64 EQ 0 +EXPECT output_buffer IDX 68 EQ 0 +EXPECT output_buffer IDX 72 EQ 0 +EXPECT output_buffer IDX 76 EQ 0 +EXPECT output_buffer IDX 80 EQ 0 +EXPECT output_buffer IDX 84 EQ 0 +EXPECT output_buffer IDX 88 EQ 0 +EXPECT output_buffer IDX 92 EQ 0 +EXPECT output_buffer IDX 96 EQ 0 +EXPECT output_buffer IDX 100 EQ 0 +EXPECT output_buffer IDX 104 EQ 0 +EXPECT output_buffer IDX 108 EQ 0 +EXPECT output_buffer IDX 112 EQ 0 +EXPECT output_buffer IDX 116 EQ 0 +EXPECT output_buffer IDX 120 EQ 0 +EXPECT output_buffer IDX 124 EQ 0 diff --git a/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_other_block.amber b/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_other_block.amber new file mode 100644 index 0000000..272174c --- /dev/null +++ b/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_other_block.amber @@ -0,0 +1,111 @@ +#!amber +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_spirv_1_4 +DEVICE_EXTENSION VK_KHR_workgroup_memory_explicit_layout +DEVICE_EXTENSION VK_KHR_zero_initialize_workgroup_memory + +SHADER compute compute_shader SPIRV-ASM + +OpCapability Shader +OpCapability WorkgroupMemoryExplicitLayoutKHR +OpExtension "SPV_KHR_workgroup_memory_explicit_layout" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %index %push_constants %output_buffer %wg %other_wg +OpExecutionMode %main LocalSize 32 4 1 + +OpDecorate %index BuiltIn LocalInvocationIndex +OpDecorate %buffer_type Block +OpMemberDecorate %buffer_type 0 Offset 0 +OpDecorate %array ArrayStride 4 +OpDecorate %output_buffer DescriptorSet 0 +OpDecorate %output_buffer Binding 1 +OpDecorate %wg Aliased +OpDecorate %other_wg Aliased +OpMemberDecorate %push_constants_type 0 Offset 0 +OpDecorate %push_constants_type Block + +%uint = OpTypeInt 32 0 +%const_uint_0 = OpConstant %uint 0 +%const_uint_32 = OpConstant %uint 32 +%uint_input_ptr = OpTypePointer Input %uint +%uint_pc_ptr = OpTypePointer PushConstant %uint + +%bool = OpTypeBool +%void = OpTypeVoid +%main_type = OpTypeFunction %void +%array = OpTypeArray %uint %const_uint_32 +%buffer_type = OpTypeStruct %array +%output_buffer_ptr = OpTypePointer StorageBuffer %buffer_type +%wg_ptr = OpTypePointer Workgroup %buffer_type +%push_constants_type = OpTypeStruct %uint +%push_constants_type_ptr = OpTypePointer PushConstant %push_constants_type +%null_buffer = OpConstantNull %buffer_type + +;;; One variable has a "null initializer" and the other not. + +%wg = OpVariable %wg_ptr Workgroup %null_buffer +%other_wg = OpVariable %wg_ptr Workgroup +%output_buffer = OpVariable %output_buffer_ptr StorageBuffer + +%index = OpVariable %uint_input_ptr Input +%push_constants = OpVariable %push_constants_type_ptr PushConstant + +%main = OpFunction %void None %main_type +%entry = OpLabel + +;;; Look up in the push constant to select which invocation will do +;;; the work. + +%index_val = OpLoad %uint %index +%worker_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_0 +%worker = OpLoad %uint %worker_ptr +%is_worker = OpIEqual %bool %index_val %worker + +OpSelectionMerge %after_copy None +OpBranchConditional %is_worker %copy %after_copy +%copy = OpLabel + +;;; Copying the other variable to output. Because the aliasing, it +;;; should be zero initalized too. + +OpCopyMemory %output_buffer %other_wg + +OpBranch %after_copy +%after_copy = OpLabel + +OpReturn +OpFunctionEnd + +END + +BUFFER output_buffer DATA_TYPE uint32 SIZE 32 FILL 99 + +BUFFER expected_buffer DATA_TYPE uint32 SIZE 32 FILL 0 + +BUFFER const_buf DATA_TYPE uint32 DATA +30 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER const_buf AS push_constant + BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 4 1 1 + +EXPECT output_buffer EQ_BUFFER expected_buffer diff --git a/vulkan/amber/compute/write_ssbo_array.amber b/vulkan/amber/compute/write_ssbo_array.amber new file mode 100644 index 0000000..b7c6c8c --- /dev/null +++ b/vulkan/amber/compute/write_ssbo_array.amber @@ -0,0 +1,53 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER compute compute_shader GLSL +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0) buffer block0 +{ + int data; +} ssbo_array[2]; + +void main() +{ + ssbo_array[0].data++; + ssbo_array[0].data++; + ssbo_array[0].data++; + + ssbo_array[1].data++; + ssbo_array[1].data++; +} +END + +BUFFER buf0 DATA_TYPE int32 DATA +0 +END + +BUFFER buf1 DATA_TYPE int32 DATA +0 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER_ARRAY buf0 buf1 AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 1 1 1 + +EXPECT buf0 IDX 0 EQ 3 +EXPECT buf1 IDX 0 EQ 2 diff --git a/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_128.amber b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_128.amber new file mode 100644 index 0000000..b3a34f5 --- /dev/null +++ b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_128.amber @@ -0,0 +1,55 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_zero_initialize_workgroup_memory + +SHADER compute compute_shader GLSL TARGET_ENV spv1.3 +#version 450 +#extension GL_EXT_null_initializer : enable + +layout(local_size_x = 128) in; +layout(set = 0, binding = 0) buffer A +{ + uint a[]; +} a; + +shared uint wg_mem = {}; + +void main() +{ + uint idx = gl_LocalInvocationID.x; + + if (gl_LocalInvocationIndex == 0) + { + wg_mem = 1; + } + + barrier(); + a.a[idx] = wg_mem; +} +END + +BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99 +BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 1 1 1 + +EXPECT result_buffer EQ_BUFFER reference_buffer \ No newline at end of file diff --git a/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_2x8x8.amber b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_2x8x8.amber new file mode 100644 index 0000000..a299f9e --- /dev/null +++ b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_2x8x8.amber @@ -0,0 +1,59 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_zero_initialize_workgroup_memory + +SHADER compute compute_shader GLSL TARGET_ENV spv1.3 +#version 450 +#extension GL_EXT_null_initializer : enable + +layout(local_size_x = 2, local_size_y = 8, local_size_z = 8) in; +layout(set = 0, binding = 0) buffer A +{ + uint a[]; +} a; + +shared uint wg_mem = {}; + +void main() +{ + uint idx_z = gl_LocalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y; + uint idx_y = gl_LocalInvocationID.y * gl_WorkGroupSize.x; + uint idx_x = gl_LocalInvocationID.x; + uint idx = idx_x + idx_y + idx_z; + + if (gl_LocalInvocationIndex == 0) + { + wg_mem = 1; + } + + barrier(); + + a.a[idx] = wg_mem; +} +END + +BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99 +BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 1 1 1 + +EXPECT result_buffer EQ_BUFFER reference_buffer \ No newline at end of file diff --git a/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_4x4x8.amber b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_4x4x8.amber new file mode 100644 index 0000000..c126a92 --- /dev/null +++ b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_4x4x8.amber @@ -0,0 +1,59 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_zero_initialize_workgroup_memory + +SHADER compute compute_shader GLSL TARGET_ENV spv1.3 +#version 450 +#extension GL_EXT_null_initializer : enable + +layout(local_size_x = 4, local_size_y = 4, local_size_z = 8) in; +layout(set = 0, binding = 0) buffer A +{ + uint a[]; +} a; + +shared uint wg_mem = {}; + +void main() +{ + uint idx_z = gl_LocalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y; + uint idx_y = gl_LocalInvocationID.y * gl_WorkGroupSize.x; + uint idx_x = gl_LocalInvocationID.x; + uint idx = idx_x + idx_y + idx_z; + + if (gl_LocalInvocationIndex == 0) + { + wg_mem = 1; + } + + barrier(); + + a.a[idx] = wg_mem; +} +END + +BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99 +BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 1 1 1 + +EXPECT result_buffer EQ_BUFFER reference_buffer \ No newline at end of file diff --git a/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_4x8x4.amber b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_4x8x4.amber new file mode 100644 index 0000000..912f1cc --- /dev/null +++ b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_4x8x4.amber @@ -0,0 +1,59 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_zero_initialize_workgroup_memory + +SHADER compute compute_shader GLSL TARGET_ENV spv1.3 +#version 450 +#extension GL_EXT_null_initializer : enable + +layout(local_size_x = 4, local_size_y = 8, local_size_z = 4) in; +layout(set = 0, binding = 0) buffer A +{ + uint a[]; +} a; + +shared uint wg_mem = {}; + +void main() +{ + uint idx_z = gl_LocalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y; + uint idx_y = gl_LocalInvocationID.y * gl_WorkGroupSize.x; + uint idx_x = gl_LocalInvocationID.x; + uint idx = idx_x + idx_y + idx_z; + + if (gl_LocalInvocationIndex == 0) + { + wg_mem = 1; + } + + barrier(); + + a.a[idx] = wg_mem; +} +END + +BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99 +BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 1 1 1 + +EXPECT result_buffer EQ_BUFFER reference_buffer \ No newline at end of file diff --git a/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_8x2x8.amber b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_8x2x8.amber new file mode 100644 index 0000000..e0e59d6 --- /dev/null +++ b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_8x2x8.amber @@ -0,0 +1,59 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_zero_initialize_workgroup_memory + +SHADER compute compute_shader GLSL TARGET_ENV spv1.3 +#version 450 +#extension GL_EXT_null_initializer : enable + +layout(local_size_x = 8, local_size_y = 2, local_size_z = 8) in; +layout(set = 0, binding = 0) buffer A +{ + uint a[]; +} a; + +shared uint wg_mem = {}; + +void main() +{ + uint idx_z = gl_LocalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y; + uint idx_y = gl_LocalInvocationID.y * gl_WorkGroupSize.x; + uint idx_x = gl_LocalInvocationID.x; + uint idx = idx_x + idx_y + idx_z; + + if (gl_LocalInvocationIndex == 0) + { + wg_mem = 1; + } + + barrier(); + + a.a[idx] = wg_mem; +} +END + +BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99 +BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 1 1 1 + +EXPECT result_buffer EQ_BUFFER reference_buffer \ No newline at end of file diff --git a/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_8x4x4.amber b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_8x4x4.amber new file mode 100644 index 0000000..0c5ab6b --- /dev/null +++ b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_8x4x4.amber @@ -0,0 +1,59 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_zero_initialize_workgroup_memory + +SHADER compute compute_shader GLSL TARGET_ENV spv1.3 +#version 450 +#extension GL_EXT_null_initializer : enable + +layout(local_size_x = 8, local_size_y = 4, local_size_z = 4) in; +layout(set = 0, binding = 0) buffer A +{ + uint a[]; +} a; + +shared uint wg_mem = {}; + +void main() +{ + uint idx_z = gl_LocalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y; + uint idx_y = gl_LocalInvocationID.y * gl_WorkGroupSize.x; + uint idx_x = gl_LocalInvocationID.x; + uint idx = idx_x + idx_y + idx_z; + + if (gl_LocalInvocationIndex == 0) + { + wg_mem = 1; + } + + barrier(); + + a.a[idx] = wg_mem; +} +END + +BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99 +BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 1 1 1 + +EXPECT result_buffer EQ_BUFFER reference_buffer \ No newline at end of file diff --git a/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_8x8x2.amber b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_8x8x2.amber new file mode 100644 index 0000000..9a8fff2 --- /dev/null +++ b/vulkan/amber/compute/zero_initialize_workgroup_memory/workgroup_size_8x8x2.amber @@ -0,0 +1,59 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_zero_initialize_workgroup_memory + +SHADER compute compute_shader GLSL TARGET_ENV spv1.3 +#version 450 +#extension GL_EXT_null_initializer : enable + +layout(local_size_x = 8, local_size_y = 8, local_size_z = 2) in; +layout(set = 0, binding = 0) buffer A +{ + uint a[]; +} a; + +shared uint wg_mem = {}; + +void main() +{ + uint idx_z = gl_LocalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y; + uint idx_y = gl_LocalInvocationID.y * gl_WorkGroupSize.x; + uint idx_x = gl_LocalInvocationID.x; + uint idx = idx_x + idx_y + idx_z; + + if (gl_LocalInvocationIndex == 0) + { + wg_mem = 1; + } + + barrier(); + + a.a[idx] = wg_mem; +} +END + +BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99 +BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 1 1 1 + +EXPECT result_buffer EQ_BUFFER reference_buffer \ No newline at end of file diff --git a/vulkan/amber/crash_test/divbyzero_comp.amber b/vulkan/amber/crash_test/divbyzero_comp.amber new file mode 100644 index 0000000..ffea513 --- /dev/null +++ b/vulkan/amber/crash_test/divbyzero_comp.amber @@ -0,0 +1,87 @@ +#!amber +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER compute compute_shader GLSL +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0) buffer block0 +{ + int data[20]; +} ssbo; + +void main() +{ + // Zero constants + int ival = ssbo.data[0]; + float val = float(ival); + + // int div + ssbo.data[1] = 7 / ival; + // float div + ssbo.data[2] = int(7.0 / val); + // normalize float + ssbo.data[3] = int(normalize(val)); + // normalize vec2 + ssbo.data[4] = int(normalize(vec2(val))[ival]); + // normalize vec3 + ssbo.data[5] = int(normalize(vec3(val))[ival]); + // normalize vec4 + ssbo.data[6] = int(normalize(vec4(val))[ival]); + // integer mod + ssbo.data[7] = 7 % ival; + // float mod + ssbo.data[8] = int(mod(7.0, val)); + // vec2 mod + ssbo.data[9] = int(mod(vec2(7.0), vec2(val))[ival]); + // vec3 mod + ssbo.data[10] = int(mod(vec3(7.0), vec3(val))[ival]); + // vec4 mod + ssbo.data[11] = int(mod(vec4(7.0), vec4(val))[ival]); + // float smoothstep + ssbo.data[12] = int(smoothstep(val, val, 0.3)); + // vec2 smoothstep + ssbo.data[13] = int(smoothstep(vec2(val), vec2(val), vec2(0.3))[ival]); + // vec3 smoothstep + ssbo.data[14] = int(smoothstep(vec3(val), vec3(val), vec3(0.3))[ival]); + // vec4 smoothstep + ssbo.data[15] = int(smoothstep(vec4(val), vec4(val), vec4(0.3))[ival]); + // float atan2 + ssbo.data[16] = int(atan(7.0, val)); + // vec2 atan2 + ssbo.data[17] = int(atan(vec2(7.0), vec2(val))[ival]); + // vec3 atan2 + ssbo.data[18] = int(atan(vec3(7.0), vec3(val))[ival]); + // vec4 atan2 + ssbo.data[19] = int(atan(vec4(7.0), vec4(val))[ival]); + + // Known good value + ssbo.data[0] = 42; +} +END + +BUFFER ssbo_buffer DATA_TYPE int32 DATA +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER ssbo_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 1 1 1 + +EXPECT ssbo_buffer IDX 0 EQ 42 diff --git a/vulkan/amber/crash_test/divbyzero_frag.amber b/vulkan/amber/crash_test/divbyzero_frag.amber new file mode 100644 index 0000000..df496e4 --- /dev/null +++ b/vulkan/amber/crash_test/divbyzero_frag.amber @@ -0,0 +1,136 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Division by zero test. Specification states: +# +# "Some calculations require division. In such cases (including implied divisions performed by +# vector normalization), division by zero produces an unspecified result but must not lead to +# Vulkan interruption or termination." +# +# This test performs various divisions (both implicit and explicit) and succeeds if it doesn't crash. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() { + ivec4 ifragcoord = ivec4(gl_FragCoord); + vec4 fragcoord = vec4(ifragcoord); + // Generate one pixel we can be certain about + if (ifragcoord.x == 0 && ifragcoord.y == 0) + { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + } + else + { + // Generate sweep of values which hit 0 as divisor. + // When ifragcoord.y hits 8, the integer case becomes "7 / (8 - 8)" + switch(ifragcoord.x % 32) + { + case 0: + // int div + color_out = vec4(7 / (ifragcoord.y - 8), 1.0, 0.0, 1.0); + break; + case 1: + // float div + color_out = vec4(7 / (fragcoord.y - 8.0), 1.0, 0.0, 1.0); + break; + case 2: + // normalize float + color_out = vec4(normalize(fragcoord.y - 8.0), 1.0, 0.0, 1.0); + break; + case 3: + // normalize vec2 + color_out = vec4(normalize(fragcoord.yy - vec2(8.0)), 0.0, 1.0); + break; + case 4: + // normalize vec3 + color_out = vec4(normalize(fragcoord.yyy - vec3(8.0)), 1.0); + break; + case 5: + // normalize vec4 + color_out = normalize(fragcoord.yyyy - vec4(8.0)); + break; + case 6: + // integer mod + color_out = vec4((7 % (ifragcoord.y - 8)), 1.0, 0.0, 1.0); + break; + case 7: + // float mod + color_out = vec4(mod(7.0, (fragcoord.y - 8.0)), 1.0, 0.0, 1.0); + break; + case 8: + // vec2 mod + color_out = vec4(mod(vec2(7.0), (fragcoord.yy - vec2(8.0))), 0.0, 1.0); + break; + case 9: + // vec3 mod + color_out = vec4(mod(vec3(7.0), (fragcoord.yyy - vec3(8.0))), 1.0); + break; + case 10: + // vec4 mod + color_out = mod(vec4(7.0), (fragcoord.yyyy - vec4(8.0))); + break; + case 11: + // float smoothstep + color_out = vec4(smoothstep(7.0, (fragcoord.y - 8.0), 0.3), 1.0, 0.0, 1.0); + break; + case 12: + // vec2 smoothstep + color_out = vec4(smoothstep(vec2(7.0), vec2(fragcoord.y - 8.0), vec2(0.3)), 0.0, 1.0); + break; + case 13: + // vec3 smoothstep + color_out = vec4(smoothstep(vec3(7.0), vec3(fragcoord.y - 8.0), vec3(0.3)), 1.0); + break; + case 14: + // vec4 smoothstep + color_out = smoothstep(vec4(7.0), vec4(fragcoord.y - 8.0), vec4(0.3)); + break; + case 15: + // float atan2 + color_out = vec4(atan(7.0, (fragcoord.y - 8.0)), 1.0, 0.0, 1.0); + break; + case 16: + // vec2 atan2 + color_out = vec4(atan(vec2(7.0), (fragcoord.yy - vec2(8.0))), 0.0, 1.0); + break; + case 17: + // vec3 atan2 + color_out = vec4(atan(vec3(7.0), (fragcoord.yyy - vec3(8.0))), 1.0); + break; + case 18: + // vec4 atan2 + color_out = atan(vec4(7.0), (fragcoord.yyyy - vec4(8.0))); + break; + default: + color_out = vec4(0.0, 0.0, 1.0, 1.0); + } + } +} +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 32 32 +# Check that the pixel we expect is fine +EXPECT framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/crash_test/divbyzero_geom.amber b/vulkan/amber/crash_test/divbyzero_geom.amber new file mode 100644 index 0000000..5572ad9 --- /dev/null +++ b/vulkan/amber/crash_test/divbyzero_geom.amber @@ -0,0 +1,126 @@ +#!amber +# Copyright 2022 Google LLC +# Copyright 2022 LunarG, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE geometryShader + +SHADER vertex vert_shader PASSTHROUGH + +SHADER geometry geom_shader GLSL +#version 450 + +layout (triangles) in; +layout (triangle_strip, max_vertices = 3) out; +in gl_PerVertex { vec4 gl_Position; float gl_PointSize; float gl_ClipDistance[]; } gl_in[]; + +layout(set = 0, binding = 0) buffer block0 +{ + int data[20]; +} ssbo; + +void main(void) +{ + // Only want to perform these operations once + if(gl_InvocationID == 0) + { + // Zero constants + int ival = ssbo.data[0]; + float val = float(ival); + + // int div + ssbo.data[1] = 7 / ival; + // float div + ssbo.data[2] = int(7.0 / val); + // normalize float + ssbo.data[3] = int(normalize(val)); + // normalize vec2 + ssbo.data[4] = int(normalize(vec2(val))[ival]); + // normalize vec3 + ssbo.data[5] = int(normalize(vec3(val))[ival]); + // normalize vec4 + ssbo.data[6] = int(normalize(vec4(val))[ival]); + // integer mod + ssbo.data[7] = 7 % ival; + // float mod + ssbo.data[8] = int(mod(7.0, val)); + // vec2 mod + ssbo.data[9] = int(mod(vec2(7.0), vec2(val))[ival]); + // vec3 mod + ssbo.data[10] = int(mod(vec3(7.0), vec3(val))[ival]); + // vec4 mod + ssbo.data[11] = int(mod(vec4(7.0), vec4(val))[ival]); + // float smoothstep + ssbo.data[12] = int(smoothstep(val, val, 0.3)); + // vec2 smoothstep + ssbo.data[13] = int(smoothstep(vec2(val), vec2(val), vec2(0.3))[ival]); + // vec3 smoothstep + ssbo.data[14] = int(smoothstep(vec3(val), vec3(val), vec3(0.3))[ival]); + // vec4 smoothstep + ssbo.data[15] = int(smoothstep(vec4(val), vec4(val), vec4(0.3))[ival]); + // float atan2 + ssbo.data[16] = int(atan(7.0, val)); + // vec2 atan2 + ssbo.data[17] = int(atan(vec2(7.0), vec2(val))[ival]); + // vec3 atan2 + ssbo.data[18] = int(atan(vec3(7.0), vec3(val))[ival]); + // vec4 atan2 + ssbo.data[19] = int(atan(vec4(7.0), vec4(val))[ival]); + + // Known good value + ssbo.data[0] = 42; + } + + gl_Position = gl_in[0].gl_Position; + EmitVertex(); + + gl_Position = gl_in[1].gl_Position; + EmitVertex(); + + gl_Position = gl_in[2].gl_Position; + EmitVertex(); + + EndPrimitive(); +} +END + +SHADER fragment frag_shader GLSL +#version 450 + +layout (location = 0) out vec4 outColor; + +void main(void) +{ + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER ssbo_buffer DATA_TYPE int32 DATA +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +END + +BUFFER framebuffer FORMAT R8G8B8A8_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH geom_shader + ATTACH frag_shader + + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER ssbo_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT ssbo_buffer IDX 0 EQ 42 \ No newline at end of file diff --git a/vulkan/amber/crash_test/divbyzero_tesc.amber b/vulkan/amber/crash_test/divbyzero_tesc.amber new file mode 100644 index 0000000..5a1e34b --- /dev/null +++ b/vulkan/amber/crash_test/divbyzero_tesc.amber @@ -0,0 +1,146 @@ +#!amber +# Copyright 2022 Google LLC +# Copyright 2022 LunarG, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE tessellationShader + +SHADER vertex vert_shader PASSTHROUGH + +SHADER tessellation_control tesc_shader GLSL +#version 450 + +layout (vertices = 3) out; +in gl_PerVertex { vec4 gl_Position; float gl_PointSize; float gl_ClipDistance[]; } gl_in[gl_MaxPatchVertices]; + +layout(set = 0, binding = 0) buffer block0 +{ + int data[20]; +} ssbo; + +void main(void) +{ + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; + + // Only want to perform these operations once + if(gl_InvocationID == 0) + { + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 1.0; + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 1.0; + gl_TessLevelOuter[2] = 1.0; + + // Zero constants + int ival = ssbo.data[0]; + float val = float(ival); + + // int div + ssbo.data[1] = 7 / ival; + // float div + ssbo.data[2] = int(7.0 / val); + // normalize float + ssbo.data[3] = int(normalize(val)); + // normalize vec2 + ssbo.data[4] = int(normalize(vec2(val))[ival]); + // normalize vec3 + ssbo.data[5] = int(normalize(vec3(val))[ival]); + // normalize vec4 + ssbo.data[6] = int(normalize(vec4(val))[ival]); + // integer mod + ssbo.data[7] = 7 % ival; + // float mod + ssbo.data[8] = int(mod(7.0, val)); + // vec2 mod + ssbo.data[9] = int(mod(vec2(7.0), vec2(val))[ival]); + // vec3 mod + ssbo.data[10] = int(mod(vec3(7.0), vec3(val))[ival]); + // vec4 mod + ssbo.data[11] = int(mod(vec4(7.0), vec4(val))[ival]); + // float smoothstep + ssbo.data[12] = int(smoothstep(val, val, 0.3)); + // vec2 smoothstep + ssbo.data[13] = int(smoothstep(vec2(val), vec2(val), vec2(0.3))[ival]); + // vec3 smoothstep + ssbo.data[14] = int(smoothstep(vec3(val), vec3(val), vec3(0.3))[ival]); + // vec4 smoothstep + ssbo.data[15] = int(smoothstep(vec4(val), vec4(val), vec4(0.3))[ival]); + // float atan2 + ssbo.data[16] = int(atan(7.0, val)); + // vec2 atan2 + ssbo.data[17] = int(atan(vec2(7.0), vec2(val))[ival]); + // vec3 atan2 + ssbo.data[18] = int(atan(vec3(7.0), vec3(val))[ival]); + // vec4 atan2 + ssbo.data[19] = int(atan(vec4(7.0), vec4(val))[ival]); + + // Known good value + ssbo.data[0] = 42; + } +} +END + +SHADER tessellation_evaluation tese_shader GLSL +#version 450 + +layout (triangles, equal_spacing, cw) in; + +void main(void) +{ + gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position) + + (gl_TessCoord.y * gl_in[1].gl_Position) + + (gl_TessCoord.z * gl_in[2].gl_Position); +} +END + +SHADER fragment frag_shader GLSL +#version 450 + +layout (location = 0) out vec4 outColor; + +void main(void) +{ + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER vertexPosition DATA_TYPE vec3 DATA +-0.50 -0.50 0.0 + 0.50 -0.50 0.0 + 0.50 0.50 0.0 + 0.50 0.50 0.0 +-0.50 0.50 0.0 +-0.50 -0.50 0.0 +END + +BUFFER ssbo_buffer DATA_TYPE int32 DATA +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +END + +BUFFER framebuffer FORMAT R8G8B8A8_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertexPosition LOCATION 0 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER ssbo_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN my_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6 + +EXPECT ssbo_buffer IDX 0 EQ 42 \ No newline at end of file diff --git a/vulkan/amber/crash_test/divbyzero_tese.amber b/vulkan/amber/crash_test/divbyzero_tese.amber new file mode 100644 index 0000000..6186d67 --- /dev/null +++ b/vulkan/amber/crash_test/divbyzero_tese.amber @@ -0,0 +1,149 @@ +#!amber +# Copyright 2022 Google LLC +# Copyright 2022 LunarG, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE tessellationShader + +SHADER vertex vert_shader PASSTHROUGH + +SHADER tessellation_control tesc_shader GLSL +#version 450 + +layout (vertices = 3) out; +in gl_PerVertex { vec4 gl_Position; float gl_PointSize; float gl_ClipDistance[]; } gl_in[gl_MaxPatchVertices]; + +void main(void) +{ + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; + + if(gl_InvocationID == 0) + { + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 1.0; + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 1.0; + gl_TessLevelOuter[2] = 1.0; + } +} +END + +SHADER tessellation_evaluation tese_shader GLSL +#version 450 + +layout (triangles, equal_spacing, cw) in; + +layout(set = 0, binding = 0) buffer block0 +{ + int data[20]; +} ssbo; + +void main(void) +{ + gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position) + + (gl_TessCoord.y * gl_in[1].gl_Position) + + (gl_TessCoord.z * gl_in[2].gl_Position); + + // Only want to perform these operations once + if(gl_Position.x == 0.5f && gl_Position.y == -0.5f) + { + // Zero constants + int ival = ssbo.data[0]; + float val = float(ival); + + // int div + ssbo.data[1] = 7 / ival; + // float div + ssbo.data[2] = int(7.0 / val); + // normalize float + ssbo.data[3] = int(normalize(val)); + // normalize vec2 + ssbo.data[4] = int(normalize(vec2(val))[ival]); + // normalize vec3 + ssbo.data[5] = int(normalize(vec3(val))[ival]); + // normalize vec4 + ssbo.data[6] = int(normalize(vec4(val))[ival]); + // integer mod + ssbo.data[7] = 7 % ival; + // float mod + ssbo.data[8] = int(mod(7.0, val)); + // vec2 mod + ssbo.data[9] = int(mod(vec2(7.0), vec2(val))[ival]); + // vec3 mod + ssbo.data[10] = int(mod(vec3(7.0), vec3(val))[ival]); + // vec4 mod + ssbo.data[11] = int(mod(vec4(7.0), vec4(val))[ival]); + // float smoothstep + ssbo.data[12] = int(smoothstep(val, val, 0.3)); + // vec2 smoothstep + ssbo.data[13] = int(smoothstep(vec2(val), vec2(val), vec2(0.3))[ival]); + // vec3 smoothstep + ssbo.data[14] = int(smoothstep(vec3(val), vec3(val), vec3(0.3))[ival]); + // vec4 smoothstep + ssbo.data[15] = int(smoothstep(vec4(val), vec4(val), vec4(0.3))[ival]); + // float atan2 + ssbo.data[16] = int(atan(7.0, val)); + // vec2 atan2 + ssbo.data[17] = int(atan(vec2(7.0), vec2(val))[ival]); + // vec3 atan2 + ssbo.data[18] = int(atan(vec3(7.0), vec3(val))[ival]); + // vec4 atan2 + ssbo.data[19] = int(atan(vec4(7.0), vec4(val))[ival]); + + // Known good value + ssbo.data[0] = 42; + } +} +END + +SHADER fragment frag_shader GLSL +#version 450 + +layout (location = 0) out vec4 outColor; + +void main(void) +{ + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER vertexPosition DATA_TYPE vec3 DATA +-0.50 -0.50 0.0 + 0.50 -0.50 0.0 + 0.50 0.50 0.0 + 0.50 0.50 0.0 +-0.50 0.50 0.0 +-0.50 -0.50 0.0 +END + +BUFFER ssbo_buffer DATA_TYPE int32 DATA +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +END + +BUFFER framebuffer FORMAT R8G8B8A8_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertexPosition LOCATION 0 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER ssbo_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN my_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6 + +EXPECT ssbo_buffer IDX 0 EQ 42 \ No newline at end of file diff --git a/vulkan/amber/crash_test/divbyzero_vert.amber b/vulkan/amber/crash_test/divbyzero_vert.amber new file mode 100644 index 0000000..2443ffb --- /dev/null +++ b/vulkan/amber/crash_test/divbyzero_vert.amber @@ -0,0 +1,106 @@ +#!amber +# Copyright 2022 Google LLC +# Copyright 2022 LunarG, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 450 +layout(location = 0) in vec2 vertex_position; + +layout(set = 0, binding = 0) buffer block0 +{ + int data[20]; +} ssbo; + +void main() +{ + gl_Position = vec4(vertex_position, 0.0f, 1.0f); + + // Only want to perform these operations once + if(gl_VertexIndex == 0) + { + // Zero constants + int ival = ssbo.data[0]; + float val = float(ival); + + // int div + ssbo.data[1] = 7 / ival; + // float div + ssbo.data[2] = int(7.0 / val); + // normalize float + ssbo.data[3] = int(normalize(val)); + // normalize vec2 + ssbo.data[4] = int(normalize(vec2(val))[ival]); + // normalize vec3 + ssbo.data[5] = int(normalize(vec3(val))[ival]); + // normalize vec4 + ssbo.data[6] = int(normalize(vec4(val))[ival]); + // integer mod + ssbo.data[7] = 7 % ival; + // float mod + ssbo.data[8] = int(mod(7.0, val)); + // vec2 mod + ssbo.data[9] = int(mod(vec2(7.0), vec2(val))[ival]); + // vec3 mod + ssbo.data[10] = int(mod(vec3(7.0), vec3(val))[ival]); + // vec4 mod + ssbo.data[11] = int(mod(vec4(7.0), vec4(val))[ival]); + // float smoothstep + ssbo.data[12] = int(smoothstep(val, val, 0.3)); + // vec2 smoothstep + ssbo.data[13] = int(smoothstep(vec2(val), vec2(val), vec2(0.3))[ival]); + // vec3 smoothstep + ssbo.data[14] = int(smoothstep(vec3(val), vec3(val), vec3(0.3))[ival]); + // vec4 smoothstep + ssbo.data[15] = int(smoothstep(vec4(val), vec4(val), vec4(0.3))[ival]); + // float atan2 + ssbo.data[16] = int(atan(7.0, val)); + // vec2 atan2 + ssbo.data[17] = int(atan(vec2(7.0), vec2(val))[ival]); + // vec3 atan2 + ssbo.data[18] = int(atan(vec3(7.0), vec3(val))[ival]); + // vec4 atan2 + ssbo.data[19] = int(atan(vec4(7.0), vec4(val))[ival]); + + // Known good value + ssbo.data[0] = 42; + } +} +END + + +SHADER fragment frag_shader GLSL +#version 450 +layout(location = 0) out vec4 color_out; +void main() { + color_out = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER ssbo_buffer DATA_TYPE int32 DATA +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER ssbo_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT ssbo_buffer IDX 0 EQ 42 diff --git a/vulkan/amber/depth/bias_fs_clamp.amber b/vulkan/amber/depth/bias_fs_clamp.amber new file mode 100644 index 0000000..e24a8d2 --- /dev/null +++ b/vulkan/amber/depth/bias_fs_clamp.amber @@ -0,0 +1,76 @@ +#!amber +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE DepthClampZeroOneFeatures.depthClampZeroOne +DEVICE_FEATURE depthClamp +DEVICE_FEATURE fragmentStoresAndAtomics + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; + +void main() +{ + gl_Position = vec4(position_in, 2, 1); +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout (binding=0) buffer B { + float d; +}; + +layout(location = 0) out highp vec4 frag_out; +void main() +{ + d = gl_FragCoord.z; + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM +BUFFER depth0 FORMAT D32_SFLOAT + +BUFFER fs_depth DATA_TYPE float DATA +0.0 +END + +PIPELINE graphics pipeline + DEPTH + TEST on + WRITE on + BIAS constant 1.0 clamp 0.0 slope 0.0 + CLAMP on + END + + VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9 + + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER depth0 AS depth_stencil + FRAMEBUFFER_SIZE 60 60 + + BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR_DEPTH pipeline 1.0 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60 + +EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT depth0 IDX 0 EQ 0.9 +EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 1.7 diff --git a/vulkan/amber/depth/bias_outside_range.amber b/vulkan/amber/depth/bias_outside_range.amber new file mode 100644 index 0000000..099e9b5 --- /dev/null +++ b/vulkan/amber/depth/bias_outside_range.amber @@ -0,0 +1,74 @@ +#!amber +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE DepthClampZeroOneFeatures.depthClampZeroOne +DEVICE_FEATURE fragmentStoresAndAtomics + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; + +void main() +{ + gl_Position = vec4(position_in, 1, 1); +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout (binding=0) buffer B { + float d; +}; + +layout(location = 0) out highp vec4 frag_out; +void main() +{ + d = gl_FragCoord.z; + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM +BUFFER depth0 FORMAT D32_SFLOAT + +BUFFER fs_depth DATA_TYPE float DATA +0.0 +END + +PIPELINE graphics pipeline + DEPTH + TEST on + WRITE on + BIAS constant 2097152.0 clamp 0.0 slope 0.0 + END + + VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.5 + + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER depth0 AS depth_stencil + FRAMEBUFFER_SIZE 60 60 + + BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR_DEPTH pipeline 1.0 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60 + +EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT depth0 IDX 0 EQ 0.625 +EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 0.625 diff --git a/vulkan/amber/depth/bias_outside_range_fs_clamp.amber b/vulkan/amber/depth/bias_outside_range_fs_clamp.amber new file mode 100644 index 0000000..8a5e1f3 --- /dev/null +++ b/vulkan/amber/depth/bias_outside_range_fs_clamp.amber @@ -0,0 +1,74 @@ +#!amber +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE DepthClampZeroOneFeatures.depthClampZeroOne +DEVICE_FEATURE fragmentStoresAndAtomics + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; + +void main() +{ + gl_Position = vec4(position_in, 1, 1); +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout (binding=0) buffer B { + float d; +}; + +layout(location = 0) out highp vec4 frag_out; +void main() +{ + d = gl_FragCoord.z; + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM +BUFFER depth0 FORMAT D32_SFLOAT + +BUFFER fs_depth DATA_TYPE float DATA +0.0 +END + +PIPELINE graphics pipeline + DEPTH + TEST on + WRITE on + BIAS constant 16777216.0 clamp 0.0 slope 0.0 + END + + VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9 + + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER depth0 AS depth_stencil + FRAMEBUFFER_SIZE 60 60 + + BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR_DEPTH pipeline 1.0 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60 + +EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT depth0 IDX 0 EQ 1.0 +EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 1.9 diff --git a/vulkan/amber/depth/bias_outside_range_fs_clamp_unrestricted.amber b/vulkan/amber/depth/bias_outside_range_fs_clamp_unrestricted.amber new file mode 100644 index 0000000..33ea349 --- /dev/null +++ b/vulkan/amber/depth/bias_outside_range_fs_clamp_unrestricted.amber @@ -0,0 +1,75 @@ +#!amber +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE DepthClampZeroOneFeatures.depthClampZeroOne +DEVICE_EXTENSION VK_EXT_depth_range_unrestricted +DEVICE_FEATURE fragmentStoresAndAtomics + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; + +void main() +{ + gl_Position = vec4(position_in, 1, 1); +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout (binding=0) buffer B { + float d; +}; + +layout(location = 0) out highp vec4 frag_out; +void main() +{ + d = gl_FragCoord.z; + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM +BUFFER depth0 FORMAT D32_SFLOAT + +BUFFER fs_depth DATA_TYPE float DATA +0.0 +END + +PIPELINE graphics pipeline + DEPTH + TEST on + WRITE on + BIAS constant 16777216.0 clamp 0.0 slope 0.0 + END + + VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9 + + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER depth0 AS depth_stencil + FRAMEBUFFER_SIZE 60 60 + + BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR_DEPTH pipeline 1.0 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60 + +EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT depth0 IDX 0 TOLERANCE 1.0e-6 EQ 1.9 +EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 1.9 diff --git a/vulkan/amber/depth/ez_fs_clamp.amber b/vulkan/amber/depth/ez_fs_clamp.amber new file mode 100644 index 0000000..42c3d49 --- /dev/null +++ b/vulkan/amber/depth/ez_fs_clamp.amber @@ -0,0 +1,77 @@ +#!amber +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE DepthClampZeroOneFeatures.depthClampZeroOne +DEVICE_FEATURE depthClamp +DEVICE_FEATURE fragmentStoresAndAtomics + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; + +void main() +{ + gl_Position = vec4(position_in, 2, 1); +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(early_fragment_tests) in; + +layout (binding=0) buffer B { + float d; +}; + +layout(location = 0) out highp vec4 frag_out; +void main() +{ + d = gl_FragCoord.z; + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM +BUFFER depth0 FORMAT D32_SFLOAT + +BUFFER fs_depth DATA_TYPE float DATA +0.0 +END + +PIPELINE graphics pipeline + DEPTH + TEST on + WRITE on + CLAMP on + END + + VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9 + + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER depth0 AS depth_stencil + FRAMEBUFFER_SIZE 60 60 + + BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR_DEPTH pipeline 1.0 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60 + +EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT depth0 IDX 0 EQ 0.9 +EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 1.7 diff --git a/vulkan/amber/depth/fs_clamp.amber b/vulkan/amber/depth/fs_clamp.amber new file mode 100644 index 0000000..cd7d834 --- /dev/null +++ b/vulkan/amber/depth/fs_clamp.amber @@ -0,0 +1,75 @@ +#!amber +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE DepthClampZeroOneFeatures.depthClampZeroOne +DEVICE_FEATURE depthClamp +DEVICE_FEATURE fragmentStoresAndAtomics + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; + +void main() +{ + gl_Position = vec4(position_in, 2, 1); +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout (binding=0) buffer B { + float d; +}; + +layout(location = 0) out highp vec4 frag_out; +void main() +{ + d = gl_FragCoord.z; + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM +BUFFER depth0 FORMAT D32_SFLOAT + +BUFFER fs_depth DATA_TYPE float DATA +0.0 +END + +PIPELINE graphics pipeline + DEPTH + TEST on + WRITE on + CLAMP on + END + + VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9 + + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER depth0 AS depth_stencil + FRAMEBUFFER_SIZE 60 60 + + BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR_DEPTH pipeline 1.0 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60 + +EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT depth0 IDX 0 EQ 0.9 +EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 1.7 diff --git a/vulkan/amber/depth/out_of_range.amber b/vulkan/amber/depth/out_of_range.amber new file mode 100644 index 0000000..60400f2 --- /dev/null +++ b/vulkan/amber/depth/out_of_range.amber @@ -0,0 +1,66 @@ +#!amber +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE DepthClampZeroOneFeatures.depthClampZeroOne + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out highp vec4 frag_out; +void main() +{ + gl_FragDepth = 2.0; + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM +BUFFER depth0 FORMAT D32_SFLOAT + +BUFFER fs_depth DATA_TYPE float DATA +0.0 +END + +PIPELINE graphics pipeline + DEPTH + TEST on + COMPARE_OP equal + WRITE on + END + + VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9 + + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER depth0 AS depth_stencil + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR_DEPTH pipeline 1.0 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60 + +EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT depth0 IDX 0 EQ 1.0 diff --git a/vulkan/amber/depth/out_of_range_unrestricted.amber b/vulkan/amber/depth/out_of_range_unrestricted.amber new file mode 100644 index 0000000..b61db58 --- /dev/null +++ b/vulkan/amber/depth/out_of_range_unrestricted.amber @@ -0,0 +1,67 @@ +#!amber +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE DepthClampZeroOneFeatures.depthClampZeroOne +DEVICE_EXTENSION VK_EXT_depth_range_unrestricted + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out highp vec4 frag_out; +void main() +{ + gl_FragDepth = 2.0; + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM +BUFFER depth0 FORMAT D32_SFLOAT + +BUFFER fs_depth DATA_TYPE float DATA +0.0 +END + +PIPELINE graphics pipeline + DEPTH + TEST on + COMPARE_OP not_equal + WRITE on + END + + VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9 + + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER depth0 AS depth_stencil + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR_DEPTH pipeline 1.0 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60 + +EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT depth0 IDX 0 EQ 2.0 diff --git a/vulkan/amber/draw/depth_bias/depth_bias_patch_list_tri_fill.amber b/vulkan/amber/draw/depth_bias/depth_bias_patch_list_tri_fill.amber new file mode 100644 index 0000000..7fceb55 --- /dev/null +++ b/vulkan/amber/draw/depth_bias/depth_bias_patch_list_tri_fill.amber @@ -0,0 +1,224 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Red rect. fragDepth: 0.17 +# Green rect. fragDepth: 0.18 +# Depth color format: D16_UNORM +# Depth bias: -0.01068115234375 (-700.0 / 2^16) +# Draw method: Patch List +# Polygon Mode: Fill +# TES primitive ordering: trianges, cw +# Result: Green rectangle should be on top. + +DEVICE_FEATURE tessellationShader + +SHADER vertex vert GLSL +#version 450 + +layout (location = 0) in vec3 inPosition; +layout (location = 1) in vec4 inColor; +layout (location = 0) out vec4 outColor; + +void main(void) +{ + gl_Position = vec4(inPosition, 1.0); + outColor = inColor; +} +END + +SHADER tessellation_control tesc GLSL +#version 450 + +layout (location = 0) in vec4 inColor[]; +layout (location = 0) patch out vec4 tcColor; +layout (vertices = 3) out; + +void main(void) +{ + float tessLevel = 2.0; + + gl_TessLevelInner[0] = tessLevel; + gl_TessLevelInner[1] = tessLevel; + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 1.0; + gl_TessLevelOuter[2] = 1.0; + + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; + tcColor = inColor[gl_InvocationID]; +} +END + +SHADER tessellation_evaluation tese GLSL +#version 450 + +layout (triangles, equal_spacing, cw) in; +layout (location = 0) patch in vec4 patch_color; +layout (location = 0) out vec4 tes_color; + +void main(void) +{ + gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position) + + (gl_TessCoord.y * gl_in[1].gl_Position) + + (gl_TessCoord.z * gl_in[2].gl_Position); + + tes_color = patch_color; +} +END + +SHADER fragment frag GLSL +#version 450 + +layout (location = 0) in vec4 inColor; +layout (location = 0) out vec4 outColor; + +void main(void) +{ + outColor = inColor; +} +END + +BUFFER vertexPositionA DATA_TYPE vec3 DATA +-0.50 -0.50 0.17 + 0.50 -0.50 0.17 + 0.50 0.50 0.17 + 0.50 0.50 0.17 +-0.50 0.50 0.17 +-0.50 -0.50 0.17 +END + +BUFFER vertexPositionB DATA_TYPE vec3 DATA +-0.50 -0.50 0.18 + 0.50 -0.50 0.18 + 0.50 0.50 0.18 + 0.50 0.50 0.18 +-0.50 0.50 0.18 +-0.50 -0.50 0.18 +END + +BUFFER vertexColorA DATA_TYPE vec4 DATA +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER vertexColorB DATA_TYPE vec4 DATA +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + +BUFFER framebuffer FORMAT R8G8B8A8_UNORM +IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0 +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics pipeline1 + ATTACH vert + ATTACH tesc + ATTACH tese + ATTACH frag + + POLYGON_MODE fill + PATCH_CONTROL_POINTS 3 + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + + FRAMEBUFFER_SIZE 100 100 + VERTEX_DATA vertexPositionA LOCATION 0 + VERTEX_DATA vertexColorA LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +PIPELINE graphics pipeline2 + ATTACH vert + ATTACH tesc + ATTACH tese + ATTACH frag + + POLYGON_MODE fill + PATCH_CONTROL_POINTS 3 + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant -700.0 clamp 0.0 slope 0.0 + END + + FRAMEBUFFER_SIZE 100 100 + VERTEX_DATA vertexPositionB LOCATION 0 + VERTEX_DATA vertexColorB LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR pipeline1 0 0 0 255 +CLEAR_DEPTH pipeline1 0.3 +CLEAR pipeline1 + +CLEAR_COLOR pipeline2 0 0 0 255 + +RUN pipeline1 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6 +RUN pipeline2 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the frame buffer contents. +# The compute shader writes color green if the value is expected, +# otherwise red. + +SHADER compute comp_shader GLSL +#version 450 + +layout(local_size_x=10,local_size_y=10) in; +uniform layout(set=0, binding=0, rgba8) image2D resultImage; +uniform layout(set=0, binding=1, rgba8) image2D verifyImage; + +void main() +{ + ivec2 uv = ivec2(gl_GlobalInvocationID.xy); + vec4 color = imageLoad(resultImage, uv); + + if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0)); + else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0)); +} +END + +PIPELINE compute verify_pipeline + ATTACH comp_shader + + FRAMEBUFFER_SIZE 100 100 + BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN verify_pipeline 10 10 1 + +EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/draw/depth_bias/depth_bias_patch_list_tri_line.amber b/vulkan/amber/draw/depth_bias/depth_bias_patch_list_tri_line.amber new file mode 100644 index 0000000..1970c7a --- /dev/null +++ b/vulkan/amber/draw/depth_bias/depth_bias_patch_list_tri_line.amber @@ -0,0 +1,225 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Red rect. fragDepth: 0.17 +# Green rect. fragDepth: 0.18 +# Depth color format: D16_UNORM +# Depth bias: -0.01068115234375 (-700.0 / 2^16) +# Draw method: Patch List +# Polygon Mode: Line +# TES primitive ordering: trianges, cw +# Result: Green rectangle should be on top. + +DEVICE_FEATURE tessellationShader +DEVICE_FEATURE fillModeNonSolid + +SHADER vertex vert GLSL +#version 450 + +layout (location = 0) in vec3 inPosition; +layout (location = 1) in vec4 inColor; +layout (location = 0) out vec4 outColor; + +void main(void) +{ + gl_Position = vec4(inPosition, 1.0); + outColor = inColor; +} +END + +SHADER tessellation_control tesc GLSL +#version 450 + +layout (location = 0) in vec4 inColor[]; +layout (location = 0) patch out vec4 tcColor; +layout (vertices = 3) out; + +void main(void) +{ + float tessLevel = 2.0; + + gl_TessLevelInner[0] = tessLevel; + gl_TessLevelInner[1] = tessLevel; + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 1.0; + gl_TessLevelOuter[2] = 1.0; + + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; + tcColor = inColor[gl_InvocationID]; +} +END + +SHADER tessellation_evaluation tese GLSL +#version 450 + +layout (triangles, equal_spacing, cw) in; +layout (location = 0) patch in vec4 patch_color; +layout (location = 0) out vec4 tes_color; + +void main(void) +{ + gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position) + + (gl_TessCoord.y * gl_in[1].gl_Position) + + (gl_TessCoord.z * gl_in[2].gl_Position); + + tes_color = patch_color; +} +END + +SHADER fragment frag GLSL +#version 450 + +layout (location = 0) in vec4 inColor; +layout (location = 0) out vec4 outColor; + +void main(void) +{ + outColor = inColor; +} +END + +BUFFER vertexPositionA DATA_TYPE vec3 DATA +-0.50 -0.50 0.17 + 0.50 -0.50 0.17 + 0.50 0.50 0.17 + 0.50 0.50 0.17 +-0.50 0.50 0.17 +-0.50 -0.50 0.17 +END + +BUFFER vertexPositionB DATA_TYPE vec3 DATA +-0.50 -0.50 0.18 + 0.50 -0.50 0.18 + 0.50 0.50 0.18 + 0.50 0.50 0.18 +-0.50 0.50 0.18 +-0.50 -0.50 0.18 +END + +BUFFER vertexColorA DATA_TYPE vec4 DATA +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER vertexColorB DATA_TYPE vec4 DATA +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + +BUFFER framebuffer FORMAT R8G8B8A8_UNORM +IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0 +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics pipeline1 + ATTACH vert + ATTACH tesc + ATTACH tese + ATTACH frag + + POLYGON_MODE line + PATCH_CONTROL_POINTS 3 + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + + FRAMEBUFFER_SIZE 100 100 + VERTEX_DATA vertexPositionA LOCATION 0 + VERTEX_DATA vertexColorA LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +PIPELINE graphics pipeline2 + ATTACH vert + ATTACH tesc + ATTACH tese + ATTACH frag + + POLYGON_MODE line + PATCH_CONTROL_POINTS 3 + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant -700.0 clamp 0.0 slope 0.0 + END + + FRAMEBUFFER_SIZE 100 100 + VERTEX_DATA vertexPositionB LOCATION 0 + VERTEX_DATA vertexColorB LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR pipeline1 0 0 0 255 +CLEAR_DEPTH pipeline1 0.3 +CLEAR pipeline1 + +CLEAR_COLOR pipeline2 0 0 0 255 + +RUN pipeline1 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6 +RUN pipeline2 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the frame buffer contents. +# The compute shader writes color green if the value is expected, +# otherwise red. + +SHADER compute comp_shader GLSL +#version 450 + +layout(local_size_x=10,local_size_y=10) in; +uniform layout(set=0, binding=0, rgba8) image2D resultImage; +uniform layout(set=0, binding=1, rgba8) image2D verifyImage; + +void main() +{ + ivec2 uv = ivec2(gl_GlobalInvocationID.xy); + vec4 color = imageLoad(resultImage, uv); + + if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0)); + else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0)); +} +END + +PIPELINE compute verify_pipeline + ATTACH comp_shader + + FRAMEBUFFER_SIZE 100 100 + BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN verify_pipeline 10 10 1 + +EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/draw/depth_bias/depth_bias_patch_list_tri_point.amber b/vulkan/amber/draw/depth_bias/depth_bias_patch_list_tri_point.amber new file mode 100644 index 0000000..8d7a50f --- /dev/null +++ b/vulkan/amber/draw/depth_bias/depth_bias_patch_list_tri_point.amber @@ -0,0 +1,225 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Red rect. fragDepth: 0.17 +# Green rect. fragDepth: 0.18 +# Depth color format: D16_UNORM +# Depth bias: -0.01068115234375 (-700.0 / 2^16) +# Draw method: Patch List +# Polygon Mode: Point +# TES primitive ordering: trianges, cw +# Result: Green rectangle should be on top. + +DEVICE_FEATURE tessellationShader +DEVICE_FEATURE fillModeNonSolid + +SHADER vertex vert GLSL +#version 450 + +layout (location = 0) in vec3 inPosition; +layout (location = 1) in vec4 inColor; +layout (location = 0) out vec4 outColor; + +void main(void) +{ + gl_Position = vec4(inPosition, 1.0); + outColor = inColor; +} +END + +SHADER tessellation_control tesc GLSL +#version 450 + +layout (location = 0) in vec4 inColor[]; +layout (location = 0) patch out vec4 tcColor; +layout (vertices = 3) out; + +void main(void) +{ + float tessLevel = 2.0; + + gl_TessLevelInner[0] = tessLevel; + gl_TessLevelInner[1] = tessLevel; + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 1.0; + gl_TessLevelOuter[2] = 1.0; + + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; + tcColor = inColor[gl_InvocationID]; +} +END + +SHADER tessellation_evaluation tese GLSL +#version 450 + +layout (triangles, equal_spacing, cw) in; +layout (location = 0) patch in vec4 patch_color; +layout (location = 0) out vec4 tes_color; + +void main(void) +{ + gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position) + + (gl_TessCoord.y * gl_in[1].gl_Position) + + (gl_TessCoord.z * gl_in[2].gl_Position); + + tes_color = patch_color; +} +END + +SHADER fragment frag GLSL +#version 450 + +layout (location = 0) in vec4 inColor; +layout (location = 0) out vec4 outColor; + +void main(void) +{ + outColor = inColor; +} +END + +BUFFER vertexPositionA DATA_TYPE vec3 DATA +-0.50 -0.50 0.17 + 0.50 -0.50 0.17 + 0.50 0.50 0.17 + 0.50 0.50 0.17 +-0.50 0.50 0.17 +-0.50 -0.50 0.17 +END + +BUFFER vertexPositionB DATA_TYPE vec3 DATA +-0.50 -0.50 0.18 + 0.50 -0.50 0.18 + 0.50 0.50 0.18 + 0.50 0.50 0.18 +-0.50 0.50 0.18 +-0.50 -0.50 0.18 +END + +BUFFER vertexColorA DATA_TYPE vec4 DATA +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER vertexColorB DATA_TYPE vec4 DATA +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + +BUFFER framebuffer FORMAT R8G8B8A8_UNORM +IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0 +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics pipeline1 + ATTACH vert + ATTACH tesc + ATTACH tese + ATTACH frag + + POLYGON_MODE point + PATCH_CONTROL_POINTS 3 + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + + FRAMEBUFFER_SIZE 100 100 + VERTEX_DATA vertexPositionA LOCATION 0 + VERTEX_DATA vertexColorA LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +PIPELINE graphics pipeline2 + ATTACH vert + ATTACH tesc + ATTACH tese + ATTACH frag + + POLYGON_MODE point + PATCH_CONTROL_POINTS 3 + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant -700.0 clamp 0.0 slope 0.0 + END + + FRAMEBUFFER_SIZE 100 100 + VERTEX_DATA vertexPositionB LOCATION 0 + VERTEX_DATA vertexColorB LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR pipeline1 0 0 0 255 +CLEAR_DEPTH pipeline1 0.3 +CLEAR pipeline1 + +CLEAR_COLOR pipeline2 0 0 0 255 + +RUN pipeline1 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6 +RUN pipeline2 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the frame buffer contents. +# The compute shader writes color green if the value is expected, +# otherwise red. + +SHADER compute comp_shader GLSL +#version 450 + +layout(local_size_x=10,local_size_y=10) in; +uniform layout(set=0, binding=0, rgba8) image2D resultImage; +uniform layout(set=0, binding=1, rgba8) image2D verifyImage; + +void main() +{ + ivec2 uv = ivec2(gl_GlobalInvocationID.xy); + vec4 color = imageLoad(resultImage, uv); + + if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0)); + else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0)); +} +END + +PIPELINE compute verify_pipeline + ATTACH comp_shader + + FRAMEBUFFER_SIZE 100 100 + BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN verify_pipeline 10 10 1 + +EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/draw/depth_bias/depth_bias_triangle_list_fill.amber b/vulkan/amber/draw/depth_bias/depth_bias_triangle_list_fill.amber new file mode 100644 index 0000000..b51ae5d --- /dev/null +++ b/vulkan/amber/draw/depth_bias/depth_bias_triangle_list_fill.amber @@ -0,0 +1,179 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Red rect. fragDepth: 0.17 +# Green rect. fragDepth: 0.18 +# Depth color format: D16_UNORM +# Depth bias: -0.01068115234375 (-700.0 / 2^16) +# Draw method: Triangle List +# Polygon Mode: Fill +# Result: Green rectangle should be on top. + +SHADER vertex vert_shader GLSL +#version 450 + +layout (location = 0) in vec3 inPosition; +layout (location = 1) in vec4 inColor; + +layout (location = 0) out vec4 outColor; + +void main() +{ + gl_Position = vec4(inPosition, 1.0); + outColor = inColor; +} +END + +SHADER fragment frag_shader GLSL +#version 450 + +layout (location = 0) in vec4 inColor; +layout (location = 0) out vec4 outColor; + +void main() +{ + outColor = inColor; +} +END + +BUFFER framebuffer FORMAT R8G8B8A8_UNORM +IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0 +BUFFER depth_buf FORMAT D16_UNORM + +BUFFER vertexPositionA DATA_TYPE vec3 DATA +-0.50 -0.50 0.17 + 0.50 -0.50 0.17 + 0.50 0.50 0.17 + 0.50 0.50 0.17 +-0.50 0.50 0.17 +-0.50 -0.50 0.17 +END + +BUFFER vertexPositionB DATA_TYPE vec3 DATA +-0.50 -0.50 0.18 + 0.50 -0.50 0.18 + 0.50 0.50 0.18 + 0.50 0.50 0.18 +-0.50 0.50 0.18 +-0.50 -0.50 0.18 +END + +BUFFER vertexColorA DATA_TYPE vec4 DATA +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER vertexColorB DATA_TYPE vec4 DATA +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + POLYGON_MODE fill + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + + FRAMEBUFFER_SIZE 100 100 + VIEWPORT 0.0 0.0 SIZE 100.0 100.0 + VERTEX_DATA vertexPositionA LOCATION 0 + VERTEX_DATA vertexColorA LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +PIPELINE graphics pipeline2 + ATTACH vert_shader + ATTACH frag_shader + + POLYGON_MODE fill + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant -700.0 clamp 0.0 slope 0.0 + END + + FRAMEBUFFER_SIZE 100 100 + VIEWPORT 0.0 0.0 SIZE 100.0 100.0 + VERTEX_DATA vertexPositionB LOCATION 0 + VERTEX_DATA vertexColorB LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR pipeline1 0 0 0 255 +CLEAR_DEPTH pipeline1 0.3 +CLEAR pipeline1 + +CLEAR_COLOR pipeline2 0 0 0 255 + +RUN pipeline1 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +RUN pipeline2 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the frame buffer contents. +# The compute shader writes color green if the value is expected, +# otherwise red. + +SHADER compute comp_shader GLSL +#version 450 + +layout(local_size_x=10,local_size_y=10) in; +uniform layout(set=0, binding=0, rgba8) image2D resultImage; +uniform layout(set=0, binding=1, rgba8) image2D verifyImage; + +void main() +{ + ivec2 uv = ivec2(gl_GlobalInvocationID.xy); + vec4 color = imageLoad(resultImage, uv); + + if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0)); + else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0)); +} +END + +PIPELINE compute verify_pipeline + ATTACH comp_shader + + FRAMEBUFFER_SIZE 100 100 + BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN verify_pipeline 10 10 1 + +EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/draw/depth_bias/depth_bias_triangle_list_line.amber b/vulkan/amber/draw/depth_bias/depth_bias_triangle_list_line.amber new file mode 100644 index 0000000..6d3195a --- /dev/null +++ b/vulkan/amber/draw/depth_bias/depth_bias_triangle_list_line.amber @@ -0,0 +1,181 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Red rect. fragDepth: 0.17 +# Green rect. fragDepth: 0.18 +# Depth color format: D16_UNORM +# Depth bias: -0.01068115234375 (-700.0 / 2^16) +# Draw method: Triangle List +# Polygon Mode: Line +# Result: Green rectangle should be on top. + +DEVICE_FEATURE fillModeNonSolid + +SHADER vertex vert_shader GLSL +#version 450 + +layout (location = 0) in vec3 inPosition; +layout (location = 1) in vec4 inColor; + +layout (location = 0) out vec4 outColor; + +void main() +{ + gl_Position = vec4(inPosition, 1.0); + outColor = inColor; +} +END + +SHADER fragment frag_shader GLSL +#version 450 + +layout (location = 0) in vec4 inColor; +layout (location = 0) out vec4 outColor; + +void main() +{ + outColor = inColor; +} +END + +BUFFER framebuffer FORMAT R8G8B8A8_UNORM +IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0 +BUFFER depth_buf FORMAT D16_UNORM + +BUFFER vertexPositionA DATA_TYPE vec3 DATA +-0.50 -0.50 0.17 + 0.50 -0.50 0.17 + 0.50 0.50 0.17 + 0.50 0.50 0.17 +-0.50 0.50 0.17 +-0.50 -0.50 0.17 +END + +BUFFER vertexPositionB DATA_TYPE vec3 DATA +-0.50 -0.50 0.18 + 0.50 -0.50 0.18 + 0.50 0.50 0.18 + 0.50 0.50 0.18 +-0.50 0.50 0.18 +-0.50 -0.50 0.18 +END + +BUFFER vertexColorA DATA_TYPE vec4 DATA +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER vertexColorB DATA_TYPE vec4 DATA +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + POLYGON_MODE line + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + + FRAMEBUFFER_SIZE 100 100 + VIEWPORT 0.0 0.0 SIZE 100.0 100.0 + VERTEX_DATA vertexPositionA LOCATION 0 + VERTEX_DATA vertexColorA LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +PIPELINE graphics pipeline2 + ATTACH vert_shader + ATTACH frag_shader + + POLYGON_MODE line + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant -700.0 clamp 0.0 slope 0.0 + END + + FRAMEBUFFER_SIZE 100 100 + VIEWPORT 0.0 0.0 SIZE 100.0 100.0 + VERTEX_DATA vertexPositionB LOCATION 0 + VERTEX_DATA vertexColorB LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR pipeline1 0 0 0 255 +CLEAR_DEPTH pipeline1 0.3 +CLEAR pipeline1 + +CLEAR_COLOR pipeline2 0 0 0 255 + +RUN pipeline1 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +RUN pipeline2 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the frame buffer contents. +# The compute shader writes color green if the value is expected, +# otherwise red. + +SHADER compute comp_shader GLSL +#version 450 + +layout(local_size_x=10,local_size_y=10) in; +uniform layout(set=0, binding=0, rgba8) image2D resultImage; +uniform layout(set=0, binding=1, rgba8) image2D verifyImage; + +void main() +{ + ivec2 uv = ivec2(gl_GlobalInvocationID.xy); + vec4 color = imageLoad(resultImage, uv); + + if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0)); + else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0)); +} +END + +PIPELINE compute verify_pipeline + ATTACH comp_shader + + FRAMEBUFFER_SIZE 100 100 + BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN verify_pipeline 10 10 1 + +EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/draw/depth_bias/depth_bias_triangle_list_point.amber b/vulkan/amber/draw/depth_bias/depth_bias_triangle_list_point.amber new file mode 100644 index 0000000..f9b63c9 --- /dev/null +++ b/vulkan/amber/draw/depth_bias/depth_bias_triangle_list_point.amber @@ -0,0 +1,182 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Red rect. fragDepth: 0.17 +# Green rect. fragDepth: 0.18 +# Depth color format: D16_UNORM +# Depth bias: -0.01068115234375 (-700.0 / 2^16) +# Draw method: Triangle List +# Polygon Mode: Point +# Result: Green rectangle should be on top. + +DEVICE_FEATURE fillModeNonSolid + +SHADER vertex vert_shader GLSL +#version 450 + +layout (location = 0) in vec3 inPosition; +layout (location = 1) in vec4 inColor; + +layout (location = 0) out vec4 outColor; + +void main() +{ + gl_Position = vec4(inPosition, 1.0); + gl_PointSize = 1.0; + outColor = inColor; +} +END + +SHADER fragment frag_shader GLSL +#version 450 + +layout (location = 0) in vec4 inColor; +layout (location = 0) out vec4 outColor; + +void main() +{ + outColor = inColor; +} +END + +BUFFER framebuffer FORMAT R8G8B8A8_UNORM +IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0 +BUFFER depth_buf FORMAT D16_UNORM + +BUFFER vertexPositionA DATA_TYPE vec3 DATA +-0.50 -0.50 0.17 + 0.50 -0.50 0.17 + 0.50 0.50 0.17 + 0.50 0.50 0.17 +-0.50 0.50 0.17 +-0.50 -0.50 0.17 +END + +BUFFER vertexPositionB DATA_TYPE vec3 DATA +-0.50 -0.50 0.18 + 0.50 -0.50 0.18 + 0.50 0.50 0.18 + 0.50 0.50 0.18 +-0.50 0.50 0.18 +-0.50 -0.50 0.18 +END + +BUFFER vertexColorA DATA_TYPE vec4 DATA +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER vertexColorB DATA_TYPE vec4 DATA +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + POLYGON_MODE point + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + + FRAMEBUFFER_SIZE 100 100 + VIEWPORT 0.0 0.0 SIZE 100.0 100.0 + VERTEX_DATA vertexPositionA LOCATION 0 + VERTEX_DATA vertexColorA LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +PIPELINE graphics pipeline2 + ATTACH vert_shader + ATTACH frag_shader + + POLYGON_MODE point + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant -700.0 clamp 0.0 slope 0.0 + END + + FRAMEBUFFER_SIZE 100 100 + VIEWPORT 0.0 0.0 SIZE 100.0 100.0 + VERTEX_DATA vertexPositionB LOCATION 0 + VERTEX_DATA vertexColorB LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR pipeline1 0 0 0 255 +CLEAR_DEPTH pipeline1 0.3 +CLEAR pipeline1 + +CLEAR_COLOR pipeline2 0 0 0 255 + +RUN pipeline1 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +RUN pipeline2 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the frame buffer contents. +# The compute shader writes color green if the value is expected, +# otherwise red. + +SHADER compute comp_shader GLSL +#version 450 + +layout(local_size_x=10,local_size_y=10) in; +uniform layout(set=0, binding=0, rgba8) image2D resultImage; +uniform layout(set=0, binding=1, rgba8) image2D verifyImage; + +void main() +{ + ivec2 uv = ivec2(gl_GlobalInvocationID.xy); + vec4 color = imageLoad(resultImage, uv); + + if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0)); + else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0)); +} +END + +PIPELINE compute verify_pipeline + ATTACH comp_shader + + FRAMEBUFFER_SIZE 100 100 + BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN verify_pipeline 10 10 1 + +EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/draw/misc/flat_b_sat_error.amber b/vulkan/amber/draw/misc/flat_b_sat_error.amber new file mode 100644 index 0000000..610f904 --- /dev/null +++ b/vulkan/amber/draw/misc/flat_b_sat_error.amber @@ -0,0 +1,51 @@ +#!amber +# Reproducer for https://gitlab.freedesktop.org/mesa/mesa/-/issues/10999 + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec2 data_in; +layout(location = 0) out flat float data_out; +void main() { + const float count = 5.0; + gl_PointSize = 1.0; + gl_Position = vec4((((data_in.x + 0.5) / count) * 2.0) - 1.0, 0.0, 0.0, 1.0); + data_out = data_in.y; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) in flat float data_in; +layout(location = 0) out vec4 final_color; +void main() { + const float epsilon = 0.0009765625; // Makes sure 0.5 is rounded up to 128. + final_color = vec4(max(0.0, min(max(data_in, 0.0), 1.0) - 0.5) + epsilon, 0.0, 0.0, 1.0); +} +END + +BUFFER position_buf DATA_TYPE vec2 DATA +0 0.0 +1 0.5 +2 1.0 +3 1.5 +4 2.0 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vtex_shader + ATTACH frag_shader + + VERTEX_DATA position_buf LOCATION 0 + FRAMEBUFFER_SIZE 5 1 + VIEWPORT 0 0 SIZE 5 1 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_ARRAY AS POINT_LIST START_IDX 0 +EXPECT framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 0 0 0 255 +EXPECT framebuffer IDX 1 0 SIZE 1 1 EQ_RGBA 0 0 0 255 +EXPECT framebuffer IDX 2 0 SIZE 1 1 EQ_RGBA 128 0 0 255 +EXPECT framebuffer IDX 3 0 SIZE 1 1 EQ_RGBA 128 0 0 255 +EXPECT framebuffer IDX 4 0 SIZE 1 1 EQ_RGBA 128 0 0 255 diff --git a/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-highp-output-float.amber b/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-highp-output-float.amber new file mode 100644 index 0000000..5b0a6ee --- /dev/null +++ b/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-highp-output-float.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec3 color_in[3]; +layout(location = 0) smooth out vec3 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec3 color_in[3]; +layout(location = 0) out highp float frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].x; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec3 color_in; +layout(location = 0) smooth out vec3 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec3 color_in; +layout(location = 0) out highp float frag_out; +void main() +{ + frag_out = color_in.x; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + float result = texture(result_sampler, texcoord_in).x; + float ref = texture(ref_sampler, texcoord_in).x; + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32 + +BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32 + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +END + +BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-highp-output-vec2.amber b/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-highp-output-vec2.amber new file mode 100644 index 0000000..1de1779 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-highp-output-vec2.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec3 color_in[3]; +layout(location = 0) smooth out vec3 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec3 color_in[3]; +layout(location = 0) out highp vec2 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].xy; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec3 color_in; +layout(location = 0) smooth out vec3 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec3 color_in; +layout(location = 0) out highp vec2 frag_out; +void main() +{ + frag_out = color_in.xy; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec2 result = texture(result_sampler, texcoord_in).xy; + vec2 ref = texture(ref_sampler, texcoord_in).xy; + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32 + +BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32 + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +END + +BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-highp.amber b/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-highp.amber new file mode 100644 index 0000000..fd5509d --- /dev/null +++ b/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-highp.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec3 color_in[3]; +layout(location = 0) smooth out vec3 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec3 color_in[3]; +layout(location = 0) out highp vec3 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i]; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec3 color_in; +layout(location = 0) smooth out vec3 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec3 color_in; +layout(location = 0) out highp vec3 frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec3 result = texture(result_sampler, texcoord_in).xyz; + vec3 ref = texture(ref_sampler, texcoord_in).xyz; + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32 + +BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32 + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +END + +BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-mediump-output-float.amber b/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-mediump-output-float.amber new file mode 100644 index 0000000..588de0d --- /dev/null +++ b/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-mediump-output-float.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec3 color_in[3]; +layout(location = 0) smooth out vec3 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec3 color_in[3]; +layout(location = 0) out mediump float frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].x; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec3 color_in; +layout(location = 0) smooth out vec3 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec3 color_in; +layout(location = 0) out mediump float frag_out; +void main() +{ + frag_out = color_in.x; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + float result = texture(result_sampler, texcoord_in).x; + float ref = texture(ref_sampler, texcoord_in).x; + if (distance(result, ref) > 0.1) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32 + +BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32 + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +END + +BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-mediump-output-vec2.amber b/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-mediump-output-vec2.amber new file mode 100644 index 0000000..fae5916 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-mediump-output-vec2.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec3 color_in[3]; +layout(location = 0) smooth out vec3 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec3 color_in[3]; +layout(location = 0) out mediump vec2 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].xy; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec3 color_in; +layout(location = 0) smooth out vec3 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec3 color_in; +layout(location = 0) out mediump vec2 frag_out; +void main() +{ + frag_out = color_in.xy; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec2 result = texture(result_sampler, texcoord_in).xy; + vec2 ref = texture(ref_sampler, texcoord_in).xy; + if (distance(result, ref) > 0.1) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32 + +BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32 + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +END + +BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-mediump.amber b/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-mediump.amber new file mode 100644 index 0000000..adac913 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/b10g11r11-ufloat-pack32-mediump.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec3 color_in[3]; +layout(location = 0) smooth out vec3 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec3 color_in[3]; +layout(location = 0) out mediump vec3 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i]; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec3 color_in; +layout(location = 0) smooth out vec3 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec3 color_in; +layout(location = 0) out mediump vec3 frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec3 result = texture(result_sampler, texcoord_in).xyz; + vec3 ref = texture(ref_sampler, texcoord_in).xyz; + if (distance(result, ref) > 0.1) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32 + +BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32 +BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32 + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +END + +BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-highp-output-vec2.amber b/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-highp-output-vec2.amber new file mode 100644 index 0000000..cee1e39 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-highp-output-vec2.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in[3]; +layout(location = 0) smooth out vec4 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in[3]; +layout(location = 0) out highp vec2 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].xy; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in; +layout(location = 0) smooth out vec4 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in; +layout(location = 0) out highp vec2 frag_out; +void main() +{ + frag_out = color_in.xy; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec2 result = texture(result_sampler, texcoord_in).xy; + vec2 ref = texture(ref_sampler, texcoord_in).xy; + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM +BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM +BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM + +BUFFER ref0 FORMAT B8G8R8A8_UNORM +BUFFER ref1 FORMAT B8G8R8A8_UNORM +BUFFER ref2 FORMAT B8G8R8A8_UNORM + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA +255 0 0 255 + 0 255 0 255 + 0 0 255 255 +255 255 0 255 +END + +BUFFER color1 DATA_TYPE B8G8R8A8_UNORM DATA + 0 255 0 255 + 0 0 255 255 +255 255 0 255 +255 0 0 255 +END + +BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA + 0 0 255 255 +255 255 0 255 +255 0 0 255 + 0 255 0 255 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-highp-output-vec3.amber b/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-highp-output-vec3.amber new file mode 100644 index 0000000..fcd47f4 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-highp-output-vec3.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in[3]; +layout(location = 0) smooth out vec4 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in[3]; +layout(location = 0) out highp vec3 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].xyz; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in; +layout(location = 0) smooth out vec4 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in; +layout(location = 0) out highp vec3 frag_out; +void main() +{ + frag_out = color_in.xyz; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec3 result = texture(result_sampler, texcoord_in).xyz; + vec3 ref = texture(ref_sampler, texcoord_in).xyz; + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM +BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM +BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM + +BUFFER ref0 FORMAT B8G8R8A8_UNORM +BUFFER ref1 FORMAT B8G8R8A8_UNORM +BUFFER ref2 FORMAT B8G8R8A8_UNORM + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA +255 0 0 255 + 0 255 0 255 + 0 0 255 255 +255 255 0 255 +END + +BUFFER color1 DATA_TYPE B8G8R8A8_UNORM DATA + 0 255 0 255 + 0 0 255 255 +255 255 0 255 +255 0 0 255 +END + +BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA + 0 0 255 255 +255 255 0 255 +255 0 0 255 + 0 255 0 255 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-highp.amber b/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-highp.amber new file mode 100644 index 0000000..e62fe4c --- /dev/null +++ b/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-highp.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in[3]; +layout(location = 0) smooth out vec4 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in[3]; +layout(location = 0) out highp vec4 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i]; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in; +layout(location = 0) smooth out vec4 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in; +layout(location = 0) out highp vec4 frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec4 result = texture(result_sampler, texcoord_in); + vec4 ref = texture(ref_sampler, texcoord_in); + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM +BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM +BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM + +BUFFER ref0 FORMAT B8G8R8A8_UNORM +BUFFER ref1 FORMAT B8G8R8A8_UNORM +BUFFER ref2 FORMAT B8G8R8A8_UNORM + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA +255 0 0 255 + 0 255 0 255 + 0 0 255 255 +255 255 0 255 +END + +BUFFER color1 DATA_TYPE B8G8R8A8_UNORM DATA + 0 255 0 255 + 0 0 255 255 +255 255 0 255 +255 0 0 255 +END + +BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA + 0 0 255 255 +255 255 0 255 +255 0 0 255 + 0 255 0 255 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-mediump-output-vec2.amber b/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-mediump-output-vec2.amber new file mode 100644 index 0000000..37c59a0 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-mediump-output-vec2.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in[3]; +layout(location = 0) smooth out vec4 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in[3]; +layout(location = 0) out mediump vec2 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].xy; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in; +layout(location = 0) smooth out vec4 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in; +layout(location = 0) out mediump vec2 frag_out; +void main() +{ + frag_out = color_in.xy; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec2 result = texture(result_sampler, texcoord_in).xy; + vec2 ref = texture(ref_sampler, texcoord_in).xy; + if (distance(result, ref) > 0.1) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM +BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM +BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM + +BUFFER ref0 FORMAT B8G8R8A8_UNORM +BUFFER ref1 FORMAT B8G8R8A8_UNORM +BUFFER ref2 FORMAT B8G8R8A8_UNORM + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA +255 0 0 255 + 0 255 0 255 + 0 0 255 255 +255 255 0 255 +END + +BUFFER color1 DATA_TYPE B8G8R8A8_UNORM DATA + 0 255 0 255 + 0 0 255 255 +255 255 0 255 +255 0 0 255 +END + +BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA + 0 0 255 255 +255 255 0 255 +255 0 0 255 + 0 255 0 255 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-mediump-output-vec3.amber b/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-mediump-output-vec3.amber new file mode 100644 index 0000000..03fa05f --- /dev/null +++ b/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-mediump-output-vec3.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in[3]; +layout(location = 0) smooth out vec4 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in[3]; +layout(location = 0) out mediump vec3 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].xyz; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in; +layout(location = 0) smooth out vec4 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in; +layout(location = 0) out mediump vec3 frag_out; +void main() +{ + frag_out = color_in.xyz; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec3 result = texture(result_sampler, texcoord_in).xyz; + vec3 ref = texture(ref_sampler, texcoord_in).xyz; + if (distance(result, ref) > 0.1) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM +BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM +BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM + +BUFFER ref0 FORMAT B8G8R8A8_UNORM +BUFFER ref1 FORMAT B8G8R8A8_UNORM +BUFFER ref2 FORMAT B8G8R8A8_UNORM + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA +255 0 0 255 + 0 255 0 255 + 0 0 255 255 +255 255 0 255 +END + +BUFFER color1 DATA_TYPE B8G8R8A8_UNORM DATA + 0 255 0 255 + 0 0 255 255 +255 255 0 255 +255 0 0 255 +END + +BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA + 0 0 255 255 +255 255 0 255 +255 0 0 255 + 0 255 0 255 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-mediump.amber b/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-mediump.amber new file mode 100644 index 0000000..5a820a0 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/b8g8r8a8-unorm-mediump.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in[3]; +layout(location = 0) smooth out vec4 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in[3]; +layout(location = 0) out mediump vec4 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i]; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in; +layout(location = 0) smooth out vec4 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in; +layout(location = 0) out mediump vec4 frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec4 result = texture(result_sampler, texcoord_in); + vec4 ref = texture(ref_sampler, texcoord_in); + if (distance(result, ref) > 0.1) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM +BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM +BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM + +BUFFER ref0 FORMAT B8G8R8A8_UNORM +BUFFER ref1 FORMAT B8G8R8A8_UNORM +BUFFER ref2 FORMAT B8G8R8A8_UNORM + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA +255 0 0 255 + 0 255 0 255 + 0 0 255 255 +255 255 0 255 +END + +BUFFER color1 DATA_TYPE B8G8R8A8_UNORM DATA + 0 255 0 255 + 0 0 255 255 +255 255 0 255 +255 0 0 255 +END + +BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA + 0 0 255 255 +255 255 0 255 +255 0 0 255 + 0 255 0 255 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r16g16-sfloat-highp-output-float.amber b/vulkan/amber/draw/output_location/array/r16g16-sfloat-highp-output-float.amber new file mode 100644 index 0000000..69a0b3b --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r16g16-sfloat-highp-output-float.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 color_in[3]; +layout(location = 0) smooth out vec2 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec2 color_in[3]; +layout(location = 0) out highp float frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].x; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 color_in; +layout(location = 0) smooth out vec2 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec2 color_in; +layout(location = 0) out highp float frag_out; +void main() +{ + frag_out = color_in.x; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + float result = texture(result_sampler, texcoord_in).x; + float ref = texture(ref_sampler, texcoord_in).x; + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R16G16_SFLOAT +BUFFER framebuffer1 FORMAT R16G16_SFLOAT +BUFFER framebuffer2 FORMAT R16G16_SFLOAT + +BUFFER ref0 FORMAT R16G16_SFLOAT +BUFFER ref1 FORMAT R16G16_SFLOAT +BUFFER ref2 FORMAT R16G16_SFLOAT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R16G16_SFLOAT DATA +1.0 0.0 +0.0 1.0 +0.0 0.0 +1.0 1.0 +END + +BUFFER color1 DATA_TYPE R16G16_SFLOAT DATA +0.0 1.0 +0.0 0.0 +1.0 1.0 +1.0 0.0 +END + +BUFFER color2 DATA_TYPE R16G16_SFLOAT DATA +0.0 0.0 +1.0 1.0 +1.0 0.0 +0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r16g16-sfloat-highp.amber b/vulkan/amber/draw/output_location/array/r16g16-sfloat-highp.amber new file mode 100644 index 0000000..1663975 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r16g16-sfloat-highp.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 color_in[3]; +layout(location = 0) smooth out vec2 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec2 color_in[3]; +layout(location = 0) out highp vec2 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i]; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 color_in; +layout(location = 0) smooth out vec2 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec2 color_in; +layout(location = 0) out highp vec2 frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec2 result = texture(result_sampler, texcoord_in).xy; + vec2 ref = texture(ref_sampler, texcoord_in).xy; + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R16G16_SFLOAT +BUFFER framebuffer1 FORMAT R16G16_SFLOAT +BUFFER framebuffer2 FORMAT R16G16_SFLOAT + +BUFFER ref0 FORMAT R16G16_SFLOAT +BUFFER ref1 FORMAT R16G16_SFLOAT +BUFFER ref2 FORMAT R16G16_SFLOAT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R16G16_SFLOAT DATA +1.0 0.0 +0.0 1.0 +0.0 0.0 +1.0 1.0 +END + +BUFFER color1 DATA_TYPE R16G16_SFLOAT DATA +0.0 1.0 +0.0 0.0 +1.0 1.0 +1.0 0.0 +END + +BUFFER color2 DATA_TYPE R16G16_SFLOAT DATA +0.0 0.0 +1.0 1.0 +1.0 0.0 +0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r16g16-sfloat-mediump-output-float.amber b/vulkan/amber/draw/output_location/array/r16g16-sfloat-mediump-output-float.amber new file mode 100644 index 0000000..87f1cee --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r16g16-sfloat-mediump-output-float.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 color_in[3]; +layout(location = 0) smooth out vec2 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec2 color_in[3]; +layout(location = 0) out mediump float frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].x; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 color_in; +layout(location = 0) smooth out vec2 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec2 color_in; +layout(location = 0) out mediump float frag_out; +void main() +{ + frag_out = color_in.x; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + float result = texture(result_sampler, texcoord_in).x; + float ref = texture(ref_sampler, texcoord_in).x; + if (distance(result, ref) > 0.1) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R16G16_SFLOAT +BUFFER framebuffer1 FORMAT R16G16_SFLOAT +BUFFER framebuffer2 FORMAT R16G16_SFLOAT + +BUFFER ref0 FORMAT R16G16_SFLOAT +BUFFER ref1 FORMAT R16G16_SFLOAT +BUFFER ref2 FORMAT R16G16_SFLOAT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R16G16_SFLOAT DATA +1.0 0.0 +0.0 1.0 +0.0 0.0 +1.0 1.0 +END + +BUFFER color1 DATA_TYPE R16G16_SFLOAT DATA +0.0 1.0 +0.0 0.0 +1.0 1.0 +1.0 0.0 +END + +BUFFER color2 DATA_TYPE R16G16_SFLOAT DATA +0.0 0.0 +1.0 1.0 +1.0 0.0 +0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r16g16-sfloat-mediump.amber b/vulkan/amber/draw/output_location/array/r16g16-sfloat-mediump.amber new file mode 100644 index 0000000..a68244b --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r16g16-sfloat-mediump.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 color_in[3]; +layout(location = 0) smooth out vec2 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec2 color_in[3]; +layout(location = 0) out mediump vec2 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i]; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 color_in; +layout(location = 0) smooth out vec2 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec2 color_in; +layout(location = 0) out mediump vec2 frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec2 result = texture(result_sampler, texcoord_in).xy; + vec2 ref = texture(ref_sampler, texcoord_in).xy; + if (distance(result, ref) > 0.1) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R16G16_SFLOAT +BUFFER framebuffer1 FORMAT R16G16_SFLOAT +BUFFER framebuffer2 FORMAT R16G16_SFLOAT + +BUFFER ref0 FORMAT R16G16_SFLOAT +BUFFER ref1 FORMAT R16G16_SFLOAT +BUFFER ref2 FORMAT R16G16_SFLOAT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R16G16_SFLOAT DATA +1.0 0.0 +0.0 1.0 +0.0 0.0 +1.0 1.0 +END + +BUFFER color1 DATA_TYPE R16G16_SFLOAT DATA +0.0 1.0 +0.0 0.0 +1.0 1.0 +1.0 0.0 +END + +BUFFER color2 DATA_TYPE R16G16_SFLOAT DATA +0.0 0.0 +1.0 1.0 +1.0 0.0 +0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r32-sfloat-highp.amber b/vulkan/amber/draw/output_location/array/r32-sfloat-highp.amber new file mode 100644 index 0000000..1d3bc32 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r32-sfloat-highp.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in float color_in[3]; +layout(location = 0) smooth out float color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in float color_in[3]; +layout(location = 0) out highp float frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i]; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in float color_in; +layout(location = 0) smooth out float color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in float color_in; +layout(location = 0) out highp float frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + float result = texture(result_sampler, texcoord_in).x; + float ref = texture(ref_sampler, texcoord_in).x; + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R32_SFLOAT +BUFFER framebuffer1 FORMAT R32_SFLOAT +BUFFER framebuffer2 FORMAT R32_SFLOAT + +BUFFER ref0 FORMAT R32_SFLOAT +BUFFER ref1 FORMAT R32_SFLOAT +BUFFER ref2 FORMAT R32_SFLOAT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32_SFLOAT DATA +1.0 +0.0 +0.0 +1.0 +END + +BUFFER color1 DATA_TYPE R32_SFLOAT DATA +0.0 +0.0 +1.0 +1.0 +END + +BUFFER color2 DATA_TYPE R32_SFLOAT DATA +0.0 +1.0 +1.0 +0.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r32-sfloat-mediump.amber b/vulkan/amber/draw/output_location/array/r32-sfloat-mediump.amber new file mode 100644 index 0000000..4b28cc9 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r32-sfloat-mediump.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in float color_in[3]; +layout(location = 0) smooth out float color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in float color_in[3]; +layout(location = 0) out mediump float frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i]; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in float color_in; +layout(location = 0) smooth out float color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in float color_in; +layout(location = 0) out mediump float frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + float result = texture(result_sampler, texcoord_in).x; + float ref = texture(ref_sampler, texcoord_in).x; + if (distance(result, ref) > 0.1) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R32_SFLOAT +BUFFER framebuffer1 FORMAT R32_SFLOAT +BUFFER framebuffer2 FORMAT R32_SFLOAT + +BUFFER ref0 FORMAT R32_SFLOAT +BUFFER ref1 FORMAT R32_SFLOAT +BUFFER ref2 FORMAT R32_SFLOAT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32_SFLOAT DATA +1.0 +0.0 +0.0 +1.0 +END + +BUFFER color1 DATA_TYPE R32_SFLOAT DATA +0.0 +0.0 +1.0 +1.0 +END + +BUFFER color2 DATA_TYPE R32_SFLOAT DATA +0.0 +1.0 +1.0 +0.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-highp-output-vec2.amber b/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-highp-output-vec2.amber new file mode 100644 index 0000000..7ce8ef8 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-highp-output-vec2.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in[3]; +layout(location = 0) smooth out vec4 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in[3]; +layout(location = 0) out highp vec2 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].xy; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in; +layout(location = 0) smooth out vec4 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in; +layout(location = 0) out highp vec2 frag_out; +void main() +{ + frag_out = color_in.xy; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec2 result = texture(result_sampler, texcoord_in).xy; + vec2 ref = texture(ref_sampler, texcoord_in).xy; + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT +BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT +BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT + +BUFFER ref0 FORMAT R32G32B32A32_SFLOAT +BUFFER ref1 FORMAT R32G32B32A32_SFLOAT +BUFFER ref2 FORMAT R32G32B32A32_SFLOAT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +END + +BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-highp-output-vec3.amber b/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-highp-output-vec3.amber new file mode 100644 index 0000000..db91ba7 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-highp-output-vec3.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in[3]; +layout(location = 0) smooth out vec4 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in[3]; +layout(location = 0) out highp vec3 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].xyz; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in; +layout(location = 0) smooth out vec4 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in; +layout(location = 0) out highp vec3 frag_out; +void main() +{ + frag_out = color_in.xyz; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec3 result = texture(result_sampler, texcoord_in).xyz; + vec3 ref = texture(ref_sampler, texcoord_in).xyz; + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT +BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT +BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT + +BUFFER ref0 FORMAT R32G32B32A32_SFLOAT +BUFFER ref1 FORMAT R32G32B32A32_SFLOAT +BUFFER ref2 FORMAT R32G32B32A32_SFLOAT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +END + +BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-highp.amber b/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-highp.amber new file mode 100644 index 0000000..657c4b9 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-highp.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in[3]; +layout(location = 0) smooth out vec4 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in[3]; +layout(location = 0) out highp vec4 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i]; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in; +layout(location = 0) smooth out vec4 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in; +layout(location = 0) out highp vec4 frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec4 result = texture(result_sampler, texcoord_in); + vec4 ref = texture(ref_sampler, texcoord_in); + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT +BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT +BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT + +BUFFER ref0 FORMAT R32G32B32A32_SFLOAT +BUFFER ref1 FORMAT R32G32B32A32_SFLOAT +BUFFER ref2 FORMAT R32G32B32A32_SFLOAT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +END + +BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-mediump-output-vec2.amber b/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-mediump-output-vec2.amber new file mode 100644 index 0000000..ddf1cfb --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-mediump-output-vec2.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in[3]; +layout(location = 0) smooth out vec4 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in[3]; +layout(location = 0) out mediump vec2 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].xy; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in; +layout(location = 0) smooth out vec4 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in; +layout(location = 0) out mediump vec2 frag_out; +void main() +{ + frag_out = color_in.xy; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec2 result = texture(result_sampler, texcoord_in).xy; + vec2 ref = texture(ref_sampler, texcoord_in).xy; + if (distance(result, ref) > 0.1) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT +BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT +BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT + +BUFFER ref0 FORMAT R32G32B32A32_SFLOAT +BUFFER ref1 FORMAT R32G32B32A32_SFLOAT +BUFFER ref2 FORMAT R32G32B32A32_SFLOAT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +END + +BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-mediump-output-vec3.amber b/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-mediump-output-vec3.amber new file mode 100644 index 0000000..5584eeb --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-mediump-output-vec3.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in[3]; +layout(location = 0) smooth out vec4 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in[3]; +layout(location = 0) out mediump vec3 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].xyz; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in; +layout(location = 0) smooth out vec4 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in; +layout(location = 0) out mediump vec3 frag_out; +void main() +{ + frag_out = color_in.xyz; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec3 result = texture(result_sampler, texcoord_in).xyz; + vec3 ref = texture(ref_sampler, texcoord_in).xyz; + if (distance(result, ref) > 0.1) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT +BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT +BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT + +BUFFER ref0 FORMAT R32G32B32A32_SFLOAT +BUFFER ref1 FORMAT R32G32B32A32_SFLOAT +BUFFER ref2 FORMAT R32G32B32A32_SFLOAT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +END + +BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-mediump.amber b/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-mediump.amber new file mode 100644 index 0000000..444cc59 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r32g32b32a32-sfloat-mediump.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in[3]; +layout(location = 0) smooth out vec4 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in[3]; +layout(location = 0) out mediump vec4 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i]; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in; +layout(location = 0) smooth out vec4 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in; +layout(location = 0) out mediump vec4 frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec4 result = texture(result_sampler, texcoord_in); + vec4 ref = texture(ref_sampler, texcoord_in); + if (distance(result, ref) > 0.1) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT +BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT +BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT + +BUFFER ref0 FORMAT R32G32B32A32_SFLOAT +BUFFER ref1 FORMAT R32G32B32A32_SFLOAT +BUFFER ref2 FORMAT R32G32B32A32_SFLOAT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +END + +BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 1.0 0.0 1.0 +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +END + +BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA +0.0 0.0 1.0 1.0 +1.0 1.0 0.0 1.0 +1.0 0.0 0.0 1.0 +0.0 1.0 0.0 1.0 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r8g8-uint-highp-output-uint.amber b/vulkan/amber/draw/output_location/array/r8g8-uint-highp-output-uint.amber new file mode 100644 index 0000000..6d1279c --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r8g8-uint-highp-output-uint.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in uvec2 color_in[3]; +layout(location = 0) flat out uvec2 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) flat in uvec2 color_in[3]; +layout(location = 0) out highp uint frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].x; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in uvec2 color_in; +layout(location = 0) flat out uvec2 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) flat in uvec2 color_in; +layout(location = 0) out highp uint frag_out; +void main() +{ + frag_out = color_in.x; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) usampler2D result_sampler; +uniform layout(set=0, binding=1) usampler2D ref_sampler; +void main() +{ + uint result = texture(result_sampler, texcoord_in).x; + uint ref = texture(ref_sampler, texcoord_in).x; + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R8G8_UINT +BUFFER framebuffer1 FORMAT R8G8_UINT +BUFFER framebuffer2 FORMAT R8G8_UINT + +BUFFER ref0 FORMAT R8G8_UINT +BUFFER ref1 FORMAT R8G8_UINT +BUFFER ref2 FORMAT R8G8_UINT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R8G8_UINT DATA +255 0 + 0 255 + 0 0 +255 255 +END + +BUFFER color1 DATA_TYPE R8G8_UINT DATA + 0 255 + 0 0 +255 255 +255 0 +END + +BUFFER color2 DATA_TYPE R8G8_UINT DATA + 0 0 +255 255 +255 0 + 0 255 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r8g8-uint-highp.amber b/vulkan/amber/draw/output_location/array/r8g8-uint-highp.amber new file mode 100644 index 0000000..b0d85d7 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r8g8-uint-highp.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in uvec2 color_in[3]; +layout(location = 0) flat out uvec2 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) flat in uvec2 color_in[3]; +layout(location = 0) out highp uvec2 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i]; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in uvec2 color_in; +layout(location = 0) flat out uvec2 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) flat in uvec2 color_in; +layout(location = 0) out highp uvec2 frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) usampler2D result_sampler; +uniform layout(set=0, binding=1) usampler2D ref_sampler; +void main() +{ + uvec2 result = texture(result_sampler, texcoord_in).xy; + uvec2 ref = texture(ref_sampler, texcoord_in).xy; + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R8G8_UINT +BUFFER framebuffer1 FORMAT R8G8_UINT +BUFFER framebuffer2 FORMAT R8G8_UINT + +BUFFER ref0 FORMAT R8G8_UINT +BUFFER ref1 FORMAT R8G8_UINT +BUFFER ref2 FORMAT R8G8_UINT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R8G8_UINT DATA +255 0 + 0 255 + 0 0 +255 255 +END + +BUFFER color1 DATA_TYPE R8G8_UINT DATA + 0 255 + 0 0 +255 255 +255 0 +END + +BUFFER color2 DATA_TYPE R8G8_UINT DATA + 0 0 +255 255 +255 0 + 0 255 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r8g8-uint-mediump-output-uint.amber b/vulkan/amber/draw/output_location/array/r8g8-uint-mediump-output-uint.amber new file mode 100644 index 0000000..973e63f --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r8g8-uint-mediump-output-uint.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in uvec2 color_in[3]; +layout(location = 0) flat out uvec2 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) flat in uvec2 color_in[3]; +layout(location = 0) out mediump uint frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i].x; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in uvec2 color_in; +layout(location = 0) flat out uvec2 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) flat in uvec2 color_in; +layout(location = 0) out mediump uint frag_out; +void main() +{ + frag_out = color_in.x; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) usampler2D result_sampler; +uniform layout(set=0, binding=1) usampler2D ref_sampler; +void main() +{ + uint result = texture(result_sampler, texcoord_in).x; + uint ref = texture(ref_sampler, texcoord_in).x; + if (distance(result, ref) > 5) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R8G8_UINT +BUFFER framebuffer1 FORMAT R8G8_UINT +BUFFER framebuffer2 FORMAT R8G8_UINT + +BUFFER ref0 FORMAT R8G8_UINT +BUFFER ref1 FORMAT R8G8_UINT +BUFFER ref2 FORMAT R8G8_UINT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R8G8_UINT DATA +255 0 + 0 255 + 0 0 +255 255 +END + +BUFFER color1 DATA_TYPE R8G8_UINT DATA + 0 255 + 0 0 +255 255 +255 0 +END + +BUFFER color2 DATA_TYPE R8G8_UINT DATA + 0 0 +255 255 +255 0 + 0 255 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/array/r8g8-uint-mediump.amber b/vulkan/amber/draw/output_location/array/r8g8-uint-mediump.amber new file mode 100644 index 0000000..dab9dd1 --- /dev/null +++ b/vulkan/amber/draw/output_location/array/r8g8-uint-mediump.amber @@ -0,0 +1,241 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in uvec2 color_in[3]; +layout(location = 0) flat out uvec2 color_out[3]; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + for (int i = 0; i < 3; i++) + color_out[i] = color_in[i]; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) flat in uvec2 color_in[3]; +layout(location = 0) out mediump uvec2 frag_out[3]; +void main() +{ + for (int i = 0; i < 3; i++) + frag_out[i] = color_in[i]; +} +END + +SHADER vertex vert_shader_ref GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in uvec2 color_in; +layout(location = 0) flat out uvec2 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref GLSL +#version 430 +layout(location = 0) flat in uvec2 color_in; +layout(location = 0) out mediump uvec2 frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) usampler2D result_sampler; +uniform layout(set=0, binding=1) usampler2D ref_sampler; +void main() +{ + uvec2 result = texture(result_sampler, texcoord_in).xy; + uvec2 ref = texture(ref_sampler, texcoord_in).xy; + if (distance(result, ref) > 5) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R8G8_UINT +BUFFER framebuffer1 FORMAT R8G8_UINT +BUFFER framebuffer2 FORMAT R8G8_UINT + +BUFFER ref0 FORMAT R8G8_UINT +BUFFER ref1 FORMAT R8G8_UINT +BUFFER ref2 FORMAT R8G8_UINT + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE R8G8_UINT DATA +255 0 + 0 255 + 0 0 +255 255 +END + +BUFFER color1 DATA_TYPE R8G8_UINT DATA + 0 255 + 0 0 +255 255 +255 0 +END + +BUFFER color2 DATA_TYPE R8G8_UINT DATA + 0 0 +255 255 +255 0 + 0 255 +END + + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref + ATTACH frag_shader_ref + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref0 0 0 0 0 +CLEAR pipeline_ref0 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref1 0 0 0 0 +CLEAR pipeline_ref1 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_ref2 0 0 0 0 +CLEAR pipeline_ref2 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify0 0 0 0 0 +CLEAR pipeline_verify0 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify1 0 0 0 0 +CLEAR pipeline_verify1 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +CLEAR_COLOR pipeline_verify2 0 0 0 0 +CLEAR pipeline_verify2 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/shuffle/inputs-outputs-mod.amber b/vulkan/amber/draw/output_location/shuffle/inputs-outputs-mod.amber new file mode 100644 index 0000000..176d8ed --- /dev/null +++ b/vulkan/amber/draw/output_location/shuffle/inputs-outputs-mod.amber @@ -0,0 +1,317 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in0; +layout(location = 2) in uvec2 color_in1; +layout(location = 3) in float color_in2; +layout(location = 0) smooth out vec4 color_out0; +layout(location = 1) flat out uvec2 color_out1; +layout(location = 2) smooth out float color_out2; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out0 = color_in0; + color_out1 = color_in1; + color_out2 = color_in2; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in0; +layout(location = 1) flat in uvec2 color_in1; +layout(location = 2) smooth in float color_in2; +layout(location = 0) out mediump float frag_out0; +layout(location = 1) out lowp uvec2 frag_out1; +layout(location = 2) out highp vec4 frag_out2; +void main() +{ + frag_out0 = color_in2; + frag_out1 = color_in1; + frag_out2 = color_in0; +} +END + +SHADER vertex vert_shader_ref0 GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec3 color_in; +layout(location = 0) smooth out vec3 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref0 GLSL +#version 430 +layout(location = 0) smooth in vec3 color_in; +layout(location = 0) out mediump vec3 frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_ref1 GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in uvec2 color_in; +layout(location = 0) flat out uvec2 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref1 GLSL +#version 430 +layout(location = 0) flat in uvec2 color_in; +layout(location = 0) out lowp uvec2 frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_ref2 GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in; +layout(location = 0) smooth out vec4 color_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out = color_in; +} +END + +SHADER fragment frag_shader_ref2 GLSL +#version 430 +layout(location = 0) smooth in vec4 color_in; +layout(location = 0) out highp vec4 frag_out; +void main() +{ + frag_out = color_in; +} +END + +SHADER vertex vert_shader_verify GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec2 texcoord_in; +layout(location = 0) out vec2 texcoord_out; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + texcoord_out = texcoord_in; +} +END + +SHADER fragment frag_shader_verify_vec4 GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + vec4 result = texture(result_sampler, texcoord_in); + vec4 ref = texture(ref_sampler, texcoord_in); + if (result != ref) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +SHADER fragment frag_shader_verify_float GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler2D result_sampler; +uniform layout(set=0, binding=1) sampler2D ref_sampler; +void main() +{ + float result = texture(result_sampler, texcoord_in).x; + float ref = texture(ref_sampler, texcoord_in).x; + if (distance(result, ref) > 0.1) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +SHADER fragment frag_shader_verify_uvec2 GLSL +#version 430 +layout(location = 0) in vec2 texcoord_in; +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) usampler2D result_sampler; +uniform layout(set=0, binding=1) usampler2D ref_sampler; +void main() +{ + uvec2 result = texture(result_sampler, texcoord_in).xy; + uvec2 ref = texture(ref_sampler, texcoord_in).xy; + if (distance(result, ref) > 5) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +BUFFER framebuffer0 FORMAT R16_SFLOAT +BUFFER framebuffer1 FORMAT R8G8_UINT +BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM + +BUFFER ref0 FORMAT R16_SFLOAT +BUFFER ref1 FORMAT R8G8_UINT +BUFFER ref2 FORMAT B8G8R8A8_UNORM + +BUFFER result0 FORMAT B8G8R8A8_UNORM +BUFFER result1 FORMAT B8G8R8A8_UNORM +BUFFER result2 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER texcoord DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA +255 0 0 255 + 0 255 0 255 + 0 0 255 255 +255 255 0 255 +END + +BUFFER color1 DATA_TYPE R8G8_UINT DATA + 0 255 + 0 0 +255 255 +255 0 +END + +BUFFER color2 DATA_TYPE R16_SFLOAT DATA +0.5 +1.0 +0.3 +0.2 +END + +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + VERTEX_DATA color2 LOCATION 3 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + BIND BUFFER framebuffer2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref0 + ATTACH frag_shader_ref0 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color2 LOCATION 1 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref1 + ATTACH frag_shader_ref1 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color1 LOCATION 1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref2 + ATTACH vert_shader_ref2 + ATTACH frag_shader_ref2 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + BIND BUFFER ref2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify0 + ATTACH vert_shader_verify + ATTACH frag_shader_verify_float + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify1 + ATTACH vert_shader_verify + ATTACH frag_shader_verify_uvec2 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_verify2 + ATTACH vert_shader_verify + ATTACH frag_shader_verify_vec4 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoord LOCATION 1 + BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER result2 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + + +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 +EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/draw/output_location/shuffle/inputs-outputs.amber b/vulkan/amber/draw/output_location/shuffle/inputs-outputs.amber new file mode 100644 index 0000000..8c98f81 --- /dev/null +++ b/vulkan/amber/draw/output_location/shuffle/inputs-outputs.amber @@ -0,0 +1,136 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec2 position_in; +layout(location = 1) in vec4 color_in0; +layout(location = 2) in vec4 color_in1; +layout(location = 0) out vec4 color_out0; +layout(location = 1) out vec4 color_out1; + +void main() +{ + gl_Position = vec4(position_in, 0, 1); + color_out0 = color_in0; + color_out1 = color_in1; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) in vec4 color_in0; +layout(location = 1) in vec4 color_in1; +layout(location = 0) out vec4 frag_out0; +layout(location = 1) out vec4 frag_out1; +void main() +{ + if (((int(gl_FragCoord.x) / 5) % 2) == ((int(gl_FragCoord.y) / 5) % 2)) + { + frag_out0 = color_in0; + frag_out1 = color_in1; + } + else + { + frag_out0 = color_in1; + frag_out1 = color_in0; + } +} +END + +SHADER vertex vert_shader_ref PASSTHROUGH + +SHADER fragment frag_shader_ref0 GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +void main() +{ + if (((int(gl_FragCoord.x) / 5) % 2) == ((int(gl_FragCoord.y) / 5) % 2)) + frag_out = vec4(1, 0, 0, 1); + else + frag_out = vec4(0, 1, 0, 1); +} +END + +SHADER fragment frag_shader_ref1 GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +void main() +{ + if (((int(gl_FragCoord.x) / 5) % 2) == ((int(gl_FragCoord.y) / 5) % 2)) + frag_out = vec4(0, 1, 0, 1); + else + frag_out = vec4(1, 0, 0, 1); +} +END + + +BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM +BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM + +BUFFER ref0 FORMAT B8G8R8A8_UNORM +BUFFER ref1 FORMAT B8G8R8A8_UNORM + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END + +BUFFER color0 DATA_TYPE R8G8B8A8_UNORM DATA +255 0 0 255 +255 0 0 255 +255 0 0 255 +255 0 0 255 +END + +BUFFER color1 DATA_TYPE R8G8B8A8_UNORM DATA + 0 255 0 255 + 0 255 0 255 + 0 255 0 255 + 0 255 0 255 +END + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA color0 LOCATION 1 + VERTEX_DATA color1 LOCATION 2 + BIND BUFFER framebuffer0 AS color LOCATION 0 + BIND BUFFER framebuffer1 AS color LOCATION 1 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref0 + ATTACH vert_shader_ref + ATTACH frag_shader_ref0 + BIND BUFFER ref0 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +PIPELINE graphics pipeline_ref1 + ATTACH vert_shader_ref + ATTACH frag_shader_ref1 + BIND BUFFER ref1 AS color LOCATION 0 + FRAMEBUFFER_SIZE 60 60 +END + +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline_ref0 DRAW_RECT POS 0 0 SIZE 60 60 +RUN pipeline_ref1 DRAW_RECT POS 0 0 SIZE 60 60 +EXPECT framebuffer0 EQ_BUFFER ref0 +EXPECT framebuffer1 EQ_BUFFER ref1 diff --git a/vulkan/amber/draw/shader_invocation/helper_invocation.amber b/vulkan/amber/draw/shader_invocation/helper_invocation.amber new file mode 100644 index 0000000..b6d845e --- /dev/null +++ b/vulkan/amber/draw/shader_invocation/helper_invocation.amber @@ -0,0 +1,193 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL TARGET_ENV spv1.3 +#version 460 +#extension GL_EXT_demote_to_helper_invocation : require +#extension GL_KHR_shader_subgroup_quad : require + +layout(binding = 0) readonly buffer Block0 +{ + float alpha[]; +}; + +layout(binding = 1) buffer Block1 +{ + uint atomics[]; +}; + +layout(location = 0) out vec4 color; + +float build_alpha_shuffle(float v) +{ + v = (helperInvocationEXT() ? 8.0 : roundEven(v)); + vec4 helpers; + helpers.x = subgroupQuadBroadcast(v, 0u); + helpers.y = subgroupQuadBroadcast(v, 1u); + helpers.z = subgroupQuadBroadcast(v, 2u); + helpers.w = subgroupQuadBroadcast(v, 3u); + + return dot(helpers, vec4(1, 10, 100, 1000)); +} + +void main() +{ + ivec2 coord = ivec2(gl_FragCoord.xy); + int linear_coord = coord.y * 2 + coord.x; + + float alpha_value = alpha[linear_coord]; + float mask0 = build_alpha_shuffle(alpha_value); + + // Lane 1 and 2 should be nuked by this. + if (fract(alpha_value) < 0.5) + { + demote; + } + + float mask1 = build_alpha_shuffle(alpha_value); + uint last_value = 0u; + + last_value = atomicAdd(atomics[linear_coord], 101u); + + if (linear_coord == 3 || last_value > 1000) + { + demote; + } + + float mask2 = build_alpha_shuffle(alpha_value); + + color = vec4(1.0, mask0, mask1, mask2); +} +END + +SHADER compute comp_shader GLSL +#version 460 +layout(local_size_x=1,local_size_y=1) in; +uniform layout(set=0, binding=0, rgba32f) image2D resultImage; + +layout(set = 0, binding = 1) buffer block0 +{ + vec4 results[]; +}; + +layout(set = 0, binding = 2) readonly buffer Block1 +{ + uvec4 atomics; +}; + +void main() +{ + vec4 colorValues = imageLoad(resultImage, ivec2(0, 0)); + + results[0] = vec4(0.0, .0, 0.0, 0.0); + results[1] = imageLoad(resultImage, ivec2(1, 0)); + results[2] = imageLoad(resultImage, ivec2(0, 1)); + results[3] = imageLoad(resultImage, ivec2(1, 1)); + + // We don't know if the invocations are helpers or not at the start + // and therefore all the possible outcomes are allowed. + for (int x = 0; x < 2; x++) + { + for (int y = 0; y < 2; y++) + { + for (int z = 0; z < 2; z++) + { + for (int w = 0; w < 2; w++) + { + vec4 testVec = vec4(x * 1.0, y * 2.0, z * 3.0, w * 4.0); + uvec4 atomicVec = uvec4(0, 0, 0, 0); + + for (int j = 0; j < 4; j++) + { + if (testVec[j] > 0.0) + { + testVec[j] = 8.0; + atomicVec[j] = 0; + } + else + { + testVec[j] = j + 1.0; + atomicVec[j] = 101; + } + } + + float mask0 = dot(testVec, vec4(1, 10, 100, 1000)); + float mask1 = dot(vec4(testVec.x, 8.0, 8.0, testVec.w), vec4(1, 10, 100, 1000)); + float mask2 = dot(vec4(testVec.x, 8.0, 8.0, 8.0), vec4(1, 10, 100, 1000)); + + atomicVec[1] = 0; + atomicVec[2] = 0; + + if (colorValues.x == 1.0 && atomics.x == atomicVec.x + && colorValues.y == mask0 && atomics.y == atomicVec.y + && colorValues.z == mask1 && atomics.z == atomicVec.z + && colorValues.w == mask2 && atomics.w == atomicVec.w) + { + results[0] = vec4(1.0, 1.0, 1.0, 1.0); + } + } + } + } + } +} +END + +BUFFER alpha_keys DATA_TYPE float DATA + 0.75 + 2.25 + 3.25 + 3.75 +END + +BUFFER atomics DATA_TYPE uint32 DATA + 0 + 0 + 0 + 0 +END + +BUFFER results DATA_TYPE float SIZE 16 FILL 0.0 +BUFFER ref_buffer DATA_TYPE float SIZE 16 FILL 1.0 + +BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics myPipeline + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 2 2 + + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER alpha_keys AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +PIPELINE compute verifyPipeline + ATTACH comp_shader + FRAMEBUFFER_SIZE 2 2 + BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +CLEAR_COLOR myPipeline 255 255 255 255 +CLEAR myPipeline + +RUN myPipeline DRAW_RECT POS 0 0 SIZE 2 2 +RUN verifyPipeline 1 1 1 + +EXPECT results EQ_BUFFER ref_buffer \ No newline at end of file diff --git a/vulkan/amber/draw/shader_invocation/helper_invocation_volatile.amber b/vulkan/amber/draw/shader_invocation/helper_invocation_volatile.amber new file mode 100644 index 0000000..ba72d73 --- /dev/null +++ b/vulkan/amber/draw/shader_invocation/helper_invocation_volatile.amber @@ -0,0 +1,193 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL TARGET_ENV spv1.6 +#version 460 +#extension GL_EXT_demote_to_helper_invocation : require +#extension GL_KHR_shader_subgroup_quad : require + +layout(binding = 0) readonly buffer Block0 +{ + float alpha[]; +}; + +layout(binding = 1) buffer Block1 +{ + uint atomics[]; +}; + +layout(location = 0) out vec4 color; + +float build_alpha_shuffle(float v) +{ + v = (gl_HelperInvocation ? 8.0 : roundEven(v)); + vec4 helpers; + helpers.x = subgroupQuadBroadcast(v, 0u); + helpers.y = subgroupQuadBroadcast(v, 1u); + helpers.z = subgroupQuadBroadcast(v, 2u); + helpers.w = subgroupQuadBroadcast(v, 3u); + + return dot(helpers, vec4(1, 10, 100, 1000)); +} + +void main() +{ + ivec2 coord = ivec2(gl_FragCoord.xy); + int linear_coord = coord.y * 2 + coord.x; + + float alpha_value = alpha[linear_coord]; + float mask0 = build_alpha_shuffle(alpha_value); + + // Lane 1 and 2 should be nuked by this. + if (fract(alpha_value) < 0.5) + { + demote; + } + + float mask1 = build_alpha_shuffle(alpha_value); + uint last_value = 0u; + + last_value = atomicAdd(atomics[linear_coord], 101u); + + if (linear_coord == 3 || last_value > 1000) + { + demote; + } + + float mask2 = build_alpha_shuffle(alpha_value); + + color = vec4(1.0, mask0, mask1, mask2); +} +END + +SHADER compute comp_shader GLSL +#version 460 +layout(local_size_x=1,local_size_y=1) in; +uniform layout(set=0, binding=0, rgba32f) image2D resultImage; + +layout(set = 0, binding = 1) buffer block0 +{ + vec4 results[]; +}; + +layout(set = 0, binding = 2) readonly buffer Block1 +{ + uvec4 atomics; +}; + +void main() +{ + vec4 colorValues = imageLoad(resultImage, ivec2(0, 0)); + + results[0] = vec4(0.0, .0, 0.0, 0.0); + results[1] = imageLoad(resultImage, ivec2(1, 0)); + results[2] = imageLoad(resultImage, ivec2(0, 1)); + results[3] = imageLoad(resultImage, ivec2(1, 1)); + + // We don't know if the invocations are helpers or not at the start + // and therefore all the possible outcomes are allowed. + for (int x = 0; x < 2; x++) + { + for (int y = 0; y < 2; y++) + { + for (int z = 0; z < 2; z++) + { + for (int w = 0; w < 2; w++) + { + vec4 testVec = vec4(x * 1.0, y * 2.0, z * 3.0, w * 4.0); + uvec4 atomicVec = uvec4(0, 0, 0, 0); + + for (int j = 0; j < 4; j++) + { + if (testVec[j] > 0.0) + { + testVec[j] = 8.0; + atomicVec[j] = 0; + } + else + { + testVec[j] = j + 1.0; + atomicVec[j] = 101; + } + } + + float mask0 = dot(testVec, vec4(1, 10, 100, 1000)); + float mask1 = dot(vec4(testVec.x, 8.0, 8.0, testVec.w), vec4(1, 10, 100, 1000)); + float mask2 = dot(vec4(testVec.x, 8.0, 8.0, 8.0), vec4(1, 10, 100, 1000)); + + atomicVec[1] = 0; + atomicVec[2] = 0; + + if (colorValues.x == 1.0 && atomics.x == atomicVec.x + && colorValues.y == mask0 && atomics.y == atomicVec.y + && colorValues.z == mask1 && atomics.z == atomicVec.z + && colorValues.w == mask2 && atomics.w == atomicVec.w) + { + results[0] = vec4(1.0, 1.0, 1.0, 1.0); + } + } + } + } + } +} +END + +BUFFER alpha_keys DATA_TYPE float DATA + 0.75 + 2.25 + 3.25 + 3.75 +END + +BUFFER atomics DATA_TYPE uint32 DATA + 0 + 0 + 0 + 0 +END + +BUFFER results DATA_TYPE float SIZE 16 FILL 0.0 +BUFFER ref_buffer DATA_TYPE float SIZE 16 FILL 1.0 + +BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics myPipeline + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 2 2 + + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER alpha_keys AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +PIPELINE compute verifyPipeline + ATTACH comp_shader + FRAMEBUFFER_SIZE 2 2 + BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +CLEAR_COLOR myPipeline 255 255 255 255 +CLEAR myPipeline + +RUN myPipeline DRAW_RECT POS 0 0 SIZE 2 2 +RUN verifyPipeline 1 1 1 + +EXPECT results EQ_BUFFER ref_buffer diff --git a/vulkan/amber/draw/shader_invocation/helper_invocation_volatile_mem_model.amber b/vulkan/amber/draw/shader_invocation/helper_invocation_volatile_mem_model.amber new file mode 100644 index 0000000..f6d2189 --- /dev/null +++ b/vulkan/amber/draw/shader_invocation/helper_invocation_volatile_mem_model.amber @@ -0,0 +1,194 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL TARGET_ENV spv1.6 +#version 460 +#pragma use_vulkan_memory_model +#extension GL_EXT_demote_to_helper_invocation : require +#extension GL_KHR_shader_subgroup_quad : require + +layout(binding = 0) readonly buffer Block0 +{ + float alpha[]; +}; + +layout(binding = 1) buffer Block1 +{ + uint atomics[]; +}; + +layout(location = 0) out vec4 color; + +float build_alpha_shuffle(float v) +{ + v = (gl_HelperInvocation ? 8.0 : roundEven(v)); + vec4 helpers; + helpers.x = subgroupQuadBroadcast(v, 0u); + helpers.y = subgroupQuadBroadcast(v, 1u); + helpers.z = subgroupQuadBroadcast(v, 2u); + helpers.w = subgroupQuadBroadcast(v, 3u); + + return dot(helpers, vec4(1, 10, 100, 1000)); +} + +void main() +{ + ivec2 coord = ivec2(gl_FragCoord.xy); + int linear_coord = coord.y * 2 + coord.x; + + float alpha_value = alpha[linear_coord]; + float mask0 = build_alpha_shuffle(alpha_value); + + // Lane 1 and 2 should be nuked by this. + if (fract(alpha_value) < 0.5) + { + demote; + } + + float mask1 = build_alpha_shuffle(alpha_value); + uint last_value = 0u; + + last_value = atomicAdd(atomics[linear_coord], 101u); + + if (linear_coord == 3 || last_value > 1000) + { + demote; + } + + float mask2 = build_alpha_shuffle(alpha_value); + + color = vec4(1.0, mask0, mask1, mask2); +} +END + +SHADER compute comp_shader GLSL +#version 460 +layout(local_size_x=1,local_size_y=1) in; +uniform layout(set=0, binding=0, rgba32f) image2D resultImage; + +layout(set = 0, binding = 1) buffer block0 +{ + vec4 results[]; +}; + +layout(set = 0, binding = 2) readonly buffer Block1 +{ + uvec4 atomics; +}; + +void main() +{ + vec4 colorValues = imageLoad(resultImage, ivec2(0, 0)); + + results[0] = vec4(0.0, .0, 0.0, 0.0); + results[1] = imageLoad(resultImage, ivec2(1, 0)); + results[2] = imageLoad(resultImage, ivec2(0, 1)); + results[3] = imageLoad(resultImage, ivec2(1, 1)); + + // We don't know if the invocations are helpers or not at the start + // and therefore all the possible outcomes are allowed. + for (int x = 0; x < 2; x++) + { + for (int y = 0; y < 2; y++) + { + for (int z = 0; z < 2; z++) + { + for (int w = 0; w < 2; w++) + { + vec4 testVec = vec4(x * 1.0, y * 2.0, z * 3.0, w * 4.0); + uvec4 atomicVec = uvec4(0, 0, 0, 0); + + for (int j = 0; j < 4; j++) + { + if (testVec[j] > 0.0) + { + testVec[j] = 8.0; + atomicVec[j] = 0; + } + else + { + testVec[j] = j + 1.0; + atomicVec[j] = 101; + } + } + + float mask0 = dot(testVec, vec4(1, 10, 100, 1000)); + float mask1 = dot(vec4(testVec.x, 8.0, 8.0, testVec.w), vec4(1, 10, 100, 1000)); + float mask2 = dot(vec4(testVec.x, 8.0, 8.0, 8.0), vec4(1, 10, 100, 1000)); + + atomicVec[1] = 0; + atomicVec[2] = 0; + + if (colorValues.x == 1.0 && atomics.x == atomicVec.x + && colorValues.y == mask0 && atomics.y == atomicVec.y + && colorValues.z == mask1 && atomics.z == atomicVec.z + && colorValues.w == mask2 && atomics.w == atomicVec.w) + { + results[0] = vec4(1.0, 1.0, 1.0, 1.0); + } + } + } + } + } +} +END + +BUFFER alpha_keys DATA_TYPE float DATA + 0.75 + 2.25 + 3.25 + 3.75 +END + +BUFFER atomics DATA_TYPE uint32 DATA + 0 + 0 + 0 + 0 +END + +BUFFER results DATA_TYPE float SIZE 16 FILL 0.0 +BUFFER ref_buffer DATA_TYPE float SIZE 16 FILL 1.0 + +BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics myPipeline + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 2 2 + + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER alpha_keys AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +PIPELINE compute verifyPipeline + ATTACH comp_shader + FRAMEBUFFER_SIZE 2 2 + BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +CLEAR_COLOR myPipeline 255 255 255 255 +CLEAR myPipeline + +RUN myPipeline DRAW_RECT POS 0 0 SIZE 2 2 +RUN verifyPipeline 1 1 1 + +EXPECT results EQ_BUFFER ref_buffer diff --git a/vulkan/amber/graphicsfuzz/access-new-vector-inside-if-condition.amber b/vulkan/amber/graphicsfuzz/access-new-vector-inside-if-condition.amber new file mode 100644 index 0000000..3aba1de --- /dev/null +++ b/vulkan/amber/graphicsfuzz/access-new-vector-inside-if-condition.amber @@ -0,0 +1,110 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A shader that accesses a new vector within an if condition + +# The test passes because the shader always writes the color red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int x = 0; +# +# if (vec4(1.0)[clamp(x, 0, 3)] >= 1.0) +# { +# } +# +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %23 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + OpName %23 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %23 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpConstant %10 1 + %13 = OpConstantComposite %11 %12 %12 %12 %12 + %15 = OpConstant %6 3 + %18 = OpTypeBool + %22 = OpTypePointer Output %11 + %23 = OpVariable %22 Output + %24 = OpConstant %10 0 + %25 = OpConstantComposite %11 %12 %24 %24 %12 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %14 = OpLoad %6 %8 + %16 = OpExtInst %6 %1 SClamp %14 %9 %15 + %17 = OpVectorExtractDynamic %10 %13 %16 + %19 = OpFOrdGreaterThanEqual %18 %17 %12 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %21 + %20 = OpLabel + OpBranch %21 + %21 = OpLabel + OpStore %23 %25 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/always-discarding-function.amber b/vulkan/amber/graphicsfuzz/always-discarding-function.amber new file mode 100644 index 0000000..b8bc8f2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/always-discarding-function.amber @@ -0,0 +1,384 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with an always discarding main function + +# The test passes because: the framebuffer is cleared to black, +# the fragment shader always discards, +# and we check that the framebuffer is still black. + +# Optimized using spirv-opt with the following arguments: +# '--private-to-local' +# '--reduce-load-size' +# '--eliminate-dead-code-aggressive' +# '--eliminate-local-multi-store' +# '--eliminate-dead-branches' +# '--merge-return' +# '--private-to-local' +# '--combine-access-chains' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--inline-entry-points-exhaustive' +# '--scalar-replacement=100' +# '--if-conversion' +# '--combine-access-chains' +# '--vector-dce' +# '--vector-dce' +# '--combine-access-chains' +# '--reduce-load-size' +# '--redundancy-elimination' +# '--eliminate-local-multi-store' +# '--vector-dce' +# '--vector-dce' +# spirv-opt commit hash: e82a428605f6ce0a07337b36f8ba3935c9f165ac + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# struct tmp_struct +# { +# int nmb[1]; +# }; +# +# int binarySearch(tmp_struct obj) +# { +# int one = 1; +# +# while (one > 10) +# { +# int zero = one - 1; +# +# if (obj.nmb[zero] == 1) +# return 1; +# +# one = zero; +# } +# +# return -1; +# } +# +# void main() +# { +# tmp_struct obj; +# float tmp_float = injectionSwitch.y; +# vec3 color = vec3(tmp_float); +# +# if (binarySearch(obj) == -1) // Always true +# { +# discard; +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 0.0, 0.0); +# color.yz += vec2(1.0); +# if (injectionSwitch.x > 1.0) +# { +# return; +# } +# } +# _GLF_color = vec4(color, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 159 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %69 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "tmp_struct" + OpMemberName %10 0 "nmb" + OpName %14 "binarySearch(struct-tmp_struct-i1[1]1;" + OpName %13 "obj" + OpName %17 "one" + OpName %28 "zero" + OpName %45 "tmp_float" + OpName %47 "buf0" + OpMemberName %47 0 "injectionSwitch" + OpName %49 "" + OpName %55 "color" + OpName %69 "_GLF_color" + OpMemberDecorate %10 0 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpMemberDecorate %47 0 Offset 0 + OpDecorate %47 Block + OpDecorate %49 DescriptorSet 0 + OpDecorate %49 Binding 0 + OpDecorate %69 Location 0 + OpDecorate %92 RelaxedPrecision + OpDecorate %102 RelaxedPrecision + OpDecorate %111 RelaxedPrecision + OpDecorate %112 RelaxedPrecision + OpDecorate %113 RelaxedPrecision + OpDecorate %114 RelaxedPrecision + OpDecorate %122 RelaxedPrecision + OpDecorate %120 RelaxedPrecision + OpDecorate %128 RelaxedPrecision + OpDecorate %137 RelaxedPrecision + OpDecorate %144 RelaxedPrecision + OpDecorate %143 RelaxedPrecision + OpDecorate %154 RelaxedPrecision + OpDecorate %153 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 1 + %9 = OpTypeArray %6 %8 + %10 = OpTypeStruct %9 + %11 = OpTypePointer Function %10 + %12 = OpTypeFunction %6 %11 + %16 = OpTypePointer Function %6 + %18 = OpConstant %6 1 + %25 = OpConstant %6 10 + %26 = OpTypeBool + %31 = OpConstant %6 0 + %40 = OpConstant %6 -1 + %43 = OpTypeFloat 32 + %44 = OpTypePointer Function %43 + %46 = OpTypeVector %43 2 + %47 = OpTypeStruct %46 + %48 = OpTypePointer Uniform %47 + %49 = OpVariable %48 Uniform + %50 = OpTypePointer Uniform %43 + %53 = OpTypeVector %43 3 + %54 = OpTypePointer Function %53 + %67 = OpTypeVector %43 4 + %68 = OpTypePointer Output %67 + %69 = OpVariable %68 Output + %70 = OpConstant %43 0 + %71 = OpConstantComposite %67 %70 %70 %70 %70 + %72 = OpConstant %43 1 + %73 = OpConstantComposite %46 %72 %72 + %79 = OpConstant %7 0 + %91 = OpUndef %10 + %97 = OpConstantFalse %26 + %98 = OpTypePointer Function %26 + %100 = OpConstantTrue %26 + %135 = OpConstantNull %9 + %136 = OpTypePointer Function %9 + %148 = OpUndef %6 + %149 = OpUndef %26 + %157 = OpUndef %6 + %158 = OpUndef %26 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %137 = OpVariable %136 Function + %110 = OpVariable %98 Function %97 + %111 = OpVariable %16 Function + %112 = OpVariable %16 Function + %113 = OpVariable %16 Function + %114 = OpVariable %16 Function + %99 = OpVariable %98 Function %97 + %45 = OpVariable %44 Function + %55 = OpVariable %54 Function + OpBranch %94 + %94 = OpLabel + OpLoopMerge %93 %96 None + OpBranch %95 + %95 = OpLabel + %51 = OpAccessChain %50 %49 %31 %8 + %52 = OpLoad %43 %51 + OpStore %45 %52 + %57 = OpCompositeConstruct %53 %52 %52 %52 + OpStore %55 %57 + %138 = OpCompositeExtract %9 %91 0 + OpStore %137 %138 + OpStore %110 %97 + OpBranch %115 + %115 = OpLabel + %142 = OpPhi %26 %97 %95 %149 %117 + OpLoopMerge %116 %117 None + OpBranch %118 + %118 = OpLabel + OpStore %112 %18 + OpBranch %119 + %119 = OpLabel + %122 = OpPhi %6 %18 %118 %120 %121 + OpLoopMerge %123 %121 None + OpBranch %124 + %124 = OpLabel + %125 = OpSGreaterThan %26 %122 %25 + OpBranchConditional %125 %126 %123 + %126 = OpLabel + %120 = OpISub %6 %122 %18 + OpStore %113 %120 + %139 = OpAccessChain %16 %137 %120 + %128 = OpLoad %6 %139 + %129 = OpIEqual %26 %128 %18 + OpSelectionMerge %130 None + OpBranchConditional %129 %131 %130 + %131 = OpLabel + OpStore %110 %100 + OpStore %111 %18 + OpBranch %123 + %130 = OpLabel + OpStore %112 %120 + OpBranch %121 + %121 = OpLabel + OpBranch %119 + %123 = OpLabel + %144 = OpPhi %6 %148 %124 %18 %131 + %140 = OpPhi %26 %142 %124 %100 %131 + OpSelectionMerge %133 None + OpBranchConditional %140 %116 %133 + %133 = OpLabel + OpStore %110 %100 + OpStore %111 %40 + OpBranch %116 + %117 = OpLabel + OpBranch %115 + %116 = OpLabel + %143 = OpPhi %6 %144 %123 %40 %133 + OpStore %114 %143 + %62 = OpIEqual %26 %143 %40 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %66 + %63 = OpLabel + OpTerminateInvocation + %66 = OpLabel + OpStore %69 %71 + %75 = OpVectorShuffle %46 %57 %57 1 2 + %76 = OpFAdd %46 %75 %73 + %78 = OpVectorShuffle %53 %57 %76 0 3 4 + OpStore %55 %78 + %80 = OpAccessChain %50 %49 %31 %79 + %81 = OpLoad %43 %80 + %82 = OpFOrdGreaterThan %26 %81 %72 + OpSelectionMerge %84 None + OpBranchConditional %82 %83 %84 + %83 = OpLabel + OpStore %99 %100 + OpBranch %93 + %84 = OpLabel + OpBranch %64 + %64 = OpLabel + %87 = OpCompositeExtract %43 %78 0 + %88 = OpCompositeExtract %43 %78 1 + %89 = OpCompositeExtract %43 %78 2 + %90 = OpCompositeConstruct %67 %87 %88 %89 %72 + OpStore %69 %90 + OpStore %99 %100 + OpBranch %93 + %96 = OpLabel + OpBranch %94 + %93 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %6 None %12 + %13 = OpFunctionParameter %11 + %15 = OpLabel + %107 = OpVariable %98 Function %97 + %102 = OpVariable %16 Function + %17 = OpVariable %16 Function + %28 = OpVariable %16 Function + OpBranch %104 + %104 = OpLabel + %152 = OpPhi %26 %97 %15 %158 %106 + OpLoopMerge %101 %106 None + OpBranch %105 + %105 = OpLabel + OpStore %17 %18 + OpBranch %19 + %19 = OpLabel + %92 = OpPhi %6 %18 %105 %30 %22 + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %27 = OpSGreaterThan %26 %92 %25 + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %30 = OpISub %6 %92 %18 + OpStore %28 %30 + %33 = OpAccessChain %16 %13 %31 %30 + %34 = OpLoad %6 %33 + %35 = OpIEqual %26 %34 %18 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %37 + %36 = OpLabel + OpStore %107 %100 + OpStore %102 %18 + OpBranch %21 + %37 = OpLabel + OpStore %17 %30 + OpBranch %22 + %22 = OpLabel + OpBranch %19 + %21 = OpLabel + %154 = OpPhi %6 %157 %23 %18 %36 + %150 = OpPhi %26 %152 %23 %100 %36 + OpSelectionMerge %108 None + OpBranchConditional %150 %101 %108 + %108 = OpLabel + OpStore %107 %100 + OpStore %102 %40 + OpBranch %101 + %106 = OpLabel + OpBranch %104 + %101 = OpLabel + %153 = OpPhi %6 %154 %21 %40 %108 + OpReturnValue %153 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 0 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/always-false-if-in-do-while.amber b/vulkan/amber/graphicsfuzz/always-false-if-in-do-while.amber new file mode 100644 index 0000000..af5dce9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/always-false-if-in-do-while.amber @@ -0,0 +1,206 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with an always false if. + +# The test passes because the shader always writes color red. +# Function brick() writes red in the beginning and returns in the end. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--inline-entry-points-exhaustive' +# '--scalar-replacement=100' +# '--eliminate-local-single-block' +# '--eliminate-local-single-block' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-code-aggressive' +# '--eliminate-dead-branches' +# '--convert-local-access-chains' +# '--scalar-replacement=100' +# '--reduce-load-size' +# '--scalar-replacement=100' +# '--redundancy-elimination' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-branches' +# '--vector-dce' +# '--eliminate-local-single-block' +# '--private-to-local' +# '--copy-propagate-arrays' +# '--eliminate-dead-branches' +# '--redundancy-elimination' +# '--vector-dce' +# '--scalar-replacement=100' +# '--eliminate-local-multi-store' +# '--scalar-replacement=100' +# '--redundancy-elimination' +# '--redundancy-elimination' +# '--copy-propagate-arrays' +# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec2 brick(vec2 uv) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Write color red +# +# int a; +# do +# { +# if (injectionSwitch.y < 0.0) // Always false +# { +# return vec2(1.0); +# } +# uv.y -= 1.0; +# } while (false); +# +# uv.y -= 1.0; +# return vec2(1.0); +# } +# +# void main() +# { +# brick(vec2(1.0)); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 54 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %15 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "brick(vf2;" + OpName %10 "uv" + OpName %15 "_GLF_color" + OpName %23 "buf0" + OpMemberName %23 0 "injectionSwitch" + OpName %25 "" + OpName %51 "param" + OpDecorate %15 Location 0 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %7 %8 + %13 = OpTypeVector %6 4 + %14 = OpTypePointer Output %13 + %15 = OpVariable %14 Output + %16 = OpConstant %6 1 + %17 = OpConstant %6 0 + %18 = OpConstantComposite %13 %16 %17 %17 %16 + %23 = OpTypeStruct %7 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpTypeInt 32 1 + %27 = OpConstant %26 0 + %28 = OpTypeInt 32 0 + %29 = OpConstant %28 1 + %30 = OpTypePointer Uniform %6 + %33 = OpTypeBool + %37 = OpConstantComposite %7 %16 %16 + %39 = OpTypePointer Function %6 + %44 = OpConstantFalse %33 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %51 = OpVariable %8 Function + OpStore %51 %37 + %52 = OpFunctionCall %7 %11 %51 + OpReturn + OpFunctionEnd + %11 = OpFunction %7 None %9 + %10 = OpFunctionParameter %8 + %12 = OpLabel + OpStore %15 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %36 None + OpBranch %20 + %20 = OpLabel + %31 = OpAccessChain %30 %25 %27 %29 + %32 = OpLoad %6 %31 + %34 = OpFOrdLessThan %33 %32 %17 + OpSelectionMerge %53 None + OpBranchConditional %34 %35 %36 + %35 = OpLabel + OpReturnValue %37 + %53 = OpLabel + OpBranch %36 + %36 = OpLabel + %40 = OpAccessChain %39 %10 %29 + %41 = OpLoad %6 %40 + %42 = OpFSub %6 %41 %16 + OpStore %40 %42 + OpBranchConditional %44 %19 %21 + %21 = OpLabel + %46 = OpLoad %6 %40 + %47 = OpFSub %6 %46 %16 + OpStore %40 %47 + OpReturnValue %37 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/always-false-if-with-discard-return.amber b/vulkan/amber/graphicsfuzz/always-false-if-with-discard-return.amber new file mode 100644 index 0000000..142c90c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/always-false-if-with-discard-return.amber @@ -0,0 +1,154 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with discard keyword and a return + +# The test passes because main always writes the color red; the discard statement is unreachable. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# vec3 drawShape() +# { +# discard; +# return vec3(1.0); +# } +# vec3 computePoint() +# { +# drawShape(); +# return vec3(1.0); +# } +# void main() +# { +# if (injectionSwitch.x > injectionSwitch.y) // always false +# { +# drawShape(); +# computePoint(); +# } +# +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %43 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "drawShape(" + OpName %11 "computePoint(" + OpName %22 "buf0" + OpMemberName %22 0 "injectionSwitch" + OpName %24 "" + OpName %43 "_GLF_color" + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %43 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeFunction %7 + %14 = OpConstant %6 1 + %15 = OpConstantComposite %7 %14 %14 %14 + %21 = OpTypeVector %6 2 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpTypeInt 32 1 + %26 = OpConstant %25 0 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %29 = OpTypePointer Uniform %6 + %32 = OpConstant %27 1 + %35 = OpTypeBool + %41 = OpTypeVector %6 4 + %42 = OpTypePointer Output %41 + %43 = OpVariable %42 Output + %44 = OpConstant %6 0 + %45 = OpConstantComposite %41 %14 %44 %44 %14 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %30 = OpAccessChain %29 %24 %26 %28 + %31 = OpLoad %6 %30 + %33 = OpAccessChain %29 %24 %26 %32 + %34 = OpLoad %6 %33 + %36 = OpFOrdGreaterThan %35 %31 %34 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + %39 = OpFunctionCall %7 %9 + %40 = OpFunctionCall %7 %11 + OpBranch %38 + %38 = OpLabel + OpStore %43 %45 + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + OpTerminateInvocation + OpFunctionEnd + %11 = OpFunction %7 None %8 + %12 = OpLabel + %18 = OpFunctionCall %7 %9 + OpReturnValue %15 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/arr-value-set-to-arr-value-squared.amber b/vulkan/amber/graphicsfuzz/arr-value-set-to-arr-value-squared.amber new file mode 100644 index 0000000..6eddecd --- /dev/null +++ b/vulkan/amber/graphicsfuzz/arr-value-set-to-arr-value-squared.amber @@ -0,0 +1,436 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with an arr value set to itself squared + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct QuicksortObject { +# int numbers[10]; +# } ; +# +# QuicksortObject obj; +# +# void swap(int i, int j) +# { +# int temp = obj.numbers[i]; +# obj.numbers[i] = obj.numbers[j]; +# obj.numbers[j] = temp; +# } +# int performPartition(int l, int h) +# { +# int pivot = obj.numbers[h]; +# int i = (l - 1); +# for( +# int j = l; +# j <= h - 1; +# j ++ +# ) +# { +# if(obj.numbers[j] <= pivot) +# { +# i ++; +# swap(i, j); +# } +# } +# swap(i + 1, h); +# return (i + 1); +# } +# void quicksort() +# { +# int l = 0, h = 9; +# int stack[10]; +# int top = - 1; +# stack[++ top] = l; +# stack[++ top] = h; +# while(top >= 0) +# { +# h = stack[top --]; +# l = stack[top --]; +# int p = performPartition(l, h); +# if(p - 1 > l) +# { +# stack[++ top] = l; +# stack[++ top] = p - 1; +# } +# if(p + 1 < h) +# { +# stack[++ top] = p + 1; +# stack[++ top] = h; +# } +# } +# } +# void main() +# { +# for( +# int i = 0; +# i < 10; +# i ++ +# ) +# { +# obj.numbers[i] = (10 - i); +# obj.numbers[i] = obj.numbers[i] * obj.numbers[i]; +# } +# quicksort(); +# +# if (obj.numbers[0] < obj.numbers[4]) +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# else +# _GLF_color = vec4(0.0, 1.0, 0.0, 1.0); +# +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 198 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %188 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "swap(i1;i1;" + OpName %9 "i" + OpName %10 "j" + OpName %16 "performPartition(i1;i1;" + OpName %14 "l" + OpName %15 "h" + OpName %18 "quicksort(" + OpName %20 "temp" + OpName %24 "QuicksortObject" + OpMemberName %24 0 "numbers" + OpName %26 "obj" + OpName %40 "pivot" + OpName %44 "i" + OpName %48 "j" + OpName %69 "param" + OpName %71 "param" + OpName %78 "param" + OpName %79 "param" + OpName %86 "l" + OpName %87 "h" + OpName %89 "top" + OpName %92 "stack" + OpName %116 "p" + OpName %117 "param" + OpName %119 "param" + OpName %152 "i" + OpName %188 "_GLF_color" + OpDecorate %188 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeFunction %6 %7 %7 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 0 + %29 = OpTypePointer Private %6 + %46 = OpConstant %6 1 + %58 = OpTypeBool + %88 = OpConstant %6 9 + %90 = OpConstant %6 -1 + %91 = OpTypePointer Function %23 + %159 = OpConstant %6 10 + %179 = OpConstant %6 4 + %185 = OpTypeFloat 32 + %186 = OpTypeVector %185 4 + %187 = OpTypePointer Output %186 + %188 = OpVariable %187 Output + %189 = OpConstant %185 1 + %190 = OpConstant %185 0 + %191 = OpConstantComposite %186 %189 %190 %190 %189 + %193 = OpConstantComposite %186 %190 %189 %190 %189 + %194 = OpTypeVector %185 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %152 = OpVariable %7 Function + OpStore %152 %27 + OpBranch %153 + %153 = OpLabel + OpLoopMerge %155 %156 None + OpBranch %157 + %157 = OpLabel + %158 = OpLoad %6 %152 + %160 = OpSLessThan %58 %158 %159 + OpBranchConditional %160 %154 %155 + %154 = OpLabel + %161 = OpLoad %6 %152 + %162 = OpLoad %6 %152 + %163 = OpISub %6 %159 %162 + %164 = OpAccessChain %29 %26 %27 %161 + OpStore %164 %163 + %165 = OpLoad %6 %152 + %166 = OpLoad %6 %152 + %167 = OpAccessChain %29 %26 %27 %166 + %168 = OpLoad %6 %167 + %169 = OpLoad %6 %152 + %170 = OpAccessChain %29 %26 %27 %169 + %171 = OpLoad %6 %170 + %172 = OpIMul %6 %168 %171 + %173 = OpAccessChain %29 %26 %27 %165 + OpStore %173 %172 + OpBranch %156 + %156 = OpLabel + %174 = OpLoad %6 %152 + %175 = OpIAdd %6 %174 %46 + OpStore %152 %175 + OpBranch %153 + %155 = OpLabel + %176 = OpFunctionCall %2 %18 + %177 = OpAccessChain %29 %26 %27 %27 + %178 = OpLoad %6 %177 + %180 = OpAccessChain %29 %26 %27 %179 + %181 = OpLoad %6 %180 + %182 = OpSLessThan %58 %178 %181 + OpSelectionMerge %184 None + OpBranchConditional %182 %183 %192 + %183 = OpLabel + OpStore %188 %191 + OpBranch %184 + %192 = OpLabel + OpStore %188 %193 + OpBranch %184 + %184 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %20 = OpVariable %7 Function + %28 = OpLoad %6 %9 + %30 = OpAccessChain %29 %26 %27 %28 + %31 = OpLoad %6 %30 + OpStore %20 %31 + %32 = OpLoad %6 %9 + %33 = OpLoad %6 %10 + %34 = OpAccessChain %29 %26 %27 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %29 %26 %27 %32 + OpStore %36 %35 + %37 = OpLoad %6 %10 + %38 = OpLoad %6 %20 + %39 = OpAccessChain %29 %26 %27 %37 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %16 = OpFunction %6 None %13 + %14 = OpFunctionParameter %7 + %15 = OpFunctionParameter %7 + %17 = OpLabel + %40 = OpVariable %7 Function + %44 = OpVariable %7 Function + %48 = OpVariable %7 Function + %69 = OpVariable %7 Function + %71 = OpVariable %7 Function + %78 = OpVariable %7 Function + %79 = OpVariable %7 Function + %41 = OpLoad %6 %15 + %42 = OpAccessChain %29 %26 %27 %41 + %43 = OpLoad %6 %42 + OpStore %40 %43 + %45 = OpLoad %6 %14 + %47 = OpISub %6 %45 %46 + OpStore %44 %47 + %49 = OpLoad %6 %14 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %48 + %56 = OpLoad %6 %15 + %57 = OpISub %6 %56 %46 + %59 = OpSLessThanEqual %58 %55 %57 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %48 + %61 = OpAccessChain %29 %26 %27 %60 + %62 = OpLoad %6 %61 + %63 = OpLoad %6 %40 + %64 = OpSLessThanEqual %58 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpLoad %6 %44 + %68 = OpIAdd %6 %67 %46 + OpStore %44 %68 + %70 = OpLoad %6 %44 + OpStore %69 %70 + %72 = OpLoad %6 %48 + OpStore %71 %72 + %73 = OpFunctionCall %2 %11 %69 %71 + OpBranch %66 + %66 = OpLabel + OpBranch %53 + %53 = OpLabel + %74 = OpLoad %6 %48 + %75 = OpIAdd %6 %74 %46 + OpStore %48 %75 + OpBranch %50 + %52 = OpLabel + %76 = OpLoad %6 %44 + %77 = OpIAdd %6 %76 %46 + OpStore %78 %77 + %80 = OpLoad %6 %15 + OpStore %79 %80 + %81 = OpFunctionCall %2 %11 %78 %79 + %82 = OpLoad %6 %44 + %83 = OpIAdd %6 %82 %46 + OpReturnValue %83 + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %86 = OpVariable %7 Function + %87 = OpVariable %7 Function + %89 = OpVariable %7 Function + %92 = OpVariable %91 Function + %116 = OpVariable %7 Function + %117 = OpVariable %7 Function + %119 = OpVariable %7 Function + OpStore %86 %27 + OpStore %87 %88 + OpStore %89 %90 + %93 = OpLoad %6 %89 + %94 = OpIAdd %6 %93 %46 + OpStore %89 %94 + %95 = OpLoad %6 %86 + %96 = OpAccessChain %7 %92 %94 + OpStore %96 %95 + %97 = OpLoad %6 %89 + %98 = OpIAdd %6 %97 %46 + OpStore %89 %98 + %99 = OpLoad %6 %87 + %100 = OpAccessChain %7 %92 %98 + OpStore %100 %99 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %6 %89 + %107 = OpSGreaterThanEqual %58 %106 %27 + OpBranchConditional %107 %102 %103 + %102 = OpLabel + %108 = OpLoad %6 %89 + %109 = OpISub %6 %108 %46 + OpStore %89 %109 + %110 = OpAccessChain %7 %92 %108 + %111 = OpLoad %6 %110 + OpStore %87 %111 + %112 = OpLoad %6 %89 + %113 = OpISub %6 %112 %46 + OpStore %89 %113 + %114 = OpAccessChain %7 %92 %112 + %115 = OpLoad %6 %114 + OpStore %86 %115 + %118 = OpLoad %6 %86 + OpStore %117 %118 + %120 = OpLoad %6 %87 + OpStore %119 %120 + %121 = OpFunctionCall %6 %16 %117 %119 + OpStore %116 %121 + %122 = OpLoad %6 %116 + %123 = OpISub %6 %122 %46 + %124 = OpLoad %6 %86 + %125 = OpSGreaterThan %58 %123 %124 + OpSelectionMerge %127 None + OpBranchConditional %125 %126 %127 + %126 = OpLabel + %128 = OpLoad %6 %89 + %129 = OpIAdd %6 %128 %46 + OpStore %89 %129 + %130 = OpLoad %6 %86 + %131 = OpAccessChain %7 %92 %129 + OpStore %131 %130 + %132 = OpLoad %6 %89 + %133 = OpIAdd %6 %132 %46 + OpStore %89 %133 + %134 = OpLoad %6 %116 + %135 = OpISub %6 %134 %46 + %136 = OpAccessChain %7 %92 %133 + OpStore %136 %135 + OpBranch %127 + %127 = OpLabel + %137 = OpLoad %6 %116 + %138 = OpIAdd %6 %137 %46 + %139 = OpLoad %6 %87 + %140 = OpSLessThan %58 %138 %139 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpLoad %6 %89 + %144 = OpIAdd %6 %143 %46 + OpStore %89 %144 + %145 = OpLoad %6 %116 + %146 = OpIAdd %6 %145 %46 + %147 = OpAccessChain %7 %92 %144 + OpStore %147 %146 + %148 = OpLoad %6 %89 + %149 = OpIAdd %6 %148 %46 + OpStore %89 %149 + %150 = OpLoad %6 %87 + %151 = OpAccessChain %7 %92 %149 + OpStore %151 %150 + OpBranch %142 + %142 = OpLabel + OpBranch %104 + %104 = OpLabel + OpBranch %101 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/array-idx-multiplied-by-for-loop-idx.amber b/vulkan/amber/graphicsfuzz/array-idx-multiplied-by-for-loop-idx.amber new file mode 100644 index 0000000..e834eba --- /dev/null +++ b/vulkan/amber/graphicsfuzz/array-idx-multiplied-by-for-loop-idx.amber @@ -0,0 +1,298 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with array index multiplied + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Function always returns 5.0. +# float func() +# { +# if (gl_FragCoord.x < 1.0) +# return 5.0; +# +# // Always false. +# if (injectionSwitch.x > injectionSwitch.y) +# return 1.0; +# +# int x = int(injectionSwitch.x); +# +# x += int(clamp(injectionSwitch.x, 0.0, 1.0)) * 3; +# +# return 5.0 + float(x); +# } +# +# void main() +# { +# vec2 data[17]; +# +# for (int i = 0; i < 4 + int(injectionSwitch.x); i++) +# { +# // Always true. +# if (gl_FragCoord.x >= 0.0) +# { +# for (int j = 0; j < 4; j++) +# { +# data[4 * j + i].x = func(); +# +# // Always true. +# if (data[0].x == 5.0 || data[15].x == 5.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# +# // Always false. +# if (injectionSwitch.x > injectionSwitch.y) +# return; +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 128 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %111 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "func(" + OpName %12 "gl_FragCoord" + OpName %26 "buf0" + OpMemberName %26 0 "injectionSwitch" + OpName %28 "" + OpName %42 "x" + OpName %60 "i" + OpName %78 "j" + OpName %89 "data" + OpName %111 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 0 + OpDecorate %111 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Input %6 + %18 = OpConstant %6 1 + %19 = OpTypeBool + %23 = OpConstant %6 5 + %25 = OpTypeVector %6 2 + %26 = OpTypeStruct %25 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpTypeInt 32 1 + %30 = OpConstant %29 0 + %31 = OpTypePointer Uniform %6 + %34 = OpConstant %13 1 + %41 = OpTypePointer Function %29 + %48 = OpConstant %6 0 + %51 = OpConstant %29 3 + %67 = OpConstant %29 4 + %86 = OpConstant %13 17 + %87 = OpTypeArray %25 %86 + %88 = OpTypePointer Function %87 + %95 = OpTypePointer Function %6 + %103 = OpConstant %29 15 + %110 = OpTypePointer Output %10 + %111 = OpVariable %110 Output + %112 = OpConstantComposite %10 %18 %48 %48 %18 + %114 = OpConstantComposite %10 %48 %48 %48 %48 + %124 = OpConstant %29 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %60 = OpVariable %41 Function + %78 = OpVariable %41 Function + %89 = OpVariable %88 Function + OpStore %60 %30 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %66 = OpLoad %29 %60 + %68 = OpAccessChain %31 %28 %30 %14 + %69 = OpLoad %6 %68 + %70 = OpConvertFToS %29 %69 + %71 = OpIAdd %29 %67 %70 + %72 = OpSLessThan %19 %66 %71 + OpBranchConditional %72 %62 %63 + %62 = OpLabel + %73 = OpAccessChain %15 %12 %14 + %74 = OpLoad %6 %73 + %75 = OpFOrdGreaterThanEqual %19 %74 %48 + OpSelectionMerge %77 None + OpBranchConditional %75 %76 %77 + %76 = OpLabel + OpStore %78 %30 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %29 %78 + %85 = OpSLessThan %19 %84 %67 + OpBranchConditional %85 %80 %81 + %80 = OpLabel + %90 = OpLoad %29 %78 + %91 = OpIMul %29 %67 %90 + %92 = OpLoad %29 %60 + %93 = OpIAdd %29 %91 %92 + %94 = OpFunctionCall %6 %8 + %96 = OpAccessChain %95 %89 %93 %14 + OpStore %96 %94 + %97 = OpAccessChain %95 %89 %30 %14 + %98 = OpLoad %6 %97 + %99 = OpFOrdEqual %19 %98 %23 + %100 = OpLogicalNot %19 %99 + OpSelectionMerge %102 None + OpBranchConditional %100 %101 %102 + %101 = OpLabel + %104 = OpAccessChain %95 %89 %103 %14 + %105 = OpLoad %6 %104 + %106 = OpFOrdEqual %19 %105 %23 + OpBranch %102 + %102 = OpLabel + %107 = OpPhi %19 %99 %80 %106 %101 + OpSelectionMerge %109 None + OpBranchConditional %107 %108 %113 + %108 = OpLabel + OpStore %111 %112 + OpBranch %109 + %113 = OpLabel + OpStore %111 %114 + OpBranch %109 + %109 = OpLabel + %115 = OpAccessChain %31 %28 %30 %14 + %116 = OpLoad %6 %115 + %117 = OpAccessChain %31 %28 %30 %34 + %118 = OpLoad %6 %117 + %119 = OpFOrdGreaterThan %19 %116 %118 + OpSelectionMerge %121 None + OpBranchConditional %119 %120 %121 + %120 = OpLabel + OpReturn + %121 = OpLabel + OpBranch %82 + %82 = OpLabel + %123 = OpLoad %29 %78 + %125 = OpIAdd %29 %123 %124 + OpStore %78 %125 + OpBranch %79 + %81 = OpLabel + OpBranch %77 + %77 = OpLabel + OpBranch %64 + %64 = OpLabel + %126 = OpLoad %29 %60 + %127 = OpIAdd %29 %126 %124 + OpStore %60 %127 + OpBranch %61 + %63 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %42 = OpVariable %41 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %6 %16 + %20 = OpFOrdLessThan %19 %17 %18 + OpSelectionMerge %22 None + OpBranchConditional %20 %21 %22 + %21 = OpLabel + OpReturnValue %23 + %22 = OpLabel + %32 = OpAccessChain %31 %28 %30 %14 + %33 = OpLoad %6 %32 + %35 = OpAccessChain %31 %28 %30 %34 + %36 = OpLoad %6 %35 + %37 = OpFOrdGreaterThan %19 %33 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + OpReturnValue %18 + %39 = OpLabel + %43 = OpAccessChain %31 %28 %30 %14 + %44 = OpLoad %6 %43 + %45 = OpConvertFToS %29 %44 + OpStore %42 %45 + %46 = OpAccessChain %31 %28 %30 %14 + %47 = OpLoad %6 %46 + %49 = OpExtInst %6 %1 FClamp %47 %48 %18 + %50 = OpConvertFToS %29 %49 + %52 = OpIMul %29 %50 %51 + %53 = OpLoad %29 %42 + %54 = OpIAdd %29 %53 %52 + OpStore %42 %54 + %55 = OpLoad %29 %42 + %56 = OpConvertSToF %6 %55 + %57 = OpFAdd %6 %23 %56 + OpReturnValue %57 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/assign-array-value-to-another-array-2.amber b/vulkan/amber/graphicsfuzz/assign-array-value-to-another-array-2.amber new file mode 100644 index 0000000..80c553e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/assign-array-value-to-another-array-2.amber @@ -0,0 +1,301 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader that assigns array values to other array + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int data[9], temp[7]; +# +# // Returns 1.0. +# float func(int a) +# { +# int b = 0; +# +# data[0] = 5; +# data[2] = 0; +# data[4] = 0; +# data[6] = 0; +# data[8] = 0; +# +# // Always true. +# if (gl_FragCoord.x >= 0.0) +# { +# while (b <= a) +# { +# if (b <= 5) { +# // When b == 0, a value of data[0] is given to +# // temp[0], making it's value 5. +# temp[b] = data[b]; +# b += 2; +# } +# } +# } +# +# for (int i = 0; i < 3; i++) +# // On first iteration data[0] value is set to +# // temp[0] + 1, which will be: 5 + 1 == 6. +# data[i] = temp[0] + 1; +# +# // Always true. +# if (temp[0] == 5 && data[0] == 6) +# return 1.0; +# else +# return 0.0; +# } +# +# void main() +# { +# for (int i = 0; i < 6; i++) +# { +# func(i); +# +# // Always true. +# if(func(i) == 1.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 123 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 %117 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "func(i1;" + OpName %10 "a" + OpName %13 "b" + OpName %19 "data" + OpName %33 "gl_FragCoord" + OpName %58 "temp" + OpName %66 "i" + OpName %99 "i" + OpName %107 "param" + OpName %110 "param" + OpName %117 "_GLF_color" + OpDecorate %33 BuiltIn FragCoord + OpDecorate %117 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFloat 32 + %9 = OpTypeFunction %8 %7 + %14 = OpConstant %6 0 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 9 + %17 = OpTypeArray %6 %16 + %18 = OpTypePointer Private %17 + %19 = OpVariable %18 Private + %20 = OpConstant %6 5 + %21 = OpTypePointer Private %6 + %23 = OpConstant %6 2 + %25 = OpConstant %6 4 + %27 = OpConstant %6 6 + %29 = OpConstant %6 8 + %31 = OpTypeVector %8 4 + %32 = OpTypePointer Input %31 + %33 = OpVariable %32 Input + %34 = OpConstant %15 0 + %35 = OpTypePointer Input %8 + %38 = OpConstant %8 0 + %39 = OpTypeBool + %55 = OpConstant %15 7 + %56 = OpTypeArray %6 %55 + %57 = OpTypePointer Private %56 + %58 = OpVariable %57 Private + %73 = OpConstant %6 3 + %78 = OpConstant %6 1 + %94 = OpConstant %8 1 + %116 = OpTypePointer Output %31 + %117 = OpVariable %116 Output + %118 = OpConstantComposite %31 %94 %38 %38 %94 + %120 = OpConstantComposite %31 %38 %38 %38 %38 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %99 = OpVariable %7 Function + %107 = OpVariable %7 Function + %110 = OpVariable %7 Function + OpStore %99 %14 + OpBranch %100 + %100 = OpLabel + OpLoopMerge %102 %103 None + OpBranch %104 + %104 = OpLabel + %105 = OpLoad %6 %99 + %106 = OpSLessThan %39 %105 %27 + OpBranchConditional %106 %101 %102 + %101 = OpLabel + %108 = OpLoad %6 %99 + OpStore %107 %108 + %109 = OpFunctionCall %8 %11 %107 + %111 = OpLoad %6 %99 + OpStore %110 %111 + %112 = OpFunctionCall %8 %11 %110 + %113 = OpFOrdEqual %39 %112 %94 + OpSelectionMerge %115 None + OpBranchConditional %113 %114 %119 + %114 = OpLabel + OpStore %117 %118 + OpBranch %115 + %119 = OpLabel + OpStore %117 %120 + OpBranch %115 + %115 = OpLabel + OpBranch %103 + %103 = OpLabel + %121 = OpLoad %6 %99 + %122 = OpIAdd %6 %121 %78 + OpStore %99 %122 + OpBranch %100 + %102 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %8 None %9 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %13 = OpVariable %7 Function + %66 = OpVariable %7 Function + OpStore %13 %14 + %22 = OpAccessChain %21 %19 %14 + OpStore %22 %20 + %24 = OpAccessChain %21 %19 %23 + OpStore %24 %14 + %26 = OpAccessChain %21 %19 %25 + OpStore %26 %14 + %28 = OpAccessChain %21 %19 %27 + OpStore %28 %14 + %30 = OpAccessChain %21 %19 %29 + OpStore %30 %14 + %36 = OpAccessChain %35 %33 %34 + %37 = OpLoad %8 %36 + %40 = OpFOrdGreaterThanEqual %39 %37 %38 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %42 + %41 = OpLabel + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %6 %13 + %49 = OpLoad %6 %10 + %50 = OpSLessThanEqual %39 %48 %49 + OpBranchConditional %50 %44 %45 + %44 = OpLabel + %51 = OpLoad %6 %13 + %52 = OpSLessThanEqual %39 %51 %20 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + %59 = OpLoad %6 %13 + %60 = OpLoad %6 %13 + %61 = OpAccessChain %21 %19 %60 + %62 = OpLoad %6 %61 + %63 = OpAccessChain %21 %58 %59 + OpStore %63 %62 + %64 = OpLoad %6 %13 + %65 = OpIAdd %6 %64 %23 + OpStore %13 %65 + OpBranch %54 + %54 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %42 + %42 = OpLabel + OpStore %66 %14 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %72 = OpLoad %6 %66 + %74 = OpSLessThan %39 %72 %73 + OpBranchConditional %74 %68 %69 + %68 = OpLabel + %75 = OpLoad %6 %66 + %76 = OpAccessChain %21 %58 %14 + %77 = OpLoad %6 %76 + %79 = OpIAdd %6 %77 %78 + %80 = OpAccessChain %21 %19 %75 + OpStore %80 %79 + OpBranch %70 + %70 = OpLabel + %81 = OpLoad %6 %66 + %82 = OpIAdd %6 %81 %78 + OpStore %66 %82 + OpBranch %67 + %69 = OpLabel + %83 = OpAccessChain %21 %58 %14 + %84 = OpLoad %6 %83 + %85 = OpIEqual %39 %84 %20 + OpSelectionMerge %87 None + OpBranchConditional %85 %86 %87 + %86 = OpLabel + %88 = OpAccessChain %21 %19 %14 + %89 = OpLoad %6 %88 + %90 = OpIEqual %39 %89 %27 + OpBranch %87 + %87 = OpLabel + %91 = OpPhi %39 %85 %69 %90 %86 + OpSelectionMerge %93 None + OpBranchConditional %91 %92 %96 + %92 = OpLabel + OpReturnValue %94 + %96 = OpLabel + OpReturnValue %38 + %93 = OpLabel + OpUnreachable + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/assign-array-value-to-another-array.amber b/vulkan/amber/graphicsfuzz/assign-array-value-to-another-array.amber new file mode 100644 index 0000000..a3f99e1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/assign-array-value-to-another-array.amber @@ -0,0 +1,248 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader that assigns array values to other array + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void func(int x) +# { +# int data[9], temp[2]; +# int a = 0; +# data[0] = 5; +# +# // For the values of x used in this test, the following loop +# // runs at least twice, making temp[0] = 5 and temp[1] = 5. +# while (a <= x) +# { +# // Always true. +# if (a <= 10) { +# // When a == 0 this sets temp[0] to data[0] == 5; +# // otherwise it sets temp[1] to data[0] == 5. +# temp[min(a, 1)] = data[min(a, 0)]; +# a++; +# } +# } +# +# // This loop sets data[0] and data[1] to 5 and 6. +# for (int i = 0; i < 2; i++) +# data[i] = temp[0] + i; +# +# if (data[0] == 5 && data[1] == 6) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +# +# void main() +# { +# for (int i = 1; i < 6; i++) +# func(i); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 100 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %81 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "func(i1;" + OpName %9 "x" + OpName %12 "a" + OpName %18 "data" + OpName %38 "temp" + OpName %49 "i" + OpName %81 "_GLF_color" + OpName %87 "i" + OpName %95 "param" + OpDecorate %81 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 + %13 = OpConstant %6 0 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 9 + %16 = OpTypeArray %6 %15 + %17 = OpTypePointer Function %16 + %19 = OpConstant %6 5 + %28 = OpTypeBool + %31 = OpConstant %6 10 + %35 = OpConstant %14 2 + %36 = OpTypeArray %6 %35 + %37 = OpTypePointer Function %36 + %40 = OpConstant %6 1 + %56 = OpConstant %6 2 + %73 = OpConstant %6 6 + %78 = OpTypeFloat 32 + %79 = OpTypeVector %78 4 + %80 = OpTypePointer Output %79 + %81 = OpVariable %80 Output + %82 = OpConstant %78 1 + %83 = OpConstant %78 0 + %84 = OpConstantComposite %79 %82 %83 %83 %82 + %86 = OpConstantComposite %79 %83 %83 %83 %83 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %87 = OpVariable %7 Function + %95 = OpVariable %7 Function + OpStore %87 %40 + OpBranch %88 + %88 = OpLabel + OpLoopMerge %90 %91 None + OpBranch %92 + %92 = OpLabel + %93 = OpLoad %6 %87 + %94 = OpSLessThan %28 %93 %73 + OpBranchConditional %94 %89 %90 + %89 = OpLabel + %96 = OpLoad %6 %87 + OpStore %95 %96 + %97 = OpFunctionCall %2 %10 %95 + OpBranch %91 + %91 = OpLabel + %98 = OpLoad %6 %87 + %99 = OpIAdd %6 %98 %40 + OpStore %87 %99 + OpBranch %88 + %90 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %12 = OpVariable %7 Function + %18 = OpVariable %17 Function + %38 = OpVariable %37 Function + %49 = OpVariable %7 Function + OpStore %12 %13 + %20 = OpAccessChain %7 %18 %13 + OpStore %20 %19 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %6 %12 + %27 = OpLoad %6 %9 + %29 = OpSLessThanEqual %28 %26 %27 + OpBranchConditional %29 %22 %23 + %22 = OpLabel + %30 = OpLoad %6 %12 + %32 = OpSLessThanEqual %28 %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %34 + %33 = OpLabel + %39 = OpLoad %6 %12 + %41 = OpExtInst %6 %1 SMin %39 %40 + %42 = OpLoad %6 %12 + %43 = OpExtInst %6 %1 SMin %42 %13 + %44 = OpAccessChain %7 %18 %43 + %45 = OpLoad %6 %44 + %46 = OpAccessChain %7 %38 %41 + OpStore %46 %45 + %47 = OpLoad %6 %12 + %48 = OpIAdd %6 %47 %40 + OpStore %12 %48 + OpBranch %34 + %34 = OpLabel + OpBranch %24 + %24 = OpLabel + OpBranch %21 + %23 = OpLabel + OpStore %49 %13 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %49 + %57 = OpSLessThan %28 %55 %56 + OpBranchConditional %57 %51 %52 + %51 = OpLabel + %58 = OpLoad %6 %49 + %59 = OpAccessChain %7 %38 %13 + %60 = OpLoad %6 %59 + %61 = OpLoad %6 %49 + %62 = OpIAdd %6 %60 %61 + %63 = OpAccessChain %7 %18 %58 + OpStore %63 %62 + OpBranch %53 + %53 = OpLabel + %64 = OpLoad %6 %49 + %65 = OpIAdd %6 %64 %40 + OpStore %49 %65 + OpBranch %50 + %52 = OpLabel + %66 = OpAccessChain %7 %18 %13 + %67 = OpLoad %6 %66 + %68 = OpIEqual %28 %67 %19 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %70 + %69 = OpLabel + %71 = OpAccessChain %7 %18 %40 + %72 = OpLoad %6 %71 + %74 = OpIEqual %28 %72 %73 + OpBranch %70 + %70 = OpLabel + %75 = OpPhi %28 %68 %52 %74 %69 + OpSelectionMerge %77 None + OpBranchConditional %75 %76 %85 + %76 = OpLabel + OpStore %81 %84 + OpBranch %77 + %85 = OpLabel + OpStore %81 %86 + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/barrier-in-loop-with-break.amber b/vulkan/amber/graphicsfuzz/barrier-in-loop-with-break.amber new file mode 100644 index 0000000..6373d4f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/barrier-in-loop-with-break.amber @@ -0,0 +1,199 @@ +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# Short description: A compute shader with a barrier in a loop with a break + +# Derived from the following GLSL. + +# Compute shader GLSL: +# #version 310 es +# +# layout(set = 0, binding = 1) uniform buf1 { +# vec2 injectionSwitch; +# }; +# layout(std430, binding = 0) buffer doesNotMatter { +# int global_seed; +# int data[]; +# }; +# layout(local_size_x = 16, local_size_y = 1) in; +# void main() +# { +# int lid = int(gl_LocalInvocationID.x); +# int val = global_seed; +# for( +# int i = 0; +# i < 2; +# i ++ +# ) +# { +# if(lid > 0) +# { +# val += data[lid - 1]; +# if(injectionSwitch.x > 100.0) +# { +# break; +# } +# } +# barrier(); +# } +# if (lid == 0) { +# data[0] = 42; +# } +# } + +[compute shader spirv] +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 74 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %4 "main" %12 + OpExecutionMode %4 LocalSize 16 1 1 + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "lid" + OpName %12 "gl_LocalInvocationID" + OpName %18 "val" + OpName %20 "doesNotMatter" + OpMemberName %20 0 "global_seed" + OpMemberName %20 1 "data" + OpName %22 "" + OpName %27 "i" + OpName %50 "buf1" + OpMemberName %50 0 "injectionSwitch" + OpName %52 "" + OpDecorate %12 BuiltIn LocalInvocationId + OpDecorate %19 ArrayStride 4 + OpMemberDecorate %20 0 Offset 0 + OpMemberDecorate %20 1 Offset 4 + OpDecorate %20 BufferBlock + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpMemberDecorate %50 0 Offset 0 + OpDecorate %50 Block + OpDecorate %52 DescriptorSet 0 + OpDecorate %52 Binding 1 + OpDecorate %73 BuiltIn WorkgroupSize + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpTypeVector %9 3 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpConstant %9 0 + %14 = OpTypePointer Input %9 + %19 = OpTypeRuntimeArray %6 + %20 = OpTypeStruct %6 %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpConstant %6 0 + %24 = OpTypePointer Uniform %6 + %34 = OpConstant %6 2 + %35 = OpTypeBool + %41 = OpConstant %6 1 + %48 = OpTypeFloat 32 + %49 = OpTypeVector %48 2 + %50 = OpTypeStruct %49 + %51 = OpTypePointer Uniform %50 + %52 = OpVariable %51 Uniform + %53 = OpTypePointer Uniform %48 + %56 = OpConstant %48 100 + %61 = OpConstant %9 2 + %62 = OpConstant %9 264 + %69 = OpConstant %6 42 + %71 = OpConstant %9 16 + %72 = OpConstant %9 1 + %73 = OpConstantComposite %10 %71 %72 %72 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpVariable %7 Function + %27 = OpVariable %7 Function + %15 = OpAccessChain %14 %12 %13 + %16 = OpLoad %9 %15 + %17 = OpBitcast %6 %16 + OpStore %8 %17 + %25 = OpAccessChain %24 %22 %23 + %26 = OpLoad %6 %25 + OpStore %18 %26 + OpStore %27 %23 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %6 %27 + %36 = OpSLessThan %35 %33 %34 + OpBranchConditional %36 %29 %30 + %29 = OpLabel + %37 = OpLoad %6 %8 + %38 = OpSGreaterThan %35 %37 %23 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + %42 = OpLoad %6 %8 + %43 = OpISub %6 %42 %41 + %44 = OpAccessChain %24 %22 %41 %43 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %18 + %47 = OpIAdd %6 %46 %45 + OpStore %18 %47 + %54 = OpAccessChain %53 %52 %23 %13 + %55 = OpLoad %48 %54 + %57 = OpFOrdGreaterThan %35 %55 %56 + OpSelectionMerge %59 None + OpBranchConditional %57 %58 %59 + %58 = OpLabel + OpBranch %30 + %59 = OpLabel + OpBranch %40 + %40 = OpLabel + OpControlBarrier %61 %61 %62 + OpBranch %31 + %31 = OpLabel + %63 = OpLoad %6 %27 + %64 = OpIAdd %6 %63 %41 + OpStore %27 %64 + OpBranch %28 + %30 = OpLabel + %65 = OpLoad %6 %8 + %66 = OpIEqual %35 %65 %23 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %68 + %67 = OpLabel + %70 = OpAccessChain %24 %22 %41 %23 + OpStore %70 %69 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd + + +[test] +## Uniforms +# injectionSwitch +uniform ubo 0:1 vec2 0 0.0 1.0 +## SSBO +ssbo 0 subdata int 0 12345 +ssbo 0 subdata int 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +compute 1 1 1 +probe ssbo int 0 4 == 42 diff --git a/vulkan/amber/graphicsfuzz/break-in-do-while-with-nested-if.amber b/vulkan/amber/graphicsfuzz/break-in-do-while-with-nested-if.amber new file mode 100644 index 0000000..0bc88ae --- /dev/null +++ b/vulkan/amber/graphicsfuzz/break-in-do-while-with-nested-if.amber @@ -0,0 +1,175 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with nested if + +# The test passes because main always writes color red. +# Running code after writing red does not matter. + +# Optimized using spirv-opt with the following arguments: +# '--copy-propagate-arrays' +# '--if-conversion' +# '--convert-local-access-chains' +# '--convert-local-access-chains' +# '--vector-dce' +# '--reduce-load-size' +# '--reduce-load-size' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--inline-entry-points-exhaustive' +# '--redundancy-elimination' +# '--private-to-local' +# '--eliminate-dead-code-aggressive' +# '--ccp' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-inserts' +# '--eliminate-dead-branches' +# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Write color red +# +# do +# { +# if (injectionSwitch.y < 0.0) // Always false +# { +# bool GLF_live12c5 = false; +# if (GLF_live12c5) +# { +# } +# continue; +# } +# break; +# } while (false); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %18 "buf0" + OpMemberName %18 0 "injectionSwitch" + OpName %20 "" + OpName %33 "GLF_live12c5" + OpDecorate %9 Location 0 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstant %6 0 + %12 = OpConstantComposite %7 %10 %11 %11 %10 + %17 = OpTypeVector %6 2 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypeInt 32 1 + %22 = OpConstant %21 0 + %23 = OpTypeInt 32 0 + %24 = OpConstant %23 1 + %25 = OpTypePointer Uniform %6 + %28 = OpTypeBool + %32 = OpTypePointer Function %28 + %34 = OpConstantFalse %28 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %33 = OpVariable %32 Function + OpStore %9 %12 + OpBranch %13 + %13 = OpLabel + OpLoopMerge %15 %37 None + OpBranch %14 + %14 = OpLabel + %26 = OpAccessChain %25 %20 %22 %24 + %27 = OpLoad %6 %26 + %29 = OpFOrdLessThan %28 %27 %11 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %31 + %30 = OpLabel + OpStore %33 %34 + %35 = OpLoad %28 %33 + OpSelectionMerge %38 None + OpBranchConditional %35 %36 %37 + %36 = OpLabel + OpBranch %37 + %38 = OpLabel + OpBranch %37 + %37 = OpLabel + OpBranchConditional %34 %13 %15 + %31 = OpLabel + OpBranch %15 + %15 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/call-function-with-discard.amber b/vulkan/amber/graphicsfuzz/call-function-with-discard.amber new file mode 100644 index 0000000..dd6bd88 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/call-function-with-discard.amber @@ -0,0 +1,165 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: Calls a function containing a discard + +# The test passes because main always writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-local-single-block' +# '--eliminate-dead-branches' +# '--merge-return' +# '--ccp' +# '--scalar-replacement=100' +# '--eliminate-local-single-block' +# '--simplify-instructions' +# '--redundancy-elimination' +# '--eliminate-local-multi-store' +# '--private-to-local' +# '--if-conversion' +# '--private-to-local' +# spirv-opt commit hash: 18b3b94567a9251a6f8491a6d07c4422abadd22c + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void func() +# { +# if (1.0 > one) // Always false +# { +# discard; +# } +# } +# +# void main() +# { +# _GLF_color = vec4(0); +# do +# { +# func(); +# } while (false); +# _GLF_color = vec4(1, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %25 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %6 "func(" + OpName %10 "buf0" + OpMemberName %10 0 "one" + OpName %12 "" + OpName %25 "_GLF_color" + OpMemberDecorate %10 0 Offset 0 + OpDecorate %10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %25 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeFloat 32 + %9 = OpConstant %8 1 + %10 = OpTypeStruct %8 + %11 = OpTypePointer Uniform %10 + %12 = OpVariable %11 Uniform + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %8 + %18 = OpTypeBool + %23 = OpTypeVector %8 4 + %24 = OpTypePointer Output %23 + %25 = OpVariable %24 Output + %26 = OpConstant %8 0 + %27 = OpConstantComposite %23 %26 %26 %26 %26 + %33 = OpConstantFalse %18 + %34 = OpConstantComposite %23 %9 %26 %26 %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %25 %27 + OpBranch %28 + %28 = OpLabel + %32 = OpFunctionCall %2 %6 + OpLoopMerge %30 %28 None + OpBranchConditional %33 %28 %30 + %30 = OpLabel + OpStore %25 %34 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %8 %16 + %19 = OpFOrdGreaterThan %18 %9 %17 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %21 + %20 = OpLabel + OpTerminateInvocation + %21 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/call-if-while-switch.amber b/vulkan/amber/graphicsfuzz/call-if-while-switch.amber new file mode 100644 index 0000000..706b254 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/call-if-while-switch.amber @@ -0,0 +1,196 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with a call, if, while, switch + +# The test passes because the fragment shader does some control flow and then writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 06407250a169c6a03b3765e86619075af1a8c187 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# int data[10]; +# +# void merge(int from) +# { +# int i = 1; +# if (1 < data[1]) +# { +# i++; +# } +# while (i < 3) +# { +# i++; +# switch (int(injectionSwitch.x)) +# { +# case 19: +# from++; +# case 38: +# case 23: +# break; +# case 78: +# _GLF_color = vec4(1.0); +# default: +# 1; +# } +# } +# data[from] = 1; +# } +# void main() +# { +# merge(1); +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 112 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %59 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %18 "data" + OpName %40 "buf0" + OpMemberName %40 0 "injectionSwitch" + OpName %42 "" + OpName %59 "_GLF_color" + OpDecorate %18 RelaxedPrecision + OpMemberDecorate %40 0 Offset 0 + OpDecorate %40 Block + OpDecorate %42 DescriptorSet 0 + OpDecorate %42 Binding 0 + OpDecorate %59 Location 0 + OpDecorate %71 RelaxedPrecision + OpDecorate %85 RelaxedPrecision + OpDecorate %95 RelaxedPrecision + OpDecorate %110 RelaxedPrecision + OpDecorate %99 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %13 = OpConstant %6 1 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 10 + %16 = OpTypeArray %6 %15 + %22 = OpTypeBool + %34 = OpConstant %6 3 + %38 = OpTypeFloat 32 + %39 = OpTypeVector %38 2 + %40 = OpTypeStruct %39 + %41 = OpTypePointer Uniform %40 + %42 = OpVariable %41 Uniform + %43 = OpConstant %6 0 + %44 = OpConstant %14 0 + %45 = OpTypePointer Uniform %38 + %57 = OpTypeVector %38 4 + %58 = OpTypePointer Output %57 + %59 = OpVariable %58 Output + %60 = OpConstant %38 1 + %61 = OpConstantComposite %57 %60 %60 %60 %60 + %67 = OpConstant %38 0 + %68 = OpConstantComposite %57 %60 %67 %67 %60 + %98 = OpTypePointer Function %16 + %109 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %18 = OpVariable %98 Function + %70 = OpAccessChain %7 %18 %13 + %71 = OpLoad %6 %70 + %72 = OpSLessThan %22 %13 %71 + %110 = OpSelect %6 %72 %109 %13 + OpBranch %77 + %77 = OpLabel + %101 = OpPhi %6 %13 %5 %106 %89 + %99 = OpPhi %6 %110 %5 %85 %89 + %82 = OpSLessThan %22 %99 %34 + OpLoopMerge %78 %89 None + OpBranchConditional %82 %83 %78 + %83 = OpLabel + %85 = OpIAdd %6 %99 %13 + %86 = OpAccessChain %45 %42 %43 %44 + %87 = OpLoad %38 %86 + %88 = OpConvertFToS %6 %87 + OpSelectionMerge %111 None + OpSwitch %88 %90 19 %91 38 %92 23 %92 78 %93 + %90 = OpLabel + OpBranch %89 + %91 = OpLabel + %95 = OpIAdd %6 %101 %13 + OpBranch %92 + %92 = OpLabel + %108 = OpPhi %6 %101 %83 %95 %91 + OpBranch %89 + %93 = OpLabel + OpStore %59 %61 + OpBranch %90 + %111 = OpLabel + OpBranch %89 + %89 = OpLabel + %106 = OpPhi %6 %101 %90 %108 %92 %43 %111 + OpBranch %77 + %78 = OpLabel + %97 = OpAccessChain %7 %18 %101 + OpStore %97 %13 + OpStore %59 %68 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/color-set-in-for-loop.amber b/vulkan/amber/graphicsfuzz/color-set-in-for-loop.amber new file mode 100644 index 0000000..50cb5c6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/color-set-in-for-loop.amber @@ -0,0 +1,153 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with color set in for loop + +# The test passes because main always writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '--wrap-opkill' +# '--eliminate-dead-branches' +# '--merge-return' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-functions' +# '--private-to-local' +# '--scalar-replacement=0' +# '--ssa-rewrite' +# '--ccp' +# spirv-opt commit hash: 18b3b94567a9251a6f8491a6d07c4422abadd22c + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# void main() +# { +# if (injectionSwitch.x > 1.0) // Always false +# { +# for (mat4 tmp1; true;) +# { +# _GLF_color = vec4(0, 0, 0, 1); +# } +# } +# _GLF_color = vec4(1, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %31 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "buf0" + OpMemberName %8 0 "injectionSwitch" + OpName %10 "" + OpName %31 "_GLF_color" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 0 + OpDecorate %31 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeStruct %7 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %6 + %18 = OpConstant %6 1 + %19 = OpTypeBool + %28 = OpConstantTrue %19 + %29 = OpTypeVector %6 4 + %30 = OpTypePointer Output %29 + %31 = OpVariable %30 Output + %32 = OpConstant %6 0 + %33 = OpConstantComposite %29 %32 %32 %32 %18 + %34 = OpConstantComposite %29 %18 %32 %32 %18 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %16 = OpAccessChain %15 %10 %12 %14 + %17 = OpLoad %6 %16 + %20 = OpFOrdGreaterThan %19 %17 %18 + OpSelectionMerge %22 None + OpBranchConditional %20 %21 %22 + %21 = OpLabel + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %24 = OpLabel + OpStore %31 %33 + OpBranch %26 + %26 = OpLabel + OpBranch %23 + %25 = OpLabel + OpUnreachable + %22 = OpLabel + OpStore %31 %34 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/color-write-in-loop.amber b/vulkan/amber/graphicsfuzz/color-write-in-loop.amber new file mode 100644 index 0000000..d02c3e3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/color-write-in-loop.amber @@ -0,0 +1,195 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader that writes to color in a loop + +# Checks that the top-left pixel is red. +# Passes because main ends by writing red to _GLF_color. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a2ef7be242bcacaa9127a3ce011602ec54b2c9ed + +# Derived from the following GLSL. + +# Fragment shader GLSL: +# #version 310 es +# +# precision highp float; +# +# struct S { +# int f0; +# mat4x3 f1; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void g() +# { +# S s = S(0, mat4x3(1.0)); +# for( +# int l = 0; +# l < (gl_FragCoord.x == 0.0 ? 1 : 2); +# l ++ +# ) +# { +# _GLF_color = vec4(1.0); +# s.f0++; +# } +# if(s.f0 < 1000) +# { +# return; +# } +# } +# void main() +# { +# g(); +# for( +# int i = 0; +# i < (gl_FragCoord.x == 0.0 ? 1 : 2); +# i++ +# ) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 120 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 %47 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %12 "S" + OpMemberName %12 0 "f0" + OpMemberName %12 1 "f1" + OpName %34 "gl_FragCoord" + OpName %47 "_GLF_color" + OpMemberDecorate %12 0 RelaxedPrecision + OpDecorate %34 BuiltIn FragCoord + OpDecorate %47 Location 0 + OpDecorate %76 RelaxedPrecision + OpDecorate %104 RelaxedPrecision + OpDecorate %105 RelaxedPrecision + OpDecorate %107 RelaxedPrecision + OpDecorate %109 RelaxedPrecision + OpDecorate %117 RelaxedPrecision + OpDecorate %119 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeInt 32 1 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 3 + %11 = OpTypeMatrix %10 4 + %12 = OpTypeStruct %8 %11 + %15 = OpConstant %8 0 + %16 = OpConstant %9 1 + %17 = OpConstant %9 0 + %18 = OpConstantComposite %10 %16 %17 %17 + %19 = OpConstantComposite %10 %17 %16 %17 + %20 = OpConstantComposite %10 %17 %17 %16 + %21 = OpConstantComposite %10 %17 %17 %17 + %22 = OpConstantComposite %11 %18 %19 %20 %21 + %23 = OpConstantComposite %12 %15 %22 + %32 = OpTypeVector %9 4 + %33 = OpTypePointer Input %32 + %34 = OpVariable %33 Input + %35 = OpTypeInt 32 0 + %36 = OpConstant %35 0 + %37 = OpTypePointer Input %9 + %40 = OpTypeBool + %42 = OpConstant %8 1 + %43 = OpConstant %8 2 + %46 = OpTypePointer Output %32 + %47 = OpVariable %46 Output + %48 = OpConstantComposite %32 %16 %16 %16 %16 + %56 = OpConstant %8 1000 + %74 = OpConstantComposite %32 %16 %17 %17 %16 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %92 + %92 = OpLabel + %118 = OpPhi %12 %23 %88 %115 %102 + %117 = OpPhi %8 %15 %88 %107 %102 + %97 = OpAccessChain %37 %34 %36 + %98 = OpLoad %9 %97 + %99 = OpFOrdEqual %40 %98 %17 + %100 = OpSelect %8 %99 %42 %43 + %101 = OpSLessThan %40 %117 %100 + OpLoopMerge %93 %102 None + OpBranchConditional %101 %102 %93 + %102 = OpLabel + OpStore %47 %48 + %104 = OpCompositeExtract %8 %118 0 + %105 = OpIAdd %8 %104 %42 + %115 = OpCompositeInsert %12 %105 %118 0 + %107 = OpIAdd %8 %117 %42 + OpBranch %92 + %93 = OpLabel + %109 = OpCompositeExtract %8 %118 0 + %110 = OpSLessThan %40 %109 %56 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %111 + %112 = OpLabel + OpBranch %89 + %111 = OpLabel + OpBranch %89 + %90 = OpLabel + OpBranch %88 + %89 = OpLabel + OpBranch %63 + %63 = OpLabel + %119 = OpPhi %8 %15 %89 %76 %64 + %73 = OpSLessThan %40 %119 %100 + OpLoopMerge %65 %64 None + OpBranchConditional %73 %64 %65 + %64 = OpLabel + OpStore %47 %74 + %76 = OpIAdd %8 %119 %42 + OpBranch %63 + %65 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/complex-nested-loops-and-call.amber b/vulkan/amber/graphicsfuzz/complex-nested-loops-and-call.amber new file mode 100644 index 0000000..c1640d1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/complex-nested-loops-and-call.amber @@ -0,0 +1,320 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with complex nested loops, breaks, etc. + +# The test passes because the shader always outputs the color red. +# pickColor(i) returns red (because i is always 1). +# mand() returns red because it sets iteration to 1, breaks from the first loop, +# does not enter the if, and returns pickColor(iteration). +# main() writes red because it sets data[0] to mand() and then writes +# vec4(data[0], 1.0) to the color output variable. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 06407250a169c6a03b3765e86619075af1a8c187 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 pickColor(int i) +# { +# return vec3(float(i), 0.0, 0.0); // i is always 1 +# } +# +# // Returns vec3(1.0, 0.0, 0.0) +# vec3 mand() +# { +# float x = 0.0, y = 0.0; +# int iteration = 1; +# int k = 1; +# int iterationCap = 17; +# do +# { +# if (injectionSwitch.x < 10.0) // always true +# { +# break; +# } +# if (injectionSwitch.x < 20.0) +# { +# discard; +# } +# iteration++; +# if (injectionSwitch.x < 30.0) +# { +# return vec3(1.0); +# } +# } while (k < iterationCap); +# +# if (injectionSwitch.x > 10.0) // always false +# { +# if (gl_FragCoord.x < 0.0) +# { +# do +# { +# _GLF_color = vec4(1.0); +# } while (gl_FragCoord.y < 0.0); +# } +# do +# { +# _GLF_color = vec4(1.0); +# } while (gl_FragCoord.x < 0.0); +# return vec3(1.0); +# } +# return pickColor(iteration); // pickColor(1) +# } +# void main() +# { +# vec3 data[16]; +# for ( +# int i = 0; +# i < int(injectionSwitch.y); // i < 1 +# i++) +# { +# for ( +# int j = 0; +# j < 2; +# j++) +# { +# data[int(injectionSwitch.x)] = mand(); // data[0] = vec3(1.0, 0.0, 0.0); +# } +# } +# _GLF_color = vec4(data[0], 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 255 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %79 %91 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %36 "buf0" + OpMemberName %36 0 "injectionSwitch" + OpName %38 "" + OpName %79 "gl_FragCoord" + OpName %91 "_GLF_color" + OpName %133 "data" + OpMemberDecorate %36 0 Offset 0 + OpDecorate %36 Block + OpDecorate %38 DescriptorSet 0 + OpDecorate %38 Binding 0 + OpDecorate %79 BuiltIn FragCoord + OpDecorate %91 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %8 = OpTypeFloat 32 + %9 = OpTypeVector %8 3 + %19 = OpConstant %8 0 + %27 = OpConstant %6 1 + %35 = OpTypeVector %8 2 + %36 = OpTypeStruct %35 + %37 = OpTypePointer Uniform %36 + %38 = OpVariable %37 Uniform + %39 = OpConstant %6 0 + %40 = OpTypeInt 32 0 + %41 = OpConstant %40 0 + %42 = OpTypePointer Uniform %8 + %45 = OpConstant %8 10 + %46 = OpTypeBool + %53 = OpConstant %8 20 + %62 = OpConstant %8 30 + %66 = OpConstant %8 1 + %67 = OpConstantComposite %9 %66 %66 %66 + %77 = OpTypeVector %8 4 + %78 = OpTypePointer Input %77 + %79 = OpVariable %78 Input + %80 = OpTypePointer Input %8 + %90 = OpTypePointer Output %77 + %91 = OpVariable %90 Output + %92 = OpConstantComposite %77 %66 %66 %66 %66 + %93 = OpConstant %40 1 + %128 = OpConstant %6 2 + %130 = OpConstant %40 16 + %131 = OpTypeArray %9 %130 + %132 = OpTypePointer Function %131 + %138 = OpTypePointer Function %9 + %159 = OpConstantFalse %46 + %162 = OpConstantTrue %46 + %251 = OpUndef %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %133 = OpVariable %132 Function + OpBranch %111 + %111 = OpLabel + %237 = OpPhi %6 %39 %5 %143 %124 + %250 = OpPhi %9 %251 %5 %249 %124 + %117 = OpAccessChain %42 %38 %39 %93 + %118 = OpLoad %8 %117 + %119 = OpConvertFToS %6 %118 + %120 = OpSLessThan %46 %237 %119 + OpLoopMerge %113 %124 None + OpBranchConditional %120 %112 %113 + %112 = OpLabel + OpBranch %122 + %122 = OpLabel + %249 = OpPhi %9 %250 %112 %245 %175 + %238 = OpPhi %6 %39 %112 %141 %175 + %129 = OpSLessThan %46 %238 %128 + OpLoopMerge %252 %175 None + OpBranchConditional %129 %123 %252 + %123 = OpLabel + %134 = OpAccessChain %42 %38 %39 %41 + %135 = OpLoad %8 %134 + %136 = OpConvertFToS %6 %135 + OpBranch %174 + %174 = OpLabel + OpLoopMerge %254 %176 None + OpBranch %178 + %178 = OpLabel + %240 = OpPhi %6 %27 %174 %194 %198 + OpLoopMerge %179 %198 None + OpBranch %181 + %181 = OpLabel + %184 = OpFOrdLessThan %46 %135 %45 + OpSelectionMerge %185 None + OpBranchConditional %184 %186 %185 + %186 = OpLabel + OpBranch %179 + %185 = OpLabel + %189 = OpFOrdLessThan %46 %135 %53 + OpSelectionMerge %190 None + OpBranchConditional %189 %191 %190 + %191 = OpLabel + OpTerminateInvocation + %190 = OpLabel + %194 = OpIAdd %6 %240 %27 + %197 = OpFOrdLessThan %46 %135 %62 + OpSelectionMerge %253 None + OpBranchConditional %197 %199 %198 + %199 = OpLabel + OpBranch %179 + %253 = OpLabel + OpBranch %198 + %198 = OpLabel + OpBranch %178 + %179 = OpLabel + %246 = OpPhi %9 %249 %186 %67 %199 + %244 = OpPhi %6 %240 %186 %194 %199 + %241 = OpPhi %46 %159 %186 %162 %199 + OpSelectionMerge %204 None + OpBranchConditional %241 %254 %204 + %204 = OpLabel + %207 = OpFOrdGreaterThan %46 %135 %45 + OpSelectionMerge %208 None + OpBranchConditional %207 %209 %208 + %209 = OpLabel + %210 = OpAccessChain %80 %79 %41 + %211 = OpLoad %8 %210 + %212 = OpFOrdLessThan %46 %211 %19 + OpSelectionMerge %213 None + OpBranchConditional %212 %214 %213 + %214 = OpLabel + OpBranch %215 + %215 = OpLabel + OpStore %91 %92 + %219 = OpAccessChain %80 %79 %93 + %220 = OpLoad %8 %219 + %221 = OpFOrdLessThan %46 %220 %19 + OpLoopMerge %216 %215 None + OpBranchConditional %221 %215 %216 + %216 = OpLabel + OpBranch %213 + %213 = OpLabel + OpBranch %222 + %222 = OpLabel + OpStore %91 %92 + OpLoopMerge %223 %222 None + OpBranchConditional %212 %222 %223 + %223 = OpLabel + OpBranch %254 + %208 = OpLabel + %235 = OpConvertSToF %8 %244 + %236 = OpCompositeConstruct %9 %235 %19 %19 + OpBranch %254 + %176 = OpLabel + OpBranch %174 + %254 = OpLabel + %245 = OpPhi %9 %246 %179 %67 %223 %236 %208 + OpBranch %175 + %175 = OpLabel + %139 = OpAccessChain %138 %133 %136 + OpStore %139 %245 + %141 = OpIAdd %6 %238 %27 + OpBranch %122 + %252 = OpLabel + OpBranch %124 + %124 = OpLabel + %143 = OpIAdd %6 %237 %27 + OpBranch %111 + %113 = OpLabel + %144 = OpAccessChain %138 %133 %39 + %145 = OpLoad %9 %144 + %146 = OpCompositeExtract %8 %145 0 + %147 = OpCompositeExtract %8 %145 1 + %148 = OpCompositeExtract %8 %145 2 + %149 = OpCompositeConstruct %77 %146 %147 %148 %66 + OpStore %91 %149 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/conditional-return-in-infinite-while.amber b/vulkan/amber/graphicsfuzz/conditional-return-in-infinite-while.amber new file mode 100644 index 0000000..5caae40 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/conditional-return-in-infinite-while.amber @@ -0,0 +1,193 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A shader with conditional return inside an infinite loop + +# The test passes because the shader always writes the color red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# int GLF_live6tree[10]; +# +# int GLF_live6search() +# { +# // This function is never accessed +# int GLF_live6currentNode; +# int GLF_live6index = 0; +# while (true) +# { +# GLF_live6currentNode = GLF_live6tree[GLF_live6index]; +# if (GLF_live6currentNode != 1) +# { +# return 1; +# } +# GLF_live6index = 1; +# } +# return 1; +# } +# +# void main() +# { +# if (injectionSwitch.x > 1.0) // Always false +# { +# GLF_live6search(); +# } +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 57 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %54 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "GLF_live6search(" + OpName %11 "GLF_live6index" + OpName %20 "GLF_live6currentNode" + OpName %25 "GLF_live6tree" + OpName %40 "buf0" + OpMemberName %40 0 "injectionSwitch" + OpName %42 "" + OpName %54 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpMemberDecorate %40 0 Offset 0 + OpDecorate %40 Block + OpDecorate %42 DescriptorSet 0 + OpDecorate %42 Binding 0 + OpDecorate %51 RelaxedPrecision + OpDecorate %54 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 0 + %18 = OpTypeBool + %19 = OpConstantTrue %18 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypePointer Private %23 + %25 = OpVariable %24 Private + %27 = OpTypePointer Private %6 + %31 = OpConstant %6 1 + %38 = OpTypeFloat 32 + %39 = OpTypeVector %38 2 + %40 = OpTypeStruct %39 + %41 = OpTypePointer Uniform %40 + %42 = OpVariable %41 Uniform + %43 = OpConstant %21 0 + %44 = OpTypePointer Uniform %38 + %47 = OpConstant %38 1 + %52 = OpTypeVector %38 4 + %53 = OpTypePointer Output %52 + %54 = OpVariable %53 Output + %55 = OpConstant %38 0 + %56 = OpConstantComposite %52 %47 %55 %55 %47 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %45 = OpAccessChain %44 %42 %12 %43 + %46 = OpLoad %38 %45 + %48 = OpFOrdGreaterThan %18 %46 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %50 + %49 = OpLabel + %51 = OpFunctionCall %6 %8 + OpBranch %50 + %50 = OpLabel + OpStore %54 %56 + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %20 = OpVariable %10 Function + OpStore %11 %12 + OpBranch %13 + %13 = OpLabel + OpLoopMerge %15 %16 None + OpBranch %17 + %17 = OpLabel + OpBranchConditional %19 %14 %15 + %14 = OpLabel + %26 = OpLoad %6 %11 + %28 = OpAccessChain %27 %25 %26 + %29 = OpLoad %6 %28 + OpStore %20 %29 + %30 = OpLoad %6 %20 + %32 = OpINotEqual %18 %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %34 + %33 = OpLabel + OpReturnValue %31 + %34 = OpLabel + OpStore %11 %31 + OpBranch %16 + %16 = OpLabel + OpBranch %13 + %15 = OpLabel + OpReturnValue %31 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/continue-and-merge.amber b/vulkan/amber/graphicsfuzz/continue-and-merge.amber new file mode 100644 index 0000000..c570dac --- /dev/null +++ b/vulkan/amber/graphicsfuzz/continue-and-merge.amber @@ -0,0 +1,86 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz; reduced by spirv-fuzz and by hand. +# A fragment shader with two nested loops. All loop conditions are false. +# We check that all pixels are red. The test passes because the final statement +# writes red to _GLF_color. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource ESSL 310 + OpName %2 "main" + OpName %3 "_GLF_color" + OpDecorate %3 Location 0 + %4 = OpTypeVoid + %5 = OpTypeFunction %4 + %6 = OpTypeFloat 32 + %7 = OpConstant %6 1 + %8 = OpConstant %6 0 + %9 = OpTypeVector %6 4 + %10 = OpConstantComposite %9 %7 %8 %8 %7 + %11 = OpTypePointer Output %9 + %3 = OpVariable %11 Output + %12 = OpTypeBool + %13 = OpConstantTrue %12 + %14 = OpConstantFalse %12 + %2 = OpFunction %4 None %5 + %15 = OpLabel + OpBranch %16 + %16 = OpLabel + OpLoopMerge %17 %18 None + OpBranchConditional %14 %19 %17 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranchConditional %14 %20 %20 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + OpBranch %18 + %18 = OpLabel + OpBranch %16 + %17 = OpLabel + OpStore %3 %10 + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/control-flow-in-function.amber b/vulkan/amber/graphicsfuzz/control-flow-in-function.amber new file mode 100644 index 0000000..a7fb64a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/control-flow-in-function.amber @@ -0,0 +1,852 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with a lot of control flow + +# The test passes because the fragment shader does not enter the first if statement, then writes +# the color red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 drawShape(vec2 pos) +# { +# bool c2; +# c2 = pos.x > 1.0; +# if (c2) +# { +# return vec3(1.0); +# } +# bool c3; +# c3 = pos.y < 1.0; +# if (c3) +# { +# return vec3(1.0); +# } +# bool c4; +# c4 = pos.y > 1.0; +# if (c4) +# { +# return vec3(1.0); +# } +# bool c5; +# c5 = pos.x < 1.0; +# if (c5) +# { +# return vec3(1.0); +# } +# bool c6; +# c6 = pos.x + 1.0 > 1.0; +# if (c6) +# { +# return vec3(1.0); +# } +# int GLF_live4_looplimiter5; +# for ( +# int GLF_live4i = 0; +# GLF_live4i < 4; +# ++GLF_live4i) +# { +# if (GLF_live4_looplimiter5 >= 7) +# { +# break; +# } +# GLF_live4_looplimiter5++; +# mat4x2 GLF_live7m42; +# GLF_live7m42 = mat4x2(1.0); +# mat3 GLF_live7m33; +# GLF_live7m33 = mat3(1.0); +# int GLF_live7_looplimiter3; +# for ( +# int GLF_live7cols = 2; +# GLF_live7cols < 4; +# ++GLF_live7cols) +# { +# if (GLF_live7_looplimiter3 >= 7) +# { +# break; +# } +# GLF_live7_looplimiter3++; +# int GLF_live7_looplimiter2; +# for ( +# int GLF_live7rows = 2; +# GLF_live7rows < 4; +# ++GLF_live7rows) +# { +# if (GLF_live7_looplimiter2 >= 7) +# { +# break; +# } +# GLF_live7_looplimiter2++; +# int GLF_live7_looplimiter1; +# GLF_live7_looplimiter1 = 0; +# for ( +# int GLF_live7c = 0; +# GLF_live7c < 3; +# GLF_live7c++) +# { +# if (GLF_live7_looplimiter1 >= 7) +# { +# break; +# } +# GLF_live7_looplimiter1++; +# int GLF_live7_looplimiter0; +# for ( +# int GLF_live7r = 0; +# GLF_live7r < 2; +# ++GLF_live7r) +# { +# if (GLF_live7_looplimiter0 >= 7) +# { +# break; +# } +# GLF_live7_looplimiter0++; +# GLF_live7m33[GLF_live7c >= 0 && GLF_live7c < 3 ? GLF_live7c : 0][GLF_live7r >= 0 && GLF_live7r < 3 ? GLF_live7r : 0] = 1.0; +# if (0.0 > injectionSwitch.y) +# { +# } +# else +# { +# GLF_live7m42[GLF_live7c >= 0 && GLF_live7c < 4 ? GLF_live7c : 0][GLF_live7r >= 0 && GLF_live7r < 2 ? GLF_live7r : 0] = 1.0; +# } +# } +# } +# } +# } +# float GLF_live7sums[9]; +# int GLF_live7sum_index; +# GLF_live7sum_index = 0; +# int GLF_live7_looplimiter7; +# GLF_live7_looplimiter7 = 0; +# for ( +# int GLF_live7cols = 2; +# GLF_live7cols < 4; +# ++GLF_live7cols) +# { +# if (GLF_live7_looplimiter7 >= 7) +# { +# break; +# } +# GLF_live7_looplimiter7++; +# int GLF_live7rows; +# GLF_live7rows = 2; +# GLF_live7sums[GLF_live7sum_index >= 0 && GLF_live7sum_index < 9 ? GLF_live7sum_index : 0] = 0.0; +# for ( +# int GLF_live7c = 0; +# GLF_live7c < 1; +# GLF_live7c++) +# { +# for ( +# int GLF_live7r = 0; +# GLF_live7r < GLF_live7rows; +# GLF_live7r++) +# { +# GLF_live7sums[GLF_live7sum_index >= 0 && GLF_live7sum_index < 9 ? GLF_live7sum_index : 0] += transpose(GLF_live7m33)[GLF_live7c < 3 ? 1 : int(injectionSwitch.x)][GLF_live7r < 3 ? 1 : 0]; +# GLF_live7sums[GLF_live7sum_index >= 0 && GLF_live7sum_index < 9 ? GLF_live7sum_index : 0] += GLF_live7m42[1][GLF_live7r]; +# } +# } +# GLF_live7sum_index++; +# } +# } +# return vec3(1.0); +# } +# void main() +# { +# if (injectionSwitch.x >= 2.0) // always false +# { +# vec2 position = gl_FragCoord.xy; +# drawShape(position); +# drawShape(position); +# +# for ( +# int i = 25; +# i > 0; +# --i) +# { +# drawShape(position); +# } +# } +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 352 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %326 %350 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %12 "drawShape(vf2;" + OpName %11 "pos" + OpName %16 "c2" + OpName %29 "c3" + OpName %38 "c4" + OpName %46 "c5" + OpName %54 "c6" + OpName %65 "GLF_live4i" + OpName %75 "GLF_live4_looplimiter5" + OpName %87 "GLF_live7m42" + OpName %95 "GLF_live7m33" + OpName %100 "GLF_live7cols" + OpName %109 "GLF_live7_looplimiter3" + OpName %117 "GLF_live7rows" + OpName %125 "GLF_live7_looplimiter2" + OpName %133 "GLF_live7_looplimiter1" + OpName %134 "GLF_live7c" + OpName %150 "GLF_live7r" + OpName %158 "GLF_live7_looplimiter0" + OpName %181 "buf0" + OpMemberName %181 0 "injectionSwitch" + OpName %183 "" + OpName %214 "GLF_live7sum_index" + OpName %215 "GLF_live7_looplimiter7" + OpName %216 "GLF_live7cols" + OpName %231 "GLF_live7rows" + OpName %235 "GLF_live7sums" + OpName %245 "GLF_live7c" + OpName %253 "GLF_live7r" + OpName %284 "indexable" + OpName %323 "position" + OpName %326 "gl_FragCoord" + OpName %329 "param" + OpName %332 "param" + OpName %335 "i" + OpName %344 "param" + OpName %350 "_GLF_color" + OpDecorate %65 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %82 RelaxedPrecision + OpDecorate %84 RelaxedPrecision + OpDecorate %100 RelaxedPrecision + OpDecorate %107 RelaxedPrecision + OpDecorate %109 RelaxedPrecision + OpDecorate %110 RelaxedPrecision + OpDecorate %115 RelaxedPrecision + OpDecorate %116 RelaxedPrecision + OpDecorate %117 RelaxedPrecision + OpDecorate %123 RelaxedPrecision + OpDecorate %125 RelaxedPrecision + OpDecorate %126 RelaxedPrecision + OpDecorate %131 RelaxedPrecision + OpDecorate %132 RelaxedPrecision + OpDecorate %133 RelaxedPrecision + OpDecorate %134 RelaxedPrecision + OpDecorate %140 RelaxedPrecision + OpDecorate %143 RelaxedPrecision + OpDecorate %148 RelaxedPrecision + OpDecorate %149 RelaxedPrecision + OpDecorate %150 RelaxedPrecision + OpDecorate %156 RelaxedPrecision + OpDecorate %158 RelaxedPrecision + OpDecorate %159 RelaxedPrecision + OpDecorate %164 RelaxedPrecision + OpDecorate %165 RelaxedPrecision + OpDecorate %166 RelaxedPrecision + OpDecorate %168 RelaxedPrecision + OpDecorate %171 RelaxedPrecision + OpDecorate %173 RelaxedPrecision + OpDecorate %175 RelaxedPrecision + OpDecorate %178 RelaxedPrecision + OpMemberDecorate %181 0 Offset 0 + OpDecorate %181 Block + OpDecorate %183 DescriptorSet 0 + OpDecorate %183 Binding 0 + OpDecorate %191 RelaxedPrecision + OpDecorate %193 RelaxedPrecision + OpDecorate %196 RelaxedPrecision + OpDecorate %198 RelaxedPrecision + OpDecorate %200 RelaxedPrecision + OpDecorate %203 RelaxedPrecision + OpDecorate %206 RelaxedPrecision + OpDecorate %207 RelaxedPrecision + OpDecorate %208 RelaxedPrecision + OpDecorate %209 RelaxedPrecision + OpDecorate %210 RelaxedPrecision + OpDecorate %211 RelaxedPrecision + OpDecorate %212 RelaxedPrecision + OpDecorate %213 RelaxedPrecision + OpDecorate %214 RelaxedPrecision + OpDecorate %215 RelaxedPrecision + OpDecorate %216 RelaxedPrecision + OpDecorate %222 RelaxedPrecision + OpDecorate %224 RelaxedPrecision + OpDecorate %229 RelaxedPrecision + OpDecorate %230 RelaxedPrecision + OpDecorate %231 RelaxedPrecision + OpDecorate %236 RelaxedPrecision + OpDecorate %238 RelaxedPrecision + OpDecorate %242 RelaxedPrecision + OpDecorate %245 RelaxedPrecision + OpDecorate %251 RelaxedPrecision + OpDecorate %253 RelaxedPrecision + OpDecorate %259 RelaxedPrecision + OpDecorate %260 RelaxedPrecision + OpDecorate %262 RelaxedPrecision + OpDecorate %264 RelaxedPrecision + OpDecorate %267 RelaxedPrecision + OpDecorate %271 RelaxedPrecision + OpDecorate %281 RelaxedPrecision + OpDecorate %291 RelaxedPrecision + OpDecorate %293 RelaxedPrecision + OpDecorate %296 RelaxedPrecision + OpDecorate %298 RelaxedPrecision + OpDecorate %305 RelaxedPrecision + OpDecorate %306 RelaxedPrecision + OpDecorate %307 RelaxedPrecision + OpDecorate %308 RelaxedPrecision + OpDecorate %309 RelaxedPrecision + OpDecorate %310 RelaxedPrecision + OpDecorate %311 RelaxedPrecision + OpDecorate %312 RelaxedPrecision + OpDecorate %313 RelaxedPrecision + OpDecorate %314 RelaxedPrecision + OpDecorate %326 BuiltIn FragCoord + OpDecorate %335 RelaxedPrecision + OpDecorate %342 RelaxedPrecision + OpDecorate %347 RelaxedPrecision + OpDecorate %348 RelaxedPrecision + OpDecorate %350 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeVector %6 3 + %10 = OpTypeFunction %9 %8 + %14 = OpTypeBool + %15 = OpTypePointer Function %14 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 0 + %19 = OpTypePointer Function %6 + %22 = OpConstant %6 1 + %27 = OpConstantComposite %9 %22 %22 %22 + %30 = OpConstant %17 1 + %63 = OpTypeInt 32 1 + %64 = OpTypePointer Function %63 + %66 = OpConstant %63 0 + %73 = OpConstant %63 4 + %77 = OpConstant %63 7 + %83 = OpConstant %63 1 + %85 = OpTypeMatrix %7 4 + %86 = OpTypePointer Function %85 + %88 = OpConstant %6 0 + %89 = OpConstantComposite %7 %22 %88 + %90 = OpConstantComposite %7 %88 %22 + %91 = OpConstantComposite %7 %88 %88 + %92 = OpConstantComposite %85 %89 %90 %91 %89 + %93 = OpTypeMatrix %9 3 + %94 = OpTypePointer Function %93 + %96 = OpConstantComposite %9 %22 %88 %88 + %97 = OpConstantComposite %9 %88 %22 %88 + %98 = OpConstantComposite %9 %88 %88 %22 + %99 = OpConstantComposite %93 %96 %97 %98 + %101 = OpConstant %63 2 + %141 = OpConstant %63 3 + %181 = OpTypeStruct %7 + %182 = OpTypePointer Uniform %181 + %183 = OpVariable %182 Uniform + %184 = OpTypePointer Uniform %6 + %232 = OpConstant %17 9 + %233 = OpTypeArray %6 %232 + %234 = OpTypePointer Function %233 + %239 = OpConstant %63 9 + %319 = OpConstant %6 2 + %324 = OpTypeVector %6 4 + %325 = OpTypePointer Input %324 + %326 = OpVariable %325 Input + %336 = OpConstant %63 25 + %349 = OpTypePointer Output %324 + %350 = OpVariable %349 Output + %351 = OpConstantComposite %324 %22 %88 %88 %22 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %323 = OpVariable %8 Function + %329 = OpVariable %8 Function + %332 = OpVariable %8 Function + %335 = OpVariable %64 Function + %344 = OpVariable %8 Function + %317 = OpAccessChain %184 %183 %66 %18 + %318 = OpLoad %6 %317 + %320 = OpFOrdGreaterThanEqual %14 %318 %319 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %327 = OpLoad %324 %326 + %328 = OpVectorShuffle %7 %327 %327 0 1 + OpStore %323 %328 + %330 = OpLoad %7 %323 + OpStore %329 %330 + %331 = OpFunctionCall %9 %12 %329 + %333 = OpLoad %7 %323 + OpStore %332 %333 + %334 = OpFunctionCall %9 %12 %332 + OpStore %335 %336 + OpBranch %337 + %337 = OpLabel + OpLoopMerge %339 %340 None + OpBranch %341 + %341 = OpLabel + %342 = OpLoad %63 %335 + %343 = OpSGreaterThan %14 %342 %66 + OpBranchConditional %343 %338 %339 + %338 = OpLabel + %345 = OpLoad %7 %323 + OpStore %344 %345 + %346 = OpFunctionCall %9 %12 %344 + OpBranch %340 + %340 = OpLabel + %347 = OpLoad %63 %335 + %348 = OpISub %63 %347 %83 + OpStore %335 %348 + OpBranch %337 + %339 = OpLabel + OpBranch %322 + %322 = OpLabel + OpStore %350 %351 + OpReturn + OpFunctionEnd + %12 = OpFunction %9 None %10 + %11 = OpFunctionParameter %8 + %13 = OpLabel + %16 = OpVariable %15 Function + %29 = OpVariable %15 Function + %38 = OpVariable %15 Function + %46 = OpVariable %15 Function + %54 = OpVariable %15 Function + %65 = OpVariable %64 Function + %75 = OpVariable %64 Function + %87 = OpVariable %86 Function + %95 = OpVariable %94 Function + %100 = OpVariable %64 Function + %109 = OpVariable %64 Function + %117 = OpVariable %64 Function + %125 = OpVariable %64 Function + %133 = OpVariable %64 Function + %134 = OpVariable %64 Function + %150 = OpVariable %64 Function + %158 = OpVariable %64 Function + %214 = OpVariable %64 Function + %215 = OpVariable %64 Function + %216 = OpVariable %64 Function + %231 = OpVariable %64 Function + %235 = OpVariable %234 Function + %245 = OpVariable %64 Function + %253 = OpVariable %64 Function + %273 = OpVariable %64 Function + %284 = OpVariable %94 Function + %20 = OpAccessChain %19 %11 %18 + %21 = OpLoad %6 %20 + %23 = OpFOrdGreaterThan %14 %21 %22 + OpStore %16 %23 + %24 = OpLoad %14 %16 + OpSelectionMerge %26 None + OpBranchConditional %24 %25 %26 + %25 = OpLabel + OpReturnValue %27 + %26 = OpLabel + %31 = OpAccessChain %19 %11 %30 + %32 = OpLoad %6 %31 + %33 = OpFOrdLessThan %14 %32 %22 + OpStore %29 %33 + %34 = OpLoad %14 %29 + OpSelectionMerge %36 None + OpBranchConditional %34 %35 %36 + %35 = OpLabel + OpReturnValue %27 + %36 = OpLabel + %39 = OpAccessChain %19 %11 %30 + %40 = OpLoad %6 %39 + %41 = OpFOrdGreaterThan %14 %40 %22 + OpStore %38 %41 + %42 = OpLoad %14 %38 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %44 + %43 = OpLabel + OpReturnValue %27 + %44 = OpLabel + %47 = OpAccessChain %19 %11 %18 + %48 = OpLoad %6 %47 + %49 = OpFOrdLessThan %14 %48 %22 + OpStore %46 %49 + %50 = OpLoad %14 %46 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %52 + %51 = OpLabel + OpReturnValue %27 + %52 = OpLabel + %55 = OpAccessChain %19 %11 %18 + %56 = OpLoad %6 %55 + %57 = OpFAdd %6 %56 %22 + %58 = OpFOrdGreaterThan %14 %57 %22 + OpStore %54 %58 + %59 = OpLoad %14 %54 + OpSelectionMerge %61 None + OpBranchConditional %59 %60 %61 + %60 = OpLabel + OpReturnValue %27 + %61 = OpLabel + OpStore %65 %66 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %72 = OpLoad %63 %65 + %74 = OpSLessThan %14 %72 %73 + OpBranchConditional %74 %68 %69 + %68 = OpLabel + %76 = OpLoad %63 %75 + %78 = OpSGreaterThanEqual %14 %76 %77 + OpSelectionMerge %80 None + OpBranchConditional %78 %79 %80 + %79 = OpLabel + OpBranch %69 + %80 = OpLabel + %82 = OpLoad %63 %75 + %84 = OpIAdd %63 %82 %83 + OpStore %75 %84 + OpStore %87 %92 + OpStore %95 %99 + OpStore %100 %101 + OpBranch %102 + %102 = OpLabel + OpLoopMerge %104 %105 None + OpBranch %106 + %106 = OpLabel + %107 = OpLoad %63 %100 + %108 = OpSLessThan %14 %107 %73 + OpBranchConditional %108 %103 %104 + %103 = OpLabel + %110 = OpLoad %63 %109 + %111 = OpSGreaterThanEqual %14 %110 %77 + OpSelectionMerge %113 None + OpBranchConditional %111 %112 %113 + %112 = OpLabel + OpBranch %104 + %113 = OpLabel + %115 = OpLoad %63 %109 + %116 = OpIAdd %63 %115 %83 + OpStore %109 %116 + OpStore %117 %101 + OpBranch %118 + %118 = OpLabel + OpLoopMerge %120 %121 None + OpBranch %122 + %122 = OpLabel + %123 = OpLoad %63 %117 + %124 = OpSLessThan %14 %123 %73 + OpBranchConditional %124 %119 %120 + %119 = OpLabel + %126 = OpLoad %63 %125 + %127 = OpSGreaterThanEqual %14 %126 %77 + OpSelectionMerge %129 None + OpBranchConditional %127 %128 %129 + %128 = OpLabel + OpBranch %120 + %129 = OpLabel + %131 = OpLoad %63 %125 + %132 = OpIAdd %63 %131 %83 + OpStore %125 %132 + OpStore %133 %66 + OpStore %134 %66 + OpBranch %135 + %135 = OpLabel + OpLoopMerge %137 %138 None + OpBranch %139 + %139 = OpLabel + %140 = OpLoad %63 %134 + %142 = OpSLessThan %14 %140 %141 + OpBranchConditional %142 %136 %137 + %136 = OpLabel + %143 = OpLoad %63 %133 + %144 = OpSGreaterThanEqual %14 %143 %77 + OpSelectionMerge %146 None + OpBranchConditional %144 %145 %146 + %145 = OpLabel + OpBranch %137 + %146 = OpLabel + %148 = OpLoad %63 %133 + %149 = OpIAdd %63 %148 %83 + OpStore %133 %149 + OpStore %150 %66 + OpBranch %151 + %151 = OpLabel + OpLoopMerge %153 %154 None + OpBranch %155 + %155 = OpLabel + %156 = OpLoad %63 %150 + %157 = OpSLessThan %14 %156 %101 + OpBranchConditional %157 %152 %153 + %152 = OpLabel + %159 = OpLoad %63 %158 + %160 = OpSGreaterThanEqual %14 %159 %77 + OpSelectionMerge %162 None + OpBranchConditional %160 %161 %162 + %161 = OpLabel + OpBranch %153 + %162 = OpLabel + %164 = OpLoad %63 %158 + %165 = OpIAdd %63 %164 %83 + OpStore %158 %165 + %166 = OpLoad %63 %134 + %167 = OpSGreaterThanEqual %14 %166 %66 + %168 = OpLoad %63 %134 + %169 = OpSLessThan %14 %168 %141 + %170 = OpLogicalAnd %14 %167 %169 + %171 = OpLoad %63 %134 + %172 = OpSelect %63 %170 %171 %66 + %173 = OpLoad %63 %150 + %174 = OpSGreaterThanEqual %14 %173 %66 + %175 = OpLoad %63 %150 + %176 = OpSLessThan %14 %175 %141 + %177 = OpLogicalAnd %14 %174 %176 + %178 = OpLoad %63 %150 + %179 = OpSelect %63 %177 %178 %66 + %180 = OpAccessChain %19 %95 %172 %179 + OpStore %180 %22 + %185 = OpAccessChain %184 %183 %66 %30 + %186 = OpLoad %6 %185 + %187 = OpFOrdGreaterThan %14 %88 %186 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %190 + %188 = OpLabel + OpBranch %189 + %190 = OpLabel + %191 = OpLoad %63 %134 + %192 = OpSGreaterThanEqual %14 %191 %66 + %193 = OpLoad %63 %134 + %194 = OpSLessThan %14 %193 %73 + %195 = OpLogicalAnd %14 %192 %194 + %196 = OpLoad %63 %134 + %197 = OpSelect %63 %195 %196 %66 + %198 = OpLoad %63 %150 + %199 = OpSGreaterThanEqual %14 %198 %66 + %200 = OpLoad %63 %150 + %201 = OpSLessThan %14 %200 %101 + %202 = OpLogicalAnd %14 %199 %201 + %203 = OpLoad %63 %150 + %204 = OpSelect %63 %202 %203 %66 + %205 = OpAccessChain %19 %87 %197 %204 + OpStore %205 %22 + OpBranch %189 + %189 = OpLabel + OpBranch %154 + %154 = OpLabel + %206 = OpLoad %63 %150 + %207 = OpIAdd %63 %206 %83 + OpStore %150 %207 + OpBranch %151 + %153 = OpLabel + OpBranch %138 + %138 = OpLabel + %208 = OpLoad %63 %134 + %209 = OpIAdd %63 %208 %83 + OpStore %134 %209 + OpBranch %135 + %137 = OpLabel + OpBranch %121 + %121 = OpLabel + %210 = OpLoad %63 %117 + %211 = OpIAdd %63 %210 %83 + OpStore %117 %211 + OpBranch %118 + %120 = OpLabel + OpBranch %105 + %105 = OpLabel + %212 = OpLoad %63 %100 + %213 = OpIAdd %63 %212 %83 + OpStore %100 %213 + OpBranch %102 + %104 = OpLabel + OpStore %214 %66 + OpStore %215 %66 + OpStore %216 %101 + OpBranch %217 + %217 = OpLabel + OpLoopMerge %219 %220 None + OpBranch %221 + %221 = OpLabel + %222 = OpLoad %63 %216 + %223 = OpSLessThan %14 %222 %73 + OpBranchConditional %223 %218 %219 + %218 = OpLabel + %224 = OpLoad %63 %215 + %225 = OpSGreaterThanEqual %14 %224 %77 + OpSelectionMerge %227 None + OpBranchConditional %225 %226 %227 + %226 = OpLabel + OpBranch %219 + %227 = OpLabel + %229 = OpLoad %63 %215 + %230 = OpIAdd %63 %229 %83 + OpStore %215 %230 + OpStore %231 %101 + %236 = OpLoad %63 %214 + %237 = OpSGreaterThanEqual %14 %236 %66 + %238 = OpLoad %63 %214 + %240 = OpSLessThan %14 %238 %239 + %241 = OpLogicalAnd %14 %237 %240 + %242 = OpLoad %63 %214 + %243 = OpSelect %63 %241 %242 %66 + %244 = OpAccessChain %19 %235 %243 + OpStore %244 %88 + OpStore %245 %66 + OpBranch %246 + %246 = OpLabel + OpLoopMerge %248 %249 None + OpBranch %250 + %250 = OpLabel + %251 = OpLoad %63 %245 + %252 = OpSLessThan %14 %251 %83 + OpBranchConditional %252 %247 %248 + %247 = OpLabel + OpStore %253 %66 + OpBranch %254 + %254 = OpLabel + OpLoopMerge %256 %257 None + OpBranch %258 + %258 = OpLabel + %259 = OpLoad %63 %253 + %260 = OpLoad %63 %231 + %261 = OpSLessThan %14 %259 %260 + OpBranchConditional %261 %255 %256 + %255 = OpLabel + %262 = OpLoad %63 %214 + %263 = OpSGreaterThanEqual %14 %262 %66 + %264 = OpLoad %63 %214 + %265 = OpSLessThan %14 %264 %239 + %266 = OpLogicalAnd %14 %263 %265 + %267 = OpLoad %63 %214 + %268 = OpSelect %63 %266 %267 %66 + %269 = OpLoad %93 %95 + %270 = OpTranspose %93 %269 + %271 = OpLoad %63 %245 + %272 = OpSLessThan %14 %271 %141 + OpSelectionMerge %275 None + OpBranchConditional %272 %274 %276 + %274 = OpLabel + OpStore %273 %83 + OpBranch %275 + %276 = OpLabel + %277 = OpAccessChain %184 %183 %66 %18 + %278 = OpLoad %6 %277 + %279 = OpConvertFToS %63 %278 + OpStore %273 %279 + OpBranch %275 + %275 = OpLabel + %280 = OpLoad %63 %273 + %281 = OpLoad %63 %253 + %282 = OpSLessThan %14 %281 %141 + %283 = OpSelect %63 %282 %83 %66 + OpStore %284 %270 + %285 = OpAccessChain %19 %284 %280 %283 + %286 = OpLoad %6 %285 + %287 = OpAccessChain %19 %235 %268 + %288 = OpLoad %6 %287 + %289 = OpFAdd %6 %288 %286 + %290 = OpAccessChain %19 %235 %268 + OpStore %290 %289 + %291 = OpLoad %63 %214 + %292 = OpSGreaterThanEqual %14 %291 %66 + %293 = OpLoad %63 %214 + %294 = OpSLessThan %14 %293 %239 + %295 = OpLogicalAnd %14 %292 %294 + %296 = OpLoad %63 %214 + %297 = OpSelect %63 %295 %296 %66 + %298 = OpLoad %63 %253 + %299 = OpAccessChain %19 %87 %83 %298 + %300 = OpLoad %6 %299 + %301 = OpAccessChain %19 %235 %297 + %302 = OpLoad %6 %301 + %303 = OpFAdd %6 %302 %300 + %304 = OpAccessChain %19 %235 %297 + OpStore %304 %303 + OpBranch %257 + %257 = OpLabel + %305 = OpLoad %63 %253 + %306 = OpIAdd %63 %305 %83 + OpStore %253 %306 + OpBranch %254 + %256 = OpLabel + OpBranch %249 + %249 = OpLabel + %307 = OpLoad %63 %245 + %308 = OpIAdd %63 %307 %83 + OpStore %245 %308 + OpBranch %246 + %248 = OpLabel + %309 = OpLoad %63 %214 + %310 = OpIAdd %63 %309 %83 + OpStore %214 %310 + OpBranch %220 + %220 = OpLabel + %311 = OpLoad %63 %216 + %312 = OpIAdd %63 %311 %83 + OpStore %216 %312 + OpBranch %217 + %219 = OpLabel + OpBranch %70 + %70 = OpLabel + %313 = OpLoad %63 %65 + %314 = OpIAdd %63 %313 %83 + OpStore %65 %314 + OpBranch %67 + %69 = OpLabel + OpReturnValue %27 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/control-flow-switch.amber b/vulkan/amber/graphicsfuzz/control-flow-switch.amber new file mode 100644 index 0000000..3393d1b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/control-flow-switch.amber @@ -0,0 +1,242 @@ +#!amber + +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# A fragment shader with somewhat complex control flow and a switch. +# Derived from the following GLSL fragment shader. +# We check that all pixels are red. The test passes because the final +# statement writes red to _GLF_color and there are no discard statements. + +# #version 310 es +# +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# layout(location=0) out vec4 _GLF_color; +# +# struct S { +# bool ok; +# }; +# +# bool g() +# { +# for( +# int i = 0; +# i < 1; +# i++ +# ) +# { +# switch(int(injectionSwitch.x)) +# { +# case 9: +# S a = S(bool(injectionSwitch.x)); +# S b = a; +# case 42: +# if(b.ok) +# { +# return true; +# } +# default: +# break; +# } +# } +# return true; +# } +# vec3 f() +# { +# { +# S a = S(bool(injectionSwitch.x)); +# if(a.ok) +# { +# return vec3(0.0); +# } +# if(g()) +# { +# return vec3(1.0); +# } +# } +# return vec3(1.0); +# } +# void main() +# { +# _GLF_color = vec4(f(), 1.0); +# // always true at runtime +# if (injectionSwitch.x == 0.0) { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource ESSL 310 + OpName %2 "main" + OpName %4 "buf0" + OpMemberName %4 0 "injectionSwitch" + OpName %5 "" + OpName %3 "_GLF_color" + OpMemberDecorate %4 0 Offset 0 + OpDecorate %4 Block + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + OpDecorate %3 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeBool + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 3 + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpConstant %11 1 + %14 = OpTypeVector %9 2 + %4 = OpTypeStruct %14 + %15 = OpTypePointer Uniform %4 + %5 = OpVariable %15 Uniform + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %9 + %19 = OpConstant %9 0 + %20 = OpConstantTrue %8 + %21 = OpConstantComposite %10 %19 %19 %19 + %22 = OpConstant %9 1 + %23 = OpConstantComposite %10 %22 %22 %22 + %24 = OpTypeVector %9 4 + %25 = OpTypePointer Output %24 + %3 = OpVariable %25 Output + %26 = OpConstantComposite %24 %22 %19 %19 %22 + %27 = OpConstantFalse %8 + %28 = OpUndef %8 + %2 = OpFunction %6 None %7 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpAccessChain %18 %5 %12 %17 + %35 = OpLoad %9 %34 + %36 = OpFOrdNotEqual %8 %35 %19 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + OpBranch %31 + %37 = OpLabel + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpPhi %8 %28 %39 %44 %72 + %46 = OpPhi %11 %12 %39 %47 %72 + %48 = OpSLessThan %8 %46 %13 + OpLoopMerge %49 %72 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + %51 = OpConvertFToS %11 %35 + OpSelectionMerge %52 None + OpSwitch %51 %45 9 %53 42 %54 + %52 = OpLabel + OpBranch %72 + %45 = OpLabel + %44 = OpPhi %8 %43 %50 %55 %56 + %47 = OpIAdd %11 %46 %13 + OpBranch %72 + %72 = OpLabel + OpBranch %42 + %53 = OpLabel + OpBranch %54 + %54 = OpLabel + %55 = OpPhi %8 %43 %50 %36 %53 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + OpBranch %49 + %56 = OpLabel + OpBranch %45 + %49 = OpLabel + %58 = OpPhi %8 %28 %42 %20 %57 + %59 = OpPhi %8 %27 %42 %20 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %40 %60 + %60 = OpLabel + OpBranch %40 + %41 = OpLabel + OpBranch %39 + %40 = OpLabel + %61 = OpPhi %8 %58 %49 %20 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + OpBranch %31 + %62 = OpLabel + OpBranch %31 + %32 = OpLabel + OpBranch %30 + %31 = OpLabel + %64 = OpPhi %10 %21 %38 %23 %63 %23 %62 + %65 = OpCompositeExtract %9 %64 0 + %66 = OpCompositeExtract %9 %64 1 + %67 = OpCompositeExtract %9 %64 2 + %68 = OpCompositeConstruct %24 %65 %66 %67 %22 + OpStore %3 %68 + %69 = OpFOrdEqual %8 %35 %19 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + OpStore %3 %26 + OpBranch %70 + %70 = OpLabel + OpReturn + OpFunctionEnd +END + + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cosh-return-inf-unused.amber b/vulkan/amber/graphicsfuzz/cosh-return-inf-unused.amber new file mode 100644 index 0000000..724e5d1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cosh-return-inf-unused.amber @@ -0,0 +1,348 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: Cosh returns inf for one component which is never used + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float zero; +# }; +# +# // Returns 3.0 if b > 1, otherwise returns 5.0. +# float func(int b) +# { +# for (int ndx = 0; ndx < 2; ndx++) +# { +# // Always false. +# if (gl_FragCoord.x < 0.0) +# { +# for (int i = 0; i < 2; i++) +# { +# // Always false. +# if (int(cosh(vec2(1, 800)).x) <= 1) +# discard; +# } +# } +# } +# +# if (b > 1) +# return 3.0; +# +# // Always false. +# if (gl_FragCoord.x < 0.0) +# _GLF_color = vec4(0); +# +# return 5.0; +# } +# +# void main() +# { +# _GLF_color = vec4(1); +# float f = 0.0; +# +# do +# { +# // Always false. +# if (int(_GLF_color.y) < 0) +# discard; +# else +# f = func(int(zero)); // f == 5.0 +# +# // Always false. +# if (int(_GLF_color.y) > 65) +# discard; +# +# for (int x = 0; x < int(zero) + 1; x++) +# { +# f = func(x + 10); // f == 3.0 +# } +# +# } while (int(zero) > 1); // Always false. +# +# if (f == 3.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 140 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %26 %72 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "func(i1;" + OpName %10 "b" + OpName %13 "ndx" + OpName %26 "gl_FragCoord" + OpName %36 "i" + OpName %72 "_GLF_color" + OpName %79 "f" + OpName %94 "buf0" + OpMemberName %94 0 "zero" + OpName %96 "" + OpName %101 "param" + OpName %111 "x" + OpName %126 "param" + OpDecorate %26 BuiltIn FragCoord + OpDecorate %72 Location 0 + OpMemberDecorate %94 0 Offset 0 + OpDecorate %94 Block + OpDecorate %96 DescriptorSet 0 + OpDecorate %96 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFloat 32 + %9 = OpTypeFunction %8 %7 + %14 = OpConstant %6 0 + %21 = OpConstant %6 2 + %22 = OpTypeBool + %24 = OpTypeVector %8 4 + %25 = OpTypePointer Input %24 + %26 = OpVariable %25 Input + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %29 = OpTypePointer Input %8 + %32 = OpConstant %8 0 + %44 = OpTypeVector %8 2 + %45 = OpConstant %8 1 + %46 = OpConstant %8 800 + %47 = OpConstantComposite %44 %45 %46 + %51 = OpConstant %6 1 + %64 = OpConstant %8 3 + %71 = OpTypePointer Output %24 + %72 = OpVariable %71 Output + %73 = OpConstantComposite %24 %32 %32 %32 %32 + %74 = OpConstant %8 5 + %77 = OpConstantComposite %24 %45 %45 %45 %45 + %78 = OpTypePointer Function %8 + %84 = OpConstant %27 1 + %85 = OpTypePointer Output %8 + %94 = OpTypeStruct %8 + %95 = OpTypePointer Uniform %94 + %96 = OpVariable %95 Uniform + %97 = OpTypePointer Uniform %8 + %106 = OpConstant %6 65 + %124 = OpConstant %6 10 + %138 = OpConstantComposite %24 %45 %32 %32 %45 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %79 = OpVariable %78 Function + %101 = OpVariable %7 Function + %111 = OpVariable %7 Function + %126 = OpVariable %7 Function + OpStore %72 %77 + OpStore %79 %32 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %82 %83 None + OpBranch %81 + %81 = OpLabel + %86 = OpAccessChain %85 %72 %84 + %87 = OpLoad %8 %86 + %88 = OpConvertFToS %6 %87 + %89 = OpSLessThan %22 %88 %14 + OpSelectionMerge %91 None + OpBranchConditional %89 %90 %93 + %90 = OpLabel + OpTerminateInvocation + %93 = OpLabel + %98 = OpAccessChain %97 %96 %14 + %99 = OpLoad %8 %98 + %100 = OpConvertFToS %6 %99 + OpStore %101 %100 + %102 = OpFunctionCall %8 %11 %101 + OpStore %79 %102 + OpBranch %91 + %91 = OpLabel + %103 = OpAccessChain %85 %72 %84 + %104 = OpLoad %8 %103 + %105 = OpConvertFToS %6 %104 + %107 = OpSGreaterThan %22 %105 %106 + OpSelectionMerge %109 None + OpBranchConditional %107 %108 %109 + %108 = OpLabel + OpTerminateInvocation + %109 = OpLabel + OpStore %111 %14 + OpBranch %112 + %112 = OpLabel + OpLoopMerge %114 %115 None + OpBranch %116 + %116 = OpLabel + %117 = OpLoad %6 %111 + %118 = OpAccessChain %97 %96 %14 + %119 = OpLoad %8 %118 + %120 = OpConvertFToS %6 %119 + %121 = OpIAdd %6 %120 %51 + %122 = OpSLessThan %22 %117 %121 + OpBranchConditional %122 %113 %114 + %113 = OpLabel + %123 = OpLoad %6 %111 + %125 = OpIAdd %6 %123 %124 + OpStore %126 %125 + %127 = OpFunctionCall %8 %11 %126 + OpStore %79 %127 + OpBranch %115 + %115 = OpLabel + %128 = OpLoad %6 %111 + %129 = OpIAdd %6 %128 %51 + OpStore %111 %129 + OpBranch %112 + %114 = OpLabel + OpBranch %83 + %83 = OpLabel + %130 = OpAccessChain %97 %96 %14 + %131 = OpLoad %8 %130 + %132 = OpConvertFToS %6 %131 + %133 = OpSGreaterThan %22 %132 %51 + OpBranchConditional %133 %80 %82 + %82 = OpLabel + %134 = OpLoad %8 %79 + %135 = OpFOrdEqual %22 %134 %64 + OpSelectionMerge %137 None + OpBranchConditional %135 %136 %139 + %136 = OpLabel + OpStore %72 %138 + OpBranch %137 + %139 = OpLabel + OpStore %72 %73 + OpBranch %137 + %137 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %8 None %9 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %13 = OpVariable %7 Function + %36 = OpVariable %7 Function + OpStore %13 %14 + OpBranch %15 + %15 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %20 = OpLoad %6 %13 + %23 = OpSLessThan %22 %20 %21 + OpBranchConditional %23 %16 %17 + %16 = OpLabel + %30 = OpAccessChain %29 %26 %28 + %31 = OpLoad %8 %30 + %33 = OpFOrdLessThan %22 %31 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %35 + %34 = OpLabel + OpStore %36 %14 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %6 %36 + %43 = OpSLessThan %22 %42 %21 + OpBranchConditional %43 %38 %39 + %38 = OpLabel + %48 = OpExtInst %44 %1 Cosh %47 + %49 = OpCompositeExtract %8 %48 0 + %50 = OpConvertFToS %6 %49 + %52 = OpSLessThanEqual %22 %50 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + OpTerminateInvocation + %54 = OpLabel + OpBranch %40 + %40 = OpLabel + %56 = OpLoad %6 %36 + %57 = OpIAdd %6 %56 %51 + OpStore %36 %57 + OpBranch %37 + %39 = OpLabel + OpBranch %35 + %35 = OpLabel + OpBranch %18 + %18 = OpLabel + %58 = OpLoad %6 %13 + %59 = OpIAdd %6 %58 %51 + OpStore %13 %59 + OpBranch %15 + %17 = OpLabel + %60 = OpLoad %6 %10 + %61 = OpSGreaterThan %22 %60 %51 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %63 + %62 = OpLabel + OpReturnValue %64 + %63 = OpLabel + %66 = OpAccessChain %29 %26 %28 + %67 = OpLoad %8 %66 + %68 = OpFOrdLessThan %22 %67 %32 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %70 + %69 = OpLabel + OpStore %72 %73 + OpBranch %70 + %70 = OpLabel + OpReturnValue %74 + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-access-array-dot.amber b/vulkan/amber/graphicsfuzz/cov-access-array-dot.amber new file mode 100644 index 0000000..769350b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-access-array-dot.amber @@ -0,0 +1,239 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers instruction combine casting, combine shifting and DAG code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_2_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_0_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [2.0, 1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int numbers[3]; +# numbers[_int_0] = _int_0; +# numbers[_int_1] = _int_1; +# numbers[_int_2] = _int_2; +# +# vec2 a = vec2(_int_0, numbers[((0.0 < _float_0_0) ? 1 : 2)]); +# float b = dot(a, vec2(_float_1_0, _float_1_0)); +# +# if (b == _float_2_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 94 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %75 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "numbers" + OpName %13 "buf1" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %39 "a" + OpName %45 "buf0" + OpMemberName %45 0 "_GLF_uniform_float_values" + OpName %47 "" + OpName %59 "b" + OpName %75 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %44 ArrayStride 16 + OpMemberDecorate %45 0 Offset 0 + OpDecorate %45 Block + OpDecorate %47 DescriptorSet 0 + OpDecorate %47 Binding 0 + OpDecorate %75 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 3 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpTypeArray %6 %8 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %6 0 + %17 = OpTypePointer Uniform %6 + %22 = OpTypePointer Function %6 + %24 = OpConstant %6 1 + %30 = OpConstant %6 2 + %36 = OpTypeFloat 32 + %37 = OpTypeVector %36 2 + %38 = OpTypePointer Function %37 + %43 = OpConstant %36 0 + %44 = OpTypeArray %36 %8 + %45 = OpTypeStruct %44 + %46 = OpTypePointer Uniform %45 + %47 = OpVariable %46 Uniform + %48 = OpTypePointer Uniform %36 + %51 = OpTypeBool + %58 = OpTypePointer Function %36 + %73 = OpTypeVector %36 4 + %74 = OpTypePointer Output %73 + %75 = OpVariable %74 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %39 = OpVariable %38 Function + %59 = OpVariable %58 Function + %18 = OpAccessChain %17 %15 %16 %16 + %19 = OpLoad %6 %18 + %20 = OpAccessChain %17 %15 %16 %16 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %22 %11 %19 + OpStore %23 %21 + %25 = OpAccessChain %17 %15 %16 %24 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %17 %15 %16 %24 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %22 %11 %26 + OpStore %29 %28 + %31 = OpAccessChain %17 %15 %16 %30 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %17 %15 %16 %30 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %22 %11 %32 + OpStore %35 %34 + %40 = OpAccessChain %17 %15 %16 %16 + %41 = OpLoad %6 %40 + %42 = OpConvertSToF %36 %41 + %49 = OpAccessChain %48 %47 %16 %30 + %50 = OpLoad %36 %49 + %52 = OpFOrdLessThan %51 %43 %50 + %53 = OpSelect %6 %52 %24 %30 + %54 = OpAccessChain %22 %11 %53 + %55 = OpLoad %6 %54 + %56 = OpConvertSToF %36 %55 + %57 = OpCompositeConstruct %37 %42 %56 + OpStore %39 %57 + %60 = OpLoad %37 %39 + %61 = OpAccessChain %48 %47 %16 %24 + %62 = OpLoad %36 %61 + %63 = OpAccessChain %48 %47 %16 %24 + %64 = OpLoad %36 %63 + %65 = OpCompositeConstruct %37 %62 %64 + %66 = OpDot %36 %60 %65 + OpStore %59 %66 + %67 = OpLoad %36 %59 + %68 = OpAccessChain %48 %47 %16 %16 + %69 = OpLoad %36 %68 + %70 = OpFOrdEqual %51 %67 %69 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %89 + %71 = OpLabel + %76 = OpAccessChain %17 %15 %16 %24 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %36 %77 + %79 = OpAccessChain %17 %15 %16 %16 + %80 = OpLoad %6 %79 + %81 = OpConvertSToF %36 %80 + %82 = OpAccessChain %17 %15 %16 %16 + %83 = OpLoad %6 %82 + %84 = OpConvertSToF %36 %83 + %85 = OpAccessChain %17 %15 %16 %24 + %86 = OpLoad %6 %85 + %87 = OpConvertSToF %36 %86 + %88 = OpCompositeConstruct %73 %78 %81 %84 %87 + OpStore %75 %88 + OpBranch %72 + %89 = OpLabel + %90 = OpAccessChain %17 %15 %16 %16 + %91 = OpLoad %6 %90 + %92 = OpConvertSToF %36 %91 + %93 = OpCompositeConstruct %73 %92 %92 %92 %92 + OpStore %75 %93 + OpBranch %72 + %72 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-analysis-reachable-from-many.amber b/vulkan/amber/graphicsfuzz/cov-analysis-reachable-from-many.amber new file mode 100644 index 0000000..cdf2db6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-analysis-reachable-from-many.amber @@ -0,0 +1,219 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific LLVM analysis code path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int zero; +# }; +# +# // Always returns 5.0. +# float func() +# { +# float s = 2.0; +# +# for(int i = 0; i < (zero + 1); i++) +# { +# s += 3.0; +# +# for (int j = 0; j < 10; j++) +# { +# if (zero == 1) // Always false. +# discard; +# } +# } +# +# return s; +# } +# +# void main() +# { +# vec4 c = vec4(func(), 0, 0, 1); +# +# if (func() == 5.0) +# _GLF_color = c; +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %71 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "s" + OpName %15 "i" + OpName %23 "buf0" + OpMemberName %23 0 "zero" + OpName %25 "" + OpName %36 "j" + OpName %60 "c" + OpName %71 "_GLF_color" + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %71 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 2 + %13 = OpTypeInt 32 1 + %14 = OpTypePointer Function %13 + %16 = OpConstant %13 0 + %23 = OpTypeStruct %13 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpTypePointer Uniform %13 + %29 = OpConstant %13 1 + %31 = OpTypeBool + %33 = OpConstant %6 3 + %43 = OpConstant %13 10 + %58 = OpTypeVector %6 4 + %59 = OpTypePointer Function %58 + %62 = OpConstant %6 0 + %63 = OpConstant %6 1 + %66 = OpConstant %6 5 + %70 = OpTypePointer Output %58 + %71 = OpVariable %70 Output + %74 = OpConstantComposite %58 %62 %62 %62 %62 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %60 = OpVariable %59 Function + %61 = OpFunctionCall %6 %8 + %64 = OpCompositeConstruct %58 %61 %62 %62 %63 + OpStore %60 %64 + %65 = OpFunctionCall %6 %8 + %67 = OpFOrdEqual %31 %65 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %73 + %68 = OpLabel + %72 = OpLoad %58 %60 + OpStore %71 %72 + OpBranch %69 + %73 = OpLabel + OpStore %71 %74 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %15 = OpVariable %14 Function + %36 = OpVariable %14 Function + OpStore %11 %12 + OpStore %15 %16 + OpBranch %17 + %17 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + %22 = OpLoad %13 %15 + %27 = OpAccessChain %26 %25 %16 + %28 = OpLoad %13 %27 + %30 = OpIAdd %13 %28 %29 + %32 = OpSLessThan %31 %22 %30 + OpBranchConditional %32 %18 %19 + %18 = OpLabel + %34 = OpLoad %6 %11 + %35 = OpFAdd %6 %34 %33 + OpStore %11 %35 + OpStore %36 %16 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %13 %36 + %44 = OpSLessThan %31 %42 %43 + OpBranchConditional %44 %38 %39 + %38 = OpLabel + %45 = OpAccessChain %26 %25 %16 + %46 = OpLoad %13 %45 + %47 = OpIEqual %31 %46 %29 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %49 + %48 = OpLabel + OpTerminateInvocation + %49 = OpLabel + OpBranch %40 + %40 = OpLabel + %51 = OpLoad %13 %36 + %52 = OpIAdd %13 %51 %29 + OpStore %36 %52 + OpBranch %37 + %39 = OpLabel + OpBranch %20 + %20 = OpLabel + %53 = OpLoad %13 %15 + %54 = OpIAdd %13 %53 %29 + OpStore %15 %54 + OpBranch %17 + %19 = OpLabel + %55 = OpLoad %6 %11 + OpReturnValue %55 + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-and-even-numbers-from-fragcoord.amber b/vulkan/amber/graphicsfuzz/cov-and-even-numbers-from-fragcoord.amber new file mode 100644 index 0000000..dc7c3aa --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-and-even-numbers-from-fragcoord.amber @@ -0,0 +1,228 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_4 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_256_0 _GLF_uniform_float_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# // Contents of _GLF_uniform_float_values: [0.4, 1.0, 256.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always false. +# if(gl_FragCoord.y < _float_0_4) +# { +# _GLF_color = vec4(_int_0); +# } +# else +# { +# // gl_FragCoord has the decimal part of 0.5. If we name the integer part +# // of gl_FragCoord (X, Y) it can be expressed as (X + 0.5, Y + 0.5). +# // +# // The value of v is calculated as follows: +# // v = ((X + 0.5, Y + 0.5) - (1.0, 0.4)) * 256 +# // = (X - 1 + 0.5, Y + 0.5 - 0.4) * 256 +# // = (X - 0.5, Y + 0.1) * 256 +# // = (X * 256 - 128, Y * 256 + 25.6) +# // +# // X * 256 is always an even number, and substracting 128 still keeps it even. +# // Y * 256 is always and even number, but adding 25.6 (and converting to an integer) +# // makes it always odd. +# ivec2 v = ivec2((gl_FragCoord.xy - vec2(_float_1_0, _float_0_4)) * _float_256_0); +# +# // v.x is even and v.y is odd. We substract one from v.y making it even too. +# // Doing a bitwise AND with an even number always resuls in zero. +# _GLF_color = vec4(_float_1_0, (v.y - _int_1) & _int_1, v.x & _int_1, _float_1_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 82 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %30 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "gl_FragCoord" + OpName %17 "buf1" + OpMemberName %17 0 "_GLF_uniform_float_values" + OpName %19 "" + OpName %30 "_GLF_color" + OpName %33 "buf0" + OpMemberName %33 0 "_GLF_uniform_int_values" + OpName %35 "" + OpName %44 "v" + OpDecorate %9 BuiltIn FragCoord + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %30 Location 0 + OpDecorate %32 ArrayStride 16 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Input %7 + %9 = OpVariable %8 Input + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 1 + %12 = OpTypePointer Input %6 + %15 = OpConstant %10 3 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypeInt 32 1 + %21 = OpConstant %20 0 + %22 = OpTypePointer Uniform %6 + %25 = OpTypeBool + %29 = OpTypePointer Output %7 + %30 = OpVariable %29 Output + %31 = OpConstant %10 2 + %32 = OpTypeArray %20 %31 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpTypePointer Uniform %20 + %42 = OpTypeVector %20 2 + %43 = OpTypePointer Function %42 + %45 = OpTypeVector %6 2 + %48 = OpConstant %20 1 + %55 = OpConstant %20 2 + %62 = OpTypePointer Function %20 + %72 = OpConstant %10 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %44 = OpVariable %43 Function + %13 = OpAccessChain %12 %9 %11 + %14 = OpLoad %6 %13 + %23 = OpAccessChain %22 %19 %21 %21 + %24 = OpLoad %6 %23 + %26 = OpFOrdLessThan %25 %14 %24 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %41 + %27 = OpLabel + %37 = OpAccessChain %36 %35 %21 %21 + %38 = OpLoad %20 %37 + %39 = OpConvertSToF %6 %38 + %40 = OpCompositeConstruct %7 %39 %39 %39 %39 + OpStore %30 %40 + OpBranch %28 + %41 = OpLabel + %46 = OpLoad %7 %9 + %47 = OpVectorShuffle %45 %46 %46 0 1 + %49 = OpAccessChain %22 %19 %21 %48 + %50 = OpLoad %6 %49 + %51 = OpAccessChain %22 %19 %21 %21 + %52 = OpLoad %6 %51 + %53 = OpCompositeConstruct %45 %50 %52 + %54 = OpFSub %45 %47 %53 + %56 = OpAccessChain %22 %19 %21 %55 + %57 = OpLoad %6 %56 + %58 = OpVectorTimesScalar %45 %54 %57 + %59 = OpConvertFToS %42 %58 + OpStore %44 %59 + %60 = OpAccessChain %22 %19 %21 %48 + %61 = OpLoad %6 %60 + %63 = OpAccessChain %62 %44 %11 + %64 = OpLoad %20 %63 + %65 = OpAccessChain %36 %35 %21 %48 + %66 = OpLoad %20 %65 + %67 = OpISub %20 %64 %66 + %68 = OpAccessChain %36 %35 %21 %48 + %69 = OpLoad %20 %68 + %70 = OpBitwiseAnd %20 %67 %69 + %71 = OpConvertSToF %6 %70 + %73 = OpAccessChain %62 %44 %72 + %74 = OpLoad %20 %73 + %75 = OpAccessChain %36 %35 %21 %48 + %76 = OpLoad %20 %75 + %77 = OpBitwiseAnd %20 %74 %76 + %78 = OpConvertSToF %6 %77 + %79 = OpAccessChain %22 %19 %21 %48 + %80 = OpLoad %6 %79 + %81 = OpCompositeConstruct %7 %61 %71 %78 %80 + OpStore %30 %81 + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.4 1.0 256.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-apfloat-acos-ldexp.amber b/vulkan/amber/graphicsfuzz/cov-apfloat-acos-ldexp.amber new file mode 100644 index 0000000..e04ecae --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-apfloat-acos-ldexp.amber @@ -0,0 +1,148 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific AP float code path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int two; +# }; +# +# void main() +# { +# vec2 v = acos(ldexp(vec2(0.1), ivec2(two, 3))); +# float d = distance(v, vec2(1.15928, 0.64350)); +# +# if (d < 0.01) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 46 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %40 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v" + OpName %13 "buf0" + OpMemberName %13 0 "two" + OpName %15 "" + OpName %26 "d" + OpName %40 "_GLF_color" + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %40 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 0.100000001 + %11 = OpConstantComposite %7 %10 %10 + %12 = OpTypeInt 32 1 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %12 0 + %17 = OpTypePointer Uniform %12 + %20 = OpConstant %12 3 + %21 = OpTypeVector %12 2 + %25 = OpTypePointer Function %6 + %28 = OpConstant %6 1.15927994 + %29 = OpConstant %6 0.64349997 + %30 = OpConstantComposite %7 %28 %29 + %33 = OpConstant %6 0.00999999978 + %34 = OpTypeBool + %38 = OpTypeVector %6 4 + %39 = OpTypePointer Output %38 + %40 = OpVariable %39 Output + %41 = OpConstant %6 1 + %42 = OpConstant %6 0 + %43 = OpConstantComposite %38 %41 %42 %42 %41 + %45 = OpConstantComposite %38 %42 %42 %42 %42 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %26 = OpVariable %25 Function + %18 = OpAccessChain %17 %15 %16 + %19 = OpLoad %12 %18 + %22 = OpCompositeConstruct %21 %19 %20 + %23 = OpExtInst %7 %1 Ldexp %11 %22 + %24 = OpExtInst %7 %1 Acos %23 + OpStore %9 %24 + %27 = OpLoad %7 %9 + %31 = OpExtInst %6 %1 Distance %27 %30 + OpStore %26 %31 + %32 = OpLoad %6 %26 + %35 = OpFOrdLessThan %34 %32 %33 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %44 + %36 = OpLabel + OpStore %40 %43 + OpBranch %37 + %44 = OpLabel + OpStore %40 %45 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE int32 DATA + 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-apfloat-determinant-for-if.amber b/vulkan/amber/graphicsfuzz/cov-apfloat-determinant-for-if.amber new file mode 100644 index 0000000..2fc9678 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-apfloat-determinant-for-if.amber @@ -0,0 +1,225 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific APFloat code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_100 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_9993001 _GLF_uniform_int_values[3] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 100, 1, 9993001] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Becomes -9993001. +# float a = determinant(mat3(1.0, 5000.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2000.0)); +# +# int b = _int_1; +# +# for (int i = _int_1; i < _int_100; i++) +# { +# if (b > _int_1) +# { +# break; +# } +# b = int(a); +# } +# +# if (b == -_int_9993001) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 87 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %68 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %21 "b" + OpName %25 "buf0" + OpMemberName %25 0 "_GLF_uniform_int_values" + OpName %27 "" + OpName %33 "i" + OpName %68 "_GLF_color" + OpDecorate %24 ArrayStride 16 + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 0 + OpDecorate %68 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeVector %6 3 + %10 = OpTypeMatrix %9 3 + %11 = OpConstant %6 1 + %12 = OpConstant %6 5000 + %13 = OpConstantComposite %9 %11 %12 %11 + %14 = OpConstantComposite %9 %11 %11 %11 + %15 = OpConstant %6 2000 + %16 = OpConstantComposite %9 %11 %11 %15 + %17 = OpConstantComposite %10 %13 %14 %16 + %19 = OpTypeInt 32 1 + %20 = OpTypePointer Function %19 + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 4 + %24 = OpTypeArray %19 %23 + %25 = OpTypeStruct %24 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpConstant %19 0 + %29 = OpConstant %19 2 + %30 = OpTypePointer Uniform %19 + %42 = OpConstant %19 1 + %45 = OpTypeBool + %59 = OpConstant %19 3 + %66 = OpTypeVector %6 4 + %67 = OpTypePointer Output %66 + %68 = OpVariable %67 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %21 = OpVariable %20 Function + %33 = OpVariable %20 Function + %18 = OpExtInst %6 %1 Determinant %17 + OpStore %8 %18 + %31 = OpAccessChain %30 %27 %28 %29 + %32 = OpLoad %19 %31 + OpStore %21 %32 + %34 = OpAccessChain %30 %27 %28 %29 + %35 = OpLoad %19 %34 + OpStore %33 %35 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %19 %33 + %43 = OpAccessChain %30 %27 %28 %42 + %44 = OpLoad %19 %43 + %46 = OpSLessThan %45 %41 %44 + OpBranchConditional %46 %37 %38 + %37 = OpLabel + %47 = OpLoad %19 %21 + %48 = OpAccessChain %30 %27 %28 %29 + %49 = OpLoad %19 %48 + %50 = OpSGreaterThan %45 %47 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %52 + %51 = OpLabel + OpBranch %38 + %52 = OpLabel + %54 = OpLoad %6 %8 + %55 = OpConvertFToS %19 %54 + OpStore %21 %55 + OpBranch %39 + %39 = OpLabel + %56 = OpLoad %19 %33 + %57 = OpIAdd %19 %56 %42 + OpStore %33 %57 + OpBranch %36 + %38 = OpLabel + %58 = OpLoad %19 %21 + %60 = OpAccessChain %30 %27 %28 %59 + %61 = OpLoad %19 %60 + %62 = OpSNegate %19 %61 + %63 = OpIEqual %45 %58 %62 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %82 + %64 = OpLabel + %69 = OpAccessChain %30 %27 %28 %29 + %70 = OpLoad %19 %69 + %71 = OpConvertSToF %6 %70 + %72 = OpAccessChain %30 %27 %28 %28 + %73 = OpLoad %19 %72 + %74 = OpConvertSToF %6 %73 + %75 = OpAccessChain %30 %27 %28 %28 + %76 = OpLoad %19 %75 + %77 = OpConvertSToF %6 %76 + %78 = OpAccessChain %30 %27 %28 %29 + %79 = OpLoad %19 %78 + %80 = OpConvertSToF %6 %79 + %81 = OpCompositeConstruct %66 %71 %74 %77 %80 + OpStore %68 %81 + OpBranch %65 + %82 = OpLabel + %83 = OpAccessChain %30 %27 %28 %28 + %84 = OpLoad %19 %83 + %85 = OpConvertSToF %6 %84 + %86 = OpCompositeConstruct %66 %85 %85 %85 %85 + OpStore %68 %86 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 100 1 9993001 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-apfloat-determinant.amber b/vulkan/amber/graphicsfuzz/cov-apfloat-determinant.amber new file mode 100644 index 0000000..7d272c3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-apfloat-determinant.amber @@ -0,0 +1,169 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific arbitrary precision float usage. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# +# float det1 = determinant(mat4(0, 1, 0, 1, +# 1, 1, 1, 2, +# 1, 4, 6, 1, +# 5, 35, 7, 63)); +# +# float det2 = determinant(mat3(1, 0, 1, +# 4, 6, 1, +# 35, 7, 63)); +# +# float det3 = determinant(mat3(1, 0, 1, +# 1, 1, 2, +# 35, 7, 63)); +# +# float det4 = determinant(mat3(1, 0, 1, +# 1, 1, 2, +# 4, 6, 1)); +# +# float ref = -det2 + det3 - 5.0 * det4; +# +# if (abs(ref - det1) < 0.1) // Always true. +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %59 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "det1" + OpName %26 "det2" + OpName %34 "det3" + OpName %38 "det4" + OpName %41 "ref" + OpName %59 "_GLF_color" + OpDecorate %59 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeVector %6 4 + %10 = OpTypeMatrix %9 4 + %11 = OpConstant %6 0 + %12 = OpConstant %6 1 + %13 = OpConstantComposite %9 %11 %12 %11 %12 + %14 = OpConstant %6 2 + %15 = OpConstantComposite %9 %12 %12 %12 %14 + %16 = OpConstant %6 4 + %17 = OpConstant %6 6 + %18 = OpConstantComposite %9 %12 %16 %17 %12 + %19 = OpConstant %6 5 + %20 = OpConstant %6 35 + %21 = OpConstant %6 7 + %22 = OpConstant %6 63 + %23 = OpConstantComposite %9 %19 %20 %21 %22 + %24 = OpConstantComposite %10 %13 %15 %18 %23 + %27 = OpTypeVector %6 3 + %28 = OpTypeMatrix %27 3 + %29 = OpConstantComposite %27 %12 %11 %12 + %30 = OpConstantComposite %27 %16 %17 %12 + %31 = OpConstantComposite %27 %20 %21 %22 + %32 = OpConstantComposite %28 %29 %30 %31 + %35 = OpConstantComposite %27 %12 %12 %14 + %36 = OpConstantComposite %28 %29 %35 %31 + %39 = OpConstantComposite %28 %29 %35 %30 + %53 = OpConstant %6 0.100000001 + %54 = OpTypeBool + %58 = OpTypePointer Output %9 + %59 = OpVariable %58 Output + %60 = OpConstantComposite %9 %12 %11 %11 %12 + %62 = OpConstantComposite %9 %11 %11 %11 %11 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %26 = OpVariable %7 Function + %34 = OpVariable %7 Function + %38 = OpVariable %7 Function + %41 = OpVariable %7 Function + %25 = OpExtInst %6 %1 Determinant %24 + OpStore %8 %25 + %33 = OpExtInst %6 %1 Determinant %32 + OpStore %26 %33 + %37 = OpExtInst %6 %1 Determinant %36 + OpStore %34 %37 + %40 = OpExtInst %6 %1 Determinant %39 + OpStore %38 %40 + %42 = OpLoad %6 %26 + %43 = OpFNegate %6 %42 + %44 = OpLoad %6 %34 + %45 = OpFAdd %6 %43 %44 + %46 = OpLoad %6 %38 + %47 = OpFMul %6 %19 %46 + %48 = OpFSub %6 %45 %47 + OpStore %41 %48 + %49 = OpLoad %6 %41 + %50 = OpLoad %6 %8 + %51 = OpFSub %6 %49 %50 + %52 = OpExtInst %6 %1 FAbs %51 + %55 = OpFOrdLessThan %54 %52 %53 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %61 + %56 = OpLabel + OpStore %59 %60 + OpBranch %57 + %61 = OpLabel + OpStore %59 %62 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-apfloat-mix-nan.amber b/vulkan/amber/graphicsfuzz/cov-apfloat-mix-nan.amber new file mode 100644 index 0000000..e73f48d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-apfloat-mix-nan.amber @@ -0,0 +1,251 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific floating point code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_3 _GLF_uniform_int_values[2] +# #define _int_4 _GLF_uniform_int_values[3] +# #define _int_5 _GLF_uniform_int_values[4] +# #define _int_6 _GLF_uniform_int_values[5] +# #define _int_7 _GLF_uniform_int_values[6] +# #define _int_8 _GLF_uniform_int_values[7] +# #define _int_0 _GLF_uniform_int_values[8] +# #define _also_1 _GLF_uniform_int_values[9] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 2, 3, 4, 5, 6, 7, 8, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[10]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float nan = intBitsToFloat(-1); +# +# // This results in an undefined value, but not in undefined behavior. +# vec4 undefined = mix(vec4(_int_1, _int_2, _int_3, _int_4), +# vec4(_int_5, _int_6, _int_7, _int_8), nan); +# +# if (_int_1 == _also_1 || undefined.x > _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 105 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "nan" + OpName %14 "undefined" + OpName %18 "buf1" + OpMemberName %18 0 "_GLF_uniform_int_values" + OpName %20 "" + OpName %74 "buf0" + OpMemberName %74 0 "_GLF_uniform_float_values" + OpName %76 "" + OpName %85 "_GLF_color" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %73 ArrayStride 16 + OpMemberDecorate %74 0 Offset 0 + OpDecorate %74 Block + OpDecorate %76 DescriptorSet 0 + OpDecorate %76 Binding 0 + OpDecorate %85 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 1 + %10 = OpConstant %9 -1 + %12 = OpTypeVector %6 4 + %13 = OpTypePointer Function %12 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 10 + %17 = OpTypeArray %9 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpConstant %9 0 + %22 = OpTypePointer Uniform %9 + %26 = OpConstant %9 1 + %30 = OpConstant %9 2 + %34 = OpConstant %9 3 + %39 = OpConstant %9 4 + %43 = OpConstant %9 5 + %47 = OpConstant %9 6 + %51 = OpConstant %9 7 + %59 = OpTypeBool + %62 = OpConstant %9 9 + %69 = OpConstant %15 0 + %72 = OpConstant %15 1 + %73 = OpTypeArray %6 %72 + %74 = OpTypeStruct %73 + %75 = OpTypePointer Uniform %74 + %76 = OpVariable %75 Uniform + %77 = OpTypePointer Uniform %6 + %84 = OpTypePointer Output %12 + %85 = OpVariable %84 Output + %89 = OpConstant %9 8 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %14 = OpVariable %13 Function + %11 = OpBitcast %6 %10 + OpStore %8 %11 + %23 = OpAccessChain %22 %20 %21 %21 + %24 = OpLoad %9 %23 + %25 = OpConvertSToF %6 %24 + %27 = OpAccessChain %22 %20 %21 %26 + %28 = OpLoad %9 %27 + %29 = OpConvertSToF %6 %28 + %31 = OpAccessChain %22 %20 %21 %30 + %32 = OpLoad %9 %31 + %33 = OpConvertSToF %6 %32 + %35 = OpAccessChain %22 %20 %21 %34 + %36 = OpLoad %9 %35 + %37 = OpConvertSToF %6 %36 + %38 = OpCompositeConstruct %12 %25 %29 %33 %37 + %40 = OpAccessChain %22 %20 %21 %39 + %41 = OpLoad %9 %40 + %42 = OpConvertSToF %6 %41 + %44 = OpAccessChain %22 %20 %21 %43 + %45 = OpLoad %9 %44 + %46 = OpConvertSToF %6 %45 + %48 = OpAccessChain %22 %20 %21 %47 + %49 = OpLoad %9 %48 + %50 = OpConvertSToF %6 %49 + %52 = OpAccessChain %22 %20 %21 %51 + %53 = OpLoad %9 %52 + %54 = OpConvertSToF %6 %53 + %55 = OpCompositeConstruct %12 %42 %46 %50 %54 + %56 = OpLoad %6 %8 + %57 = OpCompositeConstruct %12 %56 %56 %56 %56 + %58 = OpExtInst %12 %1 FMix %38 %55 %57 + OpStore %14 %58 + %60 = OpAccessChain %22 %20 %21 %21 + %61 = OpLoad %9 %60 + %63 = OpAccessChain %22 %20 %21 %62 + %64 = OpLoad %9 %63 + %65 = OpIEqual %59 %61 %64 + %66 = OpLogicalNot %59 %65 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %68 + %67 = OpLabel + %70 = OpAccessChain %7 %14 %69 + %71 = OpLoad %6 %70 + %78 = OpAccessChain %77 %76 %21 %21 + %79 = OpLoad %6 %78 + %80 = OpFOrdGreaterThan %59 %71 %79 + OpBranch %68 + %68 = OpLabel + %81 = OpPhi %59 %65 %5 %80 %67 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %100 + %82 = OpLabel + %86 = OpAccessChain %22 %20 %21 %21 + %87 = OpLoad %9 %86 + %88 = OpConvertSToF %6 %87 + %90 = OpAccessChain %22 %20 %21 %89 + %91 = OpLoad %9 %90 + %92 = OpConvertSToF %6 %91 + %93 = OpAccessChain %22 %20 %21 %89 + %94 = OpLoad %9 %93 + %95 = OpConvertSToF %6 %94 + %96 = OpAccessChain %22 %20 %21 %21 + %97 = OpLoad %9 %96 + %98 = OpConvertSToF %6 %97 + %99 = OpCompositeConstruct %12 %88 %92 %95 %98 + OpStore %85 %99 + OpBranch %83 + %100 = OpLabel + %101 = OpAccessChain %22 %20 %21 %89 + %102 = OpLoad %9 %101 + %103 = OpConvertSToF %6 %102 + %104 = OpCompositeConstruct %12 %103 %103 %103 %103 + OpStore %85 %104 + OpBranch %83 + %83 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 2 3 4 5 6 7 8 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-apfloat-mod-zero.amber b/vulkan/amber/graphicsfuzz/cov-apfloat-mod-zero.amber new file mode 100644 index 0000000..c752ee8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-apfloat-mod-zero.amber @@ -0,0 +1,208 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific floating point code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // This results in an undefined value, but not in undefined behavior. +# float undefined = mod(5.0, 0.0); +# if (_int_1 == (_int_1 + _int_0) || undefined > _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %49 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "undefined" + OpName %17 "buf1" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %37 "buf0" + OpMemberName %37 0 "_GLF_uniform_float_values" + OpName %39 "" + OpName %49 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 RelaxedPrecision + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %23 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 0 + OpDecorate %49 Location 0 + OpDecorate %51 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + OpDecorate %65 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 5 + %10 = OpConstant %6 0 + %12 = OpTypeBool + %13 = OpTypeInt 32 1 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 3 + %16 = OpTypeArray %13 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %13 0 + %21 = OpTypePointer Uniform %13 + %26 = OpConstant %13 1 + %35 = OpConstant %14 1 + %36 = OpTypeArray %6 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %6 + %47 = OpTypeVector %6 4 + %48 = OpTypePointer Output %47 + %49 = OpVariable %48 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %11 = OpFMod %6 %9 %10 + OpStore %8 %11 + %22 = OpAccessChain %21 %19 %20 %20 + %23 = OpLoad %13 %22 + %24 = OpAccessChain %21 %19 %20 %20 + %25 = OpLoad %13 %24 + %27 = OpAccessChain %21 %19 %20 %26 + %28 = OpLoad %13 %27 + %29 = OpIAdd %13 %25 %28 + %30 = OpIEqual %12 %23 %29 + %31 = OpLogicalNot %12 %30 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %33 + %32 = OpLabel + %34 = OpLoad %6 %8 + %41 = OpAccessChain %40 %39 %20 %20 + %42 = OpLoad %6 %41 + %43 = OpFOrdGreaterThan %12 %34 %42 + OpBranch %33 + %33 = OpLabel + %44 = OpPhi %12 %30 %5 %43 %32 + OpSelectionMerge %46 None + OpBranchConditional %44 %45 %63 + %45 = OpLabel + %50 = OpAccessChain %21 %19 %20 %20 + %51 = OpLoad %13 %50 + %52 = OpConvertSToF %6 %51 + %53 = OpAccessChain %21 %19 %20 %26 + %54 = OpLoad %13 %53 + %55 = OpConvertSToF %6 %54 + %56 = OpAccessChain %21 %19 %20 %26 + %57 = OpLoad %13 %56 + %58 = OpConvertSToF %6 %57 + %59 = OpAccessChain %21 %19 %20 %20 + %60 = OpLoad %13 %59 + %61 = OpConvertSToF %6 %60 + %62 = OpCompositeConstruct %47 %52 %55 %58 %61 + OpStore %49 %62 + OpBranch %46 + %63 = OpLabel + %64 = OpAccessChain %21 %19 %20 %26 + %65 = OpLoad %13 %64 + %66 = OpConvertSToF %6 %65 + %67 = OpCompositeConstruct %47 %66 %66 %66 %66 + OpStore %49 %67 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-apfloat-module-small-number.amber b/vulkan/amber/graphicsfuzz/cov-apfloat-module-small-number.amber new file mode 100644 index 0000000..b572715 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-apfloat-module-small-number.amber @@ -0,0 +1,223 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific floating point code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_01 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.01, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f0 = mod(10.0, 0.000001); +# float s1 = 0.00000000000000000000000000000000000001; +# +# if (s1 == 0.0) +# s1 = _float_1_0; +# +# float f1 = mod(10.0, s1); +# +# // Always true. +# if ((f0 > -_float_0_01 && f0 < _float_0_01) || f0 == f1) +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# else +# _GLF_color = vec4(_int_0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %55 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f0" + OpName %12 "s1" + OpName %23 "buf0" + OpMemberName %23 0 "_GLF_uniform_float_values" + OpName %25 "" + OpName %32 "f1" + OpName %55 "_GLF_color" + OpName %57 "buf1" + OpMemberName %57 0 "_GLF_uniform_int_values" + OpName %59 "" + OpDecorate %22 ArrayStride 16 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %55 Location 0 + OpDecorate %56 ArrayStride 16 + OpMemberDecorate %57 0 Offset 0 + OpDecorate %57 Block + OpDecorate %59 DescriptorSet 0 + OpDecorate %59 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 10 + %10 = OpConstant %6 9.99999997e-07 + %13 = OpConstant %6 0x1.b38fb8p-127 + %15 = OpConstant %6 0 + %16 = OpTypeBool + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 2 + %22 = OpTypeArray %6 %21 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpTypeInt 32 1 + %27 = OpConstant %26 0 + %28 = OpConstant %26 1 + %29 = OpTypePointer Uniform %6 + %53 = OpTypeVector %6 4 + %54 = OpTypePointer Output %53 + %55 = OpVariable %54 Output + %56 = OpTypeArray %26 %21 + %57 = OpTypeStruct %56 + %58 = OpTypePointer Uniform %57 + %59 = OpVariable %58 Uniform + %60 = OpTypePointer Uniform %26 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %12 = OpVariable %7 Function + %32 = OpVariable %7 Function + %11 = OpFMod %6 %9 %10 + OpStore %8 %11 + OpStore %12 %13 + %14 = OpLoad %6 %12 + %17 = OpFOrdEqual %16 %14 %15 + OpSelectionMerge %19 None + OpBranchConditional %17 %18 %19 + %18 = OpLabel + %30 = OpAccessChain %29 %25 %27 %28 + %31 = OpLoad %6 %30 + OpStore %12 %31 + OpBranch %19 + %19 = OpLabel + %33 = OpLoad %6 %12 + %34 = OpFMod %6 %9 %33 + OpStore %32 %34 + %35 = OpLoad %6 %8 + %36 = OpAccessChain %29 %25 %27 %27 + %37 = OpLoad %6 %36 + %38 = OpFNegate %6 %37 + %39 = OpFOrdGreaterThan %16 %35 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %41 + %40 = OpLabel + %42 = OpLoad %6 %8 + %43 = OpAccessChain %29 %25 %27 %27 + %44 = OpLoad %6 %43 + %45 = OpFOrdLessThan %16 %42 %44 + OpBranch %41 + %41 = OpLabel + %46 = OpPhi %16 %39 %19 %45 %40 + %47 = OpLoad %6 %8 + %48 = OpLoad %6 %32 + %49 = OpFOrdEqual %16 %47 %48 + %50 = OpLogicalOr %16 %46 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %74 + %51 = OpLabel + %61 = OpAccessChain %60 %59 %27 %28 + %62 = OpLoad %26 %61 + %63 = OpConvertSToF %6 %62 + %64 = OpAccessChain %60 %59 %27 %27 + %65 = OpLoad %26 %64 + %66 = OpConvertSToF %6 %65 + %67 = OpAccessChain %60 %59 %27 %27 + %68 = OpLoad %26 %67 + %69 = OpConvertSToF %6 %68 + %70 = OpAccessChain %60 %59 %27 %28 + %71 = OpLoad %26 %70 + %72 = OpConvertSToF %6 %71 + %73 = OpCompositeConstruct %53 %63 %66 %69 %72 + OpStore %55 %73 + OpBranch %52 + %74 = OpLabel + %75 = OpAccessChain %60 %59 %27 %27 + %76 = OpLoad %26 %75 + %77 = OpConvertSToF %6 %76 + %78 = OpCompositeConstruct %53 %77 %77 %77 %77 + OpStore %55 %78 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.01 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-apfloat-negative-step-func.amber b/vulkan/amber/graphicsfuzz/cov-apfloat-negative-step-func.amber new file mode 100644 index 0000000..495b011 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-apfloat-negative-step-func.amber @@ -0,0 +1,197 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific floating point code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float edge = determinant(mat3(1)); +# if (step(edge, vec4(-3.0)) == vec4(_float_0_0)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 69 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %43 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "edge" + OpName %27 "buf1" + OpMemberName %27 0 "_GLF_uniform_float_values" + OpName %29 "" + OpName %43 "_GLF_color" + OpName %46 "buf0" + OpMemberName %46 0 "_GLF_uniform_int_values" + OpName %48 "" + OpDecorate %26 ArrayStride 16 + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 Block + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 1 + OpDecorate %43 Location 0 + OpDecorate %45 ArrayStride 16 + OpMemberDecorate %46 0 Offset 0 + OpDecorate %46 Block + OpDecorate %48 DescriptorSet 0 + OpDecorate %48 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeVector %6 3 + %10 = OpTypeMatrix %9 3 + %11 = OpConstant %6 1 + %12 = OpConstant %6 0 + %13 = OpConstantComposite %9 %11 %12 %12 + %14 = OpConstantComposite %9 %12 %11 %12 + %15 = OpConstantComposite %9 %12 %12 %11 + %16 = OpConstantComposite %10 %13 %14 %15 + %19 = OpTypeVector %6 4 + %20 = OpConstant %6 -3 + %21 = OpConstantComposite %19 %20 %20 %20 %20 + %24 = OpTypeInt 32 0 + %25 = OpConstant %24 1 + %26 = OpTypeArray %6 %25 + %27 = OpTypeStruct %26 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %30 = OpTypeInt 32 1 + %31 = OpConstant %30 0 + %32 = OpTypePointer Uniform %6 + %36 = OpTypeBool + %37 = OpTypeVector %36 4 + %42 = OpTypePointer Output %19 + %43 = OpVariable %42 Output + %44 = OpConstant %24 2 + %45 = OpTypeArray %30 %44 + %46 = OpTypeStruct %45 + %47 = OpTypePointer Uniform %46 + %48 = OpVariable %47 Uniform + %49 = OpTypePointer Uniform %30 + %53 = OpConstant %30 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %17 = OpExtInst %6 %1 Determinant %16 + OpStore %8 %17 + %18 = OpLoad %6 %8 + %22 = OpCompositeConstruct %19 %18 %18 %18 %18 + %23 = OpExtInst %19 %1 Step %22 %21 + %33 = OpAccessChain %32 %29 %31 %31 + %34 = OpLoad %6 %33 + %35 = OpCompositeConstruct %19 %34 %34 %34 %34 + %38 = OpFOrdEqual %37 %23 %35 + %39 = OpAll %36 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %64 + %40 = OpLabel + %50 = OpAccessChain %49 %48 %31 %31 + %51 = OpLoad %30 %50 + %52 = OpConvertSToF %6 %51 + %54 = OpAccessChain %49 %48 %31 %53 + %55 = OpLoad %30 %54 + %56 = OpConvertSToF %6 %55 + %57 = OpAccessChain %49 %48 %31 %53 + %58 = OpLoad %30 %57 + %59 = OpConvertSToF %6 %58 + %60 = OpAccessChain %49 %48 %31 %31 + %61 = OpLoad %30 %60 + %62 = OpConvertSToF %6 %61 + %63 = OpCompositeConstruct %19 %52 %56 %59 %62 + OpStore %43 %63 + OpBranch %41 + %64 = OpLabel + %65 = OpAccessChain %49 %48 %31 %53 + %66 = OpLoad %30 %65 + %67 = OpConvertSToF %6 %66 + %68 = OpCompositeConstruct %19 %67 %67 %67 %67 + OpStore %43 %68 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-apfloat-reflect-denorm.amber b/vulkan/amber/graphicsfuzz/cov-apfloat-reflect-denorm.amber new file mode 100644 index 0000000..356585d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-apfloat-reflect-denorm.amber @@ -0,0 +1,238 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific floating point code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_768 _GLF_uniform_int_values[2] +# #define _int_1792 _GLF_uniform_int_values[3] +# #define _int_45056 _GLF_uniform_int_values[4] +# #define _float_0_1 _GLF_uniform_float_values[0] +# #define _float_0_5 _GLF_uniform_float_values[1] +# #define _float_2_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 768, 1792, 45056] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.1, 0.5, 2.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // All components of I are denormalized. +# vec4 I = uintBitsToFloat(uvec4(_int_768, _int_1792, _int_45056, 0x16b39)); +# vec4 N = vec4(_float_0_5); +# +# // Whether or not denormalized values are supported or flushed to zero, +# // the result of "reflect" should match the reference result. +# vec4 R = reflect(I, vec4(0.5)); +# vec4 ref = I - _float_2_0 * dot(N, I) * N; +# +# if (distance(R, ref) < _float_0_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 91 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %72 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "I" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %35 "N" + OpName %38 "buf1" + OpMemberName %38 0 "_GLF_uniform_float_values" + OpName %40 "" + OpName %46 "R" + OpName %51 "ref" + OpName %72 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %37 ArrayStride 16 + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 1 + OpDecorate %72 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 5 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpConstant %10 2 + %19 = OpTypePointer Uniform %10 + %23 = OpConstant %10 3 + %27 = OpConstant %10 4 + %31 = OpConstant %11 92985 + %32 = OpTypeVector %11 4 + %36 = OpConstant %11 3 + %37 = OpTypeArray %6 %36 + %38 = OpTypeStruct %37 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %41 = OpConstant %10 1 + %42 = OpTypePointer Uniform %6 + %48 = OpConstant %6 0.5 + %49 = OpConstantComposite %7 %48 %48 %48 %48 + %67 = OpTypeBool + %71 = OpTypePointer Output %7 + %72 = OpVariable %71 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %35 = OpVariable %8 Function + %46 = OpVariable %8 Function + %51 = OpVariable %8 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %10 %20 + %22 = OpBitcast %11 %21 + %24 = OpAccessChain %19 %16 %17 %23 + %25 = OpLoad %10 %24 + %26 = OpBitcast %11 %25 + %28 = OpAccessChain %19 %16 %17 %27 + %29 = OpLoad %10 %28 + %30 = OpBitcast %11 %29 + %33 = OpCompositeConstruct %32 %22 %26 %30 %31 + %34 = OpBitcast %7 %33 + OpStore %9 %34 + %43 = OpAccessChain %42 %40 %17 %41 + %44 = OpLoad %6 %43 + %45 = OpCompositeConstruct %7 %44 %44 %44 %44 + OpStore %35 %45 + %47 = OpLoad %7 %9 + %50 = OpExtInst %7 %1 Reflect %47 %49 + OpStore %46 %50 + %52 = OpLoad %7 %9 + %53 = OpAccessChain %42 %40 %17 %18 + %54 = OpLoad %6 %53 + %55 = OpLoad %7 %35 + %56 = OpLoad %7 %9 + %57 = OpDot %6 %55 %56 + %58 = OpFMul %6 %54 %57 + %59 = OpLoad %7 %35 + %60 = OpVectorTimesScalar %7 %59 %58 + %61 = OpFSub %7 %52 %60 + OpStore %51 %61 + %62 = OpLoad %7 %46 + %63 = OpLoad %7 %51 + %64 = OpExtInst %6 %1 Distance %62 %63 + %65 = OpAccessChain %42 %40 %17 %17 + %66 = OpLoad %6 %65 + %68 = OpFOrdLessThan %67 %64 %66 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %86 + %69 = OpLabel + %73 = OpAccessChain %19 %16 %17 %17 + %74 = OpLoad %10 %73 + %75 = OpConvertSToF %6 %74 + %76 = OpAccessChain %19 %16 %17 %41 + %77 = OpLoad %10 %76 + %78 = OpConvertSToF %6 %77 + %79 = OpAccessChain %19 %16 %17 %41 + %80 = OpLoad %10 %79 + %81 = OpConvertSToF %6 %80 + %82 = OpAccessChain %19 %16 %17 %17 + %83 = OpLoad %10 %82 + %84 = OpConvertSToF %6 %83 + %85 = OpCompositeConstruct %7 %75 %78 %81 %84 + OpStore %72 %85 + OpBranch %70 + %86 = OpLabel + %87 = OpAccessChain %19 %16 %17 %41 + %88 = OpLoad %10 %87 + %89 = OpConvertSToF %6 %88 + %90 = OpCompositeConstruct %7 %89 %89 %89 %89 + OpStore %72 %90 + OpBranch %70 + %70 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.1 0.5 2.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 768 1792 45056 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-apfloat-sinh-negative-log2.amber b/vulkan/amber/graphicsfuzz/cov-apfloat-sinh-negative-log2.amber new file mode 100644 index 0000000..ca1122e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-apfloat-sinh-negative-log2.amber @@ -0,0 +1,206 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific floating point code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // This results in an undefined value, but not in undefined behavior. +# float undefined = sinh(log2(-8.9)); +# +# if (1 == _int_1 || undefined > _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +DEVICE_EXTENSION VK_KHR_shader_float_controls +DEVICE_PROPERTY FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32 +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpCapability SignedZeroInfNanPreserve + OpExtension "SPV_KHR_float_controls" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %43 + OpExecutionMode %4 OriginUpperLeft + OpExecutionMode %4 SignedZeroInfNanPreserve 32 + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "undefined" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %31 "buf1" + OpMemberName %31 0 "_GLF_uniform_float_values" + OpName %33 "" + OpName %43 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 RelaxedPrecision + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %23 RelaxedPrecision + OpDecorate %30 ArrayStride 16 + OpMemberDecorate %31 0 Offset 0 + OpDecorate %31 Block + OpDecorate %33 DescriptorSet 0 + OpDecorate %33 Binding 1 + OpDecorate %43 Location 0 + OpDecorate %45 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %59 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0x1.8p+128 + %11 = OpTypeBool + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 1 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 2 + %16 = OpTypeArray %12 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %12 0 + %21 = OpTypePointer Uniform %12 + %29 = OpConstant %14 1 + %30 = OpTypeArray %6 %29 + %31 = OpTypeStruct %30 + %32 = OpTypePointer Uniform %31 + %33 = OpVariable %32 Uniform + %34 = OpTypePointer Uniform %6 + %41 = OpTypeVector %6 4 + %42 = OpTypePointer Output %41 + %43 = OpVariable %42 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpExtInst %6 %1 Sinh %9 + OpStore %8 %10 + %22 = OpAccessChain %21 %19 %20 %20 + %23 = OpLoad %12 %22 + %24 = OpIEqual %11 %13 %23 + %25 = OpLogicalNot %11 %24 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %27 + %26 = OpLabel + %28 = OpLoad %6 %8 + %35 = OpAccessChain %34 %33 %20 %20 + %36 = OpLoad %6 %35 + %37 = OpFOrdGreaterThan %11 %28 %36 + OpBranch %27 + %27 = OpLabel + %38 = OpPhi %11 %24 %5 %37 %26 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %57 + %39 = OpLabel + %44 = OpAccessChain %21 %19 %20 %20 + %45 = OpLoad %12 %44 + %46 = OpConvertSToF %6 %45 + %47 = OpAccessChain %21 %19 %20 %13 + %48 = OpLoad %12 %47 + %49 = OpConvertSToF %6 %48 + %50 = OpAccessChain %21 %19 %20 %13 + %51 = OpLoad %12 %50 + %52 = OpConvertSToF %6 %51 + %53 = OpAccessChain %21 %19 %20 %20 + %54 = OpLoad %12 %53 + %55 = OpConvertSToF %6 %54 + %56 = OpCompositeConstruct %41 %46 %49 %52 %55 + OpStore %43 %56 + OpBranch %40 + %57 = OpLabel + %58 = OpAccessChain %21 %19 %20 %13 + %59 = OpLoad %12 %58 + %60 = OpConvertSToF %6 %59 + %61 = OpCompositeConstruct %41 %60 %60 %60 %60 + OpStore %43 %61 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-apfloat-tanh.amber b/vulkan/amber/graphicsfuzz/cov-apfloat-tanh.amber new file mode 100644 index 0000000..1930138 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-apfloat-tanh.amber @@ -0,0 +1,136 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific arbitrary precision float usage. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v = vec4(1, 2, 3, 4); +# float dist1 = distance(tanh(v), sinh(v) / cosh(v)); +# float dist2 = distance(tanh(v), vec4(0.76159, 0.96403, 0.99505, 0.99933)); +# +# // tanh(v) == sinh(v) / cosh(v). Allow some room for precision errors. +# if (dist1 < 0.1 && dist2 < 0.1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %44 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v" + OpName %16 "dist1" + OpName %25 "dist2" + OpName %44 "_GLF_color" + OpDecorate %44 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstant %6 2 + %12 = OpConstant %6 3 + %13 = OpConstant %6 4 + %14 = OpConstantComposite %7 %10 %11 %12 %13 + %15 = OpTypePointer Function %6 + %28 = OpConstant %6 0.761590004 + %29 = OpConstant %6 0.964030027 + %30 = OpConstant %6 0.995050013 + %31 = OpConstant %6 0.999329984 + %32 = OpConstantComposite %7 %28 %29 %30 %31 + %35 = OpConstant %6 0.100000001 + %36 = OpTypeBool + %43 = OpTypePointer Output %7 + %44 = OpVariable %43 Output + %45 = OpConstant %6 0 + %46 = OpConstantComposite %7 %10 %45 %45 %10 + %48 = OpConstantComposite %7 %45 %45 %45 %45 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %16 = OpVariable %15 Function + %25 = OpVariable %15 Function + OpStore %9 %14 + %17 = OpLoad %7 %9 + %18 = OpExtInst %7 %1 Tanh %17 + %19 = OpLoad %7 %9 + %20 = OpExtInst %7 %1 Sinh %19 + %21 = OpLoad %7 %9 + %22 = OpExtInst %7 %1 Cosh %21 + %23 = OpFDiv %7 %20 %22 + %24 = OpExtInst %6 %1 Distance %18 %23 + OpStore %16 %24 + %26 = OpLoad %7 %9 + %27 = OpExtInst %7 %1 Tanh %26 + %33 = OpExtInst %6 %1 Distance %27 %32 + OpStore %25 %33 + %34 = OpLoad %6 %16 + %37 = OpFOrdLessThan %36 %34 %35 + %38 = OpLoad %6 %25 + %39 = OpFOrdLessThan %36 %38 %35 + %40 = OpLogicalAnd %36 %37 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %47 + %41 = OpLabel + OpStore %44 %46 + OpBranch %42 + %47 = OpLabel + OpStore %44 %48 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-apfloat-undefined-matrix-mul.amber b/vulkan/amber/graphicsfuzz/cov-apfloat-undefined-matrix-mul.amber new file mode 100644 index 0000000..90f99bf --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-apfloat-undefined-matrix-mul.amber @@ -0,0 +1,355 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific floating point code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_50 _GLF_uniform_int_values[0] +# #define _int_10 _GLF_uniform_int_values[1] +# #define _int_11 _GLF_uniform_int_values[2] +# #define _int_12 _GLF_uniform_int_values[3] +# #define _int_1 _GLF_uniform_int_values[4] +# #define _int_2 _GLF_uniform_int_values[5] +# #define _int_3 _GLF_uniform_int_values[6] +# #define _int_6 _GLF_uniform_int_values[7] +# #define _int_7 _GLF_uniform_int_values[8] +# #define _int_0 _GLF_uniform_int_values[9] +# #define _int_5 _GLF_uniform_int_values[10] +# #define _int_9 _GLF_uniform_int_values[11] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [50, 10, 11, 12, 1, 2, 3, 6, 7, 0, 5, 9] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[12]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat3x4 m0 = mat3x4(_int_1, _int_2, _int_3, 4, _int_5, _int_6, _int_7, 8, +# _int_9, _int_10, _int_11, _int_12); +# mat3x4 m1 = mat3x4(_int_1); +# +# // Results are too large to fit into a floating point type, thus the results are undefined. +# vec3 undefined = ldexp(vec3(1), ivec3(500)); +# // These still fit into floating point type. +# vec3 defined = ldexp(vec3(_int_1), ivec3(_int_50)); +# +# // Vectors v0 and v1 are undefined. +# vec4 v0 = m0 * undefined; +# vec4 v1 = m1 * undefined; +# +# // Vectors v2 and v3 are defined. +# vec4 v2 = m0 * defined; +# vec4 v3 = m1 * defined; +# +# // Always true. +# if (v2.x > v3.x) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# +# // The result doesn't matter as the green channel is already zero. +# if (v0.x < v1.x) +# { +# _GLF_color.g = _float_0_0; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 158 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %121 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "m0" + OpName %15 "buf1" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %68 "m1" + OpName %78 "undefined" + OpName %84 "defined" + OpName %94 "v0" + OpName %98 "v1" + OpName %102 "v2" + OpName %106 "v3" + OpName %121 "_GLF_color" + OpName %150 "buf0" + OpMemberName %150 0 "_GLF_uniform_float_values" + OpName %152 "" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 RelaxedPrecision + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 1 + OpDecorate %22 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + OpDecorate %70 RelaxedPrecision + OpDecorate %86 RelaxedPrecision + OpDecorate %90 RelaxedPrecision + OpDecorate %121 Location 0 + OpDecorate %123 RelaxedPrecision + OpDecorate %127 RelaxedPrecision + OpDecorate %130 RelaxedPrecision + OpDecorate %133 RelaxedPrecision + OpDecorate %138 RelaxedPrecision + OpDecorate %149 ArrayStride 16 + OpMemberDecorate %150 0 Offset 0 + OpDecorate %150 Block + OpDecorate %152 DescriptorSet 0 + OpDecorate %152 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeMatrix %7 3 + %9 = OpTypePointer Function %8 + %11 = OpTypeInt 32 1 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 12 + %14 = OpTypeArray %11 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %11 0 + %19 = OpConstant %11 4 + %20 = OpTypePointer Uniform %11 + %24 = OpConstant %11 5 + %28 = OpConstant %11 6 + %32 = OpConstant %6 4 + %33 = OpConstant %11 10 + %37 = OpConstant %11 7 + %41 = OpConstant %11 8 + %45 = OpConstant %6 8 + %46 = OpConstant %11 11 + %50 = OpConstant %11 1 + %54 = OpConstant %11 2 + %58 = OpConstant %11 3 + %62 = OpConstant %6 1 + %63 = OpConstant %6 0 + %76 = OpTypeVector %6 3 + %77 = OpTypePointer Function %76 + %79 = OpConstantComposite %76 %62 %62 %62 + %80 = OpTypeVector %11 3 + %81 = OpConstant %11 500 + %82 = OpConstantComposite %80 %81 %81 %81 + %93 = OpTypePointer Function %7 + %110 = OpConstant %12 0 + %111 = OpTypePointer Function %6 + %116 = OpTypeBool + %120 = OpTypePointer Output %7 + %121 = OpVariable %120 Output + %125 = OpConstant %11 9 + %148 = OpConstant %12 1 + %149 = OpTypeArray %6 %148 + %150 = OpTypeStruct %149 + %151 = OpTypePointer Uniform %150 + %152 = OpVariable %151 Uniform + %153 = OpTypePointer Uniform %6 + %156 = OpTypePointer Output %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %68 = OpVariable %9 Function + %78 = OpVariable %77 Function + %84 = OpVariable %77 Function + %94 = OpVariable %93 Function + %98 = OpVariable %93 Function + %102 = OpVariable %93 Function + %106 = OpVariable %93 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %11 %21 + %23 = OpConvertSToF %6 %22 + %25 = OpAccessChain %20 %17 %18 %24 + %26 = OpLoad %11 %25 + %27 = OpConvertSToF %6 %26 + %29 = OpAccessChain %20 %17 %18 %28 + %30 = OpLoad %11 %29 + %31 = OpConvertSToF %6 %30 + %34 = OpAccessChain %20 %17 %18 %33 + %35 = OpLoad %11 %34 + %36 = OpConvertSToF %6 %35 + %38 = OpAccessChain %20 %17 %18 %37 + %39 = OpLoad %11 %38 + %40 = OpConvertSToF %6 %39 + %42 = OpAccessChain %20 %17 %18 %41 + %43 = OpLoad %11 %42 + %44 = OpConvertSToF %6 %43 + %47 = OpAccessChain %20 %17 %18 %46 + %48 = OpLoad %11 %47 + %49 = OpConvertSToF %6 %48 + %51 = OpAccessChain %20 %17 %18 %50 + %52 = OpLoad %11 %51 + %53 = OpConvertSToF %6 %52 + %55 = OpAccessChain %20 %17 %18 %54 + %56 = OpLoad %11 %55 + %57 = OpConvertSToF %6 %56 + %59 = OpAccessChain %20 %17 %18 %58 + %60 = OpLoad %11 %59 + %61 = OpConvertSToF %6 %60 + %64 = OpCompositeConstruct %7 %23 %27 %31 %32 + %65 = OpCompositeConstruct %7 %36 %40 %44 %45 + %66 = OpCompositeConstruct %7 %49 %53 %57 %61 + %67 = OpCompositeConstruct %8 %64 %65 %66 + OpStore %10 %67 + %69 = OpAccessChain %20 %17 %18 %19 + %70 = OpLoad %11 %69 + %71 = OpConvertSToF %6 %70 + %72 = OpCompositeConstruct %7 %71 %63 %63 %63 + %73 = OpCompositeConstruct %7 %63 %71 %63 %63 + %74 = OpCompositeConstruct %7 %63 %63 %71 %63 + %75 = OpCompositeConstruct %8 %72 %73 %74 + OpStore %68 %75 + %83 = OpExtInst %76 %1 Ldexp %79 %82 + OpStore %78 %83 + %85 = OpAccessChain %20 %17 %18 %19 + %86 = OpLoad %11 %85 + %87 = OpConvertSToF %6 %86 + %88 = OpCompositeConstruct %76 %87 %87 %87 + %89 = OpAccessChain %20 %17 %18 %18 + %90 = OpLoad %11 %89 + %91 = OpCompositeConstruct %80 %90 %90 %90 + %92 = OpExtInst %76 %1 Ldexp %88 %91 + OpStore %84 %92 + %95 = OpLoad %8 %10 + %96 = OpLoad %76 %78 + %97 = OpMatrixTimesVector %7 %95 %96 + OpStore %94 %97 + %99 = OpLoad %8 %68 + %100 = OpLoad %76 %78 + %101 = OpMatrixTimesVector %7 %99 %100 + OpStore %98 %101 + %103 = OpLoad %8 %10 + %104 = OpLoad %76 %84 + %105 = OpMatrixTimesVector %7 %103 %104 + OpStore %102 %105 + %107 = OpLoad %8 %68 + %108 = OpLoad %76 %84 + %109 = OpMatrixTimesVector %7 %107 %108 + OpStore %106 %109 + %112 = OpAccessChain %111 %102 %110 + %113 = OpLoad %6 %112 + %114 = OpAccessChain %111 %106 %110 + %115 = OpLoad %6 %114 + %117 = OpFOrdGreaterThan %116 %113 %115 + OpSelectionMerge %119 None + OpBranchConditional %117 %118 %136 + %118 = OpLabel + %122 = OpAccessChain %20 %17 %18 %19 + %123 = OpLoad %11 %122 + %124 = OpConvertSToF %6 %123 + %126 = OpAccessChain %20 %17 %18 %125 + %127 = OpLoad %11 %126 + %128 = OpConvertSToF %6 %127 + %129 = OpAccessChain %20 %17 %18 %125 + %130 = OpLoad %11 %129 + %131 = OpConvertSToF %6 %130 + %132 = OpAccessChain %20 %17 %18 %19 + %133 = OpLoad %11 %132 + %134 = OpConvertSToF %6 %133 + %135 = OpCompositeConstruct %7 %124 %128 %131 %134 + OpStore %121 %135 + OpBranch %119 + %136 = OpLabel + %137 = OpAccessChain %20 %17 %18 %125 + %138 = OpLoad %11 %137 + %139 = OpConvertSToF %6 %138 + %140 = OpCompositeConstruct %7 %139 %139 %139 %139 + OpStore %121 %140 + OpBranch %119 + %119 = OpLabel + %141 = OpAccessChain %111 %94 %110 + %142 = OpLoad %6 %141 + %143 = OpAccessChain %111 %98 %110 + %144 = OpLoad %6 %143 + %145 = OpFOrdLessThan %116 %142 %144 + OpSelectionMerge %147 None + OpBranchConditional %145 %146 %147 + %146 = OpLabel + %154 = OpAccessChain %153 %152 %18 %18 + %155 = OpLoad %6 %154 + %157 = OpAccessChain %156 %121 %148 + OpStore %157 %155 + OpBranch %147 + %147 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 50 10 11 12 1 2 3 6 7 0 5 9 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-apfloat-unpackunorm-loop.amber b/vulkan/amber/graphicsfuzz/cov-apfloat-unpackunorm-loop.amber new file mode 100644 index 0000000..b15112a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-apfloat-unpackunorm-loop.amber @@ -0,0 +1,188 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific floating point code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_5 _GLF_uniform_int_values[2] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# for (int i = _int_0; i < _int_5; i++) +# { +# vec4 v = unpackUnorm4x8(100u); +# +# // Always false. +# if (int(v.x) > i) +# { +# _GLF_color = vec4(_int_0); +# return; +# } +# } +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %34 "v" + OpName %47 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %47 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %26 = OpConstant %6 2 + %29 = OpTypeBool + %31 = OpTypeFloat 32 + %32 = OpTypeVector %31 4 + %33 = OpTypePointer Function %32 + %35 = OpConstant %9 100 + %37 = OpConstant %9 0 + %38 = OpTypePointer Function %31 + %46 = OpTypePointer Output %32 + %47 = OpVariable %46 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %34 = OpVariable %33 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %6 %8 + %27 = OpAccessChain %17 %14 %15 %26 + %28 = OpLoad %6 %27 + %30 = OpSLessThan %29 %25 %28 + OpBranchConditional %30 %21 %22 + %21 = OpLabel + %36 = OpExtInst %32 %1 UnpackUnorm4x8 %35 + OpStore %34 %36 + %39 = OpAccessChain %38 %34 %37 + %40 = OpLoad %31 %39 + %41 = OpConvertFToS %6 %40 + %42 = OpLoad %6 %8 + %43 = OpSGreaterThan %29 %41 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %45 + %44 = OpLabel + %48 = OpAccessChain %17 %14 %15 %16 + %49 = OpLoad %6 %48 + %50 = OpConvertSToF %31 %49 + %51 = OpCompositeConstruct %32 %50 %50 %50 %50 + OpStore %47 %51 + OpReturn + %45 = OpLabel + OpBranch %23 + %23 = OpLabel + %53 = OpLoad %6 %8 + %54 = OpIAdd %6 %53 %16 + OpStore %8 %54 + OpBranch %20 + %22 = OpLabel + %55 = OpAccessChain %17 %14 %15 %15 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %31 %56 + %58 = OpAccessChain %17 %14 %15 %16 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %31 %59 + %61 = OpAccessChain %17 %14 %15 %16 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %31 %62 + %64 = OpAccessChain %17 %14 %15 %15 + %65 = OpLoad %6 %64 + %66 = OpConvertSToF %31 %65 + %67 = OpCompositeConstruct %32 %57 %60 %63 %66 + OpStore %47 %67 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 5 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-array-accesses-clamp.amber b/vulkan/amber/graphicsfuzz/cov-array-accesses-clamp.amber new file mode 100644 index 0000000..085def4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-array-accesses-clamp.amber @@ -0,0 +1,239 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine select path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[3] = int[3](_int_1, _int_1, _int_1); +# +# int a = arr[_int_0]; +# +# int b = a - 1; +# +# // Always false. +# if (gl_FragCoord.x < _float_0_0) +# { +# b++; +# } +# +# int c = _int_0; +# +# // arr[1] becomes 0. +# arr[clamp(c, _int_1, _int_2)] = b; +# +# _GLF_color = vec4(arr[_int_0], arr[_int_1], arr[_int_1], arr[_int_2]); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 92 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %38 %70 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "arr" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %27 "a" + OpName %32 "b" + OpName %38 "gl_FragCoord" + OpName %45 "buf1" + OpMemberName %45 0 "_GLF_uniform_float_values" + OpName %47 "" + OpName %57 "c" + OpName %70 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %38 BuiltIn FragCoord + OpDecorate %44 ArrayStride 16 + OpMemberDecorate %45 0 Offset 0 + OpDecorate %45 Block + OpDecorate %47 DescriptorSet 0 + OpDecorate %47 Binding 1 + OpDecorate %70 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 3 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpTypeArray %6 %8 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %6 0 + %17 = OpConstant %6 1 + %18 = OpTypePointer Uniform %6 + %26 = OpTypePointer Function %6 + %35 = OpTypeFloat 32 + %36 = OpTypeVector %35 4 + %37 = OpTypePointer Input %36 + %38 = OpVariable %37 Input + %39 = OpConstant %7 0 + %40 = OpTypePointer Input %35 + %43 = OpConstant %7 1 + %44 = OpTypeArray %35 %43 + %45 = OpTypeStruct %44 + %46 = OpTypePointer Uniform %45 + %47 = OpVariable %46 Uniform + %48 = OpTypePointer Uniform %35 + %51 = OpTypeBool + %63 = OpConstant %6 2 + %69 = OpTypePointer Output %36 + %70 = OpVariable %69 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %27 = OpVariable %26 Function + %32 = OpVariable %26 Function + %57 = OpVariable %26 Function + %19 = OpAccessChain %18 %15 %16 %17 + %20 = OpLoad %6 %19 + %21 = OpAccessChain %18 %15 %16 %17 + %22 = OpLoad %6 %21 + %23 = OpAccessChain %18 %15 %16 %17 + %24 = OpLoad %6 %23 + %25 = OpCompositeConstruct %9 %20 %22 %24 + OpStore %11 %25 + %28 = OpAccessChain %18 %15 %16 %16 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %26 %11 %29 + %31 = OpLoad %6 %30 + OpStore %27 %31 + %33 = OpLoad %6 %27 + %34 = OpISub %6 %33 %17 + OpStore %32 %34 + %41 = OpAccessChain %40 %38 %39 + %42 = OpLoad %35 %41 + %49 = OpAccessChain %48 %47 %16 %16 + %50 = OpLoad %35 %49 + %52 = OpFOrdLessThan %51 %42 %50 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + %55 = OpLoad %6 %32 + %56 = OpIAdd %6 %55 %17 + OpStore %32 %56 + OpBranch %54 + %54 = OpLabel + %58 = OpAccessChain %18 %15 %16 %16 + %59 = OpLoad %6 %58 + OpStore %57 %59 + %60 = OpLoad %6 %57 + %61 = OpAccessChain %18 %15 %16 %17 + %62 = OpLoad %6 %61 + %64 = OpAccessChain %18 %15 %16 %63 + %65 = OpLoad %6 %64 + %66 = OpExtInst %6 %1 SClamp %60 %62 %65 + %67 = OpLoad %6 %32 + %68 = OpAccessChain %26 %11 %66 + OpStore %68 %67 + %71 = OpAccessChain %18 %15 %16 %16 + %72 = OpLoad %6 %71 + %73 = OpAccessChain %26 %11 %72 + %74 = OpLoad %6 %73 + %75 = OpConvertSToF %35 %74 + %76 = OpAccessChain %18 %15 %16 %17 + %77 = OpLoad %6 %76 + %78 = OpAccessChain %26 %11 %77 + %79 = OpLoad %6 %78 + %80 = OpConvertSToF %35 %79 + %81 = OpAccessChain %18 %15 %16 %17 + %82 = OpLoad %6 %81 + %83 = OpAccessChain %26 %11 %82 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %35 %84 + %86 = OpAccessChain %18 %15 %16 %63 + %87 = OpLoad %6 %86 + %88 = OpAccessChain %26 %11 %87 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %35 %89 + %91 = OpCompositeConstruct %36 %75 %80 %85 %90 + OpStore %70 %91 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-array-cast-bool-float-div-by-zero-no-effect.amber b/vulkan/amber/graphicsfuzz/cov-array-cast-bool-float-div-by-zero-no-effect.amber new file mode 100644 index 0000000..14b0e7e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-array-cast-bool-float-div-by-zero-no-effect.amber @@ -0,0 +1,261 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // 1.0 / float(false) = 1.0 / 0.0. This value has no effect on the output color. +# float arr[5] = float[5](_float_1_0, _float_0_0, _float_0_0, (1.0 / float(false)), _float_0_0); +# +# for(int i = 0; i < 5; i++) +# { +# if(arr[_int_0] > arr[i]) +# { +# arr[i] = _float_1_0; +# } +# } +# +# // Always true. +# if(arr[_int_0] == _float_1_0 && arr[_int_1] == _float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 104 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %32 "i" + OpName %43 "buf1" + OpMemberName %43 0 "_GLF_uniform_int_values" + OpName %45 "" + OpName %85 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %42 ArrayStride 16 + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 1 + OpDecorate %85 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 5 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 2 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %17 1 + %27 = OpConstant %6 0x1p+128 + %31 = OpTypePointer Function %17 + %39 = OpConstant %17 5 + %40 = OpTypeBool + %42 = OpTypeArray %17 %12 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %46 = OpTypePointer Uniform %17 + %49 = OpTypePointer Function %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Output %83 + %85 = OpVariable %84 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %32 = OpVariable %31 Function + %20 = OpAccessChain %19 %16 %18 %18 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %19 %16 %18 %22 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %19 %16 %18 %22 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %19 %16 %18 %22 + %29 = OpLoad %6 %28 + %30 = OpCompositeConstruct %9 %21 %24 %26 %27 %29 + OpStore %11 %30 + OpStore %32 %18 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %17 %32 + %41 = OpSLessThan %40 %38 %39 + OpBranchConditional %41 %34 %35 + %34 = OpLabel + %47 = OpAccessChain %46 %45 %18 %18 + %48 = OpLoad %17 %47 + %50 = OpAccessChain %49 %11 %48 + %51 = OpLoad %6 %50 + %52 = OpLoad %17 %32 + %53 = OpAccessChain %49 %11 %52 + %54 = OpLoad %6 %53 + %55 = OpFOrdGreaterThan %40 %51 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %57 + %56 = OpLabel + %58 = OpLoad %17 %32 + %59 = OpAccessChain %19 %16 %18 %18 + %60 = OpLoad %6 %59 + %61 = OpAccessChain %49 %11 %58 + OpStore %61 %60 + OpBranch %57 + %57 = OpLabel + OpBranch %36 + %36 = OpLabel + %62 = OpLoad %17 %32 + %63 = OpIAdd %17 %62 %22 + OpStore %32 %63 + OpBranch %33 + %35 = OpLabel + %64 = OpAccessChain %46 %45 %18 %18 + %65 = OpLoad %17 %64 + %66 = OpAccessChain %49 %11 %65 + %67 = OpLoad %6 %66 + %68 = OpAccessChain %19 %16 %18 %18 + %69 = OpLoad %6 %68 + %70 = OpFOrdEqual %40 %67 %69 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %72 + %71 = OpLabel + %73 = OpAccessChain %46 %45 %18 %22 + %74 = OpLoad %17 %73 + %75 = OpAccessChain %49 %11 %74 + %76 = OpLoad %6 %75 + %77 = OpAccessChain %19 %16 %18 %18 + %78 = OpLoad %6 %77 + %79 = OpFOrdEqual %40 %76 %78 + OpBranch %72 + %72 = OpLabel + %80 = OpPhi %40 %70 %35 %79 %71 + OpSelectionMerge %82 None + OpBranchConditional %80 %81 %99 + %81 = OpLabel + %86 = OpAccessChain %46 %45 %18 %22 + %87 = OpLoad %17 %86 + %88 = OpConvertSToF %6 %87 + %89 = OpAccessChain %46 %45 %18 %18 + %90 = OpLoad %17 %89 + %91 = OpConvertSToF %6 %90 + %92 = OpAccessChain %46 %45 %18 %18 + %93 = OpLoad %17 %92 + %94 = OpConvertSToF %6 %93 + %95 = OpAccessChain %46 %45 %18 %22 + %96 = OpLoad %17 %95 + %97 = OpConvertSToF %6 %96 + %98 = OpCompositeConstruct %83 %88 %91 %94 %97 + OpStore %85 %98 + OpBranch %82 + %99 = OpLabel + %100 = OpAccessChain %46 %45 %18 %18 + %101 = OpLoad %17 %100 + %102 = OpConvertSToF %6 %101 + %103 = OpCompositeConstruct %83 %102 %102 %102 %102 + OpStore %85 %103 + OpBranch %82 + %82 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-array-copies-loops-with-limiters.amber b/vulkan/amber/graphicsfuzz/cov-array-copies-loops-with-limiters.amber new file mode 100644 index 0000000..99c1145 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-array-copies-loops-with-limiters.amber @@ -0,0 +1,569 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_8 _GLF_uniform_int_values[0] +# #define _int_10 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# #define _int_2 _GLF_uniform_int_values[4] +# #define _int_3 _GLF_uniform_int_values[5] +# #define _int_4 _GLF_uniform_int_values[6] +# #define _int_5 _GLF_uniform_int_values[7] +# #define _int_6 _GLF_uniform_int_values[8] +# #define _int_7 _GLF_uniform_int_values[9] +# #define _int_9 _GLF_uniform_int_values[10] +# #define _int_17 _GLF_uniform_int_values[11] +# #define _int_11 _GLF_uniform_int_values[12] +# #define _int_15 _GLF_uniform_int_values[13] +# #define _int_16 _GLF_uniform_int_values[14] +# #define _int_12 _GLF_uniform_int_values[15] +# #define _int_13 _GLF_uniform_int_values[16] +# #define _int_14 _GLF_uniform_int_values[17] +# #define _int_18 _GLF_uniform_int_values[18] +# #define _int_19 _GLF_uniform_int_values[19] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [8, 10, 1, 0, 2, 3, 4, 5, 6, 7, 9, 17, 11, 15, 16, 12, 13, 14, 18, 19] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[20]; +# }; +# +# // Contents of one: 1 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr0[10] = int[10](_int_0, _int_1, _int_2, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9); +# int arr1[10] = int[10](_int_10, _int_11, _int_12, _int_13, _int_14, _int_15, _int_16, _int_17, _int_18, _int_19); +# +# for(int a = _int_6; a < _int_8; a++) +# { +# int limiter0 = _int_0; +# while(limiter0 < _int_2) +# { +# limiter0++; +# +# int limiter1 = _int_1; +# // Iterated for b = 0..3. +# for(int b = _int_0; b < _int_10; b ++) +# { +# if(limiter1 > _int_3) +# { +# break; +# } +# limiter1++; +# arr0[b] = arr1[a]; +# } +# } +# +# int limiter2 = 0; +# // Does the same assignment five times. +# while(limiter2 < 5) +# { +# limiter2++; +# arr0[1] = arr1[1]; +# } +# +# // Iterated once. +# do +# { +# int limiter3 = 0; +# // Iterated for d = 0..4. +# for(int d = 0; d < 10; d ++) +# { +# if(limiter3 > 4) +# { +# break; +# } +# limiter3 ++; +# arr1[d] = arr0[d]; +# } +# } +# while(_int_1 == _int_0); +# } +# +# // Reference values. +# int ref0[10] = int[10](_int_17, _int_11, _int_17, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9); +# int ref1[10] = int[10](_int_17, _int_11, _int_17, _int_3, _int_4, _int_15, _int_16, _int_17, _int_18, _int_19); +# +# // Return red if no error is detected. +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# for(int i = _int_0; i < _int_10; i ++) +# { +# // Unexpected value. Change the color to black. +# if(arr0[i] != ref0[i] || arr1[i] != ref1[i]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 289 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %234 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr0" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %49 "arr1" + OpName %82 "a" + OpName %95 "limiter0" + OpName %109 "limiter1" + OpName %112 "b" + OpName %140 "limiter2" + OpName %157 "limiter3" + OpName %158 "d" + OpName %187 "ref0" + OpName %209 "ref1" + OpName %234 "_GLF_color" + OpName %248 "i" + OpName %286 "buf1" + OpMemberName %286 0 "one" + OpName %288 "" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %234 Location 0 + OpMemberDecorate %286 0 Offset 0 + OpDecorate %286 Block + OpDecorate %288 DescriptorSet 0 + OpDecorate %288 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 20 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 3 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 2 + %25 = OpConstant %6 4 + %28 = OpConstant %6 5 + %31 = OpConstant %6 6 + %34 = OpConstant %6 7 + %37 = OpConstant %6 8 + %40 = OpConstant %6 9 + %45 = OpConstant %6 10 + %50 = OpConstant %6 1 + %53 = OpConstant %6 12 + %56 = OpConstant %6 15 + %59 = OpConstant %6 16 + %62 = OpConstant %6 17 + %65 = OpConstant %6 13 + %68 = OpConstant %6 14 + %71 = OpConstant %6 11 + %74 = OpConstant %6 18 + %77 = OpConstant %6 19 + %81 = OpTypePointer Function %6 + %93 = OpTypeBool + %231 = OpTypeFloat 32 + %232 = OpTypeVector %231 4 + %233 = OpTypePointer Output %232 + %234 = OpVariable %233 Output + %286 = OpTypeStruct %6 + %287 = OpTypePointer Uniform %286 + %288 = OpVariable %287 Uniform + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %49 = OpVariable %10 Function + %82 = OpVariable %81 Function + %95 = OpVariable %81 Function + %109 = OpVariable %81 Function + %112 = OpVariable %81 Function + %140 = OpVariable %81 Function + %157 = OpVariable %81 Function + %158 = OpVariable %81 Function + %187 = OpVariable %10 Function + %209 = OpVariable %10 Function + %248 = OpVariable %81 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %19 %16 %17 %22 + %24 = OpLoad %6 %23 + %26 = OpAccessChain %19 %16 %17 %25 + %27 = OpLoad %6 %26 + %29 = OpAccessChain %19 %16 %17 %28 + %30 = OpLoad %6 %29 + %32 = OpAccessChain %19 %16 %17 %31 + %33 = OpLoad %6 %32 + %35 = OpAccessChain %19 %16 %17 %34 + %36 = OpLoad %6 %35 + %38 = OpAccessChain %19 %16 %17 %37 + %39 = OpLoad %6 %38 + %41 = OpAccessChain %19 %16 %17 %40 + %42 = OpLoad %6 %41 + %43 = OpAccessChain %19 %16 %17 %17 + %44 = OpLoad %6 %43 + %46 = OpAccessChain %19 %16 %17 %45 + %47 = OpLoad %6 %46 + %48 = OpCompositeConstruct %9 %21 %24 %27 %30 %33 %36 %39 %42 %44 %47 + OpStore %11 %48 + %51 = OpAccessChain %19 %16 %17 %50 + %52 = OpLoad %6 %51 + %54 = OpAccessChain %19 %16 %17 %53 + %55 = OpLoad %6 %54 + %57 = OpAccessChain %19 %16 %17 %56 + %58 = OpLoad %6 %57 + %60 = OpAccessChain %19 %16 %17 %59 + %61 = OpLoad %6 %60 + %63 = OpAccessChain %19 %16 %17 %62 + %64 = OpLoad %6 %63 + %66 = OpAccessChain %19 %16 %17 %65 + %67 = OpLoad %6 %66 + %69 = OpAccessChain %19 %16 %17 %68 + %70 = OpLoad %6 %69 + %72 = OpAccessChain %19 %16 %17 %71 + %73 = OpLoad %6 %72 + %75 = OpAccessChain %19 %16 %17 %74 + %76 = OpLoad %6 %75 + %78 = OpAccessChain %19 %16 %17 %77 + %79 = OpLoad %6 %78 + %80 = OpCompositeConstruct %9 %52 %55 %58 %61 %64 %67 %70 %73 %76 %79 + OpStore %49 %80 + %83 = OpAccessChain %19 %16 %17 %37 + %84 = OpLoad %6 %83 + OpStore %82 %84 + OpBranch %85 + %85 = OpLabel + OpLoopMerge %87 %88 None + OpBranch %89 + %89 = OpLabel + %90 = OpLoad %6 %82 + %91 = OpAccessChain %19 %16 %17 %17 + %92 = OpLoad %6 %91 + %94 = OpSLessThan %93 %90 %92 + OpBranchConditional %94 %86 %87 + %86 = OpLabel + %96 = OpAccessChain %19 %16 %17 %18 + %97 = OpLoad %6 %96 + OpStore %95 %97 + OpBranch %98 + %98 = OpLabel + OpLoopMerge %100 %101 None + OpBranch %102 + %102 = OpLabel + %103 = OpLoad %6 %95 + %104 = OpAccessChain %19 %16 %17 %25 + %105 = OpLoad %6 %104 + %106 = OpSLessThan %93 %103 %105 + OpBranchConditional %106 %99 %100 + %99 = OpLabel + %107 = OpLoad %6 %95 + %108 = OpIAdd %6 %107 %50 + OpStore %95 %108 + %110 = OpAccessChain %19 %16 %17 %22 + %111 = OpLoad %6 %110 + OpStore %109 %111 + %113 = OpAccessChain %19 %16 %17 %18 + %114 = OpLoad %6 %113 + OpStore %112 %114 + OpBranch %115 + %115 = OpLabel + OpLoopMerge %117 %118 None + OpBranch %119 + %119 = OpLabel + %120 = OpLoad %6 %112 + %121 = OpAccessChain %19 %16 %17 %50 + %122 = OpLoad %6 %121 + %123 = OpSLessThan %93 %120 %122 + OpBranchConditional %123 %116 %117 + %116 = OpLabel + %124 = OpLoad %6 %109 + %125 = OpAccessChain %19 %16 %17 %28 + %126 = OpLoad %6 %125 + %127 = OpSGreaterThan %93 %124 %126 + OpSelectionMerge %129 None + OpBranchConditional %127 %128 %129 + %128 = OpLabel + OpBranch %117 + %129 = OpLabel + %131 = OpLoad %6 %109 + %132 = OpIAdd %6 %131 %50 + OpStore %109 %132 + %133 = OpLoad %6 %112 + %134 = OpLoad %6 %82 + %135 = OpAccessChain %81 %49 %134 + %136 = OpLoad %6 %135 + %137 = OpAccessChain %81 %11 %133 + OpStore %137 %136 + OpBranch %118 + %118 = OpLabel + %138 = OpLoad %6 %112 + %139 = OpIAdd %6 %138 %50 + OpStore %112 %139 + OpBranch %115 + %117 = OpLabel + OpBranch %101 + %101 = OpLabel + OpBranch %98 + %100 = OpLabel + OpStore %140 %17 + OpBranch %141 + %141 = OpLabel + OpLoopMerge %143 %144 None + OpBranch %145 + %145 = OpLabel + %146 = OpLoad %6 %140 + %147 = OpSLessThan %93 %146 %28 + OpBranchConditional %147 %142 %143 + %142 = OpLabel + %148 = OpLoad %6 %140 + %149 = OpIAdd %6 %148 %50 + OpStore %140 %149 + %150 = OpAccessChain %81 %49 %50 + %151 = OpLoad %6 %150 + %152 = OpAccessChain %81 %11 %50 + OpStore %152 %151 + OpBranch %144 + %144 = OpLabel + OpBranch %141 + %143 = OpLabel + OpBranch %153 + %153 = OpLabel + OpLoopMerge %155 %156 None + OpBranch %154 + %154 = OpLabel + OpStore %157 %17 + OpStore %158 %17 + OpBranch %159 + %159 = OpLabel + OpLoopMerge %161 %162 None + OpBranch %163 + %163 = OpLabel + %164 = OpLoad %6 %158 + %165 = OpSLessThan %93 %164 %45 + OpBranchConditional %165 %160 %161 + %160 = OpLabel + %166 = OpLoad %6 %157 + %167 = OpSGreaterThan %93 %166 %25 + OpSelectionMerge %169 None + OpBranchConditional %167 %168 %169 + %168 = OpLabel + OpBranch %161 + %169 = OpLabel + %171 = OpLoad %6 %157 + %172 = OpIAdd %6 %171 %50 + OpStore %157 %172 + %173 = OpLoad %6 %158 + %174 = OpLoad %6 %158 + %175 = OpAccessChain %81 %11 %174 + %176 = OpLoad %6 %175 + %177 = OpAccessChain %81 %49 %173 + OpStore %177 %176 + OpBranch %162 + %162 = OpLabel + %178 = OpLoad %6 %158 + %179 = OpIAdd %6 %178 %50 + OpStore %158 %179 + OpBranch %159 + %161 = OpLabel + OpBranch %156 + %156 = OpLabel + %180 = OpAccessChain %19 %16 %17 %22 + %181 = OpLoad %6 %180 + %182 = OpAccessChain %19 %16 %17 %18 + %183 = OpLoad %6 %182 + %184 = OpIEqual %93 %181 %183 + OpBranchConditional %184 %153 %155 + %155 = OpLabel + OpBranch %88 + %88 = OpLabel + %185 = OpLoad %6 %82 + %186 = OpIAdd %6 %185 %50 + OpStore %82 %186 + OpBranch %85 + %87 = OpLabel + %188 = OpAccessChain %19 %16 %17 %71 + %189 = OpLoad %6 %188 + %190 = OpAccessChain %19 %16 %17 %53 + %191 = OpLoad %6 %190 + %192 = OpAccessChain %19 %16 %17 %71 + %193 = OpLoad %6 %192 + %194 = OpAccessChain %19 %16 %17 %28 + %195 = OpLoad %6 %194 + %196 = OpAccessChain %19 %16 %17 %31 + %197 = OpLoad %6 %196 + %198 = OpAccessChain %19 %16 %17 %34 + %199 = OpLoad %6 %198 + %200 = OpAccessChain %19 %16 %17 %37 + %201 = OpLoad %6 %200 + %202 = OpAccessChain %19 %16 %17 %40 + %203 = OpLoad %6 %202 + %204 = OpAccessChain %19 %16 %17 %17 + %205 = OpLoad %6 %204 + %206 = OpAccessChain %19 %16 %17 %45 + %207 = OpLoad %6 %206 + %208 = OpCompositeConstruct %9 %189 %191 %193 %195 %197 %199 %201 %203 %205 %207 + OpStore %187 %208 + %210 = OpAccessChain %19 %16 %17 %71 + %211 = OpLoad %6 %210 + %212 = OpAccessChain %19 %16 %17 %53 + %213 = OpLoad %6 %212 + %214 = OpAccessChain %19 %16 %17 %71 + %215 = OpLoad %6 %214 + %216 = OpAccessChain %19 %16 %17 %28 + %217 = OpLoad %6 %216 + %218 = OpAccessChain %19 %16 %17 %31 + %219 = OpLoad %6 %218 + %220 = OpAccessChain %19 %16 %17 %65 + %221 = OpLoad %6 %220 + %222 = OpAccessChain %19 %16 %17 %68 + %223 = OpLoad %6 %222 + %224 = OpAccessChain %19 %16 %17 %71 + %225 = OpLoad %6 %224 + %226 = OpAccessChain %19 %16 %17 %74 + %227 = OpLoad %6 %226 + %228 = OpAccessChain %19 %16 %17 %77 + %229 = OpLoad %6 %228 + %230 = OpCompositeConstruct %9 %211 %213 %215 %217 %219 %221 %223 %225 %227 %229 + OpStore %209 %230 + %235 = OpAccessChain %19 %16 %17 %22 + %236 = OpLoad %6 %235 + %237 = OpConvertSToF %231 %236 + %238 = OpAccessChain %19 %16 %17 %18 + %239 = OpLoad %6 %238 + %240 = OpConvertSToF %231 %239 + %241 = OpAccessChain %19 %16 %17 %18 + %242 = OpLoad %6 %241 + %243 = OpConvertSToF %231 %242 + %244 = OpAccessChain %19 %16 %17 %22 + %245 = OpLoad %6 %244 + %246 = OpConvertSToF %231 %245 + %247 = OpCompositeConstruct %232 %237 %240 %243 %246 + OpStore %234 %247 + %249 = OpAccessChain %19 %16 %17 %18 + %250 = OpLoad %6 %249 + OpStore %248 %250 + OpBranch %251 + %251 = OpLabel + OpLoopMerge %253 %254 None + OpBranch %255 + %255 = OpLabel + %256 = OpLoad %6 %248 + %257 = OpAccessChain %19 %16 %17 %50 + %258 = OpLoad %6 %257 + %259 = OpSLessThan %93 %256 %258 + OpBranchConditional %259 %252 %253 + %252 = OpLabel + %260 = OpLoad %6 %248 + %261 = OpAccessChain %81 %11 %260 + %262 = OpLoad %6 %261 + %263 = OpLoad %6 %248 + %264 = OpAccessChain %81 %187 %263 + %265 = OpLoad %6 %264 + %266 = OpINotEqual %93 %262 %265 + %267 = OpLogicalNot %93 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %269 + %268 = OpLabel + %270 = OpLoad %6 %248 + %271 = OpAccessChain %81 %49 %270 + %272 = OpLoad %6 %271 + %273 = OpLoad %6 %248 + %274 = OpAccessChain %81 %209 %273 + %275 = OpLoad %6 %274 + %276 = OpINotEqual %93 %272 %275 + OpBranch %269 + %269 = OpLabel + %277 = OpPhi %93 %266 %252 %276 %268 + OpSelectionMerge %279 None + OpBranchConditional %277 %278 %279 + %278 = OpLabel + %280 = OpAccessChain %19 %16 %17 %18 + %281 = OpLoad %6 %280 + %282 = OpConvertSToF %231 %281 + %283 = OpCompositeConstruct %232 %282 %282 %282 %282 + OpStore %234 %283 + OpBranch %279 + %279 = OpLabel + OpBranch %254 + %254 = OpLabel + %284 = OpLoad %6 %248 + %285 = OpIAdd %6 %284 %50 + OpStore %248 %285 + OpBranch %251 + %253 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 STD140 DATA + 1 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 8 10 1 0 2 3 4 5 6 7 9 17 11 15 16 12 13 14 18 19 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-array-set-element-condition-negative-modulus.amber b/vulkan/amber/graphicsfuzz/cov-array-set-element-condition-negative-modulus.amber new file mode 100644 index 0000000..197d77e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-array-set-element-condition-negative-modulus.amber @@ -0,0 +1,287 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[10] = int[10](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1); +# ivec2 v = ivec2(_int_1); +# int a = 1; +# +# // Always true. +# if(arr[_int_1] == _int_1) +# { +# a++; +# } +# +# // Always false. +# if (_int_1 == 0) +# { +# // Modulus of a negative value is undefined, but this is never executed. +# if(-5 % a >= _int_1) +# { +# arr[v.x + v.y] = _int_0; +# } +# } +# else +# { +# // arr[2] becomes two. +# arr[v.x + v.y] = _int_2; +# } +# +# // Always true. +# if(a == _int_2 && arr[_int_2] == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 132 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %113 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %42 "v" + OpName %47 "a" + OpName %113 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %113 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 3 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpTypePointer Uniform %6 + %40 = OpTypeVector %6 2 + %41 = OpTypePointer Function %40 + %46 = OpTypePointer Function %6 + %48 = OpConstant %6 1 + %55 = OpTypeBool + %66 = OpConstant %6 -5 + %74 = OpConstant %7 0 + %77 = OpConstant %7 1 + %90 = OpConstant %6 2 + %110 = OpTypeFloat 32 + %111 = OpTypeVector %110 4 + %112 = OpTypePointer Output %111 + %113 = OpVariable %112 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %42 = OpVariable %41 Function + %47 = OpVariable %46 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %6 %19 + %21 = OpAccessChain %18 %16 %17 %17 + %22 = OpLoad %6 %21 + %23 = OpAccessChain %18 %16 %17 %17 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %18 %16 %17 %17 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %18 %16 %17 %17 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %18 %16 %17 %17 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %18 %16 %17 %17 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %18 %16 %17 %17 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %18 %16 %17 %17 + %38 = OpLoad %6 %37 + %39 = OpCompositeConstruct %9 %20 %22 %24 %26 %28 %30 %32 %34 %36 %38 + OpStore %11 %39 + %43 = OpAccessChain %18 %16 %17 %17 + %44 = OpLoad %6 %43 + %45 = OpCompositeConstruct %40 %44 %44 + OpStore %42 %45 + OpStore %47 %48 + %49 = OpAccessChain %18 %16 %17 %17 + %50 = OpLoad %6 %49 + %51 = OpAccessChain %46 %11 %50 + %52 = OpLoad %6 %51 + %53 = OpAccessChain %18 %16 %17 %17 + %54 = OpLoad %6 %53 + %56 = OpIEqual %55 %52 %54 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + %59 = OpLoad %6 %47 + %60 = OpIAdd %6 %59 %48 + OpStore %47 %60 + OpBranch %58 + %58 = OpLabel + %61 = OpAccessChain %18 %16 %17 %17 + %62 = OpLoad %6 %61 + %63 = OpIEqual %55 %62 %17 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %84 + %64 = OpLabel + %67 = OpLoad %6 %47 + %68 = OpSMod %6 %66 %67 + %69 = OpAccessChain %18 %16 %17 %17 + %70 = OpLoad %6 %69 + %71 = OpSGreaterThanEqual %55 %68 %70 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %73 + %72 = OpLabel + %75 = OpAccessChain %46 %42 %74 + %76 = OpLoad %6 %75 + %78 = OpAccessChain %46 %42 %77 + %79 = OpLoad %6 %78 + %80 = OpIAdd %6 %76 %79 + %81 = OpAccessChain %18 %16 %17 %48 + %82 = OpLoad %6 %81 + %83 = OpAccessChain %46 %11 %80 + OpStore %83 %82 + OpBranch %73 + %73 = OpLabel + OpBranch %65 + %84 = OpLabel + %85 = OpAccessChain %46 %42 %74 + %86 = OpLoad %6 %85 + %87 = OpAccessChain %46 %42 %77 + %88 = OpLoad %6 %87 + %89 = OpIAdd %6 %86 %88 + %91 = OpAccessChain %18 %16 %17 %90 + %92 = OpLoad %6 %91 + %93 = OpAccessChain %46 %11 %89 + OpStore %93 %92 + OpBranch %65 + %65 = OpLabel + %94 = OpLoad %6 %47 + %95 = OpAccessChain %18 %16 %17 %90 + %96 = OpLoad %6 %95 + %97 = OpIEqual %55 %94 %96 + OpSelectionMerge %99 None + OpBranchConditional %97 %98 %99 + %98 = OpLabel + %100 = OpAccessChain %18 %16 %17 %90 + %101 = OpLoad %6 %100 + %102 = OpAccessChain %46 %11 %101 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %18 %16 %17 %90 + %105 = OpLoad %6 %104 + %106 = OpIEqual %55 %103 %105 + OpBranch %99 + %99 = OpLabel + %107 = OpPhi %55 %97 %65 %106 %98 + OpSelectionMerge %109 None + OpBranchConditional %107 %108 %127 + %108 = OpLabel + %114 = OpAccessChain %18 %16 %17 %17 + %115 = OpLoad %6 %114 + %116 = OpConvertSToF %110 %115 + %117 = OpAccessChain %18 %16 %17 %48 + %118 = OpLoad %6 %117 + %119 = OpConvertSToF %110 %118 + %120 = OpAccessChain %18 %16 %17 %48 + %121 = OpLoad %6 %120 + %122 = OpConvertSToF %110 %121 + %123 = OpAccessChain %18 %16 %17 %17 + %124 = OpLoad %6 %123 + %125 = OpConvertSToF %110 %124 + %126 = OpCompositeConstruct %111 %116 %119 %122 %125 + OpStore %113 %126 + OpBranch %109 + %127 = OpLabel + %128 = OpAccessChain %18 %16 %17 %48 + %129 = OpLoad %6 %128 + %130 = OpConvertSToF %110 %129 + %131 = OpCompositeConstruct %111 %130 %130 %130 %130 + OpStore %113 %131 + OpBranch %109 + %109 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-asin-undefined-smoothstep.amber b/vulkan/amber/graphicsfuzz/cov-asin-undefined-smoothstep.amber new file mode 100644 index 0000000..063d2ff --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-asin-undefined-smoothstep.amber @@ -0,0 +1,257 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplify code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_0_2 _GLF_uniform_float_values[2] +# #define _float_0_95 _GLF_uniform_float_values[3] +# #define _float_0_62 _GLF_uniform_float_values[4] +# #define _float_0_63 _GLF_uniform_float_values[5] +# #define _float_0_96 _GLF_uniform_float_values[6] +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 0.2, 0.95, 0.62, 0.63, 0.96] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[7]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v1 = vec4(_float_0_2, _float_0_2, _float_1_0, _float_0_2); +# +# // This results in an undefined value, but not in undefined behavior. v2 becomes +# // [1.57, 1.11, undefined, 0.92]. The undefined z-component doesn't matter +# // since it's not accessed when assigning the final color. +# vec4 v2 = asin(vec4(1.0, 0.9, 1.1, 0.8)); +# +# vec4 v3 = vec4(_float_1_0); +# vec4 v4 = smoothstep(v1, v2, v3); +# +# _GLF_color = v4.xywx; +# +# if (v4.x > _float_0_62 && v4.x < _float_0_63 && v4.y > _float_0_95 +# && v4.y < _float_0_96 && v4.w == _float_1_0) +# { +# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0); +# } +# else +# { +# _GLF_color = vec4(_float_0_0); +# } +# } +DEVICE_EXTENSION VK_KHR_shader_float_controls +DEVICE_PROPERTY FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32 +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 110 +; Schema: 0 + OpCapability Shader + OpCapability SignedZeroInfNanPreserve + OpExtension "SPV_KHR_float_controls" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %45 + OpExecutionMode %4 OriginUpperLeft + OpExecutionMode %4 SignedZeroInfNanPreserve 32 + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v1" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %29 "v2" + OpName %35 "v3" + OpName %39 "v4" + OpName %45 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %45 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 7 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpConstant %16 2 + %19 = OpTypePointer Uniform %6 + %30 = OpConstant %6 1.57079637 + %31 = OpConstant %6 1.11976957 + %32 = OpConstant %6 0x1.8p+128 + %33 = OpConstant %6 0.927295208 + %34 = OpConstantComposite %7 %30 %31 %32 %33 + %44 = OpTypePointer Output %7 + %45 = OpVariable %44 Output + %48 = OpTypeBool + %49 = OpConstant %10 0 + %50 = OpTypePointer Function %6 + %53 = OpConstant %16 4 + %61 = OpConstant %16 5 + %68 = OpConstant %10 1 + %71 = OpConstant %16 3 + %80 = OpConstant %16 6 + %87 = OpConstant %10 3 + %98 = OpConstant %16 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %29 = OpVariable %8 Function + %35 = OpVariable %8 Function + %39 = OpVariable %8 Function + %20 = OpAccessChain %19 %15 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %15 %17 %18 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %19 %15 %17 %17 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %19 %15 %17 %18 + %27 = OpLoad %6 %26 + %28 = OpCompositeConstruct %7 %21 %23 %25 %27 + OpStore %9 %28 + OpStore %29 %34 + %36 = OpAccessChain %19 %15 %17 %17 + %37 = OpLoad %6 %36 + %38 = OpCompositeConstruct %7 %37 %37 %37 %37 + OpStore %35 %38 + %40 = OpLoad %7 %9 + %41 = OpLoad %7 %29 + %42 = OpLoad %7 %35 + %43 = OpExtInst %7 %1 SmoothStep %40 %41 %42 + OpStore %39 %43 + %46 = OpLoad %7 %39 + %47 = OpVectorShuffle %7 %46 %46 0 1 3 0 + OpStore %45 %47 + %51 = OpAccessChain %50 %39 %49 + %52 = OpLoad %6 %51 + %54 = OpAccessChain %19 %15 %17 %53 + %55 = OpLoad %6 %54 + %56 = OpFOrdGreaterThan %48 %52 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + %59 = OpAccessChain %50 %39 %49 + %60 = OpLoad %6 %59 + %62 = OpAccessChain %19 %15 %17 %61 + %63 = OpLoad %6 %62 + %64 = OpFOrdLessThan %48 %60 %63 + OpBranch %58 + %58 = OpLabel + %65 = OpPhi %48 %56 %5 %64 %57 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %67 + %66 = OpLabel + %69 = OpAccessChain %50 %39 %68 + %70 = OpLoad %6 %69 + %72 = OpAccessChain %19 %15 %17 %71 + %73 = OpLoad %6 %72 + %74 = OpFOrdGreaterThan %48 %70 %73 + OpBranch %67 + %67 = OpLabel + %75 = OpPhi %48 %65 %58 %74 %66 + OpSelectionMerge %77 None + OpBranchConditional %75 %76 %77 + %76 = OpLabel + %78 = OpAccessChain %50 %39 %68 + %79 = OpLoad %6 %78 + %81 = OpAccessChain %19 %15 %17 %80 + %82 = OpLoad %6 %81 + %83 = OpFOrdLessThan %48 %79 %82 + OpBranch %77 + %77 = OpLabel + %84 = OpPhi %48 %75 %67 %83 %76 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %86 + %85 = OpLabel + %88 = OpAccessChain %50 %39 %87 + %89 = OpLoad %6 %88 + %90 = OpAccessChain %19 %15 %17 %17 + %91 = OpLoad %6 %90 + %92 = OpFOrdEqual %48 %89 %91 + OpBranch %86 + %86 = OpLabel + %93 = OpPhi %48 %84 %77 %92 %85 + OpSelectionMerge %95 None + OpBranchConditional %93 %94 %106 + %94 = OpLabel + %96 = OpAccessChain %19 %15 %17 %17 + %97 = OpLoad %6 %96 + %99 = OpAccessChain %19 %15 %17 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %19 %15 %17 %98 + %102 = OpLoad %6 %101 + %103 = OpAccessChain %19 %15 %17 %17 + %104 = OpLoad %6 %103 + %105 = OpCompositeConstruct %7 %97 %100 %102 %104 + OpStore %45 %105 + OpBranch %95 + %106 = OpLabel + %107 = OpAccessChain %19 %15 %17 %98 + %108 = OpLoad %6 %107 + %109 = OpCompositeConstruct %7 %108 %108 %108 %108 + OpStore %45 %109 + OpBranch %95 + %95 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 0.2 0.95 0.62 0.63 0.96 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-atan-trunc-vec4.amber b/vulkan/amber/graphicsfuzz/cov-atan-trunc-vec4.amber new file mode 100644 index 0000000..0887aa7 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-atan-trunc-vec4.amber @@ -0,0 +1,214 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_58 _GLF_uniform_float_values[0] +# #define _float_1_55 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.58, 1.55] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v = vec4(_int_0, _int_0, -621.596, _int_0); +# float f = atan(trunc(v)).z; +# +# // Always true. +# if(f > - _float_1_58 && f < - _float_1_55) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 78 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %59 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %31 "f" + OpName %39 "buf0" + OpMemberName %39 0 "_GLF_uniform_float_values" + OpName %41 "" + OpName %59 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %38 ArrayStride 16 + OpMemberDecorate %39 0 Offset 0 + OpDecorate %39 Block + OpDecorate %41 DescriptorSet 0 + OpDecorate %41 Binding 0 + OpDecorate %59 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %25 = OpConstant %6 -621.596008 + %30 = OpTypePointer Function %6 + %36 = OpTypeBool + %38 = OpTypeArray %6 %12 + %39 = OpTypeStruct %38 + %40 = OpTypePointer Uniform %39 + %41 = OpVariable %40 Uniform + %42 = OpTypePointer Uniform %6 + %50 = OpConstant %10 1 + %58 = OpTypePointer Output %7 + %59 = OpVariable %58 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %31 = OpVariable %30 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %22 = OpAccessChain %18 %16 %17 %17 + %23 = OpLoad %10 %22 + %24 = OpConvertSToF %6 %23 + %26 = OpAccessChain %18 %16 %17 %17 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpCompositeConstruct %7 %21 %24 %25 %28 + OpStore %9 %29 + %32 = OpLoad %7 %9 + %33 = OpExtInst %7 %1 Trunc %32 + %34 = OpExtInst %7 %1 Atan %33 + %35 = OpCompositeExtract %6 %34 2 + OpStore %31 %35 + %37 = OpLoad %6 %31 + %43 = OpAccessChain %42 %41 %17 %17 + %44 = OpLoad %6 %43 + %45 = OpFNegate %6 %44 + %46 = OpFOrdGreaterThan %36 %37 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + %49 = OpLoad %6 %31 + %51 = OpAccessChain %42 %41 %17 %50 + %52 = OpLoad %6 %51 + %53 = OpFNegate %6 %52 + %54 = OpFOrdLessThan %36 %49 %53 + OpBranch %48 + %48 = OpLabel + %55 = OpPhi %36 %46 %5 %54 %47 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %73 + %56 = OpLabel + %60 = OpAccessChain %18 %16 %17 %50 + %61 = OpLoad %10 %60 + %62 = OpConvertSToF %6 %61 + %63 = OpAccessChain %18 %16 %17 %17 + %64 = OpLoad %10 %63 + %65 = OpConvertSToF %6 %64 + %66 = OpAccessChain %18 %16 %17 %17 + %67 = OpLoad %10 %66 + %68 = OpConvertSToF %6 %67 + %69 = OpAccessChain %18 %16 %17 %50 + %70 = OpLoad %10 %69 + %71 = OpConvertSToF %6 %70 + %72 = OpCompositeConstruct %7 %62 %65 %68 %71 + OpStore %59 %72 + OpBranch %57 + %73 = OpLabel + %74 = OpAccessChain %18 %16 %17 %17 + %75 = OpLoad %10 %74 + %76 = OpConvertSToF %6 %75 + %77 = OpCompositeConstruct %7 %76 %76 %76 %76 + OpStore %59 %77 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.58 1.55 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-basic-block-discard-in-function.amber b/vulkan/amber/graphicsfuzz/cov-basic-block-discard-in-function.amber new file mode 100644 index 0000000..8c6aa4c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-basic-block-discard-in-function.amber @@ -0,0 +1,200 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific basic block code path + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--vector-dce' +# '--combine-access-chains' +# '--eliminate-local-multi-store' +# '--scalar-replacement=100' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-return' +# '--combine-access-chains' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-blocks' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func(int x) +# { +# if (x == 10) // Always false. +# discard; +# +# return x; +# } +# +# void main() +# { +# int a = 0; +# int b = zero; +# +# do +# { +# a = func(b); +# b++; +# } +# while(b < 4); +# +# if (a == 3) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "func(i1;" + OpName %9 "x" + OpName %22 "a" + OpName %24 "b" + OpName %25 "buf0" + OpMemberName %25 0 "zero" + OpName %27 "" + OpName %35 "param" + OpName %52 "_GLF_color" + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 0 + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %13 = OpConstant %6 10 + %14 = OpTypeBool + %23 = OpConstant %6 0 + %25 = OpTypeStruct %6 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypePointer Uniform %6 + %39 = OpConstant %6 1 + %42 = OpConstant %6 4 + %45 = OpConstant %6 3 + %49 = OpTypeFloat 32 + %50 = OpTypeVector %49 4 + %51 = OpTypePointer Output %50 + %52 = OpVariable %51 Output + %53 = OpConstant %49 1 + %54 = OpConstant %49 0 + %55 = OpConstantComposite %50 %53 %54 %54 %53 + %57 = OpConstantComposite %50 %54 %54 %54 %54 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %22 = OpVariable %7 Function + %24 = OpVariable %7 Function + %35 = OpVariable %7 Function + OpStore %22 %23 + %29 = OpAccessChain %28 %27 %23 + %30 = OpLoad %6 %29 + OpStore %24 %30 + OpBranch %31 + %31 = OpLabel + %58 = OpPhi %6 %30 %5 %40 %31 + OpStore %35 %58 + %37 = OpFunctionCall %6 %10 %35 + OpStore %22 %37 + %40 = OpIAdd %6 %58 %39 + OpStore %24 %40 + %43 = OpSLessThan %14 %40 %42 + OpLoopMerge %33 %31 None + OpBranchConditional %43 %31 %33 + %33 = OpLabel + %46 = OpIEqual %14 %37 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %56 + %47 = OpLabel + OpStore %52 %55 + OpBranch %48 + %56 = OpLabel + OpStore %52 %57 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %12 = OpLoad %6 %9 + %15 = OpIEqual %14 %12 %13 + OpSelectionMerge %17 None + OpBranchConditional %15 %16 %17 + %16 = OpLabel + OpTerminateInvocation + %17 = OpLabel + %19 = OpLoad %6 %9 + OpReturnValue %19 + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-bitcount.amber b/vulkan/amber/graphicsfuzz/cov-bitcount.amber new file mode 100644 index 0000000..60534f3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-bitcount.amber @@ -0,0 +1,252 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers specific inst combine add sub and inst combine simplify demanded code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int f1() +# { +# int a = 256; +# +# if (gl_FragCoord.y > _float_0_0) +# { +# a++; +# } +# +# // i becomes 2. +# int i = bitCount(a); +# +# if (i < _int_1) +# { +# return _int_1; +# } +# +# // Always returns 2. +# return i; +# } +# +# void main() +# { +# int a = f1(); +# +# if (a == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 87 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 %68 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f1(" + OpName %11 "a" + OpName %16 "gl_FragCoord" + OpName %23 "buf0" + OpMemberName %23 0 "_GLF_uniform_float_values" + OpName %25 "" + OpName %37 "i" + OpName %43 "buf1" + OpMemberName %43 0 "_GLF_uniform_int_values" + OpName %45 "" + OpName %58 "a" + OpName %68 "_GLF_color" + OpDecorate %16 BuiltIn FragCoord + OpDecorate %22 ArrayStride 16 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %42 ArrayStride 16 + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 1 + OpDecorate %68 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 256 + %13 = OpTypeFloat 32 + %14 = OpTypeVector %13 4 + %15 = OpTypePointer Input %14 + %16 = OpVariable %15 Input + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 1 + %19 = OpTypePointer Input %13 + %22 = OpTypeArray %13 %18 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpConstant %6 0 + %27 = OpTypePointer Uniform %13 + %30 = OpTypeBool + %35 = OpConstant %6 1 + %41 = OpConstant %17 3 + %42 = OpTypeArray %6 %41 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %46 = OpTypePointer Uniform %6 + %61 = OpConstant %6 2 + %67 = OpTypePointer Output %14 + %68 = OpVariable %67 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %58 = OpVariable %10 Function + %59 = OpFunctionCall %6 %8 + OpStore %58 %59 + %60 = OpLoad %6 %58 + %62 = OpAccessChain %46 %45 %26 %61 + %63 = OpLoad %6 %62 + %64 = OpIEqual %30 %60 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %82 + %65 = OpLabel + %69 = OpAccessChain %46 %45 %26 %26 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %13 %70 + %72 = OpAccessChain %46 %45 %26 %35 + %73 = OpLoad %6 %72 + %74 = OpConvertSToF %13 %73 + %75 = OpAccessChain %46 %45 %26 %35 + %76 = OpLoad %6 %75 + %77 = OpConvertSToF %13 %76 + %78 = OpAccessChain %46 %45 %26 %26 + %79 = OpLoad %6 %78 + %80 = OpConvertSToF %13 %79 + %81 = OpCompositeConstruct %14 %71 %74 %77 %80 + OpStore %68 %81 + OpBranch %66 + %82 = OpLabel + %83 = OpAccessChain %46 %45 %26 %35 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %13 %84 + %86 = OpCompositeConstruct %14 %85 %85 %85 %85 + OpStore %68 %86 + OpBranch %66 + %66 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %37 = OpVariable %10 Function + OpStore %11 %12 + %20 = OpAccessChain %19 %16 %18 + %21 = OpLoad %13 %20 + %28 = OpAccessChain %27 %25 %26 %26 + %29 = OpLoad %13 %28 + %31 = OpFOrdGreaterThan %30 %21 %29 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %33 + %32 = OpLabel + %34 = OpLoad %6 %11 + %36 = OpIAdd %6 %34 %35 + OpStore %11 %36 + OpBranch %33 + %33 = OpLabel + %38 = OpLoad %6 %11 + %39 = OpBitCount %6 %38 + OpStore %37 %39 + %40 = OpLoad %6 %37 + %47 = OpAccessChain %46 %45 %26 %26 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %30 %40 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %51 + %50 = OpLabel + %52 = OpAccessChain %46 %45 %26 %26 + %53 = OpLoad %6 %52 + OpReturnValue %53 + %51 = OpLabel + %55 = OpLoad %6 %37 + OpReturnValue %55 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-bitfieldExtract-undefined.amber b/vulkan/amber/graphicsfuzz/cov-bitfieldExtract-undefined.amber new file mode 100644 index 0000000..e6ab9c2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-bitfieldExtract-undefined.amber @@ -0,0 +1,176 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific constant fold code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# uint a = 0x77777777u; +# +# // b becomes undefined. This results in an undefined value, but not in undefined behavior. +# uint b = bitfieldExtract(a, -1, 1); +# +# uint c = a | b; +# +# // Always true. +# if ((c & a) == a) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 57 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %31 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %10 "b" + OpName %16 "c" + OpName %31 "_GLF_color" + OpName %34 "buf0" + OpMemberName %34 0 "_GLF_uniform_int_values" + OpName %36 "" + OpDecorate %31 Location 0 + OpDecorate %33 ArrayStride 16 + OpMemberDecorate %34 0 Offset 0 + OpDecorate %34 Block + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 2004318071 + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 -1 + %14 = OpConstant %12 1 + %24 = OpTypeBool + %28 = OpTypeFloat 32 + %29 = OpTypeVector %28 4 + %30 = OpTypePointer Output %29 + %31 = OpVariable %30 Output + %32 = OpConstant %6 2 + %33 = OpTypeArray %12 %32 + %34 = OpTypeStruct %33 + %35 = OpTypePointer Uniform %34 + %36 = OpVariable %35 Uniform + %37 = OpConstant %12 0 + %38 = OpTypePointer Uniform %12 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %16 = OpVariable %7 Function + OpStore %8 %9 + %11 = OpLoad %6 %8 + %15 = OpBitFieldUExtract %6 %11 %13 %14 + OpStore %10 %15 + %17 = OpLoad %6 %8 + %18 = OpLoad %6 %10 + %19 = OpBitwiseOr %6 %17 %18 + OpStore %16 %19 + %20 = OpLoad %6 %16 + %21 = OpLoad %6 %8 + %22 = OpBitwiseAnd %6 %20 %21 + %23 = OpLoad %6 %8 + %25 = OpIEqual %24 %22 %23 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %52 + %26 = OpLabel + %39 = OpAccessChain %38 %36 %37 %37 + %40 = OpLoad %12 %39 + %41 = OpConvertSToF %28 %40 + %42 = OpAccessChain %38 %36 %37 %14 + %43 = OpLoad %12 %42 + %44 = OpConvertSToF %28 %43 + %45 = OpAccessChain %38 %36 %37 %14 + %46 = OpLoad %12 %45 + %47 = OpConvertSToF %28 %46 + %48 = OpAccessChain %38 %36 %37 %37 + %49 = OpLoad %12 %48 + %50 = OpConvertSToF %28 %49 + %51 = OpCompositeConstruct %29 %41 %44 %47 %50 + OpStore %31 %51 + OpBranch %27 + %52 = OpLabel + %53 = OpAccessChain %38 %36 %37 %14 + %54 = OpLoad %12 %53 + %55 = OpConvertSToF %28 %54 + %56 = OpCompositeConstruct %29 %55 %55 %55 %55 + OpStore %31 %56 + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-bitfieldinsert-undefined.amber b/vulkan/amber/graphicsfuzz/cov-bitfieldinsert-undefined.amber new file mode 100644 index 0000000..e64ff70 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-bitfieldinsert-undefined.amber @@ -0,0 +1,303 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplify code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_32 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_10 _GLF_uniform_int_values[3] +# #define _int_2 _GLF_uniform_int_values[4] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# // Contents of _GLF_uniform_int_values: [1, 32, 0, 10] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[5]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# int b = _int_10; +# int c = 1; +# +# // Always false. +# if (gl_FragCoord.x < _float_0_0) +# c--; +# +# // This results in an undefined value, but not in undefined behavior. Assigning +# // an undefined value doesn't matter since d is reassigned a value >= 2 before +# // using it. +# int d = bitfieldInsert(1, 1, 32, c); +# +# if (d < _int_1) +# d = _int_2; +# +# while ((a < b) || (d < _int_1)) +# { +# d = bitfieldInsert(_int_1, _int_1, _int_32, c); +# +# if (d < _int_1) +# d = _int_2; +# +# a++; +# } +# +# if (a == _int_10) +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# else +# _GLF_color = vec4(_int_0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 121 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %29 %102 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "b" + OpName %24 "c" + OpName %29 "gl_FragCoord" + OpName %36 "buf0" + OpMemberName %36 0 "_GLF_uniform_float_values" + OpName %38 "" + OpName %48 "d" + OpName %102 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %29 BuiltIn FragCoord + OpDecorate %35 ArrayStride 16 + OpMemberDecorate %36 0 Offset 0 + OpDecorate %36 Block + OpDecorate %38 DescriptorSet 0 + OpDecorate %38 Binding 0 + OpDecorate %102 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 5 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %6 3 + %25 = OpConstant %6 1 + %26 = OpTypeFloat 32 + %27 = OpTypeVector %26 4 + %28 = OpTypePointer Input %27 + %29 = OpVariable %28 Input + %30 = OpConstant %9 0 + %31 = OpTypePointer Input %26 + %34 = OpConstant %9 1 + %35 = OpTypeArray %26 %34 + %36 = OpTypeStruct %35 + %37 = OpTypePointer Uniform %36 + %38 = OpVariable %37 Uniform + %39 = OpTypePointer Uniform %26 + %42 = OpTypeBool + %49 = OpConstant %6 32 + %58 = OpConstant %6 4 + %101 = OpTypePointer Output %27 + %102 = OpVariable %101 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %24 = OpVariable %7 Function + %48 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %22 = OpAccessChain %17 %14 %15 %21 + %23 = OpLoad %6 %22 + OpStore %20 %23 + OpStore %24 %25 + %32 = OpAccessChain %31 %29 %30 + %33 = OpLoad %26 %32 + %40 = OpAccessChain %39 %38 %15 %15 + %41 = OpLoad %26 %40 + %43 = OpFOrdLessThan %42 %33 %41 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %45 + %44 = OpLabel + %46 = OpLoad %6 %24 + %47 = OpISub %6 %46 %25 + OpStore %24 %47 + OpBranch %45 + %45 = OpLabel + %50 = OpLoad %6 %24 + %51 = OpBitFieldInsert %6 %25 %25 %49 %50 + OpStore %48 %51 + %52 = OpLoad %6 %48 + %53 = OpAccessChain %17 %14 %15 %15 + %54 = OpLoad %6 %53 + %55 = OpSLessThan %42 %52 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %57 + %56 = OpLabel + %59 = OpAccessChain %17 %14 %15 %58 + %60 = OpLoad %6 %59 + OpStore %48 %60 + OpBranch %57 + %57 = OpLabel + OpBranch %61 + %61 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %66 = OpLoad %6 %8 + %67 = OpLoad %6 %20 + %68 = OpSLessThan %42 %66 %67 + %69 = OpLogicalNot %42 %68 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %71 + %70 = OpLabel + %72 = OpLoad %6 %48 + %73 = OpAccessChain %17 %14 %15 %15 + %74 = OpLoad %6 %73 + %75 = OpSLessThan %42 %72 %74 + OpBranch %71 + %71 = OpLabel + %76 = OpPhi %42 %68 %65 %75 %70 + OpBranchConditional %76 %62 %63 + %62 = OpLabel + %77 = OpAccessChain %17 %14 %15 %15 + %78 = OpLoad %6 %77 + %79 = OpAccessChain %17 %14 %15 %15 + %80 = OpLoad %6 %79 + %81 = OpAccessChain %17 %14 %15 %25 + %82 = OpLoad %6 %81 + %83 = OpLoad %6 %24 + %84 = OpBitFieldInsert %6 %78 %80 %82 %83 + OpStore %48 %84 + %85 = OpLoad %6 %48 + %86 = OpAccessChain %17 %14 %15 %15 + %87 = OpLoad %6 %86 + %88 = OpSLessThan %42 %85 %87 + OpSelectionMerge %90 None + OpBranchConditional %88 %89 %90 + %89 = OpLabel + %91 = OpAccessChain %17 %14 %15 %58 + %92 = OpLoad %6 %91 + OpStore %48 %92 + OpBranch %90 + %90 = OpLabel + %93 = OpLoad %6 %8 + %94 = OpIAdd %6 %93 %25 + OpStore %8 %94 + OpBranch %64 + %64 = OpLabel + OpBranch %61 + %63 = OpLabel + %95 = OpLoad %6 %8 + %96 = OpAccessChain %17 %14 %15 %21 + %97 = OpLoad %6 %96 + %98 = OpIEqual %42 %95 %97 + OpSelectionMerge %100 None + OpBranchConditional %98 %99 %116 + %99 = OpLabel + %103 = OpAccessChain %17 %14 %15 %15 + %104 = OpLoad %6 %103 + %105 = OpConvertSToF %26 %104 + %106 = OpAccessChain %17 %14 %15 %16 + %107 = OpLoad %6 %106 + %108 = OpConvertSToF %26 %107 + %109 = OpAccessChain %17 %14 %15 %16 + %110 = OpLoad %6 %109 + %111 = OpConvertSToF %26 %110 + %112 = OpAccessChain %17 %14 %15 %15 + %113 = OpLoad %6 %112 + %114 = OpConvertSToF %26 %113 + %115 = OpCompositeConstruct %27 %105 %108 %111 %114 + OpStore %102 %115 + OpBranch %100 + %116 = OpLabel + %117 = OpAccessChain %17 %14 %15 %16 + %118 = OpLoad %6 %117 + %119 = OpConvertSToF %26 %118 + %120 = OpCompositeConstruct %27 %119 %119 %119 %119 + OpStore %102 %120 + OpBranch %100 + %100 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 32 0 10 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-bitfieldreverse-left-shift-findmsb.amber b/vulkan/amber/graphicsfuzz/cov-bitfieldreverse-left-shift-findmsb.amber new file mode 100644 index 0000000..1bf52d5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-bitfieldreverse-left-shift-findmsb.amber @@ -0,0 +1,179 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers specific DAG combiner and legalize vector ops code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // a becomes -2147483648. +# int a = bitfieldReverse(1); +# +# // a is negative therefore this results in an undefined value, but not in undefined behavior. +# int b = 1 << a; +# +# int c = findMSB(b); +# +# _GLF_color = vec4(c); +# +# if (a == -2147483648) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %20 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %11 "b" + OpName %14 "c" + OpName %20 "_GLF_color" + OpName %33 "buf0" + OpMemberName %33 0 "_GLF_uniform_int_values" + OpName %35 "" + OpDecorate %20 Location 0 + OpDecorate %32 ArrayStride 16 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %17 = OpTypeFloat 32 + %18 = OpTypeVector %17 4 + %19 = OpTypePointer Output %18 + %20 = OpVariable %19 Output + %25 = OpConstant %6 -2147483648 + %26 = OpTypeBool + %30 = OpTypeInt 32 0 + %31 = OpConstant %30 2 + %32 = OpTypeArray %6 %31 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpConstant %6 0 + %37 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %11 = OpVariable %7 Function + %14 = OpVariable %7 Function + %10 = OpBitReverse %6 %9 + OpStore %8 %10 + %12 = OpLoad %6 %8 + %13 = OpShiftLeftLogical %6 %9 %12 + OpStore %11 %13 + %15 = OpLoad %6 %11 + %16 = OpExtInst %6 %1 FindSMsb %15 + OpStore %14 %16 + %21 = OpLoad %6 %14 + %22 = OpConvertSToF %17 %21 + %23 = OpCompositeConstruct %18 %22 %22 %22 %22 + OpStore %20 %23 + %24 = OpLoad %6 %8 + %27 = OpIEqual %26 %24 %25 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %51 + %28 = OpLabel + %38 = OpAccessChain %37 %35 %36 %36 + %39 = OpLoad %6 %38 + %40 = OpConvertSToF %17 %39 + %41 = OpAccessChain %37 %35 %36 %9 + %42 = OpLoad %6 %41 + %43 = OpConvertSToF %17 %42 + %44 = OpAccessChain %37 %35 %36 %9 + %45 = OpLoad %6 %44 + %46 = OpConvertSToF %17 %45 + %47 = OpAccessChain %37 %35 %36 %36 + %48 = OpLoad %6 %47 + %49 = OpConvertSToF %17 %48 + %50 = OpCompositeConstruct %18 %40 %43 %46 %49 + OpStore %20 %50 + OpBranch %29 + %51 = OpLabel + %52 = OpAccessChain %37 %35 %36 %9 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %17 %53 + %55 = OpCompositeConstruct %18 %54 %54 %54 %54 + OpStore %20 %55 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow.amber b/vulkan/amber/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow.amber new file mode 100644 index 0000000..d3d50d3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow.amber @@ -0,0 +1,199 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_6 _GLF_uniform_int_values[2] +# #define _int_5 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 6, 5] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // a becomes 0x8000000 which is the smallest possible negative integer. +# int a = min(1, bitfieldReverse(1)); +# int b = _int_5; +# +# // a - 1 underflowa to the largest positive integer. The loop is executed +# // once because of the break inside. +# for (int i = 1; i <= a - 1; i++) +# { +# b += i; +# +# // Always true. +# if (_int_1 == 1) +# { +# break; +# } +# } +# +# // Always true. +# if (b == _int_6) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 78 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %56 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %16 "buf0" + OpMemberName %16 0 "_GLF_uniform_int_values" + OpName %18 "" + OpName %56 "_GLF_color" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %56 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpConstant %6 1 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 4 + %15 = OpTypeArray %6 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpConstant %6 0 + %20 = OpConstant %6 3 + %21 = OpTypePointer Uniform %6 + %33 = OpTypeBool + %47 = OpConstant %6 2 + %53 = OpTypeFloat 32 + %54 = OpTypeVector %53 4 + %55 = OpTypePointer Output %54 + %56 = OpVariable %55 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpBitReverse %6 %9 + %11 = OpExtInst %6 %1 SMin %9 %10 + %22 = OpAccessChain %21 %18 %19 %20 + %23 = OpLoad %6 %22 + OpBranch %25 + %25 = OpLabel + %76 = OpPhi %6 %23 %5 %37 %28 + %75 = OpPhi %6 %9 %5 %45 %28 + %32 = OpISub %6 %11 %9 + %34 = OpSLessThanEqual %33 %75 %32 + OpLoopMerge %27 %28 None + OpBranchConditional %34 %26 %27 + %26 = OpLabel + %37 = OpIAdd %6 %76 %75 + %38 = OpAccessChain %21 %18 %19 %19 + %39 = OpLoad %6 %38 + %40 = OpIEqual %33 %39 %9 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %42 + %41 = OpLabel + OpBranch %27 + %42 = OpLabel + OpBranch %28 + %28 = OpLabel + %45 = OpIAdd %6 %75 %9 + OpBranch %25 + %27 = OpLabel + %77 = OpPhi %6 %76 %25 %37 %41 + %48 = OpAccessChain %21 %18 %19 %47 + %49 = OpLoad %6 %48 + %50 = OpIEqual %33 %77 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %70 + %51 = OpLabel + %57 = OpAccessChain %21 %18 %19 %19 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %53 %58 + %60 = OpAccessChain %21 %18 %19 %9 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %53 %61 + %69 = OpCompositeConstruct %54 %59 %62 %62 %59 + OpStore %56 %69 + OpBranch %52 + %70 = OpLabel + %71 = OpAccessChain %21 %18 %19 %9 + %72 = OpLoad %6 %71 + %73 = OpConvertSToF %53 %72 + %74 = OpCompositeConstruct %54 %73 %73 %73 %73 + OpStore %56 %74 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 6 5 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-bitwise-and-variable-and-its-negation.amber b/vulkan/amber/graphicsfuzz/cov-bitwise-and-variable-and-its-negation.amber new file mode 100644 index 0000000..cc300df --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-bitwise-and-variable-and-its-negation.amber @@ -0,0 +1,174 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // After this a has either all or none of the bits as one. +# int a = (int(gl_FragCoord.y) & 1) != 0 ? 0 : ~ 0; +# +# // Bitwise AND with a negation is always zero. +# if((a & (~a)) == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %42 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "gl_FragCoord" + OpName %32 "buf0" + OpMemberName %32 0 "_GLF_uniform_int_values" + OpName %34 "" + OpName %42 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %31 ArrayStride 16 + OpMemberDecorate %32 0 Offset 0 + OpDecorate %32 Block + OpDecorate %34 DescriptorSet 0 + OpDecorate %34 Binding 0 + OpDecorate %42 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 1 + %15 = OpTypePointer Input %9 + %19 = OpConstant %6 1 + %21 = OpConstant %6 0 + %22 = OpTypeBool + %24 = OpConstant %6 -1 + %30 = OpConstant %13 2 + %31 = OpTypeArray %6 %30 + %32 = OpTypeStruct %31 + %33 = OpTypePointer Uniform %32 + %34 = OpVariable %33 Uniform + %35 = OpTypePointer Uniform %6 + %41 = OpTypePointer Output %10 + %42 = OpVariable %41 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %18 = OpConvertFToS %6 %17 + %20 = OpBitwiseAnd %6 %18 %19 + %23 = OpINotEqual %22 %20 %21 + %25 = OpSelect %6 %23 %21 %24 + OpStore %8 %25 + %26 = OpLoad %6 %8 + %27 = OpLoad %6 %8 + %28 = OpNot %6 %27 + %29 = OpBitwiseAnd %6 %26 %28 + %36 = OpAccessChain %35 %34 %21 %19 + %37 = OpLoad %6 %36 + %38 = OpIEqual %22 %29 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %56 + %39 = OpLabel + %43 = OpAccessChain %35 %34 %21 %21 + %44 = OpLoad %6 %43 + %45 = OpConvertSToF %9 %44 + %46 = OpAccessChain %35 %34 %21 %19 + %47 = OpLoad %6 %46 + %48 = OpConvertSToF %9 %47 + %49 = OpAccessChain %35 %34 %21 %19 + %50 = OpLoad %6 %49 + %51 = OpConvertSToF %9 %50 + %52 = OpAccessChain %35 %34 %21 %21 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %9 %53 + %55 = OpCompositeConstruct %10 %45 %48 %51 %54 + OpStore %42 %55 + OpBranch %40 + %56 = OpLabel + %57 = OpAccessChain %35 %34 %21 %19 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %9 %58 + %60 = OpCompositeConstruct %10 %59 %59 %59 %59 + OpStore %42 %60 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-bitwise-inverse-uniform-condition.amber b/vulkan/amber/graphicsfuzz/cov-bitwise-inverse-uniform-condition.amber new file mode 100644 index 0000000..a2b2b0a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-bitwise-inverse-uniform-condition.amber @@ -0,0 +1,227 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of zero: 0.0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# float zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = ~(((zero < _float_1_0) ? _int_0 : _int_1) | 1); +# +# // Always true. +# if(a == ~ _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %54 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %10 "buf2" + OpMemberName %10 0 "zero" + OpName %12 "" + OpName %20 "buf0" + OpMemberName %20 0 "_GLF_uniform_float_values" + OpName %22 "" + OpName %32 "buf1" + OpMemberName %32 0 "_GLF_uniform_int_values" + OpName %34 "" + OpName %54 "_GLF_color" + OpMemberDecorate %10 0 Offset 0 + OpDecorate %10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 2 + OpDecorate %19 ArrayStride 16 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpDecorate %31 ArrayStride 16 + OpMemberDecorate %32 0 Offset 0 + OpDecorate %32 Block + OpDecorate %34 DescriptorSet 0 + OpDecorate %34 Binding 1 + OpDecorate %54 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeStruct %9 + %11 = OpTypePointer Uniform %10 + %12 = OpVariable %11 Uniform + %13 = OpConstant %6 0 + %14 = OpTypePointer Uniform %9 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 1 + %19 = OpTypeArray %9 %18 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %25 = OpTypeBool + %30 = OpConstant %17 2 + %31 = OpTypeArray %6 %30 + %32 = OpTypeStruct %31 + %33 = OpTypePointer Uniform %32 + %34 = OpVariable %33 Uniform + %35 = OpConstant %6 1 + %36 = OpTypePointer Uniform %6 + %52 = OpTypeVector %9 4 + %53 = OpTypePointer Output %52 + %54 = OpVariable %53 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %27 = OpVariable %7 Function + %15 = OpAccessChain %14 %12 %13 + %16 = OpLoad %9 %15 + %23 = OpAccessChain %14 %22 %13 %13 + %24 = OpLoad %9 %23 + %26 = OpFOrdLessThan %25 %16 %24 + OpSelectionMerge %29 None + OpBranchConditional %26 %28 %39 + %28 = OpLabel + %37 = OpAccessChain %36 %34 %13 %35 + %38 = OpLoad %6 %37 + OpStore %27 %38 + OpBranch %29 + %39 = OpLabel + %40 = OpAccessChain %36 %34 %13 %13 + %41 = OpLoad %6 %40 + OpStore %27 %41 + OpBranch %29 + %29 = OpLabel + %42 = OpLoad %6 %27 + %43 = OpBitwiseOr %6 %42 %35 + %44 = OpNot %6 %43 + OpStore %8 %44 + %45 = OpLoad %6 %8 + %46 = OpAccessChain %36 %34 %13 %13 + %47 = OpLoad %6 %46 + %48 = OpNot %6 %47 + %49 = OpIEqual %25 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %68 + %50 = OpLabel + %55 = OpAccessChain %36 %34 %13 %13 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %9 %56 + %58 = OpAccessChain %36 %34 %13 %35 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %9 %59 + %61 = OpAccessChain %36 %34 %13 %35 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %9 %62 + %64 = OpAccessChain %36 %34 %13 %13 + %65 = OpLoad %6 %64 + %66 = OpConvertSToF %9 %65 + %67 = OpCompositeConstruct %52 %57 %60 %63 %66 + OpStore %54 %67 + OpBranch %51 + %68 = OpLabel + %69 = OpAccessChain %36 %34 %13 %35 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %9 %70 + %72 = OpCompositeConstruct %52 %71 %71 %71 %71 + OpStore %54 %72 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-bitwise-or-uniform-zero-tenth-bit-loop-limit-find-lsb.amber b/vulkan/amber/graphicsfuzz/cov-bitwise-or-uniform-zero-tenth-bit-loop-limit-find-lsb.amber new file mode 100644 index 0000000..3e41420 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-bitwise-or-uniform-zero-tenth-bit-loop-limit-find-lsb.amber @@ -0,0 +1,201 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_9 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 9] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int msb10 = _int_0 | 1024; +# int a = _int_0; +# +# // Iterated nine times. +# for(int i = _int_1; i < findLSB(msb10); i++) +# { +# a++; +# } +# +# // Always true. +# if(a == _int_9) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "msb10" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %22 "a" + OpName %25 "i" + OpName %52 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %20 = OpConstant %6 1024 + %36 = OpTypeBool + %43 = OpConstant %6 2 + %49 = OpTypeFloat 32 + %50 = OpTypeVector %49 4 + %51 = OpTypePointer Output %50 + %52 = OpVariable %51 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %7 Function + %25 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + %21 = OpBitwiseOr %6 %19 %20 + OpStore %8 %21 + %23 = OpAccessChain %17 %14 %15 %16 + %24 = OpLoad %6 %23 + OpStore %22 %24 + %26 = OpAccessChain %17 %14 %15 %15 + %27 = OpLoad %6 %26 + OpStore %25 %27 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %6 %25 + %34 = OpLoad %6 %8 + %35 = OpExtInst %6 %1 FindILsb %34 + %37 = OpSLessThan %36 %33 %35 + OpBranchConditional %37 %29 %30 + %29 = OpLabel + %38 = OpLoad %6 %22 + %39 = OpIAdd %6 %38 %16 + OpStore %22 %39 + OpBranch %31 + %31 = OpLabel + %40 = OpLoad %6 %25 + %41 = OpIAdd %6 %40 %16 + OpStore %25 %41 + OpBranch %28 + %30 = OpLabel + %42 = OpLoad %6 %22 + %44 = OpAccessChain %17 %14 %15 %43 + %45 = OpLoad %6 %44 + %46 = OpIEqual %36 %42 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %66 + %47 = OpLabel + %53 = OpAccessChain %17 %14 %15 %15 + %54 = OpLoad %6 %53 + %55 = OpConvertSToF %49 %54 + %56 = OpAccessChain %17 %14 %15 %16 + %57 = OpLoad %6 %56 + %58 = OpConvertSToF %49 %57 + %59 = OpAccessChain %17 %14 %15 %16 + %60 = OpLoad %6 %59 + %61 = OpConvertSToF %49 %60 + %62 = OpAccessChain %17 %14 %15 %15 + %63 = OpLoad %6 %62 + %64 = OpConvertSToF %49 %63 + %65 = OpCompositeConstruct %50 %55 %58 %61 %64 + OpStore %52 %65 + OpBranch %48 + %66 = OpLabel + %67 = OpAccessChain %17 %14 %15 %16 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %49 %68 + %70 = OpCompositeConstruct %50 %69 %69 %69 %69 + OpStore %52 %70 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 9 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-bitwise-shift-right-always-select-one.amber b/vulkan/amber/graphicsfuzz/cov-bitwise-shift-right-always-select-one.amber new file mode 100644 index 0000000..0216319 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-bitwise-shift-right-always-select-one.amber @@ -0,0 +1,192 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Shifting by 256 would be undefined, but value one is always selected. +# if(4 >> (gl_FragCoord.y < _float_0_0 ? 256 : 1) == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %11 %44 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "gl_FragCoord" + OpName %18 "buf0" + OpMemberName %18 0 "_GLF_uniform_float_values" + OpName %20 "" + OpName %33 "buf1" + OpMemberName %33 0 "_GLF_uniform_int_values" + OpName %35 "" + OpName %44 "_GLF_color" + OpDecorate %11 BuiltIn FragCoord + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %32 ArrayStride 16 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 1 + OpDecorate %44 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpConstant %6 4 + %8 = OpTypeFloat 32 + %9 = OpTypeVector %8 4 + %10 = OpTypePointer Input %9 + %11 = OpVariable %10 Input + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 1 + %14 = OpTypePointer Input %8 + %17 = OpTypeArray %8 %13 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpConstant %6 0 + %22 = OpTypePointer Uniform %8 + %25 = OpTypeBool + %27 = OpConstant %6 256 + %28 = OpConstant %6 1 + %31 = OpConstant %12 3 + %32 = OpTypeArray %6 %31 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpConstant %6 2 + %37 = OpTypePointer Uniform %6 + %43 = OpTypePointer Output %9 + %44 = OpVariable %43 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %15 = OpAccessChain %14 %11 %13 + %16 = OpLoad %8 %15 + %23 = OpAccessChain %22 %20 %21 %21 + %24 = OpLoad %8 %23 + %26 = OpFOrdLessThan %25 %16 %24 + %29 = OpSelect %6 %26 %27 %28 + %30 = OpShiftRightArithmetic %6 %7 %29 + %38 = OpAccessChain %37 %35 %21 %36 + %39 = OpLoad %6 %38 + %40 = OpIEqual %25 %30 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %58 + %41 = OpLabel + %45 = OpAccessChain %37 %35 %21 %21 + %46 = OpLoad %6 %45 + %47 = OpConvertSToF %8 %46 + %48 = OpAccessChain %37 %35 %21 %28 + %49 = OpLoad %6 %48 + %50 = OpConvertSToF %8 %49 + %51 = OpAccessChain %37 %35 %21 %28 + %52 = OpLoad %6 %51 + %53 = OpConvertSToF %8 %52 + %54 = OpAccessChain %37 %35 %21 %21 + %55 = OpLoad %6 %54 + %56 = OpConvertSToF %8 %55 + %57 = OpCompositeConstruct %9 %47 %50 %53 %56 + OpStore %44 %57 + OpBranch %42 + %58 = OpLabel + %59 = OpAccessChain %37 %35 %21 %28 + %60 = OpLoad %6 %59 + %61 = OpConvertSToF %8 %60 + %62 = OpCompositeConstruct %9 %61 %61 %61 %61 + OpStore %44 %62 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-bitwise-shift-right-full-bits-no-effect-clamp.amber b/vulkan/amber/graphicsfuzz/cov-bitwise-shift-right-full-bits-no-effect-clamp.amber new file mode 100644 index 0000000..5e69051 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-bitwise-shift-right-full-bits-no-effect-clamp.amber @@ -0,0 +1,150 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Arithmetic shift replicates the sign bit. +# int a = 0xffffffff >> one; +# // Clamps to 2.0. +# float f = clamp(5.0, 1.0, (a == 0xffffffff) ? 2.0 : 3.0); +# +# // Always true. +# if (int(f) == 2) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %38 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %10 "buf0" + OpMemberName %10 0 "one" + OpName %12 "" + OpName %20 "f" + OpName %38 "_GLF_color" + OpMemberDecorate %10 0 Offset 0 + OpDecorate %10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %38 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 -1 + %10 = OpTypeStruct %6 + %11 = OpTypePointer Uniform %10 + %12 = OpVariable %11 Uniform + %13 = OpConstant %6 0 + %14 = OpTypePointer Uniform %6 + %18 = OpTypeFloat 32 + %19 = OpTypePointer Function %18 + %21 = OpConstant %18 5 + %22 = OpConstant %18 1 + %24 = OpTypeBool + %26 = OpConstant %18 2 + %27 = OpConstant %18 3 + %32 = OpConstant %6 2 + %36 = OpTypeVector %18 4 + %37 = OpTypePointer Output %36 + %38 = OpVariable %37 Output + %39 = OpConstant %18 0 + %40 = OpConstantComposite %36 %22 %39 %39 %22 + %42 = OpConstantComposite %36 %39 %39 %39 %39 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %19 Function + %15 = OpAccessChain %14 %12 %13 + %16 = OpLoad %6 %15 + %17 = OpShiftRightArithmetic %6 %9 %16 + OpStore %8 %17 + %23 = OpLoad %6 %8 + %25 = OpIEqual %24 %23 %9 + %28 = OpSelect %18 %25 %26 %27 + %29 = OpExtInst %18 %1 FClamp %21 %22 %28 + OpStore %20 %29 + %30 = OpLoad %18 %20 + %31 = OpConvertFToS %6 %30 + %33 = OpIEqual %24 %31 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %41 + %34 = OpLabel + OpStore %38 %40 + OpBranch %35 + %41 = OpLabel + OpStore %38 %42 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 STD140 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-blockfrequency-several-for-loops.amber b/vulkan/amber/graphicsfuzz/cov-blockfrequency-several-for-loops.amber new file mode 100644 index 0000000..1b2766c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-blockfrequency-several-for-loops.amber @@ -0,0 +1,310 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific block frequency info code path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 c = vec4(0, 0, 0, 1); +# int a = 0; +# +# do +# { +# do +# { +# // Executed only once with a = 0. +# c[a] = 1.0; +# +# for(int i1 = 0; i1 < 1; i1++) +# for(int i2 = 0; i2 < 1; i2++) +# for(int i3 = 0; i3 < 1; i3++) +# for(int i4 = 0; i4 < 1; i4++) +# for(int i5 = 0; i5 < 1; i5++) +# for(int i6 = 0; i6 < 1; i6++) +# for(int i7 = 0; i7 < 1; i7++) +# for(int i8 = 0; i8 < 17; i8++) +# a++; +# } +# while(gl_FragCoord.x < -1.0); +# } while(gl_FragCoord.y < -1.0); +# _GLF_color = c; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 129 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %114 %127 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "c" + OpName %15 "a" + OpName %28 "i1" + OpName %38 "i2" + OpName %46 "i3" + OpName %54 "i4" + OpName %62 "i5" + OpName %70 "i6" + OpName %78 "i7" + OpName %86 "i8" + OpName %114 "gl_FragCoord" + OpName %127 "_GLF_color" + OpDecorate %114 BuiltIn FragCoord + OpDecorate %127 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 0 + %11 = OpConstant %6 1 + %12 = OpConstantComposite %7 %10 %10 %10 %11 + %13 = OpTypeInt 32 1 + %14 = OpTypePointer Function %13 + %16 = OpConstant %13 0 + %26 = OpTypePointer Function %6 + %35 = OpConstant %13 1 + %36 = OpTypeBool + %93 = OpConstant %13 17 + %113 = OpTypePointer Input %7 + %114 = OpVariable %113 Input + %115 = OpTypeInt 32 0 + %116 = OpConstant %115 0 + %117 = OpTypePointer Input %6 + %120 = OpConstant %6 -1 + %122 = OpConstant %115 1 + %126 = OpTypePointer Output %7 + %127 = OpVariable %126 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %15 = OpVariable %14 Function + %28 = OpVariable %14 Function + %38 = OpVariable %14 Function + %46 = OpVariable %14 Function + %54 = OpVariable %14 Function + %62 = OpVariable %14 Function + %70 = OpVariable %14 Function + %78 = OpVariable %14 Function + %86 = OpVariable %14 Function + OpStore %9 %12 + OpStore %15 %16 + OpBranch %17 + %17 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %18 + %18 = OpLabel + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %22 + %22 = OpLabel + %25 = OpLoad %13 %15 + %27 = OpAccessChain %26 %9 %25 + OpStore %27 %11 + OpStore %28 %16 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %13 %28 + %37 = OpSLessThan %36 %34 %35 + OpBranchConditional %37 %30 %31 + %30 = OpLabel + OpStore %38 %16 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %13 %38 + %45 = OpSLessThan %36 %44 %35 + OpBranchConditional %45 %40 %41 + %40 = OpLabel + OpStore %46 %16 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %13 %46 + %53 = OpSLessThan %36 %52 %35 + OpBranchConditional %53 %48 %49 + %48 = OpLabel + OpStore %54 %16 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %13 %54 + %61 = OpSLessThan %36 %60 %35 + OpBranchConditional %61 %56 %57 + %56 = OpLabel + OpStore %62 %16 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %13 %62 + %69 = OpSLessThan %36 %68 %35 + OpBranchConditional %69 %64 %65 + %64 = OpLabel + OpStore %70 %16 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %13 %70 + %77 = OpSLessThan %36 %76 %35 + OpBranchConditional %77 %72 %73 + %72 = OpLabel + OpStore %78 %16 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %13 %78 + %85 = OpSLessThan %36 %84 %35 + OpBranchConditional %85 %80 %81 + %80 = OpLabel + OpStore %86 %16 + OpBranch %87 + %87 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %13 %86 + %94 = OpSLessThan %36 %92 %93 + OpBranchConditional %94 %88 %89 + %88 = OpLabel + %95 = OpLoad %13 %15 + %96 = OpIAdd %13 %95 %35 + OpStore %15 %96 + OpBranch %90 + %90 = OpLabel + %97 = OpLoad %13 %86 + %98 = OpIAdd %13 %97 %35 + OpStore %86 %98 + OpBranch %87 + %89 = OpLabel + OpBranch %82 + %82 = OpLabel + %99 = OpLoad %13 %78 + %100 = OpIAdd %13 %99 %35 + OpStore %78 %100 + OpBranch %79 + %81 = OpLabel + OpBranch %74 + %74 = OpLabel + %101 = OpLoad %13 %70 + %102 = OpIAdd %13 %101 %35 + OpStore %70 %102 + OpBranch %71 + %73 = OpLabel + OpBranch %66 + %66 = OpLabel + %103 = OpLoad %13 %62 + %104 = OpIAdd %13 %103 %35 + OpStore %62 %104 + OpBranch %63 + %65 = OpLabel + OpBranch %58 + %58 = OpLabel + %105 = OpLoad %13 %54 + %106 = OpIAdd %13 %105 %35 + OpStore %54 %106 + OpBranch %55 + %57 = OpLabel + OpBranch %50 + %50 = OpLabel + %107 = OpLoad %13 %46 + %108 = OpIAdd %13 %107 %35 + OpStore %46 %108 + OpBranch %47 + %49 = OpLabel + OpBranch %42 + %42 = OpLabel + %109 = OpLoad %13 %38 + %110 = OpIAdd %13 %109 %35 + OpStore %38 %110 + OpBranch %39 + %41 = OpLabel + OpBranch %32 + %32 = OpLabel + %111 = OpLoad %13 %28 + %112 = OpIAdd %13 %111 %35 + OpStore %28 %112 + OpBranch %29 + %31 = OpLabel + OpBranch %24 + %24 = OpLabel + %118 = OpAccessChain %117 %114 %116 + %119 = OpLoad %6 %118 + %121 = OpFOrdLessThan %36 %119 %120 + OpBranchConditional %121 %21 %23 + %23 = OpLabel + OpBranch %20 + %20 = OpLabel + %123 = OpAccessChain %117 %114 %122 + %124 = OpLoad %6 %123 + %125 = OpFOrdLessThan %36 %124 %120 + OpBranchConditional %125 %17 %19 + %19 = OpLabel + %128 = OpLoad %7 %9 + OpStore %127 %128 + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-branch-probability-identity-matrix.amber b/vulkan/amber/graphicsfuzz/cov-branch-probability-identity-matrix.amber new file mode 100644 index 0000000..e8b6d9b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-branch-probability-identity-matrix.amber @@ -0,0 +1,406 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific branch propability path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_2_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 2.0] +# layout(set = 0, binding = 0) uniform buf0 { +# float _GLF_uniform_float_values[3]; +# }; +# // Contents of _GLF_uniform_int_values: [2, 0, 1, 3] +# layout(set = 0, binding = 1) uniform buf1 { +# int _GLF_uniform_int_values[4]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float sums[2]; +# sums[_int_0] = - _float_1_0; +# sums[_int_1] = - _float_1_0; +# for(int a = _int_0; a < _int_2; a ++) +# { +# for(int b = _int_0; b < _int_3; b ++) +# { +# for(int c = _int_0; c <= a; c ++) +# { +# for(int d = _int_0; d < _int_3; d ++) +# { +# sums[a] = mat2(_int_1)[c][_int_1]; +# sums[a] += mat2(_int_1)[c][_int_1]; +# } +# } +# } +# } +# if(sums[_int_0] == _float_0_0 && sums[_int_1] == _float_2_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 175 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %156 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "sums" + OpName %15 "buf1" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %25 "buf0" + OpMemberName %25 0 "_GLF_uniform_float_values" + OpName %27 "" + OpName %42 "a" + OpName %55 "b" + OpName %68 "c" + OpName %79 "d" + OpName %106 "indexable" + OpName %120 "indexable" + OpName %156 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 RelaxedPrecision + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 1 + OpDecorate %22 RelaxedPrecision + OpDecorate %24 ArrayStride 16 + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 0 + OpDecorate %36 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %63 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %70 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %77 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %87 RelaxedPrecision + OpDecorate %89 RelaxedPrecision + OpDecorate %91 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %102 RelaxedPrecision + OpDecorate %104 RelaxedPrecision + OpDecorate %110 RelaxedPrecision + OpDecorate %112 RelaxedPrecision + OpDecorate %117 RelaxedPrecision + OpDecorate %119 RelaxedPrecision + OpDecorate %127 RelaxedPrecision + OpDecorate %128 RelaxedPrecision + OpDecorate %129 RelaxedPrecision + OpDecorate %130 RelaxedPrecision + OpDecorate %131 RelaxedPrecision + OpDecorate %132 RelaxedPrecision + OpDecorate %133 RelaxedPrecision + OpDecorate %134 RelaxedPrecision + OpDecorate %136 RelaxedPrecision + OpDecorate %145 RelaxedPrecision + OpDecorate %156 Location 0 + OpDecorate %158 RelaxedPrecision + OpDecorate %161 RelaxedPrecision + OpDecorate %164 RelaxedPrecision + OpDecorate %167 RelaxedPrecision + OpDecorate %172 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 2 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpTypeInt 32 1 + %13 = OpConstant %7 4 + %14 = OpTypeArray %12 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %12 0 + %19 = OpConstant %12 1 + %20 = OpTypePointer Uniform %12 + %23 = OpConstant %7 3 + %24 = OpTypeArray %6 %23 + %25 = OpTypeStruct %24 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypePointer Uniform %6 + %32 = OpTypePointer Function %6 + %34 = OpConstant %12 2 + %41 = OpTypePointer Function %12 + %53 = OpTypeBool + %64 = OpConstant %12 3 + %95 = OpTypeVector %6 2 + %96 = OpTypeMatrix %95 2 + %97 = OpConstant %6 1 + %98 = OpConstant %6 0 + %105 = OpTypePointer Function %96 + %154 = OpTypeVector %6 4 + %155 = OpTypePointer Output %154 + %156 = OpVariable %155 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %42 = OpVariable %41 Function + %55 = OpVariable %41 Function + %68 = OpVariable %41 Function + %79 = OpVariable %41 Function + %106 = OpVariable %105 Function + %120 = OpVariable %105 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %12 %21 + %29 = OpAccessChain %28 %27 %18 %18 + %30 = OpLoad %6 %29 + %31 = OpFNegate %6 %30 + %33 = OpAccessChain %32 %11 %22 + OpStore %33 %31 + %35 = OpAccessChain %20 %17 %18 %34 + %36 = OpLoad %12 %35 + %37 = OpAccessChain %28 %27 %18 %18 + %38 = OpLoad %6 %37 + %39 = OpFNegate %6 %38 + %40 = OpAccessChain %32 %11 %36 + OpStore %40 %39 + %43 = OpAccessChain %20 %17 %18 %19 + %44 = OpLoad %12 %43 + OpStore %42 %44 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %49 + %49 = OpLabel + %50 = OpLoad %12 %42 + %51 = OpAccessChain %20 %17 %18 %18 + %52 = OpLoad %12 %51 + %54 = OpSLessThan %53 %50 %52 + OpBranchConditional %54 %46 %47 + %46 = OpLabel + %56 = OpAccessChain %20 %17 %18 %19 + %57 = OpLoad %12 %56 + OpStore %55 %57 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %12 %55 + %65 = OpAccessChain %20 %17 %18 %64 + %66 = OpLoad %12 %65 + %67 = OpSLessThan %53 %63 %66 + OpBranchConditional %67 %59 %60 + %59 = OpLabel + %69 = OpAccessChain %20 %17 %18 %19 + %70 = OpLoad %12 %69 + OpStore %68 %70 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %12 %68 + %77 = OpLoad %12 %42 + %78 = OpSLessThanEqual %53 %76 %77 + OpBranchConditional %78 %72 %73 + %72 = OpLabel + %80 = OpAccessChain %20 %17 %18 %19 + %81 = OpLoad %12 %80 + OpStore %79 %81 + OpBranch %82 + %82 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + %87 = OpLoad %12 %79 + %88 = OpAccessChain %20 %17 %18 %64 + %89 = OpLoad %12 %88 + %90 = OpSLessThan %53 %87 %89 + OpBranchConditional %90 %83 %84 + %83 = OpLabel + %91 = OpLoad %12 %42 + %92 = OpAccessChain %20 %17 %18 %34 + %93 = OpLoad %12 %92 + %94 = OpConvertSToF %6 %93 + %99 = OpCompositeConstruct %95 %94 %98 + %100 = OpCompositeConstruct %95 %98 %94 + %101 = OpCompositeConstruct %96 %99 %100 + %102 = OpLoad %12 %68 + %103 = OpAccessChain %20 %17 %18 %34 + %104 = OpLoad %12 %103 + OpStore %106 %101 + %107 = OpAccessChain %32 %106 %102 %104 + %108 = OpLoad %6 %107 + %109 = OpAccessChain %32 %11 %91 + OpStore %109 %108 + %110 = OpLoad %12 %42 + %111 = OpAccessChain %20 %17 %18 %34 + %112 = OpLoad %12 %111 + %113 = OpConvertSToF %6 %112 + %114 = OpCompositeConstruct %95 %113 %98 + %115 = OpCompositeConstruct %95 %98 %113 + %116 = OpCompositeConstruct %96 %114 %115 + %117 = OpLoad %12 %68 + %118 = OpAccessChain %20 %17 %18 %34 + %119 = OpLoad %12 %118 + OpStore %120 %116 + %121 = OpAccessChain %32 %120 %117 %119 + %122 = OpLoad %6 %121 + %123 = OpAccessChain %32 %11 %110 + %124 = OpLoad %6 %123 + %125 = OpFAdd %6 %124 %122 + %126 = OpAccessChain %32 %11 %110 + OpStore %126 %125 + OpBranch %85 + %85 = OpLabel + %127 = OpLoad %12 %79 + %128 = OpIAdd %12 %127 %19 + OpStore %79 %128 + OpBranch %82 + %84 = OpLabel + OpBranch %74 + %74 = OpLabel + %129 = OpLoad %12 %68 + %130 = OpIAdd %12 %129 %19 + OpStore %68 %130 + OpBranch %71 + %73 = OpLabel + OpBranch %61 + %61 = OpLabel + %131 = OpLoad %12 %55 + %132 = OpIAdd %12 %131 %19 + OpStore %55 %132 + OpBranch %58 + %60 = OpLabel + OpBranch %48 + %48 = OpLabel + %133 = OpLoad %12 %42 + %134 = OpIAdd %12 %133 %19 + OpStore %42 %134 + OpBranch %45 + %47 = OpLabel + %135 = OpAccessChain %20 %17 %18 %19 + %136 = OpLoad %12 %135 + %137 = OpAccessChain %32 %11 %136 + %138 = OpLoad %6 %137 + %139 = OpAccessChain %28 %27 %18 %19 + %140 = OpLoad %6 %139 + %141 = OpFOrdEqual %53 %138 %140 + OpSelectionMerge %143 None + OpBranchConditional %141 %142 %143 + %142 = OpLabel + %144 = OpAccessChain %20 %17 %18 %34 + %145 = OpLoad %12 %144 + %146 = OpAccessChain %32 %11 %145 + %147 = OpLoad %6 %146 + %148 = OpAccessChain %28 %27 %18 %34 + %149 = OpLoad %6 %148 + %150 = OpFOrdEqual %53 %147 %149 + OpBranch %143 + %143 = OpLabel + %151 = OpPhi %53 %141 %47 %150 %142 + OpSelectionMerge %153 None + OpBranchConditional %151 %152 %170 + %152 = OpLabel + %157 = OpAccessChain %20 %17 %18 %34 + %158 = OpLoad %12 %157 + %159 = OpConvertSToF %6 %158 + %160 = OpAccessChain %20 %17 %18 %19 + %161 = OpLoad %12 %160 + %162 = OpConvertSToF %6 %161 + %163 = OpAccessChain %20 %17 %18 %19 + %164 = OpLoad %12 %163 + %165 = OpConvertSToF %6 %164 + %166 = OpAccessChain %20 %17 %18 %34 + %167 = OpLoad %12 %166 + %168 = OpConvertSToF %6 %167 + %169 = OpCompositeConstruct %154 %159 %162 %165 %168 + OpStore %156 %169 + OpBranch %153 + %170 = OpLabel + %171 = OpAccessChain %20 %17 %18 %19 + %172 = OpLoad %12 %171 + %173 = OpConvertSToF %6 %172 + %174 = OpCompositeConstruct %154 %173 %173 %173 %173 + OpStore %156 %174 + OpBranch %153 + %153 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 0 1 3 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 2.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-cast-float-to-int-and-back.amber b/vulkan/amber/graphicsfuzz/cov-cast-float-to-int-and-back.amber new file mode 100644 index 0000000..7108c13 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-cast-float-to-int-and-back.amber @@ -0,0 +1,157 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = 142.7; +# +# if(float(int(f)) > 100.0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %21 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %21 "_GLF_color" + OpName %25 "buf0" + OpMemberName %25 0 "_GLF_uniform_int_values" + OpName %27 "" + OpDecorate %21 Location 0 + OpDecorate %24 ArrayStride 16 + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 142.699997 + %11 = OpTypeInt 32 1 + %14 = OpConstant %6 100 + %15 = OpTypeBool + %19 = OpTypeVector %6 4 + %20 = OpTypePointer Output %19 + %21 = OpVariable %20 Output + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 2 + %24 = OpTypeArray %11 %23 + %25 = OpTypeStruct %24 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpConstant %11 0 + %29 = OpConstant %11 1 + %30 = OpTypePointer Uniform %11 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %10 = OpLoad %6 %8 + %12 = OpConvertFToS %11 %10 + %13 = OpConvertSToF %6 %12 + %16 = OpFOrdGreaterThan %15 %13 %14 + OpSelectionMerge %18 None + OpBranchConditional %16 %17 %44 + %17 = OpLabel + %31 = OpAccessChain %30 %27 %28 %29 + %32 = OpLoad %11 %31 + %33 = OpConvertSToF %6 %32 + %34 = OpAccessChain %30 %27 %28 %28 + %35 = OpLoad %11 %34 + %36 = OpConvertSToF %6 %35 + %37 = OpAccessChain %30 %27 %28 %28 + %38 = OpLoad %11 %37 + %39 = OpConvertSToF %6 %38 + %40 = OpAccessChain %30 %27 %28 %29 + %41 = OpLoad %11 %40 + %42 = OpConvertSToF %6 %41 + %43 = OpCompositeConstruct %19 %33 %36 %39 %42 + OpStore %21 %43 + OpBranch %18 + %44 = OpLabel + %45 = OpAccessChain %30 %27 %28 %28 + %46 = OpLoad %11 %45 + %47 = OpConvertSToF %6 %46 + %48 = OpCompositeConstruct %19 %47 %47 %47 %47 + OpStore %21 %48 + OpBranch %18 + %18 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-clamp-loop-limit-increment-float-array.amber b/vulkan/amber/graphicsfuzz/cov-clamp-loop-limit-increment-float-array.amber new file mode 100644 index 0000000..18e0956 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-clamp-loop-limit-increment-float-array.amber @@ -0,0 +1,253 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_2_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 2.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float sums[3] = float[3](_float_1_0, _float_1_0, _float_1_0); +# +# for(int i = 0; i < clamp(_int_1, _int_1, 2); i ++) +# { +# // Increments by one. +# sums[_int_2] += mat2x4(_float_1_0)[i][_int_0]; +# } +# +# // Always true. +# if(sums[_int_2] == _float_2_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 103 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %84 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "sums" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %28 "i" + OpName %36 "buf1" + OpMemberName %36 0 "_GLF_uniform_int_values" + OpName %38 "" + OpName %64 "indexable" + OpName %84 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %35 ArrayStride 16 + OpMemberDecorate %36 0 Offset 0 + OpDecorate %36 Block + OpDecorate %38 DescriptorSet 0 + OpDecorate %38 Binding 1 + OpDecorate %84 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 3 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 2 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %27 = OpTypePointer Function %17 + %35 = OpTypeArray %17 %8 + %36 = OpTypeStruct %35 + %37 = OpTypePointer Uniform %36 + %38 = OpVariable %37 Uniform + %39 = OpTypePointer Uniform %17 + %44 = OpConstant %17 2 + %46 = OpTypeBool + %52 = OpTypeVector %6 4 + %53 = OpTypeMatrix %52 2 + %54 = OpConstant %6 1 + %55 = OpConstant %6 0 + %60 = OpConstant %17 1 + %63 = OpTypePointer Function %53 + %65 = OpTypePointer Function %6 + %83 = OpTypePointer Output %52 + %84 = OpVariable %83 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %28 = OpVariable %27 Function + %64 = OpVariable %63 Function + %20 = OpAccessChain %19 %16 %18 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %16 %18 %18 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %19 %16 %18 %18 + %25 = OpLoad %6 %24 + %26 = OpCompositeConstruct %9 %21 %23 %25 + OpStore %11 %26 + OpStore %28 %18 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %17 %28 + %40 = OpAccessChain %39 %38 %18 %18 + %41 = OpLoad %17 %40 + %42 = OpAccessChain %39 %38 %18 %18 + %43 = OpLoad %17 %42 + %45 = OpExtInst %17 %1 SClamp %41 %43 %44 + %47 = OpSLessThan %46 %34 %45 + OpBranchConditional %47 %30 %31 + %30 = OpLabel + %48 = OpAccessChain %39 %38 %18 %44 + %49 = OpLoad %17 %48 + %50 = OpAccessChain %19 %16 %18 %18 + %51 = OpLoad %6 %50 + %56 = OpCompositeConstruct %52 %51 %55 %55 %55 + %57 = OpCompositeConstruct %52 %55 %51 %55 %55 + %58 = OpCompositeConstruct %53 %56 %57 + %59 = OpLoad %17 %28 + %61 = OpAccessChain %39 %38 %18 %60 + %62 = OpLoad %17 %61 + OpStore %64 %58 + %66 = OpAccessChain %65 %64 %59 %62 + %67 = OpLoad %6 %66 + %68 = OpAccessChain %65 %11 %49 + %69 = OpLoad %6 %68 + %70 = OpFAdd %6 %69 %67 + %71 = OpAccessChain %65 %11 %49 + OpStore %71 %70 + OpBranch %32 + %32 = OpLabel + %72 = OpLoad %17 %28 + %73 = OpIAdd %17 %72 %60 + OpStore %28 %73 + OpBranch %29 + %31 = OpLabel + %74 = OpAccessChain %39 %38 %18 %44 + %75 = OpLoad %17 %74 + %76 = OpAccessChain %65 %11 %75 + %77 = OpLoad %6 %76 + %78 = OpAccessChain %19 %16 %18 %60 + %79 = OpLoad %6 %78 + %80 = OpFOrdEqual %46 %77 %79 + OpSelectionMerge %82 None + OpBranchConditional %80 %81 %98 + %81 = OpLabel + %85 = OpAccessChain %39 %38 %18 %18 + %86 = OpLoad %17 %85 + %87 = OpConvertSToF %6 %86 + %88 = OpAccessChain %39 %38 %18 %60 + %89 = OpLoad %17 %88 + %90 = OpConvertSToF %6 %89 + %91 = OpAccessChain %39 %38 %18 %60 + %92 = OpLoad %17 %91 + %93 = OpConvertSToF %6 %92 + %94 = OpAccessChain %39 %38 %18 %18 + %95 = OpLoad %17 %94 + %96 = OpConvertSToF %6 %95 + %97 = OpCompositeConstruct %52 %87 %90 %93 %96 + OpStore %84 %97 + OpBranch %82 + %98 = OpLabel + %99 = OpAccessChain %39 %38 %18 %60 + %100 = OpLoad %17 %99 + %101 = OpConvertSToF %6 %100 + %102 = OpCompositeConstruct %52 %101 %101 %101 %101 + OpStore %84 %102 + OpBranch %82 + %82 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 2.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-clamp-lower-limit-from-always-false.amber b/vulkan/amber/graphicsfuzz/cov-clamp-lower-limit-from-always-false.amber new file mode 100644 index 0000000..33ff020 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-clamp-lower-limit-from-always-false.amber @@ -0,0 +1,196 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_4_0 _GLF_uniform_float_values[0] +# #define _float_0_25 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [4.0, 0.25] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = 1.0; +# float b = clamp(_float_0_25, false ? a : 0.0, 1.0); +# +# // Always true. +# if(b == _float_0_25) +# { +# _GLF_color = vec4(b * _float_4_0, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 62 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %37 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %10 "b" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %37 "_GLF_color" + OpName %43 "buf0" + OpMemberName %43 0 "_GLF_uniform_int_values" + OpName %45 "" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %37 Location 0 + OpDecorate %42 ArrayStride 16 + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpConstant %17 1 + %20 = OpTypePointer Uniform %6 + %23 = OpTypeBool + %24 = OpConstantFalse %23 + %26 = OpConstant %6 0 + %35 = OpTypeVector %6 4 + %36 = OpTypePointer Output %35 + %37 = OpVariable %36 Output + %42 = OpTypeArray %17 %12 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %46 = OpTypePointer Uniform %17 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + %21 = OpAccessChain %20 %16 %18 %19 + %22 = OpLoad %6 %21 + %25 = OpLoad %6 %8 + %27 = OpSelect %6 %24 %25 %26 + %28 = OpExtInst %6 %1 FClamp %22 %27 %9 + OpStore %10 %28 + %29 = OpLoad %6 %10 + %30 = OpAccessChain %20 %16 %18 %19 + %31 = OpLoad %6 %30 + %32 = OpFOrdEqual %23 %29 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %57 + %33 = OpLabel + %38 = OpLoad %6 %10 + %39 = OpAccessChain %20 %16 %18 %18 + %40 = OpLoad %6 %39 + %41 = OpFMul %6 %38 %40 + %47 = OpAccessChain %46 %45 %18 %18 + %48 = OpLoad %17 %47 + %49 = OpConvertSToF %6 %48 + %50 = OpAccessChain %46 %45 %18 %18 + %51 = OpLoad %17 %50 + %52 = OpConvertSToF %6 %51 + %53 = OpAccessChain %46 %45 %18 %19 + %54 = OpLoad %17 %53 + %55 = OpConvertSToF %6 %54 + %56 = OpCompositeConstruct %35 %41 %49 %52 %55 + OpStore %37 %56 + OpBranch %34 + %57 = OpLabel + %58 = OpAccessChain %46 %45 %18 %18 + %59 = OpLoad %17 %58 + %60 = OpConvertSToF %6 %59 + %61 = OpCompositeConstruct %35 %60 %60 %60 %60 + OpStore %37 %61 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 4.0 0.25 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-clamp-min-bitcount-uniform.amber b/vulkan/amber/graphicsfuzz/cov-clamp-min-bitcount-uniform.amber new file mode 100644 index 0000000..3c74967 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-clamp-min-bitcount-uniform.amber @@ -0,0 +1,222 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_2_0 _GLF_uniform_float_values[0] +# #define _float_5_0 _GLF_uniform_float_values[1] +# #define _float_0_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [2.0, 5.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# // Contents of three: 3 +# layout(set = 0, binding = 2) uniform buf2 +# { +# int three; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // f = clamp(5.0, 0.0, min(bitcount(3), bitcount(3))) = clamp(5.0, 0.0, 2.0) = 2.0 +# float f = clamp(_float_5_0, _float_0_0, float(min(bitCount(three), bitCount(three)))); +# +# // Always true. +# if(f == _float_2_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 70 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %24 "buf2" + OpMemberName %24 0 "three" + OpName %26 "" + OpName %46 "_GLF_color" + OpName %49 "buf0" + OpMemberName %49 0 "_GLF_uniform_int_values" + OpName %51 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 2 + OpDecorate %34 RelaxedPrecision + OpDecorate %46 Location 0 + OpDecorate %48 ArrayStride 16 + OpMemberDecorate %49 0 Offset 0 + OpDecorate %49 Block + OpDecorate %51 DescriptorSet 0 + OpDecorate %51 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 1 + %18 = OpTypePointer Uniform %6 + %21 = OpConstant %15 2 + %24 = OpTypeStruct %15 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpTypePointer Uniform %15 + %40 = OpTypeBool + %44 = OpTypeVector %6 4 + %45 = OpTypePointer Output %44 + %46 = OpVariable %45 Output + %47 = OpConstant %9 2 + %48 = OpTypeArray %15 %47 + %49 = OpTypeStruct %48 + %50 = OpTypePointer Uniform %49 + %51 = OpVariable %50 Uniform + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %6 %19 + %22 = OpAccessChain %18 %14 %16 %21 + %23 = OpLoad %6 %22 + %28 = OpAccessChain %27 %26 %16 + %29 = OpLoad %15 %28 + %30 = OpBitCount %15 %29 + %31 = OpAccessChain %27 %26 %16 + %32 = OpLoad %15 %31 + %33 = OpBitCount %15 %32 + %34 = OpExtInst %15 %1 SMin %30 %33 + %35 = OpConvertSToF %6 %34 + %36 = OpExtInst %6 %1 FClamp %20 %23 %35 + OpStore %8 %36 + %37 = OpLoad %6 %8 + %38 = OpAccessChain %18 %14 %16 %16 + %39 = OpLoad %6 %38 + %41 = OpFOrdEqual %40 %37 %39 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %65 + %42 = OpLabel + %52 = OpAccessChain %27 %51 %16 %16 + %53 = OpLoad %15 %52 + %54 = OpConvertSToF %6 %53 + %55 = OpAccessChain %27 %51 %16 %17 + %56 = OpLoad %15 %55 + %57 = OpConvertSToF %6 %56 + %58 = OpAccessChain %27 %51 %16 %17 + %59 = OpLoad %15 %58 + %60 = OpConvertSToF %6 %59 + %61 = OpAccessChain %27 %51 %16 %16 + %62 = OpLoad %15 %61 + %63 = OpConvertSToF %6 %62 + %64 = OpCompositeConstruct %44 %54 %57 %60 %63 + OpStore %46 %64 + OpBranch %43 + %65 = OpLabel + %66 = OpAccessChain %27 %51 %16 %17 + %67 = OpLoad %15 %66 + %68 = OpConvertSToF %6 %67 + %69 = OpCompositeConstruct %44 %68 %68 %68 %68 + OpStore %46 %69 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# three +BUFFER variant_three DATA_TYPE int32 STD140 DATA + 3 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 5.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_three AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-clamp-value-and-min-select-uniform.amber b/vulkan/amber/graphicsfuzz/cov-clamp-value-and-min-select-uniform.amber new file mode 100644 index 0000000..3029a1d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-clamp-value-and-min-select-uniform.amber @@ -0,0 +1,206 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of resolution: 32.0 +# layout(push_constant) uniform buf_push +# { +# float resolution; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always true. Simplifies to clamp(0, 0, 1) < 1 -> 0 < 1. +# if(clamp(resolution < _float_1_0 ? 1 : 0, resolution < _float_1_0 ? 1 : 0, 1) < 1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 65 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %40 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "buf_push" + OpMemberName %7 0 "resolution" + OpName %9 "" + OpName %18 "buf0" + OpMemberName %18 0 "_GLF_uniform_float_values" + OpName %20 "" + OpName %40 "_GLF_color" + OpName %43 "buf1" + OpMemberName %43 0 "_GLF_uniform_int_values" + OpName %45 "" + OpMemberDecorate %7 0 Offset 0 + OpDecorate %7 Block + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %40 Location 0 + OpDecorate %42 ArrayStride 16 + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeStruct %6 + %8 = OpTypePointer PushConstant %7 + %9 = OpVariable %8 PushConstant + %10 = OpTypeInt 32 1 + %11 = OpConstant %10 0 + %12 = OpTypePointer PushConstant %6 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 1 + %17 = OpTypeArray %6 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypePointer Uniform %6 + %24 = OpTypeBool + %26 = OpConstant %10 1 + %38 = OpTypeVector %6 4 + %39 = OpTypePointer Output %38 + %40 = OpVariable %39 Output + %41 = OpConstant %15 2 + %42 = OpTypeArray %10 %41 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %46 = OpTypePointer Uniform %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %13 = OpAccessChain %12 %9 %11 + %14 = OpLoad %6 %13 + %22 = OpAccessChain %21 %20 %11 %11 + %23 = OpLoad %6 %22 + %25 = OpFOrdLessThan %24 %14 %23 + %27 = OpSelect %10 %25 %26 %11 + %28 = OpAccessChain %12 %9 %11 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %21 %20 %11 %11 + %31 = OpLoad %6 %30 + %32 = OpFOrdLessThan %24 %29 %31 + %33 = OpSelect %10 %32 %26 %11 + %34 = OpExtInst %10 %1 SClamp %27 %33 %26 + %35 = OpSLessThan %24 %34 %26 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %60 + %36 = OpLabel + %47 = OpAccessChain %46 %45 %11 %11 + %48 = OpLoad %10 %47 + %49 = OpConvertSToF %6 %48 + %50 = OpAccessChain %46 %45 %11 %26 + %51 = OpLoad %10 %50 + %52 = OpConvertSToF %6 %51 + %53 = OpAccessChain %46 %45 %11 %26 + %54 = OpLoad %10 %53 + %55 = OpConvertSToF %6 %54 + %56 = OpAccessChain %46 %45 %11 %11 + %57 = OpLoad %10 %56 + %58 = OpConvertSToF %6 %57 + %59 = OpCompositeConstruct %38 %49 %52 %55 %58 + OpStore %40 %59 + OpBranch %37 + %60 = OpLabel + %61 = OpAccessChain %46 %45 %11 %26 + %62 = OpLoad %10 %61 + %63 = OpConvertSToF %6 %62 + %64 = OpCompositeConstruct %38 %63 %63 %63 %63 + OpStore %40 %64 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE float STD140 DATA + 32.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix.amber b/vulkan/amber/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix.amber new file mode 100644 index 0000000..3982374 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix.amber @@ -0,0 +1,294 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific patch optimization code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_4 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# #define _int_0 _GLF_uniform_int_values[4] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# // Contents of _GLF_uniform_int_values: [4, 1, 2, 3, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[5]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v = vec4(_int_1, _int_2, _int_3, _int_4); +# +# // Clamps v.y, v.z, and v.z to a range of 0..1. +# // After the loop all the components of v has a value of one. +# for (int i = _int_0; i < _int_4; i++) +# { +# if(mat4(v, v, v, v)[0][i] > _float_1_0) +# { +# v[i] = clamp(v, vec4(_float_0_0), vec4(_float_1_0))[_int_1]; +# } +# } +# +# // Always true. +# if(v == vec4(_int_1)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 138 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %119 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %36 "i" + OpName %83 "buf0" + OpMemberName %83 0 "_GLF_uniform_float_values" + OpName %85 "" + OpName %119 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %82 ArrayStride 16 + OpMemberDecorate %83 0 Offset 0 + OpDecorate %83 Block + OpDecorate %85 DescriptorSet 0 + OpDecorate %85 Binding 0 + OpDecorate %119 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 5 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpConstant %10 1 + %19 = OpTypePointer Uniform %10 + %23 = OpConstant %10 2 + %27 = OpConstant %10 3 + %35 = OpTypePointer Function %10 + %37 = OpConstant %10 4 + %48 = OpTypeBool + %54 = OpTypeMatrix %7 4 + %55 = OpConstant %6 1 + %56 = OpConstant %6 0 + %81 = OpConstant %11 2 + %82 = OpTypeArray %6 %81 + %83 = OpTypeStruct %82 + %84 = OpTypePointer Uniform %83 + %85 = OpVariable %84 Uniform + %86 = OpTypePointer Uniform %6 + %104 = OpTypePointer Function %6 + %113 = OpTypeVector %48 4 + %118 = OpTypePointer Output %7 + %119 = OpVariable %118 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %36 = OpVariable %35 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %10 %20 + %22 = OpConvertSToF %6 %21 + %24 = OpAccessChain %19 %16 %17 %23 + %25 = OpLoad %10 %24 + %26 = OpConvertSToF %6 %25 + %28 = OpAccessChain %19 %16 %17 %27 + %29 = OpLoad %10 %28 + %30 = OpConvertSToF %6 %29 + %31 = OpAccessChain %19 %16 %17 %17 + %32 = OpLoad %10 %31 + %33 = OpConvertSToF %6 %32 + %34 = OpCompositeConstruct %7 %22 %26 %30 %33 + OpStore %9 %34 + %38 = OpAccessChain %19 %16 %17 %37 + %39 = OpLoad %10 %38 + OpStore %36 %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %10 %36 + %46 = OpAccessChain %19 %16 %17 %17 + %47 = OpLoad %10 %46 + %49 = OpSLessThan %48 %45 %47 + OpBranchConditional %49 %41 %42 + %41 = OpLabel + %50 = OpLoad %7 %9 + %51 = OpLoad %7 %9 + %52 = OpLoad %7 %9 + %53 = OpLoad %7 %9 + %57 = OpCompositeExtract %6 %50 0 + %58 = OpCompositeExtract %6 %50 1 + %59 = OpCompositeExtract %6 %50 2 + %60 = OpCompositeExtract %6 %50 3 + %61 = OpCompositeExtract %6 %51 0 + %62 = OpCompositeExtract %6 %51 1 + %63 = OpCompositeExtract %6 %51 2 + %64 = OpCompositeExtract %6 %51 3 + %65 = OpCompositeExtract %6 %52 0 + %66 = OpCompositeExtract %6 %52 1 + %67 = OpCompositeExtract %6 %52 2 + %68 = OpCompositeExtract %6 %52 3 + %69 = OpCompositeExtract %6 %53 0 + %70 = OpCompositeExtract %6 %53 1 + %71 = OpCompositeExtract %6 %53 2 + %72 = OpCompositeExtract %6 %53 3 + %73 = OpCompositeConstruct %7 %57 %58 %59 %60 + %74 = OpCompositeConstruct %7 %61 %62 %63 %64 + %75 = OpCompositeConstruct %7 %65 %66 %67 %68 + %76 = OpCompositeConstruct %7 %69 %70 %71 %72 + %77 = OpCompositeConstruct %54 %73 %74 %75 %76 + %78 = OpLoad %10 %36 + %79 = OpCompositeExtract %7 %77 0 + %80 = OpVectorExtractDynamic %6 %79 %78 + %87 = OpAccessChain %86 %85 %17 %17 + %88 = OpLoad %6 %87 + %89 = OpFOrdGreaterThan %48 %80 %88 + OpSelectionMerge %91 None + OpBranchConditional %89 %90 %91 + %90 = OpLabel + %92 = OpLoad %10 %36 + %93 = OpLoad %7 %9 + %94 = OpAccessChain %86 %85 %17 %18 + %95 = OpLoad %6 %94 + %96 = OpCompositeConstruct %7 %95 %95 %95 %95 + %97 = OpAccessChain %86 %85 %17 %17 + %98 = OpLoad %6 %97 + %99 = OpCompositeConstruct %7 %98 %98 %98 %98 + %100 = OpExtInst %7 %1 FClamp %93 %96 %99 + %101 = OpAccessChain %19 %16 %17 %18 + %102 = OpLoad %10 %101 + %103 = OpVectorExtractDynamic %6 %100 %102 + %105 = OpAccessChain %104 %9 %92 + OpStore %105 %103 + OpBranch %91 + %91 = OpLabel + OpBranch %43 + %43 = OpLabel + %106 = OpLoad %10 %36 + %107 = OpIAdd %10 %106 %18 + OpStore %36 %107 + OpBranch %40 + %42 = OpLabel + %108 = OpLoad %7 %9 + %109 = OpAccessChain %19 %16 %17 %18 + %110 = OpLoad %10 %109 + %111 = OpConvertSToF %6 %110 + %112 = OpCompositeConstruct %7 %111 %111 %111 %111 + %114 = OpFOrdEqual %113 %108 %112 + %115 = OpAll %48 %114 + OpSelectionMerge %117 None + OpBranchConditional %115 %116 %133 + %116 = OpLabel + %120 = OpAccessChain %19 %16 %17 %18 + %121 = OpLoad %10 %120 + %122 = OpConvertSToF %6 %121 + %123 = OpAccessChain %19 %16 %17 %37 + %124 = OpLoad %10 %123 + %125 = OpConvertSToF %6 %124 + %126 = OpAccessChain %19 %16 %17 %37 + %127 = OpLoad %10 %126 + %128 = OpConvertSToF %6 %127 + %129 = OpAccessChain %19 %16 %17 %18 + %130 = OpLoad %10 %129 + %131 = OpConvertSToF %6 %130 + %132 = OpCompositeConstruct %7 %122 %125 %128 %131 + OpStore %119 %132 + OpBranch %117 + %133 = OpLabel + %134 = OpAccessChain %19 %16 %17 %37 + %135 = OpLoad %10 %134 + %136 = OpConvertSToF %6 %135 + %137 = OpCompositeConstruct %7 %136 %136 %136 %136 + OpStore %119 %137 + OpBranch %117 + %117 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 4 1 2 3 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-clamp-vector-element-ceil-negative.amber b/vulkan/amber/graphicsfuzz/cov-clamp-vector-element-ceil-negative.amber new file mode 100644 index 0000000..4f7b5aa --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-clamp-vector-element-ceil-negative.amber @@ -0,0 +1,202 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_100_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# // Contents of _GLF_uniform_float_values: [100.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 v0 = vec2(_float_1_0, -580.015); +# vec2 v1 = clamp(ceil(v0), vec2(-_float_100_0), vec2(100.0)); +# +# if(v1.y == -_float_100_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v0" + OpName %13 "buf1" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %24 "v1" + OpName %47 "_GLF_color" + OpName %49 "buf0" + OpMemberName %49 0 "_GLF_uniform_int_values" + OpName %51 "" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %47 Location 0 + OpDecorate %48 ArrayStride 16 + OpMemberDecorate %49 0 Offset 0 + OpDecorate %49 Block + OpDecorate %51 DescriptorSet 0 + OpDecorate %51 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpConstant %16 1 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 -580.015015 + %31 = OpConstant %6 100 + %32 = OpConstantComposite %7 %31 %31 + %34 = OpConstant %10 1 + %35 = OpTypePointer Function %6 + %41 = OpTypeBool + %45 = OpTypeVector %6 4 + %46 = OpTypePointer Output %45 + %47 = OpVariable %46 Output + %48 = OpTypeArray %16 %11 + %49 = OpTypeStruct %48 + %50 = OpTypePointer Uniform %49 + %51 = OpVariable %50 Uniform + %52 = OpTypePointer Uniform %16 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %24 = OpVariable %8 Function + %20 = OpAccessChain %19 %15 %17 %18 + %21 = OpLoad %6 %20 + %23 = OpCompositeConstruct %7 %21 %22 + OpStore %9 %23 + %25 = OpLoad %7 %9 + %26 = OpExtInst %7 %1 Ceil %25 + %27 = OpAccessChain %19 %15 %17 %17 + %28 = OpLoad %6 %27 + %29 = OpFNegate %6 %28 + %30 = OpCompositeConstruct %7 %29 %29 + %33 = OpExtInst %7 %1 FClamp %26 %30 %32 + OpStore %24 %33 + %36 = OpAccessChain %35 %24 %34 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %19 %15 %17 %17 + %39 = OpLoad %6 %38 + %40 = OpFNegate %6 %39 + %42 = OpFOrdEqual %41 %37 %40 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %66 + %43 = OpLabel + %53 = OpAccessChain %52 %51 %17 %17 + %54 = OpLoad %16 %53 + %55 = OpConvertSToF %6 %54 + %56 = OpAccessChain %52 %51 %17 %18 + %57 = OpLoad %16 %56 + %58 = OpConvertSToF %6 %57 + %59 = OpAccessChain %52 %51 %17 %18 + %60 = OpLoad %16 %59 + %61 = OpConvertSToF %6 %60 + %62 = OpAccessChain %52 %51 %17 %17 + %63 = OpLoad %16 %62 + %64 = OpConvertSToF %6 %63 + %65 = OpCompositeConstruct %45 %55 %58 %61 %64 + OpStore %47 %65 + OpBranch %44 + %66 = OpLabel + %67 = OpAccessChain %52 %51 %17 %18 + %68 = OpLoad %16 %67 + %69 = OpConvertSToF %6 %68 + %70 = OpCompositeConstruct %45 %69 %69 %69 %69 + OpStore %47 %70 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 100.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-clamp-vector-variable-negative-offset.amber b/vulkan/amber/graphicsfuzz/cov-clamp-vector-variable-negative-offset.amber new file mode 100644 index 0000000..9cc7225 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-clamp-vector-variable-negative-offset.amber @@ -0,0 +1,209 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_2_0 _GLF_uniform_float_values[1] +# #define _float_1_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 2.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 v0 = vec2(_float_1_0, 3.8); +# vec2 v1 = clamp(v0 - 1.0, 0.0, _float_2_0); +# +# if (v1 == vec2(_float_0_0, _float_2_0)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %50 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v0" + OpName %13 "buf1" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %24 "v1" + OpName %50 "_GLF_color" + OpName %53 "buf0" + OpMemberName %53 0 "_GLF_uniform_int_values" + OpName %55 "" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %50 Location 0 + OpDecorate %52 ArrayStride 16 + OpMemberDecorate %53 0 Offset 0 + OpDecorate %53 Block + OpDecorate %55 DescriptorSet 0 + OpDecorate %55 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 3 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpConstant %16 2 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 3.79999995 + %26 = OpConstant %6 1 + %29 = OpConstant %6 0 + %30 = OpConstant %16 1 + %42 = OpTypeBool + %43 = OpTypeVector %42 2 + %48 = OpTypeVector %6 4 + %49 = OpTypePointer Output %48 + %50 = OpVariable %49 Output + %51 = OpConstant %10 2 + %52 = OpTypeArray %16 %51 + %53 = OpTypeStruct %52 + %54 = OpTypePointer Uniform %53 + %55 = OpVariable %54 Uniform + %56 = OpTypePointer Uniform %16 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %24 = OpVariable %8 Function + %20 = OpAccessChain %19 %15 %17 %18 + %21 = OpLoad %6 %20 + %23 = OpCompositeConstruct %7 %21 %22 + OpStore %9 %23 + %25 = OpLoad %7 %9 + %27 = OpCompositeConstruct %7 %26 %26 + %28 = OpFSub %7 %25 %27 + %31 = OpAccessChain %19 %15 %17 %30 + %32 = OpLoad %6 %31 + %33 = OpCompositeConstruct %7 %29 %29 + %34 = OpCompositeConstruct %7 %32 %32 + %35 = OpExtInst %7 %1 FClamp %28 %33 %34 + OpStore %24 %35 + %36 = OpLoad %7 %24 + %37 = OpAccessChain %19 %15 %17 %17 + %38 = OpLoad %6 %37 + %39 = OpAccessChain %19 %15 %17 %30 + %40 = OpLoad %6 %39 + %41 = OpCompositeConstruct %7 %38 %40 + %44 = OpFOrdEqual %43 %36 %41 + %45 = OpAll %42 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %70 + %46 = OpLabel + %57 = OpAccessChain %56 %55 %17 %17 + %58 = OpLoad %16 %57 + %59 = OpConvertSToF %6 %58 + %60 = OpAccessChain %56 %55 %17 %30 + %61 = OpLoad %16 %60 + %62 = OpConvertSToF %6 %61 + %63 = OpAccessChain %56 %55 %17 %30 + %64 = OpLoad %16 %63 + %65 = OpConvertSToF %6 %64 + %66 = OpAccessChain %56 %55 %17 %17 + %67 = OpLoad %16 %66 + %68 = OpConvertSToF %6 %67 + %69 = OpCompositeConstruct %48 %59 %62 %65 %68 + OpStore %50 %69 + OpBranch %47 + %70 = OpLabel + %71 = OpAccessChain %56 %55 %17 %30 + %72 = OpLoad %16 %71 + %73 = OpConvertSToF %6 %72 + %74 = OpCompositeConstruct %48 %73 %73 %73 %73 + OpStore %50 %74 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 2.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-clear-yz-inside-condition.amber b/vulkan/amber/graphicsfuzz/cov-clear-yz-inside-condition.amber new file mode 100644 index 0000000..de147b1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-clear-yz-inside-condition.amber @@ -0,0 +1,230 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--eliminate-local-multi-store' +# '--eliminate-local-single-store' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--copy-propagate-arrays' +# '--copy-propagate-arrays' +# '--eliminate-dead-inserts' +# '--vector-dce' +# '--vector-dce' +# '--inline-entry-points-exhaustive' +# '--eliminate-local-single-store' +# '--eliminate-local-single-store' +# '--simplify-instructions' +# '--eliminate-local-single-block' +# '--ccp' +# '--private-to-local' +# '--scalar-replacement=100' +# '--eliminate-local-single-block' +# '--private-to-local' +# '--scalar-replacement=100' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-blocks' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_2_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 2.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of zero: 0.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float zero; +# }; +# +# void main() +# { +# vec2 v0 = vec2(_float_1_0); +# vec4 v1 = vec4(v0.x); +# +# // Always true. +# if(zero != _float_1_0) +# { +# // Always false. +# if(zero == _float_2_0) +# { +# return; +# } +# v1.yz -= _float_1_0; +# } +# else +# { +# discard; +# } +# +# _GLF_color = v1; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %61 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v0" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %24 "v1" + OpName %30 "buf1" + OpMemberName %30 0 "zero" + OpName %32 "" + OpName %61 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 1 + OpDecorate %61 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %6 + %22 = OpTypeVector %6 4 + %23 = OpTypePointer Function %22 + %25 = OpConstant %10 0 + %26 = OpTypePointer Function %6 + %30 = OpTypeStruct %6 + %31 = OpTypePointer Uniform %30 + %32 = OpVariable %31 Uniform + %37 = OpTypeBool + %43 = OpConstant %16 1 + %60 = OpTypePointer Output %22 + %61 = OpVariable %60 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %24 = OpVariable %23 Function + %19 = OpAccessChain %18 %15 %17 %17 + %20 = OpLoad %6 %19 + %21 = OpCompositeConstruct %7 %20 %20 + OpStore %9 %21 + %27 = OpAccessChain %26 %9 %25 + %28 = OpLoad %6 %27 + %29 = OpCompositeConstruct %22 %28 %28 %28 %28 + OpStore %24 %29 + %33 = OpAccessChain %18 %32 %17 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %18 %15 %17 %17 + %36 = OpLoad %6 %35 + %38 = OpFUnordNotEqual %37 %34 %36 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %58 + %39 = OpLabel + %41 = OpAccessChain %18 %32 %17 + %42 = OpLoad %6 %41 + %44 = OpAccessChain %18 %15 %17 %43 + %45 = OpLoad %6 %44 + %46 = OpFOrdEqual %37 %42 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + OpReturn + %48 = OpLabel + %50 = OpAccessChain %18 %15 %17 %17 + %51 = OpLoad %6 %50 + %53 = OpVectorShuffle %7 %29 %29 1 2 + %54 = OpCompositeConstruct %7 %51 %51 + %55 = OpFSub %7 %53 %54 + %57 = OpVectorShuffle %22 %29 %55 0 4 5 3 + OpStore %24 %57 + OpBranch %40 + %58 = OpLabel + OpTerminateInvocation + %40 = OpLabel + OpStore %61 %57 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float STD140 DATA + 0.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 2.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch.amber b/vulkan/amber/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch.amber new file mode 100644 index 0000000..0afdcb0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch.amber @@ -0,0 +1,413 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_20 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _uint_60433 _GLF_uniform_uint_values[0] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_1_7 _GLF_uniform_float_values[2] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_uint_values: 60433 +# layout(set = 0, binding = 0) uniform buf0 +# { +# uint _GLF_uniform_uint_values[1]; +# }; +# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 1.7] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# // Contents of _GLF_uniform_int_values: [20, 1, 0, 2] +# layout(set = 0, binding = 2) uniform buf2 +# { +# int _GLF_uniform_int_values[4]; +# }; +# // Contents of three: 3 +# layout(set = 0, binding = 3) uniform buf3 +# { +# int three; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // This function does nothing as it backs up _GLF_color and writes it back. +# void func0() +# { +# vec4 tmp; +# // Always true. +# if(gl_FragCoord.x > _float_0_0) +# { +# tmp = _GLF_color; +# } +# _GLF_color = tmp; +# } +# +# // This function always returns 2. +# int func1() +# { +# int a = _int_1; +# +# while(a < _int_2) +# { +# // Always true. +# if(three > _int_1) +# { +# func0(); +# a = _int_2; +# } +# else +# { +# func0(); +# } +# } +# +# return a; +# } +# +# void main() +# { +# // Always true. +# if(gl_FragCoord.x > _float_0_0) +# { +# _GLF_color = vec4(_float_1_0, _float_0_0, _float_1_0, _float_1_7); +# } +# else +# { +# _GLF_color = unpackSnorm4x8(_uint_60433); +# } +# +# int a = _int_0; +# for(int i = 0; i < 5; i ++) +# { +# for(int j = 0; j < 2; j ++) +# { +# // Executed ten times. Func1 always returns 2, hence a gets incremented by total of 20. +# a += func1(); +# } +# } +# +# // Always true. +# if(a == _int_20) +# { +# _GLF_color.z -= _float_1_0; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 147 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %15 %38 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %6 "func0(" + OpName %10 "func1(" + OpName %15 "gl_FragCoord" + OpName %23 "buf1" + OpMemberName %23 0 "_GLF_uniform_float_values" + OpName %25 "" + OpName %36 "tmp" + OpName %38 "_GLF_color" + OpName %42 "a" + OpName %45 "buf2" + OpMemberName %45 0 "_GLF_uniform_int_values" + OpName %47 "" + OpName %61 "buf3" + OpMemberName %61 0 "three" + OpName %63 "" + OpName %99 "buf0" + OpMemberName %99 0 "_GLF_uniform_uint_values" + OpName %101 "" + OpName %106 "a" + OpName %109 "i" + OpName %118 "j" + OpDecorate %15 BuiltIn FragCoord + OpDecorate %22 ArrayStride 16 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 1 + OpDecorate %38 Location 0 + OpDecorate %44 ArrayStride 16 + OpMemberDecorate %45 0 Offset 0 + OpDecorate %45 Block + OpDecorate %47 DescriptorSet 0 + OpDecorate %47 Binding 2 + OpMemberDecorate %61 0 Offset 0 + OpDecorate %61 Block + OpDecorate %63 DescriptorSet 0 + OpDecorate %63 Binding 3 + OpDecorate %98 ArrayStride 16 + OpMemberDecorate %99 0 Offset 0 + OpDecorate %99 Block + OpDecorate %101 DescriptorSet 0 + OpDecorate %101 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeInt 32 1 + %9 = OpTypeFunction %8 + %12 = OpTypeFloat 32 + %13 = OpTypeVector %12 4 + %14 = OpTypePointer Input %13 + %15 = OpVariable %14 Input + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 0 + %18 = OpTypePointer Input %12 + %21 = OpConstant %16 3 + %22 = OpTypeArray %12 %21 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpConstant %8 0 + %27 = OpConstant %8 1 + %28 = OpTypePointer Uniform %12 + %31 = OpTypeBool + %35 = OpTypePointer Function %13 + %37 = OpTypePointer Output %13 + %38 = OpVariable %37 Output + %41 = OpTypePointer Function %8 + %43 = OpConstant %16 4 + %44 = OpTypeArray %8 %43 + %45 = OpTypeStruct %44 + %46 = OpTypePointer Uniform %45 + %47 = OpVariable %46 Uniform + %48 = OpTypePointer Uniform %8 + %57 = OpConstant %8 3 + %61 = OpTypeStruct %8 + %62 = OpTypePointer Uniform %61 + %63 = OpVariable %62 Uniform + %92 = OpConstant %8 2 + %97 = OpConstant %16 1 + %98 = OpTypeArray %16 %97 + %99 = OpTypeStruct %98 + %100 = OpTypePointer Uniform %99 + %101 = OpVariable %100 Uniform + %102 = OpTypePointer Uniform %16 + %116 = OpConstant %8 5 + %141 = OpConstant %16 2 + %142 = OpTypePointer Output %12 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %106 = OpVariable %41 Function + %109 = OpVariable %41 Function + %118 = OpVariable %41 Function + %79 = OpAccessChain %18 %15 %17 + %80 = OpLoad %12 %79 + %81 = OpAccessChain %28 %25 %26 %27 + %82 = OpLoad %12 %81 + %83 = OpFOrdGreaterThan %31 %80 %82 + OpSelectionMerge %85 None + OpBranchConditional %83 %84 %96 + %84 = OpLabel + %86 = OpAccessChain %28 %25 %26 %26 + %87 = OpLoad %12 %86 + %88 = OpAccessChain %28 %25 %26 %27 + %89 = OpLoad %12 %88 + %90 = OpAccessChain %28 %25 %26 %26 + %91 = OpLoad %12 %90 + %93 = OpAccessChain %28 %25 %26 %92 + %94 = OpLoad %12 %93 + %95 = OpCompositeConstruct %13 %87 %89 %91 %94 + OpStore %38 %95 + OpBranch %85 + %96 = OpLabel + %103 = OpAccessChain %102 %101 %26 %26 + %104 = OpLoad %16 %103 + %105 = OpExtInst %13 %1 UnpackSnorm4x8 %104 + OpStore %38 %105 + OpBranch %85 + %85 = OpLabel + %107 = OpAccessChain %48 %47 %26 %92 + %108 = OpLoad %8 %107 + OpStore %106 %108 + OpStore %109 %26 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %115 = OpLoad %8 %109 + %117 = OpSLessThan %31 %115 %116 + OpBranchConditional %117 %111 %112 + %111 = OpLabel + OpStore %118 %26 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %8 %118 + %125 = OpSLessThan %31 %124 %92 + OpBranchConditional %125 %120 %121 + %120 = OpLabel + %126 = OpFunctionCall %8 %10 + %127 = OpLoad %8 %106 + %128 = OpIAdd %8 %127 %126 + OpStore %106 %128 + OpBranch %122 + %122 = OpLabel + %129 = OpLoad %8 %118 + %130 = OpIAdd %8 %129 %27 + OpStore %118 %130 + OpBranch %119 + %121 = OpLabel + OpBranch %113 + %113 = OpLabel + %131 = OpLoad %8 %109 + %132 = OpIAdd %8 %131 %27 + OpStore %109 %132 + OpBranch %110 + %112 = OpLabel + %133 = OpLoad %8 %106 + %134 = OpAccessChain %48 %47 %26 %26 + %135 = OpLoad %8 %134 + %136 = OpIEqual %31 %133 %135 + OpSelectionMerge %138 None + OpBranchConditional %136 %137 %138 + %137 = OpLabel + %139 = OpAccessChain %28 %25 %26 %26 + %140 = OpLoad %12 %139 + %143 = OpAccessChain %142 %38 %141 + %144 = OpLoad %12 %143 + %145 = OpFSub %12 %144 %140 + %146 = OpAccessChain %142 %38 %141 + OpStore %146 %145 + OpBranch %138 + %138 = OpLabel + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %36 = OpVariable %35 Function + %19 = OpAccessChain %18 %15 %17 + %20 = OpLoad %12 %19 + %29 = OpAccessChain %28 %25 %26 %27 + %30 = OpLoad %12 %29 + %32 = OpFOrdGreaterThan %31 %20 %30 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %34 + %33 = OpLabel + %39 = OpLoad %13 %38 + OpStore %36 %39 + OpBranch %34 + %34 = OpLabel + %40 = OpLoad %13 %36 + OpStore %38 %40 + OpReturn + OpFunctionEnd + %10 = OpFunction %8 None %9 + %11 = OpLabel + %42 = OpVariable %41 Function + %49 = OpAccessChain %48 %47 %26 %27 + %50 = OpLoad %8 %49 + OpStore %42 %50 + OpBranch %51 + %51 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %8 %42 + %58 = OpAccessChain %48 %47 %26 %57 + %59 = OpLoad %8 %58 + %60 = OpSLessThan %31 %56 %59 + OpBranchConditional %60 %52 %53 + %52 = OpLabel + %64 = OpAccessChain %48 %63 %26 + %65 = OpLoad %8 %64 + %66 = OpAccessChain %48 %47 %26 %27 + %67 = OpLoad %8 %66 + %68 = OpSGreaterThan %31 %65 %67 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %74 + %69 = OpLabel + %71 = OpFunctionCall %2 %6 + %72 = OpAccessChain %48 %47 %26 %57 + %73 = OpLoad %8 %72 + OpStore %42 %73 + OpBranch %70 + %74 = OpLabel + %75 = OpFunctionCall %2 %6 + OpBranch %70 + %70 = OpLabel + OpBranch %54 + %54 = OpLabel + OpBranch %51 + %53 = OpLabel + %76 = OpLoad %8 %42 + OpReturnValue %76 + OpFunctionEnd +END + +# uniforms for variant + +# three +BUFFER variant_three DATA_TYPE int32 STD140 DATA + 3 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 20 1 0 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 1.7 +END +# _GLF_uniform_uint_values +BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA + 60433 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_three AS uniform DESCRIPTOR_SET 0 BINDING 3 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply.amber b/vulkan/amber/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply.amber new file mode 100644 index 0000000..9c22c4d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply.amber @@ -0,0 +1,192 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific DAG code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a187dd58a0485988841d325a85c8e6063f53500a + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_0_1 _GLF_uniform_float_values[2] +# #define _float_0_3 _GLF_uniform_float_values[3] +# #define _float_0_2 _GLF_uniform_float_values[4] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 0.1, 0.3, 0.2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // These conditions don't matter since the color +# // gets overwritten right after. +# if(gl_FragCoord.x > _float_1_0) +# { +# _GLF_color = vec4(_float_0_1); +# if(gl_FragCoord.y > _float_1_0) +# { +# _GLF_color = vec4(_float_0_2); +# } +# _GLF_color = vec4(_float_0_3); +# } +# +# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, 10.0); +# // Multiplying by an identity matrix doesn't change the vector value. +# _GLF_color = mat4(_float_1_0) * _GLF_color; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 72 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %30 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "gl_FragCoord" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_float_values" + OpName %19 "" + OpName %30 "_GLF_color" + OpDecorate %9 BuiltIn FragCoord + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %30 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Input %7 + %9 = OpVariable %8 Input + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 0 + %12 = OpTypePointer Input %6 + %15 = OpConstant %10 5 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypeInt 32 1 + %21 = OpConstant %20 0 + %22 = OpTypePointer Uniform %6 + %25 = OpTypeBool + %29 = OpTypePointer Output %7 + %30 = OpVariable %29 Output + %31 = OpConstant %20 2 + %35 = OpConstant %10 1 + %43 = OpConstant %20 4 + %47 = OpConstant %20 3 + %53 = OpConstant %20 1 + %58 = OpConstant %6 10 + %62 = OpTypeMatrix %7 4 + %64 = OpConstant %6 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %13 = OpAccessChain %12 %9 %11 + %14 = OpLoad %6 %13 + %23 = OpAccessChain %22 %19 %21 %21 + %24 = OpLoad %6 %23 + %26 = OpFOrdGreaterThan %25 %14 %24 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + %32 = OpAccessChain %22 %19 %21 %31 + %33 = OpLoad %6 %32 + %34 = OpCompositeConstruct %7 %33 %33 %33 %33 + OpStore %30 %34 + %36 = OpAccessChain %12 %9 %35 + %37 = OpLoad %6 %36 + %40 = OpFOrdGreaterThan %25 %37 %24 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %42 + %41 = OpLabel + %44 = OpAccessChain %22 %19 %21 %43 + %45 = OpLoad %6 %44 + %46 = OpCompositeConstruct %7 %45 %45 %45 %45 + OpStore %30 %46 + OpBranch %42 + %42 = OpLabel + %48 = OpAccessChain %22 %19 %21 %47 + %49 = OpLoad %6 %48 + %50 = OpCompositeConstruct %7 %49 %49 %49 %49 + OpStore %30 %50 + OpBranch %28 + %28 = OpLabel + %54 = OpAccessChain %22 %19 %21 %53 + %55 = OpLoad %6 %54 + %59 = OpCompositeConstruct %7 %24 %55 %55 %58 + OpStore %30 %59 + %65 = OpCompositeConstruct %7 %24 %64 %64 %64 + %66 = OpCompositeConstruct %7 %64 %24 %64 %64 + %67 = OpCompositeConstruct %7 %64 %64 %24 %64 + %68 = OpCompositeConstruct %7 %64 %64 %64 %24 + %69 = OpCompositeConstruct %62 %65 %66 %67 %68 + %70 = OpLoad %7 %30 + %71 = OpMatrixTimesVector %7 %69 %70 + OpStore %30 %71 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 0.1 0.3 0.2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-combine-and-or-xor-gt-lt.amber b/vulkan/amber/graphicsfuzz/cov-combine-and-or-xor-gt-lt.amber new file mode 100644 index 0000000..a4682f4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-combine-and-or-xor-gt-lt.amber @@ -0,0 +1,215 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific bitwise operator cobmining code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of v1: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 v1; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# bool b = true; +# +# // Always true. +# if (v1.x > v1.y) +# { +# // Always false. +# if (v1.x < v1.y) +# { +# b = false; +# } +# } +# if (b) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %41 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "b" + OpName %12 "buf1" + OpMemberName %12 0 "v1" + OpName %14 "" + OpName %41 "_GLF_color" + OpName %44 "buf0" + OpMemberName %44 0 "_GLF_uniform_int_values" + OpName %46 "" + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %41 Location 0 + OpDecorate %43 ArrayStride 16 + OpMemberDecorate %44 0 RelaxedPrecision + OpMemberDecorate %44 0 Offset 0 + OpDecorate %44 Block + OpDecorate %46 DescriptorSet 0 + OpDecorate %46 Binding 0 + OpDecorate %49 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %59 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeBool + %7 = OpTypePointer Function %6 + %9 = OpConstantTrue %6 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 2 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %10 + %22 = OpConstant %17 1 + %35 = OpConstantFalse %6 + %39 = OpTypeVector %10 4 + %40 = OpTypePointer Output %39 + %41 = OpVariable %40 Output + %42 = OpConstant %17 2 + %43 = OpTypeArray %15 %42 + %44 = OpTypeStruct %43 + %45 = OpTypePointer Uniform %44 + %46 = OpVariable %45 Uniform + %47 = OpTypePointer Uniform %15 + %51 = OpConstant %15 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %20 = OpAccessChain %19 %14 %16 %18 + %21 = OpLoad %10 %20 + %23 = OpAccessChain %19 %14 %16 %22 + %24 = OpLoad %10 %23 + %25 = OpFOrdGreaterThan %6 %21 %24 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %27 + %26 = OpLabel + %28 = OpAccessChain %19 %14 %16 %18 + %29 = OpLoad %10 %28 + %30 = OpAccessChain %19 %14 %16 %22 + %31 = OpLoad %10 %30 + %32 = OpFOrdLessThan %6 %29 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %34 + %33 = OpLabel + OpStore %8 %35 + OpBranch %34 + %34 = OpLabel + OpBranch %27 + %27 = OpLabel + %36 = OpLoad %6 %8 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %62 + %37 = OpLabel + %48 = OpAccessChain %47 %46 %16 %16 + %49 = OpLoad %15 %48 + %50 = OpConvertSToF %10 %49 + %52 = OpAccessChain %47 %46 %16 %51 + %53 = OpLoad %15 %52 + %54 = OpConvertSToF %10 %53 + %55 = OpAccessChain %47 %46 %16 %51 + %56 = OpLoad %15 %55 + %57 = OpConvertSToF %10 %56 + %58 = OpAccessChain %47 %46 %16 %16 + %59 = OpLoad %15 %58 + %60 = OpConvertSToF %10 %59 + %61 = OpCompositeConstruct %39 %50 %54 %57 %60 + OpStore %41 %61 + OpBranch %38 + %62 = OpLabel + %63 = OpAccessChain %47 %46 %16 %51 + %64 = OpLoad %15 %63 + %65 = OpConvertSToF %10 %64 + %66 = OpCompositeConstruct %39 %65 %65 %65 %65 + OpStore %41 %66 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# v1 +BUFFER variant_v1 DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_v1 AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-condition-bitfield-extract-integer.amber b/vulkan/amber/graphicsfuzz/cov-condition-bitfield-extract-integer.amber new file mode 100644 index 0000000..2cf01ff --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-condition-bitfield-extract-integer.amber @@ -0,0 +1,151 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always true. +# if (bitfieldExtract(3, 1, 2) == 1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %18 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %18 "_GLF_color" + OpName %22 "buf0" + OpMemberName %22 0 "_GLF_uniform_int_values" + OpName %24 "" + OpDecorate %18 Location 0 + OpDecorate %21 ArrayStride 16 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpConstant %6 3 + %8 = OpConstant %6 1 + %9 = OpConstant %6 2 + %11 = OpTypeBool + %15 = OpTypeFloat 32 + %16 = OpTypeVector %15 4 + %17 = OpTypePointer Output %16 + %18 = OpVariable %17 Output + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 2 + %21 = OpTypeArray %6 %20 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpConstant %6 0 + %26 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpBitFieldSExtract %6 %7 %8 %9 + %12 = OpIEqual %11 %10 %8 + OpSelectionMerge %14 None + OpBranchConditional %12 %13 %40 + %13 = OpLabel + %27 = OpAccessChain %26 %24 %25 %25 + %28 = OpLoad %6 %27 + %29 = OpConvertSToF %15 %28 + %30 = OpAccessChain %26 %24 %25 %8 + %31 = OpLoad %6 %30 + %32 = OpConvertSToF %15 %31 + %33 = OpAccessChain %26 %24 %25 %8 + %34 = OpLoad %6 %33 + %35 = OpConvertSToF %15 %34 + %36 = OpAccessChain %26 %24 %25 %25 + %37 = OpLoad %6 %36 + %38 = OpConvertSToF %15 %37 + %39 = OpCompositeConstruct %16 %29 %32 %35 %38 + OpStore %18 %39 + OpBranch %14 + %40 = OpLabel + %41 = OpAccessChain %26 %24 %25 %8 + %42 = OpLoad %6 %41 + %43 = OpConvertSToF %15 %42 + %44 = OpCompositeConstruct %16 %43 %43 %43 %43 + OpStore %18 %44 + OpBranch %14 + %14 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-condition-clamp-min-from-uniform-never-larger.amber b/vulkan/amber/graphicsfuzz/cov-condition-clamp-min-from-uniform-never-larger.amber new file mode 100644 index 0000000..b079bb3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-condition-clamp-min-from-uniform-never-larger.amber @@ -0,0 +1,201 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of two: 2.0 +# layout(push_constant) uniform buf_push +# { +# float two; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always true: regardless of the condition a value of one can never become larger by clamping. +# if(clamp(1, _float_1_0 > two ? 1 : 0, 1) <= 1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %19 "buf_push" + OpMemberName %19 0 "two" + OpName %21 "" + OpName %34 "_GLF_color" + OpName %37 "buf1" + OpMemberName %37 0 "_GLF_uniform_int_values" + OpName %39 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %34 Location 0 + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpConstant %6 1 + %8 = OpTypeFloat 32 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 1 + %11 = OpTypeArray %8 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %8 + %19 = OpTypeStruct %8 + %20 = OpTypePointer PushConstant %19 + %21 = OpVariable %20 PushConstant + %22 = OpTypePointer PushConstant %8 + %25 = OpTypeBool + %32 = OpTypeVector %8 4 + %33 = OpTypePointer Output %32 + %34 = OpVariable %33 Output + %35 = OpConstant %9 2 + %36 = OpTypeArray %6 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %17 = OpAccessChain %16 %14 %15 %15 + %18 = OpLoad %8 %17 + %23 = OpAccessChain %22 %21 %15 + %24 = OpLoad %8 %23 + %26 = OpFOrdGreaterThan %25 %18 %24 + %27 = OpSelect %6 %26 %7 %15 + %28 = OpExtInst %6 %1 SClamp %7 %27 %7 + %29 = OpSLessThanEqual %25 %28 %7 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %54 + %30 = OpLabel + %41 = OpAccessChain %40 %39 %15 %15 + %42 = OpLoad %6 %41 + %43 = OpConvertSToF %8 %42 + %44 = OpAccessChain %40 %39 %15 %7 + %45 = OpLoad %6 %44 + %46 = OpConvertSToF %8 %45 + %47 = OpAccessChain %40 %39 %15 %7 + %48 = OpLoad %6 %47 + %49 = OpConvertSToF %8 %48 + %50 = OpAccessChain %40 %39 %15 %15 + %51 = OpLoad %6 %50 + %52 = OpConvertSToF %8 %51 + %53 = OpCompositeConstruct %32 %43 %46 %49 %52 + OpStore %34 %53 + OpBranch %31 + %54 = OpLabel + %55 = OpAccessChain %40 %39 %15 %7 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %8 %56 + %58 = OpCompositeConstruct %32 %57 %57 %57 %57 + OpStore %34 %58 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE float STD140 DATA + 2.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-condition-increment-zero-to-one-divide-by-two.amber b/vulkan/amber/graphicsfuzz/cov-condition-increment-zero-to-one-divide-by-two.amber new file mode 100644 index 0000000..403c08d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-condition-increment-zero-to-one-divide-by-two.amber @@ -0,0 +1,185 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 0; +# +# if(gl_FragCoord.y > 10.0) +# { +# a++; +# } +# +# // Before division a is either 0 or 1. In both cases integer division results in zero. +# a /= 2; +# +# // Always true. +# if(a == 0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 60 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 %35 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %13 "gl_FragCoord" + OpName %35 "_GLF_color" + OpName %38 "buf0" + OpMemberName %38 0 "_GLF_uniform_int_values" + OpName %40 "" + OpDecorate %13 BuiltIn FragCoord + OpDecorate %35 Location 0 + OpDecorate %37 ArrayStride 16 + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Input %11 + %13 = OpVariable %12 Input + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 1 + %16 = OpTypePointer Input %10 + %19 = OpConstant %10 10 + %20 = OpTypeBool + %25 = OpConstant %6 1 + %27 = OpConstant %6 2 + %34 = OpTypePointer Output %11 + %35 = OpVariable %34 Output + %36 = OpConstant %14 2 + %37 = OpTypeArray %6 %36 + %38 = OpTypeStruct %37 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %41 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %17 = OpAccessChain %16 %13 %15 + %18 = OpLoad %10 %17 + %21 = OpFOrdGreaterThan %20 %18 %19 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %23 + %22 = OpLabel + %24 = OpLoad %6 %8 + %26 = OpIAdd %6 %24 %25 + OpStore %8 %26 + OpBranch %23 + %23 = OpLabel + %28 = OpLoad %6 %8 + %29 = OpSDiv %6 %28 %27 + OpStore %8 %29 + %30 = OpLoad %6 %8 + %31 = OpIEqual %20 %30 %9 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %55 + %32 = OpLabel + %42 = OpAccessChain %41 %40 %9 %9 + %43 = OpLoad %6 %42 + %44 = OpConvertSToF %10 %43 + %45 = OpAccessChain %41 %40 %9 %25 + %46 = OpLoad %6 %45 + %47 = OpConvertSToF %10 %46 + %48 = OpAccessChain %41 %40 %9 %25 + %49 = OpLoad %6 %48 + %50 = OpConvertSToF %10 %49 + %51 = OpAccessChain %41 %40 %9 %9 + %52 = OpLoad %6 %51 + %53 = OpConvertSToF %10 %52 + %54 = OpCompositeConstruct %11 %44 %47 %50 %53 + OpStore %35 %54 + OpBranch %33 + %55 = OpLabel + %56 = OpAccessChain %41 %40 %9 %25 + %57 = OpLoad %6 %56 + %58 = OpConvertSToF %10 %57 + %59 = OpCompositeConstruct %11 %58 %58 %58 %58 + OpStore %35 %59 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-condition-loop-index-bitwise-not.amber b/vulkan/amber/graphicsfuzz/cov-condition-loop-index-bitwise-not.amber new file mode 100644 index 0000000..f097cf1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-condition-loop-index-bitwise-not.amber @@ -0,0 +1,204 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_50 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 50] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# for(int i = _int_0; i < _int_50; i++) +# { +# // Always true. +# if ((~i) != 0) +# { +# a++; +# } +# } +# +# // Always true. +# if(a == _int_50) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %52 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %29 = OpConstant %6 2 + %32 = OpTypeBool + %49 = OpTypeFloat 32 + %50 = OpTypeVector %49 4 + %51 = OpTypePointer Output %50 + %52 = OpVariable %51 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %21 = OpAccessChain %17 %14 %15 %16 + %22 = OpLoad %6 %21 + OpStore %20 %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %6 %20 + %30 = OpAccessChain %17 %14 %15 %29 + %31 = OpLoad %6 %30 + %33 = OpSLessThan %32 %28 %31 + OpBranchConditional %33 %24 %25 + %24 = OpLabel + %34 = OpLoad %6 %20 + %35 = OpNot %6 %34 + %36 = OpINotEqual %32 %35 %15 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + %39 = OpLoad %6 %8 + %40 = OpIAdd %6 %39 %16 + OpStore %8 %40 + OpBranch %38 + %38 = OpLabel + OpBranch %26 + %26 = OpLabel + %41 = OpLoad %6 %20 + %42 = OpIAdd %6 %41 %16 + OpStore %20 %42 + OpBranch %23 + %25 = OpLabel + %43 = OpLoad %6 %8 + %44 = OpAccessChain %17 %14 %15 %29 + %45 = OpLoad %6 %44 + %46 = OpIEqual %32 %43 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %66 + %47 = OpLabel + %53 = OpAccessChain %17 %14 %15 %15 + %54 = OpLoad %6 %53 + %55 = OpConvertSToF %49 %54 + %56 = OpAccessChain %17 %14 %15 %16 + %57 = OpLoad %6 %56 + %58 = OpConvertSToF %49 %57 + %59 = OpAccessChain %17 %14 %15 %16 + %60 = OpLoad %6 %59 + %61 = OpConvertSToF %49 %60 + %62 = OpAccessChain %17 %14 %15 %15 + %63 = OpLoad %6 %62 + %64 = OpConvertSToF %49 %63 + %65 = OpCompositeConstruct %50 %55 %58 %61 %64 + OpStore %52 %65 + OpBranch %48 + %66 = OpLabel + %67 = OpAccessChain %17 %14 %15 %16 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %49 %68 + %70 = OpCompositeConstruct %50 %69 %69 %69 %69 + OpStore %52 %70 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 50 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-condition-matrix-determinant-uniform.amber b/vulkan/amber/graphicsfuzz/cov-condition-matrix-determinant-uniform.amber new file mode 100644 index 0000000..03f307d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-condition-matrix-determinant-uniform.amber @@ -0,0 +1,208 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat3 m = mat3(_float_1_0, _float_1_0, _float_1_0, 0.0, _float_0_0, _float_1_0, _float_0_0, _float_1_0, _float_1_0); +# +# // Always true. +# if(determinant(m) < _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %53 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "m" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %53 "_GLF_color" + OpName %55 "buf0" + OpMemberName %55 0 "_GLF_uniform_int_values" + OpName %57 "" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %53 Location 0 + OpDecorate %54 ArrayStride 16 + OpMemberDecorate %55 0 Offset 0 + OpDecorate %55 Block + OpDecorate %57 DescriptorSet 0 + OpDecorate %57 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeMatrix %7 3 + %9 = OpTypePointer Function %8 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %26 = OpConstant %6 0 + %27 = OpConstant %17 1 + %38 = OpConstant %6 1 + %47 = OpTypeBool + %51 = OpTypeVector %6 4 + %52 = OpTypePointer Output %51 + %53 = OpVariable %52 Output + %54 = OpTypeArray %17 %12 + %55 = OpTypeStruct %54 + %56 = OpTypePointer Uniform %55 + %57 = OpVariable %56 Uniform + %58 = OpTypePointer Uniform %17 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %20 = OpAccessChain %19 %16 %18 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %16 %18 %18 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %19 %16 %18 %18 + %25 = OpLoad %6 %24 + %28 = OpAccessChain %19 %16 %18 %27 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %19 %16 %18 %18 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %19 %16 %18 %27 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %19 %16 %18 %18 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %19 %16 %18 %18 + %37 = OpLoad %6 %36 + %39 = OpCompositeConstruct %7 %21 %23 %25 + %40 = OpCompositeConstruct %7 %26 %29 %31 + %41 = OpCompositeConstruct %7 %33 %35 %37 + %42 = OpCompositeConstruct %8 %39 %40 %41 + OpStore %10 %42 + %43 = OpLoad %8 %10 + %44 = OpExtInst %6 %1 Determinant %43 + %45 = OpAccessChain %19 %16 %18 %27 + %46 = OpLoad %6 %45 + %48 = OpFOrdLessThan %47 %44 %46 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %72 + %49 = OpLabel + %59 = OpAccessChain %58 %57 %18 %18 + %60 = OpLoad %17 %59 + %61 = OpConvertSToF %6 %60 + %62 = OpAccessChain %58 %57 %18 %27 + %63 = OpLoad %17 %62 + %64 = OpConvertSToF %6 %63 + %65 = OpAccessChain %58 %57 %18 %27 + %66 = OpLoad %17 %65 + %67 = OpConvertSToF %6 %66 + %68 = OpAccessChain %58 %57 %18 %18 + %69 = OpLoad %17 %68 + %70 = OpConvertSToF %6 %69 + %71 = OpCompositeConstruct %51 %61 %64 %67 %70 + OpStore %53 %71 + OpBranch %50 + %72 = OpLabel + %73 = OpAccessChain %58 %57 %18 %27 + %74 = OpLoad %17 %73 + %75 = OpConvertSToF %6 %74 + %76 = OpCompositeConstruct %51 %75 %75 %75 %75 + OpStore %53 %76 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-conditional-discard-inside-loop.amber b/vulkan/amber/graphicsfuzz/cov-conditional-discard-inside-loop.amber new file mode 100644 index 0000000..c69759b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-conditional-discard-inside-loop.amber @@ -0,0 +1,241 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_4 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 4] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 1; +# // The color value cannot be changed later without losing +# // the coverage point we are after. +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# for(int i = _int_0; i < _int_4; i++) +# { +# if(a++ > 3) +# { +# break; +# } +# +# // Always false. +# if(injectionSwitch.x > _float_1_0) +# { +# discard; +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 77 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %13 "_GLF_color" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %35 "i" + OpName %57 "buf2" + OpMemberName %57 0 "injectionSwitch" + OpName %59 "" + OpName %66 "buf1" + OpMemberName %66 0 "_GLF_uniform_float_values" + OpName %68 "" + OpDecorate %13 Location 0 + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpMemberDecorate %57 0 Offset 0 + OpDecorate %57 Block + OpDecorate %59 DescriptorSet 0 + OpDecorate %59 Binding 2 + OpDecorate %65 ArrayStride 16 + OpMemberDecorate %66 0 Offset 0 + OpDecorate %66 Block + OpDecorate %68 DescriptorSet 0 + OpDecorate %68 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Output %11 + %13 = OpVariable %12 Output + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 3 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %6 0 + %21 = OpTypePointer Uniform %6 + %44 = OpConstant %6 2 + %47 = OpTypeBool + %51 = OpConstant %6 3 + %56 = OpTypeVector %10 2 + %57 = OpTypeStruct %56 + %58 = OpTypePointer Uniform %57 + %59 = OpVariable %58 Uniform + %60 = OpConstant %14 0 + %61 = OpTypePointer Uniform %10 + %64 = OpConstant %14 1 + %65 = OpTypeArray %10 %64 + %66 = OpTypeStruct %65 + %67 = OpTypePointer Uniform %66 + %68 = OpVariable %67 Uniform + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %35 = OpVariable %7 Function + OpStore %8 %9 + %22 = OpAccessChain %21 %19 %20 %20 + %23 = OpLoad %6 %22 + %24 = OpConvertSToF %10 %23 + %25 = OpAccessChain %21 %19 %20 %9 + %26 = OpLoad %6 %25 + %27 = OpConvertSToF %10 %26 + %28 = OpAccessChain %21 %19 %20 %9 + %29 = OpLoad %6 %28 + %30 = OpConvertSToF %10 %29 + %31 = OpAccessChain %21 %19 %20 %20 + %32 = OpLoad %6 %31 + %33 = OpConvertSToF %10 %32 + %34 = OpCompositeConstruct %11 %24 %27 %30 %33 + OpStore %13 %34 + %36 = OpAccessChain %21 %19 %20 %9 + %37 = OpLoad %6 %36 + OpStore %35 %37 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %6 %35 + %45 = OpAccessChain %21 %19 %20 %44 + %46 = OpLoad %6 %45 + %48 = OpSLessThan %47 %43 %46 + OpBranchConditional %48 %39 %40 + %39 = OpLabel + %49 = OpLoad %6 %8 + %50 = OpIAdd %6 %49 %9 + OpStore %8 %50 + %52 = OpSGreaterThan %47 %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + OpBranch %40 + %54 = OpLabel + %62 = OpAccessChain %61 %59 %20 %60 + %63 = OpLoad %10 %62 + %69 = OpAccessChain %61 %68 %20 %20 + %70 = OpLoad %10 %69 + %71 = OpFOrdGreaterThan %47 %63 %70 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %73 + %72 = OpLabel + OpTerminateInvocation + %73 = OpLabel + OpBranch %41 + %41 = OpLabel + %75 = OpLoad %6 %35 + %76 = OpIAdd %6 %75 %9 + OpStore %35 %76 + OpBranch %38 + %40 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 4 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-conditions-empty-blocks-index-array-one-divided-by-findlsb.amber b/vulkan/amber/graphicsfuzz/cov-conditions-empty-blocks-index-array-one-divided-by-findlsb.amber new file mode 100644 index 0000000..736c78e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-conditions-empty-blocks-index-array-one-divided-by-findlsb.amber @@ -0,0 +1,298 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_4 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _float_2_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 4, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of _GLF_uniform_float_values: [2.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# highp vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float arr[10] = float[10](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0); +# +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# } +# else +# { +# // Always false. +# if(gl_FragCoord.x < 0.0) +# { +# } +# else +# { +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# } +# else +# { +# // arr[1] becomes 2.0. +# arr[_int_2 / findLSB(_int_4)] = _float_2_0; +# } +# } +# } +# +# // Always true. +# if(arr[_int_0] == _float_1_0 && arr[_int_1] == _float_2_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 133 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %59 %114 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %43 "buf2" + OpMemberName %43 0 "injectionSwitch" + OpName %45 "" + OpName %59 "gl_FragCoord" + OpName %78 "buf0" + OpMemberName %78 0 "_GLF_uniform_int_values" + OpName %80 "" + OpName %114 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 2 + OpDecorate %59 BuiltIn FragCoord + OpDecorate %77 ArrayStride 16 + OpMemberDecorate %78 0 Offset 0 + OpDecorate %78 Block + OpDecorate %80 DescriptorSet 0 + OpDecorate %80 Binding 0 + OpDecorate %114 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 2 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpConstant %17 1 + %20 = OpTypePointer Uniform %6 + %42 = OpTypeVector %6 2 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %46 = OpConstant %7 0 + %49 = OpConstant %7 1 + %52 = OpTypeBool + %57 = OpTypeVector %6 4 + %58 = OpTypePointer Input %57 + %59 = OpVariable %58 Input + %60 = OpTypePointer Input %6 + %63 = OpConstant %6 0 + %76 = OpConstant %7 4 + %77 = OpTypeArray %17 %76 + %78 = OpTypeStruct %77 + %79 = OpTypePointer Uniform %78 + %80 = OpVariable %79 Uniform + %81 = OpConstant %17 3 + %82 = OpTypePointer Uniform %17 + %91 = OpTypePointer Function %6 + %102 = OpConstant %17 2 + %113 = OpTypePointer Output %57 + %114 = OpVariable %113 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %21 = OpAccessChain %20 %16 %18 %19 + %22 = OpLoad %6 %21 + %41 = OpCompositeConstruct %9 %22 %22 %22 %22 %22 %22 %22 %22 %22 %22 + OpStore %11 %41 + %47 = OpAccessChain %20 %45 %18 %46 + %48 = OpLoad %6 %47 + %50 = OpAccessChain %20 %45 %18 %49 + %51 = OpLoad %6 %50 + %53 = OpFOrdGreaterThan %52 %48 %51 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %56 + %54 = OpLabel + OpBranch %55 + %56 = OpLabel + %61 = OpAccessChain %60 %59 %46 + %62 = OpLoad %6 %61 + %64 = OpFOrdLessThan %52 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %67 + %65 = OpLabel + OpBranch %66 + %67 = OpLabel + OpSelectionMerge %74 None + OpBranchConditional %53 %73 %75 + %73 = OpLabel + OpBranch %74 + %75 = OpLabel + %83 = OpAccessChain %82 %80 %18 %81 + %84 = OpLoad %17 %83 + %85 = OpAccessChain %82 %80 %18 %19 + %86 = OpLoad %17 %85 + %87 = OpExtInst %17 %1 FindILsb %86 + %88 = OpSDiv %17 %84 %87 + %89 = OpAccessChain %20 %16 %18 %18 + %90 = OpLoad %6 %89 + %92 = OpAccessChain %91 %11 %88 + OpStore %92 %90 + OpBranch %74 + %74 = OpLabel + OpBranch %66 + %66 = OpLabel + OpBranch %55 + %55 = OpLabel + %93 = OpAccessChain %82 %80 %18 %18 + %94 = OpLoad %17 %93 + %95 = OpAccessChain %91 %11 %94 + %96 = OpLoad %6 %95 + %99 = OpFOrdEqual %52 %96 %22 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %103 = OpAccessChain %82 %80 %18 %102 + %104 = OpLoad %17 %103 + %105 = OpAccessChain %91 %11 %104 + %106 = OpLoad %6 %105 + %107 = OpAccessChain %20 %16 %18 %18 + %108 = OpLoad %6 %107 + %109 = OpFOrdEqual %52 %106 %108 + OpBranch %101 + %101 = OpLabel + %110 = OpPhi %52 %99 %55 %109 %100 + OpSelectionMerge %112 None + OpBranchConditional %110 %111 %128 + %111 = OpLabel + %115 = OpAccessChain %82 %80 %18 %102 + %116 = OpLoad %17 %115 + %117 = OpConvertSToF %6 %116 + %120 = OpConvertSToF %6 %94 + %127 = OpCompositeConstruct %57 %117 %120 %120 %117 + OpStore %114 %127 + OpBranch %112 + %128 = OpLabel + %131 = OpConvertSToF %6 %94 + %132 = OpCompositeConstruct %57 %131 %131 %131 %131 + OpStore %114 %132 + OpBranch %112 + %112 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 4 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-bitfieldinsert-div-one.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-bitfieldinsert-div-one.amber new file mode 100644 index 0000000..953f6e4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-bitfieldinsert-div-one.amber @@ -0,0 +1,224 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific const folding path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_9_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 9.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [10, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float arr[10]; +# for (int i = _int_0; i < _int_10; i++) +# { +# arr[i] = float(i); +# } +# +# float f = arr[bitfieldInsert(9, 0, 0, 0) / 1]; +# if (f == _float_9_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, 1); +# } +# else +# { +# _GLF_color = vec4(0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 78 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %62 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %34 "arr" + OpName %42 "f" + OpName %51 "buf0" + OpMemberName %51 0 "_GLF_uniform_float_values" + OpName %53 "" + OpName %62 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %50 ArrayStride 16 + OpMemberDecorate %51 0 Offset 0 + OpDecorate %51 Block + OpDecorate %53 DescriptorSet 0 + OpDecorate %53 Binding 0 + OpDecorate %62 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %28 = OpTypeBool + %30 = OpTypeFloat 32 + %31 = OpConstant %9 10 + %32 = OpTypeArray %30 %31 + %33 = OpTypePointer Function %32 + %38 = OpTypePointer Function %30 + %43 = OpConstant %6 9 + %49 = OpConstant %9 1 + %50 = OpTypeArray %30 %49 + %51 = OpTypeStruct %50 + %52 = OpTypePointer Uniform %51 + %53 = OpVariable %52 Uniform + %54 = OpTypePointer Uniform %30 + %60 = OpTypeVector %30 4 + %61 = OpTypePointer Output %60 + %62 = OpVariable %61 Output + %63 = OpConstant %6 2 + %73 = OpConstant %30 1 + %76 = OpConstant %30 0 + %77 = OpConstantComposite %60 %76 %76 %76 %76 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %34 = OpVariable %33 Function + %42 = OpVariable %38 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %6 %8 + %26 = OpAccessChain %17 %14 %15 %15 + %27 = OpLoad %6 %26 + %29 = OpSLessThan %28 %25 %27 + OpBranchConditional %29 %21 %22 + %21 = OpLabel + %35 = OpLoad %6 %8 + %36 = OpLoad %6 %8 + %37 = OpConvertSToF %30 %36 + %39 = OpAccessChain %38 %34 %35 + OpStore %39 %37 + OpBranch %23 + %23 = OpLabel + %40 = OpLoad %6 %8 + %41 = OpIAdd %6 %40 %16 + OpStore %8 %41 + OpBranch %20 + %22 = OpLabel + %44 = OpBitFieldInsert %6 %43 %15 %15 %15 + %45 = OpSDiv %6 %44 %16 + %46 = OpAccessChain %38 %34 %45 + %47 = OpLoad %30 %46 + OpStore %42 %47 + %48 = OpLoad %30 %42 + %55 = OpAccessChain %54 %53 %15 %15 + %56 = OpLoad %30 %55 + %57 = OpFOrdEqual %28 %48 %56 + OpSelectionMerge %59 None + OpBranchConditional %57 %58 %75 + %58 = OpLabel + %64 = OpAccessChain %17 %14 %15 %63 + %65 = OpLoad %6 %64 + %66 = OpConvertSToF %30 %65 + %67 = OpAccessChain %17 %14 %15 %16 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %30 %68 + %70 = OpAccessChain %17 %14 %15 %16 + %71 = OpLoad %6 %70 + %72 = OpConvertSToF %30 %71 + %74 = OpCompositeConstruct %60 %66 %69 %72 %73 + OpStore %62 %74 + OpBranch %59 + %75 = OpLabel + OpStore %62 %77 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 9.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-ceil-vec4.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-ceil-vec4.amber new file mode 100644 index 0000000..7aa5c68 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-ceil-vec4.amber @@ -0,0 +1,142 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant folding code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float quarter; +# }; +# +# void main() +# { +# vec4 v = ceil(vec4(424.113, quarter, 1.3, 19.62)); +# +# if (v == vec4(425.0, 1.0, 2.0, 20.0)) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %36 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v" + OpName %11 "buf0" + OpMemberName %11 0 "quarter" + OpName %13 "" + OpName %36 "_GLF_color" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %36 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 424.113007 + %11 = OpTypeStruct %6 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypePointer Uniform %6 + %19 = OpConstant %6 1.29999995 + %20 = OpConstant %6 19.6200008 + %24 = OpConstant %6 425 + %25 = OpConstant %6 1 + %26 = OpConstant %6 2 + %27 = OpConstant %6 20 + %28 = OpConstantComposite %7 %24 %25 %26 %27 + %29 = OpTypeBool + %30 = OpTypeVector %29 4 + %35 = OpTypePointer Output %7 + %36 = OpVariable %35 Output + %37 = OpConstant %6 0 + %38 = OpConstantComposite %7 %25 %37 %37 %25 + %40 = OpConstantComposite %7 %37 %37 %37 %37 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %17 = OpAccessChain %16 %13 %15 + %18 = OpLoad %6 %17 + %21 = OpCompositeConstruct %7 %10 %18 %19 %20 + %22 = OpExtInst %7 %1 Ceil %21 + OpStore %9 %22 + %23 = OpLoad %7 %9 + %31 = OpFOrdEqual %30 %23 %28 + %32 = OpAll %29 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %39 + %33 = OpLabel + OpStore %36 %38 + OpBranch %34 + %39 = OpLabel + OpStore %36 %40 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# quarter +BUFFER variant_quarter DATA_TYPE float DATA + 0.25 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_quarter AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-inside-while.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-inside-while.amber new file mode 100644 index 0000000..1ebd1d8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-inside-while.amber @@ -0,0 +1,142 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant folding path + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = 0, j = 1; +# +# while(i < clamp(j, 5, 9)) +# { +# i++; +# j++; +# } +# +# if (i == 9 && j == 10) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %39 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %10 "j" + OpName %39 "_GLF_color" + OpDecorate %39 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %11 = OpConstant %6 1 + %19 = OpConstant %6 5 + %20 = OpConstant %6 9 + %22 = OpTypeBool + %31 = OpConstant %6 10 + %36 = OpTypeFloat 32 + %37 = OpTypeVector %36 4 + %38 = OpTypePointer Output %37 + %39 = OpVariable %38 Output + %40 = OpConstant %36 1 + %41 = OpConstant %36 0 + %42 = OpConstantComposite %37 %40 %41 %41 %40 + %44 = OpConstantComposite %37 %41 %41 %41 %41 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %11 + OpBranch %12 + %12 = OpLabel + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + %17 = OpLoad %6 %8 + %18 = OpLoad %6 %10 + %21 = OpExtInst %6 %1 SClamp %18 %19 %20 + %23 = OpSLessThan %22 %17 %21 + OpBranchConditional %23 %13 %14 + %13 = OpLabel + %24 = OpLoad %6 %8 + %25 = OpIAdd %6 %24 %11 + OpStore %8 %25 + %26 = OpLoad %6 %10 + %27 = OpIAdd %6 %26 %11 + OpStore %10 %27 + OpBranch %15 + %15 = OpLabel + OpBranch %12 + %14 = OpLabel + %28 = OpLoad %6 %8 + %29 = OpIEqual %22 %28 %20 + %30 = OpLoad %6 %10 + %32 = OpIEqual %22 %30 %31 + %33 = OpLogicalAnd %22 %29 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %43 + %34 = OpLabel + OpStore %39 %42 + OpBranch %35 + %43 = OpLabel + OpStore %39 %44 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-max.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-max.amber new file mode 100644 index 0000000..aca9353 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-max.amber @@ -0,0 +1,122 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific const folding rule path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // If condition is always false. +# if ( +# clamp( +# vec4(3000.0, 1.0, 8.0, 4.0), +# vec4(2.0, 3.0, determinant(mat2(2.0, 0.0, 0.0, 2.0)), 5.0), // min = (2, 3, 4, 5) +# vec4(6.0) // max = (6, 6, 6, 6) +# ) != vec4(6, 3, 6, 5) +# ) +# _GLF_color = vec4(0); +# else +# _GLF_color = vec4(1, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %35 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %35 "_GLF_color" + OpDecorate %35 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpConstant %6 3000 + %9 = OpConstant %6 1 + %10 = OpConstant %6 8 + %11 = OpConstant %6 4 + %12 = OpConstantComposite %7 %8 %9 %10 %11 + %13 = OpConstant %6 2 + %14 = OpConstant %6 3 + %15 = OpTypeVector %6 2 + %16 = OpTypeMatrix %15 2 + %17 = OpConstant %6 0 + %18 = OpConstantComposite %15 %13 %17 + %19 = OpConstantComposite %15 %17 %13 + %20 = OpConstantComposite %16 %18 %19 + %22 = OpConstant %6 5 + %24 = OpConstant %6 6 + %25 = OpConstantComposite %7 %24 %24 %24 %24 + %27 = OpConstantComposite %7 %24 %14 %24 %22 + %28 = OpTypeBool + %29 = OpTypeVector %28 4 + %34 = OpTypePointer Output %7 + %35 = OpVariable %34 Output + %36 = OpConstantComposite %7 %17 %17 %17 %17 + %38 = OpConstantComposite %7 %9 %17 %17 %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %21 = OpExtInst %6 %1 Determinant %20 + %23 = OpCompositeConstruct %7 %13 %14 %21 %22 + %26 = OpExtInst %7 %1 FClamp %12 %23 %25 + %30 = OpFOrdNotEqual %29 %26 %27 + %31 = OpAny %28 %30 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %37 + %32 = OpLabel + OpStore %35 %36 + OpBranch %33 + %37 = OpLabel + OpStore %35 %38 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-min.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-min.amber new file mode 100644 index 0000000..a5eb461 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-min.amber @@ -0,0 +1,133 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific const folding rule path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float zero; +# }; +# +# void main() +# { +# if (vec4(clamp(2.0, zero, 1.0), clamp(-1.0, 0.0, zero), 0, 1) != vec4(1, 0, 0, 1)) +# _GLF_color = vec4(0); +# else +# _GLF_color = vec4(1, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "buf0" + OpMemberName %8 0 "zero" + OpName %10 "" + OpName %33 "_GLF_color" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 0 + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpConstant %6 2 + %8 = OpTypeStruct %6 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpTypePointer Uniform %6 + %16 = OpConstant %6 1 + %18 = OpConstant %6 -1 + %19 = OpConstant %6 0 + %23 = OpTypeVector %6 4 + %25 = OpConstantComposite %23 %16 %19 %19 %16 + %26 = OpTypeBool + %27 = OpTypeVector %26 4 + %32 = OpTypePointer Output %23 + %33 = OpVariable %32 Output + %34 = OpConstantComposite %23 %19 %19 %19 %19 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpAccessChain %13 %10 %12 + %15 = OpLoad %6 %14 + %17 = OpExtInst %6 %1 FClamp %7 %15 %16 + %20 = OpAccessChain %13 %10 %12 + %21 = OpLoad %6 %20 + %22 = OpExtInst %6 %1 FClamp %18 %19 %21 + %24 = OpCompositeConstruct %23 %17 %22 %19 %16 + %28 = OpFOrdNotEqual %27 %24 %25 + %29 = OpAny %26 %28 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %35 + %30 = OpLabel + OpStore %33 %34 + OpBranch %31 + %35 = OpLabel + OpStore %33 %25 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-vs-original.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-vs-original.amber new file mode 100644 index 0000000..61acafb --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-vs-original.amber @@ -0,0 +1,136 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant folding path + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void main() +# { +# _GLF_color = vec4(0); +# +# float f = clamp(one, 1.0, 1.0); +# +# if (f > one) // Always false. +# _GLF_color = vec4(0); +# else +# _GLF_color = vec4(f, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %13 "f" + OpName %14 "buf0" + OpMemberName %14 0 "one" + OpName %16 "" + OpDecorate %9 Location 0 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypePointer Function %6 + %14 = OpTypeStruct %6 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 1 + %27 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %13 = OpVariable %12 Function + OpStore %9 %11 + %20 = OpAccessChain %19 %16 %18 + %21 = OpLoad %6 %20 + %23 = OpExtInst %6 %1 FClamp %21 %22 %22 + OpStore %13 %23 + %24 = OpLoad %6 %13 + %25 = OpAccessChain %19 %16 %18 + %26 = OpLoad %6 %25 + %28 = OpFOrdGreaterThan %27 %24 %26 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %31 + %29 = OpLabel + OpStore %9 %11 + OpBranch %30 + %31 = OpLabel + %32 = OpLoad %6 %13 + %33 = OpCompositeConstruct %7 %32 %10 %10 %22 + OpStore %9 %33 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-clamp.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-clamp.amber new file mode 100644 index 0000000..dba6e2d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-clamp.amber @@ -0,0 +1,141 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific const folding rule path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# float fourtytwo; +# }; +# +# void main() +# { +# // If condition is always false. +# if(clamp(1.0, fourtytwo, fourtytwo) > 42.0 +# || clamp(1.0, fourtytwo, fourtytwo) < 42.0) +# _GLF_color = vec4(0); +# else +# _GLF_color = vec4(1, 0, 0, 1); +# +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %36 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "buf0" + OpMemberName %9 0 "fourtytwo" + OpName %11 "" + OpName %36 "_GLF_color" + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 Block + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 0 + OpDecorate %36 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeBool + %7 = OpTypeFloat 32 + %8 = OpConstant %7 1 + %9 = OpTypeStruct %7 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpTypePointer Uniform %7 + %20 = OpConstant %7 42 + %34 = OpTypeVector %7 4 + %35 = OpTypePointer Output %34 + %36 = OpVariable %35 Output + %37 = OpConstant %7 0 + %38 = OpConstantComposite %34 %37 %37 %37 %37 + %40 = OpConstantComposite %34 %8 %37 %37 %8 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %15 = OpAccessChain %14 %11 %13 + %16 = OpLoad %7 %15 + %17 = OpAccessChain %14 %11 %13 + %18 = OpLoad %7 %17 + %19 = OpExtInst %7 %1 FClamp %8 %16 %18 + %21 = OpFOrdGreaterThan %6 %19 %20 + %22 = OpLogicalNot %6 %21 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %25 = OpAccessChain %14 %11 %13 + %26 = OpLoad %7 %25 + %27 = OpAccessChain %14 %11 %13 + %28 = OpLoad %7 %27 + %29 = OpExtInst %7 %1 FClamp %8 %26 %28 + %30 = OpFOrdLessThan %6 %29 %20 + OpBranch %24 + %24 = OpLabel + %31 = OpPhi %6 %21 %5 %30 %23 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %39 + %32 = OpLabel + OpStore %36 %38 + OpBranch %33 + %39 = OpLabel + OpStore %36 %40 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# fourtytwo +BUFFER variant_fourtytwo DATA_TYPE float DATA + 42.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_fourtytwo AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-det-identity.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-det-identity.amber new file mode 100644 index 0000000..8b8bb10 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-det-identity.amber @@ -0,0 +1,152 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific const folding path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec4 ref; +# }; +# +# void main() +# { +# // f becomes 1. +# float f = determinant(mat3(1.0)); +# vec4 v = vec4(sin(f), cos(f), exp2(f), log(f)); +# +# if (distance(v, ref) < 0.1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %20 "v" + OpName %31 "buf0" + OpMemberName %31 0 "ref" + OpName %33 "" + OpName %46 "_GLF_color" + OpMemberDecorate %31 0 Offset 0 + OpDecorate %31 Block + OpDecorate %33 DescriptorSet 0 + OpDecorate %33 Binding 0 + OpDecorate %46 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeVector %6 3 + %10 = OpTypeMatrix %9 3 + %11 = OpConstant %6 1 + %12 = OpConstant %6 0 + %13 = OpConstantComposite %9 %11 %12 %12 + %14 = OpConstantComposite %9 %12 %11 %12 + %15 = OpConstantComposite %9 %12 %12 %11 + %16 = OpConstantComposite %10 %13 %14 %15 + %18 = OpTypeVector %6 4 + %19 = OpTypePointer Function %18 + %31 = OpTypeStruct %18 + %32 = OpTypePointer Uniform %31 + %33 = OpVariable %32 Uniform + %34 = OpTypeInt 32 1 + %35 = OpConstant %34 0 + %36 = OpTypePointer Uniform %18 + %40 = OpConstant %6 0.100000001 + %41 = OpTypeBool + %45 = OpTypePointer Output %18 + %46 = OpVariable %45 Output + %47 = OpConstantComposite %18 %11 %12 %12 %11 + %49 = OpConstantComposite %18 %12 %12 %12 %12 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %19 Function + %17 = OpExtInst %6 %1 Determinant %16 + OpStore %8 %17 + %21 = OpLoad %6 %8 + %22 = OpExtInst %6 %1 Sin %21 + %23 = OpLoad %6 %8 + %24 = OpExtInst %6 %1 Cos %23 + %25 = OpLoad %6 %8 + %26 = OpExtInst %6 %1 Exp2 %25 + %27 = OpLoad %6 %8 + %28 = OpExtInst %6 %1 Log %27 + %29 = OpCompositeConstruct %18 %22 %24 %26 %28 + OpStore %20 %29 + %30 = OpLoad %18 %20 + %37 = OpAccessChain %36 %33 %35 + %38 = OpLoad %18 %37 + %39 = OpExtInst %6 %1 Distance %30 %38 + %42 = OpFOrdLessThan %41 %39 %40 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %48 + %43 = OpLabel + OpStore %46 %47 + OpBranch %44 + %48 = OpLabel + OpStore %46 %49 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# ref +BUFFER variant_ref DATA_TYPE vec4 DATA + 0.84 0.54 2.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_ref AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-dot-condition-true.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-dot-condition-true.amber new file mode 100644 index 0000000..77119d1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-dot-condition-true.amber @@ -0,0 +1,109 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific const folding rule path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float one = 1.0; +# // If condition is always false +# if(dot(vec2(2.0, 1.0), vec2(1.0, (true ? 0.0 : one))) != 2.0) +# _GLF_color = vec4(0); +# else +# _GLF_color = vec4(1, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 29 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %25 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "one" + OpName %25 "_GLF_color" + OpDecorate %25 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpTypeVector %6 2 + %11 = OpConstant %6 2 + %12 = OpConstantComposite %10 %11 %9 + %13 = OpTypeBool + %14 = OpConstantTrue %13 + %15 = OpConstant %6 0 + %23 = OpTypeVector %6 4 + %24 = OpTypePointer Output %23 + %25 = OpVariable %24 Output + %26 = OpConstantComposite %23 %15 %15 %15 %15 + %28 = OpConstantComposite %23 %9 %15 %15 %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %16 = OpLoad %6 %8 + %17 = OpSelect %6 %14 %15 %16 + %18 = OpCompositeConstruct %10 %9 %17 + %19 = OpDot %6 %12 %18 + %20 = OpFOrdNotEqual %13 %19 %11 + OpSelectionMerge %22 None + OpBranchConditional %20 %21 %27 + %21 = OpLabel + OpStore %25 %26 + OpBranch %22 + %27 = OpLabel + OpStore %25 %28 + OpBranch %22 + %22 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-dot-determinant.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-dot-determinant.amber new file mode 100644 index 0000000..c296cd0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-dot-determinant.amber @@ -0,0 +1,104 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific const folding rule path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# if(dot(vec2(determinant(mat2(1)), 0), vec2(0)) == 0.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %24 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %24 "_GLF_color" + OpDecorate %24 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeMatrix %7 2 + %9 = OpConstant %6 1 + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %9 %10 + %12 = OpConstantComposite %7 %10 %9 + %13 = OpConstantComposite %8 %11 %12 + %16 = OpConstantComposite %7 %10 %10 + %18 = OpTypeBool + %22 = OpTypeVector %6 4 + %23 = OpTypePointer Output %22 + %24 = OpVariable %23 Output + %25 = OpConstantComposite %22 %9 %10 %10 %9 + %27 = OpConstantComposite %22 %10 %10 %10 %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpExtInst %6 %1 Determinant %13 + %15 = OpCompositeConstruct %7 %14 %10 + %17 = OpDot %6 %15 %16 + %19 = OpFOrdEqual %18 %17 %10 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %26 + %20 = OpLabel + OpStore %24 %25 + OpBranch %21 + %26 = OpLabel + OpStore %24 %27 + OpBranch %21 + %21 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-gte-const-first.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-gte-const-first.amber new file mode 100644 index 0000000..574ee78 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-gte-const-first.amber @@ -0,0 +1,134 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant folding path + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void main() +# { +# if(3.0 >= clamp(gl_FragCoord.x, 1.0, 2.0 + one)) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %10 %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "gl_FragCoord" + OpName %18 "buf0" + OpMemberName %18 0 "one" + OpName %20 "" + OpName %33 "_GLF_color" + OpDecorate %10 BuiltIn FragCoord + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpConstant %6 3 + %8 = OpTypeVector %6 4 + %9 = OpTypePointer Input %8 + %10 = OpVariable %9 Input + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 0 + %13 = OpTypePointer Input %6 + %16 = OpConstant %6 1 + %17 = OpConstant %6 2 + %18 = OpTypeStruct %6 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypeInt 32 1 + %22 = OpConstant %21 0 + %23 = OpTypePointer Uniform %6 + %28 = OpTypeBool + %32 = OpTypePointer Output %8 + %33 = OpVariable %32 Output + %34 = OpConstant %6 0 + %35 = OpConstantComposite %8 %16 %34 %34 %16 + %37 = OpConstantComposite %8 %34 %34 %34 %34 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpAccessChain %13 %10 %12 + %15 = OpLoad %6 %14 + %24 = OpAccessChain %23 %20 %22 + %25 = OpLoad %6 %24 + %26 = OpFAdd %6 %17 %25 + %27 = OpExtInst %6 %1 FClamp %15 %16 %26 + %29 = OpFOrdGreaterThanEqual %28 %7 %27 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %36 + %30 = OpLabel + OpStore %33 %35 + OpBranch %31 + %36 = OpLabel + OpStore %33 %37 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-min-as-loop-range.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-min-as-loop-range.amber new file mode 100644 index 0000000..8ff5388 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-min-as-loop-range.amber @@ -0,0 +1,217 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant folding path + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int zero; +# }; +# +# void main() +# { +# int data[2]; +# int highSigned = 1; +# uint highUnsigned = 2u; +# +# for(int i = 0; i < min(10, highSigned) + zero; i++) +# data[i] = 5; +# +# for(uint i = 1u; i < min(10u, highUnsigned) + uint(zero); i++) +# data[i] = 6; +# +# if (data[0] == 5 && data[1] == 6) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 83 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %77 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "highSigned" + OpName %12 "highUnsigned" + OpName %14 "i" + OpName %25 "buf0" + OpMemberName %25 0 "zero" + OpName %27 "" + OpName %36 "data" + OpName %42 "i" + OpName %77 "_GLF_color" + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 0 + OpDecorate %77 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpTypeInt 32 0 + %11 = OpTypePointer Function %10 + %13 = OpConstant %10 2 + %15 = OpConstant %6 0 + %22 = OpConstant %6 10 + %25 = OpTypeStruct %6 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypePointer Uniform %6 + %32 = OpTypeBool + %34 = OpTypeArray %6 %13 + %35 = OpTypePointer Function %34 + %38 = OpConstant %6 5 + %43 = OpConstant %10 1 + %50 = OpConstant %10 10 + %59 = OpConstant %6 6 + %74 = OpTypeFloat 32 + %75 = OpTypeVector %74 4 + %76 = OpTypePointer Output %75 + %77 = OpVariable %76 Output + %78 = OpConstant %74 1 + %79 = OpConstant %74 0 + %80 = OpConstantComposite %75 %78 %79 %79 %78 + %82 = OpConstantComposite %75 %79 %79 %79 %79 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %12 = OpVariable %11 Function + %14 = OpVariable %7 Function + %36 = OpVariable %35 Function + %42 = OpVariable %11 Function + OpStore %8 %9 + OpStore %12 %13 + OpStore %14 %15 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %21 = OpLoad %6 %14 + %23 = OpLoad %6 %8 + %24 = OpExtInst %6 %1 SMin %22 %23 + %29 = OpAccessChain %28 %27 %15 + %30 = OpLoad %6 %29 + %31 = OpIAdd %6 %24 %30 + %33 = OpSLessThan %32 %21 %31 + OpBranchConditional %33 %17 %18 + %17 = OpLabel + %37 = OpLoad %6 %14 + %39 = OpAccessChain %7 %36 %37 + OpStore %39 %38 + OpBranch %19 + %19 = OpLabel + %40 = OpLoad %6 %14 + %41 = OpIAdd %6 %40 %9 + OpStore %14 %41 + OpBranch %16 + %18 = OpLabel + OpStore %42 %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %10 %42 + %51 = OpLoad %10 %12 + %52 = OpExtInst %10 %1 UMin %50 %51 + %53 = OpAccessChain %28 %27 %15 + %54 = OpLoad %6 %53 + %55 = OpBitcast %10 %54 + %56 = OpIAdd %10 %52 %55 + %57 = OpULessThan %32 %49 %56 + OpBranchConditional %57 %45 %46 + %45 = OpLabel + %58 = OpLoad %10 %42 + %60 = OpAccessChain %7 %36 %58 + OpStore %60 %59 + OpBranch %47 + %47 = OpLabel + %61 = OpLoad %10 %42 + %62 = OpIAdd %10 %61 %9 + OpStore %42 %62 + OpBranch %44 + %46 = OpLabel + %63 = OpAccessChain %7 %36 %15 + %64 = OpLoad %6 %63 + %65 = OpIEqual %32 %64 %38 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %67 + %66 = OpLabel + %68 = OpAccessChain %7 %36 %9 + %69 = OpLoad %6 %68 + %70 = OpIEqual %32 %69 %59 + OpBranch %67 + %67 = OpLabel + %71 = OpPhi %32 %65 %46 %70 %66 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %81 + %72 = OpLabel + OpStore %77 %80 + OpBranch %73 + %81 = OpLabel + OpStore %77 %82 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-mod-one-one-lte.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-mod-one-one-lte.amber new file mode 100644 index 0000000..45a3832 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-mod-one-one-lte.amber @@ -0,0 +1,147 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific const folding path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# if (mod(1.0, 1.0) <= 0.01) +# { +# _GLF_color = vec4(1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %16 "_GLF_color" + OpName %21 "buf0" + OpMemberName %21 0 "_GLF_uniform_int_values" + OpName %23 "" + OpDecorate %16 Location 0 + OpDecorate %20 ArrayStride 16 + OpMemberDecorate %21 0 Offset 0 + OpDecorate %21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpConstant %6 1 + %9 = OpConstant %6 0.00999999978 + %10 = OpTypeBool + %14 = OpTypeVector %6 4 + %15 = OpTypePointer Output %14 + %16 = OpVariable %15 Output + %17 = OpTypeInt 32 1 + %18 = OpTypeInt 32 0 + %19 = OpConstant %18 2 + %20 = OpTypeArray %17 %19 + %21 = OpTypeStruct %20 + %22 = OpTypePointer Uniform %21 + %23 = OpVariable %22 Uniform + %24 = OpConstant %17 0 + %25 = OpTypePointer Uniform %17 + %32 = OpConstant %17 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpFMod %6 %7 %7 + %11 = OpFOrdLessThanEqual %10 %8 %9 + OpSelectionMerge %13 None + OpBranchConditional %11 %12 %37 + %12 = OpLabel + %26 = OpAccessChain %25 %23 %24 %24 + %27 = OpLoad %17 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpAccessChain %25 %23 %24 %24 + %30 = OpLoad %17 %29 + %31 = OpConvertSToF %6 %30 + %33 = OpAccessChain %25 %23 %24 %32 + %34 = OpLoad %17 %33 + %35 = OpConvertSToF %6 %34 + %36 = OpCompositeConstruct %14 %7 %28 %31 %35 + OpStore %16 %36 + OpBranch %13 + %37 = OpLabel + %38 = OpAccessChain %25 %23 %24 %24 + %39 = OpLoad %17 %38 + %40 = OpConvertSToF %6 %39 + %41 = OpCompositeConstruct %14 %40 %40 %40 %40 + OpStore %16 %41 + OpBranch %13 + %13 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-pow-large-exp.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-pow-large-exp.amber new file mode 100644 index 0000000..8e0a2ba --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-pow-large-exp.amber @@ -0,0 +1,200 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific const folding path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // This results in an undefined value, but not in undefined behavior. +# float f = pow(40.33, ldexp(1.0, 98980)); +# +# if (_int_1 == (_int_1 + _int_0) || f > _float_0_0) +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# else +# _GLF_color = vec4(_int_0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 70 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %51 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %19 "buf0" + OpMemberName %19 0 "_GLF_uniform_int_values" + OpName %21 "" + OpName %39 "buf1" + OpMemberName %39 0 "_GLF_uniform_float_values" + OpName %41 "" + OpName %51 "_GLF_color" + OpDecorate %18 ArrayStride 16 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 0 + OpDecorate %38 ArrayStride 16 + OpMemberDecorate %39 0 Offset 0 + OpDecorate %39 Block + OpDecorate %41 DescriptorSet 0 + OpDecorate %41 Binding 1 + OpDecorate %51 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 40.3300018 + %10 = OpConstant %6 1 + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 98980 + %15 = OpTypeBool + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 2 + %18 = OpTypeArray %11 %17 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpConstant %11 0 + %23 = OpTypePointer Uniform %11 + %28 = OpConstant %11 1 + %37 = OpConstant %16 1 + %38 = OpTypeArray %6 %37 + %39 = OpTypeStruct %38 + %40 = OpTypePointer Uniform %39 + %41 = OpVariable %40 Uniform + %42 = OpTypePointer Uniform %6 + %49 = OpTypeVector %6 4 + %50 = OpTypePointer Output %49 + %51 = OpVariable %50 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %13 = OpExtInst %6 %1 Ldexp %10 %12 + %14 = OpExtInst %6 %1 Pow %9 %13 + OpStore %8 %14 + %24 = OpAccessChain %23 %21 %22 %22 + %25 = OpLoad %11 %24 + %26 = OpAccessChain %23 %21 %22 %22 + %27 = OpLoad %11 %26 + %29 = OpAccessChain %23 %21 %22 %28 + %30 = OpLoad %11 %29 + %31 = OpIAdd %11 %27 %30 + %32 = OpIEqual %15 %25 %31 + %33 = OpLogicalNot %15 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %35 + %34 = OpLabel + %36 = OpLoad %6 %8 + %43 = OpAccessChain %42 %41 %22 %22 + %44 = OpLoad %6 %43 + %45 = OpFOrdGreaterThan %15 %36 %44 + OpBranch %35 + %35 = OpLabel + %46 = OpPhi %15 %32 %5 %45 %34 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %65 + %47 = OpLabel + %52 = OpAccessChain %23 %21 %22 %22 + %53 = OpLoad %11 %52 + %54 = OpConvertSToF %6 %53 + %55 = OpAccessChain %23 %21 %22 %28 + %56 = OpLoad %11 %55 + %57 = OpConvertSToF %6 %56 + %58 = OpAccessChain %23 %21 %22 %28 + %59 = OpLoad %11 %58 + %60 = OpConvertSToF %6 %59 + %61 = OpAccessChain %23 %21 %22 %22 + %62 = OpLoad %11 %61 + %63 = OpConvertSToF %6 %62 + %64 = OpCompositeConstruct %49 %54 %57 %60 %63 + OpStore %51 %64 + OpBranch %48 + %65 = OpLabel + %66 = OpAccessChain %23 %21 %22 %28 + %67 = OpLoad %11 %66 + %68 = OpConvertSToF %6 %67 + %69 = OpCompositeConstruct %49 %68 %68 %68 %68 + OpStore %51 %69 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-same-condition.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-same-condition.amber new file mode 100644 index 0000000..00934e3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-same-condition.amber @@ -0,0 +1,173 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant folding code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void main() +# { +# _GLF_color = vec4(0); +# +# // Always false. +# if(one < 0.0 || one < 1.0) +# return; +# +# // Always false. +# if(one < 0.0) +# { +# while (one < 0.0) +# { +# _GLF_color = vec4(1); +# break; +# } +# } +# else +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %13 "buf0" + OpMemberName %13 0 "one" + OpName %15 "" + OpDecorate %9 Location 0 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypeBool + %13 = OpTypeStruct %6 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %6 + %27 = OpConstant %6 1 + %46 = OpConstantComposite %7 %27 %27 %27 %27 + %49 = OpConstantComposite %7 %27 %10 %10 %27 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %9 %11 + %19 = OpAccessChain %18 %15 %17 + %20 = OpLoad %6 %19 + %21 = OpFOrdLessThan %12 %20 %10 + %22 = OpLogicalNot %12 %21 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %25 = OpAccessChain %18 %15 %17 + %26 = OpLoad %6 %25 + %28 = OpFOrdLessThan %12 %26 %27 + OpBranch %24 + %24 = OpLabel + %29 = OpPhi %12 %21 %5 %28 %23 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %31 + %30 = OpLabel + OpReturn + %31 = OpLabel + %33 = OpAccessChain %18 %15 %17 + %34 = OpLoad %6 %33 + %35 = OpFOrdLessThan %12 %34 %10 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %48 + %36 = OpLabel + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpAccessChain %18 %15 %17 + %44 = OpLoad %6 %43 + %45 = OpFOrdLessThan %12 %44 %10 + OpBranchConditional %45 %39 %40 + %39 = OpLabel + OpStore %9 %46 + OpBranch %40 + %41 = OpLabel + OpBranch %38 + %40 = OpLabel + OpBranch %37 + %48 = OpLabel + OpStore %9 %49 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-sinh-inf.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-sinh-inf.amber new file mode 100644 index 0000000..fc2b0ea --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-sinh-inf.amber @@ -0,0 +1,147 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific const folding path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = sinh(724.322); +# +# // Always true. +# // injectionSwitch.x == 0.0. +# // injectionSwitch.y == 1.0. +# if (isinf(f) || injectionSwitch.x < injectionSwitch.y) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %37 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %18 "buf0" + OpMemberName %18 0 "injectionSwitch" + OpName %20 "" + OpName %37 "_GLF_color" + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %37 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 724.322021 + %11 = OpTypeBool + %17 = OpTypeVector %6 2 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypeInt 32 1 + %22 = OpConstant %21 0 + %23 = OpTypeInt 32 0 + %24 = OpConstant %23 0 + %25 = OpTypePointer Uniform %6 + %28 = OpConstant %23 1 + %35 = OpTypeVector %6 4 + %36 = OpTypePointer Output %35 + %37 = OpVariable %36 Output + %38 = OpConstant %6 1 + %39 = OpConstant %6 0 + %40 = OpConstantComposite %35 %38 %39 %39 %38 + %42 = OpConstantComposite %35 %39 %39 %39 %39 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpExtInst %6 %1 Sinh %9 + OpStore %8 %10 + %12 = OpLoad %6 %8 + %13 = OpIsInf %11 %12 + %14 = OpLogicalNot %11 %13 + OpSelectionMerge %16 None + OpBranchConditional %14 %15 %16 + %15 = OpLabel + %26 = OpAccessChain %25 %20 %22 %24 + %27 = OpLoad %6 %26 + %29 = OpAccessChain %25 %20 %22 %28 + %30 = OpLoad %6 %29 + %31 = OpFOrdLessThan %11 %27 %30 + OpBranch %16 + %16 = OpLabel + %32 = OpPhi %11 %13 %5 %31 %15 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %41 + %33 = OpLabel + OpStore %37 %40 + OpBranch %34 + %41 = OpLabel + OpStore %37 %42 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-const-folding-vector-shuffle.amber b/vulkan/amber/graphicsfuzz/cov-const-folding-vector-shuffle.amber new file mode 100644 index 0000000..063fddf --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-const-folding-vector-shuffle.amber @@ -0,0 +1,145 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific const folding rule path. + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 v; +# +# for(int i = 2; i < 3; i++) +# { +# vec4 tmp = vec4(0); +# tmp.xy = vec2(1.0, float(i)); +# v = tmp.xy; +# } +# +# // If condition is always false. +# if (v.x != 1.0 || v.y != 2.0) +# _GLF_color = vec4(0); +# else +# _GLF_color = vec4(1, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 69 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %57 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %57 "_GLF_color" + OpDecorate %38 RelaxedPrecision + OpDecorate %57 Location 0 + OpDecorate %62 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpConstant %6 2 + %16 = OpConstant %6 3 + %17 = OpTypeBool + %19 = OpTypeFloat 32 + %20 = OpTypeVector %19 4 + %23 = OpConstant %19 0 + %24 = OpConstantComposite %20 %23 %23 %23 %23 + %25 = OpConstant %19 1 + %28 = OpTypeVector %19 2 + %37 = OpConstant %6 1 + %51 = OpConstant %19 2 + %56 = OpTypePointer Output %20 + %57 = OpVariable %56 Output + %59 = OpConstantComposite %20 %25 %23 %23 %25 + %64 = OpUndef %28 + %68 = OpConstantNull %20 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %10 + %10 = OpLabel + %63 = OpPhi %28 %64 %5 %35 %11 + %62 = OpPhi %6 %9 %5 %38 %11 + %18 = OpSLessThan %17 %62 %16 + OpLoopMerge %12 %11 None + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpConvertSToF %19 %62 + %29 = OpCompositeConstruct %28 %25 %27 + %35 = OpVectorShuffle %28 %29 %68 0 1 + %38 = OpIAdd %6 %62 %37 + OpBranch %10 + %12 = OpLabel + %43 = OpCompositeExtract %19 %63 0 + %44 = OpFOrdNotEqual %17 %43 %25 + %45 = OpLogicalNot %17 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + %50 = OpCompositeExtract %19 %63 1 + %52 = OpFOrdNotEqual %17 %50 %51 + OpBranch %47 + %47 = OpLabel + %53 = OpPhi %17 %44 %12 %52 %46 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %58 + %54 = OpLabel + OpStore %57 %24 + OpBranch %55 + %58 = OpLabel + OpStore %57 %59 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-constant-folding-atan-over-tanh.amber b/vulkan/amber/graphicsfuzz/cov-constant-folding-atan-over-tanh.amber new file mode 100644 index 0000000..1282092 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-constant-folding-atan-over-tanh.amber @@ -0,0 +1,109 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant folding code path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = atan(1.0, tanh(1.0)); +# +# if (f > 0.91 && f < 0.93) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 29 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %24 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %24 "_GLF_color" + OpDecorate %24 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %13 = OpConstant %6 0.910000026 + %14 = OpTypeBool + %17 = OpConstant %6 0.930000007 + %22 = OpTypeVector %6 4 + %23 = OpTypePointer Output %22 + %24 = OpVariable %23 Output + %25 = OpConstant %6 0 + %26 = OpConstantComposite %22 %9 %25 %25 %9 + %28 = OpConstantComposite %22 %25 %25 %25 %25 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpExtInst %6 %1 Tanh %9 + %11 = OpExtInst %6 %1 Atan2 %9 %10 + OpStore %8 %11 + %12 = OpLoad %6 %8 + %15 = OpFOrdGreaterThan %14 %12 %13 + %16 = OpLoad %6 %8 + %18 = OpFOrdLessThan %14 %16 %17 + %19 = OpLogicalAnd %14 %15 %18 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %27 + %20 = OpLabel + OpStore %24 %26 + OpBranch %21 + %27 = OpLabel + OpStore %24 %28 + OpBranch %21 + %21 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-constants-combine-add-sub.amber b/vulkan/amber/graphicsfuzz/cov-constants-combine-add-sub.amber new file mode 100644 index 0000000..86ff666 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-constants-combine-add-sub.amber @@ -0,0 +1,265 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific constants and add/sub combining path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_7 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_5 _GLF_uniform_int_values[3] +# #define _int_10 _GLF_uniform_int_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [7, 1, 0, 5, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func(float f) +# { +# int a = _int_1; +# int b = _int_0; +# for (int i = _int_0; i < _int_10; i++) +# { +# if (a > _int_5) +# { +# break; +# } +# +# // Simplifies to a = i. +# a = int(f) -_int_1 / 2 + i; +# +# b++; +# } +# if (b == _int_7) +# { +# return _int_1; +# } +# else +# { +# return _int_0; +# } +# } +# +# void main() +# { +# if (func(-9.3 + 10.0) == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 107 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %88 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "func(f1;" + OpName %10 "f" + OpName %14 "a" + OpName %18 "buf0" + OpMemberName %18 0 "_GLF_uniform_int_values" + OpName %20 "" + OpName %26 "b" + OpName %30 "i" + OpName %79 "param" + OpName %88 "_GLF_color" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %88 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeInt 32 1 + %9 = OpTypeFunction %8 %7 + %13 = OpTypePointer Function %8 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 5 + %17 = OpTypeArray %8 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpConstant %8 0 + %22 = OpConstant %8 1 + %23 = OpTypePointer Uniform %8 + %27 = OpConstant %8 2 + %39 = OpConstant %8 4 + %42 = OpTypeBool + %45 = OpConstant %8 3 + %78 = OpConstant %6 0.699999988 + %86 = OpTypeVector %6 4 + %87 = OpTypePointer Output %86 + %88 = OpVariable %87 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %79 = OpVariable %7 Function + OpStore %79 %78 + %80 = OpFunctionCall %8 %11 %79 + %81 = OpAccessChain %23 %20 %21 %22 + %82 = OpLoad %8 %81 + %83 = OpIEqual %42 %80 %82 + OpSelectionMerge %85 None + OpBranchConditional %83 %84 %102 + %84 = OpLabel + %89 = OpAccessChain %23 %20 %21 %22 + %90 = OpLoad %8 %89 + %91 = OpConvertSToF %6 %90 + %92 = OpAccessChain %23 %20 %21 %27 + %93 = OpLoad %8 %92 + %94 = OpConvertSToF %6 %93 + %95 = OpAccessChain %23 %20 %21 %27 + %96 = OpLoad %8 %95 + %97 = OpConvertSToF %6 %96 + %98 = OpAccessChain %23 %20 %21 %22 + %99 = OpLoad %8 %98 + %100 = OpConvertSToF %6 %99 + %101 = OpCompositeConstruct %86 %91 %94 %97 %100 + OpStore %88 %101 + OpBranch %85 + %102 = OpLabel + %103 = OpAccessChain %23 %20 %21 %27 + %104 = OpLoad %8 %103 + %105 = OpConvertSToF %6 %104 + %106 = OpCompositeConstruct %86 %105 %105 %105 %105 + OpStore %88 %106 + OpBranch %85 + %85 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %8 None %9 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %14 = OpVariable %13 Function + %26 = OpVariable %13 Function + %30 = OpVariable %13 Function + %24 = OpAccessChain %23 %20 %21 %22 + %25 = OpLoad %8 %24 + OpStore %14 %25 + %28 = OpAccessChain %23 %20 %21 %27 + %29 = OpLoad %8 %28 + OpStore %26 %29 + %31 = OpAccessChain %23 %20 %21 %27 + %32 = OpLoad %8 %31 + OpStore %30 %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %8 %30 + %40 = OpAccessChain %23 %20 %21 %39 + %41 = OpLoad %8 %40 + %43 = OpSLessThan %42 %38 %41 + OpBranchConditional %43 %34 %35 + %34 = OpLabel + %44 = OpLoad %8 %14 + %46 = OpAccessChain %23 %20 %21 %45 + %47 = OpLoad %8 %46 + %48 = OpSGreaterThan %42 %44 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %50 + %49 = OpLabel + OpBranch %35 + %50 = OpLabel + %52 = OpLoad %6 %10 + %53 = OpConvertFToS %8 %52 + %54 = OpAccessChain %23 %20 %21 %22 + %55 = OpLoad %8 %54 + %56 = OpSDiv %8 %55 %27 + %57 = OpISub %8 %53 %56 + %58 = OpLoad %8 %30 + %59 = OpIAdd %8 %57 %58 + OpStore %14 %59 + %60 = OpLoad %8 %26 + %61 = OpIAdd %8 %60 %22 + OpStore %26 %61 + OpBranch %36 + %36 = OpLabel + %62 = OpLoad %8 %30 + %63 = OpIAdd %8 %62 %22 + OpStore %30 %63 + OpBranch %33 + %35 = OpLabel + %64 = OpLoad %8 %26 + %65 = OpAccessChain %23 %20 %21 %21 + %66 = OpLoad %8 %65 + %67 = OpIEqual %42 %64 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %73 + %68 = OpLabel + %70 = OpAccessChain %23 %20 %21 %22 + %71 = OpLoad %8 %70 + OpReturnValue %71 + %73 = OpLabel + %74 = OpAccessChain %23 %20 %21 %27 + %75 = OpLoad %8 %74 + OpReturnValue %75 + %69 = OpLabel + OpUnreachable + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 7 1 0 5 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-constants-mix-uniform.amber b/vulkan/amber/graphicsfuzz/cov-constants-mix-uniform.amber new file mode 100644 index 0000000..e88be26 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-constants-mix-uniform.amber @@ -0,0 +1,142 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant handling path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 one; +# }; +# +# void main() +# { +# // Mixing (1, 1) and (1, 1) is still (1, 1). +# vec2 mixed = mix(vec2(1), one, 0.5); +# +# // If condition is always true. +# if (mixed == vec2(1)) +# _GLF_color = vec4(mixed.x, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %32 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "mixed" + OpName %12 "buf0" + OpMemberName %12 0 "one" + OpName %14 "" + OpName %32 "_GLF_color" + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %32 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstantComposite %7 %10 %10 + %12 = OpTypeStruct %7 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %7 + %20 = OpConstant %6 0.5 + %24 = OpTypeBool + %25 = OpTypeVector %24 2 + %30 = OpTypeVector %6 4 + %31 = OpTypePointer Output %30 + %32 = OpVariable %31 Output + %33 = OpTypeInt 32 0 + %34 = OpConstant %33 0 + %35 = OpTypePointer Function %6 + %38 = OpConstant %6 0 + %41 = OpConstantComposite %30 %38 %38 %38 %38 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %18 = OpAccessChain %17 %14 %16 + %19 = OpLoad %7 %18 + %21 = OpCompositeConstruct %7 %20 %20 + %22 = OpExtInst %7 %1 FMix %11 %19 %21 + OpStore %9 %22 + %23 = OpLoad %7 %9 + %26 = OpFOrdEqual %25 %23 %11 + %27 = OpAll %24 %26 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %40 + %28 = OpLabel + %36 = OpAccessChain %35 %9 %34 + %37 = OpLoad %6 %36 + %39 = OpCompositeConstruct %30 %37 %38 %38 %10 + OpStore %32 %39 + OpBranch %29 + %40 = OpLabel + OpStore %32 %41 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE vec2 DATA + 1.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-continue-break-discard-return-in-loop.amber b/vulkan/amber/graphicsfuzz/cov-continue-break-discard-return-in-loop.amber new file mode 100644 index 0000000..745f7b6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-continue-break-discard-return-in-loop.amber @@ -0,0 +1,226 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2, 3] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of zero: 0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# do +# { +# // Always false. +# if(zero == _int_1) +# { +# continue; +# } +# +# // Always false. +# if(zero == _int_2) +# { +# break; +# } +# +# // Always false. +# if(zero == _int_3) +# { +# discard; +# } +# +# return; +# } +# while(false); +# +# // This should never be hit. +# _GLF_color = vec4(_int_0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 73 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %37 "buf1" + OpMemberName %37 0 "zero" + OpName %39 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 4 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpConstant %10 1 + %37 = OpTypeStruct %10 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %44 = OpTypeBool + %51 = OpConstant %10 2 + %60 = OpConstant %10 3 + %68 = OpConstantFalse %44 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %23 = OpAccessChain %18 %16 %17 %22 + %24 = OpLoad %10 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpAccessChain %18 %16 %17 %22 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %10 %29 + %31 = OpConvertSToF %6 %30 + %32 = OpCompositeConstruct %7 %21 %25 %28 %31 + OpStore %9 %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %34 + %34 = OpLabel + %40 = OpAccessChain %18 %39 %17 + %41 = OpLoad %10 %40 + %42 = OpAccessChain %18 %16 %17 %17 + %43 = OpLoad %10 %42 + %45 = OpIEqual %44 %41 %43 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + OpBranch %36 + %47 = OpLabel + %49 = OpAccessChain %18 %39 %17 + %50 = OpLoad %10 %49 + %52 = OpAccessChain %18 %16 %17 %51 + %53 = OpLoad %10 %52 + %54 = OpIEqual %44 %50 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + OpBranch %35 + %56 = OpLabel + %58 = OpAccessChain %18 %39 %17 + %59 = OpLoad %10 %58 + %61 = OpAccessChain %18 %16 %17 %60 + %62 = OpLoad %10 %61 + %63 = OpIEqual %44 %59 %62 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %65 + %64 = OpLabel + OpTerminateInvocation + %65 = OpLabel + OpReturn + %36 = OpLabel + OpBranchConditional %68 %33 %35 + %35 = OpLabel + %69 = OpAccessChain %18 %16 %17 %22 + %70 = OpLoad %10 %69 + %71 = OpConvertSToF %6 %70 + %72 = OpCompositeConstruct %7 %71 %71 %71 %71 + OpStore %9 %72 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 STD140 DATA + 0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-copy-array-elements-except-first-nested-loop-replace-identical-values.amber b/vulkan/amber/graphicsfuzz/cov-copy-array-elements-except-first-nested-loop-replace-identical-values.amber new file mode 100644 index 0000000..c1c41ab --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-copy-array-elements-except-first-nested-loop-replace-identical-values.amber @@ -0,0 +1,361 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 10, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# const int _GLF_global_loop_bound = 15; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int arr0[10] = int[10](0, 0, 0, 0, 0, 0, 0, 0, 0, 0), arr1[10] = int[10](1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +# +# void main() +# { +# // Sets arr[1..9] to zero. +# for(int j = _int_1; j < _int_10; j++) +# { +# _GLF_global_loop_count++; +# arr1[j] = arr0[j]; +# } +# +# // Iterates once. +# for(int i0 = _int_1; _GLF_global_loop_count < _GLF_global_loop_bound; i0 *= _int_2) +# { +# _GLF_global_loop_count++; +# // Iterates four times. +# for(int i1 = 1; i1 < 10 && _GLF_global_loop_count < _GLF_global_loop_bound; i1 += i0) +# { +# _GLF_global_loop_count ++; +# // Iterates once. +# for(int i2 = i1; i2 <= 1 && _GLF_global_loop_count < _GLF_global_loop_bound; i2++) +# { +# _GLF_global_loop_count++; +# // i2 can only be one, and both arr0[1] and arr1[1] are already zero. +# arr0[i2] = arr1[i2]; +# } +# } +# } +# +# // Always true. +# if(arr0[_int_0] == _int_0 && arr1[_int_0] == _int_1 && arr0[_int_1] == _int_0 && arr1[_int_1] == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 166 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %147 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %14 "arr0" + OpName %16 "arr1" + OpName %20 "j" + OpName %23 "buf0" + OpMemberName %23 0 "_GLF_uniform_int_values" + OpName %25 "" + OpName %49 "i0" + OpName %62 "i1" + OpName %76 "i2" + OpName %147 "_GLF_color" + OpDecorate %22 ArrayStride 16 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %147 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 10 + %12 = OpTypeArray %6 %11 + %13 = OpTypePointer Private %12 + %14 = OpVariable %13 Private + %15 = OpConstantComposite %12 %9 %9 %9 %9 %9 %9 %9 %9 %9 %9 + %16 = OpVariable %13 Private + %17 = OpConstant %6 1 + %18 = OpConstantComposite %12 %17 %17 %17 %17 %17 %17 %17 %17 %17 %17 + %19 = OpTypePointer Function %6 + %21 = OpConstant %10 4 + %22 = OpTypeArray %6 %21 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpTypePointer Uniform %6 + %35 = OpConstant %6 2 + %38 = OpTypeBool + %58 = OpConstant %6 15 + %69 = OpConstant %6 10 + %100 = OpConstant %6 3 + %144 = OpTypeFloat 32 + %145 = OpTypeVector %144 4 + %146 = OpTypePointer Output %145 + %147 = OpVariable %146 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %20 = OpVariable %19 Function + %49 = OpVariable %19 Function + %62 = OpVariable %19 Function + %76 = OpVariable %19 Function + OpStore %8 %9 + OpStore %14 %15 + OpStore %16 %18 + %27 = OpAccessChain %26 %25 %9 %9 + %28 = OpLoad %6 %27 + OpStore %20 %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %6 %20 + %36 = OpAccessChain %26 %25 %9 %35 + %37 = OpLoad %6 %36 + %39 = OpSLessThan %38 %34 %37 + OpBranchConditional %39 %30 %31 + %30 = OpLabel + %40 = OpLoad %6 %8 + %41 = OpIAdd %6 %40 %17 + OpStore %8 %41 + %42 = OpLoad %6 %20 + %43 = OpLoad %6 %20 + %44 = OpAccessChain %7 %14 %43 + %45 = OpLoad %6 %44 + %46 = OpAccessChain %7 %16 %42 + OpStore %46 %45 + OpBranch %32 + %32 = OpLabel + %47 = OpLoad %6 %20 + %48 = OpIAdd %6 %47 %17 + OpStore %20 %48 + OpBranch %29 + %31 = OpLabel + %50 = OpAccessChain %26 %25 %9 %9 + %51 = OpLoad %6 %50 + OpStore %49 %51 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %6 %8 + %59 = OpSLessThan %38 %57 %58 + OpBranchConditional %59 %53 %54 + %53 = OpLabel + %60 = OpLoad %6 %8 + %61 = OpIAdd %6 %60 %17 + OpStore %8 %61 + OpStore %62 %17 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %6 %62 + %70 = OpSLessThan %38 %68 %69 + %71 = OpLoad %6 %8 + %72 = OpSLessThan %38 %71 %58 + %73 = OpLogicalAnd %38 %70 %72 + OpBranchConditional %73 %64 %65 + %64 = OpLabel + %74 = OpLoad %6 %8 + %75 = OpIAdd %6 %74 %17 + OpStore %8 %75 + %77 = OpLoad %6 %62 + OpStore %76 %77 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %6 %76 + %84 = OpSLessThanEqual %38 %83 %17 + %85 = OpLoad %6 %8 + %86 = OpSLessThan %38 %85 %58 + %87 = OpLogicalAnd %38 %84 %86 + OpBranchConditional %87 %79 %80 + %79 = OpLabel + %88 = OpLoad %6 %8 + %89 = OpIAdd %6 %88 %17 + OpStore %8 %89 + %90 = OpLoad %6 %76 + %91 = OpLoad %6 %76 + %92 = OpAccessChain %7 %16 %91 + %93 = OpLoad %6 %92 + %94 = OpAccessChain %7 %14 %90 + OpStore %94 %93 + OpBranch %81 + %81 = OpLabel + %95 = OpLoad %6 %76 + %96 = OpIAdd %6 %95 %17 + OpStore %76 %96 + OpBranch %78 + %80 = OpLabel + OpBranch %66 + %66 = OpLabel + %97 = OpLoad %6 %49 + %98 = OpLoad %6 %62 + %99 = OpIAdd %6 %98 %97 + OpStore %62 %99 + OpBranch %63 + %65 = OpLabel + OpBranch %55 + %55 = OpLabel + %101 = OpAccessChain %26 %25 %9 %100 + %102 = OpLoad %6 %101 + %103 = OpLoad %6 %49 + %104 = OpIMul %6 %103 %102 + OpStore %49 %104 + OpBranch %52 + %54 = OpLabel + %105 = OpAccessChain %26 %25 %9 %17 + %106 = OpLoad %6 %105 + %107 = OpAccessChain %7 %14 %106 + %108 = OpLoad %6 %107 + %109 = OpAccessChain %26 %25 %9 %17 + %110 = OpLoad %6 %109 + %111 = OpIEqual %38 %108 %110 + OpSelectionMerge %113 None + OpBranchConditional %111 %112 %113 + %112 = OpLabel + %114 = OpAccessChain %26 %25 %9 %17 + %115 = OpLoad %6 %114 + %116 = OpAccessChain %7 %16 %115 + %117 = OpLoad %6 %116 + %118 = OpAccessChain %26 %25 %9 %9 + %119 = OpLoad %6 %118 + %120 = OpIEqual %38 %117 %119 + OpBranch %113 + %113 = OpLabel + %121 = OpPhi %38 %111 %54 %120 %112 + OpSelectionMerge %123 None + OpBranchConditional %121 %122 %123 + %122 = OpLabel + %124 = OpAccessChain %26 %25 %9 %9 + %125 = OpLoad %6 %124 + %126 = OpAccessChain %7 %14 %125 + %127 = OpLoad %6 %126 + %128 = OpAccessChain %26 %25 %9 %17 + %129 = OpLoad %6 %128 + %130 = OpIEqual %38 %127 %129 + OpBranch %123 + %123 = OpLabel + %131 = OpPhi %38 %121 %113 %130 %122 + OpSelectionMerge %133 None + OpBranchConditional %131 %132 %133 + %132 = OpLabel + %134 = OpAccessChain %26 %25 %9 %9 + %135 = OpLoad %6 %134 + %136 = OpAccessChain %7 %16 %135 + %137 = OpLoad %6 %136 + %138 = OpAccessChain %26 %25 %9 %17 + %139 = OpLoad %6 %138 + %140 = OpIEqual %38 %137 %139 + OpBranch %133 + %133 = OpLabel + %141 = OpPhi %38 %131 %123 %140 %132 + OpSelectionMerge %143 None + OpBranchConditional %141 %142 %161 + %142 = OpLabel + %148 = OpAccessChain %26 %25 %9 %9 + %149 = OpLoad %6 %148 + %150 = OpConvertSToF %144 %149 + %151 = OpAccessChain %26 %25 %9 %17 + %152 = OpLoad %6 %151 + %153 = OpConvertSToF %144 %152 + %154 = OpAccessChain %26 %25 %9 %17 + %155 = OpLoad %6 %154 + %156 = OpConvertSToF %144 %155 + %157 = OpAccessChain %26 %25 %9 %9 + %158 = OpLoad %6 %157 + %159 = OpConvertSToF %144 %158 + %160 = OpCompositeConstruct %145 %150 %153 %156 %159 + OpStore %147 %160 + OpBranch %143 + %161 = OpLabel + %162 = OpAccessChain %26 %25 %9 %17 + %163 = OpLoad %6 %162 + %164 = OpConvertSToF %144 %163 + %165 = OpCompositeConstruct %145 %164 %164 %164 %164 + OpStore %147 %165 + OpBranch %143 + %143 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 10 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-copy-output-color-swizzle-array-indexing.amber b/vulkan/amber/graphicsfuzz/cov-copy-output-color-swizzle-array-indexing.amber new file mode 100644 index 0000000..a524433 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-copy-output-color-swizzle-array-indexing.amber @@ -0,0 +1,153 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: 1 +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = _int_1; +# _GLF_color = vec4(0.0, 1.0, 0.0, 1.0); +# +# vec4 v = _GLF_color; +# v[i - _int_1] = v[i]; +# v[i] = v[i + _int_1]; +# _GLF_color = v; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %22 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %22 "_GLF_color" + OpName %27 "v" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %22 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 1 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %6 + %19 = OpTypeFloat 32 + %20 = OpTypeVector %19 4 + %21 = OpTypePointer Output %20 + %22 = OpVariable %21 Output + %23 = OpConstant %19 0 + %24 = OpConstant %19 1 + %25 = OpConstantComposite %20 %23 %24 %23 %24 + %26 = OpTypePointer Function %20 + %34 = OpTypePointer Function %19 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %27 = OpVariable %26 Function + %17 = OpAccessChain %16 %14 %15 %15 + %18 = OpLoad %6 %17 + OpStore %8 %18 + OpStore %22 %25 + %28 = OpLoad %20 %22 + OpStore %27 %28 + %29 = OpLoad %6 %8 + %30 = OpAccessChain %16 %14 %15 %15 + %31 = OpLoad %6 %30 + %32 = OpISub %6 %29 %31 + %33 = OpLoad %6 %8 + %35 = OpAccessChain %34 %27 %33 + %36 = OpLoad %19 %35 + %37 = OpAccessChain %34 %27 %32 + OpStore %37 %36 + %38 = OpLoad %6 %8 + %39 = OpLoad %6 %8 + %40 = OpAccessChain %16 %14 %15 %15 + %41 = OpLoad %6 %40 + %42 = OpIAdd %6 %39 %41 + %43 = OpAccessChain %34 %27 %42 + %44 = OpLoad %19 %43 + %45 = OpAccessChain %34 %27 %38 + OpStore %45 %44 + %46 = OpLoad %20 %27 + OpStore %22 %46 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-copy-prop-arrays-no-stores.amber b/vulkan/amber/graphicsfuzz/cov-copy-prop-arrays-no-stores.amber new file mode 100644 index 0000000..48f03f8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-copy-prop-arrays-no-stores.amber @@ -0,0 +1,158 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific propagate array copy path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int zero; +# }; +# +# struct Array { +# int values[2]; +# }; +# +# void main() +# { +# Array a; +# a.values[zero] = 1; +# Array b = a; +# float one = 0.0; +# // If condition is always true +# if(b.values[zero] == 1) +# one = 1.0; +# _GLF_color = vec4(one, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %40 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "Array" + OpMemberName %10 0 "values" + OpName %12 "a" + OpName %14 "buf0" + OpMemberName %14 0 "zero" + OpName %16 "" + OpName %23 "b" + OpName %27 "one" + OpName %40 "_GLF_color" + OpMemberDecorate %10 0 RelaxedPrecision + OpMemberDecorate %14 0 RelaxedPrecision + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %19 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %40 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 2 + %9 = OpTypeArray %6 %8 + %10 = OpTypeStruct %9 + %11 = OpTypePointer Function %10 + %13 = OpConstant %6 0 + %14 = OpTypeStruct %6 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypePointer Uniform %6 + %20 = OpConstant %6 1 + %21 = OpTypePointer Function %6 + %25 = OpTypeFloat 32 + %26 = OpTypePointer Function %25 + %28 = OpConstant %25 0 + %33 = OpTypeBool + %37 = OpConstant %25 1 + %38 = OpTypeVector %25 4 + %39 = OpTypePointer Output %38 + %40 = OpVariable %39 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpVariable %11 Function + %23 = OpVariable %11 Function + %27 = OpVariable %26 Function + %18 = OpAccessChain %17 %16 %13 + %19 = OpLoad %6 %18 + %22 = OpAccessChain %21 %12 %13 %19 + OpStore %22 %20 + %24 = OpLoad %10 %12 + OpStore %23 %24 + OpStore %27 %28 + %29 = OpAccessChain %17 %16 %13 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %21 %23 %13 %30 + %32 = OpLoad %6 %31 + %34 = OpIEqual %33 %32 %20 + OpSelectionMerge %36 None + OpBranchConditional %34 %35 %36 + %35 = OpLabel + OpStore %27 %37 + OpBranch %36 + %36 = OpLabel + %41 = OpLoad %25 %27 + %42 = OpCompositeConstruct %38 %41 %28 %28 %37 + OpStore %40 %42 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-copy-prop-arrays-param-uniform.amber b/vulkan/amber/graphicsfuzz/cov-copy-prop-arrays-param-uniform.amber new file mode 100644 index 0000000..be24a97 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-copy-prop-arrays-param-uniform.amber @@ -0,0 +1,299 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific propagate array copy path. + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--merge-return' +# '--reduce-load-size' +# '--if-conversion' +# '--private-to-local' +# '--if-conversion' +# '--eliminate-dead-branches' +# '--eliminate-local-multi-store' +# '--scalar-replacement=100' +# '--vector-dce' +# '--inline-entry-points-exhaustive' +# '--eliminate-local-single-store' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-return' +# '--reduce-load-size' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--redundancy-elimination' +# '--eliminate-dead-branches' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int zero; +# }; +# +# struct Array +# { +# int values[2]; +# }; +# +# // Function always returns 1 +# int func(Array a) +# { +# while(true) +# { +# if(a.values[zero] == 0) +# return 42; +# +# break; +# } +# return 42; +# } +# void main() +# { +# Array a; +# a.values[0] = zero; +# // If condition is always true +# if (func(a) == 42) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 112 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %54 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "Array" + OpMemberName %10 0 "values" + OpName %14 "func(struct-Array-i1[2]1;" + OpName %13 "a" + OpName %24 "buf0" + OpMemberName %24 0 "zero" + OpName %26 "" + OpName %45 "param" + OpName %54 "_GLF_color" + OpMemberDecorate %10 0 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpMemberDecorate %24 0 RelaxedPrecision + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 0 + OpDecorate %29 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %54 Location 0 + OpDecorate %61 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %74 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %86 RelaxedPrecision + OpDecorate %87 RelaxedPrecision + OpDecorate %102 RelaxedPrecision + OpDecorate %106 RelaxedPrecision + OpDecorate %109 RelaxedPrecision + OpDecorate %110 RelaxedPrecision + OpDecorate %111 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 2 + %9 = OpTypeArray %6 %8 + %10 = OpTypeStruct %9 + %11 = OpTypePointer Function %10 + %12 = OpTypeFunction %6 %11 + %21 = OpTypeBool + %22 = OpConstantTrue %21 + %23 = OpConstant %6 0 + %24 = OpTypeStruct %6 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpTypePointer Uniform %6 + %30 = OpTypePointer Function %6 + %36 = OpConstant %6 42 + %51 = OpTypeFloat 32 + %52 = OpTypeVector %51 4 + %53 = OpTypePointer Output %52 + %54 = OpVariable %53 Output + %55 = OpConstant %51 1 + %56 = OpConstant %51 0 + %57 = OpConstantComposite %52 %55 %56 %56 %55 + %59 = OpConstantComposite %52 %56 %56 %56 %56 + %66 = OpConstantFalse %21 + %67 = OpTypePointer Function %21 + %78 = OpUndef %6 + %79 = OpUndef %21 + %80 = OpTypePointer Function %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %85 = OpVariable %67 Function %66 + %86 = OpVariable %30 Function + %87 = OpVariable %30 Function + %81 = OpVariable %80 Function + %45 = OpVariable %11 Function + %42 = OpAccessChain %27 %26 %23 + %43 = OpLoad %6 %42 + %110 = OpLoad %9 %81 + %111 = OpCompositeInsert %9 %43 %110 0 + OpStore %81 %111 + %83 = OpLoad %9 %81 + %84 = OpCompositeConstruct %10 %83 + OpStore %45 %84 + OpStore %85 %66 + OpBranch %88 + %88 = OpLabel + OpLoopMerge %91 %89 None + OpBranch %93 + %93 = OpLabel + OpLoopMerge %96 %94 None + OpBranch %98 + %98 = OpLabel + %101 = OpAccessChain %30 %45 %23 %43 + %102 = OpLoad %6 %101 + %103 = OpIEqual %21 %102 %23 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + OpStore %85 %22 + OpStore %86 %36 + OpBranch %96 + %104 = OpLabel + OpBranch %96 + %94 = OpLabel + OpBranch %93 + %96 = OpLabel + %106 = OpPhi %6 %36 %105 %78 %104 + %107 = OpPhi %21 %22 %105 %66 %104 + OpSelectionMerge %108 None + OpBranchConditional %107 %91 %108 + %108 = OpLabel + OpStore %85 %22 + OpStore %86 %36 + OpBranch %91 + %89 = OpLabel + OpBranch %88 + %91 = OpLabel + %109 = OpPhi %6 %106 %96 %36 %108 + OpStore %87 %109 + %48 = OpIEqual %21 %109 %36 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %58 + %58 = OpLabel + OpStore %54 %59 + OpBranch %50 + %49 = OpLabel + OpStore %54 %57 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %6 None %12 + %13 = OpFunctionParameter %11 + %15 = OpLabel + %68 = OpVariable %67 Function %66 + %61 = OpVariable %30 Function + OpBranch %63 + %63 = OpLabel + %73 = OpPhi %21 %66 %15 %79 %65 + OpLoopMerge %60 %65 None + OpBranch %64 + %64 = OpLabel + OpBranch %16 + %16 = OpLabel + %72 = OpPhi %21 %73 %64 %79 %19 + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + OpBranch %17 + %17 = OpLabel + %28 = OpAccessChain %27 %26 %23 + %29 = OpLoad %6 %28 + %31 = OpAccessChain %30 %13 %23 %29 + %32 = OpLoad %6 %31 + %33 = OpIEqual %21 %32 %23 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %35 + %34 = OpLabel + OpStore %68 %22 + OpStore %61 %36 + OpBranch %18 + %35 = OpLabel + OpBranch %18 + %19 = OpLabel + OpBranch %16 + %18 = OpLabel + %75 = OpPhi %6 %36 %34 %78 %35 + %71 = OpPhi %21 %22 %34 %72 %35 + OpSelectionMerge %69 None + OpBranchConditional %71 %60 %69 + %69 = OpLabel + OpStore %68 %22 + OpStore %61 %36 + OpBranch %60 + %65 = OpLabel + OpBranch %63 + %60 = OpLabel + %74 = OpPhi %6 %75 %18 %36 %69 + OpReturnValue %74 + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-cosh-clamped-to-one.amber b/vulkan/amber/graphicsfuzz/cov-cosh-clamped-to-one.amber new file mode 100644 index 0000000..bd2bd08 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-cosh-clamped-to-one.amber @@ -0,0 +1,162 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# // Contents of _GLF_uniform_int_values: 0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[1]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v = clamp(cosh(vec4(1.0)), _float_1_0, 1.0); +# _GLF_color = vec4(v.x, _int_0, _int_0, v.z); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %28 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %16 "buf0" + OpMemberName %16 0 "_GLF_uniform_float_values" + OpName %18 "" + OpName %28 "_GLF_color" + OpName %34 "buf1" + OpMemberName %34 0 "_GLF_uniform_int_values" + OpName %36 "" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %28 Location 0 + OpDecorate %33 ArrayStride 16 + OpMemberDecorate %34 0 Offset 0 + OpDecorate %34 Block + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 1 + %15 = OpTypeArray %6 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpTypeInt 32 1 + %20 = OpConstant %19 0 + %21 = OpTypePointer Uniform %6 + %27 = OpTypePointer Output %7 + %28 = OpVariable %27 Output + %29 = OpConstant %13 0 + %30 = OpTypePointer Function %6 + %33 = OpTypeArray %19 %14 + %34 = OpTypeStruct %33 + %35 = OpTypePointer Uniform %34 + %36 = OpVariable %35 Uniform + %37 = OpTypePointer Uniform %19 + %44 = OpConstant %13 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %12 = OpExtInst %7 %1 Cosh %11 + %22 = OpAccessChain %21 %18 %20 %20 + %23 = OpLoad %6 %22 + %24 = OpCompositeConstruct %7 %23 %23 %23 %23 + %25 = OpCompositeConstruct %7 %10 %10 %10 %10 + %26 = OpExtInst %7 %1 FClamp %12 %24 %25 + OpStore %9 %26 + %31 = OpAccessChain %30 %9 %29 + %32 = OpLoad %6 %31 + %38 = OpAccessChain %37 %36 %20 %20 + %39 = OpLoad %19 %38 + %40 = OpConvertSToF %6 %39 + %41 = OpAccessChain %37 %36 %20 %20 + %42 = OpLoad %19 %41 + %43 = OpConvertSToF %6 %42 + %45 = OpAccessChain %30 %9 %44 + %46 = OpLoad %6 %45 + %47 = OpCompositeConstruct %7 %32 %40 %43 %46 + OpStore %28 %47 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-cumulate-loops-unreachable.amber b/vulkan/amber/graphicsfuzz/cov-cumulate-loops-unreachable.amber new file mode 100644 index 0000000..a12c276 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-cumulate-loops-unreachable.amber @@ -0,0 +1,483 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_28 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_2 _GLF_uniform_int_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [10, 28, 0, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# int b = _int_1; +# _GLF_color = vec4(_int_0); +# +# for(int i = _int_0; i < _int_10; i++) +# { +# if(i > _int_1) +# { +# a++; +# +# if(false) +# for(int i = _int_0; i < _int_10; i++) +# return; +# } +# } +# +# for(int i = _int_0; i < _int_10; i++) +# { +# a += int[2](_int_1, _int_2)[b]; +# } +# +# if(a == _int_28) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 122 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %27 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "b" + OpName %27 "_GLF_color" + OpName %32 "i" + OpName %57 "i" + OpName %74 "i" + OpName %96 "indexable" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %27 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 5 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %6 3 + %24 = OpTypeFloat 32 + %25 = OpTypeVector %24 4 + %26 = OpTypePointer Output %25 + %27 = OpVariable %26 Output + %43 = OpTypeBool + %52 = OpConstant %6 1 + %54 = OpConstantFalse %43 + %88 = OpConstant %6 4 + %91 = OpConstant %9 2 + %92 = OpTypeArray %6 %91 + %95 = OpTypePointer Function %92 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %32 = OpVariable %7 Function + %57 = OpVariable %7 Function + %74 = OpVariable %7 Function + %96 = OpVariable %95 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %22 = OpAccessChain %17 %14 %15 %21 + %23 = OpLoad %6 %22 + OpStore %20 %23 + %28 = OpAccessChain %17 %14 %15 %16 + %29 = OpLoad %6 %28 + %30 = OpConvertSToF %24 %29 + %31 = OpCompositeConstruct %25 %30 %30 %30 %30 + OpStore %27 %31 + %33 = OpAccessChain %17 %14 %15 %16 + %34 = OpLoad %6 %33 + OpStore %32 %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %6 %32 + %41 = OpAccessChain %17 %14 %15 %15 + %42 = OpLoad %6 %41 + %44 = OpSLessThan %43 %40 %42 + OpBranchConditional %44 %36 %37 + %36 = OpLabel + %45 = OpLoad %6 %32 + %46 = OpAccessChain %17 %14 %15 %21 + %47 = OpLoad %6 %46 + %48 = OpSGreaterThan %43 %45 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %50 + %49 = OpLabel + %51 = OpLoad %6 %8 + %53 = OpIAdd %6 %51 %52 + OpStore %8 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + %58 = OpAccessChain %17 %14 %15 %16 + %59 = OpLoad %6 %58 + OpStore %57 %59 + OpBranch %60 + %60 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %6 %57 + %66 = OpAccessChain %17 %14 %15 %15 + %67 = OpLoad %6 %66 + %68 = OpSLessThan %43 %65 %67 + OpBranchConditional %68 %61 %62 + %61 = OpLabel + OpReturn + %63 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %50 + %50 = OpLabel + OpBranch %38 + %38 = OpLabel + %72 = OpLoad %6 %32 + %73 = OpIAdd %6 %72 %52 + OpStore %32 %73 + OpBranch %35 + %37 = OpLabel + %75 = OpAccessChain %17 %14 %15 %16 + %76 = OpLoad %6 %75 + OpStore %74 %76 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %6 %74 + %83 = OpAccessChain %17 %14 %15 %15 + %84 = OpLoad %6 %83 + %85 = OpSLessThan %43 %82 %84 + OpBranchConditional %85 %78 %79 + %78 = OpLabel + %86 = OpAccessChain %17 %14 %15 %21 + %87 = OpLoad %6 %86 + %89 = OpAccessChain %17 %14 %15 %88 + %90 = OpLoad %6 %89 + %93 = OpCompositeConstruct %92 %87 %90 + %94 = OpLoad %6 %20 + OpStore %96 %93 + %97 = OpAccessChain %7 %96 %94 + %98 = OpLoad %6 %97 + %99 = OpLoad %6 %8 + %100 = OpIAdd %6 %99 %98 + OpStore %8 %100 + OpBranch %80 + %80 = OpLabel + %101 = OpLoad %6 %74 + %102 = OpIAdd %6 %101 %52 + OpStore %74 %102 + OpBranch %77 + %79 = OpLabel + %103 = OpLoad %6 %8 + %104 = OpAccessChain %17 %14 %15 %52 + %105 = OpLoad %6 %104 + %106 = OpIEqual %43 %103 %105 + OpSelectionMerge %108 None + OpBranchConditional %106 %107 %108 + %107 = OpLabel + %109 = OpAccessChain %17 %14 %15 %21 + %110 = OpLoad %6 %109 + %111 = OpConvertSToF %24 %110 + %112 = OpAccessChain %17 %14 %15 %16 + %113 = OpLoad %6 %112 + %114 = OpConvertSToF %24 %113 + %115 = OpAccessChain %17 %14 %15 %16 + %116 = OpLoad %6 %115 + %117 = OpConvertSToF %24 %116 + %118 = OpAccessChain %17 %14 %15 %21 + %119 = OpLoad %6 %118 + %120 = OpConvertSToF %24 %119 + %121 = OpCompositeConstruct %25 %111 %114 %117 %120 + OpStore %27 %121 + OpBranch %108 + %108 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 28 0 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant__vertex_shader PASSTHROUGH + +# variant__fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 0; +# int b = 1; +# _GLF_color = vec4(0); +# +# for(int i = 0; i < 10; i++) +# { +# if (i > 1) +# { +# a++; +# +# if (false) +# for(int i = 0; i < 10; i++) +# return; +# } +# } +# +# for(int i = 0; i < 10; i++) +# a += int[2](1, 2)[b]; +# +# if (a == 28) +# _GLF_color = vec4(1, 0, 0, 1); +# } +SHADER fragment variant__fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %15 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %10 "b" + OpName %15 "_GLF_color" + OpName %18 "i" + OpName %37 "i" + OpName %50 "i" + OpName %65 "indexable" + OpDecorate %15 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %11 = OpConstant %6 1 + %12 = OpTypeFloat 32 + %13 = OpTypeVector %12 4 + %14 = OpTypePointer Output %13 + %15 = OpVariable %14 Output + %16 = OpConstant %12 0 + %17 = OpConstantComposite %13 %16 %16 %16 %16 + %25 = OpConstant %6 10 + %26 = OpTypeBool + %34 = OpConstantFalse %26 + %58 = OpTypeInt 32 0 + %59 = OpConstant %58 2 + %60 = OpTypeArray %6 %59 + %61 = OpConstant %6 2 + %62 = OpConstantComposite %60 %11 %61 + %64 = OpTypePointer Function %60 + %73 = OpConstant %6 28 + %77 = OpConstant %12 1 + %78 = OpConstantComposite %13 %77 %16 %16 %77 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %18 = OpVariable %7 Function + %37 = OpVariable %7 Function + %50 = OpVariable %7 Function + %65 = OpVariable %64 Function + OpStore %8 %9 + OpStore %10 %11 + OpStore %15 %17 + OpStore %18 %9 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %6 %18 + %27 = OpSLessThan %26 %24 %25 + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %28 = OpLoad %6 %18 + %29 = OpSGreaterThan %26 %28 %11 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %31 + %30 = OpLabel + %32 = OpLoad %6 %8 + %33 = OpIAdd %6 %32 %11 + OpStore %8 %33 + OpSelectionMerge %36 None + OpBranchConditional %34 %35 %36 + %35 = OpLabel + OpStore %37 %9 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %6 %37 + %44 = OpSLessThan %26 %43 %25 + OpBranchConditional %44 %39 %40 + %39 = OpLabel + OpReturn + %41 = OpLabel + OpBranch %38 + %40 = OpLabel + OpBranch %36 + %36 = OpLabel + OpBranch %31 + %31 = OpLabel + OpBranch %22 + %22 = OpLabel + %48 = OpLoad %6 %18 + %49 = OpIAdd %6 %48 %11 + OpStore %18 %49 + OpBranch %19 + %21 = OpLabel + OpStore %50 %9 + OpBranch %51 + %51 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %6 %50 + %57 = OpSLessThan %26 %56 %25 + OpBranchConditional %57 %52 %53 + %52 = OpLabel + %63 = OpLoad %6 %10 + OpStore %65 %62 + %66 = OpAccessChain %7 %65 %63 + %67 = OpLoad %6 %66 + %68 = OpLoad %6 %8 + %69 = OpIAdd %6 %68 %67 + OpStore %8 %69 + OpBranch %54 + %54 = OpLabel + %70 = OpLoad %6 %50 + %71 = OpIAdd %6 %70 %11 + OpStore %50 %71 + OpBranch %51 + %53 = OpLabel + %72 = OpLoad %6 %8 + %74 = OpIEqual %26 %72 %73 + OpSelectionMerge %76 None + OpBranchConditional %74 %75 %76 + %75 = OpLabel + OpStore %15 %78 + OpBranch %76 + %76 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant_ + +# injectionSwitch +BUFFER variant__injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant__framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant__pipeline + ATTACH variant__vertex_shader + ATTACH variant__fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant__framebuffer AS color LOCATION 0 + BIND BUFFER variant__injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant__pipeline 0 0 0 255 + +CLEAR variant__pipeline +RUN variant__pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant__framebuffer TOLERANCE 0.005 +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array.amber b/vulkan/amber/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array.amber new file mode 100644 index 0000000..a8da49c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array.amber @@ -0,0 +1,247 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific DAG combiner code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_2_0 _GLF_uniform_float_values[1] +# #define _float_0_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 2.0] +# layout(set = 0, binding = 1) uniform buf1 { +# float _GLF_uniform_float_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float A1[3] = float[3](_float_0_0, _float_1_0, _float_2_0); +# +# // a becomes undefined. This results in an undefined value, not undefined behavior. +# int a = clamp(_int_1, _int_1, _int_0); +# +# float b = A1[clamp(a, _int_0, _int_1)]; +# +# // Always true. +# bool c = b < A1[_int_0] ? (_float_1_0 > _float_0_0) : (_float_1_0 < A1[_int_2]); +# +# if (c) +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# else +# _GLF_color = vec4(_float_1_0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 101 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %83 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "A1" + OpName %13 "buf1" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %29 "a" + OpName %31 "buf0" + OpMemberName %31 0 "_GLF_uniform_int_values" + OpName %33 "" + OpName %43 "b" + OpName %54 "c" + OpName %83 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %30 ArrayStride 16 + OpMemberDecorate %31 0 Offset 0 + OpDecorate %31 Block + OpDecorate %33 DescriptorSet 0 + OpDecorate %33 Binding 0 + OpDecorate %83 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 3 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpTypeArray %6 %8 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpConstant %16 2 + %19 = OpTypePointer Uniform %6 + %24 = OpConstant %16 1 + %28 = OpTypePointer Function %16 + %30 = OpTypeArray %16 %8 + %31 = OpTypeStruct %30 + %32 = OpTypePointer Uniform %31 + %33 = OpVariable %32 Uniform + %34 = OpTypePointer Uniform %16 + %42 = OpTypePointer Function %6 + %52 = OpTypeBool + %53 = OpTypePointer Function %52 + %81 = OpTypeVector %6 4 + %82 = OpTypePointer Output %81 + %83 = OpVariable %82 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %29 = OpVariable %28 Function + %43 = OpVariable %42 Function + %54 = OpVariable %53 Function + %61 = OpVariable %53 Function + %20 = OpAccessChain %19 %15 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %15 %17 %17 + %23 = OpLoad %6 %22 + %25 = OpAccessChain %19 %15 %17 %24 + %26 = OpLoad %6 %25 + %27 = OpCompositeConstruct %9 %21 %23 %26 + OpStore %11 %27 + %35 = OpAccessChain %34 %33 %17 %17 + %36 = OpLoad %16 %35 + %37 = OpAccessChain %34 %33 %17 %17 + %38 = OpLoad %16 %37 + %39 = OpAccessChain %34 %33 %17 %24 + %40 = OpLoad %16 %39 + %41 = OpExtInst %16 %1 SClamp %36 %38 %40 + OpStore %29 %41 + %44 = OpLoad %16 %29 + %45 = OpAccessChain %34 %33 %17 %24 + %46 = OpLoad %16 %45 + %47 = OpAccessChain %34 %33 %17 %17 + %48 = OpLoad %16 %47 + %49 = OpExtInst %16 %1 SClamp %44 %46 %48 + %50 = OpAccessChain %42 %11 %49 + %51 = OpLoad %6 %50 + OpStore %43 %51 + %55 = OpLoad %6 %43 + %56 = OpAccessChain %34 %33 %17 %24 + %57 = OpLoad %16 %56 + %58 = OpAccessChain %42 %11 %57 + %59 = OpLoad %6 %58 + %60 = OpFOrdLessThan %52 %55 %59 + OpSelectionMerge %63 None + OpBranchConditional %60 %62 %69 + %62 = OpLabel + %64 = OpAccessChain %19 %15 %17 %17 + %65 = OpLoad %6 %64 + %66 = OpAccessChain %19 %15 %17 %18 + %67 = OpLoad %6 %66 + %68 = OpFOrdGreaterThan %52 %65 %67 + OpStore %61 %68 + OpBranch %63 + %69 = OpLabel + %70 = OpAccessChain %19 %15 %17 %17 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %34 %33 %17 %18 + %73 = OpLoad %16 %72 + %74 = OpAccessChain %42 %11 %73 + %75 = OpLoad %6 %74 + %76 = OpFOrdLessThan %52 %71 %75 + OpStore %61 %76 + OpBranch %63 + %63 = OpLabel + %77 = OpLoad %52 %61 + OpStore %54 %77 + %78 = OpLoad %52 %54 + OpSelectionMerge %80 None + OpBranchConditional %78 %79 %97 + %79 = OpLabel + %84 = OpAccessChain %34 %33 %17 %17 + %85 = OpLoad %16 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpAccessChain %34 %33 %17 %24 + %88 = OpLoad %16 %87 + %89 = OpConvertSToF %6 %88 + %90 = OpAccessChain %34 %33 %17 %24 + %91 = OpLoad %16 %90 + %92 = OpConvertSToF %6 %91 + %93 = OpAccessChain %34 %33 %17 %17 + %94 = OpLoad %16 %93 + %95 = OpConvertSToF %6 %94 + %96 = OpCompositeConstruct %81 %86 %89 %92 %95 + OpStore %83 %96 + OpBranch %80 + %97 = OpLabel + %98 = OpAccessChain %19 %15 %17 %17 + %99 = OpLoad %6 %98 + %100 = OpCompositeConstruct %81 %99 %99 %99 %99 + OpStore %83 %100 + OpBranch %80 + %80 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 2.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop.amber b/vulkan/amber/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop.amber new file mode 100644 index 0000000..f927c31 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop.amber @@ -0,0 +1,218 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers DAG combiner, cast combining and legalize vector types code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2, 3] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v = vec4(_int_3); +# for (int i = _int_0; i < _int_3; i++) +# { +# v.xyz[i] = float(i); +# } +# if (v == vec4(_int_0, _int_1, _int_2, _int_3)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 93 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %74 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %25 "i" + OpName %74 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %74 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 4 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpConstant %10 3 + %19 = OpTypePointer Uniform %10 + %24 = OpTypePointer Function %10 + %36 = OpTypeBool + %39 = OpTypeVector %6 3 + %42 = OpConstant %11 0 + %43 = OpConstant %11 1 + %44 = OpConstant %11 2 + %45 = OpTypeVector %11 3 + %46 = OpConstantComposite %45 %42 %43 %44 + %48 = OpTypePointer Function %6 + %51 = OpConstant %10 1 + %60 = OpConstant %10 2 + %68 = OpTypeVector %36 4 + %73 = OpTypePointer Output %7 + %74 = OpVariable %73 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %25 = OpVariable %24 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %10 %20 + %22 = OpConvertSToF %6 %21 + %23 = OpCompositeConstruct %7 %22 %22 %22 %22 + OpStore %9 %23 + %26 = OpAccessChain %19 %16 %17 %17 + %27 = OpLoad %10 %26 + OpStore %25 %27 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %10 %25 + %34 = OpAccessChain %19 %16 %17 %18 + %35 = OpLoad %10 %34 + %37 = OpSLessThan %36 %33 %35 + OpBranchConditional %37 %29 %30 + %29 = OpLabel + %38 = OpLoad %10 %25 + %40 = OpLoad %10 %25 + %41 = OpConvertSToF %6 %40 + %47 = OpVectorExtractDynamic %11 %46 %38 + %49 = OpAccessChain %48 %9 %47 + OpStore %49 %41 + OpBranch %31 + %31 = OpLabel + %50 = OpLoad %10 %25 + %52 = OpIAdd %10 %50 %51 + OpStore %25 %52 + OpBranch %28 + %30 = OpLabel + %53 = OpLoad %7 %9 + %54 = OpAccessChain %19 %16 %17 %17 + %55 = OpLoad %10 %54 + %56 = OpConvertSToF %6 %55 + %57 = OpAccessChain %19 %16 %17 %51 + %58 = OpLoad %10 %57 + %59 = OpConvertSToF %6 %58 + %61 = OpAccessChain %19 %16 %17 %60 + %62 = OpLoad %10 %61 + %63 = OpConvertSToF %6 %62 + %64 = OpAccessChain %19 %16 %17 %18 + %65 = OpLoad %10 %64 + %66 = OpConvertSToF %6 %65 + %67 = OpCompositeConstruct %7 %56 %59 %63 %66 + %69 = OpFOrdEqual %68 %53 %67 + %70 = OpAll %36 %69 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %88 + %71 = OpLabel + %75 = OpAccessChain %19 %16 %17 %51 + %76 = OpLoad %10 %75 + %77 = OpConvertSToF %6 %76 + %78 = OpAccessChain %19 %16 %17 %17 + %79 = OpLoad %10 %78 + %80 = OpConvertSToF %6 %79 + %81 = OpAccessChain %19 %16 %17 %17 + %82 = OpLoad %10 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpAccessChain %19 %16 %17 %51 + %85 = OpLoad %10 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpCompositeConstruct %7 %77 %80 %83 %86 + OpStore %74 %87 + OpBranch %72 + %88 = OpLabel + %89 = OpAccessChain %19 %16 %17 %17 + %90 = OpLoad %10 %89 + %91 = OpConvertSToF %6 %90 + %92 = OpCompositeConstruct %7 %91 %91 %91 %91 + OpStore %74 %92 + OpBranch %72 + %72 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-dag-combiner-findmsb-loop.amber b/vulkan/amber/graphicsfuzz/cov-dag-combiner-findmsb-loop.amber new file mode 100644 index 0000000..2ceacaf --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-dag-combiner-findmsb-loop.amber @@ -0,0 +1,216 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific DAG combiner code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_4 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [3, 4, 0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1; +# +# // i = 0: a = 0 -> 2 +# // i = 1: a = 2 -> 3 +# // i = 2: a = 3 -> 4 +# for (int i = _int_0; i < _int_3; i++) +# { +# do +# { +# a++; +# } while (findMSB(a) < _int_1); +# } +# if (a == _int_4) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 76 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %57 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %57 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %57 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 3 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %6 2 + %32 = OpTypeBool + %39 = OpConstant %6 1 + %54 = OpTypeFloat 32 + %55 = OpTypeVector %54 4 + %56 = OpTypePointer Output %55 + %57 = OpVariable %56 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %22 = OpAccessChain %17 %14 %15 %21 + %23 = OpLoad %6 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %20 + %30 = OpAccessChain %17 %14 %15 %15 + %31 = OpLoad %6 %30 + %33 = OpSLessThan %32 %29 %31 + OpBranchConditional %33 %25 %26 + %25 = OpLabel + OpBranch %34 + %34 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %35 + %35 = OpLabel + %38 = OpLoad %6 %8 + %40 = OpIAdd %6 %38 %39 + OpStore %8 %40 + OpBranch %37 + %37 = OpLabel + %41 = OpLoad %6 %8 + %42 = OpExtInst %6 %1 FindSMsb %41 + %43 = OpAccessChain %17 %14 %15 %16 + %44 = OpLoad %6 %43 + %45 = OpSLessThan %32 %42 %44 + OpBranchConditional %45 %34 %36 + %36 = OpLabel + OpBranch %27 + %27 = OpLabel + %46 = OpLoad %6 %20 + %47 = OpIAdd %6 %46 %39 + OpStore %20 %47 + OpBranch %24 + %26 = OpLabel + %48 = OpLoad %6 %8 + %49 = OpAccessChain %17 %14 %15 %39 + %50 = OpLoad %6 %49 + %51 = OpIEqual %32 %48 %50 + OpSelectionMerge %53 None + OpBranchConditional %51 %52 %71 + %52 = OpLabel + %58 = OpAccessChain %17 %14 %15 %16 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %54 %59 + %61 = OpAccessChain %17 %14 %15 %21 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %54 %62 + %64 = OpAccessChain %17 %14 %15 %21 + %65 = OpLoad %6 %64 + %66 = OpConvertSToF %54 %65 + %67 = OpAccessChain %17 %14 %15 %16 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %54 %68 + %70 = OpCompositeConstruct %55 %60 %63 %66 %69 + OpStore %57 %70 + OpBranch %53 + %71 = OpLabel + %72 = OpAccessChain %17 %14 %15 %21 + %73 = OpLoad %6 %72 + %74 = OpConvertSToF %54 %73 + %75 = OpCompositeConstruct %55 %74 %74 %74 %74 + OpStore %57 %75 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32 DATA + 3 0 0 0 + 4 0 0 0 + 0 0 0 0 + 1 0 0 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-dag-combiner-glf_color.amber b/vulkan/amber/graphicsfuzz/cov-dag-combiner-glf_color.amber new file mode 100644 index 0000000..948a58d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-dag-combiner-glf_color.amber @@ -0,0 +1,277 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific dag combiner code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_4 _GLF_uniform_float_values[1] +# #define _float_2_0 _GLF_uniform_float_values[2] +# #define _float_3_0 _GLF_uniform_float_values[3] +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.4, 2.0, 3.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float func(float b) +# { +# _GLF_color = vec4(_float_1_0, _float_1_0, _float_0_4, 1.0); +# _GLF_color = _GLF_color; +# if (_float_1_0 >= b) +# { +# return _float_1_0; +# } +# return _float_2_0; +# } +# +# void main() +# { +# // func returns 1.0. +# float a = func(_float_1_0); +# +# // func returns 2.0. +# a += func(_float_1_0 + _float_1_0); +# +# if (a == _float_3_0 && +# _GLF_color == vec4(_float_1_0, _float_1_0, _float_0_4, _float_1_0)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 110 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %14 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "func(f1;" + OpName %9 "b" + OpName %14 "_GLF_color" + OpName %18 "buf1" + OpMemberName %18 0 "_GLF_uniform_float_values" + OpName %20 "" + OpName %49 "a" + OpName %50 "param" + OpName %59 "param" + OpName %88 "buf0" + OpMemberName %88 0 "_GLF_uniform_int_values" + OpName %90 "" + OpDecorate %14 Location 0 + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %87 ArrayStride 16 + OpMemberDecorate %88 0 RelaxedPrecision + OpMemberDecorate %88 0 Offset 0 + OpDecorate %88 Block + OpDecorate %90 DescriptorSet 0 + OpDecorate %90 Binding 0 + OpDecorate %93 RelaxedPrecision + OpDecorate %96 RelaxedPrecision + OpDecorate %99 RelaxedPrecision + OpDecorate %102 RelaxedPrecision + OpDecorate %107 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %12 = OpTypeVector %6 4 + %13 = OpTypePointer Output %12 + %14 = OpVariable %13 Output + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 4 + %17 = OpTypeArray %6 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypeInt 32 1 + %22 = OpConstant %21 0 + %23 = OpTypePointer Uniform %6 + %28 = OpConstant %21 1 + %31 = OpConstant %6 1 + %37 = OpTypeBool + %44 = OpConstant %21 2 + %64 = OpConstant %21 3 + %80 = OpTypeVector %37 4 + %86 = OpConstant %15 2 + %87 = OpTypeArray %21 %86 + %88 = OpTypeStruct %87 + %89 = OpTypePointer Uniform %88 + %90 = OpVariable %89 Uniform + %91 = OpTypePointer Uniform %21 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %49 = OpVariable %7 Function + %50 = OpVariable %7 Function + %59 = OpVariable %7 Function + %51 = OpAccessChain %23 %20 %22 %22 + %52 = OpLoad %6 %51 + OpStore %50 %52 + %53 = OpFunctionCall %6 %10 %50 + OpStore %49 %53 + %54 = OpAccessChain %23 %20 %22 %22 + %55 = OpLoad %6 %54 + %56 = OpAccessChain %23 %20 %22 %22 + %57 = OpLoad %6 %56 + %58 = OpFAdd %6 %55 %57 + OpStore %59 %58 + %60 = OpFunctionCall %6 %10 %59 + %61 = OpLoad %6 %49 + %62 = OpFAdd %6 %61 %60 + OpStore %49 %62 + %63 = OpLoad %6 %49 + %65 = OpAccessChain %23 %20 %22 %64 + %66 = OpLoad %6 %65 + %67 = OpFOrdEqual %37 %63 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %69 + %68 = OpLabel + %70 = OpLoad %12 %14 + %71 = OpAccessChain %23 %20 %22 %22 + %72 = OpLoad %6 %71 + %73 = OpAccessChain %23 %20 %22 %22 + %74 = OpLoad %6 %73 + %75 = OpAccessChain %23 %20 %22 %28 + %76 = OpLoad %6 %75 + %77 = OpAccessChain %23 %20 %22 %22 + %78 = OpLoad %6 %77 + %79 = OpCompositeConstruct %12 %72 %74 %76 %78 + %81 = OpFOrdEqual %80 %70 %79 + %82 = OpAll %37 %81 + OpBranch %69 + %69 = OpLabel + %83 = OpPhi %37 %67 %5 %82 %68 + OpSelectionMerge %85 None + OpBranchConditional %83 %84 %105 + %84 = OpLabel + %92 = OpAccessChain %91 %90 %22 %22 + %93 = OpLoad %21 %92 + %94 = OpConvertSToF %6 %93 + %95 = OpAccessChain %91 %90 %22 %28 + %96 = OpLoad %21 %95 + %97 = OpConvertSToF %6 %96 + %98 = OpAccessChain %91 %90 %22 %28 + %99 = OpLoad %21 %98 + %100 = OpConvertSToF %6 %99 + %101 = OpAccessChain %91 %90 %22 %22 + %102 = OpLoad %21 %101 + %103 = OpConvertSToF %6 %102 + %104 = OpCompositeConstruct %12 %94 %97 %100 %103 + OpStore %14 %104 + OpBranch %85 + %105 = OpLabel + %106 = OpAccessChain %91 %90 %22 %28 + %107 = OpLoad %21 %106 + %108 = OpConvertSToF %6 %107 + %109 = OpCompositeConstruct %12 %108 %108 %108 %108 + OpStore %14 %109 + OpBranch %85 + %85 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %24 = OpAccessChain %23 %20 %22 %22 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %23 %20 %22 %22 + %27 = OpLoad %6 %26 + %29 = OpAccessChain %23 %20 %22 %28 + %30 = OpLoad %6 %29 + %32 = OpCompositeConstruct %12 %25 %27 %30 %31 + OpStore %14 %32 + %33 = OpLoad %12 %14 + OpStore %14 %33 + %34 = OpAccessChain %23 %20 %22 %22 + %35 = OpLoad %6 %34 + %36 = OpLoad %6 %9 + %38 = OpFOrdGreaterThanEqual %37 %35 %36 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + %41 = OpAccessChain %23 %20 %22 %22 + %42 = OpLoad %6 %41 + OpReturnValue %42 + %40 = OpLabel + %45 = OpAccessChain %23 %20 %22 %44 + %46 = OpLoad %6 %45 + OpReturnValue %46 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.4 2.0 3.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-dag-combiner-increment-color.amber b/vulkan/amber/graphicsfuzz/cov-dag-combiner-increment-color.amber new file mode 100644 index 0000000..4d3297a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-dag-combiner-increment-color.amber @@ -0,0 +1,179 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific DAG combiner code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _float_0_5 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_0_2 _GLF_uniform_float_values[2] +# #define _float_1_0 _GLF_uniform_float_values[3] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.5, 0.0, 0.2, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = _float_0_0; +# if (_float_1_0 > _float_0_5) +# { +# a += _float_0_5; +# _GLF_color = vec4(a); +# if (_float_1_0 > _float_0_0) +# { +# a += _GLF_color.x; +# _GLF_color = vec4(_float_0_2); +# } +# } +# _GLF_color = vec4(a, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 60 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %36 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %36 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %36 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 1 + %18 = OpTypePointer Uniform %6 + %21 = OpConstant %15 3 + %26 = OpTypeBool + %34 = OpTypeVector %6 4 + %35 = OpTypePointer Output %34 + %36 = OpVariable %35 Output + %46 = OpConstant %9 0 + %47 = OpTypePointer Output %6 + %52 = OpConstant %15 2 + %57 = OpConstant %6 0 + %58 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %6 %19 + OpStore %8 %20 + %22 = OpAccessChain %18 %14 %16 %21 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %18 %14 %16 %16 + %25 = OpLoad %6 %24 + %27 = OpFOrdGreaterThan %26 %23 %25 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %29 + %28 = OpLabel + %30 = OpAccessChain %18 %14 %16 %16 + %31 = OpLoad %6 %30 + %32 = OpLoad %6 %8 + %33 = OpFAdd %6 %32 %31 + OpStore %8 %33 + %37 = OpLoad %6 %8 + %38 = OpCompositeConstruct %34 %37 %37 %37 %37 + OpStore %36 %38 + %39 = OpAccessChain %18 %14 %16 %21 + %40 = OpLoad %6 %39 + %41 = OpAccessChain %18 %14 %16 %17 + %42 = OpLoad %6 %41 + %43 = OpFOrdGreaterThan %26 %40 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %45 + %44 = OpLabel + %48 = OpAccessChain %47 %36 %46 + %49 = OpLoad %6 %48 + %50 = OpLoad %6 %8 + %51 = OpFAdd %6 %50 %49 + OpStore %8 %51 + %53 = OpAccessChain %18 %14 %16 %52 + %54 = OpLoad %6 %53 + %55 = OpCompositeConstruct %34 %54 %54 %54 %54 + OpStore %36 %55 + OpBranch %45 + %45 = OpLabel + OpBranch %29 + %29 = OpLabel + %56 = OpLoad %6 %8 + %59 = OpCompositeConstruct %34 %56 %57 %57 %58 + OpStore %36 %59 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.5 0.0 0.2 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse.amber b/vulkan/amber/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse.amber new file mode 100644 index 0000000..92c3bc3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse.amber @@ -0,0 +1,192 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific DAG combiner code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [3, 0, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# for (int i = -_int_2; bitfieldReverse(++i) <= _int_1;) +# { +# a++; +# } +# if (a == _int_3) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %49 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %49 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %49 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %6 3 + %33 = OpConstant %6 2 + %36 = OpTypeBool + %46 = OpTypeFloat 32 + %47 = OpTypeVector %46 4 + %48 = OpTypePointer Output %47 + %49 = OpVariable %48 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %22 = OpAccessChain %17 %14 %15 %21 + %23 = OpLoad %6 %22 + %24 = OpSNegate %6 %23 + OpStore %20 %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %6 %20 + %31 = OpIAdd %6 %30 %16 + OpStore %20 %31 + %32 = OpBitReverse %6 %31 + %34 = OpAccessChain %17 %14 %15 %33 + %35 = OpLoad %6 %34 + %37 = OpSLessThanEqual %36 %32 %35 + OpBranchConditional %37 %26 %27 + %26 = OpLabel + %38 = OpLoad %6 %8 + %39 = OpIAdd %6 %38 %16 + OpStore %8 %39 + OpBranch %28 + %28 = OpLabel + OpBranch %25 + %27 = OpLabel + %40 = OpLoad %6 %8 + %41 = OpAccessChain %17 %14 %15 %15 + %42 = OpLoad %6 %41 + %43 = OpIEqual %36 %40 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %63 + %44 = OpLabel + %50 = OpAccessChain %17 %14 %15 %33 + %51 = OpLoad %6 %50 + %52 = OpConvertSToF %46 %51 + %53 = OpAccessChain %17 %14 %15 %16 + %54 = OpLoad %6 %53 + %55 = OpConvertSToF %46 %54 + %56 = OpAccessChain %17 %14 %15 %16 + %57 = OpLoad %6 %56 + %58 = OpConvertSToF %46 %57 + %59 = OpAccessChain %17 %14 %15 %33 + %60 = OpLoad %6 %59 + %61 = OpConvertSToF %46 %60 + %62 = OpCompositeConstruct %47 %52 %55 %58 %61 + OpStore %49 %62 + OpBranch %45 + %63 = OpLabel + %64 = OpAccessChain %17 %14 %15 %16 + %65 = OpLoad %6 %64 + %66 = OpConvertSToF %46 %65 + %67 = OpCompositeConstruct %47 %66 %66 %66 %66 + OpStore %49 %67 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 0 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-dag-combiner-neg-div-pow2.amber b/vulkan/amber/graphicsfuzz/cov-dag-combiner-neg-div-pow2.amber new file mode 100644 index 0000000..71172f7 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-dag-combiner-neg-div-pow2.amber @@ -0,0 +1,203 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific DAG combiner code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int minusEight; +# }; +# layout(set = 0, binding = 1) uniform buf1 +# { +# int ten; +# }; +# +# void main() +# { +# int a = 0; +# int b = 0; +# +# for(int i = 0; i < ten; i++) +# { +# // Breaks when i == 3. +# if(a > 5) +# break; +# +# // Increments a by 2. +# a += minusEight / -4; +# b++; +# } +# +# if (b == 3) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 60 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %54 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %10 "b" + OpName %11 "i" + OpName %18 "buf1" + OpMemberName %18 0 "ten" + OpName %20 "" + OpName %32 "buf0" + OpMemberName %32 0 "minusEight" + OpName %34 "" + OpName %54 "_GLF_color" + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpMemberDecorate %32 0 Offset 0 + OpDecorate %32 Block + OpDecorate %34 DescriptorSet 0 + OpDecorate %34 Binding 0 + OpDecorate %54 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %18 = OpTypeStruct %6 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypePointer Uniform %6 + %24 = OpTypeBool + %27 = OpConstant %6 5 + %32 = OpTypeStruct %6 + %33 = OpTypePointer Uniform %32 + %34 = OpVariable %33 Uniform + %37 = OpConstant %6 -4 + %42 = OpConstant %6 1 + %47 = OpConstant %6 3 + %51 = OpTypeFloat 32 + %52 = OpTypeVector %51 4 + %53 = OpTypePointer Output %52 + %54 = OpVariable %53 Output + %55 = OpConstant %51 1 + %56 = OpConstant %51 0 + %57 = OpConstantComposite %52 %55 %56 %56 %55 + %59 = OpConstantComposite %52 %56 %56 %56 %56 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %11 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpStore %11 %9 + OpBranch %12 + %12 = OpLabel + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + %17 = OpLoad %6 %11 + %22 = OpAccessChain %21 %20 %9 + %23 = OpLoad %6 %22 + %25 = OpSLessThan %24 %17 %23 + OpBranchConditional %25 %13 %14 + %13 = OpLabel + %26 = OpLoad %6 %8 + %28 = OpSGreaterThan %24 %26 %27 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %30 + %29 = OpLabel + OpBranch %14 + %30 = OpLabel + %35 = OpAccessChain %21 %34 %9 + %36 = OpLoad %6 %35 + %38 = OpSDiv %6 %36 %37 + %39 = OpLoad %6 %8 + %40 = OpIAdd %6 %39 %38 + OpStore %8 %40 + %41 = OpLoad %6 %10 + %43 = OpIAdd %6 %41 %42 + OpStore %10 %43 + OpBranch %15 + %15 = OpLabel + %44 = OpLoad %6 %11 + %45 = OpIAdd %6 %44 %42 + OpStore %11 %45 + OpBranch %12 + %14 = OpLabel + %46 = OpLoad %6 %10 + %48 = OpIEqual %24 %46 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %58 + %49 = OpLabel + OpStore %54 %57 + OpBranch %50 + %58 = OpLabel + OpStore %54 %59 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# minuseight +BUFFER variant_minuseight DATA_TYPE int32 DATA + -8 +END +# ten +BUFFER variant_ten DATA_TYPE int32 DATA + 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_minuseight AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_ten AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-dag-combiner-same-cond-nested.amber b/vulkan/amber/graphicsfuzz/cov-dag-combiner-same-cond-nested.amber new file mode 100644 index 0000000..08ff13e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-dag-combiner-same-cond-nested.amber @@ -0,0 +1,236 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific DAG combiner code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void main() +# { +# vec3 v; +# float f = one; +# int a = 1, b = 0, c = 1; +# +# for (int i = 0; i < 3; i++) +# v[i] = f + float(i); +# +# if(one == 1.0) +# { +# do +# { +# _GLF_color = vec4(0); +# } +# while ((c & (a | b)) == 0); +# +# if(one == 1.0) +# _GLF_color = vec4(1); +# } +# +# _GLF_color.rgb = vec3(v.x == 1.0 ? 1.0 : 0.0, +# v.y == 2.0 ? 0.0 : 1.0, +# v.z == 3.0 ? 0.0 : 1.0); +# _GLF_color.a = 1.0; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 94 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %55 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %9 "buf0" + OpMemberName %9 0 "one" + OpName %11 "" + OpName %18 "a" + OpName %20 "b" + OpName %21 "c" + OpName %22 "i" + OpName %34 "v" + OpName %55 "_GLF_color" + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 Block + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 0 + OpDecorate %55 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeStruct %6 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpTypePointer Uniform %6 + %17 = OpTypePointer Function %12 + %19 = OpConstant %12 1 + %29 = OpConstant %12 3 + %30 = OpTypeBool + %32 = OpTypeVector %6 3 + %33 = OpTypePointer Function %32 + %45 = OpConstant %6 1 + %53 = OpTypeVector %6 4 + %54 = OpTypePointer Output %53 + %55 = OpVariable %54 Output + %56 = OpConstant %6 0 + %57 = OpConstantComposite %53 %56 %56 %56 %56 + %69 = OpConstantComposite %53 %45 %45 %45 %45 + %70 = OpTypeInt 32 0 + %71 = OpConstant %70 0 + %76 = OpConstant %70 1 + %79 = OpConstant %6 2 + %82 = OpConstant %70 2 + %85 = OpConstant %6 3 + %91 = OpConstant %70 3 + %92 = OpTypePointer Output %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpVariable %17 Function + %20 = OpVariable %17 Function + %21 = OpVariable %17 Function + %22 = OpVariable %17 Function + %34 = OpVariable %33 Function + %15 = OpAccessChain %14 %11 %13 + %16 = OpLoad %6 %15 + OpStore %8 %16 + OpStore %18 %19 + OpStore %20 %13 + OpStore %21 %19 + OpStore %22 %13 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %12 %22 + %31 = OpSLessThan %30 %28 %29 + OpBranchConditional %31 %24 %25 + %24 = OpLabel + %35 = OpLoad %12 %22 + %36 = OpLoad %6 %8 + %37 = OpLoad %12 %22 + %38 = OpConvertSToF %6 %37 + %39 = OpFAdd %6 %36 %38 + %40 = OpAccessChain %7 %34 %35 + OpStore %40 %39 + OpBranch %26 + %26 = OpLabel + %41 = OpLoad %12 %22 + %42 = OpIAdd %12 %41 %19 + OpStore %22 %42 + OpBranch %23 + %25 = OpLabel + %43 = OpAccessChain %14 %11 %13 + %44 = OpLoad %6 %43 + %46 = OpFOrdEqual %30 %44 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + OpBranch %49 + %49 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %50 + %50 = OpLabel + OpStore %55 %57 + OpBranch %52 + %52 = OpLabel + %58 = OpLoad %12 %21 + %59 = OpLoad %12 %18 + %60 = OpLoad %12 %20 + %61 = OpBitwiseOr %12 %59 %60 + %62 = OpBitwiseAnd %12 %58 %61 + %63 = OpIEqual %30 %62 %13 + OpBranchConditional %63 %49 %51 + %51 = OpLabel + %64 = OpAccessChain %14 %11 %13 + %65 = OpLoad %6 %64 + %66 = OpFOrdEqual %30 %65 %45 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %68 + %67 = OpLabel + OpStore %55 %69 + OpBranch %68 + %68 = OpLabel + OpBranch %48 + %48 = OpLabel + %72 = OpAccessChain %7 %34 %71 + %73 = OpLoad %6 %72 + %74 = OpFOrdEqual %30 %73 %45 + %75 = OpSelect %6 %74 %45 %56 + %77 = OpAccessChain %7 %34 %76 + %78 = OpLoad %6 %77 + %80 = OpFOrdEqual %30 %78 %79 + %81 = OpSelect %6 %80 %56 %45 + %83 = OpAccessChain %7 %34 %82 + %84 = OpLoad %6 %83 + %86 = OpFOrdEqual %30 %84 %85 + %87 = OpSelect %6 %86 %56 %45 + %88 = OpCompositeConstruct %32 %75 %81 %87 + %89 = OpLoad %53 %55 + %90 = OpVectorShuffle %53 %89 %88 4 5 6 3 + OpStore %55 %90 + %93 = OpAccessChain %92 %55 %91 + OpStore %93 %45 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-dead-branch-func-return-arg.amber b/vulkan/amber/graphicsfuzz/cov-dead-branch-func-return-arg.amber new file mode 100644 index 0000000..66fc691 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-dead-branch-func-return-arg.amber @@ -0,0 +1,330 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific dead branch elimination path + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--private-to-local' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--merge-return' +# '--combine-access-chains' +# '--reduce-load-size' +# '--eliminate-local-single-block' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-block' +# '--eliminate-local-single-store' +# '--copy-propagate-arrays' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--scalar-replacement=100' +# '--eliminate-local-single-store' +# '--eliminate-local-single-store' +# '--eliminate-dead-code-aggressive' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-local-single-block' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float func(float x) +# { +# float a = x; +# +# do +# { +# if (a == x) +# return a; +# +# a++; +# } while(a < x); +# +# return 0.0; +# } +# +# void main() +# { +# float f = 0.0; +# float i = 0.0; +# +# do +# { +# f = func(i); +# i += func(1.0); +# } +# while (i < 6.0); +# +# if (f == 5.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 127 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %58 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "func(f1;" + OpName %9 "x" + OpName %12 "a" + OpName %35 "f" + OpName %36 "i" + OpName %41 "param" + OpName %44 "param" + OpName %58 "_GLF_color" + OpDecorate %58 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %20 = OpTypeBool + %27 = OpConstant %6 1 + %32 = OpConstant %6 0 + %49 = OpConstant %6 6 + %52 = OpConstant %6 5 + %56 = OpTypeVector %6 4 + %57 = OpTypePointer Output %56 + %58 = OpVariable %57 Output + %59 = OpConstantComposite %56 %27 %32 %32 %27 + %61 = OpConstantComposite %56 %32 %32 %32 %32 + %68 = OpConstantFalse %20 + %69 = OpTypePointer Function %20 + %71 = OpConstantTrue %20 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %100 = OpVariable %69 Function %68 + %101 = OpVariable %7 Function + %102 = OpVariable %7 Function + %103 = OpVariable %7 Function + %74 = OpVariable %69 Function %68 + %75 = OpVariable %7 Function + %76 = OpVariable %7 Function + %77 = OpVariable %7 Function + %35 = OpVariable %7 Function + %36 = OpVariable %7 Function + %41 = OpVariable %7 Function + %44 = OpVariable %7 Function + OpStore %35 %32 + OpStore %36 %32 + OpBranch %37 + %37 = OpLabel + %42 = OpLoad %6 %36 + OpStore %41 %42 + OpStore %74 %68 + OpLoopMerge %39 %126 None + OpBranch %78 + %78 = OpLabel + %79 = OpLoad %6 %41 + OpStore %76 %79 + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + OpLoopMerge %83 %84 None + OpBranch %85 + %85 = OpLabel + %86 = OpLoad %6 %76 + %87 = OpLoad %6 %41 + %88 = OpFOrdEqual %20 %86 %87 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + %91 = OpLoad %6 %76 + OpStore %74 %71 + OpStore %75 %91 + OpBranch %83 + %89 = OpLabel + %92 = OpLoad %6 %76 + %93 = OpFAdd %6 %92 %27 + OpStore %76 %93 + OpBranch %84 + %84 = OpLabel + %94 = OpLoad %6 %76 + %95 = OpLoad %6 %41 + %96 = OpFOrdLessThan %20 %94 %95 + OpBranchConditional %96 %82 %83 + %83 = OpLabel + %97 = OpLoad %20 %74 + OpSelectionMerge %98 None + OpBranchConditional %97 %80 %98 + %98 = OpLabel + OpStore %74 %71 + OpStore %75 %32 + OpBranch %80 + %81 = OpLabel + OpBranch %78 + %80 = OpLabel + %99 = OpLoad %6 %75 + OpStore %77 %99 + OpStore %35 %99 + OpStore %44 %27 + OpStore %100 %68 + OpBranch %104 + %104 = OpLabel + %105 = OpLoad %6 %44 + OpStore %102 %105 + OpLoopMerge %106 %107 None + OpBranch %108 + %108 = OpLabel + OpLoopMerge %109 %110 None + OpBranch %111 + %111 = OpLabel + %112 = OpLoad %6 %102 + %113 = OpLoad %6 %44 + %114 = OpFOrdEqual %20 %112 %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %115 + %116 = OpLabel + %117 = OpLoad %6 %102 + OpStore %100 %71 + OpStore %101 %117 + OpBranch %109 + %115 = OpLabel + %118 = OpLoad %6 %102 + %119 = OpFAdd %6 %118 %27 + OpStore %102 %119 + OpBranch %110 + %110 = OpLabel + %120 = OpLoad %6 %102 + %121 = OpLoad %6 %44 + %122 = OpFOrdLessThan %20 %120 %121 + OpBranchConditional %122 %108 %109 + %109 = OpLabel + %123 = OpLoad %20 %100 + OpSelectionMerge %124 None + OpBranchConditional %123 %106 %124 + %124 = OpLabel + OpStore %100 %71 + OpStore %101 %32 + OpBranch %106 + %107 = OpLabel + OpBranch %104 + %106 = OpLabel + %125 = OpLoad %6 %101 + OpStore %103 %125 + %46 = OpLoad %6 %36 + %47 = OpFAdd %6 %46 %125 + OpStore %36 %47 + %50 = OpFOrdLessThan %20 %47 %49 + OpBranchConditional %50 %126 %39 + %126 = OpLabel + OpBranch %37 + %39 = OpLabel + %51 = OpLoad %6 %35 + %53 = OpFOrdEqual %20 %51 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %60 + %54 = OpLabel + OpStore %58 %59 + OpBranch %55 + %60 = OpLabel + OpStore %58 %61 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %70 = OpVariable %69 Function %68 + %63 = OpVariable %7 Function + %12 = OpVariable %7 Function + OpBranch %65 + %65 = OpLabel + %13 = OpLoad %6 %9 + OpStore %12 %13 + OpLoopMerge %62 %67 None + OpBranch %14 + %14 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %15 + %15 = OpLabel + %18 = OpLoad %6 %12 + %19 = OpLoad %6 %9 + %21 = OpFOrdEqual %20 %18 %19 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %23 + %22 = OpLabel + %24 = OpLoad %6 %12 + OpStore %70 %71 + OpStore %63 %24 + OpBranch %16 + %23 = OpLabel + %26 = OpLoad %6 %12 + %28 = OpFAdd %6 %26 %27 + OpStore %12 %28 + OpBranch %17 + %17 = OpLabel + %29 = OpLoad %6 %12 + %30 = OpLoad %6 %9 + %31 = OpFOrdLessThan %20 %29 %30 + OpBranchConditional %31 %14 %16 + %16 = OpLabel + %73 = OpLoad %20 %70 + OpSelectionMerge %72 None + OpBranchConditional %73 %62 %72 + %72 = OpLabel + OpStore %70 %71 + OpStore %63 %32 + OpBranch %62 + %67 = OpLabel + OpBranch %65 + %62 = OpLabel + %64 = OpLoad %6 %63 + OpReturnValue %64 + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-dead-code-unreachable-merge.amber b/vulkan/amber/graphicsfuzz/cov-dead-code-unreachable-merge.amber new file mode 100644 index 0000000..6a142a2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-dead-code-unreachable-merge.amber @@ -0,0 +1,248 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific dead code elimination path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# float array0[3]; // Will end up having 0, 0, 0 +# float array1[3]; // Will end up having 1, 1, 1 +# +# void main() +# { +# int q = 0; +# int i = int(gl_FragCoord.x) % 3; +# for(int c = 0; c < 3; c++) +# { +# array0[c] = 0.0; +# array1[c] = 0.0; +# +# // injectionSwitch.x is always zero +# switch(int((injectionSwitch.x)) + q) +# { +# case 0: +# q = 61; +# break; +# case 51: +# // We never hit this infinite loop. +# while(true) {} +# // This wrong value should never be written. +# array0[c] = 1.0; +# case 61: +# array1[0] = 1.0; +# array1[c] = 1.0; +# } +# } +# _GLF_color = vec4(array1[i], array0[i], array0[i], 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 87 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %14 %76 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "q" + OpName %10 "i" + OpName %14 "gl_FragCoord" + OpName %23 "c" + OpName %35 "array0" + OpName %40 "array1" + OpName %44 "buf0" + OpMemberName %44 0 "injectionSwitch" + OpName %46 "" + OpName %76 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %14 BuiltIn FragCoord + OpDecorate %20 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpMemberDecorate %44 0 Offset 0 + OpDecorate %44 Block + OpDecorate %46 DescriptorSet 0 + OpDecorate %46 Binding 0 + OpDecorate %50 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %65 RelaxedPrecision + OpDecorate %69 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %74 RelaxedPrecision + OpDecorate %76 Location 0 + OpDecorate %77 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + OpDecorate %83 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %11 = OpTypeFloat 32 + %12 = OpTypeVector %11 4 + %13 = OpTypePointer Input %12 + %14 = OpVariable %13 Input + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 0 + %17 = OpTypePointer Input %11 + %21 = OpConstant %6 3 + %30 = OpTypeBool + %32 = OpConstant %15 3 + %33 = OpTypeArray %11 %32 + %34 = OpTypePointer Private %33 + %35 = OpVariable %34 Private + %37 = OpConstant %11 0 + %38 = OpTypePointer Private %11 + %40 = OpVariable %34 Private + %43 = OpTypeVector %11 2 + %44 = OpTypeStruct %43 + %45 = OpTypePointer Uniform %44 + %46 = OpVariable %45 Uniform + %47 = OpTypePointer Uniform %11 + %57 = OpConstant %6 61 + %64 = OpConstantTrue %30 + %66 = OpConstant %11 1 + %73 = OpConstant %6 1 + %75 = OpTypePointer Output %12 + %76 = OpVariable %75 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %23 = OpVariable %7 Function + OpStore %8 %9 + %18 = OpAccessChain %17 %14 %16 + %19 = OpLoad %11 %18 + %20 = OpConvertFToS %6 %19 + %22 = OpSMod %6 %20 %21 + OpStore %10 %22 + OpStore %23 %9 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %23 + %31 = OpSLessThan %30 %29 %21 + OpBranchConditional %31 %25 %26 + %25 = OpLabel + %36 = OpLoad %6 %23 + %39 = OpAccessChain %38 %35 %36 + OpStore %39 %37 + %41 = OpLoad %6 %23 + %42 = OpAccessChain %38 %40 %41 + OpStore %42 %37 + %48 = OpAccessChain %47 %46 %9 %16 + %49 = OpLoad %11 %48 + %50 = OpConvertFToS %6 %49 + %51 = OpLoad %6 %8 + %52 = OpIAdd %6 %50 %51 + OpSelectionMerge %56 None + OpSwitch %52 %56 0 %53 51 %54 61 %55 + %53 = OpLabel + OpStore %8 %57 + OpBranch %56 + %54 = OpLabel + OpBranch %59 + %59 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + OpBranchConditional %64 %60 %61 + %60 = OpLabel + OpBranch %62 + %62 = OpLabel + OpBranch %59 + %61 = OpLabel + %65 = OpLoad %6 %23 + %67 = OpAccessChain %38 %35 %65 + OpStore %67 %66 + OpBranch %55 + %55 = OpLabel + %68 = OpAccessChain %38 %40 %9 + OpStore %68 %66 + %69 = OpLoad %6 %23 + %70 = OpAccessChain %38 %40 %69 + OpStore %70 %66 + OpBranch %56 + %56 = OpLabel + OpBranch %27 + %27 = OpLabel + %72 = OpLoad %6 %23 + %74 = OpIAdd %6 %72 %73 + OpStore %23 %74 + OpBranch %24 + %26 = OpLabel + %77 = OpLoad %6 %10 + %78 = OpAccessChain %38 %40 %77 + %79 = OpLoad %11 %78 + %80 = OpLoad %6 %10 + %81 = OpAccessChain %38 %35 %80 + %82 = OpLoad %11 %81 + %83 = OpLoad %6 %10 + %84 = OpAccessChain %38 %35 %83 + %85 = OpLoad %11 %84 + %86 = OpCompositeConstruct %12 %79 %82 %85 %66 + OpStore %76 %86 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-decrement-vector-elements-clamp-index.amber b/vulkan/amber/graphicsfuzz/cov-decrement-vector-elements-clamp-index.amber new file mode 100644 index 0000000..a5123ca --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-decrement-vector-elements-clamp-index.amber @@ -0,0 +1,280 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 4; +# vec4 v = vec4(1.0); +# +# // Iterates i = 4..1. Decreases v.w by two (because of the clamp) and v.y and v.z by one. +# for(int i = a; i > 0; i--) +# { +# for(int j = a; j > 0; j--) +# { +# // Indices used: 3, 3, 2, 1. +# v[_GLF_MAKE_IN_BOUNDS_INT(i, 4)] -= _float_1_0; +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# continue; +# } +# +# a += 1; +# break; +# } +# } +# +# // Always true. +# if(v == vec4(1, 0, 0, -1)) +# { +# _GLF_color = vec4(1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 104 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %54 %83 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %13 "v" + OpName %16 "i" + OpName %27 "j" + OpName %42 "buf0" + OpMemberName %42 0 "_GLF_uniform_float_values" + OpName %44 "" + OpName %54 "gl_FragCoord" + OpName %83 "_GLF_color" + OpName %85 "buf1" + OpMemberName %85 0 "_GLF_uniform_int_values" + OpName %87 "" + OpDecorate %41 ArrayStride 16 + OpMemberDecorate %42 0 Offset 0 + OpDecorate %42 Block + OpDecorate %44 DescriptorSet 0 + OpDecorate %44 Binding 0 + OpDecorate %54 BuiltIn FragCoord + OpDecorate %83 Location 0 + OpDecorate %84 ArrayStride 16 + OpMemberDecorate %85 0 Offset 0 + OpDecorate %85 Block + OpDecorate %87 DescriptorSet 0 + OpDecorate %87 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 4 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Function %11 + %14 = OpConstant %10 1 + %15 = OpConstantComposite %11 %14 %14 %14 %14 + %24 = OpConstant %6 0 + %25 = OpTypeBool + %37 = OpConstant %6 3 + %39 = OpTypeInt 32 0 + %40 = OpConstant %39 2 + %41 = OpTypeArray %10 %40 + %42 = OpTypeStruct %41 + %43 = OpTypePointer Uniform %42 + %44 = OpVariable %43 Uniform + %45 = OpTypePointer Uniform %10 + %48 = OpTypePointer Function %10 + %53 = OpTypePointer Input %11 + %54 = OpVariable %53 Input + %55 = OpConstant %39 0 + %56 = OpTypePointer Input %10 + %59 = OpConstant %6 1 + %74 = OpConstant %10 0 + %75 = OpConstant %10 -1 + %76 = OpConstantComposite %11 %14 %74 %74 %75 + %77 = OpTypeVector %25 4 + %82 = OpTypePointer Output %11 + %83 = OpVariable %82 Output + %84 = OpTypeArray %6 %40 + %85 = OpTypeStruct %84 + %86 = OpTypePointer Uniform %85 + %87 = OpVariable %86 Uniform + %88 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %13 = OpVariable %12 Function + %16 = OpVariable %7 Function + %27 = OpVariable %7 Function + OpStore %8 %9 + OpStore %13 %15 + %17 = OpLoad %6 %8 + OpStore %16 %17 + OpBranch %18 + %18 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %23 = OpLoad %6 %16 + %26 = OpSGreaterThan %25 %23 %24 + OpBranchConditional %26 %19 %20 + %19 = OpLabel + %28 = OpLoad %6 %8 + OpStore %27 %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %6 %27 + %35 = OpSGreaterThan %25 %34 %24 + OpBranchConditional %35 %30 %31 + %30 = OpLabel + %36 = OpLoad %6 %16 + %38 = OpExtInst %6 %1 SClamp %36 %24 %37 + %46 = OpAccessChain %45 %44 %24 %24 + %47 = OpLoad %10 %46 + %49 = OpAccessChain %48 %13 %38 + %50 = OpLoad %10 %49 + %51 = OpFSub %10 %50 %47 + %52 = OpAccessChain %48 %13 %38 + OpStore %52 %51 + %57 = OpAccessChain %56 %54 %55 + %58 = OpLoad %10 %57 + %60 = OpAccessChain %45 %44 %24 %59 + %61 = OpLoad %10 %60 + %62 = OpFOrdLessThan %25 %58 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %64 + %63 = OpLabel + OpBranch %32 + %64 = OpLabel + %66 = OpLoad %6 %8 + %67 = OpIAdd %6 %66 %59 + OpStore %8 %67 + OpBranch %31 + %32 = OpLabel + %69 = OpLoad %6 %27 + %70 = OpISub %6 %69 %59 + OpStore %27 %70 + OpBranch %29 + %31 = OpLabel + OpBranch %21 + %21 = OpLabel + %71 = OpLoad %6 %16 + %72 = OpISub %6 %71 %59 + OpStore %16 %72 + OpBranch %18 + %20 = OpLabel + %73 = OpLoad %11 %13 + %78 = OpFOrdEqual %77 %73 %76 + %79 = OpAll %25 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %80 %99 + %80 = OpLabel + %89 = OpAccessChain %88 %87 %24 %24 + %90 = OpLoad %6 %89 + %91 = OpConvertSToF %10 %90 + %92 = OpAccessChain %88 %87 %24 %24 + %93 = OpLoad %6 %92 + %94 = OpConvertSToF %10 %93 + %95 = OpAccessChain %88 %87 %24 %59 + %96 = OpLoad %6 %95 + %97 = OpConvertSToF %10 %96 + %98 = OpCompositeConstruct %11 %14 %91 %94 %97 + OpStore %83 %98 + OpBranch %81 + %99 = OpLabel + %100 = OpAccessChain %88 %87 %24 %24 + %101 = OpLoad %6 %100 + %102 = OpConvertSToF %10 %101 + %103 = OpCompositeConstruct %11 %102 %102 %102 %102 + OpStore %83 %103 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count.amber b/vulkan/amber/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count.amber new file mode 100644 index 0000000..cb0f9d5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count.amber @@ -0,0 +1,288 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_91_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 91.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 100; +# int _GLF_global_loop_count = 0; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = _float_1_0; +# +# for(int r = _int_0; r < _int_10; r ++) +# { +# _GLF_global_loop_count ++; +# // Derivative of a uniform vector is always zero. +# f += dFdx(injectionSwitch).y; +# } +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# f += _float_1_0; +# } +# +# // Always true. +# if(f == _float_91_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 101 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %82 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %12 "f" + OpName %16 "buf1" + OpMemberName %16 0 "_GLF_uniform_float_values" + OpName %18 "" + OpName %23 "r" + OpName %26 "buf0" + OpMemberName %26 0 "_GLF_uniform_int_values" + OpName %28 "" + OpName %47 "buf2" + OpMemberName %47 0 "injectionSwitch" + OpName %49 "" + OpName %82 "_GLF_color" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %25 ArrayStride 16 + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 0 + OpMemberDecorate %47 0 Offset 0 + OpDecorate %47 Block + OpDecorate %49 DescriptorSet 0 + OpDecorate %49 Binding 2 + OpDecorate %82 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypePointer Function %10 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 2 + %15 = OpTypeArray %10 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpTypePointer Uniform %10 + %22 = OpTypePointer Function %6 + %24 = OpConstant %13 3 + %25 = OpTypeArray %6 %24 + %26 = OpTypeStruct %25 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpConstant %6 1 + %30 = OpTypePointer Uniform %6 + %39 = OpConstant %6 2 + %42 = OpTypeBool + %46 = OpTypeVector %10 2 + %47 = OpTypeStruct %46 + %48 = OpTypePointer Uniform %47 + %49 = OpVariable %48 Uniform + %50 = OpTypePointer Uniform %46 + %54 = OpConstant %13 1 + %66 = OpConstant %6 100 + %80 = OpTypeVector %10 4 + %81 = OpTypePointer Output %80 + %82 = OpVariable %81 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpVariable %11 Function + %23 = OpVariable %22 Function + OpStore %8 %9 + %20 = OpAccessChain %19 %18 %9 %9 + %21 = OpLoad %10 %20 + OpStore %12 %21 + %31 = OpAccessChain %30 %28 %9 %29 + %32 = OpLoad %6 %31 + OpStore %23 %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %6 %23 + %40 = OpAccessChain %30 %28 %9 %39 + %41 = OpLoad %6 %40 + %43 = OpSLessThan %42 %38 %41 + OpBranchConditional %43 %34 %35 + %34 = OpLabel + %44 = OpLoad %6 %8 + %45 = OpIAdd %6 %44 %29 + OpStore %8 %45 + %51 = OpAccessChain %50 %49 %9 + %52 = OpLoad %46 %51 + %53 = OpDPdx %46 %52 + %55 = OpCompositeExtract %10 %53 1 + %56 = OpLoad %10 %12 + %57 = OpFAdd %10 %56 %55 + OpStore %12 %57 + OpBranch %36 + %36 = OpLabel + %58 = OpLoad %6 %23 + %59 = OpIAdd %6 %58 %29 + OpStore %23 %59 + OpBranch %33 + %35 = OpLabel + OpBranch %60 + %60 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %6 %8 + %67 = OpSLessThan %42 %65 %66 + OpBranchConditional %67 %61 %62 + %61 = OpLabel + %68 = OpLoad %6 %8 + %69 = OpIAdd %6 %68 %29 + OpStore %8 %69 + %70 = OpAccessChain %19 %18 %9 %9 + %71 = OpLoad %10 %70 + %72 = OpLoad %10 %12 + %73 = OpFAdd %10 %72 %71 + OpStore %12 %73 + OpBranch %63 + %63 = OpLabel + OpBranch %60 + %62 = OpLabel + %74 = OpLoad %10 %12 + %75 = OpAccessChain %19 %18 %9 %29 + %76 = OpLoad %10 %75 + %77 = OpFOrdEqual %42 %74 %76 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %96 + %78 = OpLabel + %83 = OpAccessChain %30 %28 %9 %9 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %10 %84 + %86 = OpAccessChain %30 %28 %9 %29 + %87 = OpLoad %6 %86 + %88 = OpConvertSToF %10 %87 + %89 = OpAccessChain %30 %28 %9 %29 + %90 = OpLoad %6 %89 + %91 = OpConvertSToF %10 %90 + %92 = OpAccessChain %30 %28 %9 %9 + %93 = OpLoad %6 %92 + %94 = OpConvertSToF %10 %93 + %95 = OpCompositeConstruct %80 %85 %88 %91 %94 + OpStore %82 %95 + OpBranch %79 + %96 = OpLabel + %97 = OpAccessChain %30 %28 %9 %29 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %10 %98 + %100 = OpCompositeConstruct %80 %99 %99 %99 %99 + OpStore %82 %100 + OpBranch %79 + %79 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 91.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-descending-loop-index-temporary-array.amber b/vulkan/amber/graphicsfuzz/cov-descending-loop-index-temporary-array.amber new file mode 100644 index 0000000..55099b3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-descending-loop-index-temporary-array.amber @@ -0,0 +1,278 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_5 _GLF_uniform_int_values[2] +# #define _int_4 _GLF_uniform_int_values[3] +# #define _int_3 _GLF_uniform_int_values[4] +# #define _int_2 _GLF_uniform_int_values[5] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 5, 4, 3, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[6]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1; +# int b = _int_1; +# +# // Iterated once. +# while(b >= _int_1) +# { +# b--; +# +# // Iterated once with b = 0. +# for(int i = _int_1; i != 0; i--) +# { +# // a becomes 5 and b -1. +# a = int[5](_int_5, _int_4, _int_3, _int_2, _int_1)[b--]; +# } +# +# // Always true. +# if(a > _int_1) +# { +# // b becomes 0. +# b++; +# } +# } +# +# // Always true. +# if(a == _int_5 && b == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 113 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %94 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "b" + OpName %35 "i" + OpName %65 "indexable" + OpName %94 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %94 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 6 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %31 = OpTypeBool + %45 = OpConstant %6 2 + %48 = OpConstant %6 3 + %51 = OpConstant %6 4 + %54 = OpConstant %6 5 + %59 = OpConstant %9 5 + %60 = OpTypeArray %6 %59 + %64 = OpTypePointer Function %60 + %91 = OpTypeFloat 32 + %92 = OpTypeVector %91 4 + %93 = OpTypePointer Output %92 + %94 = OpVariable %93 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %35 = OpVariable %7 Function + %65 = OpVariable %64 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %21 = OpAccessChain %17 %14 %15 %16 + %22 = OpLoad %6 %21 + OpStore %20 %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %6 %20 + %29 = OpAccessChain %17 %14 %15 %16 + %30 = OpLoad %6 %29 + %32 = OpSGreaterThanEqual %31 %28 %30 + OpBranchConditional %32 %24 %25 + %24 = OpLabel + %33 = OpLoad %6 %20 + %34 = OpISub %6 %33 %16 + OpStore %20 %34 + %36 = OpAccessChain %17 %14 %15 %16 + %37 = OpLoad %6 %36 + OpStore %35 %37 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %6 %35 + %44 = OpINotEqual %31 %43 %15 + OpBranchConditional %44 %39 %40 + %39 = OpLabel + %46 = OpAccessChain %17 %14 %15 %45 + %47 = OpLoad %6 %46 + %49 = OpAccessChain %17 %14 %15 %48 + %50 = OpLoad %6 %49 + %52 = OpAccessChain %17 %14 %15 %51 + %53 = OpLoad %6 %52 + %55 = OpAccessChain %17 %14 %15 %54 + %56 = OpLoad %6 %55 + %57 = OpAccessChain %17 %14 %15 %16 + %58 = OpLoad %6 %57 + %61 = OpCompositeConstruct %60 %47 %50 %53 %56 %58 + %62 = OpLoad %6 %20 + %63 = OpISub %6 %62 %16 + OpStore %20 %63 + OpStore %65 %61 + %66 = OpAccessChain %7 %65 %62 + %67 = OpLoad %6 %66 + OpStore %8 %67 + OpBranch %41 + %41 = OpLabel + %68 = OpLoad %6 %35 + %69 = OpISub %6 %68 %16 + OpStore %35 %69 + OpBranch %38 + %40 = OpLabel + %70 = OpLoad %6 %8 + %71 = OpAccessChain %17 %14 %15 %16 + %72 = OpLoad %6 %71 + %73 = OpSGreaterThan %31 %70 %72 + OpSelectionMerge %75 None + OpBranchConditional %73 %74 %75 + %74 = OpLabel + %76 = OpLoad %6 %20 + %77 = OpIAdd %6 %76 %16 + OpStore %20 %77 + OpBranch %75 + %75 = OpLabel + OpBranch %26 + %26 = OpLabel + OpBranch %23 + %25 = OpLabel + %78 = OpLoad %6 %8 + %79 = OpAccessChain %17 %14 %15 %45 + %80 = OpLoad %6 %79 + %81 = OpIEqual %31 %78 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %83 + %82 = OpLabel + %84 = OpLoad %6 %20 + %85 = OpAccessChain %17 %14 %15 %15 + %86 = OpLoad %6 %85 + %87 = OpIEqual %31 %84 %86 + OpBranch %83 + %83 = OpLabel + %88 = OpPhi %31 %81 %25 %87 %82 + OpSelectionMerge %90 None + OpBranchConditional %88 %89 %108 + %89 = OpLabel + %95 = OpAccessChain %17 %14 %15 %16 + %96 = OpLoad %6 %95 + %97 = OpConvertSToF %91 %96 + %98 = OpAccessChain %17 %14 %15 %15 + %99 = OpLoad %6 %98 + %100 = OpConvertSToF %91 %99 + %101 = OpAccessChain %17 %14 %15 %15 + %102 = OpLoad %6 %101 + %103 = OpConvertSToF %91 %102 + %104 = OpAccessChain %17 %14 %15 %16 + %105 = OpLoad %6 %104 + %106 = OpConvertSToF %91 %105 + %107 = OpCompositeConstruct %92 %97 %100 %103 %106 + OpStore %94 %107 + OpBranch %90 + %108 = OpLabel + %109 = OpAccessChain %17 %14 %15 %15 + %110 = OpLoad %6 %109 + %111 = OpConvertSToF %91 %110 + %112 = OpCompositeConstruct %92 %111 %111 %111 %111 + OpStore %94 %112 + OpBranch %90 + %90 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 5 4 3 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-descending-loop-min-max-always-zero.amber b/vulkan/amber/graphicsfuzz/cov-descending-loop-min-max-always-zero.amber new file mode 100644 index 0000000..28616fc --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-descending-loop-min-max-always-zero.amber @@ -0,0 +1,224 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_10 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 10, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = _float_1_0; +# +# for (int i = _int_10; i > _int_0; i--) +# { +# float a = 1.0 - max(1.0, float(i)); +# // Always sets f to zero. +# f = min(max(a, 0.0), 0.0); +# } +# +# // Always true. +# if(f == _float_0_0) +# { +# _GLF_color = vec4(_int_1, f, _int_0, 1); +# } +# else +# { +# _GLF_color = vec4(0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %61 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %22 "i" + OpName %25 "buf1" + OpMemberName %25 0 "_GLF_uniform_int_values" + OpName %27 "" + OpName %41 "a" + OpName %61 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %24 ArrayStride 16 + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 1 + OpDecorate %61 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 1 + %18 = OpTypePointer Uniform %6 + %21 = OpTypePointer Function %15 + %23 = OpConstant %9 3 + %24 = OpTypeArray %15 %23 + %25 = OpTypeStruct %24 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypePointer Uniform %15 + %39 = OpTypeBool + %42 = OpConstant %6 1 + %48 = OpConstant %6 0 + %59 = OpTypeVector %6 4 + %60 = OpTypePointer Output %59 + %61 = OpVariable %60 Output + %62 = OpConstant %15 2 + %72 = OpConstantComposite %59 %48 %48 %48 %48 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %21 Function + %41 = OpVariable %7 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %6 %19 + OpStore %8 %20 + %29 = OpAccessChain %28 %27 %16 %17 + %30 = OpLoad %15 %29 + OpStore %22 %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %15 %22 + %37 = OpAccessChain %28 %27 %16 %16 + %38 = OpLoad %15 %37 + %40 = OpSGreaterThan %39 %36 %38 + OpBranchConditional %40 %32 %33 + %32 = OpLabel + %43 = OpLoad %15 %22 + %44 = OpConvertSToF %6 %43 + %45 = OpExtInst %6 %1 FMax %42 %44 + %46 = OpFSub %6 %42 %45 + OpStore %41 %46 + %47 = OpLoad %6 %41 + %49 = OpExtInst %6 %1 FMax %47 %48 + %50 = OpExtInst %6 %1 FMin %49 %48 + OpStore %8 %50 + OpBranch %34 + %34 = OpLabel + %51 = OpLoad %15 %22 + %52 = OpISub %15 %51 %17 + OpStore %22 %52 + OpBranch %31 + %33 = OpLabel + %53 = OpLoad %6 %8 + %54 = OpAccessChain %18 %14 %16 %16 + %55 = OpLoad %6 %54 + %56 = OpFOrdEqual %39 %53 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %71 + %57 = OpLabel + %63 = OpAccessChain %28 %27 %16 %62 + %64 = OpLoad %15 %63 + %65 = OpConvertSToF %6 %64 + %66 = OpLoad %6 %8 + %67 = OpAccessChain %28 %27 %16 %16 + %68 = OpLoad %15 %67 + %69 = OpConvertSToF %6 %68 + %70 = OpCompositeConstruct %59 %65 %66 %69 %42 + OpStore %61 %70 + OpBranch %58 + %71 = OpLabel + OpStore %61 %72 + OpBranch %58 + %58 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 10 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-determinant-uninitialized-matrix-never-chosen.amber b/vulkan/amber/graphicsfuzz/cov-determinant-uninitialized-matrix-never-chosen.amber new file mode 100644 index 0000000..3a17ae5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-determinant-uninitialized-matrix-never-chosen.amber @@ -0,0 +1,238 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of one: 1 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat4 m0; +# // Initialize color to a wrong value. +# _GLF_color = vec4(_int_0); +# +# for (int i = 0; i < 5; i++) +# { +# // m0 is uninitalized, but the identity matrix is always chosen. +# mat4 m1 = one == _int_1 ? mat4(1) : m0--; +# +# // Always true. +# if (determinant(m1) == 1.0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 90 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %25 "i" + OpName %37 "m1" + OpName %38 "buf1" + OpMemberName %38 0 "one" + OpName %40 "" + OpName %57 "m0" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpConstant %10 1 + %19 = OpTypePointer Uniform %10 + %24 = OpTypePointer Function %10 + %32 = OpConstant %10 5 + %33 = OpTypeBool + %35 = OpTypeMatrix %7 4 + %36 = OpTypePointer Function %35 + %38 = OpTypeStruct %10 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %49 = OpConstant %6 1 + %50 = OpConstant %6 0 + %51 = OpConstantComposite %7 %49 %50 %50 %50 + %52 = OpConstantComposite %7 %50 %49 %50 %50 + %53 = OpConstantComposite %7 %50 %50 %49 %50 + %54 = OpConstantComposite %7 %50 %50 %50 %49 + %55 = OpConstantComposite %35 %51 %52 %53 %54 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %25 = OpVariable %24 Function + %37 = OpVariable %36 Function + %46 = OpVariable %36 Function + %57 = OpVariable %36 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %10 %20 + %22 = OpConvertSToF %6 %21 + %23 = OpCompositeConstruct %7 %22 %22 %22 %22 + OpStore %9 %23 + OpStore %25 %17 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %10 %25 + %34 = OpSLessThan %33 %31 %32 + OpBranchConditional %34 %27 %28 + %27 = OpLabel + %41 = OpAccessChain %19 %40 %17 + %42 = OpLoad %10 %41 + %43 = OpAccessChain %19 %16 %17 %17 + %44 = OpLoad %10 %43 + %45 = OpIEqual %33 %42 %44 + OpSelectionMerge %48 None + OpBranchConditional %45 %47 %56 + %47 = OpLabel + OpStore %46 %55 + OpBranch %48 + %56 = OpLabel + %58 = OpLoad %35 %57 + %59 = OpCompositeConstruct %7 %49 %49 %49 %49 + %60 = OpCompositeExtract %7 %58 0 + %61 = OpFSub %7 %60 %59 + %62 = OpCompositeExtract %7 %58 1 + %63 = OpFSub %7 %62 %59 + %64 = OpCompositeExtract %7 %58 2 + %65 = OpFSub %7 %64 %59 + %66 = OpCompositeExtract %7 %58 3 + %67 = OpFSub %7 %66 %59 + %68 = OpCompositeConstruct %35 %61 %63 %65 %67 + OpStore %57 %68 + OpStore %46 %58 + OpBranch %48 + %48 = OpLabel + %69 = OpLoad %35 %46 + OpStore %37 %69 + %70 = OpLoad %35 %37 + %71 = OpExtInst %6 %1 Determinant %70 + %72 = OpFOrdEqual %33 %71 %49 + OpSelectionMerge %74 None + OpBranchConditional %72 %73 %74 + %73 = OpLabel + %75 = OpAccessChain %19 %16 %17 %17 + %76 = OpLoad %10 %75 + %77 = OpConvertSToF %6 %76 + %78 = OpAccessChain %19 %16 %17 %18 + %79 = OpLoad %10 %78 + %80 = OpConvertSToF %6 %79 + %81 = OpAccessChain %19 %16 %17 %18 + %82 = OpLoad %10 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpAccessChain %19 %16 %17 %17 + %85 = OpLoad %10 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpCompositeConstruct %7 %77 %80 %83 %86 + OpStore %9 %87 + OpBranch %74 + %74 = OpLabel + OpBranch %29 + %29 = OpLabel + %88 = OpLoad %10 %25 + %89 = OpIAdd %10 %88 %18 + OpStore %25 %89 + OpBranch %26 + %28 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 STD140 DATA + 1 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-dfdx-dfdy-after-nested-loops.amber b/vulkan/amber/graphicsfuzz/cov-dfdx-dfdy-after-nested-loops.amber new file mode 100644 index 0000000..5296691 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-dfdx-dfdy-after-nested-loops.amber @@ -0,0 +1,1136 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# #define LOOP for (int i = 0; i < 5 && _GLF_global_loop_count < _GLF_global_loop_bound; i++, _GLF_global_loop_count++, a++) +# +# void main() +# { +# vec2 v = gl_FragCoord.xy; +# _GLF_color = vec4(v, 0, 1); +# int a = 0; +# +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# // Always false. +# if(gl_FragCoord.x < 0.0) +# { +# return; +# } +# } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } +# +# // Always true because the partial derivative of gl_FragCoord is the same +# // in x and y directions. The two most inner loops run until _GLF_global_loop_count +# // (and a with it) becomes ten. The other loops increase the variable a by one. +# if (dFdx(v.x) - dFdy(v.y) == 0.0 && a == 10 + 38) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 2564 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 %20 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %16 "gl_FragCoord" + OpName %20 "_GLF_color" + OpDecorate %16 BuiltIn FragCoord + OpDecorate %20 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %14 = OpTypeVector %10 4 + %15 = OpTypePointer Input %14 + %16 = OpVariable %15 Input + %19 = OpTypePointer Output %14 + %20 = OpVariable %19 Output + %22 = OpConstant %10 0 + %23 = OpConstant %10 1 + %36 = OpConstant %6 5 + %37 = OpTypeBool + %40 = OpConstant %6 10 + %461 = OpTypeInt 32 0 + %462 = OpConstant %461 0 + %463 = OpTypePointer Input %10 + %471 = OpConstant %6 1 + %716 = OpConstant %6 48 + %721 = OpConstantComposite %14 %23 %22 %22 %23 + %723 = OpConstantComposite %14 %22 %22 %22 %22 + %726 = OpConstantFalse %37 + %729 = OpConstantTrue %37 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %724 None + OpSwitch %462 %725 + %725 = OpLabel + %17 = OpLoad %14 %16 + %24 = OpCompositeExtract %10 %17 0 + %25 = OpCompositeExtract %10 %17 1 + %26 = OpCompositeConstruct %14 %24 %25 %22 %23 + OpStore %20 %26 + OpBranch %30 + %30 = OpLabel + %966 = OpPhi %37 %726 %725 %2483 %33 + %926 = OpPhi %6 %9 %725 %704 %33 + %811 = OpPhi %6 %9 %725 %702 %33 + %810 = OpPhi %6 %9 %725 %700 %33 + %38 = OpSLessThan %37 %810 %36 + %41 = OpSLessThan %37 %811 %40 + %42 = OpLogicalAnd %37 %38 %41 + OpLoopMerge %32 %33 None + OpBranchConditional %42 %31 %32 + %31 = OpLabel + OpBranch %44 + %44 = OpLabel + %965 = OpPhi %37 %966 %31 %2406 %47 + %925 = OpPhi %6 %926 %31 %698 %47 + %813 = OpPhi %6 %811 %31 %696 %47 + %812 = OpPhi %6 %9 %31 %694 %47 + %50 = OpSLessThan %37 %812 %36 + %52 = OpSLessThan %37 %813 %40 + %53 = OpLogicalAnd %37 %50 %52 + OpLoopMerge %46 %47 None + OpBranchConditional %53 %45 %46 + %45 = OpLabel + OpBranch %55 + %55 = OpLabel + %964 = OpPhi %37 %965 %45 %2331 %58 + %924 = OpPhi %6 %925 %45 %692 %58 + %815 = OpPhi %6 %813 %45 %690 %58 + %814 = OpPhi %6 %9 %45 %688 %58 + %61 = OpSLessThan %37 %814 %36 + %63 = OpSLessThan %37 %815 %40 + %64 = OpLogicalAnd %37 %61 %63 + OpLoopMerge %57 %58 None + OpBranchConditional %64 %56 %57 + %56 = OpLabel + OpBranch %66 + %66 = OpLabel + %963 = OpPhi %37 %964 %56 %2258 %69 + %923 = OpPhi %6 %924 %56 %686 %69 + %817 = OpPhi %6 %815 %56 %684 %69 + %816 = OpPhi %6 %9 %56 %682 %69 + %72 = OpSLessThan %37 %816 %36 + %74 = OpSLessThan %37 %817 %40 + %75 = OpLogicalAnd %37 %72 %74 + OpLoopMerge %68 %69 None + OpBranchConditional %75 %67 %68 + %67 = OpLabel + OpBranch %77 + %77 = OpLabel + %962 = OpPhi %37 %963 %67 %2187 %80 + %922 = OpPhi %6 %923 %67 %680 %80 + %819 = OpPhi %6 %817 %67 %678 %80 + %818 = OpPhi %6 %9 %67 %676 %80 + %83 = OpSLessThan %37 %818 %36 + %85 = OpSLessThan %37 %819 %40 + %86 = OpLogicalAnd %37 %83 %85 + OpLoopMerge %79 %80 None + OpBranchConditional %86 %78 %79 + %78 = OpLabel + OpBranch %88 + %88 = OpLabel + %961 = OpPhi %37 %962 %78 %2118 %91 + %921 = OpPhi %6 %922 %78 %674 %91 + %821 = OpPhi %6 %819 %78 %672 %91 + %820 = OpPhi %6 %9 %78 %670 %91 + %94 = OpSLessThan %37 %820 %36 + %96 = OpSLessThan %37 %821 %40 + %97 = OpLogicalAnd %37 %94 %96 + OpLoopMerge %90 %91 None + OpBranchConditional %97 %89 %90 + %89 = OpLabel + OpBranch %99 + %99 = OpLabel + %960 = OpPhi %37 %961 %89 %2051 %102 + %920 = OpPhi %6 %921 %89 %668 %102 + %823 = OpPhi %6 %821 %89 %666 %102 + %822 = OpPhi %6 %9 %89 %664 %102 + %105 = OpSLessThan %37 %822 %36 + %107 = OpSLessThan %37 %823 %40 + %108 = OpLogicalAnd %37 %105 %107 + OpLoopMerge %101 %102 None + OpBranchConditional %108 %100 %101 + %100 = OpLabel + OpBranch %110 + %110 = OpLabel + %959 = OpPhi %37 %960 %100 %1986 %113 + %919 = OpPhi %6 %920 %100 %662 %113 + %825 = OpPhi %6 %823 %100 %660 %113 + %824 = OpPhi %6 %9 %100 %658 %113 + %116 = OpSLessThan %37 %824 %36 + %118 = OpSLessThan %37 %825 %40 + %119 = OpLogicalAnd %37 %116 %118 + OpLoopMerge %112 %113 None + OpBranchConditional %119 %111 %112 + %111 = OpLabel + OpBranch %121 + %121 = OpLabel + %958 = OpPhi %37 %959 %111 %1923 %124 + %918 = OpPhi %6 %919 %111 %656 %124 + %827 = OpPhi %6 %825 %111 %654 %124 + %826 = OpPhi %6 %9 %111 %652 %124 + %127 = OpSLessThan %37 %826 %36 + %129 = OpSLessThan %37 %827 %40 + %130 = OpLogicalAnd %37 %127 %129 + OpLoopMerge %123 %124 None + OpBranchConditional %130 %122 %123 + %122 = OpLabel + OpBranch %132 + %132 = OpLabel + %957 = OpPhi %37 %958 %122 %1862 %135 + %917 = OpPhi %6 %918 %122 %650 %135 + %829 = OpPhi %6 %827 %122 %648 %135 + %828 = OpPhi %6 %9 %122 %646 %135 + %138 = OpSLessThan %37 %828 %36 + %140 = OpSLessThan %37 %829 %40 + %141 = OpLogicalAnd %37 %138 %140 + OpLoopMerge %134 %135 None + OpBranchConditional %141 %133 %134 + %133 = OpLabel + OpBranch %143 + %143 = OpLabel + %956 = OpPhi %37 %957 %133 %1803 %146 + %916 = OpPhi %6 %917 %133 %644 %146 + %831 = OpPhi %6 %829 %133 %642 %146 + %830 = OpPhi %6 %9 %133 %640 %146 + %149 = OpSLessThan %37 %830 %36 + %151 = OpSLessThan %37 %831 %40 + %152 = OpLogicalAnd %37 %149 %151 + OpLoopMerge %145 %146 None + OpBranchConditional %152 %144 %145 + %144 = OpLabel + OpBranch %154 + %154 = OpLabel + %955 = OpPhi %37 %956 %144 %1746 %157 + %915 = OpPhi %6 %916 %144 %638 %157 + %833 = OpPhi %6 %831 %144 %636 %157 + %832 = OpPhi %6 %9 %144 %634 %157 + %160 = OpSLessThan %37 %832 %36 + %162 = OpSLessThan %37 %833 %40 + %163 = OpLogicalAnd %37 %160 %162 + OpLoopMerge %156 %157 None + OpBranchConditional %163 %155 %156 + %155 = OpLabel + OpBranch %165 + %165 = OpLabel + %954 = OpPhi %37 %955 %155 %1691 %168 + %914 = OpPhi %6 %915 %155 %632 %168 + %835 = OpPhi %6 %833 %155 %630 %168 + %834 = OpPhi %6 %9 %155 %628 %168 + %171 = OpSLessThan %37 %834 %36 + %173 = OpSLessThan %37 %835 %40 + %174 = OpLogicalAnd %37 %171 %173 + OpLoopMerge %167 %168 None + OpBranchConditional %174 %166 %167 + %166 = OpLabel + OpBranch %176 + %176 = OpLabel + %953 = OpPhi %37 %954 %166 %1638 %179 + %913 = OpPhi %6 %914 %166 %626 %179 + %837 = OpPhi %6 %835 %166 %624 %179 + %836 = OpPhi %6 %9 %166 %622 %179 + %182 = OpSLessThan %37 %836 %36 + %184 = OpSLessThan %37 %837 %40 + %185 = OpLogicalAnd %37 %182 %184 + OpLoopMerge %178 %179 None + OpBranchConditional %185 %177 %178 + %177 = OpLabel + OpBranch %187 + %187 = OpLabel + %952 = OpPhi %37 %953 %177 %1587 %190 + %912 = OpPhi %6 %913 %177 %620 %190 + %839 = OpPhi %6 %837 %177 %618 %190 + %838 = OpPhi %6 %9 %177 %616 %190 + %193 = OpSLessThan %37 %838 %36 + %195 = OpSLessThan %37 %839 %40 + %196 = OpLogicalAnd %37 %193 %195 + OpLoopMerge %189 %190 None + OpBranchConditional %196 %188 %189 + %188 = OpLabel + OpBranch %198 + %198 = OpLabel + %951 = OpPhi %37 %952 %188 %1538 %201 + %911 = OpPhi %6 %912 %188 %614 %201 + %841 = OpPhi %6 %839 %188 %612 %201 + %840 = OpPhi %6 %9 %188 %610 %201 + %204 = OpSLessThan %37 %840 %36 + %206 = OpSLessThan %37 %841 %40 + %207 = OpLogicalAnd %37 %204 %206 + OpLoopMerge %200 %201 None + OpBranchConditional %207 %199 %200 + %199 = OpLabel + OpBranch %209 + %209 = OpLabel + %950 = OpPhi %37 %951 %199 %1491 %212 + %910 = OpPhi %6 %911 %199 %608 %212 + %843 = OpPhi %6 %841 %199 %606 %212 + %842 = OpPhi %6 %9 %199 %604 %212 + %215 = OpSLessThan %37 %842 %36 + %217 = OpSLessThan %37 %843 %40 + %218 = OpLogicalAnd %37 %215 %217 + OpLoopMerge %211 %212 None + OpBranchConditional %218 %210 %211 + %210 = OpLabel + OpBranch %220 + %220 = OpLabel + %949 = OpPhi %37 %950 %210 %1446 %223 + %909 = OpPhi %6 %910 %210 %602 %223 + %845 = OpPhi %6 %843 %210 %600 %223 + %844 = OpPhi %6 %9 %210 %598 %223 + %226 = OpSLessThan %37 %844 %36 + %228 = OpSLessThan %37 %845 %40 + %229 = OpLogicalAnd %37 %226 %228 + OpLoopMerge %222 %223 None + OpBranchConditional %229 %221 %222 + %221 = OpLabel + OpBranch %231 + %231 = OpLabel + %948 = OpPhi %37 %949 %221 %1403 %234 + %908 = OpPhi %6 %909 %221 %596 %234 + %847 = OpPhi %6 %845 %221 %594 %234 + %846 = OpPhi %6 %9 %221 %592 %234 + %237 = OpSLessThan %37 %846 %36 + %239 = OpSLessThan %37 %847 %40 + %240 = OpLogicalAnd %37 %237 %239 + OpLoopMerge %233 %234 None + OpBranchConditional %240 %232 %233 + %232 = OpLabel + OpBranch %242 + %242 = OpLabel + %947 = OpPhi %37 %948 %232 %1362 %245 + %907 = OpPhi %6 %908 %232 %590 %245 + %849 = OpPhi %6 %847 %232 %588 %245 + %848 = OpPhi %6 %9 %232 %586 %245 + %248 = OpSLessThan %37 %848 %36 + %250 = OpSLessThan %37 %849 %40 + %251 = OpLogicalAnd %37 %248 %250 + OpLoopMerge %244 %245 None + OpBranchConditional %251 %243 %244 + %243 = OpLabel + OpBranch %253 + %253 = OpLabel + %946 = OpPhi %37 %947 %243 %1323 %256 + %906 = OpPhi %6 %907 %243 %584 %256 + %851 = OpPhi %6 %849 %243 %582 %256 + %850 = OpPhi %6 %9 %243 %580 %256 + %259 = OpSLessThan %37 %850 %36 + %261 = OpSLessThan %37 %851 %40 + %262 = OpLogicalAnd %37 %259 %261 + OpLoopMerge %255 %256 None + OpBranchConditional %262 %254 %255 + %254 = OpLabel + OpBranch %264 + %264 = OpLabel + %945 = OpPhi %37 %946 %254 %1286 %267 + %905 = OpPhi %6 %906 %254 %578 %267 + %853 = OpPhi %6 %851 %254 %576 %267 + %852 = OpPhi %6 %9 %254 %574 %267 + %270 = OpSLessThan %37 %852 %36 + %272 = OpSLessThan %37 %853 %40 + %273 = OpLogicalAnd %37 %270 %272 + OpLoopMerge %266 %267 None + OpBranchConditional %273 %265 %266 + %265 = OpLabel + OpBranch %275 + %275 = OpLabel + %944 = OpPhi %37 %945 %265 %1251 %278 + %904 = OpPhi %6 %905 %265 %572 %278 + %855 = OpPhi %6 %853 %265 %570 %278 + %854 = OpPhi %6 %9 %265 %568 %278 + %281 = OpSLessThan %37 %854 %36 + %283 = OpSLessThan %37 %855 %40 + %284 = OpLogicalAnd %37 %281 %283 + OpLoopMerge %277 %278 None + OpBranchConditional %284 %276 %277 + %276 = OpLabel + OpBranch %286 + %286 = OpLabel + %943 = OpPhi %37 %944 %276 %1218 %289 + %903 = OpPhi %6 %904 %276 %566 %289 + %857 = OpPhi %6 %855 %276 %564 %289 + %856 = OpPhi %6 %9 %276 %562 %289 + %292 = OpSLessThan %37 %856 %36 + %294 = OpSLessThan %37 %857 %40 + %295 = OpLogicalAnd %37 %292 %294 + OpLoopMerge %288 %289 None + OpBranchConditional %295 %287 %288 + %287 = OpLabel + OpBranch %297 + %297 = OpLabel + %942 = OpPhi %37 %943 %287 %1187 %300 + %902 = OpPhi %6 %903 %287 %560 %300 + %859 = OpPhi %6 %857 %287 %558 %300 + %858 = OpPhi %6 %9 %287 %556 %300 + %303 = OpSLessThan %37 %858 %36 + %305 = OpSLessThan %37 %859 %40 + %306 = OpLogicalAnd %37 %303 %305 + OpLoopMerge %299 %300 None + OpBranchConditional %306 %298 %299 + %298 = OpLabel + OpBranch %308 + %308 = OpLabel + %941 = OpPhi %37 %942 %298 %1158 %311 + %901 = OpPhi %6 %902 %298 %554 %311 + %861 = OpPhi %6 %859 %298 %552 %311 + %860 = OpPhi %6 %9 %298 %550 %311 + %314 = OpSLessThan %37 %860 %36 + %316 = OpSLessThan %37 %861 %40 + %317 = OpLogicalAnd %37 %314 %316 + OpLoopMerge %310 %311 None + OpBranchConditional %317 %309 %310 + %309 = OpLabel + OpBranch %319 + %319 = OpLabel + %940 = OpPhi %37 %941 %309 %1131 %322 + %900 = OpPhi %6 %901 %309 %548 %322 + %863 = OpPhi %6 %861 %309 %546 %322 + %862 = OpPhi %6 %9 %309 %544 %322 + %325 = OpSLessThan %37 %862 %36 + %327 = OpSLessThan %37 %863 %40 + %328 = OpLogicalAnd %37 %325 %327 + OpLoopMerge %321 %322 None + OpBranchConditional %328 %320 %321 + %320 = OpLabel + OpBranch %330 + %330 = OpLabel + %939 = OpPhi %37 %940 %320 %1106 %333 + %899 = OpPhi %6 %900 %320 %542 %333 + %865 = OpPhi %6 %863 %320 %540 %333 + %864 = OpPhi %6 %9 %320 %538 %333 + %336 = OpSLessThan %37 %864 %36 + %338 = OpSLessThan %37 %865 %40 + %339 = OpLogicalAnd %37 %336 %338 + OpLoopMerge %332 %333 None + OpBranchConditional %339 %331 %332 + %331 = OpLabel + OpBranch %341 + %341 = OpLabel + %938 = OpPhi %37 %939 %331 %1083 %344 + %898 = OpPhi %6 %899 %331 %536 %344 + %867 = OpPhi %6 %865 %331 %534 %344 + %866 = OpPhi %6 %9 %331 %532 %344 + %347 = OpSLessThan %37 %866 %36 + %349 = OpSLessThan %37 %867 %40 + %350 = OpLogicalAnd %37 %347 %349 + OpLoopMerge %343 %344 None + OpBranchConditional %350 %342 %343 + %342 = OpLabel + OpBranch %352 + %352 = OpLabel + %937 = OpPhi %37 %938 %342 %1062 %355 + %897 = OpPhi %6 %898 %342 %530 %355 + %869 = OpPhi %6 %867 %342 %528 %355 + %868 = OpPhi %6 %9 %342 %526 %355 + %358 = OpSLessThan %37 %868 %36 + %360 = OpSLessThan %37 %869 %40 + %361 = OpLogicalAnd %37 %358 %360 + OpLoopMerge %354 %355 None + OpBranchConditional %361 %353 %354 + %353 = OpLabel + OpBranch %363 + %363 = OpLabel + %936 = OpPhi %37 %937 %353 %1043 %366 + %896 = OpPhi %6 %897 %353 %524 %366 + %871 = OpPhi %6 %869 %353 %522 %366 + %870 = OpPhi %6 %9 %353 %520 %366 + %369 = OpSLessThan %37 %870 %36 + %371 = OpSLessThan %37 %871 %40 + %372 = OpLogicalAnd %37 %369 %371 + OpLoopMerge %365 %366 None + OpBranchConditional %372 %364 %365 + %364 = OpLabel + OpBranch %374 + %374 = OpLabel + %935 = OpPhi %37 %936 %364 %1026 %377 + %895 = OpPhi %6 %896 %364 %518 %377 + %873 = OpPhi %6 %871 %364 %516 %377 + %872 = OpPhi %6 %9 %364 %514 %377 + %380 = OpSLessThan %37 %872 %36 + %382 = OpSLessThan %37 %873 %40 + %383 = OpLogicalAnd %37 %380 %382 + OpLoopMerge %376 %377 None + OpBranchConditional %383 %375 %376 + %375 = OpLabel + OpBranch %385 + %385 = OpLabel + %934 = OpPhi %37 %935 %375 %1011 %388 + %894 = OpPhi %6 %895 %375 %512 %388 + %875 = OpPhi %6 %873 %375 %510 %388 + %874 = OpPhi %6 %9 %375 %508 %388 + %391 = OpSLessThan %37 %874 %36 + %393 = OpSLessThan %37 %875 %40 + %394 = OpLogicalAnd %37 %391 %393 + OpLoopMerge %387 %388 None + OpBranchConditional %394 %386 %387 + %386 = OpLabel + OpBranch %396 + %396 = OpLabel + %933 = OpPhi %37 %934 %386 %998 %399 + %893 = OpPhi %6 %894 %386 %506 %399 + %877 = OpPhi %6 %875 %386 %504 %399 + %876 = OpPhi %6 %9 %386 %502 %399 + %402 = OpSLessThan %37 %876 %36 + %404 = OpSLessThan %37 %877 %40 + %405 = OpLogicalAnd %37 %402 %404 + OpLoopMerge %398 %399 None + OpBranchConditional %405 %397 %398 + %397 = OpLabel + OpBranch %407 + %407 = OpLabel + %932 = OpPhi %37 %933 %397 %987 %410 + %892 = OpPhi %6 %893 %397 %500 %410 + %879 = OpPhi %6 %877 %397 %498 %410 + %878 = OpPhi %6 %9 %397 %496 %410 + %413 = OpSLessThan %37 %878 %36 + %415 = OpSLessThan %37 %879 %40 + %416 = OpLogicalAnd %37 %413 %415 + OpLoopMerge %409 %410 None + OpBranchConditional %416 %408 %409 + %408 = OpLabel + OpBranch %418 + %418 = OpLabel + %931 = OpPhi %37 %932 %408 %978 %421 + %891 = OpPhi %6 %892 %408 %494 %421 + %881 = OpPhi %6 %879 %408 %492 %421 + %880 = OpPhi %6 %9 %408 %490 %421 + %424 = OpSLessThan %37 %880 %36 + %426 = OpSLessThan %37 %881 %40 + %427 = OpLogicalAnd %37 %424 %426 + OpLoopMerge %420 %421 None + OpBranchConditional %427 %419 %420 + %419 = OpLabel + OpBranch %429 + %429 = OpLabel + %930 = OpPhi %37 %931 %419 %971 %432 + %890 = OpPhi %6 %891 %419 %488 %432 + %883 = OpPhi %6 %881 %419 %486 %432 + %882 = OpPhi %6 %9 %419 %484 %432 + %435 = OpSLessThan %37 %882 %36 + %437 = OpSLessThan %37 %883 %40 + %438 = OpLogicalAnd %37 %435 %437 + OpLoopMerge %431 %432 None + OpBranchConditional %438 %430 %431 + %430 = OpLabel + OpBranch %440 + %440 = OpLabel + %929 = OpPhi %37 %930 %430 %927 %443 + %889 = OpPhi %6 %890 %430 %482 %443 + %885 = OpPhi %6 %883 %430 %480 %443 + %884 = OpPhi %6 %9 %430 %478 %443 + %446 = OpSLessThan %37 %884 %36 + %448 = OpSLessThan %37 %885 %40 + %449 = OpLogicalAnd %37 %446 %448 + OpLoopMerge %442 %443 None + OpBranchConditional %449 %441 %442 + %441 = OpLabel + OpBranch %451 + %451 = OpLabel + %888 = OpPhi %6 %889 %441 %476 %454 + %887 = OpPhi %6 %885 %441 %474 %454 + %886 = OpPhi %6 %9 %441 %472 %454 + %457 = OpSLessThan %37 %886 %36 + %459 = OpSLessThan %37 %887 %40 + %460 = OpLogicalAnd %37 %457 %459 + OpLoopMerge %453 %454 None + OpBranchConditional %460 %452 %453 + %452 = OpLabel + %464 = OpAccessChain %463 %16 %462 + %465 = OpLoad %10 %464 + %466 = OpFOrdLessThan %37 %465 %22 + OpSelectionMerge %468 None + OpBranchConditional %466 %467 %468 + %467 = OpLabel + OpBranch %453 + %468 = OpLabel + OpBranch %454 + %454 = OpLabel + %472 = OpIAdd %6 %886 %471 + %474 = OpIAdd %6 %887 %471 + %476 = OpIAdd %6 %888 %471 + OpBranch %451 + %453 = OpLabel + %927 = OpPhi %37 %929 %451 %729 %467 + OpSelectionMerge %730 None + OpBranchConditional %927 %442 %730 + %730 = OpLabel + OpBranch %443 + %443 = OpLabel + %478 = OpIAdd %6 %884 %471 + %480 = OpIAdd %6 %887 %471 + %482 = OpIAdd %6 %888 %471 + OpBranch %440 + %442 = OpLabel + %977 = OpPhi %6 %889 %440 %888 %453 + %976 = OpPhi %6 %885 %440 %887 %453 + %971 = OpPhi %37 %929 %440 %927 %453 + OpSelectionMerge %732 None + OpBranchConditional %971 %431 %732 + %732 = OpLabel + OpBranch %432 + %432 = OpLabel + %484 = OpIAdd %6 %882 %471 + %486 = OpIAdd %6 %976 %471 + %488 = OpIAdd %6 %977 %471 + OpBranch %429 + %431 = OpLabel + %986 = OpPhi %6 %890 %429 %977 %442 + %985 = OpPhi %6 %883 %429 %976 %442 + %978 = OpPhi %37 %930 %429 %971 %442 + OpSelectionMerge %734 None + OpBranchConditional %978 %420 %734 + %734 = OpLabel + OpBranch %421 + %421 = OpLabel + %490 = OpIAdd %6 %880 %471 + %492 = OpIAdd %6 %985 %471 + %494 = OpIAdd %6 %986 %471 + OpBranch %418 + %420 = OpLabel + %997 = OpPhi %6 %891 %418 %986 %431 + %996 = OpPhi %6 %881 %418 %985 %431 + %987 = OpPhi %37 %931 %418 %978 %431 + OpSelectionMerge %736 None + OpBranchConditional %987 %409 %736 + %736 = OpLabel + OpBranch %410 + %410 = OpLabel + %496 = OpIAdd %6 %878 %471 + %498 = OpIAdd %6 %996 %471 + %500 = OpIAdd %6 %997 %471 + OpBranch %407 + %409 = OpLabel + %1010 = OpPhi %6 %892 %407 %997 %420 + %1009 = OpPhi %6 %879 %407 %996 %420 + %998 = OpPhi %37 %932 %407 %987 %420 + OpSelectionMerge %738 None + OpBranchConditional %998 %398 %738 + %738 = OpLabel + OpBranch %399 + %399 = OpLabel + %502 = OpIAdd %6 %876 %471 + %504 = OpIAdd %6 %1009 %471 + %506 = OpIAdd %6 %1010 %471 + OpBranch %396 + %398 = OpLabel + %1025 = OpPhi %6 %893 %396 %1010 %409 + %1024 = OpPhi %6 %877 %396 %1009 %409 + %1011 = OpPhi %37 %933 %396 %998 %409 + OpSelectionMerge %740 None + OpBranchConditional %1011 %387 %740 + %740 = OpLabel + OpBranch %388 + %388 = OpLabel + %508 = OpIAdd %6 %874 %471 + %510 = OpIAdd %6 %1024 %471 + %512 = OpIAdd %6 %1025 %471 + OpBranch %385 + %387 = OpLabel + %1042 = OpPhi %6 %894 %385 %1025 %398 + %1041 = OpPhi %6 %875 %385 %1024 %398 + %1026 = OpPhi %37 %934 %385 %1011 %398 + OpSelectionMerge %742 None + OpBranchConditional %1026 %376 %742 + %742 = OpLabel + OpBranch %377 + %377 = OpLabel + %514 = OpIAdd %6 %872 %471 + %516 = OpIAdd %6 %1041 %471 + %518 = OpIAdd %6 %1042 %471 + OpBranch %374 + %376 = OpLabel + %1061 = OpPhi %6 %895 %374 %1042 %387 + %1060 = OpPhi %6 %873 %374 %1041 %387 + %1043 = OpPhi %37 %935 %374 %1026 %387 + OpSelectionMerge %744 None + OpBranchConditional %1043 %365 %744 + %744 = OpLabel + OpBranch %366 + %366 = OpLabel + %520 = OpIAdd %6 %870 %471 + %522 = OpIAdd %6 %1060 %471 + %524 = OpIAdd %6 %1061 %471 + OpBranch %363 + %365 = OpLabel + %1082 = OpPhi %6 %896 %363 %1061 %376 + %1081 = OpPhi %6 %871 %363 %1060 %376 + %1062 = OpPhi %37 %936 %363 %1043 %376 + OpSelectionMerge %746 None + OpBranchConditional %1062 %354 %746 + %746 = OpLabel + OpBranch %355 + %355 = OpLabel + %526 = OpIAdd %6 %868 %471 + %528 = OpIAdd %6 %1081 %471 + %530 = OpIAdd %6 %1082 %471 + OpBranch %352 + %354 = OpLabel + %1105 = OpPhi %6 %897 %352 %1082 %365 + %1104 = OpPhi %6 %869 %352 %1081 %365 + %1083 = OpPhi %37 %937 %352 %1062 %365 + OpSelectionMerge %748 None + OpBranchConditional %1083 %343 %748 + %748 = OpLabel + OpBranch %344 + %344 = OpLabel + %532 = OpIAdd %6 %866 %471 + %534 = OpIAdd %6 %1104 %471 + %536 = OpIAdd %6 %1105 %471 + OpBranch %341 + %343 = OpLabel + %1130 = OpPhi %6 %898 %341 %1105 %354 + %1129 = OpPhi %6 %867 %341 %1104 %354 + %1106 = OpPhi %37 %938 %341 %1083 %354 + OpSelectionMerge %750 None + OpBranchConditional %1106 %332 %750 + %750 = OpLabel + OpBranch %333 + %333 = OpLabel + %538 = OpIAdd %6 %864 %471 + %540 = OpIAdd %6 %1129 %471 + %542 = OpIAdd %6 %1130 %471 + OpBranch %330 + %332 = OpLabel + %1157 = OpPhi %6 %899 %330 %1130 %343 + %1156 = OpPhi %6 %865 %330 %1129 %343 + %1131 = OpPhi %37 %939 %330 %1106 %343 + OpSelectionMerge %752 None + OpBranchConditional %1131 %321 %752 + %752 = OpLabel + OpBranch %322 + %322 = OpLabel + %544 = OpIAdd %6 %862 %471 + %546 = OpIAdd %6 %1156 %471 + %548 = OpIAdd %6 %1157 %471 + OpBranch %319 + %321 = OpLabel + %1186 = OpPhi %6 %900 %319 %1157 %332 + %1185 = OpPhi %6 %863 %319 %1156 %332 + %1158 = OpPhi %37 %940 %319 %1131 %332 + OpSelectionMerge %754 None + OpBranchConditional %1158 %310 %754 + %754 = OpLabel + OpBranch %311 + %311 = OpLabel + %550 = OpIAdd %6 %860 %471 + %552 = OpIAdd %6 %1185 %471 + %554 = OpIAdd %6 %1186 %471 + OpBranch %308 + %310 = OpLabel + %1217 = OpPhi %6 %901 %308 %1186 %321 + %1216 = OpPhi %6 %861 %308 %1185 %321 + %1187 = OpPhi %37 %941 %308 %1158 %321 + OpSelectionMerge %756 None + OpBranchConditional %1187 %299 %756 + %756 = OpLabel + OpBranch %300 + %300 = OpLabel + %556 = OpIAdd %6 %858 %471 + %558 = OpIAdd %6 %1216 %471 + %560 = OpIAdd %6 %1217 %471 + OpBranch %297 + %299 = OpLabel + %1250 = OpPhi %6 %902 %297 %1217 %310 + %1249 = OpPhi %6 %859 %297 %1216 %310 + %1218 = OpPhi %37 %942 %297 %1187 %310 + OpSelectionMerge %758 None + OpBranchConditional %1218 %288 %758 + %758 = OpLabel + OpBranch %289 + %289 = OpLabel + %562 = OpIAdd %6 %856 %471 + %564 = OpIAdd %6 %1249 %471 + %566 = OpIAdd %6 %1250 %471 + OpBranch %286 + %288 = OpLabel + %1285 = OpPhi %6 %903 %286 %1250 %299 + %1284 = OpPhi %6 %857 %286 %1249 %299 + %1251 = OpPhi %37 %943 %286 %1218 %299 + OpSelectionMerge %760 None + OpBranchConditional %1251 %277 %760 + %760 = OpLabel + OpBranch %278 + %278 = OpLabel + %568 = OpIAdd %6 %854 %471 + %570 = OpIAdd %6 %1284 %471 + %572 = OpIAdd %6 %1285 %471 + OpBranch %275 + %277 = OpLabel + %1322 = OpPhi %6 %904 %275 %1285 %288 + %1321 = OpPhi %6 %855 %275 %1284 %288 + %1286 = OpPhi %37 %944 %275 %1251 %288 + OpSelectionMerge %762 None + OpBranchConditional %1286 %266 %762 + %762 = OpLabel + OpBranch %267 + %267 = OpLabel + %574 = OpIAdd %6 %852 %471 + %576 = OpIAdd %6 %1321 %471 + %578 = OpIAdd %6 %1322 %471 + OpBranch %264 + %266 = OpLabel + %1361 = OpPhi %6 %905 %264 %1322 %277 + %1360 = OpPhi %6 %853 %264 %1321 %277 + %1323 = OpPhi %37 %945 %264 %1286 %277 + OpSelectionMerge %764 None + OpBranchConditional %1323 %255 %764 + %764 = OpLabel + OpBranch %256 + %256 = OpLabel + %580 = OpIAdd %6 %850 %471 + %582 = OpIAdd %6 %1360 %471 + %584 = OpIAdd %6 %1361 %471 + OpBranch %253 + %255 = OpLabel + %1402 = OpPhi %6 %906 %253 %1361 %266 + %1401 = OpPhi %6 %851 %253 %1360 %266 + %1362 = OpPhi %37 %946 %253 %1323 %266 + OpSelectionMerge %766 None + OpBranchConditional %1362 %244 %766 + %766 = OpLabel + OpBranch %245 + %245 = OpLabel + %586 = OpIAdd %6 %848 %471 + %588 = OpIAdd %6 %1401 %471 + %590 = OpIAdd %6 %1402 %471 + OpBranch %242 + %244 = OpLabel + %1445 = OpPhi %6 %907 %242 %1402 %255 + %1444 = OpPhi %6 %849 %242 %1401 %255 + %1403 = OpPhi %37 %947 %242 %1362 %255 + OpSelectionMerge %768 None + OpBranchConditional %1403 %233 %768 + %768 = OpLabel + OpBranch %234 + %234 = OpLabel + %592 = OpIAdd %6 %846 %471 + %594 = OpIAdd %6 %1444 %471 + %596 = OpIAdd %6 %1445 %471 + OpBranch %231 + %233 = OpLabel + %1490 = OpPhi %6 %908 %231 %1445 %244 + %1489 = OpPhi %6 %847 %231 %1444 %244 + %1446 = OpPhi %37 %948 %231 %1403 %244 + OpSelectionMerge %770 None + OpBranchConditional %1446 %222 %770 + %770 = OpLabel + OpBranch %223 + %223 = OpLabel + %598 = OpIAdd %6 %844 %471 + %600 = OpIAdd %6 %1489 %471 + %602 = OpIAdd %6 %1490 %471 + OpBranch %220 + %222 = OpLabel + %1537 = OpPhi %6 %909 %220 %1490 %233 + %1536 = OpPhi %6 %845 %220 %1489 %233 + %1491 = OpPhi %37 %949 %220 %1446 %233 + OpSelectionMerge %772 None + OpBranchConditional %1491 %211 %772 + %772 = OpLabel + OpBranch %212 + %212 = OpLabel + %604 = OpIAdd %6 %842 %471 + %606 = OpIAdd %6 %1536 %471 + %608 = OpIAdd %6 %1537 %471 + OpBranch %209 + %211 = OpLabel + %1586 = OpPhi %6 %910 %209 %1537 %222 + %1585 = OpPhi %6 %843 %209 %1536 %222 + %1538 = OpPhi %37 %950 %209 %1491 %222 + OpSelectionMerge %774 None + OpBranchConditional %1538 %200 %774 + %774 = OpLabel + OpBranch %201 + %201 = OpLabel + %610 = OpIAdd %6 %840 %471 + %612 = OpIAdd %6 %1585 %471 + %614 = OpIAdd %6 %1586 %471 + OpBranch %198 + %200 = OpLabel + %1637 = OpPhi %6 %911 %198 %1586 %211 + %1636 = OpPhi %6 %841 %198 %1585 %211 + %1587 = OpPhi %37 %951 %198 %1538 %211 + OpSelectionMerge %776 None + OpBranchConditional %1587 %189 %776 + %776 = OpLabel + OpBranch %190 + %190 = OpLabel + %616 = OpIAdd %6 %838 %471 + %618 = OpIAdd %6 %1636 %471 + %620 = OpIAdd %6 %1637 %471 + OpBranch %187 + %189 = OpLabel + %1690 = OpPhi %6 %912 %187 %1637 %200 + %1689 = OpPhi %6 %839 %187 %1636 %200 + %1638 = OpPhi %37 %952 %187 %1587 %200 + OpSelectionMerge %778 None + OpBranchConditional %1638 %178 %778 + %778 = OpLabel + OpBranch %179 + %179 = OpLabel + %622 = OpIAdd %6 %836 %471 + %624 = OpIAdd %6 %1689 %471 + %626 = OpIAdd %6 %1690 %471 + OpBranch %176 + %178 = OpLabel + %1745 = OpPhi %6 %913 %176 %1690 %189 + %1744 = OpPhi %6 %837 %176 %1689 %189 + %1691 = OpPhi %37 %953 %176 %1638 %189 + OpSelectionMerge %780 None + OpBranchConditional %1691 %167 %780 + %780 = OpLabel + OpBranch %168 + %168 = OpLabel + %628 = OpIAdd %6 %834 %471 + %630 = OpIAdd %6 %1744 %471 + %632 = OpIAdd %6 %1745 %471 + OpBranch %165 + %167 = OpLabel + %1802 = OpPhi %6 %914 %165 %1745 %178 + %1801 = OpPhi %6 %835 %165 %1744 %178 + %1746 = OpPhi %37 %954 %165 %1691 %178 + OpSelectionMerge %782 None + OpBranchConditional %1746 %156 %782 + %782 = OpLabel + OpBranch %157 + %157 = OpLabel + %634 = OpIAdd %6 %832 %471 + %636 = OpIAdd %6 %1801 %471 + %638 = OpIAdd %6 %1802 %471 + OpBranch %154 + %156 = OpLabel + %1861 = OpPhi %6 %915 %154 %1802 %167 + %1860 = OpPhi %6 %833 %154 %1801 %167 + %1803 = OpPhi %37 %955 %154 %1746 %167 + OpSelectionMerge %784 None + OpBranchConditional %1803 %145 %784 + %784 = OpLabel + OpBranch %146 + %146 = OpLabel + %640 = OpIAdd %6 %830 %471 + %642 = OpIAdd %6 %1860 %471 + %644 = OpIAdd %6 %1861 %471 + OpBranch %143 + %145 = OpLabel + %1922 = OpPhi %6 %916 %143 %1861 %156 + %1921 = OpPhi %6 %831 %143 %1860 %156 + %1862 = OpPhi %37 %956 %143 %1803 %156 + OpSelectionMerge %786 None + OpBranchConditional %1862 %134 %786 + %786 = OpLabel + OpBranch %135 + %135 = OpLabel + %646 = OpIAdd %6 %828 %471 + %648 = OpIAdd %6 %1921 %471 + %650 = OpIAdd %6 %1922 %471 + OpBranch %132 + %134 = OpLabel + %1985 = OpPhi %6 %917 %132 %1922 %145 + %1984 = OpPhi %6 %829 %132 %1921 %145 + %1923 = OpPhi %37 %957 %132 %1862 %145 + OpSelectionMerge %788 None + OpBranchConditional %1923 %123 %788 + %788 = OpLabel + OpBranch %124 + %124 = OpLabel + %652 = OpIAdd %6 %826 %471 + %654 = OpIAdd %6 %1984 %471 + %656 = OpIAdd %6 %1985 %471 + OpBranch %121 + %123 = OpLabel + %2050 = OpPhi %6 %918 %121 %1985 %134 + %2049 = OpPhi %6 %827 %121 %1984 %134 + %1986 = OpPhi %37 %958 %121 %1923 %134 + OpSelectionMerge %790 None + OpBranchConditional %1986 %112 %790 + %790 = OpLabel + OpBranch %113 + %113 = OpLabel + %658 = OpIAdd %6 %824 %471 + %660 = OpIAdd %6 %2049 %471 + %662 = OpIAdd %6 %2050 %471 + OpBranch %110 + %112 = OpLabel + %2117 = OpPhi %6 %919 %110 %2050 %123 + %2116 = OpPhi %6 %825 %110 %2049 %123 + %2051 = OpPhi %37 %959 %110 %1986 %123 + OpSelectionMerge %792 None + OpBranchConditional %2051 %101 %792 + %792 = OpLabel + OpBranch %102 + %102 = OpLabel + %664 = OpIAdd %6 %822 %471 + %666 = OpIAdd %6 %2116 %471 + %668 = OpIAdd %6 %2117 %471 + OpBranch %99 + %101 = OpLabel + %2186 = OpPhi %6 %920 %99 %2117 %112 + %2185 = OpPhi %6 %823 %99 %2116 %112 + %2118 = OpPhi %37 %960 %99 %2051 %112 + OpSelectionMerge %794 None + OpBranchConditional %2118 %90 %794 + %794 = OpLabel + OpBranch %91 + %91 = OpLabel + %670 = OpIAdd %6 %820 %471 + %672 = OpIAdd %6 %2185 %471 + %674 = OpIAdd %6 %2186 %471 + OpBranch %88 + %90 = OpLabel + %2257 = OpPhi %6 %921 %88 %2186 %101 + %2256 = OpPhi %6 %821 %88 %2185 %101 + %2187 = OpPhi %37 %961 %88 %2118 %101 + OpSelectionMerge %796 None + OpBranchConditional %2187 %79 %796 + %796 = OpLabel + OpBranch %80 + %80 = OpLabel + %676 = OpIAdd %6 %818 %471 + %678 = OpIAdd %6 %2256 %471 + %680 = OpIAdd %6 %2257 %471 + OpBranch %77 + %79 = OpLabel + %2330 = OpPhi %6 %922 %77 %2257 %90 + %2329 = OpPhi %6 %819 %77 %2256 %90 + %2258 = OpPhi %37 %962 %77 %2187 %90 + OpSelectionMerge %798 None + OpBranchConditional %2258 %68 %798 + %798 = OpLabel + OpBranch %69 + %69 = OpLabel + %682 = OpIAdd %6 %816 %471 + %684 = OpIAdd %6 %2329 %471 + %686 = OpIAdd %6 %2330 %471 + OpBranch %66 + %68 = OpLabel + %2405 = OpPhi %6 %923 %66 %2330 %79 + %2404 = OpPhi %6 %817 %66 %2329 %79 + %2331 = OpPhi %37 %963 %66 %2258 %79 + OpSelectionMerge %800 None + OpBranchConditional %2331 %57 %800 + %800 = OpLabel + OpBranch %58 + %58 = OpLabel + %688 = OpIAdd %6 %814 %471 + %690 = OpIAdd %6 %2404 %471 + %692 = OpIAdd %6 %2405 %471 + OpBranch %55 + %57 = OpLabel + %2482 = OpPhi %6 %924 %55 %2405 %68 + %2481 = OpPhi %6 %815 %55 %2404 %68 + %2406 = OpPhi %37 %964 %55 %2331 %68 + OpSelectionMerge %802 None + OpBranchConditional %2406 %46 %802 + %802 = OpLabel + OpBranch %47 + %47 = OpLabel + %694 = OpIAdd %6 %812 %471 + %696 = OpIAdd %6 %2481 %471 + %698 = OpIAdd %6 %2482 %471 + OpBranch %44 + %46 = OpLabel + %2561 = OpPhi %6 %925 %44 %2482 %57 + %2560 = OpPhi %6 %813 %44 %2481 %57 + %2483 = OpPhi %37 %965 %44 %2406 %57 + OpSelectionMerge %804 None + OpBranchConditional %2483 %32 %804 + %804 = OpLabel + OpBranch %33 + %33 = OpLabel + %700 = OpIAdd %6 %810 %471 + %702 = OpIAdd %6 %2560 %471 + %704 = OpIAdd %6 %2561 %471 + OpBranch %30 + %32 = OpLabel + %2563 = OpPhi %6 %926 %30 %2561 %46 + %2562 = OpPhi %37 %966 %30 %2483 %46 + OpSelectionMerge %806 None + OpBranchConditional %2562 %724 %806 + %806 = OpLabel + %708 = OpDPdx %10 %24 + %712 = OpDPdy %10 %25 + %713 = OpFSub %10 %708 %712 + %714 = OpFOrdEqual %37 %713 %22 + %717 = OpIEqual %37 %2563 %716 + %718 = OpLogicalAnd %37 %714 %717 + OpSelectionMerge %720 None + OpBranchConditional %718 %719 %722 + %719 = OpLabel + OpStore %20 %721 + OpBranch %720 + %722 = OpLabel + OpStore %20 %723 + OpBranch %720 + %720 = OpLabel + OpBranch %724 + %724 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-discard-condition-loop-same-condition-again.amber b/vulkan/amber/graphicsfuzz/cov-discard-condition-loop-same-condition-again.amber new file mode 100644 index 0000000..0f78267 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-discard-condition-loop-same-condition-again.amber @@ -0,0 +1,300 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# highp vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# discard; +# } +# +# int a = 1; +# +# // Iterated twice. +# while(a << int(injectionSwitch.x) >= _int_0) +# { +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# continue; +# } +# +# a--; +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# discard; +# } +# +# if(true) +# { +# } +# } +# +# // Always true. +# if(a == -_int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %60 %85 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "buf2" + OpMemberName %8 0 "injectionSwitch" + OpName %10 "" + OpName %27 "a" + OpName %41 "buf1" + OpMemberName %41 0 "_GLF_uniform_int_values" + OpName %43 "" + OpName %60 "gl_FragCoord" + OpName %65 "buf0" + OpMemberName %65 0 "_GLF_uniform_float_values" + OpName %67 "" + OpName %85 "_GLF_color" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 2 + OpDecorate %40 ArrayStride 16 + OpMemberDecorate %41 0 Offset 0 + OpDecorate %41 Block + OpDecorate %43 DescriptorSet 0 + OpDecorate %43 Binding 1 + OpDecorate %60 BuiltIn FragCoord + OpDecorate %64 ArrayStride 16 + OpMemberDecorate %65 0 Offset 0 + OpDecorate %65 Block + OpDecorate %67 DescriptorSet 0 + OpDecorate %67 Binding 0 + OpDecorate %85 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeStruct %7 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %6 + %18 = OpConstant %13 1 + %21 = OpTypeBool + %26 = OpTypePointer Function %11 + %28 = OpConstant %11 1 + %39 = OpConstant %13 2 + %40 = OpTypeArray %11 %39 + %41 = OpTypeStruct %40 + %42 = OpTypePointer Uniform %41 + %43 = OpVariable %42 Uniform + %44 = OpTypePointer Uniform %11 + %58 = OpTypeVector %6 4 + %59 = OpTypePointer Input %58 + %60 = OpVariable %59 Input + %61 = OpTypePointer Input %6 + %64 = OpTypeArray %6 %18 + %65 = OpTypeStruct %64 + %66 = OpTypePointer Uniform %65 + %67 = OpVariable %66 Uniform + %74 = OpConstantTrue %21 + %84 = OpTypePointer Output %58 + %85 = OpVariable %84 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %27 = OpVariable %26 Function + %16 = OpAccessChain %15 %10 %12 %14 + %17 = OpLoad %6 %16 + %19 = OpAccessChain %15 %10 %12 %18 + %20 = OpLoad %6 %19 + %22 = OpFOrdGreaterThan %21 %17 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + OpTerminateInvocation + %24 = OpLabel + OpStore %27 %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %11 %27 + %35 = OpAccessChain %15 %10 %12 %14 + %36 = OpLoad %6 %35 + %37 = OpConvertFToS %11 %36 + %38 = OpShiftLeftLogical %11 %34 %37 + %45 = OpAccessChain %44 %43 %12 %28 + %46 = OpLoad %11 %45 + %47 = OpSGreaterThanEqual %21 %38 %46 + OpBranchConditional %47 %30 %31 + %30 = OpLabel + %48 = OpAccessChain %15 %10 %12 %14 + %49 = OpLoad %6 %48 + %50 = OpAccessChain %15 %10 %12 %18 + %51 = OpLoad %6 %50 + %52 = OpFOrdGreaterThan %21 %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + OpBranch %32 + %54 = OpLabel + %56 = OpLoad %11 %27 + %57 = OpISub %11 %56 %28 + OpStore %27 %57 + %62 = OpAccessChain %61 %60 %14 + %63 = OpLoad %6 %62 + %68 = OpAccessChain %15 %67 %12 %12 + %69 = OpLoad %6 %68 + %70 = OpFOrdLessThan %21 %63 %69 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %72 + %71 = OpLabel + OpTerminateInvocation + %72 = OpLabel + OpSelectionMerge %76 None + OpBranchConditional %74 %75 %76 + %75 = OpLabel + OpBranch %76 + %76 = OpLabel + OpBranch %32 + %32 = OpLabel + OpBranch %29 + %31 = OpLabel + %77 = OpLoad %11 %27 + %78 = OpAccessChain %44 %43 %12 %12 + %79 = OpLoad %11 %78 + %80 = OpSNegate %11 %79 + %81 = OpIEqual %21 %77 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %99 + %82 = OpLabel + %86 = OpAccessChain %44 %43 %12 %12 + %87 = OpLoad %11 %86 + %88 = OpConvertSToF %6 %87 + %89 = OpAccessChain %44 %43 %12 %28 + %90 = OpLoad %11 %89 + %91 = OpConvertSToF %6 %90 + %92 = OpAccessChain %44 %43 %12 %28 + %93 = OpLoad %11 %92 + %94 = OpConvertSToF %6 %93 + %95 = OpAccessChain %44 %43 %12 %12 + %96 = OpLoad %11 %95 + %97 = OpConvertSToF %6 %96 + %98 = OpCompositeConstruct %58 %88 %91 %94 %97 + OpStore %85 %98 + OpBranch %83 + %99 = OpLabel + %100 = OpAccessChain %44 %43 %12 %28 + %101 = OpLoad %11 %100 + %102 = OpConvertSToF %6 %101 + %103 = OpCompositeConstruct %58 %102 %102 %102 %102 + OpStore %85 %103 + OpBranch %83 + %83 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-divide-matrix-transpose-by-constant.amber b/vulkan/amber/graphicsfuzz/cov-divide-matrix-transpose-by-constant.amber new file mode 100644 index 0000000..6a18991 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-divide-matrix-transpose-by-constant.amber @@ -0,0 +1,128 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific VTN code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat2 m = transpose(mat2(1, 2, 3, 4)) / 2.0; +# +# if (m == mat2(0.5, 1.5, 1.0, 2.0)) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 46 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %41 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "m" + OpName %41 "_GLF_color" + OpDecorate %41 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeMatrix %7 2 + %9 = OpTypePointer Function %8 + %11 = OpConstant %6 1 + %12 = OpConstant %6 2 + %13 = OpConstantComposite %7 %11 %12 + %14 = OpConstant %6 3 + %15 = OpConstant %6 4 + %16 = OpConstantComposite %7 %14 %15 + %17 = OpConstantComposite %8 %13 %16 + %22 = OpConstant %6 0.5 + %23 = OpConstant %6 1.5 + %24 = OpConstantComposite %7 %22 %23 + %25 = OpConstantComposite %8 %24 %13 + %26 = OpTypeBool + %29 = OpTypeVector %26 2 + %39 = OpTypeVector %6 4 + %40 = OpTypePointer Output %39 + %41 = OpVariable %40 Output + %42 = OpConstant %6 0 + %43 = OpConstantComposite %39 %11 %42 %42 %11 + %45 = OpConstantComposite %39 %42 %42 %42 %42 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %18 = OpTranspose %8 %17 + %19 = OpFDiv %6 %11 %12 + %20 = OpMatrixTimesScalar %8 %18 %19 + OpStore %10 %20 + %21 = OpLoad %8 %10 + %27 = OpCompositeExtract %7 %21 0 + %28 = OpCompositeExtract %7 %25 0 + %30 = OpFOrdEqual %29 %27 %28 + %31 = OpAll %26 %30 + %32 = OpCompositeExtract %7 %21 1 + %33 = OpCompositeExtract %7 %25 1 + %34 = OpFOrdEqual %29 %32 %33 + %35 = OpAll %26 %34 + %36 = OpLogicalAnd %26 %31 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %44 + %37 = OpLabel + OpStore %41 %43 + OpBranch %38 + %44 = OpLabel + OpStore %41 %45 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-do-while-loop-until-uniform-lt-itself.amber b/vulkan/amber/graphicsfuzz/cov-do-while-loop-until-uniform-lt-itself.amber new file mode 100644 index 0000000..2db224f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-do-while-loop-until-uniform-lt-itself.amber @@ -0,0 +1,260 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of five: 5 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int five; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1; +# _GLF_color = vec4(_int_0); +# +# // Iterated once. +# do +# { +# // Always false. +# if(_int_1 >= five) +# { +# break; +# } +# a++; +# } +# while(_int_1 < _int_1); +# +# // Iterated until a is 5. +# do +# { +# if(a >= five) +# { +# break; +# } +# a++; +# } +# while(a < 20); +# +# // Iterated once. +# do +# { +# a++; +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# while(a < _int_1); +# +# // The coverage points are lost if the value of a has any dependency to output color. +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 90 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %23 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %23 "_GLF_color" + OpName %34 "buf1" + OpMemberName %34 0 "five" + OpName %36 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %23 Location 0 + OpMemberDecorate %34 0 Offset 0 + OpDecorate %34 Block + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %20 = OpTypeFloat 32 + %21 = OpTypeVector %20 4 + %22 = OpTypePointer Output %21 + %23 = OpVariable %22 Output + %34 = OpTypeStruct %6 + %35 = OpTypePointer Uniform %34 + %36 = OpVariable %35 Uniform + %39 = OpTypeBool + %65 = OpConstant %6 20 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %24 = OpAccessChain %17 %14 %15 %15 + %25 = OpLoad %6 %24 + %26 = OpConvertSToF %20 %25 + %27 = OpCompositeConstruct %21 %26 %26 %26 %26 + OpStore %23 %27 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %29 + %29 = OpLabel + %32 = OpAccessChain %17 %14 %15 %16 + %33 = OpLoad %6 %32 + %37 = OpAccessChain %17 %36 %15 + %38 = OpLoad %6 %37 + %40 = OpSGreaterThanEqual %39 %33 %38 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %42 + %41 = OpLabel + OpBranch %30 + %42 = OpLabel + %44 = OpLoad %6 %8 + %45 = OpIAdd %6 %44 %16 + OpStore %8 %45 + OpBranch %31 + %31 = OpLabel + %46 = OpAccessChain %17 %14 %15 %16 + %47 = OpLoad %6 %46 + %48 = OpAccessChain %17 %14 %15 %16 + %49 = OpLoad %6 %48 + %50 = OpSLessThan %39 %47 %49 + OpBranchConditional %50 %28 %30 + %30 = OpLabel + OpBranch %51 + %51 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %52 + %52 = OpLabel + %55 = OpLoad %6 %8 + %56 = OpAccessChain %17 %36 %15 + %57 = OpLoad %6 %56 + %58 = OpSGreaterThanEqual %39 %55 %57 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %60 + %59 = OpLabel + OpBranch %53 + %60 = OpLabel + %62 = OpLoad %6 %8 + %63 = OpIAdd %6 %62 %16 + OpStore %8 %63 + OpBranch %54 + %54 = OpLabel + %64 = OpLoad %6 %8 + %66 = OpSLessThan %39 %64 %65 + OpBranchConditional %66 %51 %53 + %53 = OpLabel + OpBranch %67 + %67 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %68 + %68 = OpLabel + %71 = OpLoad %6 %8 + %72 = OpIAdd %6 %71 %16 + OpStore %8 %72 + %73 = OpAccessChain %17 %14 %15 %16 + %74 = OpLoad %6 %73 + %75 = OpConvertSToF %20 %74 + %76 = OpAccessChain %17 %14 %15 %15 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %20 %77 + %79 = OpAccessChain %17 %14 %15 %15 + %80 = OpLoad %6 %79 + %81 = OpConvertSToF %20 %80 + %82 = OpAccessChain %17 %14 %15 %16 + %83 = OpLoad %6 %82 + %84 = OpConvertSToF %20 %83 + %85 = OpCompositeConstruct %21 %75 %78 %81 %84 + OpStore %23 %85 + OpBranch %70 + %70 = OpLabel + %86 = OpLoad %6 %8 + %87 = OpAccessChain %17 %14 %15 %16 + %88 = OpLoad %6 %87 + %89 = OpSLessThan %39 %86 %88 + OpBranchConditional %89 %67 %69 + %69 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# five +BUFFER variant_five DATA_TYPE int32 STD140 DATA + 5 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_five AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-do-while-negative-iterator-nested-loops-increment-array-element.amber b/vulkan/amber/graphicsfuzz/cov-do-while-negative-iterator-nested-loops-increment-array-element.amber new file mode 100644 index 0000000..de77715 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-do-while-negative-iterator-nested-loops-increment-array-element.amber @@ -0,0 +1,470 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_5 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_20 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_2 _GLF_uniform_int_values[4] +# #define _int_3 _GLF_uniform_int_values[5] +# #define _int_4 _GLF_uniform_int_values[6] +# #define _int_19 _GLF_uniform_int_values[7] +# #define _int_16 _GLF_uniform_int_values[8] +# #define _int_17 _GLF_uniform_int_values[9] +# #define _int_18 _GLF_uniform_int_values[10] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# // Contents of _GLF_uniform_int_values: [5, 0, 20, 1, 2, 3, 4, 19, 16, 17, 18] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[11]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[5] = int[5](_int_1, _int_2, _int_3, _int_4, _int_5); +# _GLF_color = vec4(_int_0); +# +# // Iterated five times. +# for(int i = _int_0; i < _int_5; i ++) +# { +# int a = - 100; +# int b = 1; +# +# // This loop has no effect. +# do +# { +# if(b > 7) +# { +# break; +# } +# +# switch(a) +# { +# case 0: +# // Never executed. +# _GLF_color = vec4(_int_1); +# break; +# case 5: +# // Never executed. +# if(gl_FragCoord.x < _float_1_0) +# { +# _GLF_color = vec4(1); +# } +# break; +# } +# +# a++; +# b++; +# } +# while(a < 10); +# +# // Increments each array element by three. +# for(int j = _int_0; j < _int_5; j ++) +# { +# for(int k = _int_0; k < _int_3; k ++) +# { +# for(int l = _int_0; l < k; l ++) +# { +# arr[j]++; +# } +# } +# } +# } +# +# // Always true. +# if(arr[_int_0] == _int_16 && arr[_int_1] == _int_17 && arr[_int_2] == _int_18 && arr[_int_3] == _int_19 && arr[_int_4] == _int_20) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 219 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %37 %80 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %37 "_GLF_color" + OpName %44 "i" + OpName %57 "a" + OpName %59 "b" + OpName %80 "gl_FragCoord" + OpName %87 "buf0" + OpMemberName %87 0 "_GLF_uniform_float_values" + OpName %89 "" + OpName %107 "j" + OpName %119 "k" + OpName %131 "l" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %37 Location 0 + OpDecorate %80 BuiltIn FragCoord + OpDecorate %86 ArrayStride 16 + OpMemberDecorate %87 0 Offset 0 + OpDecorate %87 Block + OpDecorate %89 DescriptorSet 0 + OpDecorate %89 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 5 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 11 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 3 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 4 + %25 = OpConstant %6 5 + %28 = OpConstant %6 6 + %34 = OpTypeFloat 32 + %35 = OpTypeVector %34 4 + %36 = OpTypePointer Output %35 + %37 = OpVariable %36 Output + %38 = OpConstant %6 1 + %43 = OpTypePointer Function %6 + %55 = OpTypeBool + %58 = OpConstant %6 -100 + %65 = OpConstant %6 7 + %79 = OpTypePointer Input %35 + %80 = OpVariable %79 Input + %81 = OpConstant %7 0 + %82 = OpTypePointer Input %34 + %85 = OpConstant %7 1 + %86 = OpTypeArray %34 %85 + %87 = OpTypeStruct %86 + %88 = OpTypePointer Uniform %87 + %89 = OpVariable %88 Uniform + %90 = OpTypePointer Uniform %34 + %96 = OpConstant %34 1 + %97 = OpConstantComposite %35 %96 %96 %96 %96 + %105 = OpConstant %6 10 + %158 = OpConstant %6 8 + %168 = OpConstant %6 9 + %199 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %44 = OpVariable %43 Function + %57 = OpVariable %43 Function + %59 = OpVariable %43 Function + %107 = OpVariable %43 Function + %119 = OpVariable %43 Function + %131 = OpVariable %43 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %19 %16 %17 %22 + %24 = OpLoad %6 %23 + %26 = OpAccessChain %19 %16 %17 %25 + %27 = OpLoad %6 %26 + %29 = OpAccessChain %19 %16 %17 %28 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %19 %16 %17 %17 + %32 = OpLoad %6 %31 + %33 = OpCompositeConstruct %9 %21 %24 %27 %30 %32 + OpStore %11 %33 + %39 = OpAccessChain %19 %16 %17 %38 + %40 = OpLoad %6 %39 + %41 = OpConvertSToF %34 %40 + %42 = OpCompositeConstruct %35 %41 %41 %41 %41 + OpStore %37 %42 + %45 = OpAccessChain %19 %16 %17 %38 + %46 = OpLoad %6 %45 + OpStore %44 %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %6 %44 + %53 = OpAccessChain %19 %16 %17 %17 + %54 = OpLoad %6 %53 + %56 = OpSLessThan %55 %52 %54 + OpBranchConditional %56 %48 %49 + %48 = OpLabel + OpStore %57 %58 + OpStore %59 %38 + OpBranch %60 + %60 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %61 + %61 = OpLabel + %64 = OpLoad %6 %59 + %66 = OpSGreaterThan %55 %64 %65 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %68 + %67 = OpLabel + OpBranch %62 + %68 = OpLabel + %70 = OpLoad %6 %57 + OpSelectionMerge %73 None + OpSwitch %70 %73 0 %71 5 %72 + %71 = OpLabel + %74 = OpAccessChain %19 %16 %17 %18 + %75 = OpLoad %6 %74 + %76 = OpConvertSToF %34 %75 + %77 = OpCompositeConstruct %35 %76 %76 %76 %76 + OpStore %37 %77 + OpBranch %73 + %72 = OpLabel + %83 = OpAccessChain %82 %80 %81 + %84 = OpLoad %34 %83 + %91 = OpAccessChain %90 %89 %17 %17 + %92 = OpLoad %34 %91 + %93 = OpFOrdLessThan %55 %84 %92 + OpSelectionMerge %95 None + OpBranchConditional %93 %94 %95 + %94 = OpLabel + OpStore %37 %97 + OpBranch %95 + %95 = OpLabel + OpBranch %73 + %73 = OpLabel + %100 = OpLoad %6 %57 + %101 = OpIAdd %6 %100 %38 + OpStore %57 %101 + %102 = OpLoad %6 %59 + %103 = OpIAdd %6 %102 %38 + OpStore %59 %103 + OpBranch %63 + %63 = OpLabel + %104 = OpLoad %6 %57 + %106 = OpSLessThan %55 %104 %105 + OpBranchConditional %106 %60 %62 + %62 = OpLabel + %108 = OpAccessChain %19 %16 %17 %38 + %109 = OpLoad %6 %108 + OpStore %107 %109 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %115 = OpLoad %6 %107 + %116 = OpAccessChain %19 %16 %17 %17 + %117 = OpLoad %6 %116 + %118 = OpSLessThan %55 %115 %117 + OpBranchConditional %118 %111 %112 + %111 = OpLabel + %120 = OpAccessChain %19 %16 %17 %38 + %121 = OpLoad %6 %120 + OpStore %119 %121 + OpBranch %122 + %122 = OpLabel + OpLoopMerge %124 %125 None + OpBranch %126 + %126 = OpLabel + %127 = OpLoad %6 %119 + %128 = OpAccessChain %19 %16 %17 %25 + %129 = OpLoad %6 %128 + %130 = OpSLessThan %55 %127 %129 + OpBranchConditional %130 %123 %124 + %123 = OpLabel + %132 = OpAccessChain %19 %16 %17 %38 + %133 = OpLoad %6 %132 + OpStore %131 %133 + OpBranch %134 + %134 = OpLabel + OpLoopMerge %136 %137 None + OpBranch %138 + %138 = OpLabel + %139 = OpLoad %6 %131 + %140 = OpLoad %6 %119 + %141 = OpSLessThan %55 %139 %140 + OpBranchConditional %141 %135 %136 + %135 = OpLabel + %142 = OpLoad %6 %107 + %143 = OpAccessChain %43 %11 %142 + %144 = OpLoad %6 %143 + %145 = OpIAdd %6 %144 %38 + OpStore %143 %145 + OpBranch %137 + %137 = OpLabel + %146 = OpLoad %6 %131 + %147 = OpIAdd %6 %146 %38 + OpStore %131 %147 + OpBranch %134 + %136 = OpLabel + OpBranch %125 + %125 = OpLabel + %148 = OpLoad %6 %119 + %149 = OpIAdd %6 %148 %38 + OpStore %119 %149 + OpBranch %122 + %124 = OpLabel + OpBranch %113 + %113 = OpLabel + %150 = OpLoad %6 %107 + %151 = OpIAdd %6 %150 %38 + OpStore %107 %151 + OpBranch %110 + %112 = OpLabel + OpBranch %50 + %50 = OpLabel + %152 = OpLoad %6 %44 + %153 = OpIAdd %6 %152 %38 + OpStore %44 %153 + OpBranch %47 + %49 = OpLabel + %154 = OpAccessChain %19 %16 %17 %38 + %155 = OpLoad %6 %154 + %156 = OpAccessChain %43 %11 %155 + %157 = OpLoad %6 %156 + %159 = OpAccessChain %19 %16 %17 %158 + %160 = OpLoad %6 %159 + %161 = OpIEqual %55 %157 %160 + OpSelectionMerge %163 None + OpBranchConditional %161 %162 %163 + %162 = OpLabel + %164 = OpAccessChain %19 %16 %17 %18 + %165 = OpLoad %6 %164 + %166 = OpAccessChain %43 %11 %165 + %167 = OpLoad %6 %166 + %169 = OpAccessChain %19 %16 %17 %168 + %170 = OpLoad %6 %169 + %171 = OpIEqual %55 %167 %170 + OpBranch %163 + %163 = OpLabel + %172 = OpPhi %55 %161 %49 %171 %162 + OpSelectionMerge %174 None + OpBranchConditional %172 %173 %174 + %173 = OpLabel + %175 = OpAccessChain %19 %16 %17 %22 + %176 = OpLoad %6 %175 + %177 = OpAccessChain %43 %11 %176 + %178 = OpLoad %6 %177 + %179 = OpAccessChain %19 %16 %17 %105 + %180 = OpLoad %6 %179 + %181 = OpIEqual %55 %178 %180 + OpBranch %174 + %174 = OpLabel + %182 = OpPhi %55 %172 %163 %181 %173 + OpSelectionMerge %184 None + OpBranchConditional %182 %183 %184 + %183 = OpLabel + %185 = OpAccessChain %19 %16 %17 %25 + %186 = OpLoad %6 %185 + %187 = OpAccessChain %43 %11 %186 + %188 = OpLoad %6 %187 + %189 = OpAccessChain %19 %16 %17 %65 + %190 = OpLoad %6 %189 + %191 = OpIEqual %55 %188 %190 + OpBranch %184 + %184 = OpLabel + %192 = OpPhi %55 %182 %174 %191 %183 + OpSelectionMerge %194 None + OpBranchConditional %192 %193 %194 + %193 = OpLabel + %195 = OpAccessChain %19 %16 %17 %28 + %196 = OpLoad %6 %195 + %197 = OpAccessChain %43 %11 %196 + %198 = OpLoad %6 %197 + %200 = OpAccessChain %19 %16 %17 %199 + %201 = OpLoad %6 %200 + %202 = OpIEqual %55 %198 %201 + OpBranch %194 + %194 = OpLabel + %203 = OpPhi %55 %192 %184 %202 %193 + OpSelectionMerge %205 None + OpBranchConditional %203 %204 %205 + %204 = OpLabel + %206 = OpAccessChain %19 %16 %17 %18 + %207 = OpLoad %6 %206 + %208 = OpConvertSToF %34 %207 + %209 = OpAccessChain %19 %16 %17 %38 + %210 = OpLoad %6 %209 + %211 = OpConvertSToF %34 %210 + %212 = OpAccessChain %19 %16 %17 %38 + %213 = OpLoad %6 %212 + %214 = OpConvertSToF %34 %213 + %215 = OpAccessChain %19 %16 %17 %18 + %216 = OpLoad %6 %215 + %217 = OpConvertSToF %34 %216 + %218 = OpCompositeConstruct %35 %208 %211 %214 %217 + OpStore %37 %218 + OpBranch %205 + %205 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 5 0 20 1 2 3 4 19 16 17 18 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-do-while-switch-case-bitcount-findmsb.amber b/vulkan/amber/graphicsfuzz/cov-do-while-switch-case-bitcount-findmsb.amber new file mode 100644 index 0000000..b813bc6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-do-while-switch-case-bitcount-findmsb.amber @@ -0,0 +1,209 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [10, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = _int_1; +# +# do +# { +# switch(i) +# { +# // This case is never his because i starts from one. +# case 0: +# if(bitCount(findMSB(_int_1)) > 1) +# { +# // This would cause an infinite loop, but it's never executed. +# continue; +# } +# } +# i++; +# } +# while((i < _int_10)); +# +# // Always true. +# if(i == _int_10) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 72 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %52 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %30 RelaxedPrecision + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %31 = OpTypeBool + %49 = OpTypeFloat 32 + %50 = OpTypeVector %49 4 + %51 = OpTypePointer Output %50 + %52 = OpVariable %51 Output + %56 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %21 + %21 = OpLabel + %24 = OpLoad %6 %8 + OpSelectionMerge %26 None + OpSwitch %24 %26 0 %25 + %25 = OpLabel + %27 = OpAccessChain %17 %14 %15 %16 + %28 = OpLoad %6 %27 + %29 = OpExtInst %6 %1 FindSMsb %28 + %30 = OpBitCount %6 %29 + %32 = OpSGreaterThan %31 %30 %16 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %34 + %33 = OpLabel + OpBranch %23 + %34 = OpLabel + OpBranch %26 + %26 = OpLabel + %37 = OpLoad %6 %8 + %38 = OpIAdd %6 %37 %16 + OpStore %8 %38 + OpBranch %23 + %23 = OpLabel + %39 = OpLoad %6 %8 + %40 = OpAccessChain %17 %14 %15 %15 + %41 = OpLoad %6 %40 + %42 = OpSLessThan %31 %39 %41 + OpBranchConditional %42 %20 %22 + %22 = OpLabel + %43 = OpLoad %6 %8 + %44 = OpAccessChain %17 %14 %15 %15 + %45 = OpLoad %6 %44 + %46 = OpIEqual %31 %43 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %67 + %47 = OpLabel + %53 = OpAccessChain %17 %14 %15 %16 + %54 = OpLoad %6 %53 + %55 = OpConvertSToF %49 %54 + %57 = OpAccessChain %17 %14 %15 %56 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %49 %58 + %60 = OpAccessChain %17 %14 %15 %56 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %49 %61 + %63 = OpAccessChain %17 %14 %15 %16 + %64 = OpLoad %6 %63 + %65 = OpConvertSToF %49 %64 + %66 = OpCompositeConstruct %50 %55 %59 %62 %65 + OpStore %52 %66 + OpBranch %48 + %67 = OpLabel + %68 = OpAccessChain %17 %14 %15 %56 + %69 = OpLoad %6 %68 + %70 = OpConvertSToF %49 %69 + %71 = OpCompositeConstruct %50 %70 %70 %70 %70 + OpStore %52 %71 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-double-if-true-in-loop.amber b/vulkan/amber/graphicsfuzz/cov-double-if-true-in-loop.amber new file mode 100644 index 0000000..76277b1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-double-if-true-in-loop.amber @@ -0,0 +1,216 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_10 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 10, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# int i = _int_0; +# +# do +# { +# i++; +# +# if (true) +# { +# if (true) +# { +# return _int_1; +# } +# } +# } +# while (i < _int_10); +# +# return _int_0; +# } +# +# void main() +# { +# if (func() == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %56 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "i" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %56 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %56 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 3 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpTypePointer Uniform %6 + %27 = OpConstant %6 1 + %29 = OpTypeBool + %30 = OpConstantTrue %29 + %35 = OpConstant %6 2 + %53 = OpTypeFloat 32 + %54 = OpTypeVector %53 4 + %55 = OpTypePointer Output %54 + %56 = OpVariable %55 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %47 = OpFunctionCall %6 %8 + %48 = OpAccessChain %19 %17 %18 %35 + %49 = OpLoad %6 %48 + %50 = OpIEqual %29 %47 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %70 + %51 = OpLabel + %57 = OpAccessChain %19 %17 %18 %35 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %53 %58 + %60 = OpAccessChain %19 %17 %18 %18 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %53 %61 + %63 = OpAccessChain %19 %17 %18 %18 + %64 = OpLoad %6 %63 + %65 = OpConvertSToF %53 %64 + %66 = OpAccessChain %19 %17 %18 %35 + %67 = OpLoad %6 %66 + %68 = OpConvertSToF %53 %67 + %69 = OpCompositeConstruct %54 %59 %62 %65 %68 + OpStore %56 %69 + OpBranch %52 + %70 = OpLabel + %71 = OpAccessChain %19 %17 %18 %18 + %72 = OpLoad %6 %71 + %73 = OpConvertSToF %53 %72 + %74 = OpCompositeConstruct %54 %73 %73 %73 %73 + OpStore %56 %74 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %20 = OpAccessChain %19 %17 %18 %18 + %21 = OpLoad %6 %20 + OpStore %11 %21 + OpBranch %22 + %22 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %23 + %23 = OpLabel + %26 = OpLoad %6 %11 + %28 = OpIAdd %6 %26 %27 + OpStore %11 %28 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + OpSelectionMerge %34 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + %36 = OpAccessChain %19 %17 %18 %35 + %37 = OpLoad %6 %36 + OpReturnValue %37 + %34 = OpLabel + OpBranch %32 + %32 = OpLabel + OpBranch %25 + %25 = OpLabel + %39 = OpLoad %6 %11 + %40 = OpAccessChain %19 %17 %18 %27 + %41 = OpLoad %6 %40 + %42 = OpSLessThan %29 %39 %41 + OpBranchConditional %42 %22 %24 + %24 = OpLabel + %43 = OpAccessChain %19 %17 %18 %18 + %44 = OpLoad %6 %43 + OpReturnValue %44 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 10 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-double-negation-fragcoord-cast-ivec2-bitwise-and.amber b/vulkan/amber/graphicsfuzz/cov-double-negation-fragcoord-cast-ivec2-bitwise-and.amber new file mode 100644 index 0000000..d37c47b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-double-negation-fragcoord-cast-ivec2-bitwise-and.amber @@ -0,0 +1,169 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Test resolution is 32 which makes fragment coordinate ANDed with 256 always zero. +# int a = ((!(!((ivec2(gl_FragCoord.xy).y & 256) != 0))) ? 0 : ~0) | ((ivec2(gl_FragCoord.xy).y & 256) != 0 ? 0 : ~0); +# +# // Always true. +# if(a == ~ _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 72 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "gl_FragCoord" + OpName %41 "buf0" + OpMemberName %41 0 "_GLF_uniform_int_values" + OpName %43 "" + OpName %52 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %40 ArrayStride 16 + OpMemberDecorate %41 0 Offset 0 + OpDecorate %41 Block + OpDecorate %43 DescriptorSet 0 + OpDecorate %43 Binding 0 + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeVector %9 2 + %16 = OpTypeVector %6 2 + %18 = OpTypeInt 32 0 + %21 = OpConstant %6 256 + %23 = OpConstant %6 0 + %24 = OpTypeBool + %28 = OpConstant %6 -1 + %39 = OpConstant %18 2 + %40 = OpTypeArray %6 %39 + %41 = OpTypeStruct %40 + %42 = OpTypePointer Uniform %41 + %43 = OpVariable %42 Uniform + %44 = OpTypePointer Uniform %6 + %51 = OpTypePointer Output %10 + %52 = OpVariable %51 Output + %53 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpLoad %10 %12 + %15 = OpVectorShuffle %13 %14 %14 0 1 + %17 = OpConvertFToS %16 %15 + %20 = OpCompositeExtract %6 %17 1 + %22 = OpBitwiseAnd %6 %20 %21 + %25 = OpINotEqual %24 %22 %23 + %26 = OpLogicalNot %24 %25 + %27 = OpLogicalNot %24 %26 + %29 = OpSelect %6 %27 %23 %28 + %36 = OpSelect %6 %25 %23 %28 + %37 = OpBitwiseOr %6 %29 %36 + %45 = OpAccessChain %44 %43 %23 %23 + %46 = OpLoad %6 %45 + %47 = OpNot %6 %46 + %48 = OpIEqual %24 %37 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %67 + %49 = OpLabel + %54 = OpAccessChain %44 %43 %23 %53 + %55 = OpLoad %6 %54 + %56 = OpConvertSToF %9 %55 + %59 = OpConvertSToF %9 %46 + %66 = OpCompositeConstruct %10 %56 %59 %59 %56 + OpStore %52 %66 + OpBranch %50 + %67 = OpLabel + %70 = OpConvertSToF %9 %46 + %71 = OpCompositeConstruct %10 %70 %70 %70 %70 + OpStore %52 %71 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-dummy-function-loop-array-element-increment-never-read.amber b/vulkan/amber/graphicsfuzz/cov-dummy-function-loop-array-element-increment-never-read.amber new file mode 100644 index 0000000..339c0e6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-dummy-function-loop-array-element-increment-never-read.amber @@ -0,0 +1,379 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_9 _GLF_uniform_int_values[3] +# #define _int_20 _GLF_uniform_int_values[4] +# #define _int_29 _GLF_uniform_int_values[5] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2, 9, 20, 29] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[6]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# // A void function that only touches local variables and returns. +# void func() +# { +# int index = _int_0; +# +# while(true) +# { +# int a = int[10](_int_1, _int_2, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1)[index]; +# +# if(a == _int_2) +# { +# // Executed during the second iteration. +# return; +# } +# +# index = _int_1; +# } +# } +# void main() +# { +# int a = _int_0; +# +# for(int i = _int_0; i < _int_20; i ++) +# { +# // Doesn't have any effect. +# func(); +# a = i; +# +# int arr[9] = int[9](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1); +# +# // The array is never read so we don't care if the elements get incremented or not. +# // The loop increments a by 10 in total. +# for(int j = 0; j < 10; j ++) +# { +# arr[clamp(a, _int_0, 8)] = _int_1; +# +# switch(i) +# { +# case 0: +# arr[clamp(a, 0, 8)]++; +# case 8: +# arr[clamp(a, 0, 8)]++; +# } +# a++; +# } +# } +# +# // Always true. +# if(a == _int_29) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 176 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %157 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %6 "func(" + OpName %10 "index" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %29 "a" + OpName %56 "indexable" + OpName %68 "a" + OpName %71 "i" + OpName %89 "arr" + OpName %109 "j" + OpName %157 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %157 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Function %8 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 6 + %13 = OpTypeArray %8 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %8 0 + %18 = OpConstant %8 1 + %19 = OpTypePointer Uniform %8 + %27 = OpTypeBool + %28 = OpConstantTrue %27 + %32 = OpConstant %8 2 + %51 = OpConstant %11 10 + %52 = OpTypeArray %8 %51 + %55 = OpTypePointer Function %52 + %80 = OpConstant %8 4 + %86 = OpConstant %11 9 + %87 = OpTypeArray %8 %86 + %88 = OpTypePointer Function %87 + %116 = OpConstant %8 10 + %121 = OpConstant %8 8 + %148 = OpConstant %8 5 + %154 = OpTypeFloat 32 + %155 = OpTypeVector %154 4 + %156 = OpTypePointer Output %155 + %157 = OpVariable %156 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %68 = OpVariable %9 Function + %71 = OpVariable %9 Function + %89 = OpVariable %88 Function + %109 = OpVariable %9 Function + %69 = OpAccessChain %19 %16 %17 %18 + %70 = OpLoad %8 %69 + OpStore %68 %70 + %72 = OpAccessChain %19 %16 %17 %18 + %73 = OpLoad %8 %72 + OpStore %71 %73 + OpBranch %74 + %74 = OpLabel + OpLoopMerge %76 %77 None + OpBranch %78 + %78 = OpLabel + %79 = OpLoad %8 %71 + %81 = OpAccessChain %19 %16 %17 %80 + %82 = OpLoad %8 %81 + %83 = OpSLessThan %27 %79 %82 + OpBranchConditional %83 %75 %76 + %75 = OpLabel + %84 = OpFunctionCall %2 %6 + %85 = OpLoad %8 %71 + OpStore %68 %85 + %90 = OpAccessChain %19 %16 %17 %17 + %91 = OpLoad %8 %90 + %92 = OpAccessChain %19 %16 %17 %17 + %93 = OpLoad %8 %92 + %94 = OpAccessChain %19 %16 %17 %17 + %95 = OpLoad %8 %94 + %96 = OpAccessChain %19 %16 %17 %17 + %97 = OpLoad %8 %96 + %98 = OpAccessChain %19 %16 %17 %17 + %99 = OpLoad %8 %98 + %100 = OpAccessChain %19 %16 %17 %17 + %101 = OpLoad %8 %100 + %102 = OpAccessChain %19 %16 %17 %17 + %103 = OpLoad %8 %102 + %104 = OpAccessChain %19 %16 %17 %17 + %105 = OpLoad %8 %104 + %106 = OpAccessChain %19 %16 %17 %17 + %107 = OpLoad %8 %106 + %108 = OpCompositeConstruct %87 %91 %93 %95 %97 %99 %101 %103 %105 %107 + OpStore %89 %108 + OpStore %109 %17 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %115 = OpLoad %8 %109 + %117 = OpSLessThan %27 %115 %116 + OpBranchConditional %117 %111 %112 + %111 = OpLabel + %118 = OpLoad %8 %68 + %119 = OpAccessChain %19 %16 %17 %18 + %120 = OpLoad %8 %119 + %122 = OpExtInst %8 %1 SClamp %118 %120 %121 + %123 = OpAccessChain %19 %16 %17 %17 + %124 = OpLoad %8 %123 + %125 = OpAccessChain %9 %89 %122 + OpStore %125 %124 + %126 = OpLoad %8 %71 + OpSelectionMerge %129 None + OpSwitch %126 %129 0 %127 8 %128 + %127 = OpLabel + %130 = OpLoad %8 %68 + %131 = OpExtInst %8 %1 SClamp %130 %17 %121 + %132 = OpAccessChain %9 %89 %131 + %133 = OpLoad %8 %132 + %134 = OpIAdd %8 %133 %18 + OpStore %132 %134 + OpBranch %128 + %128 = OpLabel + %135 = OpLoad %8 %68 + %136 = OpExtInst %8 %1 SClamp %135 %17 %121 + %137 = OpAccessChain %9 %89 %136 + %138 = OpLoad %8 %137 + %139 = OpIAdd %8 %138 %18 + OpStore %137 %139 + OpBranch %129 + %129 = OpLabel + %141 = OpLoad %8 %68 + %142 = OpIAdd %8 %141 %18 + OpStore %68 %142 + OpBranch %113 + %113 = OpLabel + %143 = OpLoad %8 %109 + %144 = OpIAdd %8 %143 %18 + OpStore %109 %144 + OpBranch %110 + %112 = OpLabel + OpBranch %77 + %77 = OpLabel + %145 = OpLoad %8 %71 + %146 = OpIAdd %8 %145 %18 + OpStore %71 %146 + OpBranch %74 + %76 = OpLabel + %147 = OpLoad %8 %68 + %149 = OpAccessChain %19 %16 %17 %148 + %150 = OpLoad %8 %149 + %151 = OpIEqual %27 %147 %150 + OpSelectionMerge %153 None + OpBranchConditional %151 %152 %171 + %152 = OpLabel + %158 = OpAccessChain %19 %16 %17 %17 + %159 = OpLoad %8 %158 + %160 = OpConvertSToF %154 %159 + %161 = OpAccessChain %19 %16 %17 %18 + %162 = OpLoad %8 %161 + %163 = OpConvertSToF %154 %162 + %164 = OpAccessChain %19 %16 %17 %18 + %165 = OpLoad %8 %164 + %166 = OpConvertSToF %154 %165 + %167 = OpAccessChain %19 %16 %17 %17 + %168 = OpLoad %8 %167 + %169 = OpConvertSToF %154 %168 + %170 = OpCompositeConstruct %155 %160 %163 %166 %169 + OpStore %157 %170 + OpBranch %153 + %171 = OpLabel + %172 = OpAccessChain %19 %16 %17 %18 + %173 = OpLoad %8 %172 + %174 = OpConvertSToF %154 %173 + %175 = OpCompositeConstruct %155 %174 %174 %174 %174 + OpStore %157 %175 + OpBranch %153 + %153 = OpLabel + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %10 = OpVariable %9 Function + %29 = OpVariable %9 Function + %56 = OpVariable %55 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %8 %20 + OpStore %10 %21 + OpBranch %22 + %22 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + OpBranchConditional %28 %23 %24 + %23 = OpLabel + %30 = OpAccessChain %19 %16 %17 %17 + %31 = OpLoad %8 %30 + %33 = OpAccessChain %19 %16 %17 %32 + %34 = OpLoad %8 %33 + %35 = OpAccessChain %19 %16 %17 %17 + %36 = OpLoad %8 %35 + %37 = OpAccessChain %19 %16 %17 %17 + %38 = OpLoad %8 %37 + %39 = OpAccessChain %19 %16 %17 %17 + %40 = OpLoad %8 %39 + %41 = OpAccessChain %19 %16 %17 %17 + %42 = OpLoad %8 %41 + %43 = OpAccessChain %19 %16 %17 %17 + %44 = OpLoad %8 %43 + %45 = OpAccessChain %19 %16 %17 %17 + %46 = OpLoad %8 %45 + %47 = OpAccessChain %19 %16 %17 %17 + %48 = OpLoad %8 %47 + %49 = OpAccessChain %19 %16 %17 %17 + %50 = OpLoad %8 %49 + %53 = OpCompositeConstruct %52 %31 %34 %36 %38 %40 %42 %44 %46 %48 %50 + %54 = OpLoad %8 %10 + OpStore %56 %53 + %57 = OpAccessChain %9 %56 %54 + %58 = OpLoad %8 %57 + OpStore %29 %58 + %59 = OpLoad %8 %29 + %60 = OpAccessChain %19 %16 %17 %32 + %61 = OpLoad %8 %60 + %62 = OpIEqual %27 %59 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %64 + %63 = OpLabel + OpReturn + %64 = OpLabel + %66 = OpAccessChain %19 %16 %17 %17 + %67 = OpLoad %8 %66 + OpStore %10 %67 + OpBranch %25 + %25 = OpLabel + OpBranch %22 + %24 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 9 20 29 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one.amber b/vulkan/amber/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one.amber new file mode 100644 index 0000000..ab7fe9b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one.amber @@ -0,0 +1,248 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [10, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 { +# int _GLF_uniform_int_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[10] = int[10](1, 2, 3, 4, 5, 6, 7, 8, 9, 10); +# int a = 0; +# +# // Always true. +# if (arr[_int_1] == 2) +# { +# // An empty for loop doing nothing. +# for(int i = _int_0; i < _int_10; i++) {} +# a++; +# } +# +# // Always true because -1 % a = -1 % 1 = 0. +# if (-1 % a == _int_0) +# { +# arr[ivec2(_int_1).y] = _int_0; +# } +# +# // Always true. +# if (arr[_int_1] == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 104 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %24 "a" + OpName %28 "buf0" + OpMemberName %28 0 "_GLF_uniform_int_values" + OpName %30 "" + OpName %40 "i" + OpName %85 "_GLF_color" + OpDecorate %27 ArrayStride 16 + OpMemberDecorate %28 0 Offset 0 + OpDecorate %28 Block + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 0 + OpDecorate %85 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %6 1 + %13 = OpConstant %6 2 + %14 = OpConstant %6 3 + %15 = OpConstant %6 4 + %16 = OpConstant %6 5 + %17 = OpConstant %6 6 + %18 = OpConstant %6 7 + %19 = OpConstant %6 8 + %20 = OpConstant %6 9 + %21 = OpConstant %6 10 + %22 = OpConstantComposite %9 %12 %13 %14 %15 %16 %17 %18 %19 %20 %21 + %23 = OpTypePointer Function %6 + %25 = OpConstant %6 0 + %26 = OpConstant %7 3 + %27 = OpTypeArray %6 %26 + %28 = OpTypeStruct %27 + %29 = OpTypePointer Uniform %28 + %30 = OpVariable %29 Uniform + %31 = OpTypePointer Uniform %6 + %36 = OpTypeBool + %56 = OpConstant %6 -1 + %66 = OpTypeVector %6 2 + %68 = OpConstant %7 1 + %82 = OpTypeFloat 32 + %83 = OpTypeVector %82 4 + %84 = OpTypePointer Output %83 + %85 = OpVariable %84 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %24 = OpVariable %23 Function + %40 = OpVariable %23 Function + OpStore %11 %22 + OpStore %24 %25 + %32 = OpAccessChain %31 %30 %25 %12 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %23 %11 %33 + %35 = OpLoad %6 %34 + %37 = OpIEqual %36 %35 %13 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + %41 = OpAccessChain %31 %30 %25 %13 + %42 = OpLoad %6 %41 + OpStore %40 %42 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %6 %40 + %49 = OpAccessChain %31 %30 %25 %25 + %50 = OpLoad %6 %49 + %51 = OpSLessThan %36 %48 %50 + OpBranchConditional %51 %44 %45 + %44 = OpLabel + OpBranch %46 + %46 = OpLabel + %52 = OpLoad %6 %40 + %53 = OpIAdd %6 %52 %12 + OpStore %40 %53 + OpBranch %43 + %45 = OpLabel + %54 = OpLoad %6 %24 + %55 = OpIAdd %6 %54 %12 + OpStore %24 %55 + OpBranch %39 + %39 = OpLabel + %57 = OpLoad %6 %24 + %58 = OpSMod %6 %56 %57 + %59 = OpAccessChain %31 %30 %25 %13 + %60 = OpLoad %6 %59 + %61 = OpIEqual %36 %58 %60 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %63 + %62 = OpLabel + %64 = OpAccessChain %31 %30 %25 %12 + %65 = OpLoad %6 %64 + %67 = OpCompositeConstruct %66 %65 %65 + %69 = OpCompositeExtract %6 %67 1 + %70 = OpAccessChain %31 %30 %25 %13 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %23 %11 %69 + OpStore %72 %71 + OpBranch %63 + %63 = OpLabel + %73 = OpAccessChain %31 %30 %25 %12 + %74 = OpLoad %6 %73 + %75 = OpAccessChain %23 %11 %74 + %76 = OpLoad %6 %75 + %77 = OpAccessChain %31 %30 %25 %13 + %78 = OpLoad %6 %77 + %79 = OpIEqual %36 %76 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %80 %99 + %80 = OpLabel + %86 = OpAccessChain %31 %30 %25 %12 + %87 = OpLoad %6 %86 + %88 = OpConvertSToF %82 %87 + %89 = OpAccessChain %31 %30 %25 %13 + %90 = OpLoad %6 %89 + %91 = OpConvertSToF %82 %90 + %92 = OpAccessChain %31 %30 %25 %13 + %93 = OpLoad %6 %92 + %94 = OpConvertSToF %82 %93 + %95 = OpAccessChain %31 %30 %25 %12 + %96 = OpLoad %6 %95 + %97 = OpConvertSToF %82 %96 + %98 = OpCompositeConstruct %83 %88 %91 %94 %97 + OpStore %85 %98 + OpBranch %81 + %99 = OpLabel + %100 = OpAccessChain %31 %30 %25 %13 + %101 = OpLoad %6 %100 + %102 = OpConvertSToF %82 %101 + %103 = OpCompositeConstruct %83 %102 %102 %102 %102 + OpStore %85 %103 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-enable-bits-pixel-location-negate-not-equal-one.amber b/vulkan/amber/graphicsfuzz/cov-enable-bits-pixel-location-negate-not-equal-one.amber new file mode 100644 index 0000000..046747d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-enable-bits-pixel-location-negate-not-equal-one.amber @@ -0,0 +1,179 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Depending on the pixel location a has either all or none bits enabled. +# int a = (int(gl_FragCoord.x) & 1) != 0 ? 0 : ~0; +# +# // When a = 0: +# // ~(a | 1) = ~1 != 1 +# // +# // When a = ~0: +# // ~(a | 1) = ~(~0)) = 0 != 1 +# if(~(a | _int_1) != _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 62 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %43 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "gl_FragCoord" + OpName %29 "buf0" + OpMemberName %29 0 "_GLF_uniform_int_values" + OpName %31 "" + OpName %43 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %28 ArrayStride 16 + OpMemberDecorate %29 0 Offset 0 + OpDecorate %29 Block + OpDecorate %31 DescriptorSet 0 + OpDecorate %31 Binding 0 + OpDecorate %43 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Input %9 + %19 = OpConstant %6 1 + %21 = OpConstant %6 0 + %22 = OpTypeBool + %24 = OpConstant %6 -1 + %27 = OpConstant %13 2 + %28 = OpTypeArray %6 %27 + %29 = OpTypeStruct %28 + %30 = OpTypePointer Uniform %29 + %31 = OpVariable %30 Uniform + %32 = OpTypePointer Uniform %6 + %42 = OpTypePointer Output %10 + %43 = OpVariable %42 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %18 = OpConvertFToS %6 %17 + %20 = OpBitwiseAnd %6 %18 %19 + %23 = OpINotEqual %22 %20 %21 + %25 = OpSelect %6 %23 %21 %24 + OpStore %8 %25 + %26 = OpLoad %6 %8 + %33 = OpAccessChain %32 %31 %21 %21 + %34 = OpLoad %6 %33 + %35 = OpBitwiseOr %6 %26 %34 + %36 = OpNot %6 %35 + %37 = OpAccessChain %32 %31 %21 %21 + %38 = OpLoad %6 %37 + %39 = OpINotEqual %22 %36 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %57 + %40 = OpLabel + %44 = OpAccessChain %32 %31 %21 %21 + %45 = OpLoad %6 %44 + %46 = OpConvertSToF %9 %45 + %47 = OpAccessChain %32 %31 %21 %19 + %48 = OpLoad %6 %47 + %49 = OpConvertSToF %9 %48 + %50 = OpAccessChain %32 %31 %21 %19 + %51 = OpLoad %6 %50 + %52 = OpConvertSToF %9 %51 + %53 = OpAccessChain %32 %31 %21 %21 + %54 = OpLoad %6 %53 + %55 = OpConvertSToF %9 %54 + %56 = OpCompositeConstruct %10 %46 %49 %52 %55 + OpStore %43 %56 + OpBranch %41 + %57 = OpLabel + %58 = OpAccessChain %32 %31 %21 %19 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %9 %59 + %61 = OpCompositeConstruct %10 %60 %60 %60 %60 + OpStore %43 %61 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-exp2-two.amber b/vulkan/amber/graphicsfuzz/cov-exp2-two.amber new file mode 100644 index 0000000..286748e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-exp2-two.amber @@ -0,0 +1,108 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp int; +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = 2.0; +# +# // Always true. +# if(exp2(f) == 4.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 25 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %19 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %19 "_GLF_color" + OpDecorate %19 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 2 + %12 = OpConstant %6 4 + %13 = OpTypeBool + %17 = OpTypeVector %6 4 + %18 = OpTypePointer Output %17 + %19 = OpVariable %18 Output + %20 = OpConstant %6 1 + %21 = OpConstant %6 0 + %22 = OpConstantComposite %17 %20 %21 %21 %20 + %24 = OpConstantComposite %17 %21 %21 %21 %21 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %10 = OpLoad %6 %8 + %11 = OpExtInst %6 %1 Exp2 %10 + %14 = OpFOrdEqual %13 %11 %12 + OpSelectionMerge %16 None + OpBranchConditional %14 %15 %23 + %15 = OpLabel + OpStore %19 %22 + OpBranch %16 + %23 = OpLabel + OpStore %19 %24 + OpBranch %16 + %16 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-extend-uniform-vec2-to-vec3-matrix-multiply.amber b/vulkan/amber/graphicsfuzz/cov-extend-uniform-vec2-to-vec3-matrix-multiply.amber new file mode 100644 index 0000000..031afe3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-extend-uniform-vec2-to-vec3-matrix-multiply.amber @@ -0,0 +1,223 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: 0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of resolution: [256.0, 256.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# vec2 resolution; +# }; +# +# void main() +# { +# // v becomes (0, 0). +# vec2 v = (mat3(_float_0_0) * vec3(resolution, 1)).xy; +# +# // Always true. +# if(v == vec2(_int_0)) +# { +# _GLF_color = vec4(_float_1_0, v, _float_1_0); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 74 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %60 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %30 "buf2" + OpMemberName %30 0 "resolution" + OpName %32 "" + OpName %44 "buf1" + OpMemberName %44 0 "_GLF_uniform_int_values" + OpName %46 "" + OpName %60 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 2 + OpDecorate %43 ArrayStride 16 + OpMemberDecorate %44 0 Offset 0 + OpDecorate %44 Block + OpDecorate %46 DescriptorSet 0 + OpDecorate %46 Binding 1 + OpDecorate %60 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpConstant %16 1 + %19 = OpTypePointer Uniform %6 + %22 = OpTypeVector %6 3 + %23 = OpTypeMatrix %22 3 + %24 = OpConstant %6 1 + %25 = OpConstant %6 0 + %30 = OpTypeStruct %7 + %31 = OpTypePointer Uniform %30 + %32 = OpVariable %31 Uniform + %33 = OpTypePointer Uniform %7 + %42 = OpConstant %10 1 + %43 = OpTypeArray %16 %42 + %44 = OpTypeStruct %43 + %45 = OpTypePointer Uniform %44 + %46 = OpVariable %45 Uniform + %47 = OpTypePointer Uniform %16 + %52 = OpTypeBool + %53 = OpTypeVector %52 2 + %58 = OpTypeVector %6 4 + %59 = OpTypePointer Output %58 + %60 = OpVariable %59 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %20 = OpAccessChain %19 %15 %17 %18 + %21 = OpLoad %6 %20 + %26 = OpCompositeConstruct %22 %21 %25 %25 + %27 = OpCompositeConstruct %22 %25 %21 %25 + %28 = OpCompositeConstruct %22 %25 %25 %21 + %29 = OpCompositeConstruct %23 %26 %27 %28 + %34 = OpAccessChain %33 %32 %17 + %35 = OpLoad %7 %34 + %36 = OpCompositeExtract %6 %35 0 + %37 = OpCompositeExtract %6 %35 1 + %38 = OpCompositeConstruct %22 %36 %37 %24 + %39 = OpMatrixTimesVector %22 %29 %38 + %40 = OpVectorShuffle %7 %39 %39 0 1 + OpStore %9 %40 + %41 = OpLoad %7 %9 + %48 = OpAccessChain %47 %46 %17 %17 + %49 = OpLoad %16 %48 + %50 = OpConvertSToF %6 %49 + %51 = OpCompositeConstruct %7 %50 %50 + %54 = OpFOrdEqual %53 %41 %51 + %55 = OpAll %52 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %69 + %56 = OpLabel + %61 = OpAccessChain %19 %15 %17 %17 + %62 = OpLoad %6 %61 + %63 = OpLoad %7 %9 + %64 = OpAccessChain %19 %15 %17 %17 + %65 = OpLoad %6 %64 + %66 = OpCompositeExtract %6 %63 0 + %67 = OpCompositeExtract %6 %63 1 + %68 = OpCompositeConstruct %58 %62 %66 %67 %65 + OpStore %60 %68 + OpBranch %57 + %69 = OpLabel + %70 = OpAccessChain %47 %46 %17 %17 + %71 = OpLoad %16 %70 + %72 = OpConvertSToF %6 %71 + %73 = OpCompositeConstruct %58 %72 %72 %72 %72 + OpStore %60 %73 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-find-msb-input-either-zero-or-minus-one.amber b/vulkan/amber/graphicsfuzz/cov-find-msb-input-either-zero-or-minus-one.amber new file mode 100644 index 0000000..7a97cfb --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-find-msb-input-either-zero-or-minus-one.amber @@ -0,0 +1,208 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_10_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 10.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 0; +# +# if(gl_FragCoord.y < _float_10_0) +# { +# a--; +# } +# +# // Here a is either 0 or -1. Both will return -1 when input to findMSB. +# if(findMSB(a) == -_int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 %48 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %13 "gl_FragCoord" + OpName %20 "buf0" + OpMemberName %20 0 "_GLF_uniform_float_values" + OpName %22 "" + OpName %37 "buf1" + OpMemberName %37 0 "_GLF_uniform_int_values" + OpName %39 "" + OpName %48 "_GLF_color" + OpDecorate %13 BuiltIn FragCoord + OpDecorate %19 ArrayStride 16 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 1 + OpDecorate %48 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Input %11 + %13 = OpVariable %12 Input + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 1 + %16 = OpTypePointer Input %10 + %19 = OpTypeArray %10 %15 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpTypePointer Uniform %10 + %26 = OpTypeBool + %31 = OpConstant %6 1 + %35 = OpConstant %14 2 + %36 = OpTypeArray %6 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %6 + %47 = OpTypePointer Output %11 + %48 = OpVariable %47 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %17 = OpAccessChain %16 %13 %15 + %18 = OpLoad %10 %17 + %24 = OpAccessChain %23 %22 %9 %9 + %25 = OpLoad %10 %24 + %27 = OpFOrdLessThan %26 %18 %25 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %29 + %28 = OpLabel + %30 = OpLoad %6 %8 + %32 = OpISub %6 %30 %31 + OpStore %8 %32 + OpBranch %29 + %29 = OpLabel + %33 = OpLoad %6 %8 + %34 = OpExtInst %6 %1 FindSMsb %33 + %41 = OpAccessChain %40 %39 %9 %31 + %42 = OpLoad %6 %41 + %43 = OpSNegate %6 %42 + %44 = OpIEqual %26 %34 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %45 %62 + %45 = OpLabel + %49 = OpAccessChain %40 %39 %9 %31 + %50 = OpLoad %6 %49 + %51 = OpConvertSToF %10 %50 + %52 = OpAccessChain %40 %39 %9 %9 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %10 %53 + %55 = OpAccessChain %40 %39 %9 %9 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %10 %56 + %58 = OpAccessChain %40 %39 %9 %31 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %10 %59 + %61 = OpCompositeConstruct %11 %51 %54 %57 %60 + OpStore %48 %61 + OpBranch %46 + %62 = OpLabel + %63 = OpAccessChain %40 %39 %9 %9 + %64 = OpLoad %6 %63 + %65 = OpConvertSToF %10 %64 + %66 = OpCompositeConstruct %11 %65 %65 %65 %65 + OpStore %48 %66 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 10.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-findlsb-division-by-zero.amber b/vulkan/amber/graphicsfuzz/cov-findlsb-division-by-zero.amber new file mode 100644 index 0000000..b81c680 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-findlsb-division-by-zero.amber @@ -0,0 +1,248 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplify code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_5 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# #define _int_9 _GLF_uniform_int_values[4] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [5, 2, 1, 0, 9] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S { +# int data; +# }; +# +# void main() +# { +# int value = -_int_1; +# for (int i = _int_1; i < _int_5; i++) +# { +# // idx becomes undefined during the first and third iteration since i +# // is divided by zero. Nevertheless, it becomes 2 in the last iteration. +# int idx = clamp(_int_0, (i / findLSB(i)), _int_9); +# +# if (idx == _int_2) +# { +# value = S[3](S(_int_0), S(_int_1), S(_int_2))[idx].data; +# } +# } +# +# if (value == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 101 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %82 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "value" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %21 "i" + OpName %34 "idx" + OpName %55 "S" + OpMemberName %55 0 "data" + OpName %68 "indexable" + OpName %82 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %82 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 5 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %32 = OpTypeBool + %35 = OpConstant %6 3 + %42 = OpConstant %6 4 + %47 = OpConstant %6 1 + %55 = OpTypeStruct %6 + %63 = OpConstant %9 3 + %64 = OpTypeArray %55 %63 + %67 = OpTypePointer Function %64 + %79 = OpTypeFloat 32 + %80 = OpTypeVector %79 4 + %81 = OpTypePointer Output %80 + %82 = OpVariable %81 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %21 = OpVariable %7 Function + %34 = OpVariable %7 Function + %68 = OpVariable %67 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + %20 = OpSNegate %6 %19 + OpStore %8 %20 + %22 = OpAccessChain %17 %14 %15 %16 + %23 = OpLoad %6 %22 + OpStore %21 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %21 + %30 = OpAccessChain %17 %14 %15 %15 + %31 = OpLoad %6 %30 + %33 = OpSLessThan %32 %29 %31 + OpBranchConditional %33 %25 %26 + %25 = OpLabel + %36 = OpAccessChain %17 %14 %15 %35 + %37 = OpLoad %6 %36 + %38 = OpLoad %6 %21 + %39 = OpLoad %6 %21 + %40 = OpExtInst %6 %1 FindILsb %39 + %41 = OpSDiv %6 %38 %40 + %43 = OpAccessChain %17 %14 %15 %42 + %44 = OpLoad %6 %43 + %45 = OpExtInst %6 %1 SClamp %37 %41 %44 + OpStore %34 %45 + %46 = OpLoad %6 %34 + %48 = OpAccessChain %17 %14 %15 %47 + %49 = OpLoad %6 %48 + %50 = OpIEqual %32 %46 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %52 + %51 = OpLabel + %53 = OpAccessChain %17 %14 %15 %35 + %54 = OpLoad %6 %53 + %56 = OpCompositeConstruct %55 %54 + %57 = OpAccessChain %17 %14 %15 %16 + %58 = OpLoad %6 %57 + %59 = OpCompositeConstruct %55 %58 + %60 = OpAccessChain %17 %14 %15 %47 + %61 = OpLoad %6 %60 + %62 = OpCompositeConstruct %55 %61 + %65 = OpCompositeConstruct %64 %56 %59 %62 + %66 = OpLoad %6 %34 + OpStore %68 %65 + %69 = OpAccessChain %7 %68 %66 %15 + %70 = OpLoad %6 %69 + OpStore %8 %70 + OpBranch %52 + %52 = OpLabel + OpBranch %27 + %27 = OpLabel + %71 = OpLoad %6 %21 + %72 = OpIAdd %6 %71 %47 + OpStore %21 %72 + OpBranch %24 + %26 = OpLabel + %73 = OpLoad %6 %8 + %74 = OpAccessChain %17 %14 %15 %47 + %75 = OpLoad %6 %74 + %76 = OpIEqual %32 %73 %75 + OpSelectionMerge %78 None + OpBranchConditional %76 %77 %96 + %77 = OpLabel + %83 = OpAccessChain %17 %14 %15 %16 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %79 %84 + %86 = OpAccessChain %17 %14 %15 %35 + %87 = OpLoad %6 %86 + %88 = OpConvertSToF %79 %87 + %89 = OpAccessChain %17 %14 %15 %35 + %90 = OpLoad %6 %89 + %91 = OpConvertSToF %79 %90 + %92 = OpAccessChain %17 %14 %15 %16 + %93 = OpLoad %6 %92 + %94 = OpConvertSToF %79 %93 + %95 = OpCompositeConstruct %80 %85 %88 %91 %94 + OpStore %82 %95 + OpBranch %78 + %96 = OpLabel + %97 = OpAccessChain %17 %14 %15 %35 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %79 %98 + %100 = OpCompositeConstruct %80 %99 %99 %99 %99 + OpStore %82 %100 + OpBranch %78 + %78 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 5 2 1 0 9 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-float-array-init-pow.amber b/vulkan/amber/graphicsfuzz/cov-float-array-init-pow.amber new file mode 100644 index 0000000..f7a534b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-float-array-init-pow.amber @@ -0,0 +1,222 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific arith builder code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_7 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_8 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_3_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [7, 1, 0, 8] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# // Contents of _GLF_uniform_float_values: [1.0, 3.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = 2.0; +# float arr[10] = float[10](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, pow(f, _float_3_0), _float_1_0, _float_1_0); +# +# // Always true. +# if(int(arr[_int_7]) == _int_8) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 87 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %67 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %14 "arr" + OpName %17 "buf1" + OpMemberName %17 0 "_GLF_uniform_float_values" + OpName %19 "" + OpName %49 "buf0" + OpMemberName %49 0 "_GLF_uniform_int_values" + OpName %51 "" + OpName %67 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %48 ArrayStride 16 + OpMemberDecorate %49 0 Offset 0 + OpDecorate %49 Block + OpDecorate %51 DescriptorSet 0 + OpDecorate %51 Binding 0 + OpDecorate %67 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 2 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 10 + %12 = OpTypeArray %6 %11 + %13 = OpTypePointer Function %12 + %15 = OpConstant %10 2 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypeInt 32 1 + %21 = OpConstant %20 0 + %22 = OpTypePointer Uniform %6 + %38 = OpConstant %20 1 + %47 = OpConstant %10 4 + %48 = OpTypeArray %20 %47 + %49 = OpTypeStruct %48 + %50 = OpTypePointer Uniform %49 + %51 = OpVariable %50 Uniform + %52 = OpTypePointer Uniform %20 + %58 = OpConstant %20 3 + %61 = OpTypeBool + %65 = OpTypeVector %6 4 + %66 = OpTypePointer Output %65 + %67 = OpVariable %66 Output + %71 = OpConstant %20 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %14 = OpVariable %13 Function + OpStore %8 %9 + %23 = OpAccessChain %22 %19 %21 %21 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %22 %19 %21 %21 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %22 %19 %21 %21 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %22 %19 %21 %21 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %22 %19 %21 %21 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %22 %19 %21 %21 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %22 %19 %21 %21 + %36 = OpLoad %6 %35 + %37 = OpLoad %6 %8 + %39 = OpAccessChain %22 %19 %21 %38 + %40 = OpLoad %6 %39 + %41 = OpExtInst %6 %1 Pow %37 %40 + %42 = OpAccessChain %22 %19 %21 %21 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %22 %19 %21 %21 + %45 = OpLoad %6 %44 + %46 = OpCompositeConstruct %12 %24 %26 %28 %30 %32 %34 %36 %41 %43 %45 + OpStore %14 %46 + %53 = OpAccessChain %52 %51 %21 %21 + %54 = OpLoad %20 %53 + %55 = OpAccessChain %7 %14 %54 + %56 = OpLoad %6 %55 + %57 = OpConvertFToS %20 %56 + %59 = OpAccessChain %52 %51 %21 %58 + %60 = OpLoad %20 %59 + %62 = OpIEqual %61 %57 %60 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %82 + %63 = OpLabel + %68 = OpAccessChain %52 %51 %21 %38 + %69 = OpLoad %20 %68 + %70 = OpConvertSToF %6 %69 + %72 = OpAccessChain %52 %51 %21 %71 + %73 = OpLoad %20 %72 + %74 = OpConvertSToF %6 %73 + %75 = OpAccessChain %52 %51 %21 %71 + %76 = OpLoad %20 %75 + %77 = OpConvertSToF %6 %76 + %78 = OpAccessChain %52 %51 %21 %38 + %79 = OpLoad %20 %78 + %80 = OpConvertSToF %6 %79 + %81 = OpCompositeConstruct %65 %70 %74 %77 %80 + OpStore %67 %81 + OpBranch %64 + %82 = OpLabel + %83 = OpAccessChain %52 %51 %21 %71 + %84 = OpLoad %20 %83 + %85 = OpConvertSToF %6 %84 + %86 = OpCompositeConstruct %65 %85 %85 %85 %85 + OpStore %67 %86 + OpBranch %64 + %64 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 3.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 7 1 0 8 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fold-and-in-for-loop-range.amber b/vulkan/amber/graphicsfuzz/cov-fold-and-in-for-loop-range.amber new file mode 100644 index 0000000..6127666 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fold-and-in-for-loop-range.amber @@ -0,0 +1,172 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific folding path + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# int func() +# { +# int ret = 0; +# +# for(int i = 3; i > (i & 1); i -= one) +# ret++; +# +# return ret; +# } +# +# void main() +# { +# if (func() == 2) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "ret" + OpName %13 "i" + OpName %28 "buf0" + OpMemberName %28 0 "one" + OpName %30 "" + OpName %47 "_GLF_color" + OpMemberDecorate %28 0 Offset 0 + OpDecorate %28 Block + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 0 + OpDecorate %47 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 0 + %14 = OpConstant %6 3 + %22 = OpConstant %6 1 + %24 = OpTypeBool + %28 = OpTypeStruct %6 + %29 = OpTypePointer Uniform %28 + %30 = OpVariable %29 Uniform + %31 = OpTypePointer Uniform %6 + %40 = OpConstant %6 2 + %44 = OpTypeFloat 32 + %45 = OpTypeVector %44 4 + %46 = OpTypePointer Output %45 + %47 = OpVariable %46 Output + %48 = OpConstant %44 1 + %49 = OpConstant %44 0 + %50 = OpConstantComposite %45 %48 %49 %49 %48 + %52 = OpConstantComposite %45 %49 %49 %49 %49 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %39 = OpFunctionCall %6 %8 + %41 = OpIEqual %24 %39 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %51 + %42 = OpLabel + OpStore %47 %50 + OpBranch %43 + %51 = OpLabel + OpStore %47 %52 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %13 = OpVariable %10 Function + OpStore %11 %12 + OpStore %13 %14 + OpBranch %15 + %15 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %20 = OpLoad %6 %13 + %21 = OpLoad %6 %13 + %23 = OpBitwiseAnd %6 %21 %22 + %25 = OpSGreaterThan %24 %20 %23 + OpBranchConditional %25 %16 %17 + %16 = OpLabel + %26 = OpLoad %6 %11 + %27 = OpIAdd %6 %26 %22 + OpStore %11 %27 + OpBranch %18 + %18 = OpLabel + %32 = OpAccessChain %31 %30 %12 + %33 = OpLoad %6 %32 + %34 = OpLoad %6 %13 + %35 = OpISub %6 %34 %33 + OpStore %13 %35 + OpBranch %15 + %17 = OpLabel + %36 = OpLoad %6 %11 + OpReturnValue %36 + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fold-bitwise-and-zero.amber b/vulkan/amber/graphicsfuzz/cov-fold-bitwise-and-zero.amber new file mode 100644 index 0000000..50cf4fa --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fold-bitwise-and-zero.amber @@ -0,0 +1,125 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // If condition is always true. +# if ((one & 0) == 0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %22 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "buf0" + OpMemberName %7 0 "one" + OpName %9 "" + OpName %22 "_GLF_color" + OpMemberDecorate %7 0 Offset 0 + OpDecorate %7 Block + OpDecorate %9 DescriptorSet 0 + OpDecorate %9 Binding 0 + OpDecorate %22 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Uniform %7 + %9 = OpVariable %8 Uniform + %10 = OpConstant %6 0 + %11 = OpTypePointer Uniform %6 + %15 = OpTypeBool + %19 = OpTypeFloat 32 + %20 = OpTypeVector %19 4 + %21 = OpTypePointer Output %20 + %22 = OpVariable %21 Output + %23 = OpConstant %19 1 + %24 = OpConstant %19 0 + %25 = OpConstantComposite %20 %23 %24 %24 %23 + %27 = OpConstantComposite %20 %24 %24 %24 %24 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpAccessChain %11 %9 %10 + %13 = OpLoad %6 %12 + %14 = OpBitwiseAnd %6 %13 %10 + %16 = OpIEqual %15 %14 %10 + OpSelectionMerge %18 None + OpBranchConditional %16 %17 %26 + %17 = OpLabel + OpStore %22 %25 + OpBranch %18 + %26 = OpLabel + OpStore %22 %27 + OpBranch %18 + %18 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fold-bitwise-or-full-mask.amber b/vulkan/amber/graphicsfuzz/cov-fold-bitwise-or-full-mask.amber new file mode 100644 index 0000000..6ddecd3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fold-bitwise-or-full-mask.amber @@ -0,0 +1,126 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // If condition is always true. +# if (((~0) | one) == (~0)) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 29 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %23 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "buf0" + OpMemberName %8 0 "one" + OpName %10 "" + OpName %23 "_GLF_color" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 0 + OpDecorate %23 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpConstant %6 -1 + %8 = OpTypeStruct %6 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpConstant %6 0 + %12 = OpTypePointer Uniform %6 + %16 = OpTypeBool + %20 = OpTypeFloat 32 + %21 = OpTypeVector %20 4 + %22 = OpTypePointer Output %21 + %23 = OpVariable %22 Output + %24 = OpConstant %20 1 + %25 = OpConstant %20 0 + %26 = OpConstantComposite %21 %24 %25 %25 %24 + %28 = OpConstantComposite %21 %25 %25 %25 %25 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %13 = OpAccessChain %12 %10 %11 + %14 = OpLoad %6 %13 + %15 = OpBitwiseOr %6 %7 %14 + %17 = OpIEqual %16 %15 %7 + OpSelectionMerge %19 None + OpBranchConditional %17 %18 %27 + %18 = OpLabel + OpStore %23 %26 + OpBranch %19 + %27 = OpLabel + OpStore %23 %28 + OpBranch %19 + %19 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fold-bitwise-xor.amber b/vulkan/amber/graphicsfuzz/cov-fold-bitwise-xor.amber new file mode 100644 index 0000000..871a351 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fold-bitwise-xor.amber @@ -0,0 +1,117 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 6; +# int b = 5; +# // If condition is always false. +# if ((a ^ b) != 3) +# _GLF_color = vec4(0); +# else +# _GLF_color = vec4(1, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 29 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %23 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %10 "b" + OpName %23 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %23 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 6 + %11 = OpConstant %6 5 + %15 = OpConstant %6 3 + %16 = OpTypeBool + %20 = OpTypeFloat 32 + %21 = OpTypeVector %20 4 + %22 = OpTypePointer Output %21 + %23 = OpVariable %22 Output + %24 = OpConstant %20 0 + %25 = OpConstantComposite %21 %24 %24 %24 %24 + %27 = OpConstant %20 1 + %28 = OpConstantComposite %21 %27 %24 %24 %27 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %11 + %12 = OpLoad %6 %8 + %13 = OpLoad %6 %10 + %14 = OpBitwiseXor %6 %12 %13 + %17 = OpINotEqual %16 %14 %15 + OpSelectionMerge %19 None + OpBranchConditional %17 %18 %26 + %18 = OpLabel + OpStore %23 %25 + OpBranch %19 + %26 = OpLabel + OpStore %23 %28 + OpBranch %19 + %19 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fold-logical-and-const-variable.amber b/vulkan/amber/graphicsfuzz/cov-fold-logical-and-const-variable.amber new file mode 100644 index 0000000..a5f677a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fold-logical-and-const-variable.amber @@ -0,0 +1,107 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# bool a = false; +# +# // If condition is always false. +# if(true && a) +# _GLF_color = vec4(0); +# else +# _GLF_color = vec4(1, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 24 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %18 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %18 "_GLF_color" + OpDecorate %18 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeBool + %7 = OpTypePointer Function %6 + %9 = OpConstantFalse %6 + %10 = OpConstantTrue %6 + %15 = OpTypeFloat 32 + %16 = OpTypeVector %15 4 + %17 = OpTypePointer Output %16 + %18 = OpVariable %17 Output + %19 = OpConstant %15 0 + %20 = OpConstantComposite %16 %19 %19 %19 %19 + %22 = OpConstant %15 1 + %23 = OpConstantComposite %16 %22 %19 %19 %22 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %11 = OpLoad %6 %8 + %12 = OpLogicalAnd %6 %10 %11 + OpSelectionMerge %14 None + OpBranchConditional %12 %13 %21 + %13 = OpLabel + OpStore %18 %20 + OpBranch %14 + %21 = OpLabel + OpStore %18 %23 + OpBranch %14 + %14 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fold-logical-and-constant.amber b/vulkan/amber/graphicsfuzz/cov-fold-logical-and-constant.amber new file mode 100644 index 0000000..7d1731b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fold-logical-and-constant.amber @@ -0,0 +1,148 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main(void) +# { +# int i = 2; +# +# do +# { +# i++; +# } +# while(gl_FragCoord.x >= 0.0 && false); +# +# // If condition is always true. +# if (i == 3) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %20 %37 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %20 "gl_FragCoord" + OpName %37 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %20 BuiltIn FragCoord + OpDecorate %31 RelaxedPrecision + OpDecorate %37 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 2 + %15 = OpConstant %6 1 + %17 = OpTypeFloat 32 + %18 = OpTypeVector %17 4 + %19 = OpTypePointer Input %18 + %20 = OpVariable %19 Input + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Input %17 + %26 = OpConstant %17 0 + %27 = OpTypeBool + %29 = OpConstantFalse %27 + %32 = OpConstant %6 3 + %36 = OpTypePointer Output %18 + %37 = OpVariable %36 Output + %38 = OpConstant %17 1 + %39 = OpConstantComposite %18 %38 %26 %26 %38 + %41 = OpConstantComposite %18 %26 %26 %26 %26 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %11 + %11 = OpLabel + %14 = OpLoad %6 %8 + %16 = OpIAdd %6 %14 %15 + OpStore %8 %16 + OpBranch %13 + %13 = OpLabel + %24 = OpAccessChain %23 %20 %22 + %25 = OpLoad %17 %24 + %28 = OpFOrdGreaterThanEqual %27 %25 %26 + %30 = OpLogicalAnd %27 %28 %29 + OpBranchConditional %30 %10 %12 + %12 = OpLabel + %31 = OpLoad %6 %8 + %33 = OpIEqual %27 %31 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %40 + %34 = OpLabel + OpStore %37 %39 + OpBranch %35 + %40 = OpLabel + OpStore %37 %41 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fold-logical-or-constant.amber b/vulkan/amber/graphicsfuzz/cov-fold-logical-or-constant.amber new file mode 100644 index 0000000..2fa2505 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fold-logical-or-constant.amber @@ -0,0 +1,107 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // If condition is always true. +# if((gl_FragCoord.x < 0.0) || true) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %23 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "gl_FragCoord" + OpName %23 "_GLF_color" + OpDecorate %9 BuiltIn FragCoord + OpDecorate %23 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Input %7 + %9 = OpVariable %8 Input + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 0 + %12 = OpTypePointer Input %6 + %15 = OpConstant %6 0 + %16 = OpTypeBool + %18 = OpConstantTrue %16 + %22 = OpTypePointer Output %7 + %23 = OpVariable %22 Output + %24 = OpConstant %6 1 + %25 = OpConstantComposite %7 %24 %15 %15 %24 + %27 = OpConstantComposite %7 %15 %15 %15 %15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %13 = OpAccessChain %12 %9 %11 + %14 = OpLoad %6 %13 + %17 = OpFOrdLessThan %16 %14 %15 + %19 = OpLogicalOr %16 %17 %18 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %26 + %20 = OpLabel + OpStore %23 %25 + OpBranch %21 + %26 = OpLabel + OpStore %23 %27 + OpBranch %21 + %21 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fold-negate-min-int-value.amber b/vulkan/amber/graphicsfuzz/cov-fold-negate-min-int-value.amber new file mode 100644 index 0000000..7896493 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fold-negate-min-int-value.amber @@ -0,0 +1,139 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int minusOne; +# }; +# +# void main() +# { +# int minValue = -2147483648; +# int negMinValue = -minValue; +# +# if (negMinValue == minValue * minusOne) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %30 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "minValue" + OpName %10 "negMinValue" + OpName %15 "buf0" + OpMemberName %15 0 "minusOne" + OpName %17 "" + OpName %30 "_GLF_color" + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %30 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 -2147483648 + %15 = OpTypeStruct %6 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpTypePointer Uniform %6 + %23 = OpTypeBool + %27 = OpTypeFloat 32 + %28 = OpTypeVector %27 4 + %29 = OpTypePointer Output %28 + %30 = OpVariable %29 Output + %31 = OpConstant %27 1 + %32 = OpConstant %27 0 + %33 = OpConstantComposite %28 %31 %32 %32 %31 + %35 = OpConstantComposite %28 %32 %32 %32 %32 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + %11 = OpLoad %6 %8 + %12 = OpSNegate %6 %11 + OpStore %10 %12 + %13 = OpLoad %6 %10 + %14 = OpLoad %6 %8 + %20 = OpAccessChain %19 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpIMul %6 %14 %21 + %24 = OpIEqual %23 %13 %22 + OpSelectionMerge %26 None + OpBranchConditional %24 %25 %34 + %25 = OpLabel + OpStore %30 %33 + OpBranch %26 + %34 = OpLabel + OpStore %30 %35 + OpBranch %26 + %26 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# minusOne +BUFFER variant_minusOne DATA_TYPE int32 DATA + -1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_minusOne AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fold-negate-variable.amber b/vulkan/amber/graphicsfuzz/cov-fold-negate-variable.amber new file mode 100644 index 0000000..e94cfb4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fold-negate-variable.amber @@ -0,0 +1,109 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = 3; +# // If comparison is always true. +# if((~i) == -4) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0, 0, 0, 0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %20 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %20 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %20 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 3 + %12 = OpConstant %6 -4 + %13 = OpTypeBool + %17 = OpTypeFloat 32 + %18 = OpTypeVector %17 4 + %19 = OpTypePointer Output %18 + %20 = OpVariable %19 Output + %21 = OpConstant %17 1 + %22 = OpConstant %17 0 + %23 = OpConstantComposite %18 %21 %22 %22 %21 + %25 = OpConstantComposite %18 %22 %22 %22 %22 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %10 = OpLoad %6 %8 + %11 = OpNot %6 %10 + %14 = OpIEqual %13 %11 %12 + OpSelectionMerge %16 None + OpBranchConditional %14 %15 %24 + %15 = OpLabel + OpStore %20 %23 + OpBranch %16 + %24 = OpLabel + OpStore %20 %25 + OpBranch %16 + %16 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fold-shift-gte32.amber b/vulkan/amber/graphicsfuzz/cov-fold-shift-gte32.amber new file mode 100644 index 0000000..b73d8d9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fold-shift-gte32.amber @@ -0,0 +1,253 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# uint one; +# }; +# +# void main() +# { +# uint a = (77u + one) >> 32u; +# uint b = (3243u + one) >> 33u; +# uint c = (23u + one) >> 345u; +# uint d = (2395u + one) << 32u; +# uint e = (290485u + one) << 33u; +# uint f = (44321u + one) << 345u; +# +# if (a != 1u) a = 1u; +# if (b != 0u) b = 0u; +# if (c != 1u) c = 1u; +# if (d != 0u) d = 0u; +# if (e != 1u) e = 1u; +# if (f != 0u) f = 0u; +# +# if (a == 1u && b == 0u && c == 1u && d == 0u && e == 1u && f == 0u) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 108 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %102 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %10 "buf0" + OpMemberName %10 0 "one" + OpName %12 "" + OpName %21 "b" + OpName %28 "c" + OpName %35 "d" + OpName %41 "e" + OpName %47 "f" + OpName %102 "_GLF_color" + OpMemberDecorate %10 0 Offset 0 + OpDecorate %10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %102 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 77 + %10 = OpTypeStruct %6 + %11 = OpTypePointer Uniform %10 + %12 = OpVariable %11 Uniform + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %6 + %19 = OpConstant %6 32 + %22 = OpConstant %6 3243 + %26 = OpConstant %6 33 + %29 = OpConstant %6 23 + %33 = OpConstant %6 345 + %36 = OpConstant %6 2395 + %42 = OpConstant %6 290485 + %48 = OpConstant %6 44321 + %54 = OpConstant %6 1 + %55 = OpTypeBool + %60 = OpConstant %6 0 + %99 = OpTypeFloat 32 + %100 = OpTypeVector %99 4 + %101 = OpTypePointer Output %100 + %102 = OpVariable %101 Output + %103 = OpConstant %99 1 + %104 = OpConstant %99 0 + %105 = OpConstantComposite %100 %103 %104 %104 %103 + %107 = OpConstantComposite %100 %104 %104 %104 %104 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %21 = OpVariable %7 Function + %28 = OpVariable %7 Function + %35 = OpVariable %7 Function + %41 = OpVariable %7 Function + %47 = OpVariable %7 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %6 %16 + %18 = OpIAdd %6 %9 %17 + %20 = OpShiftRightLogical %6 %18 %19 + OpStore %8 %20 + %23 = OpAccessChain %15 %12 %14 + %24 = OpLoad %6 %23 + %25 = OpIAdd %6 %22 %24 + %27 = OpShiftRightLogical %6 %25 %26 + OpStore %21 %27 + %30 = OpAccessChain %15 %12 %14 + %31 = OpLoad %6 %30 + %32 = OpIAdd %6 %29 %31 + %34 = OpShiftRightLogical %6 %32 %33 + OpStore %28 %34 + %37 = OpAccessChain %15 %12 %14 + %38 = OpLoad %6 %37 + %39 = OpIAdd %6 %36 %38 + %40 = OpShiftLeftLogical %6 %39 %19 + OpStore %35 %40 + %43 = OpAccessChain %15 %12 %14 + %44 = OpLoad %6 %43 + %45 = OpIAdd %6 %42 %44 + %46 = OpShiftLeftLogical %6 %45 %26 + OpStore %41 %46 + %49 = OpAccessChain %15 %12 %14 + %50 = OpLoad %6 %49 + %51 = OpIAdd %6 %48 %50 + %52 = OpShiftLeftLogical %6 %51 %33 + OpStore %47 %52 + %53 = OpLoad %6 %8 + %56 = OpINotEqual %55 %53 %54 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + OpStore %8 %54 + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %6 %21 + %61 = OpINotEqual %55 %59 %60 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %63 + %62 = OpLabel + OpStore %21 %60 + OpBranch %63 + %63 = OpLabel + %64 = OpLoad %6 %28 + %65 = OpINotEqual %55 %64 %54 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %67 + %66 = OpLabel + OpStore %28 %54 + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %6 %35 + %69 = OpINotEqual %55 %68 %60 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %71 + %70 = OpLabel + OpStore %35 %60 + OpBranch %71 + %71 = OpLabel + %72 = OpLoad %6 %41 + %73 = OpINotEqual %55 %72 %54 + OpSelectionMerge %75 None + OpBranchConditional %73 %74 %75 + %74 = OpLabel + OpStore %41 %54 + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %6 %47 + %77 = OpINotEqual %55 %76 %60 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + OpStore %47 %60 + OpBranch %79 + %79 = OpLabel + %80 = OpLoad %6 %8 + %81 = OpIEqual %55 %80 %54 + %82 = OpLoad %6 %21 + %83 = OpIEqual %55 %82 %60 + %84 = OpLogicalAnd %55 %81 %83 + %85 = OpLoad %6 %28 + %86 = OpIEqual %55 %85 %54 + %87 = OpLogicalAnd %55 %84 %86 + %88 = OpLoad %6 %35 + %89 = OpIEqual %55 %88 %60 + %90 = OpLogicalAnd %55 %87 %89 + %91 = OpLoad %6 %41 + %92 = OpIEqual %55 %91 %54 + %93 = OpLogicalAnd %55 %90 %92 + %94 = OpLoad %6 %47 + %95 = OpIEqual %55 %94 %60 + %96 = OpLogicalAnd %55 %93 %95 + OpSelectionMerge %98 None + OpBranchConditional %96 %97 %106 + %97 = OpLabel + OpStore %102 %105 + OpBranch %98 + %106 = OpLabel + OpStore %102 %107 + OpBranch %98 + %98 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fold-shift-right-arithmetic.amber b/vulkan/amber/graphicsfuzz/cov-fold-shift-right-arithmetic.amber new file mode 100644 index 0000000..6caa908 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fold-shift-right-arithmetic.amber @@ -0,0 +1,110 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = 5; +# // If condition is always false. +# if (i >> 1 != 2) +# _GLF_color = vec4(0); +# else +# _GLF_color = vec4(1, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 27 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %21 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %21 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %21 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 5 + %11 = OpConstant %6 1 + %13 = OpConstant %6 2 + %14 = OpTypeBool + %18 = OpTypeFloat 32 + %19 = OpTypeVector %18 4 + %20 = OpTypePointer Output %19 + %21 = OpVariable %20 Output + %22 = OpConstant %18 0 + %23 = OpConstantComposite %19 %22 %22 %22 %22 + %25 = OpConstant %18 1 + %26 = OpConstantComposite %19 %25 %22 %22 %25 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %10 = OpLoad %6 %8 + %12 = OpShiftRightArithmetic %6 %10 %11 + %15 = OpINotEqual %14 %12 %13 + OpSelectionMerge %17 None + OpBranchConditional %15 %16 %24 + %16 = OpLabel + OpStore %21 %23 + OpBranch %17 + %24 = OpLabel + OpStore %21 %26 + OpBranch %17 + %17 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fold-switch-udiv.amber b/vulkan/amber/graphicsfuzz/cov-fold-switch-udiv.amber new file mode 100644 index 0000000..e5d11d7 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fold-switch-udiv.amber @@ -0,0 +1,113 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# uint a = 4u; +# +# switch(a / 2u) +# { +# case 2u: +# // This branch is always executed. +# _GLF_color = vec4(1, 0, 0, 1); +# break; +# default: +# _GLF_color = vec4(0); +# break; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 27 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %19 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %19 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %19 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 4 + %11 = OpConstant %6 2 + %16 = OpTypeFloat 32 + %17 = OpTypeVector %16 4 + %18 = OpTypePointer Output %17 + %19 = OpVariable %18 Output + %20 = OpConstant %16 1 + %21 = OpConstant %16 0 + %22 = OpConstantComposite %17 %20 %21 %21 %20 + %24 = OpConstantComposite %17 %21 %21 %21 %21 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %10 = OpLoad %6 %8 + %12 = OpUDiv %6 %10 %11 + OpSelectionMerge %15 None + OpSwitch %12 %14 2 %13 + %14 = OpLabel + OpStore %19 %24 + OpBranch %15 + %13 = OpLabel + OpStore %19 %22 + OpBranch %15 + %15 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-clamp-cmp-const-first.amber b/vulkan/amber/graphicsfuzz/cov-folding-clamp-cmp-const-first.amber new file mode 100644 index 0000000..4c0fde2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-clamp-cmp-const-first.amber @@ -0,0 +1,155 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant folding path + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void main() +# { +# float f = 1.0; +# +# do +# { +# f += one; +# } +# while(10.0 > clamp(f, 8.0, 9.0 + one)); +# +# if (f == 10.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %40 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %14 "buf0" + OpMemberName %14 0 "one" + OpName %16 "" + OpName %40 "_GLF_color" + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %40 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %14 = OpTypeStruct %6 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %24 = OpConstant %6 10 + %26 = OpConstant %6 8 + %27 = OpConstant %6 9 + %32 = OpTypeBool + %38 = OpTypeVector %6 4 + %39 = OpTypePointer Output %38 + %40 = OpVariable %39 Output + %41 = OpConstant %6 0 + %42 = OpConstantComposite %38 %9 %41 %41 %9 + %44 = OpConstantComposite %38 %41 %41 %41 %41 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %11 + %11 = OpLabel + %20 = OpAccessChain %19 %16 %18 + %21 = OpLoad %6 %20 + %22 = OpLoad %6 %8 + %23 = OpFAdd %6 %22 %21 + OpStore %8 %23 + OpBranch %13 + %13 = OpLabel + %25 = OpLoad %6 %8 + %28 = OpAccessChain %19 %16 %18 + %29 = OpLoad %6 %28 + %30 = OpFAdd %6 %27 %29 + %31 = OpExtInst %6 %1 FClamp %25 %26 %30 + %33 = OpFOrdGreaterThan %32 %24 %31 + OpBranchConditional %33 %10 %12 + %12 = OpLabel + %34 = OpLoad %6 %8 + %35 = OpFOrdEqual %32 %34 %24 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %43 + %36 = OpLabel + OpStore %40 %42 + OpBranch %37 + %43 = OpLabel + OpStore %40 %44 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-merge-add-sub-uniform.amber b/vulkan/amber/graphicsfuzz/cov-folding-merge-add-sub-uniform.amber new file mode 100644 index 0000000..832d0ce --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-merge-add-sub-uniform.amber @@ -0,0 +1,127 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# void main() +# { +# if (1 + (3 - one) == 3) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 31 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %25 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "buf0" + OpMemberName %9 0 "one" + OpName %11 "" + OpName %25 "_GLF_color" + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 Block + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 0 + OpDecorate %25 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpConstant %6 1 + %8 = OpConstant %6 3 + %9 = OpTypeStruct %6 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpConstant %6 0 + %13 = OpTypePointer Uniform %6 + %18 = OpTypeBool + %22 = OpTypeFloat 32 + %23 = OpTypeVector %22 4 + %24 = OpTypePointer Output %23 + %25 = OpVariable %24 Output + %26 = OpConstant %22 1 + %27 = OpConstant %22 0 + %28 = OpConstantComposite %23 %26 %27 %27 %26 + %30 = OpConstantComposite %23 %27 %27 %27 %27 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpAccessChain %13 %11 %12 + %15 = OpLoad %6 %14 + %16 = OpISub %6 %8 %15 + %17 = OpIAdd %6 %7 %16 + %19 = OpIEqual %18 %17 %8 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %29 + %20 = OpLabel + OpStore %25 %28 + OpBranch %21 + %29 = OpLabel + OpStore %25 %30 + OpBranch %21 + %21 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-construct-extract.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-construct-extract.amber new file mode 100644 index 0000000..9fbde7c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-construct-extract.amber @@ -0,0 +1,159 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 twoandthree; // (2.0, 3.0) +# }; +# +# void main() +# { +# vec2 a = twoandthree; +# vec2 b = vec2(a.x, clamp(a, vec2(1), vec2(1)).y); +# +# // Always true +# if (b.x == 2.0 && b.y == 1.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "a" + OpName %10 "buf0" + OpMemberName %10 0 "twoandthree" + OpName %12 "" + OpName %18 "b" + OpName %46 "_GLF_color" + OpMemberDecorate %10 0 Offset 0 + OpDecorate %10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %46 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeStruct %7 + %11 = OpTypePointer Uniform %10 + %12 = OpVariable %11 Uniform + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %7 + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 0 + %21 = OpTypePointer Function %6 + %25 = OpConstant %6 1 + %26 = OpConstantComposite %7 %25 %25 + %28 = OpConstant %19 1 + %31 = OpTypeBool + %34 = OpConstant %6 2 + %44 = OpTypeVector %6 4 + %45 = OpTypePointer Output %44 + %46 = OpVariable %45 Output + %47 = OpConstant %6 0 + %48 = OpConstantComposite %44 %25 %47 %47 %25 + %50 = OpConstantComposite %44 %47 %47 %47 %47 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %18 = OpVariable %8 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %7 %16 + OpStore %9 %17 + %22 = OpAccessChain %21 %9 %20 + %23 = OpLoad %6 %22 + %24 = OpLoad %7 %9 + %27 = OpExtInst %7 %1 FClamp %24 %26 %26 + %29 = OpCompositeExtract %6 %27 1 + %30 = OpCompositeConstruct %7 %23 %29 + OpStore %18 %30 + %32 = OpAccessChain %21 %18 %20 + %33 = OpLoad %6 %32 + %35 = OpFOrdEqual %31 %33 %34 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %37 + %36 = OpLabel + %38 = OpAccessChain %21 %18 %28 + %39 = OpLoad %6 %38 + %40 = OpFOrdEqual %31 %39 %25 + OpBranch %37 + %37 = OpLabel + %41 = OpPhi %31 %35 %5 %40 %36 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %49 + %42 = OpLabel + OpStore %46 %48 + OpBranch %43 + %49 = OpLabel + OpStore %46 %50 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# twoandthree +BUFFER variant_twoandthree DATA_TYPE vec2 DATA + 2.0 3.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_twoandthree AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-dot-extract.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-dot-extract.amber new file mode 100644 index 0000000..4df1539 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-dot-extract.amber @@ -0,0 +1,127 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float three; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always true. +# if(dot(vec4(1.0, 2.0, three, 4.0), vec4(0.0, 1.0, 0.0, 0.0)) == 2.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %28 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "buf0" + OpMemberName %9 0 "three" + OpName %11 "" + OpName %28 "_GLF_color" + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 Block + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 0 + OpDecorate %28 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpConstant %6 1 + %8 = OpConstant %6 2 + %9 = OpTypeStruct %6 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpTypePointer Uniform %6 + %17 = OpConstant %6 4 + %18 = OpTypeVector %6 4 + %20 = OpConstant %6 0 + %21 = OpConstantComposite %18 %20 %7 %20 %20 + %23 = OpTypeBool + %27 = OpTypePointer Output %18 + %28 = OpVariable %27 Output + %29 = OpConstantComposite %18 %7 %20 %20 %7 + %31 = OpConstantComposite %18 %20 %20 %20 %20 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %15 = OpAccessChain %14 %11 %13 + %16 = OpLoad %6 %15 + %19 = OpCompositeConstruct %18 %7 %8 %16 %17 + %22 = OpDot %6 %19 %21 + %24 = OpFOrdEqual %23 %22 %8 + OpSelectionMerge %26 None + OpBranchConditional %24 %25 %30 + %25 = OpLabel + OpStore %28 %29 + OpBranch %26 + %30 = OpLabel + OpStore %28 %31 + OpBranch %26 + %26 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# three +BUFFER variant_three DATA_TYPE float DATA + 3.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_three AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-dot-no-extract.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-dot-no-extract.amber new file mode 100644 index 0000000..3bbf1f6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-dot-no-extract.amber @@ -0,0 +1,128 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float three; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always true. +# if(dot(vec2(2.0, three), vec2(0.0, 2.0)) == 6.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %28 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "buf0" + OpMemberName %8 0 "three" + OpName %10 "" + OpName %28 "_GLF_color" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 0 + OpDecorate %28 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpConstant %6 2 + %8 = OpTypeStruct %6 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpTypePointer Uniform %6 + %16 = OpTypeVector %6 2 + %18 = OpConstant %6 0 + %19 = OpConstantComposite %16 %18 %7 + %21 = OpConstant %6 6 + %22 = OpTypeBool + %26 = OpTypeVector %6 4 + %27 = OpTypePointer Output %26 + %28 = OpVariable %27 Output + %29 = OpConstant %6 1 + %30 = OpConstantComposite %26 %29 %18 %18 %29 + %32 = OpConstantComposite %26 %18 %18 %18 %18 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpAccessChain %13 %10 %12 + %15 = OpLoad %6 %14 + %17 = OpCompositeConstruct %16 %7 %15 + %20 = OpDot %6 %17 %19 + %23 = OpFOrdEqual %22 %20 %21 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %31 + %24 = OpLabel + OpStore %28 %30 + OpBranch %25 + %31 = OpLabel + OpStore %28 %32 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# three +BUFFER variant_three DATA_TYPE float DATA + 3.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_three AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-add-sub.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-add-sub.amber new file mode 100644 index 0000000..c1dae78 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-add-sub.amber @@ -0,0 +1,141 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = 5; +# +# while(i >= 0) +# { +# i -= 3; +# i++; +# } +# +# // If condition is always true. +# if (i == -1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %33 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 5 + %16 = OpConstant %6 0 + %17 = OpTypeBool + %19 = OpConstant %6 3 + %23 = OpConstant %6 1 + %26 = OpConstant %6 -1 + %30 = OpTypeFloat 32 + %31 = OpTypeVector %30 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpConstant %30 1 + %35 = OpConstant %30 0 + %36 = OpConstantComposite %31 %34 %35 %35 %34 + %38 = OpConstantComposite %31 %35 %35 %35 %35 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %6 %8 + %18 = OpSGreaterThanEqual %17 %15 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %20 = OpLoad %6 %8 + %21 = OpISub %6 %20 %19 + OpStore %8 %21 + %22 = OpLoad %6 %8 + %24 = OpIAdd %6 %22 %23 + OpStore %8 %24 + OpBranch %13 + %13 = OpLabel + OpBranch %10 + %12 = OpLabel + %25 = OpLoad %6 %8 + %27 = OpIEqual %17 %25 %26 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %37 + %28 = OpLabel + OpStore %33 %36 + OpBranch %29 + %37 = OpLabel + OpStore %33 %38 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-div-mul.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-div-mul.amber new file mode 100644 index 0000000..4a4d580 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-div-mul.amber @@ -0,0 +1,138 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void main() +# { +# float f = 4.0 / (2.0 * one); +# +# // If condition is always true. +# if (f > 1.9 && f < 2.1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %11 "buf0" + OpMemberName %11 0 "one" + OpName %13 "" + OpName %33 "_GLF_color" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 4 + %10 = OpConstant %6 2 + %11 = OpTypeStruct %6 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypePointer Uniform %6 + %22 = OpConstant %6 1.89999998 + %23 = OpTypeBool + %26 = OpConstant %6 2.0999999 + %31 = OpTypeVector %6 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpConstant %6 1 + %35 = OpConstant %6 0 + %36 = OpConstantComposite %31 %34 %35 %35 %34 + %38 = OpConstantComposite %31 %35 %35 %35 %35 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %17 = OpAccessChain %16 %13 %15 + %18 = OpLoad %6 %17 + %19 = OpFMul %6 %10 %18 + %20 = OpFDiv %6 %9 %19 + OpStore %8 %20 + %21 = OpLoad %6 %8 + %24 = OpFOrdGreaterThan %23 %21 %22 + %25 = OpLoad %6 %8 + %27 = OpFOrdLessThan %23 %25 %26 + %28 = OpLogicalAnd %23 %24 %27 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %37 + %29 = OpLabel + OpStore %33 %36 + OpBranch %30 + %37 = OpLabel + OpStore %33 %38 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-divs.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-divs.amber new file mode 100644 index 0000000..0ca375c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-divs.amber @@ -0,0 +1,136 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float four; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = 2.0 / (1.0 / four); +# // If condition is always true. +# if (a > 7.9 && a < 8.1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %11 "buf0" + OpMemberName %11 0 "four" + OpName %13 "" + OpName %33 "_GLF_color" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 2 + %10 = OpConstant %6 1 + %11 = OpTypeStruct %6 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypePointer Uniform %6 + %22 = OpConstant %6 7.9000001 + %23 = OpTypeBool + %26 = OpConstant %6 8.10000038 + %31 = OpTypeVector %6 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpConstant %6 0 + %35 = OpConstantComposite %31 %10 %34 %34 %10 + %37 = OpConstantComposite %31 %34 %34 %34 %34 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %17 = OpAccessChain %16 %13 %15 + %18 = OpLoad %6 %17 + %19 = OpFDiv %6 %10 %18 + %20 = OpFDiv %6 %9 %19 + OpStore %8 %20 + %21 = OpLoad %6 %8 + %24 = OpFOrdGreaterThan %23 %21 %22 + %25 = OpLoad %6 %8 + %27 = OpFOrdLessThan %23 %25 %26 + %28 = OpLogicalAnd %23 %24 %27 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %36 + %29 = OpLabel + OpStore %33 %35 + OpBranch %30 + %36 = OpLabel + OpStore %33 %37 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# four +BUFFER variant_four DATA_TYPE float DATA + 4.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_four AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-mul-div.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-mul-div.amber new file mode 100644 index 0000000..52582f4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-mul-div.amber @@ -0,0 +1,138 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void main() +# { +# float f = 4.0 * (2.0 / one); +# +# // If condition is always true. +# if(f > 7.9 && f < 8.1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %11 "buf0" + OpMemberName %11 0 "one" + OpName %13 "" + OpName %33 "_GLF_color" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 4 + %10 = OpConstant %6 2 + %11 = OpTypeStruct %6 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypePointer Uniform %6 + %22 = OpConstant %6 7.9000001 + %23 = OpTypeBool + %26 = OpConstant %6 8.10000038 + %31 = OpTypeVector %6 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpConstant %6 1 + %35 = OpConstant %6 0 + %36 = OpConstantComposite %31 %34 %35 %35 %34 + %38 = OpConstantComposite %31 %35 %35 %35 %35 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %17 = OpAccessChain %16 %13 %15 + %18 = OpLoad %6 %17 + %19 = OpFDiv %6 %10 %18 + %20 = OpFMul %6 %9 %19 + OpStore %8 %20 + %21 = OpLoad %6 %8 + %24 = OpFOrdGreaterThan %23 %21 %22 + %25 = OpLoad %6 %8 + %27 = OpFOrdLessThan %23 %25 %26 + %28 = OpLogicalAnd %23 %24 %27 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %37 + %29 = OpLabel + OpStore %33 %36 + OpBranch %30 + %37 = OpLabel + OpStore %33 %38 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-sub-add.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-sub-add.amber new file mode 100644 index 0000000..d243038 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-sub-add.amber @@ -0,0 +1,159 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# bool b = false; +# +# // A single loop with i = 1. +# for(int i = 1; i > 0; i--) +# { +# float a = 1.0 + float(i); +# +# // If condition is always true. +# if(2.0 - a == 0.0) +# b = true; +# } +# +# // If condition is always true. +# if (b) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %44 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "b" + OpName %12 "i" + OpName %24 "a" + OpName %44 "_GLF_color" + OpDecorate %12 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %44 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeBool + %7 = OpTypePointer Function %6 + %9 = OpConstantFalse %6 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %13 = OpConstant %10 1 + %20 = OpConstant %10 0 + %22 = OpTypeFloat 32 + %23 = OpTypePointer Function %22 + %25 = OpConstant %22 1 + %29 = OpConstant %22 2 + %32 = OpConstant %22 0 + %36 = OpConstantTrue %6 + %42 = OpTypeVector %22 4 + %43 = OpTypePointer Output %42 + %44 = OpVariable %43 Output + %45 = OpConstantComposite %42 %25 %32 %32 %25 + %47 = OpConstantComposite %42 %32 %32 %32 %32 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %12 = OpVariable %11 Function + %24 = OpVariable %23 Function + OpStore %8 %9 + OpStore %12 %13 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %18 + %18 = OpLabel + %19 = OpLoad %10 %12 + %21 = OpSGreaterThan %6 %19 %20 + OpBranchConditional %21 %15 %16 + %15 = OpLabel + %26 = OpLoad %10 %12 + %27 = OpConvertSToF %22 %26 + %28 = OpFAdd %22 %25 %27 + OpStore %24 %28 + %30 = OpLoad %22 %24 + %31 = OpFSub %22 %29 %30 + %33 = OpFOrdEqual %6 %31 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %35 + %34 = OpLabel + OpStore %8 %36 + OpBranch %35 + %35 = OpLabel + OpBranch %17 + %17 = OpLabel + %37 = OpLoad %10 %12 + %38 = OpISub %10 %37 %13 + OpStore %12 %38 + OpBranch %14 + %16 = OpLabel + %39 = OpLoad %6 %8 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %46 + %40 = OpLabel + OpStore %44 %45 + OpBranch %41 + %46 = OpLabel + OpStore %44 %47 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-sub-sub.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-sub-sub.amber new file mode 100644 index 0000000..7b0a905 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-sub-sub.amber @@ -0,0 +1,160 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# bool b = false; +# +# // A single loop with i = 1. +# for(int i = 1; i > 0; i--) +# { +# float a = 3.0 - float(i); +# +# // If condition is always true. +# if(2.0 - a == 0.0) +# b = true; +# } +# +# // If condition is always true. +# if (b) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %44 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "b" + OpName %12 "i" + OpName %24 "a" + OpName %44 "_GLF_color" + OpDecorate %12 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %44 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeBool + %7 = OpTypePointer Function %6 + %9 = OpConstantFalse %6 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %13 = OpConstant %10 1 + %20 = OpConstant %10 0 + %22 = OpTypeFloat 32 + %23 = OpTypePointer Function %22 + %25 = OpConstant %22 3 + %29 = OpConstant %22 2 + %32 = OpConstant %22 0 + %36 = OpConstantTrue %6 + %42 = OpTypeVector %22 4 + %43 = OpTypePointer Output %42 + %44 = OpVariable %43 Output + %45 = OpConstant %22 1 + %46 = OpConstantComposite %42 %45 %32 %32 %45 + %48 = OpConstantComposite %42 %32 %32 %32 %32 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %12 = OpVariable %11 Function + %24 = OpVariable %23 Function + OpStore %8 %9 + OpStore %12 %13 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %18 + %18 = OpLabel + %19 = OpLoad %10 %12 + %21 = OpSGreaterThan %6 %19 %20 + OpBranchConditional %21 %15 %16 + %15 = OpLabel + %26 = OpLoad %10 %12 + %27 = OpConvertSToF %22 %26 + %28 = OpFSub %22 %25 %27 + OpStore %24 %28 + %30 = OpLoad %22 %24 + %31 = OpFSub %22 %29 %30 + %33 = OpFOrdEqual %6 %31 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %35 + %34 = OpLabel + OpStore %8 %36 + OpBranch %35 + %35 = OpLabel + OpBranch %17 + %17 = OpLabel + %37 = OpLoad %10 %12 + %38 = OpISub %10 %37 %13 + OpStore %12 %38 + OpBranch %14 + %16 = OpLabel + %39 = OpLoad %6 %8 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %47 + %40 = OpLabel + OpStore %44 %46 + OpBranch %41 + %47 = OpLabel + OpStore %44 %48 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-var-sub.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-var-sub.amber new file mode 100644 index 0000000..2e4891b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-var-sub.amber @@ -0,0 +1,156 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int five; +# }; +# +# void main() +# { +# int i = five; +# +# while(i > 0) +# { +# i--; +# i--; +# } +# +# if (i == -1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %37 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %9 "buf0" + OpMemberName %9 0 "five" + OpName %11 "" + OpName %37 "_GLF_color" + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 Block + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 0 + OpDecorate %37 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeStruct %6 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpConstant %6 0 + %13 = OpTypePointer Uniform %6 + %22 = OpTypeBool + %25 = OpConstant %6 1 + %30 = OpConstant %6 -1 + %34 = OpTypeFloat 32 + %35 = OpTypeVector %34 4 + %36 = OpTypePointer Output %35 + %37 = OpVariable %36 Output + %38 = OpConstant %34 1 + %39 = OpConstant %34 0 + %40 = OpConstantComposite %35 %38 %39 %39 %38 + %42 = OpConstantComposite %35 %39 %39 %39 %39 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %14 = OpAccessChain %13 %11 %12 + %15 = OpLoad %6 %14 + OpStore %8 %15 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %21 = OpLoad %6 %8 + %23 = OpSGreaterThan %22 %21 %12 + OpBranchConditional %23 %17 %18 + %17 = OpLabel + %24 = OpLoad %6 %8 + %26 = OpISub %6 %24 %25 + OpStore %8 %26 + %27 = OpLoad %6 %8 + %28 = OpISub %6 %27 %25 + OpStore %8 %28 + OpBranch %19 + %19 = OpLabel + OpBranch %16 + %18 = OpLabel + %29 = OpLoad %6 %8 + %31 = OpIEqual %22 %29 %30 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %41 + %32 = OpLabel + OpStore %37 %40 + OpBranch %33 + %41 = OpLabel + OpStore %37 %42 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# five +BUFFER variant_five DATA_TYPE int32 DATA + 5 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_five AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-mix-uniform-weight.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-mix-uniform-weight.amber new file mode 100644 index 0000000..61365df --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-mix-uniform-weight.amber @@ -0,0 +1,152 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void main() +# { +# // This selects the second vector because one == 1. +# vec3 v = mix(vec3(5, 8, -12.2), vec3(1, 4.9, -2.1), one); +# +# float d = distance(v, vec3(1, 4.9, -2.1)); +# +# if (d < 0.1) +# _GLF_color = vec4(v.x, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %40 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v" + OpName %18 "buf0" + OpMemberName %18 0 "one" + OpName %20 "" + OpName %29 "d" + OpName %40 "_GLF_color" + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %40 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 5 + %11 = OpConstant %6 8 + %12 = OpConstant %6 -12.1999998 + %13 = OpConstantComposite %7 %10 %11 %12 + %14 = OpConstant %6 1 + %15 = OpConstant %6 4.9000001 + %16 = OpConstant %6 -2.0999999 + %17 = OpConstantComposite %7 %14 %15 %16 + %18 = OpTypeStruct %6 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypeInt 32 1 + %22 = OpConstant %21 0 + %23 = OpTypePointer Uniform %6 + %28 = OpTypePointer Function %6 + %33 = OpConstant %6 0.100000001 + %34 = OpTypeBool + %38 = OpTypeVector %6 4 + %39 = OpTypePointer Output %38 + %40 = OpVariable %39 Output + %41 = OpTypeInt 32 0 + %42 = OpConstant %41 0 + %45 = OpConstant %6 0 + %48 = OpConstantComposite %38 %45 %45 %45 %45 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %29 = OpVariable %28 Function + %24 = OpAccessChain %23 %20 %22 + %25 = OpLoad %6 %24 + %26 = OpCompositeConstruct %7 %25 %25 %25 + %27 = OpExtInst %7 %1 FMix %13 %17 %26 + OpStore %9 %27 + %30 = OpLoad %7 %9 + %31 = OpExtInst %6 %1 Distance %30 %17 + OpStore %29 %31 + %32 = OpLoad %6 %29 + %35 = OpFOrdLessThan %34 %32 %33 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %47 + %36 = OpLabel + %43 = OpAccessChain %28 %9 %42 + %44 = OpLoad %6 %43 + %46 = OpCompositeConstruct %38 %44 %45 %45 %14 + OpStore %40 %46 + OpBranch %37 + %47 = OpLabel + OpStore %40 %48 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-negate-div.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-negate-div.amber new file mode 100644 index 0000000..929df34 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-negate-div.amber @@ -0,0 +1,130 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int four; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // If condition is always true. +# if(-(four / 2) == -2) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 31 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %25 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "buf0" + OpMemberName %7 0 "four" + OpName %9 "" + OpName %25 "_GLF_color" + OpMemberDecorate %7 0 RelaxedPrecision + OpMemberDecorate %7 0 Offset 0 + OpDecorate %7 Block + OpDecorate %9 DescriptorSet 0 + OpDecorate %9 Binding 0 + OpDecorate %13 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %25 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Uniform %7 + %9 = OpVariable %8 Uniform + %10 = OpConstant %6 0 + %11 = OpTypePointer Uniform %6 + %14 = OpConstant %6 2 + %17 = OpConstant %6 -2 + %18 = OpTypeBool + %22 = OpTypeFloat 32 + %23 = OpTypeVector %22 4 + %24 = OpTypePointer Output %23 + %25 = OpVariable %24 Output + %26 = OpConstant %22 1 + %27 = OpConstant %22 0 + %28 = OpConstantComposite %23 %26 %27 %27 %26 + %30 = OpConstantComposite %23 %27 %27 %27 %27 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpAccessChain %11 %9 %10 + %13 = OpLoad %6 %12 + %15 = OpSDiv %6 %13 %14 + %16 = OpSNegate %6 %15 + %19 = OpIEqual %18 %16 %17 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %29 + %20 = OpLabel + OpStore %25 %28 + OpBranch %21 + %29 = OpLabel + OpStore %25 %30 + OpBranch %21 + %21 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# four +BUFFER variant_four DATA_TYPE int32 DATA + 4 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_four AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-negate-sub.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-negate-sub.amber new file mode 100644 index 0000000..e63f60e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-negate-sub.amber @@ -0,0 +1,134 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# void main() +# { +# int x = -(5 - one); +# +# if (x == -4) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %28 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + OpName %10 "buf0" + OpMemberName %10 0 "one" + OpName %12 "" + OpName %28 "_GLF_color" + OpMemberDecorate %10 0 Offset 0 + OpDecorate %10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %28 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 5 + %10 = OpTypeStruct %6 + %11 = OpTypePointer Uniform %10 + %12 = OpVariable %11 Uniform + %13 = OpConstant %6 0 + %14 = OpTypePointer Uniform %6 + %20 = OpConstant %6 -4 + %21 = OpTypeBool + %25 = OpTypeFloat 32 + %26 = OpTypeVector %25 4 + %27 = OpTypePointer Output %26 + %28 = OpVariable %27 Output + %29 = OpConstant %25 1 + %30 = OpConstant %25 0 + %31 = OpConstantComposite %26 %29 %30 %30 %29 + %33 = OpConstantComposite %26 %30 %30 %30 %30 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %15 = OpAccessChain %14 %12 %13 + %16 = OpLoad %6 %15 + %17 = OpISub %6 %9 %16 + %18 = OpSNegate %6 %17 + OpStore %8 %18 + %19 = OpLoad %6 %8 + %22 = OpIEqual %21 %19 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %32 + %23 = OpLabel + OpStore %28 %31 + OpBranch %24 + %32 = OpLabel + OpStore %28 %33 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-redundant-mix.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-redundant-mix.amber new file mode 100644 index 0000000..3928b6a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-redundant-mix.amber @@ -0,0 +1,129 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always true. +# if(mix(injectionSwitch, vec2(1), vec2(0)) == vec2(0, 1)) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %30 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "buf0" + OpMemberName %8 0 "injectionSwitch" + OpName %10 "" + OpName %30 "_GLF_color" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 0 + OpDecorate %30 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeStruct %7 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpTypePointer Uniform %7 + %16 = OpConstant %6 1 + %17 = OpConstantComposite %7 %16 %16 + %18 = OpConstant %6 0 + %19 = OpConstantComposite %7 %18 %18 + %21 = OpConstantComposite %7 %18 %16 + %22 = OpTypeBool + %23 = OpTypeVector %22 2 + %28 = OpTypeVector %6 4 + %29 = OpTypePointer Output %28 + %30 = OpVariable %29 Output + %31 = OpConstantComposite %28 %16 %18 %18 %16 + %33 = OpConstantComposite %28 %18 %18 %18 %18 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpAccessChain %13 %10 %12 + %15 = OpLoad %7 %14 + %20 = OpExtInst %7 %1 FMix %15 %17 %19 + %24 = OpFOrdEqual %23 %20 %21 + %25 = OpAll %22 %24 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %32 + %26 = OpLabel + OpStore %30 %31 + OpBranch %27 + %32 = OpLabel + OpStore %30 %33 + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-shuffle-extract.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-shuffle-extract.amber new file mode 100644 index 0000000..a2cca84 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-shuffle-extract.amber @@ -0,0 +1,131 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always true. +# if(mix(injectionSwitch, vec2(1), bvec2(false)).x == 0.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %32 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "buf0" + OpMemberName %8 0 "injectionSwitch" + OpName %10 "" + OpName %32 "_GLF_color" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 0 + OpDecorate %32 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeStruct %7 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpTypePointer Uniform %7 + %16 = OpConstant %6 1 + %17 = OpConstantComposite %7 %16 %16 + %18 = OpTypeBool + %19 = OpTypeVector %18 2 + %20 = OpConstantFalse %18 + %21 = OpConstantComposite %19 %20 %20 + %23 = OpTypeInt 32 0 + %24 = OpConstant %23 0 + %26 = OpConstant %6 0 + %30 = OpTypeVector %6 4 + %31 = OpTypePointer Output %30 + %32 = OpVariable %31 Output + %33 = OpConstantComposite %30 %16 %26 %26 %16 + %35 = OpConstantComposite %30 %26 %26 %26 %26 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpAccessChain %13 %10 %12 + %15 = OpLoad %7 %14 + %22 = OpSelect %7 %21 %17 %15 + %25 = OpCompositeExtract %6 %22 0 + %27 = OpFOrdEqual %18 %25 %26 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %34 + %28 = OpLabel + OpStore %32 %33 + OpBranch %29 + %34 = OpLabel + OpStore %32 %35 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-shuffle-mix.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-shuffle-mix.amber new file mode 100644 index 0000000..ac90e37 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-shuffle-mix.amber @@ -0,0 +1,151 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 threeandfour; // (3.0, 4.0) +# }; +# +# void main() +# { +# vec4 v = vec4(2, 3, 4, 5); +# // mix returns (1.0, 6.0) +# v.xy = mix(vec2(2, 6), vec2(1.0, threeandfour.y), bvec2(true, false)); +# if (v == vec4(1, 6, 4, 5)) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v" + OpName %19 "buf0" + OpMemberName %19 0 "threeandfour" + OpName %21 "" + OpName %46 "_GLF_color" + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 0 + OpDecorate %46 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 2 + %11 = OpConstant %6 3 + %12 = OpConstant %6 4 + %13 = OpConstant %6 5 + %14 = OpConstantComposite %7 %10 %11 %12 %13 + %15 = OpTypeVector %6 2 + %16 = OpConstant %6 6 + %17 = OpConstantComposite %15 %10 %16 + %18 = OpConstant %6 1 + %19 = OpTypeStruct %15 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpTypeInt 32 1 + %23 = OpConstant %22 0 + %24 = OpTypeInt 32 0 + %25 = OpConstant %24 1 + %26 = OpTypePointer Uniform %6 + %30 = OpTypeBool + %31 = OpTypeVector %30 2 + %32 = OpConstantTrue %30 + %33 = OpConstantFalse %30 + %34 = OpConstantComposite %31 %32 %33 + %39 = OpConstantComposite %7 %18 %16 %12 %13 + %40 = OpTypeVector %30 4 + %45 = OpTypePointer Output %7 + %46 = OpVariable %45 Output + %47 = OpConstant %6 0 + %48 = OpConstantComposite %7 %18 %47 %47 %18 + %50 = OpConstantComposite %7 %47 %47 %47 %47 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + OpStore %9 %14 + %27 = OpAccessChain %26 %21 %23 %25 + %28 = OpLoad %6 %27 + %29 = OpCompositeConstruct %15 %18 %28 + %35 = OpSelect %15 %34 %29 %17 + %36 = OpLoad %7 %9 + %37 = OpVectorShuffle %7 %36 %35 4 5 2 3 + OpStore %9 %37 + %38 = OpLoad %7 %9 + %41 = OpFOrdEqual %40 %38 %39 + %42 = OpAll %30 %41 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %49 + %43 = OpLabel + OpStore %46 %48 + OpBranch %44 + %49 = OpLabel + OpStore %46 %50 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# threeandfour +BUFFER variant_threeandfour DATA_TYPE vec2 DATA + 3.0 4.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_threeandfour AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-split-vector-init.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-split-vector-init.amber new file mode 100644 index 0000000..b20a9cc --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-split-vector-init.amber @@ -0,0 +1,116 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v; +# v.xy = vec2(1); +# v.zw = vec2(2); +# // Always true. +# if (v == vec4(1, 1, 2, 2)) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %28 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v" + OpName %28 "_GLF_color" + OpDecorate %28 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 2 + %11 = OpConstant %6 1 + %12 = OpConstantComposite %10 %11 %11 + %15 = OpConstant %6 2 + %16 = OpConstantComposite %10 %15 %15 + %20 = OpConstantComposite %7 %11 %11 %15 %15 + %21 = OpTypeBool + %22 = OpTypeVector %21 4 + %27 = OpTypePointer Output %7 + %28 = OpVariable %27 Output + %29 = OpConstant %6 0 + %30 = OpConstantComposite %7 %11 %29 %29 %11 + %32 = OpConstantComposite %7 %29 %29 %29 %29 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %13 = OpLoad %7 %9 + %14 = OpVectorShuffle %7 %13 %12 4 5 2 3 + OpStore %9 %14 + %17 = OpLoad %7 %9 + %18 = OpVectorShuffle %7 %17 %16 0 1 4 5 + OpStore %9 %18 + %19 = OpLoad %7 %9 + %23 = OpFOrdEqual %22 %19 %20 + %24 = OpAll %21 %23 + OpSelectionMerge %26 None + OpBranchConditional %24 %25 %31 + %25 = OpLabel + OpStore %28 %30 + OpBranch %26 + %31 = OpLabel + OpStore %28 %32 + OpBranch %26 + %26 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-folding-rules-vec-mix-uniform.amber b/vulkan/amber/graphicsfuzz/cov-folding-rules-vec-mix-uniform.amber new file mode 100644 index 0000000..8fe1dbf --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-folding-rules-vec-mix-uniform.amber @@ -0,0 +1,155 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 zeroOne; +# }; +# +# void main() +# { +# // Since zeroOne is (0, 1) the results will be (2, 5). +# vec2 v = mix(vec2(2, 3), vec2(4, 5), zeroOne); +# float d = distance(v, vec2(2, 5)); +# +# if (d < 0.1) +# _GLF_color = vec4(v.x - 1.0, v.y - 5.0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %38 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v" + OpName %16 "buf0" + OpMemberName %16 0 "zeroOne" + OpName %18 "" + OpName %26 "d" + OpName %38 "_GLF_color" + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %38 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 2 + %11 = OpConstant %6 3 + %12 = OpConstantComposite %7 %10 %11 + %13 = OpConstant %6 4 + %14 = OpConstant %6 5 + %15 = OpConstantComposite %7 %13 %14 + %16 = OpTypeStruct %7 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpTypeInt 32 1 + %20 = OpConstant %19 0 + %21 = OpTypePointer Uniform %7 + %25 = OpTypePointer Function %6 + %28 = OpConstantComposite %7 %10 %14 + %31 = OpConstant %6 0.100000001 + %32 = OpTypeBool + %36 = OpTypeVector %6 4 + %37 = OpTypePointer Output %36 + %38 = OpVariable %37 Output + %39 = OpTypeInt 32 0 + %40 = OpConstant %39 0 + %43 = OpConstant %6 1 + %45 = OpConstant %39 1 + %49 = OpConstant %6 0 + %52 = OpConstantComposite %36 %49 %49 %49 %49 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %26 = OpVariable %25 Function + %22 = OpAccessChain %21 %18 %20 + %23 = OpLoad %7 %22 + %24 = OpExtInst %7 %1 FMix %12 %15 %23 + OpStore %9 %24 + %27 = OpLoad %7 %9 + %29 = OpExtInst %6 %1 Distance %27 %28 + OpStore %26 %29 + %30 = OpLoad %6 %26 + %33 = OpFOrdLessThan %32 %30 %31 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %51 + %34 = OpLabel + %41 = OpAccessChain %25 %9 %40 + %42 = OpLoad %6 %41 + %44 = OpFSub %6 %42 %43 + %46 = OpAccessChain %25 %9 %45 + %47 = OpLoad %6 %46 + %48 = OpFSub %6 %47 %14 + %50 = OpCompositeConstruct %36 %44 %48 %49 %43 + OpStore %38 %50 + OpBranch %35 + %51 = OpLabel + OpStore %38 %52 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zeroOne +BUFFER variant_zeroOne DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zeroOne AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-for-array-initializing-modulo.amber b/vulkan/amber/graphicsfuzz/cov-for-array-initializing-modulo.amber new file mode 100644 index 0000000..a6ca255 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-for-array-initializing-modulo.amber @@ -0,0 +1,185 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine compares code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [10, 0, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a[2]; +# for (int i = _int_1; i < _int_10; i++) +# { +# // a becomes [0, 1]. +# a = int[2](_int_0, (i % ivec2(3, _int_2))[1]); +# } +# +# _GLF_color = vec4(a[_int_1], _int_0, _int_0, a[_int_1]); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %53 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %33 "a" + OpName %53 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %53 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %28 = OpTypeBool + %30 = OpConstant %9 2 + %31 = OpTypeArray %6 %30 + %32 = OpTypePointer Function %31 + %34 = OpConstant %6 1 + %38 = OpConstant %6 3 + %41 = OpTypeVector %6 2 + %45 = OpConstant %9 1 + %50 = OpTypeFloat 32 + %51 = OpTypeVector %50 4 + %52 = OpTypePointer Output %51 + %53 = OpVariable %52 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %33 = OpVariable %32 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %6 %8 + %26 = OpAccessChain %17 %14 %15 %15 + %27 = OpLoad %6 %26 + %29 = OpSLessThan %28 %25 %27 + OpBranchConditional %29 %21 %22 + %21 = OpLabel + %35 = OpAccessChain %17 %14 %15 %34 + %36 = OpLoad %6 %35 + %37 = OpLoad %6 %8 + %39 = OpAccessChain %17 %14 %15 %38 + %40 = OpLoad %6 %39 + %42 = OpCompositeConstruct %41 %38 %40 + %43 = OpCompositeConstruct %41 %37 %37 + %44 = OpSMod %41 %43 %42 + %46 = OpCompositeExtract %6 %44 1 + %47 = OpCompositeConstruct %31 %36 %46 + OpStore %33 %47 + OpBranch %23 + %23 = OpLabel + %48 = OpLoad %6 %8 + %49 = OpIAdd %6 %48 %34 + OpStore %8 %49 + OpBranch %20 + %22 = OpLabel + %54 = OpAccessChain %17 %14 %15 %16 + %55 = OpLoad %6 %54 + %56 = OpAccessChain %7 %33 %55 + %57 = OpLoad %6 %56 + %58 = OpConvertSToF %50 %57 + %59 = OpAccessChain %17 %14 %15 %34 + %60 = OpLoad %6 %59 + %61 = OpConvertSToF %50 %60 + %62 = OpAccessChain %17 %14 %15 %34 + %63 = OpLoad %6 %62 + %64 = OpConvertSToF %50 %63 + %65 = OpAccessChain %17 %14 %15 %16 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %7 %33 %66 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %50 %68 + %70 = OpCompositeConstruct %51 %58 %61 %64 %69 + OpStore %53 %70 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 0 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-for-loop-condition-one-shift-right-integer-comparison-break.amber b/vulkan/amber/graphicsfuzz/cov-for-loop-condition-one-shift-right-integer-comparison-break.amber new file mode 100644 index 0000000..d1923f1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-for-loop-condition-one-shift-right-integer-comparison-break.amber @@ -0,0 +1,209 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_5 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 5, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# // Loops three time until breaks. +# for(int i = -_int_5; i < (_int_1 >> _int_1); i++) +# { +# if(a >= 2) +# { +# break; +# } +# a++; +# } +# +# // Always true. +# if(a == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 76 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %57 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %57 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %57 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %6 2 + %36 = OpTypeBool + %48 = OpConstant %6 3 + %54 = OpTypeFloat 32 + %55 = OpTypeVector %54 4 + %56 = OpTypePointer Output %55 + %57 = OpVariable %56 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %22 = OpAccessChain %17 %14 %15 %21 + %23 = OpLoad %6 %22 + %24 = OpSNegate %6 %23 + OpStore %20 %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %6 %20 + %31 = OpAccessChain %17 %14 %15 %15 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %17 %14 %15 %15 + %34 = OpLoad %6 %33 + %35 = OpShiftRightArithmetic %6 %32 %34 + %37 = OpSLessThan %36 %30 %35 + OpBranchConditional %37 %26 %27 + %26 = OpLabel + %38 = OpLoad %6 %8 + %39 = OpSGreaterThanEqual %36 %38 %21 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %41 + %40 = OpLabel + OpBranch %27 + %41 = OpLabel + %43 = OpLoad %6 %8 + %44 = OpIAdd %6 %43 %16 + OpStore %8 %44 + OpBranch %28 + %28 = OpLabel + %45 = OpLoad %6 %20 + %46 = OpIAdd %6 %45 %16 + OpStore %20 %46 + OpBranch %25 + %27 = OpLabel + %47 = OpLoad %6 %8 + %49 = OpAccessChain %17 %14 %15 %48 + %50 = OpLoad %6 %49 + %51 = OpIEqual %36 %47 %50 + OpSelectionMerge %53 None + OpBranchConditional %51 %52 %71 + %52 = OpLabel + %58 = OpAccessChain %17 %14 %15 %15 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %54 %59 + %61 = OpAccessChain %17 %14 %15 %16 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %54 %62 + %64 = OpAccessChain %17 %14 %15 %16 + %65 = OpLoad %6 %64 + %66 = OpConvertSToF %54 %65 + %67 = OpAccessChain %17 %14 %15 %15 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %54 %68 + %70 = OpCompositeConstruct %55 %60 %63 %66 %69 + OpStore %57 %70 + OpBranch %53 + %71 = OpLabel + %72 = OpAccessChain %17 %14 %15 %16 + %73 = OpLoad %6 %72 + %74 = OpConvertSToF %54 %73 + %75 = OpCompositeConstruct %55 %74 %74 %74 %74 + OpStore %57 %75 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 5 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-for-loop-min-increment-array-element.amber b/vulkan/amber/graphicsfuzz/cov-for-loop-min-increment-array-element.amber new file mode 100644 index 0000000..240da48 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-for-loop-min-increment-array-element.amber @@ -0,0 +1,236 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_2_0 _GLF_uniform_float_values[1] +# #define _float_3_0 _GLF_uniform_float_values[2] +# #define _float_4_0 _GLF_uniform_float_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 2.0, 3.0, 4.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[4]; +# }; +# // Contents of _GLF_uniform_int_values: [0, 1, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float arr[3] = float[3](_float_1_0, _float_2_0, _float_3_0); +# +# for (int i = 1; i < min(_int_2, 3); i++) +# { +# arr[_int_2] += _float_1_0; +# } +# +# if(arr[_int_2] == _float_4_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 89 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %70 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %30 "i" + OpName %38 "buf1" + OpMemberName %38 0 "_GLF_uniform_int_values" + OpName %40 "" + OpName %70 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %37 ArrayStride 16 + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 1 + OpDecorate %70 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 3 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 4 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %17 1 + %25 = OpConstant %17 2 + %29 = OpTypePointer Function %17 + %37 = OpTypeArray %17 %8 + %38 = OpTypeStruct %37 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %41 = OpTypePointer Uniform %17 + %44 = OpConstant %17 3 + %46 = OpTypeBool + %52 = OpTypePointer Function %6 + %68 = OpTypeVector %6 4 + %69 = OpTypePointer Output %68 + %70 = OpVariable %69 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %30 = OpVariable %29 Function + %20 = OpAccessChain %19 %16 %18 %18 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %19 %16 %18 %22 + %24 = OpLoad %6 %23 + %26 = OpAccessChain %19 %16 %18 %25 + %27 = OpLoad %6 %26 + %28 = OpCompositeConstruct %9 %21 %24 %27 + OpStore %11 %28 + OpStore %30 %22 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %17 %30 + %42 = OpAccessChain %41 %40 %18 %25 + %43 = OpLoad %17 %42 + %45 = OpExtInst %17 %1 SMin %43 %44 + %47 = OpSLessThan %46 %36 %45 + OpBranchConditional %47 %32 %33 + %32 = OpLabel + %48 = OpAccessChain %41 %40 %18 %25 + %49 = OpLoad %17 %48 + %50 = OpAccessChain %19 %16 %18 %18 + %51 = OpLoad %6 %50 + %53 = OpAccessChain %52 %11 %49 + %54 = OpLoad %6 %53 + %55 = OpFAdd %6 %54 %51 + %56 = OpAccessChain %52 %11 %49 + OpStore %56 %55 + OpBranch %34 + %34 = OpLabel + %57 = OpLoad %17 %30 + %58 = OpIAdd %17 %57 %22 + OpStore %30 %58 + OpBranch %31 + %33 = OpLabel + %59 = OpAccessChain %41 %40 %18 %25 + %60 = OpLoad %17 %59 + %61 = OpAccessChain %52 %11 %60 + %62 = OpLoad %6 %61 + %63 = OpAccessChain %19 %16 %18 %44 + %64 = OpLoad %6 %63 + %65 = OpFOrdEqual %46 %62 %64 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %84 + %66 = OpLabel + %71 = OpAccessChain %41 %40 %18 %22 + %72 = OpLoad %17 %71 + %73 = OpConvertSToF %6 %72 + %74 = OpAccessChain %41 %40 %18 %18 + %75 = OpLoad %17 %74 + %76 = OpConvertSToF %6 %75 + %77 = OpAccessChain %41 %40 %18 %18 + %78 = OpLoad %17 %77 + %79 = OpConvertSToF %6 %78 + %80 = OpAccessChain %41 %40 %18 %22 + %81 = OpLoad %17 %80 + %82 = OpConvertSToF %6 %81 + %83 = OpCompositeConstruct %68 %73 %76 %79 %82 + OpStore %70 %83 + OpBranch %67 + %84 = OpLabel + %85 = OpAccessChain %41 %40 %18 %18 + %86 = OpLoad %17 %85 + %87 = OpConvertSToF %6 %86 + %88 = OpCompositeConstruct %68 %87 %87 %87 %87 + OpStore %70 %88 + OpBranch %67 + %67 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 2.0 3.0 4.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-for-loop-start-negative-increment-variable.amber b/vulkan/amber/graphicsfuzz/cov-for-loop-start-negative-increment-variable.amber new file mode 100644 index 0000000..a7b6bb8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-for-loop-start-negative-increment-variable.amber @@ -0,0 +1,244 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of one: 1 +# layout(push_constant) uniform buf_push +# { +# int one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1; +# int b = _int_0; +# +# for(b = -1; b <= one; b++) +# { +# while(a >= _int_0) +# { +# a--; +# } +# } +# +# // Always true. +# if(a == -_int_1 && b == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 88 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %69 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %19 "b" + OpName %30 "buf_push" + OpMemberName %30 0 "one" + OpName %32 "" + OpName %69 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %69 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %6 + %20 = OpConstant %6 1 + %23 = OpConstant %6 -1 + %30 = OpTypeStruct %6 + %31 = OpTypePointer PushConstant %30 + %32 = OpVariable %31 PushConstant + %33 = OpTypePointer PushConstant %6 + %36 = OpTypeBool + %59 = OpConstant %6 2 + %66 = OpTypeFloat 32 + %67 = OpTypeVector %66 4 + %68 = OpTypePointer Output %67 + %69 = OpVariable %68 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %17 = OpAccessChain %16 %14 %15 %15 + %18 = OpLoad %6 %17 + OpStore %8 %18 + %21 = OpAccessChain %16 %14 %15 %20 + %22 = OpLoad %6 %21 + OpStore %19 %22 + OpStore %19 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %19 + %34 = OpAccessChain %33 %32 %15 + %35 = OpLoad %6 %34 + %37 = OpSLessThanEqual %36 %29 %35 + OpBranchConditional %37 %25 %26 + %25 = OpLabel + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %6 %8 + %44 = OpAccessChain %16 %14 %15 %20 + %45 = OpLoad %6 %44 + %46 = OpSGreaterThanEqual %36 %43 %45 + OpBranchConditional %46 %39 %40 + %39 = OpLabel + %47 = OpLoad %6 %8 + %48 = OpISub %6 %47 %20 + OpStore %8 %48 + OpBranch %41 + %41 = OpLabel + OpBranch %38 + %40 = OpLabel + OpBranch %27 + %27 = OpLabel + %49 = OpLoad %6 %19 + %50 = OpIAdd %6 %49 %20 + OpStore %19 %50 + OpBranch %24 + %26 = OpLabel + %51 = OpLoad %6 %8 + %52 = OpAccessChain %16 %14 %15 %15 + %53 = OpLoad %6 %52 + %54 = OpSNegate %6 %53 + %55 = OpIEqual %36 %51 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %57 + %56 = OpLabel + %58 = OpLoad %6 %19 + %60 = OpAccessChain %16 %14 %15 %59 + %61 = OpLoad %6 %60 + %62 = OpIEqual %36 %58 %61 + OpBranch %57 + %57 = OpLabel + %63 = OpPhi %36 %55 %26 %62 %56 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %83 + %64 = OpLabel + %70 = OpAccessChain %16 %14 %15 %15 + %71 = OpLoad %6 %70 + %72 = OpConvertSToF %66 %71 + %73 = OpAccessChain %16 %14 %15 %20 + %74 = OpLoad %6 %73 + %75 = OpConvertSToF %66 %74 + %76 = OpAccessChain %16 %14 %15 %20 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %66 %77 + %79 = OpAccessChain %16 %14 %15 %15 + %80 = OpLoad %6 %79 + %81 = OpConvertSToF %66 %80 + %82 = OpCompositeConstruct %67 %72 %75 %78 %81 + OpStore %69 %82 + OpBranch %65 + %83 = OpLabel + %84 = OpAccessChain %16 %14 %15 %20 + %85 = OpLoad %6 %84 + %86 = OpConvertSToF %66 %85 + %87 = OpCompositeConstruct %67 %86 %86 %86 %86 + OpStore %69 %87 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 STD140 DATA + 1 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-for-loop-struct-as-iterator.amber b/vulkan/amber/graphicsfuzz/cov-for-loop-struct-as-iterator.amber new file mode 100644 index 0000000..457c590 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-for-loop-struct-as-iterator.amber @@ -0,0 +1,226 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-local-multi-store' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--reduce-load-size' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--if-conversion' +# '--simplify-instructions' +# '--ccp' +# '--vector-dce' +# '--vector-dce' +# '--eliminate-dead-code-aggressive' +# '--redundancy-elimination' +# '--eliminate-local-multi-store' +# '--eliminate-dead-branches' +# '--eliminate-local-single-store' +# '--private-to-local' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-branches' +# '--merge-blocks' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_5 _GLF_uniform_int_values[0] +# #define _int_4 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [5, 4, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# struct S +# { +# int i; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1; +# +# for(S s = S(0); s.i < _int_5; s.i++) +# { +# if(a > 3) +# { +# break; +# } +# a++; +# } +# +# if(a == _int_4) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 82 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %56 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "S" + OpMemberName %20 0 "i" + OpName %22 "s" + OpName %56 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %56 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %20 = OpTypeStruct %6 + %21 = OpTypePointer Function %20 + %23 = OpConstantComposite %20 %15 + %33 = OpTypeBool + %36 = OpConstant %6 3 + %42 = OpConstant %6 1 + %53 = OpTypeFloat 32 + %54 = OpTypeVector %53 4 + %55 = OpTypePointer Output %54 + %56 = OpVariable %55 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %22 = OpVariable %21 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %22 %23 + OpBranch %24 + %24 = OpLabel + %81 = OpPhi %20 %23 %5 %80 %27 + %75 = OpPhi %6 %19 %5 %43 %27 + %30 = OpCompositeExtract %6 %81 0 + %31 = OpAccessChain %17 %14 %15 %15 + %32 = OpLoad %6 %31 + %34 = OpSLessThan %33 %30 %32 + OpLoopMerge %26 %27 None + OpBranchConditional %34 %25 %26 + %25 = OpLabel + %37 = OpSGreaterThan %33 %75 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + OpBranch %26 + %39 = OpLabel + %43 = OpIAdd %6 %75 %42 + OpBranch %27 + %27 = OpLabel + %45 = OpCompositeExtract %6 %81 0 + %46 = OpIAdd %6 %45 %42 + %80 = OpCompositeInsert %20 %46 %81 0 + OpStore %22 %80 + OpBranch %24 + %26 = OpLabel + %48 = OpAccessChain %17 %14 %15 %42 + %49 = OpLoad %6 %48 + %50 = OpIEqual %33 %75 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %70 + %51 = OpLabel + %59 = OpConvertSToF %53 %19 + %60 = OpAccessChain %17 %14 %15 %36 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %53 %61 + %69 = OpCompositeConstruct %54 %59 %62 %62 %59 + OpStore %56 %69 + OpBranch %52 + %70 = OpLabel + %71 = OpAccessChain %17 %14 %15 %36 + %72 = OpLoad %6 %71 + %73 = OpConvertSToF %53 %72 + %74 = OpCompositeConstruct %54 %73 %73 %73 %73 + OpStore %56 %74 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 5 4 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-for-switch-fallthrough.amber b/vulkan/amber/graphicsfuzz/cov-for-switch-fallthrough.amber new file mode 100644 index 0000000..b88e7d1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-for-switch-fallthrough.amber @@ -0,0 +1,203 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine and or xor code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [10, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# for (int i = _int_0; i < _int_10; i++) +# { +# switch (i) +# { +# case -1: +# case 0: +# a = _int_1; +# } +# } +# +# if (a == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 70 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %51 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %51 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %51 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %31 = OpTypeBool + %36 = OpConstant %6 1 + %48 = OpTypeFloat 32 + %49 = OpTypeVector %48 4 + %50 = OpTypePointer Output %49 + %51 = OpVariable %50 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %21 = OpAccessChain %17 %14 %15 %16 + %22 = OpLoad %6 %21 + OpStore %20 %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %6 %20 + %29 = OpAccessChain %17 %14 %15 %15 + %30 = OpLoad %6 %29 + %32 = OpSLessThan %31 %28 %30 + OpBranchConditional %32 %24 %25 + %24 = OpLabel + %33 = OpLoad %6 %20 + OpSelectionMerge %35 None + OpSwitch %33 %35 -1 %34 0 %34 + %34 = OpLabel + %37 = OpAccessChain %17 %14 %15 %36 + %38 = OpLoad %6 %37 + OpStore %8 %38 + OpBranch %35 + %35 = OpLabel + OpBranch %26 + %26 = OpLabel + %40 = OpLoad %6 %20 + %41 = OpIAdd %6 %40 %36 + OpStore %20 %41 + OpBranch %23 + %25 = OpLabel + %42 = OpLoad %6 %8 + %43 = OpAccessChain %17 %14 %15 %36 + %44 = OpLoad %6 %43 + %45 = OpIEqual %31 %42 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %65 + %46 = OpLabel + %52 = OpAccessChain %17 %14 %15 %36 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %48 %53 + %55 = OpAccessChain %17 %14 %15 %16 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %48 %56 + %58 = OpAccessChain %17 %14 %15 %16 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %48 %59 + %61 = OpAccessChain %17 %14 %15 %36 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %48 %62 + %64 = OpCompositeConstruct %49 %54 %57 %60 %63 + OpStore %51 %64 + OpBranch %47 + %65 = OpLabel + %66 = OpAccessChain %17 %14 %15 %16 + %67 = OpLoad %6 %66 + %68 = OpConvertSToF %48 %67 + %69 = OpCompositeConstruct %49 %68 %68 %68 %68 + OpStore %51 %69 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fract-asin-undefined-never-used.amber b/vulkan/amber/graphicsfuzz/cov-fract-asin-undefined-never-used.amber new file mode 100644 index 0000000..fd0c644 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fract-asin-undefined-never-used.amber @@ -0,0 +1,202 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // The result of asin is undefined. +# float f0 = asin(2.0); +# float f1 = fract(f0); +# +# // Always true. +# if(gl_FragCoord.x > _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# // f1 is undefined, but this branch is never executed. +# _GLF_color = vec4(f1); +# } +# } +DEVICE_EXTENSION VK_KHR_shader_float_controls +DEVICE_PROPERTY FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32 +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpCapability SignedZeroInfNanPreserve + OpExtension "SPV_KHR_float_controls" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %15 %36 + OpExecutionMode %4 OriginUpperLeft + OpExecutionMode %4 SignedZeroInfNanPreserve 32 + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f0" + OpName %10 "f1" + OpName %15 "gl_FragCoord" + OpName %23 "buf0" + OpMemberName %23 0 "_GLF_uniform_float_values" + OpName %25 "" + OpName %36 "_GLF_color" + OpName %39 "buf1" + OpMemberName %39 0 "_GLF_uniform_int_values" + OpName %41 "" + OpDecorate %15 BuiltIn FragCoord + OpDecorate %22 ArrayStride 16 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %36 Location 0 + OpDecorate %38 ArrayStride 16 + OpMemberDecorate %39 0 Offset 0 + OpDecorate %39 Block + OpDecorate %41 DescriptorSet 0 + OpDecorate %41 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0x1.8p+128 + %13 = OpTypeVector %6 4 + %14 = OpTypePointer Input %13 + %15 = OpVariable %14 Input + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 0 + %18 = OpTypePointer Input %6 + %21 = OpConstant %16 1 + %22 = OpTypeArray %6 %21 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpTypeInt 32 1 + %27 = OpConstant %26 0 + %28 = OpTypePointer Uniform %6 + %31 = OpTypeBool + %35 = OpTypePointer Output %13 + %36 = OpVariable %35 Output + %37 = OpConstant %16 2 + %38 = OpTypeArray %26 %37 + %39 = OpTypeStruct %38 + %40 = OpTypePointer Uniform %39 + %41 = OpVariable %40 Uniform + %42 = OpConstant %26 1 + %43 = OpTypePointer Uniform %26 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + %11 = OpLoad %6 %8 + %12 = OpExtInst %6 %1 Fract %11 + OpStore %10 %12 + %19 = OpAccessChain %18 %15 %17 + %20 = OpLoad %6 %19 + %29 = OpAccessChain %28 %25 %27 %27 + %30 = OpLoad %6 %29 + %32 = OpFOrdGreaterThan %31 %20 %30 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %57 + %33 = OpLabel + %44 = OpAccessChain %43 %41 %27 %42 + %45 = OpLoad %26 %44 + %46 = OpConvertSToF %6 %45 + %47 = OpAccessChain %43 %41 %27 %27 + %48 = OpLoad %26 %47 + %49 = OpConvertSToF %6 %48 + %50 = OpAccessChain %43 %41 %27 %27 + %51 = OpLoad %26 %50 + %52 = OpConvertSToF %6 %51 + %53 = OpAccessChain %43 %41 %27 %42 + %54 = OpLoad %26 %53 + %55 = OpConvertSToF %6 %54 + %56 = OpCompositeConstruct %13 %46 %49 %52 %55 + OpStore %36 %56 + OpBranch %34 + %57 = OpLabel + %58 = OpLoad %6 %10 + %59 = OpCompositeConstruct %13 %58 %58 %58 %58 + OpStore %36 %59 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fract-smoothstep-undefined.amber b/vulkan/amber/graphicsfuzz/cov-fract-smoothstep-undefined.amber new file mode 100644 index 0000000..014c9ee --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fract-smoothstep-undefined.amber @@ -0,0 +1,191 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific APFloat code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 v1 = vec2(_float_1_0); +# vec2 b = fract(v1); +# +# // The values of the edges are the same, therefore this results in +# // an undefined value, but not in undefined behavior. +# float a = smoothstep(vec2(1.0), vec2(1.0), b).x; +# +# _GLF_color = vec4(_float_1_0, a, a, _float_1_0); +# +# // Always true. +# if (b.x < 1.0 && b.y < 1.0) +# { +# _GLF_color = vec4(_float_1_0, b.x, b.y, _float_1_0); +# } +# else +# { +# _GLF_color = vec4(_float_1_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %35 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v1" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %22 "b" + OpName %26 "a" + OpName %35 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %35 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 1 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %6 + %25 = OpTypePointer Function %6 + %27 = OpConstant %6 1 + %28 = OpConstantComposite %7 %27 %27 + %31 = OpConstant %10 0 + %33 = OpTypeVector %6 4 + %34 = OpTypePointer Output %33 + %35 = OpVariable %34 Output + %43 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %22 = OpVariable %8 Function + %26 = OpVariable %25 Function + %19 = OpAccessChain %18 %15 %17 %17 + %20 = OpLoad %6 %19 + %21 = OpCompositeConstruct %7 %20 %20 + OpStore %9 %21 + %23 = OpLoad %7 %9 + %24 = OpExtInst %7 %1 Fract %23 + OpStore %22 %24 + %29 = OpLoad %7 %22 + %30 = OpExtInst %7 %1 SmoothStep %28 %28 %29 + %32 = OpCompositeExtract %6 %30 0 + OpStore %26 %32 + %36 = OpAccessChain %18 %15 %17 %17 + %37 = OpLoad %6 %36 + %38 = OpLoad %6 %26 + %39 = OpLoad %6 %26 + %40 = OpAccessChain %18 %15 %17 %17 + %41 = OpLoad %6 %40 + %42 = OpCompositeConstruct %33 %37 %38 %39 %41 + OpStore %35 %42 + %44 = OpAccessChain %25 %22 %31 + %45 = OpLoad %6 %44 + %46 = OpFOrdLessThan %43 %45 %27 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + %49 = OpAccessChain %25 %22 %11 + %50 = OpLoad %6 %49 + %51 = OpFOrdLessThan %43 %50 %27 + OpBranch %48 + %48 = OpLabel + %52 = OpPhi %43 %46 %5 %51 %47 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %64 + %53 = OpLabel + %55 = OpAccessChain %18 %15 %17 %17 + %56 = OpLoad %6 %55 + %57 = OpAccessChain %25 %22 %31 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %25 %22 %11 + %60 = OpLoad %6 %59 + %61 = OpAccessChain %18 %15 %17 %17 + %62 = OpLoad %6 %61 + %63 = OpCompositeConstruct %33 %56 %58 %60 %62 + OpStore %35 %63 + OpBranch %54 + %64 = OpLabel + %65 = OpAccessChain %18 %15 %17 %17 + %66 = OpLoad %6 %65 + %67 = OpCompositeConstruct %33 %66 %66 %66 %66 + OpStore %35 %67 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fract-trunc-always-zero.amber b/vulkan/amber/graphicsfuzz/cov-fract-trunc-always-zero.amber new file mode 100644 index 0000000..7c2f3f1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fract-trunc-always-zero.amber @@ -0,0 +1,190 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // fract(trunc(x)) is always 0. +# float f = fract(trunc(float(_int_1))); +# +# // Always true. +# if(f == _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %39 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %27 "buf1" + OpMemberName %27 0 "_GLF_uniform_float_values" + OpName %29 "" + OpName %39 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %26 ArrayStride 16 + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 Block + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 1 + OpDecorate %39 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 1 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %9 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %9 0 + %17 = OpConstant %9 1 + %18 = OpTypePointer Uniform %9 + %25 = OpConstant %10 1 + %26 = OpTypeArray %6 %25 + %27 = OpTypeStruct %26 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %30 = OpTypePointer Uniform %6 + %33 = OpTypeBool + %37 = OpTypeVector %6 4 + %38 = OpTypePointer Output %37 + %39 = OpVariable %38 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpAccessChain %18 %15 %16 %17 + %20 = OpLoad %9 %19 + %21 = OpConvertSToF %6 %20 + %22 = OpExtInst %6 %1 Trunc %21 + %23 = OpExtInst %6 %1 Fract %22 + OpStore %8 %23 + %24 = OpLoad %6 %8 + %31 = OpAccessChain %30 %29 %16 %16 + %32 = OpLoad %6 %31 + %34 = OpFOrdEqual %33 %24 %32 + OpSelectionMerge %36 None + OpBranchConditional %34 %35 %53 + %35 = OpLabel + %40 = OpAccessChain %18 %15 %16 %17 + %41 = OpLoad %9 %40 + %42 = OpConvertSToF %6 %41 + %43 = OpAccessChain %18 %15 %16 %16 + %44 = OpLoad %9 %43 + %45 = OpConvertSToF %6 %44 + %46 = OpAccessChain %18 %15 %16 %16 + %47 = OpLoad %9 %46 + %48 = OpConvertSToF %6 %47 + %49 = OpAccessChain %18 %15 %16 %17 + %50 = OpLoad %9 %49 + %51 = OpConvertSToF %6 %50 + %52 = OpCompositeConstruct %37 %42 %45 %48 %51 + OpStore %39 %52 + OpBranch %36 + %53 = OpLabel + %54 = OpAccessChain %18 %15 %16 %16 + %55 = OpLoad %9 %54 + %56 = OpConvertSToF %6 %55 + %57 = OpCompositeConstruct %37 %56 %56 %56 %56 + OpStore %39 %57 + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fragcood-multiple-conditions-function-loop-global-counter.amber b/vulkan/amber/graphicsfuzz/cov-fragcood-multiple-conditions-function-loop-global-counter.amber new file mode 100644 index 0000000..edfc42c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fragcood-multiple-conditions-function-loop-global-counter.amber @@ -0,0 +1,534 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--copy-propagate-arrays' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--private-to-local' +# '--reduce-load-size' +# '--eliminate-dead-code-aggressive' +# '--ccp' +# '--reduce-load-size' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-block' +# '--eliminate-dead-code-aggressive' +# '--redundancy-elimination' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-multi-store' +# '--reduce-load-size' +# '--inline-entry-points-exhaustive' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-multi-store' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-local-single-store' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_1 _GLF_uniform_float_values[1] +# #define _float_0_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: 0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[1]; +# }; +# // Contents of _GLF_uniform_float_values: [1.0, 0.1, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // This function always returns 1.0 or greater. +# float func(float x) +# { +# float f = _float_1_0; +# +# // Always false. +# if(_float_1_0 < 1.0) +# { +# if(gl_FragCoord.x < _float_0_0) +# { +# return _float_1_0; +# } +# } +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# f += _float_1_0; +# +# // Always true. +# if(gl_FragCoord.x >= 0.0) +# { +# _GLF_color = vec4(_float_1_0); +# } +# +# // Always false. +# if (x < _float_0_0) +# { +# return f; +# } +# } +# +# // Never iterated as the loop bound has already been reached. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# } +# +# return f; +# } +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# +# // Always false. +# if(gl_FragCoord.x < _float_0_1) +# { +# return; +# } +# +# // v0 becomes (0, 0, 0, 0). +# vec4 v0 = _GLF_color; +# +# // Always true. +# if(gl_FragCoord.x >= 0.0) +# { +# _GLF_color = vec4(_float_1_0); +# } +# +# _GLF_color = v0; +# +# // Always false. +# if(gl_FragCoord.y < _float_0_1) +# { +# return; +# } +# +# vec4 v1 = vec4(_float_0_0); +# // v1 becomes (x, 0, 0, x), where x >= 1.0. +# v1.x = v1.w = func(gl_FragCoord.y); +# +# // Always true. +# if(gl_FragCoord.x >= 0.0) +# { +# _GLF_color = vec4(_float_1_0); +# } +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# return; +# } +# +# // Results clamps to (1, 0, 0, 1). +# _GLF_color = v1; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 247 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %35 %71 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func(f1;" + OpName %9 "x" + OpName %14 "_GLF_global_loop_count" + OpName %16 "f" + OpName %20 "buf1" + OpMemberName %20 0 "_GLF_uniform_float_values" + OpName %22 "" + OpName %35 "gl_FragCoord" + OpName %71 "_GLF_color" + OpName %97 "buf0" + OpMemberName %97 0 "_GLF_uniform_int_values" + OpName %99 "" + OpName %114 "v0" + OpName %133 "v1" + OpName %137 "param" + OpDecorate %19 ArrayStride 16 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 1 + OpDecorate %35 BuiltIn FragCoord + OpDecorate %71 Location 0 + OpDecorate %96 ArrayStride 16 + OpMemberDecorate %97 0 Offset 0 + OpDecorate %97 Block + OpDecorate %99 DescriptorSet 0 + OpDecorate %99 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %12 = OpTypeInt 32 1 + %13 = OpTypePointer Private %12 + %14 = OpVariable %13 Private + %15 = OpConstant %12 0 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 3 + %19 = OpTypeArray %6 %18 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpTypePointer Uniform %6 + %28 = OpConstant %6 1 + %29 = OpTypeBool + %33 = OpTypeVector %6 4 + %34 = OpTypePointer Input %33 + %35 = OpVariable %34 Input + %36 = OpConstant %17 0 + %37 = OpTypePointer Input %6 + %40 = OpConstant %12 2 + %55 = OpConstant %12 10 + %58 = OpConstant %12 1 + %66 = OpConstant %6 0 + %70 = OpTypePointer Output %33 + %71 = OpVariable %70 Output + %95 = OpConstant %17 1 + %96 = OpTypeArray %12 %95 + %97 = OpTypeStruct %96 + %98 = OpTypePointer Uniform %97 + %99 = OpVariable %98 Uniform + %100 = OpTypePointer Uniform %12 + %113 = OpTypePointer Function %33 + %166 = OpConstantFalse %29 + %167 = OpTypePointer Function %29 + %169 = OpConstantTrue %29 + %192 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %194 = OpVariable %167 Function %166 + %195 = OpVariable %7 Function + %196 = OpVariable %7 Function + %197 = OpVariable %7 Function + %114 = OpVariable %113 Function + %133 = OpVariable %113 Function + %137 = OpVariable %7 Function + OpSelectionMerge %164 None + OpSwitch %36 %165 + %165 = OpLabel + OpStore %14 %15 + %101 = OpAccessChain %100 %99 %15 %15 + %102 = OpLoad %12 %101 + %103 = OpConvertSToF %6 %102 + %104 = OpCompositeConstruct %33 %103 %103 %103 %103 + OpStore %71 %104 + %105 = OpAccessChain %37 %35 %36 + %106 = OpLoad %6 %105 + %107 = OpAccessChain %23 %22 %15 %58 + %108 = OpLoad %6 %107 + %109 = OpFOrdLessThan %29 %106 %108 + OpSelectionMerge %111 None + OpBranchConditional %109 %110 %111 + %110 = OpLabel + OpBranch %164 + %111 = OpLabel + %115 = OpLoad %33 %71 + OpStore %114 %115 + %118 = OpFOrdGreaterThanEqual %29 %106 %66 + OpSelectionMerge %120 None + OpBranchConditional %118 %119 %120 + %119 = OpLabel + %121 = OpAccessChain %23 %22 %15 %15 + %122 = OpLoad %6 %121 + %123 = OpCompositeConstruct %33 %122 %122 %122 %122 + OpStore %71 %123 + OpBranch %120 + %120 = OpLabel + OpStore %71 %115 + %125 = OpAccessChain %37 %35 %95 + %126 = OpLoad %6 %125 + %129 = OpFOrdLessThan %29 %126 %108 + OpSelectionMerge %131 None + OpBranchConditional %129 %130 %131 + %130 = OpLabel + OpBranch %164 + %131 = OpLabel + %134 = OpAccessChain %23 %22 %15 %40 + %135 = OpLoad %6 %134 + %136 = OpCompositeConstruct %33 %135 %135 %135 %135 + OpStore %133 %136 + OpStore %137 %126 + OpStore %194 %166 + OpSelectionMerge %245 None + OpSwitch %36 %199 + %199 = OpLabel + %200 = OpAccessChain %23 %22 %15 %15 + %201 = OpLoad %6 %200 + OpStore %196 %201 + %202 = OpFOrdLessThan %29 %201 %28 + OpSelectionMerge %211 None + OpBranchConditional %202 %203 %211 + %203 = OpLabel + %204 = OpAccessChain %37 %35 %36 + %205 = OpLoad %6 %204 + %206 = OpAccessChain %23 %22 %15 %40 + %207 = OpLoad %6 %206 + %208 = OpFOrdLessThan %29 %205 %207 + OpSelectionMerge %210 None + OpBranchConditional %208 %209 %210 + %209 = OpLabel + OpStore %194 %169 + OpStore %195 %201 + OpBranch %245 + %210 = OpLabel + OpBranch %211 + %211 = OpLabel + OpBranch %212 + %212 = OpLabel + %213 = OpPhi %6 %201 %211 %219 %232 + %214 = OpLoad %12 %14 + %215 = OpSLessThan %29 %214 %55 + OpLoopMerge %233 %232 None + OpBranchConditional %215 %216 %233 + %216 = OpLabel + %217 = OpLoad %12 %14 + %218 = OpIAdd %12 %217 %58 + OpStore %14 %218 + %219 = OpFAdd %6 %213 %201 + OpStore %196 %219 + %220 = OpAccessChain %37 %35 %36 + %221 = OpLoad %6 %220 + %222 = OpFOrdGreaterThanEqual %29 %221 %66 + OpSelectionMerge %225 None + OpBranchConditional %222 %223 %225 + %223 = OpLabel + %224 = OpCompositeConstruct %33 %201 %201 %201 %201 + OpStore %71 %224 + OpBranch %225 + %225 = OpLabel + %227 = OpAccessChain %23 %22 %15 %40 + %228 = OpLoad %6 %227 + %229 = OpFOrdLessThan %29 %126 %228 + OpSelectionMerge %231 None + OpBranchConditional %229 %230 %231 + %230 = OpLabel + OpStore %194 %169 + OpStore %195 %219 + OpBranch %233 + %231 = OpLabel + OpBranch %232 + %232 = OpLabel + OpBranch %212 + %233 = OpLabel + %234 = OpPhi %6 %192 %212 %219 %230 + %235 = OpPhi %6 %213 %212 %219 %230 + %236 = OpPhi %29 %166 %212 %169 %230 + OpSelectionMerge %237 None + OpBranchConditional %236 %245 %237 + %237 = OpLabel + OpBranch %238 + %238 = OpLabel + %239 = OpLoad %12 %14 + %240 = OpSLessThan %29 %239 %55 + OpLoopMerge %244 %241 None + OpBranchConditional %240 %241 %244 + %241 = OpLabel + %242 = OpLoad %12 %14 + %243 = OpIAdd %12 %242 %58 + OpStore %14 %243 + OpBranch %238 + %244 = OpLabel + OpStore %194 %169 + OpStore %195 %235 + OpBranch %245 + %245 = OpLabel + %246 = OpPhi %6 %201 %209 %234 %233 %235 %244 + OpStore %197 %246 + %161 = OpCompositeInsert %33 %246 %136 3 + %163 = OpCompositeInsert %33 %246 %161 0 + OpStore %133 %163 + OpSelectionMerge %147 None + OpBranchConditional %118 %146 %147 + %146 = OpLabel + %148 = OpAccessChain %23 %22 %15 %15 + %149 = OpLoad %6 %148 + %150 = OpCompositeConstruct %33 %149 %149 %149 %149 + OpStore %71 %150 + OpBranch %147 + %147 = OpLabel + %155 = OpFOrdLessThan %29 %106 %135 + OpSelectionMerge %157 None + OpBranchConditional %155 %156 %157 + %156 = OpLabel + OpBranch %164 + %157 = OpLabel + OpStore %71 %163 + OpBranch %164 + %164 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %174 = OpVariable %167 Function %166 + %171 = OpVariable %7 Function + %16 = OpVariable %7 Function + OpSelectionMerge %170 None + OpSwitch %36 %173 + %173 = OpLabel + %24 = OpAccessChain %23 %22 %15 %15 + %25 = OpLoad %6 %24 + OpStore %16 %25 + %30 = OpFOrdLessThan %29 %25 %28 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + %38 = OpAccessChain %37 %35 %36 + %39 = OpLoad %6 %38 + %41 = OpAccessChain %23 %22 %15 %40 + %42 = OpLoad %6 %41 + %43 = OpFOrdLessThan %29 %39 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %45 + %44 = OpLabel + OpStore %174 %169 + OpStore %171 %25 + OpBranch %170 + %45 = OpLabel + OpBranch %32 + %32 = OpLabel + OpBranch %49 + %49 = OpLabel + %179 = OpPhi %6 %25 %32 %63 %52 + %54 = OpLoad %12 %14 + %56 = OpSLessThan %29 %54 %55 + OpLoopMerge %51 %52 None + OpBranchConditional %56 %50 %51 + %50 = OpLabel + %57 = OpLoad %12 %14 + %59 = OpIAdd %12 %57 %58 + OpStore %14 %59 + %63 = OpFAdd %6 %179 %25 + OpStore %16 %63 + %64 = OpAccessChain %37 %35 %36 + %65 = OpLoad %6 %64 + %67 = OpFOrdGreaterThanEqual %29 %65 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %69 + %68 = OpLabel + %74 = OpCompositeConstruct %33 %25 %25 %25 %25 + OpStore %71 %74 + OpBranch %69 + %69 = OpLabel + %75 = OpLoad %6 %9 + %76 = OpAccessChain %23 %22 %15 %40 + %77 = OpLoad %6 %76 + %78 = OpFOrdLessThan %29 %75 %77 + OpSelectionMerge %80 None + OpBranchConditional %78 %79 %80 + %79 = OpLabel + OpStore %174 %169 + OpStore %171 %63 + OpBranch %51 + %80 = OpLabel + OpBranch %52 + %52 = OpLabel + OpBranch %49 + %51 = OpLabel + %189 = OpPhi %6 %192 %49 %63 %79 + %187 = OpPhi %6 %179 %49 %63 %79 + %182 = OpPhi %29 %166 %49 %169 %79 + OpSelectionMerge %175 None + OpBranchConditional %182 %170 %175 + %175 = OpLabel + OpBranch %83 + %83 = OpLabel + %88 = OpLoad %12 %14 + %89 = OpSLessThan %29 %88 %55 + OpLoopMerge %85 %84 None + OpBranchConditional %89 %84 %85 + %84 = OpLabel + %90 = OpLoad %12 %14 + %91 = OpIAdd %12 %90 %58 + OpStore %14 %91 + OpBranch %83 + %85 = OpLabel + OpStore %174 %169 + OpStore %171 %187 + OpBranch %170 + %170 = OpLabel + %188 = OpPhi %6 %25 %44 %189 %51 %187 %85 + OpReturnValue %188 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.1 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fragcoord-and-one-or-same-value.amber b/vulkan/amber/graphicsfuzz/cov-fragcoord-and-one-or-same-value.amber new file mode 100644 index 0000000..6b763c4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fragcoord-and-one-or-same-value.amber @@ -0,0 +1,189 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int x = int(gl_FragCoord.x); +# // a becomes 0 or 1. +# int a = (x & _int_1) | (x & _int_1); +# +# // Always selects a color from index 0 or 1. +# _GLF_color = vec4[4](vec4(_int_1, _int_0, _int_0, _int_1), vec4(_int_1, _int_0, _int_0, _int_1), vec4(_int_0), vec4(_int_0))[a]; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 82 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %37 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "x" + OpName %12 "gl_FragCoord" + OpName %19 "a" + OpName %23 "buf0" + OpMemberName %23 0 "_GLF_uniform_int_values" + OpName %25 "" + OpName %37 "_GLF_color" + OpName %78 "indexable" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %22 ArrayStride 16 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %37 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Input %9 + %21 = OpConstant %13 2 + %22 = OpTypeArray %6 %21 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpConstant %6 0 + %27 = OpTypePointer Uniform %6 + %36 = OpTypePointer Output %10 + %37 = OpVariable %36 Output + %41 = OpConstant %6 1 + %73 = OpConstant %13 4 + %74 = OpTypeArray %10 %73 + %77 = OpTypePointer Function %74 + %79 = OpTypePointer Function %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %78 = OpVariable %77 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %18 = OpConvertFToS %6 %17 + OpStore %8 %18 + %20 = OpLoad %6 %8 + %28 = OpAccessChain %27 %25 %26 %26 + %29 = OpLoad %6 %28 + %30 = OpBitwiseAnd %6 %20 %29 + %31 = OpLoad %6 %8 + %32 = OpAccessChain %27 %25 %26 %26 + %33 = OpLoad %6 %32 + %34 = OpBitwiseAnd %6 %31 %33 + %35 = OpBitwiseOr %6 %30 %34 + OpStore %19 %35 + %38 = OpAccessChain %27 %25 %26 %26 + %39 = OpLoad %6 %38 + %40 = OpConvertSToF %9 %39 + %42 = OpAccessChain %27 %25 %26 %41 + %43 = OpLoad %6 %42 + %44 = OpConvertSToF %9 %43 + %45 = OpAccessChain %27 %25 %26 %41 + %46 = OpLoad %6 %45 + %47 = OpConvertSToF %9 %46 + %48 = OpAccessChain %27 %25 %26 %26 + %49 = OpLoad %6 %48 + %50 = OpConvertSToF %9 %49 + %51 = OpCompositeConstruct %10 %40 %44 %47 %50 + %52 = OpAccessChain %27 %25 %26 %26 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %9 %53 + %55 = OpAccessChain %27 %25 %26 %41 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %9 %56 + %58 = OpAccessChain %27 %25 %26 %41 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %9 %59 + %61 = OpAccessChain %27 %25 %26 %26 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %9 %62 + %64 = OpCompositeConstruct %10 %54 %57 %60 %63 + %65 = OpAccessChain %27 %25 %26 %41 + %66 = OpLoad %6 %65 + %67 = OpConvertSToF %9 %66 + %68 = OpCompositeConstruct %10 %67 %67 %67 %67 + %69 = OpAccessChain %27 %25 %26 %41 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %9 %70 + %72 = OpCompositeConstruct %10 %71 %71 %71 %71 + %75 = OpCompositeConstruct %74 %51 %64 %68 %72 + %76 = OpLoad %6 %19 + OpStore %78 %75 + %80 = OpAccessChain %79 %78 %76 + %81 = OpLoad %10 %80 + OpStore %37 %81 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fragcoord-bitwise-and-loop-reduce-value-index-array.amber b/vulkan/amber/graphicsfuzz/cov-fragcoord-bitwise-and-loop-reduce-value-index-array.amber new file mode 100644 index 0000000..0fa453a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fragcoord-bitwise-and-loop-reduce-value-index-array.amber @@ -0,0 +1,252 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform sampler2D tex; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# ivec2 ipos = ivec2(gl_FragCoord.xy); +# int a = (ipos.x & 5) + ((ipos.y & 5) | (ipos.x & 10)); +# +# // This loop reduces a to a range of 0..3. +# while(a > 3) +# { +# vec4 v = texture(tex, vec2(1.0)); +# +# // Sampled values are between 0..1 making this condition always false. +# while(v.x > 2.0) +# { +# } +# +# a -= 4; +# } +# +# // Always true. +# if (a >= 0 && a < 4) +# _GLF_color = vec4[4](vec4(1, 0, 0, 1), vec4(1, 0, 0, 1), vec4(1, 0, 0, 1), vec4(1, 0, 0, 1))[a]; +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 90 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 %77 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "ipos" + OpName %13 "gl_FragCoord" + OpName %19 "a" + OpName %46 "v" + OpName %50 "tex" + OpName %77 "_GLF_color" + OpName %85 "indexable" + OpDecorate %13 BuiltIn FragCoord + OpDecorate %50 RelaxedPrecision + OpDecorate %50 DescriptorSet 0 + OpDecorate %50 Binding 0 + OpDecorate %51 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %77 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Input %11 + %13 = OpVariable %12 Input + %14 = OpTypeVector %10 2 + %18 = OpTypePointer Function %6 + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 0 + %24 = OpConstant %6 5 + %26 = OpConstant %20 1 + %32 = OpConstant %6 10 + %42 = OpConstant %6 3 + %43 = OpTypeBool + %45 = OpTypePointer Function %11 + %47 = OpTypeImage %10 2D 0 0 0 1 Unknown + %48 = OpTypeSampledImage %47 + %49 = OpTypePointer UniformConstant %48 + %50 = OpVariable %49 UniformConstant + %52 = OpConstant %10 1 + %53 = OpConstantComposite %14 %52 %52 + %60 = OpTypePointer Function %10 + %63 = OpConstant %10 2 + %65 = OpConstant %6 4 + %69 = OpConstant %6 0 + %76 = OpTypePointer Output %11 + %77 = OpVariable %76 Output + %78 = OpConstant %20 4 + %79 = OpTypeArray %11 %78 + %80 = OpConstant %10 0 + %81 = OpConstantComposite %11 %52 %80 %80 %52 + %82 = OpConstantComposite %79 %81 %81 %81 %81 + %84 = OpTypePointer Function %79 + %89 = OpConstantComposite %11 %80 %80 %80 %80 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %19 = OpVariable %18 Function + %46 = OpVariable %45 Function + %85 = OpVariable %84 Function + %15 = OpLoad %11 %13 + %16 = OpVectorShuffle %14 %15 %15 0 1 + %17 = OpConvertFToS %7 %16 + OpStore %9 %17 + %22 = OpAccessChain %18 %9 %21 + %23 = OpLoad %6 %22 + %25 = OpBitwiseAnd %6 %23 %24 + %27 = OpAccessChain %18 %9 %26 + %28 = OpLoad %6 %27 + %29 = OpBitwiseAnd %6 %28 %24 + %30 = OpAccessChain %18 %9 %21 + %31 = OpLoad %6 %30 + %33 = OpBitwiseAnd %6 %31 %32 + %34 = OpBitwiseOr %6 %29 %33 + %35 = OpIAdd %6 %25 %34 + OpStore %19 %35 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %6 %19 + %44 = OpSGreaterThan %43 %41 %42 + OpBranchConditional %44 %37 %38 + %37 = OpLabel + %51 = OpLoad %48 %50 + %54 = OpImageSampleImplicitLod %11 %51 %53 + OpStore %46 %54 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %61 = OpAccessChain %60 %46 %21 + %62 = OpLoad %10 %61 + %64 = OpFOrdGreaterThan %43 %62 %63 + OpBranchConditional %64 %56 %57 + %56 = OpLabel + OpBranch %58 + %58 = OpLabel + OpBranch %55 + %57 = OpLabel + %66 = OpLoad %6 %19 + %67 = OpISub %6 %66 %65 + OpStore %19 %67 + OpBranch %39 + %39 = OpLabel + OpBranch %36 + %38 = OpLabel + %68 = OpLoad %6 %19 + %70 = OpSGreaterThanEqual %43 %68 %69 + %71 = OpLoad %6 %19 + %72 = OpSLessThan %43 %71 %65 + %73 = OpLogicalAnd %43 %70 %72 + OpSelectionMerge %75 None + OpBranchConditional %73 %74 %88 + %74 = OpLabel + %83 = OpLoad %6 %19 + OpStore %85 %82 + %86 = OpAccessChain %45 %85 %83 + %87 = OpLoad %11 %86 + OpStore %77 %87 + OpBranch %75 + %88 = OpLabel + OpStore %77 %89 + OpBranch %75 + %75 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# GLF_dead6tex +SAMPLER variant_GLF_dead6tex + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_GLF_dead6tex DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fragcoord-bitwise-not.amber b/vulkan/amber/graphicsfuzz/cov-fragcoord-bitwise-not.amber new file mode 100644 index 0000000..517dc30 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fragcoord-bitwise-not.amber @@ -0,0 +1,184 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // a is always positive. +# int a = int(gl_FragCoord.x); +# +# // Always true because the bitwise not of a positive value of x is -x - 1. +# if (~a < 0) +# { +# a = _int_1; +# } +# +# // Always true. +# if(a == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %42 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "gl_FragCoord" + OpName %28 "buf0" + OpMemberName %28 0 "_GLF_uniform_int_values" + OpName %30 "" + OpName %42 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %27 ArrayStride 16 + OpMemberDecorate %28 0 Offset 0 + OpDecorate %28 Block + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 0 + OpDecorate %42 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Input %9 + %21 = OpConstant %6 0 + %22 = OpTypeBool + %26 = OpConstant %13 2 + %27 = OpTypeArray %6 %26 + %28 = OpTypeStruct %27 + %29 = OpTypePointer Uniform %28 + %30 = OpVariable %29 Uniform + %31 = OpConstant %6 1 + %32 = OpTypePointer Uniform %6 + %41 = OpTypePointer Output %10 + %42 = OpVariable %41 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %18 = OpConvertFToS %6 %17 + OpStore %8 %18 + %19 = OpLoad %6 %8 + %20 = OpNot %6 %19 + %23 = OpSLessThan %22 %20 %21 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + %33 = OpAccessChain %32 %30 %21 %31 + %34 = OpLoad %6 %33 + OpStore %8 %34 + OpBranch %25 + %25 = OpLabel + %35 = OpLoad %6 %8 + %36 = OpAccessChain %32 %30 %21 %31 + %37 = OpLoad %6 %36 + %38 = OpIEqual %22 %35 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %56 + %39 = OpLabel + %43 = OpAccessChain %32 %30 %21 %31 + %44 = OpLoad %6 %43 + %45 = OpConvertSToF %9 %44 + %46 = OpAccessChain %32 %30 %21 %21 + %47 = OpLoad %6 %46 + %48 = OpConvertSToF %9 %47 + %49 = OpAccessChain %32 %30 %21 %21 + %50 = OpLoad %6 %49 + %51 = OpConvertSToF %9 %50 + %52 = OpAccessChain %32 %30 %21 %31 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %9 %53 + %55 = OpCompositeConstruct %10 %45 %48 %51 %54 + OpStore %42 %55 + OpBranch %40 + %56 = OpLabel + %57 = OpAccessChain %32 %30 %21 %21 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %9 %58 + %60 = OpCompositeConstruct %10 %59 %59 %59 %59 + OpStore %42 %60 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fragcoord-clamp-array-access.amber b/vulkan/amber/graphicsfuzz/cov-fragcoord-clamp-array-access.amber new file mode 100644 index 0000000..d01cc6c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fragcoord-clamp-array-access.amber @@ -0,0 +1,293 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplify path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_15 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [2, 1, 0, 15] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 data[2] = vec4[2](vec4(_float_1_0), vec4(_float_1_0)); +# +# int b = _int_1; +# +# // This results in an undefined value, but not in undefined behavior. y becomes +# // undefined with some of the window coordinate values. Doesn't matter since +# // b's value is checked at the same time with y. +# int y = clamp(int(gl_FragCoord.y), _int_1 | int(gl_FragCoord.y), _int_1); +# +# for (int i = _int_1; i < _int_2; i++) +# { +# if (b > _int_2 && y > _int_1) +# { +# break; +# } +# b++; +# } +# +# if (b == _int_2) +# { +# data[clamp(_int_0, _int_1, _int_15)] = +# vec4(_int_1, _int_0, _int_0, _int_1); +# } +# _GLF_color = vec4(data[_int_1]); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 127 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %41 %117 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %12 "data" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_float_values" + OpName %17 "" + OpName %29 "b" + OpName %32 "buf1" + OpMemberName %32 0 "_GLF_uniform_int_values" + OpName %34 "" + OpName %39 "y" + OpName %41 "gl_FragCoord" + OpName %55 "i" + OpName %117 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %31 ArrayStride 16 + OpMemberDecorate %32 0 Offset 0 + OpDecorate %32 Block + OpDecorate %34 DescriptorSet 0 + OpDecorate %34 Binding 1 + OpDecorate %41 BuiltIn FragCoord + OpDecorate %117 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeInt 32 0 + %9 = OpConstant %8 2 + %10 = OpTypeArray %7 %9 + %11 = OpTypePointer Function %10 + %13 = OpConstant %8 1 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %6 + %28 = OpTypePointer Function %18 + %30 = OpConstant %8 4 + %31 = OpTypeArray %18 %30 + %32 = OpTypeStruct %31 + %33 = OpTypePointer Uniform %32 + %34 = OpVariable %33 Uniform + %35 = OpConstant %18 1 + %36 = OpTypePointer Uniform %18 + %40 = OpTypePointer Input %7 + %41 = OpVariable %40 Input + %42 = OpTypePointer Input %6 + %66 = OpTypeBool + %92 = OpConstant %18 2 + %97 = OpConstant %18 3 + %114 = OpTypePointer Function %7 + %116 = OpTypePointer Output %7 + %117 = OpVariable %116 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpVariable %11 Function + %29 = OpVariable %28 Function + %39 = OpVariable %28 Function + %55 = OpVariable %28 Function + %21 = OpAccessChain %20 %17 %19 %19 + %22 = OpLoad %6 %21 + %23 = OpCompositeConstruct %7 %22 %22 %22 %22 + %24 = OpAccessChain %20 %17 %19 %19 + %25 = OpLoad %6 %24 + %26 = OpCompositeConstruct %7 %25 %25 %25 %25 + %27 = OpCompositeConstruct %10 %23 %26 + OpStore %12 %27 + %37 = OpAccessChain %36 %34 %19 %35 + %38 = OpLoad %18 %37 + OpStore %29 %38 + %43 = OpAccessChain %42 %41 %13 + %44 = OpLoad %6 %43 + %45 = OpConvertFToS %18 %44 + %46 = OpAccessChain %36 %34 %19 %35 + %47 = OpLoad %18 %46 + %48 = OpAccessChain %42 %41 %13 + %49 = OpLoad %6 %48 + %50 = OpConvertFToS %18 %49 + %51 = OpBitwiseOr %18 %47 %50 + %52 = OpAccessChain %36 %34 %19 %35 + %53 = OpLoad %18 %52 + %54 = OpExtInst %18 %1 SClamp %45 %51 %53 + OpStore %39 %54 + %56 = OpAccessChain %36 %34 %19 %35 + %57 = OpLoad %18 %56 + OpStore %55 %57 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %18 %55 + %64 = OpAccessChain %36 %34 %19 %19 + %65 = OpLoad %18 %64 + %67 = OpSLessThan %66 %63 %65 + OpBranchConditional %67 %59 %60 + %59 = OpLabel + %68 = OpLoad %18 %29 + %69 = OpAccessChain %36 %34 %19 %19 + %70 = OpLoad %18 %69 + %71 = OpSGreaterThan %66 %68 %70 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %73 + %72 = OpLabel + %74 = OpLoad %18 %39 + %75 = OpAccessChain %36 %34 %19 %35 + %76 = OpLoad %18 %75 + %77 = OpSGreaterThan %66 %74 %76 + OpBranch %73 + %73 = OpLabel + %78 = OpPhi %66 %71 %59 %77 %72 + OpSelectionMerge %80 None + OpBranchConditional %78 %79 %80 + %79 = OpLabel + OpBranch %60 + %80 = OpLabel + %82 = OpLoad %18 %29 + %83 = OpIAdd %18 %82 %35 + OpStore %29 %83 + OpBranch %61 + %61 = OpLabel + %84 = OpLoad %18 %55 + %85 = OpIAdd %18 %84 %35 + OpStore %55 %85 + OpBranch %58 + %60 = OpLabel + %86 = OpLoad %18 %29 + %87 = OpAccessChain %36 %34 %19 %19 + %88 = OpLoad %18 %87 + %89 = OpIEqual %66 %86 %88 + OpSelectionMerge %91 None + OpBranchConditional %89 %90 %91 + %90 = OpLabel + %93 = OpAccessChain %36 %34 %19 %92 + %94 = OpLoad %18 %93 + %95 = OpAccessChain %36 %34 %19 %35 + %96 = OpLoad %18 %95 + %98 = OpAccessChain %36 %34 %19 %97 + %99 = OpLoad %18 %98 + %100 = OpExtInst %18 %1 SClamp %94 %96 %99 + %101 = OpAccessChain %36 %34 %19 %35 + %102 = OpLoad %18 %101 + %103 = OpConvertSToF %6 %102 + %104 = OpAccessChain %36 %34 %19 %92 + %105 = OpLoad %18 %104 + %106 = OpConvertSToF %6 %105 + %107 = OpAccessChain %36 %34 %19 %92 + %108 = OpLoad %18 %107 + %109 = OpConvertSToF %6 %108 + %110 = OpAccessChain %36 %34 %19 %35 + %111 = OpLoad %18 %110 + %112 = OpConvertSToF %6 %111 + %113 = OpCompositeConstruct %7 %103 %106 %109 %112 + %115 = OpAccessChain %114 %12 %100 + OpStore %115 %113 + OpBranch %91 + %91 = OpLabel + %118 = OpAccessChain %36 %34 %19 %35 + %119 = OpLoad %18 %118 + %120 = OpAccessChain %114 %12 %119 + %121 = OpLoad %7 %120 + %122 = OpCompositeExtract %6 %121 0 + %123 = OpCompositeExtract %6 %121 1 + %124 = OpCompositeExtract %6 %121 2 + %125 = OpCompositeExtract %6 %121 3 + %126 = OpCompositeConstruct %7 %122 %123 %124 %125 + OpStore %117 %126 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 1 0 15 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fragcoord-conditions-never-return-index-array-using-uniform.amber b/vulkan/amber/graphicsfuzz/cov-fragcoord-conditions-never-return-index-array-using-uniform.amber new file mode 100644 index 0000000..af89adf --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fragcoord-conditions-never-return-index-array-using-uniform.amber @@ -0,0 +1,284 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--if-conversion' +# '--eliminate-dead-branches' +# '--merge-return' +# '--private-to-local' +# '--scalar-replacement=100' +# '--if-conversion' +# '--scalar-replacement=100' +# '--eliminate-dead-branches' +# '--scalar-replacement=100' +# '--redundancy-elimination' +# '--private-to-local' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--if-conversion' +# '--if-conversion' +# '--scalar-replacement=100' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-code-aggressive' +# '--copy-propagate-arrays' +# '--eliminate-local-single-block' +# '--vector-dce' +# '--ccp' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_300_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 300.0] +# layout(set = 0, binding = 1) uniform buf1 { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# for(int i = _int_1; i != _int_1; ) +# { +# return; +# } +# } +# +# // Iterated once. +# do +# { +# // Useless line but still needed for the coverage. +# gl_FragCoord.y < _float_0_0; +# +# +# // Always false. +# if(gl_FragCoord.y >= _float_300_0) +# { +# return; +# } +# } +# while(gl_FragCoord.y < _float_0_0); +# +# // Selects (1, 0, 0, 1). +# _GLF_color = vec4[4](vec4(_int_1, _int_0, _int_0, _int_1), vec4(_int_0), vec4(_int_0), vec4(_int_0))[_int_0]; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 119 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %73 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "gl_FragCoord" + OpName %17 "buf1" + OpMemberName %17 0 "_GLF_uniform_float_values" + OpName %19 "" + OpName %30 "i" + OpName %32 "buf0" + OpMemberName %32 0 "_GLF_uniform_int_values" + OpName %34 "" + OpName %73 "_GLF_color" + OpName %105 "indexable" + OpDecorate %9 BuiltIn FragCoord + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %31 ArrayStride 16 + OpMemberDecorate %32 0 Offset 0 + OpDecorate %32 Block + OpDecorate %34 DescriptorSet 0 + OpDecorate %34 Binding 0 + OpDecorate %73 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Input %7 + %9 = OpVariable %8 Input + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 0 + %12 = OpTypePointer Input %6 + %15 = OpConstant %10 2 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypeInt 32 1 + %21 = OpConstant %20 0 + %22 = OpTypePointer Uniform %6 + %25 = OpTypeBool + %29 = OpTypePointer Function %20 + %31 = OpTypeArray %20 %15 + %32 = OpTypeStruct %31 + %33 = OpTypePointer Uniform %32 + %34 = OpVariable %33 Uniform + %35 = OpTypePointer Uniform %20 + %52 = OpConstant %10 1 + %60 = OpConstant %20 1 + %72 = OpTypePointer Output %7 + %73 = OpVariable %72 Output + %99 = OpConstant %10 4 + %100 = OpTypeArray %7 %99 + %104 = OpTypePointer Function %100 + %106 = OpTypePointer Function %7 + %111 = OpConstantFalse %25 + %112 = OpTypePointer Function %25 + %114 = OpConstantTrue %25 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %113 = OpVariable %112 Function %111 + %30 = OpVariable %29 Function + %105 = OpVariable %104 Function + OpSelectionMerge %109 None + OpSwitch %11 %110 + %110 = OpLabel + %13 = OpAccessChain %12 %9 %11 + %14 = OpLoad %6 %13 + %23 = OpAccessChain %22 %19 %21 %21 + %24 = OpLoad %6 %23 + %26 = OpFOrdLessThan %25 %14 %24 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + %36 = OpAccessChain %35 %34 %21 %21 + %37 = OpLoad %20 %36 + OpStore %30 %37 + OpBranch %38 + %38 = OpLabel + %43 = OpLoad %20 %30 + %46 = OpINotEqual %25 %43 %37 + OpLoopMerge %40 %41 None + OpBranchConditional %46 %39 %40 + %39 = OpLabel + OpStore %113 %114 + OpBranch %40 + %41 = OpLabel + OpBranch %38 + %40 = OpLabel + %116 = OpLoad %25 %113 + OpSelectionMerge %115 None + OpBranchConditional %116 %109 %115 + %115 = OpLabel + OpBranch %28 + %28 = OpLabel + OpBranch %48 + %48 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %49 + %49 = OpLabel + %53 = OpAccessChain %12 %9 %52 + %54 = OpLoad %6 %53 + %57 = OpFOrdLessThan %25 %54 %24 + %61 = OpAccessChain %22 %19 %21 %60 + %62 = OpLoad %6 %61 + %63 = OpFOrdGreaterThanEqual %25 %54 %62 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %65 + %64 = OpLabel + OpStore %113 %114 + OpBranch %50 + %65 = OpLabel + OpBranch %51 + %51 = OpLabel + OpBranchConditional %57 %48 %50 + %50 = OpLabel + %118 = OpLoad %25 %113 + OpSelectionMerge %117 None + OpBranchConditional %118 %109 %117 + %117 = OpLabel + %74 = OpAccessChain %35 %34 %21 %21 + %75 = OpLoad %20 %74 + %76 = OpConvertSToF %6 %75 + %77 = OpAccessChain %35 %34 %21 %60 + %78 = OpLoad %20 %77 + %79 = OpConvertSToF %6 %78 + %86 = OpCompositeConstruct %7 %76 %79 %79 %76 + %90 = OpCompositeConstruct %7 %79 %79 %79 %79 + %101 = OpCompositeConstruct %100 %86 %90 %90 %90 + OpStore %105 %101 + %107 = OpAccessChain %106 %105 %78 + %108 = OpLoad %7 %107 + OpStore %73 %108 + OpStore %113 %114 + OpBranch %109 + %109 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 300.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fragcoord-integer-loop-reduce-to-range.amber b/vulkan/amber/graphicsfuzz/cov-fragcoord-integer-loop-reduce-to-range.amber new file mode 100644 index 0000000..20c58e6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fragcoord-integer-loop-reduce-to-range.amber @@ -0,0 +1,207 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = int(gl_FragCoord.x); +# +# for(int i = 1; i < 3; i++) +# { +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# return; +# } +# } +# +# // Always false. +# if(a < 0) +# { +# a = -a; +# } +# +# // Loops until a is in range 0..2. +# while(a > 2) +# { +# a -= 2; +# +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# break; +# } +# } +# +# // Correct values are at indices 0..2. +# _GLF_color = vec4[5](vec4(1, 0, 0, 1), vec4(1, 0, 0, 1), vec4(1, 0, 0, 1), vec4(0), vec4(0))[a]; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %64 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "gl_FragCoord" + OpName %19 "i" + OpName %64 "_GLF_color" + OpName %73 "indexable" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %64 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Input %9 + %20 = OpConstant %6 1 + %27 = OpConstant %6 3 + %28 = OpTypeBool + %30 = OpConstant %13 1 + %33 = OpConstant %9 0 + %41 = OpConstant %6 0 + %53 = OpConstant %6 2 + %63 = OpTypePointer Output %10 + %64 = OpVariable %63 Output + %65 = OpConstant %13 5 + %66 = OpTypeArray %10 %65 + %67 = OpConstant %9 1 + %68 = OpConstantComposite %10 %67 %33 %33 %67 + %69 = OpConstantComposite %10 %33 %33 %33 %33 + %70 = OpConstantComposite %66 %68 %68 %68 %69 %69 + %72 = OpTypePointer Function %66 + %74 = OpTypePointer Function %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %73 = OpVariable %72 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %18 = OpConvertFToS %6 %17 + OpStore %8 %18 + OpStore %19 %20 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %6 %19 + %29 = OpSLessThan %28 %26 %27 + OpBranchConditional %29 %22 %23 + %22 = OpLabel + %31 = OpAccessChain %15 %12 %30 + %32 = OpLoad %9 %31 + %34 = OpFOrdLessThan %28 %32 %33 + OpSelectionMerge %36 None + OpBranchConditional %34 %35 %36 + %35 = OpLabel + OpReturn + %36 = OpLabel + OpBranch %24 + %24 = OpLabel + %38 = OpLoad %6 %19 + %39 = OpIAdd %6 %38 %20 + OpStore %19 %39 + OpBranch %21 + %23 = OpLabel + %40 = OpLoad %6 %8 + %42 = OpSLessThan %28 %40 %41 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %44 + %43 = OpLabel + %45 = OpLoad %6 %8 + %46 = OpSNegate %6 %45 + OpStore %8 %46 + OpBranch %44 + %44 = OpLabel + OpBranch %47 + %47 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %6 %8 + %54 = OpSGreaterThan %28 %52 %53 + OpBranchConditional %54 %48 %49 + %48 = OpLabel + %55 = OpLoad %6 %8 + %56 = OpISub %6 %55 %53 + OpStore %8 %56 + %57 = OpAccessChain %15 %12 %30 + %58 = OpLoad %9 %57 + %59 = OpFOrdLessThan %28 %58 %33 + OpSelectionMerge %61 None + OpBranchConditional %59 %60 %61 + %60 = OpLabel + OpBranch %49 + %61 = OpLabel + OpBranch %50 + %50 = OpLabel + OpBranch %47 + %49 = OpLabel + %71 = OpLoad %6 %8 + OpStore %73 %70 + %75 = OpAccessChain %74 %73 %71 + %76 = OpLoad %10 %75 + OpStore %64 %76 + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fragcoord-loop-limit-negative-decrease-sum-first-iteration.amber b/vulkan/amber/graphicsfuzz/cov-fragcoord-loop-limit-negative-decrease-sum-first-iteration.amber new file mode 100644 index 0000000..1fe1e78 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fragcoord-loop-limit-negative-decrease-sum-first-iteration.amber @@ -0,0 +1,250 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_18 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 18] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int sum = _int_1; +# +# // The loop limit is always 20. The first iteration decreases the sum, +# // and all other iterations increases it. +# for(int i = 1; i < ((gl_FragCoord.x >= _float_0_0) ? 20 : - 1); i++) +# { +# sum += i == _int_1 ? - _int_1 : _int_1; +# } +# +# // Always true. +# if(sum == _int_18) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 94 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %30 %75 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "sum" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %30 "gl_FragCoord" + OpName %37 "buf0" + OpMemberName %37 0 "_GLF_uniform_float_values" + OpName %39 "" + OpName %75 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %30 BuiltIn FragCoord + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 0 + OpDecorate %75 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %27 = OpTypeFloat 32 + %28 = OpTypeVector %27 4 + %29 = OpTypePointer Input %28 + %30 = OpVariable %29 Input + %31 = OpConstant %9 0 + %32 = OpTypePointer Input %27 + %35 = OpConstant %9 1 + %36 = OpTypeArray %27 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %27 + %43 = OpTypeBool + %45 = OpConstant %6 20 + %46 = OpConstant %6 -1 + %68 = OpConstant %6 2 + %74 = OpTypePointer Output %28 + %75 = OpVariable %74 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %53 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpStore %20 %16 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %6 %20 + %33 = OpAccessChain %32 %30 %31 + %34 = OpLoad %27 %33 + %41 = OpAccessChain %40 %39 %15 %15 + %42 = OpLoad %27 %41 + %44 = OpFOrdGreaterThanEqual %43 %34 %42 + %47 = OpSelect %6 %44 %45 %46 + %48 = OpSLessThan %43 %26 %47 + OpBranchConditional %48 %22 %23 + %22 = OpLabel + %49 = OpLoad %6 %20 + %50 = OpAccessChain %17 %14 %15 %16 + %51 = OpLoad %6 %50 + %52 = OpIEqual %43 %49 %51 + OpSelectionMerge %55 None + OpBranchConditional %52 %54 %59 + %54 = OpLabel + %56 = OpAccessChain %17 %14 %15 %16 + %57 = OpLoad %6 %56 + %58 = OpSNegate %6 %57 + OpStore %53 %58 + OpBranch %55 + %59 = OpLabel + %60 = OpAccessChain %17 %14 %15 %16 + %61 = OpLoad %6 %60 + OpStore %53 %61 + OpBranch %55 + %55 = OpLabel + %62 = OpLoad %6 %53 + %63 = OpLoad %6 %8 + %64 = OpIAdd %6 %63 %62 + OpStore %8 %64 + OpBranch %24 + %24 = OpLabel + %65 = OpLoad %6 %20 + %66 = OpIAdd %6 %65 %16 + OpStore %20 %66 + OpBranch %21 + %23 = OpLabel + %67 = OpLoad %6 %8 + %69 = OpAccessChain %17 %14 %15 %68 + %70 = OpLoad %6 %69 + %71 = OpIEqual %43 %67 %70 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %89 + %72 = OpLabel + %76 = OpAccessChain %17 %14 %15 %16 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %27 %77 + %79 = OpAccessChain %17 %14 %15 %15 + %80 = OpLoad %6 %79 + %81 = OpConvertSToF %27 %80 + %82 = OpAccessChain %17 %14 %15 %15 + %83 = OpLoad %6 %82 + %84 = OpConvertSToF %27 %83 + %85 = OpAccessChain %17 %14 %15 %16 + %86 = OpLoad %6 %85 + %87 = OpConvertSToF %27 %86 + %88 = OpCompositeConstruct %28 %78 %81 %84 %87 + OpStore %75 %88 + OpBranch %73 + %89 = OpLabel + %90 = OpAccessChain %17 %14 %15 %15 + %91 = OpLoad %6 %90 + %92 = OpConvertSToF %27 %91 + %93 = OpCompositeConstruct %28 %92 %92 %92 %92 + OpStore %75 %93 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 18 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fragcoord-multiple-conditions-function-global-loop-counter-simplified.amber b/vulkan/amber/graphicsfuzz/cov-fragcoord-multiple-conditions-function-global-loop-counter-simplified.amber new file mode 100644 index 0000000..950d2cb --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fragcoord-multiple-conditions-function-global-loop-counter-simplified.amber @@ -0,0 +1,390 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--copy-propagate-arrays' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--private-to-local' +# '--reduce-load-size' +# '--eliminate-dead-code-aggressive' +# '--ccp' +# '--reduce-load-size' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-block' +# '--eliminate-dead-code-aggressive' +# '--redundancy-elimination' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-multi-store' +# '--reduce-load-size' +# '--inline-entry-points-exhaustive' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-multi-store' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-local-single-store' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Returns values 1.0 or greater. +# float func(float x) +# { +# float f = 1.0; +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# +# f += _float_1_0; +# _GLF_color = vec4(_float_0_0); +# +# // Always true. +# if(gl_FragCoord.x >= _float_0_0) +# { +# _GLF_color = vec4(_float_1_0); +# } +# +# // Always false. +# if(x < _float_0_0) +# { +# return f; +# } +# } +# +# return f; +# } +# +# void main() +# { +# // Always false. +# if(gl_FragCoord.x < 0.1) +# { +# return; +# } +# +# // Always false. +# if(gl_FragCoord.y < 0.1) +# { +# return; +# } +# +# // v becomes (x, 0, 0, x), where x >= 1. +# vec4 v = vec4(_float_0_0); +# v.x = v.w = func(gl_FragCoord.y); +# +# // Always false. +# if(gl_FragCoord.x < 0.0) +# { +# return; +# } +# +# // Result clamps to (1, 0, 0, 1) +# _GLF_color = v; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 171 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %43 %48 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func(f1;" + OpName %9 "x" + OpName %14 "_GLF_global_loop_count" + OpName %16 "f" + OpName %33 "buf0" + OpMemberName %33 0 "_GLF_uniform_float_values" + OpName %35 "" + OpName %43 "_GLF_color" + OpName %48 "gl_FragCoord" + OpName %87 "v" + OpName %91 "param" + OpDecorate %32 ArrayStride 16 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 0 + OpDecorate %43 Location 0 + OpDecorate %48 BuiltIn FragCoord + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %12 = OpTypeInt 32 1 + %13 = OpTypePointer Private %12 + %14 = OpVariable %13 Private + %15 = OpConstant %12 0 + %17 = OpConstant %6 1 + %24 = OpConstant %12 10 + %25 = OpTypeBool + %28 = OpConstant %12 1 + %30 = OpTypeInt 32 0 + %31 = OpConstant %30 2 + %32 = OpTypeArray %6 %31 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpTypePointer Uniform %6 + %41 = OpTypeVector %6 4 + %42 = OpTypePointer Output %41 + %43 = OpVariable %42 Output + %47 = OpTypePointer Input %41 + %48 = OpVariable %47 Input + %49 = OpConstant %30 0 + %50 = OpTypePointer Input %6 + %74 = OpConstant %6 0.100000001 + %79 = OpConstant %30 1 + %86 = OpTypePointer Function %41 + %100 = OpConstant %6 0 + %112 = OpConstantFalse %25 + %113 = OpTypePointer Function %25 + %115 = OpConstantTrue %25 + %132 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %134 = OpVariable %113 Function %112 + %135 = OpVariable %7 Function + %136 = OpVariable %7 Function + %137 = OpVariable %7 Function + %87 = OpVariable %86 Function + %91 = OpVariable %7 Function + OpSelectionMerge %110 None + OpSwitch %49 %111 + %111 = OpLabel + OpStore %14 %15 + %72 = OpAccessChain %50 %48 %49 + %73 = OpLoad %6 %72 + %75 = OpFOrdLessThan %25 %73 %74 + OpSelectionMerge %77 None + OpBranchConditional %75 %76 %77 + %76 = OpLabel + OpBranch %110 + %77 = OpLabel + %80 = OpAccessChain %50 %48 %79 + %81 = OpLoad %6 %80 + %82 = OpFOrdLessThan %25 %81 %74 + OpSelectionMerge %84 None + OpBranchConditional %82 %83 %84 + %83 = OpLabel + OpBranch %110 + %84 = OpLabel + %88 = OpAccessChain %36 %35 %15 %28 + %89 = OpLoad %6 %88 + %90 = OpCompositeConstruct %41 %89 %89 %89 %89 + OpStore %87 %90 + OpStore %91 %81 + OpStore %134 %112 + OpSelectionMerge %169 None + OpSwitch %49 %139 + %139 = OpLabel + OpStore %136 %17 + OpBranch %140 + %140 = OpLabel + %141 = OpPhi %6 %17 %139 %149 %163 + %142 = OpLoad %12 %14 + %143 = OpSLessThan %25 %142 %24 + OpLoopMerge %164 %163 None + OpBranchConditional %143 %144 %164 + %144 = OpLabel + %145 = OpLoad %12 %14 + %146 = OpIAdd %12 %145 %28 + OpStore %14 %146 + %147 = OpAccessChain %36 %35 %15 %15 + %148 = OpLoad %6 %147 + %149 = OpFAdd %6 %141 %148 + OpStore %136 %149 + %150 = OpAccessChain %36 %35 %15 %28 + %151 = OpLoad %6 %150 + %152 = OpCompositeConstruct %41 %151 %151 %151 %151 + OpStore %43 %152 + %153 = OpAccessChain %50 %48 %49 + %154 = OpLoad %6 %153 + %155 = OpFOrdGreaterThanEqual %25 %154 %151 + OpSelectionMerge %158 None + OpBranchConditional %155 %156 %158 + %156 = OpLabel + %157 = OpCompositeConstruct %41 %148 %148 %148 %148 + OpStore %43 %157 + OpBranch %158 + %158 = OpLabel + %160 = OpFOrdLessThan %25 %81 %151 + OpSelectionMerge %162 None + OpBranchConditional %160 %161 %162 + %161 = OpLabel + OpStore %134 %115 + OpStore %135 %149 + OpBranch %164 + %162 = OpLabel + OpBranch %163 + %163 = OpLabel + OpBranch %140 + %164 = OpLabel + %165 = OpPhi %6 %132 %140 %149 %161 + %166 = OpPhi %6 %141 %140 %149 %161 + %167 = OpPhi %25 %112 %140 %115 %161 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %168 + %168 = OpLabel + OpStore %134 %115 + OpStore %135 %166 + OpBranch %169 + %169 = OpLabel + %170 = OpPhi %6 %165 %164 %166 %168 + OpStore %137 %170 + %107 = OpCompositeInsert %41 %170 %90 3 + %109 = OpCompositeInsert %41 %170 %107 0 + OpStore %87 %109 + %101 = OpFOrdLessThan %25 %73 %100 + OpSelectionMerge %103 None + OpBranchConditional %101 %102 %103 + %102 = OpLabel + OpBranch %110 + %103 = OpLabel + OpStore %43 %109 + OpBranch %110 + %110 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %120 = OpVariable %113 Function %112 + %117 = OpVariable %7 Function + %16 = OpVariable %7 Function + OpSelectionMerge %116 None + OpSwitch %49 %119 + %119 = OpLabel + OpStore %16 %17 + OpBranch %18 + %18 = OpLabel + %123 = OpPhi %6 %17 %119 %40 %21 + %23 = OpLoad %12 %14 + %26 = OpSLessThan %25 %23 %24 + OpLoopMerge %20 %21 None + OpBranchConditional %26 %19 %20 + %19 = OpLabel + %27 = OpLoad %12 %14 + %29 = OpIAdd %12 %27 %28 + OpStore %14 %29 + %37 = OpAccessChain %36 %35 %15 %15 + %38 = OpLoad %6 %37 + %40 = OpFAdd %6 %123 %38 + OpStore %16 %40 + %44 = OpAccessChain %36 %35 %15 %28 + %45 = OpLoad %6 %44 + %46 = OpCompositeConstruct %41 %45 %45 %45 %45 + OpStore %43 %46 + %51 = OpAccessChain %50 %48 %49 + %52 = OpLoad %6 %51 + %55 = OpFOrdGreaterThanEqual %25 %52 %45 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %57 + %56 = OpLabel + %60 = OpCompositeConstruct %41 %38 %38 %38 %38 + OpStore %43 %60 + OpBranch %57 + %57 = OpLabel + %61 = OpLoad %6 %9 + %64 = OpFOrdLessThan %25 %61 %45 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + OpStore %120 %115 + OpStore %117 %40 + OpBranch %20 + %66 = OpLabel + OpBranch %21 + %21 = OpLabel + OpBranch %18 + %20 = OpLabel + %130 = OpPhi %6 %132 %18 %40 %65 + %128 = OpPhi %6 %123 %18 %40 %65 + %125 = OpPhi %25 %112 %18 %115 %65 + OpSelectionMerge %121 None + OpBranchConditional %125 %116 %121 + %121 = OpLabel + OpStore %120 %115 + OpStore %117 %128 + OpBranch %116 + %116 = OpLabel + %129 = OpPhi %6 %130 %20 %128 %121 + OpReturnValue %129 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fragcoord-multiply.amber b/vulkan/amber/graphicsfuzz/cov-fragcoord-multiply.amber new file mode 100644 index 0000000..eecce3a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fragcoord-multiply.amber @@ -0,0 +1,250 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _float_0_4 _GLF_uniform_float_values[0] +# #define _float_256_0 _GLF_uniform_float_values[1] +# #define _float_1_0 _GLF_uniform_float_values[2] +# #define _float_0_0 _GLF_uniform_float_values[3] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: 1 +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[1]; +# }; +# // Contents of _GLF_uniform_float_values: [0.4, 256.0, 1.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[4]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always true. +# if(gl_FragCoord.x * _float_256_0 > _float_0_4) +# { +# ivec2 icoord = ivec2(((gl_FragCoord.xy * _float_256_0) - vec2(_float_0_4, _float_1_0))); +# _GLF_color = vec4(_float_1_0, _float_0_0, icoord.x * icoord.y != _int_1 ? _float_0_0 : _float_1_0, _int_1); +# } +# else +# { +# ivec2 icoord = ivec2(((gl_FragCoord.xy * _float_256_0) - vec2(_float_0_4, _float_1_0))); +# _GLF_color = vec4(_float_0_0, _float_0_0, icoord.x, _float_0_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 110 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %51 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "gl_FragCoord" + OpName %17 "buf1" + OpMemberName %17 0 "_GLF_uniform_float_values" + OpName %19 "" + OpName %35 "icoord" + OpName %51 "_GLF_color" + OpName %65 "buf0" + OpMemberName %65 0 "_GLF_uniform_int_values" + OpName %67 "" + OpName %87 "icoord" + OpDecorate %9 BuiltIn FragCoord + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %51 Location 0 + OpDecorate %64 ArrayStride 16 + OpMemberDecorate %65 0 Offset 0 + OpDecorate %65 Block + OpDecorate %67 DescriptorSet 0 + OpDecorate %67 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Input %7 + %9 = OpVariable %8 Input + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 0 + %12 = OpTypePointer Input %6 + %15 = OpConstant %10 4 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypeInt 32 1 + %21 = OpConstant %20 0 + %22 = OpConstant %20 1 + %23 = OpTypePointer Uniform %6 + %29 = OpTypeBool + %33 = OpTypeVector %20 2 + %34 = OpTypePointer Function %33 + %36 = OpTypeVector %6 2 + %44 = OpConstant %20 2 + %50 = OpTypePointer Output %7 + %51 = OpVariable %50 Output + %54 = OpConstant %20 3 + %57 = OpTypePointer Function %20 + %60 = OpConstant %10 1 + %64 = OpTypeArray %20 %60 + %65 = OpTypeStruct %64 + %66 = OpTypePointer Uniform %65 + %67 = OpVariable %66 Uniform + %68 = OpTypePointer Uniform %20 + %72 = OpTypePointer Function %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %35 = OpVariable %34 Function + %73 = OpVariable %72 Function + %87 = OpVariable %34 Function + %13 = OpAccessChain %12 %9 %11 + %14 = OpLoad %6 %13 + %24 = OpAccessChain %23 %19 %21 %22 + %25 = OpLoad %6 %24 + %26 = OpFMul %6 %14 %25 + %27 = OpAccessChain %23 %19 %21 %21 + %28 = OpLoad %6 %27 + %30 = OpFOrdGreaterThan %29 %26 %28 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %86 + %31 = OpLabel + %37 = OpLoad %7 %9 + %38 = OpVectorShuffle %36 %37 %37 0 1 + %39 = OpAccessChain %23 %19 %21 %22 + %40 = OpLoad %6 %39 + %41 = OpVectorTimesScalar %36 %38 %40 + %42 = OpAccessChain %23 %19 %21 %21 + %43 = OpLoad %6 %42 + %45 = OpAccessChain %23 %19 %21 %44 + %46 = OpLoad %6 %45 + %47 = OpCompositeConstruct %36 %43 %46 + %48 = OpFSub %36 %41 %47 + %49 = OpConvertFToS %33 %48 + OpStore %35 %49 + %52 = OpAccessChain %23 %19 %21 %44 + %53 = OpLoad %6 %52 + %55 = OpAccessChain %23 %19 %21 %54 + %56 = OpLoad %6 %55 + %58 = OpAccessChain %57 %35 %11 + %59 = OpLoad %20 %58 + %61 = OpAccessChain %57 %35 %60 + %62 = OpLoad %20 %61 + %63 = OpIMul %20 %59 %62 + %69 = OpAccessChain %68 %67 %21 %21 + %70 = OpLoad %20 %69 + %71 = OpINotEqual %29 %63 %70 + OpSelectionMerge %75 None + OpBranchConditional %71 %74 %78 + %74 = OpLabel + %76 = OpAccessChain %23 %19 %21 %54 + %77 = OpLoad %6 %76 + OpStore %73 %77 + OpBranch %75 + %78 = OpLabel + %79 = OpAccessChain %23 %19 %21 %44 + %80 = OpLoad %6 %79 + OpStore %73 %80 + OpBranch %75 + %75 = OpLabel + %81 = OpLoad %6 %73 + %82 = OpAccessChain %68 %67 %21 %21 + %83 = OpLoad %20 %82 + %84 = OpConvertSToF %6 %83 + %85 = OpCompositeConstruct %7 %53 %56 %81 %84 + OpStore %51 %85 + OpBranch %32 + %86 = OpLabel + %88 = OpLoad %7 %9 + %89 = OpVectorShuffle %36 %88 %88 0 1 + %90 = OpAccessChain %23 %19 %21 %22 + %91 = OpLoad %6 %90 + %92 = OpVectorTimesScalar %36 %89 %91 + %93 = OpAccessChain %23 %19 %21 %21 + %94 = OpLoad %6 %93 + %95 = OpAccessChain %23 %19 %21 %44 + %96 = OpLoad %6 %95 + %97 = OpCompositeConstruct %36 %94 %96 + %98 = OpFSub %36 %92 %97 + %99 = OpConvertFToS %33 %98 + OpStore %87 %99 + %100 = OpAccessChain %23 %19 %21 %54 + %101 = OpLoad %6 %100 + %102 = OpAccessChain %23 %19 %21 %54 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %57 %87 %11 + %105 = OpLoad %20 %104 + %106 = OpConvertSToF %6 %105 + %107 = OpAccessChain %23 %19 %21 %54 + %108 = OpLoad %6 %107 + %109 = OpCompositeConstruct %7 %101 %103 %106 %108 + OpStore %51 %109 + OpBranch %32 + %32 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.4 256.0 1.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-fragcoord-select-always-one.amber b/vulkan/amber/graphicsfuzz/cov-fragcoord-select-always-one.amber new file mode 100644 index 0000000..2fcc91d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-fragcoord-select-always-one.amber @@ -0,0 +1,219 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_5_0 _GLF_uniform_float_values[0] +# #define _float_10_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [5.0, 10.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // a becomes one. +# int a = gl_FragCoord.x > _float_5_0 ? 1 : 1; +# // b becomes one. +# int b = gl_FragCoord.x > _float_10_0 ? max(1, a) : _int_1; +# +# // Always true. +# if(b == 1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %56 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "gl_FragCoord" + OpName %20 "buf0" + OpMemberName %20 0 "_GLF_uniform_float_values" + OpName %22 "" + OpName %31 "b" + OpName %44 "buf1" + OpMemberName %44 0 "_GLF_uniform_int_values" + OpName %46 "" + OpName %56 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %19 ArrayStride 16 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpDecorate %43 ArrayStride 16 + OpMemberDecorate %44 0 Offset 0 + OpDecorate %44 Block + OpDecorate %46 DescriptorSet 0 + OpDecorate %46 Binding 1 + OpDecorate %56 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Input %9 + %18 = OpConstant %13 2 + %19 = OpTypeArray %9 %18 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpConstant %6 0 + %24 = OpTypePointer Uniform %9 + %27 = OpTypeBool + %29 = OpConstant %6 1 + %43 = OpTypeArray %6 %18 + %44 = OpTypeStruct %43 + %45 = OpTypePointer Uniform %44 + %46 = OpVariable %45 Uniform + %47 = OpTypePointer Uniform %6 + %55 = OpTypePointer Output %10 + %56 = OpVariable %55 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %31 = OpVariable %7 Function + %37 = OpVariable %7 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %25 = OpAccessChain %24 %22 %23 %23 + %26 = OpLoad %9 %25 + %28 = OpFOrdGreaterThan %27 %17 %26 + %30 = OpSelect %6 %28 %29 %29 + OpStore %8 %30 + %32 = OpAccessChain %15 %12 %14 + %33 = OpLoad %9 %32 + %34 = OpAccessChain %24 %22 %23 %29 + %35 = OpLoad %9 %34 + %36 = OpFOrdGreaterThan %27 %33 %35 + OpSelectionMerge %39 None + OpBranchConditional %36 %38 %42 + %38 = OpLabel + %40 = OpLoad %6 %8 + %41 = OpExtInst %6 %1 SMax %29 %40 + OpStore %37 %41 + OpBranch %39 + %42 = OpLabel + %48 = OpAccessChain %47 %46 %23 %23 + %49 = OpLoad %6 %48 + OpStore %37 %49 + OpBranch %39 + %39 = OpLabel + %50 = OpLoad %6 %37 + OpStore %31 %50 + %51 = OpLoad %6 %31 + %52 = OpIEqual %27 %51 %29 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %70 + %53 = OpLabel + %57 = OpAccessChain %47 %46 %23 %23 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %9 %58 + %60 = OpAccessChain %47 %46 %23 %29 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %9 %61 + %63 = OpAccessChain %47 %46 %23 %29 + %64 = OpLoad %6 %63 + %65 = OpConvertSToF %9 %64 + %66 = OpAccessChain %47 %46 %23 %23 + %67 = OpLoad %6 %66 + %68 = OpConvertSToF %9 %67 + %69 = OpCompositeConstruct %10 %59 %62 %65 %68 + OpStore %56 %69 + OpBranch %54 + %70 = OpLabel + %71 = OpAccessChain %47 %46 %23 %29 + %72 = OpLoad %6 %71 + %73 = OpConvertSToF %9 %72 + %74 = OpCompositeConstruct %10 %73 %73 %73 %73 + OpStore %56 %74 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 5.0 10.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-always-return-negative-bitfield-extract.amber b/vulkan/amber/graphicsfuzz/cov-function-always-return-negative-bitfield-extract.amber new file mode 100644 index 0000000..751859c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-always-return-negative-bitfield-extract.amber @@ -0,0 +1,358 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // This function always returns vec3(bitfieldExtract(2, 1, 1)) +# // which is a negative number because of sign extension. +# vec3 func(vec2 v) +# { +# // Iterates once. +# for(int i = _int_0; i < _int_1; i++) +# { +# // Always false. +# if(v.x < _float_0_0) +# { +# return vec3(_int_1); +# } +# } +# +# // Iterates once. +# for(int i = 0; i < _int_1; i++) +# { +# // Always true. +# if(v.y > _float_0_0) +# { +# do +# { +# if(gl_FragCoord.x > 5.0) +# { +# // Always true. +# if(!(gl_FragCoord.y < 0.0)) +# { +# return vec3(bitfieldExtract(2, _int_1, _int_1)); +# } +# else +# { +# return vec3(_int_1); +# } +# } +# } +# while(false); +# } +# } +# +# return vec3(bitfieldExtract(_int_2, _int_1, _int_1)); +# } +# +# void main() +# { +# float f = _float_1_0; +# +# // Iterates once. +# do +# { +# f = _float_0_0; +# } +# while(gl_FragCoord.y < 0.0); +# +# // Calls func(vec2(1)). The condition is always true. +# if(func(vec2(_float_1_0) * mat2(_int_1, f, _int_1, f)) != vec3(_int_1)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 319 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %84 %169 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %20 "buf1" + OpMemberName %20 0 "_GLF_uniform_int_values" + OpName %22 "" + OpName %44 "buf0" + OpMemberName %44 0 "_GLF_uniform_float_values" + OpName %46 "" + OpName %84 "gl_FragCoord" + OpName %169 "_GLF_color" + OpDecorate %19 ArrayStride 16 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 1 + OpDecorate %43 ArrayStride 16 + OpMemberDecorate %44 0 Offset 0 + OpDecorate %44 Block + OpDecorate %46 DescriptorSet 0 + OpDecorate %46 Binding 0 + OpDecorate %84 BuiltIn FragCoord + OpDecorate %169 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %9 = OpTypeVector %6 3 + %14 = OpTypeInt 32 1 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 3 + %19 = OpTypeArray %14 %18 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpConstant %14 0 + %24 = OpTypePointer Uniform %14 + %33 = OpConstant %14 1 + %36 = OpTypeBool + %38 = OpConstant %17 0 + %42 = OpConstant %17 2 + %43 = OpTypeArray %6 %42 + %44 = OpTypeStruct %43 + %45 = OpTypePointer Uniform %44 + %46 = OpVariable %45 Uniform + %47 = OpTypePointer Uniform %6 + %70 = OpConstant %17 1 + %82 = OpTypeVector %6 4 + %83 = OpTypePointer Input %82 + %84 = OpVariable %83 Input + %85 = OpTypePointer Input %6 + %88 = OpConstant %6 5 + %94 = OpConstant %6 0 + %99 = OpConstant %14 2 + %114 = OpConstantFalse %36 + %151 = OpTypeMatrix %7 2 + %163 = OpTypeVector %36 3 + %168 = OpTypePointer Output %82 + %169 = OpVariable %168 Output + %195 = OpConstantTrue %36 + %312 = OpUndef %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %131 + %131 = OpLabel + %135 = OpAccessChain %47 %46 %23 %33 + %136 = OpLoad %6 %135 + %137 = OpAccessChain %85 %84 %70 + %138 = OpLoad %6 %137 + %139 = OpFOrdLessThan %36 %138 %94 + OpLoopMerge %133 %131 None + OpBranchConditional %139 %131 %133 + %133 = OpLabel + %140 = OpAccessChain %47 %46 %23 %23 + %141 = OpLoad %6 %140 + %142 = OpCompositeConstruct %7 %141 %141 + %143 = OpAccessChain %24 %22 %23 %33 + %144 = OpLoad %14 %143 + %145 = OpConvertSToF %6 %144 + %153 = OpCompositeConstruct %7 %145 %136 + %155 = OpCompositeConstruct %151 %153 %153 + %156 = OpVectorTimesMatrix %7 %142 %155 + OpSelectionMerge %293 None + OpSwitch %38 %208 + %208 = OpLabel + %209 = OpAccessChain %24 %22 %23 %23 + %210 = OpLoad %14 %209 + OpBranch %211 + %211 = OpLabel + %297 = OpPhi %14 %210 %208 %231 %229 + %216 = OpSLessThan %36 %297 %144 + OpLoopMerge %232 %229 None + OpBranchConditional %216 %217 %232 + %217 = OpLabel + %219 = OpCompositeExtract %6 %156 0 + %222 = OpFOrdLessThan %36 %219 %136 + OpSelectionMerge %228 None + OpBranchConditional %222 %223 %228 + %223 = OpLabel + %227 = OpCompositeConstruct %9 %145 %145 %145 + OpBranch %232 + %228 = OpLabel + OpBranch %229 + %229 = OpLabel + %231 = OpIAdd %14 %297 %33 + OpBranch %211 + %232 = OpLabel + %309 = OpPhi %9 %312 %211 %227 %223 + %298 = OpPhi %36 %114 %211 %195 %223 + OpSelectionMerge %234 None + OpBranchConditional %298 %293 %234 + %234 = OpLabel + OpBranch %235 + %235 = OpLabel + %303 = OpPhi %36 %298 %234 %318 %278 + %300 = OpPhi %14 %23 %234 %280 %278 + %314 = OpPhi %9 %309 %234 %315 %278 + %240 = OpSLessThan %36 %300 %144 + OpLoopMerge %281 %278 None + OpBranchConditional %240 %241 %281 + %241 = OpLabel + %243 = OpCompositeExtract %6 %156 1 + %246 = OpFOrdGreaterThan %36 %243 %136 + OpSelectionMerge %277 None + OpBranchConditional %246 %247 %277 + %247 = OpLabel + OpBranch %248 + %248 = OpLabel + OpLoopMerge %274 %273 None + OpBranch %249 + %249 = OpLabel + %250 = OpAccessChain %85 %84 %38 + %251 = OpLoad %6 %250 + %252 = OpFOrdGreaterThan %36 %251 %88 + OpSelectionMerge %272 None + OpBranchConditional %252 %253 %272 + %253 = OpLabel + %257 = OpLogicalNot %36 %139 + OpSelectionMerge %271 None + OpBranchConditional %257 %258 %266 + %266 = OpLabel + %270 = OpCompositeConstruct %9 %145 %145 %145 + OpBranch %274 + %258 = OpLabel + %263 = OpBitFieldSExtract %14 %99 %144 %144 + %264 = OpConvertSToF %6 %263 + %265 = OpCompositeConstruct %9 %264 %264 %264 + OpBranch %274 + %271 = OpLabel + OpUnreachable + %272 = OpLabel + OpBranch %273 + %273 = OpLabel + OpBranchConditional %114 %248 %274 + %274 = OpLabel + %316 = OpPhi %9 %265 %258 %270 %266 %314 %273 + %301 = OpPhi %36 %195 %258 %195 %266 %303 %273 + OpSelectionMerge %276 None + OpBranchConditional %301 %281 %276 + %276 = OpLabel + OpBranch %277 + %277 = OpLabel + %318 = OpPhi %36 %303 %241 %301 %276 + %315 = OpPhi %9 %314 %241 %316 %276 + OpBranch %278 + %278 = OpLabel + %280 = OpIAdd %14 %300 %33 + OpBranch %235 + %281 = OpLabel + %313 = OpPhi %9 %314 %235 %316 %274 + %307 = OpPhi %36 %303 %235 %301 %274 + OpSelectionMerge %283 None + OpBranchConditional %307 %293 %283 + %283 = OpLabel + %284 = OpAccessChain %24 %22 %23 %99 + %285 = OpLoad %14 %284 + %290 = OpBitFieldSExtract %14 %285 %144 %144 + %291 = OpConvertSToF %6 %290 + %292 = OpCompositeConstruct %9 %291 %291 %291 + OpBranch %293 + %293 = OpLabel + %308 = OpPhi %9 %309 %232 %313 %281 %292 %283 + %162 = OpCompositeConstruct %9 %145 %145 %145 + %164 = OpFUnordNotEqual %163 %308 %162 + %165 = OpAny %36 %164 + OpSelectionMerge %167 None + OpBranchConditional %165 %166 %183 + %183 = OpLabel + %186 = OpConvertSToF %6 %210 + %187 = OpCompositeConstruct %82 %186 %186 %186 %186 + OpStore %169 %187 + OpBranch %167 + %166 = OpLabel + %175 = OpConvertSToF %6 %210 + %182 = OpCompositeConstruct %82 %145 %175 %175 %145 + OpStore %169 %182 + OpBranch %167 + %167 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-argument-uniform-float-loop-never-return.amber b/vulkan/amber/graphicsfuzz/cov-function-argument-uniform-float-loop-never-return.amber new file mode 100644 index 0000000..e389eb9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-argument-uniform-float-loop-never-return.amber @@ -0,0 +1,257 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of resolution: 256.0 +# layout(push_constant) uniform buf_push +# { +# float resolution; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func(float x) +# { +# int a = 1; +# +# for(int i = 0; i < 2; i ++) +# { +# while(a < 80) +# { +# // Always false. +# if(float(a) > x) +# { +# return _int_1; +# } +# +# a++; +# } +# } +# +# // Always returns here. +# return 0; +# } +# +# void main() +# { +# // Always true. +# if(func(resolution) == 0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 89 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %70 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "func(f1;" + OpName %10 "x" + OpName %14 "a" + OpName %16 "i" + OpName %44 "buf0" + OpMemberName %44 0 "_GLF_uniform_int_values" + OpName %46 "" + OpName %57 "buf_push" + OpMemberName %57 0 "resolution" + OpName %59 "" + OpName %60 "param" + OpName %70 "_GLF_color" + OpDecorate %43 ArrayStride 16 + OpMemberDecorate %44 0 Offset 0 + OpDecorate %44 Block + OpDecorate %46 DescriptorSet 0 + OpDecorate %46 Binding 0 + OpMemberDecorate %57 0 Offset 0 + OpDecorate %57 Block + OpDecorate %70 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeInt 32 1 + %9 = OpTypeFunction %8 %7 + %13 = OpTypePointer Function %8 + %15 = OpConstant %8 1 + %17 = OpConstant %8 0 + %24 = OpConstant %8 2 + %25 = OpTypeBool + %33 = OpConstant %8 80 + %41 = OpTypeInt 32 0 + %42 = OpConstant %41 2 + %43 = OpTypeArray %8 %42 + %44 = OpTypeStruct %43 + %45 = OpTypePointer Uniform %44 + %46 = OpVariable %45 Uniform + %47 = OpTypePointer Uniform %8 + %57 = OpTypeStruct %6 + %58 = OpTypePointer PushConstant %57 + %59 = OpVariable %58 PushConstant + %61 = OpTypePointer PushConstant %6 + %68 = OpTypeVector %6 4 + %69 = OpTypePointer Output %68 + %70 = OpVariable %69 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %60 = OpVariable %7 Function + %62 = OpAccessChain %61 %59 %17 + %63 = OpLoad %6 %62 + OpStore %60 %63 + %64 = OpFunctionCall %8 %11 %60 + %65 = OpIEqual %25 %64 %17 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %84 + %66 = OpLabel + %71 = OpAccessChain %47 %46 %17 %17 + %72 = OpLoad %8 %71 + %73 = OpConvertSToF %6 %72 + %74 = OpAccessChain %47 %46 %17 %15 + %75 = OpLoad %8 %74 + %76 = OpConvertSToF %6 %75 + %77 = OpAccessChain %47 %46 %17 %15 + %78 = OpLoad %8 %77 + %79 = OpConvertSToF %6 %78 + %80 = OpAccessChain %47 %46 %17 %17 + %81 = OpLoad %8 %80 + %82 = OpConvertSToF %6 %81 + %83 = OpCompositeConstruct %68 %73 %76 %79 %82 + OpStore %70 %83 + OpBranch %67 + %84 = OpLabel + %85 = OpAccessChain %47 %46 %17 %15 + %86 = OpLoad %8 %85 + %87 = OpConvertSToF %6 %86 + %88 = OpCompositeConstruct %68 %87 %87 %87 %87 + OpStore %70 %88 + OpBranch %67 + %67 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %8 None %9 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %14 = OpVariable %13 Function + %16 = OpVariable %13 Function + OpStore %14 %15 + OpStore %16 %17 + OpBranch %18 + %18 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %23 = OpLoad %8 %16 + %26 = OpSLessThan %25 %23 %24 + OpBranchConditional %26 %19 %20 + %19 = OpLabel + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %8 %14 + %34 = OpSLessThan %25 %32 %33 + OpBranchConditional %34 %28 %29 + %28 = OpLabel + %35 = OpLoad %8 %14 + %36 = OpConvertSToF %6 %35 + %37 = OpLoad %6 %10 + %38 = OpFOrdGreaterThan %25 %36 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + %48 = OpAccessChain %47 %46 %17 %17 + %49 = OpLoad %8 %48 + OpReturnValue %49 + %40 = OpLabel + %51 = OpLoad %8 %14 + %52 = OpIAdd %8 %51 %15 + OpStore %14 %52 + OpBranch %30 + %30 = OpLabel + OpBranch %27 + %29 = OpLabel + OpBranch %21 + %21 = OpLabel + %53 = OpLoad %8 %16 + %54 = OpIAdd %8 %53 %15 + OpStore %16 %54 + OpBranch %18 + %20 = OpLabel + OpReturnValue %17 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE float STD140 DATA + 256.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-call-twice-clamp-global-variable.amber b/vulkan/amber/graphicsfuzz/cov-function-call-twice-clamp-global-variable.amber new file mode 100644 index 0000000..6f89361 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-call-twice-clamp-global-variable.amber @@ -0,0 +1,291 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_10_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0, 10.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float a = 1.0; +# float b = 1.0; +# +# void func() +# { +# // Always true. +# if(gl_FragCoord.y > _float_0_0) +# { +# // Always true. +# if(gl_FragCoord.y > _float_0_0) +# { +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# } +# +# a = 256.0; +# } +# +# // c becomes b = 1. +# float c = 256.0 - a + b; +# // Clamps 10.0 between 0 and 1.0 resulting in 1.0. +# b = clamp(_float_10_0, _float_0_0, c); +# } +# } +# +# void main() +# { +# func(); +# func(); +# +# // Always true. +# if(b == _float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 103 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %19 %78 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %6 "func(" + OpName %10 "_GLF_global_loop_count" + OpName %14 "a" + OpName %16 "b" + OpName %19 "gl_FragCoord" + OpName %27 "buf1" + OpMemberName %27 0 "_GLF_uniform_float_values" + OpName %29 "" + OpName %57 "c" + OpName %78 "_GLF_color" + OpName %81 "buf0" + OpMemberName %81 0 "_GLF_uniform_int_values" + OpName %83 "" + OpDecorate %19 BuiltIn FragCoord + OpDecorate %26 ArrayStride 16 + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 Block + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 1 + OpDecorate %78 Location 0 + OpDecorate %80 ArrayStride 16 + OpMemberDecorate %81 0 Offset 0 + OpDecorate %81 Block + OpDecorate %83 DescriptorSet 0 + OpDecorate %83 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Private %8 + %10 = OpVariable %9 Private + %11 = OpConstant %8 0 + %12 = OpTypeFloat 32 + %13 = OpTypePointer Private %12 + %14 = OpVariable %13 Private + %15 = OpConstant %12 1 + %16 = OpVariable %13 Private + %17 = OpTypeVector %12 4 + %18 = OpTypePointer Input %17 + %19 = OpVariable %18 Input + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 1 + %22 = OpTypePointer Input %12 + %25 = OpConstant %20 3 + %26 = OpTypeArray %12 %25 + %27 = OpTypeStruct %26 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %30 = OpTypePointer Uniform %12 + %33 = OpTypeBool + %50 = OpConstant %8 10 + %53 = OpConstant %8 1 + %55 = OpConstant %12 256 + %56 = OpTypePointer Function %12 + %62 = OpConstant %8 2 + %77 = OpTypePointer Output %17 + %78 = OpVariable %77 Output + %79 = OpConstant %20 2 + %80 = OpTypeArray %8 %79 + %81 = OpTypeStruct %80 + %82 = OpTypePointer Uniform %81 + %83 = OpVariable %82 Uniform + %84 = OpTypePointer Uniform %8 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %10 %11 + OpStore %14 %15 + OpStore %16 %15 + %69 = OpFunctionCall %2 %6 + %70 = OpFunctionCall %2 %6 + %71 = OpLoad %12 %16 + %72 = OpAccessChain %30 %29 %11 %53 + %73 = OpLoad %12 %72 + %74 = OpFOrdEqual %33 %71 %73 + OpSelectionMerge %76 None + OpBranchConditional %74 %75 %98 + %75 = OpLabel + %85 = OpAccessChain %84 %83 %11 %11 + %86 = OpLoad %8 %85 + %87 = OpConvertSToF %12 %86 + %88 = OpAccessChain %84 %83 %11 %53 + %89 = OpLoad %8 %88 + %90 = OpConvertSToF %12 %89 + %91 = OpAccessChain %84 %83 %11 %53 + %92 = OpLoad %8 %91 + %93 = OpConvertSToF %12 %92 + %94 = OpAccessChain %84 %83 %11 %11 + %95 = OpLoad %8 %94 + %96 = OpConvertSToF %12 %95 + %97 = OpCompositeConstruct %17 %87 %90 %93 %96 + OpStore %78 %97 + OpBranch %76 + %98 = OpLabel + %99 = OpAccessChain %84 %83 %11 %53 + %100 = OpLoad %8 %99 + %101 = OpConvertSToF %12 %100 + %102 = OpCompositeConstruct %17 %101 %101 %101 %101 + OpStore %78 %102 + OpBranch %76 + %76 = OpLabel + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %57 = OpVariable %56 Function + %23 = OpAccessChain %22 %19 %21 + %24 = OpLoad %12 %23 + %31 = OpAccessChain %30 %29 %11 %11 + %32 = OpLoad %12 %31 + %34 = OpFOrdGreaterThan %33 %24 %32 + OpSelectionMerge %36 None + OpBranchConditional %34 %35 %36 + %35 = OpLabel + %37 = OpAccessChain %22 %19 %21 + %38 = OpLoad %12 %37 + %39 = OpAccessChain %30 %29 %11 %11 + %40 = OpLoad %12 %39 + %41 = OpFOrdGreaterThan %33 %38 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %43 + %42 = OpLabel + OpBranch %44 + %44 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %8 %10 + %51 = OpSLessThan %33 %49 %50 + OpBranchConditional %51 %45 %46 + %45 = OpLabel + %52 = OpLoad %8 %10 + %54 = OpIAdd %8 %52 %53 + OpStore %10 %54 + OpBranch %47 + %47 = OpLabel + OpBranch %44 + %46 = OpLabel + OpStore %14 %55 + OpBranch %43 + %43 = OpLabel + %58 = OpLoad %12 %14 + %59 = OpFSub %12 %55 %58 + %60 = OpLoad %12 %16 + %61 = OpFAdd %12 %59 %60 + OpStore %57 %61 + %63 = OpAccessChain %30 %29 %11 %62 + %64 = OpLoad %12 %63 + %65 = OpAccessChain %30 %29 %11 %11 + %66 = OpLoad %12 %65 + %67 = OpLoad %12 %57 + %68 = OpExtInst %12 %1 FClamp %64 %66 %67 + OpStore %16 %68 + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 10.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-check-argument-one-always-return-minus-one.amber b/vulkan/amber/graphicsfuzz/cov-function-check-argument-one-always-return-minus-one.amber new file mode 100644 index 0000000..053f0d3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-check-argument-one-always-return-minus-one.amber @@ -0,0 +1,182 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func(int x) +# { +# // Always false. +# if(x == 1) +# { +# return x; +# } +# +# return -1; +# } +# +# void main() +# { +# // Always false. +# if(func(-100) > 0) +# { +# _GLF_color = vec4(_int_0); +# } +# else +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func(i1;" + OpName %9 "x" + OpName %24 "param" + OpName %33 "_GLF_color" + OpName %37 "buf0" + OpMemberName %37 0 "_GLF_uniform_int_values" + OpName %39 "" + OpDecorate %33 Location 0 + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %13 = OpConstant %6 1 + %14 = OpTypeBool + %20 = OpConstant %6 -1 + %23 = OpConstant %6 -100 + %26 = OpConstant %6 0 + %30 = OpTypeFloat 32 + %31 = OpTypeVector %30 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpTypeInt 32 0 + %35 = OpConstant %34 2 + %36 = OpTypeArray %6 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %24 = OpVariable %7 Function + OpStore %24 %23 + %25 = OpFunctionCall %6 %10 %24 + %27 = OpSGreaterThan %14 %25 %26 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %45 + %28 = OpLabel + %41 = OpAccessChain %40 %39 %26 %26 + %42 = OpLoad %6 %41 + %43 = OpConvertSToF %30 %42 + %44 = OpCompositeConstruct %31 %43 %43 %43 %43 + OpStore %33 %44 + OpBranch %29 + %45 = OpLabel + %46 = OpAccessChain %40 %39 %26 %13 + %47 = OpLoad %6 %46 + %48 = OpConvertSToF %30 %47 + %49 = OpAccessChain %40 %39 %26 %26 + %50 = OpLoad %6 %49 + %51 = OpConvertSToF %30 %50 + %52 = OpAccessChain %40 %39 %26 %26 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %30 %53 + %55 = OpAccessChain %40 %39 %26 %13 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %30 %56 + %58 = OpCompositeConstruct %31 %48 %51 %54 %57 + OpStore %33 %58 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %12 = OpLoad %6 %9 + %15 = OpIEqual %14 %12 %13 + OpSelectionMerge %17 None + OpBranchConditional %15 %16 %17 + %16 = OpLabel + %18 = OpLoad %6 %9 + OpReturnValue %18 + %17 = OpLabel + OpReturnValue %20 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-clamp-min-identical-shift-right.amber b/vulkan/amber/graphicsfuzz/cov-function-clamp-min-identical-shift-right.amber new file mode 100644 index 0000000..c96c50a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-clamp-min-identical-shift-right.amber @@ -0,0 +1,192 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_4 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_5 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_6 _GLF_uniform_int_values[4] +# #define _int_0 _GLF_uniform_int_values[5] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [4, 2, 5, 1, 6, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[6]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# int a = _int_1 << _int_6; +# // Returns 2. +# return clamp(a >> _int_5, a >> _int_5, _int_4); +# } +# +# void main() +# { +# // Always true. +# if(func() == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 72 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "a" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %52 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 6 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpConstant %6 3 + %20 = OpTypePointer Uniform %6 + %23 = OpConstant %6 4 + %28 = OpConstant %6 2 + %42 = OpConstant %6 1 + %45 = OpTypeBool + %49 = OpTypeFloat 32 + %50 = OpTypeVector %49 4 + %51 = OpTypePointer Output %50 + %52 = OpVariable %51 Output + %56 = OpConstant %6 5 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %41 = OpFunctionCall %6 %8 + %43 = OpAccessChain %20 %17 %18 %42 + %44 = OpLoad %6 %43 + %46 = OpIEqual %45 %41 %44 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %67 + %47 = OpLabel + %53 = OpAccessChain %20 %17 %18 %19 + %54 = OpLoad %6 %53 + %55 = OpConvertSToF %49 %54 + %57 = OpAccessChain %20 %17 %18 %56 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %49 %58 + %60 = OpAccessChain %20 %17 %18 %56 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %49 %61 + %63 = OpAccessChain %20 %17 %18 %19 + %64 = OpLoad %6 %63 + %65 = OpConvertSToF %49 %64 + %66 = OpCompositeConstruct %50 %55 %59 %62 %65 + OpStore %52 %66 + OpBranch %48 + %67 = OpLabel + %68 = OpAccessChain %20 %17 %18 %56 + %69 = OpLoad %6 %68 + %70 = OpConvertSToF %49 %69 + %71 = OpCompositeConstruct %50 %70 %70 %70 %70 + OpStore %52 %71 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %6 %21 + %24 = OpAccessChain %20 %17 %18 %23 + %25 = OpLoad %6 %24 + %26 = OpShiftLeftLogical %6 %22 %25 + OpStore %11 %26 + %27 = OpLoad %6 %11 + %29 = OpAccessChain %20 %17 %18 %28 + %30 = OpLoad %6 %29 + %31 = OpShiftRightArithmetic %6 %27 %30 + %32 = OpLoad %6 %11 + %33 = OpAccessChain %20 %17 %18 %28 + %34 = OpLoad %6 %33 + %35 = OpShiftRightArithmetic %6 %32 %34 + %36 = OpAccessChain %20 %17 %18 %18 + %37 = OpLoad %6 %36 + %38 = OpExtInst %6 %1 SClamp %31 %35 %37 + OpReturnValue %38 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 4 2 5 1 6 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-divide-argument-until-lt-one.amber b/vulkan/amber/graphicsfuzz/cov-function-divide-argument-until-lt-one.amber new file mode 100644 index 0000000..0f5ef3f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-divide-argument-until-lt-one.amber @@ -0,0 +1,291 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(push_constant) uniform buf_push +# { +# highp vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Returns 0 or 1 as long as x >= 0. +# int func(int x) +# { +# while(x > 1) +# { +# x /= 2; +# } +# +# return x; +# } +# +# void main() +# { +# int a = int(gl_FragCoord.y); +# +# if(true) +# { +# } +# +# // Calls func with an argument of one or a positive integer based on gl_FragCoord. The return value is 0 or 1 which both index the red color. +# _GLF_color = vec4[4](vec4(_int_1, _int_0, _int_0, _int_1), vec4(_int_1, _int_0, _int_0, _int_1), vec4(_int_0), vec4(_int_0))[(injectionSwitch.y < _float_0_0) ? _int_1 : func(a)]; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 117 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %31 %42 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func(i1;" + OpName %9 "x" + OpName %27 "a" + OpName %31 "gl_FragCoord" + OpName %42 "_GLF_color" + OpName %45 "buf1" + OpMemberName %45 0 "_GLF_uniform_int_values" + OpName %47 "" + OpName %88 "buf_push" + OpMemberName %88 0 "injectionSwitch" + OpName %90 "" + OpName %95 "buf0" + OpMemberName %95 0 "_GLF_uniform_float_values" + OpName %97 "" + OpName %108 "param" + OpName %113 "indexable" + OpDecorate %31 BuiltIn FragCoord + OpDecorate %42 Location 0 + OpDecorate %44 ArrayStride 16 + OpMemberDecorate %45 0 Offset 0 + OpDecorate %45 Block + OpDecorate %47 DescriptorSet 0 + OpDecorate %47 Binding 1 + OpMemberDecorate %88 0 Offset 0 + OpDecorate %88 Block + OpDecorate %94 ArrayStride 16 + OpMemberDecorate %95 0 Offset 0 + OpDecorate %95 Block + OpDecorate %97 DescriptorSet 0 + OpDecorate %97 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %18 = OpConstant %6 1 + %19 = OpTypeBool + %21 = OpConstant %6 2 + %28 = OpTypeFloat 32 + %29 = OpTypeVector %28 4 + %30 = OpTypePointer Input %29 + %31 = OpVariable %30 Input + %32 = OpTypeInt 32 0 + %33 = OpConstant %32 1 + %34 = OpTypePointer Input %28 + %38 = OpConstantTrue %19 + %41 = OpTypePointer Output %29 + %42 = OpVariable %41 Output + %43 = OpConstant %32 2 + %44 = OpTypeArray %6 %43 + %45 = OpTypeStruct %44 + %46 = OpTypePointer Uniform %45 + %47 = OpVariable %46 Uniform + %48 = OpConstant %6 0 + %49 = OpTypePointer Uniform %6 + %84 = OpConstant %32 4 + %85 = OpTypeArray %29 %84 + %87 = OpTypeVector %28 2 + %88 = OpTypeStruct %87 + %89 = OpTypePointer PushConstant %88 + %90 = OpVariable %89 PushConstant + %91 = OpTypePointer PushConstant %28 + %94 = OpTypeArray %28 %33 + %95 = OpTypeStruct %94 + %96 = OpTypePointer Uniform %95 + %97 = OpVariable %96 Uniform + %98 = OpTypePointer Uniform %28 + %112 = OpTypePointer Function %85 + %114 = OpTypePointer Function %29 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %27 = OpVariable %7 Function + %102 = OpVariable %7 Function + %108 = OpVariable %7 Function + %113 = OpVariable %112 Function + %35 = OpAccessChain %34 %31 %33 + %36 = OpLoad %28 %35 + %37 = OpConvertFToS %6 %36 + OpStore %27 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + OpBranch %40 + %40 = OpLabel + %50 = OpAccessChain %49 %47 %48 %18 + %51 = OpLoad %6 %50 + %52 = OpConvertSToF %28 %51 + %53 = OpAccessChain %49 %47 %48 %48 + %54 = OpLoad %6 %53 + %55 = OpConvertSToF %28 %54 + %56 = OpAccessChain %49 %47 %48 %48 + %57 = OpLoad %6 %56 + %58 = OpConvertSToF %28 %57 + %59 = OpAccessChain %49 %47 %48 %18 + %60 = OpLoad %6 %59 + %61 = OpConvertSToF %28 %60 + %62 = OpCompositeConstruct %29 %52 %55 %58 %61 + %63 = OpAccessChain %49 %47 %48 %18 + %64 = OpLoad %6 %63 + %65 = OpConvertSToF %28 %64 + %66 = OpAccessChain %49 %47 %48 %48 + %67 = OpLoad %6 %66 + %68 = OpConvertSToF %28 %67 + %69 = OpAccessChain %49 %47 %48 %48 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %28 %70 + %72 = OpAccessChain %49 %47 %48 %18 + %73 = OpLoad %6 %72 + %74 = OpConvertSToF %28 %73 + %75 = OpCompositeConstruct %29 %65 %68 %71 %74 + %76 = OpAccessChain %49 %47 %48 %48 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %28 %77 + %79 = OpCompositeConstruct %29 %78 %78 %78 %78 + %80 = OpAccessChain %49 %47 %48 %48 + %81 = OpLoad %6 %80 + %82 = OpConvertSToF %28 %81 + %83 = OpCompositeConstruct %29 %82 %82 %82 %82 + %86 = OpCompositeConstruct %85 %62 %75 %79 %83 + %92 = OpAccessChain %91 %90 %48 %33 + %93 = OpLoad %28 %92 + %99 = OpAccessChain %98 %97 %48 %48 + %100 = OpLoad %28 %99 + %101 = OpFOrdLessThan %19 %93 %100 + OpSelectionMerge %104 None + OpBranchConditional %101 %103 %107 + %103 = OpLabel + %105 = OpAccessChain %49 %47 %48 %18 + %106 = OpLoad %6 %105 + OpStore %102 %106 + OpBranch %104 + %107 = OpLabel + %109 = OpLoad %6 %27 + OpStore %108 %109 + %110 = OpFunctionCall %6 %10 %108 + OpStore %102 %110 + OpBranch %104 + %104 = OpLabel + %111 = OpLoad %6 %102 + OpStore %113 %86 + %115 = OpAccessChain %114 %113 %111 + %116 = OpLoad %29 %115 + OpStore %42 %116 + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + OpBranch %12 + %12 = OpLabel + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + %17 = OpLoad %6 %9 + %20 = OpSGreaterThan %19 %17 %18 + OpBranchConditional %20 %13 %14 + %13 = OpLabel + %22 = OpLoad %6 %9 + %23 = OpSDiv %6 %22 %21 + OpStore %9 %23 + OpBranch %15 + %15 = OpLabel + OpBranch %12 + %14 = OpLabel + %24 = OpLoad %6 %9 + OpReturnValue %24 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-find-lsb-ivec2-one.amber b/vulkan/amber/graphicsfuzz/cov-function-find-lsb-ivec2-one.amber new file mode 100644 index 0000000..ae9557b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-find-lsb-ivec2-one.amber @@ -0,0 +1,174 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // This function returns 0. +# int func() +# { +# return findLSB(ivec2(1)).g; +# } +# +# void main() +# { +# // Always true. +# if(func() == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %39 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %25 "buf0" + OpMemberName %25 0 "_GLF_uniform_int_values" + OpName %27 "" + OpName %39 "_GLF_color" + OpDecorate %13 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %24 ArrayStride 16 + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 0 + OpDecorate %39 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypeVector %6 2 + %11 = OpConstant %6 1 + %12 = OpConstantComposite %10 %11 %11 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 1 + %17 = OpTypePointer Function %6 + %23 = OpConstant %14 2 + %24 = OpTypeArray %6 %23 + %25 = OpTypeStruct %24 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpConstant %6 0 + %29 = OpTypePointer Uniform %6 + %32 = OpTypeBool + %36 = OpTypeFloat 32 + %37 = OpTypeVector %36 4 + %38 = OpTypePointer Output %37 + %39 = OpVariable %38 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %22 = OpFunctionCall %6 %8 + %30 = OpAccessChain %29 %27 %28 %28 + %31 = OpLoad %6 %30 + %33 = OpIEqual %32 %22 %31 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %53 + %34 = OpLabel + %40 = OpAccessChain %29 %27 %28 %11 + %41 = OpLoad %6 %40 + %42 = OpConvertSToF %36 %41 + %43 = OpAccessChain %29 %27 %28 %28 + %44 = OpLoad %6 %43 + %45 = OpConvertSToF %36 %44 + %46 = OpAccessChain %29 %27 %28 %28 + %47 = OpLoad %6 %46 + %48 = OpConvertSToF %36 %47 + %49 = OpAccessChain %29 %27 %28 %11 + %50 = OpLoad %6 %49 + %51 = OpConvertSToF %36 %50 + %52 = OpCompositeConstruct %37 %42 %45 %48 %51 + OpStore %39 %52 + OpBranch %35 + %53 = OpLabel + %54 = OpAccessChain %29 %27 %28 %28 + %55 = OpLoad %6 %54 + %56 = OpConvertSToF %36 %55 + %57 = OpCompositeConstruct %37 %56 %56 %56 %56 + OpStore %39 %57 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %18 = OpVariable %17 Function + %13 = OpExtInst %10 %1 FindILsb %12 + %16 = OpCompositeExtract %6 %13 1 + OpStore %18 %16 + %19 = OpLoad %6 %18 + OpReturnValue %19 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-fragcoord-condition-always-return.amber b/vulkan/amber/graphicsfuzz/cov-function-fragcoord-condition-always-return.amber new file mode 100644 index 0000000..54c16e1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-fragcoord-condition-always-return.amber @@ -0,0 +1,292 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_2_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_0_0 _GLF_uniform_float_values[2] +# #define _float_300_0 _GLF_uniform_float_values[3] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# // Contents of _GLF_uniform_float_values: [2.0, 1.0, 0.0, 300.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[4]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# // This function always returns 1.0. +# float func(float x) +# { +# while(true) +# { +# do +# { +# // Always false. +# if(gl_FragCoord.y < _float_0_0) +# { +# do +# { +# } +# while(gl_FragCoord.x < _float_0_0); +# } +# +# // Always true. +# if(x < _float_300_0) +# { +# return _float_1_0; +# } +# } +# while(gl_FragCoord.y < _float_0_0); // Always false. +# } +# return _float_2_0; +# } +# +# void main() +# { +# // Always true. +# if(func(gl_FragCoord.x) == _float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 110 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %25 %85 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func(f1;" + OpName %9 "x" + OpName %25 "gl_FragCoord" + OpName %33 "buf1" + OpMemberName %33 0 "_GLF_uniform_float_values" + OpName %35 "" + OpName %75 "param" + OpName %85 "_GLF_color" + OpName %88 "buf0" + OpMemberName %88 0 "_GLF_uniform_int_values" + OpName %90 "" + OpDecorate %25 BuiltIn FragCoord + OpDecorate %32 ArrayStride 16 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 1 + OpDecorate %85 Location 0 + OpDecorate %87 ArrayStride 16 + OpMemberDecorate %88 0 Offset 0 + OpDecorate %88 Block + OpDecorate %90 DescriptorSet 0 + OpDecorate %90 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %17 = OpTypeBool + %18 = OpConstantTrue %17 + %23 = OpTypeVector %6 4 + %24 = OpTypePointer Input %23 + %25 = OpVariable %24 Input + %26 = OpTypeInt 32 0 + %27 = OpConstant %26 1 + %28 = OpTypePointer Input %6 + %31 = OpConstant %26 4 + %32 = OpTypeArray %6 %31 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpTypeInt 32 1 + %37 = OpConstant %36 0 + %38 = OpConstant %36 2 + %39 = OpTypePointer Uniform %6 + %49 = OpConstant %26 0 + %56 = OpConstant %36 3 + %62 = OpConstant %36 1 + %84 = OpTypePointer Output %23 + %85 = OpVariable %84 Output + %86 = OpConstant %26 2 + %87 = OpTypeArray %36 %86 + %88 = OpTypeStruct %87 + %89 = OpTypePointer Uniform %88 + %90 = OpVariable %89 Uniform + %91 = OpTypePointer Uniform %36 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %75 = OpVariable %7 Function + %76 = OpAccessChain %28 %25 %49 + %77 = OpLoad %6 %76 + OpStore %75 %77 + %78 = OpFunctionCall %6 %10 %75 + %79 = OpAccessChain %39 %35 %37 %62 + %80 = OpLoad %6 %79 + %81 = OpFOrdEqual %17 %78 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %105 + %82 = OpLabel + %92 = OpAccessChain %91 %90 %37 %37 + %93 = OpLoad %36 %92 + %94 = OpConvertSToF %6 %93 + %95 = OpAccessChain %91 %90 %37 %62 + %96 = OpLoad %36 %95 + %97 = OpConvertSToF %6 %96 + %98 = OpAccessChain %91 %90 %37 %62 + %99 = OpLoad %36 %98 + %100 = OpConvertSToF %6 %99 + %101 = OpAccessChain %91 %90 %37 %37 + %102 = OpLoad %36 %101 + %103 = OpConvertSToF %6 %102 + %104 = OpCompositeConstruct %23 %94 %97 %100 %103 + OpStore %85 %104 + OpBranch %83 + %105 = OpLabel + %106 = OpAccessChain %91 %90 %37 %62 + %107 = OpLoad %36 %106 + %108 = OpConvertSToF %6 %107 + %109 = OpCompositeConstruct %23 %108 %108 %108 %108 + OpStore %85 %109 + OpBranch %83 + %83 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + OpBranch %12 + %12 = OpLabel + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + OpBranchConditional %18 %13 %14 + %13 = OpLabel + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %20 + %20 = OpLabel + %29 = OpAccessChain %28 %25 %27 + %30 = OpLoad %6 %29 + %40 = OpAccessChain %39 %35 %37 %38 + %41 = OpLoad %6 %40 + %42 = OpFOrdLessThan %17 %30 %41 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %44 + %43 = OpLabel + OpBranch %45 + %45 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %46 + %46 = OpLabel + OpBranch %48 + %48 = OpLabel + %50 = OpAccessChain %28 %25 %49 + %51 = OpLoad %6 %50 + %52 = OpAccessChain %39 %35 %37 %38 + %53 = OpLoad %6 %52 + %54 = OpFOrdLessThan %17 %51 %53 + OpBranchConditional %54 %45 %47 + %47 = OpLabel + OpBranch %44 + %44 = OpLabel + %55 = OpLoad %6 %9 + %57 = OpAccessChain %39 %35 %37 %56 + %58 = OpLoad %6 %57 + %59 = OpFOrdLessThan %17 %55 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %60 %61 + %60 = OpLabel + %63 = OpAccessChain %39 %35 %37 %62 + %64 = OpLoad %6 %63 + OpReturnValue %64 + %61 = OpLabel + OpBranch %22 + %22 = OpLabel + %66 = OpAccessChain %28 %25 %27 + %67 = OpLoad %6 %66 + %68 = OpAccessChain %39 %35 %37 %38 + %69 = OpLoad %6 %68 + %70 = OpFOrdLessThan %17 %67 %69 + OpBranchConditional %70 %19 %21 + %21 = OpLabel + OpBranch %15 + %15 = OpLabel + OpBranch %12 + %14 = OpLabel + %71 = OpAccessChain %39 %35 %37 %37 + %72 = OpLoad %6 %71 + OpReturnValue %72 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 1.0 0.0 300.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-global-loop-counter-sample-texture.amber b/vulkan/amber/graphicsfuzz/cov-function-global-loop-counter-sample-texture.amber new file mode 100644 index 0000000..aa177e9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-global-loop-counter-sample-texture.amber @@ -0,0 +1,605 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_4 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 4, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(push_constant) uniform buf_push +# { +# highp vec2 injectionSwitch; +# }; +# +# layout(set = 0, binding = 2) uniform sampler2D tex; +# +# layout(location = 0) out vec4 _GLF_color; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# void func() +# { +# int arr[10] = int[10](_int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0); +# int a = _int_1; +# int b = _int_1; +# +# // Iterates once. +# for(int i = _int_1; i != _int_0; i--) +# { +# _GLF_global_loop_count++; +# +# // Iterates once. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# // Always false. +# if(b >= _int_4) +# { +# break; +# } +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# } +# +# // These array values are not used. +# arr[a++] = _int_1; +# } +# } +# } +# +# void main() +# { +# int a = 1; +# +# // Iterates once. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# int b = _int_1; +# +# // Iterates four times. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# if(b >= _int_4) +# { +# break; +# } +# +# b++; +# } +# +# // Always false. +# if(a >= 4) +# { +# break; +# } +# +# // Always true. +# if(gl_FragCoord.y > _float_0_0) +# { +# a++; +# } +# +# // Always false. +# if(gl_FragCoord.y < _float_0_0) +# { +# return; +# } +# +# // Always true. +# if(gl_FragCoord.x > _float_0_0) +# { +# // Iterates once (the global loop bound gets reached inside func()). +# for(int i = _int_1; i != int(injectionSwitch.x) && _GLF_global_loop_count < _GLF_global_loop_bound; i++) +# { +# _GLF_global_loop_count++; +# func(); +# } +# } +# } +# +# // Always true. +# if(a == _int_2) +# { +# // Texture sample is (0, 0, 0, 0). +# _GLF_color = texture(tex, vec2(_int_0)) + vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 238 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %141 %208 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %6 "func(" + OpName %10 "_GLF_global_loop_count" + OpName %16 "arr" + OpName %19 "buf1" + OpMemberName %19 0 "_GLF_uniform_int_values" + OpName %21 "" + OpName %46 "a" + OpName %49 "b" + OpName %52 "i" + OpName %101 "a" + OpName %111 "b" + OpName %141 "gl_FragCoord" + OpName %147 "buf0" + OpMemberName %147 0 "_GLF_uniform_float_values" + OpName %149 "" + OpName %174 "i" + OpName %184 "buf_push" + OpMemberName %184 0 "injectionSwitch" + OpName %186 "" + OpName %208 "_GLF_color" + OpName %212 "tex" + OpDecorate %18 ArrayStride 16 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 1 + OpDecorate %141 BuiltIn FragCoord + OpDecorate %146 ArrayStride 16 + OpMemberDecorate %147 0 Offset 0 + OpDecorate %147 Block + OpDecorate %149 DescriptorSet 0 + OpDecorate %149 Binding 0 + OpMemberDecorate %184 0 Offset 0 + OpDecorate %184 Block + OpDecorate %208 Location 0 + OpDecorate %212 RelaxedPrecision + OpDecorate %212 DescriptorSet 0 + OpDecorate %212 Binding 2 + OpDecorate %213 RelaxedPrecision + OpDecorate %216 RelaxedPrecision + OpDecorate %217 RelaxedPrecision + OpDecorate %218 RelaxedPrecision + OpDecorate %221 RelaxedPrecision + OpDecorate %224 RelaxedPrecision + OpDecorate %227 RelaxedPrecision + OpDecorate %230 RelaxedPrecision + OpDecorate %231 RelaxedPrecision + OpDecorate %232 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Private %8 + %10 = OpVariable %9 Private + %11 = OpConstant %8 0 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 10 + %14 = OpTypeArray %8 %13 + %15 = OpTypePointer Function %14 + %17 = OpConstant %12 4 + %18 = OpTypeArray %8 %17 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpConstant %8 1 + %23 = OpTypePointer Uniform %8 + %45 = OpTypePointer Function %8 + %63 = OpTypeBool + %73 = OpConstant %8 10 + %78 = OpConstant %8 2 + %133 = OpConstant %8 4 + %138 = OpTypeFloat 32 + %139 = OpTypeVector %138 4 + %140 = OpTypePointer Input %139 + %141 = OpVariable %140 Input + %142 = OpConstant %12 1 + %143 = OpTypePointer Input %138 + %146 = OpTypeArray %138 %142 + %147 = OpTypeStruct %146 + %148 = OpTypePointer Uniform %147 + %149 = OpVariable %148 Uniform + %150 = OpTypePointer Uniform %138 + %166 = OpConstant %12 0 + %183 = OpTypeVector %138 2 + %184 = OpTypeStruct %183 + %185 = OpTypePointer PushConstant %184 + %186 = OpVariable %185 PushConstant + %187 = OpTypePointer PushConstant %138 + %201 = OpConstant %8 3 + %207 = OpTypePointer Output %139 + %208 = OpVariable %207 Output + %209 = OpTypeImage %138 2D 0 0 0 1 Unknown + %210 = OpTypeSampledImage %209 + %211 = OpTypePointer UniformConstant %210 + %212 = OpVariable %211 UniformConstant + %4 = OpFunction %2 None %3 + %5 = OpLabel + %101 = OpVariable %45 Function + %111 = OpVariable %45 Function + %174 = OpVariable %45 Function + OpStore %10 %11 + OpStore %101 %22 + OpBranch %102 + %102 = OpLabel + OpLoopMerge %104 %105 None + OpBranch %106 + %106 = OpLabel + %107 = OpLoad %8 %10 + %108 = OpSLessThan %63 %107 %73 + OpBranchConditional %108 %103 %104 + %103 = OpLabel + %109 = OpLoad %8 %10 + %110 = OpIAdd %8 %109 %22 + OpStore %10 %110 + %112 = OpAccessChain %23 %21 %11 %11 + %113 = OpLoad %8 %112 + OpStore %111 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %116 %117 None + OpBranch %118 + %118 = OpLabel + %119 = OpLoad %8 %10 + %120 = OpSLessThan %63 %119 %73 + OpBranchConditional %120 %115 %116 + %115 = OpLabel + %121 = OpLoad %8 %10 + %122 = OpIAdd %8 %121 %22 + OpStore %10 %122 + %123 = OpLoad %8 %111 + %124 = OpAccessChain %23 %21 %11 %78 + %125 = OpLoad %8 %124 + %126 = OpSGreaterThanEqual %63 %123 %125 + OpSelectionMerge %128 None + OpBranchConditional %126 %127 %128 + %127 = OpLabel + OpBranch %116 + %128 = OpLabel + %130 = OpLoad %8 %111 + %131 = OpIAdd %8 %130 %22 + OpStore %111 %131 + OpBranch %117 + %117 = OpLabel + OpBranch %114 + %116 = OpLabel + %132 = OpLoad %8 %101 + %134 = OpSGreaterThanEqual %63 %132 %133 + OpSelectionMerge %136 None + OpBranchConditional %134 %135 %136 + %135 = OpLabel + OpBranch %104 + %136 = OpLabel + %144 = OpAccessChain %143 %141 %142 + %145 = OpLoad %138 %144 + %151 = OpAccessChain %150 %149 %11 %11 + %152 = OpLoad %138 %151 + %153 = OpFOrdGreaterThan %63 %145 %152 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %156 = OpLoad %8 %101 + %157 = OpIAdd %8 %156 %22 + OpStore %101 %157 + OpBranch %155 + %155 = OpLabel + %158 = OpAccessChain %143 %141 %142 + %159 = OpLoad %138 %158 + %160 = OpAccessChain %150 %149 %11 %11 + %161 = OpLoad %138 %160 + %162 = OpFOrdLessThan %63 %159 %161 + OpSelectionMerge %164 None + OpBranchConditional %162 %163 %164 + %163 = OpLabel + OpReturn + %164 = OpLabel + %167 = OpAccessChain %143 %141 %166 + %168 = OpLoad %138 %167 + %169 = OpAccessChain %150 %149 %11 %11 + %170 = OpLoad %138 %169 + %171 = OpFOrdGreaterThan %63 %168 %170 + OpSelectionMerge %173 None + OpBranchConditional %171 %172 %173 + %172 = OpLabel + %175 = OpAccessChain %23 %21 %11 %11 + %176 = OpLoad %8 %175 + OpStore %174 %176 + OpBranch %177 + %177 = OpLabel + OpLoopMerge %179 %180 None + OpBranch %181 + %181 = OpLabel + %182 = OpLoad %8 %174 + %188 = OpAccessChain %187 %186 %11 %166 + %189 = OpLoad %138 %188 + %190 = OpConvertFToS %8 %189 + %191 = OpINotEqual %63 %182 %190 + %192 = OpLoad %8 %10 + %193 = OpSLessThan %63 %192 %73 + %194 = OpLogicalAnd %63 %191 %193 + OpBranchConditional %194 %178 %179 + %178 = OpLabel + %195 = OpLoad %8 %10 + %196 = OpIAdd %8 %195 %22 + OpStore %10 %196 + %197 = OpFunctionCall %2 %6 + OpBranch %180 + %180 = OpLabel + %198 = OpLoad %8 %174 + %199 = OpIAdd %8 %198 %22 + OpStore %174 %199 + OpBranch %177 + %179 = OpLabel + OpBranch %173 + %173 = OpLabel + OpBranch %105 + %105 = OpLabel + OpBranch %102 + %104 = OpLabel + %200 = OpLoad %8 %101 + %202 = OpAccessChain %23 %21 %11 %201 + %203 = OpLoad %8 %202 + %204 = OpIEqual %63 %200 %203 + OpSelectionMerge %206 None + OpBranchConditional %204 %205 %233 + %205 = OpLabel + %213 = OpLoad %210 %212 + %214 = OpAccessChain %23 %21 %11 %22 + %215 = OpLoad %8 %214 + %216 = OpConvertSToF %138 %215 + %217 = OpCompositeConstruct %183 %216 %216 + %218 = OpImageSampleImplicitLod %139 %213 %217 + %219 = OpAccessChain %23 %21 %11 %11 + %220 = OpLoad %8 %219 + %221 = OpConvertSToF %138 %220 + %222 = OpAccessChain %23 %21 %11 %22 + %223 = OpLoad %8 %222 + %224 = OpConvertSToF %138 %223 + %225 = OpAccessChain %23 %21 %11 %22 + %226 = OpLoad %8 %225 + %227 = OpConvertSToF %138 %226 + %228 = OpAccessChain %23 %21 %11 %11 + %229 = OpLoad %8 %228 + %230 = OpConvertSToF %138 %229 + %231 = OpCompositeConstruct %139 %221 %224 %227 %230 + %232 = OpFAdd %139 %218 %231 + OpStore %208 %232 + OpBranch %206 + %233 = OpLabel + %234 = OpAccessChain %23 %21 %11 %22 + %235 = OpLoad %8 %234 + %236 = OpConvertSToF %138 %235 + %237 = OpCompositeConstruct %139 %236 %236 %236 %236 + OpStore %208 %237 + OpBranch %206 + %206 = OpLabel + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %16 = OpVariable %15 Function + %46 = OpVariable %45 Function + %49 = OpVariable %45 Function + %52 = OpVariable %45 Function + %24 = OpAccessChain %23 %21 %11 %22 + %25 = OpLoad %8 %24 + %26 = OpAccessChain %23 %21 %11 %22 + %27 = OpLoad %8 %26 + %28 = OpAccessChain %23 %21 %11 %22 + %29 = OpLoad %8 %28 + %30 = OpAccessChain %23 %21 %11 %22 + %31 = OpLoad %8 %30 + %32 = OpAccessChain %23 %21 %11 %22 + %33 = OpLoad %8 %32 + %34 = OpAccessChain %23 %21 %11 %22 + %35 = OpLoad %8 %34 + %36 = OpAccessChain %23 %21 %11 %22 + %37 = OpLoad %8 %36 + %38 = OpAccessChain %23 %21 %11 %22 + %39 = OpLoad %8 %38 + %40 = OpAccessChain %23 %21 %11 %22 + %41 = OpLoad %8 %40 + %42 = OpAccessChain %23 %21 %11 %22 + %43 = OpLoad %8 %42 + %44 = OpCompositeConstruct %14 %25 %27 %29 %31 %33 %35 %37 %39 %41 %43 + OpStore %16 %44 + %47 = OpAccessChain %23 %21 %11 %11 + %48 = OpLoad %8 %47 + OpStore %46 %48 + %50 = OpAccessChain %23 %21 %11 %11 + %51 = OpLoad %8 %50 + OpStore %49 %51 + %53 = OpAccessChain %23 %21 %11 %11 + %54 = OpLoad %8 %53 + OpStore %52 %54 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %8 %52 + %61 = OpAccessChain %23 %21 %11 %22 + %62 = OpLoad %8 %61 + %64 = OpINotEqual %63 %60 %62 + OpBranchConditional %64 %56 %57 + %56 = OpLabel + %65 = OpLoad %8 %10 + %66 = OpIAdd %8 %65 %22 + OpStore %10 %66 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %72 = OpLoad %8 %10 + %74 = OpSLessThan %63 %72 %73 + OpBranchConditional %74 %68 %69 + %68 = OpLabel + %75 = OpLoad %8 %10 + %76 = OpIAdd %8 %75 %22 + OpStore %10 %76 + %77 = OpLoad %8 %49 + %79 = OpAccessChain %23 %21 %11 %78 + %80 = OpLoad %8 %79 + %81 = OpSGreaterThanEqual %63 %77 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %83 + %82 = OpLabel + OpBranch %69 + %83 = OpLabel + OpBranch %85 + %85 = OpLabel + OpLoopMerge %87 %88 None + OpBranch %89 + %89 = OpLabel + %90 = OpLoad %8 %10 + %91 = OpSLessThan %63 %90 %73 + OpBranchConditional %91 %86 %87 + %86 = OpLabel + %92 = OpLoad %8 %10 + %93 = OpIAdd %8 %92 %22 + OpStore %10 %93 + OpBranch %88 + %88 = OpLabel + OpBranch %85 + %87 = OpLabel + %94 = OpLoad %8 %46 + %95 = OpIAdd %8 %94 %22 + OpStore %46 %95 + %96 = OpAccessChain %23 %21 %11 %11 + %97 = OpLoad %8 %96 + %98 = OpAccessChain %45 %16 %94 + OpStore %98 %97 + OpBranch %70 + %70 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %58 + %58 = OpLabel + %99 = OpLoad %8 %52 + %100 = OpISub %8 %99 %22 + OpStore %52 %100 + OpBranch %55 + %57 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# tex +SAMPLER variant_tex + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 4 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant_injectionSwitch AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-global-variables-fragcoord-condition-call-twice.amber b/vulkan/amber/graphicsfuzz/cov-function-global-variables-fragcoord-condition-call-twice.amber new file mode 100644 index 0000000..018477b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-global-variables-fragcoord-condition-call-twice.amber @@ -0,0 +1,314 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_2_0 _GLF_uniform_float_values[1] +# #define _float_0_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 2.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# float a = 1.0; +# float b = 1.0; +# +# void func() +# { +# // Always true. +# if(gl_FragCoord.y >= _float_0_0) +# { +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# } +# +# a = 1.0; +# } +# +# // During the first call to func: +# // b = b - b * (1 - a) - 1 = 1 - 1 * (1 - 1) - 1 = 1 - 1 * 0 - 1 = 1 - 1 = 0 +# // During the second call to func: +# // b = b - b * (1 - a) - 1 = 0 - 0 * (1 - 1) - 1 = 0 - 1 = -1 +# b = b - b * (1.0 - a) - 1.0; +# a *= _float_2_0; +# +# // Has no effect. +# clamp(_float_1_0, _float_1_0, b); +# } +# void main() +# { +# // Always true. +# if(gl_FragCoord.y >= _float_0_0) +# { +# func(); +# } +# +# // Always true. +# if(gl_FragCoord.y >= _float_0_0) +# { +# func(); +# } +# +# // Always true. +# if(b == -_float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 115 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %19 %90 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %6 "func(" + OpName %10 "_GLF_global_loop_count" + OpName %14 "a" + OpName %16 "b" + OpName %19 "gl_FragCoord" + OpName %27 "buf1" + OpMemberName %27 0 "_GLF_uniform_float_values" + OpName %29 "" + OpName %90 "_GLF_color" + OpName %93 "buf0" + OpMemberName %93 0 "_GLF_uniform_int_values" + OpName %95 "" + OpDecorate %19 BuiltIn FragCoord + OpDecorate %26 ArrayStride 16 + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 Block + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 1 + OpDecorate %90 Location 0 + OpDecorate %92 ArrayStride 16 + OpMemberDecorate %93 0 Offset 0 + OpDecorate %93 Block + OpDecorate %95 DescriptorSet 0 + OpDecorate %95 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Private %8 + %10 = OpVariable %9 Private + %11 = OpConstant %8 0 + %12 = OpTypeFloat 32 + %13 = OpTypePointer Private %12 + %14 = OpVariable %13 Private + %15 = OpConstant %12 1 + %16 = OpVariable %13 Private + %17 = OpTypeVector %12 4 + %18 = OpTypePointer Input %17 + %19 = OpVariable %18 Input + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 1 + %22 = OpTypePointer Input %12 + %25 = OpConstant %20 3 + %26 = OpTypeArray %12 %25 + %27 = OpTypeStruct %26 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %30 = OpConstant %8 2 + %31 = OpTypePointer Uniform %12 + %34 = OpTypeBool + %44 = OpConstant %8 10 + %47 = OpConstant %8 1 + %89 = OpTypePointer Output %17 + %90 = OpVariable %89 Output + %91 = OpConstant %20 2 + %92 = OpTypeArray %8 %91 + %93 = OpTypeStruct %92 + %94 = OpTypePointer Uniform %93 + %95 = OpVariable %94 Uniform + %96 = OpTypePointer Uniform %8 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %10 %11 + OpStore %14 %15 + OpStore %16 %15 + %66 = OpAccessChain %22 %19 %21 + %67 = OpLoad %12 %66 + %68 = OpAccessChain %31 %29 %11 %30 + %69 = OpLoad %12 %68 + %70 = OpFOrdGreaterThanEqual %34 %67 %69 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %72 + %71 = OpLabel + %73 = OpFunctionCall %2 %6 + OpBranch %72 + %72 = OpLabel + %74 = OpAccessChain %22 %19 %21 + %75 = OpLoad %12 %74 + %76 = OpAccessChain %31 %29 %11 %30 + %77 = OpLoad %12 %76 + %78 = OpFOrdGreaterThanEqual %34 %75 %77 + OpSelectionMerge %80 None + OpBranchConditional %78 %79 %80 + %79 = OpLabel + %81 = OpFunctionCall %2 %6 + OpBranch %80 + %80 = OpLabel + %82 = OpLoad %12 %16 + %83 = OpAccessChain %31 %29 %11 %11 + %84 = OpLoad %12 %83 + %85 = OpFNegate %12 %84 + %86 = OpFOrdEqual %34 %82 %85 + OpSelectionMerge %88 None + OpBranchConditional %86 %87 %110 + %87 = OpLabel + %97 = OpAccessChain %96 %95 %11 %47 + %98 = OpLoad %8 %97 + %99 = OpConvertSToF %12 %98 + %100 = OpAccessChain %96 %95 %11 %11 + %101 = OpLoad %8 %100 + %102 = OpConvertSToF %12 %101 + %103 = OpAccessChain %96 %95 %11 %11 + %104 = OpLoad %8 %103 + %105 = OpConvertSToF %12 %104 + %106 = OpAccessChain %96 %95 %11 %47 + %107 = OpLoad %8 %106 + %108 = OpConvertSToF %12 %107 + %109 = OpCompositeConstruct %17 %99 %102 %105 %108 + OpStore %90 %109 + OpBranch %88 + %110 = OpLabel + %111 = OpAccessChain %96 %95 %11 %11 + %112 = OpLoad %8 %111 + %113 = OpConvertSToF %12 %112 + %114 = OpCompositeConstruct %17 %113 %113 %113 %113 + OpStore %90 %114 + OpBranch %88 + %88 = OpLabel + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %23 = OpAccessChain %22 %19 %21 + %24 = OpLoad %12 %23 + %32 = OpAccessChain %31 %29 %11 %30 + %33 = OpLoad %12 %32 + %35 = OpFOrdGreaterThanEqual %34 %24 %33 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %37 + %36 = OpLabel + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %8 %10 + %45 = OpSLessThan %34 %43 %44 + OpBranchConditional %45 %39 %40 + %39 = OpLabel + %46 = OpLoad %8 %10 + %48 = OpIAdd %8 %46 %47 + OpStore %10 %48 + OpBranch %41 + %41 = OpLabel + OpBranch %38 + %40 = OpLabel + OpStore %14 %15 + OpBranch %37 + %37 = OpLabel + %49 = OpLoad %12 %16 + %50 = OpLoad %12 %16 + %51 = OpLoad %12 %14 + %52 = OpFSub %12 %15 %51 + %53 = OpFMul %12 %50 %52 + %54 = OpFSub %12 %49 %53 + %55 = OpFSub %12 %54 %15 + OpStore %16 %55 + %56 = OpAccessChain %31 %29 %11 %47 + %57 = OpLoad %12 %56 + %58 = OpLoad %12 %14 + %59 = OpFMul %12 %58 %57 + OpStore %14 %59 + %60 = OpAccessChain %31 %29 %11 %11 + %61 = OpLoad %12 %60 + %62 = OpAccessChain %31 %29 %11 %11 + %63 = OpLoad %12 %62 + %64 = OpLoad %12 %16 + %65 = OpExtInst %12 %1 FClamp %61 %63 %64 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 2.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-index-array-redundant-clamps.amber b/vulkan/amber/graphicsfuzz/cov-function-index-array-redundant-clamps.amber new file mode 100644 index 0000000..81ee7b2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-index-array-redundant-clamps.amber @@ -0,0 +1,207 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [2, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // This function always returns two. +# int func() +# { +# int a = _int_1; +# +# return int[10](_int_1, _int_2, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1)[clamp(clamp(a, 0, 1), 0, 9)]; +# } +# +# void main() +# { +# // Always true. +# if(func() == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 86 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %66 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "a" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %51 "indexable" + OpName %66 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %66 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 3 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpConstant %6 1 + %20 = OpTypePointer Uniform %6 + %43 = OpConstant %12 10 + %44 = OpTypeArray %6 %43 + %48 = OpConstant %6 9 + %50 = OpTypePointer Function %44 + %59 = OpTypeBool + %63 = OpTypeFloat 32 + %64 = OpTypeVector %63 4 + %65 = OpTypePointer Output %64 + %66 = OpVariable %65 Output + %70 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %56 = OpFunctionCall %6 %8 + %57 = OpAccessChain %20 %17 %18 %18 + %58 = OpLoad %6 %57 + %60 = OpIEqual %59 %56 %58 + OpSelectionMerge %62 None + OpBranchConditional %60 %61 %81 + %61 = OpLabel + %67 = OpAccessChain %20 %17 %18 %19 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %63 %68 + %71 = OpAccessChain %20 %17 %18 %70 + %72 = OpLoad %6 %71 + %73 = OpConvertSToF %63 %72 + %74 = OpAccessChain %20 %17 %18 %70 + %75 = OpLoad %6 %74 + %76 = OpConvertSToF %63 %75 + %77 = OpAccessChain %20 %17 %18 %19 + %78 = OpLoad %6 %77 + %79 = OpConvertSToF %63 %78 + %80 = OpCompositeConstruct %64 %69 %73 %76 %79 + OpStore %66 %80 + OpBranch %62 + %81 = OpLabel + %82 = OpAccessChain %20 %17 %18 %70 + %83 = OpLoad %6 %82 + %84 = OpConvertSToF %63 %83 + %85 = OpCompositeConstruct %64 %84 %84 %84 %84 + OpStore %66 %85 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %51 = OpVariable %50 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %6 %21 + OpStore %11 %22 + %23 = OpAccessChain %20 %17 %18 %19 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %20 %17 %18 %18 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %20 %17 %18 %19 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %20 %17 %18 %19 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %20 %17 %18 %19 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %20 %17 %18 %19 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %20 %17 %18 %19 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %20 %17 %18 %19 + %38 = OpLoad %6 %37 + %39 = OpAccessChain %20 %17 %18 %19 + %40 = OpLoad %6 %39 + %41 = OpAccessChain %20 %17 %18 %19 + %42 = OpLoad %6 %41 + %45 = OpCompositeConstruct %44 %24 %26 %28 %30 %32 %34 %36 %38 %40 %42 + %46 = OpLoad %6 %11 + %47 = OpExtInst %6 %1 SClamp %46 %18 %19 + %49 = OpExtInst %6 %1 SClamp %47 %18 %48 + OpStore %51 %45 + %52 = OpAccessChain %10 %51 %49 + %53 = OpLoad %6 %52 + OpReturnValue %53 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-infinite-loop-always-return.amber b/vulkan/amber/graphicsfuzz/cov-function-infinite-loop-always-return.amber new file mode 100644 index 0000000..690527a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-infinite-loop-always-return.amber @@ -0,0 +1,219 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# while(true) +# { +# for(int i = 0; i < 1; i++) +# { +# // Always true. +# if(gl_FragCoord.y > 0.0) +# { +# return 1; +# } +# } +# } +# +# // Never executed. +# return _int_0; +# } +# +# void main() +# { +# // Always true. +# if(func() == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 132 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %31 %61 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %31 "gl_FragCoord" + OpName %46 "buf0" + OpMemberName %46 0 "_GLF_uniform_int_values" + OpName %48 "" + OpName %61 "_GLF_color" + OpDecorate %31 BuiltIn FragCoord + OpDecorate %45 ArrayStride 16 + OpMemberDecorate %46 0 Offset 0 + OpDecorate %46 Block + OpDecorate %48 DescriptorSet 0 + OpDecorate %48 Binding 0 + OpDecorate %61 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %15 = OpTypeBool + %16 = OpConstantTrue %15 + %19 = OpConstant %6 0 + %26 = OpConstant %6 1 + %28 = OpTypeFloat 32 + %29 = OpTypeVector %28 4 + %30 = OpTypePointer Input %29 + %31 = OpVariable %30 Input + %32 = OpTypeInt 32 0 + %33 = OpConstant %32 1 + %34 = OpTypePointer Input %28 + %37 = OpConstant %28 0 + %44 = OpConstant %32 2 + %45 = OpTypeArray %6 %44 + %46 = OpTypeStruct %45 + %47 = OpTypePointer Uniform %46 + %48 = OpVariable %47 Uniform + %49 = OpTypePointer Uniform %6 + %60 = OpTypePointer Output %29 + %61 = OpVariable %60 Output + %84 = OpConstant %32 0 + %85 = OpConstantFalse %15 + %131 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %121 None + OpSwitch %84 %97 + %97 = OpLabel + OpBranch %98 + %98 = OpLabel + %126 = OpPhi %15 %85 %97 %124 %117 + %130 = OpPhi %6 %131 %97 %128 %117 + OpLoopMerge %118 %117 None + OpBranch %101 + %101 = OpLabel + %123 = OpPhi %6 %19 %98 %113 %111 + %104 = OpSLessThan %15 %123 %26 + OpLoopMerge %114 %111 None + OpBranchConditional %104 %105 %114 + %105 = OpLabel + %106 = OpAccessChain %34 %31 %33 + %107 = OpLoad %28 %106 + %108 = OpFOrdGreaterThan %15 %107 %37 + OpSelectionMerge %110 None + OpBranchConditional %108 %109 %110 + %109 = OpLabel + OpBranch %114 + %110 = OpLabel + OpBranch %111 + %111 = OpLabel + %113 = OpIAdd %6 %123 %26 + OpBranch %101 + %114 = OpLabel + %128 = OpPhi %6 %130 %101 %26 %109 + %124 = OpPhi %15 %126 %101 %16 %109 + OpSelectionMerge %116 None + OpBranchConditional %124 %118 %116 + %116 = OpLabel + OpBranch %117 + %117 = OpLabel + OpBranch %98 + %118 = OpLabel + OpSelectionMerge %120 None + OpBranchConditional %124 %121 %120 + %120 = OpLabel + OpBranch %121 + %121 = OpLabel + %55 = OpAccessChain %49 %48 %19 %26 + %56 = OpLoad %6 %55 + %57 = OpIEqual %15 %128 %56 + OpSelectionMerge %59 None + OpBranchConditional %57 %58 %75 + %75 = OpLabel + %76 = OpAccessChain %49 %48 %19 %19 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %28 %77 + %79 = OpCompositeConstruct %29 %78 %78 %78 %78 + OpStore %61 %79 + OpBranch %59 + %58 = OpLabel + %64 = OpConvertSToF %28 %56 + %65 = OpAccessChain %49 %48 %19 %19 + %66 = OpLoad %6 %65 + %67 = OpConvertSToF %28 %66 + %74 = OpCompositeConstruct %29 %64 %67 %67 %64 + OpStore %61 %74 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-infinite-loop-return-identical-condition.amber b/vulkan/amber/graphicsfuzz/cov-function-infinite-loop-return-identical-condition.amber new file mode 100644 index 0000000..38c9baf --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-infinite-loop-return-identical-condition.amber @@ -0,0 +1,266 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of two: 2 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int two; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# while(true) +# { +# // Returns during the first iteration. +# for(int i = two; i > 0; i--) +# { +# // Always true. +# if(two > _int_1) +# { +# return _int_1; +# } +# } +# } +# } +# +# void main() +# { +# int a = _int_0; +# +# // Always true. +# if(two > _int_1) +# { +# a = func(); +# } +# +# // Always true. +# if(a == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 92 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %73 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %18 "i" + OpName %19 "buf1" + OpMemberName %19 0 "two" + OpName %21 "" + OpName %38 "buf0" + OpMemberName %38 0 "_GLF_uniform_int_values" + OpName %40 "" + OpName %53 "a" + OpName %73 "_GLF_color" + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 1 + OpDecorate %37 ArrayStride 16 + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 0 + OpDecorate %73 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %15 = OpTypeBool + %16 = OpConstantTrue %15 + %17 = OpTypePointer Function %6 + %19 = OpTypeStruct %6 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpConstant %6 0 + %23 = OpTypePointer Uniform %6 + %35 = OpTypeInt 32 0 + %36 = OpConstant %35 2 + %37 = OpTypeArray %6 %36 + %38 = OpTypeStruct %37 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %50 = OpConstant %6 1 + %70 = OpTypeFloat 32 + %71 = OpTypeVector %70 4 + %72 = OpTypePointer Output %71 + %73 = OpVariable %72 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %53 = OpVariable %17 Function + %54 = OpAccessChain %23 %40 %22 %50 + %55 = OpLoad %6 %54 + OpStore %53 %55 + %56 = OpAccessChain %23 %21 %22 + %57 = OpLoad %6 %56 + %58 = OpAccessChain %23 %40 %22 %22 + %59 = OpLoad %6 %58 + %60 = OpSGreaterThan %15 %57 %59 + OpSelectionMerge %62 None + OpBranchConditional %60 %61 %62 + %61 = OpLabel + %63 = OpFunctionCall %6 %8 + OpStore %53 %63 + OpBranch %62 + %62 = OpLabel + %64 = OpLoad %6 %53 + %65 = OpAccessChain %23 %40 %22 %22 + %66 = OpLoad %6 %65 + %67 = OpIEqual %15 %64 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %87 + %68 = OpLabel + %74 = OpAccessChain %23 %40 %22 %22 + %75 = OpLoad %6 %74 + %76 = OpConvertSToF %70 %75 + %77 = OpAccessChain %23 %40 %22 %50 + %78 = OpLoad %6 %77 + %79 = OpConvertSToF %70 %78 + %80 = OpAccessChain %23 %40 %22 %50 + %81 = OpLoad %6 %80 + %82 = OpConvertSToF %70 %81 + %83 = OpAccessChain %23 %40 %22 %22 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %70 %84 + %86 = OpCompositeConstruct %71 %76 %79 %82 %85 + OpStore %73 %86 + OpBranch %69 + %87 = OpLabel + %88 = OpAccessChain %23 %40 %22 %50 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %70 %89 + %91 = OpCompositeConstruct %71 %90 %90 %90 %90 + OpStore %73 %91 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %18 = OpVariable %17 Function + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + OpBranchConditional %16 %11 %12 + %11 = OpLabel + %24 = OpAccessChain %23 %21 %22 + %25 = OpLoad %6 %24 + OpStore %18 %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %6 %18 + %32 = OpSGreaterThan %15 %31 %22 + OpBranchConditional %32 %27 %28 + %27 = OpLabel + %33 = OpAccessChain %23 %21 %22 + %34 = OpLoad %6 %33 + %41 = OpAccessChain %23 %40 %22 %22 + %42 = OpLoad %6 %41 + %43 = OpSGreaterThan %15 %34 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %45 + %44 = OpLabel + %46 = OpAccessChain %23 %40 %22 %22 + %47 = OpLoad %6 %46 + OpReturnValue %47 + %45 = OpLabel + OpBranch %29 + %29 = OpLabel + %49 = OpLoad %6 %18 + %51 = OpISub %6 %49 %50 + OpStore %18 %51 + OpBranch %26 + %28 = OpLabel + OpBranch %13 + %13 = OpLabel + OpBranch %10 + %12 = OpLabel + %52 = OpUndef %6 + OpReturnValue %52 + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE int32 STD140 DATA + 2 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-large-array-max-clamp.amber b/vulkan/amber/graphicsfuzz/cov-function-large-array-max-clamp.amber new file mode 100644 index 0000000..6591899 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-large-array-max-clamp.amber @@ -0,0 +1,228 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# +# // Contents of _GLF_uniform_int_values: [0, 2, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# #define ARR int[256](1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) +# +# vec4 func(int a) +# { +# // Always true. +# if(ARR[a] > _int_0 && ARR[a] < _int_2) +# { +# // b becomes 1. +# int b = max(clamp(ARR[a], ARR[a], _int_1), ARR[a]); +# return vec4(b, _int_0, _int_0, _int_1); +# } +# // Never executed. +# return vec4(_int_0); +# } +# +# void main() +# { +# _GLF_color = func(int(gl_FragCoord.y)); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 95 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %87 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "func(i1;" + OpName %11 "a" + OpName %22 "indexable" + OpName %27 "buf0" + OpMemberName %27 0 "_GLF_uniform_int_values" + OpName %29 "" + OpName %38 "indexable" + OpName %47 "b" + OpName %49 "indexable" + OpName %53 "indexable" + OpName %61 "indexable" + OpName %85 "_GLF_color" + OpName %87 "gl_FragCoord" + OpName %93 "param" + OpDecorate %26 ArrayStride 16 + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 Block + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 0 + OpDecorate %85 Location 0 + OpDecorate %87 BuiltIn FragCoord + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFloat 32 + %9 = OpTypeVector %8 4 + %10 = OpTypeFunction %9 %7 + %14 = OpTypeBool + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 256 + %17 = OpTypeArray %6 %16 + %18 = OpConstant %6 1 + %19 = OpConstantComposite %17 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 + %21 = OpTypePointer Function %17 + %25 = OpConstant %15 3 + %26 = OpTypeArray %6 %25 + %27 = OpTypeStruct %26 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %30 = OpConstant %6 0 + %31 = OpTypePointer Uniform %6 + %56 = OpConstant %6 2 + %84 = OpTypePointer Output %9 + %85 = OpVariable %84 Output + %86 = OpTypePointer Input %9 + %87 = OpVariable %86 Input + %88 = OpConstant %15 1 + %89 = OpTypePointer Input %8 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %93 = OpVariable %7 Function + %90 = OpAccessChain %89 %87 %88 + %91 = OpLoad %8 %90 + %92 = OpConvertFToS %6 %91 + OpStore %93 %92 + %94 = OpFunctionCall %9 %12 %93 + OpStore %85 %94 + OpReturn + OpFunctionEnd + %12 = OpFunction %9 None %10 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %22 = OpVariable %21 Function + %38 = OpVariable %21 Function + %47 = OpVariable %7 Function + %49 = OpVariable %21 Function + %53 = OpVariable %21 Function + %61 = OpVariable %21 Function + %20 = OpLoad %6 %11 + OpStore %22 %19 + %23 = OpAccessChain %7 %22 %20 + %24 = OpLoad %6 %23 + %32 = OpAccessChain %31 %29 %30 %30 + %33 = OpLoad %6 %32 + %34 = OpSGreaterThan %14 %24 %33 + OpSelectionMerge %36 None + OpBranchConditional %34 %35 %36 + %35 = OpLabel + %37 = OpLoad %6 %11 + OpStore %38 %19 + %39 = OpAccessChain %7 %38 %37 + %40 = OpLoad %6 %39 + %41 = OpAccessChain %31 %29 %30 %18 + %42 = OpLoad %6 %41 + %43 = OpSLessThan %14 %40 %42 + OpBranch %36 + %36 = OpLabel + %44 = OpPhi %14 %34 %13 %43 %35 + OpSelectionMerge %46 None + OpBranchConditional %44 %45 %46 + %45 = OpLabel + %48 = OpLoad %6 %11 + OpStore %49 %19 + %50 = OpAccessChain %7 %49 %48 + %51 = OpLoad %6 %50 + %52 = OpLoad %6 %11 + OpStore %53 %19 + %54 = OpAccessChain %7 %53 %52 + %55 = OpLoad %6 %54 + %57 = OpAccessChain %31 %29 %30 %56 + %58 = OpLoad %6 %57 + %59 = OpExtInst %6 %1 SClamp %51 %55 %58 + %60 = OpLoad %6 %11 + OpStore %61 %19 + %62 = OpAccessChain %7 %61 %60 + %63 = OpLoad %6 %62 + %64 = OpExtInst %6 %1 SMax %59 %63 + OpStore %47 %64 + %65 = OpLoad %6 %47 + %66 = OpConvertSToF %8 %65 + %67 = OpAccessChain %31 %29 %30 %30 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %8 %68 + %70 = OpAccessChain %31 %29 %30 %30 + %71 = OpLoad %6 %70 + %72 = OpConvertSToF %8 %71 + %73 = OpAccessChain %31 %29 %30 %56 + %74 = OpLoad %6 %73 + %75 = OpConvertSToF %8 %74 + %76 = OpCompositeConstruct %9 %66 %69 %72 %75 + OpReturnValue %76 + %46 = OpLabel + %78 = OpAccessChain %31 %29 %30 %30 + %79 = OpLoad %6 %78 + %80 = OpConvertSToF %8 %79 + %81 = OpCompositeConstruct %9 %80 %80 %80 %80 + OpReturnValue %81 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 2 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-large-loop-always-return-first-iteration.amber b/vulkan/amber/graphicsfuzz/cov-function-large-loop-always-return-first-iteration.amber new file mode 100644 index 0000000..adb0c20 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-large-loop-always-return-first-iteration.amber @@ -0,0 +1,322 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--copy-propagate-arrays' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_800 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 800, 2, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# int a = 1; +# +# for(int i = 1; i < _int_800; i++) +# { +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# continue; +# } +# +# // Always false. +# if(a >= 3) +# { +# if(_float_0_0 > _float_1_0) +# { +# continue; +# } +# break; +# } +# +# a++; +# +# // Always true. +# if(i > 0) +# { +# return a; +# } +# } +# +# return _int_0; +# } +# +# void main() +# { +# // Always true. +# if(func() == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 117 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %35 %88 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "a" + OpName %13 "i" + OpName %23 "buf1" + OpMemberName %23 0 "_GLF_uniform_int_values" + OpName %25 "" + OpName %35 "gl_FragCoord" + OpName %42 "buf0" + OpMemberName %42 0 "_GLF_uniform_float_values" + OpName %44 "" + OpName %88 "_GLF_color" + OpDecorate %22 ArrayStride 16 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 1 + OpDecorate %35 BuiltIn FragCoord + OpDecorate %41 ArrayStride 16 + OpMemberDecorate %42 0 Offset 0 + OpDecorate %42 Block + OpDecorate %44 DescriptorSet 0 + OpDecorate %44 Binding 0 + OpDecorate %88 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 1 + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 4 + %22 = OpTypeArray %6 %21 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpConstant %6 0 + %27 = OpTypePointer Uniform %6 + %30 = OpTypeBool + %32 = OpTypeFloat 32 + %33 = OpTypeVector %32 4 + %34 = OpTypePointer Input %33 + %35 = OpVariable %34 Input + %36 = OpConstant %20 0 + %37 = OpTypePointer Input %32 + %40 = OpConstant %20 2 + %41 = OpTypeArray %32 %40 + %42 = OpTypeStruct %41 + %43 = OpTypePointer Uniform %42 + %44 = OpVariable %43 Uniform + %45 = OpTypePointer Uniform %32 + %53 = OpConstant %6 3 + %81 = OpConstant %6 2 + %87 = OpTypePointer Output %33 + %88 = OpVariable %87 Output + %111 = OpConstantFalse %30 + %112 = OpTypePointer Function %30 + %114 = OpConstantTrue %30 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %80 = OpFunctionCall %6 %8 + %82 = OpAccessChain %27 %25 %26 %81 + %83 = OpLoad %6 %82 + %84 = OpIEqual %30 %80 %83 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %102 + %85 = OpLabel + %89 = OpAccessChain %27 %25 %26 %53 + %90 = OpLoad %6 %89 + %91 = OpConvertSToF %32 %90 + %92 = OpAccessChain %27 %25 %26 %26 + %93 = OpLoad %6 %92 + %94 = OpConvertSToF %32 %93 + %95 = OpAccessChain %27 %25 %26 %26 + %96 = OpLoad %6 %95 + %97 = OpConvertSToF %32 %96 + %98 = OpAccessChain %27 %25 %26 %53 + %99 = OpLoad %6 %98 + %100 = OpConvertSToF %32 %99 + %101 = OpCompositeConstruct %33 %91 %94 %97 %100 + OpStore %88 %101 + OpBranch %86 + %102 = OpLabel + %103 = OpAccessChain %27 %25 %26 %26 + %104 = OpLoad %6 %103 + %105 = OpConvertSToF %32 %104 + %106 = OpCompositeConstruct %33 %105 %105 %105 %105 + OpStore %88 %106 + OpBranch %86 + %86 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %113 = OpVariable %112 Function %111 + %108 = OpVariable %10 Function + %11 = OpVariable %10 Function + %13 = OpVariable %10 Function + OpSelectionMerge %107 None + OpSwitch %36 %110 + %110 = OpLabel + OpStore %11 %12 + OpStore %13 %12 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %18 + %18 = OpLabel + %19 = OpLoad %6 %13 + %28 = OpAccessChain %27 %25 %26 %12 + %29 = OpLoad %6 %28 + %31 = OpSLessThan %30 %19 %29 + OpBranchConditional %31 %15 %16 + %15 = OpLabel + %38 = OpAccessChain %37 %35 %36 + %39 = OpLoad %32 %38 + %46 = OpAccessChain %45 %44 %26 %12 + %47 = OpLoad %32 %46 + %48 = OpFOrdLessThan %30 %39 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %50 + %49 = OpLabel + OpBranch %17 + %50 = OpLabel + %52 = OpLoad %6 %11 + %54 = OpSGreaterThanEqual %30 %52 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + %57 = OpAccessChain %45 %44 %26 %12 + %58 = OpLoad %32 %57 + %59 = OpAccessChain %45 %44 %26 %26 + %60 = OpLoad %32 %59 + %61 = OpFOrdGreaterThan %30 %58 %60 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %63 + %62 = OpLabel + OpBranch %17 + %63 = OpLabel + OpBranch %16 + %56 = OpLabel + %66 = OpLoad %6 %11 + %67 = OpIAdd %6 %66 %12 + OpStore %11 %67 + %68 = OpLoad %6 %13 + %69 = OpSGreaterThan %30 %68 %26 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %71 + %70 = OpLabel + %72 = OpLoad %6 %11 + OpStore %113 %114 + OpStore %108 %72 + OpBranch %16 + %71 = OpLabel + OpBranch %17 + %17 = OpLabel + %74 = OpLoad %6 %13 + %75 = OpIAdd %6 %74 %12 + OpStore %13 %75 + OpBranch %14 + %16 = OpLabel + %116 = OpLoad %30 %113 + OpSelectionMerge %115 None + OpBranchConditional %116 %107 %115 + %115 = OpLabel + %76 = OpAccessChain %27 %25 %26 %26 + %77 = OpLoad %6 %76 + OpStore %113 %114 + OpStore %108 %77 + OpBranch %107 + %107 = OpLabel + %109 = OpLoad %6 %108 + OpReturnValue %109 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 800 2 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-large-loop-break-argument-lte-global-loop-bound.amber b/vulkan/amber/graphicsfuzz/cov-function-large-loop-break-argument-lte-global-loop-bound.amber new file mode 100644 index 0000000..f655742 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-large-loop-break-argument-lte-global-loop-bound.amber @@ -0,0 +1,267 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func(float x) +# { +# for(int i = 1; i < 800 && _GLF_global_loop_count < _GLF_global_loop_bound; i++) +# { +# _GLF_global_loop_count++; +# +# if(float(i) >= x) +# { +# return _int_1; +# } +# } +# +# return 0; +# } +# +# void main() +# { +# // func returns one. +# int a = func(_float_1_0); +# // func returns zero because global loop count has been reached. +# a += func(35.61); +# +# // Always true. +# if(a == 1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 95 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %76 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "func(f1;" + OpName %10 "x" + OpName %14 "_GLF_global_loop_count" + OpName %17 "i" + OpName %43 "buf0" + OpMemberName %43 0 "_GLF_uniform_int_values" + OpName %45 "" + OpName %54 "a" + OpName %57 "buf1" + OpMemberName %57 0 "_GLF_uniform_float_values" + OpName %59 "" + OpName %60 "param" + OpName %66 "param" + OpName %76 "_GLF_color" + OpDecorate %42 ArrayStride 16 + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 0 + OpDecorate %56 ArrayStride 16 + OpMemberDecorate %57 0 Offset 0 + OpDecorate %57 Block + OpDecorate %59 DescriptorSet 0 + OpDecorate %59 Binding 1 + OpDecorate %76 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeInt 32 1 + %9 = OpTypeFunction %8 %7 + %13 = OpTypePointer Private %8 + %14 = OpVariable %13 Private + %15 = OpConstant %8 0 + %16 = OpTypePointer Function %8 + %18 = OpConstant %8 1 + %25 = OpConstant %8 800 + %26 = OpTypeBool + %29 = OpConstant %8 10 + %40 = OpTypeInt 32 0 + %41 = OpConstant %40 2 + %42 = OpTypeArray %8 %41 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %46 = OpTypePointer Uniform %8 + %55 = OpConstant %40 1 + %56 = OpTypeArray %6 %55 + %57 = OpTypeStruct %56 + %58 = OpTypePointer Uniform %57 + %59 = OpVariable %58 Uniform + %61 = OpTypePointer Uniform %6 + %65 = OpConstant %6 35.6100006 + %74 = OpTypeVector %6 4 + %75 = OpTypePointer Output %74 + %76 = OpVariable %75 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %54 = OpVariable %16 Function + %60 = OpVariable %7 Function + %66 = OpVariable %7 Function + OpStore %14 %15 + %62 = OpAccessChain %61 %59 %15 %15 + %63 = OpLoad %6 %62 + OpStore %60 %63 + %64 = OpFunctionCall %8 %11 %60 + OpStore %54 %64 + OpStore %66 %65 + %67 = OpFunctionCall %8 %11 %66 + %68 = OpLoad %8 %54 + %69 = OpIAdd %8 %68 %67 + OpStore %54 %69 + %70 = OpLoad %8 %54 + %71 = OpIEqual %26 %70 %18 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %90 + %72 = OpLabel + %77 = OpAccessChain %46 %45 %15 %15 + %78 = OpLoad %8 %77 + %79 = OpConvertSToF %6 %78 + %80 = OpAccessChain %46 %45 %15 %18 + %81 = OpLoad %8 %80 + %82 = OpConvertSToF %6 %81 + %83 = OpAccessChain %46 %45 %15 %18 + %84 = OpLoad %8 %83 + %85 = OpConvertSToF %6 %84 + %86 = OpAccessChain %46 %45 %15 %15 + %87 = OpLoad %8 %86 + %88 = OpConvertSToF %6 %87 + %89 = OpCompositeConstruct %74 %79 %82 %85 %88 + OpStore %76 %89 + OpBranch %73 + %90 = OpLabel + %91 = OpAccessChain %46 %45 %15 %18 + %92 = OpLoad %8 %91 + %93 = OpConvertSToF %6 %92 + %94 = OpCompositeConstruct %74 %93 %93 %93 %93 + OpStore %76 %94 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %8 None %9 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %17 = OpVariable %16 Function + OpStore %17 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %8 %17 + %27 = OpSLessThan %26 %24 %25 + %28 = OpLoad %8 %14 + %30 = OpSLessThan %26 %28 %29 + %31 = OpLogicalAnd %26 %27 %30 + OpBranchConditional %31 %20 %21 + %20 = OpLabel + %32 = OpLoad %8 %14 + %33 = OpIAdd %8 %32 %18 + OpStore %14 %33 + %34 = OpLoad %8 %17 + %35 = OpConvertSToF %6 %34 + %36 = OpLoad %6 %10 + %37 = OpFOrdGreaterThanEqual %26 %35 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + %47 = OpAccessChain %46 %45 %15 %15 + %48 = OpLoad %8 %47 + OpReturnValue %48 + %39 = OpLabel + OpBranch %22 + %22 = OpLabel + %50 = OpLoad %8 %17 + %51 = OpIAdd %8 %50 %18 + OpStore %17 %51 + OpBranch %19 + %21 = OpLabel + OpReturnValue %15 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-loop-check-determinant-zero-return-vector.amber b/vulkan/amber/graphicsfuzz/cov-function-loop-check-determinant-zero-return-vector.amber new file mode 100644 index 0000000..f00b8fd --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-loop-check-determinant-zero-return-vector.amber @@ -0,0 +1,257 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec4 func() +# { +# do +# { +# _GLF_global_loop_count++; +# +# // Always true. +# if(determinant(mat4(_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, 1, 1, _int_0, 0, 0)) == _float_0_0) +# { +# return vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +# while(_GLF_global_loop_count < _GLF_global_loop_bound); +# +# // Never executed. +# return vec4(_int_0); +# } +# +# void main() +# { +# _GLF_color = func(); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 112 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %110 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "func(" + OpName %13 "_GLF_global_loop_count" + OpName %25 "buf1" + OpMemberName %25 0 "_GLF_uniform_int_values" + OpName %27 "" + OpName %76 "buf0" + OpMemberName %76 0 "_GLF_uniform_float_values" + OpName %78 "" + OpName %110 "_GLF_color" + OpDecorate %24 ArrayStride 16 + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 1 + OpDecorate %75 ArrayStride 16 + OpMemberDecorate %76 0 Offset 0 + OpDecorate %76 Block + OpDecorate %78 DescriptorSet 0 + OpDecorate %78 Binding 0 + OpDecorate %110 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeFunction %7 + %11 = OpTypeInt 32 1 + %12 = OpTypePointer Private %11 + %13 = OpVariable %12 Private + %14 = OpConstant %11 0 + %20 = OpConstant %11 1 + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 2 + %24 = OpTypeArray %11 %23 + %25 = OpTypeStruct %24 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypePointer Uniform %11 + %62 = OpConstant %6 1 + %66 = OpConstant %6 0 + %67 = OpTypeMatrix %7 4 + %74 = OpConstant %22 1 + %75 = OpTypeArray %6 %74 + %76 = OpTypeStruct %75 + %77 = OpTypePointer Uniform %76 + %78 = OpVariable %77 Uniform + %79 = OpTypePointer Uniform %6 + %82 = OpTypeBool + %101 = OpConstant %11 10 + %109 = OpTypePointer Output %7 + %110 = OpVariable %109 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %13 %14 + %111 = OpFunctionCall %7 %9 + OpStore %110 %111 + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + OpBranch %15 + %15 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %16 + %16 = OpLabel + %19 = OpLoad %11 %13 + %21 = OpIAdd %11 %19 %20 + OpStore %13 %21 + %29 = OpAccessChain %28 %27 %14 %14 + %30 = OpLoad %11 %29 + %31 = OpConvertSToF %6 %30 + %32 = OpAccessChain %28 %27 %14 %14 + %33 = OpLoad %11 %32 + %34 = OpConvertSToF %6 %33 + %35 = OpAccessChain %28 %27 %14 %14 + %36 = OpLoad %11 %35 + %37 = OpConvertSToF %6 %36 + %38 = OpAccessChain %28 %27 %14 %14 + %39 = OpLoad %11 %38 + %40 = OpConvertSToF %6 %39 + %41 = OpAccessChain %28 %27 %14 %14 + %42 = OpLoad %11 %41 + %43 = OpConvertSToF %6 %42 + %44 = OpAccessChain %28 %27 %14 %14 + %45 = OpLoad %11 %44 + %46 = OpConvertSToF %6 %45 + %47 = OpAccessChain %28 %27 %14 %14 + %48 = OpLoad %11 %47 + %49 = OpConvertSToF %6 %48 + %50 = OpAccessChain %28 %27 %14 %14 + %51 = OpLoad %11 %50 + %52 = OpConvertSToF %6 %51 + %53 = OpAccessChain %28 %27 %14 %14 + %54 = OpLoad %11 %53 + %55 = OpConvertSToF %6 %54 + %56 = OpAccessChain %28 %27 %14 %14 + %57 = OpLoad %11 %56 + %58 = OpConvertSToF %6 %57 + %59 = OpAccessChain %28 %27 %14 %14 + %60 = OpLoad %11 %59 + %61 = OpConvertSToF %6 %60 + %63 = OpAccessChain %28 %27 %14 %20 + %64 = OpLoad %11 %63 + %65 = OpConvertSToF %6 %64 + %68 = OpCompositeConstruct %7 %31 %34 %37 %40 + %69 = OpCompositeConstruct %7 %43 %46 %49 %52 + %70 = OpCompositeConstruct %7 %55 %58 %61 %62 + %71 = OpCompositeConstruct %7 %62 %65 %66 %66 + %72 = OpCompositeConstruct %67 %68 %69 %70 %71 + %73 = OpExtInst %6 %1 Determinant %72 + %80 = OpAccessChain %79 %78 %14 %14 + %81 = OpLoad %6 %80 + %83 = OpFOrdEqual %82 %73 %81 + OpSelectionMerge %85 None + OpBranchConditional %83 %84 %85 + %84 = OpLabel + %86 = OpAccessChain %28 %27 %14 %14 + %87 = OpLoad %11 %86 + %88 = OpConvertSToF %6 %87 + %89 = OpAccessChain %28 %27 %14 %20 + %90 = OpLoad %11 %89 + %91 = OpConvertSToF %6 %90 + %92 = OpAccessChain %28 %27 %14 %20 + %93 = OpLoad %11 %92 + %94 = OpConvertSToF %6 %93 + %95 = OpAccessChain %28 %27 %14 %14 + %96 = OpLoad %11 %95 + %97 = OpConvertSToF %6 %96 + %98 = OpCompositeConstruct %7 %88 %91 %94 %97 + OpReturnValue %98 + %85 = OpLabel + OpBranch %18 + %18 = OpLabel + %100 = OpLoad %11 %13 + %102 = OpSLessThan %82 %100 %101 + OpBranchConditional %102 %15 %17 + %17 = OpLabel + %103 = OpAccessChain %28 %27 %14 %20 + %104 = OpLoad %11 %103 + %105 = OpConvertSToF %6 %104 + %106 = OpCompositeConstruct %7 %105 %105 %105 %105 + OpReturnValue %106 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-loop-clamp-no-effect.amber b/vulkan/amber/graphicsfuzz/cov-function-loop-clamp-no-effect.amber new file mode 100644 index 0000000..86aeeb7 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-loop-clamp-no-effect.amber @@ -0,0 +1,302 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-local-single-store' +# '--simplify-instructions' +# '--reduce-load-size' +# '--redundancy-elimination' +# '--eliminate-dead-inserts' +# '--eliminate-dead-code-aggressive' +# '--copy-propagate-arrays' +# '--ccp' +# '--if-conversion' +# '--eliminate-local-single-store' +# '--copy-propagate-arrays' +# '--private-to-local' +# '--ccp' +# '--combine-access-chains' +# '--eliminate-dead-branches' +# '--merge-return' +# '--if-conversion' +# '--ccp' +# '--private-to-local' +# '--eliminate-local-single-block' +# '--redundancy-elimination' +# '--eliminate-dead-branches' +# '--merge-return' +# '--reduce-load-size' +# '--reduce-load-size' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _int_9 _GLF_uniform_int_values[4] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 10, 2, 9] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // This function always returns one. +# int func() +# { +# int a = 1; +# int b = 1; +# +# while(a <= 9) +# { +# if(b++ > 7) +# { +# break; +# } +# +# // (a + 9) / 2 is always between 0..10 making the clamp useless. +# // The condition is also always false. +# if(clamp((a + _int_9) / 2, _int_0, _int_10) == _int_1) +# { +# return (a + _int_9) / 2; +# } +# +# // a / 2 is always between 0..10 making the clamp useless. +# // The condition is true during the first iteration where a == 1. +# if(clamp(a / _int_2, _int_0, _int_10) < _int_1) +# { +# a += _int_2; +# } +# } +# +# return 1; +# } +# +# void main() +# { +# // Always true. +# if(func() != 0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 119 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %89 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "a" + OpName %13 "b" + OpName %34 "buf0" + OpMemberName %34 0 "_GLF_uniform_int_values" + OpName %36 "" + OpName %89 "_GLF_color" + OpDecorate %33 ArrayStride 16 + OpMemberDecorate %34 0 Offset 0 + OpDecorate %34 Block + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 0 + OpDecorate %89 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 1 + %20 = OpConstant %6 9 + %21 = OpTypeBool + %25 = OpConstant %6 7 + %31 = OpTypeInt 32 0 + %32 = OpConstant %31 5 + %33 = OpTypeArray %6 %32 + %34 = OpTypeStruct %33 + %35 = OpTypePointer Uniform %34 + %36 = OpVariable %35 Uniform + %37 = OpConstant %6 0 + %38 = OpConstant %6 4 + %39 = OpTypePointer Uniform %6 + %43 = OpConstant %6 2 + %62 = OpConstant %6 3 + %86 = OpTypeFloat 32 + %87 = OpTypeVector %86 4 + %88 = OpTypePointer Output %87 + %89 = OpVariable %88 Output + %112 = OpConstant %31 0 + %113 = OpConstantFalse %21 + %114 = OpTypePointer Function %21 + %116 = OpConstantTrue %21 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %82 = OpFunctionCall %6 %8 + %83 = OpINotEqual %21 %82 %37 + OpSelectionMerge %85 None + OpBranchConditional %83 %84 %103 + %84 = OpLabel + %90 = OpAccessChain %39 %36 %37 %12 + %91 = OpLoad %6 %90 + %92 = OpConvertSToF %86 %91 + %93 = OpAccessChain %39 %36 %37 %37 + %94 = OpLoad %6 %93 + %95 = OpConvertSToF %86 %94 + %102 = OpCompositeConstruct %87 %92 %95 %95 %92 + OpStore %89 %102 + OpBranch %85 + %103 = OpLabel + %104 = OpAccessChain %39 %36 %37 %37 + %105 = OpLoad %6 %104 + %106 = OpConvertSToF %86 %105 + %107 = OpCompositeConstruct %87 %106 %106 %106 %106 + OpStore %89 %107 + OpBranch %85 + %85 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %115 = OpVariable %114 Function %113 + %109 = OpVariable %10 Function + %11 = OpVariable %10 Function + %13 = OpVariable %10 Function + OpSelectionMerge %108 None + OpSwitch %112 %111 + %111 = OpLabel + OpStore %11 %12 + OpStore %13 %12 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %18 + %18 = OpLabel + %19 = OpLoad %6 %11 + %22 = OpSLessThanEqual %21 %19 %20 + OpBranchConditional %22 %15 %16 + %15 = OpLabel + %23 = OpLoad %6 %13 + %24 = OpIAdd %6 %23 %12 + OpStore %13 %24 + %26 = OpSGreaterThan %21 %23 %25 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + OpBranch %16 + %28 = OpLabel + %30 = OpLoad %6 %11 + %40 = OpAccessChain %39 %36 %37 %38 + %41 = OpLoad %6 %40 + %42 = OpIAdd %6 %30 %41 + %44 = OpSDiv %6 %42 %43 + %45 = OpAccessChain %39 %36 %37 %37 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %39 %36 %37 %43 + %48 = OpLoad %6 %47 + %49 = OpExtInst %6 %1 SClamp %44 %46 %48 + %50 = OpAccessChain %39 %36 %37 %12 + %51 = OpLoad %6 %50 + %52 = OpIEqual %21 %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + %55 = OpLoad %6 %11 + %58 = OpIAdd %6 %55 %41 + %59 = OpSDiv %6 %58 %43 + OpStore %115 %116 + OpStore %109 %59 + OpBranch %16 + %54 = OpLabel + %61 = OpLoad %6 %11 + %63 = OpAccessChain %39 %36 %37 %62 + %64 = OpLoad %6 %63 + %65 = OpSDiv %6 %61 %64 + %70 = OpExtInst %6 %1 SClamp %65 %46 %48 + %73 = OpSLessThan %21 %70 %51 + OpSelectionMerge %75 None + OpBranchConditional %73 %74 %75 + %74 = OpLabel + %78 = OpLoad %6 %11 + %79 = OpIAdd %6 %78 %64 + OpStore %11 %79 + OpBranch %75 + %75 = OpLabel + OpBranch %17 + %17 = OpLabel + OpBranch %14 + %16 = OpLabel + %118 = OpLoad %21 %115 + OpSelectionMerge %117 None + OpBranchConditional %118 %108 %117 + %117 = OpLabel + OpStore %115 %116 + OpStore %109 %12 + OpBranch %108 + %108 = OpLabel + %110 = OpLoad %6 %109 + OpReturnValue %110 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 10 2 9 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-loop-condition-constant-array-always-false.amber b/vulkan/amber/graphicsfuzz/cov-function-loop-condition-constant-array-always-false.amber new file mode 100644 index 0000000..8084343 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-loop-condition-constant-array-always-false.amber @@ -0,0 +1,346 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int data0[10] = int[10](5, 5, 5, 5, 5, 5, 5, 5, 5, 5); +# int data1[10] = int[10](9, 8, 7, 6, 5, 4, 3, 2, 1, 0); +# +# void func(int i) +# { +# int j = 0, k = _int_0; +# +# // Iterates twice. +# while(i <= 1 && j <= 1) +# { +# // Always false. +# if(int[10](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1)[i] < _int_1) +# { +# data1[k++] = i++; +# } +# else +# { +# data1[k++] = j++; +# } +# +# // Always false. +# if(_int_1 < _int_0) +# { +# discard; +# } +# } +# +# // Never iterated. +# while(i < 1) +# { +# data1[k++] = data0[i++]; +# } +# +# data0[_int_1] = data1[_int_1]; +# } +# +# void main() +# { +# func(0); +# +# // Always true. +# if(data0[_int_1] == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 156 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %137 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func(i1;" + OpName %9 "i" + OpName %16 "data0" + OpName %19 "data1" + OpName %30 "j" + OpName %31 "k" + OpName %34 "buf0" + OpMemberName %34 0 "_GLF_uniform_int_values" + OpName %36 "" + OpName %74 "indexable" + OpName %123 "param" + OpName %137 "_GLF_color" + OpDecorate %33 ArrayStride 16 + OpMemberDecorate %34 0 Offset 0 + OpDecorate %34 Block + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 0 + OpDecorate %137 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 10 + %14 = OpTypeArray %6 %13 + %15 = OpTypePointer Private %14 + %16 = OpVariable %15 Private + %17 = OpConstant %6 5 + %18 = OpConstantComposite %14 %17 %17 %17 %17 %17 %17 %17 %17 %17 %17 + %19 = OpVariable %15 Private + %20 = OpConstant %6 9 + %21 = OpConstant %6 8 + %22 = OpConstant %6 7 + %23 = OpConstant %6 6 + %24 = OpConstant %6 4 + %25 = OpConstant %6 3 + %26 = OpConstant %6 2 + %27 = OpConstant %6 1 + %28 = OpConstant %6 0 + %29 = OpConstantComposite %14 %20 %21 %22 %23 %17 %24 %25 %26 %27 %28 + %32 = OpConstant %12 2 + %33 = OpTypeArray %6 %32 + %34 = OpTypeStruct %33 + %35 = OpTypePointer Uniform %34 + %36 = OpVariable %35 Uniform + %37 = OpTypePointer Uniform %6 + %46 = OpTypeBool + %73 = OpTypePointer Function %14 + %86 = OpTypePointer Private %6 + %134 = OpTypeFloat 32 + %135 = OpTypeVector %134 4 + %136 = OpTypePointer Output %135 + %137 = OpVariable %136 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %123 = OpVariable %7 Function + OpStore %16 %18 + OpStore %19 %29 + OpStore %123 %28 + %124 = OpFunctionCall %2 %10 %123 + %125 = OpAccessChain %37 %36 %28 %28 + %126 = OpLoad %6 %125 + %127 = OpAccessChain %86 %16 %126 + %128 = OpLoad %6 %127 + %129 = OpAccessChain %37 %36 %28 %28 + %130 = OpLoad %6 %129 + %131 = OpIEqual %46 %128 %130 + OpSelectionMerge %133 None + OpBranchConditional %131 %132 %151 + %132 = OpLabel + %138 = OpAccessChain %37 %36 %28 %28 + %139 = OpLoad %6 %138 + %140 = OpConvertSToF %134 %139 + %141 = OpAccessChain %37 %36 %28 %27 + %142 = OpLoad %6 %141 + %143 = OpConvertSToF %134 %142 + %144 = OpAccessChain %37 %36 %28 %27 + %145 = OpLoad %6 %144 + %146 = OpConvertSToF %134 %145 + %147 = OpAccessChain %37 %36 %28 %28 + %148 = OpLoad %6 %147 + %149 = OpConvertSToF %134 %148 + %150 = OpCompositeConstruct %135 %140 %143 %146 %149 + OpStore %137 %150 + OpBranch %133 + %151 = OpLabel + %152 = OpAccessChain %37 %36 %28 %27 + %153 = OpLoad %6 %152 + %154 = OpConvertSToF %134 %153 + %155 = OpCompositeConstruct %135 %154 %154 %154 %154 + OpStore %137 %155 + OpBranch %133 + %133 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %30 = OpVariable %7 Function + %31 = OpVariable %7 Function + %74 = OpVariable %73 Function + OpStore %30 %28 + %38 = OpAccessChain %37 %36 %28 %27 + %39 = OpLoad %6 %38 + OpStore %31 %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %6 %9 + %47 = OpSLessThanEqual %46 %45 %27 + %48 = OpLoad %6 %30 + %49 = OpSLessThanEqual %46 %48 %27 + %50 = OpLogicalAnd %46 %47 %49 + OpBranchConditional %50 %41 %42 + %41 = OpLabel + %51 = OpAccessChain %37 %36 %28 %28 + %52 = OpLoad %6 %51 + %53 = OpAccessChain %37 %36 %28 %28 + %54 = OpLoad %6 %53 + %55 = OpAccessChain %37 %36 %28 %28 + %56 = OpLoad %6 %55 + %57 = OpAccessChain %37 %36 %28 %28 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %37 %36 %28 %28 + %60 = OpLoad %6 %59 + %61 = OpAccessChain %37 %36 %28 %28 + %62 = OpLoad %6 %61 + %63 = OpAccessChain %37 %36 %28 %28 + %64 = OpLoad %6 %63 + %65 = OpAccessChain %37 %36 %28 %28 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %37 %36 %28 %28 + %68 = OpLoad %6 %67 + %69 = OpAccessChain %37 %36 %28 %28 + %70 = OpLoad %6 %69 + %71 = OpCompositeConstruct %14 %52 %54 %56 %58 %60 %62 %64 %66 %68 %70 + %72 = OpLoad %6 %9 + OpStore %74 %71 + %75 = OpAccessChain %7 %74 %72 + %76 = OpLoad %6 %75 + %77 = OpAccessChain %37 %36 %28 %28 + %78 = OpLoad %6 %77 + %79 = OpSLessThan %46 %76 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %80 %88 + %80 = OpLabel + %82 = OpLoad %6 %31 + %83 = OpIAdd %6 %82 %27 + OpStore %31 %83 + %84 = OpLoad %6 %9 + %85 = OpIAdd %6 %84 %27 + OpStore %9 %85 + %87 = OpAccessChain %86 %19 %82 + OpStore %87 %84 + OpBranch %81 + %88 = OpLabel + %89 = OpLoad %6 %31 + %90 = OpIAdd %6 %89 %27 + OpStore %31 %90 + %91 = OpLoad %6 %30 + %92 = OpIAdd %6 %91 %27 + OpStore %30 %92 + %93 = OpAccessChain %86 %19 %89 + OpStore %93 %91 + OpBranch %81 + %81 = OpLabel + %94 = OpAccessChain %37 %36 %28 %28 + %95 = OpLoad %6 %94 + %96 = OpAccessChain %37 %36 %28 %27 + %97 = OpLoad %6 %96 + %98 = OpSLessThan %46 %95 %97 + OpSelectionMerge %100 None + OpBranchConditional %98 %99 %100 + %99 = OpLabel + OpTerminateInvocation + %100 = OpLabel + OpBranch %43 + %43 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %102 + %102 = OpLabel + OpLoopMerge %104 %105 None + OpBranch %106 + %106 = OpLabel + %107 = OpLoad %6 %9 + %108 = OpSLessThan %46 %107 %27 + OpBranchConditional %108 %103 %104 + %103 = OpLabel + %109 = OpLoad %6 %31 + %110 = OpIAdd %6 %109 %27 + OpStore %31 %110 + %111 = OpLoad %6 %9 + %112 = OpIAdd %6 %111 %27 + OpStore %9 %112 + %113 = OpAccessChain %86 %16 %111 + %114 = OpLoad %6 %113 + %115 = OpAccessChain %86 %19 %109 + OpStore %115 %114 + OpBranch %105 + %105 = OpLabel + OpBranch %102 + %104 = OpLabel + %116 = OpAccessChain %37 %36 %28 %28 + %117 = OpLoad %6 %116 + %118 = OpAccessChain %37 %36 %28 %28 + %119 = OpLoad %6 %118 + %120 = OpAccessChain %86 %19 %119 + %121 = OpLoad %6 %120 + %122 = OpAccessChain %86 %16 %117 + OpStore %122 %121 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-loop-condition-uniform-shift-right.amber b/vulkan/amber/graphicsfuzz/cov-function-loop-condition-uniform-shift-right.amber new file mode 100644 index 0000000..72f46a3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-loop-condition-uniform-shift-right.amber @@ -0,0 +1,287 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_5 _GLF_uniform_int_values[1] +# #define _int_30 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_6 _GLF_uniform_int_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 5, 30, 1, 6] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# // Contents of two: 2 +# layout(push_constant) uniform buf_push +# { +# int two; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Always returns 6. +# int func() +# { +# int a = _int_1; +# +# // Iterated twice. +# for(int j = 0; j != two >> 1; j++) +# { +# while(a < _int_6) +# { +# a++; +# } +# } +# return a; +# } +# +# void main() +# { +# int a = _int_0; +# int b = _int_0; +# +# while(a < _int_5) +# { +# a++; +# b += func(); +# } +# +# // Always true. +# if(b == _int_30) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 106 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %87 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "a" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %23 "j" + OpName %30 "buf_push" + OpMemberName %30 0 "two" + OpName %32 "" + OpName %57 "a" + OpName %60 "b" + OpName %87 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %87 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 5 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpConstant %6 3 + %20 = OpTypePointer Uniform %6 + %30 = OpTypeStruct %6 + %31 = OpTypePointer PushConstant %30 + %32 = OpVariable %31 PushConstant + %33 = OpTypePointer PushConstant %6 + %36 = OpConstant %6 1 + %38 = OpTypeBool + %46 = OpConstant %6 4 + %78 = OpConstant %6 2 + %84 = OpTypeFloat 32 + %85 = OpTypeVector %84 4 + %86 = OpTypePointer Output %85 + %87 = OpVariable %86 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %57 = OpVariable %10 Function + %60 = OpVariable %10 Function + %58 = OpAccessChain %20 %17 %18 %18 + %59 = OpLoad %6 %58 + OpStore %57 %59 + %61 = OpAccessChain %20 %17 %18 %18 + %62 = OpLoad %6 %61 + OpStore %60 %62 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %6 %57 + %69 = OpAccessChain %20 %17 %18 %36 + %70 = OpLoad %6 %69 + %71 = OpSLessThan %38 %68 %70 + OpBranchConditional %71 %64 %65 + %64 = OpLabel + %72 = OpLoad %6 %57 + %73 = OpIAdd %6 %72 %36 + OpStore %57 %73 + %74 = OpFunctionCall %6 %8 + %75 = OpLoad %6 %60 + %76 = OpIAdd %6 %75 %74 + OpStore %60 %76 + OpBranch %66 + %66 = OpLabel + OpBranch %63 + %65 = OpLabel + %77 = OpLoad %6 %60 + %79 = OpAccessChain %20 %17 %18 %78 + %80 = OpLoad %6 %79 + %81 = OpIEqual %38 %77 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %101 + %82 = OpLabel + %88 = OpAccessChain %20 %17 %18 %19 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %84 %89 + %91 = OpAccessChain %20 %17 %18 %18 + %92 = OpLoad %6 %91 + %93 = OpConvertSToF %84 %92 + %94 = OpAccessChain %20 %17 %18 %18 + %95 = OpLoad %6 %94 + %96 = OpConvertSToF %84 %95 + %97 = OpAccessChain %20 %17 %18 %19 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %84 %98 + %100 = OpCompositeConstruct %85 %90 %93 %96 %99 + OpStore %87 %100 + OpBranch %83 + %101 = OpLabel + %102 = OpAccessChain %20 %17 %18 %18 + %103 = OpLoad %6 %102 + %104 = OpConvertSToF %84 %103 + %105 = OpCompositeConstruct %85 %104 %104 %104 %104 + OpStore %87 %105 + OpBranch %83 + %83 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %23 = OpVariable %10 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %6 %21 + OpStore %11 %22 + OpStore %23 %18 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %23 + %34 = OpAccessChain %33 %32 %18 + %35 = OpLoad %6 %34 + %37 = OpShiftRightArithmetic %6 %35 %36 + %39 = OpINotEqual %38 %29 %37 + OpBranchConditional %39 %25 %26 + %25 = OpLabel + OpBranch %40 + %40 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %6 %11 + %47 = OpAccessChain %20 %17 %18 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %38 %45 %48 + OpBranchConditional %49 %41 %42 + %41 = OpLabel + %50 = OpLoad %6 %11 + %51 = OpIAdd %6 %50 %36 + OpStore %11 %51 + OpBranch %43 + %43 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %27 + %27 = OpLabel + %52 = OpLoad %6 %23 + %53 = OpIAdd %6 %52 %36 + OpStore %23 %53 + OpBranch %24 + %26 = OpLabel + %54 = OpLoad %6 %11 + OpReturnValue %54 + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE int32 STD140 DATA + 2 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 5 30 1 6 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-loop-condition-variable-less-than-min-itself.amber b/vulkan/amber/graphicsfuzz/cov-function-loop-condition-variable-less-than-min-itself.amber new file mode 100644 index 0000000..3930f58 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-loop-condition-variable-less-than-min-itself.amber @@ -0,0 +1,268 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_500 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [500, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // This function always returns one. +# int func() +# { +# int a = _int_1; +# int b = int[10](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1)[a]; +# +# for(int i = _int_1; i < _int_500; i++) +# { +# // b < min(i, b) is always false. +# for(int j = _int_1; b < min(i, b); j ++) +# { +# a++; +# } +# } +# +# return a; +# } +# +# void main() +# { +# // Always true. +# if(func() == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 116 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %96 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "a" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %23 "b" + OpName %49 "indexable" + OpName %52 "i" + OpName %65 "j" + OpName %96 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %96 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 3 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpConstant %6 1 + %20 = OpTypePointer Uniform %6 + %44 = OpConstant %12 10 + %45 = OpTypeArray %6 %44 + %48 = OpTypePointer Function %45 + %63 = OpTypeBool + %93 = OpTypeFloat 32 + %94 = OpTypeVector %93 4 + %95 = OpTypePointer Output %94 + %96 = OpVariable %95 Output + %100 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %87 = OpFunctionCall %6 %8 + %88 = OpAccessChain %20 %17 %18 %19 + %89 = OpLoad %6 %88 + %90 = OpIEqual %63 %87 %89 + OpSelectionMerge %92 None + OpBranchConditional %90 %91 %111 + %91 = OpLabel + %97 = OpAccessChain %20 %17 %18 %19 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %93 %98 + %101 = OpAccessChain %20 %17 %18 %100 + %102 = OpLoad %6 %101 + %103 = OpConvertSToF %93 %102 + %104 = OpAccessChain %20 %17 %18 %100 + %105 = OpLoad %6 %104 + %106 = OpConvertSToF %93 %105 + %107 = OpAccessChain %20 %17 %18 %19 + %108 = OpLoad %6 %107 + %109 = OpConvertSToF %93 %108 + %110 = OpCompositeConstruct %94 %99 %103 %106 %109 + OpStore %96 %110 + OpBranch %92 + %111 = OpLabel + %112 = OpAccessChain %20 %17 %18 %100 + %113 = OpLoad %6 %112 + %114 = OpConvertSToF %93 %113 + %115 = OpCompositeConstruct %94 %114 %114 %114 %114 + OpStore %96 %115 + OpBranch %92 + %92 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %23 = OpVariable %10 Function + %49 = OpVariable %48 Function + %52 = OpVariable %10 Function + %65 = OpVariable %10 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %6 %21 + OpStore %11 %22 + %24 = OpAccessChain %20 %17 %18 %19 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %20 %17 %18 %19 + %27 = OpLoad %6 %26 + %28 = OpAccessChain %20 %17 %18 %19 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %20 %17 %18 %19 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %20 %17 %18 %19 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %20 %17 %18 %19 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %20 %17 %18 %19 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %20 %17 %18 %19 + %39 = OpLoad %6 %38 + %40 = OpAccessChain %20 %17 %18 %19 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %20 %17 %18 %19 + %43 = OpLoad %6 %42 + %46 = OpCompositeConstruct %45 %25 %27 %29 %31 %33 %35 %37 %39 %41 %43 + %47 = OpLoad %6 %11 + OpStore %49 %46 + %50 = OpAccessChain %10 %49 %47 + %51 = OpLoad %6 %50 + OpStore %23 %51 + %53 = OpAccessChain %20 %17 %18 %19 + %54 = OpLoad %6 %53 + OpStore %52 %54 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %6 %52 + %61 = OpAccessChain %20 %17 %18 %18 + %62 = OpLoad %6 %61 + %64 = OpSLessThan %63 %60 %62 + OpBranchConditional %64 %56 %57 + %56 = OpLabel + %66 = OpAccessChain %20 %17 %18 %19 + %67 = OpLoad %6 %66 + OpStore %65 %67 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %23 + %74 = OpLoad %6 %52 + %75 = OpLoad %6 %23 + %76 = OpExtInst %6 %1 SMin %74 %75 + %77 = OpSLessThan %63 %73 %76 + OpBranchConditional %77 %69 %70 + %69 = OpLabel + %78 = OpLoad %6 %11 + %79 = OpIAdd %6 %78 %19 + OpStore %11 %79 + OpBranch %71 + %71 = OpLabel + %80 = OpLoad %6 %65 + %81 = OpIAdd %6 %80 %19 + OpStore %65 %81 + OpBranch %68 + %70 = OpLabel + OpBranch %58 + %58 = OpLabel + %82 = OpLoad %6 %52 + %83 = OpIAdd %6 %82 %19 + OpStore %52 %83 + OpBranch %55 + %57 = OpLabel + %84 = OpLoad %6 %11 + OpReturnValue %84 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 500 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-loop-copy-array-elements-based-on-arguments.amber b/vulkan/amber/graphicsfuzz/cov-function-loop-copy-array-elements-based-on-arguments.amber new file mode 100644 index 0000000..1b476c9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-loop-copy-array-elements-based-on-arguments.amber @@ -0,0 +1,396 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_7 _GLF_uniform_int_values[1] +# #define _int_9 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_10 _GLF_uniform_int_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 7, 9, 1, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int arr0[10] = int[10](0, 0, 0, 0, 0, 0, 0, 0, 0, 0), arr1[10] = int[10](1, 2, 3, 4, 5, 6, 7, 8, 9, 10); +# +# void func(int x, int y) +# { +# int a = _int_1; +# int b = _int_1; +# +# // Sets arr1[1..5] to zero. +# while(x <= y) +# { +# if(b >= 6) +# { +# break; +# } +# +# b++; +# +# arr1[a++] = arr0[_int_1]; +# } +# +# // Same as arr0[x] = arr1[x]. +# for(int i = x; i <= x; i ++) +# { +# arr0[i] = arr1[i]; +# } +# } +# +# void main() +# { +# // Iterates only i = 1. +# for(int i = 1; i <= 1; i = 2 * i) +# { +# // Iterates j = 0, 2, 4, 6, and 8. +# for(int j = 0; j < 10; j += 2 * i) +# { +# func(j, j + i); +# } +# } +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Check the results and output black if unexpected values are seen. +# int ref[10] = int[10](_int_1, _int_0, _int_0, _int_0, _int_0, _int_0, _int_7, _int_0, _int_9, _int_0); +# for(int i = _int_0; i < _int_10; i++) +# { +# if(arr0[i] != ref[i]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 181 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %117 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "func(i1;i1;" + OpName %9 "x" + OpName %10 "y" + OpName %17 "arr0" + OpName %20 "arr1" + OpName %32 "a" + OpName %35 "buf0" + OpMemberName %35 0 "_GLF_uniform_int_values" + OpName %37 "" + OpName %41 "b" + OpName %68 "i" + OpName %85 "i" + OpName %93 "j" + OpName %104 "param" + OpName %106 "param" + OpName %117 "_GLF_color" + OpName %132 "ref" + OpName %154 "i" + OpDecorate %34 ArrayStride 16 + OpMemberDecorate %35 0 Offset 0 + OpDecorate %35 Block + OpDecorate %37 DescriptorSet 0 + OpDecorate %37 Binding 0 + OpDecorate %117 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 10 + %15 = OpTypeArray %6 %14 + %16 = OpTypePointer Private %15 + %17 = OpVariable %16 Private + %18 = OpConstant %6 0 + %19 = OpConstantComposite %15 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 + %20 = OpVariable %16 Private + %21 = OpConstant %6 1 + %22 = OpConstant %6 2 + %23 = OpConstant %6 3 + %24 = OpConstant %6 4 + %25 = OpConstant %6 5 + %26 = OpConstant %6 6 + %27 = OpConstant %6 7 + %28 = OpConstant %6 8 + %29 = OpConstant %6 9 + %30 = OpConstant %6 10 + %31 = OpConstantComposite %15 %21 %22 %23 %24 %25 %26 %27 %28 %29 %30 + %33 = OpConstant %13 5 + %34 = OpTypeArray %6 %33 + %35 = OpTypeStruct %34 + %36 = OpTypePointer Uniform %35 + %37 = OpVariable %36 Uniform + %38 = OpTypePointer Uniform %6 + %51 = OpTypeBool + %64 = OpTypePointer Private %6 + %114 = OpTypeFloat 32 + %115 = OpTypeVector %114 4 + %116 = OpTypePointer Output %115 + %117 = OpVariable %116 Output + %131 = OpTypePointer Function %15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %85 = OpVariable %7 Function + %93 = OpVariable %7 Function + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %132 = OpVariable %131 Function + %154 = OpVariable %7 Function + OpStore %17 %19 + OpStore %20 %31 + OpStore %85 %21 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %6 %85 + %92 = OpSLessThanEqual %51 %91 %21 + OpBranchConditional %92 %87 %88 + %87 = OpLabel + OpStore %93 %18 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %96 %97 None + OpBranch %98 + %98 = OpLabel + %99 = OpLoad %6 %93 + %100 = OpSLessThan %51 %99 %30 + OpBranchConditional %100 %95 %96 + %95 = OpLabel + %101 = OpLoad %6 %93 + %102 = OpLoad %6 %85 + %103 = OpIAdd %6 %101 %102 + %105 = OpLoad %6 %93 + OpStore %104 %105 + OpStore %106 %103 + %107 = OpFunctionCall %2 %11 %104 %106 + OpBranch %97 + %97 = OpLabel + %108 = OpLoad %6 %85 + %109 = OpIMul %6 %22 %108 + %110 = OpLoad %6 %93 + %111 = OpIAdd %6 %110 %109 + OpStore %93 %111 + OpBranch %94 + %96 = OpLabel + OpBranch %89 + %89 = OpLabel + %112 = OpLoad %6 %85 + %113 = OpIMul %6 %22 %112 + OpStore %85 %113 + OpBranch %86 + %88 = OpLabel + %118 = OpAccessChain %38 %37 %18 %23 + %119 = OpLoad %6 %118 + %120 = OpConvertSToF %114 %119 + %121 = OpAccessChain %38 %37 %18 %18 + %122 = OpLoad %6 %121 + %123 = OpConvertSToF %114 %122 + %124 = OpAccessChain %38 %37 %18 %18 + %125 = OpLoad %6 %124 + %126 = OpConvertSToF %114 %125 + %127 = OpAccessChain %38 %37 %18 %23 + %128 = OpLoad %6 %127 + %129 = OpConvertSToF %114 %128 + %130 = OpCompositeConstruct %115 %120 %123 %126 %129 + OpStore %117 %130 + %133 = OpAccessChain %38 %37 %18 %23 + %134 = OpLoad %6 %133 + %135 = OpAccessChain %38 %37 %18 %18 + %136 = OpLoad %6 %135 + %137 = OpAccessChain %38 %37 %18 %18 + %138 = OpLoad %6 %137 + %139 = OpAccessChain %38 %37 %18 %18 + %140 = OpLoad %6 %139 + %141 = OpAccessChain %38 %37 %18 %18 + %142 = OpLoad %6 %141 + %143 = OpAccessChain %38 %37 %18 %18 + %144 = OpLoad %6 %143 + %145 = OpAccessChain %38 %37 %18 %21 + %146 = OpLoad %6 %145 + %147 = OpAccessChain %38 %37 %18 %18 + %148 = OpLoad %6 %147 + %149 = OpAccessChain %38 %37 %18 %22 + %150 = OpLoad %6 %149 + %151 = OpAccessChain %38 %37 %18 %18 + %152 = OpLoad %6 %151 + %153 = OpCompositeConstruct %15 %134 %136 %138 %140 %142 %144 %146 %148 %150 %152 + OpStore %132 %153 + %155 = OpAccessChain %38 %37 %18 %18 + %156 = OpLoad %6 %155 + OpStore %154 %156 + OpBranch %157 + %157 = OpLabel + OpLoopMerge %159 %160 None + OpBranch %161 + %161 = OpLabel + %162 = OpLoad %6 %154 + %163 = OpAccessChain %38 %37 %18 %24 + %164 = OpLoad %6 %163 + %165 = OpSLessThan %51 %162 %164 + OpBranchConditional %165 %158 %159 + %158 = OpLabel + %166 = OpLoad %6 %154 + %167 = OpAccessChain %64 %17 %166 + %168 = OpLoad %6 %167 + %169 = OpLoad %6 %154 + %170 = OpAccessChain %7 %132 %169 + %171 = OpLoad %6 %170 + %172 = OpINotEqual %51 %168 %171 + OpSelectionMerge %174 None + OpBranchConditional %172 %173 %174 + %173 = OpLabel + %175 = OpAccessChain %38 %37 %18 %18 + %176 = OpLoad %6 %175 + %177 = OpConvertSToF %114 %176 + %178 = OpCompositeConstruct %115 %177 %177 %177 %177 + OpStore %117 %178 + OpBranch %174 + %174 = OpLabel + OpBranch %160 + %160 = OpLabel + %179 = OpLoad %6 %154 + %180 = OpIAdd %6 %179 %21 + OpStore %154 %180 + OpBranch %157 + %159 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %32 = OpVariable %7 Function + %41 = OpVariable %7 Function + %68 = OpVariable %7 Function + %39 = OpAccessChain %38 %37 %18 %23 + %40 = OpLoad %6 %39 + OpStore %32 %40 + %42 = OpAccessChain %38 %37 %18 %23 + %43 = OpLoad %6 %42 + OpStore %41 %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %6 %9 + %50 = OpLoad %6 %10 + %52 = OpSLessThanEqual %51 %49 %50 + OpBranchConditional %52 %45 %46 + %45 = OpLabel + %53 = OpLoad %6 %41 + %54 = OpSGreaterThanEqual %51 %53 %26 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + OpBranch %46 + %56 = OpLabel + %58 = OpLoad %6 %41 + %59 = OpIAdd %6 %58 %21 + OpStore %41 %59 + %60 = OpLoad %6 %32 + %61 = OpIAdd %6 %60 %21 + OpStore %32 %61 + %62 = OpAccessChain %38 %37 %18 %23 + %63 = OpLoad %6 %62 + %65 = OpAccessChain %64 %17 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %64 %20 %60 + OpStore %67 %66 + OpBranch %47 + %47 = OpLabel + OpBranch %44 + %46 = OpLabel + %69 = OpLoad %6 %9 + OpStore %68 %69 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %6 %68 + %76 = OpLoad %6 %9 + %77 = OpSLessThanEqual %51 %75 %76 + OpBranchConditional %77 %71 %72 + %71 = OpLabel + %78 = OpLoad %6 %68 + %79 = OpLoad %6 %68 + %80 = OpAccessChain %64 %20 %79 + %81 = OpLoad %6 %80 + %82 = OpAccessChain %64 %17 %78 + OpStore %82 %81 + OpBranch %73 + %73 = OpLabel + %83 = OpLoad %6 %68 + %84 = OpIAdd %6 %83 %21 + OpStore %68 %84 + OpBranch %70 + %72 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 7 9 1 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-loop-modify-ivec-components-infinite-loop-never-executed.amber b/vulkan/amber/graphicsfuzz/cov-function-loop-modify-ivec-components-infinite-loop-never-executed.amber new file mode 100644 index 0000000..9e28c16 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-loop-modify-ivec-components-infinite-loop-never-executed.amber @@ -0,0 +1,274 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of zero: 0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# ivec2 func() +# { +# ivec2 v = ivec2(zero, 2); +# +# // i = 0: v changes from (0, 2) to (1, 2). +# // i = 1: v changes from (1, 2) to (1, 1). +# // i = 2: v changes from (1, 1) to (1, 0). +# for(int i = 0; i < 3; i++) +# { +# if(v.x > _int_0) +# { +# v.y--; +# } +# +# v.x += v.y / 2; +# } +# +# // This loop is never iterated. +# while(v.x > 1) +# { +# } +# +# // Returns (1, 0). +# return v; +# } +# +# void main() +# { +# // Always true. +# if(func() == ivec2(1, 0)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 101 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %82 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "func(" + OpName %12 "v" + OpName %13 "buf1" + OpMemberName %13 0 "zero" + OpName %15 "" + OpName %23 "i" + OpName %39 "buf0" + OpMemberName %39 0 "_GLF_uniform_int_values" + OpName %41 "" + OpName %82 "_GLF_color" + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %38 ArrayStride 16 + OpMemberDecorate %39 0 Offset 0 + OpDecorate %39 Block + OpDecorate %41 DescriptorSet 0 + OpDecorate %41 Binding 0 + OpDecorate %82 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %8 = OpTypeFunction %7 + %11 = OpTypePointer Function %7 + %13 = OpTypeStruct %6 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %6 0 + %17 = OpTypePointer Uniform %6 + %20 = OpConstant %6 2 + %22 = OpTypePointer Function %6 + %30 = OpConstant %6 3 + %31 = OpTypeBool + %33 = OpTypeInt 32 0 + %34 = OpConstant %33 0 + %37 = OpConstant %33 2 + %38 = OpTypeArray %6 %37 + %39 = OpTypeStruct %38 + %40 = OpTypePointer Uniform %39 + %41 = OpVariable %40 Uniform + %47 = OpConstant %33 1 + %50 = OpConstant %6 1 + %73 = OpConstantComposite %7 %50 %16 + %74 = OpTypeVector %31 2 + %79 = OpTypeFloat 32 + %80 = OpTypeVector %79 4 + %81 = OpTypePointer Output %80 + %82 = OpVariable %81 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %72 = OpFunctionCall %7 %9 + %75 = OpIEqual %74 %72 %73 + %76 = OpAll %31 %75 + OpSelectionMerge %78 None + OpBranchConditional %76 %77 %96 + %77 = OpLabel + %83 = OpAccessChain %17 %41 %16 %50 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %79 %84 + %86 = OpAccessChain %17 %41 %16 %16 + %87 = OpLoad %6 %86 + %88 = OpConvertSToF %79 %87 + %89 = OpAccessChain %17 %41 %16 %16 + %90 = OpLoad %6 %89 + %91 = OpConvertSToF %79 %90 + %92 = OpAccessChain %17 %41 %16 %50 + %93 = OpLoad %6 %92 + %94 = OpConvertSToF %79 %93 + %95 = OpCompositeConstruct %80 %85 %88 %91 %94 + OpStore %82 %95 + OpBranch %78 + %96 = OpLabel + %97 = OpAccessChain %17 %41 %16 %16 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %79 %98 + %100 = OpCompositeConstruct %80 %99 %99 %99 %99 + OpStore %82 %100 + OpBranch %78 + %78 = OpLabel + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %12 = OpVariable %11 Function + %23 = OpVariable %22 Function + %18 = OpAccessChain %17 %15 %16 + %19 = OpLoad %6 %18 + %21 = OpCompositeConstruct %7 %19 %20 + OpStore %12 %21 + OpStore %23 %16 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %23 + %32 = OpSLessThan %31 %29 %30 + OpBranchConditional %32 %25 %26 + %25 = OpLabel + %35 = OpAccessChain %22 %12 %34 + %36 = OpLoad %6 %35 + %42 = OpAccessChain %17 %41 %16 %16 + %43 = OpLoad %6 %42 + %44 = OpSGreaterThan %31 %36 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %45 %46 + %45 = OpLabel + %48 = OpAccessChain %22 %12 %47 + %49 = OpLoad %6 %48 + %51 = OpISub %6 %49 %50 + OpStore %48 %51 + OpBranch %46 + %46 = OpLabel + %52 = OpAccessChain %22 %12 %47 + %53 = OpLoad %6 %52 + %54 = OpSDiv %6 %53 %20 + %55 = OpAccessChain %22 %12 %34 + %56 = OpLoad %6 %55 + %57 = OpIAdd %6 %56 %54 + %58 = OpAccessChain %22 %12 %34 + OpStore %58 %57 + OpBranch %27 + %27 = OpLabel + %59 = OpLoad %6 %23 + %60 = OpIAdd %6 %59 %50 + OpStore %23 %60 + OpBranch %24 + %26 = OpLabel + OpBranch %61 + %61 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %66 = OpAccessChain %22 %12 %34 + %67 = OpLoad %6 %66 + %68 = OpSGreaterThan %31 %67 %50 + OpBranchConditional %68 %62 %63 + %62 = OpLabel + OpBranch %64 + %64 = OpLabel + OpBranch %61 + %63 = OpLabel + %69 = OpLoad %7 %12 + OpReturnValue %69 + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 STD140 DATA + 0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-loop-same-conditions-multiple-times-struct-array.amber b/vulkan/amber/graphicsfuzz/cov-function-loop-same-conditions-multiple-times-struct-array.amber new file mode 100644 index 0000000..ce404c0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-loop-same-conditions-multiple-times-struct-array.amber @@ -0,0 +1,367 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_5 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_11 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [5, 0, 11, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(push_constant) uniform buf_push +# { +# highp vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S +# { +# int data; +# }; +# +# S arr[10] = S[10](S(1), S(2), S(3), S(4), S(5), S(6), S(7), S(8), S(9), S(10)); +# +# void func0(inout S s) +# { +# } +# +# int func1() +# { +# int a = _int_0; +# +# // Each iteration increases a by one. +# for(int i = _int_0; i < _int_5; i++) +# { +# // s.data is always a + 1. +# S s = arr[a]; +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# continue; +# } +# +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# continue; +# } +# +# // Always false. +# if(s.data == _int_11) +# { +# return -1; +# } +# +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# break; +# } +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# return - 1; +# } +# +# a = s.data; +# } +# +# return a; +# } +# +# void main() +# { +# // An empty function does nothing. +# func0(arr[_int_1]); +# +# // Always true. +# if(func1() == _int_5) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 263 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %74 %151 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "S" + OpMemberName %7 0 "data" + OpName %20 "arr" + OpName %46 "buf1" + OpMemberName %46 0 "_GLF_uniform_int_values" + OpName %48 "" + OpName %74 "gl_FragCoord" + OpName %81 "buf0" + OpMemberName %81 0 "_GLF_uniform_float_values" + OpName %83 "" + OpName %92 "buf_push" + OpMemberName %92 0 "injectionSwitch" + OpName %94 "" + OpName %151 "_GLF_color" + OpDecorate %45 ArrayStride 16 + OpMemberDecorate %46 0 Offset 0 + OpDecorate %46 Block + OpDecorate %48 DescriptorSet 0 + OpDecorate %48 Binding 1 + OpDecorate %74 BuiltIn FragCoord + OpDecorate %80 ArrayStride 16 + OpMemberDecorate %81 0 Offset 0 + OpDecorate %81 Block + OpDecorate %83 DescriptorSet 0 + OpDecorate %83 Binding 0 + OpMemberDecorate %92 0 Offset 0 + OpDecorate %92 Block + OpDecorate %151 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Function %7 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 10 + %18 = OpTypeArray %7 %17 + %21 = OpConstant %6 1 + %22 = OpConstantComposite %7 %21 + %23 = OpConstant %6 2 + %24 = OpConstantComposite %7 %23 + %25 = OpConstant %6 3 + %26 = OpConstantComposite %7 %25 + %27 = OpConstant %6 4 + %28 = OpConstantComposite %7 %27 + %29 = OpConstant %6 5 + %30 = OpConstantComposite %7 %29 + %31 = OpConstant %6 6 + %32 = OpConstantComposite %7 %31 + %33 = OpConstant %6 7 + %34 = OpConstantComposite %7 %33 + %35 = OpConstant %6 8 + %36 = OpConstantComposite %7 %35 + %37 = OpConstant %6 9 + %38 = OpConstantComposite %7 %37 + %39 = OpConstant %6 10 + %40 = OpConstantComposite %7 %39 + %41 = OpConstantComposite %18 %22 %24 %26 %28 %30 %32 %34 %36 %38 %40 + %44 = OpConstant %16 4 + %45 = OpTypeArray %6 %44 + %46 = OpTypeStruct %45 + %47 = OpTypePointer Uniform %46 + %48 = OpVariable %47 Uniform + %49 = OpConstant %6 0 + %50 = OpTypePointer Uniform %6 + %64 = OpTypeBool + %71 = OpTypeFloat 32 + %72 = OpTypeVector %71 4 + %73 = OpTypePointer Input %72 + %74 = OpVariable %73 Input + %75 = OpConstant %16 0 + %76 = OpTypePointer Input %71 + %79 = OpConstant %16 1 + %80 = OpTypeArray %71 %79 + %81 = OpTypeStruct %80 + %82 = OpTypePointer Uniform %81 + %83 = OpVariable %82 Uniform + %84 = OpTypePointer Uniform %71 + %91 = OpTypeVector %71 2 + %92 = OpTypeStruct %91 + %93 = OpTypePointer PushConstant %92 + %94 = OpVariable %93 PushConstant + %95 = OpTypePointer PushConstant %71 + %111 = OpConstant %6 -1 + %150 = OpTypePointer Output %72 + %151 = OpVariable %150 Output + %174 = OpConstantFalse %64 + %177 = OpConstantTrue %64 + %249 = OpTypePointer Function %18 + %260 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %20 = OpVariable %249 Function + OpStore %20 %41 + %136 = OpAccessChain %50 %48 %49 %25 + %137 = OpLoad %6 %136 + %139 = OpAccessChain %8 %20 %137 + %140 = OpLoad %7 %139 + OpStore %139 %140 + OpSelectionMerge %247 None + OpSwitch %75 %188 + %188 = OpLabel + %189 = OpAccessChain %50 %48 %49 %21 + %190 = OpLoad %6 %189 + OpBranch %193 + %193 = OpLabel + %253 = OpPhi %6 %190 %188 %262 %240 + %252 = OpPhi %6 %190 %188 %242 %240 + %196 = OpAccessChain %50 %48 %49 %49 + %197 = OpLoad %6 %196 + %198 = OpSLessThan %64 %252 %197 + OpLoopMerge %243 %240 None + OpBranchConditional %198 %199 %243 + %199 = OpLabel + %201 = OpAccessChain %8 %20 %253 + %202 = OpLoad %7 %201 + %251 = OpCompositeExtract %6 %202 0 + %203 = OpAccessChain %76 %74 %75 + %204 = OpLoad %71 %203 + %205 = OpAccessChain %84 %83 %49 %49 + %206 = OpLoad %71 %205 + %207 = OpFOrdLessThan %64 %204 %206 + OpSelectionMerge %209 None + OpBranchConditional %207 %208 %209 + %208 = OpLabel + OpBranch %240 + %209 = OpLabel + %210 = OpAccessChain %95 %94 %49 %75 + %211 = OpLoad %71 %210 + %212 = OpAccessChain %95 %94 %49 %79 + %213 = OpLoad %71 %212 + %214 = OpFOrdGreaterThan %64 %211 %213 + OpSelectionMerge %216 None + OpBranchConditional %214 %215 %216 + %215 = OpLabel + OpBranch %240 + %216 = OpLabel + %219 = OpAccessChain %50 %48 %49 %23 + %220 = OpLoad %6 %219 + %221 = OpIEqual %64 %251 %220 + OpSelectionMerge %223 None + OpBranchConditional %221 %222 %223 + %222 = OpLabel + OpBranch %243 + %223 = OpLabel + OpSelectionMerge %230 None + OpBranchConditional %214 %229 %230 + %229 = OpLabel + OpBranch %243 + %230 = OpLabel + OpSelectionMerge %237 None + OpBranchConditional %207 %236 %237 + %236 = OpLabel + OpBranch %243 + %237 = OpLabel + OpBranch %240 + %240 = OpLabel + %262 = OpPhi %6 %253 %208 %253 %215 %251 %237 + %242 = OpIAdd %6 %252 %21 + OpBranch %193 + %243 = OpLabel + %258 = OpPhi %6 %260 %193 %111 %222 %260 %229 %111 %236 + %254 = OpPhi %64 %174 %193 %177 %222 %174 %229 %177 %236 + OpSelectionMerge %245 None + OpBranchConditional %254 %247 %245 + %245 = OpLabel + OpBranch %247 + %247 = OpLabel + %257 = OpPhi %6 %258 %243 %253 %245 + %147 = OpIEqual %64 %257 %197 + OpSelectionMerge %149 None + OpBranchConditional %147 %148 %165 + %148 = OpLabel + %154 = OpConvertSToF %71 %137 + %157 = OpConvertSToF %71 %190 + %164 = OpCompositeConstruct %72 %154 %157 %157 %154 + OpStore %151 %164 + OpBranch %149 + %165 = OpLabel + %168 = OpConvertSToF %71 %190 + %169 = OpCompositeConstruct %72 %168 %168 %168 %168 + OpStore %151 %169 + OpBranch %149 + %149 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 5 0 11 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-loop-switch-increment-array-element-return.amber b/vulkan/amber/graphicsfuzz/cov-function-loop-switch-increment-array-element-return.amber new file mode 100644 index 0000000..e405190 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-loop-switch-increment-array-element-return.amber @@ -0,0 +1,288 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_4 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 4, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# int a = _int_1; +# int b = _int_1; +# int arr[6] = int[6](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1); +# +# // Returns during the second iteration. +# while(b >= _int_1) +# { +# a = b++; +# +# for(int i = 0; i < 3; i++) +# { +# switch(a) +# { +# case 2: +# arr[a]++; +# break; +# case 3: +# return arr[_int_2]; +# case 5: +# // Never executed. +# arr[a]++; +# break; +# } +# } +# } +# +# // Never executed. +# return _int_0; +# } +# +# void main() +# { +# // Always true. +# if(func() == _int_4) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 120 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %101 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "a" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %23 "b" + OpName %29 "arr" + OpName %55 "i" + OpName %101 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %101 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 4 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpConstant %6 1 + %20 = OpTypePointer Uniform %6 + %26 = OpConstant %12 6 + %27 = OpTypeArray %6 %26 + %28 = OpTypePointer Function %27 + %51 = OpTypeBool + %62 = OpConstant %6 3 + %92 = OpConstant %6 2 + %98 = OpTypeFloat 32 + %99 = OpTypeVector %98 4 + %100 = OpTypePointer Output %99 + %101 = OpVariable %100 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %91 = OpFunctionCall %6 %8 + %93 = OpAccessChain %20 %17 %18 %92 + %94 = OpLoad %6 %93 + %95 = OpIEqual %51 %91 %94 + OpSelectionMerge %97 None + OpBranchConditional %95 %96 %115 + %96 = OpLabel + %102 = OpAccessChain %20 %17 %18 %19 + %103 = OpLoad %6 %102 + %104 = OpConvertSToF %98 %103 + %105 = OpAccessChain %20 %17 %18 %18 + %106 = OpLoad %6 %105 + %107 = OpConvertSToF %98 %106 + %108 = OpAccessChain %20 %17 %18 %18 + %109 = OpLoad %6 %108 + %110 = OpConvertSToF %98 %109 + %111 = OpAccessChain %20 %17 %18 %19 + %112 = OpLoad %6 %111 + %113 = OpConvertSToF %98 %112 + %114 = OpCompositeConstruct %99 %104 %107 %110 %113 + OpStore %101 %114 + OpBranch %97 + %115 = OpLabel + %116 = OpAccessChain %20 %17 %18 %18 + %117 = OpLoad %6 %116 + %118 = OpConvertSToF %98 %117 + %119 = OpCompositeConstruct %99 %118 %118 %118 %118 + OpStore %101 %119 + OpBranch %97 + %97 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %23 = OpVariable %10 Function + %29 = OpVariable %28 Function + %55 = OpVariable %10 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %6 %21 + OpStore %11 %22 + %24 = OpAccessChain %20 %17 %18 %19 + %25 = OpLoad %6 %24 + OpStore %23 %25 + %30 = OpAccessChain %20 %17 %18 %19 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %20 %17 %18 %19 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %20 %17 %18 %19 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %20 %17 %18 %19 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %20 %17 %18 %19 + %39 = OpLoad %6 %38 + %40 = OpAccessChain %20 %17 %18 %19 + %41 = OpLoad %6 %40 + %42 = OpCompositeConstruct %27 %31 %33 %35 %37 %39 %41 + OpStore %29 %42 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %6 %23 + %49 = OpAccessChain %20 %17 %18 %19 + %50 = OpLoad %6 %49 + %52 = OpSGreaterThanEqual %51 %48 %50 + OpBranchConditional %52 %44 %45 + %44 = OpLabel + %53 = OpLoad %6 %23 + %54 = OpIAdd %6 %53 %19 + OpStore %23 %54 + OpStore %11 %53 + OpStore %55 %18 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %6 %55 + %63 = OpSLessThan %51 %61 %62 + OpBranchConditional %63 %57 %58 + %57 = OpLabel + %64 = OpLoad %6 %11 + OpSelectionMerge %68 None + OpSwitch %64 %68 2 %65 3 %66 5 %67 + %65 = OpLabel + %69 = OpLoad %6 %11 + %70 = OpAccessChain %10 %29 %69 + %71 = OpLoad %6 %70 + %72 = OpIAdd %6 %71 %19 + OpStore %70 %72 + OpBranch %68 + %66 = OpLabel + %74 = OpAccessChain %20 %17 %18 %62 + %75 = OpLoad %6 %74 + %76 = OpAccessChain %10 %29 %75 + %77 = OpLoad %6 %76 + OpReturnValue %77 + %67 = OpLabel + %79 = OpLoad %6 %11 + %80 = OpAccessChain %10 %29 %79 + %81 = OpLoad %6 %80 + %82 = OpIAdd %6 %81 %19 + OpStore %80 %82 + OpBranch %68 + %68 = OpLabel + OpBranch %59 + %59 = OpLabel + %85 = OpLoad %6 %55 + %86 = OpIAdd %6 %85 %19 + OpStore %55 %86 + OpBranch %56 + %58 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %43 + %45 = OpLabel + %87 = OpAccessChain %20 %17 %18 %18 + %88 = OpLoad %6 %87 + OpReturnValue %88 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 4 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-loop-variable-multiplied-unused.amber b/vulkan/amber/graphicsfuzz/cov-function-loop-variable-multiplied-unused.amber new file mode 100644 index 0000000..724bdf3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-loop-variable-multiplied-unused.amber @@ -0,0 +1,236 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--copy-propagate-arrays' +# '--eliminate-local-multi-store' +# '--if-conversion' +# '--if-conversion' +# '--combine-access-chains' +# '--redundancy-elimination' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--merge-blocks' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# int a = 1; +# int i = 1; +# +# // Iterated once. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# // Iterated nine times. 2 * a has no effect. +# for( i = _int_1; _GLF_global_loop_count < _GLF_global_loop_bound; 2 * a) +# { +# _GLF_global_loop_count++; +# i++; +# } +# } +# +# // Returns 10. +# return i; +# } +# +# void main() +# { +# // Always true. +# if(func() == 10) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 84 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %61 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "_GLF_global_loop_count" + OpName %14 "a" + OpName %16 "i" + OpName %31 "buf0" + OpMemberName %31 0 "_GLF_uniform_int_values" + OpName %33 "" + OpName %61 "_GLF_color" + OpDecorate %30 ArrayStride 16 + OpMemberDecorate %31 0 Offset 0 + OpDecorate %31 Block + OpDecorate %33 DescriptorSet 0 + OpDecorate %33 Binding 0 + OpDecorate %61 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Private %6 + %11 = OpVariable %10 Private + %12 = OpConstant %6 0 + %13 = OpTypePointer Function %6 + %15 = OpConstant %6 1 + %23 = OpConstant %6 10 + %24 = OpTypeBool + %28 = OpTypeInt 32 0 + %29 = OpConstant %28 2 + %30 = OpTypeArray %6 %29 + %31 = OpTypeStruct %30 + %32 = OpTypePointer Uniform %31 + %33 = OpVariable %32 Uniform + %34 = OpTypePointer Uniform %6 + %48 = OpConstant %6 2 + %58 = OpTypeFloat 32 + %59 = OpTypeVector %58 4 + %60 = OpTypePointer Output %59 + %61 = OpVariable %60 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %11 %12 + %54 = OpFunctionCall %6 %8 + %55 = OpIEqual %24 %54 %23 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %75 + %56 = OpLabel + %62 = OpAccessChain %34 %33 %12 %12 + %63 = OpLoad %6 %62 + %64 = OpConvertSToF %58 %63 + %65 = OpAccessChain %34 %33 %12 %15 + %66 = OpLoad %6 %65 + %67 = OpConvertSToF %58 %66 + %74 = OpCompositeConstruct %59 %64 %67 %67 %64 + OpStore %61 %74 + OpBranch %57 + %75 = OpLabel + %76 = OpAccessChain %34 %33 %12 %15 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %58 %77 + %79 = OpCompositeConstruct %59 %78 %78 %78 %78 + OpStore %61 %79 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %14 = OpVariable %13 Function + %16 = OpVariable %13 Function + OpStore %14 %15 + OpStore %16 %15 + OpBranch %17 + %17 = OpLabel + %80 = OpPhi %6 %15 %9 %81 %20 + %83 = OpPhi %6 %15 %9 %83 %20 + %22 = OpLoad %6 %11 + %25 = OpSLessThan %24 %22 %23 + OpLoopMerge %19 %20 None + OpBranchConditional %25 %18 %19 + %18 = OpLabel + %26 = OpLoad %6 %11 + %27 = OpIAdd %6 %26 %15 + OpStore %11 %27 + %35 = OpAccessChain %34 %33 %12 %12 + %36 = OpLoad %6 %35 + OpStore %16 %36 + OpBranch %37 + %37 = OpLabel + %81 = OpPhi %6 %36 %18 %47 %38 + %42 = OpLoad %6 %11 + %43 = OpSLessThan %24 %42 %23 + OpLoopMerge %39 %38 None + OpBranchConditional %43 %38 %39 + %38 = OpLabel + %44 = OpLoad %6 %11 + %45 = OpIAdd %6 %44 %15 + OpStore %11 %45 + %47 = OpIAdd %6 %81 %15 + OpStore %16 %47 + %50 = OpIMul %6 %48 %83 + OpBranch %37 + %39 = OpLabel + OpBranch %20 + %20 = OpLabel + OpBranch %17 + %19 = OpLabel + OpReturnValue %80 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-loops-vector-mul-matrix-never-executed.amber b/vulkan/amber/graphicsfuzz/cov-function-loops-vector-mul-matrix-never-executed.amber new file mode 100644 index 0000000..958c4b2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-loops-vector-mul-matrix-never-executed.amber @@ -0,0 +1,590 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_4 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_2_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 2.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2, 4] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# highp vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# ivec4 func() +# { +# ivec4 v = ivec4(_int_1); +# int a = _int_1; +# +# // Iterates twice. +# for(int b = 0; b < 2; b++) +# { +# int c = 0; +# +# // Iterates three times. +# for(int d = _int_1; c < 3; d++) +# { +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# if(injectionSwitch.y > _float_0_0) +# { +# vec2 v0 = vec2(_float_1_0) * mat2(_float_1_0); +# for(int i = _int_1; i >= 1; i--) { } +# +# vec2 v1 = vec2(_float_1_0) * mat2(_float_1_0); +# for(int i = _int_1; i >= 1; i--) { } +# +# vec2 v2 = vec2(_float_1_0) * mat2(_float_1_0); +# for(int i = _int_1; i >= 0; i--) { } +# } +# } +# else +# { +# c++; +# } +# +# // Same as a += d. +# for(int i = _int_0; i < d; i++) +# { +# a++; +# } +# +# a *= _int_2; +# +# // v = vec4(a); +# for(int i = _int_0; i < _int_4; i++) +# { +# v[i] = a; +# } +# } +# } +# +# return v; +# } +# +# // Same as func(), but manually simplified. +# ivec4 funcSimplified() +# { +# ivec4 v = ivec4(1); +# int a = 1; +# +# for(int b = 0; b < 2; b++) +# { +# for(int d = 1; d < 4; d++) +# { +# a = (a + d) * 2; +# } +# } +# +# return ivec4(a); +# } +# +# void main() +# { +# // Always true. +# if(func() == funcSimplified()) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 259 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %55 %240 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "func(" + OpName %11 "funcSimplified(" + OpName %14 "v" + OpName %18 "buf1" + OpMemberName %18 0 "_GLF_uniform_int_values" + OpName %20 "" + OpName %27 "a" + OpName %30 "b" + OpName %40 "c" + OpName %41 "d" + OpName %55 "gl_FragCoord" + OpName %62 "buf0" + OpMemberName %62 0 "_GLF_uniform_float_values" + OpName %64 "" + OpName %73 "buf2" + OpMemberName %73 0 "injectionSwitch" + OpName %75 "" + OpName %85 "v0" + OpName %98 "i" + OpName %110 "v1" + OpName %120 "i" + OpName %132 "v2" + OpName %142 "i" + OpName %157 "i" + OpName %176 "i" + OpName %200 "v" + OpName %202 "a" + OpName %203 "b" + OpName %211 "d" + OpName %240 "_GLF_color" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %55 BuiltIn FragCoord + OpDecorate %61 ArrayStride 16 + OpMemberDecorate %62 0 Offset 0 + OpDecorate %62 Block + OpDecorate %64 DescriptorSet 0 + OpDecorate %64 Binding 0 + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 2 + OpDecorate %240 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 4 + %8 = OpTypeFunction %7 + %13 = OpTypePointer Function %7 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 4 + %17 = OpTypeArray %6 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpConstant %6 0 + %22 = OpTypePointer Uniform %6 + %26 = OpTypePointer Function %6 + %37 = OpConstant %6 2 + %38 = OpTypeBool + %50 = OpConstant %6 3 + %52 = OpTypeFloat 32 + %53 = OpTypeVector %52 4 + %54 = OpTypePointer Input %53 + %55 = OpVariable %54 Input + %56 = OpConstant %15 0 + %57 = OpTypePointer Input %52 + %60 = OpConstant %15 3 + %61 = OpTypeArray %52 %60 + %62 = OpTypeStruct %61 + %63 = OpTypePointer Uniform %62 + %64 = OpVariable %63 Uniform + %65 = OpConstant %6 1 + %66 = OpTypePointer Uniform %52 + %72 = OpTypeVector %52 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpConstant %15 1 + %84 = OpTypePointer Function %72 + %91 = OpTypeMatrix %72 2 + %92 = OpConstant %52 1 + %93 = OpConstant %52 0 + %201 = OpConstantComposite %7 %65 %65 %65 %65 + %218 = OpConstant %6 4 + %234 = OpTypeVector %38 4 + %239 = OpTypePointer Output %53 + %240 = OpVariable %239 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %232 = OpFunctionCall %7 %9 + %233 = OpFunctionCall %7 %11 + %235 = OpIEqual %234 %232 %233 + %236 = OpAll %38 %235 + OpSelectionMerge %238 None + OpBranchConditional %236 %237 %254 + %237 = OpLabel + %241 = OpAccessChain %22 %20 %21 %21 + %242 = OpLoad %6 %241 + %243 = OpConvertSToF %52 %242 + %244 = OpAccessChain %22 %20 %21 %65 + %245 = OpLoad %6 %244 + %246 = OpConvertSToF %52 %245 + %247 = OpAccessChain %22 %20 %21 %65 + %248 = OpLoad %6 %247 + %249 = OpConvertSToF %52 %248 + %250 = OpAccessChain %22 %20 %21 %21 + %251 = OpLoad %6 %250 + %252 = OpConvertSToF %52 %251 + %253 = OpCompositeConstruct %53 %243 %246 %249 %252 + OpStore %240 %253 + OpBranch %238 + %254 = OpLabel + %255 = OpAccessChain %22 %20 %21 %65 + %256 = OpLoad %6 %255 + %257 = OpConvertSToF %52 %256 + %258 = OpCompositeConstruct %53 %257 %257 %257 %257 + OpStore %240 %258 + OpBranch %238 + %238 = OpLabel + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %14 = OpVariable %13 Function + %27 = OpVariable %26 Function + %30 = OpVariable %26 Function + %40 = OpVariable %26 Function + %41 = OpVariable %26 Function + %85 = OpVariable %84 Function + %98 = OpVariable %26 Function + %110 = OpVariable %84 Function + %120 = OpVariable %26 Function + %132 = OpVariable %84 Function + %142 = OpVariable %26 Function + %157 = OpVariable %26 Function + %176 = OpVariable %26 Function + %23 = OpAccessChain %22 %20 %21 %21 + %24 = OpLoad %6 %23 + %25 = OpCompositeConstruct %7 %24 %24 %24 %24 + OpStore %14 %25 + %28 = OpAccessChain %22 %20 %21 %21 + %29 = OpLoad %6 %28 + OpStore %27 %29 + OpStore %30 %21 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %6 %30 + %39 = OpSLessThan %38 %36 %37 + OpBranchConditional %39 %32 %33 + %32 = OpLabel + OpStore %40 %21 + %42 = OpAccessChain %22 %20 %21 %21 + %43 = OpLoad %6 %42 + OpStore %41 %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %6 %40 + %51 = OpSLessThan %38 %49 %50 + OpBranchConditional %51 %45 %46 + %45 = OpLabel + %58 = OpAccessChain %57 %55 %56 + %59 = OpLoad %52 %58 + %67 = OpAccessChain %66 %64 %21 %65 + %68 = OpLoad %52 %67 + %69 = OpFOrdLessThan %38 %59 %68 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %154 + %70 = OpLabel + %77 = OpAccessChain %66 %75 %21 %76 + %78 = OpLoad %52 %77 + %79 = OpAccessChain %66 %64 %21 %65 + %80 = OpLoad %52 %79 + %81 = OpFOrdGreaterThan %38 %78 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %83 + %82 = OpLabel + %86 = OpAccessChain %66 %64 %21 %21 + %87 = OpLoad %52 %86 + %88 = OpCompositeConstruct %72 %87 %87 + %89 = OpAccessChain %66 %64 %21 %21 + %90 = OpLoad %52 %89 + %94 = OpCompositeConstruct %72 %90 %93 + %95 = OpCompositeConstruct %72 %93 %90 + %96 = OpCompositeConstruct %91 %94 %95 + %97 = OpVectorTimesMatrix %72 %88 %96 + OpStore %85 %97 + %99 = OpAccessChain %22 %20 %21 %21 + %100 = OpLoad %6 %99 + OpStore %98 %100 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %6 %98 + %107 = OpSGreaterThanEqual %38 %106 %65 + OpBranchConditional %107 %102 %103 + %102 = OpLabel + OpBranch %104 + %104 = OpLabel + %108 = OpLoad %6 %98 + %109 = OpISub %6 %108 %65 + OpStore %98 %109 + OpBranch %101 + %103 = OpLabel + %111 = OpAccessChain %66 %64 %21 %21 + %112 = OpLoad %52 %111 + %113 = OpCompositeConstruct %72 %112 %112 + %114 = OpAccessChain %66 %64 %21 %21 + %115 = OpLoad %52 %114 + %116 = OpCompositeConstruct %72 %115 %93 + %117 = OpCompositeConstruct %72 %93 %115 + %118 = OpCompositeConstruct %91 %116 %117 + %119 = OpVectorTimesMatrix %72 %113 %118 + OpStore %110 %119 + %121 = OpAccessChain %22 %20 %21 %21 + %122 = OpLoad %6 %121 + OpStore %120 %122 + OpBranch %123 + %123 = OpLabel + OpLoopMerge %125 %126 None + OpBranch %127 + %127 = OpLabel + %128 = OpLoad %6 %120 + %129 = OpSGreaterThanEqual %38 %128 %65 + OpBranchConditional %129 %124 %125 + %124 = OpLabel + OpBranch %126 + %126 = OpLabel + %130 = OpLoad %6 %120 + %131 = OpISub %6 %130 %65 + OpStore %120 %131 + OpBranch %123 + %125 = OpLabel + %133 = OpAccessChain %66 %64 %21 %21 + %134 = OpLoad %52 %133 + %135 = OpCompositeConstruct %72 %134 %134 + %136 = OpAccessChain %66 %64 %21 %21 + %137 = OpLoad %52 %136 + %138 = OpCompositeConstruct %72 %137 %93 + %139 = OpCompositeConstruct %72 %93 %137 + %140 = OpCompositeConstruct %91 %138 %139 + %141 = OpVectorTimesMatrix %72 %135 %140 + OpStore %132 %141 + %143 = OpAccessChain %22 %20 %21 %21 + %144 = OpLoad %6 %143 + OpStore %142 %144 + OpBranch %145 + %145 = OpLabel + OpLoopMerge %147 %148 None + OpBranch %149 + %149 = OpLabel + %150 = OpLoad %6 %142 + %151 = OpSGreaterThanEqual %38 %150 %21 + OpBranchConditional %151 %146 %147 + %146 = OpLabel + OpBranch %148 + %148 = OpLabel + %152 = OpLoad %6 %142 + %153 = OpISub %6 %152 %65 + OpStore %142 %153 + OpBranch %145 + %147 = OpLabel + OpBranch %83 + %83 = OpLabel + OpBranch %71 + %154 = OpLabel + %155 = OpLoad %6 %40 + %156 = OpIAdd %6 %155 %65 + OpStore %40 %156 + OpBranch %71 + %71 = OpLabel + %158 = OpAccessChain %22 %20 %21 %65 + %159 = OpLoad %6 %158 + OpStore %157 %159 + OpBranch %160 + %160 = OpLabel + OpLoopMerge %162 %163 None + OpBranch %164 + %164 = OpLabel + %165 = OpLoad %6 %157 + %166 = OpLoad %6 %41 + %167 = OpSLessThan %38 %165 %166 + OpBranchConditional %167 %161 %162 + %161 = OpLabel + %168 = OpLoad %6 %27 + %169 = OpIAdd %6 %168 %65 + OpStore %27 %169 + OpBranch %163 + %163 = OpLabel + %170 = OpLoad %6 %157 + %171 = OpIAdd %6 %170 %65 + OpStore %157 %171 + OpBranch %160 + %162 = OpLabel + %172 = OpAccessChain %22 %20 %21 %37 + %173 = OpLoad %6 %172 + %174 = OpLoad %6 %27 + %175 = OpIMul %6 %174 %173 + OpStore %27 %175 + %177 = OpAccessChain %22 %20 %21 %65 + %178 = OpLoad %6 %177 + OpStore %176 %178 + OpBranch %179 + %179 = OpLabel + OpLoopMerge %181 %182 None + OpBranch %183 + %183 = OpLabel + %184 = OpLoad %6 %176 + %185 = OpAccessChain %22 %20 %21 %50 + %186 = OpLoad %6 %185 + %187 = OpSLessThan %38 %184 %186 + OpBranchConditional %187 %180 %181 + %180 = OpLabel + %188 = OpLoad %6 %176 + %189 = OpLoad %6 %27 + %190 = OpAccessChain %26 %14 %188 + OpStore %190 %189 + OpBranch %182 + %182 = OpLabel + %191 = OpLoad %6 %176 + %192 = OpIAdd %6 %191 %65 + OpStore %176 %192 + OpBranch %179 + %181 = OpLabel + OpBranch %47 + %47 = OpLabel + %193 = OpLoad %6 %41 + %194 = OpIAdd %6 %193 %65 + OpStore %41 %194 + OpBranch %44 + %46 = OpLabel + OpBranch %34 + %34 = OpLabel + %195 = OpLoad %6 %30 + %196 = OpIAdd %6 %195 %65 + OpStore %30 %196 + OpBranch %31 + %33 = OpLabel + %197 = OpLoad %7 %14 + OpReturnValue %197 + OpFunctionEnd + %11 = OpFunction %7 None %8 + %12 = OpLabel + %200 = OpVariable %13 Function + %202 = OpVariable %26 Function + %203 = OpVariable %26 Function + %211 = OpVariable %26 Function + OpStore %200 %201 + OpStore %202 %65 + OpStore %203 %21 + OpBranch %204 + %204 = OpLabel + OpLoopMerge %206 %207 None + OpBranch %208 + %208 = OpLabel + %209 = OpLoad %6 %203 + %210 = OpSLessThan %38 %209 %37 + OpBranchConditional %210 %205 %206 + %205 = OpLabel + OpStore %211 %65 + OpBranch %212 + %212 = OpLabel + OpLoopMerge %214 %215 None + OpBranch %216 + %216 = OpLabel + %217 = OpLoad %6 %211 + %219 = OpSLessThan %38 %217 %218 + OpBranchConditional %219 %213 %214 + %213 = OpLabel + %220 = OpLoad %6 %202 + %221 = OpLoad %6 %211 + %222 = OpIAdd %6 %220 %221 + %223 = OpIMul %6 %222 %37 + OpStore %202 %223 + OpBranch %215 + %215 = OpLabel + %224 = OpLoad %6 %211 + %225 = OpIAdd %6 %224 %65 + OpStore %211 %225 + OpBranch %212 + %214 = OpLabel + OpBranch %207 + %207 = OpLabel + %226 = OpLoad %6 %203 + %227 = OpIAdd %6 %226 %65 + OpStore %203 %227 + OpBranch %204 + %206 = OpLabel + %228 = OpLoad %6 %202 + %229 = OpCompositeConstruct %7 %228 %228 %228 %228 + OpReturnValue %229 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 4 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 2.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-max-all-ones-select-always-true.amber b/vulkan/amber/graphicsfuzz/cov-function-max-all-ones-select-always-true.amber new file mode 100644 index 0000000..84fa4a7 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-max-all-ones-select-always-true.amber @@ -0,0 +1,242 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--inline-entry-points-exhaustive' +# '--reduce-load-size' +# '--eliminate-local-single-block' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--simplify-instructions' +# '--inline-entry-points-exhaustive' +# '--if-conversion' +# '--redundancy-elimination' +# '--eliminate-local-single-block' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--vector-dce' +# '--if-conversion' +# '--vector-dce' +# '--combine-access-chains' +# '--simplify-instructions' +# '--eliminate-dead-code-aggressive' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-inserts' +# '--eliminate-local-single-store' +# '--ccp' +# '--reduce-load-size' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--if-conversion' +# '--combine-access-chains' +# '--copy-propagate-arrays' +# '--eliminate-dead-branches' +# '--merge-return' +# '--inline-entry-points-exhaustive' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 func() +# { +# int a = _int_1; +# // b becomes one. +# int b = int(max(ivec2(1, true ? a : _int_1), ivec2(1, true ? a : _int_1))); +# // Returns vec3(1, 1, 1). +# return vec3(max(_float_1_0, b == _int_1 ? _float_0_0 : _float_1_0)); +# } +# +# void main() +# { +# // Always true. +# if(func() == vec3(_int_1)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 144 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %86 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %17 "buf1" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %50 "buf0" + OpMemberName %50 0 "_GLF_uniform_float_values" + OpName %52 "" + OpName %86 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %49 ArrayStride 16 + OpMemberDecorate %50 0 Offset 0 + OpDecorate %50 Block + OpDecorate %52 DescriptorSet 0 + OpDecorate %52 Binding 0 + OpDecorate %86 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %11 = OpTypeInt 32 1 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 2 + %16 = OpTypeArray %11 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %11 0 + %21 = OpTypePointer Uniform %11 + %25 = OpConstant %11 1 + %26 = OpTypeBool + %36 = OpTypeVector %11 2 + %49 = OpTypeArray %6 %15 + %50 = OpTypeStruct %49 + %51 = OpTypePointer Uniform %50 + %52 = OpVariable %51 Uniform + %53 = OpTypePointer Uniform %6 + %60 = OpTypePointer Function %6 + %79 = OpTypeVector %26 3 + %84 = OpTypeVector %6 4 + %85 = OpTypePointer Output %84 + %86 = OpVariable %85 Output + %143 = OpUndef %11 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %109 = OpVariable %60 Function + %113 = OpAccessChain %21 %19 %20 %20 + %114 = OpLoad %11 %113 + %119 = OpCompositeConstruct %36 %25 %143 + %125 = OpExtInst %36 %1 SMax %119 %119 + %126 = OpCompositeExtract %11 %125 0 + %127 = OpAccessChain %53 %52 %20 %20 + %128 = OpLoad %6 %127 + %132 = OpIEqual %26 %126 %114 + OpSelectionMerge %139 None + OpBranchConditional %132 %136 %133 + %133 = OpLabel + OpStore %109 %128 + OpBranch %139 + %136 = OpLabel + %137 = OpAccessChain %53 %52 %20 %25 + %138 = OpLoad %6 %137 + OpStore %109 %138 + OpBranch %139 + %139 = OpLabel + %140 = OpLoad %6 %109 + %141 = OpExtInst %6 %1 FMax %128 %140 + %142 = OpCompositeConstruct %7 %141 %141 %141 + %77 = OpConvertSToF %6 %114 + %78 = OpCompositeConstruct %7 %77 %77 %77 + %80 = OpFOrdEqual %79 %142 %78 + %81 = OpAll %26 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %100 + %100 = OpLabel + %101 = OpAccessChain %21 %19 %20 %25 + %102 = OpLoad %11 %101 + %103 = OpConvertSToF %6 %102 + %104 = OpCompositeConstruct %84 %103 %103 %103 %103 + OpStore %86 %104 + OpBranch %83 + %82 = OpLabel + %90 = OpAccessChain %21 %19 %20 %25 + %91 = OpLoad %11 %90 + %92 = OpConvertSToF %6 %91 + %99 = OpCompositeConstruct %84 %77 %92 %92 %77 + OpStore %86 %99 + OpBranch %83 + %83 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-min-identical-integer-division-multiplication.amber b/vulkan/amber/graphicsfuzz/cov-function-min-identical-integer-division-multiplication.amber new file mode 100644 index 0000000..c471f4f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-min-identical-integer-division-multiplication.amber @@ -0,0 +1,231 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_4 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [4, 0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# int arr[10] = int[10](_int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0); +# +# // Always true. +# if(min(4 * (_int_1 / 4), 4 * (_int_1 / 4)) == _int_0) +# { +# arr[_int_1 / _int_4] = _int_1; +# } +# +# return arr[_int_0]; +# } +# +# void main() +# { +# if(func() == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 104 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %14 "arr" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %85 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %85 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 10 + %12 = OpTypeArray %6 %11 + %13 = OpTypePointer Function %12 + %15 = OpConstant %10 3 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %6 0 + %21 = OpConstant %6 1 + %22 = OpTypePointer Uniform %6 + %44 = OpConstant %6 4 + %45 = OpConstant %6 2 + %57 = OpTypeBool + %68 = OpTypePointer Function %6 + %82 = OpTypeFloat 32 + %83 = OpTypeVector %82 4 + %84 = OpTypePointer Output %83 + %85 = OpVariable %84 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %76 = OpFunctionCall %6 %8 + %77 = OpAccessChain %22 %19 %20 %45 + %78 = OpLoad %6 %77 + %79 = OpIEqual %57 %76 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %80 %99 + %80 = OpLabel + %86 = OpAccessChain %22 %19 %20 %45 + %87 = OpLoad %6 %86 + %88 = OpConvertSToF %82 %87 + %89 = OpAccessChain %22 %19 %20 %21 + %90 = OpLoad %6 %89 + %91 = OpConvertSToF %82 %90 + %92 = OpAccessChain %22 %19 %20 %21 + %93 = OpLoad %6 %92 + %94 = OpConvertSToF %82 %93 + %95 = OpAccessChain %22 %19 %20 %45 + %96 = OpLoad %6 %95 + %97 = OpConvertSToF %82 %96 + %98 = OpCompositeConstruct %83 %88 %91 %94 %97 + OpStore %85 %98 + OpBranch %81 + %99 = OpLabel + %100 = OpAccessChain %22 %19 %20 %21 + %101 = OpLoad %6 %100 + %102 = OpConvertSToF %82 %101 + %103 = OpCompositeConstruct %83 %102 %102 %102 %102 + OpStore %85 %103 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %14 = OpVariable %13 Function + %23 = OpAccessChain %22 %19 %20 %21 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %22 %19 %20 %21 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %22 %19 %20 %21 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %22 %19 %20 %21 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %22 %19 %20 %21 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %22 %19 %20 %21 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %22 %19 %20 %21 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %22 %19 %20 %21 + %38 = OpLoad %6 %37 + %39 = OpAccessChain %22 %19 %20 %21 + %40 = OpLoad %6 %39 + %41 = OpAccessChain %22 %19 %20 %21 + %42 = OpLoad %6 %41 + %43 = OpCompositeConstruct %12 %24 %26 %28 %30 %32 %34 %36 %38 %40 %42 + OpStore %14 %43 + %46 = OpAccessChain %22 %19 %20 %45 + %47 = OpLoad %6 %46 + %48 = OpSDiv %6 %47 %44 + %49 = OpIMul %6 %44 %48 + %50 = OpAccessChain %22 %19 %20 %45 + %51 = OpLoad %6 %50 + %52 = OpSDiv %6 %51 %44 + %53 = OpIMul %6 %44 %52 + %54 = OpExtInst %6 %1 SMin %49 %53 + %55 = OpAccessChain %22 %19 %20 %21 + %56 = OpLoad %6 %55 + %58 = OpIEqual %57 %54 %56 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %60 + %59 = OpLabel + %61 = OpAccessChain %22 %19 %20 %45 + %62 = OpLoad %6 %61 + %63 = OpAccessChain %22 %19 %20 %20 + %64 = OpLoad %6 %63 + %65 = OpSDiv %6 %62 %64 + %66 = OpAccessChain %22 %19 %20 %45 + %67 = OpLoad %6 %66 + %69 = OpAccessChain %68 %14 %65 + OpStore %69 %67 + OpBranch %60 + %60 = OpLabel + %70 = OpAccessChain %22 %19 %20 %21 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %68 %14 %71 + %73 = OpLoad %6 %72 + OpReturnValue %73 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 4 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-min-integer-large-shift-unused.amber b/vulkan/amber/graphicsfuzz/cov-function-min-integer-large-shift-unused.amber new file mode 100644 index 0000000..5735496 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-min-integer-large-shift-unused.amber @@ -0,0 +1,151 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec4 func() +# { +# int a = _int_1; +# min(a, a << 24323); +# return vec4(_int_1, _int_0, _int_0, _int_1); +# } +# +# void main() +# { +# _GLF_color = func(); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "func(" + OpName %13 "a" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %46 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %46 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeFunction %7 + %11 = OpTypeInt 32 1 + %12 = OpTypePointer Function %11 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 2 + %16 = OpTypeArray %11 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %11 0 + %21 = OpTypePointer Uniform %11 + %26 = OpConstant %11 24323 + %32 = OpConstant %11 1 + %45 = OpTypePointer Output %7 + %46 = OpVariable %45 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %47 = OpFunctionCall %7 %9 + OpStore %46 %47 + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %13 = OpVariable %12 Function + %22 = OpAccessChain %21 %19 %20 %20 + %23 = OpLoad %11 %22 + OpStore %13 %23 + %24 = OpLoad %11 %13 + %25 = OpLoad %11 %13 + %27 = OpShiftLeftLogical %11 %25 %26 + %28 = OpExtInst %11 %1 SMin %24 %27 + %29 = OpAccessChain %21 %19 %20 %20 + %30 = OpLoad %11 %29 + %31 = OpConvertSToF %6 %30 + %33 = OpAccessChain %21 %19 %20 %32 + %34 = OpLoad %11 %33 + %35 = OpConvertSToF %6 %34 + %36 = OpAccessChain %21 %19 %20 %32 + %37 = OpLoad %11 %36 + %38 = OpConvertSToF %6 %37 + %39 = OpAccessChain %21 %19 %20 %20 + %40 = OpLoad %11 %39 + %41 = OpConvertSToF %6 %40 + %42 = OpCompositeConstruct %7 %31 %35 %38 %41 + OpReturnValue %42 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-multiple-loops-compare-integer-return.amber b/vulkan/amber/graphicsfuzz/cov-function-multiple-loops-compare-integer-return.amber new file mode 100644 index 0000000..f9468c3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-multiple-loops-compare-integer-return.amber @@ -0,0 +1,275 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_5 _GLF_uniform_int_values[2] +# #define _int_7 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 5, 7] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# int a = _int_1; +# +# for(int i = 1; i < 4; i++) +# { +# // Iterates four times. +# for(int j = _int_1; j < _int_5; j++) +# { +# int k = 0; +# +# for(int l = 0; l < i; l++) +# { +# // Always false. +# if(k >= 3) +# { +# break; +# } +# k++; +# +# // True during the second iteration of i. +# if(a == _int_7) +# { +# return _int_1; +# } +# } +# +# // a is incremented by total of four every time i is iterated. +# a++; +# } +# } +# return _int_0; +# } +# +# void main() +# { +# // Always true. +# if(func() == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 225 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %94 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %94 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %94 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 4 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpConstant %6 1 + %20 = OpTypePointer Uniform %6 + %30 = OpConstant %6 4 + %31 = OpTypeBool + %42 = OpConstant %6 2 + %57 = OpConstant %6 3 + %91 = OpTypeFloat 32 + %92 = OpTypeVector %91 4 + %93 = OpTypePointer Output %92 + %94 = OpVariable %93 Output + %117 = OpConstant %12 0 + %118 = OpConstantFalse %31 + %121 = OpConstantTrue %31 + %221 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %196 None + OpSwitch %117 %137 + %137 = OpLabel + %138 = OpAccessChain %20 %17 %18 %19 + %139 = OpLoad %6 %138 + OpBranch %140 + %140 = OpLabel + %210 = OpPhi %31 %118 %137 %214 %188 + %206 = OpPhi %6 %139 %137 %205 %188 + %198 = OpPhi %6 %19 %137 %190 %188 + %220 = OpPhi %6 %221 %137 %222 %188 + %143 = OpSLessThan %31 %198 %30 + OpLoopMerge %191 %188 None + OpBranchConditional %143 %144 %191 + %144 = OpLabel + OpBranch %147 + %147 = OpLabel + %209 = OpPhi %31 %210 %144 %207 %182 + %205 = OpPhi %6 %206 %144 %181 %182 + %199 = OpPhi %6 %139 %144 %184 %182 + %223 = OpPhi %6 %220 %144 %224 %182 + %150 = OpAccessChain %20 %17 %18 %42 + %151 = OpLoad %6 %150 + %152 = OpSLessThan %31 %199 %151 + OpLoopMerge %185 %182 None + OpBranchConditional %152 %153 %185 + %153 = OpLabel + OpBranch %154 + %154 = OpLabel + %203 = OpPhi %6 %18 %153 %165 %174 + %200 = OpPhi %6 %18 %153 %176 %174 + %158 = OpSLessThan %31 %200 %198 + OpLoopMerge %177 %174 None + OpBranchConditional %158 %159 %177 + %159 = OpLabel + %161 = OpSGreaterThanEqual %31 %203 %57 + OpSelectionMerge %163 None + OpBranchConditional %161 %162 %163 + %162 = OpLabel + OpBranch %177 + %163 = OpLabel + %165 = OpIAdd %6 %203 %19 + %167 = OpAccessChain %20 %17 %18 %57 + %168 = OpLoad %6 %167 + %169 = OpIEqual %31 %205 %168 + OpSelectionMerge %173 None + OpBranchConditional %169 %170 %173 + %170 = OpLabel + OpBranch %177 + %173 = OpLabel + OpBranch %174 + %174 = OpLabel + %176 = OpIAdd %6 %200 %19 + OpBranch %154 + %177 = OpLabel + %224 = OpPhi %6 %223 %154 %223 %162 %139 %170 + %207 = OpPhi %31 %209 %154 %209 %162 %121 %170 + OpSelectionMerge %179 None + OpBranchConditional %207 %185 %179 + %179 = OpLabel + %181 = OpIAdd %6 %205 %19 + OpBranch %182 + %182 = OpLabel + %184 = OpIAdd %6 %199 %19 + OpBranch %147 + %185 = OpLabel + %222 = OpPhi %6 %223 %147 %224 %177 + %214 = OpPhi %31 %209 %147 %207 %177 + OpSelectionMerge %187 None + OpBranchConditional %214 %191 %187 + %187 = OpLabel + OpBranch %188 + %188 = OpLabel + %190 = OpIAdd %6 %198 %19 + OpBranch %140 + %191 = OpLabel + %219 = OpPhi %6 %220 %140 %222 %185 + %217 = OpPhi %31 %210 %140 %214 %185 + OpSelectionMerge %193 None + OpBranchConditional %217 %196 %193 + %193 = OpLabel + %194 = OpAccessChain %20 %17 %18 %18 + %195 = OpLoad %6 %194 + OpBranch %196 + %196 = OpLabel + %218 = OpPhi %6 %219 %191 %195 %193 + %88 = OpIEqual %31 %218 %139 + OpSelectionMerge %90 None + OpBranchConditional %88 %89 %108 + %89 = OpLabel + %97 = OpConvertSToF %91 %139 + %98 = OpAccessChain %20 %17 %18 %18 + %99 = OpLoad %6 %98 + %100 = OpConvertSToF %91 %99 + %107 = OpCompositeConstruct %92 %97 %100 %100 %97 + OpStore %94 %107 + OpBranch %90 + %108 = OpLabel + %109 = OpAccessChain %20 %17 %18 %18 + %110 = OpLoad %6 %109 + %111 = OpConvertSToF %91 %110 + %112 = OpCompositeConstruct %92 %111 %111 %111 %111 + OpStore %94 %112 + OpBranch %90 + %90 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 5 7 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-nested-do-whiles-looped-once.amber b/vulkan/amber/graphicsfuzz/cov-function-nested-do-whiles-looped-once.amber new file mode 100644 index 0000000..4135d8a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-nested-do-whiles-looped-once.amber @@ -0,0 +1,288 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // This function always returns 1. +# int func(float x) +# { +# while(true) +# { +# do +# { +# // Always false. +# if(gl_FragCoord.y < _float_0_0) +# { +# do +# { +# } +# while(gl_FragCoord.x < _float_0_0); +# } +# +# // Always true. +# if(x >= _float_0_0) +# { +# return _int_1; +# } +# } +# while(gl_FragCoord.y < _float_0_0); +# } +# // Never executed. +# return _int_0; +# } +# +# void main() +# { +# // Always true. +# if(func(gl_FragCoord.x) == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 107 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %26 %88 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "func(f1;" + OpName %10 "x" + OpName %26 "gl_FragCoord" + OpName %33 "buf0" + OpMemberName %33 0 "_GLF_uniform_float_values" + OpName %35 "" + OpName %61 "buf1" + OpMemberName %61 0 "_GLF_uniform_int_values" + OpName %63 "" + OpName %78 "param" + OpName %88 "_GLF_color" + OpDecorate %26 BuiltIn FragCoord + OpDecorate %32 ArrayStride 16 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 0 + OpDecorate %60 ArrayStride 16 + OpMemberDecorate %61 0 Offset 0 + OpDecorate %61 Block + OpDecorate %63 DescriptorSet 0 + OpDecorate %63 Binding 1 + OpDecorate %88 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeInt 32 1 + %9 = OpTypeFunction %8 %7 + %18 = OpTypeBool + %19 = OpConstantTrue %18 + %24 = OpTypeVector %6 4 + %25 = OpTypePointer Input %24 + %26 = OpVariable %25 Input + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 1 + %29 = OpTypePointer Input %6 + %32 = OpTypeArray %6 %28 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpConstant %8 0 + %37 = OpTypePointer Uniform %6 + %47 = OpConstant %27 0 + %59 = OpConstant %27 2 + %60 = OpTypeArray %8 %59 + %61 = OpTypeStruct %60 + %62 = OpTypePointer Uniform %61 + %63 = OpVariable %62 Uniform + %64 = OpConstant %8 1 + %65 = OpTypePointer Uniform %8 + %87 = OpTypePointer Output %24 + %88 = OpVariable %87 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %78 = OpVariable %7 Function + %79 = OpAccessChain %29 %26 %47 + %80 = OpLoad %6 %79 + OpStore %78 %80 + %81 = OpFunctionCall %8 %11 %78 + %82 = OpAccessChain %65 %63 %36 %64 + %83 = OpLoad %8 %82 + %84 = OpIEqual %18 %81 %83 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %102 + %85 = OpLabel + %89 = OpAccessChain %65 %63 %36 %64 + %90 = OpLoad %8 %89 + %91 = OpConvertSToF %6 %90 + %92 = OpAccessChain %65 %63 %36 %36 + %93 = OpLoad %8 %92 + %94 = OpConvertSToF %6 %93 + %95 = OpAccessChain %65 %63 %36 %36 + %96 = OpLoad %8 %95 + %97 = OpConvertSToF %6 %96 + %98 = OpAccessChain %65 %63 %36 %64 + %99 = OpLoad %8 %98 + %100 = OpConvertSToF %6 %99 + %101 = OpCompositeConstruct %24 %91 %94 %97 %100 + OpStore %88 %101 + OpBranch %86 + %102 = OpLabel + %103 = OpAccessChain %65 %63 %36 %36 + %104 = OpLoad %8 %103 + %105 = OpConvertSToF %6 %104 + %106 = OpCompositeConstruct %24 %105 %105 %105 %105 + OpStore %88 %106 + OpBranch %86 + %86 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %8 None %9 + %10 = OpFunctionParameter %7 + %12 = OpLabel + OpBranch %13 + %13 = OpLabel + OpLoopMerge %15 %16 None + OpBranch %17 + %17 = OpLabel + OpBranchConditional %19 %14 %15 + %14 = OpLabel + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %21 + %21 = OpLabel + %30 = OpAccessChain %29 %26 %28 + %31 = OpLoad %6 %30 + %38 = OpAccessChain %37 %35 %36 %36 + %39 = OpLoad %6 %38 + %40 = OpFOrdLessThan %18 %31 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %42 + %41 = OpLabel + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %44 + %44 = OpLabel + OpBranch %46 + %46 = OpLabel + %48 = OpAccessChain %29 %26 %47 + %49 = OpLoad %6 %48 + %50 = OpAccessChain %37 %35 %36 %36 + %51 = OpLoad %6 %50 + %52 = OpFOrdLessThan %18 %49 %51 + OpBranchConditional %52 %43 %45 + %45 = OpLabel + OpBranch %42 + %42 = OpLabel + %53 = OpLoad %6 %10 + %54 = OpAccessChain %37 %35 %36 %36 + %55 = OpLoad %6 %54 + %56 = OpFOrdGreaterThanEqual %18 %53 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + %66 = OpAccessChain %65 %63 %36 %64 + %67 = OpLoad %8 %66 + OpReturnValue %67 + %58 = OpLabel + OpBranch %23 + %23 = OpLabel + %69 = OpAccessChain %29 %26 %28 + %70 = OpLoad %6 %69 + %71 = OpAccessChain %37 %35 %36 %36 + %72 = OpLoad %6 %71 + %73 = OpFOrdLessThan %18 %70 %72 + OpBranchConditional %73 %20 %22 + %22 = OpLabel + OpBranch %16 + %16 = OpLabel + OpBranch %13 + %15 = OpLabel + %74 = OpAccessChain %65 %63 %36 %36 + %75 = OpLoad %8 %74 + OpReturnValue %75 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-nested-loops-break-early-never-discard.amber b/vulkan/amber/graphicsfuzz/cov-function-nested-loops-break-early-never-discard.amber new file mode 100644 index 0000000..3889180 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-nested-loops-break-early-never-discard.amber @@ -0,0 +1,437 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--convert-local-access-chains' +# '--copy-propagate-arrays' +# '--reduce-load-size' +# '--scalar-replacement=100' +# '--eliminate-dead-code-aggressive' +# '--eliminate-dead-inserts' +# '--convert-local-access-chains' +# '--private-to-local' +# '--eliminate-local-single-block' +# '--combine-access-chains' +# '--eliminate-local-single-block' +# '--eliminate-local-single-store' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--eliminate-local-single-store' +# '--ccp' +# '--simplify-instructions' +# '--eliminate-dead-inserts' +# '--inline-entry-points-exhaustive' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-branches' +# '--merge-return' +# '--ccp' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_20 _GLF_uniform_int_values[0] +# #define _int_5 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [20, 5, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# int a = _int_0; +# +# for(int i = _int_1; i < _int_20; i++) +# { +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# discard; +# } +# +# for(int j = 1; j < 80; j ++) +# { +# if(a >= 5) +# { +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# continue; +# } +# +# break; +# } +# +# a++; +# +# if(gl_FragCoord.x < _float_1_0) +# { +# _GLF_color = vec4(_int_1); +# } +# } +# } +# +# // Always returns 5. +# return a; +# } +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# +# // Always true. +# if(func() == _int_5) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 180 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %40 %88 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "a" + OpName %15 "buf1" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %23 "i" + OpName %40 "gl_FragCoord" + OpName %50 "j" + OpName %78 "buf0" + OpMemberName %78 0 "_GLF_uniform_float_values" + OpName %80 "" + OpName %88 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 1 + OpDecorate %40 BuiltIn FragCoord + OpDecorate %77 ArrayStride 16 + OpMemberDecorate %78 0 Offset 0 + OpDecorate %78 Block + OpDecorate %80 DescriptorSet 0 + OpDecorate %80 Binding 0 + OpDecorate %88 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 4 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpConstant %6 2 + %20 = OpTypePointer Uniform %6 + %24 = OpConstant %6 3 + %35 = OpTypeBool + %37 = OpTypeFloat 32 + %38 = OpTypeVector %37 4 + %39 = OpTypePointer Input %38 + %40 = OpVariable %39 Input + %41 = OpConstant %12 1 + %42 = OpTypePointer Input %37 + %45 = OpConstant %37 0 + %51 = OpConstant %6 1 + %58 = OpConstant %6 80 + %61 = OpConstant %6 5 + %74 = OpConstant %12 0 + %77 = OpTypeArray %37 %41 + %78 = OpTypeStruct %77 + %79 = OpTypePointer Uniform %78 + %80 = OpVariable %79 Uniform + %81 = OpTypePointer Uniform %37 + %87 = OpTypePointer Output %38 + %88 = OpVariable %87 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %123 = OpVariable %10 Function + %124 = OpVariable %10 Function + %125 = OpVariable %10 Function + %126 = OpVariable %10 Function + %100 = OpAccessChain %20 %17 %18 %19 + %101 = OpLoad %6 %100 + %102 = OpConvertSToF %37 %101 + %103 = OpCompositeConstruct %38 %102 %102 %102 %102 + OpStore %88 %103 + %128 = OpAccessChain %20 %17 %18 %19 + %129 = OpLoad %6 %128 + OpStore %123 %129 + %130 = OpAccessChain %20 %17 %18 %24 + %131 = OpLoad %6 %130 + OpStore %124 %131 + OpBranch %132 + %132 = OpLabel + %134 = OpLoad %6 %124 + %135 = OpAccessChain %20 %17 %18 %18 + %136 = OpLoad %6 %135 + %137 = OpSLessThan %35 %134 %136 + OpLoopMerge %178 %175 None + OpBranchConditional %137 %138 %178 + %138 = OpLabel + %139 = OpAccessChain %42 %40 %41 + %140 = OpLoad %37 %139 + %141 = OpFOrdLessThan %35 %140 %45 + OpSelectionMerge %143 None + OpBranchConditional %141 %142 %143 + %142 = OpLabel + OpTerminateInvocation + %143 = OpLabel + OpStore %125 %51 + OpBranch %144 + %144 = OpLabel + %146 = OpLoad %6 %125 + %147 = OpSLessThan %35 %146 %58 + OpLoopMerge %174 %171 None + OpBranchConditional %147 %148 %174 + %148 = OpLabel + %149 = OpLoad %6 %123 + %150 = OpSGreaterThanEqual %35 %149 %61 + OpSelectionMerge %157 None + OpBranchConditional %150 %151 %157 + %151 = OpLabel + %152 = OpAccessChain %42 %40 %41 + %153 = OpLoad %37 %152 + %154 = OpFOrdLessThan %35 %153 %45 + OpSelectionMerge %156 None + OpBranchConditional %154 %155 %156 + %155 = OpLabel + OpBranch %171 + %156 = OpLabel + OpBranch %174 + %157 = OpLabel + %158 = OpLoad %6 %123 + %159 = OpIAdd %6 %158 %51 + OpStore %123 %159 + %160 = OpAccessChain %42 %40 %74 + %161 = OpLoad %37 %160 + %162 = OpAccessChain %81 %80 %18 %18 + %163 = OpLoad %37 %162 + %164 = OpFOrdLessThan %35 %161 %163 + OpSelectionMerge %170 None + OpBranchConditional %164 %165 %170 + %165 = OpLabel + %166 = OpAccessChain %20 %17 %18 %24 + %167 = OpLoad %6 %166 + %168 = OpConvertSToF %37 %167 + %169 = OpCompositeConstruct %38 %168 %168 %168 %168 + OpStore %88 %169 + OpBranch %170 + %170 = OpLabel + OpBranch %171 + %171 = OpLabel + %172 = OpLoad %6 %125 + %173 = OpIAdd %6 %172 %51 + OpStore %125 %173 + OpBranch %144 + %174 = OpLabel + OpBranch %175 + %175 = OpLabel + %176 = OpLoad %6 %124 + %177 = OpIAdd %6 %176 %51 + OpStore %124 %177 + OpBranch %132 + %178 = OpLabel + %179 = OpLoad %6 %123 + OpStore %126 %179 + %104 = OpLoad %6 %126 + %105 = OpAccessChain %20 %17 %18 %51 + %106 = OpLoad %6 %105 + %107 = OpIEqual %35 %104 %106 + OpSelectionMerge %109 None + OpBranchConditional %107 %108 %109 + %108 = OpLabel + %110 = OpAccessChain %20 %17 %18 %24 + %111 = OpLoad %6 %110 + %112 = OpConvertSToF %37 %111 + %113 = OpAccessChain %20 %17 %18 %19 + %114 = OpLoad %6 %113 + %115 = OpConvertSToF %37 %114 + %116 = OpAccessChain %20 %17 %18 %19 + %117 = OpLoad %6 %116 + %118 = OpConvertSToF %37 %117 + %119 = OpAccessChain %20 %17 %18 %24 + %120 = OpLoad %6 %119 + %121 = OpConvertSToF %37 %120 + %122 = OpCompositeConstruct %38 %112 %115 %118 %121 + OpStore %88 %122 + OpBranch %109 + %109 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %23 = OpVariable %10 Function + %50 = OpVariable %10 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %6 %21 + OpStore %11 %22 + %25 = OpAccessChain %20 %17 %18 %24 + %26 = OpLoad %6 %25 + OpStore %23 %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %6 %23 + %33 = OpAccessChain %20 %17 %18 %18 + %34 = OpLoad %6 %33 + %36 = OpSLessThan %35 %32 %34 + OpBranchConditional %36 %28 %29 + %28 = OpLabel + %43 = OpAccessChain %42 %40 %41 + %44 = OpLoad %37 %43 + %46 = OpFOrdLessThan %35 %44 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + OpTerminateInvocation + %48 = OpLabel + OpStore %50 %51 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %6 %50 + %59 = OpSLessThan %35 %57 %58 + OpBranchConditional %59 %53 %54 + %53 = OpLabel + %60 = OpLoad %6 %11 + %62 = OpSGreaterThanEqual %35 %60 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %64 + %63 = OpLabel + %65 = OpAccessChain %42 %40 %41 + %66 = OpLoad %37 %65 + %67 = OpFOrdLessThan %35 %66 %45 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %69 + %68 = OpLabel + OpBranch %55 + %69 = OpLabel + OpBranch %54 + %64 = OpLabel + %72 = OpLoad %6 %11 + %73 = OpIAdd %6 %72 %51 + OpStore %11 %73 + %75 = OpAccessChain %42 %40 %74 + %76 = OpLoad %37 %75 + %82 = OpAccessChain %81 %80 %18 %18 + %83 = OpLoad %37 %82 + %84 = OpFOrdLessThan %35 %76 %83 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %86 + %85 = OpLabel + %89 = OpAccessChain %20 %17 %18 %24 + %90 = OpLoad %6 %89 + %91 = OpConvertSToF %37 %90 + %92 = OpCompositeConstruct %38 %91 %91 %91 %91 + OpStore %88 %92 + OpBranch %86 + %86 = OpLabel + OpBranch %55 + %55 = OpLabel + %93 = OpLoad %6 %50 + %94 = OpIAdd %6 %93 %51 + OpStore %50 %94 + OpBranch %52 + %54 = OpLabel + OpBranch %30 + %30 = OpLabel + %95 = OpLoad %6 %23 + %96 = OpIAdd %6 %95 %51 + OpStore %23 %96 + OpBranch %27 + %29 = OpLabel + %97 = OpLoad %6 %11 + OpReturnValue %97 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 20 5 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-nested-loops-limit-uniform-xor-uniform.amber b/vulkan/amber/graphicsfuzz/cov-function-nested-loops-limit-uniform-xor-uniform.amber new file mode 100644 index 0000000..dbdcddc --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-nested-loops-limit-uniform-xor-uniform.amber @@ -0,0 +1,355 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of one: 1 +# layout(push_constant) uniform buf_push +# { +# int one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func(float x) +# { +# vec2 v = vec2(_float_1_0); +# +# // Always true. +# while(one >= 1) +# { +# // Always true. +# if(v.x > _float_0_0) +# { +# int a = 1; +# +# // Iterates twice. +# for(int i = _int_0; i < _int_2; i++) +# { +# // Iterates once. +# for(int j = _int_1; j != (_int_1 ^ one); j--) +# { +# // Iterates twice when this block is first executed. +# while(a >= 0) +# { +# x = _float_1_0; +# a--; +# } +# } +# } +# +# // Always true. +# if (a == -1) +# return 1; +# +# // Never executed. +# v = vec2(x); +# } +# } +# +# // Never executed. +# return _int_0; +# } +# +# void main() +# { +# int a = _int_0; +# int b = func(_float_0_0); +# _GLF_color = vec4(b, a, a, b); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 132 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %122 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "func(f1;" + OpName %10 "x" + OpName %15 "v" + OpName %19 "buf1" + OpMemberName %19 0 "_GLF_uniform_float_values" + OpName %21 "" + OpName %32 "buf_push" + OpMemberName %32 0 "one" + OpName %34 "" + OpName %50 "a" + OpName %51 "i" + OpName %54 "buf0" + OpMemberName %54 0 "_GLF_uniform_int_values" + OpName %56 "" + OpName %70 "j" + OpName %112 "a" + OpName %115 "b" + OpName %116 "param" + OpName %122 "_GLF_color" + OpDecorate %18 ArrayStride 16 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 1 + OpMemberDecorate %32 0 Offset 0 + OpDecorate %32 Block + OpDecorate %53 ArrayStride 16 + OpMemberDecorate %54 0 Offset 0 + OpDecorate %54 Block + OpDecorate %56 DescriptorSet 0 + OpDecorate %56 Binding 0 + OpDecorate %122 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeInt 32 1 + %9 = OpTypeFunction %8 %7 + %13 = OpTypeVector %6 2 + %14 = OpTypePointer Function %13 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 2 + %18 = OpTypeArray %6 %17 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpConstant %8 0 + %23 = OpTypePointer Uniform %6 + %32 = OpTypeStruct %8 + %33 = OpTypePointer PushConstant %32 + %34 = OpVariable %33 PushConstant + %35 = OpTypePointer PushConstant %8 + %38 = OpConstant %8 1 + %39 = OpTypeBool + %41 = OpConstant %16 0 + %49 = OpTypePointer Function %8 + %52 = OpConstant %16 3 + %53 = OpTypeArray %8 %52 + %54 = OpTypeStruct %53 + %55 = OpTypePointer Uniform %54 + %56 = OpVariable %55 Uniform + %57 = OpTypePointer Uniform %8 + %66 = OpConstant %8 2 + %101 = OpConstant %8 -1 + %120 = OpTypeVector %6 4 + %121 = OpTypePointer Output %120 + %122 = OpVariable %121 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %112 = OpVariable %49 Function + %115 = OpVariable %49 Function + %116 = OpVariable %7 Function + %113 = OpAccessChain %57 %56 %22 %38 + %114 = OpLoad %8 %113 + OpStore %112 %114 + %117 = OpAccessChain %23 %21 %22 %38 + %118 = OpLoad %6 %117 + OpStore %116 %118 + %119 = OpFunctionCall %8 %11 %116 + OpStore %115 %119 + %123 = OpLoad %8 %115 + %124 = OpConvertSToF %6 %123 + %125 = OpLoad %8 %112 + %126 = OpConvertSToF %6 %125 + %127 = OpLoad %8 %112 + %128 = OpConvertSToF %6 %127 + %129 = OpLoad %8 %115 + %130 = OpConvertSToF %6 %129 + %131 = OpCompositeConstruct %120 %124 %126 %128 %130 + OpStore %122 %131 + OpReturn + OpFunctionEnd + %11 = OpFunction %8 None %9 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %15 = OpVariable %14 Function + %50 = OpVariable %49 Function + %51 = OpVariable %49 Function + %70 = OpVariable %49 Function + %24 = OpAccessChain %23 %21 %22 %22 + %25 = OpLoad %6 %24 + %26 = OpCompositeConstruct %13 %25 %25 + OpStore %15 %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %36 = OpAccessChain %35 %34 %22 + %37 = OpLoad %8 %36 + %40 = OpSGreaterThanEqual %39 %37 %38 + OpBranchConditional %40 %28 %29 + %28 = OpLabel + %42 = OpAccessChain %7 %15 %41 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %23 %21 %22 %38 + %45 = OpLoad %6 %44 + %46 = OpFOrdGreaterThan %39 %43 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + OpStore %50 %38 + %58 = OpAccessChain %57 %56 %22 %38 + %59 = OpLoad %8 %58 + OpStore %51 %59 + OpBranch %60 + %60 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %8 %51 + %67 = OpAccessChain %57 %56 %22 %66 + %68 = OpLoad %8 %67 + %69 = OpSLessThan %39 %65 %68 + OpBranchConditional %69 %61 %62 + %61 = OpLabel + %71 = OpAccessChain %57 %56 %22 %22 + %72 = OpLoad %8 %71 + OpStore %70 %72 + OpBranch %73 + %73 = OpLabel + OpLoopMerge %75 %76 None + OpBranch %77 + %77 = OpLabel + %78 = OpLoad %8 %70 + %79 = OpAccessChain %57 %56 %22 %22 + %80 = OpLoad %8 %79 + %81 = OpAccessChain %35 %34 %22 + %82 = OpLoad %8 %81 + %83 = OpBitwiseXor %8 %80 %82 + %84 = OpINotEqual %39 %78 %83 + OpBranchConditional %84 %74 %75 + %74 = OpLabel + OpBranch %85 + %85 = OpLabel + OpLoopMerge %87 %88 None + OpBranch %89 + %89 = OpLabel + %90 = OpLoad %8 %50 + %91 = OpSGreaterThanEqual %39 %90 %22 + OpBranchConditional %91 %86 %87 + %86 = OpLabel + %92 = OpAccessChain %23 %21 %22 %22 + %93 = OpLoad %6 %92 + OpStore %10 %93 + %94 = OpLoad %8 %50 + %95 = OpISub %8 %94 %38 + OpStore %50 %95 + OpBranch %88 + %88 = OpLabel + OpBranch %85 + %87 = OpLabel + OpBranch %76 + %76 = OpLabel + %96 = OpLoad %8 %70 + %97 = OpISub %8 %96 %38 + OpStore %70 %97 + OpBranch %73 + %75 = OpLabel + OpBranch %63 + %63 = OpLabel + %98 = OpLoad %8 %51 + %99 = OpIAdd %8 %98 %38 + OpStore %51 %99 + OpBranch %60 + %62 = OpLabel + %100 = OpLoad %8 %50 + %102 = OpIEqual %39 %100 %101 + OpSelectionMerge %104 None + OpBranchConditional %102 %103 %104 + %103 = OpLabel + OpReturnValue %38 + %104 = OpLabel + %106 = OpLoad %6 %10 + %107 = OpCompositeConstruct %13 %106 %106 + OpStore %15 %107 + OpBranch %48 + %48 = OpLabel + OpBranch %30 + %30 = OpLabel + OpBranch %27 + %29 = OpLabel + %108 = OpAccessChain %57 %56 %22 %38 + %109 = OpLoad %8 %108 + OpReturnValue %109 + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 STD140 DATA + 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS push_constant + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-parameter-zero-divided-by-uniform.amber b/vulkan/amber/graphicsfuzz/cov-function-parameter-zero-divided-by-uniform.amber new file mode 100644 index 0000000..603a3a0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-parameter-zero-divided-by-uniform.amber @@ -0,0 +1,232 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 100; +# int _GLF_global_loop_count = 0; +# +# // Contents of resolution: [0.2501191, 0.1597625] +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 resolution; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec4 func(ivec2 v) +# { +# // Iterated once. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# +# // Always true. +# if(v.x < _int_1) +# { +# return vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +# +# // Never executed. +# return vec4(_int_0); +# } +# +# void main() +# { +# // The x component of the ivec is zero because 0 / N is always zero. +# _GLF_color = func((ivec2(vec2(0, _int_1) / resolution))); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 84 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %67 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %13 "func(vi2;" + OpName %12 "v" + OpName %16 "_GLF_global_loop_count" + OpName %37 "buf0" + OpMemberName %37 0 "_GLF_uniform_int_values" + OpName %39 "" + OpName %67 "_GLF_color" + OpName %74 "buf1" + OpMemberName %74 0 "resolution" + OpName %76 "" + OpName %82 "param" + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 0 + OpDecorate %67 Location 0 + OpMemberDecorate %74 0 Offset 0 + OpDecorate %74 Block + OpDecorate %76 DescriptorSet 0 + OpDecorate %76 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypeFunction %10 %8 + %15 = OpTypePointer Private %6 + %16 = OpVariable %15 Private + %17 = OpConstant %6 0 + %24 = OpConstant %6 100 + %25 = OpTypeBool + %28 = OpConstant %6 1 + %30 = OpTypeInt 32 0 + %31 = OpConstant %30 0 + %32 = OpTypePointer Function %6 + %35 = OpConstant %30 2 + %36 = OpTypeArray %6 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %6 + %66 = OpTypePointer Output %10 + %67 = OpVariable %66 Output + %68 = OpConstant %9 0 + %72 = OpTypeVector %9 2 + %74 = OpTypeStruct %72 + %75 = OpTypePointer Uniform %74 + %76 = OpVariable %75 Uniform + %77 = OpTypePointer Uniform %72 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %82 = OpVariable %8 Function + OpStore %16 %17 + %69 = OpAccessChain %40 %39 %17 %28 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %9 %70 + %73 = OpCompositeConstruct %72 %68 %71 + %78 = OpAccessChain %77 %76 %17 + %79 = OpLoad %72 %78 + %80 = OpFDiv %72 %73 %79 + %81 = OpConvertFToS %7 %80 + OpStore %82 %81 + %83 = OpFunctionCall %10 %13 %82 + OpStore %67 %83 + OpReturn + OpFunctionEnd + %13 = OpFunction %10 None %11 + %12 = OpFunctionParameter %8 + %14 = OpLabel + OpBranch %18 + %18 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %23 = OpLoad %6 %16 + %26 = OpSLessThan %25 %23 %24 + OpBranchConditional %26 %19 %20 + %19 = OpLabel + %27 = OpLoad %6 %16 + %29 = OpIAdd %6 %27 %28 + OpStore %16 %29 + %33 = OpAccessChain %32 %12 %31 + %34 = OpLoad %6 %33 + %41 = OpAccessChain %40 %39 %17 %28 + %42 = OpLoad %6 %41 + %43 = OpSLessThan %25 %34 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %45 + %44 = OpLabel + %46 = OpAccessChain %40 %39 %17 %28 + %47 = OpLoad %6 %46 + %48 = OpConvertSToF %9 %47 + %49 = OpAccessChain %40 %39 %17 %17 + %50 = OpLoad %6 %49 + %51 = OpConvertSToF %9 %50 + %52 = OpAccessChain %40 %39 %17 %17 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %9 %53 + %55 = OpAccessChain %40 %39 %17 %28 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %9 %56 + %58 = OpCompositeConstruct %10 %48 %51 %54 %57 + OpReturnValue %58 + %45 = OpLabel + OpBranch %21 + %21 = OpLabel + OpBranch %18 + %20 = OpLabel + %60 = OpAccessChain %40 %39 %17 %17 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %9 %61 + %63 = OpCompositeConstruct %10 %62 %62 %62 %62 + OpReturnValue %63 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 0.2501191 0.1597625 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-round-unpack-half-2x16.amber b/vulkan/amber/graphicsfuzz/cov-function-round-unpack-half-2x16.amber new file mode 100644 index 0000000..ca09b05 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-round-unpack-half-2x16.amber @@ -0,0 +1,201 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float func() +# { +# // 1u unpacked as a half float is a number very close to zero. +# // Rounding it makes it exactly zero. +# return round(unpackHalf2x16(1u)).x; +# } +# +# void main() +# { +# // Always true. +# if(func() == _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %38 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %24 "buf0" + OpMemberName %24 0 "_GLF_uniform_float_values" + OpName %26 "" + OpName %38 "_GLF_color" + OpName %41 "buf1" + OpMemberName %41 0 "_GLF_uniform_int_values" + OpName %43 "" + OpDecorate %14 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %23 ArrayStride 16 + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 0 + OpDecorate %38 Location 0 + OpDecorate %40 ArrayStride 16 + OpMemberDecorate %41 0 Offset 0 + OpDecorate %41 Block + OpDecorate %43 DescriptorSet 0 + OpDecorate %43 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 1 + %12 = OpTypeVector %6 2 + %15 = OpConstant %10 0 + %17 = OpTypePointer Function %6 + %23 = OpTypeArray %6 %11 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpTypeInt 32 1 + %28 = OpConstant %27 0 + %29 = OpTypePointer Uniform %6 + %32 = OpTypeBool + %36 = OpTypeVector %6 4 + %37 = OpTypePointer Output %36 + %38 = OpVariable %37 Output + %39 = OpConstant %10 2 + %40 = OpTypeArray %27 %39 + %41 = OpTypeStruct %40 + %42 = OpTypePointer Uniform %41 + %43 = OpVariable %42 Uniform + %44 = OpConstant %27 1 + %45 = OpTypePointer Uniform %27 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %22 = OpFunctionCall %6 %8 + %30 = OpAccessChain %29 %26 %28 %28 + %31 = OpLoad %6 %30 + %33 = OpFOrdEqual %32 %22 %31 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %59 + %34 = OpLabel + %46 = OpAccessChain %45 %43 %28 %44 + %47 = OpLoad %27 %46 + %48 = OpConvertSToF %6 %47 + %49 = OpAccessChain %45 %43 %28 %28 + %50 = OpLoad %27 %49 + %51 = OpConvertSToF %6 %50 + %52 = OpAccessChain %45 %43 %28 %28 + %53 = OpLoad %27 %52 + %54 = OpConvertSToF %6 %53 + %55 = OpAccessChain %45 %43 %28 %44 + %56 = OpLoad %27 %55 + %57 = OpConvertSToF %6 %56 + %58 = OpCompositeConstruct %36 %48 %51 %54 %57 + OpStore %38 %58 + OpBranch %35 + %59 = OpLabel + %60 = OpAccessChain %45 %43 %28 %28 + %61 = OpLoad %27 %60 + %62 = OpConvertSToF %6 %61 + %63 = OpCompositeConstruct %36 %62 %62 %62 %62 + OpStore %38 %63 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %18 = OpVariable %17 Function + %13 = OpExtInst %12 %1 UnpackHalf2x16 %11 + %14 = OpExtInst %12 %1 Round %13 + %16 = OpCompositeExtract %6 %14 0 + OpStore %18 %16 + %19 = OpLoad %6 %18 + OpReturnValue %19 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-set-struct-field-zero-loop-reset-first-element.amber b/vulkan/amber/graphicsfuzz/cov-function-set-struct-field-zero-loop-reset-first-element.amber new file mode 100644 index 0000000..c39a890 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-set-struct-field-zero-loop-reset-first-element.amber @@ -0,0 +1,399 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _int_5 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 10, 5] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(push_constant) uniform buf_push { +# highp vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S +# { +# int data; +# }; +# +# S arr[10] = S[10](S(1), S(1), S(1), S(1), S(1), S(1), S(1), S(1), S(1), S(1)); +# +# void func(inout S s) +# { +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# return; +# } +# +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# return; +# } +# +# s.data = 0; +# } +# +# void main() +# { +# func(arr[_int_1]); +# bool b = false; +# +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# b = true; +# } +# +# // Always true. +# if(!b) +# { +# int idx = 0; +# +# for(int i = 0; i < _int_5; i++) +# { +# arr[idx].data = _int_1; +# func(arr[i]); +# } +# } +# +# // The first five elements had data set to zero, but also the first element was set back to one in iterations i = 1..4. +# int ref[10] = int[10](_int_1, _int_0, _int_0, _int_0, _int_0, _int_1, _int_1, _int_1, _int_1, _int_1); +# +# // Check the results and set an output color to black if the check fails. +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# for(int i = _int_0; i < _int_10; i++) +# { +# if(arr[i].data != ref[i]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 175 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %41 %133 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "S" + OpMemberName %7 0 "data" + OpName %11 "func(struct-S-i11;" + OpName %10 "s" + OpName %17 "arr" + OpName %23 "buf_push" + OpMemberName %23 0 "injectionSwitch" + OpName %25 "" + OpName %41 "gl_FragCoord" + OpName %54 "buf0" + OpMemberName %54 0 "_GLF_uniform_int_values" + OpName %56 "" + OpName %60 "param" + OpName %68 "b" + OpName %82 "idx" + OpName %83 "i" + OpName %100 "param" + OpName %110 "ref" + OpName %133 "_GLF_color" + OpName %147 "i" + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %41 BuiltIn FragCoord + OpDecorate %53 ArrayStride 16 + OpMemberDecorate %54 0 Offset 0 + OpDecorate %54 Block + OpDecorate %56 DescriptorSet 0 + OpDecorate %56 Binding 0 + OpDecorate %133 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %2 %8 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 10 + %15 = OpTypeArray %7 %14 + %16 = OpTypePointer Private %15 + %17 = OpVariable %16 Private + %18 = OpConstant %6 1 + %19 = OpConstantComposite %7 %18 + %20 = OpConstantComposite %15 %19 %19 %19 %19 %19 %19 %19 %19 %19 %19 + %21 = OpTypeFloat 32 + %22 = OpTypeVector %21 2 + %23 = OpTypeStruct %22 + %24 = OpTypePointer PushConstant %23 + %25 = OpVariable %24 PushConstant + %26 = OpConstant %6 0 + %27 = OpConstant %13 0 + %28 = OpTypePointer PushConstant %21 + %31 = OpConstant %13 1 + %34 = OpTypeBool + %39 = OpTypeVector %21 4 + %40 = OpTypePointer Input %39 + %41 = OpVariable %40 Input + %42 = OpTypePointer Input %21 + %45 = OpConstant %21 0 + %50 = OpTypePointer Function %6 + %52 = OpConstant %13 4 + %53 = OpTypeArray %6 %52 + %54 = OpTypeStruct %53 + %55 = OpTypePointer Uniform %54 + %56 = OpVariable %55 Uniform + %57 = OpTypePointer Uniform %6 + %61 = OpTypePointer Private %7 + %67 = OpTypePointer Function %34 + %69 = OpConstantFalse %34 + %77 = OpConstantTrue %34 + %90 = OpConstant %6 3 + %97 = OpTypePointer Private %6 + %108 = OpTypeArray %6 %14 + %109 = OpTypePointer Function %108 + %132 = OpTypePointer Output %39 + %133 = OpVariable %132 Output + %156 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %60 = OpVariable %8 Function + %68 = OpVariable %67 Function + %82 = OpVariable %50 Function + %83 = OpVariable %50 Function + %100 = OpVariable %8 Function + %110 = OpVariable %109 Function + %147 = OpVariable %50 Function + OpStore %17 %20 + %58 = OpAccessChain %57 %56 %26 %26 + %59 = OpLoad %6 %58 + %62 = OpAccessChain %61 %17 %59 + %63 = OpLoad %7 %62 + OpStore %60 %63 + %64 = OpFunctionCall %2 %11 %60 + %65 = OpLoad %7 %60 + %66 = OpAccessChain %61 %17 %59 + OpStore %66 %65 + OpStore %68 %69 + %70 = OpAccessChain %28 %25 %26 %27 + %71 = OpLoad %21 %70 + %72 = OpAccessChain %28 %25 %26 %31 + %73 = OpLoad %21 %72 + %74 = OpFOrdGreaterThan %34 %71 %73 + OpSelectionMerge %76 None + OpBranchConditional %74 %75 %76 + %75 = OpLabel + OpStore %68 %77 + OpBranch %76 + %76 = OpLabel + %78 = OpLoad %34 %68 + %79 = OpLogicalNot %34 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %80 %81 + %80 = OpLabel + OpStore %82 %26 + OpStore %83 %26 + OpBranch %84 + %84 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %89 = OpLoad %6 %83 + %91 = OpAccessChain %57 %56 %26 %90 + %92 = OpLoad %6 %91 + %93 = OpSLessThan %34 %89 %92 + OpBranchConditional %93 %85 %86 + %85 = OpLabel + %94 = OpLoad %6 %82 + %95 = OpAccessChain %57 %56 %26 %26 + %96 = OpLoad %6 %95 + %98 = OpAccessChain %97 %17 %94 %26 + OpStore %98 %96 + %99 = OpLoad %6 %83 + %101 = OpAccessChain %61 %17 %99 + %102 = OpLoad %7 %101 + OpStore %100 %102 + %103 = OpFunctionCall %2 %11 %100 + %104 = OpLoad %7 %100 + %105 = OpAccessChain %61 %17 %99 + OpStore %105 %104 + OpBranch %87 + %87 = OpLabel + %106 = OpLoad %6 %83 + %107 = OpIAdd %6 %106 %18 + OpStore %83 %107 + OpBranch %84 + %86 = OpLabel + OpBranch %81 + %81 = OpLabel + %111 = OpAccessChain %57 %56 %26 %26 + %112 = OpLoad %6 %111 + %113 = OpAccessChain %57 %56 %26 %18 + %114 = OpLoad %6 %113 + %115 = OpAccessChain %57 %56 %26 %18 + %116 = OpLoad %6 %115 + %117 = OpAccessChain %57 %56 %26 %18 + %118 = OpLoad %6 %117 + %119 = OpAccessChain %57 %56 %26 %18 + %120 = OpLoad %6 %119 + %121 = OpAccessChain %57 %56 %26 %26 + %122 = OpLoad %6 %121 + %123 = OpAccessChain %57 %56 %26 %26 + %124 = OpLoad %6 %123 + %125 = OpAccessChain %57 %56 %26 %26 + %126 = OpLoad %6 %125 + %127 = OpAccessChain %57 %56 %26 %26 + %128 = OpLoad %6 %127 + %129 = OpAccessChain %57 %56 %26 %26 + %130 = OpLoad %6 %129 + %131 = OpCompositeConstruct %108 %112 %114 %116 %118 %120 %122 %124 %126 %128 %130 + OpStore %110 %131 + %134 = OpAccessChain %57 %56 %26 %26 + %135 = OpLoad %6 %134 + %136 = OpConvertSToF %21 %135 + %137 = OpAccessChain %57 %56 %26 %18 + %138 = OpLoad %6 %137 + %139 = OpConvertSToF %21 %138 + %140 = OpAccessChain %57 %56 %26 %18 + %141 = OpLoad %6 %140 + %142 = OpConvertSToF %21 %141 + %143 = OpAccessChain %57 %56 %26 %26 + %144 = OpLoad %6 %143 + %145 = OpConvertSToF %21 %144 + %146 = OpCompositeConstruct %39 %136 %139 %142 %145 + OpStore %133 %146 + %148 = OpAccessChain %57 %56 %26 %18 + %149 = OpLoad %6 %148 + OpStore %147 %149 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %152 %153 None + OpBranch %154 + %154 = OpLabel + %155 = OpLoad %6 %147 + %157 = OpAccessChain %57 %56 %26 %156 + %158 = OpLoad %6 %157 + %159 = OpSLessThan %34 %155 %158 + OpBranchConditional %159 %151 %152 + %151 = OpLabel + %160 = OpLoad %6 %147 + %161 = OpAccessChain %97 %17 %160 %26 + %162 = OpLoad %6 %161 + %163 = OpLoad %6 %147 + %164 = OpAccessChain %50 %110 %163 + %165 = OpLoad %6 %164 + %166 = OpINotEqual %34 %162 %165 + OpSelectionMerge %168 None + OpBranchConditional %166 %167 %168 + %167 = OpLabel + %169 = OpAccessChain %57 %56 %26 %18 + %170 = OpLoad %6 %169 + %171 = OpConvertSToF %21 %170 + %172 = OpCompositeConstruct %39 %171 %171 %171 %171 + OpStore %133 %172 + OpBranch %168 + %168 = OpLabel + OpBranch %153 + %153 = OpLabel + %173 = OpLoad %6 %147 + %174 = OpIAdd %6 %173 %18 + OpStore %147 %174 + OpBranch %150 + %152 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %9 + %10 = OpFunctionParameter %8 + %12 = OpLabel + %29 = OpAccessChain %28 %25 %26 %27 + %30 = OpLoad %21 %29 + %32 = OpAccessChain %28 %25 %26 %31 + %33 = OpLoad %21 %32 + %35 = OpFOrdGreaterThan %34 %30 %33 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %37 + %36 = OpLabel + OpReturn + %37 = OpLabel + %43 = OpAccessChain %42 %41 %31 + %44 = OpLoad %21 %43 + %46 = OpFOrdLessThan %34 %44 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + OpReturn + %48 = OpLabel + %51 = OpAccessChain %50 %10 %26 + OpStore %51 %26 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 10 5 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-struct-int-array-loop-check-element.amber b/vulkan/amber/graphicsfuzz/cov-function-struct-int-array-loop-check-element.amber new file mode 100644 index 0000000..3f8e2ca --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-struct-int-array-loop-check-element.amber @@ -0,0 +1,292 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--ccp' +# '--eliminate-local-single-store' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-code-aggressive' +# '--private-to-local' +# '--private-to-local' +# '--eliminate-dead-inserts' +# '--copy-propagate-arrays' +# '--eliminate-local-multi-store' +# '--eliminate-dead-inserts' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_9 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2, 9] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S +# { +# int arr[10]; +# }; +# +# int func(S s) +# { +# int a = _int_0; +# +# // Iterates twice. +# for(int i = _int_0; i < _int_2; i++) +# { +# // True during the second iteration when a = 1. +# if(s.arr[(a + _int_9) / _int_2] == 1) +# { +# return i; +# } +# +# a = _int_1; +# } +# +# // Never executed. +# return _int_0; +# } +# +# void main() +# { +# S s = S(int[10](1, 1, 1, 1, -1, 1, 1, 1, 1, 1)); +# +# // Always true. +# if(func(s) == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 118 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %80 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "S" + OpMemberName %10 0 "arr" + OpName %14 "func(struct-S-i1[10]1;" + OpName %13 "s" + OpName %17 "a" + OpName %20 "buf0" + OpMemberName %20 0 "_GLF_uniform_int_values" + OpName %22 "" + OpName %28 "i" + OpName %69 "param" + OpName %80 "_GLF_color" + OpDecorate %19 ArrayStride 16 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpDecorate %80 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypeStruct %9 + %11 = OpTypePointer Function %10 + %12 = OpTypeFunction %6 %11 + %16 = OpTypePointer Function %6 + %18 = OpConstant %7 4 + %19 = OpTypeArray %6 %18 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpConstant %6 0 + %24 = OpConstant %6 1 + %25 = OpTypePointer Uniform %6 + %37 = OpConstant %6 2 + %40 = OpTypeBool + %43 = OpConstant %6 3 + %66 = OpConstant %6 -1 + %67 = OpConstantComposite %9 %24 %24 %24 %24 %66 %24 %24 %24 %24 %24 + %68 = OpConstantComposite %10 %67 + %77 = OpTypeFloat 32 + %78 = OpTypeVector %77 4 + %79 = OpTypePointer Output %78 + %80 = OpVariable %79 Output + %103 = OpConstant %7 0 + %104 = OpConstantFalse %40 + %105 = OpTypePointer Function %40 + %107 = OpConstantTrue %40 + %117 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %69 = OpVariable %11 Function + OpStore %69 %68 + %71 = OpFunctionCall %6 %14 %69 + %72 = OpAccessChain %25 %22 %23 %23 + %73 = OpLoad %6 %72 + %74 = OpIEqual %40 %71 %73 + OpSelectionMerge %76 None + OpBranchConditional %74 %75 %94 + %75 = OpLabel + %81 = OpAccessChain %25 %22 %23 %23 + %82 = OpLoad %6 %81 + %83 = OpConvertSToF %77 %82 + %84 = OpAccessChain %25 %22 %23 %24 + %85 = OpLoad %6 %84 + %86 = OpConvertSToF %77 %85 + %87 = OpAccessChain %25 %22 %23 %24 + %88 = OpLoad %6 %87 + %89 = OpConvertSToF %77 %88 + %90 = OpAccessChain %25 %22 %23 %23 + %91 = OpLoad %6 %90 + %92 = OpConvertSToF %77 %91 + %93 = OpCompositeConstruct %78 %83 %86 %89 %92 + OpStore %80 %93 + OpBranch %76 + %94 = OpLabel + %95 = OpAccessChain %25 %22 %23 %24 + %96 = OpLoad %6 %95 + %97 = OpConvertSToF %77 %96 + %98 = OpCompositeConstruct %78 %97 %97 %97 %97 + OpStore %80 %98 + OpBranch %76 + %76 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %6 None %12 + %13 = OpFunctionParameter %11 + %15 = OpLabel + %106 = OpVariable %105 Function %104 + %100 = OpVariable %16 Function + %17 = OpVariable %16 Function + %28 = OpVariable %16 Function + OpSelectionMerge %99 None + OpSwitch %103 %102 + %102 = OpLabel + %26 = OpAccessChain %25 %22 %23 %24 + %27 = OpLoad %6 %26 + OpStore %17 %27 + %29 = OpAccessChain %25 %22 %23 %24 + %30 = OpLoad %6 %29 + OpStore %28 %30 + OpBranch %31 + %31 = OpLabel + %111 = OpPhi %6 %27 %102 %58 %34 + %110 = OpPhi %6 %30 %102 %60 %34 + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %38 = OpAccessChain %25 %22 %23 %37 + %39 = OpLoad %6 %38 + %41 = OpSLessThan %40 %110 %39 + OpBranchConditional %41 %32 %33 + %32 = OpLabel + %44 = OpAccessChain %25 %22 %23 %43 + %45 = OpLoad %6 %44 + %46 = OpIAdd %6 %111 %45 + %47 = OpAccessChain %25 %22 %23 %37 + %48 = OpLoad %6 %47 + %49 = OpSDiv %6 %46 %48 + %50 = OpAccessChain %16 %13 %23 %49 + %51 = OpLoad %6 %50 + %52 = OpIEqual %40 %51 %24 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + OpStore %106 %107 + OpStore %100 %110 + OpBranch %33 + %54 = OpLabel + %57 = OpAccessChain %25 %22 %23 %23 + %58 = OpLoad %6 %57 + OpStore %17 %58 + OpBranch %34 + %34 = OpLabel + %60 = OpIAdd %6 %110 %24 + OpStore %28 %60 + OpBranch %31 + %33 = OpLabel + %115 = OpPhi %6 %117 %35 %110 %53 + %112 = OpPhi %40 %104 %35 %107 %53 + OpSelectionMerge %108 None + OpBranchConditional %112 %99 %108 + %108 = OpLabel + %61 = OpAccessChain %25 %22 %23 %24 + %62 = OpLoad %6 %61 + OpStore %106 %107 + OpStore %100 %62 + OpBranch %99 + %99 = OpLabel + %114 = OpPhi %6 %115 %33 %62 %108 + OpReturnValue %114 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 9 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-switch-case-constant-clamp-transpose-identity-matrices.amber b/vulkan/amber/graphicsfuzz/cov-function-switch-case-constant-clamp-transpose-identity-matrices.amber new file mode 100644 index 0000000..41cc874 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-switch-case-constant-clamp-transpose-identity-matrices.amber @@ -0,0 +1,223 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-Os' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_25 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.25, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float func(vec2 v) +# { +# switch(1) +# { +# case 0: +# return 1.0; +# case 1: +# // Trasposing an identity matrix has no effect. The line below simplifies to +# // clamp(vec2(0.25, 0.25, vec2(0.5, 0.5), vec2(1.0, 1.0))).x = vec2(0.5, 0.5).x = 0.5 +# return clamp(vec2(transpose(mat4(_float_0_25))), v, vec2(transpose(mat4(_float_1_0)))).x; +# } +# } +# +# void main() +# { +# // The fraction parts of gl_FragCoord components are always 0.5 (the center of the pixel). +# // The function returns 0.5. +# if(func(fract(gl_FragCoord.xy)) == 0.5) +# { +# _GLF_color = vec4(1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 124 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %61 %73 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %23 "buf0" + OpMemberName %23 0 "_GLF_uniform_float_values" + OpName %25 "" + OpName %61 "gl_FragCoord" + OpName %73 "_GLF_color" + OpName %75 "buf1" + OpMemberName %75 0 "_GLF_uniform_int_values" + OpName %77 "" + OpDecorate %22 ArrayStride 16 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %61 BuiltIn FragCoord + OpDecorate %73 Location 0 + OpDecorate %74 ArrayStride 16 + OpMemberDecorate %75 0 Offset 0 + OpDecorate %75 Block + OpDecorate %77 DescriptorSet 0 + OpDecorate %77 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 1 + %18 = OpConstant %6 1 + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 2 + %22 = OpTypeArray %6 %21 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpConstant %13 0 + %27 = OpTypePointer Uniform %6 + %30 = OpTypeVector %6 4 + %31 = OpTypeMatrix %30 4 + %32 = OpConstant %6 0 + %60 = OpTypePointer Input %30 + %61 = OpVariable %60 Input + %67 = OpConstant %6 0.5 + %68 = OpTypeBool + %72 = OpTypePointer Output %30 + %73 = OpVariable %72 Output + %74 = OpTypeArray %13 %21 + %75 = OpTypeStruct %74 + %76 = OpTypePointer Uniform %75 + %77 = OpVariable %76 Uniform + %78 = OpTypePointer Uniform %13 + %123 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %62 = OpLoad %30 %61 + %63 = OpVectorShuffle %7 %62 %62 0 1 + %64 = OpExtInst %7 %1 Fract %63 + %98 = OpAccessChain %27 %25 %26 %26 + %99 = OpLoad %6 %98 + %100 = OpCompositeConstruct %30 %99 %32 %32 %32 + %101 = OpCompositeConstruct %30 %32 %99 %32 %32 + %102 = OpCompositeConstruct %30 %32 %32 %99 %32 + %103 = OpCompositeConstruct %30 %32 %32 %32 %99 + %104 = OpCompositeConstruct %31 %100 %101 %102 %103 + %105 = OpTranspose %31 %104 + %106 = OpCompositeExtract %6 %105 0 0 + %108 = OpCompositeConstruct %7 %106 %123 + %110 = OpAccessChain %27 %25 %26 %14 + %111 = OpLoad %6 %110 + %112 = OpCompositeConstruct %30 %111 %32 %32 %32 + %113 = OpCompositeConstruct %30 %32 %111 %32 %32 + %114 = OpCompositeConstruct %30 %32 %32 %111 %32 + %115 = OpCompositeConstruct %30 %32 %32 %32 %111 + %116 = OpCompositeConstruct %31 %112 %113 %114 %115 + %117 = OpTranspose %31 %116 + %118 = OpCompositeExtract %6 %117 0 0 + %120 = OpCompositeConstruct %7 %118 %123 + %121 = OpExtInst %7 %1 FClamp %108 %64 %120 + %122 = OpCompositeExtract %6 %121 0 + %69 = OpFOrdEqual %68 %122 %67 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %89 + %89 = OpLabel + %90 = OpAccessChain %78 %77 %26 %26 + %91 = OpLoad %13 %90 + %92 = OpConvertSToF %6 %91 + %93 = OpCompositeConstruct %30 %92 %92 %92 %92 + OpStore %73 %93 + OpBranch %71 + %70 = OpLabel + %79 = OpAccessChain %78 %77 %26 %26 + %80 = OpLoad %13 %79 + %81 = OpConvertSToF %6 %80 + %85 = OpAccessChain %78 %77 %26 %14 + %86 = OpLoad %13 %85 + %87 = OpConvertSToF %6 %86 + %88 = OpCompositeConstruct %30 %18 %81 %81 %87 + OpStore %73 %88 + OpBranch %71 + %71 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.25 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-trivial-switch-case.amber b/vulkan/amber/graphicsfuzz/cov-function-trivial-switch-case.amber new file mode 100644 index 0000000..9f8456c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-trivial-switch-case.amber @@ -0,0 +1,112 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp int; +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Always returns (1, 0, 0, 1) +# vec4 func() +# { +# switch(0) +# { +# case 0: +# return vec4(1, 0, 0, 1); +# default: +# return vec4(0); +# } +# } +# +# void main() +# { +# _GLF_color = func(); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 27 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %25 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "func(" + OpName %25 "_GLF_color" + OpDecorate %25 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeFunction %7 + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %16 = OpConstant %6 1 + %17 = OpConstant %6 0 + %18 = OpConstantComposite %7 %16 %17 %17 %16 + %20 = OpConstantComposite %7 %17 %17 %17 %17 + %24 = OpTypePointer Output %7 + %25 = OpVariable %24 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %26 = OpFunctionCall %7 %9 + OpStore %25 %26 + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + OpSelectionMerge %15 None + OpSwitch %12 %14 0 %13 + %14 = OpLabel + OpReturnValue %20 + %13 = OpLabel + OpReturnValue %18 + %15 = OpLabel + OpUnreachable + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-two-loops-limit-using-arguments-array-element-copies.amber b/vulkan/amber/graphicsfuzz/cov-function-two-loops-limit-using-arguments-array-element-copies.amber new file mode 100644 index 0000000..be4f68b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-two-loops-limit-using-arguments-array-element-copies.amber @@ -0,0 +1,335 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# int arr0[10] = int[10](1, 1, 1, 1, 1, 1, 1, 1, 1, 1), arr1[10] = int[10](2, 2, 2, 2, 2, 2, 2, 2, 2, 2); +# +# void func(int a, int b, int c) +# { +# for(int i = a; i <= b; i++) +# { +# arr1[_GLF_MAKE_IN_BOUNDS_INT(i, 10)] = arr0[_GLF_MAKE_IN_BOUNDS_INT(i, 10)]; +# } +# +# for(int i = a; i <= c; i++) +# { +# arr0[_GLF_MAKE_IN_BOUNDS_INT(i, 10)] = arr1[_GLF_MAKE_IN_BOUNDS_INT(_int_1, 10)]; +# } +# } +# +# void main() +# { +# // Sets arr1 elements 1..9 to one. +# for(int i = 1; i < 50; i ++) +# { +# func(i, 2 * i - 1, 3 * i - 1); +# } +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Check for errors. +# for(int i = _int_1; i < _int_10; i ++) +# { +# if(arr0[i] != _int_1 || arr1[i] != _int_1) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 149 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %99 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "func(i1;i1;i1;" + OpName %9 "a" + OpName %10 "b" + OpName %11 "c" + OpName %18 "arr0" + OpName %21 "arr1" + OpName %24 "i" + OpName %47 "i" + OpName %61 "buf0" + OpMemberName %61 0 "_GLF_uniform_int_values" + OpName %63 "" + OpName %73 "i" + OpName %89 "param" + OpName %91 "param" + OpName %92 "param" + OpName %99 "_GLF_color" + OpName %113 "i" + OpDecorate %60 ArrayStride 16 + OpMemberDecorate %61 0 Offset 0 + OpDecorate %61 Block + OpDecorate %63 DescriptorSet 0 + OpDecorate %63 Binding 0 + OpDecorate %99 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 10 + %16 = OpTypeArray %6 %15 + %17 = OpTypePointer Private %16 + %18 = OpVariable %17 Private + %19 = OpConstant %6 1 + %20 = OpConstantComposite %16 %19 %19 %19 %19 %19 %19 %19 %19 %19 %19 + %21 = OpVariable %17 Private + %22 = OpConstant %6 2 + %23 = OpConstantComposite %16 %22 %22 %22 %22 %22 %22 %22 %22 %22 %22 + %33 = OpTypeBool + %36 = OpConstant %6 0 + %37 = OpConstant %6 9 + %41 = OpTypePointer Private %6 + %59 = OpConstant %14 3 + %60 = OpTypeArray %6 %59 + %61 = OpTypeStruct %60 + %62 = OpTypePointer Uniform %61 + %63 = OpVariable %62 Uniform + %64 = OpTypePointer Uniform %6 + %80 = OpConstant %6 50 + %85 = OpConstant %6 3 + %96 = OpTypeFloat 32 + %97 = OpTypeVector %96 4 + %98 = OpTypePointer Output %97 + %99 = OpVariable %98 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %73 = OpVariable %7 Function + %89 = OpVariable %7 Function + %91 = OpVariable %7 Function + %92 = OpVariable %7 Function + %113 = OpVariable %7 Function + OpStore %18 %20 + OpStore %21 %23 + OpStore %73 %19 + OpBranch %74 + %74 = OpLabel + OpLoopMerge %76 %77 None + OpBranch %78 + %78 = OpLabel + %79 = OpLoad %6 %73 + %81 = OpSLessThan %33 %79 %80 + OpBranchConditional %81 %75 %76 + %75 = OpLabel + %82 = OpLoad %6 %73 + %83 = OpIMul %6 %22 %82 + %84 = OpISub %6 %83 %19 + %86 = OpLoad %6 %73 + %87 = OpIMul %6 %85 %86 + %88 = OpISub %6 %87 %19 + %90 = OpLoad %6 %73 + OpStore %89 %90 + OpStore %91 %84 + OpStore %92 %88 + %93 = OpFunctionCall %2 %12 %89 %91 %92 + OpBranch %77 + %77 = OpLabel + %94 = OpLoad %6 %73 + %95 = OpIAdd %6 %94 %19 + OpStore %73 %95 + OpBranch %74 + %76 = OpLabel + %100 = OpAccessChain %64 %63 %36 %36 + %101 = OpLoad %6 %100 + %102 = OpConvertSToF %96 %101 + %103 = OpAccessChain %64 %63 %36 %19 + %104 = OpLoad %6 %103 + %105 = OpConvertSToF %96 %104 + %106 = OpAccessChain %64 %63 %36 %19 + %107 = OpLoad %6 %106 + %108 = OpConvertSToF %96 %107 + %109 = OpAccessChain %64 %63 %36 %36 + %110 = OpLoad %6 %109 + %111 = OpConvertSToF %96 %110 + %112 = OpCompositeConstruct %97 %102 %105 %108 %111 + OpStore %99 %112 + %114 = OpAccessChain %64 %63 %36 %36 + %115 = OpLoad %6 %114 + OpStore %113 %115 + OpBranch %116 + %116 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %121 = OpLoad %6 %113 + %122 = OpAccessChain %64 %63 %36 %22 + %123 = OpLoad %6 %122 + %124 = OpSLessThan %33 %121 %123 + OpBranchConditional %124 %117 %118 + %117 = OpLabel + %125 = OpLoad %6 %113 + %126 = OpAccessChain %41 %18 %125 + %127 = OpLoad %6 %126 + %128 = OpAccessChain %64 %63 %36 %36 + %129 = OpLoad %6 %128 + %130 = OpINotEqual %33 %127 %129 + %131 = OpLogicalNot %33 %130 + OpSelectionMerge %133 None + OpBranchConditional %131 %132 %133 + %132 = OpLabel + %134 = OpLoad %6 %113 + %135 = OpAccessChain %41 %21 %134 + %136 = OpLoad %6 %135 + %137 = OpAccessChain %64 %63 %36 %36 + %138 = OpLoad %6 %137 + %139 = OpINotEqual %33 %136 %138 + OpBranch %133 + %133 = OpLabel + %140 = OpPhi %33 %130 %117 %139 %132 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %64 %63 %36 %19 + %144 = OpLoad %6 %143 + %145 = OpConvertSToF %96 %144 + %146 = OpCompositeConstruct %97 %145 %145 %145 %145 + OpStore %99 %146 + OpBranch %142 + %142 = OpLabel + OpBranch %119 + %119 = OpLabel + %147 = OpLoad %6 %113 + %148 = OpIAdd %6 %147 %19 + OpStore %113 %148 + OpBranch %116 + %118 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %24 = OpVariable %7 Function + %47 = OpVariable %7 Function + %25 = OpLoad %6 %9 + OpStore %24 %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %6 %24 + %32 = OpLoad %6 %10 + %34 = OpSLessThanEqual %33 %31 %32 + OpBranchConditional %34 %27 %28 + %27 = OpLabel + %35 = OpLoad %6 %24 + %38 = OpExtInst %6 %1 SClamp %35 %36 %37 + %39 = OpLoad %6 %24 + %40 = OpExtInst %6 %1 SClamp %39 %36 %37 + %42 = OpAccessChain %41 %18 %40 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %41 %21 %38 + OpStore %44 %43 + OpBranch %29 + %29 = OpLabel + %45 = OpLoad %6 %24 + %46 = OpIAdd %6 %45 %19 + OpStore %24 %46 + OpBranch %26 + %28 = OpLabel + %48 = OpLoad %6 %9 + OpStore %47 %48 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %6 %47 + %55 = OpLoad %6 %11 + %56 = OpSLessThanEqual %33 %54 %55 + OpBranchConditional %56 %50 %51 + %50 = OpLabel + %57 = OpLoad %6 %47 + %58 = OpExtInst %6 %1 SClamp %57 %36 %37 + %65 = OpAccessChain %64 %63 %36 %36 + %66 = OpLoad %6 %65 + %67 = OpExtInst %6 %1 SClamp %66 %36 %37 + %68 = OpAccessChain %41 %21 %67 + %69 = OpLoad %6 %68 + %70 = OpAccessChain %41 %18 %58 + OpStore %70 %69 + OpBranch %52 + %52 = OpLabel + %71 = OpLoad %6 %47 + %72 = OpIAdd %6 %71 %19 + OpStore %47 %72 + OpBranch %49 + %51 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-undefined-shift-left-index-array-with-return-value.amber b/vulkan/amber/graphicsfuzz/cov-function-undefined-shift-left-index-array-with-return-value.amber new file mode 100644 index 0000000..dfe54a4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-undefined-shift-left-index-array-with-return-value.amber @@ -0,0 +1,179 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // This function always returns one. +# int func() +# { +# int a = _int_1; +# // Result of the shift is undefined, but it's never used. +# a < (10 << 87454); +# +# return _int_1; +# } +# +# void main() +# { +# // Always selects (1, 0, 0, 1). +# _GLF_color = vec4[4](vec4(_int_0), vec4(_int_1, _int_0, _int_0, _int_1), vec4(_int_0), vec4(_int_0))[func()]; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 69 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "a" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %33 "_GLF_color" + OpName %65 "indexable" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 2 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpTypePointer Uniform %6 + %23 = OpConstant %6 -2147483648 + %24 = OpTypeBool + %30 = OpTypeFloat 32 + %31 = OpTypeVector %30 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpConstant %6 1 + %60 = OpConstant %12 4 + %61 = OpTypeArray %31 %60 + %64 = OpTypePointer Function %61 + %66 = OpTypePointer Function %31 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %65 = OpVariable %64 Function + %35 = OpAccessChain %19 %17 %18 %34 + %36 = OpLoad %6 %35 + %37 = OpConvertSToF %30 %36 + %38 = OpCompositeConstruct %31 %37 %37 %37 %37 + %39 = OpAccessChain %19 %17 %18 %18 + %40 = OpLoad %6 %39 + %41 = OpConvertSToF %30 %40 + %42 = OpAccessChain %19 %17 %18 %34 + %43 = OpLoad %6 %42 + %44 = OpConvertSToF %30 %43 + %45 = OpAccessChain %19 %17 %18 %34 + %46 = OpLoad %6 %45 + %47 = OpConvertSToF %30 %46 + %48 = OpAccessChain %19 %17 %18 %18 + %49 = OpLoad %6 %48 + %50 = OpConvertSToF %30 %49 + %51 = OpCompositeConstruct %31 %41 %44 %47 %50 + %52 = OpAccessChain %19 %17 %18 %34 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %30 %53 + %55 = OpCompositeConstruct %31 %54 %54 %54 %54 + %56 = OpAccessChain %19 %17 %18 %34 + %57 = OpLoad %6 %56 + %58 = OpConvertSToF %30 %57 + %59 = OpCompositeConstruct %31 %58 %58 %58 %58 + %62 = OpCompositeConstruct %61 %38 %51 %55 %59 + %63 = OpFunctionCall %6 %8 + OpStore %65 %62 + %67 = OpAccessChain %66 %65 %63 + %68 = OpLoad %31 %67 + OpStore %33 %68 + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %20 = OpAccessChain %19 %17 %18 %18 + %21 = OpLoad %6 %20 + OpStore %11 %21 + %22 = OpLoad %6 %11 + %25 = OpSLessThan %24 %22 %23 + %26 = OpAccessChain %19 %17 %18 %18 + %27 = OpLoad %6 %26 + OpReturnValue %27 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-unpack-unorm-2x16-one.amber b/vulkan/amber/graphicsfuzz/cov-function-unpack-unorm-2x16-one.amber new file mode 100644 index 0000000..877b877 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-unpack-unorm-2x16-one.amber @@ -0,0 +1,230 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--if-conversion' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-block' +# '--simplify-instructions' +# '--simplify-instructions' +# '--combine-access-chains' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--ccp' +# '--eliminate-local-single-block' +# '--combine-access-chains' +# '--private-to-local' +# '--eliminate-dead-inserts' +# '--redundancy-elimination' +# '--scalar-replacement=100' +# '--eliminate-dead-branches' +# '--eliminate-local-multi-store' +# '--if-conversion' +# '--eliminate-dead-branches' +# '--eliminate-local-single-block' +# '--scalar-replacement=100' +# '--private-to-local' +# '--eliminate-dead-branches' +# '--eliminate-local-single-block' +# '--if-conversion' +# '--redundancy-elimination' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // This function always returns one. +# int func() +# { +# // Always true. +# if(unpackUnorm2x16(1u).y == 0.0) +# { +# return _int_1; +# } +# else +# { +# return _int_0; +# } +# } +# +# void main() +# { +# // Always true. +# if(func() == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %45 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %23 "buf0" + OpMemberName %23 0 "_GLF_uniform_int_values" + OpName %25 "" + OpName %45 "_GLF_color" + OpDecorate %22 ArrayStride 16 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %45 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 1 + %12 = OpTypeFloat 32 + %13 = OpTypeVector %12 2 + %16 = OpConstant %12 0 + %17 = OpTypeBool + %21 = OpConstant %10 2 + %22 = OpTypeArray %6 %21 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpConstant %6 0 + %27 = OpTypePointer Uniform %6 + %32 = OpConstant %6 1 + %43 = OpTypeVector %12 4 + %44 = OpTypePointer Output %43 + %45 = OpVariable %44 Output + %65 = OpTypePointer Function %6 + %69 = OpConstant %10 0 + %70 = OpConstantFalse %17 + %71 = OpTypePointer Function %17 + %73 = OpConstantTrue %17 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %37 = OpFunctionCall %6 %8 + %38 = OpAccessChain %27 %25 %26 %26 + %39 = OpLoad %6 %38 + %40 = OpIEqual %17 %37 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %59 + %59 = OpLabel + %60 = OpAccessChain %27 %25 %26 %32 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %12 %61 + %63 = OpCompositeConstruct %43 %62 %62 %62 %62 + OpStore %45 %63 + OpBranch %42 + %41 = OpLabel + %48 = OpConvertSToF %12 %39 + %49 = OpAccessChain %27 %25 %26 %32 + %50 = OpLoad %6 %49 + %51 = OpConvertSToF %12 %50 + %58 = OpCompositeConstruct %43 %48 %51 %51 %48 + OpStore %45 %58 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %72 = OpVariable %71 Function %70 + %66 = OpVariable %65 Function + OpSelectionMerge %64 None + OpSwitch %69 %68 + %68 = OpLabel + %14 = OpExtInst %13 %1 UnpackUnorm2x16 %11 + %15 = OpCompositeExtract %12 %14 1 + %18 = OpFOrdEqual %17 %15 %16 + OpSelectionMerge %20 None + OpBranchConditional %18 %19 %31 + %31 = OpLabel + %33 = OpAccessChain %27 %25 %26 %32 + %34 = OpLoad %6 %33 + OpStore %72 %73 + OpStore %66 %34 + OpBranch %64 + %19 = OpLabel + %28 = OpAccessChain %27 %25 %26 %26 + %29 = OpLoad %6 %28 + OpStore %72 %73 + OpStore %66 %29 + OpBranch %64 + %20 = OpLabel + OpUnreachable + %64 = OpLabel + %74 = OpPhi %6 %34 %31 %29 %19 + OpReturnValue %74 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-unused-argument-single-loop-iteration-icrement-global-counter.amber b/vulkan/amber/graphicsfuzz/cov-function-unused-argument-single-loop-iteration-icrement-global-counter.amber new file mode 100644 index 0000000..edba038 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-unused-argument-single-loop-iteration-icrement-global-counter.amber @@ -0,0 +1,214 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: 1 +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[1]; +# }; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void func(float ref) +# { +# // Iterates once. +# for(int i = 1; i > 0 && _GLF_global_loop_count < _GLF_global_loop_bound; i--) +# { +# _GLF_global_loop_count++; +# } +# } +# void main() +# { +# // The argument is not used by the function. +# func(_float_1_0); +# +# // Always true. +# if(_GLF_global_loop_count == _int_1) +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %59 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func(f1;" + OpName %9 "ref" + OpName %14 "_GLF_global_loop_count" + OpName %17 "i" + OpName %38 "buf1" + OpMemberName %38 0 "_GLF_uniform_float_values" + OpName %40 "" + OpName %41 "param" + OpName %48 "buf0" + OpMemberName %48 0 "_GLF_uniform_int_values" + OpName %50 "" + OpName %59 "_GLF_color" + OpDecorate %37 ArrayStride 16 + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 1 + OpDecorate %47 ArrayStride 16 + OpMemberDecorate %48 0 Offset 0 + OpDecorate %48 Block + OpDecorate %50 DescriptorSet 0 + OpDecorate %50 Binding 0 + OpDecorate %59 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 + %12 = OpTypeInt 32 1 + %13 = OpTypePointer Private %12 + %14 = OpVariable %13 Private + %15 = OpConstant %12 0 + %16 = OpTypePointer Function %12 + %18 = OpConstant %12 1 + %25 = OpTypeBool + %28 = OpConstant %12 10 + %35 = OpTypeInt 32 0 + %36 = OpConstant %35 1 + %37 = OpTypeArray %6 %36 + %38 = OpTypeStruct %37 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %42 = OpTypePointer Uniform %6 + %47 = OpTypeArray %12 %36 + %48 = OpTypeStruct %47 + %49 = OpTypePointer Uniform %48 + %50 = OpVariable %49 Uniform + %51 = OpTypePointer Uniform %12 + %57 = OpTypeVector %6 4 + %58 = OpTypePointer Output %57 + %59 = OpVariable %58 Output + %60 = OpConstant %6 1 + %61 = OpConstant %6 0 + %62 = OpConstantComposite %57 %60 %61 %61 %60 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %41 = OpVariable %7 Function + OpStore %14 %15 + %43 = OpAccessChain %42 %40 %15 %15 + %44 = OpLoad %6 %43 + OpStore %41 %44 + %45 = OpFunctionCall %2 %10 %41 + %46 = OpLoad %12 %14 + %52 = OpAccessChain %51 %50 %15 %15 + %53 = OpLoad %12 %52 + %54 = OpIEqual %25 %46 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + OpStore %59 %62 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %17 = OpVariable %16 Function + OpStore %17 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %12 %17 + %26 = OpSGreaterThan %25 %24 %15 + %27 = OpLoad %12 %14 + %29 = OpSLessThan %25 %27 %28 + %30 = OpLogicalAnd %25 %26 %29 + OpBranchConditional %30 %20 %21 + %20 = OpLabel + %31 = OpLoad %12 %14 + %32 = OpIAdd %12 %31 %18 + OpStore %14 %32 + OpBranch %22 + %22 = OpLabel + %33 = OpLoad %12 %17 + %34 = OpISub %12 %33 %18 + OpStore %17 %34 + OpBranch %19 + %21 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-variable-plus-one-minus-one.amber b/vulkan/amber/graphicsfuzz/cov-function-variable-plus-one-minus-one.amber new file mode 100644 index 0000000..afef6aa --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-variable-plus-one-minus-one.amber @@ -0,0 +1,168 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# int a = 1; +# return (1 + a) - 1; +# } +# +# void main() +# { +# // Always true. +# if(func() == 1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %26 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "a" + OpName %26 "_GLF_color" + OpName %30 "buf0" + OpMemberName %30 0 "_GLF_uniform_int_values" + OpName %32 "" + OpDecorate %26 Location 0 + OpDecorate %29 ArrayStride 16 + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 1 + %19 = OpTypeBool + %23 = OpTypeFloat 32 + %24 = OpTypeVector %23 4 + %25 = OpTypePointer Output %24 + %26 = OpVariable %25 Output + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 2 + %29 = OpTypeArray %6 %28 + %30 = OpTypeStruct %29 + %31 = OpTypePointer Uniform %30 + %32 = OpVariable %31 Uniform + %33 = OpConstant %6 0 + %34 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %18 = OpFunctionCall %6 %8 + %20 = OpIEqual %19 %18 %12 + OpSelectionMerge %22 None + OpBranchConditional %20 %21 %48 + %21 = OpLabel + %35 = OpAccessChain %34 %32 %33 %33 + %36 = OpLoad %6 %35 + %37 = OpConvertSToF %23 %36 + %38 = OpAccessChain %34 %32 %33 %12 + %39 = OpLoad %6 %38 + %40 = OpConvertSToF %23 %39 + %41 = OpAccessChain %34 %32 %33 %12 + %42 = OpLoad %6 %41 + %43 = OpConvertSToF %23 %42 + %44 = OpAccessChain %34 %32 %33 %33 + %45 = OpLoad %6 %44 + %46 = OpConvertSToF %23 %45 + %47 = OpCompositeConstruct %24 %37 %40 %43 %46 + OpStore %26 %47 + OpBranch %22 + %48 = OpLabel + %49 = OpAccessChain %34 %32 %33 %12 + %50 = OpLoad %6 %49 + %51 = OpConvertSToF %23 %50 + %52 = OpCompositeConstruct %24 %51 %51 %51 %51 + OpStore %26 %52 + OpBranch %22 + %22 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + OpStore %11 %12 + %13 = OpLoad %6 %11 + %14 = OpIAdd %6 %12 %13 + %15 = OpISub %6 %14 %12 + OpReturnValue %15 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-vec2-never-discard.amber b/vulkan/amber/graphicsfuzz/cov-function-vec2-never-discard.amber new file mode 100644 index 0000000..c28fee4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-vec2-never-discard.amber @@ -0,0 +1,263 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of zero: 0.0 +# layout(set = 0, binding = 2) uniform buf2 { +# float zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# bool func(vec2 pos) +# { +# // Always false. +# if(pos.x < _float_0_0) +# { +# return true; +# } +# +# // Always true. +# if(pos.y > _float_0_0) +# { +# return false; +# } +# +# if(zero > _float_1_0) +# { +# return true; +# } +# +# return true; +# } +# +# void main() +# { +# // Always false. +# if (func(gl_FragCoord.xy)) +# { +# discard; +# } +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 88 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %60 %69 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "func(vf2;" + OpName %11 "pos" + OpName %21 "buf1" + OpMemberName %21 0 "_GLF_uniform_float_values" + OpName %23 "" + OpName %44 "buf2" + OpMemberName %44 0 "zero" + OpName %46 "" + OpName %60 "gl_FragCoord" + OpName %61 "param" + OpName %69 "_GLF_color" + OpName %71 "buf0" + OpMemberName %71 0 "_GLF_uniform_int_values" + OpName %73 "" + OpDecorate %20 ArrayStride 16 + OpMemberDecorate %21 0 Offset 0 + OpDecorate %21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 1 + OpMemberDecorate %44 0 Offset 0 + OpDecorate %44 Block + OpDecorate %46 DescriptorSet 0 + OpDecorate %46 Binding 2 + OpDecorate %60 BuiltIn FragCoord + OpDecorate %69 Location 0 + OpDecorate %70 ArrayStride 16 + OpMemberDecorate %71 0 Offset 0 + OpDecorate %71 Block + OpDecorate %73 DescriptorSet 0 + OpDecorate %73 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeBool + %10 = OpTypeFunction %9 %8 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 0 + %16 = OpTypePointer Function %6 + %19 = OpConstant %14 2 + %20 = OpTypeArray %6 %19 + %21 = OpTypeStruct %20 + %22 = OpTypePointer Uniform %21 + %23 = OpVariable %22 Uniform + %24 = OpTypeInt 32 1 + %25 = OpConstant %24 0 + %26 = OpTypePointer Uniform %6 + %32 = OpConstantTrue %9 + %34 = OpConstant %14 1 + %42 = OpConstantFalse %9 + %44 = OpTypeStruct %6 + %45 = OpTypePointer Uniform %44 + %46 = OpVariable %45 Uniform + %49 = OpConstant %24 1 + %58 = OpTypeVector %6 4 + %59 = OpTypePointer Input %58 + %60 = OpVariable %59 Input + %68 = OpTypePointer Output %58 + %69 = OpVariable %68 Output + %70 = OpTypeArray %24 %19 + %71 = OpTypeStruct %70 + %72 = OpTypePointer Uniform %71 + %73 = OpVariable %72 Uniform + %74 = OpTypePointer Uniform %24 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %61 = OpVariable %8 Function + %62 = OpLoad %58 %60 + %63 = OpVectorShuffle %7 %62 %62 0 1 + OpStore %61 %63 + %64 = OpFunctionCall %9 %12 %61 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + OpTerminateInvocation + %66 = OpLabel + %75 = OpAccessChain %74 %73 %25 %25 + %76 = OpLoad %24 %75 + %77 = OpConvertSToF %6 %76 + %78 = OpAccessChain %74 %73 %25 %49 + %79 = OpLoad %24 %78 + %80 = OpConvertSToF %6 %79 + %81 = OpAccessChain %74 %73 %25 %49 + %82 = OpLoad %24 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpAccessChain %74 %73 %25 %25 + %85 = OpLoad %24 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpCompositeConstruct %58 %77 %80 %83 %86 + OpStore %69 %87 + OpReturn + OpFunctionEnd + %12 = OpFunction %9 None %10 + %11 = OpFunctionParameter %8 + %13 = OpLabel + %17 = OpAccessChain %16 %11 %15 + %18 = OpLoad %6 %17 + %27 = OpAccessChain %26 %23 %25 %25 + %28 = OpLoad %6 %27 + %29 = OpFOrdLessThan %9 %18 %28 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %31 + %30 = OpLabel + OpReturnValue %32 + %31 = OpLabel + %35 = OpAccessChain %16 %11 %34 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %26 %23 %25 %25 + %38 = OpLoad %6 %37 + %39 = OpFOrdGreaterThan %9 %36 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %41 + %40 = OpLabel + OpReturnValue %42 + %41 = OpLabel + %47 = OpAccessChain %26 %46 %25 + %48 = OpLoad %6 %47 + %50 = OpAccessChain %26 %23 %25 %49 + %51 = OpLoad %6 %50 + %52 = OpFOrdGreaterThan %9 %48 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + OpReturnValue %32 + %54 = OpLabel + OpReturnValue %32 + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float STD140 DATA + 0.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-function-with-nested-loops-called-from-nested-loops.amber b/vulkan/amber/graphicsfuzz/cov-function-with-nested-loops-called-from-nested-loops.amber new file mode 100644 index 0000000..e49e870 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-function-with-nested-loops-called-from-nested-loops.amber @@ -0,0 +1,792 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define LOOP for (int i = 0; i < 1; i++) +# +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(push_constant) uniform buf_push +# { +# float five; +# }; +# +# // Function always returns 1.0. +# float func(float x) +# { +# float a = 1.0; +# +# LOOP +# { +# LOOP +# { +# LOOP +# { +# LOOP +# { +# LOOP +# { +# // Always false. +# if (mod(1.0, x) < 0.0) +# { +# LOOP +# { +# LOOP +# { +# LOOP +# { +# LOOP +# { +# LOOP +# { +# LOOP +# { +# a += 1.0; +# } +# } +# } +# } +# } +# } +# } +# +# // Always true. +# if (x > 1.0) +# { +# return a; +# } +# } +# } +# } +# } +# } +# +# return 2.0; +# } +# +# void main() +# { +# float f = 0.0; +# +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP +# { +# f = func(five); +# } +# } } } } } } } } } } } } } } } } } } } } } } } } } } } +# +# // Always true. +# if (f == 1.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 1659 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %441 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %371 "buf_push" + OpMemberName %371 0 "five" + OpName %373 "" + OpName %441 "_GLF_color" + OpMemberDecorate %371 0 Offset 0 + OpDecorate %371 Block + OpDecorate %441 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %13 = OpConstant %6 1 + %14 = OpTypeInt 32 1 + %17 = OpConstant %14 0 + %24 = OpConstant %14 1 + %25 = OpTypeBool + %61 = OpConstant %6 0 + %143 = OpConstant %6 2 + %371 = OpTypeStruct %6 + %372 = OpTypePointer PushConstant %371 + %373 = OpVariable %372 PushConstant + %375 = OpTypePointer PushConstant %6 + %439 = OpTypeVector %6 4 + %440 = OpTypePointer Output %439 + %441 = OpVariable %440 Output + %442 = OpConstantComposite %439 %13 %61 %61 %13 + %444 = OpConstantComposite %439 %61 %61 %61 %61 + %449 = OpTypeInt 32 0 + %450 = OpConstant %449 0 + %451 = OpConstantFalse %25 + %454 = OpConstantTrue %25 + %747 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %148 + %148 = OpLabel + %606 = OpPhi %6 %61 %5 %786 %151 + %605 = OpPhi %14 %17 %5 %434 %151 + %746 = OpPhi %6 %747 %5 %745 %151 + %154 = OpSLessThan %25 %605 %24 + OpLoopMerge %150 %151 None + OpBranchConditional %154 %149 %150 + %149 = OpLabel + OpBranch %156 + %156 = OpLabel + %607 = OpPhi %14 %17 %149 %432 %159 + %786 = OpPhi %6 %606 %149 %787 %159 + %745 = OpPhi %6 %746 %149 %744 %159 + %162 = OpSLessThan %25 %607 %24 + OpLoopMerge %158 %159 None + OpBranchConditional %162 %157 %158 + %157 = OpLabel + OpBranch %164 + %164 = OpLabel + %609 = OpPhi %14 %17 %157 %430 %167 + %787 = OpPhi %6 %786 %157 %788 %167 + %744 = OpPhi %6 %745 %157 %743 %167 + %170 = OpSLessThan %25 %609 %24 + OpLoopMerge %166 %167 None + OpBranchConditional %170 %165 %166 + %165 = OpLabel + OpBranch %172 + %172 = OpLabel + %611 = OpPhi %14 %17 %165 %428 %175 + %788 = OpPhi %6 %787 %165 %789 %175 + %743 = OpPhi %6 %744 %165 %742 %175 + %178 = OpSLessThan %25 %611 %24 + OpLoopMerge %174 %175 None + OpBranchConditional %178 %173 %174 + %173 = OpLabel + OpBranch %180 + %180 = OpLabel + %613 = OpPhi %14 %17 %173 %426 %183 + %789 = OpPhi %6 %788 %173 %790 %183 + %742 = OpPhi %6 %743 %173 %741 %183 + %186 = OpSLessThan %25 %613 %24 + OpLoopMerge %182 %183 None + OpBranchConditional %186 %181 %182 + %181 = OpLabel + OpBranch %188 + %188 = OpLabel + %615 = OpPhi %14 %17 %181 %424 %191 + %790 = OpPhi %6 %789 %181 %791 %191 + %741 = OpPhi %6 %742 %181 %740 %191 + %194 = OpSLessThan %25 %615 %24 + OpLoopMerge %190 %191 None + OpBranchConditional %194 %189 %190 + %189 = OpLabel + OpBranch %196 + %196 = OpLabel + %617 = OpPhi %14 %17 %189 %422 %199 + %791 = OpPhi %6 %790 %189 %792 %199 + %740 = OpPhi %6 %741 %189 %739 %199 + %202 = OpSLessThan %25 %617 %24 + OpLoopMerge %198 %199 None + OpBranchConditional %202 %197 %198 + %197 = OpLabel + OpBranch %204 + %204 = OpLabel + %619 = OpPhi %14 %17 %197 %420 %207 + %792 = OpPhi %6 %791 %197 %793 %207 + %739 = OpPhi %6 %740 %197 %738 %207 + %210 = OpSLessThan %25 %619 %24 + OpLoopMerge %206 %207 None + OpBranchConditional %210 %205 %206 + %205 = OpLabel + OpBranch %212 + %212 = OpLabel + %621 = OpPhi %14 %17 %205 %418 %215 + %793 = OpPhi %6 %792 %205 %794 %215 + %738 = OpPhi %6 %739 %205 %737 %215 + %218 = OpSLessThan %25 %621 %24 + OpLoopMerge %214 %215 None + OpBranchConditional %218 %213 %214 + %213 = OpLabel + OpBranch %220 + %220 = OpLabel + %623 = OpPhi %14 %17 %213 %416 %223 + %794 = OpPhi %6 %793 %213 %795 %223 + %737 = OpPhi %6 %738 %213 %736 %223 + %226 = OpSLessThan %25 %623 %24 + OpLoopMerge %222 %223 None + OpBranchConditional %226 %221 %222 + %221 = OpLabel + OpBranch %228 + %228 = OpLabel + %625 = OpPhi %14 %17 %221 %414 %231 + %795 = OpPhi %6 %794 %221 %796 %231 + %736 = OpPhi %6 %737 %221 %735 %231 + %234 = OpSLessThan %25 %625 %24 + OpLoopMerge %230 %231 None + OpBranchConditional %234 %229 %230 + %229 = OpLabel + OpBranch %236 + %236 = OpLabel + %627 = OpPhi %14 %17 %229 %412 %239 + %796 = OpPhi %6 %795 %229 %797 %239 + %735 = OpPhi %6 %736 %229 %734 %239 + %242 = OpSLessThan %25 %627 %24 + OpLoopMerge %238 %239 None + OpBranchConditional %242 %237 %238 + %237 = OpLabel + OpBranch %244 + %244 = OpLabel + %629 = OpPhi %14 %17 %237 %410 %247 + %797 = OpPhi %6 %796 %237 %798 %247 + %734 = OpPhi %6 %735 %237 %733 %247 + %250 = OpSLessThan %25 %629 %24 + OpLoopMerge %246 %247 None + OpBranchConditional %250 %245 %246 + %245 = OpLabel + OpBranch %252 + %252 = OpLabel + %631 = OpPhi %14 %17 %245 %408 %255 + %798 = OpPhi %6 %797 %245 %799 %255 + %733 = OpPhi %6 %734 %245 %732 %255 + %258 = OpSLessThan %25 %631 %24 + OpLoopMerge %254 %255 None + OpBranchConditional %258 %253 %254 + %253 = OpLabel + OpBranch %260 + %260 = OpLabel + %633 = OpPhi %14 %17 %253 %406 %263 + %799 = OpPhi %6 %798 %253 %800 %263 + %732 = OpPhi %6 %733 %253 %731 %263 + %266 = OpSLessThan %25 %633 %24 + OpLoopMerge %262 %263 None + OpBranchConditional %266 %261 %262 + %261 = OpLabel + OpBranch %268 + %268 = OpLabel + %635 = OpPhi %14 %17 %261 %404 %271 + %800 = OpPhi %6 %799 %261 %801 %271 + %731 = OpPhi %6 %732 %261 %730 %271 + %274 = OpSLessThan %25 %635 %24 + OpLoopMerge %270 %271 None + OpBranchConditional %274 %269 %270 + %269 = OpLabel + OpBranch %276 + %276 = OpLabel + %637 = OpPhi %14 %17 %269 %402 %279 + %801 = OpPhi %6 %800 %269 %802 %279 + %730 = OpPhi %6 %731 %269 %729 %279 + %282 = OpSLessThan %25 %637 %24 + OpLoopMerge %278 %279 None + OpBranchConditional %282 %277 %278 + %277 = OpLabel + OpBranch %284 + %284 = OpLabel + %639 = OpPhi %14 %17 %277 %400 %287 + %802 = OpPhi %6 %801 %277 %803 %287 + %729 = OpPhi %6 %730 %277 %728 %287 + %290 = OpSLessThan %25 %639 %24 + OpLoopMerge %286 %287 None + OpBranchConditional %290 %285 %286 + %285 = OpLabel + OpBranch %292 + %292 = OpLabel + %641 = OpPhi %14 %17 %285 %398 %295 + %803 = OpPhi %6 %802 %285 %804 %295 + %728 = OpPhi %6 %729 %285 %727 %295 + %298 = OpSLessThan %25 %641 %24 + OpLoopMerge %294 %295 None + OpBranchConditional %298 %293 %294 + %293 = OpLabel + OpBranch %300 + %300 = OpLabel + %643 = OpPhi %14 %17 %293 %396 %303 + %804 = OpPhi %6 %803 %293 %805 %303 + %727 = OpPhi %6 %728 %293 %726 %303 + %306 = OpSLessThan %25 %643 %24 + OpLoopMerge %302 %303 None + OpBranchConditional %306 %301 %302 + %301 = OpLabel + OpBranch %308 + %308 = OpLabel + %645 = OpPhi %14 %17 %301 %394 %311 + %805 = OpPhi %6 %804 %301 %806 %311 + %726 = OpPhi %6 %727 %301 %725 %311 + %314 = OpSLessThan %25 %645 %24 + OpLoopMerge %310 %311 None + OpBranchConditional %314 %309 %310 + %309 = OpLabel + OpBranch %316 + %316 = OpLabel + %647 = OpPhi %14 %17 %309 %392 %319 + %806 = OpPhi %6 %805 %309 %807 %319 + %725 = OpPhi %6 %726 %309 %724 %319 + %322 = OpSLessThan %25 %647 %24 + OpLoopMerge %318 %319 None + OpBranchConditional %322 %317 %318 + %317 = OpLabel + OpBranch %324 + %324 = OpLabel + %649 = OpPhi %14 %17 %317 %390 %327 + %807 = OpPhi %6 %806 %317 %808 %327 + %724 = OpPhi %6 %725 %317 %723 %327 + %330 = OpSLessThan %25 %649 %24 + OpLoopMerge %326 %327 None + OpBranchConditional %330 %325 %326 + %325 = OpLabel + OpBranch %332 + %332 = OpLabel + %651 = OpPhi %14 %17 %325 %388 %335 + %808 = OpPhi %6 %807 %325 %809 %335 + %723 = OpPhi %6 %724 %325 %722 %335 + %338 = OpSLessThan %25 %651 %24 + OpLoopMerge %334 %335 None + OpBranchConditional %338 %333 %334 + %333 = OpLabel + OpBranch %340 + %340 = OpLabel + %653 = OpPhi %14 %17 %333 %386 %343 + %809 = OpPhi %6 %808 %333 %810 %343 + %722 = OpPhi %6 %723 %333 %721 %343 + %346 = OpSLessThan %25 %653 %24 + OpLoopMerge %342 %343 None + OpBranchConditional %346 %341 %342 + %341 = OpLabel + OpBranch %348 + %348 = OpLabel + %655 = OpPhi %14 %17 %341 %384 %351 + %810 = OpPhi %6 %809 %341 %811 %351 + %721 = OpPhi %6 %722 %341 %720 %351 + %354 = OpSLessThan %25 %655 %24 + OpLoopMerge %350 %351 None + OpBranchConditional %354 %349 %350 + %349 = OpLabel + OpBranch %356 + %356 = OpLabel + %657 = OpPhi %14 %17 %349 %382 %359 + %811 = OpPhi %6 %810 %349 %812 %359 + %720 = OpPhi %6 %721 %349 %719 %359 + %362 = OpSLessThan %25 %657 %24 + OpLoopMerge %358 %359 None + OpBranchConditional %362 %357 %358 + %357 = OpLabel + OpBranch %364 + %364 = OpLabel + %719 = OpPhi %6 %720 %357 %716 %367 + %659 = OpPhi %14 %17 %357 %380 %367 + %812 = OpPhi %6 %811 %357 %716 %367 + %370 = OpSLessThan %25 %659 %24 + OpLoopMerge %366 %367 None + OpBranchConditional %370 %365 %366 + %365 = OpLabel + %376 = OpAccessChain %375 %373 %17 + %377 = OpLoad %6 %376 + OpSelectionMerge %603 None + OpSwitch %450 %481 + %481 = OpLabel + OpBranch %482 + %482 = OpLabel + %681 = OpPhi %25 %451 %481 %704 %597 + %674 = OpPhi %6 %13 %481 %1655 %597 + %661 = OpPhi %14 %17 %481 %599 %597 + %718 = OpPhi %6 %719 %481 %748 %597 + %485 = OpSLessThan %25 %661 %24 + OpLoopMerge %600 %597 None + OpBranchConditional %485 %486 %600 + %486 = OpLabel + OpBranch %487 + %487 = OpLabel + %680 = OpPhi %25 %681 %486 %695 %591 + %673 = OpPhi %6 %674 %486 %1656 %591 + %662 = OpPhi %14 %17 %486 %593 %591 + %749 = OpPhi %6 %718 %486 %750 %591 + %490 = OpSLessThan %25 %662 %24 + OpLoopMerge %594 %591 None + OpBranchConditional %490 %491 %594 + %491 = OpLabel + OpBranch %492 + %492 = OpLabel + %679 = OpPhi %25 %680 %491 %688 %585 + %672 = OpPhi %6 %673 %491 %1657 %585 + %663 = OpPhi %14 %17 %491 %587 %585 + %751 = OpPhi %6 %749 %491 %752 %585 + %495 = OpSLessThan %25 %663 %24 + OpLoopMerge %588 %585 None + OpBranchConditional %495 %496 %588 + %496 = OpLabel + OpBranch %497 + %497 = OpLabel + %678 = OpPhi %25 %679 %496 %676 %579 + %671 = OpPhi %6 %672 %496 %1658 %579 + %664 = OpPhi %14 %17 %496 %581 %579 + %753 = OpPhi %6 %751 %496 %754 %579 + %500 = OpSLessThan %25 %664 %24 + OpLoopMerge %582 %579 None + OpBranchConditional %500 %501 %582 + %501 = OpLabel + OpBranch %502 + %502 = OpLabel + %665 = OpPhi %14 %17 %501 %575 %573 + %670 = OpPhi %6 %671 %501 %669 %573 + %505 = OpSLessThan %25 %665 %24 + OpLoopMerge %576 %573 None + OpBranchConditional %505 %506 %576 + %506 = OpLabel + %508 = OpFMod %6 %13 %377 + %509 = OpFOrdLessThan %25 %508 %61 + OpSelectionMerge %567 None + OpBranchConditional %509 %510 %567 + %510 = OpLabel + OpBranch %511 + %511 = OpLabel + %675 = OpPhi %6 %670 %510 %785 %563 + %666 = OpPhi %14 %17 %510 %565 %563 + %514 = OpSLessThan %25 %666 %24 + OpLoopMerge %566 %563 None + OpBranchConditional %514 %515 %566 + %515 = OpLabel + OpBranch %516 + %516 = OpLabel + %771 = OpPhi %14 %17 %515 %561 %559 + %785 = OpPhi %6 %675 %515 %784 %559 + %519 = OpSLessThan %25 %771 %24 + OpLoopMerge %562 %559 None + OpBranchConditional %519 %520 %562 + %520 = OpLabel + OpBranch %521 + %521 = OpLabel + %773 = OpPhi %14 %17 %520 %557 %555 + %784 = OpPhi %6 %785 %520 %783 %555 + %524 = OpSLessThan %25 %773 %24 + OpLoopMerge %558 %555 None + OpBranchConditional %524 %525 %558 + %525 = OpLabel + OpBranch %526 + %526 = OpLabel + %775 = OpPhi %14 %17 %525 %553 %551 + %783 = OpPhi %6 %784 %525 %782 %551 + %529 = OpSLessThan %25 %775 %24 + OpLoopMerge %554 %551 None + OpBranchConditional %529 %530 %554 + %530 = OpLabel + OpBranch %531 + %531 = OpLabel + %777 = OpPhi %14 %17 %530 %549 %547 + %782 = OpPhi %6 %783 %530 %781 %547 + %534 = OpSLessThan %25 %777 %24 + OpLoopMerge %550 %547 None + OpBranchConditional %534 %535 %550 + %535 = OpLabel + OpBranch %536 + %536 = OpLabel + %781 = OpPhi %6 %782 %535 %542 %540 + %779 = OpPhi %14 %17 %535 %545 %540 + %539 = OpSLessThan %25 %779 %24 + OpLoopMerge %546 %540 None + OpBranchConditional %539 %540 %546 + %540 = OpLabel + %542 = OpFAdd %6 %781 %13 + %545 = OpIAdd %14 %779 %24 + OpBranch %536 + %546 = OpLabel + OpBranch %547 + %547 = OpLabel + %549 = OpIAdd %14 %777 %24 + OpBranch %531 + %550 = OpLabel + OpBranch %551 + %551 = OpLabel + %553 = OpIAdd %14 %775 %24 + OpBranch %526 + %554 = OpLabel + OpBranch %555 + %555 = OpLabel + %557 = OpIAdd %14 %773 %24 + OpBranch %521 + %558 = OpLabel + OpBranch %559 + %559 = OpLabel + %561 = OpIAdd %14 %771 %24 + OpBranch %516 + %562 = OpLabel + OpBranch %563 + %563 = OpLabel + %565 = OpIAdd %14 %666 %24 + OpBranch %511 + %566 = OpLabel + OpBranch %567 + %567 = OpLabel + %669 = OpPhi %6 %670 %506 %675 %566 + %569 = OpFOrdGreaterThan %25 %377 %13 + OpSelectionMerge %572 None + OpBranchConditional %569 %570 %572 + %570 = OpLabel + OpBranch %576 + %572 = OpLabel + OpBranch %573 + %573 = OpLabel + %575 = OpIAdd %14 %665 %24 + OpBranch %502 + %576 = OpLabel + %1658 = OpPhi %6 %670 %502 %669 %570 + %754 = OpPhi %6 %753 %502 %669 %570 + %676 = OpPhi %25 %678 %502 %454 %570 + OpSelectionMerge %578 None + OpBranchConditional %676 %582 %578 + %578 = OpLabel + OpBranch %579 + %579 = OpLabel + %581 = OpIAdd %14 %664 %24 + OpBranch %497 + %582 = OpLabel + %1657 = OpPhi %6 %671 %497 %1658 %576 + %752 = OpPhi %6 %753 %497 %754 %576 + %688 = OpPhi %25 %678 %497 %676 %576 + OpSelectionMerge %584 None + OpBranchConditional %688 %588 %584 + %584 = OpLabel + OpBranch %585 + %585 = OpLabel + %587 = OpIAdd %14 %663 %24 + OpBranch %492 + %588 = OpLabel + %1656 = OpPhi %6 %672 %492 %1657 %582 + %750 = OpPhi %6 %751 %492 %752 %582 + %695 = OpPhi %25 %679 %492 %688 %582 + OpSelectionMerge %590 None + OpBranchConditional %695 %594 %590 + %590 = OpLabel + OpBranch %591 + %591 = OpLabel + %593 = OpIAdd %14 %662 %24 + OpBranch %487 + %594 = OpLabel + %1655 = OpPhi %6 %673 %487 %1656 %588 + %748 = OpPhi %6 %749 %487 %750 %588 + %704 = OpPhi %25 %680 %487 %695 %588 + OpSelectionMerge %596 None + OpBranchConditional %704 %600 %596 + %596 = OpLabel + OpBranch %597 + %597 = OpLabel + %599 = OpIAdd %14 %661 %24 + OpBranch %482 + %600 = OpLabel + %717 = OpPhi %6 %718 %482 %748 %594 + %715 = OpPhi %25 %681 %482 %704 %594 + OpSelectionMerge %602 None + OpBranchConditional %715 %603 %602 + %602 = OpLabel + OpBranch %603 + %603 = OpLabel + %716 = OpPhi %6 %717 %600 %143 %602 + OpBranch %367 + %367 = OpLabel + %380 = OpIAdd %14 %659 %24 + OpBranch %364 + %366 = OpLabel + OpBranch %359 + %359 = OpLabel + %382 = OpIAdd %14 %657 %24 + OpBranch %356 + %358 = OpLabel + OpBranch %351 + %351 = OpLabel + %384 = OpIAdd %14 %655 %24 + OpBranch %348 + %350 = OpLabel + OpBranch %343 + %343 = OpLabel + %386 = OpIAdd %14 %653 %24 + OpBranch %340 + %342 = OpLabel + OpBranch %335 + %335 = OpLabel + %388 = OpIAdd %14 %651 %24 + OpBranch %332 + %334 = OpLabel + OpBranch %327 + %327 = OpLabel + %390 = OpIAdd %14 %649 %24 + OpBranch %324 + %326 = OpLabel + OpBranch %319 + %319 = OpLabel + %392 = OpIAdd %14 %647 %24 + OpBranch %316 + %318 = OpLabel + OpBranch %311 + %311 = OpLabel + %394 = OpIAdd %14 %645 %24 + OpBranch %308 + %310 = OpLabel + OpBranch %303 + %303 = OpLabel + %396 = OpIAdd %14 %643 %24 + OpBranch %300 + %302 = OpLabel + OpBranch %295 + %295 = OpLabel + %398 = OpIAdd %14 %641 %24 + OpBranch %292 + %294 = OpLabel + OpBranch %287 + %287 = OpLabel + %400 = OpIAdd %14 %639 %24 + OpBranch %284 + %286 = OpLabel + OpBranch %279 + %279 = OpLabel + %402 = OpIAdd %14 %637 %24 + OpBranch %276 + %278 = OpLabel + OpBranch %271 + %271 = OpLabel + %404 = OpIAdd %14 %635 %24 + OpBranch %268 + %270 = OpLabel + OpBranch %263 + %263 = OpLabel + %406 = OpIAdd %14 %633 %24 + OpBranch %260 + %262 = OpLabel + OpBranch %255 + %255 = OpLabel + %408 = OpIAdd %14 %631 %24 + OpBranch %252 + %254 = OpLabel + OpBranch %247 + %247 = OpLabel + %410 = OpIAdd %14 %629 %24 + OpBranch %244 + %246 = OpLabel + OpBranch %239 + %239 = OpLabel + %412 = OpIAdd %14 %627 %24 + OpBranch %236 + %238 = OpLabel + OpBranch %231 + %231 = OpLabel + %414 = OpIAdd %14 %625 %24 + OpBranch %228 + %230 = OpLabel + OpBranch %223 + %223 = OpLabel + %416 = OpIAdd %14 %623 %24 + OpBranch %220 + %222 = OpLabel + OpBranch %215 + %215 = OpLabel + %418 = OpIAdd %14 %621 %24 + OpBranch %212 + %214 = OpLabel + OpBranch %207 + %207 = OpLabel + %420 = OpIAdd %14 %619 %24 + OpBranch %204 + %206 = OpLabel + OpBranch %199 + %199 = OpLabel + %422 = OpIAdd %14 %617 %24 + OpBranch %196 + %198 = OpLabel + OpBranch %191 + %191 = OpLabel + %424 = OpIAdd %14 %615 %24 + OpBranch %188 + %190 = OpLabel + OpBranch %183 + %183 = OpLabel + %426 = OpIAdd %14 %613 %24 + OpBranch %180 + %182 = OpLabel + OpBranch %175 + %175 = OpLabel + %428 = OpIAdd %14 %611 %24 + OpBranch %172 + %174 = OpLabel + OpBranch %167 + %167 = OpLabel + %430 = OpIAdd %14 %609 %24 + OpBranch %164 + %166 = OpLabel + OpBranch %159 + %159 = OpLabel + %432 = OpIAdd %14 %607 %24 + OpBranch %156 + %158 = OpLabel + OpBranch %151 + %151 = OpLabel + %434 = OpIAdd %14 %605 %24 + OpBranch %148 + %150 = OpLabel + %436 = OpFOrdEqual %25 %606 %13 + OpSelectionMerge %438 None + OpBranchConditional %436 %437 %443 + %437 = OpLabel + OpStore %441 %442 + OpBranch %438 + %443 = OpLabel + OpStore %441 %444 + OpBranch %438 + %438 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# five +BUFFER variant_five DATA_TYPE float STD140 DATA + 5.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_five AS push_constant +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-bound-true-logical-or.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-bound-true-logical-or.amber new file mode 100644 index 0000000..9685311 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-bound-true-logical-or.amber @@ -0,0 +1,213 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 100; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# while (_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# // Always false. +# if (!(true || _int_0 == _int_1)) +# { +# break; +# } +# } +# +# // This loop will not be iterated since the loop bound +# // has already been reached with the previous loop. +# while (_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# _GLF_color = vec4(_int_0); +# } +# +# // The output color still remains red beacuse the loop above +# // was not executed. +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %13 "_GLF_color" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpDecorate %13 Location 0 + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Output %11 + %13 = OpVariable %12 Output + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 2 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %6 1 + %21 = OpTypePointer Uniform %6 + %41 = OpConstant %6 100 + %42 = OpTypeBool + %46 = OpConstantTrue %42 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %8 %9 + %22 = OpAccessChain %21 %19 %9 %20 + %23 = OpLoad %6 %22 + %24 = OpConvertSToF %10 %23 + %25 = OpAccessChain %21 %19 %9 %9 + %26 = OpLoad %6 %25 + %27 = OpConvertSToF %10 %26 + %28 = OpAccessChain %21 %19 %9 %9 + %29 = OpLoad %6 %28 + %30 = OpConvertSToF %10 %29 + %31 = OpAccessChain %21 %19 %9 %20 + %32 = OpLoad %6 %31 + %33 = OpConvertSToF %10 %32 + %34 = OpCompositeConstruct %11 %24 %27 %30 %33 + OpStore %13 %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %6 %8 + %43 = OpSLessThan %42 %40 %41 + OpBranchConditional %43 %36 %37 + %36 = OpLabel + %44 = OpLoad %6 %8 + %45 = OpIAdd %6 %44 %20 + OpStore %8 %45 + %47 = OpLogicalNot %42 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %49 + %48 = OpLabel + %50 = OpAccessChain %21 %19 %9 %9 + %51 = OpLoad %6 %50 + %52 = OpAccessChain %21 %19 %9 %20 + %53 = OpLoad %6 %52 + %54 = OpIEqual %42 %51 %53 + OpBranch %49 + %49 = OpLabel + %55 = OpPhi %42 %46 %36 %54 %48 + %56 = OpLogicalNot %42 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + OpBranch %37 + %58 = OpLabel + OpBranch %38 + %38 = OpLabel + OpBranch %35 + %37 = OpLabel + OpBranch %60 + %60 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %6 %8 + %66 = OpSLessThan %42 %65 %41 + OpBranchConditional %66 %61 %62 + %61 = OpLabel + %67 = OpLoad %6 %8 + %68 = OpIAdd %6 %67 %20 + OpStore %8 %68 + %69 = OpAccessChain %21 %19 %9 %9 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %10 %70 + %72 = OpCompositeConstruct %11 %71 %71 %71 %71 + OpStore %13 %72 + OpBranch %63 + %63 = OpLabel + OpBranch %60 + %62 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-count-array-struct-field-set-int-array-element.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-count-array-struct-field-set-int-array-element.amber new file mode 100644 index 0000000..5d474b0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-count-array-struct-field-set-int-array-element.amber @@ -0,0 +1,389 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 5; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S +# { +# int data[10]; +# }; +# +# void main() +# { +# S obj = S(int[10](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1)); +# int arr[10] = int[10](_int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0); +# +# obj.data[_int_1] = _int_0; +# int a = _int_1; +# +# // Iterated once. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# // b = 0. +# int b = arr[_int_1]; +# +# // Iterated four times. +# do +# { +# _GLF_global_loop_count++; +# +# // Always true. +# if(gl_FragCoord.y > _float_0_0) +# { +# b++; +# } +# } +# while((gl_FragCoord.x > _float_0_0) && (_GLF_global_loop_count < _GLF_global_loop_bound)); +# +# int c = _int_1; +# +# // Always true. +# if(obj.data[b] <= _int_1) +# { +# c++; +# } +# +# // arr[2] = 2. +# arr[++a] = c; +# } +# +# // Always true. +# if(arr[_int_2] == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 175 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %102 %156 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %13 "S" + OpMemberName %13 0 "data" + OpName %15 "obj" + OpName %18 "buf1" + OpMemberName %18 0 "_GLF_uniform_int_values" + OpName %20 "" + OpName %45 "arr" + OpName %74 "a" + OpName %88 "b" + OpName %102 "gl_FragCoord" + OpName %108 "buf0" + OpMemberName %108 0 "_GLF_uniform_float_values" + OpName %110 "" + OpName %128 "c" + OpName %156 "_GLF_color" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %102 BuiltIn FragCoord + OpDecorate %107 ArrayStride 16 + OpMemberDecorate %108 0 Offset 0 + OpDecorate %108 Block + OpDecorate %110 DescriptorSet 0 + OpDecorate %110 Binding 0 + OpDecorate %156 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 10 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Function %13 + %16 = OpConstant %10 3 + %17 = OpTypeArray %6 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypePointer Uniform %6 + %44 = OpTypePointer Function %12 + %46 = OpConstant %6 1 + %72 = OpTypePointer Function %6 + %83 = OpConstant %6 5 + %84 = OpTypeBool + %99 = OpTypeFloat 32 + %100 = OpTypeVector %99 4 + %101 = OpTypePointer Input %100 + %102 = OpVariable %101 Input + %103 = OpConstant %10 1 + %104 = OpTypePointer Input %99 + %107 = OpTypeArray %99 %103 + %108 = OpTypeStruct %107 + %109 = OpTypePointer Uniform %108 + %110 = OpVariable %109 Uniform + %111 = OpTypePointer Uniform %99 + %119 = OpConstant %10 0 + %145 = OpConstant %6 2 + %155 = OpTypePointer Output %100 + %156 = OpVariable %155 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %15 = OpVariable %14 Function + %45 = OpVariable %44 Function + %74 = OpVariable %72 Function + %88 = OpVariable %72 Function + %128 = OpVariable %72 Function + OpStore %8 %9 + %22 = OpAccessChain %21 %20 %9 %9 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %21 %20 %9 %9 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %21 %20 %9 %9 + %27 = OpLoad %6 %26 + %28 = OpAccessChain %21 %20 %9 %9 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %21 %20 %9 %9 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %21 %20 %9 %9 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %21 %20 %9 %9 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %21 %20 %9 %9 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %21 %20 %9 %9 + %39 = OpLoad %6 %38 + %40 = OpAccessChain %21 %20 %9 %9 + %41 = OpLoad %6 %40 + %42 = OpCompositeConstruct %12 %23 %25 %27 %29 %31 %33 %35 %37 %39 %41 + %43 = OpCompositeConstruct %13 %42 + OpStore %15 %43 + %47 = OpAccessChain %21 %20 %9 %46 + %48 = OpLoad %6 %47 + %49 = OpAccessChain %21 %20 %9 %46 + %50 = OpLoad %6 %49 + %51 = OpAccessChain %21 %20 %9 %46 + %52 = OpLoad %6 %51 + %53 = OpAccessChain %21 %20 %9 %46 + %54 = OpLoad %6 %53 + %55 = OpAccessChain %21 %20 %9 %46 + %56 = OpLoad %6 %55 + %57 = OpAccessChain %21 %20 %9 %46 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %21 %20 %9 %46 + %60 = OpLoad %6 %59 + %61 = OpAccessChain %21 %20 %9 %46 + %62 = OpLoad %6 %61 + %63 = OpAccessChain %21 %20 %9 %46 + %64 = OpLoad %6 %63 + %65 = OpAccessChain %21 %20 %9 %46 + %66 = OpLoad %6 %65 + %67 = OpCompositeConstruct %12 %48 %50 %52 %54 %56 %58 %60 %62 %64 %66 + OpStore %45 %67 + %68 = OpAccessChain %21 %20 %9 %9 + %69 = OpLoad %6 %68 + %70 = OpAccessChain %21 %20 %9 %46 + %71 = OpLoad %6 %70 + %73 = OpAccessChain %72 %15 %9 %69 + OpStore %73 %71 + %75 = OpAccessChain %21 %20 %9 %9 + %76 = OpLoad %6 %75 + OpStore %74 %76 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %6 %8 + %85 = OpSLessThan %84 %82 %83 + OpBranchConditional %85 %78 %79 + %78 = OpLabel + %86 = OpLoad %6 %8 + %87 = OpIAdd %6 %86 %46 + OpStore %8 %87 + %89 = OpAccessChain %21 %20 %9 %9 + %90 = OpLoad %6 %89 + %91 = OpAccessChain %72 %45 %90 + %92 = OpLoad %6 %91 + OpStore %88 %92 + OpBranch %93 + %93 = OpLabel + OpLoopMerge %95 %96 None + OpBranch %94 + %94 = OpLabel + %97 = OpLoad %6 %8 + %98 = OpIAdd %6 %97 %46 + OpStore %8 %98 + %105 = OpAccessChain %104 %102 %103 + %106 = OpLoad %99 %105 + %112 = OpAccessChain %111 %110 %9 %9 + %113 = OpLoad %99 %112 + %114 = OpFOrdGreaterThan %84 %106 %113 + OpSelectionMerge %116 None + OpBranchConditional %114 %115 %116 + %115 = OpLabel + %117 = OpLoad %6 %88 + %118 = OpIAdd %6 %117 %46 + OpStore %88 %118 + OpBranch %116 + %116 = OpLabel + OpBranch %96 + %96 = OpLabel + %120 = OpAccessChain %104 %102 %119 + %121 = OpLoad %99 %120 + %122 = OpAccessChain %111 %110 %9 %9 + %123 = OpLoad %99 %122 + %124 = OpFOrdGreaterThan %84 %121 %123 + %125 = OpLoad %6 %8 + %126 = OpSLessThan %84 %125 %83 + %127 = OpLogicalAnd %84 %124 %126 + OpBranchConditional %127 %93 %95 + %95 = OpLabel + %129 = OpAccessChain %21 %20 %9 %9 + %130 = OpLoad %6 %129 + OpStore %128 %130 + %131 = OpLoad %6 %88 + %132 = OpAccessChain %72 %15 %9 %131 + %133 = OpLoad %6 %132 + %134 = OpAccessChain %21 %20 %9 %9 + %135 = OpLoad %6 %134 + %136 = OpSLessThanEqual %84 %133 %135 + OpSelectionMerge %138 None + OpBranchConditional %136 %137 %138 + %137 = OpLabel + %139 = OpLoad %6 %128 + %140 = OpIAdd %6 %139 %46 + OpStore %128 %140 + OpBranch %138 + %138 = OpLabel + %141 = OpLoad %6 %74 + %142 = OpIAdd %6 %141 %46 + OpStore %74 %142 + %143 = OpLoad %6 %128 + %144 = OpAccessChain %72 %45 %142 + OpStore %144 %143 + OpBranch %80 + %80 = OpLabel + OpBranch %77 + %79 = OpLabel + %146 = OpAccessChain %21 %20 %9 %145 + %147 = OpLoad %6 %146 + %148 = OpAccessChain %72 %45 %147 + %149 = OpLoad %6 %148 + %150 = OpAccessChain %21 %20 %9 %145 + %151 = OpLoad %6 %150 + %152 = OpIEqual %84 %149 %151 + OpSelectionMerge %154 None + OpBranchConditional %152 %153 %170 + %153 = OpLabel + %157 = OpAccessChain %21 %20 %9 %9 + %158 = OpLoad %6 %157 + %159 = OpConvertSToF %99 %158 + %160 = OpAccessChain %21 %20 %9 %46 + %161 = OpLoad %6 %160 + %162 = OpConvertSToF %99 %161 + %163 = OpAccessChain %21 %20 %9 %46 + %164 = OpLoad %6 %163 + %165 = OpConvertSToF %99 %164 + %166 = OpAccessChain %21 %20 %9 %9 + %167 = OpLoad %6 %166 + %168 = OpConvertSToF %99 %167 + %169 = OpCompositeConstruct %100 %159 %162 %165 %168 + OpStore %156 %169 + OpBranch %154 + %170 = OpLabel + %171 = OpAccessChain %21 %20 %9 %46 + %172 = OpLoad %6 %171 + %173 = OpConvertSToF %99 %172 + %174 = OpCompositeConstruct %100 %173 %173 %173 %173 + OpStore %156 %174 + OpBranch %154 + %154 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-counter-accumulate-integer-condition-large-array-elements.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-accumulate-integer-condition-large-array-elements.amber new file mode 100644 index 0000000..992fb75 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-accumulate-integer-condition-large-array-elements.amber @@ -0,0 +1,346 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_16 _GLF_uniform_int_values[1] +# #define _int_128 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 16, 128, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int arr[128] = int[128](1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +# +# void main() +# { +# // Iterated once. +# do +# { +# _GLF_global_loop_count++; +# +# int a = 0; +# +# // Always true. +# if(arr[_GLF_MAKE_IN_BOUNDS_INT(_int_1, 128)] == _int_1) +# { +# a++; +# } +# +# // Always true. +# if(arr[_GLF_MAKE_IN_BOUNDS_INT(_int_1, 128)] == _int_1) +# { +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# } +# a++; +# } +# +# // Always true. +# if(arr[_GLF_MAKE_IN_BOUNDS_INT(_int_1, 128)] == _int_1) +# { +# a++; +# } +# +# // Always false. +# if(a == 0) +# { +# arr[_GLF_MAKE_IN_BOUNDS_INT(_int_16, 128)] = _int_0; +# } +# +# // Always false. +# if(arr[_GLF_MAKE_IN_BOUNDS_INT(clamp(int(gl_FragCoord.y), _int_0, _int_128 - _int_1), 128)] == _int_0) +# { +# return; +# } +# } +# while(_GLF_global_loop_count < _GLF_global_loop_bound); +# +# if(arr[_GLF_MAKE_IN_BOUNDS_INT(_int_16, 128)] == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 149 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %93 %130 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %14 "arr" + OpName %24 "a" + OpName %27 "buf0" + OpMemberName %27 0 "_GLF_uniform_int_values" + OpName %29 "" + OpName %93 "gl_FragCoord" + OpName %130 "_GLF_color" + OpDecorate %26 ArrayStride 16 + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 Block + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 0 + OpDecorate %93 BuiltIn FragCoord + OpDecorate %130 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 128 + %12 = OpTypeArray %6 %11 + %13 = OpTypePointer Private %12 + %14 = OpVariable %13 Private + %15 = OpConstant %6 1 + %16 = OpConstantComposite %12 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 + %23 = OpTypePointer Function %6 + %25 = OpConstant %10 4 + %26 = OpTypeArray %6 %25 + %27 = OpTypeStruct %26 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %30 = OpTypePointer Uniform %6 + %33 = OpConstant %6 127 + %39 = OpTypeBool + %61 = OpConstant %6 10 + %86 = OpConstant %6 3 + %90 = OpTypeFloat 32 + %91 = OpTypeVector %90 4 + %92 = OpTypePointer Input %91 + %93 = OpVariable %92 Input + %94 = OpConstant %10 1 + %95 = OpTypePointer Input %90 + %101 = OpConstant %6 2 + %129 = OpTypePointer Output %91 + %130 = OpVariable %129 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %24 = OpVariable %23 Function + OpStore %8 %9 + OpStore %14 %16 + OpBranch %17 + %17 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %18 + %18 = OpLabel + %21 = OpLoad %6 %8 + %22 = OpIAdd %6 %21 %15 + OpStore %8 %22 + OpStore %24 %9 + %31 = OpAccessChain %30 %29 %9 %9 + %32 = OpLoad %6 %31 + %34 = OpExtInst %6 %1 SClamp %32 %9 %33 + %35 = OpAccessChain %7 %14 %34 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %30 %29 %9 %9 + %38 = OpLoad %6 %37 + %40 = OpIEqual %39 %36 %38 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %42 + %41 = OpLabel + %43 = OpLoad %6 %24 + %44 = OpIAdd %6 %43 %15 + OpStore %24 %44 + OpBranch %42 + %42 = OpLabel + %45 = OpAccessChain %30 %29 %9 %9 + %46 = OpLoad %6 %45 + %47 = OpExtInst %6 %1 SClamp %46 %9 %33 + %48 = OpAccessChain %7 %14 %47 + %49 = OpLoad %6 %48 + %50 = OpAccessChain %30 %29 %9 %9 + %51 = OpLoad %6 %50 + %52 = OpIEqual %39 %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + OpBranch %55 + %55 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %6 %8 + %62 = OpSLessThan %39 %60 %61 + OpBranchConditional %62 %56 %57 + %56 = OpLabel + %63 = OpLoad %6 %8 + %64 = OpIAdd %6 %63 %15 + OpStore %8 %64 + OpBranch %58 + %58 = OpLabel + OpBranch %55 + %57 = OpLabel + %65 = OpLoad %6 %24 + %66 = OpIAdd %6 %65 %15 + OpStore %24 %66 + OpBranch %54 + %54 = OpLabel + %67 = OpAccessChain %30 %29 %9 %9 + %68 = OpLoad %6 %67 + %69 = OpExtInst %6 %1 SClamp %68 %9 %33 + %70 = OpAccessChain %7 %14 %69 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %30 %29 %9 %9 + %73 = OpLoad %6 %72 + %74 = OpIEqual %39 %71 %73 + OpSelectionMerge %76 None + OpBranchConditional %74 %75 %76 + %75 = OpLabel + %77 = OpLoad %6 %24 + %78 = OpIAdd %6 %77 %15 + OpStore %24 %78 + OpBranch %76 + %76 = OpLabel + %79 = OpLoad %6 %24 + %80 = OpIEqual %39 %79 %9 + OpSelectionMerge %82 None + OpBranchConditional %80 %81 %82 + %81 = OpLabel + %83 = OpAccessChain %30 %29 %9 %15 + %84 = OpLoad %6 %83 + %85 = OpExtInst %6 %1 SClamp %84 %9 %33 + %87 = OpAccessChain %30 %29 %9 %86 + %88 = OpLoad %6 %87 + %89 = OpAccessChain %7 %14 %85 + OpStore %89 %88 + OpBranch %82 + %82 = OpLabel + %96 = OpAccessChain %95 %93 %94 + %97 = OpLoad %90 %96 + %98 = OpConvertFToS %6 %97 + %99 = OpAccessChain %30 %29 %9 %86 + %100 = OpLoad %6 %99 + %102 = OpAccessChain %30 %29 %9 %101 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %30 %29 %9 %9 + %105 = OpLoad %6 %104 + %106 = OpISub %6 %103 %105 + %107 = OpExtInst %6 %1 SClamp %98 %100 %106 + %108 = OpExtInst %6 %1 SClamp %107 %9 %33 + %109 = OpAccessChain %7 %14 %108 + %110 = OpLoad %6 %109 + %111 = OpAccessChain %30 %29 %9 %86 + %112 = OpLoad %6 %111 + %113 = OpIEqual %39 %110 %112 + OpSelectionMerge %115 None + OpBranchConditional %113 %114 %115 + %114 = OpLabel + OpReturn + %115 = OpLabel + OpBranch %20 + %20 = OpLabel + %117 = OpLoad %6 %8 + %118 = OpSLessThan %39 %117 %61 + OpBranchConditional %118 %17 %19 + %19 = OpLabel + %119 = OpAccessChain %30 %29 %9 %15 + %120 = OpLoad %6 %119 + %121 = OpExtInst %6 %1 SClamp %120 %9 %33 + %122 = OpAccessChain %7 %14 %121 + %123 = OpLoad %6 %122 + %124 = OpAccessChain %30 %29 %9 %9 + %125 = OpLoad %6 %124 + %126 = OpIEqual %39 %123 %125 + OpSelectionMerge %128 None + OpBranchConditional %126 %127 %144 + %127 = OpLabel + %131 = OpAccessChain %30 %29 %9 %9 + %132 = OpLoad %6 %131 + %133 = OpConvertSToF %90 %132 + %134 = OpAccessChain %30 %29 %9 %86 + %135 = OpLoad %6 %134 + %136 = OpConvertSToF %90 %135 + %137 = OpAccessChain %30 %29 %9 %86 + %138 = OpLoad %6 %137 + %139 = OpConvertSToF %90 %138 + %140 = OpAccessChain %30 %29 %9 %9 + %141 = OpLoad %6 %140 + %142 = OpConvertSToF %90 %141 + %143 = OpCompositeConstruct %91 %133 %136 %139 %142 + OpStore %130 %143 + OpBranch %128 + %144 = OpLabel + %145 = OpAccessChain %30 %29 %9 %86 + %146 = OpLoad %6 %145 + %147 = OpConvertSToF %90 %146 + %148 = OpCompositeConstruct %91 %147 %147 %147 %147 + OpStore %130 %148 + OpBranch %128 + %128 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 16 128 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-counter-exhaust-calling-function-twice.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-exhaust-calling-function-twice.amber new file mode 100644 index 0000000..f1f131f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-exhaust-calling-function-twice.amber @@ -0,0 +1,478 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _int_6 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 10, 6] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# struct S +# { +# int data[10]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void func() +# { +# int a = _int_1; +# int b = _int_1; +# +# while (_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# +# if(b == _int_6) +# { +# break; +# } +# +# b++; +# +# // Always false. +# if(int[10](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1)[a] == _int_0) +# { +# return; +# } +# } +# } +# +# void main() +# { +# S obj = S(int[10](_int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0)); +# +# for(int i = _int_0; i < _int_10 && _GLF_global_loop_count < _GLF_global_loop_bound; i ++) +# { +# _GLF_global_loop_count ++; +# +# if(i == 0) +# { +# obj.data[i] = 1; +# } +# else if(i == 1) +# { +# // Calling func twice makes sure the global counter has reached its limit, and this +# // loop will therefore end. +# func(); +# func(); +# obj.data[i] = _int_1; +# } +# // Never executed. +# else if(i == 4) +# { +# obj.data[i] = _int_1; +# } +# // Never executed. +# else +# { +# discard; +# } +# } +# +# // Check results against reference values. +# bool ok = true; +# int ref[10] = int[10](_int_1, _int_1, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0); +# +# for(int i = 0; i < 10; i ++) +# { +# if(obj.data[i] != ref[i]) +# { +# ok = false; +# } +# } +# +# if(ok) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 226 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %207 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %6 "func(" + OpName %10 "_GLF_global_loop_count" + OpName %13 "a" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %23 "b" + OpName %73 "indexable" + OpName %82 "S" + OpMemberName %82 0 "data" + OpName %84 "obj" + OpName %107 "i" + OpName %157 "ok" + OpName %159 "ref" + OpName %181 "i" + OpName %207 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %207 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Private %8 + %10 = OpVariable %9 Private + %11 = OpConstant %8 0 + %12 = OpTypePointer Function %8 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 4 + %16 = OpTypeArray %8 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypePointer Uniform %8 + %32 = OpConstant %8 10 + %33 = OpTypeBool + %36 = OpConstant %8 1 + %39 = OpConstant %8 3 + %68 = OpConstant %14 10 + %69 = OpTypeArray %8 %68 + %72 = OpTypePointer Function %69 + %82 = OpTypeStruct %69 + %83 = OpTypePointer Function %82 + %116 = OpConstant %8 2 + %144 = OpConstant %8 4 + %156 = OpTypePointer Function %33 + %158 = OpConstantTrue %33 + %198 = OpConstantFalse %33 + %204 = OpTypeFloat 32 + %205 = OpTypeVector %204 4 + %206 = OpTypePointer Output %205 + %207 = OpVariable %206 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %84 = OpVariable %83 Function + %107 = OpVariable %12 Function + %157 = OpVariable %156 Function + %159 = OpVariable %72 Function + %181 = OpVariable %12 Function + OpStore %10 %11 + %85 = OpAccessChain %20 %19 %11 %36 + %86 = OpLoad %8 %85 + %87 = OpAccessChain %20 %19 %11 %36 + %88 = OpLoad %8 %87 + %89 = OpAccessChain %20 %19 %11 %36 + %90 = OpLoad %8 %89 + %91 = OpAccessChain %20 %19 %11 %36 + %92 = OpLoad %8 %91 + %93 = OpAccessChain %20 %19 %11 %36 + %94 = OpLoad %8 %93 + %95 = OpAccessChain %20 %19 %11 %36 + %96 = OpLoad %8 %95 + %97 = OpAccessChain %20 %19 %11 %36 + %98 = OpLoad %8 %97 + %99 = OpAccessChain %20 %19 %11 %36 + %100 = OpLoad %8 %99 + %101 = OpAccessChain %20 %19 %11 %36 + %102 = OpLoad %8 %101 + %103 = OpAccessChain %20 %19 %11 %36 + %104 = OpLoad %8 %103 + %105 = OpCompositeConstruct %69 %86 %88 %90 %92 %94 %96 %98 %100 %102 %104 + %106 = OpCompositeConstruct %82 %105 + OpStore %84 %106 + %108 = OpAccessChain %20 %19 %11 %36 + %109 = OpLoad %8 %108 + OpStore %107 %109 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %115 = OpLoad %8 %107 + %117 = OpAccessChain %20 %19 %11 %116 + %118 = OpLoad %8 %117 + %119 = OpSLessThan %33 %115 %118 + %120 = OpLoad %8 %10 + %121 = OpSLessThan %33 %120 %32 + %122 = OpLogicalAnd %33 %119 %121 + OpBranchConditional %122 %111 %112 + %111 = OpLabel + %123 = OpLoad %8 %10 + %124 = OpIAdd %8 %123 %36 + OpStore %10 %124 + %125 = OpLoad %8 %107 + %126 = OpIEqual %33 %125 %11 + OpSelectionMerge %128 None + OpBranchConditional %126 %127 %131 + %127 = OpLabel + %129 = OpLoad %8 %107 + %130 = OpAccessChain %12 %84 %11 %129 + OpStore %130 %36 + OpBranch %128 + %131 = OpLabel + %132 = OpLoad %8 %107 + %133 = OpIEqual %33 %132 %36 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %142 + %134 = OpLabel + %136 = OpFunctionCall %2 %6 + %137 = OpFunctionCall %2 %6 + %138 = OpLoad %8 %107 + %139 = OpAccessChain %20 %19 %11 %11 + %140 = OpLoad %8 %139 + %141 = OpAccessChain %12 %84 %11 %138 + OpStore %141 %140 + OpBranch %135 + %142 = OpLabel + %143 = OpLoad %8 %107 + %145 = OpIEqual %33 %143 %144 + OpSelectionMerge %147 None + OpBranchConditional %145 %146 %152 + %146 = OpLabel + %148 = OpLoad %8 %107 + %149 = OpAccessChain %20 %19 %11 %11 + %150 = OpLoad %8 %149 + %151 = OpAccessChain %12 %84 %11 %148 + OpStore %151 %150 + OpBranch %147 + %152 = OpLabel + OpTerminateInvocation + %147 = OpLabel + OpBranch %135 + %135 = OpLabel + OpBranch %128 + %128 = OpLabel + OpBranch %113 + %113 = OpLabel + %154 = OpLoad %8 %107 + %155 = OpIAdd %8 %154 %36 + OpStore %107 %155 + OpBranch %110 + %112 = OpLabel + OpStore %157 %158 + %160 = OpAccessChain %20 %19 %11 %11 + %161 = OpLoad %8 %160 + %162 = OpAccessChain %20 %19 %11 %11 + %163 = OpLoad %8 %162 + %164 = OpAccessChain %20 %19 %11 %36 + %165 = OpLoad %8 %164 + %166 = OpAccessChain %20 %19 %11 %36 + %167 = OpLoad %8 %166 + %168 = OpAccessChain %20 %19 %11 %36 + %169 = OpLoad %8 %168 + %170 = OpAccessChain %20 %19 %11 %36 + %171 = OpLoad %8 %170 + %172 = OpAccessChain %20 %19 %11 %36 + %173 = OpLoad %8 %172 + %174 = OpAccessChain %20 %19 %11 %36 + %175 = OpLoad %8 %174 + %176 = OpAccessChain %20 %19 %11 %36 + %177 = OpLoad %8 %176 + %178 = OpAccessChain %20 %19 %11 %36 + %179 = OpLoad %8 %178 + %180 = OpCompositeConstruct %69 %161 %163 %165 %167 %169 %171 %173 %175 %177 %179 + OpStore %159 %180 + OpStore %181 %11 + OpBranch %182 + %182 = OpLabel + OpLoopMerge %184 %185 None + OpBranch %186 + %186 = OpLabel + %187 = OpLoad %8 %181 + %188 = OpSLessThan %33 %187 %32 + OpBranchConditional %188 %183 %184 + %183 = OpLabel + %189 = OpLoad %8 %181 + %190 = OpAccessChain %12 %84 %11 %189 + %191 = OpLoad %8 %190 + %192 = OpLoad %8 %181 + %193 = OpAccessChain %12 %159 %192 + %194 = OpLoad %8 %193 + %195 = OpINotEqual %33 %191 %194 + OpSelectionMerge %197 None + OpBranchConditional %195 %196 %197 + %196 = OpLabel + OpStore %157 %198 + OpBranch %197 + %197 = OpLabel + OpBranch %185 + %185 = OpLabel + %199 = OpLoad %8 %181 + %200 = OpIAdd %8 %199 %36 + OpStore %181 %200 + OpBranch %182 + %184 = OpLabel + %201 = OpLoad %33 %157 + OpSelectionMerge %203 None + OpBranchConditional %201 %202 %221 + %202 = OpLabel + %208 = OpAccessChain %20 %19 %11 %11 + %209 = OpLoad %8 %208 + %210 = OpConvertSToF %204 %209 + %211 = OpAccessChain %20 %19 %11 %36 + %212 = OpLoad %8 %211 + %213 = OpConvertSToF %204 %212 + %214 = OpAccessChain %20 %19 %11 %36 + %215 = OpLoad %8 %214 + %216 = OpConvertSToF %204 %215 + %217 = OpAccessChain %20 %19 %11 %11 + %218 = OpLoad %8 %217 + %219 = OpConvertSToF %204 %218 + %220 = OpCompositeConstruct %205 %210 %213 %216 %219 + OpStore %207 %220 + OpBranch %203 + %221 = OpLabel + %222 = OpAccessChain %20 %19 %11 %36 + %223 = OpLoad %8 %222 + %224 = OpConvertSToF %204 %223 + %225 = OpCompositeConstruct %205 %224 %224 %224 %224 + OpStore %207 %225 + OpBranch %203 + %203 = OpLabel + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %13 = OpVariable %12 Function + %23 = OpVariable %12 Function + %73 = OpVariable %72 Function + %21 = OpAccessChain %20 %19 %11 %11 + %22 = OpLoad %8 %21 + OpStore %13 %22 + %24 = OpAccessChain %20 %19 %11 %11 + %25 = OpLoad %8 %24 + OpStore %23 %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %8 %10 + %34 = OpSLessThan %33 %31 %32 + OpBranchConditional %34 %27 %28 + %27 = OpLabel + %35 = OpLoad %8 %10 + %37 = OpIAdd %8 %35 %36 + OpStore %10 %37 + %38 = OpLoad %8 %23 + %40 = OpAccessChain %20 %19 %11 %39 + %41 = OpLoad %8 %40 + %42 = OpIEqual %33 %38 %41 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %44 + %43 = OpLabel + OpBranch %28 + %44 = OpLabel + %46 = OpLoad %8 %23 + %47 = OpIAdd %8 %46 %36 + OpStore %23 %47 + %48 = OpAccessChain %20 %19 %11 %11 + %49 = OpLoad %8 %48 + %50 = OpAccessChain %20 %19 %11 %11 + %51 = OpLoad %8 %50 + %52 = OpAccessChain %20 %19 %11 %11 + %53 = OpLoad %8 %52 + %54 = OpAccessChain %20 %19 %11 %11 + %55 = OpLoad %8 %54 + %56 = OpAccessChain %20 %19 %11 %11 + %57 = OpLoad %8 %56 + %58 = OpAccessChain %20 %19 %11 %11 + %59 = OpLoad %8 %58 + %60 = OpAccessChain %20 %19 %11 %11 + %61 = OpLoad %8 %60 + %62 = OpAccessChain %20 %19 %11 %11 + %63 = OpLoad %8 %62 + %64 = OpAccessChain %20 %19 %11 %11 + %65 = OpLoad %8 %64 + %66 = OpAccessChain %20 %19 %11 %11 + %67 = OpLoad %8 %66 + %70 = OpCompositeConstruct %69 %49 %51 %53 %55 %57 %59 %61 %63 %65 %67 + %71 = OpLoad %8 %13 + OpStore %73 %70 + %74 = OpAccessChain %12 %73 %71 + %75 = OpLoad %8 %74 + %76 = OpAccessChain %20 %19 %11 %36 + %77 = OpLoad %8 %76 + %78 = OpIEqual %33 %75 %77 + OpSelectionMerge %80 None + OpBranchConditional %78 %79 %80 + %79 = OpLabel + OpReturn + %80 = OpLabel + OpBranch %29 + %29 = OpLabel + OpBranch %26 + %28 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 10 6 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-counter-findlsb-zero.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-findlsb-zero.amber new file mode 100644 index 0000000..a5ee382 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-findlsb-zero.amber @@ -0,0 +1,257 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_4 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 4] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 1; +# +# // Iterates ten times. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# // a becomes -1. +# a = findLSB(_int_0); +# } +# +# // Iterates once. +# do +# { +# _GLF_global_loop_count++; +# +# // Never iterated. +# for(int i = _int_0; i < _int_4 && _GLF_global_loop_count < _GLF_global_loop_bound; i++) +# { +# _GLF_global_loop_count ++; +# } +# +# a++; +# } +# while((a < 50) && (_GLF_global_loop_count < _GLF_global_loop_bound)); +# +# // Always true. +# if(a == 0) +# { +# _GLF_color = vec4(1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 92 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %75 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %11 "a" + OpName %27 "buf0" + OpMemberName %27 0 "_GLF_uniform_int_values" + OpName %29 "" + OpName %40 "i" + OpName %75 "_GLF_color" + OpDecorate %26 ArrayStride 16 + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 Block + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 0 + OpDecorate %75 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 1 + %19 = OpConstant %6 10 + %20 = OpTypeBool + %24 = OpTypeInt 32 0 + %25 = OpConstant %24 3 + %26 = OpTypeArray %6 %25 + %27 = OpTypeStruct %26 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %30 = OpTypePointer Uniform %6 + %49 = OpConstant %6 2 + %63 = OpConstant %6 50 + %72 = OpTypeFloat 32 + %73 = OpTypeVector %72 4 + %74 = OpTypePointer Output %73 + %75 = OpVariable %74 Output + %76 = OpConstant %72 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %40 = OpVariable %10 Function + OpStore %8 %9 + OpStore %11 %12 + OpBranch %13 + %13 = OpLabel + OpLoopMerge %15 %16 None + OpBranch %17 + %17 = OpLabel + %18 = OpLoad %6 %8 + %21 = OpSLessThan %20 %18 %19 + OpBranchConditional %21 %14 %15 + %14 = OpLabel + %22 = OpLoad %6 %8 + %23 = OpIAdd %6 %22 %12 + OpStore %8 %23 + %31 = OpAccessChain %30 %29 %9 %9 + %32 = OpLoad %6 %31 + %33 = OpExtInst %6 %1 FindILsb %32 + OpStore %11 %33 + OpBranch %16 + %16 = OpLabel + OpBranch %13 + %15 = OpLabel + OpBranch %34 + %34 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %35 + %35 = OpLabel + %38 = OpLoad %6 %8 + %39 = OpIAdd %6 %38 %12 + OpStore %8 %39 + %41 = OpAccessChain %30 %29 %9 %9 + %42 = OpLoad %6 %41 + OpStore %40 %42 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %6 %40 + %50 = OpAccessChain %30 %29 %9 %49 + %51 = OpLoad %6 %50 + %52 = OpSLessThan %20 %48 %51 + %53 = OpLoad %6 %8 + %54 = OpSLessThan %20 %53 %19 + %55 = OpLogicalAnd %20 %52 %54 + OpBranchConditional %55 %44 %45 + %44 = OpLabel + %56 = OpLoad %6 %8 + %57 = OpIAdd %6 %56 %12 + OpStore %8 %57 + OpBranch %46 + %46 = OpLabel + %58 = OpLoad %6 %40 + %59 = OpIAdd %6 %58 %12 + OpStore %40 %59 + OpBranch %43 + %45 = OpLabel + %60 = OpLoad %6 %11 + %61 = OpIAdd %6 %60 %12 + OpStore %11 %61 + OpBranch %37 + %37 = OpLabel + %62 = OpLoad %6 %11 + %64 = OpSLessThan %20 %62 %63 + %65 = OpLoad %6 %8 + %66 = OpSLessThan %20 %65 %19 + %67 = OpLogicalAnd %20 %64 %66 + OpBranchConditional %67 %34 %36 + %36 = OpLabel + %68 = OpLoad %6 %11 + %69 = OpIEqual %20 %68 %9 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %87 + %70 = OpLabel + %77 = OpAccessChain %30 %29 %9 %9 + %78 = OpLoad %6 %77 + %79 = OpConvertSToF %72 %78 + %80 = OpAccessChain %30 %29 %9 %9 + %81 = OpLoad %6 %80 + %82 = OpConvertSToF %72 %81 + %83 = OpAccessChain %30 %29 %9 %12 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %72 %84 + %86 = OpCompositeConstruct %73 %76 %79 %82 %85 + OpStore %75 %86 + OpBranch %71 + %87 = OpLabel + %88 = OpAccessChain %30 %29 %9 %9 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %72 %89 + %91 = OpCompositeConstruct %73 %90 %90 %90 %90 + OpStore %75 %91 + OpBranch %71 + %71 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 4 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix.amber new file mode 100644 index 0000000..51114c4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix.amber @@ -0,0 +1,434 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_4 _GLF_uniform_int_values[3] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_2_0 _GLF_uniform_float_values[2] +# #define _float_3_0 _GLF_uniform_float_values[3] +# #define _float_4_0 _GLF_uniform_float_values[4] +# #define _float_5_0 _GLF_uniform_float_values[5] +# #define _float_6_0 _GLF_uniform_float_values[6] +# #define _float_7_0 _GLF_uniform_float_values[7] +# #define _float_8_0 _GLF_uniform_float_values[8] +# #define _float_9_0 _GLF_uniform_float_values[9] +# #define _float_10_0 _GLF_uniform_float_values[10] +# #define _float_11_0 _GLF_uniform_float_values[11] +# #define _float_12_0 _GLF_uniform_float_values[12] +# #define _float_13_0 _GLF_uniform_float_values[13] +# #define _float_14_0 _GLF_uniform_float_values[14] +# #define _float_15_0 _GLF_uniform_float_values[15] +# #define _float_16_0 _GLF_uniform_float_values[16] +# #define _float_27_0 _GLF_uniform_float_values[17] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 2, 1, 4] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of _GLF_uniform_float_values: +# // [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 27.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[18]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# // Contents of one: 1 +# layout(set = 0, binding = 2) uniform buf2 +# { +# int one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat4 m = mat4(_float_1_0, _float_2_0, _float_3_0, _float_4_0, _float_5_0, _float_6_0, _float_7_0, _float_8_0, _float_9_0, _float_10_0, _float_11_0, _float_12_0, _float_13_0, _float_14_0, _float_15_0, _float_16_0); +# vec4 v = vec4(_float_1_0, _float_2_0, _float_3_0, _float_4_0); +# float f = _float_1_0; +# +# // Iterated once. +# for(int a = _int_0; _GLF_global_loop_count < _GLF_global_loop_bound; a++) +# { +# _GLF_global_loop_count++; +# +# // v becomes (2, 2, 3, 4). +# v[_GLF_MAKE_IN_BOUNDS_INT(a, 4)] += _float_1_0; +# +# // Iterated 9 times. +# for(int b = _int_1; _GLF_global_loop_count < _GLF_global_loop_bound; b--) +# { +# _GLF_global_loop_count++; +# // Iteration b = 1: f += 10. Iterations b = 0..-8: f += 2. +# f += v[_GLF_MAKE_IN_BOUNDS_INT(b, 4)] * m[_GLF_MAKE_IN_BOUNDS_INT(b, 4)][a]; +# } +# +# // This value is never used. +# m[1][_GLF_MAKE_IN_BOUNDS_INT(a, 4)] = _float_1_0; +# +# // Always false. +# if(one == _int_0) +# { +# discard; +# } +# // Always false. +# if(one == _int_2) +# { +# discard; +# } +# } +# +# float zero = _float_0_0; +# // Modify zero in case the result is not what's expected. +# if(f != _float_27_0) +# { +# zero = _float_1_0; +# } +# +# _GLF_color = vec4(f, zero, _int_0, f); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 193 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %185 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %14 "m" + OpName %18 "buf1" + OpMemberName %18 0 "_GLF_uniform_float_values" + OpName %20 "" + OpName %78 "v" + OpName %89 "f" + OpName %93 "a" + OpName %96 "buf0" + OpMemberName %96 0 "_GLF_uniform_int_values" + OpName %98 "" + OpName %120 "b" + OpName %151 "buf2" + OpMemberName %151 0 "one" + OpName %153 "" + OpName %172 "zero" + OpName %185 "_GLF_color" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %95 ArrayStride 16 + OpMemberDecorate %96 0 Offset 0 + OpDecorate %96 Block + OpDecorate %98 DescriptorSet 0 + OpDecorate %98 Binding 0 + OpMemberDecorate %151 0 Offset 0 + OpDecorate %151 Block + OpDecorate %153 DescriptorSet 0 + OpDecorate %153 Binding 2 + OpDecorate %185 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypeMatrix %11 4 + %13 = OpTypePointer Function %12 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 18 + %17 = OpTypeArray %10 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpConstant %6 1 + %22 = OpTypePointer Uniform %10 + %25 = OpConstant %6 2 + %28 = OpConstant %6 3 + %31 = OpConstant %6 4 + %34 = OpConstant %6 5 + %37 = OpConstant %6 6 + %40 = OpConstant %6 7 + %43 = OpConstant %6 8 + %46 = OpConstant %6 9 + %49 = OpConstant %6 10 + %52 = OpConstant %6 11 + %55 = OpConstant %6 12 + %58 = OpConstant %6 13 + %61 = OpConstant %6 14 + %64 = OpConstant %6 15 + %67 = OpConstant %6 16 + %70 = OpConstant %10 1 + %71 = OpConstant %10 0 + %77 = OpTypePointer Function %11 + %88 = OpTypePointer Function %10 + %92 = OpTypePointer Function %6 + %94 = OpConstant %15 4 + %95 = OpTypeArray %6 %94 + %96 = OpTypeStruct %95 + %97 = OpTypePointer Uniform %96 + %98 = OpVariable %97 Uniform + %99 = OpTypePointer Uniform %6 + %108 = OpTypeBool + %151 = OpTypeStruct %6 + %152 = OpTypePointer Uniform %151 + %153 = OpVariable %152 Uniform + %176 = OpConstant %6 17 + %184 = OpTypePointer Output %11 + %185 = OpVariable %184 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpVariable %13 Function + %78 = OpVariable %77 Function + %89 = OpVariable %88 Function + %93 = OpVariable %92 Function + %120 = OpVariable %92 Function + %172 = OpVariable %88 Function + OpStore %8 %9 + %23 = OpAccessChain %22 %20 %9 %21 + %24 = OpLoad %10 %23 + %26 = OpAccessChain %22 %20 %9 %25 + %27 = OpLoad %10 %26 + %29 = OpAccessChain %22 %20 %9 %28 + %30 = OpLoad %10 %29 + %32 = OpAccessChain %22 %20 %9 %31 + %33 = OpLoad %10 %32 + %35 = OpAccessChain %22 %20 %9 %34 + %36 = OpLoad %10 %35 + %38 = OpAccessChain %22 %20 %9 %37 + %39 = OpLoad %10 %38 + %41 = OpAccessChain %22 %20 %9 %40 + %42 = OpLoad %10 %41 + %44 = OpAccessChain %22 %20 %9 %43 + %45 = OpLoad %10 %44 + %47 = OpAccessChain %22 %20 %9 %46 + %48 = OpLoad %10 %47 + %50 = OpAccessChain %22 %20 %9 %49 + %51 = OpLoad %10 %50 + %53 = OpAccessChain %22 %20 %9 %52 + %54 = OpLoad %10 %53 + %56 = OpAccessChain %22 %20 %9 %55 + %57 = OpLoad %10 %56 + %59 = OpAccessChain %22 %20 %9 %58 + %60 = OpLoad %10 %59 + %62 = OpAccessChain %22 %20 %9 %61 + %63 = OpLoad %10 %62 + %65 = OpAccessChain %22 %20 %9 %64 + %66 = OpLoad %10 %65 + %68 = OpAccessChain %22 %20 %9 %67 + %69 = OpLoad %10 %68 + %72 = OpCompositeConstruct %11 %24 %27 %30 %33 + %73 = OpCompositeConstruct %11 %36 %39 %42 %45 + %74 = OpCompositeConstruct %11 %48 %51 %54 %57 + %75 = OpCompositeConstruct %11 %60 %63 %66 %69 + %76 = OpCompositeConstruct %12 %72 %73 %74 %75 + OpStore %14 %76 + %79 = OpAccessChain %22 %20 %9 %21 + %80 = OpLoad %10 %79 + %81 = OpAccessChain %22 %20 %9 %25 + %82 = OpLoad %10 %81 + %83 = OpAccessChain %22 %20 %9 %28 + %84 = OpLoad %10 %83 + %85 = OpAccessChain %22 %20 %9 %31 + %86 = OpLoad %10 %85 + %87 = OpCompositeConstruct %11 %80 %82 %84 %86 + OpStore %78 %87 + %90 = OpAccessChain %22 %20 %9 %21 + %91 = OpLoad %10 %90 + OpStore %89 %91 + %100 = OpAccessChain %99 %98 %9 %9 + %101 = OpLoad %6 %100 + OpStore %93 %101 + OpBranch %102 + %102 = OpLabel + OpLoopMerge %104 %105 None + OpBranch %106 + %106 = OpLabel + %107 = OpLoad %6 %8 + %109 = OpSLessThan %108 %107 %49 + OpBranchConditional %109 %103 %104 + %103 = OpLabel + %110 = OpLoad %6 %8 + %111 = OpIAdd %6 %110 %21 + OpStore %8 %111 + %112 = OpLoad %6 %93 + %113 = OpExtInst %6 %1 SClamp %112 %9 %28 + %114 = OpAccessChain %22 %20 %9 %21 + %115 = OpLoad %10 %114 + %116 = OpAccessChain %88 %78 %113 + %117 = OpLoad %10 %116 + %118 = OpFAdd %10 %117 %115 + %119 = OpAccessChain %88 %78 %113 + OpStore %119 %118 + %121 = OpAccessChain %99 %98 %9 %25 + %122 = OpLoad %6 %121 + OpStore %120 %122 + OpBranch %123 + %123 = OpLabel + OpLoopMerge %125 %126 None + OpBranch %127 + %127 = OpLabel + %128 = OpLoad %6 %8 + %129 = OpSLessThan %108 %128 %49 + OpBranchConditional %129 %124 %125 + %124 = OpLabel + %130 = OpLoad %6 %8 + %131 = OpIAdd %6 %130 %21 + OpStore %8 %131 + %132 = OpLoad %6 %120 + %133 = OpExtInst %6 %1 SClamp %132 %9 %28 + %134 = OpAccessChain %88 %78 %133 + %135 = OpLoad %10 %134 + %136 = OpLoad %6 %120 + %137 = OpExtInst %6 %1 SClamp %136 %9 %28 + %138 = OpLoad %6 %93 + %139 = OpAccessChain %88 %14 %137 %138 + %140 = OpLoad %10 %139 + %141 = OpFMul %10 %135 %140 + %142 = OpLoad %10 %89 + %143 = OpFAdd %10 %142 %141 + OpStore %89 %143 + OpBranch %126 + %126 = OpLabel + %144 = OpLoad %6 %120 + %145 = OpISub %6 %144 %21 + OpStore %120 %145 + OpBranch %123 + %125 = OpLabel + %146 = OpLoad %6 %93 + %147 = OpExtInst %6 %1 SClamp %146 %9 %28 + %148 = OpAccessChain %22 %20 %9 %21 + %149 = OpLoad %10 %148 + %150 = OpAccessChain %88 %14 %21 %147 + OpStore %150 %149 + %154 = OpAccessChain %99 %153 %9 + %155 = OpLoad %6 %154 + %156 = OpAccessChain %99 %98 %9 %9 + %157 = OpLoad %6 %156 + %158 = OpIEqual %108 %155 %157 + OpSelectionMerge %160 None + OpBranchConditional %158 %159 %160 + %159 = OpLabel + OpTerminateInvocation + %160 = OpLabel + %162 = OpAccessChain %99 %153 %9 + %163 = OpLoad %6 %162 + %164 = OpAccessChain %99 %98 %9 %21 + %165 = OpLoad %6 %164 + %166 = OpIEqual %108 %163 %165 + OpSelectionMerge %168 None + OpBranchConditional %166 %167 %168 + %167 = OpLabel + OpTerminateInvocation + %168 = OpLabel + OpBranch %105 + %105 = OpLabel + %170 = OpLoad %6 %93 + %171 = OpIAdd %6 %170 %21 + OpStore %93 %171 + OpBranch %102 + %104 = OpLabel + %173 = OpAccessChain %22 %20 %9 %9 + %174 = OpLoad %10 %173 + OpStore %172 %174 + %175 = OpLoad %10 %89 + %177 = OpAccessChain %22 %20 %9 %176 + %178 = OpLoad %10 %177 + %179 = OpFUnordNotEqual %108 %175 %178 + OpSelectionMerge %181 None + OpBranchConditional %179 %180 %181 + %180 = OpLabel + %182 = OpAccessChain %22 %20 %9 %21 + %183 = OpLoad %10 %182 + OpStore %172 %183 + OpBranch %181 + %181 = OpLabel + %186 = OpLoad %10 %89 + %187 = OpLoad %10 %172 + %188 = OpAccessChain %99 %98 %9 %9 + %189 = OpLoad %6 %188 + %190 = OpConvertSToF %10 %189 + %191 = OpLoad %10 %89 + %192 = OpCompositeConstruct %11 %186 %187 %190 %191 + OpStore %185 %192 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 STD140 DATA + 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 27.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 2 1 4 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-counter-for-loop-function-call-inside-never-called.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-for-loop-function-call-inside-never-called.amber new file mode 100644 index 0000000..81b9e81 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-for-loop-function-call-inside-never-called.amber @@ -0,0 +1,410 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_5 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2, 5] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# int arr[5] = int[5](1, 1, 1, 1, 1); +# +# layout(location = 0) out vec4 _GLF_color; +# +# void func() +# { +# int b = _int_0; +# +# for(int i = 0; _GLF_global_loop_count < _GLF_global_loop_bound; i ++) +# { +# _GLF_global_loop_count++; +# +# if(++b > 2) +# { +# break; +# } +# +# int c = _int_0; +# +# for(int j = _int_0; _GLF_global_loop_count < _GLF_global_loop_bound; ) +# { +# _GLF_global_loop_count++; +# +# if(++c > _int_2) +# { +# break; +# } +# +# // Same as arr[i] because j is always 0. +# arr[j + i] = i - 1; +# } +# } +# } +# +# void main() +# { +# // Sets arr[0] to -1 and arr[1] to 0. +# func(); +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# int a = 5; +# +# for(int i = 1; i < 4 && _GLF_global_loop_count < _GLF_global_loop_bound; i++) +# { +# _GLF_global_loop_count++; +# +# // Always false as i reaches four before a reaches eight. +# if(a++ > 7) +# { +# func(); +# break; +# } +# } +# } +# +# // Check for the expected values, and set color output to black if the check fails. +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# int ref[5] = int[5](- _int_1, _int_0, _int_1, _int_1, _int_1); +# for(int i = _int_0; i < _int_5; i ++) +# { +# if(arr[i] != ref[i]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 174 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %118 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %6 "func(" + OpName %10 "_GLF_global_loop_count" + OpName %16 "arr" + OpName %20 "b" + OpName %23 "buf0" + OpMemberName %23 0 "_GLF_uniform_int_values" + OpName %25 "" + OpName %29 "i" + OpName %48 "c" + OpName %51 "j" + OpName %89 "a" + OpName %91 "i" + OpName %118 "_GLF_color" + OpName %133 "ref" + OpName %146 "i" + OpDecorate %22 ArrayStride 16 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %118 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Private %8 + %10 = OpVariable %9 Private + %11 = OpConstant %8 0 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 5 + %14 = OpTypeArray %8 %13 + %15 = OpTypePointer Private %14 + %16 = OpVariable %15 Private + %17 = OpConstant %8 1 + %18 = OpConstantComposite %14 %17 %17 %17 %17 %17 + %19 = OpTypePointer Function %8 + %21 = OpConstant %12 4 + %22 = OpTypeArray %8 %21 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpTypePointer Uniform %8 + %36 = OpConstant %8 10 + %37 = OpTypeBool + %43 = OpConstant %8 2 + %90 = OpConstant %8 5 + %98 = OpConstant %8 4 + %107 = OpConstant %8 7 + %115 = OpTypeFloat 32 + %116 = OpTypeVector %115 4 + %117 = OpTypePointer Output %116 + %118 = OpVariable %117 Output + %132 = OpTypePointer Function %14 + %155 = OpConstant %8 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %89 = OpVariable %19 Function + %91 = OpVariable %19 Function + %133 = OpVariable %132 Function + %146 = OpVariable %19 Function + OpStore %10 %11 + OpStore %16 %18 + %79 = OpFunctionCall %2 %6 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %82 %83 None + OpBranch %84 + %84 = OpLabel + %85 = OpLoad %8 %10 + %86 = OpSLessThan %37 %85 %36 + OpBranchConditional %86 %81 %82 + %81 = OpLabel + %87 = OpLoad %8 %10 + %88 = OpIAdd %8 %87 %17 + OpStore %10 %88 + OpStore %89 %90 + OpStore %91 %17 + OpBranch %92 + %92 = OpLabel + OpLoopMerge %94 %95 None + OpBranch %96 + %96 = OpLabel + %97 = OpLoad %8 %91 + %99 = OpSLessThan %37 %97 %98 + %100 = OpLoad %8 %10 + %101 = OpSLessThan %37 %100 %36 + %102 = OpLogicalAnd %37 %99 %101 + OpBranchConditional %102 %93 %94 + %93 = OpLabel + %103 = OpLoad %8 %10 + %104 = OpIAdd %8 %103 %17 + OpStore %10 %104 + %105 = OpLoad %8 %89 + %106 = OpIAdd %8 %105 %17 + OpStore %89 %106 + %108 = OpSGreaterThan %37 %105 %107 + OpSelectionMerge %110 None + OpBranchConditional %108 %109 %110 + %109 = OpLabel + %111 = OpFunctionCall %2 %6 + OpBranch %94 + %110 = OpLabel + OpBranch %95 + %95 = OpLabel + %113 = OpLoad %8 %91 + %114 = OpIAdd %8 %113 %17 + OpStore %91 %114 + OpBranch %92 + %94 = OpLabel + OpBranch %83 + %83 = OpLabel + OpBranch %80 + %82 = OpLabel + %119 = OpAccessChain %26 %25 %11 %11 + %120 = OpLoad %8 %119 + %121 = OpConvertSToF %115 %120 + %122 = OpAccessChain %26 %25 %11 %17 + %123 = OpLoad %8 %122 + %124 = OpConvertSToF %115 %123 + %125 = OpAccessChain %26 %25 %11 %17 + %126 = OpLoad %8 %125 + %127 = OpConvertSToF %115 %126 + %128 = OpAccessChain %26 %25 %11 %11 + %129 = OpLoad %8 %128 + %130 = OpConvertSToF %115 %129 + %131 = OpCompositeConstruct %116 %121 %124 %127 %130 + OpStore %118 %131 + %134 = OpAccessChain %26 %25 %11 %11 + %135 = OpLoad %8 %134 + %136 = OpSNegate %8 %135 + %137 = OpAccessChain %26 %25 %11 %17 + %138 = OpLoad %8 %137 + %139 = OpAccessChain %26 %25 %11 %11 + %140 = OpLoad %8 %139 + %141 = OpAccessChain %26 %25 %11 %11 + %142 = OpLoad %8 %141 + %143 = OpAccessChain %26 %25 %11 %11 + %144 = OpLoad %8 %143 + %145 = OpCompositeConstruct %14 %136 %138 %140 %142 %144 + OpStore %133 %145 + %147 = OpAccessChain %26 %25 %11 %17 + %148 = OpLoad %8 %147 + OpStore %146 %148 + OpBranch %149 + %149 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %154 = OpLoad %8 %146 + %156 = OpAccessChain %26 %25 %11 %155 + %157 = OpLoad %8 %156 + %158 = OpSLessThan %37 %154 %157 + OpBranchConditional %158 %150 %151 + %150 = OpLabel + %159 = OpLoad %8 %146 + %160 = OpAccessChain %9 %16 %159 + %161 = OpLoad %8 %160 + %162 = OpLoad %8 %146 + %163 = OpAccessChain %19 %133 %162 + %164 = OpLoad %8 %163 + %165 = OpINotEqual %37 %161 %164 + OpSelectionMerge %167 None + OpBranchConditional %165 %166 %167 + %166 = OpLabel + %168 = OpAccessChain %26 %25 %11 %17 + %169 = OpLoad %8 %168 + %170 = OpConvertSToF %115 %169 + %171 = OpCompositeConstruct %116 %170 %170 %170 %170 + OpStore %118 %171 + OpBranch %167 + %167 = OpLabel + OpBranch %152 + %152 = OpLabel + %172 = OpLoad %8 %146 + %173 = OpIAdd %8 %172 %17 + OpStore %146 %173 + OpBranch %149 + %151 = OpLabel + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %20 = OpVariable %19 Function + %29 = OpVariable %19 Function + %48 = OpVariable %19 Function + %51 = OpVariable %19 Function + %27 = OpAccessChain %26 %25 %11 %17 + %28 = OpLoad %8 %27 + OpStore %20 %28 + OpStore %29 %11 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %8 %10 + %38 = OpSLessThan %37 %35 %36 + OpBranchConditional %38 %31 %32 + %31 = OpLabel + %39 = OpLoad %8 %10 + %40 = OpIAdd %8 %39 %17 + OpStore %10 %40 + %41 = OpLoad %8 %20 + %42 = OpIAdd %8 %41 %17 + OpStore %20 %42 + %44 = OpSGreaterThan %37 %42 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %45 %46 + %45 = OpLabel + OpBranch %32 + %46 = OpLabel + %49 = OpAccessChain %26 %25 %11 %17 + %50 = OpLoad %8 %49 + OpStore %48 %50 + %52 = OpAccessChain %26 %25 %11 %17 + %53 = OpLoad %8 %52 + OpStore %51 %53 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %8 %10 + %60 = OpSLessThan %37 %59 %36 + OpBranchConditional %60 %55 %56 + %55 = OpLabel + %61 = OpLoad %8 %10 + %62 = OpIAdd %8 %61 %17 + OpStore %10 %62 + %63 = OpLoad %8 %48 + %64 = OpIAdd %8 %63 %17 + OpStore %48 %64 + %65 = OpAccessChain %26 %25 %11 %43 + %66 = OpLoad %8 %65 + %67 = OpSGreaterThan %37 %64 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %69 + %68 = OpLabel + OpBranch %56 + %69 = OpLabel + %71 = OpLoad %8 %51 + %72 = OpLoad %8 %29 + %73 = OpIAdd %8 %71 %72 + %74 = OpLoad %8 %29 + %75 = OpISub %8 %74 %17 + %76 = OpAccessChain %9 %16 %73 + OpStore %76 %75 + OpBranch %57 + %57 = OpLabel + OpBranch %54 + %56 = OpLabel + OpBranch %33 + %33 = OpLabel + %77 = OpLoad %8 %29 + %78 = OpIAdd %8 %77 %17 + OpStore %29 %78 + OpBranch %30 + %32 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 5 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-counter-main-function-call.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-main-function-call.amber new file mode 100644 index 0000000..ce2c53b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-main-function-call.amber @@ -0,0 +1,240 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 100; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# // Never iterated as the loop count has already been exhausted +# // before calling this function. +# while (_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# return _int_1; +# } +# +# return _int_2; +# } +# +# void main() +# { +# do +# { +# _GLF_global_loop_count++; +# +# if (false) +# { +# return; +# } +# } +# while (true && (_GLF_global_loop_count < _GLF_global_loop_bound)); +# +# int a = func(); +# +# // Always true. +# if (a == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %66 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "_GLF_global_loop_count" + OpName %28 "buf0" + OpMemberName %28 0 "_GLF_uniform_int_values" + OpName %30 "" + OpName %55 "a" + OpName %66 "_GLF_color" + OpDecorate %27 ArrayStride 16 + OpMemberDecorate %28 0 Offset 0 + OpDecorate %28 Block + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 0 + OpDecorate %66 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Private %6 + %11 = OpVariable %10 Private + %12 = OpConstant %6 0 + %19 = OpConstant %6 100 + %20 = OpTypeBool + %23 = OpConstant %6 1 + %25 = OpTypeInt 32 0 + %26 = OpConstant %25 3 + %27 = OpTypeArray %6 %26 + %28 = OpTypeStruct %27 + %29 = OpTypePointer Uniform %28 + %30 = OpVariable %29 Uniform + %31 = OpTypePointer Uniform %6 + %35 = OpConstant %6 2 + %46 = OpConstantFalse %20 + %50 = OpConstantTrue %20 + %54 = OpTypePointer Function %6 + %63 = OpTypeFloat 32 + %64 = OpTypeVector %63 4 + %65 = OpTypePointer Output %64 + %66 = OpVariable %65 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %55 = OpVariable %54 Function + OpStore %11 %12 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %41 + %41 = OpLabel + %44 = OpLoad %6 %11 + %45 = OpIAdd %6 %44 %23 + OpStore %11 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + OpReturn + %48 = OpLabel + OpBranch %43 + %43 = OpLabel + %51 = OpLoad %6 %11 + %52 = OpSLessThan %20 %51 %19 + %53 = OpLogicalAnd %20 %50 %52 + OpBranchConditional %53 %40 %42 + %42 = OpLabel + %56 = OpFunctionCall %6 %8 + OpStore %55 %56 + %57 = OpLoad %6 %55 + %58 = OpAccessChain %31 %30 %12 %35 + %59 = OpLoad %6 %58 + %60 = OpIEqual %20 %57 %59 + OpSelectionMerge %62 None + OpBranchConditional %60 %61 %80 + %61 = OpLabel + %67 = OpAccessChain %31 %30 %12 %12 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %63 %68 + %70 = OpAccessChain %31 %30 %12 %23 + %71 = OpLoad %6 %70 + %72 = OpConvertSToF %63 %71 + %73 = OpAccessChain %31 %30 %12 %23 + %74 = OpLoad %6 %73 + %75 = OpConvertSToF %63 %74 + %76 = OpAccessChain %31 %30 %12 %12 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %63 %77 + %79 = OpCompositeConstruct %64 %69 %72 %75 %78 + OpStore %66 %79 + OpBranch %62 + %80 = OpLabel + %81 = OpAccessChain %31 %30 %12 %23 + %82 = OpLoad %6 %81 + %83 = OpConvertSToF %63 %82 + %84 = OpCompositeConstruct %64 %83 %83 %83 %83 + OpStore %66 %84 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + OpBranch %13 + %13 = OpLabel + OpLoopMerge %15 %16 None + OpBranch %17 + %17 = OpLabel + %18 = OpLoad %6 %11 + %21 = OpSLessThan %20 %18 %19 + OpBranchConditional %21 %14 %15 + %14 = OpLabel + %22 = OpLoad %6 %11 + %24 = OpIAdd %6 %22 %23 + OpStore %11 %24 + %32 = OpAccessChain %31 %30 %12 %12 + %33 = OpLoad %6 %32 + OpReturnValue %33 + %16 = OpLabel + OpBranch %13 + %15 = OpLabel + %36 = OpAccessChain %31 %30 %12 %35 + %37 = OpLoad %6 %36 + OpReturnValue %37 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-counter-multiply-one-minus.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-multiply-one-minus.amber new file mode 100644 index 0000000..41fffe6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-multiply-one-minus.amber @@ -0,0 +1,200 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 100; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 1; +# +# while (_GLF_global_loop_count < _GLF_global_loop_bound - _int_1) +# { +# _GLF_global_loop_count++; +# } +# +# // Always true. +# if (_int_0 == 0) +# { +# // Iterated once. +# while (_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# // a becomes 0. +# a *= 1 - a; +# } +# } +# +# // Always true. +# if (a == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %61 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %23 "buf0" + OpMemberName %23 0 "_GLF_uniform_int_values" + OpName %25 "" + OpName %61 "_GLF_color" + OpDecorate %22 ArrayStride 16 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %61 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpConstant %6 0 + %12 = OpConstant %6 1 + %19 = OpConstant %6 100 + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 2 + %22 = OpTypeArray %6 %21 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpTypePointer Uniform %6 + %30 = OpTypeBool + %58 = OpTypeFloat 32 + %59 = OpTypeVector %58 4 + %60 = OpTypePointer Output %59 + %61 = OpVariable %60 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %13 + %13 = OpLabel + %80 = OpPhi %6 %9 %5 %33 %14 + %27 = OpAccessChain %26 %25 %9 %12 + %28 = OpLoad %6 %27 + %29 = OpISub %6 %19 %28 + %31 = OpSLessThan %30 %80 %29 + OpLoopMerge %15 %14 None + OpBranchConditional %31 %14 %15 + %14 = OpLabel + %33 = OpIAdd %6 %80 %12 + OpBranch %13 + %15 = OpLabel + %34 = OpAccessChain %26 %25 %9 %9 + %35 = OpLoad %6 %34 + %36 = OpIEqual %30 %35 %9 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + OpBranch %39 + %39 = OpLabel + %84 = OpPhi %6 %12 %37 %51 %40 + %81 = OpPhi %6 %80 %37 %47 %40 + %45 = OpSLessThan %30 %81 %19 + OpLoopMerge %41 %40 None + OpBranchConditional %45 %40 %41 + %40 = OpLabel + %47 = OpIAdd %6 %81 %12 + %49 = OpISub %6 %12 %84 + %51 = OpIMul %6 %84 %49 + OpBranch %39 + %41 = OpLabel + OpBranch %38 + %38 = OpLabel + %82 = OpPhi %6 %12 %15 %84 %41 + %55 = OpIEqual %30 %82 %35 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %75 + %56 = OpLabel + %64 = OpConvertSToF %58 %28 + %67 = OpConvertSToF %58 %35 + %74 = OpCompositeConstruct %59 %64 %67 %67 %64 + OpStore %61 %74 + OpBranch %57 + %75 = OpLabel + %78 = OpConvertSToF %58 %35 + %79 = OpCompositeConstruct %59 %78 %78 %78 %78 + OpStore %61 %79 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-counter-read-past-matrix-size-never-executed.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-read-past-matrix-size-never-executed.amber new file mode 100644 index 0000000..da08b8c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-read-past-matrix-size-never-executed.amber @@ -0,0 +1,313 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 { +# float _GLF_uniform_float_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# // Contents of zero: 0.0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# float zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat2 m22 = mat2(_float_0_0); +# float f = _float_0_0; +# +# // Iterated ten times. +# for(int c = 1; zero < _float_1_0 && _GLF_global_loop_count < _GLF_global_loop_bound; c++) +# { +# _GLF_global_loop_count++; +# int r = 1; +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# // r goes past the size of the matrix, but this is never executed. +# f += (true ? m22 : mat2(_float_1_0))[c][r]; +# } +# } +# +# // Always true. +# if(f == _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 119 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %59 %95 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %14 "m22" + OpName %18 "buf1" + OpMemberName %18 0 "_GLF_uniform_float_values" + OpName %20 "" + OpName %31 "f" + OpName %35 "c" + OpName %41 "buf2" + OpMemberName %41 0 "zero" + OpName %43 "" + OpName %56 "r" + OpName %59 "gl_FragCoord" + OpName %95 "_GLF_color" + OpName %97 "buf0" + OpMemberName %97 0 "_GLF_uniform_int_values" + OpName %99 "" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpMemberDecorate %41 0 Offset 0 + OpDecorate %41 Block + OpDecorate %43 DescriptorSet 0 + OpDecorate %43 Binding 2 + OpDecorate %59 BuiltIn FragCoord + OpDecorate %95 Location 0 + OpDecorate %96 ArrayStride 16 + OpMemberDecorate %97 0 Offset 0 + OpDecorate %97 Block + OpDecorate %99 DescriptorSet 0 + OpDecorate %99 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 2 + %12 = OpTypeMatrix %11 2 + %13 = OpTypePointer Function %12 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 2 + %17 = OpTypeArray %10 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpConstant %6 1 + %22 = OpTypePointer Uniform %10 + %25 = OpConstant %10 1 + %26 = OpConstant %10 0 + %30 = OpTypePointer Function %10 + %34 = OpTypePointer Function %6 + %41 = OpTypeStruct %10 + %42 = OpTypePointer Uniform %41 + %43 = OpVariable %42 Uniform + %48 = OpTypeBool + %51 = OpConstant %6 10 + %57 = OpTypeVector %10 4 + %58 = OpTypePointer Input %57 + %59 = OpVariable %58 Input + %60 = OpConstant %15 0 + %61 = OpTypePointer Input %10 + %69 = OpConstantTrue %48 + %94 = OpTypePointer Output %57 + %95 = OpVariable %94 Output + %96 = OpTypeArray %6 %16 + %97 = OpTypeStruct %96 + %98 = OpTypePointer Uniform %97 + %99 = OpVariable %98 Uniform + %100 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpVariable %13 Function + %31 = OpVariable %30 Function + %35 = OpVariable %34 Function + %56 = OpVariable %34 Function + %70 = OpVariable %13 Function + OpStore %8 %9 + %23 = OpAccessChain %22 %20 %9 %21 + %24 = OpLoad %10 %23 + %27 = OpCompositeConstruct %11 %24 %26 + %28 = OpCompositeConstruct %11 %26 %24 + %29 = OpCompositeConstruct %12 %27 %28 + OpStore %14 %29 + %32 = OpAccessChain %22 %20 %9 %21 + %33 = OpLoad %10 %32 + OpStore %31 %33 + OpStore %35 %21 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %44 = OpAccessChain %22 %43 %9 + %45 = OpLoad %10 %44 + %46 = OpAccessChain %22 %20 %9 %9 + %47 = OpLoad %10 %46 + %49 = OpFOrdLessThan %48 %45 %47 + %50 = OpLoad %6 %8 + %52 = OpSLessThan %48 %50 %51 + %53 = OpLogicalAnd %48 %49 %52 + OpBranchConditional %53 %37 %38 + %37 = OpLabel + %54 = OpLoad %6 %8 + %55 = OpIAdd %6 %54 %21 + OpStore %8 %55 + OpStore %56 %21 + %62 = OpAccessChain %61 %59 %60 + %63 = OpLoad %10 %62 + %64 = OpAccessChain %22 %20 %9 %21 + %65 = OpLoad %10 %64 + %66 = OpFOrdLessThan %48 %63 %65 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %68 + %67 = OpLabel + OpSelectionMerge %72 None + OpBranchConditional %69 %71 %74 + %71 = OpLabel + %73 = OpLoad %12 %14 + OpStore %70 %73 + OpBranch %72 + %74 = OpLabel + %75 = OpAccessChain %22 %20 %9 %9 + %76 = OpLoad %10 %75 + %77 = OpCompositeConstruct %11 %76 %26 + %78 = OpCompositeConstruct %11 %26 %76 + %79 = OpCompositeConstruct %12 %77 %78 + OpStore %70 %79 + OpBranch %72 + %72 = OpLabel + %80 = OpLoad %6 %35 + %81 = OpLoad %6 %56 + %82 = OpAccessChain %30 %70 %80 %81 + %83 = OpLoad %10 %82 + %84 = OpLoad %10 %31 + %85 = OpFAdd %10 %84 %83 + OpStore %31 %85 + OpBranch %68 + %68 = OpLabel + OpBranch %39 + %39 = OpLabel + %86 = OpLoad %6 %35 + %87 = OpIAdd %6 %86 %21 + OpStore %35 %87 + OpBranch %36 + %38 = OpLabel + %88 = OpLoad %10 %31 + %89 = OpAccessChain %22 %20 %9 %21 + %90 = OpLoad %10 %89 + %91 = OpFOrdEqual %48 %88 %90 + OpSelectionMerge %93 None + OpBranchConditional %91 %92 %114 + %92 = OpLabel + %101 = OpAccessChain %100 %99 %9 %21 + %102 = OpLoad %6 %101 + %103 = OpConvertSToF %10 %102 + %104 = OpAccessChain %100 %99 %9 %9 + %105 = OpLoad %6 %104 + %106 = OpConvertSToF %10 %105 + %107 = OpAccessChain %100 %99 %9 %9 + %108 = OpLoad %6 %107 + %109 = OpConvertSToF %10 %108 + %110 = OpAccessChain %100 %99 %9 %21 + %111 = OpLoad %6 %110 + %112 = OpConvertSToF %10 %111 + %113 = OpCompositeConstruct %57 %103 %106 %109 %112 + OpStore %95 %113 + OpBranch %93 + %114 = OpLabel + %115 = OpAccessChain %100 %99 %9 %9 + %116 = OpLoad %6 %115 + %117 = OpConvertSToF %10 %116 + %118 = OpCompositeConstruct %57 %117 %117 %117 %117 + OpStore %95 %118 + OpBranch %93 + %93 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float STD140 DATA + 0.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-counter-select-one-or-zero-never-greater-than-one.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-select-one-or-zero-never-greater-than-one.amber new file mode 100644 index 0000000..2bbfff6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-select-one-or-zero-never-greater-than-one.amber @@ -0,0 +1,235 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_2_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 2.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of one: 1.0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# float one; +# }; +# +# void main() +# { +# // Iterated once. +# do +# { +# _GLF_global_loop_count++; +# } +# while((one < _float_2_0 ? 1 : 0) > 1 && _GLF_global_loop_count < _GLF_global_loop_bound); +# +# // Always true. +# if(_GLF_global_loop_count == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %54 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %18 "buf2" + OpMemberName %18 0 "one" + OpName %20 "" + OpName %27 "buf0" + OpMemberName %27 0 "_GLF_uniform_float_values" + OpName %29 "" + OpName %43 "buf1" + OpMemberName %43 0 "_GLF_uniform_int_values" + OpName %45 "" + OpName %54 "_GLF_color" + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 2 + OpDecorate %26 ArrayStride 16 + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 Block + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 0 + OpDecorate %42 ArrayStride 16 + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 1 + OpDecorate %54 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %15 = OpConstant %6 1 + %17 = OpTypeFloat 32 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypePointer Uniform %17 + %24 = OpTypeInt 32 0 + %25 = OpConstant %24 1 + %26 = OpTypeArray %17 %25 + %27 = OpTypeStruct %26 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %32 = OpTypeBool + %37 = OpConstant %6 10 + %41 = OpConstant %24 2 + %42 = OpTypeArray %6 %41 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %46 = OpTypePointer Uniform %6 + %52 = OpTypeVector %17 4 + %53 = OpTypePointer Output %52 + %54 = OpVariable %53 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %11 + %11 = OpLabel + %14 = OpLoad %6 %8 + %16 = OpIAdd %6 %14 %15 + OpStore %8 %16 + OpBranch %13 + %13 = OpLabel + %22 = OpAccessChain %21 %20 %9 + %23 = OpLoad %17 %22 + %30 = OpAccessChain %21 %29 %9 %9 + %31 = OpLoad %17 %30 + %33 = OpFOrdLessThan %32 %23 %31 + %34 = OpSelect %6 %33 %15 %9 + %35 = OpSGreaterThan %32 %34 %15 + %36 = OpLoad %6 %8 + %38 = OpSLessThan %32 %36 %37 + %39 = OpLogicalAnd %32 %35 %38 + OpBranchConditional %39 %10 %12 + %12 = OpLabel + %40 = OpLoad %6 %8 + %47 = OpAccessChain %46 %45 %9 %15 + %48 = OpLoad %6 %47 + %49 = OpIEqual %32 %40 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %68 + %50 = OpLabel + %55 = OpAccessChain %46 %45 %9 %15 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %17 %56 + %58 = OpAccessChain %46 %45 %9 %9 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %17 %59 + %61 = OpAccessChain %46 %45 %9 %9 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %17 %62 + %64 = OpAccessChain %46 %45 %9 %15 + %65 = OpLoad %6 %64 + %66 = OpConvertSToF %17 %65 + %67 = OpCompositeConstruct %52 %57 %60 %63 %66 + OpStore %54 %67 + OpBranch %51 + %68 = OpLabel + %69 = OpAccessChain %46 %45 %9 %9 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %17 %70 + %72 = OpCompositeConstruct %52 %71 %71 %71 %71 + OpStore %54 %72 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-counter-set-array-element-once-index-using-findmsb.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-set-array-element-once-index-using-findmsb.amber new file mode 100644 index 0000000..be0cc07 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-set-array-element-once-index-using-findmsb.amber @@ -0,0 +1,390 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 2, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 50; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of resolution: [256.0, 256.0] +# layout(push_constant) uniform buf_push +# { +# vec2 resolution; +# }; +# +# void main() +# { +# float arr[32] = float[32](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0); +# int i = 1; +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# +# // Always false. +# if(gl_FragCoord.y < _float_0_0 && (true ? resolution : vec2(_int_1)).x >= _float_1_0) +# { +# break; +# } +# +# if(i == 1) +# { +# // Executed once. Sets arr[1] to zero. +# arr[i++] = _float_0_0; +# } +# } +# +# // Always true. Simplifies to arr[1] * resolution.y = 0.0 * 256.0 = 0.0. +# if(arr[findMSB(_int_2)] * resolution.y == _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 191 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %103 %171 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %15 "arr" + OpName %18 "buf0" + OpMemberName %18 0 "_GLF_uniform_float_values" + OpName %20 "" + OpName %88 "i" + OpName %103 "gl_FragCoord" + OpName %119 "buf_push" + OpMemberName %119 0 "resolution" + OpName %121 "" + OpName %128 "buf1" + OpMemberName %128 0 "_GLF_uniform_int_values" + OpName %130 "" + OpName %171 "_GLF_color" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %103 BuiltIn FragCoord + OpMemberDecorate %119 0 Offset 0 + OpDecorate %119 Block + OpDecorate %127 ArrayStride 16 + OpMemberDecorate %128 0 Offset 0 + OpDecorate %128 Block + OpDecorate %130 DescriptorSet 0 + OpDecorate %130 Binding 1 + OpDecorate %171 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 32 + %13 = OpTypeArray %10 %12 + %14 = OpTypePointer Function %13 + %16 = OpConstant %11 2 + %17 = OpTypeArray %10 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypePointer Uniform %10 + %87 = OpTypePointer Function %6 + %89 = OpConstant %6 1 + %96 = OpConstant %6 50 + %97 = OpTypeBool + %101 = OpTypeVector %10 4 + %102 = OpTypePointer Input %101 + %103 = OpVariable %102 Input + %104 = OpConstant %11 1 + %105 = OpTypePointer Input %10 + %113 = OpConstantTrue %97 + %114 = OpTypeVector %10 2 + %115 = OpTypePointer Function %114 + %119 = OpTypeStruct %114 + %120 = OpTypePointer PushConstant %119 + %121 = OpVariable %120 PushConstant + %122 = OpTypePointer PushConstant %114 + %126 = OpConstant %11 3 + %127 = OpTypeArray %6 %126 + %128 = OpTypeStruct %127 + %129 = OpTypePointer Uniform %128 + %130 = OpVariable %129 Uniform + %131 = OpTypePointer Uniform %6 + %136 = OpConstant %11 0 + %137 = OpTypePointer Function %10 + %161 = OpTypePointer PushConstant %10 + %170 = OpTypePointer Output %101 + %171 = OpVariable %170 Output + %175 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %15 = OpVariable %14 Function + %88 = OpVariable %87 Function + %116 = OpVariable %115 Function + OpStore %8 %9 + %22 = OpAccessChain %21 %20 %9 %9 + %23 = OpLoad %10 %22 + %24 = OpAccessChain %21 %20 %9 %9 + %25 = OpLoad %10 %24 + %26 = OpAccessChain %21 %20 %9 %9 + %27 = OpLoad %10 %26 + %28 = OpAccessChain %21 %20 %9 %9 + %29 = OpLoad %10 %28 + %30 = OpAccessChain %21 %20 %9 %9 + %31 = OpLoad %10 %30 + %32 = OpAccessChain %21 %20 %9 %9 + %33 = OpLoad %10 %32 + %34 = OpAccessChain %21 %20 %9 %9 + %35 = OpLoad %10 %34 + %36 = OpAccessChain %21 %20 %9 %9 + %37 = OpLoad %10 %36 + %38 = OpAccessChain %21 %20 %9 %9 + %39 = OpLoad %10 %38 + %40 = OpAccessChain %21 %20 %9 %9 + %41 = OpLoad %10 %40 + %42 = OpAccessChain %21 %20 %9 %9 + %43 = OpLoad %10 %42 + %44 = OpAccessChain %21 %20 %9 %9 + %45 = OpLoad %10 %44 + %46 = OpAccessChain %21 %20 %9 %9 + %47 = OpLoad %10 %46 + %48 = OpAccessChain %21 %20 %9 %9 + %49 = OpLoad %10 %48 + %50 = OpAccessChain %21 %20 %9 %9 + %51 = OpLoad %10 %50 + %52 = OpAccessChain %21 %20 %9 %9 + %53 = OpLoad %10 %52 + %54 = OpAccessChain %21 %20 %9 %9 + %55 = OpLoad %10 %54 + %56 = OpAccessChain %21 %20 %9 %9 + %57 = OpLoad %10 %56 + %58 = OpAccessChain %21 %20 %9 %9 + %59 = OpLoad %10 %58 + %60 = OpAccessChain %21 %20 %9 %9 + %61 = OpLoad %10 %60 + %62 = OpAccessChain %21 %20 %9 %9 + %63 = OpLoad %10 %62 + %64 = OpAccessChain %21 %20 %9 %9 + %65 = OpLoad %10 %64 + %66 = OpAccessChain %21 %20 %9 %9 + %67 = OpLoad %10 %66 + %68 = OpAccessChain %21 %20 %9 %9 + %69 = OpLoad %10 %68 + %70 = OpAccessChain %21 %20 %9 %9 + %71 = OpLoad %10 %70 + %72 = OpAccessChain %21 %20 %9 %9 + %73 = OpLoad %10 %72 + %74 = OpAccessChain %21 %20 %9 %9 + %75 = OpLoad %10 %74 + %76 = OpAccessChain %21 %20 %9 %9 + %77 = OpLoad %10 %76 + %78 = OpAccessChain %21 %20 %9 %9 + %79 = OpLoad %10 %78 + %80 = OpAccessChain %21 %20 %9 %9 + %81 = OpLoad %10 %80 + %82 = OpAccessChain %21 %20 %9 %9 + %83 = OpLoad %10 %82 + %84 = OpAccessChain %21 %20 %9 %9 + %85 = OpLoad %10 %84 + %86 = OpCompositeConstruct %13 %23 %25 %27 %29 %31 %33 %35 %37 %39 %41 %43 %45 %47 %49 %51 %53 %55 %57 %59 %61 %63 %65 %67 %69 %71 %73 %75 %77 %79 %81 %83 %85 + OpStore %15 %86 + OpStore %88 %89 + OpBranch %90 + %90 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %6 %8 + %98 = OpSLessThan %97 %95 %96 + OpBranchConditional %98 %91 %92 + %91 = OpLabel + %99 = OpLoad %6 %8 + %100 = OpIAdd %6 %99 %89 + OpStore %8 %100 + %106 = OpAccessChain %105 %103 %104 + %107 = OpLoad %10 %106 + %108 = OpAccessChain %21 %20 %9 %89 + %109 = OpLoad %10 %108 + %110 = OpFOrdLessThan %97 %107 %109 + OpSelectionMerge %112 None + OpBranchConditional %110 %111 %112 + %111 = OpLabel + OpSelectionMerge %118 None + OpBranchConditional %113 %117 %125 + %117 = OpLabel + %123 = OpAccessChain %122 %121 %9 + %124 = OpLoad %114 %123 + OpStore %116 %124 + OpBranch %118 + %125 = OpLabel + %132 = OpAccessChain %131 %130 %9 %9 + %133 = OpLoad %6 %132 + %134 = OpConvertSToF %10 %133 + %135 = OpCompositeConstruct %114 %134 %134 + OpStore %116 %135 + OpBranch %118 + %118 = OpLabel + %138 = OpAccessChain %137 %116 %136 + %139 = OpLoad %10 %138 + %140 = OpAccessChain %21 %20 %9 %9 + %141 = OpLoad %10 %140 + %142 = OpFOrdGreaterThanEqual %97 %139 %141 + OpBranch %112 + %112 = OpLabel + %143 = OpPhi %97 %110 %91 %142 %118 + OpSelectionMerge %145 None + OpBranchConditional %143 %144 %145 + %144 = OpLabel + OpBranch %92 + %145 = OpLabel + %147 = OpLoad %6 %88 + %148 = OpIEqual %97 %147 %89 + OpSelectionMerge %150 None + OpBranchConditional %148 %149 %150 + %149 = OpLabel + %151 = OpLoad %6 %88 + %152 = OpIAdd %6 %151 %89 + OpStore %88 %152 + %153 = OpAccessChain %21 %20 %9 %89 + %154 = OpLoad %10 %153 + %155 = OpAccessChain %137 %15 %151 + OpStore %155 %154 + OpBranch %150 + %150 = OpLabel + OpBranch %93 + %93 = OpLabel + OpBranch %90 + %92 = OpLabel + %156 = OpAccessChain %131 %130 %9 %89 + %157 = OpLoad %6 %156 + %158 = OpExtInst %6 %1 FindSMsb %157 + %159 = OpAccessChain %137 %15 %158 + %160 = OpLoad %10 %159 + %162 = OpAccessChain %161 %121 %9 %104 + %163 = OpLoad %10 %162 + %164 = OpFMul %10 %160 %163 + %165 = OpAccessChain %21 %20 %9 %89 + %166 = OpLoad %10 %165 + %167 = OpFOrdEqual %97 %164 %166 + OpSelectionMerge %169 None + OpBranchConditional %167 %168 %186 + %168 = OpLabel + %172 = OpAccessChain %131 %130 %9 %9 + %173 = OpLoad %6 %172 + %174 = OpConvertSToF %10 %173 + %176 = OpAccessChain %131 %130 %9 %175 + %177 = OpLoad %6 %176 + %178 = OpConvertSToF %10 %177 + %179 = OpAccessChain %131 %130 %9 %175 + %180 = OpLoad %6 %179 + %181 = OpConvertSToF %10 %180 + %182 = OpAccessChain %131 %130 %9 %9 + %183 = OpLoad %6 %182 + %184 = OpConvertSToF %10 %183 + %185 = OpCompositeConstruct %101 %174 %178 %181 %184 + OpStore %171 %185 + OpBranch %169 + %186 = OpLabel + %187 = OpAccessChain %131 %130 %9 %175 + %188 = OpLoad %6 %187 + %189 = OpConvertSToF %10 %188 + %190 = OpCompositeConstruct %101 %189 %189 %189 %189 + OpStore %171 %190 + OpBranch %169 + %169 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 2 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-counter-squared-comparison.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-squared-comparison.amber new file mode 100644 index 0000000..6b33fdb --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-squared-comparison.amber @@ -0,0 +1,193 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# const int _GLF_global_loop_bound = 100; +# int _GLF_global_loop_count = 0; +# +# void main() +# { +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# +# if(_GLF_global_loop_count * _GLF_global_loop_count > 10) +# { +# break; +# } +# } +# +# // Always true. +# if(_GLF_global_loop_count == 4) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %38 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %38 "_GLF_color" + OpName %42 "buf0" + OpMemberName %42 0 "_GLF_uniform_int_values" + OpName %44 "" + OpDecorate %38 Location 0 + OpDecorate %41 ArrayStride 16 + OpMemberDecorate %42 0 Offset 0 + OpDecorate %42 Block + OpDecorate %44 DescriptorSet 0 + OpDecorate %44 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %16 = OpConstant %6 100 + %17 = OpTypeBool + %20 = OpConstant %6 1 + %25 = OpConstant %6 10 + %31 = OpConstant %6 4 + %35 = OpTypeFloat 32 + %36 = OpTypeVector %35 4 + %37 = OpTypePointer Output %36 + %38 = OpVariable %37 Output + %39 = OpTypeInt 32 0 + %40 = OpConstant %39 2 + %41 = OpTypeArray %6 %40 + %42 = OpTypeStruct %41 + %43 = OpTypePointer Uniform %42 + %44 = OpVariable %43 Uniform + %45 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %6 %8 + %18 = OpSLessThan %17 %15 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %19 = OpLoad %6 %8 + %21 = OpIAdd %6 %19 %20 + OpStore %8 %21 + %22 = OpLoad %6 %8 + %23 = OpLoad %6 %8 + %24 = OpIMul %6 %22 %23 + %26 = OpSGreaterThan %17 %24 %25 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + OpBranch %12 + %28 = OpLabel + OpBranch %13 + %13 = OpLabel + OpBranch %10 + %12 = OpLabel + %30 = OpLoad %6 %8 + %32 = OpIEqual %17 %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %59 + %33 = OpLabel + %46 = OpAccessChain %45 %44 %9 %9 + %47 = OpLoad %6 %46 + %48 = OpConvertSToF %35 %47 + %49 = OpAccessChain %45 %44 %9 %20 + %50 = OpLoad %6 %49 + %51 = OpConvertSToF %35 %50 + %52 = OpAccessChain %45 %44 %9 %20 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %35 %53 + %55 = OpAccessChain %45 %44 %9 %9 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %35 %56 + %58 = OpCompositeConstruct %36 %48 %51 %54 %57 + OpStore %38 %58 + OpBranch %34 + %59 = OpLabel + %60 = OpAccessChain %45 %44 %9 %20 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %35 %61 + %63 = OpCompositeConstruct %36 %62 %62 %62 %62 + OpStore %38 %63 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-global-loop-counter-texture-sample-loop-condition-set-array-element.amber b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-texture-sample-loop-condition-set-array-element.amber new file mode 100644 index 0000000..bdd845b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-global-loop-counter-texture-sample-loop-condition-set-array-element.amber @@ -0,0 +1,299 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# const int _GLF_global_loop_bound = 50; +# int _GLF_global_loop_count = 0; +# +# int arr[32] = int[32](1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +# +# layout(set = 0, binding = 0) uniform sampler2D tex; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Sets arr elements 2..15 to 0. +# for(int i = 2; (i < 16) && (_GLF_global_loop_count < _GLF_global_loop_bound); i++) +# { +# _GLF_global_loop_count++; +# arr[i] = 0; +# } +# +# // Loops until the global loop bound is reached. +# while(texture(tex, vec2(1.0)).a > 0.0 && _GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# ivec2 v = ivec2(1); +# +# // Always true. +# if(arr[1] == 1) +# { +# // Sets arr[17] to 2. +# arr[v.x + v.y * 16] = 2; +# } +# } +# +# // Always true. +# if (arr[0] == 1 && arr[1] == 1 && arr[2] == 0 && arr[17] == 2) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 111 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %107 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %14 "arr" + OpName %18 "i" + OpName %48 "tex" + OpName %66 "v" + OpName %107 "_GLF_color" + OpDecorate %48 RelaxedPrecision + OpDecorate %48 DescriptorSet 0 + OpDecorate %48 Binding 0 + OpDecorate %49 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %107 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 32 + %12 = OpTypeArray %6 %11 + %13 = OpTypePointer Private %12 + %14 = OpVariable %13 Private + %15 = OpConstant %6 1 + %16 = OpConstantComposite %12 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 + %17 = OpTypePointer Function %6 + %19 = OpConstant %6 2 + %26 = OpConstant %6 16 + %27 = OpTypeBool + %30 = OpConstant %6 50 + %44 = OpTypeFloat 32 + %45 = OpTypeImage %44 2D 0 0 0 1 Unknown + %46 = OpTypeSampledImage %45 + %47 = OpTypePointer UniformConstant %46 + %48 = OpVariable %47 UniformConstant + %50 = OpTypeVector %44 2 + %51 = OpConstant %44 1 + %52 = OpConstantComposite %50 %51 %51 + %53 = OpTypeVector %44 4 + %55 = OpConstant %10 3 + %57 = OpConstant %44 0 + %64 = OpTypeVector %6 2 + %65 = OpTypePointer Function %64 + %67 = OpConstantComposite %64 %15 %15 + %73 = OpConstant %10 0 + %76 = OpConstant %10 1 + %99 = OpConstant %6 17 + %106 = OpTypePointer Output %53 + %107 = OpVariable %106 Output + %108 = OpConstantComposite %53 %51 %57 %57 %51 + %110 = OpConstantComposite %53 %57 %57 %57 %57 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %18 = OpVariable %17 Function + %66 = OpVariable %65 Function + OpStore %8 %9 + OpStore %14 %16 + OpStore %18 %19 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %6 %18 + %28 = OpSLessThan %27 %25 %26 + %29 = OpLoad %6 %8 + %31 = OpSLessThan %27 %29 %30 + %32 = OpLogicalAnd %27 %28 %31 + OpBranchConditional %32 %21 %22 + %21 = OpLabel + %33 = OpLoad %6 %8 + %34 = OpIAdd %6 %33 %15 + OpStore %8 %34 + %35 = OpLoad %6 %18 + %36 = OpAccessChain %7 %14 %35 + OpStore %36 %9 + OpBranch %23 + %23 = OpLabel + %37 = OpLoad %6 %18 + %38 = OpIAdd %6 %37 %15 + OpStore %18 %38 + OpBranch %20 + %22 = OpLabel + OpBranch %39 + %39 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %49 = OpLoad %46 %48 + %54 = OpImageSampleImplicitLod %53 %49 %52 + %56 = OpCompositeExtract %44 %54 3 + %58 = OpFOrdGreaterThan %27 %56 %57 + %59 = OpLoad %6 %8 + %60 = OpSLessThan %27 %59 %30 + %61 = OpLogicalAnd %27 %58 %60 + OpBranchConditional %61 %40 %41 + %40 = OpLabel + %62 = OpLoad %6 %8 + %63 = OpIAdd %6 %62 %15 + OpStore %8 %63 + OpStore %66 %67 + %68 = OpAccessChain %7 %14 %15 + %69 = OpLoad %6 %68 + %70 = OpIEqual %27 %69 %15 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %72 + %71 = OpLabel + %74 = OpAccessChain %17 %66 %73 + %75 = OpLoad %6 %74 + %77 = OpAccessChain %17 %66 %76 + %78 = OpLoad %6 %77 + %79 = OpIMul %6 %78 %26 + %80 = OpIAdd %6 %75 %79 + %81 = OpAccessChain %7 %14 %80 + OpStore %81 %19 + OpBranch %72 + %72 = OpLabel + OpBranch %42 + %42 = OpLabel + OpBranch %39 + %41 = OpLabel + %82 = OpAccessChain %7 %14 %9 + %83 = OpLoad %6 %82 + %84 = OpIEqual %27 %83 %15 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %86 + %85 = OpLabel + %87 = OpAccessChain %7 %14 %15 + %88 = OpLoad %6 %87 + %89 = OpIEqual %27 %88 %15 + OpBranch %86 + %86 = OpLabel + %90 = OpPhi %27 %84 %41 %89 %85 + OpSelectionMerge %92 None + OpBranchConditional %90 %91 %92 + %91 = OpLabel + %93 = OpAccessChain %7 %14 %19 + %94 = OpLoad %6 %93 + %95 = OpIEqual %27 %94 %9 + OpBranch %92 + %92 = OpLabel + %96 = OpPhi %27 %90 %86 %95 %91 + OpSelectionMerge %98 None + OpBranchConditional %96 %97 %98 + %97 = OpLabel + %100 = OpAccessChain %7 %14 %99 + %101 = OpLoad %6 %100 + %102 = OpIEqual %27 %101 %19 + OpBranch %98 + %98 = OpLabel + %103 = OpPhi %27 %96 %92 %102 %97 + OpSelectionMerge %105 None + OpBranchConditional %103 %104 %109 + %104 = OpLabel + OpStore %107 %108 + OpBranch %105 + %109 = OpLabel + OpStore %107 %110 + OpBranch %105 + %105 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# GLF_dead3tex +SAMPLER variant_GLF_dead3tex + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_GLF_dead3tex DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-if-conversion-identical-branches.amber b/vulkan/amber/graphicsfuzz/cov-if-conversion-identical-branches.amber new file mode 100644 index 0000000..94be19e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-if-conversion-identical-branches.amber @@ -0,0 +1,152 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific if condition conversion path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int zero; +# }; +# +# void main() +# { +# int a = zero; +# +# // Always true. +# if (a == 0) +# a++; +# else +# a++; +# +# // Always true. +# if (a == 1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %9 "buf0" + OpMemberName %9 0 "zero" + OpName %11 "" + OpName %34 "_GLF_color" + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 Block + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 0 + OpDecorate %34 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeStruct %6 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpConstant %6 0 + %13 = OpTypePointer Uniform %6 + %17 = OpTypeBool + %22 = OpConstant %6 1 + %31 = OpTypeFloat 32 + %32 = OpTypeVector %31 4 + %33 = OpTypePointer Output %32 + %34 = OpVariable %33 Output + %35 = OpConstant %31 1 + %36 = OpConstant %31 0 + %37 = OpConstantComposite %32 %35 %36 %36 %35 + %39 = OpConstantComposite %32 %36 %36 %36 %36 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %14 = OpAccessChain %13 %11 %12 + %15 = OpLoad %6 %14 + OpStore %8 %15 + %16 = OpLoad %6 %8 + %18 = OpIEqual %17 %16 %12 + OpSelectionMerge %20 None + OpBranchConditional %18 %19 %24 + %19 = OpLabel + %21 = OpLoad %6 %8 + %23 = OpIAdd %6 %21 %22 + OpStore %8 %23 + OpBranch %20 + %24 = OpLabel + %25 = OpLoad %6 %8 + %26 = OpIAdd %6 %25 %22 + OpStore %8 %26 + OpBranch %20 + %20 = OpLabel + %27 = OpLoad %6 %8 + %28 = OpIEqual %17 %27 %22 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %38 + %29 = OpLabel + OpStore %34 %37 + OpBranch %30 + %38 = OpLabel + OpStore %34 %39 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-if-switch-fallthrough.amber b/vulkan/amber/graphicsfuzz/cov-if-switch-fallthrough.amber new file mode 100644 index 0000000..ba0d352 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-if-switch-fallthrough.amber @@ -0,0 +1,208 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine and or xor code path + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a187dd58a0485988841d325a85c8e6063f53500a + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_float_1_0); +# +# // Always true. +# if (gl_FragCoord.y >= _float_0_0) +# { +# switch (_int_0) +# { +# case 16: +# case 0: +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +# +# // Always false. +# if (_int_0 == _int_1) +# { +# _GLF_color = vec4(_float_0_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %24 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %24 "gl_FragCoord" + OpName %36 "buf1" + OpMemberName %36 0 "_GLF_uniform_int_values" + OpName %38 "" + OpDecorate %9 Location 0 + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %24 BuiltIn FragCoord + OpDecorate %35 ArrayStride 16 + OpMemberDecorate %36 0 Offset 0 + OpDecorate %36 Block + OpDecorate %38 DescriptorSet 0 + OpDecorate %38 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpConstant %16 1 + %19 = OpTypePointer Uniform %6 + %23 = OpTypePointer Input %7 + %24 = OpVariable %23 Input + %25 = OpConstant %10 1 + %26 = OpTypePointer Input %6 + %31 = OpTypeBool + %35 = OpTypeArray %16 %11 + %36 = OpTypeStruct %35 + %37 = OpTypePointer Uniform %36 + %38 = OpVariable %37 Uniform + %39 = OpTypePointer Uniform %16 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %20 = OpAccessChain %19 %15 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpCompositeConstruct %7 %21 %21 %21 %21 + OpStore %9 %22 + %27 = OpAccessChain %26 %24 %25 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %19 %15 %17 %17 + %30 = OpLoad %6 %29 + %32 = OpFOrdGreaterThanEqual %31 %28 %30 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %34 + %33 = OpLabel + %40 = OpAccessChain %39 %38 %17 %18 + %41 = OpLoad %16 %40 + OpSelectionMerge %43 None + OpSwitch %41 %43 16 %42 0 %42 + %42 = OpLabel + %44 = OpAccessChain %39 %38 %17 %17 + %45 = OpLoad %16 %44 + %46 = OpConvertSToF %6 %45 + %49 = OpConvertSToF %6 %41 + %56 = OpCompositeConstruct %7 %46 %49 %49 %46 + OpStore %9 %56 + OpBranch %43 + %43 = OpLabel + OpBranch %34 + %34 = OpLabel + %58 = OpAccessChain %39 %38 %17 %18 + %59 = OpLoad %16 %58 + %60 = OpAccessChain %39 %38 %17 %17 + %61 = OpLoad %16 %60 + %62 = OpIEqual %31 %59 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %64 + %63 = OpLabel + %67 = OpCompositeConstruct %7 %30 %30 %30 %30 + OpStore %9 %67 + OpBranch %64 + %64 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-if-true-continue.amber b/vulkan/amber/graphicsfuzz/cov-if-true-continue.amber new file mode 100644 index 0000000..8957e0c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-if-true-continue.amber @@ -0,0 +1,240 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_10 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 10, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# int b = _int_10; +# int c = _int_1; +# +# // Loop iterates 10 times where a goes from 0 to 10 +# // during the loop, and c goes from 1 to 2 on the +# // first iteration. +# while (a < b) +# { +# a++; +# +# // True for the first iteration. +# if (c == _int_1) +# { +# c *= _int_2; +# } +# else if (true) +# { +# continue; +# } +# } +# +# // Always true. +# if (a == b && c == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 88 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %69 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %19 "b" + OpName %23 "c" + OpName %69 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %69 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %6 + %20 = OpConstant %6 1 + %24 = OpConstant %6 2 + %34 = OpTypeBool + %44 = OpConstant %6 3 + %50 = OpConstantTrue %34 + %66 = OpTypeFloat 32 + %67 = OpTypeVector %66 4 + %68 = OpTypePointer Output %67 + %69 = OpVariable %68 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %23 = OpVariable %7 Function + %17 = OpAccessChain %16 %14 %15 %15 + %18 = OpLoad %6 %17 + OpStore %8 %18 + %21 = OpAccessChain %16 %14 %15 %20 + %22 = OpLoad %6 %21 + OpStore %19 %22 + %25 = OpAccessChain %16 %14 %15 %24 + %26 = OpLoad %6 %25 + OpStore %23 %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %6 %8 + %33 = OpLoad %6 %19 + %35 = OpSLessThan %34 %32 %33 + OpBranchConditional %35 %28 %29 + %28 = OpLabel + %36 = OpLoad %6 %8 + %37 = OpIAdd %6 %36 %20 + OpStore %8 %37 + %38 = OpLoad %6 %23 + %39 = OpAccessChain %16 %14 %15 %24 + %40 = OpLoad %6 %39 + %41 = OpIEqual %34 %38 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %49 + %42 = OpLabel + %45 = OpAccessChain %16 %14 %15 %44 + %46 = OpLoad %6 %45 + %47 = OpLoad %6 %23 + %48 = OpIMul %6 %47 %46 + OpStore %23 %48 + OpBranch %43 + %49 = OpLabel + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %52 + %51 = OpLabel + OpBranch %30 + %52 = OpLabel + OpBranch %43 + %43 = OpLabel + OpBranch %30 + %30 = OpLabel + OpBranch %27 + %29 = OpLabel + %54 = OpLoad %6 %8 + %55 = OpLoad %6 %19 + %56 = OpIEqual %34 %54 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + %59 = OpLoad %6 %23 + %60 = OpAccessChain %16 %14 %15 %44 + %61 = OpLoad %6 %60 + %62 = OpIEqual %34 %59 %61 + OpBranch %58 + %58 = OpLabel + %63 = OpPhi %34 %56 %29 %62 %57 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %83 + %64 = OpLabel + %70 = OpAccessChain %16 %14 %15 %24 + %71 = OpLoad %6 %70 + %72 = OpConvertSToF %66 %71 + %73 = OpAccessChain %16 %14 %15 %15 + %74 = OpLoad %6 %73 + %75 = OpConvertSToF %66 %74 + %76 = OpAccessChain %16 %14 %15 %15 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %66 %77 + %79 = OpAccessChain %16 %14 %15 %24 + %80 = OpLoad %6 %79 + %81 = OpConvertSToF %66 %80 + %82 = OpCompositeConstruct %67 %72 %75 %78 %81 + OpStore %69 %82 + OpBranch %65 + %83 = OpLabel + %84 = OpAccessChain %16 %14 %15 %15 + %85 = OpLoad %6 %84 + %86 = OpConvertSToF %66 %85 + %87 = OpCompositeConstruct %67 %86 %86 %86 %86 + OpStore %69 %87 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 10 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached.amber b/vulkan/amber/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached.amber new file mode 100644 index 0000000..342026c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached.amber @@ -0,0 +1,202 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 1; +# +# do +# { +# // Always true. +# if(a >= _int_0) +# { +# break; +# } +# +# // Never executed as the break above is always hit. +# if (true) +# { +# discard; +# } +# +# a++; +# } +# while(a != 1); +# +# // Always true. +# if(a == 1) +# { +# _GLF_color = vec4(1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %45 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %18 "buf0" + OpMemberName %18 0 "_GLF_uniform_int_values" + OpName %20 "" + OpName %45 "_GLF_color" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %45 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 2 + %17 = OpTypeArray %6 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpConstant %6 0 + %22 = OpTypePointer Uniform %6 + %25 = OpTypeBool + %30 = OpConstantTrue %25 + %42 = OpTypeFloat 32 + %43 = OpTypeVector %42 4 + %44 = OpTypePointer Output %43 + %45 = OpVariable %44 Output + %46 = OpConstant %42 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %11 + %11 = OpLabel + %14 = OpLoad %6 %8 + %23 = OpAccessChain %22 %20 %21 %21 + %24 = OpLoad %6 %23 + %26 = OpSGreaterThanEqual %25 %14 %24 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + OpBranch %12 + %28 = OpLabel + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + OpTerminateInvocation + %32 = OpLabel + %34 = OpLoad %6 %8 + %35 = OpIAdd %6 %34 %9 + OpStore %8 %35 + OpBranch %13 + %13 = OpLabel + %36 = OpLoad %6 %8 + %37 = OpINotEqual %25 %36 %9 + OpBranchConditional %37 %10 %12 + %12 = OpLabel + %38 = OpLoad %6 %8 + %39 = OpIEqual %25 %38 %9 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %57 + %40 = OpLabel + %47 = OpAccessChain %22 %20 %21 %21 + %48 = OpLoad %6 %47 + %49 = OpConvertSToF %42 %48 + %50 = OpAccessChain %22 %20 %21 %21 + %51 = OpLoad %6 %50 + %52 = OpConvertSToF %42 %51 + %53 = OpAccessChain %22 %20 %21 %9 + %54 = OpLoad %6 %53 + %55 = OpConvertSToF %42 %54 + %56 = OpCompositeConstruct %43 %46 %49 %52 %55 + OpStore %45 %56 + OpBranch %41 + %57 = OpLabel + %58 = OpAccessChain %22 %20 %21 %21 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %42 %59 + %61 = OpCompositeConstruct %43 %60 %60 %60 %60 + OpStore %45 %61 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-if-true-float-bits-to-int-one.amber b/vulkan/amber/graphicsfuzz/cov-if-true-float-bits-to-int-one.amber new file mode 100644 index 0000000..5181c4f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-if-true-float-bits-to-int-one.amber @@ -0,0 +1,115 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp int; +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# if(true) +# { +# } +# +# if(0x3f800000 == floatBitsToInt(1.0)) +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# else +# { +# _GLF_color = vec4(0); +# } +# +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 25 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %20 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %20 "_GLF_color" + OpDecorate %20 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeBool + %7 = OpConstantTrue %6 + %10 = OpTypeInt 32 1 + %11 = OpConstant %10 1065353216 + %12 = OpTypeFloat 32 + %13 = OpConstant %12 1 + %18 = OpTypeVector %12 4 + %19 = OpTypePointer Output %18 + %20 = OpVariable %19 Output + %21 = OpConstant %12 0 + %22 = OpConstantComposite %18 %13 %21 %21 %13 + %24 = OpConstantComposite %18 %21 %21 %21 %21 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %9 None + OpBranchConditional %7 %8 %9 + %8 = OpLabel + OpBranch %9 + %9 = OpLabel + %14 = OpBitcast %10 %13 + %15 = OpIEqual %6 %11 %14 + OpSelectionMerge %17 None + OpBranchConditional %15 %16 %23 + %16 = OpLabel + OpStore %20 %22 + OpBranch %17 + %23 = OpLabel + OpStore %20 %24 + OpBranch %17 + %17 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inc-array-element-loop-lsb.amber b/vulkan/amber/graphicsfuzz/cov-inc-array-element-loop-lsb.amber new file mode 100644 index 0000000..23ea1d4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inc-array-element-loop-lsb.amber @@ -0,0 +1,286 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific SSCP path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_50 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_49 _GLF_uniform_int_values[3] +# #define _float_2_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [2.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [50, 0, 1, 49] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float A[50]; +# int i = _int_0; +# +# // Initializes all A elements to 1.0 and leaves i at 49. +# for( i = _int_0; i < _int_50; i ++) +# A[i] = _float_1_0; +# +# // a becomes -1. +# int a = findLSB(0); +# +# // Loops once. +# do +# { +# i ++; +# A[clamp(a, _int_0, _int_49)] += _float_1_0; +# } +# while(a < _int_1 && i < _int_50); +# +# // Always true. +# if(A[_int_0] == _float_2_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# return; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 114 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %94 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %36 "A" + OpName %40 "buf0" + OpMemberName %40 0 "_GLF_uniform_float_values" + OpName %42 "" + OpName %50 "a" + OpName %94 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %39 ArrayStride 16 + OpMemberDecorate %40 0 Offset 0 + OpDecorate %40 Block + OpDecorate %42 DescriptorSet 0 + OpDecorate %42 Binding 0 + OpDecorate %51 RelaxedPrecision + OpDecorate %94 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %30 = OpTypeBool + %32 = OpTypeFloat 32 + %33 = OpConstant %9 50 + %34 = OpTypeArray %32 %33 + %35 = OpTypePointer Function %34 + %38 = OpConstant %9 2 + %39 = OpTypeArray %32 %38 + %40 = OpTypeStruct %39 + %41 = OpTypePointer Uniform %40 + %42 = OpVariable %41 Uniform + %43 = OpTypePointer Uniform %32 + %46 = OpTypePointer Function %32 + %61 = OpConstant %6 3 + %72 = OpConstant %6 2 + %92 = OpTypeVector %32 4 + %93 = OpTypePointer Output %92 + %94 = OpVariable %93 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %36 = OpVariable %35 Function + %50 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %20 = OpAccessChain %17 %14 %15 %16 + %21 = OpLoad %6 %20 + OpStore %8 %21 + OpBranch %22 + %22 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %27 = OpLoad %6 %8 + %28 = OpAccessChain %17 %14 %15 %15 + %29 = OpLoad %6 %28 + %31 = OpSLessThan %30 %27 %29 + OpBranchConditional %31 %23 %24 + %23 = OpLabel + %37 = OpLoad %6 %8 + %44 = OpAccessChain %43 %42 %15 %16 + %45 = OpLoad %32 %44 + %47 = OpAccessChain %46 %36 %37 + OpStore %47 %45 + OpBranch %25 + %25 = OpLabel + %48 = OpLoad %6 %8 + %49 = OpIAdd %6 %48 %16 + OpStore %8 %49 + OpBranch %22 + %24 = OpLabel + %51 = OpExtInst %6 %1 FindILsb %15 + OpStore %50 %51 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %53 + %53 = OpLabel + %56 = OpLoad %6 %8 + %57 = OpIAdd %6 %56 %16 + OpStore %8 %57 + %58 = OpLoad %6 %50 + %59 = OpAccessChain %17 %14 %15 %16 + %60 = OpLoad %6 %59 + %62 = OpAccessChain %17 %14 %15 %61 + %63 = OpLoad %6 %62 + %64 = OpExtInst %6 %1 SClamp %58 %60 %63 + %65 = OpAccessChain %43 %42 %15 %16 + %66 = OpLoad %32 %65 + %67 = OpAccessChain %46 %36 %64 + %68 = OpLoad %32 %67 + %69 = OpFAdd %32 %68 %66 + %70 = OpAccessChain %46 %36 %64 + OpStore %70 %69 + OpBranch %55 + %55 = OpLabel + %71 = OpLoad %6 %50 + %73 = OpAccessChain %17 %14 %15 %72 + %74 = OpLoad %6 %73 + %75 = OpSLessThan %30 %71 %74 + OpSelectionMerge %77 None + OpBranchConditional %75 %76 %77 + %76 = OpLabel + %78 = OpLoad %6 %8 + %79 = OpAccessChain %17 %14 %15 %15 + %80 = OpLoad %6 %79 + %81 = OpSLessThan %30 %78 %80 + OpBranch %77 + %77 = OpLabel + %82 = OpPhi %30 %75 %55 %81 %76 + OpBranchConditional %82 %52 %54 + %54 = OpLabel + %83 = OpAccessChain %17 %14 %15 %16 + %84 = OpLoad %6 %83 + %85 = OpAccessChain %46 %36 %84 + %86 = OpLoad %32 %85 + %87 = OpAccessChain %43 %42 %15 %15 + %88 = OpLoad %32 %87 + %89 = OpFOrdEqual %30 %86 %88 + OpSelectionMerge %91 None + OpBranchConditional %89 %90 %108 + %90 = OpLabel + %95 = OpAccessChain %17 %14 %15 %72 + %96 = OpLoad %6 %95 + %97 = OpConvertSToF %32 %96 + %98 = OpAccessChain %17 %14 %15 %16 + %99 = OpLoad %6 %98 + %100 = OpConvertSToF %32 %99 + %101 = OpAccessChain %17 %14 %15 %16 + %102 = OpLoad %6 %101 + %103 = OpConvertSToF %32 %102 + %104 = OpAccessChain %17 %14 %15 %72 + %105 = OpLoad %6 %104 + %106 = OpConvertSToF %32 %105 + %107 = OpCompositeConstruct %92 %97 %100 %103 %106 + OpStore %94 %107 + OpBranch %91 + %108 = OpLabel + %109 = OpAccessChain %17 %14 %15 %16 + %110 = OpLoad %6 %109 + %111 = OpConvertSToF %32 %110 + %112 = OpCompositeConstruct %92 %111 %111 %111 %111 + OpStore %94 %112 + OpReturn + %91 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 50 0 1 49 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inc-inside-switch-and-for.amber b/vulkan/amber/graphicsfuzz/cov-inc-inside-switch-and-for.amber new file mode 100644 index 0000000..96b87a0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inc-inside-switch-and-for.amber @@ -0,0 +1,172 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific LLVM analysis code path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int three; +# }; +# +# void main() +# { +# int a = 0; +# for(int i = 0; i < 7 + three; i++) +# { +# switch(i) +# { +# case 7: +# case 8: +# a++; +# break; +# } +# } +# +# if (a == 2) // Always true. +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %45 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %10 "i" + OpName %18 "buf0" + OpMemberName %18 0 "three" + OpName %20 "" + OpName %45 "_GLF_color" + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %45 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpConstant %6 7 + %18 = OpTypeStruct %6 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypePointer Uniform %6 + %25 = OpTypeBool + %31 = OpConstant %6 1 + %38 = OpConstant %6 2 + %42 = OpTypeFloat 32 + %43 = OpTypeVector %42 4 + %44 = OpTypePointer Output %43 + %45 = OpVariable %44 Output + %46 = OpConstant %42 1 + %47 = OpConstant %42 0 + %48 = OpConstantComposite %43 %46 %47 %47 %46 + %50 = OpConstantComposite %43 %47 %47 %47 %47 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %16 = OpLoad %6 %10 + %22 = OpAccessChain %21 %20 %9 + %23 = OpLoad %6 %22 + %24 = OpIAdd %6 %17 %23 + %26 = OpSLessThan %25 %16 %24 + OpBranchConditional %26 %12 %13 + %12 = OpLabel + %27 = OpLoad %6 %10 + OpSelectionMerge %29 None + OpSwitch %27 %29 7 %28 8 %28 + %28 = OpLabel + %30 = OpLoad %6 %8 + %32 = OpIAdd %6 %30 %31 + OpStore %8 %32 + OpBranch %29 + %29 = OpLabel + OpBranch %14 + %14 = OpLabel + %35 = OpLoad %6 %10 + %36 = OpIAdd %6 %35 %31 + OpStore %10 %36 + OpBranch %11 + %13 = OpLabel + %37 = OpLoad %6 %8 + %39 = OpIEqual %25 %37 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %49 + %40 = OpLabel + OpStore %45 %48 + OpBranch %41 + %49 = OpLabel + OpStore %45 %50 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# three +BUFFER variant_three DATA_TYPE int32 DATA + 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_three AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-increment-array-element-in-loop.amber b/vulkan/amber/graphicsfuzz/cov-increment-array-element-in-loop.amber new file mode 100644 index 0000000..4ce411d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-increment-array-element-in-loop.amber @@ -0,0 +1,252 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_2_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [2, 0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 2.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float arr[3] = float[3](_float_0_0, _float_1_0, _float_2_0); +# int a = 0; +# +# // Iterated once. +# while(a <= _int_0) +# { +# arr[a++] = _float_1_0; +# } +# +# // Always true. +# if(arr[_int_0] == _float_1_0 && arr[_int_1] == _float_1_0 && arr[_int_2] == _float_2_0) +# { +# _GLF_color = vec4(arr[_int_0], _float_0_0, _float_0_0, _float_1_0); +# } +# else +# { +# _GLF_color = vec4(_float_0_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 98 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %82 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %13 "buf1" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %29 "a" + OpName %37 "buf0" + OpMemberName %37 0 "_GLF_uniform_int_values" + OpName %39 "" + OpName %82 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 0 + OpDecorate %82 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 3 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpTypeArray %6 %8 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpConstant %16 1 + %19 = OpTypePointer Uniform %6 + %24 = OpConstant %16 2 + %28 = OpTypePointer Function %16 + %36 = OpTypeArray %16 %8 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %16 + %43 = OpTypeBool + %49 = OpTypePointer Function %6 + %80 = OpTypeVector %6 4 + %81 = OpTypePointer Output %80 + %82 = OpVariable %81 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %29 = OpVariable %28 Function + %20 = OpAccessChain %19 %15 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %15 %17 %17 + %23 = OpLoad %6 %22 + %25 = OpAccessChain %19 %15 %17 %24 + %26 = OpLoad %6 %25 + %27 = OpCompositeConstruct %9 %21 %23 %26 + OpStore %11 %27 + OpStore %29 %17 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %16 %29 + %41 = OpAccessChain %40 %39 %17 %18 + %42 = OpLoad %16 %41 + %44 = OpSLessThanEqual %43 %35 %42 + OpBranchConditional %44 %31 %32 + %31 = OpLabel + %45 = OpLoad %16 %29 + %46 = OpIAdd %16 %45 %18 + OpStore %29 %46 + %47 = OpAccessChain %19 %15 %17 %17 + %48 = OpLoad %6 %47 + %50 = OpAccessChain %49 %11 %45 + OpStore %50 %48 + OpBranch %33 + %33 = OpLabel + OpBranch %30 + %32 = OpLabel + %51 = OpAccessChain %40 %39 %17 %18 + %52 = OpLoad %16 %51 + %53 = OpAccessChain %49 %11 %52 + %54 = OpLoad %6 %53 + %55 = OpAccessChain %19 %15 %17 %17 + %56 = OpLoad %6 %55 + %57 = OpFOrdEqual %43 %54 %56 + OpSelectionMerge %59 None + OpBranchConditional %57 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %40 %39 %17 %24 + %61 = OpLoad %16 %60 + %62 = OpAccessChain %49 %11 %61 + %63 = OpLoad %6 %62 + %64 = OpAccessChain %19 %15 %17 %17 + %65 = OpLoad %6 %64 + %66 = OpFOrdEqual %43 %63 %65 + OpBranch %59 + %59 = OpLabel + %67 = OpPhi %43 %57 %32 %66 %58 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %69 + %68 = OpLabel + %70 = OpAccessChain %40 %39 %17 %17 + %71 = OpLoad %16 %70 + %72 = OpAccessChain %49 %11 %71 + %73 = OpLoad %6 %72 + %74 = OpAccessChain %19 %15 %17 %24 + %75 = OpLoad %6 %74 + %76 = OpFOrdEqual %43 %73 %75 + OpBranch %69 + %69 = OpLabel + %77 = OpPhi %43 %67 %59 %76 %68 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %94 + %78 = OpLabel + %83 = OpAccessChain %40 %39 %17 %18 + %84 = OpLoad %16 %83 + %85 = OpAccessChain %49 %11 %84 + %86 = OpLoad %6 %85 + %87 = OpAccessChain %19 %15 %17 %18 + %88 = OpLoad %6 %87 + %89 = OpAccessChain %19 %15 %17 %18 + %90 = OpLoad %6 %89 + %91 = OpAccessChain %19 %15 %17 %17 + %92 = OpLoad %6 %91 + %93 = OpCompositeConstruct %80 %86 %88 %90 %92 + OpStore %82 %93 + OpBranch %79 + %94 = OpLabel + %95 = OpAccessChain %19 %15 %17 %18 + %96 = OpLoad %6 %95 + %97 = OpCompositeConstruct %80 %96 %96 %96 %96 + OpStore %82 %97 + OpBranch %79 + %79 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 2.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-increment-array-element-usub-borrow.amber b/vulkan/amber/graphicsfuzz/cov-increment-array-element-usub-borrow.amber new file mode 100644 index 0000000..e0ff384 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-increment-array-element-usub-borrow.amber @@ -0,0 +1,299 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _uint_1 _GLF_uniform_uint_values[0] +# #define _uint_0 _GLF_uniform_uint_values[1] +# #define _float_8_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_2_0 _GLF_uniform_float_values[2] +# #define _float_3_0 _GLF_uniform_float_values[3] +# #define _float_4_0 _GLF_uniform_float_values[4] +# #define _float_5_0 _GLF_uniform_float_values[5] +# #define _float_6_0 _GLF_uniform_float_values[6] +# #define _float_7_0 _GLF_uniform_float_values[7] +# #define _float_9_0 _GLF_uniform_float_values[8] +# #define _float_10_0 _GLF_uniform_float_values[9] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [8.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 9.0, 10.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[10]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_uint_values: [1, 0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# uint _GLF_uniform_uint_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# uint a = _uint_1; +# int b = _int_1; +# float arr[5] = float[5](_float_1_0, _float_2_0, _float_3_0, _float_4_0, _float_5_0); +# // arr[1] += 6. +# arr[b] += float[5](_float_6_0, _float_7_0, _float_8_0, _float_9_0, _float_10_0)[usubBorrow(1u, 1u, a)]; +# +# // Always true. +# if(arr[_int_1] == _float_8_0 && a == _uint_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 122 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %103 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %11 "buf2" + OpMemberName %11 0 "_GLF_uniform_uint_values" + OpName %13 "" + OpName %20 "b" + OpName %22 "buf1" + OpMemberName %22 0 "_GLF_uniform_int_values" + OpName %24 "" + OpName %32 "arr" + OpName %35 "buf0" + OpMemberName %35 0 "_GLF_uniform_float_values" + OpName %37 "" + OpName %72 "ResType" + OpName %76 "indexable" + OpName %103 "_GLF_color" + OpDecorate %10 ArrayStride 16 + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 2 + OpDecorate %21 ArrayStride 16 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 1 + OpDecorate %34 ArrayStride 16 + OpMemberDecorate %35 0 Offset 0 + OpDecorate %35 Block + OpDecorate %37 DescriptorSet 0 + OpDecorate %37 Binding 0 + OpDecorate %103 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 2 + %10 = OpTypeArray %6 %9 + %11 = OpTypeStruct %10 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypePointer Uniform %6 + %19 = OpTypePointer Function %14 + %21 = OpTypeArray %14 %9 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpTypePointer Uniform %14 + %28 = OpTypeFloat 32 + %29 = OpConstant %6 5 + %30 = OpTypeArray %28 %29 + %31 = OpTypePointer Function %30 + %33 = OpConstant %6 10 + %34 = OpTypeArray %28 %33 + %35 = OpTypeStruct %34 + %36 = OpTypePointer Uniform %35 + %37 = OpVariable %36 Uniform + %38 = OpConstant %14 1 + %39 = OpTypePointer Uniform %28 + %42 = OpConstant %14 2 + %45 = OpConstant %14 3 + %48 = OpConstant %14 4 + %51 = OpConstant %14 5 + %56 = OpConstant %14 6 + %59 = OpConstant %14 7 + %64 = OpConstant %14 8 + %67 = OpConstant %14 9 + %71 = OpConstant %6 1 + %72 = OpTypeStruct %6 %6 + %77 = OpTypePointer Function %28 + %84 = OpTypeBool + %101 = OpTypeVector %28 4 + %102 = OpTypePointer Output %101 + %103 = OpVariable %102 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %19 Function + %32 = OpVariable %31 Function + %76 = OpVariable %31 Function + %17 = OpAccessChain %16 %13 %15 %15 + %18 = OpLoad %6 %17 + OpStore %8 %18 + %26 = OpAccessChain %25 %24 %15 %15 + %27 = OpLoad %14 %26 + OpStore %20 %27 + %40 = OpAccessChain %39 %37 %15 %38 + %41 = OpLoad %28 %40 + %43 = OpAccessChain %39 %37 %15 %42 + %44 = OpLoad %28 %43 + %46 = OpAccessChain %39 %37 %15 %45 + %47 = OpLoad %28 %46 + %49 = OpAccessChain %39 %37 %15 %48 + %50 = OpLoad %28 %49 + %52 = OpAccessChain %39 %37 %15 %51 + %53 = OpLoad %28 %52 + %54 = OpCompositeConstruct %30 %41 %44 %47 %50 %53 + OpStore %32 %54 + %55 = OpLoad %14 %20 + %57 = OpAccessChain %39 %37 %15 %56 + %58 = OpLoad %28 %57 + %60 = OpAccessChain %39 %37 %15 %59 + %61 = OpLoad %28 %60 + %62 = OpAccessChain %39 %37 %15 %15 + %63 = OpLoad %28 %62 + %65 = OpAccessChain %39 %37 %15 %64 + %66 = OpLoad %28 %65 + %68 = OpAccessChain %39 %37 %15 %67 + %69 = OpLoad %28 %68 + %70 = OpCompositeConstruct %30 %58 %61 %63 %66 %69 + %73 = OpISubBorrow %72 %71 %71 + %74 = OpCompositeExtract %6 %73 1 + OpStore %8 %74 + %75 = OpCompositeExtract %6 %73 0 + OpStore %76 %70 + %78 = OpAccessChain %77 %76 %75 + %79 = OpLoad %28 %78 + %80 = OpAccessChain %77 %32 %55 + %81 = OpLoad %28 %80 + %82 = OpFAdd %28 %81 %79 + %83 = OpAccessChain %77 %32 %55 + OpStore %83 %82 + %85 = OpAccessChain %25 %24 %15 %15 + %86 = OpLoad %14 %85 + %87 = OpAccessChain %77 %32 %86 + %88 = OpLoad %28 %87 + %89 = OpAccessChain %39 %37 %15 %15 + %90 = OpLoad %28 %89 + %91 = OpFOrdEqual %84 %88 %90 + OpSelectionMerge %93 None + OpBranchConditional %91 %92 %93 + %92 = OpLabel + %94 = OpLoad %6 %8 + %95 = OpAccessChain %16 %13 %15 %38 + %96 = OpLoad %6 %95 + %97 = OpIEqual %84 %94 %96 + OpBranch %93 + %93 = OpLabel + %98 = OpPhi %84 %91 %5 %97 %92 + OpSelectionMerge %100 None + OpBranchConditional %98 %99 %117 + %99 = OpLabel + %104 = OpAccessChain %25 %24 %15 %15 + %105 = OpLoad %14 %104 + %106 = OpConvertSToF %28 %105 + %107 = OpAccessChain %25 %24 %15 %38 + %108 = OpLoad %14 %107 + %109 = OpConvertSToF %28 %108 + %110 = OpAccessChain %25 %24 %15 %38 + %111 = OpLoad %14 %110 + %112 = OpConvertSToF %28 %111 + %113 = OpAccessChain %25 %24 %15 %15 + %114 = OpLoad %14 %113 + %115 = OpConvertSToF %28 %114 + %116 = OpCompositeConstruct %101 %106 %109 %112 %115 + OpStore %103 %116 + OpBranch %100 + %117 = OpLabel + %118 = OpAccessChain %25 %24 %15 %38 + %119 = OpLoad %14 %118 + %120 = OpConvertSToF %28 %119 + %121 = OpCompositeConstruct %101 %120 %120 %120 %120 + OpStore %103 %121 + OpBranch %100 + %100 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_uint_values +BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 8.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 9.0 10.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-increment-float-in-loop-abs.amber b/vulkan/amber/graphicsfuzz/cov-increment-float-in-loop-abs.amber new file mode 100644 index 0000000..e3166cf --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-increment-float-in-loop-abs.amber @@ -0,0 +1,239 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_33 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_23_0 _GLF_uniform_float_values[1] +# #define _float_24_0 _GLF_uniform_float_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [1.0, 23.0, 24.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# // Contents of _GLF_uniform_int_values: [33, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f0 = _float_1_0; +# float f1 = _float_1_0; +# +# for (int i = _int_0; i < _int_33; i++) +# { +# f0 = abs(1.1 * f0); +# f1 = f0; +# } +# +# // Always true. +# if (f1 > _float_23_0 && f1 < _float_24_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %66 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f0" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %20 "f1" + OpName %24 "i" + OpName %26 "buf1" + OpMemberName %26 0 "_GLF_uniform_int_values" + OpName %28 "" + OpName %66 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %25 ArrayStride 16 + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 1 + OpDecorate %66 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %23 = OpTypePointer Function %15 + %25 = OpTypeArray %15 %10 + %26 = OpTypeStruct %25 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpConstant %15 1 + %30 = OpTypePointer Uniform %15 + %41 = OpTypeBool + %43 = OpConstant %6 1.10000002 + %57 = OpConstant %15 2 + %64 = OpTypeVector %6 4 + %65 = OpTypePointer Output %64 + %66 = OpVariable %65 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %24 = OpVariable %23 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %21 = OpAccessChain %17 %14 %16 %16 + %22 = OpLoad %6 %21 + OpStore %20 %22 + %31 = OpAccessChain %30 %28 %16 %29 + %32 = OpLoad %15 %31 + OpStore %24 %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %15 %24 + %39 = OpAccessChain %30 %28 %16 %16 + %40 = OpLoad %15 %39 + %42 = OpSLessThan %41 %38 %40 + OpBranchConditional %42 %34 %35 + %34 = OpLabel + %44 = OpLoad %6 %8 + %45 = OpFMul %6 %43 %44 + %46 = OpExtInst %6 %1 FAbs %45 + OpStore %8 %46 + %47 = OpLoad %6 %8 + OpStore %20 %47 + OpBranch %36 + %36 = OpLabel + %48 = OpLoad %15 %24 + %49 = OpIAdd %15 %48 %29 + OpStore %24 %49 + OpBranch %33 + %35 = OpLabel + %50 = OpLoad %6 %20 + %51 = OpAccessChain %17 %14 %16 %29 + %52 = OpLoad %6 %51 + %53 = OpFOrdGreaterThan %41 %50 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %55 + %54 = OpLabel + %56 = OpLoad %6 %20 + %58 = OpAccessChain %17 %14 %16 %57 + %59 = OpLoad %6 %58 + %60 = OpFOrdLessThan %41 %56 %59 + OpBranch %55 + %55 = OpLabel + %61 = OpPhi %41 %53 %35 %60 %54 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %80 + %62 = OpLabel + %67 = OpAccessChain %30 %28 %16 %57 + %68 = OpLoad %15 %67 + %69 = OpConvertSToF %6 %68 + %70 = OpAccessChain %30 %28 %16 %29 + %71 = OpLoad %15 %70 + %72 = OpConvertSToF %6 %71 + %73 = OpAccessChain %30 %28 %16 %29 + %74 = OpLoad %15 %73 + %75 = OpConvertSToF %6 %74 + %76 = OpAccessChain %30 %28 %16 %57 + %77 = OpLoad %15 %76 + %78 = OpConvertSToF %6 %77 + %79 = OpCompositeConstruct %64 %69 %72 %75 %78 + OpStore %66 %79 + OpBranch %63 + %80 = OpLabel + %81 = OpAccessChain %30 %28 %16 %29 + %82 = OpLoad %15 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpCompositeConstruct %64 %83 %83 %83 %83 + OpStore %66 %84 + OpBranch %63 + %63 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 33 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 23.0 24.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-increment-global-counter-loop-function.amber b/vulkan/amber/graphicsfuzz/cov-increment-global-counter-loop-function.amber new file mode 100644 index 0000000..4a4e44e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-increment-global-counter-loop-function.amber @@ -0,0 +1,258 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-local-single-block' +# '--eliminate-local-single-store' +# '--eliminate-local-multi-store' +# '--eliminate-dead-branches' +# '--scalar-replacement=100' +# '--eliminate-local-multi-store' +# '--inline-entry-points-exhaustive' +# '--copy-propagate-arrays' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-code-aggressive' +# '--redundancy-elimination' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--merge-blocks' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_12 _GLF_uniform_int_values[2] +# #define _int_5 _GLF_uniform_int_values[3] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 12, 5] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# void func() +# { +# int a = _int_1; +# +# for(int i = _int_0; i < _int_5; i ++) +# { +# _GLF_global_loop_count ++; +# } +# +# if(a < _int_1) +# { +# return; +# } +# } +# +# void main() +# { +# // _GLF_global_loop_count = 0, 1, 6, 7, 12 +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# func(); +# } +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# // Never executed. +# _GLF_global_loop_count ++; +# } +# +# // Always true. +# if(_GLF_global_loop_count == _int_12) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 99 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %79 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %6 "func(" + OpName %10 "_GLF_global_loop_count" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %79 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %79 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Private %8 + %10 = OpVariable %9 Private + %11 = OpConstant %8 0 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 4 + %16 = OpTypeArray %8 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %8 1 + %21 = OpTypePointer Uniform %8 + %33 = OpConstant %8 3 + %36 = OpTypeBool + %55 = OpConstant %8 10 + %70 = OpConstant %8 2 + %76 = OpTypeFloat 32 + %77 = OpTypeVector %76 4 + %78 = OpTypePointer Output %77 + %79 = OpVariable %78 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %10 %11 + OpBranch %49 + %49 = OpLabel + %54 = OpLoad %8 %10 + %56 = OpSLessThan %36 %54 %55 + OpLoopMerge %51 %50 None + OpBranchConditional %56 %50 %51 + %50 = OpLabel + %57 = OpLoad %8 %10 + %58 = OpIAdd %8 %57 %20 + OpStore %10 %58 + %59 = OpFunctionCall %2 %6 + OpBranch %49 + %51 = OpLabel + OpBranch %60 + %60 = OpLabel + %65 = OpLoad %8 %10 + %66 = OpSLessThan %36 %65 %55 + OpLoopMerge %62 %61 None + OpBranchConditional %66 %61 %62 + %61 = OpLabel + %67 = OpLoad %8 %10 + %68 = OpIAdd %8 %67 %20 + OpStore %10 %68 + OpBranch %60 + %62 = OpLabel + %69 = OpLoad %8 %10 + %71 = OpAccessChain %21 %19 %11 %70 + %72 = OpLoad %8 %71 + %73 = OpIEqual %36 %69 %72 + OpSelectionMerge %75 None + OpBranchConditional %73 %74 %93 + %74 = OpLabel + %80 = OpAccessChain %21 %19 %11 %20 + %81 = OpLoad %8 %80 + %82 = OpConvertSToF %76 %81 + %83 = OpAccessChain %21 %19 %11 %11 + %84 = OpLoad %8 %83 + %85 = OpConvertSToF %76 %84 + %92 = OpCompositeConstruct %77 %82 %85 %85 %82 + OpStore %79 %92 + OpBranch %75 + %93 = OpLabel + %94 = OpAccessChain %21 %19 %11 %11 + %95 = OpLoad %8 %94 + %96 = OpConvertSToF %76 %95 + %97 = OpCompositeConstruct %77 %96 %96 %96 %96 + OpStore %79 %97 + OpBranch %75 + %75 = OpLabel + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %22 = OpAccessChain %21 %19 %11 %20 + %23 = OpLoad %8 %22 + %25 = OpAccessChain %21 %19 %11 %11 + %26 = OpLoad %8 %25 + OpBranch %27 + %27 = OpLabel + %98 = OpPhi %8 %26 %7 %41 %28 + %34 = OpAccessChain %21 %19 %11 %33 + %35 = OpLoad %8 %34 + %37 = OpSLessThan %36 %98 %35 + OpLoopMerge %29 %28 None + OpBranchConditional %37 %28 %29 + %28 = OpLabel + %38 = OpLoad %8 %10 + %39 = OpIAdd %8 %38 %20 + OpStore %10 %39 + %41 = OpIAdd %8 %98 %20 + OpBranch %27 + %29 = OpLabel + %45 = OpSLessThan %36 %23 %23 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + OpReturn + %47 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 12 5 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-increment-inside-clamp.amber b/vulkan/amber/graphicsfuzz/cov-increment-inside-clamp.amber new file mode 100644 index 0000000..a17aab4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-increment-inside-clamp.amber @@ -0,0 +1,188 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers specific value tracking and simplification paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# void main() +# { +# int a[3]; +# a[0] = 1; +# a[1] = 2; +# a[2] = 3; +# +# int b = 0; +# int c = a[one]; +# +# // Always true. +# if(c > 1) +# { +# // This will be overwritten later. +# _GLF_color = vec4(0, 1, 1, 0); +# ++b; +# } +# +# // Increments a[2] to 4. +# a[clamp(++b, 0, 2)]++; +# +# if (a[2] == 4) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %38 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "a" + OpName %20 "b" + OpName %21 "c" + OpName %22 "buf0" + OpMemberName %22 0 "one" + OpName %24 "" + OpName %38 "_GLF_color" + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %38 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 3 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %6 0 + %13 = OpConstant %6 1 + %14 = OpTypePointer Function %6 + %16 = OpConstant %6 2 + %18 = OpConstant %6 3 + %22 = OpTypeStruct %6 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpTypePointer Uniform %6 + %31 = OpTypeBool + %35 = OpTypeFloat 32 + %36 = OpTypeVector %35 4 + %37 = OpTypePointer Output %36 + %38 = OpVariable %37 Output + %39 = OpConstant %35 0 + %40 = OpConstant %35 1 + %41 = OpConstantComposite %36 %39 %40 %40 %39 + %52 = OpConstant %6 4 + %56 = OpConstantComposite %36 %40 %39 %39 %40 + %58 = OpConstantComposite %36 %39 %39 %39 %39 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %20 = OpVariable %14 Function + %21 = OpVariable %14 Function + %15 = OpAccessChain %14 %11 %12 + OpStore %15 %13 + %17 = OpAccessChain %14 %11 %13 + OpStore %17 %16 + %19 = OpAccessChain %14 %11 %16 + OpStore %19 %18 + OpStore %20 %12 + %26 = OpAccessChain %25 %24 %12 + %27 = OpLoad %6 %26 + %28 = OpAccessChain %14 %11 %27 + %29 = OpLoad %6 %28 + OpStore %21 %29 + %30 = OpLoad %6 %21 + %32 = OpSGreaterThan %31 %30 %13 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %34 + %33 = OpLabel + OpStore %38 %41 + %42 = OpLoad %6 %20 + %43 = OpIAdd %6 %42 %13 + OpStore %20 %43 + OpBranch %34 + %34 = OpLabel + %44 = OpLoad %6 %20 + %45 = OpIAdd %6 %44 %13 + OpStore %20 %45 + %46 = OpExtInst %6 %1 SClamp %45 %12 %16 + %47 = OpAccessChain %14 %11 %46 + %48 = OpLoad %6 %47 + %49 = OpIAdd %6 %48 %13 + OpStore %47 %49 + %50 = OpAccessChain %14 %11 %16 + %51 = OpLoad %6 %50 + %53 = OpIEqual %31 %51 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %57 + %54 = OpLabel + OpStore %38 %56 + OpBranch %55 + %57 = OpLabel + OpStore %38 %58 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-increment-int-loop-counter-mod-array.amber b/vulkan/amber/graphicsfuzz/cov-increment-int-loop-counter-mod-array.amber new file mode 100644 index 0000000..ed24ce0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-increment-int-loop-counter-mod-array.amber @@ -0,0 +1,214 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_33 _GLF_uniform_int_values[0] +# #define _int_157 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# #define _int_9 _GLF_uniform_int_values[4] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [33, 157, 1, 0, 9] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1; +# +# for(int i = _int_0; i < _int_33; i++) +# { +# a += int[9](1, 2, 3, 4, 5, 6, 7, 8, 9)[i % _int_9]; +# } +# +# if(a == _int_157) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 84 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %65 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %49 "indexable" + OpName %65 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %65 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 5 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %6 3 + %32 = OpTypeBool + %34 = OpConstant %9 9 + %35 = OpTypeArray %6 %34 + %36 = OpConstant %6 1 + %37 = OpConstant %6 4 + %38 = OpConstant %6 5 + %39 = OpConstant %6 6 + %40 = OpConstant %6 7 + %41 = OpConstant %6 8 + %42 = OpConstant %6 9 + %43 = OpConstantComposite %35 %36 %16 %21 %37 %38 %39 %40 %41 %42 + %48 = OpTypePointer Function %35 + %62 = OpTypeFloat 32 + %63 = OpTypeVector %62 4 + %64 = OpTypePointer Output %63 + %65 = OpVariable %64 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %49 = OpVariable %48 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %22 = OpAccessChain %17 %14 %15 %21 + %23 = OpLoad %6 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %20 + %30 = OpAccessChain %17 %14 %15 %15 + %31 = OpLoad %6 %30 + %33 = OpSLessThan %32 %29 %31 + OpBranchConditional %33 %25 %26 + %25 = OpLabel + %44 = OpLoad %6 %20 + %45 = OpAccessChain %17 %14 %15 %37 + %46 = OpLoad %6 %45 + %47 = OpSMod %6 %44 %46 + OpStore %49 %43 + %50 = OpAccessChain %7 %49 %47 + %51 = OpLoad %6 %50 + %52 = OpLoad %6 %8 + %53 = OpIAdd %6 %52 %51 + OpStore %8 %53 + OpBranch %27 + %27 = OpLabel + %54 = OpLoad %6 %20 + %55 = OpIAdd %6 %54 %36 + OpStore %20 %55 + OpBranch %24 + %26 = OpLabel + %56 = OpLoad %6 %8 + %57 = OpAccessChain %17 %14 %15 %36 + %58 = OpLoad %6 %57 + %59 = OpIEqual %32 %56 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %60 %79 + %60 = OpLabel + %66 = OpAccessChain %17 %14 %15 %16 + %67 = OpLoad %6 %66 + %68 = OpConvertSToF %62 %67 + %69 = OpAccessChain %17 %14 %15 %21 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %62 %70 + %72 = OpAccessChain %17 %14 %15 %21 + %73 = OpLoad %6 %72 + %74 = OpConvertSToF %62 %73 + %75 = OpAccessChain %17 %14 %15 %16 + %76 = OpLoad %6 %75 + %77 = OpConvertSToF %62 %76 + %78 = OpCompositeConstruct %63 %68 %71 %74 %77 + OpStore %65 %78 + OpBranch %61 + %79 = OpLabel + %80 = OpAccessChain %17 %14 %15 %21 + %81 = OpLoad %6 %80 + %82 = OpConvertSToF %62 %81 + %83 = OpCompositeConstruct %63 %82 %82 %82 %82 + OpStore %65 %83 + OpBranch %61 + %61 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 33 157 1 0 9 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-increment-multiple-integers.amber b/vulkan/amber/graphicsfuzz/cov-increment-multiple-integers.amber new file mode 100644 index 0000000..52838fc --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-increment-multiple-integers.amber @@ -0,0 +1,261 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_10 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_6 _GLF_uniform_int_values[3] +# #define _int_20 _GLF_uniform_int_values[4] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 10, 1, 6, 20] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# int b = _int_1; +# int c = 1; +# +# while (b < _int_20 && a < 10) +# { +# if (c > 5) +# break; +# +# a++; +# c++; +# b++; +# } +# +# for(; a < _int_10; a++) +# { +# } +# +# if(a == _int_10 && b == _int_6 && c == _int_6) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 106 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %87 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %19 "b" + OpName %23 "c" + OpName %87 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %87 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 5 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %6 + %20 = OpConstant %6 2 + %24 = OpConstant %6 1 + %31 = OpConstant %6 4 + %34 = OpTypeBool + %37 = OpConstant %6 10 + %41 = OpConstant %6 5 + %70 = OpConstant %6 3 + %84 = OpTypeFloat 32 + %85 = OpTypeVector %84 4 + %86 = OpTypePointer Output %85 + %87 = OpVariable %86 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %23 = OpVariable %7 Function + %17 = OpAccessChain %16 %14 %15 %15 + %18 = OpLoad %6 %17 + OpStore %8 %18 + %21 = OpAccessChain %16 %14 %15 %20 + %22 = OpLoad %6 %21 + OpStore %19 %22 + OpStore %23 %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %6 %19 + %32 = OpAccessChain %16 %14 %15 %31 + %33 = OpLoad %6 %32 + %35 = OpSLessThan %34 %30 %33 + %36 = OpLoad %6 %8 + %38 = OpSLessThan %34 %36 %37 + %39 = OpLogicalAnd %34 %35 %38 + OpBranchConditional %39 %26 %27 + %26 = OpLabel + %40 = OpLoad %6 %23 + %42 = OpSGreaterThan %34 %40 %41 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %44 + %43 = OpLabel + OpBranch %27 + %44 = OpLabel + %46 = OpLoad %6 %8 + %47 = OpIAdd %6 %46 %24 + OpStore %8 %47 + %48 = OpLoad %6 %23 + %49 = OpIAdd %6 %48 %24 + OpStore %23 %49 + %50 = OpLoad %6 %19 + %51 = OpIAdd %6 %50 %24 + OpStore %19 %51 + OpBranch %28 + %28 = OpLabel + OpBranch %25 + %27 = OpLabel + OpBranch %52 + %52 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %6 %8 + %58 = OpAccessChain %16 %14 %15 %24 + %59 = OpLoad %6 %58 + %60 = OpSLessThan %34 %57 %59 + OpBranchConditional %60 %53 %54 + %53 = OpLabel + OpBranch %55 + %55 = OpLabel + %61 = OpLoad %6 %8 + %62 = OpIAdd %6 %61 %24 + OpStore %8 %62 + OpBranch %52 + %54 = OpLabel + %63 = OpLoad %6 %8 + %64 = OpAccessChain %16 %14 %15 %24 + %65 = OpLoad %6 %64 + %66 = OpIEqual %34 %63 %65 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %68 + %67 = OpLabel + %69 = OpLoad %6 %19 + %71 = OpAccessChain %16 %14 %15 %70 + %72 = OpLoad %6 %71 + %73 = OpIEqual %34 %69 %72 + OpBranch %68 + %68 = OpLabel + %74 = OpPhi %34 %66 %54 %73 %67 + OpSelectionMerge %76 None + OpBranchConditional %74 %75 %76 + %75 = OpLabel + %77 = OpLoad %6 %23 + %78 = OpAccessChain %16 %14 %15 %70 + %79 = OpLoad %6 %78 + %80 = OpIEqual %34 %77 %79 + OpBranch %76 + %76 = OpLabel + %81 = OpPhi %34 %74 %68 %80 %75 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %101 + %82 = OpLabel + %88 = OpAccessChain %16 %14 %15 %20 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %84 %89 + %91 = OpAccessChain %16 %14 %15 %15 + %92 = OpLoad %6 %91 + %93 = OpConvertSToF %84 %92 + %94 = OpAccessChain %16 %14 %15 %15 + %95 = OpLoad %6 %94 + %96 = OpConvertSToF %84 %95 + %97 = OpAccessChain %16 %14 %15 %20 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %84 %98 + %100 = OpCompositeConstruct %85 %90 %93 %96 %99 + OpStore %87 %100 + OpBranch %83 + %101 = OpLabel + %102 = OpAccessChain %16 %14 %15 %15 + %103 = OpLoad %6 %102 + %104 = OpConvertSToF %84 %103 + %105 = OpCompositeConstruct %85 %104 %104 %104 %104 + OpStore %87 %105 + OpBranch %83 + %83 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 10 1 6 20 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-increment-one-array-element-check-index-from-fragcoord.amber b/vulkan/amber/graphicsfuzz/cov-increment-one-array-element-check-index-from-fragcoord.amber new file mode 100644 index 0000000..14783c3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-increment-one-array-element-check-index-from-fragcoord.amber @@ -0,0 +1,327 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_7 _GLF_uniform_int_values[2] +# #define _int_9 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_3_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 3.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 7, 9] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float arr[9] = float[9](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0); +# +# // Sets arr[7] = 3. +# for(int i = 1; i < 3; i++) +# { +# arr[_int_7] += _float_1_0; +# } +# +# // Does nothing. Still needed for the coverage. +# int a = _int_1; +# while(true) +# { +# if(a++ >= 4) +# { +# break; +# } +# } +# +# int idx = clamp(int(gl_FragCoord.y), _int_0, _int_9 - _int_1); +# +# // Always true. +# if(arr[_GLF_MAKE_IN_BOUNDS_INT(idx, 9)] == (idx == _int_7 ? _float_3_0 : _float_1_0)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 143 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %88 %124 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %40 "i" + OpName %53 "buf1" + OpMemberName %53 0 "_GLF_uniform_int_values" + OpName %55 "" + OpName %69 "a" + OpName %85 "idx" + OpName %88 "gl_FragCoord" + OpName %124 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %52 ArrayStride 16 + OpMemberDecorate %53 0 Offset 0 + OpDecorate %53 Block + OpDecorate %55 DescriptorSet 0 + OpDecorate %55 Binding 1 + OpDecorate %88 BuiltIn FragCoord + OpDecorate %124 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 9 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 2 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %39 = OpTypePointer Function %17 + %41 = OpConstant %17 1 + %48 = OpConstant %17 3 + %49 = OpTypeBool + %51 = OpConstant %7 4 + %52 = OpTypeArray %17 %51 + %53 = OpTypeStruct %52 + %54 = OpTypePointer Uniform %53 + %55 = OpVariable %54 Uniform + %56 = OpConstant %17 2 + %57 = OpTypePointer Uniform %17 + %62 = OpTypePointer Function %6 + %77 = OpConstantTrue %49 + %80 = OpConstant %17 4 + %86 = OpTypeVector %6 4 + %87 = OpTypePointer Input %86 + %88 = OpVariable %87 Input + %89 = OpConstant %7 1 + %90 = OpTypePointer Input %6 + %103 = OpConstant %17 8 + %123 = OpTypePointer Output %86 + %124 = OpVariable %123 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %40 = OpVariable %39 Function + %69 = OpVariable %39 Function + %85 = OpVariable %39 Function + %111 = OpVariable %62 Function + %20 = OpAccessChain %19 %16 %18 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %16 %18 %18 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %19 %16 %18 %18 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %19 %16 %18 %18 + %27 = OpLoad %6 %26 + %28 = OpAccessChain %19 %16 %18 %18 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %19 %16 %18 %18 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %19 %16 %18 %18 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %19 %16 %18 %18 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %19 %16 %18 %18 + %37 = OpLoad %6 %36 + %38 = OpCompositeConstruct %9 %21 %23 %25 %27 %29 %31 %33 %35 %37 + OpStore %11 %38 + OpStore %40 %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %47 = OpLoad %17 %40 + %50 = OpSLessThan %49 %47 %48 + OpBranchConditional %50 %43 %44 + %43 = OpLabel + %58 = OpAccessChain %57 %55 %18 %56 + %59 = OpLoad %17 %58 + %60 = OpAccessChain %19 %16 %18 %18 + %61 = OpLoad %6 %60 + %63 = OpAccessChain %62 %11 %59 + %64 = OpLoad %6 %63 + %65 = OpFAdd %6 %64 %61 + %66 = OpAccessChain %62 %11 %59 + OpStore %66 %65 + OpBranch %45 + %45 = OpLabel + %67 = OpLoad %17 %40 + %68 = OpIAdd %17 %67 %41 + OpStore %40 %68 + OpBranch %42 + %44 = OpLabel + %70 = OpAccessChain %57 %55 %18 %41 + %71 = OpLoad %17 %70 + OpStore %69 %71 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %74 %75 None + OpBranch %76 + %76 = OpLabel + OpBranchConditional %77 %73 %74 + %73 = OpLabel + %78 = OpLoad %17 %69 + %79 = OpIAdd %17 %78 %41 + OpStore %69 %79 + %81 = OpSGreaterThanEqual %49 %78 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %83 + %82 = OpLabel + OpBranch %74 + %83 = OpLabel + OpBranch %75 + %75 = OpLabel + OpBranch %72 + %74 = OpLabel + %91 = OpAccessChain %90 %88 %89 + %92 = OpLoad %6 %91 + %93 = OpConvertFToS %17 %92 + %94 = OpAccessChain %57 %55 %18 %18 + %95 = OpLoad %17 %94 + %96 = OpAccessChain %57 %55 %18 %48 + %97 = OpLoad %17 %96 + %98 = OpAccessChain %57 %55 %18 %41 + %99 = OpLoad %17 %98 + %100 = OpISub %17 %97 %99 + %101 = OpExtInst %17 %1 SClamp %93 %95 %100 + OpStore %85 %101 + %102 = OpLoad %17 %85 + %104 = OpExtInst %17 %1 SClamp %102 %18 %103 + %105 = OpAccessChain %62 %11 %104 + %106 = OpLoad %6 %105 + %107 = OpLoad %17 %85 + %108 = OpAccessChain %57 %55 %18 %56 + %109 = OpLoad %17 %108 + %110 = OpIEqual %49 %107 %109 + OpSelectionMerge %113 None + OpBranchConditional %110 %112 %116 + %112 = OpLabel + %114 = OpAccessChain %19 %16 %18 %41 + %115 = OpLoad %6 %114 + OpStore %111 %115 + OpBranch %113 + %116 = OpLabel + %117 = OpAccessChain %19 %16 %18 %18 + %118 = OpLoad %6 %117 + OpStore %111 %118 + OpBranch %113 + %113 = OpLabel + %119 = OpLoad %6 %111 + %120 = OpFOrdEqual %49 %106 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %138 + %121 = OpLabel + %125 = OpAccessChain %57 %55 %18 %41 + %126 = OpLoad %17 %125 + %127 = OpConvertSToF %6 %126 + %128 = OpAccessChain %57 %55 %18 %18 + %129 = OpLoad %17 %128 + %130 = OpConvertSToF %6 %129 + %131 = OpAccessChain %57 %55 %18 %18 + %132 = OpLoad %17 %131 + %133 = OpConvertSToF %6 %132 + %134 = OpAccessChain %57 %55 %18 %41 + %135 = OpLoad %17 %134 + %136 = OpConvertSToF %6 %135 + %137 = OpCompositeConstruct %86 %127 %130 %133 %136 + OpStore %124 %137 + OpBranch %122 + %138 = OpLabel + %139 = OpAccessChain %57 %55 %18 %18 + %140 = OpLoad %17 %139 + %141 = OpConvertSToF %6 %140 + %142 = OpCompositeConstruct %86 %141 %141 %141 %141 + OpStore %124 %142 + OpBranch %122 + %122 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 7 9 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 3.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-increment-vector-array-matrix-element.amber b/vulkan/amber/graphicsfuzz/cov-increment-vector-array-matrix-element.amber new file mode 100644 index 0000000..f3317e1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-increment-vector-array-matrix-element.amber @@ -0,0 +1,250 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_3 _GLF_uniform_int_values[1] +# #define _int_5 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# #define _float_2_0 _GLF_uniform_float_values[0] +# #define _float_3_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 3, 5, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# // Contents of _GLF_uniform_float_values: [2.0, 3.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Initialize with an identity matrix. +# mat3 m = mat3(_int_1); +# int a = _int_1; +# +# // Change the value one at the center of the +# // matrix to value two. +# m[a][a] = _float_2_0; +# +# vec3 arr[2] = vec3[2](m[1], m[1]); +# vec3 v = vec3(_float_3_0); +# v += arr[a]; +# +# // Always true. +# if(v == vec3(_int_3, _int_5, _int_3)) +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# else +# _GLF_color = vec4(_int_0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 104 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %84 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "m" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %30 "a" + OpName %37 "buf1" + OpMemberName %37 0 "_GLF_uniform_float_values" + OpName %39 "" + OpName %47 "arr" + OpName %55 "v" + OpName %84 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 1 + OpDecorate %84 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeMatrix %7 3 + %9 = OpTypePointer Function %8 + %11 = OpTypeInt 32 1 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 4 + %14 = OpTypeArray %11 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %11 0 + %19 = OpTypePointer Uniform %11 + %23 = OpConstant %6 1 + %24 = OpConstant %6 0 + %29 = OpTypePointer Function %11 + %35 = OpConstant %12 2 + %36 = OpTypeArray %6 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %6 + %43 = OpTypePointer Function %6 + %45 = OpTypeArray %7 %35 + %46 = OpTypePointer Function %45 + %48 = OpConstant %11 1 + %49 = OpTypePointer Function %7 + %68 = OpConstant %11 2 + %76 = OpTypeBool + %77 = OpTypeVector %76 3 + %82 = OpTypeVector %6 4 + %83 = OpTypePointer Output %82 + %84 = OpVariable %83 Output + %88 = OpConstant %11 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %30 = OpVariable %29 Function + %47 = OpVariable %46 Function + %55 = OpVariable %49 Function + %20 = OpAccessChain %19 %17 %18 %18 + %21 = OpLoad %11 %20 + %22 = OpConvertSToF %6 %21 + %25 = OpCompositeConstruct %7 %22 %24 %24 + %26 = OpCompositeConstruct %7 %24 %22 %24 + %27 = OpCompositeConstruct %7 %24 %24 %22 + %28 = OpCompositeConstruct %8 %25 %26 %27 + OpStore %10 %28 + %31 = OpAccessChain %19 %17 %18 %18 + %32 = OpLoad %11 %31 + OpStore %30 %32 + %33 = OpLoad %11 %30 + %34 = OpLoad %11 %30 + %41 = OpAccessChain %40 %39 %18 %18 + %42 = OpLoad %6 %41 + %44 = OpAccessChain %43 %10 %33 %34 + OpStore %44 %42 + %50 = OpAccessChain %49 %10 %48 + %51 = OpLoad %7 %50 + %52 = OpAccessChain %49 %10 %48 + %53 = OpLoad %7 %52 + %54 = OpCompositeConstruct %45 %51 %53 + OpStore %47 %54 + %56 = OpAccessChain %40 %39 %18 %48 + %57 = OpLoad %6 %56 + %58 = OpCompositeConstruct %7 %57 %57 %57 + OpStore %55 %58 + %59 = OpLoad %11 %30 + %60 = OpAccessChain %49 %47 %59 + %61 = OpLoad %7 %60 + %62 = OpLoad %7 %55 + %63 = OpFAdd %7 %62 %61 + OpStore %55 %63 + %64 = OpLoad %7 %55 + %65 = OpAccessChain %19 %17 %18 %48 + %66 = OpLoad %11 %65 + %67 = OpConvertSToF %6 %66 + %69 = OpAccessChain %19 %17 %18 %68 + %70 = OpLoad %11 %69 + %71 = OpConvertSToF %6 %70 + %72 = OpAccessChain %19 %17 %18 %48 + %73 = OpLoad %11 %72 + %74 = OpConvertSToF %6 %73 + %75 = OpCompositeConstruct %7 %67 %71 %74 + %78 = OpFOrdEqual %77 %64 %75 + %79 = OpAll %76 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %80 %99 + %80 = OpLabel + %85 = OpAccessChain %19 %17 %18 %18 + %86 = OpLoad %11 %85 + %87 = OpConvertSToF %6 %86 + %89 = OpAccessChain %19 %17 %18 %88 + %90 = OpLoad %11 %89 + %91 = OpConvertSToF %6 %90 + %92 = OpAccessChain %19 %17 %18 %88 + %93 = OpLoad %11 %92 + %94 = OpConvertSToF %6 %93 + %95 = OpAccessChain %19 %17 %18 %18 + %96 = OpLoad %11 %95 + %97 = OpConvertSToF %6 %96 + %98 = OpCompositeConstruct %82 %87 %91 %94 %97 + OpStore %84 %98 + OpBranch %81 + %99 = OpLabel + %100 = OpAccessChain %19 %17 %18 %88 + %101 = OpLoad %11 %100 + %102 = OpConvertSToF %6 %101 + %103 = OpCompositeConstruct %82 %102 %102 %102 %102 + OpStore %84 %103 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 3.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 3 5 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-increment-vector-component-with-matrix-copy.amber b/vulkan/amber/graphicsfuzz/cov-increment-vector-component-with-matrix-copy.amber new file mode 100644 index 0000000..4e40cce --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-increment-vector-component-with-matrix-copy.amber @@ -0,0 +1,254 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_3_0 _GLF_uniform_float_values[0] +# #define _float_4_0 _GLF_uniform_float_values[1] +# #define _float_1_0 _GLF_uniform_float_values[2] +# #define _float_2_0 _GLF_uniform_float_values[3] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# // Contents of _GLF_uniform_float_values: [3.0, 4.0, 1.0, 2.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[4]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1; +# vec4 v = vec4(_float_1_0); +# mat3x4 m = mat3x4(_float_2_0); +# m[a][a] = _float_3_0; +# v[a] += mat4(m)[a][a]; +# +# if(v.y == _float_4_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 111 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %92 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %22 "v" + OpName %25 "buf1" + OpMemberName %25 0 "_GLF_uniform_float_values" + OpName %27 "" + OpName %35 "m" + OpName %74 "indexable" + OpName %92 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %24 ArrayStride 16 + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 1 + OpDecorate %92 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %6 + %19 = OpTypeFloat 32 + %20 = OpTypeVector %19 4 + %21 = OpTypePointer Function %20 + %23 = OpConstant %9 4 + %24 = OpTypeArray %19 %23 + %25 = OpTypeStruct %24 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpConstant %6 2 + %29 = OpTypePointer Uniform %19 + %33 = OpTypeMatrix %20 3 + %34 = OpTypePointer Function %33 + %36 = OpConstant %6 3 + %39 = OpConstant %19 1 + %40 = OpConstant %19 0 + %49 = OpTypePointer Function %19 + %53 = OpTypeMatrix %20 4 + %73 = OpTypePointer Function %53 + %81 = OpConstant %9 1 + %84 = OpConstant %6 1 + %87 = OpTypeBool + %91 = OpTypePointer Output %20 + %92 = OpVariable %91 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %21 Function + %35 = OpVariable %34 Function + %74 = OpVariable %73 Function + %17 = OpAccessChain %16 %14 %15 %15 + %18 = OpLoad %6 %17 + OpStore %8 %18 + %30 = OpAccessChain %29 %27 %15 %28 + %31 = OpLoad %19 %30 + %32 = OpCompositeConstruct %20 %31 %31 %31 %31 + OpStore %22 %32 + %37 = OpAccessChain %29 %27 %15 %36 + %38 = OpLoad %19 %37 + %41 = OpCompositeConstruct %20 %38 %40 %40 %40 + %42 = OpCompositeConstruct %20 %40 %38 %40 %40 + %43 = OpCompositeConstruct %20 %40 %40 %38 %40 + %44 = OpCompositeConstruct %33 %41 %42 %43 + OpStore %35 %44 + %45 = OpLoad %6 %8 + %46 = OpLoad %6 %8 + %47 = OpAccessChain %29 %27 %15 %15 + %48 = OpLoad %19 %47 + %50 = OpAccessChain %49 %35 %45 %46 + OpStore %50 %48 + %51 = OpLoad %6 %8 + %52 = OpLoad %33 %35 + %54 = OpCompositeExtract %19 %52 0 0 + %55 = OpCompositeExtract %19 %52 0 1 + %56 = OpCompositeExtract %19 %52 0 2 + %57 = OpCompositeExtract %19 %52 0 3 + %58 = OpCompositeExtract %19 %52 1 0 + %59 = OpCompositeExtract %19 %52 1 1 + %60 = OpCompositeExtract %19 %52 1 2 + %61 = OpCompositeExtract %19 %52 1 3 + %62 = OpCompositeExtract %19 %52 2 0 + %63 = OpCompositeExtract %19 %52 2 1 + %64 = OpCompositeExtract %19 %52 2 2 + %65 = OpCompositeExtract %19 %52 2 3 + %66 = OpCompositeConstruct %20 %54 %55 %56 %57 + %67 = OpCompositeConstruct %20 %58 %59 %60 %61 + %68 = OpCompositeConstruct %20 %62 %63 %64 %65 + %69 = OpCompositeConstruct %20 %40 %40 %40 %39 + %70 = OpCompositeConstruct %53 %66 %67 %68 %69 + %71 = OpLoad %6 %8 + %72 = OpLoad %6 %8 + OpStore %74 %70 + %75 = OpAccessChain %49 %74 %71 %72 + %76 = OpLoad %19 %75 + %77 = OpAccessChain %49 %22 %51 + %78 = OpLoad %19 %77 + %79 = OpFAdd %19 %78 %76 + %80 = OpAccessChain %49 %22 %51 + OpStore %80 %79 + %82 = OpAccessChain %49 %22 %81 + %83 = OpLoad %19 %82 + %85 = OpAccessChain %29 %27 %15 %84 + %86 = OpLoad %19 %85 + %88 = OpFOrdEqual %87 %83 %86 + OpSelectionMerge %90 None + OpBranchConditional %88 %89 %106 + %89 = OpLabel + %93 = OpAccessChain %16 %14 %15 %15 + %94 = OpLoad %6 %93 + %95 = OpConvertSToF %19 %94 + %96 = OpAccessChain %16 %14 %15 %84 + %97 = OpLoad %6 %96 + %98 = OpConvertSToF %19 %97 + %99 = OpAccessChain %16 %14 %15 %84 + %100 = OpLoad %6 %99 + %101 = OpConvertSToF %19 %100 + %102 = OpAccessChain %16 %14 %15 %15 + %103 = OpLoad %6 %102 + %104 = OpConvertSToF %19 %103 + %105 = OpCompositeConstruct %20 %95 %98 %101 %104 + OpStore %92 %105 + OpBranch %90 + %106 = OpLabel + %107 = OpAccessChain %16 %14 %15 %84 + %108 = OpLoad %6 %107 + %109 = OpConvertSToF %19 %108 + %110 = OpCompositeConstruct %20 %109 %109 %109 %109 + OpStore %92 %110 + OpBranch %90 + %90 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 3.0 4.0 1.0 2.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-increment-vector-function-call-conditional.amber b/vulkan/amber/graphicsfuzz/cov-increment-vector-function-call-conditional.amber new file mode 100644 index 0000000..35a92b0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-increment-vector-function-call-conditional.amber @@ -0,0 +1,309 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# // Contents of one: 1 +# layout(set = 0, binding = 2) uniform buf2 +# { +# int one; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# vec4 func() +# { +# vec4 v = vec4(_int_0); +# int i = _int_1; +# +# // Iterated once. +# do +# { +# v[i] = _float_1_0; +# i++; +# } +# while(findMSB(_int_1) > _int_1); +# +# // Returns (0, 1, 0, 0) +# return v; +# } +# +# void main() +# { +# vec4 v = vec4(_int_0); +# +# // Always true. +# if(one > _int_0) +# { +# // v becomes (0, 1, 0, 0). +# v = v + func(); +# } +# // v becomes (0, 2, 0, 0). +# v = v + func(); +# +# // Always true. +# if(v == vec4(_int_0, _int_2, _int_0, _int_0)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 119 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %100 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "func(" + OpName %12 "v" + OpName %17 "buf1" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %28 "i" + OpName %38 "buf0" + OpMemberName %38 0 "_GLF_uniform_float_values" + OpName %40 "" + OpName %58 "v" + OpName %63 "buf2" + OpMemberName %63 0 "one" + OpName %65 "" + OpName %100 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %37 ArrayStride 16 + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 0 + OpMemberDecorate %63 0 Offset 0 + OpDecorate %63 Block + OpDecorate %65 DescriptorSet 0 + OpDecorate %65 Binding 2 + OpDecorate %100 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeFunction %7 + %11 = OpTypePointer Function %7 + %13 = OpTypeInt 32 1 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 3 + %16 = OpTypeArray %13 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %13 0 + %21 = OpConstant %13 1 + %22 = OpTypePointer Uniform %13 + %27 = OpTypePointer Function %13 + %36 = OpConstant %14 1 + %37 = OpTypeArray %6 %36 + %38 = OpTypeStruct %37 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %41 = OpTypePointer Uniform %6 + %44 = OpTypePointer Function %6 + %53 = OpTypeBool + %63 = OpTypeStruct %13 + %64 = OpTypePointer Uniform %63 + %65 = OpVariable %64 Uniform + %83 = OpConstant %13 2 + %94 = OpTypeVector %53 4 + %99 = OpTypePointer Output %7 + %100 = OpVariable %99 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %58 = OpVariable %11 Function + %59 = OpAccessChain %22 %19 %20 %21 + %60 = OpLoad %13 %59 + %61 = OpConvertSToF %6 %60 + %62 = OpCompositeConstruct %7 %61 %61 %61 %61 + OpStore %58 %62 + %66 = OpAccessChain %22 %65 %20 + %67 = OpLoad %13 %66 + %68 = OpAccessChain %22 %19 %20 %21 + %69 = OpLoad %13 %68 + %70 = OpSGreaterThan %53 %67 %69 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %72 + %71 = OpLabel + %73 = OpLoad %7 %58 + %74 = OpFunctionCall %7 %9 + %75 = OpFAdd %7 %73 %74 + OpStore %58 %75 + OpBranch %72 + %72 = OpLabel + %76 = OpLoad %7 %58 + %77 = OpFunctionCall %7 %9 + %78 = OpFAdd %7 %76 %77 + OpStore %58 %78 + %79 = OpLoad %7 %58 + %80 = OpAccessChain %22 %19 %20 %21 + %81 = OpLoad %13 %80 + %82 = OpConvertSToF %6 %81 + %84 = OpAccessChain %22 %19 %20 %83 + %85 = OpLoad %13 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpAccessChain %22 %19 %20 %21 + %88 = OpLoad %13 %87 + %89 = OpConvertSToF %6 %88 + %90 = OpAccessChain %22 %19 %20 %21 + %91 = OpLoad %13 %90 + %92 = OpConvertSToF %6 %91 + %93 = OpCompositeConstruct %7 %82 %86 %89 %92 + %95 = OpFOrdEqual %94 %79 %93 + %96 = OpAll %53 %95 + OpSelectionMerge %98 None + OpBranchConditional %96 %97 %114 + %97 = OpLabel + %101 = OpAccessChain %22 %19 %20 %20 + %102 = OpLoad %13 %101 + %103 = OpConvertSToF %6 %102 + %104 = OpAccessChain %22 %19 %20 %21 + %105 = OpLoad %13 %104 + %106 = OpConvertSToF %6 %105 + %107 = OpAccessChain %22 %19 %20 %21 + %108 = OpLoad %13 %107 + %109 = OpConvertSToF %6 %108 + %110 = OpAccessChain %22 %19 %20 %20 + %111 = OpLoad %13 %110 + %112 = OpConvertSToF %6 %111 + %113 = OpCompositeConstruct %7 %103 %106 %109 %112 + OpStore %100 %113 + OpBranch %98 + %114 = OpLabel + %115 = OpAccessChain %22 %19 %20 %21 + %116 = OpLoad %13 %115 + %117 = OpConvertSToF %6 %116 + %118 = OpCompositeConstruct %7 %117 %117 %117 %117 + OpStore %100 %118 + OpBranch %98 + %98 = OpLabel + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %12 = OpVariable %11 Function + %28 = OpVariable %27 Function + %23 = OpAccessChain %22 %19 %20 %21 + %24 = OpLoad %13 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpCompositeConstruct %7 %25 %25 %25 %25 + OpStore %12 %26 + %29 = OpAccessChain %22 %19 %20 %20 + %30 = OpLoad %13 %29 + OpStore %28 %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %32 + %32 = OpLabel + %35 = OpLoad %13 %28 + %42 = OpAccessChain %41 %40 %20 %20 + %43 = OpLoad %6 %42 + %45 = OpAccessChain %44 %12 %35 + OpStore %45 %43 + %46 = OpLoad %13 %28 + %47 = OpIAdd %13 %46 %21 + OpStore %28 %47 + OpBranch %34 + %34 = OpLabel + %48 = OpAccessChain %22 %19 %20 %20 + %49 = OpLoad %13 %48 + %50 = OpExtInst %13 %1 FindSMsb %49 + %51 = OpAccessChain %22 %19 %20 %20 + %52 = OpLoad %13 %51 + %54 = OpSGreaterThan %53 %50 %52 + OpBranchConditional %54 %31 %33 + %33 = OpLabel + %55 = OpLoad %7 %12 + OpReturnValue %55 + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 STD140 DATA + 1 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-index-array-using-uniform-bitwise-or-one.amber b/vulkan/amber/graphicsfuzz/cov-index-array-using-uniform-bitwise-or-one.amber new file mode 100644 index 0000000..44275b0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-index-array-using-uniform-bitwise-or-one.amber @@ -0,0 +1,224 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1 | 1; +# int arr[10] = int[10](_int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0); +# +# arr[a]++; +# +# // Always true. +# if(arr[_int_1] == _int_1) +# { +# arr[_int_1] ++; +# } +# +# // Always true. +# if(arr[_int_1] == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 97 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %78 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %24 "arr" + OpName %78 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %78 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %9 10 + %22 = OpTypeArray %6 %21 + %23 = OpTypePointer Function %22 + %56 = OpTypeBool + %69 = OpConstant %6 2 + %75 = OpTypeFloat 32 + %76 = OpTypeVector %75 4 + %77 = OpTypePointer Output %76 + %78 = OpVariable %77 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %24 = OpVariable %23 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + %20 = OpBitwiseOr %6 %19 %16 + OpStore %8 %20 + %25 = OpAccessChain %17 %14 %15 %15 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %17 %14 %15 %15 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %17 %14 %15 %15 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %17 %14 %15 %15 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %17 %14 %15 %15 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %17 %14 %15 %15 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %17 %14 %15 %15 + %38 = OpLoad %6 %37 + %39 = OpAccessChain %17 %14 %15 %15 + %40 = OpLoad %6 %39 + %41 = OpAccessChain %17 %14 %15 %15 + %42 = OpLoad %6 %41 + %43 = OpAccessChain %17 %14 %15 %15 + %44 = OpLoad %6 %43 + %45 = OpCompositeConstruct %22 %26 %28 %30 %32 %34 %36 %38 %40 %42 %44 + OpStore %24 %45 + %46 = OpLoad %6 %8 + %47 = OpAccessChain %7 %24 %46 + %48 = OpLoad %6 %47 + %49 = OpIAdd %6 %48 %16 + OpStore %47 %49 + %50 = OpAccessChain %17 %14 %15 %16 + %51 = OpLoad %6 %50 + %52 = OpAccessChain %7 %24 %51 + %53 = OpLoad %6 %52 + %54 = OpAccessChain %17 %14 %15 %16 + %55 = OpLoad %6 %54 + %57 = OpIEqual %56 %53 %55 + OpSelectionMerge %59 None + OpBranchConditional %57 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %17 %14 %15 %16 + %61 = OpLoad %6 %60 + %62 = OpAccessChain %7 %24 %61 + %63 = OpLoad %6 %62 + %64 = OpIAdd %6 %63 %16 + OpStore %62 %64 + OpBranch %59 + %59 = OpLabel + %65 = OpAccessChain %17 %14 %15 %16 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %7 %24 %66 + %68 = OpLoad %6 %67 + %70 = OpAccessChain %17 %14 %15 %69 + %71 = OpLoad %6 %70 + %72 = OpIEqual %56 %68 %71 + OpSelectionMerge %74 None + OpBranchConditional %72 %73 %92 + %73 = OpLabel + %79 = OpAccessChain %17 %14 %15 %16 + %80 = OpLoad %6 %79 + %81 = OpConvertSToF %75 %80 + %82 = OpAccessChain %17 %14 %15 %15 + %83 = OpLoad %6 %82 + %84 = OpConvertSToF %75 %83 + %85 = OpAccessChain %17 %14 %15 %15 + %86 = OpLoad %6 %85 + %87 = OpConvertSToF %75 %86 + %88 = OpAccessChain %17 %14 %15 %16 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %75 %89 + %91 = OpCompositeConstruct %76 %81 %84 %87 %90 + OpStore %78 %91 + OpBranch %74 + %92 = OpLabel + %93 = OpAccessChain %17 %14 %15 %15 + %94 = OpLoad %6 %93 + %95 = OpConvertSToF %75 %94 + %96 = OpCompositeConstruct %76 %95 %95 %95 %95 + OpStore %78 %96 + OpBranch %74 + %74 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-initialize-integer-array-variable-divided-by-itself.amber b/vulkan/amber/graphicsfuzz/cov-initialize-integer-array-variable-divided-by-itself.amber new file mode 100644 index 0000000..dbad4c3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-initialize-integer-array-variable-divided-by-itself.amber @@ -0,0 +1,234 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1; +# +# // Iterated ten times. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# +# int b = _int_1; +# +# int arr[10] = int[10](_int_0, (a / a), _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0); +# +# // a still has a value of one after this assignment. +# a = arr[b]; +# } +# +# // Always true. +# if(a == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 93 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %74 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %11 "a" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %33 "b" + OpName %39 "arr" + OpName %74 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %74 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 2 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypePointer Uniform %6 + %27 = OpConstant %6 10 + %28 = OpTypeBool + %31 = OpConstant %6 1 + %36 = OpConstant %12 10 + %37 = OpTypeArray %6 %36 + %38 = OpTypePointer Function %37 + %71 = OpTypeFloat 32 + %72 = OpTypeVector %71 4 + %73 = OpTypePointer Output %72 + %74 = OpVariable %73 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %33 = OpVariable %10 Function + %39 = OpVariable %38 Function + OpStore %8 %9 + %19 = OpAccessChain %18 %17 %9 %9 + %20 = OpLoad %6 %19 + OpStore %11 %20 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %6 %8 + %29 = OpSLessThan %28 %26 %27 + OpBranchConditional %29 %22 %23 + %22 = OpLabel + %30 = OpLoad %6 %8 + %32 = OpIAdd %6 %30 %31 + OpStore %8 %32 + %34 = OpAccessChain %18 %17 %9 %9 + %35 = OpLoad %6 %34 + OpStore %33 %35 + %40 = OpAccessChain %18 %17 %9 %31 + %41 = OpLoad %6 %40 + %42 = OpLoad %6 %11 + %43 = OpLoad %6 %11 + %44 = OpSDiv %6 %42 %43 + %45 = OpAccessChain %18 %17 %9 %31 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %18 %17 %9 %31 + %48 = OpLoad %6 %47 + %49 = OpAccessChain %18 %17 %9 %31 + %50 = OpLoad %6 %49 + %51 = OpAccessChain %18 %17 %9 %31 + %52 = OpLoad %6 %51 + %53 = OpAccessChain %18 %17 %9 %31 + %54 = OpLoad %6 %53 + %55 = OpAccessChain %18 %17 %9 %31 + %56 = OpLoad %6 %55 + %57 = OpAccessChain %18 %17 %9 %31 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %18 %17 %9 %31 + %60 = OpLoad %6 %59 + %61 = OpCompositeConstruct %37 %41 %44 %46 %48 %50 %52 %54 %56 %58 %60 + OpStore %39 %61 + %62 = OpLoad %6 %33 + %63 = OpAccessChain %10 %39 %62 + %64 = OpLoad %6 %63 + OpStore %11 %64 + OpBranch %24 + %24 = OpLabel + OpBranch %21 + %23 = OpLabel + %65 = OpLoad %6 %11 + %66 = OpAccessChain %18 %17 %9 %9 + %67 = OpLoad %6 %66 + %68 = OpIEqual %28 %65 %67 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %88 + %69 = OpLabel + %75 = OpAccessChain %18 %17 %9 %9 + %76 = OpLoad %6 %75 + %77 = OpConvertSToF %71 %76 + %78 = OpAccessChain %18 %17 %9 %31 + %79 = OpLoad %6 %78 + %80 = OpConvertSToF %71 %79 + %81 = OpAccessChain %18 %17 %9 %31 + %82 = OpLoad %6 %81 + %83 = OpConvertSToF %71 %82 + %84 = OpAccessChain %18 %17 %9 %9 + %85 = OpLoad %6 %84 + %86 = OpConvertSToF %71 %85 + %87 = OpCompositeConstruct %72 %77 %80 %83 %86 + OpStore %74 %87 + OpBranch %70 + %88 = OpLabel + %89 = OpAccessChain %18 %17 %9 %31 + %90 = OpLoad %6 %89 + %91 = OpConvertSToF %71 %90 + %92 = OpCompositeConstruct %72 %91 %91 %91 %91 + OpStore %74 %92 + OpBranch %70 + %70 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inline-pass-empty-block.amber b/vulkan/amber/graphicsfuzz/cov-inline-pass-empty-block.amber new file mode 100644 index 0000000..9832718 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inline-pass-empty-block.amber @@ -0,0 +1,150 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific inlining optimization path. + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--reduce-load-size' +# '--convert-local-access-chains' +# '--eliminate-local-single-store' +# '--simplify-instructions' +# '--combine-access-chains' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--convert-local-access-chains' +# '--convert-local-access-chains' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec4 func() +# { +# float x = 1.0; +# +# // Always false. +# if (gl_FragCoord.x < 0.0) +# x = 0.5; +# +# return vec4(x, 0, 0, 1); +# } +# +# void main() +# { +# _GLF_color = vec4(0); +# +# do +# { +# _GLF_color = func(); +# } +# while (false); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %15 %32 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "func(" + OpName %12 "x" + OpName %15 "gl_FragCoord" + OpName %32 "_GLF_color" + OpDecorate %15 BuiltIn FragCoord + OpDecorate %32 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeFunction %7 + %11 = OpTypePointer Function %6 + %13 = OpConstant %6 1 + %14 = OpTypePointer Input %7 + %15 = OpVariable %14 Input + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 0 + %18 = OpTypePointer Input %6 + %21 = OpConstant %6 0 + %22 = OpTypeBool + %26 = OpConstant %6 0.5 + %31 = OpTypePointer Output %7 + %32 = OpVariable %31 Output + %33 = OpConstantComposite %7 %21 %21 %21 %21 + %39 = OpConstantFalse %22 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %32 %33 + OpBranch %34 + %34 = OpLabel + %38 = OpFunctionCall %7 %9 + OpStore %32 %38 + OpLoopMerge %36 %34 None + OpBranchConditional %39 %34 %36 + %36 = OpLabel + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %12 = OpVariable %11 Function + OpStore %12 %13 + %19 = OpAccessChain %18 %15 %17 + %20 = OpLoad %6 %19 + %23 = OpFOrdLessThan %22 %20 %21 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + OpStore %12 %26 + OpBranch %25 + %25 = OpLabel + %27 = OpLoad %6 %12 + %28 = OpCompositeConstruct %7 %27 %21 %21 %13 + OpReturnValue %28 + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inline-pass-nested-loops.amber b/vulkan/amber/graphicsfuzz/cov-inline-pass-nested-loops.amber new file mode 100644 index 0000000..6777f2f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inline-pass-nested-loops.amber @@ -0,0 +1,212 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific inlining optimization path. + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-inserts' +# '--eliminate-local-single-store' +# '--scalar-replacement=100' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--scalar-replacement=100' +# '--eliminate-dead-branches' +# '--ccp' +# '--ccp' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--scalar-replacement=100' +# '--eliminate-local-single-store' +# '--combine-access-chains' +# '--redundancy-elimination' +# '--ccp' +# '--eliminate-dead-code-aggressive' +# '--private-to-local' +# '--eliminate-local-single-block' +# '--eliminate-local-multi-store' +# '--eliminate-local-single-block' +# '--ccp' +# spirv-opt commit hash: 96354f5047bf35765af49657304357e00264e5f9 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int zero; +# }; +# +# vec4 returnRed() +# { +# do +# { +# // Always false. +# if(zero == 1) +# { +# return vec4(1, 0, 0, 1); +# } +# } +# while(false); +# return vec4(1, 0, 0, 1); +# } +# +# void main() +# { +# do +# { +# _GLF_color = returnRed(); +# } +# while(false); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %40 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "returnRed(" + OpName %16 "buf0" + OpMemberName %16 0 "zero" + OpName %18 "" + OpName %40 "_GLF_color" + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %40 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeFunction %7 + %15 = OpTypeInt 32 1 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpConstant %15 0 + %20 = OpTypePointer Uniform %15 + %23 = OpConstant %15 1 + %24 = OpTypeBool + %28 = OpConstant %6 1 + %29 = OpConstant %6 0 + %30 = OpConstantComposite %7 %28 %29 %29 %28 + %32 = OpConstantFalse %24 + %39 = OpTypePointer Output %7 + %40 = OpVariable %39 Output + %43 = OpTypePointer Function %7 + %49 = OpTypePointer Function %24 + %51 = OpConstantTrue %24 + %61 = OpUndef %7 + %62 = OpUndef %24 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %35 + %35 = OpLabel + %41 = OpFunctionCall %7 %9 + OpStore %40 %41 + OpLoopMerge %37 %35 None + OpBranchConditional %32 %35 %37 + %37 = OpLabel + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %50 = OpVariable %49 Function %32 + %44 = OpVariable %43 Function + OpBranch %46 + %46 = OpLabel + %56 = OpPhi %24 %32 %10 %62 %48 + OpLoopMerge %42 %48 None + OpBranch %11 + %11 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %12 + %12 = OpLabel + %21 = OpAccessChain %20 %18 %19 + %22 = OpLoad %15 %21 + %25 = OpIEqual %24 %22 %23 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %27 + %26 = OpLabel + OpStore %50 %51 + OpStore %44 %30 + OpBranch %13 + %27 = OpLabel + OpBranch %14 + %14 = OpLabel + OpBranchConditional %32 %11 %13 + %13 = OpLabel + %58 = OpPhi %7 %30 %26 %61 %14 + %54 = OpPhi %24 %51 %26 %32 %14 + OpSelectionMerge %52 None + OpBranchConditional %54 %42 %52 + %52 = OpLabel + OpStore %50 %51 + OpStore %44 %30 + OpBranch %42 + %48 = OpLabel + OpBranch %46 + %42 = OpLabel + %57 = OpPhi %7 %58 %13 %30 %52 + OpReturnValue %57 + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inline-pass-return-in-loop.amber b/vulkan/amber/graphicsfuzz/cov-inline-pass-return-in-loop.amber new file mode 100644 index 0000000..3633918 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inline-pass-return-in-loop.amber @@ -0,0 +1,165 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific inlining optimization path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float func() +# { +# for (int i = 0; i < 10; ++i) +# { +# if (i > 5) +# ++i; +# +# if (i > 8) +# return 0.0; +# } +# +# return 1.0; +# } +# +# void main() +# { +# if (false) +# { +# _GLF_color = vec4(func()); +# } +# else +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %48 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "func(" + OpName %12 "i" + OpName %48 "_GLF_color" + OpDecorate %48 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %13 = OpConstant %10 0 + %20 = OpConstant %10 10 + %21 = OpTypeBool + %24 = OpConstant %10 5 + %29 = OpConstant %10 1 + %32 = OpConstant %10 8 + %36 = OpConstant %6 0 + %40 = OpConstant %6 1 + %43 = OpConstantFalse %21 + %46 = OpTypeVector %6 4 + %47 = OpTypePointer Output %46 + %48 = OpVariable %47 Output + %52 = OpConstantComposite %46 %40 %36 %36 %40 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %51 + %44 = OpLabel + %49 = OpFunctionCall %6 %8 + %50 = OpCompositeConstruct %46 %49 %49 %49 %49 + OpStore %48 %50 + OpBranch %45 + %51 = OpLabel + OpStore %48 %52 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %12 = OpVariable %11 Function + OpStore %12 %13 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %18 + %18 = OpLabel + %19 = OpLoad %10 %12 + %22 = OpSLessThan %21 %19 %20 + OpBranchConditional %22 %15 %16 + %15 = OpLabel + %23 = OpLoad %10 %12 + %25 = OpSGreaterThan %21 %23 %24 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %27 + %26 = OpLabel + %28 = OpLoad %10 %12 + %30 = OpIAdd %10 %28 %29 + OpStore %12 %30 + OpBranch %27 + %27 = OpLabel + %31 = OpLoad %10 %12 + %33 = OpSGreaterThan %21 %31 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %35 + %34 = OpLabel + OpReturnValue %36 + %35 = OpLabel + OpBranch %17 + %17 = OpLabel + %38 = OpLoad %10 %12 + %39 = OpIAdd %10 %38 %29 + OpStore %12 %39 + OpBranch %14 + %16 = OpLabel + OpReturnValue %40 + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inline-pass-unreachable-func.amber b/vulkan/amber/graphicsfuzz/cov-inline-pass-unreachable-func.amber new file mode 100644 index 0000000..9255b33 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inline-pass-unreachable-func.amber @@ -0,0 +1,156 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific inlining optimization path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float func() +# { +# float x = 2.0; +# if (gl_FragCoord.x == 12.0) +# { +# if (gl_FragCoord.y == 13.0) +# { +# x += 1.0; +# } +# return x; +# } +# +# return 1.0; +# } +# +# void main() +# { +# if (false) +# { +# _GLF_color = vec4(func()); +# } +# else +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %15 %44 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "x" + OpName %15 "gl_FragCoord" + OpName %44 "_GLF_color" + OpDecorate %15 BuiltIn FragCoord + OpDecorate %44 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 2 + %13 = OpTypeVector %6 4 + %14 = OpTypePointer Input %13 + %15 = OpVariable %14 Input + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 0 + %18 = OpTypePointer Input %6 + %21 = OpConstant %6 12 + %22 = OpTypeBool + %26 = OpConstant %16 1 + %29 = OpConstant %6 13 + %33 = OpConstant %6 1 + %40 = OpConstantFalse %22 + %43 = OpTypePointer Output %13 + %44 = OpVariable %43 Output + %48 = OpConstant %6 0 + %49 = OpConstantComposite %13 %33 %48 %48 %33 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %47 + %41 = OpLabel + %45 = OpFunctionCall %6 %8 + %46 = OpCompositeConstruct %13 %45 %45 %45 %45 + OpStore %44 %46 + OpBranch %42 + %47 = OpLabel + OpStore %44 %49 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + OpStore %11 %12 + %19 = OpAccessChain %18 %15 %17 + %20 = OpLoad %6 %19 + %23 = OpFOrdEqual %22 %20 %21 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + %27 = OpAccessChain %18 %15 %26 + %28 = OpLoad %6 %27 + %30 = OpFOrdEqual %22 %28 %29 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + %34 = OpLoad %6 %11 + %35 = OpFAdd %6 %34 %33 + OpStore %11 %35 + OpBranch %32 + %32 = OpLabel + %36 = OpLoad %6 %11 + OpReturnValue %36 + %25 = OpLabel + OpReturnValue %33 + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-determinant.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-determinant.amber new file mode 100644 index 0000000..1933978 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-determinant.amber @@ -0,0 +1,230 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine add sub code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_4_0 _GLF_uniform_float_values[1] +# #define _float_3_0 _GLF_uniform_float_values[2] +# #define _float_2_0 _GLF_uniform_float_values[3] +# #define _float_0_0 _GLF_uniform_float_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 4.0, 3.0, 2.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[5]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // mix() selects 2.0. +# float a = mix(-_float_1_0, 2.0, _float_0_0 < _float_1_0); +# mat2 m = mat2(1.0, a, 3.0, 4.0); +# float ref = _float_1_0 * _float_4_0 - (_float_2_0)*_float_3_0; +# +# if (determinant(m) == ref) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 90 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %65 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %33 "m" + OpName %42 "ref" + OpName %65 "_GLF_color" + OpName %68 "buf1" + OpMemberName %68 0 "_GLF_uniform_int_values" + OpName %70 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %65 Location 0 + OpDecorate %67 ArrayStride 16 + OpMemberDecorate %68 0 Offset 0 + OpDecorate %68 Block + OpDecorate %70 DescriptorSet 0 + OpDecorate %70 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 5 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %6 2 + %22 = OpConstant %15 4 + %27 = OpTypeBool + %30 = OpTypeVector %6 2 + %31 = OpTypeMatrix %30 2 + %32 = OpTypePointer Function %31 + %34 = OpConstant %6 1 + %36 = OpConstant %6 3 + %37 = OpConstant %6 4 + %38 = OpConstant %6 0 + %45 = OpConstant %15 1 + %49 = OpConstant %15 3 + %52 = OpConstant %15 2 + %63 = OpTypeVector %6 4 + %64 = OpTypePointer Output %63 + %65 = OpVariable %64 Output + %66 = OpConstant %9 2 + %67 = OpTypeArray %15 %66 + %68 = OpTypeStruct %67 + %69 = OpTypePointer Uniform %68 + %70 = OpVariable %69 Uniform + %71 = OpTypePointer Uniform %15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %33 = OpVariable %32 Function + %42 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %6 %18 + %20 = OpFNegate %6 %19 + %23 = OpAccessChain %17 %14 %16 %22 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %17 %14 %16 %16 + %26 = OpLoad %6 %25 + %28 = OpFOrdLessThan %27 %24 %26 + %29 = OpSelect %6 %28 %21 %20 + OpStore %8 %29 + %35 = OpLoad %6 %8 + %39 = OpCompositeConstruct %30 %34 %35 + %40 = OpCompositeConstruct %30 %36 %37 + %41 = OpCompositeConstruct %31 %39 %40 + OpStore %33 %41 + %43 = OpAccessChain %17 %14 %16 %16 + %44 = OpLoad %6 %43 + %46 = OpAccessChain %17 %14 %16 %45 + %47 = OpLoad %6 %46 + %48 = OpFMul %6 %44 %47 + %50 = OpAccessChain %17 %14 %16 %49 + %51 = OpLoad %6 %50 + %53 = OpAccessChain %17 %14 %16 %52 + %54 = OpLoad %6 %53 + %55 = OpFMul %6 %51 %54 + %56 = OpFSub %6 %48 %55 + OpStore %42 %56 + %57 = OpLoad %31 %33 + %58 = OpExtInst %6 %1 Determinant %57 + %59 = OpLoad %6 %42 + %60 = OpFOrdEqual %27 %58 %59 + OpSelectionMerge %62 None + OpBranchConditional %60 %61 %85 + %61 = OpLabel + %72 = OpAccessChain %71 %70 %16 %16 + %73 = OpLoad %15 %72 + %74 = OpConvertSToF %6 %73 + %75 = OpAccessChain %71 %70 %16 %45 + %76 = OpLoad %15 %75 + %77 = OpConvertSToF %6 %76 + %78 = OpAccessChain %71 %70 %16 %45 + %79 = OpLoad %15 %78 + %80 = OpConvertSToF %6 %79 + %81 = OpAccessChain %71 %70 %16 %16 + %82 = OpLoad %15 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpCompositeConstruct %63 %74 %77 %80 %83 + OpStore %65 %84 + OpBranch %62 + %85 = OpLabel + %86 = OpAccessChain %71 %70 %16 %45 + %87 = OpLoad %15 %86 + %88 = OpConvertSToF %6 %87 + %89 = OpCompositeConstruct %63 %88 %88 %88 %88 + OpStore %65 %89 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 4.0 3.0 2.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-increase-negative.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-increase-negative.amber new file mode 100644 index 0000000..f768d47 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-increase-negative.amber @@ -0,0 +1,264 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine add sub code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[2]; +# for (int i = _int_0; i < _int_2; i++) +# { +# arr[i] = _int_0; +# } +# +# int a = -1; +# +# // Always true. +# if (!(gl_FragCoord.y < _float_0_0)) +# { +# arr[++a] = _int_1; +# } +# +# arr[++a] = _int_2; +# +# // Checks arr[0] == 1. Always true. +# if (arr[_int_0] == _int_1) +# { +# _GLF_color = vec4(a, _int_0, _int_0, a); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 99 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 %82 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %33 "arr" + OpName %41 "a" + OpName %46 "gl_FragCoord" + OpName %52 "buf0" + OpMemberName %52 0 "_GLF_uniform_float_values" + OpName %54 "" + OpName %82 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %46 BuiltIn FragCoord + OpDecorate %51 ArrayStride 16 + OpMemberDecorate %52 0 Offset 0 + OpDecorate %52 Block + OpDecorate %54 DescriptorSet 0 + OpDecorate %54 Binding 0 + OpDecorate %82 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %6 + %25 = OpConstant %6 2 + %28 = OpTypeBool + %30 = OpConstant %9 2 + %31 = OpTypeArray %6 %30 + %32 = OpTypePointer Function %31 + %39 = OpConstant %6 1 + %42 = OpConstant %6 -1 + %43 = OpTypeFloat 32 + %44 = OpTypeVector %43 4 + %45 = OpTypePointer Input %44 + %46 = OpVariable %45 Input + %47 = OpConstant %9 1 + %48 = OpTypePointer Input %43 + %51 = OpTypeArray %43 %47 + %52 = OpTypeStruct %51 + %53 = OpTypePointer Uniform %52 + %54 = OpVariable %53 Uniform + %55 = OpTypePointer Uniform %43 + %81 = OpTypePointer Output %44 + %82 = OpVariable %81 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %33 = OpVariable %32 Function + %41 = OpVariable %7 Function + %17 = OpAccessChain %16 %14 %15 %15 + %18 = OpLoad %6 %17 + OpStore %8 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %6 %8 + %26 = OpAccessChain %16 %14 %15 %25 + %27 = OpLoad %6 %26 + %29 = OpSLessThan %28 %24 %27 + OpBranchConditional %29 %20 %21 + %20 = OpLabel + %34 = OpLoad %6 %8 + %35 = OpAccessChain %16 %14 %15 %15 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %7 %33 %34 + OpStore %37 %36 + OpBranch %22 + %22 = OpLabel + %38 = OpLoad %6 %8 + %40 = OpIAdd %6 %38 %39 + OpStore %8 %40 + OpBranch %19 + %21 = OpLabel + OpStore %41 %42 + %49 = OpAccessChain %48 %46 %47 + %50 = OpLoad %43 %49 + %56 = OpAccessChain %55 %54 %15 %15 + %57 = OpLoad %43 %56 + %58 = OpFOrdLessThan %28 %50 %57 + %59 = OpLogicalNot %28 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %60 %61 + %60 = OpLabel + %62 = OpLoad %6 %41 + %63 = OpIAdd %6 %62 %39 + OpStore %41 %63 + %64 = OpAccessChain %16 %14 %15 %39 + %65 = OpLoad %6 %64 + %66 = OpAccessChain %7 %33 %63 + OpStore %66 %65 + OpBranch %61 + %61 = OpLabel + %67 = OpLoad %6 %41 + %68 = OpIAdd %6 %67 %39 + OpStore %41 %68 + %69 = OpAccessChain %16 %14 %15 %25 + %70 = OpLoad %6 %69 + %71 = OpAccessChain %7 %33 %68 + OpStore %71 %70 + %72 = OpAccessChain %16 %14 %15 %15 + %73 = OpLoad %6 %72 + %74 = OpAccessChain %7 %33 %73 + %75 = OpLoad %6 %74 + %76 = OpAccessChain %16 %14 %15 %39 + %77 = OpLoad %6 %76 + %78 = OpIEqual %28 %75 %77 + OpSelectionMerge %80 None + OpBranchConditional %78 %79 %94 + %79 = OpLabel + %83 = OpLoad %6 %41 + %84 = OpConvertSToF %43 %83 + %85 = OpAccessChain %16 %14 %15 %15 + %86 = OpLoad %6 %85 + %87 = OpConvertSToF %43 %86 + %88 = OpAccessChain %16 %14 %15 %15 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %43 %89 + %91 = OpLoad %6 %41 + %92 = OpConvertSToF %43 %91 + %93 = OpCompositeConstruct %44 %84 %87 %90 %92 + OpStore %82 %93 + OpBranch %80 + %94 = OpLabel + %95 = OpAccessChain %16 %14 %15 %15 + %96 = OpLoad %6 %95 + %97 = OpConvertSToF %43 %96 + %98 = OpCompositeConstruct %44 %97 %97 %97 %97 + OpStore %82 %98 + OpBranch %80 + %80 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-ldexp.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-ldexp.amber new file mode 100644 index 0000000..7edb71f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-ldexp.amber @@ -0,0 +1,227 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific inst combine add sub code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_4_5 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 4.5 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [10, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# a++; +# float b; +# for (int i = _int_0; i < _int_10; i++) +# { +# // b becomes 9.0 * 2^-1 = 4.5. +# b = ldexp(float(i), -a); +# } +# +# if (b == _float_4_5) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(b); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %59 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %22 "i" + OpName %37 "b" + OpName %48 "buf0" + OpMemberName %48 0 "_GLF_uniform_float_values" + OpName %50 "" + OpName %59 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %47 ArrayStride 16 + OpMemberDecorate %48 0 Offset 0 + OpDecorate %48 Block + OpDecorate %50 DescriptorSet 0 + OpDecorate %50 Binding 0 + OpDecorate %59 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %33 = OpTypeBool + %35 = OpTypeFloat 32 + %36 = OpTypePointer Function %35 + %46 = OpConstant %9 1 + %47 = OpTypeArray %35 %46 + %48 = OpTypeStruct %47 + %49 = OpTypePointer Uniform %48 + %50 = OpVariable %49 Uniform + %51 = OpTypePointer Uniform %35 + %57 = OpTypeVector %35 4 + %58 = OpTypePointer Output %57 + %59 = OpVariable %58 Output + %60 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %7 Function + %37 = OpVariable %36 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %20 = OpLoad %6 %8 + %21 = OpIAdd %6 %20 %16 + OpStore %8 %21 + %23 = OpAccessChain %17 %14 %15 %16 + %24 = OpLoad %6 %23 + OpStore %22 %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %6 %22 + %31 = OpAccessChain %17 %14 %15 %15 + %32 = OpLoad %6 %31 + %34 = OpSLessThan %33 %30 %32 + OpBranchConditional %34 %26 %27 + %26 = OpLabel + %38 = OpLoad %6 %22 + %39 = OpConvertSToF %35 %38 + %40 = OpLoad %6 %8 + %41 = OpSNegate %6 %40 + %42 = OpExtInst %35 %1 Ldexp %39 %41 + OpStore %37 %42 + OpBranch %28 + %28 = OpLabel + %43 = OpLoad %6 %22 + %44 = OpIAdd %6 %43 %16 + OpStore %22 %44 + OpBranch %25 + %27 = OpLabel + %45 = OpLoad %35 %37 + %52 = OpAccessChain %51 %50 %15 %15 + %53 = OpLoad %35 %52 + %54 = OpFOrdEqual %33 %45 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %74 + %55 = OpLabel + %61 = OpAccessChain %17 %14 %15 %60 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %35 %62 + %64 = OpAccessChain %17 %14 %15 %16 + %65 = OpLoad %6 %64 + %66 = OpConvertSToF %35 %65 + %67 = OpAccessChain %17 %14 %15 %16 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %35 %68 + %70 = OpAccessChain %17 %14 %15 %60 + %71 = OpLoad %6 %70 + %72 = OpConvertSToF %35 %71 + %73 = OpCompositeConstruct %57 %63 %66 %69 %72 + OpStore %59 %73 + OpBranch %56 + %74 = OpLabel + %75 = OpLoad %35 %37 + %76 = OpCompositeConstruct %57 %75 %75 %75 %75 + OpStore %59 %76 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 4.5 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg.amber new file mode 100644 index 0000000..fbe2f0c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg.amber @@ -0,0 +1,266 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific add/sub combining path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_9 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_5 _GLF_uniform_int_values[3] +# #define _int_10 _GLF_uniform_int_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [9, 1, 0, 5, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func(float f) +# { +# int a = _int_1; +# int b = _int_0; +# +# for (int i = _int_0; i < _int_10; i++) +# { +# if (a > _int_5) +# { +# break; +# } +# +# // Simplifies to a = i - 2. +# a = int(f) - 1 - _int_1 + i; +# +# b++; +# } +# +# if (b == _int_9) +# { +# return _int_1; +# } +# else +# { +# return _int_0; +# } +# } +# void main() +# { +# if (func(-9.3 + 10.0) == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 107 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %88 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "func(f1;" + OpName %10 "f" + OpName %14 "a" + OpName %18 "buf0" + OpMemberName %18 0 "_GLF_uniform_int_values" + OpName %20 "" + OpName %26 "b" + OpName %30 "i" + OpName %79 "param" + OpName %88 "_GLF_color" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %88 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeInt 32 1 + %9 = OpTypeFunction %8 %7 + %13 = OpTypePointer Function %8 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 5 + %17 = OpTypeArray %8 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpConstant %8 0 + %22 = OpConstant %8 1 + %23 = OpTypePointer Uniform %8 + %27 = OpConstant %8 2 + %39 = OpConstant %8 4 + %42 = OpTypeBool + %45 = OpConstant %8 3 + %78 = OpConstant %6 0.699999988 + %86 = OpTypeVector %6 4 + %87 = OpTypePointer Output %86 + %88 = OpVariable %87 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %79 = OpVariable %7 Function + OpStore %79 %78 + %80 = OpFunctionCall %8 %11 %79 + %81 = OpAccessChain %23 %20 %21 %22 + %82 = OpLoad %8 %81 + %83 = OpIEqual %42 %80 %82 + OpSelectionMerge %85 None + OpBranchConditional %83 %84 %102 + %84 = OpLabel + %89 = OpAccessChain %23 %20 %21 %22 + %90 = OpLoad %8 %89 + %91 = OpConvertSToF %6 %90 + %92 = OpAccessChain %23 %20 %21 %27 + %93 = OpLoad %8 %92 + %94 = OpConvertSToF %6 %93 + %95 = OpAccessChain %23 %20 %21 %27 + %96 = OpLoad %8 %95 + %97 = OpConvertSToF %6 %96 + %98 = OpAccessChain %23 %20 %21 %22 + %99 = OpLoad %8 %98 + %100 = OpConvertSToF %6 %99 + %101 = OpCompositeConstruct %86 %91 %94 %97 %100 + OpStore %88 %101 + OpBranch %85 + %102 = OpLabel + %103 = OpAccessChain %23 %20 %21 %27 + %104 = OpLoad %8 %103 + %105 = OpConvertSToF %6 %104 + %106 = OpCompositeConstruct %86 %105 %105 %105 %105 + OpStore %88 %106 + OpBranch %85 + %85 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %8 None %9 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %14 = OpVariable %13 Function + %26 = OpVariable %13 Function + %30 = OpVariable %13 Function + %24 = OpAccessChain %23 %20 %21 %22 + %25 = OpLoad %8 %24 + OpStore %14 %25 + %28 = OpAccessChain %23 %20 %21 %27 + %29 = OpLoad %8 %28 + OpStore %26 %29 + %31 = OpAccessChain %23 %20 %21 %27 + %32 = OpLoad %8 %31 + OpStore %30 %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %8 %30 + %40 = OpAccessChain %23 %20 %21 %39 + %41 = OpLoad %8 %40 + %43 = OpSLessThan %42 %38 %41 + OpBranchConditional %43 %34 %35 + %34 = OpLabel + %44 = OpLoad %8 %14 + %46 = OpAccessChain %23 %20 %21 %45 + %47 = OpLoad %8 %46 + %48 = OpSGreaterThan %42 %44 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %50 + %49 = OpLabel + OpBranch %35 + %50 = OpLabel + %52 = OpLoad %6 %10 + %53 = OpConvertFToS %8 %52 + %54 = OpISub %8 %53 %22 + %55 = OpAccessChain %23 %20 %21 %22 + %56 = OpLoad %8 %55 + %57 = OpISub %8 %54 %56 + %58 = OpLoad %8 %30 + %59 = OpIAdd %8 %57 %58 + OpStore %14 %59 + %60 = OpLoad %8 %26 + %61 = OpIAdd %8 %60 %22 + OpStore %26 %61 + OpBranch %36 + %36 = OpLabel + %62 = OpLoad %8 %30 + %63 = OpIAdd %8 %62 %22 + OpStore %30 %63 + OpBranch %33 + %35 = OpLabel + %64 = OpLoad %8 %26 + %65 = OpAccessChain %23 %20 %21 %21 + %66 = OpLoad %8 %65 + %67 = OpIEqual %42 %64 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %73 + %68 = OpLabel + %70 = OpAccessChain %23 %20 %21 %22 + %71 = OpLoad %8 %70 + OpReturnValue %71 + %73 = OpLabel + %74 = OpAccessChain %23 %20 %21 %27 + %75 = OpLoad %8 %74 + OpReturnValue %75 + %69 = OpLabel + OpUnreachable + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 9 1 0 5 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-pre-increase.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-pre-increase.amber new file mode 100644 index 0000000..5b59324 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-add-sub-pre-increase.amber @@ -0,0 +1,273 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers specific inst combine add sub and dag combiner code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [10, 1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int f1() +# { +# int A[10]; +# for (int i = _int_0; i < _int_10; i++) +# { +# A[i] = _int_0; +# } +# +# int a = -1; +# +# // Always true. +# if (gl_FragCoord.y >= _float_0_0) +# { +# A[++a] = _int_1; +# } +# +# // Always returns 0. +# if (A[_int_0] == _int_1) +# { +# return A[++a]; +# } +# else +# { +# return _int_1; +# } +# } +# +# void main() +# { +# int i = f1(); +# _GLF_color = vec4(_int_1, i, i, _int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 103 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %49 %91 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f1(" + OpName %11 "i" + OpName %15 "buf1" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %36 "A" + OpName %44 "a" + OpName %49 "gl_FragCoord" + OpName %55 "buf0" + OpMemberName %55 0 "_GLF_uniform_float_values" + OpName %57 "" + OpName %88 "i" + OpName %91 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 1 + OpDecorate %49 BuiltIn FragCoord + OpDecorate %54 ArrayStride 16 + OpMemberDecorate %55 0 Offset 0 + OpDecorate %55 Block + OpDecorate %57 DescriptorSet 0 + OpDecorate %57 Binding 0 + OpDecorate %91 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 3 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpConstant %6 2 + %20 = OpTypePointer Uniform %6 + %31 = OpTypeBool + %33 = OpConstant %12 10 + %34 = OpTypeArray %6 %33 + %35 = OpTypePointer Function %34 + %42 = OpConstant %6 1 + %45 = OpConstant %6 -1 + %46 = OpTypeFloat 32 + %47 = OpTypeVector %46 4 + %48 = OpTypePointer Input %47 + %49 = OpVariable %48 Input + %50 = OpConstant %12 1 + %51 = OpTypePointer Input %46 + %54 = OpTypeArray %46 %50 + %55 = OpTypeStruct %54 + %56 = OpTypePointer Uniform %55 + %57 = OpVariable %56 Uniform + %58 = OpTypePointer Uniform %46 + %90 = OpTypePointer Output %47 + %91 = OpVariable %90 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %88 = OpVariable %10 Function + %89 = OpFunctionCall %6 %8 + OpStore %88 %89 + %92 = OpAccessChain %20 %17 %18 %42 + %93 = OpLoad %6 %92 + %94 = OpConvertSToF %46 %93 + %95 = OpLoad %6 %88 + %96 = OpConvertSToF %46 %95 + %97 = OpLoad %6 %88 + %98 = OpConvertSToF %46 %97 + %99 = OpAccessChain %20 %17 %18 %42 + %100 = OpLoad %6 %99 + %101 = OpConvertSToF %46 %100 + %102 = OpCompositeConstruct %47 %94 %96 %98 %101 + OpStore %91 %102 + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %36 = OpVariable %35 Function + %44 = OpVariable %10 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %6 %21 + OpStore %11 %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %6 %11 + %29 = OpAccessChain %20 %17 %18 %18 + %30 = OpLoad %6 %29 + %32 = OpSLessThan %31 %28 %30 + OpBranchConditional %32 %24 %25 + %24 = OpLabel + %37 = OpLoad %6 %11 + %38 = OpAccessChain %20 %17 %18 %19 + %39 = OpLoad %6 %38 + %40 = OpAccessChain %10 %36 %37 + OpStore %40 %39 + OpBranch %26 + %26 = OpLabel + %41 = OpLoad %6 %11 + %43 = OpIAdd %6 %41 %42 + OpStore %11 %43 + OpBranch %23 + %25 = OpLabel + OpStore %44 %45 + %52 = OpAccessChain %51 %49 %50 + %53 = OpLoad %46 %52 + %59 = OpAccessChain %58 %57 %18 %18 + %60 = OpLoad %46 %59 + %61 = OpFOrdGreaterThanEqual %31 %53 %60 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %63 + %62 = OpLabel + %64 = OpLoad %6 %44 + %65 = OpIAdd %6 %64 %42 + OpStore %44 %65 + %66 = OpAccessChain %20 %17 %18 %42 + %67 = OpLoad %6 %66 + %68 = OpAccessChain %10 %36 %65 + OpStore %68 %67 + OpBranch %63 + %63 = OpLabel + %69 = OpAccessChain %20 %17 %18 %19 + %70 = OpLoad %6 %69 + %71 = OpAccessChain %10 %36 %70 + %72 = OpLoad %6 %71 + %73 = OpAccessChain %20 %17 %18 %42 + %74 = OpLoad %6 %73 + %75 = OpIEqual %31 %72 %74 + OpSelectionMerge %77 None + OpBranchConditional %75 %76 %83 + %76 = OpLabel + %78 = OpLoad %6 %44 + %79 = OpIAdd %6 %78 %42 + OpStore %44 %79 + %80 = OpAccessChain %10 %36 %79 + %81 = OpLoad %6 %80 + OpReturnValue %81 + %83 = OpLabel + %84 = OpAccessChain %20 %17 %18 %42 + %85 = OpLoad %6 %84 + OpReturnValue %85 + %77 = OpLabel + OpUnreachable + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-for-bitfieldinsert.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-for-bitfieldinsert.amber new file mode 100644 index 0000000..eb436f4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-for-bitfieldinsert.amber @@ -0,0 +1,138 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine and or xor code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# +# precision highp int; +# +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 1; +# +# for (int i = 0; i < 2; i++) +# { +# a = bitfieldInsert(1, 1, 1, i); +# } +# +# if (a == 3) { +# _GLF_color = vec4(1, 0, 0, 1); +# } else { +# _GLF_color = vec4(0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %10 "i" + OpName %33 "_GLF_color" + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %11 = OpConstant %6 0 + %18 = OpConstant %6 2 + %19 = OpTypeBool + %26 = OpConstant %6 3 + %30 = OpTypeFloat 32 + %31 = OpTypeVector %30 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpConstant %30 1 + %35 = OpConstant %30 0 + %36 = OpConstantComposite %31 %34 %35 %35 %34 + %38 = OpConstantComposite %31 %35 %35 %35 %35 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %11 + OpBranch %12 + %12 = OpLabel + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + %17 = OpLoad %6 %10 + %20 = OpSLessThan %19 %17 %18 + OpBranchConditional %20 %13 %14 + %13 = OpLabel + %21 = OpLoad %6 %10 + %22 = OpBitFieldInsert %6 %9 %9 %9 %21 + OpStore %8 %22 + OpBranch %15 + %15 = OpLabel + %23 = OpLoad %6 %10 + %24 = OpIAdd %6 %23 %9 + OpStore %10 %24 + OpBranch %12 + %14 = OpLabel + %25 = OpLoad %6 %8 + %27 = OpIEqual %19 %25 %26 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %37 + %28 = OpLabel + OpStore %33 %36 + OpBranch %29 + %37 = OpLabel + OpStore %33 %38 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack.amber new file mode 100644 index 0000000..125e1b1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack.amber @@ -0,0 +1,288 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine and or xor code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_127_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 127.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [3, 0, 2, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Packs the components into an unsigned integer of 4294967295u. +# uint a = packUnorm4x8(vec4(_float_1_0)); +# +# // Unpacks the packed integer into signed integers and converts them into +# // normalized floating-point values. +# vec4 v1 = unpackSnorm4x8(a); +# +# // Reference values. The unpacked values were also divided by 127.0, thus they +# // can be compared to the reference value regardless of loss of precision. +# vec4 ref = vec4(-_float_1_0 / _float_127_0, -_float_1_0 / _float_127_0, +# -_float_1_0 / _float_127_0, -_float_1_0 / _float_127_0); +# +# if (v1[_int_0] == ref[_int_3] && v1[_int_1] == ref[_int_2] && +# v1[_int_2] == ref[_int_1] && v1[_int_3] == ref[_int_0]) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(v1[_int_0]); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 132 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %112 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %24 "v1" + OpName %27 "ref" + OpName %57 "buf1" + OpMemberName %57 0 "_GLF_uniform_int_values" + OpName %59 "" + OpName %112 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %56 ArrayStride 16 + OpMemberDecorate %57 0 Offset 0 + OpDecorate %57 Block + OpDecorate %59 DescriptorSet 0 + OpDecorate %59 Binding 1 + OpDecorate %112 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpConstant %6 2 + %11 = OpTypeArray %9 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %9 + %20 = OpTypeVector %9 4 + %23 = OpTypePointer Function %20 + %31 = OpConstant %15 1 + %54 = OpTypeBool + %55 = OpConstant %6 4 + %56 = OpTypeArray %15 %55 + %57 = OpTypeStruct %56 + %58 = OpTypePointer Uniform %57 + %59 = OpVariable %58 Uniform + %60 = OpTypePointer Uniform %15 + %63 = OpTypePointer Function %9 + %73 = OpConstant %15 3 + %78 = OpConstant %15 2 + %111 = OpTypePointer Output %20 + %112 = OpVariable %111 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %24 = OpVariable %23 Function + %27 = OpVariable %23 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %9 %18 + %21 = OpCompositeConstruct %20 %19 %19 %19 %19 + %22 = OpExtInst %6 %1 PackUnorm4x8 %21 + OpStore %8 %22 + %25 = OpLoad %6 %8 + %26 = OpExtInst %20 %1 UnpackSnorm4x8 %25 + OpStore %24 %26 + %28 = OpAccessChain %17 %14 %16 %16 + %29 = OpLoad %9 %28 + %30 = OpFNegate %9 %29 + %32 = OpAccessChain %17 %14 %16 %31 + %33 = OpLoad %9 %32 + %34 = OpFDiv %9 %30 %33 + %35 = OpAccessChain %17 %14 %16 %16 + %36 = OpLoad %9 %35 + %37 = OpFNegate %9 %36 + %38 = OpAccessChain %17 %14 %16 %31 + %39 = OpLoad %9 %38 + %40 = OpFDiv %9 %37 %39 + %41 = OpAccessChain %17 %14 %16 %16 + %42 = OpLoad %9 %41 + %43 = OpFNegate %9 %42 + %44 = OpAccessChain %17 %14 %16 %31 + %45 = OpLoad %9 %44 + %46 = OpFDiv %9 %43 %45 + %47 = OpAccessChain %17 %14 %16 %16 + %48 = OpLoad %9 %47 + %49 = OpFNegate %9 %48 + %50 = OpAccessChain %17 %14 %16 %31 + %51 = OpLoad %9 %50 + %52 = OpFDiv %9 %49 %51 + %53 = OpCompositeConstruct %20 %34 %40 %46 %52 + OpStore %27 %53 + %61 = OpAccessChain %60 %59 %16 %31 + %62 = OpLoad %15 %61 + %64 = OpAccessChain %63 %24 %62 + %65 = OpLoad %9 %64 + %66 = OpAccessChain %60 %59 %16 %16 + %67 = OpLoad %15 %66 + %68 = OpAccessChain %63 %27 %67 + %69 = OpLoad %9 %68 + %70 = OpFOrdEqual %54 %65 %69 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %72 + %71 = OpLabel + %74 = OpAccessChain %60 %59 %16 %73 + %75 = OpLoad %15 %74 + %76 = OpAccessChain %63 %24 %75 + %77 = OpLoad %9 %76 + %79 = OpAccessChain %60 %59 %16 %78 + %80 = OpLoad %15 %79 + %81 = OpAccessChain %63 %27 %80 + %82 = OpLoad %9 %81 + %83 = OpFOrdEqual %54 %77 %82 + OpBranch %72 + %72 = OpLabel + %84 = OpPhi %54 %70 %5 %83 %71 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %86 + %85 = OpLabel + %87 = OpAccessChain %60 %59 %16 %78 + %88 = OpLoad %15 %87 + %89 = OpAccessChain %63 %24 %88 + %90 = OpLoad %9 %89 + %91 = OpAccessChain %60 %59 %16 %73 + %92 = OpLoad %15 %91 + %93 = OpAccessChain %63 %27 %92 + %94 = OpLoad %9 %93 + %95 = OpFOrdEqual %54 %90 %94 + OpBranch %86 + %86 = OpLabel + %96 = OpPhi %54 %84 %72 %95 %85 + OpSelectionMerge %98 None + OpBranchConditional %96 %97 %98 + %97 = OpLabel + %99 = OpAccessChain %60 %59 %16 %16 + %100 = OpLoad %15 %99 + %101 = OpAccessChain %63 %24 %100 + %102 = OpLoad %9 %101 + %103 = OpAccessChain %60 %59 %16 %31 + %104 = OpLoad %15 %103 + %105 = OpAccessChain %63 %27 %104 + %106 = OpLoad %9 %105 + %107 = OpFOrdEqual %54 %102 %106 + OpBranch %98 + %98 = OpLabel + %108 = OpPhi %54 %96 %86 %107 %97 + OpSelectionMerge %110 None + OpBranchConditional %108 %109 %126 + %109 = OpLabel + %113 = OpAccessChain %60 %59 %16 %73 + %114 = OpLoad %15 %113 + %115 = OpConvertSToF %9 %114 + %116 = OpAccessChain %60 %59 %16 %31 + %117 = OpLoad %15 %116 + %118 = OpConvertSToF %9 %117 + %119 = OpAccessChain %60 %59 %16 %31 + %120 = OpLoad %15 %119 + %121 = OpConvertSToF %9 %120 + %122 = OpAccessChain %60 %59 %16 %73 + %123 = OpLoad %15 %122 + %124 = OpConvertSToF %9 %123 + %125 = OpCompositeConstruct %20 %115 %118 %121 %124 + OpStore %112 %125 + OpBranch %110 + %126 = OpLabel + %127 = OpAccessChain %60 %59 %16 %31 + %128 = OpLoad %15 %127 + %129 = OpAccessChain %63 %24 %128 + %130 = OpLoad %9 %129 + %131 = OpCompositeConstruct %20 %130 %130 %130 %130 + OpStore %112 %131 + OpBranch %110 + %110 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 0 2 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 127.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-switch.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-switch.amber new file mode 100644 index 0000000..4ba9323 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-switch.amber @@ -0,0 +1,235 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine and or xor code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_4 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_10 _GLF_uniform_int_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [4, 2, 0, 1, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int count0 = _int_0; +# int count1 = _int_0; +# for (int i = _int_0; i < _int_10; i++) +# { +# switch (i) +# { +# case 0: +# case 1: +# count0++; +# case 3: +# case 2: +# count1++; +# } +# } +# if (count1 == _int_4) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# if (count0 != _int_2) +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 88 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %58 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "count0" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "count1" + OpName %23 "i" + OpName %58 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %58 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 5 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %32 = OpConstant %6 4 + %35 = OpTypeBool + %42 = OpConstant %6 1 + %55 = OpTypeFloat 32 + %56 = OpTypeVector %55 4 + %57 = OpTypePointer Output %56 + %58 = OpVariable %57 Output + %59 = OpConstant %6 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %23 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %21 = OpAccessChain %17 %14 %15 %16 + %22 = OpLoad %6 %21 + OpStore %20 %22 + %24 = OpAccessChain %17 %14 %15 %16 + %25 = OpLoad %6 %24 + OpStore %23 %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %6 %23 + %33 = OpAccessChain %17 %14 %15 %32 + %34 = OpLoad %6 %33 + %36 = OpSLessThan %35 %31 %34 + OpBranchConditional %36 %27 %28 + %27 = OpLabel + %37 = OpLoad %6 %23 + OpSelectionMerge %40 None + OpSwitch %37 %40 0 %38 1 %38 3 %39 2 %39 + %38 = OpLabel + %41 = OpLoad %6 %8 + %43 = OpIAdd %6 %41 %42 + OpStore %8 %43 + OpBranch %39 + %39 = OpLabel + %44 = OpLoad %6 %20 + %45 = OpIAdd %6 %44 %42 + OpStore %20 %45 + OpBranch %40 + %40 = OpLabel + OpBranch %29 + %29 = OpLabel + %47 = OpLoad %6 %23 + %48 = OpIAdd %6 %47 %42 + OpStore %23 %48 + OpBranch %26 + %28 = OpLabel + %49 = OpLoad %6 %20 + %50 = OpAccessChain %17 %14 %15 %15 + %51 = OpLoad %6 %50 + %52 = OpIEqual %35 %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %73 + %53 = OpLabel + %60 = OpAccessChain %17 %14 %15 %59 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %55 %61 + %63 = OpAccessChain %17 %14 %15 %16 + %64 = OpLoad %6 %63 + %65 = OpConvertSToF %55 %64 + %66 = OpAccessChain %17 %14 %15 %16 + %67 = OpLoad %6 %66 + %68 = OpConvertSToF %55 %67 + %69 = OpAccessChain %17 %14 %15 %59 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %55 %70 + %72 = OpCompositeConstruct %56 %62 %65 %68 %71 + OpStore %58 %72 + OpBranch %54 + %73 = OpLabel + %74 = OpAccessChain %17 %14 %15 %16 + %75 = OpLoad %6 %74 + %76 = OpConvertSToF %55 %75 + %77 = OpCompositeConstruct %56 %76 %76 %76 %76 + OpStore %58 %77 + OpBranch %54 + %54 = OpLabel + %78 = OpLoad %6 %8 + %79 = OpAccessChain %17 %14 %15 %42 + %80 = OpLoad %6 %79 + %81 = OpINotEqual %35 %78 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %83 + %82 = OpLabel + %84 = OpAccessChain %17 %14 %15 %16 + %85 = OpLoad %6 %84 + %86 = OpConvertSToF %55 %85 + %87 = OpCompositeConstruct %56 %86 %86 %86 %86 + OpStore %58 %87 + OpBranch %83 + %83 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 4 2 0 1 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add.amber new file mode 100644 index 0000000..5d427f9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add.amber @@ -0,0 +1,203 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine and or xor code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float data[2]; +# data[_int_0] = _float_0_0; +# data[_int_1] = _float_1_0; +# float a = data[(1 ^ (_int_1 & 2))]; +# if (a == _float_1_0) +# { +# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0); +# } +# else +# { +# _GLF_color = vec4(_float_0_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %53 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "data" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %22 "buf1" + OpMemberName %22 0 "_GLF_uniform_float_values" + OpName %24 "" + OpName %36 "a" + OpName %53 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %21 ArrayStride 16 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 1 + OpDecorate %53 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 2 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpTypeInt 32 1 + %13 = OpTypeArray %12 %8 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %12 0 + %18 = OpTypePointer Uniform %12 + %21 = OpTypeArray %6 %8 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpTypePointer Uniform %6 + %28 = OpTypePointer Function %6 + %30 = OpConstant %12 1 + %39 = OpConstant %12 2 + %47 = OpTypeBool + %51 = OpTypeVector %6 4 + %52 = OpTypePointer Output %51 + %53 = OpVariable %52 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %36 = OpVariable %28 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %12 %19 + %26 = OpAccessChain %25 %24 %17 %17 + %27 = OpLoad %6 %26 + %29 = OpAccessChain %28 %11 %20 + OpStore %29 %27 + %31 = OpAccessChain %18 %16 %17 %30 + %32 = OpLoad %12 %31 + %33 = OpAccessChain %25 %24 %17 %30 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %28 %11 %32 + OpStore %35 %34 + %37 = OpAccessChain %18 %16 %17 %30 + %38 = OpLoad %12 %37 + %40 = OpBitwiseAnd %12 %38 %39 + %41 = OpBitwiseXor %12 %30 %40 + %42 = OpAccessChain %28 %11 %41 + %43 = OpLoad %6 %42 + OpStore %36 %43 + %44 = OpLoad %6 %36 + %45 = OpAccessChain %25 %24 %17 %30 + %46 = OpLoad %6 %45 + %48 = OpFOrdEqual %47 %44 %46 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %63 + %49 = OpLabel + %54 = OpAccessChain %25 %24 %17 %30 + %55 = OpLoad %6 %54 + %56 = OpAccessChain %25 %24 %17 %17 + %57 = OpLoad %6 %56 + %58 = OpAccessChain %25 %24 %17 %17 + %59 = OpLoad %6 %58 + %60 = OpAccessChain %25 %24 %17 %30 + %61 = OpLoad %6 %60 + %62 = OpCompositeConstruct %51 %55 %57 %59 %61 + OpStore %53 %62 + OpBranch %50 + %63 = OpLabel + %64 = OpAccessChain %25 %24 %17 %17 + %65 = OpLoad %6 %64 + %66 = OpCompositeConstruct %51 %65 %65 %65 %65 + OpStore %53 %66 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-combine-select-uaddcarry.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-combine-select-uaddcarry.amber new file mode 100644 index 0000000..4da8d88 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-combine-select-uaddcarry.amber @@ -0,0 +1,333 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers a specific instruction combine compares and combine select code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _uint_1 _GLF_uniform_uint_values[0] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_uint_values: 1 +# layout(set = 0, binding = 1) uniform buf1 +# { +# uint _GLF_uniform_uint_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [2, 0, 1] +# layout(set = 0, binding = 2) uniform buf2 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S { +# int a; +# }; +# +# // Always returns 1. +# int f1() +# { +# S A = S(1); +# int i = _int_0; +# for (int i = _int_0; i < _int_0 + _int_2; i++) +# { +# if (A.a == clamp(i, _int_0, 1)) +# { +# return _int_1; +# } +# } +# +# // The function returns before reaching this. +# return _int_2; +# } +# +# // Always returns 1.0. +# float f2() +# { +# return float(f1()); +# } +# +# void main() +# { +# uint a = _uint_1; +# uint b = uaddCarry(uint(2 * _int_0), uint(_int_0), a); +# if (b == 0u && f2() == _float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 130 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %111 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f1(" + OpName %12 "f2(" + OpName %14 "S" + OpMemberName %14 0 "a" + OpName %16 "A" + OpName %20 "i" + OpName %24 "buf2" + OpMemberName %24 0 "_GLF_uniform_int_values" + OpName %26 "" + OpName %31 "i" + OpName %71 "a" + OpName %74 "buf1" + OpMemberName %74 0 "_GLF_uniform_uint_values" + OpName %76 "" + OpName %80 "b" + OpName %88 "ResType" + OpName %99 "buf0" + OpMemberName %99 0 "_GLF_uniform_float_values" + OpName %101 "" + OpName %111 "_GLF_color" + OpDecorate %23 ArrayStride 16 + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 2 + OpDecorate %73 ArrayStride 16 + OpMemberDecorate %74 0 Offset 0 + OpDecorate %74 Block + OpDecorate %76 DescriptorSet 0 + OpDecorate %76 Binding 1 + OpDecorate %98 ArrayStride 16 + OpMemberDecorate %99 0 Offset 0 + OpDecorate %99 Block + OpDecorate %101 DescriptorSet 0 + OpDecorate %101 Binding 0 + OpDecorate %111 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypeFloat 32 + %11 = OpTypeFunction %10 + %14 = OpTypeStruct %6 + %15 = OpTypePointer Function %14 + %17 = OpConstant %6 1 + %18 = OpConstantComposite %14 %17 + %19 = OpTypePointer Function %6 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 3 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpConstant %6 0 + %28 = OpTypePointer Uniform %6 + %45 = OpTypeBool + %56 = OpConstant %6 2 + %70 = OpTypePointer Function %21 + %72 = OpConstant %21 1 + %73 = OpTypeArray %21 %72 + %74 = OpTypeStruct %73 + %75 = OpTypePointer Uniform %74 + %76 = OpVariable %75 Uniform + %77 = OpTypePointer Uniform %21 + %88 = OpTypeStruct %21 %21 + %93 = OpConstant %21 0 + %98 = OpTypeArray %10 %72 + %99 = OpTypeStruct %98 + %100 = OpTypePointer Uniform %99 + %101 = OpVariable %100 Uniform + %102 = OpTypePointer Uniform %10 + %109 = OpTypeVector %10 4 + %110 = OpTypePointer Output %109 + %111 = OpVariable %110 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %71 = OpVariable %70 Function + %80 = OpVariable %70 Function + %78 = OpAccessChain %77 %76 %27 %27 + %79 = OpLoad %21 %78 + OpStore %71 %79 + %81 = OpAccessChain %28 %26 %27 %17 + %82 = OpLoad %6 %81 + %83 = OpIMul %6 %56 %82 + %84 = OpBitcast %21 %83 + %85 = OpAccessChain %28 %26 %27 %17 + %86 = OpLoad %6 %85 + %87 = OpBitcast %21 %86 + %89 = OpIAddCarry %88 %84 %87 + %90 = OpCompositeExtract %21 %89 1 + OpStore %71 %90 + %91 = OpCompositeExtract %21 %89 0 + OpStore %80 %91 + %92 = OpLoad %21 %80 + %94 = OpIEqual %45 %92 %93 + OpSelectionMerge %96 None + OpBranchConditional %94 %95 %96 + %95 = OpLabel + %97 = OpFunctionCall %10 %12 + %103 = OpAccessChain %102 %101 %27 %27 + %104 = OpLoad %10 %103 + %105 = OpFOrdEqual %45 %97 %104 + OpBranch %96 + %96 = OpLabel + %106 = OpPhi %45 %94 %5 %105 %95 + OpSelectionMerge %108 None + OpBranchConditional %106 %107 %125 + %107 = OpLabel + %112 = OpAccessChain %28 %26 %27 %56 + %113 = OpLoad %6 %112 + %114 = OpConvertSToF %10 %113 + %115 = OpAccessChain %28 %26 %27 %17 + %116 = OpLoad %6 %115 + %117 = OpConvertSToF %10 %116 + %118 = OpAccessChain %28 %26 %27 %17 + %119 = OpLoad %6 %118 + %120 = OpConvertSToF %10 %119 + %121 = OpAccessChain %28 %26 %27 %56 + %122 = OpLoad %6 %121 + %123 = OpConvertSToF %10 %122 + %124 = OpCompositeConstruct %109 %114 %117 %120 %123 + OpStore %111 %124 + OpBranch %108 + %125 = OpLabel + %126 = OpAccessChain %28 %26 %27 %56 + %127 = OpLoad %6 %126 + %128 = OpConvertSToF %10 %127 + %129 = OpCompositeConstruct %109 %128 %128 %128 %128 + OpStore %111 %129 + OpBranch %108 + %108 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %16 = OpVariable %15 Function + %20 = OpVariable %19 Function + %31 = OpVariable %19 Function + OpStore %16 %18 + %29 = OpAccessChain %28 %26 %27 %17 + %30 = OpLoad %6 %29 + OpStore %20 %30 + %32 = OpAccessChain %28 %26 %27 %17 + %33 = OpLoad %6 %32 + OpStore %31 %33 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %6 %31 + %40 = OpAccessChain %28 %26 %27 %17 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %28 %26 %27 %27 + %43 = OpLoad %6 %42 + %44 = OpIAdd %6 %41 %43 + %46 = OpSLessThan %45 %39 %44 + OpBranchConditional %46 %35 %36 + %35 = OpLabel + %47 = OpAccessChain %19 %16 %27 + %48 = OpLoad %6 %47 + %49 = OpLoad %6 %31 + %50 = OpAccessChain %28 %26 %27 %17 + %51 = OpLoad %6 %50 + %52 = OpExtInst %6 %1 SClamp %49 %51 %17 + %53 = OpIEqual %45 %48 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %55 + %54 = OpLabel + %57 = OpAccessChain %28 %26 %27 %56 + %58 = OpLoad %6 %57 + OpReturnValue %58 + %55 = OpLabel + OpBranch %37 + %37 = OpLabel + %60 = OpLoad %6 %31 + %61 = OpIAdd %6 %60 %17 + OpStore %31 %61 + OpBranch %34 + %36 = OpLabel + %62 = OpAccessChain %28 %26 %27 %27 + %63 = OpLoad %6 %62 + OpReturnValue %63 + OpFunctionEnd + %12 = OpFunction %10 None %11 + %13 = OpLabel + %66 = OpFunctionCall %6 %8 + %67 = OpConvertSToF %10 %66 + OpReturnValue %67 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 0 1 +END +# _GLF_uniform_uint_values +BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA + 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-isnan.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-isnan.amber new file mode 100644 index 0000000..a54455b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-isnan.amber @@ -0,0 +1,151 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction combine compare code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# if (isnan((-_GLF_color).x)) +# { +# _GLF_color = vec4(_int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 RelaxedPrecision + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %20 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpConstant %10 1 + %35 = OpConstant %11 0 + %37 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %23 = OpAccessChain %18 %16 %17 %22 + %24 = OpLoad %10 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpAccessChain %18 %16 %17 %22 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %10 %29 + %31 = OpConvertSToF %6 %30 + %32 = OpCompositeConstruct %7 %21 %25 %28 %31 + OpStore %9 %32 + %33 = OpLoad %7 %9 + %34 = OpFNegate %7 %33 + %36 = OpCompositeExtract %6 %34 0 + %38 = OpIsNan %37 %36 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + %41 = OpAccessChain %18 %16 %17 %17 + %42 = OpLoad %10 %41 + %43 = OpConvertSToF %6 %42 + %44 = OpCompositeConstruct %7 %43 %43 %43 %43 + OpStore %9 %44 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-ldexp.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-ldexp.amber new file mode 100644 index 0000000..77b17ac --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-ldexp.amber @@ -0,0 +1,188 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction combine compares code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# if (ldexp(_float_0_0, 10000) == _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %28 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "buf0" + OpMemberName %10 0 "_GLF_uniform_float_values" + OpName %12 "" + OpName %28 "_GLF_color" + OpName %31 "buf1" + OpMemberName %31 0 "_GLF_uniform_int_values" + OpName %33 "" + OpDecorate %9 ArrayStride 16 + OpMemberDecorate %10 0 Offset 0 + OpDecorate %10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %28 Location 0 + OpDecorate %30 ArrayStride 16 + OpMemberDecorate %31 0 Offset 0 + OpDecorate %31 Block + OpDecorate %33 DescriptorSet 0 + OpDecorate %33 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 1 + %9 = OpTypeArray %6 %8 + %10 = OpTypeStruct %9 + %11 = OpTypePointer Uniform %10 + %12 = OpVariable %11 Uniform + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %6 + %18 = OpConstant %13 10000 + %22 = OpTypeBool + %26 = OpTypeVector %6 4 + %27 = OpTypePointer Output %26 + %28 = OpVariable %27 Output + %29 = OpConstant %7 2 + %30 = OpTypeArray %13 %29 + %31 = OpTypeStruct %30 + %32 = OpTypePointer Uniform %31 + %33 = OpVariable %32 Uniform + %34 = OpConstant %13 1 + %35 = OpTypePointer Uniform %13 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %16 = OpAccessChain %15 %12 %14 %14 + %17 = OpLoad %6 %16 + %19 = OpExtInst %6 %1 Ldexp %17 %18 + %20 = OpAccessChain %15 %12 %14 %14 + %21 = OpLoad %6 %20 + %23 = OpFOrdEqual %22 %19 %21 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %49 + %24 = OpLabel + %36 = OpAccessChain %35 %33 %14 %34 + %37 = OpLoad %13 %36 + %38 = OpConvertSToF %6 %37 + %39 = OpAccessChain %35 %33 %14 %14 + %40 = OpLoad %13 %39 + %41 = OpConvertSToF %6 %40 + %42 = OpAccessChain %35 %33 %14 %14 + %43 = OpLoad %13 %42 + %44 = OpConvertSToF %6 %43 + %45 = OpAccessChain %35 %33 %14 %34 + %46 = OpLoad %13 %45 + %47 = OpConvertSToF %6 %46 + %48 = OpCompositeConstruct %26 %38 %41 %44 %47 + OpStore %28 %48 + OpBranch %25 + %49 = OpLabel + %50 = OpAccessChain %35 %33 %14 %34 + %51 = OpLoad %13 %50 + %52 = OpConvertSToF %6 %51 + %53 = OpAccessChain %35 %33 %14 %14 + %54 = OpLoad %13 %53 + %55 = OpConvertSToF %6 %54 + %56 = OpAccessChain %35 %33 %14 %14 + %57 = OpLoad %13 %56 + %58 = OpConvertSToF %6 %57 + %59 = OpAccessChain %35 %33 %14 %34 + %60 = OpLoad %13 %59 + %61 = OpConvertSToF %6 %60 + %62 = OpCompositeConstruct %26 %52 %55 %58 %61 + OpStore %28 %62 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp.amber new file mode 100644 index 0000000..2421af2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp.amber @@ -0,0 +1,266 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine compares code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_2_0 _GLF_uniform_float_values[2] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0, 2.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float f1(float a) +# { +# int b = 8; +# +# if (gl_FragCoord.y >= _float_0_0) +# { +# ++b; +# ++b; +# } +# +# // Always false. +# if (a < _float_1_0) +# { +# return _float_1_0; +# } +# +# float c = float(clamp(b, 0, 2)); +# +# // Always returns 2.0. +# return c; +# } +# +# void main() +# { +# float a = f1(_float_1_0); +# if (a == _float_2_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 96 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %18 %71 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "f1(f1;" + OpName %9 "a" + OpName %14 "b" + OpName %18 "gl_FragCoord" + OpName %26 "buf0" + OpMemberName %26 0 "_GLF_uniform_float_values" + OpName %28 "" + OpName %51 "c" + OpName %59 "a" + OpName %60 "param" + OpName %71 "_GLF_color" + OpName %74 "buf1" + OpMemberName %74 0 "_GLF_uniform_int_values" + OpName %76 "" + OpDecorate %18 BuiltIn FragCoord + OpDecorate %25 ArrayStride 16 + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 0 + OpDecorate %71 Location 0 + OpDecorate %73 ArrayStride 16 + OpMemberDecorate %74 0 Offset 0 + OpDecorate %74 Block + OpDecorate %76 DescriptorSet 0 + OpDecorate %76 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %12 = OpTypeInt 32 1 + %13 = OpTypePointer Function %12 + %15 = OpConstant %12 8 + %16 = OpTypeVector %6 4 + %17 = OpTypePointer Input %16 + %18 = OpVariable %17 Input + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 1 + %21 = OpTypePointer Input %6 + %24 = OpConstant %19 3 + %25 = OpTypeArray %6 %24 + %26 = OpTypeStruct %25 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpConstant %12 0 + %30 = OpTypePointer Uniform %6 + %33 = OpTypeBool + %38 = OpConstant %12 1 + %53 = OpConstant %12 2 + %70 = OpTypePointer Output %16 + %71 = OpVariable %70 Output + %72 = OpConstant %19 2 + %73 = OpTypeArray %12 %72 + %74 = OpTypeStruct %73 + %75 = OpTypePointer Uniform %74 + %76 = OpVariable %75 Uniform + %77 = OpTypePointer Uniform %12 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %59 = OpVariable %7 Function + %60 = OpVariable %7 Function + %61 = OpAccessChain %30 %28 %29 %38 + %62 = OpLoad %6 %61 + OpStore %60 %62 + %63 = OpFunctionCall %6 %10 %60 + OpStore %59 %63 + %64 = OpLoad %6 %59 + %65 = OpAccessChain %30 %28 %29 %53 + %66 = OpLoad %6 %65 + %67 = OpFOrdEqual %33 %64 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %91 + %68 = OpLabel + %78 = OpAccessChain %77 %76 %29 %38 + %79 = OpLoad %12 %78 + %80 = OpConvertSToF %6 %79 + %81 = OpAccessChain %77 %76 %29 %29 + %82 = OpLoad %12 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpAccessChain %77 %76 %29 %29 + %85 = OpLoad %12 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpAccessChain %77 %76 %29 %38 + %88 = OpLoad %12 %87 + %89 = OpConvertSToF %6 %88 + %90 = OpCompositeConstruct %16 %80 %83 %86 %89 + OpStore %71 %90 + OpBranch %69 + %91 = OpLabel + %92 = OpAccessChain %77 %76 %29 %29 + %93 = OpLoad %12 %92 + %94 = OpConvertSToF %6 %93 + %95 = OpCompositeConstruct %16 %94 %94 %94 %94 + OpStore %71 %95 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %14 = OpVariable %13 Function + %51 = OpVariable %7 Function + OpStore %14 %15 + %22 = OpAccessChain %21 %18 %20 + %23 = OpLoad %6 %22 + %31 = OpAccessChain %30 %28 %29 %29 + %32 = OpLoad %6 %31 + %34 = OpFOrdGreaterThanEqual %33 %23 %32 + OpSelectionMerge %36 None + OpBranchConditional %34 %35 %36 + %35 = OpLabel + %37 = OpLoad %12 %14 + %39 = OpIAdd %12 %37 %38 + OpStore %14 %39 + %40 = OpLoad %12 %14 + %41 = OpIAdd %12 %40 %38 + OpStore %14 %41 + OpBranch %36 + %36 = OpLabel + %42 = OpLoad %6 %9 + %43 = OpAccessChain %30 %28 %29 %38 + %44 = OpLoad %6 %43 + %45 = OpFOrdLessThan %33 %42 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + %48 = OpAccessChain %30 %28 %29 %38 + %49 = OpLoad %6 %48 + OpReturnValue %49 + %47 = OpLabel + %52 = OpLoad %12 %14 + %54 = OpExtInst %12 %1 SClamp %52 %29 %53 + %55 = OpConvertSToF %6 %54 + OpStore %51 %55 + %56 = OpLoad %6 %51 + OpReturnValue %56 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 2.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access.amber new file mode 100644 index 0000000..6a1012d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access.amber @@ -0,0 +1,216 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction combine compare code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_2_0 _GLF_uniform_float_values[2] +# #define _float_3_0 _GLF_uniform_float_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0, 2.0, 3.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[4]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // a becomes 0. +# int a = (gl_FragCoord.y >= _float_0_0) ? 0 : 2; +# +# float b = vec3(_float_1_0, _float_2_0, _float_3_0)[a]; +# +# if (b == _float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "gl_FragCoord" + OpName %20 "buf0" + OpMemberName %20 0 "_GLF_uniform_float_values" + OpName %22 "" + OpName %32 "b" + OpName %52 "_GLF_color" + OpName %55 "buf1" + OpMemberName %55 0 "_GLF_uniform_int_values" + OpName %57 "" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %19 ArrayStride 16 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpDecorate %52 Location 0 + OpDecorate %54 ArrayStride 16 + OpMemberDecorate %55 0 Offset 0 + OpDecorate %55 Block + OpDecorate %57 DescriptorSet 0 + OpDecorate %57 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 1 + %15 = OpTypePointer Input %9 + %18 = OpConstant %13 4 + %19 = OpTypeArray %9 %18 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpConstant %6 0 + %24 = OpTypePointer Uniform %9 + %27 = OpTypeBool + %29 = OpConstant %6 2 + %31 = OpTypePointer Function %9 + %33 = OpConstant %6 1 + %38 = OpConstant %6 3 + %41 = OpTypeVector %9 3 + %51 = OpTypePointer Output %10 + %52 = OpVariable %51 Output + %53 = OpConstant %13 2 + %54 = OpTypeArray %6 %53 + %55 = OpTypeStruct %54 + %56 = OpTypePointer Uniform %55 + %57 = OpVariable %56 Uniform + %58 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %32 = OpVariable %31 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %25 = OpAccessChain %24 %22 %23 %23 + %26 = OpLoad %9 %25 + %28 = OpFOrdGreaterThanEqual %27 %17 %26 + %30 = OpSelect %6 %28 %23 %29 + OpStore %8 %30 + %34 = OpAccessChain %24 %22 %23 %33 + %35 = OpLoad %9 %34 + %36 = OpAccessChain %24 %22 %23 %29 + %37 = OpLoad %9 %36 + %39 = OpAccessChain %24 %22 %23 %38 + %40 = OpLoad %9 %39 + %42 = OpCompositeConstruct %41 %35 %37 %40 + %43 = OpLoad %6 %8 + %44 = OpVectorExtractDynamic %9 %42 %43 + OpStore %32 %44 + %45 = OpLoad %9 %32 + %46 = OpAccessChain %24 %22 %23 %33 + %47 = OpLoad %9 %46 + %48 = OpFOrdEqual %27 %45 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %72 + %49 = OpLabel + %59 = OpAccessChain %58 %57 %23 %23 + %60 = OpLoad %6 %59 + %61 = OpConvertSToF %9 %60 + %62 = OpAccessChain %58 %57 %23 %33 + %63 = OpLoad %6 %62 + %64 = OpConvertSToF %9 %63 + %65 = OpAccessChain %58 %57 %23 %33 + %66 = OpLoad %6 %65 + %67 = OpConvertSToF %9 %66 + %68 = OpAccessChain %58 %57 %23 %23 + %69 = OpLoad %6 %68 + %70 = OpConvertSToF %9 %69 + %71 = OpCompositeConstruct %10 %61 %64 %67 %70 + OpStore %52 %71 + OpBranch %50 + %72 = OpLabel + %73 = OpAccessChain %58 %57 %23 %23 + %74 = OpLoad %6 %73 + %75 = OpConvertSToF %9 %74 + %76 = OpCompositeConstruct %10 %75 %75 %75 %75 + OpStore %52 %76 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 2.0 3.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-while-modulo.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-while-modulo.amber new file mode 100644 index 0000000..8f1d5e8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-compares-while-modulo.amber @@ -0,0 +1,201 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine compares code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 10] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = _int_10; +# while (i >= 0) +# { +# if ((i % 2) == 0) +# { +# _GLF_color = vec4(1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_float_1_0); +# } +# i--; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %36 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %36 "_GLF_color" + OpName %52 "buf0" + OpMemberName %52 0 "_GLF_uniform_float_values" + OpName %54 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %36 Location 0 + OpDecorate %51 ArrayStride 16 + OpMemberDecorate %52 0 Offset 0 + OpDecorate %52 Block + OpDecorate %54 DescriptorSet 0 + OpDecorate %54 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %26 = OpTypeBool + %33 = OpTypeFloat 32 + %34 = OpTypeVector %33 4 + %35 = OpTypePointer Output %34 + %36 = OpVariable %35 Output + %37 = OpConstant %33 1 + %44 = OpConstant %6 1 + %50 = OpConstant %9 1 + %51 = OpTypeArray %33 %50 + %52 = OpTypeStruct %51 + %53 = OpTypePointer Uniform %52 + %54 = OpVariable %53 Uniform + %55 = OpTypePointer Uniform %33 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %6 %8 + %27 = OpSGreaterThanEqual %26 %25 %15 + OpBranchConditional %27 %21 %22 + %21 = OpLabel + %28 = OpLoad %6 %8 + %29 = OpSMod %6 %28 %16 + %30 = OpIEqual %26 %29 %15 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %49 + %31 = OpLabel + %38 = OpAccessChain %17 %14 %15 %15 + %39 = OpLoad %6 %38 + %40 = OpConvertSToF %33 %39 + %41 = OpAccessChain %17 %14 %15 %15 + %42 = OpLoad %6 %41 + %43 = OpConvertSToF %33 %42 + %45 = OpAccessChain %17 %14 %15 %44 + %46 = OpLoad %6 %45 + %47 = OpConvertSToF %33 %46 + %48 = OpCompositeConstruct %34 %37 %40 %43 %47 + OpStore %36 %48 + OpBranch %32 + %49 = OpLabel + %56 = OpAccessChain %55 %54 %15 %15 + %57 = OpLoad %33 %56 + %58 = OpCompositeConstruct %34 %57 %57 %57 %57 + OpStore %36 %58 + OpBranch %32 + %32 = OpLabel + %59 = OpLoad %6 %8 + %60 = OpISub %6 %59 %44 + OpStore %8 %60 + OpBranch %23 + %23 = OpLabel + OpBranch %20 + %22 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 10 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix.amber new file mode 100644 index 0000000..ba56643 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix.amber @@ -0,0 +1,264 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine mul div rem code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float f1(float a) +# { +# return dFdx(a); +# } +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# vec4 v2; +# +# // Always false. +# if (gl_FragCoord.x < _float_0_0) +# { +# // v2 is undefined. Doesn't matter since this is never executed. +# if (!(v2.x < 1.0)) +# { +# float a = _float_0_0 / ((_float_0_0 > _float_1_0) ? f1(_float_1_0) : _float_1_0); +# _GLF_color = +# vec4(mix(vec3(_float_1_0), vec3(_float_1_0), a), _float_0_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 104 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %18 %43 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "f1(f1;" + OpName %9 "a" + OpName %18 "_GLF_color" + OpName %23 "buf0" + OpMemberName %23 0 "_GLF_uniform_int_values" + OpName %25 "" + OpName %43 "gl_FragCoord" + OpName %49 "buf1" + OpMemberName %49 0 "_GLF_uniform_float_values" + OpName %51 "" + OpName %60 "v2" + OpName %68 "a" + OpName %79 "param" + OpDecorate %18 Location 0 + OpDecorate %22 ArrayStride 16 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %43 BuiltIn FragCoord + OpDecorate %48 ArrayStride 16 + OpMemberDecorate %49 0 Offset 0 + OpDecorate %49 Block + OpDecorate %51 DescriptorSet 0 + OpDecorate %51 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %16 = OpTypeVector %6 4 + %17 = OpTypePointer Output %16 + %18 = OpVariable %17 Output + %19 = OpTypeInt 32 1 + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 2 + %22 = OpTypeArray %19 %21 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpConstant %19 0 + %27 = OpTypePointer Uniform %19 + %31 = OpConstant %19 1 + %42 = OpTypePointer Input %16 + %43 = OpVariable %42 Input + %44 = OpConstant %20 0 + %45 = OpTypePointer Input %6 + %48 = OpTypeArray %6 %21 + %49 = OpTypeStruct %48 + %50 = OpTypePointer Uniform %49 + %51 = OpVariable %50 Uniform + %52 = OpTypePointer Uniform %6 + %55 = OpTypeBool + %59 = OpTypePointer Function %16 + %63 = OpConstant %6 1 + %90 = OpTypeVector %6 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %60 = OpVariable %59 Function + %68 = OpVariable %7 Function + %76 = OpVariable %7 Function + %79 = OpVariable %7 Function + %28 = OpAccessChain %27 %25 %26 %26 + %29 = OpLoad %19 %28 + %30 = OpConvertSToF %6 %29 + %32 = OpAccessChain %27 %25 %26 %31 + %33 = OpLoad %19 %32 + %34 = OpConvertSToF %6 %33 + %35 = OpAccessChain %27 %25 %26 %31 + %36 = OpLoad %19 %35 + %37 = OpConvertSToF %6 %36 + %38 = OpAccessChain %27 %25 %26 %26 + %39 = OpLoad %19 %38 + %40 = OpConvertSToF %6 %39 + %41 = OpCompositeConstruct %16 %30 %34 %37 %40 + OpStore %18 %41 + %46 = OpAccessChain %45 %43 %44 + %47 = OpLoad %6 %46 + %53 = OpAccessChain %52 %51 %26 %31 + %54 = OpLoad %6 %53 + %56 = OpFOrdLessThan %55 %47 %54 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + %61 = OpAccessChain %7 %60 %44 + %62 = OpLoad %6 %61 + %64 = OpFOrdLessThan %55 %62 %63 + %65 = OpLogicalNot %55 %64 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %67 + %66 = OpLabel + %69 = OpAccessChain %52 %51 %26 %31 + %70 = OpLoad %6 %69 + %71 = OpAccessChain %52 %51 %26 %31 + %72 = OpLoad %6 %71 + %73 = OpAccessChain %52 %51 %26 %26 + %74 = OpLoad %6 %73 + %75 = OpFOrdGreaterThan %55 %72 %74 + OpSelectionMerge %78 None + OpBranchConditional %75 %77 %83 + %77 = OpLabel + %80 = OpAccessChain %52 %51 %26 %26 + %81 = OpLoad %6 %80 + OpStore %79 %81 + %82 = OpFunctionCall %6 %10 %79 + OpStore %76 %82 + OpBranch %78 + %83 = OpLabel + %84 = OpAccessChain %52 %51 %26 %26 + %85 = OpLoad %6 %84 + OpStore %76 %85 + OpBranch %78 + %78 = OpLabel + %86 = OpLoad %6 %76 + %87 = OpFDiv %6 %70 %86 + OpStore %68 %87 + %88 = OpAccessChain %52 %51 %26 %26 + %89 = OpLoad %6 %88 + %91 = OpCompositeConstruct %90 %89 %89 %89 + %92 = OpAccessChain %52 %51 %26 %26 + %93 = OpLoad %6 %92 + %94 = OpCompositeConstruct %90 %93 %93 %93 + %95 = OpLoad %6 %68 + %96 = OpCompositeConstruct %90 %95 %95 %95 + %97 = OpExtInst %90 %1 FMix %91 %94 %96 + %98 = OpAccessChain %52 %51 %26 %31 + %99 = OpLoad %6 %98 + %100 = OpCompositeExtract %6 %97 0 + %101 = OpCompositeExtract %6 %97 1 + %102 = OpCompositeExtract %6 %97 2 + %103 = OpCompositeConstruct %16 %100 %101 %102 %99 + OpStore %18 %103 + OpBranch %67 + %67 = OpLabel + OpBranch %58 + %58 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %12 = OpLoad %6 %9 + %13 = OpDPdx %6 %12 + OpReturnValue %13 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-pack-unpack.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-pack-unpack.amber new file mode 100644 index 0000000..337de64 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-pack-unpack.amber @@ -0,0 +1,290 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers specific combine shifts and combine simplify demanded code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _float_0_25 _GLF_uniform_float_values[0] +# #define _float_0_75 _GLF_uniform_float_values[1] +# #define _float_0_0 _GLF_uniform_float_values[2] +# #define _float_127_0 _GLF_uniform_float_values[3] +# #define _float_64_0 _GLF_uniform_float_values[4] +# #define _float_1_0 _GLF_uniform_float_values[5] +# #define _float_65_0 _GLF_uniform_float_values[6] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [3, 1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.25, 0.75, 0.0, 127.0, 64.0, 1.0, 65.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[7]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Packs the two components into an unsigned integer of 3221176320. +# uint a = packUnorm2x16(vec2(_float_0_25, _float_0_75)); +# +# // Unpacks the integer into values of 0.0, 64.0, -1.0 and -65.0. +# // Then converts them into floating-point values by dividing with 127.0. +# vec4 v1 = unpackSnorm4x8(a); +# +# float E = 0.01; +# if ( abs(v1[_int_0] - (_float_0_0 / _float_127_0)) < E +# && abs(v1[_int_1] - (_float_64_0 / _float_127_0)) < E +# && abs(v1[_int_2] - (-_float_1_0 / _float_127_0)) < E +# && abs(v1[_int_3] - (-_float_65_0 / _float_127_0)) < E +# ) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_float_1_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 130 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %112 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %28 "v1" + OpName %32 "E" + OpName %37 "buf0" + OpMemberName %37 0 "_GLF_uniform_int_values" + OpName %39 "" + OpName %112 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 0 + OpDecorate %112 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpConstant %6 7 + %11 = OpTypeArray %9 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %9 + %20 = OpConstant %15 1 + %23 = OpTypeVector %9 2 + %26 = OpTypeVector %9 4 + %27 = OpTypePointer Function %26 + %31 = OpTypePointer Function %9 + %33 = OpConstant %9 0.00999999978 + %34 = OpTypeBool + %35 = OpConstant %6 4 + %36 = OpTypeArray %15 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpConstant %15 2 + %41 = OpTypePointer Uniform %15 + %48 = OpConstant %15 3 + %62 = OpConstant %15 4 + %79 = OpConstant %15 5 + %97 = OpConstant %15 6 + %111 = OpTypePointer Output %26 + %112 = OpVariable %111 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %28 = OpVariable %27 Function + %32 = OpVariable %31 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %9 %18 + %21 = OpAccessChain %17 %14 %16 %20 + %22 = OpLoad %9 %21 + %24 = OpCompositeConstruct %23 %19 %22 + %25 = OpExtInst %6 %1 PackUnorm2x16 %24 + OpStore %8 %25 + %29 = OpLoad %6 %8 + %30 = OpExtInst %26 %1 UnpackSnorm4x8 %29 + OpStore %28 %30 + OpStore %32 %33 + %42 = OpAccessChain %41 %39 %16 %40 + %43 = OpLoad %15 %42 + %44 = OpAccessChain %31 %28 %43 + %45 = OpLoad %9 %44 + %46 = OpAccessChain %17 %14 %16 %40 + %47 = OpLoad %9 %46 + %49 = OpAccessChain %17 %14 %16 %48 + %50 = OpLoad %9 %49 + %51 = OpFDiv %9 %47 %50 + %52 = OpFSub %9 %45 %51 + %53 = OpExtInst %9 %1 FAbs %52 + %54 = OpLoad %9 %32 + %55 = OpFOrdLessThan %34 %53 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %57 + %56 = OpLabel + %58 = OpAccessChain %41 %39 %16 %20 + %59 = OpLoad %15 %58 + %60 = OpAccessChain %31 %28 %59 + %61 = OpLoad %9 %60 + %63 = OpAccessChain %17 %14 %16 %62 + %64 = OpLoad %9 %63 + %65 = OpAccessChain %17 %14 %16 %48 + %66 = OpLoad %9 %65 + %67 = OpFDiv %9 %64 %66 + %68 = OpFSub %9 %61 %67 + %69 = OpExtInst %9 %1 FAbs %68 + %70 = OpLoad %9 %32 + %71 = OpFOrdLessThan %34 %69 %70 + OpBranch %57 + %57 = OpLabel + %72 = OpPhi %34 %55 %5 %71 %56 + OpSelectionMerge %74 None + OpBranchConditional %72 %73 %74 + %73 = OpLabel + %75 = OpAccessChain %41 %39 %16 %48 + %76 = OpLoad %15 %75 + %77 = OpAccessChain %31 %28 %76 + %78 = OpLoad %9 %77 + %80 = OpAccessChain %17 %14 %16 %79 + %81 = OpLoad %9 %80 + %82 = OpFNegate %9 %81 + %83 = OpAccessChain %17 %14 %16 %48 + %84 = OpLoad %9 %83 + %85 = OpFDiv %9 %82 %84 + %86 = OpFSub %9 %78 %85 + %87 = OpExtInst %9 %1 FAbs %86 + %88 = OpLoad %9 %32 + %89 = OpFOrdLessThan %34 %87 %88 + OpBranch %74 + %74 = OpLabel + %90 = OpPhi %34 %72 %57 %89 %73 + OpSelectionMerge %92 None + OpBranchConditional %90 %91 %92 + %91 = OpLabel + %93 = OpAccessChain %41 %39 %16 %16 + %94 = OpLoad %15 %93 + %95 = OpAccessChain %31 %28 %94 + %96 = OpLoad %9 %95 + %98 = OpAccessChain %17 %14 %16 %97 + %99 = OpLoad %9 %98 + %100 = OpFNegate %9 %99 + %101 = OpAccessChain %17 %14 %16 %48 + %102 = OpLoad %9 %101 + %103 = OpFDiv %9 %100 %102 + %104 = OpFSub %9 %96 %103 + %105 = OpExtInst %9 %1 FAbs %104 + %106 = OpLoad %9 %32 + %107 = OpFOrdLessThan %34 %105 %106 + OpBranch %92 + %92 = OpLabel + %108 = OpPhi %34 %90 %74 %107 %91 + OpSelectionMerge %110 None + OpBranchConditional %108 %109 %126 + %109 = OpLabel + %113 = OpAccessChain %41 %39 %16 %20 + %114 = OpLoad %15 %113 + %115 = OpConvertSToF %9 %114 + %116 = OpAccessChain %41 %39 %16 %40 + %117 = OpLoad %15 %116 + %118 = OpConvertSToF %9 %117 + %119 = OpAccessChain %41 %39 %16 %40 + %120 = OpLoad %15 %119 + %121 = OpConvertSToF %9 %120 + %122 = OpAccessChain %41 %39 %16 %20 + %123 = OpLoad %15 %122 + %124 = OpConvertSToF %9 %123 + %125 = OpCompositeConstruct %26 %115 %118 %121 %124 + OpStore %112 %125 + OpBranch %110 + %126 = OpLabel + %127 = OpAccessChain %17 %14 %16 %79 + %128 = OpLoad %9 %127 + %129 = OpCompositeConstruct %26 %128 %128 %128 %128 + OpStore %112 %129 + OpBranch %110 + %110 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.25 0.75 0.0 127.0 64.0 1.0 65.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-select-findlsb-uaddcarry.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-select-findlsb-uaddcarry.amber new file mode 100644 index 0000000..9449f60 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-select-findlsb-uaddcarry.amber @@ -0,0 +1,415 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction combine select code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_4 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_2 _GLF_uniform_int_values[4] +# #define _uint_0 _GLF_uniform_uint_values[0] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _uint_4294967294 _GLF_uniform_uint_values[1] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_uint_values: 0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# uint _GLF_uniform_uint_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [10, 4, 0, 1, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of A: [0.0, 1.0] +# layout(set = 0, binding = 3) uniform buf3 +# { +# vec2 A; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# float f1() +# { +# // Always false. +# if (A.x > A.y) +# { +# // Always false. +# if (gl_FragCoord.y < _float_0_0) +# { +# return _float_0_0; +# } +# } +# +# // Always false. +# if (_float_0_0 > A.x) +# { +# // Always false. +# if (A.x > A.y) +# { +# return _float_0_0; +# } +# } +# for (int i = _int_0; i < _int_10; i++) +# { +# // Always false. +# if (gl_FragCoord.x < _float_0_0) +# { +# return _float_0_0; +# } +# } +# +# // Always returns 1.0. +# return _float_1_0; +# } +# +# void main() +# { +# float data[2]; +# +# data[0] = 0.1; +# data[1] = 0.2; +# +# // Loops over two times. +# for (int j = _int_0; j < findLSB(_int_4); j++) +# { +# uint index = _uint_0; +# +# uaddCarry(uint(_int_2 * j), _uint_4294967294, index); +# data[index] = f1() - float(index); +# } +# +# _GLF_color = vec4(data[_int_0], data[_int_1], data[_int_1], data[_int_0]); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 170 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %30 %151 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f1(" + OpName %11 "buf3" + OpMemberName %11 0 "A" + OpName %13 "" + OpName %30 "gl_FragCoord" + OpName %36 "buf2" + OpMemberName %36 0 "_GLF_uniform_float_values" + OpName %38 "" + OpName %66 "i" + OpName %69 "buf1" + OpMemberName %69 0 "_GLF_uniform_int_values" + OpName %71 "" + OpName %102 "data" + OpName %108 "j" + OpName %122 "index" + OpName %124 "buf0" + OpMemberName %124 0 "_GLF_uniform_uint_values" + OpName %126 "" + OpName %138 "ResType" + OpName %151 "_GLF_color" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 3 + OpDecorate %30 BuiltIn FragCoord + OpDecorate %35 ArrayStride 16 + OpMemberDecorate %36 0 Offset 0 + OpDecorate %36 Block + OpDecorate %38 DescriptorSet 0 + OpDecorate %38 Binding 2 + OpDecorate %68 ArrayStride 16 + OpMemberDecorate %69 0 Offset 0 + OpDecorate %69 Block + OpDecorate %71 DescriptorSet 0 + OpDecorate %71 Binding 1 + OpDecorate %123 ArrayStride 16 + OpMemberDecorate %124 0 Offset 0 + OpDecorate %124 Block + OpDecorate %126 DescriptorSet 0 + OpDecorate %126 Binding 0 + OpDecorate %151 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypeVector %6 2 + %11 = OpTypeStruct %10 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %6 + %21 = OpConstant %16 1 + %24 = OpTypeBool + %28 = OpTypeVector %6 4 + %29 = OpTypePointer Input %28 + %30 = OpVariable %29 Input + %31 = OpTypePointer Input %6 + %34 = OpConstant %16 2 + %35 = OpTypeArray %6 %34 + %36 = OpTypeStruct %35 + %37 = OpTypePointer Uniform %36 + %38 = OpVariable %37 Uniform + %39 = OpConstant %14 1 + %65 = OpTypePointer Function %14 + %67 = OpConstant %16 5 + %68 = OpTypeArray %14 %67 + %69 = OpTypeStruct %68 + %70 = OpTypePointer Uniform %69 + %71 = OpVariable %70 Uniform + %72 = OpConstant %14 2 + %73 = OpTypePointer Uniform %14 + %101 = OpTypePointer Function %35 + %103 = OpConstant %6 0.100000001 + %104 = OpTypePointer Function %6 + %106 = OpConstant %6 0.200000003 + %121 = OpTypePointer Function %16 + %123 = OpTypeArray %16 %34 + %124 = OpTypeStruct %123 + %125 = OpTypePointer Uniform %124 + %126 = OpVariable %125 Uniform + %127 = OpTypePointer Uniform %16 + %130 = OpConstant %14 4 + %138 = OpTypeStruct %16 %16 + %150 = OpTypePointer Output %28 + %151 = OpVariable %150 Output + %156 = OpConstant %14 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %102 = OpVariable %101 Function + %108 = OpVariable %65 Function + %122 = OpVariable %121 Function + %105 = OpAccessChain %104 %102 %15 + OpStore %105 %103 + %107 = OpAccessChain %104 %102 %39 + OpStore %107 %106 + %109 = OpAccessChain %73 %71 %15 %72 + %110 = OpLoad %14 %109 + OpStore %108 %110 + OpBranch %111 + %111 = OpLabel + OpLoopMerge %113 %114 None + OpBranch %115 + %115 = OpLabel + %116 = OpLoad %14 %108 + %117 = OpAccessChain %73 %71 %15 %39 + %118 = OpLoad %14 %117 + %119 = OpExtInst %14 %1 FindILsb %118 + %120 = OpSLessThan %24 %116 %119 + OpBranchConditional %120 %112 %113 + %112 = OpLabel + %128 = OpAccessChain %127 %126 %15 %15 + %129 = OpLoad %16 %128 + OpStore %122 %129 + %131 = OpAccessChain %73 %71 %15 %130 + %132 = OpLoad %14 %131 + %133 = OpLoad %14 %108 + %134 = OpIMul %14 %132 %133 + %135 = OpBitcast %16 %134 + %136 = OpAccessChain %127 %126 %15 %39 + %137 = OpLoad %16 %136 + %139 = OpIAddCarry %138 %135 %137 + %140 = OpCompositeExtract %16 %139 1 + OpStore %122 %140 + %141 = OpCompositeExtract %16 %139 0 + %142 = OpLoad %16 %122 + %143 = OpFunctionCall %6 %8 + %144 = OpLoad %16 %122 + %145 = OpConvertUToF %6 %144 + %146 = OpFSub %6 %143 %145 + %147 = OpAccessChain %104 %102 %142 + OpStore %147 %146 + OpBranch %114 + %114 = OpLabel + %148 = OpLoad %14 %108 + %149 = OpIAdd %14 %148 %39 + OpStore %108 %149 + OpBranch %111 + %113 = OpLabel + %152 = OpAccessChain %73 %71 %15 %72 + %153 = OpLoad %14 %152 + %154 = OpAccessChain %104 %102 %153 + %155 = OpLoad %6 %154 + %157 = OpAccessChain %73 %71 %15 %156 + %158 = OpLoad %14 %157 + %159 = OpAccessChain %104 %102 %158 + %160 = OpLoad %6 %159 + %161 = OpAccessChain %73 %71 %15 %156 + %162 = OpLoad %14 %161 + %163 = OpAccessChain %104 %102 %162 + %164 = OpLoad %6 %163 + %165 = OpAccessChain %73 %71 %15 %72 + %166 = OpLoad %14 %165 + %167 = OpAccessChain %104 %102 %166 + %168 = OpLoad %6 %167 + %169 = OpCompositeConstruct %28 %155 %160 %164 %168 + OpStore %151 %169 + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %66 = OpVariable %65 Function + %19 = OpAccessChain %18 %13 %15 %17 + %20 = OpLoad %6 %19 + %22 = OpAccessChain %18 %13 %15 %21 + %23 = OpLoad %6 %22 + %25 = OpFOrdGreaterThan %24 %20 %23 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %27 + %26 = OpLabel + %32 = OpAccessChain %31 %30 %21 + %33 = OpLoad %6 %32 + %40 = OpAccessChain %18 %38 %15 %39 + %41 = OpLoad %6 %40 + %42 = OpFOrdLessThan %24 %33 %41 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %44 + %43 = OpLabel + %45 = OpAccessChain %18 %38 %15 %39 + %46 = OpLoad %6 %45 + OpReturnValue %46 + %44 = OpLabel + OpBranch %27 + %27 = OpLabel + %48 = OpAccessChain %18 %38 %15 %39 + %49 = OpLoad %6 %48 + %50 = OpAccessChain %18 %13 %15 %17 + %51 = OpLoad %6 %50 + %52 = OpFOrdGreaterThan %24 %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + %55 = OpAccessChain %18 %13 %15 %17 + %56 = OpLoad %6 %55 + %57 = OpAccessChain %18 %13 %15 %21 + %58 = OpLoad %6 %57 + %59 = OpFOrdGreaterThan %24 %56 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %60 %61 + %60 = OpLabel + %62 = OpAccessChain %18 %38 %15 %39 + %63 = OpLoad %6 %62 + OpReturnValue %63 + %61 = OpLabel + OpBranch %54 + %54 = OpLabel + %74 = OpAccessChain %73 %71 %15 %72 + %75 = OpLoad %14 %74 + OpStore %66 %75 + OpBranch %76 + %76 = OpLabel + OpLoopMerge %78 %79 None + OpBranch %80 + %80 = OpLabel + %81 = OpLoad %14 %66 + %82 = OpAccessChain %73 %71 %15 %15 + %83 = OpLoad %14 %82 + %84 = OpSLessThan %24 %81 %83 + OpBranchConditional %84 %77 %78 + %77 = OpLabel + %85 = OpAccessChain %31 %30 %17 + %86 = OpLoad %6 %85 + %87 = OpAccessChain %18 %38 %15 %39 + %88 = OpLoad %6 %87 + %89 = OpFOrdLessThan %24 %86 %88 + OpSelectionMerge %91 None + OpBranchConditional %89 %90 %91 + %90 = OpLabel + %92 = OpAccessChain %18 %38 %15 %39 + %93 = OpLoad %6 %92 + OpReturnValue %93 + %91 = OpLabel + OpBranch %79 + %79 = OpLabel + %95 = OpLoad %14 %66 + %96 = OpIAdd %14 %95 %39 + OpStore %66 %96 + OpBranch %76 + %78 = OpLabel + %97 = OpAccessChain %18 %38 %15 %15 + %98 = OpLoad %6 %97 + OpReturnValue %98 + OpFunctionEnd +END + +# uniforms for variant + +# A +BUFFER variant_A DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 4 0 1 2 +END +# _GLF_uniform_uint_values +BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA + 0 4294967294 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_A AS uniform DESCRIPTOR_SET 0 BINDING 3 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-shifts-bitfield-bitcount.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-shifts-bitfield-bitcount.amber new file mode 100644 index 0000000..dd85566 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-shifts-bitfield-bitcount.amber @@ -0,0 +1,161 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction combine shifts code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always zero. +# int i = bitfieldExtract(_int_0, bitCount(0), _int_1); +# +# if (i == _int_0) +# { +# _GLF_color = vec4(_int_1, i, i, _int_1); +# } +# else +# { +# _GLF_color = vec4(i); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %34 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %19 RelaxedPrecision + OpDecorate %34 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %6 + %20 = OpConstant %6 1 + %27 = OpTypeBool + %31 = OpTypeFloat 32 + %32 = OpTypeVector %31 4 + %33 = OpTypePointer Output %32 + %34 = OpVariable %33 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %17 = OpAccessChain %16 %14 %15 %15 + %18 = OpLoad %6 %17 + %19 = OpBitCount %6 %15 + %21 = OpAccessChain %16 %14 %15 %20 + %22 = OpLoad %6 %21 + %23 = OpBitFieldSExtract %6 %18 %19 %22 + OpStore %8 %23 + %24 = OpLoad %6 %8 + %25 = OpAccessChain %16 %14 %15 %15 + %26 = OpLoad %6 %25 + %28 = OpIEqual %27 %24 %26 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %46 + %29 = OpLabel + %35 = OpAccessChain %16 %14 %15 %20 + %36 = OpLoad %6 %35 + %37 = OpConvertSToF %31 %36 + %38 = OpLoad %6 %8 + %39 = OpConvertSToF %31 %38 + %40 = OpLoad %6 %8 + %41 = OpConvertSToF %31 %40 + %42 = OpAccessChain %16 %14 %15 %20 + %43 = OpLoad %6 %42 + %44 = OpConvertSToF %31 %43 + %45 = OpCompositeConstruct %32 %37 %39 %41 %44 + OpStore %34 %45 + OpBranch %30 + %46 = OpLabel + %47 = OpLoad %6 %8 + %48 = OpConvertSToF %31 %47 + %49 = OpCompositeConstruct %32 %48 %48 %48 %48 + OpStore %34 %49 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-shifts-left-shift-for.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-shifts-left-shift-for.amber new file mode 100644 index 0000000..e909069 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-shifts-left-shift-for.amber @@ -0,0 +1,212 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine shifts code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_5 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 5, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# +# // i becomes 4. +# int i = 1 << ((gl_FragCoord.y >= _float_0_0) ? 2 : 1); +# +# for (; (i != _int_1) && (i < _int_5); i++) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %28 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %25 "i" + OpName %28 "gl_FragCoord" + OpName %34 "buf1" + OpMemberName %34 0 "_GLF_uniform_float_values" + OpName %36 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %28 BuiltIn FragCoord + OpDecorate %33 ArrayStride 16 + OpMemberDecorate %34 0 Offset 0 + OpDecorate %34 Block + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 3 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpConstant %10 2 + %19 = OpTypePointer Uniform %10 + %24 = OpTypePointer Function %10 + %26 = OpConstant %10 1 + %27 = OpTypePointer Input %7 + %28 = OpVariable %27 Input + %29 = OpConstant %11 1 + %30 = OpTypePointer Input %6 + %33 = OpTypeArray %6 %29 + %34 = OpTypeStruct %33 + %35 = OpTypePointer Uniform %34 + %36 = OpVariable %35 Uniform + %37 = OpTypePointer Uniform %6 + %40 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %25 = OpVariable %24 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %10 %20 + %22 = OpConvertSToF %6 %21 + %23 = OpCompositeConstruct %7 %22 %22 %22 %22 + OpStore %9 %23 + %31 = OpAccessChain %30 %28 %29 + %32 = OpLoad %6 %31 + %38 = OpAccessChain %37 %36 %17 %17 + %39 = OpLoad %6 %38 + %41 = OpFOrdGreaterThanEqual %40 %32 %39 + %42 = OpSelect %10 %41 %18 %26 + %43 = OpShiftLeftLogical %10 %26 %42 + OpStore %25 %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %10 %25 + %50 = OpAccessChain %19 %16 %17 %17 + %51 = OpLoad %10 %50 + %52 = OpINotEqual %40 %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + %55 = OpLoad %10 %25 + %56 = OpAccessChain %19 %16 %17 %26 + %57 = OpLoad %10 %56 + %58 = OpSLessThan %40 %55 %57 + OpBranch %54 + %54 = OpLabel + %59 = OpPhi %40 %52 %48 %58 %53 + OpBranchConditional %59 %45 %46 + %45 = OpLabel + %60 = OpAccessChain %19 %16 %17 %17 + %61 = OpLoad %10 %60 + %62 = OpConvertSToF %6 %61 + %63 = OpAccessChain %19 %16 %17 %18 + %64 = OpLoad %10 %63 + %65 = OpConvertSToF %6 %64 + %66 = OpAccessChain %19 %16 %17 %18 + %67 = OpLoad %10 %66 + %68 = OpConvertSToF %6 %67 + %69 = OpAccessChain %19 %16 %17 %17 + %70 = OpLoad %10 %69 + %71 = OpConvertSToF %6 %70 + %72 = OpCompositeConstruct %7 %62 %65 %68 %71 + OpStore %9 %72 + OpBranch %47 + %47 = OpLabel + %73 = OpLoad %10 %25 + %74 = OpIAdd %10 %73 %26 + OpStore %25 %74 + OpBranch %44 + %46 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 5 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp.amber new file mode 100644 index 0000000..c879660 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp.amber @@ -0,0 +1,313 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction combine shifts code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 2, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int A[2]; +# A[_int_0] = _int_1; +# A[_int_1] = _int_2; +# +# int i = _int_1; +# while (i > _int_0) +# { +# i--; +# } +# +# int a = A[((_float_0_0 >= _float_0_0) ? 1 : i)]; +# +# // v1 becomes vec2(1, 1). +# vec2 v1 = mix(vec2(_int_1, a), vec2(_int_1, _int_1), bvec2((_float_0_0 < _float_1_0), true)); +# +# // v2 becomes vec2(1, 1). +# vec2 v2 = mix(vec2(v1[_int_0]), vec2(v1[_int_1]), bvec2(false)); +# +# int b = A[int(clamp(vec2(_int_2), vec2(_int_1), v2).x)]; +# +# if (b == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 146 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %127 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "A" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %32 "i" + OpName %47 "a" + OpName %50 "buf0" + OpMemberName %50 0 "_GLF_uniform_float_values" + OpName %52 "" + OpName %65 "v1" + OpName %88 "v2" + OpName %103 "b" + OpName %127 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %49 ArrayStride 16 + OpMemberDecorate %50 0 Offset 0 + OpDecorate %50 Block + OpDecorate %52 DescriptorSet 0 + OpDecorate %52 Binding 0 + OpDecorate %127 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 2 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 3 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 2 + %19 = OpTypePointer Uniform %6 + %24 = OpTypePointer Function %6 + %28 = OpConstant %6 1 + %43 = OpTypeBool + %48 = OpTypeFloat 32 + %49 = OpTypeArray %48 %8 + %50 = OpTypeStruct %49 + %51 = OpTypePointer Uniform %50 + %52 = OpVariable %51 Uniform + %53 = OpTypePointer Uniform %48 + %63 = OpTypeVector %48 2 + %64 = OpTypePointer Function %63 + %84 = OpConstantTrue %43 + %85 = OpTypeVector %43 2 + %91 = OpTypePointer Function %48 + %100 = OpConstantFalse %43 + %101 = OpConstantComposite %85 %100 %100 + %114 = OpConstant %7 0 + %125 = OpTypeVector %48 4 + %126 = OpTypePointer Output %125 + %127 = OpVariable %126 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %32 = OpVariable %24 Function + %47 = OpVariable %24 Function + %65 = OpVariable %64 Function + %88 = OpVariable %64 Function + %103 = OpVariable %24 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %16 %17 %17 + %23 = OpLoad %6 %22 + %25 = OpAccessChain %24 %11 %21 + OpStore %25 %23 + %26 = OpAccessChain %19 %16 %17 %17 + %27 = OpLoad %6 %26 + %29 = OpAccessChain %19 %16 %17 %28 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %24 %11 %27 + OpStore %31 %30 + %33 = OpAccessChain %19 %16 %17 %17 + %34 = OpLoad %6 %33 + OpStore %32 %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %6 %32 + %41 = OpAccessChain %19 %16 %17 %18 + %42 = OpLoad %6 %41 + %44 = OpSGreaterThan %43 %40 %42 + OpBranchConditional %44 %36 %37 + %36 = OpLabel + %45 = OpLoad %6 %32 + %46 = OpISub %6 %45 %28 + OpStore %32 %46 + OpBranch %38 + %38 = OpLabel + OpBranch %35 + %37 = OpLabel + %54 = OpAccessChain %53 %52 %17 %28 + %55 = OpLoad %48 %54 + %56 = OpAccessChain %53 %52 %17 %28 + %57 = OpLoad %48 %56 + %58 = OpFOrdGreaterThanEqual %43 %55 %57 + %59 = OpLoad %6 %32 + %60 = OpSelect %6 %58 %28 %59 + %61 = OpAccessChain %24 %11 %60 + %62 = OpLoad %6 %61 + OpStore %47 %62 + %66 = OpAccessChain %19 %16 %17 %17 + %67 = OpLoad %6 %66 + %68 = OpConvertSToF %48 %67 + %69 = OpLoad %6 %47 + %70 = OpConvertSToF %48 %69 + %71 = OpCompositeConstruct %63 %68 %70 + %72 = OpAccessChain %19 %16 %17 %17 + %73 = OpLoad %6 %72 + %74 = OpConvertSToF %48 %73 + %75 = OpAccessChain %19 %16 %17 %17 + %76 = OpLoad %6 %75 + %77 = OpConvertSToF %48 %76 + %78 = OpCompositeConstruct %63 %74 %77 + %79 = OpAccessChain %53 %52 %17 %28 + %80 = OpLoad %48 %79 + %81 = OpAccessChain %53 %52 %17 %17 + %82 = OpLoad %48 %81 + %83 = OpFOrdLessThan %43 %80 %82 + %86 = OpCompositeConstruct %85 %83 %84 + %87 = OpSelect %63 %86 %78 %71 + OpStore %65 %87 + %89 = OpAccessChain %19 %16 %17 %18 + %90 = OpLoad %6 %89 + %92 = OpAccessChain %91 %65 %90 + %93 = OpLoad %48 %92 + %94 = OpCompositeConstruct %63 %93 %93 + %95 = OpAccessChain %19 %16 %17 %17 + %96 = OpLoad %6 %95 + %97 = OpAccessChain %91 %65 %96 + %98 = OpLoad %48 %97 + %99 = OpCompositeConstruct %63 %98 %98 + %102 = OpSelect %63 %101 %99 %94 + OpStore %88 %102 + %104 = OpAccessChain %19 %16 %17 %28 + %105 = OpLoad %6 %104 + %106 = OpConvertSToF %48 %105 + %107 = OpCompositeConstruct %63 %106 %106 + %108 = OpAccessChain %19 %16 %17 %17 + %109 = OpLoad %6 %108 + %110 = OpConvertSToF %48 %109 + %111 = OpCompositeConstruct %63 %110 %110 + %112 = OpLoad %63 %88 + %113 = OpExtInst %63 %1 FClamp %107 %111 %112 + %115 = OpCompositeExtract %48 %113 0 + %116 = OpConvertFToS %6 %115 + %117 = OpAccessChain %24 %11 %116 + %118 = OpLoad %6 %117 + OpStore %103 %118 + %119 = OpLoad %6 %103 + %120 = OpAccessChain %19 %16 %17 %28 + %121 = OpLoad %6 %120 + %122 = OpIEqual %43 %119 %121 + OpSelectionMerge %124 None + OpBranchConditional %122 %123 %141 + %123 = OpLabel + %128 = OpAccessChain %19 %16 %17 %17 + %129 = OpLoad %6 %128 + %130 = OpConvertSToF %48 %129 + %131 = OpAccessChain %19 %16 %17 %18 + %132 = OpLoad %6 %131 + %133 = OpConvertSToF %48 %132 + %134 = OpAccessChain %19 %16 %17 %18 + %135 = OpLoad %6 %134 + %136 = OpConvertSToF %48 %135 + %137 = OpAccessChain %19 %16 %17 %17 + %138 = OpLoad %6 %137 + %139 = OpConvertSToF %48 %138 + %140 = OpCompositeConstruct %125 %130 %133 %136 %139 + OpStore %127 %140 + OpBranch %124 + %141 = OpLabel + %142 = OpAccessChain %19 %16 %17 %18 + %143 = OpLoad %6 %142 + %144 = OpConvertSToF %48 %143 + %145 = OpCompositeConstruct %125 %144 %144 %144 %144 + OpStore %127 %145 + OpBranch %124 + %124 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 2 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack.amber new file mode 100644 index 0000000..9d889fc --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack.amber @@ -0,0 +1,281 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers a specific instruction combine simplify demanded code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_127_0 _GLF_uniform_float_values[1] +# #define _float_60_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 127.0, 60.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2, 3] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Converts the two 32-bit floating-point quantities to 16-bit quantities +# // and packs them into a 32-bit unsigned integer of 1006648320. +# uint a = packHalf2x16(vec2(1.0)); +# +# // Unpacks the integer into 8-bit signed integers of values 0.0, 60.0, 0.0 and 60.0. +# // Then converts them into normalized floating-point numbers by dividing 127.0. +# vec4 v1 = unpackSnorm4x8(a); +# +# float E = 0.01; +# if (abs(v1[_int_0] - (_float_0_0 / _float_127_0)) < E +# && abs(v1[_int_1] - (_float_60_0 / _float_127_0)) < E +# && abs(v1[_int_2] - (_float_0_0 / _float_127_0)) < E +# && abs(v1[_int_3] - (_float_60_0 / _float_127_0)) < E) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(v1[_int_0]); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 124 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %104 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %16 "v1" + OpName %20 "E" + OpName %26 "buf1" + OpMemberName %26 0 "_GLF_uniform_int_values" + OpName %28 "" + OpName %38 "buf0" + OpMemberName %38 0 "_GLF_uniform_float_values" + OpName %40 "" + OpName %104 "_GLF_color" + OpDecorate %25 ArrayStride 16 + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 1 + OpDecorate %37 ArrayStride 16 + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 0 + OpDecorate %104 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 2 + %11 = OpConstant %9 1 + %12 = OpConstantComposite %10 %11 %11 + %14 = OpTypeVector %9 4 + %15 = OpTypePointer Function %14 + %19 = OpTypePointer Function %9 + %21 = OpConstant %9 0.00999999978 + %22 = OpTypeBool + %23 = OpTypeInt 32 1 + %24 = OpConstant %6 4 + %25 = OpTypeArray %23 %24 + %26 = OpTypeStruct %25 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpConstant %23 0 + %30 = OpConstant %23 1 + %31 = OpTypePointer Uniform %23 + %36 = OpConstant %6 3 + %37 = OpTypeArray %9 %36 + %38 = OpTypeStruct %37 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %41 = OpTypePointer Uniform %9 + %57 = OpConstant %23 2 + %86 = OpConstant %23 3 + %103 = OpTypePointer Output %14 + %104 = OpVariable %103 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %16 = OpVariable %15 Function + %20 = OpVariable %19 Function + %13 = OpExtInst %6 %1 PackHalf2x16 %12 + OpStore %8 %13 + %17 = OpLoad %6 %8 + %18 = OpExtInst %14 %1 UnpackSnorm4x8 %17 + OpStore %16 %18 + OpStore %20 %21 + %32 = OpAccessChain %31 %28 %29 %30 + %33 = OpLoad %23 %32 + %34 = OpAccessChain %19 %16 %33 + %35 = OpLoad %9 %34 + %42 = OpAccessChain %41 %40 %29 %29 + %43 = OpLoad %9 %42 + %44 = OpAccessChain %41 %40 %29 %30 + %45 = OpLoad %9 %44 + %46 = OpFDiv %9 %43 %45 + %47 = OpFSub %9 %35 %46 + %48 = OpExtInst %9 %1 FAbs %47 + %49 = OpLoad %9 %20 + %50 = OpFOrdLessThan %22 %48 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %52 + %51 = OpLabel + %53 = OpAccessChain %31 %28 %29 %29 + %54 = OpLoad %23 %53 + %55 = OpAccessChain %19 %16 %54 + %56 = OpLoad %9 %55 + %58 = OpAccessChain %41 %40 %29 %57 + %59 = OpLoad %9 %58 + %60 = OpAccessChain %41 %40 %29 %30 + %61 = OpLoad %9 %60 + %62 = OpFDiv %9 %59 %61 + %63 = OpFSub %9 %56 %62 + %64 = OpExtInst %9 %1 FAbs %63 + %65 = OpLoad %9 %20 + %66 = OpFOrdLessThan %22 %64 %65 + OpBranch %52 + %52 = OpLabel + %67 = OpPhi %22 %50 %5 %66 %51 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %69 + %68 = OpLabel + %70 = OpAccessChain %31 %28 %29 %57 + %71 = OpLoad %23 %70 + %72 = OpAccessChain %19 %16 %71 + %73 = OpLoad %9 %72 + %74 = OpAccessChain %41 %40 %29 %29 + %75 = OpLoad %9 %74 + %76 = OpAccessChain %41 %40 %29 %30 + %77 = OpLoad %9 %76 + %78 = OpFDiv %9 %75 %77 + %79 = OpFSub %9 %73 %78 + %80 = OpExtInst %9 %1 FAbs %79 + %81 = OpLoad %9 %20 + %82 = OpFOrdLessThan %22 %80 %81 + OpBranch %69 + %69 = OpLabel + %83 = OpPhi %22 %67 %52 %82 %68 + OpSelectionMerge %85 None + OpBranchConditional %83 %84 %85 + %84 = OpLabel + %87 = OpAccessChain %31 %28 %29 %86 + %88 = OpLoad %23 %87 + %89 = OpAccessChain %19 %16 %88 + %90 = OpLoad %9 %89 + %91 = OpAccessChain %41 %40 %29 %57 + %92 = OpLoad %9 %91 + %93 = OpAccessChain %41 %40 %29 %30 + %94 = OpLoad %9 %93 + %95 = OpFDiv %9 %92 %94 + %96 = OpFSub %9 %90 %95 + %97 = OpExtInst %9 %1 FAbs %96 + %98 = OpLoad %9 %20 + %99 = OpFOrdLessThan %22 %97 %98 + OpBranch %85 + %85 = OpLabel + %100 = OpPhi %22 %83 %69 %99 %84 + OpSelectionMerge %102 None + OpBranchConditional %100 %101 %118 + %101 = OpLabel + %105 = OpAccessChain %31 %28 %29 %29 + %106 = OpLoad %23 %105 + %107 = OpConvertSToF %9 %106 + %108 = OpAccessChain %31 %28 %29 %30 + %109 = OpLoad %23 %108 + %110 = OpConvertSToF %9 %109 + %111 = OpAccessChain %31 %28 %29 %30 + %112 = OpLoad %23 %111 + %113 = OpConvertSToF %9 %112 + %114 = OpAccessChain %31 %28 %29 %29 + %115 = OpLoad %23 %114 + %116 = OpConvertSToF %9 %115 + %117 = OpCompositeConstruct %14 %107 %110 %113 %116 + OpStore %104 %117 + OpBranch %102 + %118 = OpLabel + %119 = OpAccessChain %31 %28 %29 %30 + %120 = OpLoad %23 %119 + %121 = OpAccessChain %19 %16 %120 + %122 = OpLoad %9 %121 + %123 = OpCompositeConstruct %14 %122 %122 %122 %122 + OpStore %104 %123 + OpBranch %102 + %102 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 3 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 127.0 60.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm.amber new file mode 100644 index 0000000..8baff2d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm.amber @@ -0,0 +1,280 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers a specific instruction combine simplify demanded code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_3 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _float_0_01 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_127_0 _GLF_uniform_float_values[2] +# #define _float_255_0 _GLF_uniform_float_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 3, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.01, 1.0, 127.0, 255.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Converts the components into signed 8-bit integers and packs the result +# // into an unsigned integer of 2139062143. +# uint a = packSnorm4x8(vec4(_float_1_0)); +# +# // Unpacks the integer into four 8-bit unsigned integers and converts +# // them into a floating-point value of 0.5. +# vec4 v1 = unpackUnorm4x8(a); +# +# float E = _float_0_01; +# if (abs(v1[_int_0] - (_float_127_0/_float_255_0)) < E && +# abs(v1[_int_1] - (_float_127_0/_float_255_0)) < E && +# abs(v1[_int_2] - (_float_127_0/_float_255_0)) < E && +# abs(v1[_int_3] - (_float_127_0/_float_255_0)) < E) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 123 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %104 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %25 "v1" + OpName %29 "E" + OpName %34 "buf0" + OpMemberName %34 0 "_GLF_uniform_int_values" + OpName %36 "" + OpName %104 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %33 ArrayStride 16 + OpMemberDecorate %34 0 Offset 0 + OpDecorate %34 Block + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 0 + OpDecorate %104 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpConstant %6 4 + %11 = OpTypeArray %9 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 1 + %18 = OpTypePointer Uniform %9 + %21 = OpTypeVector %9 4 + %24 = OpTypePointer Function %21 + %28 = OpTypePointer Function %9 + %32 = OpTypeBool + %33 = OpTypeArray %15 %10 + %34 = OpTypeStruct %33 + %35 = OpTypePointer Uniform %34 + %36 = OpVariable %35 Uniform + %37 = OpTypePointer Uniform %15 + %42 = OpConstant %15 2 + %45 = OpConstant %15 3 + %103 = OpTypePointer Output %21 + %104 = OpVariable %103 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %25 = OpVariable %24 Function + %29 = OpVariable %28 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %9 %19 + %22 = OpCompositeConstruct %21 %20 %20 %20 %20 + %23 = OpExtInst %6 %1 PackSnorm4x8 %22 + OpStore %8 %23 + %26 = OpLoad %6 %8 + %27 = OpExtInst %21 %1 UnpackUnorm4x8 %26 + OpStore %25 %27 + %30 = OpAccessChain %18 %14 %16 %16 + %31 = OpLoad %9 %30 + OpStore %29 %31 + %38 = OpAccessChain %37 %36 %16 %17 + %39 = OpLoad %15 %38 + %40 = OpAccessChain %28 %25 %39 + %41 = OpLoad %9 %40 + %43 = OpAccessChain %18 %14 %16 %42 + %44 = OpLoad %9 %43 + %46 = OpAccessChain %18 %14 %16 %45 + %47 = OpLoad %9 %46 + %48 = OpFDiv %9 %44 %47 + %49 = OpFSub %9 %41 %48 + %50 = OpExtInst %9 %1 FAbs %49 + %51 = OpLoad %9 %29 + %52 = OpFOrdLessThan %32 %50 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + %55 = OpAccessChain %37 %36 %16 %16 + %56 = OpLoad %15 %55 + %57 = OpAccessChain %28 %25 %56 + %58 = OpLoad %9 %57 + %59 = OpAccessChain %18 %14 %16 %42 + %60 = OpLoad %9 %59 + %61 = OpAccessChain %18 %14 %16 %45 + %62 = OpLoad %9 %61 + %63 = OpFDiv %9 %60 %62 + %64 = OpFSub %9 %58 %63 + %65 = OpExtInst %9 %1 FAbs %64 + %66 = OpLoad %9 %29 + %67 = OpFOrdLessThan %32 %65 %66 + OpBranch %54 + %54 = OpLabel + %68 = OpPhi %32 %52 %5 %67 %53 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %70 + %69 = OpLabel + %71 = OpAccessChain %37 %36 %16 %45 + %72 = OpLoad %15 %71 + %73 = OpAccessChain %28 %25 %72 + %74 = OpLoad %9 %73 + %75 = OpAccessChain %18 %14 %16 %42 + %76 = OpLoad %9 %75 + %77 = OpAccessChain %18 %14 %16 %45 + %78 = OpLoad %9 %77 + %79 = OpFDiv %9 %76 %78 + %80 = OpFSub %9 %74 %79 + %81 = OpExtInst %9 %1 FAbs %80 + %82 = OpLoad %9 %29 + %83 = OpFOrdLessThan %32 %81 %82 + OpBranch %70 + %70 = OpLabel + %84 = OpPhi %32 %68 %54 %83 %69 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %86 + %85 = OpLabel + %87 = OpAccessChain %37 %36 %16 %42 + %88 = OpLoad %15 %87 + %89 = OpAccessChain %28 %25 %88 + %90 = OpLoad %9 %89 + %91 = OpAccessChain %18 %14 %16 %42 + %92 = OpLoad %9 %91 + %93 = OpAccessChain %18 %14 %16 %45 + %94 = OpLoad %9 %93 + %95 = OpFDiv %9 %92 %94 + %96 = OpFSub %9 %90 %95 + %97 = OpExtInst %9 %1 FAbs %96 + %98 = OpLoad %9 %29 + %99 = OpFOrdLessThan %32 %97 %98 + OpBranch %86 + %86 = OpLabel + %100 = OpPhi %32 %84 %70 %99 %85 + OpSelectionMerge %102 None + OpBranchConditional %100 %101 %118 + %101 = OpLabel + %105 = OpAccessChain %37 %36 %16 %16 + %106 = OpLoad %15 %105 + %107 = OpConvertSToF %9 %106 + %108 = OpAccessChain %37 %36 %16 %17 + %109 = OpLoad %15 %108 + %110 = OpConvertSToF %9 %109 + %111 = OpAccessChain %37 %36 %16 %17 + %112 = OpLoad %15 %111 + %113 = OpConvertSToF %9 %112 + %114 = OpAccessChain %37 %36 %16 %16 + %115 = OpLoad %15 %114 + %116 = OpConvertSToF %9 %115 + %117 = OpCompositeConstruct %21 %107 %110 %113 %116 + OpStore %104 %117 + OpBranch %102 + %118 = OpLabel + %119 = OpAccessChain %37 %36 %16 %17 + %120 = OpLoad %15 %119 + %121 = OpConvertSToF %9 %120 + %122 = OpCompositeConstruct %21 %121 %121 %121 %121 + OpStore %104 %122 + OpBranch %102 + %102 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.01 1.0 127.0 255.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 3 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor.amber new file mode 100644 index 0000000..9c9186a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor.amber @@ -0,0 +1,178 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine simplify demanded path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 color = vec4(_float_0_0, _float_0_0, _float_0_0, _float_1_0); +# switch ((1 | _int_1) ^ 1) +# { +# case 0: +# color[_int_0] = _float_1_0; +# break; +# } +# +# _GLF_color = color; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %49 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "color" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %30 "buf1" + OpMemberName %30 0 "_GLF_uniform_int_values" + OpName %32 "" + OpName %49 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %29 ArrayStride 16 + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 1 + OpDecorate %49 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %6 + %25 = OpConstant %16 1 + %29 = OpTypeArray %16 %11 + %30 = OpTypeStruct %29 + %31 = OpTypePointer Uniform %30 + %32 = OpVariable %31 Uniform + %33 = OpTypePointer Uniform %16 + %44 = OpTypePointer Function %6 + %48 = OpTypePointer Output %7 + %49 = OpVariable %48 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %19 = OpAccessChain %18 %15 %17 %17 + %20 = OpLoad %6 %19 + %21 = OpAccessChain %18 %15 %17 %17 + %22 = OpLoad %6 %21 + %23 = OpAccessChain %18 %15 %17 %17 + %24 = OpLoad %6 %23 + %26 = OpAccessChain %18 %15 %17 %25 + %27 = OpLoad %6 %26 + %28 = OpCompositeConstruct %7 %20 %22 %24 %27 + OpStore %9 %28 + %34 = OpAccessChain %33 %32 %17 %25 + %35 = OpLoad %16 %34 + %36 = OpBitwiseOr %16 %25 %35 + %37 = OpBitwiseXor %16 %36 %25 + OpSelectionMerge %39 None + OpSwitch %37 %39 0 %38 + %38 = OpLabel + %40 = OpAccessChain %33 %32 %17 %17 + %41 = OpLoad %16 %40 + %42 = OpAccessChain %18 %15 %17 %25 + %43 = OpLoad %6 %42 + %45 = OpAccessChain %44 %9 %41 + OpStore %45 %43 + OpBranch %39 + %39 = OpLabel + %50 = OpLoad %7 %9 + OpStore %49 %50 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-combine-vector-ops-asin.amber b/vulkan/amber/graphicsfuzz/cov-inst-combine-vector-ops-asin.amber new file mode 100644 index 0000000..e588df6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-combine-vector-ops-asin.amber @@ -0,0 +1,253 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific inst combine vector ops code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_0_25 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_0_281 _GLF_uniform_float_values[2] +# #define _float_0_282 _GLF_uniform_float_values[3] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.25, 1.0, 0.281, 0.282] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[4]; +# }; +# +# // Contents of _GLF_uniform_int_values: [10, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = _float_0_25; +# float b; +# float c; +# for (int i = _int_0; i < _int_10; i++) +# { +# b = a; +# c = b; +# float d = asin(c); +# c = _float_1_0; +# a = d; +# } +# +# if ((_float_0_281 < a) && (a < _float_0_282)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 89 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %70 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %21 "i" + OpName %24 "buf1" + OpMemberName %24 0 "_GLF_uniform_int_values" + OpName %26 "" + OpName %41 "b" + OpName %43 "c" + OpName %45 "d" + OpName %70 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %23 ArrayStride 16 + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 1 + OpDecorate %70 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %20 = OpTypePointer Function %15 + %22 = OpConstant %9 3 + %23 = OpTypeArray %15 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpConstant %15 1 + %28 = OpTypePointer Uniform %15 + %39 = OpTypeBool + %53 = OpConstant %15 2 + %61 = OpConstant %15 3 + %68 = OpTypeVector %6 4 + %69 = OpTypePointer Output %68 + %70 = OpVariable %69 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %21 = OpVariable %20 Function + %41 = OpVariable %7 Function + %43 = OpVariable %7 Function + %45 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %29 = OpAccessChain %28 %26 %16 %27 + %30 = OpLoad %15 %29 + OpStore %21 %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %15 %21 + %37 = OpAccessChain %28 %26 %16 %16 + %38 = OpLoad %15 %37 + %40 = OpSLessThan %39 %36 %38 + OpBranchConditional %40 %32 %33 + %32 = OpLabel + %42 = OpLoad %6 %8 + OpStore %41 %42 + %44 = OpLoad %6 %41 + OpStore %43 %44 + %46 = OpLoad %6 %43 + %47 = OpExtInst %6 %1 Asin %46 + OpStore %45 %47 + %48 = OpAccessChain %17 %14 %16 %27 + %49 = OpLoad %6 %48 + OpStore %43 %49 + %50 = OpLoad %6 %45 + OpStore %8 %50 + OpBranch %34 + %34 = OpLabel + %51 = OpLoad %15 %21 + %52 = OpIAdd %15 %51 %27 + OpStore %21 %52 + OpBranch %31 + %33 = OpLabel + %54 = OpAccessChain %17 %14 %16 %53 + %55 = OpLoad %6 %54 + %56 = OpLoad %6 %8 + %57 = OpFOrdLessThan %39 %55 %56 + OpSelectionMerge %59 None + OpBranchConditional %57 %58 %59 + %58 = OpLabel + %60 = OpLoad %6 %8 + %62 = OpAccessChain %17 %14 %16 %61 + %63 = OpLoad %6 %62 + %64 = OpFOrdLessThan %39 %60 %63 + OpBranch %59 + %59 = OpLabel + %65 = OpPhi %39 %57 %33 %64 %58 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %84 + %66 = OpLabel + %71 = OpAccessChain %28 %26 %16 %53 + %72 = OpLoad %15 %71 + %73 = OpConvertSToF %6 %72 + %74 = OpAccessChain %28 %26 %16 %27 + %75 = OpLoad %15 %74 + %76 = OpConvertSToF %6 %75 + %77 = OpAccessChain %28 %26 %16 %27 + %78 = OpLoad %15 %77 + %79 = OpConvertSToF %6 %78 + %80 = OpAccessChain %28 %26 %16 %53 + %81 = OpLoad %15 %80 + %82 = OpConvertSToF %6 %81 + %83 = OpCompositeConstruct %68 %73 %76 %79 %82 + OpStore %70 %83 + OpBranch %67 + %84 = OpLabel + %85 = OpAccessChain %28 %26 %16 %27 + %86 = OpLoad %15 %85 + %87 = OpConvertSToF %6 %86 + %88 = OpCompositeConstruct %68 %87 %87 %87 %87 + OpStore %70 %88 + OpBranch %67 + %67 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.25 1.0 0.281 0.282 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-peephole-optimizer-acosh.amber b/vulkan/amber/graphicsfuzz/cov-inst-peephole-optimizer-acosh.amber new file mode 100644 index 0000000..9c385c1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-peephole-optimizer-acosh.amber @@ -0,0 +1,220 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific peephole optimizer code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _float_1_2 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_1_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: 1 +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[1]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.2, 0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = _float_1_2; +# +# // Always true. +# if (!(gl_FragCoord.x < _float_0_0)) +# { +# // Always true. +# if (!(gl_FragCoord.x < _float_0_0)) +# { +# // Always false. +# if (!(gl_FragCoord.x > _float_0_0)) +# { +# discard; +# } +# a = _float_1_0; +# } +# } +# _GLF_color = vec4(_int_1, acosh(a), acosh(a), _int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 74 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %22 %56 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %22 "gl_FragCoord" + OpName %56 "_GLF_color" + OpName %59 "buf0" + OpMemberName %59 0 "_GLF_uniform_int_values" + OpName %61 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %22 BuiltIn FragCoord + OpDecorate %56 Location 0 + OpDecorate %58 ArrayStride 16 + OpMemberDecorate %59 0 Offset 0 + OpDecorate %59 Block + OpDecorate %61 DescriptorSet 0 + OpDecorate %61 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %20 = OpTypeVector %6 4 + %21 = OpTypePointer Input %20 + %22 = OpVariable %21 Input + %23 = OpConstant %9 0 + %24 = OpTypePointer Input %6 + %27 = OpConstant %15 1 + %30 = OpTypeBool + %52 = OpConstant %15 2 + %55 = OpTypePointer Output %20 + %56 = OpVariable %55 Output + %57 = OpConstant %9 1 + %58 = OpTypeArray %15 %57 + %59 = OpTypeStruct %58 + %60 = OpTypePointer Uniform %59 + %61 = OpVariable %60 Uniform + %62 = OpTypePointer Uniform %15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %25 = OpAccessChain %24 %22 %23 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %17 %14 %16 %27 + %29 = OpLoad %6 %28 + %31 = OpFOrdLessThan %30 %26 %29 + %32 = OpLogicalNot %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %34 + %33 = OpLabel + %35 = OpAccessChain %24 %22 %23 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %17 %14 %16 %27 + %38 = OpLoad %6 %37 + %39 = OpFOrdLessThan %30 %36 %38 + %40 = OpLogicalNot %30 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %42 + %41 = OpLabel + %43 = OpAccessChain %24 %22 %23 + %44 = OpLoad %6 %43 + %45 = OpAccessChain %17 %14 %16 %27 + %46 = OpLoad %6 %45 + %47 = OpFOrdGreaterThan %30 %44 %46 + %48 = OpLogicalNot %30 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %50 + %49 = OpLabel + OpTerminateInvocation + %50 = OpLabel + %53 = OpAccessChain %17 %14 %16 %52 + %54 = OpLoad %6 %53 + OpStore %8 %54 + OpBranch %42 + %42 = OpLabel + OpBranch %34 + %34 = OpLabel + %63 = OpAccessChain %62 %61 %16 %16 + %64 = OpLoad %15 %63 + %65 = OpConvertSToF %6 %64 + %66 = OpLoad %6 %8 + %67 = OpExtInst %6 %1 Acosh %66 + %68 = OpLoad %6 %8 + %69 = OpExtInst %6 %1 Acosh %68 + %70 = OpAccessChain %62 %61 %16 %16 + %71 = OpLoad %15 %70 + %72 = OpConvertSToF %6 %71 + %73 = OpCompositeConstruct %20 %65 %67 %69 %72 + OpStore %56 %73 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.2 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-inst-value-tracking-inversesqrt.amber b/vulkan/amber/graphicsfuzz/cov-inst-value-tracking-inversesqrt.amber new file mode 100644 index 0000000..e9fd249 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-inst-value-tracking-inversesqrt.amber @@ -0,0 +1,146 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific value tracking path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always false. +# if (inversesqrt(_float_1_0) < -1.0) +# { +# _GLF_color = vec4(_float_0_0); +# } +# else +# { +# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %27 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "buf0" + OpMemberName %10 0 "_GLF_uniform_float_values" + OpName %12 "" + OpName %27 "_GLF_color" + OpDecorate %9 ArrayStride 16 + OpMemberDecorate %10 0 Offset 0 + OpDecorate %10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %27 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 2 + %9 = OpTypeArray %6 %8 + %10 = OpTypeStruct %9 + %11 = OpTypePointer Uniform %10 + %12 = OpVariable %11 Uniform + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 0 + %15 = OpConstant %13 1 + %16 = OpTypePointer Uniform %6 + %20 = OpConstant %6 -1 + %21 = OpTypeBool + %25 = OpTypeVector %6 4 + %26 = OpTypePointer Output %25 + %27 = OpVariable %26 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %17 = OpAccessChain %16 %12 %14 %15 + %18 = OpLoad %6 %17 + %19 = OpExtInst %6 %1 InverseSqrt %18 + %22 = OpFOrdLessThan %21 %19 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %31 + %23 = OpLabel + %28 = OpAccessChain %16 %12 %14 %14 + %29 = OpLoad %6 %28 + %30 = OpCompositeConstruct %25 %29 %29 %29 %29 + OpStore %27 %30 + OpBranch %24 + %31 = OpLabel + %32 = OpAccessChain %16 %12 %14 %15 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %16 %12 %14 %14 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %16 %12 %14 %14 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %16 %12 %14 %15 + %39 = OpLoad %6 %38 + %40 = OpCompositeConstruct %25 %33 %35 %37 %39 + OpStore %27 %40 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-instr-emitter-pow-asinh.amber b/vulkan/amber/graphicsfuzz/cov-instr-emitter-pow-asinh.amber new file mode 100644 index 0000000..5d0b736 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-instr-emitter-pow-asinh.amber @@ -0,0 +1,202 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction emitter code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_01 _GLF_uniform_float_values[0] +# #define _float_3_0 _GLF_uniform_float_values[1] +# #define _float_2_63 _GLF_uniform_float_values[2] +# #define _float_1_0 _GLF_uniform_float_values[3] +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.01, 3.0, 2.63, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = pow(_float_3_0, asinh(_float_1_0)); +# if (abs(f - _float_2_63) < _float_0_01) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(abs(f - _float_2_63)); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %40 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %40 "_GLF_color" + OpName %43 "buf0" + OpMemberName %43 0 "_GLF_uniform_int_values" + OpName %45 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %40 Location 0 + OpDecorate %42 ArrayStride 16 + OpMemberDecorate %43 0 RelaxedPrecision + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 0 + OpDecorate %48 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 1 + %18 = OpTypePointer Uniform %6 + %21 = OpConstant %15 3 + %27 = OpConstant %15 2 + %34 = OpTypeBool + %38 = OpTypeVector %6 4 + %39 = OpTypePointer Output %38 + %40 = OpVariable %39 Output + %41 = OpConstant %9 2 + %42 = OpTypeArray %15 %41 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %46 = OpTypePointer Uniform %15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %6 %19 + %22 = OpAccessChain %18 %14 %16 %21 + %23 = OpLoad %6 %22 + %24 = OpExtInst %6 %1 Asinh %23 + %25 = OpExtInst %6 %1 Pow %20 %24 + OpStore %8 %25 + %26 = OpLoad %6 %8 + %28 = OpAccessChain %18 %14 %16 %27 + %29 = OpLoad %6 %28 + %30 = OpFSub %6 %26 %29 + %31 = OpExtInst %6 %1 FAbs %30 + %32 = OpAccessChain %18 %14 %16 %16 + %33 = OpLoad %6 %32 + %35 = OpFOrdLessThan %34 %31 %33 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %60 + %36 = OpLabel + %47 = OpAccessChain %46 %45 %16 %16 + %48 = OpLoad %15 %47 + %49 = OpConvertSToF %6 %48 + %50 = OpAccessChain %46 %45 %16 %17 + %51 = OpLoad %15 %50 + %52 = OpConvertSToF %6 %51 + %53 = OpAccessChain %46 %45 %16 %17 + %54 = OpLoad %15 %53 + %55 = OpConvertSToF %6 %54 + %56 = OpAccessChain %46 %45 %16 %16 + %57 = OpLoad %15 %56 + %58 = OpConvertSToF %6 %57 + %59 = OpCompositeConstruct %38 %49 %52 %55 %58 + OpStore %40 %59 + OpBranch %37 + %60 = OpLabel + %61 = OpLoad %6 %8 + %62 = OpAccessChain %18 %14 %16 %27 + %63 = OpLoad %6 %62 + %64 = OpFSub %6 %61 %63 + %65 = OpExtInst %6 %1 FAbs %64 + %66 = OpCompositeConstruct %38 %65 %65 %65 %65 + OpStore %40 %66 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.01 3.0 2.63 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-instr-info-det-mat-min.amber b/vulkan/amber/graphicsfuzz/cov-instr-info-det-mat-min.amber new file mode 100644 index 0000000..a45527b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-instr-info-det-mat-min.amber @@ -0,0 +1,338 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instr info code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# int data[10]; +# +# void f1() +# { +# _GLF_color = vec4(0); +# +# for (int i = _int_1; i < _int_10; i++) +# { +# data[i] = _int_0; +# } +# +# float a = determinant(mat2(1.0, 1.0, 1.0, 1.0)); +# float b = determinant(mat2(0.0, 0.0, 0.0, 0.0)); +# +# mat2x4 m24a = mat2x4(a, _float_1_0, _float_1_0, _float_1_0, _float_1_0, +# _float_1_0, _float_1_0, _float_1_0); +# mat2x4 m24b = mat2x4(b, _float_1_0, _float_1_0, _float_1_0, _float_1_0, +# _float_1_0, _float_1_0, _float_1_0); +# +# float c = min(float(m24a), float(m24b)); +# +# if (c < _float_1_0 && a == 0.0 && b == 0.0) +# { +# data[0] = _int_1; +# } +# } +# +# void main() +# { +# for (int i = 0; i <= 10; i++) +# { +# f1(); +# } +# +# _GLF_color = vec4(data[0], _float_0_0, _float_0_0, data[0]); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 152 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %6 "f1(" + OpName %11 "_GLF_color" + OpName %16 "i" + OpName %20 "buf0" + OpMemberName %20 0 "_GLF_uniform_int_values" + OpName %22 "" + OpName %42 "data" + OpName %51 "a" + OpName %58 "b" + OpName %64 "m24a" + OpName %68 "buf1" + OpMemberName %68 0 "_GLF_uniform_float_values" + OpName %70 "" + OpName %89 "m24b" + OpName %108 "c" + OpName %129 "i" + OpDecorate %11 Location 0 + OpDecorate %19 ArrayStride 16 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpDecorate %67 ArrayStride 16 + OpMemberDecorate %68 0 Offset 0 + OpDecorate %68 Block + OpDecorate %70 DescriptorSet 0 + OpDecorate %70 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeFloat 32 + %9 = OpTypeVector %8 4 + %10 = OpTypePointer Output %9 + %11 = OpVariable %10 Output + %12 = OpConstant %8 0 + %13 = OpConstantComposite %9 %12 %12 %12 %12 + %14 = OpTypeInt 32 1 + %15 = OpTypePointer Function %14 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 3 + %19 = OpTypeArray %14 %18 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpConstant %14 0 + %24 = OpConstant %14 1 + %25 = OpTypePointer Uniform %14 + %34 = OpConstant %14 2 + %37 = OpTypeBool + %39 = OpConstant %17 10 + %40 = OpTypeArray %14 %39 + %41 = OpTypePointer Private %40 + %42 = OpVariable %41 Private + %46 = OpTypePointer Private %14 + %50 = OpTypePointer Function %8 + %52 = OpTypeVector %8 2 + %53 = OpTypeMatrix %52 2 + %54 = OpConstant %8 1 + %55 = OpConstantComposite %52 %54 %54 + %56 = OpConstantComposite %53 %55 %55 + %59 = OpConstantComposite %52 %12 %12 + %60 = OpConstantComposite %53 %59 %59 + %62 = OpTypeMatrix %9 2 + %63 = OpTypePointer Function %62 + %66 = OpConstant %17 2 + %67 = OpTypeArray %8 %66 + %68 = OpTypeStruct %67 + %69 = OpTypePointer Uniform %68 + %70 = OpVariable %69 Uniform + %71 = OpTypePointer Uniform %8 + %136 = OpConstant %14 10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %129 = OpVariable %15 Function + OpStore %129 %23 + OpBranch %130 + %130 = OpLabel + OpLoopMerge %132 %133 None + OpBranch %134 + %134 = OpLabel + %135 = OpLoad %14 %129 + %137 = OpSLessThanEqual %37 %135 %136 + OpBranchConditional %137 %131 %132 + %131 = OpLabel + %138 = OpFunctionCall %2 %6 + OpBranch %133 + %133 = OpLabel + %139 = OpLoad %14 %129 + %140 = OpIAdd %14 %139 %24 + OpStore %129 %140 + OpBranch %130 + %132 = OpLabel + %141 = OpAccessChain %46 %42 %23 + %142 = OpLoad %14 %141 + %143 = OpConvertSToF %8 %142 + %144 = OpAccessChain %71 %70 %23 %23 + %145 = OpLoad %8 %144 + %146 = OpAccessChain %71 %70 %23 %23 + %147 = OpLoad %8 %146 + %148 = OpAccessChain %46 %42 %23 + %149 = OpLoad %14 %148 + %150 = OpConvertSToF %8 %149 + %151 = OpCompositeConstruct %9 %143 %145 %147 %150 + OpStore %11 %151 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %16 = OpVariable %15 Function + %51 = OpVariable %50 Function + %58 = OpVariable %50 Function + %64 = OpVariable %63 Function + %89 = OpVariable %63 Function + %108 = OpVariable %50 Function + OpStore %11 %13 + %26 = OpAccessChain %25 %22 %23 %24 + %27 = OpLoad %14 %26 + OpStore %16 %27 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %14 %16 + %35 = OpAccessChain %25 %22 %23 %34 + %36 = OpLoad %14 %35 + %38 = OpSLessThan %37 %33 %36 + OpBranchConditional %38 %29 %30 + %29 = OpLabel + %43 = OpLoad %14 %16 + %44 = OpAccessChain %25 %22 %23 %23 + %45 = OpLoad %14 %44 + %47 = OpAccessChain %46 %42 %43 + OpStore %47 %45 + OpBranch %31 + %31 = OpLabel + %48 = OpLoad %14 %16 + %49 = OpIAdd %14 %48 %24 + OpStore %16 %49 + OpBranch %28 + %30 = OpLabel + %57 = OpExtInst %8 %1 Determinant %56 + OpStore %51 %57 + %61 = OpExtInst %8 %1 Determinant %60 + OpStore %58 %61 + %65 = OpLoad %8 %51 + %72 = OpAccessChain %71 %70 %23 %24 + %73 = OpLoad %8 %72 + %74 = OpAccessChain %71 %70 %23 %24 + %75 = OpLoad %8 %74 + %76 = OpAccessChain %71 %70 %23 %24 + %77 = OpLoad %8 %76 + %78 = OpAccessChain %71 %70 %23 %24 + %79 = OpLoad %8 %78 + %80 = OpAccessChain %71 %70 %23 %24 + %81 = OpLoad %8 %80 + %82 = OpAccessChain %71 %70 %23 %24 + %83 = OpLoad %8 %82 + %84 = OpAccessChain %71 %70 %23 %24 + %85 = OpLoad %8 %84 + %86 = OpCompositeConstruct %9 %65 %73 %75 %77 + %87 = OpCompositeConstruct %9 %79 %81 %83 %85 + %88 = OpCompositeConstruct %62 %86 %87 + OpStore %64 %88 + %90 = OpLoad %8 %58 + %91 = OpAccessChain %71 %70 %23 %24 + %92 = OpLoad %8 %91 + %93 = OpAccessChain %71 %70 %23 %24 + %94 = OpLoad %8 %93 + %95 = OpAccessChain %71 %70 %23 %24 + %96 = OpLoad %8 %95 + %97 = OpAccessChain %71 %70 %23 %24 + %98 = OpLoad %8 %97 + %99 = OpAccessChain %71 %70 %23 %24 + %100 = OpLoad %8 %99 + %101 = OpAccessChain %71 %70 %23 %24 + %102 = OpLoad %8 %101 + %103 = OpAccessChain %71 %70 %23 %24 + %104 = OpLoad %8 %103 + %105 = OpCompositeConstruct %9 %90 %92 %94 %96 + %106 = OpCompositeConstruct %9 %98 %100 %102 %104 + %107 = OpCompositeConstruct %62 %105 %106 + OpStore %89 %107 + %109 = OpLoad %62 %64 + %110 = OpCompositeExtract %8 %109 0 0 + %111 = OpLoad %62 %89 + %112 = OpCompositeExtract %8 %111 0 0 + %113 = OpExtInst %8 %1 FMin %110 %112 + OpStore %108 %113 + %114 = OpLoad %8 %108 + %115 = OpAccessChain %71 %70 %23 %24 + %116 = OpLoad %8 %115 + %117 = OpFOrdLessThan %37 %114 %116 + %118 = OpLoad %8 %51 + %119 = OpFOrdEqual %37 %118 %12 + %120 = OpLogicalAnd %37 %117 %119 + %121 = OpLoad %8 %58 + %122 = OpFOrdEqual %37 %121 %12 + %123 = OpLogicalAnd %37 %120 %122 + OpSelectionMerge %125 None + OpBranchConditional %123 %124 %125 + %124 = OpLabel + %126 = OpAccessChain %25 %22 %23 %24 + %127 = OpLoad %14 %126 + %128 = OpAccessChain %46 %42 %23 + OpStore %128 %127 + OpBranch %125 + %125 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 10 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-instruction-simplify-atanh-log-undefined.amber b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-atanh-log-undefined.amber new file mode 100644 index 0000000..1399726 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-atanh-log-undefined.amber @@ -0,0 +1,192 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplification path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# float a = atanh(_float_1_0) - log(-1.0); +# if (a != _float_0_0) +# { +# _GLF_color.g = _float_0_0; +# } +# } +DEVICE_EXTENSION VK_KHR_shader_float_controls +DEVICE_PROPERTY FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32 +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpCapability SignedZeroInfNanPreserve + OpExtension "SPV_KHR_float_controls" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpExecutionMode %4 SignedZeroInfNanPreserve 32 + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %34 "a" + OpName %36 "buf1" + OpMemberName %36 0 "_GLF_uniform_float_values" + OpName %38 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 RelaxedPrecision + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %20 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %35 ArrayStride 16 + OpMemberDecorate %36 0 Offset 0 + OpDecorate %36 Block + OpDecorate %38 DescriptorSet 0 + OpDecorate %38 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpConstant %10 1 + %33 = OpTypePointer Function %6 + %35 = OpTypeArray %6 %12 + %36 = OpTypeStruct %35 + %37 = OpTypePointer Uniform %36 + %38 = OpVariable %37 Uniform + %39 = OpTypePointer Uniform %6 + %43 = OpConstant %6 0x1.8p+128 + %48 = OpTypeBool + %54 = OpConstant %11 1 + %55 = OpTypePointer Output %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %34 = OpVariable %33 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %23 = OpAccessChain %18 %16 %17 %22 + %24 = OpLoad %10 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpAccessChain %18 %16 %17 %22 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %10 %29 + %31 = OpConvertSToF %6 %30 + %32 = OpCompositeConstruct %7 %21 %25 %28 %31 + OpStore %9 %32 + %40 = OpAccessChain %39 %38 %17 %22 + %41 = OpLoad %6 %40 + %42 = OpExtInst %6 %1 Atanh %41 + %44 = OpFSub %6 %42 %43 + OpStore %34 %44 + %45 = OpLoad %6 %34 + %46 = OpAccessChain %39 %38 %17 %17 + %47 = OpLoad %6 %46 + %49 = OpFOrdNotEqual %48 %45 %47 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %51 + %50 = OpLabel + %52 = OpAccessChain %39 %38 %17 %17 + %53 = OpLoad %6 %52 + %56 = OpAccessChain %55 %9 %54 + OpStore %56 %53 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-instruction-simplify-bit-shifting.amber b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-bit-shifting.amber new file mode 100644 index 0000000..f23fe7b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-bit-shifting.amber @@ -0,0 +1,161 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplification path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 1 >> (_int_0 << 5) >> _int_0; +# if (a == 1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(a); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %34 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %34 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %6 0 + %17 = OpTypePointer Uniform %6 + %20 = OpConstant %6 5 + %27 = OpTypeBool + %31 = OpTypeFloat 32 + %32 = OpTypeVector %31 4 + %33 = OpTypePointer Output %32 + %34 = OpVariable %33 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpAccessChain %17 %15 %16 %16 + %19 = OpLoad %6 %18 + %21 = OpShiftLeftLogical %6 %19 %20 + %22 = OpShiftRightArithmetic %6 %9 %21 + %23 = OpAccessChain %17 %15 %16 %16 + %24 = OpLoad %6 %23 + %25 = OpShiftRightArithmetic %6 %22 %24 + OpStore %8 %25 + %26 = OpLoad %6 %8 + %28 = OpIEqual %27 %26 %9 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %48 + %29 = OpLabel + %35 = OpAccessChain %17 %15 %16 %9 + %36 = OpLoad %6 %35 + %37 = OpConvertSToF %31 %36 + %38 = OpAccessChain %17 %15 %16 %16 + %39 = OpLoad %6 %38 + %40 = OpConvertSToF %31 %39 + %41 = OpAccessChain %17 %15 %16 %16 + %42 = OpLoad %6 %41 + %43 = OpConvertSToF %31 %42 + %44 = OpAccessChain %17 %15 %16 %9 + %45 = OpLoad %6 %44 + %46 = OpConvertSToF %31 %45 + %47 = OpCompositeConstruct %32 %37 %40 %43 %46 + OpStore %34 %47 + OpBranch %30 + %48 = OpLabel + %49 = OpLoad %6 %8 + %50 = OpConvertSToF %31 %49 + %51 = OpCompositeConstruct %32 %50 %50 %50 %50 + OpStore %34 %51 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-instruction-simplify-inclusive-or.amber b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-inclusive-or.amber new file mode 100644 index 0000000..df7205c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-inclusive-or.amber @@ -0,0 +1,188 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplification path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = vec2(_int_0, _int_1)[_int_0 | 1]; +# if (a == _float_1_0) +# { +# _GLF_color = vec4(a, _int_0, _int_0, a); +# } +# else +# { +# _GLF_color = vec4(a); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %34 "buf1" + OpMemberName %34 0 "_GLF_uniform_float_values" + OpName %36 "" + OpName %46 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %33 ArrayStride 16 + OpMemberDecorate %34 0 Offset 0 + OpDecorate %34 Block + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 1 + OpDecorate %46 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 1 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %9 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %9 0 + %17 = OpTypePointer Uniform %9 + %21 = OpConstant %9 1 + %25 = OpTypeVector %6 2 + %32 = OpConstant %10 1 + %33 = OpTypeArray %6 %32 + %34 = OpTypeStruct %33 + %35 = OpTypePointer Uniform %34 + %36 = OpVariable %35 Uniform + %37 = OpTypePointer Uniform %6 + %40 = OpTypeBool + %44 = OpTypeVector %6 4 + %45 = OpTypePointer Output %44 + %46 = OpVariable %45 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpAccessChain %17 %15 %16 %16 + %19 = OpLoad %9 %18 + %20 = OpConvertSToF %6 %19 + %22 = OpAccessChain %17 %15 %16 %21 + %23 = OpLoad %9 %22 + %24 = OpConvertSToF %6 %23 + %26 = OpCompositeConstruct %25 %20 %24 + %27 = OpAccessChain %17 %15 %16 %16 + %28 = OpLoad %9 %27 + %29 = OpBitwiseOr %9 %28 %21 + %30 = OpVectorExtractDynamic %6 %26 %29 + OpStore %8 %30 + %31 = OpLoad %6 %8 + %38 = OpAccessChain %37 %36 %16 %16 + %39 = OpLoad %6 %38 + %41 = OpFOrdEqual %40 %31 %39 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %56 + %42 = OpLabel + %47 = OpLoad %6 %8 + %48 = OpAccessChain %17 %15 %16 %16 + %49 = OpLoad %9 %48 + %50 = OpConvertSToF %6 %49 + %51 = OpAccessChain %17 %15 %16 %16 + %52 = OpLoad %9 %51 + %53 = OpConvertSToF %6 %52 + %54 = OpLoad %6 %8 + %55 = OpCompositeConstruct %44 %47 %50 %53 %54 + OpStore %46 %55 + OpBranch %43 + %56 = OpLabel + %57 = OpLoad %6 %8 + %58 = OpCompositeConstruct %44 %57 %57 %57 %57 + OpStore %46 %58 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result.amber b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result.amber new file mode 100644 index 0000000..cfc9762 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result.amber @@ -0,0 +1,558 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplification path + +# The test passes because the shader always writes red + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_3 _GLF_uniform_int_values[2] +# #define _int_4 _GLF_uniform_int_values[3] +# #define _int_5 _GLF_uniform_int_values[4] +# #define _int_6 _GLF_uniform_int_values[5] +# #define _int_10 _GLF_uniform_int_values[6] +# #define _int_11 _GLF_uniform_int_values[7] +# #define _int_7 _GLF_uniform_int_values[8] +# #define _int_8 _GLF_uniform_int_values[9] +# #define _int_9 _GLF_uniform_int_values[10] +# #define _int_1 _GLF_uniform_int_values[11] +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 2, 3, 4, 5, 6, 10, 11, 7, 8, 9, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[12]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Always returns a. +# int f(int a) +# { +# for (int i = _int_0; i < _int_10; i++) +# { +# if (i > _int_3) +# { +# return a; +# } +# } +# return _int_0; +# } +# void main() +# { +# int a[10]; +# int ref[10]; +# ref[_int_0] = _int_2; +# ref[_int_1] = _int_3; +# ref[_int_2] = _int_4; +# ref[_int_3] = _int_5; +# ref[_int_4] = _int_6; +# +# ref[_int_5] = _int_10; +# ref[_int_6] = _int_11; +# +# ref[_int_7] = _int_7; +# ref[_int_8] = _int_8; +# ref[_int_9] = _int_9; +# +# for (int i = _int_0; i < _int_10; i++) +# { +# a[i] = i; +# +# // True for i = 0..4. +# if (i < _int_10 / _int_2) +# { +# a[i] = i + _int_2; +# +# // Always true. +# if (i < _int_10) +# { +# continue; +# } +# +# // Unreachable code below. +# a[i] = i + _int_7; +# +# if (f(a[i]) < _int_7) +# { +# a[i]--; +# } +# } +# else +# { +# // True for i = 5..6. +# if (f(a[i]) < _int_7) +# { +# a[i] += _int_5; +# } +# } +# } +# for (int i = _int_0; i < _int_10; i++) +# { +# if (a[i] != ref[i]) +# { +# _GLF_color = vec4(_int_0); +# return; +# } +# } +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 235 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %214 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "f(i1;" + OpName %9 "a" + OpName %12 "i" + OpName %16 "buf0" + OpMemberName %16 0 "_GLF_uniform_int_values" + OpName %18 "" + OpName %53 "ref" + OpName %112 "i" + OpName %124 "a" + OpName %157 "param" + OpName %172 "param" + OpName %190 "i" + OpName %214 "_GLF_color" + OpDecorate %10 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 RelaxedPrecision + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %22 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %61 RelaxedPrecision + OpDecorate %63 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %69 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %78 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %84 RelaxedPrecision + OpDecorate %86 RelaxedPrecision + OpDecorate %89 RelaxedPrecision + OpDecorate %92 RelaxedPrecision + OpDecorate %96 RelaxedPrecision + OpDecorate %98 RelaxedPrecision + OpDecorate %102 RelaxedPrecision + OpDecorate %104 RelaxedPrecision + OpDecorate %108 RelaxedPrecision + OpDecorate %110 RelaxedPrecision + OpDecorate %112 RelaxedPrecision + OpDecorate %114 RelaxedPrecision + OpDecorate %120 RelaxedPrecision + OpDecorate %122 RelaxedPrecision + OpDecorate %124 RelaxedPrecision + OpDecorate %125 RelaxedPrecision + OpDecorate %126 RelaxedPrecision + OpDecorate %128 RelaxedPrecision + OpDecorate %130 RelaxedPrecision + OpDecorate %132 RelaxedPrecision + OpDecorate %133 RelaxedPrecision + OpDecorate %137 RelaxedPrecision + OpDecorate %138 RelaxedPrecision + OpDecorate %140 RelaxedPrecision + OpDecorate %141 RelaxedPrecision + OpDecorate %143 RelaxedPrecision + OpDecorate %145 RelaxedPrecision + OpDecorate %150 RelaxedPrecision + OpDecorate %151 RelaxedPrecision + OpDecorate %153 RelaxedPrecision + OpDecorate %154 RelaxedPrecision + OpDecorate %156 RelaxedPrecision + OpDecorate %159 RelaxedPrecision + OpDecorate %160 RelaxedPrecision + OpDecorate %162 RelaxedPrecision + OpDecorate %166 RelaxedPrecision + OpDecorate %168 RelaxedPrecision + OpDecorate %169 RelaxedPrecision + OpDecorate %171 RelaxedPrecision + OpDecorate %174 RelaxedPrecision + OpDecorate %175 RelaxedPrecision + OpDecorate %177 RelaxedPrecision + OpDecorate %181 RelaxedPrecision + OpDecorate %183 RelaxedPrecision + OpDecorate %185 RelaxedPrecision + OpDecorate %186 RelaxedPrecision + OpDecorate %188 RelaxedPrecision + OpDecorate %189 RelaxedPrecision + OpDecorate %190 RelaxedPrecision + OpDecorate %192 RelaxedPrecision + OpDecorate %198 RelaxedPrecision + OpDecorate %200 RelaxedPrecision + OpDecorate %202 RelaxedPrecision + OpDecorate %204 RelaxedPrecision + OpDecorate %205 RelaxedPrecision + OpDecorate %207 RelaxedPrecision + OpDecorate %214 Location 0 + OpDecorate %216 RelaxedPrecision + OpDecorate %220 RelaxedPrecision + OpDecorate %221 RelaxedPrecision + OpDecorate %223 RelaxedPrecision + OpDecorate %226 RelaxedPrecision + OpDecorate %229 RelaxedPrecision + OpDecorate %232 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 12 + %15 = OpTypeArray %6 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpConstant %6 0 + %20 = OpTypePointer Uniform %6 + %29 = OpConstant %6 6 + %32 = OpTypeBool + %35 = OpConstant %6 2 + %44 = OpConstant %6 1 + %50 = OpConstant %13 10 + %51 = OpTypeArray %6 %50 + %52 = OpTypePointer Function %51 + %59 = OpConstant %6 11 + %67 = OpConstant %6 3 + %73 = OpConstant %6 4 + %79 = OpConstant %6 5 + %90 = OpConstant %6 7 + %94 = OpConstant %6 8 + %100 = OpConstant %6 9 + %106 = OpConstant %6 10 + %211 = OpTypeFloat 32 + %212 = OpTypeVector %211 4 + %213 = OpTypePointer Output %212 + %214 = OpVariable %213 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %53 = OpVariable %52 Function + %112 = OpVariable %7 Function + %124 = OpVariable %52 Function + %157 = OpVariable %7 Function + %172 = OpVariable %7 Function + %190 = OpVariable %7 Function + %54 = OpAccessChain %20 %18 %19 %19 + %55 = OpLoad %6 %54 + %56 = OpAccessChain %20 %18 %19 %44 + %57 = OpLoad %6 %56 + %58 = OpAccessChain %7 %53 %55 + OpStore %58 %57 + %60 = OpAccessChain %20 %18 %19 %59 + %61 = OpLoad %6 %60 + %62 = OpAccessChain %20 %18 %19 %35 + %63 = OpLoad %6 %62 + %64 = OpAccessChain %7 %53 %61 + OpStore %64 %63 + %65 = OpAccessChain %20 %18 %19 %44 + %66 = OpLoad %6 %65 + %68 = OpAccessChain %20 %18 %19 %67 + %69 = OpLoad %6 %68 + %70 = OpAccessChain %7 %53 %66 + OpStore %70 %69 + %71 = OpAccessChain %20 %18 %19 %35 + %72 = OpLoad %6 %71 + %74 = OpAccessChain %20 %18 %19 %73 + %75 = OpLoad %6 %74 + %76 = OpAccessChain %7 %53 %72 + OpStore %76 %75 + %77 = OpAccessChain %20 %18 %19 %67 + %78 = OpLoad %6 %77 + %80 = OpAccessChain %20 %18 %19 %79 + %81 = OpLoad %6 %80 + %82 = OpAccessChain %7 %53 %78 + OpStore %82 %81 + %83 = OpAccessChain %20 %18 %19 %73 + %84 = OpLoad %6 %83 + %85 = OpAccessChain %20 %18 %19 %29 + %86 = OpLoad %6 %85 + %87 = OpAccessChain %7 %53 %84 + OpStore %87 %86 + %88 = OpAccessChain %20 %18 %19 %79 + %89 = OpLoad %6 %88 + %91 = OpAccessChain %20 %18 %19 %90 + %92 = OpLoad %6 %91 + %93 = OpAccessChain %7 %53 %89 + OpStore %93 %92 + %95 = OpAccessChain %20 %18 %19 %94 + %96 = OpLoad %6 %95 + %97 = OpAccessChain %20 %18 %19 %94 + %98 = OpLoad %6 %97 + %99 = OpAccessChain %7 %53 %96 + OpStore %99 %98 + %101 = OpAccessChain %20 %18 %19 %100 + %102 = OpLoad %6 %101 + %103 = OpAccessChain %20 %18 %19 %100 + %104 = OpLoad %6 %103 + %105 = OpAccessChain %7 %53 %102 + OpStore %105 %104 + %107 = OpAccessChain %20 %18 %19 %106 + %108 = OpLoad %6 %107 + %109 = OpAccessChain %20 %18 %19 %106 + %110 = OpLoad %6 %109 + %111 = OpAccessChain %7 %53 %108 + OpStore %111 %110 + %113 = OpAccessChain %20 %18 %19 %19 + %114 = OpLoad %6 %113 + OpStore %112 %114 + OpBranch %115 + %115 = OpLabel + OpLoopMerge %117 %118 None + OpBranch %119 + %119 = OpLabel + %120 = OpLoad %6 %112 + %121 = OpAccessChain %20 %18 %19 %29 + %122 = OpLoad %6 %121 + %123 = OpSLessThan %32 %120 %122 + OpBranchConditional %123 %116 %117 + %116 = OpLabel + %125 = OpLoad %6 %112 + %126 = OpLoad %6 %112 + %127 = OpAccessChain %7 %124 %125 + OpStore %127 %126 + %128 = OpLoad %6 %112 + %129 = OpAccessChain %20 %18 %19 %29 + %130 = OpLoad %6 %129 + %131 = OpAccessChain %20 %18 %19 %44 + %132 = OpLoad %6 %131 + %133 = OpSDiv %6 %130 %132 + %134 = OpSLessThan %32 %128 %133 + OpSelectionMerge %136 None + OpBranchConditional %134 %135 %170 + %135 = OpLabel + %137 = OpLoad %6 %112 + %138 = OpLoad %6 %112 + %139 = OpAccessChain %20 %18 %19 %44 + %140 = OpLoad %6 %139 + %141 = OpIAdd %6 %138 %140 + %142 = OpAccessChain %7 %124 %137 + OpStore %142 %141 + %143 = OpLoad %6 %112 + %144 = OpAccessChain %20 %18 %19 %29 + %145 = OpLoad %6 %144 + %146 = OpSLessThan %32 %143 %145 + OpSelectionMerge %148 None + OpBranchConditional %146 %147 %148 + %147 = OpLabel + OpBranch %118 + %148 = OpLabel + %150 = OpLoad %6 %112 + %151 = OpLoad %6 %112 + %152 = OpAccessChain %20 %18 %19 %94 + %153 = OpLoad %6 %152 + %154 = OpIAdd %6 %151 %153 + %155 = OpAccessChain %7 %124 %150 + OpStore %155 %154 + %156 = OpLoad %6 %112 + %158 = OpAccessChain %7 %124 %156 + %159 = OpLoad %6 %158 + OpStore %157 %159 + %160 = OpFunctionCall %6 %10 %157 + %161 = OpAccessChain %20 %18 %19 %94 + %162 = OpLoad %6 %161 + %163 = OpSLessThan %32 %160 %162 + OpSelectionMerge %165 None + OpBranchConditional %163 %164 %165 + %164 = OpLabel + %166 = OpLoad %6 %112 + %167 = OpAccessChain %7 %124 %166 + %168 = OpLoad %6 %167 + %169 = OpISub %6 %168 %44 + OpStore %167 %169 + OpBranch %165 + %165 = OpLabel + OpBranch %136 + %170 = OpLabel + %171 = OpLoad %6 %112 + %173 = OpAccessChain %7 %124 %171 + %174 = OpLoad %6 %173 + OpStore %172 %174 + %175 = OpFunctionCall %6 %10 %172 + %176 = OpAccessChain %20 %18 %19 %94 + %177 = OpLoad %6 %176 + %178 = OpSLessThan %32 %175 %177 + OpSelectionMerge %180 None + OpBranchConditional %178 %179 %180 + %179 = OpLabel + %181 = OpLoad %6 %112 + %182 = OpAccessChain %20 %18 %19 %73 + %183 = OpLoad %6 %182 + %184 = OpAccessChain %7 %124 %181 + %185 = OpLoad %6 %184 + %186 = OpIAdd %6 %185 %183 + %187 = OpAccessChain %7 %124 %181 + OpStore %187 %186 + OpBranch %180 + %180 = OpLabel + OpBranch %136 + %136 = OpLabel + OpBranch %118 + %118 = OpLabel + %188 = OpLoad %6 %112 + %189 = OpIAdd %6 %188 %44 + OpStore %112 %189 + OpBranch %115 + %117 = OpLabel + %191 = OpAccessChain %20 %18 %19 %19 + %192 = OpLoad %6 %191 + OpStore %190 %192 + OpBranch %193 + %193 = OpLabel + OpLoopMerge %195 %196 None + OpBranch %197 + %197 = OpLabel + %198 = OpLoad %6 %190 + %199 = OpAccessChain %20 %18 %19 %29 + %200 = OpLoad %6 %199 + %201 = OpSLessThan %32 %198 %200 + OpBranchConditional %201 %194 %195 + %194 = OpLabel + %202 = OpLoad %6 %190 + %203 = OpAccessChain %7 %124 %202 + %204 = OpLoad %6 %203 + %205 = OpLoad %6 %190 + %206 = OpAccessChain %7 %53 %205 + %207 = OpLoad %6 %206 + %208 = OpINotEqual %32 %204 %207 + OpSelectionMerge %210 None + OpBranchConditional %208 %209 %210 + %209 = OpLabel + %215 = OpAccessChain %20 %18 %19 %19 + %216 = OpLoad %6 %215 + %217 = OpConvertSToF %211 %216 + %218 = OpCompositeConstruct %212 %217 %217 %217 %217 + OpStore %214 %218 + OpReturn + %210 = OpLabel + OpBranch %196 + %196 = OpLabel + %220 = OpLoad %6 %190 + %221 = OpIAdd %6 %220 %44 + OpStore %190 %221 + OpBranch %193 + %195 = OpLabel + %222 = OpAccessChain %20 %18 %19 %59 + %223 = OpLoad %6 %222 + %224 = OpConvertSToF %211 %223 + %225 = OpAccessChain %20 %18 %19 %19 + %226 = OpLoad %6 %225 + %227 = OpConvertSToF %211 %226 + %228 = OpAccessChain %20 %18 %19 %19 + %229 = OpLoad %6 %228 + %230 = OpConvertSToF %211 %229 + %231 = OpAccessChain %20 %18 %19 %59 + %232 = OpLoad %6 %231 + %233 = OpConvertSToF %211 %232 + %234 = OpCompositeConstruct %212 %224 %227 %230 %233 + OpStore %214 %234 + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %12 = OpVariable %7 Function + %21 = OpAccessChain %20 %18 %19 %19 + %22 = OpLoad %6 %21 + OpStore %12 %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %6 %12 + %30 = OpAccessChain %20 %18 %19 %29 + %31 = OpLoad %6 %30 + %33 = OpSLessThan %32 %28 %31 + OpBranchConditional %33 %24 %25 + %24 = OpLabel + %34 = OpLoad %6 %12 + %36 = OpAccessChain %20 %18 %19 %35 + %37 = OpLoad %6 %36 + %38 = OpSGreaterThan %32 %34 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + %41 = OpLoad %6 %9 + OpReturnValue %41 + %40 = OpLabel + OpBranch %26 + %26 = OpLabel + %43 = OpLoad %6 %12 + %45 = OpIAdd %6 %43 %44 + OpStore %12 %45 + OpBranch %23 + %25 = OpLabel + %46 = OpAccessChain %20 %18 %19 %19 + %47 = OpLoad %6 %46 + OpReturnValue %47 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 2 3 4 5 6 10 11 7 8 9 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined.amber b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined.amber new file mode 100644 index 0000000..5274959 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined.amber @@ -0,0 +1,190 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplification path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# float a = mod(_float_1_0, acos(1.01)); +# if (a != _float_0_0) +# { +# _GLF_color.g = _float_0_0; +# } +# } +DEVICE_EXTENSION VK_KHR_shader_float_controls +DEVICE_PROPERTY FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32 +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpCapability SignedZeroInfNanPreserve + OpExtension "SPV_KHR_float_controls" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpExecutionMode %4 SignedZeroInfNanPreserve 32 + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %34 "a" + OpName %36 "buf1" + OpMemberName %36 0 "_GLF_uniform_float_values" + OpName %38 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 RelaxedPrecision + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %20 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %35 ArrayStride 16 + OpMemberDecorate %36 0 Offset 0 + OpDecorate %36 Block + OpDecorate %38 DescriptorSet 0 + OpDecorate %38 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpConstant %10 1 + %33 = OpTypePointer Function %6 + %35 = OpTypeArray %6 %12 + %36 = OpTypeStruct %35 + %37 = OpTypePointer Uniform %36 + %38 = OpVariable %37 Uniform + %39 = OpTypePointer Uniform %6 + %42 = OpConstant %6 0x1.8p+128 + %47 = OpTypeBool + %53 = OpConstant %11 1 + %54 = OpTypePointer Output %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %34 = OpVariable %33 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %23 = OpAccessChain %18 %16 %17 %22 + %24 = OpLoad %10 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpAccessChain %18 %16 %17 %22 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %10 %29 + %31 = OpConvertSToF %6 %30 + %32 = OpCompositeConstruct %7 %21 %25 %28 %31 + OpStore %9 %32 + %40 = OpAccessChain %39 %38 %17 %22 + %41 = OpLoad %6 %40 + %43 = OpFMod %6 %41 %42 + OpStore %34 %43 + %44 = OpLoad %6 %34 + %45 = OpAccessChain %39 %38 %17 %17 + %46 = OpLoad %6 %45 + %48 = OpFOrdNotEqual %47 %44 %46 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %50 + %49 = OpLabel + %51 = OpAccessChain %39 %38 %17 %17 + %52 = OpLoad %6 %51 + %55 = OpAccessChain %54 %9 %53 + OpStore %55 %52 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined.amber b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined.amber new file mode 100644 index 0000000..c5bcecf --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined.amber @@ -0,0 +1,190 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplification path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# float a = mod(sqrt(-1.), _float_1_0); +# if (a != _float_0_0) +# { +# _GLF_color.g = _float_0_0; +# } +# } +DEVICE_EXTENSION VK_KHR_shader_float_controls +DEVICE_PROPERTY FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32 +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpCapability SignedZeroInfNanPreserve + OpExtension "SPV_KHR_float_controls" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpExecutionMode %4 SignedZeroInfNanPreserve 32 + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %34 "a" + OpName %37 "buf1" + OpMemberName %37 0 "_GLF_uniform_float_values" + OpName %39 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 RelaxedPrecision + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %20 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpConstant %10 1 + %33 = OpTypePointer Function %6 + %35 = OpConstant %6 -0x1.8p+128 + %36 = OpTypeArray %6 %12 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %6 + %47 = OpTypeBool + %53 = OpConstant %11 1 + %54 = OpTypePointer Output %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %34 = OpVariable %33 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %23 = OpAccessChain %18 %16 %17 %22 + %24 = OpLoad %10 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpAccessChain %18 %16 %17 %22 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %10 %29 + %31 = OpConvertSToF %6 %30 + %32 = OpCompositeConstruct %7 %21 %25 %28 %31 + OpStore %9 %32 + %41 = OpAccessChain %40 %39 %17 %22 + %42 = OpLoad %6 %41 + %43 = OpFMod %6 %35 %42 + OpStore %34 %43 + %44 = OpLoad %6 %34 + %45 = OpAccessChain %40 %39 %17 %17 + %46 = OpLoad %6 %45 + %48 = OpFOrdNotEqual %47 %44 %46 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %50 + %49 = OpLabel + %51 = OpAccessChain %40 %39 %17 %17 + %52 = OpLoad %6 %51 + %55 = OpAccessChain %54 %9 %53 + OpStore %55 %52 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-instruction-simplify-sqrt.amber b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-sqrt.amber new file mode 100644 index 0000000..8743e6f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-instruction-simplify-sqrt.amber @@ -0,0 +1,182 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplify code path + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a187dd58a0485988841d325a85c8e6063f53500a + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = _float_1_0; +# a = -1.; +# if (sqrt(_float_0_0) < a) +# { +# _GLF_color = vec4(_int_0); +# } +# else +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %31 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %31 "_GLF_color" + OpName %33 "buf1" + OpMemberName %33 0 "_GLF_uniform_int_values" + OpName %35 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %31 Location 0 + OpDecorate %32 ArrayStride 16 + OpMemberDecorate %33 0 RelaxedPrecision + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 1 + OpDecorate %39 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %20 = OpConstant %6 -1 + %25 = OpTypeBool + %29 = OpTypeVector %6 4 + %30 = OpTypePointer Output %29 + %31 = OpVariable %30 Output + %32 = OpTypeArray %15 %10 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpConstant %15 1 + %37 = OpTypePointer Uniform %15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %21 = OpAccessChain %17 %14 %16 %16 + %22 = OpLoad %6 %21 + %23 = OpExtInst %6 %1 Sqrt %22 + %26 = OpFOrdLessThan %25 %23 %20 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %42 + %27 = OpLabel + %38 = OpAccessChain %37 %35 %16 %36 + %39 = OpLoad %15 %38 + %40 = OpConvertSToF %6 %39 + %41 = OpCompositeConstruct %29 %40 %40 %40 %40 + OpStore %31 %41 + OpBranch %28 + %42 = OpLabel + %43 = OpAccessChain %37 %35 %16 %16 + %44 = OpLoad %15 %43 + %45 = OpConvertSToF %6 %44 + %46 = OpAccessChain %37 %35 %16 %36 + %47 = OpLoad %15 %46 + %48 = OpConvertSToF %6 %47 + %55 = OpCompositeConstruct %29 %45 %48 %48 %45 + OpStore %31 %55 + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-instructions-first-value-phi.amber b/vulkan/amber/graphicsfuzz/cov-instructions-first-value-phi.amber new file mode 100644 index 0000000..9d17079 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-instructions-first-value-phi.amber @@ -0,0 +1,405 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instructions code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_5 _GLF_uniform_int_values[4] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [3, 2, 0, 1, 5] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# // Contents of v1: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 v1; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S { +# int data; +# }; +# +# void func(inout S s) +# { +# // Always false. +# if (v1.x > v1.y) +# { +# return; +# } +# s.data = _int_3; +# } +# void main() +# { +# S arr[3]; +# for (int i = _int_0; i < _int_3; i++) +# { +# arr[i].data = i; +# } +# for (int i = _int_0; i < _int_3; i++) +# { +# // Always false. +# if (v1.x > v1.y) +# { +# break; +# } +# // True for i == 1. +# if (arr[i].data == _int_1) +# { +# func(arr[i]); +# } +# else +# { +# for (int j = _int_0; j < _int_3; j++) +# { +# // Always false. +# if (arr[j].data > _int_5) +# { +# discard; +# } +# } +# } +# } +# if (arr[_int_0].data == _int_0 && arr[_int_1].data == _int_3 && +# arr[_int_2].data == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 178 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %159 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "S" + OpMemberName %7 0 "data" + OpName %11 "func(struct-S-i11;" + OpName %10 "s" + OpName %15 "buf1" + OpMemberName %15 0 "v1" + OpName %17 "" + OpName %34 "buf0" + OpMemberName %34 0 "_GLF_uniform_int_values" + OpName %36 "" + OpName %42 "i" + OpName %58 "arr" + OpName %65 "i" + OpName %95 "param" + OpName %102 "j" + OpName %159 "_GLF_color" + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 1 + OpDecorate %33 ArrayStride 16 + OpMemberDecorate %34 0 Offset 0 + OpDecorate %34 Block + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 0 + OpDecorate %159 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %2 %8 + %13 = OpTypeFloat 32 + %14 = OpTypeVector %13 2 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 0 + %21 = OpTypePointer Uniform %13 + %24 = OpConstant %19 1 + %27 = OpTypeBool + %32 = OpConstant %19 5 + %33 = OpTypeArray %6 %32 + %34 = OpTypeStruct %33 + %35 = OpTypePointer Uniform %34 + %36 = OpVariable %35 Uniform + %37 = OpTypePointer Uniform %6 + %40 = OpTypePointer Function %6 + %43 = OpConstant %6 2 + %55 = OpConstant %19 3 + %56 = OpTypeArray %7 %55 + %57 = OpTypePointer Function %56 + %63 = OpConstant %6 1 + %88 = OpConstant %6 3 + %117 = OpConstant %6 4 + %157 = OpTypeVector %13 4 + %158 = OpTypePointer Output %157 + %159 = OpVariable %158 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %42 = OpVariable %40 Function + %58 = OpVariable %57 Function + %65 = OpVariable %40 Function + %95 = OpVariable %8 Function + %102 = OpVariable %40 Function + %44 = OpAccessChain %37 %36 %18 %43 + %45 = OpLoad %6 %44 + OpStore %42 %45 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %6 %42 + %52 = OpAccessChain %37 %36 %18 %18 + %53 = OpLoad %6 %52 + %54 = OpSLessThan %27 %51 %53 + OpBranchConditional %54 %47 %48 + %47 = OpLabel + %59 = OpLoad %6 %42 + %60 = OpLoad %6 %42 + %61 = OpAccessChain %40 %58 %59 %18 + OpStore %61 %60 + OpBranch %49 + %49 = OpLabel + %62 = OpLoad %6 %42 + %64 = OpIAdd %6 %62 %63 + OpStore %42 %64 + OpBranch %46 + %48 = OpLabel + %66 = OpAccessChain %37 %36 %18 %43 + %67 = OpLoad %6 %66 + OpStore %65 %67 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %65 + %74 = OpAccessChain %37 %36 %18 %18 + %75 = OpLoad %6 %74 + %76 = OpSLessThan %27 %73 %75 + OpBranchConditional %76 %69 %70 + %69 = OpLabel + %77 = OpAccessChain %21 %17 %18 %20 + %78 = OpLoad %13 %77 + %79 = OpAccessChain %21 %17 %18 %24 + %80 = OpLoad %13 %79 + %81 = OpFOrdGreaterThan %27 %78 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %83 + %82 = OpLabel + OpBranch %70 + %83 = OpLabel + %85 = OpLoad %6 %65 + %86 = OpAccessChain %40 %58 %85 %18 + %87 = OpLoad %6 %86 + %89 = OpAccessChain %37 %36 %18 %88 + %90 = OpLoad %6 %89 + %91 = OpIEqual %27 %87 %90 + OpSelectionMerge %93 None + OpBranchConditional %91 %92 %101 + %92 = OpLabel + %94 = OpLoad %6 %65 + %96 = OpAccessChain %8 %58 %94 + %97 = OpLoad %7 %96 + OpStore %95 %97 + %98 = OpFunctionCall %2 %11 %95 + %99 = OpLoad %7 %95 + %100 = OpAccessChain %8 %58 %94 + OpStore %100 %99 + OpBranch %93 + %101 = OpLabel + %103 = OpAccessChain %37 %36 %18 %43 + %104 = OpLoad %6 %103 + OpStore %102 %104 + OpBranch %105 + %105 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %110 = OpLoad %6 %102 + %111 = OpAccessChain %37 %36 %18 %18 + %112 = OpLoad %6 %111 + %113 = OpSLessThan %27 %110 %112 + OpBranchConditional %113 %106 %107 + %106 = OpLabel + %114 = OpLoad %6 %102 + %115 = OpAccessChain %40 %58 %114 %18 + %116 = OpLoad %6 %115 + %118 = OpAccessChain %37 %36 %18 %117 + %119 = OpLoad %6 %118 + %120 = OpSGreaterThan %27 %116 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + OpTerminateInvocation + %122 = OpLabel + OpBranch %108 + %108 = OpLabel + %124 = OpLoad %6 %102 + %125 = OpIAdd %6 %124 %63 + OpStore %102 %125 + OpBranch %105 + %107 = OpLabel + OpBranch %93 + %93 = OpLabel + OpBranch %71 + %71 = OpLabel + %126 = OpLoad %6 %65 + %127 = OpIAdd %6 %126 %63 + OpStore %65 %127 + OpBranch %68 + %70 = OpLabel + %128 = OpAccessChain %37 %36 %18 %43 + %129 = OpLoad %6 %128 + %130 = OpAccessChain %40 %58 %129 %18 + %131 = OpLoad %6 %130 + %132 = OpAccessChain %37 %36 %18 %43 + %133 = OpLoad %6 %132 + %134 = OpIEqual %27 %131 %133 + OpSelectionMerge %136 None + OpBranchConditional %134 %135 %136 + %135 = OpLabel + %137 = OpAccessChain %37 %36 %18 %88 + %138 = OpLoad %6 %137 + %139 = OpAccessChain %40 %58 %138 %18 + %140 = OpLoad %6 %139 + %141 = OpAccessChain %37 %36 %18 %18 + %142 = OpLoad %6 %141 + %143 = OpIEqual %27 %140 %142 + OpBranch %136 + %136 = OpLabel + %144 = OpPhi %27 %134 %70 %143 %135 + OpSelectionMerge %146 None + OpBranchConditional %144 %145 %146 + %145 = OpLabel + %147 = OpAccessChain %37 %36 %18 %63 + %148 = OpLoad %6 %147 + %149 = OpAccessChain %40 %58 %148 %18 + %150 = OpLoad %6 %149 + %151 = OpAccessChain %37 %36 %18 %63 + %152 = OpLoad %6 %151 + %153 = OpIEqual %27 %150 %152 + OpBranch %146 + %146 = OpLabel + %154 = OpPhi %27 %144 %136 %153 %145 + OpSelectionMerge %156 None + OpBranchConditional %154 %155 %173 + %155 = OpLabel + %160 = OpAccessChain %37 %36 %18 %88 + %161 = OpLoad %6 %160 + %162 = OpConvertSToF %13 %161 + %163 = OpAccessChain %37 %36 %18 %43 + %164 = OpLoad %6 %163 + %165 = OpConvertSToF %13 %164 + %166 = OpAccessChain %37 %36 %18 %43 + %167 = OpLoad %6 %166 + %168 = OpConvertSToF %13 %167 + %169 = OpAccessChain %37 %36 %18 %88 + %170 = OpLoad %6 %169 + %171 = OpConvertSToF %13 %170 + %172 = OpCompositeConstruct %157 %162 %165 %168 %171 + OpStore %159 %172 + OpBranch %156 + %173 = OpLabel + %174 = OpAccessChain %37 %36 %18 %43 + %175 = OpLoad %6 %174 + %176 = OpConvertSToF %13 %175 + %177 = OpCompositeConstruct %157 %176 %176 %176 %176 + OpStore %159 %177 + OpBranch %156 + %156 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %9 + %10 = OpFunctionParameter %8 + %12 = OpLabel + %22 = OpAccessChain %21 %17 %18 %20 + %23 = OpLoad %13 %22 + %25 = OpAccessChain %21 %17 %18 %24 + %26 = OpLoad %13 %25 + %28 = OpFOrdGreaterThan %27 %23 %26 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %30 + %29 = OpLabel + OpReturn + %30 = OpLabel + %38 = OpAccessChain %37 %36 %18 %18 + %39 = OpLoad %6 %38 + %41 = OpAccessChain %40 %10 %18 + OpStore %41 %39 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# v1 +BUFFER variant_v1 DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 2 0 1 5 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_v1 AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-instructions-for-if-less-than-equal.amber b/vulkan/amber/graphicsfuzz/cov-instructions-for-if-less-than-equal.amber new file mode 100644 index 0000000..9fcdc0e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-instructions-for-if-less-than-equal.amber @@ -0,0 +1,199 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers specific instruction simplify and combine compare code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_10 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_25 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.25] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 10] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# for (int i = _int_0; i < _int_10; i++) +# { +# // True when i = 0. +# if (!(_float_0_25 <= float(i))) +# { +# _GLF_color += vec4(_float_1_0, i, i, _float_1_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %24 "i" + OpName %39 "buf0" + OpMemberName %39 0 "_GLF_uniform_float_values" + OpName %41 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %38 ArrayStride 16 + OpMemberDecorate %39 0 Offset 0 + OpDecorate %39 Block + OpDecorate %41 DescriptorSet 0 + OpDecorate %41 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %23 = OpTypePointer Function %10 + %33 = OpConstant %10 1 + %36 = OpTypeBool + %38 = OpTypeArray %6 %12 + %39 = OpTypeStruct %38 + %40 = OpTypePointer Uniform %39 + %41 = OpVariable %40 Uniform + %42 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %24 = OpVariable %23 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %22 = OpCompositeConstruct %7 %21 %21 %21 %21 + OpStore %9 %22 + %25 = OpAccessChain %18 %16 %17 %17 + %26 = OpLoad %10 %25 + OpStore %24 %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %10 %24 + %34 = OpAccessChain %18 %16 %17 %33 + %35 = OpLoad %10 %34 + %37 = OpSLessThan %36 %32 %35 + OpBranchConditional %37 %28 %29 + %28 = OpLabel + %43 = OpAccessChain %42 %41 %17 %33 + %44 = OpLoad %6 %43 + %45 = OpLoad %10 %24 + %46 = OpConvertSToF %6 %45 + %47 = OpFOrdLessThanEqual %36 %44 %46 + %48 = OpLogicalNot %36 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %50 + %49 = OpLabel + %51 = OpAccessChain %42 %41 %17 %17 + %52 = OpLoad %6 %51 + %53 = OpLoad %10 %24 + %54 = OpConvertSToF %6 %53 + %55 = OpLoad %10 %24 + %56 = OpConvertSToF %6 %55 + %57 = OpAccessChain %42 %41 %17 %17 + %58 = OpLoad %6 %57 + %59 = OpCompositeConstruct %7 %52 %54 %56 %58 + %60 = OpLoad %7 %9 + %61 = OpFAdd %7 %60 %59 + OpStore %9 %61 + OpBranch %50 + %50 = OpLabel + OpBranch %30 + %30 = OpLabel + %62 = OpLoad %10 %24 + %63 = OpIAdd %10 %62 %33 + OpStore %24 %63 + OpBranch %27 + %29 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 10 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.25 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-int-div-round-to-zero.amber b/vulkan/amber/graphicsfuzz/cov-int-div-round-to-zero.amber new file mode 100644 index 0000000..d9bcbd1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-int-div-round-to-zero.amber @@ -0,0 +1,171 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific fast idiv code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1000 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1000, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1000; +# +# // Always true. +# if((a / ivec2(_int_1, 63677)).y == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %40 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %40 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %40 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %6 2 + %24 = OpConstant %6 63677 + %25 = OpTypeVector %6 2 + %29 = OpConstant %9 1 + %33 = OpTypeBool + %37 = OpTypeFloat 32 + %38 = OpTypeVector %37 4 + %39 = OpTypePointer Output %38 + %40 = OpVariable %39 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %20 = OpLoad %6 %8 + %22 = OpAccessChain %17 %14 %15 %21 + %23 = OpLoad %6 %22 + %26 = OpCompositeConstruct %25 %23 %24 + %27 = OpCompositeConstruct %25 %20 %20 + %28 = OpSDiv %25 %27 %26 + %30 = OpCompositeExtract %6 %28 1 + %31 = OpAccessChain %17 %14 %15 %15 + %32 = OpLoad %6 %31 + %34 = OpIEqual %33 %30 %32 + OpSelectionMerge %36 None + OpBranchConditional %34 %35 %54 + %35 = OpLabel + %41 = OpAccessChain %17 %14 %15 %21 + %42 = OpLoad %6 %41 + %43 = OpConvertSToF %37 %42 + %44 = OpAccessChain %17 %14 %15 %15 + %45 = OpLoad %6 %44 + %46 = OpConvertSToF %37 %45 + %47 = OpAccessChain %17 %14 %15 %15 + %48 = OpLoad %6 %47 + %49 = OpConvertSToF %37 %48 + %50 = OpAccessChain %17 %14 %15 %21 + %51 = OpLoad %6 %50 + %52 = OpConvertSToF %37 %51 + %53 = OpCompositeConstruct %38 %43 %46 %49 %52 + OpStore %40 %53 + OpBranch %36 + %54 = OpLabel + %55 = OpAccessChain %17 %14 %15 %15 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %37 %56 + %58 = OpCompositeConstruct %38 %57 %57 %57 %57 + OpStore %40 %58 + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1000 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-int-full-bits-divide-by-two-loop.amber b/vulkan/amber/graphicsfuzz/cov-int-full-bits-divide-by-two-loop.amber new file mode 100644 index 0000000..782d401 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-int-full-bits-divide-by-two-loop.amber @@ -0,0 +1,199 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always selects ~0. +# int a = int(gl_FragCoord.x) < _int_0 ? 0 : ~0; +# +# for (int i = 0; i < 5; i ++) +# { +# a /= 2; +# } +# +# // Always true. +# if (a == ~0 / 32) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "gl_FragCoord" + OpName %21 "buf0" + OpMemberName %21 0 "_GLF_uniform_int_values" + OpName %23 "" + OpName %33 "i" + OpName %52 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %20 ArrayStride 16 + OpMemberDecorate %21 0 Offset 0 + OpDecorate %21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 0 + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Input %9 + %19 = OpConstant %13 2 + %20 = OpTypeArray %6 %19 + %21 = OpTypeStruct %20 + %22 = OpTypePointer Uniform %21 + %23 = OpVariable %22 Uniform + %24 = OpConstant %6 0 + %25 = OpConstant %6 1 + %26 = OpTypePointer Uniform %6 + %29 = OpTypeBool + %31 = OpConstant %6 -1 + %40 = OpConstant %6 5 + %42 = OpConstant %6 2 + %51 = OpTypePointer Output %10 + %52 = OpVariable %51 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %33 = OpVariable %7 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %18 = OpConvertFToS %6 %17 + %27 = OpAccessChain %26 %23 %24 %25 + %28 = OpLoad %6 %27 + %30 = OpSLessThan %29 %18 %28 + %32 = OpSelect %6 %30 %24 %31 + OpStore %8 %32 + OpStore %33 %24 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %6 %33 + %41 = OpSLessThan %29 %39 %40 + OpBranchConditional %41 %35 %36 + %35 = OpLabel + %43 = OpLoad %6 %8 + %44 = OpSDiv %6 %43 %42 + OpStore %8 %44 + OpBranch %37 + %37 = OpLabel + %45 = OpLoad %6 %33 + %46 = OpIAdd %6 %45 %25 + OpStore %33 %46 + OpBranch %34 + %36 = OpLabel + %47 = OpLoad %6 %8 + %48 = OpIEqual %29 %47 %24 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %66 + %49 = OpLabel + %53 = OpAccessChain %26 %23 %24 %24 + %54 = OpLoad %6 %53 + %55 = OpConvertSToF %9 %54 + %56 = OpAccessChain %26 %23 %24 %25 + %57 = OpLoad %6 %56 + %58 = OpConvertSToF %9 %57 + %59 = OpAccessChain %26 %23 %24 %25 + %60 = OpLoad %6 %59 + %61 = OpConvertSToF %9 %60 + %62 = OpAccessChain %26 %23 %24 %24 + %63 = OpLoad %6 %62 + %64 = OpConvertSToF %9 %63 + %65 = OpCompositeConstruct %10 %55 %58 %61 %64 + OpStore %52 %65 + OpBranch %50 + %66 = OpLabel + %67 = OpAccessChain %26 %23 %24 %25 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %9 %68 + %70 = OpCompositeConstruct %10 %69 %69 %69 %69 + OpStore %52 %70 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-int-initialize-from-multiple-large-arrays.amber b/vulkan/amber/graphicsfuzz/cov-int-initialize-from-multiple-large-arrays.amber new file mode 100644 index 0000000..ab3e5a9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-int-initialize-from-multiple-large-arrays.amber @@ -0,0 +1,2287 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_256 _GLF_uniform_int_values[2] +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# #define INT_ARR_256 int[256](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1) +# #define ONE INT_ARR_256[_GLF_MAKE_IN_BOUNDS_INT(x, 256)] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 256] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // This function always returns one. +# int func(int x) +# { +# // a becomes one. +# int a = clamp(ONE, max(ONE, ONE), ONE); +# +# // Always false. +# if(x < 0) +# { +# discard; +# } +# +# return a; +# } +# +# void main() +# { +# // Always true. +# if (func(int(gl_FragCoord.x)) == _int_1) +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# else +# _GLF_color = vec4(_int_0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 2145 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %2112 %2126 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func(i1;" + OpName %9 "x" + OpName %12 "a" + OpName %16 "buf0" + OpMemberName %16 0 "_GLF_uniform_int_values" + OpName %18 "" + OpName %541 "indexable" + OpName %1059 "indexable" + OpName %1577 "indexable" + OpName %2096 "indexable" + OpName %2112 "gl_FragCoord" + OpName %2118 "param" + OpName %2126 "_GLF_color" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %2112 BuiltIn FragCoord + OpDecorate %2126 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 3 + %15 = OpTypeArray %6 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpConstant %6 0 + %20 = OpConstant %6 1 + %21 = OpTypePointer Uniform %6 + %534 = OpConstant %13 256 + %535 = OpTypeArray %6 %534 + %538 = OpConstant %6 255 + %540 = OpTypePointer Function %535 + %2101 = OpTypeBool + %2109 = OpTypeFloat 32 + %2110 = OpTypeVector %2109 4 + %2111 = OpTypePointer Input %2110 + %2112 = OpVariable %2111 Input + %2113 = OpConstant %13 0 + %2114 = OpTypePointer Input %2109 + %2125 = OpTypePointer Output %2110 + %2126 = OpVariable %2125 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %2118 = OpVariable %7 Function + %2115 = OpAccessChain %2114 %2112 %2113 + %2116 = OpLoad %2109 %2115 + %2117 = OpConvertFToS %6 %2116 + OpStore %2118 %2117 + %2119 = OpFunctionCall %6 %10 %2118 + %2120 = OpAccessChain %21 %18 %19 %20 + %2121 = OpLoad %6 %2120 + %2122 = OpIEqual %2101 %2119 %2121 + OpSelectionMerge %2124 None + OpBranchConditional %2122 %2123 %2140 + %2123 = OpLabel + %2127 = OpAccessChain %21 %18 %19 %20 + %2128 = OpLoad %6 %2127 + %2129 = OpConvertSToF %2109 %2128 + %2130 = OpAccessChain %21 %18 %19 %19 + %2131 = OpLoad %6 %2130 + %2132 = OpConvertSToF %2109 %2131 + %2133 = OpAccessChain %21 %18 %19 %19 + %2134 = OpLoad %6 %2133 + %2135 = OpConvertSToF %2109 %2134 + %2136 = OpAccessChain %21 %18 %19 %20 + %2137 = OpLoad %6 %2136 + %2138 = OpConvertSToF %2109 %2137 + %2139 = OpCompositeConstruct %2110 %2129 %2132 %2135 %2138 + OpStore %2126 %2139 + OpBranch %2124 + %2140 = OpLabel + %2141 = OpAccessChain %21 %18 %19 %19 + %2142 = OpLoad %6 %2141 + %2143 = OpConvertSToF %2109 %2142 + %2144 = OpCompositeConstruct %2110 %2143 %2143 %2143 %2143 + OpStore %2126 %2144 + OpBranch %2124 + %2124 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %12 = OpVariable %7 Function + %541 = OpVariable %540 Function + %1059 = OpVariable %540 Function + %1577 = OpVariable %540 Function + %2096 = OpVariable %540 Function + %22 = OpAccessChain %21 %18 %19 %20 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %21 %18 %19 %20 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %21 %18 %19 %20 + %27 = OpLoad %6 %26 + %28 = OpAccessChain %21 %18 %19 %20 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %21 %18 %19 %20 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %21 %18 %19 %20 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %21 %18 %19 %20 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %21 %18 %19 %20 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %21 %18 %19 %20 + %39 = OpLoad %6 %38 + %40 = OpAccessChain %21 %18 %19 %20 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %21 %18 %19 %20 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %21 %18 %19 %20 + %45 = OpLoad %6 %44 + %46 = OpAccessChain %21 %18 %19 %20 + %47 = OpLoad %6 %46 + %48 = OpAccessChain %21 %18 %19 %20 + %49 = OpLoad %6 %48 + %50 = OpAccessChain %21 %18 %19 %20 + %51 = OpLoad %6 %50 + %52 = OpAccessChain %21 %18 %19 %20 + %53 = OpLoad %6 %52 + %54 = OpAccessChain %21 %18 %19 %20 + %55 = OpLoad %6 %54 + %56 = OpAccessChain %21 %18 %19 %20 + %57 = OpLoad %6 %56 + %58 = OpAccessChain %21 %18 %19 %20 + %59 = OpLoad %6 %58 + %60 = OpAccessChain %21 %18 %19 %20 + %61 = OpLoad %6 %60 + %62 = OpAccessChain %21 %18 %19 %20 + %63 = OpLoad %6 %62 + %64 = OpAccessChain %21 %18 %19 %20 + %65 = OpLoad %6 %64 + %66 = OpAccessChain %21 %18 %19 %20 + %67 = OpLoad %6 %66 + %68 = OpAccessChain %21 %18 %19 %20 + %69 = OpLoad %6 %68 + %70 = OpAccessChain %21 %18 %19 %20 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %21 %18 %19 %20 + %73 = OpLoad %6 %72 + %74 = OpAccessChain %21 %18 %19 %20 + %75 = OpLoad %6 %74 + %76 = OpAccessChain %21 %18 %19 %20 + %77 = OpLoad %6 %76 + %78 = OpAccessChain %21 %18 %19 %20 + %79 = OpLoad %6 %78 + %80 = OpAccessChain %21 %18 %19 %20 + %81 = OpLoad %6 %80 + %82 = OpAccessChain %21 %18 %19 %20 + %83 = OpLoad %6 %82 + %84 = OpAccessChain %21 %18 %19 %20 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %21 %18 %19 %20 + %87 = OpLoad %6 %86 + %88 = OpAccessChain %21 %18 %19 %20 + %89 = OpLoad %6 %88 + %90 = OpAccessChain %21 %18 %19 %20 + %91 = OpLoad %6 %90 + %92 = OpAccessChain %21 %18 %19 %20 + %93 = OpLoad %6 %92 + %94 = OpAccessChain %21 %18 %19 %20 + %95 = OpLoad %6 %94 + %96 = OpAccessChain %21 %18 %19 %20 + %97 = OpLoad %6 %96 + %98 = OpAccessChain %21 %18 %19 %20 + %99 = OpLoad %6 %98 + %100 = OpAccessChain %21 %18 %19 %20 + %101 = OpLoad %6 %100 + %102 = OpAccessChain %21 %18 %19 %20 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %21 %18 %19 %20 + %105 = OpLoad %6 %104 + %106 = OpAccessChain %21 %18 %19 %20 + %107 = OpLoad %6 %106 + %108 = OpAccessChain %21 %18 %19 %20 + %109 = OpLoad %6 %108 + %110 = OpAccessChain %21 %18 %19 %20 + %111 = OpLoad %6 %110 + %112 = OpAccessChain %21 %18 %19 %20 + %113 = OpLoad %6 %112 + %114 = OpAccessChain %21 %18 %19 %20 + %115 = OpLoad %6 %114 + %116 = OpAccessChain %21 %18 %19 %20 + %117 = OpLoad %6 %116 + %118 = OpAccessChain %21 %18 %19 %20 + %119 = OpLoad %6 %118 + %120 = OpAccessChain %21 %18 %19 %20 + %121 = OpLoad %6 %120 + %122 = OpAccessChain %21 %18 %19 %20 + %123 = OpLoad %6 %122 + %124 = OpAccessChain %21 %18 %19 %20 + %125 = OpLoad %6 %124 + %126 = OpAccessChain %21 %18 %19 %20 + %127 = OpLoad %6 %126 + %128 = OpAccessChain %21 %18 %19 %20 + %129 = OpLoad %6 %128 + %130 = OpAccessChain %21 %18 %19 %20 + %131 = OpLoad %6 %130 + %132 = OpAccessChain %21 %18 %19 %20 + %133 = OpLoad %6 %132 + %134 = OpAccessChain %21 %18 %19 %20 + %135 = OpLoad %6 %134 + %136 = OpAccessChain %21 %18 %19 %20 + %137 = OpLoad %6 %136 + %138 = OpAccessChain %21 %18 %19 %20 + %139 = OpLoad %6 %138 + %140 = OpAccessChain %21 %18 %19 %20 + %141 = OpLoad %6 %140 + %142 = OpAccessChain %21 %18 %19 %20 + %143 = OpLoad %6 %142 + %144 = OpAccessChain %21 %18 %19 %20 + %145 = OpLoad %6 %144 + %146 = OpAccessChain %21 %18 %19 %20 + %147 = OpLoad %6 %146 + %148 = OpAccessChain %21 %18 %19 %20 + %149 = OpLoad %6 %148 + %150 = OpAccessChain %21 %18 %19 %20 + %151 = OpLoad %6 %150 + %152 = OpAccessChain %21 %18 %19 %20 + %153 = OpLoad %6 %152 + %154 = OpAccessChain %21 %18 %19 %20 + %155 = OpLoad %6 %154 + %156 = OpAccessChain %21 %18 %19 %20 + %157 = OpLoad %6 %156 + %158 = OpAccessChain %21 %18 %19 %20 + %159 = OpLoad %6 %158 + %160 = OpAccessChain %21 %18 %19 %20 + %161 = OpLoad %6 %160 + %162 = OpAccessChain %21 %18 %19 %20 + %163 = OpLoad %6 %162 + %164 = OpAccessChain %21 %18 %19 %20 + %165 = OpLoad %6 %164 + %166 = OpAccessChain %21 %18 %19 %20 + %167 = OpLoad %6 %166 + %168 = OpAccessChain %21 %18 %19 %20 + %169 = OpLoad %6 %168 + %170 = OpAccessChain %21 %18 %19 %20 + %171 = OpLoad %6 %170 + %172 = OpAccessChain %21 %18 %19 %20 + %173 = OpLoad %6 %172 + %174 = OpAccessChain %21 %18 %19 %20 + %175 = OpLoad %6 %174 + %176 = OpAccessChain %21 %18 %19 %20 + %177 = OpLoad %6 %176 + %178 = OpAccessChain %21 %18 %19 %20 + %179 = OpLoad %6 %178 + %180 = OpAccessChain %21 %18 %19 %20 + %181 = OpLoad %6 %180 + %182 = OpAccessChain %21 %18 %19 %20 + %183 = OpLoad %6 %182 + %184 = OpAccessChain %21 %18 %19 %20 + %185 = OpLoad %6 %184 + %186 = OpAccessChain %21 %18 %19 %20 + %187 = OpLoad %6 %186 + %188 = OpAccessChain %21 %18 %19 %20 + %189 = OpLoad %6 %188 + %190 = OpAccessChain %21 %18 %19 %20 + %191 = OpLoad %6 %190 + %192 = OpAccessChain %21 %18 %19 %20 + %193 = OpLoad %6 %192 + %194 = OpAccessChain %21 %18 %19 %20 + %195 = OpLoad %6 %194 + %196 = OpAccessChain %21 %18 %19 %20 + %197 = OpLoad %6 %196 + %198 = OpAccessChain %21 %18 %19 %20 + %199 = OpLoad %6 %198 + %200 = OpAccessChain %21 %18 %19 %20 + %201 = OpLoad %6 %200 + %202 = OpAccessChain %21 %18 %19 %20 + %203 = OpLoad %6 %202 + %204 = OpAccessChain %21 %18 %19 %20 + %205 = OpLoad %6 %204 + %206 = OpAccessChain %21 %18 %19 %20 + %207 = OpLoad %6 %206 + %208 = OpAccessChain %21 %18 %19 %20 + %209 = OpLoad %6 %208 + %210 = OpAccessChain %21 %18 %19 %20 + %211 = OpLoad %6 %210 + %212 = OpAccessChain %21 %18 %19 %20 + %213 = OpLoad %6 %212 + %214 = OpAccessChain %21 %18 %19 %20 + %215 = OpLoad %6 %214 + %216 = OpAccessChain %21 %18 %19 %20 + %217 = OpLoad %6 %216 + %218 = OpAccessChain %21 %18 %19 %20 + %219 = OpLoad %6 %218 + %220 = OpAccessChain %21 %18 %19 %20 + %221 = OpLoad %6 %220 + %222 = OpAccessChain %21 %18 %19 %20 + %223 = OpLoad %6 %222 + %224 = OpAccessChain %21 %18 %19 %20 + %225 = OpLoad %6 %224 + %226 = OpAccessChain %21 %18 %19 %20 + %227 = OpLoad %6 %226 + %228 = OpAccessChain %21 %18 %19 %20 + %229 = OpLoad %6 %228 + %230 = OpAccessChain %21 %18 %19 %20 + %231 = OpLoad %6 %230 + %232 = OpAccessChain %21 %18 %19 %20 + %233 = OpLoad %6 %232 + %234 = OpAccessChain %21 %18 %19 %20 + %235 = OpLoad %6 %234 + %236 = OpAccessChain %21 %18 %19 %20 + %237 = OpLoad %6 %236 + %238 = OpAccessChain %21 %18 %19 %20 + %239 = OpLoad %6 %238 + %240 = OpAccessChain %21 %18 %19 %20 + %241 = OpLoad %6 %240 + %242 = OpAccessChain %21 %18 %19 %20 + %243 = OpLoad %6 %242 + %244 = OpAccessChain %21 %18 %19 %20 + %245 = OpLoad %6 %244 + %246 = OpAccessChain %21 %18 %19 %20 + %247 = OpLoad %6 %246 + %248 = OpAccessChain %21 %18 %19 %20 + %249 = OpLoad %6 %248 + %250 = OpAccessChain %21 %18 %19 %20 + %251 = OpLoad %6 %250 + %252 = OpAccessChain %21 %18 %19 %20 + %253 = OpLoad %6 %252 + %254 = OpAccessChain %21 %18 %19 %20 + %255 = OpLoad %6 %254 + %256 = OpAccessChain %21 %18 %19 %20 + %257 = OpLoad %6 %256 + %258 = OpAccessChain %21 %18 %19 %20 + %259 = OpLoad %6 %258 + %260 = OpAccessChain %21 %18 %19 %20 + %261 = OpLoad %6 %260 + %262 = OpAccessChain %21 %18 %19 %20 + %263 = OpLoad %6 %262 + %264 = OpAccessChain %21 %18 %19 %20 + %265 = OpLoad %6 %264 + %266 = OpAccessChain %21 %18 %19 %20 + %267 = OpLoad %6 %266 + %268 = OpAccessChain %21 %18 %19 %20 + %269 = OpLoad %6 %268 + %270 = OpAccessChain %21 %18 %19 %20 + %271 = OpLoad %6 %270 + %272 = OpAccessChain %21 %18 %19 %20 + %273 = OpLoad %6 %272 + %274 = OpAccessChain %21 %18 %19 %20 + %275 = OpLoad %6 %274 + %276 = OpAccessChain %21 %18 %19 %20 + %277 = OpLoad %6 %276 + %278 = OpAccessChain %21 %18 %19 %20 + %279 = OpLoad %6 %278 + %280 = OpAccessChain %21 %18 %19 %20 + %281 = OpLoad %6 %280 + %282 = OpAccessChain %21 %18 %19 %20 + %283 = OpLoad %6 %282 + %284 = OpAccessChain %21 %18 %19 %20 + %285 = OpLoad %6 %284 + %286 = OpAccessChain %21 %18 %19 %20 + %287 = OpLoad %6 %286 + %288 = OpAccessChain %21 %18 %19 %20 + %289 = OpLoad %6 %288 + %290 = OpAccessChain %21 %18 %19 %20 + %291 = OpLoad %6 %290 + %292 = OpAccessChain %21 %18 %19 %20 + %293 = OpLoad %6 %292 + %294 = OpAccessChain %21 %18 %19 %20 + %295 = OpLoad %6 %294 + %296 = OpAccessChain %21 %18 %19 %20 + %297 = OpLoad %6 %296 + %298 = OpAccessChain %21 %18 %19 %20 + %299 = OpLoad %6 %298 + %300 = OpAccessChain %21 %18 %19 %20 + %301 = OpLoad %6 %300 + %302 = OpAccessChain %21 %18 %19 %20 + %303 = OpLoad %6 %302 + %304 = OpAccessChain %21 %18 %19 %20 + %305 = OpLoad %6 %304 + %306 = OpAccessChain %21 %18 %19 %20 + %307 = OpLoad %6 %306 + %308 = OpAccessChain %21 %18 %19 %20 + %309 = OpLoad %6 %308 + %310 = OpAccessChain %21 %18 %19 %20 + %311 = OpLoad %6 %310 + %312 = OpAccessChain %21 %18 %19 %20 + %313 = OpLoad %6 %312 + %314 = OpAccessChain %21 %18 %19 %20 + %315 = OpLoad %6 %314 + %316 = OpAccessChain %21 %18 %19 %20 + %317 = OpLoad %6 %316 + %318 = OpAccessChain %21 %18 %19 %20 + %319 = OpLoad %6 %318 + %320 = OpAccessChain %21 %18 %19 %20 + %321 = OpLoad %6 %320 + %322 = OpAccessChain %21 %18 %19 %20 + %323 = OpLoad %6 %322 + %324 = OpAccessChain %21 %18 %19 %20 + %325 = OpLoad %6 %324 + %326 = OpAccessChain %21 %18 %19 %20 + %327 = OpLoad %6 %326 + %328 = OpAccessChain %21 %18 %19 %20 + %329 = OpLoad %6 %328 + %330 = OpAccessChain %21 %18 %19 %20 + %331 = OpLoad %6 %330 + %332 = OpAccessChain %21 %18 %19 %20 + %333 = OpLoad %6 %332 + %334 = OpAccessChain %21 %18 %19 %20 + %335 = OpLoad %6 %334 + %336 = OpAccessChain %21 %18 %19 %20 + %337 = OpLoad %6 %336 + %338 = OpAccessChain %21 %18 %19 %20 + %339 = OpLoad %6 %338 + %340 = OpAccessChain %21 %18 %19 %20 + %341 = OpLoad %6 %340 + %342 = OpAccessChain %21 %18 %19 %20 + %343 = OpLoad %6 %342 + %344 = OpAccessChain %21 %18 %19 %20 + %345 = OpLoad %6 %344 + %346 = OpAccessChain %21 %18 %19 %20 + %347 = OpLoad %6 %346 + %348 = OpAccessChain %21 %18 %19 %20 + %349 = OpLoad %6 %348 + %350 = OpAccessChain %21 %18 %19 %20 + %351 = OpLoad %6 %350 + %352 = OpAccessChain %21 %18 %19 %20 + %353 = OpLoad %6 %352 + %354 = OpAccessChain %21 %18 %19 %20 + %355 = OpLoad %6 %354 + %356 = OpAccessChain %21 %18 %19 %20 + %357 = OpLoad %6 %356 + %358 = OpAccessChain %21 %18 %19 %20 + %359 = OpLoad %6 %358 + %360 = OpAccessChain %21 %18 %19 %20 + %361 = OpLoad %6 %360 + %362 = OpAccessChain %21 %18 %19 %20 + %363 = OpLoad %6 %362 + %364 = OpAccessChain %21 %18 %19 %20 + %365 = OpLoad %6 %364 + %366 = OpAccessChain %21 %18 %19 %20 + %367 = OpLoad %6 %366 + %368 = OpAccessChain %21 %18 %19 %20 + %369 = OpLoad %6 %368 + %370 = OpAccessChain %21 %18 %19 %20 + %371 = OpLoad %6 %370 + %372 = OpAccessChain %21 %18 %19 %20 + %373 = OpLoad %6 %372 + %374 = OpAccessChain %21 %18 %19 %20 + %375 = OpLoad %6 %374 + %376 = OpAccessChain %21 %18 %19 %20 + %377 = OpLoad %6 %376 + %378 = OpAccessChain %21 %18 %19 %20 + %379 = OpLoad %6 %378 + %380 = OpAccessChain %21 %18 %19 %20 + %381 = OpLoad %6 %380 + %382 = OpAccessChain %21 %18 %19 %20 + %383 = OpLoad %6 %382 + %384 = OpAccessChain %21 %18 %19 %20 + %385 = OpLoad %6 %384 + %386 = OpAccessChain %21 %18 %19 %20 + %387 = OpLoad %6 %386 + %388 = OpAccessChain %21 %18 %19 %20 + %389 = OpLoad %6 %388 + %390 = OpAccessChain %21 %18 %19 %20 + %391 = OpLoad %6 %390 + %392 = OpAccessChain %21 %18 %19 %20 + %393 = OpLoad %6 %392 + %394 = OpAccessChain %21 %18 %19 %20 + %395 = OpLoad %6 %394 + %396 = OpAccessChain %21 %18 %19 %20 + %397 = OpLoad %6 %396 + %398 = OpAccessChain %21 %18 %19 %20 + %399 = OpLoad %6 %398 + %400 = OpAccessChain %21 %18 %19 %20 + %401 = OpLoad %6 %400 + %402 = OpAccessChain %21 %18 %19 %20 + %403 = OpLoad %6 %402 + %404 = OpAccessChain %21 %18 %19 %20 + %405 = OpLoad %6 %404 + %406 = OpAccessChain %21 %18 %19 %20 + %407 = OpLoad %6 %406 + %408 = OpAccessChain %21 %18 %19 %20 + %409 = OpLoad %6 %408 + %410 = OpAccessChain %21 %18 %19 %20 + %411 = OpLoad %6 %410 + %412 = OpAccessChain %21 %18 %19 %20 + %413 = OpLoad %6 %412 + %414 = OpAccessChain %21 %18 %19 %20 + %415 = OpLoad %6 %414 + %416 = OpAccessChain %21 %18 %19 %20 + %417 = OpLoad %6 %416 + %418 = OpAccessChain %21 %18 %19 %20 + %419 = OpLoad %6 %418 + %420 = OpAccessChain %21 %18 %19 %20 + %421 = OpLoad %6 %420 + %422 = OpAccessChain %21 %18 %19 %20 + %423 = OpLoad %6 %422 + %424 = OpAccessChain %21 %18 %19 %20 + %425 = OpLoad %6 %424 + %426 = OpAccessChain %21 %18 %19 %20 + %427 = OpLoad %6 %426 + %428 = OpAccessChain %21 %18 %19 %20 + %429 = OpLoad %6 %428 + %430 = OpAccessChain %21 %18 %19 %20 + %431 = OpLoad %6 %430 + %432 = OpAccessChain %21 %18 %19 %20 + %433 = OpLoad %6 %432 + %434 = OpAccessChain %21 %18 %19 %20 + %435 = OpLoad %6 %434 + %436 = OpAccessChain %21 %18 %19 %20 + %437 = OpLoad %6 %436 + %438 = OpAccessChain %21 %18 %19 %20 + %439 = OpLoad %6 %438 + %440 = OpAccessChain %21 %18 %19 %20 + %441 = OpLoad %6 %440 + %442 = OpAccessChain %21 %18 %19 %20 + %443 = OpLoad %6 %442 + %444 = OpAccessChain %21 %18 %19 %20 + %445 = OpLoad %6 %444 + %446 = OpAccessChain %21 %18 %19 %20 + %447 = OpLoad %6 %446 + %448 = OpAccessChain %21 %18 %19 %20 + %449 = OpLoad %6 %448 + %450 = OpAccessChain %21 %18 %19 %20 + %451 = OpLoad %6 %450 + %452 = OpAccessChain %21 %18 %19 %20 + %453 = OpLoad %6 %452 + %454 = OpAccessChain %21 %18 %19 %20 + %455 = OpLoad %6 %454 + %456 = OpAccessChain %21 %18 %19 %20 + %457 = OpLoad %6 %456 + %458 = OpAccessChain %21 %18 %19 %20 + %459 = OpLoad %6 %458 + %460 = OpAccessChain %21 %18 %19 %20 + %461 = OpLoad %6 %460 + %462 = OpAccessChain %21 %18 %19 %20 + %463 = OpLoad %6 %462 + %464 = OpAccessChain %21 %18 %19 %20 + %465 = OpLoad %6 %464 + %466 = OpAccessChain %21 %18 %19 %20 + %467 = OpLoad %6 %466 + %468 = OpAccessChain %21 %18 %19 %20 + %469 = OpLoad %6 %468 + %470 = OpAccessChain %21 %18 %19 %20 + %471 = OpLoad %6 %470 + %472 = OpAccessChain %21 %18 %19 %20 + %473 = OpLoad %6 %472 + %474 = OpAccessChain %21 %18 %19 %20 + %475 = OpLoad %6 %474 + %476 = OpAccessChain %21 %18 %19 %20 + %477 = OpLoad %6 %476 + %478 = OpAccessChain %21 %18 %19 %20 + %479 = OpLoad %6 %478 + %480 = OpAccessChain %21 %18 %19 %20 + %481 = OpLoad %6 %480 + %482 = OpAccessChain %21 %18 %19 %20 + %483 = OpLoad %6 %482 + %484 = OpAccessChain %21 %18 %19 %20 + %485 = OpLoad %6 %484 + %486 = OpAccessChain %21 %18 %19 %20 + %487 = OpLoad %6 %486 + %488 = OpAccessChain %21 %18 %19 %20 + %489 = OpLoad %6 %488 + %490 = OpAccessChain %21 %18 %19 %20 + %491 = OpLoad %6 %490 + %492 = OpAccessChain %21 %18 %19 %20 + %493 = OpLoad %6 %492 + %494 = OpAccessChain %21 %18 %19 %20 + %495 = OpLoad %6 %494 + %496 = OpAccessChain %21 %18 %19 %20 + %497 = OpLoad %6 %496 + %498 = OpAccessChain %21 %18 %19 %20 + %499 = OpLoad %6 %498 + %500 = OpAccessChain %21 %18 %19 %20 + %501 = OpLoad %6 %500 + %502 = OpAccessChain %21 %18 %19 %20 + %503 = OpLoad %6 %502 + %504 = OpAccessChain %21 %18 %19 %20 + %505 = OpLoad %6 %504 + %506 = OpAccessChain %21 %18 %19 %20 + %507 = OpLoad %6 %506 + %508 = OpAccessChain %21 %18 %19 %20 + %509 = OpLoad %6 %508 + %510 = OpAccessChain %21 %18 %19 %20 + %511 = OpLoad %6 %510 + %512 = OpAccessChain %21 %18 %19 %20 + %513 = OpLoad %6 %512 + %514 = OpAccessChain %21 %18 %19 %20 + %515 = OpLoad %6 %514 + %516 = OpAccessChain %21 %18 %19 %20 + %517 = OpLoad %6 %516 + %518 = OpAccessChain %21 %18 %19 %20 + %519 = OpLoad %6 %518 + %520 = OpAccessChain %21 %18 %19 %20 + %521 = OpLoad %6 %520 + %522 = OpAccessChain %21 %18 %19 %20 + %523 = OpLoad %6 %522 + %524 = OpAccessChain %21 %18 %19 %20 + %525 = OpLoad %6 %524 + %526 = OpAccessChain %21 %18 %19 %20 + %527 = OpLoad %6 %526 + %528 = OpAccessChain %21 %18 %19 %20 + %529 = OpLoad %6 %528 + %530 = OpAccessChain %21 %18 %19 %20 + %531 = OpLoad %6 %530 + %532 = OpAccessChain %21 %18 %19 %20 + %533 = OpLoad %6 %532 + %536 = OpCompositeConstruct %535 %23 %25 %27 %29 %31 %33 %35 %37 %39 %41 %43 %45 %47 %49 %51 %53 %55 %57 %59 %61 %63 %65 %67 %69 %71 %73 %75 %77 %79 %81 %83 %85 %87 %89 %91 %93 %95 %97 %99 %101 %103 %105 %107 %109 %111 %113 %115 %117 %119 %121 %123 %125 %127 %129 %131 %133 %135 %137 %139 %141 %143 %145 %147 %149 %151 %153 %155 %157 %159 %161 %163 %165 %167 %169 %171 %173 %175 %177 %179 %181 %183 %185 %187 %189 %191 %193 %195 %197 %199 %201 %203 %205 %207 %209 %211 %213 %215 %217 %219 %221 %223 %225 %227 %229 %231 %233 %235 %237 %239 %241 %243 %245 %247 %249 %251 %253 %255 %257 %259 %261 %263 %265 %267 %269 %271 %273 %275 %277 %279 %281 %283 %285 %287 %289 %291 %293 %295 %297 %299 %301 %303 %305 %307 %309 %311 %313 %315 %317 %319 %321 %323 %325 %327 %329 %331 %333 %335 %337 %339 %341 %343 %345 %347 %349 %351 %353 %355 %357 %359 %361 %363 %365 %367 %369 %371 %373 %375 %377 %379 %381 %383 %385 %387 %389 %391 %393 %395 %397 %399 %401 %403 %405 %407 %409 %411 %413 %415 %417 %419 %421 %423 %425 %427 %429 %431 %433 %435 %437 %439 %441 %443 %445 %447 %449 %451 %453 %455 %457 %459 %461 %463 %465 %467 %469 %471 %473 %475 %477 %479 %481 %483 %485 %487 %489 %491 %493 %495 %497 %499 %501 %503 %505 %507 %509 %511 %513 %515 %517 %519 %521 %523 %525 %527 %529 %531 %533 + %537 = OpLoad %6 %9 + %539 = OpExtInst %6 %1 SClamp %537 %19 %538 + OpStore %541 %536 + %542 = OpAccessChain %7 %541 %539 + %543 = OpLoad %6 %542 + %544 = OpAccessChain %21 %18 %19 %20 + %545 = OpLoad %6 %544 + %546 = OpAccessChain %21 %18 %19 %20 + %547 = OpLoad %6 %546 + %548 = OpAccessChain %21 %18 %19 %20 + %549 = OpLoad %6 %548 + %550 = OpAccessChain %21 %18 %19 %20 + %551 = OpLoad %6 %550 + %552 = OpAccessChain %21 %18 %19 %20 + %553 = OpLoad %6 %552 + %554 = OpAccessChain %21 %18 %19 %20 + %555 = OpLoad %6 %554 + %556 = OpAccessChain %21 %18 %19 %20 + %557 = OpLoad %6 %556 + %558 = OpAccessChain %21 %18 %19 %20 + %559 = OpLoad %6 %558 + %560 = OpAccessChain %21 %18 %19 %20 + %561 = OpLoad %6 %560 + %562 = OpAccessChain %21 %18 %19 %20 + %563 = OpLoad %6 %562 + %564 = OpAccessChain %21 %18 %19 %20 + %565 = OpLoad %6 %564 + %566 = OpAccessChain %21 %18 %19 %20 + %567 = OpLoad %6 %566 + %568 = OpAccessChain %21 %18 %19 %20 + %569 = OpLoad %6 %568 + %570 = OpAccessChain %21 %18 %19 %20 + %571 = OpLoad %6 %570 + %572 = OpAccessChain %21 %18 %19 %20 + %573 = OpLoad %6 %572 + %574 = OpAccessChain %21 %18 %19 %20 + %575 = OpLoad %6 %574 + %576 = OpAccessChain %21 %18 %19 %20 + %577 = OpLoad %6 %576 + %578 = OpAccessChain %21 %18 %19 %20 + %579 = OpLoad %6 %578 + %580 = OpAccessChain %21 %18 %19 %20 + %581 = OpLoad %6 %580 + %582 = OpAccessChain %21 %18 %19 %20 + %583 = OpLoad %6 %582 + %584 = OpAccessChain %21 %18 %19 %20 + %585 = OpLoad %6 %584 + %586 = OpAccessChain %21 %18 %19 %20 + %587 = OpLoad %6 %586 + %588 = OpAccessChain %21 %18 %19 %20 + %589 = OpLoad %6 %588 + %590 = OpAccessChain %21 %18 %19 %20 + %591 = OpLoad %6 %590 + %592 = OpAccessChain %21 %18 %19 %20 + %593 = OpLoad %6 %592 + %594 = OpAccessChain %21 %18 %19 %20 + %595 = OpLoad %6 %594 + %596 = OpAccessChain %21 %18 %19 %20 + %597 = OpLoad %6 %596 + %598 = OpAccessChain %21 %18 %19 %20 + %599 = OpLoad %6 %598 + %600 = OpAccessChain %21 %18 %19 %20 + %601 = OpLoad %6 %600 + %602 = OpAccessChain %21 %18 %19 %20 + %603 = OpLoad %6 %602 + %604 = OpAccessChain %21 %18 %19 %20 + %605 = OpLoad %6 %604 + %606 = OpAccessChain %21 %18 %19 %20 + %607 = OpLoad %6 %606 + %608 = OpAccessChain %21 %18 %19 %20 + %609 = OpLoad %6 %608 + %610 = OpAccessChain %21 %18 %19 %20 + %611 = OpLoad %6 %610 + %612 = OpAccessChain %21 %18 %19 %20 + %613 = OpLoad %6 %612 + %614 = OpAccessChain %21 %18 %19 %20 + %615 = OpLoad %6 %614 + %616 = OpAccessChain %21 %18 %19 %20 + %617 = OpLoad %6 %616 + %618 = OpAccessChain %21 %18 %19 %20 + %619 = OpLoad %6 %618 + %620 = OpAccessChain %21 %18 %19 %20 + %621 = OpLoad %6 %620 + %622 = OpAccessChain %21 %18 %19 %20 + %623 = OpLoad %6 %622 + %624 = OpAccessChain %21 %18 %19 %20 + %625 = OpLoad %6 %624 + %626 = OpAccessChain %21 %18 %19 %20 + %627 = OpLoad %6 %626 + %628 = OpAccessChain %21 %18 %19 %20 + %629 = OpLoad %6 %628 + %630 = OpAccessChain %21 %18 %19 %20 + %631 = OpLoad %6 %630 + %632 = OpAccessChain %21 %18 %19 %20 + %633 = OpLoad %6 %632 + %634 = OpAccessChain %21 %18 %19 %20 + %635 = OpLoad %6 %634 + %636 = OpAccessChain %21 %18 %19 %20 + %637 = OpLoad %6 %636 + %638 = OpAccessChain %21 %18 %19 %20 + %639 = OpLoad %6 %638 + %640 = OpAccessChain %21 %18 %19 %20 + %641 = OpLoad %6 %640 + %642 = OpAccessChain %21 %18 %19 %20 + %643 = OpLoad %6 %642 + %644 = OpAccessChain %21 %18 %19 %20 + %645 = OpLoad %6 %644 + %646 = OpAccessChain %21 %18 %19 %20 + %647 = OpLoad %6 %646 + %648 = OpAccessChain %21 %18 %19 %20 + %649 = OpLoad %6 %648 + %650 = OpAccessChain %21 %18 %19 %20 + %651 = OpLoad %6 %650 + %652 = OpAccessChain %21 %18 %19 %20 + %653 = OpLoad %6 %652 + %654 = OpAccessChain %21 %18 %19 %20 + %655 = OpLoad %6 %654 + %656 = OpAccessChain %21 %18 %19 %20 + %657 = OpLoad %6 %656 + %658 = OpAccessChain %21 %18 %19 %20 + %659 = OpLoad %6 %658 + %660 = OpAccessChain %21 %18 %19 %20 + %661 = OpLoad %6 %660 + %662 = OpAccessChain %21 %18 %19 %20 + %663 = OpLoad %6 %662 + %664 = OpAccessChain %21 %18 %19 %20 + %665 = OpLoad %6 %664 + %666 = OpAccessChain %21 %18 %19 %20 + %667 = OpLoad %6 %666 + %668 = OpAccessChain %21 %18 %19 %20 + %669 = OpLoad %6 %668 + %670 = OpAccessChain %21 %18 %19 %20 + %671 = OpLoad %6 %670 + %672 = OpAccessChain %21 %18 %19 %20 + %673 = OpLoad %6 %672 + %674 = OpAccessChain %21 %18 %19 %20 + %675 = OpLoad %6 %674 + %676 = OpAccessChain %21 %18 %19 %20 + %677 = OpLoad %6 %676 + %678 = OpAccessChain %21 %18 %19 %20 + %679 = OpLoad %6 %678 + %680 = OpAccessChain %21 %18 %19 %20 + %681 = OpLoad %6 %680 + %682 = OpAccessChain %21 %18 %19 %20 + %683 = OpLoad %6 %682 + %684 = OpAccessChain %21 %18 %19 %20 + %685 = OpLoad %6 %684 + %686 = OpAccessChain %21 %18 %19 %20 + %687 = OpLoad %6 %686 + %688 = OpAccessChain %21 %18 %19 %20 + %689 = OpLoad %6 %688 + %690 = OpAccessChain %21 %18 %19 %20 + %691 = OpLoad %6 %690 + %692 = OpAccessChain %21 %18 %19 %20 + %693 = OpLoad %6 %692 + %694 = OpAccessChain %21 %18 %19 %20 + %695 = OpLoad %6 %694 + %696 = OpAccessChain %21 %18 %19 %20 + %697 = OpLoad %6 %696 + %698 = OpAccessChain %21 %18 %19 %20 + %699 = OpLoad %6 %698 + %700 = OpAccessChain %21 %18 %19 %20 + %701 = OpLoad %6 %700 + %702 = OpAccessChain %21 %18 %19 %20 + %703 = OpLoad %6 %702 + %704 = OpAccessChain %21 %18 %19 %20 + %705 = OpLoad %6 %704 + %706 = OpAccessChain %21 %18 %19 %20 + %707 = OpLoad %6 %706 + %708 = OpAccessChain %21 %18 %19 %20 + %709 = OpLoad %6 %708 + %710 = OpAccessChain %21 %18 %19 %20 + %711 = OpLoad %6 %710 + %712 = OpAccessChain %21 %18 %19 %20 + %713 = OpLoad %6 %712 + %714 = OpAccessChain %21 %18 %19 %20 + %715 = OpLoad %6 %714 + %716 = OpAccessChain %21 %18 %19 %20 + %717 = OpLoad %6 %716 + %718 = OpAccessChain %21 %18 %19 %20 + %719 = OpLoad %6 %718 + %720 = OpAccessChain %21 %18 %19 %20 + %721 = OpLoad %6 %720 + %722 = OpAccessChain %21 %18 %19 %20 + %723 = OpLoad %6 %722 + %724 = OpAccessChain %21 %18 %19 %20 + %725 = OpLoad %6 %724 + %726 = OpAccessChain %21 %18 %19 %20 + %727 = OpLoad %6 %726 + %728 = OpAccessChain %21 %18 %19 %20 + %729 = OpLoad %6 %728 + %730 = OpAccessChain %21 %18 %19 %20 + %731 = OpLoad %6 %730 + %732 = OpAccessChain %21 %18 %19 %20 + %733 = OpLoad %6 %732 + %734 = OpAccessChain %21 %18 %19 %20 + %735 = OpLoad %6 %734 + %736 = OpAccessChain %21 %18 %19 %20 + %737 = OpLoad %6 %736 + %738 = OpAccessChain %21 %18 %19 %20 + %739 = OpLoad %6 %738 + %740 = OpAccessChain %21 %18 %19 %20 + %741 = OpLoad %6 %740 + %742 = OpAccessChain %21 %18 %19 %20 + %743 = OpLoad %6 %742 + %744 = OpAccessChain %21 %18 %19 %20 + %745 = OpLoad %6 %744 + %746 = OpAccessChain %21 %18 %19 %20 + %747 = OpLoad %6 %746 + %748 = OpAccessChain %21 %18 %19 %20 + %749 = OpLoad %6 %748 + %750 = OpAccessChain %21 %18 %19 %20 + %751 = OpLoad %6 %750 + %752 = OpAccessChain %21 %18 %19 %20 + %753 = OpLoad %6 %752 + %754 = OpAccessChain %21 %18 %19 %20 + %755 = OpLoad %6 %754 + %756 = OpAccessChain %21 %18 %19 %20 + %757 = OpLoad %6 %756 + %758 = OpAccessChain %21 %18 %19 %20 + %759 = OpLoad %6 %758 + %760 = OpAccessChain %21 %18 %19 %20 + %761 = OpLoad %6 %760 + %762 = OpAccessChain %21 %18 %19 %20 + %763 = OpLoad %6 %762 + %764 = OpAccessChain %21 %18 %19 %20 + %765 = OpLoad %6 %764 + %766 = OpAccessChain %21 %18 %19 %20 + %767 = OpLoad %6 %766 + %768 = OpAccessChain %21 %18 %19 %20 + %769 = OpLoad %6 %768 + %770 = OpAccessChain %21 %18 %19 %20 + %771 = OpLoad %6 %770 + %772 = OpAccessChain %21 %18 %19 %20 + %773 = OpLoad %6 %772 + %774 = OpAccessChain %21 %18 %19 %20 + %775 = OpLoad %6 %774 + %776 = OpAccessChain %21 %18 %19 %20 + %777 = OpLoad %6 %776 + %778 = OpAccessChain %21 %18 %19 %20 + %779 = OpLoad %6 %778 + %780 = OpAccessChain %21 %18 %19 %20 + %781 = OpLoad %6 %780 + %782 = OpAccessChain %21 %18 %19 %20 + %783 = OpLoad %6 %782 + %784 = OpAccessChain %21 %18 %19 %20 + %785 = OpLoad %6 %784 + %786 = OpAccessChain %21 %18 %19 %20 + %787 = OpLoad %6 %786 + %788 = OpAccessChain %21 %18 %19 %20 + %789 = OpLoad %6 %788 + %790 = OpAccessChain %21 %18 %19 %20 + %791 = OpLoad %6 %790 + %792 = OpAccessChain %21 %18 %19 %20 + %793 = OpLoad %6 %792 + %794 = OpAccessChain %21 %18 %19 %20 + %795 = OpLoad %6 %794 + %796 = OpAccessChain %21 %18 %19 %20 + %797 = OpLoad %6 %796 + %798 = OpAccessChain %21 %18 %19 %20 + %799 = OpLoad %6 %798 + %800 = OpAccessChain %21 %18 %19 %20 + %801 = OpLoad %6 %800 + %802 = OpAccessChain %21 %18 %19 %20 + %803 = OpLoad %6 %802 + %804 = OpAccessChain %21 %18 %19 %20 + %805 = OpLoad %6 %804 + %806 = OpAccessChain %21 %18 %19 %20 + %807 = OpLoad %6 %806 + %808 = OpAccessChain %21 %18 %19 %20 + %809 = OpLoad %6 %808 + %810 = OpAccessChain %21 %18 %19 %20 + %811 = OpLoad %6 %810 + %812 = OpAccessChain %21 %18 %19 %20 + %813 = OpLoad %6 %812 + %814 = OpAccessChain %21 %18 %19 %20 + %815 = OpLoad %6 %814 + %816 = OpAccessChain %21 %18 %19 %20 + %817 = OpLoad %6 %816 + %818 = OpAccessChain %21 %18 %19 %20 + %819 = OpLoad %6 %818 + %820 = OpAccessChain %21 %18 %19 %20 + %821 = OpLoad %6 %820 + %822 = OpAccessChain %21 %18 %19 %20 + %823 = OpLoad %6 %822 + %824 = OpAccessChain %21 %18 %19 %20 + %825 = OpLoad %6 %824 + %826 = OpAccessChain %21 %18 %19 %20 + %827 = OpLoad %6 %826 + %828 = OpAccessChain %21 %18 %19 %20 + %829 = OpLoad %6 %828 + %830 = OpAccessChain %21 %18 %19 %20 + %831 = OpLoad %6 %830 + %832 = OpAccessChain %21 %18 %19 %20 + %833 = OpLoad %6 %832 + %834 = OpAccessChain %21 %18 %19 %20 + %835 = OpLoad %6 %834 + %836 = OpAccessChain %21 %18 %19 %20 + %837 = OpLoad %6 %836 + %838 = OpAccessChain %21 %18 %19 %20 + %839 = OpLoad %6 %838 + %840 = OpAccessChain %21 %18 %19 %20 + %841 = OpLoad %6 %840 + %842 = OpAccessChain %21 %18 %19 %20 + %843 = OpLoad %6 %842 + %844 = OpAccessChain %21 %18 %19 %20 + %845 = OpLoad %6 %844 + %846 = OpAccessChain %21 %18 %19 %20 + %847 = OpLoad %6 %846 + %848 = OpAccessChain %21 %18 %19 %20 + %849 = OpLoad %6 %848 + %850 = OpAccessChain %21 %18 %19 %20 + %851 = OpLoad %6 %850 + %852 = OpAccessChain %21 %18 %19 %20 + %853 = OpLoad %6 %852 + %854 = OpAccessChain %21 %18 %19 %20 + %855 = OpLoad %6 %854 + %856 = OpAccessChain %21 %18 %19 %20 + %857 = OpLoad %6 %856 + %858 = OpAccessChain %21 %18 %19 %20 + %859 = OpLoad %6 %858 + %860 = OpAccessChain %21 %18 %19 %20 + %861 = OpLoad %6 %860 + %862 = OpAccessChain %21 %18 %19 %20 + %863 = OpLoad %6 %862 + %864 = OpAccessChain %21 %18 %19 %20 + %865 = OpLoad %6 %864 + %866 = OpAccessChain %21 %18 %19 %20 + %867 = OpLoad %6 %866 + %868 = OpAccessChain %21 %18 %19 %20 + %869 = OpLoad %6 %868 + %870 = OpAccessChain %21 %18 %19 %20 + %871 = OpLoad %6 %870 + %872 = OpAccessChain %21 %18 %19 %20 + %873 = OpLoad %6 %872 + %874 = OpAccessChain %21 %18 %19 %20 + %875 = OpLoad %6 %874 + %876 = OpAccessChain %21 %18 %19 %20 + %877 = OpLoad %6 %876 + %878 = OpAccessChain %21 %18 %19 %20 + %879 = OpLoad %6 %878 + %880 = OpAccessChain %21 %18 %19 %20 + %881 = OpLoad %6 %880 + %882 = OpAccessChain %21 %18 %19 %20 + %883 = OpLoad %6 %882 + %884 = OpAccessChain %21 %18 %19 %20 + %885 = OpLoad %6 %884 + %886 = OpAccessChain %21 %18 %19 %20 + %887 = OpLoad %6 %886 + %888 = OpAccessChain %21 %18 %19 %20 + %889 = OpLoad %6 %888 + %890 = OpAccessChain %21 %18 %19 %20 + %891 = OpLoad %6 %890 + %892 = OpAccessChain %21 %18 %19 %20 + %893 = OpLoad %6 %892 + %894 = OpAccessChain %21 %18 %19 %20 + %895 = OpLoad %6 %894 + %896 = OpAccessChain %21 %18 %19 %20 + %897 = OpLoad %6 %896 + %898 = OpAccessChain %21 %18 %19 %20 + %899 = OpLoad %6 %898 + %900 = OpAccessChain %21 %18 %19 %20 + %901 = OpLoad %6 %900 + %902 = OpAccessChain %21 %18 %19 %20 + %903 = OpLoad %6 %902 + %904 = OpAccessChain %21 %18 %19 %20 + %905 = OpLoad %6 %904 + %906 = OpAccessChain %21 %18 %19 %20 + %907 = OpLoad %6 %906 + %908 = OpAccessChain %21 %18 %19 %20 + %909 = OpLoad %6 %908 + %910 = OpAccessChain %21 %18 %19 %20 + %911 = OpLoad %6 %910 + %912 = OpAccessChain %21 %18 %19 %20 + %913 = OpLoad %6 %912 + %914 = OpAccessChain %21 %18 %19 %20 + %915 = OpLoad %6 %914 + %916 = OpAccessChain %21 %18 %19 %20 + %917 = OpLoad %6 %916 + %918 = OpAccessChain %21 %18 %19 %20 + %919 = OpLoad %6 %918 + %920 = OpAccessChain %21 %18 %19 %20 + %921 = OpLoad %6 %920 + %922 = OpAccessChain %21 %18 %19 %20 + %923 = OpLoad %6 %922 + %924 = OpAccessChain %21 %18 %19 %20 + %925 = OpLoad %6 %924 + %926 = OpAccessChain %21 %18 %19 %20 + %927 = OpLoad %6 %926 + %928 = OpAccessChain %21 %18 %19 %20 + %929 = OpLoad %6 %928 + %930 = OpAccessChain %21 %18 %19 %20 + %931 = OpLoad %6 %930 + %932 = OpAccessChain %21 %18 %19 %20 + %933 = OpLoad %6 %932 + %934 = OpAccessChain %21 %18 %19 %20 + %935 = OpLoad %6 %934 + %936 = OpAccessChain %21 %18 %19 %20 + %937 = OpLoad %6 %936 + %938 = OpAccessChain %21 %18 %19 %20 + %939 = OpLoad %6 %938 + %940 = OpAccessChain %21 %18 %19 %20 + %941 = OpLoad %6 %940 + %942 = OpAccessChain %21 %18 %19 %20 + %943 = OpLoad %6 %942 + %944 = OpAccessChain %21 %18 %19 %20 + %945 = OpLoad %6 %944 + %946 = OpAccessChain %21 %18 %19 %20 + %947 = OpLoad %6 %946 + %948 = OpAccessChain %21 %18 %19 %20 + %949 = OpLoad %6 %948 + %950 = OpAccessChain %21 %18 %19 %20 + %951 = OpLoad %6 %950 + %952 = OpAccessChain %21 %18 %19 %20 + %953 = OpLoad %6 %952 + %954 = OpAccessChain %21 %18 %19 %20 + %955 = OpLoad %6 %954 + %956 = OpAccessChain %21 %18 %19 %20 + %957 = OpLoad %6 %956 + %958 = OpAccessChain %21 %18 %19 %20 + %959 = OpLoad %6 %958 + %960 = OpAccessChain %21 %18 %19 %20 + %961 = OpLoad %6 %960 + %962 = OpAccessChain %21 %18 %19 %20 + %963 = OpLoad %6 %962 + %964 = OpAccessChain %21 %18 %19 %20 + %965 = OpLoad %6 %964 + %966 = OpAccessChain %21 %18 %19 %20 + %967 = OpLoad %6 %966 + %968 = OpAccessChain %21 %18 %19 %20 + %969 = OpLoad %6 %968 + %970 = OpAccessChain %21 %18 %19 %20 + %971 = OpLoad %6 %970 + %972 = OpAccessChain %21 %18 %19 %20 + %973 = OpLoad %6 %972 + %974 = OpAccessChain %21 %18 %19 %20 + %975 = OpLoad %6 %974 + %976 = OpAccessChain %21 %18 %19 %20 + %977 = OpLoad %6 %976 + %978 = OpAccessChain %21 %18 %19 %20 + %979 = OpLoad %6 %978 + %980 = OpAccessChain %21 %18 %19 %20 + %981 = OpLoad %6 %980 + %982 = OpAccessChain %21 %18 %19 %20 + %983 = OpLoad %6 %982 + %984 = OpAccessChain %21 %18 %19 %20 + %985 = OpLoad %6 %984 + %986 = OpAccessChain %21 %18 %19 %20 + %987 = OpLoad %6 %986 + %988 = OpAccessChain %21 %18 %19 %20 + %989 = OpLoad %6 %988 + %990 = OpAccessChain %21 %18 %19 %20 + %991 = OpLoad %6 %990 + %992 = OpAccessChain %21 %18 %19 %20 + %993 = OpLoad %6 %992 + %994 = OpAccessChain %21 %18 %19 %20 + %995 = OpLoad %6 %994 + %996 = OpAccessChain %21 %18 %19 %20 + %997 = OpLoad %6 %996 + %998 = OpAccessChain %21 %18 %19 %20 + %999 = OpLoad %6 %998 + %1000 = OpAccessChain %21 %18 %19 %20 + %1001 = OpLoad %6 %1000 + %1002 = OpAccessChain %21 %18 %19 %20 + %1003 = OpLoad %6 %1002 + %1004 = OpAccessChain %21 %18 %19 %20 + %1005 = OpLoad %6 %1004 + %1006 = OpAccessChain %21 %18 %19 %20 + %1007 = OpLoad %6 %1006 + %1008 = OpAccessChain %21 %18 %19 %20 + %1009 = OpLoad %6 %1008 + %1010 = OpAccessChain %21 %18 %19 %20 + %1011 = OpLoad %6 %1010 + %1012 = OpAccessChain %21 %18 %19 %20 + %1013 = OpLoad %6 %1012 + %1014 = OpAccessChain %21 %18 %19 %20 + %1015 = OpLoad %6 %1014 + %1016 = OpAccessChain %21 %18 %19 %20 + %1017 = OpLoad %6 %1016 + %1018 = OpAccessChain %21 %18 %19 %20 + %1019 = OpLoad %6 %1018 + %1020 = OpAccessChain %21 %18 %19 %20 + %1021 = OpLoad %6 %1020 + %1022 = OpAccessChain %21 %18 %19 %20 + %1023 = OpLoad %6 %1022 + %1024 = OpAccessChain %21 %18 %19 %20 + %1025 = OpLoad %6 %1024 + %1026 = OpAccessChain %21 %18 %19 %20 + %1027 = OpLoad %6 %1026 + %1028 = OpAccessChain %21 %18 %19 %20 + %1029 = OpLoad %6 %1028 + %1030 = OpAccessChain %21 %18 %19 %20 + %1031 = OpLoad %6 %1030 + %1032 = OpAccessChain %21 %18 %19 %20 + %1033 = OpLoad %6 %1032 + %1034 = OpAccessChain %21 %18 %19 %20 + %1035 = OpLoad %6 %1034 + %1036 = OpAccessChain %21 %18 %19 %20 + %1037 = OpLoad %6 %1036 + %1038 = OpAccessChain %21 %18 %19 %20 + %1039 = OpLoad %6 %1038 + %1040 = OpAccessChain %21 %18 %19 %20 + %1041 = OpLoad %6 %1040 + %1042 = OpAccessChain %21 %18 %19 %20 + %1043 = OpLoad %6 %1042 + %1044 = OpAccessChain %21 %18 %19 %20 + %1045 = OpLoad %6 %1044 + %1046 = OpAccessChain %21 %18 %19 %20 + %1047 = OpLoad %6 %1046 + %1048 = OpAccessChain %21 %18 %19 %20 + %1049 = OpLoad %6 %1048 + %1050 = OpAccessChain %21 %18 %19 %20 + %1051 = OpLoad %6 %1050 + %1052 = OpAccessChain %21 %18 %19 %20 + %1053 = OpLoad %6 %1052 + %1054 = OpAccessChain %21 %18 %19 %20 + %1055 = OpLoad %6 %1054 + %1056 = OpCompositeConstruct %535 %545 %547 %549 %551 %553 %555 %557 %559 %561 %563 %565 %567 %569 %571 %573 %575 %577 %579 %581 %583 %585 %587 %589 %591 %593 %595 %597 %599 %601 %603 %605 %607 %609 %611 %613 %615 %617 %619 %621 %623 %625 %627 %629 %631 %633 %635 %637 %639 %641 %643 %645 %647 %649 %651 %653 %655 %657 %659 %661 %663 %665 %667 %669 %671 %673 %675 %677 %679 %681 %683 %685 %687 %689 %691 %693 %695 %697 %699 %701 %703 %705 %707 %709 %711 %713 %715 %717 %719 %721 %723 %725 %727 %729 %731 %733 %735 %737 %739 %741 %743 %745 %747 %749 %751 %753 %755 %757 %759 %761 %763 %765 %767 %769 %771 %773 %775 %777 %779 %781 %783 %785 %787 %789 %791 %793 %795 %797 %799 %801 %803 %805 %807 %809 %811 %813 %815 %817 %819 %821 %823 %825 %827 %829 %831 %833 %835 %837 %839 %841 %843 %845 %847 %849 %851 %853 %855 %857 %859 %861 %863 %865 %867 %869 %871 %873 %875 %877 %879 %881 %883 %885 %887 %889 %891 %893 %895 %897 %899 %901 %903 %905 %907 %909 %911 %913 %915 %917 %919 %921 %923 %925 %927 %929 %931 %933 %935 %937 %939 %941 %943 %945 %947 %949 %951 %953 %955 %957 %959 %961 %963 %965 %967 %969 %971 %973 %975 %977 %979 %981 %983 %985 %987 %989 %991 %993 %995 %997 %999 %1001 %1003 %1005 %1007 %1009 %1011 %1013 %1015 %1017 %1019 %1021 %1023 %1025 %1027 %1029 %1031 %1033 %1035 %1037 %1039 %1041 %1043 %1045 %1047 %1049 %1051 %1053 %1055 + %1057 = OpLoad %6 %9 + %1058 = OpExtInst %6 %1 SClamp %1057 %19 %538 + OpStore %1059 %1056 + %1060 = OpAccessChain %7 %1059 %1058 + %1061 = OpLoad %6 %1060 + %1062 = OpAccessChain %21 %18 %19 %20 + %1063 = OpLoad %6 %1062 + %1064 = OpAccessChain %21 %18 %19 %20 + %1065 = OpLoad %6 %1064 + %1066 = OpAccessChain %21 %18 %19 %20 + %1067 = OpLoad %6 %1066 + %1068 = OpAccessChain %21 %18 %19 %20 + %1069 = OpLoad %6 %1068 + %1070 = OpAccessChain %21 %18 %19 %20 + %1071 = OpLoad %6 %1070 + %1072 = OpAccessChain %21 %18 %19 %20 + %1073 = OpLoad %6 %1072 + %1074 = OpAccessChain %21 %18 %19 %20 + %1075 = OpLoad %6 %1074 + %1076 = OpAccessChain %21 %18 %19 %20 + %1077 = OpLoad %6 %1076 + %1078 = OpAccessChain %21 %18 %19 %20 + %1079 = OpLoad %6 %1078 + %1080 = OpAccessChain %21 %18 %19 %20 + %1081 = OpLoad %6 %1080 + %1082 = OpAccessChain %21 %18 %19 %20 + %1083 = OpLoad %6 %1082 + %1084 = OpAccessChain %21 %18 %19 %20 + %1085 = OpLoad %6 %1084 + %1086 = OpAccessChain %21 %18 %19 %20 + %1087 = OpLoad %6 %1086 + %1088 = OpAccessChain %21 %18 %19 %20 + %1089 = OpLoad %6 %1088 + %1090 = OpAccessChain %21 %18 %19 %20 + %1091 = OpLoad %6 %1090 + %1092 = OpAccessChain %21 %18 %19 %20 + %1093 = OpLoad %6 %1092 + %1094 = OpAccessChain %21 %18 %19 %20 + %1095 = OpLoad %6 %1094 + %1096 = OpAccessChain %21 %18 %19 %20 + %1097 = OpLoad %6 %1096 + %1098 = OpAccessChain %21 %18 %19 %20 + %1099 = OpLoad %6 %1098 + %1100 = OpAccessChain %21 %18 %19 %20 + %1101 = OpLoad %6 %1100 + %1102 = OpAccessChain %21 %18 %19 %20 + %1103 = OpLoad %6 %1102 + %1104 = OpAccessChain %21 %18 %19 %20 + %1105 = OpLoad %6 %1104 + %1106 = OpAccessChain %21 %18 %19 %20 + %1107 = OpLoad %6 %1106 + %1108 = OpAccessChain %21 %18 %19 %20 + %1109 = OpLoad %6 %1108 + %1110 = OpAccessChain %21 %18 %19 %20 + %1111 = OpLoad %6 %1110 + %1112 = OpAccessChain %21 %18 %19 %20 + %1113 = OpLoad %6 %1112 + %1114 = OpAccessChain %21 %18 %19 %20 + %1115 = OpLoad %6 %1114 + %1116 = OpAccessChain %21 %18 %19 %20 + %1117 = OpLoad %6 %1116 + %1118 = OpAccessChain %21 %18 %19 %20 + %1119 = OpLoad %6 %1118 + %1120 = OpAccessChain %21 %18 %19 %20 + %1121 = OpLoad %6 %1120 + %1122 = OpAccessChain %21 %18 %19 %20 + %1123 = OpLoad %6 %1122 + %1124 = OpAccessChain %21 %18 %19 %20 + %1125 = OpLoad %6 %1124 + %1126 = OpAccessChain %21 %18 %19 %20 + %1127 = OpLoad %6 %1126 + %1128 = OpAccessChain %21 %18 %19 %20 + %1129 = OpLoad %6 %1128 + %1130 = OpAccessChain %21 %18 %19 %20 + %1131 = OpLoad %6 %1130 + %1132 = OpAccessChain %21 %18 %19 %20 + %1133 = OpLoad %6 %1132 + %1134 = OpAccessChain %21 %18 %19 %20 + %1135 = OpLoad %6 %1134 + %1136 = OpAccessChain %21 %18 %19 %20 + %1137 = OpLoad %6 %1136 + %1138 = OpAccessChain %21 %18 %19 %20 + %1139 = OpLoad %6 %1138 + %1140 = OpAccessChain %21 %18 %19 %20 + %1141 = OpLoad %6 %1140 + %1142 = OpAccessChain %21 %18 %19 %20 + %1143 = OpLoad %6 %1142 + %1144 = OpAccessChain %21 %18 %19 %20 + %1145 = OpLoad %6 %1144 + %1146 = OpAccessChain %21 %18 %19 %20 + %1147 = OpLoad %6 %1146 + %1148 = OpAccessChain %21 %18 %19 %20 + %1149 = OpLoad %6 %1148 + %1150 = OpAccessChain %21 %18 %19 %20 + %1151 = OpLoad %6 %1150 + %1152 = OpAccessChain %21 %18 %19 %20 + %1153 = OpLoad %6 %1152 + %1154 = OpAccessChain %21 %18 %19 %20 + %1155 = OpLoad %6 %1154 + %1156 = OpAccessChain %21 %18 %19 %20 + %1157 = OpLoad %6 %1156 + %1158 = OpAccessChain %21 %18 %19 %20 + %1159 = OpLoad %6 %1158 + %1160 = OpAccessChain %21 %18 %19 %20 + %1161 = OpLoad %6 %1160 + %1162 = OpAccessChain %21 %18 %19 %20 + %1163 = OpLoad %6 %1162 + %1164 = OpAccessChain %21 %18 %19 %20 + %1165 = OpLoad %6 %1164 + %1166 = OpAccessChain %21 %18 %19 %20 + %1167 = OpLoad %6 %1166 + %1168 = OpAccessChain %21 %18 %19 %20 + %1169 = OpLoad %6 %1168 + %1170 = OpAccessChain %21 %18 %19 %20 + %1171 = OpLoad %6 %1170 + %1172 = OpAccessChain %21 %18 %19 %20 + %1173 = OpLoad %6 %1172 + %1174 = OpAccessChain %21 %18 %19 %20 + %1175 = OpLoad %6 %1174 + %1176 = OpAccessChain %21 %18 %19 %20 + %1177 = OpLoad %6 %1176 + %1178 = OpAccessChain %21 %18 %19 %20 + %1179 = OpLoad %6 %1178 + %1180 = OpAccessChain %21 %18 %19 %20 + %1181 = OpLoad %6 %1180 + %1182 = OpAccessChain %21 %18 %19 %20 + %1183 = OpLoad %6 %1182 + %1184 = OpAccessChain %21 %18 %19 %20 + %1185 = OpLoad %6 %1184 + %1186 = OpAccessChain %21 %18 %19 %20 + %1187 = OpLoad %6 %1186 + %1188 = OpAccessChain %21 %18 %19 %20 + %1189 = OpLoad %6 %1188 + %1190 = OpAccessChain %21 %18 %19 %20 + %1191 = OpLoad %6 %1190 + %1192 = OpAccessChain %21 %18 %19 %20 + %1193 = OpLoad %6 %1192 + %1194 = OpAccessChain %21 %18 %19 %20 + %1195 = OpLoad %6 %1194 + %1196 = OpAccessChain %21 %18 %19 %20 + %1197 = OpLoad %6 %1196 + %1198 = OpAccessChain %21 %18 %19 %20 + %1199 = OpLoad %6 %1198 + %1200 = OpAccessChain %21 %18 %19 %20 + %1201 = OpLoad %6 %1200 + %1202 = OpAccessChain %21 %18 %19 %20 + %1203 = OpLoad %6 %1202 + %1204 = OpAccessChain %21 %18 %19 %20 + %1205 = OpLoad %6 %1204 + %1206 = OpAccessChain %21 %18 %19 %20 + %1207 = OpLoad %6 %1206 + %1208 = OpAccessChain %21 %18 %19 %20 + %1209 = OpLoad %6 %1208 + %1210 = OpAccessChain %21 %18 %19 %20 + %1211 = OpLoad %6 %1210 + %1212 = OpAccessChain %21 %18 %19 %20 + %1213 = OpLoad %6 %1212 + %1214 = OpAccessChain %21 %18 %19 %20 + %1215 = OpLoad %6 %1214 + %1216 = OpAccessChain %21 %18 %19 %20 + %1217 = OpLoad %6 %1216 + %1218 = OpAccessChain %21 %18 %19 %20 + %1219 = OpLoad %6 %1218 + %1220 = OpAccessChain %21 %18 %19 %20 + %1221 = OpLoad %6 %1220 + %1222 = OpAccessChain %21 %18 %19 %20 + %1223 = OpLoad %6 %1222 + %1224 = OpAccessChain %21 %18 %19 %20 + %1225 = OpLoad %6 %1224 + %1226 = OpAccessChain %21 %18 %19 %20 + %1227 = OpLoad %6 %1226 + %1228 = OpAccessChain %21 %18 %19 %20 + %1229 = OpLoad %6 %1228 + %1230 = OpAccessChain %21 %18 %19 %20 + %1231 = OpLoad %6 %1230 + %1232 = OpAccessChain %21 %18 %19 %20 + %1233 = OpLoad %6 %1232 + %1234 = OpAccessChain %21 %18 %19 %20 + %1235 = OpLoad %6 %1234 + %1236 = OpAccessChain %21 %18 %19 %20 + %1237 = OpLoad %6 %1236 + %1238 = OpAccessChain %21 %18 %19 %20 + %1239 = OpLoad %6 %1238 + %1240 = OpAccessChain %21 %18 %19 %20 + %1241 = OpLoad %6 %1240 + %1242 = OpAccessChain %21 %18 %19 %20 + %1243 = OpLoad %6 %1242 + %1244 = OpAccessChain %21 %18 %19 %20 + %1245 = OpLoad %6 %1244 + %1246 = OpAccessChain %21 %18 %19 %20 + %1247 = OpLoad %6 %1246 + %1248 = OpAccessChain %21 %18 %19 %20 + %1249 = OpLoad %6 %1248 + %1250 = OpAccessChain %21 %18 %19 %20 + %1251 = OpLoad %6 %1250 + %1252 = OpAccessChain %21 %18 %19 %20 + %1253 = OpLoad %6 %1252 + %1254 = OpAccessChain %21 %18 %19 %20 + %1255 = OpLoad %6 %1254 + %1256 = OpAccessChain %21 %18 %19 %20 + %1257 = OpLoad %6 %1256 + %1258 = OpAccessChain %21 %18 %19 %20 + %1259 = OpLoad %6 %1258 + %1260 = OpAccessChain %21 %18 %19 %20 + %1261 = OpLoad %6 %1260 + %1262 = OpAccessChain %21 %18 %19 %20 + %1263 = OpLoad %6 %1262 + %1264 = OpAccessChain %21 %18 %19 %20 + %1265 = OpLoad %6 %1264 + %1266 = OpAccessChain %21 %18 %19 %20 + %1267 = OpLoad %6 %1266 + %1268 = OpAccessChain %21 %18 %19 %20 + %1269 = OpLoad %6 %1268 + %1270 = OpAccessChain %21 %18 %19 %20 + %1271 = OpLoad %6 %1270 + %1272 = OpAccessChain %21 %18 %19 %20 + %1273 = OpLoad %6 %1272 + %1274 = OpAccessChain %21 %18 %19 %20 + %1275 = OpLoad %6 %1274 + %1276 = OpAccessChain %21 %18 %19 %20 + %1277 = OpLoad %6 %1276 + %1278 = OpAccessChain %21 %18 %19 %20 + %1279 = OpLoad %6 %1278 + %1280 = OpAccessChain %21 %18 %19 %20 + %1281 = OpLoad %6 %1280 + %1282 = OpAccessChain %21 %18 %19 %20 + %1283 = OpLoad %6 %1282 + %1284 = OpAccessChain %21 %18 %19 %20 + %1285 = OpLoad %6 %1284 + %1286 = OpAccessChain %21 %18 %19 %20 + %1287 = OpLoad %6 %1286 + %1288 = OpAccessChain %21 %18 %19 %20 + %1289 = OpLoad %6 %1288 + %1290 = OpAccessChain %21 %18 %19 %20 + %1291 = OpLoad %6 %1290 + %1292 = OpAccessChain %21 %18 %19 %20 + %1293 = OpLoad %6 %1292 + %1294 = OpAccessChain %21 %18 %19 %20 + %1295 = OpLoad %6 %1294 + %1296 = OpAccessChain %21 %18 %19 %20 + %1297 = OpLoad %6 %1296 + %1298 = OpAccessChain %21 %18 %19 %20 + %1299 = OpLoad %6 %1298 + %1300 = OpAccessChain %21 %18 %19 %20 + %1301 = OpLoad %6 %1300 + %1302 = OpAccessChain %21 %18 %19 %20 + %1303 = OpLoad %6 %1302 + %1304 = OpAccessChain %21 %18 %19 %20 + %1305 = OpLoad %6 %1304 + %1306 = OpAccessChain %21 %18 %19 %20 + %1307 = OpLoad %6 %1306 + %1308 = OpAccessChain %21 %18 %19 %20 + %1309 = OpLoad %6 %1308 + %1310 = OpAccessChain %21 %18 %19 %20 + %1311 = OpLoad %6 %1310 + %1312 = OpAccessChain %21 %18 %19 %20 + %1313 = OpLoad %6 %1312 + %1314 = OpAccessChain %21 %18 %19 %20 + %1315 = OpLoad %6 %1314 + %1316 = OpAccessChain %21 %18 %19 %20 + %1317 = OpLoad %6 %1316 + %1318 = OpAccessChain %21 %18 %19 %20 + %1319 = OpLoad %6 %1318 + %1320 = OpAccessChain %21 %18 %19 %20 + %1321 = OpLoad %6 %1320 + %1322 = OpAccessChain %21 %18 %19 %20 + %1323 = OpLoad %6 %1322 + %1324 = OpAccessChain %21 %18 %19 %20 + %1325 = OpLoad %6 %1324 + %1326 = OpAccessChain %21 %18 %19 %20 + %1327 = OpLoad %6 %1326 + %1328 = OpAccessChain %21 %18 %19 %20 + %1329 = OpLoad %6 %1328 + %1330 = OpAccessChain %21 %18 %19 %20 + %1331 = OpLoad %6 %1330 + %1332 = OpAccessChain %21 %18 %19 %20 + %1333 = OpLoad %6 %1332 + %1334 = OpAccessChain %21 %18 %19 %20 + %1335 = OpLoad %6 %1334 + %1336 = OpAccessChain %21 %18 %19 %20 + %1337 = OpLoad %6 %1336 + %1338 = OpAccessChain %21 %18 %19 %20 + %1339 = OpLoad %6 %1338 + %1340 = OpAccessChain %21 %18 %19 %20 + %1341 = OpLoad %6 %1340 + %1342 = OpAccessChain %21 %18 %19 %20 + %1343 = OpLoad %6 %1342 + %1344 = OpAccessChain %21 %18 %19 %20 + %1345 = OpLoad %6 %1344 + %1346 = OpAccessChain %21 %18 %19 %20 + %1347 = OpLoad %6 %1346 + %1348 = OpAccessChain %21 %18 %19 %20 + %1349 = OpLoad %6 %1348 + %1350 = OpAccessChain %21 %18 %19 %20 + %1351 = OpLoad %6 %1350 + %1352 = OpAccessChain %21 %18 %19 %20 + %1353 = OpLoad %6 %1352 + %1354 = OpAccessChain %21 %18 %19 %20 + %1355 = OpLoad %6 %1354 + %1356 = OpAccessChain %21 %18 %19 %20 + %1357 = OpLoad %6 %1356 + %1358 = OpAccessChain %21 %18 %19 %20 + %1359 = OpLoad %6 %1358 + %1360 = OpAccessChain %21 %18 %19 %20 + %1361 = OpLoad %6 %1360 + %1362 = OpAccessChain %21 %18 %19 %20 + %1363 = OpLoad %6 %1362 + %1364 = OpAccessChain %21 %18 %19 %20 + %1365 = OpLoad %6 %1364 + %1366 = OpAccessChain %21 %18 %19 %20 + %1367 = OpLoad %6 %1366 + %1368 = OpAccessChain %21 %18 %19 %20 + %1369 = OpLoad %6 %1368 + %1370 = OpAccessChain %21 %18 %19 %20 + %1371 = OpLoad %6 %1370 + %1372 = OpAccessChain %21 %18 %19 %20 + %1373 = OpLoad %6 %1372 + %1374 = OpAccessChain %21 %18 %19 %20 + %1375 = OpLoad %6 %1374 + %1376 = OpAccessChain %21 %18 %19 %20 + %1377 = OpLoad %6 %1376 + %1378 = OpAccessChain %21 %18 %19 %20 + %1379 = OpLoad %6 %1378 + %1380 = OpAccessChain %21 %18 %19 %20 + %1381 = OpLoad %6 %1380 + %1382 = OpAccessChain %21 %18 %19 %20 + %1383 = OpLoad %6 %1382 + %1384 = OpAccessChain %21 %18 %19 %20 + %1385 = OpLoad %6 %1384 + %1386 = OpAccessChain %21 %18 %19 %20 + %1387 = OpLoad %6 %1386 + %1388 = OpAccessChain %21 %18 %19 %20 + %1389 = OpLoad %6 %1388 + %1390 = OpAccessChain %21 %18 %19 %20 + %1391 = OpLoad %6 %1390 + %1392 = OpAccessChain %21 %18 %19 %20 + %1393 = OpLoad %6 %1392 + %1394 = OpAccessChain %21 %18 %19 %20 + %1395 = OpLoad %6 %1394 + %1396 = OpAccessChain %21 %18 %19 %20 + %1397 = OpLoad %6 %1396 + %1398 = OpAccessChain %21 %18 %19 %20 + %1399 = OpLoad %6 %1398 + %1400 = OpAccessChain %21 %18 %19 %20 + %1401 = OpLoad %6 %1400 + %1402 = OpAccessChain %21 %18 %19 %20 + %1403 = OpLoad %6 %1402 + %1404 = OpAccessChain %21 %18 %19 %20 + %1405 = OpLoad %6 %1404 + %1406 = OpAccessChain %21 %18 %19 %20 + %1407 = OpLoad %6 %1406 + %1408 = OpAccessChain %21 %18 %19 %20 + %1409 = OpLoad %6 %1408 + %1410 = OpAccessChain %21 %18 %19 %20 + %1411 = OpLoad %6 %1410 + %1412 = OpAccessChain %21 %18 %19 %20 + %1413 = OpLoad %6 %1412 + %1414 = OpAccessChain %21 %18 %19 %20 + %1415 = OpLoad %6 %1414 + %1416 = OpAccessChain %21 %18 %19 %20 + %1417 = OpLoad %6 %1416 + %1418 = OpAccessChain %21 %18 %19 %20 + %1419 = OpLoad %6 %1418 + %1420 = OpAccessChain %21 %18 %19 %20 + %1421 = OpLoad %6 %1420 + %1422 = OpAccessChain %21 %18 %19 %20 + %1423 = OpLoad %6 %1422 + %1424 = OpAccessChain %21 %18 %19 %20 + %1425 = OpLoad %6 %1424 + %1426 = OpAccessChain %21 %18 %19 %20 + %1427 = OpLoad %6 %1426 + %1428 = OpAccessChain %21 %18 %19 %20 + %1429 = OpLoad %6 %1428 + %1430 = OpAccessChain %21 %18 %19 %20 + %1431 = OpLoad %6 %1430 + %1432 = OpAccessChain %21 %18 %19 %20 + %1433 = OpLoad %6 %1432 + %1434 = OpAccessChain %21 %18 %19 %20 + %1435 = OpLoad %6 %1434 + %1436 = OpAccessChain %21 %18 %19 %20 + %1437 = OpLoad %6 %1436 + %1438 = OpAccessChain %21 %18 %19 %20 + %1439 = OpLoad %6 %1438 + %1440 = OpAccessChain %21 %18 %19 %20 + %1441 = OpLoad %6 %1440 + %1442 = OpAccessChain %21 %18 %19 %20 + %1443 = OpLoad %6 %1442 + %1444 = OpAccessChain %21 %18 %19 %20 + %1445 = OpLoad %6 %1444 + %1446 = OpAccessChain %21 %18 %19 %20 + %1447 = OpLoad %6 %1446 + %1448 = OpAccessChain %21 %18 %19 %20 + %1449 = OpLoad %6 %1448 + %1450 = OpAccessChain %21 %18 %19 %20 + %1451 = OpLoad %6 %1450 + %1452 = OpAccessChain %21 %18 %19 %20 + %1453 = OpLoad %6 %1452 + %1454 = OpAccessChain %21 %18 %19 %20 + %1455 = OpLoad %6 %1454 + %1456 = OpAccessChain %21 %18 %19 %20 + %1457 = OpLoad %6 %1456 + %1458 = OpAccessChain %21 %18 %19 %20 + %1459 = OpLoad %6 %1458 + %1460 = OpAccessChain %21 %18 %19 %20 + %1461 = OpLoad %6 %1460 + %1462 = OpAccessChain %21 %18 %19 %20 + %1463 = OpLoad %6 %1462 + %1464 = OpAccessChain %21 %18 %19 %20 + %1465 = OpLoad %6 %1464 + %1466 = OpAccessChain %21 %18 %19 %20 + %1467 = OpLoad %6 %1466 + %1468 = OpAccessChain %21 %18 %19 %20 + %1469 = OpLoad %6 %1468 + %1470 = OpAccessChain %21 %18 %19 %20 + %1471 = OpLoad %6 %1470 + %1472 = OpAccessChain %21 %18 %19 %20 + %1473 = OpLoad %6 %1472 + %1474 = OpAccessChain %21 %18 %19 %20 + %1475 = OpLoad %6 %1474 + %1476 = OpAccessChain %21 %18 %19 %20 + %1477 = OpLoad %6 %1476 + %1478 = OpAccessChain %21 %18 %19 %20 + %1479 = OpLoad %6 %1478 + %1480 = OpAccessChain %21 %18 %19 %20 + %1481 = OpLoad %6 %1480 + %1482 = OpAccessChain %21 %18 %19 %20 + %1483 = OpLoad %6 %1482 + %1484 = OpAccessChain %21 %18 %19 %20 + %1485 = OpLoad %6 %1484 + %1486 = OpAccessChain %21 %18 %19 %20 + %1487 = OpLoad %6 %1486 + %1488 = OpAccessChain %21 %18 %19 %20 + %1489 = OpLoad %6 %1488 + %1490 = OpAccessChain %21 %18 %19 %20 + %1491 = OpLoad %6 %1490 + %1492 = OpAccessChain %21 %18 %19 %20 + %1493 = OpLoad %6 %1492 + %1494 = OpAccessChain %21 %18 %19 %20 + %1495 = OpLoad %6 %1494 + %1496 = OpAccessChain %21 %18 %19 %20 + %1497 = OpLoad %6 %1496 + %1498 = OpAccessChain %21 %18 %19 %20 + %1499 = OpLoad %6 %1498 + %1500 = OpAccessChain %21 %18 %19 %20 + %1501 = OpLoad %6 %1500 + %1502 = OpAccessChain %21 %18 %19 %20 + %1503 = OpLoad %6 %1502 + %1504 = OpAccessChain %21 %18 %19 %20 + %1505 = OpLoad %6 %1504 + %1506 = OpAccessChain %21 %18 %19 %20 + %1507 = OpLoad %6 %1506 + %1508 = OpAccessChain %21 %18 %19 %20 + %1509 = OpLoad %6 %1508 + %1510 = OpAccessChain %21 %18 %19 %20 + %1511 = OpLoad %6 %1510 + %1512 = OpAccessChain %21 %18 %19 %20 + %1513 = OpLoad %6 %1512 + %1514 = OpAccessChain %21 %18 %19 %20 + %1515 = OpLoad %6 %1514 + %1516 = OpAccessChain %21 %18 %19 %20 + %1517 = OpLoad %6 %1516 + %1518 = OpAccessChain %21 %18 %19 %20 + %1519 = OpLoad %6 %1518 + %1520 = OpAccessChain %21 %18 %19 %20 + %1521 = OpLoad %6 %1520 + %1522 = OpAccessChain %21 %18 %19 %20 + %1523 = OpLoad %6 %1522 + %1524 = OpAccessChain %21 %18 %19 %20 + %1525 = OpLoad %6 %1524 + %1526 = OpAccessChain %21 %18 %19 %20 + %1527 = OpLoad %6 %1526 + %1528 = OpAccessChain %21 %18 %19 %20 + %1529 = OpLoad %6 %1528 + %1530 = OpAccessChain %21 %18 %19 %20 + %1531 = OpLoad %6 %1530 + %1532 = OpAccessChain %21 %18 %19 %20 + %1533 = OpLoad %6 %1532 + %1534 = OpAccessChain %21 %18 %19 %20 + %1535 = OpLoad %6 %1534 + %1536 = OpAccessChain %21 %18 %19 %20 + %1537 = OpLoad %6 %1536 + %1538 = OpAccessChain %21 %18 %19 %20 + %1539 = OpLoad %6 %1538 + %1540 = OpAccessChain %21 %18 %19 %20 + %1541 = OpLoad %6 %1540 + %1542 = OpAccessChain %21 %18 %19 %20 + %1543 = OpLoad %6 %1542 + %1544 = OpAccessChain %21 %18 %19 %20 + %1545 = OpLoad %6 %1544 + %1546 = OpAccessChain %21 %18 %19 %20 + %1547 = OpLoad %6 %1546 + %1548 = OpAccessChain %21 %18 %19 %20 + %1549 = OpLoad %6 %1548 + %1550 = OpAccessChain %21 %18 %19 %20 + %1551 = OpLoad %6 %1550 + %1552 = OpAccessChain %21 %18 %19 %20 + %1553 = OpLoad %6 %1552 + %1554 = OpAccessChain %21 %18 %19 %20 + %1555 = OpLoad %6 %1554 + %1556 = OpAccessChain %21 %18 %19 %20 + %1557 = OpLoad %6 %1556 + %1558 = OpAccessChain %21 %18 %19 %20 + %1559 = OpLoad %6 %1558 + %1560 = OpAccessChain %21 %18 %19 %20 + %1561 = OpLoad %6 %1560 + %1562 = OpAccessChain %21 %18 %19 %20 + %1563 = OpLoad %6 %1562 + %1564 = OpAccessChain %21 %18 %19 %20 + %1565 = OpLoad %6 %1564 + %1566 = OpAccessChain %21 %18 %19 %20 + %1567 = OpLoad %6 %1566 + %1568 = OpAccessChain %21 %18 %19 %20 + %1569 = OpLoad %6 %1568 + %1570 = OpAccessChain %21 %18 %19 %20 + %1571 = OpLoad %6 %1570 + %1572 = OpAccessChain %21 %18 %19 %20 + %1573 = OpLoad %6 %1572 + %1574 = OpCompositeConstruct %535 %1063 %1065 %1067 %1069 %1071 %1073 %1075 %1077 %1079 %1081 %1083 %1085 %1087 %1089 %1091 %1093 %1095 %1097 %1099 %1101 %1103 %1105 %1107 %1109 %1111 %1113 %1115 %1117 %1119 %1121 %1123 %1125 %1127 %1129 %1131 %1133 %1135 %1137 %1139 %1141 %1143 %1145 %1147 %1149 %1151 %1153 %1155 %1157 %1159 %1161 %1163 %1165 %1167 %1169 %1171 %1173 %1175 %1177 %1179 %1181 %1183 %1185 %1187 %1189 %1191 %1193 %1195 %1197 %1199 %1201 %1203 %1205 %1207 %1209 %1211 %1213 %1215 %1217 %1219 %1221 %1223 %1225 %1227 %1229 %1231 %1233 %1235 %1237 %1239 %1241 %1243 %1245 %1247 %1249 %1251 %1253 %1255 %1257 %1259 %1261 %1263 %1265 %1267 %1269 %1271 %1273 %1275 %1277 %1279 %1281 %1283 %1285 %1287 %1289 %1291 %1293 %1295 %1297 %1299 %1301 %1303 %1305 %1307 %1309 %1311 %1313 %1315 %1317 %1319 %1321 %1323 %1325 %1327 %1329 %1331 %1333 %1335 %1337 %1339 %1341 %1343 %1345 %1347 %1349 %1351 %1353 %1355 %1357 %1359 %1361 %1363 %1365 %1367 %1369 %1371 %1373 %1375 %1377 %1379 %1381 %1383 %1385 %1387 %1389 %1391 %1393 %1395 %1397 %1399 %1401 %1403 %1405 %1407 %1409 %1411 %1413 %1415 %1417 %1419 %1421 %1423 %1425 %1427 %1429 %1431 %1433 %1435 %1437 %1439 %1441 %1443 %1445 %1447 %1449 %1451 %1453 %1455 %1457 %1459 %1461 %1463 %1465 %1467 %1469 %1471 %1473 %1475 %1477 %1479 %1481 %1483 %1485 %1487 %1489 %1491 %1493 %1495 %1497 %1499 %1501 %1503 %1505 %1507 %1509 %1511 %1513 %1515 %1517 %1519 %1521 %1523 %1525 %1527 %1529 %1531 %1533 %1535 %1537 %1539 %1541 %1543 %1545 %1547 %1549 %1551 %1553 %1555 %1557 %1559 %1561 %1563 %1565 %1567 %1569 %1571 %1573 + %1575 = OpLoad %6 %9 + %1576 = OpExtInst %6 %1 SClamp %1575 %19 %538 + OpStore %1577 %1574 + %1578 = OpAccessChain %7 %1577 %1576 + %1579 = OpLoad %6 %1578 + %1580 = OpExtInst %6 %1 SMax %1061 %1579 + %1581 = OpAccessChain %21 %18 %19 %20 + %1582 = OpLoad %6 %1581 + %1583 = OpAccessChain %21 %18 %19 %20 + %1584 = OpLoad %6 %1583 + %1585 = OpAccessChain %21 %18 %19 %20 + %1586 = OpLoad %6 %1585 + %1587 = OpAccessChain %21 %18 %19 %20 + %1588 = OpLoad %6 %1587 + %1589 = OpAccessChain %21 %18 %19 %20 + %1590 = OpLoad %6 %1589 + %1591 = OpAccessChain %21 %18 %19 %20 + %1592 = OpLoad %6 %1591 + %1593 = OpAccessChain %21 %18 %19 %20 + %1594 = OpLoad %6 %1593 + %1595 = OpAccessChain %21 %18 %19 %20 + %1596 = OpLoad %6 %1595 + %1597 = OpAccessChain %21 %18 %19 %20 + %1598 = OpLoad %6 %1597 + %1599 = OpAccessChain %21 %18 %19 %20 + %1600 = OpLoad %6 %1599 + %1601 = OpAccessChain %21 %18 %19 %20 + %1602 = OpLoad %6 %1601 + %1603 = OpAccessChain %21 %18 %19 %20 + %1604 = OpLoad %6 %1603 + %1605 = OpAccessChain %21 %18 %19 %20 + %1606 = OpLoad %6 %1605 + %1607 = OpAccessChain %21 %18 %19 %20 + %1608 = OpLoad %6 %1607 + %1609 = OpAccessChain %21 %18 %19 %20 + %1610 = OpLoad %6 %1609 + %1611 = OpAccessChain %21 %18 %19 %20 + %1612 = OpLoad %6 %1611 + %1613 = OpAccessChain %21 %18 %19 %20 + %1614 = OpLoad %6 %1613 + %1615 = OpAccessChain %21 %18 %19 %20 + %1616 = OpLoad %6 %1615 + %1617 = OpAccessChain %21 %18 %19 %20 + %1618 = OpLoad %6 %1617 + %1619 = OpAccessChain %21 %18 %19 %20 + %1620 = OpLoad %6 %1619 + %1621 = OpAccessChain %21 %18 %19 %20 + %1622 = OpLoad %6 %1621 + %1623 = OpAccessChain %21 %18 %19 %20 + %1624 = OpLoad %6 %1623 + %1625 = OpAccessChain %21 %18 %19 %20 + %1626 = OpLoad %6 %1625 + %1627 = OpAccessChain %21 %18 %19 %20 + %1628 = OpLoad %6 %1627 + %1629 = OpAccessChain %21 %18 %19 %20 + %1630 = OpLoad %6 %1629 + %1631 = OpAccessChain %21 %18 %19 %20 + %1632 = OpLoad %6 %1631 + %1633 = OpAccessChain %21 %18 %19 %20 + %1634 = OpLoad %6 %1633 + %1635 = OpAccessChain %21 %18 %19 %20 + %1636 = OpLoad %6 %1635 + %1637 = OpAccessChain %21 %18 %19 %20 + %1638 = OpLoad %6 %1637 + %1639 = OpAccessChain %21 %18 %19 %20 + %1640 = OpLoad %6 %1639 + %1641 = OpAccessChain %21 %18 %19 %20 + %1642 = OpLoad %6 %1641 + %1643 = OpAccessChain %21 %18 %19 %20 + %1644 = OpLoad %6 %1643 + %1645 = OpAccessChain %21 %18 %19 %20 + %1646 = OpLoad %6 %1645 + %1647 = OpAccessChain %21 %18 %19 %20 + %1648 = OpLoad %6 %1647 + %1649 = OpAccessChain %21 %18 %19 %20 + %1650 = OpLoad %6 %1649 + %1651 = OpAccessChain %21 %18 %19 %20 + %1652 = OpLoad %6 %1651 + %1653 = OpAccessChain %21 %18 %19 %20 + %1654 = OpLoad %6 %1653 + %1655 = OpAccessChain %21 %18 %19 %20 + %1656 = OpLoad %6 %1655 + %1657 = OpAccessChain %21 %18 %19 %20 + %1658 = OpLoad %6 %1657 + %1659 = OpAccessChain %21 %18 %19 %20 + %1660 = OpLoad %6 %1659 + %1661 = OpAccessChain %21 %18 %19 %20 + %1662 = OpLoad %6 %1661 + %1663 = OpAccessChain %21 %18 %19 %20 + %1664 = OpLoad %6 %1663 + %1665 = OpAccessChain %21 %18 %19 %20 + %1666 = OpLoad %6 %1665 + %1667 = OpAccessChain %21 %18 %19 %20 + %1668 = OpLoad %6 %1667 + %1669 = OpAccessChain %21 %18 %19 %20 + %1670 = OpLoad %6 %1669 + %1671 = OpAccessChain %21 %18 %19 %20 + %1672 = OpLoad %6 %1671 + %1673 = OpAccessChain %21 %18 %19 %20 + %1674 = OpLoad %6 %1673 + %1675 = OpAccessChain %21 %18 %19 %20 + %1676 = OpLoad %6 %1675 + %1677 = OpAccessChain %21 %18 %19 %20 + %1678 = OpLoad %6 %1677 + %1679 = OpAccessChain %21 %18 %19 %20 + %1680 = OpLoad %6 %1679 + %1681 = OpAccessChain %21 %18 %19 %20 + %1682 = OpLoad %6 %1681 + %1683 = OpAccessChain %21 %18 %19 %20 + %1684 = OpLoad %6 %1683 + %1685 = OpAccessChain %21 %18 %19 %20 + %1686 = OpLoad %6 %1685 + %1687 = OpAccessChain %21 %18 %19 %20 + %1688 = OpLoad %6 %1687 + %1689 = OpAccessChain %21 %18 %19 %20 + %1690 = OpLoad %6 %1689 + %1691 = OpAccessChain %21 %18 %19 %20 + %1692 = OpLoad %6 %1691 + %1693 = OpAccessChain %21 %18 %19 %20 + %1694 = OpLoad %6 %1693 + %1695 = OpAccessChain %21 %18 %19 %20 + %1696 = OpLoad %6 %1695 + %1697 = OpAccessChain %21 %18 %19 %20 + %1698 = OpLoad %6 %1697 + %1699 = OpAccessChain %21 %18 %19 %20 + %1700 = OpLoad %6 %1699 + %1701 = OpAccessChain %21 %18 %19 %20 + %1702 = OpLoad %6 %1701 + %1703 = OpAccessChain %21 %18 %19 %20 + %1704 = OpLoad %6 %1703 + %1705 = OpAccessChain %21 %18 %19 %20 + %1706 = OpLoad %6 %1705 + %1707 = OpAccessChain %21 %18 %19 %20 + %1708 = OpLoad %6 %1707 + %1709 = OpAccessChain %21 %18 %19 %20 + %1710 = OpLoad %6 %1709 + %1711 = OpAccessChain %21 %18 %19 %20 + %1712 = OpLoad %6 %1711 + %1713 = OpAccessChain %21 %18 %19 %20 + %1714 = OpLoad %6 %1713 + %1715 = OpAccessChain %21 %18 %19 %20 + %1716 = OpLoad %6 %1715 + %1717 = OpAccessChain %21 %18 %19 %20 + %1718 = OpLoad %6 %1717 + %1719 = OpAccessChain %21 %18 %19 %20 + %1720 = OpLoad %6 %1719 + %1721 = OpAccessChain %21 %18 %19 %20 + %1722 = OpLoad %6 %1721 + %1723 = OpAccessChain %21 %18 %19 %20 + %1724 = OpLoad %6 %1723 + %1725 = OpAccessChain %21 %18 %19 %20 + %1726 = OpLoad %6 %1725 + %1727 = OpAccessChain %21 %18 %19 %20 + %1728 = OpLoad %6 %1727 + %1729 = OpAccessChain %21 %18 %19 %20 + %1730 = OpLoad %6 %1729 + %1731 = OpAccessChain %21 %18 %19 %20 + %1732 = OpLoad %6 %1731 + %1733 = OpAccessChain %21 %18 %19 %20 + %1734 = OpLoad %6 %1733 + %1735 = OpAccessChain %21 %18 %19 %20 + %1736 = OpLoad %6 %1735 + %1737 = OpAccessChain %21 %18 %19 %20 + %1738 = OpLoad %6 %1737 + %1739 = OpAccessChain %21 %18 %19 %20 + %1740 = OpLoad %6 %1739 + %1741 = OpAccessChain %21 %18 %19 %20 + %1742 = OpLoad %6 %1741 + %1743 = OpAccessChain %21 %18 %19 %20 + %1744 = OpLoad %6 %1743 + %1745 = OpAccessChain %21 %18 %19 %20 + %1746 = OpLoad %6 %1745 + %1747 = OpAccessChain %21 %18 %19 %20 + %1748 = OpLoad %6 %1747 + %1749 = OpAccessChain %21 %18 %19 %20 + %1750 = OpLoad %6 %1749 + %1751 = OpAccessChain %21 %18 %19 %20 + %1752 = OpLoad %6 %1751 + %1753 = OpAccessChain %21 %18 %19 %20 + %1754 = OpLoad %6 %1753 + %1755 = OpAccessChain %21 %18 %19 %20 + %1756 = OpLoad %6 %1755 + %1757 = OpAccessChain %21 %18 %19 %20 + %1758 = OpLoad %6 %1757 + %1759 = OpAccessChain %21 %18 %19 %20 + %1760 = OpLoad %6 %1759 + %1761 = OpAccessChain %21 %18 %19 %20 + %1762 = OpLoad %6 %1761 + %1763 = OpAccessChain %21 %18 %19 %20 + %1764 = OpLoad %6 %1763 + %1765 = OpAccessChain %21 %18 %19 %20 + %1766 = OpLoad %6 %1765 + %1767 = OpAccessChain %21 %18 %19 %20 + %1768 = OpLoad %6 %1767 + %1769 = OpAccessChain %21 %18 %19 %20 + %1770 = OpLoad %6 %1769 + %1771 = OpAccessChain %21 %18 %19 %20 + %1772 = OpLoad %6 %1771 + %1773 = OpAccessChain %21 %18 %19 %20 + %1774 = OpLoad %6 %1773 + %1775 = OpAccessChain %21 %18 %19 %20 + %1776 = OpLoad %6 %1775 + %1777 = OpAccessChain %21 %18 %19 %20 + %1778 = OpLoad %6 %1777 + %1779 = OpAccessChain %21 %18 %19 %20 + %1780 = OpLoad %6 %1779 + %1781 = OpAccessChain %21 %18 %19 %20 + %1782 = OpLoad %6 %1781 + %1783 = OpAccessChain %21 %18 %19 %20 + %1784 = OpLoad %6 %1783 + %1785 = OpAccessChain %21 %18 %19 %20 + %1786 = OpLoad %6 %1785 + %1787 = OpAccessChain %21 %18 %19 %20 + %1788 = OpLoad %6 %1787 + %1789 = OpAccessChain %21 %18 %19 %20 + %1790 = OpLoad %6 %1789 + %1791 = OpAccessChain %21 %18 %19 %20 + %1792 = OpLoad %6 %1791 + %1793 = OpAccessChain %21 %18 %19 %20 + %1794 = OpLoad %6 %1793 + %1795 = OpAccessChain %21 %18 %19 %20 + %1796 = OpLoad %6 %1795 + %1797 = OpAccessChain %21 %18 %19 %20 + %1798 = OpLoad %6 %1797 + %1799 = OpAccessChain %21 %18 %19 %20 + %1800 = OpLoad %6 %1799 + %1801 = OpAccessChain %21 %18 %19 %20 + %1802 = OpLoad %6 %1801 + %1803 = OpAccessChain %21 %18 %19 %20 + %1804 = OpLoad %6 %1803 + %1805 = OpAccessChain %21 %18 %19 %20 + %1806 = OpLoad %6 %1805 + %1807 = OpAccessChain %21 %18 %19 %20 + %1808 = OpLoad %6 %1807 + %1809 = OpAccessChain %21 %18 %19 %20 + %1810 = OpLoad %6 %1809 + %1811 = OpAccessChain %21 %18 %19 %20 + %1812 = OpLoad %6 %1811 + %1813 = OpAccessChain %21 %18 %19 %20 + %1814 = OpLoad %6 %1813 + %1815 = OpAccessChain %21 %18 %19 %20 + %1816 = OpLoad %6 %1815 + %1817 = OpAccessChain %21 %18 %19 %20 + %1818 = OpLoad %6 %1817 + %1819 = OpAccessChain %21 %18 %19 %20 + %1820 = OpLoad %6 %1819 + %1821 = OpAccessChain %21 %18 %19 %20 + %1822 = OpLoad %6 %1821 + %1823 = OpAccessChain %21 %18 %19 %20 + %1824 = OpLoad %6 %1823 + %1825 = OpAccessChain %21 %18 %19 %20 + %1826 = OpLoad %6 %1825 + %1827 = OpAccessChain %21 %18 %19 %20 + %1828 = OpLoad %6 %1827 + %1829 = OpAccessChain %21 %18 %19 %20 + %1830 = OpLoad %6 %1829 + %1831 = OpAccessChain %21 %18 %19 %20 + %1832 = OpLoad %6 %1831 + %1833 = OpAccessChain %21 %18 %19 %20 + %1834 = OpLoad %6 %1833 + %1835 = OpAccessChain %21 %18 %19 %20 + %1836 = OpLoad %6 %1835 + %1837 = OpAccessChain %21 %18 %19 %20 + %1838 = OpLoad %6 %1837 + %1839 = OpAccessChain %21 %18 %19 %20 + %1840 = OpLoad %6 %1839 + %1841 = OpAccessChain %21 %18 %19 %20 + %1842 = OpLoad %6 %1841 + %1843 = OpAccessChain %21 %18 %19 %20 + %1844 = OpLoad %6 %1843 + %1845 = OpAccessChain %21 %18 %19 %20 + %1846 = OpLoad %6 %1845 + %1847 = OpAccessChain %21 %18 %19 %20 + %1848 = OpLoad %6 %1847 + %1849 = OpAccessChain %21 %18 %19 %20 + %1850 = OpLoad %6 %1849 + %1851 = OpAccessChain %21 %18 %19 %20 + %1852 = OpLoad %6 %1851 + %1853 = OpAccessChain %21 %18 %19 %20 + %1854 = OpLoad %6 %1853 + %1855 = OpAccessChain %21 %18 %19 %20 + %1856 = OpLoad %6 %1855 + %1857 = OpAccessChain %21 %18 %19 %20 + %1858 = OpLoad %6 %1857 + %1859 = OpAccessChain %21 %18 %19 %20 + %1860 = OpLoad %6 %1859 + %1861 = OpAccessChain %21 %18 %19 %20 + %1862 = OpLoad %6 %1861 + %1863 = OpAccessChain %21 %18 %19 %20 + %1864 = OpLoad %6 %1863 + %1865 = OpAccessChain %21 %18 %19 %20 + %1866 = OpLoad %6 %1865 + %1867 = OpAccessChain %21 %18 %19 %20 + %1868 = OpLoad %6 %1867 + %1869 = OpAccessChain %21 %18 %19 %20 + %1870 = OpLoad %6 %1869 + %1871 = OpAccessChain %21 %18 %19 %20 + %1872 = OpLoad %6 %1871 + %1873 = OpAccessChain %21 %18 %19 %20 + %1874 = OpLoad %6 %1873 + %1875 = OpAccessChain %21 %18 %19 %20 + %1876 = OpLoad %6 %1875 + %1877 = OpAccessChain %21 %18 %19 %20 + %1878 = OpLoad %6 %1877 + %1879 = OpAccessChain %21 %18 %19 %20 + %1880 = OpLoad %6 %1879 + %1881 = OpAccessChain %21 %18 %19 %20 + %1882 = OpLoad %6 %1881 + %1883 = OpAccessChain %21 %18 %19 %20 + %1884 = OpLoad %6 %1883 + %1885 = OpAccessChain %21 %18 %19 %20 + %1886 = OpLoad %6 %1885 + %1887 = OpAccessChain %21 %18 %19 %20 + %1888 = OpLoad %6 %1887 + %1889 = OpAccessChain %21 %18 %19 %20 + %1890 = OpLoad %6 %1889 + %1891 = OpAccessChain %21 %18 %19 %20 + %1892 = OpLoad %6 %1891 + %1893 = OpAccessChain %21 %18 %19 %20 + %1894 = OpLoad %6 %1893 + %1895 = OpAccessChain %21 %18 %19 %20 + %1896 = OpLoad %6 %1895 + %1897 = OpAccessChain %21 %18 %19 %20 + %1898 = OpLoad %6 %1897 + %1899 = OpAccessChain %21 %18 %19 %20 + %1900 = OpLoad %6 %1899 + %1901 = OpAccessChain %21 %18 %19 %20 + %1902 = OpLoad %6 %1901 + %1903 = OpAccessChain %21 %18 %19 %20 + %1904 = OpLoad %6 %1903 + %1905 = OpAccessChain %21 %18 %19 %20 + %1906 = OpLoad %6 %1905 + %1907 = OpAccessChain %21 %18 %19 %20 + %1908 = OpLoad %6 %1907 + %1909 = OpAccessChain %21 %18 %19 %20 + %1910 = OpLoad %6 %1909 + %1911 = OpAccessChain %21 %18 %19 %20 + %1912 = OpLoad %6 %1911 + %1913 = OpAccessChain %21 %18 %19 %20 + %1914 = OpLoad %6 %1913 + %1915 = OpAccessChain %21 %18 %19 %20 + %1916 = OpLoad %6 %1915 + %1917 = OpAccessChain %21 %18 %19 %20 + %1918 = OpLoad %6 %1917 + %1919 = OpAccessChain %21 %18 %19 %20 + %1920 = OpLoad %6 %1919 + %1921 = OpAccessChain %21 %18 %19 %20 + %1922 = OpLoad %6 %1921 + %1923 = OpAccessChain %21 %18 %19 %20 + %1924 = OpLoad %6 %1923 + %1925 = OpAccessChain %21 %18 %19 %20 + %1926 = OpLoad %6 %1925 + %1927 = OpAccessChain %21 %18 %19 %20 + %1928 = OpLoad %6 %1927 + %1929 = OpAccessChain %21 %18 %19 %20 + %1930 = OpLoad %6 %1929 + %1931 = OpAccessChain %21 %18 %19 %20 + %1932 = OpLoad %6 %1931 + %1933 = OpAccessChain %21 %18 %19 %20 + %1934 = OpLoad %6 %1933 + %1935 = OpAccessChain %21 %18 %19 %20 + %1936 = OpLoad %6 %1935 + %1937 = OpAccessChain %21 %18 %19 %20 + %1938 = OpLoad %6 %1937 + %1939 = OpAccessChain %21 %18 %19 %20 + %1940 = OpLoad %6 %1939 + %1941 = OpAccessChain %21 %18 %19 %20 + %1942 = OpLoad %6 %1941 + %1943 = OpAccessChain %21 %18 %19 %20 + %1944 = OpLoad %6 %1943 + %1945 = OpAccessChain %21 %18 %19 %20 + %1946 = OpLoad %6 %1945 + %1947 = OpAccessChain %21 %18 %19 %20 + %1948 = OpLoad %6 %1947 + %1949 = OpAccessChain %21 %18 %19 %20 + %1950 = OpLoad %6 %1949 + %1951 = OpAccessChain %21 %18 %19 %20 + %1952 = OpLoad %6 %1951 + %1953 = OpAccessChain %21 %18 %19 %20 + %1954 = OpLoad %6 %1953 + %1955 = OpAccessChain %21 %18 %19 %20 + %1956 = OpLoad %6 %1955 + %1957 = OpAccessChain %21 %18 %19 %20 + %1958 = OpLoad %6 %1957 + %1959 = OpAccessChain %21 %18 %19 %20 + %1960 = OpLoad %6 %1959 + %1961 = OpAccessChain %21 %18 %19 %20 + %1962 = OpLoad %6 %1961 + %1963 = OpAccessChain %21 %18 %19 %20 + %1964 = OpLoad %6 %1963 + %1965 = OpAccessChain %21 %18 %19 %20 + %1966 = OpLoad %6 %1965 + %1967 = OpAccessChain %21 %18 %19 %20 + %1968 = OpLoad %6 %1967 + %1969 = OpAccessChain %21 %18 %19 %20 + %1970 = OpLoad %6 %1969 + %1971 = OpAccessChain %21 %18 %19 %20 + %1972 = OpLoad %6 %1971 + %1973 = OpAccessChain %21 %18 %19 %20 + %1974 = OpLoad %6 %1973 + %1975 = OpAccessChain %21 %18 %19 %20 + %1976 = OpLoad %6 %1975 + %1977 = OpAccessChain %21 %18 %19 %20 + %1978 = OpLoad %6 %1977 + %1979 = OpAccessChain %21 %18 %19 %20 + %1980 = OpLoad %6 %1979 + %1981 = OpAccessChain %21 %18 %19 %20 + %1982 = OpLoad %6 %1981 + %1983 = OpAccessChain %21 %18 %19 %20 + %1984 = OpLoad %6 %1983 + %1985 = OpAccessChain %21 %18 %19 %20 + %1986 = OpLoad %6 %1985 + %1987 = OpAccessChain %21 %18 %19 %20 + %1988 = OpLoad %6 %1987 + %1989 = OpAccessChain %21 %18 %19 %20 + %1990 = OpLoad %6 %1989 + %1991 = OpAccessChain %21 %18 %19 %20 + %1992 = OpLoad %6 %1991 + %1993 = OpAccessChain %21 %18 %19 %20 + %1994 = OpLoad %6 %1993 + %1995 = OpAccessChain %21 %18 %19 %20 + %1996 = OpLoad %6 %1995 + %1997 = OpAccessChain %21 %18 %19 %20 + %1998 = OpLoad %6 %1997 + %1999 = OpAccessChain %21 %18 %19 %20 + %2000 = OpLoad %6 %1999 + %2001 = OpAccessChain %21 %18 %19 %20 + %2002 = OpLoad %6 %2001 + %2003 = OpAccessChain %21 %18 %19 %20 + %2004 = OpLoad %6 %2003 + %2005 = OpAccessChain %21 %18 %19 %20 + %2006 = OpLoad %6 %2005 + %2007 = OpAccessChain %21 %18 %19 %20 + %2008 = OpLoad %6 %2007 + %2009 = OpAccessChain %21 %18 %19 %20 + %2010 = OpLoad %6 %2009 + %2011 = OpAccessChain %21 %18 %19 %20 + %2012 = OpLoad %6 %2011 + %2013 = OpAccessChain %21 %18 %19 %20 + %2014 = OpLoad %6 %2013 + %2015 = OpAccessChain %21 %18 %19 %20 + %2016 = OpLoad %6 %2015 + %2017 = OpAccessChain %21 %18 %19 %20 + %2018 = OpLoad %6 %2017 + %2019 = OpAccessChain %21 %18 %19 %20 + %2020 = OpLoad %6 %2019 + %2021 = OpAccessChain %21 %18 %19 %20 + %2022 = OpLoad %6 %2021 + %2023 = OpAccessChain %21 %18 %19 %20 + %2024 = OpLoad %6 %2023 + %2025 = OpAccessChain %21 %18 %19 %20 + %2026 = OpLoad %6 %2025 + %2027 = OpAccessChain %21 %18 %19 %20 + %2028 = OpLoad %6 %2027 + %2029 = OpAccessChain %21 %18 %19 %20 + %2030 = OpLoad %6 %2029 + %2031 = OpAccessChain %21 %18 %19 %20 + %2032 = OpLoad %6 %2031 + %2033 = OpAccessChain %21 %18 %19 %20 + %2034 = OpLoad %6 %2033 + %2035 = OpAccessChain %21 %18 %19 %20 + %2036 = OpLoad %6 %2035 + %2037 = OpAccessChain %21 %18 %19 %20 + %2038 = OpLoad %6 %2037 + %2039 = OpAccessChain %21 %18 %19 %20 + %2040 = OpLoad %6 %2039 + %2041 = OpAccessChain %21 %18 %19 %20 + %2042 = OpLoad %6 %2041 + %2043 = OpAccessChain %21 %18 %19 %20 + %2044 = OpLoad %6 %2043 + %2045 = OpAccessChain %21 %18 %19 %20 + %2046 = OpLoad %6 %2045 + %2047 = OpAccessChain %21 %18 %19 %20 + %2048 = OpLoad %6 %2047 + %2049 = OpAccessChain %21 %18 %19 %20 + %2050 = OpLoad %6 %2049 + %2051 = OpAccessChain %21 %18 %19 %20 + %2052 = OpLoad %6 %2051 + %2053 = OpAccessChain %21 %18 %19 %20 + %2054 = OpLoad %6 %2053 + %2055 = OpAccessChain %21 %18 %19 %20 + %2056 = OpLoad %6 %2055 + %2057 = OpAccessChain %21 %18 %19 %20 + %2058 = OpLoad %6 %2057 + %2059 = OpAccessChain %21 %18 %19 %20 + %2060 = OpLoad %6 %2059 + %2061 = OpAccessChain %21 %18 %19 %20 + %2062 = OpLoad %6 %2061 + %2063 = OpAccessChain %21 %18 %19 %20 + %2064 = OpLoad %6 %2063 + %2065 = OpAccessChain %21 %18 %19 %20 + %2066 = OpLoad %6 %2065 + %2067 = OpAccessChain %21 %18 %19 %20 + %2068 = OpLoad %6 %2067 + %2069 = OpAccessChain %21 %18 %19 %20 + %2070 = OpLoad %6 %2069 + %2071 = OpAccessChain %21 %18 %19 %20 + %2072 = OpLoad %6 %2071 + %2073 = OpAccessChain %21 %18 %19 %20 + %2074 = OpLoad %6 %2073 + %2075 = OpAccessChain %21 %18 %19 %20 + %2076 = OpLoad %6 %2075 + %2077 = OpAccessChain %21 %18 %19 %20 + %2078 = OpLoad %6 %2077 + %2079 = OpAccessChain %21 %18 %19 %20 + %2080 = OpLoad %6 %2079 + %2081 = OpAccessChain %21 %18 %19 %20 + %2082 = OpLoad %6 %2081 + %2083 = OpAccessChain %21 %18 %19 %20 + %2084 = OpLoad %6 %2083 + %2085 = OpAccessChain %21 %18 %19 %20 + %2086 = OpLoad %6 %2085 + %2087 = OpAccessChain %21 %18 %19 %20 + %2088 = OpLoad %6 %2087 + %2089 = OpAccessChain %21 %18 %19 %20 + %2090 = OpLoad %6 %2089 + %2091 = OpAccessChain %21 %18 %19 %20 + %2092 = OpLoad %6 %2091 + %2093 = OpCompositeConstruct %535 %1582 %1584 %1586 %1588 %1590 %1592 %1594 %1596 %1598 %1600 %1602 %1604 %1606 %1608 %1610 %1612 %1614 %1616 %1618 %1620 %1622 %1624 %1626 %1628 %1630 %1632 %1634 %1636 %1638 %1640 %1642 %1644 %1646 %1648 %1650 %1652 %1654 %1656 %1658 %1660 %1662 %1664 %1666 %1668 %1670 %1672 %1674 %1676 %1678 %1680 %1682 %1684 %1686 %1688 %1690 %1692 %1694 %1696 %1698 %1700 %1702 %1704 %1706 %1708 %1710 %1712 %1714 %1716 %1718 %1720 %1722 %1724 %1726 %1728 %1730 %1732 %1734 %1736 %1738 %1740 %1742 %1744 %1746 %1748 %1750 %1752 %1754 %1756 %1758 %1760 %1762 %1764 %1766 %1768 %1770 %1772 %1774 %1776 %1778 %1780 %1782 %1784 %1786 %1788 %1790 %1792 %1794 %1796 %1798 %1800 %1802 %1804 %1806 %1808 %1810 %1812 %1814 %1816 %1818 %1820 %1822 %1824 %1826 %1828 %1830 %1832 %1834 %1836 %1838 %1840 %1842 %1844 %1846 %1848 %1850 %1852 %1854 %1856 %1858 %1860 %1862 %1864 %1866 %1868 %1870 %1872 %1874 %1876 %1878 %1880 %1882 %1884 %1886 %1888 %1890 %1892 %1894 %1896 %1898 %1900 %1902 %1904 %1906 %1908 %1910 %1912 %1914 %1916 %1918 %1920 %1922 %1924 %1926 %1928 %1930 %1932 %1934 %1936 %1938 %1940 %1942 %1944 %1946 %1948 %1950 %1952 %1954 %1956 %1958 %1960 %1962 %1964 %1966 %1968 %1970 %1972 %1974 %1976 %1978 %1980 %1982 %1984 %1986 %1988 %1990 %1992 %1994 %1996 %1998 %2000 %2002 %2004 %2006 %2008 %2010 %2012 %2014 %2016 %2018 %2020 %2022 %2024 %2026 %2028 %2030 %2032 %2034 %2036 %2038 %2040 %2042 %2044 %2046 %2048 %2050 %2052 %2054 %2056 %2058 %2060 %2062 %2064 %2066 %2068 %2070 %2072 %2074 %2076 %2078 %2080 %2082 %2084 %2086 %2088 %2090 %2092 + %2094 = OpLoad %6 %9 + %2095 = OpExtInst %6 %1 SClamp %2094 %19 %538 + OpStore %2096 %2093 + %2097 = OpAccessChain %7 %2096 %2095 + %2098 = OpLoad %6 %2097 + %2099 = OpExtInst %6 %1 SClamp %543 %1580 %2098 + OpStore %12 %2099 + %2100 = OpLoad %6 %9 + %2102 = OpSLessThan %2101 %2100 %19 + OpSelectionMerge %2104 None + OpBranchConditional %2102 %2103 %2104 + %2103 = OpLabel + OpTerminateInvocation + %2104 = OpLabel + %2106 = OpLoad %6 %12 + OpReturnValue %2106 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 256 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-integer-constant-mod-variable-increased-condition-array-element.amber b/vulkan/amber/graphicsfuzz/cov-integer-constant-mod-variable-increased-condition-array-element.amber new file mode 100644 index 0000000..f52c5ce --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-integer-constant-mod-variable-increased-condition-array-element.amber @@ -0,0 +1,232 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [2, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int arr[10] = int[10](1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +# +# void main() +# { +# ivec2 v = ivec2(_int_1); +# int a = 1; +# +# // Always true. +# if(arr[_int_1] == _int_1) +# { +# a++; +# } +# +# // Always true. +# if(57678 % a == _int_0) +# { +# // arr[2] becomes 2. +# arr[v.x + v.y] = _int_2; +# } +# +# // Always true. +# if(arr[_int_2] == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 92 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %73 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %16 "v" + OpName %19 "buf0" + OpMemberName %19 0 "_GLF_uniform_int_values" + OpName %21 "" + OpName %28 "a" + OpName %73 "_GLF_color" + OpDecorate %18 ArrayStride 16 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 0 + OpDecorate %73 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Private %9 + %11 = OpVariable %10 Private + %12 = OpConstant %6 1 + %13 = OpConstantComposite %9 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 + %14 = OpTypeVector %6 2 + %15 = OpTypePointer Function %14 + %17 = OpConstant %7 3 + %18 = OpTypeArray %6 %17 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpConstant %6 0 + %23 = OpTypePointer Uniform %6 + %27 = OpTypePointer Function %6 + %31 = OpTypePointer Private %6 + %36 = OpTypeBool + %42 = OpConstant %6 57678 + %45 = OpConstant %6 2 + %51 = OpConstant %7 0 + %54 = OpConstant %7 1 + %70 = OpTypeFloat 32 + %71 = OpTypeVector %70 4 + %72 = OpTypePointer Output %71 + %73 = OpVariable %72 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %16 = OpVariable %15 Function + %28 = OpVariable %27 Function + OpStore %11 %13 + %24 = OpAccessChain %23 %21 %22 %12 + %25 = OpLoad %6 %24 + %26 = OpCompositeConstruct %14 %25 %25 + OpStore %16 %26 + OpStore %28 %12 + %29 = OpAccessChain %23 %21 %22 %12 + %30 = OpLoad %6 %29 + %32 = OpAccessChain %31 %11 %30 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %23 %21 %22 %12 + %35 = OpLoad %6 %34 + %37 = OpIEqual %36 %33 %35 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + %40 = OpLoad %6 %28 + %41 = OpIAdd %6 %40 %12 + OpStore %28 %41 + OpBranch %39 + %39 = OpLabel + %43 = OpLoad %6 %28 + %44 = OpSMod %6 %42 %43 + %46 = OpAccessChain %23 %21 %22 %45 + %47 = OpLoad %6 %46 + %48 = OpIEqual %36 %44 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %50 + %49 = OpLabel + %52 = OpAccessChain %27 %16 %51 + %53 = OpLoad %6 %52 + %55 = OpAccessChain %27 %16 %54 + %56 = OpLoad %6 %55 + %57 = OpIAdd %6 %53 %56 + %58 = OpAccessChain %23 %21 %22 %22 + %59 = OpLoad %6 %58 + %60 = OpAccessChain %31 %11 %57 + OpStore %60 %59 + OpBranch %50 + %50 = OpLabel + %61 = OpAccessChain %23 %21 %22 %22 + %62 = OpLoad %6 %61 + %63 = OpAccessChain %31 %11 %62 + %64 = OpLoad %6 %63 + %65 = OpAccessChain %23 %21 %22 %22 + %66 = OpLoad %6 %65 + %67 = OpIEqual %36 %64 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %87 + %68 = OpLabel + %74 = OpAccessChain %23 %21 %22 %12 + %75 = OpLoad %6 %74 + %76 = OpConvertSToF %70 %75 + %77 = OpAccessChain %23 %21 %22 %45 + %78 = OpLoad %6 %77 + %79 = OpConvertSToF %70 %78 + %80 = OpAccessChain %23 %21 %22 %45 + %81 = OpLoad %6 %80 + %82 = OpConvertSToF %70 %81 + %83 = OpAccessChain %23 %21 %22 %12 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %70 %84 + %86 = OpCompositeConstruct %71 %76 %79 %82 %85 + OpStore %73 %86 + OpBranch %69 + %87 = OpLabel + %88 = OpAccessChain %23 %21 %22 %45 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %70 %89 + %91 = OpCompositeConstruct %71 %90 %90 %90 %90 + OpStore %73 %91 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-integer-minus-one-increased-before-indexing-array.amber b/vulkan/amber/graphicsfuzz/cov-integer-minus-one-increased-before-indexing-array.amber new file mode 100644 index 0000000..1551d77 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-integer-minus-one-increased-before-indexing-array.amber @@ -0,0 +1,597 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_8 _GLF_uniform_int_values[0] +# #define _int_9 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _int_3 _GLF_uniform_int_values[4] +# #define _int_4 _GLF_uniform_int_values[5] +# #define _int_5 _GLF_uniform_int_values[6] +# #define _int_6 _GLF_uniform_int_values[7] +# #define _int_7 _GLF_uniform_int_values[8] +# #define _int_0 _GLF_uniform_int_values[9] +# #define _int_10 _GLF_uniform_int_values[10] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# // Contents of _GLF_uniform_int_values: [8, 9, 1, 2, 3, 4, 5, 6, 7, 0, 10] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[11]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# // Contents of zero: 0.0 +# layout(push_constant) uniform buf_push +# { +# float zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // This function is called once with x = 0. +# int func(int x) +# { +# int i = _int_1; +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# +# // Always true. +# if(x <= _int_1) +# { +# // Iterated once. +# for(int k = int(zero); k != _int_1; k ++) +# { +# // Always true. +# if(gl_FragCoord.y >= 0.0) +# { +# i++; +# } +# } +# +# // Sets global loop count to global loop bound. +# for(int k = int(zero); k < _int_1 && _GLF_global_loop_count < _GLF_global_loop_bound; ) +# { +# _GLF_global_loop_count++; +# } +# } +# } +# +# // Returns 2. +# return i; +# } +# +# void main() +# { +# int a = _int_1, b = _int_1, c = -_int_1; +# int arr[10] = int[10](_int_0, _int_1, _int_2, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9); +# +# // Always true. +# if(gl_FragCoord.y >= 0.0) +# { +# // c becomes zero. +# arr[++c] = _int_1; +# } +# +# // Iterated once. +# while(c >= _int_0 && _GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# +# // Always true. +# if(gl_FragCoord.y > _float_0_0) +# { +# // a becomes 0 +# a = arr[c]; +# } +# +# // Always true. +# if(zero == _float_0_0) +# { +# b = arr[c]; +# } +# +# if(a < _int_1) +# { +# // arr[0] becomes one and c becomes one. +# arr[++c] = _int_1; +# } +# +# // Calling the function makes global loop count to reach the global loop bound. The function returns 2 making the condition false. +# if(func(a) < _int_1) +# { +# arr[++c] = b; +# } +# } +# +# // Check the array against reference values, and set output color to black if the check fails. +# int ref[10] = int[10](_int_1, _int_1, _int_2, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9); +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# for(int i = _int_0; i < _int_10; i ++) +# { +# if(arr[i] != ref[i]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 276 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %64 %235 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func(i1;" + OpName %9 "x" + OpName %13 "_GLF_global_loop_count" + OpName %15 "i" + OpName %19 "buf1" + OpMemberName %19 0 "_GLF_uniform_int_values" + OpName %21 "" + OpName %44 "k" + OpName %46 "buf_push" + OpMemberName %46 0 "zero" + OpName %48 "" + OpName %64 "gl_FragCoord" + OpName %77 "k" + OpName %98 "a" + OpName %101 "b" + OpName %104 "c" + OpName %111 "arr" + OpName %167 "buf0" + OpMemberName %167 0 "_GLF_uniform_float_values" + OpName %169 "" + OpName %200 "param" + OpName %212 "ref" + OpName %235 "_GLF_color" + OpName %249 "i" + OpDecorate %18 ArrayStride 16 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 1 + OpMemberDecorate %46 0 Offset 0 + OpDecorate %46 Block + OpDecorate %64 BuiltIn FragCoord + OpDecorate %166 ArrayStride 16 + OpMemberDecorate %167 0 Offset 0 + OpDecorate %167 Block + OpDecorate %169 DescriptorSet 0 + OpDecorate %169 Binding 0 + OpDecorate %235 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %12 = OpTypePointer Private %6 + %13 = OpVariable %12 Private + %14 = OpConstant %6 0 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 11 + %18 = OpTypeArray %6 %17 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpConstant %6 2 + %23 = OpTypePointer Uniform %6 + %32 = OpConstant %6 10 + %33 = OpTypeBool + %36 = OpConstant %6 1 + %45 = OpTypeFloat 32 + %46 = OpTypeStruct %45 + %47 = OpTypePointer PushConstant %46 + %48 = OpVariable %47 PushConstant + %49 = OpTypePointer PushConstant %45 + %62 = OpTypeVector %45 4 + %63 = OpTypePointer Input %62 + %64 = OpVariable %63 Input + %65 = OpConstant %16 1 + %66 = OpTypePointer Input %45 + %69 = OpConstant %45 0 + %108 = OpConstant %16 10 + %109 = OpTypeArray %6 %108 + %110 = OpTypePointer Function %109 + %112 = OpConstant %6 9 + %117 = OpConstant %6 3 + %120 = OpConstant %6 4 + %123 = OpConstant %6 5 + %126 = OpConstant %6 6 + %129 = OpConstant %6 7 + %132 = OpConstant %6 8 + %166 = OpTypeArray %45 %65 + %167 = OpTypeStruct %166 + %168 = OpTypePointer Uniform %167 + %169 = OpVariable %168 Uniform + %170 = OpTypePointer Uniform %45 + %234 = OpTypePointer Output %62 + %235 = OpVariable %234 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %98 = OpVariable %7 Function + %101 = OpVariable %7 Function + %104 = OpVariable %7 Function + %111 = OpVariable %110 Function + %200 = OpVariable %7 Function + %212 = OpVariable %110 Function + %249 = OpVariable %7 Function + OpStore %13 %14 + %99 = OpAccessChain %23 %21 %14 %22 + %100 = OpLoad %6 %99 + OpStore %98 %100 + %102 = OpAccessChain %23 %21 %14 %22 + %103 = OpLoad %6 %102 + OpStore %101 %103 + %105 = OpAccessChain %23 %21 %14 %22 + %106 = OpLoad %6 %105 + %107 = OpSNegate %6 %106 + OpStore %104 %107 + %113 = OpAccessChain %23 %21 %14 %112 + %114 = OpLoad %6 %113 + %115 = OpAccessChain %23 %21 %14 %22 + %116 = OpLoad %6 %115 + %118 = OpAccessChain %23 %21 %14 %117 + %119 = OpLoad %6 %118 + %121 = OpAccessChain %23 %21 %14 %120 + %122 = OpLoad %6 %121 + %124 = OpAccessChain %23 %21 %14 %123 + %125 = OpLoad %6 %124 + %127 = OpAccessChain %23 %21 %14 %126 + %128 = OpLoad %6 %127 + %130 = OpAccessChain %23 %21 %14 %129 + %131 = OpLoad %6 %130 + %133 = OpAccessChain %23 %21 %14 %132 + %134 = OpLoad %6 %133 + %135 = OpAccessChain %23 %21 %14 %14 + %136 = OpLoad %6 %135 + %137 = OpAccessChain %23 %21 %14 %36 + %138 = OpLoad %6 %137 + %139 = OpCompositeConstruct %109 %114 %116 %119 %122 %125 %128 %131 %134 %136 %138 + OpStore %111 %139 + %140 = OpAccessChain %66 %64 %65 + %141 = OpLoad %45 %140 + %142 = OpFOrdGreaterThanEqual %33 %141 %69 + OpSelectionMerge %144 None + OpBranchConditional %142 %143 %144 + %143 = OpLabel + %145 = OpLoad %6 %104 + %146 = OpIAdd %6 %145 %36 + OpStore %104 %146 + %147 = OpAccessChain %23 %21 %14 %22 + %148 = OpLoad %6 %147 + %149 = OpAccessChain %7 %111 %146 + OpStore %149 %148 + OpBranch %144 + %144 = OpLabel + OpBranch %150 + %150 = OpLabel + OpLoopMerge %152 %153 None + OpBranch %154 + %154 = OpLabel + %155 = OpLoad %6 %104 + %156 = OpAccessChain %23 %21 %14 %112 + %157 = OpLoad %6 %156 + %158 = OpSGreaterThanEqual %33 %155 %157 + %159 = OpLoad %6 %13 + %160 = OpSLessThan %33 %159 %32 + %161 = OpLogicalAnd %33 %158 %160 + OpBranchConditional %161 %151 %152 + %151 = OpLabel + %162 = OpLoad %6 %13 + %163 = OpIAdd %6 %162 %36 + OpStore %13 %163 + %164 = OpAccessChain %66 %64 %65 + %165 = OpLoad %45 %164 + %171 = OpAccessChain %170 %169 %14 %14 + %172 = OpLoad %45 %171 + %173 = OpFOrdGreaterThan %33 %165 %172 + OpSelectionMerge %175 None + OpBranchConditional %173 %174 %175 + %174 = OpLabel + %176 = OpLoad %6 %104 + %177 = OpAccessChain %7 %111 %176 + %178 = OpLoad %6 %177 + OpStore %98 %178 + OpBranch %175 + %175 = OpLabel + %179 = OpAccessChain %49 %48 %14 + %180 = OpLoad %45 %179 + %181 = OpAccessChain %170 %169 %14 %14 + %182 = OpLoad %45 %181 + %183 = OpFOrdEqual %33 %180 %182 + OpSelectionMerge %185 None + OpBranchConditional %183 %184 %185 + %184 = OpLabel + %186 = OpLoad %6 %104 + %187 = OpAccessChain %7 %111 %186 + %188 = OpLoad %6 %187 + OpStore %101 %188 + OpBranch %185 + %185 = OpLabel + %189 = OpLoad %6 %98 + %190 = OpAccessChain %23 %21 %14 %22 + %191 = OpLoad %6 %190 + %192 = OpSLessThan %33 %189 %191 + OpSelectionMerge %194 None + OpBranchConditional %192 %193 %194 + %193 = OpLabel + %195 = OpLoad %6 %104 + %196 = OpIAdd %6 %195 %36 + OpStore %104 %196 + %197 = OpAccessChain %23 %21 %14 %22 + %198 = OpLoad %6 %197 + %199 = OpAccessChain %7 %111 %196 + OpStore %199 %198 + OpBranch %194 + %194 = OpLabel + %201 = OpLoad %6 %98 + OpStore %200 %201 + %202 = OpFunctionCall %6 %10 %200 + %203 = OpAccessChain %23 %21 %14 %22 + %204 = OpLoad %6 %203 + %205 = OpSLessThan %33 %202 %204 + OpSelectionMerge %207 None + OpBranchConditional %205 %206 %207 + %206 = OpLabel + %208 = OpLoad %6 %104 + %209 = OpIAdd %6 %208 %36 + OpStore %104 %209 + %210 = OpLoad %6 %101 + %211 = OpAccessChain %7 %111 %209 + OpStore %211 %210 + OpBranch %207 + %207 = OpLabel + OpBranch %153 + %153 = OpLabel + OpBranch %150 + %152 = OpLabel + %213 = OpAccessChain %23 %21 %14 %22 + %214 = OpLoad %6 %213 + %215 = OpAccessChain %23 %21 %14 %22 + %216 = OpLoad %6 %215 + %217 = OpAccessChain %23 %21 %14 %117 + %218 = OpLoad %6 %217 + %219 = OpAccessChain %23 %21 %14 %120 + %220 = OpLoad %6 %219 + %221 = OpAccessChain %23 %21 %14 %123 + %222 = OpLoad %6 %221 + %223 = OpAccessChain %23 %21 %14 %126 + %224 = OpLoad %6 %223 + %225 = OpAccessChain %23 %21 %14 %129 + %226 = OpLoad %6 %225 + %227 = OpAccessChain %23 %21 %14 %132 + %228 = OpLoad %6 %227 + %229 = OpAccessChain %23 %21 %14 %14 + %230 = OpLoad %6 %229 + %231 = OpAccessChain %23 %21 %14 %36 + %232 = OpLoad %6 %231 + %233 = OpCompositeConstruct %109 %214 %216 %218 %220 %222 %224 %226 %228 %230 %232 + OpStore %212 %233 + %236 = OpAccessChain %23 %21 %14 %22 + %237 = OpLoad %6 %236 + %238 = OpConvertSToF %45 %237 + %239 = OpAccessChain %23 %21 %14 %112 + %240 = OpLoad %6 %239 + %241 = OpConvertSToF %45 %240 + %242 = OpAccessChain %23 %21 %14 %112 + %243 = OpLoad %6 %242 + %244 = OpConvertSToF %45 %243 + %245 = OpAccessChain %23 %21 %14 %22 + %246 = OpLoad %6 %245 + %247 = OpConvertSToF %45 %246 + %248 = OpCompositeConstruct %62 %238 %241 %244 %247 + OpStore %235 %248 + %250 = OpAccessChain %23 %21 %14 %112 + %251 = OpLoad %6 %250 + OpStore %249 %251 + OpBranch %252 + %252 = OpLabel + OpLoopMerge %254 %255 None + OpBranch %256 + %256 = OpLabel + %257 = OpLoad %6 %249 + %258 = OpAccessChain %23 %21 %14 %32 + %259 = OpLoad %6 %258 + %260 = OpSLessThan %33 %257 %259 + OpBranchConditional %260 %253 %254 + %253 = OpLabel + %261 = OpLoad %6 %249 + %262 = OpAccessChain %7 %111 %261 + %263 = OpLoad %6 %262 + %264 = OpLoad %6 %249 + %265 = OpAccessChain %7 %212 %264 + %266 = OpLoad %6 %265 + %267 = OpINotEqual %33 %263 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %269 + %268 = OpLabel + %270 = OpAccessChain %23 %21 %14 %112 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %45 %271 + %273 = OpCompositeConstruct %62 %272 %272 %272 %272 + OpStore %235 %273 + OpBranch %269 + %269 = OpLabel + OpBranch %255 + %255 = OpLabel + %274 = OpLoad %6 %249 + %275 = OpIAdd %6 %274 %36 + OpStore %249 %275 + OpBranch %252 + %254 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %15 = OpVariable %7 Function + %44 = OpVariable %7 Function + %77 = OpVariable %7 Function + %24 = OpAccessChain %23 %21 %14 %22 + %25 = OpLoad %6 %24 + OpStore %15 %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %6 %13 + %34 = OpSLessThan %33 %31 %32 + OpBranchConditional %34 %27 %28 + %27 = OpLabel + %35 = OpLoad %6 %13 + %37 = OpIAdd %6 %35 %36 + OpStore %13 %37 + %38 = OpLoad %6 %9 + %39 = OpAccessChain %23 %21 %14 %22 + %40 = OpLoad %6 %39 + %41 = OpSLessThanEqual %33 %38 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %43 + %42 = OpLabel + %50 = OpAccessChain %49 %48 %14 + %51 = OpLoad %45 %50 + %52 = OpConvertFToS %6 %51 + OpStore %44 %52 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %6 %44 + %59 = OpAccessChain %23 %21 %14 %22 + %60 = OpLoad %6 %59 + %61 = OpINotEqual %33 %58 %60 + OpBranchConditional %61 %54 %55 + %54 = OpLabel + %67 = OpAccessChain %66 %64 %65 + %68 = OpLoad %45 %67 + %70 = OpFOrdGreaterThanEqual %33 %68 %69 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %72 + %71 = OpLabel + %73 = OpLoad %6 %15 + %74 = OpIAdd %6 %73 %36 + OpStore %15 %74 + OpBranch %72 + %72 = OpLabel + OpBranch %56 + %56 = OpLabel + %75 = OpLoad %6 %44 + %76 = OpIAdd %6 %75 %36 + OpStore %44 %76 + OpBranch %53 + %55 = OpLabel + %78 = OpAccessChain %49 %48 %14 + %79 = OpLoad %45 %78 + %80 = OpConvertFToS %6 %79 + OpStore %77 %80 + OpBranch %81 + %81 = OpLabel + OpLoopMerge %83 %84 None + OpBranch %85 + %85 = OpLabel + %86 = OpLoad %6 %77 + %87 = OpAccessChain %23 %21 %14 %22 + %88 = OpLoad %6 %87 + %89 = OpSLessThan %33 %86 %88 + %90 = OpLoad %6 %13 + %91 = OpSLessThan %33 %90 %32 + %92 = OpLogicalAnd %33 %89 %91 + OpBranchConditional %92 %82 %83 + %82 = OpLabel + %93 = OpLoad %6 %13 + %94 = OpIAdd %6 %93 %36 + OpStore %13 %94 + OpBranch %84 + %84 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %43 + %43 = OpLabel + OpBranch %29 + %29 = OpLabel + OpBranch %26 + %28 = OpLabel + %95 = OpLoad %6 %15 + OpReturnValue %95 + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 8 9 1 2 3 4 5 6 7 0 10 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-integer-modulo-negative.amber b/vulkan/amber/graphicsfuzz/cov-integer-modulo-negative.amber new file mode 100644 index 0000000..2eb8e1a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-integer-modulo-negative.amber @@ -0,0 +1,204 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific instruction combining code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [10, 0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int count = _int_0; +# for (int i = _int_0; i < _int_10; i++) +# { +# // Always false. +# if (count % -93448 > _int_0) +# { +# count++; +# } +# } +# if (count == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 74 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %54 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "count" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %54 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %54 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %31 = OpTypeBool + %34 = OpConstant %6 -93448 + %51 = OpTypeFloat 32 + %52 = OpTypeVector %51 4 + %53 = OpTypePointer Output %52 + %54 = OpVariable %53 Output + %55 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %21 = OpAccessChain %17 %14 %15 %16 + %22 = OpLoad %6 %21 + OpStore %20 %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %6 %20 + %29 = OpAccessChain %17 %14 %15 %15 + %30 = OpLoad %6 %29 + %32 = OpSLessThan %31 %28 %30 + OpBranchConditional %32 %24 %25 + %24 = OpLabel + %33 = OpLoad %6 %8 + %35 = OpSMod %6 %33 %34 + %36 = OpAccessChain %17 %14 %15 %16 + %37 = OpLoad %6 %36 + %38 = OpSGreaterThan %31 %35 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + %41 = OpLoad %6 %8 + %42 = OpIAdd %6 %41 %16 + OpStore %8 %42 + OpBranch %40 + %40 = OpLabel + OpBranch %26 + %26 = OpLabel + %43 = OpLoad %6 %20 + %44 = OpIAdd %6 %43 %16 + OpStore %20 %44 + OpBranch %23 + %25 = OpLabel + %45 = OpLoad %6 %8 + %46 = OpAccessChain %17 %14 %15 %16 + %47 = OpLoad %6 %46 + %48 = OpIEqual %31 %45 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %69 + %49 = OpLabel + %56 = OpAccessChain %17 %14 %15 %55 + %57 = OpLoad %6 %56 + %58 = OpConvertSToF %51 %57 + %59 = OpAccessChain %17 %14 %15 %16 + %60 = OpLoad %6 %59 + %61 = OpConvertSToF %51 %60 + %62 = OpAccessChain %17 %14 %15 %16 + %63 = OpLoad %6 %62 + %64 = OpConvertSToF %51 %63 + %65 = OpAccessChain %17 %14 %15 %55 + %66 = OpLoad %6 %65 + %67 = OpConvertSToF %51 %66 + %68 = OpCompositeConstruct %52 %58 %61 %64 %67 + OpStore %54 %68 + OpBranch %50 + %69 = OpLabel + %70 = OpAccessChain %17 %14 %15 %16 + %71 = OpLoad %6 %70 + %72 = OpConvertSToF %51 %71 + %73 = OpCompositeConstruct %52 %72 %72 %72 %72 + OpStore %54 %73 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-integer-variable-or-with-inversion.amber b/vulkan/amber/graphicsfuzz/cov-integer-variable-or-with-inversion.amber new file mode 100644 index 0000000..fb03ab4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-integer-variable-or-with-inversion.amber @@ -0,0 +1,183 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = (int(gl_FragCoord.y) & 1) != 0 ? 0 : ~ 0; +# +# // b becomes one: regardless of what a is, (a | ~a) always produces an integer with all bits on. +# int b = _int_1 & (a | ~a); +# +# // Always true. +# if(b == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 66 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %47 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "gl_FragCoord" + OpName %26 "b" + OpName %29 "buf0" + OpMemberName %29 0 "_GLF_uniform_int_values" + OpName %31 "" + OpName %47 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %28 ArrayStride 16 + OpMemberDecorate %29 0 Offset 0 + OpDecorate %29 Block + OpDecorate %31 DescriptorSet 0 + OpDecorate %31 Binding 0 + OpDecorate %47 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 1 + %15 = OpTypePointer Input %9 + %19 = OpConstant %6 1 + %21 = OpConstant %6 0 + %22 = OpTypeBool + %24 = OpConstant %6 -1 + %27 = OpConstant %13 2 + %28 = OpTypeArray %6 %27 + %29 = OpTypeStruct %28 + %30 = OpTypePointer Uniform %29 + %31 = OpVariable %30 Uniform + %32 = OpTypePointer Uniform %6 + %46 = OpTypePointer Output %10 + %47 = OpVariable %46 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %26 = OpVariable %7 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %18 = OpConvertFToS %6 %17 + %20 = OpBitwiseAnd %6 %18 %19 + %23 = OpINotEqual %22 %20 %21 + %25 = OpSelect %6 %23 %21 %24 + OpStore %8 %25 + %33 = OpAccessChain %32 %31 %21 %21 + %34 = OpLoad %6 %33 + %35 = OpLoad %6 %8 + %36 = OpLoad %6 %8 + %37 = OpNot %6 %36 + %38 = OpBitwiseOr %6 %35 %37 + %39 = OpBitwiseAnd %6 %34 %38 + OpStore %26 %39 + %40 = OpLoad %6 %26 + %41 = OpAccessChain %32 %31 %21 %21 + %42 = OpLoad %6 %41 + %43 = OpIEqual %22 %40 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %61 + %44 = OpLabel + %48 = OpAccessChain %32 %31 %21 %21 + %49 = OpLoad %6 %48 + %50 = OpConvertSToF %9 %49 + %51 = OpAccessChain %32 %31 %21 %19 + %52 = OpLoad %6 %51 + %53 = OpConvertSToF %9 %52 + %54 = OpAccessChain %32 %31 %21 %19 + %55 = OpLoad %6 %54 + %56 = OpConvertSToF %9 %55 + %57 = OpAccessChain %32 %31 %21 %21 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %9 %58 + %60 = OpCompositeConstruct %10 %50 %53 %56 %59 + OpStore %47 %60 + OpBranch %45 + %61 = OpLabel + %62 = OpAccessChain %32 %31 %21 %19 + %63 = OpLoad %6 %62 + %64 = OpConvertSToF %9 %63 + %65 = OpCompositeConstruct %10 %64 %64 %64 %64 + OpStore %47 %65 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-intervalmap-set-stop.amber b/vulkan/amber/graphicsfuzz/cov-intervalmap-set-stop.amber new file mode 100644 index 0000000..2c84ddd --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-intervalmap-set-stop.amber @@ -0,0 +1,264 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific interval map code path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 func() +# { +# vec2 v = vec2(1); +# int i = 0; +# for(int k = 0; k < 2; k++) +# { +# if(v.y + 1.0 > 4.0) // Always false. +# break; +# +# v.y = 1.0; +# i++; +# } +# +# if(i < 10) // Always true. +# return vec3(1, 0, 0); +# else +# return vec3(0, 0, 1); +# } +# +# void main() +# { +# vec3 data[2]; +# +# // Writes data[0] = (1, 0, 0). +# for(int j = 0; j < 1; j++) +# data[j] = func(); +# +# // Writes data[1] = (1, 0, 0). +# for(int j = 0; j < 1; j++) +# data[4*j + 1] = func(); +# +# if (data[0] == vec3(1, 0, 0) && data[1] == vec3(1, 0, 0)) // Always true. +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 113 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %109 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "func(" + OpName %13 "v" + OpName %18 "i" + OpName %20 "k" + OpName %59 "j" + OpName %70 "data" + OpName %77 "j" + OpName %109 "_GLF_color" + OpDecorate %109 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeFunction %7 + %11 = OpTypeVector %6 2 + %12 = OpTypePointer Function %11 + %14 = OpConstant %6 1 + %15 = OpConstantComposite %11 %14 %14 + %16 = OpTypeInt 32 1 + %17 = OpTypePointer Function %16 + %19 = OpConstant %16 0 + %27 = OpConstant %16 2 + %28 = OpTypeBool + %30 = OpTypeInt 32 0 + %31 = OpConstant %30 1 + %32 = OpTypePointer Function %6 + %36 = OpConstant %6 4 + %43 = OpConstant %16 1 + %48 = OpConstant %16 10 + %52 = OpConstant %6 0 + %53 = OpConstantComposite %7 %14 %52 %52 + %56 = OpConstantComposite %7 %52 %52 %14 + %67 = OpConstant %30 2 + %68 = OpTypeArray %7 %67 + %69 = OpTypePointer Function %68 + %73 = OpTypePointer Function %7 + %85 = OpConstant %16 4 + %95 = OpTypeVector %28 3 + %107 = OpTypeVector %6 4 + %108 = OpTypePointer Output %107 + %109 = OpVariable %108 Output + %110 = OpConstantComposite %107 %14 %52 %52 %14 + %112 = OpConstantComposite %107 %52 %52 %52 %52 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %59 = OpVariable %17 Function + %70 = OpVariable %69 Function + %77 = OpVariable %17 Function + OpStore %59 %19 + OpBranch %60 + %60 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %16 %59 + %66 = OpSLessThan %28 %65 %43 + OpBranchConditional %66 %61 %62 + %61 = OpLabel + %71 = OpLoad %16 %59 + %72 = OpFunctionCall %7 %9 + %74 = OpAccessChain %73 %70 %71 + OpStore %74 %72 + OpBranch %63 + %63 = OpLabel + %75 = OpLoad %16 %59 + %76 = OpIAdd %16 %75 %43 + OpStore %59 %76 + OpBranch %60 + %62 = OpLabel + OpStore %77 %19 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %16 %77 + %84 = OpSLessThan %28 %83 %43 + OpBranchConditional %84 %79 %80 + %79 = OpLabel + %86 = OpLoad %16 %77 + %87 = OpIMul %16 %85 %86 + %88 = OpIAdd %16 %87 %43 + %89 = OpFunctionCall %7 %9 + %90 = OpAccessChain %73 %70 %88 + OpStore %90 %89 + OpBranch %81 + %81 = OpLabel + %91 = OpLoad %16 %77 + %92 = OpIAdd %16 %91 %43 + OpStore %77 %92 + OpBranch %78 + %80 = OpLabel + %93 = OpAccessChain %73 %70 %19 + %94 = OpLoad %7 %93 + %96 = OpFOrdEqual %95 %94 %53 + %97 = OpAll %28 %96 + OpSelectionMerge %99 None + OpBranchConditional %97 %98 %99 + %98 = OpLabel + %100 = OpAccessChain %73 %70 %43 + %101 = OpLoad %7 %100 + %102 = OpFOrdEqual %95 %101 %53 + %103 = OpAll %28 %102 + OpBranch %99 + %99 = OpLabel + %104 = OpPhi %28 %97 %80 %103 %98 + OpSelectionMerge %106 None + OpBranchConditional %104 %105 %111 + %105 = OpLabel + OpStore %109 %110 + OpBranch %106 + %111 = OpLabel + OpStore %109 %112 + OpBranch %106 + %106 = OpLabel + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %13 = OpVariable %12 Function + %18 = OpVariable %17 Function + %20 = OpVariable %17 Function + OpStore %13 %15 + OpStore %18 %19 + OpStore %20 %19 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %16 %20 + %29 = OpSLessThan %28 %26 %27 + OpBranchConditional %29 %22 %23 + %22 = OpLabel + %33 = OpAccessChain %32 %13 %31 + %34 = OpLoad %6 %33 + %35 = OpFAdd %6 %34 %14 + %37 = OpFOrdGreaterThan %28 %35 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + OpBranch %23 + %39 = OpLabel + %41 = OpAccessChain %32 %13 %31 + OpStore %41 %14 + %42 = OpLoad %16 %18 + %44 = OpIAdd %16 %42 %43 + OpStore %18 %44 + OpBranch %24 + %24 = OpLabel + %45 = OpLoad %16 %20 + %46 = OpIAdd %16 %45 %43 + OpStore %20 %46 + OpBranch %21 + %23 = OpLabel + %47 = OpLoad %16 %18 + %49 = OpSLessThan %28 %47 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %55 + %50 = OpLabel + OpReturnValue %53 + %55 = OpLabel + OpReturnValue %56 + %51 = OpLabel + OpUnreachable + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-ir-builder-constant-fold-inst-combine-calls-value-tracking-findmsb-incr-if.amber b/vulkan/amber/graphicsfuzz/cov-ir-builder-constant-fold-inst-combine-calls-value-tracking-findmsb-incr-if.amber new file mode 100644 index 0000000..8fa06bc --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-ir-builder-constant-fold-inst-combine-calls-value-tracking-findmsb-incr-if.amber @@ -0,0 +1,250 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers IR builder, constant fold, inst combine calls and value tracking code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [3, 1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 0; +# +# // Always false. +# if (mix(vec2(1), vec2(2), bvec2(true, _int_1 == _int_2)) == vec2(1)) +# { +# for (int i = _int_1; findMSB(i) < 5; i++) +# { +# a++; +# } +# } +# else +# { +# for (int i = _int_1; findMSB(i) < _int_3; i++) +# { +# a++; +# } +# } +# if (a == 7) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 100 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %80 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %21 "buf0" + OpMemberName %21 0 "_GLF_uniform_int_values" + OpName %23 "" + OpName %39 "i" + OpName %56 "i" + OpName %80 "_GLF_color" + OpDecorate %20 ArrayStride 16 + OpMemberDecorate %21 0 Offset 0 + OpDecorate %21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 0 + OpDecorate %80 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 2 + %12 = OpConstant %10 1 + %13 = OpConstantComposite %11 %12 %12 + %14 = OpConstant %10 2 + %15 = OpConstantComposite %11 %14 %14 + %16 = OpTypeBool + %17 = OpConstantTrue %16 + %18 = OpTypeInt 32 0 + %19 = OpConstant %18 4 + %20 = OpTypeArray %6 %19 + %21 = OpTypeStruct %20 + %22 = OpTypePointer Uniform %21 + %23 = OpVariable %22 Uniform + %24 = OpConstant %6 1 + %25 = OpTypePointer Uniform %6 + %28 = OpConstant %6 3 + %32 = OpTypeVector %16 2 + %49 = OpConstant %6 5 + %74 = OpConstant %6 7 + %78 = OpTypeVector %10 4 + %79 = OpTypePointer Output %78 + %80 = OpVariable %79 Output + %84 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %39 = OpVariable %7 Function + %56 = OpVariable %7 Function + OpStore %8 %9 + %26 = OpAccessChain %25 %23 %9 %24 + %27 = OpLoad %6 %26 + %29 = OpAccessChain %25 %23 %9 %28 + %30 = OpLoad %6 %29 + %31 = OpIEqual %16 %27 %30 + %33 = OpCompositeConstruct %32 %17 %31 + %34 = OpSelect %11 %33 %15 %13 + %35 = OpFOrdEqual %32 %34 %13 + %36 = OpAll %16 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %55 + %37 = OpLabel + %40 = OpAccessChain %25 %23 %9 %24 + %41 = OpLoad %6 %40 + OpStore %39 %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %47 = OpLoad %6 %39 + %48 = OpExtInst %6 %1 FindSMsb %47 + %50 = OpSLessThan %16 %48 %49 + OpBranchConditional %50 %43 %44 + %43 = OpLabel + %51 = OpLoad %6 %8 + %52 = OpIAdd %6 %51 %24 + OpStore %8 %52 + OpBranch %45 + %45 = OpLabel + %53 = OpLoad %6 %39 + %54 = OpIAdd %6 %53 %24 + OpStore %39 %54 + OpBranch %42 + %44 = OpLabel + OpBranch %38 + %55 = OpLabel + %57 = OpAccessChain %25 %23 %9 %24 + %58 = OpLoad %6 %57 + OpStore %56 %58 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + %64 = OpLoad %6 %56 + %65 = OpExtInst %6 %1 FindSMsb %64 + %66 = OpAccessChain %25 %23 %9 %9 + %67 = OpLoad %6 %66 + %68 = OpSLessThan %16 %65 %67 + OpBranchConditional %68 %60 %61 + %60 = OpLabel + %69 = OpLoad %6 %8 + %70 = OpIAdd %6 %69 %24 + OpStore %8 %70 + OpBranch %62 + %62 = OpLabel + %71 = OpLoad %6 %56 + %72 = OpIAdd %6 %71 %24 + OpStore %56 %72 + OpBranch %59 + %61 = OpLabel + OpBranch %38 + %38 = OpLabel + %73 = OpLoad %6 %8 + %75 = OpIEqual %16 %73 %74 + OpSelectionMerge %77 None + OpBranchConditional %75 %76 %95 + %76 = OpLabel + %81 = OpAccessChain %25 %23 %9 %24 + %82 = OpLoad %6 %81 + %83 = OpConvertSToF %10 %82 + %85 = OpAccessChain %25 %23 %9 %84 + %86 = OpLoad %6 %85 + %87 = OpConvertSToF %10 %86 + %88 = OpAccessChain %25 %23 %9 %84 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %10 %89 + %91 = OpAccessChain %25 %23 %9 %24 + %92 = OpLoad %6 %91 + %93 = OpConvertSToF %10 %92 + %94 = OpCompositeConstruct %78 %83 %87 %90 %93 + OpStore %80 %94 + OpBranch %77 + %95 = OpLabel + %96 = OpAccessChain %25 %23 %9 %84 + %97 = OpLoad %6 %96 + %98 = OpConvertSToF %10 %97 + %99 = OpCompositeConstruct %78 %98 %98 %98 %98 + OpStore %80 %99 + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-irbuilder-matrix-cell-uniform.amber b/vulkan/amber/graphicsfuzz/cov-irbuilder-matrix-cell-uniform.amber new file mode 100644 index 0000000..8436f2b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-irbuilder-matrix-cell-uniform.amber @@ -0,0 +1,141 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific IR builder path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void main() +# { +# mat4 m = mat4(1.0, 1.0, 0.0, 1.0, +# 0.0, 0.0, 1.0, 1.0, +# 0.0, 0.0, one, 0.0, +# 0.0, 0.0, 0.0, 0.0); +# +# if(abs(determinant(m)) < 0.01) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %35 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "m" + OpName %13 "buf0" + OpMemberName %13 0 "one" + OpName %15 "" + OpName %35 "_GLF_color" + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %35 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeMatrix %7 4 + %9 = OpTypePointer Function %8 + %11 = OpConstant %6 1 + %12 = OpConstant %6 0 + %13 = OpTypeStruct %6 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %6 + %29 = OpConstant %6 0.00999999978 + %30 = OpTypeBool + %34 = OpTypePointer Output %7 + %35 = OpVariable %34 Output + %36 = OpConstantComposite %7 %11 %12 %12 %11 + %38 = OpConstantComposite %7 %12 %12 %12 %12 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %19 = OpAccessChain %18 %15 %17 + %20 = OpLoad %6 %19 + %21 = OpCompositeConstruct %7 %11 %11 %12 %11 + %22 = OpCompositeConstruct %7 %12 %12 %11 %11 + %23 = OpCompositeConstruct %7 %12 %12 %20 %12 + %24 = OpCompositeConstruct %7 %12 %12 %12 %12 + %25 = OpCompositeConstruct %8 %21 %22 %23 %24 + OpStore %10 %25 + %26 = OpLoad %8 %10 + %27 = OpExtInst %6 %1 Determinant %26 + %28 = OpExtInst %6 %1 FAbs %27 + %31 = OpFOrdLessThan %30 %28 %29 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %37 + %32 = OpLabel + OpStore %35 %36 + OpBranch %33 + %37 = OpLabel + OpStore %35 %38 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-isnan-asinh-clamp-always-zero.amber b/vulkan/amber/graphicsfuzz/cov-isnan-asinh-clamp-always-zero.amber new file mode 100644 index 0000000..5027232 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-isnan-asinh-clamp-always-zero.amber @@ -0,0 +1,290 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _float_2_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_0_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_float_values: [2.0, 1.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int data[10]; +# +# for(int i = _int_0; i < _int_10; i++) +# { +# data[i] = _int_1; +# } +# +# float f0 = _float_1_0; +# // Always selects 2.0. +# float f1 = isnan(f0) ? _float_1_0 : _float_2_0; +# // Clamp always returns 1.0. Substract 1.0 and asinh gets zero for its input resulting in f2 = 0. +# float f2 = asinh(clamp(_float_1_0, _float_1_0, gl_FragCoord.x + _float_1_0) - float(data[_int_1])); +# +# // Always true. +# if (f1 == _float_2_0 && f2 == _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 119 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %70 %100 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %34 "data" + OpName %43 "f0" + OpName %45 "buf1" + OpMemberName %45 0 "_GLF_uniform_float_values" + OpName %47 "" + OpName %51 "f1" + OpName %63 "f2" + OpName %70 "gl_FragCoord" + OpName %100 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %44 ArrayStride 16 + OpMemberDecorate %45 0 Offset 0 + OpDecorate %45 Block + OpDecorate %47 DescriptorSet 0 + OpDecorate %47 Binding 1 + OpDecorate %70 BuiltIn FragCoord + OpDecorate %100 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %26 = OpConstant %6 2 + %29 = OpTypeBool + %31 = OpConstant %9 10 + %32 = OpTypeArray %6 %31 + %33 = OpTypePointer Function %32 + %41 = OpTypeFloat 32 + %42 = OpTypePointer Function %41 + %44 = OpTypeArray %41 %10 + %45 = OpTypeStruct %44 + %46 = OpTypePointer Uniform %45 + %47 = OpVariable %46 Uniform + %48 = OpTypePointer Uniform %41 + %68 = OpTypeVector %41 4 + %69 = OpTypePointer Input %68 + %70 = OpVariable %69 Input + %71 = OpConstant %9 0 + %72 = OpTypePointer Input %41 + %99 = OpTypePointer Output %68 + %100 = OpVariable %99 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %34 = OpVariable %33 Function + %43 = OpVariable %42 Function + %51 = OpVariable %42 Function + %54 = OpVariable %42 Function + %63 = OpVariable %42 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %6 %8 + %27 = OpAccessChain %17 %14 %15 %26 + %28 = OpLoad %6 %27 + %30 = OpSLessThan %29 %25 %28 + OpBranchConditional %30 %21 %22 + %21 = OpLabel + %35 = OpLoad %6 %8 + %36 = OpAccessChain %17 %14 %15 %15 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %7 %34 %35 + OpStore %38 %37 + OpBranch %23 + %23 = OpLabel + %39 = OpLoad %6 %8 + %40 = OpIAdd %6 %39 %16 + OpStore %8 %40 + OpBranch %20 + %22 = OpLabel + %49 = OpAccessChain %48 %47 %15 %16 + %50 = OpLoad %41 %49 + OpStore %43 %50 + %52 = OpLoad %41 %43 + %53 = OpIsNan %29 %52 + OpSelectionMerge %56 None + OpBranchConditional %53 %55 %59 + %55 = OpLabel + %57 = OpAccessChain %48 %47 %15 %16 + %58 = OpLoad %41 %57 + OpStore %54 %58 + OpBranch %56 + %59 = OpLabel + %60 = OpAccessChain %48 %47 %15 %15 + %61 = OpLoad %41 %60 + OpStore %54 %61 + OpBranch %56 + %56 = OpLabel + %62 = OpLoad %41 %54 + OpStore %51 %62 + %64 = OpAccessChain %48 %47 %15 %16 + %65 = OpLoad %41 %64 + %66 = OpAccessChain %48 %47 %15 %16 + %67 = OpLoad %41 %66 + %73 = OpAccessChain %72 %70 %71 + %74 = OpLoad %41 %73 + %75 = OpAccessChain %48 %47 %15 %16 + %76 = OpLoad %41 %75 + %77 = OpFAdd %41 %74 %76 + %78 = OpExtInst %41 %1 FClamp %65 %67 %77 + %79 = OpAccessChain %17 %14 %15 %15 + %80 = OpLoad %6 %79 + %81 = OpAccessChain %7 %34 %80 + %82 = OpLoad %6 %81 + %83 = OpConvertSToF %41 %82 + %84 = OpFSub %41 %78 %83 + %85 = OpExtInst %41 %1 Asinh %84 + OpStore %63 %85 + %86 = OpLoad %41 %51 + %87 = OpAccessChain %48 %47 %15 %15 + %88 = OpLoad %41 %87 + %89 = OpFOrdEqual %29 %86 %88 + OpSelectionMerge %91 None + OpBranchConditional %89 %90 %91 + %90 = OpLabel + %92 = OpLoad %41 %63 + %93 = OpAccessChain %48 %47 %15 %26 + %94 = OpLoad %41 %93 + %95 = OpFOrdEqual %29 %92 %94 + OpBranch %91 + %91 = OpLabel + %96 = OpPhi %29 %89 %56 %95 %90 + OpSelectionMerge %98 None + OpBranchConditional %96 %97 %114 + %97 = OpLabel + %101 = OpAccessChain %17 %14 %15 %15 + %102 = OpLoad %6 %101 + %103 = OpConvertSToF %41 %102 + %104 = OpAccessChain %17 %14 %15 %16 + %105 = OpLoad %6 %104 + %106 = OpConvertSToF %41 %105 + %107 = OpAccessChain %17 %14 %15 %16 + %108 = OpLoad %6 %107 + %109 = OpConvertSToF %41 %108 + %110 = OpAccessChain %17 %14 %15 %15 + %111 = OpLoad %6 %110 + %112 = OpConvertSToF %41 %111 + %113 = OpCompositeConstruct %68 %103 %106 %109 %112 + OpStore %100 %113 + OpBranch %98 + %114 = OpLabel + %115 = OpAccessChain %17 %14 %15 %16 + %116 = OpLoad %6 %115 + %117 = OpConvertSToF %41 %116 + %118 = OpCompositeConstruct %68 %117 %117 %117 %117 + OpStore %100 %118 + OpBranch %98 + %98 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 1.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-ivec-from-uniform-float-shift-right-add-components.amber b/vulkan/amber/graphicsfuzz/cov-ivec-from-uniform-float-shift-right-add-components.amber new file mode 100644 index 0000000..2cefc15 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-ivec-from-uniform-float-shift-right-add-components.amber @@ -0,0 +1,202 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_256 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [256, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of resolution: 256.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float resolution; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // p becomes (128, 128). +# ivec2 p = ivec2(resolution) >> ivec2(1); +# // p becomes (256, 128). +# p.x += p.y; +# +# // Always true. +# if(p.x == _int_256) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 69 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %49 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "p" + OpName %11 "buf1" + OpMemberName %11 0 "resolution" + OpName %13 "" + OpName %37 "buf0" + OpMemberName %37 0 "_GLF_uniform_int_values" + OpName %39 "" + OpName %49 "_GLF_color" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 1 + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 0 + OpDecorate %49 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeFloat 32 + %11 = OpTypeStruct %10 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpConstant %6 0 + %15 = OpTypePointer Uniform %10 + %20 = OpConstant %6 1 + %21 = OpConstantComposite %7 %20 %20 + %23 = OpTypeInt 32 0 + %24 = OpConstant %23 1 + %25 = OpTypePointer Function %6 + %28 = OpConstant %23 0 + %35 = OpConstant %23 3 + %36 = OpTypeArray %6 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %6 + %43 = OpTypeBool + %47 = OpTypeVector %10 4 + %48 = OpTypePointer Output %47 + %49 = OpVariable %48 Output + %53 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %16 = OpAccessChain %15 %13 %14 + %17 = OpLoad %10 %16 + %18 = OpConvertFToS %6 %17 + %19 = OpCompositeConstruct %7 %18 %18 + %22 = OpShiftRightArithmetic %7 %19 %21 + OpStore %9 %22 + %26 = OpAccessChain %25 %9 %24 + %27 = OpLoad %6 %26 + %29 = OpAccessChain %25 %9 %28 + %30 = OpLoad %6 %29 + %31 = OpIAdd %6 %30 %27 + %32 = OpAccessChain %25 %9 %28 + OpStore %32 %31 + %33 = OpAccessChain %25 %9 %28 + %34 = OpLoad %6 %33 + %41 = OpAccessChain %40 %39 %14 %14 + %42 = OpLoad %6 %41 + %44 = OpIEqual %43 %34 %42 + OpSelectionMerge %46 None + OpBranchConditional %44 %45 %64 + %45 = OpLabel + %50 = OpAccessChain %40 %39 %14 %20 + %51 = OpLoad %6 %50 + %52 = OpConvertSToF %10 %51 + %54 = OpAccessChain %40 %39 %14 %53 + %55 = OpLoad %6 %54 + %56 = OpConvertSToF %10 %55 + %57 = OpAccessChain %40 %39 %14 %53 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %10 %58 + %60 = OpAccessChain %40 %39 %14 %20 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %10 %61 + %63 = OpCompositeConstruct %47 %52 %56 %59 %62 + OpStore %49 %63 + OpBranch %46 + %64 = OpLabel + %65 = OpAccessChain %40 %39 %14 %53 + %66 = OpLoad %6 %65 + %67 = OpConvertSToF %10 %66 + %68 = OpCompositeConstruct %47 %67 %67 %67 %67 + OpStore %49 %68 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE float STD140 DATA + 256.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 256 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-ivec-shift-right-by-large-number.amber b/vulkan/amber/graphicsfuzz/cov-ivec-shift-right-by-large-number.amber new file mode 100644 index 0000000..e737030 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-ivec-shift-right-by-large-number.amber @@ -0,0 +1,196 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# // Results are not used as they are undefined. +# ivec2(injectionSwitch) >> 90955; +# return _int_1; +# } +# +# void main() +# { +# // Always true. +# if(func() == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %45 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %12 "buf1" + OpMemberName %12 0 "injectionSwitch" + OpName %14 "" + OpName %27 "buf0" + OpMemberName %27 0 "_GLF_uniform_int_values" + OpName %29 "" + OpName %45 "_GLF_color" + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %26 ArrayStride 16 + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 Block + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 0 + OpDecorate %45 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 2 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %11 + %19 = OpTypeVector %6 2 + %21 = OpConstant %6 90955 + %24 = OpTypeInt 32 0 + %25 = OpConstant %24 2 + %26 = OpTypeArray %6 %25 + %27 = OpTypeStruct %26 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %30 = OpConstant %6 1 + %31 = OpTypePointer Uniform %6 + %39 = OpTypeBool + %43 = OpTypeVector %10 4 + %44 = OpTypePointer Output %43 + %45 = OpVariable %44 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %36 = OpFunctionCall %6 %8 + %37 = OpAccessChain %31 %29 %15 %30 + %38 = OpLoad %6 %37 + %40 = OpIEqual %39 %36 %38 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %59 + %41 = OpLabel + %46 = OpAccessChain %31 %29 %15 %30 + %47 = OpLoad %6 %46 + %48 = OpConvertSToF %10 %47 + %49 = OpAccessChain %31 %29 %15 %15 + %50 = OpLoad %6 %49 + %51 = OpConvertSToF %10 %50 + %52 = OpAccessChain %31 %29 %15 %15 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %10 %53 + %55 = OpAccessChain %31 %29 %15 %30 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %10 %56 + %58 = OpCompositeConstruct %43 %48 %51 %54 %57 + OpStore %45 %58 + OpBranch %42 + %59 = OpLabel + %60 = OpAccessChain %31 %29 %15 %15 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %10 %61 + %63 = OpCompositeConstruct %43 %62 %62 %62 %62 + OpStore %45 %63 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %17 = OpAccessChain %16 %14 %15 + %18 = OpLoad %11 %17 + %20 = OpConvertFToS %19 %18 + %22 = OpCompositeConstruct %19 %21 %21 + %23 = OpShiftRightArithmetic %19 %20 %22 + %32 = OpAccessChain %31 %29 %15 %30 + %33 = OpLoad %6 %32 + OpReturnValue %33 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-large-for-loop-exit-early-set-iterator-array-element.amber b/vulkan/amber/graphicsfuzz/cov-large-for-loop-exit-early-set-iterator-array-element.amber new file mode 100644 index 0000000..858a79b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-large-for-loop-exit-early-set-iterator-array-element.amber @@ -0,0 +1,252 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_800 _GLF_uniform_int_values[0] +# #define _int_47942 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_47941 _GLF_uniform_int_values[4] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [800, 47942, 0, 1, 47941] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[10] = int[10](_int_1, _int_47941, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1); +# +# int i = _int_0; +# +# // Iterated once. +# for( i = _int_1; i < _int_800; i ++) +# { +# int a = i + 1; +# +# // Iterated once. +# while(i < a) +# { +# i = arr[_int_1]; +# } +# } +# +# // Always true. +# if(i == _int_47942) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 105 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %86 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %43 "i" + OpName %59 "a" + OpName %86 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %86 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 5 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 3 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 4 + %42 = OpTypePointer Function %6 + %44 = OpConstant %6 2 + %57 = OpTypeBool + %61 = OpConstant %6 1 + %83 = OpTypeFloat 32 + %84 = OpTypeVector %83 4 + %85 = OpTypePointer Output %84 + %86 = OpVariable %85 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %43 = OpVariable %42 Function + %59 = OpVariable %42 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %19 %16 %17 %22 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %19 %16 %17 %18 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %19 %16 %17 %18 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %19 %16 %17 %18 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %19 %16 %17 %18 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %19 %16 %17 %18 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %19 %16 %17 %18 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %19 %16 %17 %18 + %38 = OpLoad %6 %37 + %39 = OpAccessChain %19 %16 %17 %18 + %40 = OpLoad %6 %39 + %41 = OpCompositeConstruct %9 %21 %24 %26 %28 %30 %32 %34 %36 %38 %40 + OpStore %11 %41 + %45 = OpAccessChain %19 %16 %17 %44 + %46 = OpLoad %6 %45 + OpStore %43 %46 + %47 = OpAccessChain %19 %16 %17 %18 + %48 = OpLoad %6 %47 + OpStore %43 %48 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %6 %43 + %55 = OpAccessChain %19 %16 %17 %17 + %56 = OpLoad %6 %55 + %58 = OpSLessThan %57 %54 %56 + OpBranchConditional %58 %50 %51 + %50 = OpLabel + %60 = OpLoad %6 %43 + %62 = OpIAdd %6 %60 %61 + OpStore %59 %62 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %6 %43 + %69 = OpLoad %6 %59 + %70 = OpSLessThan %57 %68 %69 + OpBranchConditional %70 %64 %65 + %64 = OpLabel + %71 = OpAccessChain %19 %16 %17 %18 + %72 = OpLoad %6 %71 + %73 = OpAccessChain %42 %11 %72 + %74 = OpLoad %6 %73 + OpStore %43 %74 + OpBranch %66 + %66 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %52 + %52 = OpLabel + %75 = OpLoad %6 %43 + %76 = OpIAdd %6 %75 %61 + OpStore %43 %76 + OpBranch %49 + %51 = OpLabel + %77 = OpLoad %6 %43 + %78 = OpAccessChain %19 %16 %17 %61 + %79 = OpLoad %6 %78 + %80 = OpIEqual %57 %77 %79 + OpSelectionMerge %82 None + OpBranchConditional %80 %81 %100 + %81 = OpLabel + %87 = OpAccessChain %19 %16 %17 %18 + %88 = OpLoad %6 %87 + %89 = OpConvertSToF %83 %88 + %90 = OpAccessChain %19 %16 %17 %44 + %91 = OpLoad %6 %90 + %92 = OpConvertSToF %83 %91 + %93 = OpAccessChain %19 %16 %17 %44 + %94 = OpLoad %6 %93 + %95 = OpConvertSToF %83 %94 + %96 = OpAccessChain %19 %16 %17 %18 + %97 = OpLoad %6 %96 + %98 = OpConvertSToF %83 %97 + %99 = OpCompositeConstruct %84 %89 %92 %95 %98 + OpStore %86 %99 + OpBranch %82 + %100 = OpLabel + %101 = OpAccessChain %19 %16 %17 %44 + %102 = OpLoad %6 %101 + %103 = OpConvertSToF %83 %102 + %104 = OpCompositeConstruct %84 %103 %103 %103 %103 + OpStore %86 %104 + OpBranch %82 + %82 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 800 47942 0 1 47941 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-large-int-array-nested-loops-set-ivec-index-component-sum.amber b/vulkan/amber/graphicsfuzz/cov-large-int-array-nested-loops-set-ivec-index-component-sum.amber new file mode 100644 index 0000000..004c8ff --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-large-int-array-nested-loops-set-ivec-index-component-sum.amber @@ -0,0 +1,262 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# int arr[128] = int[128](1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +# +# void main() +# { +# ivec2 p = ivec2(1); +# +# for(int i = 1; i < 8; i ++) +# { +# for(int j = 1; j < 8; j ++) +# { +# // Always true. +# if(arr[j] == 1) +# { +# // Always false. +# if(gl_FragCoord.x < 0.0) +# { +# continue; +# } +# +# p.y = i; +# } +# } +# } +# +# // Here p = (1, 7). +# arr[p.x + p.y] = 0; +# +# // Always true. +# if(arr[8] == 0) +# { +# _GLF_color = vec4(1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 100 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 %77 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %16 "p" + OpName %19 "i" + OpName %29 "j" + OpName %47 "gl_FragCoord" + OpName %77 "_GLF_color" + OpName %81 "buf0" + OpMemberName %81 0 "_GLF_uniform_int_values" + OpName %83 "" + OpDecorate %47 BuiltIn FragCoord + OpDecorate %77 Location 0 + OpDecorate %80 ArrayStride 16 + OpMemberDecorate %81 0 Offset 0 + OpDecorate %81 Block + OpDecorate %83 DescriptorSet 0 + OpDecorate %83 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 128 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Private %9 + %11 = OpVariable %10 Private + %12 = OpConstant %6 1 + %13 = OpConstantComposite %9 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 + %14 = OpTypeVector %6 2 + %15 = OpTypePointer Function %14 + %17 = OpConstantComposite %14 %12 %12 + %18 = OpTypePointer Function %6 + %26 = OpConstant %6 8 + %27 = OpTypeBool + %38 = OpTypePointer Private %6 + %44 = OpTypeFloat 32 + %45 = OpTypeVector %44 4 + %46 = OpTypePointer Input %45 + %47 = OpVariable %46 Input + %48 = OpConstant %7 0 + %49 = OpTypePointer Input %44 + %52 = OpConstant %44 0 + %58 = OpConstant %7 1 + %69 = OpConstant %6 0 + %76 = OpTypePointer Output %45 + %77 = OpVariable %76 Output + %78 = OpConstant %44 1 + %79 = OpConstant %7 2 + %80 = OpTypeArray %6 %79 + %81 = OpTypeStruct %80 + %82 = OpTypePointer Uniform %81 + %83 = OpVariable %82 Uniform + %84 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %16 = OpVariable %15 Function + %19 = OpVariable %18 Function + %29 = OpVariable %18 Function + OpStore %11 %13 + OpStore %16 %17 + OpStore %19 %12 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %6 %19 + %28 = OpSLessThan %27 %25 %26 + OpBranchConditional %28 %21 %22 + %21 = OpLabel + OpStore %29 %12 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %6 %29 + %36 = OpSLessThan %27 %35 %26 + OpBranchConditional %36 %31 %32 + %31 = OpLabel + %37 = OpLoad %6 %29 + %39 = OpAccessChain %38 %11 %37 + %40 = OpLoad %6 %39 + %41 = OpIEqual %27 %40 %12 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %43 + %42 = OpLabel + %50 = OpAccessChain %49 %47 %48 + %51 = OpLoad %44 %50 + %53 = OpFOrdLessThan %27 %51 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %55 + %54 = OpLabel + OpBranch %33 + %55 = OpLabel + %57 = OpLoad %6 %19 + %59 = OpAccessChain %18 %16 %58 + OpStore %59 %57 + OpBranch %43 + %43 = OpLabel + OpBranch %33 + %33 = OpLabel + %60 = OpLoad %6 %29 + %61 = OpIAdd %6 %60 %12 + OpStore %29 %61 + OpBranch %30 + %32 = OpLabel + OpBranch %23 + %23 = OpLabel + %62 = OpLoad %6 %19 + %63 = OpIAdd %6 %62 %12 + OpStore %19 %63 + OpBranch %20 + %22 = OpLabel + %64 = OpAccessChain %18 %16 %48 + %65 = OpLoad %6 %64 + %66 = OpAccessChain %18 %16 %58 + %67 = OpLoad %6 %66 + %68 = OpIAdd %6 %65 %67 + %70 = OpAccessChain %38 %11 %68 + OpStore %70 %69 + %71 = OpAccessChain %38 %11 %26 + %72 = OpLoad %6 %71 + %73 = OpIEqual %27 %72 %69 + OpSelectionMerge %75 None + OpBranchConditional %73 %74 %95 + %74 = OpLabel + %85 = OpAccessChain %84 %83 %69 %69 + %86 = OpLoad %6 %85 + %87 = OpConvertSToF %44 %86 + %88 = OpAccessChain %84 %83 %69 %69 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %44 %89 + %91 = OpAccessChain %84 %83 %69 %12 + %92 = OpLoad %6 %91 + %93 = OpConvertSToF %44 %92 + %94 = OpCompositeConstruct %45 %78 %87 %90 %93 + OpStore %77 %94 + OpBranch %75 + %95 = OpLabel + %96 = OpAccessChain %84 %83 %69 %69 + %97 = OpLoad %6 %96 + %98 = OpConvertSToF %44 %97 + %99 = OpCompositeConstruct %45 %98 %98 %98 %98 + OpStore %77 %99 + OpBranch %75 + %75 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-large-loop-break-early-condition-iterator-divided.amber b/vulkan/amber/graphicsfuzz/cov-large-loop-break-early-condition-iterator-divided.amber new file mode 100644 index 0000000..9fe4647 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-large-loop-break-early-condition-iterator-divided.amber @@ -0,0 +1,292 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_4 _GLF_uniform_int_values[3] +# #define _int_3 _GLF_uniform_int_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 2, 0, 4, 3] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# // Contents of two: 2 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int two; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[3] = int[3](_int_1, _int_2, _int_3); +# +# // Breaks after three full iterations. +# for(int i = 0; i < 200; i++) +# { +# if(i > two) +# { +# break; +# } +# +# // True for i == 0. +# if(i / _int_4 == i) +# { +# arr[i] = i; +# } +# } +# +# for(int i = _int_0; i < _int_3; i++) +# { +# arr[i] += arr[i]; +# } +# +# // Always true. +# if (arr[0] == 0 && arr[1] == 4 && arr[2] == 6) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 113 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %107 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %29 "i" + OpName %40 "buf1" + OpMemberName %40 0 "two" + OpName %42 "" + OpName %63 "i" + OpName %107 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpMemberDecorate %40 0 Offset 0 + OpDecorate %40 Block + OpDecorate %42 DescriptorSet 0 + OpDecorate %42 Binding 1 + OpDecorate %107 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 3 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 5 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpTypePointer Uniform %6 + %21 = OpConstant %6 1 + %24 = OpConstant %6 4 + %28 = OpTypePointer Function %6 + %36 = OpConstant %6 200 + %37 = OpTypeBool + %40 = OpTypeStruct %6 + %41 = OpTypePointer Uniform %40 + %42 = OpVariable %41 Uniform + %50 = OpConstant %6 3 + %64 = OpConstant %6 2 + %99 = OpConstant %6 6 + %104 = OpTypeFloat 32 + %105 = OpTypeVector %104 4 + %106 = OpTypePointer Output %105 + %107 = OpVariable %106 Output + %108 = OpConstant %104 1 + %109 = OpConstant %104 0 + %110 = OpConstantComposite %105 %108 %109 %109 %108 + %112 = OpConstantComposite %105 %109 %109 %109 %109 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %29 = OpVariable %28 Function + %63 = OpVariable %28 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %6 %19 + %22 = OpAccessChain %18 %16 %17 %21 + %23 = OpLoad %6 %22 + %25 = OpAccessChain %18 %16 %17 %24 + %26 = OpLoad %6 %25 + %27 = OpCompositeConstruct %9 %20 %23 %26 + OpStore %11 %27 + OpStore %29 %17 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %6 %29 + %38 = OpSLessThan %37 %35 %36 + OpBranchConditional %38 %31 %32 + %31 = OpLabel + %39 = OpLoad %6 %29 + %43 = OpAccessChain %18 %42 %17 + %44 = OpLoad %6 %43 + %45 = OpSGreaterThan %37 %39 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + OpBranch %32 + %47 = OpLabel + %49 = OpLoad %6 %29 + %51 = OpAccessChain %18 %16 %17 %50 + %52 = OpLoad %6 %51 + %53 = OpSDiv %6 %49 %52 + %54 = OpLoad %6 %29 + %55 = OpIEqual %37 %53 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %57 + %56 = OpLabel + %58 = OpLoad %6 %29 + %59 = OpLoad %6 %29 + %60 = OpAccessChain %28 %11 %58 + OpStore %60 %59 + OpBranch %57 + %57 = OpLabel + OpBranch %33 + %33 = OpLabel + %61 = OpLoad %6 %29 + %62 = OpIAdd %6 %61 %21 + OpStore %29 %62 + OpBranch %30 + %32 = OpLabel + %65 = OpAccessChain %18 %16 %17 %64 + %66 = OpLoad %6 %65 + OpStore %63 %66 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %72 = OpLoad %6 %63 + %73 = OpAccessChain %18 %16 %17 %24 + %74 = OpLoad %6 %73 + %75 = OpSLessThan %37 %72 %74 + OpBranchConditional %75 %68 %69 + %68 = OpLabel + %76 = OpLoad %6 %63 + %77 = OpLoad %6 %63 + %78 = OpAccessChain %28 %11 %77 + %79 = OpLoad %6 %78 + %80 = OpAccessChain %28 %11 %76 + %81 = OpLoad %6 %80 + %82 = OpIAdd %6 %81 %79 + %83 = OpAccessChain %28 %11 %76 + OpStore %83 %82 + OpBranch %70 + %70 = OpLabel + %84 = OpLoad %6 %63 + %85 = OpIAdd %6 %84 %21 + OpStore %63 %85 + OpBranch %67 + %69 = OpLabel + %86 = OpAccessChain %28 %11 %17 + %87 = OpLoad %6 %86 + %88 = OpIEqual %37 %87 %17 + OpSelectionMerge %90 None + OpBranchConditional %88 %89 %90 + %89 = OpLabel + %91 = OpAccessChain %28 %11 %21 + %92 = OpLoad %6 %91 + %93 = OpIEqual %37 %92 %24 + OpBranch %90 + %90 = OpLabel + %94 = OpPhi %37 %88 %69 %93 %89 + OpSelectionMerge %96 None + OpBranchConditional %94 %95 %96 + %95 = OpLabel + %97 = OpAccessChain %28 %11 %64 + %98 = OpLoad %6 %97 + %100 = OpIEqual %37 %98 %99 + OpBranch %96 + %96 = OpLabel + %101 = OpPhi %37 %94 %90 %100 %95 + OpSelectionMerge %103 None + OpBranchConditional %101 %102 %111 + %102 = OpLabel + OpStore %107 %110 + OpBranch %103 + %111 = OpLabel + OpStore %107 %112 + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE int32 STD140 DATA + 2 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 2 0 4 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-large-loop-multiply-integer-by-uniform-one.amber b/vulkan/amber/graphicsfuzz/cov-large-loop-multiply-integer-by-uniform-one.amber new file mode 100644 index 0000000..5a0ba23 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-large-loop-multiply-integer-by-uniform-one.amber @@ -0,0 +1,252 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = _float_1_0; +# +# // Always true. +# if(_int_1 > _int_0) +# { +# int a = _int_1; +# +# // Multiplies a by one 120 times. +# for(int i = 0; i < 120; i++) +# { +# a *= _int_1; +# } +# +# // f becomes one, which is the same as the original value of f. +# f = float(a); +# } +# +# // f = max(f, 1) = max(1, 1) = 1. +# f = max(f, _float_1_0); +# +# // Always true. +# if(f == _float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 87 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %68 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %22 "buf1" + OpMemberName %22 0 "_GLF_uniform_int_values" + OpName %24 "" + OpName %36 "a" + OpName %39 "i" + OpName %68 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %21 ArrayStride 16 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 1 + OpDecorate %68 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 1 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %20 = OpConstant %9 2 + %21 = OpTypeArray %15 %20 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpConstant %15 1 + %26 = OpTypePointer Uniform %15 + %31 = OpTypeBool + %35 = OpTypePointer Function %15 + %46 = OpConstant %15 120 + %66 = OpTypeVector %6 4 + %67 = OpTypePointer Output %66 + %68 = OpVariable %67 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %36 = OpVariable %35 Function + %39 = OpVariable %35 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %27 = OpAccessChain %26 %24 %16 %25 + %28 = OpLoad %15 %27 + %29 = OpAccessChain %26 %24 %16 %16 + %30 = OpLoad %15 %29 + %32 = OpSGreaterThan %31 %28 %30 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %34 + %33 = OpLabel + %37 = OpAccessChain %26 %24 %16 %25 + %38 = OpLoad %15 %37 + OpStore %36 %38 + OpStore %39 %16 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %15 %39 + %47 = OpSLessThan %31 %45 %46 + OpBranchConditional %47 %41 %42 + %41 = OpLabel + %48 = OpAccessChain %26 %24 %16 %25 + %49 = OpLoad %15 %48 + %50 = OpLoad %15 %36 + %51 = OpIMul %15 %50 %49 + OpStore %36 %51 + OpBranch %43 + %43 = OpLabel + %52 = OpLoad %15 %39 + %53 = OpIAdd %15 %52 %25 + OpStore %39 %53 + OpBranch %40 + %42 = OpLabel + %54 = OpLoad %15 %36 + %55 = OpConvertSToF %6 %54 + OpStore %8 %55 + OpBranch %34 + %34 = OpLabel + %56 = OpLoad %6 %8 + %57 = OpAccessChain %17 %14 %16 %16 + %58 = OpLoad %6 %57 + %59 = OpExtInst %6 %1 FMax %56 %58 + OpStore %8 %59 + %60 = OpLoad %6 %8 + %61 = OpAccessChain %17 %14 %16 %16 + %62 = OpLoad %6 %61 + %63 = OpFOrdEqual %31 %60 %62 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %82 + %64 = OpLabel + %69 = OpAccessChain %26 %24 %16 %25 + %70 = OpLoad %15 %69 + %71 = OpConvertSToF %6 %70 + %72 = OpAccessChain %26 %24 %16 %16 + %73 = OpLoad %15 %72 + %74 = OpConvertSToF %6 %73 + %75 = OpAccessChain %26 %24 %16 %16 + %76 = OpLoad %15 %75 + %77 = OpConvertSToF %6 %76 + %78 = OpAccessChain %26 %24 %16 %25 + %79 = OpLoad %15 %78 + %80 = OpConvertSToF %6 %79 + %81 = OpCompositeConstruct %66 %71 %74 %77 %80 + OpStore %68 %81 + OpBranch %65 + %82 = OpLabel + %83 = OpAccessChain %26 %24 %16 %16 + %84 = OpLoad %15 %83 + %85 = OpConvertSToF %6 %84 + %86 = OpCompositeConstruct %66 %85 %85 %85 %85 + OpStore %68 %86 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-large-number-of-false-conditions-return-discard-continue.amber b/vulkan/amber/graphicsfuzz/cov-large-number-of-false-conditions-return-discard-continue.amber new file mode 100644 index 0000000..2b0f509 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-large-number-of-false-conditions-return-discard-continue.amber @@ -0,0 +1,924 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# highp vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(0); +# +# int a = 0; +# +# // None of the returns, discards, or continues are executed in this loop, except for the return at the end. +# do +# { +# _GLF_global_loop_count ++; +# +# if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; +# if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; +# if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; +# if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; +# if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; +# if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; +# if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; +# if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; +# if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; +# if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; +# if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; +# +# a++; +# +# // Always false. +# if(a == 0) +# { +# if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; +# if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; if(gl_FragCoord.x < 0.0) return; +# +# while (_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# +# if(gl_FragCoord.x < 0.0) return; +# +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# } +# +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# } +# else +# { +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) discard; +# +# if(injectionSwitch.x > injectionSwitch.y) +# { +# if(gl_FragCoord.x < 0.0) return; +# if(gl_FragCoord.x < 0.0) continue; +# +# discard; +# } +# +# } +# +# if(gl_FragCoord.x < 0.0) discard; +# if(gl_FragCoord.x < 0.0) continue; +# +# _GLF_color = vec4(1, 0, 0, 1); +# +# return; +# } +# while(_GLF_global_loop_count < _GLF_global_loop_bound); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 857 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 %26 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %13 "_GLF_color" + OpName %26 "gl_FragCoord" + OpName %793 "buf0" + OpMemberName %793 0 "injectionSwitch" + OpName %795 "" + OpDecorate %13 Location 0 + OpDecorate %26 BuiltIn FragCoord + OpMemberDecorate %793 0 Offset 0 + OpDecorate %793 Block + OpDecorate %795 DescriptorSet 0 + OpDecorate %795 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Output %11 + %13 = OpVariable %12 Output + %14 = OpConstant %10 0 + %15 = OpConstantComposite %11 %14 %14 %14 %14 + %23 = OpConstant %6 1 + %25 = OpTypePointer Input %11 + %26 = OpVariable %25 Input + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %29 = OpTypePointer Input %10 + %32 = OpTypeBool + %355 = OpConstant %6 10 + %792 = OpTypeVector %10 2 + %793 = OpTypeStruct %792 + %794 = OpTypePointer Uniform %793 + %795 = OpVariable %794 Uniform + %796 = OpTypePointer Uniform %10 + %799 = OpConstant %27 1 + %830 = OpConstant %10 1 + %831 = OpConstantComposite %11 %830 %14 %14 %830 + %837 = OpConstantFalse %32 + %840 = OpConstantTrue %32 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %835 None + OpSwitch %28 %836 + %836 = OpLabel + OpStore %13 %15 + OpBranch %18 + %18 = OpLabel + %850 = OpPhi %32 %837 %836 %855 %21 + %846 = OpPhi %6 %9 %836 %296 %21 + %845 = OpPhi %6 %9 %836 %851 %21 + OpLoopMerge %20 %21 None + OpBranch %19 + %19 = OpLabel + %24 = OpIAdd %6 %845 %23 + %30 = OpAccessChain %29 %26 %28 + %31 = OpLoad %10 %30 + %33 = OpFOrdLessThan %32 %31 %14 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %35 + %34 = OpLabel + OpBranch %20 + %35 = OpLabel + OpSelectionMerge %41 None + OpBranchConditional %33 %40 %41 + %40 = OpLabel + OpBranch %20 + %41 = OpLabel + OpSelectionMerge %47 None + OpBranchConditional %33 %46 %47 + %46 = OpLabel + OpBranch %20 + %47 = OpLabel + OpSelectionMerge %53 None + OpBranchConditional %33 %52 %53 + %52 = OpLabel + OpBranch %20 + %53 = OpLabel + OpSelectionMerge %59 None + OpBranchConditional %33 %58 %59 + %58 = OpLabel + OpBranch %20 + %59 = OpLabel + OpSelectionMerge %65 None + OpBranchConditional %33 %64 %65 + %64 = OpLabel + OpBranch %20 + %65 = OpLabel + OpSelectionMerge %71 None + OpBranchConditional %33 %70 %71 + %70 = OpLabel + OpBranch %20 + %71 = OpLabel + OpSelectionMerge %77 None + OpBranchConditional %33 %76 %77 + %76 = OpLabel + OpBranch %20 + %77 = OpLabel + OpSelectionMerge %83 None + OpBranchConditional %33 %82 %83 + %82 = OpLabel + OpBranch %20 + %83 = OpLabel + OpSelectionMerge %89 None + OpBranchConditional %33 %88 %89 + %88 = OpLabel + OpBranch %20 + %89 = OpLabel + OpSelectionMerge %95 None + OpBranchConditional %33 %94 %95 + %94 = OpLabel + OpBranch %20 + %95 = OpLabel + OpSelectionMerge %101 None + OpBranchConditional %33 %100 %101 + %100 = OpLabel + OpBranch %20 + %101 = OpLabel + OpSelectionMerge %107 None + OpBranchConditional %33 %106 %107 + %106 = OpLabel + OpBranch %20 + %107 = OpLabel + OpSelectionMerge %113 None + OpBranchConditional %33 %112 %113 + %112 = OpLabel + OpBranch %20 + %113 = OpLabel + OpSelectionMerge %119 None + OpBranchConditional %33 %118 %119 + %118 = OpLabel + OpBranch %20 + %119 = OpLabel + OpSelectionMerge %125 None + OpBranchConditional %33 %124 %125 + %124 = OpLabel + OpBranch %20 + %125 = OpLabel + OpSelectionMerge %131 None + OpBranchConditional %33 %130 %131 + %130 = OpLabel + OpBranch %20 + %131 = OpLabel + OpSelectionMerge %137 None + OpBranchConditional %33 %136 %137 + %136 = OpLabel + OpBranch %20 + %137 = OpLabel + OpSelectionMerge %143 None + OpBranchConditional %33 %142 %143 + %142 = OpLabel + OpBranch %20 + %143 = OpLabel + OpSelectionMerge %149 None + OpBranchConditional %33 %148 %149 + %148 = OpLabel + OpBranch %20 + %149 = OpLabel + OpSelectionMerge %155 None + OpBranchConditional %33 %154 %155 + %154 = OpLabel + OpBranch %20 + %155 = OpLabel + OpSelectionMerge %161 None + OpBranchConditional %33 %160 %161 + %160 = OpLabel + OpBranch %20 + %161 = OpLabel + OpSelectionMerge %167 None + OpBranchConditional %33 %166 %167 + %166 = OpLabel + OpBranch %20 + %167 = OpLabel + OpSelectionMerge %173 None + OpBranchConditional %33 %172 %173 + %172 = OpLabel + OpBranch %20 + %173 = OpLabel + OpSelectionMerge %179 None + OpBranchConditional %33 %178 %179 + %178 = OpLabel + OpBranch %20 + %179 = OpLabel + OpSelectionMerge %185 None + OpBranchConditional %33 %184 %185 + %184 = OpLabel + OpBranch %20 + %185 = OpLabel + OpSelectionMerge %191 None + OpBranchConditional %33 %190 %191 + %190 = OpLabel + OpBranch %20 + %191 = OpLabel + OpSelectionMerge %197 None + OpBranchConditional %33 %196 %197 + %196 = OpLabel + OpBranch %20 + %197 = OpLabel + OpSelectionMerge %203 None + OpBranchConditional %33 %202 %203 + %202 = OpLabel + OpBranch %20 + %203 = OpLabel + OpSelectionMerge %209 None + OpBranchConditional %33 %208 %209 + %208 = OpLabel + OpBranch %20 + %209 = OpLabel + OpSelectionMerge %215 None + OpBranchConditional %33 %214 %215 + %214 = OpLabel + OpBranch %20 + %215 = OpLabel + OpSelectionMerge %221 None + OpBranchConditional %33 %220 %221 + %220 = OpLabel + OpBranch %20 + %221 = OpLabel + OpSelectionMerge %227 None + OpBranchConditional %33 %226 %227 + %226 = OpLabel + OpBranch %20 + %227 = OpLabel + OpSelectionMerge %233 None + OpBranchConditional %33 %232 %233 + %232 = OpLabel + OpBranch %20 + %233 = OpLabel + OpSelectionMerge %239 None + OpBranchConditional %33 %238 %239 + %238 = OpLabel + OpBranch %20 + %239 = OpLabel + OpSelectionMerge %245 None + OpBranchConditional %33 %244 %245 + %244 = OpLabel + OpBranch %20 + %245 = OpLabel + OpSelectionMerge %251 None + OpBranchConditional %33 %250 %251 + %250 = OpLabel + OpBranch %20 + %251 = OpLabel + OpSelectionMerge %257 None + OpBranchConditional %33 %256 %257 + %256 = OpLabel + OpBranch %20 + %257 = OpLabel + OpSelectionMerge %263 None + OpBranchConditional %33 %262 %263 + %262 = OpLabel + OpBranch %20 + %263 = OpLabel + OpSelectionMerge %269 None + OpBranchConditional %33 %268 %269 + %268 = OpLabel + OpBranch %20 + %269 = OpLabel + OpSelectionMerge %275 None + OpBranchConditional %33 %274 %275 + %274 = OpLabel + OpBranch %20 + %275 = OpLabel + OpSelectionMerge %281 None + OpBranchConditional %33 %280 %281 + %280 = OpLabel + OpBranch %20 + %281 = OpLabel + OpSelectionMerge %287 None + OpBranchConditional %33 %286 %287 + %286 = OpLabel + OpBranch %20 + %287 = OpLabel + OpSelectionMerge %293 None + OpBranchConditional %33 %292 %293 + %292 = OpLabel + OpBranch %20 + %293 = OpLabel + %296 = OpIAdd %6 %846 %23 + %298 = OpIEqual %32 %296 %9 + OpSelectionMerge %300 None + OpBranchConditional %298 %299 %425 + %299 = OpLabel + OpSelectionMerge %305 None + OpBranchConditional %33 %304 %305 + %304 = OpLabel + OpBranch %20 + %305 = OpLabel + OpSelectionMerge %311 None + OpBranchConditional %33 %310 %311 + %310 = OpLabel + OpBranch %20 + %311 = OpLabel + OpSelectionMerge %317 None + OpBranchConditional %33 %316 %317 + %316 = OpLabel + OpBranch %20 + %317 = OpLabel + OpSelectionMerge %323 None + OpBranchConditional %33 %322 %323 + %322 = OpLabel + OpBranch %20 + %323 = OpLabel + OpSelectionMerge %329 None + OpBranchConditional %33 %328 %329 + %328 = OpLabel + OpBranch %20 + %329 = OpLabel + OpSelectionMerge %335 None + OpBranchConditional %33 %334 %335 + %334 = OpLabel + OpBranch %20 + %335 = OpLabel + OpSelectionMerge %341 None + OpBranchConditional %33 %340 %341 + %340 = OpLabel + OpBranch %20 + %341 = OpLabel + OpSelectionMerge %347 None + OpBranchConditional %33 %346 %347 + %346 = OpLabel + OpBranch %20 + %347 = OpLabel + OpBranch %349 + %349 = OpLabel + %847 = OpPhi %6 %24 %347 %358 %352 + %356 = OpSLessThan %32 %847 %355 + OpLoopMerge %351 %352 None + OpBranchConditional %356 %350 %351 + %350 = OpLabel + %358 = OpIAdd %6 %847 %23 + OpSelectionMerge %363 None + OpBranchConditional %33 %362 %363 + %362 = OpLabel + OpBranch %351 + %363 = OpLabel + OpSelectionMerge %369 None + OpBranchConditional %33 %368 %369 + %368 = OpLabel + OpTerminateInvocation + %369 = OpLabel + OpSelectionMerge %375 None + OpBranchConditional %33 %374 %375 + %374 = OpLabel + OpTerminateInvocation + %375 = OpLabel + OpSelectionMerge %381 None + OpBranchConditional %33 %380 %381 + %380 = OpLabel + OpTerminateInvocation + %381 = OpLabel + OpSelectionMerge %387 None + OpBranchConditional %33 %386 %387 + %386 = OpLabel + OpTerminateInvocation + %387 = OpLabel + OpSelectionMerge %393 None + OpBranchConditional %33 %392 %393 + %392 = OpLabel + OpTerminateInvocation + %393 = OpLabel + OpSelectionMerge %399 None + OpBranchConditional %33 %398 %399 + %398 = OpLabel + OpTerminateInvocation + %399 = OpLabel + OpSelectionMerge %405 None + OpBranchConditional %33 %404 %405 + %404 = OpLabel + OpTerminateInvocation + %405 = OpLabel + OpSelectionMerge %411 None + OpBranchConditional %33 %410 %411 + %410 = OpLabel + OpTerminateInvocation + %411 = OpLabel + OpBranch %352 + %352 = OpLabel + OpBranch %349 + %351 = OpLabel + %853 = OpPhi %6 %847 %349 %358 %362 + %848 = OpPhi %32 %850 %349 %840 %362 + OpSelectionMerge %843 None + OpBranchConditional %848 %20 %843 + %843 = OpLabel + OpSelectionMerge %417 None + OpBranchConditional %33 %416 %417 + %416 = OpLabel + OpTerminateInvocation + %417 = OpLabel + OpSelectionMerge %423 None + OpBranchConditional %33 %422 %423 + %422 = OpLabel + OpTerminateInvocation + %423 = OpLabel + OpBranch %300 + %425 = OpLabel + OpSelectionMerge %430 None + OpBranchConditional %33 %429 %430 + %429 = OpLabel + OpTerminateInvocation + %430 = OpLabel + OpSelectionMerge %436 None + OpBranchConditional %33 %435 %436 + %435 = OpLabel + OpTerminateInvocation + %436 = OpLabel + OpSelectionMerge %442 None + OpBranchConditional %33 %441 %442 + %441 = OpLabel + OpTerminateInvocation + %442 = OpLabel + OpSelectionMerge %448 None + OpBranchConditional %33 %447 %448 + %447 = OpLabel + OpTerminateInvocation + %448 = OpLabel + OpSelectionMerge %454 None + OpBranchConditional %33 %453 %454 + %453 = OpLabel + OpTerminateInvocation + %454 = OpLabel + OpSelectionMerge %460 None + OpBranchConditional %33 %459 %460 + %459 = OpLabel + OpTerminateInvocation + %460 = OpLabel + OpSelectionMerge %466 None + OpBranchConditional %33 %465 %466 + %465 = OpLabel + OpTerminateInvocation + %466 = OpLabel + OpSelectionMerge %472 None + OpBranchConditional %33 %471 %472 + %471 = OpLabel + OpTerminateInvocation + %472 = OpLabel + OpSelectionMerge %478 None + OpBranchConditional %33 %477 %478 + %477 = OpLabel + OpTerminateInvocation + %478 = OpLabel + OpSelectionMerge %484 None + OpBranchConditional %33 %483 %484 + %483 = OpLabel + OpTerminateInvocation + %484 = OpLabel + OpSelectionMerge %490 None + OpBranchConditional %33 %489 %490 + %489 = OpLabel + OpTerminateInvocation + %490 = OpLabel + OpSelectionMerge %496 None + OpBranchConditional %33 %495 %496 + %495 = OpLabel + OpTerminateInvocation + %496 = OpLabel + OpSelectionMerge %502 None + OpBranchConditional %33 %501 %502 + %501 = OpLabel + OpTerminateInvocation + %502 = OpLabel + OpSelectionMerge %508 None + OpBranchConditional %33 %507 %508 + %507 = OpLabel + OpTerminateInvocation + %508 = OpLabel + OpSelectionMerge %514 None + OpBranchConditional %33 %513 %514 + %513 = OpLabel + OpTerminateInvocation + %514 = OpLabel + OpSelectionMerge %520 None + OpBranchConditional %33 %519 %520 + %519 = OpLabel + OpTerminateInvocation + %520 = OpLabel + OpSelectionMerge %526 None + OpBranchConditional %33 %525 %526 + %525 = OpLabel + OpTerminateInvocation + %526 = OpLabel + OpSelectionMerge %532 None + OpBranchConditional %33 %531 %532 + %531 = OpLabel + OpTerminateInvocation + %532 = OpLabel + OpSelectionMerge %538 None + OpBranchConditional %33 %537 %538 + %537 = OpLabel + OpTerminateInvocation + %538 = OpLabel + OpSelectionMerge %544 None + OpBranchConditional %33 %543 %544 + %543 = OpLabel + OpTerminateInvocation + %544 = OpLabel + OpSelectionMerge %550 None + OpBranchConditional %33 %549 %550 + %549 = OpLabel + OpTerminateInvocation + %550 = OpLabel + OpSelectionMerge %556 None + OpBranchConditional %33 %555 %556 + %555 = OpLabel + OpTerminateInvocation + %556 = OpLabel + OpSelectionMerge %562 None + OpBranchConditional %33 %561 %562 + %561 = OpLabel + OpTerminateInvocation + %562 = OpLabel + OpSelectionMerge %568 None + OpBranchConditional %33 %567 %568 + %567 = OpLabel + OpTerminateInvocation + %568 = OpLabel + OpSelectionMerge %574 None + OpBranchConditional %33 %573 %574 + %573 = OpLabel + OpTerminateInvocation + %574 = OpLabel + OpSelectionMerge %580 None + OpBranchConditional %33 %579 %580 + %579 = OpLabel + OpTerminateInvocation + %580 = OpLabel + OpSelectionMerge %586 None + OpBranchConditional %33 %585 %586 + %585 = OpLabel + OpTerminateInvocation + %586 = OpLabel + OpSelectionMerge %592 None + OpBranchConditional %33 %591 %592 + %591 = OpLabel + OpTerminateInvocation + %592 = OpLabel + OpSelectionMerge %598 None + OpBranchConditional %33 %597 %598 + %597 = OpLabel + OpTerminateInvocation + %598 = OpLabel + OpSelectionMerge %604 None + OpBranchConditional %33 %603 %604 + %603 = OpLabel + OpTerminateInvocation + %604 = OpLabel + OpSelectionMerge %610 None + OpBranchConditional %33 %609 %610 + %609 = OpLabel + OpTerminateInvocation + %610 = OpLabel + OpSelectionMerge %616 None + OpBranchConditional %33 %615 %616 + %615 = OpLabel + OpTerminateInvocation + %616 = OpLabel + OpSelectionMerge %622 None + OpBranchConditional %33 %621 %622 + %621 = OpLabel + OpTerminateInvocation + %622 = OpLabel + OpSelectionMerge %628 None + OpBranchConditional %33 %627 %628 + %627 = OpLabel + OpTerminateInvocation + %628 = OpLabel + OpSelectionMerge %634 None + OpBranchConditional %33 %633 %634 + %633 = OpLabel + OpTerminateInvocation + %634 = OpLabel + OpSelectionMerge %640 None + OpBranchConditional %33 %639 %640 + %639 = OpLabel + OpTerminateInvocation + %640 = OpLabel + OpSelectionMerge %646 None + OpBranchConditional %33 %645 %646 + %645 = OpLabel + OpTerminateInvocation + %646 = OpLabel + OpSelectionMerge %652 None + OpBranchConditional %33 %651 %652 + %651 = OpLabel + OpTerminateInvocation + %652 = OpLabel + OpSelectionMerge %658 None + OpBranchConditional %33 %657 %658 + %657 = OpLabel + OpTerminateInvocation + %658 = OpLabel + OpSelectionMerge %664 None + OpBranchConditional %33 %663 %664 + %663 = OpLabel + OpTerminateInvocation + %664 = OpLabel + OpSelectionMerge %670 None + OpBranchConditional %33 %669 %670 + %669 = OpLabel + OpTerminateInvocation + %670 = OpLabel + OpSelectionMerge %676 None + OpBranchConditional %33 %675 %676 + %675 = OpLabel + OpTerminateInvocation + %676 = OpLabel + OpSelectionMerge %682 None + OpBranchConditional %33 %681 %682 + %681 = OpLabel + OpTerminateInvocation + %682 = OpLabel + OpSelectionMerge %688 None + OpBranchConditional %33 %687 %688 + %687 = OpLabel + OpTerminateInvocation + %688 = OpLabel + OpSelectionMerge %694 None + OpBranchConditional %33 %693 %694 + %693 = OpLabel + OpTerminateInvocation + %694 = OpLabel + OpSelectionMerge %700 None + OpBranchConditional %33 %699 %700 + %699 = OpLabel + OpTerminateInvocation + %700 = OpLabel + OpSelectionMerge %706 None + OpBranchConditional %33 %705 %706 + %705 = OpLabel + OpTerminateInvocation + %706 = OpLabel + OpSelectionMerge %712 None + OpBranchConditional %33 %711 %712 + %711 = OpLabel + OpTerminateInvocation + %712 = OpLabel + OpSelectionMerge %718 None + OpBranchConditional %33 %717 %718 + %717 = OpLabel + OpTerminateInvocation + %718 = OpLabel + OpSelectionMerge %724 None + OpBranchConditional %33 %723 %724 + %723 = OpLabel + OpTerminateInvocation + %724 = OpLabel + OpSelectionMerge %730 None + OpBranchConditional %33 %729 %730 + %729 = OpLabel + OpTerminateInvocation + %730 = OpLabel + OpSelectionMerge %736 None + OpBranchConditional %33 %735 %736 + %735 = OpLabel + OpTerminateInvocation + %736 = OpLabel + OpSelectionMerge %742 None + OpBranchConditional %33 %741 %742 + %741 = OpLabel + OpTerminateInvocation + %742 = OpLabel + OpSelectionMerge %748 None + OpBranchConditional %33 %747 %748 + %747 = OpLabel + OpTerminateInvocation + %748 = OpLabel + OpSelectionMerge %754 None + OpBranchConditional %33 %753 %754 + %753 = OpLabel + OpTerminateInvocation + %754 = OpLabel + OpSelectionMerge %760 None + OpBranchConditional %33 %759 %760 + %759 = OpLabel + OpTerminateInvocation + %760 = OpLabel + OpSelectionMerge %766 None + OpBranchConditional %33 %765 %766 + %765 = OpLabel + OpTerminateInvocation + %766 = OpLabel + OpSelectionMerge %772 None + OpBranchConditional %33 %771 %772 + %771 = OpLabel + OpTerminateInvocation + %772 = OpLabel + OpSelectionMerge %778 None + OpBranchConditional %33 %777 %778 + %777 = OpLabel + OpTerminateInvocation + %778 = OpLabel + OpSelectionMerge %784 None + OpBranchConditional %33 %783 %784 + %783 = OpLabel + OpTerminateInvocation + %784 = OpLabel + OpSelectionMerge %790 None + OpBranchConditional %33 %789 %790 + %789 = OpLabel + OpTerminateInvocation + %790 = OpLabel + %797 = OpAccessChain %796 %795 %9 %28 + %798 = OpLoad %10 %797 + %800 = OpAccessChain %796 %795 %9 %799 + %801 = OpLoad %10 %800 + %802 = OpFOrdGreaterThan %32 %798 %801 + OpSelectionMerge %804 None + OpBranchConditional %802 %803 %804 + %803 = OpLabel + OpSelectionMerge %809 None + OpBranchConditional %33 %808 %809 + %808 = OpLabel + OpBranch %20 + %809 = OpLabel + OpSelectionMerge %815 None + OpBranchConditional %33 %814 %815 + %814 = OpLabel + OpBranch %21 + %815 = OpLabel + OpTerminateInvocation + %804 = OpLabel + OpBranch %300 + %300 = OpLabel + %856 = OpPhi %32 %848 %423 %850 %804 + %852 = OpPhi %6 %853 %423 %24 %804 + OpSelectionMerge %822 None + OpBranchConditional %33 %821 %822 + %821 = OpLabel + OpTerminateInvocation + %822 = OpLabel + OpSelectionMerge %828 None + OpBranchConditional %33 %827 %828 + %827 = OpLabel + OpBranch %21 + %828 = OpLabel + OpStore %13 %831 + OpBranch %20 + %21 = OpLabel + %855 = OpPhi %32 %850 %814 %856 %827 + %851 = OpPhi %6 %24 %814 %852 %827 + %834 = OpSLessThan %32 %851 %355 + OpBranchConditional %834 %18 %20 + %20 = OpLabel + %854 = OpPhi %32 %840 %34 %840 %40 %840 %46 %840 %52 %840 %58 %840 %64 %840 %70 %840 %76 %840 %82 %840 %88 %840 %94 %840 %100 %840 %106 %840 %112 %840 %118 %840 %124 %840 %130 %840 %136 %840 %142 %840 %148 %840 %154 %840 %160 %840 %166 %840 %172 %840 %178 %840 %184 %840 %190 %840 %196 %840 %202 %840 %208 %840 %214 %840 %220 %840 %226 %840 %232 %840 %238 %840 %244 %840 %250 %840 %256 %840 %262 %840 %268 %840 %274 %840 %280 %840 %286 %840 %292 %840 %304 %840 %310 %840 %316 %840 %322 %840 %328 %840 %334 %840 %340 %840 %346 %848 %351 %840 %808 %840 %828 %855 %21 + OpSelectionMerge %841 None + OpBranchConditional %854 %835 %841 + %841 = OpLabel + OpBranch %835 + %835 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-ldexp-exponent-undefined-divided-fragcoord-never-executed.amber b/vulkan/amber/graphicsfuzz/cov-ldexp-exponent-undefined-divided-fragcoord-never-executed.amber new file mode 100644 index 0000000..4a2d254 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-ldexp-exponent-undefined-divided-fragcoord-never-executed.amber @@ -0,0 +1,221 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a; +# float f = _float_0_0; +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# // a is undefined, but this is never executed. +# f = ldexp(_float_1_0, (a / int(gl_FragCoord.x))); +# } +# +# // Always true. +# if(f == _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %22 %51 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %22 "gl_FragCoord" + OpName %37 "a" + OpName %51 "_GLF_color" + OpName %53 "buf0" + OpMemberName %53 0 "_GLF_uniform_int_values" + OpName %55 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %22 BuiltIn FragCoord + OpDecorate %51 Location 0 + OpDecorate %52 ArrayStride 16 + OpMemberDecorate %53 0 Offset 0 + OpDecorate %53 Block + OpDecorate %55 DescriptorSet 0 + OpDecorate %55 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %20 = OpTypeVector %6 4 + %21 = OpTypePointer Input %20 + %22 = OpVariable %21 Input + %23 = OpConstant %9 0 + %24 = OpTypePointer Input %6 + %29 = OpTypeBool + %33 = OpConstant %15 1 + %36 = OpTypePointer Function %15 + %50 = OpTypePointer Output %20 + %51 = OpVariable %50 Output + %52 = OpTypeArray %15 %10 + %53 = OpTypeStruct %52 + %54 = OpTypePointer Uniform %53 + %55 = OpVariable %54 Uniform + %56 = OpTypePointer Uniform %15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %37 = OpVariable %36 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %25 = OpAccessChain %24 %22 %23 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %17 %14 %16 %16 + %28 = OpLoad %6 %27 + %30 = OpFOrdLessThan %29 %26 %28 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + %34 = OpAccessChain %17 %14 %16 %33 + %35 = OpLoad %6 %34 + %38 = OpLoad %15 %37 + %39 = OpAccessChain %24 %22 %23 + %40 = OpLoad %6 %39 + %41 = OpConvertFToS %15 %40 + %42 = OpSDiv %15 %38 %41 + %43 = OpExtInst %6 %1 Ldexp %35 %42 + OpStore %8 %43 + OpBranch %32 + %32 = OpLabel + %44 = OpLoad %6 %8 + %45 = OpAccessChain %17 %14 %16 %16 + %46 = OpLoad %6 %45 + %47 = OpFOrdEqual %29 %44 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %70 + %48 = OpLabel + %57 = OpAccessChain %56 %55 %16 %16 + %58 = OpLoad %15 %57 + %59 = OpConvertSToF %6 %58 + %60 = OpAccessChain %56 %55 %16 %33 + %61 = OpLoad %15 %60 + %62 = OpConvertSToF %6 %61 + %63 = OpAccessChain %56 %55 %16 %33 + %64 = OpLoad %15 %63 + %65 = OpConvertSToF %6 %64 + %66 = OpAccessChain %56 %55 %16 %16 + %67 = OpLoad %15 %66 + %68 = OpConvertSToF %6 %67 + %69 = OpCompositeConstruct %20 %59 %62 %65 %68 + OpStore %51 %69 + OpBranch %49 + %70 = OpLabel + %71 = OpAccessChain %56 %55 %16 %33 + %72 = OpLoad %15 %71 + %73 = OpConvertSToF %6 %72 + %74 = OpCompositeConstruct %20 %73 %73 %73 %73 + OpStore %51 %74 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply.amber b/vulkan/amber/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply.amber new file mode 100644 index 0000000..fca8876 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply.amber @@ -0,0 +1,200 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers specific inst combine simplify demanded and inst combine shifts path + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a187dd58a0485988841d325a85c8e6063f53500a + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_256_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 256.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 v1 = vec2(_float_256_0); +# +# // v1.y becomes undefined. This results in an undefined value, but not in undefined behavior. +# v1[_int_1] = ldexp(v1.y, -256); +# +# vec2 v2 = v1 * mat2(_float_0_0); +# +# if (v2.x == _float_0_0) +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# else +# _GLF_color = vec4(_int_0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 78 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %58 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v1" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %23 "buf1" + OpMemberName %23 0 "_GLF_uniform_int_values" + OpName %25 "" + OpName %58 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %22 ArrayStride 16 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 1 + OpDecorate %58 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %6 + %22 = OpTypeArray %16 %11 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpTypePointer Uniform %16 + %29 = OpConstant %10 1 + %30 = OpTypePointer Function %6 + %33 = OpConstant %16 -256 + %40 = OpTypeMatrix %7 2 + %42 = OpConstant %6 0 + %52 = OpTypeBool + %56 = OpTypeVector %6 4 + %57 = OpTypePointer Output %56 + %58 = OpVariable %57 Output + %62 = OpConstant %16 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %19 = OpAccessChain %18 %15 %17 %17 + %20 = OpLoad %6 %19 + %21 = OpCompositeConstruct %7 %20 %20 + OpStore %9 %21 + %27 = OpAccessChain %26 %25 %17 %17 + %28 = OpLoad %16 %27 + %31 = OpAccessChain %30 %9 %29 + %32 = OpLoad %6 %31 + %34 = OpExtInst %6 %1 Ldexp %32 %33 + %35 = OpAccessChain %30 %9 %28 + OpStore %35 %34 + %37 = OpLoad %7 %9 + %43 = OpCompositeConstruct %7 %20 %42 + %44 = OpCompositeConstruct %7 %42 %20 + %45 = OpCompositeConstruct %40 %43 %44 + %46 = OpVectorTimesMatrix %7 %37 %45 + %49 = OpCompositeExtract %6 %46 0 + %53 = OpFOrdEqual %52 %49 %20 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %73 + %54 = OpLabel + %61 = OpConvertSToF %6 %28 + %63 = OpAccessChain %26 %25 %17 %62 + %64 = OpLoad %16 %63 + %65 = OpConvertSToF %6 %64 + %72 = OpCompositeConstruct %56 %61 %65 %65 %61 + OpStore %58 %72 + OpBranch %55 + %73 = OpLabel + %74 = OpAccessChain %26 %25 %17 %62 + %75 = OpLoad %16 %74 + %76 = OpConvertSToF %6 %75 + %77 = OpCompositeConstruct %56 %76 %76 %76 %76 + OpStore %58 %77 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-left-shift-array-access.amber b/vulkan/amber/graphicsfuzz/cov-left-shift-array-access.amber new file mode 100644 index 0000000..b854a07 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-left-shift-array-access.amber @@ -0,0 +1,176 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine shifts code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int idx = 1 << _int_0; +# +# int a = int[2](_int_0, _int_1)[idx]; +# if (a == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %42 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "idx" + OpName %13 "buf1" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %21 "a" + OpName %29 "indexable" + OpName %42 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %42 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %6 0 + %17 = OpTypePointer Uniform %6 + %28 = OpTypePointer Function %12 + %35 = OpTypeBool + %39 = OpTypeFloat 32 + %40 = OpTypeVector %39 4 + %41 = OpTypePointer Output %40 + %42 = OpVariable %41 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %21 = OpVariable %7 Function + %29 = OpVariable %28 Function + %18 = OpAccessChain %17 %15 %16 %9 + %19 = OpLoad %6 %18 + %20 = OpShiftLeftLogical %6 %9 %19 + OpStore %8 %20 + %22 = OpAccessChain %17 %15 %16 %9 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %17 %15 %16 %16 + %25 = OpLoad %6 %24 + %26 = OpCompositeConstruct %12 %23 %25 + %27 = OpLoad %6 %8 + OpStore %29 %26 + %30 = OpAccessChain %7 %29 %27 + %31 = OpLoad %6 %30 + OpStore %21 %31 + %32 = OpLoad %6 %21 + %33 = OpAccessChain %17 %15 %16 %16 + %34 = OpLoad %6 %33 + %36 = OpIEqual %35 %32 %34 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %56 + %37 = OpLabel + %43 = OpAccessChain %17 %15 %16 %16 + %44 = OpLoad %6 %43 + %45 = OpConvertSToF %39 %44 + %46 = OpAccessChain %17 %15 %16 %9 + %47 = OpLoad %6 %46 + %48 = OpConvertSToF %39 %47 + %49 = OpAccessChain %17 %15 %16 %9 + %50 = OpLoad %6 %49 + %51 = OpConvertSToF %39 %50 + %52 = OpAccessChain %17 %15 %16 %16 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %39 %53 + %55 = OpCompositeConstruct %40 %45 %48 %51 %54 + OpStore %42 %55 + OpBranch %38 + %56 = OpLabel + %57 = OpAccessChain %17 %15 %16 %9 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %39 %58 + %60 = OpCompositeConstruct %40 %59 %59 %59 %59 + OpStore %42 %60 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-left-shift-right-shift-compare.amber b/vulkan/amber/graphicsfuzz/cov-left-shift-right-shift-compare.amber new file mode 100644 index 0000000..12c7688 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-left-shift-right-shift-compare.amber @@ -0,0 +1,169 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine compares code path + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a187dd58a0485988841d325a85c8e6063f53500a + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# +# // c becomes 1. +# int c = (_int_1 << _int_1) >> 1; +# +# int a = _int_0; +# for (int i = c; c < 10; i++) +# { +# a++; +# if (a == _int_10) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# break; +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 72 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 3 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpConstant %10 1 + %19 = OpTypePointer Uniform %10 + %43 = OpConstant %10 10 + %44 = OpTypeBool + %49 = OpConstant %10 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %10 %20 + %22 = OpConvertSToF %6 %21 + %23 = OpCompositeConstruct %7 %22 %22 %22 %22 + OpStore %9 %23 + %26 = OpAccessChain %19 %16 %17 %17 + %27 = OpLoad %10 %26 + %30 = OpShiftLeftLogical %10 %27 %27 + %31 = OpShiftRightArithmetic %10 %30 %18 + OpBranch %37 + %37 = OpLabel + %71 = OpPhi %10 %21 %5 %47 %40 + %45 = OpSLessThan %44 %31 %43 + OpLoopMerge %39 %40 None + OpBranchConditional %45 %38 %39 + %38 = OpLabel + %47 = OpIAdd %10 %71 %18 + %50 = OpAccessChain %19 %16 %17 %49 + %51 = OpLoad %10 %50 + %52 = OpIEqual %44 %47 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + %57 = OpConvertSToF %6 %27 + %67 = OpCompositeConstruct %7 %57 %22 %22 %57 + OpStore %9 %67 + OpBranch %39 + %54 = OpLabel + OpBranch %40 + %40 = OpLabel + OpBranch %37 + %39 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-liveinterval-different-dest.amber b/vulkan/amber/graphicsfuzz/cov-liveinterval-different-dest.amber new file mode 100644 index 0000000..50900a2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-liveinterval-different-dest.amber @@ -0,0 +1,242 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific live interval code path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 func() +# { +# vec2 v = vec2(1); +# int i = 0; +# for(int k = 0; k < 2; k++) +# { +# if(v.y + 1.0 > 4.0) // Always false. +# break; +# +# v.y = 1.0; +# i++; +# } +# +# if(i < 10) // Always true. +# return vec3(1, 0, 0); +# else +# return vec3(0, 0, 1); +# } +# +# void main() +# { +# vec3 data[2]; +# +# // Writes data[0] = (1, 0, 0). +# for(int j = 0; j < 1; j++) +# data[j] = func(); +# +# // Writes data[1] = (1, 0, 0). +# for(int j = 0; j < 1; j++) +# data[4*j + 1] = func(); +# +# _GLF_color = vec4(data[0], 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 102 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %95 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "func(" + OpName %13 "v" + OpName %18 "i" + OpName %20 "k" + OpName %59 "j" + OpName %70 "data" + OpName %77 "j" + OpName %95 "_GLF_color" + OpDecorate %95 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeFunction %7 + %11 = OpTypeVector %6 2 + %12 = OpTypePointer Function %11 + %14 = OpConstant %6 1 + %15 = OpConstantComposite %11 %14 %14 + %16 = OpTypeInt 32 1 + %17 = OpTypePointer Function %16 + %19 = OpConstant %16 0 + %27 = OpConstant %16 2 + %28 = OpTypeBool + %30 = OpTypeInt 32 0 + %31 = OpConstant %30 1 + %32 = OpTypePointer Function %6 + %36 = OpConstant %6 4 + %43 = OpConstant %16 1 + %48 = OpConstant %16 10 + %52 = OpConstant %6 0 + %53 = OpConstantComposite %7 %14 %52 %52 + %56 = OpConstantComposite %7 %52 %52 %14 + %67 = OpConstant %30 2 + %68 = OpTypeArray %7 %67 + %69 = OpTypePointer Function %68 + %73 = OpTypePointer Function %7 + %85 = OpConstant %16 4 + %93 = OpTypeVector %6 4 + %94 = OpTypePointer Output %93 + %95 = OpVariable %94 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %59 = OpVariable %17 Function + %70 = OpVariable %69 Function + %77 = OpVariable %17 Function + OpStore %59 %19 + OpBranch %60 + %60 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %16 %59 + %66 = OpSLessThan %28 %65 %43 + OpBranchConditional %66 %61 %62 + %61 = OpLabel + %71 = OpLoad %16 %59 + %72 = OpFunctionCall %7 %9 + %74 = OpAccessChain %73 %70 %71 + OpStore %74 %72 + OpBranch %63 + %63 = OpLabel + %75 = OpLoad %16 %59 + %76 = OpIAdd %16 %75 %43 + OpStore %59 %76 + OpBranch %60 + %62 = OpLabel + OpStore %77 %19 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %16 %77 + %84 = OpSLessThan %28 %83 %43 + OpBranchConditional %84 %79 %80 + %79 = OpLabel + %86 = OpLoad %16 %77 + %87 = OpIMul %16 %85 %86 + %88 = OpIAdd %16 %87 %43 + %89 = OpFunctionCall %7 %9 + %90 = OpAccessChain %73 %70 %88 + OpStore %90 %89 + OpBranch %81 + %81 = OpLabel + %91 = OpLoad %16 %77 + %92 = OpIAdd %16 %91 %43 + OpStore %77 %92 + OpBranch %78 + %80 = OpLabel + %96 = OpAccessChain %73 %70 %19 + %97 = OpLoad %7 %96 + %98 = OpCompositeExtract %6 %97 0 + %99 = OpCompositeExtract %6 %97 1 + %100 = OpCompositeExtract %6 %97 2 + %101 = OpCompositeConstruct %93 %98 %99 %100 %14 + OpStore %95 %101 + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %13 = OpVariable %12 Function + %18 = OpVariable %17 Function + %20 = OpVariable %17 Function + OpStore %13 %15 + OpStore %18 %19 + OpStore %20 %19 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %16 %20 + %29 = OpSLessThan %28 %26 %27 + OpBranchConditional %29 %22 %23 + %22 = OpLabel + %33 = OpAccessChain %32 %13 %31 + %34 = OpLoad %6 %33 + %35 = OpFAdd %6 %34 %14 + %37 = OpFOrdGreaterThan %28 %35 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + OpBranch %23 + %39 = OpLabel + %41 = OpAccessChain %32 %13 %31 + OpStore %41 %14 + %42 = OpLoad %16 %18 + %44 = OpIAdd %16 %42 %43 + OpStore %18 %44 + OpBranch %24 + %24 = OpLabel + %45 = OpLoad %16 %20 + %46 = OpIAdd %16 %45 %43 + OpStore %20 %46 + OpBranch %21 + %23 = OpLabel + %47 = OpLoad %16 %18 + %49 = OpSLessThan %28 %47 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %55 + %50 = OpLabel + OpReturnValue %53 + %55 = OpLabel + OpReturnValue %56 + %51 = OpLabel + OpUnreachable + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-abs-multiply-offset.amber b/vulkan/amber/graphicsfuzz/cov-loop-abs-multiply-offset.amber new file mode 100644 index 0000000..e89ed9a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-abs-multiply-offset.amber @@ -0,0 +1,240 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_33 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_245_0 _GLF_uniform_float_values[1] +# #define _float_246_0 _GLF_uniform_float_values[2] +# #define _float_1_1 _GLF_uniform_float_values[3] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [1.0, 245.0, 246.0, 1.1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[4]; +# }; +# +# // Contents of _GLF_uniform_int_values: [33, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = _float_1_0; +# +# for(int i = _int_0; i < _int_33; i++) +# { +# f = abs(- _float_1_1 * f) + _float_1_0; +# } +# +# // Always true. +# if(f > _float_245_0 && f < _float_246_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 88 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %69 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %21 "i" + OpName %24 "buf1" + OpMemberName %24 0 "_GLF_uniform_int_values" + OpName %26 "" + OpName %69 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %23 ArrayStride 16 + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 1 + OpDecorate %69 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %20 = OpTypePointer Function %15 + %22 = OpConstant %9 3 + %23 = OpTypeArray %15 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpConstant %15 1 + %28 = OpTypePointer Uniform %15 + %39 = OpTypeBool + %41 = OpConstant %15 3 + %60 = OpConstant %15 2 + %67 = OpTypeVector %6 4 + %68 = OpTypePointer Output %67 + %69 = OpVariable %68 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %21 = OpVariable %20 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %29 = OpAccessChain %28 %26 %16 %27 + %30 = OpLoad %15 %29 + OpStore %21 %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %15 %21 + %37 = OpAccessChain %28 %26 %16 %16 + %38 = OpLoad %15 %37 + %40 = OpSLessThan %39 %36 %38 + OpBranchConditional %40 %32 %33 + %32 = OpLabel + %42 = OpAccessChain %17 %14 %16 %41 + %43 = OpLoad %6 %42 + %44 = OpFNegate %6 %43 + %45 = OpLoad %6 %8 + %46 = OpFMul %6 %44 %45 + %47 = OpExtInst %6 %1 FAbs %46 + %48 = OpAccessChain %17 %14 %16 %16 + %49 = OpLoad %6 %48 + %50 = OpFAdd %6 %47 %49 + OpStore %8 %50 + OpBranch %34 + %34 = OpLabel + %51 = OpLoad %15 %21 + %52 = OpIAdd %15 %51 %27 + OpStore %21 %52 + OpBranch %31 + %33 = OpLabel + %53 = OpLoad %6 %8 + %54 = OpAccessChain %17 %14 %16 %27 + %55 = OpLoad %6 %54 + %56 = OpFOrdGreaterThan %39 %53 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + %59 = OpLoad %6 %8 + %61 = OpAccessChain %17 %14 %16 %60 + %62 = OpLoad %6 %61 + %63 = OpFOrdLessThan %39 %59 %62 + OpBranch %58 + %58 = OpLabel + %64 = OpPhi %39 %56 %33 %63 %57 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %83 + %65 = OpLabel + %70 = OpAccessChain %28 %26 %16 %60 + %71 = OpLoad %15 %70 + %72 = OpConvertSToF %6 %71 + %73 = OpAccessChain %28 %26 %16 %27 + %74 = OpLoad %15 %73 + %75 = OpConvertSToF %6 %74 + %76 = OpAccessChain %28 %26 %16 %27 + %77 = OpLoad %15 %76 + %78 = OpConvertSToF %6 %77 + %79 = OpAccessChain %28 %26 %16 %60 + %80 = OpLoad %15 %79 + %81 = OpConvertSToF %6 %80 + %82 = OpCompositeConstruct %67 %72 %75 %78 %81 + OpStore %69 %82 + OpBranch %66 + %83 = OpLabel + %84 = OpAccessChain %28 %26 %16 %27 + %85 = OpLoad %15 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpCompositeConstruct %67 %86 %86 %86 %86 + OpStore %69 %87 + OpBranch %66 + %66 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 33 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 245.0 246.0 1.1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-array-element-bitfield-insert-undefined-never-read.amber b/vulkan/amber/graphicsfuzz/cov-loop-array-element-bitfield-insert-undefined-never-read.amber new file mode 100644 index 0000000..72aa4e9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-array-element-bitfield-insert-undefined-never-read.amber @@ -0,0 +1,316 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_5 _GLF_uniform_int_values[1] +# #define _int_4 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 5, 4, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr0[10] = int[10](_int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0); +# int a = _int_4; +# int idx = _int_1; +# // arr0[1] becomes one. +# arr0[idx] = _int_1; +# +# for(int i = _int_0; i < _int_5; i++) +# { +# int b = _int_1; +# +# // Always true. +# if(arr0[_int_1] == _int_1) +# { +# b++; +# } +# +# // bitfieldInsert return value is undefined but also unused. +# int arr1[10] = int[10](_int_1, _int_1, _int_1, a, _int_1, _int_1, _int_1, _int_1, _int_1, bitfieldInsert(b, _int_1, 50, _int_1)); +# int c = _int_1; +# +# // Always true. +# if(arr1[c] >= _int_1) +# { +# a = _int_1; +# } +# } +# +# // Always true. +# if(a == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 150 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %131 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr0" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %42 "a" + OpName %46 "idx" + OpName %53 "i" + OpName %67 "b" + OpName %81 "arr1" + OpName %107 "c" + OpName %131 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %131 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 4 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 3 + %19 = OpTypePointer Uniform %6 + %41 = OpTypePointer Function %6 + %43 = OpConstant %6 2 + %62 = OpConstant %6 1 + %65 = OpTypeBool + %102 = OpConstant %6 50 + %128 = OpTypeFloat 32 + %129 = OpTypeVector %128 4 + %130 = OpTypePointer Output %129 + %131 = OpVariable %130 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %42 = OpVariable %41 Function + %46 = OpVariable %41 Function + %53 = OpVariable %41 Function + %67 = OpVariable %41 Function + %81 = OpVariable %10 Function + %107 = OpVariable %41 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %16 %17 %18 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %19 %16 %17 %18 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %19 %16 %17 %18 + %27 = OpLoad %6 %26 + %28 = OpAccessChain %19 %16 %17 %18 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %19 %16 %17 %18 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %19 %16 %17 %18 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %19 %16 %17 %18 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %19 %16 %17 %18 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %19 %16 %17 %18 + %39 = OpLoad %6 %38 + %40 = OpCompositeConstruct %9 %21 %23 %25 %27 %29 %31 %33 %35 %37 %39 + OpStore %11 %40 + %44 = OpAccessChain %19 %16 %17 %43 + %45 = OpLoad %6 %44 + OpStore %42 %45 + %47 = OpAccessChain %19 %16 %17 %17 + %48 = OpLoad %6 %47 + OpStore %46 %48 + %49 = OpLoad %6 %46 + %50 = OpAccessChain %19 %16 %17 %17 + %51 = OpLoad %6 %50 + %52 = OpAccessChain %41 %11 %49 + OpStore %52 %51 + %54 = OpAccessChain %19 %16 %17 %18 + %55 = OpLoad %6 %54 + OpStore %53 %55 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %6 %53 + %63 = OpAccessChain %19 %16 %17 %62 + %64 = OpLoad %6 %63 + %66 = OpSLessThan %65 %61 %64 + OpBranchConditional %66 %57 %58 + %57 = OpLabel + %68 = OpAccessChain %19 %16 %17 %17 + %69 = OpLoad %6 %68 + OpStore %67 %69 + %70 = OpAccessChain %19 %16 %17 %17 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %41 %11 %71 + %73 = OpLoad %6 %72 + %74 = OpAccessChain %19 %16 %17 %17 + %75 = OpLoad %6 %74 + %76 = OpIEqual %65 %73 %75 + OpSelectionMerge %78 None + OpBranchConditional %76 %77 %78 + %77 = OpLabel + %79 = OpLoad %6 %67 + %80 = OpIAdd %6 %79 %62 + OpStore %67 %80 + OpBranch %78 + %78 = OpLabel + %82 = OpAccessChain %19 %16 %17 %17 + %83 = OpLoad %6 %82 + %84 = OpAccessChain %19 %16 %17 %17 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %19 %16 %17 %17 + %87 = OpLoad %6 %86 + %88 = OpLoad %6 %42 + %89 = OpAccessChain %19 %16 %17 %17 + %90 = OpLoad %6 %89 + %91 = OpAccessChain %19 %16 %17 %17 + %92 = OpLoad %6 %91 + %93 = OpAccessChain %19 %16 %17 %17 + %94 = OpLoad %6 %93 + %95 = OpAccessChain %19 %16 %17 %17 + %96 = OpLoad %6 %95 + %97 = OpAccessChain %19 %16 %17 %17 + %98 = OpLoad %6 %97 + %99 = OpLoad %6 %67 + %100 = OpAccessChain %19 %16 %17 %17 + %101 = OpLoad %6 %100 + %103 = OpAccessChain %19 %16 %17 %17 + %104 = OpLoad %6 %103 + %105 = OpBitFieldInsert %6 %99 %101 %102 %104 + %106 = OpCompositeConstruct %9 %83 %85 %87 %88 %90 %92 %94 %96 %98 %105 + OpStore %81 %106 + %108 = OpAccessChain %19 %16 %17 %17 + %109 = OpLoad %6 %108 + OpStore %107 %109 + %110 = OpLoad %6 %107 + %111 = OpAccessChain %41 %81 %110 + %112 = OpLoad %6 %111 + %113 = OpAccessChain %19 %16 %17 %17 + %114 = OpLoad %6 %113 + %115 = OpSGreaterThanEqual %65 %112 %114 + OpSelectionMerge %117 None + OpBranchConditional %115 %116 %117 + %116 = OpLabel + %118 = OpAccessChain %19 %16 %17 %17 + %119 = OpLoad %6 %118 + OpStore %42 %119 + OpBranch %117 + %117 = OpLabel + OpBranch %59 + %59 = OpLabel + %120 = OpLoad %6 %53 + %121 = OpIAdd %6 %120 %62 + OpStore %53 %121 + OpBranch %56 + %58 = OpLabel + %122 = OpLoad %6 %42 + %123 = OpAccessChain %19 %16 %17 %17 + %124 = OpLoad %6 %123 + %125 = OpIEqual %65 %122 %124 + OpSelectionMerge %127 None + OpBranchConditional %125 %126 %145 + %126 = OpLabel + %132 = OpAccessChain %19 %16 %17 %17 + %133 = OpLoad %6 %132 + %134 = OpConvertSToF %128 %133 + %135 = OpAccessChain %19 %16 %17 %18 + %136 = OpLoad %6 %135 + %137 = OpConvertSToF %128 %136 + %138 = OpAccessChain %19 %16 %17 %18 + %139 = OpLoad %6 %138 + %140 = OpConvertSToF %128 %139 + %141 = OpAccessChain %19 %16 %17 %17 + %142 = OpLoad %6 %141 + %143 = OpConvertSToF %128 %142 + %144 = OpCompositeConstruct %129 %134 %137 %140 %143 + OpStore %131 %144 + OpBranch %127 + %145 = OpLabel + %146 = OpAccessChain %19 %16 %17 %18 + %147 = OpLoad %6 %146 + %148 = OpConvertSToF %128 %147 + %149 = OpCompositeConstruct %129 %148 %148 %148 %148 + OpStore %131 %149 + OpBranch %127 + %127 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 5 4 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-array-element-copy-index-clamp-sign.amber b/vulkan/amber/graphicsfuzz/cov-loop-array-element-copy-index-clamp-sign.amber new file mode 100644 index 0000000..7feaa69 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-array-element-copy-index-clamp-sign.amber @@ -0,0 +1,283 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _int_3 _GLF_uniform_int_values[4] +# #define _int_4 _GLF_uniform_int_values[5] +# #define _int_5 _GLF_uniform_int_values[6] +# #define _int_6 _GLF_uniform_int_values[7] +# #define _int_7 _GLF_uniform_int_values[8] +# #define _int_8 _GLF_uniform_int_values[9] +# #define _int_9 _GLF_uniform_int_values[10] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [10, 1, 0, 2, 3, 4, 5, 6, 7, 8, 9] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[11]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[10] = int[10](_int_0, _int_1, _int_2, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9); +# int ref[10] = int[10](_int_0, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1); +# +# // Sign returns 0 for i = 0 and 1 for all other values of i. +# for(int i = 0; i < _int_10; i++) +# arr[i] = arr[clamp(sign(i), _int_0, _int_1)]; +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Verify results. +# for(int i = _int_0; i < _int_10; i++) +# if(arr[i] != ref[i]) +# _GLF_color = vec4(_int_0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 141 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %100 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %50 "ref" + OpName %73 "i" + OpName %100 "_GLF_color" + OpName %114 "i" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %100 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 11 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 2 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 1 + %25 = OpConstant %6 3 + %28 = OpConstant %6 4 + %31 = OpConstant %6 5 + %34 = OpConstant %6 6 + %37 = OpConstant %6 7 + %40 = OpConstant %6 8 + %43 = OpConstant %6 9 + %46 = OpConstant %6 10 + %72 = OpTypePointer Function %6 + %82 = OpTypeBool + %97 = OpTypeFloat 32 + %98 = OpTypeVector %97 4 + %99 = OpTypePointer Output %98 + %100 = OpVariable %99 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %50 = OpVariable %10 Function + %73 = OpVariable %72 Function + %114 = OpVariable %72 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %19 %16 %17 %22 + %24 = OpLoad %6 %23 + %26 = OpAccessChain %19 %16 %17 %25 + %27 = OpLoad %6 %26 + %29 = OpAccessChain %19 %16 %17 %28 + %30 = OpLoad %6 %29 + %32 = OpAccessChain %19 %16 %17 %31 + %33 = OpLoad %6 %32 + %35 = OpAccessChain %19 %16 %17 %34 + %36 = OpLoad %6 %35 + %38 = OpAccessChain %19 %16 %17 %37 + %39 = OpLoad %6 %38 + %41 = OpAccessChain %19 %16 %17 %40 + %42 = OpLoad %6 %41 + %44 = OpAccessChain %19 %16 %17 %43 + %45 = OpLoad %6 %44 + %47 = OpAccessChain %19 %16 %17 %46 + %48 = OpLoad %6 %47 + %49 = OpCompositeConstruct %9 %21 %24 %27 %30 %33 %36 %39 %42 %45 %48 + OpStore %11 %49 + %51 = OpAccessChain %19 %16 %17 %18 + %52 = OpLoad %6 %51 + %53 = OpAccessChain %19 %16 %17 %22 + %54 = OpLoad %6 %53 + %55 = OpAccessChain %19 %16 %17 %22 + %56 = OpLoad %6 %55 + %57 = OpAccessChain %19 %16 %17 %22 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %19 %16 %17 %22 + %60 = OpLoad %6 %59 + %61 = OpAccessChain %19 %16 %17 %22 + %62 = OpLoad %6 %61 + %63 = OpAccessChain %19 %16 %17 %22 + %64 = OpLoad %6 %63 + %65 = OpAccessChain %19 %16 %17 %22 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %19 %16 %17 %22 + %68 = OpLoad %6 %67 + %69 = OpAccessChain %19 %16 %17 %22 + %70 = OpLoad %6 %69 + %71 = OpCompositeConstruct %9 %52 %54 %56 %58 %60 %62 %64 %66 %68 %70 + OpStore %50 %71 + OpStore %73 %17 + OpBranch %74 + %74 = OpLabel + OpLoopMerge %76 %77 None + OpBranch %78 + %78 = OpLabel + %79 = OpLoad %6 %73 + %80 = OpAccessChain %19 %16 %17 %17 + %81 = OpLoad %6 %80 + %83 = OpSLessThan %82 %79 %81 + OpBranchConditional %83 %75 %76 + %75 = OpLabel + %84 = OpLoad %6 %73 + %85 = OpLoad %6 %73 + %86 = OpExtInst %6 %1 SSign %85 + %87 = OpAccessChain %19 %16 %17 %18 + %88 = OpLoad %6 %87 + %89 = OpAccessChain %19 %16 %17 %22 + %90 = OpLoad %6 %89 + %91 = OpExtInst %6 %1 SClamp %86 %88 %90 + %92 = OpAccessChain %72 %11 %91 + %93 = OpLoad %6 %92 + %94 = OpAccessChain %72 %11 %84 + OpStore %94 %93 + OpBranch %77 + %77 = OpLabel + %95 = OpLoad %6 %73 + %96 = OpIAdd %6 %95 %22 + OpStore %73 %96 + OpBranch %74 + %76 = OpLabel + %101 = OpAccessChain %19 %16 %17 %22 + %102 = OpLoad %6 %101 + %103 = OpConvertSToF %97 %102 + %104 = OpAccessChain %19 %16 %17 %18 + %105 = OpLoad %6 %104 + %106 = OpConvertSToF %97 %105 + %107 = OpAccessChain %19 %16 %17 %18 + %108 = OpLoad %6 %107 + %109 = OpConvertSToF %97 %108 + %110 = OpAccessChain %19 %16 %17 %22 + %111 = OpLoad %6 %110 + %112 = OpConvertSToF %97 %111 + %113 = OpCompositeConstruct %98 %103 %106 %109 %112 + OpStore %100 %113 + %115 = OpAccessChain %19 %16 %17 %18 + %116 = OpLoad %6 %115 + OpStore %114 %116 + OpBranch %117 + %117 = OpLabel + OpLoopMerge %119 %120 None + OpBranch %121 + %121 = OpLabel + %122 = OpLoad %6 %114 + %123 = OpAccessChain %19 %16 %17 %17 + %124 = OpLoad %6 %123 + %125 = OpSLessThan %82 %122 %124 + OpBranchConditional %125 %118 %119 + %118 = OpLabel + %126 = OpLoad %6 %114 + %127 = OpAccessChain %72 %11 %126 + %128 = OpLoad %6 %127 + %129 = OpLoad %6 %114 + %130 = OpAccessChain %72 %50 %129 + %131 = OpLoad %6 %130 + %132 = OpINotEqual %82 %128 %131 + OpSelectionMerge %134 None + OpBranchConditional %132 %133 %134 + %133 = OpLabel + %135 = OpAccessChain %19 %16 %17 %18 + %136 = OpLoad %6 %135 + %137 = OpConvertSToF %97 %136 + %138 = OpCompositeConstruct %98 %137 %137 %137 %137 + OpStore %100 %138 + OpBranch %134 + %134 = OpLabel + OpBranch %120 + %120 = OpLabel + %139 = OpLoad %6 %114 + %140 = OpIAdd %6 %139 %22 + OpStore %114 %140 + OpBranch %117 + %119 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 1 0 2 3 4 5 6 7 8 9 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-array-index-decrement-never-negative.amber b/vulkan/amber/graphicsfuzz/cov-loop-array-index-decrement-never-negative.amber new file mode 100644 index 0000000..55d9d67 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-array-index-decrement-never-negative.amber @@ -0,0 +1,312 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--copy-propagate-arrays' +# '--eliminate-local-multi-store' +# '--if-conversion' +# '--eliminate-local-single-block' +# '--eliminate-dead-inserts' +# '--redundancy-elimination' +# '--eliminate-local-single-store' +# '--eliminate-dead-code-aggressive' +# '--eliminate-dead-code-aggressive' +# '--redundancy-elimination' +# '--scalar-replacement=100' +# '--eliminate-local-multi-store' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--ccp' +# '--copy-propagate-arrays' +# '--combine-access-chains' +# '--if-conversion' +# '--private-to-local' +# '--reduce-load-size' +# '--scalar-replacement=100' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int arr0[10] = int[10](1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +# +# int func() +# { +# int a = _int_1; +# int b = _int_0; +# int arr1[10] = int[10](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1); +# +# // Iterates ten times. +# while(b >= _int_0 && _GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# // Reads zero as an index and then decrements b to -1. Reads value one, so a stays at one. +# a = arr1[b--]; +# +# // arr0[1] = arr0[0]. No effect. +# arr0[_int_1] = arr0[a]; +# +# // Always true. +# if(a > _int_0) +# { +# // Increments b to zero and indexes with that. Writes one to arr1[0] but that value already existed. +# arr1[++b] = a; +# } +# } +# +# // Returns zero. +# return b; +# } +# +# void main() +# { +# // Always true. +# if(func() == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 157 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %104 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "_GLF_global_loop_count" + OpName %17 "arr0" + OpName %24 "buf0" + OpMemberName %24 0 "_GLF_uniform_int_values" + OpName %26 "" + OpName %34 "arr1" + OpName %104 "_GLF_color" + OpDecorate %23 ArrayStride 16 + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 0 + OpDecorate %104 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Private %6 + %11 = OpVariable %10 Private + %12 = OpConstant %6 0 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 10 + %15 = OpTypeArray %6 %14 + %16 = OpTypePointer Private %15 + %17 = OpVariable %16 Private + %18 = OpConstant %6 1 + %19 = OpConstantComposite %15 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 + %20 = OpTypePointer Function %6 + %22 = OpConstant %13 2 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpTypePointer Uniform %6 + %33 = OpTypePointer Function %15 + %64 = OpTypeBool + %67 = OpConstant %6 10 + %101 = OpTypeFloat 32 + %102 = OpTypeVector %101 4 + %103 = OpTypePointer Output %102 + %104 = OpVariable %103 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %125 = OpVariable %33 Function + %126 = OpVariable %20 Function + OpStore %11 %12 + OpStore %17 %19 + %128 = OpAccessChain %27 %26 %12 %12 + %129 = OpLoad %6 %128 + %130 = OpAccessChain %27 %26 %12 %18 + %131 = OpLoad %6 %130 + %132 = OpCompositeConstruct %15 %129 %129 %129 %129 %129 %129 %129 %129 %129 %129 + OpStore %125 %132 + OpBranch %133 + %133 = OpLabel + %134 = OpPhi %6 %131 %5 %154 %155 + %136 = OpSGreaterThanEqual %64 %134 %131 + %137 = OpLoad %6 %11 + %138 = OpSLessThan %64 %137 %67 + %139 = OpLogicalAnd %64 %136 %138 + OpLoopMerge %156 %155 None + OpBranchConditional %139 %140 %156 + %140 = OpLabel + %141 = OpLoad %6 %11 + %142 = OpIAdd %6 %141 %18 + OpStore %11 %142 + %143 = OpISub %6 %134 %18 + %144 = OpAccessChain %20 %125 %134 + %145 = OpLoad %6 %144 + %146 = OpAccessChain %10 %17 %145 + %147 = OpLoad %6 %146 + %148 = OpAccessChain %10 %17 %129 + OpStore %148 %147 + %149 = OpSGreaterThan %64 %145 %131 + OpSelectionMerge %153 None + OpBranchConditional %149 %150 %153 + %150 = OpLabel + %151 = OpIAdd %6 %143 %18 + %152 = OpAccessChain %20 %125 %151 + OpStore %152 %145 + OpBranch %153 + %153 = OpLabel + %154 = OpPhi %6 %143 %140 %151 %150 + OpBranch %155 + %155 = OpLabel + OpBranch %133 + %156 = OpLabel + OpStore %126 %134 + %95 = OpLoad %6 %126 + %96 = OpAccessChain %27 %26 %12 %18 + %97 = OpLoad %6 %96 + %98 = OpIEqual %64 %95 %97 + OpSelectionMerge %100 None + OpBranchConditional %98 %99 %118 + %99 = OpLabel + %105 = OpAccessChain %27 %26 %12 %12 + %106 = OpLoad %6 %105 + %107 = OpConvertSToF %101 %106 + %110 = OpConvertSToF %101 %97 + %117 = OpCompositeConstruct %102 %107 %110 %110 %107 + OpStore %104 %117 + OpBranch %100 + %118 = OpLabel + %121 = OpConvertSToF %101 %97 + %122 = OpCompositeConstruct %102 %121 %121 %121 %121 + OpStore %104 %122 + OpBranch %100 + %100 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %34 = OpVariable %33 Function + %28 = OpAccessChain %27 %26 %12 %12 + %29 = OpLoad %6 %28 + %31 = OpAccessChain %27 %26 %12 %18 + %32 = OpLoad %6 %31 + %55 = OpCompositeConstruct %15 %29 %29 %29 %29 %29 %29 %29 %29 %29 %29 + OpStore %34 %55 + OpBranch %56 + %56 = OpLabel + %123 = OpPhi %6 %32 %9 %124 %59 + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %65 = OpSGreaterThanEqual %64 %123 %32 + %66 = OpLoad %6 %11 + %68 = OpSLessThan %64 %66 %67 + %69 = OpLogicalAnd %64 %65 %68 + OpBranchConditional %69 %57 %58 + %57 = OpLabel + %70 = OpLoad %6 %11 + %71 = OpIAdd %6 %70 %18 + OpStore %11 %71 + %73 = OpISub %6 %123 %18 + %74 = OpAccessChain %20 %34 %123 + %75 = OpLoad %6 %74 + %79 = OpAccessChain %10 %17 %75 + %80 = OpLoad %6 %79 + %81 = OpAccessChain %10 %17 %29 + OpStore %81 %80 + %85 = OpSGreaterThan %64 %75 %32 + OpSelectionMerge %87 None + OpBranchConditional %85 %86 %87 + %86 = OpLabel + %89 = OpIAdd %6 %73 %18 + %91 = OpAccessChain %20 %34 %89 + OpStore %91 %75 + OpBranch %87 + %87 = OpLabel + %124 = OpPhi %6 %73 %57 %89 %86 + OpBranch %59 + %59 = OpLabel + OpBranch %56 + %58 = OpLabel + OpReturnValue %123 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-array-struct-field-index-array-with-uniforms.amber b/vulkan/amber/graphicsfuzz/cov-loop-array-struct-field-index-array-with-uniforms.amber new file mode 100644 index 0000000..6f139fd --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-array-struct-field-index-array-with-uniforms.amber @@ -0,0 +1,301 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_5 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [5, 1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S +# { +# int data[5]; +# }; +# +# void main() +# { +# S obj = S(int[5](1, _int_1, _int_1, _int_1, _int_1)); +# int arr[5] = int[5](_int_0, _int_0, _int_0, _int_0, _int_0); +# +# for(int i = _int_0; i < _int_5; i++) +# { +# int a = _int_0; +# int b = arr[_int_1]; +# int c = _int_1; +# +# // Always true. +# if(obj.data[b] <= 1) +# { +# c++; +# } +# +# // arr[i] = 2 + i +# arr[a + i] = c + i; +# } +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Check the results and set the color to black if failed. +# for(int i = _int_0; i < _int_5; i++) +# { +# if(arr[i] != i + _int_2) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 133 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %90 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "S" + OpMemberName %10 0 "data" + OpName %12 "obj" + OpName %16 "buf0" + OpMemberName %16 0 "_GLF_uniform_int_values" + OpName %18 "" + OpName %32 "arr" + OpName %46 "i" + OpName %59 "a" + OpName %62 "b" + OpName %67 "c" + OpName %90 "_GLF_color" + OpName %104 "i" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %90 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 5 + %9 = OpTypeArray %6 %8 + %10 = OpTypeStruct %9 + %11 = OpTypePointer Function %10 + %13 = OpConstant %6 1 + %14 = OpConstant %7 4 + %15 = OpTypeArray %6 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpConstant %6 0 + %20 = OpTypePointer Uniform %6 + %31 = OpTypePointer Function %9 + %33 = OpConstant %6 2 + %45 = OpTypePointer Function %6 + %57 = OpTypeBool + %87 = OpTypeFloat 32 + %88 = OpTypeVector %87 4 + %89 = OpTypePointer Output %88 + %90 = OpVariable %89 Output + %120 = OpConstant %6 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpVariable %11 Function + %32 = OpVariable %31 Function + %46 = OpVariable %45 Function + %59 = OpVariable %45 Function + %62 = OpVariable %45 Function + %67 = OpVariable %45 Function + %104 = OpVariable %45 Function + %21 = OpAccessChain %20 %18 %19 %13 + %22 = OpLoad %6 %21 + %23 = OpAccessChain %20 %18 %19 %13 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %20 %18 %19 %13 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %20 %18 %19 %13 + %28 = OpLoad %6 %27 + %29 = OpCompositeConstruct %9 %13 %22 %24 %26 %28 + %30 = OpCompositeConstruct %10 %29 + OpStore %12 %30 + %34 = OpAccessChain %20 %18 %19 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %20 %18 %19 %33 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %20 %18 %19 %33 + %39 = OpLoad %6 %38 + %40 = OpAccessChain %20 %18 %19 %33 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %20 %18 %19 %33 + %43 = OpLoad %6 %42 + %44 = OpCompositeConstruct %9 %35 %37 %39 %41 %43 + OpStore %32 %44 + %47 = OpAccessChain %20 %18 %19 %33 + %48 = OpLoad %6 %47 + OpStore %46 %48 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %6 %46 + %55 = OpAccessChain %20 %18 %19 %19 + %56 = OpLoad %6 %55 + %58 = OpSLessThan %57 %54 %56 + OpBranchConditional %58 %50 %51 + %50 = OpLabel + %60 = OpAccessChain %20 %18 %19 %33 + %61 = OpLoad %6 %60 + OpStore %59 %61 + %63 = OpAccessChain %20 %18 %19 %13 + %64 = OpLoad %6 %63 + %65 = OpAccessChain %45 %32 %64 + %66 = OpLoad %6 %65 + OpStore %62 %66 + %68 = OpAccessChain %20 %18 %19 %13 + %69 = OpLoad %6 %68 + OpStore %67 %69 + %70 = OpLoad %6 %62 + %71 = OpAccessChain %45 %12 %19 %70 + %72 = OpLoad %6 %71 + %73 = OpSLessThanEqual %57 %72 %13 + OpSelectionMerge %75 None + OpBranchConditional %73 %74 %75 + %74 = OpLabel + %76 = OpLoad %6 %67 + %77 = OpIAdd %6 %76 %13 + OpStore %67 %77 + OpBranch %75 + %75 = OpLabel + %78 = OpLoad %6 %59 + %79 = OpLoad %6 %46 + %80 = OpIAdd %6 %78 %79 + %81 = OpLoad %6 %67 + %82 = OpLoad %6 %46 + %83 = OpIAdd %6 %81 %82 + %84 = OpAccessChain %45 %32 %80 + OpStore %84 %83 + OpBranch %52 + %52 = OpLabel + %85 = OpLoad %6 %46 + %86 = OpIAdd %6 %85 %13 + OpStore %46 %86 + OpBranch %49 + %51 = OpLabel + %91 = OpAccessChain %20 %18 %19 %13 + %92 = OpLoad %6 %91 + %93 = OpConvertSToF %87 %92 + %94 = OpAccessChain %20 %18 %19 %33 + %95 = OpLoad %6 %94 + %96 = OpConvertSToF %87 %95 + %97 = OpAccessChain %20 %18 %19 %33 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %87 %98 + %100 = OpAccessChain %20 %18 %19 %13 + %101 = OpLoad %6 %100 + %102 = OpConvertSToF %87 %101 + %103 = OpCompositeConstruct %88 %93 %96 %99 %102 + OpStore %90 %103 + %105 = OpAccessChain %20 %18 %19 %33 + %106 = OpLoad %6 %105 + OpStore %104 %106 + OpBranch %107 + %107 = OpLabel + OpLoopMerge %109 %110 None + OpBranch %111 + %111 = OpLabel + %112 = OpLoad %6 %104 + %113 = OpAccessChain %20 %18 %19 %19 + %114 = OpLoad %6 %113 + %115 = OpSLessThan %57 %112 %114 + OpBranchConditional %115 %108 %109 + %108 = OpLabel + %116 = OpLoad %6 %104 + %117 = OpAccessChain %45 %32 %116 + %118 = OpLoad %6 %117 + %119 = OpLoad %6 %104 + %121 = OpAccessChain %20 %18 %19 %120 + %122 = OpLoad %6 %121 + %123 = OpIAdd %6 %119 %122 + %124 = OpINotEqual %57 %118 %123 + OpSelectionMerge %126 None + OpBranchConditional %124 %125 %126 + %125 = OpLabel + %127 = OpAccessChain %20 %18 %19 %33 + %128 = OpLoad %6 %127 + %129 = OpConvertSToF %87 %128 + %130 = OpCompositeConstruct %88 %129 %129 %129 %129 + OpStore %90 %130 + OpBranch %126 + %126 = OpLabel + OpBranch %110 + %110 = OpLabel + %131 = OpLoad %6 %104 + %132 = OpIAdd %6 %131 %13 + OpStore %104 %132 + OpBranch %107 + %109 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 5 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-break-after-first-iteration-set-array-element.amber b/vulkan/amber/graphicsfuzz/cov-loop-break-after-first-iteration-set-array-element.amber new file mode 100644 index 0000000..0c4d4c8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-break-after-first-iteration-set-array-element.amber @@ -0,0 +1,363 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_5 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# // Contents of _GLF_uniform_int_values: [5, 1, 0, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[5] = int[5](_int_1, _int_1, _int_1, _int_1, _int_1); +# int a = _int_1; +# +# // This loop sets arr[1] = 2. +# do +# { +# int b = _int_0; +# +# // True after the first iteration. +# if(a > _int_1 && arr[a] == _int_1) +# { +# b++; +# } +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# continue; +# } +# +# // True after the first iteration. +# if(b == _int_1) +# { +# break; +# } +# else +# { +# // Executed during the first iteration. +# arr[a] = _int_2; +# a++; +# } +# } +# while(true); +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Check for expected results. +# int ref[5] = int[5](_int_1, _int_2, _int_1, _int_1, _int_1); +# for(int i = _int_0; i < _int_5; i++) +# { +# if(arr[i] != ref[i] || a != _int_2) +# { +# // Failure. +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 159 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %64 %98 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %32 "a" + OpName %39 "b" + OpName %64 "gl_FragCoord" + OpName %71 "buf0" + OpMemberName %71 0 "_GLF_uniform_float_values" + OpName %73 "" + OpName %98 "_GLF_color" + OpName %112 "ref" + OpName %124 "i" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %64 BuiltIn FragCoord + OpDecorate %70 ArrayStride 16 + OpMemberDecorate %71 0 Offset 0 + OpDecorate %71 Block + OpDecorate %73 DescriptorSet 0 + OpDecorate %73 Binding 0 + OpDecorate %98 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 5 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 4 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 1 + %19 = OpTypePointer Uniform %6 + %31 = OpTypePointer Function %6 + %40 = OpConstant %6 2 + %43 = OpTypeBool + %61 = OpTypeFloat 32 + %62 = OpTypeVector %61 4 + %63 = OpTypePointer Input %62 + %64 = OpVariable %63 Input + %65 = OpConstant %7 0 + %66 = OpTypePointer Input %61 + %69 = OpConstant %7 1 + %70 = OpTypeArray %61 %69 + %71 = OpTypeStruct %70 + %72 = OpTypePointer Uniform %71 + %73 = OpVariable %72 Uniform + %74 = OpTypePointer Uniform %61 + %90 = OpConstant %6 3 + %96 = OpConstantTrue %43 + %97 = OpTypePointer Output %62 + %98 = OpVariable %97 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %32 = OpVariable %31 Function + %39 = OpVariable %31 Function + %112 = OpVariable %10 Function + %124 = OpVariable %31 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %16 %17 %18 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %19 %16 %17 %18 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %19 %16 %17 %18 + %27 = OpLoad %6 %26 + %28 = OpAccessChain %19 %16 %17 %18 + %29 = OpLoad %6 %28 + %30 = OpCompositeConstruct %9 %21 %23 %25 %27 %29 + OpStore %11 %30 + %33 = OpAccessChain %19 %16 %17 %18 + %34 = OpLoad %6 %33 + OpStore %32 %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %36 + %36 = OpLabel + %41 = OpAccessChain %19 %16 %17 %40 + %42 = OpLoad %6 %41 + OpStore %39 %42 + %44 = OpLoad %6 %32 + %45 = OpAccessChain %19 %16 %17 %18 + %46 = OpLoad %6 %45 + %47 = OpSGreaterThan %43 %44 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %49 + %48 = OpLabel + %50 = OpLoad %6 %32 + %51 = OpAccessChain %31 %11 %50 + %52 = OpLoad %6 %51 + %53 = OpAccessChain %19 %16 %17 %18 + %54 = OpLoad %6 %53 + %55 = OpIEqual %43 %52 %54 + OpBranch %49 + %49 = OpLabel + %56 = OpPhi %43 %47 %36 %55 %48 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + %59 = OpLoad %6 %39 + %60 = OpIAdd %6 %59 %18 + OpStore %39 %60 + OpBranch %58 + %58 = OpLabel + %67 = OpAccessChain %66 %64 %65 + %68 = OpLoad %61 %67 + %75 = OpAccessChain %74 %73 %17 %17 + %76 = OpLoad %61 %75 + %77 = OpFOrdLessThan %43 %68 %76 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + OpBranch %38 + %79 = OpLabel + %81 = OpLoad %6 %39 + %82 = OpAccessChain %19 %16 %17 %18 + %83 = OpLoad %6 %82 + %84 = OpIEqual %43 %81 %83 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %88 + %85 = OpLabel + OpBranch %37 + %88 = OpLabel + %89 = OpLoad %6 %32 + %91 = OpAccessChain %19 %16 %17 %90 + %92 = OpLoad %6 %91 + %93 = OpAccessChain %31 %11 %89 + OpStore %93 %92 + %94 = OpLoad %6 %32 + %95 = OpIAdd %6 %94 %18 + OpStore %32 %95 + OpBranch %86 + %86 = OpLabel + OpBranch %38 + %38 = OpLabel + OpBranchConditional %96 %35 %37 + %37 = OpLabel + %99 = OpAccessChain %19 %16 %17 %18 + %100 = OpLoad %6 %99 + %101 = OpConvertSToF %61 %100 + %102 = OpAccessChain %19 %16 %17 %40 + %103 = OpLoad %6 %102 + %104 = OpConvertSToF %61 %103 + %105 = OpAccessChain %19 %16 %17 %40 + %106 = OpLoad %6 %105 + %107 = OpConvertSToF %61 %106 + %108 = OpAccessChain %19 %16 %17 %18 + %109 = OpLoad %6 %108 + %110 = OpConvertSToF %61 %109 + %111 = OpCompositeConstruct %62 %101 %104 %107 %110 + OpStore %98 %111 + %113 = OpAccessChain %19 %16 %17 %18 + %114 = OpLoad %6 %113 + %115 = OpAccessChain %19 %16 %17 %90 + %116 = OpLoad %6 %115 + %117 = OpAccessChain %19 %16 %17 %18 + %118 = OpLoad %6 %117 + %119 = OpAccessChain %19 %16 %17 %18 + %120 = OpLoad %6 %119 + %121 = OpAccessChain %19 %16 %17 %18 + %122 = OpLoad %6 %121 + %123 = OpCompositeConstruct %9 %114 %116 %118 %120 %122 + OpStore %112 %123 + %125 = OpAccessChain %19 %16 %17 %40 + %126 = OpLoad %6 %125 + OpStore %124 %126 + OpBranch %127 + %127 = OpLabel + OpLoopMerge %129 %130 None + OpBranch %131 + %131 = OpLabel + %132 = OpLoad %6 %124 + %133 = OpAccessChain %19 %16 %17 %17 + %134 = OpLoad %6 %133 + %135 = OpSLessThan %43 %132 %134 + OpBranchConditional %135 %128 %129 + %128 = OpLabel + %136 = OpLoad %6 %124 + %137 = OpAccessChain %31 %11 %136 + %138 = OpLoad %6 %137 + %139 = OpLoad %6 %124 + %140 = OpAccessChain %31 %112 %139 + %141 = OpLoad %6 %140 + %142 = OpINotEqual %43 %138 %141 + %143 = OpLogicalNot %43 %142 + OpSelectionMerge %145 None + OpBranchConditional %143 %144 %145 + %144 = OpLabel + %146 = OpLoad %6 %32 + %147 = OpAccessChain %19 %16 %17 %90 + %148 = OpLoad %6 %147 + %149 = OpINotEqual %43 %146 %148 + OpBranch %145 + %145 = OpLabel + %150 = OpPhi %43 %142 %128 %149 %144 + OpSelectionMerge %152 None + OpBranchConditional %150 %151 %152 + %151 = OpLabel + %153 = OpAccessChain %19 %16 %17 %40 + %154 = OpLoad %6 %153 + %155 = OpConvertSToF %61 %154 + %156 = OpCompositeConstruct %62 %155 %155 %155 %155 + OpStore %98 %156 + OpBranch %152 + %152 = OpLabel + OpBranch %130 + %130 = OpLabel + %157 = OpLoad %6 %124 + %158 = OpIAdd %6 %157 %18 + OpStore %124 %158 + OpBranch %127 + %129 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 5 1 0 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-break-floor-nan-never-executed.amber b/vulkan/amber/graphicsfuzz/cov-loop-break-floor-nan-never-executed.amber new file mode 100644 index 0000000..2ac7be0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-break-floor-nan-never-executed.amber @@ -0,0 +1,191 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# layout(location = 0) out highp vec4 _GLF_color; +# +# void main() +# { +# +# int a = 0; +# +# for (int i = 0; i < 5; i++) +# { +# // Always false. +# if (one == 0) +# { +# // intBitsToFloat produces NaN. Floor of NaN is undefined, but this +# // code is never executed. +# if (floor(intBitsToFloat(0xffc00000)) > 0.0) +# { +# a = -1; +# break; +# } +# } +# +# a++; +# } +# +# // Always true. +# if (a == 5) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %50 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %10 "i" + OpName %20 "buf0" + OpMemberName %20 0 "one" + OpName %22 "" + OpName %50 "_GLF_color" + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpDecorate %50 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpConstant %6 5 + %18 = OpTypeBool + %20 = OpTypeStruct %6 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpTypePointer Uniform %6 + %29 = OpConstant %6 -4194304 + %30 = OpTypeFloat 32 + %33 = OpConstant %30 0 + %37 = OpConstant %6 -1 + %40 = OpConstant %6 1 + %48 = OpTypeVector %30 4 + %49 = OpTypePointer Output %48 + %50 = OpVariable %49 Output + %51 = OpConstant %30 1 + %52 = OpConstantComposite %48 %51 %33 %33 %51 + %54 = OpConstantComposite %48 %33 %33 %33 %33 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %16 = OpLoad %6 %10 + %19 = OpSLessThan %18 %16 %17 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + %24 = OpAccessChain %23 %22 %9 + %25 = OpLoad %6 %24 + %26 = OpIEqual %18 %25 %9 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + %31 = OpBitcast %30 %29 + %32 = OpExtInst %30 %1 Floor %31 + %34 = OpFOrdGreaterThan %18 %32 %33 + OpSelectionMerge %36 None + OpBranchConditional %34 %35 %36 + %35 = OpLabel + OpStore %8 %37 + OpBranch %13 + %36 = OpLabel + OpBranch %28 + %28 = OpLabel + %39 = OpLoad %6 %8 + %41 = OpIAdd %6 %39 %40 + OpStore %8 %41 + OpBranch %14 + %14 = OpLabel + %42 = OpLoad %6 %10 + %43 = OpIAdd %6 %42 %40 + OpStore %10 %43 + OpBranch %11 + %13 = OpLabel + %44 = OpLoad %6 %8 + %45 = OpIEqual %18 %44 %17 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %53 + %46 = OpLabel + OpStore %50 %52 + OpBranch %47 + %53 = OpLabel + OpStore %50 %54 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 STD140 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-break-fragcoord-x-empty-loop.amber b/vulkan/amber/graphicsfuzz/cov-loop-break-fragcoord-x-empty-loop.amber new file mode 100644 index 0000000..0500273 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-break-fragcoord-x-empty-loop.amber @@ -0,0 +1,229 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_32 _GLF_uniform_int_values[2] +# #define _int_8 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 32, 8] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = 0; +# +# do +# { +# if(i <= int(gl_FragCoord.x)) +# { +# break; +# } +# +# // Iterates empty code block for seven times. +# for(int j = _int_1; j < _int_8; j++) { } +# +# i++; +# } +# while(i < 50); +# +# // Always true because of the framebuffer resolution of 32x32. +# if(i < _int_32) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 84 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %18 %65 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "i" + OpName %18 "gl_FragCoord" + OpName %30 "j" + OpName %33 "buf0" + OpMemberName %33 0 "_GLF_uniform_int_values" + OpName %35 "" + OpName %65 "_GLF_color" + OpDecorate %18 BuiltIn FragCoord + OpDecorate %32 ArrayStride 16 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 0 + OpDecorate %65 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %15 = OpTypeFloat 32 + %16 = OpTypeVector %15 4 + %17 = OpTypePointer Input %16 + %18 = OpVariable %17 Input + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 0 + %21 = OpTypePointer Input %15 + %25 = OpTypeBool + %31 = OpConstant %19 4 + %32 = OpTypeArray %6 %31 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpConstant %6 1 + %37 = OpTypePointer Uniform %6 + %46 = OpConstant %6 3 + %55 = OpConstant %6 50 + %58 = OpConstant %6 2 + %64 = OpTypePointer Output %16 + %65 = OpVariable %64 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %30 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %11 + %11 = OpLabel + %14 = OpLoad %6 %8 + %22 = OpAccessChain %21 %18 %20 + %23 = OpLoad %15 %22 + %24 = OpConvertFToS %6 %23 + %26 = OpSLessThanEqual %25 %14 %24 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + OpBranch %12 + %28 = OpLabel + %38 = OpAccessChain %37 %35 %9 %36 + %39 = OpLoad %6 %38 + OpStore %30 %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %6 %30 + %47 = OpAccessChain %37 %35 %9 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %25 %45 %48 + OpBranchConditional %49 %41 %42 + %41 = OpLabel + OpBranch %43 + %43 = OpLabel + %50 = OpLoad %6 %30 + %51 = OpIAdd %6 %50 %36 + OpStore %30 %51 + OpBranch %40 + %42 = OpLabel + %52 = OpLoad %6 %8 + %53 = OpIAdd %6 %52 %36 + OpStore %8 %53 + OpBranch %13 + %13 = OpLabel + %54 = OpLoad %6 %8 + %56 = OpSLessThan %25 %54 %55 + OpBranchConditional %56 %10 %12 + %12 = OpLabel + %57 = OpLoad %6 %8 + %59 = OpAccessChain %37 %35 %9 %58 + %60 = OpLoad %6 %59 + %61 = OpSLessThan %25 %57 %60 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %79 + %62 = OpLabel + %66 = OpAccessChain %37 %35 %9 %36 + %67 = OpLoad %6 %66 + %68 = OpConvertSToF %15 %67 + %69 = OpAccessChain %37 %35 %9 %9 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %15 %70 + %72 = OpAccessChain %37 %35 %9 %9 + %73 = OpLoad %6 %72 + %74 = OpConvertSToF %15 %73 + %75 = OpAccessChain %37 %35 %9 %36 + %76 = OpLoad %6 %75 + %77 = OpConvertSToF %15 %76 + %78 = OpCompositeConstruct %16 %68 %71 %74 %77 + OpStore %65 %78 + OpBranch %63 + %79 = OpLabel + %80 = OpAccessChain %37 %35 %9 %9 + %81 = OpLoad %6 %80 + %82 = OpConvertSToF %15 %81 + %83 = OpCompositeConstruct %16 %82 %82 %82 %82 + OpStore %65 %83 + OpBranch %63 + %63 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 32 8 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-clamp-to-one-empty-condition.amber b/vulkan/amber/graphicsfuzz/cov-loop-clamp-to-one-empty-condition.amber new file mode 100644 index 0000000..e8eb3c0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-clamp-to-one-empty-condition.amber @@ -0,0 +1,250 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_100 _GLF_uniform_int_values[2] +# #define _float_99_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_5_0 _GLF_uniform_float_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [99.0, 1.0, 5.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 100] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 100; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = _float_1_0; +# +# for (int i = _int_0; i < _int_100; i ++) +# { +# if (f > _float_1_0) +# { +# } +# +# f = 1.0; +# f = (1.0 - clamp(_float_5_0, 1.0, f)) + float(i); +# } +# +# // Always true. +# if (f == _float_99_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 88 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %68 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %12 "f" + OpName %16 "buf0" + OpMemberName %16 0 "_GLF_uniform_float_values" + OpName %18 "" + OpName %24 "i" + OpName %26 "buf1" + OpMemberName %26 0 "_GLF_uniform_int_values" + OpName %28 "" + OpName %68 "_GLF_color" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %25 ArrayStride 16 + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 1 + OpDecorate %68 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypePointer Function %10 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 3 + %15 = OpTypeArray %10 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpConstant %6 1 + %20 = OpTypePointer Uniform %10 + %23 = OpTypePointer Function %6 + %25 = OpTypeArray %6 %14 + %26 = OpTypeStruct %25 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpTypePointer Uniform %6 + %38 = OpConstant %6 2 + %41 = OpTypeBool + %49 = OpConstant %10 1 + %66 = OpTypeVector %10 4 + %67 = OpTypePointer Output %66 + %68 = OpVariable %67 Output + %87 = OpConstant %6 100 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpVariable %11 Function + %24 = OpVariable %23 Function + OpStore %8 %9 + %21 = OpAccessChain %20 %18 %9 %19 + %22 = OpLoad %10 %21 + OpStore %12 %22 + %30 = OpAccessChain %29 %28 %9 %19 + %31 = OpLoad %6 %30 + OpStore %24 %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %6 %24 + %39 = OpAccessChain %29 %28 %9 %38 + %40 = OpLoad %6 %39 + %42 = OpSLessThan %41 %37 %40 + OpBranchConditional %42 %33 %34 + %33 = OpLabel + %43 = OpLoad %10 %12 + %44 = OpAccessChain %20 %18 %9 %19 + %45 = OpLoad %10 %44 + %46 = OpFOrdGreaterThan %41 %43 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + OpBranch %48 + %48 = OpLabel + OpStore %12 %49 + %50 = OpAccessChain %20 %18 %9 %38 + %51 = OpLoad %10 %50 + %52 = OpLoad %10 %12 + %53 = OpExtInst %10 %1 FClamp %51 %49 %52 + %54 = OpFSub %10 %49 %53 + %55 = OpLoad %6 %24 + %56 = OpConvertSToF %10 %55 + %57 = OpFAdd %10 %54 %56 + OpStore %12 %57 + OpBranch %35 + %35 = OpLabel + %58 = OpLoad %6 %24 + %59 = OpIAdd %6 %58 %19 + OpStore %24 %59 + OpBranch %32 + %34 = OpLabel + %60 = OpLoad %10 %12 + %61 = OpAccessChain %20 %18 %9 %9 + %62 = OpLoad %10 %61 + %63 = OpFOrdEqual %41 %60 %62 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %82 + %64 = OpLabel + %69 = OpAccessChain %29 %28 %9 %9 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %10 %70 + %72 = OpAccessChain %29 %28 %9 %19 + %73 = OpLoad %6 %72 + %74 = OpConvertSToF %10 %73 + %75 = OpAccessChain %29 %28 %9 %19 + %76 = OpLoad %6 %75 + %77 = OpConvertSToF %10 %76 + %78 = OpAccessChain %29 %28 %9 %9 + %79 = OpLoad %6 %78 + %80 = OpConvertSToF %10 %79 + %81 = OpCompositeConstruct %66 %71 %74 %77 %80 + OpStore %68 %81 + OpBranch %65 + %82 = OpLabel + %83 = OpAccessChain %29 %28 %9 %19 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %10 %84 + %86 = OpCompositeConstruct %66 %85 %85 %85 %85 + OpStore %68 %86 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 100 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 99.0 1.0 5.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-condition-bitfield-extract-set-array-elements.amber b/vulkan/amber/graphicsfuzz/cov-loop-condition-bitfield-extract-set-array-elements.amber new file mode 100644 index 0000000..b777f63 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-condition-bitfield-extract-set-array-elements.amber @@ -0,0 +1,354 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_16 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _int_7 _GLF_uniform_int_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [16, 1, 0, 2, 7] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[16] = int[16](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1); +# +# // bitfieldExtract returns zero, making the loop iterate three times. +# for(int i = _int_2; i >= bitfieldExtract(_int_1, _int_1, _int_1); i--) +# { +# int a = _int_1; +# +# // True for the first iteration. +# if(arr[_int_1] == _int_1) +# { +# arr[a] = i; +# } +# +# for(int j = _int_2; j < _int_7; j++) +# { +# arr[j] = 0; +# } +# } +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# int ref[16] = int[16](_int_1, _int_2, _int_0, _int_0, _int_0, _int_0, _int_0, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1); +# +# // Check for the expected results. +# for(int i = _int_0; i < _int_16; i++) +# { +# if(arr[i] != ref[i]) +# { +# // Failure. +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 186 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %110 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %54 "i" + OpName %73 "a" + OpName %88 "j" + OpName %110 "_GLF_color" + OpName %125 "ref" + OpName %159 "i" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %110 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 16 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 5 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 1 + %19 = OpTypePointer Uniform %6 + %53 = OpTypePointer Function %6 + %55 = OpConstant %6 3 + %71 = OpTypeBool + %97 = OpConstant %6 4 + %107 = OpTypeFloat 32 + %108 = OpTypeVector %107 4 + %109 = OpTypePointer Output %108 + %110 = OpVariable %109 Output + %114 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %54 = OpVariable %53 Function + %73 = OpVariable %53 Function + %88 = OpVariable %53 Function + %125 = OpVariable %10 Function + %159 = OpVariable %53 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %16 %17 %18 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %19 %16 %17 %18 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %19 %16 %17 %18 + %27 = OpLoad %6 %26 + %28 = OpAccessChain %19 %16 %17 %18 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %19 %16 %17 %18 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %19 %16 %17 %18 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %19 %16 %17 %18 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %19 %16 %17 %18 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %19 %16 %17 %18 + %39 = OpLoad %6 %38 + %40 = OpAccessChain %19 %16 %17 %18 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %19 %16 %17 %18 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %19 %16 %17 %18 + %45 = OpLoad %6 %44 + %46 = OpAccessChain %19 %16 %17 %18 + %47 = OpLoad %6 %46 + %48 = OpAccessChain %19 %16 %17 %18 + %49 = OpLoad %6 %48 + %50 = OpAccessChain %19 %16 %17 %18 + %51 = OpLoad %6 %50 + %52 = OpCompositeConstruct %9 %21 %23 %25 %27 %29 %31 %33 %35 %37 %39 %41 %43 %45 %47 %49 %51 + OpStore %11 %52 + %56 = OpAccessChain %19 %16 %17 %55 + %57 = OpLoad %6 %56 + OpStore %54 %57 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %6 %54 + %64 = OpAccessChain %19 %16 %17 %18 + %65 = OpLoad %6 %64 + %66 = OpAccessChain %19 %16 %17 %18 + %67 = OpLoad %6 %66 + %68 = OpAccessChain %19 %16 %17 %18 + %69 = OpLoad %6 %68 + %70 = OpBitFieldSExtract %6 %65 %67 %69 + %72 = OpSGreaterThanEqual %71 %63 %70 + OpBranchConditional %72 %59 %60 + %59 = OpLabel + %74 = OpAccessChain %19 %16 %17 %18 + %75 = OpLoad %6 %74 + OpStore %73 %75 + %76 = OpAccessChain %19 %16 %17 %18 + %77 = OpLoad %6 %76 + %78 = OpAccessChain %53 %11 %77 + %79 = OpLoad %6 %78 + %80 = OpAccessChain %19 %16 %17 %18 + %81 = OpLoad %6 %80 + %82 = OpIEqual %71 %79 %81 + OpSelectionMerge %84 None + OpBranchConditional %82 %83 %84 + %83 = OpLabel + %85 = OpLoad %6 %73 + %86 = OpLoad %6 %54 + %87 = OpAccessChain %53 %11 %85 + OpStore %87 %86 + OpBranch %84 + %84 = OpLabel + %89 = OpAccessChain %19 %16 %17 %55 + %90 = OpLoad %6 %89 + OpStore %88 %90 + OpBranch %91 + %91 = OpLabel + OpLoopMerge %93 %94 None + OpBranch %95 + %95 = OpLabel + %96 = OpLoad %6 %88 + %98 = OpAccessChain %19 %16 %17 %97 + %99 = OpLoad %6 %98 + %100 = OpSLessThan %71 %96 %99 + OpBranchConditional %100 %92 %93 + %92 = OpLabel + %101 = OpLoad %6 %88 + %102 = OpAccessChain %53 %11 %101 + OpStore %102 %17 + OpBranch %94 + %94 = OpLabel + %103 = OpLoad %6 %88 + %104 = OpIAdd %6 %103 %18 + OpStore %88 %104 + OpBranch %91 + %93 = OpLabel + OpBranch %61 + %61 = OpLabel + %105 = OpLoad %6 %54 + %106 = OpISub %6 %105 %18 + OpStore %54 %106 + OpBranch %58 + %60 = OpLabel + %111 = OpAccessChain %19 %16 %17 %18 + %112 = OpLoad %6 %111 + %113 = OpConvertSToF %107 %112 + %115 = OpAccessChain %19 %16 %17 %114 + %116 = OpLoad %6 %115 + %117 = OpConvertSToF %107 %116 + %118 = OpAccessChain %19 %16 %17 %114 + %119 = OpLoad %6 %118 + %120 = OpConvertSToF %107 %119 + %121 = OpAccessChain %19 %16 %17 %18 + %122 = OpLoad %6 %121 + %123 = OpConvertSToF %107 %122 + %124 = OpCompositeConstruct %108 %113 %117 %120 %123 + OpStore %110 %124 + %126 = OpAccessChain %19 %16 %17 %18 + %127 = OpLoad %6 %126 + %128 = OpAccessChain %19 %16 %17 %55 + %129 = OpLoad %6 %128 + %130 = OpAccessChain %19 %16 %17 %114 + %131 = OpLoad %6 %130 + %132 = OpAccessChain %19 %16 %17 %114 + %133 = OpLoad %6 %132 + %134 = OpAccessChain %19 %16 %17 %114 + %135 = OpLoad %6 %134 + %136 = OpAccessChain %19 %16 %17 %114 + %137 = OpLoad %6 %136 + %138 = OpAccessChain %19 %16 %17 %114 + %139 = OpLoad %6 %138 + %140 = OpAccessChain %19 %16 %17 %18 + %141 = OpLoad %6 %140 + %142 = OpAccessChain %19 %16 %17 %18 + %143 = OpLoad %6 %142 + %144 = OpAccessChain %19 %16 %17 %18 + %145 = OpLoad %6 %144 + %146 = OpAccessChain %19 %16 %17 %18 + %147 = OpLoad %6 %146 + %148 = OpAccessChain %19 %16 %17 %18 + %149 = OpLoad %6 %148 + %150 = OpAccessChain %19 %16 %17 %18 + %151 = OpLoad %6 %150 + %152 = OpAccessChain %19 %16 %17 %18 + %153 = OpLoad %6 %152 + %154 = OpAccessChain %19 %16 %17 %18 + %155 = OpLoad %6 %154 + %156 = OpAccessChain %19 %16 %17 %18 + %157 = OpLoad %6 %156 + %158 = OpCompositeConstruct %9 %127 %129 %131 %133 %135 %137 %139 %141 %143 %145 %147 %149 %151 %153 %155 %157 + OpStore %125 %158 + %160 = OpAccessChain %19 %16 %17 %114 + %161 = OpLoad %6 %160 + OpStore %159 %161 + OpBranch %162 + %162 = OpLabel + OpLoopMerge %164 %165 None + OpBranch %166 + %166 = OpLabel + %167 = OpLoad %6 %159 + %168 = OpAccessChain %19 %16 %17 %17 + %169 = OpLoad %6 %168 + %170 = OpSLessThan %71 %167 %169 + OpBranchConditional %170 %163 %164 + %163 = OpLabel + %171 = OpLoad %6 %159 + %172 = OpAccessChain %53 %11 %171 + %173 = OpLoad %6 %172 + %174 = OpLoad %6 %159 + %175 = OpAccessChain %53 %125 %174 + %176 = OpLoad %6 %175 + %177 = OpINotEqual %71 %173 %176 + OpSelectionMerge %179 None + OpBranchConditional %177 %178 %179 + %178 = OpLabel + %180 = OpAccessChain %19 %16 %17 %114 + %181 = OpLoad %6 %180 + %182 = OpConvertSToF %107 %181 + %183 = OpCompositeConstruct %108 %182 %182 %182 %182 + OpStore %110 %183 + OpBranch %179 + %179 = OpLabel + OpBranch %165 + %165 = OpLabel + %184 = OpLoad %6 %159 + %185 = OpIAdd %6 %184 %18 + OpStore %159 %185 + OpBranch %162 + %164 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 16 1 0 2 7 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-condition-clamp-vec-of-ones.amber b/vulkan/amber/graphicsfuzz/cov-loop-condition-clamp-vec-of-ones.amber new file mode 100644 index 0000000..b6e4794 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-condition-clamp-vec-of-ones.amber @@ -0,0 +1,293 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--scalar-replacement=100' +# '--eliminate-dead-inserts' +# '--eliminate-local-multi-store' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--scalar-replacement=100' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--ccp' +# '--eliminate-local-single-store' +# '--scalar-replacement=100' +# '--convert-local-access-chains' +# '--ccp' +# '--reduce-load-size' +# '--eliminate-dead-branches' +# '--eliminate-local-single-block' +# '--redundancy-elimination' +# '--combine-access-chains' +# '--ccp' +# '--inline-entry-points-exhaustive' +# '--scalar-replacement=100' +# '--ccp' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_5 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.5] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of one: [1.0, 1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# vec2 one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = _float_1_0; +# +# // Iterated once. +# do +# { +# // Iterated once. +# for (int i = 0; i != clamp(_int_0, int(one.x), 2); i++) +# { +# // Always chooses 2.0, thus f becomes 0.5. +# f /= one.y > _float_1_0 ? 256.0 : 2.0; +# } +# } +# while(_float_1_0 > one.y); +# +# // Always true. +# if (f > _float_0_5 - 0.01 && f < _float_0_5 + 0.01) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 110 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %88 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %25 "i" + OpName %33 "buf0" + OpMemberName %33 0 "_GLF_uniform_int_values" + OpName %35 "" + OpName %41 "buf2" + OpMemberName %41 0 "one" + OpName %43 "" + OpName %88 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %32 ArrayStride 16 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 0 + OpMemberDecorate %41 0 Offset 0 + OpDecorate %41 Block + OpDecorate %43 DescriptorSet 0 + OpDecorate %43 Binding 2 + OpDecorate %88 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %24 = OpTypePointer Function %15 + %32 = OpTypeArray %15 %10 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpConstant %15 1 + %37 = OpTypePointer Uniform %15 + %40 = OpTypeVector %6 2 + %41 = OpTypeStruct %40 + %42 = OpTypePointer Uniform %41 + %43 = OpVariable %42 Uniform + %44 = OpConstant %9 0 + %48 = OpConstant %15 2 + %50 = OpTypeBool + %52 = OpConstant %9 1 + %58 = OpConstant %6 256 + %59 = OpConstant %6 2 + %73 = OpConstant %6 0.00999999978 + %86 = OpTypeVector %6 4 + %87 = OpTypePointer Output %86 + %88 = OpVariable %87 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %25 = OpVariable %24 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpBranch %20 + %20 = OpLabel + %109 = OpPhi %6 %19 %5 %108 %23 + OpStore %25 %16 + OpLoopMerge %22 %23 None + OpBranch %26 + %26 = OpLabel + %108 = OpPhi %6 %109 %20 %62 %27 + %107 = OpPhi %15 %16 %20 %64 %27 + %38 = OpAccessChain %37 %35 %16 %36 + %39 = OpLoad %15 %38 + %45 = OpAccessChain %17 %43 %16 %44 + %46 = OpLoad %6 %45 + %47 = OpConvertFToS %15 %46 + %49 = OpExtInst %15 %1 SClamp %39 %47 %48 + %51 = OpINotEqual %50 %107 %49 + OpLoopMerge %28 %27 None + OpBranchConditional %51 %27 %28 + %27 = OpLabel + %53 = OpAccessChain %17 %43 %16 %52 + %54 = OpLoad %6 %53 + %57 = OpFOrdGreaterThan %50 %54 %19 + %60 = OpSelect %6 %57 %58 %59 + %62 = OpFDiv %6 %108 %60 + OpStore %8 %62 + %64 = OpIAdd %15 %107 %36 + OpStore %25 %64 + OpBranch %26 + %28 = OpLabel + OpBranch %23 + %23 = OpLabel + %67 = OpAccessChain %17 %43 %16 %52 + %68 = OpLoad %6 %67 + %69 = OpFOrdGreaterThan %50 %19 %68 + OpBranchConditional %69 %20 %22 + %22 = OpLabel + %71 = OpAccessChain %17 %14 %16 %36 + %72 = OpLoad %6 %71 + %74 = OpFSub %6 %72 %73 + %75 = OpFOrdGreaterThan %50 %108 %74 + OpSelectionMerge %77 None + OpBranchConditional %75 %76 %77 + %76 = OpLabel + %81 = OpFAdd %6 %72 %73 + %82 = OpFOrdLessThan %50 %108 %81 + OpBranch %77 + %77 = OpLabel + %83 = OpPhi %50 %75 %22 %82 %76 + OpSelectionMerge %85 None + OpBranchConditional %83 %84 %102 + %84 = OpLabel + %89 = OpAccessChain %37 %35 %16 %16 + %90 = OpLoad %15 %89 + %91 = OpConvertSToF %6 %90 + %94 = OpConvertSToF %6 %39 + %101 = OpCompositeConstruct %86 %91 %94 %94 %91 + OpStore %88 %101 + OpBranch %85 + %102 = OpLabel + %105 = OpConvertSToF %6 %39 + %106 = OpCompositeConstruct %86 %105 %105 %105 %105 + OpStore %88 %106 + OpBranch %85 + %85 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE vec2 STD140 DATA + 1.0 1.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.5 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-condition-constant-struct-field-data.amber b/vulkan/amber/graphicsfuzz/cov-loop-condition-constant-struct-field-data.amber new file mode 100644 index 0000000..84dd1ba --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-condition-constant-struct-field-data.amber @@ -0,0 +1,232 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--if-conversion' +# '--redundancy-elimination' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# struct S +# { +# int data0; +# int data1; +# }; +# +# void main() +# { +# int a = _int_0; +# +# // Iterates once. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# // Iterates until the global loop count is reached. +# while(a != 1 && _GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# // a becomes 2. +# a = S(_int_1, 2).data1; +# } +# } +# +# // Always true. +# if(a == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %60 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %11 "a" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %48 "S" + OpMemberName %48 0 "data0" + OpMemberName %48 1 "data1" + OpName %60 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %60 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 3 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypePointer Uniform %6 + %27 = OpConstant %6 10 + %28 = OpTypeBool + %31 = OpConstant %6 1 + %47 = OpConstant %6 2 + %48 = OpTypeStruct %6 %6 + %57 = OpTypeFloat 32 + %58 = OpTypeVector %57 4 + %59 = OpTypePointer Output %58 + %60 = OpVariable %59 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + OpStore %8 %9 + %19 = OpAccessChain %18 %17 %9 %9 + %20 = OpLoad %6 %19 + OpStore %11 %20 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %6 %8 + %29 = OpSLessThan %28 %26 %27 + OpBranchConditional %29 %22 %23 + %22 = OpLabel + %30 = OpLoad %6 %8 + %32 = OpIAdd %6 %30 %31 + OpStore %8 %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %6 %11 + %39 = OpINotEqual %28 %38 %31 + %40 = OpLoad %6 %8 + %41 = OpSLessThan %28 %40 %27 + %42 = OpLogicalAnd %28 %39 %41 + OpBranchConditional %42 %34 %35 + %34 = OpLabel + %43 = OpLoad %6 %8 + %44 = OpIAdd %6 %43 %31 + OpStore %8 %44 + %45 = OpAccessChain %18 %17 %9 %31 + %46 = OpLoad %6 %45 + %49 = OpCompositeConstruct %48 %46 %47 + %50 = OpCompositeExtract %6 %49 1 + OpStore %11 %50 + OpBranch %36 + %36 = OpLabel + OpBranch %33 + %35 = OpLabel + OpBranch %24 + %24 = OpLabel + OpBranch %21 + %23 = OpLabel + %51 = OpLoad %6 %11 + %52 = OpAccessChain %18 %17 %9 %47 + %53 = OpLoad %6 %52 + %54 = OpIEqual %28 %51 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %74 + %55 = OpLabel + %61 = OpAccessChain %18 %17 %9 %31 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %57 %62 + %66 = OpConvertSToF %57 %20 + %73 = OpCompositeConstruct %58 %63 %66 %66 %63 + OpStore %60 %73 + OpBranch %56 + %74 = OpLabel + %77 = OpConvertSToF %57 %20 + %78 = OpCompositeConstruct %58 %77 %77 %77 %77 + OpStore %60 %78 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-condition-divide-by-uniform-always-false.amber b/vulkan/amber/graphicsfuzz/cov-loop-condition-divide-by-uniform-always-false.amber new file mode 100644 index 0000000..2266a37 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-condition-divide-by-uniform-always-false.amber @@ -0,0 +1,262 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of quarter: 0.25 +# layout(set = 0, binding = 2) uniform buf2 +# { +# float quarter; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# +# for(int i = 1; i < 9; i++) +# { +# for(int j = 1; j < 10; j++) +# { +# if(i > _int_1) +# { +# continue; +# } +# +# // Always false. +# if(_float_1_0 / quarter < _float_1_0) +# { +# return; +# } +# } +# } +# +# // The execution always reaches this point. +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 88 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %24 "i" + OpName %35 "j" + OpName %53 "buf0" + OpMemberName %53 0 "_GLF_uniform_float_values" + OpName %55 "" + OpName %59 "buf2" + OpMemberName %59 0 "quarter" + OpName %61 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %52 ArrayStride 16 + OpMemberDecorate %53 0 Offset 0 + OpDecorate %53 Block + OpDecorate %55 DescriptorSet 0 + OpDecorate %55 Binding 0 + OpMemberDecorate %59 0 Offset 0 + OpDecorate %59 Block + OpDecorate %61 DescriptorSet 0 + OpDecorate %61 Binding 2 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %23 = OpTypePointer Function %10 + %25 = OpConstant %10 1 + %32 = OpConstant %10 9 + %33 = OpTypeBool + %42 = OpConstant %10 10 + %51 = OpConstant %11 1 + %52 = OpTypeArray %6 %51 + %53 = OpTypeStruct %52 + %54 = OpTypePointer Uniform %53 + %55 = OpVariable %54 Uniform + %56 = OpTypePointer Uniform %6 + %59 = OpTypeStruct %6 + %60 = OpTypePointer Uniform %59 + %61 = OpVariable %60 Uniform + %4 = OpFunction %2 None %3 + %5 = OpLabel + %24 = OpVariable %23 Function + %35 = OpVariable %23 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %22 = OpCompositeConstruct %7 %21 %21 %21 %21 + OpStore %9 %22 + OpStore %24 %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %10 %24 + %34 = OpSLessThan %33 %31 %32 + OpBranchConditional %34 %27 %28 + %27 = OpLabel + OpStore %35 %25 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %10 %35 + %43 = OpSLessThan %33 %41 %42 + OpBranchConditional %43 %37 %38 + %37 = OpLabel + %44 = OpLoad %10 %24 + %45 = OpAccessChain %18 %16 %17 %25 + %46 = OpLoad %10 %45 + %47 = OpSGreaterThan %33 %44 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %49 + %48 = OpLabel + OpBranch %39 + %49 = OpLabel + %57 = OpAccessChain %56 %55 %17 %17 + %58 = OpLoad %6 %57 + %62 = OpAccessChain %56 %61 %17 + %63 = OpLoad %6 %62 + %64 = OpFDiv %6 %58 %63 + %65 = OpAccessChain %56 %55 %17 %17 + %66 = OpLoad %6 %65 + %67 = OpFOrdLessThan %33 %64 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %69 + %68 = OpLabel + OpReturn + %69 = OpLabel + OpBranch %39 + %39 = OpLabel + %71 = OpLoad %10 %35 + %72 = OpIAdd %10 %71 %25 + OpStore %35 %72 + OpBranch %36 + %38 = OpLabel + OpBranch %29 + %29 = OpLabel + %73 = OpLoad %10 %24 + %74 = OpIAdd %10 %73 %25 + OpStore %24 %74 + OpBranch %26 + %28 = OpLabel + %75 = OpAccessChain %18 %16 %17 %25 + %76 = OpLoad %10 %75 + %77 = OpConvertSToF %6 %76 + %78 = OpAccessChain %18 %16 %17 %17 + %79 = OpLoad %10 %78 + %80 = OpConvertSToF %6 %79 + %81 = OpAccessChain %18 %16 %17 %17 + %82 = OpLoad %10 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpAccessChain %18 %16 %17 %25 + %85 = OpLoad %10 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpCompositeConstruct %7 %77 %80 %83 %86 + OpStore %9 %87 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# quarter +BUFFER variant_quarter DATA_TYPE float STD140 DATA + 0.25 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_quarter AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-condition-double-negate.amber b/vulkan/amber/graphicsfuzz/cov-loop-condition-double-negate.amber new file mode 100644 index 0000000..c4cf953 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-condition-double-negate.amber @@ -0,0 +1,251 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_6 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _int_5 _GLF_uniform_int_values[4] +# #define _int_4 _GLF_uniform_int_values[5] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 6, 2, 5, 4] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[6]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[3] = int[3](_int_2, _int_4, _int_6); +# int index = 1; +# +# // Iterates once. The condition simplifies to +# // _int_1 == 1 && index <= 1. +# while (!(true && ! (_int_1 == 1 && index <= 1))) +# { +# arr[index]++; +# index++; +# } +# +# // Always true +# if (arr[_int_0] == _int_2 && arr[_int_1] == _int_5 && arr[_int_2] == _int_6) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 108 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %89 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %30 "index" + OpName %89 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %89 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 3 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 6 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 3 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 5 + %25 = OpConstant %6 2 + %29 = OpTypePointer Function %6 + %31 = OpConstant %6 1 + %37 = OpTypeBool + %38 = OpConstantTrue %37 + %69 = OpConstant %6 4 + %86 = OpTypeFloat 32 + %87 = OpTypeVector %86 4 + %88 = OpTypePointer Output %87 + %89 = OpVariable %88 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %30 = OpVariable %29 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %19 %16 %17 %22 + %24 = OpLoad %6 %23 + %26 = OpAccessChain %19 %16 %17 %25 + %27 = OpLoad %6 %26 + %28 = OpCompositeConstruct %9 %21 %24 %27 + OpStore %11 %28 + OpStore %30 %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + %41 = OpAccessChain %19 %16 %17 %17 + %42 = OpLoad %6 %41 + %43 = OpIEqual %37 %42 %31 + %44 = OpLoad %6 %30 + %45 = OpSLessThanEqual %37 %44 %31 + %46 = OpLogicalAnd %37 %43 %45 + %47 = OpLogicalNot %37 %46 + OpBranch %40 + %40 = OpLabel + %48 = OpPhi %37 %38 %36 %47 %39 + %49 = OpLogicalNot %37 %48 + OpBranchConditional %49 %33 %34 + %33 = OpLabel + %50 = OpLoad %6 %30 + %51 = OpAccessChain %29 %11 %50 + %52 = OpLoad %6 %51 + %53 = OpIAdd %6 %52 %31 + OpStore %51 %53 + %54 = OpLoad %6 %30 + %55 = OpIAdd %6 %54 %31 + OpStore %30 %55 + OpBranch %35 + %35 = OpLabel + OpBranch %32 + %34 = OpLabel + %56 = OpAccessChain %19 %16 %17 %31 + %57 = OpLoad %6 %56 + %58 = OpAccessChain %29 %11 %57 + %59 = OpLoad %6 %58 + %60 = OpAccessChain %19 %16 %17 %18 + %61 = OpLoad %6 %60 + %62 = OpIEqual %37 %59 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %64 + %63 = OpLabel + %65 = OpAccessChain %19 %16 %17 %17 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %29 %11 %66 + %68 = OpLoad %6 %67 + %70 = OpAccessChain %19 %16 %17 %69 + %71 = OpLoad %6 %70 + %72 = OpIEqual %37 %68 %71 + OpBranch %64 + %64 = OpLabel + %73 = OpPhi %37 %62 %34 %72 %63 + OpSelectionMerge %75 None + OpBranchConditional %73 %74 %75 + %74 = OpLabel + %76 = OpAccessChain %19 %16 %17 %18 + %77 = OpLoad %6 %76 + %78 = OpAccessChain %29 %11 %77 + %79 = OpLoad %6 %78 + %80 = OpAccessChain %19 %16 %17 %25 + %81 = OpLoad %6 %80 + %82 = OpIEqual %37 %79 %81 + OpBranch %75 + %75 = OpLabel + %83 = OpPhi %37 %73 %64 %82 %74 + OpSelectionMerge %85 None + OpBranchConditional %83 %84 %103 + %84 = OpLabel + %90 = OpAccessChain %19 %16 %17 %17 + %91 = OpLoad %6 %90 + %92 = OpConvertSToF %86 %91 + %93 = OpAccessChain %19 %16 %17 %31 + %94 = OpLoad %6 %93 + %95 = OpConvertSToF %86 %94 + %96 = OpAccessChain %19 %16 %17 %31 + %97 = OpLoad %6 %96 + %98 = OpConvertSToF %86 %97 + %99 = OpAccessChain %19 %16 %17 %17 + %100 = OpLoad %6 %99 + %101 = OpConvertSToF %86 %100 + %102 = OpCompositeConstruct %87 %92 %95 %98 %101 + OpStore %89 %102 + OpBranch %85 + %103 = OpLabel + %104 = OpAccessChain %19 %16 %17 %31 + %105 = OpLoad %6 %104 + %106 = OpConvertSToF %86 %105 + %107 = OpCompositeConstruct %87 %106 %106 %106 %106 + OpStore %89 %107 + OpBranch %85 + %85 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 6 2 5 4 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-condition-filter-some-iterations-never-discard.amber b/vulkan/amber/graphicsfuzz/cov-loop-condition-filter-some-iterations-never-discard.amber new file mode 100644 index 0000000..c81bb6d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-condition-filter-some-iterations-never-discard.amber @@ -0,0 +1,191 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_5 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [5, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# for(int i = _int_0; i < _int_5; i++) +# { +# if(i != 1) +# { +# if(i != 2) +# { +# // Always false. +# if(gl_FragCoord.x < 0.0) +# { +# discard; +# } +# else +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %42 %54 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %42 "gl_FragCoord" + OpName %54 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %42 BuiltIn FragCoord + OpDecorate %54 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %28 = OpTypeBool + %35 = OpConstant %6 2 + %39 = OpTypeFloat 32 + %40 = OpTypeVector %39 4 + %41 = OpTypePointer Input %40 + %42 = OpVariable %41 Input + %43 = OpConstant %9 0 + %44 = OpTypePointer Input %39 + %47 = OpConstant %39 0 + %53 = OpTypePointer Output %40 + %54 = OpVariable %53 Output + %55 = OpConstant %39 1 + %56 = OpConstantComposite %40 %55 %47 %47 %55 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %6 %8 + %26 = OpAccessChain %17 %14 %15 %15 + %27 = OpLoad %6 %26 + %29 = OpSLessThan %28 %25 %27 + OpBranchConditional %29 %21 %22 + %21 = OpLabel + %30 = OpLoad %6 %8 + %31 = OpINotEqual %28 %30 %16 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %33 + %32 = OpLabel + %34 = OpLoad %6 %8 + %36 = OpINotEqual %28 %34 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + %45 = OpAccessChain %44 %42 %43 + %46 = OpLoad %39 %45 + %48 = OpFOrdLessThan %28 %46 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %52 + %49 = OpLabel + OpTerminateInvocation + %52 = OpLabel + OpStore %54 %56 + OpBranch %50 + %50 = OpLabel + OpBranch %38 + %38 = OpLabel + OpBranch %33 + %33 = OpLabel + OpBranch %23 + %23 = OpLabel + %57 = OpLoad %6 %8 + %58 = OpIAdd %6 %57 %16 + OpStore %8 %58 + OpBranch %20 + %22 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 5 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-condition-increment-integer-fallback-global-counter.amber b/vulkan/amber/graphicsfuzz/cov-loop-condition-increment-integer-fallback-global-counter.amber new file mode 100644 index 0000000..826eb03 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-condition-increment-integer-fallback-global-counter.amber @@ -0,0 +1,238 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 5; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = 1; +# +# // Loops until the global loop bound is reached. +# do +# { +# _GLF_global_loop_count++; +# +# // Always true. +# if(gl_FragCoord.y > 0.0) +# { +# float f = _float_1_0; +# modf(_float_1_0, f); +# i++; +# } +# +# // During the first iteration i becomes 3, making the i != 2 below always true. +# i++; +# } +# while(i != 2 && _GLF_global_loop_count < _GLF_global_loop_bound); +# +# // Always true. +# if(i == 11) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 90 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %22 %62 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %22 "gl_FragCoord" + OpName %34 "f" + OpName %36 "buf0" + OpMemberName %36 0 "_GLF_uniform_float_values" + OpName %38 "" + OpName %62 "_GLF_color" + OpName %65 "buf1" + OpMemberName %65 0 "_GLF_uniform_int_values" + OpName %67 "" + OpDecorate %22 BuiltIn FragCoord + OpDecorate %35 ArrayStride 16 + OpMemberDecorate %36 0 Offset 0 + OpDecorate %36 Block + OpDecorate %38 DescriptorSet 0 + OpDecorate %38 Binding 0 + OpDecorate %62 Location 0 + OpDecorate %64 ArrayStride 16 + OpMemberDecorate %65 0 Offset 0 + OpDecorate %65 Block + OpDecorate %67 DescriptorSet 0 + OpDecorate %67 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpConstant %6 0 + %12 = OpConstant %6 1 + %19 = OpTypeFloat 32 + %20 = OpTypeVector %19 4 + %21 = OpTypePointer Input %20 + %22 = OpVariable %21 Input + %23 = OpTypeInt 32 0 + %24 = OpConstant %23 1 + %25 = OpTypePointer Input %19 + %28 = OpConstant %19 0 + %29 = OpTypeBool + %33 = OpTypePointer Function %19 + %35 = OpTypeArray %19 %24 + %36 = OpTypeStruct %35 + %37 = OpTypePointer Uniform %36 + %38 = OpVariable %37 Uniform + %39 = OpTypePointer Uniform %19 + %50 = OpConstant %6 2 + %53 = OpConstant %6 5 + %57 = OpConstant %6 11 + %61 = OpTypePointer Output %20 + %62 = OpVariable %61 Output + %63 = OpConstant %23 2 + %64 = OpTypeArray %6 %63 + %65 = OpTypeStruct %64 + %66 = OpTypePointer Uniform %65 + %67 = OpVariable %66 Uniform + %68 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %34 = OpVariable %33 Function + OpBranch %13 + %13 = OpLabel + %88 = OpPhi %6 %12 %5 %48 %16 + %87 = OpPhi %6 %9 %5 %18 %16 + OpLoopMerge %15 %16 None + OpBranch %14 + %14 = OpLabel + %18 = OpIAdd %6 %87 %12 + %26 = OpAccessChain %25 %22 %24 + %27 = OpLoad %19 %26 + %30 = OpFOrdGreaterThan %29 %27 %28 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + %42 = OpAccessChain %39 %38 %9 %9 + %43 = OpLoad %19 %42 + %44 = OpExtInst %19 %1 Modf %43 %34 + %46 = OpIAdd %6 %88 %12 + OpBranch %32 + %32 = OpLabel + %89 = OpPhi %6 %88 %14 %46 %31 + %48 = OpIAdd %6 %89 %12 + OpBranch %16 + %16 = OpLabel + %51 = OpINotEqual %29 %48 %50 + %54 = OpSLessThan %29 %18 %53 + %55 = OpLogicalAnd %29 %51 %54 + OpBranchConditional %55 %13 %15 + %15 = OpLabel + %58 = OpIEqual %29 %48 %57 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %82 + %59 = OpLabel + %69 = OpAccessChain %68 %67 %9 %9 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %19 %70 + %72 = OpAccessChain %68 %67 %9 %12 + %73 = OpLoad %6 %72 + %74 = OpConvertSToF %19 %73 + %81 = OpCompositeConstruct %20 %71 %74 %74 %71 + OpStore %62 %81 + OpBranch %60 + %82 = OpLabel + %83 = OpAccessChain %68 %67 %9 %12 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %19 %84 + %86 = OpCompositeConstruct %20 %85 %85 %85 %85 + OpStore %62 %86 + OpBranch %60 + %60 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-condition-logical-or-never-iterated.amber b/vulkan/amber/graphicsfuzz/cov-loop-condition-logical-or-never-iterated.amber new file mode 100644 index 0000000..b8522e1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-condition-logical-or-never-iterated.amber @@ -0,0 +1,192 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# // Never iterated. +# for(int i = _int_0; (_int_1 | i) < 1; i++) +# { +# a++; +# } +# +# // Always true. +# if(a == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 66 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %47 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %47 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %32 = OpTypeBool + %44 = OpTypeFloat 32 + %45 = OpTypeVector %44 4 + %46 = OpTypePointer Output %45 + %47 = OpVariable %46 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %21 = OpAccessChain %17 %14 %15 %16 + %22 = OpLoad %6 %21 + OpStore %20 %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpAccessChain %17 %14 %15 %15 + %29 = OpLoad %6 %28 + %30 = OpLoad %6 %20 + %31 = OpBitwiseOr %6 %29 %30 + %33 = OpSLessThan %32 %31 %16 + OpBranchConditional %33 %24 %25 + %24 = OpLabel + %34 = OpLoad %6 %8 + %35 = OpIAdd %6 %34 %16 + OpStore %8 %35 + OpBranch %26 + %26 = OpLabel + %36 = OpLoad %6 %20 + %37 = OpIAdd %6 %36 %16 + OpStore %20 %37 + OpBranch %23 + %25 = OpLabel + %38 = OpLoad %6 %8 + %39 = OpAccessChain %17 %14 %15 %16 + %40 = OpLoad %6 %39 + %41 = OpIEqual %32 %38 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %61 + %42 = OpLabel + %48 = OpAccessChain %17 %14 %15 %15 + %49 = OpLoad %6 %48 + %50 = OpConvertSToF %44 %49 + %51 = OpAccessChain %17 %14 %15 %16 + %52 = OpLoad %6 %51 + %53 = OpConvertSToF %44 %52 + %54 = OpAccessChain %17 %14 %15 %16 + %55 = OpLoad %6 %54 + %56 = OpConvertSToF %44 %55 + %57 = OpAccessChain %17 %14 %15 %15 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %44 %58 + %60 = OpCompositeConstruct %45 %50 %53 %56 %59 + OpStore %47 %60 + OpBranch %43 + %61 = OpLabel + %62 = OpAccessChain %17 %14 %15 %16 + %63 = OpLoad %6 %62 + %64 = OpConvertSToF %44 %63 + %65 = OpCompositeConstruct %45 %64 %64 %64 %64 + OpStore %47 %65 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-construct-vec4-from-vec4-clamp-same-min-max.amber b/vulkan/amber/graphicsfuzz/cov-loop-construct-vec4-from-vec4-clamp-same-min-max.amber new file mode 100644 index 0000000..770ee3c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-construct-vec4-from-vec4-clamp-same-min-max.amber @@ -0,0 +1,279 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_4 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _int_3 _GLF_uniform_int_values[4] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [4, 0, 1, 2, 3] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v = vec4(_int_0, _int_1, _int_2, _int_3); +# +# for(int i = _int_0; i < _int_4; i++) +# { +# // True for i = 2 and 3. +# if(vec4(v)[i] > _float_1_0) +# { +# // Same as v[i] = v[1]; +# v[i] = clamp(vec4(_float_1_0), v, v)[_int_1]; +# } +# } +# +# // Always true. +# if(v == vec4(_int_0, _int_1, _int_1, _int_1)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 122 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %103 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %37 "i" + OpName %60 "buf0" + OpMemberName %60 0 "_GLF_uniform_float_values" + OpName %62 "" + OpName %103 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %59 ArrayStride 16 + OpMemberDecorate %60 0 Offset 0 + OpDecorate %60 Block + OpDecorate %62 DescriptorSet 0 + OpDecorate %62 Binding 0 + OpDecorate %103 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 5 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpConstant %10 1 + %19 = OpTypePointer Uniform %10 + %23 = OpConstant %10 2 + %27 = OpConstant %10 3 + %31 = OpConstant %10 4 + %36 = OpTypePointer Function %10 + %48 = OpTypeBool + %58 = OpConstant %11 1 + %59 = OpTypeArray %6 %58 + %60 = OpTypeStruct %59 + %61 = OpTypePointer Uniform %60 + %62 = OpVariable %61 Uniform + %63 = OpTypePointer Uniform %6 + %79 = OpTypePointer Function %6 + %97 = OpTypeVector %48 4 + %102 = OpTypePointer Output %7 + %103 = OpVariable %102 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %37 = OpVariable %36 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %10 %20 + %22 = OpConvertSToF %6 %21 + %24 = OpAccessChain %19 %16 %17 %23 + %25 = OpLoad %10 %24 + %26 = OpConvertSToF %6 %25 + %28 = OpAccessChain %19 %16 %17 %27 + %29 = OpLoad %10 %28 + %30 = OpConvertSToF %6 %29 + %32 = OpAccessChain %19 %16 %17 %31 + %33 = OpLoad %10 %32 + %34 = OpConvertSToF %6 %33 + %35 = OpCompositeConstruct %7 %22 %26 %30 %34 + OpStore %9 %35 + %38 = OpAccessChain %19 %16 %17 %18 + %39 = OpLoad %10 %38 + OpStore %37 %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %10 %37 + %46 = OpAccessChain %19 %16 %17 %17 + %47 = OpLoad %10 %46 + %49 = OpSLessThan %48 %45 %47 + OpBranchConditional %49 %41 %42 + %41 = OpLabel + %50 = OpLoad %7 %9 + %51 = OpCompositeExtract %6 %50 0 + %52 = OpCompositeExtract %6 %50 1 + %53 = OpCompositeExtract %6 %50 2 + %54 = OpCompositeExtract %6 %50 3 + %55 = OpCompositeConstruct %7 %51 %52 %53 %54 + %56 = OpLoad %10 %37 + %57 = OpVectorExtractDynamic %6 %55 %56 + %64 = OpAccessChain %63 %62 %17 %17 + %65 = OpLoad %6 %64 + %66 = OpFOrdGreaterThan %48 %57 %65 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %68 + %67 = OpLabel + %69 = OpLoad %10 %37 + %70 = OpAccessChain %63 %62 %17 %17 + %71 = OpLoad %6 %70 + %72 = OpCompositeConstruct %7 %71 %71 %71 %71 + %73 = OpLoad %7 %9 + %74 = OpLoad %7 %9 + %75 = OpExtInst %7 %1 FClamp %72 %73 %74 + %76 = OpAccessChain %19 %16 %17 %23 + %77 = OpLoad %10 %76 + %78 = OpVectorExtractDynamic %6 %75 %77 + %80 = OpAccessChain %79 %9 %69 + OpStore %80 %78 + OpBranch %68 + %68 = OpLabel + OpBranch %43 + %43 = OpLabel + %81 = OpLoad %10 %37 + %82 = OpIAdd %10 %81 %18 + OpStore %37 %82 + OpBranch %40 + %42 = OpLabel + %83 = OpLoad %7 %9 + %84 = OpAccessChain %19 %16 %17 %18 + %85 = OpLoad %10 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpAccessChain %19 %16 %17 %23 + %88 = OpLoad %10 %87 + %89 = OpConvertSToF %6 %88 + %90 = OpAccessChain %19 %16 %17 %23 + %91 = OpLoad %10 %90 + %92 = OpConvertSToF %6 %91 + %93 = OpAccessChain %19 %16 %17 %23 + %94 = OpLoad %10 %93 + %95 = OpConvertSToF %6 %94 + %96 = OpCompositeConstruct %7 %86 %89 %92 %95 + %98 = OpFOrdEqual %97 %83 %96 + %99 = OpAll %48 %98 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %117 + %100 = OpLabel + %104 = OpAccessChain %19 %16 %17 %23 + %105 = OpLoad %10 %104 + %106 = OpConvertSToF %6 %105 + %107 = OpAccessChain %19 %16 %17 %18 + %108 = OpLoad %10 %107 + %109 = OpConvertSToF %6 %108 + %110 = OpAccessChain %19 %16 %17 %18 + %111 = OpLoad %10 %110 + %112 = OpConvertSToF %6 %111 + %113 = OpAccessChain %19 %16 %17 %23 + %114 = OpLoad %10 %113 + %115 = OpConvertSToF %6 %114 + %116 = OpCompositeConstruct %7 %106 %109 %112 %115 + OpStore %103 %116 + OpBranch %101 + %117 = OpLabel + %118 = OpAccessChain %19 %16 %17 %18 + %119 = OpLoad %10 %118 + %120 = OpConvertSToF %6 %119 + %121 = OpCompositeConstruct %7 %120 %120 %120 %120 + OpStore %103 %121 + OpBranch %101 + %101 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 4 0 1 2 3 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-decrease-integer-never-break.amber b/vulkan/amber/graphicsfuzz/cov-loop-decrease-integer-never-break.amber new file mode 100644 index 0000000..458eccd --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-decrease-integer-never-break.amber @@ -0,0 +1,169 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# // Contents of one: 1 +# layout(push_constant) uniform buf_push +# { +# int one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 100; +# +# do +# { +# // Always false. +# if(one < 1) +# { +# break; +# } +# +# a--; +# } +# while(a > 1); +# +# // Always true. +# if(a == 1) +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# else +# { +# _GLF_color = vec4(0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 44 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %38 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %14 "buf_push" + OpMemberName %14 0 "one" + OpName %16 "" + OpName %38 "_GLF_color" + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %38 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 100 + %14 = OpTypeStruct %6 + %15 = OpTypePointer PushConstant %14 + %16 = OpVariable %15 PushConstant + %17 = OpConstant %6 0 + %18 = OpTypePointer PushConstant %6 + %21 = OpConstant %6 1 + %22 = OpTypeBool + %35 = OpTypeFloat 32 + %36 = OpTypeVector %35 4 + %37 = OpTypePointer Output %36 + %38 = OpVariable %37 Output + %39 = OpConstant %35 1 + %40 = OpConstant %35 0 + %41 = OpConstantComposite %36 %39 %40 %40 %39 + %43 = OpConstantComposite %36 %40 %40 %40 %40 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %11 + %11 = OpLabel + %19 = OpAccessChain %18 %16 %17 + %20 = OpLoad %6 %19 + %23 = OpSLessThan %22 %20 %21 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + OpBranch %12 + %25 = OpLabel + %27 = OpLoad %6 %8 + %28 = OpISub %6 %27 %21 + OpStore %8 %28 + OpBranch %13 + %13 = OpLabel + %29 = OpLoad %6 %8 + %30 = OpSGreaterThan %22 %29 %21 + OpBranchConditional %30 %10 %12 + %12 = OpLabel + %31 = OpLoad %6 %8 + %32 = OpIEqual %22 %31 %21 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %42 + %33 = OpLabel + OpStore %38 %41 + OpBranch %34 + %42 = OpLabel + OpStore %38 %43 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 STD140 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS push_constant +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-decrease-vector-component-only-first-iteration.amber b/vulkan/amber/graphicsfuzz/cov-loop-decrease-vector-component-only-first-iteration.amber new file mode 100644 index 0000000..fa386ec --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-decrease-vector-component-only-first-iteration.amber @@ -0,0 +1,211 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# ivec2 p = ivec2(1); +# +# // Iterates three times. +# for(int i = 3; i > 0; i--) +# { +# // Iterates once when i == 3. +# while (p.x > 0) +# { +# p.x -= 16; +# } +# } +# +# // Always true. +# if(p.x == -15) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %50 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "p" + OpName %13 "i" + OpName %50 "_GLF_color" + OpName %53 "buf0" + OpMemberName %53 0 "_GLF_uniform_int_values" + OpName %55 "" + OpDecorate %50 Location 0 + OpDecorate %52 ArrayStride 16 + OpMemberDecorate %53 0 Offset 0 + OpDecorate %53 Block + OpDecorate %55 DescriptorSet 0 + OpDecorate %55 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstantComposite %7 %10 %10 + %12 = OpTypePointer Function %6 + %14 = OpConstant %6 3 + %21 = OpConstant %6 0 + %22 = OpTypeBool + %29 = OpTypeInt 32 0 + %30 = OpConstant %29 0 + %34 = OpConstant %6 16 + %43 = OpConstant %6 -15 + %47 = OpTypeFloat 32 + %48 = OpTypeVector %47 4 + %49 = OpTypePointer Output %48 + %50 = OpVariable %49 Output + %51 = OpConstant %29 2 + %52 = OpTypeArray %6 %51 + %53 = OpTypeStruct %52 + %54 = OpTypePointer Uniform %53 + %55 = OpVariable %54 Uniform + %56 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %13 = OpVariable %12 Function + OpStore %9 %11 + OpStore %13 %14 + OpBranch %15 + %15 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %20 = OpLoad %6 %13 + %23 = OpSGreaterThan %22 %20 %21 + OpBranchConditional %23 %16 %17 + %16 = OpLabel + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %31 = OpAccessChain %12 %9 %30 + %32 = OpLoad %6 %31 + %33 = OpSGreaterThan %22 %32 %21 + OpBranchConditional %33 %25 %26 + %25 = OpLabel + %35 = OpAccessChain %12 %9 %30 + %36 = OpLoad %6 %35 + %37 = OpISub %6 %36 %34 + %38 = OpAccessChain %12 %9 %30 + OpStore %38 %37 + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %18 + %18 = OpLabel + %39 = OpLoad %6 %13 + %40 = OpISub %6 %39 %10 + OpStore %13 %40 + OpBranch %15 + %17 = OpLabel + %41 = OpAccessChain %12 %9 %30 + %42 = OpLoad %6 %41 + %44 = OpIEqual %22 %42 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %45 %70 + %45 = OpLabel + %57 = OpAccessChain %56 %55 %21 %21 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %47 %58 + %60 = OpAccessChain %56 %55 %21 %10 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %47 %61 + %63 = OpAccessChain %56 %55 %21 %10 + %64 = OpLoad %6 %63 + %65 = OpConvertSToF %47 %64 + %66 = OpAccessChain %56 %55 %21 %21 + %67 = OpLoad %6 %66 + %68 = OpConvertSToF %47 %67 + %69 = OpCompositeConstruct %48 %59 %62 %65 %68 + OpStore %50 %69 + OpBranch %46 + %70 = OpLabel + %71 = OpAccessChain %56 %55 %21 %10 + %72 = OpLoad %6 %71 + %73 = OpConvertSToF %47 %72 + %74 = OpCompositeConstruct %48 %73 %73 %73 %73 + OpStore %50 %74 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-decrease-vector-components-assign-multiple-times.amber b/vulkan/amber/graphicsfuzz/cov-loop-decrease-vector-components-assign-multiple-times.amber new file mode 100644 index 0000000..478b152 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-decrease-vector-components-assign-multiple-times.amber @@ -0,0 +1,236 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [2, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v = vec4(_float_1_0); +# +# // Decreases v.yz by one. +# for(int i = _int_2; i > _int_0; i--) +# { +# v[i] -= _float_1_0; +# } +# +# // Assigns the same value multiple times. +# for(int i = 2; i > 0; i--) +# { +# for(int j = 2; j != 0; j--) +# { +# _GLF_color = v; +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %71 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %13 "buf1" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %23 "i" + OpName %26 "buf0" + OpMemberName %26 0 "_GLF_uniform_int_values" + OpName %28 "" + OpName %53 "i" + OpName %62 "j" + OpName %71 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %25 ArrayStride 16 + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 0 + OpDecorate %71 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 1 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %6 + %22 = OpTypePointer Function %16 + %24 = OpConstant %10 2 + %25 = OpTypeArray %16 %24 + %26 = OpTypeStruct %25 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpTypePointer Uniform %16 + %38 = OpConstant %16 1 + %41 = OpTypeBool + %46 = OpTypePointer Function %6 + %54 = OpConstant %16 2 + %70 = OpTypePointer Output %7 + %71 = OpVariable %70 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %23 = OpVariable %22 Function + %53 = OpVariable %22 Function + %62 = OpVariable %22 Function + %19 = OpAccessChain %18 %15 %17 %17 + %20 = OpLoad %6 %19 + %21 = OpCompositeConstruct %7 %20 %20 %20 %20 + OpStore %9 %21 + %30 = OpAccessChain %29 %28 %17 %17 + %31 = OpLoad %16 %30 + OpStore %23 %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %16 %23 + %39 = OpAccessChain %29 %28 %17 %38 + %40 = OpLoad %16 %39 + %42 = OpSGreaterThan %41 %37 %40 + OpBranchConditional %42 %33 %34 + %33 = OpLabel + %43 = OpLoad %16 %23 + %44 = OpAccessChain %18 %15 %17 %17 + %45 = OpLoad %6 %44 + %47 = OpAccessChain %46 %9 %43 + %48 = OpLoad %6 %47 + %49 = OpFSub %6 %48 %45 + %50 = OpAccessChain %46 %9 %43 + OpStore %50 %49 + OpBranch %35 + %35 = OpLabel + %51 = OpLoad %16 %23 + %52 = OpISub %16 %51 %38 + OpStore %23 %52 + OpBranch %32 + %34 = OpLabel + OpStore %53 %54 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %16 %53 + %61 = OpSGreaterThan %41 %60 %17 + OpBranchConditional %61 %56 %57 + %56 = OpLabel + OpStore %62 %54 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %16 %62 + %69 = OpINotEqual %41 %68 %17 + OpBranchConditional %69 %64 %65 + %64 = OpLabel + %72 = OpLoad %7 %9 + OpStore %71 %72 + OpBranch %66 + %66 = OpLabel + %73 = OpLoad %16 %62 + %74 = OpISub %16 %73 %38 + OpStore %62 %74 + OpBranch %63 + %65 = OpLabel + OpBranch %58 + %58 = OpLabel + %75 = OpLoad %16 %53 + %76 = OpISub %16 %75 %38 + OpStore %53 %76 + OpBranch %55 + %57 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-dfdx-constant-divide.amber b/vulkan/amber/graphicsfuzz/cov-loop-dfdx-constant-divide.amber new file mode 100644 index 0000000..f73de33 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-dfdx-constant-divide.amber @@ -0,0 +1,261 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific patch optimization code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [3, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = _float_1_0; +# float b = _float_1_0; +# float c = _float_1_0; +# +# for (int i = _int_0; i < _int_3; i ++) +# { +# if (i == _int_1) +# { +# // Executed when i == 1 but this still keeps b as one. +# b = dFdx(a) + _float_1_0; +# } +# +# // c = 0 +# c = dFdx(a); +# +# // a = 0 / 1 = 0 +# a = c / b; +# } +# +# // Always true. +# if (a == _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 93 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %74 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %21 "b" + OpName %24 "c" + OpName %28 "i" + OpName %31 "buf1" + OpMemberName %31 0 "_GLF_uniform_int_values" + OpName %33 "" + OpName %74 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %30 ArrayStride 16 + OpMemberDecorate %31 0 Offset 0 + OpDecorate %31 Block + OpDecorate %33 DescriptorSet 0 + OpDecorate %33 Binding 1 + OpDecorate %74 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 1 + %18 = OpTypePointer Uniform %6 + %27 = OpTypePointer Function %15 + %29 = OpConstant %9 3 + %30 = OpTypeArray %15 %29 + %31 = OpTypeStruct %30 + %32 = OpTypePointer Uniform %31 + %33 = OpVariable %32 Uniform + %34 = OpTypePointer Uniform %15 + %45 = OpTypeBool + %48 = OpConstant %15 2 + %72 = OpTypeVector %6 4 + %73 = OpTypePointer Output %72 + %74 = OpVariable %73 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %21 = OpVariable %7 Function + %24 = OpVariable %7 Function + %28 = OpVariable %27 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %6 %19 + OpStore %8 %20 + %22 = OpAccessChain %18 %14 %16 %17 + %23 = OpLoad %6 %22 + OpStore %21 %23 + %25 = OpAccessChain %18 %14 %16 %17 + %26 = OpLoad %6 %25 + OpStore %24 %26 + %35 = OpAccessChain %34 %33 %16 %17 + %36 = OpLoad %15 %35 + OpStore %28 %36 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %15 %28 + %43 = OpAccessChain %34 %33 %16 %16 + %44 = OpLoad %15 %43 + %46 = OpSLessThan %45 %42 %44 + OpBranchConditional %46 %38 %39 + %38 = OpLabel + %47 = OpLoad %15 %28 + %49 = OpAccessChain %34 %33 %16 %48 + %50 = OpLoad %15 %49 + %51 = OpIEqual %45 %47 %50 + OpSelectionMerge %53 None + OpBranchConditional %51 %52 %53 + %52 = OpLabel + %54 = OpLoad %6 %8 + %55 = OpDPdx %6 %54 + %56 = OpAccessChain %18 %14 %16 %17 + %57 = OpLoad %6 %56 + %58 = OpFAdd %6 %55 %57 + OpStore %21 %58 + OpBranch %53 + %53 = OpLabel + %59 = OpLoad %6 %8 + %60 = OpDPdx %6 %59 + OpStore %24 %60 + %61 = OpLoad %6 %24 + %62 = OpLoad %6 %21 + %63 = OpFDiv %6 %61 %62 + OpStore %8 %63 + OpBranch %40 + %40 = OpLabel + %64 = OpLoad %15 %28 + %65 = OpIAdd %15 %64 %17 + OpStore %28 %65 + OpBranch %37 + %39 = OpLabel + %66 = OpLoad %6 %8 + %67 = OpAccessChain %18 %14 %16 %16 + %68 = OpLoad %6 %67 + %69 = OpFOrdEqual %45 %66 %68 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %88 + %70 = OpLabel + %75 = OpAccessChain %34 %33 %16 %48 + %76 = OpLoad %15 %75 + %77 = OpConvertSToF %6 %76 + %78 = OpAccessChain %34 %33 %16 %17 + %79 = OpLoad %15 %78 + %80 = OpConvertSToF %6 %79 + %81 = OpAccessChain %34 %33 %16 %17 + %82 = OpLoad %15 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpAccessChain %34 %33 %16 %48 + %85 = OpLoad %15 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpCompositeConstruct %72 %77 %80 %83 %86 + OpStore %74 %87 + OpBranch %71 + %88 = OpLabel + %89 = OpAccessChain %34 %33 %16 %17 + %90 = OpLoad %15 %89 + %91 = OpConvertSToF %6 %90 + %92 = OpCompositeConstruct %72 %91 %91 %91 %91 + OpStore %74 %92 + OpBranch %71 + %71 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-divide-uninitialized-vector-min-unused.amber b/vulkan/amber/graphicsfuzz/cov-loop-divide-uninitialized-vector-min-unused.amber new file mode 100644 index 0000000..f6c360f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-divide-uninitialized-vector-min-unused.amber @@ -0,0 +1,236 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_11_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [11.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [10, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = _float_1_0; +# vec4 v; +# +# for(int i = _int_0; i < _int_10; i++) +# { +# f += _float_1_0; +# // v / f is undefined because v is uninitialized, but the results are not used. +# min(vec4(_float_1_0), v / f); +# } +# +# // Always true. +# if(f == _float_11_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %65 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %22 "i" + OpName %25 "buf1" + OpMemberName %25 0 "_GLF_uniform_int_values" + OpName %27 "" + OpName %50 "v" + OpName %65 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %24 ArrayStride 16 + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 1 + OpDecorate %65 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 1 + %18 = OpTypePointer Uniform %6 + %21 = OpTypePointer Function %15 + %23 = OpConstant %9 3 + %24 = OpTypeArray %15 %23 + %25 = OpTypeStruct %24 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypePointer Uniform %15 + %39 = OpTypeBool + %47 = OpTypeVector %6 4 + %49 = OpTypePointer Function %47 + %64 = OpTypePointer Output %47 + %65 = OpVariable %64 Output + %66 = OpConstant %15 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %21 Function + %50 = OpVariable %49 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %6 %19 + OpStore %8 %20 + %29 = OpAccessChain %28 %27 %16 %17 + %30 = OpLoad %15 %29 + OpStore %22 %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %15 %22 + %37 = OpAccessChain %28 %27 %16 %16 + %38 = OpLoad %15 %37 + %40 = OpSLessThan %39 %36 %38 + OpBranchConditional %40 %32 %33 + %32 = OpLabel + %41 = OpAccessChain %18 %14 %16 %17 + %42 = OpLoad %6 %41 + %43 = OpLoad %6 %8 + %44 = OpFAdd %6 %43 %42 + OpStore %8 %44 + %45 = OpAccessChain %18 %14 %16 %17 + %46 = OpLoad %6 %45 + %48 = OpCompositeConstruct %47 %46 %46 %46 %46 + %51 = OpLoad %47 %50 + %52 = OpLoad %6 %8 + %53 = OpCompositeConstruct %47 %52 %52 %52 %52 + %54 = OpFDiv %47 %51 %53 + %55 = OpExtInst %47 %1 FMin %48 %54 + OpBranch %34 + %34 = OpLabel + %56 = OpLoad %15 %22 + %57 = OpIAdd %15 %56 %17 + OpStore %22 %57 + OpBranch %31 + %33 = OpLabel + %58 = OpLoad %6 %8 + %59 = OpAccessChain %18 %14 %16 %16 + %60 = OpLoad %6 %59 + %61 = OpFOrdEqual %39 %58 %60 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %80 + %62 = OpLabel + %67 = OpAccessChain %28 %27 %16 %66 + %68 = OpLoad %15 %67 + %69 = OpConvertSToF %6 %68 + %70 = OpAccessChain %28 %27 %16 %17 + %71 = OpLoad %15 %70 + %72 = OpConvertSToF %6 %71 + %73 = OpAccessChain %28 %27 %16 %17 + %74 = OpLoad %15 %73 + %75 = OpConvertSToF %6 %74 + %76 = OpAccessChain %28 %27 %16 %66 + %77 = OpLoad %15 %76 + %78 = OpConvertSToF %6 %77 + %79 = OpCompositeConstruct %47 %69 %72 %75 %78 + OpStore %65 %79 + OpBranch %63 + %80 = OpLabel + %81 = OpAccessChain %28 %27 %16 %17 + %82 = OpLoad %15 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpCompositeConstruct %47 %83 %83 %83 %83 + OpStore %65 %84 + OpBranch %63 + %63 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 11.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-exit-conditions-sampler-struct-integer-variable.amber b/vulkan/amber/graphicsfuzz/cov-loop-exit-conditions-sampler-struct-integer-variable.amber new file mode 100644 index 0000000..8e6796e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-exit-conditions-sampler-struct-integer-variable.amber @@ -0,0 +1,270 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--copy-propagate-arrays' +# '--eliminate-dead-inserts' +# '--convert-local-access-chains' +# '--private-to-local' +# '--redundancy-elimination' +# '--eliminate-local-multi-store' +# '--eliminate-local-single-block' +# '--eliminate-dead-code-aggressive' +# '--copy-propagate-arrays' +# '--eliminate-dead-inserts' +# '--redundancy-elimination' +# '--eliminate-local-single-block' +# '--eliminate-local-single-store' +# '--eliminate-local-single-store' +# '--eliminate-dead-code-aggressive' +# '--inline-entry-points-exhaustive' +# '--combine-access-chains' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-block' +# '--eliminate-dead-branches' +# '--reduce-load-size' +# '--eliminate-dead-inserts' +# '--copy-propagate-arrays' +# '--convert-local-access-chains' +# '--vector-dce' +# '--redundancy-elimination' +# '--eliminate-local-multi-store' +# '--redundancy-elimination' +# '--eliminate-dead-inserts' +# '--eliminate-dead-code-aggressive' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# struct S +# { +# int data; +# }; +# +# layout(set = 0, binding = 0) uniform sampler2D tex; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 1; +# int b = 1; +# vec4 v = vec4(1.0); +# S s = S(1); +# +# // Iterated once. +# while(v.x + 1.0 > 0.0 && s.data <= 1 && _GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# // Always false. +# if(b++ > 3) +# { +# break; +# } +# +# // The sampled value doesn't matter because the loop will exit in any case. +# v = texture(tex, vec2(1.0)); +# +# // This will cause the loop to exit. +# s.data++; +# } +# +# // Always true. +# if (s.data == 2) +# _GLF_color = vec4(float(a), 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 96 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %75 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %20 "S" + OpMemberName %20 0 "data" + OpName %60 "tex" + OpName %75 "_GLF_color" + OpDecorate %60 RelaxedPrecision + OpDecorate %60 DescriptorSet 0 + OpDecorate %60 Binding 0 + OpDecorate %61 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %75 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpConstant %6 0 + %12 = OpConstant %6 1 + %14 = OpTypeFloat 32 + %15 = OpTypeVector %14 4 + %18 = OpConstant %14 1 + %19 = OpConstantComposite %15 %18 %18 %18 %18 + %20 = OpTypeStruct %6 + %23 = OpConstantComposite %20 %12 + %29 = OpTypeBool + %36 = OpConstant %14 0 + %45 = OpConstant %6 10 + %52 = OpConstant %6 3 + %57 = OpTypeImage %14 2D 0 0 0 1 Unknown + %58 = OpTypeSampledImage %57 + %59 = OpTypePointer UniformConstant %58 + %60 = OpVariable %59 UniformConstant + %62 = OpTypeVector %14 2 + %63 = OpConstantComposite %62 %18 %18 + %70 = OpConstant %6 2 + %74 = OpTypePointer Output %15 + %75 = OpVariable %74 Output + %80 = OpConstantComposite %15 %36 %36 %36 %36 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %24 + %24 = OpLabel + %95 = OpPhi %20 %23 %5 %85 %27 + %94 = OpPhi %15 %19 %5 %64 %27 + %90 = OpPhi %6 %12 %5 %51 %27 + %88 = OpPhi %6 %9 %5 %49 %27 + %93 = OpPhi %6 %12 %5 %93 %27 + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %34 = OpCompositeExtract %14 %94 0 + %35 = OpFAdd %14 %34 %18 + %37 = OpFOrdGreaterThan %29 %35 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + %41 = OpCompositeExtract %6 %95 0 + %42 = OpSLessThanEqual %29 %41 %12 + OpBranch %39 + %39 = OpLabel + %43 = OpPhi %29 %37 %28 %42 %38 + %46 = OpSLessThan %29 %88 %45 + %47 = OpLogicalAnd %29 %43 %46 + OpBranchConditional %47 %25 %26 + %25 = OpLabel + %49 = OpIAdd %6 %88 %12 + %51 = OpIAdd %6 %90 %12 + %53 = OpSGreaterThan %29 %90 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %55 + %54 = OpLabel + OpBranch %26 + %55 = OpLabel + %61 = OpLoad %58 %60 + %64 = OpImageSampleImplicitLod %15 %61 %63 + %66 = OpCompositeExtract %6 %95 0 + %67 = OpIAdd %6 %66 %12 + %85 = OpCompositeInsert %20 %67 %95 0 + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + %69 = OpCompositeExtract %6 %95 0 + %71 = OpIEqual %29 %69 %70 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %79 + %72 = OpLabel + %77 = OpConvertSToF %14 %93 + %78 = OpCompositeConstruct %15 %77 %36 %36 %18 + OpStore %75 %78 + OpBranch %73 + %79 = OpLabel + OpStore %75 %80 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# GLF_live1tex +SAMPLER variant_GLF_live1tex + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_GLF_live1tex DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-find-lsb-eight-fragcoord-never-discard.amber b/vulkan/amber/graphicsfuzz/cov-loop-find-lsb-eight-fragcoord-never-discard.amber new file mode 100644 index 0000000..a2b509b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-find-lsb-eight-fragcoord-never-discard.amber @@ -0,0 +1,283 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_64 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 64] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# return; +# } +# +# int a = 0; +# +# do +# { +# // Iterates twice but has no effect. +# for(int i = 1; i < findLSB(8); i++) +# { +# if(i < a) +# { +# continue; +# } +# +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# } +# else +# { +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# discard; +# } +# } +# } +# +# a++; +# } +# while(a < 64); +# +# // Always true. +# if(a == _int_64) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 117 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %59 %89 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "buf1" + OpMemberName %8 0 "injectionSwitch" + OpName %10 "" + OpName %59 "gl_FragCoord" + OpName %78 "buf0" + OpMemberName %78 0 "_GLF_uniform_int_values" + OpName %80 "" + OpName %89 "_GLF_color" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 1 + OpDecorate %41 RelaxedPrecision + OpDecorate %59 BuiltIn FragCoord + OpDecorate %77 ArrayStride 16 + OpMemberDecorate %78 0 Offset 0 + OpDecorate %78 Block + OpDecorate %80 DescriptorSet 0 + OpDecorate %80 Binding 0 + OpDecorate %89 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeStruct %7 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %6 + %18 = OpConstant %13 1 + %21 = OpTypeBool + %33 = OpConstant %11 1 + %40 = OpConstant %11 8 + %57 = OpTypeVector %6 4 + %58 = OpTypePointer Input %57 + %59 = OpVariable %58 Input + %60 = OpTypePointer Input %6 + %63 = OpConstant %6 0 + %73 = OpConstant %11 64 + %76 = OpConstant %13 3 + %77 = OpTypeArray %11 %76 + %78 = OpTypeStruct %77 + %79 = OpTypePointer Uniform %78 + %80 = OpVariable %79 Uniform + %81 = OpConstant %11 2 + %82 = OpTypePointer Uniform %11 + %88 = OpTypePointer Output %57 + %89 = OpVariable %88 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %108 None + OpSwitch %14 %109 + %109 = OpLabel + %16 = OpAccessChain %15 %10 %12 %14 + %17 = OpLoad %6 %16 + %19 = OpAccessChain %15 %10 %12 %18 + %20 = OpLoad %6 %19 + %22 = OpFOrdGreaterThan %21 %17 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + OpBranch %108 + %24 = OpLabel + OpBranch %28 + %28 = OpLabel + %116 = OpPhi %11 %12 %24 %71 %31 + OpLoopMerge %30 %31 None + OpBranch %34 + %34 = OpLabel + %114 = OpPhi %11 %33 %28 %69 %37 + %41 = OpExtInst %11 %1 FindILsb %40 + %42 = OpSLessThan %21 %114 %41 + OpLoopMerge %36 %37 None + OpBranchConditional %42 %35 %36 + %35 = OpLabel + %45 = OpSLessThan %21 %114 %116 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + OpBranch %37 + %47 = OpLabel + OpSelectionMerge %55 None + OpBranchConditional %22 %54 %56 + %54 = OpLabel + OpBranch %55 + %56 = OpLabel + %61 = OpAccessChain %60 %59 %18 + %62 = OpLoad %6 %61 + %64 = OpFOrdLessThan %21 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + OpTerminateInvocation + %66 = OpLabel + OpBranch %55 + %55 = OpLabel + OpBranch %37 + %37 = OpLabel + %69 = OpIAdd %11 %114 %33 + OpBranch %34 + %36 = OpLabel + %71 = OpIAdd %11 %116 %33 + OpBranch %31 + %31 = OpLabel + %74 = OpSLessThan %21 %71 %73 + OpBranchConditional %74 %28 %30 + %30 = OpLabel + %83 = OpAccessChain %82 %80 %12 %81 + %84 = OpLoad %11 %83 + %85 = OpIEqual %21 %71 %84 + OpSelectionMerge %87 None + OpBranchConditional %85 %86 %103 + %86 = OpLabel + %90 = OpAccessChain %82 %80 %12 %33 + %91 = OpLoad %11 %90 + %92 = OpConvertSToF %6 %91 + %93 = OpAccessChain %82 %80 %12 %12 + %94 = OpLoad %11 %93 + %95 = OpConvertSToF %6 %94 + %102 = OpCompositeConstruct %57 %92 %95 %95 %92 + OpStore %89 %102 + OpBranch %87 + %103 = OpLabel + %104 = OpAccessChain %82 %80 %12 %12 + %105 = OpLoad %11 %104 + %106 = OpConvertSToF %6 %105 + %107 = OpCompositeConstruct %57 %106 %106 %106 %106 + OpStore %89 %107 + OpBranch %87 + %87 = OpLabel + OpBranch %108 + %108 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 64 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-findmsb-findlsb.amber b/vulkan/amber/graphicsfuzz/cov-loop-findmsb-findlsb.amber new file mode 100644 index 0000000..ce9217f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-findmsb-findlsb.amber @@ -0,0 +1,222 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers specific simplification and value tracking paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int two; +# }; +# +# int func(int i, int x) +# { +# int r = 2; +# +# // Run until x = 3 (three iterations). +# while(x <= r) +# { +# // Always false. +# if(i == 1) +# return -1; +# +# // Always false. +# if(x < 1) +# r = 1; +# +# // r is always 2. +# // findLSB(2) = 1 +# // findMSB(1) = 0 +# // --> The while loop is run only once. +# do +# { +# x++; +# } +# while(findMSB(findLSB(r)) > 1); +# } +# +# return x; +# } +# +# void main() +# { +# if(func(two, 1) == 3) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %65 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "func(i1;i1;" + OpName %9 "i" + OpName %10 "x" + OpName %13 "r" + OpName %48 "buf0" + OpMemberName %48 0 "two" + OpName %50 "" + OpName %52 "param" + OpName %56 "param" + OpName %65 "_GLF_color" + OpMemberDecorate %48 0 Offset 0 + OpDecorate %48 Block + OpDecorate %50 DescriptorSet 0 + OpDecorate %50 Binding 0 + OpDecorate %65 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 %7 + %14 = OpConstant %6 2 + %22 = OpTypeBool + %25 = OpConstant %6 1 + %29 = OpConstant %6 -1 + %48 = OpTypeStruct %6 + %49 = OpTypePointer Uniform %48 + %50 = OpVariable %49 Uniform + %51 = OpConstant %6 0 + %53 = OpTypePointer Uniform %6 + %58 = OpConstant %6 3 + %62 = OpTypeFloat 32 + %63 = OpTypeVector %62 4 + %64 = OpTypePointer Output %63 + %65 = OpVariable %64 Output + %66 = OpConstant %62 1 + %67 = OpConstant %62 0 + %68 = OpConstantComposite %63 %66 %67 %67 %66 + %70 = OpConstantComposite %63 %67 %67 %67 %67 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %52 = OpVariable %7 Function + %56 = OpVariable %7 Function + %54 = OpAccessChain %53 %50 %51 + %55 = OpLoad %6 %54 + OpStore %52 %55 + OpStore %56 %25 + %57 = OpFunctionCall %6 %11 %52 %56 + %59 = OpIEqual %22 %57 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %60 %69 + %60 = OpLabel + OpStore %65 %68 + OpBranch %61 + %69 = OpLabel + OpStore %65 %70 + OpBranch %61 + %61 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %13 = OpVariable %7 Function + OpStore %13 %14 + OpBranch %15 + %15 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %20 = OpLoad %6 %10 + %21 = OpLoad %6 %13 + %23 = OpSLessThanEqual %22 %20 %21 + OpBranchConditional %23 %16 %17 + %16 = OpLabel + %24 = OpLoad %6 %9 + %26 = OpIEqual %22 %24 %25 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + OpReturnValue %29 + %28 = OpLabel + %31 = OpLoad %6 %10 + %32 = OpSLessThan %22 %31 %25 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %34 + %33 = OpLabel + OpStore %13 %25 + OpBranch %34 + %34 = OpLabel + OpBranch %35 + %35 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %36 + %36 = OpLabel + %39 = OpLoad %6 %10 + %40 = OpIAdd %6 %39 %25 + OpStore %10 %40 + OpBranch %38 + %38 = OpLabel + %41 = OpLoad %6 %13 + %42 = OpExtInst %6 %1 FindILsb %41 + %43 = OpExtInst %6 %1 FindSMsb %42 + %44 = OpSGreaterThan %22 %43 %25 + OpBranchConditional %44 %35 %37 + %37 = OpLabel + OpBranch %18 + %18 = OpLabel + OpBranch %15 + %17 = OpLabel + %45 = OpLoad %6 %10 + OpReturnValue %45 + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE int32 DATA + 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-fragcoord-identical-condition.amber b/vulkan/amber/graphicsfuzz/cov-loop-fragcoord-identical-condition.amber new file mode 100644 index 0000000..1541c91 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-fragcoord-identical-condition.amber @@ -0,0 +1,242 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# for(int i = int(injectionSwitch.y); i != 0; i--) +# { +# // Always true. +# if(gl_FragCoord.x > 0.0) +# { +# _GLF_color = vec4(_float_1_0, injectionSwitch.x, _float_0_0, _float_1_0); +# } +# else +# { +# for(int j = 1; j > 0; j--) +# { +# // Similar condition as above, but never executed. +# if(gl_FragCoord.x > 0.0) +# { +# _GLF_color = vec4(1.0); +# } +# else +# { +# discard; +# } +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %31 %41 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "i" + OpName %11 "buf1" + OpMemberName %11 0 "injectionSwitch" + OpName %13 "" + OpName %31 "gl_FragCoord" + OpName %41 "_GLF_color" + OpName %44 "buf0" + OpMemberName %44 0 "_GLF_uniform_float_values" + OpName %46 "" + OpName %58 "j" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 1 + OpDecorate %31 BuiltIn FragCoord + OpDecorate %41 Location 0 + OpDecorate %43 ArrayStride 16 + OpMemberDecorate %44 0 Offset 0 + OpDecorate %44 Block + OpDecorate %46 DescriptorSet 0 + OpDecorate %46 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 2 + %11 = OpTypeStruct %10 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpConstant %6 0 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 1 + %17 = OpTypePointer Uniform %9 + %27 = OpTypeBool + %29 = OpTypeVector %9 4 + %30 = OpTypePointer Input %29 + %31 = OpVariable %30 Input + %32 = OpConstant %15 0 + %33 = OpTypePointer Input %9 + %36 = OpConstant %9 0 + %40 = OpTypePointer Output %29 + %41 = OpVariable %40 Output + %42 = OpConstant %15 2 + %43 = OpTypeArray %9 %42 + %44 = OpTypeStruct %43 + %45 = OpTypePointer Uniform %44 + %46 = OpVariable %45 Uniform + %47 = OpConstant %6 1 + %71 = OpConstant %9 1 + %72 = OpConstantComposite %29 %71 %71 %71 %71 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %58 = OpVariable %7 Function + %18 = OpAccessChain %17 %13 %14 %16 + %19 = OpLoad %9 %18 + %20 = OpConvertFToS %6 %19 + OpStore %8 %20 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %6 %8 + %28 = OpINotEqual %27 %26 %14 + OpBranchConditional %28 %22 %23 + %22 = OpLabel + %34 = OpAccessChain %33 %31 %32 + %35 = OpLoad %9 %34 + %37 = OpFOrdGreaterThan %27 %35 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %57 + %38 = OpLabel + %48 = OpAccessChain %17 %46 %14 %47 + %49 = OpLoad %9 %48 + %50 = OpAccessChain %17 %13 %14 %32 + %51 = OpLoad %9 %50 + %52 = OpAccessChain %17 %46 %14 %14 + %53 = OpLoad %9 %52 + %54 = OpAccessChain %17 %46 %14 %47 + %55 = OpLoad %9 %54 + %56 = OpCompositeConstruct %29 %49 %51 %53 %55 + OpStore %41 %56 + OpBranch %39 + %57 = OpLabel + OpStore %58 %47 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + %64 = OpLoad %6 %58 + %65 = OpSGreaterThan %27 %64 %14 + OpBranchConditional %65 %60 %61 + %60 = OpLabel + %66 = OpAccessChain %33 %31 %32 + %67 = OpLoad %9 %66 + %68 = OpFOrdGreaterThan %27 %67 %36 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %73 + %69 = OpLabel + OpStore %41 %72 + OpBranch %70 + %73 = OpLabel + OpTerminateInvocation + %70 = OpLabel + OpBranch %62 + %62 = OpLabel + %75 = OpLoad %6 %58 + %76 = OpISub %6 %75 %47 + OpStore %58 %76 + OpBranch %59 + %61 = OpLabel + OpBranch %39 + %39 = OpLabel + OpBranch %24 + %24 = OpLabel + %77 = OpLoad %6 %8 + %78 = OpISub %6 %77 %47 + OpStore %8 %78 + OpBranch %21 + %23 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-function-call-negative-argument.amber b/vulkan/amber/graphicsfuzz/cov-loop-function-call-negative-argument.amber new file mode 100644 index 0000000..e7685ff --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-function-call-negative-argument.amber @@ -0,0 +1,430 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_7 _GLF_uniform_int_values[2] +# #define _int_10 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 7, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int arr0[10] = int[10](0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +# int arr1[10] = int[10](1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +# +# void func(int x) +# { +# int a = 1; +# int b = x; +# +# // Iterates seven times. +# while(b <= x) +# { +# if(a > 7) +# { +# break; +# } +# +# // Always false. +# if(arr0[clamp(b, 0, 1)] < arr0[0]) +# { +# arr1[a] = arr0[b++]; +# } +# else +# { +# arr1[a] = arr0[a]; +# } +# +# a++; +# } +# +# arr1[a++] = b; +# +# for(int i = _int_0; i < _int_7; i++) +# { +# arr0[i] = arr1[_int_1]; +# } +# } +# +# void main() +# { +# for(int a = _int_0; a < _int_7; a++) +# { +# for(int i = -10; i < 0; i++) +# { +# func(i); +# } +# } +# +# // Verify against expected results and set output to black if failed. +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# int ref[10] = int[10](_int_1, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, -_int_1, _int_1); +# +# for(int i = _int_0; i < _int_10; i++) +# { +# if(arr0[i] != _int_0 || arr1[i] != ref[i]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 202 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %126 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func(i1;" + OpName %9 "x" + OpName %16 "arr0" + OpName %19 "arr1" + OpName %22 "a" + OpName %23 "b" + OpName %68 "i" + OpName %71 "buf0" + OpMemberName %71 0 "_GLF_uniform_int_values" + OpName %73 "" + OpName %95 "a" + OpName %107 "i" + OpName %116 "param" + OpName %126 "_GLF_color" + OpName %141 "ref" + OpName %164 "i" + OpDecorate %70 ArrayStride 16 + OpMemberDecorate %71 0 Offset 0 + OpDecorate %71 Block + OpDecorate %73 DescriptorSet 0 + OpDecorate %73 Binding 0 + OpDecorate %126 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 10 + %14 = OpTypeArray %6 %13 + %15 = OpTypePointer Private %14 + %16 = OpVariable %15 Private + %17 = OpConstant %6 0 + %18 = OpConstantComposite %14 %17 %17 %17 %17 %17 %17 %17 %17 %17 %17 + %19 = OpVariable %15 Private + %20 = OpConstant %6 1 + %21 = OpConstantComposite %14 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 + %32 = OpTypeBool + %35 = OpConstant %6 7 + %42 = OpTypePointer Private %6 + %69 = OpConstant %12 4 + %70 = OpTypeArray %6 %69 + %71 = OpTypeStruct %70 + %72 = OpTypePointer Uniform %71 + %73 = OpVariable %72 Uniform + %74 = OpTypePointer Uniform %6 + %83 = OpConstant %6 2 + %108 = OpConstant %6 -10 + %123 = OpTypeFloat 32 + %124 = OpTypeVector %123 4 + %125 = OpTypePointer Output %124 + %126 = OpVariable %125 Output + %140 = OpTypePointer Function %14 + %173 = OpConstant %6 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %95 = OpVariable %7 Function + %107 = OpVariable %7 Function + %116 = OpVariable %7 Function + %141 = OpVariable %140 Function + %164 = OpVariable %7 Function + OpStore %16 %18 + OpStore %19 %21 + %96 = OpAccessChain %74 %73 %17 %17 + %97 = OpLoad %6 %96 + OpStore %95 %97 + OpBranch %98 + %98 = OpLabel + OpLoopMerge %100 %101 None + OpBranch %102 + %102 = OpLabel + %103 = OpLoad %6 %95 + %104 = OpAccessChain %74 %73 %17 %83 + %105 = OpLoad %6 %104 + %106 = OpSLessThan %32 %103 %105 + OpBranchConditional %106 %99 %100 + %99 = OpLabel + OpStore %107 %108 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %107 + %115 = OpSLessThan %32 %114 %17 + OpBranchConditional %115 %110 %111 + %110 = OpLabel + %117 = OpLoad %6 %107 + OpStore %116 %117 + %118 = OpFunctionCall %2 %10 %116 + OpBranch %112 + %112 = OpLabel + %119 = OpLoad %6 %107 + %120 = OpIAdd %6 %119 %20 + OpStore %107 %120 + OpBranch %109 + %111 = OpLabel + OpBranch %101 + %101 = OpLabel + %121 = OpLoad %6 %95 + %122 = OpIAdd %6 %121 %20 + OpStore %95 %122 + OpBranch %98 + %100 = OpLabel + %127 = OpAccessChain %74 %73 %17 %20 + %128 = OpLoad %6 %127 + %129 = OpConvertSToF %123 %128 + %130 = OpAccessChain %74 %73 %17 %17 + %131 = OpLoad %6 %130 + %132 = OpConvertSToF %123 %131 + %133 = OpAccessChain %74 %73 %17 %17 + %134 = OpLoad %6 %133 + %135 = OpConvertSToF %123 %134 + %136 = OpAccessChain %74 %73 %17 %20 + %137 = OpLoad %6 %136 + %138 = OpConvertSToF %123 %137 + %139 = OpCompositeConstruct %124 %129 %132 %135 %138 + OpStore %126 %139 + %142 = OpAccessChain %74 %73 %17 %20 + %143 = OpLoad %6 %142 + %144 = OpAccessChain %74 %73 %17 %17 + %145 = OpLoad %6 %144 + %146 = OpAccessChain %74 %73 %17 %17 + %147 = OpLoad %6 %146 + %148 = OpAccessChain %74 %73 %17 %17 + %149 = OpLoad %6 %148 + %150 = OpAccessChain %74 %73 %17 %17 + %151 = OpLoad %6 %150 + %152 = OpAccessChain %74 %73 %17 %17 + %153 = OpLoad %6 %152 + %154 = OpAccessChain %74 %73 %17 %17 + %155 = OpLoad %6 %154 + %156 = OpAccessChain %74 %73 %17 %17 + %157 = OpLoad %6 %156 + %158 = OpAccessChain %74 %73 %17 %20 + %159 = OpLoad %6 %158 + %160 = OpSNegate %6 %159 + %161 = OpAccessChain %74 %73 %17 %20 + %162 = OpLoad %6 %161 + %163 = OpCompositeConstruct %14 %143 %145 %147 %149 %151 %153 %155 %157 %160 %162 + OpStore %141 %163 + %165 = OpAccessChain %74 %73 %17 %17 + %166 = OpLoad %6 %165 + OpStore %164 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %172 = OpLoad %6 %164 + %174 = OpAccessChain %74 %73 %17 %173 + %175 = OpLoad %6 %174 + %176 = OpSLessThan %32 %172 %175 + OpBranchConditional %176 %168 %169 + %168 = OpLabel + %177 = OpLoad %6 %164 + %178 = OpAccessChain %42 %16 %177 + %179 = OpLoad %6 %178 + %180 = OpAccessChain %74 %73 %17 %17 + %181 = OpLoad %6 %180 + %182 = OpINotEqual %32 %179 %181 + %183 = OpLogicalNot %32 %182 + OpSelectionMerge %185 None + OpBranchConditional %183 %184 %185 + %184 = OpLabel + %186 = OpLoad %6 %164 + %187 = OpAccessChain %42 %19 %186 + %188 = OpLoad %6 %187 + %189 = OpLoad %6 %164 + %190 = OpAccessChain %7 %141 %189 + %191 = OpLoad %6 %190 + %192 = OpINotEqual %32 %188 %191 + OpBranch %185 + %185 = OpLabel + %193 = OpPhi %32 %182 %168 %192 %184 + OpSelectionMerge %195 None + OpBranchConditional %193 %194 %195 + %194 = OpLabel + %196 = OpAccessChain %74 %73 %17 %17 + %197 = OpLoad %6 %196 + %198 = OpConvertSToF %123 %197 + %199 = OpCompositeConstruct %124 %198 %198 %198 %198 + OpStore %126 %199 + OpBranch %195 + %195 = OpLabel + OpBranch %170 + %170 = OpLabel + %200 = OpLoad %6 %164 + %201 = OpIAdd %6 %200 %20 + OpStore %164 %201 + OpBranch %167 + %169 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %22 = OpVariable %7 Function + %23 = OpVariable %7 Function + %68 = OpVariable %7 Function + OpStore %22 %20 + %24 = OpLoad %6 %9 + OpStore %23 %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %6 %23 + %31 = OpLoad %6 %9 + %33 = OpSLessThanEqual %32 %30 %31 + OpBranchConditional %33 %26 %27 + %26 = OpLabel + %34 = OpLoad %6 %22 + %36 = OpSGreaterThan %32 %34 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + OpBranch %27 + %38 = OpLabel + %40 = OpLoad %6 %23 + %41 = OpExtInst %6 %1 SClamp %40 %17 %20 + %43 = OpAccessChain %42 %16 %41 + %44 = OpLoad %6 %43 + %45 = OpAccessChain %42 %16 %17 + %46 = OpLoad %6 %45 + %47 = OpSLessThan %32 %44 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %56 + %48 = OpLabel + %50 = OpLoad %6 %22 + %51 = OpLoad %6 %23 + %52 = OpIAdd %6 %51 %20 + OpStore %23 %52 + %53 = OpAccessChain %42 %16 %51 + %54 = OpLoad %6 %53 + %55 = OpAccessChain %42 %19 %50 + OpStore %55 %54 + OpBranch %49 + %56 = OpLabel + %57 = OpLoad %6 %22 + %58 = OpLoad %6 %22 + %59 = OpAccessChain %42 %16 %58 + %60 = OpLoad %6 %59 + %61 = OpAccessChain %42 %19 %57 + OpStore %61 %60 + OpBranch %49 + %49 = OpLabel + %62 = OpLoad %6 %22 + %63 = OpIAdd %6 %62 %20 + OpStore %22 %63 + OpBranch %28 + %28 = OpLabel + OpBranch %25 + %27 = OpLabel + %64 = OpLoad %6 %22 + %65 = OpIAdd %6 %64 %20 + OpStore %22 %65 + %66 = OpLoad %6 %23 + %67 = OpAccessChain %42 %19 %64 + OpStore %67 %66 + %75 = OpAccessChain %74 %73 %17 %17 + %76 = OpLoad %6 %75 + OpStore %68 %76 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %6 %68 + %84 = OpAccessChain %74 %73 %17 %83 + %85 = OpLoad %6 %84 + %86 = OpSLessThan %32 %82 %85 + OpBranchConditional %86 %78 %79 + %78 = OpLabel + %87 = OpLoad %6 %68 + %88 = OpAccessChain %74 %73 %17 %20 + %89 = OpLoad %6 %88 + %90 = OpAccessChain %42 %19 %89 + %91 = OpLoad %6 %90 + %92 = OpAccessChain %42 %16 %87 + OpStore %92 %91 + OpBranch %80 + %80 = OpLabel + %93 = OpLoad %6 %68 + %94 = OpIAdd %6 %93 %20 + OpStore %68 %94 + OpBranch %77 + %79 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 7 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-function-call-vector-matrix-multiplication.amber b/vulkan/amber/graphicsfuzz/cov-loop-function-call-vector-matrix-multiplication.amber new file mode 100644 index 0000000..d429464 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-function-call-vector-matrix-multiplication.amber @@ -0,0 +1,271 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# bool func(vec2 v0, vec4 v1) +# { +# // Always false. +# if(v1.y > _float_1_0) +# { +# return true; +# } +# +# // Always false. +# if(v0.x > ((gl_FragCoord.y < _float_0_0) ? v1.z : 4.3)) +# { +# return false; +# } +# +# // Always returns here. +# return true; +# } +# +# void main() +# { +# vec2 v0 = vec3(1.0, 7014.7640, 1.0) * mat2x3(1.0, -1.0, 1.0, _float_1_0, _float_1_0, _float_1_0); +# _GLF_color = vec4(_int_0); +# +# for(int i = 0; i < 5; i++) +# { +# // Always true. +# if(func(v0, vec4[5](vec4(1), vec4(_int_1), vec4(_int_1), vec4(_int_1), vec4(_int_1))[i])) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 196 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %41 %83 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %24 "buf0" + OpMemberName %24 0 "_GLF_uniform_float_values" + OpName %26 "" + OpName %41 "gl_FragCoord" + OpName %83 "_GLF_color" + OpName %85 "buf1" + OpMemberName %85 0 "_GLF_uniform_int_values" + OpName %87 "" + OpName %128 "indexable" + OpDecorate %23 ArrayStride 16 + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 0 + OpDecorate %41 BuiltIn FragCoord + OpDecorate %83 Location 0 + OpDecorate %84 ArrayStride 16 + OpMemberDecorate %85 0 Offset 0 + OpDecorate %85 Block + OpDecorate %87 DescriptorSet 0 + OpDecorate %87 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %9 = OpTypeVector %6 4 + %10 = OpTypePointer Function %9 + %11 = OpTypeBool + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 1 + %22 = OpConstant %17 2 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpTypeInt 32 1 + %28 = OpConstant %27 0 + %29 = OpTypePointer Uniform %6 + %35 = OpConstantTrue %11 + %37 = OpConstant %17 0 + %40 = OpTypePointer Input %9 + %41 = OpVariable %40 Input + %42 = OpTypePointer Input %6 + %45 = OpConstant %27 1 + %55 = OpConstant %6 4.30000019 + %60 = OpConstantFalse %11 + %65 = OpTypeVector %6 3 + %66 = OpConstant %6 1 + %67 = OpConstant %6 7014.76416 + %68 = OpConstantComposite %65 %66 %67 %66 + %69 = OpConstant %6 -1 + %76 = OpTypeMatrix %65 2 + %82 = OpTypePointer Output %9 + %83 = OpVariable %82 Output + %84 = OpTypeArray %27 %22 + %85 = OpTypeStruct %84 + %86 = OpTypePointer Uniform %85 + %87 = OpVariable %86 Uniform + %88 = OpTypePointer Uniform %27 + %101 = OpConstant %27 5 + %103 = OpConstantComposite %9 %66 %66 %66 %66 + %120 = OpConstant %17 5 + %121 = OpTypeArray %9 %120 + %127 = OpTypePointer Function %121 + %195 = OpConstantComposite %65 %66 %69 %66 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %128 = OpVariable %127 Function + %70 = OpAccessChain %29 %26 %28 %28 + %71 = OpLoad %6 %70 + %79 = OpCompositeConstruct %65 %71 %71 %71 + %80 = OpCompositeConstruct %76 %195 %79 + %81 = OpVectorTimesMatrix %7 %68 %80 + %89 = OpAccessChain %88 %87 %28 %45 + %90 = OpLoad %27 %89 + %91 = OpConvertSToF %6 %90 + %92 = OpCompositeConstruct %9 %91 %91 %91 %91 + OpStore %83 %92 + OpBranch %95 + %95 = OpLabel + %189 = OpPhi %27 %28 %5 %148 %98 + %102 = OpSLessThan %11 %189 %101 + OpLoopMerge %97 %98 None + OpBranchConditional %102 %96 %97 + %96 = OpLabel + %104 = OpAccessChain %88 %87 %28 %28 + %105 = OpLoad %27 %104 + %106 = OpConvertSToF %6 %105 + %107 = OpCompositeConstruct %9 %106 %106 %106 %106 + %122 = OpCompositeConstruct %121 %103 %107 %107 %107 %107 + OpStore %128 %122 + %129 = OpAccessChain %10 %128 %189 + %130 = OpLoad %9 %129 + OpSelectionMerge %184 None + OpSwitch %37 %160 + %160 = OpLabel + %162 = OpCompositeExtract %6 %130 1 + %165 = OpFOrdGreaterThan %11 %162 %71 + OpSelectionMerge %167 None + OpBranchConditional %165 %166 %167 + %166 = OpLabel + OpBranch %184 + %167 = OpLabel + %169 = OpCompositeExtract %6 %81 0 + %170 = OpAccessChain %42 %41 %18 + %171 = OpLoad %6 %170 + %172 = OpAccessChain %29 %26 %28 %45 + %173 = OpLoad %6 %172 + %174 = OpFOrdLessThan %11 %171 %173 + OpSelectionMerge %179 None + OpBranchConditional %174 %175 %178 + %175 = OpLabel + %177 = OpCompositeExtract %6 %130 2 + OpBranch %179 + %178 = OpLabel + OpBranch %179 + %179 = OpLabel + %190 = OpPhi %6 %177 %175 %55 %178 + %181 = OpFOrdGreaterThan %11 %169 %190 + OpSelectionMerge %183 None + OpBranchConditional %181 %182 %183 + %182 = OpLabel + OpBranch %184 + %183 = OpLabel + OpBranch %184 + %184 = OpLabel + %191 = OpPhi %11 %35 %166 %60 %182 %35 %183 + OpSelectionMerge %133 None + OpBranchConditional %191 %132 %133 + %132 = OpLabel + %146 = OpCompositeConstruct %9 %106 %91 %91 %106 + OpStore %83 %146 + OpBranch %133 + %133 = OpLabel + OpBranch %98 + %98 = OpLabel + %148 = OpIAdd %27 %189 %45 + OpBranch %95 + %97 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-global-counter-break-set-ivec-elements.amber b/vulkan/amber/graphicsfuzz/cov-loop-global-counter-break-set-ivec-elements.amber new file mode 100644 index 0000000..80ece9b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-global-counter-break-set-ivec-elements.amber @@ -0,0 +1,235 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_3 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 3, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# ivec4 v = ivec4(_int_0); +# int a = 1; +# int b = 1; +# +# do +# { +# _GLF_global_loop_count++; +# +# if(b++ >= 3) +# { +# break; +# } +# +# // Executed twice: v[1] = 2 and v[2] = 3. +# v[a++] = a; +# } +# while(_GLF_global_loop_count < _GLF_global_loop_bound); +# +# // Always true. +# if(v == ivec4(_int_0, _int_2, _int_3, _int_0)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 86 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %66 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %12 "v" + OpName %16 "buf0" + OpMemberName %16 0 "_GLF_uniform_int_values" + OpName %18 "" + OpName %24 "a" + OpName %26 "b" + OpName %66 "_GLF_color" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %66 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Function %10 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 4 + %15 = OpTypeArray %6 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpTypePointer Uniform %6 + %23 = OpTypePointer Function %6 + %25 = OpConstant %6 1 + %35 = OpConstant %6 3 + %36 = OpTypeBool + %46 = OpConstant %6 10 + %58 = OpTypeVector %36 4 + %63 = OpTypeFloat 32 + %64 = OpTypeVector %63 4 + %65 = OpTypePointer Output %64 + %66 = OpVariable %65 Output + %67 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpVariable %11 Function + %24 = OpVariable %23 Function + %26 = OpVariable %23 Function + OpStore %8 %9 + %20 = OpAccessChain %19 %18 %9 %9 + %21 = OpLoad %6 %20 + %22 = OpCompositeConstruct %10 %21 %21 %21 %21 + OpStore %12 %22 + OpStore %24 %25 + OpStore %26 %25 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %28 + %28 = OpLabel + %31 = OpLoad %6 %8 + %32 = OpIAdd %6 %31 %25 + OpStore %8 %32 + %33 = OpLoad %6 %26 + %34 = OpIAdd %6 %33 %25 + OpStore %26 %34 + %37 = OpSGreaterThanEqual %36 %33 %35 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + OpBranch %29 + %39 = OpLabel + %41 = OpLoad %6 %24 + %42 = OpIAdd %6 %41 %25 + OpStore %24 %42 + %43 = OpLoad %6 %24 + %44 = OpAccessChain %23 %12 %41 + OpStore %44 %43 + OpBranch %30 + %30 = OpLabel + %45 = OpLoad %6 %8 + %47 = OpSLessThan %36 %45 %46 + OpBranchConditional %47 %27 %29 + %29 = OpLabel + %48 = OpLoad %10 %12 + %49 = OpAccessChain %19 %18 %9 %9 + %50 = OpLoad %6 %49 + %51 = OpAccessChain %19 %18 %9 %35 + %52 = OpLoad %6 %51 + %53 = OpAccessChain %19 %18 %9 %25 + %54 = OpLoad %6 %53 + %55 = OpAccessChain %19 %18 %9 %9 + %56 = OpLoad %6 %55 + %57 = OpCompositeConstruct %10 %50 %52 %54 %56 + %59 = OpIEqual %58 %48 %57 + %60 = OpAll %36 %59 + OpSelectionMerge %62 None + OpBranchConditional %60 %61 %81 + %61 = OpLabel + %68 = OpAccessChain %19 %18 %9 %67 + %69 = OpLoad %6 %68 + %70 = OpConvertSToF %63 %69 + %71 = OpAccessChain %19 %18 %9 %9 + %72 = OpLoad %6 %71 + %73 = OpConvertSToF %63 %72 + %74 = OpAccessChain %19 %18 %9 %9 + %75 = OpLoad %6 %74 + %76 = OpConvertSToF %63 %75 + %77 = OpAccessChain %19 %18 %9 %67 + %78 = OpLoad %6 %77 + %79 = OpConvertSToF %63 %78 + %80 = OpCompositeConstruct %64 %70 %73 %76 %79 + OpStore %66 %80 + OpBranch %62 + %81 = OpLabel + %82 = OpAccessChain %19 %18 %9 %9 + %83 = OpLoad %6 %82 + %84 = OpConvertSToF %63 %83 + %85 = OpCompositeConstruct %64 %84 %84 %84 %84 + OpStore %66 %85 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 3 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-global-counter-increment-iterator-select-uniform.amber b/vulkan/amber/graphicsfuzz/cov-loop-global-counter-increment-iterator-select-uniform.amber new file mode 100644 index 0000000..6f55bd5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-global-counter-increment-iterator-select-uniform.amber @@ -0,0 +1,337 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_20 _GLF_uniform_int_values[2] +# #define _int_4 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 20, 4] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# // Contents of zero: 0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int zero; +# }; +# +# // Contents of two: 2 +# layout(set = 0, binding = 2) uniform buf2 +# { +# int two; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[10] = int[10](_int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0); +# +# // Iterates ten times because of the global loop bound. +# for(int i = 0; i < _int_20 && _GLF_global_loop_count < _GLF_global_loop_bound; (zero < _int_1) ? i++ : _int_1) +# { +# _GLF_global_loop_count++; +# +# // Always false. +# if(two <= _int_1) +# { +# break; +# } +# +# // True when i == 0. +# if((i / 4) == i) +# { +# arr[i / _int_4] = _int_1; +# } +# } +# +# arr[_int_1]++; +# +# // Always true. +# if(arr[_int_0] == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 140 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %121 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %14 "arr" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %43 "i" + OpName %62 "buf2" + OpMemberName %62 0 "two" + OpName %64 "" + OpName %88 "buf1" + OpMemberName %88 0 "zero" + OpName %90 "" + OpName %121 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpMemberDecorate %62 0 Offset 0 + OpDecorate %62 Block + OpDecorate %64 DescriptorSet 0 + OpDecorate %64 Binding 2 + OpMemberDecorate %88 0 Offset 0 + OpDecorate %88 Block + OpDecorate %90 DescriptorSet 0 + OpDecorate %90 Binding 1 + OpDecorate %121 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 10 + %12 = OpTypeArray %6 %11 + %13 = OpTypePointer Function %12 + %15 = OpConstant %10 4 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypePointer Uniform %6 + %42 = OpTypePointer Function %6 + %50 = OpConstant %6 2 + %53 = OpTypeBool + %56 = OpConstant %6 10 + %60 = OpConstant %6 1 + %62 = OpTypeStruct %6 + %63 = OpTypePointer Uniform %62 + %64 = OpVariable %63 Uniform + %74 = OpConstant %6 4 + %81 = OpConstant %6 3 + %88 = OpTypeStruct %6 + %89 = OpTypePointer Uniform %88 + %90 = OpVariable %89 Uniform + %118 = OpTypeFloat 32 + %119 = OpTypeVector %118 4 + %120 = OpTypePointer Output %119 + %121 = OpVariable %120 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpVariable %13 Function + %43 = OpVariable %42 Function + %96 = OpVariable %42 Function + OpStore %8 %9 + %21 = OpAccessChain %20 %19 %9 %9 + %22 = OpLoad %6 %21 + %23 = OpAccessChain %20 %19 %9 %9 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %20 %19 %9 %9 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %20 %19 %9 %9 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %20 %19 %9 %9 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %20 %19 %9 %9 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %20 %19 %9 %9 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %20 %19 %9 %9 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %20 %19 %9 %9 + %38 = OpLoad %6 %37 + %39 = OpAccessChain %20 %19 %9 %9 + %40 = OpLoad %6 %39 + %41 = OpCompositeConstruct %12 %22 %24 %26 %28 %30 %32 %34 %36 %38 %40 + OpStore %14 %41 + OpStore %43 %9 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %6 %43 + %51 = OpAccessChain %20 %19 %9 %50 + %52 = OpLoad %6 %51 + %54 = OpSLessThan %53 %49 %52 + %55 = OpLoad %6 %8 + %57 = OpSLessThan %53 %55 %56 + %58 = OpLogicalAnd %53 %54 %57 + OpBranchConditional %58 %45 %46 + %45 = OpLabel + %59 = OpLoad %6 %8 + %61 = OpIAdd %6 %59 %60 + OpStore %8 %61 + %65 = OpAccessChain %20 %64 %9 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %20 %19 %9 %60 + %68 = OpLoad %6 %67 + %69 = OpSLessThanEqual %53 %66 %68 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %71 + %70 = OpLabel + OpBranch %46 + %71 = OpLabel + %73 = OpLoad %6 %43 + %75 = OpSDiv %6 %73 %74 + %76 = OpLoad %6 %43 + %77 = OpIEqual %53 %75 %76 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %80 = OpLoad %6 %43 + %82 = OpAccessChain %20 %19 %9 %81 + %83 = OpLoad %6 %82 + %84 = OpSDiv %6 %80 %83 + %85 = OpAccessChain %20 %19 %9 %60 + %86 = OpLoad %6 %85 + %87 = OpAccessChain %42 %14 %84 + OpStore %87 %86 + OpBranch %79 + %79 = OpLabel + OpBranch %47 + %47 = OpLabel + %91 = OpAccessChain %20 %90 %9 + %92 = OpLoad %6 %91 + %93 = OpAccessChain %20 %19 %9 %60 + %94 = OpLoad %6 %93 + %95 = OpSLessThan %53 %92 %94 + OpSelectionMerge %98 None + OpBranchConditional %95 %97 %101 + %97 = OpLabel + %99 = OpLoad %6 %43 + %100 = OpIAdd %6 %99 %60 + OpStore %43 %100 + OpStore %96 %99 + OpBranch %98 + %101 = OpLabel + %102 = OpAccessChain %20 %19 %9 %60 + %103 = OpLoad %6 %102 + OpStore %96 %103 + OpBranch %98 + %98 = OpLabel + OpBranch %44 + %46 = OpLabel + %104 = OpAccessChain %20 %19 %9 %60 + %105 = OpLoad %6 %104 + %106 = OpAccessChain %42 %14 %105 + %107 = OpLoad %6 %106 + %108 = OpIAdd %6 %107 %60 + OpStore %106 %108 + %109 = OpAccessChain %20 %19 %9 %9 + %110 = OpLoad %6 %109 + %111 = OpAccessChain %42 %14 %110 + %112 = OpLoad %6 %111 + %113 = OpAccessChain %20 %19 %9 %60 + %114 = OpLoad %6 %113 + %115 = OpIEqual %53 %112 %114 + OpSelectionMerge %117 None + OpBranchConditional %115 %116 %135 + %116 = OpLabel + %122 = OpAccessChain %20 %19 %9 %60 + %123 = OpLoad %6 %122 + %124 = OpConvertSToF %118 %123 + %125 = OpAccessChain %20 %19 %9 %9 + %126 = OpLoad %6 %125 + %127 = OpConvertSToF %118 %126 + %128 = OpAccessChain %20 %19 %9 %9 + %129 = OpLoad %6 %128 + %130 = OpConvertSToF %118 %129 + %131 = OpAccessChain %20 %19 %9 %60 + %132 = OpLoad %6 %131 + %133 = OpConvertSToF %118 %132 + %134 = OpCompositeConstruct %119 %124 %127 %130 %133 + OpStore %121 %134 + OpBranch %117 + %135 = OpLabel + %136 = OpAccessChain %20 %19 %9 %9 + %137 = OpLoad %6 %136 + %138 = OpConvertSToF %118 %137 + %139 = OpCompositeConstruct %119 %138 %138 %138 %138 + OpStore %121 %139 + OpBranch %117 + %117 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 STD140 DATA + 0 +END +# two +BUFFER variant_two DATA_TYPE int32 STD140 DATA + 2 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 20 4 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-increase-iterator-condition-uniform-copy-array-elements.amber b/vulkan/amber/graphicsfuzz/cov-loop-increase-iterator-condition-uniform-copy-array-elements.amber new file mode 100644 index 0000000..b6756cb --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-increase-iterator-condition-uniform-copy-array-elements.amber @@ -0,0 +1,271 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# #define _int_4 _GLF_uniform_int_values[4] +# #define _int_5 _GLF_uniform_int_values[5] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2, 3, 4, 5] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[6]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[5] = int[5](_int_0, _int_1, _int_2, _int_3, _int_4); +# int ref[5] = int[5](_int_0, _int_1, _int_2, _int_1, _int_1); +# +# // Copies arr[1] to indices 1, 3, and 4. +# for(int i = 0; i < 5; i++) +# { +# // Always true. +# if(_int_0 < _int_1) +# { +# i++; +# } +# arr[_GLF_MAKE_IN_BOUNDS_INT(i, 5)] = arr[_int_1]; +# } +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# // Verify results and set color to black if failed. +# for(int i = _int_0; i < _int_5; i++) +# { +# if(arr[i] != ref[i]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 119 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %78 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %34 "ref" + OpName %47 "i" + OpName %78 "_GLF_color" + OpName %92 "i" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %78 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 5 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 6 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpTypePointer Uniform %6 + %21 = OpConstant %6 1 + %24 = OpConstant %6 2 + %27 = OpConstant %6 3 + %30 = OpConstant %6 4 + %46 = OpTypePointer Function %6 + %54 = OpConstant %6 5 + %55 = OpTypeBool + %75 = OpTypeFloat 32 + %76 = OpTypeVector %75 4 + %77 = OpTypePointer Output %76 + %78 = OpVariable %77 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %34 = OpVariable %10 Function + %47 = OpVariable %46 Function + %92 = OpVariable %46 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %6 %19 + %22 = OpAccessChain %18 %16 %17 %21 + %23 = OpLoad %6 %22 + %25 = OpAccessChain %18 %16 %17 %24 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %18 %16 %17 %27 + %29 = OpLoad %6 %28 + %31 = OpAccessChain %18 %16 %17 %30 + %32 = OpLoad %6 %31 + %33 = OpCompositeConstruct %9 %20 %23 %26 %29 %32 + OpStore %11 %33 + %35 = OpAccessChain %18 %16 %17 %17 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %18 %16 %17 %21 + %38 = OpLoad %6 %37 + %39 = OpAccessChain %18 %16 %17 %24 + %40 = OpLoad %6 %39 + %41 = OpAccessChain %18 %16 %17 %21 + %42 = OpLoad %6 %41 + %43 = OpAccessChain %18 %16 %17 %21 + %44 = OpLoad %6 %43 + %45 = OpCompositeConstruct %9 %36 %38 %40 %42 %44 + OpStore %34 %45 + OpStore %47 %17 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %6 %47 + %56 = OpSLessThan %55 %53 %54 + OpBranchConditional %56 %49 %50 + %49 = OpLabel + %57 = OpAccessChain %18 %16 %17 %17 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %18 %16 %17 %21 + %60 = OpLoad %6 %59 + %61 = OpSLessThan %55 %58 %60 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %63 + %62 = OpLabel + %64 = OpLoad %6 %47 + %65 = OpIAdd %6 %64 %21 + OpStore %47 %65 + OpBranch %63 + %63 = OpLabel + %66 = OpLoad %6 %47 + %67 = OpExtInst %6 %1 SClamp %66 %17 %30 + %68 = OpAccessChain %18 %16 %17 %21 + %69 = OpLoad %6 %68 + %70 = OpAccessChain %46 %11 %69 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %46 %11 %67 + OpStore %72 %71 + OpBranch %51 + %51 = OpLabel + %73 = OpLoad %6 %47 + %74 = OpIAdd %6 %73 %21 + OpStore %47 %74 + OpBranch %48 + %50 = OpLabel + %79 = OpAccessChain %18 %16 %17 %21 + %80 = OpLoad %6 %79 + %81 = OpConvertSToF %75 %80 + %82 = OpAccessChain %18 %16 %17 %17 + %83 = OpLoad %6 %82 + %84 = OpConvertSToF %75 %83 + %85 = OpAccessChain %18 %16 %17 %17 + %86 = OpLoad %6 %85 + %87 = OpConvertSToF %75 %86 + %88 = OpAccessChain %18 %16 %17 %21 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %75 %89 + %91 = OpCompositeConstruct %76 %81 %84 %87 %90 + OpStore %78 %91 + %93 = OpAccessChain %18 %16 %17 %17 + %94 = OpLoad %6 %93 + OpStore %92 %94 + OpBranch %95 + %95 = OpLabel + OpLoopMerge %97 %98 None + OpBranch %99 + %99 = OpLabel + %100 = OpLoad %6 %92 + %101 = OpAccessChain %18 %16 %17 %54 + %102 = OpLoad %6 %101 + %103 = OpSLessThan %55 %100 %102 + OpBranchConditional %103 %96 %97 + %96 = OpLabel + %104 = OpLoad %6 %92 + %105 = OpAccessChain %46 %11 %104 + %106 = OpLoad %6 %105 + %107 = OpLoad %6 %92 + %108 = OpAccessChain %46 %34 %107 + %109 = OpLoad %6 %108 + %110 = OpINotEqual %55 %106 %109 + OpSelectionMerge %112 None + OpBranchConditional %110 %111 %112 + %111 = OpLabel + %113 = OpAccessChain %18 %16 %17 %17 + %114 = OpLoad %6 %113 + %115 = OpConvertSToF %75 %114 + %116 = OpCompositeConstruct %76 %115 %115 %115 %115 + OpStore %78 %116 + OpBranch %112 + %112 = OpLabel + OpBranch %98 + %98 = OpLabel + %117 = OpLoad %6 %92 + %118 = OpIAdd %6 %117 %21 + OpStore %92 %118 + OpBranch %95 + %97 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 3 4 5 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-increment-array-elements-clamp-index.amber b/vulkan/amber/graphicsfuzz/cov-loop-increment-array-elements-clamp-index.amber new file mode 100644 index 0000000..0b09e09 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-increment-array-elements-clamp-index.amber @@ -0,0 +1,365 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_3 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_8962_56 _GLF_uniform_float_values[2] +# #define _float_3_0 _GLF_uniform_float_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0, 8962.56, 3.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[4]; +# }; +# // Contents of _GLF_uniform_int_values: [0, 1, 3, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# highp vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float A[3] = float[3](_float_1_0, _float_1_0, _float_1_0); +# _GLF_color = vec4(_float_8962_56, _float_1_0, _float_1_0, _float_1_0); +# int i = -1; +# +# // Iterates through i = -1..1. +# do +# { +# // Breaks when i == 1. +# if(i > int(injectionSwitch.x)) +# { +# break; +# } +# +# // Iterates once. +# for(int j = int(injectionSwitch.y); j > 0; j --) +# { +# // Always true. +# if(injectionSwitch.y > _float_0_0) +# { +# _GLF_color = vec4(_int_0); +# } +# +# // A[clamp(i, 0, 3)]++ +# A[_GLF_MAKE_IN_BOUNDS_INT(i, 3)] += float[3](_float_1_0, _float_1_0, _float_1_0)[_GLF_MAKE_IN_BOUNDS_INT(i, 3)]; +# } +# i++; +# } +# while(i < 50); +# +# // Always true. +# if(A[_int_0] == _float_3_0 && A[_int_1] == _float_1_0 && A[_int_2] == _float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 159 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %30 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "A" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %30 "_GLF_color" + OpName %42 "i" + OpName %50 "buf2" + OpMemberName %50 0 "injectionSwitch" + OpName %52 "" + OpName %62 "j" + OpName %82 "buf1" + OpMemberName %82 0 "_GLF_uniform_int_values" + OpName %84 "" + OpName %101 "indexable" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %30 Location 0 + OpMemberDecorate %50 0 Offset 0 + OpDecorate %50 Block + OpDecorate %52 DescriptorSet 0 + OpDecorate %52 Binding 2 + OpDecorate %81 ArrayStride 16 + OpMemberDecorate %82 0 Offset 0 + OpDecorate %82 Block + OpDecorate %84 DescriptorSet 0 + OpDecorate %84 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 3 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 4 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpConstant %17 1 + %20 = OpTypePointer Uniform %6 + %28 = OpTypeVector %6 4 + %29 = OpTypePointer Output %28 + %30 = OpVariable %29 Output + %31 = OpConstant %17 2 + %41 = OpTypePointer Function %17 + %43 = OpConstant %17 -1 + %49 = OpTypeVector %6 2 + %50 = OpTypeStruct %49 + %51 = OpTypePointer Uniform %50 + %52 = OpVariable %51 Uniform + %53 = OpConstant %7 0 + %57 = OpTypeBool + %63 = OpConstant %7 1 + %81 = OpTypeArray %17 %12 + %82 = OpTypeStruct %81 + %83 = OpTypePointer Uniform %82 + %84 = OpVariable %83 Uniform + %85 = OpTypePointer Uniform %17 + %102 = OpTypePointer Function %6 + %114 = OpConstant %17 50 + %120 = OpConstant %17 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %42 = OpVariable %41 Function + %62 = OpVariable %41 Function + %101 = OpVariable %10 Function + %21 = OpAccessChain %20 %16 %18 %19 + %22 = OpLoad %6 %21 + %23 = OpAccessChain %20 %16 %18 %19 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %20 %16 %18 %19 + %26 = OpLoad %6 %25 + %27 = OpCompositeConstruct %9 %22 %24 %26 + OpStore %11 %27 + %32 = OpAccessChain %20 %16 %18 %31 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %20 %16 %18 %19 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %20 %16 %18 %19 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %20 %16 %18 %19 + %39 = OpLoad %6 %38 + %40 = OpCompositeConstruct %28 %33 %35 %37 %39 + OpStore %30 %40 + OpStore %42 %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %45 + %45 = OpLabel + %48 = OpLoad %17 %42 + %54 = OpAccessChain %20 %52 %18 %53 + %55 = OpLoad %6 %54 + %56 = OpConvertFToS %17 %55 + %58 = OpSGreaterThan %57 %48 %56 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %60 + %59 = OpLabel + OpBranch %46 + %60 = OpLabel + %64 = OpAccessChain %20 %52 %18 %63 + %65 = OpLoad %6 %64 + %66 = OpConvertFToS %17 %65 + OpStore %62 %66 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %72 = OpLoad %17 %62 + %73 = OpSGreaterThan %57 %72 %18 + OpBranchConditional %73 %68 %69 + %68 = OpLabel + %74 = OpAccessChain %20 %52 %18 %63 + %75 = OpLoad %6 %74 + %76 = OpAccessChain %20 %16 %18 %18 + %77 = OpLoad %6 %76 + %78 = OpFOrdGreaterThan %57 %75 %77 + OpSelectionMerge %80 None + OpBranchConditional %78 %79 %80 + %79 = OpLabel + %86 = OpAccessChain %85 %84 %18 %18 + %87 = OpLoad %17 %86 + %88 = OpConvertSToF %6 %87 + %89 = OpCompositeConstruct %28 %88 %88 %88 %88 + OpStore %30 %89 + OpBranch %80 + %80 = OpLabel + %90 = OpLoad %17 %42 + %91 = OpExtInst %17 %1 SClamp %90 %18 %31 + %92 = OpAccessChain %20 %16 %18 %19 + %93 = OpLoad %6 %92 + %94 = OpAccessChain %20 %16 %18 %19 + %95 = OpLoad %6 %94 + %96 = OpAccessChain %20 %16 %18 %19 + %97 = OpLoad %6 %96 + %98 = OpCompositeConstruct %9 %93 %95 %97 + %99 = OpLoad %17 %42 + %100 = OpExtInst %17 %1 SClamp %99 %18 %31 + OpStore %101 %98 + %103 = OpAccessChain %102 %101 %100 + %104 = OpLoad %6 %103 + %105 = OpAccessChain %102 %11 %91 + %106 = OpLoad %6 %105 + %107 = OpFAdd %6 %106 %104 + %108 = OpAccessChain %102 %11 %91 + OpStore %108 %107 + OpBranch %70 + %70 = OpLabel + %109 = OpLoad %17 %62 + %110 = OpISub %17 %109 %19 + OpStore %62 %110 + OpBranch %67 + %69 = OpLabel + %111 = OpLoad %17 %42 + %112 = OpIAdd %17 %111 %19 + OpStore %42 %112 + OpBranch %47 + %47 = OpLabel + %113 = OpLoad %17 %42 + %115 = OpSLessThan %57 %113 %114 + OpBranchConditional %115 %44 %46 + %46 = OpLabel + %116 = OpAccessChain %85 %84 %18 %18 + %117 = OpLoad %17 %116 + %118 = OpAccessChain %102 %11 %117 + %119 = OpLoad %6 %118 + %121 = OpAccessChain %20 %16 %18 %120 + %122 = OpLoad %6 %121 + %123 = OpFOrdEqual %57 %119 %122 + OpSelectionMerge %125 None + OpBranchConditional %123 %124 %125 + %124 = OpLabel + %126 = OpAccessChain %85 %84 %18 %19 + %127 = OpLoad %17 %126 + %128 = OpAccessChain %102 %11 %127 + %129 = OpLoad %6 %128 + %130 = OpAccessChain %20 %16 %18 %19 + %131 = OpLoad %6 %130 + %132 = OpFOrdEqual %57 %129 %131 + OpBranch %125 + %125 = OpLabel + %133 = OpPhi %57 %123 %46 %132 %124 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %136 = OpAccessChain %85 %84 %18 %120 + %137 = OpLoad %17 %136 + %138 = OpAccessChain %102 %11 %137 + %139 = OpLoad %6 %138 + %140 = OpAccessChain %20 %16 %18 %19 + %141 = OpLoad %6 %140 + %142 = OpFOrdEqual %57 %139 %141 + OpBranch %135 + %135 = OpLabel + %143 = OpPhi %57 %133 %125 %142 %134 + OpSelectionMerge %145 None + OpBranchConditional %143 %144 %145 + %144 = OpLabel + %146 = OpAccessChain %85 %84 %18 %19 + %147 = OpLoad %17 %146 + %148 = OpConvertSToF %6 %147 + %149 = OpAccessChain %85 %84 %18 %18 + %150 = OpLoad %17 %149 + %151 = OpConvertSToF %6 %150 + %152 = OpAccessChain %85 %84 %18 %18 + %153 = OpLoad %17 %152 + %154 = OpConvertSToF %6 %153 + %155 = OpAccessChain %85 %84 %18 %19 + %156 = OpLoad %17 %155 + %157 = OpConvertSToF %6 %156 + %158 = OpCompositeConstruct %28 %148 %151 %154 %157 + OpStore %30 %158 + OpBranch %145 + %145 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 3 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 8962.56 3.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-increment-array-index-array-usuborrow-feedback.amber b/vulkan/amber/graphicsfuzz/cov-loop-increment-array-index-array-usuborrow-feedback.amber new file mode 100644 index 0000000..d635464 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-increment-array-index-array-usuborrow-feedback.amber @@ -0,0 +1,334 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _uint_1 _GLF_uniform_uint_values[0] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_2_0 _GLF_uniform_float_values[1] +# #define _float_3_0 _GLF_uniform_float_values[2] +# #define _float_4_0 _GLF_uniform_float_values[3] +# #define _float_5_0 _GLF_uniform_float_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_uint_values: 1 +# layout(set = 0, binding = 0) uniform buf0 +# { +# uint _GLF_uniform_uint_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 10] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 2.0, 3.0, 4.0, 5.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# float _GLF_uniform_float_values[5]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# uint a = _uint_1; +# float arr[16] = float[16](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0); +# int i = _int_1; +# +# // Iterated once. +# do +# { +# // usubBorrow returns zero and sets a to zero. If this was to be iterated more usubBorrow would return -1. +# arr[i++] += float[5](_float_1_0, _float_2_0, _float_3_0, _float_4_0, _float_5_0)[usubBorrow(a, _uint_1, a)]; +# } +# while(i < _int_1); +# +# // Always true. +# if(arr[_int_1] == _float_2_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 148 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %128 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %12 "a" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_uint_values" + OpName %17 "" + OpName %25 "arr" + OpName %28 "buf2" + OpMemberName %28 0 "_GLF_uniform_float_values" + OpName %30 "" + OpName %66 "i" + OpName %69 "buf1" + OpMemberName %69 0 "_GLF_uniform_int_values" + OpName %71 "" + OpName %99 "ResType" + OpName %104 "indexable" + OpName %128 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %27 ArrayStride 16 + OpMemberDecorate %28 0 Offset 0 + OpDecorate %28 Block + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 2 + OpDecorate %68 ArrayStride 16 + OpMemberDecorate %69 0 Offset 0 + OpDecorate %69 Block + OpDecorate %71 DescriptorSet 0 + OpDecorate %71 Binding 1 + OpDecorate %128 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeInt 32 0 + %11 = OpTypePointer Function %10 + %13 = OpConstant %10 1 + %14 = OpTypeArray %10 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypePointer Uniform %10 + %21 = OpTypeFloat 32 + %22 = OpConstant %10 16 + %23 = OpTypeArray %21 %22 + %24 = OpTypePointer Function %23 + %26 = OpConstant %10 5 + %27 = OpTypeArray %21 %26 + %28 = OpTypeStruct %27 + %29 = OpTypePointer Uniform %28 + %30 = OpVariable %29 Uniform + %31 = OpTypePointer Uniform %21 + %65 = OpTypePointer Function %6 + %67 = OpConstant %10 3 + %68 = OpTypeArray %6 %67 + %69 = OpTypeStruct %68 + %70 = OpTypePointer Uniform %69 + %71 = OpVariable %70 Uniform + %72 = OpTypePointer Uniform %6 + %80 = OpConstant %6 1 + %86 = OpConstant %6 2 + %89 = OpConstant %6 3 + %92 = OpConstant %6 4 + %99 = OpTypeStruct %10 %10 + %103 = OpTypePointer Function %27 + %105 = OpTypePointer Function %21 + %115 = OpTypeBool + %126 = OpTypeVector %21 4 + %127 = OpTypePointer Output %126 + %128 = OpVariable %127 Output + %147 = OpConstant %6 10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpVariable %11 Function + %25 = OpVariable %24 Function + %66 = OpVariable %65 Function + %104 = OpVariable %103 Function + OpStore %8 %9 + %19 = OpAccessChain %18 %17 %9 %9 + %20 = OpLoad %10 %19 + OpStore %12 %20 + %32 = OpAccessChain %31 %30 %9 %9 + %33 = OpLoad %21 %32 + %34 = OpAccessChain %31 %30 %9 %9 + %35 = OpLoad %21 %34 + %36 = OpAccessChain %31 %30 %9 %9 + %37 = OpLoad %21 %36 + %38 = OpAccessChain %31 %30 %9 %9 + %39 = OpLoad %21 %38 + %40 = OpAccessChain %31 %30 %9 %9 + %41 = OpLoad %21 %40 + %42 = OpAccessChain %31 %30 %9 %9 + %43 = OpLoad %21 %42 + %44 = OpAccessChain %31 %30 %9 %9 + %45 = OpLoad %21 %44 + %46 = OpAccessChain %31 %30 %9 %9 + %47 = OpLoad %21 %46 + %48 = OpAccessChain %31 %30 %9 %9 + %49 = OpLoad %21 %48 + %50 = OpAccessChain %31 %30 %9 %9 + %51 = OpLoad %21 %50 + %52 = OpAccessChain %31 %30 %9 %9 + %53 = OpLoad %21 %52 + %54 = OpAccessChain %31 %30 %9 %9 + %55 = OpLoad %21 %54 + %56 = OpAccessChain %31 %30 %9 %9 + %57 = OpLoad %21 %56 + %58 = OpAccessChain %31 %30 %9 %9 + %59 = OpLoad %21 %58 + %60 = OpAccessChain %31 %30 %9 %9 + %61 = OpLoad %21 %60 + %62 = OpAccessChain %31 %30 %9 %9 + %63 = OpLoad %21 %62 + %64 = OpCompositeConstruct %23 %33 %35 %37 %39 %41 %43 %45 %47 %49 %51 %53 %55 %57 %59 %61 %63 + OpStore %25 %64 + %73 = OpAccessChain %72 %71 %9 %9 + %74 = OpLoad %6 %73 + OpStore %66 %74 + OpBranch %75 + %75 = OpLabel + OpLoopMerge %77 %78 None + OpBranch %76 + %76 = OpLabel + %79 = OpLoad %6 %66 + %81 = OpIAdd %6 %79 %80 + OpStore %66 %81 + %82 = OpAccessChain %31 %30 %9 %9 + %83 = OpLoad %21 %82 + %84 = OpAccessChain %31 %30 %9 %80 + %85 = OpLoad %21 %84 + %87 = OpAccessChain %31 %30 %9 %86 + %88 = OpLoad %21 %87 + %90 = OpAccessChain %31 %30 %9 %89 + %91 = OpLoad %21 %90 + %93 = OpAccessChain %31 %30 %9 %92 + %94 = OpLoad %21 %93 + %95 = OpCompositeConstruct %27 %83 %85 %88 %91 %94 + %96 = OpLoad %10 %12 + %97 = OpAccessChain %18 %17 %9 %9 + %98 = OpLoad %10 %97 + %100 = OpISubBorrow %99 %96 %98 + %101 = OpCompositeExtract %10 %100 1 + OpStore %12 %101 + %102 = OpCompositeExtract %10 %100 0 + OpStore %104 %95 + %106 = OpAccessChain %105 %104 %102 + %107 = OpLoad %21 %106 + %108 = OpAccessChain %105 %25 %79 + %109 = OpLoad %21 %108 + %110 = OpFAdd %21 %109 %107 + %111 = OpAccessChain %105 %25 %79 + OpStore %111 %110 + OpBranch %78 + %78 = OpLabel + %112 = OpLoad %6 %66 + %113 = OpAccessChain %72 %71 %9 %9 + %114 = OpLoad %6 %113 + %116 = OpSLessThan %115 %112 %114 + OpBranchConditional %116 %75 %77 + %77 = OpLabel + %117 = OpAccessChain %72 %71 %9 %9 + %118 = OpLoad %6 %117 + %119 = OpAccessChain %105 %25 %118 + %120 = OpLoad %21 %119 + %121 = OpAccessChain %31 %30 %9 %80 + %122 = OpLoad %21 %121 + %123 = OpFOrdEqual %115 %120 %122 + OpSelectionMerge %125 None + OpBranchConditional %123 %124 %142 + %124 = OpLabel + %129 = OpAccessChain %72 %71 %9 %9 + %130 = OpLoad %6 %129 + %131 = OpConvertSToF %21 %130 + %132 = OpAccessChain %72 %71 %9 %80 + %133 = OpLoad %6 %132 + %134 = OpConvertSToF %21 %133 + %135 = OpAccessChain %72 %71 %9 %80 + %136 = OpLoad %6 %135 + %137 = OpConvertSToF %21 %136 + %138 = OpAccessChain %72 %71 %9 %9 + %139 = OpLoad %6 %138 + %140 = OpConvertSToF %21 %139 + %141 = OpCompositeConstruct %126 %131 %134 %137 %140 + OpStore %128 %141 + OpBranch %125 + %142 = OpLabel + %143 = OpAccessChain %72 %71 %9 %80 + %144 = OpLoad %6 %143 + %145 = OpConvertSToF %21 %144 + %146 = OpCompositeConstruct %126 %145 %145 %145 %145 + OpStore %128 %146 + OpBranch %125 + %125 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 2.0 3.0 4.0 5.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 10 +END +# _GLF_uniform_uint_values +BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-increment-integer-findmsb-minus-uniform.amber b/vulkan/amber/graphicsfuzz/cov-loop-increment-integer-findmsb-minus-uniform.amber new file mode 100644 index 0000000..2cd7f1e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-increment-integer-findmsb-minus-uniform.amber @@ -0,0 +1,237 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_3 _GLF_uniform_int_values[1] +# #define _int_63 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# #define _int_1 _GLF_uniform_int_values[4] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [10, 3, 63, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_3; +# +# for(int i = _int_0; i < _int_10; i ++) +# { +# // b = findMSB(256 - 1) = findMSB(255) = 7 +# int b = findMSB(256 - _int_1); +# // a = a + b - 1 = a + 6 +# a = a + b - _int_1; +# } +# +# // Always true. +# if(a == _int_63) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 83 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %59 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %34 "b" + OpName %59 "_GLF_color" + OpName %80 "buf0" + OpMemberName %80 0 "_GLF_uniform_float_values" + OpName %82 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %59 Location 0 + OpDecorate %79 ArrayStride 16 + OpMemberDecorate %80 0 Offset 0 + OpDecorate %80 Block + OpDecorate %82 DescriptorSet 0 + OpDecorate %82 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 5 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %6 3 + %32 = OpTypeBool + %35 = OpConstant %6 256 + %36 = OpConstant %6 4 + %50 = OpConstant %6 2 + %56 = OpTypeFloat 32 + %57 = OpTypeVector %56 4 + %58 = OpTypePointer Output %57 + %59 = OpVariable %58 Output + %78 = OpConstant %9 2 + %79 = OpTypeArray %56 %78 + %80 = OpTypeStruct %79 + %81 = OpTypePointer Uniform %80 + %82 = OpVariable %81 Uniform + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %34 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %22 = OpAccessChain %17 %14 %15 %21 + %23 = OpLoad %6 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %20 + %30 = OpAccessChain %17 %14 %15 %15 + %31 = OpLoad %6 %30 + %33 = OpSLessThan %32 %29 %31 + OpBranchConditional %33 %25 %26 + %25 = OpLabel + %37 = OpAccessChain %17 %14 %15 %36 + %38 = OpLoad %6 %37 + %39 = OpISub %6 %35 %38 + %40 = OpExtInst %6 %1 FindSMsb %39 + OpStore %34 %40 + %41 = OpLoad %6 %8 + %42 = OpLoad %6 %34 + %43 = OpIAdd %6 %41 %42 + %44 = OpAccessChain %17 %14 %15 %36 + %45 = OpLoad %6 %44 + %46 = OpISub %6 %43 %45 + OpStore %8 %46 + OpBranch %27 + %27 = OpLabel + %47 = OpLoad %6 %20 + %48 = OpIAdd %6 %47 %16 + OpStore %20 %48 + OpBranch %24 + %26 = OpLabel + %49 = OpLoad %6 %8 + %51 = OpAccessChain %17 %14 %15 %50 + %52 = OpLoad %6 %51 + %53 = OpIEqual %32 %49 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %73 + %54 = OpLabel + %60 = OpAccessChain %17 %14 %15 %36 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %56 %61 + %63 = OpAccessChain %17 %14 %15 %21 + %64 = OpLoad %6 %63 + %65 = OpConvertSToF %56 %64 + %66 = OpAccessChain %17 %14 %15 %21 + %67 = OpLoad %6 %66 + %68 = OpConvertSToF %56 %67 + %69 = OpAccessChain %17 %14 %15 %36 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %56 %70 + %72 = OpCompositeConstruct %57 %62 %65 %68 %71 + OpStore %59 %72 + OpBranch %55 + %73 = OpLabel + %74 = OpAccessChain %17 %14 %15 %21 + %75 = OpLoad %6 %74 + %76 = OpConvertSToF %56 %75 + %77 = OpCompositeConstruct %57 %76 %76 %76 %76 + OpStore %59 %77 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 3 63 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-increment-integer-set-output-color-break.amber b/vulkan/amber/graphicsfuzz/cov-loop-increment-integer-set-output-color-break.amber new file mode 100644 index 0000000..f6fa594 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-increment-integer-set-output-color-break.amber @@ -0,0 +1,150 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp int; +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of one: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void main() +# { +# int a = 1; +# +# // Iterated until the break is executed. +# while(int(one) >= 1) +# { +# if(a++ >= 5) +# { +# _GLF_color = vec4(1, 0, 0, 1); +# break; +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %16 "buf0" + OpMemberName %16 0 "one" + OpName %18 "" + OpName %34 "_GLF_color" + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %34 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %15 = OpTypeFloat 32 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpConstant %6 0 + %20 = OpTypePointer Uniform %15 + %24 = OpTypeBool + %28 = OpConstant %6 5 + %32 = OpTypeVector %15 4 + %33 = OpTypePointer Output %32 + %34 = OpVariable %33 Output + %35 = OpConstant %15 1 + %36 = OpConstant %15 0 + %37 = OpConstantComposite %32 %35 %36 %36 %35 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %21 = OpAccessChain %20 %18 %19 + %22 = OpLoad %15 %21 + %23 = OpConvertFToS %6 %22 + %25 = OpSGreaterThanEqual %24 %23 %9 + OpBranchConditional %25 %11 %12 + %11 = OpLabel + %26 = OpLoad %6 %8 + %27 = OpIAdd %6 %26 %9 + OpStore %8 %27 + %29 = OpSGreaterThanEqual %24 %26 %28 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %31 + %30 = OpLabel + OpStore %34 %37 + OpBranch %12 + %31 = OpLabel + OpBranch %13 + %13 = OpLabel + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration.amber b/vulkan/amber/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration.amber new file mode 100644 index 0000000..3a14ca6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration.amber @@ -0,0 +1,307 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_100 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2, 100] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat2x3 m23 = mat2x3(_float_0_0); +# +# // Iterates once because of the break. +# for (int i = 1; i < _int_100; i++) +# { +# m23[_int_1][_int_2] += _float_1_0; +# +# if (gl_FragCoord.y < _float_1_0) +# { +# } +# +# // Always true. +# if (!(true && (gl_FragCoord.x < 0.0))) +# { +# break; +# } +# } +# +# // Always true. +# if(m23 == mat2x3(_int_0, _int_0, _int_0, _int_0, _int_0, _int_1)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 139 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %61 %120 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "m23" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %29 "i" + OpName %38 "buf0" + OpMemberName %38 0 "_GLF_uniform_int_values" + OpName %40 "" + OpName %61 "gl_FragCoord" + OpName %120 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %37 ArrayStride 16 + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 0 + OpDecorate %61 BuiltIn FragCoord + OpDecorate %120 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeMatrix %7 2 + %9 = OpTypePointer Function %8 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpConstant %17 1 + %20 = OpTypePointer Uniform %6 + %23 = OpConstant %6 1 + %24 = OpConstant %6 0 + %28 = OpTypePointer Function %17 + %36 = OpConstant %11 4 + %37 = OpTypeArray %17 %36 + %38 = OpTypeStruct %37 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %41 = OpConstant %17 3 + %42 = OpTypePointer Uniform %17 + %45 = OpTypeBool + %49 = OpConstant %17 2 + %54 = OpTypePointer Function %6 + %59 = OpTypeVector %6 4 + %60 = OpTypePointer Input %59 + %61 = OpVariable %60 Input + %62 = OpConstant %11 1 + %63 = OpTypePointer Input %6 + %71 = OpConstantTrue %45 + %74 = OpConstant %11 0 + %109 = OpTypeVector %45 3 + %119 = OpTypePointer Output %59 + %120 = OpVariable %119 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %29 = OpVariable %28 Function + %21 = OpAccessChain %20 %16 %18 %19 + %22 = OpLoad %6 %21 + %25 = OpCompositeConstruct %7 %22 %24 %24 + %26 = OpCompositeConstruct %7 %24 %22 %24 + %27 = OpCompositeConstruct %8 %25 %26 + OpStore %10 %27 + OpStore %29 %19 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %17 %29 + %43 = OpAccessChain %42 %40 %18 %41 + %44 = OpLoad %17 %43 + %46 = OpSLessThan %45 %35 %44 + OpBranchConditional %46 %31 %32 + %31 = OpLabel + %47 = OpAccessChain %42 %40 %18 %18 + %48 = OpLoad %17 %47 + %50 = OpAccessChain %42 %40 %18 %49 + %51 = OpLoad %17 %50 + %52 = OpAccessChain %20 %16 %18 %18 + %53 = OpLoad %6 %52 + %55 = OpAccessChain %54 %10 %48 %51 + %56 = OpLoad %6 %55 + %57 = OpFAdd %6 %56 %53 + %58 = OpAccessChain %54 %10 %48 %51 + OpStore %58 %57 + %64 = OpAccessChain %63 %61 %62 + %65 = OpLoad %6 %64 + %66 = OpAccessChain %20 %16 %18 %18 + %67 = OpLoad %6 %66 + %68 = OpFOrdLessThan %45 %65 %67 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %70 + %69 = OpLabel + OpBranch %70 + %70 = OpLabel + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %73 + %72 = OpLabel + %75 = OpAccessChain %63 %61 %74 + %76 = OpLoad %6 %75 + %77 = OpFOrdLessThan %45 %76 %24 + OpBranch %73 + %73 = OpLabel + %78 = OpPhi %45 %71 %70 %77 %72 + %79 = OpLogicalNot %45 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %80 %81 + %80 = OpLabel + OpBranch %32 + %81 = OpLabel + OpBranch %33 + %33 = OpLabel + %83 = OpLoad %17 %29 + %84 = OpIAdd %17 %83 %19 + OpStore %29 %84 + OpBranch %30 + %32 = OpLabel + %85 = OpLoad %8 %10 + %86 = OpAccessChain %42 %40 %18 %19 + %87 = OpLoad %17 %86 + %88 = OpConvertSToF %6 %87 + %89 = OpAccessChain %42 %40 %18 %19 + %90 = OpLoad %17 %89 + %91 = OpConvertSToF %6 %90 + %92 = OpAccessChain %42 %40 %18 %19 + %93 = OpLoad %17 %92 + %94 = OpConvertSToF %6 %93 + %95 = OpAccessChain %42 %40 %18 %19 + %96 = OpLoad %17 %95 + %97 = OpConvertSToF %6 %96 + %98 = OpAccessChain %42 %40 %18 %19 + %99 = OpLoad %17 %98 + %100 = OpConvertSToF %6 %99 + %101 = OpAccessChain %42 %40 %18 %18 + %102 = OpLoad %17 %101 + %103 = OpConvertSToF %6 %102 + %104 = OpCompositeConstruct %7 %88 %91 %94 + %105 = OpCompositeConstruct %7 %97 %100 %103 + %106 = OpCompositeConstruct %8 %104 %105 + %107 = OpCompositeExtract %7 %85 0 + %108 = OpCompositeExtract %7 %106 0 + %110 = OpFOrdEqual %109 %107 %108 + %111 = OpAll %45 %110 + %112 = OpCompositeExtract %7 %85 1 + %113 = OpCompositeExtract %7 %106 1 + %114 = OpFOrdEqual %109 %112 %113 + %115 = OpAll %45 %114 + %116 = OpLogicalAnd %45 %111 %115 + OpSelectionMerge %118 None + OpBranchConditional %116 %117 %134 + %117 = OpLabel + %121 = OpAccessChain %42 %40 %18 %18 + %122 = OpLoad %17 %121 + %123 = OpConvertSToF %6 %122 + %124 = OpAccessChain %42 %40 %18 %19 + %125 = OpLoad %17 %124 + %126 = OpConvertSToF %6 %125 + %127 = OpAccessChain %42 %40 %18 %19 + %128 = OpLoad %17 %127 + %129 = OpConvertSToF %6 %128 + %130 = OpAccessChain %42 %40 %18 %18 + %131 = OpLoad %17 %130 + %132 = OpConvertSToF %6 %131 + %133 = OpCompositeConstruct %59 %123 %126 %129 %132 + OpStore %120 %133 + OpBranch %118 + %134 = OpLabel + %135 = OpAccessChain %42 %40 %18 %19 + %136 = OpLoad %17 %135 + %137 = OpConvertSToF %6 %136 + %138 = OpCompositeConstruct %59 %137 %137 %137 %137 + OpStore %120 %138 + OpBranch %118 + %118 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 100 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index.amber b/vulkan/amber/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index.amber new file mode 100644 index 0000000..7baf835 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index.amber @@ -0,0 +1,215 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_5 _GLF_uniform_int_values[2] +# #define _int_9 _GLF_uniform_int_values[3] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 5, 9] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_9; +# +# // Iteration i = 0: a is incremented to 10. +# // Iteration i = 1: a = a / 1 = a = 10. +# // Iteration i = 2: a = a / 2 = 10 / 2 = 5. +# for(int i = 0; i < 3; i++) +# { +# if(i == _int_0) +# { +# a++; +# } +# else +# { +# a = a / i; +# } +# } +# +# // Always true. +# if(a == _int_5) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %54 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %54 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %54 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 3 + %17 = OpTypePointer Uniform %6 + %27 = OpTypeBool + %30 = OpConstant %6 1 + %45 = OpConstant %6 2 + %51 = OpTypeFloat 32 + %52 = OpTypeVector %51 4 + %53 = OpTypePointer Output %52 + %54 = OpVariable %53 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpStore %20 %15 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %6 %20 + %28 = OpSLessThan %27 %26 %16 + OpBranchConditional %28 %22 %23 + %22 = OpLabel + %29 = OpLoad %6 %20 + %31 = OpAccessChain %17 %14 %15 %30 + %32 = OpLoad %6 %31 + %33 = OpIEqual %27 %29 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %38 + %34 = OpLabel + %36 = OpLoad %6 %8 + %37 = OpIAdd %6 %36 %30 + OpStore %8 %37 + OpBranch %35 + %38 = OpLabel + %39 = OpLoad %6 %8 + %40 = OpLoad %6 %20 + %41 = OpSDiv %6 %39 %40 + OpStore %8 %41 + OpBranch %35 + %35 = OpLabel + OpBranch %24 + %24 = OpLabel + %42 = OpLoad %6 %20 + %43 = OpIAdd %6 %42 %30 + OpStore %20 %43 + OpBranch %21 + %23 = OpLabel + %44 = OpLoad %6 %8 + %46 = OpAccessChain %17 %14 %15 %45 + %47 = OpLoad %6 %46 + %48 = OpIEqual %27 %44 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %68 + %49 = OpLabel + %55 = OpAccessChain %17 %14 %15 %15 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %51 %56 + %58 = OpAccessChain %17 %14 %15 %30 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %51 %59 + %61 = OpAccessChain %17 %14 %15 %30 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %51 %62 + %64 = OpAccessChain %17 %14 %15 %15 + %65 = OpLoad %6 %64 + %66 = OpConvertSToF %51 %65 + %67 = OpCompositeConstruct %52 %57 %60 %63 %66 + OpStore %54 %67 + OpBranch %50 + %68 = OpLabel + %69 = OpAccessChain %17 %14 %15 %30 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %51 %70 + %72 = OpCompositeConstruct %52 %71 %71 %71 %71 + OpStore %54 %72 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 5 9 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-index-array-max-negative-zero.amber b/vulkan/amber/graphicsfuzz/cov-loop-index-array-max-negative-zero.amber new file mode 100644 index 0000000..27425b5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-index-array-max-negative-zero.amber @@ -0,0 +1,252 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [2, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int idx = -87256; +# int arr[3] = int[3](_int_0, _int_1, _int_2); +# +# for(int i = 0; i < 10; i++) +# { +# // Always true. +# if(arr[_int_1] <= _int_1) +# { +# // The array index is always zero. +# arr[max(idx++, 0)] = _int_1; +# } +# } +# +# // Always true. +# if(arr[_int_0] == _int_1 && arr[_int_1] == _int_1 && arr[_int_2] == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 108 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %89 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "idx" + OpName %14 "arr" + OpName %16 "buf0" + OpMemberName %16 0 "_GLF_uniform_int_values" + OpName %18 "" + OpName %30 "i" + OpName %89 "_GLF_color" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %89 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 -87256 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 3 + %12 = OpTypeArray %6 %11 + %13 = OpTypePointer Function %12 + %15 = OpTypeArray %6 %11 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpConstant %6 0 + %20 = OpConstant %6 2 + %21 = OpTypePointer Uniform %6 + %24 = OpConstant %6 1 + %37 = OpConstant %6 10 + %38 = OpTypeBool + %86 = OpTypeFloat 32 + %87 = OpTypeVector %86 4 + %88 = OpTypePointer Output %87 + %89 = OpVariable %88 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %14 = OpVariable %13 Function + %30 = OpVariable %7 Function + OpStore %8 %9 + %22 = OpAccessChain %21 %18 %19 %20 + %23 = OpLoad %6 %22 + %25 = OpAccessChain %21 %18 %19 %24 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %21 %18 %19 %19 + %28 = OpLoad %6 %27 + %29 = OpCompositeConstruct %12 %23 %26 %28 + OpStore %14 %29 + OpStore %30 %19 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %6 %30 + %39 = OpSLessThan %38 %36 %37 + OpBranchConditional %39 %32 %33 + %32 = OpLabel + %40 = OpAccessChain %21 %18 %19 %24 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %7 %14 %41 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %21 %18 %19 %24 + %45 = OpLoad %6 %44 + %46 = OpSLessThanEqual %38 %43 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + %49 = OpLoad %6 %8 + %50 = OpIAdd %6 %49 %24 + OpStore %8 %50 + %51 = OpExtInst %6 %1 SMax %49 %19 + %52 = OpAccessChain %21 %18 %19 %24 + %53 = OpLoad %6 %52 + %54 = OpAccessChain %7 %14 %51 + OpStore %54 %53 + OpBranch %48 + %48 = OpLabel + OpBranch %34 + %34 = OpLabel + %55 = OpLoad %6 %30 + %56 = OpIAdd %6 %55 %24 + OpStore %30 %56 + OpBranch %31 + %33 = OpLabel + %57 = OpAccessChain %21 %18 %19 %20 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %7 %14 %58 + %60 = OpLoad %6 %59 + %61 = OpAccessChain %21 %18 %19 %24 + %62 = OpLoad %6 %61 + %63 = OpIEqual %38 %60 %62 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %65 + %64 = OpLabel + %66 = OpAccessChain %21 %18 %19 %24 + %67 = OpLoad %6 %66 + %68 = OpAccessChain %7 %14 %67 + %69 = OpLoad %6 %68 + %70 = OpAccessChain %21 %18 %19 %24 + %71 = OpLoad %6 %70 + %72 = OpIEqual %38 %69 %71 + OpBranch %65 + %65 = OpLabel + %73 = OpPhi %38 %63 %33 %72 %64 + OpSelectionMerge %75 None + OpBranchConditional %73 %74 %75 + %74 = OpLabel + %76 = OpAccessChain %21 %18 %19 %19 + %77 = OpLoad %6 %76 + %78 = OpAccessChain %7 %14 %77 + %79 = OpLoad %6 %78 + %80 = OpAccessChain %21 %18 %19 %19 + %81 = OpLoad %6 %80 + %82 = OpIEqual %38 %79 %81 + OpBranch %75 + %75 = OpLabel + %83 = OpPhi %38 %73 %65 %82 %74 + OpSelectionMerge %85 None + OpBranchConditional %83 %84 %103 + %84 = OpLabel + %90 = OpAccessChain %21 %18 %19 %24 + %91 = OpLoad %6 %90 + %92 = OpConvertSToF %86 %91 + %93 = OpAccessChain %21 %18 %19 %20 + %94 = OpLoad %6 %93 + %95 = OpConvertSToF %86 %94 + %96 = OpAccessChain %21 %18 %19 %20 + %97 = OpLoad %6 %96 + %98 = OpConvertSToF %86 %97 + %99 = OpAccessChain %21 %18 %19 %24 + %100 = OpLoad %6 %99 + %101 = OpConvertSToF %86 %100 + %102 = OpCompositeConstruct %87 %92 %95 %98 %101 + OpStore %89 %102 + OpBranch %85 + %103 = OpLabel + %104 = OpAccessChain %21 %18 %19 %20 + %105 = OpLoad %6 %104 + %106 = OpConvertSToF %86 %105 + %107 = OpCompositeConstruct %87 %106 %106 %106 %106 + OpStore %89 %107 + OpBranch %85 + %85 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-integer-half-minus-one.amber b/vulkan/amber/graphicsfuzz/cov-loop-integer-half-minus-one.amber new file mode 100644 index 0000000..be6824d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-integer-half-minus-one.amber @@ -0,0 +1,184 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_9 _GLF_uniform_int_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 9] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_9; +# +# while (a >= 0) +# { +# a = (a / 2) - 1; +# } +# +# // Always true. +# if (a == -_int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %42 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %42 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %42 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %26 = OpTypeBool + %30 = OpConstant %6 1 + %39 = OpTypeFloat 32 + %40 = OpTypeVector %39 4 + %41 = OpTypePointer Output %40 + %42 = OpVariable %41 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %6 %8 + %27 = OpSGreaterThanEqual %26 %25 %15 + OpBranchConditional %27 %21 %22 + %21 = OpLabel + %28 = OpLoad %6 %8 + %29 = OpSDiv %6 %28 %16 + %31 = OpISub %6 %29 %30 + OpStore %8 %31 + OpBranch %23 + %23 = OpLabel + OpBranch %20 + %22 = OpLabel + %32 = OpLoad %6 %8 + %33 = OpAccessChain %17 %14 %15 %15 + %34 = OpLoad %6 %33 + %35 = OpSNegate %6 %34 + %36 = OpIEqual %26 %32 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %56 + %37 = OpLabel + %43 = OpAccessChain %17 %14 %15 %15 + %44 = OpLoad %6 %43 + %45 = OpConvertSToF %39 %44 + %46 = OpAccessChain %17 %14 %15 %30 + %47 = OpLoad %6 %46 + %48 = OpConvertSToF %39 %47 + %49 = OpAccessChain %17 %14 %15 %30 + %50 = OpLoad %6 %49 + %51 = OpConvertSToF %39 %50 + %52 = OpAccessChain %17 %14 %15 %15 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %39 %53 + %55 = OpCompositeConstruct %40 %45 %48 %51 %54 + OpStore %42 %55 + OpBranch %38 + %56 = OpLabel + %57 = OpAccessChain %17 %14 %15 %30 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %39 %58 + %60 = OpCompositeConstruct %40 %59 %59 %59 %59 + OpStore %42 %60 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 9 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-iterator-bitwise-negate.amber b/vulkan/amber/graphicsfuzz/cov-loop-iterator-bitwise-negate.amber new file mode 100644 index 0000000..e6c6415 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-iterator-bitwise-negate.amber @@ -0,0 +1,208 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_3 _GLF_uniform_int_values[1] +# #define _int_256 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 3, 256, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# +# for(int k = ~_int_0; k > ~_int_0 - _int_3; k--) +# { +# // Always true. +# if(uint(~k) < uint(int(gl_FragCoord.y + _float_1_0) * _int_256)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# break; +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 87 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %47 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %47 "gl_FragCoord" + OpName %53 "buf0" + OpMemberName %53 0 "_GLF_uniform_float_values" + OpName %55 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %47 BuiltIn FragCoord + OpDecorate %52 ArrayStride 16 + OpMemberDecorate %53 0 Offset 0 + OpDecorate %53 Block + OpDecorate %55 DescriptorSet 0 + OpDecorate %55 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 4 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %37 = OpConstant %10 1 + %41 = OpTypeBool + %46 = OpTypePointer Input %7 + %47 = OpVariable %46 Input + %48 = OpConstant %11 1 + %49 = OpTypePointer Input %6 + %52 = OpTypeArray %6 %48 + %53 = OpTypeStruct %52 + %54 = OpTypePointer Uniform %53 + %55 = OpVariable %54 Uniform + %56 = OpTypePointer Uniform %6 + %61 = OpConstant %10 2 + %69 = OpConstant %10 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %22 = OpCompositeConstruct %7 %21 %21 %21 %21 + OpStore %9 %22 + %27 = OpNot %10 %20 + OpBranch %28 + %28 = OpLabel + %86 = OpPhi %10 %27 %5 %85 %31 + %38 = OpAccessChain %18 %16 %17 %37 + %39 = OpLoad %10 %38 + %40 = OpISub %10 %27 %39 + %42 = OpSGreaterThan %41 %86 %40 + OpLoopMerge %30 %31 None + OpBranchConditional %42 %29 %30 + %29 = OpLabel + %44 = OpNot %10 %86 + %45 = OpBitcast %11 %44 + %50 = OpAccessChain %49 %47 %48 + %51 = OpLoad %6 %50 + %57 = OpAccessChain %56 %55 %17 %17 + %58 = OpLoad %6 %57 + %59 = OpFAdd %6 %51 %58 + %60 = OpConvertFToS %10 %59 + %62 = OpAccessChain %18 %16 %17 %61 + %63 = OpLoad %10 %62 + %64 = OpIMul %10 %60 %63 + %65 = OpBitcast %11 %64 + %66 = OpULessThan %41 %45 %65 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %68 + %67 = OpLabel + %70 = OpAccessChain %18 %16 %17 %69 + %71 = OpLoad %10 %70 + %72 = OpConvertSToF %6 %71 + %82 = OpCompositeConstruct %7 %72 %21 %21 %72 + OpStore %9 %82 + OpBranch %30 + %68 = OpLabel + OpBranch %31 + %31 = OpLabel + %85 = OpISub %10 %86 %37 + OpBranch %28 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 3 256 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-iterator-limit-xor-and-unifrom.amber b/vulkan/amber/graphicsfuzz/cov-loop-iterator-limit-xor-and-unifrom.amber new file mode 100644 index 0000000..4c7e7ac --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-iterator-limit-xor-and-unifrom.amber @@ -0,0 +1,231 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of one: 1 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int one; +# }; +# +# void main() +# { +# int a = _int_0; +# +# // (1 ^ 1) & 1 = 0, therefore the loop iterates until global loop bound is reached. +# for(int i = _int_1; i != ((1 ^ one) & 1) && _GLF_global_loop_count < _GLF_global_loop_bound; i++) +# { +# _GLF_global_loop_count++; +# a++; +# } +# +# // Always true. +# if(a == _int_10) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %60 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %11 "a" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %21 "i" + OpName %31 "buf1" + OpMemberName %31 0 "one" + OpName %33 "" + OpName %60 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpMemberDecorate %31 0 Offset 0 + OpDecorate %31 Block + OpDecorate %33 DescriptorSet 0 + OpDecorate %33 Binding 1 + OpDecorate %60 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 3 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypePointer Uniform %6 + %22 = OpConstant %6 1 + %31 = OpTypeStruct %6 + %32 = OpTypePointer Uniform %31 + %33 = OpVariable %32 Uniform + %38 = OpTypeBool + %41 = OpConstant %6 10 + %51 = OpConstant %6 2 + %57 = OpTypeFloat 32 + %58 = OpTypeVector %57 4 + %59 = OpTypePointer Output %58 + %60 = OpVariable %59 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %21 = OpVariable %10 Function + OpStore %8 %9 + %19 = OpAccessChain %18 %17 %9 %9 + %20 = OpLoad %6 %19 + OpStore %11 %20 + %23 = OpAccessChain %18 %17 %9 %22 + %24 = OpLoad %6 %23 + OpStore %21 %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %6 %21 + %34 = OpAccessChain %18 %33 %9 + %35 = OpLoad %6 %34 + %36 = OpBitwiseXor %6 %22 %35 + %37 = OpBitwiseAnd %6 %36 %22 + %39 = OpINotEqual %38 %30 %37 + %40 = OpLoad %6 %8 + %42 = OpSLessThan %38 %40 %41 + %43 = OpLogicalAnd %38 %39 %42 + OpBranchConditional %43 %26 %27 + %26 = OpLabel + %44 = OpLoad %6 %8 + %45 = OpIAdd %6 %44 %22 + OpStore %8 %45 + %46 = OpLoad %6 %11 + %47 = OpIAdd %6 %46 %22 + OpStore %11 %47 + OpBranch %28 + %28 = OpLabel + %48 = OpLoad %6 %21 + %49 = OpIAdd %6 %48 %22 + OpStore %21 %49 + OpBranch %25 + %27 = OpLabel + %50 = OpLoad %6 %11 + %52 = OpAccessChain %18 %17 %9 %51 + %53 = OpLoad %6 %52 + %54 = OpIEqual %38 %50 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %74 + %55 = OpLabel + %61 = OpAccessChain %18 %17 %9 %22 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %57 %62 + %64 = OpAccessChain %18 %17 %9 %9 + %65 = OpLoad %6 %64 + %66 = OpConvertSToF %57 %65 + %67 = OpAccessChain %18 %17 %9 %9 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %57 %68 + %70 = OpAccessChain %18 %17 %9 %22 + %71 = OpLoad %6 %70 + %72 = OpConvertSToF %57 %71 + %73 = OpCompositeConstruct %58 %63 %66 %69 %72 + OpStore %60 %73 + OpBranch %56 + %74 = OpLabel + %75 = OpAccessChain %18 %17 %9 %9 + %76 = OpLoad %6 %75 + %77 = OpConvertSToF %57 %76 + %78 = OpCompositeConstruct %58 %77 %77 %77 %77 + OpStore %60 %78 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 STD140 DATA + 1 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-iterator-plus-one-variable-outside-index-array.amber b/vulkan/amber/graphicsfuzz/cov-loop-iterator-plus-one-variable-outside-index-array.amber new file mode 100644 index 0000000..145c3e1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-iterator-plus-one-variable-outside-index-array.amber @@ -0,0 +1,244 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_9 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_3 _GLF_uniform_int_values[4] +# #define _int_4 _GLF_uniform_int_values[5] +# #define _int_5 _GLF_uniform_int_values[6] +# #define _int_6 _GLF_uniform_int_values[7] +# #define _int_7 _GLF_uniform_int_values[8] +# #define _int_8 _GLF_uniform_int_values[9] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [9, 0, 2, 1, 3, 4, 5, 6, 7, 8] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[10]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# int arr[10] = int[10](_int_0, _int_1, _int_2, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9); +# +# for(int i = _int_0; i < _int_9; i++) +# { +# a++; +# // a equals i + 1. +# arr[_int_2] = arr[a]; +# } +# +# // Always true. +# if(arr[_int_2] == _int_9) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 105 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %86 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %21 "arr" + OpName %51 "i" + OpName %86 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %86 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 10 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %20 = OpTypePointer Function %11 + %24 = OpConstant %6 3 + %27 = OpConstant %6 2 + %30 = OpConstant %6 4 + %33 = OpConstant %6 5 + %36 = OpConstant %6 6 + %39 = OpConstant %6 7 + %42 = OpConstant %6 8 + %45 = OpConstant %6 9 + %62 = OpTypeBool + %83 = OpTypeFloat 32 + %84 = OpTypeVector %83 4 + %85 = OpTypePointer Output %84 + %86 = OpVariable %85 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %21 = OpVariable %20 Function + %51 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %22 = OpAccessChain %17 %14 %15 %16 + %23 = OpLoad %6 %22 + %25 = OpAccessChain %17 %14 %15 %24 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %17 %14 %15 %27 + %29 = OpLoad %6 %28 + %31 = OpAccessChain %17 %14 %15 %30 + %32 = OpLoad %6 %31 + %34 = OpAccessChain %17 %14 %15 %33 + %35 = OpLoad %6 %34 + %37 = OpAccessChain %17 %14 %15 %36 + %38 = OpLoad %6 %37 + %40 = OpAccessChain %17 %14 %15 %39 + %41 = OpLoad %6 %40 + %43 = OpAccessChain %17 %14 %15 %42 + %44 = OpLoad %6 %43 + %46 = OpAccessChain %17 %14 %15 %45 + %47 = OpLoad %6 %46 + %48 = OpAccessChain %17 %14 %15 %15 + %49 = OpLoad %6 %48 + %50 = OpCompositeConstruct %11 %23 %26 %29 %32 %35 %38 %41 %44 %47 %49 + OpStore %21 %50 + %52 = OpAccessChain %17 %14 %15 %16 + %53 = OpLoad %6 %52 + OpStore %51 %53 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %6 %51 + %60 = OpAccessChain %17 %14 %15 %15 + %61 = OpLoad %6 %60 + %63 = OpSLessThan %62 %59 %61 + OpBranchConditional %63 %55 %56 + %55 = OpLabel + %64 = OpLoad %6 %8 + %65 = OpIAdd %6 %64 %16 + OpStore %8 %65 + %66 = OpAccessChain %17 %14 %15 %27 + %67 = OpLoad %6 %66 + %68 = OpLoad %6 %8 + %69 = OpAccessChain %7 %21 %68 + %70 = OpLoad %6 %69 + %71 = OpAccessChain %7 %21 %67 + OpStore %71 %70 + OpBranch %57 + %57 = OpLabel + %72 = OpLoad %6 %51 + %73 = OpIAdd %6 %72 %16 + OpStore %51 %73 + OpBranch %54 + %56 = OpLabel + %74 = OpAccessChain %17 %14 %15 %27 + %75 = OpLoad %6 %74 + %76 = OpAccessChain %7 %21 %75 + %77 = OpLoad %6 %76 + %78 = OpAccessChain %17 %14 %15 %15 + %79 = OpLoad %6 %78 + %80 = OpIEqual %62 %77 %79 + OpSelectionMerge %82 None + OpBranchConditional %80 %81 %100 + %81 = OpLabel + %87 = OpAccessChain %17 %14 %15 %24 + %88 = OpLoad %6 %87 + %89 = OpConvertSToF %83 %88 + %90 = OpAccessChain %17 %14 %15 %16 + %91 = OpLoad %6 %90 + %92 = OpConvertSToF %83 %91 + %93 = OpAccessChain %17 %14 %15 %16 + %94 = OpLoad %6 %93 + %95 = OpConvertSToF %83 %94 + %96 = OpAccessChain %17 %14 %15 %24 + %97 = OpLoad %6 %96 + %98 = OpConvertSToF %83 %97 + %99 = OpCompositeConstruct %84 %89 %92 %95 %98 + OpStore %86 %99 + OpBranch %82 + %100 = OpLabel + %101 = OpAccessChain %17 %14 %15 %16 + %102 = OpLoad %6 %101 + %103 = OpConvertSToF %83 %102 + %104 = OpCompositeConstruct %84 %103 %103 %103 %103 + OpStore %86 %104 + OpBranch %82 + %82 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 9 0 2 1 3 4 5 6 7 8 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-iterator-start-select-uniform-negative-integer.amber b/vulkan/amber/graphicsfuzz/cov-loop-iterator-start-select-uniform-negative-integer.amber new file mode 100644 index 0000000..be52ed5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-iterator-start-select-uniform-negative-integer.amber @@ -0,0 +1,267 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 10] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# // Contents of zero: 0.0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# float zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // a becomes -57167. +# int a = (zero > _float_1_0 ? 1 : -1) - 57166; +# int b = _int_0; +# +# // Iterates until the global loop bound is reached. +# for(int i = a; i < 80199 && _GLF_global_loop_count < _GLF_global_loop_bound; i += 2) +# { +# _GLF_global_loop_count++; +# b++; +# } +# +# // Always true. +# if(b == _int_10) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 91 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %72 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %11 "a" + OpName %13 "buf2" + OpMemberName %13 0 "zero" + OpName %15 "" + OpName %22 "buf0" + OpMemberName %22 0 "_GLF_uniform_float_values" + OpName %24 "" + OpName %34 "b" + OpName %37 "buf1" + OpMemberName %37 0 "_GLF_uniform_int_values" + OpName %39 "" + OpName %43 "i" + OpName %72 "_GLF_color" + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 2 + OpDecorate %21 ArrayStride 16 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 1 + OpDecorate %72 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypePointer Function %6 + %12 = OpTypeFloat 32 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypePointer Uniform %12 + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 1 + %21 = OpTypeArray %12 %20 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %27 = OpTypeBool + %29 = OpConstant %6 1 + %30 = OpConstant %6 -1 + %32 = OpConstant %6 57166 + %35 = OpConstant %19 3 + %36 = OpTypeArray %6 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %6 + %51 = OpConstant %6 80199 + %54 = OpConstant %6 10 + %61 = OpConstant %6 2 + %70 = OpTypeVector %12 4 + %71 = OpTypePointer Output %70 + %72 = OpVariable %71 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %34 = OpVariable %10 Function + %43 = OpVariable %10 Function + OpStore %8 %9 + %17 = OpAccessChain %16 %15 %9 + %18 = OpLoad %12 %17 + %25 = OpAccessChain %16 %24 %9 %9 + %26 = OpLoad %12 %25 + %28 = OpFOrdGreaterThan %27 %18 %26 + %31 = OpSelect %6 %28 %29 %30 + %33 = OpISub %6 %31 %32 + OpStore %11 %33 + %41 = OpAccessChain %40 %39 %9 %9 + %42 = OpLoad %6 %41 + OpStore %34 %42 + %44 = OpLoad %6 %11 + OpStore %43 %44 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %49 + %49 = OpLabel + %50 = OpLoad %6 %43 + %52 = OpSLessThan %27 %50 %51 + %53 = OpLoad %6 %8 + %55 = OpSLessThan %27 %53 %54 + %56 = OpLogicalAnd %27 %52 %55 + OpBranchConditional %56 %46 %47 + %46 = OpLabel + %57 = OpLoad %6 %8 + %58 = OpIAdd %6 %57 %29 + OpStore %8 %58 + %59 = OpLoad %6 %34 + %60 = OpIAdd %6 %59 %29 + OpStore %34 %60 + OpBranch %48 + %48 = OpLabel + %62 = OpLoad %6 %43 + %63 = OpIAdd %6 %62 %61 + OpStore %43 %63 + OpBranch %45 + %47 = OpLabel + %64 = OpLoad %6 %34 + %65 = OpAccessChain %40 %39 %9 %61 + %66 = OpLoad %6 %65 + %67 = OpIEqual %27 %64 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %86 + %68 = OpLabel + %73 = OpAccessChain %40 %39 %9 %29 + %74 = OpLoad %6 %73 + %75 = OpConvertSToF %12 %74 + %76 = OpAccessChain %40 %39 %9 %9 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %12 %77 + %79 = OpAccessChain %40 %39 %9 %9 + %80 = OpLoad %6 %79 + %81 = OpConvertSToF %12 %80 + %82 = OpAccessChain %40 %39 %9 %29 + %83 = OpLoad %6 %82 + %84 = OpConvertSToF %12 %83 + %85 = OpCompositeConstruct %70 %75 %78 %81 %84 + OpStore %72 %85 + OpBranch %69 + %86 = OpLabel + %87 = OpAccessChain %40 %39 %9 %9 + %88 = OpLoad %6 %87 + %89 = OpConvertSToF %12 %88 + %90 = OpCompositeConstruct %70 %89 %89 %89 %89 + OpStore %72 %90 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 10 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-iterator-start-shift-left-right.amber b/vulkan/amber/graphicsfuzz/cov-loop-iterator-start-shift-left-right.amber new file mode 100644 index 0000000..15a2d67 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-iterator-start-shift-left-right.amber @@ -0,0 +1,208 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [2, 0, 10, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# // Iterates twice. +# for(int i = ((1 - _int_0) << 2) >> 1; i > _int_0 && a < _int_10; i--) +# { +# a++; +# } +# +# // Always true. +# if(a == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %57 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %57 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %57 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %24 = OpConstant %6 2 + %32 = OpTypeBool + %54 = OpTypeFloat 32 + %55 = OpTypeVector %54 4 + %56 = OpTypePointer Output %55 + %57 = OpVariable %56 Output + %58 = OpConstant %6 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %21 = OpAccessChain %17 %14 %15 %16 + %22 = OpLoad %6 %21 + %23 = OpISub %6 %16 %22 + %25 = OpShiftLeftLogical %6 %23 %24 + %26 = OpShiftRightArithmetic %6 %25 %16 + OpStore %20 %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %33 = OpLoad %6 %20 + %34 = OpAccessChain %17 %14 %15 %16 + %35 = OpLoad %6 %34 + %36 = OpSGreaterThan %32 %33 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + %39 = OpLoad %6 %8 + %40 = OpAccessChain %17 %14 %15 %24 + %41 = OpLoad %6 %40 + %42 = OpSLessThan %32 %39 %41 + OpBranch %38 + %38 = OpLabel + %43 = OpPhi %32 %36 %31 %42 %37 + OpBranchConditional %43 %28 %29 + %28 = OpLabel + %44 = OpLoad %6 %8 + %45 = OpIAdd %6 %44 %16 + OpStore %8 %45 + OpBranch %30 + %30 = OpLabel + %46 = OpLoad %6 %20 + %47 = OpISub %6 %46 %16 + OpStore %20 %47 + OpBranch %27 + %29 = OpLabel + %48 = OpLoad %6 %8 + %49 = OpAccessChain %17 %14 %15 %15 + %50 = OpLoad %6 %49 + %51 = OpIEqual %32 %48 %50 + OpSelectionMerge %53 None + OpBranchConditional %51 %52 %72 + %52 = OpLabel + %59 = OpAccessChain %17 %14 %15 %58 + %60 = OpLoad %6 %59 + %61 = OpConvertSToF %54 %60 + %62 = OpAccessChain %17 %14 %15 %16 + %63 = OpLoad %6 %62 + %64 = OpConvertSToF %54 %63 + %65 = OpAccessChain %17 %14 %15 %16 + %66 = OpLoad %6 %65 + %67 = OpConvertSToF %54 %66 + %68 = OpAccessChain %17 %14 %15 %58 + %69 = OpLoad %6 %68 + %70 = OpConvertSToF %54 %69 + %71 = OpCompositeConstruct %55 %61 %64 %67 %70 + OpStore %57 %71 + OpBranch %53 + %72 = OpLabel + %73 = OpAccessChain %17 %14 %15 %16 + %74 = OpLoad %6 %73 + %75 = OpConvertSToF %54 %74 + %76 = OpCompositeConstruct %55 %75 %75 %75 %75 + OpStore %57 %76 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 0 10 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-large-array-index-clamp-negative-value.amber b/vulkan/amber/graphicsfuzz/cov-loop-large-array-index-clamp-negative-value.amber new file mode 100644 index 0000000..d010489 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-large-array-index-clamp-negative-value.amber @@ -0,0 +1,707 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 2, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void func() +# { +# int a = -86465; +# +# for(int i = 0; i < 3; i++) +# { +# // Always clamps the index to one and selects value two. +# if(int[256](_int_1, _int_2, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1)[clamp(a, 1, 255)] == _int_2) +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# +# a++; +# } +# } +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# func(); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 575 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %561 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %6 "func(" + OpName %10 "a" + OpName %12 "i" + OpName %26 "buf0" + OpMemberName %26 0 "_GLF_uniform_int_values" + OpName %28 "" + OpName %550 "indexable" + OpName %561 "_GLF_color" + OpDecorate %25 ArrayStride 16 + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 0 + OpDecorate %561 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Function %8 + %11 = OpConstant %8 -86465 + %13 = OpConstant %8 0 + %20 = OpConstant %8 3 + %21 = OpTypeBool + %23 = OpTypeInt 32 0 + %24 = OpConstant %23 3 + %25 = OpTypeArray %8 %24 + %26 = OpTypeStruct %25 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpTypePointer Uniform %8 + %32 = OpConstant %8 1 + %543 = OpConstant %23 256 + %544 = OpTypeArray %8 %543 + %547 = OpConstant %8 255 + %549 = OpTypePointer Function %544 + %558 = OpTypeFloat 32 + %559 = OpTypeVector %558 4 + %560 = OpTypePointer Output %559 + %561 = OpVariable %560 Output + %562 = OpConstant %558 1 + %563 = OpConstant %558 0 + %564 = OpConstantComposite %559 %562 %563 %563 %562 + %569 = OpConstant %8 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %570 = OpAccessChain %29 %28 %13 %569 + %571 = OpLoad %8 %570 + %572 = OpConvertSToF %558 %571 + %573 = OpCompositeConstruct %559 %572 %572 %572 %572 + OpStore %561 %573 + %574 = OpFunctionCall %2 %6 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %10 = OpVariable %9 Function + %12 = OpVariable %9 Function + %550 = OpVariable %549 Function + OpStore %10 %11 + OpStore %12 %13 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %18 + %18 = OpLabel + %19 = OpLoad %8 %12 + %22 = OpSLessThan %21 %19 %20 + OpBranchConditional %22 %15 %16 + %15 = OpLabel + %30 = OpAccessChain %29 %28 %13 %13 + %31 = OpLoad %8 %30 + %33 = OpAccessChain %29 %28 %13 %32 + %34 = OpLoad %8 %33 + %35 = OpAccessChain %29 %28 %13 %13 + %36 = OpLoad %8 %35 + %37 = OpAccessChain %29 %28 %13 %13 + %38 = OpLoad %8 %37 + %39 = OpAccessChain %29 %28 %13 %13 + %40 = OpLoad %8 %39 + %41 = OpAccessChain %29 %28 %13 %13 + %42 = OpLoad %8 %41 + %43 = OpAccessChain %29 %28 %13 %13 + %44 = OpLoad %8 %43 + %45 = OpAccessChain %29 %28 %13 %13 + %46 = OpLoad %8 %45 + %47 = OpAccessChain %29 %28 %13 %13 + %48 = OpLoad %8 %47 + %49 = OpAccessChain %29 %28 %13 %13 + %50 = OpLoad %8 %49 + %51 = OpAccessChain %29 %28 %13 %13 + %52 = OpLoad %8 %51 + %53 = OpAccessChain %29 %28 %13 %13 + %54 = OpLoad %8 %53 + %55 = OpAccessChain %29 %28 %13 %13 + %56 = OpLoad %8 %55 + %57 = OpAccessChain %29 %28 %13 %13 + %58 = OpLoad %8 %57 + %59 = OpAccessChain %29 %28 %13 %13 + %60 = OpLoad %8 %59 + %61 = OpAccessChain %29 %28 %13 %13 + %62 = OpLoad %8 %61 + %63 = OpAccessChain %29 %28 %13 %13 + %64 = OpLoad %8 %63 + %65 = OpAccessChain %29 %28 %13 %13 + %66 = OpLoad %8 %65 + %67 = OpAccessChain %29 %28 %13 %13 + %68 = OpLoad %8 %67 + %69 = OpAccessChain %29 %28 %13 %13 + %70 = OpLoad %8 %69 + %71 = OpAccessChain %29 %28 %13 %13 + %72 = OpLoad %8 %71 + %73 = OpAccessChain %29 %28 %13 %13 + %74 = OpLoad %8 %73 + %75 = OpAccessChain %29 %28 %13 %13 + %76 = OpLoad %8 %75 + %77 = OpAccessChain %29 %28 %13 %13 + %78 = OpLoad %8 %77 + %79 = OpAccessChain %29 %28 %13 %13 + %80 = OpLoad %8 %79 + %81 = OpAccessChain %29 %28 %13 %13 + %82 = OpLoad %8 %81 + %83 = OpAccessChain %29 %28 %13 %13 + %84 = OpLoad %8 %83 + %85 = OpAccessChain %29 %28 %13 %13 + %86 = OpLoad %8 %85 + %87 = OpAccessChain %29 %28 %13 %13 + %88 = OpLoad %8 %87 + %89 = OpAccessChain %29 %28 %13 %13 + %90 = OpLoad %8 %89 + %91 = OpAccessChain %29 %28 %13 %13 + %92 = OpLoad %8 %91 + %93 = OpAccessChain %29 %28 %13 %13 + %94 = OpLoad %8 %93 + %95 = OpAccessChain %29 %28 %13 %13 + %96 = OpLoad %8 %95 + %97 = OpAccessChain %29 %28 %13 %13 + %98 = OpLoad %8 %97 + %99 = OpAccessChain %29 %28 %13 %13 + %100 = OpLoad %8 %99 + %101 = OpAccessChain %29 %28 %13 %13 + %102 = OpLoad %8 %101 + %103 = OpAccessChain %29 %28 %13 %13 + %104 = OpLoad %8 %103 + %105 = OpAccessChain %29 %28 %13 %13 + %106 = OpLoad %8 %105 + %107 = OpAccessChain %29 %28 %13 %13 + %108 = OpLoad %8 %107 + %109 = OpAccessChain %29 %28 %13 %13 + %110 = OpLoad %8 %109 + %111 = OpAccessChain %29 %28 %13 %13 + %112 = OpLoad %8 %111 + %113 = OpAccessChain %29 %28 %13 %13 + %114 = OpLoad %8 %113 + %115 = OpAccessChain %29 %28 %13 %13 + %116 = OpLoad %8 %115 + %117 = OpAccessChain %29 %28 %13 %13 + %118 = OpLoad %8 %117 + %119 = OpAccessChain %29 %28 %13 %13 + %120 = OpLoad %8 %119 + %121 = OpAccessChain %29 %28 %13 %13 + %122 = OpLoad %8 %121 + %123 = OpAccessChain %29 %28 %13 %13 + %124 = OpLoad %8 %123 + %125 = OpAccessChain %29 %28 %13 %13 + %126 = OpLoad %8 %125 + %127 = OpAccessChain %29 %28 %13 %13 + %128 = OpLoad %8 %127 + %129 = OpAccessChain %29 %28 %13 %13 + %130 = OpLoad %8 %129 + %131 = OpAccessChain %29 %28 %13 %13 + %132 = OpLoad %8 %131 + %133 = OpAccessChain %29 %28 %13 %13 + %134 = OpLoad %8 %133 + %135 = OpAccessChain %29 %28 %13 %13 + %136 = OpLoad %8 %135 + %137 = OpAccessChain %29 %28 %13 %13 + %138 = OpLoad %8 %137 + %139 = OpAccessChain %29 %28 %13 %13 + %140 = OpLoad %8 %139 + %141 = OpAccessChain %29 %28 %13 %13 + %142 = OpLoad %8 %141 + %143 = OpAccessChain %29 %28 %13 %13 + %144 = OpLoad %8 %143 + %145 = OpAccessChain %29 %28 %13 %13 + %146 = OpLoad %8 %145 + %147 = OpAccessChain %29 %28 %13 %13 + %148 = OpLoad %8 %147 + %149 = OpAccessChain %29 %28 %13 %13 + %150 = OpLoad %8 %149 + %151 = OpAccessChain %29 %28 %13 %13 + %152 = OpLoad %8 %151 + %153 = OpAccessChain %29 %28 %13 %13 + %154 = OpLoad %8 %153 + %155 = OpAccessChain %29 %28 %13 %13 + %156 = OpLoad %8 %155 + %157 = OpAccessChain %29 %28 %13 %13 + %158 = OpLoad %8 %157 + %159 = OpAccessChain %29 %28 %13 %13 + %160 = OpLoad %8 %159 + %161 = OpAccessChain %29 %28 %13 %13 + %162 = OpLoad %8 %161 + %163 = OpAccessChain %29 %28 %13 %13 + %164 = OpLoad %8 %163 + %165 = OpAccessChain %29 %28 %13 %13 + %166 = OpLoad %8 %165 + %167 = OpAccessChain %29 %28 %13 %13 + %168 = OpLoad %8 %167 + %169 = OpAccessChain %29 %28 %13 %13 + %170 = OpLoad %8 %169 + %171 = OpAccessChain %29 %28 %13 %13 + %172 = OpLoad %8 %171 + %173 = OpAccessChain %29 %28 %13 %13 + %174 = OpLoad %8 %173 + %175 = OpAccessChain %29 %28 %13 %13 + %176 = OpLoad %8 %175 + %177 = OpAccessChain %29 %28 %13 %13 + %178 = OpLoad %8 %177 + %179 = OpAccessChain %29 %28 %13 %13 + %180 = OpLoad %8 %179 + %181 = OpAccessChain %29 %28 %13 %13 + %182 = OpLoad %8 %181 + %183 = OpAccessChain %29 %28 %13 %13 + %184 = OpLoad %8 %183 + %185 = OpAccessChain %29 %28 %13 %13 + %186 = OpLoad %8 %185 + %187 = OpAccessChain %29 %28 %13 %13 + %188 = OpLoad %8 %187 + %189 = OpAccessChain %29 %28 %13 %13 + %190 = OpLoad %8 %189 + %191 = OpAccessChain %29 %28 %13 %13 + %192 = OpLoad %8 %191 + %193 = OpAccessChain %29 %28 %13 %13 + %194 = OpLoad %8 %193 + %195 = OpAccessChain %29 %28 %13 %13 + %196 = OpLoad %8 %195 + %197 = OpAccessChain %29 %28 %13 %13 + %198 = OpLoad %8 %197 + %199 = OpAccessChain %29 %28 %13 %13 + %200 = OpLoad %8 %199 + %201 = OpAccessChain %29 %28 %13 %13 + %202 = OpLoad %8 %201 + %203 = OpAccessChain %29 %28 %13 %13 + %204 = OpLoad %8 %203 + %205 = OpAccessChain %29 %28 %13 %13 + %206 = OpLoad %8 %205 + %207 = OpAccessChain %29 %28 %13 %13 + %208 = OpLoad %8 %207 + %209 = OpAccessChain %29 %28 %13 %13 + %210 = OpLoad %8 %209 + %211 = OpAccessChain %29 %28 %13 %13 + %212 = OpLoad %8 %211 + %213 = OpAccessChain %29 %28 %13 %13 + %214 = OpLoad %8 %213 + %215 = OpAccessChain %29 %28 %13 %13 + %216 = OpLoad %8 %215 + %217 = OpAccessChain %29 %28 %13 %13 + %218 = OpLoad %8 %217 + %219 = OpAccessChain %29 %28 %13 %13 + %220 = OpLoad %8 %219 + %221 = OpAccessChain %29 %28 %13 %13 + %222 = OpLoad %8 %221 + %223 = OpAccessChain %29 %28 %13 %13 + %224 = OpLoad %8 %223 + %225 = OpAccessChain %29 %28 %13 %13 + %226 = OpLoad %8 %225 + %227 = OpAccessChain %29 %28 %13 %13 + %228 = OpLoad %8 %227 + %229 = OpAccessChain %29 %28 %13 %13 + %230 = OpLoad %8 %229 + %231 = OpAccessChain %29 %28 %13 %13 + %232 = OpLoad %8 %231 + %233 = OpAccessChain %29 %28 %13 %13 + %234 = OpLoad %8 %233 + %235 = OpAccessChain %29 %28 %13 %13 + %236 = OpLoad %8 %235 + %237 = OpAccessChain %29 %28 %13 %13 + %238 = OpLoad %8 %237 + %239 = OpAccessChain %29 %28 %13 %13 + %240 = OpLoad %8 %239 + %241 = OpAccessChain %29 %28 %13 %13 + %242 = OpLoad %8 %241 + %243 = OpAccessChain %29 %28 %13 %13 + %244 = OpLoad %8 %243 + %245 = OpAccessChain %29 %28 %13 %13 + %246 = OpLoad %8 %245 + %247 = OpAccessChain %29 %28 %13 %13 + %248 = OpLoad %8 %247 + %249 = OpAccessChain %29 %28 %13 %13 + %250 = OpLoad %8 %249 + %251 = OpAccessChain %29 %28 %13 %13 + %252 = OpLoad %8 %251 + %253 = OpAccessChain %29 %28 %13 %13 + %254 = OpLoad %8 %253 + %255 = OpAccessChain %29 %28 %13 %13 + %256 = OpLoad %8 %255 + %257 = OpAccessChain %29 %28 %13 %13 + %258 = OpLoad %8 %257 + %259 = OpAccessChain %29 %28 %13 %13 + %260 = OpLoad %8 %259 + %261 = OpAccessChain %29 %28 %13 %13 + %262 = OpLoad %8 %261 + %263 = OpAccessChain %29 %28 %13 %13 + %264 = OpLoad %8 %263 + %265 = OpAccessChain %29 %28 %13 %13 + %266 = OpLoad %8 %265 + %267 = OpAccessChain %29 %28 %13 %13 + %268 = OpLoad %8 %267 + %269 = OpAccessChain %29 %28 %13 %13 + %270 = OpLoad %8 %269 + %271 = OpAccessChain %29 %28 %13 %13 + %272 = OpLoad %8 %271 + %273 = OpAccessChain %29 %28 %13 %13 + %274 = OpLoad %8 %273 + %275 = OpAccessChain %29 %28 %13 %13 + %276 = OpLoad %8 %275 + %277 = OpAccessChain %29 %28 %13 %13 + %278 = OpLoad %8 %277 + %279 = OpAccessChain %29 %28 %13 %13 + %280 = OpLoad %8 %279 + %281 = OpAccessChain %29 %28 %13 %13 + %282 = OpLoad %8 %281 + %283 = OpAccessChain %29 %28 %13 %13 + %284 = OpLoad %8 %283 + %285 = OpAccessChain %29 %28 %13 %13 + %286 = OpLoad %8 %285 + %287 = OpAccessChain %29 %28 %13 %13 + %288 = OpLoad %8 %287 + %289 = OpAccessChain %29 %28 %13 %13 + %290 = OpLoad %8 %289 + %291 = OpAccessChain %29 %28 %13 %13 + %292 = OpLoad %8 %291 + %293 = OpAccessChain %29 %28 %13 %13 + %294 = OpLoad %8 %293 + %295 = OpAccessChain %29 %28 %13 %13 + %296 = OpLoad %8 %295 + %297 = OpAccessChain %29 %28 %13 %13 + %298 = OpLoad %8 %297 + %299 = OpAccessChain %29 %28 %13 %13 + %300 = OpLoad %8 %299 + %301 = OpAccessChain %29 %28 %13 %13 + %302 = OpLoad %8 %301 + %303 = OpAccessChain %29 %28 %13 %13 + %304 = OpLoad %8 %303 + %305 = OpAccessChain %29 %28 %13 %13 + %306 = OpLoad %8 %305 + %307 = OpAccessChain %29 %28 %13 %13 + %308 = OpLoad %8 %307 + %309 = OpAccessChain %29 %28 %13 %13 + %310 = OpLoad %8 %309 + %311 = OpAccessChain %29 %28 %13 %13 + %312 = OpLoad %8 %311 + %313 = OpAccessChain %29 %28 %13 %13 + %314 = OpLoad %8 %313 + %315 = OpAccessChain %29 %28 %13 %13 + %316 = OpLoad %8 %315 + %317 = OpAccessChain %29 %28 %13 %13 + %318 = OpLoad %8 %317 + %319 = OpAccessChain %29 %28 %13 %13 + %320 = OpLoad %8 %319 + %321 = OpAccessChain %29 %28 %13 %13 + %322 = OpLoad %8 %321 + %323 = OpAccessChain %29 %28 %13 %13 + %324 = OpLoad %8 %323 + %325 = OpAccessChain %29 %28 %13 %13 + %326 = OpLoad %8 %325 + %327 = OpAccessChain %29 %28 %13 %13 + %328 = OpLoad %8 %327 + %329 = OpAccessChain %29 %28 %13 %13 + %330 = OpLoad %8 %329 + %331 = OpAccessChain %29 %28 %13 %13 + %332 = OpLoad %8 %331 + %333 = OpAccessChain %29 %28 %13 %13 + %334 = OpLoad %8 %333 + %335 = OpAccessChain %29 %28 %13 %13 + %336 = OpLoad %8 %335 + %337 = OpAccessChain %29 %28 %13 %13 + %338 = OpLoad %8 %337 + %339 = OpAccessChain %29 %28 %13 %13 + %340 = OpLoad %8 %339 + %341 = OpAccessChain %29 %28 %13 %13 + %342 = OpLoad %8 %341 + %343 = OpAccessChain %29 %28 %13 %13 + %344 = OpLoad %8 %343 + %345 = OpAccessChain %29 %28 %13 %13 + %346 = OpLoad %8 %345 + %347 = OpAccessChain %29 %28 %13 %13 + %348 = OpLoad %8 %347 + %349 = OpAccessChain %29 %28 %13 %13 + %350 = OpLoad %8 %349 + %351 = OpAccessChain %29 %28 %13 %13 + %352 = OpLoad %8 %351 + %353 = OpAccessChain %29 %28 %13 %13 + %354 = OpLoad %8 %353 + %355 = OpAccessChain %29 %28 %13 %13 + %356 = OpLoad %8 %355 + %357 = OpAccessChain %29 %28 %13 %13 + %358 = OpLoad %8 %357 + %359 = OpAccessChain %29 %28 %13 %13 + %360 = OpLoad %8 %359 + %361 = OpAccessChain %29 %28 %13 %13 + %362 = OpLoad %8 %361 + %363 = OpAccessChain %29 %28 %13 %13 + %364 = OpLoad %8 %363 + %365 = OpAccessChain %29 %28 %13 %13 + %366 = OpLoad %8 %365 + %367 = OpAccessChain %29 %28 %13 %13 + %368 = OpLoad %8 %367 + %369 = OpAccessChain %29 %28 %13 %13 + %370 = OpLoad %8 %369 + %371 = OpAccessChain %29 %28 %13 %13 + %372 = OpLoad %8 %371 + %373 = OpAccessChain %29 %28 %13 %13 + %374 = OpLoad %8 %373 + %375 = OpAccessChain %29 %28 %13 %13 + %376 = OpLoad %8 %375 + %377 = OpAccessChain %29 %28 %13 %13 + %378 = OpLoad %8 %377 + %379 = OpAccessChain %29 %28 %13 %13 + %380 = OpLoad %8 %379 + %381 = OpAccessChain %29 %28 %13 %13 + %382 = OpLoad %8 %381 + %383 = OpAccessChain %29 %28 %13 %13 + %384 = OpLoad %8 %383 + %385 = OpAccessChain %29 %28 %13 %13 + %386 = OpLoad %8 %385 + %387 = OpAccessChain %29 %28 %13 %13 + %388 = OpLoad %8 %387 + %389 = OpAccessChain %29 %28 %13 %13 + %390 = OpLoad %8 %389 + %391 = OpAccessChain %29 %28 %13 %13 + %392 = OpLoad %8 %391 + %393 = OpAccessChain %29 %28 %13 %13 + %394 = OpLoad %8 %393 + %395 = OpAccessChain %29 %28 %13 %13 + %396 = OpLoad %8 %395 + %397 = OpAccessChain %29 %28 %13 %13 + %398 = OpLoad %8 %397 + %399 = OpAccessChain %29 %28 %13 %13 + %400 = OpLoad %8 %399 + %401 = OpAccessChain %29 %28 %13 %13 + %402 = OpLoad %8 %401 + %403 = OpAccessChain %29 %28 %13 %13 + %404 = OpLoad %8 %403 + %405 = OpAccessChain %29 %28 %13 %13 + %406 = OpLoad %8 %405 + %407 = OpAccessChain %29 %28 %13 %13 + %408 = OpLoad %8 %407 + %409 = OpAccessChain %29 %28 %13 %13 + %410 = OpLoad %8 %409 + %411 = OpAccessChain %29 %28 %13 %13 + %412 = OpLoad %8 %411 + %413 = OpAccessChain %29 %28 %13 %13 + %414 = OpLoad %8 %413 + %415 = OpAccessChain %29 %28 %13 %13 + %416 = OpLoad %8 %415 + %417 = OpAccessChain %29 %28 %13 %13 + %418 = OpLoad %8 %417 + %419 = OpAccessChain %29 %28 %13 %13 + %420 = OpLoad %8 %419 + %421 = OpAccessChain %29 %28 %13 %13 + %422 = OpLoad %8 %421 + %423 = OpAccessChain %29 %28 %13 %13 + %424 = OpLoad %8 %423 + %425 = OpAccessChain %29 %28 %13 %13 + %426 = OpLoad %8 %425 + %427 = OpAccessChain %29 %28 %13 %13 + %428 = OpLoad %8 %427 + %429 = OpAccessChain %29 %28 %13 %13 + %430 = OpLoad %8 %429 + %431 = OpAccessChain %29 %28 %13 %13 + %432 = OpLoad %8 %431 + %433 = OpAccessChain %29 %28 %13 %13 + %434 = OpLoad %8 %433 + %435 = OpAccessChain %29 %28 %13 %13 + %436 = OpLoad %8 %435 + %437 = OpAccessChain %29 %28 %13 %13 + %438 = OpLoad %8 %437 + %439 = OpAccessChain %29 %28 %13 %13 + %440 = OpLoad %8 %439 + %441 = OpAccessChain %29 %28 %13 %13 + %442 = OpLoad %8 %441 + %443 = OpAccessChain %29 %28 %13 %13 + %444 = OpLoad %8 %443 + %445 = OpAccessChain %29 %28 %13 %13 + %446 = OpLoad %8 %445 + %447 = OpAccessChain %29 %28 %13 %13 + %448 = OpLoad %8 %447 + %449 = OpAccessChain %29 %28 %13 %13 + %450 = OpLoad %8 %449 + %451 = OpAccessChain %29 %28 %13 %13 + %452 = OpLoad %8 %451 + %453 = OpAccessChain %29 %28 %13 %13 + %454 = OpLoad %8 %453 + %455 = OpAccessChain %29 %28 %13 %13 + %456 = OpLoad %8 %455 + %457 = OpAccessChain %29 %28 %13 %13 + %458 = OpLoad %8 %457 + %459 = OpAccessChain %29 %28 %13 %13 + %460 = OpLoad %8 %459 + %461 = OpAccessChain %29 %28 %13 %13 + %462 = OpLoad %8 %461 + %463 = OpAccessChain %29 %28 %13 %13 + %464 = OpLoad %8 %463 + %465 = OpAccessChain %29 %28 %13 %13 + %466 = OpLoad %8 %465 + %467 = OpAccessChain %29 %28 %13 %13 + %468 = OpLoad %8 %467 + %469 = OpAccessChain %29 %28 %13 %13 + %470 = OpLoad %8 %469 + %471 = OpAccessChain %29 %28 %13 %13 + %472 = OpLoad %8 %471 + %473 = OpAccessChain %29 %28 %13 %13 + %474 = OpLoad %8 %473 + %475 = OpAccessChain %29 %28 %13 %13 + %476 = OpLoad %8 %475 + %477 = OpAccessChain %29 %28 %13 %13 + %478 = OpLoad %8 %477 + %479 = OpAccessChain %29 %28 %13 %13 + %480 = OpLoad %8 %479 + %481 = OpAccessChain %29 %28 %13 %13 + %482 = OpLoad %8 %481 + %483 = OpAccessChain %29 %28 %13 %13 + %484 = OpLoad %8 %483 + %485 = OpAccessChain %29 %28 %13 %13 + %486 = OpLoad %8 %485 + %487 = OpAccessChain %29 %28 %13 %13 + %488 = OpLoad %8 %487 + %489 = OpAccessChain %29 %28 %13 %13 + %490 = OpLoad %8 %489 + %491 = OpAccessChain %29 %28 %13 %13 + %492 = OpLoad %8 %491 + %493 = OpAccessChain %29 %28 %13 %13 + %494 = OpLoad %8 %493 + %495 = OpAccessChain %29 %28 %13 %13 + %496 = OpLoad %8 %495 + %497 = OpAccessChain %29 %28 %13 %13 + %498 = OpLoad %8 %497 + %499 = OpAccessChain %29 %28 %13 %13 + %500 = OpLoad %8 %499 + %501 = OpAccessChain %29 %28 %13 %13 + %502 = OpLoad %8 %501 + %503 = OpAccessChain %29 %28 %13 %13 + %504 = OpLoad %8 %503 + %505 = OpAccessChain %29 %28 %13 %13 + %506 = OpLoad %8 %505 + %507 = OpAccessChain %29 %28 %13 %13 + %508 = OpLoad %8 %507 + %509 = OpAccessChain %29 %28 %13 %13 + %510 = OpLoad %8 %509 + %511 = OpAccessChain %29 %28 %13 %13 + %512 = OpLoad %8 %511 + %513 = OpAccessChain %29 %28 %13 %13 + %514 = OpLoad %8 %513 + %515 = OpAccessChain %29 %28 %13 %13 + %516 = OpLoad %8 %515 + %517 = OpAccessChain %29 %28 %13 %13 + %518 = OpLoad %8 %517 + %519 = OpAccessChain %29 %28 %13 %13 + %520 = OpLoad %8 %519 + %521 = OpAccessChain %29 %28 %13 %13 + %522 = OpLoad %8 %521 + %523 = OpAccessChain %29 %28 %13 %13 + %524 = OpLoad %8 %523 + %525 = OpAccessChain %29 %28 %13 %13 + %526 = OpLoad %8 %525 + %527 = OpAccessChain %29 %28 %13 %13 + %528 = OpLoad %8 %527 + %529 = OpAccessChain %29 %28 %13 %13 + %530 = OpLoad %8 %529 + %531 = OpAccessChain %29 %28 %13 %13 + %532 = OpLoad %8 %531 + %533 = OpAccessChain %29 %28 %13 %13 + %534 = OpLoad %8 %533 + %535 = OpAccessChain %29 %28 %13 %13 + %536 = OpLoad %8 %535 + %537 = OpAccessChain %29 %28 %13 %13 + %538 = OpLoad %8 %537 + %539 = OpAccessChain %29 %28 %13 %13 + %540 = OpLoad %8 %539 + %541 = OpAccessChain %29 %28 %13 %13 + %542 = OpLoad %8 %541 + %545 = OpCompositeConstruct %544 %31 %34 %36 %38 %40 %42 %44 %46 %48 %50 %52 %54 %56 %58 %60 %62 %64 %66 %68 %70 %72 %74 %76 %78 %80 %82 %84 %86 %88 %90 %92 %94 %96 %98 %100 %102 %104 %106 %108 %110 %112 %114 %116 %118 %120 %122 %124 %126 %128 %130 %132 %134 %136 %138 %140 %142 %144 %146 %148 %150 %152 %154 %156 %158 %160 %162 %164 %166 %168 %170 %172 %174 %176 %178 %180 %182 %184 %186 %188 %190 %192 %194 %196 %198 %200 %202 %204 %206 %208 %210 %212 %214 %216 %218 %220 %222 %224 %226 %228 %230 %232 %234 %236 %238 %240 %242 %244 %246 %248 %250 %252 %254 %256 %258 %260 %262 %264 %266 %268 %270 %272 %274 %276 %278 %280 %282 %284 %286 %288 %290 %292 %294 %296 %298 %300 %302 %304 %306 %308 %310 %312 %314 %316 %318 %320 %322 %324 %326 %328 %330 %332 %334 %336 %338 %340 %342 %344 %346 %348 %350 %352 %354 %356 %358 %360 %362 %364 %366 %368 %370 %372 %374 %376 %378 %380 %382 %384 %386 %388 %390 %392 %394 %396 %398 %400 %402 %404 %406 %408 %410 %412 %414 %416 %418 %420 %422 %424 %426 %428 %430 %432 %434 %436 %438 %440 %442 %444 %446 %448 %450 %452 %454 %456 %458 %460 %462 %464 %466 %468 %470 %472 %474 %476 %478 %480 %482 %484 %486 %488 %490 %492 %494 %496 %498 %500 %502 %504 %506 %508 %510 %512 %514 %516 %518 %520 %522 %524 %526 %528 %530 %532 %534 %536 %538 %540 %542 + %546 = OpLoad %8 %10 + %548 = OpExtInst %8 %1 SClamp %546 %32 %547 + OpStore %550 %545 + %551 = OpAccessChain %9 %550 %548 + %552 = OpLoad %8 %551 + %553 = OpAccessChain %29 %28 %13 %32 + %554 = OpLoad %8 %553 + %555 = OpIEqual %21 %552 %554 + OpSelectionMerge %557 None + OpBranchConditional %555 %556 %557 + %556 = OpLabel + OpStore %561 %564 + OpBranch %557 + %557 = OpLabel + %565 = OpLoad %8 %10 + %566 = OpIAdd %8 %565 %32 + OpStore %10 %566 + OpBranch %17 + %17 = OpLabel + %567 = OpLoad %8 %12 + %568 = OpIAdd %8 %567 %32 + OpStore %12 %568 + OpBranch %14 + %16 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 2 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-limiter-min-findlsb.amber b/vulkan/amber/graphicsfuzz/cov-loop-limiter-min-findlsb.amber new file mode 100644 index 0000000..48b4d42 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-limiter-min-findlsb.amber @@ -0,0 +1,202 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# // Iterates once: min(2, findMSB(1)) = min(2, 0) = 0. +# for(int i = 0; i <= min(2, findMSB(1)) && a < _int_10; i++) +# { +# a++; +# } +# +# // Always true. +# if(a == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %52 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %30 RelaxedPrecision + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %26 = OpTypeBool + %28 = OpConstant %6 2 + %49 = OpTypeFloat 32 + %50 = OpTypeVector %49 4 + %51 = OpTypePointer Output %50 + %52 = OpVariable %51 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpStore %20 %15 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %27 = OpLoad %6 %20 + %29 = OpExtInst %6 %1 FindSMsb %16 + %30 = OpExtInst %6 %1 SMin %28 %29 + %31 = OpSLessThanEqual %26 %27 %30 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %33 + %32 = OpLabel + %34 = OpLoad %6 %8 + %35 = OpAccessChain %17 %14 %15 %28 + %36 = OpLoad %6 %35 + %37 = OpSLessThan %26 %34 %36 + OpBranch %33 + %33 = OpLabel + %38 = OpPhi %26 %31 %25 %37 %32 + OpBranchConditional %38 %22 %23 + %22 = OpLabel + %39 = OpLoad %6 %8 + %40 = OpIAdd %6 %39 %16 + OpStore %8 %40 + OpBranch %24 + %24 = OpLabel + %41 = OpLoad %6 %20 + %42 = OpIAdd %6 %41 %16 + OpStore %20 %42 + OpBranch %21 + %23 = OpLabel + %43 = OpLoad %6 %8 + %44 = OpAccessChain %17 %14 %15 %15 + %45 = OpLoad %6 %44 + %46 = OpIEqual %26 %43 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %66 + %47 = OpLabel + %53 = OpAccessChain %17 %14 %15 %15 + %54 = OpLoad %6 %53 + %55 = OpConvertSToF %49 %54 + %56 = OpAccessChain %17 %14 %15 %16 + %57 = OpLoad %6 %56 + %58 = OpConvertSToF %49 %57 + %59 = OpAccessChain %17 %14 %15 %16 + %60 = OpLoad %6 %59 + %61 = OpConvertSToF %49 %60 + %62 = OpAccessChain %17 %14 %15 %15 + %63 = OpLoad %6 %62 + %64 = OpConvertSToF %49 %63 + %65 = OpCompositeConstruct %50 %55 %58 %61 %64 + OpStore %52 %65 + OpBranch %48 + %66 = OpLabel + %67 = OpAccessChain %17 %14 %15 %16 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %49 %68 + %70 = OpCompositeConstruct %50 %69 %69 %69 %69 + OpStore %52 %70 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-limiter-uniform-bitwise-and-one-always-break.amber b/vulkan/amber/graphicsfuzz/cov-loop-limiter-uniform-bitwise-and-one-always-break.amber new file mode 100644 index 0000000..c6858dc --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-limiter-uniform-bitwise-and-one-always-break.amber @@ -0,0 +1,171 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(0); +# +# // Iterates once. +# for(int i = _int_1 & 1; i > 0; i--) +# { +# while(true) +# { +# _GLF_color = vec4(i, _int_0, _int_0, i); +# +# // Always true. +# if(_int_1 > 0) +# { +# break; +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %18 "buf0" + OpMemberName %18 0 "_GLF_uniform_int_values" + OpName %20 "" + OpDecorate %9 Location 0 + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypeInt 32 1 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 2 + %17 = OpTypeArray %12 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpConstant %12 0 + %22 = OpTypePointer Uniform %12 + %25 = OpConstant %12 1 + %33 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %9 %11 + %23 = OpAccessChain %22 %20 %21 %21 + %24 = OpLoad %12 %23 + %26 = OpBitwiseAnd %12 %24 %25 + OpBranch %27 + %27 = OpLabel + %60 = OpPhi %12 %26 %5 %59 %30 + %34 = OpSGreaterThan %33 %60 %21 + OpLoopMerge %29 %30 None + OpBranchConditional %34 %28 %29 + %28 = OpLabel + OpBranch %35 + %35 = OpLabel + OpLoopMerge %55 %38 None + OpBranch %36 + %36 = OpLabel + %42 = OpConvertSToF %6 %60 + %43 = OpAccessChain %22 %20 %21 %25 + %44 = OpLoad %12 %43 + %45 = OpConvertSToF %6 %44 + %51 = OpCompositeConstruct %7 %42 %45 %45 %42 + OpStore %9 %51 + %54 = OpSGreaterThan %33 %24 %21 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + OpBranch %30 + %56 = OpLabel + OpBranch %38 + %38 = OpLabel + OpBranch %35 + %30 = OpLabel + %59 = OpISub %12 %60 %25 + OpBranch %27 + %29 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-logical-xor.amber b/vulkan/amber/graphicsfuzz/cov-loop-logical-xor.amber new file mode 100644 index 0000000..0fa89e3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-logical-xor.amber @@ -0,0 +1,165 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1; +# _GLF_color = vec4(_int_0); +# +# // Always true. +# while((_int_2 == a) ^^ true) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# break; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %22 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %22 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %22 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %6 + %19 = OpTypeFloat 32 + %20 = OpTypeVector %19 4 + %21 = OpTypePointer Output %20 + %22 = OpVariable %21 Output + %23 = OpConstant %6 1 + %33 = OpConstant %6 2 + %37 = OpTypeBool + %39 = OpConstantTrue %37 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %17 = OpAccessChain %16 %14 %15 %15 + %18 = OpLoad %6 %17 + OpStore %8 %18 + %24 = OpAccessChain %16 %14 %15 %23 + %25 = OpLoad %6 %24 + %26 = OpConvertSToF %19 %25 + %27 = OpCompositeConstruct %20 %26 %26 %26 %26 + OpStore %22 %27 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %34 = OpAccessChain %16 %14 %15 %33 + %35 = OpLoad %6 %34 + %36 = OpLoad %6 %8 + %38 = OpIEqual %37 %35 %36 + %40 = OpLogicalNotEqual %37 %38 %39 + OpBranchConditional %40 %29 %30 + %29 = OpLabel + %41 = OpAccessChain %16 %14 %15 %15 + %42 = OpLoad %6 %41 + %43 = OpConvertSToF %19 %42 + %44 = OpAccessChain %16 %14 %15 %23 + %45 = OpLoad %6 %44 + %46 = OpConvertSToF %19 %45 + %47 = OpAccessChain %16 %14 %15 %23 + %48 = OpLoad %6 %47 + %49 = OpConvertSToF %19 %48 + %50 = OpAccessChain %16 %14 %15 %15 + %51 = OpLoad %6 %50 + %52 = OpConvertSToF %19 %51 + %53 = OpCompositeConstruct %20 %43 %46 %49 %52 + OpStore %22 %53 + OpBranch %30 + %31 = OpLabel + OpBranch %28 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-max-divide-integer-by-ten.amber b/vulkan/amber/graphicsfuzz/cov-loop-max-divide-integer-by-ten.amber new file mode 100644 index 0000000..c4b775f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-max-divide-integer-by-ten.amber @@ -0,0 +1,204 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_10 _GLF_uniform_int_values[1] +# #define _int_10000 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# #define _int_1 _GLF_uniform_int_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [3, 10, 10000, 0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_10000; +# +# // Divides a by 10 three times. +# for(int i = _int_0; i < _int_3; i++) +# { +# a = max(a / _int_10, a / _int_10); +# } +# +# // Always true. +# if(a == _int_10) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %55 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %55 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %55 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 5 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %6 3 + %32 = OpTypeBool + %35 = OpConstant %6 1 + %52 = OpTypeFloat 32 + %53 = OpTypeVector %52 4 + %54 = OpTypePointer Output %53 + %55 = OpVariable %54 Output + %56 = OpConstant %6 4 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %22 = OpAccessChain %17 %14 %15 %21 + %23 = OpLoad %6 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %20 + %30 = OpAccessChain %17 %14 %15 %15 + %31 = OpLoad %6 %30 + %33 = OpSLessThan %32 %29 %31 + OpBranchConditional %33 %25 %26 + %25 = OpLabel + %34 = OpLoad %6 %8 + %36 = OpAccessChain %17 %14 %15 %35 + %37 = OpLoad %6 %36 + %38 = OpSDiv %6 %34 %37 + %39 = OpLoad %6 %8 + %40 = OpAccessChain %17 %14 %15 %35 + %41 = OpLoad %6 %40 + %42 = OpSDiv %6 %39 %41 + %43 = OpExtInst %6 %1 SMax %38 %42 + OpStore %8 %43 + OpBranch %27 + %27 = OpLabel + %44 = OpLoad %6 %20 + %45 = OpIAdd %6 %44 %35 + OpStore %20 %45 + OpBranch %24 + %26 = OpLabel + %46 = OpLoad %6 %8 + %47 = OpAccessChain %17 %14 %15 %35 + %48 = OpLoad %6 %47 + %49 = OpIEqual %32 %46 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %70 + %50 = OpLabel + %57 = OpAccessChain %17 %14 %15 %56 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %52 %58 + %60 = OpAccessChain %17 %14 %15 %21 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %52 %61 + %63 = OpAccessChain %17 %14 %15 %21 + %64 = OpLoad %6 %63 + %65 = OpConvertSToF %52 %64 + %66 = OpAccessChain %17 %14 %15 %56 + %67 = OpLoad %6 %66 + %68 = OpConvertSToF %52 %67 + %69 = OpCompositeConstruct %53 %59 %62 %65 %68 + OpStore %55 %69 + OpBranch %51 + %70 = OpLabel + %71 = OpAccessChain %17 %14 %15 %21 + %72 = OpLoad %6 %71 + %73 = OpConvertSToF %52 %72 + %74 = OpCompositeConstruct %53 %73 %73 %73 %73 + OpStore %55 %74 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 10 10000 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-min-max-clamp-increment-only-first-iteration.amber b/vulkan/amber/graphicsfuzz/cov-loop-min-max-clamp-increment-only-first-iteration.amber new file mode 100644 index 0000000..bc9c917 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-min-max-clamp-increment-only-first-iteration.amber @@ -0,0 +1,695 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_256 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 256] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(set = 0, binding = 2) uniform sampler2D tex; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 v = gl_FragCoord.xy; +# int a = _int_256; +# vec4 res = vec4(_int_0); +# +# // Iterates three times. +# for(int i = 0; i < 3; i++) +# { +# // Iterates three times. +# for(int j = 0; j < 3; j++) +# { +# vec4 v0 = texture(tex, clamp(vec2(_int_1) + max(vec2(_int_1), vec2(i, j - _int_1)), vec2(_int_1), vec2(_int_1, v.y + float(j)) - vec2(_int_1))); +# vec4 v1 = texture(tex, clamp(vec2(_int_1) + min(min(gl_FragCoord.x > _float_0_0 ? max(vec2(i, _int_1), vec2(a, j)) : vec2(_int_1), vec2(_int_1)), max(vec2(i, j), vec2(a, j))), vec2(_int_1) + max(vec2(i, j), vec2(i, _int_1)), vec2(_int_1) + clamp(vec2(_int_1), max(vec2(_int_1), vec2(i, j)), max(vec2(_int_1), vec2(i - _int_1, j))))); +# vec4 v2 = texture(tex, clamp(vec2(_int_1) + vec2(i * a, j), vec2(_int_1), vec2(_int_1))); +# vec4 v3 = texture(tex, clamp(vec2(_int_1) + max(vec2(i, _int_1), vec2(_int_1, j)), vec2(_int_1) + max(vec2(i, gl_FragCoord.y > _float_0_0 ? _int_1 : j), vec2(_int_1)), v + vec2(_int_1, j))); +# vec4 v4 = clamp(v1, v2, v3); +# +# // Only iteration i = 0, j = 0 increments res. +# res += min(v0, v4) * float[9](1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)[i * 3 + j]; +# } +# } +# +# // The loops above simplify to a line below by substituting i = 0 and j = 0, and manually simplifying the expressions. +# vec4 ref = texture(tex, vec2(_int_1, _int_1)); +# +# // Always true. +# if(ref == res) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 355 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %336 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %12 "gl_FragCoord" + OpName %17 "a" + OpName %21 "buf1" + OpMemberName %21 0 "_GLF_uniform_int_values" + OpName %23 "" + OpName %30 "res" + OpName %36 "i" + OpName %46 "j" + OpName %54 "v0" + OpName %58 "tex" + OpName %100 "v1" + OpName %111 "buf0" + OpMemberName %111 0 "_GLF_uniform_float_values" + OpName %113 "" + OpName %209 "v2" + OpName %233 "v3" + OpName %290 "v4" + OpName %308 "indexable" + OpName %318 "ref" + OpName %336 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %20 ArrayStride 16 + OpMemberDecorate %21 0 Offset 0 + OpDecorate %21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 1 + OpDecorate %58 RelaxedPrecision + OpDecorate %58 DescriptorSet 0 + OpDecorate %58 Binding 2 + OpDecorate %59 RelaxedPrecision + OpDecorate %62 RelaxedPrecision + OpDecorate %63 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %67 RelaxedPrecision + OpDecorate %69 RelaxedPrecision + OpDecorate %74 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %77 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %84 RelaxedPrecision + OpDecorate %92 RelaxedPrecision + OpDecorate %95 RelaxedPrecision + OpDecorate %96 RelaxedPrecision + OpDecorate %97 RelaxedPrecision + OpDecorate %98 RelaxedPrecision + OpDecorate %99 RelaxedPrecision + OpDecorate %101 RelaxedPrecision + OpDecorate %104 RelaxedPrecision + OpDecorate %105 RelaxedPrecision + OpDecorate %110 ArrayStride 16 + OpMemberDecorate %111 0 Offset 0 + OpDecorate %111 Block + OpDecorate %113 DescriptorSet 0 + OpDecorate %113 Binding 0 + OpDecorate %118 RelaxedPrecision + OpDecorate %122 RelaxedPrecision + OpDecorate %125 RelaxedPrecision + OpDecorate %126 RelaxedPrecision + OpDecorate %128 RelaxedPrecision + OpDecorate %130 RelaxedPrecision + OpDecorate %131 RelaxedPrecision + OpDecorate %132 RelaxedPrecision + OpDecorate %136 RelaxedPrecision + OpDecorate %137 RelaxedPrecision + OpDecorate %138 RelaxedPrecision + OpDecorate %141 RelaxedPrecision + OpDecorate %142 RelaxedPrecision + OpDecorate %143 RelaxedPrecision + OpDecorate %145 RelaxedPrecision + OpDecorate %147 RelaxedPrecision + OpDecorate %148 RelaxedPrecision + OpDecorate %150 RelaxedPrecision + OpDecorate %152 RelaxedPrecision + OpDecorate %153 RelaxedPrecision + OpDecorate %154 RelaxedPrecision + OpDecorate %155 RelaxedPrecision + OpDecorate %156 RelaxedPrecision + OpDecorate %159 RelaxedPrecision + OpDecorate %160 RelaxedPrecision + OpDecorate %162 RelaxedPrecision + OpDecorate %164 RelaxedPrecision + OpDecorate %165 RelaxedPrecision + OpDecorate %167 RelaxedPrecision + OpDecorate %170 RelaxedPrecision + OpDecorate %171 RelaxedPrecision + OpDecorate %172 RelaxedPrecision + OpDecorate %173 RelaxedPrecision + OpDecorate %176 RelaxedPrecision + OpDecorate %177 RelaxedPrecision + OpDecorate %180 RelaxedPrecision + OpDecorate %181 RelaxedPrecision + OpDecorate %184 RelaxedPrecision + OpDecorate %185 RelaxedPrecision + OpDecorate %187 RelaxedPrecision + OpDecorate %189 RelaxedPrecision + OpDecorate %190 RelaxedPrecision + OpDecorate %191 RelaxedPrecision + OpDecorate %194 RelaxedPrecision + OpDecorate %195 RelaxedPrecision + OpDecorate %200 RelaxedPrecision + OpDecorate %202 RelaxedPrecision + OpDecorate %203 RelaxedPrecision + OpDecorate %204 RelaxedPrecision + OpDecorate %205 RelaxedPrecision + OpDecorate %206 RelaxedPrecision + OpDecorate %207 RelaxedPrecision + OpDecorate %208 RelaxedPrecision + OpDecorate %210 RelaxedPrecision + OpDecorate %213 RelaxedPrecision + OpDecorate %214 RelaxedPrecision + OpDecorate %218 RelaxedPrecision + OpDecorate %220 RelaxedPrecision + OpDecorate %221 RelaxedPrecision + OpDecorate %222 RelaxedPrecision + OpDecorate %225 RelaxedPrecision + OpDecorate %226 RelaxedPrecision + OpDecorate %229 RelaxedPrecision + OpDecorate %230 RelaxedPrecision + OpDecorate %231 RelaxedPrecision + OpDecorate %232 RelaxedPrecision + OpDecorate %234 RelaxedPrecision + OpDecorate %289 RelaxedPrecision + OpDecorate %319 RelaxedPrecision + OpDecorate %322 RelaxedPrecision + OpDecorate %325 RelaxedPrecision + OpDecorate %326 RelaxedPrecision + OpDecorate %327 RelaxedPrecision + OpDecorate %336 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeInt 32 1 + %16 = OpTypePointer Function %15 + %18 = OpTypeInt 32 0 + %19 = OpConstant %18 3 + %20 = OpTypeArray %15 %19 + %21 = OpTypeStruct %20 + %22 = OpTypePointer Uniform %21 + %23 = OpVariable %22 Uniform + %24 = OpConstant %15 0 + %25 = OpConstant %15 2 + %26 = OpTypePointer Uniform %15 + %29 = OpTypePointer Function %10 + %31 = OpConstant %15 1 + %43 = OpConstant %15 3 + %44 = OpTypeBool + %55 = OpTypeImage %6 2D 0 0 0 1 Unknown + %56 = OpTypeSampledImage %55 + %57 = OpTypePointer UniformConstant %56 + %58 = OpVariable %57 UniformConstant + %85 = OpConstant %18 1 + %86 = OpTypePointer Function %6 + %106 = OpConstant %18 0 + %107 = OpTypePointer Input %6 + %110 = OpTypeArray %6 %85 + %111 = OpTypeStruct %110 + %112 = OpTypePointer Uniform %111 + %113 = OpVariable %112 Uniform + %114 = OpTypePointer Uniform %6 + %298 = OpConstant %18 9 + %299 = OpTypeArray %6 %298 + %300 = OpConstant %6 1 + %301 = OpConstant %6 0 + %302 = OpConstantComposite %299 %300 %301 %301 %301 %301 %301 %301 %301 %301 + %307 = OpTypePointer Function %299 + %330 = OpTypeVector %44 4 + %335 = OpTypePointer Output %10 + %336 = OpVariable %335 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %17 = OpVariable %16 Function + %30 = OpVariable %29 Function + %36 = OpVariable %16 Function + %46 = OpVariable %16 Function + %54 = OpVariable %29 Function + %100 = OpVariable %29 Function + %118 = OpVariable %8 Function + %209 = OpVariable %29 Function + %233 = OpVariable %29 Function + %264 = OpVariable %16 Function + %290 = OpVariable %29 Function + %308 = OpVariable %307 Function + %318 = OpVariable %29 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + OpStore %9 %14 + %27 = OpAccessChain %26 %23 %24 %25 + %28 = OpLoad %15 %27 + OpStore %17 %28 + %32 = OpAccessChain %26 %23 %24 %31 + %33 = OpLoad %15 %32 + %34 = OpConvertSToF %6 %33 + %35 = OpCompositeConstruct %10 %34 %34 %34 %34 + OpStore %30 %35 + OpStore %36 %24 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %15 %36 + %45 = OpSLessThan %44 %42 %43 + OpBranchConditional %45 %38 %39 + %38 = OpLabel + OpStore %46 %24 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %15 %46 + %53 = OpSLessThan %44 %52 %43 + OpBranchConditional %53 %48 %49 + %48 = OpLabel + %59 = OpLoad %56 %58 + %60 = OpAccessChain %26 %23 %24 %24 + %61 = OpLoad %15 %60 + %62 = OpConvertSToF %6 %61 + %63 = OpCompositeConstruct %7 %62 %62 + %64 = OpAccessChain %26 %23 %24 %24 + %65 = OpLoad %15 %64 + %66 = OpConvertSToF %6 %65 + %67 = OpCompositeConstruct %7 %66 %66 + %68 = OpLoad %15 %36 + %69 = OpConvertSToF %6 %68 + %70 = OpLoad %15 %46 + %71 = OpAccessChain %26 %23 %24 %24 + %72 = OpLoad %15 %71 + %73 = OpISub %15 %70 %72 + %74 = OpConvertSToF %6 %73 + %75 = OpCompositeConstruct %7 %69 %74 + %76 = OpExtInst %7 %1 FMax %67 %75 + %77 = OpFAdd %7 %63 %76 + %78 = OpAccessChain %26 %23 %24 %24 + %79 = OpLoad %15 %78 + %80 = OpConvertSToF %6 %79 + %81 = OpCompositeConstruct %7 %80 %80 + %82 = OpAccessChain %26 %23 %24 %24 + %83 = OpLoad %15 %82 + %84 = OpConvertSToF %6 %83 + %87 = OpAccessChain %86 %9 %85 + %88 = OpLoad %6 %87 + %89 = OpLoad %15 %46 + %90 = OpConvertSToF %6 %89 + %91 = OpFAdd %6 %88 %90 + %92 = OpCompositeConstruct %7 %84 %91 + %93 = OpAccessChain %26 %23 %24 %24 + %94 = OpLoad %15 %93 + %95 = OpConvertSToF %6 %94 + %96 = OpCompositeConstruct %7 %95 %95 + %97 = OpFSub %7 %92 %96 + %98 = OpExtInst %7 %1 FClamp %77 %81 %97 + %99 = OpImageSampleImplicitLod %10 %59 %98 + OpStore %54 %99 + %101 = OpLoad %56 %58 + %102 = OpAccessChain %26 %23 %24 %24 + %103 = OpLoad %15 %102 + %104 = OpConvertSToF %6 %103 + %105 = OpCompositeConstruct %7 %104 %104 + %108 = OpAccessChain %107 %12 %106 + %109 = OpLoad %6 %108 + %115 = OpAccessChain %114 %113 %24 %24 + %116 = OpLoad %6 %115 + %117 = OpFOrdGreaterThan %44 %109 %116 + OpSelectionMerge %120 None + OpBranchConditional %117 %119 %133 + %119 = OpLabel + %121 = OpLoad %15 %36 + %122 = OpConvertSToF %6 %121 + %123 = OpAccessChain %26 %23 %24 %24 + %124 = OpLoad %15 %123 + %125 = OpConvertSToF %6 %124 + %126 = OpCompositeConstruct %7 %122 %125 + %127 = OpLoad %15 %17 + %128 = OpConvertSToF %6 %127 + %129 = OpLoad %15 %46 + %130 = OpConvertSToF %6 %129 + %131 = OpCompositeConstruct %7 %128 %130 + %132 = OpExtInst %7 %1 FMax %126 %131 + OpStore %118 %132 + OpBranch %120 + %133 = OpLabel + %134 = OpAccessChain %26 %23 %24 %24 + %135 = OpLoad %15 %134 + %136 = OpConvertSToF %6 %135 + %137 = OpCompositeConstruct %7 %136 %136 + OpStore %118 %137 + OpBranch %120 + %120 = OpLabel + %138 = OpLoad %7 %118 + %139 = OpAccessChain %26 %23 %24 %24 + %140 = OpLoad %15 %139 + %141 = OpConvertSToF %6 %140 + %142 = OpCompositeConstruct %7 %141 %141 + %143 = OpExtInst %7 %1 FMin %138 %142 + %144 = OpLoad %15 %36 + %145 = OpConvertSToF %6 %144 + %146 = OpLoad %15 %46 + %147 = OpConvertSToF %6 %146 + %148 = OpCompositeConstruct %7 %145 %147 + %149 = OpLoad %15 %17 + %150 = OpConvertSToF %6 %149 + %151 = OpLoad %15 %46 + %152 = OpConvertSToF %6 %151 + %153 = OpCompositeConstruct %7 %150 %152 + %154 = OpExtInst %7 %1 FMax %148 %153 + %155 = OpExtInst %7 %1 FMin %143 %154 + %156 = OpFAdd %7 %105 %155 + %157 = OpAccessChain %26 %23 %24 %24 + %158 = OpLoad %15 %157 + %159 = OpConvertSToF %6 %158 + %160 = OpCompositeConstruct %7 %159 %159 + %161 = OpLoad %15 %36 + %162 = OpConvertSToF %6 %161 + %163 = OpLoad %15 %46 + %164 = OpConvertSToF %6 %163 + %165 = OpCompositeConstruct %7 %162 %164 + %166 = OpLoad %15 %36 + %167 = OpConvertSToF %6 %166 + %168 = OpAccessChain %26 %23 %24 %24 + %169 = OpLoad %15 %168 + %170 = OpConvertSToF %6 %169 + %171 = OpCompositeConstruct %7 %167 %170 + %172 = OpExtInst %7 %1 FMax %165 %171 + %173 = OpFAdd %7 %160 %172 + %174 = OpAccessChain %26 %23 %24 %24 + %175 = OpLoad %15 %174 + %176 = OpConvertSToF %6 %175 + %177 = OpCompositeConstruct %7 %176 %176 + %178 = OpAccessChain %26 %23 %24 %24 + %179 = OpLoad %15 %178 + %180 = OpConvertSToF %6 %179 + %181 = OpCompositeConstruct %7 %180 %180 + %182 = OpAccessChain %26 %23 %24 %24 + %183 = OpLoad %15 %182 + %184 = OpConvertSToF %6 %183 + %185 = OpCompositeConstruct %7 %184 %184 + %186 = OpLoad %15 %36 + %187 = OpConvertSToF %6 %186 + %188 = OpLoad %15 %46 + %189 = OpConvertSToF %6 %188 + %190 = OpCompositeConstruct %7 %187 %189 + %191 = OpExtInst %7 %1 FMax %185 %190 + %192 = OpAccessChain %26 %23 %24 %24 + %193 = OpLoad %15 %192 + %194 = OpConvertSToF %6 %193 + %195 = OpCompositeConstruct %7 %194 %194 + %196 = OpLoad %15 %36 + %197 = OpAccessChain %26 %23 %24 %24 + %198 = OpLoad %15 %197 + %199 = OpISub %15 %196 %198 + %200 = OpConvertSToF %6 %199 + %201 = OpLoad %15 %46 + %202 = OpConvertSToF %6 %201 + %203 = OpCompositeConstruct %7 %200 %202 + %204 = OpExtInst %7 %1 FMax %195 %203 + %205 = OpExtInst %7 %1 FClamp %181 %191 %204 + %206 = OpFAdd %7 %177 %205 + %207 = OpExtInst %7 %1 FClamp %156 %173 %206 + %208 = OpImageSampleImplicitLod %10 %101 %207 + OpStore %100 %208 + %210 = OpLoad %56 %58 + %211 = OpAccessChain %26 %23 %24 %24 + %212 = OpLoad %15 %211 + %213 = OpConvertSToF %6 %212 + %214 = OpCompositeConstruct %7 %213 %213 + %215 = OpLoad %15 %36 + %216 = OpLoad %15 %17 + %217 = OpIMul %15 %215 %216 + %218 = OpConvertSToF %6 %217 + %219 = OpLoad %15 %46 + %220 = OpConvertSToF %6 %219 + %221 = OpCompositeConstruct %7 %218 %220 + %222 = OpFAdd %7 %214 %221 + %223 = OpAccessChain %26 %23 %24 %24 + %224 = OpLoad %15 %223 + %225 = OpConvertSToF %6 %224 + %226 = OpCompositeConstruct %7 %225 %225 + %227 = OpAccessChain %26 %23 %24 %24 + %228 = OpLoad %15 %227 + %229 = OpConvertSToF %6 %228 + %230 = OpCompositeConstruct %7 %229 %229 + %231 = OpExtInst %7 %1 FClamp %222 %226 %230 + %232 = OpImageSampleImplicitLod %10 %210 %231 + OpStore %209 %232 + %234 = OpLoad %56 %58 + %235 = OpAccessChain %26 %23 %24 %24 + %236 = OpLoad %15 %235 + %237 = OpConvertSToF %6 %236 + %238 = OpCompositeConstruct %7 %237 %237 + %239 = OpLoad %15 %36 + %240 = OpConvertSToF %6 %239 + %241 = OpAccessChain %26 %23 %24 %24 + %242 = OpLoad %15 %241 + %243 = OpConvertSToF %6 %242 + %244 = OpCompositeConstruct %7 %240 %243 + %245 = OpAccessChain %26 %23 %24 %24 + %246 = OpLoad %15 %245 + %247 = OpConvertSToF %6 %246 + %248 = OpLoad %15 %46 + %249 = OpConvertSToF %6 %248 + %250 = OpCompositeConstruct %7 %247 %249 + %251 = OpExtInst %7 %1 FMax %244 %250 + %252 = OpFAdd %7 %238 %251 + %253 = OpAccessChain %26 %23 %24 %24 + %254 = OpLoad %15 %253 + %255 = OpConvertSToF %6 %254 + %256 = OpCompositeConstruct %7 %255 %255 + %257 = OpLoad %15 %36 + %258 = OpConvertSToF %6 %257 + %259 = OpAccessChain %107 %12 %85 + %260 = OpLoad %6 %259 + %261 = OpAccessChain %114 %113 %24 %24 + %262 = OpLoad %6 %261 + %263 = OpFOrdGreaterThan %44 %260 %262 + OpSelectionMerge %266 None + OpBranchConditional %263 %265 %269 + %265 = OpLabel + %267 = OpAccessChain %26 %23 %24 %24 + %268 = OpLoad %15 %267 + OpStore %264 %268 + OpBranch %266 + %269 = OpLabel + %270 = OpLoad %15 %46 + OpStore %264 %270 + OpBranch %266 + %266 = OpLabel + %271 = OpLoad %15 %264 + %272 = OpConvertSToF %6 %271 + %273 = OpCompositeConstruct %7 %258 %272 + %274 = OpAccessChain %26 %23 %24 %24 + %275 = OpLoad %15 %274 + %276 = OpConvertSToF %6 %275 + %277 = OpCompositeConstruct %7 %276 %276 + %278 = OpExtInst %7 %1 FMax %273 %277 + %279 = OpFAdd %7 %256 %278 + %280 = OpLoad %7 %9 + %281 = OpAccessChain %26 %23 %24 %24 + %282 = OpLoad %15 %281 + %283 = OpConvertSToF %6 %282 + %284 = OpLoad %15 %46 + %285 = OpConvertSToF %6 %284 + %286 = OpCompositeConstruct %7 %283 %285 + %287 = OpFAdd %7 %280 %286 + %288 = OpExtInst %7 %1 FClamp %252 %279 %287 + %289 = OpImageSampleImplicitLod %10 %234 %288 + OpStore %233 %289 + %291 = OpLoad %10 %100 + %292 = OpLoad %10 %209 + %293 = OpLoad %10 %233 + %294 = OpExtInst %10 %1 FClamp %291 %292 %293 + OpStore %290 %294 + %295 = OpLoad %10 %54 + %296 = OpLoad %10 %290 + %297 = OpExtInst %10 %1 FMin %295 %296 + %303 = OpLoad %15 %36 + %304 = OpIMul %15 %303 %43 + %305 = OpLoad %15 %46 + %306 = OpIAdd %15 %304 %305 + OpStore %308 %302 + %309 = OpAccessChain %86 %308 %306 + %310 = OpLoad %6 %309 + %311 = OpVectorTimesScalar %10 %297 %310 + %312 = OpLoad %10 %30 + %313 = OpFAdd %10 %312 %311 + OpStore %30 %313 + OpBranch %50 + %50 = OpLabel + %314 = OpLoad %15 %46 + %315 = OpIAdd %15 %314 %31 + OpStore %46 %315 + OpBranch %47 + %49 = OpLabel + OpBranch %40 + %40 = OpLabel + %316 = OpLoad %15 %36 + %317 = OpIAdd %15 %316 %31 + OpStore %36 %317 + OpBranch %37 + %39 = OpLabel + %319 = OpLoad %56 %58 + %320 = OpAccessChain %26 %23 %24 %24 + %321 = OpLoad %15 %320 + %322 = OpConvertSToF %6 %321 + %323 = OpAccessChain %26 %23 %24 %24 + %324 = OpLoad %15 %323 + %325 = OpConvertSToF %6 %324 + %326 = OpCompositeConstruct %7 %322 %325 + %327 = OpImageSampleImplicitLod %10 %319 %326 + OpStore %318 %327 + %328 = OpLoad %10 %318 + %329 = OpLoad %10 %30 + %331 = OpFOrdEqual %330 %328 %329 + %332 = OpAll %44 %331 + OpSelectionMerge %334 None + OpBranchConditional %332 %333 %350 + %333 = OpLabel + %337 = OpAccessChain %26 %23 %24 %24 + %338 = OpLoad %15 %337 + %339 = OpConvertSToF %6 %338 + %340 = OpAccessChain %26 %23 %24 %31 + %341 = OpLoad %15 %340 + %342 = OpConvertSToF %6 %341 + %343 = OpAccessChain %26 %23 %24 %31 + %344 = OpLoad %15 %343 + %345 = OpConvertSToF %6 %344 + %346 = OpAccessChain %26 %23 %24 %24 + %347 = OpLoad %15 %346 + %348 = OpConvertSToF %6 %347 + %349 = OpCompositeConstruct %10 %339 %342 %345 %348 + OpStore %336 %349 + OpBranch %334 + %350 = OpLabel + %351 = OpAccessChain %26 %23 %24 %31 + %352 = OpLoad %15 %351 + %353 = OpConvertSToF %6 %352 + %354 = OpCompositeConstruct %10 %353 %353 %353 %353 + OpStore %336 %354 + OpBranch %334 + %334 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# tex +SAMPLER variant_tex + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 256 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-multiple-iterator-variables-copy-array-elements.amber b/vulkan/amber/graphicsfuzz/cov-loop-multiple-iterator-variables-copy-array-elements.amber new file mode 100644 index 0000000..e6a2b17 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-multiple-iterator-variables-copy-array-elements.amber @@ -0,0 +1,376 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_6 _GLF_uniform_int_values[0] +# #define _int_7 _GLF_uniform_int_values[1] +# #define _int_8 _GLF_uniform_int_values[2] +# #define _int_9 _GLF_uniform_int_values[3] +# #define _int_10 _GLF_uniform_int_values[4] +# #define _int_11 _GLF_uniform_int_values[5] +# #define _int_12 _GLF_uniform_int_values[6] +# #define _int_13 _GLF_uniform_int_values[7] +# #define _int_14 _GLF_uniform_int_values[8] +# #define _int_15 _GLF_uniform_int_values[9] +# #define _int_16 _GLF_uniform_int_values[10] +# #define _int_2 _GLF_uniform_int_values[11] +# #define _int_3 _GLF_uniform_int_values[12] +# #define _int_1 _GLF_uniform_int_values[13] +# #define _int_0 _GLF_uniform_int_values[14] +# #define _int_4 _GLF_uniform_int_values[15] +# #define _int_5 _GLF_uniform_int_values[16] +# #define _int_17 _GLF_uniform_int_values[17] +# #define _int_18 _GLF_uniform_int_values[18] +# #define _int_19 _GLF_uniform_int_values[19] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 2, 3, 1, 0, 4, 5, 17, 18, 19] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[20]; +# }; +# +# // Contents of three: 3 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int three; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr0[10] = int[10](0, _int_1, 2, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9), arr1[10] = int[10](_int_10, _int_11, _int_12, _int_13, _int_14, _int_15, _int_16, _int_17, _int_18, _int_19); +# int k = _int_0, j = _int_0; +# +# // Iterates three times and copies elements 0..2 from arr0 to arr1. +# for(int i = 0; i < three; i++) +# { +# arr1[k++] = arr0[j++]; +# } +# +# // No effect: the values are already equal. +# arr0[1] = arr1[1]; +# +# // Always true. +# if(arr0[0] == 0 && arr0[1] == 1 && arr0[2] == 2 && arr1[0] == _int_0 && arr1[1] == 1 && arr1[_int_2] == _int_2 && arr1[_int_3] == _int_13) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 183 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %164 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr0" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %43 "arr1" + OpName %76 "k" + OpName %80 "j" + OpName %83 "i" + OpName %90 "buf1" + OpMemberName %90 0 "three" + OpName %92 "" + OpName %164 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpMemberDecorate %90 0 Offset 0 + OpDecorate %90 Block + OpDecorate %92 DescriptorSet 0 + OpDecorate %92 Binding 1 + OpDecorate %164 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %6 0 + %13 = OpConstant %7 20 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 13 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 2 + %23 = OpConstant %6 12 + %26 = OpConstant %6 15 + %29 = OpConstant %6 16 + %34 = OpConstant %6 1 + %39 = OpConstant %6 3 + %44 = OpConstant %6 4 + %47 = OpConstant %6 5 + %50 = OpConstant %6 6 + %53 = OpConstant %6 7 + %56 = OpConstant %6 8 + %59 = OpConstant %6 9 + %62 = OpConstant %6 10 + %65 = OpConstant %6 17 + %68 = OpConstant %6 18 + %71 = OpConstant %6 19 + %75 = OpTypePointer Function %6 + %77 = OpConstant %6 14 + %90 = OpTypeStruct %6 + %91 = OpTypePointer Uniform %90 + %92 = OpVariable %91 Uniform + %95 = OpTypeBool + %140 = OpConstant %6 11 + %161 = OpTypeFloat 32 + %162 = OpTypeVector %161 4 + %163 = OpTypePointer Output %162 + %164 = OpVariable %163 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %43 = OpVariable %10 Function + %76 = OpVariable %75 Function + %80 = OpVariable %75 Function + %83 = OpVariable %75 Function + %20 = OpAccessChain %19 %17 %12 %18 + %21 = OpLoad %6 %20 + %24 = OpAccessChain %19 %17 %12 %23 + %25 = OpLoad %6 %24 + %27 = OpAccessChain %19 %17 %12 %26 + %28 = OpLoad %6 %27 + %30 = OpAccessChain %19 %17 %12 %29 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %19 %17 %12 %12 + %33 = OpLoad %6 %32 + %35 = OpAccessChain %19 %17 %12 %34 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %19 %17 %12 %22 + %38 = OpLoad %6 %37 + %40 = OpAccessChain %19 %17 %12 %39 + %41 = OpLoad %6 %40 + %42 = OpCompositeConstruct %9 %12 %21 %22 %25 %28 %31 %33 %36 %38 %41 + OpStore %11 %42 + %45 = OpAccessChain %19 %17 %12 %44 + %46 = OpLoad %6 %45 + %48 = OpAccessChain %19 %17 %12 %47 + %49 = OpLoad %6 %48 + %51 = OpAccessChain %19 %17 %12 %50 + %52 = OpLoad %6 %51 + %54 = OpAccessChain %19 %17 %12 %53 + %55 = OpLoad %6 %54 + %57 = OpAccessChain %19 %17 %12 %56 + %58 = OpLoad %6 %57 + %60 = OpAccessChain %19 %17 %12 %59 + %61 = OpLoad %6 %60 + %63 = OpAccessChain %19 %17 %12 %62 + %64 = OpLoad %6 %63 + %66 = OpAccessChain %19 %17 %12 %65 + %67 = OpLoad %6 %66 + %69 = OpAccessChain %19 %17 %12 %68 + %70 = OpLoad %6 %69 + %72 = OpAccessChain %19 %17 %12 %71 + %73 = OpLoad %6 %72 + %74 = OpCompositeConstruct %9 %46 %49 %52 %55 %58 %61 %64 %67 %70 %73 + OpStore %43 %74 + %78 = OpAccessChain %19 %17 %12 %77 + %79 = OpLoad %6 %78 + OpStore %76 %79 + %81 = OpAccessChain %19 %17 %12 %77 + %82 = OpLoad %6 %81 + OpStore %80 %82 + OpStore %83 %12 + OpBranch %84 + %84 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %89 = OpLoad %6 %83 + %93 = OpAccessChain %19 %92 %12 + %94 = OpLoad %6 %93 + %96 = OpSLessThan %95 %89 %94 + OpBranchConditional %96 %85 %86 + %85 = OpLabel + %97 = OpLoad %6 %76 + %98 = OpIAdd %6 %97 %34 + OpStore %76 %98 + %99 = OpLoad %6 %80 + %100 = OpIAdd %6 %99 %34 + OpStore %80 %100 + %101 = OpAccessChain %75 %11 %99 + %102 = OpLoad %6 %101 + %103 = OpAccessChain %75 %43 %97 + OpStore %103 %102 + OpBranch %87 + %87 = OpLabel + %104 = OpLoad %6 %83 + %105 = OpIAdd %6 %104 %34 + OpStore %83 %105 + OpBranch %84 + %86 = OpLabel + %106 = OpAccessChain %75 %43 %34 + %107 = OpLoad %6 %106 + %108 = OpAccessChain %75 %11 %34 + OpStore %108 %107 + %109 = OpAccessChain %75 %11 %12 + %110 = OpLoad %6 %109 + %111 = OpIEqual %95 %110 %12 + OpSelectionMerge %113 None + OpBranchConditional %111 %112 %113 + %112 = OpLabel + %114 = OpAccessChain %75 %11 %34 + %115 = OpLoad %6 %114 + %116 = OpIEqual %95 %115 %34 + OpBranch %113 + %113 = OpLabel + %117 = OpPhi %95 %111 %86 %116 %112 + OpSelectionMerge %119 None + OpBranchConditional %117 %118 %119 + %118 = OpLabel + %120 = OpAccessChain %75 %11 %22 + %121 = OpLoad %6 %120 + %122 = OpIEqual %95 %121 %22 + OpBranch %119 + %119 = OpLabel + %123 = OpPhi %95 %117 %113 %122 %118 + OpSelectionMerge %125 None + OpBranchConditional %123 %124 %125 + %124 = OpLabel + %126 = OpAccessChain %75 %43 %12 + %127 = OpLoad %6 %126 + %128 = OpAccessChain %19 %17 %12 %77 + %129 = OpLoad %6 %128 + %130 = OpIEqual %95 %127 %129 + OpBranch %125 + %125 = OpLabel + %131 = OpPhi %95 %123 %119 %130 %124 + OpSelectionMerge %133 None + OpBranchConditional %131 %132 %133 + %132 = OpLabel + %134 = OpAccessChain %75 %43 %34 + %135 = OpLoad %6 %134 + %136 = OpIEqual %95 %135 %34 + OpBranch %133 + %133 = OpLabel + %137 = OpPhi %95 %131 %125 %136 %132 + OpSelectionMerge %139 None + OpBranchConditional %137 %138 %139 + %138 = OpLabel + %141 = OpAccessChain %19 %17 %12 %140 + %142 = OpLoad %6 %141 + %143 = OpAccessChain %75 %43 %142 + %144 = OpLoad %6 %143 + %145 = OpAccessChain %19 %17 %12 %140 + %146 = OpLoad %6 %145 + %147 = OpIEqual %95 %144 %146 + OpBranch %139 + %139 = OpLabel + %148 = OpPhi %95 %137 %133 %147 %138 + OpSelectionMerge %150 None + OpBranchConditional %148 %149 %150 + %149 = OpLabel + %151 = OpAccessChain %19 %17 %12 %23 + %152 = OpLoad %6 %151 + %153 = OpAccessChain %75 %43 %152 + %154 = OpLoad %6 %153 + %155 = OpAccessChain %19 %17 %12 %53 + %156 = OpLoad %6 %155 + %157 = OpIEqual %95 %154 %156 + OpBranch %150 + %150 = OpLabel + %158 = OpPhi %95 %148 %139 %157 %149 + OpSelectionMerge %160 None + OpBranchConditional %158 %159 %178 + %159 = OpLabel + %165 = OpAccessChain %19 %17 %12 %18 + %166 = OpLoad %6 %165 + %167 = OpConvertSToF %161 %166 + %168 = OpAccessChain %19 %17 %12 %77 + %169 = OpLoad %6 %168 + %170 = OpConvertSToF %161 %169 + %171 = OpAccessChain %19 %17 %12 %77 + %172 = OpLoad %6 %171 + %173 = OpConvertSToF %161 %172 + %174 = OpAccessChain %19 %17 %12 %18 + %175 = OpLoad %6 %174 + %176 = OpConvertSToF %161 %175 + %177 = OpCompositeConstruct %162 %167 %170 %173 %176 + OpStore %164 %177 + OpBranch %160 + %178 = OpLabel + %179 = OpAccessChain %19 %17 %12 %77 + %180 = OpLoad %6 %179 + %181 = OpConvertSToF %161 %180 + %182 = OpCompositeConstruct %162 %181 %181 %181 %181 + OpStore %164 %182 + OpBranch %160 + %160 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# three +BUFFER variant_three DATA_TYPE int32 STD140 DATA + 3 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 6 7 8 9 10 11 12 13 14 15 16 2 3 1 0 4 5 17 18 19 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_three AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-never-iterated-constant-vector-condition.amber b/vulkan/amber/graphicsfuzz/cov-loop-never-iterated-constant-vector-condition.amber new file mode 100644 index 0000000..a7a01fa --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-never-iterated-constant-vector-condition.amber @@ -0,0 +1,256 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_2_0 _GLF_uniform_float_values[0] +# #define _float_923_2 _GLF_uniform_float_values[1] +# #define _float_9_9 _GLF_uniform_float_values[2] +# #define _float_802_849 _GLF_uniform_float_values[3] +# #define _float_1_0 _GLF_uniform_float_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [2.0, 923.2, 9.9, 802.849, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[5]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // This will be replaced later. +# _GLF_color = vec4(_float_923_2, _float_9_9, _float_802_849, _float_2_0); +# vec2 v = vec2(1.0); +# +# // Never iterated. +# while((v.x > 1.0 || v.y > 1.0) && (_GLF_global_loop_count < _GLF_global_loop_bound)) +# { +# _GLF_global_loop_count++; +# v *= _float_2_0; +# _GLF_color = vec4(_float_1_0); +# } +# +# // Always true. +# if(v == vec2(_int_1)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 100 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %13 "_GLF_color" + OpName %17 "buf1" + OpMemberName %17 0 "_GLF_uniform_float_values" + OpName %19 "" + OpName %35 "v" + OpName %74 "buf0" + OpMemberName %74 0 "_GLF_uniform_int_values" + OpName %76 "" + OpDecorate %13 Location 0 + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %73 ArrayStride 16 + OpMemberDecorate %74 0 Offset 0 + OpDecorate %74 Block + OpDecorate %76 DescriptorSet 0 + OpDecorate %76 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Output %11 + %13 = OpVariable %12 Output + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 5 + %16 = OpTypeArray %10 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %6 1 + %21 = OpTypePointer Uniform %10 + %24 = OpConstant %6 2 + %27 = OpConstant %6 3 + %33 = OpTypeVector %10 2 + %34 = OpTypePointer Function %33 + %36 = OpConstant %10 1 + %37 = OpConstantComposite %33 %36 %36 + %43 = OpTypeBool + %44 = OpConstant %14 0 + %45 = OpTypePointer Function %10 + %52 = OpConstant %14 1 + %58 = OpConstant %6 10 + %67 = OpConstant %6 4 + %72 = OpConstant %14 2 + %73 = OpTypeArray %6 %72 + %74 = OpTypeStruct %73 + %75 = OpTypePointer Uniform %74 + %76 = OpVariable %75 Uniform + %77 = OpTypePointer Uniform %6 + %82 = OpTypeVector %43 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %35 = OpVariable %34 Function + OpStore %8 %9 + %22 = OpAccessChain %21 %19 %9 %20 + %23 = OpLoad %10 %22 + %25 = OpAccessChain %21 %19 %9 %24 + %26 = OpLoad %10 %25 + %28 = OpAccessChain %21 %19 %9 %27 + %29 = OpLoad %10 %28 + %30 = OpAccessChain %21 %19 %9 %9 + %31 = OpLoad %10 %30 + %32 = OpCompositeConstruct %11 %23 %26 %29 %31 + OpStore %13 %32 + OpStore %35 %37 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %46 = OpAccessChain %45 %35 %44 + %47 = OpLoad %10 %46 + %48 = OpFOrdGreaterThan %43 %47 %36 + %49 = OpLogicalNot %43 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %51 + %50 = OpLabel + %53 = OpAccessChain %45 %35 %52 + %54 = OpLoad %10 %53 + %55 = OpFOrdGreaterThan %43 %54 %36 + OpBranch %51 + %51 = OpLabel + %56 = OpPhi %43 %48 %42 %55 %50 + %57 = OpLoad %6 %8 + %59 = OpSLessThan %43 %57 %58 + %60 = OpLogicalAnd %43 %56 %59 + OpBranchConditional %60 %39 %40 + %39 = OpLabel + %61 = OpLoad %6 %8 + %62 = OpIAdd %6 %61 %20 + OpStore %8 %62 + %63 = OpAccessChain %21 %19 %9 %9 + %64 = OpLoad %10 %63 + %65 = OpLoad %33 %35 + %66 = OpVectorTimesScalar %33 %65 %64 + OpStore %35 %66 + %68 = OpAccessChain %21 %19 %9 %67 + %69 = OpLoad %10 %68 + %70 = OpCompositeConstruct %11 %69 %69 %69 %69 + OpStore %13 %70 + OpBranch %41 + %41 = OpLabel + OpBranch %38 + %40 = OpLabel + %71 = OpLoad %33 %35 + %78 = OpAccessChain %77 %76 %9 %9 + %79 = OpLoad %6 %78 + %80 = OpConvertSToF %10 %79 + %81 = OpCompositeConstruct %33 %80 %80 + %83 = OpFOrdEqual %82 %71 %81 + %84 = OpAll %43 %83 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %86 + %85 = OpLabel + %87 = OpAccessChain %77 %76 %9 %9 + %88 = OpLoad %6 %87 + %89 = OpConvertSToF %10 %88 + %90 = OpAccessChain %77 %76 %9 %20 + %91 = OpLoad %6 %90 + %92 = OpConvertSToF %10 %91 + %93 = OpAccessChain %77 %76 %9 %20 + %94 = OpLoad %6 %93 + %95 = OpConvertSToF %10 %94 + %96 = OpAccessChain %77 %76 %9 %9 + %97 = OpLoad %6 %96 + %98 = OpConvertSToF %10 %97 + %99 = OpCompositeConstruct %11 %89 %92 %95 %98 + OpStore %13 %99 + OpBranch %86 + %86 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 923.2 9.9 802.849 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-overwrite-sample-texture-as-color-output.amber b/vulkan/amber/graphicsfuzz/cov-loop-overwrite-sample-texture-as-color-output.amber new file mode 100644 index 0000000..9bbe394 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-overwrite-sample-texture-as-color-output.amber @@ -0,0 +1,295 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 2) uniform sampler2D tex; +# +# void main() +# { +# // This will be overwritten later. +# _GLF_color = texture(tex, vec2(_float_1_0)); +# +# vec2 v = vec2(_float_1_0); +# int a = 0; +# +# // One of the conditions in parentheses is always true. +# while((a < 1 || v.y > 1.0) && _GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# v *= 2.0; +# a++; +# } +# +# // Always false: the previous loop was run until the global loop bound was reached. +# if(_GLF_global_loop_count != _GLF_global_loop_bound) +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 94 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %13 "_GLF_color" + OpName %17 "tex" + OpName %22 "buf0" + OpMemberName %22 0 "_GLF_uniform_float_values" + OpName %24 "" + OpName %32 "v" + OpName %37 "a" + OpName %64 "buf1" + OpMemberName %64 0 "_GLF_uniform_int_values" + OpName %66 "" + OpDecorate %13 Location 0 + OpDecorate %17 RelaxedPrecision + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 2 + OpDecorate %18 RelaxedPrecision + OpDecorate %21 ArrayStride 16 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %29 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %63 ArrayStride 16 + OpMemberDecorate %64 0 Offset 0 + OpDecorate %64 Block + OpDecorate %66 DescriptorSet 0 + OpDecorate %66 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Output %11 + %13 = OpVariable %12 Output + %14 = OpTypeImage %10 2D 0 0 0 1 Unknown + %15 = OpTypeSampledImage %14 + %16 = OpTypePointer UniformConstant %15 + %17 = OpVariable %16 UniformConstant + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 1 + %21 = OpTypeArray %10 %20 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpTypePointer Uniform %10 + %28 = OpTypeVector %10 2 + %31 = OpTypePointer Function %28 + %36 = OpTypePointer Function %6 + %43 = OpTypeBool + %45 = OpConstant %6 1 + %50 = OpTypePointer Function %10 + %53 = OpConstant %10 1 + %57 = OpConstant %6 10 + %62 = OpConstant %19 2 + %63 = OpTypeArray %6 %62 + %64 = OpTypeStruct %63 + %65 = OpTypePointer Uniform %64 + %66 = OpVariable %65 Uniform + %67 = OpTypePointer Uniform %6 + %81 = OpConstant %10 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %32 = OpVariable %31 Function + %37 = OpVariable %36 Function + OpStore %8 %9 + %18 = OpLoad %15 %17 + %26 = OpAccessChain %25 %24 %9 %9 + %27 = OpLoad %10 %26 + %29 = OpCompositeConstruct %28 %27 %27 + %30 = OpImageSampleImplicitLod %11 %18 %29 + OpStore %13 %30 + %33 = OpAccessChain %25 %24 %9 %9 + %34 = OpLoad %10 %33 + %35 = OpCompositeConstruct %28 %34 %34 + OpStore %32 %35 + OpStore %37 %9 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %44 = OpLoad %6 %37 + %46 = OpSLessThan %43 %44 %45 + %47 = OpLogicalNot %43 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %49 + %48 = OpLabel + %51 = OpAccessChain %50 %32 %20 + %52 = OpLoad %10 %51 + %54 = OpFOrdGreaterThan %43 %52 %53 + OpBranch %49 + %49 = OpLabel + %55 = OpPhi %43 %46 %42 %54 %48 + %56 = OpLoad %6 %8 + %58 = OpSLessThan %43 %56 %57 + %59 = OpLogicalAnd %43 %55 %58 + OpBranchConditional %59 %39 %40 + %39 = OpLabel + %60 = OpLoad %6 %8 + %61 = OpIAdd %6 %60 %45 + OpStore %8 %61 + %68 = OpAccessChain %67 %66 %9 %9 + %69 = OpLoad %6 %68 + %70 = OpConvertSToF %10 %69 + %71 = OpAccessChain %67 %66 %9 %45 + %72 = OpLoad %6 %71 + %73 = OpConvertSToF %10 %72 + %74 = OpAccessChain %67 %66 %9 %45 + %75 = OpLoad %6 %74 + %76 = OpConvertSToF %10 %75 + %77 = OpAccessChain %67 %66 %9 %9 + %78 = OpLoad %6 %77 + %79 = OpConvertSToF %10 %78 + %80 = OpCompositeConstruct %11 %70 %73 %76 %79 + OpStore %13 %80 + %82 = OpLoad %28 %32 + %83 = OpVectorTimesScalar %28 %82 %81 + OpStore %32 %83 + %84 = OpLoad %6 %37 + %85 = OpIAdd %6 %84 %45 + OpStore %37 %85 + OpBranch %41 + %41 = OpLabel + OpBranch %38 + %40 = OpLabel + %86 = OpLoad %6 %8 + %87 = OpINotEqual %43 %86 %57 + OpSelectionMerge %89 None + OpBranchConditional %87 %88 %89 + %88 = OpLabel + %90 = OpAccessChain %67 %66 %9 %45 + %91 = OpLoad %6 %90 + %92 = OpConvertSToF %10 %91 + %93 = OpCompositeConstruct %11 %92 %92 %92 %92 + OpStore %13 %93 + OpBranch %89 + %89 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# tex +SAMPLER variant_tex + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-read-array-index-from-array-data.amber b/vulkan/amber/graphicsfuzz/cov-loop-read-array-index-from-array-data.amber new file mode 100644 index 0000000..10cd998 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-read-array-index-from-array-data.amber @@ -0,0 +1,204 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[10] = int[10](30989, 0, 0, 0, 0, 0, 0, 0, 0, 1); +# int i = 0; +# int a = _int_0; +# +# // Iterates twice. +# while(i != 1) +# { +# // The first iteration sets i to arr[0] = 30989, and the second iteration sets i to arr[9] = 1. +# i = arr[clamp(i, 0, 10 - 1)]; +# a++; +# } +# +# // Always true. +# if(a == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %17 "i" + OpName %18 "a" + OpName %21 "buf0" + OpMemberName %21 0 "_GLF_uniform_int_values" + OpName %23 "" + OpName %52 "_GLF_color" + OpDecorate %20 ArrayStride 16 + OpMemberDecorate %21 0 Offset 0 + OpDecorate %21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 0 + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %6 30989 + %13 = OpConstant %6 0 + %14 = OpConstant %6 1 + %15 = OpConstantComposite %9 %12 %13 %13 %13 %13 %13 %13 %13 %13 %14 + %16 = OpTypePointer Function %6 + %19 = OpConstant %7 3 + %20 = OpTypeArray %6 %19 + %21 = OpTypeStruct %20 + %22 = OpTypePointer Uniform %21 + %23 = OpVariable %22 Uniform + %24 = OpTypePointer Uniform %6 + %33 = OpTypeBool + %36 = OpConstant %6 9 + %43 = OpConstant %6 2 + %49 = OpTypeFloat 32 + %50 = OpTypeVector %49 4 + %51 = OpTypePointer Output %50 + %52 = OpVariable %51 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %17 = OpVariable %16 Function + %18 = OpVariable %16 Function + OpStore %11 %15 + OpStore %17 %13 + %25 = OpAccessChain %24 %23 %13 %14 + %26 = OpLoad %6 %25 + OpStore %18 %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %6 %17 + %34 = OpINotEqual %33 %32 %14 + OpBranchConditional %34 %28 %29 + %28 = OpLabel + %35 = OpLoad %6 %17 + %37 = OpExtInst %6 %1 SClamp %35 %13 %36 + %38 = OpAccessChain %16 %11 %37 + %39 = OpLoad %6 %38 + OpStore %17 %39 + %40 = OpLoad %6 %18 + %41 = OpIAdd %6 %40 %14 + OpStore %18 %41 + OpBranch %30 + %30 = OpLabel + OpBranch %27 + %29 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %24 %23 %13 %43 + %45 = OpLoad %6 %44 + %46 = OpIEqual %33 %42 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %66 + %47 = OpLabel + %53 = OpAccessChain %24 %23 %13 %13 + %54 = OpLoad %6 %53 + %55 = OpConvertSToF %49 %54 + %56 = OpAccessChain %24 %23 %13 %14 + %57 = OpLoad %6 %56 + %58 = OpConvertSToF %49 %57 + %59 = OpAccessChain %24 %23 %13 %14 + %60 = OpLoad %6 %59 + %61 = OpConvertSToF %49 %60 + %62 = OpAccessChain %24 %23 %13 %13 + %63 = OpLoad %6 %62 + %64 = OpConvertSToF %49 %63 + %65 = OpCompositeConstruct %50 %55 %58 %61 %64 + OpStore %52 %65 + OpBranch %48 + %66 = OpLabel + %67 = OpAccessChain %24 %23 %13 %14 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %49 %68 + %70 = OpCompositeConstruct %50 %69 %69 %69 %69 + OpStore %52 %70 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-replace-output-color-restore-original.amber b/vulkan/amber/graphicsfuzz/cov-loop-replace-output-color-restore-original.amber new file mode 100644 index 0000000..5487ddf --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-replace-output-color-restore-original.amber @@ -0,0 +1,223 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of zero: 0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, 1); +# int a = 1; +# +# // Iterates until a reaches seven. +# do +# { +# if(a++ >= 7) +# { +# break; +# } +# +# // v = (1, 0, 0, 1) +# vec4 v = _GLF_color; +# +# // The original value is always restored below. +# _GLF_color = vec4(a); +# +# // Always true. +# if(gl_FragCoord.x >= 0.0) +# { +# _GLF_color = v; +# } +# } +# while(_int_1 > zero); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 70 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %32 "a" + OpName %46 "v" + OpName %52 "gl_FragCoord" + OpName %64 "buf1" + OpMemberName %64 0 "zero" + OpName %66 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %52 BuiltIn FragCoord + OpMemberDecorate %64 0 Offset 0 + OpDecorate %64 Block + OpDecorate %66 DescriptorSet 0 + OpDecorate %66 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpConstant %10 1 + %29 = OpConstant %6 1 + %31 = OpTypePointer Function %10 + %39 = OpConstant %10 7 + %40 = OpTypeBool + %45 = OpTypePointer Function %7 + %51 = OpTypePointer Input %7 + %52 = OpVariable %51 Input + %53 = OpConstant %11 0 + %54 = OpTypePointer Input %6 + %57 = OpConstant %6 0 + %64 = OpTypeStruct %10 + %65 = OpTypePointer Uniform %64 + %66 = OpVariable %65 Uniform + %4 = OpFunction %2 None %3 + %5 = OpLabel + %32 = OpVariable %31 Function + %46 = OpVariable %45 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %23 = OpAccessChain %18 %16 %17 %22 + %24 = OpLoad %10 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpAccessChain %18 %16 %17 %22 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %30 = OpCompositeConstruct %7 %21 %25 %28 %29 + OpStore %9 %30 + OpStore %32 %22 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %34 + %34 = OpLabel + %37 = OpLoad %10 %32 + %38 = OpIAdd %10 %37 %22 + OpStore %32 %38 + %41 = OpSGreaterThanEqual %40 %37 %39 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %43 + %42 = OpLabel + OpBranch %35 + %43 = OpLabel + %47 = OpLoad %7 %9 + OpStore %46 %47 + %48 = OpLoad %10 %32 + %49 = OpConvertSToF %6 %48 + %50 = OpCompositeConstruct %7 %49 %49 %49 %49 + OpStore %9 %50 + %55 = OpAccessChain %54 %52 %53 + %56 = OpLoad %6 %55 + %58 = OpFOrdGreaterThanEqual %40 %56 %57 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %60 + %59 = OpLabel + %61 = OpLoad %7 %46 + OpStore %9 %61 + OpBranch %60 + %60 = OpLabel + OpBranch %36 + %36 = OpLabel + %62 = OpAccessChain %18 %16 %17 %17 + %63 = OpLoad %10 %62 + %67 = OpAccessChain %18 %66 %17 + %68 = OpLoad %10 %67 + %69 = OpSGreaterThan %40 %63 %68 + OpBranchConditional %69 %33 %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 STD140 DATA + 0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-returns-behind-true-and-false.amber b/vulkan/amber/graphicsfuzz/cov-loop-returns-behind-true-and-false.amber new file mode 100644 index 0000000..e92ad7a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-returns-behind-true-and-false.amber @@ -0,0 +1,228 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 100; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# switch(_int_1) +# { +# case 0: +# if (true) +# { +# _GLF_color = vec4(_int_0); +# return; +# } +# case 1: +# if (true) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# if (false) +# { +# _GLF_color = vec4(_int_1); +# +# do +# { +# _GLF_global_loop_count++; +# +# if (false) +# { +# return; +# } +# if (true) +# { +# return; +# } +# } +# while (_GLF_global_loop_count < _GLF_global_loop_bound); +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 74 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %29 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %29 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %29 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypePointer Uniform %6 + %22 = OpTypeBool + %23 = OpConstantTrue %22 + %26 = OpTypeFloat 32 + %27 = OpTypeVector %26 4 + %28 = OpTypePointer Output %27 + %29 = OpVariable %28 Output + %30 = OpConstant %6 1 + %51 = OpConstantFalse %22 + %71 = OpConstant %6 100 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %8 %9 + %17 = OpAccessChain %16 %15 %9 %9 + %18 = OpLoad %6 %17 + OpSelectionMerge %21 None + OpSwitch %18 %21 0 %19 1 %20 + %19 = OpLabel + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + %31 = OpAccessChain %16 %15 %9 %30 + %32 = OpLoad %6 %31 + %33 = OpConvertSToF %26 %32 + %34 = OpCompositeConstruct %27 %33 %33 %33 %33 + OpStore %29 %34 + OpReturn + %25 = OpLabel + OpBranch %20 + %20 = OpLabel + OpSelectionMerge %37 None + OpBranchConditional %23 %36 %37 + %36 = OpLabel + %38 = OpAccessChain %16 %15 %9 %9 + %39 = OpLoad %6 %38 + %40 = OpConvertSToF %26 %39 + %41 = OpAccessChain %16 %15 %9 %30 + %42 = OpLoad %6 %41 + %43 = OpConvertSToF %26 %42 + %44 = OpAccessChain %16 %15 %9 %30 + %45 = OpLoad %6 %44 + %46 = OpConvertSToF %26 %45 + %47 = OpAccessChain %16 %15 %9 %9 + %48 = OpLoad %6 %47 + %49 = OpConvertSToF %26 %48 + %50 = OpCompositeConstruct %27 %40 %43 %46 %49 + OpStore %29 %50 + OpSelectionMerge %53 None + OpBranchConditional %51 %52 %53 + %52 = OpLabel + %54 = OpAccessChain %16 %15 %9 %9 + %55 = OpLoad %6 %54 + %56 = OpConvertSToF %26 %55 + %57 = OpCompositeConstruct %27 %56 %56 %56 %56 + OpStore %29 %57 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %59 + %59 = OpLabel + %62 = OpLoad %6 %8 + %63 = OpIAdd %6 %62 %30 + OpStore %8 %63 + OpSelectionMerge %65 None + OpBranchConditional %51 %64 %65 + %64 = OpLabel + OpReturn + %65 = OpLabel + OpSelectionMerge %68 None + OpBranchConditional %23 %67 %68 + %67 = OpLabel + OpReturn + %68 = OpLabel + OpBranch %61 + %61 = OpLabel + %70 = OpLoad %6 %8 + %72 = OpSLessThan %22 %70 %71 + OpBranchConditional %72 %58 %60 + %60 = OpLabel + OpBranch %53 + %53 = OpLabel + OpBranch %37 + %37 = OpLabel + OpBranch %21 + %21 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-sampled-texel-integer-counter.amber b/vulkan/amber/graphicsfuzz/cov-loop-sampled-texel-integer-counter.amber new file mode 100644 index 0000000..cb13f2a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-sampled-texel-integer-counter.amber @@ -0,0 +1,312 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_4 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 4] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(set = 0, binding = 2) uniform sampler2D tex; +# +# // Contents of zero: 0.0 +# layout(set = 0, binding = 3) uniform buf3 +# { +# float zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = 0; +# float f = texture(tex, vec2(_float_1_0)).y; +# +# // Sampled texel components are always <= 1. The loop will run until i is four. +# while(f <= _float_1_0 && i < 4) +# { +# // Always false. +# if(zero < _float_0_0) +# { +# continue; +# } +# +# i++; +# } +# +# // Always true. +# if(i == _int_4) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 94 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %75 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "i" + OpName %12 "f" + OpName %16 "tex" + OpName %21 "buf0" + OpMemberName %21 0 "_GLF_uniform_float_values" + OpName %23 "" + OpName %47 "buf3" + OpMemberName %47 0 "zero" + OpName %49 "" + OpName %64 "buf1" + OpMemberName %64 0 "_GLF_uniform_int_values" + OpName %66 "" + OpName %75 "_GLF_color" + OpDecorate %16 RelaxedPrecision + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 2 + OpDecorate %17 RelaxedPrecision + OpDecorate %20 ArrayStride 16 + OpMemberDecorate %21 0 Offset 0 + OpDecorate %21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 0 + OpDecorate %28 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpMemberDecorate %47 0 Offset 0 + OpDecorate %47 Block + OpDecorate %49 DescriptorSet 0 + OpDecorate %49 Binding 3 + OpDecorate %63 ArrayStride 16 + OpMemberDecorate %64 0 Offset 0 + OpDecorate %64 Block + OpDecorate %66 DescriptorSet 0 + OpDecorate %66 Binding 1 + OpDecorate %75 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypePointer Function %10 + %13 = OpTypeImage %10 2D 0 0 0 1 Unknown + %14 = OpTypeSampledImage %13 + %15 = OpTypePointer UniformConstant %14 + %16 = OpVariable %15 UniformConstant + %18 = OpTypeInt 32 0 + %19 = OpConstant %18 2 + %20 = OpTypeArray %10 %19 + %21 = OpTypeStruct %20 + %22 = OpTypePointer Uniform %21 + %23 = OpVariable %22 Uniform + %24 = OpTypePointer Uniform %10 + %27 = OpTypeVector %10 2 + %29 = OpTypeVector %10 4 + %31 = OpConstant %18 1 + %41 = OpTypeBool + %44 = OpConstant %6 4 + %47 = OpTypeStruct %10 + %48 = OpTypePointer Uniform %47 + %49 = OpVariable %48 Uniform + %52 = OpConstant %6 1 + %62 = OpConstant %18 3 + %63 = OpTypeArray %6 %62 + %64 = OpTypeStruct %63 + %65 = OpTypePointer Uniform %64 + %66 = OpVariable %65 Uniform + %67 = OpConstant %6 2 + %68 = OpTypePointer Uniform %6 + %74 = OpTypePointer Output %29 + %75 = OpVariable %74 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %12 = OpVariable %11 Function + OpStore %8 %9 + %17 = OpLoad %14 %16 + %25 = OpAccessChain %24 %23 %9 %9 + %26 = OpLoad %10 %25 + %28 = OpCompositeConstruct %27 %26 %26 + %30 = OpImageSampleImplicitLod %29 %17 %28 + %32 = OpCompositeExtract %10 %30 1 + OpStore %12 %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %10 %12 + %39 = OpAccessChain %24 %23 %9 %9 + %40 = OpLoad %10 %39 + %42 = OpFOrdLessThanEqual %41 %38 %40 + %43 = OpLoad %6 %8 + %45 = OpSLessThan %41 %43 %44 + %46 = OpLogicalAnd %41 %42 %45 + OpBranchConditional %46 %34 %35 + %34 = OpLabel + %50 = OpAccessChain %24 %49 %9 + %51 = OpLoad %10 %50 + %53 = OpAccessChain %24 %23 %9 %52 + %54 = OpLoad %10 %53 + %55 = OpFOrdLessThan %41 %51 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %57 + %56 = OpLabel + OpBranch %36 + %57 = OpLabel + %59 = OpLoad %6 %8 + %60 = OpIAdd %6 %59 %52 + OpStore %8 %60 + OpBranch %36 + %36 = OpLabel + OpBranch %33 + %35 = OpLabel + %61 = OpLoad %6 %8 + %69 = OpAccessChain %68 %66 %9 %67 + %70 = OpLoad %6 %69 + %71 = OpIEqual %41 %61 %70 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %89 + %72 = OpLabel + %76 = OpAccessChain %68 %66 %9 %9 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %10 %77 + %79 = OpAccessChain %68 %66 %9 %52 + %80 = OpLoad %6 %79 + %81 = OpConvertSToF %10 %80 + %82 = OpAccessChain %68 %66 %9 %52 + %83 = OpLoad %6 %82 + %84 = OpConvertSToF %10 %83 + %85 = OpAccessChain %68 %66 %9 %9 + %86 = OpLoad %6 %85 + %87 = OpConvertSToF %10 %86 + %88 = OpCompositeConstruct %29 %78 %81 %84 %87 + OpStore %75 %88 + OpBranch %73 + %89 = OpLabel + %90 = OpAccessChain %68 %66 %9 %52 + %91 = OpLoad %6 %90 + %92 = OpConvertSToF %10 %91 + %93 = OpCompositeConstruct %29 %92 %92 %92 %92 + OpStore %75 %93 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# tex +SAMPLER variant_tex + +# zero +BUFFER variant_zero DATA_TYPE float STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 4 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 3 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-set-vector-components-pow-two.amber b/vulkan/amber/graphicsfuzz/cov-loop-set-vector-components-pow-two.amber new file mode 100644 index 0000000..f62ca5c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-set-vector-components-pow-two.amber @@ -0,0 +1,274 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _float_4_0 _GLF_uniform_float_values[0] +# #define _float_16_0 _GLF_uniform_float_values[1] +# #define _float_1_0 _GLF_uniform_float_values[2] +# #define _float_0_0 _GLF_uniform_float_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [4.0, 16.0, 1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[4]; +# }; +# +# // Contents of two: 2.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float two; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec3 v = vec3(_float_1_0); +# v.y = two; +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# while(true) +# { +# } +# } +# +# // i = 1: v.y becomes v.y * v.y = 2 * 2 = 4 +# // i = 2: v.z becomes v.y * v.y = 4 * 4 = 16 +# for(int i = 1; i < 3; i ++) +# { +# // Always true. +# if(v[i] >= _float_1_0) +# { +# v[i] = v[1] * v[1]; +# } +# } +# +# // Always true. +# if(v == vec3(_float_1_0, _float_4_0, _float_16_0)) +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# else +# { +# _GLF_color = vec4(0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 98 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 %92 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %23 "buf1" + OpMemberName %23 0 "two" + OpName %25 "" + OpName %33 "gl_FragCoord" + OpName %52 "i" + OpName %92 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 1 + OpDecorate %33 BuiltIn FragCoord + OpDecorate %92 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 4 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpConstant %16 2 + %19 = OpTypePointer Uniform %6 + %23 = OpTypeStruct %6 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %28 = OpConstant %10 1 + %29 = OpTypePointer Function %6 + %31 = OpTypeVector %6 4 + %32 = OpTypePointer Input %31 + %33 = OpVariable %32 Input + %34 = OpConstant %10 0 + %35 = OpTypePointer Input %6 + %38 = OpConstant %16 3 + %41 = OpTypeBool + %50 = OpConstantTrue %41 + %51 = OpTypePointer Function %16 + %53 = OpConstant %16 1 + %86 = OpTypeVector %41 3 + %91 = OpTypePointer Output %31 + %92 = OpVariable %91 Output + %93 = OpConstant %6 1 + %94 = OpConstant %6 0 + %95 = OpConstantComposite %31 %93 %94 %94 %93 + %97 = OpConstantComposite %31 %94 %94 %94 %94 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %52 = OpVariable %51 Function + %20 = OpAccessChain %19 %15 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpCompositeConstruct %7 %21 %21 %21 + OpStore %9 %22 + %26 = OpAccessChain %19 %25 %17 + %27 = OpLoad %6 %26 + %30 = OpAccessChain %29 %9 %28 + OpStore %30 %27 + %36 = OpAccessChain %35 %33 %34 + %37 = OpLoad %6 %36 + %39 = OpAccessChain %19 %15 %17 %38 + %40 = OpLoad %6 %39 + %42 = OpFOrdLessThan %41 %37 %40 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %44 + %43 = OpLabel + OpBranch %45 + %45 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %49 + %49 = OpLabel + OpBranchConditional %50 %46 %47 + %46 = OpLabel + OpBranch %48 + %48 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %44 + %44 = OpLabel + OpStore %52 %53 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %16 %52 + %60 = OpSLessThan %41 %59 %38 + OpBranchConditional %60 %55 %56 + %55 = OpLabel + %61 = OpLoad %16 %52 + %62 = OpAccessChain %29 %9 %61 + %63 = OpLoad %6 %62 + %64 = OpAccessChain %19 %15 %17 %18 + %65 = OpLoad %6 %64 + %66 = OpFOrdGreaterThanEqual %41 %63 %65 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %68 + %67 = OpLabel + %69 = OpLoad %16 %52 + %70 = OpAccessChain %29 %9 %28 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %29 %9 %28 + %73 = OpLoad %6 %72 + %74 = OpFMul %6 %71 %73 + %75 = OpAccessChain %29 %9 %69 + OpStore %75 %74 + OpBranch %68 + %68 = OpLabel + OpBranch %57 + %57 = OpLabel + %76 = OpLoad %16 %52 + %77 = OpIAdd %16 %76 %53 + OpStore %52 %77 + OpBranch %54 + %56 = OpLabel + %78 = OpLoad %7 %9 + %79 = OpAccessChain %19 %15 %17 %18 + %80 = OpLoad %6 %79 + %81 = OpAccessChain %19 %15 %17 %17 + %82 = OpLoad %6 %81 + %83 = OpAccessChain %19 %15 %17 %53 + %84 = OpLoad %6 %83 + %85 = OpCompositeConstruct %7 %80 %82 %84 + %87 = OpFOrdEqual %86 %78 %85 + %88 = OpAll %41 %87 + OpSelectionMerge %90 None + OpBranchConditional %88 %89 %96 + %89 = OpLabel + OpStore %92 %95 + OpBranch %90 + %96 = OpLabel + OpStore %92 %97 + OpBranch %90 + %90 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE float STD140 DATA + 2.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 4.0 16.0 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-start-fragcoord-while-iterates-once.amber b/vulkan/amber/graphicsfuzz/cov-loop-start-fragcoord-while-iterates-once.amber new file mode 100644 index 0000000..39f9faf --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-start-fragcoord-while-iterates-once.amber @@ -0,0 +1,287 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 10, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = -1; +# int b = _int_0; +# +# // i starts at -1. +# for(int i = (gl_FragCoord.y > _float_0_0) ? a : 1; i < _int_1 && b < _int_10; i++) +# { +# int c = _int_0; +# +# // Iterates once. +# while(c != _int_1) +# { +# b++; +# c = _int_1; +# } +# } +# +# // Always true. +# if(a == -_int_1 && b == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 112 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %25 %93 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %10 "b" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %21 "i" + OpName %25 "gl_FragCoord" + OpName %31 "buf0" + OpMemberName %31 0 "_GLF_uniform_float_values" + OpName %33 "" + OpName %59 "c" + OpName %93 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %25 BuiltIn FragCoord + OpDecorate %30 ArrayStride 16 + OpMemberDecorate %31 0 Offset 0 + OpDecorate %31 Block + OpDecorate %33 DescriptorSet 0 + OpDecorate %33 Binding 0 + OpDecorate %93 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 -1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 4 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpTypePointer Uniform %6 + %22 = OpTypeFloat 32 + %23 = OpTypeVector %22 4 + %24 = OpTypePointer Input %23 + %25 = OpVariable %24 Input + %26 = OpConstant %11 1 + %27 = OpTypePointer Input %22 + %30 = OpTypeArray %22 %26 + %31 = OpTypeStruct %30 + %32 = OpTypePointer Uniform %31 + %33 = OpVariable %32 Uniform + %34 = OpTypePointer Uniform %22 + %37 = OpTypeBool + %40 = OpConstant %6 1 + %54 = OpConstant %6 2 + %85 = OpConstant %6 3 + %92 = OpTypePointer Output %23 + %93 = OpVariable %92 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %21 = OpVariable %7 Function + %59 = OpVariable %7 Function + OpStore %8 %9 + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %6 %19 + OpStore %10 %20 + %28 = OpAccessChain %27 %25 %26 + %29 = OpLoad %22 %28 + %35 = OpAccessChain %34 %33 %17 %17 + %36 = OpLoad %22 %35 + %38 = OpFOrdGreaterThan %37 %29 %36 + %39 = OpLoad %6 %8 + %41 = OpSelect %6 %38 %39 %40 + OpStore %21 %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %47 = OpLoad %6 %21 + %48 = OpAccessChain %18 %16 %17 %40 + %49 = OpLoad %6 %48 + %50 = OpSLessThan %37 %47 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %52 + %51 = OpLabel + %53 = OpLoad %6 %10 + %55 = OpAccessChain %18 %16 %17 %54 + %56 = OpLoad %6 %55 + %57 = OpSLessThan %37 %53 %56 + OpBranch %52 + %52 = OpLabel + %58 = OpPhi %37 %50 %46 %57 %51 + OpBranchConditional %58 %43 %44 + %43 = OpLabel + %60 = OpAccessChain %18 %16 %17 %17 + %61 = OpLoad %6 %60 + OpStore %59 %61 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpLoad %6 %59 + %68 = OpAccessChain %18 %16 %17 %40 + %69 = OpLoad %6 %68 + %70 = OpINotEqual %37 %67 %69 + OpBranchConditional %70 %63 %64 + %63 = OpLabel + %71 = OpLoad %6 %10 + %72 = OpIAdd %6 %71 %40 + OpStore %10 %72 + %73 = OpAccessChain %18 %16 %17 %40 + %74 = OpLoad %6 %73 + OpStore %59 %74 + OpBranch %65 + %65 = OpLabel + OpBranch %62 + %64 = OpLabel + OpBranch %45 + %45 = OpLabel + %75 = OpLoad %6 %21 + %76 = OpIAdd %6 %75 %40 + OpStore %21 %76 + OpBranch %42 + %44 = OpLabel + %77 = OpLoad %6 %8 + %78 = OpAccessChain %18 %16 %17 %40 + %79 = OpLoad %6 %78 + %80 = OpSNegate %6 %79 + %81 = OpIEqual %37 %77 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %83 + %82 = OpLabel + %84 = OpLoad %6 %10 + %86 = OpAccessChain %18 %16 %17 %85 + %87 = OpLoad %6 %86 + %88 = OpIEqual %37 %84 %87 + OpBranch %83 + %83 = OpLabel + %89 = OpPhi %37 %81 %44 %88 %82 + OpSelectionMerge %91 None + OpBranchConditional %89 %90 %107 + %90 = OpLabel + %94 = OpAccessChain %18 %16 %17 %40 + %95 = OpLoad %6 %94 + %96 = OpConvertSToF %22 %95 + %97 = OpAccessChain %18 %16 %17 %17 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %22 %98 + %100 = OpAccessChain %18 %16 %17 %17 + %101 = OpLoad %6 %100 + %102 = OpConvertSToF %22 %101 + %103 = OpAccessChain %18 %16 %17 %40 + %104 = OpLoad %6 %103 + %105 = OpConvertSToF %22 %104 + %106 = OpCompositeConstruct %23 %96 %99 %102 %105 + OpStore %93 %106 + OpBranch %91 + %107 = OpLabel + %108 = OpAccessChain %18 %16 %17 %17 + %109 = OpLoad %6 %108 + %110 = OpConvertSToF %22 %109 + %111 = OpCompositeConstruct %23 %110 %110 %110 %110 + OpStore %93 %111 + OpBranch %91 + %91 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 10 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-start-from-one-switch-case-invalid-color-never-executed.amber b/vulkan/amber/graphicsfuzz/cov-loop-start-from-one-switch-case-invalid-color-never-executed.amber new file mode 100644 index 0000000..e4c5eaa --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-start-from-one-switch-case-invalid-color-never-executed.amber @@ -0,0 +1,199 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [10, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# for(int i = 1; i < _int_10; i++) +# { +# // Always true. +# if(i > 0) +# { +# } +# else +# { +# // Never executed. +# switch(i) +# { +# case - 1: +# _GLF_color = vec4(_int_0); +# break; +# case 0: +# _GLF_color = vec4(_int_1); +# return; +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %35 "i" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 3 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpConstant %10 1 + %19 = OpTypePointer Uniform %10 + %23 = OpConstant %10 2 + %34 = OpTypePointer Function %10 + %44 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %35 = OpVariable %34 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %10 %20 + %22 = OpConvertSToF %6 %21 + %24 = OpAccessChain %19 %16 %17 %23 + %25 = OpLoad %10 %24 + %26 = OpConvertSToF %6 %25 + %27 = OpAccessChain %19 %16 %17 %23 + %28 = OpLoad %10 %27 + %29 = OpConvertSToF %6 %28 + %30 = OpAccessChain %19 %16 %17 %18 + %31 = OpLoad %10 %30 + %32 = OpConvertSToF %6 %31 + %33 = OpCompositeConstruct %7 %22 %26 %29 %32 + OpStore %9 %33 + OpStore %35 %18 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %10 %35 + %42 = OpAccessChain %19 %16 %17 %17 + %43 = OpLoad %10 %42 + %45 = OpSLessThan %44 %41 %43 + OpBranchConditional %45 %37 %38 + %37 = OpLabel + %46 = OpLoad %10 %35 + %47 = OpSGreaterThan %44 %46 %17 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %50 + %48 = OpLabel + OpBranch %49 + %50 = OpLabel + %51 = OpLoad %10 %35 + OpSelectionMerge %54 None + OpSwitch %51 %54 -1 %52 0 %53 + %52 = OpLabel + %55 = OpAccessChain %19 %16 %17 %23 + %56 = OpLoad %10 %55 + %57 = OpConvertSToF %6 %56 + %58 = OpCompositeConstruct %7 %57 %57 %57 %57 + OpStore %9 %58 + OpBranch %54 + %53 = OpLabel + %60 = OpAccessChain %19 %16 %17 %18 + %61 = OpLoad %10 %60 + %62 = OpConvertSToF %6 %61 + %63 = OpCompositeConstruct %7 %62 %62 %62 %62 + OpStore %9 %63 + OpReturn + %54 = OpLabel + OpBranch %49 + %49 = OpLabel + OpBranch %39 + %39 = OpLabel + %66 = OpLoad %10 %35 + %67 = OpIAdd %10 %66 %18 + OpStore %35 %67 + OpBranch %36 + %38 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-start-from-one-switch-case-never-executed.amber b/vulkan/amber/graphicsfuzz/cov-loop-start-from-one-switch-case-never-executed.amber new file mode 100644 index 0000000..90d4329 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-start-from-one-switch-case-never-executed.amber @@ -0,0 +1,215 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [10, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = 1; +# for( i = _int_1; i < _int_10; i++) +# { +# // Always true. +# if(i > 0) +# { +# } +# else +# { +# // Never executed. +# switch(i) +# { +# case - 1: +# break; +# case 0: +# return; +# } +# } +# } +# +# // Always true. +# if(i == _int_10) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %53 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "i" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %53 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %53 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 3 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %6 0 + %17 = OpTypePointer Uniform %6 + %28 = OpTypeBool + %50 = OpTypeFloat 32 + %51 = OpTypeVector %50 4 + %52 = OpTypePointer Output %51 + %53 = OpVariable %52 Output + %57 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %18 = OpAccessChain %17 %15 %16 %9 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %6 %8 + %26 = OpAccessChain %17 %15 %16 %16 + %27 = OpLoad %6 %26 + %29 = OpSLessThan %28 %25 %27 + OpBranchConditional %29 %21 %22 + %21 = OpLabel + %30 = OpLoad %6 %8 + %31 = OpSGreaterThan %28 %30 %16 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %34 + %32 = OpLabel + OpBranch %33 + %34 = OpLabel + %35 = OpLoad %6 %8 + OpSelectionMerge %38 None + OpSwitch %35 %38 -1 %36 0 %37 + %36 = OpLabel + OpBranch %38 + %37 = OpLabel + OpReturn + %38 = OpLabel + OpBranch %33 + %33 = OpLabel + OpBranch %23 + %23 = OpLabel + %42 = OpLoad %6 %8 + %43 = OpIAdd %6 %42 %9 + OpStore %8 %43 + OpBranch %20 + %22 = OpLabel + %44 = OpLoad %6 %8 + %45 = OpAccessChain %17 %15 %16 %16 + %46 = OpLoad %6 %45 + %47 = OpIEqual %28 %44 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %68 + %48 = OpLabel + %54 = OpAccessChain %17 %15 %16 %9 + %55 = OpLoad %6 %54 + %56 = OpConvertSToF %50 %55 + %58 = OpAccessChain %17 %15 %16 %57 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %50 %59 + %61 = OpAccessChain %17 %15 %16 %57 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %50 %62 + %64 = OpAccessChain %17 %15 %16 %9 + %65 = OpLoad %6 %64 + %66 = OpConvertSToF %50 %65 + %67 = OpCompositeConstruct %51 %56 %60 %63 %66 + OpStore %53 %67 + OpBranch %49 + %68 = OpLabel + %69 = OpAccessChain %17 %15 %16 %57 + %70 = OpLoad %6 %69 + %71 = OpConvertSToF %50 %70 + %72 = OpCompositeConstruct %51 %71 %71 %71 %71 + OpStore %53 %72 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-struct-array-field-set-value-self-dependency.amber b/vulkan/amber/graphicsfuzz/cov-loop-struct-array-field-set-value-self-dependency.amber new file mode 100644 index 0000000..0ca2899 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-struct-array-field-set-value-self-dependency.amber @@ -0,0 +1,409 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_7 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 7, 3] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S +# { +# float unused[10]; +# float data[10]; +# }; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# float arr[7] = float[7](1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0); +# +# for(int i = _int_0; i < _int_3; i++) +# { +# // Always true. +# if(gl_FragCoord.x > _float_0_0) +# { +# S s = S(float[10](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0), float[10](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0)); +# +# // Sets s.data elements to zero except for the first element which is kept as one. +# for(int j = _int_0; j < _int_7; j++) +# { +# s.data[s.data[_GLF_MAKE_IN_BOUNDS_INT(_int_1, 10)] > _float_0_0 ? _int_1 : j] = _float_0_0; +# arr[j] = s.data[j]; +# } +# } +# } +# +# // Verify the results and set output to black if failed. +# float ref[7] = float[7](_float_1_0, _float_0_0, _float_0_0, _float_0_0, _float_0_0, _float_0_0, _float_0_0); +# for(int i = _int_0; i < _int_7; i++) +# { +# if(arr[i] != ref[i]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 205 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %55 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %36 "arr" + OpName %40 "i" + OpName %55 "gl_FragCoord" + OpName %62 "buf0" + OpMemberName %62 0 "_GLF_uniform_float_values" + OpName %64 "" + OpName %73 "S" + OpMemberName %73 0 "unused" + OpMemberName %73 1 "data" + OpName %75 "s" + OpName %119 "j" + OpName %162 "ref" + OpName %178 "i" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %55 BuiltIn FragCoord + OpDecorate %61 ArrayStride 16 + OpMemberDecorate %62 0 Offset 0 + OpDecorate %62 Block + OpDecorate %64 DescriptorSet 0 + OpDecorate %64 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 4 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpConstant %10 1 + %33 = OpConstant %11 7 + %34 = OpTypeArray %6 %33 + %35 = OpTypePointer Function %34 + %37 = OpConstant %6 1 + %38 = OpConstantComposite %34 %37 %37 %37 %37 %37 %37 %37 + %39 = OpTypePointer Function %10 + %49 = OpConstant %10 3 + %52 = OpTypeBool + %54 = OpTypePointer Input %7 + %55 = OpVariable %54 Input + %56 = OpConstant %11 0 + %57 = OpTypePointer Input %6 + %60 = OpConstant %11 2 + %61 = OpTypeArray %6 %60 + %62 = OpTypeStruct %61 + %63 = OpTypePointer Uniform %62 + %64 = OpVariable %63 Uniform + %65 = OpTypePointer Uniform %6 + %71 = OpConstant %11 10 + %72 = OpTypeArray %6 %71 + %73 = OpTypeStruct %72 %72 + %74 = OpTypePointer Function %73 + %128 = OpConstant %10 2 + %134 = OpConstant %10 9 + %136 = OpTypePointer Function %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %36 = OpVariable %35 Function + %40 = OpVariable %39 Function + %75 = OpVariable %74 Function + %119 = OpVariable %39 Function + %142 = OpVariable %39 Function + %162 = OpVariable %35 Function + %178 = OpVariable %39 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %23 = OpAccessChain %18 %16 %17 %22 + %24 = OpLoad %10 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpAccessChain %18 %16 %17 %22 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %10 %29 + %31 = OpConvertSToF %6 %30 + %32 = OpCompositeConstruct %7 %21 %25 %28 %31 + OpStore %9 %32 + OpStore %36 %38 + %41 = OpAccessChain %18 %16 %17 %22 + %42 = OpLoad %10 %41 + OpStore %40 %42 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %10 %40 + %50 = OpAccessChain %18 %16 %17 %49 + %51 = OpLoad %10 %50 + %53 = OpSLessThan %52 %48 %51 + OpBranchConditional %53 %44 %45 + %44 = OpLabel + %58 = OpAccessChain %57 %55 %56 + %59 = OpLoad %6 %58 + %66 = OpAccessChain %65 %64 %17 %22 + %67 = OpLoad %6 %66 + %68 = OpFOrdGreaterThan %52 %59 %67 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %70 + %69 = OpLabel + %76 = OpAccessChain %65 %64 %17 %17 + %77 = OpLoad %6 %76 + %78 = OpAccessChain %65 %64 %17 %17 + %79 = OpLoad %6 %78 + %80 = OpAccessChain %65 %64 %17 %17 + %81 = OpLoad %6 %80 + %82 = OpAccessChain %65 %64 %17 %17 + %83 = OpLoad %6 %82 + %84 = OpAccessChain %65 %64 %17 %17 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %65 %64 %17 %17 + %87 = OpLoad %6 %86 + %88 = OpAccessChain %65 %64 %17 %17 + %89 = OpLoad %6 %88 + %90 = OpAccessChain %65 %64 %17 %17 + %91 = OpLoad %6 %90 + %92 = OpAccessChain %65 %64 %17 %17 + %93 = OpLoad %6 %92 + %94 = OpAccessChain %65 %64 %17 %17 + %95 = OpLoad %6 %94 + %96 = OpCompositeConstruct %72 %77 %79 %81 %83 %85 %87 %89 %91 %93 %95 + %97 = OpAccessChain %65 %64 %17 %17 + %98 = OpLoad %6 %97 + %99 = OpAccessChain %65 %64 %17 %17 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %65 %64 %17 %17 + %102 = OpLoad %6 %101 + %103 = OpAccessChain %65 %64 %17 %17 + %104 = OpLoad %6 %103 + %105 = OpAccessChain %65 %64 %17 %17 + %106 = OpLoad %6 %105 + %107 = OpAccessChain %65 %64 %17 %17 + %108 = OpLoad %6 %107 + %109 = OpAccessChain %65 %64 %17 %17 + %110 = OpLoad %6 %109 + %111 = OpAccessChain %65 %64 %17 %17 + %112 = OpLoad %6 %111 + %113 = OpAccessChain %65 %64 %17 %17 + %114 = OpLoad %6 %113 + %115 = OpAccessChain %65 %64 %17 %17 + %116 = OpLoad %6 %115 + %117 = OpCompositeConstruct %72 %98 %100 %102 %104 %106 %108 %110 %112 %114 %116 + %118 = OpCompositeConstruct %73 %96 %117 + OpStore %75 %118 + %120 = OpAccessChain %18 %16 %17 %22 + %121 = OpLoad %10 %120 + OpStore %119 %121 + OpBranch %122 + %122 = OpLabel + OpLoopMerge %124 %125 None + OpBranch %126 + %126 = OpLabel + %127 = OpLoad %10 %119 + %129 = OpAccessChain %18 %16 %17 %128 + %130 = OpLoad %10 %129 + %131 = OpSLessThan %52 %127 %130 + OpBranchConditional %131 %123 %124 + %123 = OpLabel + %132 = OpAccessChain %18 %16 %17 %17 + %133 = OpLoad %10 %132 + %135 = OpExtInst %10 %1 SClamp %133 %17 %134 + %137 = OpAccessChain %136 %75 %22 %135 + %138 = OpLoad %6 %137 + %139 = OpAccessChain %65 %64 %17 %22 + %140 = OpLoad %6 %139 + %141 = OpFOrdGreaterThan %52 %138 %140 + OpSelectionMerge %144 None + OpBranchConditional %141 %143 %147 + %143 = OpLabel + %145 = OpAccessChain %18 %16 %17 %17 + %146 = OpLoad %10 %145 + OpStore %142 %146 + OpBranch %144 + %147 = OpLabel + %148 = OpLoad %10 %119 + OpStore %142 %148 + OpBranch %144 + %144 = OpLabel + %149 = OpLoad %10 %142 + %150 = OpAccessChain %65 %64 %17 %22 + %151 = OpLoad %6 %150 + %152 = OpAccessChain %136 %75 %22 %149 + OpStore %152 %151 + %153 = OpLoad %10 %119 + %154 = OpLoad %10 %119 + %155 = OpAccessChain %136 %75 %22 %154 + %156 = OpLoad %6 %155 + %157 = OpAccessChain %136 %36 %153 + OpStore %157 %156 + OpBranch %125 + %125 = OpLabel + %158 = OpLoad %10 %119 + %159 = OpIAdd %10 %158 %22 + OpStore %119 %159 + OpBranch %122 + %124 = OpLabel + OpBranch %70 + %70 = OpLabel + OpBranch %46 + %46 = OpLabel + %160 = OpLoad %10 %40 + %161 = OpIAdd %10 %160 %22 + OpStore %40 %161 + OpBranch %43 + %45 = OpLabel + %163 = OpAccessChain %65 %64 %17 %17 + %164 = OpLoad %6 %163 + %165 = OpAccessChain %65 %64 %17 %22 + %166 = OpLoad %6 %165 + %167 = OpAccessChain %65 %64 %17 %22 + %168 = OpLoad %6 %167 + %169 = OpAccessChain %65 %64 %17 %22 + %170 = OpLoad %6 %169 + %171 = OpAccessChain %65 %64 %17 %22 + %172 = OpLoad %6 %171 + %173 = OpAccessChain %65 %64 %17 %22 + %174 = OpLoad %6 %173 + %175 = OpAccessChain %65 %64 %17 %22 + %176 = OpLoad %6 %175 + %177 = OpCompositeConstruct %34 %164 %166 %168 %170 %172 %174 %176 + OpStore %162 %177 + %179 = OpAccessChain %18 %16 %17 %22 + %180 = OpLoad %10 %179 + OpStore %178 %180 + OpBranch %181 + %181 = OpLabel + OpLoopMerge %183 %184 None + OpBranch %185 + %185 = OpLabel + %186 = OpLoad %10 %178 + %187 = OpAccessChain %18 %16 %17 %128 + %188 = OpLoad %10 %187 + %189 = OpSLessThan %52 %186 %188 + OpBranchConditional %189 %182 %183 + %182 = OpLabel + %190 = OpLoad %10 %178 + %191 = OpAccessChain %136 %36 %190 + %192 = OpLoad %6 %191 + %193 = OpLoad %10 %178 + %194 = OpAccessChain %136 %162 %193 + %195 = OpLoad %6 %194 + %196 = OpFUnordNotEqual %52 %192 %195 + OpSelectionMerge %198 None + OpBranchConditional %196 %197 %198 + %197 = OpLabel + %199 = OpAccessChain %18 %16 %17 %22 + %200 = OpLoad %10 %199 + %201 = OpConvertSToF %6 %200 + %202 = OpCompositeConstruct %7 %201 %201 %201 %201 + OpStore %9 %202 + OpBranch %198 + %198 = OpLabel + OpBranch %184 + %184 = OpLabel + %203 = OpLoad %10 %178 + %204 = OpIAdd %10 %203 %22 + OpStore %178 %204 + OpBranch %181 + %183 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 7 3 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-switch-discard-never-hit.amber b/vulkan/amber/graphicsfuzz/cov-loop-switch-discard-never-hit.amber new file mode 100644 index 0000000..bdbc1b8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-switch-discard-never-hit.amber @@ -0,0 +1,245 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# // Contents of zero: 0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int zero; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1; +# int b = _int_1; +# +# // Iterated once. +# while(b > _int_0) +# { +# a = b; +# b++; +# +# for(int i = 0; i < 2; i++) +# { +# switch(a) +# { +# // These are never hit because a is 1. +# case 0: +# case 3: +# discard; +# } +# } +# +# // Always true. +# if(zero == _int_0) +# { +# break; +# } +# } +# +# // Always true. +# if(a == _int_1 && b == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %79 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %52 "buf1" + OpMemberName %52 0 "zero" + OpName %54 "" + OpName %79 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpMemberDecorate %52 0 Offset 0 + OpDecorate %52 Block + OpDecorate %54 DescriptorSet 0 + OpDecorate %54 Binding 1 + OpDecorate %79 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %31 = OpTypeBool + %43 = OpConstant %6 2 + %52 = OpTypeStruct %6 + %53 = OpTypePointer Uniform %52 + %54 = OpVariable %53 Uniform + %76 = OpTypeFloat 32 + %77 = OpTypeVector %76 4 + %78 = OpTypePointer Output %77 + %79 = OpVariable %78 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpBranch %23 + %23 = OpLabel + %98 = OpPhi %6 %19 %5 %35 %26 + %101 = OpPhi %6 %19 %5 %98 %26 + %29 = OpAccessChain %17 %14 %15 %15 + %30 = OpLoad %6 %29 + %32 = OpSGreaterThan %31 %98 %30 + OpLoopMerge %25 %26 None + OpBranchConditional %32 %24 %25 + %24 = OpLabel + %35 = OpIAdd %6 %98 %16 + OpBranch %37 + %37 = OpLabel + %99 = OpPhi %6 %15 %24 %51 %40 + %44 = OpSLessThan %31 %99 %43 + OpLoopMerge %39 %40 None + OpBranchConditional %44 %38 %39 + %38 = OpLabel + OpSelectionMerge %47 None + OpSwitch %98 %47 0 %46 3 %46 + %46 = OpLabel + OpTerminateInvocation + %47 = OpLabel + OpBranch %40 + %40 = OpLabel + %51 = OpIAdd %6 %99 %16 + OpBranch %37 + %39 = OpLabel + %55 = OpAccessChain %17 %54 %15 + %56 = OpLoad %6 %55 + %59 = OpIEqual %31 %56 %30 + OpSelectionMerge %61 None + OpBranchConditional %59 %60 %61 + %60 = OpLabel + OpBranch %25 + %61 = OpLabel + OpBranch %26 + %26 = OpLabel + OpBranch %23 + %25 = OpLabel + %103 = OpPhi %6 %98 %23 %35 %60 + %100 = OpPhi %6 %101 %23 %98 %60 + %66 = OpIEqual %31 %100 %19 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %68 + %67 = OpLabel + %70 = OpAccessChain %17 %14 %15 %43 + %71 = OpLoad %6 %70 + %72 = OpIEqual %31 %103 %71 + OpBranch %68 + %68 = OpLabel + %73 = OpPhi %31 %66 %25 %72 %67 + OpSelectionMerge %75 None + OpBranchConditional %73 %74 %93 + %74 = OpLabel + %82 = OpConvertSToF %76 %19 + %85 = OpConvertSToF %76 %30 + %92 = OpCompositeConstruct %77 %82 %85 %85 %82 + OpStore %79 %92 + OpBranch %75 + %93 = OpLabel + %96 = OpConvertSToF %76 %30 + %97 = OpCompositeConstruct %77 %96 %96 %96 %96 + OpStore %79 %97 + OpBranch %75 + %75 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 STD140 DATA + 0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-two-iterators-increment-array-empty-do-while.amber b/vulkan/amber/graphicsfuzz/cov-loop-two-iterators-increment-array-empty-do-while.amber new file mode 100644 index 0000000..c09fc59 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-two-iterators-increment-array-empty-do-while.amber @@ -0,0 +1,302 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[10] = int[10](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1); +# int ref[10] = int[10](_int_1, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_1, _int_1, _int_1); +# int a = 1; +# +# // Iterated six times. +# for(int i = 1; i < 10; i ++) +# { +# if(a > 6) +# { +# break; +# } +# a++; +# arr[i] = 0; +# } +# +# // Exits after the first iteration. +# do +# { +# } +# while(arr[1] == _int_1); +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Verify the results are what's expected. +# for(int i = _int_0; i < _int_10; i ++) +# { +# if(arr[i] != ref[i]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 141 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %99 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %40 "ref" + OpName %64 "a" + OpName %65 "i" + OpName %99 "_GLF_color" + OpName %113 "i" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %99 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 3 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpTypePointer Uniform %6 + %43 = OpConstant %6 1 + %63 = OpTypePointer Function %6 + %72 = OpConstant %6 10 + %73 = OpTypeBool + %76 = OpConstant %6 6 + %96 = OpTypeFloat 32 + %97 = OpTypeVector %96 4 + %98 = OpTypePointer Output %97 + %99 = OpVariable %98 Output + %122 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %40 = OpVariable %10 Function + %64 = OpVariable %63 Function + %65 = OpVariable %63 Function + %113 = OpVariable %63 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %6 %19 + %21 = OpAccessChain %18 %16 %17 %17 + %22 = OpLoad %6 %21 + %23 = OpAccessChain %18 %16 %17 %17 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %18 %16 %17 %17 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %18 %16 %17 %17 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %18 %16 %17 %17 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %18 %16 %17 %17 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %18 %16 %17 %17 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %18 %16 %17 %17 + %38 = OpLoad %6 %37 + %39 = OpCompositeConstruct %9 %20 %22 %24 %26 %28 %30 %32 %34 %36 %38 + OpStore %11 %39 + %41 = OpAccessChain %18 %16 %17 %17 + %42 = OpLoad %6 %41 + %44 = OpAccessChain %18 %16 %17 %43 + %45 = OpLoad %6 %44 + %46 = OpAccessChain %18 %16 %17 %43 + %47 = OpLoad %6 %46 + %48 = OpAccessChain %18 %16 %17 %43 + %49 = OpLoad %6 %48 + %50 = OpAccessChain %18 %16 %17 %43 + %51 = OpLoad %6 %50 + %52 = OpAccessChain %18 %16 %17 %43 + %53 = OpLoad %6 %52 + %54 = OpAccessChain %18 %16 %17 %43 + %55 = OpLoad %6 %54 + %56 = OpAccessChain %18 %16 %17 %17 + %57 = OpLoad %6 %56 + %58 = OpAccessChain %18 %16 %17 %17 + %59 = OpLoad %6 %58 + %60 = OpAccessChain %18 %16 %17 %17 + %61 = OpLoad %6 %60 + %62 = OpCompositeConstruct %9 %42 %45 %47 %49 %51 %53 %55 %57 %59 %61 + OpStore %40 %62 + OpStore %64 %43 + OpStore %65 %43 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %6 %65 + %74 = OpSLessThan %73 %71 %72 + OpBranchConditional %74 %67 %68 + %67 = OpLabel + %75 = OpLoad %6 %64 + %77 = OpSGreaterThan %73 %75 %76 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + OpBranch %68 + %79 = OpLabel + %81 = OpLoad %6 %64 + %82 = OpIAdd %6 %81 %43 + OpStore %64 %82 + %83 = OpLoad %6 %65 + %84 = OpAccessChain %63 %11 %83 + OpStore %84 %17 + OpBranch %69 + %69 = OpLabel + %85 = OpLoad %6 %65 + %86 = OpIAdd %6 %85 %43 + OpStore %65 %86 + OpBranch %66 + %68 = OpLabel + OpBranch %87 + %87 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %88 + %88 = OpLabel + OpBranch %90 + %90 = OpLabel + %91 = OpAccessChain %63 %11 %43 + %92 = OpLoad %6 %91 + %93 = OpAccessChain %18 %16 %17 %17 + %94 = OpLoad %6 %93 + %95 = OpIEqual %73 %92 %94 + OpBranchConditional %95 %87 %89 + %89 = OpLabel + %100 = OpAccessChain %18 %16 %17 %17 + %101 = OpLoad %6 %100 + %102 = OpConvertSToF %96 %101 + %103 = OpAccessChain %18 %16 %17 %43 + %104 = OpLoad %6 %103 + %105 = OpConvertSToF %96 %104 + %106 = OpAccessChain %18 %16 %17 %43 + %107 = OpLoad %6 %106 + %108 = OpConvertSToF %96 %107 + %109 = OpAccessChain %18 %16 %17 %17 + %110 = OpLoad %6 %109 + %111 = OpConvertSToF %96 %110 + %112 = OpCompositeConstruct %97 %102 %105 %108 %111 + OpStore %99 %112 + %114 = OpAccessChain %18 %16 %17 %43 + %115 = OpLoad %6 %114 + OpStore %113 %115 + OpBranch %116 + %116 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %121 = OpLoad %6 %113 + %123 = OpAccessChain %18 %16 %17 %122 + %124 = OpLoad %6 %123 + %125 = OpSLessThan %73 %121 %124 + OpBranchConditional %125 %117 %118 + %117 = OpLabel + %126 = OpLoad %6 %113 + %127 = OpAccessChain %63 %11 %126 + %128 = OpLoad %6 %127 + %129 = OpLoad %6 %113 + %130 = OpAccessChain %63 %40 %129 + %131 = OpLoad %6 %130 + %132 = OpINotEqual %73 %128 %131 + OpSelectionMerge %134 None + OpBranchConditional %132 %133 %134 + %133 = OpLabel + %135 = OpAccessChain %18 %16 %17 %43 + %136 = OpLoad %6 %135 + %137 = OpConvertSToF %96 %136 + %138 = OpCompositeConstruct %97 %137 %137 %137 %137 + OpStore %99 %138 + OpBranch %134 + %134 = OpLabel + OpBranch %119 + %119 = OpLabel + %139 = OpLoad %6 %113 + %140 = OpIAdd %6 %139 %43 + OpStore %113 %140 + OpBranch %116 + %118 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-variable-less-than-itself.amber b/vulkan/amber/graphicsfuzz/cov-loop-variable-less-than-itself.amber new file mode 100644 index 0000000..68875c4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-variable-less-than-itself.amber @@ -0,0 +1,294 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of one: [1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# float one; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1; +# +# do +# { +# _GLF_global_loop_count++; +# +# if(one > _float_0_0) +# { +# // a < a is always false. +# for(a = 0; a < a && _GLF_global_loop_count < _GLF_global_loop_bound; a++) +# { +# _GLF_global_loop_count ++; +# } +# } +# +# // Always false: a is 0. +# if(a + a > _int_1) +# { +# break; +# } +# } +# while(_GLF_global_loop_count < _GLF_global_loop_bound); +# +# // Always true. +# if(a == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 100 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %81 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %11 "a" + OpName %15 "buf1" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %29 "buf2" + OpMemberName %29 0 "one" + OpName %31 "" + OpName %37 "buf0" + OpMemberName %37 0 "_GLF_uniform_float_values" + OpName %39 "" + OpName %81 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 1 + OpMemberDecorate %29 0 Offset 0 + OpDecorate %29 Block + OpDecorate %31 DescriptorSet 0 + OpDecorate %31 Binding 2 + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 0 + OpDecorate %81 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 2 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypePointer Uniform %6 + %26 = OpConstant %6 1 + %28 = OpTypeFloat 32 + %29 = OpTypeStruct %28 + %30 = OpTypePointer Uniform %29 + %31 = OpVariable %30 Uniform + %32 = OpTypePointer Uniform %28 + %35 = OpConstant %12 1 + %36 = OpTypeArray %28 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %42 = OpTypeBool + %55 = OpConstant %6 10 + %79 = OpTypeVector %28 4 + %80 = OpTypePointer Output %79 + %81 = OpVariable %80 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + OpStore %8 %9 + %19 = OpAccessChain %18 %17 %9 %9 + %20 = OpLoad %6 %19 + OpStore %11 %20 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %22 + %22 = OpLabel + %25 = OpLoad %6 %8 + %27 = OpIAdd %6 %25 %26 + OpStore %8 %27 + %33 = OpAccessChain %32 %31 %9 + %34 = OpLoad %28 %33 + %40 = OpAccessChain %32 %39 %9 %9 + %41 = OpLoad %28 %40 + %43 = OpFOrdGreaterThan %42 %34 %41 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %45 + %44 = OpLabel + OpStore %11 %9 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %6 %11 + %52 = OpLoad %6 %11 + %53 = OpSLessThan %42 %51 %52 + %54 = OpLoad %6 %8 + %56 = OpSLessThan %42 %54 %55 + %57 = OpLogicalAnd %42 %53 %56 + OpBranchConditional %57 %47 %48 + %47 = OpLabel + %58 = OpLoad %6 %8 + %59 = OpIAdd %6 %58 %26 + OpStore %8 %59 + OpBranch %49 + %49 = OpLabel + %60 = OpLoad %6 %11 + %61 = OpIAdd %6 %60 %26 + OpStore %11 %61 + OpBranch %46 + %48 = OpLabel + OpBranch %45 + %45 = OpLabel + %62 = OpLoad %6 %11 + %63 = OpLoad %6 %11 + %64 = OpIAdd %6 %62 %63 + %65 = OpAccessChain %18 %17 %9 %9 + %66 = OpLoad %6 %65 + %67 = OpSGreaterThan %42 %64 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %69 + %68 = OpLabel + OpBranch %23 + %69 = OpLabel + OpBranch %24 + %24 = OpLabel + %71 = OpLoad %6 %8 + %72 = OpSLessThan %42 %71 %55 + OpBranchConditional %72 %21 %23 + %23 = OpLabel + %73 = OpLoad %6 %11 + %74 = OpAccessChain %18 %17 %9 %26 + %75 = OpLoad %6 %74 + %76 = OpIEqual %42 %73 %75 + OpSelectionMerge %78 None + OpBranchConditional %76 %77 %95 + %77 = OpLabel + %82 = OpAccessChain %18 %17 %9 %9 + %83 = OpLoad %6 %82 + %84 = OpConvertSToF %28 %83 + %85 = OpAccessChain %18 %17 %9 %26 + %86 = OpLoad %6 %85 + %87 = OpConvertSToF %28 %86 + %88 = OpAccessChain %18 %17 %9 %26 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %28 %89 + %91 = OpAccessChain %18 %17 %9 %9 + %92 = OpLoad %6 %91 + %93 = OpConvertSToF %28 %92 + %94 = OpCompositeConstruct %79 %84 %87 %90 %93 + OpStore %81 %94 + OpBranch %78 + %95 = OpLabel + %96 = OpAccessChain %18 %17 %9 %26 + %97 = OpLoad %6 %96 + %98 = OpConvertSToF %28 %97 + %99 = OpCompositeConstruct %79 %98 %98 %98 %98 + OpStore %81 %99 + OpBranch %78 + %78 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loop-with-two-integers.amber b/vulkan/amber/graphicsfuzz/cov-loop-with-two-integers.amber new file mode 100644 index 0000000..d8cab0a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loop-with-two-integers.amber @@ -0,0 +1,267 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_5 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# // Contents of _GLF_uniform_int_values: [5, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float arr[5] = float[5](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0); +# int i = _int_0; +# +# for(int j = 0; i < _int_5; i++, j++) +# { +# // Always false. +# if(j < -1) +# { +# break; +# } +# +# arr[j] += 1.0; +# } +# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0); +# for( i = _int_0; i < _int_5; i++) +# { +# // Always false. +# if(arr[i] != 2.0) +# { +# _GLF_color = vec4(_float_0_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 104 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %71 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %32 "i" + OpName %34 "buf1" + OpMemberName %34 0 "_GLF_uniform_int_values" + OpName %36 "" + OpName %41 "j" + OpName %71 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %33 ArrayStride 16 + OpMemberDecorate %34 0 Offset 0 + OpDecorate %34 Block + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 1 + OpDecorate %71 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 5 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 2 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %31 = OpTypePointer Function %17 + %33 = OpTypeArray %17 %12 + %34 = OpTypeStruct %33 + %35 = OpTypePointer Uniform %34 + %36 = OpVariable %35 Uniform + %37 = OpConstant %17 1 + %38 = OpTypePointer Uniform %17 + %50 = OpTypeBool + %53 = OpConstant %17 -1 + %59 = OpConstant %6 1 + %60 = OpTypePointer Function %6 + %69 = OpTypeVector %6 4 + %70 = OpTypePointer Output %69 + %71 = OpVariable %70 Output + %95 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %32 = OpVariable %31 Function + %41 = OpVariable %31 Function + %20 = OpAccessChain %19 %16 %18 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %16 %18 %18 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %19 %16 %18 %18 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %19 %16 %18 %18 + %27 = OpLoad %6 %26 + %28 = OpAccessChain %19 %16 %18 %18 + %29 = OpLoad %6 %28 + %30 = OpCompositeConstruct %9 %21 %23 %25 %27 %29 + OpStore %11 %30 + %39 = OpAccessChain %38 %36 %18 %37 + %40 = OpLoad %17 %39 + OpStore %32 %40 + OpStore %41 %18 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %47 = OpLoad %17 %32 + %48 = OpAccessChain %38 %36 %18 %18 + %49 = OpLoad %17 %48 + %51 = OpSLessThan %50 %47 %49 + OpBranchConditional %51 %43 %44 + %43 = OpLabel + %52 = OpLoad %17 %41 + %54 = OpSLessThan %50 %52 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + OpBranch %44 + %56 = OpLabel + %58 = OpLoad %17 %41 + %61 = OpAccessChain %60 %11 %58 + %62 = OpLoad %6 %61 + %63 = OpFAdd %6 %62 %59 + %64 = OpAccessChain %60 %11 %58 + OpStore %64 %63 + OpBranch %45 + %45 = OpLabel + %65 = OpLoad %17 %32 + %66 = OpIAdd %17 %65 %37 + OpStore %32 %66 + %67 = OpLoad %17 %41 + %68 = OpIAdd %17 %67 %37 + OpStore %41 %68 + OpBranch %42 + %44 = OpLabel + %72 = OpAccessChain %19 %16 %18 %18 + %73 = OpLoad %6 %72 + %74 = OpAccessChain %19 %16 %18 %37 + %75 = OpLoad %6 %74 + %76 = OpAccessChain %19 %16 %18 %37 + %77 = OpLoad %6 %76 + %78 = OpAccessChain %19 %16 %18 %18 + %79 = OpLoad %6 %78 + %80 = OpCompositeConstruct %69 %73 %75 %77 %79 + OpStore %71 %80 + %81 = OpAccessChain %38 %36 %18 %37 + %82 = OpLoad %17 %81 + OpStore %32 %82 + OpBranch %83 + %83 = OpLabel + OpLoopMerge %85 %86 None + OpBranch %87 + %87 = OpLabel + %88 = OpLoad %17 %32 + %89 = OpAccessChain %38 %36 %18 %18 + %90 = OpLoad %17 %89 + %91 = OpSLessThan %50 %88 %90 + OpBranchConditional %91 %84 %85 + %84 = OpLabel + %92 = OpLoad %17 %32 + %93 = OpAccessChain %60 %11 %92 + %94 = OpLoad %6 %93 + %96 = OpFUnordNotEqual %50 %94 %95 + OpSelectionMerge %98 None + OpBranchConditional %96 %97 %98 + %97 = OpLabel + %99 = OpAccessChain %19 %16 %18 %37 + %100 = OpLoad %6 %99 + %101 = OpCompositeConstruct %69 %100 %100 %100 %100 + OpStore %71 %101 + OpBranch %98 + %98 = OpLabel + OpBranch %86 + %86 = OpLabel + %102 = OpLoad %17 %32 + %103 = OpIAdd %17 %102 %37 + OpStore %32 %103 + OpBranch %83 + %85 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 5 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loops-and-conditions-fragcoord-always-false-floats-one.amber b/vulkan/amber/graphicsfuzz/cov-loops-and-conditions-fragcoord-always-false-floats-one.amber new file mode 100644 index 0000000..342e178 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loops-and-conditions-fragcoord-always-false-floats-one.amber @@ -0,0 +1,365 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_256_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 256.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [3, 1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always false. +# if(gl_FragCoord.x < 0.0) +# { +# discard; +# } +# +# float a = _float_1_0; +# float b = _float_1_0; +# float c = _float_1_0; +# vec3 v = vec3(_int_0); +# +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# a++; +# } +# +# // Iterates three times. +# for(int i = _int_0; i < _int_3; i++) +# { +# // Always false. +# if(gl_FragCoord.x < 0.0) +# { +# } +# else +# { +# // Never iterated. +# while(gl_FragCoord.y < 0.0) +# { +# } +# } +# +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# } +# else +# { +# // No effect as b is already one. +# b = 1.0; +# } +# +# // c becomes zero. +# c *= 1.0 - b; +# // No effect: 1 * 256 = 1. +# b *= _float_256_0; +# // v[i] becomes 1 + 0 = 1. +# v[i] = a + c; +# } +# +# // Always true. +# if(v == vec3(_int_1)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 141 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %122 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "gl_FragCoord" + OpName %22 "a" + OpName %25 "buf0" + OpMemberName %25 0 "_GLF_uniform_float_values" + OpName %27 "" + OpName %33 "b" + OpName %36 "c" + OpName %41 "v" + OpName %44 "buf1" + OpMemberName %44 0 "_GLF_uniform_int_values" + OpName %46 "" + OpName %63 "i" + OpName %122 "_GLF_color" + OpDecorate %9 BuiltIn FragCoord + OpDecorate %24 ArrayStride 16 + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 0 + OpDecorate %43 ArrayStride 16 + OpMemberDecorate %44 0 Offset 0 + OpDecorate %44 Block + OpDecorate %46 DescriptorSet 0 + OpDecorate %46 Binding 1 + OpDecorate %122 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Input %7 + %9 = OpVariable %8 Input + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 0 + %12 = OpTypePointer Input %6 + %15 = OpConstant %6 0 + %16 = OpTypeBool + %21 = OpTypePointer Function %6 + %23 = OpConstant %10 2 + %24 = OpTypeArray %6 %23 + %25 = OpTypeStruct %24 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypeInt 32 1 + %29 = OpConstant %28 0 + %30 = OpTypePointer Uniform %6 + %39 = OpTypeVector %6 3 + %40 = OpTypePointer Function %39 + %42 = OpConstant %10 3 + %43 = OpTypeArray %28 %42 + %44 = OpTypeStruct %43 + %45 = OpTypePointer Uniform %44 + %46 = OpVariable %45 Uniform + %47 = OpConstant %28 2 + %48 = OpTypePointer Uniform %28 + %53 = OpConstant %10 1 + %60 = OpConstant %6 1 + %62 = OpTypePointer Function %28 + %99 = OpConstant %28 1 + %116 = OpTypeVector %16 3 + %121 = OpTypePointer Output %7 + %122 = OpVariable %121 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %22 = OpVariable %21 Function + %33 = OpVariable %21 Function + %36 = OpVariable %21 Function + %41 = OpVariable %40 Function + %63 = OpVariable %62 Function + %13 = OpAccessChain %12 %9 %11 + %14 = OpLoad %6 %13 + %17 = OpFOrdLessThan %16 %14 %15 + OpSelectionMerge %19 None + OpBranchConditional %17 %18 %19 + %18 = OpLabel + OpTerminateInvocation + %19 = OpLabel + %31 = OpAccessChain %30 %27 %29 %29 + %32 = OpLoad %6 %31 + OpStore %22 %32 + %34 = OpAccessChain %30 %27 %29 %29 + %35 = OpLoad %6 %34 + OpStore %33 %35 + %37 = OpAccessChain %30 %27 %29 %29 + %38 = OpLoad %6 %37 + OpStore %36 %38 + %49 = OpAccessChain %48 %46 %29 %47 + %50 = OpLoad %28 %49 + %51 = OpConvertSToF %6 %50 + %52 = OpCompositeConstruct %39 %51 %51 %51 + OpStore %41 %52 + %54 = OpAccessChain %12 %9 %53 + %55 = OpLoad %6 %54 + %56 = OpFOrdLessThan %16 %55 %15 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + %59 = OpLoad %6 %22 + %61 = OpFAdd %6 %59 %60 + OpStore %22 %61 + OpBranch %58 + %58 = OpLabel + %64 = OpAccessChain %48 %46 %29 %47 + %65 = OpLoad %28 %64 + OpStore %63 %65 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %28 %63 + %72 = OpAccessChain %48 %46 %29 %29 + %73 = OpLoad %28 %72 + %74 = OpSLessThan %16 %71 %73 + OpBranchConditional %74 %67 %68 + %67 = OpLabel + %75 = OpAccessChain %12 %9 %11 + %76 = OpLoad %6 %75 + %77 = OpFOrdLessThan %16 %76 %15 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %80 + %78 = OpLabel + OpBranch %79 + %80 = OpLabel + OpBranch %81 + %81 = OpLabel + OpLoopMerge %83 %84 None + OpBranch %85 + %85 = OpLabel + %86 = OpAccessChain %12 %9 %53 + %87 = OpLoad %6 %86 + %88 = OpFOrdLessThan %16 %87 %15 + OpBranchConditional %88 %82 %83 + %82 = OpLabel + OpBranch %84 + %84 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %79 + %79 = OpLabel + %89 = OpAccessChain %12 %9 %53 + %90 = OpLoad %6 %89 + %91 = OpFOrdLessThan %16 %90 %15 + OpSelectionMerge %93 None + OpBranchConditional %91 %92 %94 + %92 = OpLabel + OpBranch %93 + %94 = OpLabel + OpStore %33 %60 + OpBranch %93 + %93 = OpLabel + %95 = OpLoad %6 %33 + %96 = OpFSub %6 %60 %95 + %97 = OpLoad %6 %36 + %98 = OpFMul %6 %97 %96 + OpStore %36 %98 + %100 = OpAccessChain %30 %27 %29 %99 + %101 = OpLoad %6 %100 + %102 = OpLoad %6 %33 + %103 = OpFMul %6 %102 %101 + OpStore %33 %103 + %104 = OpLoad %28 %63 + %105 = OpLoad %6 %22 + %106 = OpLoad %6 %36 + %107 = OpFAdd %6 %105 %106 + %108 = OpAccessChain %21 %41 %104 + OpStore %108 %107 + OpBranch %69 + %69 = OpLabel + %109 = OpLoad %28 %63 + %110 = OpIAdd %28 %109 %99 + OpStore %63 %110 + OpBranch %66 + %68 = OpLabel + %111 = OpLoad %39 %41 + %112 = OpAccessChain %48 %46 %29 %99 + %113 = OpLoad %28 %112 + %114 = OpConvertSToF %6 %113 + %115 = OpCompositeConstruct %39 %114 %114 %114 + %117 = OpFOrdEqual %116 %111 %115 + %118 = OpAll %16 %117 + OpSelectionMerge %120 None + OpBranchConditional %118 %119 %136 + %119 = OpLabel + %123 = OpAccessChain %48 %46 %29 %99 + %124 = OpLoad %28 %123 + %125 = OpConvertSToF %6 %124 + %126 = OpAccessChain %48 %46 %29 %47 + %127 = OpLoad %28 %126 + %128 = OpConvertSToF %6 %127 + %129 = OpAccessChain %48 %46 %29 %47 + %130 = OpLoad %28 %129 + %131 = OpConvertSToF %6 %130 + %132 = OpAccessChain %48 %46 %29 %99 + %133 = OpLoad %28 %132 + %134 = OpConvertSToF %6 %133 + %135 = OpCompositeConstruct %7 %125 %128 %131 %134 + OpStore %122 %135 + OpBranch %120 + %136 = OpLabel + %137 = OpAccessChain %48 %46 %29 %47 + %138 = OpLoad %28 %137 + %139 = OpConvertSToF %6 %138 + %140 = OpCompositeConstruct %7 %139 %139 %139 %139 + OpStore %122 %140 + OpBranch %120 + %120 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-loops-same-code-outside-loop.amber b/vulkan/amber/graphicsfuzz/cov-loops-same-code-outside-loop.amber new file mode 100644 index 0000000..1d7e2b9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-loops-same-code-outside-loop.amber @@ -0,0 +1,344 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--if-conversion' +# '--ccp' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--private-to-local' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--ccp' +# '--eliminate-local-multi-store' +# '--eliminate-dead-inserts' +# '--simplify-instructions' +# '--redundancy-elimination' +# '--simplify-instructions' +# '--copy-propagate-arrays' +# '--eliminate-local-single-block' +# '--convert-local-access-chains' +# '--eliminate-local-single-store' +# '--eliminate-dead-code-aggressive' +# '--eliminate-local-single-store' +# '--reduce-load-size' +# '--eliminate-dead-branches' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-return' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-inserts' +# '--eliminate-dead-branches' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_5 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 5, 3] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# ivec4 v = ivec4(_int_5); +# +# // Iterates three times. +# for(int k = 1; k < 4; k++) +# { +# for(int b = 4; b >= k; b--) +# { +# // Always false. +# if(gl_FragCoord.x < 0.0) +# { +# return; +# } +# } +# +# // Always false. +# if(gl_FragCoord.x < 0.0) +# { +# return; +# } +# +# v[_int_1] = _int_1; +# } +# +# // At this point v is (5, 1, 5, 5). +# +# for(int i = _int_1; i >= 0; i--) +# { +# for(int j = _int_3; j >= i + _int_1; j--) +# { +# // This is iterated with (i, j) pairs of (1, 3), (1, 2), (0, 3), (0, 2), (0, 1). +# v[j]--; +# } +# } +# +# // Always true. +# if(v == ivec4(_int_5, _int_0, _int_3, _int_3)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 160 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 %120 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %13 "buf1" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %46 "gl_FragCoord" + OpName %120 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %46 BuiltIn FragCoord + OpDecorate %120 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 4 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %6 0 + %17 = OpConstant %6 2 + %18 = OpTypePointer Uniform %6 + %22 = OpTypePointer Function %6 + %24 = OpConstant %6 1 + %31 = OpConstant %6 4 + %32 = OpTypeBool + %43 = OpTypeFloat 32 + %44 = OpTypeVector %43 4 + %45 = OpTypePointer Input %44 + %46 = OpVariable %45 Input + %47 = OpConstant %10 0 + %48 = OpTypePointer Input %43 + %51 = OpConstant %43 0 + %82 = OpConstant %6 3 + %114 = OpTypeVector %32 4 + %119 = OpTypePointer Output %44 + %120 = OpVariable %119 Output + %152 = OpConstantFalse %32 + %153 = OpTypePointer Function %32 + %155 = OpConstantTrue %32 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %154 = OpVariable %153 Function %152 + %9 = OpVariable %8 Function + OpSelectionMerge %150 None + OpSwitch %47 %151 + %151 = OpLabel + %19 = OpAccessChain %18 %15 %16 %17 + %20 = OpLoad %6 %19 + %21 = OpCompositeConstruct %7 %20 %20 %20 %20 + OpStore %9 %21 + OpBranch %25 + %25 = OpLabel + %144 = OpPhi %6 %24 %151 %70 %28 + %33 = OpSLessThan %32 %144 %31 + OpLoopMerge %27 %28 None + OpBranchConditional %33 %26 %27 + %26 = OpLabel + OpBranch %35 + %35 = OpLabel + %148 = OpPhi %6 %31 %26 %57 %38 + %42 = OpSGreaterThanEqual %32 %148 %144 + OpLoopMerge %37 %38 None + OpBranchConditional %42 %36 %37 + %36 = OpLabel + %49 = OpAccessChain %48 %46 %47 + %50 = OpLoad %43 %49 + %52 = OpFOrdLessThan %32 %50 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + OpStore %154 %155 + OpBranch %37 + %54 = OpLabel + OpBranch %38 + %38 = OpLabel + %57 = OpISub %6 %148 %24 + OpBranch %35 + %37 = OpLabel + %157 = OpLoad %32 %154 + OpSelectionMerge %156 None + OpBranchConditional %157 %27 %156 + %156 = OpLabel + %58 = OpAccessChain %48 %46 %47 + %59 = OpLoad %43 %58 + %60 = OpFOrdLessThan %32 %59 %51 + OpSelectionMerge %62 None + OpBranchConditional %60 %61 %62 + %61 = OpLabel + OpStore %154 %155 + OpBranch %27 + %62 = OpLabel + %64 = OpAccessChain %18 %15 %16 %16 + %65 = OpLoad %6 %64 + %68 = OpAccessChain %22 %9 %65 + OpStore %68 %65 + OpBranch %28 + %28 = OpLabel + %70 = OpIAdd %6 %144 %24 + OpBranch %25 + %27 = OpLabel + %159 = OpLoad %32 %154 + OpSelectionMerge %158 None + OpBranchConditional %159 %150 %158 + %158 = OpLabel + %72 = OpAccessChain %18 %15 %16 %16 + %73 = OpLoad %6 %72 + OpBranch %74 + %74 = OpLabel + %145 = OpPhi %6 %73 %158 %103 %77 + %80 = OpSGreaterThanEqual %32 %145 %16 + OpLoopMerge %76 %77 None + OpBranchConditional %80 %75 %76 + %75 = OpLabel + %83 = OpAccessChain %18 %15 %16 %82 + %84 = OpLoad %6 %83 + OpBranch %85 + %85 = OpLabel + %146 = OpPhi %6 %84 %75 %101 %86 + %94 = OpIAdd %6 %145 %73 + %95 = OpSGreaterThanEqual %32 %146 %94 + OpLoopMerge %87 %86 None + OpBranchConditional %95 %86 %87 + %86 = OpLabel + %97 = OpAccessChain %22 %9 %146 + %98 = OpLoad %6 %97 + %99 = OpISub %6 %98 %24 + OpStore %97 %99 + %101 = OpISub %6 %146 %24 + OpBranch %85 + %87 = OpLabel + OpBranch %77 + %77 = OpLabel + %103 = OpISub %6 %145 %24 + OpBranch %74 + %76 = OpLabel + %104 = OpLoad %7 %9 + %107 = OpAccessChain %18 %15 %16 %24 + %108 = OpLoad %6 %107 + %109 = OpAccessChain %18 %15 %16 %82 + %110 = OpLoad %6 %109 + %113 = OpCompositeConstruct %7 %20 %108 %110 %110 + %115 = OpIEqual %114 %104 %113 + %116 = OpAll %32 %115 + OpSelectionMerge %118 None + OpBranchConditional %116 %117 %134 + %117 = OpLabel + %123 = OpConvertSToF %43 %73 + %126 = OpConvertSToF %43 %108 + %133 = OpCompositeConstruct %44 %123 %126 %126 %123 + OpStore %120 %133 + OpBranch %118 + %134 = OpLabel + %137 = OpConvertSToF %43 %108 + %138 = OpCompositeConstruct %44 %137 %137 %137 %137 + OpStore %120 %138 + OpBranch %118 + %118 = OpLabel + OpStore %154 %155 + OpBranch %150 + %150 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 5 3 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than.amber b/vulkan/amber/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than.amber new file mode 100644 index 0000000..2442671 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than.amber @@ -0,0 +1,337 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific machine basic block code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_5 _GLF_uniform_int_values[1] +# #define _int_4 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# #define _int_2 _GLF_uniform_int_values[4] +# #define _int_0 _GLF_uniform_int_values[5] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# // Contents of _GLF_uniform_int_values: [1, 5, 4, 3, 2, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[6]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# int data[5] = int[5](_int_5, _int_4, _int_3, _int_2, _int_1); +# +# for (int a = _int_0; a < _int_1; a++) +# { +# for (int i = _int_0; i < _int_5; i++) +# { +# for (int j = i; j < _int_5; j++) +# { +# if (data[i] < data[j]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +# } +# +# // Always false. +# while (gl_FragCoord.x < _float_0_0) +# { +# for (int i = _int_0; i < _int_1; i++) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 146 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %114 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %36 "data" + OpName %53 "a" + OpName %66 "i" + OpName %78 "j" + OpName %114 "gl_FragCoord" + OpName %121 "buf0" + OpMemberName %121 0 "_GLF_uniform_float_values" + OpName %123 "" + OpName %128 "i" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %114 BuiltIn FragCoord + OpDecorate %120 ArrayStride 16 + OpMemberDecorate %121 0 Offset 0 + OpDecorate %121 Block + OpDecorate %123 DescriptorSet 0 + OpDecorate %123 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 6 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpConstant %10 5 + %33 = OpConstant %11 5 + %34 = OpTypeArray %10 %33 + %35 = OpTypePointer Function %34 + %37 = OpConstant %10 1 + %40 = OpConstant %10 2 + %43 = OpConstant %10 3 + %46 = OpConstant %10 4 + %52 = OpTypePointer Function %10 + %64 = OpTypeBool + %113 = OpTypePointer Input %7 + %114 = OpVariable %113 Input + %115 = OpConstant %11 0 + %116 = OpTypePointer Input %6 + %119 = OpConstant %11 1 + %120 = OpTypeArray %6 %119 + %121 = OpTypeStruct %120 + %122 = OpTypePointer Uniform %121 + %123 = OpVariable %122 Uniform + %124 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %36 = OpVariable %35 Function + %53 = OpVariable %52 Function + %66 = OpVariable %52 Function + %78 = OpVariable %52 Function + %128 = OpVariable %52 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %23 = OpAccessChain %18 %16 %17 %22 + %24 = OpLoad %10 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpAccessChain %18 %16 %17 %22 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %10 %29 + %31 = OpConvertSToF %6 %30 + %32 = OpCompositeConstruct %7 %21 %25 %28 %31 + OpStore %9 %32 + %38 = OpAccessChain %18 %16 %17 %37 + %39 = OpLoad %10 %38 + %41 = OpAccessChain %18 %16 %17 %40 + %42 = OpLoad %10 %41 + %44 = OpAccessChain %18 %16 %17 %43 + %45 = OpLoad %10 %44 + %47 = OpAccessChain %18 %16 %17 %46 + %48 = OpLoad %10 %47 + %49 = OpAccessChain %18 %16 %17 %17 + %50 = OpLoad %10 %49 + %51 = OpCompositeConstruct %34 %39 %42 %45 %48 %50 + OpStore %36 %51 + %54 = OpAccessChain %18 %16 %17 %22 + %55 = OpLoad %10 %54 + OpStore %53 %55 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %10 %53 + %62 = OpAccessChain %18 %16 %17 %17 + %63 = OpLoad %10 %62 + %65 = OpSLessThan %64 %61 %63 + OpBranchConditional %65 %57 %58 + %57 = OpLabel + %67 = OpAccessChain %18 %16 %17 %22 + %68 = OpLoad %10 %67 + OpStore %66 %68 + OpBranch %69 + %69 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %10 %66 + %75 = OpAccessChain %18 %16 %17 %37 + %76 = OpLoad %10 %75 + %77 = OpSLessThan %64 %74 %76 + OpBranchConditional %77 %70 %71 + %70 = OpLabel + %79 = OpLoad %10 %66 + OpStore %78 %79 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %82 %83 None + OpBranch %84 + %84 = OpLabel + %85 = OpLoad %10 %78 + %86 = OpAccessChain %18 %16 %17 %37 + %87 = OpLoad %10 %86 + %88 = OpSLessThan %64 %85 %87 + OpBranchConditional %88 %81 %82 + %81 = OpLabel + %89 = OpLoad %10 %66 + %90 = OpAccessChain %52 %36 %89 + %91 = OpLoad %10 %90 + %92 = OpLoad %10 %78 + %93 = OpAccessChain %52 %36 %92 + %94 = OpLoad %10 %93 + %95 = OpSLessThan %64 %91 %94 + OpSelectionMerge %97 None + OpBranchConditional %95 %96 %97 + %96 = OpLabel + %98 = OpAccessChain %18 %16 %17 %22 + %99 = OpLoad %10 %98 + %100 = OpConvertSToF %6 %99 + %101 = OpCompositeConstruct %7 %100 %100 %100 %100 + OpStore %9 %101 + OpBranch %97 + %97 = OpLabel + OpBranch %83 + %83 = OpLabel + %102 = OpLoad %10 %78 + %103 = OpIAdd %10 %102 %37 + OpStore %78 %103 + OpBranch %80 + %82 = OpLabel + OpBranch %72 + %72 = OpLabel + %104 = OpLoad %10 %66 + %105 = OpIAdd %10 %104 %37 + OpStore %66 %105 + OpBranch %69 + %71 = OpLabel + OpBranch %59 + %59 = OpLabel + %106 = OpLoad %10 %53 + %107 = OpIAdd %10 %106 %37 + OpStore %53 %107 + OpBranch %56 + %58 = OpLabel + OpBranch %108 + %108 = OpLabel + OpLoopMerge %110 %111 None + OpBranch %112 + %112 = OpLabel + %117 = OpAccessChain %116 %114 %115 + %118 = OpLoad %6 %117 + %125 = OpAccessChain %124 %123 %17 %17 + %126 = OpLoad %6 %125 + %127 = OpFOrdLessThan %64 %118 %126 + OpBranchConditional %127 %109 %110 + %109 = OpLabel + %129 = OpAccessChain %18 %16 %17 %22 + %130 = OpLoad %10 %129 + OpStore %128 %130 + OpBranch %131 + %131 = OpLabel + OpLoopMerge %133 %134 None + OpBranch %135 + %135 = OpLabel + %136 = OpLoad %10 %128 + %137 = OpAccessChain %18 %16 %17 %17 + %138 = OpLoad %10 %137 + %139 = OpSLessThan %64 %136 %138 + OpBranchConditional %139 %132 %133 + %132 = OpLabel + %140 = OpAccessChain %18 %16 %17 %22 + %141 = OpLoad %10 %140 + %142 = OpConvertSToF %6 %141 + %143 = OpCompositeConstruct %7 %142 %142 %142 %142 + OpStore %9 %143 + OpBranch %134 + %134 = OpLabel + %144 = OpLoad %10 %128 + %145 = OpIAdd %10 %144 %37 + OpStore %128 %145 + OpBranch %131 + %133 = OpLabel + OpBranch %111 + %111 = OpLabel + OpBranch %108 + %110 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 5 4 3 2 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-machine-scheduler-for-if-pow.amber b/vulkan/amber/graphicsfuzz/cov-machine-scheduler-for-if-pow.amber new file mode 100644 index 0000000..b580932 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-machine-scheduler-for-if-pow.amber @@ -0,0 +1,302 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific machine scheduler path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_4_0 _GLF_uniform_float_values[1] +# #define _float_1_0 _GLF_uniform_float_values[2] +# #define _float_2_0 _GLF_uniform_float_values[3] +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [10, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 4.0, 1.0, 2.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_v1; +# +# void main() +# { +# vec2 uv = gl_FragCoord.xy; +# vec4 v1 = vec4(_float_0_0); +# if (uv.y >= _float_0_0) +# { +# v1.x = _float_1_0; +# v1.y = _float_0_0; +# v1.z = _float_0_0; +# v1.w = _float_1_0; +# } +# +# float a = _float_1_0; +# for (int i = _int_0; i < _int_10; i++) +# { +# // Always false. +# if (_float_1_0 < _float_0_0) +# { +# discard; +# } +# // a becomes 4. +# a = pow(v1.x + v1.y + v1.z + v1.w, _float_2_0); +# } +# +# if (a == _float_4_0) +# { +# _GLF_v1 = v1; +# } +# else +# { +# _GLF_v1 = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 116 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %109 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "uv" + OpName %12 "gl_FragCoord" + OpName %16 "v1" + OpName %20 "buf1" + OpMemberName %20 0 "_GLF_uniform_float_values" + OpName %22 "" + OpName %55 "a" + OpName %59 "i" + OpName %61 "buf0" + OpMemberName %61 0 "_GLF_uniform_int_values" + OpName %63 "" + OpName %109 "_GLF_v1" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %19 ArrayStride 16 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 1 + OpDecorate %59 RelaxedPrecision + OpDecorate %60 ArrayStride 16 + OpMemberDecorate %61 0 RelaxedPrecision + OpMemberDecorate %61 0 Offset 0 + OpDecorate %61 Block + OpDecorate %63 DescriptorSet 0 + OpDecorate %63 Binding 0 + OpDecorate %67 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %100 RelaxedPrecision + OpDecorate %101 RelaxedPrecision + OpDecorate %109 Location 0 + OpDecorate %113 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypePointer Function %10 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 4 + %19 = OpTypeArray %6 %18 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpTypeInt 32 1 + %24 = OpConstant %23 0 + %25 = OpTypePointer Uniform %6 + %29 = OpConstant %17 1 + %30 = OpTypePointer Function %6 + %35 = OpTypeBool + %39 = OpConstant %23 2 + %42 = OpConstant %17 0 + %49 = OpConstant %17 2 + %53 = OpConstant %17 3 + %58 = OpTypePointer Function %23 + %60 = OpTypeArray %23 %49 + %61 = OpTypeStruct %60 + %62 = OpTypePointer Uniform %61 + %63 = OpVariable %62 Uniform + %64 = OpConstant %23 1 + %65 = OpTypePointer Uniform %23 + %96 = OpConstant %23 3 + %108 = OpTypePointer Output %10 + %109 = OpVariable %108 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %16 = OpVariable %15 Function + %55 = OpVariable %30 Function + %59 = OpVariable %58 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + OpStore %9 %14 + %26 = OpAccessChain %25 %22 %24 %24 + %27 = OpLoad %6 %26 + %28 = OpCompositeConstruct %10 %27 %27 %27 %27 + OpStore %16 %28 + %31 = OpAccessChain %30 %9 %29 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %25 %22 %24 %24 + %34 = OpLoad %6 %33 + %36 = OpFOrdGreaterThanEqual %35 %32 %34 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + %40 = OpAccessChain %25 %22 %24 %39 + %41 = OpLoad %6 %40 + %43 = OpAccessChain %30 %16 %42 + OpStore %43 %41 + %44 = OpAccessChain %25 %22 %24 %24 + %45 = OpLoad %6 %44 + %46 = OpAccessChain %30 %16 %29 + OpStore %46 %45 + %47 = OpAccessChain %25 %22 %24 %24 + %48 = OpLoad %6 %47 + %50 = OpAccessChain %30 %16 %49 + OpStore %50 %48 + %51 = OpAccessChain %25 %22 %24 %39 + %52 = OpLoad %6 %51 + %54 = OpAccessChain %30 %16 %53 + OpStore %54 %52 + OpBranch %38 + %38 = OpLabel + %56 = OpAccessChain %25 %22 %24 %39 + %57 = OpLoad %6 %56 + OpStore %55 %57 + %66 = OpAccessChain %65 %63 %24 %64 + %67 = OpLoad %23 %66 + OpStore %59 %67 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %23 %59 + %74 = OpAccessChain %65 %63 %24 %24 + %75 = OpLoad %23 %74 + %76 = OpSLessThan %35 %73 %75 + OpBranchConditional %76 %69 %70 + %69 = OpLabel + %77 = OpAccessChain %25 %22 %24 %39 + %78 = OpLoad %6 %77 + %79 = OpAccessChain %25 %22 %24 %24 + %80 = OpLoad %6 %79 + %81 = OpFOrdLessThan %35 %78 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %83 + %82 = OpLabel + OpTerminateInvocation + %83 = OpLabel + %85 = OpAccessChain %30 %16 %42 + %86 = OpLoad %6 %85 + %87 = OpAccessChain %30 %16 %29 + %88 = OpLoad %6 %87 + %89 = OpFAdd %6 %86 %88 + %90 = OpAccessChain %30 %16 %49 + %91 = OpLoad %6 %90 + %92 = OpFAdd %6 %89 %91 + %93 = OpAccessChain %30 %16 %53 + %94 = OpLoad %6 %93 + %95 = OpFAdd %6 %92 %94 + %97 = OpAccessChain %25 %22 %24 %96 + %98 = OpLoad %6 %97 + %99 = OpExtInst %6 %1 Pow %95 %98 + OpStore %55 %99 + OpBranch %71 + %71 = OpLabel + %100 = OpLoad %23 %59 + %101 = OpIAdd %23 %100 %64 + OpStore %59 %101 + OpBranch %68 + %70 = OpLabel + %102 = OpLoad %6 %55 + %103 = OpAccessChain %25 %22 %24 %64 + %104 = OpLoad %6 %103 + %105 = OpFOrdEqual %35 %102 %104 + OpSelectionMerge %107 None + OpBranchConditional %105 %106 %111 + %106 = OpLabel + %110 = OpLoad %10 %16 + OpStore %109 %110 + OpBranch %107 + %111 = OpLabel + %112 = OpAccessChain %65 %63 %24 %64 + %113 = OpLoad %23 %112 + %114 = OpConvertSToF %6 %113 + %115 = OpCompositeConstruct %10 %114 %114 %114 %114 + OpStore %109 %115 + OpBranch %107 + %107 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 4.0 1.0 2.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-machinevaluetype-one-iter-loop.amber b/vulkan/amber/graphicsfuzz/cov-machinevaluetype-one-iter-loop.amber new file mode 100644 index 0000000..49be588 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-machinevaluetype-one-iter-loop.amber @@ -0,0 +1,177 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific machine value type code path + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# void main() +# { +# int a = 0; +# for(int i = 0; i < int(injectionSwitch.y); i++) +# { +# if (a > 0) +# { +# break; +# } +# // a becomes 1. +# a = ((int(injectionSwitch.y) * 2) / 2); +# } +# +# if (a == 1) // Always true. +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %50 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %10 "i" + OpName %19 "buf0" + OpMemberName %19 0 "injectionSwitch" + OpName %21 "" + OpName %50 "_GLF_color" + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 0 + OpDecorate %50 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpTypeFloat 32 + %18 = OpTypeVector %17 2 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 1 + %24 = OpTypePointer Uniform %17 + %28 = OpTypeBool + %38 = OpConstant %6 2 + %42 = OpConstant %6 1 + %48 = OpTypeVector %17 4 + %49 = OpTypePointer Output %48 + %50 = OpVariable %49 Output + %51 = OpConstant %17 1 + %52 = OpConstant %17 0 + %53 = OpConstantComposite %48 %51 %52 %52 %51 + %55 = OpConstantComposite %48 %52 %52 %52 %52 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %16 = OpLoad %6 %10 + %25 = OpAccessChain %24 %21 %9 %23 + %26 = OpLoad %17 %25 + %27 = OpConvertFToS %6 %26 + %29 = OpSLessThan %28 %16 %27 + OpBranchConditional %29 %12 %13 + %12 = OpLabel + %30 = OpLoad %6 %8 + %31 = OpSGreaterThan %28 %30 %9 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %33 + %32 = OpLabel + OpBranch %13 + %33 = OpLabel + %35 = OpAccessChain %24 %21 %9 %23 + %36 = OpLoad %17 %35 + %37 = OpConvertFToS %6 %36 + %39 = OpIMul %6 %37 %38 + %40 = OpSDiv %6 %39 %38 + OpStore %8 %40 + OpBranch %14 + %14 = OpLabel + %41 = OpLoad %6 %10 + %43 = OpIAdd %6 %41 %42 + OpStore %10 %43 + OpBranch %11 + %13 = OpLabel + %44 = OpLoad %6 %8 + %45 = OpIEqual %28 %44 %42 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %54 + %46 = OpLabel + OpStore %50 %53 + OpBranch %47 + %54 = OpLabel + OpStore %50 %55 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-matching-conditions-break.amber b/vulkan/amber/graphicsfuzz/cov-matching-conditions-break.amber new file mode 100644 index 0000000..cf53c38 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-matching-conditions-break.amber @@ -0,0 +1,247 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_4 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 4] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# _GLF_color = vec4(_int_0); +# } +# +# for(int i = _int_0; i < _int_4; i++) +# { +# // Always true. +# if(gl_FragCoord.x > 0.0) +# { +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# _GLF_color = vec4(_int_0); +# break; +# } +# } +# +# // Always true. +# if(gl_FragCoord.x > 0.0) +# { +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 94 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %34 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %34 "gl_FragCoord" + OpName %49 "i" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %34 BuiltIn FragCoord + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 3 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpConstant %10 1 + %33 = OpTypePointer Input %7 + %34 = OpVariable %33 Input + %35 = OpConstant %11 1 + %36 = OpTypePointer Input %6 + %39 = OpConstant %6 0 + %40 = OpTypeBool + %48 = OpTypePointer Function %10 + %58 = OpConstant %10 2 + %62 = OpConstant %11 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %49 = OpVariable %48 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %23 = OpAccessChain %18 %16 %17 %22 + %24 = OpLoad %10 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpAccessChain %18 %16 %17 %22 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %10 %29 + %31 = OpConvertSToF %6 %30 + %32 = OpCompositeConstruct %7 %21 %25 %28 %31 + OpStore %9 %32 + %37 = OpAccessChain %36 %34 %35 + %38 = OpLoad %6 %37 + %41 = OpFOrdLessThan %40 %38 %39 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %43 + %42 = OpLabel + %44 = OpAccessChain %18 %16 %17 %22 + %45 = OpLoad %10 %44 + %46 = OpConvertSToF %6 %45 + %47 = OpCompositeConstruct %7 %46 %46 %46 %46 + OpStore %9 %47 + OpBranch %43 + %43 = OpLabel + %50 = OpAccessChain %18 %16 %17 %22 + %51 = OpLoad %10 %50 + OpStore %49 %51 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %10 %49 + %59 = OpAccessChain %18 %16 %17 %58 + %60 = OpLoad %10 %59 + %61 = OpSLessThan %40 %57 %60 + OpBranchConditional %61 %53 %54 + %53 = OpLabel + %63 = OpAccessChain %36 %34 %62 + %64 = OpLoad %6 %63 + %65 = OpFOrdGreaterThan %40 %64 %39 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %67 + %66 = OpLabel + %68 = OpAccessChain %36 %34 %35 + %69 = OpLoad %6 %68 + %70 = OpFOrdLessThan %40 %69 %39 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %72 + %71 = OpLabel + %73 = OpAccessChain %18 %16 %17 %22 + %74 = OpLoad %10 %73 + %75 = OpConvertSToF %6 %74 + %76 = OpCompositeConstruct %7 %75 %75 %75 %75 + OpStore %9 %76 + OpBranch %54 + %72 = OpLabel + OpBranch %67 + %67 = OpLabel + %78 = OpAccessChain %36 %34 %62 + %79 = OpLoad %6 %78 + %80 = OpFOrdGreaterThan %40 %79 %39 + OpSelectionMerge %82 None + OpBranchConditional %80 %81 %82 + %81 = OpLabel + %83 = OpAccessChain %36 %34 %35 + %84 = OpLoad %6 %83 + %85 = OpFOrdLessThan %40 %84 %39 + OpSelectionMerge %87 None + OpBranchConditional %85 %86 %87 + %86 = OpLabel + %88 = OpAccessChain %18 %16 %17 %22 + %89 = OpLoad %10 %88 + %90 = OpConvertSToF %6 %89 + %91 = OpCompositeConstruct %7 %90 %90 %90 %90 + OpStore %9 %91 + OpBranch %87 + %87 = OpLabel + OpBranch %82 + %82 = OpLabel + OpBranch %55 + %55 = OpLabel + %92 = OpLoad %10 %49 + %93 = OpIAdd %10 %92 %22 + OpStore %49 %93 + OpBranch %52 + %54 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 4 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-matching-if-always-true-inside-loop.amber b/vulkan/amber/graphicsfuzz/cov-matching-if-always-true-inside-loop.amber new file mode 100644 index 0000000..4acc231 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-matching-if-always-true-inside-loop.amber @@ -0,0 +1,297 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_4 _GLF_uniform_int_values[1] +# #define _int_3 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_2 _GLF_uniform_int_values[4] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 4, 3, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func(int x) +# { +# int a = _int_0; +# +# for (int i = _int_0; i < _int_4; i++) +# { +# if (int[4](_int_1, _int_1, _int_1, _int_1)[a] > x) +# { +# if (true) +# { +# // We hit this the first time the function is called (x = 0). +# return _int_1; +# } +# else +# { +# a = _int_1; +# } +# } +# else +# { +# if (true) +# { +# // We hit this the second time the function is called (x = 1). +# return _int_2; +# } +# } +# } +# +# return _int_0; +# } +# +# void main() +# { +# // a becomes 1. +# int a = func(_int_0); +# // a becomes 3. +# a += func(_int_1); +# +# if(a == _int_3) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 120 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %101 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func(i1;" + OpName %9 "x" + OpName %12 "a" + OpName %16 "buf0" + OpMemberName %16 0 "_GLF_uniform_int_values" + OpName %18 "" + OpName %23 "i" + OpName %51 "indexable" + OpName %80 "a" + OpName %81 "param" + OpName %85 "param" + OpName %101 "_GLF_color" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %101 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 5 + %15 = OpTypeArray %6 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpConstant %6 0 + %20 = OpTypePointer Uniform %6 + %32 = OpConstant %6 1 + %35 = OpTypeBool + %37 = OpConstant %6 3 + %46 = OpConstant %13 4 + %47 = OpTypeArray %6 %46 + %50 = OpTypePointer Function %47 + %58 = OpConstantTrue %35 + %70 = OpConstant %6 4 + %92 = OpConstant %6 2 + %98 = OpTypeFloat 32 + %99 = OpTypeVector %98 4 + %100 = OpTypePointer Output %99 + %101 = OpVariable %100 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %80 = OpVariable %7 Function + %81 = OpVariable %7 Function + %85 = OpVariable %7 Function + %82 = OpAccessChain %20 %18 %19 %19 + %83 = OpLoad %6 %82 + OpStore %81 %83 + %84 = OpFunctionCall %6 %10 %81 + OpStore %80 %84 + %86 = OpAccessChain %20 %18 %19 %37 + %87 = OpLoad %6 %86 + OpStore %85 %87 + %88 = OpFunctionCall %6 %10 %85 + %89 = OpLoad %6 %80 + %90 = OpIAdd %6 %89 %88 + OpStore %80 %90 + %91 = OpLoad %6 %80 + %93 = OpAccessChain %20 %18 %19 %92 + %94 = OpLoad %6 %93 + %95 = OpIEqual %35 %91 %94 + OpSelectionMerge %97 None + OpBranchConditional %95 %96 %115 + %96 = OpLabel + %102 = OpAccessChain %20 %18 %19 %37 + %103 = OpLoad %6 %102 + %104 = OpConvertSToF %98 %103 + %105 = OpAccessChain %20 %18 %19 %19 + %106 = OpLoad %6 %105 + %107 = OpConvertSToF %98 %106 + %108 = OpAccessChain %20 %18 %19 %19 + %109 = OpLoad %6 %108 + %110 = OpConvertSToF %98 %109 + %111 = OpAccessChain %20 %18 %19 %37 + %112 = OpLoad %6 %111 + %113 = OpConvertSToF %98 %112 + %114 = OpCompositeConstruct %99 %104 %107 %110 %113 + OpStore %101 %114 + OpBranch %97 + %115 = OpLabel + %116 = OpAccessChain %20 %18 %19 %19 + %117 = OpLoad %6 %116 + %118 = OpConvertSToF %98 %117 + %119 = OpCompositeConstruct %99 %118 %118 %118 %118 + OpStore %101 %119 + OpBranch %97 + %97 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %12 = OpVariable %7 Function + %23 = OpVariable %7 Function + %51 = OpVariable %50 Function + %21 = OpAccessChain %20 %18 %19 %19 + %22 = OpLoad %6 %21 + OpStore %12 %22 + %24 = OpAccessChain %20 %18 %19 %19 + %25 = OpLoad %6 %24 + OpStore %23 %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %6 %23 + %33 = OpAccessChain %20 %18 %19 %32 + %34 = OpLoad %6 %33 + %36 = OpSLessThan %35 %31 %34 + OpBranchConditional %36 %27 %28 + %27 = OpLabel + %38 = OpAccessChain %20 %18 %19 %37 + %39 = OpLoad %6 %38 + %40 = OpAccessChain %20 %18 %19 %37 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %20 %18 %19 %37 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %20 %18 %19 %37 + %45 = OpLoad %6 %44 + %48 = OpCompositeConstruct %47 %39 %41 %43 %45 + %49 = OpLoad %6 %12 + OpStore %51 %48 + %52 = OpAccessChain %7 %51 %49 + %53 = OpLoad %6 %52 + %54 = OpLoad %6 %9 + %55 = OpSGreaterThan %35 %53 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %67 + %56 = OpLabel + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %64 + %59 = OpLabel + %61 = OpAccessChain %20 %18 %19 %37 + %62 = OpLoad %6 %61 + OpReturnValue %62 + %64 = OpLabel + %65 = OpAccessChain %20 %18 %19 %37 + %66 = OpLoad %6 %65 + OpStore %12 %66 + OpBranch %60 + %60 = OpLabel + OpBranch %57 + %67 = OpLabel + OpSelectionMerge %69 None + OpBranchConditional %58 %68 %69 + %68 = OpLabel + %71 = OpAccessChain %20 %18 %19 %70 + %72 = OpLoad %6 %71 + OpReturnValue %72 + %69 = OpLabel + OpBranch %57 + %57 = OpLabel + OpBranch %29 + %29 = OpLabel + %74 = OpLoad %6 %23 + %75 = OpIAdd %6 %74 %32 + OpStore %23 %75 + OpBranch %26 + %28 = OpLabel + %76 = OpAccessChain %20 %18 %19 %19 + %77 = OpLoad %6 %76 + OpReturnValue %77 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 4 3 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-matrix-double-transpose.amber b/vulkan/amber/graphicsfuzz/cov-matrix-double-transpose.amber new file mode 100644 index 0000000..f4610e2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-matrix-double-transpose.amber @@ -0,0 +1,181 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat2 m = transpose(transpose(mat2x2(_int_1))); +# +# if(m == mat2x2(_int_1)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 72 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "m" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %52 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeMatrix %7 2 + %9 = OpTypePointer Function %8 + %11 = OpTypeInt 32 1 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 2 + %14 = OpTypeArray %11 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %11 0 + %19 = OpTypePointer Uniform %11 + %23 = OpConstant %6 1 + %24 = OpConstant %6 0 + %37 = OpTypeBool + %40 = OpTypeVector %37 2 + %50 = OpTypeVector %6 4 + %51 = OpTypePointer Output %50 + %52 = OpVariable %51 Output + %56 = OpConstant %11 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %20 = OpAccessChain %19 %17 %18 %18 + %21 = OpLoad %11 %20 + %22 = OpConvertSToF %6 %21 + %25 = OpCompositeConstruct %7 %22 %24 + %26 = OpCompositeConstruct %7 %24 %22 + %27 = OpCompositeConstruct %8 %25 %26 + %28 = OpTranspose %8 %27 + %29 = OpTranspose %8 %28 + OpStore %10 %29 + %30 = OpLoad %8 %10 + %31 = OpAccessChain %19 %17 %18 %18 + %32 = OpLoad %11 %31 + %33 = OpConvertSToF %6 %32 + %34 = OpCompositeConstruct %7 %33 %24 + %35 = OpCompositeConstruct %7 %24 %33 + %36 = OpCompositeConstruct %8 %34 %35 + %38 = OpCompositeExtract %7 %30 0 + %39 = OpCompositeExtract %7 %36 0 + %41 = OpFOrdEqual %40 %38 %39 + %42 = OpAll %37 %41 + %43 = OpCompositeExtract %7 %30 1 + %44 = OpCompositeExtract %7 %36 1 + %45 = OpFOrdEqual %40 %43 %44 + %46 = OpAll %37 %45 + %47 = OpLogicalAnd %37 %42 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %67 + %48 = OpLabel + %53 = OpAccessChain %19 %17 %18 %18 + %54 = OpLoad %11 %53 + %55 = OpConvertSToF %6 %54 + %57 = OpAccessChain %19 %17 %18 %56 + %58 = OpLoad %11 %57 + %59 = OpConvertSToF %6 %58 + %60 = OpAccessChain %19 %17 %18 %56 + %61 = OpLoad %11 %60 + %62 = OpConvertSToF %6 %61 + %63 = OpAccessChain %19 %17 %18 %18 + %64 = OpLoad %11 %63 + %65 = OpConvertSToF %6 %64 + %66 = OpCompositeConstruct %50 %55 %59 %62 %65 + OpStore %52 %66 + OpBranch %49 + %67 = OpLabel + %68 = OpAccessChain %19 %17 %18 %56 + %69 = OpLoad %11 %68 + %70 = OpConvertSToF %6 %69 + %71 = OpCompositeConstruct %50 %70 %70 %70 %70 + OpStore %52 %71 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-matrix-mult-round-even-asinh.amber b/vulkan/amber/graphicsfuzz/cov-matrix-mult-round-even-asinh.amber new file mode 100644 index 0000000..24cfa2c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-matrix-mult-round-even-asinh.amber @@ -0,0 +1,239 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [2, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# // Contents of zero: 0.0 +# layout(push_constant) uniform buf_push +# { +# float zero; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat2 m = mat2(zero); +# // v0 becomes (0, 0). +# vec2 v0 = roundEven(m * gl_FragCoord.xy); +# // v1 becomes (0, 0). +# vec2 v1 = asinh(v0); +# int a = _int_1; +# // Always selects 2. +# int b = isnan(float(a)) ? _int_1 : _int_2; +# +# // Always true. +# if(b == _int_2) +# { +# _GLF_color = vec4(_int_1, v1.x, v1.y, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 91 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %29 %70 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "m" + OpName %11 "buf_push" + OpMemberName %11 0 "zero" + OpName %13 "" + OpName %25 "v0" + OpName %29 "gl_FragCoord" + OpName %34 "v1" + OpName %38 "a" + OpName %42 "buf0" + OpMemberName %42 0 "_GLF_uniform_int_values" + OpName %44 "" + OpName %49 "b" + OpName %70 "_GLF_color" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %29 BuiltIn FragCoord + OpDecorate %41 ArrayStride 16 + OpMemberDecorate %42 0 Offset 0 + OpDecorate %42 Block + OpDecorate %44 DescriptorSet 0 + OpDecorate %44 Binding 0 + OpDecorate %70 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeMatrix %7 2 + %9 = OpTypePointer Function %8 + %11 = OpTypeStruct %6 + %12 = OpTypePointer PushConstant %11 + %13 = OpVariable %12 PushConstant + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypePointer PushConstant %6 + %19 = OpConstant %6 1 + %20 = OpConstant %6 0 + %24 = OpTypePointer Function %7 + %27 = OpTypeVector %6 4 + %28 = OpTypePointer Input %27 + %29 = OpVariable %28 Input + %37 = OpTypePointer Function %14 + %39 = OpTypeInt 32 0 + %40 = OpConstant %39 3 + %41 = OpTypeArray %14 %40 + %42 = OpTypeStruct %41 + %43 = OpTypePointer Uniform %42 + %44 = OpVariable %43 Uniform + %45 = OpConstant %14 1 + %46 = OpTypePointer Uniform %14 + %52 = OpTypeBool + %69 = OpTypePointer Output %27 + %70 = OpVariable %69 Output + %74 = OpConstant %39 0 + %75 = OpTypePointer Function %6 + %78 = OpConstant %39 1 + %86 = OpConstant %14 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %25 = OpVariable %24 Function + %34 = OpVariable %24 Function + %38 = OpVariable %37 Function + %49 = OpVariable %37 Function + %54 = OpVariable %37 Function + %17 = OpAccessChain %16 %13 %15 + %18 = OpLoad %6 %17 + %21 = OpCompositeConstruct %7 %18 %20 + %22 = OpCompositeConstruct %7 %20 %18 + %23 = OpCompositeConstruct %8 %21 %22 + OpStore %10 %23 + %26 = OpLoad %8 %10 + %30 = OpLoad %27 %29 + %31 = OpVectorShuffle %7 %30 %30 0 1 + %32 = OpMatrixTimesVector %7 %26 %31 + %33 = OpExtInst %7 %1 RoundEven %32 + OpStore %25 %33 + %35 = OpLoad %7 %25 + %36 = OpExtInst %7 %1 Asinh %35 + OpStore %34 %36 + %47 = OpAccessChain %46 %44 %15 %45 + %48 = OpLoad %14 %47 + OpStore %38 %48 + %50 = OpLoad %14 %38 + %51 = OpConvertSToF %6 %50 + %53 = OpIsNan %52 %51 + OpSelectionMerge %56 None + OpBranchConditional %53 %55 %59 + %55 = OpLabel + %57 = OpAccessChain %46 %44 %15 %45 + %58 = OpLoad %14 %57 + OpStore %54 %58 + OpBranch %56 + %59 = OpLabel + %60 = OpAccessChain %46 %44 %15 %15 + %61 = OpLoad %14 %60 + OpStore %54 %61 + OpBranch %56 + %56 = OpLabel + %62 = OpLoad %14 %54 + OpStore %49 %62 + %63 = OpLoad %14 %49 + %64 = OpAccessChain %46 %44 %15 %15 + %65 = OpLoad %14 %64 + %66 = OpIEqual %52 %63 %65 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %85 + %67 = OpLabel + %71 = OpAccessChain %46 %44 %15 %45 + %72 = OpLoad %14 %71 + %73 = OpConvertSToF %6 %72 + %76 = OpAccessChain %75 %34 %74 + %77 = OpLoad %6 %76 + %79 = OpAccessChain %75 %34 %78 + %80 = OpLoad %6 %79 + %81 = OpAccessChain %46 %44 %15 %45 + %82 = OpLoad %14 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpCompositeConstruct %27 %73 %77 %80 %83 + OpStore %70 %84 + OpBranch %68 + %85 = OpLabel + %87 = OpAccessChain %46 %44 %15 %86 + %88 = OpLoad %14 %87 + %89 = OpConvertSToF %6 %88 + %90 = OpCompositeConstruct %27 %89 %89 %89 %89 + OpStore %70 %90 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-matrix-square-mul-with-vector.amber b/vulkan/amber/graphicsfuzz/cov-matrix-square-mul-with-vector.amber new file mode 100644 index 0000000..f1112ce --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-matrix-square-mul-with-vector.amber @@ -0,0 +1,184 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat2 m0 = mat2(_float_1_0, - cos(1.0), cos(1.0), _float_1_0); +# mat2 m1 = m0 * m0; +# vec2 v = vec2(_float_1_0) * m1; +# +# // Always true. +# if(v.x < _float_1_0) +# { +# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0); +# } +# else +# { +# _GLF_color = vec4(_float_0_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 69 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %54 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "m0" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %31 "m1" + OpName %36 "v" + OpName %54 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %54 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeMatrix %7 2 + %9 = OpTypePointer Function %8 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 -0.540302277 + %23 = OpConstant %6 0.540302277 + %26 = OpConstant %6 1 + %27 = OpConstant %6 0 + %35 = OpTypePointer Function %7 + %42 = OpConstant %11 0 + %43 = OpTypePointer Function %6 + %48 = OpTypeBool + %52 = OpTypeVector %6 4 + %53 = OpTypePointer Output %52 + %54 = OpVariable %53 Output + %57 = OpConstant %17 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %31 = OpVariable %9 Function + %36 = OpVariable %35 Function + %20 = OpAccessChain %19 %16 %18 %18 + %21 = OpLoad %6 %20 + %24 = OpAccessChain %19 %16 %18 %18 + %25 = OpLoad %6 %24 + %28 = OpCompositeConstruct %7 %21 %22 + %29 = OpCompositeConstruct %7 %23 %25 + %30 = OpCompositeConstruct %8 %28 %29 + OpStore %10 %30 + %32 = OpLoad %8 %10 + %33 = OpLoad %8 %10 + %34 = OpMatrixTimesMatrix %8 %32 %33 + OpStore %31 %34 + %37 = OpAccessChain %19 %16 %18 %18 + %38 = OpLoad %6 %37 + %39 = OpCompositeConstruct %7 %38 %38 + %40 = OpLoad %8 %31 + %41 = OpVectorTimesMatrix %7 %39 %40 + OpStore %36 %41 + %44 = OpAccessChain %43 %36 %42 + %45 = OpLoad %6 %44 + %46 = OpAccessChain %19 %16 %18 %18 + %47 = OpLoad %6 %46 + %49 = OpFOrdLessThan %48 %45 %47 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %65 + %50 = OpLabel + %55 = OpAccessChain %19 %16 %18 %18 + %56 = OpLoad %6 %55 + %58 = OpAccessChain %19 %16 %18 %57 + %59 = OpLoad %6 %58 + %60 = OpAccessChain %19 %16 %18 %57 + %61 = OpLoad %6 %60 + %62 = OpAccessChain %19 %16 %18 %18 + %63 = OpLoad %6 %62 + %64 = OpCompositeConstruct %52 %56 %59 %61 %63 + OpStore %54 %64 + OpBranch %51 + %65 = OpLabel + %66 = OpAccessChain %19 %16 %18 %57 + %67 = OpLoad %6 %66 + %68 = OpCompositeConstruct %52 %67 %67 %67 %67 + OpStore %54 %68 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-max-clamp-same-minval.amber b/vulkan/amber/graphicsfuzz/cov-max-clamp-same-minval.amber new file mode 100644 index 0000000..bbd7972 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-max-clamp-same-minval.amber @@ -0,0 +1,135 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction simplification path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# void main() +# { +# if(max(one, clamp(one, one, 1)) == 1) +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# else +# { +# _GLF_color = vec4(1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %28 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "buf0" + OpMemberName %7 0 "one" + OpName %9 "" + OpName %28 "_GLF_color" + OpMemberDecorate %7 0 Offset 0 + OpDecorate %7 Block + OpDecorate %9 DescriptorSet 0 + OpDecorate %9 Binding 0 + OpDecorate %28 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Uniform %7 + %9 = OpVariable %8 Uniform + %10 = OpConstant %6 0 + %11 = OpTypePointer Uniform %6 + %18 = OpConstant %6 1 + %21 = OpTypeBool + %25 = OpTypeFloat 32 + %26 = OpTypeVector %25 4 + %27 = OpTypePointer Output %26 + %28 = OpVariable %27 Output + %29 = OpConstant %25 1 + %30 = OpConstant %25 0 + %31 = OpConstantComposite %26 %29 %30 %30 %29 + %33 = OpConstantComposite %26 %29 %29 %29 %29 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpAccessChain %11 %9 %10 + %13 = OpLoad %6 %12 + %14 = OpAccessChain %11 %9 %10 + %15 = OpLoad %6 %14 + %16 = OpAccessChain %11 %9 %10 + %17 = OpLoad %6 %16 + %19 = OpExtInst %6 %1 SClamp %15 %17 %18 + %20 = OpExtInst %6 %1 SMax %13 %19 + %22 = OpIEqual %21 %20 %18 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %32 + %23 = OpLabel + OpStore %28 %31 + OpBranch %24 + %32 = OpLabel + OpStore %28 %33 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-max-min-less-than.amber b/vulkan/amber/graphicsfuzz/cov-max-min-less-than.amber new file mode 100644 index 0000000..08d2331 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-max-min-less-than.amber @@ -0,0 +1,165 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine select code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // a becomes 1. +# int a = max(1, min(1, int(gl_FragCoord.x))); +# +# if (a < 2) +# { +# _GLF_color = vec4(1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 %29 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %13 "gl_FragCoord" + OpName %29 "_GLF_color" + OpName %33 "buf0" + OpMemberName %33 0 "_GLF_uniform_int_values" + OpName %35 "" + OpDecorate %13 BuiltIn FragCoord + OpDecorate %29 Location 0 + OpDecorate %32 ArrayStride 16 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Input %11 + %13 = OpVariable %12 Input + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 0 + %16 = OpTypePointer Input %10 + %23 = OpConstant %6 2 + %24 = OpTypeBool + %28 = OpTypePointer Output %11 + %29 = OpVariable %28 Output + %30 = OpConstant %10 1 + %31 = OpConstant %14 2 + %32 = OpTypeArray %6 %31 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpConstant %6 0 + %37 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %17 = OpAccessChain %16 %13 %15 + %18 = OpLoad %10 %17 + %19 = OpConvertFToS %6 %18 + %20 = OpExtInst %6 %1 SMin %9 %19 + %21 = OpExtInst %6 %1 SMax %9 %20 + OpStore %8 %21 + %22 = OpLoad %6 %8 + %25 = OpSLessThan %24 %22 %23 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %48 + %26 = OpLabel + %38 = OpAccessChain %37 %35 %36 %36 + %39 = OpLoad %6 %38 + %40 = OpConvertSToF %10 %39 + %41 = OpAccessChain %37 %35 %36 %36 + %42 = OpLoad %6 %41 + %43 = OpConvertSToF %10 %42 + %44 = OpAccessChain %37 %35 %36 %9 + %45 = OpLoad %6 %44 + %46 = OpConvertSToF %10 %45 + %47 = OpCompositeConstruct %11 %30 %40 %43 %46 + OpStore %29 %47 + OpBranch %27 + %48 = OpLabel + %49 = OpAccessChain %37 %35 %36 %9 + %50 = OpLoad %6 %49 + %51 = OpConvertSToF %10 %50 + %52 = OpCompositeConstruct %11 %51 %51 %51 %51 + OpStore %29 %52 + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-mem-pass-sum-struct-members.amber b/vulkan/amber/graphicsfuzz/cov-mem-pass-sum-struct-members.amber new file mode 100644 index 0000000..b3ff834 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-mem-pass-sum-struct-members.amber @@ -0,0 +1,330 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific mem pass code path. + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--redundancy-elimination' +# '--eliminate-dead-inserts' +# '--private-to-local' +# '--redundancy-elimination' +# '--eliminate-local-multi-store' +# '--if-conversion' +# '--scalar-replacement=100' +# '--combine-access-chains' +# '--reduce-load-size' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-block' +# '--if-conversion' +# '--private-to-local' +# '--eliminate-dead-inserts' +# '--copy-propagate-arrays' +# '--inline-entry-points-exhaustive' +# '--copy-propagate-arrays' +# '--convert-local-access-chains' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# struct S +# { +# int a; +# int b; +# int c; +# }; +# +# int func(S s, int x) +# { +# s.a = x; +# +# // Always false. +# if(s.a == 2) +# s.a = 9; +# +# s.b = x + 1; +# s.c = x + 2; +# +# // Always false. +# if(s.b == 2) +# s.b = 7; +# +# return s.a + s.b + s.c; +# } +# +# void main() +# { +# S arr[2]; +# arr[one].a = 2; +# +# // Always false. +# if(arr[1].a < 1) +# { +# _GLF_color = vec4(0); +# return; +# } +# else +# { +# if (func(arr[1], 2 + one) == 12) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 136 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %71 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "S" + OpMemberName %7 0 "a" + OpMemberName %7 1 "b" + OpMemberName %7 2 "c" + OpName %13 "func(struct-S-i1-i1-i11;i1;" + OpName %11 "s" + OpName %12 "x" + OpName %55 "arr" + OpName %56 "buf0" + OpMemberName %56 0 "one" + OpName %58 "" + OpName %71 "_GLF_color" + OpName %79 "param" + OpName %82 "param" + OpMemberDecorate %56 0 Offset 0 + OpDecorate %56 Block + OpDecorate %58 DescriptorSet 0 + OpDecorate %58 Binding 0 + OpDecorate %71 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypePointer Function %6 + %10 = OpTypeFunction %6 %8 %9 + %15 = OpConstant %6 0 + %20 = OpConstant %6 2 + %21 = OpTypeBool + %25 = OpConstant %6 9 + %27 = OpConstant %6 1 + %39 = OpConstant %6 7 + %51 = OpTypeInt 32 0 + %52 = OpConstant %51 2 + %53 = OpTypeArray %7 %52 + %54 = OpTypePointer Function %53 + %56 = OpTypeStruct %6 + %57 = OpTypePointer Uniform %56 + %58 = OpVariable %57 Uniform + %59 = OpTypePointer Uniform %6 + %68 = OpTypeFloat 32 + %69 = OpTypeVector %68 4 + %70 = OpTypePointer Output %69 + %71 = OpVariable %70 Output + %72 = OpConstant %68 0 + %73 = OpConstantComposite %69 %72 %72 %72 %72 + %84 = OpConstant %6 12 + %88 = OpConstant %68 1 + %89 = OpConstantComposite %69 %88 %72 %72 %88 + %95 = OpConstantFalse %21 + %96 = OpTypePointer Function %21 + %98 = OpConstantTrue %21 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %99 = OpVariable %9 Function + %97 = OpVariable %96 Function %95 + %55 = OpVariable %54 Function + %79 = OpVariable %8 Function + %82 = OpVariable %9 Function + OpBranch %92 + %92 = OpLabel + OpLoopMerge %91 %94 None + OpBranch %93 + %93 = OpLabel + %60 = OpAccessChain %59 %58 %15 + %61 = OpLoad %6 %60 + %62 = OpAccessChain %9 %55 %61 %15 + OpStore %62 %20 + %63 = OpAccessChain %9 %55 %27 %15 + %64 = OpLoad %6 %63 + %65 = OpSLessThan %21 %64 %27 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %75 + %66 = OpLabel + OpStore %71 %73 + OpStore %97 %98 + OpBranch %91 + %75 = OpLabel + %78 = OpIAdd %6 %20 %61 + %80 = OpAccessChain %8 %55 %27 + %81 = OpLoad %7 %80 + OpStore %79 %81 + OpStore %82 %78 + %100 = OpLoad %6 %82 + %101 = OpAccessChain %9 %79 %15 + %121 = OpLoad %7 %79 + %122 = OpCompositeInsert %7 %100 %121 0 + OpStore %79 %122 + %123 = OpLoad %7 %79 + %102 = OpCompositeExtract %6 %123 0 + %103 = OpIEqual %21 %102 %20 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + %124 = OpLoad %7 %79 + %125 = OpCompositeInsert %7 %25 %124 0 + OpStore %79 %125 + OpBranch %104 + %104 = OpLabel + %106 = OpLoad %6 %82 + %107 = OpIAdd %6 %106 %27 + %108 = OpAccessChain %9 %79 %27 + %126 = OpLoad %7 %79 + %127 = OpCompositeInsert %7 %107 %126 1 + OpStore %79 %127 + %109 = OpLoad %6 %82 + %110 = OpIAdd %6 %109 %20 + %111 = OpAccessChain %9 %79 %20 + %128 = OpLoad %7 %79 + %129 = OpCompositeInsert %7 %110 %128 2 + OpStore %79 %129 + %130 = OpLoad %7 %79 + %112 = OpCompositeExtract %6 %130 1 + %113 = OpIEqual %21 %112 %20 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %114 + %115 = OpLabel + %131 = OpLoad %7 %79 + %132 = OpCompositeInsert %7 %39 %131 1 + OpStore %79 %132 + OpBranch %114 + %114 = OpLabel + %133 = OpLoad %7 %79 + %116 = OpCompositeExtract %6 %133 0 + %134 = OpLoad %7 %79 + %117 = OpCompositeExtract %6 %134 1 + %118 = OpIAdd %6 %116 %117 + %135 = OpLoad %7 %79 + %119 = OpCompositeExtract %6 %135 2 + %120 = OpIAdd %6 %118 %119 + OpStore %99 %120 + %83 = OpLoad %6 %99 + %85 = OpIEqual %21 %83 %84 + OpSelectionMerge %87 None + OpBranchConditional %85 %86 %90 + %86 = OpLabel + OpStore %71 %89 + OpBranch %87 + %90 = OpLabel + OpStore %71 %73 + OpBranch %87 + %87 = OpLabel + OpBranch %67 + %67 = OpLabel + OpStore %97 %98 + OpBranch %91 + %94 = OpLabel + OpBranch %92 + %91 = OpLabel + OpReturn + OpFunctionEnd + %13 = OpFunction %6 None %10 + %11 = OpFunctionParameter %8 + %12 = OpFunctionParameter %9 + %14 = OpLabel + %16 = OpLoad %6 %12 + %17 = OpAccessChain %9 %11 %15 + OpStore %17 %16 + %19 = OpLoad %6 %17 + %22 = OpIEqual %21 %19 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + OpStore %17 %25 + OpBranch %24 + %24 = OpLabel + %28 = OpLoad %6 %12 + %29 = OpIAdd %6 %28 %27 + %30 = OpAccessChain %9 %11 %27 + OpStore %30 %29 + %31 = OpLoad %6 %12 + %32 = OpIAdd %6 %31 %20 + %33 = OpAccessChain %9 %11 %20 + OpStore %33 %32 + %35 = OpLoad %6 %30 + %36 = OpIEqual %21 %35 %20 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + OpStore %30 %39 + OpBranch %38 + %38 = OpLabel + %42 = OpLoad %6 %17 + %44 = OpLoad %6 %30 + %45 = OpIAdd %6 %42 %44 + %47 = OpLoad %6 %33 + %48 = OpIAdd %6 %45 %47 + OpReturnValue %48 + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-mem-pass-unused-component.amber b/vulkan/amber/graphicsfuzz/cov-mem-pass-unused-component.amber new file mode 100644 index 0000000..d074727 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-mem-pass-unused-component.amber @@ -0,0 +1,169 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific mem pass code path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# float two; +# }; +# +# float func(vec2 v) +# { +# // Never used in this function. +# v.x = two; +# +# // Always false. +# if(v.y < 1.0) +# return 1.0; +# +# return 5.0; +# } +# +# void main() +# { +# float f = func(vec2(1)); +# +# if (f == 5.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "func(vf2;" + OpName %10 "v" + OpName %13 "buf0" + OpMemberName %13 0 "two" + OpName %15 "" + OpName %37 "f" + OpName %39 "param" + OpName %47 "_GLF_color" + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %47 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %6 %8 + %13 = OpTypeStruct %6 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %6 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Function %6 + %25 = OpConstant %21 1 + %28 = OpConstant %6 1 + %29 = OpTypeBool + %34 = OpConstant %6 5 + %38 = OpConstantComposite %7 %28 %28 + %45 = OpTypeVector %6 4 + %46 = OpTypePointer Output %45 + %47 = OpVariable %46 Output + %48 = OpConstant %6 0 + %49 = OpConstantComposite %45 %28 %48 %48 %28 + %51 = OpConstantComposite %45 %48 %48 %48 %48 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %37 = OpVariable %23 Function + %39 = OpVariable %8 Function + OpStore %39 %38 + %40 = OpFunctionCall %6 %11 %39 + OpStore %37 %40 + %41 = OpLoad %6 %37 + %42 = OpFOrdEqual %29 %41 %34 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %50 + %43 = OpLabel + OpStore %47 %49 + OpBranch %44 + %50 = OpLabel + OpStore %47 %51 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %6 None %9 + %10 = OpFunctionParameter %8 + %12 = OpLabel + %19 = OpAccessChain %18 %15 %17 + %20 = OpLoad %6 %19 + %24 = OpAccessChain %23 %10 %22 + OpStore %24 %20 + %26 = OpAccessChain %23 %10 %25 + %27 = OpLoad %6 %26 + %30 = OpFOrdLessThan %29 %27 %28 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + OpReturnValue %28 + %32 = OpLabel + OpReturnValue %34 + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE float DATA + 2.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-merge-return-condition-twice.amber b/vulkan/amber/graphicsfuzz/cov-merge-return-condition-twice.amber new file mode 100644 index 0000000..718a931 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-merge-return-condition-twice.amber @@ -0,0 +1,195 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific return merge path. + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--private-to-local' +# '--eliminate-local-single-block' +# '--eliminate-local-single-block' +# '--if-conversion' +# '--eliminate-local-multi-store' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# float three; +# }; +# +# // Always returns 1.0. +# float func() +# { +# float b = 2.0; +# +# do +# { +# // Always false. +# if (three == 0.0) +# break; +# +# // Always false. +# if (three == 0.0) +# return 1.0; +# +# b = 1.0; +# } +# while(false); +# +# return b; +# } +# +# void main() +# { +# if (func() == 1.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 54 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %48 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "b" + OpName %17 "buf0" + OpMemberName %17 0 "three" + OpName %19 "" + OpName %48 "_GLF_color" + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %48 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 2 + %17 = OpTypeStruct %6 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypeInt 32 1 + %21 = OpConstant %20 0 + %22 = OpTypePointer Uniform %6 + %25 = OpConstant %6 0 + %26 = OpTypeBool + %36 = OpConstant %6 1 + %38 = OpConstantFalse %26 + %46 = OpTypeVector %6 4 + %47 = OpTypePointer Output %46 + %48 = OpVariable %47 Output + %49 = OpConstantComposite %46 %36 %25 %25 %36 + %51 = OpConstantComposite %46 %25 %25 %25 %25 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %42 = OpFunctionCall %6 %8 + %43 = OpFOrdEqual %26 %42 %36 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %50 + %44 = OpLabel + OpStore %48 %49 + OpBranch %45 + %50 = OpLabel + OpStore %48 %51 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + OpStore %11 %12 + OpBranch %13 + %13 = OpLabel + %53 = OpPhi %6 %12 %9 %36 %16 + OpLoopMerge %15 %16 None + OpBranch %14 + %14 = OpLabel + %23 = OpAccessChain %22 %19 %21 + %24 = OpLoad %6 %23 + %27 = OpFOrdEqual %26 %24 %25 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %29 + %28 = OpLabel + OpBranch %15 + %29 = OpLabel + %31 = OpAccessChain %22 %19 %21 + %32 = OpLoad %6 %31 + %33 = OpFOrdEqual %26 %32 %25 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %35 + %34 = OpLabel + OpReturnValue %36 + %35 = OpLabel + OpStore %11 %36 + OpBranch %16 + %16 = OpLabel + OpBranchConditional %38 %13 %15 + %15 = OpLabel + %52 = OpPhi %6 %53 %28 %36 %16 + OpReturnValue %52 + OpFunctionEnd +END + +# uniforms for variant + +# three +BUFFER variant_three DATA_TYPE float DATA + 3.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_three AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-min-identical-uint-uniform-check-highest-bit.amber b/vulkan/amber/graphicsfuzz/cov-min-identical-uint-uniform-check-highest-bit.amber new file mode 100644 index 0000000..600a367 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-min-identical-uint-uniform-check-highest-bit.amber @@ -0,0 +1,146 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# uint one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Simplifies to min(0, 0) = 0. +# uint a = min(((one & 0x80000000u) != 0u ? 1u : 0u), (one & 0x80000000u) != 0u ? 1u : 0u); +# +# // Always true. +# if (a == 0u) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %37 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %9 "buf0" + OpMemberName %9 0 "one" + OpName %11 "" + OpName %37 "_GLF_color" + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 Block + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 0 + OpDecorate %37 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpTypeStruct %6 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpTypePointer Uniform %6 + %17 = OpConstant %6 2147483648 + %19 = OpConstant %6 0 + %20 = OpTypeBool + %22 = OpConstant %6 1 + %34 = OpTypeFloat 32 + %35 = OpTypeVector %34 4 + %36 = OpTypePointer Output %35 + %37 = OpVariable %36 Output + %38 = OpConstant %34 1 + %39 = OpConstant %34 0 + %40 = OpConstantComposite %35 %38 %39 %39 %38 + %42 = OpConstantComposite %35 %39 %39 %39 %39 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %15 = OpAccessChain %14 %11 %13 + %16 = OpLoad %6 %15 + %18 = OpBitwiseAnd %6 %16 %17 + %21 = OpINotEqual %20 %18 %19 + %23 = OpSelect %6 %21 %22 %19 + %24 = OpAccessChain %14 %11 %13 + %25 = OpLoad %6 %24 + %26 = OpBitwiseAnd %6 %25 %17 + %27 = OpINotEqual %20 %26 %19 + %28 = OpSelect %6 %27 %22 %19 + %29 = OpExtInst %6 %1 UMin %23 %28 + OpStore %8 %29 + %30 = OpLoad %6 %8 + %31 = OpIEqual %20 %30 %19 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %41 + %32 = OpLabel + OpStore %37 %40 + OpBranch %33 + %41 = OpLabel + OpStore %37 %42 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE uint32 STD140 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-min-identical-uint-uniform.amber b/vulkan/amber/graphicsfuzz/cov-min-identical-uint-uniform.amber new file mode 100644 index 0000000..90cc9e6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-min-identical-uint-uniform.amber @@ -0,0 +1,255 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _uint_1 _GLF_uniform_uint_values[0] +# #define _uint_0 _GLF_uniform_uint_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_uint_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# uint _GLF_uniform_uint_values[2]; +# }; +# +# // Contents of one: 1 +# layout(set = 0, binding = 2) uniform buf2 +# { +# uint one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Simplifies to min((1 & 1 != 0 ? 1 : 0) / 1, 1 & 1 != 0 ? 1 : 0) = min(1 / 1, 1) = 1. +# uint a = min(((one & _uint_1) != _uint_0 ? _uint_1 : _uint_0) / one, (one & _uint_1) != _uint_0 ? _uint_1 : _uint_0); +# +# // Always true. +# if(a == _uint_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 93 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %69 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %9 "buf2" + OpMemberName %9 0 "one" + OpName %11 "" + OpName %19 "buf1" + OpMemberName %19 0 "_GLF_uniform_uint_values" + OpName %21 "" + OpName %69 "_GLF_color" + OpName %71 "buf0" + OpMemberName %71 0 "_GLF_uniform_int_values" + OpName %73 "" + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 Block + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 2 + OpDecorate %18 ArrayStride 16 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 1 + OpDecorate %69 Location 0 + OpDecorate %70 ArrayStride 16 + OpMemberDecorate %71 0 Offset 0 + OpDecorate %71 Block + OpDecorate %73 DescriptorSet 0 + OpDecorate %73 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpTypeStruct %6 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpTypePointer Uniform %6 + %17 = OpConstant %6 2 + %18 = OpTypeArray %6 %17 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %25 = OpConstant %12 1 + %28 = OpTypeBool + %66 = OpTypeFloat 32 + %67 = OpTypeVector %66 4 + %68 = OpTypePointer Output %67 + %69 = OpVariable %68 Output + %70 = OpTypeArray %12 %17 + %71 = OpTypeStruct %70 + %72 = OpTypePointer Uniform %71 + %73 = OpVariable %72 Uniform + %74 = OpTypePointer Uniform %12 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %30 = OpVariable %7 Function + %50 = OpVariable %7 Function + %15 = OpAccessChain %14 %11 %13 + %16 = OpLoad %6 %15 + %22 = OpAccessChain %14 %21 %13 %13 + %23 = OpLoad %6 %22 + %24 = OpBitwiseAnd %6 %16 %23 + %26 = OpAccessChain %14 %21 %13 %25 + %27 = OpLoad %6 %26 + %29 = OpINotEqual %28 %24 %27 + OpSelectionMerge %32 None + OpBranchConditional %29 %31 %35 + %31 = OpLabel + %33 = OpAccessChain %14 %21 %13 %13 + %34 = OpLoad %6 %33 + OpStore %30 %34 + OpBranch %32 + %35 = OpLabel + %36 = OpAccessChain %14 %21 %13 %25 + %37 = OpLoad %6 %36 + OpStore %30 %37 + OpBranch %32 + %32 = OpLabel + %38 = OpLoad %6 %30 + %39 = OpAccessChain %14 %11 %13 + %40 = OpLoad %6 %39 + %41 = OpUDiv %6 %38 %40 + %42 = OpAccessChain %14 %11 %13 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %14 %21 %13 %13 + %45 = OpLoad %6 %44 + %46 = OpBitwiseAnd %6 %43 %45 + %47 = OpAccessChain %14 %21 %13 %25 + %48 = OpLoad %6 %47 + %49 = OpINotEqual %28 %46 %48 + OpSelectionMerge %52 None + OpBranchConditional %49 %51 %55 + %51 = OpLabel + %53 = OpAccessChain %14 %21 %13 %13 + %54 = OpLoad %6 %53 + OpStore %50 %54 + OpBranch %52 + %55 = OpLabel + %56 = OpAccessChain %14 %21 %13 %25 + %57 = OpLoad %6 %56 + OpStore %50 %57 + OpBranch %52 + %52 = OpLabel + %58 = OpLoad %6 %50 + %59 = OpExtInst %6 %1 UMin %41 %58 + OpStore %8 %59 + %60 = OpLoad %6 %8 + %61 = OpAccessChain %14 %21 %13 %13 + %62 = OpLoad %6 %61 + %63 = OpIEqual %28 %60 %62 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %88 + %64 = OpLabel + %75 = OpAccessChain %74 %73 %13 %13 + %76 = OpLoad %12 %75 + %77 = OpConvertSToF %66 %76 + %78 = OpAccessChain %74 %73 %13 %25 + %79 = OpLoad %12 %78 + %80 = OpConvertSToF %66 %79 + %81 = OpAccessChain %74 %73 %13 %25 + %82 = OpLoad %12 %81 + %83 = OpConvertSToF %66 %82 + %84 = OpAccessChain %74 %73 %13 %13 + %85 = OpLoad %12 %84 + %86 = OpConvertSToF %66 %85 + %87 = OpCompositeConstruct %67 %77 %80 %83 %86 + OpStore %69 %87 + OpBranch %65 + %88 = OpLabel + %89 = OpAccessChain %74 %73 %13 %25 + %90 = OpLoad %12 %89 + %91 = OpConvertSToF %66 %90 + %92 = OpCompositeConstruct %67 %91 %91 %91 %91 + OpStore %69 %92 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE uint32 STD140 DATA + 1 +END +# _GLF_uniform_uint_values +BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used.amber b/vulkan/amber/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used.amber new file mode 100644 index 0000000..0c5b4b3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used.amber @@ -0,0 +1,195 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // -1 encodes a NaN, which makes the result of +# // intBitsToFloat undefined. +# float f = min(intBitsToFloat(-1), 1.0); +# +# // Always true. +# if(gl_FragCoord.x > _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# // f is undefined, but this is never executed. +# _GLF_color = vec4(f); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 60 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 %36 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %16 "gl_FragCoord" + OpName %24 "buf0" + OpMemberName %24 0 "_GLF_uniform_float_values" + OpName %26 "" + OpName %36 "_GLF_color" + OpName %39 "buf1" + OpMemberName %39 0 "_GLF_uniform_int_values" + OpName %41 "" + OpDecorate %16 BuiltIn FragCoord + OpDecorate %23 ArrayStride 16 + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 0 + OpDecorate %36 Location 0 + OpDecorate %38 ArrayStride 16 + OpMemberDecorate %39 0 Offset 0 + OpDecorate %39 Block + OpDecorate %41 DescriptorSet 0 + OpDecorate %41 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 1 + %10 = OpConstant %9 -1 + %12 = OpConstant %6 1 + %14 = OpTypeVector %6 4 + %15 = OpTypePointer Input %14 + %16 = OpVariable %15 Input + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 0 + %19 = OpTypePointer Input %6 + %22 = OpConstant %17 1 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpConstant %9 0 + %28 = OpTypePointer Uniform %6 + %31 = OpTypeBool + %35 = OpTypePointer Output %14 + %36 = OpVariable %35 Output + %37 = OpConstant %17 2 + %38 = OpTypeArray %9 %37 + %39 = OpTypeStruct %38 + %40 = OpTypePointer Uniform %39 + %41 = OpVariable %40 Uniform + %42 = OpConstant %9 1 + %43 = OpTypePointer Uniform %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %11 = OpBitcast %6 %10 + %13 = OpExtInst %6 %1 FMin %11 %12 + OpStore %8 %13 + %20 = OpAccessChain %19 %16 %18 + %21 = OpLoad %6 %20 + %29 = OpAccessChain %28 %26 %27 %27 + %30 = OpLoad %6 %29 + %32 = OpFOrdGreaterThan %31 %21 %30 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %57 + %33 = OpLabel + %44 = OpAccessChain %43 %41 %27 %42 + %45 = OpLoad %9 %44 + %46 = OpConvertSToF %6 %45 + %47 = OpAccessChain %43 %41 %27 %27 + %48 = OpLoad %9 %47 + %49 = OpConvertSToF %6 %48 + %50 = OpAccessChain %43 %41 %27 %27 + %51 = OpLoad %9 %50 + %52 = OpConvertSToF %6 %51 + %53 = OpAccessChain %43 %41 %27 %42 + %54 = OpLoad %9 %53 + %55 = OpConvertSToF %6 %54 + %56 = OpCompositeConstruct %14 %46 %49 %52 %55 + OpStore %36 %56 + OpBranch %34 + %57 = OpLabel + %58 = OpLoad %6 %8 + %59 = OpCompositeConstruct %14 %58 %58 %58 %58 + OpStore %36 %59 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-min-negative-constant-always-below-one.amber b/vulkan/amber/graphicsfuzz/cov-min-negative-constant-always-below-one.amber new file mode 100644 index 0000000..0cb2c37 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-min-negative-constant-always-below-one.amber @@ -0,0 +1,175 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of one: 1.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always true as -1 < 1. +# if(min(-1.0, one) < 1.0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %24 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "buf1" + OpMemberName %8 0 "one" + OpName %10 "" + OpName %24 "_GLF_color" + OpName %28 "buf0" + OpMemberName %28 0 "_GLF_uniform_int_values" + OpName %30 "" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 1 + OpDecorate %24 Location 0 + OpDecorate %27 ArrayStride 16 + OpMemberDecorate %28 0 Offset 0 + OpDecorate %28 Block + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpConstant %6 -1 + %8 = OpTypeStruct %6 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpTypePointer Uniform %6 + %17 = OpConstant %6 1 + %18 = OpTypeBool + %22 = OpTypeVector %6 4 + %23 = OpTypePointer Output %22 + %24 = OpVariable %23 Output + %25 = OpTypeInt 32 0 + %26 = OpConstant %25 2 + %27 = OpTypeArray %11 %26 + %28 = OpTypeStruct %27 + %29 = OpTypePointer Uniform %28 + %30 = OpVariable %29 Uniform + %31 = OpConstant %11 1 + %32 = OpTypePointer Uniform %11 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpAccessChain %13 %10 %12 + %15 = OpLoad %6 %14 + %16 = OpExtInst %6 %1 FMin %7 %15 + %19 = OpFOrdLessThan %18 %16 %17 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %46 + %20 = OpLabel + %33 = OpAccessChain %32 %30 %12 %31 + %34 = OpLoad %11 %33 + %35 = OpConvertSToF %6 %34 + %36 = OpAccessChain %32 %30 %12 %12 + %37 = OpLoad %11 %36 + %38 = OpConvertSToF %6 %37 + %39 = OpAccessChain %32 %30 %12 %12 + %40 = OpLoad %11 %39 + %41 = OpConvertSToF %6 %40 + %42 = OpAccessChain %32 %30 %12 %31 + %43 = OpLoad %11 %42 + %44 = OpConvertSToF %6 %43 + %45 = OpCompositeConstruct %22 %35 %38 %41 %44 + OpStore %24 %45 + OpBranch %21 + %46 = OpLabel + %47 = OpAccessChain %32 %30 %12 %12 + %48 = OpLoad %11 %47 + %49 = OpConvertSToF %6 %48 + %50 = OpCompositeConstruct %22 %49 %49 %49 %49 + OpStore %24 %50 + OpBranch %21 + %21 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-min-nested-loop-same-value-for-variables.amber b/vulkan/amber/graphicsfuzz/cov-min-nested-loop-same-value-for-variables.amber new file mode 100644 index 0000000..1d845e3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-min-nested-loop-same-value-for-variables.amber @@ -0,0 +1,446 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 2) uniform sampler2D tex; +# +# void main() +# { +# const float arr[9] = float[9](0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); +# vec2 coord = gl_FragCoord.xy; +# vec4 res = vec4(_int_1, _int_0, _int_0, _int_1); +# +# for (int i = 0; i < 3; i++) +# { +# for (int j = 0; j < 3; j++) +# { +# int a = clamp(i + j, 0, 9); +# // f0 and f1 are guaranteed to get the value 0.0. +# float f0 = clamp(arr[a], arr[a], arr[a]); +# float f1 = clamp(arr[a], arr[a], arr[a]); +# // v0 = (0, 0, 0, 0) due to f0 being zero. +# vec4 v0 = vec4(f0); +# // v1, v2, v3, v4 all become (0, 0, 0, 0) due to multiplication by zero. +# vec4 v1 = texture(tex, vec2(i)) * f1; +# vec4 v2 = texture(tex, coord) * arr[a]; +# vec4 v3 = texture(tex, coord) * arr[a]; +# vec4 v4 = texture(tex, coord + vec2(i - _int_1, j - _int_1)) * arr[a]; +# +# // v5 becomes (0, 0, 0, 0) since the min function picks v2. +# vec4 v5 = min(vec4(1.0), v2); +# // v6 also becomes (0, 0, 0, 0) because both v3 and v5 are zero vectors. +# vec4 v6 = min(v3, v5); +# +# // The min chain simplifies to min(vec4(1.0), vec4(0.0)) which results +# // in zero vector. Thus the += operation has no effect. +# res += min(min(min(v0, v1), v6) + vec4(_float_1_0), v4); +# } +# } +# +# // res is originally red, and it has only zero vector added to it, so the +# // output color will be red too. +# _GLF_color = res; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 188 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %186 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "coord" + OpName %12 "gl_FragCoord" + OpName %16 "res" + OpName %21 "buf1" + OpMemberName %21 0 "_GLF_uniform_int_values" + OpName %23 "" + OpName %41 "i" + OpName %51 "j" + OpName %59 "a" + OpName %66 "f0" + OpName %73 "indexable" + OpName %77 "indexable" + OpName %81 "indexable" + OpName %85 "f1" + OpName %87 "indexable" + OpName %91 "indexable" + OpName %95 "indexable" + OpName %99 "v0" + OpName %102 "v1" + OpName %106 "tex" + OpName %114 "v2" + OpName %119 "indexable" + OpName %123 "v3" + OpName %128 "indexable" + OpName %132 "v4" + OpName %149 "indexable" + OpName %153 "v5" + OpName %158 "v6" + OpName %169 "buf0" + OpMemberName %169 0 "_GLF_uniform_float_values" + OpName %171 "" + OpName %186 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %20 ArrayStride 16 + OpMemberDecorate %21 0 Offset 0 + OpDecorate %21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 1 + OpDecorate %106 RelaxedPrecision + OpDecorate %106 DescriptorSet 0 + OpDecorate %106 Binding 2 + OpDecorate %107 RelaxedPrecision + OpDecorate %109 RelaxedPrecision + OpDecorate %110 RelaxedPrecision + OpDecorate %111 RelaxedPrecision + OpDecorate %115 RelaxedPrecision + OpDecorate %117 RelaxedPrecision + OpDecorate %124 RelaxedPrecision + OpDecorate %126 RelaxedPrecision + OpDecorate %133 RelaxedPrecision + OpDecorate %147 RelaxedPrecision + OpDecorate %168 ArrayStride 16 + OpMemberDecorate %169 0 Offset 0 + OpDecorate %169 Block + OpDecorate %171 DescriptorSet 0 + OpDecorate %171 Binding 0 + OpDecorate %186 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypePointer Function %10 + %17 = OpTypeInt 32 1 + %18 = OpTypeInt 32 0 + %19 = OpConstant %18 2 + %20 = OpTypeArray %17 %19 + %21 = OpTypeStruct %20 + %22 = OpTypePointer Uniform %21 + %23 = OpVariable %22 Uniform + %24 = OpConstant %17 0 + %25 = OpTypePointer Uniform %17 + %29 = OpConstant %17 1 + %40 = OpTypePointer Function %17 + %48 = OpConstant %17 3 + %49 = OpTypeBool + %63 = OpConstant %17 9 + %65 = OpTypePointer Function %6 + %67 = OpConstant %18 9 + %68 = OpTypeArray %6 %67 + %69 = OpConstant %6 0 + %70 = OpConstantComposite %68 %69 %69 %69 %69 %69 %69 %69 %69 %69 + %72 = OpTypePointer Function %68 + %103 = OpTypeImage %6 2D 0 0 0 1 Unknown + %104 = OpTypeSampledImage %103 + %105 = OpTypePointer UniformConstant %104 + %106 = OpVariable %105 UniformConstant + %154 = OpConstant %6 1 + %155 = OpConstantComposite %10 %154 %154 %154 %154 + %167 = OpConstant %18 1 + %168 = OpTypeArray %6 %167 + %169 = OpTypeStruct %168 + %170 = OpTypePointer Uniform %169 + %171 = OpVariable %170 Uniform + %172 = OpTypePointer Uniform %6 + %185 = OpTypePointer Output %10 + %186 = OpVariable %185 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %16 = OpVariable %15 Function + %41 = OpVariable %40 Function + %51 = OpVariable %40 Function + %59 = OpVariable %40 Function + %66 = OpVariable %65 Function + %73 = OpVariable %72 Function + %77 = OpVariable %72 Function + %81 = OpVariable %72 Function + %85 = OpVariable %65 Function + %87 = OpVariable %72 Function + %91 = OpVariable %72 Function + %95 = OpVariable %72 Function + %99 = OpVariable %15 Function + %102 = OpVariable %15 Function + %114 = OpVariable %15 Function + %119 = OpVariable %72 Function + %123 = OpVariable %15 Function + %128 = OpVariable %72 Function + %132 = OpVariable %15 Function + %149 = OpVariable %72 Function + %153 = OpVariable %15 Function + %158 = OpVariable %15 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + OpStore %9 %14 + %26 = OpAccessChain %25 %23 %24 %24 + %27 = OpLoad %17 %26 + %28 = OpConvertSToF %6 %27 + %30 = OpAccessChain %25 %23 %24 %29 + %31 = OpLoad %17 %30 + %32 = OpConvertSToF %6 %31 + %33 = OpAccessChain %25 %23 %24 %29 + %34 = OpLoad %17 %33 + %35 = OpConvertSToF %6 %34 + %36 = OpAccessChain %25 %23 %24 %24 + %37 = OpLoad %17 %36 + %38 = OpConvertSToF %6 %37 + %39 = OpCompositeConstruct %10 %28 %32 %35 %38 + OpStore %16 %39 + OpStore %41 %24 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %47 = OpLoad %17 %41 + %50 = OpSLessThan %49 %47 %48 + OpBranchConditional %50 %43 %44 + %43 = OpLabel + OpStore %51 %24 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %17 %51 + %58 = OpSLessThan %49 %57 %48 + OpBranchConditional %58 %53 %54 + %53 = OpLabel + %60 = OpLoad %17 %41 + %61 = OpLoad %17 %51 + %62 = OpIAdd %17 %60 %61 + %64 = OpExtInst %17 %1 SClamp %62 %24 %63 + OpStore %59 %64 + %71 = OpLoad %17 %59 + OpStore %73 %70 + %74 = OpAccessChain %65 %73 %71 + %75 = OpLoad %6 %74 + %76 = OpLoad %17 %59 + OpStore %77 %70 + %78 = OpAccessChain %65 %77 %76 + %79 = OpLoad %6 %78 + %80 = OpLoad %17 %59 + OpStore %81 %70 + %82 = OpAccessChain %65 %81 %80 + %83 = OpLoad %6 %82 + %84 = OpExtInst %6 %1 FClamp %75 %79 %83 + OpStore %66 %84 + %86 = OpLoad %17 %59 + OpStore %87 %70 + %88 = OpAccessChain %65 %87 %86 + %89 = OpLoad %6 %88 + %90 = OpLoad %17 %59 + OpStore %91 %70 + %92 = OpAccessChain %65 %91 %90 + %93 = OpLoad %6 %92 + %94 = OpLoad %17 %59 + OpStore %95 %70 + %96 = OpAccessChain %65 %95 %94 + %97 = OpLoad %6 %96 + %98 = OpExtInst %6 %1 FClamp %89 %93 %97 + OpStore %85 %98 + %100 = OpLoad %6 %66 + %101 = OpCompositeConstruct %10 %100 %100 %100 %100 + OpStore %99 %101 + %107 = OpLoad %104 %106 + %108 = OpLoad %17 %41 + %109 = OpConvertSToF %6 %108 + %110 = OpCompositeConstruct %7 %109 %109 + %111 = OpImageSampleImplicitLod %10 %107 %110 + %112 = OpLoad %6 %85 + %113 = OpVectorTimesScalar %10 %111 %112 + OpStore %102 %113 + %115 = OpLoad %104 %106 + %116 = OpLoad %7 %9 + %117 = OpImageSampleImplicitLod %10 %115 %116 + %118 = OpLoad %17 %59 + OpStore %119 %70 + %120 = OpAccessChain %65 %119 %118 + %121 = OpLoad %6 %120 + %122 = OpVectorTimesScalar %10 %117 %121 + OpStore %114 %122 + %124 = OpLoad %104 %106 + %125 = OpLoad %7 %9 + %126 = OpImageSampleImplicitLod %10 %124 %125 + %127 = OpLoad %17 %59 + OpStore %128 %70 + %129 = OpAccessChain %65 %128 %127 + %130 = OpLoad %6 %129 + %131 = OpVectorTimesScalar %10 %126 %130 + OpStore %123 %131 + %133 = OpLoad %104 %106 + %134 = OpLoad %7 %9 + %135 = OpLoad %17 %41 + %136 = OpAccessChain %25 %23 %24 %24 + %137 = OpLoad %17 %136 + %138 = OpISub %17 %135 %137 + %139 = OpConvertSToF %6 %138 + %140 = OpLoad %17 %51 + %141 = OpAccessChain %25 %23 %24 %24 + %142 = OpLoad %17 %141 + %143 = OpISub %17 %140 %142 + %144 = OpConvertSToF %6 %143 + %145 = OpCompositeConstruct %7 %139 %144 + %146 = OpFAdd %7 %134 %145 + %147 = OpImageSampleImplicitLod %10 %133 %146 + %148 = OpLoad %17 %59 + OpStore %149 %70 + %150 = OpAccessChain %65 %149 %148 + %151 = OpLoad %6 %150 + %152 = OpVectorTimesScalar %10 %147 %151 + OpStore %132 %152 + %156 = OpLoad %10 %114 + %157 = OpExtInst %10 %1 FMin %155 %156 + OpStore %153 %157 + %159 = OpLoad %10 %123 + %160 = OpLoad %10 %153 + %161 = OpExtInst %10 %1 FMin %159 %160 + OpStore %158 %161 + %162 = OpLoad %10 %99 + %163 = OpLoad %10 %102 + %164 = OpExtInst %10 %1 FMin %162 %163 + %165 = OpLoad %10 %158 + %166 = OpExtInst %10 %1 FMin %164 %165 + %173 = OpAccessChain %172 %171 %24 %24 + %174 = OpLoad %6 %173 + %175 = OpCompositeConstruct %10 %174 %174 %174 %174 + %176 = OpFAdd %10 %166 %175 + %177 = OpLoad %10 %132 + %178 = OpExtInst %10 %1 FMin %176 %177 + %179 = OpLoad %10 %16 + %180 = OpFAdd %10 %179 %178 + OpStore %16 %180 + OpBranch %55 + %55 = OpLabel + %181 = OpLoad %17 %51 + %182 = OpIAdd %17 %181 %29 + OpStore %51 %182 + OpBranch %52 + %54 = OpLabel + OpBranch %45 + %45 = OpLabel + %183 = OpLoad %17 %41 + %184 = OpIAdd %17 %183 %29 + OpStore %41 %184 + OpBranch %42 + %44 = OpLabel + %187 = OpLoad %10 %16 + OpStore %186 %187 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# tex +SAMPLER variant_tex + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-min-vec2-transpose-mat2-identity.amber b/vulkan/amber/graphicsfuzz/cov-min-vec2-transpose-mat2-identity.amber new file mode 100644 index 0000000..33ba57b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-min-vec2-transpose-mat2-identity.amber @@ -0,0 +1,192 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-Os' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always true. The line below simplifies to +# // min(vec2(1, 1), vec2(transpose(mat2(1)))).y = min(vec2(1, 1), vec2(mat2(1))).y +# // = min(vec2(1, 1), vec2(1, 0)).y = vec2(1, 0).y = 0. +# if(min(vec2(1), vec2(transpose(mat2(_int_1)))).y == _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %35 "buf1" + OpMemberName %35 0 "_GLF_uniform_float_values" + OpName %37 "" + OpName %47 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %34 ArrayStride 16 + OpMemberDecorate %35 0 Offset 0 + OpDecorate %35 Block + OpDecorate %37 DescriptorSet 0 + OpDecorate %37 Binding 1 + OpDecorate %47 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpConstant %6 1 + %9 = OpConstantComposite %7 %8 %8 + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpTypeMatrix %7 2 + %23 = OpConstant %6 0 + %32 = OpConstant %11 1 + %34 = OpTypeArray %6 %32 + %35 = OpTypeStruct %34 + %36 = OpTypePointer Uniform %35 + %37 = OpVariable %36 Uniform + %38 = OpTypePointer Uniform %6 + %41 = OpTypeBool + %45 = OpTypeVector %6 4 + %46 = OpTypePointer Output %45 + %47 = OpVariable %46 Output + %51 = OpConstant %10 1 + %67 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %24 = OpCompositeConstruct %7 %21 %23 + %25 = OpCompositeConstruct %7 %23 %21 + %26 = OpCompositeConstruct %22 %24 %25 + %27 = OpTranspose %22 %26 + %29 = OpCompositeExtract %6 %27 0 1 + %30 = OpCompositeConstruct %7 %67 %29 + %31 = OpExtInst %7 %1 FMin %9 %30 + %33 = OpCompositeExtract %6 %31 1 + %39 = OpAccessChain %38 %37 %17 %17 + %40 = OpLoad %6 %39 + %42 = OpFOrdEqual %41 %33 %40 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %62 + %43 = OpLabel + %52 = OpAccessChain %18 %16 %17 %51 + %53 = OpLoad %10 %52 + %54 = OpConvertSToF %6 %53 + %61 = OpCompositeConstruct %45 %21 %54 %54 %21 + OpStore %47 %61 + OpBranch %44 + %62 = OpLabel + %63 = OpAccessChain %18 %16 %17 %51 + %64 = OpLoad %10 %63 + %65 = OpConvertSToF %6 %64 + %66 = OpCompositeConstruct %45 %65 %65 %65 %65 + OpStore %47 %66 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-missing-return-value-function-never-called.amber b/vulkan/amber/graphicsfuzz/cov-missing-return-value-function-never-called.amber new file mode 100644 index 0000000..6eba6b1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-missing-return-value-function-never-called.amber @@ -0,0 +1,230 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: 0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[1]; +# }; +# +# // Contents of one: 1 +# layout(set = 0, binding = 1) uniform buf1 +# { +# uint one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Function is missing return value at the end, +# // but this function is never called. +# float func() +# { +# switch(1) +# { +# case 0: +# return 1.0; +# } +# } +# +# void main() +# { +# vec4 v = vec4(1.0); +# +# // Always false. +# if (gl_FragCoord.y < 0.0) +# { +# v = vec4(func()); +# } +# +# // Always false. +# if (packUnorm4x8(v) == 1u) +# { +# return; +# } +# +# // Always true. +# if ((1u << one) == 2u) +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %23 %55 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %20 "v" + OpName %23 "gl_FragCoord" + OpName %42 "buf1" + OpMemberName %42 0 "one" + OpName %44 "" + OpName %55 "_GLF_color" + OpName %59 "buf0" + OpMemberName %59 0 "_GLF_uniform_int_values" + OpName %61 "" + OpDecorate %23 BuiltIn FragCoord + OpMemberDecorate %42 0 Offset 0 + OpDecorate %42 Block + OpDecorate %44 DescriptorSet 0 + OpDecorate %44 Binding 1 + OpDecorate %55 Location 0 + OpDecorate %58 ArrayStride 16 + OpMemberDecorate %59 0 Offset 0 + OpDecorate %59 Block + OpDecorate %61 DescriptorSet 0 + OpDecorate %61 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypeInt 32 1 + %11 = OpConstant %10 1 + %14 = OpConstant %6 1 + %18 = OpTypeVector %6 4 + %19 = OpTypePointer Function %18 + %21 = OpConstantComposite %18 %14 %14 %14 %14 + %22 = OpTypePointer Input %18 + %23 = OpVariable %22 Input + %24 = OpTypeInt 32 0 + %25 = OpConstant %24 1 + %26 = OpTypePointer Input %6 + %29 = OpConstant %6 0 + %30 = OpTypeBool + %42 = OpTypeStruct %24 + %43 = OpTypePointer Uniform %42 + %44 = OpVariable %43 Uniform + %45 = OpConstant %10 0 + %46 = OpTypePointer Uniform %24 + %50 = OpConstant %24 2 + %54 = OpTypePointer Output %18 + %55 = OpVariable %54 Output + %56 = OpConstantComposite %18 %14 %29 %29 %14 + %58 = OpTypeArray %10 %25 + %59 = OpTypeStruct %58 + %60 = OpTypePointer Uniform %59 + %61 = OpVariable %60 Uniform + %62 = OpTypePointer Uniform %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %20 = OpVariable %19 Function + OpStore %20 %21 + %27 = OpAccessChain %26 %23 %25 + %28 = OpLoad %6 %27 + %31 = OpFOrdLessThan %30 %28 %29 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %33 + %32 = OpLabel + %34 = OpFunctionCall %6 %8 + %35 = OpCompositeConstruct %18 %34 %34 %34 %34 + OpStore %20 %35 + OpBranch %33 + %33 = OpLabel + %36 = OpLoad %18 %20 + %37 = OpExtInst %24 %1 PackUnorm4x8 %36 + %38 = OpIEqual %30 %37 %25 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + OpReturn + %40 = OpLabel + %47 = OpAccessChain %46 %44 %45 + %48 = OpLoad %24 %47 + %49 = OpShiftLeftLogical %24 %25 %48 + %51 = OpIEqual %30 %49 %50 + OpSelectionMerge %53 None + OpBranchConditional %51 %52 %57 + %52 = OpLabel + OpStore %55 %56 + OpBranch %53 + %57 = OpLabel + %63 = OpAccessChain %62 %61 %45 %45 + %64 = OpLoad %10 %63 + %65 = OpConvertSToF %6 %64 + %66 = OpCompositeConstruct %18 %65 %65 %65 %65 + OpStore %55 %66 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + OpSelectionMerge %13 None + OpSwitch %11 %13 0 %12 + %12 = OpLabel + OpReturnValue %14 + %13 = OpLabel + %17 = OpUndef %6 + OpReturnValue %17 + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE uint32 STD140 DATA + 1 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-mix-uninitialized-float-never-selected.amber b/vulkan/amber/graphicsfuzz/cov-mix-uninitialized-float-never-selected.amber new file mode 100644 index 0000000..08736ff --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-mix-uninitialized-float-never-selected.amber @@ -0,0 +1,137 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f; +# +# // f is uninitialized, but 1.0 is selected from the first vector. +# _GLF_color = mix(vec4(1.0), vec4(f, 0.0, 0.0, 1.0), bvec4(gl_FragCoord.y < _float_0_0, true, true, true)); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %18 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %13 "f" + OpName %18 "gl_FragCoord" + OpName %25 "buf0" + OpMemberName %25 0 "_GLF_uniform_float_values" + OpName %27 "" + OpDecorate %9 Location 0 + OpDecorate %18 BuiltIn FragCoord + OpDecorate %24 ArrayStride 16 + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypePointer Function %6 + %15 = OpConstant %6 0 + %17 = OpTypePointer Input %7 + %18 = OpVariable %17 Input + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 1 + %21 = OpTypePointer Input %6 + %24 = OpTypeArray %6 %20 + %25 = OpTypeStruct %24 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypeInt 32 1 + %29 = OpConstant %28 0 + %30 = OpTypePointer Uniform %6 + %33 = OpTypeBool + %35 = OpConstantTrue %33 + %36 = OpTypeVector %33 4 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %13 = OpVariable %12 Function + %14 = OpLoad %6 %13 + %16 = OpCompositeConstruct %7 %14 %15 %15 %10 + %22 = OpAccessChain %21 %18 %20 + %23 = OpLoad %6 %22 + %31 = OpAccessChain %30 %27 %29 %29 + %32 = OpLoad %6 %31 + %34 = OpFOrdLessThan %33 %23 %32 + %37 = OpCompositeConstruct %36 %34 %35 %35 %35 + %38 = OpSelect %7 %37 %16 %11 + OpStore %9 %38 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-mix-uninitialized-vector-select-only-defined-data.amber b/vulkan/amber/graphicsfuzz/cov-mix-uninitialized-vector-select-only-defined-data.amber new file mode 100644 index 0000000..97d2b5e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-mix-uninitialized-vector-select-only-defined-data.amber @@ -0,0 +1,180 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: 1 +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[1]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v; +# // _GLF_color becomes (1, 1, 1, 1). Vector v is uninitialized, but none of it's values are selected. +# _GLF_color = mix(vec4(1.0, v[_int_1], 1.0, 1.0), vec4(1), bvec4(true, true, gl_FragCoord.y > _float_0_0, true)); +# // Adjust the color to (1, 0, 0, 1). +# _GLF_color.yz -= _float_1_0; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %32 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %12 "v" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %32 "gl_FragCoord" + OpName %38 "buf1" + OpMemberName %38 0 "_GLF_uniform_float_values" + OpName %40 "" + OpDecorate %9 Location 0 + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %32 BuiltIn FragCoord + OpDecorate %37 ArrayStride 16 + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpTypePointer Function %7 + %13 = OpTypeInt 32 1 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 1 + %16 = OpTypeArray %13 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %13 0 + %21 = OpTypePointer Uniform %13 + %24 = OpTypePointer Function %6 + %28 = OpConstantComposite %7 %10 %10 %10 %10 + %29 = OpTypeBool + %30 = OpConstantTrue %29 + %31 = OpTypePointer Input %7 + %32 = OpVariable %31 Input + %33 = OpTypePointer Input %6 + %36 = OpConstant %14 2 + %37 = OpTypeArray %6 %36 + %38 = OpTypeStruct %37 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %41 = OpTypePointer Uniform %6 + %45 = OpTypeVector %29 4 + %48 = OpConstant %13 1 + %51 = OpTypeVector %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpVariable %11 Function + %22 = OpAccessChain %21 %19 %20 %20 + %23 = OpLoad %13 %22 + %25 = OpAccessChain %24 %12 %23 + %26 = OpLoad %6 %25 + %27 = OpCompositeConstruct %7 %10 %26 %10 %10 + %34 = OpAccessChain %33 %32 %15 + %35 = OpLoad %6 %34 + %42 = OpAccessChain %41 %40 %20 %20 + %43 = OpLoad %6 %42 + %44 = OpFOrdGreaterThan %29 %35 %43 + %46 = OpCompositeConstruct %45 %30 %30 %44 %30 + %47 = OpSelect %7 %46 %28 %27 + OpStore %9 %47 + %49 = OpAccessChain %41 %40 %20 %48 + %50 = OpLoad %6 %49 + %52 = OpLoad %7 %9 + %53 = OpVectorShuffle %51 %52 %52 1 2 + %54 = OpCompositeConstruct %51 %50 %50 + %55 = OpFSub %51 %53 %54 + %56 = OpLoad %7 %9 + %57 = OpVectorShuffle %7 %56 %55 0 4 5 3 + OpStore %9 %57 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-mod-acosh.amber b/vulkan/amber/graphicsfuzz/cov-mod-acosh.amber new file mode 100644 index 0000000..4d92f82 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-mod-acosh.amber @@ -0,0 +1,193 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that calculates modulo of an acosh result + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_2_6 _GLF_uniform_float_values[0] +# #define _float_1_61 _GLF_uniform_float_values[1] +# #define _float_0_1 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [2.6, 1.61, 0.1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = mod(acosh(_float_2_6), 7938.0); +# if (abs(f - _float_1_61) < _float_0_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %38 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %38 "_GLF_color" + OpName %41 "buf1" + OpMemberName %41 0 "_GLF_uniform_int_values" + OpName %43 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %38 Location 0 + OpDecorate %40 ArrayStride 16 + OpMemberDecorate %41 0 Offset 0 + OpDecorate %41 Block + OpDecorate %43 DescriptorSet 0 + OpDecorate %43 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %6 7938 + %24 = OpConstant %15 1 + %29 = OpConstant %15 2 + %32 = OpTypeBool + %36 = OpTypeVector %6 4 + %37 = OpTypePointer Output %36 + %38 = OpVariable %37 Output + %39 = OpConstant %9 2 + %40 = OpTypeArray %15 %39 + %41 = OpTypeStruct %40 + %42 = OpTypePointer Uniform %41 + %43 = OpVariable %42 Uniform + %44 = OpTypePointer Uniform %15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %6 %18 + %20 = OpExtInst %6 %1 Acosh %19 + %22 = OpFMod %6 %20 %21 + OpStore %8 %22 + %23 = OpLoad %6 %8 + %25 = OpAccessChain %17 %14 %16 %24 + %26 = OpLoad %6 %25 + %27 = OpFSub %6 %23 %26 + %28 = OpExtInst %6 %1 FAbs %27 + %30 = OpAccessChain %17 %14 %16 %29 + %31 = OpLoad %6 %30 + %33 = OpFOrdLessThan %32 %28 %31 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %58 + %34 = OpLabel + %45 = OpAccessChain %44 %43 %16 %24 + %46 = OpLoad %15 %45 + %47 = OpConvertSToF %6 %46 + %48 = OpAccessChain %44 %43 %16 %16 + %49 = OpLoad %15 %48 + %50 = OpConvertSToF %6 %49 + %51 = OpAccessChain %44 %43 %16 %16 + %52 = OpLoad %15 %51 + %53 = OpConvertSToF %6 %52 + %54 = OpAccessChain %44 %43 %16 %24 + %55 = OpLoad %15 %54 + %56 = OpConvertSToF %6 %55 + %57 = OpCompositeConstruct %36 %47 %50 %53 %56 + OpStore %38 %57 + OpBranch %35 + %58 = OpLabel + %59 = OpAccessChain %44 %43 %16 %16 + %60 = OpLoad %15 %59 + %61 = OpConvertSToF %6 %60 + %62 = OpCompositeConstruct %36 %61 %61 %61 %61 + OpStore %38 %62 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.6 1.61 0.1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-mod-uint-bits-float.amber b/vulkan/amber/graphicsfuzz/cov-mod-uint-bits-float.amber new file mode 100644 index 0000000..98ad57c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-mod-uint-bits-float.amber @@ -0,0 +1,149 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific APFloat path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_0_01 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = mod(uintBitsToFloat(1u), 1.0); +# +# _GLF_color = vec4(_float_0_0); +# if (a < _float_0_01) +# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 46 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %16 "_GLF_color" + OpName %19 "buf0" + OpMemberName %19 0 "_GLF_uniform_float_values" + OpName %21 "" + OpDecorate %16 Location 0 + OpDecorate %18 ArrayStride 16 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 1 + %12 = OpConstant %6 1 + %14 = OpTypeVector %6 4 + %15 = OpTypePointer Output %14 + %16 = OpVariable %15 Output + %17 = OpConstant %9 3 + %18 = OpTypeArray %6 %17 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpTypeInt 32 1 + %23 = OpConstant %22 0 + %24 = OpConstant %22 1 + %25 = OpTypePointer Uniform %6 + %30 = OpConstant %22 2 + %33 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %11 = OpBitcast %6 %10 + %13 = OpFMod %6 %11 %12 + OpStore %8 %13 + %26 = OpAccessChain %25 %21 %23 %24 + %27 = OpLoad %6 %26 + %28 = OpCompositeConstruct %14 %27 %27 %27 %27 + OpStore %16 %28 + %29 = OpLoad %6 %8 + %31 = OpAccessChain %25 %21 %23 %30 + %32 = OpLoad %6 %31 + %34 = OpFOrdLessThan %33 %29 %32 + OpSelectionMerge %36 None + OpBranchConditional %34 %35 %36 + %35 = OpLabel + %37 = OpAccessChain %25 %21 %23 %23 + %38 = OpLoad %6 %37 + %39 = OpAccessChain %25 %21 %23 %24 + %40 = OpLoad %6 %39 + %41 = OpAccessChain %25 %21 %23 %24 + %42 = OpLoad %6 %41 + %43 = OpAccessChain %25 %21 %23 %23 + %44 = OpLoad %6 %43 + %45 = OpCompositeConstruct %14 %38 %40 %42 %44 + OpStore %16 %45 + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 0.01 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-modf-clamp-for.amber b/vulkan/amber/graphicsfuzz/cov-modf-clamp-for.amber new file mode 100644 index 0000000..701f284 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-modf-clamp-for.amber @@ -0,0 +1,280 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific live intervals code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_10 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_2_0 _GLF_uniform_float_values[1] +# #define _float_0_0 _GLF_uniform_float_values[2] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 2, 1, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 2.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = _float_1_0; +# +# // b becomes 0. +# int b = int(modf(_float_0_0, a)); +# +# vec2 v1 = vec2(_float_1_0); +# +# // Always true. +# if (v1[clamp(_int_0, b, _int_2)] >= _float_1_0) +# { +# float c = _float_2_0; +# for (int i = _int_0; (c >= _float_2_0) && (i < _int_10); i++) +# { +# a = c; +# c = a; +# } +# } +# if (a == _float_2_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 108 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %89 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %21 "b" + OpName %29 "v1" + OpName %35 "buf0" + OpMemberName %35 0 "_GLF_uniform_int_values" + OpName %37 "" + OpName %54 "c" + OpName %57 "i" + OpName %89 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %34 ArrayStride 16 + OpMemberDecorate %35 0 Offset 0 + OpDecorate %35 Block + OpDecorate %37 DescriptorSet 0 + OpDecorate %37 Binding 0 + OpDecorate %89 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %20 = OpTypePointer Function %15 + %22 = OpConstant %15 2 + %27 = OpTypeVector %6 2 + %28 = OpTypePointer Function %27 + %33 = OpConstant %9 4 + %34 = OpTypeArray %15 %33 + %35 = OpTypeStruct %34 + %36 = OpTypePointer Uniform %35 + %37 = OpVariable %36 Uniform + %38 = OpTypePointer Uniform %15 + %42 = OpConstant %15 1 + %50 = OpTypeBool + %72 = OpConstant %15 3 + %87 = OpTypeVector %6 4 + %88 = OpTypePointer Output %87 + %89 = OpVariable %88 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %21 = OpVariable %20 Function + %29 = OpVariable %28 Function + %54 = OpVariable %7 Function + %57 = OpVariable %20 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %23 = OpAccessChain %17 %14 %16 %22 + %24 = OpLoad %6 %23 + %25 = OpExtInst %6 %1 Modf %24 %8 + %26 = OpConvertFToS %15 %25 + OpStore %21 %26 + %30 = OpAccessChain %17 %14 %16 %16 + %31 = OpLoad %6 %30 + %32 = OpCompositeConstruct %27 %31 %31 + OpStore %29 %32 + %39 = OpAccessChain %38 %37 %16 %16 + %40 = OpLoad %15 %39 + %41 = OpLoad %15 %21 + %43 = OpAccessChain %38 %37 %16 %42 + %44 = OpLoad %15 %43 + %45 = OpExtInst %15 %1 SClamp %40 %41 %44 + %46 = OpAccessChain %7 %29 %45 + %47 = OpLoad %6 %46 + %48 = OpAccessChain %17 %14 %16 %16 + %49 = OpLoad %6 %48 + %51 = OpFOrdGreaterThanEqual %50 %47 %49 + OpSelectionMerge %53 None + OpBranchConditional %51 %52 %53 + %52 = OpLabel + %55 = OpAccessChain %17 %14 %16 %42 + %56 = OpLoad %6 %55 + OpStore %54 %56 + %58 = OpAccessChain %38 %37 %16 %16 + %59 = OpLoad %15 %58 + OpStore %57 %59 + OpBranch %60 + %60 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %6 %54 + %66 = OpAccessChain %17 %14 %16 %42 + %67 = OpLoad %6 %66 + %68 = OpFOrdGreaterThanEqual %50 %65 %67 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %70 + %69 = OpLabel + %71 = OpLoad %15 %57 + %73 = OpAccessChain %38 %37 %16 %72 + %74 = OpLoad %15 %73 + %75 = OpSLessThan %50 %71 %74 + OpBranch %70 + %70 = OpLabel + %76 = OpPhi %50 %68 %64 %75 %69 + OpBranchConditional %76 %61 %62 + %61 = OpLabel + %77 = OpLoad %6 %54 + OpStore %8 %77 + %78 = OpLoad %6 %8 + OpStore %54 %78 + OpBranch %63 + %63 = OpLabel + %79 = OpLoad %15 %57 + %80 = OpIAdd %15 %79 %42 + OpStore %57 %80 + OpBranch %60 + %62 = OpLabel + OpBranch %53 + %53 = OpLabel + %81 = OpLoad %6 %8 + %82 = OpAccessChain %17 %14 %16 %42 + %83 = OpLoad %6 %82 + %84 = OpFOrdEqual %50 %81 %83 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %103 + %85 = OpLabel + %90 = OpAccessChain %38 %37 %16 %22 + %91 = OpLoad %15 %90 + %92 = OpConvertSToF %6 %91 + %93 = OpAccessChain %38 %37 %16 %16 + %94 = OpLoad %15 %93 + %95 = OpConvertSToF %6 %94 + %96 = OpAccessChain %38 %37 %16 %16 + %97 = OpLoad %15 %96 + %98 = OpConvertSToF %6 %97 + %99 = OpAccessChain %38 %37 %16 %22 + %100 = OpLoad %15 %99 + %101 = OpConvertSToF %6 %100 + %102 = OpCompositeConstruct %87 %92 %95 %98 %101 + OpStore %89 %102 + OpBranch %86 + %103 = OpLabel + %104 = OpAccessChain %38 %37 %16 %16 + %105 = OpLoad %15 %104 + %106 = OpConvertSToF %6 %105 + %107 = OpCompositeConstruct %87 %106 %106 %106 %106 + OpStore %89 %107 + OpBranch %86 + %86 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 2.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 2 1 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-modf-integer-to-private.amber b/vulkan/amber/graphicsfuzz/cov-modf-integer-to-private.amber new file mode 100644 index 0000000..460a51d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-modf-integer-to-private.amber @@ -0,0 +1,106 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific private to local path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float a; +# +# void main() +# { +# modf(5.0, a); +# +# // Always true. +# if (a == 5.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 24 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %18 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "a" + OpName %18 "_GLF_color" + OpDecorate %18 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpConstant %6 5 + %8 = OpTypePointer Private %6 + %9 = OpVariable %8 Private + %12 = OpTypeBool + %16 = OpTypeVector %6 4 + %17 = OpTypePointer Output %16 + %18 = OpVariable %17 Output + %19 = OpConstant %6 1 + %20 = OpConstant %6 0 + %21 = OpConstantComposite %16 %19 %20 %20 %19 + %23 = OpConstantComposite %16 %20 %20 %20 %20 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpExtInst %6 %1 Modf %7 %9 + %11 = OpLoad %6 %9 + %13 = OpFOrdEqual %12 %11 %7 + OpSelectionMerge %15 None + OpBranchConditional %13 %14 %22 + %14 = OpLabel + OpStore %18 %21 + OpBranch %15 + %22 = OpLabel + OpStore %18 %23 + OpBranch %15 + %15 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-modulo-zero-never-executed.amber b/vulkan/amber/graphicsfuzz/cov-modulo-zero-never-executed.amber new file mode 100644 index 0000000..1aaeed5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-modulo-zero-never-executed.amber @@ -0,0 +1,244 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _uint_5 _GLF_uniform_uint_values[0] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_uint_values: 5 +# layout(set = 0, binding = 1) uniform buf1 +# { +# uint _GLF_uniform_uint_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 2) uniform buf2 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# uint a = 0u; +# int b = _int_1; +# +# // Always false. +# if (gl_FragCoord.x < _float_0_0) +# { +# // Modulo of zero is undefined, but this is never executed. +# b = int(_uint_5 % a); +# } +# +# // Always true. +# if (b == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 78 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %26 %59 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "b" + OpName %15 "buf2" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %26 "gl_FragCoord" + OpName %32 "buf0" + OpMemberName %32 0 "_GLF_uniform_float_values" + OpName %34 "" + OpName %43 "buf1" + OpMemberName %43 0 "_GLF_uniform_uint_values" + OpName %45 "" + OpName %59 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 2 + OpDecorate %26 BuiltIn FragCoord + OpDecorate %31 ArrayStride 16 + OpMemberDecorate %32 0 Offset 0 + OpDecorate %32 Block + OpDecorate %34 DescriptorSet 0 + OpDecorate %34 Binding 0 + OpDecorate %42 ArrayStride 16 + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 1 + OpDecorate %59 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %13 = OpConstant %6 2 + %14 = OpTypeArray %10 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %10 0 + %19 = OpConstant %10 1 + %20 = OpTypePointer Uniform %10 + %23 = OpTypeFloat 32 + %24 = OpTypeVector %23 4 + %25 = OpTypePointer Input %24 + %26 = OpVariable %25 Input + %27 = OpTypePointer Input %23 + %30 = OpConstant %6 1 + %31 = OpTypeArray %23 %30 + %32 = OpTypeStruct %31 + %33 = OpTypePointer Uniform %32 + %34 = OpVariable %33 Uniform + %35 = OpTypePointer Uniform %23 + %38 = OpTypeBool + %42 = OpTypeArray %6 %30 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %46 = OpTypePointer Uniform %6 + %58 = OpTypePointer Output %24 + %59 = OpVariable %58 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %12 = OpVariable %11 Function + OpStore %8 %9 + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %10 %21 + OpStore %12 %22 + %28 = OpAccessChain %27 %26 %9 + %29 = OpLoad %23 %28 + %36 = OpAccessChain %35 %34 %18 %18 + %37 = OpLoad %23 %36 + %39 = OpFOrdLessThan %38 %29 %37 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %41 + %40 = OpLabel + %47 = OpAccessChain %46 %45 %18 %18 + %48 = OpLoad %6 %47 + %49 = OpLoad %6 %8 + %50 = OpUMod %6 %48 %49 + %51 = OpBitcast %10 %50 + OpStore %12 %51 + OpBranch %41 + %41 = OpLabel + %52 = OpLoad %10 %12 + %53 = OpAccessChain %20 %17 %18 %19 + %54 = OpLoad %10 %53 + %55 = OpIEqual %38 %52 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %73 + %56 = OpLabel + %60 = OpAccessChain %20 %17 %18 %19 + %61 = OpLoad %10 %60 + %62 = OpConvertSToF %23 %61 + %63 = OpAccessChain %20 %17 %18 %18 + %64 = OpLoad %10 %63 + %65 = OpConvertSToF %23 %64 + %66 = OpAccessChain %20 %17 %18 %18 + %67 = OpLoad %10 %66 + %68 = OpConvertSToF %23 %67 + %69 = OpAccessChain %20 %17 %18 %19 + %70 = OpLoad %10 %69 + %71 = OpConvertSToF %23 %70 + %72 = OpCompositeConstruct %24 %62 %65 %68 %71 + OpStore %59 %72 + OpBranch %57 + %73 = OpLabel + %74 = OpAccessChain %20 %17 %18 %18 + %75 = OpLoad %10 %74 + %76 = OpConvertSToF %23 %75 + %77 = OpCompositeConstruct %24 %76 %76 %76 %76 + OpStore %59 %77 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_uint_values +BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA + 5 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-multiple-fragcoord-conditions-false-never-return-sample-texture.amber b/vulkan/amber/graphicsfuzz/cov-multiple-fragcoord-conditions-false-never-return-sample-texture.amber new file mode 100644 index 0000000..60c010c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-multiple-fragcoord-conditions-false-never-return-sample-texture.amber @@ -0,0 +1,291 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [10, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(set = 0, binding = 2) uniform sampler2D tex; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always false. +# if(gl_FragCoord.y < _float_0_0) +# { +# return; +# } +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# if(gl_FragCoord.x < _float_0_0) +# { +# return; +# } +# +# for(int i = _int_0; i < _int_10; i++) +# { +# if(gl_FragCoord.x < _float_1_0) +# { +# return; +# } +# } +# } +# +# _GLF_color = vec4(_float_1_0, texture(tex, vec2(_float_1_0)).yzw); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 105 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %76 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "gl_FragCoord" + OpName %17 "buf1" + OpMemberName %17 0 "_GLF_uniform_float_values" + OpName %19 "" + OpName %49 "buf0" + OpMemberName %49 0 "_GLF_uniform_int_values" + OpName %51 "" + OpName %76 "_GLF_color" + OpName %82 "tex" + OpDecorate %9 BuiltIn FragCoord + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %48 ArrayStride 16 + OpMemberDecorate %49 0 Offset 0 + OpDecorate %49 Block + OpDecorate %51 DescriptorSet 0 + OpDecorate %51 Binding 0 + OpDecorate %76 Location 0 + OpDecorate %82 RelaxedPrecision + OpDecorate %82 DescriptorSet 0 + OpDecorate %82 Binding 2 + OpDecorate %83 RelaxedPrecision + OpDecorate %87 RelaxedPrecision + OpDecorate %88 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Input %7 + %9 = OpVariable %8 Input + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 1 + %12 = OpTypePointer Input %6 + %15 = OpConstant %10 2 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypeInt 32 1 + %21 = OpConstant %20 0 + %22 = OpTypePointer Uniform %6 + %25 = OpTypeBool + %30 = OpConstant %10 0 + %48 = OpTypeArray %20 %15 + %49 = OpTypeStruct %48 + %50 = OpTypePointer Uniform %49 + %51 = OpVariable %50 Uniform + %52 = OpConstant %20 1 + %53 = OpTypePointer Uniform %20 + %75 = OpTypePointer Output %7 + %76 = OpVariable %75 Output + %79 = OpTypeImage %6 2D 0 0 0 1 Unknown + %80 = OpTypeSampledImage %79 + %81 = OpTypePointer UniformConstant %80 + %82 = OpVariable %81 UniformConstant + %86 = OpTypeVector %6 2 + %97 = OpConstantFalse %25 + %100 = OpConstantTrue %25 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %95 None + OpSwitch %30 %96 + %96 = OpLabel + %13 = OpAccessChain %12 %9 %11 + %14 = OpLoad %6 %13 + %23 = OpAccessChain %22 %19 %21 %21 + %24 = OpLoad %6 %23 + %26 = OpFOrdLessThan %25 %14 %24 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + OpBranch %95 + %28 = OpLabel + %31 = OpAccessChain %12 %9 %30 + %32 = OpLoad %6 %31 + %35 = OpFOrdLessThan %25 %32 %24 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %37 + %36 = OpLabel + OpSelectionMerge %44 None + OpBranchConditional %35 %43 %44 + %43 = OpLabel + OpBranch %95 + %44 = OpLabel + %54 = OpAccessChain %53 %51 %21 %52 + %55 = OpLoad %20 %54 + OpBranch %56 + %56 = OpLabel + %103 = OpPhi %20 %55 %44 %74 %59 + %62 = OpAccessChain %53 %51 %21 %21 + %63 = OpLoad %20 %62 + %64 = OpSLessThan %25 %103 %63 + OpLoopMerge %58 %59 None + OpBranchConditional %64 %57 %58 + %57 = OpLabel + %67 = OpAccessChain %22 %19 %21 %52 + %68 = OpLoad %6 %67 + %69 = OpFOrdLessThan %25 %32 %68 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %71 + %70 = OpLabel + OpBranch %58 + %71 = OpLabel + OpBranch %59 + %59 = OpLabel + %74 = OpIAdd %20 %103 %52 + OpBranch %56 + %58 = OpLabel + %104 = OpPhi %25 %97 %56 %100 %70 + OpSelectionMerge %101 None + OpBranchConditional %104 %95 %101 + %101 = OpLabel + OpBranch %37 + %37 = OpLabel + %77 = OpAccessChain %22 %19 %21 %52 + %78 = OpLoad %6 %77 + %83 = OpLoad %80 %82 + %87 = OpCompositeConstruct %86 %78 %78 + %88 = OpImageSampleImplicitLod %7 %83 %87 + %91 = OpCompositeExtract %6 %88 1 + %92 = OpCompositeExtract %6 %88 2 + %93 = OpCompositeExtract %6 %88 3 + %94 = OpCompositeConstruct %7 %78 %91 %92 %93 + OpStore %76 %94 + OpBranch %95 + %95 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# tex +SAMPLER variant_tex + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-multiple-fragcoord-conditions-never-return-color-uninitialized.amber b/vulkan/amber/graphicsfuzz/cov-multiple-fragcoord-conditions-never-return-color-uninitialized.amber new file mode 100644 index 0000000..8d25a56 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-multiple-fragcoord-conditions-never-return-color-uninitialized.amber @@ -0,0 +1,254 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [10, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of one: 1.0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# float one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always false. +# if(one > _float_1_0) +# { +# return; +# } +# +# // Always false. +# if(gl_FragCoord.x < 0.0) +# { +# if(gl_FragCoord.x < 0.0) +# { +# return; +# } +# for(int i = _int_0; i < _int_10; i ++) +# { +# if(gl_FragCoord.x < _float_1_0) +# { +# return; +# } +# } +# } +# +# _GLF_color = vec4(1, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 89 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %30 %76 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "buf2" + OpMemberName %7 0 "one" + OpName %9 "" + OpName %18 "buf0" + OpMemberName %18 0 "_GLF_uniform_float_values" + OpName %20 "" + OpName %30 "gl_FragCoord" + OpName %49 "buf1" + OpMemberName %49 0 "_GLF_uniform_int_values" + OpName %51 "" + OpName %76 "_GLF_color" + OpMemberDecorate %7 0 Offset 0 + OpDecorate %7 Block + OpDecorate %9 DescriptorSet 0 + OpDecorate %9 Binding 2 + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %30 BuiltIn FragCoord + OpDecorate %48 ArrayStride 16 + OpMemberDecorate %49 0 Offset 0 + OpDecorate %49 Block + OpDecorate %51 DescriptorSet 0 + OpDecorate %51 Binding 1 + OpDecorate %76 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Uniform %7 + %9 = OpVariable %8 Uniform + %10 = OpTypeInt 32 1 + %11 = OpConstant %10 0 + %12 = OpTypePointer Uniform %6 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 1 + %17 = OpTypeArray %6 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %23 = OpTypeBool + %28 = OpTypeVector %6 4 + %29 = OpTypePointer Input %28 + %30 = OpVariable %29 Input + %31 = OpConstant %15 0 + %32 = OpTypePointer Input %6 + %35 = OpConstant %6 0 + %47 = OpConstant %15 2 + %48 = OpTypeArray %10 %47 + %49 = OpTypeStruct %48 + %50 = OpTypePointer Uniform %49 + %51 = OpVariable %50 Uniform + %52 = OpConstant %10 1 + %53 = OpTypePointer Uniform %10 + %75 = OpTypePointer Output %28 + %76 = OpVariable %75 Output + %77 = OpConstant %6 1 + %78 = OpConstantComposite %28 %77 %35 %35 %77 + %81 = OpConstantFalse %23 + %84 = OpConstantTrue %23 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %79 None + OpSwitch %31 %80 + %80 = OpLabel + %13 = OpAccessChain %12 %9 %11 + %14 = OpLoad %6 %13 + %21 = OpAccessChain %12 %20 %11 %11 + %22 = OpLoad %6 %21 + %24 = OpFOrdGreaterThan %23 %14 %22 + OpSelectionMerge %26 None + OpBranchConditional %24 %25 %26 + %25 = OpLabel + OpBranch %79 + %26 = OpLabel + %33 = OpAccessChain %32 %30 %31 + %34 = OpLoad %6 %33 + %36 = OpFOrdLessThan %23 %34 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + OpSelectionMerge %43 None + OpBranchConditional %36 %42 %43 + %42 = OpLabel + OpBranch %79 + %43 = OpLabel + %54 = OpAccessChain %53 %51 %11 %52 + %55 = OpLoad %10 %54 + OpBranch %56 + %56 = OpLabel + %87 = OpPhi %10 %55 %43 %74 %59 + %62 = OpAccessChain %53 %51 %11 %11 + %63 = OpLoad %10 %62 + %64 = OpSLessThan %23 %87 %63 + OpLoopMerge %58 %59 None + OpBranchConditional %64 %57 %58 + %57 = OpLabel + %69 = OpFOrdLessThan %23 %34 %22 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %71 + %70 = OpLabel + OpBranch %58 + %71 = OpLabel + OpBranch %59 + %59 = OpLabel + %74 = OpIAdd %10 %87 %52 + OpBranch %56 + %58 = OpLabel + %88 = OpPhi %23 %81 %56 %84 %70 + OpSelectionMerge %85 None + OpBranchConditional %88 %79 %85 + %85 = OpLabel + OpBranch %38 + %38 = OpLabel + OpStore %76 %78 + OpBranch %79 + %79 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-multiple-functions-global-never-change.amber b/vulkan/amber/graphicsfuzz/cov-multiple-functions-global-never-change.amber new file mode 100644 index 0000000..786e71f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-multiple-functions-global-never-change.amber @@ -0,0 +1,666 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_100 _GLF_uniform_int_values[2] +# #define _int_30 _GLF_uniform_int_values[3] +# #define _int_6 _GLF_uniform_int_values[4] +# #define _int_35 _GLF_uniform_int_values[5] +# #define _int_8 _GLF_uniform_int_values[6] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 100, 30, 6, 35, 8] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[7]; +# }; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int arr[10] = int[10](1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +# +# void func0(int x) +# { +# int a = _int_1; +# +# for(int i = 0; i < 4; i ++) +# { +# // Always false. +# if(x == 1) +# { +# return; +# } +# +# // a stays at value one. +# a = arr[a]; +# +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# frexp(1.0, x); +# +# for(int j = _int_8; a < 10; j ++) +# { +# if(float[10](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0)[a] > _float_0_0) +# { +# a = j; +# } +# } +# } +# } +# } +# +# // This value never changes. +# float f = 1.0; +# +# // This function always returns vec3(1, 1, 1). +# vec3 func1(vec2 v) +# { +# if(v.x > _float_1_0) +# { +# return vec3(_int_1); +# } +# +# if(v.y < _float_1_0) +# { +# // f stays at value one. +# f = min(_float_1_0, f); +# +# return vec3(_int_1, _int_1, f); +# } +# +# if(v.y > _float_1_0) +# { +# // f stays at value one. +# f = clamp(_float_1_0, _float_1_0, f); +# } +# +# return vec3(_int_1); +# } +# +# // This function is always called with a zero matrix +# // and always returns vec3(1, 1, 1). +# vec3 func2(mat2 m) +# { +# func0(_int_6); +# func0(30); +# +# // v0 = vec2(0, 0). +# vec2 v0 = vec2(_float_1_0) * m; +# vec3 v1 = vec3(_float_1_0); +# +# for(int i = _int_0; i < _int_35; i ++) +# { +# // v2 = vec3(1, 1, 1); +# vec3 v2 = func1(v0); +# +# // Always false. +# if(length(v2) <= _float_1_0) +# { +# continue; +# } +# +# // v1 stays at value (1, 1, 1). +# v1 = v2; +# } +# +# +# return v1; +# } +# +# void main() +# { +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# return; +# } +# +# // v = vec3(1, 1, 1). +# vec3 v = func2(mat2(_float_0_0, cos(_float_0_0), _float_0_0, _float_0_0)); +# func2(mat2(_int_0)); +# func0(_int_100); +# func0(_int_30); +# func2(mat2(_int_0)); +# +# // Always true. +# if(f == _float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(v, _int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 318 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %295 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func0(i1;" + OpName %9 "x" + OpName %18 "func1(vf2;" + OpName %17 "v" + OpName %24 "func2(mf22;" + OpName %23 "m" + OpName %30 "arr" + OpName %34 "f" + OpName %36 "a" + OpName %39 "buf1" + OpMemberName %39 0 "_GLF_uniform_int_values" + OpName %41 "" + OpName %46 "i" + OpName %65 "buf2" + OpMemberName %65 0 "injectionSwitch" + OpName %67 "" + OpName %78 "ResType" + OpName %82 "j" + OpName %96 "buf0" + OpMemberName %96 0 "_GLF_uniform_float_values" + OpName %98 "" + OpName %123 "indexable" + OpName %188 "param" + OpName %193 "param" + OpName %195 "v0" + OpName %202 "v1" + OpName %206 "i" + OpName %219 "v2" + OpName %220 "param" + OpName %245 "v" + OpName %259 "param" + OpName %267 "param" + OpName %270 "param" + OpName %275 "param" + OpName %285 "param" + OpName %295 "_GLF_color" + OpDecorate %38 ArrayStride 16 + OpMemberDecorate %39 0 Offset 0 + OpDecorate %39 Block + OpDecorate %41 DescriptorSet 0 + OpDecorate %41 Binding 1 + OpMemberDecorate %65 0 Offset 0 + OpDecorate %65 Block + OpDecorate %67 DescriptorSet 0 + OpDecorate %67 Binding 2 + OpDecorate %95 ArrayStride 16 + OpMemberDecorate %96 0 Offset 0 + OpDecorate %96 Block + OpDecorate %98 DescriptorSet 0 + OpDecorate %98 Binding 0 + OpDecorate %295 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 + %12 = OpTypeFloat 32 + %13 = OpTypeVector %12 2 + %14 = OpTypePointer Function %13 + %15 = OpTypeVector %12 3 + %16 = OpTypeFunction %15 %14 + %20 = OpTypeMatrix %13 2 + %21 = OpTypePointer Function %20 + %22 = OpTypeFunction %15 %21 + %26 = OpTypeInt 32 0 + %27 = OpConstant %26 10 + %28 = OpTypeArray %6 %27 + %29 = OpTypePointer Private %28 + %30 = OpVariable %29 Private + %31 = OpConstant %6 1 + %32 = OpConstantComposite %28 %31 %31 %31 %31 %31 %31 %31 %31 %31 %31 + %33 = OpTypePointer Private %12 + %34 = OpVariable %33 Private + %35 = OpConstant %12 1 + %37 = OpConstant %26 7 + %38 = OpTypeArray %6 %37 + %39 = OpTypeStruct %38 + %40 = OpTypePointer Uniform %39 + %41 = OpVariable %40 Uniform + %42 = OpConstant %6 0 + %43 = OpTypePointer Uniform %6 + %53 = OpConstant %6 4 + %54 = OpTypeBool + %62 = OpTypePointer Private %6 + %65 = OpTypeStruct %13 + %66 = OpTypePointer Uniform %65 + %67 = OpVariable %66 Uniform + %68 = OpConstant %26 0 + %69 = OpTypePointer Uniform %12 + %72 = OpConstant %26 1 + %78 = OpTypeStruct %12 %6 + %83 = OpConstant %6 6 + %92 = OpConstant %6 10 + %94 = OpConstant %26 2 + %95 = OpTypeArray %12 %94 + %96 = OpTypeStruct %95 + %97 = OpTypePointer Uniform %96 + %98 = OpVariable %97 Uniform + %119 = OpTypeArray %12 %27 + %122 = OpTypePointer Function %119 + %124 = OpTypePointer Function %12 + %192 = OpConstant %6 30 + %201 = OpTypePointer Function %15 + %215 = OpConstant %6 5 + %255 = OpConstant %12 0 + %269 = OpConstant %6 2 + %274 = OpConstant %6 3 + %293 = OpTypeVector %12 4 + %294 = OpTypePointer Output %293 + %295 = OpVariable %294 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %245 = OpVariable %201 Function + %259 = OpVariable %21 Function + %267 = OpVariable %21 Function + %270 = OpVariable %7 Function + %275 = OpVariable %7 Function + %285 = OpVariable %21 Function + OpStore %30 %32 + OpStore %34 %35 + %237 = OpAccessChain %69 %67 %42 %68 + %238 = OpLoad %12 %237 + %239 = OpAccessChain %69 %67 %42 %72 + %240 = OpLoad %12 %239 + %241 = OpFOrdGreaterThan %54 %238 %240 + OpSelectionMerge %243 None + OpBranchConditional %241 %242 %243 + %242 = OpLabel + OpReturn + %243 = OpLabel + %246 = OpAccessChain %69 %98 %42 %31 + %247 = OpLoad %12 %246 + %248 = OpAccessChain %69 %98 %42 %31 + %249 = OpLoad %12 %248 + %250 = OpExtInst %12 %1 Cos %249 + %251 = OpAccessChain %69 %98 %42 %31 + %252 = OpLoad %12 %251 + %253 = OpAccessChain %69 %98 %42 %31 + %254 = OpLoad %12 %253 + %256 = OpCompositeConstruct %13 %247 %250 + %257 = OpCompositeConstruct %13 %252 %254 + %258 = OpCompositeConstruct %20 %256 %257 + OpStore %259 %258 + %260 = OpFunctionCall %15 %24 %259 + OpStore %245 %260 + %261 = OpAccessChain %43 %41 %42 %31 + %262 = OpLoad %6 %261 + %263 = OpConvertSToF %12 %262 + %264 = OpCompositeConstruct %13 %263 %255 + %265 = OpCompositeConstruct %13 %255 %263 + %266 = OpCompositeConstruct %20 %264 %265 + OpStore %267 %266 + %268 = OpFunctionCall %15 %24 %267 + %271 = OpAccessChain %43 %41 %42 %269 + %272 = OpLoad %6 %271 + OpStore %270 %272 + %273 = OpFunctionCall %2 %10 %270 + %276 = OpAccessChain %43 %41 %42 %274 + %277 = OpLoad %6 %276 + OpStore %275 %277 + %278 = OpFunctionCall %2 %10 %275 + %279 = OpAccessChain %43 %41 %42 %31 + %280 = OpLoad %6 %279 + %281 = OpConvertSToF %12 %280 + %282 = OpCompositeConstruct %13 %281 %255 + %283 = OpCompositeConstruct %13 %255 %281 + %284 = OpCompositeConstruct %20 %282 %283 + OpStore %285 %284 + %286 = OpFunctionCall %15 %24 %285 + %287 = OpLoad %12 %34 + %288 = OpAccessChain %69 %98 %42 %42 + %289 = OpLoad %12 %288 + %290 = OpFOrdEqual %54 %287 %289 + OpSelectionMerge %292 None + OpBranchConditional %290 %291 %309 + %291 = OpLabel + %296 = OpAccessChain %43 %41 %42 %42 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %12 %297 + %299 = OpAccessChain %43 %41 %42 %31 + %300 = OpLoad %6 %299 + %301 = OpConvertSToF %12 %300 + %302 = OpAccessChain %43 %41 %42 %31 + %303 = OpLoad %6 %302 + %304 = OpConvertSToF %12 %303 + %305 = OpAccessChain %43 %41 %42 %42 + %306 = OpLoad %6 %305 + %307 = OpConvertSToF %12 %306 + %308 = OpCompositeConstruct %293 %298 %301 %304 %307 + OpStore %295 %308 + OpBranch %292 + %309 = OpLabel + %310 = OpLoad %15 %245 + %311 = OpAccessChain %43 %41 %42 %31 + %312 = OpLoad %6 %311 + %313 = OpConvertSToF %12 %312 + %314 = OpCompositeExtract %12 %310 0 + %315 = OpCompositeExtract %12 %310 1 + %316 = OpCompositeExtract %12 %310 2 + %317 = OpCompositeConstruct %293 %314 %315 %316 %313 + OpStore %295 %317 + OpBranch %292 + %292 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %36 = OpVariable %7 Function + %46 = OpVariable %7 Function + %82 = OpVariable %7 Function + %123 = OpVariable %122 Function + %44 = OpAccessChain %43 %41 %42 %42 + %45 = OpLoad %6 %44 + OpStore %36 %45 + OpStore %46 %42 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %6 %46 + %55 = OpSLessThan %54 %52 %53 + OpBranchConditional %55 %48 %49 + %48 = OpLabel + %56 = OpLoad %6 %9 + %57 = OpIEqual %54 %56 %31 + OpSelectionMerge %59 None + OpBranchConditional %57 %58 %59 + %58 = OpLabel + OpReturn + %59 = OpLabel + %61 = OpLoad %6 %36 + %63 = OpAccessChain %62 %30 %61 + %64 = OpLoad %6 %63 + OpStore %36 %64 + %70 = OpAccessChain %69 %67 %42 %68 + %71 = OpLoad %12 %70 + %73 = OpAccessChain %69 %67 %42 %72 + %74 = OpLoad %12 %73 + %75 = OpFOrdGreaterThan %54 %71 %74 + OpSelectionMerge %77 None + OpBranchConditional %75 %76 %77 + %76 = OpLabel + %79 = OpExtInst %78 %1 FrexpStruct %35 + %80 = OpCompositeExtract %6 %79 1 + OpStore %9 %80 + %81 = OpCompositeExtract %12 %79 0 + %84 = OpAccessChain %43 %41 %42 %83 + %85 = OpLoad %6 %84 + OpStore %82 %85 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %6 %36 + %93 = OpSLessThan %54 %91 %92 + OpBranchConditional %93 %87 %88 + %87 = OpLabel + %99 = OpAccessChain %69 %98 %42 %42 + %100 = OpLoad %12 %99 + %101 = OpAccessChain %69 %98 %42 %42 + %102 = OpLoad %12 %101 + %103 = OpAccessChain %69 %98 %42 %42 + %104 = OpLoad %12 %103 + %105 = OpAccessChain %69 %98 %42 %42 + %106 = OpLoad %12 %105 + %107 = OpAccessChain %69 %98 %42 %42 + %108 = OpLoad %12 %107 + %109 = OpAccessChain %69 %98 %42 %42 + %110 = OpLoad %12 %109 + %111 = OpAccessChain %69 %98 %42 %42 + %112 = OpLoad %12 %111 + %113 = OpAccessChain %69 %98 %42 %42 + %114 = OpLoad %12 %113 + %115 = OpAccessChain %69 %98 %42 %42 + %116 = OpLoad %12 %115 + %117 = OpAccessChain %69 %98 %42 %42 + %118 = OpLoad %12 %117 + %120 = OpCompositeConstruct %119 %100 %102 %104 %106 %108 %110 %112 %114 %116 %118 + %121 = OpLoad %6 %36 + OpStore %123 %120 + %125 = OpAccessChain %124 %123 %121 + %126 = OpLoad %12 %125 + %127 = OpAccessChain %69 %98 %42 %31 + %128 = OpLoad %12 %127 + %129 = OpFOrdGreaterThan %54 %126 %128 + OpSelectionMerge %131 None + OpBranchConditional %129 %130 %131 + %130 = OpLabel + %132 = OpLoad %6 %82 + OpStore %36 %132 + OpBranch %131 + %131 = OpLabel + OpBranch %89 + %89 = OpLabel + %133 = OpLoad %6 %82 + %134 = OpIAdd %6 %133 %31 + OpStore %82 %134 + OpBranch %86 + %88 = OpLabel + OpBranch %77 + %77 = OpLabel + OpBranch %50 + %50 = OpLabel + %135 = OpLoad %6 %46 + %136 = OpIAdd %6 %135 %31 + OpStore %46 %136 + OpBranch %47 + %49 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpFunction %15 None %16 + %17 = OpFunctionParameter %14 + %19 = OpLabel + %137 = OpAccessChain %124 %17 %68 + %138 = OpLoad %12 %137 + %139 = OpAccessChain %69 %98 %42 %42 + %140 = OpLoad %12 %139 + %141 = OpFOrdGreaterThan %54 %138 %140 + OpSelectionMerge %143 None + OpBranchConditional %141 %142 %143 + %142 = OpLabel + %144 = OpAccessChain %43 %41 %42 %42 + %145 = OpLoad %6 %144 + %146 = OpConvertSToF %12 %145 + %147 = OpCompositeConstruct %15 %146 %146 %146 + OpReturnValue %147 + %143 = OpLabel + %149 = OpAccessChain %124 %17 %72 + %150 = OpLoad %12 %149 + %151 = OpAccessChain %69 %98 %42 %42 + %152 = OpLoad %12 %151 + %153 = OpFOrdLessThan %54 %150 %152 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %156 = OpAccessChain %69 %98 %42 %42 + %157 = OpLoad %12 %156 + %158 = OpLoad %12 %34 + %159 = OpExtInst %12 %1 FMin %157 %158 + OpStore %34 %159 + %160 = OpAccessChain %43 %41 %42 %42 + %161 = OpLoad %6 %160 + %162 = OpConvertSToF %12 %161 + %163 = OpAccessChain %43 %41 %42 %42 + %164 = OpLoad %6 %163 + %165 = OpConvertSToF %12 %164 + %166 = OpLoad %12 %34 + %167 = OpCompositeConstruct %15 %162 %165 %166 + OpReturnValue %167 + %155 = OpLabel + %169 = OpAccessChain %124 %17 %72 + %170 = OpLoad %12 %169 + %171 = OpAccessChain %69 %98 %42 %42 + %172 = OpLoad %12 %171 + %173 = OpFOrdGreaterThan %54 %170 %172 + OpSelectionMerge %175 None + OpBranchConditional %173 %174 %175 + %174 = OpLabel + %176 = OpAccessChain %69 %98 %42 %42 + %177 = OpLoad %12 %176 + %178 = OpAccessChain %69 %98 %42 %42 + %179 = OpLoad %12 %178 + %180 = OpLoad %12 %34 + %181 = OpExtInst %12 %1 FClamp %177 %179 %180 + OpStore %34 %181 + OpBranch %175 + %175 = OpLabel + %182 = OpAccessChain %43 %41 %42 %42 + %183 = OpLoad %6 %182 + %184 = OpConvertSToF %12 %183 + %185 = OpCompositeConstruct %15 %184 %184 %184 + OpReturnValue %185 + OpFunctionEnd + %24 = OpFunction %15 None %22 + %23 = OpFunctionParameter %21 + %25 = OpLabel + %188 = OpVariable %7 Function + %193 = OpVariable %7 Function + %195 = OpVariable %14 Function + %202 = OpVariable %201 Function + %206 = OpVariable %7 Function + %219 = OpVariable %201 Function + %220 = OpVariable %14 Function + %189 = OpAccessChain %43 %41 %42 %53 + %190 = OpLoad %6 %189 + OpStore %188 %190 + %191 = OpFunctionCall %2 %10 %188 + OpStore %193 %192 + %194 = OpFunctionCall %2 %10 %193 + %196 = OpAccessChain %69 %98 %42 %42 + %197 = OpLoad %12 %196 + %198 = OpCompositeConstruct %13 %197 %197 + %199 = OpLoad %20 %23 + %200 = OpVectorTimesMatrix %13 %198 %199 + OpStore %195 %200 + %203 = OpAccessChain %69 %98 %42 %42 + %204 = OpLoad %12 %203 + %205 = OpCompositeConstruct %15 %204 %204 %204 + OpStore %202 %205 + %207 = OpAccessChain %43 %41 %42 %31 + %208 = OpLoad %6 %207 + OpStore %206 %208 + OpBranch %209 + %209 = OpLabel + OpLoopMerge %211 %212 None + OpBranch %213 + %213 = OpLabel + %214 = OpLoad %6 %206 + %216 = OpAccessChain %43 %41 %42 %215 + %217 = OpLoad %6 %216 + %218 = OpSLessThan %54 %214 %217 + OpBranchConditional %218 %210 %211 + %210 = OpLabel + %221 = OpLoad %13 %195 + OpStore %220 %221 + %222 = OpFunctionCall %15 %18 %220 + OpStore %219 %222 + %223 = OpLoad %15 %219 + %224 = OpExtInst %12 %1 Length %223 + %225 = OpAccessChain %69 %98 %42 %42 + %226 = OpLoad %12 %225 + %227 = OpFOrdLessThanEqual %54 %224 %226 + OpSelectionMerge %229 None + OpBranchConditional %227 %228 %229 + %228 = OpLabel + OpBranch %212 + %229 = OpLabel + %231 = OpLoad %15 %219 + OpStore %202 %231 + OpBranch %212 + %212 = OpLabel + %232 = OpLoad %6 %206 + %233 = OpIAdd %6 %232 %31 + OpStore %206 %233 + OpBranch %209 + %211 = OpLabel + %234 = OpLoad %15 %202 + OpReturnValue %234 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 100 30 6 35 8 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-multiple-loops-same-condition-always-false-global-loop-counter.amber b/vulkan/amber/graphicsfuzz/cov-multiple-loops-same-condition-always-false-global-loop-counter.amber new file mode 100644 index 0000000..1187336 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-multiple-loops-same-condition-always-false-global-loop-counter.amber @@ -0,0 +1,277 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of one: 1.0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# float one; +# }; +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# +# // Always false. +# if(one < _float_1_0) +# { +# } +# else +# { +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# } +# else +# { +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# return; +# } +# } +# } +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# } +# +# // Always true. +# if(_GLF_global_loop_count == _GLF_global_loop_bound) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 87 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 %44 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %13 "_GLF_color" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %25 "buf2" + OpMemberName %25 0 "one" + OpName %27 "" + OpName %33 "buf1" + OpMemberName %33 0 "_GLF_uniform_float_values" + OpName %35 "" + OpName %44 "gl_FragCoord" + OpDecorate %13 Location 0 + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 2 + OpDecorate %32 ArrayStride 16 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 1 + OpDecorate %44 BuiltIn FragCoord + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Output %11 + %13 = OpVariable %12 Output + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 2 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypePointer Uniform %6 + %25 = OpTypeStruct %10 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypePointer Uniform %10 + %31 = OpConstant %14 1 + %32 = OpTypeArray %10 %31 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %38 = OpTypeBool + %43 = OpTypePointer Input %11 + %44 = OpVariable %43 Input + %45 = OpTypePointer Input %10 + %48 = OpConstant %10 0 + %65 = OpConstant %6 10 + %68 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %8 %9 + %21 = OpAccessChain %20 %19 %9 %9 + %22 = OpLoad %6 %21 + %23 = OpConvertSToF %10 %22 + %24 = OpCompositeConstruct %11 %23 %23 %23 %23 + OpStore %13 %24 + %29 = OpAccessChain %28 %27 %9 + %30 = OpLoad %10 %29 + %36 = OpAccessChain %28 %35 %9 %9 + %37 = OpLoad %10 %36 + %39 = OpFOrdLessThan %38 %30 %37 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %42 + %40 = OpLabel + OpBranch %41 + %42 = OpLabel + %46 = OpAccessChain %45 %44 %31 + %47 = OpLoad %10 %46 + %49 = OpFOrdLessThan %38 %47 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %52 + %50 = OpLabel + OpBranch %51 + %52 = OpLabel + %53 = OpAccessChain %45 %44 %31 + %54 = OpLoad %10 %53 + %55 = OpFOrdLessThan %38 %54 %48 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %57 + %56 = OpLabel + OpReturn + %57 = OpLabel + OpBranch %51 + %51 = OpLabel + OpBranch %41 + %41 = OpLabel + OpBranch %59 + %59 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + %64 = OpLoad %6 %8 + %66 = OpSLessThan %38 %64 %65 + OpBranchConditional %66 %60 %61 + %60 = OpLabel + %67 = OpLoad %6 %8 + %69 = OpIAdd %6 %67 %68 + OpStore %8 %69 + OpBranch %62 + %62 = OpLabel + OpBranch %59 + %61 = OpLabel + %70 = OpLoad %6 %8 + %71 = OpIEqual %38 %70 %65 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %73 + %72 = OpLabel + %74 = OpAccessChain %20 %19 %9 %68 + %75 = OpLoad %6 %74 + %76 = OpConvertSToF %10 %75 + %77 = OpAccessChain %20 %19 %9 %9 + %78 = OpLoad %6 %77 + %79 = OpConvertSToF %10 %78 + %80 = OpAccessChain %20 %19 %9 %9 + %81 = OpLoad %6 %80 + %82 = OpConvertSToF %10 %81 + %83 = OpAccessChain %20 %19 %9 %68 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %10 %84 + %86 = OpCompositeConstruct %11 %76 %79 %82 %85 + OpStore %13 %86 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float STD140 DATA + 1.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices.amber b/vulkan/amber/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices.amber new file mode 100644 index 0000000..c9540cf --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices.amber @@ -0,0 +1,1056 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define LOOP for (int i = 0; i < 1; i++) +# +# precision highp int; +# precision highp float; +# +# const int _GLF_global_loop_bound = 100; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat2x3 m23 = mat2x3(0); +# mat2x4 m24 = mat2x4(0); +# mat3x2 m32 = mat3x2(0); +# mat3 m33 = mat3(0); +# mat3x4 m34 = mat3x4(0); +# mat4x2 m42 = mat4x2(0); +# mat4x3 m43 = mat4x3(0); +# mat4 m44 = mat4(0); +# +# // Each loop iterates just once. +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# LOOP { LOOP { LOOP { LOOP { LOOP { +# // Run until _GLF_global_loop_bound is 98. +# do +# { +# _GLF_global_loop_count++; +# } +# while(_GLF_global_loop_count < _GLF_global_loop_bound - 2); +# +# // Write one to the first matrix element. +# m23[i][i] = 1.0; +# m24[i][i] = 1.0; +# m32[i][i] = 1.0; +# m33[i][i] = 1.0; +# m34[i][i] = 1.0; +# m42[i][i] = 1.0; +# m43[i][i] = 1.0; +# m44[i][i] = 1.0; +# } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } +# +# float sum = 0.0; +# // Iterate twice. The first iteration reads one and the second zero. +# for(int r = 0; _GLF_global_loop_count < _GLF_global_loop_bound; r++) +# { +# _GLF_global_loop_count++; +# sum += m23[0][r]; +# sum += m24[0][r]; +# sum += m32[0][r]; +# sum += m33[0][r]; +# sum += m34[0][r]; +# sum += m42[0][r]; +# sum += m43[0][r]; +# sum += m44[0][r]; +# } +# +# // Always true. +# if (sum == 8.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 531 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %528 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %14 "m23" + OpName %21 "m24" + OpName %27 "m32" + OpName %32 "m33" + OpName %36 "m34" + OpName %40 "m42" + OpName %44 "m43" + OpName %48 "m44" + OpName %51 "i" + OpName %61 "i" + OpName %69 "i" + OpName %77 "i" + OpName %85 "i" + OpName %93 "i" + OpName %101 "i" + OpName %109 "i" + OpName %117 "i" + OpName %125 "i" + OpName %133 "i" + OpName %141 "i" + OpName %149 "i" + OpName %157 "i" + OpName %165 "i" + OpName %173 "i" + OpName %181 "i" + OpName %189 "i" + OpName %197 "i" + OpName %205 "i" + OpName %213 "i" + OpName %221 "i" + OpName %229 "i" + OpName %237 "i" + OpName %245 "i" + OpName %253 "i" + OpName %261 "i" + OpName %269 "i" + OpName %277 "i" + OpName %285 "i" + OpName %293 "i" + OpName %301 "i" + OpName %309 "i" + OpName %317 "i" + OpName %325 "i" + OpName %333 "i" + OpName %341 "i" + OpName %349 "i" + OpName %468 "sum" + OpName %469 "r" + OpName %528 "_GLF_color" + OpDecorate %528 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 3 + %12 = OpTypeMatrix %11 2 + %13 = OpTypePointer Function %12 + %15 = OpConstant %10 0 + %16 = OpConstantComposite %11 %15 %15 %15 + %17 = OpConstantComposite %12 %16 %16 + %18 = OpTypeVector %10 4 + %19 = OpTypeMatrix %18 2 + %20 = OpTypePointer Function %19 + %22 = OpConstantComposite %18 %15 %15 %15 %15 + %23 = OpConstantComposite %19 %22 %22 + %24 = OpTypeVector %10 2 + %25 = OpTypeMatrix %24 3 + %26 = OpTypePointer Function %25 + %28 = OpConstantComposite %24 %15 %15 + %29 = OpConstantComposite %25 %28 %28 %28 + %30 = OpTypeMatrix %11 3 + %31 = OpTypePointer Function %30 + %33 = OpConstantComposite %30 %16 %16 %16 + %34 = OpTypeMatrix %18 3 + %35 = OpTypePointer Function %34 + %37 = OpConstantComposite %34 %22 %22 %22 + %38 = OpTypeMatrix %24 4 + %39 = OpTypePointer Function %38 + %41 = OpConstantComposite %38 %28 %28 %28 %28 + %42 = OpTypeMatrix %11 4 + %43 = OpTypePointer Function %42 + %45 = OpConstantComposite %42 %16 %16 %16 %16 + %46 = OpTypeMatrix %18 4 + %47 = OpTypePointer Function %46 + %49 = OpConstantComposite %46 %22 %22 %22 %22 + %50 = OpTypePointer Function %6 + %58 = OpConstant %6 1 + %59 = OpTypeBool + %364 = OpConstant %6 98 + %368 = OpConstant %10 1 + %369 = OpTypePointer Function %10 + %476 = OpConstant %6 100 + %523 = OpConstant %10 8 + %527 = OpTypePointer Output %18 + %528 = OpVariable %527 Output + %529 = OpConstantComposite %18 %368 %15 %15 %368 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpVariable %13 Function + %21 = OpVariable %20 Function + %27 = OpVariable %26 Function + %32 = OpVariable %31 Function + %36 = OpVariable %35 Function + %40 = OpVariable %39 Function + %44 = OpVariable %43 Function + %48 = OpVariable %47 Function + %51 = OpVariable %50 Function + %61 = OpVariable %50 Function + %69 = OpVariable %50 Function + %77 = OpVariable %50 Function + %85 = OpVariable %50 Function + %93 = OpVariable %50 Function + %101 = OpVariable %50 Function + %109 = OpVariable %50 Function + %117 = OpVariable %50 Function + %125 = OpVariable %50 Function + %133 = OpVariable %50 Function + %141 = OpVariable %50 Function + %149 = OpVariable %50 Function + %157 = OpVariable %50 Function + %165 = OpVariable %50 Function + %173 = OpVariable %50 Function + %181 = OpVariable %50 Function + %189 = OpVariable %50 Function + %197 = OpVariable %50 Function + %205 = OpVariable %50 Function + %213 = OpVariable %50 Function + %221 = OpVariable %50 Function + %229 = OpVariable %50 Function + %237 = OpVariable %50 Function + %245 = OpVariable %50 Function + %253 = OpVariable %50 Function + %261 = OpVariable %50 Function + %269 = OpVariable %50 Function + %277 = OpVariable %50 Function + %285 = OpVariable %50 Function + %293 = OpVariable %50 Function + %301 = OpVariable %50 Function + %309 = OpVariable %50 Function + %317 = OpVariable %50 Function + %325 = OpVariable %50 Function + %333 = OpVariable %50 Function + %341 = OpVariable %50 Function + %349 = OpVariable %50 Function + %468 = OpVariable %369 Function + %469 = OpVariable %50 Function + OpStore %8 %9 + OpStore %14 %17 + OpStore %21 %23 + OpStore %27 %29 + OpStore %32 %33 + OpStore %36 %37 + OpStore %40 %41 + OpStore %44 %45 + OpStore %48 %49 + OpStore %51 %9 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %6 %51 + %60 = OpSLessThan %59 %57 %58 + OpBranchConditional %60 %53 %54 + %53 = OpLabel + OpStore %61 %9 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpLoad %6 %61 + %68 = OpSLessThan %59 %67 %58 + OpBranchConditional %68 %63 %64 + %63 = OpLabel + OpStore %69 %9 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %6 %69 + %76 = OpSLessThan %59 %75 %58 + OpBranchConditional %76 %71 %72 + %71 = OpLabel + OpStore %77 %9 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %6 %77 + %84 = OpSLessThan %59 %83 %58 + OpBranchConditional %84 %79 %80 + %79 = OpLabel + OpStore %85 %9 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %6 %85 + %92 = OpSLessThan %59 %91 %58 + OpBranchConditional %92 %87 %88 + %87 = OpLabel + OpStore %93 %9 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %96 %97 None + OpBranch %98 + %98 = OpLabel + %99 = OpLoad %6 %93 + %100 = OpSLessThan %59 %99 %58 + OpBranchConditional %100 %95 %96 + %95 = OpLabel + OpStore %101 %9 + OpBranch %102 + %102 = OpLabel + OpLoopMerge %104 %105 None + OpBranch %106 + %106 = OpLabel + %107 = OpLoad %6 %101 + %108 = OpSLessThan %59 %107 %58 + OpBranchConditional %108 %103 %104 + %103 = OpLabel + OpStore %109 %9 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %115 = OpLoad %6 %109 + %116 = OpSLessThan %59 %115 %58 + OpBranchConditional %116 %111 %112 + %111 = OpLabel + OpStore %117 %9 + OpBranch %118 + %118 = OpLabel + OpLoopMerge %120 %121 None + OpBranch %122 + %122 = OpLabel + %123 = OpLoad %6 %117 + %124 = OpSLessThan %59 %123 %58 + OpBranchConditional %124 %119 %120 + %119 = OpLabel + OpStore %125 %9 + OpBranch %126 + %126 = OpLabel + OpLoopMerge %128 %129 None + OpBranch %130 + %130 = OpLabel + %131 = OpLoad %6 %125 + %132 = OpSLessThan %59 %131 %58 + OpBranchConditional %132 %127 %128 + %127 = OpLabel + OpStore %133 %9 + OpBranch %134 + %134 = OpLabel + OpLoopMerge %136 %137 None + OpBranch %138 + %138 = OpLabel + %139 = OpLoad %6 %133 + %140 = OpSLessThan %59 %139 %58 + OpBranchConditional %140 %135 %136 + %135 = OpLabel + OpStore %141 %9 + OpBranch %142 + %142 = OpLabel + OpLoopMerge %144 %145 None + OpBranch %146 + %146 = OpLabel + %147 = OpLoad %6 %141 + %148 = OpSLessThan %59 %147 %58 + OpBranchConditional %148 %143 %144 + %143 = OpLabel + OpStore %149 %9 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %152 %153 None + OpBranch %154 + %154 = OpLabel + %155 = OpLoad %6 %149 + %156 = OpSLessThan %59 %155 %58 + OpBranchConditional %156 %151 %152 + %151 = OpLabel + OpStore %157 %9 + OpBranch %158 + %158 = OpLabel + OpLoopMerge %160 %161 None + OpBranch %162 + %162 = OpLabel + %163 = OpLoad %6 %157 + %164 = OpSLessThan %59 %163 %58 + OpBranchConditional %164 %159 %160 + %159 = OpLabel + OpStore %165 %9 + OpBranch %166 + %166 = OpLabel + OpLoopMerge %168 %169 None + OpBranch %170 + %170 = OpLabel + %171 = OpLoad %6 %165 + %172 = OpSLessThan %59 %171 %58 + OpBranchConditional %172 %167 %168 + %167 = OpLabel + OpStore %173 %9 + OpBranch %174 + %174 = OpLabel + OpLoopMerge %176 %177 None + OpBranch %178 + %178 = OpLabel + %179 = OpLoad %6 %173 + %180 = OpSLessThan %59 %179 %58 + OpBranchConditional %180 %175 %176 + %175 = OpLabel + OpStore %181 %9 + OpBranch %182 + %182 = OpLabel + OpLoopMerge %184 %185 None + OpBranch %186 + %186 = OpLabel + %187 = OpLoad %6 %181 + %188 = OpSLessThan %59 %187 %58 + OpBranchConditional %188 %183 %184 + %183 = OpLabel + OpStore %189 %9 + OpBranch %190 + %190 = OpLabel + OpLoopMerge %192 %193 None + OpBranch %194 + %194 = OpLabel + %195 = OpLoad %6 %189 + %196 = OpSLessThan %59 %195 %58 + OpBranchConditional %196 %191 %192 + %191 = OpLabel + OpStore %197 %9 + OpBranch %198 + %198 = OpLabel + OpLoopMerge %200 %201 None + OpBranch %202 + %202 = OpLabel + %203 = OpLoad %6 %197 + %204 = OpSLessThan %59 %203 %58 + OpBranchConditional %204 %199 %200 + %199 = OpLabel + OpStore %205 %9 + OpBranch %206 + %206 = OpLabel + OpLoopMerge %208 %209 None + OpBranch %210 + %210 = OpLabel + %211 = OpLoad %6 %205 + %212 = OpSLessThan %59 %211 %58 + OpBranchConditional %212 %207 %208 + %207 = OpLabel + OpStore %213 %9 + OpBranch %214 + %214 = OpLabel + OpLoopMerge %216 %217 None + OpBranch %218 + %218 = OpLabel + %219 = OpLoad %6 %213 + %220 = OpSLessThan %59 %219 %58 + OpBranchConditional %220 %215 %216 + %215 = OpLabel + OpStore %221 %9 + OpBranch %222 + %222 = OpLabel + OpLoopMerge %224 %225 None + OpBranch %226 + %226 = OpLabel + %227 = OpLoad %6 %221 + %228 = OpSLessThan %59 %227 %58 + OpBranchConditional %228 %223 %224 + %223 = OpLabel + OpStore %229 %9 + OpBranch %230 + %230 = OpLabel + OpLoopMerge %232 %233 None + OpBranch %234 + %234 = OpLabel + %235 = OpLoad %6 %229 + %236 = OpSLessThan %59 %235 %58 + OpBranchConditional %236 %231 %232 + %231 = OpLabel + OpStore %237 %9 + OpBranch %238 + %238 = OpLabel + OpLoopMerge %240 %241 None + OpBranch %242 + %242 = OpLabel + %243 = OpLoad %6 %237 + %244 = OpSLessThan %59 %243 %58 + OpBranchConditional %244 %239 %240 + %239 = OpLabel + OpStore %245 %9 + OpBranch %246 + %246 = OpLabel + OpLoopMerge %248 %249 None + OpBranch %250 + %250 = OpLabel + %251 = OpLoad %6 %245 + %252 = OpSLessThan %59 %251 %58 + OpBranchConditional %252 %247 %248 + %247 = OpLabel + OpStore %253 %9 + OpBranch %254 + %254 = OpLabel + OpLoopMerge %256 %257 None + OpBranch %258 + %258 = OpLabel + %259 = OpLoad %6 %253 + %260 = OpSLessThan %59 %259 %58 + OpBranchConditional %260 %255 %256 + %255 = OpLabel + OpStore %261 %9 + OpBranch %262 + %262 = OpLabel + OpLoopMerge %264 %265 None + OpBranch %266 + %266 = OpLabel + %267 = OpLoad %6 %261 + %268 = OpSLessThan %59 %267 %58 + OpBranchConditional %268 %263 %264 + %263 = OpLabel + OpStore %269 %9 + OpBranch %270 + %270 = OpLabel + OpLoopMerge %272 %273 None + OpBranch %274 + %274 = OpLabel + %275 = OpLoad %6 %269 + %276 = OpSLessThan %59 %275 %58 + OpBranchConditional %276 %271 %272 + %271 = OpLabel + OpStore %277 %9 + OpBranch %278 + %278 = OpLabel + OpLoopMerge %280 %281 None + OpBranch %282 + %282 = OpLabel + %283 = OpLoad %6 %277 + %284 = OpSLessThan %59 %283 %58 + OpBranchConditional %284 %279 %280 + %279 = OpLabel + OpStore %285 %9 + OpBranch %286 + %286 = OpLabel + OpLoopMerge %288 %289 None + OpBranch %290 + %290 = OpLabel + %291 = OpLoad %6 %285 + %292 = OpSLessThan %59 %291 %58 + OpBranchConditional %292 %287 %288 + %287 = OpLabel + OpStore %293 %9 + OpBranch %294 + %294 = OpLabel + OpLoopMerge %296 %297 None + OpBranch %298 + %298 = OpLabel + %299 = OpLoad %6 %293 + %300 = OpSLessThan %59 %299 %58 + OpBranchConditional %300 %295 %296 + %295 = OpLabel + OpStore %301 %9 + OpBranch %302 + %302 = OpLabel + OpLoopMerge %304 %305 None + OpBranch %306 + %306 = OpLabel + %307 = OpLoad %6 %301 + %308 = OpSLessThan %59 %307 %58 + OpBranchConditional %308 %303 %304 + %303 = OpLabel + OpStore %309 %9 + OpBranch %310 + %310 = OpLabel + OpLoopMerge %312 %313 None + OpBranch %314 + %314 = OpLabel + %315 = OpLoad %6 %309 + %316 = OpSLessThan %59 %315 %58 + OpBranchConditional %316 %311 %312 + %311 = OpLabel + OpStore %317 %9 + OpBranch %318 + %318 = OpLabel + OpLoopMerge %320 %321 None + OpBranch %322 + %322 = OpLabel + %323 = OpLoad %6 %317 + %324 = OpSLessThan %59 %323 %58 + OpBranchConditional %324 %319 %320 + %319 = OpLabel + OpStore %325 %9 + OpBranch %326 + %326 = OpLabel + OpLoopMerge %328 %329 None + OpBranch %330 + %330 = OpLabel + %331 = OpLoad %6 %325 + %332 = OpSLessThan %59 %331 %58 + OpBranchConditional %332 %327 %328 + %327 = OpLabel + OpStore %333 %9 + OpBranch %334 + %334 = OpLabel + OpLoopMerge %336 %337 None + OpBranch %338 + %338 = OpLabel + %339 = OpLoad %6 %333 + %340 = OpSLessThan %59 %339 %58 + OpBranchConditional %340 %335 %336 + %335 = OpLabel + OpStore %341 %9 + OpBranch %342 + %342 = OpLabel + OpLoopMerge %344 %345 None + OpBranch %346 + %346 = OpLabel + %347 = OpLoad %6 %341 + %348 = OpSLessThan %59 %347 %58 + OpBranchConditional %348 %343 %344 + %343 = OpLabel + OpStore %349 %9 + OpBranch %350 + %350 = OpLabel + OpLoopMerge %352 %353 None + OpBranch %354 + %354 = OpLabel + %355 = OpLoad %6 %349 + %356 = OpSLessThan %59 %355 %58 + OpBranchConditional %356 %351 %352 + %351 = OpLabel + OpBranch %357 + %357 = OpLabel + OpLoopMerge %359 %360 None + OpBranch %358 + %358 = OpLabel + %361 = OpLoad %6 %8 + %362 = OpIAdd %6 %361 %58 + OpStore %8 %362 + OpBranch %360 + %360 = OpLabel + %363 = OpLoad %6 %8 + %365 = OpSLessThan %59 %363 %364 + OpBranchConditional %365 %357 %359 + %359 = OpLabel + %366 = OpLoad %6 %349 + %367 = OpLoad %6 %349 + %370 = OpAccessChain %369 %14 %366 %367 + OpStore %370 %368 + %371 = OpLoad %6 %349 + %372 = OpLoad %6 %349 + %373 = OpAccessChain %369 %21 %371 %372 + OpStore %373 %368 + %374 = OpLoad %6 %349 + %375 = OpLoad %6 %349 + %376 = OpAccessChain %369 %27 %374 %375 + OpStore %376 %368 + %377 = OpLoad %6 %349 + %378 = OpLoad %6 %349 + %379 = OpAccessChain %369 %32 %377 %378 + OpStore %379 %368 + %380 = OpLoad %6 %349 + %381 = OpLoad %6 %349 + %382 = OpAccessChain %369 %36 %380 %381 + OpStore %382 %368 + %383 = OpLoad %6 %349 + %384 = OpLoad %6 %349 + %385 = OpAccessChain %369 %40 %383 %384 + OpStore %385 %368 + %386 = OpLoad %6 %349 + %387 = OpLoad %6 %349 + %388 = OpAccessChain %369 %44 %386 %387 + OpStore %388 %368 + %389 = OpLoad %6 %349 + %390 = OpLoad %6 %349 + %391 = OpAccessChain %369 %48 %389 %390 + OpStore %391 %368 + OpBranch %353 + %353 = OpLabel + %392 = OpLoad %6 %349 + %393 = OpIAdd %6 %392 %58 + OpStore %349 %393 + OpBranch %350 + %352 = OpLabel + OpBranch %345 + %345 = OpLabel + %394 = OpLoad %6 %341 + %395 = OpIAdd %6 %394 %58 + OpStore %341 %395 + OpBranch %342 + %344 = OpLabel + OpBranch %337 + %337 = OpLabel + %396 = OpLoad %6 %333 + %397 = OpIAdd %6 %396 %58 + OpStore %333 %397 + OpBranch %334 + %336 = OpLabel + OpBranch %329 + %329 = OpLabel + %398 = OpLoad %6 %325 + %399 = OpIAdd %6 %398 %58 + OpStore %325 %399 + OpBranch %326 + %328 = OpLabel + OpBranch %321 + %321 = OpLabel + %400 = OpLoad %6 %317 + %401 = OpIAdd %6 %400 %58 + OpStore %317 %401 + OpBranch %318 + %320 = OpLabel + OpBranch %313 + %313 = OpLabel + %402 = OpLoad %6 %309 + %403 = OpIAdd %6 %402 %58 + OpStore %309 %403 + OpBranch %310 + %312 = OpLabel + OpBranch %305 + %305 = OpLabel + %404 = OpLoad %6 %301 + %405 = OpIAdd %6 %404 %58 + OpStore %301 %405 + OpBranch %302 + %304 = OpLabel + OpBranch %297 + %297 = OpLabel + %406 = OpLoad %6 %293 + %407 = OpIAdd %6 %406 %58 + OpStore %293 %407 + OpBranch %294 + %296 = OpLabel + OpBranch %289 + %289 = OpLabel + %408 = OpLoad %6 %285 + %409 = OpIAdd %6 %408 %58 + OpStore %285 %409 + OpBranch %286 + %288 = OpLabel + OpBranch %281 + %281 = OpLabel + %410 = OpLoad %6 %277 + %411 = OpIAdd %6 %410 %58 + OpStore %277 %411 + OpBranch %278 + %280 = OpLabel + OpBranch %273 + %273 = OpLabel + %412 = OpLoad %6 %269 + %413 = OpIAdd %6 %412 %58 + OpStore %269 %413 + OpBranch %270 + %272 = OpLabel + OpBranch %265 + %265 = OpLabel + %414 = OpLoad %6 %261 + %415 = OpIAdd %6 %414 %58 + OpStore %261 %415 + OpBranch %262 + %264 = OpLabel + OpBranch %257 + %257 = OpLabel + %416 = OpLoad %6 %253 + %417 = OpIAdd %6 %416 %58 + OpStore %253 %417 + OpBranch %254 + %256 = OpLabel + OpBranch %249 + %249 = OpLabel + %418 = OpLoad %6 %245 + %419 = OpIAdd %6 %418 %58 + OpStore %245 %419 + OpBranch %246 + %248 = OpLabel + OpBranch %241 + %241 = OpLabel + %420 = OpLoad %6 %237 + %421 = OpIAdd %6 %420 %58 + OpStore %237 %421 + OpBranch %238 + %240 = OpLabel + OpBranch %233 + %233 = OpLabel + %422 = OpLoad %6 %229 + %423 = OpIAdd %6 %422 %58 + OpStore %229 %423 + OpBranch %230 + %232 = OpLabel + OpBranch %225 + %225 = OpLabel + %424 = OpLoad %6 %221 + %425 = OpIAdd %6 %424 %58 + OpStore %221 %425 + OpBranch %222 + %224 = OpLabel + OpBranch %217 + %217 = OpLabel + %426 = OpLoad %6 %213 + %427 = OpIAdd %6 %426 %58 + OpStore %213 %427 + OpBranch %214 + %216 = OpLabel + OpBranch %209 + %209 = OpLabel + %428 = OpLoad %6 %205 + %429 = OpIAdd %6 %428 %58 + OpStore %205 %429 + OpBranch %206 + %208 = OpLabel + OpBranch %201 + %201 = OpLabel + %430 = OpLoad %6 %197 + %431 = OpIAdd %6 %430 %58 + OpStore %197 %431 + OpBranch %198 + %200 = OpLabel + OpBranch %193 + %193 = OpLabel + %432 = OpLoad %6 %189 + %433 = OpIAdd %6 %432 %58 + OpStore %189 %433 + OpBranch %190 + %192 = OpLabel + OpBranch %185 + %185 = OpLabel + %434 = OpLoad %6 %181 + %435 = OpIAdd %6 %434 %58 + OpStore %181 %435 + OpBranch %182 + %184 = OpLabel + OpBranch %177 + %177 = OpLabel + %436 = OpLoad %6 %173 + %437 = OpIAdd %6 %436 %58 + OpStore %173 %437 + OpBranch %174 + %176 = OpLabel + OpBranch %169 + %169 = OpLabel + %438 = OpLoad %6 %165 + %439 = OpIAdd %6 %438 %58 + OpStore %165 %439 + OpBranch %166 + %168 = OpLabel + OpBranch %161 + %161 = OpLabel + %440 = OpLoad %6 %157 + %441 = OpIAdd %6 %440 %58 + OpStore %157 %441 + OpBranch %158 + %160 = OpLabel + OpBranch %153 + %153 = OpLabel + %442 = OpLoad %6 %149 + %443 = OpIAdd %6 %442 %58 + OpStore %149 %443 + OpBranch %150 + %152 = OpLabel + OpBranch %145 + %145 = OpLabel + %444 = OpLoad %6 %141 + %445 = OpIAdd %6 %444 %58 + OpStore %141 %445 + OpBranch %142 + %144 = OpLabel + OpBranch %137 + %137 = OpLabel + %446 = OpLoad %6 %133 + %447 = OpIAdd %6 %446 %58 + OpStore %133 %447 + OpBranch %134 + %136 = OpLabel + OpBranch %129 + %129 = OpLabel + %448 = OpLoad %6 %125 + %449 = OpIAdd %6 %448 %58 + OpStore %125 %449 + OpBranch %126 + %128 = OpLabel + OpBranch %121 + %121 = OpLabel + %450 = OpLoad %6 %117 + %451 = OpIAdd %6 %450 %58 + OpStore %117 %451 + OpBranch %118 + %120 = OpLabel + OpBranch %113 + %113 = OpLabel + %452 = OpLoad %6 %109 + %453 = OpIAdd %6 %452 %58 + OpStore %109 %453 + OpBranch %110 + %112 = OpLabel + OpBranch %105 + %105 = OpLabel + %454 = OpLoad %6 %101 + %455 = OpIAdd %6 %454 %58 + OpStore %101 %455 + OpBranch %102 + %104 = OpLabel + OpBranch %97 + %97 = OpLabel + %456 = OpLoad %6 %93 + %457 = OpIAdd %6 %456 %58 + OpStore %93 %457 + OpBranch %94 + %96 = OpLabel + OpBranch %89 + %89 = OpLabel + %458 = OpLoad %6 %85 + %459 = OpIAdd %6 %458 %58 + OpStore %85 %459 + OpBranch %86 + %88 = OpLabel + OpBranch %81 + %81 = OpLabel + %460 = OpLoad %6 %77 + %461 = OpIAdd %6 %460 %58 + OpStore %77 %461 + OpBranch %78 + %80 = OpLabel + OpBranch %73 + %73 = OpLabel + %462 = OpLoad %6 %69 + %463 = OpIAdd %6 %462 %58 + OpStore %69 %463 + OpBranch %70 + %72 = OpLabel + OpBranch %65 + %65 = OpLabel + %464 = OpLoad %6 %61 + %465 = OpIAdd %6 %464 %58 + OpStore %61 %465 + OpBranch %62 + %64 = OpLabel + OpBranch %55 + %55 = OpLabel + %466 = OpLoad %6 %51 + %467 = OpIAdd %6 %466 %58 + OpStore %51 %467 + OpBranch %52 + %54 = OpLabel + OpStore %468 %15 + OpStore %469 %9 + OpBranch %470 + %470 = OpLabel + OpLoopMerge %472 %473 None + OpBranch %474 + %474 = OpLabel + %475 = OpLoad %6 %8 + %477 = OpSLessThan %59 %475 %476 + OpBranchConditional %477 %471 %472 + %471 = OpLabel + %478 = OpLoad %6 %8 + %479 = OpIAdd %6 %478 %58 + OpStore %8 %479 + %480 = OpLoad %6 %469 + %481 = OpAccessChain %369 %14 %9 %480 + %482 = OpLoad %10 %481 + %483 = OpLoad %10 %468 + %484 = OpFAdd %10 %483 %482 + OpStore %468 %484 + %485 = OpLoad %6 %469 + %486 = OpAccessChain %369 %21 %9 %485 + %487 = OpLoad %10 %486 + %488 = OpLoad %10 %468 + %489 = OpFAdd %10 %488 %487 + OpStore %468 %489 + %490 = OpLoad %6 %469 + %491 = OpAccessChain %369 %27 %9 %490 + %492 = OpLoad %10 %491 + %493 = OpLoad %10 %468 + %494 = OpFAdd %10 %493 %492 + OpStore %468 %494 + %495 = OpLoad %6 %469 + %496 = OpAccessChain %369 %32 %9 %495 + %497 = OpLoad %10 %496 + %498 = OpLoad %10 %468 + %499 = OpFAdd %10 %498 %497 + OpStore %468 %499 + %500 = OpLoad %6 %469 + %501 = OpAccessChain %369 %36 %9 %500 + %502 = OpLoad %10 %501 + %503 = OpLoad %10 %468 + %504 = OpFAdd %10 %503 %502 + OpStore %468 %504 + %505 = OpLoad %6 %469 + %506 = OpAccessChain %369 %40 %9 %505 + %507 = OpLoad %10 %506 + %508 = OpLoad %10 %468 + %509 = OpFAdd %10 %508 %507 + OpStore %468 %509 + %510 = OpLoad %6 %469 + %511 = OpAccessChain %369 %44 %9 %510 + %512 = OpLoad %10 %511 + %513 = OpLoad %10 %468 + %514 = OpFAdd %10 %513 %512 + OpStore %468 %514 + %515 = OpLoad %6 %469 + %516 = OpAccessChain %369 %48 %9 %515 + %517 = OpLoad %10 %516 + %518 = OpLoad %10 %468 + %519 = OpFAdd %10 %518 %517 + OpStore %468 %519 + OpBranch %473 + %473 = OpLabel + %520 = OpLoad %6 %469 + %521 = OpIAdd %6 %520 %58 + OpStore %469 %521 + OpBranch %470 + %472 = OpLabel + %522 = OpLoad %10 %468 + %524 = OpFOrdEqual %59 %522 %523 + OpSelectionMerge %526 None + OpBranchConditional %524 %525 %530 + %525 = OpLabel + OpStore %528 %529 + OpBranch %526 + %530 = OpLabel + OpStore %528 %22 + OpBranch %526 + %526 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-negative-integer-bitwise-or-uniform-increment-loop.amber b/vulkan/amber/graphicsfuzz/cov-negative-integer-bitwise-or-uniform-increment-loop.amber new file mode 100644 index 0000000..52732d8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-negative-integer-bitwise-or-uniform-increment-loop.amber @@ -0,0 +1,200 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_25225 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [10, 25225, 0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# +# // a becomes -25235. +# int a = -25236 | _int_1; +# +# // Increments a by ten. +# for(int i = _int_0; i < _int_10; i++) +# { +# a++; +# } +# +# // Always true. +# if(a == -_int_25225) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 70 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %51 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %22 "i" + OpName %51 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %51 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 -25236 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 4 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %6 0 + %17 = OpConstant %6 3 + %18 = OpTypePointer Uniform %6 + %23 = OpConstant %6 2 + %34 = OpTypeBool + %37 = OpConstant %6 1 + %48 = OpTypeFloat 32 + %49 = OpTypeVector %48 4 + %50 = OpTypePointer Output %49 + %51 = OpVariable %50 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %7 Function + %19 = OpAccessChain %18 %15 %16 %17 + %20 = OpLoad %6 %19 + %21 = OpBitwiseOr %6 %9 %20 + OpStore %8 %21 + %24 = OpAccessChain %18 %15 %16 %23 + %25 = OpLoad %6 %24 + OpStore %22 %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %6 %22 + %32 = OpAccessChain %18 %15 %16 %16 + %33 = OpLoad %6 %32 + %35 = OpSLessThan %34 %31 %33 + OpBranchConditional %35 %27 %28 + %27 = OpLabel + %36 = OpLoad %6 %8 + %38 = OpIAdd %6 %36 %37 + OpStore %8 %38 + OpBranch %29 + %29 = OpLabel + %39 = OpLoad %6 %22 + %40 = OpIAdd %6 %39 %37 + OpStore %22 %40 + OpBranch %26 + %28 = OpLabel + %41 = OpLoad %6 %8 + %42 = OpAccessChain %18 %15 %16 %37 + %43 = OpLoad %6 %42 + %44 = OpSNegate %6 %43 + %45 = OpIEqual %34 %41 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %65 + %46 = OpLabel + %52 = OpAccessChain %18 %15 %16 %17 + %53 = OpLoad %6 %52 + %54 = OpConvertSToF %48 %53 + %55 = OpAccessChain %18 %15 %16 %23 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %48 %56 + %58 = OpAccessChain %18 %15 %16 %23 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %48 %59 + %61 = OpAccessChain %18 %15 %16 %17 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %48 %62 + %64 = OpCompositeConstruct %49 %54 %57 %60 %63 + OpStore %51 %64 + OpBranch %47 + %65 = OpLabel + %66 = OpAccessChain %18 %15 %16 %23 + %67 = OpLoad %6 %66 + %68 = OpConvertSToF %48 %67 + %69 = OpCompositeConstruct %49 %68 %68 %68 %68 + OpStore %51 %69 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 25225 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-functions-accumulate-global-matrix.amber b/vulkan/amber/graphicsfuzz/cov-nested-functions-accumulate-global-matrix.amber new file mode 100644 index 0000000..a3258cd --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-functions-accumulate-global-matrix.amber @@ -0,0 +1,399 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-inserts' +# '--eliminate-dead-branches' +# '--merge-blocks' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_4 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 2, 4, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of one: 1.0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# float one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# mat4x2 m = mat4x2(0.0); +# +# void func0(int x) +# { +# // Always false. +# if (x < 1 || (x > 1 && one > _float_1_0)) +# { +# return; +# } +# +# // Always true. +# if (one == _float_1_0) +# { +# for(int i = 0; i < 2; i ++) +# { +# m[_GLF_MAKE_IN_BOUNDS_INT(x, 4)][i] += _float_1_0; +# } +# } +# } +# +# void func1() +# { +# // Always false. +# if (gl_FragCoord.y < 0.0) +# { +# return; +# } +# +# func0(1); +# } +# +# void main() +# { +# // Called twice causing two of the matrix elements to increase by two. +# func1(); +# func1(); +# +# // Always true. +# if(m == mat4x2(_int_0, _int_0, _int_2, _int_2, _int_0, _int_0, _int_0, _int_0)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 176 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %157 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func0(i1;" + OpName %9 "x" + OpName %12 "func1(" + OpName %18 "m" + OpName %33 "buf2" + OpMemberName %33 0 "one" + OpName %35 "" + OpName %43 "buf0" + OpMemberName %43 0 "_GLF_uniform_float_values" + OpName %45 "" + OpName %61 "i" + OpName %85 "gl_FragCoord" + OpName %93 "param" + OpName %100 "buf1" + OpMemberName %100 0 "_GLF_uniform_int_values" + OpName %102 "" + OpName %157 "_GLF_color" + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 2 + OpDecorate %42 ArrayStride 16 + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpDecorate %99 ArrayStride 16 + OpMemberDecorate %100 0 Offset 0 + OpDecorate %100 Block + OpDecorate %102 DescriptorSet 0 + OpDecorate %102 Binding 1 + OpDecorate %157 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 + %14 = OpTypeFloat 32 + %15 = OpTypeVector %14 2 + %16 = OpTypeMatrix %15 4 + %17 = OpTypePointer Private %16 + %18 = OpVariable %17 Private + %19 = OpConstant %14 0 + %20 = OpConstantComposite %15 %19 %19 + %21 = OpConstantComposite %16 %20 %20 %20 %20 + %22 = OpTypeBool + %24 = OpConstant %6 1 + %33 = OpTypeStruct %14 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpConstant %6 0 + %37 = OpTypePointer Uniform %14 + %40 = OpTypeInt 32 0 + %41 = OpConstant %40 1 + %42 = OpTypeArray %14 %41 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %68 = OpConstant %6 2 + %71 = OpConstant %6 3 + %76 = OpTypePointer Private %14 + %83 = OpTypeVector %14 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %86 = OpTypePointer Input %14 + %98 = OpConstant %40 4 + %99 = OpTypeArray %6 %98 + %100 = OpTypeStruct %99 + %101 = OpTypePointer Uniform %100 + %102 = OpVariable %101 Uniform + %103 = OpTypePointer Uniform %6 + %128 = OpConstant %14 1 + %136 = OpTypeVector %22 2 + %156 = OpTypePointer Output %83 + %157 = OpVariable %156 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %18 %21 + %95 = OpFunctionCall %2 %12 + %96 = OpFunctionCall %2 %12 + %97 = OpLoad %16 %18 + %104 = OpAccessChain %103 %102 %36 %36 + %105 = OpLoad %6 %104 + %106 = OpConvertSToF %14 %105 + %107 = OpAccessChain %103 %102 %36 %36 + %108 = OpLoad %6 %107 + %109 = OpConvertSToF %14 %108 + %110 = OpAccessChain %103 %102 %36 %24 + %111 = OpLoad %6 %110 + %112 = OpConvertSToF %14 %111 + %113 = OpAccessChain %103 %102 %36 %24 + %114 = OpLoad %6 %113 + %115 = OpConvertSToF %14 %114 + %116 = OpAccessChain %103 %102 %36 %36 + %117 = OpLoad %6 %116 + %118 = OpConvertSToF %14 %117 + %119 = OpAccessChain %103 %102 %36 %36 + %120 = OpLoad %6 %119 + %121 = OpConvertSToF %14 %120 + %122 = OpAccessChain %103 %102 %36 %36 + %123 = OpLoad %6 %122 + %124 = OpConvertSToF %14 %123 + %125 = OpAccessChain %103 %102 %36 %36 + %126 = OpLoad %6 %125 + %127 = OpConvertSToF %14 %126 + %129 = OpCompositeConstruct %15 %106 %109 + %130 = OpCompositeConstruct %15 %112 %115 + %131 = OpCompositeConstruct %15 %118 %121 + %132 = OpCompositeConstruct %15 %124 %127 + %133 = OpCompositeConstruct %16 %129 %130 %131 %132 + %134 = OpCompositeExtract %15 %97 0 + %135 = OpCompositeExtract %15 %133 0 + %137 = OpFOrdEqual %136 %134 %135 + %138 = OpAll %22 %137 + %139 = OpCompositeExtract %15 %97 1 + %140 = OpCompositeExtract %15 %133 1 + %141 = OpFOrdEqual %136 %139 %140 + %142 = OpAll %22 %141 + %143 = OpLogicalAnd %22 %138 %142 + %144 = OpCompositeExtract %15 %97 2 + %145 = OpCompositeExtract %15 %133 2 + %146 = OpFOrdEqual %136 %144 %145 + %147 = OpAll %22 %146 + %148 = OpLogicalAnd %22 %143 %147 + %149 = OpCompositeExtract %15 %97 3 + %150 = OpCompositeExtract %15 %133 3 + %151 = OpFOrdEqual %136 %149 %150 + %152 = OpAll %22 %151 + %153 = OpLogicalAnd %22 %148 %152 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %171 + %154 = OpLabel + %158 = OpAccessChain %103 %102 %36 %71 + %159 = OpLoad %6 %158 + %160 = OpConvertSToF %14 %159 + %161 = OpAccessChain %103 %102 %36 %36 + %162 = OpLoad %6 %161 + %163 = OpConvertSToF %14 %162 + %164 = OpAccessChain %103 %102 %36 %36 + %165 = OpLoad %6 %164 + %166 = OpConvertSToF %14 %165 + %167 = OpAccessChain %103 %102 %36 %71 + %168 = OpLoad %6 %167 + %169 = OpConvertSToF %14 %168 + %170 = OpCompositeConstruct %83 %160 %163 %166 %169 + OpStore %157 %170 + OpBranch %155 + %171 = OpLabel + %172 = OpAccessChain %103 %102 %36 %36 + %173 = OpLoad %6 %172 + %174 = OpConvertSToF %14 %173 + %175 = OpCompositeConstruct %83 %174 %174 %174 %174 + OpStore %157 %175 + OpBranch %155 + %155 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %61 = OpVariable %7 Function + %23 = OpLoad %6 %9 + %25 = OpSLessThan %22 %23 %24 + %26 = OpLogicalNot %22 %25 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + %29 = OpLoad %6 %9 + %30 = OpSGreaterThan %22 %29 %24 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + %38 = OpAccessChain %37 %35 %36 + %39 = OpLoad %14 %38 + %46 = OpAccessChain %37 %45 %36 %36 + %47 = OpLoad %14 %46 + %48 = OpFOrdGreaterThan %22 %39 %47 + OpBranch %32 + %32 = OpLabel + %49 = OpPhi %22 %30 %27 %48 %31 + OpBranch %28 + %28 = OpLabel + %50 = OpPhi %22 %25 %11 %49 %32 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %52 + %51 = OpLabel + OpReturn + %52 = OpLabel + %54 = OpAccessChain %37 %35 %36 + %55 = OpLoad %14 %54 + %56 = OpAccessChain %37 %45 %36 %36 + %57 = OpLoad %14 %56 + %58 = OpFOrdEqual %22 %55 %57 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %60 + %59 = OpLabel + OpStore %61 %36 + OpBranch %62 + %62 = OpLabel + %67 = OpLoad %6 %61 + %69 = OpSLessThan %22 %67 %68 + OpLoopMerge %64 %63 None + OpBranchConditional %69 %63 %64 + %63 = OpLabel + %70 = OpLoad %6 %9 + %72 = OpExtInst %6 %1 SClamp %70 %36 %71 + %73 = OpLoad %6 %61 + %74 = OpAccessChain %37 %45 %36 %36 + %75 = OpLoad %14 %74 + %77 = OpAccessChain %76 %18 %72 %73 + %78 = OpLoad %14 %77 + %79 = OpFAdd %14 %78 %75 + %80 = OpAccessChain %76 %18 %72 %73 + OpStore %80 %79 + %81 = OpLoad %6 %61 + %82 = OpIAdd %6 %81 %24 + OpStore %61 %82 + OpBranch %62 + %64 = OpLabel + OpBranch %60 + %60 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %3 + %13 = OpLabel + %93 = OpVariable %7 Function + %87 = OpAccessChain %86 %85 %41 + %88 = OpLoad %14 %87 + %89 = OpFOrdLessThan %22 %88 %19 + OpSelectionMerge %91 None + OpBranchConditional %89 %90 %91 + %90 = OpLabel + OpReturn + %91 = OpLabel + OpStore %93 %24 + %94 = OpFunctionCall %2 %10 %93 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 2 4 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-functions-compare-fragcood-length-zero-vector.amber b/vulkan/amber/graphicsfuzz/cov-nested-functions-compare-fragcood-length-zero-vector.amber new file mode 100644 index 0000000..02e989e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-functions-compare-fragcood-length-zero-vector.amber @@ -0,0 +1,354 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_6 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _int_3 _GLF_uniform_int_values[4] +# #define _int_5 _GLF_uniform_int_values[5] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 6, 2, 3, 5] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[6]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func0(int x) +# { +# for(int i = _int_0; i < _int_5; i++) +# { +# // This function is only called with x = 0, +# // therefore the second iteration always returns 1. +# if(x == _int_1) +# { +# return _int_1; +# } +# +# x++; +# } +# +# // This part of the function is never executed because +# // the loop above always returns one. +# +# // Always true. +# if(gl_FragCoord.x > 0.0) +# { +# return -1; +# } +# +# // Never executed. +# return 2; +# } +# +# int func1() +# { +# // Always true. +# if(gl_FragCoord.y > 0.0) +# { +# // Always true. +# if(gl_FragCoord.y > length(vec3(0))) +# { +# return func0(_int_0); +# } +# +# // Never executed. +# if(gl_FragCoord.x > 0.0) +# { +# _GLF_color = vec4(_int_0); +# } +# +# // Never executed. +# if(func0(_int_6) > _int_0) +# { +# return _int_2; +# } +# } +# +# // Never executed. +# return _int_3; +# } +# +# void main() +# { +# // Always true. +# if(func1() == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 288 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %54 %90 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %19 "buf0" + OpMemberName %19 0 "_GLF_uniform_int_values" + OpName %21 "" + OpName %54 "gl_FragCoord" + OpName %90 "_GLF_color" + OpDecorate %18 ArrayStride 16 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 0 + OpDecorate %54 BuiltIn FragCoord + OpDecorate %90 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 6 + %18 = OpTypeArray %6 %17 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpConstant %6 0 + %23 = OpTypePointer Uniform %6 + %32 = OpConstant %6 5 + %35 = OpTypeBool + %38 = OpConstant %6 1 + %51 = OpTypeFloat 32 + %52 = OpTypeVector %51 4 + %53 = OpTypePointer Input %52 + %54 = OpVariable %53 Input + %55 = OpConstant %16 0 + %56 = OpTypePointer Input %51 + %59 = OpConstant %51 0 + %63 = OpConstant %6 -1 + %65 = OpConstant %6 2 + %68 = OpConstant %16 1 + %89 = OpTypePointer Output %52 + %90 = OpVariable %89 Output + %104 = OpConstant %6 3 + %108 = OpConstant %6 4 + %141 = OpConstantFalse %35 + %144 = OpConstantTrue %35 + %279 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %193 None + OpSwitch %55 %158 + %158 = OpLabel + %159 = OpAccessChain %56 %54 %68 + %160 = OpLoad %51 %159 + %161 = OpFOrdGreaterThan %35 %160 %59 + OpSelectionMerge %190 None + OpBranchConditional %161 %162 %190 + %162 = OpLabel + OpSelectionMerge %170 None + OpBranchConditional %161 %166 %170 + %166 = OpLabel + %167 = OpAccessChain %23 %21 %22 %22 + %168 = OpLoad %6 %167 + OpSelectionMerge %231 None + OpSwitch %55 %200 + %200 = OpLabel + OpBranch %203 + %203 = OpLabel + %281 = OpPhi %6 %168 %200 %219 %220 + %280 = OpPhi %6 %168 %200 %222 %220 + %206 = OpAccessChain %23 %21 %22 %32 + %207 = OpLoad %6 %206 + %208 = OpSLessThan %35 %280 %207 + OpLoopMerge %223 %220 None + OpBranchConditional %208 %209 %223 + %209 = OpLabel + %211 = OpAccessChain %23 %21 %22 %38 + %212 = OpLoad %6 %211 + %213 = OpIEqual %35 %281 %212 + OpSelectionMerge %217 None + OpBranchConditional %213 %214 %217 + %214 = OpLabel + OpBranch %223 + %217 = OpLabel + %219 = OpIAdd %6 %281 %38 + OpBranch %220 + %220 = OpLabel + %222 = OpIAdd %6 %280 %38 + OpBranch %203 + %223 = OpLabel + %285 = OpPhi %6 %279 %203 %212 %214 + %282 = OpPhi %35 %141 %203 %144 %214 + OpSelectionMerge %225 None + OpBranchConditional %282 %231 %225 + %225 = OpLabel + %226 = OpAccessChain %56 %54 %55 + %227 = OpLoad %51 %226 + %228 = OpFOrdGreaterThan %35 %227 %59 + OpSelectionMerge %230 None + OpBranchConditional %228 %229 %230 + %229 = OpLabel + OpBranch %231 + %230 = OpLabel + OpBranch %231 + %231 = OpLabel + %284 = OpPhi %6 %285 %223 %63 %229 %65 %230 + OpBranch %193 + %170 = OpLabel + %171 = OpAccessChain %56 %54 %55 + %172 = OpLoad %51 %171 + %173 = OpFOrdGreaterThan %35 %172 %59 + OpSelectionMerge %179 None + OpBranchConditional %173 %174 %179 + %174 = OpLabel + %175 = OpAccessChain %23 %21 %22 %22 + %176 = OpLoad %6 %175 + %177 = OpConvertSToF %51 %176 + %178 = OpCompositeConstruct %52 %177 %177 %177 %177 + OpStore %90 %178 + OpBranch %179 + %179 = OpLabel + %180 = OpAccessChain %23 %21 %22 %65 + %181 = OpLoad %6 %180 + OpSelectionMerge %269 None + OpSwitch %55 %238 + %238 = OpLabel + %239 = OpAccessChain %23 %21 %22 %22 + %240 = OpLoad %6 %239 + OpBranch %241 + %241 = OpLabel + %272 = OpPhi %6 %181 %238 %257 %258 + %271 = OpPhi %6 %240 %238 %260 %258 + %244 = OpAccessChain %23 %21 %22 %32 + %245 = OpLoad %6 %244 + %246 = OpSLessThan %35 %271 %245 + OpLoopMerge %261 %258 None + OpBranchConditional %246 %247 %261 + %247 = OpLabel + %249 = OpAccessChain %23 %21 %22 %38 + %250 = OpLoad %6 %249 + %251 = OpIEqual %35 %272 %250 + OpSelectionMerge %255 None + OpBranchConditional %251 %252 %255 + %252 = OpLabel + OpBranch %261 + %255 = OpLabel + %257 = OpIAdd %6 %272 %38 + OpBranch %258 + %258 = OpLabel + %260 = OpIAdd %6 %271 %38 + OpBranch %241 + %261 = OpLabel + %276 = OpPhi %6 %279 %241 %250 %252 + %273 = OpPhi %35 %141 %241 %144 %252 + OpSelectionMerge %263 None + OpBranchConditional %273 %269 %263 + %263 = OpLabel + OpSelectionMerge %268 None + OpBranchConditional %173 %267 %268 + %267 = OpLabel + OpBranch %269 + %268 = OpLabel + OpBranch %269 + %269 = OpLabel + %275 = OpPhi %6 %276 %261 %63 %267 %65 %268 + %185 = OpSGreaterThan %35 %275 %240 + OpSelectionMerge %189 None + OpBranchConditional %185 %186 %189 + %186 = OpLabel + %187 = OpAccessChain %23 %21 %22 %104 + %188 = OpLoad %6 %187 + OpBranch %193 + %189 = OpLabel + OpBranch %190 + %190 = OpLabel + %191 = OpAccessChain %23 %21 %22 %108 + %192 = OpLoad %6 %191 + OpBranch %193 + %193 = OpLabel + %287 = OpPhi %6 %284 %231 %188 %186 %192 %190 + %114 = OpAccessChain %23 %21 %22 %38 + %115 = OpLoad %6 %114 + %116 = OpIEqual %35 %287 %115 + OpSelectionMerge %118 None + OpBranchConditional %116 %117 %132 + %117 = OpLabel + %121 = OpConvertSToF %51 %115 + %122 = OpAccessChain %23 %21 %22 %22 + %123 = OpLoad %6 %122 + %124 = OpConvertSToF %51 %123 + %131 = OpCompositeConstruct %52 %121 %124 %124 %121 + OpStore %90 %131 + OpBranch %118 + %132 = OpLabel + %133 = OpAccessChain %23 %21 %22 %22 + %134 = OpLoad %6 %133 + %135 = OpConvertSToF %51 %134 + %136 = OpCompositeConstruct %52 %135 %135 %135 %135 + OpStore %90 %136 + OpBranch %118 + %118 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 6 2 3 5 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-functions-loop-assign-global-array-element.amber b/vulkan/amber/graphicsfuzz/cov-nested-functions-loop-assign-global-array-element.amber new file mode 100644 index 0000000..5edf91b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-functions-loop-assign-global-array-element.amber @@ -0,0 +1,298 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_0_5 _GLF_uniform_float_values[1] +# #define _float_1_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 0.5, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const vec4 arr[5] = vec4[5](vec4(1.0), vec4(1, 0, 0, 1), vec4(1.0), vec4(1.0), vec4(1.0)); +# +# layout(location = 0) out vec4 _GLF_color; +# +# void func0(vec4 x) +# { +# vec4 v; +# +# for(int i = _int_1 << _int_1; i != _int_1; i--) +# { +# v = _GLF_color; +# } +# +# _GLF_color = v; +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# return; +# } +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# discard; +# } +# +# // Always true. +# if(x.x > _float_0_0) +# { +# _GLF_color = vec4(_int_1); +# return; +# } +# +# _GLF_color = vec4(_int_0); +# } +# +# // This function returns (1, 0, 0, 1). +# vec4 func1() +# { +# vec4 v = vec4(_float_1_0, _float_0_5, _float_1_0, _float_1_0); +# +# for(int i = 0; i < 3; i ++) +# { +# func0(vec4[3](vec4(1.0), vec4(1.0), vec4(1.0))[i]); +# v = arr[_int_1]; +# } +# +# return v; +# } +# +# void main() +# { +# _GLF_color = func1(); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 242 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %44 %51 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %22 "buf1" + OpMemberName %22 0 "_GLF_uniform_int_values" + OpName %24 "" + OpName %44 "_GLF_color" + OpName %51 "gl_FragCoord" + OpName %58 "buf0" + OpMemberName %58 0 "_GLF_uniform_float_values" + OpName %60 "" + OpDecorate %21 ArrayStride 16 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 1 + OpDecorate %44 Location 0 + OpDecorate %51 BuiltIn FragCoord + OpDecorate %57 ArrayStride 16 + OpMemberDecorate %58 0 Offset 0 + OpDecorate %58 Block + OpDecorate %60 DescriptorSet 0 + OpDecorate %60 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %16 = OpTypeInt 32 1 + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 2 + %21 = OpTypeArray %16 %20 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpConstant %16 0 + %26 = OpTypePointer Uniform %16 + %40 = OpTypeBool + %43 = OpTypePointer Output %7 + %44 = OpVariable %43 Output + %47 = OpConstant %16 1 + %50 = OpTypePointer Input %7 + %51 = OpVariable %50 Input + %52 = OpConstant %19 0 + %53 = OpTypePointer Input %6 + %56 = OpConstant %19 3 + %57 = OpTypeArray %6 %56 + %58 = OpTypeStruct %57 + %59 = OpTypePointer Uniform %58 + %60 = OpVariable %59 Uniform + %61 = OpTypePointer Uniform %6 + %94 = OpConstant %16 2 + %111 = OpConstant %16 3 + %113 = OpTypeArray %7 %56 + %114 = OpConstant %6 1 + %115 = OpConstantComposite %7 %114 %114 %114 %114 + %116 = OpConstantComposite %113 %115 %115 %115 + %119 = OpTypePointer Function %113 + %124 = OpConstant %19 5 + %125 = OpTypeArray %7 %124 + %126 = OpConstant %6 0 + %127 = OpConstantComposite %7 %114 %126 %126 %114 + %128 = OpConstantComposite %125 %115 %127 %115 %115 %115 + %131 = OpTypePointer Function %125 + %241 = OpUndef %7 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %150 = OpVariable %119 Function + %151 = OpVariable %131 Function + %154 = OpAccessChain %61 %60 %25 %94 + %155 = OpLoad %6 %154 + %156 = OpAccessChain %61 %60 %25 %47 + %157 = OpLoad %6 %156 + %162 = OpCompositeConstruct %7 %155 %157 %155 %155 + OpBranch %163 + %163 = OpLabel + %240 = OpPhi %7 %241 %5 %239 %176 + %237 = OpPhi %7 %162 %5 %175 %176 + %236 = OpPhi %16 %25 %5 %178 %176 + %166 = OpSLessThan %40 %236 %111 + OpLoopMerge %179 %176 None + OpBranchConditional %166 %167 %179 + %167 = OpLabel + OpStore %150 %116 + %169 = OpAccessChain %8 %150 %236 + %170 = OpLoad %7 %169 + OpSelectionMerge %233 None + OpSwitch %52 %185 + %185 = OpLabel + %186 = OpAccessChain %26 %24 %25 %25 + %187 = OpLoad %16 %186 + %190 = OpShiftLeftLogical %16 %187 %187 + OpBranch %191 + %191 = OpLabel + %239 = OpPhi %7 %240 %185 %198 %197 + %238 = OpPhi %16 %190 %185 %201 %197 + %196 = OpINotEqual %40 %238 %187 + OpLoopMerge %202 %197 None + OpBranchConditional %196 %197 %202 + %197 = OpLabel + %198 = OpLoad %7 %44 + %201 = OpISub %16 %238 %47 + OpBranch %191 + %202 = OpLabel + OpStore %44 %239 + %204 = OpAccessChain %53 %51 %52 + %205 = OpLoad %6 %204 + %206 = OpAccessChain %61 %60 %25 %25 + %207 = OpLoad %6 %206 + %208 = OpFOrdLessThan %40 %205 %207 + OpSelectionMerge %210 None + OpBranchConditional %208 %209 %210 + %209 = OpLabel + OpBranch %233 + %210 = OpLabel + OpSelectionMerge %217 None + OpBranchConditional %208 %216 %217 + %216 = OpLabel + OpTerminateInvocation + %217 = OpLabel + %219 = OpCompositeExtract %6 %170 0 + %222 = OpFOrdGreaterThan %40 %219 %207 + OpSelectionMerge %228 None + OpBranchConditional %222 %223 %228 + %223 = OpLabel + %226 = OpConvertSToF %6 %187 + %227 = OpCompositeConstruct %7 %226 %226 %226 %226 + OpStore %44 %227 + OpBranch %233 + %228 = OpLabel + %229 = OpAccessChain %26 %24 %25 %47 + %230 = OpLoad %16 %229 + %231 = OpConvertSToF %6 %230 + %232 = OpCompositeConstruct %7 %231 %231 %231 %231 + OpStore %44 %232 + OpBranch %233 + %233 = OpLabel + OpStore %151 %128 + %174 = OpAccessChain %8 %151 %187 + %175 = OpLoad %7 %174 + OpBranch %176 + %176 = OpLabel + %178 = OpIAdd %16 %236 %47 + OpBranch %163 + %179 = OpLabel + OpStore %44 %237 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 0.5 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-functions-struct-arrays-vector-lengths.amber b/vulkan/amber/graphicsfuzz/cov-nested-functions-struct-arrays-vector-lengths.amber new file mode 100644 index 0000000..2c5f920 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-functions-struct-arrays-vector-lengths.amber @@ -0,0 +1,498 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_4 _GLF_uniform_int_values[1] +# #define _int_35 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_2_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 2.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 4, 35, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# const int _GLF_global_loop_bound = 100; +# int _GLF_global_loop_count = 0; +# +# struct S +# { +# int data0; +# int data1; +# }; +# +# int a = 1; +# +# S arr[10] = S[10](S(1, 1), S(1, 1), S(1, 1), S(1, 1), S(1, 1), S(1, 1), S(1, 1), S(1, 1), S(1, 1), S(1, 1)); +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Has no effect because the original value is always one. Also this function is never called. +# void func0(inout S s) +# { +# s.data0 = _int_1; +# } +# +# // Always returns vec4(fract(x), 1, 1). +# vec3 func1(float x) +# { +# // Always false because x is the result of a call to sin. +# if(x > _float_1_0) +# { +# return vec3(_int_0); +# } +# +# return vec3(fract(x), _float_1_0, _float_1_0); +# } +# +# vec3 func2() +# { +# // Always true. +# if(gl_FragCoord.x > _float_0_0) +# { +# // a becomes one. +# a = S[10](S(_int_1, _int_1), S(_int_1, _int_1), S(_int_1, _int_1), S(_int_1, _int_1), S(_int_1, _int_1), S(_int_1, _int_1), S(_int_1, _int_1), S(_int_1, _int_1), S(_int_1, _int_1), S(_int_1, _int_1))[a].data1; +# } +# +# vec3 v0 = vec3(_float_1_0); +# for(int i = _int_35; i >= _int_1 && _GLF_global_loop_count < _GLF_global_loop_bound; i--) +# { +# _GLF_global_loop_count++; +# +# vec3 v1 = func1(sin(float(i))); +# +# // Always true. +# if(length(v1) >= _float_0_0) +# { +# v0 = v1; +# } +# } +# +# return v0; +# } +# +# void main() +# { +# a = _int_4; +# func2(); +# vec3 v = func2(); +# +# // Always true. +# if(gl_FragCoord.x > _float_0_0) +# { +# // Always false. +# if(arr[a].data1 == 0) +# { +# func0(arr[a]); +# return; +# } +# } +# +# // Guaranteed to be true because of an identical check in func2. +# if(length(v) > _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 238 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %75 %219 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "S" + OpMemberName %7 0 "data0" + OpMemberName %7 1 "data1" + OpName %11 "func0(struct-S-i1-i11;" + OpName %10 "s" + OpName %18 "func1(f1;" + OpName %17 "x" + OpName %21 "func2(" + OpName %24 "_GLF_global_loop_count" + OpName %26 "a" + OpName %32 "arr" + OpName %37 "buf1" + OpMemberName %37 0 "_GLF_uniform_int_values" + OpName %39 "" + OpName %48 "buf0" + OpMemberName %48 0 "_GLF_uniform_float_values" + OpName %50 "" + OpName %75 "gl_FragCoord" + OpName %138 "indexable" + OpName %142 "v0" + OpName %146 "i" + OpName %165 "v1" + OpName %169 "param" + OpName %187 "v" + OpName %203 "param" + OpName %219 "_GLF_color" + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 1 + OpDecorate %47 ArrayStride 16 + OpMemberDecorate %48 0 Offset 0 + OpDecorate %48 Block + OpDecorate %50 DescriptorSet 0 + OpDecorate %50 Binding 0 + OpDecorate %75 BuiltIn FragCoord + OpDecorate %219 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %2 %8 + %13 = OpTypeFloat 32 + %14 = OpTypePointer Function %13 + %15 = OpTypeVector %13 3 + %16 = OpTypeFunction %15 %14 + %20 = OpTypeFunction %15 + %23 = OpTypePointer Private %6 + %24 = OpVariable %23 Private + %25 = OpConstant %6 0 + %26 = OpVariable %23 Private + %27 = OpConstant %6 1 + %28 = OpTypeInt 32 0 + %29 = OpConstant %28 10 + %30 = OpTypeArray %7 %29 + %31 = OpTypePointer Private %30 + %32 = OpVariable %31 Private + %33 = OpConstantComposite %7 %27 %27 + %34 = OpConstantComposite %30 %33 %33 %33 %33 %33 %33 %33 %33 %33 %33 + %35 = OpConstant %28 4 + %36 = OpTypeArray %6 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %6 + %43 = OpTypePointer Function %6 + %46 = OpConstant %28 3 + %47 = OpTypeArray %13 %46 + %48 = OpTypeStruct %47 + %49 = OpTypePointer Uniform %48 + %50 = OpVariable %49 Uniform + %51 = OpTypePointer Uniform %13 + %54 = OpTypeBool + %58 = OpConstant %6 3 + %73 = OpTypeVector %13 4 + %74 = OpTypePointer Input %73 + %75 = OpVariable %74 Input + %76 = OpConstant %28 0 + %77 = OpTypePointer Input %13 + %137 = OpTypePointer Function %30 + %141 = OpTypePointer Function %15 + %147 = OpConstant %6 2 + %160 = OpConstant %6 100 + %204 = OpTypePointer Private %7 + %218 = OpTypePointer Output %73 + %219 = OpVariable %218 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %187 = OpVariable %141 Function + %203 = OpVariable %8 Function + OpStore %24 %25 + OpStore %26 %27 + OpStore %32 %34 + %184 = OpAccessChain %40 %39 %25 %27 + %185 = OpLoad %6 %184 + OpStore %26 %185 + %186 = OpFunctionCall %15 %21 + %188 = OpFunctionCall %15 %21 + OpStore %187 %188 + %189 = OpAccessChain %77 %75 %76 + %190 = OpLoad %13 %189 + %191 = OpAccessChain %51 %50 %25 %27 + %192 = OpLoad %13 %191 + %193 = OpFOrdGreaterThan %54 %190 %192 + OpSelectionMerge %195 None + OpBranchConditional %193 %194 %195 + %194 = OpLabel + %196 = OpLoad %6 %26 + %197 = OpAccessChain %23 %32 %196 %27 + %198 = OpLoad %6 %197 + %199 = OpIEqual %54 %198 %25 + OpSelectionMerge %201 None + OpBranchConditional %199 %200 %201 + %200 = OpLabel + %202 = OpLoad %6 %26 + %205 = OpAccessChain %204 %32 %202 + %206 = OpLoad %7 %205 + OpStore %203 %206 + %207 = OpFunctionCall %2 %11 %203 + %208 = OpLoad %7 %203 + %209 = OpAccessChain %204 %32 %202 + OpStore %209 %208 + OpReturn + %201 = OpLabel + OpBranch %195 + %195 = OpLabel + %211 = OpLoad %15 %187 + %212 = OpExtInst %13 %1 Length %211 + %213 = OpAccessChain %51 %50 %25 %27 + %214 = OpLoad %13 %213 + %215 = OpFOrdGreaterThan %54 %212 %214 + OpSelectionMerge %217 None + OpBranchConditional %215 %216 %233 + %216 = OpLabel + %220 = OpAccessChain %40 %39 %25 %25 + %221 = OpLoad %6 %220 + %222 = OpConvertSToF %13 %221 + %223 = OpAccessChain %40 %39 %25 %58 + %224 = OpLoad %6 %223 + %225 = OpConvertSToF %13 %224 + %226 = OpAccessChain %40 %39 %25 %58 + %227 = OpLoad %6 %226 + %228 = OpConvertSToF %13 %227 + %229 = OpAccessChain %40 %39 %25 %25 + %230 = OpLoad %6 %229 + %231 = OpConvertSToF %13 %230 + %232 = OpCompositeConstruct %73 %222 %225 %228 %231 + OpStore %219 %232 + OpBranch %217 + %233 = OpLabel + %234 = OpAccessChain %40 %39 %25 %58 + %235 = OpLoad %6 %234 + %236 = OpConvertSToF %13 %235 + %237 = OpCompositeConstruct %73 %236 %236 %236 %236 + OpStore %219 %237 + OpBranch %217 + %217 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %9 + %10 = OpFunctionParameter %8 + %12 = OpLabel + %41 = OpAccessChain %40 %39 %25 %25 + %42 = OpLoad %6 %41 + %44 = OpAccessChain %43 %10 %25 + OpStore %44 %42 + OpReturn + OpFunctionEnd + %18 = OpFunction %15 None %16 + %17 = OpFunctionParameter %14 + %19 = OpLabel + %45 = OpLoad %13 %17 + %52 = OpAccessChain %51 %50 %25 %25 + %53 = OpLoad %13 %52 + %55 = OpFOrdGreaterThan %54 %45 %53 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %57 + %56 = OpLabel + %59 = OpAccessChain %40 %39 %25 %58 + %60 = OpLoad %6 %59 + %61 = OpConvertSToF %13 %60 + %62 = OpCompositeConstruct %15 %61 %61 %61 + OpReturnValue %62 + %57 = OpLabel + %64 = OpLoad %13 %17 + %65 = OpExtInst %13 %1 Fract %64 + %66 = OpAccessChain %51 %50 %25 %25 + %67 = OpLoad %13 %66 + %68 = OpAccessChain %51 %50 %25 %25 + %69 = OpLoad %13 %68 + %70 = OpCompositeConstruct %15 %65 %67 %69 + OpReturnValue %70 + OpFunctionEnd + %21 = OpFunction %15 None %20 + %22 = OpLabel + %138 = OpVariable %137 Function + %142 = OpVariable %141 Function + %146 = OpVariable %43 Function + %165 = OpVariable %141 Function + %169 = OpVariable %14 Function + %78 = OpAccessChain %77 %75 %76 + %79 = OpLoad %13 %78 + %80 = OpAccessChain %51 %50 %25 %27 + %81 = OpLoad %13 %80 + %82 = OpFOrdGreaterThan %54 %79 %81 + OpSelectionMerge %84 None + OpBranchConditional %82 %83 %84 + %83 = OpLabel + %85 = OpAccessChain %40 %39 %25 %25 + %86 = OpLoad %6 %85 + %87 = OpAccessChain %40 %39 %25 %25 + %88 = OpLoad %6 %87 + %89 = OpCompositeConstruct %7 %86 %88 + %90 = OpAccessChain %40 %39 %25 %25 + %91 = OpLoad %6 %90 + %92 = OpAccessChain %40 %39 %25 %25 + %93 = OpLoad %6 %92 + %94 = OpCompositeConstruct %7 %91 %93 + %95 = OpAccessChain %40 %39 %25 %25 + %96 = OpLoad %6 %95 + %97 = OpAccessChain %40 %39 %25 %25 + %98 = OpLoad %6 %97 + %99 = OpCompositeConstruct %7 %96 %98 + %100 = OpAccessChain %40 %39 %25 %25 + %101 = OpLoad %6 %100 + %102 = OpAccessChain %40 %39 %25 %25 + %103 = OpLoad %6 %102 + %104 = OpCompositeConstruct %7 %101 %103 + %105 = OpAccessChain %40 %39 %25 %25 + %106 = OpLoad %6 %105 + %107 = OpAccessChain %40 %39 %25 %25 + %108 = OpLoad %6 %107 + %109 = OpCompositeConstruct %7 %106 %108 + %110 = OpAccessChain %40 %39 %25 %25 + %111 = OpLoad %6 %110 + %112 = OpAccessChain %40 %39 %25 %25 + %113 = OpLoad %6 %112 + %114 = OpCompositeConstruct %7 %111 %113 + %115 = OpAccessChain %40 %39 %25 %25 + %116 = OpLoad %6 %115 + %117 = OpAccessChain %40 %39 %25 %25 + %118 = OpLoad %6 %117 + %119 = OpCompositeConstruct %7 %116 %118 + %120 = OpAccessChain %40 %39 %25 %25 + %121 = OpLoad %6 %120 + %122 = OpAccessChain %40 %39 %25 %25 + %123 = OpLoad %6 %122 + %124 = OpCompositeConstruct %7 %121 %123 + %125 = OpAccessChain %40 %39 %25 %25 + %126 = OpLoad %6 %125 + %127 = OpAccessChain %40 %39 %25 %25 + %128 = OpLoad %6 %127 + %129 = OpCompositeConstruct %7 %126 %128 + %130 = OpAccessChain %40 %39 %25 %25 + %131 = OpLoad %6 %130 + %132 = OpAccessChain %40 %39 %25 %25 + %133 = OpLoad %6 %132 + %134 = OpCompositeConstruct %7 %131 %133 + %135 = OpCompositeConstruct %30 %89 %94 %99 %104 %109 %114 %119 %124 %129 %134 + %136 = OpLoad %6 %26 + OpStore %138 %135 + %139 = OpAccessChain %43 %138 %136 %27 + %140 = OpLoad %6 %139 + OpStore %26 %140 + OpBranch %84 + %84 = OpLabel + %143 = OpAccessChain %51 %50 %25 %25 + %144 = OpLoad %13 %143 + %145 = OpCompositeConstruct %15 %144 %144 %144 + OpStore %142 %145 + %148 = OpAccessChain %40 %39 %25 %147 + %149 = OpLoad %6 %148 + OpStore %146 %149 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %152 %153 None + OpBranch %154 + %154 = OpLabel + %155 = OpLoad %6 %146 + %156 = OpAccessChain %40 %39 %25 %25 + %157 = OpLoad %6 %156 + %158 = OpSGreaterThanEqual %54 %155 %157 + %159 = OpLoad %6 %24 + %161 = OpSLessThan %54 %159 %160 + %162 = OpLogicalAnd %54 %158 %161 + OpBranchConditional %162 %151 %152 + %151 = OpLabel + %163 = OpLoad %6 %24 + %164 = OpIAdd %6 %163 %27 + OpStore %24 %164 + %166 = OpLoad %6 %146 + %167 = OpConvertSToF %13 %166 + %168 = OpExtInst %13 %1 Sin %167 + OpStore %169 %168 + %170 = OpFunctionCall %15 %18 %169 + OpStore %165 %170 + %171 = OpLoad %15 %165 + %172 = OpExtInst %13 %1 Length %171 + %173 = OpAccessChain %51 %50 %25 %27 + %174 = OpLoad %13 %173 + %175 = OpFOrdGreaterThanEqual %54 %172 %174 + OpSelectionMerge %177 None + OpBranchConditional %175 %176 %177 + %176 = OpLabel + %178 = OpLoad %15 %165 + OpStore %142 %178 + OpBranch %177 + %177 = OpLabel + OpBranch %153 + %153 = OpLabel + %179 = OpLoad %6 %146 + %180 = OpISub %6 %179 %27 + OpStore %146 %180 + OpBranch %150 + %152 = OpLabel + %181 = OpLoad %15 %142 + OpReturnValue %181 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 4 35 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 2.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-functions-vec4-array-element-argument.amber b/vulkan/amber/graphicsfuzz/cov-nested-functions-vec4-array-element-argument.amber new file mode 100644 index 0000000..f3865f7 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-functions-vec4-array-element-argument.amber @@ -0,0 +1,308 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_8 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_3 _GLF_uniform_int_values[4] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_2_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [8, 2, 0, 1, 3] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 2.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# highp vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Returns true if v.y >= 2.0. +# bool func0(vec4 v) +# { +# // Always false. +# while(injectionSwitch.x < _float_0_0) +# { +# return false; +# } +# +# if(v.y < _float_2_0) +# { +# return false; +# } +# +# return true; +# } +# +# // Returns 2. +# int func1() +# { +# int a = _int_0; +# +# // Iterates seven times. +# for(int i = _int_1; i < _int_8; i++) +# { +# if(func0(vec4[8](vec4(_int_1), vec4(_int_1), vec4(_int_3), vec4(_int_1), vec4(_int_1), vec4(_int_1), vec4(_int_1), vec4(_int_1))[i])) +# { +# a = i; +# } +# } +# +# return a; +# } +# +# void main() +# { +# // Always true. +# if(func1() == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 275 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %139 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %24 "buf2" + OpMemberName %24 0 "injectionSwitch" + OpName %26 "" + OpName %35 "buf1" + OpMemberName %35 0 "_GLF_uniform_float_values" + OpName %37 "" + OpName %61 "buf0" + OpMemberName %61 0 "_GLF_uniform_int_values" + OpName %63 "" + OpName %139 "_GLF_color" + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 2 + OpDecorate %34 ArrayStride 16 + OpMemberDecorate %35 0 Offset 0 + OpDecorate %35 Block + OpDecorate %37 DescriptorSet 0 + OpDecorate %37 Binding 1 + OpDecorate %60 ArrayStride 16 + OpMemberDecorate %61 0 Offset 0 + OpDecorate %61 Block + OpDecorate %63 DescriptorSet 0 + OpDecorate %63 Binding 0 + OpDecorate %139 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %9 = OpTypeBool + %14 = OpTypeInt 32 1 + %23 = OpTypeVector %6 2 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpConstant %14 0 + %28 = OpTypeInt 32 0 + %29 = OpConstant %28 0 + %30 = OpTypePointer Uniform %6 + %33 = OpConstant %28 2 + %34 = OpTypeArray %6 %33 + %35 = OpTypeStruct %34 + %36 = OpTypePointer Uniform %35 + %37 = OpVariable %36 Uniform + %41 = OpConstantFalse %9 + %47 = OpConstant %14 1 + %54 = OpConstantTrue %9 + %59 = OpConstant %28 5 + %60 = OpTypeArray %14 %59 + %61 = OpTypeStruct %60 + %62 = OpTypePointer Uniform %61 + %63 = OpVariable %62 Uniform + %64 = OpConstant %14 2 + %65 = OpTypePointer Uniform %14 + %69 = OpConstant %14 3 + %89 = OpConstant %14 4 + %114 = OpConstant %28 8 + %115 = OpTypeArray %7 %114 + %119 = OpTypePointer Function %115 + %138 = OpTypePointer Output %7 + %139 = OpVariable %138 Output + %263 = OpUndef %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %169 = OpVariable %119 Function + %172 = OpAccessChain %65 %63 %27 %64 + %173 = OpLoad %14 %172 + %174 = OpAccessChain %65 %63 %27 %69 + %175 = OpLoad %14 %174 + OpBranch %176 + %176 = OpLabel + %262 = OpPhi %9 %263 %5 %259 %223 + %256 = OpPhi %14 %173 %5 %274 %223 + %255 = OpPhi %14 %175 %5 %225 %223 + %179 = OpAccessChain %65 %63 %27 %27 + %180 = OpLoad %14 %179 + %181 = OpSLessThan %9 %255 %180 + OpLoopMerge %226 %223 None + OpBranchConditional %181 %182 %226 + %182 = OpLabel + %185 = OpConvertSToF %6 %175 + %186 = OpCompositeConstruct %7 %185 %185 %185 %185 + %191 = OpAccessChain %65 %63 %27 %89 + %192 = OpLoad %14 %191 + %193 = OpConvertSToF %6 %192 + %194 = OpCompositeConstruct %7 %193 %193 %193 %193 + %215 = OpCompositeConstruct %115 %186 %186 %194 %186 %186 %186 %186 %186 + OpStore %169 %215 + %217 = OpAccessChain %8 %169 %255 + %218 = OpLoad %7 %217 + OpSelectionMerge %252 None + OpSwitch %29 %232 + %232 = OpLabel + OpBranch %233 + %233 = OpLabel + %235 = OpAccessChain %30 %26 %27 %29 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %30 %37 %27 %27 + %238 = OpLoad %6 %237 + %239 = OpFOrdLessThan %9 %236 %238 + OpLoopMerge %242 %241 None + OpBranchConditional %239 %240 %242 + %240 = OpLabel + OpBranch %242 + %241 = OpLabel + OpBranch %233 + %242 = OpLabel + %260 = OpPhi %9 %262 %233 %41 %240 + %257 = OpPhi %9 %41 %233 %54 %240 + OpSelectionMerge %244 None + OpBranchConditional %257 %252 %244 + %244 = OpLabel + %246 = OpCompositeExtract %6 %218 1 + %247 = OpAccessChain %30 %37 %27 %47 + %248 = OpLoad %6 %247 + %249 = OpFOrdLessThan %9 %246 %248 + OpSelectionMerge %251 None + OpBranchConditional %249 %250 %251 + %250 = OpLabel + OpBranch %252 + %251 = OpLabel + OpBranch %252 + %252 = OpLabel + %259 = OpPhi %9 %260 %242 %41 %250 %54 %251 + %274 = OpSelect %14 %259 %255 %256 + OpBranch %223 + %223 = OpLabel + %225 = OpIAdd %14 %255 %47 + OpBranch %176 + %226 = OpLabel + %133 = OpAccessChain %65 %63 %27 %47 + %134 = OpLoad %14 %133 + %135 = OpIEqual %9 %256 %134 + OpSelectionMerge %137 None + OpBranchConditional %135 %136 %153 + %153 = OpLabel + %156 = OpConvertSToF %6 %173 + %157 = OpCompositeConstruct %7 %156 %156 %156 %156 + OpStore %139 %157 + OpBranch %137 + %136 = OpLabel + %142 = OpConvertSToF %6 %175 + %145 = OpConvertSToF %6 %173 + %152 = OpCompositeConstruct %7 %142 %145 %145 %142 + OpStore %139 %152 + OpBranch %137 + %137 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 2.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 8 2 0 1 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loop-continue-inner-copy-array-element.amber b/vulkan/amber/graphicsfuzz/cov-nested-loop-continue-inner-copy-array-element.amber new file mode 100644 index 0000000..a099727 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loop-continue-inner-copy-array-element.amber @@ -0,0 +1,425 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_2_0 _GLF_uniform_float_values[1] +# #define _float_3_0 _GLF_uniform_float_values[2] +# #define _float_4_0 _GLF_uniform_float_values[3] +# #define _float_5_0 _GLF_uniform_float_values[4] +# #define _float_6_0 _GLF_uniform_float_values[5] +# #define _float_7_0 _GLF_uniform_float_values[6] +# #define _float_8_0 _GLF_uniform_float_values[7] +# #define _float_9_0 _GLF_uniform_float_values[8] +# #define _float_10_0 _GLF_uniform_float_values[9] +# #define _float_0_0 _GLF_uniform_float_values[10] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[11]; +# }; +# // Contents of _GLF_uniform_int_values: [1, 0, 10] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float data[10] = float[10](_float_1_0, _float_2_0, _float_3_0, _float_4_0, _float_5_0, _float_6_0, _float_7_0, _float_8_0, _float_9_0, _float_10_0); +# +# // This loop copies data[1] to indices two and up. +# for(int i = 0; i < 10; i ++) +# { +# for(int j = 0; j < 10; j ++) +# { +# // Skips all other iterations except j >= i. The inner loop has no dependency of j, +# // thus it just does data[i] = data[1] multiple times when i > 1. +# if(j < i) +# { +# continue; +# } +# +# float f0 = data[i]; +# float f1 = data[_int_1]; +# +# // Always selects f0 > f1 which is true when i > 1. +# bool b = injectionSwitch.x > _float_0_0 ? injectionSwitch.x < injectionSwitch.y : f0 > f1; +# +# if(b) +# { +# data[i] = data[_int_1]; +# } +# } +# } +# +# // Compare against expected results. +# float ref[10] = float[10](_float_1_0, _float_2_0, _float_2_0, _float_2_0, _float_2_0, _float_2_0, _float_2_0, _float_2_0, _float_2_0, _float_2_0); +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# for(int i = _int_0; i < _int_10; i ++) +# { +# if(data[i] != ref[i]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 195 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %154 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "data" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %51 "i" + OpName %61 "j" + OpName %76 "f0" + OpName %80 "f1" + OpName %83 "buf1" + OpMemberName %83 0 "_GLF_uniform_int_values" + OpName %85 "" + OpName %92 "b" + OpName %94 "buf2" + OpMemberName %94 0 "injectionSwitch" + OpName %96 "" + OpName %130 "ref" + OpName %154 "_GLF_color" + OpName %168 "i" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %82 ArrayStride 16 + OpMemberDecorate %83 0 Offset 0 + OpDecorate %83 Block + OpDecorate %85 DescriptorSet 0 + OpDecorate %85 Binding 1 + OpMemberDecorate %94 0 Offset 0 + OpDecorate %94 Block + OpDecorate %96 DescriptorSet 0 + OpDecorate %96 Binding 2 + OpDecorate %154 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 11 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %17 1 + %25 = OpConstant %17 2 + %28 = OpConstant %17 3 + %31 = OpConstant %17 4 + %34 = OpConstant %17 5 + %37 = OpConstant %17 6 + %40 = OpConstant %17 7 + %43 = OpConstant %17 8 + %46 = OpConstant %17 9 + %50 = OpTypePointer Function %17 + %58 = OpConstant %17 10 + %59 = OpTypeBool + %75 = OpTypePointer Function %6 + %81 = OpConstant %7 3 + %82 = OpTypeArray %17 %81 + %83 = OpTypeStruct %82 + %84 = OpTypePointer Uniform %83 + %85 = OpVariable %84 Uniform + %86 = OpTypePointer Uniform %17 + %91 = OpTypePointer Function %59 + %93 = OpTypeVector %6 2 + %94 = OpTypeStruct %93 + %95 = OpTypePointer Uniform %94 + %96 = OpVariable %95 Uniform + %97 = OpConstant %7 0 + %108 = OpConstant %7 1 + %152 = OpTypeVector %6 4 + %153 = OpTypePointer Output %152 + %154 = OpVariable %153 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %51 = OpVariable %50 Function + %61 = OpVariable %50 Function + %76 = OpVariable %75 Function + %80 = OpVariable %75 Function + %92 = OpVariable %91 Function + %103 = OpVariable %91 Function + %130 = OpVariable %10 Function + %168 = OpVariable %50 Function + %20 = OpAccessChain %19 %16 %18 %18 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %19 %16 %18 %22 + %24 = OpLoad %6 %23 + %26 = OpAccessChain %19 %16 %18 %25 + %27 = OpLoad %6 %26 + %29 = OpAccessChain %19 %16 %18 %28 + %30 = OpLoad %6 %29 + %32 = OpAccessChain %19 %16 %18 %31 + %33 = OpLoad %6 %32 + %35 = OpAccessChain %19 %16 %18 %34 + %36 = OpLoad %6 %35 + %38 = OpAccessChain %19 %16 %18 %37 + %39 = OpLoad %6 %38 + %41 = OpAccessChain %19 %16 %18 %40 + %42 = OpLoad %6 %41 + %44 = OpAccessChain %19 %16 %18 %43 + %45 = OpLoad %6 %44 + %47 = OpAccessChain %19 %16 %18 %46 + %48 = OpLoad %6 %47 + %49 = OpCompositeConstruct %9 %21 %24 %27 %30 %33 %36 %39 %42 %45 %48 + OpStore %11 %49 + OpStore %51 %18 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %17 %51 + %60 = OpSLessThan %59 %57 %58 + OpBranchConditional %60 %53 %54 + %53 = OpLabel + OpStore %61 %18 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpLoad %17 %61 + %68 = OpSLessThan %59 %67 %58 + OpBranchConditional %68 %63 %64 + %63 = OpLabel + %69 = OpLoad %17 %61 + %70 = OpLoad %17 %51 + %71 = OpSLessThan %59 %69 %70 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %73 + %72 = OpLabel + OpBranch %65 + %73 = OpLabel + %77 = OpLoad %17 %51 + %78 = OpAccessChain %75 %11 %77 + %79 = OpLoad %6 %78 + OpStore %76 %79 + %87 = OpAccessChain %86 %85 %18 %18 + %88 = OpLoad %17 %87 + %89 = OpAccessChain %75 %11 %88 + %90 = OpLoad %6 %89 + OpStore %80 %90 + %98 = OpAccessChain %19 %96 %18 %97 + %99 = OpLoad %6 %98 + %100 = OpAccessChain %19 %16 %18 %58 + %101 = OpLoad %6 %100 + %102 = OpFOrdGreaterThan %59 %99 %101 + OpSelectionMerge %105 None + OpBranchConditional %102 %104 %112 + %104 = OpLabel + %106 = OpAccessChain %19 %96 %18 %97 + %107 = OpLoad %6 %106 + %109 = OpAccessChain %19 %96 %18 %108 + %110 = OpLoad %6 %109 + %111 = OpFOrdLessThan %59 %107 %110 + OpStore %103 %111 + OpBranch %105 + %112 = OpLabel + %113 = OpLoad %6 %76 + %114 = OpLoad %6 %80 + %115 = OpFOrdGreaterThan %59 %113 %114 + OpStore %103 %115 + OpBranch %105 + %105 = OpLabel + %116 = OpLoad %59 %103 + OpStore %92 %116 + %117 = OpLoad %59 %92 + OpSelectionMerge %119 None + OpBranchConditional %117 %118 %119 + %118 = OpLabel + %120 = OpLoad %17 %51 + %121 = OpAccessChain %86 %85 %18 %18 + %122 = OpLoad %17 %121 + %123 = OpAccessChain %75 %11 %122 + %124 = OpLoad %6 %123 + %125 = OpAccessChain %75 %11 %120 + OpStore %125 %124 + OpBranch %119 + %119 = OpLabel + OpBranch %65 + %65 = OpLabel + %126 = OpLoad %17 %61 + %127 = OpIAdd %17 %126 %22 + OpStore %61 %127 + OpBranch %62 + %64 = OpLabel + OpBranch %55 + %55 = OpLabel + %128 = OpLoad %17 %51 + %129 = OpIAdd %17 %128 %22 + OpStore %51 %129 + OpBranch %52 + %54 = OpLabel + %131 = OpAccessChain %19 %16 %18 %18 + %132 = OpLoad %6 %131 + %133 = OpAccessChain %19 %16 %18 %22 + %134 = OpLoad %6 %133 + %135 = OpAccessChain %19 %16 %18 %22 + %136 = OpLoad %6 %135 + %137 = OpAccessChain %19 %16 %18 %22 + %138 = OpLoad %6 %137 + %139 = OpAccessChain %19 %16 %18 %22 + %140 = OpLoad %6 %139 + %141 = OpAccessChain %19 %16 %18 %22 + %142 = OpLoad %6 %141 + %143 = OpAccessChain %19 %16 %18 %22 + %144 = OpLoad %6 %143 + %145 = OpAccessChain %19 %16 %18 %22 + %146 = OpLoad %6 %145 + %147 = OpAccessChain %19 %16 %18 %22 + %148 = OpLoad %6 %147 + %149 = OpAccessChain %19 %16 %18 %22 + %150 = OpLoad %6 %149 + %151 = OpCompositeConstruct %9 %132 %134 %136 %138 %140 %142 %144 %146 %148 %150 + OpStore %130 %151 + %155 = OpAccessChain %86 %85 %18 %18 + %156 = OpLoad %17 %155 + %157 = OpConvertSToF %6 %156 + %158 = OpAccessChain %86 %85 %18 %22 + %159 = OpLoad %17 %158 + %160 = OpConvertSToF %6 %159 + %161 = OpAccessChain %86 %85 %18 %22 + %162 = OpLoad %17 %161 + %163 = OpConvertSToF %6 %162 + %164 = OpAccessChain %86 %85 %18 %18 + %165 = OpLoad %17 %164 + %166 = OpConvertSToF %6 %165 + %167 = OpCompositeConstruct %152 %157 %160 %163 %166 + OpStore %154 %167 + %169 = OpAccessChain %86 %85 %18 %22 + %170 = OpLoad %17 %169 + OpStore %168 %170 + OpBranch %171 + %171 = OpLabel + OpLoopMerge %173 %174 None + OpBranch %175 + %175 = OpLabel + %176 = OpLoad %17 %168 + %177 = OpAccessChain %86 %85 %18 %25 + %178 = OpLoad %17 %177 + %179 = OpSLessThan %59 %176 %178 + OpBranchConditional %179 %172 %173 + %172 = OpLabel + %180 = OpLoad %17 %168 + %181 = OpAccessChain %75 %11 %180 + %182 = OpLoad %6 %181 + %183 = OpLoad %17 %168 + %184 = OpAccessChain %75 %130 %183 + %185 = OpLoad %6 %184 + %186 = OpFUnordNotEqual %59 %182 %185 + OpSelectionMerge %188 None + OpBranchConditional %186 %187 %188 + %187 = OpLabel + %189 = OpAccessChain %86 %85 %18 %22 + %190 = OpLoad %17 %189 + %191 = OpConvertSToF %6 %190 + %192 = OpCompositeConstruct %152 %191 %191 %191 %191 + OpStore %154 %192 + OpBranch %188 + %188 = OpLabel + OpBranch %174 + %174 = OpLabel + %193 = OpLoad %17 %168 + %194 = OpIAdd %17 %193 %22 + OpStore %168 %194 + OpBranch %171 + %173 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 10 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loop-decrease-vector-components.amber b/vulkan/amber/graphicsfuzz/cov-nested-loop-decrease-vector-components.amber new file mode 100644 index 0000000..d9fefa2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loop-decrease-vector-components.amber @@ -0,0 +1,278 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_3 _GLF_uniform_int_values[2] +# #define _int_4 _GLF_uniform_int_values[3] +# #define _int_0 _GLF_uniform_int_values[4] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 2, 3, 4, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# ivec4 v = ivec4(_int_1, _int_2, _int_3, _int_4); +# +# // Iterates i = 1, 0. +# for(int i = 1; i >= 0; i--) +# { +# // Iterates j = 1 when i = 1, and j = 1, 0 when i = 0. +# for(int j = (gl_FragCoord.y >= _float_0_0) ? 1 : i; j >= i; j--) +# { +# // v[0] gets decreased twice and v[1] once. +# v[i]--; +# } +# } +# +# // Always true. +# if(v == ivec4(-_int_1, _int_1, _int_3, _int_4)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 112 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %44 %92 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %31 "i" + OpName %40 "j" + OpName %44 "gl_FragCoord" + OpName %50 "buf1" + OpMemberName %50 0 "_GLF_uniform_float_values" + OpName %52 "" + OpName %92 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %44 BuiltIn FragCoord + OpDecorate %49 ArrayStride 16 + OpMemberDecorate %50 0 Offset 0 + OpDecorate %50 Block + OpDecorate %52 DescriptorSet 0 + OpDecorate %52 Binding 1 + OpDecorate %92 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 5 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %6 0 + %17 = OpTypePointer Uniform %6 + %20 = OpConstant %6 1 + %23 = OpConstant %6 2 + %26 = OpConstant %6 3 + %30 = OpTypePointer Function %6 + %38 = OpTypeBool + %41 = OpTypeFloat 32 + %42 = OpTypeVector %41 4 + %43 = OpTypePointer Input %42 + %44 = OpVariable %43 Input + %45 = OpConstant %10 1 + %46 = OpTypePointer Input %41 + %49 = OpTypeArray %41 %45 + %50 = OpTypeStruct %49 + %51 = OpTypePointer Uniform %50 + %52 = OpVariable %51 Uniform + %53 = OpTypePointer Uniform %41 + %86 = OpTypeVector %38 4 + %91 = OpTypePointer Output %42 + %92 = OpVariable %91 Output + %96 = OpConstant %6 4 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %31 = OpVariable %30 Function + %40 = OpVariable %30 Function + %18 = OpAccessChain %17 %15 %16 %16 + %19 = OpLoad %6 %18 + %21 = OpAccessChain %17 %15 %16 %20 + %22 = OpLoad %6 %21 + %24 = OpAccessChain %17 %15 %16 %23 + %25 = OpLoad %6 %24 + %27 = OpAccessChain %17 %15 %16 %26 + %28 = OpLoad %6 %27 + %29 = OpCompositeConstruct %7 %19 %22 %25 %28 + OpStore %9 %29 + OpStore %31 %20 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %6 %31 + %39 = OpSGreaterThanEqual %38 %37 %16 + OpBranchConditional %39 %33 %34 + %33 = OpLabel + %47 = OpAccessChain %46 %44 %45 + %48 = OpLoad %41 %47 + %54 = OpAccessChain %53 %52 %16 %16 + %55 = OpLoad %41 %54 + %56 = OpFOrdGreaterThanEqual %38 %48 %55 + %57 = OpLoad %6 %31 + %58 = OpSelect %6 %56 %20 %57 + OpStore %40 %58 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + %64 = OpLoad %6 %40 + %65 = OpLoad %6 %31 + %66 = OpSGreaterThanEqual %38 %64 %65 + OpBranchConditional %66 %60 %61 + %60 = OpLabel + %67 = OpLoad %6 %31 + %68 = OpAccessChain %30 %9 %67 + %69 = OpLoad %6 %68 + %70 = OpISub %6 %69 %20 + OpStore %68 %70 + OpBranch %62 + %62 = OpLabel + %71 = OpLoad %6 %40 + %72 = OpISub %6 %71 %20 + OpStore %40 %72 + OpBranch %59 + %61 = OpLabel + OpBranch %35 + %35 = OpLabel + %73 = OpLoad %6 %31 + %74 = OpISub %6 %73 %20 + OpStore %31 %74 + OpBranch %32 + %34 = OpLabel + %75 = OpLoad %7 %9 + %76 = OpAccessChain %17 %15 %16 %16 + %77 = OpLoad %6 %76 + %78 = OpSNegate %6 %77 + %79 = OpAccessChain %17 %15 %16 %16 + %80 = OpLoad %6 %79 + %81 = OpAccessChain %17 %15 %16 %23 + %82 = OpLoad %6 %81 + %83 = OpAccessChain %17 %15 %16 %26 + %84 = OpLoad %6 %83 + %85 = OpCompositeConstruct %7 %78 %80 %82 %84 + %87 = OpIEqual %86 %75 %85 + %88 = OpAll %38 %87 + OpSelectionMerge %90 None + OpBranchConditional %88 %89 %107 + %89 = OpLabel + %93 = OpAccessChain %17 %15 %16 %16 + %94 = OpLoad %6 %93 + %95 = OpConvertSToF %41 %94 + %97 = OpAccessChain %17 %15 %16 %96 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %41 %98 + %100 = OpAccessChain %17 %15 %16 %96 + %101 = OpLoad %6 %100 + %102 = OpConvertSToF %41 %101 + %103 = OpAccessChain %17 %15 %16 %16 + %104 = OpLoad %6 %103 + %105 = OpConvertSToF %41 %104 + %106 = OpCompositeConstruct %42 %95 %99 %102 %105 + OpStore %92 %106 + OpBranch %90 + %107 = OpLabel + %108 = OpAccessChain %17 %15 %16 %96 + %109 = OpLoad %6 %108 + %110 = OpConvertSToF %41 %109 + %111 = OpCompositeConstruct %42 %110 %110 %110 %110 + OpStore %92 %111 + OpBranch %90 + %90 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 2 3 4 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loop-initializer-value-increased-inside.amber b/vulkan/amber/graphicsfuzz/cov-nested-loop-initializer-value-increased-inside.amber new file mode 100644 index 0000000..c94cf29 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loop-initializer-value-increased-inside.amber @@ -0,0 +1,289 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 3; +# vec4 v = vec4(1.0); +# +# // Iterates four times. +# for(int i = a; i >= 0; i--) +# { +# // Iterates once because of the break at the end of the block. +# for(int j = a; j >= 0; j--) +# { +# // i goes from 3 to 0 decreasing each channel by one. +# v[i] -= _float_1_0; +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# continue; +# } +# +# // Does not affect the outer loop because the initializer +# // has already been run. +# a++; +# +# break; +# } +# } +# +# // Always true. +# if(a == 7 && v == vec4(0)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 108 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %52 %84 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %13 "v" + OpName %16 "i" + OpName %27 "j" + OpName %40 "buf0" + OpMemberName %40 0 "_GLF_uniform_float_values" + OpName %42 "" + OpName %52 "gl_FragCoord" + OpName %84 "_GLF_color" + OpName %86 "buf1" + OpMemberName %86 0 "_GLF_uniform_int_values" + OpName %88 "" + OpDecorate %39 ArrayStride 16 + OpMemberDecorate %40 0 Offset 0 + OpDecorate %40 Block + OpDecorate %42 DescriptorSet 0 + OpDecorate %42 Binding 0 + OpDecorate %52 BuiltIn FragCoord + OpDecorate %84 Location 0 + OpDecorate %85 ArrayStride 16 + OpMemberDecorate %86 0 Offset 0 + OpDecorate %86 Block + OpDecorate %88 DescriptorSet 0 + OpDecorate %88 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 3 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Function %11 + %14 = OpConstant %10 1 + %15 = OpConstantComposite %11 %14 %14 %14 %14 + %24 = OpConstant %6 0 + %25 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 2 + %39 = OpTypeArray %10 %38 + %40 = OpTypeStruct %39 + %41 = OpTypePointer Uniform %40 + %42 = OpVariable %41 Uniform + %43 = OpTypePointer Uniform %10 + %46 = OpTypePointer Function %10 + %51 = OpTypePointer Input %11 + %52 = OpVariable %51 Input + %53 = OpConstant %37 0 + %54 = OpTypePointer Input %10 + %57 = OpConstant %6 1 + %72 = OpConstant %6 7 + %75 = OpConstant %10 0 + %76 = OpConstantComposite %11 %75 %75 %75 %75 + %77 = OpTypeVector %25 4 + %83 = OpTypePointer Output %11 + %84 = OpVariable %83 Output + %85 = OpTypeArray %6 %38 + %86 = OpTypeStruct %85 + %87 = OpTypePointer Uniform %86 + %88 = OpVariable %87 Uniform + %89 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %13 = OpVariable %12 Function + %16 = OpVariable %7 Function + %27 = OpVariable %7 Function + OpStore %8 %9 + OpStore %13 %15 + %17 = OpLoad %6 %8 + OpStore %16 %17 + OpBranch %18 + %18 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %23 = OpLoad %6 %16 + %26 = OpSGreaterThanEqual %25 %23 %24 + OpBranchConditional %26 %19 %20 + %19 = OpLabel + %28 = OpLoad %6 %8 + OpStore %27 %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %6 %27 + %35 = OpSGreaterThanEqual %25 %34 %24 + OpBranchConditional %35 %30 %31 + %30 = OpLabel + %36 = OpLoad %6 %16 + %44 = OpAccessChain %43 %42 %24 %24 + %45 = OpLoad %10 %44 + %47 = OpAccessChain %46 %13 %36 + %48 = OpLoad %10 %47 + %49 = OpFSub %10 %48 %45 + %50 = OpAccessChain %46 %13 %36 + OpStore %50 %49 + %55 = OpAccessChain %54 %52 %53 + %56 = OpLoad %10 %55 + %58 = OpAccessChain %43 %42 %24 %57 + %59 = OpLoad %10 %58 + %60 = OpFOrdLessThan %25 %56 %59 + OpSelectionMerge %62 None + OpBranchConditional %60 %61 %62 + %61 = OpLabel + OpBranch %32 + %62 = OpLabel + %64 = OpLoad %6 %8 + %65 = OpIAdd %6 %64 %57 + OpStore %8 %65 + OpBranch %31 + %32 = OpLabel + %67 = OpLoad %6 %27 + %68 = OpISub %6 %67 %57 + OpStore %27 %68 + OpBranch %29 + %31 = OpLabel + OpBranch %21 + %21 = OpLabel + %69 = OpLoad %6 %16 + %70 = OpISub %6 %69 %57 + OpStore %16 %70 + OpBranch %18 + %20 = OpLabel + %71 = OpLoad %6 %8 + %73 = OpIEqual %25 %71 %72 + %74 = OpLoad %11 %13 + %78 = OpFOrdEqual %77 %74 %76 + %79 = OpAll %25 %78 + %80 = OpLogicalAnd %25 %73 %79 + OpSelectionMerge %82 None + OpBranchConditional %80 %81 %103 + %81 = OpLabel + %90 = OpAccessChain %89 %88 %24 %24 + %91 = OpLoad %6 %90 + %92 = OpConvertSToF %10 %91 + %93 = OpAccessChain %89 %88 %24 %57 + %94 = OpLoad %6 %93 + %95 = OpConvertSToF %10 %94 + %96 = OpAccessChain %89 %88 %24 %57 + %97 = OpLoad %6 %96 + %98 = OpConvertSToF %10 %97 + %99 = OpAccessChain %89 %88 %24 %24 + %100 = OpLoad %6 %99 + %101 = OpConvertSToF %10 %100 + %102 = OpCompositeConstruct %11 %92 %95 %98 %101 + OpStore %84 %102 + OpBranch %82 + %103 = OpLabel + %104 = OpAccessChain %89 %88 %24 %57 + %105 = OpLoad %6 %104 + %106 = OpConvertSToF %10 %105 + %107 = OpCompositeConstruct %11 %106 %106 %106 %106 + OpStore %84 %107 + OpBranch %82 + %82 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loop-large-array-index-using-vector-components.amber b/vulkan/amber/graphicsfuzz/cov-nested-loop-large-array-index-using-vector-components.amber new file mode 100644 index 0000000..7b48b2d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loop-large-array-index-using-vector-components.amber @@ -0,0 +1,398 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# int arr[64] = int[64](1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +# +# void main() +# { +# ivec2 v = ivec2(_int_1); +# bool b = false; +# _GLF_color = vec4(_int_1); +# +# do +# { +# // True for the second iteration. +# if(v.x > _int_1) +# { +# break; +# } +# +# for(int i = 1; i < 8; i ++) +# { +# for(int j = 1; j < 8; j ++) +# { +# // Always true. +# if(arr[i] == _int_1) +# { +# v = ivec2(j, i); +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# continue; +# } +# +# b = true; +# +# // Always false. +# if(gl_FragCoord.y < _float_0_0) +# { +# _GLF_color = vec4(_int_0); +# +# if(gl_FragCoord.y < _float_1_0) +# { +# if(gl_FragCoord.y >= _float_1_0) +# { +# _GLF_color = vec4(_float_1_0); +# } +# return; +# } +# } +# } +# } +# } +# +# // Overwrites a value that is already one. +# arr[v.x + v.y] = _int_1; +# +# // Always false. +# if(arr[_int_1] == _int_2) +# { +# discard; +# } +# } +# while(b); +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 167 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 %83 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %16 "v" + OpName %19 "buf0" + OpMemberName %19 0 "_GLF_uniform_int_values" + OpName %21 "" + OpName %29 "b" + OpName %34 "_GLF_color" + OpName %53 "i" + OpName %62 "j" + OpName %83 "gl_FragCoord" + OpName %89 "buf1" + OpMemberName %89 0 "_GLF_uniform_float_values" + OpName %91 "" + OpDecorate %18 ArrayStride 16 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 0 + OpDecorate %34 Location 0 + OpDecorate %83 BuiltIn FragCoord + OpDecorate %88 ArrayStride 16 + OpMemberDecorate %89 0 Offset 0 + OpDecorate %89 Block + OpDecorate %91 DescriptorSet 0 + OpDecorate %91 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 64 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Private %9 + %11 = OpVariable %10 Private + %12 = OpConstant %6 1 + %13 = OpConstantComposite %9 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 + %14 = OpTypeVector %6 2 + %15 = OpTypePointer Function %14 + %17 = OpConstant %7 3 + %18 = OpTypeArray %6 %17 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpConstant %6 0 + %23 = OpTypePointer Uniform %6 + %27 = OpTypeBool + %28 = OpTypePointer Function %27 + %30 = OpConstantFalse %27 + %31 = OpTypeFloat 32 + %32 = OpTypeVector %31 4 + %33 = OpTypePointer Output %32 + %34 = OpVariable %33 Output + %43 = OpConstant %7 0 + %44 = OpTypePointer Function %6 + %60 = OpConstant %6 8 + %71 = OpTypePointer Private %6 + %82 = OpTypePointer Input %32 + %83 = OpVariable %82 Input + %84 = OpTypePointer Input %31 + %87 = OpConstant %7 2 + %88 = OpTypeArray %31 %87 + %89 = OpTypeStruct %88 + %90 = OpTypePointer Uniform %89 + %91 = OpVariable %90 Uniform + %92 = OpTypePointer Uniform %31 + %99 = OpConstantTrue %27 + %100 = OpConstant %7 1 + %146 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %16 = OpVariable %15 Function + %29 = OpVariable %28 Function + %53 = OpVariable %44 Function + %62 = OpVariable %44 Function + OpStore %11 %13 + %24 = OpAccessChain %23 %21 %22 %12 + %25 = OpLoad %6 %24 + %26 = OpCompositeConstruct %14 %25 %25 + OpStore %16 %26 + OpStore %29 %30 + %35 = OpAccessChain %23 %21 %22 %12 + %36 = OpLoad %6 %35 + %37 = OpConvertSToF %31 %36 + %38 = OpCompositeConstruct %32 %37 %37 %37 %37 + OpStore %34 %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %40 + %40 = OpLabel + %45 = OpAccessChain %44 %16 %43 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %23 %21 %22 %12 + %48 = OpLoad %6 %47 + %49 = OpSGreaterThan %27 %46 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %51 + %50 = OpLabel + OpBranch %41 + %51 = OpLabel + OpStore %53 %12 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %6 %53 + %61 = OpSLessThan %27 %59 %60 + OpBranchConditional %61 %55 %56 + %55 = OpLabel + OpStore %62 %12 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %6 %62 + %69 = OpSLessThan %27 %68 %60 + OpBranchConditional %69 %64 %65 + %64 = OpLabel + %70 = OpLoad %6 %53 + %72 = OpAccessChain %71 %11 %70 + %73 = OpLoad %6 %72 + %74 = OpAccessChain %23 %21 %22 %12 + %75 = OpLoad %6 %74 + %76 = OpIEqual %27 %73 %75 + OpSelectionMerge %78 None + OpBranchConditional %76 %77 %78 + %77 = OpLabel + %79 = OpLoad %6 %62 + %80 = OpLoad %6 %53 + %81 = OpCompositeConstruct %14 %79 %80 + OpStore %16 %81 + %85 = OpAccessChain %84 %83 %43 + %86 = OpLoad %31 %85 + %93 = OpAccessChain %92 %91 %22 %12 + %94 = OpLoad %31 %93 + %95 = OpFOrdLessThan %27 %86 %94 + OpSelectionMerge %97 None + OpBranchConditional %95 %96 %97 + %96 = OpLabel + OpBranch %66 + %97 = OpLabel + OpStore %29 %99 + %101 = OpAccessChain %84 %83 %100 + %102 = OpLoad %31 %101 + %103 = OpAccessChain %92 %91 %22 %12 + %104 = OpLoad %31 %103 + %105 = OpFOrdLessThan %27 %102 %104 + OpSelectionMerge %107 None + OpBranchConditional %105 %106 %107 + %106 = OpLabel + %108 = OpAccessChain %23 %21 %22 %22 + %109 = OpLoad %6 %108 + %110 = OpConvertSToF %31 %109 + %111 = OpCompositeConstruct %32 %110 %110 %110 %110 + OpStore %34 %111 + %112 = OpAccessChain %84 %83 %100 + %113 = OpLoad %31 %112 + %114 = OpAccessChain %92 %91 %22 %22 + %115 = OpLoad %31 %114 + %116 = OpFOrdLessThan %27 %113 %115 + OpSelectionMerge %118 None + OpBranchConditional %116 %117 %118 + %117 = OpLabel + %119 = OpAccessChain %84 %83 %100 + %120 = OpLoad %31 %119 + %121 = OpAccessChain %92 %91 %22 %22 + %122 = OpLoad %31 %121 + %123 = OpFOrdGreaterThanEqual %27 %120 %122 + OpSelectionMerge %125 None + OpBranchConditional %123 %124 %125 + %124 = OpLabel + %126 = OpAccessChain %92 %91 %22 %22 + %127 = OpLoad %31 %126 + %128 = OpCompositeConstruct %32 %127 %127 %127 %127 + OpStore %34 %128 + OpBranch %125 + %125 = OpLabel + OpReturn + %118 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %78 + %78 = OpLabel + OpBranch %66 + %66 = OpLabel + %130 = OpLoad %6 %62 + %131 = OpIAdd %6 %130 %12 + OpStore %62 %131 + OpBranch %63 + %65 = OpLabel + OpBranch %57 + %57 = OpLabel + %132 = OpLoad %6 %53 + %133 = OpIAdd %6 %132 %12 + OpStore %53 %133 + OpBranch %54 + %56 = OpLabel + %134 = OpAccessChain %44 %16 %43 + %135 = OpLoad %6 %134 + %136 = OpAccessChain %44 %16 %100 + %137 = OpLoad %6 %136 + %138 = OpIAdd %6 %135 %137 + %139 = OpAccessChain %23 %21 %22 %12 + %140 = OpLoad %6 %139 + %141 = OpAccessChain %71 %11 %138 + OpStore %141 %140 + %142 = OpAccessChain %23 %21 %22 %12 + %143 = OpLoad %6 %142 + %144 = OpAccessChain %71 %11 %143 + %145 = OpLoad %6 %144 + %147 = OpAccessChain %23 %21 %22 %146 + %148 = OpLoad %6 %147 + %149 = OpIEqual %27 %145 %148 + OpSelectionMerge %151 None + OpBranchConditional %149 %150 %151 + %150 = OpLabel + OpTerminateInvocation + %151 = OpLabel + OpBranch %42 + %42 = OpLabel + %153 = OpLoad %27 %29 + OpBranchConditional %153 %39 %41 + %41 = OpLabel + %154 = OpAccessChain %23 %21 %22 %12 + %155 = OpLoad %6 %154 + %156 = OpConvertSToF %31 %155 + %157 = OpAccessChain %23 %21 %22 %22 + %158 = OpLoad %6 %157 + %159 = OpConvertSToF %31 %158 + %160 = OpAccessChain %23 %21 %22 %22 + %161 = OpLoad %6 %160 + %162 = OpConvertSToF %31 %161 + %163 = OpAccessChain %23 %21 %22 %12 + %164 = OpLoad %6 %163 + %165 = OpConvertSToF %31 %164 + %166 = OpCompositeConstruct %32 %156 %159 %162 %165 + OpStore %34 %166 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loop-not-greater-than-increment-array-element.amber b/vulkan/amber/graphicsfuzz/cov-nested-loop-not-greater-than-increment-array-element.amber new file mode 100644 index 0000000..0214f40 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loop-not-greater-than-increment-array-element.amber @@ -0,0 +1,315 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_5 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _float_21_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_0_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [21.0, 1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# // Contents of _GLF_uniform_int_values: [5, 1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(push_constant) uniform buf_push +# { +# highp vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float arr[9] = float[9](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0); +# +# for(int i = _int_0; i < _int_5; i ++) +# { +# for(int j = 0; j < 4; j ++) +# { +# // Always true. +# if(!(injectionSwitch.x > injectionSwitch.y)) +# { +# do +# { +# // Always true. +# if(!(injectionSwitch.x > injectionSwitch.y)) +# { +# // Always true. +# if(!(gl_FragCoord.x < 0.0)) +# { +# // Iterated 20 times. +# arr[_int_1] += _float_1_0; +# } +# } +# } +# while(gl_FragCoord.y < _float_0_0); // Always false. +# } +# } +# } +# +# // Always true. +# if(arr[_int_1] == _float_21_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %98 %135 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %43 "buf1" + OpMemberName %43 0 "_GLF_uniform_int_values" + OpName %45 "" + OpName %70 "buf_push" + OpMemberName %70 0 "injectionSwitch" + OpName %72 "" + OpName %98 "gl_FragCoord" + OpName %135 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %42 ArrayStride 16 + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 1 + OpMemberDecorate %70 0 Offset 0 + OpDecorate %70 Block + OpDecorate %98 BuiltIn FragCoord + OpDecorate %135 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 9 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 3 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpConstant %17 1 + %20 = OpTypePointer Uniform %6 + %42 = OpTypeArray %17 %12 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %46 = OpConstant %17 2 + %47 = OpTypePointer Uniform %17 + %58 = OpTypeBool + %67 = OpConstant %17 4 + %69 = OpTypeVector %6 2 + %70 = OpTypeStruct %69 + %71 = OpTypePointer PushConstant %70 + %72 = OpVariable %71 PushConstant + %73 = OpConstant %7 0 + %74 = OpTypePointer PushConstant %6 + %77 = OpConstant %7 1 + %96 = OpTypeVector %6 4 + %97 = OpTypePointer Input %96 + %98 = OpVariable %97 Input + %99 = OpTypePointer Input %6 + %102 = OpConstant %6 0 + %111 = OpTypePointer Function %6 + %134 = OpTypePointer Output %96 + %135 = OpVariable %134 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %21 = OpAccessChain %20 %16 %18 %19 + %22 = OpLoad %6 %21 + %39 = OpCompositeConstruct %9 %22 %22 %22 %22 %22 %22 %22 %22 %22 + OpStore %11 %39 + %48 = OpAccessChain %47 %45 %18 %46 + %49 = OpLoad %17 %48 + OpBranch %50 + %50 = OpLabel + %154 = OpPhi %17 %49 %5 %124 %53 + %56 = OpAccessChain %47 %45 %18 %18 + %57 = OpLoad %17 %56 + %59 = OpSLessThan %58 %154 %57 + OpLoopMerge %52 %53 None + OpBranchConditional %59 %51 %52 + %51 = OpLabel + OpBranch %61 + %61 = OpLabel + %155 = OpPhi %17 %18 %51 %122 %64 + %68 = OpSLessThan %58 %155 %67 + OpLoopMerge %63 %64 None + OpBranchConditional %68 %62 %63 + %62 = OpLabel + %75 = OpAccessChain %74 %72 %18 %73 + %76 = OpLoad %6 %75 + %78 = OpAccessChain %74 %72 %18 %77 + %79 = OpLoad %6 %78 + %80 = OpFOrdGreaterThan %58 %76 %79 + %81 = OpLogicalNot %58 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %83 + %82 = OpLabel + OpBranch %84 + %84 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %85 + %85 = OpLabel + OpSelectionMerge %95 None + OpBranchConditional %81 %94 %95 + %94 = OpLabel + %100 = OpAccessChain %99 %98 %73 + %101 = OpLoad %6 %100 + %103 = OpFOrdLessThan %58 %101 %102 + %104 = OpLogicalNot %58 %103 + OpSelectionMerge %106 None + OpBranchConditional %104 %105 %106 + %105 = OpLabel + %107 = OpAccessChain %47 %45 %18 %19 + %108 = OpLoad %17 %107 + %112 = OpAccessChain %111 %11 %108 + %113 = OpLoad %6 %112 + %114 = OpFAdd %6 %113 %22 + OpStore %112 %114 + OpBranch %106 + %106 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %87 + %87 = OpLabel + %116 = OpAccessChain %99 %98 %77 + %117 = OpLoad %6 %116 + %118 = OpAccessChain %20 %16 %18 %46 + %119 = OpLoad %6 %118 + %120 = OpFOrdLessThan %58 %117 %119 + OpBranchConditional %120 %84 %86 + %86 = OpLabel + OpBranch %83 + %83 = OpLabel + OpBranch %64 + %64 = OpLabel + %122 = OpIAdd %17 %155 %19 + OpBranch %61 + %63 = OpLabel + OpBranch %53 + %53 = OpLabel + %124 = OpIAdd %17 %154 %19 + OpBranch %50 + %52 = OpLabel + %125 = OpAccessChain %47 %45 %18 %19 + %126 = OpLoad %17 %125 + %127 = OpAccessChain %111 %11 %126 + %128 = OpLoad %6 %127 + %129 = OpAccessChain %20 %16 %18 %18 + %130 = OpLoad %6 %129 + %131 = OpFOrdEqual %58 %128 %130 + OpSelectionMerge %133 None + OpBranchConditional %131 %132 %149 + %132 = OpLabel + %138 = OpConvertSToF %6 %126 + %141 = OpConvertSToF %6 %49 + %148 = OpCompositeConstruct %96 %138 %141 %141 %138 + OpStore %135 %148 + OpBranch %133 + %149 = OpLabel + %152 = OpConvertSToF %6 %49 + %153 = OpCompositeConstruct %96 %152 %152 %152 %152 + OpStore %135 %153 + OpBranch %133 + %133 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 5 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 21.0 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed.amber b/vulkan/amber/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed.amber new file mode 100644 index 0000000..682b396 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed.amber @@ -0,0 +1,301 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# #define _int_4 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_100 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# #define _float_5_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [5.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [4, 1, 100, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v0 = vec4(_float_1_0); +# vec4 v1 = vec4(_float_5_0); +# +# for(int a = _int_1; a < _int_4; a++) +# { +# for(int c = _int_0; c < _int_100; c++) +# { +# v0[_GLF_MAKE_IN_BOUNDS_INT(c, 4)] -= _float_1_0; +# +# // Always false. +# if(_int_1 == _int_0) +# { +# // Undefined behavior because edge0.w > edge1.w, but this is never executed. +# v1[a] = smoothstep(vec4(_float_1_0, _float_1_0, _float_1_0, 3.0), vec4(1.0), v0)[a]; +# } +# } +# } +# +# // Always true because the x coordinate is never touched. +# if(v1.x == _float_5_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 125 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %106 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v0" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %23 "v1" + OpName %28 "a" + OpName %31 "buf1" + OpMemberName %31 0 "_GLF_uniform_int_values" + OpName %33 "" + OpName %47 "c" + OpName %106 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %30 ArrayStride 16 + OpMemberDecorate %31 0 Offset 0 + OpDecorate %31 Block + OpDecorate %33 DescriptorSet 0 + OpDecorate %33 Binding 1 + OpDecorate %106 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpConstant %16 1 + %19 = OpTypePointer Uniform %6 + %27 = OpTypePointer Function %16 + %29 = OpConstant %10 4 + %30 = OpTypeArray %16 %29 + %31 = OpTypeStruct %30 + %32 = OpTypePointer Uniform %31 + %33 = OpVariable %32 Uniform + %34 = OpTypePointer Uniform %16 + %45 = OpTypeBool + %48 = OpConstant %16 3 + %57 = OpConstant %16 2 + %65 = OpTypePointer Function %6 + %84 = OpConstant %6 3 + %86 = OpConstant %6 1 + %87 = OpConstantComposite %7 %86 %86 %86 %86 + %97 = OpConstant %10 0 + %105 = OpTypePointer Output %7 + %106 = OpVariable %105 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %23 = OpVariable %8 Function + %28 = OpVariable %27 Function + %47 = OpVariable %27 Function + %20 = OpAccessChain %19 %15 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpCompositeConstruct %7 %21 %21 %21 %21 + OpStore %9 %22 + %24 = OpAccessChain %19 %15 %17 %17 + %25 = OpLoad %6 %24 + %26 = OpCompositeConstruct %7 %25 %25 %25 %25 + OpStore %23 %26 + %35 = OpAccessChain %34 %33 %17 %18 + %36 = OpLoad %16 %35 + OpStore %28 %36 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %16 %28 + %43 = OpAccessChain %34 %33 %17 %17 + %44 = OpLoad %16 %43 + %46 = OpSLessThan %45 %42 %44 + OpBranchConditional %46 %38 %39 + %38 = OpLabel + %49 = OpAccessChain %34 %33 %17 %48 + %50 = OpLoad %16 %49 + OpStore %47 %50 + OpBranch %51 + %51 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %16 %47 + %58 = OpAccessChain %34 %33 %17 %57 + %59 = OpLoad %16 %58 + %60 = OpSLessThan %45 %56 %59 + OpBranchConditional %60 %52 %53 + %52 = OpLabel + %61 = OpLoad %16 %47 + %62 = OpExtInst %16 %1 SClamp %61 %17 %48 + %63 = OpAccessChain %19 %15 %17 %18 + %64 = OpLoad %6 %63 + %66 = OpAccessChain %65 %9 %62 + %67 = OpLoad %6 %66 + %68 = OpFSub %6 %67 %64 + %69 = OpAccessChain %65 %9 %62 + OpStore %69 %68 + %70 = OpAccessChain %34 %33 %17 %18 + %71 = OpLoad %16 %70 + %72 = OpAccessChain %34 %33 %17 %48 + %73 = OpLoad %16 %72 + %74 = OpIEqual %45 %71 %73 + OpSelectionMerge %76 None + OpBranchConditional %74 %75 %76 + %75 = OpLabel + %77 = OpLoad %16 %28 + %78 = OpAccessChain %19 %15 %17 %18 + %79 = OpLoad %6 %78 + %80 = OpAccessChain %19 %15 %17 %18 + %81 = OpLoad %6 %80 + %82 = OpAccessChain %19 %15 %17 %18 + %83 = OpLoad %6 %82 + %85 = OpCompositeConstruct %7 %79 %81 %83 %84 + %88 = OpLoad %7 %9 + %89 = OpExtInst %7 %1 SmoothStep %85 %87 %88 + %90 = OpLoad %16 %28 + %91 = OpVectorExtractDynamic %6 %89 %90 + %92 = OpAccessChain %65 %23 %77 + OpStore %92 %91 + OpBranch %76 + %76 = OpLabel + OpBranch %54 + %54 = OpLabel + %93 = OpLoad %16 %47 + %94 = OpIAdd %16 %93 %18 + OpStore %47 %94 + OpBranch %51 + %53 = OpLabel + OpBranch %40 + %40 = OpLabel + %95 = OpLoad %16 %28 + %96 = OpIAdd %16 %95 %18 + OpStore %28 %96 + OpBranch %37 + %39 = OpLabel + %98 = OpAccessChain %65 %23 %97 + %99 = OpLoad %6 %98 + %100 = OpAccessChain %19 %15 %17 %17 + %101 = OpLoad %6 %100 + %102 = OpFOrdEqual %45 %99 %101 + OpSelectionMerge %104 None + OpBranchConditional %102 %103 %120 + %103 = OpLabel + %107 = OpAccessChain %34 %33 %17 %18 + %108 = OpLoad %16 %107 + %109 = OpConvertSToF %6 %108 + %110 = OpAccessChain %34 %33 %17 %48 + %111 = OpLoad %16 %110 + %112 = OpConvertSToF %6 %111 + %113 = OpAccessChain %34 %33 %17 %48 + %114 = OpLoad %16 %113 + %115 = OpConvertSToF %6 %114 + %116 = OpAccessChain %34 %33 %17 %18 + %117 = OpLoad %16 %116 + %118 = OpConvertSToF %6 %117 + %119 = OpCompositeConstruct %7 %109 %112 %115 %118 + OpStore %106 %119 + OpBranch %104 + %120 = OpLabel + %121 = OpAccessChain %34 %33 %17 %48 + %122 = OpLoad %16 %121 + %123 = OpConvertSToF %6 %122 + %124 = OpCompositeConstruct %7 %123 %123 %123 %123 + OpStore %106 %124 + OpBranch %104 + %104 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 4 1 100 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 5.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-array-choose-red-last-iteration.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-array-choose-red-last-iteration.amber new file mode 100644 index 0000000..96afdfa --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-array-choose-red-last-iteration.amber @@ -0,0 +1,284 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_4 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [4, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# highp vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# _GLF_color = vec4(_float_1_0); +# } +# +# for(int i = _int_0; i < _int_4; i ++) +# { +# // Iterates once. +# do +# { +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# _GLF_color = atanh(vec4(_float_1_0)); +# } +# do +# { +# _GLF_color = vec4(_float_1_0); +# } +# while(gl_FragCoord.x < _float_0_0); +# } +# while(injectionSwitch.x > injectionSwitch.y); +# +# // The last value of red is chosen during the last iteration. +# _GLF_color = vec4[4](vec4(_int_0), vec4(_int_0), vec4(_int_0), vec4(_int_1, _int_0, _int_0, _int_1))[i]; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 129 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %27 %79 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "buf2" + OpMemberName %8 0 "injectionSwitch" + OpName %10 "" + OpName %27 "_GLF_color" + OpName %30 "buf0" + OpMemberName %30 0 "_GLF_uniform_float_values" + OpName %32 "" + OpName %40 "buf1" + OpMemberName %40 0 "_GLF_uniform_int_values" + OpName %42 "" + OpName %79 "gl_FragCoord" + OpName %122 "indexable" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 2 + OpDecorate %27 Location 0 + OpDecorate %29 ArrayStride 16 + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 0 + OpDecorate %39 ArrayStride 16 + OpMemberDecorate %40 0 Offset 0 + OpDecorate %40 Block + OpDecorate %42 DescriptorSet 0 + OpDecorate %42 Binding 1 + OpDecorate %79 BuiltIn FragCoord + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeStruct %7 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %6 + %18 = OpConstant %13 1 + %21 = OpTypeBool + %25 = OpTypeVector %6 4 + %26 = OpTypePointer Output %25 + %27 = OpVariable %26 Output + %28 = OpConstant %13 2 + %29 = OpTypeArray %6 %28 + %30 = OpTypeStruct %29 + %31 = OpTypePointer Uniform %30 + %32 = OpVariable %31 Uniform + %38 = OpConstant %13 3 + %39 = OpTypeArray %11 %38 + %40 = OpTypeStruct %39 + %41 = OpTypePointer Uniform %40 + %42 = OpVariable %41 Uniform + %43 = OpConstant %11 1 + %44 = OpTypePointer Uniform %11 + %78 = OpTypePointer Input %25 + %79 = OpVariable %78 Input + %80 = OpTypePointer Input %6 + %103 = OpConstant %11 2 + %117 = OpConstant %13 4 + %118 = OpTypeArray %25 %117 + %121 = OpTypePointer Function %118 + %123 = OpTypePointer Function %25 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %122 = OpVariable %121 Function + %16 = OpAccessChain %15 %10 %12 %14 + %17 = OpLoad %6 %16 + %19 = OpAccessChain %15 %10 %12 %18 + %20 = OpLoad %6 %19 + %22 = OpFOrdGreaterThan %21 %17 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpAccessChain %15 %32 %12 %12 + %34 = OpLoad %6 %33 + %35 = OpCompositeConstruct %25 %34 %34 %34 %34 + OpStore %27 %35 + OpBranch %24 + %24 = OpLabel + %45 = OpAccessChain %44 %42 %12 %43 + %46 = OpLoad %11 %45 + OpBranch %47 + %47 = OpLabel + %128 = OpPhi %11 %46 %24 %127 %50 + %53 = OpAccessChain %44 %42 %12 %12 + %54 = OpLoad %11 %53 + %55 = OpSLessThan %21 %128 %54 + OpLoopMerge %49 %50 None + OpBranchConditional %55 %48 %49 + %48 = OpLabel + OpBranch %56 + %56 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %57 + %57 = OpLabel + OpSelectionMerge %66 None + OpBranchConditional %22 %65 %66 + %65 = OpLabel + %67 = OpAccessChain %15 %32 %12 %12 + %68 = OpLoad %6 %67 + %69 = OpCompositeConstruct %25 %68 %68 %68 %68 + %70 = OpExtInst %25 %1 Atanh %69 + OpStore %27 %70 + OpBranch %66 + %66 = OpLabel + OpBranch %71 + %71 = OpLabel + %75 = OpAccessChain %15 %32 %12 %12 + %76 = OpLoad %6 %75 + %77 = OpCompositeConstruct %25 %76 %76 %76 %76 + OpStore %27 %77 + %81 = OpAccessChain %80 %79 %14 + %82 = OpLoad %6 %81 + %83 = OpAccessChain %15 %32 %12 %43 + %84 = OpLoad %6 %83 + %85 = OpFOrdLessThan %21 %82 %84 + OpLoopMerge %73 %71 None + OpBranchConditional %85 %71 %73 + %73 = OpLabel + OpBranch %59 + %59 = OpLabel + OpBranchConditional %22 %56 %58 + %58 = OpLabel + %93 = OpConvertSToF %6 %46 + %94 = OpCompositeConstruct %25 %93 %93 %93 %93 + %104 = OpAccessChain %44 %42 %12 %103 + %105 = OpLoad %11 %104 + %106 = OpConvertSToF %6 %105 + %116 = OpCompositeConstruct %25 %106 %93 %93 %106 + %119 = OpCompositeConstruct %118 %94 %94 %94 %116 + OpStore %122 %119 + %124 = OpAccessChain %123 %122 %128 + %125 = OpLoad %25 %124 + OpStore %27 %125 + OpBranch %50 + %50 = OpLabel + %127 = OpIAdd %11 %128 %43 + OpBranch %47 + %49 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 4 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-assign-vector-elements-from-matrix-no-negative-indexing.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-assign-vector-elements-from-matrix-no-negative-indexing.amber new file mode 100644 index 0000000..8164e79 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-assign-vector-elements-from-matrix-no-negative-indexing.amber @@ -0,0 +1,361 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [3, 1, 0, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of zero: 0.0 +# layout(set = 0, binding = 2) uniform buf2 { +# float zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat4 m = mat4(_int_1); +# m = mat4(_int_1); +# vec4 v = vec4(_int_2); +# int a = _int_0; +# +# for(int i = _int_1; a < _int_3; i++) +# { +# a++; +# +# // Iterates for j = 1 and j = 0 when i = 1. +# for(int j = _int_1; i <= _int_1 && a < _int_3; j--) +# { +# a++; +# +# // Executed twice: +# // v[1] = m[1][1] = 1 +# // v[0] = m[0][1] = 0 +# v[j] = m[j][i]; +# +# // Always false. +# if(zero > _float_1_0) +# { +# discard; +# } +# } +# } +# +# // Always true. +# if(v == vec4(_int_0, _int_1, _int_2, _int_2)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 154 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %135 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "m" + OpName %15 "buf1" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %40 "v" + OpName %47 "a" + OpName %51 "i" + OpName %66 "j" + OpName %94 "buf2" + OpMemberName %94 0 "zero" + OpName %96 "" + OpName %102 "buf0" + OpMemberName %102 0 "_GLF_uniform_float_values" + OpName %104 "" + OpName %135 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 1 + OpMemberDecorate %94 0 Offset 0 + OpDecorate %94 Block + OpDecorate %96 DescriptorSet 0 + OpDecorate %96 Binding 2 + OpDecorate %101 ArrayStride 16 + OpMemberDecorate %102 0 Offset 0 + OpDecorate %102 Block + OpDecorate %104 DescriptorSet 0 + OpDecorate %104 Binding 0 + OpDecorate %135 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeMatrix %7 4 + %9 = OpTypePointer Function %8 + %11 = OpTypeInt 32 1 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 4 + %14 = OpTypeArray %11 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %11 0 + %19 = OpConstant %11 1 + %20 = OpTypePointer Uniform %11 + %24 = OpConstant %6 1 + %25 = OpConstant %6 0 + %39 = OpTypePointer Function %7 + %41 = OpConstant %11 3 + %46 = OpTypePointer Function %11 + %48 = OpConstant %11 2 + %62 = OpTypeBool + %90 = OpTypePointer Function %6 + %94 = OpTypeStruct %6 + %95 = OpTypePointer Uniform %94 + %96 = OpVariable %95 Uniform + %97 = OpTypePointer Uniform %6 + %100 = OpConstant %12 1 + %101 = OpTypeArray %6 %100 + %102 = OpTypeStruct %101 + %103 = OpTypePointer Uniform %102 + %104 = OpVariable %103 Uniform + %129 = OpTypeVector %62 4 + %134 = OpTypePointer Output %7 + %135 = OpVariable %134 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %40 = OpVariable %39 Function + %47 = OpVariable %46 Function + %51 = OpVariable %46 Function + %66 = OpVariable %46 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %11 %21 + %23 = OpConvertSToF %6 %22 + %26 = OpCompositeConstruct %7 %23 %25 %25 %25 + %27 = OpCompositeConstruct %7 %25 %23 %25 %25 + %28 = OpCompositeConstruct %7 %25 %25 %23 %25 + %29 = OpCompositeConstruct %7 %25 %25 %25 %23 + %30 = OpCompositeConstruct %8 %26 %27 %28 %29 + OpStore %10 %30 + %31 = OpAccessChain %20 %17 %18 %19 + %32 = OpLoad %11 %31 + %33 = OpConvertSToF %6 %32 + %34 = OpCompositeConstruct %7 %33 %25 %25 %25 + %35 = OpCompositeConstruct %7 %25 %33 %25 %25 + %36 = OpCompositeConstruct %7 %25 %25 %33 %25 + %37 = OpCompositeConstruct %7 %25 %25 %25 %33 + %38 = OpCompositeConstruct %8 %34 %35 %36 %37 + OpStore %10 %38 + %42 = OpAccessChain %20 %17 %18 %41 + %43 = OpLoad %11 %42 + %44 = OpConvertSToF %6 %43 + %45 = OpCompositeConstruct %7 %44 %44 %44 %44 + OpStore %40 %45 + %49 = OpAccessChain %20 %17 %18 %48 + %50 = OpLoad %11 %49 + OpStore %47 %50 + %52 = OpAccessChain %20 %17 %18 %19 + %53 = OpLoad %11 %52 + OpStore %51 %53 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %11 %47 + %60 = OpAccessChain %20 %17 %18 %18 + %61 = OpLoad %11 %60 + %63 = OpSLessThan %62 %59 %61 + OpBranchConditional %63 %55 %56 + %55 = OpLabel + %64 = OpLoad %11 %47 + %65 = OpIAdd %11 %64 %19 + OpStore %47 %65 + %67 = OpAccessChain %20 %17 %18 %19 + %68 = OpLoad %11 %67 + OpStore %66 %68 + OpBranch %69 + %69 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %11 %51 + %75 = OpAccessChain %20 %17 %18 %19 + %76 = OpLoad %11 %75 + %77 = OpSLessThanEqual %62 %74 %76 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %80 = OpLoad %11 %47 + %81 = OpAccessChain %20 %17 %18 %18 + %82 = OpLoad %11 %81 + %83 = OpSLessThan %62 %80 %82 + OpBranch %79 + %79 = OpLabel + %84 = OpPhi %62 %77 %73 %83 %78 + OpBranchConditional %84 %70 %71 + %70 = OpLabel + %85 = OpLoad %11 %47 + %86 = OpIAdd %11 %85 %19 + OpStore %47 %86 + %87 = OpLoad %11 %66 + %88 = OpLoad %11 %66 + %89 = OpLoad %11 %51 + %91 = OpAccessChain %90 %10 %88 %89 + %92 = OpLoad %6 %91 + %93 = OpAccessChain %90 %40 %87 + OpStore %93 %92 + %98 = OpAccessChain %97 %96 %18 + %99 = OpLoad %6 %98 + %105 = OpAccessChain %97 %104 %18 %18 + %106 = OpLoad %6 %105 + %107 = OpFOrdGreaterThan %62 %99 %106 + OpSelectionMerge %109 None + OpBranchConditional %107 %108 %109 + %108 = OpLabel + OpTerminateInvocation + %109 = OpLabel + OpBranch %72 + %72 = OpLabel + %111 = OpLoad %11 %66 + %112 = OpISub %11 %111 %19 + OpStore %66 %112 + OpBranch %69 + %71 = OpLabel + OpBranch %57 + %57 = OpLabel + %113 = OpLoad %11 %51 + %114 = OpIAdd %11 %113 %19 + OpStore %51 %114 + OpBranch %54 + %56 = OpLabel + %115 = OpLoad %7 %40 + %116 = OpAccessChain %20 %17 %18 %48 + %117 = OpLoad %11 %116 + %118 = OpConvertSToF %6 %117 + %119 = OpAccessChain %20 %17 %18 %19 + %120 = OpLoad %11 %119 + %121 = OpConvertSToF %6 %120 + %122 = OpAccessChain %20 %17 %18 %41 + %123 = OpLoad %11 %122 + %124 = OpConvertSToF %6 %123 + %125 = OpAccessChain %20 %17 %18 %41 + %126 = OpLoad %11 %125 + %127 = OpConvertSToF %6 %126 + %128 = OpCompositeConstruct %7 %118 %121 %124 %127 + %130 = OpFOrdEqual %129 %115 %128 + %131 = OpAll %62 %130 + OpSelectionMerge %133 None + OpBranchConditional %131 %132 %149 + %132 = OpLabel + %136 = OpAccessChain %20 %17 %18 %19 + %137 = OpLoad %11 %136 + %138 = OpConvertSToF %6 %137 + %139 = OpAccessChain %20 %17 %18 %48 + %140 = OpLoad %11 %139 + %141 = OpConvertSToF %6 %140 + %142 = OpAccessChain %20 %17 %18 %48 + %143 = OpLoad %11 %142 + %144 = OpConvertSToF %6 %143 + %145 = OpAccessChain %20 %17 %18 %19 + %146 = OpLoad %11 %145 + %147 = OpConvertSToF %6 %146 + %148 = OpCompositeConstruct %7 %138 %141 %144 %147 + OpStore %135 %148 + OpBranch %133 + %149 = OpLabel + %150 = OpAccessChain %20 %17 %18 %48 + %151 = OpLoad %11 %150 + %152 = OpConvertSToF %6 %151 + %153 = OpCompositeConstruct %7 %152 %152 %152 %152 + OpStore %135 %153 + OpBranch %133 + %133 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 1 0 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-clamp-ivec-push-constant-increment-global-counter.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-clamp-ivec-push-constant-increment-global-counter.amber new file mode 100644 index 0000000..a2263ed --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-clamp-ivec-push-constant-increment-global-counter.amber @@ -0,0 +1,217 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_5 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 5, 3] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# highp vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# // Iterated three times. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# a++; +# +# // Iterated four times. +# for(int i = clamp(ivec2(1, int(injectionSwitch.y)), ivec2(0), ivec2(_int_1)).x; i < _int_5; i++) +# { +# _GLF_global_loop_count++; +# } +# } +# +# // Always true. +# if(a == _int_3) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 102 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %76 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %76 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %76 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpConstant %6 0 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 4 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 1 + %19 = OpTypePointer Uniform %6 + %28 = OpConstant %6 10 + %29 = OpTypeBool + %34 = OpTypeFloat 32 + %44 = OpTypeVector %6 2 + %46 = OpConstantComposite %44 %9 %9 + %59 = OpConstant %6 2 + %68 = OpConstant %6 3 + %74 = OpTypeVector %34 4 + %75 = OpTypePointer Output %74 + %76 = OpVariable %75 Output + %101 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %20 = OpAccessChain %19 %17 %9 %18 + %21 = OpLoad %6 %20 + OpBranch %22 + %22 = OpLabel + %96 = OpPhi %6 %21 %5 %32 %25 + %95 = OpPhi %6 %9 %5 %98 %25 + %30 = OpSLessThan %29 %95 %28 + OpLoopMerge %24 %25 None + OpBranchConditional %30 %23 %24 + %23 = OpLabel + %32 = OpIAdd %6 %96 %18 + %45 = OpCompositeConstruct %44 %18 %101 + %47 = OpAccessChain %19 %17 %9 %9 + %48 = OpLoad %6 %47 + %49 = OpCompositeConstruct %44 %48 %48 + %50 = OpExtInst %44 %1 SClamp %45 %46 %49 + %52 = OpCompositeExtract %6 %50 0 + OpBranch %53 + %53 = OpLabel + %98 = OpPhi %6 %95 %23 %64 %54 + %97 = OpPhi %6 %52 %23 %66 %54 + %60 = OpAccessChain %19 %17 %9 %59 + %61 = OpLoad %6 %60 + %62 = OpSLessThan %29 %97 %61 + OpLoopMerge %55 %54 None + OpBranchConditional %62 %54 %55 + %54 = OpLabel + %64 = OpIAdd %6 %98 %18 + %66 = OpIAdd %6 %97 %18 + OpBranch %53 + %55 = OpLabel + OpBranch %25 + %25 = OpLabel + OpBranch %22 + %24 = OpLabel + %69 = OpAccessChain %19 %17 %9 %68 + %70 = OpLoad %6 %69 + %71 = OpIEqual %29 %96 %70 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %90 + %72 = OpLabel + %77 = OpAccessChain %19 %17 %9 %9 + %78 = OpLoad %6 %77 + %79 = OpConvertSToF %34 %78 + %82 = OpConvertSToF %34 %21 + %89 = OpCompositeConstruct %74 %79 %82 %82 %79 + OpStore %76 %89 + OpBranch %73 + %90 = OpLabel + %93 = OpConvertSToF %34 %21 + %94 = OpCompositeConstruct %74 %93 %93 %93 %93 + OpStore %76 %94 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 5 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-copy-array-elements-skip-first.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-copy-array-elements-skip-first.amber new file mode 100644 index 0000000..37aced7 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-copy-array-elements-skip-first.amber @@ -0,0 +1,465 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_9 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# #define _int_2 _GLF_uniform_int_values[4] +# #define _int_3 _GLF_uniform_int_values[5] +# #define _int_4 _GLF_uniform_int_values[6] +# #define _int_5 _GLF_uniform_int_values[7] +# #define _int_6 _GLF_uniform_int_values[8] +# #define _int_7 _GLF_uniform_int_values[9] +# #define _int_8 _GLF_uniform_int_values[10] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 9, 10, 0, 2, 3, 4, 5, 6, 7, 8] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[11]; +# }; +# +# // Contents of zero: 0 +# layout(set = 0, binding = 2) uniform buf2 { +# int zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[10] = int[10](_int_0, _int_1, _int_2, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9); +# int a = _int_0; +# +# // Iterates two times. +# for(int i = 1; i < _int_3; i++) +# { +# // Always false. +# if(a >= _int_1) +# { +# break; +# } +# +# // Always false. +# if(zero < _int_0) +# { +# a++; +# } +# +# int b = _int_1; +# +# // Iterates once. +# do +# { +# // Iterates six times until breaks because of b >= 7. +# for(int j = 0; j < _int_10; j++) +# { +# if(b >= _int_7) +# { +# break; +# } +# +# b++; +# +# // True when: +# // j == 0 && i == 1 +# // j == 1 && i == 1 +# // j == 0 && i == 2 +# // j == 1 && i == 2 +# // j == 2 && i == 2 +# if(j < i + 1) +# { +# continue; +# } +# +# arr[j] = arr[_int_1]; +# } +# } +# while(gl_FragCoord.y < _float_0_0); +# } +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Verify results and set color to black if failed. +# int ref[10] = int[10](_int_0, _int_1, _int_1, _int_1, _int_1, _int_1, _int_6, _int_7, _int_8, _int_9); +# for(int i = _int_0; i < _int_10; i++) +# { +# if(arr[i] != ref[i]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 207 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %128 %144 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %50 "a" + OpName %53 "i" + OpName %71 "buf2" + OpMemberName %71 0 "zero" + OpName %73 "" + OpName %83 "b" + OpName %90 "j" + OpName %128 "gl_FragCoord" + OpName %134 "buf0" + OpMemberName %134 0 "_GLF_uniform_float_values" + OpName %136 "" + OpName %144 "_GLF_color" + OpName %158 "ref" + OpName %180 "i" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpMemberDecorate %71 0 Offset 0 + OpDecorate %71 Block + OpDecorate %73 DescriptorSet 0 + OpDecorate %73 Binding 2 + OpDecorate %128 BuiltIn FragCoord + OpDecorate %133 ArrayStride 16 + OpMemberDecorate %134 0 Offset 0 + OpDecorate %134 Block + OpDecorate %136 DescriptorSet 0 + OpDecorate %136 Binding 0 + OpDecorate %144 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 11 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 3 + %19 = OpTypePointer Uniform %6 + %24 = OpConstant %6 4 + %27 = OpConstant %6 5 + %30 = OpConstant %6 6 + %33 = OpConstant %6 7 + %36 = OpConstant %6 8 + %39 = OpConstant %6 9 + %42 = OpConstant %6 10 + %45 = OpConstant %6 1 + %49 = OpTypePointer Function %6 + %62 = OpTypeBool + %71 = OpTypeStruct %6 + %72 = OpTypePointer Uniform %71 + %73 = OpVariable %72 Uniform + %97 = OpConstant %6 2 + %125 = OpTypeFloat 32 + %126 = OpTypeVector %125 4 + %127 = OpTypePointer Input %126 + %128 = OpVariable %127 Input + %129 = OpConstant %7 1 + %130 = OpTypePointer Input %125 + %133 = OpTypeArray %125 %129 + %134 = OpTypeStruct %133 + %135 = OpTypePointer Uniform %134 + %136 = OpVariable %135 Uniform + %137 = OpTypePointer Uniform %125 + %143 = OpTypePointer Output %126 + %144 = OpVariable %143 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %50 = OpVariable %49 Function + %53 = OpVariable %49 Function + %83 = OpVariable %49 Function + %90 = OpVariable %49 Function + %158 = OpVariable %10 Function + %180 = OpVariable %49 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %16 %17 %17 + %23 = OpLoad %6 %22 + %25 = OpAccessChain %19 %16 %17 %24 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %19 %16 %17 %27 + %29 = OpLoad %6 %28 + %31 = OpAccessChain %19 %16 %17 %30 + %32 = OpLoad %6 %31 + %34 = OpAccessChain %19 %16 %17 %33 + %35 = OpLoad %6 %34 + %37 = OpAccessChain %19 %16 %17 %36 + %38 = OpLoad %6 %37 + %40 = OpAccessChain %19 %16 %17 %39 + %41 = OpLoad %6 %40 + %43 = OpAccessChain %19 %16 %17 %42 + %44 = OpLoad %6 %43 + %46 = OpAccessChain %19 %16 %17 %45 + %47 = OpLoad %6 %46 + %48 = OpCompositeConstruct %9 %21 %23 %26 %29 %32 %35 %38 %41 %44 %47 + OpStore %11 %48 + %51 = OpAccessChain %19 %16 %17 %18 + %52 = OpLoad %6 %51 + OpStore %50 %52 + OpStore %53 %45 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %6 %53 + %60 = OpAccessChain %19 %16 %17 %27 + %61 = OpLoad %6 %60 + %63 = OpSLessThan %62 %59 %61 + OpBranchConditional %63 %55 %56 + %55 = OpLabel + %64 = OpLoad %6 %50 + %65 = OpAccessChain %19 %16 %17 %17 + %66 = OpLoad %6 %65 + %67 = OpSGreaterThanEqual %62 %64 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %69 + %68 = OpLabel + OpBranch %56 + %69 = OpLabel + %74 = OpAccessChain %19 %73 %17 + %75 = OpLoad %6 %74 + %76 = OpAccessChain %19 %16 %17 %18 + %77 = OpLoad %6 %76 + %78 = OpSLessThan %62 %75 %77 + OpSelectionMerge %80 None + OpBranchConditional %78 %79 %80 + %79 = OpLabel + %81 = OpLoad %6 %50 + %82 = OpIAdd %6 %81 %45 + OpStore %50 %82 + OpBranch %80 + %80 = OpLabel + %84 = OpAccessChain %19 %16 %17 %17 + %85 = OpLoad %6 %84 + OpStore %83 %85 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %87 + %87 = OpLabel + OpStore %90 %17 + OpBranch %91 + %91 = OpLabel + OpLoopMerge %93 %94 None + OpBranch %95 + %95 = OpLabel + %96 = OpLoad %6 %90 + %98 = OpAccessChain %19 %16 %17 %97 + %99 = OpLoad %6 %98 + %100 = OpSLessThan %62 %96 %99 + OpBranchConditional %100 %92 %93 + %92 = OpLabel + %101 = OpLoad %6 %83 + %102 = OpAccessChain %19 %16 %17 %39 + %103 = OpLoad %6 %102 + %104 = OpSGreaterThanEqual %62 %101 %103 + OpSelectionMerge %106 None + OpBranchConditional %104 %105 %106 + %105 = OpLabel + OpBranch %93 + %106 = OpLabel + %108 = OpLoad %6 %83 + %109 = OpIAdd %6 %108 %45 + OpStore %83 %109 + %110 = OpLoad %6 %90 + %111 = OpLoad %6 %53 + %112 = OpIAdd %6 %111 %45 + %113 = OpSLessThan %62 %110 %112 + OpSelectionMerge %115 None + OpBranchConditional %113 %114 %115 + %114 = OpLabel + OpBranch %94 + %115 = OpLabel + %117 = OpLoad %6 %90 + %118 = OpAccessChain %19 %16 %17 %17 + %119 = OpLoad %6 %118 + %120 = OpAccessChain %49 %11 %119 + %121 = OpLoad %6 %120 + %122 = OpAccessChain %49 %11 %117 + OpStore %122 %121 + OpBranch %94 + %94 = OpLabel + %123 = OpLoad %6 %90 + %124 = OpIAdd %6 %123 %45 + OpStore %90 %124 + OpBranch %91 + %93 = OpLabel + OpBranch %89 + %89 = OpLabel + %131 = OpAccessChain %130 %128 %129 + %132 = OpLoad %125 %131 + %138 = OpAccessChain %137 %136 %17 %17 + %139 = OpLoad %125 %138 + %140 = OpFOrdLessThan %62 %132 %139 + OpBranchConditional %140 %86 %88 + %88 = OpLabel + OpBranch %57 + %57 = OpLabel + %141 = OpLoad %6 %53 + %142 = OpIAdd %6 %141 %45 + OpStore %53 %142 + OpBranch %54 + %56 = OpLabel + %145 = OpAccessChain %19 %16 %17 %17 + %146 = OpLoad %6 %145 + %147 = OpConvertSToF %125 %146 + %148 = OpAccessChain %19 %16 %17 %18 + %149 = OpLoad %6 %148 + %150 = OpConvertSToF %125 %149 + %151 = OpAccessChain %19 %16 %17 %18 + %152 = OpLoad %6 %151 + %153 = OpConvertSToF %125 %152 + %154 = OpAccessChain %19 %16 %17 %17 + %155 = OpLoad %6 %154 + %156 = OpConvertSToF %125 %155 + %157 = OpCompositeConstruct %126 %147 %150 %153 %156 + OpStore %144 %157 + %159 = OpAccessChain %19 %16 %17 %18 + %160 = OpLoad %6 %159 + %161 = OpAccessChain %19 %16 %17 %17 + %162 = OpLoad %6 %161 + %163 = OpAccessChain %19 %16 %17 %17 + %164 = OpLoad %6 %163 + %165 = OpAccessChain %19 %16 %17 %17 + %166 = OpLoad %6 %165 + %167 = OpAccessChain %19 %16 %17 %17 + %168 = OpLoad %6 %167 + %169 = OpAccessChain %19 %16 %17 %17 + %170 = OpLoad %6 %169 + %171 = OpAccessChain %19 %16 %17 %36 + %172 = OpLoad %6 %171 + %173 = OpAccessChain %19 %16 %17 %39 + %174 = OpLoad %6 %173 + %175 = OpAccessChain %19 %16 %17 %42 + %176 = OpLoad %6 %175 + %177 = OpAccessChain %19 %16 %17 %45 + %178 = OpLoad %6 %177 + %179 = OpCompositeConstruct %9 %160 %162 %164 %166 %168 %170 %172 %174 %176 %178 + OpStore %158 %179 + %181 = OpAccessChain %19 %16 %17 %18 + %182 = OpLoad %6 %181 + OpStore %180 %182 + OpBranch %183 + %183 = OpLabel + OpLoopMerge %185 %186 None + OpBranch %187 + %187 = OpLabel + %188 = OpLoad %6 %180 + %189 = OpAccessChain %19 %16 %17 %97 + %190 = OpLoad %6 %189 + %191 = OpSLessThan %62 %188 %190 + OpBranchConditional %191 %184 %185 + %184 = OpLabel + %192 = OpLoad %6 %180 + %193 = OpAccessChain %49 %11 %192 + %194 = OpLoad %6 %193 + %195 = OpLoad %6 %180 + %196 = OpAccessChain %49 %158 %195 + %197 = OpLoad %6 %196 + %198 = OpINotEqual %62 %194 %197 + OpSelectionMerge %200 None + OpBranchConditional %198 %199 %200 + %199 = OpLabel + %201 = OpAccessChain %19 %16 %17 %18 + %202 = OpLoad %6 %201 + %203 = OpConvertSToF %125 %202 + %204 = OpCompositeConstruct %126 %203 %203 %203 %203 + OpStore %144 %204 + OpBranch %200 + %200 = OpLabel + OpBranch %186 + %186 = OpLabel + %205 = OpLoad %6 %180 + %206 = OpIAdd %6 %205 %45 + OpStore %180 %206 + OpBranch %183 + %185 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 STD140 DATA + 0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 9 10 0 2 3 4 5 6 7 8 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-decrease-ivec-component.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-decrease-ivec-component.amber new file mode 100644 index 0000000..71e3c8b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-decrease-ivec-component.amber @@ -0,0 +1,243 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# ivec4 v = ivec4(_int_1); +# +# // Always true. +# if(_int_1 == 1) +# { +# // Iterates twice. +# for(int i = 2; i >= 1; i--) +# { +# // Iterates once when i = 2 and twice when i = 1. +# for(int j = _int_2; j >= i; j--) +# { +# v[i]--; +# } +# } +# } +# +# // Always true. +# if(v == ivec4(_int_1, -_int_1, _int_0, _int_1)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 95 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %76 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %29 "i" + OpName %38 "j" + OpName %76 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %76 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 3 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %6 0 + %17 = OpTypePointer Uniform %6 + %23 = OpConstant %6 1 + %24 = OpTypeBool + %28 = OpTypePointer Function %6 + %30 = OpConstant %6 2 + %68 = OpTypeVector %24 4 + %73 = OpTypeFloat 32 + %74 = OpTypeVector %73 4 + %75 = OpTypePointer Output %74 + %76 = OpVariable %75 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %29 = OpVariable %28 Function + %38 = OpVariable %28 Function + %18 = OpAccessChain %17 %15 %16 %16 + %19 = OpLoad %6 %18 + %20 = OpCompositeConstruct %7 %19 %19 %19 %19 + OpStore %9 %20 + %21 = OpAccessChain %17 %15 %16 %16 + %22 = OpLoad %6 %21 + %25 = OpIEqual %24 %22 %23 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %27 + %26 = OpLabel + OpStore %29 %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %6 %29 + %37 = OpSGreaterThanEqual %24 %36 %23 + OpBranchConditional %37 %32 %33 + %32 = OpLabel + %39 = OpAccessChain %17 %15 %16 %30 + %40 = OpLoad %6 %39 + OpStore %38 %40 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %6 %38 + %47 = OpLoad %6 %29 + %48 = OpSGreaterThanEqual %24 %46 %47 + OpBranchConditional %48 %42 %43 + %42 = OpLabel + %49 = OpLoad %6 %29 + %50 = OpAccessChain %28 %9 %49 + %51 = OpLoad %6 %50 + %52 = OpISub %6 %51 %23 + OpStore %50 %52 + OpBranch %44 + %44 = OpLabel + %53 = OpLoad %6 %38 + %54 = OpISub %6 %53 %23 + OpStore %38 %54 + OpBranch %41 + %43 = OpLabel + OpBranch %34 + %34 = OpLabel + %55 = OpLoad %6 %29 + %56 = OpISub %6 %55 %23 + OpStore %29 %56 + OpBranch %31 + %33 = OpLabel + OpBranch %27 + %27 = OpLabel + %57 = OpLoad %7 %9 + %58 = OpAccessChain %17 %15 %16 %16 + %59 = OpLoad %6 %58 + %60 = OpAccessChain %17 %15 %16 %16 + %61 = OpLoad %6 %60 + %62 = OpSNegate %6 %61 + %63 = OpAccessChain %17 %15 %16 %23 + %64 = OpLoad %6 %63 + %65 = OpAccessChain %17 %15 %16 %16 + %66 = OpLoad %6 %65 + %67 = OpCompositeConstruct %7 %59 %62 %64 %66 + %69 = OpIEqual %68 %57 %67 + %70 = OpAll %24 %69 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %90 + %71 = OpLabel + %77 = OpAccessChain %17 %15 %16 %16 + %78 = OpLoad %6 %77 + %79 = OpConvertSToF %73 %78 + %80 = OpAccessChain %17 %15 %16 %23 + %81 = OpLoad %6 %80 + %82 = OpConvertSToF %73 %81 + %83 = OpAccessChain %17 %15 %16 %23 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %73 %84 + %86 = OpAccessChain %17 %15 %16 %16 + %87 = OpLoad %6 %86 + %88 = OpConvertSToF %73 %87 + %89 = OpCompositeConstruct %74 %79 %82 %85 %88 + OpStore %76 %89 + OpBranch %72 + %90 = OpLabel + %91 = OpAccessChain %17 %15 %16 %23 + %92 = OpLoad %6 %91 + %93 = OpConvertSToF %73 %92 + %94 = OpCompositeConstruct %74 %93 %93 %93 %93 + OpStore %76 %94 + OpBranch %72 + %72 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-decrease-vector-component-by-matrix-element-global-loop-counter.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-decrease-vector-component-by-matrix-element-global-loop-counter.amber new file mode 100644 index 0000000..a160661 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-decrease-vector-component-by-matrix-element-global-loop-counter.amber @@ -0,0 +1,298 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v = vec4(_float_1_0); +# +# // Iterated twice with i = 1, 0. +# for(int i = _int_1; i >= 0 && _GLF_global_loop_count < _GLF_global_loop_bound; i--) +# { +# _GLF_global_loop_count++; +# +# for(int j = 1; j >= 1 && _GLF_global_loop_count < _GLF_global_loop_bound; j--) +# { +# _GLF_global_loop_count++; +# +# // i = 1: decreases v[1] by one. +# // i = 0: decreases v[0] by zero. +# v[i] -= mat4(1.0)[i][_int_1]; +# } +# } +# +# // Always true. +# if(v == vec4(_int_1, _int_0, _int_1, _int_1)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 126 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %107 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %13 "v" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_float_values" + OpName %19 "" + OpName %25 "i" + OpName %28 "buf1" + OpMemberName %28 0 "_GLF_uniform_int_values" + OpName %30 "" + OpName %49 "j" + OpName %75 "indexable" + OpName %107 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %27 ArrayStride 16 + OpMemberDecorate %28 0 Offset 0 + OpDecorate %28 Block + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 1 + OpDecorate %107 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Function %11 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 1 + %16 = OpTypeArray %10 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypePointer Uniform %10 + %24 = OpTypePointer Function %6 + %26 = OpConstant %14 2 + %27 = OpTypeArray %6 %26 + %28 = OpTypeStruct %27 + %29 = OpTypePointer Uniform %28 + %30 = OpVariable %29 Uniform + %31 = OpConstant %6 1 + %32 = OpTypePointer Uniform %6 + %41 = OpTypeBool + %44 = OpConstant %6 10 + %63 = OpTypeMatrix %11 4 + %64 = OpConstant %10 1 + %65 = OpConstant %10 0 + %66 = OpConstantComposite %11 %64 %65 %65 %65 + %67 = OpConstantComposite %11 %65 %64 %65 %65 + %68 = OpConstantComposite %11 %65 %65 %64 %65 + %69 = OpConstantComposite %11 %65 %65 %65 %64 + %70 = OpConstantComposite %63 %66 %67 %68 %69 + %74 = OpTypePointer Function %63 + %76 = OpTypePointer Function %10 + %101 = OpTypeVector %41 4 + %106 = OpTypePointer Output %11 + %107 = OpVariable %106 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %13 = OpVariable %12 Function + %25 = OpVariable %24 Function + %49 = OpVariable %24 Function + %75 = OpVariable %74 Function + OpStore %8 %9 + %21 = OpAccessChain %20 %19 %9 %9 + %22 = OpLoad %10 %21 + %23 = OpCompositeConstruct %11 %22 %22 %22 %22 + OpStore %13 %23 + %33 = OpAccessChain %32 %30 %9 %31 + %34 = OpLoad %6 %33 + OpStore %25 %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %6 %25 + %42 = OpSGreaterThanEqual %41 %40 %9 + %43 = OpLoad %6 %8 + %45 = OpSLessThan %41 %43 %44 + %46 = OpLogicalAnd %41 %42 %45 + OpBranchConditional %46 %36 %37 + %36 = OpLabel + %47 = OpLoad %6 %8 + %48 = OpIAdd %6 %47 %31 + OpStore %8 %48 + OpStore %49 %31 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %49 + %56 = OpSGreaterThanEqual %41 %55 %31 + %57 = OpLoad %6 %8 + %58 = OpSLessThan %41 %57 %44 + %59 = OpLogicalAnd %41 %56 %58 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %8 + %61 = OpIAdd %6 %60 %31 + OpStore %8 %61 + %62 = OpLoad %6 %25 + %71 = OpLoad %6 %25 + %72 = OpAccessChain %32 %30 %9 %31 + %73 = OpLoad %6 %72 + OpStore %75 %70 + %77 = OpAccessChain %76 %75 %71 %73 + %78 = OpLoad %10 %77 + %79 = OpAccessChain %76 %13 %62 + %80 = OpLoad %10 %79 + %81 = OpFSub %10 %80 %78 + %82 = OpAccessChain %76 %13 %62 + OpStore %82 %81 + OpBranch %53 + %53 = OpLabel + %83 = OpLoad %6 %49 + %84 = OpISub %6 %83 %31 + OpStore %49 %84 + OpBranch %50 + %52 = OpLabel + OpBranch %38 + %38 = OpLabel + %85 = OpLoad %6 %25 + %86 = OpISub %6 %85 %31 + OpStore %25 %86 + OpBranch %35 + %37 = OpLabel + %87 = OpLoad %11 %13 + %88 = OpAccessChain %32 %30 %9 %31 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %10 %89 + %91 = OpAccessChain %32 %30 %9 %9 + %92 = OpLoad %6 %91 + %93 = OpConvertSToF %10 %92 + %94 = OpAccessChain %32 %30 %9 %31 + %95 = OpLoad %6 %94 + %96 = OpConvertSToF %10 %95 + %97 = OpAccessChain %32 %30 %9 %31 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %10 %98 + %100 = OpCompositeConstruct %11 %90 %93 %96 %99 + %102 = OpFOrdEqual %101 %87 %100 + %103 = OpAll %41 %102 + OpSelectionMerge %105 None + OpBranchConditional %103 %104 %121 + %104 = OpLabel + %108 = OpAccessChain %32 %30 %9 %31 + %109 = OpLoad %6 %108 + %110 = OpConvertSToF %10 %109 + %111 = OpAccessChain %32 %30 %9 %9 + %112 = OpLoad %6 %111 + %113 = OpConvertSToF %10 %112 + %114 = OpAccessChain %32 %30 %9 %9 + %115 = OpLoad %6 %114 + %116 = OpConvertSToF %10 %115 + %117 = OpAccessChain %32 %30 %9 %31 + %118 = OpLoad %6 %117 + %119 = OpConvertSToF %10 %118 + %120 = OpCompositeConstruct %11 %110 %113 %116 %119 + OpStore %107 %120 + OpBranch %105 + %121 = OpLabel + %122 = OpAccessChain %32 %30 %9 %9 + %123 = OpLoad %6 %122 + %124 = OpConvertSToF %10 %123 + %125 = OpCompositeConstruct %11 %124 %124 %124 %124 + OpStore %107 %125 + OpBranch %105 + %105 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-different-iteration-rates-function-copy-array-elements.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-different-iteration-rates-function-copy-array-elements.amber new file mode 100644 index 0000000..a546511 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-different-iteration-rates-function-copy-array-elements.amber @@ -0,0 +1,326 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_6 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [2, 1, 0, 6] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# int arr0[10] = int[10](0, 0, 0, 0, 0, 0, 0, 0, 0, 0), arr1[10] = int[10](1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +# +# layout(location = 0) out vec4 _GLF_color; +# +# void func(int x, int y) +# { +# // Sets arr1[1..5] = arr0[1] = 0. +# for(int i = _int_1; i < _int_6; i++) +# { +# arr1[i] = arr0[_int_1]; +# } +# +# int a = 0; +# +# // Sets arr0[x..min(x+8, 9)] = arr1[1] = 0. +# for(int i = x; i < y; i++) +# { +# if(a++ > 6) +# { +# break; +# } +# +# arr0[i] = arr1[_int_1]; +# } +# } +# +# void main() +# { +# int a = 1; +# +# // Iterates i = 1, 2, 2, 2, 2. +# for(int i = 1; a < 6; i = _int_2, a++) +# { +# // Iterates j = 1..9 during the first round, and +# // j = 1, 3, 5, 7, 9 for the other rounds. +# for(int j = 1; j < 10; j += i) +# { +# func(j, 10); +# } +# } +# +# // Sets _GLF_color to (1, 0, 0, 1). +# _GLF_color = vec4(arr1[_int_0], arr0[_int_0], arr1[_int_1], arr1[_int_6]); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 133 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %110 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "func(i1;i1;" + OpName %9 "x" + OpName %10 "y" + OpName %17 "arr0" + OpName %20 "arr1" + OpName %23 "i" + OpName %26 "buf0" + OpMemberName %26 0 "_GLF_uniform_int_values" + OpName %28 "" + OpName %52 "a" + OpName %53 "i" + OpName %78 "a" + OpName %79 "i" + OpName %87 "j" + OpName %96 "param" + OpName %98 "param" + OpName %110 "_GLF_color" + OpDecorate %25 ArrayStride 16 + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 0 + OpDecorate %110 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 10 + %15 = OpTypeArray %6 %14 + %16 = OpTypePointer Private %15 + %17 = OpVariable %16 Private + %18 = OpConstant %6 0 + %19 = OpConstantComposite %15 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 + %20 = OpVariable %16 Private + %21 = OpConstant %6 1 + %22 = OpConstantComposite %15 %21 %21 %21 %21 %21 %21 %21 %21 %21 %21 + %24 = OpConstant %13 4 + %25 = OpTypeArray %6 %24 + %26 = OpTypeStruct %25 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpTypePointer Uniform %6 + %38 = OpConstant %6 3 + %41 = OpTypeBool + %46 = OpTypePointer Private %6 + %65 = OpConstant %6 6 + %94 = OpConstant %6 10 + %107 = OpTypeFloat 32 + %108 = OpTypeVector %107 4 + %109 = OpTypePointer Output %108 + %110 = OpVariable %109 Output + %111 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %78 = OpVariable %7 Function + %79 = OpVariable %7 Function + %87 = OpVariable %7 Function + %96 = OpVariable %7 Function + %98 = OpVariable %7 Function + OpStore %17 %19 + OpStore %20 %22 + OpStore %78 %21 + OpStore %79 %21 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %82 %83 None + OpBranch %84 + %84 = OpLabel + %85 = OpLoad %6 %78 + %86 = OpSLessThan %41 %85 %65 + OpBranchConditional %86 %81 %82 + %81 = OpLabel + OpStore %87 %21 + OpBranch %88 + %88 = OpLabel + OpLoopMerge %90 %91 None + OpBranch %92 + %92 = OpLabel + %93 = OpLoad %6 %87 + %95 = OpSLessThan %41 %93 %94 + OpBranchConditional %95 %89 %90 + %89 = OpLabel + %97 = OpLoad %6 %87 + OpStore %96 %97 + OpStore %98 %94 + %99 = OpFunctionCall %2 %11 %96 %98 + OpBranch %91 + %91 = OpLabel + %100 = OpLoad %6 %79 + %101 = OpLoad %6 %87 + %102 = OpIAdd %6 %101 %100 + OpStore %87 %102 + OpBranch %88 + %90 = OpLabel + OpBranch %83 + %83 = OpLabel + %103 = OpAccessChain %29 %28 %18 %18 + %104 = OpLoad %6 %103 + OpStore %79 %104 + %105 = OpLoad %6 %78 + %106 = OpIAdd %6 %105 %21 + OpStore %78 %106 + OpBranch %80 + %82 = OpLabel + %112 = OpAccessChain %29 %28 %18 %111 + %113 = OpLoad %6 %112 + %114 = OpAccessChain %46 %20 %113 + %115 = OpLoad %6 %114 + %116 = OpConvertSToF %107 %115 + %117 = OpAccessChain %29 %28 %18 %111 + %118 = OpLoad %6 %117 + %119 = OpAccessChain %46 %17 %118 + %120 = OpLoad %6 %119 + %121 = OpConvertSToF %107 %120 + %122 = OpAccessChain %29 %28 %18 %21 + %123 = OpLoad %6 %122 + %124 = OpAccessChain %46 %20 %123 + %125 = OpLoad %6 %124 + %126 = OpConvertSToF %107 %125 + %127 = OpAccessChain %29 %28 %18 %38 + %128 = OpLoad %6 %127 + %129 = OpAccessChain %46 %20 %128 + %130 = OpLoad %6 %129 + %131 = OpConvertSToF %107 %130 + %132 = OpCompositeConstruct %108 %116 %121 %126 %131 + OpStore %110 %132 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %23 = OpVariable %7 Function + %52 = OpVariable %7 Function + %53 = OpVariable %7 Function + %30 = OpAccessChain %29 %28 %18 %21 + %31 = OpLoad %6 %30 + OpStore %23 %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %6 %23 + %39 = OpAccessChain %29 %28 %18 %38 + %40 = OpLoad %6 %39 + %42 = OpSLessThan %41 %37 %40 + OpBranchConditional %42 %33 %34 + %33 = OpLabel + %43 = OpLoad %6 %23 + %44 = OpAccessChain %29 %28 %18 %21 + %45 = OpLoad %6 %44 + %47 = OpAccessChain %46 %17 %45 + %48 = OpLoad %6 %47 + %49 = OpAccessChain %46 %20 %43 + OpStore %49 %48 + OpBranch %35 + %35 = OpLabel + %50 = OpLoad %6 %23 + %51 = OpIAdd %6 %50 %21 + OpStore %23 %51 + OpBranch %32 + %34 = OpLabel + OpStore %52 %18 + %54 = OpLoad %6 %9 + OpStore %53 %54 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %6 %53 + %61 = OpLoad %6 %10 + %62 = OpSLessThan %41 %60 %61 + OpBranchConditional %62 %56 %57 + %56 = OpLabel + %63 = OpLoad %6 %52 + %64 = OpIAdd %6 %63 %21 + OpStore %52 %64 + %66 = OpSGreaterThan %41 %63 %65 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %68 + %67 = OpLabel + OpBranch %57 + %68 = OpLabel + %70 = OpLoad %6 %53 + %71 = OpAccessChain %29 %28 %18 %21 + %72 = OpLoad %6 %71 + %73 = OpAccessChain %46 %20 %72 + %74 = OpLoad %6 %73 + %75 = OpAccessChain %46 %17 %70 + OpStore %75 %74 + OpBranch %58 + %58 = OpLabel + %76 = OpLoad %6 %53 + %77 = OpIAdd %6 %76 %21 + OpStore %53 %77 + OpBranch %55 + %57 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 1 0 6 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-divide-integer-constant-always-zero.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-divide-integer-constant-always-zero.amber new file mode 100644 index 0000000..8d705a7 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-divide-integer-constant-always-zero.amber @@ -0,0 +1,228 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_3 _GLF_uniform_int_values[2] +# #define _int_6 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 3, 6] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1; +# +# // Iterated once. +# while(a < _int_3) +# { +# int b = _int_1; +# +# // Iterated until the break. +# do +# { +# _GLF_global_loop_count ++; +# +# if(b >= _int_6) +# { +# break; +# } +# b++; +# +# int unused = _int_1; +# // a / 256 is always zero simplifying the line below to a = b. +# a = (a / 256 + b); +# } +# while(_GLF_global_loop_count < _GLF_global_loop_bound); +# } +# +# // The coverage point is lost if a or _GLF_global_loop_count is checked, so just write the correct color. +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 80 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %66 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %11 "a" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %32 "b" + OpName %52 "unused" + OpName %66 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %66 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 4 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypePointer Uniform %6 + %27 = OpConstant %6 2 + %30 = OpTypeBool + %40 = OpConstant %6 1 + %43 = OpConstant %6 3 + %56 = OpConstant %6 256 + %61 = OpConstant %6 10 + %63 = OpTypeFloat 32 + %64 = OpTypeVector %63 4 + %65 = OpTypePointer Output %64 + %66 = OpVariable %65 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %32 = OpVariable %10 Function + %52 = OpVariable %10 Function + OpStore %8 %9 + %19 = OpAccessChain %18 %17 %9 %9 + %20 = OpLoad %6 %19 + OpStore %11 %20 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %6 %11 + %28 = OpAccessChain %18 %17 %9 %27 + %29 = OpLoad %6 %28 + %31 = OpSLessThan %30 %26 %29 + OpBranchConditional %31 %22 %23 + %22 = OpLabel + %33 = OpAccessChain %18 %17 %9 %9 + %34 = OpLoad %6 %33 + OpStore %32 %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %36 + %36 = OpLabel + %39 = OpLoad %6 %8 + %41 = OpIAdd %6 %39 %40 + OpStore %8 %41 + %42 = OpLoad %6 %32 + %44 = OpAccessChain %18 %17 %9 %43 + %45 = OpLoad %6 %44 + %46 = OpSGreaterThanEqual %30 %42 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + OpBranch %37 + %48 = OpLabel + %50 = OpLoad %6 %32 + %51 = OpIAdd %6 %50 %40 + OpStore %32 %51 + %53 = OpAccessChain %18 %17 %9 %9 + %54 = OpLoad %6 %53 + OpStore %52 %54 + %55 = OpLoad %6 %11 + %57 = OpSDiv %6 %55 %56 + %58 = OpLoad %6 %32 + %59 = OpIAdd %6 %57 %58 + OpStore %11 %59 + OpBranch %38 + %38 = OpLabel + %60 = OpLoad %6 %8 + %62 = OpSLessThan %30 %60 %61 + OpBranchConditional %62 %35 %37 + %37 = OpLabel + OpBranch %24 + %24 = OpLabel + OpBranch %21 + %23 = OpLabel + %67 = OpAccessChain %18 %17 %9 %9 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %63 %68 + %70 = OpAccessChain %18 %17 %9 %40 + %71 = OpLoad %6 %70 + %72 = OpConvertSToF %63 %71 + %73 = OpAccessChain %18 %17 %9 %40 + %74 = OpLoad %6 %73 + %75 = OpConvertSToF %63 %74 + %76 = OpAccessChain %18 %17 %9 %9 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %63 %77 + %79 = OpCompositeConstruct %64 %69 %72 %75 %78 + OpStore %66 %79 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 3 6 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-float-array-select-by-fragcoord.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-float-array-select-by-fragcoord.amber new file mode 100644 index 0000000..1199b8c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-float-array-select-by-fragcoord.amber @@ -0,0 +1,690 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# #define LOOP for (int i = 0; i < 1; i++) +# +# precision highp float; +# precision highp int; +# +# const int _GLF_global_loop_bound = 100; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float arr[10] = float[10](1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0); +# int index = 0; +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# // The inner loop will be iterated just once. +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# LOOP { LOOP { LOOP { LOOP { LOOP +# { +# _GLF_global_loop_count ++; +# } +# } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } +# +# // In the end all elemenst of arr have a value of 2.0. +# arr[_GLF_MAKE_IN_BOUNDS_INT(index, 10)] = float[10](2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0)[_GLF_MAKE_IN_BOUNDS_INT(index, 10)]; +# index++; +# } +# +# // The selected indices don't matter as all have the same data of 2.0. +# vec2 v = vec2(arr[_GLF_MAKE_IN_BOUNDS_INT(int(gl_FragCoord.x), 10)], arr[_GLF_MAKE_IN_BOUNDS_INT(int(gl_FragCoord.y), 10)]); +# +# // Always true. +# if (v.x == 2.0 && v.y == 2.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 583 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %431 %460 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %15 "arr" + OpName %419 "indexable" + OpName %431 "gl_FragCoord" + OpName %460 "_GLF_color" + OpDecorate %431 BuiltIn FragCoord + OpDecorate %460 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 10 + %13 = OpTypeArray %10 %12 + %14 = OpTypePointer Function %13 + %16 = OpConstant %10 1 + %17 = OpConstantComposite %13 %16 %16 %16 %16 %16 %16 %16 %16 %16 %16 + %26 = OpConstant %6 100 + %27 = OpTypeBool + %36 = OpConstant %6 1 + %413 = OpConstant %6 9 + %415 = OpConstant %10 2 + %416 = OpConstantComposite %13 %415 %415 %415 %415 %415 %415 %415 %415 %415 %415 + %420 = OpTypePointer Function %10 + %429 = OpTypeVector %10 4 + %430 = OpTypePointer Input %429 + %431 = OpVariable %430 Input + %432 = OpConstant %11 0 + %433 = OpTypePointer Input %10 + %440 = OpConstant %11 1 + %459 = OpTypePointer Output %429 + %460 = OpVariable %459 Output + %461 = OpConstant %10 0 + %462 = OpConstantComposite %429 %16 %461 %461 %16 + %464 = OpConstantComposite %429 %461 %461 %461 %461 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %15 = OpVariable %14 Function + %419 = OpVariable %14 Function + OpStore %15 %17 + OpBranch %20 + %20 = OpLabel + %470 = OpPhi %6 %9 %5 %425 %23 + %467 = OpPhi %6 %9 %5 %582 %23 + %28 = OpSLessThan %27 %467 %26 + OpLoopMerge %22 %23 None + OpBranchConditional %28 %21 %22 + %21 = OpLabel + OpBranch %30 + %30 = OpLabel + %468 = OpPhi %6 %9 %21 %411 %33 + %582 = OpPhi %6 %467 %21 %581 %33 + %37 = OpSLessThan %27 %468 %36 + OpLoopMerge %32 %33 None + OpBranchConditional %37 %31 %32 + %31 = OpLabel + OpBranch %39 + %39 = OpLabel + %471 = OpPhi %6 %9 %31 %409 %42 + %581 = OpPhi %6 %582 %31 %580 %42 + %45 = OpSLessThan %27 %471 %36 + OpLoopMerge %41 %42 None + OpBranchConditional %45 %40 %41 + %40 = OpLabel + OpBranch %47 + %47 = OpLabel + %473 = OpPhi %6 %9 %40 %407 %50 + %580 = OpPhi %6 %581 %40 %579 %50 + %53 = OpSLessThan %27 %473 %36 + OpLoopMerge %49 %50 None + OpBranchConditional %53 %48 %49 + %48 = OpLabel + OpBranch %55 + %55 = OpLabel + %475 = OpPhi %6 %9 %48 %405 %58 + %579 = OpPhi %6 %580 %48 %578 %58 + %61 = OpSLessThan %27 %475 %36 + OpLoopMerge %57 %58 None + OpBranchConditional %61 %56 %57 + %56 = OpLabel + OpBranch %63 + %63 = OpLabel + %477 = OpPhi %6 %9 %56 %403 %66 + %578 = OpPhi %6 %579 %56 %577 %66 + %69 = OpSLessThan %27 %477 %36 + OpLoopMerge %65 %66 None + OpBranchConditional %69 %64 %65 + %64 = OpLabel + OpBranch %71 + %71 = OpLabel + %479 = OpPhi %6 %9 %64 %401 %74 + %577 = OpPhi %6 %578 %64 %576 %74 + %77 = OpSLessThan %27 %479 %36 + OpLoopMerge %73 %74 None + OpBranchConditional %77 %72 %73 + %72 = OpLabel + OpBranch %79 + %79 = OpLabel + %481 = OpPhi %6 %9 %72 %399 %82 + %576 = OpPhi %6 %577 %72 %575 %82 + %85 = OpSLessThan %27 %481 %36 + OpLoopMerge %81 %82 None + OpBranchConditional %85 %80 %81 + %80 = OpLabel + OpBranch %87 + %87 = OpLabel + %483 = OpPhi %6 %9 %80 %397 %90 + %575 = OpPhi %6 %576 %80 %574 %90 + %93 = OpSLessThan %27 %483 %36 + OpLoopMerge %89 %90 None + OpBranchConditional %93 %88 %89 + %88 = OpLabel + OpBranch %95 + %95 = OpLabel + %485 = OpPhi %6 %9 %88 %395 %98 + %574 = OpPhi %6 %575 %88 %573 %98 + %101 = OpSLessThan %27 %485 %36 + OpLoopMerge %97 %98 None + OpBranchConditional %101 %96 %97 + %96 = OpLabel + OpBranch %103 + %103 = OpLabel + %487 = OpPhi %6 %9 %96 %393 %106 + %573 = OpPhi %6 %574 %96 %572 %106 + %109 = OpSLessThan %27 %487 %36 + OpLoopMerge %105 %106 None + OpBranchConditional %109 %104 %105 + %104 = OpLabel + OpBranch %111 + %111 = OpLabel + %489 = OpPhi %6 %9 %104 %391 %114 + %572 = OpPhi %6 %573 %104 %571 %114 + %117 = OpSLessThan %27 %489 %36 + OpLoopMerge %113 %114 None + OpBranchConditional %117 %112 %113 + %112 = OpLabel + OpBranch %119 + %119 = OpLabel + %491 = OpPhi %6 %9 %112 %389 %122 + %571 = OpPhi %6 %572 %112 %570 %122 + %125 = OpSLessThan %27 %491 %36 + OpLoopMerge %121 %122 None + OpBranchConditional %125 %120 %121 + %120 = OpLabel + OpBranch %127 + %127 = OpLabel + %493 = OpPhi %6 %9 %120 %387 %130 + %570 = OpPhi %6 %571 %120 %569 %130 + %133 = OpSLessThan %27 %493 %36 + OpLoopMerge %129 %130 None + OpBranchConditional %133 %128 %129 + %128 = OpLabel + OpBranch %135 + %135 = OpLabel + %495 = OpPhi %6 %9 %128 %385 %138 + %569 = OpPhi %6 %570 %128 %568 %138 + %141 = OpSLessThan %27 %495 %36 + OpLoopMerge %137 %138 None + OpBranchConditional %141 %136 %137 + %136 = OpLabel + OpBranch %143 + %143 = OpLabel + %497 = OpPhi %6 %9 %136 %383 %146 + %568 = OpPhi %6 %569 %136 %567 %146 + %149 = OpSLessThan %27 %497 %36 + OpLoopMerge %145 %146 None + OpBranchConditional %149 %144 %145 + %144 = OpLabel + OpBranch %151 + %151 = OpLabel + %499 = OpPhi %6 %9 %144 %381 %154 + %567 = OpPhi %6 %568 %144 %566 %154 + %157 = OpSLessThan %27 %499 %36 + OpLoopMerge %153 %154 None + OpBranchConditional %157 %152 %153 + %152 = OpLabel + OpBranch %159 + %159 = OpLabel + %501 = OpPhi %6 %9 %152 %379 %162 + %566 = OpPhi %6 %567 %152 %565 %162 + %165 = OpSLessThan %27 %501 %36 + OpLoopMerge %161 %162 None + OpBranchConditional %165 %160 %161 + %160 = OpLabel + OpBranch %167 + %167 = OpLabel + %503 = OpPhi %6 %9 %160 %377 %170 + %565 = OpPhi %6 %566 %160 %564 %170 + %173 = OpSLessThan %27 %503 %36 + OpLoopMerge %169 %170 None + OpBranchConditional %173 %168 %169 + %168 = OpLabel + OpBranch %175 + %175 = OpLabel + %505 = OpPhi %6 %9 %168 %375 %178 + %564 = OpPhi %6 %565 %168 %563 %178 + %181 = OpSLessThan %27 %505 %36 + OpLoopMerge %177 %178 None + OpBranchConditional %181 %176 %177 + %176 = OpLabel + OpBranch %183 + %183 = OpLabel + %507 = OpPhi %6 %9 %176 %373 %186 + %563 = OpPhi %6 %564 %176 %562 %186 + %189 = OpSLessThan %27 %507 %36 + OpLoopMerge %185 %186 None + OpBranchConditional %189 %184 %185 + %184 = OpLabel + OpBranch %191 + %191 = OpLabel + %509 = OpPhi %6 %9 %184 %371 %194 + %562 = OpPhi %6 %563 %184 %561 %194 + %197 = OpSLessThan %27 %509 %36 + OpLoopMerge %193 %194 None + OpBranchConditional %197 %192 %193 + %192 = OpLabel + OpBranch %199 + %199 = OpLabel + %511 = OpPhi %6 %9 %192 %369 %202 + %561 = OpPhi %6 %562 %192 %560 %202 + %205 = OpSLessThan %27 %511 %36 + OpLoopMerge %201 %202 None + OpBranchConditional %205 %200 %201 + %200 = OpLabel + OpBranch %207 + %207 = OpLabel + %513 = OpPhi %6 %9 %200 %367 %210 + %560 = OpPhi %6 %561 %200 %559 %210 + %213 = OpSLessThan %27 %513 %36 + OpLoopMerge %209 %210 None + OpBranchConditional %213 %208 %209 + %208 = OpLabel + OpBranch %215 + %215 = OpLabel + %515 = OpPhi %6 %9 %208 %365 %218 + %559 = OpPhi %6 %560 %208 %558 %218 + %221 = OpSLessThan %27 %515 %36 + OpLoopMerge %217 %218 None + OpBranchConditional %221 %216 %217 + %216 = OpLabel + OpBranch %223 + %223 = OpLabel + %517 = OpPhi %6 %9 %216 %363 %226 + %558 = OpPhi %6 %559 %216 %557 %226 + %229 = OpSLessThan %27 %517 %36 + OpLoopMerge %225 %226 None + OpBranchConditional %229 %224 %225 + %224 = OpLabel + OpBranch %231 + %231 = OpLabel + %519 = OpPhi %6 %9 %224 %361 %234 + %557 = OpPhi %6 %558 %224 %556 %234 + %237 = OpSLessThan %27 %519 %36 + OpLoopMerge %233 %234 None + OpBranchConditional %237 %232 %233 + %232 = OpLabel + OpBranch %239 + %239 = OpLabel + %521 = OpPhi %6 %9 %232 %359 %242 + %556 = OpPhi %6 %557 %232 %555 %242 + %245 = OpSLessThan %27 %521 %36 + OpLoopMerge %241 %242 None + OpBranchConditional %245 %240 %241 + %240 = OpLabel + OpBranch %247 + %247 = OpLabel + %523 = OpPhi %6 %9 %240 %357 %250 + %555 = OpPhi %6 %556 %240 %554 %250 + %253 = OpSLessThan %27 %523 %36 + OpLoopMerge %249 %250 None + OpBranchConditional %253 %248 %249 + %248 = OpLabel + OpBranch %255 + %255 = OpLabel + %525 = OpPhi %6 %9 %248 %355 %258 + %554 = OpPhi %6 %555 %248 %553 %258 + %261 = OpSLessThan %27 %525 %36 + OpLoopMerge %257 %258 None + OpBranchConditional %261 %256 %257 + %256 = OpLabel + OpBranch %263 + %263 = OpLabel + %527 = OpPhi %6 %9 %256 %353 %266 + %553 = OpPhi %6 %554 %256 %552 %266 + %269 = OpSLessThan %27 %527 %36 + OpLoopMerge %265 %266 None + OpBranchConditional %269 %264 %265 + %264 = OpLabel + OpBranch %271 + %271 = OpLabel + %529 = OpPhi %6 %9 %264 %351 %274 + %552 = OpPhi %6 %553 %264 %551 %274 + %277 = OpSLessThan %27 %529 %36 + OpLoopMerge %273 %274 None + OpBranchConditional %277 %272 %273 + %272 = OpLabel + OpBranch %279 + %279 = OpLabel + %531 = OpPhi %6 %9 %272 %349 %282 + %551 = OpPhi %6 %552 %272 %550 %282 + %285 = OpSLessThan %27 %531 %36 + OpLoopMerge %281 %282 None + OpBranchConditional %285 %280 %281 + %280 = OpLabel + OpBranch %287 + %287 = OpLabel + %533 = OpPhi %6 %9 %280 %347 %290 + %550 = OpPhi %6 %551 %280 %549 %290 + %293 = OpSLessThan %27 %533 %36 + OpLoopMerge %289 %290 None + OpBranchConditional %293 %288 %289 + %288 = OpLabel + OpBranch %295 + %295 = OpLabel + %535 = OpPhi %6 %9 %288 %345 %298 + %549 = OpPhi %6 %550 %288 %548 %298 + %301 = OpSLessThan %27 %535 %36 + OpLoopMerge %297 %298 None + OpBranchConditional %301 %296 %297 + %296 = OpLabel + OpBranch %303 + %303 = OpLabel + %537 = OpPhi %6 %9 %296 %343 %306 + %548 = OpPhi %6 %549 %296 %547 %306 + %309 = OpSLessThan %27 %537 %36 + OpLoopMerge %305 %306 None + OpBranchConditional %309 %304 %305 + %304 = OpLabel + OpBranch %311 + %311 = OpLabel + %539 = OpPhi %6 %9 %304 %341 %314 + %547 = OpPhi %6 %548 %304 %546 %314 + %317 = OpSLessThan %27 %539 %36 + OpLoopMerge %313 %314 None + OpBranchConditional %317 %312 %313 + %312 = OpLabel + OpBranch %319 + %319 = OpLabel + %541 = OpPhi %6 %9 %312 %339 %322 + %546 = OpPhi %6 %547 %312 %545 %322 + %325 = OpSLessThan %27 %541 %36 + OpLoopMerge %321 %322 None + OpBranchConditional %325 %320 %321 + %320 = OpLabel + OpBranch %327 + %327 = OpLabel + %545 = OpPhi %6 %546 %320 %335 %328 + %543 = OpPhi %6 %9 %320 %337 %328 + %333 = OpSLessThan %27 %543 %36 + OpLoopMerge %329 %328 None + OpBranchConditional %333 %328 %329 + %328 = OpLabel + %335 = OpIAdd %6 %545 %36 + %337 = OpIAdd %6 %543 %36 + OpBranch %327 + %329 = OpLabel + OpBranch %322 + %322 = OpLabel + %339 = OpIAdd %6 %541 %36 + OpBranch %319 + %321 = OpLabel + OpBranch %314 + %314 = OpLabel + %341 = OpIAdd %6 %539 %36 + OpBranch %311 + %313 = OpLabel + OpBranch %306 + %306 = OpLabel + %343 = OpIAdd %6 %537 %36 + OpBranch %303 + %305 = OpLabel + OpBranch %298 + %298 = OpLabel + %345 = OpIAdd %6 %535 %36 + OpBranch %295 + %297 = OpLabel + OpBranch %290 + %290 = OpLabel + %347 = OpIAdd %6 %533 %36 + OpBranch %287 + %289 = OpLabel + OpBranch %282 + %282 = OpLabel + %349 = OpIAdd %6 %531 %36 + OpBranch %279 + %281 = OpLabel + OpBranch %274 + %274 = OpLabel + %351 = OpIAdd %6 %529 %36 + OpBranch %271 + %273 = OpLabel + OpBranch %266 + %266 = OpLabel + %353 = OpIAdd %6 %527 %36 + OpBranch %263 + %265 = OpLabel + OpBranch %258 + %258 = OpLabel + %355 = OpIAdd %6 %525 %36 + OpBranch %255 + %257 = OpLabel + OpBranch %250 + %250 = OpLabel + %357 = OpIAdd %6 %523 %36 + OpBranch %247 + %249 = OpLabel + OpBranch %242 + %242 = OpLabel + %359 = OpIAdd %6 %521 %36 + OpBranch %239 + %241 = OpLabel + OpBranch %234 + %234 = OpLabel + %361 = OpIAdd %6 %519 %36 + OpBranch %231 + %233 = OpLabel + OpBranch %226 + %226 = OpLabel + %363 = OpIAdd %6 %517 %36 + OpBranch %223 + %225 = OpLabel + OpBranch %218 + %218 = OpLabel + %365 = OpIAdd %6 %515 %36 + OpBranch %215 + %217 = OpLabel + OpBranch %210 + %210 = OpLabel + %367 = OpIAdd %6 %513 %36 + OpBranch %207 + %209 = OpLabel + OpBranch %202 + %202 = OpLabel + %369 = OpIAdd %6 %511 %36 + OpBranch %199 + %201 = OpLabel + OpBranch %194 + %194 = OpLabel + %371 = OpIAdd %6 %509 %36 + OpBranch %191 + %193 = OpLabel + OpBranch %186 + %186 = OpLabel + %373 = OpIAdd %6 %507 %36 + OpBranch %183 + %185 = OpLabel + OpBranch %178 + %178 = OpLabel + %375 = OpIAdd %6 %505 %36 + OpBranch %175 + %177 = OpLabel + OpBranch %170 + %170 = OpLabel + %377 = OpIAdd %6 %503 %36 + OpBranch %167 + %169 = OpLabel + OpBranch %162 + %162 = OpLabel + %379 = OpIAdd %6 %501 %36 + OpBranch %159 + %161 = OpLabel + OpBranch %154 + %154 = OpLabel + %381 = OpIAdd %6 %499 %36 + OpBranch %151 + %153 = OpLabel + OpBranch %146 + %146 = OpLabel + %383 = OpIAdd %6 %497 %36 + OpBranch %143 + %145 = OpLabel + OpBranch %138 + %138 = OpLabel + %385 = OpIAdd %6 %495 %36 + OpBranch %135 + %137 = OpLabel + OpBranch %130 + %130 = OpLabel + %387 = OpIAdd %6 %493 %36 + OpBranch %127 + %129 = OpLabel + OpBranch %122 + %122 = OpLabel + %389 = OpIAdd %6 %491 %36 + OpBranch %119 + %121 = OpLabel + OpBranch %114 + %114 = OpLabel + %391 = OpIAdd %6 %489 %36 + OpBranch %111 + %113 = OpLabel + OpBranch %106 + %106 = OpLabel + %393 = OpIAdd %6 %487 %36 + OpBranch %103 + %105 = OpLabel + OpBranch %98 + %98 = OpLabel + %395 = OpIAdd %6 %485 %36 + OpBranch %95 + %97 = OpLabel + OpBranch %90 + %90 = OpLabel + %397 = OpIAdd %6 %483 %36 + OpBranch %87 + %89 = OpLabel + OpBranch %82 + %82 = OpLabel + %399 = OpIAdd %6 %481 %36 + OpBranch %79 + %81 = OpLabel + OpBranch %74 + %74 = OpLabel + %401 = OpIAdd %6 %479 %36 + OpBranch %71 + %73 = OpLabel + OpBranch %66 + %66 = OpLabel + %403 = OpIAdd %6 %477 %36 + OpBranch %63 + %65 = OpLabel + OpBranch %58 + %58 = OpLabel + %405 = OpIAdd %6 %475 %36 + OpBranch %55 + %57 = OpLabel + OpBranch %50 + %50 = OpLabel + %407 = OpIAdd %6 %473 %36 + OpBranch %47 + %49 = OpLabel + OpBranch %42 + %42 = OpLabel + %409 = OpIAdd %6 %471 %36 + OpBranch %39 + %41 = OpLabel + OpBranch %33 + %33 = OpLabel + %411 = OpIAdd %6 %468 %36 + OpBranch %30 + %32 = OpLabel + %414 = OpExtInst %6 %1 SClamp %470 %9 %413 + OpStore %419 %416 + %421 = OpAccessChain %420 %419 %414 + %422 = OpLoad %10 %421 + %423 = OpAccessChain %420 %15 %414 + OpStore %423 %422 + %425 = OpIAdd %6 %470 %36 + OpBranch %23 + %23 = OpLabel + OpBranch %20 + %22 = OpLabel + %434 = OpAccessChain %433 %431 %432 + %435 = OpLoad %10 %434 + %436 = OpConvertFToS %6 %435 + %437 = OpExtInst %6 %1 SClamp %436 %9 %413 + %438 = OpAccessChain %420 %15 %437 + %439 = OpLoad %10 %438 + %441 = OpAccessChain %433 %431 %440 + %442 = OpLoad %10 %441 + %443 = OpConvertFToS %6 %442 + %444 = OpExtInst %6 %1 SClamp %443 %9 %413 + %445 = OpAccessChain %420 %15 %444 + %446 = OpLoad %10 %445 + %450 = OpFOrdEqual %27 %439 %415 + OpSelectionMerge %452 None + OpBranchConditional %450 %451 %452 + %451 = OpLabel + %455 = OpFOrdEqual %27 %446 %415 + OpBranch %452 + %452 = OpLabel + %456 = OpPhi %27 %450 %22 %455 %451 + OpSelectionMerge %458 None + OpBranchConditional %456 %457 %463 + %457 = OpLabel + OpStore %460 %462 + OpBranch %458 + %463 = OpLabel + OpStore %460 %464 + OpBranch %458 + %458 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-float-bits-to-int-increment-array.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-float-bits-to-int-increment-array.amber new file mode 100644 index 0000000..0c1caeb --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-float-bits-to-int-increment-array.amber @@ -0,0 +1,449 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_5 _GLF_uniform_int_values[0] +# #define _int_3 _GLF_uniform_int_values[1] +# #define _int_4 _GLF_uniform_int_values[2] +# #define _int_6 _GLF_uniform_int_values[3] +# #define _int_7 _GLF_uniform_int_values[4] +# #define _int_8 _GLF_uniform_int_values[5] +# #define _int_1 _GLF_uniform_int_values[6] +# #define _int_0 _GLF_uniform_int_values[7] +# #define _int_2 _GLF_uniform_int_values[8] +# #define _int_9 _GLF_uniform_int_values[9] +# #define _int_1065353216 _GLF_uniform_int_values[10] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [5, 3, 4, 6, 7, 8, 1, 0, 2, 9, 1065353216] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[11]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // a becomes 1065353216. +# int a = floatBitsToInt(1.0); +# int arr[9] = int[9](_int_1, _int_2, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9); +# +# // During the loop only arr[8] changes to zero. +# for(int i = 0; i < 5; i ++) +# { +# for(int j = 0; j < 5; j ++) +# { +# // a is a large number making the clamp always return 8. +# int idx = clamp(a, 0, 8); +# // Sets the last array element to zero. +# arr[idx] = _int_0; +# +# for(int k = _int_0; k < i; k ++) +# { +# for(int l = 0; l < j; l ++) +# { +# // These cases get all hit at some point, but +# // they only affect the last element as idx is +# // always eight. Even that value gets overwritten +# // by zero (see the code above) and the last +# // iterations don't hit any of these cases making +# // the final value zero. +# switch(a - _int_1065353216) +# { +# case 6: +# arr[idx] += _int_1; +# break; +# case 7: +# arr[idx] += _int_2; +# break; +# case 8: +# arr[idx] += _int_3; +# break; +# case 9: +# arr[idx] += _int_4; +# break; +# case 10: +# arr[idx] += _int_5; +# break; +# } +# } +# } +# a++; +# } +# } +# +# int ref[9] = int[9](_int_1, _int_2, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_0); +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Verify results. +# for(int i = _int_0; i < _int_9; i ++) +# { +# if(arr[i] != ref[i]) +# { +# // Indicate a failure. +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 221 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %180 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %16 "arr" + OpName %19 "buf0" + OpMemberName %19 0 "_GLF_uniform_int_values" + OpName %21 "" + OpName %51 "i" + OpName %60 "j" + OpName %68 "idx" + OpName %76 "k" + OpName %87 "l" + OpName %158 "ref" + OpName %180 "_GLF_color" + OpName %194 "i" + OpDecorate %18 ArrayStride 16 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 0 + OpDecorate %180 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpConstant %9 1 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 9 + %14 = OpTypeArray %6 %13 + %15 = OpTypePointer Function %14 + %17 = OpConstant %12 11 + %18 = OpTypeArray %6 %17 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpConstant %6 0 + %23 = OpConstant %6 6 + %24 = OpTypePointer Uniform %6 + %27 = OpConstant %6 8 + %30 = OpConstant %6 1 + %33 = OpConstant %6 2 + %38 = OpConstant %6 3 + %41 = OpConstant %6 4 + %44 = OpConstant %6 5 + %47 = OpConstant %6 9 + %58 = OpTypeBool + %72 = OpConstant %6 7 + %97 = OpConstant %6 10 + %178 = OpTypeVector %9 4 + %179 = OpTypePointer Output %178 + %180 = OpVariable %179 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %16 = OpVariable %15 Function + %51 = OpVariable %7 Function + %60 = OpVariable %7 Function + %68 = OpVariable %7 Function + %76 = OpVariable %7 Function + %87 = OpVariable %7 Function + %158 = OpVariable %15 Function + %194 = OpVariable %7 Function + %11 = OpBitcast %6 %10 + OpStore %8 %11 + %25 = OpAccessChain %24 %21 %22 %23 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %24 %21 %22 %27 + %29 = OpLoad %6 %28 + %31 = OpAccessChain %24 %21 %22 %30 + %32 = OpLoad %6 %31 + %34 = OpAccessChain %24 %21 %22 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %24 %21 %22 %22 + %37 = OpLoad %6 %36 + %39 = OpAccessChain %24 %21 %22 %38 + %40 = OpLoad %6 %39 + %42 = OpAccessChain %24 %21 %22 %41 + %43 = OpLoad %6 %42 + %45 = OpAccessChain %24 %21 %22 %44 + %46 = OpLoad %6 %45 + %48 = OpAccessChain %24 %21 %22 %47 + %49 = OpLoad %6 %48 + %50 = OpCompositeConstruct %14 %26 %29 %32 %35 %37 %40 %43 %46 %49 + OpStore %16 %50 + OpStore %51 %22 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %6 %51 + %59 = OpSLessThan %58 %57 %44 + OpBranchConditional %59 %53 %54 + %53 = OpLabel + OpStore %60 %22 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %66 = OpLoad %6 %60 + %67 = OpSLessThan %58 %66 %44 + OpBranchConditional %67 %62 %63 + %62 = OpLabel + %69 = OpLoad %6 %8 + %70 = OpExtInst %6 %1 SClamp %69 %22 %27 + OpStore %68 %70 + %71 = OpLoad %6 %68 + %73 = OpAccessChain %24 %21 %22 %72 + %74 = OpLoad %6 %73 + %75 = OpAccessChain %7 %16 %71 + OpStore %75 %74 + %77 = OpAccessChain %24 %21 %22 %72 + %78 = OpLoad %6 %77 + OpStore %76 %78 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %6 %76 + %85 = OpLoad %6 %51 + %86 = OpSLessThan %58 %84 %85 + OpBranchConditional %86 %80 %81 + %80 = OpLabel + OpStore %87 %22 + OpBranch %88 + %88 = OpLabel + OpLoopMerge %90 %91 None + OpBranch %92 + %92 = OpLabel + %93 = OpLoad %6 %87 + %94 = OpLoad %6 %60 + %95 = OpSLessThan %58 %93 %94 + OpBranchConditional %95 %89 %90 + %89 = OpLabel + %96 = OpLoad %6 %8 + %98 = OpAccessChain %24 %21 %22 %97 + %99 = OpLoad %6 %98 + %100 = OpISub %6 %96 %99 + OpSelectionMerge %106 None + OpSwitch %100 %106 6 %101 7 %102 8 %103 9 %104 10 %105 + %101 = OpLabel + %107 = OpLoad %6 %68 + %108 = OpAccessChain %24 %21 %22 %23 + %109 = OpLoad %6 %108 + %110 = OpAccessChain %7 %16 %107 + %111 = OpLoad %6 %110 + %112 = OpIAdd %6 %111 %109 + %113 = OpAccessChain %7 %16 %107 + OpStore %113 %112 + OpBranch %106 + %102 = OpLabel + %115 = OpLoad %6 %68 + %116 = OpAccessChain %24 %21 %22 %27 + %117 = OpLoad %6 %116 + %118 = OpAccessChain %7 %16 %115 + %119 = OpLoad %6 %118 + %120 = OpIAdd %6 %119 %117 + %121 = OpAccessChain %7 %16 %115 + OpStore %121 %120 + OpBranch %106 + %103 = OpLabel + %123 = OpLoad %6 %68 + %124 = OpAccessChain %24 %21 %22 %30 + %125 = OpLoad %6 %124 + %126 = OpAccessChain %7 %16 %123 + %127 = OpLoad %6 %126 + %128 = OpIAdd %6 %127 %125 + %129 = OpAccessChain %7 %16 %123 + OpStore %129 %128 + OpBranch %106 + %104 = OpLabel + %131 = OpLoad %6 %68 + %132 = OpAccessChain %24 %21 %22 %33 + %133 = OpLoad %6 %132 + %134 = OpAccessChain %7 %16 %131 + %135 = OpLoad %6 %134 + %136 = OpIAdd %6 %135 %133 + %137 = OpAccessChain %7 %16 %131 + OpStore %137 %136 + OpBranch %106 + %105 = OpLabel + %139 = OpLoad %6 %68 + %140 = OpAccessChain %24 %21 %22 %22 + %141 = OpLoad %6 %140 + %142 = OpAccessChain %7 %16 %139 + %143 = OpLoad %6 %142 + %144 = OpIAdd %6 %143 %141 + %145 = OpAccessChain %7 %16 %139 + OpStore %145 %144 + OpBranch %106 + %106 = OpLabel + OpBranch %91 + %91 = OpLabel + %148 = OpLoad %6 %87 + %149 = OpIAdd %6 %148 %30 + OpStore %87 %149 + OpBranch %88 + %90 = OpLabel + OpBranch %82 + %82 = OpLabel + %150 = OpLoad %6 %76 + %151 = OpIAdd %6 %150 %30 + OpStore %76 %151 + OpBranch %79 + %81 = OpLabel + %152 = OpLoad %6 %8 + %153 = OpIAdd %6 %152 %30 + OpStore %8 %153 + OpBranch %64 + %64 = OpLabel + %154 = OpLoad %6 %60 + %155 = OpIAdd %6 %154 %30 + OpStore %60 %155 + OpBranch %61 + %63 = OpLabel + OpBranch %55 + %55 = OpLabel + %156 = OpLoad %6 %51 + %157 = OpIAdd %6 %156 %30 + OpStore %51 %157 + OpBranch %52 + %54 = OpLabel + %159 = OpAccessChain %24 %21 %22 %23 + %160 = OpLoad %6 %159 + %161 = OpAccessChain %24 %21 %22 %27 + %162 = OpLoad %6 %161 + %163 = OpAccessChain %24 %21 %22 %30 + %164 = OpLoad %6 %163 + %165 = OpAccessChain %24 %21 %22 %33 + %166 = OpLoad %6 %165 + %167 = OpAccessChain %24 %21 %22 %22 + %168 = OpLoad %6 %167 + %169 = OpAccessChain %24 %21 %22 %38 + %170 = OpLoad %6 %169 + %171 = OpAccessChain %24 %21 %22 %41 + %172 = OpLoad %6 %171 + %173 = OpAccessChain %24 %21 %22 %44 + %174 = OpLoad %6 %173 + %175 = OpAccessChain %24 %21 %22 %72 + %176 = OpLoad %6 %175 + %177 = OpCompositeConstruct %14 %160 %162 %164 %166 %168 %170 %172 %174 %176 + OpStore %158 %177 + %181 = OpAccessChain %24 %21 %22 %23 + %182 = OpLoad %6 %181 + %183 = OpConvertSToF %9 %182 + %184 = OpAccessChain %24 %21 %22 %72 + %185 = OpLoad %6 %184 + %186 = OpConvertSToF %9 %185 + %187 = OpAccessChain %24 %21 %22 %72 + %188 = OpLoad %6 %187 + %189 = OpConvertSToF %9 %188 + %190 = OpAccessChain %24 %21 %22 %23 + %191 = OpLoad %6 %190 + %192 = OpConvertSToF %9 %191 + %193 = OpCompositeConstruct %178 %183 %186 %189 %192 + OpStore %180 %193 + %195 = OpAccessChain %24 %21 %22 %72 + %196 = OpLoad %6 %195 + OpStore %194 %196 + OpBranch %197 + %197 = OpLabel + OpLoopMerge %199 %200 None + OpBranch %201 + %201 = OpLabel + %202 = OpLoad %6 %194 + %203 = OpAccessChain %24 %21 %22 %47 + %204 = OpLoad %6 %203 + %205 = OpSLessThan %58 %202 %204 + OpBranchConditional %205 %198 %199 + %198 = OpLabel + %206 = OpLoad %6 %194 + %207 = OpAccessChain %7 %16 %206 + %208 = OpLoad %6 %207 + %209 = OpLoad %6 %194 + %210 = OpAccessChain %7 %158 %209 + %211 = OpLoad %6 %210 + %212 = OpINotEqual %58 %208 %211 + OpSelectionMerge %214 None + OpBranchConditional %212 %213 %214 + %213 = OpLabel + %215 = OpAccessChain %24 %21 %22 %72 + %216 = OpLoad %6 %215 + %217 = OpConvertSToF %9 %216 + %218 = OpCompositeConstruct %178 %217 %217 %217 %217 + OpStore %180 %218 + OpBranch %214 + %214 = OpLabel + OpBranch %200 + %200 = OpLabel + %219 = OpLoad %6 %194 + %220 = OpIAdd %6 %219 %30 + OpStore %194 %220 + OpBranch %197 + %199 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 5 3 4 6 7 8 1 0 2 9 1065353216 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-fragcoord-conditions-empty-blocks.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-fragcoord-conditions-empty-blocks.amber new file mode 100644 index 0000000..dfa8abe --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-fragcoord-conditions-empty-blocks.amber @@ -0,0 +1,224 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: 0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[1]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# } +# else +# { +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# } +# else +# { +# // Always true. +# if(gl_FragCoord.x >= 0.0) +# { +# // Iterated once. +# do +# { +# _GLF_color = vec4(1, _int_0, _int_0, 1); +# } +# while(gl_FragCoord.y < 0.0); +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %24 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %24 "gl_FragCoord" + OpName %30 "buf1" + OpMemberName %30 0 "_GLF_uniform_float_values" + OpName %32 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %24 BuiltIn FragCoord + OpDecorate %29 ArrayStride 16 + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 1 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %23 = OpTypePointer Input %7 + %24 = OpVariable %23 Input + %25 = OpConstant %11 0 + %26 = OpTypePointer Input %6 + %29 = OpTypeArray %6 %12 + %30 = OpTypeStruct %29 + %31 = OpTypePointer Uniform %30 + %32 = OpVariable %31 Uniform + %33 = OpTypePointer Uniform %6 + %36 = OpTypeBool + %43 = OpConstant %6 0 + %57 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %22 = OpCompositeConstruct %7 %21 %21 %21 %21 + OpStore %9 %22 + %27 = OpAccessChain %26 %24 %25 + %28 = OpLoad %6 %27 + %34 = OpAccessChain %33 %32 %17 %17 + %35 = OpLoad %6 %34 + %37 = OpFOrdLessThan %36 %28 %35 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %40 + %38 = OpLabel + OpBranch %39 + %40 = OpLabel + %41 = OpAccessChain %26 %24 %12 + %42 = OpLoad %6 %41 + %44 = OpFOrdLessThan %36 %42 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %45 %47 + %45 = OpLabel + OpBranch %46 + %47 = OpLabel + %48 = OpAccessChain %26 %24 %25 + %49 = OpLoad %6 %48 + %50 = OpFOrdGreaterThanEqual %36 %49 %43 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %52 + %51 = OpLabel + OpBranch %53 + %53 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %54 + %54 = OpLabel + %58 = OpAccessChain %18 %16 %17 %17 + %59 = OpLoad %10 %58 + %60 = OpConvertSToF %6 %59 + %61 = OpAccessChain %18 %16 %17 %17 + %62 = OpLoad %10 %61 + %63 = OpConvertSToF %6 %62 + %64 = OpCompositeConstruct %7 %57 %60 %63 %57 + OpStore %9 %64 + OpBranch %56 + %56 = OpLabel + %65 = OpAccessChain %26 %24 %12 + %66 = OpLoad %6 %65 + %67 = OpFOrdLessThan %36 %66 %43 + OpBranchConditional %67 %53 %55 + %55 = OpLabel + OpBranch %52 + %52 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-fragcoord-never-return-descending-loop.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-fragcoord-never-return-descending-loop.amber new file mode 100644 index 0000000..4878954 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-fragcoord-never-return-descending-loop.amber @@ -0,0 +1,327 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-local-single-store' +# '--eliminate-local-single-store' +# '--eliminate-local-single-store' +# '--eliminate-local-multi-store' +# '--scalar-replacement=100' +# '--redundancy-elimination' +# '--eliminate-local-single-store' +# '--eliminate-dead-inserts' +# '--simplify-instructions' +# '--eliminate-local-multi-store' +# '--redundancy-elimination' +# '--vector-dce' +# '--eliminate-local-single-block' +# '--eliminate-dead-code-aggressive' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--scalar-replacement=100' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-inserts' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-return' +# '--if-conversion' +# '--vector-dce' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# // Iterates once. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# // Iterates nine times. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# // Always false. +# if(gl_FragCoord.y < _float_0_0) +# { +# return; +# } +# +# a = _int_1; +# } +# +# // Never iterated because the global loop bound has been reached. +# for(int i = 4; i >= 0 && _GLF_global_loop_count < _GLF_global_loop_bound; i--) +# { +# _GLF_global_loop_count++; +# a = _int_2; +# } +# } +# +# // Always true. +# if(a == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 123 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %45 %89 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %15 "buf1" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %45 "gl_FragCoord" + OpName %51 "buf0" + OpMemberName %51 0 "_GLF_uniform_float_values" + OpName %53 "" + OpName %89 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 1 + OpDecorate %45 BuiltIn FragCoord + OpDecorate %50 ArrayStride 16 + OpMemberDecorate %51 0 Offset 0 + OpDecorate %51 Block + OpDecorate %53 DescriptorSet 0 + OpDecorate %53 Binding 0 + OpDecorate %89 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 3 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypePointer Uniform %6 + %27 = OpConstant %6 10 + %28 = OpTypeBool + %31 = OpConstant %6 1 + %42 = OpTypeFloat 32 + %43 = OpTypeVector %42 4 + %44 = OpTypePointer Input %43 + %45 = OpVariable %44 Input + %46 = OpConstant %12 1 + %47 = OpTypePointer Input %42 + %50 = OpTypeArray %42 %46 + %51 = OpTypeStruct %50 + %52 = OpTypePointer Uniform %51 + %53 = OpVariable %52 Uniform + %54 = OpTypePointer Uniform %42 + %64 = OpConstant %6 4 + %77 = OpConstant %6 2 + %88 = OpTypePointer Output %43 + %89 = OpVariable %88 Output + %114 = OpConstant %12 0 + %115 = OpConstantFalse %28 + %116 = OpTypePointer Function %28 + %118 = OpConstantTrue %28 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %117 = OpVariable %116 Function %115 + OpSelectionMerge %112 None + OpSwitch %114 %113 + %113 = OpLabel + OpStore %8 %9 + %19 = OpAccessChain %18 %17 %9 %9 + %20 = OpLoad %6 %19 + OpBranch %21 + %21 = OpLabel + %108 = OpPhi %6 %20 %113 %110 %24 + %26 = OpLoad %6 %8 + %29 = OpSLessThan %28 %26 %27 + OpLoopMerge %23 %24 None + OpBranchConditional %29 %22 %23 + %22 = OpLabel + %30 = OpLoad %6 %8 + %32 = OpIAdd %6 %30 %31 + OpStore %8 %32 + OpBranch %33 + %33 = OpLabel + %111 = OpPhi %6 %108 %22 %62 %36 + %38 = OpLoad %6 %8 + %39 = OpSLessThan %28 %38 %27 + OpLoopMerge %35 %36 None + OpBranchConditional %39 %34 %35 + %34 = OpLabel + %40 = OpLoad %6 %8 + %41 = OpIAdd %6 %40 %31 + OpStore %8 %41 + %48 = OpAccessChain %47 %45 %46 + %49 = OpLoad %42 %48 + %55 = OpAccessChain %54 %53 %9 %9 + %56 = OpLoad %42 %55 + %57 = OpFOrdLessThan %28 %49 %56 + OpSelectionMerge %59 None + OpBranchConditional %57 %58 %59 + %58 = OpLabel + OpStore %117 %118 + OpBranch %35 + %59 = OpLabel + %61 = OpAccessChain %18 %17 %9 %31 + %62 = OpLoad %6 %61 + OpBranch %36 + %36 = OpLabel + OpBranch %33 + %35 = OpLabel + %120 = OpLoad %28 %117 + OpSelectionMerge %119 None + OpBranchConditional %120 %23 %119 + %119 = OpLabel + OpBranch %65 + %65 = OpLabel + %109 = OpPhi %6 %64 %119 %81 %66 + %110 = OpPhi %6 %111 %119 %79 %66 + %71 = OpSGreaterThanEqual %28 %109 %9 + %72 = OpLoad %6 %8 + %73 = OpSLessThan %28 %72 %27 + %74 = OpLogicalAnd %28 %71 %73 + OpLoopMerge %67 %66 None + OpBranchConditional %74 %66 %67 + %66 = OpLabel + %75 = OpLoad %6 %8 + %76 = OpIAdd %6 %75 %31 + OpStore %8 %76 + %78 = OpAccessChain %18 %17 %9 %77 + %79 = OpLoad %6 %78 + %81 = OpISub %6 %109 %31 + OpBranch %65 + %67 = OpLabel + OpBranch %24 + %24 = OpLabel + OpBranch %21 + %23 = OpLabel + %122 = OpLoad %28 %117 + OpSelectionMerge %121 None + OpBranchConditional %122 %112 %121 + %121 = OpLabel + %83 = OpAccessChain %18 %17 %9 %31 + %84 = OpLoad %6 %83 + %85 = OpIEqual %28 %108 %84 + OpSelectionMerge %87 None + OpBranchConditional %85 %86 %103 + %86 = OpLabel + %92 = OpConvertSToF %42 %84 + %95 = OpConvertSToF %42 %20 + %102 = OpCompositeConstruct %43 %92 %95 %95 %92 + OpStore %89 %102 + OpBranch %87 + %103 = OpLabel + %106 = OpConvertSToF %42 %20 + %107 = OpCompositeConstruct %43 %106 %106 %106 %106 + OpStore %89 %107 + OpBranch %87 + %87 = OpLabel + OpStore %117 %118 + OpBranch %112 + %112 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-global-counter-func-set-struct-field.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-counter-func-set-struct-field.amber new file mode 100644 index 0000000..1917251 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-counter-func-set-struct-field.amber @@ -0,0 +1,358 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of zero: 0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# struct S +# { +# int data0; +# int data1; +# }; +# +# S arr[10] = S[10](S(1, 1), S(1, 1), S(1, 1), S(1, 1), S(1, 1), S(1, 1), S(1, 1), S(1, 1), S(1, 1), S(1, 1)); +# +# void func(inout S s) +# { +# s.data0 = _int_0; +# } +# +# void main() +# { +# // Iterated once. +# for(int i = _int_1; _GLF_global_loop_count < _GLF_global_loop_bound; i++) +# { +# _GLF_global_loop_count++; +# +# // Iterates until the global loop bound is reached. +# for(int j = zero; j != _int_1 && _GLF_global_loop_count < _GLF_global_loop_bound; ) +# { +# _GLF_global_loop_count++; +# } +# +# // Always true. +# if(arr[i].data0 >= _int_1) +# { +# // Always false. +# if(arr[i].data1 == 2) +# { +# func(arr[i]); +# return; +# } +# else +# { +# func(arr[i]); +# } +# } +# } +# +# // Always true. +# if(arr[_int_1].data0 == _int_0 && arr[_int_2].data0 == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 143 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %124 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "S" + OpMemberName %7 0 "data0" + OpMemberName %7 1 "data1" + OpName %11 "func(struct-S-i1-i11;" + OpName %10 "s" + OpName %14 "_GLF_global_loop_count" + OpName %20 "arr" + OpName %26 "buf0" + OpMemberName %26 0 "_GLF_uniform_int_values" + OpName %28 "" + OpName %34 "i" + OpName %48 "j" + OpName %49 "buf1" + OpMemberName %49 0 "zero" + OpName %51 "" + OpName %84 "param" + OpName %94 "param" + OpName %124 "_GLF_color" + OpDecorate %25 ArrayStride 16 + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 0 + OpMemberDecorate %49 0 Offset 0 + OpDecorate %49 Block + OpDecorate %51 DescriptorSet 0 + OpDecorate %51 Binding 1 + OpDecorate %124 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %2 %8 + %13 = OpTypePointer Private %6 + %14 = OpVariable %13 Private + %15 = OpConstant %6 0 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 10 + %18 = OpTypeArray %7 %17 + %19 = OpTypePointer Private %18 + %20 = OpVariable %19 Private + %21 = OpConstant %6 1 + %22 = OpConstantComposite %7 %21 %21 + %23 = OpConstantComposite %18 %22 %22 %22 %22 %22 %22 %22 %22 %22 %22 + %24 = OpConstant %16 3 + %25 = OpTypeArray %6 %24 + %26 = OpTypeStruct %25 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpTypePointer Uniform %6 + %32 = OpTypePointer Function %6 + %43 = OpConstant %6 10 + %44 = OpTypeBool + %49 = OpTypeStruct %6 + %50 = OpTypePointer Uniform %49 + %51 = OpVariable %50 Uniform + %79 = OpConstant %6 2 + %85 = OpTypePointer Private %7 + %121 = OpTypeFloat 32 + %122 = OpTypeVector %121 4 + %123 = OpTypePointer Output %122 + %124 = OpVariable %123 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %34 = OpVariable %32 Function + %48 = OpVariable %32 Function + %84 = OpVariable %8 Function + %94 = OpVariable %8 Function + OpStore %14 %15 + OpStore %20 %23 + %35 = OpAccessChain %29 %28 %15 %21 + %36 = OpLoad %6 %35 + OpStore %34 %36 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %6 %14 + %45 = OpSLessThan %44 %42 %43 + OpBranchConditional %45 %38 %39 + %38 = OpLabel + %46 = OpLoad %6 %14 + %47 = OpIAdd %6 %46 %21 + OpStore %14 %47 + %52 = OpAccessChain %29 %51 %15 + %53 = OpLoad %6 %52 + OpStore %48 %53 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %6 %48 + %60 = OpAccessChain %29 %28 %15 %21 + %61 = OpLoad %6 %60 + %62 = OpINotEqual %44 %59 %61 + %63 = OpLoad %6 %14 + %64 = OpSLessThan %44 %63 %43 + %65 = OpLogicalAnd %44 %62 %64 + OpBranchConditional %65 %55 %56 + %55 = OpLabel + %66 = OpLoad %6 %14 + %67 = OpIAdd %6 %66 %21 + OpStore %14 %67 + OpBranch %57 + %57 = OpLabel + OpBranch %54 + %56 = OpLabel + %68 = OpLoad %6 %34 + %69 = OpAccessChain %13 %20 %68 %15 + %70 = OpLoad %6 %69 + %71 = OpAccessChain %29 %28 %15 %21 + %72 = OpLoad %6 %71 + %73 = OpSGreaterThanEqual %44 %70 %72 + OpSelectionMerge %75 None + OpBranchConditional %73 %74 %75 + %74 = OpLabel + %76 = OpLoad %6 %34 + %77 = OpAccessChain %13 %20 %76 %21 + %78 = OpLoad %6 %77 + %80 = OpIEqual %44 %78 %79 + OpSelectionMerge %82 None + OpBranchConditional %80 %81 %92 + %81 = OpLabel + %83 = OpLoad %6 %34 + %86 = OpAccessChain %85 %20 %83 + %87 = OpLoad %7 %86 + OpStore %84 %87 + %88 = OpFunctionCall %2 %11 %84 + %89 = OpLoad %7 %84 + %90 = OpAccessChain %85 %20 %83 + OpStore %90 %89 + OpReturn + %92 = OpLabel + %93 = OpLoad %6 %34 + %95 = OpAccessChain %85 %20 %93 + %96 = OpLoad %7 %95 + OpStore %94 %96 + %97 = OpFunctionCall %2 %11 %94 + %98 = OpLoad %7 %94 + %99 = OpAccessChain %85 %20 %93 + OpStore %99 %98 + OpBranch %82 + %82 = OpLabel + OpBranch %75 + %75 = OpLabel + OpBranch %40 + %40 = OpLabel + %100 = OpLoad %6 %34 + %101 = OpIAdd %6 %100 %21 + OpStore %34 %101 + OpBranch %37 + %39 = OpLabel + %102 = OpAccessChain %29 %28 %15 %21 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %13 %20 %103 %15 + %105 = OpLoad %6 %104 + %106 = OpAccessChain %29 %28 %15 %15 + %107 = OpLoad %6 %106 + %108 = OpIEqual %44 %105 %107 + OpSelectionMerge %110 None + OpBranchConditional %108 %109 %110 + %109 = OpLabel + %111 = OpAccessChain %29 %28 %15 %79 + %112 = OpLoad %6 %111 + %113 = OpAccessChain %13 %20 %112 %15 + %114 = OpLoad %6 %113 + %115 = OpAccessChain %29 %28 %15 %21 + %116 = OpLoad %6 %115 + %117 = OpIEqual %44 %114 %116 + OpBranch %110 + %110 = OpLabel + %118 = OpPhi %44 %108 %39 %117 %109 + OpSelectionMerge %120 None + OpBranchConditional %118 %119 %138 + %119 = OpLabel + %125 = OpAccessChain %29 %28 %15 %21 + %126 = OpLoad %6 %125 + %127 = OpConvertSToF %121 %126 + %128 = OpAccessChain %29 %28 %15 %15 + %129 = OpLoad %6 %128 + %130 = OpConvertSToF %121 %129 + %131 = OpAccessChain %29 %28 %15 %15 + %132 = OpLoad %6 %131 + %133 = OpConvertSToF %121 %132 + %134 = OpAccessChain %29 %28 %15 %21 + %135 = OpLoad %6 %134 + %136 = OpConvertSToF %121 %135 + %137 = OpCompositeConstruct %122 %127 %130 %133 %136 + OpStore %124 %137 + OpBranch %120 + %138 = OpLabel + %139 = OpAccessChain %29 %28 %15 %15 + %140 = OpLoad %6 %139 + %141 = OpConvertSToF %121 %140 + %142 = OpCompositeConstruct %122 %141 %141 %141 %141 + OpStore %124 %142 + OpBranch %120 + %120 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %9 + %10 = OpFunctionParameter %8 + %12 = OpLabel + %30 = OpAccessChain %29 %28 %15 %15 + %31 = OpLoad %6 %30 + %33 = OpAccessChain %32 %10 %15 + OpStore %33 %31 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 STD140 DATA + 0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-global-counter-increment-single-element.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-counter-increment-single-element.amber new file mode 100644 index 0000000..26d40a6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-counter-increment-single-element.amber @@ -0,0 +1,331 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_3_0 _GLF_uniform_float_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2, 3] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 3.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float arr[9] = float[9](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0); +# +# // This loop increases arr[2] by two. Other elements are left untouched. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# // This gets executed twice. +# arr[_int_2] += _float_1_0; +# +# int a = _int_1; +# // Loops four times without the global loop counter restriction. +# while(_int_2 > 0 && _GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# if(a > _int_3) +# { +# break; +# } +# +# a++; +# } +# } +# } +# +# // Always true. +# if(arr[_int_2] == _float_3_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 135 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %116 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %15 "arr" + OpName %18 "buf1" + OpMemberName %18 0 "_GLF_uniform_float_values" + OpName %20 "" + OpName %64 "buf0" + OpMemberName %64 0 "_GLF_uniform_int_values" + OpName %66 "" + OpName %79 "a" + OpName %116 "_GLF_color" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %63 ArrayStride 16 + OpMemberDecorate %64 0 Offset 0 + OpDecorate %64 Block + OpDecorate %66 DescriptorSet 0 + OpDecorate %66 Binding 0 + OpDecorate %116 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 9 + %13 = OpTypeArray %10 %12 + %14 = OpTypePointer Function %13 + %16 = OpConstant %11 3 + %17 = OpTypeArray %10 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypePointer Uniform %10 + %47 = OpConstant %6 10 + %48 = OpTypeBool + %51 = OpConstant %6 1 + %62 = OpConstant %11 4 + %63 = OpTypeArray %6 %62 + %64 = OpTypeStruct %63 + %65 = OpTypePointer Uniform %64 + %66 = OpVariable %65 Uniform + %67 = OpConstant %6 2 + %68 = OpTypePointer Uniform %6 + %73 = OpTypePointer Function %10 + %78 = OpTypePointer Function %6 + %96 = OpConstant %6 3 + %114 = OpTypeVector %10 4 + %115 = OpTypePointer Output %114 + %116 = OpVariable %115 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %15 = OpVariable %14 Function + %79 = OpVariable %78 Function + OpStore %8 %9 + %22 = OpAccessChain %21 %20 %9 %9 + %23 = OpLoad %10 %22 + %24 = OpAccessChain %21 %20 %9 %9 + %25 = OpLoad %10 %24 + %26 = OpAccessChain %21 %20 %9 %9 + %27 = OpLoad %10 %26 + %28 = OpAccessChain %21 %20 %9 %9 + %29 = OpLoad %10 %28 + %30 = OpAccessChain %21 %20 %9 %9 + %31 = OpLoad %10 %30 + %32 = OpAccessChain %21 %20 %9 %9 + %33 = OpLoad %10 %32 + %34 = OpAccessChain %21 %20 %9 %9 + %35 = OpLoad %10 %34 + %36 = OpAccessChain %21 %20 %9 %9 + %37 = OpLoad %10 %36 + %38 = OpAccessChain %21 %20 %9 %9 + %39 = OpLoad %10 %38 + %40 = OpCompositeConstruct %13 %23 %25 %27 %29 %31 %33 %35 %37 %39 + OpStore %15 %40 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %6 %8 + %49 = OpSLessThan %48 %46 %47 + OpBranchConditional %49 %42 %43 + %42 = OpLabel + %50 = OpLoad %6 %8 + %52 = OpIAdd %6 %50 %51 + OpStore %8 %52 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %6 %8 + %59 = OpSLessThan %48 %58 %47 + OpBranchConditional %59 %54 %55 + %54 = OpLabel + %60 = OpLoad %6 %8 + %61 = OpIAdd %6 %60 %51 + OpStore %8 %61 + %69 = OpAccessChain %68 %66 %9 %67 + %70 = OpLoad %6 %69 + %71 = OpAccessChain %21 %20 %9 %9 + %72 = OpLoad %10 %71 + %74 = OpAccessChain %73 %15 %70 + %75 = OpLoad %10 %74 + %76 = OpFAdd %10 %75 %72 + %77 = OpAccessChain %73 %15 %70 + OpStore %77 %76 + %80 = OpAccessChain %68 %66 %9 %9 + %81 = OpLoad %6 %80 + OpStore %79 %81 + OpBranch %82 + %82 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + %87 = OpAccessChain %68 %66 %9 %67 + %88 = OpLoad %6 %87 + %89 = OpSGreaterThan %48 %88 %9 + %90 = OpLoad %6 %8 + %91 = OpSLessThan %48 %90 %47 + %92 = OpLogicalAnd %48 %89 %91 + OpBranchConditional %92 %83 %84 + %83 = OpLabel + %93 = OpLoad %6 %8 + %94 = OpIAdd %6 %93 %51 + OpStore %8 %94 + %95 = OpLoad %6 %79 + %97 = OpAccessChain %68 %66 %9 %96 + %98 = OpLoad %6 %97 + %99 = OpSGreaterThan %48 %95 %98 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + OpBranch %84 + %101 = OpLabel + %103 = OpLoad %6 %79 + %104 = OpIAdd %6 %103 %51 + OpStore %79 %104 + OpBranch %85 + %85 = OpLabel + OpBranch %82 + %84 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %53 + %55 = OpLabel + OpBranch %44 + %44 = OpLabel + OpBranch %41 + %43 = OpLabel + %105 = OpAccessChain %68 %66 %9 %67 + %106 = OpLoad %6 %105 + %107 = OpAccessChain %73 %15 %106 + %108 = OpLoad %10 %107 + %109 = OpAccessChain %21 %20 %9 %67 + %110 = OpLoad %10 %109 + %111 = OpFOrdEqual %48 %108 %110 + OpSelectionMerge %113 None + OpBranchConditional %111 %112 %130 + %112 = OpLabel + %117 = OpAccessChain %68 %66 %9 %9 + %118 = OpLoad %6 %117 + %119 = OpConvertSToF %10 %118 + %120 = OpAccessChain %68 %66 %9 %51 + %121 = OpLoad %6 %120 + %122 = OpConvertSToF %10 %121 + %123 = OpAccessChain %68 %66 %9 %51 + %124 = OpLoad %6 %123 + %125 = OpConvertSToF %10 %124 + %126 = OpAccessChain %68 %66 %9 %9 + %127 = OpLoad %6 %126 + %128 = OpConvertSToF %10 %127 + %129 = OpCompositeConstruct %114 %119 %122 %125 %128 + OpStore %116 %129 + OpBranch %113 + %130 = OpLabel + %131 = OpAccessChain %68 %66 %9 %51 + %132 = OpLoad %6 %131 + %133 = OpConvertSToF %10 %132 + %134 = OpCompositeConstruct %114 %133 %133 %133 %133 + OpStore %116 %134 + OpBranch %113 + %113 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 3.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float.amber new file mode 100644 index 0000000..d727963 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float.amber @@ -0,0 +1,665 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_10 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_28_0 _GLF_uniform_float_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 28.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2, 10] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# const int _GLF_global_loop_bound = 100; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = _float_0_0; +# +# // On the first iteration, _GLF_global_loop_count is incremented 90 times, and on each of the +# // subsequent 3 iterations it is incremented once, so its value on leaving the loop is 93. The +# // value of f on leaving the loop is 4.0. +# for(int i = _int_0; i < _int_1; i++) +# { +# for(int i = _int_0; i < _int_1; i++) +# { +# for(int i = _int_0; i < _int_1; i++) +# { +# for(int i = _int_0; i < _int_1; i++) +# { +# for(int i = _int_0; i < _int_1; i++) +# { +# for(int i = _int_0; i < _int_1; i++) +# { +# for(int i = _int_0; i < _int_1; i++) +# { +# for(int i = _int_0; i < _int_1; i++) +# { +# for(int i = _int_0; i < _int_1; i++) +# { +# for(int i = _int_0; i < _int_1; i++) +# { +# for(int i = _int_0; i < _int_1; i++) +# { +# for(int i = _int_0; i < _int_2; i++) +# { +# for(int i = _int_0; i < _int_1; i++) +# { +# for(int i = _int_0; i < _int_1; i++) +# { +# for(int i = _int_0; i < _int_2; i++) +# { +# do +# { +# _GLF_global_loop_count++; +# } +# while(_GLF_global_loop_count < _GLF_global_loop_bound - _int_10); +# +# f += _float_1_0; +# } +# } +# } +# } +# } +# } +# } +# } +# } +# } +# } +# } +# } +# } +# } +# +# float sum = _float_0_0; +# +# // This loop iterates 7 times, and f is 4.0, so the sum ends up being 4.0 * 7 == 28.0. +# for(int r = _int_0; _GLF_global_loop_count < _GLF_global_loop_bound; r++) +# { +# _GLF_global_loop_count++; +# sum += f; +# } +# +# // Always true. +# if(sum == _float_28_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 306 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %287 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %12 "f" + OpName %16 "buf0" + OpMemberName %16 0 "_GLF_uniform_float_values" + OpName %18 "" + OpName %24 "i" + OpName %27 "buf1" + OpMemberName %27 0 "_GLF_uniform_int_values" + OpName %29 "" + OpName %43 "i" + OpName %55 "i" + OpName %67 "i" + OpName %79 "i" + OpName %91 "i" + OpName %103 "i" + OpName %115 "i" + OpName %127 "i" + OpName %139 "i" + OpName %151 "i" + OpName %163 "i" + OpName %176 "i" + OpName %188 "i" + OpName %200 "i" + OpName %259 "sum" + OpName %262 "r" + OpName %287 "_GLF_color" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %26 ArrayStride 16 + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 Block + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 1 + OpDecorate %287 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypePointer Function %10 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 3 + %15 = OpTypeArray %10 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpConstant %6 1 + %20 = OpTypePointer Uniform %10 + %23 = OpTypePointer Function %6 + %25 = OpConstant %13 4 + %26 = OpTypeArray %6 %25 + %27 = OpTypeStruct %26 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %30 = OpTypePointer Uniform %6 + %41 = OpTypeBool + %172 = OpConstant %6 2 + %219 = OpConstant %6 100 + %220 = OpConstant %6 3 + %285 = OpTypeVector %10 4 + %286 = OpTypePointer Output %285 + %287 = OpVariable %286 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpVariable %11 Function + %24 = OpVariable %23 Function + %43 = OpVariable %23 Function + %55 = OpVariable %23 Function + %67 = OpVariable %23 Function + %79 = OpVariable %23 Function + %91 = OpVariable %23 Function + %103 = OpVariable %23 Function + %115 = OpVariable %23 Function + %127 = OpVariable %23 Function + %139 = OpVariable %23 Function + %151 = OpVariable %23 Function + %163 = OpVariable %23 Function + %176 = OpVariable %23 Function + %188 = OpVariable %23 Function + %200 = OpVariable %23 Function + %259 = OpVariable %11 Function + %262 = OpVariable %23 Function + OpStore %8 %9 + %21 = OpAccessChain %20 %18 %9 %19 + %22 = OpLoad %10 %21 + OpStore %12 %22 + %31 = OpAccessChain %30 %29 %9 %19 + %32 = OpLoad %6 %31 + OpStore %24 %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %6 %24 + %39 = OpAccessChain %30 %29 %9 %9 + %40 = OpLoad %6 %39 + %42 = OpSLessThan %41 %38 %40 + OpBranchConditional %42 %34 %35 + %34 = OpLabel + %44 = OpAccessChain %30 %29 %9 %19 + %45 = OpLoad %6 %44 + OpStore %43 %45 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %6 %43 + %52 = OpAccessChain %30 %29 %9 %9 + %53 = OpLoad %6 %52 + %54 = OpSLessThan %41 %51 %53 + OpBranchConditional %54 %47 %48 + %47 = OpLabel + %56 = OpAccessChain %30 %29 %9 %19 + %57 = OpLoad %6 %56 + OpStore %55 %57 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %6 %55 + %64 = OpAccessChain %30 %29 %9 %9 + %65 = OpLoad %6 %64 + %66 = OpSLessThan %41 %63 %65 + OpBranchConditional %66 %59 %60 + %59 = OpLabel + %68 = OpAccessChain %30 %29 %9 %19 + %69 = OpLoad %6 %68 + OpStore %67 %69 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %6 %67 + %76 = OpAccessChain %30 %29 %9 %9 + %77 = OpLoad %6 %76 + %78 = OpSLessThan %41 %75 %77 + OpBranchConditional %78 %71 %72 + %71 = OpLabel + %80 = OpAccessChain %30 %29 %9 %19 + %81 = OpLoad %6 %80 + OpStore %79 %81 + OpBranch %82 + %82 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + %87 = OpLoad %6 %79 + %88 = OpAccessChain %30 %29 %9 %9 + %89 = OpLoad %6 %88 + %90 = OpSLessThan %41 %87 %89 + OpBranchConditional %90 %83 %84 + %83 = OpLabel + %92 = OpAccessChain %30 %29 %9 %19 + %93 = OpLoad %6 %92 + OpStore %91 %93 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %96 %97 None + OpBranch %98 + %98 = OpLabel + %99 = OpLoad %6 %91 + %100 = OpAccessChain %30 %29 %9 %9 + %101 = OpLoad %6 %100 + %102 = OpSLessThan %41 %99 %101 + OpBranchConditional %102 %95 %96 + %95 = OpLabel + %104 = OpAccessChain %30 %29 %9 %19 + %105 = OpLoad %6 %104 + OpStore %103 %105 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %108 %109 None + OpBranch %110 + %110 = OpLabel + %111 = OpLoad %6 %103 + %112 = OpAccessChain %30 %29 %9 %9 + %113 = OpLoad %6 %112 + %114 = OpSLessThan %41 %111 %113 + OpBranchConditional %114 %107 %108 + %107 = OpLabel + %116 = OpAccessChain %30 %29 %9 %19 + %117 = OpLoad %6 %116 + OpStore %115 %117 + OpBranch %118 + %118 = OpLabel + OpLoopMerge %120 %121 None + OpBranch %122 + %122 = OpLabel + %123 = OpLoad %6 %115 + %124 = OpAccessChain %30 %29 %9 %9 + %125 = OpLoad %6 %124 + %126 = OpSLessThan %41 %123 %125 + OpBranchConditional %126 %119 %120 + %119 = OpLabel + %128 = OpAccessChain %30 %29 %9 %19 + %129 = OpLoad %6 %128 + OpStore %127 %129 + OpBranch %130 + %130 = OpLabel + OpLoopMerge %132 %133 None + OpBranch %134 + %134 = OpLabel + %135 = OpLoad %6 %127 + %136 = OpAccessChain %30 %29 %9 %9 + %137 = OpLoad %6 %136 + %138 = OpSLessThan %41 %135 %137 + OpBranchConditional %138 %131 %132 + %131 = OpLabel + %140 = OpAccessChain %30 %29 %9 %19 + %141 = OpLoad %6 %140 + OpStore %139 %141 + OpBranch %142 + %142 = OpLabel + OpLoopMerge %144 %145 None + OpBranch %146 + %146 = OpLabel + %147 = OpLoad %6 %139 + %148 = OpAccessChain %30 %29 %9 %9 + %149 = OpLoad %6 %148 + %150 = OpSLessThan %41 %147 %149 + OpBranchConditional %150 %143 %144 + %143 = OpLabel + %152 = OpAccessChain %30 %29 %9 %19 + %153 = OpLoad %6 %152 + OpStore %151 %153 + OpBranch %154 + %154 = OpLabel + OpLoopMerge %156 %157 None + OpBranch %158 + %158 = OpLabel + %159 = OpLoad %6 %151 + %160 = OpAccessChain %30 %29 %9 %9 + %161 = OpLoad %6 %160 + %162 = OpSLessThan %41 %159 %161 + OpBranchConditional %162 %155 %156 + %155 = OpLabel + %164 = OpAccessChain %30 %29 %9 %19 + %165 = OpLoad %6 %164 + OpStore %163 %165 + OpBranch %166 + %166 = OpLabel + OpLoopMerge %168 %169 None + OpBranch %170 + %170 = OpLabel + %171 = OpLoad %6 %163 + %173 = OpAccessChain %30 %29 %9 %172 + %174 = OpLoad %6 %173 + %175 = OpSLessThan %41 %171 %174 + OpBranchConditional %175 %167 %168 + %167 = OpLabel + %177 = OpAccessChain %30 %29 %9 %19 + %178 = OpLoad %6 %177 + OpStore %176 %178 + OpBranch %179 + %179 = OpLabel + OpLoopMerge %181 %182 None + OpBranch %183 + %183 = OpLabel + %184 = OpLoad %6 %176 + %185 = OpAccessChain %30 %29 %9 %9 + %186 = OpLoad %6 %185 + %187 = OpSLessThan %41 %184 %186 + OpBranchConditional %187 %180 %181 + %180 = OpLabel + %189 = OpAccessChain %30 %29 %9 %19 + %190 = OpLoad %6 %189 + OpStore %188 %190 + OpBranch %191 + %191 = OpLabel + OpLoopMerge %193 %194 None + OpBranch %195 + %195 = OpLabel + %196 = OpLoad %6 %188 + %197 = OpAccessChain %30 %29 %9 %9 + %198 = OpLoad %6 %197 + %199 = OpSLessThan %41 %196 %198 + OpBranchConditional %199 %192 %193 + %192 = OpLabel + %201 = OpAccessChain %30 %29 %9 %19 + %202 = OpLoad %6 %201 + OpStore %200 %202 + OpBranch %203 + %203 = OpLabel + OpLoopMerge %205 %206 None + OpBranch %207 + %207 = OpLabel + %208 = OpLoad %6 %200 + %209 = OpAccessChain %30 %29 %9 %172 + %210 = OpLoad %6 %209 + %211 = OpSLessThan %41 %208 %210 + OpBranchConditional %211 %204 %205 + %204 = OpLabel + OpBranch %212 + %212 = OpLabel + OpLoopMerge %214 %215 None + OpBranch %213 + %213 = OpLabel + %216 = OpLoad %6 %8 + %217 = OpIAdd %6 %216 %19 + OpStore %8 %217 + OpBranch %215 + %215 = OpLabel + %218 = OpLoad %6 %8 + %221 = OpAccessChain %30 %29 %9 %220 + %222 = OpLoad %6 %221 + %223 = OpISub %6 %219 %222 + %224 = OpSLessThan %41 %218 %223 + OpBranchConditional %224 %212 %214 + %214 = OpLabel + %225 = OpAccessChain %20 %18 %9 %9 + %226 = OpLoad %10 %225 + %227 = OpLoad %10 %12 + %228 = OpFAdd %10 %227 %226 + OpStore %12 %228 + OpBranch %206 + %206 = OpLabel + %229 = OpLoad %6 %200 + %230 = OpIAdd %6 %229 %19 + OpStore %200 %230 + OpBranch %203 + %205 = OpLabel + OpBranch %194 + %194 = OpLabel + %231 = OpLoad %6 %188 + %232 = OpIAdd %6 %231 %19 + OpStore %188 %232 + OpBranch %191 + %193 = OpLabel + OpBranch %182 + %182 = OpLabel + %233 = OpLoad %6 %176 + %234 = OpIAdd %6 %233 %19 + OpStore %176 %234 + OpBranch %179 + %181 = OpLabel + OpBranch %169 + %169 = OpLabel + %235 = OpLoad %6 %163 + %236 = OpIAdd %6 %235 %19 + OpStore %163 %236 + OpBranch %166 + %168 = OpLabel + OpBranch %157 + %157 = OpLabel + %237 = OpLoad %6 %151 + %238 = OpIAdd %6 %237 %19 + OpStore %151 %238 + OpBranch %154 + %156 = OpLabel + OpBranch %145 + %145 = OpLabel + %239 = OpLoad %6 %139 + %240 = OpIAdd %6 %239 %19 + OpStore %139 %240 + OpBranch %142 + %144 = OpLabel + OpBranch %133 + %133 = OpLabel + %241 = OpLoad %6 %127 + %242 = OpIAdd %6 %241 %19 + OpStore %127 %242 + OpBranch %130 + %132 = OpLabel + OpBranch %121 + %121 = OpLabel + %243 = OpLoad %6 %115 + %244 = OpIAdd %6 %243 %19 + OpStore %115 %244 + OpBranch %118 + %120 = OpLabel + OpBranch %109 + %109 = OpLabel + %245 = OpLoad %6 %103 + %246 = OpIAdd %6 %245 %19 + OpStore %103 %246 + OpBranch %106 + %108 = OpLabel + OpBranch %97 + %97 = OpLabel + %247 = OpLoad %6 %91 + %248 = OpIAdd %6 %247 %19 + OpStore %91 %248 + OpBranch %94 + %96 = OpLabel + OpBranch %85 + %85 = OpLabel + %249 = OpLoad %6 %79 + %250 = OpIAdd %6 %249 %19 + OpStore %79 %250 + OpBranch %82 + %84 = OpLabel + OpBranch %73 + %73 = OpLabel + %251 = OpLoad %6 %67 + %252 = OpIAdd %6 %251 %19 + OpStore %67 %252 + OpBranch %70 + %72 = OpLabel + OpBranch %61 + %61 = OpLabel + %253 = OpLoad %6 %55 + %254 = OpIAdd %6 %253 %19 + OpStore %55 %254 + OpBranch %58 + %60 = OpLabel + OpBranch %49 + %49 = OpLabel + %255 = OpLoad %6 %43 + %256 = OpIAdd %6 %255 %19 + OpStore %43 %256 + OpBranch %46 + %48 = OpLabel + OpBranch %36 + %36 = OpLabel + %257 = OpLoad %6 %24 + %258 = OpIAdd %6 %257 %19 + OpStore %24 %258 + OpBranch %33 + %35 = OpLabel + %260 = OpAccessChain %20 %18 %9 %19 + %261 = OpLoad %10 %260 + OpStore %259 %261 + %263 = OpAccessChain %30 %29 %9 %19 + %264 = OpLoad %6 %263 + OpStore %262 %264 + OpBranch %265 + %265 = OpLabel + OpLoopMerge %267 %268 None + OpBranch %269 + %269 = OpLabel + %270 = OpLoad %6 %8 + %271 = OpSLessThan %41 %270 %219 + OpBranchConditional %271 %266 %267 + %266 = OpLabel + %272 = OpLoad %6 %8 + %273 = OpIAdd %6 %272 %19 + OpStore %8 %273 + %274 = OpLoad %10 %12 + %275 = OpLoad %10 %259 + %276 = OpFAdd %10 %275 %274 + OpStore %259 %276 + OpBranch %268 + %268 = OpLabel + %277 = OpLoad %6 %262 + %278 = OpIAdd %6 %277 %19 + OpStore %262 %278 + OpBranch %265 + %267 = OpLabel + %279 = OpLoad %10 %259 + %280 = OpAccessChain %20 %18 %9 %172 + %281 = OpLoad %10 %280 + %282 = OpFOrdEqual %41 %279 %281 + OpSelectionMerge %284 None + OpBranchConditional %282 %283 %301 + %283 = OpLabel + %288 = OpAccessChain %30 %29 %9 %9 + %289 = OpLoad %6 %288 + %290 = OpConvertSToF %10 %289 + %291 = OpAccessChain %30 %29 %9 %19 + %292 = OpLoad %6 %291 + %293 = OpConvertSToF %10 %292 + %294 = OpAccessChain %30 %29 %9 %19 + %295 = OpLoad %6 %294 + %296 = OpConvertSToF %10 %295 + %297 = OpAccessChain %30 %29 %9 %9 + %298 = OpLoad %6 %297 + %299 = OpConvertSToF %10 %298 + %300 = OpCompositeConstruct %285 %290 %293 %296 %299 + OpStore %287 %300 + OpBranch %284 + %301 = OpLabel + %302 = OpAccessChain %30 %29 %9 %19 + %303 = OpLoad %6 %302 + %304 = OpConvertSToF %10 %303 + %305 = OpCompositeConstruct %285 %304 %304 %304 %304 + OpStore %287 %305 + OpBranch %284 + %284 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 10 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 28.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-fragcoord-negative-always-false.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-fragcoord-negative-always-false.amber new file mode 100644 index 0000000..6b74268 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-fragcoord-negative-always-false.amber @@ -0,0 +1,313 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--redundancy-elimination' +# '--vector-dce' +# '--redundancy-elimination' +# '--convert-local-access-chains' +# '--eliminate-dead-inserts' +# '--ccp' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--scalar-replacement=100' +# '--scalar-replacement=100' +# '--scalar-replacement=100' +# '--if-conversion' +# '--vector-dce' +# '--inline-entry-points-exhaustive' +# '--scalar-replacement=100' +# '--simplify-instructions' +# '--eliminate-dead-code-aggressive' +# '--eliminate-dead-code-aggressive' +# '--eliminate-local-multi-store' +# '--ccp' +# '--convert-local-access-chains' +# '--scalar-replacement=100' +# '--if-conversion' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-store' +# '--eliminate-dead-inserts' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--private-to-local' +# '--eliminate-dead-branches' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [10, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# continue; +# } +# +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# return; +# } +# +# do +# { +# // Always false. +# if(gl_FragCoord.y < 0.0) +# { +# return; +# } +# } +# while(false); +# } +# } +# +# // Always true. +# if(_GLF_global_loop_count == _int_10) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 108 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 %75 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %34 "gl_FragCoord" + OpName %65 "buf0" + OpMemberName %65 0 "_GLF_uniform_int_values" + OpName %67 "" + OpName %75 "_GLF_color" + OpDecorate %34 BuiltIn FragCoord + OpDecorate %64 ArrayStride 16 + OpMemberDecorate %65 0 Offset 0 + OpDecorate %65 Block + OpDecorate %67 DescriptorSet 0 + OpDecorate %67 Binding 0 + OpDecorate %75 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %20 = OpConstant %6 1 + %31 = OpTypeFloat 32 + %32 = OpTypeVector %31 4 + %33 = OpTypePointer Input %32 + %34 = OpVariable %33 Input + %35 = OpTypeInt 32 0 + %36 = OpConstant %35 1 + %37 = OpTypePointer Input %31 + %40 = OpConstant %31 0 + %61 = OpConstantFalse %17 + %63 = OpConstant %35 3 + %64 = OpTypeArray %6 %63 + %65 = OpTypeStruct %64 + %66 = OpTypePointer Uniform %65 + %67 = OpVariable %66 Uniform + %68 = OpTypePointer Uniform %6 + %74 = OpTypePointer Output %32 + %75 = OpVariable %74 Output + %79 = OpConstant %6 2 + %97 = OpConstant %35 0 + %98 = OpTypePointer Function %17 + %100 = OpConstantTrue %17 + %107 = OpTypePointer Function %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %107 Function + %99 = OpVariable %98 Function %61 + OpSelectionMerge %95 None + OpSwitch %97 %96 + %96 = OpLabel + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %15 = OpLoad %6 %8 + %18 = OpSLessThan %17 %15 %16 + OpLoopMerge %12 %13 None + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %19 = OpLoad %6 %8 + %21 = OpIAdd %6 %19 %20 + OpStore %8 %21 + OpBranch %22 + %22 = OpLabel + %27 = OpLoad %6 %8 + %28 = OpSLessThan %17 %27 %16 + OpLoopMerge %24 %25 None + OpBranchConditional %28 %23 %24 + %23 = OpLabel + %29 = OpLoad %6 %8 + %30 = OpIAdd %6 %29 %20 + OpStore %8 %30 + %38 = OpAccessChain %37 %34 %36 + %39 = OpLoad %31 %38 + %41 = OpFOrdLessThan %17 %39 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %43 + %42 = OpLabel + OpBranch %25 + %43 = OpLabel + OpSelectionMerge %49 None + OpBranchConditional %41 %48 %49 + %48 = OpLabel + OpStore %99 %100 + OpBranch %24 + %49 = OpLabel + OpBranch %51 + %51 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %52 + %52 = OpLabel + OpSelectionMerge %59 None + OpBranchConditional %41 %58 %59 + %58 = OpLabel + OpStore %99 %100 + OpBranch %53 + %59 = OpLabel + OpBranch %54 + %54 = OpLabel + OpBranchConditional %61 %51 %53 + %53 = OpLabel + %106 = OpLoad %17 %99 + OpSelectionMerge %105 None + OpBranchConditional %106 %24 %105 + %105 = OpLabel + OpBranch %25 + %25 = OpLabel + OpBranch %22 + %24 = OpLabel + %102 = OpLoad %17 %99 + OpSelectionMerge %101 None + OpBranchConditional %102 %12 %101 + %101 = OpLabel + OpBranch %13 + %13 = OpLabel + OpBranch %10 + %12 = OpLabel + %104 = OpLoad %17 %99 + OpSelectionMerge %103 None + OpBranchConditional %104 %95 %103 + %103 = OpLabel + %62 = OpLoad %6 %8 + %69 = OpAccessChain %68 %67 %9 %9 + %70 = OpLoad %6 %69 + %71 = OpIEqual %17 %62 %70 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %90 + %72 = OpLabel + %76 = OpAccessChain %68 %67 %9 %20 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %31 %77 + %80 = OpAccessChain %68 %67 %9 %79 + %81 = OpLoad %6 %80 + %82 = OpConvertSToF %31 %81 + %89 = OpCompositeConstruct %32 %78 %82 %82 %78 + OpStore %75 %89 + OpBranch %73 + %90 = OpLabel + %91 = OpAccessChain %68 %67 %9 %79 + %92 = OpLoad %6 %91 + %93 = OpConvertSToF %31 %92 + %94 = OpCompositeConstruct %32 %93 %93 %93 %93 + OpStore %75 %94 + OpBranch %73 + %73 = OpLabel + OpStore %99 %100 + OpBranch %95 + %95 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-index-array-vec2.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-index-array-vec2.amber new file mode 100644 index 0000000..ac4a539 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-index-array-vec2.amber @@ -0,0 +1,598 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_7 _GLF_uniform_int_values[3] +# #define _int_8 _GLF_uniform_int_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2, 7, 8] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr0[16] = int[16](_int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0); +# int arr1[16] = int[16](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1); +# ivec2 v = ivec2(_int_1); +# +# // Iterates once. +# for(int i = _int_1; i < _int_8 && _GLF_global_loop_count < _GLF_global_loop_bound; i++) +# { +# _GLF_global_loop_count++; +# +# // Iterated once. +# for(int j = 1; _GLF_global_loop_count < _GLF_global_loop_bound; j++) +# { +# _GLF_global_loop_count++; +# +# do +# { +# _GLF_global_loop_count++; +# +# // Always true. +# if(arr1[j + i] == _int_1) +# { +# v.x = _int_1; +# int a = _int_1; +# int b = _int_1; +# +# // Iterates once. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# +# // Iterates once. +# for(int k = _int_1; k < _int_8 && _GLF_global_loop_count < _GLF_global_loop_bound; k++) +# { +# _GLF_global_loop_count++; +# +# if(b >= _int_7) +# { +# break; +# } +# b++; +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# } +# } +# +# // Always false. +# if(arr0[_int_1] == _int_1) +# { +# a++; +# } +# +# // Always true. +# if(a == _int_1) +# { +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# } +# +# arr0[a] = _int_1; +# } +# +# if(a >= _int_7) +# { +# break; +# } +# a++; +# } +# +# // Never iterated. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# } +# } +# } +# while(_GLF_global_loop_count < _GLF_global_loop_bound); +# } +# } +# +# arr1[v.x + v.y] = _int_2; +# +# // Always true. +# if(arr0[_int_1] == _int_1 && arr1[_int_2] == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 304 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %285 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %14 "arr0" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %54 "arr1" + OpName %91 "v" + OpName %96 "i" + OpName %116 "j" + OpName %146 "a" + OpName %149 "b" + OpName %161 "k" + OpName %285 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %285 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 16 + %12 = OpTypeArray %6 %11 + %13 = OpTypePointer Function %12 + %15 = OpConstant %10 5 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypePointer Uniform %6 + %55 = OpConstant %6 1 + %89 = OpTypeVector %6 2 + %90 = OpTypePointer Function %89 + %95 = OpTypePointer Function %6 + %105 = OpConstant %6 4 + %108 = OpTypeBool + %111 = OpConstant %6 10 + %144 = OpConstant %10 0 + %179 = OpConstant %6 3 + %255 = OpConstant %10 1 + %259 = OpConstant %6 2 + %282 = OpTypeFloat 32 + %283 = OpTypeVector %282 4 + %284 = OpTypePointer Output %283 + %285 = OpVariable %284 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpVariable %13 Function + %54 = OpVariable %13 Function + %91 = OpVariable %90 Function + %96 = OpVariable %95 Function + %116 = OpVariable %95 Function + %146 = OpVariable %95 Function + %149 = OpVariable %95 Function + %161 = OpVariable %95 Function + OpStore %8 %9 + %21 = OpAccessChain %20 %19 %9 %9 + %22 = OpLoad %6 %21 + %23 = OpAccessChain %20 %19 %9 %9 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %20 %19 %9 %9 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %20 %19 %9 %9 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %20 %19 %9 %9 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %20 %19 %9 %9 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %20 %19 %9 %9 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %20 %19 %9 %9 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %20 %19 %9 %9 + %38 = OpLoad %6 %37 + %39 = OpAccessChain %20 %19 %9 %9 + %40 = OpLoad %6 %39 + %41 = OpAccessChain %20 %19 %9 %9 + %42 = OpLoad %6 %41 + %43 = OpAccessChain %20 %19 %9 %9 + %44 = OpLoad %6 %43 + %45 = OpAccessChain %20 %19 %9 %9 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %20 %19 %9 %9 + %48 = OpLoad %6 %47 + %49 = OpAccessChain %20 %19 %9 %9 + %50 = OpLoad %6 %49 + %51 = OpAccessChain %20 %19 %9 %9 + %52 = OpLoad %6 %51 + %53 = OpCompositeConstruct %12 %22 %24 %26 %28 %30 %32 %34 %36 %38 %40 %42 %44 %46 %48 %50 %52 + OpStore %14 %53 + %56 = OpAccessChain %20 %19 %9 %55 + %57 = OpLoad %6 %56 + %58 = OpAccessChain %20 %19 %9 %55 + %59 = OpLoad %6 %58 + %60 = OpAccessChain %20 %19 %9 %55 + %61 = OpLoad %6 %60 + %62 = OpAccessChain %20 %19 %9 %55 + %63 = OpLoad %6 %62 + %64 = OpAccessChain %20 %19 %9 %55 + %65 = OpLoad %6 %64 + %66 = OpAccessChain %20 %19 %9 %55 + %67 = OpLoad %6 %66 + %68 = OpAccessChain %20 %19 %9 %55 + %69 = OpLoad %6 %68 + %70 = OpAccessChain %20 %19 %9 %55 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %20 %19 %9 %55 + %73 = OpLoad %6 %72 + %74 = OpAccessChain %20 %19 %9 %55 + %75 = OpLoad %6 %74 + %76 = OpAccessChain %20 %19 %9 %55 + %77 = OpLoad %6 %76 + %78 = OpAccessChain %20 %19 %9 %55 + %79 = OpLoad %6 %78 + %80 = OpAccessChain %20 %19 %9 %55 + %81 = OpLoad %6 %80 + %82 = OpAccessChain %20 %19 %9 %55 + %83 = OpLoad %6 %82 + %84 = OpAccessChain %20 %19 %9 %55 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %20 %19 %9 %55 + %87 = OpLoad %6 %86 + %88 = OpCompositeConstruct %12 %57 %59 %61 %63 %65 %67 %69 %71 %73 %75 %77 %79 %81 %83 %85 %87 + OpStore %54 %88 + %92 = OpAccessChain %20 %19 %9 %55 + %93 = OpLoad %6 %92 + %94 = OpCompositeConstruct %89 %93 %93 + OpStore %91 %94 + %97 = OpAccessChain %20 %19 %9 %55 + %98 = OpLoad %6 %97 + OpStore %96 %98 + OpBranch %99 + %99 = OpLabel + OpLoopMerge %101 %102 None + OpBranch %103 + %103 = OpLabel + %104 = OpLoad %6 %96 + %106 = OpAccessChain %20 %19 %9 %105 + %107 = OpLoad %6 %106 + %109 = OpSLessThan %108 %104 %107 + %110 = OpLoad %6 %8 + %112 = OpSLessThan %108 %110 %111 + %113 = OpLogicalAnd %108 %109 %112 + OpBranchConditional %113 %100 %101 + %100 = OpLabel + %114 = OpLoad %6 %8 + %115 = OpIAdd %6 %114 %55 + OpStore %8 %115 + OpStore %116 %55 + OpBranch %117 + %117 = OpLabel + OpLoopMerge %119 %120 None + OpBranch %121 + %121 = OpLabel + %122 = OpLoad %6 %8 + %123 = OpSLessThan %108 %122 %111 + OpBranchConditional %123 %118 %119 + %118 = OpLabel + %124 = OpLoad %6 %8 + %125 = OpIAdd %6 %124 %55 + OpStore %8 %125 + OpBranch %126 + %126 = OpLabel + OpLoopMerge %128 %129 None + OpBranch %127 + %127 = OpLabel + %130 = OpLoad %6 %8 + %131 = OpIAdd %6 %130 %55 + OpStore %8 %131 + %132 = OpLoad %6 %116 + %133 = OpLoad %6 %96 + %134 = OpIAdd %6 %132 %133 + %135 = OpAccessChain %95 %54 %134 + %136 = OpLoad %6 %135 + %137 = OpAccessChain %20 %19 %9 %55 + %138 = OpLoad %6 %137 + %139 = OpIEqual %108 %136 %138 + OpSelectionMerge %141 None + OpBranchConditional %139 %140 %141 + %140 = OpLabel + %142 = OpAccessChain %20 %19 %9 %55 + %143 = OpLoad %6 %142 + %145 = OpAccessChain %95 %91 %144 + OpStore %145 %143 + %147 = OpAccessChain %20 %19 %9 %55 + %148 = OpLoad %6 %147 + OpStore %146 %148 + %150 = OpAccessChain %20 %19 %9 %55 + %151 = OpLoad %6 %150 + OpStore %149 %151 + OpBranch %152 + %152 = OpLabel + OpLoopMerge %154 %155 None + OpBranch %156 + %156 = OpLabel + %157 = OpLoad %6 %8 + %158 = OpSLessThan %108 %157 %111 + OpBranchConditional %158 %153 %154 + %153 = OpLabel + %159 = OpLoad %6 %8 + %160 = OpIAdd %6 %159 %55 + OpStore %8 %160 + %162 = OpAccessChain %20 %19 %9 %55 + %163 = OpLoad %6 %162 + OpStore %161 %163 + OpBranch %164 + %164 = OpLabel + OpLoopMerge %166 %167 None + OpBranch %168 + %168 = OpLabel + %169 = OpLoad %6 %161 + %170 = OpAccessChain %20 %19 %9 %105 + %171 = OpLoad %6 %170 + %172 = OpSLessThan %108 %169 %171 + %173 = OpLoad %6 %8 + %174 = OpSLessThan %108 %173 %111 + %175 = OpLogicalAnd %108 %172 %174 + OpBranchConditional %175 %165 %166 + %165 = OpLabel + %176 = OpLoad %6 %8 + %177 = OpIAdd %6 %176 %55 + OpStore %8 %177 + %178 = OpLoad %6 %149 + %180 = OpAccessChain %20 %19 %9 %179 + %181 = OpLoad %6 %180 + %182 = OpSGreaterThanEqual %108 %178 %181 + OpSelectionMerge %184 None + OpBranchConditional %182 %183 %184 + %183 = OpLabel + OpBranch %166 + %184 = OpLabel + %186 = OpLoad %6 %149 + %187 = OpIAdd %6 %186 %55 + OpStore %149 %187 + OpBranch %188 + %188 = OpLabel + OpLoopMerge %190 %191 None + OpBranch %192 + %192 = OpLabel + %193 = OpLoad %6 %8 + %194 = OpSLessThan %108 %193 %111 + OpBranchConditional %194 %189 %190 + %189 = OpLabel + %195 = OpLoad %6 %8 + %196 = OpIAdd %6 %195 %55 + OpStore %8 %196 + OpBranch %191 + %191 = OpLabel + OpBranch %188 + %190 = OpLabel + OpBranch %167 + %167 = OpLabel + %197 = OpLoad %6 %161 + %198 = OpIAdd %6 %197 %55 + OpStore %161 %198 + OpBranch %164 + %166 = OpLabel + %199 = OpAccessChain %20 %19 %9 %55 + %200 = OpLoad %6 %199 + %201 = OpAccessChain %95 %14 %200 + %202 = OpLoad %6 %201 + %203 = OpAccessChain %20 %19 %9 %55 + %204 = OpLoad %6 %203 + %205 = OpIEqual %108 %202 %204 + OpSelectionMerge %207 None + OpBranchConditional %205 %206 %207 + %206 = OpLabel + %208 = OpLoad %6 %146 + %209 = OpIAdd %6 %208 %55 + OpStore %146 %209 + OpBranch %207 + %207 = OpLabel + %210 = OpLoad %6 %146 + %211 = OpAccessChain %20 %19 %9 %55 + %212 = OpLoad %6 %211 + %213 = OpIEqual %108 %210 %212 + OpSelectionMerge %215 None + OpBranchConditional %213 %214 %215 + %214 = OpLabel + OpBranch %216 + %216 = OpLabel + OpLoopMerge %218 %219 None + OpBranch %220 + %220 = OpLabel + %221 = OpLoad %6 %8 + %222 = OpSLessThan %108 %221 %111 + OpBranchConditional %222 %217 %218 + %217 = OpLabel + %223 = OpLoad %6 %8 + %224 = OpIAdd %6 %223 %55 + OpStore %8 %224 + OpBranch %219 + %219 = OpLabel + OpBranch %216 + %218 = OpLabel + %225 = OpLoad %6 %146 + %226 = OpAccessChain %20 %19 %9 %55 + %227 = OpLoad %6 %226 + %228 = OpAccessChain %95 %14 %225 + OpStore %228 %227 + OpBranch %215 + %215 = OpLabel + %229 = OpLoad %6 %146 + %230 = OpAccessChain %20 %19 %9 %179 + %231 = OpLoad %6 %230 + %232 = OpSGreaterThanEqual %108 %229 %231 + OpSelectionMerge %234 None + OpBranchConditional %232 %233 %234 + %233 = OpLabel + OpBranch %154 + %234 = OpLabel + %236 = OpLoad %6 %146 + %237 = OpIAdd %6 %236 %55 + OpStore %146 %237 + OpBranch %155 + %155 = OpLabel + OpBranch %152 + %154 = OpLabel + OpBranch %238 + %238 = OpLabel + OpLoopMerge %240 %241 None + OpBranch %242 + %242 = OpLabel + %243 = OpLoad %6 %8 + %244 = OpSLessThan %108 %243 %111 + OpBranchConditional %244 %239 %240 + %239 = OpLabel + %245 = OpLoad %6 %8 + %246 = OpIAdd %6 %245 %55 + OpStore %8 %246 + OpBranch %241 + %241 = OpLabel + OpBranch %238 + %240 = OpLabel + OpBranch %141 + %141 = OpLabel + OpBranch %129 + %129 = OpLabel + %247 = OpLoad %6 %8 + %248 = OpSLessThan %108 %247 %111 + OpBranchConditional %248 %126 %128 + %128 = OpLabel + OpBranch %120 + %120 = OpLabel + %249 = OpLoad %6 %116 + %250 = OpIAdd %6 %249 %55 + OpStore %116 %250 + OpBranch %117 + %119 = OpLabel + OpBranch %102 + %102 = OpLabel + %251 = OpLoad %6 %96 + %252 = OpIAdd %6 %251 %55 + OpStore %96 %252 + OpBranch %99 + %101 = OpLabel + %253 = OpAccessChain %95 %91 %144 + %254 = OpLoad %6 %253 + %256 = OpAccessChain %95 %91 %255 + %257 = OpLoad %6 %256 + %258 = OpIAdd %6 %254 %257 + %260 = OpAccessChain %20 %19 %9 %259 + %261 = OpLoad %6 %260 + %262 = OpAccessChain %95 %54 %258 + OpStore %262 %261 + %263 = OpAccessChain %20 %19 %9 %55 + %264 = OpLoad %6 %263 + %265 = OpAccessChain %95 %14 %264 + %266 = OpLoad %6 %265 + %267 = OpAccessChain %20 %19 %9 %55 + %268 = OpLoad %6 %267 + %269 = OpIEqual %108 %266 %268 + OpSelectionMerge %271 None + OpBranchConditional %269 %270 %271 + %270 = OpLabel + %272 = OpAccessChain %20 %19 %9 %259 + %273 = OpLoad %6 %272 + %274 = OpAccessChain %95 %54 %273 + %275 = OpLoad %6 %274 + %276 = OpAccessChain %20 %19 %9 %259 + %277 = OpLoad %6 %276 + %278 = OpIEqual %108 %275 %277 + OpBranch %271 + %271 = OpLabel + %279 = OpPhi %108 %269 %101 %278 %270 + OpSelectionMerge %281 None + OpBranchConditional %279 %280 %299 + %280 = OpLabel + %286 = OpAccessChain %20 %19 %9 %55 + %287 = OpLoad %6 %286 + %288 = OpConvertSToF %282 %287 + %289 = OpAccessChain %20 %19 %9 %9 + %290 = OpLoad %6 %289 + %291 = OpConvertSToF %282 %290 + %292 = OpAccessChain %20 %19 %9 %9 + %293 = OpLoad %6 %292 + %294 = OpConvertSToF %282 %293 + %295 = OpAccessChain %20 %19 %9 %55 + %296 = OpLoad %6 %295 + %297 = OpConvertSToF %282 %296 + %298 = OpCompositeConstruct %283 %288 %291 %294 %297 + OpStore %285 %298 + OpBranch %281 + %299 = OpLabel + %300 = OpAccessChain %20 %19 %9 %9 + %301 = OpLoad %6 %300 + %302 = OpConvertSToF %282 %301 + %303 = OpCompositeConstruct %283 %302 %302 %302 %302 + OpStore %285 %303 + OpBranch %281 + %281 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 7 8 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-iterator-dependency.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-iterator-dependency.amber new file mode 100644 index 0000000..21b1d5d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-iterator-dependency.amber @@ -0,0 +1,310 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_8 _GLF_uniform_int_values[3] +# #define _int_10 _GLF_uniform_int_values[4] +# #define _int_9 _GLF_uniform_int_values[5] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2, 8, 10, 9] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[6]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# int arr0[10] = int[10](1, 1, 1, 1, 1, 1, 1, 1, 1, 1), arr1[10] = int[10](2, 2, 2, 2, 2, 2, 2, 2, 2, 2); +# +# void main() +# { +# // Iterated once. +# for(int i = _int_1; _GLF_global_loop_count < _GLF_global_loop_bound; i++) +# { +# _GLF_global_loop_count++; +# int k = _int_1, j = i; +# +# // Iterated nine times with k = 1..9 and j = 1..9. +# while((j < _int_10) && (_GLF_global_loop_count < _GLF_global_loop_bound)) +# { +# _GLF_global_loop_count ++; +# arr1[k++] = arr0[j++]; +# } +# +# arr0[_int_1] = arr1[_int_1]; +# } +# +# // Always true. +# if(arr1[_int_0] == _int_2 && arr1[_int_1] == _int_1 && arr1[_int_8] == _int_1 && arr1[_int_9] == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 140 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %121 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %14 "arr0" + OpName %17 "arr1" + OpName %21 "i" + OpName %24 "buf0" + OpMemberName %24 0 "_GLF_uniform_int_values" + OpName %26 "" + OpName %41 "k" + OpName %44 "j" + OpName %121 "_GLF_color" + OpDecorate %23 ArrayStride 16 + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 0 + OpDecorate %121 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 10 + %12 = OpTypeArray %6 %11 + %13 = OpTypePointer Private %12 + %14 = OpVariable %13 Private + %15 = OpConstant %6 1 + %16 = OpConstantComposite %12 %15 %15 %15 %15 %15 %15 %15 %15 %15 %15 + %17 = OpVariable %13 Private + %18 = OpConstant %6 2 + %19 = OpConstantComposite %12 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 + %20 = OpTypePointer Function %6 + %22 = OpConstant %10 6 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpTypePointer Uniform %6 + %36 = OpConstant %6 10 + %37 = OpTypeBool + %52 = OpConstant %6 4 + %96 = OpConstant %6 3 + %107 = OpConstant %6 5 + %118 = OpTypeFloat 32 + %119 = OpTypeVector %118 4 + %120 = OpTypePointer Output %119 + %121 = OpVariable %120 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %21 = OpVariable %20 Function + %41 = OpVariable %20 Function + %44 = OpVariable %20 Function + OpStore %8 %9 + OpStore %14 %16 + OpStore %17 %19 + %28 = OpAccessChain %27 %26 %9 %15 + %29 = OpLoad %6 %28 + OpStore %21 %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %6 %8 + %38 = OpSLessThan %37 %35 %36 + OpBranchConditional %38 %31 %32 + %31 = OpLabel + %39 = OpLoad %6 %8 + %40 = OpIAdd %6 %39 %15 + OpStore %8 %40 + %42 = OpAccessChain %27 %26 %9 %15 + %43 = OpLoad %6 %42 + OpStore %41 %43 + %45 = OpLoad %6 %21 + OpStore %44 %45 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %6 %44 + %53 = OpAccessChain %27 %26 %9 %52 + %54 = OpLoad %6 %53 + %55 = OpSLessThan %37 %51 %54 + %56 = OpLoad %6 %8 + %57 = OpSLessThan %37 %56 %36 + %58 = OpLogicalAnd %37 %55 %57 + OpBranchConditional %58 %47 %48 + %47 = OpLabel + %59 = OpLoad %6 %8 + %60 = OpIAdd %6 %59 %15 + OpStore %8 %60 + %61 = OpLoad %6 %41 + %62 = OpIAdd %6 %61 %15 + OpStore %41 %62 + %63 = OpLoad %6 %44 + %64 = OpIAdd %6 %63 %15 + OpStore %44 %64 + %65 = OpAccessChain %7 %14 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %7 %17 %61 + OpStore %67 %66 + OpBranch %49 + %49 = OpLabel + OpBranch %46 + %48 = OpLabel + %68 = OpAccessChain %27 %26 %9 %15 + %69 = OpLoad %6 %68 + %70 = OpAccessChain %27 %26 %9 %15 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %7 %17 %71 + %73 = OpLoad %6 %72 + %74 = OpAccessChain %7 %14 %69 + OpStore %74 %73 + OpBranch %33 + %33 = OpLabel + %75 = OpLoad %6 %21 + %76 = OpIAdd %6 %75 %15 + OpStore %21 %76 + OpBranch %30 + %32 = OpLabel + %77 = OpAccessChain %27 %26 %9 %9 + %78 = OpLoad %6 %77 + %79 = OpAccessChain %7 %17 %78 + %80 = OpLoad %6 %79 + %81 = OpAccessChain %27 %26 %9 %18 + %82 = OpLoad %6 %81 + %83 = OpIEqual %37 %80 %82 + OpSelectionMerge %85 None + OpBranchConditional %83 %84 %85 + %84 = OpLabel + %86 = OpAccessChain %27 %26 %9 %15 + %87 = OpLoad %6 %86 + %88 = OpAccessChain %7 %17 %87 + %89 = OpLoad %6 %88 + %90 = OpAccessChain %27 %26 %9 %15 + %91 = OpLoad %6 %90 + %92 = OpIEqual %37 %89 %91 + OpBranch %85 + %85 = OpLabel + %93 = OpPhi %37 %83 %32 %92 %84 + OpSelectionMerge %95 None + OpBranchConditional %93 %94 %95 + %94 = OpLabel + %97 = OpAccessChain %27 %26 %9 %96 + %98 = OpLoad %6 %97 + %99 = OpAccessChain %7 %17 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %27 %26 %9 %15 + %102 = OpLoad %6 %101 + %103 = OpIEqual %37 %100 %102 + OpBranch %95 + %95 = OpLabel + %104 = OpPhi %37 %93 %85 %103 %94 + OpSelectionMerge %106 None + OpBranchConditional %104 %105 %106 + %105 = OpLabel + %108 = OpAccessChain %27 %26 %9 %107 + %109 = OpLoad %6 %108 + %110 = OpAccessChain %7 %17 %109 + %111 = OpLoad %6 %110 + %112 = OpAccessChain %27 %26 %9 %15 + %113 = OpLoad %6 %112 + %114 = OpIEqual %37 %111 %113 + OpBranch %106 + %106 = OpLabel + %115 = OpPhi %37 %104 %95 %114 %105 + OpSelectionMerge %117 None + OpBranchConditional %115 %116 %135 + %116 = OpLabel + %122 = OpAccessChain %27 %26 %9 %15 + %123 = OpLoad %6 %122 + %124 = OpConvertSToF %118 %123 + %125 = OpAccessChain %27 %26 %9 %9 + %126 = OpLoad %6 %125 + %127 = OpConvertSToF %118 %126 + %128 = OpAccessChain %27 %26 %9 %9 + %129 = OpLoad %6 %128 + %130 = OpConvertSToF %118 %129 + %131 = OpAccessChain %27 %26 %9 %15 + %132 = OpLoad %6 %131 + %133 = OpConvertSToF %118 %132 + %134 = OpCompositeConstruct %119 %124 %127 %130 %133 + OpStore %121 %134 + OpBranch %117 + %135 = OpLabel + %136 = OpAccessChain %27 %26 %9 %9 + %137 = OpLoad %6 %136 + %138 = OpConvertSToF %118 %137 + %139 = OpCompositeConstruct %119 %138 %138 %138 %138 + OpStore %121 %139 + OpBranch %117 + %117 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 8 10 9 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-output-color-from-backup.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-output-color-from-backup.amber new file mode 100644 index 0000000..80f701b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-output-color-from-backup.amber @@ -0,0 +1,262 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Iterated once. +# for(int i = _int_1; i > _int_0 && _GLF_global_loop_count < _GLF_global_loop_bound; i--) +# { +# // Iterated once. +# for(int i = _int_1; i != _int_0 && _GLF_global_loop_count < _GLF_global_loop_bound; i--) +# { +# // Uninitialized here, but this gets a value in the while loop below. +# vec4 v; +# +# // Iterated ten times. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# v = _GLF_color; +# } +# +# _GLF_color = vec4(_int_0); +# +# // Always true. +# if(_int_1 > _int_0) +# { +# _GLF_color = v; +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 101 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %13 "_GLF_color" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %36 "i" + OpName %53 "i" + OpName %78 "v" + OpDecorate %13 Location 0 + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Output %11 + %13 = OpVariable %12 Output + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 2 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypePointer Uniform %6 + %24 = OpConstant %6 1 + %35 = OpTypePointer Function %6 + %47 = OpTypeBool + %50 = OpConstant %6 10 + %77 = OpTypePointer Function %11 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %36 = OpVariable %35 Function + %53 = OpVariable %35 Function + %78 = OpVariable %77 Function + OpStore %8 %9 + %21 = OpAccessChain %20 %19 %9 %9 + %22 = OpLoad %6 %21 + %23 = OpConvertSToF %10 %22 + %25 = OpAccessChain %20 %19 %9 %24 + %26 = OpLoad %6 %25 + %27 = OpConvertSToF %10 %26 + %28 = OpAccessChain %20 %19 %9 %24 + %29 = OpLoad %6 %28 + %30 = OpConvertSToF %10 %29 + %31 = OpAccessChain %20 %19 %9 %9 + %32 = OpLoad %6 %31 + %33 = OpConvertSToF %10 %32 + %34 = OpCompositeConstruct %11 %23 %27 %30 %33 + OpStore %13 %34 + %37 = OpAccessChain %20 %19 %9 %9 + %38 = OpLoad %6 %37 + OpStore %36 %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %6 %36 + %45 = OpAccessChain %20 %19 %9 %24 + %46 = OpLoad %6 %45 + %48 = OpSGreaterThan %47 %44 %46 + %49 = OpLoad %6 %8 + %51 = OpSLessThan %47 %49 %50 + %52 = OpLogicalAnd %47 %48 %51 + OpBranchConditional %52 %40 %41 + %40 = OpLabel + %54 = OpAccessChain %20 %19 %9 %9 + %55 = OpLoad %6 %54 + OpStore %53 %55 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %6 %53 + %62 = OpAccessChain %20 %19 %9 %24 + %63 = OpLoad %6 %62 + %64 = OpINotEqual %47 %61 %63 + %65 = OpLoad %6 %8 + %66 = OpSLessThan %47 %65 %50 + %67 = OpLogicalAnd %47 %64 %66 + OpBranchConditional %67 %57 %58 + %57 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %8 + %74 = OpSLessThan %47 %73 %50 + OpBranchConditional %74 %69 %70 + %69 = OpLabel + %75 = OpLoad %6 %8 + %76 = OpIAdd %6 %75 %24 + OpStore %8 %76 + %79 = OpLoad %11 %13 + OpStore %78 %79 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %80 = OpAccessChain %20 %19 %9 %24 + %81 = OpLoad %6 %80 + %82 = OpConvertSToF %10 %81 + %83 = OpCompositeConstruct %11 %82 %82 %82 %82 + OpStore %13 %83 + %84 = OpAccessChain %20 %19 %9 %9 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %20 %19 %9 %24 + %87 = OpLoad %6 %86 + %88 = OpSGreaterThan %47 %85 %87 + OpSelectionMerge %90 None + OpBranchConditional %88 %89 %92 + %89 = OpLabel + %91 = OpLoad %11 %78 + OpStore %13 %91 + OpBranch %90 + %92 = OpLabel + %93 = OpAccessChain %20 %19 %9 %24 + %94 = OpLoad %6 %93 + %95 = OpConvertSToF %10 %94 + %96 = OpCompositeConstruct %11 %95 %95 %95 %95 + OpStore %13 %96 + OpBranch %90 + %90 = OpLabel + OpBranch %59 + %59 = OpLabel + %97 = OpLoad %6 %53 + %98 = OpISub %6 %97 %24 + OpStore %53 %98 + OpBranch %56 + %58 = OpLabel + OpBranch %42 + %42 = OpLabel + %99 = OpLoad %6 %36 + %100 = OpISub %6 %99 %24 + OpStore %36 %100 + OpBranch %39 + %41 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-reached-second-iteration.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-reached-second-iteration.amber new file mode 100644 index 0000000..d6ce092 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-global-loop-counter-reached-second-iteration.amber @@ -0,0 +1,309 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# // Iterates twice. +# for(int i = _int_1; _GLF_global_loop_count < _GLF_global_loop_bound; i = _int_2) +# { +# _GLF_global_loop_count++; +# +# int b = i - int(injectionSwitch.x) + int(max(injectionSwitch, injectionSwitch).x) - 1; +# +# // Loops until the global loop bound is reached, but only during the second iteration +# // when i == 2. +# while(b >= _int_1 && _GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# } +# +# // Iterates once when i == 1. The global loop bound is already reached when i == 2. +# for(int j = _int_1; j <= i && _GLF_global_loop_count < _GLF_global_loop_bound; j++) +# { +# _GLF_global_loop_count++; +# a++; +# } +# } +# +# // Always true. +# if(a == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 123 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %104 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %11 "a" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %22 "i" + OpName %36 "b" + OpName %40 "buf1" + OpMemberName %40 0 "injectionSwitch" + OpName %42 "" + OpName %73 "j" + OpName %104 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpMemberDecorate %40 0 Offset 0 + OpDecorate %40 Block + OpDecorate %42 DescriptorSet 0 + OpDecorate %42 Binding 1 + OpDecorate %104 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 3 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 1 + %19 = OpTypePointer Uniform %6 + %31 = OpConstant %6 10 + %32 = OpTypeBool + %38 = OpTypeFloat 32 + %39 = OpTypeVector %38 2 + %40 = OpTypeStruct %39 + %41 = OpTypePointer Uniform %40 + %42 = OpVariable %41 Uniform + %43 = OpConstant %12 0 + %44 = OpTypePointer Uniform %38 + %49 = OpTypePointer Uniform %39 + %93 = OpConstant %6 2 + %102 = OpTypeVector %38 4 + %103 = OpTypePointer Output %102 + %104 = OpVariable %103 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %22 = OpVariable %10 Function + %36 = OpVariable %10 Function + %73 = OpVariable %10 Function + OpStore %8 %9 + %20 = OpAccessChain %19 %17 %9 %18 + %21 = OpLoad %6 %20 + OpStore %11 %21 + %23 = OpAccessChain %19 %17 %9 %9 + %24 = OpLoad %6 %23 + OpStore %22 %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %6 %8 + %33 = OpSLessThan %32 %30 %31 + OpBranchConditional %33 %26 %27 + %26 = OpLabel + %34 = OpLoad %6 %8 + %35 = OpIAdd %6 %34 %18 + OpStore %8 %35 + %37 = OpLoad %6 %22 + %45 = OpAccessChain %44 %42 %9 %43 + %46 = OpLoad %38 %45 + %47 = OpConvertFToS %6 %46 + %48 = OpISub %6 %37 %47 + %50 = OpAccessChain %49 %42 %9 + %51 = OpLoad %39 %50 + %52 = OpAccessChain %49 %42 %9 + %53 = OpLoad %39 %52 + %54 = OpExtInst %39 %1 FMax %51 %53 + %55 = OpCompositeExtract %38 %54 0 + %56 = OpConvertFToS %6 %55 + %57 = OpIAdd %6 %48 %56 + %58 = OpISub %6 %57 %18 + OpStore %36 %58 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + %64 = OpLoad %6 %36 + %65 = OpAccessChain %19 %17 %9 %9 + %66 = OpLoad %6 %65 + %67 = OpSGreaterThanEqual %32 %64 %66 + %68 = OpLoad %6 %8 + %69 = OpSLessThan %32 %68 %31 + %70 = OpLogicalAnd %32 %67 %69 + OpBranchConditional %70 %60 %61 + %60 = OpLabel + %71 = OpLoad %6 %8 + %72 = OpIAdd %6 %71 %18 + OpStore %8 %72 + OpBranch %62 + %62 = OpLabel + OpBranch %59 + %61 = OpLabel + %74 = OpAccessChain %19 %17 %9 %9 + %75 = OpLoad %6 %74 + OpStore %73 %75 + OpBranch %76 + %76 = OpLabel + OpLoopMerge %78 %79 None + OpBranch %80 + %80 = OpLabel + %81 = OpLoad %6 %73 + %82 = OpLoad %6 %22 + %83 = OpSLessThanEqual %32 %81 %82 + %84 = OpLoad %6 %8 + %85 = OpSLessThan %32 %84 %31 + %86 = OpLogicalAnd %32 %83 %85 + OpBranchConditional %86 %77 %78 + %77 = OpLabel + %87 = OpLoad %6 %8 + %88 = OpIAdd %6 %87 %18 + OpStore %8 %88 + %89 = OpLoad %6 %11 + %90 = OpIAdd %6 %89 %18 + OpStore %11 %90 + OpBranch %79 + %79 = OpLabel + %91 = OpLoad %6 %73 + %92 = OpIAdd %6 %91 %18 + OpStore %73 %92 + OpBranch %76 + %78 = OpLabel + OpBranch %28 + %28 = OpLabel + %94 = OpAccessChain %19 %17 %9 %93 + %95 = OpLoad %6 %94 + OpStore %22 %95 + OpBranch %25 + %27 = OpLabel + %96 = OpLoad %6 %11 + %97 = OpAccessChain %19 %17 %9 %9 + %98 = OpLoad %6 %97 + %99 = OpIEqual %32 %96 %98 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %118 + %100 = OpLabel + %105 = OpAccessChain %19 %17 %9 %9 + %106 = OpLoad %6 %105 + %107 = OpConvertSToF %38 %106 + %108 = OpAccessChain %19 %17 %9 %18 + %109 = OpLoad %6 %108 + %110 = OpConvertSToF %38 %109 + %111 = OpAccessChain %19 %17 %9 %18 + %112 = OpLoad %6 %111 + %113 = OpConvertSToF %38 %112 + %114 = OpAccessChain %19 %17 %9 %9 + %115 = OpLoad %6 %114 + %116 = OpConvertSToF %38 %115 + %117 = OpCompositeConstruct %102 %107 %110 %113 %116 + OpStore %104 %117 + OpBranch %101 + %118 = OpLabel + %119 = OpAccessChain %19 %17 %9 %18 + %120 = OpLoad %6 %119 + %121 = OpConvertSToF %38 %120 + %122 = OpCompositeConstruct %102 %121 %121 %121 %121 + OpStore %104 %122 + OpBranch %101 + %101 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-identical-iterator-names-multiply-divide.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-identical-iterator-names-multiply-divide.amber new file mode 100644 index 0000000..046e755 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-identical-iterator-names-multiply-divide.amber @@ -0,0 +1,268 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_4 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [4, 1, 2, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# // Iterated once. +# for(int i = _int_0; i < _int_1; i++) +# { +# { +# int j = _int_1, i = i; +# +# // Iterated twice. +# while(i <= _int_1) +# { +# a++; +# +# // Never iterated. +# for(j = 1; j < i; j++) +# { +# a = _int_0; +# // This would make the while loop infinite, but this is never executed. +# i = (_int_4 * i) / 1000; +# } +# +# i++; +# } +# } +# } +# +# // Always true. +# if(a == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 101 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %82 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %34 "j" + OpName %37 "i" + OpName %82 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %82 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 3 + %17 = OpTypePointer Uniform %6 + %29 = OpConstant %6 1 + %32 = OpTypeBool + %64 = OpConstant %6 1000 + %73 = OpConstant %6 2 + %79 = OpTypeFloat 32 + %80 = OpTypeVector %79 4 + %81 = OpTypePointer Output %80 + %82 = OpVariable %81 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %34 = OpVariable %7 Function + %37 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %21 = OpAccessChain %17 %14 %15 %16 + %22 = OpLoad %6 %21 + OpStore %20 %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %6 %20 + %30 = OpAccessChain %17 %14 %15 %29 + %31 = OpLoad %6 %30 + %33 = OpSLessThan %32 %28 %31 + OpBranchConditional %33 %24 %25 + %24 = OpLabel + %35 = OpAccessChain %17 %14 %15 %29 + %36 = OpLoad %6 %35 + OpStore %34 %36 + %38 = OpLoad %6 %20 + OpStore %37 %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %6 %37 + %45 = OpAccessChain %17 %14 %15 %29 + %46 = OpLoad %6 %45 + %47 = OpSLessThanEqual %32 %44 %46 + OpBranchConditional %47 %40 %41 + %40 = OpLabel + %48 = OpLoad %6 %8 + %49 = OpIAdd %6 %48 %29 + OpStore %8 %49 + OpStore %34 %29 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %34 + %56 = OpLoad %6 %37 + %57 = OpSLessThan %32 %55 %56 + OpBranchConditional %57 %51 %52 + %51 = OpLabel + %58 = OpAccessChain %17 %14 %15 %16 + %59 = OpLoad %6 %58 + OpStore %8 %59 + %60 = OpAccessChain %17 %14 %15 %15 + %61 = OpLoad %6 %60 + %62 = OpLoad %6 %37 + %63 = OpIMul %6 %61 %62 + %65 = OpSDiv %6 %63 %64 + OpStore %37 %65 + OpBranch %53 + %53 = OpLabel + %66 = OpLoad %6 %34 + %67 = OpIAdd %6 %66 %29 + OpStore %34 %67 + OpBranch %50 + %52 = OpLabel + %68 = OpLoad %6 %37 + %69 = OpIAdd %6 %68 %29 + OpStore %37 %69 + OpBranch %42 + %42 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %26 + %26 = OpLabel + %70 = OpLoad %6 %20 + %71 = OpIAdd %6 %70 %29 + OpStore %20 %71 + OpBranch %23 + %25 = OpLabel + %72 = OpLoad %6 %8 + %74 = OpAccessChain %17 %14 %15 %73 + %75 = OpLoad %6 %74 + %76 = OpIEqual %32 %72 %75 + OpSelectionMerge %78 None + OpBranchConditional %76 %77 %96 + %77 = OpLabel + %83 = OpAccessChain %17 %14 %15 %29 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %79 %84 + %86 = OpAccessChain %17 %14 %15 %16 + %87 = OpLoad %6 %86 + %88 = OpConvertSToF %79 %87 + %89 = OpAccessChain %17 %14 %15 %16 + %90 = OpLoad %6 %89 + %91 = OpConvertSToF %79 %90 + %92 = OpAccessChain %17 %14 %15 %29 + %93 = OpLoad %6 %92 + %94 = OpConvertSToF %79 %93 + %95 = OpCompositeConstruct %80 %85 %88 %91 %94 + OpStore %82 %95 + OpBranch %78 + %96 = OpLabel + %97 = OpAccessChain %17 %14 %15 %16 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %79 %98 + %100 = OpCompositeConstruct %80 %99 %99 %99 %99 + OpStore %82 %100 + OpBranch %78 + %78 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 4 1 2 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-identical-iterators-compare-same-array-elements.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-identical-iterators-compare-same-array-elements.amber new file mode 100644 index 0000000..5ed6824 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-identical-iterators-compare-same-array-elements.amber @@ -0,0 +1,330 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_9967_043 _GLF_uniform_float_values[0] +# #define _float_5_4 _GLF_uniform_float_values[1] +# #define _float_214_06 _GLF_uniform_float_values[2] +# #define _float_63_98 _GLF_uniform_float_values[3] +# #define _float_9966_043 _GLF_uniform_float_values[4] +# #define _float_6_4 _GLF_uniform_float_values[5] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_float_values: [9967.043, 5.4, 214.06, 63.98, 9966.043, 6.4] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[6]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int data[2] = int[2](0, 1); +# int i = _int_1, j = _int_1; +# _GLF_color = vec4(_int_0); +# +# // Iterates once. +# while(i <= _int_1 && j <= _int_1 && _GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# +# // Iterates once. +# for(int k = 1; k != 0 && _GLF_global_loop_count < _GLF_global_loop_bound; k--) +# { +# _GLF_global_loop_count ++; +# +# // Always false. +# if(data[i] < data[j]) +# { +# i++; +# } +# else +# { +# _GLF_color = vec4(_float_6_4, _float_214_06, _float_63_98, _float_9967_043); +# j++; +# } +# } +# } +# +# // Always true. +# if(i == _int_1 && j == _int_2) +# { +# // _GLF_color becomes (1, 0, 0, 1). +# _GLF_color -= vec4(_float_5_4, _float_214_06, _float_63_98, _float_9966_043); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 133 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %14 "data" + OpName %18 "i" + OpName %21 "buf0" + OpMemberName %21 0 "_GLF_uniform_int_values" + OpName %23 "" + OpName %27 "j" + OpName %33 "_GLF_color" + OpName %61 "k" + OpName %88 "buf1" + OpMemberName %88 0 "_GLF_uniform_float_values" + OpName %90 "" + OpDecorate %20 ArrayStride 16 + OpMemberDecorate %21 0 Offset 0 + OpDecorate %21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 0 + OpDecorate %33 Location 0 + OpDecorate %87 ArrayStride 16 + OpMemberDecorate %88 0 Offset 0 + OpDecorate %88 Block + OpDecorate %90 DescriptorSet 0 + OpDecorate %90 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypePointer Function %12 + %15 = OpConstant %6 1 + %16 = OpConstantComposite %12 %9 %15 + %17 = OpTypePointer Function %6 + %19 = OpConstant %10 3 + %20 = OpTypeArray %6 %19 + %21 = OpTypeStruct %20 + %22 = OpTypePointer Uniform %21 + %23 = OpVariable %22 Uniform + %24 = OpTypePointer Uniform %6 + %30 = OpTypeFloat 32 + %31 = OpTypeVector %30 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %43 = OpTypeBool + %56 = OpConstant %6 10 + %86 = OpConstant %10 6 + %87 = OpTypeArray %30 %86 + %88 = OpTypeStruct %87 + %89 = OpTypePointer Uniform %88 + %90 = OpVariable %89 Uniform + %91 = OpConstant %6 5 + %92 = OpTypePointer Uniform %30 + %95 = OpConstant %6 2 + %98 = OpConstant %6 3 + %127 = OpConstant %6 4 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpVariable %13 Function + %18 = OpVariable %17 Function + %27 = OpVariable %17 Function + %61 = OpVariable %17 Function + OpStore %8 %9 + OpStore %14 %16 + %25 = OpAccessChain %24 %23 %9 %9 + %26 = OpLoad %6 %25 + OpStore %18 %26 + %28 = OpAccessChain %24 %23 %9 %9 + %29 = OpLoad %6 %28 + OpStore %27 %29 + %34 = OpAccessChain %24 %23 %9 %15 + %35 = OpLoad %6 %34 + %36 = OpConvertSToF %30 %35 + %37 = OpCompositeConstruct %31 %36 %36 %36 %36 + OpStore %33 %37 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %44 = OpLoad %6 %18 + %45 = OpAccessChain %24 %23 %9 %9 + %46 = OpLoad %6 %45 + %47 = OpSLessThanEqual %43 %44 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %49 + %48 = OpLabel + %50 = OpLoad %6 %27 + %51 = OpAccessChain %24 %23 %9 %9 + %52 = OpLoad %6 %51 + %53 = OpSLessThanEqual %43 %50 %52 + OpBranch %49 + %49 = OpLabel + %54 = OpPhi %43 %47 %42 %53 %48 + %55 = OpLoad %6 %8 + %57 = OpSLessThan %43 %55 %56 + %58 = OpLogicalAnd %43 %54 %57 + OpBranchConditional %58 %39 %40 + %39 = OpLabel + %59 = OpLoad %6 %8 + %60 = OpIAdd %6 %59 %15 + OpStore %8 %60 + OpStore %61 %15 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpLoad %6 %61 + %68 = OpINotEqual %43 %67 %9 + %69 = OpLoad %6 %8 + %70 = OpSLessThan %43 %69 %56 + %71 = OpLogicalAnd %43 %68 %70 + OpBranchConditional %71 %63 %64 + %63 = OpLabel + %72 = OpLoad %6 %8 + %73 = OpIAdd %6 %72 %15 + OpStore %8 %73 + %74 = OpLoad %6 %18 + %75 = OpAccessChain %17 %14 %74 + %76 = OpLoad %6 %75 + %77 = OpLoad %6 %27 + %78 = OpAccessChain %17 %14 %77 + %79 = OpLoad %6 %78 + %80 = OpSLessThan %43 %76 %79 + OpSelectionMerge %82 None + OpBranchConditional %80 %81 %85 + %81 = OpLabel + %83 = OpLoad %6 %18 + %84 = OpIAdd %6 %83 %15 + OpStore %18 %84 + OpBranch %82 + %85 = OpLabel + %93 = OpAccessChain %92 %90 %9 %91 + %94 = OpLoad %30 %93 + %96 = OpAccessChain %92 %90 %9 %95 + %97 = OpLoad %30 %96 + %99 = OpAccessChain %92 %90 %9 %98 + %100 = OpLoad %30 %99 + %101 = OpAccessChain %92 %90 %9 %9 + %102 = OpLoad %30 %101 + %103 = OpCompositeConstruct %31 %94 %97 %100 %102 + OpStore %33 %103 + %104 = OpLoad %6 %27 + %105 = OpIAdd %6 %104 %15 + OpStore %27 %105 + OpBranch %82 + %82 = OpLabel + OpBranch %65 + %65 = OpLabel + %106 = OpLoad %6 %61 + %107 = OpISub %6 %106 %15 + OpStore %61 %107 + OpBranch %62 + %64 = OpLabel + OpBranch %41 + %41 = OpLabel + OpBranch %38 + %40 = OpLabel + %108 = OpLoad %6 %18 + %109 = OpAccessChain %24 %23 %9 %9 + %110 = OpLoad %6 %109 + %111 = OpIEqual %43 %108 %110 + OpSelectionMerge %113 None + OpBranchConditional %111 %112 %113 + %112 = OpLabel + %114 = OpLoad %6 %27 + %115 = OpAccessChain %24 %23 %9 %95 + %116 = OpLoad %6 %115 + %117 = OpIEqual %43 %114 %116 + OpBranch %113 + %113 = OpLabel + %118 = OpPhi %43 %111 %40 %117 %112 + OpSelectionMerge %120 None + OpBranchConditional %118 %119 %120 + %119 = OpLabel + %121 = OpAccessChain %92 %90 %9 %15 + %122 = OpLoad %30 %121 + %123 = OpAccessChain %92 %90 %9 %95 + %124 = OpLoad %30 %123 + %125 = OpAccessChain %92 %90 %9 %98 + %126 = OpLoad %30 %125 + %128 = OpAccessChain %92 %90 %9 %127 + %129 = OpLoad %30 %128 + %130 = OpCompositeConstruct %31 %122 %124 %126 %129 + %131 = OpLoad %31 %33 + %132 = OpFSub %31 %131 %130 + OpStore %33 %132 + OpBranch %120 + %120 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 9967.043 5.4 214.06 63.98 9966.043 6.4 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-increase-integer-dot-product.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-increase-integer-dot-product.amber new file mode 100644 index 0000000..f06af1b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-increase-integer-dot-product.amber @@ -0,0 +1,272 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 1; +# +# // After this loop a becomes 6. +# do +# { +# _GLF_global_loop_count ++; +# +# // Iterated once. +# do +# { +# _GLF_global_loop_count ++; +# a++; +# } +# while((gl_FragCoord.y < _float_0_0) && (_GLF_global_loop_count < _GLF_global_loop_bound)); +# } +# while((a != 1) && (_GLF_global_loop_count < _GLF_global_loop_bound)); +# +# // (1, a + 1) dot (1, 1) = 1 * 1 + (a + 1) * 1 = 1 + a + 1 = a + 2 = 6 + 2 = 8 +# float f = dot(vec2(1, a +_int_1), vec2(_int_1)); +# if(f > 7.9 && f < 8.1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 104 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %30 %85 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %11 "a" + OpName %30 "gl_FragCoord" + OpName %37 "buf0" + OpMemberName %37 0 "_GLF_uniform_float_values" + OpName %39 "" + OpName %55 "f" + OpName %60 "buf1" + OpMemberName %60 0 "_GLF_uniform_int_values" + OpName %62 "" + OpName %85 "_GLF_color" + OpDecorate %30 BuiltIn FragCoord + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 0 + OpDecorate %59 ArrayStride 16 + OpMemberDecorate %60 0 Offset 0 + OpDecorate %60 Block + OpDecorate %62 DescriptorSet 0 + OpDecorate %62 Binding 1 + OpDecorate %85 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 1 + %27 = OpTypeFloat 32 + %28 = OpTypeVector %27 4 + %29 = OpTypePointer Input %28 + %30 = OpVariable %29 Input + %31 = OpTypeInt 32 0 + %32 = OpConstant %31 1 + %33 = OpTypePointer Input %27 + %36 = OpTypeArray %27 %32 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %27 + %43 = OpTypeBool + %46 = OpConstant %6 10 + %54 = OpTypePointer Function %27 + %56 = OpConstant %27 1 + %58 = OpConstant %31 2 + %59 = OpTypeArray %6 %58 + %60 = OpTypeStruct %59 + %61 = OpTypePointer Uniform %60 + %62 = OpVariable %61 Uniform + %63 = OpTypePointer Uniform %6 + %68 = OpTypeVector %27 2 + %76 = OpConstant %27 7.9000001 + %79 = OpConstant %27 8.10000038 + %84 = OpTypePointer Output %28 + %85 = OpVariable %84 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %55 = OpVariable %54 Function + OpStore %8 %9 + OpStore %11 %12 + OpBranch %13 + %13 = OpLabel + OpLoopMerge %15 %16 None + OpBranch %14 + %14 = OpLabel + %17 = OpLoad %6 %8 + %18 = OpIAdd %6 %17 %12 + OpStore %8 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %20 + %20 = OpLabel + %23 = OpLoad %6 %8 + %24 = OpIAdd %6 %23 %12 + OpStore %8 %24 + %25 = OpLoad %6 %11 + %26 = OpIAdd %6 %25 %12 + OpStore %11 %26 + OpBranch %22 + %22 = OpLabel + %34 = OpAccessChain %33 %30 %32 + %35 = OpLoad %27 %34 + %41 = OpAccessChain %40 %39 %9 %9 + %42 = OpLoad %27 %41 + %44 = OpFOrdLessThan %43 %35 %42 + %45 = OpLoad %6 %8 + %47 = OpSLessThan %43 %45 %46 + %48 = OpLogicalAnd %43 %44 %47 + OpBranchConditional %48 %19 %21 + %21 = OpLabel + OpBranch %16 + %16 = OpLabel + %49 = OpLoad %6 %11 + %50 = OpINotEqual %43 %49 %12 + %51 = OpLoad %6 %8 + %52 = OpSLessThan %43 %51 %46 + %53 = OpLogicalAnd %43 %50 %52 + OpBranchConditional %53 %13 %15 + %15 = OpLabel + %57 = OpLoad %6 %11 + %64 = OpAccessChain %63 %62 %9 %9 + %65 = OpLoad %6 %64 + %66 = OpIAdd %6 %57 %65 + %67 = OpConvertSToF %27 %66 + %69 = OpCompositeConstruct %68 %56 %67 + %70 = OpAccessChain %63 %62 %9 %9 + %71 = OpLoad %6 %70 + %72 = OpConvertSToF %27 %71 + %73 = OpCompositeConstruct %68 %72 %72 + %74 = OpDot %27 %69 %73 + OpStore %55 %74 + %75 = OpLoad %27 %55 + %77 = OpFOrdGreaterThan %43 %75 %76 + %78 = OpLoad %27 %55 + %80 = OpFOrdLessThan %43 %78 %79 + %81 = OpLogicalAnd %43 %77 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %99 + %82 = OpLabel + %86 = OpAccessChain %63 %62 %9 %9 + %87 = OpLoad %6 %86 + %88 = OpConvertSToF %27 %87 + %89 = OpAccessChain %63 %62 %9 %12 + %90 = OpLoad %6 %89 + %91 = OpConvertSToF %27 %90 + %92 = OpAccessChain %63 %62 %9 %12 + %93 = OpLoad %6 %92 + %94 = OpConvertSToF %27 %93 + %95 = OpAccessChain %63 %62 %9 %9 + %96 = OpLoad %6 %95 + %97 = OpConvertSToF %27 %96 + %98 = OpCompositeConstruct %28 %88 %91 %94 %97 + OpStore %85 %98 + OpBranch %83 + %99 = OpLabel + %100 = OpAccessChain %63 %62 %9 %12 + %101 = OpLoad %6 %100 + %102 = OpConvertSToF %27 %101 + %103 = OpCompositeConstruct %28 %102 %102 %102 %102 + OpStore %85 %103 + OpBranch %83 + %83 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-inner-loop-min-copy-array-elements.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-inner-loop-min-copy-array-elements.amber new file mode 100644 index 0000000..7a74678 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-inner-loop-min-copy-array-elements.amber @@ -0,0 +1,311 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _int_3 _GLF_uniform_int_values[4] +# #define _int_4 _GLF_uniform_int_values[5] +# #define _int_5 _GLF_uniform_int_values[6] +# #define _int_6 _GLF_uniform_int_values[7] +# #define _int_7 _GLF_uniform_int_values[8] +# #define _int_8 _GLF_uniform_int_values[9] +# #define _int_9 _GLF_uniform_int_values[10] +# #define _int_11 _GLF_uniform_int_values[11] +# #define _int_12 _GLF_uniform_int_values[12] +# #define _int_13 _GLF_uniform_int_values[13] +# #define _int_14 _GLF_uniform_int_values[14] +# #define _int_15 _GLF_uniform_int_values[15] +# #define _int_16 _GLF_uniform_int_values[16] +# #define _int_17 _GLF_uniform_int_values[17] +# #define _int_18 _GLF_uniform_int_values[18] +# #define _int_19 _GLF_uniform_int_values[19] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [10, 1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[20]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int data0[10] = int[10](_int_0, _int_1, _int_2, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9); +# int data1[10] = int[10](_int_10, _int_11, _int_12, _int_13, _int_14, _int_15, _int_16, _int_17, _int_18, _int_19); +# +# data1[_int_1] = data0[_int_1]; +# +# for(int i = _int_2; i < _int_10; i += _int_2) +# { +# for(int j = _int_1; j < _int_10; j += (i / _int_2)) +# { +# // Iterates once with k = j if j <= 5. +# for(int k = j; k <= min(j, 5); k ++) +# { +# data0[k] = data1[k]; +# } +# } +# } +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Compare against reference values and set output to black if failed. +# int ref[10] = int[10](_int_0, _int_1, _int_12, _int_13, _int_14, _int_15, _int_6, _int_7, _int_8, _int_9); +# +# for(int i = _int_0; i < _int_10; i ++) +# { +# if(data0[i] != ref[i]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 214 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %145 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "data0" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %50 "data1" + OpName %145 "_GLF_color" + OpName %159 "ref" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %145 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 20 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 2 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 1 + %25 = OpConstant %6 3 + %28 = OpConstant %6 4 + %31 = OpConstant %6 5 + %34 = OpConstant %6 6 + %37 = OpConstant %6 7 + %40 = OpConstant %6 8 + %43 = OpConstant %6 9 + %46 = OpConstant %6 10 + %53 = OpConstant %6 11 + %56 = OpConstant %6 12 + %59 = OpConstant %6 13 + %62 = OpConstant %6 14 + %65 = OpConstant %6 15 + %68 = OpConstant %6 16 + %71 = OpConstant %6 17 + %74 = OpConstant %6 18 + %77 = OpConstant %6 19 + %85 = OpTypePointer Function %6 + %100 = OpTypeBool + %142 = OpTypeFloat 32 + %143 = OpTypeVector %142 4 + %144 = OpTypePointer Output %143 + %145 = OpVariable %144 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %50 = OpVariable %10 Function + %159 = OpVariable %10 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %19 %16 %17 %22 + %24 = OpLoad %6 %23 + %26 = OpAccessChain %19 %16 %17 %25 + %27 = OpLoad %6 %26 + %29 = OpAccessChain %19 %16 %17 %28 + %30 = OpLoad %6 %29 + %32 = OpAccessChain %19 %16 %17 %31 + %33 = OpLoad %6 %32 + %35 = OpAccessChain %19 %16 %17 %34 + %36 = OpLoad %6 %35 + %38 = OpAccessChain %19 %16 %17 %37 + %39 = OpLoad %6 %38 + %41 = OpAccessChain %19 %16 %17 %40 + %42 = OpLoad %6 %41 + %44 = OpAccessChain %19 %16 %17 %43 + %45 = OpLoad %6 %44 + %47 = OpAccessChain %19 %16 %17 %46 + %48 = OpLoad %6 %47 + %49 = OpCompositeConstruct %9 %21 %24 %27 %30 %33 %36 %39 %42 %45 %48 + OpStore %11 %49 + %51 = OpAccessChain %19 %16 %17 %17 + %52 = OpLoad %6 %51 + %54 = OpAccessChain %19 %16 %17 %53 + %55 = OpLoad %6 %54 + %57 = OpAccessChain %19 %16 %17 %56 + %58 = OpLoad %6 %57 + %60 = OpAccessChain %19 %16 %17 %59 + %61 = OpLoad %6 %60 + %63 = OpAccessChain %19 %16 %17 %62 + %64 = OpLoad %6 %63 + %66 = OpAccessChain %19 %16 %17 %65 + %67 = OpLoad %6 %66 + %69 = OpAccessChain %19 %16 %17 %68 + %70 = OpLoad %6 %69 + %72 = OpAccessChain %19 %16 %17 %71 + %73 = OpLoad %6 %72 + %75 = OpAccessChain %19 %16 %17 %74 + %76 = OpLoad %6 %75 + %78 = OpAccessChain %19 %16 %17 %77 + %79 = OpLoad %6 %78 + %80 = OpCompositeConstruct %9 %52 %55 %58 %61 %64 %67 %70 %73 %76 %79 + OpStore %50 %80 + %86 = OpAccessChain %85 %11 %24 + %87 = OpLoad %6 %86 + %88 = OpAccessChain %85 %50 %24 + OpStore %88 %87 + OpBranch %92 + %92 = OpLabel + %208 = OpPhi %6 %27 %5 %141 %95 + %101 = OpSLessThan %100 %208 %52 + OpLoopMerge %94 %95 None + OpBranchConditional %101 %93 %94 + %93 = OpLabel + OpBranch %105 + %105 = OpLabel + %211 = OpPhi %6 %24 %93 %137 %108 + %113 = OpSLessThan %100 %211 %52 + OpLoopMerge %107 %108 None + OpBranchConditional %113 %106 %107 + %106 = OpLabel + OpBranch %116 + %116 = OpLabel + %213 = OpPhi %6 %211 %106 %131 %117 + %123 = OpExtInst %6 %1 SMin %211 %31 + %124 = OpSLessThanEqual %100 %213 %123 + OpLoopMerge %118 %117 None + OpBranchConditional %124 %117 %118 + %117 = OpLabel + %127 = OpAccessChain %85 %50 %213 + %128 = OpLoad %6 %127 + %129 = OpAccessChain %85 %11 %213 + OpStore %129 %128 + %131 = OpIAdd %6 %213 %22 + OpBranch %116 + %118 = OpLabel + OpBranch %108 + %108 = OpLabel + %135 = OpSDiv %6 %208 %27 + %137 = OpIAdd %6 %211 %135 + OpBranch %105 + %107 = OpLabel + OpBranch %95 + %95 = OpLabel + %141 = OpIAdd %6 %208 %27 + OpBranch %92 + %94 = OpLabel + %148 = OpConvertSToF %142 %24 + %151 = OpConvertSToF %142 %21 + %158 = OpCompositeConstruct %143 %148 %151 %151 %148 + OpStore %145 %158 + %180 = OpCompositeConstruct %9 %21 %24 %58 %61 %64 %67 %39 %42 %45 %48 + OpStore %159 %180 + OpBranch %184 + %184 = OpLabel + %209 = OpPhi %6 %21 %94 %207 %187 + %192 = OpSLessThan %100 %209 %52 + OpLoopMerge %186 %187 None + OpBranchConditional %192 %185 %186 + %185 = OpLabel + %194 = OpAccessChain %85 %11 %209 + %195 = OpLoad %6 %194 + %197 = OpAccessChain %85 %159 %209 + %198 = OpLoad %6 %197 + %199 = OpINotEqual %100 %195 %198 + OpSelectionMerge %201 None + OpBranchConditional %199 %200 %201 + %200 = OpLabel + %205 = OpCompositeConstruct %143 %151 %151 %151 %151 + OpStore %145 %205 + OpBranch %201 + %201 = OpLabel + OpBranch %187 + %187 = OpLabel + %207 = OpIAdd %6 %209 %22 + OpBranch %184 + %186 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 1 0 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-iterator-times-two-while-min.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-iterator-times-two-while-min.amber new file mode 100644 index 0000000..06b6441 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-iterator-times-two-while-min.amber @@ -0,0 +1,256 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_8 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [8, 0, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# // Contents of two: 2 +# layout(push_constant) uniform buf_push +# { +# int two; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# // Iterates once. +# for(int i = _int_1; _GLF_global_loop_count < _GLF_global_loop_bound; i *= _int_2) +# { +# _GLF_global_loop_count++; +# +# // Iterates until the global loop bound is reached. The first condition is always true because i = 1. +# while(min(i - 1, two) >= 1 && _GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# a++; +# } +# } +# +# // Always true. +# if(a == _int_8) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 92 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %73 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %11 "a" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %22 "i" + OpName %44 "buf_push" + OpMemberName %44 0 "two" + OpName %46 "" + OpName %73 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpMemberDecorate %44 0 Offset 0 + OpDecorate %44 Block + OpDecorate %73 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 4 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 1 + %19 = OpTypePointer Uniform %6 + %23 = OpConstant %6 2 + %32 = OpConstant %6 10 + %33 = OpTypeBool + %44 = OpTypeStruct %6 + %45 = OpTypePointer PushConstant %44 + %46 = OpVariable %45 PushConstant + %47 = OpTypePointer PushConstant %6 + %59 = OpConstant %6 3 + %70 = OpTypeFloat 32 + %71 = OpTypeVector %70 4 + %72 = OpTypePointer Output %71 + %73 = OpVariable %72 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %22 = OpVariable %10 Function + OpStore %8 %9 + %20 = OpAccessChain %19 %17 %9 %18 + %21 = OpLoad %6 %20 + OpStore %11 %21 + %24 = OpAccessChain %19 %17 %9 %23 + %25 = OpLoad %6 %24 + OpStore %22 %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %6 %8 + %34 = OpSLessThan %33 %31 %32 + OpBranchConditional %34 %27 %28 + %27 = OpLabel + %35 = OpLoad %6 %8 + %36 = OpIAdd %6 %35 %18 + OpStore %8 %36 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %6 %22 + %43 = OpISub %6 %42 %18 + %48 = OpAccessChain %47 %46 %9 + %49 = OpLoad %6 %48 + %50 = OpExtInst %6 %1 SMin %43 %49 + %51 = OpSGreaterThanEqual %33 %50 %18 + %52 = OpLoad %6 %8 + %53 = OpSLessThan %33 %52 %32 + %54 = OpLogicalAnd %33 %51 %53 + OpBranchConditional %54 %38 %39 + %38 = OpLabel + %55 = OpLoad %6 %8 + %56 = OpIAdd %6 %55 %18 + OpStore %8 %56 + %57 = OpLoad %6 %11 + %58 = OpIAdd %6 %57 %18 + OpStore %11 %58 + OpBranch %40 + %40 = OpLabel + OpBranch %37 + %39 = OpLabel + OpBranch %29 + %29 = OpLabel + %60 = OpAccessChain %19 %17 %9 %59 + %61 = OpLoad %6 %60 + %62 = OpLoad %6 %22 + %63 = OpIMul %6 %62 %61 + OpStore %22 %63 + OpBranch %26 + %28 = OpLabel + %64 = OpLoad %6 %11 + %65 = OpAccessChain %19 %17 %9 %9 + %66 = OpLoad %6 %65 + %67 = OpIEqual %33 %64 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %87 + %68 = OpLabel + %74 = OpAccessChain %19 %17 %9 %23 + %75 = OpLoad %6 %74 + %76 = OpConvertSToF %70 %75 + %77 = OpAccessChain %19 %17 %9 %18 + %78 = OpLoad %6 %77 + %79 = OpConvertSToF %70 %78 + %80 = OpAccessChain %19 %17 %9 %18 + %81 = OpLoad %6 %80 + %82 = OpConvertSToF %70 %81 + %83 = OpAccessChain %19 %17 %9 %23 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %70 %84 + %86 = OpCompositeConstruct %71 %76 %79 %82 %85 + OpStore %73 %86 + OpBranch %69 + %87 = OpLabel + %88 = OpAccessChain %19 %17 %9 %18 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %70 %89 + %91 = OpCompositeConstruct %71 %90 %90 %90 %90 + OpStore %73 %91 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE int32 STD140 DATA + 2 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 8 0 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-never-change-array-element-one.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-never-change-array-element-one.amber new file mode 100644 index 0000000..866d5e0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-never-change-array-element-one.amber @@ -0,0 +1,344 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_8 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 8] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of one: 1.0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# float one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[10] = int[10](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1); +# +# for(int i = 1; i < 10; i++) +# { +# if(i != 1) +# { +# // Iterated once. +# do +# { +# if(i != 7) +# { +# // Iterated once. +# do +# { +# if(i == 8) +# { +# arr[i] = _int_0; +# } +# } +# while(_float_0_0 > one); +# } +# } +# while(_float_0_0 > one); +# } +# } +# +# // Always true. +# if(arr[_int_1] == _int_1 && arr[_int_8] == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# discard; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 138 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %122 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %41 "i" + OpName %81 "buf0" + OpMemberName %81 0 "_GLF_uniform_float_values" + OpName %83 "" + OpName %87 "buf2" + OpMemberName %87 0 "one" + OpName %89 "" + OpName %122 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %80 ArrayStride 16 + OpMemberDecorate %81 0 Offset 0 + OpDecorate %81 Block + OpDecorate %83 DescriptorSet 0 + OpDecorate %83 Binding 0 + OpMemberDecorate %87 0 Offset 0 + OpDecorate %87 Block + OpDecorate %89 DescriptorSet 0 + OpDecorate %89 Binding 2 + OpDecorate %122 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 3 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpTypePointer Uniform %6 + %40 = OpTypePointer Function %6 + %42 = OpConstant %6 1 + %49 = OpConstant %6 10 + %50 = OpTypeBool + %61 = OpConstant %6 7 + %70 = OpConstant %6 8 + %78 = OpTypeFloat 32 + %79 = OpConstant %7 1 + %80 = OpTypeArray %78 %79 + %81 = OpTypeStruct %80 + %82 = OpTypePointer Uniform %81 + %83 = OpVariable %82 Uniform + %84 = OpTypePointer Uniform %78 + %87 = OpTypeStruct %78 + %88 = OpTypePointer Uniform %87 + %89 = OpVariable %88 Uniform + %109 = OpConstant %6 2 + %120 = OpTypeVector %78 4 + %121 = OpTypePointer Output %120 + %122 = OpVariable %121 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %41 = OpVariable %40 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %6 %19 + %21 = OpAccessChain %18 %16 %17 %17 + %22 = OpLoad %6 %21 + %23 = OpAccessChain %18 %16 %17 %17 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %18 %16 %17 %17 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %18 %16 %17 %17 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %18 %16 %17 %17 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %18 %16 %17 %17 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %18 %16 %17 %17 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %18 %16 %17 %17 + %38 = OpLoad %6 %37 + %39 = OpCompositeConstruct %9 %20 %22 %24 %26 %28 %30 %32 %34 %36 %38 + OpStore %11 %39 + OpStore %41 %42 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %6 %41 + %51 = OpSLessThan %50 %48 %49 + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %52 = OpLoad %6 %41 + %53 = OpINotEqual %50 %52 %42 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %55 + %54 = OpLabel + OpBranch %56 + %56 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %57 + %57 = OpLabel + %60 = OpLoad %6 %41 + %62 = OpINotEqual %50 %60 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %64 + %63 = OpLabel + OpBranch %65 + %65 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %66 + %66 = OpLabel + %69 = OpLoad %6 %41 + %71 = OpIEqual %50 %69 %70 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %73 + %72 = OpLabel + %74 = OpLoad %6 %41 + %75 = OpAccessChain %18 %16 %17 %42 + %76 = OpLoad %6 %75 + %77 = OpAccessChain %40 %11 %74 + OpStore %77 %76 + OpBranch %73 + %73 = OpLabel + OpBranch %68 + %68 = OpLabel + %85 = OpAccessChain %84 %83 %17 %17 + %86 = OpLoad %78 %85 + %90 = OpAccessChain %84 %89 %17 + %91 = OpLoad %78 %90 + %92 = OpFOrdGreaterThan %50 %86 %91 + OpBranchConditional %92 %65 %67 + %67 = OpLabel + OpBranch %64 + %64 = OpLabel + OpBranch %59 + %59 = OpLabel + %93 = OpAccessChain %84 %83 %17 %17 + %94 = OpLoad %78 %93 + %95 = OpAccessChain %84 %89 %17 + %96 = OpLoad %78 %95 + %97 = OpFOrdGreaterThan %50 %94 %96 + OpBranchConditional %97 %56 %58 + %58 = OpLabel + OpBranch %55 + %55 = OpLabel + OpBranch %46 + %46 = OpLabel + %98 = OpLoad %6 %41 + %99 = OpIAdd %6 %98 %42 + OpStore %41 %99 + OpBranch %43 + %45 = OpLabel + %100 = OpAccessChain %18 %16 %17 %17 + %101 = OpLoad %6 %100 + %102 = OpAccessChain %40 %11 %101 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %18 %16 %17 %17 + %105 = OpLoad %6 %104 + %106 = OpIEqual %50 %103 %105 + OpSelectionMerge %108 None + OpBranchConditional %106 %107 %108 + %107 = OpLabel + %110 = OpAccessChain %18 %16 %17 %109 + %111 = OpLoad %6 %110 + %112 = OpAccessChain %40 %11 %111 + %113 = OpLoad %6 %112 + %114 = OpAccessChain %18 %16 %17 %42 + %115 = OpLoad %6 %114 + %116 = OpIEqual %50 %113 %115 + OpBranch %108 + %108 = OpLabel + %117 = OpPhi %50 %106 %45 %116 %107 + OpSelectionMerge %119 None + OpBranchConditional %117 %118 %136 + %118 = OpLabel + %123 = OpAccessChain %18 %16 %17 %17 + %124 = OpLoad %6 %123 + %125 = OpConvertSToF %78 %124 + %126 = OpAccessChain %18 %16 %17 %42 + %127 = OpLoad %6 %126 + %128 = OpConvertSToF %78 %127 + %129 = OpAccessChain %18 %16 %17 %42 + %130 = OpLoad %6 %129 + %131 = OpConvertSToF %78 %130 + %132 = OpAccessChain %18 %16 %17 %17 + %133 = OpLoad %6 %132 + %134 = OpConvertSToF %78 %133 + %135 = OpCompositeConstruct %120 %125 %128 %131 %134 + OpStore %122 %135 + OpBranch %119 + %136 = OpLabel + OpTerminateInvocation + %119 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 8 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-redundant-condition.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-redundant-condition.amber new file mode 100644 index 0000000..997f02c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-redundant-condition.amber @@ -0,0 +1,289 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_5 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 5, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# vec2 injectionSwitch; +# }; +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# } +# else +# { +# // Always true. +# if(gl_FragCoord.x >= _float_0_0) +# { +# _GLF_color = vec4(_float_1_0); +# } +# +# for(int i = _int_0; i < _int_5; i++) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, 1); +# +# // Always true. +# if(gl_FragCoord.y >= _float_0_0) +# { +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# { +# _GLF_color = vec4(0); +# } +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 101 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %40 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %24 "buf2" + OpMemberName %24 0 "injectionSwitch" + OpName %26 "" + OpName %40 "gl_FragCoord" + OpName %46 "buf0" + OpMemberName %46 0 "_GLF_uniform_float_values" + OpName %48 "" + OpName %59 "i" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 2 + OpDecorate %40 BuiltIn FragCoord + OpDecorate %45 ArrayStride 16 + OpMemberDecorate %46 0 Offset 0 + OpDecorate %46 Block + OpDecorate %48 DescriptorSet 0 + OpDecorate %48 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 3 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %23 = OpTypeVector %6 2 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpConstant %11 0 + %28 = OpTypePointer Uniform %6 + %31 = OpConstant %11 1 + %34 = OpTypeBool + %39 = OpTypePointer Input %7 + %40 = OpVariable %39 Input + %41 = OpTypePointer Input %6 + %44 = OpConstant %11 2 + %45 = OpTypeArray %6 %44 + %46 = OpTypeStruct %45 + %47 = OpTypePointer Uniform %46 + %48 = OpVariable %47 Uniform + %54 = OpConstant %10 1 + %58 = OpTypePointer Function %10 + %71 = OpConstant %10 2 + %81 = OpConstant %6 1 + %97 = OpConstant %6 0 + %98 = OpConstantComposite %7 %97 %97 %97 %97 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %59 = OpVariable %58 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %22 = OpCompositeConstruct %7 %21 %21 %21 %21 + OpStore %9 %22 + %29 = OpAccessChain %28 %26 %17 %27 + %30 = OpLoad %6 %29 + %32 = OpAccessChain %28 %26 %17 %31 + %33 = OpLoad %6 %32 + %35 = OpFOrdGreaterThan %34 %30 %33 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %38 + %36 = OpLabel + OpBranch %37 + %38 = OpLabel + %42 = OpAccessChain %41 %40 %27 + %43 = OpLoad %6 %42 + %49 = OpAccessChain %28 %48 %17 %17 + %50 = OpLoad %6 %49 + %51 = OpFOrdGreaterThanEqual %34 %43 %50 + OpSelectionMerge %53 None + OpBranchConditional %51 %52 %53 + %52 = OpLabel + %55 = OpAccessChain %28 %48 %17 %54 + %56 = OpLoad %6 %55 + %57 = OpCompositeConstruct %7 %56 %56 %56 %56 + OpStore %9 %57 + OpBranch %53 + %53 = OpLabel + %60 = OpAccessChain %18 %16 %17 %17 + %61 = OpLoad %10 %60 + OpStore %59 %61 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpLoad %10 %59 + %68 = OpAccessChain %18 %16 %17 %54 + %69 = OpLoad %10 %68 + %70 = OpSLessThan %34 %67 %69 + OpBranchConditional %70 %63 %64 + %63 = OpLabel + %72 = OpAccessChain %18 %16 %17 %71 + %73 = OpLoad %10 %72 + %74 = OpConvertSToF %6 %73 + %75 = OpAccessChain %18 %16 %17 %17 + %76 = OpLoad %10 %75 + %77 = OpConvertSToF %6 %76 + %78 = OpAccessChain %18 %16 %17 %17 + %79 = OpLoad %10 %78 + %80 = OpConvertSToF %6 %79 + %82 = OpCompositeConstruct %7 %74 %77 %80 %81 + OpStore %9 %82 + %83 = OpAccessChain %41 %40 %31 + %84 = OpLoad %6 %83 + %85 = OpAccessChain %28 %48 %17 %17 + %86 = OpLoad %6 %85 + %87 = OpFOrdGreaterThanEqual %34 %84 %86 + OpSelectionMerge %89 None + OpBranchConditional %87 %88 %89 + %88 = OpLabel + %90 = OpAccessChain %28 %26 %17 %27 + %91 = OpLoad %6 %90 + %92 = OpAccessChain %28 %26 %17 %31 + %93 = OpLoad %6 %92 + %94 = OpFOrdGreaterThan %34 %91 %93 + OpSelectionMerge %96 None + OpBranchConditional %94 %95 %96 + %95 = OpLabel + OpStore %9 %98 + OpBranch %96 + %96 = OpLabel + OpBranch %89 + %89 = OpLabel + OpBranch %65 + %65 = OpLabel + %99 = OpLoad %10 %59 + %100 = OpIAdd %10 %99 %54 + OpStore %59 %100 + OpBranch %62 + %64 = OpLabel + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 5 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-return-inside-while-never-executed.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-return-inside-while-never-executed.amber new file mode 100644 index 0000000..76c61b3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-return-inside-while-never-executed.amber @@ -0,0 +1,230 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# +# // Iterates once with i = 1. +# for(int i = 1; i <= 1; i *= 2) +# { +# // Iterates once with j = 0. +# for(int j = 0; j < 1; j += 2 * i) +# { +# // k = 1 + 0 + 1 = 2 +# int k = i + j + 1; +# +# // Never iterates. +# while((j + i) >= _int_1 && k <= min(j + 2 * i, 1)) +# { +# return; +# } +# } +# } +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 89 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %25 "i" + OpName %34 "j" + OpName %42 "k" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpConstant %10 1 + %19 = OpTypePointer Uniform %10 + %24 = OpTypePointer Function %10 + %32 = OpTypeBool + %62 = OpConstant %10 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %25 = OpVariable %24 Function + %34 = OpVariable %24 Function + %42 = OpVariable %24 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %10 %20 + %22 = OpConvertSToF %6 %21 + %23 = OpCompositeConstruct %7 %22 %22 %22 %22 + OpStore %9 %23 + OpStore %25 %18 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %10 %25 + %33 = OpSLessThanEqual %32 %31 %18 + OpBranchConditional %33 %27 %28 + %27 = OpLabel + OpStore %34 %17 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %10 %34 + %41 = OpSLessThan %32 %40 %18 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %43 = OpLoad %10 %25 + %44 = OpLoad %10 %34 + %45 = OpIAdd %10 %43 %44 + %46 = OpIAdd %10 %45 %18 + OpStore %42 %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %10 %34 + %53 = OpLoad %10 %25 + %54 = OpIAdd %10 %52 %53 + %55 = OpAccessChain %19 %16 %17 %17 + %56 = OpLoad %10 %55 + %57 = OpSGreaterThanEqual %32 %54 %56 + OpSelectionMerge %59 None + OpBranchConditional %57 %58 %59 + %58 = OpLabel + %60 = OpLoad %10 %42 + %61 = OpLoad %10 %34 + %63 = OpLoad %10 %25 + %64 = OpIMul %10 %62 %63 + %65 = OpIAdd %10 %61 %64 + %66 = OpExtInst %10 %1 SMin %65 %18 + %67 = OpSLessThanEqual %32 %60 %66 + OpBranch %59 + %59 = OpLabel + %68 = OpPhi %32 %57 %51 %67 %58 + OpBranchConditional %68 %48 %49 + %48 = OpLabel + OpReturn + %50 = OpLabel + OpBranch %47 + %49 = OpLabel + OpBranch %38 + %38 = OpLabel + %70 = OpLoad %10 %25 + %71 = OpIMul %10 %62 %70 + %72 = OpLoad %10 %34 + %73 = OpIAdd %10 %72 %71 + OpStore %34 %73 + OpBranch %35 + %37 = OpLabel + OpBranch %29 + %29 = OpLabel + %74 = OpLoad %10 %25 + %75 = OpIMul %10 %74 %62 + OpStore %25 %75 + OpBranch %26 + %28 = OpLabel + %76 = OpAccessChain %19 %16 %17 %17 + %77 = OpLoad %10 %76 + %78 = OpConvertSToF %6 %77 + %79 = OpAccessChain %19 %16 %17 %18 + %80 = OpLoad %10 %79 + %81 = OpConvertSToF %6 %80 + %82 = OpAccessChain %19 %16 %17 %18 + %83 = OpLoad %10 %82 + %84 = OpConvertSToF %6 %83 + %85 = OpAccessChain %19 %16 %17 %17 + %86 = OpLoad %10 %85 + %87 = OpConvertSToF %6 %86 + %88 = OpCompositeConstruct %7 %78 %81 %84 %87 + OpStore %9 %88 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-sample-opposite-corners.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-sample-opposite-corners.amber new file mode 100644 index 0000000..c4777f0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-sample-opposite-corners.amber @@ -0,0 +1,578 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_4 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_255_0 _GLF_uniform_float_values[2] +# #define _float_256_0 _GLF_uniform_float_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0, 255.0, 256.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[4]; +# }; +# // Contents of _GLF_uniform_int_values: [0, 1, 4] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# // Contents of one: 1.0 +# layout(push_constant) uniform buf_push +# { +# float one; +# }; +# +# layout(set = 0, binding = 2) uniform sampler2D tex; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 coord = vec2(_float_0_0); +# vec4 texel = texture(tex, coord); +# _GLF_color = vec4(_int_0); +# +# for(int i = _int_0; i < int(one); i++) +# { +# // Texture has a red channel that changes from zero to one in u direction. +# // The first time it's sampled from u = 0 which gives a value of zero. +# // The second time the sampled location has chaned to the other edge +# // where it samples 1.0 and therefore exits the loop. +# while(texel.x < _float_1_0) +# { +# for(int i = _int_0; i < _int_1; i ++) +# { +# // Always true. +# if(gl_FragCoord.y > _float_0_0) +# { +# } +# else +# { +# // This branch is never executed. +# for(int i = _int_1; i > _int_0; i--) +# { +# for(int i = _int_0; i != _int_1; i++) +# { +# for(int i = _int_0; i < int(one); i++) +# { +# if(gl_FragCoord.y > _float_0_0) +# { +# } +# else +# { +# coord = vec2(_float_1_0); +# } +# } +# } +# } +# } +# } +# +# // Jump to the opposite corner of the texture where +# // it will sample 1.0 for the red channel. +# coord = coord + _float_255_0 / _float_256_0; +# for(int i = _int_0; i < _int_1; i ++) +# { +# for(int i = _int_1; i != _int_0; i --) +# { +# texel = texture(tex, coord); +# _GLF_color = vec4(texel.x, _int_0, _int_0, _int_1); +# } +# } +# +# // This does nothing. +# for(int i = _int_0; i < _int_1; i ++) +# { +# for(int i = _int_0; i != _int_1; i ++) +# { +# } +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 239 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 %89 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "coord" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %24 "texel" + OpName %28 "tex" + OpName %33 "_GLF_color" + OpName %36 "buf1" + OpMemberName %36 0 "_GLF_uniform_int_values" + OpName %38 "" + OpName %45 "i" + OpName %54 "buf_push" + OpMemberName %54 0 "one" + OpName %56 "" + OpName %76 "i" + OpName %89 "gl_FragCoord" + OpName %100 "i" + OpName %112 "i" + OpName %124 "i" + OpName %166 "i" + OpName %178 "i" + OpName %209 "i" + OpName %221 "i" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %28 RelaxedPrecision + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 2 + OpDecorate %29 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %33 Location 0 + OpDecorate %35 ArrayStride 16 + OpMemberDecorate %36 0 Offset 0 + OpDecorate %36 Block + OpDecorate %38 DescriptorSet 0 + OpDecorate %38 Binding 1 + OpMemberDecorate %54 0 Offset 0 + OpDecorate %54 Block + OpDecorate %89 BuiltIn FragCoord + OpDecorate %190 RelaxedPrecision + OpDecorate %192 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 4 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %6 + %22 = OpTypeVector %6 4 + %23 = OpTypePointer Function %22 + %25 = OpTypeImage %6 2D 0 0 0 1 Unknown + %26 = OpTypeSampledImage %25 + %27 = OpTypePointer UniformConstant %26 + %28 = OpVariable %27 UniformConstant + %32 = OpTypePointer Output %22 + %33 = OpVariable %32 Output + %34 = OpConstant %10 3 + %35 = OpTypeArray %16 %34 + %36 = OpTypeStruct %35 + %37 = OpTypePointer Uniform %36 + %38 = OpVariable %37 Uniform + %39 = OpTypePointer Uniform %16 + %44 = OpTypePointer Function %16 + %54 = OpTypeStruct %6 + %55 = OpTypePointer PushConstant %54 + %56 = OpVariable %55 PushConstant + %57 = OpTypePointer PushConstant %6 + %61 = OpTypeBool + %68 = OpConstant %10 0 + %69 = OpTypePointer Function %6 + %72 = OpConstant %16 1 + %88 = OpTypePointer Input %22 + %89 = OpVariable %88 Input + %90 = OpConstant %10 1 + %91 = OpTypePointer Input %6 + %157 = OpConstant %16 2 + %160 = OpConstant %16 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %24 = OpVariable %23 Function + %45 = OpVariable %44 Function + %76 = OpVariable %44 Function + %100 = OpVariable %44 Function + %112 = OpVariable %44 Function + %124 = OpVariable %44 Function + %166 = OpVariable %44 Function + %178 = OpVariable %44 Function + %209 = OpVariable %44 Function + %221 = OpVariable %44 Function + %19 = OpAccessChain %18 %15 %17 %17 + %20 = OpLoad %6 %19 + %21 = OpCompositeConstruct %7 %20 %20 + OpStore %9 %21 + %29 = OpLoad %26 %28 + %30 = OpLoad %7 %9 + %31 = OpImageSampleImplicitLod %22 %29 %30 + OpStore %24 %31 + %40 = OpAccessChain %39 %38 %17 %17 + %41 = OpLoad %16 %40 + %42 = OpConvertSToF %6 %41 + %43 = OpCompositeConstruct %22 %42 %42 %42 %42 + OpStore %33 %43 + %46 = OpAccessChain %39 %38 %17 %17 + %47 = OpLoad %16 %46 + OpStore %45 %47 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %16 %45 + %58 = OpAccessChain %57 %56 %17 + %59 = OpLoad %6 %58 + %60 = OpConvertFToS %16 %59 + %62 = OpSLessThan %61 %53 %60 + OpBranchConditional %62 %49 %50 + %49 = OpLabel + OpBranch %63 + %63 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %70 = OpAccessChain %69 %24 %68 + %71 = OpLoad %6 %70 + %73 = OpAccessChain %18 %15 %17 %72 + %74 = OpLoad %6 %73 + %75 = OpFOrdLessThan %61 %71 %74 + OpBranchConditional %75 %64 %65 + %64 = OpLabel + %77 = OpAccessChain %39 %38 %17 %17 + %78 = OpLoad %16 %77 + OpStore %76 %78 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %16 %76 + %85 = OpAccessChain %39 %38 %17 %72 + %86 = OpLoad %16 %85 + %87 = OpSLessThan %61 %84 %86 + OpBranchConditional %87 %80 %81 + %80 = OpLabel + %92 = OpAccessChain %91 %89 %90 + %93 = OpLoad %6 %92 + %94 = OpAccessChain %18 %15 %17 %17 + %95 = OpLoad %6 %94 + %96 = OpFOrdGreaterThan %61 %93 %95 + OpSelectionMerge %98 None + OpBranchConditional %96 %97 %99 + %97 = OpLabel + OpBranch %98 + %99 = OpLabel + %101 = OpAccessChain %39 %38 %17 %72 + %102 = OpLoad %16 %101 + OpStore %100 %102 + OpBranch %103 + %103 = OpLabel + OpLoopMerge %105 %106 None + OpBranch %107 + %107 = OpLabel + %108 = OpLoad %16 %100 + %109 = OpAccessChain %39 %38 %17 %17 + %110 = OpLoad %16 %109 + %111 = OpSGreaterThan %61 %108 %110 + OpBranchConditional %111 %104 %105 + %104 = OpLabel + %113 = OpAccessChain %39 %38 %17 %17 + %114 = OpLoad %16 %113 + OpStore %112 %114 + OpBranch %115 + %115 = OpLabel + OpLoopMerge %117 %118 None + OpBranch %119 + %119 = OpLabel + %120 = OpLoad %16 %112 + %121 = OpAccessChain %39 %38 %17 %72 + %122 = OpLoad %16 %121 + %123 = OpINotEqual %61 %120 %122 + OpBranchConditional %123 %116 %117 + %116 = OpLabel + %125 = OpAccessChain %39 %38 %17 %17 + %126 = OpLoad %16 %125 + OpStore %124 %126 + OpBranch %127 + %127 = OpLabel + OpLoopMerge %129 %130 None + OpBranch %131 + %131 = OpLabel + %132 = OpLoad %16 %124 + %133 = OpAccessChain %57 %56 %17 + %134 = OpLoad %6 %133 + %135 = OpConvertFToS %16 %134 + %136 = OpSLessThan %61 %132 %135 + OpBranchConditional %136 %128 %129 + %128 = OpLabel + %137 = OpAccessChain %91 %89 %90 + %138 = OpLoad %6 %137 + %139 = OpAccessChain %18 %15 %17 %17 + %140 = OpLoad %6 %139 + %141 = OpFOrdGreaterThan %61 %138 %140 + OpSelectionMerge %143 None + OpBranchConditional %141 %142 %144 + %142 = OpLabel + OpBranch %143 + %144 = OpLabel + %145 = OpAccessChain %18 %15 %17 %72 + %146 = OpLoad %6 %145 + %147 = OpCompositeConstruct %7 %146 %146 + OpStore %9 %147 + OpBranch %143 + %143 = OpLabel + OpBranch %130 + %130 = OpLabel + %148 = OpLoad %16 %124 + %149 = OpIAdd %16 %148 %72 + OpStore %124 %149 + OpBranch %127 + %129 = OpLabel + OpBranch %118 + %118 = OpLabel + %150 = OpLoad %16 %112 + %151 = OpIAdd %16 %150 %72 + OpStore %112 %151 + OpBranch %115 + %117 = OpLabel + OpBranch %106 + %106 = OpLabel + %152 = OpLoad %16 %100 + %153 = OpISub %16 %152 %72 + OpStore %100 %153 + OpBranch %103 + %105 = OpLabel + OpBranch %98 + %98 = OpLabel + OpBranch %82 + %82 = OpLabel + %154 = OpLoad %16 %76 + %155 = OpIAdd %16 %154 %72 + OpStore %76 %155 + OpBranch %79 + %81 = OpLabel + %156 = OpLoad %7 %9 + %158 = OpAccessChain %18 %15 %17 %157 + %159 = OpLoad %6 %158 + %161 = OpAccessChain %18 %15 %17 %160 + %162 = OpLoad %6 %161 + %163 = OpFDiv %6 %159 %162 + %164 = OpCompositeConstruct %7 %163 %163 + %165 = OpFAdd %7 %156 %164 + OpStore %9 %165 + %167 = OpAccessChain %39 %38 %17 %17 + %168 = OpLoad %16 %167 + OpStore %166 %168 + OpBranch %169 + %169 = OpLabel + OpLoopMerge %171 %172 None + OpBranch %173 + %173 = OpLabel + %174 = OpLoad %16 %166 + %175 = OpAccessChain %39 %38 %17 %72 + %176 = OpLoad %16 %175 + %177 = OpSLessThan %61 %174 %176 + OpBranchConditional %177 %170 %171 + %170 = OpLabel + %179 = OpAccessChain %39 %38 %17 %72 + %180 = OpLoad %16 %179 + OpStore %178 %180 + OpBranch %181 + %181 = OpLabel + OpLoopMerge %183 %184 None + OpBranch %185 + %185 = OpLabel + %186 = OpLoad %16 %178 + %187 = OpAccessChain %39 %38 %17 %17 + %188 = OpLoad %16 %187 + %189 = OpINotEqual %61 %186 %188 + OpBranchConditional %189 %182 %183 + %182 = OpLabel + %190 = OpLoad %26 %28 + %191 = OpLoad %7 %9 + %192 = OpImageSampleImplicitLod %22 %190 %191 + OpStore %24 %192 + %193 = OpAccessChain %69 %24 %68 + %194 = OpLoad %6 %193 + %195 = OpAccessChain %39 %38 %17 %17 + %196 = OpLoad %16 %195 + %197 = OpConvertSToF %6 %196 + %198 = OpAccessChain %39 %38 %17 %17 + %199 = OpLoad %16 %198 + %200 = OpConvertSToF %6 %199 + %201 = OpAccessChain %39 %38 %17 %72 + %202 = OpLoad %16 %201 + %203 = OpConvertSToF %6 %202 + %204 = OpCompositeConstruct %22 %194 %197 %200 %203 + OpStore %33 %204 + OpBranch %184 + %184 = OpLabel + %205 = OpLoad %16 %178 + %206 = OpISub %16 %205 %72 + OpStore %178 %206 + OpBranch %181 + %183 = OpLabel + OpBranch %172 + %172 = OpLabel + %207 = OpLoad %16 %166 + %208 = OpIAdd %16 %207 %72 + OpStore %166 %208 + OpBranch %169 + %171 = OpLabel + %210 = OpAccessChain %39 %38 %17 %17 + %211 = OpLoad %16 %210 + OpStore %209 %211 + OpBranch %212 + %212 = OpLabel + OpLoopMerge %214 %215 None + OpBranch %216 + %216 = OpLabel + %217 = OpLoad %16 %209 + %218 = OpAccessChain %39 %38 %17 %72 + %219 = OpLoad %16 %218 + %220 = OpSLessThan %61 %217 %219 + OpBranchConditional %220 %213 %214 + %213 = OpLabel + %222 = OpAccessChain %39 %38 %17 %17 + %223 = OpLoad %16 %222 + OpStore %221 %223 + OpBranch %224 + %224 = OpLabel + OpLoopMerge %226 %227 None + OpBranch %228 + %228 = OpLabel + %229 = OpLoad %16 %221 + %230 = OpAccessChain %39 %38 %17 %72 + %231 = OpLoad %16 %230 + %232 = OpINotEqual %61 %229 %231 + OpBranchConditional %232 %225 %226 + %225 = OpLabel + OpBranch %227 + %227 = OpLabel + %233 = OpLoad %16 %221 + %234 = OpIAdd %16 %233 %72 + OpStore %221 %234 + OpBranch %224 + %226 = OpLabel + OpBranch %215 + %215 = OpLabel + %235 = OpLoad %16 %209 + %236 = OpIAdd %16 %235 %72 + OpStore %209 %236 + OpBranch %212 + %214 = OpLabel + OpBranch %66 + %66 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %51 + %51 = OpLabel + %237 = OpLoad %16 %45 + %238 = OpIAdd %16 %237 %72 + OpStore %45 %238 + OpBranch %48 + %50 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# tex +SAMPLER variant_tex + +# one +BUFFER variant_one DATA_TYPE float STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 4 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 255.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant_one AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-select-starting-value-fragcoord.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-select-starting-value-fragcoord.amber new file mode 100644 index 0000000..10fe227 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-select-starting-value-fragcoord.amber @@ -0,0 +1,312 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_5 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 5] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# // Iterates once. +# for(int i = 0; i < _int_1 && _GLF_global_loop_count < _GLF_global_loop_bound; i++) +# { +# _GLF_global_loop_count++; +# +# // Iterates once. +# for(int j = _int_1; j >= _int_1 && _GLF_global_loop_count < _GLF_global_loop_bound; j--) +# { +# _GLF_global_loop_count++; +# } +# +# // Iterates five times: k = 4..0. +# for(int k = gl_FragCoord.x < _float_0_0 ? 1 : 4; k >= i && _GLF_global_loop_count < _GLF_global_loop_bound; k--) +# { +# _GLF_global_loop_count++; +# a++; +# } +# } +# +# // Always true. +# if(a == _int_5) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 124 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %62 %105 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %11 "a" + OpName %15 "buf1" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %21 "i" + OpName %39 "j" + OpName %58 "k" + OpName %62 "gl_FragCoord" + OpName %69 "buf0" + OpMemberName %69 0 "_GLF_uniform_float_values" + OpName %71 "" + OpName %105 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 1 + OpDecorate %62 BuiltIn FragCoord + OpDecorate %68 ArrayStride 16 + OpMemberDecorate %69 0 Offset 0 + OpDecorate %69 Block + OpDecorate %71 DescriptorSet 0 + OpDecorate %71 Binding 0 + OpDecorate %105 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 3 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypePointer Uniform %6 + %28 = OpConstant %6 1 + %31 = OpTypeBool + %34 = OpConstant %6 10 + %59 = OpTypeFloat 32 + %60 = OpTypeVector %59 4 + %61 = OpTypePointer Input %60 + %62 = OpVariable %61 Input + %63 = OpConstant %12 0 + %64 = OpTypePointer Input %59 + %67 = OpConstant %12 1 + %68 = OpTypeArray %59 %67 + %69 = OpTypeStruct %68 + %70 = OpTypePointer Uniform %69 + %71 = OpVariable %70 Uniform + %72 = OpTypePointer Uniform %59 + %76 = OpConstant %6 4 + %98 = OpConstant %6 2 + %104 = OpTypePointer Output %60 + %105 = OpVariable %104 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %21 = OpVariable %10 Function + %39 = OpVariable %10 Function + %58 = OpVariable %10 Function + OpStore %8 %9 + %19 = OpAccessChain %18 %17 %9 %9 + %20 = OpLoad %6 %19 + OpStore %11 %20 + OpStore %21 %9 + OpBranch %22 + %22 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %27 = OpLoad %6 %21 + %29 = OpAccessChain %18 %17 %9 %28 + %30 = OpLoad %6 %29 + %32 = OpSLessThan %31 %27 %30 + %33 = OpLoad %6 %8 + %35 = OpSLessThan %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %23 %24 + %23 = OpLabel + %37 = OpLoad %6 %8 + %38 = OpIAdd %6 %37 %28 + OpStore %8 %38 + %40 = OpAccessChain %18 %17 %9 %28 + %41 = OpLoad %6 %40 + OpStore %39 %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %47 = OpLoad %6 %39 + %48 = OpAccessChain %18 %17 %9 %28 + %49 = OpLoad %6 %48 + %50 = OpSGreaterThanEqual %31 %47 %49 + %51 = OpLoad %6 %8 + %52 = OpSLessThan %31 %51 %34 + %53 = OpLogicalAnd %31 %50 %52 + OpBranchConditional %53 %43 %44 + %43 = OpLabel + %54 = OpLoad %6 %8 + %55 = OpIAdd %6 %54 %28 + OpStore %8 %55 + OpBranch %45 + %45 = OpLabel + %56 = OpLoad %6 %39 + %57 = OpISub %6 %56 %28 + OpStore %39 %57 + OpBranch %42 + %44 = OpLabel + %65 = OpAccessChain %64 %62 %63 + %66 = OpLoad %59 %65 + %73 = OpAccessChain %72 %71 %9 %9 + %74 = OpLoad %59 %73 + %75 = OpFOrdLessThan %31 %66 %74 + %77 = OpSelect %6 %75 %28 %76 + OpStore %58 %77 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %6 %58 + %84 = OpLoad %6 %21 + %85 = OpSGreaterThanEqual %31 %83 %84 + %86 = OpLoad %6 %8 + %87 = OpSLessThan %31 %86 %34 + %88 = OpLogicalAnd %31 %85 %87 + OpBranchConditional %88 %79 %80 + %79 = OpLabel + %89 = OpLoad %6 %8 + %90 = OpIAdd %6 %89 %28 + OpStore %8 %90 + %91 = OpLoad %6 %11 + %92 = OpIAdd %6 %91 %28 + OpStore %11 %92 + OpBranch %81 + %81 = OpLabel + %93 = OpLoad %6 %58 + %94 = OpISub %6 %93 %28 + OpStore %58 %94 + OpBranch %78 + %80 = OpLabel + OpBranch %25 + %25 = OpLabel + %95 = OpLoad %6 %21 + %96 = OpIAdd %6 %95 %28 + OpStore %21 %96 + OpBranch %22 + %24 = OpLabel + %97 = OpLoad %6 %11 + %99 = OpAccessChain %18 %17 %9 %98 + %100 = OpLoad %6 %99 + %101 = OpIEqual %31 %97 %100 + OpSelectionMerge %103 None + OpBranchConditional %101 %102 %119 + %102 = OpLabel + %106 = OpAccessChain %18 %17 %9 %28 + %107 = OpLoad %6 %106 + %108 = OpConvertSToF %59 %107 + %109 = OpAccessChain %18 %17 %9 %9 + %110 = OpLoad %6 %109 + %111 = OpConvertSToF %59 %110 + %112 = OpAccessChain %18 %17 %9 %9 + %113 = OpLoad %6 %112 + %114 = OpConvertSToF %59 %113 + %115 = OpAccessChain %18 %17 %9 %28 + %116 = OpLoad %6 %115 + %117 = OpConvertSToF %59 %116 + %118 = OpCompositeConstruct %60 %108 %111 %114 %117 + OpStore %105 %118 + OpBranch %103 + %119 = OpLabel + %120 = OpAccessChain %18 %17 %9 %9 + %121 = OpLoad %6 %120 + %122 = OpConvertSToF %59 %121 + %123 = OpCompositeConstruct %60 %122 %122 %122 %122 + OpStore %105 %123 + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 5 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-set-struct-data-verify-in-function.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-set-struct-data-verify-in-function.amber new file mode 100644 index 0000000..7a1e948 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-set-struct-data-verify-in-function.amber @@ -0,0 +1,845 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-Os' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# const int _GLF_global_loop_bound = 100; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S +# { +# int data[10]; +# }; +# +# int func(S obj) +# { +# int x = 0; +# +# // Five more iterations as the global loop count has already +# // reached its limit. +# while(_GLF_global_loop_count < _GLF_global_loop_bound + 5) +# { +# _GLF_global_loop_count ++; +# +# // Checks if the first five elements are set to the +# // correct value inside the inner loop in the main +# // function. Return zero if the check fails. +# if (obj.data[x] != x) +# return 0; +# +# x++; +# } +# +# // Return 1 when the check passes. +# return 1; +# } +# +# // Global loop counter incrementation cannot be inside the for loop (along with i++) for the coverage points to trigger. +# #define LOOP _GLF_global_loop_count++; for(int i = 0; i < 5 && _GLF_global_loop_count < _GLF_global_loop_bound; i++) +# +# void main() +# { +# S obj = S(int[10](0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); +# +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { LOOP { +# // Sets the first five elements to 0, 1, 2, 3, 4. +# obj.data[i] = i; +# } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } +# +# int a = 0; +# // Always true. +# if(gl_FragCoord.y > 0.0) +# a = func(obj); +# +# // Always true. +# if (a == 1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 836 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %642 %659 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %642 "gl_FragCoord" + OpName %659 "_GLF_color" + OpDecorate %642 BuiltIn FragCoord + OpDecorate %659 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %18 = OpConstant %6 0 + %19 = OpTypePointer Function %6 + %27 = OpConstant %6 105 + %28 = OpTypeBool + %31 = OpConstant %6 1 + %46 = OpConstantComposite %9 %18 %18 %18 %18 %18 %18 %18 %18 %18 %18 + %57 = OpConstant %6 5 + %60 = OpConstant %6 100 + %639 = OpTypeFloat 32 + %640 = OpTypeVector %639 4 + %641 = OpTypePointer Input %640 + %642 = OpVariable %641 Input + %643 = OpConstant %7 1 + %644 = OpTypePointer Input %639 + %647 = OpConstant %639 0 + %658 = OpTypePointer Output %640 + %659 = OpVariable %658 Output + %660 = OpConstant %639 1 + %661 = OpConstantComposite %640 %660 %647 %647 %660 + %663 = OpConstantComposite %640 %647 %647 %647 %647 + %668 = OpConstant %7 0 + %669 = OpConstantFalse %28 + %672 = OpConstantTrue %28 + %703 = OpTypePointer Function %9 + %722 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %709 = OpVariable %703 Function + %704 = OpVariable %703 Function + OpStore %704 %46 + OpBranch %51 + %51 = OpLabel + %713 = OpPhi %6 %31 %5 %725 %54 + %712 = OpPhi %6 %18 %5 %637 %54 + %58 = OpSLessThan %28 %712 %57 + %61 = OpSLessThan %28 %713 %60 + %62 = OpLogicalAnd %28 %58 %61 + OpLoopMerge %53 %54 None + OpBranchConditional %62 %52 %53 + %52 = OpLabel + %64 = OpIAdd %6 %713 %31 + OpBranch %66 + %66 = OpLabel + %725 = OpPhi %6 %64 %52 %728 %69 + %724 = OpPhi %6 %18 %52 %635 %69 + %72 = OpSLessThan %28 %724 %57 + %74 = OpSLessThan %28 %725 %60 + %75 = OpLogicalAnd %28 %72 %74 + OpLoopMerge %68 %69 None + OpBranchConditional %75 %67 %68 + %67 = OpLabel + %77 = OpIAdd %6 %725 %31 + OpBranch %79 + %79 = OpLabel + %728 = OpPhi %6 %77 %67 %731 %82 + %727 = OpPhi %6 %18 %67 %633 %82 + %85 = OpSLessThan %28 %727 %57 + %87 = OpSLessThan %28 %728 %60 + %88 = OpLogicalAnd %28 %85 %87 + OpLoopMerge %81 %82 None + OpBranchConditional %88 %80 %81 + %80 = OpLabel + %90 = OpIAdd %6 %728 %31 + OpBranch %92 + %92 = OpLabel + %731 = OpPhi %6 %90 %80 %734 %95 + %730 = OpPhi %6 %18 %80 %631 %95 + %98 = OpSLessThan %28 %730 %57 + %100 = OpSLessThan %28 %731 %60 + %101 = OpLogicalAnd %28 %98 %100 + OpLoopMerge %94 %95 None + OpBranchConditional %101 %93 %94 + %93 = OpLabel + %103 = OpIAdd %6 %731 %31 + OpBranch %105 + %105 = OpLabel + %734 = OpPhi %6 %103 %93 %737 %108 + %733 = OpPhi %6 %18 %93 %629 %108 + %111 = OpSLessThan %28 %733 %57 + %113 = OpSLessThan %28 %734 %60 + %114 = OpLogicalAnd %28 %111 %113 + OpLoopMerge %107 %108 None + OpBranchConditional %114 %106 %107 + %106 = OpLabel + %116 = OpIAdd %6 %734 %31 + OpBranch %118 + %118 = OpLabel + %737 = OpPhi %6 %116 %106 %740 %121 + %736 = OpPhi %6 %18 %106 %627 %121 + %124 = OpSLessThan %28 %736 %57 + %126 = OpSLessThan %28 %737 %60 + %127 = OpLogicalAnd %28 %124 %126 + OpLoopMerge %120 %121 None + OpBranchConditional %127 %119 %120 + %119 = OpLabel + %129 = OpIAdd %6 %737 %31 + OpBranch %131 + %131 = OpLabel + %740 = OpPhi %6 %129 %119 %743 %134 + %739 = OpPhi %6 %18 %119 %625 %134 + %137 = OpSLessThan %28 %739 %57 + %139 = OpSLessThan %28 %740 %60 + %140 = OpLogicalAnd %28 %137 %139 + OpLoopMerge %133 %134 None + OpBranchConditional %140 %132 %133 + %132 = OpLabel + %142 = OpIAdd %6 %740 %31 + OpBranch %144 + %144 = OpLabel + %743 = OpPhi %6 %142 %132 %746 %147 + %742 = OpPhi %6 %18 %132 %623 %147 + %150 = OpSLessThan %28 %742 %57 + %152 = OpSLessThan %28 %743 %60 + %153 = OpLogicalAnd %28 %150 %152 + OpLoopMerge %146 %147 None + OpBranchConditional %153 %145 %146 + %145 = OpLabel + %155 = OpIAdd %6 %743 %31 + OpBranch %157 + %157 = OpLabel + %746 = OpPhi %6 %155 %145 %749 %160 + %745 = OpPhi %6 %18 %145 %621 %160 + %163 = OpSLessThan %28 %745 %57 + %165 = OpSLessThan %28 %746 %60 + %166 = OpLogicalAnd %28 %163 %165 + OpLoopMerge %159 %160 None + OpBranchConditional %166 %158 %159 + %158 = OpLabel + %168 = OpIAdd %6 %746 %31 + OpBranch %170 + %170 = OpLabel + %749 = OpPhi %6 %168 %158 %752 %173 + %748 = OpPhi %6 %18 %158 %619 %173 + %176 = OpSLessThan %28 %748 %57 + %178 = OpSLessThan %28 %749 %60 + %179 = OpLogicalAnd %28 %176 %178 + OpLoopMerge %172 %173 None + OpBranchConditional %179 %171 %172 + %171 = OpLabel + %181 = OpIAdd %6 %749 %31 + OpBranch %183 + %183 = OpLabel + %752 = OpPhi %6 %181 %171 %755 %186 + %751 = OpPhi %6 %18 %171 %617 %186 + %189 = OpSLessThan %28 %751 %57 + %191 = OpSLessThan %28 %752 %60 + %192 = OpLogicalAnd %28 %189 %191 + OpLoopMerge %185 %186 None + OpBranchConditional %192 %184 %185 + %184 = OpLabel + %194 = OpIAdd %6 %752 %31 + OpBranch %196 + %196 = OpLabel + %755 = OpPhi %6 %194 %184 %758 %199 + %754 = OpPhi %6 %18 %184 %615 %199 + %202 = OpSLessThan %28 %754 %57 + %204 = OpSLessThan %28 %755 %60 + %205 = OpLogicalAnd %28 %202 %204 + OpLoopMerge %198 %199 None + OpBranchConditional %205 %197 %198 + %197 = OpLabel + %207 = OpIAdd %6 %755 %31 + OpBranch %209 + %209 = OpLabel + %758 = OpPhi %6 %207 %197 %761 %212 + %757 = OpPhi %6 %18 %197 %613 %212 + %215 = OpSLessThan %28 %757 %57 + %217 = OpSLessThan %28 %758 %60 + %218 = OpLogicalAnd %28 %215 %217 + OpLoopMerge %211 %212 None + OpBranchConditional %218 %210 %211 + %210 = OpLabel + %220 = OpIAdd %6 %758 %31 + OpBranch %222 + %222 = OpLabel + %761 = OpPhi %6 %220 %210 %764 %225 + %760 = OpPhi %6 %18 %210 %611 %225 + %228 = OpSLessThan %28 %760 %57 + %230 = OpSLessThan %28 %761 %60 + %231 = OpLogicalAnd %28 %228 %230 + OpLoopMerge %224 %225 None + OpBranchConditional %231 %223 %224 + %223 = OpLabel + %233 = OpIAdd %6 %761 %31 + OpBranch %235 + %235 = OpLabel + %764 = OpPhi %6 %233 %223 %767 %238 + %763 = OpPhi %6 %18 %223 %609 %238 + %241 = OpSLessThan %28 %763 %57 + %243 = OpSLessThan %28 %764 %60 + %244 = OpLogicalAnd %28 %241 %243 + OpLoopMerge %237 %238 None + OpBranchConditional %244 %236 %237 + %236 = OpLabel + %246 = OpIAdd %6 %764 %31 + OpBranch %248 + %248 = OpLabel + %767 = OpPhi %6 %246 %236 %770 %251 + %766 = OpPhi %6 %18 %236 %607 %251 + %254 = OpSLessThan %28 %766 %57 + %256 = OpSLessThan %28 %767 %60 + %257 = OpLogicalAnd %28 %254 %256 + OpLoopMerge %250 %251 None + OpBranchConditional %257 %249 %250 + %249 = OpLabel + %259 = OpIAdd %6 %767 %31 + OpBranch %261 + %261 = OpLabel + %770 = OpPhi %6 %259 %249 %773 %264 + %769 = OpPhi %6 %18 %249 %605 %264 + %267 = OpSLessThan %28 %769 %57 + %269 = OpSLessThan %28 %770 %60 + %270 = OpLogicalAnd %28 %267 %269 + OpLoopMerge %263 %264 None + OpBranchConditional %270 %262 %263 + %262 = OpLabel + %272 = OpIAdd %6 %770 %31 + OpBranch %274 + %274 = OpLabel + %773 = OpPhi %6 %272 %262 %776 %277 + %772 = OpPhi %6 %18 %262 %603 %277 + %280 = OpSLessThan %28 %772 %57 + %282 = OpSLessThan %28 %773 %60 + %283 = OpLogicalAnd %28 %280 %282 + OpLoopMerge %276 %277 None + OpBranchConditional %283 %275 %276 + %275 = OpLabel + %285 = OpIAdd %6 %773 %31 + OpBranch %287 + %287 = OpLabel + %776 = OpPhi %6 %285 %275 %779 %290 + %775 = OpPhi %6 %18 %275 %601 %290 + %293 = OpSLessThan %28 %775 %57 + %295 = OpSLessThan %28 %776 %60 + %296 = OpLogicalAnd %28 %293 %295 + OpLoopMerge %289 %290 None + OpBranchConditional %296 %288 %289 + %288 = OpLabel + %298 = OpIAdd %6 %776 %31 + OpBranch %300 + %300 = OpLabel + %779 = OpPhi %6 %298 %288 %782 %303 + %778 = OpPhi %6 %18 %288 %599 %303 + %306 = OpSLessThan %28 %778 %57 + %308 = OpSLessThan %28 %779 %60 + %309 = OpLogicalAnd %28 %306 %308 + OpLoopMerge %302 %303 None + OpBranchConditional %309 %301 %302 + %301 = OpLabel + %311 = OpIAdd %6 %779 %31 + OpBranch %313 + %313 = OpLabel + %782 = OpPhi %6 %311 %301 %785 %316 + %781 = OpPhi %6 %18 %301 %597 %316 + %319 = OpSLessThan %28 %781 %57 + %321 = OpSLessThan %28 %782 %60 + %322 = OpLogicalAnd %28 %319 %321 + OpLoopMerge %315 %316 None + OpBranchConditional %322 %314 %315 + %314 = OpLabel + %324 = OpIAdd %6 %782 %31 + OpBranch %326 + %326 = OpLabel + %785 = OpPhi %6 %324 %314 %788 %329 + %784 = OpPhi %6 %18 %314 %595 %329 + %332 = OpSLessThan %28 %784 %57 + %334 = OpSLessThan %28 %785 %60 + %335 = OpLogicalAnd %28 %332 %334 + OpLoopMerge %328 %329 None + OpBranchConditional %335 %327 %328 + %327 = OpLabel + %337 = OpIAdd %6 %785 %31 + OpBranch %339 + %339 = OpLabel + %788 = OpPhi %6 %337 %327 %791 %342 + %787 = OpPhi %6 %18 %327 %593 %342 + %345 = OpSLessThan %28 %787 %57 + %347 = OpSLessThan %28 %788 %60 + %348 = OpLogicalAnd %28 %345 %347 + OpLoopMerge %341 %342 None + OpBranchConditional %348 %340 %341 + %340 = OpLabel + %350 = OpIAdd %6 %788 %31 + OpBranch %352 + %352 = OpLabel + %791 = OpPhi %6 %350 %340 %794 %355 + %790 = OpPhi %6 %18 %340 %591 %355 + %358 = OpSLessThan %28 %790 %57 + %360 = OpSLessThan %28 %791 %60 + %361 = OpLogicalAnd %28 %358 %360 + OpLoopMerge %354 %355 None + OpBranchConditional %361 %353 %354 + %353 = OpLabel + %363 = OpIAdd %6 %791 %31 + OpBranch %365 + %365 = OpLabel + %794 = OpPhi %6 %363 %353 %797 %368 + %793 = OpPhi %6 %18 %353 %589 %368 + %371 = OpSLessThan %28 %793 %57 + %373 = OpSLessThan %28 %794 %60 + %374 = OpLogicalAnd %28 %371 %373 + OpLoopMerge %367 %368 None + OpBranchConditional %374 %366 %367 + %366 = OpLabel + %376 = OpIAdd %6 %794 %31 + OpBranch %378 + %378 = OpLabel + %797 = OpPhi %6 %376 %366 %800 %381 + %796 = OpPhi %6 %18 %366 %587 %381 + %384 = OpSLessThan %28 %796 %57 + %386 = OpSLessThan %28 %797 %60 + %387 = OpLogicalAnd %28 %384 %386 + OpLoopMerge %380 %381 None + OpBranchConditional %387 %379 %380 + %379 = OpLabel + %389 = OpIAdd %6 %797 %31 + OpBranch %391 + %391 = OpLabel + %800 = OpPhi %6 %389 %379 %803 %394 + %799 = OpPhi %6 %18 %379 %585 %394 + %397 = OpSLessThan %28 %799 %57 + %399 = OpSLessThan %28 %800 %60 + %400 = OpLogicalAnd %28 %397 %399 + OpLoopMerge %393 %394 None + OpBranchConditional %400 %392 %393 + %392 = OpLabel + %402 = OpIAdd %6 %800 %31 + OpBranch %404 + %404 = OpLabel + %803 = OpPhi %6 %402 %392 %806 %407 + %802 = OpPhi %6 %18 %392 %583 %407 + %410 = OpSLessThan %28 %802 %57 + %412 = OpSLessThan %28 %803 %60 + %413 = OpLogicalAnd %28 %410 %412 + OpLoopMerge %406 %407 None + OpBranchConditional %413 %405 %406 + %405 = OpLabel + %415 = OpIAdd %6 %803 %31 + OpBranch %417 + %417 = OpLabel + %806 = OpPhi %6 %415 %405 %809 %420 + %805 = OpPhi %6 %18 %405 %581 %420 + %423 = OpSLessThan %28 %805 %57 + %425 = OpSLessThan %28 %806 %60 + %426 = OpLogicalAnd %28 %423 %425 + OpLoopMerge %419 %420 None + OpBranchConditional %426 %418 %419 + %418 = OpLabel + %428 = OpIAdd %6 %806 %31 + OpBranch %430 + %430 = OpLabel + %809 = OpPhi %6 %428 %418 %812 %433 + %808 = OpPhi %6 %18 %418 %579 %433 + %436 = OpSLessThan %28 %808 %57 + %438 = OpSLessThan %28 %809 %60 + %439 = OpLogicalAnd %28 %436 %438 + OpLoopMerge %432 %433 None + OpBranchConditional %439 %431 %432 + %431 = OpLabel + %441 = OpIAdd %6 %809 %31 + OpBranch %443 + %443 = OpLabel + %812 = OpPhi %6 %441 %431 %815 %446 + %811 = OpPhi %6 %18 %431 %577 %446 + %449 = OpSLessThan %28 %811 %57 + %451 = OpSLessThan %28 %812 %60 + %452 = OpLogicalAnd %28 %449 %451 + OpLoopMerge %445 %446 None + OpBranchConditional %452 %444 %445 + %444 = OpLabel + %454 = OpIAdd %6 %812 %31 + OpBranch %456 + %456 = OpLabel + %815 = OpPhi %6 %454 %444 %818 %459 + %814 = OpPhi %6 %18 %444 %575 %459 + %462 = OpSLessThan %28 %814 %57 + %464 = OpSLessThan %28 %815 %60 + %465 = OpLogicalAnd %28 %462 %464 + OpLoopMerge %458 %459 None + OpBranchConditional %465 %457 %458 + %457 = OpLabel + %467 = OpIAdd %6 %815 %31 + OpBranch %469 + %469 = OpLabel + %818 = OpPhi %6 %467 %457 %821 %472 + %817 = OpPhi %6 %18 %457 %573 %472 + %475 = OpSLessThan %28 %817 %57 + %477 = OpSLessThan %28 %818 %60 + %478 = OpLogicalAnd %28 %475 %477 + OpLoopMerge %471 %472 None + OpBranchConditional %478 %470 %471 + %470 = OpLabel + %480 = OpIAdd %6 %818 %31 + OpBranch %482 + %482 = OpLabel + %821 = OpPhi %6 %480 %470 %824 %485 + %820 = OpPhi %6 %18 %470 %571 %485 + %488 = OpSLessThan %28 %820 %57 + %490 = OpSLessThan %28 %821 %60 + %491 = OpLogicalAnd %28 %488 %490 + OpLoopMerge %484 %485 None + OpBranchConditional %491 %483 %484 + %483 = OpLabel + %493 = OpIAdd %6 %821 %31 + OpBranch %495 + %495 = OpLabel + %824 = OpPhi %6 %493 %483 %827 %498 + %823 = OpPhi %6 %18 %483 %569 %498 + %501 = OpSLessThan %28 %823 %57 + %503 = OpSLessThan %28 %824 %60 + %504 = OpLogicalAnd %28 %501 %503 + OpLoopMerge %497 %498 None + OpBranchConditional %504 %496 %497 + %496 = OpLabel + %506 = OpIAdd %6 %824 %31 + OpBranch %508 + %508 = OpLabel + %827 = OpPhi %6 %506 %496 %830 %511 + %826 = OpPhi %6 %18 %496 %567 %511 + %514 = OpSLessThan %28 %826 %57 + %516 = OpSLessThan %28 %827 %60 + %517 = OpLogicalAnd %28 %514 %516 + OpLoopMerge %510 %511 None + OpBranchConditional %517 %509 %510 + %509 = OpLabel + %519 = OpIAdd %6 %827 %31 + OpBranch %521 + %521 = OpLabel + %830 = OpPhi %6 %519 %509 %833 %524 + %829 = OpPhi %6 %18 %509 %565 %524 + %527 = OpSLessThan %28 %829 %57 + %529 = OpSLessThan %28 %830 %60 + %530 = OpLogicalAnd %28 %527 %529 + OpLoopMerge %523 %524 None + OpBranchConditional %530 %522 %523 + %522 = OpLabel + %532 = OpIAdd %6 %830 %31 + OpBranch %534 + %534 = OpLabel + %833 = OpPhi %6 %532 %522 %545 %537 + %832 = OpPhi %6 %18 %522 %563 %537 + %540 = OpSLessThan %28 %832 %57 + %542 = OpSLessThan %28 %833 %60 + %543 = OpLogicalAnd %28 %540 %542 + OpLoopMerge %536 %537 None + OpBranchConditional %543 %535 %536 + %535 = OpLabel + %545 = OpIAdd %6 %833 %31 + OpBranch %547 + %547 = OpLabel + %835 = OpPhi %6 %18 %535 %561 %548 + %553 = OpSLessThan %28 %835 %57 + %555 = OpSLessThan %28 %545 %60 + %556 = OpLogicalAnd %28 %553 %555 + OpLoopMerge %549 %548 None + OpBranchConditional %556 %548 %549 + %548 = OpLabel + %706 = OpAccessChain %19 %704 %835 + OpStore %706 %835 + %561 = OpIAdd %6 %835 %31 + OpBranch %547 + %549 = OpLabel + OpBranch %537 + %537 = OpLabel + %563 = OpIAdd %6 %832 %31 + OpBranch %534 + %536 = OpLabel + OpBranch %524 + %524 = OpLabel + %565 = OpIAdd %6 %829 %31 + OpBranch %521 + %523 = OpLabel + OpBranch %511 + %511 = OpLabel + %567 = OpIAdd %6 %826 %31 + OpBranch %508 + %510 = OpLabel + OpBranch %498 + %498 = OpLabel + %569 = OpIAdd %6 %823 %31 + OpBranch %495 + %497 = OpLabel + OpBranch %485 + %485 = OpLabel + %571 = OpIAdd %6 %820 %31 + OpBranch %482 + %484 = OpLabel + OpBranch %472 + %472 = OpLabel + %573 = OpIAdd %6 %817 %31 + OpBranch %469 + %471 = OpLabel + OpBranch %459 + %459 = OpLabel + %575 = OpIAdd %6 %814 %31 + OpBranch %456 + %458 = OpLabel + OpBranch %446 + %446 = OpLabel + %577 = OpIAdd %6 %811 %31 + OpBranch %443 + %445 = OpLabel + OpBranch %433 + %433 = OpLabel + %579 = OpIAdd %6 %808 %31 + OpBranch %430 + %432 = OpLabel + OpBranch %420 + %420 = OpLabel + %581 = OpIAdd %6 %805 %31 + OpBranch %417 + %419 = OpLabel + OpBranch %407 + %407 = OpLabel + %583 = OpIAdd %6 %802 %31 + OpBranch %404 + %406 = OpLabel + OpBranch %394 + %394 = OpLabel + %585 = OpIAdd %6 %799 %31 + OpBranch %391 + %393 = OpLabel + OpBranch %381 + %381 = OpLabel + %587 = OpIAdd %6 %796 %31 + OpBranch %378 + %380 = OpLabel + OpBranch %368 + %368 = OpLabel + %589 = OpIAdd %6 %793 %31 + OpBranch %365 + %367 = OpLabel + OpBranch %355 + %355 = OpLabel + %591 = OpIAdd %6 %790 %31 + OpBranch %352 + %354 = OpLabel + OpBranch %342 + %342 = OpLabel + %593 = OpIAdd %6 %787 %31 + OpBranch %339 + %341 = OpLabel + OpBranch %329 + %329 = OpLabel + %595 = OpIAdd %6 %784 %31 + OpBranch %326 + %328 = OpLabel + OpBranch %316 + %316 = OpLabel + %597 = OpIAdd %6 %781 %31 + OpBranch %313 + %315 = OpLabel + OpBranch %303 + %303 = OpLabel + %599 = OpIAdd %6 %778 %31 + OpBranch %300 + %302 = OpLabel + OpBranch %290 + %290 = OpLabel + %601 = OpIAdd %6 %775 %31 + OpBranch %287 + %289 = OpLabel + OpBranch %277 + %277 = OpLabel + %603 = OpIAdd %6 %772 %31 + OpBranch %274 + %276 = OpLabel + OpBranch %264 + %264 = OpLabel + %605 = OpIAdd %6 %769 %31 + OpBranch %261 + %263 = OpLabel + OpBranch %251 + %251 = OpLabel + %607 = OpIAdd %6 %766 %31 + OpBranch %248 + %250 = OpLabel + OpBranch %238 + %238 = OpLabel + %609 = OpIAdd %6 %763 %31 + OpBranch %235 + %237 = OpLabel + OpBranch %225 + %225 = OpLabel + %611 = OpIAdd %6 %760 %31 + OpBranch %222 + %224 = OpLabel + OpBranch %212 + %212 = OpLabel + %613 = OpIAdd %6 %757 %31 + OpBranch %209 + %211 = OpLabel + OpBranch %199 + %199 = OpLabel + %615 = OpIAdd %6 %754 %31 + OpBranch %196 + %198 = OpLabel + OpBranch %186 + %186 = OpLabel + %617 = OpIAdd %6 %751 %31 + OpBranch %183 + %185 = OpLabel + OpBranch %173 + %173 = OpLabel + %619 = OpIAdd %6 %748 %31 + OpBranch %170 + %172 = OpLabel + OpBranch %160 + %160 = OpLabel + %621 = OpIAdd %6 %745 %31 + OpBranch %157 + %159 = OpLabel + OpBranch %147 + %147 = OpLabel + %623 = OpIAdd %6 %742 %31 + OpBranch %144 + %146 = OpLabel + OpBranch %134 + %134 = OpLabel + %625 = OpIAdd %6 %739 %31 + OpBranch %131 + %133 = OpLabel + OpBranch %121 + %121 = OpLabel + %627 = OpIAdd %6 %736 %31 + OpBranch %118 + %120 = OpLabel + OpBranch %108 + %108 = OpLabel + %629 = OpIAdd %6 %733 %31 + OpBranch %105 + %107 = OpLabel + OpBranch %95 + %95 = OpLabel + %631 = OpIAdd %6 %730 %31 + OpBranch %92 + %94 = OpLabel + OpBranch %82 + %82 = OpLabel + %633 = OpIAdd %6 %727 %31 + OpBranch %79 + %81 = OpLabel + OpBranch %69 + %69 = OpLabel + %635 = OpIAdd %6 %724 %31 + OpBranch %66 + %68 = OpLabel + OpBranch %54 + %54 = OpLabel + %637 = OpIAdd %6 %712 %31 + OpBranch %51 + %53 = OpLabel + %645 = OpAccessChain %644 %642 %643 + %646 = OpLoad %639 %645 + %648 = OpFOrdGreaterThan %28 %646 %647 + OpSelectionMerge %650 None + OpBranchConditional %648 %649 %650 + %649 = OpLabel + %707 = OpLoad %9 %704 + OpStore %709 %707 + OpSelectionMerge %701 None + OpSwitch %668 %680 + %680 = OpLabel + OpBranch %681 + %681 = OpLabel + %715 = OpPhi %6 %18 %680 %696 %697 + %714 = OpPhi %6 %713 %680 %687 %697 + %684 = OpSLessThan %28 %714 %27 + OpLoopMerge %698 %697 None + OpBranchConditional %684 %685 %698 + %685 = OpLabel + %687 = OpIAdd %6 %714 %31 + %711 = OpAccessChain %19 %709 %715 + %690 = OpLoad %6 %711 + %692 = OpINotEqual %28 %690 %715 + OpSelectionMerge %694 None + OpBranchConditional %692 %693 %694 + %693 = OpLabel + OpBranch %698 + %694 = OpLabel + %696 = OpIAdd %6 %715 %31 + OpBranch %697 + %697 = OpLabel + OpBranch %681 + %698 = OpLabel + %719 = OpPhi %6 %722 %681 %18 %693 + %716 = OpPhi %28 %669 %681 %672 %693 + OpSelectionMerge %700 None + OpBranchConditional %716 %701 %700 + %700 = OpLabel + OpBranch %701 + %701 = OpLabel + %718 = OpPhi %6 %719 %698 %31 %700 + OpBranch %650 + %650 = OpLabel + %723 = OpPhi %6 %18 %53 %718 %701 + %655 = OpIEqual %28 %723 %31 + OpSelectionMerge %657 None + OpBranchConditional %655 %656 %662 + %656 = OpLabel + OpStore %659 %661 + OpBranch %657 + %662 = OpLabel + OpStore %659 %663 + OpBranch %657 + %657 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-substract-matrix-element-change-float.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-substract-matrix-element-change-float.amber new file mode 100644 index 0000000..793e4b5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-substract-matrix-element-change-float.amber @@ -0,0 +1,360 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_9_0 _GLF_uniform_float_values[1] +# #define _float_10_0 _GLF_uniform_float_values[2] +# #define _float_2_0 _GLF_uniform_float_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2, 3] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 9.0, 10.0, 2.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = _float_2_0; +# mat4 m = mat4(_float_1_0); +# int a = 1; +# +# // i = 1: m[1][1] = m[1][1] - 5 * 2 = 1 - 10 = -9. +# // i = 2: m[1][2] = m[1][1] - 1 = -9 - 1 = -10. +# // i = 3: m[1][3] = m[1][1] - 1 = -9 - 1 = -10. +# for(int i = 1; i < 4; i ++) +# { +# // Always false. +# if(gl_FragCoord.x < 0.0) +# { +# break; +# } +# +# // Always false. +# if(a ++ >= 5) +# { +# break; +# } +# +# for(int j = 1; j < 6; j++) +# { +# m[_int_1][i] = m[_int_1][_int_1] - f; +# } +# +# f = _float_1_0; +# } +# +# mat4 ref = mat4(_float_1_0); +# ref[1][1] = -9.0; +# ref[1][2] = -10.0; +# ref[1][3] = -10.0; +# +# // Always true. +# if(m == ref) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %48 %137 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %24 "m" + OpName %35 "a" + OpName %37 "i" + OpName %48 "gl_FragCoord" + OpName %64 "j" + OpName %74 "buf0" + OpMemberName %74 0 "_GLF_uniform_int_values" + OpName %76 "" + OpName %96 "ref" + OpName %137 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %48 BuiltIn FragCoord + OpDecorate %73 ArrayStride 16 + OpMemberDecorate %74 0 Offset 0 + OpDecorate %74 Block + OpDecorate %76 DescriptorSet 0 + OpDecorate %76 Binding 0 + OpDecorate %137 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 3 + %18 = OpTypePointer Uniform %6 + %21 = OpTypeVector %6 4 + %22 = OpTypeMatrix %21 4 + %23 = OpTypePointer Function %22 + %27 = OpConstant %6 1 + %28 = OpConstant %6 0 + %34 = OpTypePointer Function %15 + %36 = OpConstant %15 1 + %44 = OpConstant %15 4 + %45 = OpTypeBool + %47 = OpTypePointer Input %21 + %48 = OpVariable %47 Input + %49 = OpConstant %9 0 + %50 = OpTypePointer Input %6 + %59 = OpConstant %15 5 + %71 = OpConstant %15 6 + %73 = OpTypeArray %15 %10 + %74 = OpTypeStruct %73 + %75 = OpTypePointer Uniform %74 + %76 = OpVariable %75 Uniform + %77 = OpTypePointer Uniform %15 + %104 = OpConstant %6 -9 + %105 = OpConstant %9 1 + %107 = OpConstant %6 -10 + %108 = OpConstant %9 2 + %110 = OpConstant %9 3 + %116 = OpTypeVector %45 4 + %136 = OpTypePointer Output %21 + %137 = OpVariable %136 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %24 = OpVariable %23 Function + %35 = OpVariable %34 Function + %37 = OpVariable %34 Function + %64 = OpVariable %34 Function + %96 = OpVariable %23 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %6 %19 + OpStore %8 %20 + %25 = OpAccessChain %18 %14 %16 %16 + %26 = OpLoad %6 %25 + %29 = OpCompositeConstruct %21 %26 %28 %28 %28 + %30 = OpCompositeConstruct %21 %28 %26 %28 %28 + %31 = OpCompositeConstruct %21 %28 %28 %26 %28 + %32 = OpCompositeConstruct %21 %28 %28 %28 %26 + %33 = OpCompositeConstruct %22 %29 %30 %31 %32 + OpStore %24 %33 + OpStore %35 %36 + OpStore %37 %36 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %15 %37 + %46 = OpSLessThan %45 %43 %44 + OpBranchConditional %46 %39 %40 + %39 = OpLabel + %51 = OpAccessChain %50 %48 %49 + %52 = OpLoad %6 %51 + %53 = OpFOrdLessThan %45 %52 %28 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %55 + %54 = OpLabel + OpBranch %40 + %55 = OpLabel + %57 = OpLoad %15 %35 + %58 = OpIAdd %15 %57 %36 + OpStore %35 %58 + %60 = OpSGreaterThanEqual %45 %57 %59 + OpSelectionMerge %62 None + OpBranchConditional %60 %61 %62 + %61 = OpLabel + OpBranch %40 + %62 = OpLabel + OpStore %64 %36 + OpBranch %65 + %65 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %70 = OpLoad %15 %64 + %72 = OpSLessThan %45 %70 %71 + OpBranchConditional %72 %66 %67 + %66 = OpLabel + %78 = OpAccessChain %77 %76 %16 %16 + %79 = OpLoad %15 %78 + %80 = OpLoad %15 %37 + %81 = OpAccessChain %77 %76 %16 %16 + %82 = OpLoad %15 %81 + %83 = OpAccessChain %77 %76 %16 %16 + %84 = OpLoad %15 %83 + %85 = OpAccessChain %7 %24 %82 %84 + %86 = OpLoad %6 %85 + %87 = OpLoad %6 %8 + %88 = OpFSub %6 %86 %87 + %89 = OpAccessChain %7 %24 %79 %80 + OpStore %89 %88 + OpBranch %68 + %68 = OpLabel + %90 = OpLoad %15 %64 + %91 = OpIAdd %15 %90 %36 + OpStore %64 %91 + OpBranch %65 + %67 = OpLabel + %92 = OpAccessChain %18 %14 %16 %16 + %93 = OpLoad %6 %92 + OpStore %8 %93 + OpBranch %41 + %41 = OpLabel + %94 = OpLoad %15 %37 + %95 = OpIAdd %15 %94 %36 + OpStore %37 %95 + OpBranch %38 + %40 = OpLabel + %97 = OpAccessChain %18 %14 %16 %16 + %98 = OpLoad %6 %97 + %99 = OpCompositeConstruct %21 %98 %28 %28 %28 + %100 = OpCompositeConstruct %21 %28 %98 %28 %28 + %101 = OpCompositeConstruct %21 %28 %28 %98 %28 + %102 = OpCompositeConstruct %21 %28 %28 %28 %98 + %103 = OpCompositeConstruct %22 %99 %100 %101 %102 + OpStore %96 %103 + %106 = OpAccessChain %7 %96 %36 %105 + OpStore %106 %104 + %109 = OpAccessChain %7 %96 %36 %108 + OpStore %109 %107 + %111 = OpAccessChain %7 %96 %36 %110 + OpStore %111 %107 + %112 = OpLoad %22 %24 + %113 = OpLoad %22 %96 + %114 = OpCompositeExtract %21 %112 0 + %115 = OpCompositeExtract %21 %113 0 + %117 = OpFOrdEqual %116 %114 %115 + %118 = OpAll %45 %117 + %119 = OpCompositeExtract %21 %112 1 + %120 = OpCompositeExtract %21 %113 1 + %121 = OpFOrdEqual %116 %119 %120 + %122 = OpAll %45 %121 + %123 = OpLogicalAnd %45 %118 %122 + %124 = OpCompositeExtract %21 %112 2 + %125 = OpCompositeExtract %21 %113 2 + %126 = OpFOrdEqual %116 %124 %125 + %127 = OpAll %45 %126 + %128 = OpLogicalAnd %45 %123 %127 + %129 = OpCompositeExtract %21 %112 3 + %130 = OpCompositeExtract %21 %113 3 + %131 = OpFOrdEqual %116 %129 %130 + %132 = OpAll %45 %131 + %133 = OpLogicalAnd %45 %128 %132 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %151 + %134 = OpLabel + %138 = OpAccessChain %77 %76 %16 %16 + %139 = OpLoad %15 %138 + %140 = OpConvertSToF %6 %139 + %141 = OpAccessChain %77 %76 %16 %36 + %142 = OpLoad %15 %141 + %143 = OpConvertSToF %6 %142 + %144 = OpAccessChain %77 %76 %16 %36 + %145 = OpLoad %15 %144 + %146 = OpConvertSToF %6 %145 + %147 = OpAccessChain %77 %76 %16 %16 + %148 = OpLoad %15 %147 + %149 = OpConvertSToF %6 %148 + %150 = OpCompositeConstruct %21 %140 %143 %146 %149 + OpStore %137 %150 + OpBranch %135 + %151 = OpLabel + %152 = OpAccessChain %77 %76 %16 %36 + %153 = OpLoad %15 %152 + %154 = OpConvertSToF %6 %153 + %155 = OpCompositeConstruct %21 %154 %154 %154 %154 + OpStore %137 %155 + OpBranch %135 + %135 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 9.0 10.0 2.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-switch-add-zero-matrix-elements.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-switch-add-zero-matrix-elements.amber new file mode 100644 index 0000000..90cf4fb --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-switch-add-zero-matrix-elements.amber @@ -0,0 +1,487 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-multi-store' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-branches' +# '--merge-return' +# '--redundancy-elimination' +# '--reduce-load-size' +# '--simplify-instructions' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-return' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_5 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_0 _GLF_uniform_int_values[4] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_19_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 19.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [3, 5, 2, 1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float arr[9] = float[9](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0); +# +# for(int i = _int_1; i < _int_5; i ++) +# { +# for(int j = 2; j <= 4; j ++) +# { +# for(int k = 0; k < j; k ++) +# { +# for(int l = 0; l < 2; l ++) +# { +# // Iterated 18 times for each value of i. +# switch(i) +# { +# case 0: +# arr[i] += _float_1_0; +# break; +# case 1: +# arr[i] += _float_1_0; +# break; +# // Matrices only contain zero values. +# case 2: +# arr[i] += mat2x4(0.0)[clamp(k, _int_0, _int_1)][l]; +# break; +# case 3: +# arr[i] += mat3x2(0.0)[clamp(k, _int_0, _int_2)][l]; +# break; +# case 4: +# arr[i] += mat3(0.0)[clamp(k, _int_0, _int_2)][l]; +# break; +# // Cases below are never executed. +# case 5: +# arr[i] += mat3x4(0.0)[clamp(k, 0, _int_2)][l]; +# break; +# case 6: +# arr[i] += mat4x2(0.0)[clamp(k, 0, 3)][l]; +# break; +# case 7: +# arr[i] += mat4x3(0.0)[clamp(k, 0, 3)][l]; +# // Fallthrough +# case 8: +# arr[i] += mat4(0.0)[clamp(k, 0, _int_3)][l]; +# break; +# } +# } +# } +# } +# } +# +# // Always true. +# if(arr[_int_0] == _float_1_0 && arr[_int_1] == _float_19_0 && arr[_int_2] == _float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 307 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %282 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %40 "i" + OpName %43 "buf1" + OpMemberName %43 0 "_GLF_uniform_int_values" + OpName %45 "" + OpName %61 "j" + OpName %71 "k" + OpName %80 "l" + OpName %130 "indexable" + OpName %151 "indexable" + OpName %172 "indexable" + OpName %189 "indexable" + OpName %204 "indexable" + OpName %219 "indexable" + OpName %235 "indexable" + OpName %282 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %42 ArrayStride 16 + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 1 + OpDecorate %282 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 9 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 2 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %39 = OpTypePointer Function %17 + %41 = OpConstant %7 5 + %42 = OpTypeArray %17 %41 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %46 = OpConstant %17 3 + %47 = OpTypePointer Uniform %17 + %56 = OpConstant %17 1 + %59 = OpTypeBool + %62 = OpConstant %17 2 + %69 = OpConstant %17 4 + %102 = OpTypePointer Function %6 + %117 = OpTypeVector %6 4 + %118 = OpTypeMatrix %117 2 + %119 = OpConstant %6 0 + %120 = OpConstantComposite %117 %119 %119 %119 %119 + %121 = OpConstantComposite %118 %120 %120 + %129 = OpTypePointer Function %118 + %139 = OpTypeVector %6 2 + %140 = OpTypeMatrix %139 3 + %141 = OpConstantComposite %139 %119 %119 + %142 = OpConstantComposite %140 %141 %141 %141 + %150 = OpTypePointer Function %140 + %160 = OpTypeVector %6 3 + %161 = OpTypeMatrix %160 3 + %162 = OpConstantComposite %160 %119 %119 %119 + %163 = OpConstantComposite %161 %162 %162 %162 + %171 = OpTypePointer Function %161 + %181 = OpTypeMatrix %117 3 + %182 = OpConstantComposite %181 %120 %120 %120 + %188 = OpTypePointer Function %181 + %198 = OpTypeMatrix %139 4 + %199 = OpConstantComposite %198 %141 %141 %141 %141 + %203 = OpTypePointer Function %198 + %213 = OpTypeMatrix %160 4 + %214 = OpConstantComposite %213 %162 %162 %162 %162 + %218 = OpTypePointer Function %213 + %227 = OpTypeMatrix %117 4 + %228 = OpConstantComposite %227 %120 %120 %120 %120 + %234 = OpTypePointer Function %227 + %281 = OpTypePointer Output %117 + %282 = OpVariable %281 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %40 = OpVariable %39 Function + %61 = OpVariable %39 Function + %71 = OpVariable %39 Function + %80 = OpVariable %39 Function + %130 = OpVariable %129 Function + %151 = OpVariable %150 Function + %172 = OpVariable %171 Function + %189 = OpVariable %188 Function + %204 = OpVariable %203 Function + %219 = OpVariable %218 Function + %235 = OpVariable %234 Function + %20 = OpAccessChain %19 %16 %18 %18 + %21 = OpLoad %6 %20 + %38 = OpCompositeConstruct %9 %21 %21 %21 %21 %21 %21 %21 %21 %21 + OpStore %11 %38 + %48 = OpAccessChain %47 %45 %18 %46 + %49 = OpLoad %17 %48 + OpStore %40 %49 + OpBranch %50 + %50 = OpLabel + %301 = OpPhi %17 %49 %5 %251 %53 + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %57 = OpAccessChain %47 %45 %18 %56 + %58 = OpLoad %17 %57 + %60 = OpSLessThan %59 %301 %58 + OpBranchConditional %60 %51 %52 + %51 = OpLabel + OpStore %61 %62 + OpBranch %63 + %63 = OpLabel + %302 = OpPhi %17 %62 %51 %249 %66 + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %70 = OpSLessThanEqual %59 %302 %69 + OpBranchConditional %70 %64 %65 + %64 = OpLabel + OpStore %71 %18 + OpBranch %72 + %72 = OpLabel + %304 = OpPhi %17 %18 %64 %247 %75 + OpLoopMerge %74 %75 None + OpBranch %76 + %76 = OpLabel + %79 = OpSLessThan %59 %304 %302 + OpBranchConditional %79 %73 %74 + %73 = OpLabel + OpStore %80 %18 + OpBranch %81 + %81 = OpLabel + %306 = OpPhi %17 %18 %73 %245 %84 + OpLoopMerge %83 %84 None + OpBranch %85 + %85 = OpLabel + %87 = OpSLessThan %59 %306 %62 + OpBranchConditional %87 %82 %83 + %82 = OpLabel + OpSelectionMerge %98 None + OpSwitch %301 %98 0 %89 1 %90 2 %91 3 %92 4 %93 5 %94 6 %95 7 %96 8 %97 + %89 = OpLabel + %103 = OpAccessChain %102 %11 %301 + %104 = OpLoad %6 %103 + %105 = OpFAdd %6 %104 %21 + OpStore %103 %105 + OpBranch %98 + %90 = OpLabel + %111 = OpAccessChain %102 %11 %301 + %112 = OpLoad %6 %111 + %113 = OpFAdd %6 %112 %21 + OpStore %111 %113 + OpBranch %98 + %91 = OpLabel + %123 = OpAccessChain %47 %45 %18 %69 + %124 = OpLoad %17 %123 + %127 = OpExtInst %17 %1 SClamp %304 %124 %49 + OpStore %130 %121 + %131 = OpAccessChain %102 %130 %127 %306 + %132 = OpLoad %6 %131 + %133 = OpAccessChain %102 %11 %301 + %134 = OpLoad %6 %133 + %135 = OpFAdd %6 %134 %132 + OpStore %133 %135 + OpBranch %98 + %92 = OpLabel + %144 = OpAccessChain %47 %45 %18 %69 + %145 = OpLoad %17 %144 + %146 = OpAccessChain %47 %45 %18 %62 + %147 = OpLoad %17 %146 + %148 = OpExtInst %17 %1 SClamp %304 %145 %147 + OpStore %151 %142 + %152 = OpAccessChain %102 %151 %148 %306 + %153 = OpLoad %6 %152 + %154 = OpAccessChain %102 %11 %301 + %155 = OpLoad %6 %154 + %156 = OpFAdd %6 %155 %153 + OpStore %154 %156 + OpBranch %98 + %93 = OpLabel + %165 = OpAccessChain %47 %45 %18 %69 + %166 = OpLoad %17 %165 + %167 = OpAccessChain %47 %45 %18 %62 + %168 = OpLoad %17 %167 + %169 = OpExtInst %17 %1 SClamp %304 %166 %168 + OpStore %172 %163 + %173 = OpAccessChain %102 %172 %169 %306 + %174 = OpLoad %6 %173 + %175 = OpAccessChain %102 %11 %301 + %176 = OpLoad %6 %175 + %177 = OpFAdd %6 %176 %174 + OpStore %175 %177 + OpBranch %98 + %94 = OpLabel + %184 = OpAccessChain %47 %45 %18 %62 + %185 = OpLoad %17 %184 + %186 = OpExtInst %17 %1 SClamp %304 %18 %185 + OpStore %189 %182 + %190 = OpAccessChain %102 %189 %186 %306 + %191 = OpLoad %6 %190 + %192 = OpAccessChain %102 %11 %301 + %193 = OpLoad %6 %192 + %194 = OpFAdd %6 %193 %191 + OpStore %192 %194 + OpBranch %98 + %95 = OpLabel + %201 = OpExtInst %17 %1 SClamp %304 %18 %46 + OpStore %204 %199 + %205 = OpAccessChain %102 %204 %201 %306 + %206 = OpLoad %6 %205 + %207 = OpAccessChain %102 %11 %301 + %208 = OpLoad %6 %207 + %209 = OpFAdd %6 %208 %206 + OpStore %207 %209 + OpBranch %98 + %96 = OpLabel + %216 = OpExtInst %17 %1 SClamp %304 %18 %46 + OpStore %219 %214 + %220 = OpAccessChain %102 %219 %216 %306 + %221 = OpLoad %6 %220 + %222 = OpAccessChain %102 %11 %301 + %223 = OpLoad %6 %222 + %224 = OpFAdd %6 %223 %221 + OpStore %222 %224 + OpBranch %97 + %97 = OpLabel + %230 = OpAccessChain %47 %45 %18 %18 + %231 = OpLoad %17 %230 + %232 = OpExtInst %17 %1 SClamp %304 %18 %231 + OpStore %235 %228 + %236 = OpAccessChain %102 %235 %232 %306 + %237 = OpLoad %6 %236 + %238 = OpAccessChain %102 %11 %301 + %239 = OpLoad %6 %238 + %240 = OpFAdd %6 %239 %237 + OpStore %238 %240 + OpBranch %98 + %98 = OpLabel + OpBranch %84 + %84 = OpLabel + %245 = OpIAdd %17 %306 %56 + OpStore %80 %245 + OpBranch %81 + %83 = OpLabel + OpBranch %75 + %75 = OpLabel + %247 = OpIAdd %17 %304 %56 + OpStore %71 %247 + OpBranch %72 + %74 = OpLabel + OpBranch %66 + %66 = OpLabel + %249 = OpIAdd %17 %302 %56 + OpStore %61 %249 + OpBranch %63 + %65 = OpLabel + OpBranch %53 + %53 = OpLabel + %251 = OpIAdd %17 %301 %56 + OpStore %40 %251 + OpBranch %50 + %52 = OpLabel + %252 = OpAccessChain %47 %45 %18 %69 + %253 = OpLoad %17 %252 + %254 = OpAccessChain %102 %11 %253 + %255 = OpLoad %6 %254 + %258 = OpFOrdEqual %59 %255 %21 + OpSelectionMerge %260 None + OpBranchConditional %258 %259 %260 + %259 = OpLabel + %263 = OpAccessChain %102 %11 %49 + %264 = OpLoad %6 %263 + %265 = OpAccessChain %19 %16 %18 %56 + %266 = OpLoad %6 %265 + %267 = OpFOrdEqual %59 %264 %266 + OpBranch %260 + %260 = OpLabel + %268 = OpPhi %59 %258 %52 %267 %259 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %271 = OpAccessChain %47 %45 %18 %62 + %272 = OpLoad %17 %271 + %273 = OpAccessChain %102 %11 %272 + %274 = OpLoad %6 %273 + %277 = OpFOrdEqual %59 %274 %21 + OpBranch %270 + %270 = OpLabel + %278 = OpPhi %59 %268 %260 %277 %269 + OpSelectionMerge %280 None + OpBranchConditional %278 %279 %296 + %279 = OpLabel + %285 = OpConvertSToF %6 %49 + %288 = OpConvertSToF %6 %253 + %295 = OpCompositeConstruct %117 %285 %288 %288 %285 + OpStore %282 %295 + OpBranch %280 + %296 = OpLabel + %299 = OpConvertSToF %6 %253 + %300 = OpCompositeConstruct %117 %299 %299 %299 %299 + OpStore %282 %300 + OpBranch %280 + %280 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 5 2 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 19.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-switch-case-fallthrough-increment-array-element.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-switch-case-fallthrough-increment-array-element.amber new file mode 100644 index 0000000..ec2f92e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-switch-case-fallthrough-increment-array-element.amber @@ -0,0 +1,308 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_4 _GLF_uniform_int_values[3] +# #define _int_5 _GLF_uniform_int_values[4] +# #define _int_7 _GLF_uniform_int_values[5] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [2, 1, 0, 4, 5, 7] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[6]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[3] = int[3](_int_0, _int_1, _int_2); +# int a = 1; +# +# // Iterates three times. +# for(int i = 2; i < 5; i++) +# { +# int b = _int_1; +# +# // Iterates three times. +# while(i > _int_1) +# { +# if(b >= _int_4) +# { +# break; +# } +# b++; +# +# switch(a) +# { +# case 1: +# arr[a]++; +# // Fallthrough makes arr[1] to increment by two. +# case 2: +# arr[a]++; +# } +# } +# +# a++; +# } +# +# // Always true. +# if(arr[_int_0] == _int_0 && arr[_int_1] == _int_7 && arr[_int_2] == _int_5) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 131 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %112 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "arr" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %29 "a" + OpName %30 "i" + OpName %40 "b" + OpName %112 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %112 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 3 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 6 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 2 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 1 + %28 = OpTypePointer Function %6 + %37 = OpConstant %6 5 + %38 = OpTypeBool + %53 = OpConstant %6 3 + %102 = OpConstant %6 4 + %109 = OpTypeFloat 32 + %110 = OpTypeVector %109 4 + %111 = OpTypePointer Output %110 + %112 = OpVariable %111 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %29 = OpVariable %28 Function + %30 = OpVariable %28 Function + %40 = OpVariable %28 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %19 %16 %17 %22 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %19 %16 %17 %17 + %26 = OpLoad %6 %25 + %27 = OpCompositeConstruct %9 %21 %24 %26 + OpStore %11 %27 + OpStore %29 %22 + OpStore %30 %18 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %6 %30 + %39 = OpSLessThan %38 %36 %37 + OpBranchConditional %39 %32 %33 + %32 = OpLabel + %41 = OpAccessChain %19 %16 %17 %22 + %42 = OpLoad %6 %41 + OpStore %40 %42 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %6 %30 + %49 = OpAccessChain %19 %16 %17 %22 + %50 = OpLoad %6 %49 + %51 = OpSGreaterThan %38 %48 %50 + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %52 = OpLoad %6 %40 + %54 = OpAccessChain %19 %16 %17 %53 + %55 = OpLoad %6 %54 + %56 = OpSGreaterThanEqual %38 %52 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + OpBranch %45 + %58 = OpLabel + %60 = OpLoad %6 %40 + %61 = OpIAdd %6 %60 %22 + OpStore %40 %61 + %62 = OpLoad %6 %29 + OpSelectionMerge %65 None + OpSwitch %62 %65 1 %63 2 %64 + %63 = OpLabel + %66 = OpLoad %6 %29 + %67 = OpAccessChain %28 %11 %66 + %68 = OpLoad %6 %67 + %69 = OpIAdd %6 %68 %22 + OpStore %67 %69 + OpBranch %64 + %64 = OpLabel + %70 = OpLoad %6 %29 + %71 = OpAccessChain %28 %11 %70 + %72 = OpLoad %6 %71 + %73 = OpIAdd %6 %72 %22 + OpStore %71 %73 + OpBranch %65 + %65 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %43 + %45 = OpLabel + %75 = OpLoad %6 %29 + %76 = OpIAdd %6 %75 %22 + OpStore %29 %76 + OpBranch %34 + %34 = OpLabel + %77 = OpLoad %6 %30 + %78 = OpIAdd %6 %77 %22 + OpStore %30 %78 + OpBranch %31 + %33 = OpLabel + %79 = OpAccessChain %19 %16 %17 %18 + %80 = OpLoad %6 %79 + %81 = OpAccessChain %28 %11 %80 + %82 = OpLoad %6 %81 + %83 = OpAccessChain %19 %16 %17 %18 + %84 = OpLoad %6 %83 + %85 = OpIEqual %38 %82 %84 + OpSelectionMerge %87 None + OpBranchConditional %85 %86 %87 + %86 = OpLabel + %88 = OpAccessChain %19 %16 %17 %22 + %89 = OpLoad %6 %88 + %90 = OpAccessChain %28 %11 %89 + %91 = OpLoad %6 %90 + %92 = OpAccessChain %19 %16 %17 %37 + %93 = OpLoad %6 %92 + %94 = OpIEqual %38 %91 %93 + OpBranch %87 + %87 = OpLabel + %95 = OpPhi %38 %85 %33 %94 %86 + OpSelectionMerge %97 None + OpBranchConditional %95 %96 %97 + %96 = OpLabel + %98 = OpAccessChain %19 %16 %17 %17 + %99 = OpLoad %6 %98 + %100 = OpAccessChain %28 %11 %99 + %101 = OpLoad %6 %100 + %103 = OpAccessChain %19 %16 %17 %102 + %104 = OpLoad %6 %103 + %105 = OpIEqual %38 %101 %104 + OpBranch %97 + %97 = OpLabel + %106 = OpPhi %38 %95 %87 %105 %96 + OpSelectionMerge %108 None + OpBranchConditional %106 %107 %126 + %107 = OpLabel + %113 = OpAccessChain %19 %16 %17 %22 + %114 = OpLoad %6 %113 + %115 = OpConvertSToF %109 %114 + %116 = OpAccessChain %19 %16 %17 %18 + %117 = OpLoad %6 %116 + %118 = OpConvertSToF %109 %117 + %119 = OpAccessChain %19 %16 %17 %18 + %120 = OpLoad %6 %119 + %121 = OpConvertSToF %109 %120 + %122 = OpAccessChain %19 %16 %17 %22 + %123 = OpLoad %6 %122 + %124 = OpConvertSToF %109 %123 + %125 = OpCompositeConstruct %110 %115 %118 %121 %124 + OpStore %112 %125 + OpBranch %108 + %126 = OpLabel + %127 = OpAccessChain %19 %16 %17 %18 + %128 = OpLoad %6 %127 + %129 = OpConvertSToF %109 %128 + %130 = OpCompositeConstruct %110 %129 %129 %129 %129 + OpStore %112 %130 + OpBranch %108 + %108 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 1 0 4 5 7 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-temporary-copy-output-color-index-matrix.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-temporary-copy-output-color-index-matrix.amber new file mode 100644 index 0000000..103c103 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-temporary-copy-output-color-index-matrix.amber @@ -0,0 +1,404 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--scalar-replacement=100' +# '--copy-propagate-arrays' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-store' +# '--eliminate-local-single-store' +# '--ccp' +# '--eliminate-dead-code-aggressive' +# '--copy-propagate-arrays' +# '--eliminate-dead-branches' +# '--inline-entry-points-exhaustive' +# '--copy-propagate-arrays' +# '--eliminate-dead-branches' +# '--redundancy-elimination' +# '--ccp' +# '--reduce-load-size' +# '--eliminate-local-single-block' +# '--copy-propagate-arrays' +# '--ccp' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_5 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_3_9 _GLF_uniform_float_values[1] +# #define _float_4_1 _GLF_uniform_float_values[2] +# #define _float_1_0 _GLF_uniform_float_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 3.9, 4.1, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[4]; +# }; +# +# // Contents of _GLF_uniform_int_values: [5, 1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1); +# float f = _float_0_0; +# +# // Iterates four times increasing f by one per each iteration. +# for(int i = _int_1; i < _int_5; i++) +# { +# // Iterates once. +# for(int j = _int_0; j < _int_1; j++) +# { +# for(int k = _int_0; k < i; k++) +# { +# // Increases f by one when k = 0. +# f += mat2(_float_1_0)[j][clamp(k, _int_0, _int_1)]; +# +# // Copy output color to a temporary vector and back. +# // This will be overwritten later. +# vec4 tmp; +# for(int l = _int_0; l < _int_1; l++) +# { +# tmp = _GLF_color; +# } +# _GLF_color = tmp; +# +# // Always false. +# if(gl_FragCoord.y < _float_0_0) +# { +# return; +# } +# +# _GLF_color = vec4(_int_0); +# } +# } +# } +# +# // Always true. +# if(f > _float_3_9 && f < _float_4_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 179 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %114 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %25 "f" + OpName %28 "buf0" + OpMemberName %28 0 "_GLF_uniform_float_values" + OpName %30 "" + OpName %35 "i" + OpName %48 "j" + OpName %61 "k" + OpName %90 "indexable" + OpName %95 "l" + OpName %108 "tmp" + OpName %114 "gl_FragCoord" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %27 ArrayStride 16 + OpMemberDecorate %28 0 Offset 0 + OpDecorate %28 Block + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 0 + OpDecorate %114 BuiltIn FragCoord + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 3 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpConstant %10 1 + %19 = OpTypePointer Uniform %10 + %24 = OpTypePointer Function %6 + %26 = OpConstant %11 4 + %27 = OpTypeArray %6 %26 + %28 = OpTypeStruct %27 + %29 = OpTypePointer Uniform %28 + %30 = OpVariable %29 Uniform + %31 = OpTypePointer Uniform %6 + %34 = OpTypePointer Function %10 + %46 = OpTypeBool + %49 = OpConstant %10 2 + %72 = OpConstant %10 3 + %75 = OpTypeVector %6 2 + %76 = OpTypeMatrix %75 2 + %78 = OpConstant %6 0 + %89 = OpTypePointer Function %76 + %107 = OpTypePointer Function %7 + %113 = OpTypePointer Input %7 + %114 = OpVariable %113 Input + %115 = OpConstant %11 1 + %116 = OpTypePointer Input %6 + %168 = OpConstant %11 0 + %169 = OpConstantFalse %46 + %170 = OpTypePointer Function %46 + %172 = OpConstantTrue %46 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %171 = OpVariable %170 Function %169 + %25 = OpVariable %24 Function + %35 = OpVariable %34 Function + %48 = OpVariable %34 Function + %61 = OpVariable %34 Function + %90 = OpVariable %89 Function + %95 = OpVariable %34 Function + %108 = OpVariable %107 Function + OpSelectionMerge %166 None + OpSwitch %168 %167 + %167 = OpLabel + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %10 %20 + %22 = OpConvertSToF %6 %21 + %23 = OpCompositeConstruct %7 %22 %22 %22 %22 + OpStore %9 %23 + %32 = OpAccessChain %31 %30 %17 %17 + %33 = OpLoad %6 %32 + OpStore %25 %33 + OpStore %35 %21 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %10 %35 + %44 = OpAccessChain %19 %16 %17 %17 + %45 = OpLoad %10 %44 + %47 = OpSLessThan %46 %43 %45 + OpBranchConditional %47 %39 %40 + %39 = OpLabel + %50 = OpAccessChain %19 %16 %17 %49 + %51 = OpLoad %10 %50 + OpStore %48 %51 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %10 %48 + %60 = OpSLessThan %46 %57 %21 + OpBranchConditional %60 %53 %54 + %53 = OpLabel + OpStore %61 %51 + OpBranch %64 + %64 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %69 = OpLoad %10 %61 + %70 = OpLoad %10 %35 + %71 = OpSLessThan %46 %69 %70 + OpBranchConditional %71 %65 %66 + %65 = OpLabel + %73 = OpAccessChain %31 %30 %17 %72 + %74 = OpLoad %6 %73 + %79 = OpCompositeConstruct %75 %74 %78 + %80 = OpCompositeConstruct %75 %78 %74 + %81 = OpCompositeConstruct %76 %79 %80 + %82 = OpLoad %10 %48 + %83 = OpLoad %10 %61 + %88 = OpExtInst %10 %1 SClamp %83 %51 %21 + OpStore %90 %81 + %91 = OpAccessChain %24 %90 %82 %88 + %92 = OpLoad %6 %91 + %93 = OpLoad %6 %25 + %94 = OpFAdd %6 %93 %92 + OpStore %25 %94 + OpStore %95 %51 + OpBranch %98 + %98 = OpLabel + OpLoopMerge %100 %101 None + OpBranch %102 + %102 = OpLabel + %103 = OpLoad %10 %95 + %106 = OpSLessThan %46 %103 %21 + OpBranchConditional %106 %99 %100 + %99 = OpLabel + %109 = OpLoad %7 %9 + OpStore %108 %109 + OpBranch %101 + %101 = OpLabel + %110 = OpLoad %10 %95 + %111 = OpIAdd %10 %110 %18 + OpStore %95 %111 + OpBranch %98 + %100 = OpLabel + %112 = OpLoad %7 %108 + OpStore %9 %112 + %117 = OpAccessChain %116 %114 %115 + %118 = OpLoad %6 %117 + %121 = OpFOrdLessThan %46 %118 %33 + OpSelectionMerge %123 None + OpBranchConditional %121 %122 %123 + %122 = OpLabel + OpStore %171 %172 + OpBranch %66 + %123 = OpLabel + %127 = OpConvertSToF %6 %51 + %128 = OpCompositeConstruct %7 %127 %127 %127 %127 + OpStore %9 %128 + OpBranch %67 + %67 = OpLabel + %129 = OpLoad %10 %61 + %130 = OpIAdd %10 %129 %18 + OpStore %61 %130 + OpBranch %64 + %66 = OpLabel + %174 = OpLoad %46 %171 + OpSelectionMerge %173 None + OpBranchConditional %174 %54 %173 + %173 = OpLabel + OpBranch %55 + %55 = OpLabel + %131 = OpLoad %10 %48 + %132 = OpIAdd %10 %131 %18 + OpStore %48 %132 + OpBranch %52 + %54 = OpLabel + %176 = OpLoad %46 %171 + OpSelectionMerge %175 None + OpBranchConditional %176 %40 %175 + %175 = OpLabel + OpBranch %41 + %41 = OpLabel + %133 = OpLoad %10 %35 + %134 = OpIAdd %10 %133 %18 + OpStore %35 %134 + OpBranch %38 + %40 = OpLabel + %178 = OpLoad %46 %171 + OpSelectionMerge %177 None + OpBranchConditional %178 %166 %177 + %177 = OpLabel + %135 = OpLoad %6 %25 + %136 = OpAccessChain %31 %30 %17 %18 + %137 = OpLoad %6 %136 + %138 = OpFOrdGreaterThan %46 %135 %137 + OpSelectionMerge %140 None + OpBranchConditional %138 %139 %140 + %139 = OpLabel + %141 = OpLoad %6 %25 + %142 = OpAccessChain %31 %30 %17 %49 + %143 = OpLoad %6 %142 + %144 = OpFOrdLessThan %46 %141 %143 + OpBranch %140 + %140 = OpLabel + %145 = OpPhi %46 %138 %177 %144 %139 + OpSelectionMerge %147 None + OpBranchConditional %145 %146 %161 + %146 = OpLabel + %151 = OpAccessChain %19 %16 %17 %49 + %152 = OpLoad %10 %151 + %153 = OpConvertSToF %6 %152 + %160 = OpCompositeConstruct %7 %22 %153 %153 %22 + OpStore %9 %160 + OpBranch %147 + %161 = OpLabel + %162 = OpAccessChain %19 %16 %17 %49 + %163 = OpLoad %10 %162 + %164 = OpConvertSToF %6 %163 + %165 = OpCompositeConstruct %7 %164 %164 %164 %164 + OpStore %9 %165 + OpBranch %147 + %147 = OpLabel + OpStore %171 %172 + OpBranch %166 + %166 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 5 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 3.9 4.1 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-while-condition-integer-range-increment-variable.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-while-condition-integer-range-increment-variable.amber new file mode 100644 index 0000000..5cc860e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-while-condition-integer-range-increment-variable.amber @@ -0,0 +1,312 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_8 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 8] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# // Iterates i = 1, 2, 4, 8. +# for(int i = 1; i <= 10; i *= 2) +# { +# for(int j = 0; j < 10; j += i) +# { +# int b = j + i - 1; +# // For the last iteration of the outer loop i = 8 and j iterates values 0 and 8. +# // The last assignment to a is 8. +# a = j; +# +# +# // The condition of the while loop below can be opened as follows: +# // a <= b <= 1 +# // j <= j + i - 1 <= 1 +# // +# // Because j <= 1 the values for j can be 0 and 1. +# // Therefore j + i - 1 <= 1 gives us: +# // 0 + i - 1 <= 1 +# // i <= 2 +# // and +# // 1 + i - 1 <= 1 +# // i <= 1 +# // +# // i starts at one so the condition is true when i = 1 or 2 and j = 0 or 1. +# +# // This condition is false during the last iteration of i = 8 and j = 8. +# while(a <= b && b <= 1) +# { +# // Always false. +# if(gl_FragCoord.x < _float_0_0) +# { +# discard; +# } +# a++; +# } +# } +# } +# +# // Always true. The last iteration assigned i = 8 but didn't increment it in a while loop. +# if(a == _int_8) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 109 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %58 %90 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %30 "j" + OpName %38 "b" + OpName %58 "gl_FragCoord" + OpName %65 "buf1" + OpMemberName %65 0 "_GLF_uniform_float_values" + OpName %67 "" + OpName %90 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %58 BuiltIn FragCoord + OpDecorate %64 ArrayStride 16 + OpMemberDecorate %65 0 Offset 0 + OpDecorate %65 Block + OpDecorate %67 DescriptorSet 0 + OpDecorate %67 Binding 1 + OpDecorate %90 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %27 = OpConstant %6 10 + %28 = OpTypeBool + %55 = OpTypeFloat 32 + %56 = OpTypeVector %55 4 + %57 = OpTypePointer Input %56 + %58 = OpVariable %57 Input + %59 = OpConstant %9 0 + %60 = OpTypePointer Input %55 + %63 = OpConstant %9 1 + %64 = OpTypeArray %55 %63 + %65 = OpTypeStruct %64 + %66 = OpTypePointer Uniform %65 + %67 = OpVariable %66 Uniform + %68 = OpTypePointer Uniform %55 + %80 = OpConstant %6 2 + %89 = OpTypePointer Output %56 + %90 = OpVariable %89 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %30 = OpVariable %7 Function + %38 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpStore %20 %16 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %6 %20 + %29 = OpSLessThanEqual %28 %26 %27 + OpBranchConditional %29 %22 %23 + %22 = OpLabel + OpStore %30 %15 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %6 %30 + %37 = OpSLessThan %28 %36 %27 + OpBranchConditional %37 %32 %33 + %32 = OpLabel + %39 = OpLoad %6 %30 + %40 = OpLoad %6 %20 + %41 = OpIAdd %6 %39 %40 + %42 = OpISub %6 %41 %16 + OpStore %38 %42 + %43 = OpLoad %6 %30 + OpStore %8 %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %6 %8 + %50 = OpLoad %6 %38 + %51 = OpSLessThanEqual %28 %49 %50 + %52 = OpLoad %6 %38 + %53 = OpSLessThanEqual %28 %52 %16 + %54 = OpLogicalAnd %28 %51 %53 + OpBranchConditional %54 %45 %46 + %45 = OpLabel + %61 = OpAccessChain %60 %58 %59 + %62 = OpLoad %55 %61 + %69 = OpAccessChain %68 %67 %15 %15 + %70 = OpLoad %55 %69 + %71 = OpFOrdLessThan %28 %62 %70 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %73 + %72 = OpLabel + OpTerminateInvocation + %73 = OpLabel + %75 = OpLoad %6 %8 + %76 = OpIAdd %6 %75 %16 + OpStore %8 %76 + OpBranch %47 + %47 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %34 + %34 = OpLabel + %77 = OpLoad %6 %20 + %78 = OpLoad %6 %30 + %79 = OpIAdd %6 %78 %77 + OpStore %30 %79 + OpBranch %31 + %33 = OpLabel + OpBranch %24 + %24 = OpLabel + %81 = OpLoad %6 %20 + %82 = OpIMul %6 %81 %80 + OpStore %20 %82 + OpBranch %21 + %23 = OpLabel + %83 = OpLoad %6 %8 + %84 = OpAccessChain %17 %14 %15 %80 + %85 = OpLoad %6 %84 + %86 = OpIEqual %28 %83 %85 + OpSelectionMerge %88 None + OpBranchConditional %86 %87 %104 + %87 = OpLabel + %91 = OpAccessChain %17 %14 %15 %15 + %92 = OpLoad %6 %91 + %93 = OpConvertSToF %55 %92 + %94 = OpAccessChain %17 %14 %15 %16 + %95 = OpLoad %6 %94 + %96 = OpConvertSToF %55 %95 + %97 = OpAccessChain %17 %14 %15 %16 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %55 %98 + %100 = OpAccessChain %17 %14 %15 %15 + %101 = OpLoad %6 %100 + %102 = OpConvertSToF %55 %101 + %103 = OpCompositeConstruct %56 %93 %96 %99 %102 + OpStore %90 %103 + OpBranch %88 + %104 = OpLabel + %105 = OpAccessChain %17 %14 %15 %16 + %106 = OpLoad %6 %105 + %107 = OpConvertSToF %55 %106 + %108 = OpCompositeConstruct %56 %107 %107 %107 %107 + OpStore %90 %108 + OpBranch %88 + %88 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 8 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-loops-while-min-iterator-condition-always-false.amber b/vulkan/amber/graphicsfuzz/cov-nested-loops-while-min-iterator-condition-always-false.amber new file mode 100644 index 0000000..b8642fc --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-loops-while-min-iterator-condition-always-false.amber @@ -0,0 +1,320 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_5 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_2_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 2.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 5, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v = vec4(_int_1); +# int a = _int_0; +# +# // Iterates once. +# for(int m = 1; m <= 1; m *= 2) +# { +# // Iterates five times. +# for(int i = 1; i < 10; i += 2 * m) +# { +# a++; +# +# // min(i - 1, 10) is always i - 1 because i < 10 from the loop condition above. +# // Therefore the condition below becomes i <= i - 1, which is always false. +# while(i <= min(i - 1, 10)) +# { +# for(int j = 3; j >= 1; j--) +# { +# v[j] /= _float_2_0; +# } +# } +# } +# } +# +# // Always true. +# if(a == _int_5 && v == vec4(_int_1)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 127 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %108 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %25 "a" + OpName %28 "m" + OpName %38 "i" + OpName %59 "j" + OpName %71 "buf0" + OpMemberName %71 0 "_GLF_uniform_float_values" + OpName %73 "" + OpName %108 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %70 ArrayStride 16 + OpMemberDecorate %71 0 Offset 0 + OpDecorate %71 Block + OpDecorate %73 DescriptorSet 0 + OpDecorate %73 Binding 0 + OpDecorate %108 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 3 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpConstant %10 2 + %19 = OpTypePointer Uniform %10 + %24 = OpTypePointer Function %10 + %29 = OpConstant %10 1 + %36 = OpTypeBool + %45 = OpConstant %10 10 + %60 = OpConstant %10 3 + %69 = OpConstant %11 1 + %70 = OpTypeArray %6 %69 + %71 = OpTypeStruct %70 + %72 = OpTypePointer Uniform %71 + %73 = OpVariable %72 Uniform + %74 = OpTypePointer Uniform %6 + %77 = OpTypePointer Function %6 + %101 = OpTypeVector %36 4 + %107 = OpTypePointer Output %7 + %108 = OpVariable %107 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %25 = OpVariable %24 Function + %28 = OpVariable %24 Function + %38 = OpVariable %24 Function + %59 = OpVariable %24 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %10 %20 + %22 = OpConvertSToF %6 %21 + %23 = OpCompositeConstruct %7 %22 %22 %22 %22 + OpStore %9 %23 + %26 = OpAccessChain %19 %16 %17 %17 + %27 = OpLoad %10 %26 + OpStore %25 %27 + OpStore %28 %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %10 %28 + %37 = OpSLessThanEqual %36 %35 %29 + OpBranchConditional %37 %31 %32 + %31 = OpLabel + OpStore %38 %29 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %10 %38 + %46 = OpSLessThan %36 %44 %45 + OpBranchConditional %46 %40 %41 + %40 = OpLabel + %47 = OpLoad %10 %25 + %48 = OpIAdd %10 %47 %29 + OpStore %25 %48 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %10 %38 + %55 = OpLoad %10 %38 + %56 = OpISub %10 %55 %29 + %57 = OpExtInst %10 %1 SMin %56 %45 + %58 = OpSLessThanEqual %36 %54 %57 + OpBranchConditional %58 %50 %51 + %50 = OpLabel + OpStore %59 %60 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %66 = OpLoad %10 %59 + %67 = OpSGreaterThanEqual %36 %66 %29 + OpBranchConditional %67 %62 %63 + %62 = OpLabel + %68 = OpLoad %10 %59 + %75 = OpAccessChain %74 %73 %17 %17 + %76 = OpLoad %6 %75 + %78 = OpAccessChain %77 %9 %68 + %79 = OpLoad %6 %78 + %80 = OpFDiv %6 %79 %76 + %81 = OpAccessChain %77 %9 %68 + OpStore %81 %80 + OpBranch %64 + %64 = OpLabel + %82 = OpLoad %10 %59 + %83 = OpISub %10 %82 %29 + OpStore %59 %83 + OpBranch %61 + %63 = OpLabel + OpBranch %52 + %52 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %42 + %42 = OpLabel + %84 = OpLoad %10 %28 + %85 = OpIMul %10 %18 %84 + %86 = OpLoad %10 %38 + %87 = OpIAdd %10 %86 %85 + OpStore %38 %87 + OpBranch %39 + %41 = OpLabel + OpBranch %33 + %33 = OpLabel + %88 = OpLoad %10 %28 + %89 = OpIMul %10 %88 %18 + OpStore %28 %89 + OpBranch %30 + %32 = OpLabel + %90 = OpLoad %10 %25 + %91 = OpAccessChain %19 %16 %17 %29 + %92 = OpLoad %10 %91 + %93 = OpIEqual %36 %90 %92 + OpSelectionMerge %95 None + OpBranchConditional %93 %94 %95 + %94 = OpLabel + %96 = OpLoad %7 %9 + %97 = OpAccessChain %19 %16 %17 %18 + %98 = OpLoad %10 %97 + %99 = OpConvertSToF %6 %98 + %100 = OpCompositeConstruct %7 %99 %99 %99 %99 + %102 = OpFOrdEqual %101 %96 %100 + %103 = OpAll %36 %102 + OpBranch %95 + %95 = OpLabel + %104 = OpPhi %36 %93 %32 %103 %94 + OpSelectionMerge %106 None + OpBranchConditional %104 %105 %122 + %105 = OpLabel + %109 = OpAccessChain %19 %16 %17 %18 + %110 = OpLoad %10 %109 + %111 = OpConvertSToF %6 %110 + %112 = OpAccessChain %19 %16 %17 %17 + %113 = OpLoad %10 %112 + %114 = OpConvertSToF %6 %113 + %115 = OpAccessChain %19 %16 %17 %17 + %116 = OpLoad %10 %115 + %117 = OpConvertSToF %6 %116 + %118 = OpAccessChain %19 %16 %17 %18 + %119 = OpLoad %10 %118 + %120 = OpConvertSToF %6 %119 + %121 = OpCompositeConstruct %7 %111 %114 %117 %120 + OpStore %108 %121 + OpBranch %106 + %122 = OpLabel + %123 = OpAccessChain %19 %16 %17 %17 + %124 = OpLoad %10 %123 + %125 = OpConvertSToF %6 %124 + %126 = OpCompositeConstruct %7 %125 %125 %125 %125 + OpStore %108 %126 + OpBranch %106 + %106 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 5 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nested-structs-function-set-inner-struct-field-return.amber b/vulkan/amber/graphicsfuzz/cov-nested-structs-function-set-inner-struct-field-return.amber new file mode 100644 index 0000000..05c5cc5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nested-structs-function-set-inner-struct-field-return.amber @@ -0,0 +1,262 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--convert-local-access-chains' +# '--reduce-load-size' +# '--simplify-instructions' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-local-single-block' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--redundancy-elimination' +# '--convert-local-access-chains' +# '--eliminate-local-single-store' +# '--eliminate-dead-branches' +# '--merge-return' +# '--scalar-replacement=100' +# '--eliminate-dead-inserts' +# '--eliminate-local-single-block' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-block' +# '--eliminate-dead-branches' +# '--merge-return' +# '--simplify-instructions' +# '--copy-propagate-arrays' +# '--reduce-load-size' +# '--scalar-replacement=100' +# '--eliminate-dead-inserts' +# '--eliminate-dead-inserts' +# '--vector-dce' +# '--combine-access-chains' +# '--eliminate-local-multi-store' +# '--if-conversion' +# '--combine-access-chains' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [3, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S0 +# { +# int a; +# }; +# +# struct S1 +# { +# S0 data0; +# // data1 is unused. +# vec4 data1; +# }; +# +# // This function always returns one. +# int func() +# { +# S1 s; +# +# for(int i = _int_0; i < _int_3; i++) +# { +# s.data0.a = _int_1; +# } +# +# return s.data0.a; +# } +# +# void main() +# { +# // Always true. +# if(func() == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 102 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %56 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "i" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %33 "S0" + OpMemberName %33 0 "a" + OpName %36 "S1" + OpMemberName %36 0 "data0" + OpMemberName %36 1 "data1" + OpName %56 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %56 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 3 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpConstant %6 2 + %20 = OpTypePointer Uniform %6 + %31 = OpTypeBool + %33 = OpTypeStruct %6 + %34 = OpTypeFloat 32 + %35 = OpTypeVector %34 4 + %36 = OpTypeStruct %33 %35 + %37 = OpTypePointer Function %36 + %39 = OpConstant %6 1 + %55 = OpTypePointer Output %35 + %56 = OpVariable %55 Output + %78 = OpTypePointer Function %33 + %80 = OpTypePointer Function %35 + %99 = OpUndef %35 + %101 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %49 = OpFunctionCall %6 %8 + %50 = OpAccessChain %20 %17 %18 %39 + %51 = OpLoad %6 %50 + %52 = OpIEqual %31 %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %70 + %53 = OpLabel + %59 = OpConvertSToF %34 %51 + %60 = OpAccessChain %20 %17 %18 %19 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %34 %61 + %69 = OpCompositeConstruct %35 %59 %62 %62 %59 + OpStore %56 %69 + OpBranch %54 + %70 = OpLabel + %71 = OpAccessChain %20 %17 %18 %19 + %72 = OpLoad %6 %71 + %73 = OpConvertSToF %34 %72 + %74 = OpCompositeConstruct %35 %73 %73 %73 %73 + OpStore %56 %74 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %91 = OpVariable %10 Function + %81 = OpVariable %80 Function + %11 = OpVariable %10 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %6 %21 + OpStore %11 %22 + OpBranch %23 + %23 = OpLabel + %100 = OpPhi %6 %101 %9 %94 %24 + %98 = OpPhi %35 %99 %9 %98 %24 + %97 = OpPhi %6 %22 %9 %44 %24 + %29 = OpAccessChain %20 %17 %18 %18 + %30 = OpLoad %6 %29 + %32 = OpSLessThan %31 %97 %30 + OpLoopMerge %25 %24 None + OpBranchConditional %32 %24 %25 + %24 = OpLabel + %40 = OpAccessChain %20 %17 %18 %39 + %41 = OpLoad %6 %40 + %93 = OpCompositeConstruct %33 %100 + %85 = OpCompositeConstruct %36 %93 %98 + %76 = OpCompositeInsert %36 %41 %85 0 0 + %86 = OpCompositeExtract %33 %76 0 + %94 = OpCompositeExtract %6 %86 0 + OpStore %91 %94 + OpStore %81 %98 + %44 = OpIAdd %6 %97 %39 + OpStore %11 %44 + OpBranch %23 + %25 = OpLabel + %96 = OpCompositeConstruct %33 %100 + %90 = OpCompositeConstruct %36 %96 %98 + OpReturnValue %100 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nir-array-access.amber b/vulkan/amber/graphicsfuzz/cov-nir-array-access.amber new file mode 100644 index 0000000..446d5e2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nir-array-access.amber @@ -0,0 +1,365 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific nir path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_100 _GLF_uniform_int_values[0] +# #define _int_17 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_2 _GLF_uniform_int_values[4] +# #define _int_3 _GLF_uniform_int_values[5] +# #define _int_4 _GLF_uniform_int_values[6] +# #define _int_5 _GLF_uniform_int_values[7] +# #define _int_6 _GLF_uniform_int_values[8] +# #define _int_7 _GLF_uniform_int_values[9] +# #define _int_8 _GLF_uniform_int_values[10] +# #define _int_9 _GLF_uniform_int_values[11] +# #define _int_10 _GLF_uniform_int_values[12] +# #define _int_11 _GLF_uniform_int_values[13] +# #define _int_12 _GLF_uniform_int_values[14] +# #define _int_13 _GLF_uniform_int_values[15] +# #define _int_14 _GLF_uniform_int_values[16] +# #define _int_15 _GLF_uniform_int_values[17] +# #define _int_16 _GLF_uniform_int_values[18] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: +# // [100, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[19]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int A[17] = int[17](_int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, +# _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, +# _int_0, _int_0, _int_0); +# int ref[17] = int[17](_int_1, _int_2, _int_3, _int_4, _int_5, _int_6, +# _int_7, _int_8, _int_9, _int_10, _int_11, _int_12, +# _int_13, _int_14, _int_15, _int_16, _int_17); +# +# int a = _int_0; +# for (int i = _int_0; i < _int_17; i++) +# { +# A[i] = a--; +# A[clamp(i, _int_0, _int_16)] = i + _int_1; +# } +# +# bool ok = true; +# for (int i = _int_0; i < _int_17; i++) +# { +# if (A[i] != ref[i]) +# ok = false; +# } +# +# _GLF_color = vec4(_int_0); +# +# if (ok) +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 193 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %172 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "A" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %55 "ref" + OpName %109 "a" + OpName %112 "i" + OpName %143 "ok" + OpName %145 "i" + OpName %172 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %172 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 17 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 19 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 2 + %19 = OpTypePointer Uniform %6 + %56 = OpConstant %6 3 + %59 = OpConstant %6 4 + %62 = OpConstant %6 5 + %65 = OpConstant %6 6 + %68 = OpConstant %6 7 + %71 = OpConstant %6 8 + %74 = OpConstant %6 9 + %77 = OpConstant %6 10 + %80 = OpConstant %6 11 + %83 = OpConstant %6 12 + %86 = OpConstant %6 13 + %89 = OpConstant %6 14 + %92 = OpConstant %6 15 + %95 = OpConstant %6 16 + %98 = OpConstant %6 17 + %101 = OpConstant %6 18 + %104 = OpConstant %6 1 + %108 = OpTypePointer Function %6 + %123 = OpTypeBool + %142 = OpTypePointer Function %123 + %144 = OpConstantTrue %123 + %166 = OpConstantFalse %123 + %169 = OpTypeFloat 32 + %170 = OpTypeVector %169 4 + %171 = OpTypePointer Output %170 + %172 = OpVariable %171 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %55 = OpVariable %10 Function + %109 = OpVariable %108 Function + %112 = OpVariable %108 Function + %143 = OpVariable %142 Function + %145 = OpVariable %108 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %16 %17 %18 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %19 %16 %17 %18 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %19 %16 %17 %18 + %27 = OpLoad %6 %26 + %28 = OpAccessChain %19 %16 %17 %18 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %19 %16 %17 %18 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %19 %16 %17 %18 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %19 %16 %17 %18 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %19 %16 %17 %18 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %19 %16 %17 %18 + %39 = OpLoad %6 %38 + %40 = OpAccessChain %19 %16 %17 %18 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %19 %16 %17 %18 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %19 %16 %17 %18 + %45 = OpLoad %6 %44 + %46 = OpAccessChain %19 %16 %17 %18 + %47 = OpLoad %6 %46 + %48 = OpAccessChain %19 %16 %17 %18 + %49 = OpLoad %6 %48 + %50 = OpAccessChain %19 %16 %17 %18 + %51 = OpLoad %6 %50 + %52 = OpAccessChain %19 %16 %17 %18 + %53 = OpLoad %6 %52 + %54 = OpCompositeConstruct %9 %21 %23 %25 %27 %29 %31 %33 %35 %37 %39 %41 %43 %45 %47 %49 %51 %53 + OpStore %11 %54 + %57 = OpAccessChain %19 %16 %17 %56 + %58 = OpLoad %6 %57 + %60 = OpAccessChain %19 %16 %17 %59 + %61 = OpLoad %6 %60 + %63 = OpAccessChain %19 %16 %17 %62 + %64 = OpLoad %6 %63 + %66 = OpAccessChain %19 %16 %17 %65 + %67 = OpLoad %6 %66 + %69 = OpAccessChain %19 %16 %17 %68 + %70 = OpLoad %6 %69 + %72 = OpAccessChain %19 %16 %17 %71 + %73 = OpLoad %6 %72 + %75 = OpAccessChain %19 %16 %17 %74 + %76 = OpLoad %6 %75 + %78 = OpAccessChain %19 %16 %17 %77 + %79 = OpLoad %6 %78 + %81 = OpAccessChain %19 %16 %17 %80 + %82 = OpLoad %6 %81 + %84 = OpAccessChain %19 %16 %17 %83 + %85 = OpLoad %6 %84 + %87 = OpAccessChain %19 %16 %17 %86 + %88 = OpLoad %6 %87 + %90 = OpAccessChain %19 %16 %17 %89 + %91 = OpLoad %6 %90 + %93 = OpAccessChain %19 %16 %17 %92 + %94 = OpLoad %6 %93 + %96 = OpAccessChain %19 %16 %17 %95 + %97 = OpLoad %6 %96 + %99 = OpAccessChain %19 %16 %17 %98 + %100 = OpLoad %6 %99 + %102 = OpAccessChain %19 %16 %17 %101 + %103 = OpLoad %6 %102 + %105 = OpAccessChain %19 %16 %17 %104 + %106 = OpLoad %6 %105 + %107 = OpCompositeConstruct %9 %58 %61 %64 %67 %70 %73 %76 %79 %82 %85 %88 %91 %94 %97 %100 %103 %106 + OpStore %55 %107 + %110 = OpAccessChain %19 %16 %17 %18 + %111 = OpLoad %6 %110 + OpStore %109 %111 + %113 = OpAccessChain %19 %16 %17 %18 + %114 = OpLoad %6 %113 + OpStore %112 %114 + OpBranch %115 + %115 = OpLabel + OpLoopMerge %117 %118 None + OpBranch %119 + %119 = OpLabel + %120 = OpLoad %6 %112 + %121 = OpAccessChain %19 %16 %17 %104 + %122 = OpLoad %6 %121 + %124 = OpSLessThan %123 %120 %122 + OpBranchConditional %124 %116 %117 + %116 = OpLabel + %125 = OpLoad %6 %112 + %126 = OpLoad %6 %109 + %127 = OpISub %6 %126 %104 + OpStore %109 %127 + %128 = OpAccessChain %108 %11 %125 + OpStore %128 %126 + %129 = OpLoad %6 %112 + %130 = OpAccessChain %19 %16 %17 %18 + %131 = OpLoad %6 %130 + %132 = OpAccessChain %19 %16 %17 %101 + %133 = OpLoad %6 %132 + %134 = OpExtInst %6 %1 SClamp %129 %131 %133 + %135 = OpLoad %6 %112 + %136 = OpAccessChain %19 %16 %17 %56 + %137 = OpLoad %6 %136 + %138 = OpIAdd %6 %135 %137 + %139 = OpAccessChain %108 %11 %134 + OpStore %139 %138 + OpBranch %118 + %118 = OpLabel + %140 = OpLoad %6 %112 + %141 = OpIAdd %6 %140 %104 + OpStore %112 %141 + OpBranch %115 + %117 = OpLabel + OpStore %143 %144 + %146 = OpAccessChain %19 %16 %17 %18 + %147 = OpLoad %6 %146 + OpStore %145 %147 + OpBranch %148 + %148 = OpLabel + OpLoopMerge %150 %151 None + OpBranch %152 + %152 = OpLabel + %153 = OpLoad %6 %145 + %154 = OpAccessChain %19 %16 %17 %104 + %155 = OpLoad %6 %154 + %156 = OpSLessThan %123 %153 %155 + OpBranchConditional %156 %149 %150 + %149 = OpLabel + %157 = OpLoad %6 %145 + %158 = OpAccessChain %108 %11 %157 + %159 = OpLoad %6 %158 + %160 = OpLoad %6 %145 + %161 = OpAccessChain %108 %55 %160 + %162 = OpLoad %6 %161 + %163 = OpINotEqual %123 %159 %162 + OpSelectionMerge %165 None + OpBranchConditional %163 %164 %165 + %164 = OpLabel + OpStore %143 %166 + OpBranch %165 + %165 = OpLabel + OpBranch %151 + %151 = OpLabel + %167 = OpLoad %6 %145 + %168 = OpIAdd %6 %167 %104 + OpStore %145 %168 + OpBranch %148 + %150 = OpLabel + %173 = OpAccessChain %19 %16 %17 %18 + %174 = OpLoad %6 %173 + %175 = OpConvertSToF %169 %174 + %176 = OpCompositeConstruct %170 %175 %175 %175 %175 + OpStore %172 %176 + %177 = OpLoad %123 %143 + OpSelectionMerge %179 None + OpBranchConditional %177 %178 %179 + %178 = OpLabel + %180 = OpAccessChain %19 %16 %17 %56 + %181 = OpLoad %6 %180 + %182 = OpConvertSToF %169 %181 + %183 = OpAccessChain %19 %16 %17 %18 + %184 = OpLoad %6 %183 + %185 = OpConvertSToF %169 %184 + %186 = OpAccessChain %19 %16 %17 %18 + %187 = OpLoad %6 %186 + %188 = OpConvertSToF %169 %187 + %189 = OpAccessChain %19 %16 %17 %56 + %190 = OpLoad %6 %189 + %191 = OpConvertSToF %169 %190 + %192 = OpCompositeConstruct %170 %182 %185 %188 %191 + OpStore %172 %192 + OpBranch %179 + %179 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 100 17 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access.amber b/vulkan/amber/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access.amber new file mode 100644 index 0000000..351af49 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access.amber @@ -0,0 +1,232 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific nir opt large constants path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_33 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [33, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v1 = vec4(_float_1_0); +# for (int i = _int_0; i < _int_33; i++) +# { +# int a = int(vec4[2](vec4(1.0), vec4(0.0))[clamp(i, _int_0, _int_1)].x); +# v1 = vec4[2](vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0), +# vec4(_float_0_0, _float_1_0, _float_1_0, _float_0_0))[a]; +# } +# _GLF_color = v1; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 92 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %90 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v1" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %23 "i" + OpName %26 "buf1" + OpMemberName %26 0 "_GLF_uniform_int_values" + OpName %28 "" + OpName %43 "a" + OpName %59 "indexable" + OpName %84 "indexable" + OpName %90 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %25 ArrayStride 16 + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 1 + OpDecorate %90 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %6 + %22 = OpTypePointer Function %16 + %24 = OpConstant %10 3 + %25 = OpTypeArray %16 %24 + %26 = OpTypeStruct %25 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpConstant %16 1 + %30 = OpTypePointer Uniform %16 + %41 = OpTypeBool + %44 = OpTypeArray %7 %11 + %45 = OpConstant %6 1 + %46 = OpConstantComposite %7 %45 %45 %45 %45 + %47 = OpConstant %6 0 + %48 = OpConstantComposite %7 %47 %47 %47 %47 + %49 = OpConstantComposite %44 %46 %48 + %53 = OpConstant %16 2 + %57 = OpConstant %10 0 + %58 = OpTypePointer Function %44 + %60 = OpTypePointer Function %6 + %89 = OpTypePointer Output %7 + %90 = OpVariable %89 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %23 = OpVariable %22 Function + %43 = OpVariable %22 Function + %59 = OpVariable %58 Function + %84 = OpVariable %58 Function + %19 = OpAccessChain %18 %15 %17 %17 + %20 = OpLoad %6 %19 + %21 = OpCompositeConstruct %7 %20 %20 %20 %20 + OpStore %9 %21 + %31 = OpAccessChain %30 %28 %17 %29 + %32 = OpLoad %16 %31 + OpStore %23 %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %16 %23 + %39 = OpAccessChain %30 %28 %17 %17 + %40 = OpLoad %16 %39 + %42 = OpSLessThan %41 %38 %40 + OpBranchConditional %42 %34 %35 + %34 = OpLabel + %50 = OpLoad %16 %23 + %51 = OpAccessChain %30 %28 %17 %29 + %52 = OpLoad %16 %51 + %54 = OpAccessChain %30 %28 %17 %53 + %55 = OpLoad %16 %54 + %56 = OpExtInst %16 %1 SClamp %50 %52 %55 + OpStore %59 %49 + %61 = OpAccessChain %60 %59 %56 %57 + %62 = OpLoad %6 %61 + %63 = OpConvertFToS %16 %62 + OpStore %43 %63 + %64 = OpAccessChain %18 %15 %17 %17 + %65 = OpLoad %6 %64 + %66 = OpAccessChain %18 %15 %17 %29 + %67 = OpLoad %6 %66 + %68 = OpAccessChain %18 %15 %17 %29 + %69 = OpLoad %6 %68 + %70 = OpAccessChain %18 %15 %17 %17 + %71 = OpLoad %6 %70 + %72 = OpCompositeConstruct %7 %65 %67 %69 %71 + %73 = OpAccessChain %18 %15 %17 %29 + %74 = OpLoad %6 %73 + %75 = OpAccessChain %18 %15 %17 %17 + %76 = OpLoad %6 %75 + %77 = OpAccessChain %18 %15 %17 %17 + %78 = OpLoad %6 %77 + %79 = OpAccessChain %18 %15 %17 %29 + %80 = OpLoad %6 %79 + %81 = OpCompositeConstruct %7 %74 %76 %78 %80 + %82 = OpCompositeConstruct %44 %72 %81 + %83 = OpLoad %16 %43 + OpStore %84 %82 + %85 = OpAccessChain %8 %84 %83 + %86 = OpLoad %7 %85 + OpStore %9 %86 + OpBranch %36 + %36 = OpLabel + %87 = OpLoad %16 %23 + %88 = OpIAdd %16 %87 %29 + OpStore %23 %88 + OpBranch %33 + %35 = OpLabel + %91 = OpLoad %7 %9 + OpStore %90 %91 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 33 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while.amber b/vulkan/amber/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while.amber new file mode 100644 index 0000000..d940e82 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while.amber @@ -0,0 +1,250 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific nir opt loop unroll path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_float_0_0); +# +# float a = _float_1_0; +# +# do +# { +# // Always false. +# if ((_float_1_0 / 0.2) < _float_1_0) +# return; +# +# // Always false. +# if ((_float_1_0 / 0.2) < _float_1_0) +# return; +# +# // Always false. +# if ((_float_1_0 / 0.2) < _float_1_0) +# return; +# +# // Always false. +# if ((_float_1_0 / 0.2) < _float_1_0) +# return; +# else +# a = 0.0; +# +# } while (a != 0.0); +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 91 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %24 "a" + OpName %74 "buf1" + OpMemberName %74 0 "_GLF_uniform_int_values" + OpName %76 "" + OpDecorate %9 Location 0 + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %73 ArrayStride 16 + OpMemberDecorate %74 0 Offset 0 + OpDecorate %74 Block + OpDecorate %76 DescriptorSet 0 + OpDecorate %76 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpConstant %16 1 + %19 = OpTypePointer Uniform %6 + %23 = OpTypePointer Function %6 + %33 = OpConstant %6 0.200000003 + %37 = OpTypeBool + %70 = OpConstant %6 0 + %73 = OpTypeArray %16 %11 + %74 = OpTypeStruct %73 + %75 = OpTypePointer Uniform %74 + %76 = OpVariable %75 Uniform + %77 = OpTypePointer Uniform %16 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %24 = OpVariable %23 Function + %20 = OpAccessChain %19 %15 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpCompositeConstruct %7 %21 %21 %21 %21 + OpStore %9 %22 + %25 = OpAccessChain %19 %15 %17 %17 + %26 = OpLoad %6 %25 + OpStore %24 %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %28 + %28 = OpLabel + %31 = OpAccessChain %19 %15 %17 %17 + %32 = OpLoad %6 %31 + %34 = OpFDiv %6 %32 %33 + %35 = OpAccessChain %19 %15 %17 %17 + %36 = OpLoad %6 %35 + %38 = OpFOrdLessThan %37 %34 %36 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + OpReturn + %40 = OpLabel + %42 = OpAccessChain %19 %15 %17 %17 + %43 = OpLoad %6 %42 + %44 = OpFDiv %6 %43 %33 + %45 = OpAccessChain %19 %15 %17 %17 + %46 = OpLoad %6 %45 + %47 = OpFOrdLessThan %37 %44 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %49 + %48 = OpLabel + OpReturn + %49 = OpLabel + %51 = OpAccessChain %19 %15 %17 %17 + %52 = OpLoad %6 %51 + %53 = OpFDiv %6 %52 %33 + %54 = OpAccessChain %19 %15 %17 %17 + %55 = OpLoad %6 %54 + %56 = OpFOrdLessThan %37 %53 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + OpReturn + %58 = OpLabel + %60 = OpAccessChain %19 %15 %17 %17 + %61 = OpLoad %6 %60 + %62 = OpFDiv %6 %61 %33 + %63 = OpAccessChain %19 %15 %17 %17 + %64 = OpLoad %6 %63 + %65 = OpFOrdLessThan %37 %62 %64 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %69 + %66 = OpLabel + OpReturn + %69 = OpLabel + OpStore %24 %70 + OpBranch %67 + %67 = OpLabel + OpBranch %30 + %30 = OpLabel + %71 = OpLoad %6 %24 + %72 = OpFUnordNotEqual %37 %71 %70 + OpBranchConditional %72 %27 %29 + %29 = OpLabel + %78 = OpAccessChain %77 %76 %17 %18 + %79 = OpLoad %16 %78 + %80 = OpConvertSToF %6 %79 + %81 = OpAccessChain %77 %76 %17 %17 + %82 = OpLoad %16 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpAccessChain %77 %76 %17 %17 + %85 = OpLoad %16 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpAccessChain %77 %76 %17 %18 + %88 = OpLoad %16 %87 + %89 = OpConvertSToF %6 %88 + %90 = OpCompositeConstruct %7 %80 %83 %86 %89 + OpStore %9 %90 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-not-clamp-matrix-access.amber b/vulkan/amber/graphicsfuzz/cov-not-clamp-matrix-access.amber new file mode 100644 index 0000000..91fb2cd --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-not-clamp-matrix-access.amber @@ -0,0 +1,252 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific selection dag code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_10_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_2_0 _GLF_uniform_float_values[2] +# #define _float_3_0 _GLF_uniform_float_values[3] +# #define _float_4_0 _GLF_uniform_float_values[4] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [10.0, 1.0, 2.0, 3.0, 4.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[5]; +# }; +# +# // Contents of _GLF_uniform_int_values: [3, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat2 M1 = mat2(_float_1_0, _float_2_0, _float_3_0, _float_4_0); +# float a = _float_1_0; +# +# for (int c = _int_0; c < _int_3; c++) +# { +# // At each iteration, clamp returns 0. +# a += M1[_int_1][clamp(~c, 0, 1)]; +# } +# +# if (a == _float_10_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 99 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %80 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "M1" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %38 "a" + OpName %42 "c" + OpName %45 "buf1" + OpMemberName %45 0 "_GLF_uniform_int_values" + OpName %47 "" + OpName %80 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %44 ArrayStride 16 + OpMemberDecorate %45 0 Offset 0 + OpDecorate %45 Block + OpDecorate %47 DescriptorSet 0 + OpDecorate %47 Binding 1 + OpDecorate %80 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeMatrix %7 2 + %9 = OpTypePointer Function %8 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 5 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpConstant %17 1 + %20 = OpTypePointer Uniform %6 + %23 = OpConstant %17 2 + %26 = OpConstant %17 3 + %29 = OpConstant %17 4 + %32 = OpConstant %6 1 + %33 = OpConstant %6 0 + %37 = OpTypePointer Function %6 + %41 = OpTypePointer Function %17 + %43 = OpConstant %11 3 + %44 = OpTypeArray %17 %43 + %45 = OpTypeStruct %44 + %46 = OpTypePointer Uniform %45 + %47 = OpVariable %46 Uniform + %48 = OpTypePointer Uniform %17 + %59 = OpTypeBool + %78 = OpTypeVector %6 4 + %79 = OpTypePointer Output %78 + %80 = OpVariable %79 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %38 = OpVariable %37 Function + %42 = OpVariable %41 Function + %21 = OpAccessChain %20 %16 %18 %19 + %22 = OpLoad %6 %21 + %24 = OpAccessChain %20 %16 %18 %23 + %25 = OpLoad %6 %24 + %27 = OpAccessChain %20 %16 %18 %26 + %28 = OpLoad %6 %27 + %30 = OpAccessChain %20 %16 %18 %29 + %31 = OpLoad %6 %30 + %34 = OpCompositeConstruct %7 %22 %25 + %35 = OpCompositeConstruct %7 %28 %31 + %36 = OpCompositeConstruct %8 %34 %35 + OpStore %10 %36 + %39 = OpAccessChain %20 %16 %18 %19 + %40 = OpLoad %6 %39 + OpStore %38 %40 + %49 = OpAccessChain %48 %47 %18 %19 + %50 = OpLoad %17 %49 + OpStore %42 %50 + OpBranch %51 + %51 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %17 %42 + %57 = OpAccessChain %48 %47 %18 %18 + %58 = OpLoad %17 %57 + %60 = OpSLessThan %59 %56 %58 + OpBranchConditional %60 %52 %53 + %52 = OpLabel + %61 = OpAccessChain %48 %47 %18 %23 + %62 = OpLoad %17 %61 + %63 = OpLoad %17 %42 + %64 = OpNot %17 %63 + %65 = OpExtInst %17 %1 SClamp %64 %18 %19 + %66 = OpAccessChain %37 %10 %62 %65 + %67 = OpLoad %6 %66 + %68 = OpLoad %6 %38 + %69 = OpFAdd %6 %68 %67 + OpStore %38 %69 + OpBranch %54 + %54 = OpLabel + %70 = OpLoad %17 %42 + %71 = OpIAdd %17 %70 %19 + OpStore %42 %71 + OpBranch %51 + %53 = OpLabel + %72 = OpLoad %6 %38 + %73 = OpAccessChain %20 %16 %18 %18 + %74 = OpLoad %6 %73 + %75 = OpFOrdEqual %59 %72 %74 + OpSelectionMerge %77 None + OpBranchConditional %75 %76 %94 + %76 = OpLabel + %81 = OpAccessChain %48 %47 %18 %23 + %82 = OpLoad %17 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpAccessChain %48 %47 %18 %19 + %85 = OpLoad %17 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpAccessChain %48 %47 %18 %19 + %88 = OpLoad %17 %87 + %89 = OpConvertSToF %6 %88 + %90 = OpAccessChain %48 %47 %18 %23 + %91 = OpLoad %17 %90 + %92 = OpConvertSToF %6 %91 + %93 = OpCompositeConstruct %78 %83 %86 %89 %92 + OpStore %80 %93 + OpBranch %77 + %94 = OpLabel + %95 = OpAccessChain %48 %47 %18 %23 + %96 = OpLoad %17 %95 + %97 = OpConvertSToF %6 %96 + %98 = OpCompositeConstruct %78 %97 %97 %97 %97 + OpStore %80 %98 + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 10.0 1.0 2.0 3.0 4.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-nouble-negation-fragcoord-cast-ivec2-bitwise-and.amber b/vulkan/amber/graphicsfuzz/cov-nouble-negation-fragcoord-cast-ivec2-bitwise-and.amber new file mode 100644 index 0000000..b132b1d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-nouble-negation-fragcoord-cast-ivec2-bitwise-and.amber @@ -0,0 +1,169 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Test resolution is 256 which makes fragment coordinate ANDed with 256 always zero. +# int a = ((!(!((ivec2(gl_FragCoord.xy).y & 256) != 0))) ? 0 : ~0) | ((ivec2(gl_FragCoord.xy).y & 256) != 0 ? 0 : ~0); +# +# // Always true. +# if(a == ~ _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 72 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "gl_FragCoord" + OpName %41 "buf0" + OpMemberName %41 0 "_GLF_uniform_int_values" + OpName %43 "" + OpName %52 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %40 ArrayStride 16 + OpMemberDecorate %41 0 Offset 0 + OpDecorate %41 Block + OpDecorate %43 DescriptorSet 0 + OpDecorate %43 Binding 0 + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeVector %9 2 + %16 = OpTypeVector %6 2 + %18 = OpTypeInt 32 0 + %21 = OpConstant %6 256 + %23 = OpConstant %6 0 + %24 = OpTypeBool + %28 = OpConstant %6 -1 + %39 = OpConstant %18 2 + %40 = OpTypeArray %6 %39 + %41 = OpTypeStruct %40 + %42 = OpTypePointer Uniform %41 + %43 = OpVariable %42 Uniform + %44 = OpTypePointer Uniform %6 + %51 = OpTypePointer Output %10 + %52 = OpVariable %51 Output + %53 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpLoad %10 %12 + %15 = OpVectorShuffle %13 %14 %14 0 1 + %17 = OpConvertFToS %16 %15 + %20 = OpCompositeExtract %6 %17 1 + %22 = OpBitwiseAnd %6 %20 %21 + %25 = OpINotEqual %24 %22 %23 + %26 = OpLogicalNot %24 %25 + %27 = OpLogicalNot %24 %26 + %29 = OpSelect %6 %27 %23 %28 + %36 = OpSelect %6 %25 %23 %28 + %37 = OpBitwiseOr %6 %29 %36 + %45 = OpAccessChain %44 %43 %23 %23 + %46 = OpLoad %6 %45 + %47 = OpNot %6 %46 + %48 = OpIEqual %24 %37 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %67 + %49 = OpLabel + %54 = OpAccessChain %44 %43 %23 %53 + %55 = OpLoad %6 %54 + %56 = OpConvertSToF %9 %55 + %59 = OpConvertSToF %9 %46 + %66 = OpCompositeConstruct %10 %56 %59 %59 %56 + OpStore %52 %66 + OpBranch %50 + %67 = OpLabel + %70 = OpConvertSToF %9 %46 + %71 = OpCompositeConstruct %10 %70 %70 %70 %70 + OpStore %52 %71 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-one-bitwise-and-bitwise-or-full-bits.amber b/vulkan/amber/graphicsfuzz/cov-one-bitwise-and-bitwise-or-full-bits.amber new file mode 100644 index 0000000..fe58bb3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-one-bitwise-and-bitwise-or-full-bits.amber @@ -0,0 +1,235 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-code-aggressive' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-local-multi-store' +# '--reduce-load-size' +# '--convert-local-access-chains' +# '--eliminate-local-multi-store' +# '--combine-access-chains' +# '--vector-dce' +# '--scalar-replacement=100' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--copy-propagate-arrays' +# '--eliminate-dead-branches' +# '--scalar-replacement=100' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--vector-dce' +# '--convert-local-access-chains' +# '--combine-access-chains' +# '--redundancy-elimination' +# '--inline-entry-points-exhaustive' +# '--combine-access-chains' +# '--eliminate-dead-branches' +# '--eliminate-local-multi-store' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void func(int x) +# { +# // Always false. +# if(x > _int_1) +# { +# return; +# } +# +# ivec2 a = ivec2(_int_1); +# // b = 1 & ((~0 | ~0) >> 1) = 1 & (~0 >> 1) = 1 & ~0 = 1 +# int b = _int_1 & (((a.x != _int_1 ? 0 : ~ 0) | (a.x != _int_1 ? 0 : ~ 0)) >> _int_1); +# +# // Always true. +# if(b == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +# +# void main() +# { +# func(_int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 91 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %65 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "func(i1;" + OpName %9 "x" + OpName %16 "buf0" + OpMemberName %16 0 "_GLF_uniform_int_values" + OpName %18 "" + OpName %30 "a" + OpName %34 "b" + OpName %65 "_GLF_color" + OpName %85 "param" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %65 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 2 + %15 = OpTypeArray %6 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpConstant %6 0 + %20 = OpTypePointer Uniform %6 + %23 = OpTypeBool + %28 = OpTypeVector %6 2 + %29 = OpTypePointer Function %28 + %37 = OpConstant %13 0 + %43 = OpConstant %6 -1 + %62 = OpTypeFloat 32 + %63 = OpTypeVector %62 4 + %64 = OpTypePointer Output %63 + %65 = OpVariable %64 Output + %69 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %85 = OpVariable %7 Function + %86 = OpAccessChain %20 %18 %19 %19 + %87 = OpLoad %6 %86 + OpStore %85 %87 + %88 = OpFunctionCall %2 %10 %85 + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %30 = OpVariable %29 Function + %34 = OpVariable %7 Function + %12 = OpLoad %6 %9 + %21 = OpAccessChain %20 %18 %19 %19 + %22 = OpLoad %6 %21 + %24 = OpSGreaterThan %23 %12 %22 + OpSelectionMerge %26 None + OpBranchConditional %24 %25 %26 + %25 = OpLabel + OpReturn + %26 = OpLabel + %33 = OpCompositeConstruct %28 %22 %22 + OpStore %30 %33 + %38 = OpAccessChain %7 %30 %37 + %89 = OpLoad %28 %30 + %39 = OpCompositeExtract %6 %89 0 + %42 = OpINotEqual %23 %39 %22 + %44 = OpSelect %6 %42 %19 %43 + %90 = OpLoad %28 %30 + %46 = OpCompositeExtract %6 %90 0 + %49 = OpINotEqual %23 %46 %22 + %50 = OpSelect %6 %49 %19 %43 + %51 = OpBitwiseOr %6 %44 %50 + %54 = OpShiftRightArithmetic %6 %51 %22 + %55 = OpBitwiseAnd %6 %22 %54 + OpStore %34 %55 + %59 = OpIEqual %23 %55 %22 + OpSelectionMerge %61 None + OpBranchConditional %59 %60 %80 + %60 = OpLabel + %68 = OpConvertSToF %62 %22 + %70 = OpAccessChain %20 %18 %19 %69 + %71 = OpLoad %6 %70 + %72 = OpConvertSToF %62 %71 + %79 = OpCompositeConstruct %63 %68 %72 %72 %68 + OpStore %65 %79 + OpBranch %61 + %80 = OpLabel + %81 = OpAccessChain %20 %18 %19 %69 + %82 = OpLoad %6 %81 + %83 = OpConvertSToF %62 %82 + %84 = OpCompositeConstruct %63 %83 %83 %83 %83 + OpStore %65 %84 + OpBranch %61 + %61 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int.amber b/vulkan/amber/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int.amber new file mode 100644 index 0000000..d5efe6c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int.amber @@ -0,0 +1,170 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = 2.0; +# // Clamp always returns 1 and a is set to zero. +# int a = int(1.0 - clamp(1.0, 1.0, f)); +# +# +# // Always true. +# if(a == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %36 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %12 "a" + OpName %22 "buf0" + OpMemberName %22 0 "_GLF_uniform_int_values" + OpName %24 "" + OpName %36 "_GLF_color" + OpDecorate %21 ArrayStride 16 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %36 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 2 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %13 = OpConstant %6 1 + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 2 + %21 = OpTypeArray %10 %20 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpConstant %10 0 + %26 = OpConstant %10 1 + %27 = OpTypePointer Uniform %10 + %30 = OpTypeBool + %34 = OpTypeVector %6 4 + %35 = OpTypePointer Output %34 + %36 = OpVariable %35 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %12 = OpVariable %11 Function + OpStore %8 %9 + %14 = OpLoad %6 %8 + %15 = OpExtInst %6 %1 FClamp %13 %13 %14 + %16 = OpFSub %6 %13 %15 + %17 = OpConvertFToS %10 %16 + OpStore %12 %17 + %18 = OpLoad %10 %12 + %28 = OpAccessChain %27 %24 %25 %26 + %29 = OpLoad %10 %28 + %31 = OpIEqual %30 %18 %29 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %50 + %32 = OpLabel + %37 = OpAccessChain %27 %24 %25 %25 + %38 = OpLoad %10 %37 + %39 = OpConvertSToF %6 %38 + %40 = OpAccessChain %27 %24 %25 %26 + %41 = OpLoad %10 %40 + %42 = OpConvertSToF %6 %41 + %43 = OpAccessChain %27 %24 %25 %26 + %44 = OpLoad %10 %43 + %45 = OpConvertSToF %6 %44 + %46 = OpAccessChain %27 %24 %25 %25 + %47 = OpLoad %10 %46 + %48 = OpConvertSToF %6 %47 + %49 = OpCompositeConstruct %34 %39 %42 %45 %48 + OpStore %36 %49 + OpBranch %33 + %50 = OpLabel + %51 = OpAccessChain %27 %24 %25 %26 + %52 = OpLoad %10 %51 + %53 = OpConvertSToF %6 %52 + %54 = OpCompositeConstruct %34 %53 %53 %53 %53 + OpStore %36 %54 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if.amber b/vulkan/amber/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if.amber new file mode 100644 index 0000000..c2efe55 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if.amber @@ -0,0 +1,293 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific optimize PHIs code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [10, 1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# for (int i = _int_0; i < _int_10; i++) +# { +# for (int j = _int_0; j < _int_10; j++) +# { +# do +# { +# a = _int_1; +# if (gl_FragCoord.y < _float_0_0) +# { +# discard; +# } +# } while (a < _int_1); +# +# // Always false. +# if (gl_FragCoord.y < _float_0_0) +# { +# break; +# } +# } +# } +# if (a == _int_1) +# { +# _GLF_color = vec4(a, _int_0, _int_0, a); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 111 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %55 %94 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %33 "j" + OpName %55 "gl_FragCoord" + OpName %61 "buf0" + OpMemberName %61 0 "_GLF_uniform_float_values" + OpName %63 "" + OpName %94 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %55 BuiltIn FragCoord + OpDecorate %60 ArrayStride 16 + OpMemberDecorate %61 0 Offset 0 + OpDecorate %61 Block + OpDecorate %63 DescriptorSet 0 + OpDecorate %63 Binding 0 + OpDecorate %94 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %31 = OpTypeBool + %49 = OpConstant %6 1 + %52 = OpTypeFloat 32 + %53 = OpTypeVector %52 4 + %54 = OpTypePointer Input %53 + %55 = OpVariable %54 Input + %56 = OpConstant %9 1 + %57 = OpTypePointer Input %52 + %60 = OpTypeArray %52 %56 + %61 = OpTypeStruct %60 + %62 = OpTypePointer Uniform %61 + %63 = OpVariable %62 Uniform + %64 = OpTypePointer Uniform %52 + %93 = OpTypePointer Output %53 + %94 = OpVariable %93 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %33 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %21 = OpAccessChain %17 %14 %15 %16 + %22 = OpLoad %6 %21 + OpStore %20 %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %6 %20 + %29 = OpAccessChain %17 %14 %15 %15 + %30 = OpLoad %6 %29 + %32 = OpSLessThan %31 %28 %30 + OpBranchConditional %32 %24 %25 + %24 = OpLabel + %34 = OpAccessChain %17 %14 %15 %16 + %35 = OpLoad %6 %34 + OpStore %33 %35 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %6 %33 + %42 = OpAccessChain %17 %14 %15 %15 + %43 = OpLoad %6 %42 + %44 = OpSLessThan %31 %41 %43 + OpBranchConditional %44 %37 %38 + %37 = OpLabel + OpBranch %45 + %45 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %46 + %46 = OpLabel + %50 = OpAccessChain %17 %14 %15 %49 + %51 = OpLoad %6 %50 + OpStore %8 %51 + %58 = OpAccessChain %57 %55 %56 + %59 = OpLoad %52 %58 + %65 = OpAccessChain %64 %63 %15 %15 + %66 = OpLoad %52 %65 + %67 = OpFOrdLessThan %31 %59 %66 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %69 + %68 = OpLabel + OpTerminateInvocation + %69 = OpLabel + OpBranch %48 + %48 = OpLabel + %71 = OpLoad %6 %8 + %72 = OpAccessChain %17 %14 %15 %49 + %73 = OpLoad %6 %72 + %74 = OpSLessThan %31 %71 %73 + OpBranchConditional %74 %45 %47 + %47 = OpLabel + %75 = OpAccessChain %57 %55 %56 + %76 = OpLoad %52 %75 + %77 = OpAccessChain %64 %63 %15 %15 + %78 = OpLoad %52 %77 + %79 = OpFOrdLessThan %31 %76 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %80 %81 + %80 = OpLabel + OpBranch %38 + %81 = OpLabel + OpBranch %39 + %39 = OpLabel + %83 = OpLoad %6 %33 + %84 = OpIAdd %6 %83 %49 + OpStore %33 %84 + OpBranch %36 + %38 = OpLabel + OpBranch %26 + %26 = OpLabel + %85 = OpLoad %6 %20 + %86 = OpIAdd %6 %85 %49 + OpStore %20 %86 + OpBranch %23 + %25 = OpLabel + %87 = OpLoad %6 %8 + %88 = OpAccessChain %17 %14 %15 %49 + %89 = OpLoad %6 %88 + %90 = OpIEqual %31 %87 %89 + OpSelectionMerge %92 None + OpBranchConditional %90 %91 %106 + %91 = OpLabel + %95 = OpLoad %6 %8 + %96 = OpConvertSToF %52 %95 + %97 = OpAccessChain %17 %14 %15 %16 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %52 %98 + %100 = OpAccessChain %17 %14 %15 %16 + %101 = OpLoad %6 %100 + %102 = OpConvertSToF %52 %101 + %103 = OpLoad %6 %8 + %104 = OpConvertSToF %52 %103 + %105 = OpCompositeConstruct %53 %96 %99 %102 %104 + OpStore %94 %105 + OpBranch %92 + %106 = OpLabel + %107 = OpAccessChain %17 %14 %15 %16 + %108 = OpLoad %6 %107 + %109 = OpConvertSToF %52 %108 + %110 = OpCompositeConstruct %53 %109 %109 %109 %109 + OpStore %94 %110 + OpBranch %92 + %92 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-optimize-phis-for.amber b/vulkan/amber/graphicsfuzz/cov-optimize-phis-for.amber new file mode 100644 index 0000000..280f3a8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-optimize-phis-for.amber @@ -0,0 +1,545 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that cover specific optimize phis code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [2, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = _float_1_0; +# float b = _float_0_0; +# +# for (int i = _int_0; i < _int_2; i++) +# { +# for (int i = _int_0; i < _int_2; i++) +# { +# for (int i = _int_0; i < _int_2; i++) +# { +# for (int i = _int_1; i < _int_2; i++) +# { +# for (int i = _int_1; i < _int_2; i++) +# { +# for (int i = _int_0; i < _int_2; i++) +# { +# for (int i = _int_0; i < _int_2; i++) +# { +# for (int i = _int_0; i < _int_2; i++) +# { +# for (int i = _int_0; i < _int_2; i++) +# { +# for (int i = _int_0; i < _int_2; i++) +# { +# for (int i = _int_0; i < _int_2; +# i++) +# { +# a = _float_0_0; +# if (gl_FragCoord.y > _float_0_0) +# { +# break; +# } +# } +# } +# } +# } +# } +# } +# } +# } +# } +# } +# b++; +# } +# _GLF_color = vec4(b, a, a, b); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 212 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %169 %206 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %20 "b" + OpName %25 "i" + OpName %28 "buf1" + OpMemberName %28 0 "_GLF_uniform_int_values" + OpName %30 "" + OpName %44 "i" + OpName %56 "i" + OpName %68 "i" + OpName %81 "i" + OpName %93 "i" + OpName %105 "i" + OpName %117 "i" + OpName %129 "i" + OpName %141 "i" + OpName %153 "i" + OpName %169 "gl_FragCoord" + OpName %206 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %25 RelaxedPrecision + OpDecorate %27 ArrayStride 16 + OpMemberDecorate %28 0 RelaxedPrecision + OpMemberDecorate %28 0 Offset 0 + OpDecorate %28 Block + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 1 + OpDecorate %33 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %77 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %83 RelaxedPrecision + OpDecorate %89 RelaxedPrecision + OpDecorate %91 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %95 RelaxedPrecision + OpDecorate %101 RelaxedPrecision + OpDecorate %103 RelaxedPrecision + OpDecorate %105 RelaxedPrecision + OpDecorate %107 RelaxedPrecision + OpDecorate %113 RelaxedPrecision + OpDecorate %115 RelaxedPrecision + OpDecorate %117 RelaxedPrecision + OpDecorate %119 RelaxedPrecision + OpDecorate %125 RelaxedPrecision + OpDecorate %127 RelaxedPrecision + OpDecorate %129 RelaxedPrecision + OpDecorate %131 RelaxedPrecision + OpDecorate %137 RelaxedPrecision + OpDecorate %139 RelaxedPrecision + OpDecorate %141 RelaxedPrecision + OpDecorate %143 RelaxedPrecision + OpDecorate %149 RelaxedPrecision + OpDecorate %151 RelaxedPrecision + OpDecorate %153 RelaxedPrecision + OpDecorate %155 RelaxedPrecision + OpDecorate %161 RelaxedPrecision + OpDecorate %163 RelaxedPrecision + OpDecorate %169 BuiltIn FragCoord + OpDecorate %180 RelaxedPrecision + OpDecorate %181 RelaxedPrecision + OpDecorate %182 RelaxedPrecision + OpDecorate %183 RelaxedPrecision + OpDecorate %184 RelaxedPrecision + OpDecorate %185 RelaxedPrecision + OpDecorate %186 RelaxedPrecision + OpDecorate %187 RelaxedPrecision + OpDecorate %188 RelaxedPrecision + OpDecorate %189 RelaxedPrecision + OpDecorate %190 RelaxedPrecision + OpDecorate %191 RelaxedPrecision + OpDecorate %192 RelaxedPrecision + OpDecorate %193 RelaxedPrecision + OpDecorate %194 RelaxedPrecision + OpDecorate %195 RelaxedPrecision + OpDecorate %196 RelaxedPrecision + OpDecorate %197 RelaxedPrecision + OpDecorate %198 RelaxedPrecision + OpDecorate %199 RelaxedPrecision + OpDecorate %203 RelaxedPrecision + OpDecorate %204 RelaxedPrecision + OpDecorate %206 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %15 1 + %24 = OpTypePointer Function %15 + %26 = OpConstant %9 3 + %27 = OpTypeArray %15 %26 + %28 = OpTypeStruct %27 + %29 = OpTypePointer Uniform %28 + %30 = OpVariable %29 Uniform + %31 = OpTypePointer Uniform %15 + %42 = OpTypeBool + %69 = OpConstant %15 2 + %167 = OpTypeVector %6 4 + %168 = OpTypePointer Input %167 + %169 = OpVariable %168 Input + %170 = OpConstant %9 1 + %171 = OpTypePointer Input %6 + %201 = OpConstant %6 1 + %205 = OpTypePointer Output %167 + %206 = OpVariable %205 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %25 = OpVariable %24 Function + %44 = OpVariable %24 Function + %56 = OpVariable %24 Function + %68 = OpVariable %24 Function + %81 = OpVariable %24 Function + %93 = OpVariable %24 Function + %105 = OpVariable %24 Function + %117 = OpVariable %24 Function + %129 = OpVariable %24 Function + %141 = OpVariable %24 Function + %153 = OpVariable %24 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %22 = OpAccessChain %17 %14 %16 %21 + %23 = OpLoad %6 %22 + OpStore %20 %23 + %32 = OpAccessChain %31 %30 %16 %21 + %33 = OpLoad %15 %32 + OpStore %25 %33 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %15 %25 + %40 = OpAccessChain %31 %30 %16 %16 + %41 = OpLoad %15 %40 + %43 = OpSLessThan %42 %39 %41 + OpBranchConditional %43 %35 %36 + %35 = OpLabel + %45 = OpAccessChain %31 %30 %16 %21 + %46 = OpLoad %15 %45 + OpStore %44 %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %15 %44 + %53 = OpAccessChain %31 %30 %16 %16 + %54 = OpLoad %15 %53 + %55 = OpSLessThan %42 %52 %54 + OpBranchConditional %55 %48 %49 + %48 = OpLabel + %57 = OpAccessChain %31 %30 %16 %21 + %58 = OpLoad %15 %57 + OpStore %56 %58 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + %64 = OpLoad %15 %56 + %65 = OpAccessChain %31 %30 %16 %16 + %66 = OpLoad %15 %65 + %67 = OpSLessThan %42 %64 %66 + OpBranchConditional %67 %60 %61 + %60 = OpLabel + %70 = OpAccessChain %31 %30 %16 %69 + %71 = OpLoad %15 %70 + OpStore %68 %71 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %74 %75 None + OpBranch %76 + %76 = OpLabel + %77 = OpLoad %15 %68 + %78 = OpAccessChain %31 %30 %16 %16 + %79 = OpLoad %15 %78 + %80 = OpSLessThan %42 %77 %79 + OpBranchConditional %80 %73 %74 + %73 = OpLabel + %82 = OpAccessChain %31 %30 %16 %69 + %83 = OpLoad %15 %82 + OpStore %81 %83 + OpBranch %84 + %84 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %89 = OpLoad %15 %81 + %90 = OpAccessChain %31 %30 %16 %16 + %91 = OpLoad %15 %90 + %92 = OpSLessThan %42 %89 %91 + OpBranchConditional %92 %85 %86 + %85 = OpLabel + %94 = OpAccessChain %31 %30 %16 %21 + %95 = OpLoad %15 %94 + OpStore %93 %95 + OpBranch %96 + %96 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %101 = OpLoad %15 %93 + %102 = OpAccessChain %31 %30 %16 %16 + %103 = OpLoad %15 %102 + %104 = OpSLessThan %42 %101 %103 + OpBranchConditional %104 %97 %98 + %97 = OpLabel + %106 = OpAccessChain %31 %30 %16 %21 + %107 = OpLoad %15 %106 + OpStore %105 %107 + OpBranch %108 + %108 = OpLabel + OpLoopMerge %110 %111 None + OpBranch %112 + %112 = OpLabel + %113 = OpLoad %15 %105 + %114 = OpAccessChain %31 %30 %16 %16 + %115 = OpLoad %15 %114 + %116 = OpSLessThan %42 %113 %115 + OpBranchConditional %116 %109 %110 + %109 = OpLabel + %118 = OpAccessChain %31 %30 %16 %21 + %119 = OpLoad %15 %118 + OpStore %117 %119 + OpBranch %120 + %120 = OpLabel + OpLoopMerge %122 %123 None + OpBranch %124 + %124 = OpLabel + %125 = OpLoad %15 %117 + %126 = OpAccessChain %31 %30 %16 %16 + %127 = OpLoad %15 %126 + %128 = OpSLessThan %42 %125 %127 + OpBranchConditional %128 %121 %122 + %121 = OpLabel + %130 = OpAccessChain %31 %30 %16 %21 + %131 = OpLoad %15 %130 + OpStore %129 %131 + OpBranch %132 + %132 = OpLabel + OpLoopMerge %134 %135 None + OpBranch %136 + %136 = OpLabel + %137 = OpLoad %15 %129 + %138 = OpAccessChain %31 %30 %16 %16 + %139 = OpLoad %15 %138 + %140 = OpSLessThan %42 %137 %139 + OpBranchConditional %140 %133 %134 + %133 = OpLabel + %142 = OpAccessChain %31 %30 %16 %21 + %143 = OpLoad %15 %142 + OpStore %141 %143 + OpBranch %144 + %144 = OpLabel + OpLoopMerge %146 %147 None + OpBranch %148 + %148 = OpLabel + %149 = OpLoad %15 %141 + %150 = OpAccessChain %31 %30 %16 %16 + %151 = OpLoad %15 %150 + %152 = OpSLessThan %42 %149 %151 + OpBranchConditional %152 %145 %146 + %145 = OpLabel + %154 = OpAccessChain %31 %30 %16 %21 + %155 = OpLoad %15 %154 + OpStore %153 %155 + OpBranch %156 + %156 = OpLabel + OpLoopMerge %158 %159 None + OpBranch %160 + %160 = OpLabel + %161 = OpLoad %15 %153 + %162 = OpAccessChain %31 %30 %16 %16 + %163 = OpLoad %15 %162 + %164 = OpSLessThan %42 %161 %163 + OpBranchConditional %164 %157 %158 + %157 = OpLabel + %165 = OpAccessChain %17 %14 %16 %21 + %166 = OpLoad %6 %165 + OpStore %8 %166 + %172 = OpAccessChain %171 %169 %170 + %173 = OpLoad %6 %172 + %174 = OpAccessChain %17 %14 %16 %21 + %175 = OpLoad %6 %174 + %176 = OpFOrdGreaterThan %42 %173 %175 + OpSelectionMerge %178 None + OpBranchConditional %176 %177 %178 + %177 = OpLabel + OpBranch %158 + %178 = OpLabel + OpBranch %159 + %159 = OpLabel + %180 = OpLoad %15 %153 + %181 = OpIAdd %15 %180 %21 + OpStore %153 %181 + OpBranch %156 + %158 = OpLabel + OpBranch %147 + %147 = OpLabel + %182 = OpLoad %15 %141 + %183 = OpIAdd %15 %182 %21 + OpStore %141 %183 + OpBranch %144 + %146 = OpLabel + OpBranch %135 + %135 = OpLabel + %184 = OpLoad %15 %129 + %185 = OpIAdd %15 %184 %21 + OpStore %129 %185 + OpBranch %132 + %134 = OpLabel + OpBranch %123 + %123 = OpLabel + %186 = OpLoad %15 %117 + %187 = OpIAdd %15 %186 %21 + OpStore %117 %187 + OpBranch %120 + %122 = OpLabel + OpBranch %111 + %111 = OpLabel + %188 = OpLoad %15 %105 + %189 = OpIAdd %15 %188 %21 + OpStore %105 %189 + OpBranch %108 + %110 = OpLabel + OpBranch %99 + %99 = OpLabel + %190 = OpLoad %15 %93 + %191 = OpIAdd %15 %190 %21 + OpStore %93 %191 + OpBranch %96 + %98 = OpLabel + OpBranch %87 + %87 = OpLabel + %192 = OpLoad %15 %81 + %193 = OpIAdd %15 %192 %21 + OpStore %81 %193 + OpBranch %84 + %86 = OpLabel + OpBranch %75 + %75 = OpLabel + %194 = OpLoad %15 %68 + %195 = OpIAdd %15 %194 %21 + OpStore %68 %195 + OpBranch %72 + %74 = OpLabel + OpBranch %62 + %62 = OpLabel + %196 = OpLoad %15 %56 + %197 = OpIAdd %15 %196 %21 + OpStore %56 %197 + OpBranch %59 + %61 = OpLabel + OpBranch %50 + %50 = OpLabel + %198 = OpLoad %15 %44 + %199 = OpIAdd %15 %198 %21 + OpStore %44 %199 + OpBranch %47 + %49 = OpLabel + %200 = OpLoad %6 %20 + %202 = OpFAdd %6 %200 %201 + OpStore %20 %202 + OpBranch %37 + %37 = OpLabel + %203 = OpLoad %15 %25 + %204 = OpIAdd %15 %203 %21 + OpStore %25 %204 + OpBranch %34 + %36 = OpLabel + %207 = OpLoad %6 %20 + %208 = OpLoad %6 %8 + %209 = OpLoad %6 %8 + %210 = OpLoad %6 %20 + %211 = OpCompositeConstruct %167 %207 %208 %209 %210 + OpStore %206 %211 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-packhalf-unpackunorm.amber b/vulkan/amber/graphicsfuzz/cov-packhalf-unpackunorm.amber new file mode 100644 index 0000000..7944dd0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-packhalf-unpackunorm.amber @@ -0,0 +1,293 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine shifts code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_3 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _float_255_0 _GLF_uniform_float_values[0] +# #define _float_60_0 _GLF_uniform_float_values[1] +# #define _float_0_01 _GLF_uniform_float_values[2] +# #define _float_0_0 _GLF_uniform_float_values[3] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [255.0, 60.0, 0.01, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[4]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 3, 2] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // a becomes 1006648320. +# uint a = packHalf2x16(vec2(1.0)); +# vec4 values = unpackUnorm4x8(a); +# +# vec4 ref = vec4(_float_0_0, _float_60_0 / _float_255_0, +# _float_0_0 / _float_255_0, _float_60_0 / _float_255_0); +# +# if (abs(values[_int_0] - ref[_int_0]) < _float_0_01 +# && abs(values[_int_1] - ref[_int_1]) < _float_0_01 +# && abs(values[_int_2] - ref[_int_2]) < _float_0_01 +# && abs(values[_int_3] - ref[_int_3]) < _float_0_01) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } else { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 139 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %120 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %16 "values" + OpName %19 "ref" + OpName %22 "buf0" + OpMemberName %22 0 "_GLF_uniform_float_values" + OpName %24 "" + OpName %50 "buf1" + OpMemberName %50 0 "_GLF_uniform_int_values" + OpName %52 "" + OpName %120 "_GLF_color" + OpDecorate %21 ArrayStride 16 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %49 ArrayStride 16 + OpMemberDecorate %50 0 Offset 0 + OpDecorate %50 Block + OpDecorate %52 DescriptorSet 0 + OpDecorate %52 Binding 1 + OpDecorate %120 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 2 + %11 = OpConstant %9 1 + %12 = OpConstantComposite %10 %11 %11 + %14 = OpTypeVector %9 4 + %15 = OpTypePointer Function %14 + %20 = OpConstant %6 4 + %21 = OpTypeArray %9 %20 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpTypeInt 32 1 + %26 = OpConstant %25 0 + %27 = OpConstant %25 3 + %28 = OpTypePointer Uniform %9 + %31 = OpConstant %25 1 + %48 = OpTypeBool + %49 = OpTypeArray %25 %20 + %50 = OpTypeStruct %49 + %51 = OpTypePointer Uniform %50 + %52 = OpVariable %51 Uniform + %53 = OpTypePointer Uniform %25 + %56 = OpTypePointer Function %9 + %65 = OpConstant %25 2 + %119 = OpTypePointer Output %14 + %120 = OpVariable %119 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %16 = OpVariable %15 Function + %19 = OpVariable %15 Function + %13 = OpExtInst %6 %1 PackHalf2x16 %12 + OpStore %8 %13 + %17 = OpLoad %6 %8 + %18 = OpExtInst %14 %1 UnpackUnorm4x8 %17 + OpStore %16 %18 + %29 = OpAccessChain %28 %24 %26 %27 + %30 = OpLoad %9 %29 + %32 = OpAccessChain %28 %24 %26 %31 + %33 = OpLoad %9 %32 + %34 = OpAccessChain %28 %24 %26 %26 + %35 = OpLoad %9 %34 + %36 = OpFDiv %9 %33 %35 + %37 = OpAccessChain %28 %24 %26 %27 + %38 = OpLoad %9 %37 + %39 = OpAccessChain %28 %24 %26 %26 + %40 = OpLoad %9 %39 + %41 = OpFDiv %9 %38 %40 + %42 = OpAccessChain %28 %24 %26 %31 + %43 = OpLoad %9 %42 + %44 = OpAccessChain %28 %24 %26 %26 + %45 = OpLoad %9 %44 + %46 = OpFDiv %9 %43 %45 + %47 = OpCompositeConstruct %14 %30 %36 %41 %46 + OpStore %19 %47 + %54 = OpAccessChain %53 %52 %26 %26 + %55 = OpLoad %25 %54 + %57 = OpAccessChain %56 %16 %55 + %58 = OpLoad %9 %57 + %59 = OpAccessChain %53 %52 %26 %26 + %60 = OpLoad %25 %59 + %61 = OpAccessChain %56 %19 %60 + %62 = OpLoad %9 %61 + %63 = OpFSub %9 %58 %62 + %64 = OpExtInst %9 %1 FAbs %63 + %66 = OpAccessChain %28 %24 %26 %65 + %67 = OpLoad %9 %66 + %68 = OpFOrdLessThan %48 %64 %67 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %70 + %69 = OpLabel + %71 = OpAccessChain %53 %52 %26 %31 + %72 = OpLoad %25 %71 + %73 = OpAccessChain %56 %16 %72 + %74 = OpLoad %9 %73 + %75 = OpAccessChain %53 %52 %26 %31 + %76 = OpLoad %25 %75 + %77 = OpAccessChain %56 %19 %76 + %78 = OpLoad %9 %77 + %79 = OpFSub %9 %74 %78 + %80 = OpExtInst %9 %1 FAbs %79 + %81 = OpAccessChain %28 %24 %26 %65 + %82 = OpLoad %9 %81 + %83 = OpFOrdLessThan %48 %80 %82 + OpBranch %70 + %70 = OpLabel + %84 = OpPhi %48 %68 %5 %83 %69 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %86 + %85 = OpLabel + %87 = OpAccessChain %53 %52 %26 %27 + %88 = OpLoad %25 %87 + %89 = OpAccessChain %56 %16 %88 + %90 = OpLoad %9 %89 + %91 = OpAccessChain %53 %52 %26 %27 + %92 = OpLoad %25 %91 + %93 = OpAccessChain %56 %19 %92 + %94 = OpLoad %9 %93 + %95 = OpFSub %9 %90 %94 + %96 = OpExtInst %9 %1 FAbs %95 + %97 = OpAccessChain %28 %24 %26 %65 + %98 = OpLoad %9 %97 + %99 = OpFOrdLessThan %48 %96 %98 + OpBranch %86 + %86 = OpLabel + %100 = OpPhi %48 %84 %70 %99 %85 + OpSelectionMerge %102 None + OpBranchConditional %100 %101 %102 + %101 = OpLabel + %103 = OpAccessChain %53 %52 %26 %65 + %104 = OpLoad %25 %103 + %105 = OpAccessChain %56 %16 %104 + %106 = OpLoad %9 %105 + %107 = OpAccessChain %53 %52 %26 %65 + %108 = OpLoad %25 %107 + %109 = OpAccessChain %56 %19 %108 + %110 = OpLoad %9 %109 + %111 = OpFSub %9 %106 %110 + %112 = OpExtInst %9 %1 FAbs %111 + %113 = OpAccessChain %28 %24 %26 %65 + %114 = OpLoad %9 %113 + %115 = OpFOrdLessThan %48 %112 %114 + OpBranch %102 + %102 = OpLabel + %116 = OpPhi %48 %100 %86 %115 %101 + OpSelectionMerge %118 None + OpBranchConditional %116 %117 %134 + %117 = OpLabel + %121 = OpAccessChain %53 %52 %26 %31 + %122 = OpLoad %25 %121 + %123 = OpConvertSToF %9 %122 + %124 = OpAccessChain %53 %52 %26 %26 + %125 = OpLoad %25 %124 + %126 = OpConvertSToF %9 %125 + %127 = OpAccessChain %53 %52 %26 %26 + %128 = OpLoad %25 %127 + %129 = OpConvertSToF %9 %128 + %130 = OpAccessChain %53 %52 %26 %31 + %131 = OpLoad %25 %130 + %132 = OpConvertSToF %9 %131 + %133 = OpCompositeConstruct %14 %123 %126 %129 %132 + OpStore %120 %133 + OpBranch %118 + %134 = OpLabel + %135 = OpAccessChain %53 %52 %26 %26 + %136 = OpLoad %25 %135 + %137 = OpConvertSToF %9 %136 + %138 = OpCompositeConstruct %14 %137 %137 %137 %137 + OpStore %120 %138 + OpBranch %118 + %118 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 3 2 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 255.0 60.0 0.01 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-pattern-match-signum.amber b/vulkan/amber/graphicsfuzz/cov-pattern-match-signum.amber new file mode 100644 index 0000000..60d5016 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-pattern-match-signum.amber @@ -0,0 +1,156 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific pattern matching path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# int func(int x) +# { +# // Always true. +# if (one == 1) +# return x; +# +# return one; +# } +# +# void main() +# { +# if(func(-1) <= 0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %39 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "func(i1;" + OpName %9 "x" + OpName %12 "buf0" + OpMemberName %12 0 "one" + OpName %14 "" + OpName %31 "param" + OpName %39 "_GLF_color" + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %39 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %12 = OpTypeStruct %6 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %6 + %19 = OpConstant %6 1 + %20 = OpTypeBool + %30 = OpConstant %6 -1 + %36 = OpTypeFloat 32 + %37 = OpTypeVector %36 4 + %38 = OpTypePointer Output %37 + %39 = OpVariable %38 Output + %40 = OpConstant %36 1 + %41 = OpConstant %36 0 + %42 = OpConstantComposite %37 %40 %41 %41 %40 + %44 = OpConstantComposite %37 %41 %41 %41 %41 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %31 = OpVariable %7 Function + OpStore %31 %30 + %32 = OpFunctionCall %6 %10 %31 + %33 = OpSLessThanEqual %20 %32 %15 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %43 + %34 = OpLabel + OpStore %39 %42 + OpBranch %35 + %43 = OpLabel + OpStore %39 %44 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %17 = OpAccessChain %16 %14 %15 + %18 = OpLoad %6 %17 + %21 = OpIEqual %20 %18 %19 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %23 + %22 = OpLabel + %24 = OpLoad %6 %9 + OpReturnValue %24 + %23 = OpLabel + %26 = OpAccessChain %16 %14 %15 + %27 = OpLoad %6 %26 + OpReturnValue %27 + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-pattern-match-single-bit.amber b/vulkan/amber/graphicsfuzz/cov-pattern-match-single-bit.amber new file mode 100644 index 0000000..3805d0b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-pattern-match-single-bit.amber @@ -0,0 +1,128 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific pattern matching path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int three; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# if(10 / (2 & three) == 5) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %26 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "buf0" + OpMemberName %9 0 "three" + OpName %11 "" + OpName %26 "_GLF_color" + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 Block + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 0 + OpDecorate %26 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpConstant %6 10 + %8 = OpConstant %6 2 + %9 = OpTypeStruct %6 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpConstant %6 0 + %13 = OpTypePointer Uniform %6 + %18 = OpConstant %6 5 + %19 = OpTypeBool + %23 = OpTypeFloat 32 + %24 = OpTypeVector %23 4 + %25 = OpTypePointer Output %24 + %26 = OpVariable %25 Output + %27 = OpConstant %23 1 + %28 = OpConstant %23 0 + %29 = OpConstantComposite %24 %27 %28 %28 %27 + %31 = OpConstantComposite %24 %28 %28 %28 %28 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpAccessChain %13 %11 %12 + %15 = OpLoad %6 %14 + %16 = OpBitwiseAnd %6 %8 %15 + %17 = OpSDiv %6 %7 %16 + %20 = OpIEqual %19 %17 %18 + OpSelectionMerge %22 None + OpBranchConditional %20 %21 %30 + %21 = OpLabel + OpStore %26 %29 + OpBranch %22 + %30 = OpLabel + OpStore %26 %31 + OpBranch %22 + %22 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# three +BUFFER variant_three DATA_TYPE int32 DATA + 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_three AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if.amber b/vulkan/amber/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if.amber new file mode 100644 index 0000000..7075311 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if.amber @@ -0,0 +1,276 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers peephole optimizer and instr info code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# for (int i = _int_0; i < _int_10; i++) +# { +# // Always false. +# if (gl_FragCoord.y < _float_0_0) +# { +# // Always false. +# if (gl_FragCoord.x < _float_0_0) +# { +# return; +# } +# +# // Always false. +# if (_float_1_0 > _float_1_0) +# { +# return; +# } +# discard; +# } +# +# // Always true. +# if (_float_1_0 > _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# break; +# } +# +# // Always false. +# if (_float_0_0 < 0.0) +# { +# discard; +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %40 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %25 "i" + OpName %40 "gl_FragCoord" + OpName %47 "buf1" + OpMemberName %47 0 "_GLF_uniform_float_values" + OpName %49 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %40 BuiltIn FragCoord + OpDecorate %46 ArrayStride 16 + OpMemberDecorate %47 0 Offset 0 + OpDecorate %47 Block + OpDecorate %49 DescriptorSet 0 + OpDecorate %49 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 3 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpConstant %10 1 + %19 = OpTypePointer Uniform %10 + %24 = OpTypePointer Function %10 + %34 = OpConstant %10 2 + %37 = OpTypeBool + %39 = OpTypePointer Input %7 + %40 = OpVariable %39 Input + %41 = OpConstant %11 1 + %42 = OpTypePointer Input %6 + %45 = OpConstant %11 2 + %46 = OpTypeArray %6 %45 + %47 = OpTypeStruct %46 + %48 = OpTypePointer Uniform %47 + %49 = OpVariable %48 Uniform + %50 = OpTypePointer Uniform %6 + %56 = OpConstant %11 0 + %97 = OpConstant %6 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %25 = OpVariable %24 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %10 %20 + %22 = OpConvertSToF %6 %21 + %23 = OpCompositeConstruct %7 %22 %22 %22 %22 + OpStore %9 %23 + %26 = OpAccessChain %19 %16 %17 %18 + %27 = OpLoad %10 %26 + OpStore %25 %27 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %10 %25 + %35 = OpAccessChain %19 %16 %17 %34 + %36 = OpLoad %10 %35 + %38 = OpSLessThan %37 %33 %36 + OpBranchConditional %38 %29 %30 + %29 = OpLabel + %43 = OpAccessChain %42 %40 %41 + %44 = OpLoad %6 %43 + %51 = OpAccessChain %50 %49 %17 %17 + %52 = OpLoad %6 %51 + %53 = OpFOrdLessThan %37 %44 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %55 + %54 = OpLabel + %57 = OpAccessChain %42 %40 %56 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %50 %49 %17 %17 + %60 = OpLoad %6 %59 + %61 = OpFOrdLessThan %37 %58 %60 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %63 + %62 = OpLabel + OpReturn + %63 = OpLabel + %65 = OpAccessChain %50 %49 %17 %18 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %50 %49 %17 %18 + %68 = OpLoad %6 %67 + %69 = OpFOrdGreaterThan %37 %66 %68 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %71 + %70 = OpLabel + OpReturn + %71 = OpLabel + OpTerminateInvocation + %55 = OpLabel + %74 = OpAccessChain %50 %49 %17 %18 + %75 = OpLoad %6 %74 + %76 = OpAccessChain %50 %49 %17 %17 + %77 = OpLoad %6 %76 + %78 = OpFOrdGreaterThan %37 %75 %77 + OpSelectionMerge %80 None + OpBranchConditional %78 %79 %80 + %79 = OpLabel + %81 = OpAccessChain %19 %16 %17 %17 + %82 = OpLoad %10 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpAccessChain %19 %16 %17 %18 + %85 = OpLoad %10 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpAccessChain %19 %16 %17 %18 + %88 = OpLoad %10 %87 + %89 = OpConvertSToF %6 %88 + %90 = OpAccessChain %19 %16 %17 %17 + %91 = OpLoad %10 %90 + %92 = OpConvertSToF %6 %91 + %93 = OpCompositeConstruct %7 %83 %86 %89 %92 + OpStore %9 %93 + OpBranch %30 + %80 = OpLabel + %95 = OpAccessChain %50 %49 %17 %17 + %96 = OpLoad %6 %95 + %98 = OpFOrdLessThan %37 %96 %97 + OpSelectionMerge %100 None + OpBranchConditional %98 %99 %100 + %99 = OpLabel + OpTerminateInvocation + %100 = OpLabel + OpBranch %31 + %31 = OpLabel + %102 = OpLoad %10 %25 + %103 = OpIAdd %10 %102 %18 + OpStore %25 %103 + OpBranch %28 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-pow-distance-uniform-vector-constant-one-vector.amber b/vulkan/amber/graphicsfuzz/cov-pow-distance-uniform-vector-constant-one-vector.amber new file mode 100644 index 0000000..dfcf9ec --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-pow-distance-uniform-vector-constant-one-vector.amber @@ -0,0 +1,193 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v = vec4(1.0); +# // Distance is zero and so is 0^2. +# float f = pow(distance(v, vec4(_float_1_0)), 2.0); +# +# // Always true. +# if (f == 0.0) +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# else +# _GLF_color = vec4(_int_0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 62 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %37 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %13 "f" + OpName %18 "buf0" + OpMemberName %18 0 "_GLF_uniform_float_values" + OpName %20 "" + OpName %37 "_GLF_color" + OpName %39 "buf1" + OpMemberName %39 0 "_GLF_uniform_int_values" + OpName %41 "" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %37 Location 0 + OpDecorate %38 ArrayStride 16 + OpMemberDecorate %39 0 Offset 0 + OpDecorate %39 Block + OpDecorate %41 DescriptorSet 0 + OpDecorate %41 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypePointer Function %6 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 2 + %17 = OpTypeArray %6 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypeInt 32 1 + %22 = OpConstant %21 0 + %23 = OpTypePointer Uniform %6 + %28 = OpConstant %6 2 + %31 = OpConstant %6 0 + %32 = OpTypeBool + %36 = OpTypePointer Output %7 + %37 = OpVariable %36 Output + %38 = OpTypeArray %21 %16 + %39 = OpTypeStruct %38 + %40 = OpTypePointer Uniform %39 + %41 = OpVariable %40 Uniform + %42 = OpConstant %21 1 + %43 = OpTypePointer Uniform %21 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %13 = OpVariable %12 Function + OpStore %9 %11 + %14 = OpLoad %7 %9 + %24 = OpAccessChain %23 %20 %22 %22 + %25 = OpLoad %6 %24 + %26 = OpCompositeConstruct %7 %25 %25 %25 %25 + %27 = OpExtInst %6 %1 Distance %14 %26 + %29 = OpExtInst %6 %1 Pow %27 %28 + OpStore %13 %29 + %30 = OpLoad %6 %13 + %33 = OpFOrdEqual %32 %30 %31 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %57 + %34 = OpLabel + %44 = OpAccessChain %43 %41 %22 %42 + %45 = OpLoad %21 %44 + %46 = OpConvertSToF %6 %45 + %47 = OpAccessChain %43 %41 %22 %22 + %48 = OpLoad %21 %47 + %49 = OpConvertSToF %6 %48 + %50 = OpAccessChain %43 %41 %22 %22 + %51 = OpLoad %21 %50 + %52 = OpConvertSToF %6 %51 + %53 = OpAccessChain %43 %41 %22 %42 + %54 = OpLoad %21 %53 + %55 = OpConvertSToF %6 %54 + %56 = OpCompositeConstruct %7 %46 %49 %52 %55 + OpStore %37 %56 + OpBranch %35 + %57 = OpLabel + %58 = OpAccessChain %43 %41 %22 %22 + %59 = OpLoad %21 %58 + %60 = OpConvertSToF %6 %59 + %61 = OpCompositeConstruct %7 %60 %60 %60 %60 + OpStore %37 %61 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-pow-identical-value-sqrt.amber b/vulkan/amber/graphicsfuzz/cov-pow-identical-value-sqrt.amber new file mode 100644 index 0000000..7546e99 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-pow-identical-value-sqrt.amber @@ -0,0 +1,238 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific SPIR-V lower math code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_2_0 _GLF_uniform_float_values[0] +# #define _float_0_5 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [2.0, 0.5] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# // Contents of one: 1.0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# float one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f0 = _float_2_0; +# float f1 = _float_0_5 * pow(f0, 4.0); +# float f2 = _float_0_5 * pow(f0, 4.0); +# // f3 = sqrt((8-8) - 1 + 2) = sqrt(1) = 1. +# float f3 = sqrt((f1 - f2) - one + f0); +# +# // Always true. +# if(int(f3) == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 81 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %62 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f0" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %20 "f1" + OpName %28 "f2" + OpName %34 "f3" + OpName %38 "buf2" + OpMemberName %38 0 "one" + OpName %40 "" + OpName %50 "buf1" + OpMemberName %50 0 "_GLF_uniform_int_values" + OpName %52 "" + OpName %62 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 2 + OpDecorate %49 ArrayStride 16 + OpMemberDecorate %50 0 Offset 0 + OpDecorate %50 Block + OpDecorate %52 DescriptorSet 0 + OpDecorate %52 Binding 1 + OpDecorate %62 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %15 1 + %25 = OpConstant %6 4 + %38 = OpTypeStruct %6 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %49 = OpTypeArray %15 %10 + %50 = OpTypeStruct %49 + %51 = OpTypePointer Uniform %50 + %52 = OpVariable %51 Uniform + %53 = OpTypePointer Uniform %15 + %56 = OpTypeBool + %60 = OpTypeVector %6 4 + %61 = OpTypePointer Output %60 + %62 = OpVariable %61 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %28 = OpVariable %7 Function + %34 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %22 = OpAccessChain %17 %14 %16 %21 + %23 = OpLoad %6 %22 + %24 = OpLoad %6 %8 + %26 = OpExtInst %6 %1 Pow %24 %25 + %27 = OpFMul %6 %23 %26 + OpStore %20 %27 + %29 = OpAccessChain %17 %14 %16 %21 + %30 = OpLoad %6 %29 + %31 = OpLoad %6 %8 + %32 = OpExtInst %6 %1 Pow %31 %25 + %33 = OpFMul %6 %30 %32 + OpStore %28 %33 + %35 = OpLoad %6 %20 + %36 = OpLoad %6 %28 + %37 = OpFSub %6 %35 %36 + %41 = OpAccessChain %17 %40 %16 + %42 = OpLoad %6 %41 + %43 = OpFSub %6 %37 %42 + %44 = OpLoad %6 %8 + %45 = OpFAdd %6 %43 %44 + %46 = OpExtInst %6 %1 Sqrt %45 + OpStore %34 %46 + %47 = OpLoad %6 %34 + %48 = OpConvertFToS %15 %47 + %54 = OpAccessChain %53 %52 %16 %16 + %55 = OpLoad %15 %54 + %57 = OpIEqual %56 %48 %55 + OpSelectionMerge %59 None + OpBranchConditional %57 %58 %76 + %58 = OpLabel + %63 = OpAccessChain %53 %52 %16 %16 + %64 = OpLoad %15 %63 + %65 = OpConvertSToF %6 %64 + %66 = OpAccessChain %53 %52 %16 %21 + %67 = OpLoad %15 %66 + %68 = OpConvertSToF %6 %67 + %69 = OpAccessChain %53 %52 %16 %21 + %70 = OpLoad %15 %69 + %71 = OpConvertSToF %6 %70 + %72 = OpAccessChain %53 %52 %16 %16 + %73 = OpLoad %15 %72 + %74 = OpConvertSToF %6 %73 + %75 = OpCompositeConstruct %60 %65 %68 %71 %74 + OpStore %62 %75 + OpBranch %59 + %76 = OpLabel + %77 = OpAccessChain %53 %52 %16 %21 + %78 = OpLoad %15 %77 + %79 = OpConvertSToF %6 %78 + %80 = OpCompositeConstruct %60 %79 %79 %79 %79 + OpStore %62 %80 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 0.5 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true.amber b/vulkan/amber/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true.amber new file mode 100644 index 0000000..22cceb7 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true.amber @@ -0,0 +1,223 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of zero: 0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# int zero; +# }; +# +# void main() +# { +# // Results are undefined. +# float f = pow(- _float_1_0, sinh(1.0)); +# +# // The value of f doesn't matter because the right side is always true. +# if(f == _float_0_0 || zero == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 70 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %51 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %33 "buf2" + OpMemberName %33 0 "zero" + OpName %35 "" + OpName %40 "buf0" + OpMemberName %40 0 "_GLF_uniform_int_values" + OpName %42 "" + OpName %51 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 2 + OpDecorate %39 ArrayStride 16 + OpMemberDecorate %40 0 Offset 0 + OpDecorate %40 Block + OpDecorate %42 DescriptorSet 0 + OpDecorate %42 Binding 0 + OpDecorate %51 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 1 + %18 = OpTypePointer Uniform %6 + %22 = OpConstant %6 1 + %25 = OpTypeBool + %33 = OpTypeStruct %15 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpTypePointer Uniform %15 + %39 = OpTypeArray %15 %10 + %40 = OpTypeStruct %39 + %41 = OpTypePointer Uniform %40 + %42 = OpVariable %41 Uniform + %49 = OpTypeVector %6 4 + %50 = OpTypePointer Output %49 + %51 = OpVariable %50 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %6 %19 + %21 = OpFNegate %6 %20 + %23 = OpExtInst %6 %1 Sinh %22 + %24 = OpExtInst %6 %1 Pow %21 %23 + OpStore %8 %24 + %26 = OpLoad %6 %8 + %27 = OpAccessChain %18 %14 %16 %16 + %28 = OpLoad %6 %27 + %29 = OpFOrdEqual %25 %26 %28 + %30 = OpLogicalNot %25 %29 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + %37 = OpAccessChain %36 %35 %16 + %38 = OpLoad %15 %37 + %43 = OpAccessChain %36 %42 %16 %16 + %44 = OpLoad %15 %43 + %45 = OpIEqual %25 %38 %44 + OpBranch %32 + %32 = OpLabel + %46 = OpPhi %25 %29 %5 %45 %31 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %65 + %47 = OpLabel + %52 = OpAccessChain %36 %42 %16 %17 + %53 = OpLoad %15 %52 + %54 = OpConvertSToF %6 %53 + %55 = OpAccessChain %36 %42 %16 %16 + %56 = OpLoad %15 %55 + %57 = OpConvertSToF %6 %56 + %58 = OpAccessChain %36 %42 %16 %16 + %59 = OpLoad %15 %58 + %60 = OpConvertSToF %6 %59 + %61 = OpAccessChain %36 %42 %16 %17 + %62 = OpLoad %15 %61 + %63 = OpConvertSToF %6 %62 + %64 = OpCompositeConstruct %49 %54 %57 %60 %63 + OpStore %51 %64 + OpBranch %48 + %65 = OpLabel + %66 = OpAccessChain %36 %42 %16 %16 + %67 = OpLoad %15 %66 + %68 = OpConvertSToF %6 %67 + %69 = OpCompositeConstruct %49 %68 %68 %68 %68 + OpStore %51 %69 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 STD140 DATA + 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-pow-undefined.amber b/vulkan/amber/graphicsfuzz/cov-pow-undefined.amber new file mode 100644 index 0000000..890ee6f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-pow-undefined.amber @@ -0,0 +1,171 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific constant fold and selection dag code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = -1.0; +# float b = 1.7; +# +# // c becomes undefined since a < 0. This results in an undefined value, but not in undefined behavior. +# float c = pow(a, b); +# +# _GLF_color = vec4(c); +# +# if (a == -1.0 && b == 1.7) +# { +# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0); +# } +# else +# { +# _GLF_color = vec4(_float_1_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %18 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %10 "b" + OpName %12 "c" + OpName %18 "_GLF_color" + OpName %32 "buf0" + OpMemberName %32 0 "_GLF_uniform_float_values" + OpName %34 "" + OpDecorate %18 Location 0 + OpDecorate %31 ArrayStride 16 + OpMemberDecorate %32 0 Offset 0 + OpDecorate %32 Block + OpDecorate %34 DescriptorSet 0 + OpDecorate %34 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 -1 + %11 = OpConstant %6 1.70000005 + %16 = OpTypeVector %6 4 + %17 = OpTypePointer Output %16 + %18 = OpVariable %17 Output + %22 = OpTypeBool + %29 = OpTypeInt 32 0 + %30 = OpConstant %29 2 + %31 = OpTypeArray %6 %30 + %32 = OpTypeStruct %31 + %33 = OpTypePointer Uniform %32 + %34 = OpVariable %33 Uniform + %35 = OpTypeInt 32 1 + %36 = OpConstant %35 0 + %37 = OpTypePointer Uniform %6 + %40 = OpConstant %35 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %12 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %11 + %13 = OpLoad %6 %8 + %14 = OpLoad %6 %10 + %15 = OpExtInst %6 %1 Pow %13 %14 + OpStore %12 %15 + %19 = OpLoad %6 %12 + %20 = OpCompositeConstruct %16 %19 %19 %19 %19 + OpStore %18 %20 + %21 = OpLoad %6 %8 + %23 = OpFOrdEqual %22 %21 %9 + %24 = OpLoad %6 %10 + %25 = OpFOrdEqual %22 %24 %11 + %26 = OpLogicalAnd %22 %23 %25 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %48 + %27 = OpLabel + %38 = OpAccessChain %37 %34 %36 %36 + %39 = OpLoad %6 %38 + %41 = OpAccessChain %37 %34 %36 %40 + %42 = OpLoad %6 %41 + %43 = OpAccessChain %37 %34 %36 %40 + %44 = OpLoad %6 %43 + %45 = OpAccessChain %37 %34 %36 %36 + %46 = OpLoad %6 %45 + %47 = OpCompositeConstruct %16 %39 %42 %44 %46 + OpStore %18 %47 + OpBranch %28 + %48 = OpLabel + %49 = OpAccessChain %37 %34 %36 %36 + %50 = OpLoad %6 %49 + %51 = OpCompositeConstruct %16 %50 %50 %50 %50 + OpStore %18 %51 + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-rcp-negative-int.amber b/vulkan/amber/graphicsfuzz/cov-rcp-negative-int.amber new file mode 100644 index 0000000..02e1cd6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-rcp-negative-int.amber @@ -0,0 +1,160 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = -7563; +# +# // Always true. +# if(_int_1 / a == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %32 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %32 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %32 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 -7563 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %6 0 + %17 = OpConstant %6 1 + %18 = OpTypePointer Uniform %6 + %25 = OpTypeBool + %29 = OpTypeFloat 32 + %30 = OpTypeVector %29 4 + %31 = OpTypePointer Output %30 + %32 = OpVariable %31 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %19 = OpAccessChain %18 %15 %16 %17 + %20 = OpLoad %6 %19 + %21 = OpLoad %6 %8 + %22 = OpSDiv %6 %20 %21 + %23 = OpAccessChain %18 %15 %16 %16 + %24 = OpLoad %6 %23 + %26 = OpIEqual %25 %22 %24 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %46 + %27 = OpLabel + %33 = OpAccessChain %18 %15 %16 %17 + %34 = OpLoad %6 %33 + %35 = OpConvertSToF %29 %34 + %36 = OpAccessChain %18 %15 %16 %16 + %37 = OpLoad %6 %36 + %38 = OpConvertSToF %29 %37 + %39 = OpAccessChain %18 %15 %16 %16 + %40 = OpLoad %6 %39 + %41 = OpConvertSToF %29 %40 + %42 = OpAccessChain %18 %15 %16 %17 + %43 = OpLoad %6 %42 + %44 = OpConvertSToF %29 %43 + %45 = OpCompositeConstruct %30 %35 %38 %41 %44 + OpStore %32 %45 + OpBranch %28 + %46 = OpLabel + %47 = OpAccessChain %18 %15 %16 %16 + %48 = OpLoad %6 %47 + %49 = OpConvertSToF %29 %48 + %50 = OpCompositeConstruct %30 %49 %49 %49 %49 + OpStore %32 %50 + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-read-matrix-push-constant.amber b/vulkan/amber/graphicsfuzz/cov-read-matrix-push-constant.amber new file mode 100644 index 0000000..fe713eb --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-read-matrix-push-constant.amber @@ -0,0 +1,204 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific SPIR-V reader code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of m: [1.0, 5.0, 3.0, 7.0, 9.0, 6.0, 7.0, 8.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] +# layout(push_constant) uniform buf_push +# { +# mat4 m; +# }; +# +# void main() +# { +# // Always true. +# if(m[_int_0][_int_0] == _float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %41 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "buf_push" + OpMemberName %9 0 "m" + OpName %11 "" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %30 "buf1" + OpMemberName %30 0 "_GLF_uniform_float_values" + OpName %32 "" + OpName %41 "_GLF_color" + OpMemberDecorate %9 0 ColMajor + OpMemberDecorate %9 0 Offset 0 + OpMemberDecorate %9 0 MatrixStride 16 + OpDecorate %9 Block + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %29 ArrayStride 16 + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 1 + OpDecorate %41 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeMatrix %7 4 + %9 = OpTypeStruct %8 + %10 = OpTypePointer PushConstant %9 + %11 = OpVariable %10 PushConstant + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 2 + %16 = OpTypeArray %12 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypePointer Uniform %12 + %25 = OpTypePointer PushConstant %6 + %28 = OpConstant %14 1 + %29 = OpTypeArray %6 %28 + %30 = OpTypeStruct %29 + %31 = OpTypePointer Uniform %30 + %32 = OpVariable %31 Uniform + %33 = OpTypePointer Uniform %6 + %36 = OpTypeBool + %40 = OpTypePointer Output %7 + %41 = OpVariable %40 Output + %42 = OpConstant %12 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %21 = OpAccessChain %20 %19 %13 %13 + %22 = OpLoad %12 %21 + %23 = OpAccessChain %20 %19 %13 %13 + %24 = OpLoad %12 %23 + %26 = OpAccessChain %25 %11 %13 %22 %24 + %27 = OpLoad %6 %26 + %34 = OpAccessChain %33 %32 %13 %13 + %35 = OpLoad %6 %34 + %37 = OpFOrdEqual %36 %27 %35 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %56 + %38 = OpLabel + %43 = OpAccessChain %20 %19 %13 %42 + %44 = OpLoad %12 %43 + %45 = OpConvertSToF %6 %44 + %46 = OpAccessChain %20 %19 %13 %13 + %47 = OpLoad %12 %46 + %48 = OpConvertSToF %6 %47 + %49 = OpAccessChain %20 %19 %13 %13 + %50 = OpLoad %12 %49 + %51 = OpConvertSToF %6 %50 + %52 = OpAccessChain %20 %19 %13 %42 + %53 = OpLoad %12 %52 + %54 = OpConvertSToF %6 %53 + %55 = OpCompositeConstruct %7 %45 %48 %51 %54 + OpStore %41 %55 + OpBranch %39 + %56 = OpLabel + %57 = OpAccessChain %20 %19 %13 %13 + %58 = OpLoad %12 %57 + %59 = OpConvertSToF %6 %58 + %60 = OpCompositeConstruct %7 %59 %59 %59 %59 + OpStore %41 %60 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# m +BUFFER variant_m DATA_TYPE mat4x4[] STD140 DATA + 1.0 5.0 3.0 7.0 9.0 6.0 7.0 8.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_m AS push_constant + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-reciprocal-var-minus-one.amber b/vulkan/amber/graphicsfuzz/cov-reciprocal-var-minus-one.amber new file mode 100644 index 0000000..6ccb578 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-reciprocal-var-minus-one.amber @@ -0,0 +1,160 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = -1; +# +# // Always true. +# if(_int_1 / a < _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %32 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_int_values" + OpName %15 "" + OpName %32 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %32 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 -1 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %6 0 + %17 = OpConstant %6 1 + %18 = OpTypePointer Uniform %6 + %25 = OpTypeBool + %29 = OpTypeFloat 32 + %30 = OpTypeVector %29 4 + %31 = OpTypePointer Output %30 + %32 = OpVariable %31 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %19 = OpAccessChain %18 %15 %16 %17 + %20 = OpLoad %6 %19 + %21 = OpLoad %6 %8 + %22 = OpSDiv %6 %20 %21 + %23 = OpAccessChain %18 %15 %16 %17 + %24 = OpLoad %6 %23 + %26 = OpSLessThan %25 %22 %24 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %46 + %27 = OpLabel + %33 = OpAccessChain %18 %15 %16 %17 + %34 = OpLoad %6 %33 + %35 = OpConvertSToF %29 %34 + %36 = OpAccessChain %18 %15 %16 %16 + %37 = OpLoad %6 %36 + %38 = OpConvertSToF %29 %37 + %39 = OpAccessChain %18 %15 %16 %16 + %40 = OpLoad %6 %39 + %41 = OpConvertSToF %29 %40 + %42 = OpAccessChain %18 %15 %16 %17 + %43 = OpLoad %6 %42 + %44 = OpConvertSToF %29 %43 + %45 = OpCompositeConstruct %30 %35 %38 %41 %44 + OpStore %32 %45 + OpBranch %28 + %46 = OpLabel + %47 = OpAccessChain %18 %15 %16 %16 + %48 = OpLoad %6 %47 + %49 = OpConvertSToF %29 %48 + %50 = OpCompositeConstruct %30 %49 %49 %49 %49 + OpStore %32 %50 + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-reduce-load-array-replace-extract.amber b/vulkan/amber/graphicsfuzz/cov-reduce-load-array-replace-extract.amber new file mode 100644 index 0000000..46bef4b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-reduce-load-array-replace-extract.amber @@ -0,0 +1,183 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific load size reduction path. + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-Os' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int zero; +# }; +# +# struct S +# { +# int x[1]; +# }; +# +# // Function returns 1 or 2. +# int func(S s, int a) +# { +# _GLF_color = vec4(0); +# +# if(s.x[zero] == a) +# return 1; +# +# return 2; +# } +# +# void main() +# { +# S s; // Uninitialized. Contents don't matter. +# int res = func(s, s.x[0]); +# // Always true. +# if (res == 1 || res == 2) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 97 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %21 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %21 "_GLF_color" + OpName %25 "buf0" + OpMemberName %25 0 "zero" + OpName %27 "" + OpDecorate %21 Location 0 + OpMemberDecorate %25 0 RelaxedPrecision + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 0 + OpDecorate %49 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %88 RelaxedPrecision + OpDecorate %96 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 1 + %9 = OpTypeArray %6 %8 + %12 = OpTypePointer Function %6 + %18 = OpTypeFloat 32 + %19 = OpTypeVector %18 4 + %20 = OpTypePointer Output %19 + %21 = OpVariable %20 Output + %22 = OpConstant %18 0 + %23 = OpConstantComposite %19 %22 %22 %22 %22 + %24 = OpConstant %6 0 + %25 = OpTypeStruct %6 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypePointer Uniform %6 + %34 = OpTypeBool + %38 = OpConstant %6 1 + %40 = OpConstant %6 2 + %58 = OpConstant %18 1 + %59 = OpConstantComposite %19 %58 %22 %22 %58 + %87 = OpTypePointer Function %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %88 = OpVariable %87 Function + %89 = OpLoad %9 %88 + %49 = OpCompositeExtract %6 %89 0 + OpBranch %74 + %74 = OpLabel + OpLoopMerge %75 %76 None + OpBranch %77 + %77 = OpLabel + OpStore %21 %23 + %78 = OpAccessChain %28 %27 %24 + %79 = OpLoad %6 %78 + %94 = OpAccessChain %12 %88 %79 + %81 = OpLoad %6 %94 + %83 = OpIEqual %34 %81 %49 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %84 + %85 = OpLabel + OpBranch %75 + %84 = OpLabel + OpBranch %75 + %76 = OpLabel + OpBranch %74 + %75 = OpLabel + %96 = OpPhi %6 %38 %85 %40 %84 + %52 = OpIEqual %34 %96 %38 + %54 = OpIEqual %34 %96 %40 + %55 = OpLogicalOr %34 %52 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %60 + %60 = OpLabel + OpStore %21 %23 + OpBranch %57 + %56 = OpLabel + OpStore %21 %59 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-reduce-load-replace-extract.amber b/vulkan/amber/graphicsfuzz/cov-reduce-load-replace-extract.amber new file mode 100644 index 0000000..54dcbe5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-reduce-load-replace-extract.amber @@ -0,0 +1,228 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific load size reduction path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# struct S +# { +# int x; +# int y; +# } ; +# +# void func(inout S arg) +# { +# arg.y = 1; +# } +# +# void main() +# { +# float a = 5.0; +# +# do +# { +# S b[2]; +# b[one].x = 1; +# +# // Always true. +# if (b[1].x == 1) +# { +# // Always true. +# if (one == 1) +# break; +# +# // Unreachable code. +# func(b[1]); +# a = float(b[1].y); +# } +# +# // Unreachable code. +# a = 0.0; +# } +# while(false); +# +# if (a == 5.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %66 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "S" + OpMemberName %7 0 "x" + OpMemberName %7 1 "y" + OpName %11 "func(struct-S-i1-i11;" + OpName %10 "arg" + OpName %18 "a" + OpName %28 "b" + OpName %29 "buf0" + OpMemberName %29 0 "one" + OpName %31 "" + OpName %49 "param" + OpName %66 "_GLF_color" + OpMemberDecorate %29 0 Offset 0 + OpDecorate %29 Block + OpDecorate %31 DescriptorSet 0 + OpDecorate %31 Binding 0 + OpDecorate %66 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %2 %8 + %13 = OpConstant %6 1 + %14 = OpTypePointer Function %6 + %16 = OpTypeFloat 32 + %17 = OpTypePointer Function %16 + %19 = OpConstant %16 5 + %24 = OpTypeInt 32 0 + %25 = OpConstant %24 2 + %26 = OpTypeArray %7 %25 + %27 = OpTypePointer Function %26 + %29 = OpTypeStruct %6 + %30 = OpTypePointer Uniform %29 + %31 = OpVariable %30 Uniform + %32 = OpConstant %6 0 + %33 = OpTypePointer Uniform %6 + %39 = OpTypeBool + %58 = OpConstant %16 0 + %59 = OpConstantFalse %39 + %64 = OpTypeVector %16 4 + %65 = OpTypePointer Output %64 + %66 = OpVariable %65 Output + %67 = OpConstant %16 1 + %68 = OpConstantComposite %64 %67 %58 %58 %67 + %70 = OpConstantComposite %64 %58 %58 %58 %58 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %18 = OpVariable %17 Function + %28 = OpVariable %27 Function + %49 = OpVariable %8 Function + OpStore %18 %19 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %21 + %21 = OpLabel + %34 = OpAccessChain %33 %31 %32 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %14 %28 %35 %32 + OpStore %36 %13 + %37 = OpAccessChain %14 %28 %13 %32 + %38 = OpLoad %6 %37 + %40 = OpIEqual %39 %38 %13 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %42 + %41 = OpLabel + %43 = OpAccessChain %33 %31 %32 + %44 = OpLoad %6 %43 + %45 = OpIEqual %39 %44 %13 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + OpBranch %22 + %47 = OpLabel + %50 = OpAccessChain %8 %28 %13 + %51 = OpLoad %7 %50 + OpStore %49 %51 + %52 = OpFunctionCall %2 %11 %49 + %53 = OpLoad %7 %49 + %54 = OpAccessChain %8 %28 %13 + OpStore %54 %53 + %55 = OpAccessChain %14 %28 %13 %13 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %16 %56 + OpStore %18 %57 + OpBranch %42 + %42 = OpLabel + OpStore %18 %58 + OpBranch %23 + %23 = OpLabel + OpBranchConditional %59 %20 %22 + %22 = OpLabel + %60 = OpLoad %16 %18 + %61 = OpFOrdEqual %39 %60 %19 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %69 + %62 = OpLabel + OpStore %66 %68 + OpBranch %63 + %69 = OpLabel + OpStore %66 %70 + OpBranch %63 + %63 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %9 + %10 = OpFunctionParameter %8 + %12 = OpLabel + %15 = OpAccessChain %14 %10 %13 + OpStore %15 %13 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard.amber b/vulkan/amber/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard.amber new file mode 100644 index 0000000..ee48a73 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard.amber @@ -0,0 +1,247 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers register coalescer, live intervals and target instr info code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [10, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_v1; +# +# void main() +# { +# for (int i = _int_0; i < _int_10; i++) +# { +# // Always false. +# if (_float_0_0 > _float_1_0) +# { +# discard; +# } +# for (int j = _int_0; j < _int_10; j++) +# { +# // Always false. +# if (gl_FragCoord.x < _float_0_0) +# { +# discard; +# } +# _GLF_v1 = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 90 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %59 %71 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %33 "buf0" + OpMemberName %33 0 "_GLF_uniform_float_values" + OpName %35 "" + OpName %45 "j" + OpName %59 "gl_FragCoord" + OpName %71 "_GLF_v1" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %32 ArrayStride 16 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 0 + OpDecorate %59 BuiltIn FragCoord + OpDecorate %71 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %28 = OpTypeBool + %30 = OpTypeFloat 32 + %31 = OpConstant %9 2 + %32 = OpTypeArray %30 %31 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpTypePointer Uniform %30 + %57 = OpTypeVector %30 4 + %58 = OpTypePointer Input %57 + %59 = OpVariable %58 Input + %60 = OpConstant %9 0 + %61 = OpTypePointer Input %30 + %70 = OpTypePointer Output %57 + %71 = OpVariable %70 Output + %72 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %45 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %6 %8 + %26 = OpAccessChain %17 %14 %15 %15 + %27 = OpLoad %6 %26 + %29 = OpSLessThan %28 %25 %27 + OpBranchConditional %29 %21 %22 + %21 = OpLabel + %37 = OpAccessChain %36 %35 %15 %15 + %38 = OpLoad %30 %37 + %39 = OpAccessChain %36 %35 %15 %16 + %40 = OpLoad %30 %39 + %41 = OpFOrdGreaterThan %28 %38 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %43 + %42 = OpLabel + OpTerminateInvocation + %43 = OpLabel + %46 = OpAccessChain %17 %14 %15 %16 + %47 = OpLoad %6 %46 + OpStore %45 %47 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %6 %45 + %54 = OpAccessChain %17 %14 %15 %15 + %55 = OpLoad %6 %54 + %56 = OpSLessThan %28 %53 %55 + OpBranchConditional %56 %49 %50 + %49 = OpLabel + %62 = OpAccessChain %61 %59 %60 + %63 = OpLoad %30 %62 + %64 = OpAccessChain %36 %35 %15 %15 + %65 = OpLoad %30 %64 + %66 = OpFOrdLessThan %28 %63 %65 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %68 + %67 = OpLabel + OpTerminateInvocation + %68 = OpLabel + %73 = OpAccessChain %17 %14 %15 %72 + %74 = OpLoad %6 %73 + %75 = OpConvertSToF %30 %74 + %76 = OpAccessChain %17 %14 %15 %16 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %30 %77 + %79 = OpAccessChain %17 %14 %15 %16 + %80 = OpLoad %6 %79 + %81 = OpConvertSToF %30 %80 + %82 = OpAccessChain %17 %14 %15 %72 + %83 = OpLoad %6 %82 + %84 = OpConvertSToF %30 %83 + %85 = OpCompositeConstruct %57 %75 %78 %81 %84 + OpStore %71 %85 + OpBranch %51 + %51 = OpLabel + %86 = OpLoad %6 %45 + %87 = OpIAdd %6 %86 %16 + OpStore %45 %87 + OpBranch %48 + %50 = OpLabel + OpBranch %23 + %23 = OpLabel + %88 = OpLoad %6 %8 + %89 = OpIAdd %6 %88 %16 + OpStore %8 %89 + OpBranch %20 + %22 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value.amber b/vulkan/amber/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value.amber new file mode 100644 index 0000000..8ecbcb8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value.amber @@ -0,0 +1,278 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [2, 0, 1, 3] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f; +# mat2 m; +# +# // Always false. +# if (_int_0 == 1) +# { +# // Uses an undefined value, but this is never executed. +# m = mat2(f); +# } +# +# // Initialize all matrix elements in a loop. +# for(int i = _int_0; i < _int_2; i++) +# { +# for(int j = _int_0; j < _int_2; j++) +# { +# m[i][j] = float(i * _int_2 + j); +# } +# } +# +# // Always true. +# if(m == mat2(_int_0, _int_1, _int_2, _int_3)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 125 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %106 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "buf0" + OpMemberName %10 0 "_GLF_uniform_int_values" + OpName %12 "" + OpName %26 "m" + OpName %28 "f" + OpName %36 "i" + OpName %48 "j" + OpName %106 "_GLF_color" + OpDecorate %9 ArrayStride 16 + OpMemberDecorate %10 0 Offset 0 + OpDecorate %10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %106 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 4 + %9 = OpTypeArray %6 %8 + %10 = OpTypeStruct %9 + %11 = OpTypePointer Uniform %10 + %12 = OpVariable %11 Uniform + %13 = OpConstant %6 0 + %14 = OpConstant %6 1 + %15 = OpTypePointer Uniform %6 + %18 = OpTypeBool + %22 = OpTypeFloat 32 + %23 = OpTypeVector %22 2 + %24 = OpTypeMatrix %23 2 + %25 = OpTypePointer Function %24 + %27 = OpTypePointer Function %22 + %30 = OpConstant %22 1 + %31 = OpConstant %22 0 + %35 = OpTypePointer Function %6 + %78 = OpConstant %6 2 + %85 = OpConstant %6 3 + %94 = OpTypeVector %18 2 + %104 = OpTypeVector %22 4 + %105 = OpTypePointer Output %104 + %106 = OpVariable %105 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %26 = OpVariable %25 Function + %28 = OpVariable %27 Function + %36 = OpVariable %35 Function + %48 = OpVariable %35 Function + %16 = OpAccessChain %15 %12 %13 %14 + %17 = OpLoad %6 %16 + %19 = OpIEqual %18 %17 %14 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %21 + %20 = OpLabel + %29 = OpLoad %22 %28 + %32 = OpCompositeConstruct %23 %29 %31 + %33 = OpCompositeConstruct %23 %31 %29 + %34 = OpCompositeConstruct %24 %32 %33 + OpStore %26 %34 + OpBranch %21 + %21 = OpLabel + %37 = OpAccessChain %15 %12 %13 %14 + %38 = OpLoad %6 %37 + OpStore %36 %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %6 %36 + %45 = OpAccessChain %15 %12 %13 %13 + %46 = OpLoad %6 %45 + %47 = OpSLessThan %18 %44 %46 + OpBranchConditional %47 %40 %41 + %40 = OpLabel + %49 = OpAccessChain %15 %12 %13 %14 + %50 = OpLoad %6 %49 + OpStore %48 %50 + OpBranch %51 + %51 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %6 %48 + %57 = OpAccessChain %15 %12 %13 %13 + %58 = OpLoad %6 %57 + %59 = OpSLessThan %18 %56 %58 + OpBranchConditional %59 %52 %53 + %52 = OpLabel + %60 = OpLoad %6 %36 + %61 = OpLoad %6 %48 + %62 = OpLoad %6 %36 + %63 = OpAccessChain %15 %12 %13 %13 + %64 = OpLoad %6 %63 + %65 = OpIMul %6 %62 %64 + %66 = OpLoad %6 %48 + %67 = OpIAdd %6 %65 %66 + %68 = OpConvertSToF %22 %67 + %69 = OpAccessChain %27 %26 %60 %61 + OpStore %69 %68 + OpBranch %54 + %54 = OpLabel + %70 = OpLoad %6 %48 + %71 = OpIAdd %6 %70 %14 + OpStore %48 %71 + OpBranch %51 + %53 = OpLabel + OpBranch %42 + %42 = OpLabel + %72 = OpLoad %6 %36 + %73 = OpIAdd %6 %72 %14 + OpStore %36 %73 + OpBranch %39 + %41 = OpLabel + %74 = OpLoad %24 %26 + %75 = OpAccessChain %15 %12 %13 %14 + %76 = OpLoad %6 %75 + %77 = OpConvertSToF %22 %76 + %79 = OpAccessChain %15 %12 %13 %78 + %80 = OpLoad %6 %79 + %81 = OpConvertSToF %22 %80 + %82 = OpAccessChain %15 %12 %13 %13 + %83 = OpLoad %6 %82 + %84 = OpConvertSToF %22 %83 + %86 = OpAccessChain %15 %12 %13 %85 + %87 = OpLoad %6 %86 + %88 = OpConvertSToF %22 %87 + %89 = OpCompositeConstruct %23 %77 %81 + %90 = OpCompositeConstruct %23 %84 %88 + %91 = OpCompositeConstruct %24 %89 %90 + %92 = OpCompositeExtract %23 %74 0 + %93 = OpCompositeExtract %23 %91 0 + %95 = OpFOrdEqual %94 %92 %93 + %96 = OpAll %18 %95 + %97 = OpCompositeExtract %23 %74 1 + %98 = OpCompositeExtract %23 %91 1 + %99 = OpFOrdEqual %94 %97 %98 + %100 = OpAll %18 %99 + %101 = OpLogicalAnd %18 %96 %100 + OpSelectionMerge %103 None + OpBranchConditional %101 %102 %120 + %102 = OpLabel + %107 = OpAccessChain %15 %12 %13 %78 + %108 = OpLoad %6 %107 + %109 = OpConvertSToF %22 %108 + %110 = OpAccessChain %15 %12 %13 %14 + %111 = OpLoad %6 %110 + %112 = OpConvertSToF %22 %111 + %113 = OpAccessChain %15 %12 %13 %14 + %114 = OpLoad %6 %113 + %115 = OpConvertSToF %22 %114 + %116 = OpAccessChain %15 %12 %13 %78 + %117 = OpLoad %6 %116 + %118 = OpConvertSToF %22 %117 + %119 = OpCompositeConstruct %104 %109 %112 %115 %118 + OpStore %106 %119 + OpBranch %103 + %120 = OpLabel + %121 = OpAccessChain %15 %12 %13 %14 + %122 = OpLoad %6 %121 + %123 = OpConvertSToF %22 %122 + %124 = OpCompositeConstruct %104 %123 %123 %123 %123 + OpStore %106 %124 + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 0 1 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-repeating-conditions-fract-unused.amber b/vulkan/amber/graphicsfuzz/cov-repeating-conditions-fract-unused.amber new file mode 100644 index 0000000..d8b5313 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-repeating-conditions-fract-unused.amber @@ -0,0 +1,230 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_5 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: 0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[1]; +# }; +# // Contents of _GLF_uniform_float_values: [0.0, 1.5] +# layout(set = 0, binding = 1) uniform buf1 { +# float _GLF_uniform_float_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = _float_1_5; +# _GLF_color = vec4(_int_0); +# +# // Always true. +# if(gl_FragCoord.y > _float_0_0) +# { +# _GLF_color = vec4(1); +# } +# +# // Always true. +# if(gl_FragCoord.x > _float_0_0) +# { +# _GLF_color = vec4(2); +# } +# +# // Always true. +# if(gl_FragCoord.x > _float_0_0) +# { +# _GLF_color = vec4(1, 0, 0, 1); +# +# // Always true. +# if(gl_FragCoord.y > _float_0_0) +# { +# // Result is unused. +# fract(a); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %23 %35 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %23 "_GLF_color" + OpName %26 "buf0" + OpMemberName %26 0 "_GLF_uniform_int_values" + OpName %28 "" + OpName %35 "gl_FragCoord" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %23 Location 0 + OpDecorate %25 ArrayStride 16 + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 0 + OpDecorate %35 BuiltIn FragCoord + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 1 + %18 = OpTypePointer Uniform %6 + %21 = OpTypeVector %6 4 + %22 = OpTypePointer Output %21 + %23 = OpVariable %22 Output + %24 = OpConstant %9 1 + %25 = OpTypeArray %15 %24 + %26 = OpTypeStruct %25 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpTypePointer Uniform %15 + %34 = OpTypePointer Input %21 + %35 = OpVariable %34 Input + %36 = OpTypePointer Input %6 + %41 = OpTypeBool + %45 = OpConstant %6 1 + %46 = OpConstantComposite %21 %45 %45 %45 %45 + %47 = OpConstant %9 0 + %55 = OpConstant %6 2 + %56 = OpConstantComposite %21 %55 %55 %55 %55 + %64 = OpConstant %6 0 + %65 = OpConstantComposite %21 %45 %64 %64 %45 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %6 %19 + OpStore %8 %20 + %30 = OpAccessChain %29 %28 %16 %16 + %31 = OpLoad %15 %30 + %32 = OpConvertSToF %6 %31 + %33 = OpCompositeConstruct %21 %32 %32 %32 %32 + OpStore %23 %33 + %37 = OpAccessChain %36 %35 %24 + %38 = OpLoad %6 %37 + %39 = OpAccessChain %18 %14 %16 %16 + %40 = OpLoad %6 %39 + %42 = OpFOrdGreaterThan %41 %38 %40 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %44 + %43 = OpLabel + OpStore %23 %46 + OpBranch %44 + %44 = OpLabel + %48 = OpAccessChain %36 %35 %47 + %49 = OpLoad %6 %48 + %50 = OpAccessChain %18 %14 %16 %16 + %51 = OpLoad %6 %50 + %52 = OpFOrdGreaterThan %41 %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + OpStore %23 %56 + OpBranch %54 + %54 = OpLabel + %57 = OpAccessChain %36 %35 %47 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %18 %14 %16 %16 + %60 = OpLoad %6 %59 + %61 = OpFOrdGreaterThan %41 %58 %60 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %63 + %62 = OpLabel + OpStore %23 %65 + %66 = OpAccessChain %36 %35 %24 + %67 = OpLoad %6 %66 + %68 = OpAccessChain %18 %14 %16 %16 + %69 = OpLoad %6 %68 + %70 = OpFOrdGreaterThan %41 %67 %69 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %72 + %71 = OpLabel + %73 = OpLoad %6 %8 + %74 = OpExtInst %6 %1 Fract %73 + OpBranch %72 + %72 = OpLabel + OpBranch %63 + %63 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.5 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-replace-copy-object.amber b/vulkan/amber/graphicsfuzz/cov-replace-copy-object.amber new file mode 100644 index 0000000..51f532b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-replace-copy-object.amber @@ -0,0 +1,276 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific shader simplification path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision lowp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# struct S +# { +# int data; +# }; +# +# int func(inout S s, int x) +# { +# if (s.data == 1) +# return x + s.data; +# else +# return x; +# } +# +# void main() +# { +# int a = 0; +# S arr[1]; +# +# arr[0].data = one; +# +# for(int i = 0; i < 5 + one; i++) +# { +# if (i % 2 != 0) +# a = func(arr[0], i); +# else +# a = func(arr[0], 1); +# } +# +# if (a == 6) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 95 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %89 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "S" + OpMemberName %7 0 "data" + OpName %13 "func(struct-S-i11;i1;" + OpName %11 "s" + OpName %12 "x" + OpName %32 "a" + OpName %37 "arr" + OpName %38 "buf0" + OpMemberName %38 0 "one" + OpName %40 "" + OpName %45 "i" + OpName %63 "param" + OpName %66 "param" + OpName %72 "param" + OpName %75 "param" + OpName %89 "_GLF_color" + OpMemberDecorate %7 0 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpMemberDecorate %38 0 RelaxedPrecision + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 0 + OpDecorate %43 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %59 RelaxedPrecision + OpDecorate %67 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %89 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Function %7 + %9 = OpTypePointer Function %6 + %10 = OpTypeFunction %6 %8 %9 + %15 = OpConstant %6 0 + %18 = OpConstant %6 1 + %19 = OpTypeBool + %33 = OpTypeInt 32 0 + %34 = OpConstant %33 1 + %35 = OpTypeArray %7 %34 + %36 = OpTypePointer Function %35 + %38 = OpTypeStruct %6 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %41 = OpTypePointer Uniform %6 + %52 = OpConstant %6 5 + %58 = OpConstant %6 2 + %82 = OpConstant %6 6 + %86 = OpTypeFloat 32 + %87 = OpTypeVector %86 4 + %88 = OpTypePointer Output %87 + %89 = OpVariable %88 Output + %90 = OpConstant %86 1 + %91 = OpConstant %86 0 + %92 = OpConstantComposite %87 %90 %91 %91 %90 + %94 = OpConstantComposite %87 %91 %91 %91 %91 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %32 = OpVariable %9 Function + %37 = OpVariable %36 Function + %45 = OpVariable %9 Function + %63 = OpVariable %8 Function + %66 = OpVariable %9 Function + %72 = OpVariable %8 Function + %75 = OpVariable %9 Function + OpStore %32 %15 + %42 = OpAccessChain %41 %40 %15 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %9 %37 %15 %15 + OpStore %44 %43 + OpStore %45 %15 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %6 %45 + %53 = OpAccessChain %41 %40 %15 + %54 = OpLoad %6 %53 + %55 = OpIAdd %6 %52 %54 + %56 = OpSLessThan %19 %51 %55 + OpBranchConditional %56 %47 %48 + %47 = OpLabel + %57 = OpLoad %6 %45 + %59 = OpSMod %6 %57 %58 + %60 = OpINotEqual %19 %59 %15 + OpSelectionMerge %62 None + OpBranchConditional %60 %61 %71 + %61 = OpLabel + %64 = OpAccessChain %8 %37 %15 + %65 = OpLoad %7 %64 + OpStore %63 %65 + %67 = OpLoad %6 %45 + OpStore %66 %67 + %68 = OpFunctionCall %6 %13 %63 %66 + %69 = OpLoad %7 %63 + %70 = OpAccessChain %8 %37 %15 + OpStore %70 %69 + OpStore %32 %68 + OpBranch %62 + %71 = OpLabel + %73 = OpAccessChain %8 %37 %15 + %74 = OpLoad %7 %73 + OpStore %72 %74 + OpStore %75 %18 + %76 = OpFunctionCall %6 %13 %72 %75 + %77 = OpLoad %7 %72 + %78 = OpAccessChain %8 %37 %15 + OpStore %78 %77 + OpStore %32 %76 + OpBranch %62 + %62 = OpLabel + OpBranch %49 + %49 = OpLabel + %79 = OpLoad %6 %45 + %80 = OpIAdd %6 %79 %18 + OpStore %45 %80 + OpBranch %46 + %48 = OpLabel + %81 = OpLoad %6 %32 + %83 = OpIEqual %19 %81 %82 + OpSelectionMerge %85 None + OpBranchConditional %83 %84 %93 + %84 = OpLabel + OpStore %89 %92 + OpBranch %85 + %93 = OpLabel + OpStore %89 %94 + OpBranch %85 + %85 = OpLabel + OpReturn + OpFunctionEnd + %13 = OpFunction %6 None %10 + %11 = OpFunctionParameter %8 + %12 = OpFunctionParameter %9 + %14 = OpLabel + %16 = OpAccessChain %9 %11 %15 + %17 = OpLoad %6 %16 + %20 = OpIEqual %19 %17 %18 + OpSelectionMerge %22 None + OpBranchConditional %20 %21 %28 + %21 = OpLabel + %23 = OpLoad %6 %12 + %24 = OpAccessChain %9 %11 %15 + %25 = OpLoad %6 %24 + %26 = OpIAdd %6 %23 %25 + OpReturnValue %26 + %28 = OpLabel + %29 = OpLoad %6 %12 + OpReturnValue %29 + %22 = OpLabel + OpUnreachable + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-return-after-do-while.amber b/vulkan/amber/graphicsfuzz/cov-return-after-do-while.amber new file mode 100644 index 0000000..8c658a1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-return-after-do-while.amber @@ -0,0 +1,168 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific simplify cfg code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Always false. +# if(_int_0 > _int_1) +# { +# do +# { +# _GLF_color = vec4(_int_1); +# } +# while(_int_0 > _int_1); +# +# return; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpConstant %10 1 + %37 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %23 = OpAccessChain %18 %16 %17 %22 + %24 = OpLoad %10 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpAccessChain %18 %16 %17 %22 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %10 %29 + %31 = OpConvertSToF %6 %30 + %32 = OpCompositeConstruct %7 %21 %25 %28 %31 + OpStore %9 %32 + %33 = OpAccessChain %18 %16 %17 %22 + %34 = OpLoad %10 %33 + %35 = OpAccessChain %18 %16 %17 %17 + %36 = OpLoad %10 %35 + %38 = OpSGreaterThan %37 %34 %36 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + OpBranch %41 + %41 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %42 + %42 = OpLabel + %45 = OpAccessChain %18 %16 %17 %17 + %46 = OpLoad %10 %45 + %47 = OpConvertSToF %6 %46 + %48 = OpCompositeConstruct %7 %47 %47 %47 %47 + OpStore %9 %48 + OpBranch %44 + %44 = OpLabel + %49 = OpAccessChain %18 %16 %17 %22 + %50 = OpLoad %10 %49 + %51 = OpAccessChain %18 %16 %17 %17 + %52 = OpLoad %10 %51 + %53 = OpSGreaterThan %37 %50 %52 + OpBranchConditional %53 %41 %43 + %43 = OpLabel + OpReturn + %40 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-return-after-first-iteration.amber b/vulkan/amber/graphicsfuzz/cov-return-after-first-iteration.amber new file mode 100644 index 0000000..070d5d2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-return-after-first-iteration.amber @@ -0,0 +1,236 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_100 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_10_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 10.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# // Contents of _GLF_uniform_int_values: [100, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // To hit the coverage points this value cannot +# // be changed later. +# _GLF_color = vec4(1, 0, 0, 1); +# +# for (int i = _int_0; i < _int_100; i++) +# { +# if (i != _int_0) +# { +# return; +# } +# } +# +# // Execution never reaches this point. +# if (gl_FragCoord.y < _float_10_0) +# { +# return; +# } +# _GLF_color = vec4(vec3(1.0), injectionSwitch.y); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %47 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %15 "i" + OpName %19 "buf1" + OpMemberName %19 0 "_GLF_uniform_int_values" + OpName %21 "" + OpName %47 "gl_FragCoord" + OpName %53 "buf0" + OpMemberName %53 0 "_GLF_uniform_float_values" + OpName %55 "" + OpName %66 "buf2" + OpMemberName %66 0 "injectionSwitch" + OpName %68 "" + OpDecorate %9 Location 0 + OpDecorate %18 ArrayStride 16 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 1 + OpDecorate %47 BuiltIn FragCoord + OpDecorate %52 ArrayStride 16 + OpMemberDecorate %53 0 Offset 0 + OpDecorate %53 Block + OpDecorate %55 DescriptorSet 0 + OpDecorate %55 Binding 0 + OpMemberDecorate %66 0 Offset 0 + OpDecorate %66 Block + OpDecorate %68 DescriptorSet 0 + OpDecorate %68 Binding 2 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstant %6 0 + %12 = OpConstantComposite %7 %10 %11 %11 %10 + %13 = OpTypeInt 32 1 + %14 = OpTypePointer Function %13 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 2 + %18 = OpTypeArray %13 %17 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpConstant %13 0 + %23 = OpConstant %13 1 + %24 = OpTypePointer Uniform %13 + %35 = OpTypeBool + %46 = OpTypePointer Input %7 + %47 = OpVariable %46 Input + %48 = OpConstant %16 1 + %49 = OpTypePointer Input %6 + %52 = OpTypeArray %6 %48 + %53 = OpTypeStruct %52 + %54 = OpTypePointer Uniform %53 + %55 = OpVariable %54 Uniform + %56 = OpTypePointer Uniform %6 + %63 = OpTypeVector %6 3 + %64 = OpConstantComposite %63 %10 %10 %10 + %65 = OpTypeVector %6 2 + %66 = OpTypeStruct %65 + %67 = OpTypePointer Uniform %66 + %68 = OpVariable %67 Uniform + %4 = OpFunction %2 None %3 + %5 = OpLabel + %15 = OpVariable %14 Function + OpStore %9 %12 + %25 = OpAccessChain %24 %21 %22 %23 + %26 = OpLoad %13 %25 + OpStore %15 %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %13 %15 + %33 = OpAccessChain %24 %21 %22 %22 + %34 = OpLoad %13 %33 + %36 = OpSLessThan %35 %32 %34 + OpBranchConditional %36 %28 %29 + %28 = OpLabel + %37 = OpLoad %13 %15 + %38 = OpAccessChain %24 %21 %22 %23 + %39 = OpLoad %13 %38 + %40 = OpINotEqual %35 %37 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %42 + %41 = OpLabel + OpReturn + %42 = OpLabel + OpBranch %30 + %30 = OpLabel + %44 = OpLoad %13 %15 + %45 = OpIAdd %13 %44 %23 + OpStore %15 %45 + OpBranch %27 + %29 = OpLabel + %50 = OpAccessChain %49 %47 %48 + %51 = OpLoad %6 %50 + %57 = OpAccessChain %56 %55 %22 %22 + %58 = OpLoad %6 %57 + %59 = OpFOrdLessThan %35 %51 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %60 %61 + %60 = OpLabel + OpReturn + %61 = OpLabel + %69 = OpAccessChain %56 %68 %22 %48 + %70 = OpLoad %6 %69 + %71 = OpCompositeExtract %6 %64 0 + %72 = OpCompositeExtract %6 %64 1 + %73 = OpCompositeExtract %6 %64 2 + %74 = OpCompositeConstruct %7 %71 %72 %73 %70 + OpStore %9 %74 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 100 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 10.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-return-partly-undefined-vector-from-array.amber b/vulkan/amber/graphicsfuzz/cov-return-partly-undefined-vector-from-array.amber new file mode 100644 index 0000000..0d03e12 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-return-partly-undefined-vector-from-array.amber @@ -0,0 +1,224 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_5_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [5.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec2 func() +# { +# vec2 v; +# v.y = _float_5_0; +# int a = 2; +# return vec2[3](vec2(_float_1_0), vec2(_float_1_0), v)[a]; +# } +# +# void main() +# { +# if(func().y == _float_5_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 82 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %58 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "func(" + OpName %12 "v" + OpName %16 "buf0" + OpMemberName %16 0 "_GLF_uniform_float_values" + OpName %18 "" + OpName %28 "a" + OpName %43 "indexable" + OpName %58 "_GLF_color" + OpName %60 "buf1" + OpMemberName %60 0 "_GLF_uniform_int_values" + OpName %62 "" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %58 Location 0 + OpDecorate %59 ArrayStride 16 + OpMemberDecorate %60 0 Offset 0 + OpDecorate %60 Block + OpDecorate %62 DescriptorSet 0 + OpDecorate %62 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeFunction %7 + %11 = OpTypePointer Function %7 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 2 + %15 = OpTypeArray %6 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpTypeInt 32 1 + %20 = OpConstant %19 0 + %21 = OpTypePointer Uniform %6 + %24 = OpConstant %13 1 + %25 = OpTypePointer Function %6 + %27 = OpTypePointer Function %19 + %29 = OpConstant %19 2 + %30 = OpConstant %19 1 + %38 = OpConstant %13 3 + %39 = OpTypeArray %7 %38 + %42 = OpTypePointer Function %39 + %52 = OpTypeBool + %56 = OpTypeVector %6 4 + %57 = OpTypePointer Output %56 + %58 = OpVariable %57 Output + %59 = OpTypeArray %19 %14 + %60 = OpTypeStruct %59 + %61 = OpTypePointer Uniform %60 + %62 = OpVariable %61 Uniform + %63 = OpTypePointer Uniform %19 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %48 = OpFunctionCall %7 %9 + %49 = OpCompositeExtract %6 %48 1 + %50 = OpAccessChain %21 %18 %20 %20 + %51 = OpLoad %6 %50 + %53 = OpFOrdEqual %52 %49 %51 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %77 + %54 = OpLabel + %64 = OpAccessChain %63 %62 %20 %20 + %65 = OpLoad %19 %64 + %66 = OpConvertSToF %6 %65 + %67 = OpAccessChain %63 %62 %20 %30 + %68 = OpLoad %19 %67 + %69 = OpConvertSToF %6 %68 + %70 = OpAccessChain %63 %62 %20 %30 + %71 = OpLoad %19 %70 + %72 = OpConvertSToF %6 %71 + %73 = OpAccessChain %63 %62 %20 %20 + %74 = OpLoad %19 %73 + %75 = OpConvertSToF %6 %74 + %76 = OpCompositeConstruct %56 %66 %69 %72 %75 + OpStore %58 %76 + OpBranch %55 + %77 = OpLabel + %78 = OpAccessChain %63 %62 %20 %30 + %79 = OpLoad %19 %78 + %80 = OpConvertSToF %6 %79 + %81 = OpCompositeConstruct %56 %80 %80 %80 %80 + OpStore %58 %81 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %12 = OpVariable %11 Function + %28 = OpVariable %27 Function + %43 = OpVariable %42 Function + %22 = OpAccessChain %21 %18 %20 %20 + %23 = OpLoad %6 %22 + %26 = OpAccessChain %25 %12 %24 + OpStore %26 %23 + OpStore %28 %29 + %31 = OpAccessChain %21 %18 %20 %30 + %32 = OpLoad %6 %31 + %33 = OpCompositeConstruct %7 %32 %32 + %34 = OpAccessChain %21 %18 %20 %30 + %35 = OpLoad %6 %34 + %36 = OpCompositeConstruct %7 %35 %35 + %37 = OpLoad %7 %12 + %40 = OpCompositeConstruct %39 %33 %36 %37 + %41 = OpLoad %19 %28 + OpStore %43 %40 + %44 = OpAccessChain %11 %43 %41 + %45 = OpLoad %7 %44 + OpReturnValue %45 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 5.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-sample-texture-hundred-iterations.amber b/vulkan/amber/graphicsfuzz/cov-sample-texture-hundred-iterations.amber new file mode 100644 index 0000000..d460991 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-sample-texture-hundred-iterations.amber @@ -0,0 +1,280 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_100 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_256_0 _GLF_uniform_float_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0, 256.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# // Contents of _GLF_uniform_int_values: [100, 0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 2) uniform sampler2D tex; +# +# void main() +# { +# vec4 texel = texture(tex, vec2(_float_0_0)); +# vec4 texelCopy = texel; +# +# // Sample from different location than texelCopy which should +# // result in different color value too. +# for(int i = _int_0; i < _int_100; i++) +# texel = texture(tex, vec2(_float_1_0 / _float_256_0)); +# +# // Always true. +# if(texelCopy != texel) +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# else +# _GLF_color = vec4(_int_0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 89 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %70 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "texel" + OpName %13 "tex" + OpName %18 "buf0" + OpMemberName %18 0 "_GLF_uniform_float_values" + OpName %20 "" + OpName %29 "texelCopy" + OpName %32 "i" + OpName %34 "buf1" + OpMemberName %34 0 "_GLF_uniform_int_values" + OpName %36 "" + OpName %70 "_GLF_color" + OpDecorate %13 RelaxedPrecision + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 2 + OpDecorate %14 RelaxedPrecision + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %33 ArrayStride 16 + OpMemberDecorate %34 0 Offset 0 + OpDecorate %34 Block + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 1 + OpDecorate %51 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + OpDecorate %59 RelaxedPrecision + OpDecorate %70 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeImage %6 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 + %12 = OpTypePointer UniformConstant %11 + %13 = OpVariable %12 UniformConstant + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 3 + %17 = OpTypeArray %6 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypeInt 32 1 + %22 = OpConstant %21 0 + %23 = OpTypePointer Uniform %6 + %26 = OpTypeVector %6 2 + %31 = OpTypePointer Function %21 + %33 = OpTypeArray %21 %16 + %34 = OpTypeStruct %33 + %35 = OpTypePointer Uniform %34 + %36 = OpVariable %35 Uniform + %37 = OpConstant %21 1 + %38 = OpTypePointer Uniform %21 + %49 = OpTypeBool + %54 = OpConstant %21 2 + %64 = OpTypeVector %49 4 + %69 = OpTypePointer Output %7 + %70 = OpVariable %69 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %29 = OpVariable %8 Function + %32 = OpVariable %31 Function + %14 = OpLoad %11 %13 + %24 = OpAccessChain %23 %20 %22 %22 + %25 = OpLoad %6 %24 + %27 = OpCompositeConstruct %26 %25 %25 + %28 = OpImageSampleImplicitLod %7 %14 %27 + OpStore %9 %28 + %30 = OpLoad %7 %9 + OpStore %29 %30 + %39 = OpAccessChain %38 %36 %22 %37 + %40 = OpLoad %21 %39 + OpStore %32 %40 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %21 %32 + %47 = OpAccessChain %38 %36 %22 %22 + %48 = OpLoad %21 %47 + %50 = OpSLessThan %49 %46 %48 + OpBranchConditional %50 %42 %43 + %42 = OpLabel + %51 = OpLoad %11 %13 + %52 = OpAccessChain %23 %20 %22 %37 + %53 = OpLoad %6 %52 + %55 = OpAccessChain %23 %20 %22 %54 + %56 = OpLoad %6 %55 + %57 = OpFDiv %6 %53 %56 + %58 = OpCompositeConstruct %26 %57 %57 + %59 = OpImageSampleImplicitLod %7 %51 %58 + OpStore %9 %59 + OpBranch %44 + %44 = OpLabel + %60 = OpLoad %21 %32 + %61 = OpIAdd %21 %60 %37 + OpStore %32 %61 + OpBranch %41 + %43 = OpLabel + %62 = OpLoad %7 %29 + %63 = OpLoad %7 %9 + %65 = OpFUnordNotEqual %64 %62 %63 + %66 = OpAny %49 %65 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %84 + %67 = OpLabel + %71 = OpAccessChain %38 %36 %22 %54 + %72 = OpLoad %21 %71 + %73 = OpConvertSToF %6 %72 + %74 = OpAccessChain %38 %36 %22 %37 + %75 = OpLoad %21 %74 + %76 = OpConvertSToF %6 %75 + %77 = OpAccessChain %38 %36 %22 %37 + %78 = OpLoad %21 %77 + %79 = OpConvertSToF %6 %78 + %80 = OpAccessChain %38 %36 %22 %54 + %81 = OpLoad %21 %80 + %82 = OpConvertSToF %6 %81 + %83 = OpCompositeConstruct %7 %73 %76 %79 %82 + OpStore %70 %83 + OpBranch %68 + %84 = OpLabel + %85 = OpAccessChain %38 %36 %22 %37 + %86 = OpLoad %21 %85 + %87 = OpConvertSToF %6 %86 + %88 = OpCompositeConstruct %7 %87 %87 %87 %87 + OpStore %70 %88 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# tex +SAMPLER variant_tex + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 100 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-sampler-as-function-argument.amber b/vulkan/amber/graphicsfuzz/cov-sampler-as-function-argument.amber new file mode 100644 index 0000000..6581ce6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-sampler-as-function-argument.amber @@ -0,0 +1,236 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific SPIR-V reader code paths + +# The test passes because the shader always writes red. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(set = 0, binding = 1) uniform sampler2D tex; +# layout(location = 0) out vec4 _GLF_color; +# +# vec4 func(sampler2D s) +# { +# return texture(s, vec2(_int_0)); +# } +# +# void main() +# { +# // Always true. +# if (func(tex) == vec4(_int_0, _int_0, _int_0, _int_1)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 78 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %59 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %13 "func(s21;" + OpName %12 "s" + OpName %20 "buf0" + OpMemberName %20 0 "_GLF_uniform_int_values" + OpName %22 "" + OpName %36 "tex" + OpName %59 "_GLF_color" + OpDecorate %12 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %19 ArrayStride 16 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpDecorate %27 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 1 + OpDecorate %59 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeImage %6 2D 0 0 0 1 Unknown + %8 = OpTypeSampledImage %7 + %9 = OpTypePointer UniformConstant %8 + %10 = OpTypeVector %6 4 + %11 = OpTypeFunction %10 %9 + %16 = OpTypeInt 32 1 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 2 + %19 = OpTypeArray %16 %18 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpConstant %16 0 + %24 = OpTypePointer Uniform %16 + %28 = OpTypeVector %6 2 + %31 = OpTypePointer Function %10 + %36 = OpVariable %9 UniformConstant + %47 = OpConstant %16 1 + %52 = OpTypeBool + %53 = OpTypeVector %52 4 + %58 = OpTypePointer Output %10 + %59 = OpVariable %58 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %37 = OpFunctionCall %10 %13 %36 + %38 = OpAccessChain %24 %22 %23 %23 + %39 = OpLoad %16 %38 + %40 = OpConvertSToF %6 %39 + %41 = OpAccessChain %24 %22 %23 %23 + %42 = OpLoad %16 %41 + %43 = OpConvertSToF %6 %42 + %44 = OpAccessChain %24 %22 %23 %23 + %45 = OpLoad %16 %44 + %46 = OpConvertSToF %6 %45 + %48 = OpAccessChain %24 %22 %23 %47 + %49 = OpLoad %16 %48 + %50 = OpConvertSToF %6 %49 + %51 = OpCompositeConstruct %10 %40 %43 %46 %50 + %54 = OpFOrdEqual %53 %37 %51 + %55 = OpAll %52 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %73 + %56 = OpLabel + %60 = OpAccessChain %24 %22 %23 %47 + %61 = OpLoad %16 %60 + %62 = OpConvertSToF %6 %61 + %63 = OpAccessChain %24 %22 %23 %23 + %64 = OpLoad %16 %63 + %65 = OpConvertSToF %6 %64 + %66 = OpAccessChain %24 %22 %23 %23 + %67 = OpLoad %16 %66 + %68 = OpConvertSToF %6 %67 + %69 = OpAccessChain %24 %22 %23 %47 + %70 = OpLoad %16 %69 + %71 = OpConvertSToF %6 %70 + %72 = OpCompositeConstruct %10 %62 %65 %68 %71 + OpStore %59 %72 + OpBranch %57 + %73 = OpLabel + %74 = OpAccessChain %24 %22 %23 %23 + %75 = OpLoad %16 %74 + %76 = OpConvertSToF %6 %75 + %77 = OpCompositeConstruct %10 %76 %76 %76 %76 + OpStore %59 %77 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd + %13 = OpFunction %10 None %11 + %12 = OpFunctionParameter %9 + %14 = OpLabel + %32 = OpVariable %31 Function + %15 = OpLoad %8 %12 + %25 = OpAccessChain %24 %22 %23 %23 + %26 = OpLoad %16 %25 + %27 = OpConvertSToF %6 %26 + %29 = OpCompositeConstruct %28 %27 %27 + %30 = OpImageSampleImplicitLod %10 %15 %29 + OpStore %32 %30 + %33 = OpLoad %10 %32 + OpReturnValue %33 + OpFunctionEnd +END + +# uniforms for variant + +# tex +SAMPLER variant_tex + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-scaled-number-nested-loops-array-access.amber b/vulkan/amber/graphicsfuzz/cov-scaled-number-nested-loops-array-access.amber new file mode 100644 index 0000000..d847094 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-scaled-number-nested-loops-array-access.amber @@ -0,0 +1,545 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific scaled number path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_12 _GLF_uniform_int_values[3] +# #define _int_4 _GLF_uniform_int_values[4] +# #define _int_8 _GLF_uniform_int_values[5] +# #define _int_3 _GLF_uniform_int_values[6] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_6912_0 _GLF_uniform_float_values[1] +# #define _float_1_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [2, 0, 1, 12, 4, 8, 3] +# layout(set = 0, binding = 0) uniform buf0 { +# int _GLF_uniform_int_values[7]; +# }; +# // Contents of _GLF_uniform_float_values: [0.0, 6912.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 { +# float _GLF_uniform_float_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float sums[2]; +# sums[_int_0] = _float_0_0; +# sums[_int_1] = _float_0_0; +# +# for(int a = _int_0; a < _int_2; a ++) +# for(int b = _int_8; b < _int_12; b ++) // Loops 4 times. +# for(int c = _int_3; c <= _int_4; c ++) // Loops 2 times. +# for(int d = _int_0; d < _int_3; d ++) // Loops 3 times. +# for(int e = _int_2; e <= _int_4; e ++) // Loops 3 times. +# for(int f = _int_0; f < _int_2; f ++) // Loops 2 times. +# for(int g = _int_0; g < _int_3; g ++) // Loops 3 times. +# for(int h = _int_0; h < _int_2; h ++) // Loops 2 times. +# for(int i = _int_0; i < _int_4; i ++) // Loops 4 times. +# for(int j = _int_2; j > _int_0; j --) // Loops 2 times. +# { +# sums[a] += _float_1_0; +# } +# +# if(sums[_int_0] == _float_6912_0 && sums[_int_1] == _float_6912_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 232 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %213 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "sums" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %25 "buf1" + OpMemberName %25 0 "_GLF_uniform_float_values" + OpName %27 "" + OpName %40 "a" + OpName %53 "b" + OpName %67 "c" + OpName %81 "d" + OpName %93 "e" + OpName %105 "f" + OpName %117 "g" + OpName %129 "h" + OpName %141 "i" + OpName %153 "j" + OpName %213 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 RelaxedPrecision + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %22 RelaxedPrecision + OpDecorate %24 ArrayStride 16 + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 1 + OpDecorate %35 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %62 RelaxedPrecision + OpDecorate %65 RelaxedPrecision + OpDecorate %67 RelaxedPrecision + OpDecorate %70 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %83 RelaxedPrecision + OpDecorate %89 RelaxedPrecision + OpDecorate %91 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %95 RelaxedPrecision + OpDecorate %101 RelaxedPrecision + OpDecorate %103 RelaxedPrecision + OpDecorate %105 RelaxedPrecision + OpDecorate %107 RelaxedPrecision + OpDecorate %113 RelaxedPrecision + OpDecorate %115 RelaxedPrecision + OpDecorate %117 RelaxedPrecision + OpDecorate %119 RelaxedPrecision + OpDecorate %125 RelaxedPrecision + OpDecorate %127 RelaxedPrecision + OpDecorate %129 RelaxedPrecision + OpDecorate %131 RelaxedPrecision + OpDecorate %137 RelaxedPrecision + OpDecorate %139 RelaxedPrecision + OpDecorate %141 RelaxedPrecision + OpDecorate %143 RelaxedPrecision + OpDecorate %149 RelaxedPrecision + OpDecorate %151 RelaxedPrecision + OpDecorate %153 RelaxedPrecision + OpDecorate %155 RelaxedPrecision + OpDecorate %161 RelaxedPrecision + OpDecorate %163 RelaxedPrecision + OpDecorate %165 RelaxedPrecision + OpDecorate %172 RelaxedPrecision + OpDecorate %173 RelaxedPrecision + OpDecorate %174 RelaxedPrecision + OpDecorate %175 RelaxedPrecision + OpDecorate %176 RelaxedPrecision + OpDecorate %177 RelaxedPrecision + OpDecorate %178 RelaxedPrecision + OpDecorate %179 RelaxedPrecision + OpDecorate %180 RelaxedPrecision + OpDecorate %181 RelaxedPrecision + OpDecorate %182 RelaxedPrecision + OpDecorate %183 RelaxedPrecision + OpDecorate %184 RelaxedPrecision + OpDecorate %185 RelaxedPrecision + OpDecorate %186 RelaxedPrecision + OpDecorate %187 RelaxedPrecision + OpDecorate %188 RelaxedPrecision + OpDecorate %189 RelaxedPrecision + OpDecorate %190 RelaxedPrecision + OpDecorate %191 RelaxedPrecision + OpDecorate %193 RelaxedPrecision + OpDecorate %202 RelaxedPrecision + OpDecorate %213 Location 0 + OpDecorate %215 RelaxedPrecision + OpDecorate %218 RelaxedPrecision + OpDecorate %221 RelaxedPrecision + OpDecorate %224 RelaxedPrecision + OpDecorate %229 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 2 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpTypeInt 32 1 + %13 = OpConstant %7 7 + %14 = OpTypeArray %12 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %12 0 + %19 = OpConstant %12 1 + %20 = OpTypePointer Uniform %12 + %23 = OpConstant %7 3 + %24 = OpTypeArray %6 %23 + %25 = OpTypeStruct %24 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypePointer Uniform %6 + %31 = OpTypePointer Function %6 + %33 = OpConstant %12 2 + %39 = OpTypePointer Function %12 + %51 = OpTypeBool + %54 = OpConstant %12 5 + %63 = OpConstant %12 3 + %68 = OpConstant %12 6 + %77 = OpConstant %12 4 + %211 = OpTypeVector %6 4 + %212 = OpTypePointer Output %211 + %213 = OpVariable %212 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %40 = OpVariable %39 Function + %53 = OpVariable %39 Function + %67 = OpVariable %39 Function + %81 = OpVariable %39 Function + %93 = OpVariable %39 Function + %105 = OpVariable %39 Function + %117 = OpVariable %39 Function + %129 = OpVariable %39 Function + %141 = OpVariable %39 Function + %153 = OpVariable %39 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %12 %21 + %29 = OpAccessChain %28 %27 %18 %18 + %30 = OpLoad %6 %29 + %32 = OpAccessChain %31 %11 %22 + OpStore %32 %30 + %34 = OpAccessChain %20 %17 %18 %33 + %35 = OpLoad %12 %34 + %36 = OpAccessChain %28 %27 %18 %18 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %31 %11 %35 + OpStore %38 %37 + %41 = OpAccessChain %20 %17 %18 %19 + %42 = OpLoad %12 %41 + OpStore %40 %42 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %12 %40 + %49 = OpAccessChain %20 %17 %18 %18 + %50 = OpLoad %12 %49 + %52 = OpSLessThan %51 %48 %50 + OpBranchConditional %52 %44 %45 + %44 = OpLabel + %55 = OpAccessChain %20 %17 %18 %54 + %56 = OpLoad %12 %55 + OpStore %53 %56 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %62 = OpLoad %12 %53 + %64 = OpAccessChain %20 %17 %18 %63 + %65 = OpLoad %12 %64 + %66 = OpSLessThan %51 %62 %65 + OpBranchConditional %66 %58 %59 + %58 = OpLabel + %69 = OpAccessChain %20 %17 %18 %68 + %70 = OpLoad %12 %69 + OpStore %67 %70 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %12 %67 + %78 = OpAccessChain %20 %17 %18 %77 + %79 = OpLoad %12 %78 + %80 = OpSLessThanEqual %51 %76 %79 + OpBranchConditional %80 %72 %73 + %72 = OpLabel + %82 = OpAccessChain %20 %17 %18 %19 + %83 = OpLoad %12 %82 + OpStore %81 %83 + OpBranch %84 + %84 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %89 = OpLoad %12 %81 + %90 = OpAccessChain %20 %17 %18 %68 + %91 = OpLoad %12 %90 + %92 = OpSLessThan %51 %89 %91 + OpBranchConditional %92 %85 %86 + %85 = OpLabel + %94 = OpAccessChain %20 %17 %18 %18 + %95 = OpLoad %12 %94 + OpStore %93 %95 + OpBranch %96 + %96 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %101 = OpLoad %12 %93 + %102 = OpAccessChain %20 %17 %18 %77 + %103 = OpLoad %12 %102 + %104 = OpSLessThanEqual %51 %101 %103 + OpBranchConditional %104 %97 %98 + %97 = OpLabel + %106 = OpAccessChain %20 %17 %18 %19 + %107 = OpLoad %12 %106 + OpStore %105 %107 + OpBranch %108 + %108 = OpLabel + OpLoopMerge %110 %111 None + OpBranch %112 + %112 = OpLabel + %113 = OpLoad %12 %105 + %114 = OpAccessChain %20 %17 %18 %18 + %115 = OpLoad %12 %114 + %116 = OpSLessThan %51 %113 %115 + OpBranchConditional %116 %109 %110 + %109 = OpLabel + %118 = OpAccessChain %20 %17 %18 %19 + %119 = OpLoad %12 %118 + OpStore %117 %119 + OpBranch %120 + %120 = OpLabel + OpLoopMerge %122 %123 None + OpBranch %124 + %124 = OpLabel + %125 = OpLoad %12 %117 + %126 = OpAccessChain %20 %17 %18 %68 + %127 = OpLoad %12 %126 + %128 = OpSLessThan %51 %125 %127 + OpBranchConditional %128 %121 %122 + %121 = OpLabel + %130 = OpAccessChain %20 %17 %18 %19 + %131 = OpLoad %12 %130 + OpStore %129 %131 + OpBranch %132 + %132 = OpLabel + OpLoopMerge %134 %135 None + OpBranch %136 + %136 = OpLabel + %137 = OpLoad %12 %129 + %138 = OpAccessChain %20 %17 %18 %18 + %139 = OpLoad %12 %138 + %140 = OpSLessThan %51 %137 %139 + OpBranchConditional %140 %133 %134 + %133 = OpLabel + %142 = OpAccessChain %20 %17 %18 %19 + %143 = OpLoad %12 %142 + OpStore %141 %143 + OpBranch %144 + %144 = OpLabel + OpLoopMerge %146 %147 None + OpBranch %148 + %148 = OpLabel + %149 = OpLoad %12 %141 + %150 = OpAccessChain %20 %17 %18 %77 + %151 = OpLoad %12 %150 + %152 = OpSLessThan %51 %149 %151 + OpBranchConditional %152 %145 %146 + %145 = OpLabel + %154 = OpAccessChain %20 %17 %18 %18 + %155 = OpLoad %12 %154 + OpStore %153 %155 + OpBranch %156 + %156 = OpLabel + OpLoopMerge %158 %159 None + OpBranch %160 + %160 = OpLabel + %161 = OpLoad %12 %153 + %162 = OpAccessChain %20 %17 %18 %19 + %163 = OpLoad %12 %162 + %164 = OpSGreaterThan %51 %161 %163 + OpBranchConditional %164 %157 %158 + %157 = OpLabel + %165 = OpLoad %12 %40 + %166 = OpAccessChain %28 %27 %18 %33 + %167 = OpLoad %6 %166 + %168 = OpAccessChain %31 %11 %165 + %169 = OpLoad %6 %168 + %170 = OpFAdd %6 %169 %167 + %171 = OpAccessChain %31 %11 %165 + OpStore %171 %170 + OpBranch %159 + %159 = OpLabel + %172 = OpLoad %12 %153 + %173 = OpISub %12 %172 %19 + OpStore %153 %173 + OpBranch %156 + %158 = OpLabel + OpBranch %147 + %147 = OpLabel + %174 = OpLoad %12 %141 + %175 = OpIAdd %12 %174 %19 + OpStore %141 %175 + OpBranch %144 + %146 = OpLabel + OpBranch %135 + %135 = OpLabel + %176 = OpLoad %12 %129 + %177 = OpIAdd %12 %176 %19 + OpStore %129 %177 + OpBranch %132 + %134 = OpLabel + OpBranch %123 + %123 = OpLabel + %178 = OpLoad %12 %117 + %179 = OpIAdd %12 %178 %19 + OpStore %117 %179 + OpBranch %120 + %122 = OpLabel + OpBranch %111 + %111 = OpLabel + %180 = OpLoad %12 %105 + %181 = OpIAdd %12 %180 %19 + OpStore %105 %181 + OpBranch %108 + %110 = OpLabel + OpBranch %99 + %99 = OpLabel + %182 = OpLoad %12 %93 + %183 = OpIAdd %12 %182 %19 + OpStore %93 %183 + OpBranch %96 + %98 = OpLabel + OpBranch %87 + %87 = OpLabel + %184 = OpLoad %12 %81 + %185 = OpIAdd %12 %184 %19 + OpStore %81 %185 + OpBranch %84 + %86 = OpLabel + OpBranch %74 + %74 = OpLabel + %186 = OpLoad %12 %67 + %187 = OpIAdd %12 %186 %19 + OpStore %67 %187 + OpBranch %71 + %73 = OpLabel + OpBranch %60 + %60 = OpLabel + %188 = OpLoad %12 %53 + %189 = OpIAdd %12 %188 %19 + OpStore %53 %189 + OpBranch %57 + %59 = OpLabel + OpBranch %46 + %46 = OpLabel + %190 = OpLoad %12 %40 + %191 = OpIAdd %12 %190 %19 + OpStore %40 %191 + OpBranch %43 + %45 = OpLabel + %192 = OpAccessChain %20 %17 %18 %19 + %193 = OpLoad %12 %192 + %194 = OpAccessChain %31 %11 %193 + %195 = OpLoad %6 %194 + %196 = OpAccessChain %28 %27 %18 %19 + %197 = OpLoad %6 %196 + %198 = OpFOrdEqual %51 %195 %197 + OpSelectionMerge %200 None + OpBranchConditional %198 %199 %200 + %199 = OpLabel + %201 = OpAccessChain %20 %17 %18 %33 + %202 = OpLoad %12 %201 + %203 = OpAccessChain %31 %11 %202 + %204 = OpLoad %6 %203 + %205 = OpAccessChain %28 %27 %18 %19 + %206 = OpLoad %6 %205 + %207 = OpFOrdEqual %51 %204 %206 + OpBranch %200 + %200 = OpLabel + %208 = OpPhi %51 %198 %45 %207 %199 + OpSelectionMerge %210 None + OpBranchConditional %208 %209 %227 + %209 = OpLabel + %214 = OpAccessChain %20 %17 %18 %33 + %215 = OpLoad %12 %214 + %216 = OpConvertSToF %6 %215 + %217 = OpAccessChain %20 %17 %18 %19 + %218 = OpLoad %12 %217 + %219 = OpConvertSToF %6 %218 + %220 = OpAccessChain %20 %17 %18 %19 + %221 = OpLoad %12 %220 + %222 = OpConvertSToF %6 %221 + %223 = OpAccessChain %20 %17 %18 %33 + %224 = OpLoad %12 %223 + %225 = OpConvertSToF %6 %224 + %226 = OpCompositeConstruct %211 %216 %219 %222 %225 + OpStore %213 %226 + OpBranch %210 + %227 = OpLabel + %228 = OpAccessChain %20 %17 %18 %19 + %229 = OpLoad %12 %228 + %230 = OpConvertSToF %6 %229 + %231 = OpCompositeConstruct %211 %230 %230 %230 %230 + OpStore %213 %231 + OpBranch %210 + %210 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 6912.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 0 1 12 4 8 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-scaled-number-nested-loops.amber b/vulkan/amber/graphicsfuzz/cov-scaled-number-nested-loops.amber new file mode 100644 index 0000000..265af79 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-scaled-number-nested-loops.amber @@ -0,0 +1,381 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific scaled number code path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# void main() +# { +# int a = 0; +# +# for(int i0 = 0; i0 < one; i0++) +# for( int i1 = 0; i1 < one; i1++) +# for(int i2 = 0; i2 < one; i2++) +# // While other loops iterate only once, this one +# // does three iterations. +# for(int i3 = 0; i3 < one + 2; i3++) +# for(int i4 = 0; i4 < one; i4++) +# for(int i5 = 0; i5 < one; i5++) +# { +# // Always true, but will break at the end of the loop. +# while(one > 0) +# { +# for( int i6 = 0; i6 < one; i6++) +# for( int i7 = 0; i7 < one; i7++) +# for( int i8 = 0; i8 < one; i8++) +# for( int i9 = 0; i9 < one; i9++) +# a++; +# +# break; +# } +# } +# +# if (a == 3) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 163 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %157 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %10 "i0" + OpName %17 "buf0" + OpMemberName %17 0 "one" + OpName %19 "" + OpName %25 "i1" + OpName %35 "i2" + OpName %45 "i3" + OpName %57 "i4" + OpName %67 "i5" + OpName %85 "i6" + OpName %95 "i7" + OpName %105 "i8" + OpName %115 "i9" + OpName %157 "_GLF_color" + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %157 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpTypeStruct %6 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypePointer Uniform %6 + %23 = OpTypeBool + %54 = OpConstant %6 2 + %126 = OpConstant %6 1 + %150 = OpConstant %6 3 + %154 = OpTypeFloat 32 + %155 = OpTypeVector %154 4 + %156 = OpTypePointer Output %155 + %157 = OpVariable %156 Output + %158 = OpConstant %154 1 + %159 = OpConstant %154 0 + %160 = OpConstantComposite %155 %158 %159 %159 %158 + %162 = OpConstantComposite %155 %159 %159 %159 %159 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %25 = OpVariable %7 Function + %35 = OpVariable %7 Function + %45 = OpVariable %7 Function + %57 = OpVariable %7 Function + %67 = OpVariable %7 Function + %85 = OpVariable %7 Function + %95 = OpVariable %7 Function + %105 = OpVariable %7 Function + %115 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %16 = OpLoad %6 %10 + %21 = OpAccessChain %20 %19 %9 + %22 = OpLoad %6 %21 + %24 = OpSLessThan %23 %16 %22 + OpBranchConditional %24 %12 %13 + %12 = OpLabel + OpStore %25 %9 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %6 %25 + %32 = OpAccessChain %20 %19 %9 + %33 = OpLoad %6 %32 + %34 = OpSLessThan %23 %31 %33 + OpBranchConditional %34 %27 %28 + %27 = OpLabel + OpStore %35 %9 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %6 %35 + %42 = OpAccessChain %20 %19 %9 + %43 = OpLoad %6 %42 + %44 = OpSLessThan %23 %41 %43 + OpBranchConditional %44 %37 %38 + %37 = OpLabel + OpStore %45 %9 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %6 %45 + %52 = OpAccessChain %20 %19 %9 + %53 = OpLoad %6 %52 + %55 = OpIAdd %6 %53 %54 + %56 = OpSLessThan %23 %51 %55 + OpBranchConditional %56 %47 %48 + %47 = OpLabel + OpStore %57 %9 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %6 %57 + %64 = OpAccessChain %20 %19 %9 + %65 = OpLoad %6 %64 + %66 = OpSLessThan %23 %63 %65 + OpBranchConditional %66 %59 %60 + %59 = OpLabel + OpStore %67 %9 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %67 + %74 = OpAccessChain %20 %19 %9 + %75 = OpLoad %6 %74 + %76 = OpSLessThan %23 %73 %75 + OpBranchConditional %76 %69 %70 + %69 = OpLabel + OpBranch %77 + %77 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpAccessChain %20 %19 %9 + %83 = OpLoad %6 %82 + %84 = OpSGreaterThan %23 %83 %9 + OpBranchConditional %84 %78 %79 + %78 = OpLabel + OpStore %85 %9 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %6 %85 + %92 = OpAccessChain %20 %19 %9 + %93 = OpLoad %6 %92 + %94 = OpSLessThan %23 %91 %93 + OpBranchConditional %94 %87 %88 + %87 = OpLabel + OpStore %95 %9 + OpBranch %96 + %96 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %101 = OpLoad %6 %95 + %102 = OpAccessChain %20 %19 %9 + %103 = OpLoad %6 %102 + %104 = OpSLessThan %23 %101 %103 + OpBranchConditional %104 %97 %98 + %97 = OpLabel + OpStore %105 %9 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %108 %109 None + OpBranch %110 + %110 = OpLabel + %111 = OpLoad %6 %105 + %112 = OpAccessChain %20 %19 %9 + %113 = OpLoad %6 %112 + %114 = OpSLessThan %23 %111 %113 + OpBranchConditional %114 %107 %108 + %107 = OpLabel + OpStore %115 %9 + OpBranch %116 + %116 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %121 = OpLoad %6 %115 + %122 = OpAccessChain %20 %19 %9 + %123 = OpLoad %6 %122 + %124 = OpSLessThan %23 %121 %123 + OpBranchConditional %124 %117 %118 + %117 = OpLabel + %125 = OpLoad %6 %8 + %127 = OpIAdd %6 %125 %126 + OpStore %8 %127 + OpBranch %119 + %119 = OpLabel + %128 = OpLoad %6 %115 + %129 = OpIAdd %6 %128 %126 + OpStore %115 %129 + OpBranch %116 + %118 = OpLabel + OpBranch %109 + %109 = OpLabel + %130 = OpLoad %6 %105 + %131 = OpIAdd %6 %130 %126 + OpStore %105 %131 + OpBranch %106 + %108 = OpLabel + OpBranch %99 + %99 = OpLabel + %132 = OpLoad %6 %95 + %133 = OpIAdd %6 %132 %126 + OpStore %95 %133 + OpBranch %96 + %98 = OpLabel + OpBranch %89 + %89 = OpLabel + %134 = OpLoad %6 %85 + %135 = OpIAdd %6 %134 %126 + OpStore %85 %135 + OpBranch %86 + %88 = OpLabel + OpBranch %79 + %80 = OpLabel + OpBranch %77 + %79 = OpLabel + OpBranch %71 + %71 = OpLabel + %137 = OpLoad %6 %67 + %138 = OpIAdd %6 %137 %126 + OpStore %67 %138 + OpBranch %68 + %70 = OpLabel + OpBranch %61 + %61 = OpLabel + %139 = OpLoad %6 %57 + %140 = OpIAdd %6 %139 %126 + OpStore %57 %140 + OpBranch %58 + %60 = OpLabel + OpBranch %49 + %49 = OpLabel + %141 = OpLoad %6 %45 + %142 = OpIAdd %6 %141 %126 + OpStore %45 %142 + OpBranch %46 + %48 = OpLabel + OpBranch %39 + %39 = OpLabel + %143 = OpLoad %6 %35 + %144 = OpIAdd %6 %143 %126 + OpStore %35 %144 + OpBranch %36 + %38 = OpLabel + OpBranch %29 + %29 = OpLabel + %145 = OpLoad %6 %25 + %146 = OpIAdd %6 %145 %126 + OpStore %25 %146 + OpBranch %26 + %28 = OpLabel + OpBranch %14 + %14 = OpLabel + %147 = OpLoad %6 %10 + %148 = OpIAdd %6 %147 %126 + OpStore %10 %148 + OpBranch %11 + %13 = OpLabel + %149 = OpLoad %6 %8 + %151 = OpIEqual %23 %149 %150 + OpSelectionMerge %153 None + OpBranchConditional %151 %152 %161 + %152 = OpLabel + OpStore %157 %160 + OpBranch %153 + %161 = OpLabel + OpStore %157 %162 + OpBranch %153 + %153 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos.amber b/vulkan/amber/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos.amber new file mode 100644 index 0000000..690abbc --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos.amber @@ -0,0 +1,180 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers a specific schedule dag register reduction list code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _float_0_0446 _GLF_uniform_float_values[0] +# #define _float_0_0448 _GLF_uniform_float_values[1] +# #define _float_4_6 _GLF_uniform_float_values[2] +# #define _float_1_0 _GLF_uniform_float_values[3] +# #define _float_0_0 _GLF_uniform_float_values[4] +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [0.0446, 0.0448, 4.6, 1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // a becomes 4.6. +# float a = mix(_float_4_6, _float_1_0, _float_1_0 > _float_4_6); +# +# float b = cos(log(a)); +# +# _GLF_color = vec4(b); +# +# if (b > _float_0_0446 && b < _float_0_0448) +# { +# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %37 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %31 "b" + OpName %37 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %37 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 5 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 2 + %18 = OpTypePointer Uniform %6 + %21 = OpConstant %15 3 + %28 = OpTypeBool + %35 = OpTypeVector %6 4 + %36 = OpTypePointer Output %35 + %37 = OpVariable %36 Output + %47 = OpConstant %15 1 + %56 = OpConstant %15 4 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %31 = OpVariable %7 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %6 %19 + %22 = OpAccessChain %18 %14 %16 %21 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %18 %14 %16 %21 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %18 %14 %16 %17 + %27 = OpLoad %6 %26 + %29 = OpFOrdGreaterThan %28 %25 %27 + %30 = OpSelect %6 %29 %23 %20 + OpStore %8 %30 + %32 = OpLoad %6 %8 + %33 = OpExtInst %6 %1 Log %32 + %34 = OpExtInst %6 %1 Cos %33 + OpStore %31 %34 + %38 = OpLoad %6 %31 + %39 = OpCompositeConstruct %35 %38 %38 %38 %38 + OpStore %37 %39 + %40 = OpLoad %6 %31 + %41 = OpAccessChain %18 %14 %16 %16 + %42 = OpLoad %6 %41 + %43 = OpFOrdGreaterThan %28 %40 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %45 + %44 = OpLabel + %46 = OpLoad %6 %31 + %48 = OpAccessChain %18 %14 %16 %47 + %49 = OpLoad %6 %48 + %50 = OpFOrdLessThan %28 %46 %49 + OpBranch %45 + %45 = OpLabel + %51 = OpPhi %28 %43 %5 %50 %44 + OpSelectionMerge %53 None + OpBranchConditional %51 %52 %53 + %52 = OpLabel + %54 = OpAccessChain %18 %14 %16 %21 + %55 = OpLoad %6 %54 + %57 = OpAccessChain %18 %14 %16 %56 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %18 %14 %16 %56 + %60 = OpLoad %6 %59 + %61 = OpAccessChain %18 %14 %16 %21 + %62 = OpLoad %6 %61 + %63 = OpCompositeConstruct %35 %55 %58 %60 %62 + OpStore %37 %63 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0446 0.0448 4.6 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-selection-dag-assign-back-and-forth.amber b/vulkan/amber/graphicsfuzz/cov-selection-dag-assign-back-and-forth.amber new file mode 100644 index 0000000..9b9b837 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-selection-dag-assign-back-and-forth.amber @@ -0,0 +1,139 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific selection DAG code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# vec4 v = _GLF_color; +# _GLF_color = vec4(0); +# _GLF_color = v; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %34 "v" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpConstant %10 1 + %33 = OpTypePointer Function %7 + %36 = OpConstant %6 0 + %37 = OpConstantComposite %7 %36 %36 %36 %36 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %34 = OpVariable %33 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %23 = OpAccessChain %18 %16 %17 %22 + %24 = OpLoad %10 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpAccessChain %18 %16 %17 %22 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %10 %29 + %31 = OpConvertSToF %6 %30 + %32 = OpCompositeConstruct %7 %21 %25 %28 %31 + OpStore %9 %32 + %35 = OpLoad %7 %9 + OpStore %34 %35 + OpStore %9 %37 + %38 = OpLoad %7 %34 + OpStore %9 %38 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-selection-dag-inverse-clamp.amber b/vulkan/amber/graphicsfuzz/cov-selection-dag-inverse-clamp.amber new file mode 100644 index 0000000..a832438 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-selection-dag-inverse-clamp.amber @@ -0,0 +1,194 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific selection DAG code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_10 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [10, 0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int c = _int_1; +# +# for (int i = _int_1; i < _int_10; i++) +# { +# c = ~i; +# +# c = clamp(c, 0, 3); +# } +# +# _GLF_color = vec4(_int_0); +# +# if (c == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %44 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "c" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %44 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %44 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %31 = OpTypeBool + %36 = OpConstant %6 3 + %39 = OpConstant %6 1 + %41 = OpTypeFloat 32 + %42 = OpTypeVector %41 4 + %43 = OpTypePointer Output %42 + %44 = OpVariable %43 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %21 = OpAccessChain %17 %14 %15 %16 + %22 = OpLoad %6 %21 + OpStore %20 %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %6 %20 + %29 = OpAccessChain %17 %14 %15 %15 + %30 = OpLoad %6 %29 + %32 = OpSLessThan %31 %28 %30 + OpBranchConditional %32 %24 %25 + %24 = OpLabel + %33 = OpLoad %6 %20 + %34 = OpNot %6 %33 + OpStore %8 %34 + %35 = OpLoad %6 %8 + %37 = OpExtInst %6 %1 SClamp %35 %15 %36 + OpStore %8 %37 + OpBranch %26 + %26 = OpLabel + %38 = OpLoad %6 %20 + %40 = OpIAdd %6 %38 %39 + OpStore %20 %40 + OpBranch %23 + %25 = OpLabel + %45 = OpAccessChain %17 %14 %15 %39 + %46 = OpLoad %6 %45 + %47 = OpConvertSToF %41 %46 + %48 = OpCompositeConstruct %42 %47 %47 %47 %47 + OpStore %44 %48 + %49 = OpLoad %6 %8 + %50 = OpAccessChain %17 %14 %15 %39 + %51 = OpLoad %6 %50 + %52 = OpIEqual %31 %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + %55 = OpAccessChain %17 %14 %15 %16 + %56 = OpLoad %6 %55 + %57 = OpConvertSToF %41 %56 + %58 = OpAccessChain %17 %14 %15 %39 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %41 %59 + %61 = OpAccessChain %17 %14 %15 %39 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %41 %62 + %64 = OpAccessChain %17 %14 %15 %16 + %65 = OpLoad %6 %64 + %66 = OpConvertSToF %41 %65 + %67 = OpCompositeConstruct %42 %57 %60 %63 %66 + OpStore %44 %67 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 10 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-selection-dag-lt-gt.amber b/vulkan/amber/graphicsfuzz/cov-selection-dag-lt-gt.amber new file mode 100644 index 0000000..e26ab99 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-selection-dag-lt-gt.amber @@ -0,0 +1,198 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific selection DAG code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# // Contents of v1: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 v1; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Always true. +# if (v1.x < v1.y) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Always false. +# if (v1.x > v1.y) +# { +# _GLF_color = vec4(_int_1); +# } +# return; +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 65 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %27 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "buf1" + OpMemberName %8 0 "v1" + OpName %10 "" + OpName %27 "_GLF_color" + OpName %30 "buf0" + OpMemberName %30 0 "_GLF_uniform_int_values" + OpName %32 "" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 1 + OpDecorate %27 Location 0 + OpDecorate %29 ArrayStride 16 + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeStruct %7 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %6 + %18 = OpConstant %13 1 + %21 = OpTypeBool + %25 = OpTypeVector %6 4 + %26 = OpTypePointer Output %25 + %27 = OpVariable %26 Output + %28 = OpConstant %13 2 + %29 = OpTypeArray %11 %28 + %30 = OpTypeStruct %29 + %31 = OpTypePointer Uniform %30 + %32 = OpVariable %31 Uniform + %33 = OpTypePointer Uniform %11 + %37 = OpConstant %11 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %16 = OpAccessChain %15 %10 %12 %14 + %17 = OpLoad %6 %16 + %19 = OpAccessChain %15 %10 %12 %18 + %20 = OpLoad %6 %19 + %22 = OpFOrdLessThan %21 %17 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %60 + %23 = OpLabel + %34 = OpAccessChain %33 %32 %12 %12 + %35 = OpLoad %11 %34 + %36 = OpConvertSToF %6 %35 + %38 = OpAccessChain %33 %32 %12 %37 + %39 = OpLoad %11 %38 + %40 = OpConvertSToF %6 %39 + %41 = OpAccessChain %33 %32 %12 %37 + %42 = OpLoad %11 %41 + %43 = OpConvertSToF %6 %42 + %44 = OpAccessChain %33 %32 %12 %12 + %45 = OpLoad %11 %44 + %46 = OpConvertSToF %6 %45 + %47 = OpCompositeConstruct %25 %36 %40 %43 %46 + OpStore %27 %47 + %48 = OpAccessChain %15 %10 %12 %14 + %49 = OpLoad %6 %48 + %50 = OpAccessChain %15 %10 %12 %18 + %51 = OpLoad %6 %50 + %52 = OpFOrdGreaterThan %21 %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + %55 = OpAccessChain %33 %32 %12 %12 + %56 = OpLoad %11 %55 + %57 = OpConvertSToF %6 %56 + %58 = OpCompositeConstruct %25 %57 %57 %57 %57 + OpStore %27 %58 + OpBranch %54 + %54 = OpLabel + OpReturn + %60 = OpLabel + %61 = OpAccessChain %33 %32 %12 %37 + %62 = OpLoad %11 %61 + %63 = OpConvertSToF %6 %62 + %64 = OpCompositeConstruct %25 %63 %63 %63 %63 + OpStore %27 %64 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# v1 +BUFFER variant_v1 DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_v1 AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-selection-dag-same-cond-twice.amber b/vulkan/amber/graphicsfuzz/cov-selection-dag-same-cond-twice.amber new file mode 100644 index 0000000..bb99b20 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-selection-dag-same-cond-twice.amber @@ -0,0 +1,140 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific selection DAG code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void main() +# { +# _GLF_color = vec4(0); +# +# // Always false. +# if(one < 0.0 && one < 0.0) +# { +# _GLF_color = vec4(1); +# } +# else +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %13 "buf0" + OpMemberName %13 0 "one" + OpName %15 "" + OpDecorate %9 Location 0 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypeBool + %13 = OpTypeStruct %6 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %6 + %30 = OpConstant %6 1 + %31 = OpConstantComposite %7 %30 %30 %30 %30 + %33 = OpConstantComposite %7 %30 %10 %10 %30 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %9 %11 + %19 = OpAccessChain %18 %15 %17 + %20 = OpLoad %6 %19 + %21 = OpFOrdLessThan %12 %20 %10 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %23 + %22 = OpLabel + %24 = OpAccessChain %18 %15 %17 + %25 = OpLoad %6 %24 + %26 = OpFOrdLessThan %12 %25 %10 + OpBranch %23 + %23 = OpLabel + %27 = OpPhi %12 %21 %5 %26 %22 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %32 + %28 = OpLabel + OpStore %9 %31 + OpBranch %29 + %32 = OpLabel + OpStore %9 %33 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-set-array-elements-to-uniform-check-value-break.amber b/vulkan/amber/graphicsfuzz/cov-set-array-elements-to-uniform-check-value-break.amber new file mode 100644 index 0000000..c3bd757 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-set-array-elements-to-uniform-check-value-break.amber @@ -0,0 +1,345 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_10 _GLF_uniform_int_values[3] +# #define _float_2_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_0_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [2, 1, 0, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of _GLF_uniform_float_values: [2.0, 1.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# // Contents of zero: 0.0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# float zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float data[10] = float[10](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0); +# +# // Set elements 1..9 to zero. +# for(int i = _int_1; i < _int_10; i ++) +# { +# data[i] = zero; +# } +# +# for(int i = 0; i < 9; i ++) +# { +# // True for i = 1. +# if(data[i] < _float_1_0) +# { +# data[i] = _float_2_0; +# break; +# } +# } +# +# // Always true. +# if(data[_int_0] == _float_1_0 && data[_int_1] == _float_2_0 && data[_int_2] == _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 148 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %129 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "data" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %43 "i" + OpName %46 "buf0" + OpMemberName %46 0 "_GLF_uniform_int_values" + OpName %48 "" + OpName %64 "buf2" + OpMemberName %64 0 "zero" + OpName %66 "" + OpName %73 "i" + OpName %129 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %45 ArrayStride 16 + OpMemberDecorate %46 0 Offset 0 + OpDecorate %46 Block + OpDecorate %48 DescriptorSet 0 + OpDecorate %48 Binding 0 + OpMemberDecorate %64 0 Offset 0 + OpDecorate %64 Block + OpDecorate %66 DescriptorSet 0 + OpDecorate %66 Binding 2 + OpDecorate %129 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 3 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpConstant %17 1 + %20 = OpTypePointer Uniform %6 + %42 = OpTypePointer Function %17 + %44 = OpConstant %7 4 + %45 = OpTypeArray %17 %44 + %46 = OpTypeStruct %45 + %47 = OpTypePointer Uniform %46 + %48 = OpVariable %47 Uniform + %49 = OpTypePointer Uniform %17 + %58 = OpConstant %17 3 + %61 = OpTypeBool + %64 = OpTypeStruct %6 + %65 = OpTypePointer Uniform %64 + %66 = OpVariable %65 Uniform + %69 = OpTypePointer Function %6 + %80 = OpConstant %17 9 + %97 = OpConstant %17 2 + %127 = OpTypeVector %6 4 + %128 = OpTypePointer Output %127 + %129 = OpVariable %128 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %43 = OpVariable %42 Function + %73 = OpVariable %42 Function + %21 = OpAccessChain %20 %16 %18 %19 + %22 = OpLoad %6 %21 + %23 = OpAccessChain %20 %16 %18 %19 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %20 %16 %18 %19 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %20 %16 %18 %19 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %20 %16 %18 %19 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %20 %16 %18 %19 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %20 %16 %18 %19 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %20 %16 %18 %19 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %20 %16 %18 %19 + %38 = OpLoad %6 %37 + %39 = OpAccessChain %20 %16 %18 %19 + %40 = OpLoad %6 %39 + %41 = OpCompositeConstruct %9 %22 %24 %26 %28 %30 %32 %34 %36 %38 %40 + OpStore %11 %41 + %50 = OpAccessChain %49 %48 %18 %19 + %51 = OpLoad %17 %50 + OpStore %43 %51 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %17 %43 + %59 = OpAccessChain %49 %48 %18 %58 + %60 = OpLoad %17 %59 + %62 = OpSLessThan %61 %57 %60 + OpBranchConditional %62 %53 %54 + %53 = OpLabel + %63 = OpLoad %17 %43 + %67 = OpAccessChain %20 %66 %18 + %68 = OpLoad %6 %67 + %70 = OpAccessChain %69 %11 %63 + OpStore %70 %68 + OpBranch %55 + %55 = OpLabel + %71 = OpLoad %17 %43 + %72 = OpIAdd %17 %71 %19 + OpStore %43 %72 + OpBranch %52 + %54 = OpLabel + OpStore %73 %18 + OpBranch %74 + %74 = OpLabel + OpLoopMerge %76 %77 None + OpBranch %78 + %78 = OpLabel + %79 = OpLoad %17 %73 + %81 = OpSLessThan %61 %79 %80 + OpBranchConditional %81 %75 %76 + %75 = OpLabel + %82 = OpLoad %17 %73 + %83 = OpAccessChain %69 %11 %82 + %84 = OpLoad %6 %83 + %85 = OpAccessChain %20 %16 %18 %19 + %86 = OpLoad %6 %85 + %87 = OpFOrdLessThan %61 %84 %86 + OpSelectionMerge %89 None + OpBranchConditional %87 %88 %89 + %88 = OpLabel + %90 = OpLoad %17 %73 + %91 = OpAccessChain %20 %16 %18 %18 + %92 = OpLoad %6 %91 + %93 = OpAccessChain %69 %11 %90 + OpStore %93 %92 + OpBranch %76 + %89 = OpLabel + OpBranch %77 + %77 = OpLabel + %95 = OpLoad %17 %73 + %96 = OpIAdd %17 %95 %19 + OpStore %73 %96 + OpBranch %74 + %76 = OpLabel + %98 = OpAccessChain %49 %48 %18 %97 + %99 = OpLoad %17 %98 + %100 = OpAccessChain %69 %11 %99 + %101 = OpLoad %6 %100 + %102 = OpAccessChain %20 %16 %18 %19 + %103 = OpLoad %6 %102 + %104 = OpFOrdEqual %61 %101 %103 + OpSelectionMerge %106 None + OpBranchConditional %104 %105 %106 + %105 = OpLabel + %107 = OpAccessChain %49 %48 %18 %19 + %108 = OpLoad %17 %107 + %109 = OpAccessChain %69 %11 %108 + %110 = OpLoad %6 %109 + %111 = OpAccessChain %20 %16 %18 %18 + %112 = OpLoad %6 %111 + %113 = OpFOrdEqual %61 %110 %112 + OpBranch %106 + %106 = OpLabel + %114 = OpPhi %61 %104 %76 %113 %105 + OpSelectionMerge %116 None + OpBranchConditional %114 %115 %116 + %115 = OpLabel + %117 = OpAccessChain %49 %48 %18 %18 + %118 = OpLoad %17 %117 + %119 = OpAccessChain %69 %11 %118 + %120 = OpLoad %6 %119 + %121 = OpAccessChain %20 %16 %18 %97 + %122 = OpLoad %6 %121 + %123 = OpFOrdEqual %61 %120 %122 + OpBranch %116 + %116 = OpLabel + %124 = OpPhi %61 %114 %106 %123 %115 + OpSelectionMerge %126 None + OpBranchConditional %124 %125 %143 + %125 = OpLabel + %130 = OpAccessChain %49 %48 %18 %19 + %131 = OpLoad %17 %130 + %132 = OpConvertSToF %6 %131 + %133 = OpAccessChain %49 %48 %18 %97 + %134 = OpLoad %17 %133 + %135 = OpConvertSToF %6 %134 + %136 = OpAccessChain %49 %48 %18 %97 + %137 = OpLoad %17 %136 + %138 = OpConvertSToF %6 %137 + %139 = OpAccessChain %49 %48 %18 %19 + %140 = OpLoad %17 %139 + %141 = OpConvertSToF %6 %140 + %142 = OpCompositeConstruct %127 %132 %135 %138 %141 + OpStore %129 %142 + OpBranch %126 + %143 = OpLabel + %144 = OpAccessChain %49 %48 %18 %97 + %145 = OpLoad %17 %144 + %146 = OpConvertSToF %6 %145 + %147 = OpCompositeConstruct %127 %146 %146 %146 %146 + OpStore %129 %147 + OpBranch %126 + %126 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float STD140 DATA + 0.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 1.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 1 0 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-set-output-color-function-call-nested-loop.amber b/vulkan/amber/graphicsfuzz/cov-set-output-color-function-call-nested-loop.amber new file mode 100644 index 0000000..db3de79 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-set-output-color-function-call-nested-loop.amber @@ -0,0 +1,248 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific BRW code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_14 _GLF_uniform_int_values[2] +# #define _int_5 _GLF_uniform_int_values[3] +# #define _int_10 _GLF_uniform_int_values[4] +# #define _int_13 _GLF_uniform_int_values[5] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 14, 5, 10, 13] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[6]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# // When x > 5 the function returns 2 and doesn't touch _GLF_color. +# // Otherwise returns 1 and sets _GLF_color to vec4(x + 9). +# int func (int x) +# { +# if (x > _int_5) +# { +# return 2; +# } +# +# vec4 v; +# +# for (int i = _int_0; i < _int_10; i++) +# { +# v = vec4(float(x + i)); +# } +# +# _GLF_color = v; +# +# return _int_1; +# } +# +# void main() +# { +# int a = _int_0; +# +# // a gets the value 13 because func returns 1 five times and 2 four times, +# // and _GLF_color gets the value 14 due to func is called with i == 5. +# for (int i = _int_1; i < _int_10; i++) +# { +# a += func(i); +# } +# +# // Write red in case we have expected values. +# if(_GLF_color == vec4(_int_14) && a == _int_13) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 177 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %56 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %16 "buf0" + OpMemberName %16 0 "_GLF_uniform_int_values" + OpName %18 "" + OpName %56 "_GLF_color" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %56 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 6 + %15 = OpTypeArray %6 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpConstant %6 0 + %20 = OpConstant %6 3 + %21 = OpTypePointer Uniform %6 + %24 = OpTypeBool + %28 = OpConstant %6 2 + %39 = OpConstant %6 4 + %43 = OpTypeFloat 32 + %44 = OpTypeVector %43 4 + %53 = OpConstant %6 1 + %55 = OpTypePointer Output %44 + %56 = OpVariable %55 Output + %89 = OpTypeVector %24 4 + %95 = OpConstant %6 5 + %124 = OpConstant %13 0 + %170 = OpUndef %44 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %63 = OpAccessChain %21 %18 %19 %19 + %64 = OpLoad %6 %63 + %66 = OpAccessChain %21 %18 %19 %53 + %67 = OpLoad %6 %66 + OpBranch %68 + %68 = OpLabel + %169 = OpPhi %44 %170 %5 %176 %71 + %166 = OpPhi %6 %64 %5 %81 %71 + %165 = OpPhi %6 %67 %5 %83 %71 + %74 = OpAccessChain %21 %18 %19 %39 + %75 = OpLoad %6 %74 + %76 = OpSLessThan %24 %165 %75 + OpLoopMerge %70 %71 None + OpBranchConditional %76 %69 %70 + %69 = OpLabel + OpSelectionMerge %163 None + OpSwitch %124 %135 + %135 = OpLabel + %137 = OpAccessChain %21 %18 %19 %20 + %138 = OpLoad %6 %137 + %139 = OpSGreaterThan %24 %165 %138 + OpSelectionMerge %141 None + OpBranchConditional %139 %140 %141 + %140 = OpLabel + OpBranch %163 + %141 = OpLabel + OpBranch %144 + %144 = OpLabel + %168 = OpPhi %44 %169 %141 %155 %150 + %167 = OpPhi %6 %64 %141 %158 %150 + %149 = OpSLessThan %24 %167 %75 + OpLoopMerge %159 %150 None + OpBranchConditional %149 %150 %159 + %150 = OpLabel + %153 = OpIAdd %6 %165 %167 + %154 = OpConvertSToF %43 %153 + %155 = OpCompositeConstruct %44 %154 %154 %154 %154 + %158 = OpIAdd %6 %167 %53 + OpBranch %144 + %159 = OpLabel + OpStore %56 %168 + OpBranch %163 + %163 = OpLabel + %176 = OpPhi %44 %169 %140 %168 %159 + %171 = OpPhi %6 %28 %140 %67 %159 + %81 = OpIAdd %6 %166 %171 + OpBranch %71 + %71 = OpLabel + %83 = OpIAdd %6 %165 %53 + OpBranch %68 + %70 = OpLabel + %84 = OpLoad %44 %56 + %85 = OpAccessChain %21 %18 %19 %28 + %86 = OpLoad %6 %85 + %87 = OpConvertSToF %43 %86 + %88 = OpCompositeConstruct %44 %87 %87 %87 %87 + %90 = OpFOrdEqual %89 %84 %88 + %91 = OpAll %24 %90 + OpSelectionMerge %93 None + OpBranchConditional %91 %92 %93 + %92 = OpLabel + %96 = OpAccessChain %21 %18 %19 %95 + %97 = OpLoad %6 %96 + %98 = OpIEqual %24 %166 %97 + OpBranch %93 + %93 = OpLabel + %99 = OpPhi %24 %91 %70 %98 %92 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %115 + %100 = OpLabel + %104 = OpConvertSToF %43 %67 + %107 = OpConvertSToF %43 %64 + %114 = OpCompositeConstruct %44 %104 %107 %107 %104 + OpStore %56 %114 + OpBranch %101 + %115 = OpLabel + %118 = OpConvertSToF %43 %64 + %119 = OpCompositeConstruct %44 %118 %118 %118 %118 + OpStore %56 %119 + OpBranch %101 + %101 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 14 5 10 13 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-set-vector-cos-fragcoord.amber b/vulkan/amber/graphicsfuzz/cov-set-vector-cos-fragcoord.amber new file mode 100644 index 0000000..2614212 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-set-vector-cos-fragcoord.amber @@ -0,0 +1,273 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific set vector code path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void main() +# { +# vec2 a = vec2(1); +# vec3 b = vec3(0); +# +# if(int(gl_FragCoord.y) < 40) +# { +# b = vec3(0.1); +# } +# else if(int(gl_FragCoord.y) < 60) +# { +# b = vec3(0.2); +# } +# else if(gl_FragCoord.y < 80.0) +# { +# b = cos(a.x + vec3(one)) + 0.01; +# } +# else if(int(gl_FragCoord.y) < 100) +# { +# b = cos(vec3(one)); +# } +# else if(int(gl_FragCoord.y) < 500) +# { +# b = cos(vec3(1.0, 1.0, 22.0)); +# } +# +# // Always true. +# if (b.x < 1.02 && b.y < 1.02 && b.z < 1.02) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 116 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %19 %112 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "a" + OpName %14 "b" + OpName %19 "gl_FragCoord" + OpName %55 "buf0" + OpMemberName %55 0 "one" + OpName %57 "" + OpName %112 "_GLF_color" + OpDecorate %19 BuiltIn FragCoord + OpMemberDecorate %55 0 Offset 0 + OpDecorate %55 Block + OpDecorate %57 DescriptorSet 0 + OpDecorate %57 Binding 0 + OpDecorate %112 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstantComposite %7 %10 %10 + %12 = OpTypeVector %6 3 + %13 = OpTypePointer Function %12 + %15 = OpConstant %6 0 + %16 = OpConstantComposite %12 %15 %15 %15 + %17 = OpTypeVector %6 4 + %18 = OpTypePointer Input %17 + %19 = OpVariable %18 Input + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 1 + %22 = OpTypePointer Input %6 + %25 = OpTypeInt 32 1 + %27 = OpConstant %25 40 + %28 = OpTypeBool + %32 = OpConstant %6 0.100000001 + %33 = OpConstantComposite %12 %32 %32 %32 + %38 = OpConstant %25 60 + %42 = OpConstant %6 0.200000003 + %43 = OpConstantComposite %12 %42 %42 %42 + %47 = OpConstant %6 80 + %51 = OpConstant %20 0 + %52 = OpTypePointer Function %6 + %55 = OpTypeStruct %6 + %56 = OpTypePointer Uniform %55 + %57 = OpVariable %56 Uniform + %58 = OpConstant %25 0 + %59 = OpTypePointer Uniform %6 + %66 = OpConstant %6 0.00999999978 + %73 = OpConstant %25 100 + %85 = OpConstant %25 500 + %89 = OpConstant %6 0.540302277 + %90 = OpConstant %6 -0.99996084 + %91 = OpConstantComposite %12 %89 %89 %90 + %94 = OpConstant %6 1.01999998 + %104 = OpConstant %20 2 + %111 = OpTypePointer Output %17 + %112 = OpVariable %111 Output + %113 = OpConstantComposite %17 %10 %15 %15 %10 + %115 = OpConstantComposite %17 %15 %15 %15 %15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %14 = OpVariable %13 Function + OpStore %9 %11 + OpStore %14 %16 + %23 = OpAccessChain %22 %19 %21 + %24 = OpLoad %6 %23 + %26 = OpConvertFToS %25 %24 + %29 = OpSLessThan %28 %26 %27 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %34 + %30 = OpLabel + OpStore %14 %33 + OpBranch %31 + %34 = OpLabel + %35 = OpAccessChain %22 %19 %21 + %36 = OpLoad %6 %35 + %37 = OpConvertFToS %25 %36 + %39 = OpSLessThan %28 %37 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %44 + %40 = OpLabel + OpStore %14 %43 + OpBranch %41 + %44 = OpLabel + %45 = OpAccessChain %22 %19 %21 + %46 = OpLoad %6 %45 + %48 = OpFOrdLessThan %28 %46 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %69 + %49 = OpLabel + %53 = OpAccessChain %52 %9 %51 + %54 = OpLoad %6 %53 + %60 = OpAccessChain %59 %57 %58 + %61 = OpLoad %6 %60 + %62 = OpCompositeConstruct %12 %61 %61 %61 + %63 = OpCompositeConstruct %12 %54 %54 %54 + %64 = OpFAdd %12 %63 %62 + %65 = OpExtInst %12 %1 Cos %64 + %67 = OpCompositeConstruct %12 %66 %66 %66 + %68 = OpFAdd %12 %65 %67 + OpStore %14 %68 + OpBranch %50 + %69 = OpLabel + %70 = OpAccessChain %22 %19 %21 + %71 = OpLoad %6 %70 + %72 = OpConvertFToS %25 %71 + %74 = OpSLessThan %28 %72 %73 + OpSelectionMerge %76 None + OpBranchConditional %74 %75 %81 + %75 = OpLabel + %77 = OpAccessChain %59 %57 %58 + %78 = OpLoad %6 %77 + %79 = OpCompositeConstruct %12 %78 %78 %78 + %80 = OpExtInst %12 %1 Cos %79 + OpStore %14 %80 + OpBranch %76 + %81 = OpLabel + %82 = OpAccessChain %22 %19 %21 + %83 = OpLoad %6 %82 + %84 = OpConvertFToS %25 %83 + %86 = OpSLessThan %28 %84 %85 + OpSelectionMerge %88 None + OpBranchConditional %86 %87 %88 + %87 = OpLabel + OpStore %14 %91 + OpBranch %88 + %88 = OpLabel + OpBranch %76 + %76 = OpLabel + OpBranch %50 + %50 = OpLabel + OpBranch %41 + %41 = OpLabel + OpBranch %31 + %31 = OpLabel + %92 = OpAccessChain %52 %14 %51 + %93 = OpLoad %6 %92 + %95 = OpFOrdLessThan %28 %93 %94 + OpSelectionMerge %97 None + OpBranchConditional %95 %96 %97 + %96 = OpLabel + %98 = OpAccessChain %52 %14 %21 + %99 = OpLoad %6 %98 + %100 = OpFOrdLessThan %28 %99 %94 + OpBranch %97 + %97 = OpLabel + %101 = OpPhi %28 %95 %31 %100 %96 + OpSelectionMerge %103 None + OpBranchConditional %101 %102 %103 + %102 = OpLabel + %105 = OpAccessChain %52 %14 %104 + %106 = OpLoad %6 %105 + %107 = OpFOrdLessThan %28 %106 %94 + OpBranch %103 + %103 = OpLabel + %108 = OpPhi %28 %101 %97 %107 %102 + OpSelectionMerge %110 None + OpBranchConditional %108 %109 %114 + %109 = OpLabel + OpStore %112 %113 + OpBranch %110 + %114 = OpLabel + OpStore %112 %115 + OpBranch %110 + %110 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-sign-array-access-uaddcarry.amber b/vulkan/amber/graphicsfuzz/cov-sign-array-access-uaddcarry.amber new file mode 100644 index 0000000..af6b8a4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-sign-array-access-uaddcarry.amber @@ -0,0 +1,233 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine compares code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _uint_2 _GLF_uniform_uint_values[0] +# #define _uint_1 _GLF_uniform_uint_values[1] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_uint_values: [2, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# uint _GLF_uniform_uint_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // b becomes [0, 1]. +# int b[2] = int[2](sign(_int_0 * 6), _int_1); +# +# // i becomes 1. +# int i = b[clamp(_int_0, _int_1, _int_2)]; +# +# uint a = _uint_1; +# +# // a becomes 0. +# // c becomes 2. +# uint c = uaddCarry(_uint_1, uint(i), a); +# +# if (c == _uint_2) +# { +# _GLF_color = vec4(i, a, a, i); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 83 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %68 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "b" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %29 "i" + OpName %41 "a" + OpName %43 "buf1" + OpMemberName %43 0 "_GLF_uniform_uint_values" + OpName %45 "" + OpName %49 "c" + OpName %54 "ResType" + OpName %68 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %42 ArrayStride 16 + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 1 + OpDecorate %68 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 2 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 3 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 1 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 6 + %28 = OpTypePointer Function %6 + %34 = OpConstant %6 2 + %40 = OpTypePointer Function %7 + %42 = OpTypeArray %7 %8 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %46 = OpTypePointer Uniform %7 + %54 = OpTypeStruct %7 %7 + %61 = OpTypeBool + %65 = OpTypeFloat 32 + %66 = OpTypeVector %65 4 + %67 = OpTypePointer Output %66 + %68 = OpVariable %67 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %29 = OpVariable %28 Function + %41 = OpVariable %40 Function + %49 = OpVariable %40 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %23 = OpIMul %6 %21 %22 + %24 = OpExtInst %6 %1 SSign %23 + %25 = OpAccessChain %19 %16 %17 %17 + %26 = OpLoad %6 %25 + %27 = OpCompositeConstruct %9 %24 %26 + OpStore %11 %27 + %30 = OpAccessChain %19 %16 %17 %18 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %19 %16 %17 %17 + %33 = OpLoad %6 %32 + %35 = OpAccessChain %19 %16 %17 %34 + %36 = OpLoad %6 %35 + %37 = OpExtInst %6 %1 SClamp %31 %33 %36 + %38 = OpAccessChain %28 %11 %37 + %39 = OpLoad %6 %38 + OpStore %29 %39 + %47 = OpAccessChain %46 %45 %17 %18 + %48 = OpLoad %7 %47 + OpStore %41 %48 + %50 = OpAccessChain %46 %45 %17 %18 + %51 = OpLoad %7 %50 + %52 = OpLoad %6 %29 + %53 = OpBitcast %7 %52 + %55 = OpIAddCarry %54 %51 %53 + %56 = OpCompositeExtract %7 %55 1 + OpStore %41 %56 + %57 = OpCompositeExtract %7 %55 0 + OpStore %49 %57 + %58 = OpLoad %7 %49 + %59 = OpAccessChain %46 %45 %17 %17 + %60 = OpLoad %7 %59 + %62 = OpIEqual %61 %58 %60 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %78 + %63 = OpLabel + %69 = OpLoad %6 %29 + %70 = OpConvertSToF %65 %69 + %71 = OpLoad %7 %41 + %72 = OpConvertUToF %65 %71 + %73 = OpLoad %7 %41 + %74 = OpConvertUToF %65 %73 + %75 = OpLoad %6 %29 + %76 = OpConvertSToF %65 %75 + %77 = OpCompositeConstruct %66 %70 %72 %74 %76 + OpStore %68 %77 + OpBranch %64 + %78 = OpLabel + %79 = OpAccessChain %19 %16 %17 %18 + %80 = OpLoad %6 %79 + %81 = OpConvertSToF %65 %80 + %82 = OpCompositeConstruct %66 %81 %81 %81 %81 + OpStore %68 %82 + OpBranch %64 + %64 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_uint_values +BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA + 2 1 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplification-unused-struct.amber b/vulkan/amber/graphicsfuzz/cov-simplification-unused-struct.amber new file mode 100644 index 0000000..0744954 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplification-unused-struct.amber @@ -0,0 +1,283 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific shader simplification path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision lowp int; +# +# struct S +# { +# int arr[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# int func(S s, int x) +# { +# s.arr[1] = x + 1; +# +# // Always false. +# if(s.arr[one] == x) +# return -1; +# +# return x; +# } +# +# void main() +# { +# S s; +# int a = 0; +# +# for(int i = 0; i < 2 + one; i++) +# { +# for( int j = 0; j < 3 + one; j++) +# { +# // a is incremented with the following values: +# // (0 + 1 + 2 + 3) + (1 + 2 + 3 + 4) + (2 + 3 + 4 + 5) +# a += func(s, i + j); +# } +# } +# +# // Always true. +# if (a == 30) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 94 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %88 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "S" + OpMemberName %10 0 "arr" + OpName %16 "func(struct-S-i1[2]1;i1;" + OpName %14 "s" + OpName %15 "x" + OpName %23 "buf0" + OpMemberName %23 0 "one" + OpName %25 "" + OpName %41 "a" + OpName %42 "i" + OpName %54 "j" + OpName %66 "s" + OpName %70 "param" + OpName %72 "param" + OpName %88 "_GLF_color" + OpMemberDecorate %10 0 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpMemberDecorate %23 0 RelaxedPrecision + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %28 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + OpDecorate %63 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %67 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %69 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %74 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %77 RelaxedPrecision + OpDecorate %78 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + OpDecorate %88 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 2 + %9 = OpTypeArray %6 %8 + %10 = OpTypeStruct %9 + %11 = OpTypePointer Function %10 + %12 = OpTypePointer Function %6 + %13 = OpTypeFunction %6 %11 %12 + %18 = OpConstant %6 0 + %19 = OpConstant %6 1 + %23 = OpTypeStruct %6 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpTypePointer Uniform %6 + %32 = OpTypeBool + %36 = OpConstant %6 -1 + %49 = OpConstant %6 2 + %61 = OpConstant %6 3 + %81 = OpConstant %6 30 + %85 = OpTypeFloat 32 + %86 = OpTypeVector %85 4 + %87 = OpTypePointer Output %86 + %88 = OpVariable %87 Output + %89 = OpConstant %85 1 + %90 = OpConstant %85 0 + %91 = OpConstantComposite %86 %89 %90 %90 %89 + %93 = OpConstantComposite %86 %90 %90 %90 %90 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %41 = OpVariable %12 Function + %42 = OpVariable %12 Function + %54 = OpVariable %12 Function + %66 = OpVariable %11 Function + %70 = OpVariable %11 Function + %72 = OpVariable %12 Function + OpStore %41 %18 + OpStore %42 %18 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %6 %42 + %50 = OpAccessChain %26 %25 %18 + %51 = OpLoad %6 %50 + %52 = OpIAdd %6 %49 %51 + %53 = OpSLessThan %32 %48 %52 + OpBranchConditional %53 %44 %45 + %44 = OpLabel + OpStore %54 %18 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %6 %54 + %62 = OpAccessChain %26 %25 %18 + %63 = OpLoad %6 %62 + %64 = OpIAdd %6 %61 %63 + %65 = OpSLessThan %32 %60 %64 + OpBranchConditional %65 %56 %57 + %56 = OpLabel + %67 = OpLoad %6 %42 + %68 = OpLoad %6 %54 + %69 = OpIAdd %6 %67 %68 + %71 = OpLoad %10 %66 + OpStore %70 %71 + OpStore %72 %69 + %73 = OpFunctionCall %6 %16 %70 %72 + %74 = OpLoad %6 %41 + %75 = OpIAdd %6 %74 %73 + OpStore %41 %75 + OpBranch %58 + %58 = OpLabel + %76 = OpLoad %6 %54 + %77 = OpIAdd %6 %76 %19 + OpStore %54 %77 + OpBranch %55 + %57 = OpLabel + OpBranch %46 + %46 = OpLabel + %78 = OpLoad %6 %42 + %79 = OpIAdd %6 %78 %19 + OpStore %42 %79 + OpBranch %43 + %45 = OpLabel + %80 = OpLoad %6 %41 + %82 = OpIEqual %32 %80 %81 + OpSelectionMerge %84 None + OpBranchConditional %82 %83 %92 + %83 = OpLabel + OpStore %88 %91 + OpBranch %84 + %92 = OpLabel + OpStore %88 %93 + OpBranch %84 + %84 = OpLabel + OpReturn + OpFunctionEnd + %16 = OpFunction %6 None %13 + %14 = OpFunctionParameter %11 + %15 = OpFunctionParameter %12 + %17 = OpLabel + %20 = OpLoad %6 %15 + %21 = OpIAdd %6 %20 %19 + %22 = OpAccessChain %12 %14 %18 %19 + OpStore %22 %21 + %27 = OpAccessChain %26 %25 %18 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %12 %14 %18 %28 + %30 = OpLoad %6 %29 + %31 = OpLoad %6 %15 + %33 = OpIEqual %32 %30 %31 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %35 + %34 = OpLabel + OpReturnValue %36 + %35 = OpLabel + %38 = OpLoad %6 %15 + OpReturnValue %38 + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplification-while-inside-for.amber b/vulkan/amber/graphicsfuzz/cov-simplification-while-inside-for.amber new file mode 100644 index 0000000..05d2278 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplification-while-inside-for.amber @@ -0,0 +1,200 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific code simplification path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# layout(set = 0, binding = 1) uniform buf1 +# { +# int zero; +# }; +# +# void main() +# { +# _GLF_color = vec4(0); +# +# for(int i = 0; i < one; i++) +# { +# do +# { +# // Always true. +# if(one == 1) +# _GLF_color = vec4(1, 0, 0, 1); +# } +# while(false); +# } +# +# vec4 v; +# v.y = float(zero); +# _GLF_color.y = v.y; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "i" + OpName %22 "buf0" + OpMemberName %22 0 "one" + OpName %24 "" + OpName %46 "v" + OpName %47 "buf1" + OpMemberName %47 0 "zero" + OpName %49 "" + OpDecorate %9 Location 0 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpMemberDecorate %47 0 Offset 0 + OpDecorate %47 Block + OpDecorate %49 DescriptorSet 0 + OpDecorate %49 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypeInt 32 1 + %13 = OpTypePointer Function %12 + %15 = OpConstant %12 0 + %22 = OpTypeStruct %12 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpTypePointer Uniform %12 + %28 = OpTypeBool + %36 = OpConstant %12 1 + %40 = OpConstant %6 1 + %41 = OpConstantComposite %7 %40 %10 %10 %40 + %42 = OpConstantFalse %28 + %45 = OpTypePointer Function %7 + %47 = OpTypeStruct %12 + %48 = OpTypePointer Uniform %47 + %49 = OpVariable %48 Uniform + %53 = OpTypeInt 32 0 + %54 = OpConstant %53 1 + %55 = OpTypePointer Function %6 + %59 = OpTypePointer Output %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpVariable %13 Function + %46 = OpVariable %45 Function + OpStore %9 %11 + OpStore %14 %15 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %21 = OpLoad %12 %14 + %26 = OpAccessChain %25 %24 %15 + %27 = OpLoad %12 %26 + %29 = OpSLessThan %28 %21 %27 + OpBranchConditional %29 %17 %18 + %17 = OpLabel + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %31 + %31 = OpLabel + %34 = OpAccessChain %25 %24 %15 + %35 = OpLoad %12 %34 + %37 = OpIEqual %28 %35 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + OpStore %9 %41 + OpBranch %39 + %39 = OpLabel + OpBranch %33 + %33 = OpLabel + OpBranchConditional %42 %30 %32 + %32 = OpLabel + OpBranch %19 + %19 = OpLabel + %43 = OpLoad %12 %14 + %44 = OpIAdd %12 %43 %36 + OpStore %14 %44 + OpBranch %16 + %18 = OpLabel + %50 = OpAccessChain %25 %49 %15 + %51 = OpLoad %12 %50 + %52 = OpConvertSToF %6 %51 + %56 = OpAccessChain %55 %46 %54 + OpStore %56 %52 + %57 = OpAccessChain %55 %46 %54 + %58 = OpLoad %6 %57 + %60 = OpAccessChain %59 %9 %54 + OpStore %60 %58 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-clamp-max-itself.amber b/vulkan/amber/graphicsfuzz/cov-simplify-clamp-max-itself.amber new file mode 100644 index 0000000..a2c1633 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-clamp-max-itself.amber @@ -0,0 +1,207 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction simplification code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# // (0, 1, 2, 3) +# ivec4 sequence; +# }; +# +# void main() +# { +# ivec4 a = ivec4(0); +# +# // Sets a = (0, 5, 2, 3) +# for(int i = 0; i < sequence.w + 1; i++) +# { +# if(sequence[clamp(i, sequence.x, i)] == 1) +# a[i] = 5; +# else +# a[i] = i; +# } +# +# int sum = a.x + a.y + a.z + a.w; +# if (sum == 10) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 80 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %74 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "a" + OpName %13 "i" + OpName %20 "buf0" + OpMemberName %20 0 "sequence" + OpName %22 "" + OpName %52 "sum" + OpName %74 "_GLF_color" + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpDecorate %74 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypePointer Function %6 + %20 = OpTypeStruct %7 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpTypeInt 32 0 + %24 = OpConstant %23 3 + %25 = OpTypePointer Uniform %6 + %28 = OpConstant %6 1 + %30 = OpTypeBool + %33 = OpConstant %23 0 + %44 = OpConstant %6 5 + %55 = OpConstant %23 1 + %59 = OpConstant %23 2 + %67 = OpConstant %6 10 + %71 = OpTypeFloat 32 + %72 = OpTypeVector %71 4 + %73 = OpTypePointer Output %72 + %74 = OpVariable %73 Output + %75 = OpConstant %71 1 + %76 = OpConstant %71 0 + %77 = OpConstantComposite %72 %75 %76 %76 %75 + %79 = OpConstantComposite %72 %76 %76 %76 %76 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %13 = OpVariable %12 Function + %52 = OpVariable %12 Function + OpStore %9 %11 + OpStore %13 %10 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %18 + %18 = OpLabel + %19 = OpLoad %6 %13 + %26 = OpAccessChain %25 %22 %10 %24 + %27 = OpLoad %6 %26 + %29 = OpIAdd %6 %27 %28 + %31 = OpSLessThan %30 %19 %29 + OpBranchConditional %31 %15 %16 + %15 = OpLabel + %32 = OpLoad %6 %13 + %34 = OpAccessChain %25 %22 %10 %33 + %35 = OpLoad %6 %34 + %36 = OpLoad %6 %13 + %37 = OpExtInst %6 %1 SClamp %32 %35 %36 + %38 = OpAccessChain %25 %22 %10 %37 + %39 = OpLoad %6 %38 + %40 = OpIEqual %30 %39 %28 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %46 + %41 = OpLabel + %43 = OpLoad %6 %13 + %45 = OpAccessChain %12 %9 %43 + OpStore %45 %44 + OpBranch %42 + %46 = OpLabel + %47 = OpLoad %6 %13 + %48 = OpLoad %6 %13 + %49 = OpAccessChain %12 %9 %47 + OpStore %49 %48 + OpBranch %42 + %42 = OpLabel + OpBranch %17 + %17 = OpLabel + %50 = OpLoad %6 %13 + %51 = OpIAdd %6 %50 %28 + OpStore %13 %51 + OpBranch %14 + %16 = OpLabel + %53 = OpAccessChain %12 %9 %33 + %54 = OpLoad %6 %53 + %56 = OpAccessChain %12 %9 %55 + %57 = OpLoad %6 %56 + %58 = OpIAdd %6 %54 %57 + %60 = OpAccessChain %12 %9 %59 + %61 = OpLoad %6 %60 + %62 = OpIAdd %6 %58 %61 + %63 = OpAccessChain %12 %9 %24 + %64 = OpLoad %6 %63 + %65 = OpIAdd %6 %62 %64 + OpStore %52 %65 + %66 = OpLoad %6 %52 + %68 = OpIEqual %30 %66 %67 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %78 + %69 = OpLabel + OpStore %74 %77 + OpBranch %70 + %78 = OpLabel + OpStore %74 %79 + OpBranch %70 + %70 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# sequence +BUFFER variant_sequence DATA_TYPE vec4 DATA + 0 1 2 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_sequence AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-combine-compares-max-max-one.amber b/vulkan/amber/graphicsfuzz/cov-simplify-combine-compares-max-max-one.amber new file mode 100644 index 0000000..3992c4c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-combine-compares-max-max-one.amber @@ -0,0 +1,159 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers specific instruction simplifying and combining code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_5 _GLF_uniform_int_values[1] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = max(_int_1, max(_int_1, 1)); +# if (a == _int_1) +# { +# _GLF_color = vec4(a, _int_0, _int_0, a); +# } +# else +# { +# _GLF_color = vec4(a); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %34 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %34 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %6 + %21 = OpConstant %6 1 + %27 = OpTypeBool + %31 = OpTypeFloat 32 + %32 = OpTypeVector %31 4 + %33 = OpTypePointer Output %32 + %34 = OpVariable %33 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %17 = OpAccessChain %16 %14 %15 %15 + %18 = OpLoad %6 %17 + %19 = OpAccessChain %16 %14 %15 %15 + %20 = OpLoad %6 %19 + %22 = OpExtInst %6 %1 SMax %20 %21 + %23 = OpExtInst %6 %1 SMax %18 %22 + OpStore %8 %23 + %24 = OpLoad %6 %8 + %25 = OpAccessChain %16 %14 %15 %15 + %26 = OpLoad %6 %25 + %28 = OpIEqual %27 %24 %26 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %46 + %29 = OpLabel + %35 = OpLoad %6 %8 + %36 = OpConvertSToF %31 %35 + %37 = OpAccessChain %16 %14 %15 %21 + %38 = OpLoad %6 %37 + %39 = OpConvertSToF %31 %38 + %40 = OpAccessChain %16 %14 %15 %21 + %41 = OpLoad %6 %40 + %42 = OpConvertSToF %31 %41 + %43 = OpLoad %6 %8 + %44 = OpConvertSToF %31 %43 + %45 = OpCompositeConstruct %32 %36 %39 %42 %44 + OpStore %34 %45 + OpBranch %30 + %46 = OpLabel + %47 = OpLoad %6 %8 + %48 = OpConvertSToF %31 %47 + %49 = OpCompositeConstruct %32 %48 %48 %48 %48 + OpStore %34 %49 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-component-uniform-idx.amber b/vulkan/amber/graphicsfuzz/cov-simplify-component-uniform-idx.amber new file mode 100644 index 0000000..2490c95 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-component-uniform-idx.amber @@ -0,0 +1,167 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction simplification code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int two; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = 0; +# +# for(int r = 0; r < two * 4; r += 2) +# i += ivec4(1, 2, 3, 4)[r / two]; +# +# if (i == 10) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %49 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %10 "r" + OpName %17 "buf0" + OpMemberName %17 0 "two" + OpName %19 "" + OpName %49 "_GLF_color" + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %49 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpTypeStruct %6 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypePointer Uniform %6 + %23 = OpConstant %6 4 + %25 = OpTypeBool + %27 = OpTypeVector %6 4 + %28 = OpConstant %6 1 + %29 = OpConstant %6 2 + %30 = OpConstant %6 3 + %31 = OpConstantComposite %27 %28 %29 %30 %23 + %42 = OpConstant %6 10 + %46 = OpTypeFloat 32 + %47 = OpTypeVector %46 4 + %48 = OpTypePointer Output %47 + %49 = OpVariable %48 Output + %50 = OpConstant %46 1 + %51 = OpConstant %46 0 + %52 = OpConstantComposite %47 %50 %51 %51 %50 + %54 = OpConstantComposite %47 %51 %51 %51 %51 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %16 = OpLoad %6 %10 + %21 = OpAccessChain %20 %19 %9 + %22 = OpLoad %6 %21 + %24 = OpIMul %6 %22 %23 + %26 = OpSLessThan %25 %16 %24 + OpBranchConditional %26 %12 %13 + %12 = OpLabel + %32 = OpLoad %6 %10 + %33 = OpAccessChain %20 %19 %9 + %34 = OpLoad %6 %33 + %35 = OpSDiv %6 %32 %34 + %36 = OpVectorExtractDynamic %6 %31 %35 + %37 = OpLoad %6 %8 + %38 = OpIAdd %6 %37 %36 + OpStore %8 %38 + OpBranch %14 + %14 = OpLabel + %39 = OpLoad %6 %10 + %40 = OpIAdd %6 %39 %29 + OpStore %10 %40 + OpBranch %11 + %13 = OpLabel + %41 = OpLoad %6 %8 + %43 = OpIEqual %25 %41 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %53 + %44 = OpLabel + OpStore %49 %52 + OpBranch %45 + %53 = OpLabel + OpStore %49 %54 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE int32 DATA + 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-div-by-uint-one.amber b/vulkan/amber/graphicsfuzz/cov-simplify-div-by-uint-one.amber new file mode 100644 index 0000000..00f5d7f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-div-by-uint-one.amber @@ -0,0 +1,135 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction simplification code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# uint two; +# }; +# +# void main() +# { +# uint a = two / 1u; +# +# if (a == 2u) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %28 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %9 "buf0" + OpMemberName %9 0 "two" + OpName %11 "" + OpName %28 "_GLF_color" + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 Block + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 0 + OpDecorate %28 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpTypeStruct %6 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpTypePointer Uniform %6 + %17 = OpConstant %6 1 + %20 = OpConstant %6 2 + %21 = OpTypeBool + %25 = OpTypeFloat 32 + %26 = OpTypeVector %25 4 + %27 = OpTypePointer Output %26 + %28 = OpVariable %27 Output + %29 = OpConstant %25 1 + %30 = OpConstant %25 0 + %31 = OpConstantComposite %26 %29 %30 %30 %29 + %33 = OpConstantComposite %26 %30 %30 %30 %30 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %15 = OpAccessChain %14 %11 %13 + %16 = OpLoad %6 %15 + %18 = OpUDiv %6 %16 %17 + OpStore %8 %18 + %19 = OpLoad %6 %8 + %22 = OpIEqual %21 %19 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %32 + %23 = OpLabel + OpStore %28 %31 + OpBranch %24 + %32 = OpLabel + OpStore %28 %33 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE uint32 DATA + 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-for-bitwise-condition.amber b/vulkan/amber/graphicsfuzz/cov-simplify-for-bitwise-condition.amber new file mode 100644 index 0000000..58d0e06 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-for-bitwise-condition.amber @@ -0,0 +1,193 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplify code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# for (int i = -_int_1; (i | _int_1) < _int_1; i++) +# { +# a = i * _int_1; +# } +# +# if (a == -_int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(a); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %53 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %53 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %53 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %35 = OpTypeBool + %50 = OpTypeFloat 32 + %51 = OpTypeVector %50 4 + %52 = OpTypePointer Output %51 + %53 = OpVariable %52 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %21 = OpAccessChain %17 %14 %15 %15 + %22 = OpLoad %6 %21 + %23 = OpSNegate %6 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %20 + %30 = OpAccessChain %17 %14 %15 %15 + %31 = OpLoad %6 %30 + %32 = OpBitwiseOr %6 %29 %31 + %33 = OpAccessChain %17 %14 %15 %15 + %34 = OpLoad %6 %33 + %36 = OpSLessThan %35 %32 %34 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %37 = OpLoad %6 %20 + %38 = OpAccessChain %17 %14 %15 %15 + %39 = OpLoad %6 %38 + %40 = OpIMul %6 %37 %39 + OpStore %8 %40 + OpBranch %27 + %27 = OpLabel + %41 = OpLoad %6 %20 + %42 = OpIAdd %6 %41 %16 + OpStore %20 %42 + OpBranch %24 + %26 = OpLabel + %43 = OpLoad %6 %8 + %44 = OpAccessChain %17 %14 %15 %15 + %45 = OpLoad %6 %44 + %46 = OpSNegate %6 %45 + %47 = OpIEqual %35 %43 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %67 + %48 = OpLabel + %54 = OpAccessChain %17 %14 %15 %15 + %55 = OpLoad %6 %54 + %56 = OpConvertSToF %50 %55 + %57 = OpAccessChain %17 %14 %15 %16 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %50 %58 + %60 = OpAccessChain %17 %14 %15 %16 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %50 %61 + %63 = OpAccessChain %17 %14 %15 %15 + %64 = OpLoad %6 %63 + %65 = OpConvertSToF %50 %64 + %66 = OpCompositeConstruct %51 %56 %59 %62 %65 + OpStore %53 %66 + OpBranch %49 + %67 = OpLabel + %68 = OpLoad %6 %8 + %69 = OpConvertSToF %50 %68 + %70 = OpCompositeConstruct %51 %69 %69 %69 %69 + OpStore %53 %70 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-ldexp-exponent-zero.amber b/vulkan/amber/graphicsfuzz/cov-simplify-ldexp-exponent-zero.amber new file mode 100644 index 0000000..f166e7f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-ldexp-exponent-zero.amber @@ -0,0 +1,132 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction simplification code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float three; +# }; +# +# void main() +# { +# // f becomes 3.0 * 2^0 = 3.0. +# float f = ldexp(three, 0); +# +# if (f == 3.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %26 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %9 "buf0" + OpMemberName %9 0 "three" + OpName %11 "" + OpName %26 "_GLF_color" + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 Block + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 0 + OpDecorate %26 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeStruct %6 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpTypePointer Uniform %6 + %19 = OpConstant %6 3 + %20 = OpTypeBool + %24 = OpTypeVector %6 4 + %25 = OpTypePointer Output %24 + %26 = OpVariable %25 Output + %27 = OpConstant %6 1 + %28 = OpConstant %6 0 + %29 = OpConstantComposite %24 %27 %28 %28 %27 + %31 = OpConstantComposite %24 %28 %28 %28 %28 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %15 = OpAccessChain %14 %11 %13 + %16 = OpLoad %6 %15 + %17 = OpExtInst %6 %1 Ldexp %16 %13 + OpStore %8 %17 + %18 = OpLoad %6 %8 + %21 = OpFOrdEqual %20 %18 %19 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %30 + %22 = OpLabel + OpStore %26 %29 + OpBranch %23 + %30 = OpLabel + OpStore %26 %31 + OpBranch %23 + %23 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# three +BUFFER variant_three DATA_TYPE float DATA + 3.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_three AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-max-multiplied-values.amber b/vulkan/amber/graphicsfuzz/cov-simplify-max-multiplied-values.amber new file mode 100644 index 0000000..52950ac --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-max-multiplied-values.amber @@ -0,0 +1,261 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplify code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_3 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# #define _int_4 _GLF_uniform_int_values[4] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 2, 3, 1, 4] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int A[4]; +# for (int i = _int_0; i < _int_4; i++) +# { +# A[i] = _int_0; +# +# // Sets the first two elements of A to 1. +# if (max(2 * i, 2 * _int_1) == _int_2) +# { +# A[i] = 1; +# } +# } +# +# if (A[_int_0] == _int_1 && A[_int_1] == _int_1 && A[_int_2] == _int_0 && +# A[_int_3] == _int_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 115 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %98 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %33 "A" + OpName %98 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %98 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 5 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %6 + %25 = OpConstant %6 4 + %28 = OpTypeBool + %30 = OpConstant %9 4 + %31 = OpTypeArray %6 %30 + %32 = OpTypePointer Function %31 + %38 = OpConstant %6 2 + %41 = OpConstant %6 3 + %46 = OpConstant %6 1 + %95 = OpTypeFloat 32 + %96 = OpTypeVector %95 4 + %97 = OpTypePointer Output %96 + %98 = OpVariable %97 Output + %113 = OpConstant %95 1 + %114 = OpConstantComposite %96 %113 %113 %113 %113 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %33 = OpVariable %32 Function + %17 = OpAccessChain %16 %14 %15 %15 + %18 = OpLoad %6 %17 + OpStore %8 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %6 %8 + %26 = OpAccessChain %16 %14 %15 %25 + %27 = OpLoad %6 %26 + %29 = OpSLessThan %28 %24 %27 + OpBranchConditional %29 %20 %21 + %20 = OpLabel + %34 = OpLoad %6 %8 + %35 = OpAccessChain %16 %14 %15 %15 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %7 %33 %34 + OpStore %37 %36 + %39 = OpLoad %6 %8 + %40 = OpIMul %6 %38 %39 + %42 = OpAccessChain %16 %14 %15 %41 + %43 = OpLoad %6 %42 + %44 = OpIMul %6 %38 %43 + %45 = OpExtInst %6 %1 SMax %40 %44 + %47 = OpAccessChain %16 %14 %15 %46 + %48 = OpLoad %6 %47 + %49 = OpIEqual %28 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %51 + %50 = OpLabel + %52 = OpLoad %6 %8 + %53 = OpAccessChain %7 %33 %52 + OpStore %53 %46 + OpBranch %51 + %51 = OpLabel + OpBranch %22 + %22 = OpLabel + %54 = OpLoad %6 %8 + %55 = OpIAdd %6 %54 %46 + OpStore %8 %55 + OpBranch %19 + %21 = OpLabel + %56 = OpAccessChain %16 %14 %15 %15 + %57 = OpLoad %6 %56 + %58 = OpAccessChain %7 %33 %57 + %59 = OpLoad %6 %58 + %60 = OpAccessChain %16 %14 %15 %41 + %61 = OpLoad %6 %60 + %62 = OpIEqual %28 %59 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %64 + %63 = OpLabel + %65 = OpAccessChain %16 %14 %15 %41 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %7 %33 %66 + %68 = OpLoad %6 %67 + %69 = OpAccessChain %16 %14 %15 %41 + %70 = OpLoad %6 %69 + %71 = OpIEqual %28 %68 %70 + OpBranch %64 + %64 = OpLabel + %72 = OpPhi %28 %62 %21 %71 %63 + OpSelectionMerge %74 None + OpBranchConditional %72 %73 %74 + %73 = OpLabel + %75 = OpAccessChain %16 %14 %15 %46 + %76 = OpLoad %6 %75 + %77 = OpAccessChain %7 %33 %76 + %78 = OpLoad %6 %77 + %79 = OpAccessChain %16 %14 %15 %15 + %80 = OpLoad %6 %79 + %81 = OpIEqual %28 %78 %80 + OpBranch %74 + %74 = OpLabel + %82 = OpPhi %28 %72 %64 %81 %73 + OpSelectionMerge %84 None + OpBranchConditional %82 %83 %84 + %83 = OpLabel + %85 = OpAccessChain %16 %14 %15 %38 + %86 = OpLoad %6 %85 + %87 = OpAccessChain %7 %33 %86 + %88 = OpLoad %6 %87 + %89 = OpAccessChain %16 %14 %15 %15 + %90 = OpLoad %6 %89 + %91 = OpIEqual %28 %88 %90 + OpBranch %84 + %84 = OpLabel + %92 = OpPhi %28 %82 %74 %91 %83 + OpSelectionMerge %94 None + OpBranchConditional %92 %93 %112 + %93 = OpLabel + %99 = OpAccessChain %16 %14 %15 %41 + %100 = OpLoad %6 %99 + %101 = OpConvertSToF %95 %100 + %102 = OpAccessChain %16 %14 %15 %15 + %103 = OpLoad %6 %102 + %104 = OpConvertSToF %95 %103 + %105 = OpAccessChain %16 %14 %15 %15 + %106 = OpLoad %6 %105 + %107 = OpConvertSToF %95 %106 + %108 = OpAccessChain %16 %14 %15 %41 + %109 = OpLoad %6 %108 + %110 = OpConvertSToF %95 %109 + %111 = OpCompositeConstruct %96 %101 %104 %107 %110 + OpStore %98 %111 + OpBranch %94 + %112 = OpLabel + OpStore %98 %114 + OpBranch %94 + %94 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 2 3 1 4 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-modulo-1.amber b/vulkan/amber/graphicsfuzz/cov-simplify-modulo-1.amber new file mode 100644 index 0000000..ccbc652 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-modulo-1.amber @@ -0,0 +1,180 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific instruction simplification code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_10_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 10.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: 1 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = mod(_float_10_0, 1.); +# +# if (a == _float_0_0) +# { +# _GLF_color = vec4(_int_1, a, a, _int_1); +# } +# else +# { +# _GLF_color = vec4(a); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %31 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %31 "_GLF_color" + OpName %34 "buf1" + OpMemberName %34 0 "_GLF_uniform_int_values" + OpName %36 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %31 Location 0 + OpDecorate %33 ArrayStride 16 + OpMemberDecorate %34 0 Offset 0 + OpDecorate %34 Block + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %6 + %20 = OpConstant %6 1 + %25 = OpTypeBool + %29 = OpTypeVector %6 4 + %30 = OpTypePointer Output %29 + %31 = OpVariable %30 Output + %32 = OpConstant %9 1 + %33 = OpTypeArray %15 %32 + %34 = OpTypeStruct %33 + %35 = OpTypePointer Uniform %34 + %36 = OpVariable %35 Uniform + %37 = OpTypePointer Uniform %15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %16 %16 + %19 = OpLoad %6 %18 + %21 = OpFMod %6 %19 %20 + OpStore %8 %21 + %22 = OpLoad %6 %8 + %23 = OpAccessChain %17 %14 %16 %16 + %24 = OpLoad %6 %23 + %26 = OpFOrdEqual %25 %22 %24 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %47 + %27 = OpLabel + %38 = OpAccessChain %37 %36 %16 %16 + %39 = OpLoad %15 %38 + %40 = OpConvertSToF %6 %39 + %41 = OpLoad %6 %8 + %42 = OpLoad %6 %8 + %43 = OpAccessChain %37 %36 %16 %16 + %44 = OpLoad %15 %43 + %45 = OpConvertSToF %6 %44 + %46 = OpCompositeConstruct %29 %40 %41 %42 %45 + OpStore %31 %46 + OpBranch %28 + %47 = OpLabel + %48 = OpLoad %6 %8 + %49 = OpCompositeConstruct %29 %48 %48 %48 %48 + OpStore %31 %49 + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 10.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-mul-identity.amber b/vulkan/amber/graphicsfuzz/cov-simplify-mul-identity.amber new file mode 100644 index 0000000..8cc9343 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-mul-identity.amber @@ -0,0 +1,148 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction simplification code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 v = vec4(8.4, -864.665, 945.420, 1.0); +# // Multiplying with an identity matrix returns the original vector. +# vec4 res = mat4(one) * v; +# +# if (distance(v, res) < 0.01) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 46 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %42 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v" + OpName %15 "res" + OpName %16 "buf0" + OpMemberName %16 0 "one" + OpName %18 "" + OpName %42 "_GLF_color" + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %42 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 8.39999962 + %11 = OpConstant %6 -864.664978 + %12 = OpConstant %6 945.419983 + %13 = OpConstant %6 1 + %14 = OpConstantComposite %7 %10 %11 %12 %13 + %16 = OpTypeStruct %6 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpTypeInt 32 1 + %20 = OpConstant %19 0 + %21 = OpTypePointer Uniform %6 + %24 = OpTypeMatrix %7 4 + %25 = OpConstant %6 0 + %36 = OpConstant %6 0.00999999978 + %37 = OpTypeBool + %41 = OpTypePointer Output %7 + %42 = OpVariable %41 Output + %43 = OpConstantComposite %7 %13 %25 %25 %13 + %45 = OpConstantComposite %7 %25 %25 %25 %25 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %15 = OpVariable %8 Function + OpStore %9 %14 + %22 = OpAccessChain %21 %18 %20 + %23 = OpLoad %6 %22 + %26 = OpCompositeConstruct %7 %23 %25 %25 %25 + %27 = OpCompositeConstruct %7 %25 %23 %25 %25 + %28 = OpCompositeConstruct %7 %25 %25 %23 %25 + %29 = OpCompositeConstruct %7 %25 %25 %25 %23 + %30 = OpCompositeConstruct %24 %26 %27 %28 %29 + %31 = OpLoad %7 %9 + %32 = OpMatrixTimesVector %7 %30 %31 + OpStore %15 %32 + %33 = OpLoad %7 %9 + %34 = OpLoad %7 %15 + %35 = OpExtInst %6 %1 Distance %33 %34 + %38 = OpFOrdLessThan %37 %35 %36 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %44 + %39 = OpLabel + OpStore %42 %43 + OpBranch %40 + %44 = OpLabel + OpStore %42 %45 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-not-less-than-neg.amber b/vulkan/amber/graphicsfuzz/cov-simplify-not-less-than-neg.amber new file mode 100644 index 0000000..c2341ce --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-not-less-than-neg.amber @@ -0,0 +1,143 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction simplification code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int three; +# }; +# +# void main() +# { +# // Always true. +# if(three > 1 && !(gl_FragCoord.y < -5.0)) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %22 %35 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "buf0" + OpMemberName %8 0 "three" + OpName %10 "" + OpName %22 "gl_FragCoord" + OpName %35 "_GLF_color" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 0 + OpDecorate %22 BuiltIn FragCoord + OpDecorate %35 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeBool + %7 = OpTypeInt 32 1 + %8 = OpTypeStruct %7 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpConstant %7 0 + %12 = OpTypePointer Uniform %7 + %15 = OpConstant %7 1 + %19 = OpTypeFloat 32 + %20 = OpTypeVector %19 4 + %21 = OpTypePointer Input %20 + %22 = OpVariable %21 Input + %23 = OpTypeInt 32 0 + %24 = OpConstant %23 1 + %25 = OpTypePointer Input %19 + %28 = OpConstant %19 -5 + %34 = OpTypePointer Output %20 + %35 = OpVariable %34 Output + %36 = OpConstant %19 1 + %37 = OpConstant %19 0 + %38 = OpConstantComposite %20 %36 %37 %37 %36 + %40 = OpConstantComposite %20 %37 %37 %37 %37 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %13 = OpAccessChain %12 %10 %11 + %14 = OpLoad %7 %13 + %16 = OpSGreaterThan %6 %14 %15 + OpSelectionMerge %18 None + OpBranchConditional %16 %17 %18 + %17 = OpLabel + %26 = OpAccessChain %25 %22 %24 + %27 = OpLoad %19 %26 + %29 = OpFOrdLessThan %6 %27 %28 + %30 = OpLogicalNot %6 %29 + OpBranch %18 + %18 = OpLabel + %31 = OpPhi %6 %16 %5 %30 %17 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %39 + %32 = OpLabel + OpStore %35 %38 + OpBranch %33 + %39 = OpLabel + OpStore %35 %40 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# three +BUFFER variant_three DATA_TYPE int32 DATA + 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_three AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-right-shift-greater-than-zero.amber b/vulkan/amber/graphicsfuzz/cov-simplify-right-shift-greater-than-zero.amber new file mode 100644 index 0000000..d665a7d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-right-shift-greater-than-zero.amber @@ -0,0 +1,150 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers specific instruction simplify and combine compare code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# if ((1 >> _int_0) > 0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %26 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "buf0" + OpMemberName %11 0 "_GLF_uniform_int_values" + OpName %13 "" + OpName %26 "_GLF_color" + OpDecorate %10 ArrayStride 16 + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %26 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpConstant %6 1 + %8 = OpTypeInt 32 0 + %9 = OpConstant %8 2 + %10 = OpTypeArray %6 %9 + %11 = OpTypeStruct %10 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpConstant %6 0 + %15 = OpTypePointer Uniform %6 + %19 = OpTypeBool + %23 = OpTypeFloat 32 + %24 = OpTypeVector %23 4 + %25 = OpTypePointer Output %24 + %26 = OpVariable %25 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %16 = OpAccessChain %15 %13 %14 %14 + %17 = OpLoad %6 %16 + %18 = OpShiftRightArithmetic %6 %7 %17 + %20 = OpSGreaterThan %19 %18 %14 + OpSelectionMerge %22 None + OpBranchConditional %20 %21 %40 + %21 = OpLabel + %27 = OpAccessChain %15 %13 %14 %7 + %28 = OpLoad %6 %27 + %29 = OpConvertSToF %23 %28 + %30 = OpAccessChain %15 %13 %14 %14 + %31 = OpLoad %6 %30 + %32 = OpConvertSToF %23 %31 + %33 = OpAccessChain %15 %13 %14 %14 + %34 = OpLoad %6 %33 + %35 = OpConvertSToF %23 %34 + %36 = OpAccessChain %15 %13 %14 %7 + %37 = OpLoad %6 %36 + %38 = OpConvertSToF %23 %37 + %39 = OpCompositeConstruct %24 %29 %32 %35 %38 + OpStore %26 %39 + OpBranch %22 + %40 = OpLabel + %41 = OpAccessChain %15 %13 %14 %14 + %42 = OpLoad %6 %41 + %43 = OpConvertSToF %23 %42 + %44 = OpCompositeConstruct %24 %43 %43 %43 %43 + OpStore %26 %44 + OpBranch %22 + %22 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-select-fragcoord.amber b/vulkan/amber/graphicsfuzz/cov-simplify-select-fragcoord.amber new file mode 100644 index 0000000..ac9a447 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-select-fragcoord.amber @@ -0,0 +1,147 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction simplification code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# void main() +# { +# // Always selects 1.0. +# float f = mix(1.0, 0.0, gl_FragCoord.y < 0.0); +# +# if(determinant(mat3(f)) == one) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 46 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 %42 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %13 "gl_FragCoord" + OpName %30 "buf0" + OpMemberName %30 0 "one" + OpName %32 "" + OpName %42 "_GLF_color" + OpDecorate %13 BuiltIn FragCoord + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 0 + OpDecorate %42 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpConstant %6 0 + %11 = OpTypeVector %6 4 + %12 = OpTypePointer Input %11 + %13 = OpVariable %12 Input + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 1 + %16 = OpTypePointer Input %6 + %19 = OpTypeBool + %23 = OpTypeVector %6 3 + %24 = OpTypeMatrix %23 3 + %30 = OpTypeStruct %6 + %31 = OpTypePointer Uniform %30 + %32 = OpVariable %31 Uniform + %33 = OpTypeInt 32 1 + %34 = OpConstant %33 0 + %35 = OpTypePointer Uniform %6 + %41 = OpTypePointer Output %11 + %42 = OpVariable %41 Output + %43 = OpConstantComposite %11 %9 %10 %10 %9 + %45 = OpConstantComposite %11 %10 %10 %10 %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %17 = OpAccessChain %16 %13 %15 + %18 = OpLoad %6 %17 + %20 = OpFOrdLessThan %19 %18 %10 + %21 = OpSelect %6 %20 %10 %9 + OpStore %8 %21 + %22 = OpLoad %6 %8 + %25 = OpCompositeConstruct %23 %22 %10 %10 + %26 = OpCompositeConstruct %23 %10 %22 %10 + %27 = OpCompositeConstruct %23 %10 %10 %22 + %28 = OpCompositeConstruct %24 %25 %26 %27 + %29 = OpExtInst %6 %1 Determinant %28 + %36 = OpAccessChain %35 %32 %34 + %37 = OpLoad %6 %36 + %38 = OpFOrdEqual %19 %29 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %44 + %39 = OpLabel + OpStore %42 %43 + OpBranch %40 + %44 = OpLabel + OpStore %42 %45 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-sign-cosh.amber b/vulkan/amber/graphicsfuzz/cov-simplify-sign-cosh.amber new file mode 100644 index 0000000..d47cafc --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-sign-cosh.amber @@ -0,0 +1,139 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction simplification path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# void main() +# { +# if (sign(cosh(709.)) == 1. || one == 1) +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# else +# { +# _GLF_color = vec4(1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %31 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %17 "buf0" + OpMemberName %17 0 "one" + OpName %19 "" + OpName %31 "_GLF_color" + OpMemberDecorate %17 0 RelaxedPrecision + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %23 RelaxedPrecision + OpDecorate %31 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeBool + %7 = OpTypeFloat 32 + %8 = OpConstant %7 709 + %11 = OpConstant %7 1 + %16 = OpTypeInt 32 1 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %16 0 + %21 = OpTypePointer Uniform %16 + %24 = OpConstant %16 1 + %29 = OpTypeVector %7 4 + %30 = OpTypePointer Output %29 + %31 = OpVariable %30 Output + %32 = OpConstant %7 0 + %33 = OpConstantComposite %29 %11 %32 %32 %11 + %35 = OpConstantComposite %29 %11 %11 %11 %11 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpExtInst %7 %1 Cosh %8 + %10 = OpExtInst %7 %1 FSign %9 + %12 = OpFOrdEqual %6 %10 %11 + %13 = OpLogicalNot %6 %12 + OpSelectionMerge %15 None + OpBranchConditional %13 %14 %15 + %14 = OpLabel + %22 = OpAccessChain %21 %19 %20 + %23 = OpLoad %16 %22 + %25 = OpIEqual %6 %23 %24 + OpBranch %15 + %15 = OpLabel + %26 = OpPhi %6 %12 %5 %25 %14 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %34 + %27 = OpLabel + OpStore %31 %33 + OpBranch %28 + %34 = OpLabel + OpStore %31 %35 + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-simplify-smoothstep-undef.amber b/vulkan/amber/graphicsfuzz/cov-simplify-smoothstep-undef.amber new file mode 100644 index 0000000..ebb66f2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-simplify-smoothstep-undef.amber @@ -0,0 +1,188 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction simplification code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# float zero; +# }; +# +# void main() +# { +# float f = gl_FragCoord.x; +# +# // (1.0 / 0.0) -> Inf. +# // (Inf * 0.0) -> Nan. +# // So: f += Nan. +# f += (1.0 / 0.0) * 0.0; +# +# // Doesn't matter if this is executed or not. +# if (5.0 / f == 0.0) +# f += 1.0; +# +# if (isnan(f) || f != zero) +# f = 0.0; +# +# // Always true. +# if (f == 0.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +DEVICE_EXTENSION VK_KHR_shader_float_controls +DEVICE_PROPERTY FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32 +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpCapability SignedZeroInfNanPreserve + OpExtension "SPV_KHR_float_controls" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %11 %54 + OpExecutionMode %4 OriginUpperLeft + OpExecutionMode %4 SignedZeroInfNanPreserve 32 + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %11 "gl_FragCoord" + OpName %37 "buf0" + OpMemberName %37 0 "zero" + OpName %39 "" + OpName %54 "_GLF_color" + OpDecorate %11 BuiltIn FragCoord + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 0 + OpDecorate %54 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeVector %6 4 + %10 = OpTypePointer Input %9 + %11 = OpVariable %10 Input + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 0 + %14 = OpTypePointer Input %6 + %17 = OpConstant %6 -0x1.8p+128 + %20 = OpConstant %6 5 + %23 = OpConstant %6 0 + %24 = OpTypeBool + %28 = OpConstant %6 1 + %37 = OpTypeStruct %6 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypeInt 32 1 + %41 = OpConstant %40 0 + %42 = OpTypePointer Uniform %6 + %53 = OpTypePointer Output %9 + %54 = OpVariable %53 Output + %55 = OpConstantComposite %9 %28 %23 %23 %28 + %57 = OpConstantComposite %9 %23 %23 %23 %23 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %15 = OpAccessChain %14 %11 %13 + %16 = OpLoad %6 %15 + OpStore %8 %16 + %18 = OpLoad %6 %8 + %19 = OpFAdd %6 %18 %17 + OpStore %8 %19 + %21 = OpLoad %6 %8 + %22 = OpFDiv %6 %20 %21 + %25 = OpFOrdEqual %24 %22 %23 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %27 + %26 = OpLabel + %29 = OpLoad %6 %8 + %30 = OpFAdd %6 %29 %28 + OpStore %8 %30 + OpBranch %27 + %27 = OpLabel + %31 = OpLoad %6 %8 + %32 = OpIsNan %24 %31 + %33 = OpLogicalNot %24 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %35 + %34 = OpLabel + %36 = OpLoad %6 %8 + %43 = OpAccessChain %42 %39 %41 + %44 = OpLoad %6 %43 + %45 = OpFOrdNotEqual %24 %36 %44 + OpBranch %35 + %35 = OpLabel + %46 = OpPhi %24 %32 %27 %45 %34 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + OpStore %8 %23 + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %6 %8 + %50 = OpFOrdEqual %24 %49 %23 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %56 + %51 = OpLabel + OpStore %54 %55 + OpBranch %52 + %56 = OpLabel + OpStore %54 %57 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat.amber b/vulkan/amber/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat.amber new file mode 100644 index 0000000..fe3f9f1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat.amber @@ -0,0 +1,272 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific dag combiner code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int f1(vec2 v1) +# { +# if (v1.x == _float_1_0 && v1.y == _float_0_0) +# { +# return _int_0; +# } +# return _int_1; +# } +# +# void main() +# { +# mat2 m1 = mat2(_float_1_0, -_float_0_0, _float_0_0, sin(_float_0_0)); +# +# // m2 becomes [[1 0], [0 0]] +# mat2 m2 = m1 * m1; +# +# // v1 becomes [1.0, 0.0]. +# vec2 v1 = vec2(_float_1_0) * m2; +# +# int a = f1(v1); +# +# if (a == _int_0) +# { +# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 110 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %95 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %12 "f1(vf2;" + OpName %11 "v1" + OpName %22 "buf0" + OpMemberName %22 0 "_GLF_uniform_float_values" + OpName %24 "" + OpName %43 "buf1" + OpMemberName %43 0 "_GLF_uniform_int_values" + OpName %45 "" + OpName %56 "m1" + OpName %72 "m2" + OpName %76 "v1" + OpName %83 "a" + OpName %84 "param" + OpName %95 "_GLF_color" + OpDecorate %21 ArrayStride 16 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %42 ArrayStride 16 + OpMemberDecorate %43 0 Offset 0 + OpDecorate %43 Block + OpDecorate %45 DescriptorSet 0 + OpDecorate %45 Binding 1 + OpDecorate %95 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeInt 32 1 + %10 = OpTypeFunction %9 %8 + %14 = OpTypeBool + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 0 + %17 = OpTypePointer Function %6 + %20 = OpConstant %15 2 + %21 = OpTypeArray %6 %20 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpConstant %9 0 + %26 = OpTypePointer Uniform %6 + %32 = OpConstant %15 1 + %35 = OpConstant %9 1 + %42 = OpTypeArray %9 %20 + %43 = OpTypeStruct %42 + %44 = OpTypePointer Uniform %43 + %45 = OpVariable %44 Uniform + %46 = OpTypePointer Uniform %9 + %54 = OpTypeMatrix %7 2 + %55 = OpTypePointer Function %54 + %67 = OpConstant %6 1 + %68 = OpConstant %6 0 + %82 = OpTypePointer Function %9 + %93 = OpTypeVector %6 4 + %94 = OpTypePointer Output %93 + %95 = OpVariable %94 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %56 = OpVariable %55 Function + %72 = OpVariable %55 Function + %76 = OpVariable %8 Function + %83 = OpVariable %82 Function + %84 = OpVariable %8 Function + %57 = OpAccessChain %26 %24 %25 %25 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %26 %24 %25 %35 + %60 = OpLoad %6 %59 + %61 = OpFNegate %6 %60 + %62 = OpAccessChain %26 %24 %25 %35 + %63 = OpLoad %6 %62 + %64 = OpAccessChain %26 %24 %25 %35 + %65 = OpLoad %6 %64 + %66 = OpExtInst %6 %1 Sin %65 + %69 = OpCompositeConstruct %7 %58 %61 + %70 = OpCompositeConstruct %7 %63 %66 + %71 = OpCompositeConstruct %54 %69 %70 + OpStore %56 %71 + %73 = OpLoad %54 %56 + %74 = OpLoad %54 %56 + %75 = OpMatrixTimesMatrix %54 %73 %74 + OpStore %72 %75 + %77 = OpAccessChain %26 %24 %25 %25 + %78 = OpLoad %6 %77 + %79 = OpCompositeConstruct %7 %78 %78 + %80 = OpLoad %54 %72 + %81 = OpVectorTimesMatrix %7 %79 %80 + OpStore %76 %81 + %85 = OpLoad %7 %76 + OpStore %84 %85 + %86 = OpFunctionCall %9 %12 %84 + OpStore %83 %86 + %87 = OpLoad %9 %83 + %88 = OpAccessChain %46 %45 %25 %35 + %89 = OpLoad %9 %88 + %90 = OpIEqual %14 %87 %89 + OpSelectionMerge %92 None + OpBranchConditional %90 %91 %105 + %91 = OpLabel + %96 = OpAccessChain %26 %24 %25 %25 + %97 = OpLoad %6 %96 + %98 = OpAccessChain %26 %24 %25 %35 + %99 = OpLoad %6 %98 + %100 = OpAccessChain %26 %24 %25 %35 + %101 = OpLoad %6 %100 + %102 = OpAccessChain %26 %24 %25 %25 + %103 = OpLoad %6 %102 + %104 = OpCompositeConstruct %93 %97 %99 %101 %103 + OpStore %95 %104 + OpBranch %92 + %105 = OpLabel + %106 = OpAccessChain %46 %45 %25 %35 + %107 = OpLoad %9 %106 + %108 = OpConvertSToF %6 %107 + %109 = OpCompositeConstruct %93 %108 %108 %108 %108 + OpStore %95 %109 + OpBranch %92 + %92 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %9 None %10 + %11 = OpFunctionParameter %8 + %13 = OpLabel + %18 = OpAccessChain %17 %11 %16 + %19 = OpLoad %6 %18 + %27 = OpAccessChain %26 %24 %25 %25 + %28 = OpLoad %6 %27 + %29 = OpFOrdEqual %14 %19 %28 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %31 + %30 = OpLabel + %33 = OpAccessChain %17 %11 %32 + %34 = OpLoad %6 %33 + %36 = OpAccessChain %26 %24 %25 %35 + %37 = OpLoad %6 %36 + %38 = OpFOrdEqual %14 %34 %37 + OpBranch %31 + %31 = OpLabel + %39 = OpPhi %14 %29 %13 %38 %30 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %41 + %40 = OpLabel + %47 = OpAccessChain %46 %45 %25 %35 + %48 = OpLoad %9 %47 + OpReturnValue %48 + %41 = OpLabel + %50 = OpAccessChain %46 %45 %25 %25 + %51 = OpLoad %9 %50 + OpReturnValue %51 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-single-block-elim-self-assign.amber b/vulkan/amber/graphicsfuzz/cov-single-block-elim-self-assign.amber new file mode 100644 index 0000000..ef31fc9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-single-block-elim-self-assign.amber @@ -0,0 +1,205 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific single block elimination path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int g = 0; +# +# void main() +# { +# while(g < int(injectionSwitch.x + 2.0)) { +# g++; +# } +# +# // g is 2. +# int a = g; +# +# // Always false. +# while(g < int(injectionSwitch.y)) { +# g++; +# } +# +# a = a; +# +# // Always true. +# if(a == 2) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %58 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "g" + OpName %18 "buf0" + OpMemberName %18 0 "injectionSwitch" + OpName %20 "" + OpName %35 "a" + OpName %58 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %31 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %58 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %16 = OpTypeFloat 32 + %17 = OpTypeVector %16 2 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Uniform %16 + %26 = OpConstant %16 2 + %29 = OpTypeBool + %32 = OpConstant %6 1 + %34 = OpTypePointer Function %6 + %43 = OpConstant %21 1 + %52 = OpConstant %6 2 + %56 = OpTypeVector %16 4 + %57 = OpTypePointer Output %56 + %58 = OpVariable %57 Output + %59 = OpConstant %16 1 + %60 = OpConstant %16 0 + %61 = OpConstantComposite %56 %59 %60 %60 %59 + %63 = OpConstantComposite %56 %60 %60 %60 %60 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %35 = OpVariable %34 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %6 %8 + %24 = OpAccessChain %23 %20 %9 %22 + %25 = OpLoad %16 %24 + %27 = OpFAdd %16 %25 %26 + %28 = OpConvertFToS %6 %27 + %30 = OpSLessThan %29 %15 %28 + OpBranchConditional %30 %11 %12 + %11 = OpLabel + %31 = OpLoad %6 %8 + %33 = OpIAdd %6 %31 %32 + OpStore %8 %33 + OpBranch %13 + %13 = OpLabel + OpBranch %10 + %12 = OpLabel + %36 = OpLoad %6 %8 + OpStore %35 %36 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %6 %8 + %44 = OpAccessChain %23 %20 %9 %43 + %45 = OpLoad %16 %44 + %46 = OpConvertFToS %6 %45 + %47 = OpSLessThan %29 %42 %46 + OpBranchConditional %47 %38 %39 + %38 = OpLabel + %48 = OpLoad %6 %8 + %49 = OpIAdd %6 %48 %32 + OpStore %8 %49 + OpBranch %40 + %40 = OpLabel + OpBranch %37 + %39 = OpLabel + %50 = OpLoad %6 %35 + OpStore %35 %50 + %51 = OpLoad %6 %35 + %53 = OpIEqual %29 %51 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %62 + %54 = OpLabel + OpStore %58 %61 + OpBranch %55 + %62 = OpLabel + OpStore %58 %63 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-single-store-elim-assume-store.amber b/vulkan/amber/graphicsfuzz/cov-single-store-elim-assume-store.amber new file mode 100644 index 0000000..7e8d8cd --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-single-store-elim-assume-store.amber @@ -0,0 +1,215 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific single store elimination path. + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--if-conversion' +# '--eliminate-local-single-block' +# '--redundancy-elimination' +# '--reduce-load-size' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# void main() +# { +# ivec2 v0 = ivec2(0); +# ivec2 v1 = ivec2(2); +# int a = one; +# +# do +# { +# // Always false. +# if (a > 10) +# { +# _GLF_color = vec4(0); +# return; +# } +# +# v0 = v1.x > a ? ivec2(0) : ivec2(1); +# a++; +# } while(a < 9); +# +# // After the loop v0 == (1, 1). +# +# if(v1.x > 1) +# v0 += ivec2(1); +# +# if (v0 == ivec2(2)) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %36 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v0" + OpName %12 "v1" + OpName %16 "a" + OpName %17 "buf0" + OpMemberName %17 0 "one" + OpName %19 "" + OpName %36 "_GLF_color" + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %36 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %10 %10 + %13 = OpConstant %6 2 + %14 = OpConstantComposite %7 %13 %13 + %15 = OpTypePointer Function %6 + %17 = OpTypeStruct %6 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypePointer Uniform %6 + %28 = OpConstant %6 10 + %29 = OpTypeBool + %33 = OpTypeFloat 32 + %34 = OpTypeVector %33 4 + %35 = OpTypePointer Output %34 + %36 = OpVariable %35 Output + %37 = OpConstant %33 0 + %38 = OpConstantComposite %34 %37 %37 %37 %37 + %40 = OpTypeInt 32 0 + %41 = OpConstant %40 0 + %46 = OpConstant %6 1 + %47 = OpConstantComposite %7 %46 %46 + %48 = OpTypeVector %29 2 + %54 = OpConstant %6 9 + %68 = OpConstant %33 1 + %69 = OpConstantComposite %34 %68 %37 %37 %68 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %12 = OpVariable %8 Function + %16 = OpVariable %15 Function + OpStore %9 %11 + OpStore %12 %14 + %21 = OpAccessChain %20 %19 %10 + %22 = OpLoad %6 %21 + OpStore %16 %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %24 + %24 = OpLabel + %27 = OpLoad %6 %16 + %30 = OpSGreaterThan %29 %27 %28 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + OpStore %36 %38 + OpReturn + %32 = OpLabel + %42 = OpAccessChain %15 %12 %41 + %43 = OpLoad %6 %42 + %44 = OpLoad %6 %16 + %45 = OpSGreaterThan %29 %43 %44 + %49 = OpCompositeConstruct %48 %45 %45 + %50 = OpSelect %7 %49 %11 %47 + OpStore %9 %50 + %52 = OpIAdd %6 %44 %46 + OpStore %16 %52 + OpBranch %26 + %26 = OpLabel + %53 = OpLoad %6 %16 + %55 = OpSLessThan %29 %53 %54 + OpBranchConditional %55 %23 %25 + %25 = OpLabel + %57 = OpLoad %6 %42 + %58 = OpSGreaterThan %29 %57 %46 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %60 + %59 = OpLabel + %61 = OpLoad %7 %9 + %62 = OpIAdd %7 %61 %47 + OpStore %9 %62 + OpBranch %60 + %60 = OpLabel + %63 = OpLoad %7 %9 + %64 = OpIEqual %48 %63 %14 + %65 = OpAll %29 %64 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %70 + %66 = OpLabel + OpStore %36 %69 + OpBranch %67 + %70 = OpLabel + OpStore %36 %38 + OpBranch %67 + %67 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-sinh-ldexp.amber b/vulkan/amber/graphicsfuzz/cov-sinh-ldexp.amber new file mode 100644 index 0000000..7332fbb --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-sinh-ldexp.amber @@ -0,0 +1,241 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific inst combine compares code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_2_3503 _GLF_uniform_float_values[0] +# #define _float_2_3505 _GLF_uniform_float_values[1] +# #define _float_1_0 _GLF_uniform_float_values[2] +# #define _float_800_0 _GLF_uniform_float_values[3] +# +# precision highp int; +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [2.3503, 2.3505, 1.0, 800.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // This results in an undefined value, but not in undefined behavior. +# // v1.x becomes approximately 1.1752 and v1.y becomes undefined. +# vec2 v1 = sinh(vec2(_float_1_0, _float_800_0)); +# +# ivec2 v2 = ivec2(_int_1, -3000); +# +# // This results in an undefined value, but not in undefined behavior. +# // v3.x becomes approximately 2.3504 and v3.y becomes undefined. +# vec2 v3 = ldexp(v1, v2); +# +# // Assigning an undefined value doesn't matter since the variable will be +# // reassigned later with a sensible value. +# _GLF_color = vec4(v3.y); +# +# if (v3.x > _float_2_3503 && v3.x < _float_2_3505) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 88 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v1" + OpName %13 "buf1" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %29 "v2" + OpName %32 "buf0" + OpMemberName %32 0 "_GLF_uniform_int_values" + OpName %34 "" + OpName %40 "v3" + OpName %46 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %31 ArrayStride 16 + OpMemberDecorate %32 0 Offset 0 + OpDecorate %32 Block + OpDecorate %34 DescriptorSet 0 + OpDecorate %34 Binding 0 + OpDecorate %46 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 4 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpConstant %16 2 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %16 3 + %27 = OpTypeVector %16 2 + %28 = OpTypePointer Function %27 + %30 = OpConstant %10 2 + %31 = OpTypeArray %16 %30 + %32 = OpTypeStruct %31 + %33 = OpTypePointer Uniform %32 + %34 = OpVariable %33 Uniform + %35 = OpTypePointer Uniform %16 + %38 = OpConstant %16 -3000 + %44 = OpTypeVector %6 4 + %45 = OpTypePointer Output %44 + %46 = OpVariable %45 Output + %47 = OpConstant %10 1 + %48 = OpTypePointer Function %6 + %52 = OpTypeBool + %53 = OpConstant %10 0 + %63 = OpConstant %16 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %29 = OpVariable %28 Function + %40 = OpVariable %8 Function + %20 = OpAccessChain %19 %15 %17 %18 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %19 %15 %17 %22 + %24 = OpLoad %6 %23 + %25 = OpCompositeConstruct %7 %21 %24 + %26 = OpExtInst %7 %1 Sinh %25 + OpStore %9 %26 + %36 = OpAccessChain %35 %34 %17 %17 + %37 = OpLoad %16 %36 + %39 = OpCompositeConstruct %27 %37 %38 + OpStore %29 %39 + %41 = OpLoad %7 %9 + %42 = OpLoad %27 %29 + %43 = OpExtInst %7 %1 Ldexp %41 %42 + OpStore %40 %43 + %49 = OpAccessChain %48 %40 %47 + %50 = OpLoad %6 %49 + %51 = OpCompositeConstruct %44 %50 %50 %50 %50 + OpStore %46 %51 + %54 = OpAccessChain %48 %40 %53 + %55 = OpLoad %6 %54 + %56 = OpAccessChain %19 %15 %17 %17 + %57 = OpLoad %6 %56 + %58 = OpFOrdGreaterThan %52 %55 %57 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %60 + %59 = OpLabel + %61 = OpAccessChain %48 %40 %53 + %62 = OpLoad %6 %61 + %64 = OpAccessChain %19 %15 %17 %63 + %65 = OpLoad %6 %64 + %66 = OpFOrdLessThan %52 %62 %65 + OpBranch %60 + %60 = OpLabel + %67 = OpPhi %52 %58 %5 %66 %59 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %83 + %68 = OpLabel + %70 = OpAccessChain %35 %34 %17 %17 + %71 = OpLoad %16 %70 + %72 = OpConvertSToF %6 %71 + %73 = OpAccessChain %35 %34 %17 %63 + %74 = OpLoad %16 %73 + %75 = OpConvertSToF %6 %74 + %76 = OpAccessChain %35 %34 %17 %63 + %77 = OpLoad %16 %76 + %78 = OpConvertSToF %6 %77 + %79 = OpAccessChain %35 %34 %17 %17 + %80 = OpLoad %16 %79 + %81 = OpConvertSToF %6 %80 + %82 = OpCompositeConstruct %44 %72 %75 %78 %81 + OpStore %46 %82 + OpBranch %69 + %83 = OpLabel + %84 = OpAccessChain %35 %34 %17 %63 + %85 = OpLoad %16 %84 + %86 = OpConvertSToF %6 %85 + %87 = OpCompositeConstruct %44 %86 %86 %86 %86 + OpStore %46 %87 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.3503 2.3505 1.0 800.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-small-array-overwrite-most-uniform-value-check-data-break.amber b/vulkan/amber/graphicsfuzz/cov-small-array-overwrite-most-uniform-value-check-data-break.amber new file mode 100644 index 0000000..fbb0e39 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-small-array-overwrite-most-uniform-value-check-data-break.amber @@ -0,0 +1,301 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _float_2_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_0_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [2, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_float_values: [2.0, 1.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float data[3] = float[3](1.0, _float_1_0, _float_1_0); +# +# // data becomes [1, 0, 0]. +# for(int i = 1; i < 3; i++) +# { +# data[i] = _float_0_0; +# } +# +# // data becomes [1, 2, 0]. +# for(int i = 0; i < 3; i++) +# { +# if(data[i] < _float_1_0) +# { +# data[i] = _float_2_0; +# break; +# } +# } +# +# // Always true. +# if(data[_int_0] == _float_1_0 && data[_int_1] == _float_2_0 && data[_int_2] == _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 123 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %104 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "data" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %27 "i" + OpName %45 "i" + OpName %69 "buf0" + OpMemberName %69 0 "_GLF_uniform_int_values" + OpName %71 "" + OpName %104 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %68 ArrayStride 16 + OpMemberDecorate %69 0 Offset 0 + OpDecorate %69 Block + OpDecorate %71 DescriptorSet 0 + OpDecorate %71 Binding 0 + OpDecorate %104 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 3 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %6 1 + %13 = OpTypeArray %6 %8 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpConstant %17 1 + %20 = OpTypePointer Uniform %6 + %26 = OpTypePointer Function %17 + %34 = OpConstant %17 3 + %35 = OpTypeBool + %38 = OpConstant %17 2 + %41 = OpTypePointer Function %6 + %68 = OpTypeArray %17 %8 + %69 = OpTypeStruct %68 + %70 = OpTypePointer Uniform %69 + %71 = OpVariable %70 Uniform + %72 = OpTypePointer Uniform %17 + %102 = OpTypeVector %6 4 + %103 = OpTypePointer Output %102 + %104 = OpVariable %103 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %27 = OpVariable %26 Function + %45 = OpVariable %26 Function + %21 = OpAccessChain %20 %16 %18 %19 + %22 = OpLoad %6 %21 + %23 = OpAccessChain %20 %16 %18 %19 + %24 = OpLoad %6 %23 + %25 = OpCompositeConstruct %9 %12 %22 %24 + OpStore %11 %25 + OpStore %27 %19 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %17 %27 + %36 = OpSLessThan %35 %33 %34 + OpBranchConditional %36 %29 %30 + %29 = OpLabel + %37 = OpLoad %17 %27 + %39 = OpAccessChain %20 %16 %18 %38 + %40 = OpLoad %6 %39 + %42 = OpAccessChain %41 %11 %37 + OpStore %42 %40 + OpBranch %31 + %31 = OpLabel + %43 = OpLoad %17 %27 + %44 = OpIAdd %17 %43 %19 + OpStore %27 %44 + OpBranch %28 + %30 = OpLabel + OpStore %45 %18 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %17 %45 + %52 = OpSLessThan %35 %51 %34 + OpBranchConditional %52 %47 %48 + %47 = OpLabel + %53 = OpLoad %17 %45 + %54 = OpAccessChain %41 %11 %53 + %55 = OpLoad %6 %54 + %56 = OpAccessChain %20 %16 %18 %19 + %57 = OpLoad %6 %56 + %58 = OpFOrdLessThan %35 %55 %57 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %60 + %59 = OpLabel + %61 = OpLoad %17 %45 + %62 = OpAccessChain %20 %16 %18 %18 + %63 = OpLoad %6 %62 + %64 = OpAccessChain %41 %11 %61 + OpStore %64 %63 + OpBranch %48 + %60 = OpLabel + OpBranch %49 + %49 = OpLabel + %66 = OpLoad %17 %45 + %67 = OpIAdd %17 %66 %19 + OpStore %45 %67 + OpBranch %46 + %48 = OpLabel + %73 = OpAccessChain %72 %71 %18 %38 + %74 = OpLoad %17 %73 + %75 = OpAccessChain %41 %11 %74 + %76 = OpLoad %6 %75 + %77 = OpAccessChain %20 %16 %18 %19 + %78 = OpLoad %6 %77 + %79 = OpFOrdEqual %35 %76 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %80 %81 + %80 = OpLabel + %82 = OpAccessChain %72 %71 %18 %19 + %83 = OpLoad %17 %82 + %84 = OpAccessChain %41 %11 %83 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %20 %16 %18 %18 + %87 = OpLoad %6 %86 + %88 = OpFOrdEqual %35 %85 %87 + OpBranch %81 + %81 = OpLabel + %89 = OpPhi %35 %79 %48 %88 %80 + OpSelectionMerge %91 None + OpBranchConditional %89 %90 %91 + %90 = OpLabel + %92 = OpAccessChain %72 %71 %18 %18 + %93 = OpLoad %17 %92 + %94 = OpAccessChain %41 %11 %93 + %95 = OpLoad %6 %94 + %96 = OpAccessChain %20 %16 %18 %38 + %97 = OpLoad %6 %96 + %98 = OpFOrdEqual %35 %95 %97 + OpBranch %91 + %91 = OpLabel + %99 = OpPhi %35 %89 %81 %98 %90 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %118 + %100 = OpLabel + %105 = OpAccessChain %72 %71 %18 %19 + %106 = OpLoad %17 %105 + %107 = OpConvertSToF %6 %106 + %108 = OpAccessChain %72 %71 %18 %38 + %109 = OpLoad %17 %108 + %110 = OpConvertSToF %6 %109 + %111 = OpAccessChain %72 %71 %18 %38 + %112 = OpLoad %17 %111 + %113 = OpConvertSToF %6 %112 + %114 = OpAccessChain %72 %71 %18 %19 + %115 = OpLoad %17 %114 + %116 = OpConvertSToF %6 %115 + %117 = OpCompositeConstruct %102 %107 %110 %113 %116 + OpStore %104 %117 + OpBranch %101 + %118 = OpLabel + %119 = OpAccessChain %72 %71 %18 %38 + %120 = OpLoad %17 %119 + %121 = OpConvertSToF %6 %120 + %122 = OpCompositeConstruct %102 %121 %121 %121 %121 + OpStore %104 %122 + OpBranch %101 + %101 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 1.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-ssa-rewrite-case-with-default.amber b/vulkan/amber/graphicsfuzz/cov-ssa-rewrite-case-with-default.amber new file mode 100644 index 0000000..31eb2b1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-ssa-rewrite-case-with-default.amber @@ -0,0 +1,183 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific SSA rewrite path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# vec4 func() +# { +# // Always true. +# if(one == 1) +# return vec4(1, 0, 0, 1); +# else +# return vec4(0); +# } +# +# void main() +# { +# _GLF_color = vec4(0); +# for(int i = 0; i <= one; i++) +# { +# switch(i) +# { +# case 1: +# _GLF_color = func(); +# case 0: +# default: +# _GLF_color.y = 0.0; +# break; +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "func(" + OpName %12 "buf0" + OpMemberName %12 0 "one" + OpName %14 "" + OpName %33 "_GLF_color" + OpName %35 "i" + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeFunction %7 + %11 = OpTypeInt 32 1 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %11 0 + %16 = OpTypePointer Uniform %11 + %19 = OpConstant %11 1 + %20 = OpTypeBool + %24 = OpConstant %6 1 + %25 = OpConstant %6 0 + %26 = OpConstantComposite %7 %24 %25 %25 %24 + %29 = OpConstantComposite %7 %25 %25 %25 %25 + %32 = OpTypePointer Output %7 + %33 = OpVariable %32 Output + %34 = OpTypePointer Function %11 + %50 = OpTypeInt 32 0 + %51 = OpConstant %50 1 + %52 = OpTypePointer Output %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %35 = OpVariable %34 Function + OpStore %33 %29 + OpStore %35 %15 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %11 %35 + %42 = OpAccessChain %16 %14 %15 + %43 = OpLoad %11 %42 + %44 = OpSLessThanEqual %20 %41 %43 + OpBranchConditional %44 %37 %38 + %37 = OpLabel + %45 = OpLoad %11 %35 + OpSelectionMerge %48 None + OpSwitch %45 %47 1 %46 0 %47 + %47 = OpLabel + %53 = OpAccessChain %52 %33 %51 + OpStore %53 %25 + OpBranch %48 + %46 = OpLabel + %49 = OpFunctionCall %7 %9 + OpStore %33 %49 + OpBranch %47 + %48 = OpLabel + OpBranch %39 + %39 = OpLabel + %56 = OpLoad %11 %35 + %57 = OpIAdd %11 %56 %19 + OpStore %35 %57 + OpBranch %36 + %38 = OpLabel + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %17 = OpAccessChain %16 %14 %15 + %18 = OpLoad %11 %17 + %21 = OpIEqual %20 %18 %19 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %28 + %22 = OpLabel + OpReturnValue %26 + %28 = OpLabel + OpReturnValue %29 + %23 = OpLabel + OpUnreachable + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-step-sinh.amber b/vulkan/amber/graphicsfuzz/cov-step-sinh.amber new file mode 100644 index 0000000..65a67f9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-step-sinh.amber @@ -0,0 +1,114 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific APFloat code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# +# precision highp int; +# +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 v1 = vec2(1.0, -1.0); +# +# // v2 becomes [1.0, 0.0]. +# vec2 v2 = step(0.4, sinh(v1)); +# _GLF_color = vec4(v2.x, v2.y, v2.y, v2.x); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %21 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v1" + OpName %13 "v2" + OpName %21 "_GLF_color" + OpDecorate %21 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstant %6 -1 + %12 = OpConstantComposite %7 %10 %11 + %14 = OpConstant %6 0.400000006 + %19 = OpTypeVector %6 4 + %20 = OpTypePointer Output %19 + %21 = OpVariable %20 Output + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 0 + %24 = OpTypePointer Function %6 + %27 = OpConstant %22 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %13 = OpVariable %8 Function + OpStore %9 %12 + %15 = OpLoad %7 %9 + %16 = OpExtInst %7 %1 Sinh %15 + %17 = OpCompositeConstruct %7 %14 %14 + %18 = OpExtInst %7 %1 Step %17 %16 + OpStore %13 %18 + %25 = OpAccessChain %24 %13 %23 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %24 %13 %27 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %24 %13 %27 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %24 %13 %23 + %33 = OpLoad %6 %32 + %34 = OpCompositeConstruct %19 %26 %29 %31 %33 + OpStore %21 %34 + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-struct-array-ivec-negative-modulus-empty-function.amber b/vulkan/amber/graphicsfuzz/cov-struct-array-ivec-negative-modulus-empty-function.amber new file mode 100644 index 0000000..ea1238f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-struct-array-ivec-negative-modulus-empty-function.amber @@ -0,0 +1,302 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_2 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 2, 1, 3] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# struct S +# { +# int data; +# }; +# +# void func(inout S s) +# { +# } +# +# void main() +# { +# S arr[10] = S[10](S(_int_1), S(_int_1), S(_int_1), S(_int_1), S(_int_1), S(_int_1), S(_int_1), S(_int_1), S(_int_1), S(_int_1)); +# int a = _int_0; +# // a becomes 1. +# a = arr[a].data; +# +# // Always false. +# if (gl_FragCoord.x < 0.0) +# { +# // Negative modulus is undefined, but this is never executed. +# ivec2 v = (ivec2(_int_3) & a) % (-1); +# +# do +# { +# a++; +# } +# while(v.y != _int_0); +# } +# +# // Does nothing. +# func(arr[_int_1]); +# +# // Always true. +# if(a == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 137 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %67 %118 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "S" + OpMemberName %7 0 "data" + OpName %11 "func(struct-S-i11;" + OpName %10 "s" + OpName %17 "arr" + OpName %20 "buf0" + OpMemberName %20 0 "_GLF_uniform_int_values" + OpName %22 "" + OpName %58 "a" + OpName %67 "gl_FragCoord" + OpName %79 "v" + OpName %105 "param" + OpName %118 "_GLF_color" + OpDecorate %19 ArrayStride 16 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpDecorate %67 BuiltIn FragCoord + OpDecorate %118 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %2 %8 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 10 + %15 = OpTypeArray %7 %14 + %16 = OpTypePointer Function %15 + %18 = OpConstant %13 4 + %19 = OpTypeArray %6 %18 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpConstant %6 0 + %24 = OpConstant %6 2 + %25 = OpTypePointer Uniform %6 + %57 = OpTypePointer Function %6 + %64 = OpTypeFloat 32 + %65 = OpTypeVector %64 4 + %66 = OpTypePointer Input %65 + %67 = OpVariable %66 Input + %68 = OpConstant %13 0 + %69 = OpTypePointer Input %64 + %72 = OpConstant %64 0 + %73 = OpTypeBool + %77 = OpTypeVector %6 2 + %78 = OpTypePointer Function %77 + %80 = OpConstant %6 3 + %87 = OpConstant %6 -1 + %95 = OpConstant %6 1 + %97 = OpConstant %13 1 + %117 = OpTypePointer Output %65 + %118 = OpVariable %117 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %17 = OpVariable %16 Function + %58 = OpVariable %57 Function + %79 = OpVariable %78 Function + %105 = OpVariable %8 Function + %26 = OpAccessChain %25 %22 %23 %24 + %27 = OpLoad %6 %26 + %28 = OpCompositeConstruct %7 %27 + %29 = OpAccessChain %25 %22 %23 %24 + %30 = OpLoad %6 %29 + %31 = OpCompositeConstruct %7 %30 + %32 = OpAccessChain %25 %22 %23 %24 + %33 = OpLoad %6 %32 + %34 = OpCompositeConstruct %7 %33 + %35 = OpAccessChain %25 %22 %23 %24 + %36 = OpLoad %6 %35 + %37 = OpCompositeConstruct %7 %36 + %38 = OpAccessChain %25 %22 %23 %24 + %39 = OpLoad %6 %38 + %40 = OpCompositeConstruct %7 %39 + %41 = OpAccessChain %25 %22 %23 %24 + %42 = OpLoad %6 %41 + %43 = OpCompositeConstruct %7 %42 + %44 = OpAccessChain %25 %22 %23 %24 + %45 = OpLoad %6 %44 + %46 = OpCompositeConstruct %7 %45 + %47 = OpAccessChain %25 %22 %23 %24 + %48 = OpLoad %6 %47 + %49 = OpCompositeConstruct %7 %48 + %50 = OpAccessChain %25 %22 %23 %24 + %51 = OpLoad %6 %50 + %52 = OpCompositeConstruct %7 %51 + %53 = OpAccessChain %25 %22 %23 %24 + %54 = OpLoad %6 %53 + %55 = OpCompositeConstruct %7 %54 + %56 = OpCompositeConstruct %15 %28 %31 %34 %37 %40 %43 %46 %49 %52 %55 + OpStore %17 %56 + %59 = OpAccessChain %25 %22 %23 %23 + %60 = OpLoad %6 %59 + OpStore %58 %60 + %61 = OpLoad %6 %58 + %62 = OpAccessChain %57 %17 %61 %23 + %63 = OpLoad %6 %62 + OpStore %58 %63 + %70 = OpAccessChain %69 %67 %68 + %71 = OpLoad %64 %70 + %74 = OpFOrdLessThan %73 %71 %72 + OpSelectionMerge %76 None + OpBranchConditional %74 %75 %76 + %75 = OpLabel + %81 = OpAccessChain %25 %22 %23 %80 + %82 = OpLoad %6 %81 + %83 = OpCompositeConstruct %77 %82 %82 + %84 = OpLoad %6 %58 + %85 = OpCompositeConstruct %77 %84 %84 + %86 = OpBitwiseAnd %77 %83 %85 + %88 = OpCompositeConstruct %77 %87 %87 + %89 = OpSMod %77 %86 %88 + OpStore %79 %89 + OpBranch %90 + %90 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %91 + %91 = OpLabel + %94 = OpLoad %6 %58 + %96 = OpIAdd %6 %94 %95 + OpStore %58 %96 + OpBranch %93 + %93 = OpLabel + %98 = OpAccessChain %57 %79 %97 + %99 = OpLoad %6 %98 + %100 = OpAccessChain %25 %22 %23 %23 + %101 = OpLoad %6 %100 + %102 = OpINotEqual %73 %99 %101 + OpBranchConditional %102 %90 %92 + %92 = OpLabel + OpBranch %76 + %76 = OpLabel + %103 = OpAccessChain %25 %22 %23 %24 + %104 = OpLoad %6 %103 + %106 = OpAccessChain %8 %17 %104 + %107 = OpLoad %7 %106 + OpStore %105 %107 + %108 = OpFunctionCall %2 %11 %105 + %109 = OpLoad %7 %105 + %110 = OpAccessChain %8 %17 %104 + OpStore %110 %109 + %111 = OpLoad %6 %58 + %112 = OpAccessChain %25 %22 %23 %24 + %113 = OpLoad %6 %112 + %114 = OpIEqual %73 %111 %113 + OpSelectionMerge %116 None + OpBranchConditional %114 %115 %132 + %115 = OpLabel + %119 = OpAccessChain %25 %22 %23 %24 + %120 = OpLoad %6 %119 + %121 = OpConvertSToF %64 %120 + %122 = OpAccessChain %25 %22 %23 %23 + %123 = OpLoad %6 %122 + %124 = OpConvertSToF %64 %123 + %125 = OpAccessChain %25 %22 %23 %23 + %126 = OpLoad %6 %125 + %127 = OpConvertSToF %64 %126 + %128 = OpAccessChain %25 %22 %23 %24 + %129 = OpLoad %6 %128 + %130 = OpConvertSToF %64 %129 + %131 = OpCompositeConstruct %65 %121 %124 %127 %130 + OpStore %118 %131 + OpBranch %116 + %132 = OpLabel + %133 = OpAccessChain %25 %22 %23 %23 + %134 = OpLoad %6 %133 + %135 = OpConvertSToF %64 %134 + %136 = OpCompositeConstruct %65 %135 %135 %135 %135 + OpStore %118 %136 + OpBranch %116 + %116 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %9 + %10 = OpFunctionParameter %8 + %12 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 2 1 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors.amber b/vulkan/amber/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors.amber new file mode 100644 index 0000000..64702c3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors.amber @@ -0,0 +1,304 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_0_01 _GLF_uniform_float_values[1] +# #define _float_0_2 _GLF_uniform_float_values[2] +# #define _float_0_1 _GLF_uniform_float_values[3] +# #define _float_0_3 _GLF_uniform_float_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# // Contents of _GLF_uniform_float_values: [0.0, 0.01, 0.2, 0.1, 0.3] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[5]; +# }; +# // Contents of zeroVec: [0.0, 0.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# vec2 zeroVec; +# }; +# // Contents of oneVec: [1.0, 1.0] +# layout(set = 0, binding = 3) uniform buf3 +# { +# vec2 oneVec; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# struct S +# { +# float numbers[3]; +# }; +# +# void main() +# { +# S obj = S(float[3](_float_0_1, _float_0_2, _float_0_3)); +# // obj becomes [0.0, 0.2, 0.3]. +# obj.numbers[int(zeroVec.x)] = _float_0_0; +# // a becomes 1.0. +# float a = ((zeroVec.x > _float_0_0) ? zeroVec : oneVec).y; +# // b becomes 0.2. +# float b = mix(_float_0_0, a, obj.numbers[_int_1]); +# +# // Always true. +# if(distance(b, _float_0_2) < _float_0_01) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 113 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %94 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "S" + OpMemberName %10 0 "numbers" + OpName %12 "obj" + OpName %15 "buf1" + OpMemberName %15 0 "_GLF_uniform_float_values" + OpName %17 "" + OpName %33 "buf2" + OpMemberName %33 0 "zeroVec" + OpName %35 "" + OpName %44 "a" + OpName %59 "buf3" + OpMemberName %59 0 "oneVec" + OpName %61 "" + OpName %67 "b" + OpName %73 "buf0" + OpMemberName %73 0 "_GLF_uniform_int_values" + OpName %75 "" + OpName %94 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 1 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 2 + OpMemberDecorate %59 0 Offset 0 + OpDecorate %59 Block + OpDecorate %61 DescriptorSet 0 + OpDecorate %61 Binding 3 + OpDecorate %72 ArrayStride 16 + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %94 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 3 + %9 = OpTypeArray %6 %8 + %10 = OpTypeStruct %9 + %11 = OpTypePointer Function %10 + %13 = OpConstant %7 5 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpConstant %18 3 + %21 = OpTypePointer Uniform %6 + %24 = OpConstant %18 2 + %27 = OpConstant %18 4 + %32 = OpTypeVector %6 2 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpConstant %7 0 + %42 = OpTypePointer Function %6 + %49 = OpTypeBool + %51 = OpTypePointer Function %32 + %55 = OpTypePointer Uniform %32 + %59 = OpTypeStruct %32 + %60 = OpTypePointer Uniform %59 + %61 = OpVariable %60 Uniform + %64 = OpConstant %7 1 + %71 = OpConstant %7 2 + %72 = OpTypeArray %18 %71 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypePointer Uniform %18 + %86 = OpConstant %18 1 + %92 = OpTypeVector %6 4 + %93 = OpTypePointer Output %92 + %94 = OpVariable %93 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpVariable %11 Function + %44 = OpVariable %42 Function + %52 = OpVariable %51 Function + %67 = OpVariable %42 Function + %22 = OpAccessChain %21 %17 %19 %20 + %23 = OpLoad %6 %22 + %25 = OpAccessChain %21 %17 %19 %24 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %21 %17 %19 %27 + %29 = OpLoad %6 %28 + %30 = OpCompositeConstruct %9 %23 %26 %29 + %31 = OpCompositeConstruct %10 %30 + OpStore %12 %31 + %37 = OpAccessChain %21 %35 %19 %36 + %38 = OpLoad %6 %37 + %39 = OpConvertFToS %18 %38 + %40 = OpAccessChain %21 %17 %19 %19 + %41 = OpLoad %6 %40 + %43 = OpAccessChain %42 %12 %19 %39 + OpStore %43 %41 + %45 = OpAccessChain %21 %35 %19 %36 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %21 %17 %19 %19 + %48 = OpLoad %6 %47 + %50 = OpFOrdGreaterThan %49 %46 %48 + OpSelectionMerge %54 None + OpBranchConditional %50 %53 %58 + %53 = OpLabel + %56 = OpAccessChain %55 %35 %19 + %57 = OpLoad %32 %56 + OpStore %52 %57 + OpBranch %54 + %58 = OpLabel + %62 = OpAccessChain %55 %61 %19 + %63 = OpLoad %32 %62 + OpStore %52 %63 + OpBranch %54 + %54 = OpLabel + %65 = OpAccessChain %42 %52 %64 + %66 = OpLoad %6 %65 + OpStore %44 %66 + %68 = OpAccessChain %21 %17 %19 %19 + %69 = OpLoad %6 %68 + %70 = OpLoad %6 %44 + %77 = OpAccessChain %76 %75 %19 %19 + %78 = OpLoad %18 %77 + %79 = OpAccessChain %42 %12 %19 %78 + %80 = OpLoad %6 %79 + %81 = OpExtInst %6 %1 FMix %69 %70 %80 + OpStore %67 %81 + %82 = OpLoad %6 %67 + %83 = OpAccessChain %21 %17 %19 %24 + %84 = OpLoad %6 %83 + %85 = OpExtInst %6 %1 Distance %82 %84 + %87 = OpAccessChain %21 %17 %19 %86 + %88 = OpLoad %6 %87 + %89 = OpFOrdLessThan %49 %85 %88 + OpSelectionMerge %91 None + OpBranchConditional %89 %90 %108 + %90 = OpLabel + %95 = OpAccessChain %76 %75 %19 %19 + %96 = OpLoad %18 %95 + %97 = OpConvertSToF %6 %96 + %98 = OpAccessChain %76 %75 %19 %86 + %99 = OpLoad %18 %98 + %100 = OpConvertSToF %6 %99 + %101 = OpAccessChain %76 %75 %19 %86 + %102 = OpLoad %18 %101 + %103 = OpConvertSToF %6 %102 + %104 = OpAccessChain %76 %75 %19 %19 + %105 = OpLoad %18 %104 + %106 = OpConvertSToF %6 %105 + %107 = OpCompositeConstruct %92 %97 %100 %103 %106 + OpStore %94 %107 + OpBranch %91 + %108 = OpLabel + %109 = OpAccessChain %76 %75 %19 %86 + %110 = OpLoad %18 %109 + %111 = OpConvertSToF %6 %110 + %112 = OpCompositeConstruct %92 %111 %111 %111 %111 + OpStore %94 %112 + OpBranch %91 + %91 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zeroVec +BUFFER variant_zeroVec DATA_TYPE vec2 STD140 DATA + 0.0 0.0 +END +# oneVec +BUFFER variant_oneVec DATA_TYPE vec2 STD140 DATA + 1.0 1.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 0.01 0.2 0.1 0.3 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zeroVec AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant_oneVec AS uniform DESCRIPTOR_SET 0 BINDING 3 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-struct-int-array-select-uniform-ivec.amber b/vulkan/amber/graphicsfuzz/cov-struct-int-array-select-uniform-ivec.amber new file mode 100644 index 0000000..f8b8d0f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-struct-int-array-select-uniform-ivec.amber @@ -0,0 +1,305 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [2, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of v0: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# ivec2 v0; +# }; +# +# // Contents of v1: [2, 3] +# layout(set = 0, binding = 2) uniform buf2 +# { +# ivec2 v1; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S +# { +# int arr[10]; +# }; +# +# void main() +# { +# S obj = S(int[10](_int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0)); +# +# // Sets obj.arr[0..1] to 2. +# for(int i = v0.x; i < _int_2; i++) +# { +# obj.arr[i] = _int_2; +# } +# +# // a = 2 * 1 = 2. +# int a = obj.arr[_int_1] * (v0.x < _int_1 ? v0 : v1).y; +# +# // Always true. +# if(a == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 124 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %105 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "S" + OpMemberName %10 0 "arr" + OpName %12 "obj" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %44 "i" + OpName %46 "buf1" + OpMemberName %46 0 "v0" + OpName %48 "" + OpName %69 "a" + OpName %87 "buf2" + OpMemberName %87 0 "v1" + OpName %89 "" + OpName %105 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpMemberDecorate %46 0 Offset 0 + OpDecorate %46 Block + OpDecorate %48 DescriptorSet 0 + OpDecorate %48 Binding 1 + OpMemberDecorate %87 0 Offset 0 + OpDecorate %87 Block + OpDecorate %89 DescriptorSet 0 + OpDecorate %89 Binding 2 + OpDecorate %105 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypeStruct %9 + %11 = OpTypePointer Function %10 + %13 = OpConstant %7 3 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 0 + %19 = OpConstant %6 2 + %20 = OpTypePointer Uniform %6 + %43 = OpTypePointer Function %6 + %45 = OpTypeVector %6 2 + %46 = OpTypeStruct %45 + %47 = OpTypePointer Uniform %46 + %48 = OpVariable %47 Uniform + %49 = OpConstant %7 0 + %60 = OpTypeBool + %67 = OpConstant %6 1 + %79 = OpTypePointer Function %45 + %83 = OpTypePointer Uniform %45 + %87 = OpTypeStruct %45 + %88 = OpTypePointer Uniform %87 + %89 = OpVariable %88 Uniform + %92 = OpConstant %7 1 + %102 = OpTypeFloat 32 + %103 = OpTypeVector %102 4 + %104 = OpTypePointer Output %103 + %105 = OpVariable %104 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpVariable %11 Function + %44 = OpVariable %43 Function + %69 = OpVariable %43 Function + %80 = OpVariable %79 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %6 %21 + %23 = OpAccessChain %20 %17 %18 %19 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %20 %17 %18 %19 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %20 %17 %18 %19 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %20 %17 %18 %19 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %20 %17 %18 %19 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %20 %17 %18 %19 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %20 %17 %18 %19 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %20 %17 %18 %19 + %38 = OpLoad %6 %37 + %39 = OpAccessChain %20 %17 %18 %19 + %40 = OpLoad %6 %39 + %41 = OpCompositeConstruct %9 %22 %24 %26 %28 %30 %32 %34 %36 %38 %40 + %42 = OpCompositeConstruct %10 %41 + OpStore %12 %42 + %50 = OpAccessChain %20 %48 %18 %49 + %51 = OpLoad %6 %50 + OpStore %44 %51 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %6 %44 + %58 = OpAccessChain %20 %17 %18 %18 + %59 = OpLoad %6 %58 + %61 = OpSLessThan %60 %57 %59 + OpBranchConditional %61 %53 %54 + %53 = OpLabel + %62 = OpLoad %6 %44 + %63 = OpAccessChain %20 %17 %18 %18 + %64 = OpLoad %6 %63 + %65 = OpAccessChain %43 %12 %18 %62 + OpStore %65 %64 + OpBranch %55 + %55 = OpLabel + %66 = OpLoad %6 %44 + %68 = OpIAdd %6 %66 %67 + OpStore %44 %68 + OpBranch %52 + %54 = OpLabel + %70 = OpAccessChain %20 %17 %18 %67 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %43 %12 %18 %71 + %73 = OpLoad %6 %72 + %74 = OpAccessChain %20 %48 %18 %49 + %75 = OpLoad %6 %74 + %76 = OpAccessChain %20 %17 %18 %67 + %77 = OpLoad %6 %76 + %78 = OpSLessThan %60 %75 %77 + OpSelectionMerge %82 None + OpBranchConditional %78 %81 %86 + %81 = OpLabel + %84 = OpAccessChain %83 %48 %18 + %85 = OpLoad %45 %84 + OpStore %80 %85 + OpBranch %82 + %86 = OpLabel + %90 = OpAccessChain %83 %89 %18 + %91 = OpLoad %45 %90 + OpStore %80 %91 + OpBranch %82 + %82 = OpLabel + %93 = OpAccessChain %43 %80 %92 + %94 = OpLoad %6 %93 + %95 = OpIMul %6 %73 %94 + OpStore %69 %95 + %96 = OpLoad %6 %69 + %97 = OpAccessChain %20 %17 %18 %18 + %98 = OpLoad %6 %97 + %99 = OpIEqual %60 %96 %98 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %119 + %100 = OpLabel + %106 = OpAccessChain %20 %17 %18 %67 + %107 = OpLoad %6 %106 + %108 = OpConvertSToF %102 %107 + %109 = OpAccessChain %20 %17 %18 %19 + %110 = OpLoad %6 %109 + %111 = OpConvertSToF %102 %110 + %112 = OpAccessChain %20 %17 %18 %19 + %113 = OpLoad %6 %112 + %114 = OpConvertSToF %102 %113 + %115 = OpAccessChain %20 %17 %18 %67 + %116 = OpLoad %6 %115 + %117 = OpConvertSToF %102 %116 + %118 = OpCompositeConstruct %103 %108 %111 %114 %117 + OpStore %105 %118 + OpBranch %101 + %119 = OpLabel + %120 = OpAccessChain %20 %17 %18 %19 + %121 = OpLoad %6 %120 + %122 = OpConvertSToF %102 %121 + %123 = OpCompositeConstruct %103 %122 %122 %122 %122 + OpStore %105 %123 + OpBranch %101 + %101 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# v0 +BUFFER variant_v0 DATA_TYPE vec2 STD140 DATA + 0 1 +END +# v1 +BUFFER variant_v1 DATA_TYPE vec2 STD140 DATA + 2 3 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_v0 AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant_v1 AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-sum-uniform-vector-components-round.amber b/vulkan/amber/graphicsfuzz/cov-sum-uniform-vector-components-round.amber new file mode 100644 index 0000000..f66a247 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-sum-uniform-vector-components-round.amber @@ -0,0 +1,225 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1540_7 _GLF_uniform_float_values[0] +# #define _float_2_0 _GLF_uniform_float_values[1] +# #define _float_3_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1540.7, 2.0, 3.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# // Contents of resolution: [256.6, 256.5] +# layout(set = 0, binding = 2) uniform buf2 +# { +# vec2 resolution; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = _float_2_0 * resolution.x + _float_3_0 * round(resolution.x) + resolution.y; +# +# // Always true. +# if(f == _float_1540_7) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %50 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %22 "buf2" + OpMemberName %22 0 "resolution" + OpName %24 "" + OpName %50 "_GLF_color" + OpName %53 "buf0" + OpMemberName %53 0 "_GLF_uniform_int_values" + OpName %55 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 2 + OpDecorate %50 Location 0 + OpDecorate %52 ArrayStride 16 + OpMemberDecorate %53 0 Offset 0 + OpDecorate %53 Block + OpDecorate %55 DescriptorSet 0 + OpDecorate %55 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 1 + %18 = OpTypePointer Uniform %6 + %21 = OpTypeVector %6 2 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpConstant %9 0 + %29 = OpConstant %15 2 + %37 = OpConstant %9 1 + %44 = OpTypeBool + %48 = OpTypeVector %6 4 + %49 = OpTypePointer Output %48 + %50 = OpVariable %49 Output + %51 = OpConstant %9 2 + %52 = OpTypeArray %15 %51 + %53 = OpTypeStruct %52 + %54 = OpTypePointer Uniform %53 + %55 = OpVariable %54 Uniform + %56 = OpTypePointer Uniform %15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %6 %19 + %26 = OpAccessChain %18 %24 %16 %25 + %27 = OpLoad %6 %26 + %28 = OpFMul %6 %20 %27 + %30 = OpAccessChain %18 %14 %16 %29 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %18 %24 %16 %25 + %33 = OpLoad %6 %32 + %34 = OpExtInst %6 %1 Round %33 + %35 = OpFMul %6 %31 %34 + %36 = OpFAdd %6 %28 %35 + %38 = OpAccessChain %18 %24 %16 %37 + %39 = OpLoad %6 %38 + %40 = OpFAdd %6 %36 %39 + OpStore %8 %40 + %41 = OpLoad %6 %8 + %42 = OpAccessChain %18 %14 %16 %16 + %43 = OpLoad %6 %42 + %45 = OpFOrdEqual %44 %41 %43 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %70 + %46 = OpLabel + %57 = OpAccessChain %56 %55 %16 %16 + %58 = OpLoad %15 %57 + %59 = OpConvertSToF %6 %58 + %60 = OpAccessChain %56 %55 %16 %17 + %61 = OpLoad %15 %60 + %62 = OpConvertSToF %6 %61 + %63 = OpAccessChain %56 %55 %16 %17 + %64 = OpLoad %15 %63 + %65 = OpConvertSToF %6 %64 + %66 = OpAccessChain %56 %55 %16 %16 + %67 = OpLoad %15 %66 + %68 = OpConvertSToF %6 %67 + %69 = OpCompositeConstruct %48 %59 %62 %65 %68 + OpStore %50 %69 + OpBranch %47 + %70 = OpLabel + %71 = OpAccessChain %56 %55 %16 %17 + %72 = OpLoad %15 %71 + %73 = OpConvertSToF %6 %72 + %74 = OpCompositeConstruct %48 %73 %73 %73 %73 + OpStore %50 %74 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.6 256.5 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1540.7 2.0 3.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-switch-fallthrough-variable-from-first-case.amber b/vulkan/amber/graphicsfuzz/cov-switch-fallthrough-variable-from-first-case.amber new file mode 100644 index 0000000..6122994 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-switch-fallthrough-variable-from-first-case.amber @@ -0,0 +1,412 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of zero: 0 +# layout(push_constant) uniform buf_push +# { +# int zero; +# }; +# +# struct S +# { +# float arr[10]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# int m = _int_0; +# +# for( m = _int_1; _GLF_global_loop_count < _GLF_global_loop_bound; m = _int_2) +# { +# _GLF_global_loop_count++; +# +# switch(zero) +# { +# case 0: +# S s0 = S(float[10](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0)); +# +# // Always true. +# if(s0.arr[m] > _float_0_0) +# { +# m = _int_1; +# } +# +# int a = _int_0; +# // Fallthrough +# case 1: +# // a would be undefined if zero == 1, but case 0 gets always executed. +# while (a > _int_0 && _GLF_global_loop_count < _GLF_global_loop_bound) +# { +# // Never executed. +# _GLF_global_loop_count ++; +# } +# +# S s1 = S(float[10](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0)); +# +# // Always true. +# if(s1.arr[m] > _float_0_0) +# { +# a = _int_1; +# } +# } +# } +# +# // The loop sets m = 2 after each iteration so this function +# // always returns 2 regardless of how many times the loop was run. +# return m; +# } +# +# void main() +# { +# // Always true. +# if(func() == _int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 176 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %157 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "_GLF_global_loop_count" + OpName %14 "m" + OpName %18 "buf0" + OpMemberName %18 0 "_GLF_uniform_int_values" + OpName %20 "" + OpName %38 "buf_push" + OpMemberName %38 0 "zero" + OpName %40 "" + OpName %50 "S" + OpMemberName %50 0 "arr" + OpName %52 "s0" + OpName %55 "buf1" + OpMemberName %55 0 "_GLF_uniform_float_values" + OpName %57 "" + OpName %92 "a" + OpName %109 "s1" + OpName %157 "_GLF_color" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %54 ArrayStride 16 + OpMemberDecorate %55 0 Offset 0 + OpDecorate %55 Block + OpDecorate %57 DescriptorSet 0 + OpDecorate %57 Binding 1 + OpDecorate %157 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Private %6 + %11 = OpVariable %10 Private + %12 = OpConstant %6 0 + %13 = OpTypePointer Function %6 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 3 + %17 = OpTypeArray %6 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpConstant %6 1 + %22 = OpTypePointer Uniform %6 + %33 = OpConstant %6 10 + %34 = OpTypeBool + %38 = OpTypeStruct %6 + %39 = OpTypePointer PushConstant %38 + %40 = OpVariable %39 PushConstant + %41 = OpTypePointer PushConstant %6 + %47 = OpTypeFloat 32 + %48 = OpConstant %15 10 + %49 = OpTypeArray %47 %48 + %50 = OpTypeStruct %49 + %51 = OpTypePointer Function %50 + %53 = OpConstant %15 2 + %54 = OpTypeArray %47 %53 + %55 = OpTypeStruct %54 + %56 = OpTypePointer Uniform %55 + %57 = OpVariable %56 Uniform + %58 = OpTypePointer Uniform %47 + %82 = OpTypePointer Function %47 + %143 = OpConstant %6 2 + %155 = OpTypeVector %47 4 + %156 = OpTypePointer Output %155 + %157 = OpVariable %156 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %11 %12 + %149 = OpFunctionCall %6 %8 + %150 = OpAccessChain %22 %20 %12 %143 + %151 = OpLoad %6 %150 + %152 = OpIEqual %34 %149 %151 + OpSelectionMerge %154 None + OpBranchConditional %152 %153 %171 + %153 = OpLabel + %158 = OpAccessChain %22 %20 %12 %12 + %159 = OpLoad %6 %158 + %160 = OpConvertSToF %47 %159 + %161 = OpAccessChain %22 %20 %12 %21 + %162 = OpLoad %6 %161 + %163 = OpConvertSToF %47 %162 + %164 = OpAccessChain %22 %20 %12 %21 + %165 = OpLoad %6 %164 + %166 = OpConvertSToF %47 %165 + %167 = OpAccessChain %22 %20 %12 %12 + %168 = OpLoad %6 %167 + %169 = OpConvertSToF %47 %168 + %170 = OpCompositeConstruct %155 %160 %163 %166 %169 + OpStore %157 %170 + OpBranch %154 + %171 = OpLabel + %172 = OpAccessChain %22 %20 %12 %21 + %173 = OpLoad %6 %172 + %174 = OpConvertSToF %47 %173 + %175 = OpCompositeConstruct %155 %174 %174 %174 %174 + OpStore %157 %175 + OpBranch %154 + %154 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %14 = OpVariable %13 Function + %52 = OpVariable %51 Function + %92 = OpVariable %13 Function + %109 = OpVariable %51 Function + %23 = OpAccessChain %22 %20 %12 %21 + %24 = OpLoad %6 %23 + OpStore %14 %24 + %25 = OpAccessChain %22 %20 %12 %12 + %26 = OpLoad %6 %25 + OpStore %14 %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %6 %11 + %35 = OpSLessThan %34 %32 %33 + OpBranchConditional %35 %28 %29 + %28 = OpLabel + %36 = OpLoad %6 %11 + %37 = OpIAdd %6 %36 %21 + OpStore %11 %37 + %42 = OpAccessChain %41 %40 %12 + %43 = OpLoad %6 %42 + OpSelectionMerge %46 None + OpSwitch %43 %46 0 %44 1 %45 + %44 = OpLabel + %59 = OpAccessChain %58 %57 %12 %12 + %60 = OpLoad %47 %59 + %61 = OpAccessChain %58 %57 %12 %12 + %62 = OpLoad %47 %61 + %63 = OpAccessChain %58 %57 %12 %12 + %64 = OpLoad %47 %63 + %65 = OpAccessChain %58 %57 %12 %12 + %66 = OpLoad %47 %65 + %67 = OpAccessChain %58 %57 %12 %12 + %68 = OpLoad %47 %67 + %69 = OpAccessChain %58 %57 %12 %12 + %70 = OpLoad %47 %69 + %71 = OpAccessChain %58 %57 %12 %12 + %72 = OpLoad %47 %71 + %73 = OpAccessChain %58 %57 %12 %12 + %74 = OpLoad %47 %73 + %75 = OpAccessChain %58 %57 %12 %12 + %76 = OpLoad %47 %75 + %77 = OpAccessChain %58 %57 %12 %12 + %78 = OpLoad %47 %77 + %79 = OpCompositeConstruct %49 %60 %62 %64 %66 %68 %70 %72 %74 %76 %78 + %80 = OpCompositeConstruct %50 %79 + OpStore %52 %80 + %81 = OpLoad %6 %14 + %83 = OpAccessChain %82 %52 %12 %81 + %84 = OpLoad %47 %83 + %85 = OpAccessChain %58 %57 %12 %21 + %86 = OpLoad %47 %85 + %87 = OpFOrdGreaterThan %34 %84 %86 + OpSelectionMerge %89 None + OpBranchConditional %87 %88 %89 + %88 = OpLabel + %90 = OpAccessChain %22 %20 %12 %12 + %91 = OpLoad %6 %90 + OpStore %14 %91 + OpBranch %89 + %89 = OpLabel + %93 = OpAccessChain %22 %20 %12 %21 + %94 = OpLoad %6 %93 + OpStore %92 %94 + OpBranch %45 + %45 = OpLabel + OpBranch %95 + %95 = OpLabel + OpLoopMerge %97 %98 None + OpBranch %99 + %99 = OpLabel + %100 = OpLoad %6 %92 + %101 = OpAccessChain %22 %20 %12 %21 + %102 = OpLoad %6 %101 + %103 = OpSGreaterThan %34 %100 %102 + %104 = OpLoad %6 %11 + %105 = OpSLessThan %34 %104 %33 + %106 = OpLogicalAnd %34 %103 %105 + OpBranchConditional %106 %96 %97 + %96 = OpLabel + %107 = OpLoad %6 %11 + %108 = OpIAdd %6 %107 %21 + OpStore %11 %108 + OpBranch %98 + %98 = OpLabel + OpBranch %95 + %97 = OpLabel + %110 = OpAccessChain %58 %57 %12 %12 + %111 = OpLoad %47 %110 + %112 = OpAccessChain %58 %57 %12 %12 + %113 = OpLoad %47 %112 + %114 = OpAccessChain %58 %57 %12 %12 + %115 = OpLoad %47 %114 + %116 = OpAccessChain %58 %57 %12 %12 + %117 = OpLoad %47 %116 + %118 = OpAccessChain %58 %57 %12 %12 + %119 = OpLoad %47 %118 + %120 = OpAccessChain %58 %57 %12 %12 + %121 = OpLoad %47 %120 + %122 = OpAccessChain %58 %57 %12 %12 + %123 = OpLoad %47 %122 + %124 = OpAccessChain %58 %57 %12 %12 + %125 = OpLoad %47 %124 + %126 = OpAccessChain %58 %57 %12 %12 + %127 = OpLoad %47 %126 + %128 = OpAccessChain %58 %57 %12 %12 + %129 = OpLoad %47 %128 + %130 = OpCompositeConstruct %49 %111 %113 %115 %117 %119 %121 %123 %125 %127 %129 + %131 = OpCompositeConstruct %50 %130 + OpStore %109 %131 + %132 = OpLoad %6 %14 + %133 = OpAccessChain %82 %109 %12 %132 + %134 = OpLoad %47 %133 + %135 = OpAccessChain %58 %57 %12 %21 + %136 = OpLoad %47 %135 + %137 = OpFOrdGreaterThan %34 %134 %136 + OpSelectionMerge %139 None + OpBranchConditional %137 %138 %139 + %138 = OpLabel + %140 = OpAccessChain %22 %20 %12 %12 + %141 = OpLoad %6 %140 + OpStore %92 %141 + OpBranch %139 + %139 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %30 + %30 = OpLabel + %144 = OpAccessChain %22 %20 %12 %143 + %145 = OpLoad %6 %144 + OpStore %14 %145 + OpBranch %27 + %29 = OpLabel + %146 = OpLoad %6 %14 + OpReturnValue %146 + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 STD140 DATA + 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS push_constant + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-tail-duplicator-for-for-for.amber b/vulkan/amber/graphicsfuzz/cov-tail-duplicator-for-for-for.amber new file mode 100644 index 0000000..66614f2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-tail-duplicator-for-for-for.amber @@ -0,0 +1,265 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific tail duplicator code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_4 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: 0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 color = vec4(1.0); +# +# for (int i = _int_0; i < _int_4; i++) +# { +# switch (i) +# { +# case 1: +# // Never entered. +# for (int j = _int_0; i > i; j++) +# { +# for (int k = _int_0; k < i; k++) +# { +# color[k] = _float_0_0; +# } +# } +# +# color[i] = _float_0_0; +# break; +# +# case 2: +# color[i] = _float_0_0; +# break; +# } +# } +# +# _GLF_color = color; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 93 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %91 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "color" + OpName %14 "i" + OpName %18 "buf0" + OpMemberName %18 0 "_GLF_uniform_int_values" + OpName %20 "" + OpName %40 "j" + OpName %51 "k" + OpName %65 "buf1" + OpMemberName %65 0 "_GLF_uniform_float_values" + OpName %67 "" + OpName %91 "_GLF_color" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %64 ArrayStride 16 + OpMemberDecorate %65 0 Offset 0 + OpDecorate %65 Block + OpDecorate %67 DescriptorSet 0 + OpDecorate %67 Binding 1 + OpDecorate %91 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypeInt 32 1 + %13 = OpTypePointer Function %12 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 2 + %17 = OpTypeArray %12 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpConstant %12 0 + %22 = OpTypePointer Uniform %12 + %31 = OpConstant %12 1 + %34 = OpTypeBool + %63 = OpConstant %15 1 + %64 = OpTypeArray %6 %63 + %65 = OpTypeStruct %64 + %66 = OpTypePointer Uniform %65 + %67 = OpVariable %66 Uniform + %68 = OpTypePointer Uniform %6 + %71 = OpTypePointer Function %6 + %90 = OpTypePointer Output %7 + %91 = OpVariable %90 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %14 = OpVariable %13 Function + %40 = OpVariable %13 Function + %51 = OpVariable %13 Function + OpStore %9 %11 + %23 = OpAccessChain %22 %20 %21 %21 + %24 = OpLoad %12 %23 + OpStore %14 %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %12 %14 + %32 = OpAccessChain %22 %20 %21 %31 + %33 = OpLoad %12 %32 + %35 = OpSLessThan %34 %30 %33 + OpBranchConditional %35 %26 %27 + %26 = OpLabel + %36 = OpLoad %12 %14 + OpSelectionMerge %39 None + OpSwitch %36 %39 1 %37 2 %38 + %37 = OpLabel + %41 = OpAccessChain %22 %20 %21 %21 + %42 = OpLoad %12 %41 + OpStore %40 %42 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %12 %14 + %49 = OpLoad %12 %14 + %50 = OpSGreaterThan %34 %48 %49 + OpBranchConditional %50 %44 %45 + %44 = OpLabel + %52 = OpAccessChain %22 %20 %21 %21 + %53 = OpLoad %12 %52 + OpStore %51 %53 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %12 %51 + %60 = OpLoad %12 %14 + %61 = OpSLessThan %34 %59 %60 + OpBranchConditional %61 %55 %56 + %55 = OpLabel + %62 = OpLoad %12 %51 + %69 = OpAccessChain %68 %67 %21 %21 + %70 = OpLoad %6 %69 + %72 = OpAccessChain %71 %9 %62 + OpStore %72 %70 + OpBranch %57 + %57 = OpLabel + %73 = OpLoad %12 %51 + %74 = OpIAdd %12 %73 %31 + OpStore %51 %74 + OpBranch %54 + %56 = OpLabel + OpBranch %46 + %46 = OpLabel + %75 = OpLoad %12 %40 + %76 = OpIAdd %12 %75 %31 + OpStore %40 %76 + OpBranch %43 + %45 = OpLabel + %77 = OpLoad %12 %14 + %78 = OpAccessChain %68 %67 %21 %21 + %79 = OpLoad %6 %78 + %80 = OpAccessChain %71 %9 %77 + OpStore %80 %79 + OpBranch %39 + %38 = OpLabel + %82 = OpLoad %12 %14 + %83 = OpAccessChain %68 %67 %21 %21 + %84 = OpLoad %6 %83 + %85 = OpAccessChain %71 %9 %82 + OpStore %85 %84 + OpBranch %39 + %39 = OpLabel + OpBranch %28 + %28 = OpLabel + %88 = OpLoad %12 %14 + %89 = OpIAdd %12 %88 %31 + OpStore %14 %89 + OpBranch %25 + %27 = OpLabel + %92 = OpLoad %7 %9 + OpStore %91 %92 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 4 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-tail-duplicator-infinite-loops.amber b/vulkan/amber/graphicsfuzz/cov-tail-duplicator-infinite-loops.amber new file mode 100644 index 0000000..7c51c19 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-tail-duplicator-infinite-loops.amber @@ -0,0 +1,275 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific tail duplicator code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_5 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [5, 0] +# layout(set = 0, binding = 0) uniform buf0 { +# int _GLF_uniform_int_values[2]; +# }; +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 { +# float _GLF_uniform_float_values[2]; +# }; +# // Contents of zero: 0.0 +# layout(set = 0, binding = 2) uniform buf2 { +# float zero; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_float_0_0); +# +# // Always false. +# if(zero > _float_0_0) +# { +# do +# { +# _GLF_color = vec4(_float_1_0); +# } +# while(true); +# } +# else +# { +# do +# { +# // Loops once because of the break inside. +# while(true) +# { +# for(int i = _int_0; i < _int_5; i ++) +# { +# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0); +# } +# break; +# } +# } +# while(zero > _float_0_0); // Always false. +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 87 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %13 "buf1" + OpMemberName %13 0 "_GLF_uniform_float_values" + OpName %15 "" + OpName %22 "buf2" + OpMemberName %22 0 "zero" + OpName %24 "" + OpName %53 "i" + OpName %55 "buf0" + OpMemberName %55 0 "_GLF_uniform_int_values" + OpName %57 "" + OpDecorate %9 Location 0 + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 2 + OpDecorate %53 RelaxedPrecision + OpDecorate %54 ArrayStride 16 + OpMemberDecorate %55 0 RelaxedPrecision + OpMemberDecorate %55 0 Offset 0 + OpDecorate %55 Block + OpDecorate %57 DescriptorSet 0 + OpDecorate %57 Binding 0 + OpDecorate %60 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 2 + %12 = OpTypeArray %6 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %6 + %22 = OpTypeStruct %6 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %29 = OpTypeBool + %37 = OpConstant %16 1 + %41 = OpConstantTrue %29 + %52 = OpTypePointer Function %16 + %54 = OpTypeArray %16 %11 + %55 = OpTypeStruct %54 + %56 = OpTypePointer Uniform %55 + %57 = OpVariable %56 Uniform + %58 = OpTypePointer Uniform %16 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %53 = OpVariable %52 Function + %19 = OpAccessChain %18 %15 %17 %17 + %20 = OpLoad %6 %19 + %21 = OpCompositeConstruct %7 %20 %20 %20 %20 + OpStore %9 %21 + %25 = OpAccessChain %18 %24 %17 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %18 %15 %17 %17 + %28 = OpLoad %6 %27 + %30 = OpFOrdGreaterThan %29 %26 %28 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %42 + %31 = OpLabel + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %34 + %34 = OpLabel + %38 = OpAccessChain %18 %15 %17 %37 + %39 = OpLoad %6 %38 + %40 = OpCompositeConstruct %7 %39 %39 %39 %39 + OpStore %9 %40 + OpBranch %36 + %36 = OpLabel + OpBranchConditional %41 %33 %35 + %35 = OpLabel + OpBranch %32 + %42 = OpLabel + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %44 + %44 = OpLabel + OpBranch %47 + %47 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + OpBranchConditional %41 %48 %49 + %48 = OpLabel + %59 = OpAccessChain %58 %57 %17 %37 + %60 = OpLoad %16 %59 + OpStore %53 %60 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %66 = OpLoad %16 %53 + %67 = OpAccessChain %58 %57 %17 %17 + %68 = OpLoad %16 %67 + %69 = OpSLessThan %29 %66 %68 + OpBranchConditional %69 %62 %63 + %62 = OpLabel + %70 = OpAccessChain %18 %15 %17 %37 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %18 %15 %17 %17 + %73 = OpLoad %6 %72 + %74 = OpAccessChain %18 %15 %17 %17 + %75 = OpLoad %6 %74 + %76 = OpAccessChain %18 %15 %17 %37 + %77 = OpLoad %6 %76 + %78 = OpCompositeConstruct %7 %71 %73 %75 %77 + OpStore %9 %78 + OpBranch %64 + %64 = OpLabel + %79 = OpLoad %16 %53 + %80 = OpIAdd %16 %79 %37 + OpStore %53 %80 + OpBranch %61 + %63 = OpLabel + OpBranch %49 + %50 = OpLabel + OpBranch %47 + %49 = OpLabel + OpBranch %46 + %46 = OpLabel + %82 = OpAccessChain %18 %24 %17 + %83 = OpLoad %6 %82 + %84 = OpAccessChain %18 %15 %17 %17 + %85 = OpLoad %6 %84 + %86 = OpFOrdGreaterThan %29 %83 %85 + OpBranchConditional %86 %43 %45 + %45 = OpLabel + OpBranch %32 + %32 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float STD140 DATA + 0.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 5 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-target-lowering-dfdx-cos.amber b/vulkan/amber/graphicsfuzz/cov-target-lowering-dfdx-cos.amber new file mode 100644 index 0000000..353a557 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-target-lowering-dfdx-cos.amber @@ -0,0 +1,154 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific target lowering code path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# float two; +# }; +# +# void main() +# { +# float a = dFdx(cos(gl_FragCoord.x)); +# +# // The weight value doesn't matter since two equals 2. +# float b = mix(2.0, two, a); +# +# // Always true. +# if (b >= 1.9 && b <= 2.1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %11 %42 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %11 "gl_FragCoord" + OpName %19 "b" + OpName %21 "buf0" + OpMemberName %21 0 "two" + OpName %23 "" + OpName %42 "_GLF_color" + OpDecorate %11 BuiltIn FragCoord + OpMemberDecorate %21 0 Offset 0 + OpDecorate %21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 0 + OpDecorate %42 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeVector %6 4 + %10 = OpTypePointer Input %9 + %11 = OpVariable %10 Input + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 0 + %14 = OpTypePointer Input %6 + %20 = OpConstant %6 2 + %21 = OpTypeStruct %6 + %22 = OpTypePointer Uniform %21 + %23 = OpVariable %22 Uniform + %24 = OpTypeInt 32 1 + %25 = OpConstant %24 0 + %26 = OpTypePointer Uniform %6 + %32 = OpConstant %6 1.89999998 + %33 = OpTypeBool + %36 = OpConstant %6 2.0999999 + %41 = OpTypePointer Output %9 + %42 = OpVariable %41 Output + %43 = OpConstant %6 1 + %44 = OpConstant %6 0 + %45 = OpConstantComposite %9 %43 %44 %44 %43 + %47 = OpConstantComposite %9 %44 %44 %44 %44 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %15 = OpAccessChain %14 %11 %13 + %16 = OpLoad %6 %15 + %17 = OpExtInst %6 %1 Cos %16 + %18 = OpDPdx %6 %17 + OpStore %8 %18 + %27 = OpAccessChain %26 %23 %25 + %28 = OpLoad %6 %27 + %29 = OpLoad %6 %8 + %30 = OpExtInst %6 %1 FMix %20 %28 %29 + OpStore %19 %30 + %31 = OpLoad %6 %19 + %34 = OpFOrdGreaterThanEqual %33 %31 %32 + %35 = OpLoad %6 %19 + %37 = OpFOrdLessThanEqual %33 %35 %36 + %38 = OpLogicalAnd %33 %34 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %46 + %39 = OpLabel + OpStore %42 %45 + OpBranch %40 + %46 = OpLabel + OpStore %42 %47 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE float DATA + 2.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal.amber b/vulkan/amber/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal.amber new file mode 100644 index 0000000..67a249e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal.amber @@ -0,0 +1,417 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers target lowering and compare combining code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_3 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _int_5 _GLF_uniform_int_values[4] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 3, 0, 2, 5] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of v1: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 v1; +# }; +# +# struct S { +# int data; +# }; +# +# void func(inout S s) +# { +# // Always false. +# while (v1.x > v1.y) +# { +# return; +# } +# s.data = _int_1; +# } +# void main() +# { +# S arr[3]; +# for (int i = _int_0; i < _int_3; i++) +# { +# arr[i].data = i; +# } +# for (int i = _int_0; i < _int_3; i++) +# { +# // Always false. +# if (v1.x > v1.y) +# { +# break; +# } +# +# // True for i = 1, 2 +# if (arr[i].data == _int_1) +# { +# arr[clamp(i, 0, 3)].data = _int_2; +# func(arr[2]); +# } +# else +# { +# for (int j = _int_0; j < _int_3; j++) +# { +# // Always false. +# if (arr[j].data > _int_5) +# { +# discard; +# } +# } +# } +# } +# if (arr[_int_0].data == _int_0 && arr[_int_1].data == _int_2 && +# arr[_int_2].data == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 185 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %166 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "S" + OpMemberName %7 0 "data" + OpName %11 "func(struct-S-i11;" + OpName %10 "s" + OpName %20 "buf1" + OpMemberName %20 0 "v1" + OpName %22 "" + OpName %37 "buf0" + OpMemberName %37 0 "_GLF_uniform_int_values" + OpName %39 "" + OpName %45 "i" + OpName %62 "arr" + OpName %68 "i" + OpName %102 "param" + OpName %109 "j" + OpName %166 "_GLF_color" + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 1 + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 0 + OpDecorate %166 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %2 %8 + %18 = OpTypeFloat 32 + %19 = OpTypeVector %18 2 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpConstant %6 0 + %24 = OpTypeInt 32 0 + %25 = OpConstant %24 0 + %26 = OpTypePointer Uniform %18 + %29 = OpConstant %24 1 + %32 = OpTypeBool + %35 = OpConstant %24 5 + %36 = OpTypeArray %6 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpTypePointer Uniform %6 + %43 = OpTypePointer Function %6 + %46 = OpConstant %6 2 + %55 = OpConstant %6 1 + %59 = OpConstant %24 3 + %60 = OpTypeArray %7 %59 + %61 = OpTypePointer Function %60 + %97 = OpConstant %6 3 + %124 = OpConstant %6 4 + %164 = OpTypeVector %18 4 + %165 = OpTypePointer Output %164 + %166 = OpVariable %165 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %45 = OpVariable %43 Function + %62 = OpVariable %61 Function + %68 = OpVariable %43 Function + %102 = OpVariable %8 Function + %109 = OpVariable %43 Function + %47 = OpAccessChain %40 %39 %23 %46 + %48 = OpLoad %6 %47 + OpStore %45 %48 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %6 %45 + %56 = OpAccessChain %40 %39 %23 %55 + %57 = OpLoad %6 %56 + %58 = OpSLessThan %32 %54 %57 + OpBranchConditional %58 %50 %51 + %50 = OpLabel + %63 = OpLoad %6 %45 + %64 = OpLoad %6 %45 + %65 = OpAccessChain %43 %62 %63 %23 + OpStore %65 %64 + OpBranch %52 + %52 = OpLabel + %66 = OpLoad %6 %45 + %67 = OpIAdd %6 %66 %55 + OpStore %45 %67 + OpBranch %49 + %51 = OpLabel + %69 = OpAccessChain %40 %39 %23 %46 + %70 = OpLoad %6 %69 + OpStore %68 %70 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %6 %68 + %77 = OpAccessChain %40 %39 %23 %55 + %78 = OpLoad %6 %77 + %79 = OpSLessThan %32 %76 %78 + OpBranchConditional %79 %72 %73 + %72 = OpLabel + %80 = OpAccessChain %26 %22 %23 %25 + %81 = OpLoad %18 %80 + %82 = OpAccessChain %26 %22 %23 %29 + %83 = OpLoad %18 %82 + %84 = OpFOrdGreaterThan %32 %81 %83 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %86 + %85 = OpLabel + OpBranch %73 + %86 = OpLabel + %88 = OpLoad %6 %68 + %89 = OpAccessChain %43 %62 %88 %23 + %90 = OpLoad %6 %89 + %91 = OpAccessChain %40 %39 %23 %23 + %92 = OpLoad %6 %91 + %93 = OpIEqual %32 %90 %92 + OpSelectionMerge %95 None + OpBranchConditional %93 %94 %108 + %94 = OpLabel + %96 = OpLoad %6 %68 + %98 = OpExtInst %6 %1 SClamp %96 %23 %97 + %99 = OpAccessChain %40 %39 %23 %97 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %62 %98 %23 + OpStore %101 %100 + %103 = OpAccessChain %8 %62 %46 + %104 = OpLoad %7 %103 + OpStore %102 %104 + %105 = OpFunctionCall %2 %11 %102 + %106 = OpLoad %7 %102 + %107 = OpAccessChain %8 %62 %46 + OpStore %107 %106 + OpBranch %95 + %108 = OpLabel + %110 = OpAccessChain %40 %39 %23 %46 + %111 = OpLoad %6 %110 + OpStore %109 %111 + OpBranch %112 + %112 = OpLabel + OpLoopMerge %114 %115 None + OpBranch %116 + %116 = OpLabel + %117 = OpLoad %6 %109 + %118 = OpAccessChain %40 %39 %23 %55 + %119 = OpLoad %6 %118 + %120 = OpSLessThan %32 %117 %119 + OpBranchConditional %120 %113 %114 + %113 = OpLabel + %121 = OpLoad %6 %109 + %122 = OpAccessChain %43 %62 %121 %23 + %123 = OpLoad %6 %122 + %125 = OpAccessChain %40 %39 %23 %124 + %126 = OpLoad %6 %125 + %127 = OpSGreaterThan %32 %123 %126 + OpSelectionMerge %129 None + OpBranchConditional %127 %128 %129 + %128 = OpLabel + OpTerminateInvocation + %129 = OpLabel + OpBranch %115 + %115 = OpLabel + %131 = OpLoad %6 %109 + %132 = OpIAdd %6 %131 %55 + OpStore %109 %132 + OpBranch %112 + %114 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %74 + %74 = OpLabel + %133 = OpLoad %6 %68 + %134 = OpIAdd %6 %133 %55 + OpStore %68 %134 + OpBranch %71 + %73 = OpLabel + %135 = OpAccessChain %40 %39 %23 %46 + %136 = OpLoad %6 %135 + %137 = OpAccessChain %43 %62 %136 %23 + %138 = OpLoad %6 %137 + %139 = OpAccessChain %40 %39 %23 %46 + %140 = OpLoad %6 %139 + %141 = OpIEqual %32 %138 %140 + OpSelectionMerge %143 None + OpBranchConditional %141 %142 %143 + %142 = OpLabel + %144 = OpAccessChain %40 %39 %23 %23 + %145 = OpLoad %6 %144 + %146 = OpAccessChain %43 %62 %145 %23 + %147 = OpLoad %6 %146 + %148 = OpAccessChain %40 %39 %23 %97 + %149 = OpLoad %6 %148 + %150 = OpIEqual %32 %147 %149 + OpBranch %143 + %143 = OpLabel + %151 = OpPhi %32 %141 %73 %150 %142 + OpSelectionMerge %153 None + OpBranchConditional %151 %152 %153 + %152 = OpLabel + %154 = OpAccessChain %40 %39 %23 %97 + %155 = OpLoad %6 %154 + %156 = OpAccessChain %43 %62 %155 %23 + %157 = OpLoad %6 %156 + %158 = OpAccessChain %40 %39 %23 %23 + %159 = OpLoad %6 %158 + %160 = OpIEqual %32 %157 %159 + OpBranch %153 + %153 = OpLabel + %161 = OpPhi %32 %151 %143 %160 %152 + OpSelectionMerge %163 None + OpBranchConditional %161 %162 %180 + %162 = OpLabel + %167 = OpAccessChain %40 %39 %23 %23 + %168 = OpLoad %6 %167 + %169 = OpConvertSToF %18 %168 + %170 = OpAccessChain %40 %39 %23 %46 + %171 = OpLoad %6 %170 + %172 = OpConvertSToF %18 %171 + %173 = OpAccessChain %40 %39 %23 %46 + %174 = OpLoad %6 %173 + %175 = OpConvertSToF %18 %174 + %176 = OpAccessChain %40 %39 %23 %23 + %177 = OpLoad %6 %176 + %178 = OpConvertSToF %18 %177 + %179 = OpCompositeConstruct %164 %169 %172 %175 %178 + OpStore %166 %179 + OpBranch %163 + %180 = OpLabel + %181 = OpAccessChain %40 %39 %23 %46 + %182 = OpLoad %6 %181 + %183 = OpConvertSToF %18 %182 + %184 = OpCompositeConstruct %164 %183 %183 %183 %183 + OpStore %166 %184 + OpBranch %163 + %163 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %9 + %10 = OpFunctionParameter %8 + %12 = OpLabel + OpBranch %13 + %13 = OpLabel + OpLoopMerge %15 %16 None + OpBranch %17 + %17 = OpLabel + %27 = OpAccessChain %26 %22 %23 %25 + %28 = OpLoad %18 %27 + %30 = OpAccessChain %26 %22 %23 %29 + %31 = OpLoad %18 %30 + %33 = OpFOrdGreaterThan %32 %28 %31 + OpBranchConditional %33 %14 %15 + %14 = OpLabel + OpReturn + %16 = OpLabel + OpBranch %13 + %15 = OpLabel + %41 = OpAccessChain %40 %39 %23 %23 + %42 = OpLoad %6 %41 + %44 = OpAccessChain %43 %10 %23 + OpStore %44 %42 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# v1 +BUFFER variant_v1 DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 3 0 2 5 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_v1 AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-texel-double-negation.amber b/vulkan/amber/graphicsfuzz/cov-texel-double-negation.amber new file mode 100644 index 0000000..29ea7e2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-texel-double-negation.amber @@ -0,0 +1,289 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_5 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_2_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [1.0, 2.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# // Contents of _GLF_uniform_int_values: [0, 1, 5] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 2) uniform sampler2D tex; +# +# void main() +# { +# int i = 1; +# vec4 texel = vec4(_float_1_0); +# +# // Iterates until i becomes 5. +# // The texture lookup reads only values in the range of 0..1 +# // making the texel.z != 2.0 condition always true. +# while(!(false || (!(texel.z != _float_2_0 && i < 5)))) +# { +# texel = texture(tex, vec2(_float_1_0)); +# i++; +# } +# +# // Always true. +# if(i == _int_5) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 93 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %74 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "i" + OpName %13 "texel" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_float_values" + OpName %19 "" + OpName %51 "tex" + OpName %63 "buf1" + OpMemberName %63 0 "_GLF_uniform_int_values" + OpName %65 "" + OpName %74 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %51 RelaxedPrecision + OpDecorate %51 DescriptorSet 0 + OpDecorate %51 Binding 2 + OpDecorate %52 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %62 ArrayStride 16 + OpMemberDecorate %63 0 Offset 0 + OpDecorate %63 Block + OpDecorate %65 DescriptorSet 0 + OpDecorate %65 Binding 1 + OpDecorate %74 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Function %11 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 2 + %16 = OpTypeArray %10 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %6 0 + %21 = OpTypePointer Uniform %10 + %30 = OpTypeBool + %31 = OpConstantFalse %30 + %35 = OpTypePointer Function %10 + %42 = OpConstant %6 5 + %48 = OpTypeImage %10 2D 0 0 0 1 Unknown + %49 = OpTypeSampledImage %48 + %50 = OpTypePointer UniformConstant %49 + %51 = OpVariable %50 UniformConstant + %55 = OpTypeVector %10 2 + %61 = OpConstant %14 3 + %62 = OpTypeArray %6 %61 + %63 = OpTypeStruct %62 + %64 = OpTypePointer Uniform %63 + %65 = OpVariable %64 Uniform + %66 = OpConstant %6 2 + %67 = OpTypePointer Uniform %6 + %73 = OpTypePointer Output %11 + %74 = OpVariable %73 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %13 = OpVariable %12 Function + OpStore %8 %9 + %22 = OpAccessChain %21 %19 %20 %20 + %23 = OpLoad %10 %22 + %24 = OpCompositeConstruct %11 %23 %23 %23 %23 + OpStore %13 %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %32 = OpLogicalNot %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %34 + %33 = OpLabel + %36 = OpAccessChain %35 %13 %15 + %37 = OpLoad %10 %36 + %38 = OpAccessChain %21 %19 %20 %9 + %39 = OpLoad %10 %38 + %40 = OpFUnordNotEqual %30 %37 %39 + %41 = OpLoad %6 %8 + %43 = OpSLessThan %30 %41 %42 + %44 = OpLogicalAnd %30 %40 %43 + %45 = OpLogicalNot %30 %44 + OpBranch %34 + %34 = OpLabel + %46 = OpPhi %30 %31 %29 %45 %33 + %47 = OpLogicalNot %30 %46 + OpBranchConditional %47 %26 %27 + %26 = OpLabel + %52 = OpLoad %49 %51 + %53 = OpAccessChain %21 %19 %20 %20 + %54 = OpLoad %10 %53 + %56 = OpCompositeConstruct %55 %54 %54 + %57 = OpImageSampleImplicitLod %11 %52 %56 + OpStore %13 %57 + %58 = OpLoad %6 %8 + %59 = OpIAdd %6 %58 %9 + OpStore %8 %59 + OpBranch %28 + %28 = OpLabel + OpBranch %25 + %27 = OpLabel + %60 = OpLoad %6 %8 + %68 = OpAccessChain %67 %65 %20 %66 + %69 = OpLoad %6 %68 + %70 = OpIEqual %30 %60 %69 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %88 + %71 = OpLabel + %75 = OpAccessChain %67 %65 %20 %9 + %76 = OpLoad %6 %75 + %77 = OpConvertSToF %10 %76 + %78 = OpAccessChain %67 %65 %20 %20 + %79 = OpLoad %6 %78 + %80 = OpConvertSToF %10 %79 + %81 = OpAccessChain %67 %65 %20 %20 + %82 = OpLoad %6 %81 + %83 = OpConvertSToF %10 %82 + %84 = OpAccessChain %67 %65 %20 %9 + %85 = OpLoad %6 %84 + %86 = OpConvertSToF %10 %85 + %87 = OpCompositeConstruct %11 %77 %80 %83 %86 + OpStore %74 %87 + OpBranch %72 + %88 = OpLabel + %89 = OpAccessChain %67 %65 %20 %20 + %90 = OpLoad %6 %89 + %91 = OpConvertSToF %10 %90 + %92 = OpCompositeConstruct %11 %91 %91 %91 %91 + OpStore %74 %92 + OpBranch %72 + %72 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# tex +SAMPLER variant_tex + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 5 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 2.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-transpose-multiply.amber b/vulkan/amber/graphicsfuzz/cov-transpose-multiply.amber new file mode 100644 index 0000000..92998ac --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-transpose-multiply.amber @@ -0,0 +1,129 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp int; +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat2 m = mat2(1, 2, 3, 4); +# +# if (transpose(m) * transpose(m) == transpose(m * m)) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %42 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "m" + OpName %42 "_GLF_color" + OpDecorate %42 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeMatrix %7 2 + %9 = OpTypePointer Function %8 + %11 = OpConstant %6 1 + %12 = OpConstant %6 2 + %13 = OpConstantComposite %7 %11 %12 + %14 = OpConstant %6 3 + %15 = OpConstant %6 4 + %16 = OpConstantComposite %7 %14 %15 + %17 = OpConstantComposite %8 %13 %16 + %27 = OpTypeBool + %30 = OpTypeVector %27 2 + %40 = OpTypeVector %6 4 + %41 = OpTypePointer Output %40 + %42 = OpVariable %41 Output + %43 = OpConstant %6 0 + %44 = OpConstantComposite %40 %11 %43 %43 %11 + %46 = OpConstantComposite %40 %43 %43 %43 %43 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + OpStore %10 %17 + %18 = OpLoad %8 %10 + %19 = OpTranspose %8 %18 + %20 = OpLoad %8 %10 + %21 = OpTranspose %8 %20 + %22 = OpMatrixTimesMatrix %8 %19 %21 + %23 = OpLoad %8 %10 + %24 = OpLoad %8 %10 + %25 = OpMatrixTimesMatrix %8 %23 %24 + %26 = OpTranspose %8 %25 + %28 = OpCompositeExtract %7 %22 0 + %29 = OpCompositeExtract %7 %26 0 + %31 = OpFOrdEqual %30 %28 %29 + %32 = OpAll %27 %31 + %33 = OpCompositeExtract %7 %22 1 + %34 = OpCompositeExtract %7 %26 1 + %35 = OpFOrdEqual %30 %33 %34 + %36 = OpAll %27 %35 + %37 = OpLogicalAnd %27 %32 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %45 + %38 = OpLabel + OpStore %42 %44 + OpBranch %39 + %45 = OpLabel + OpStore %42 %46 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-trunc-fract-always-zero.amber b/vulkan/amber/graphicsfuzz/cov-trunc-fract-always-zero.amber new file mode 100644 index 0000000..5c89fd4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-trunc-fract-always-zero.amber @@ -0,0 +1,200 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_5_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.0, 5.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Trunc returns either 0.0 or 1.0. Fract will return zero for both. +# float f = fract(trunc(gl_FragCoord.y < _float_5_0 ? 0.1 : 1.0)); +# +# // Always true. +# if(f == _float_0_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 66 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %11 %42 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %11 "gl_FragCoord" + OpName %19 "buf1" + OpMemberName %19 0 "_GLF_uniform_float_values" + OpName %21 "" + OpName %42 "_GLF_color" + OpName %44 "buf0" + OpMemberName %44 0 "_GLF_uniform_int_values" + OpName %46 "" + OpDecorate %11 BuiltIn FragCoord + OpDecorate %18 ArrayStride 16 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 1 + OpDecorate %42 Location 0 + OpDecorate %43 ArrayStride 16 + OpMemberDecorate %44 0 Offset 0 + OpDecorate %44 Block + OpDecorate %46 DescriptorSet 0 + OpDecorate %46 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeVector %6 4 + %10 = OpTypePointer Input %9 + %11 = OpVariable %10 Input + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 1 + %14 = OpTypePointer Input %6 + %17 = OpConstant %12 2 + %18 = OpTypeArray %6 %17 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpTypeInt 32 1 + %23 = OpConstant %22 0 + %24 = OpConstant %22 1 + %25 = OpTypePointer Uniform %6 + %28 = OpTypeBool + %30 = OpConstant %6 0.100000001 + %31 = OpConstant %6 1 + %41 = OpTypePointer Output %9 + %42 = OpVariable %41 Output + %43 = OpTypeArray %22 %17 + %44 = OpTypeStruct %43 + %45 = OpTypePointer Uniform %44 + %46 = OpVariable %45 Uniform + %47 = OpTypePointer Uniform %22 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %15 = OpAccessChain %14 %11 %13 + %16 = OpLoad %6 %15 + %26 = OpAccessChain %25 %21 %23 %24 + %27 = OpLoad %6 %26 + %29 = OpFOrdLessThan %28 %16 %27 + %32 = OpSelect %6 %29 %30 %31 + %33 = OpExtInst %6 %1 Trunc %32 + %34 = OpExtInst %6 %1 Fract %33 + OpStore %8 %34 + %35 = OpLoad %6 %8 + %36 = OpAccessChain %25 %21 %23 %23 + %37 = OpLoad %6 %36 + %38 = OpFOrdEqual %28 %35 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %61 + %39 = OpLabel + %48 = OpAccessChain %47 %46 %23 %23 + %49 = OpLoad %22 %48 + %50 = OpConvertSToF %6 %49 + %51 = OpAccessChain %47 %46 %23 %24 + %52 = OpLoad %22 %51 + %53 = OpConvertSToF %6 %52 + %54 = OpAccessChain %47 %46 %23 %24 + %55 = OpLoad %22 %54 + %56 = OpConvertSToF %6 %55 + %57 = OpAccessChain %47 %46 %23 %23 + %58 = OpLoad %22 %57 + %59 = OpConvertSToF %6 %58 + %60 = OpCompositeConstruct %9 %50 %53 %56 %59 + OpStore %42 %60 + OpBranch %40 + %61 = OpLabel + %62 = OpAccessChain %47 %46 %23 %24 + %63 = OpLoad %22 %62 + %64 = OpConvertSToF %6 %63 + %65 = OpCompositeConstruct %9 %64 %64 %64 %64 + OpStore %42 %65 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 5.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-two-functions-loops-copy-elements-infinite-loops-never-executed.amber b/vulkan/amber/graphicsfuzz/cov-two-functions-loops-copy-elements-infinite-loops-never-executed.amber new file mode 100644 index 0000000..83c6fb0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-two-functions-loops-copy-elements-infinite-loops-never-executed.amber @@ -0,0 +1,857 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_4 _GLF_uniform_int_values[3] +# #define _int_14 _GLF_uniform_int_values[4] +# #define _int_15 _GLF_uniform_int_values[5] +# #define _int_16 _GLF_uniform_int_values[6] +# #define _int_17 _GLF_uniform_int_values[7] +# #define _int_18 _GLF_uniform_int_values[8] +# #define _int_19 _GLF_uniform_int_values[9] +# #define _int_10 _GLF_uniform_int_values[10] +# #define _int_0 _GLF_uniform_int_values[11] +# #define _int_9 _GLF_uniform_int_values[12] +# #define _int_5 _GLF_uniform_int_values[13] +# #define _int_6 _GLF_uniform_int_values[14] +# #define _int_7 _GLF_uniform_int_values[15] +# #define _int_8 _GLF_uniform_int_values[16] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [3, 1, 2, 4, 14, 15, 16, 17, 18, 19, 10, 0, 9, 5, 6, 7, 8] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[17]; +# }; +# +# // Contents of two: 2.0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# float two; +# }; +# +# struct S +# { +# int data; +# int leftIndex; +# int rightIndex; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int data0[10] = int[10](0, 1, 2, 3, 4, 5, 6, 7, 8, 9), data1[10] = int[10](10, 11, 12, 13, 14, 15, 16, 17, 18, 19); +# +# void func0(int from, int mid, int to) +# { +# int k = _int_1, i = 1, j = _int_1; +# +# while(i <= mid) +# { +# if(i <= j) +# { +# _GLF_color = vec4(_int_1); +# +# int a = - _int_1; +# +# // Iterates once. +# while(a != _int_1) +# { +# a = S[10](S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3))[clamp(a, _int_0, _int_9)].data; +# } +# } +# else +# { +# data1[k++] = data0[j++]; +# } +# +# i++; +# } +# +# while(i < 5 && k < _int_10) +# { +# data1[k++] = int[10](_int_0, _int_1, _int_2, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9)[i++]; +# } +# +# for(int i = from; i <= to - 1; i++) +# { +# data0[i] = data1[i]; +# } +# } +# +# int func1() +# { +# int a = _int_1; +# +# for(int i = 1; i < 10; i *= 2) +# { +# for(int j = 1; j < 10; j += i) +# { +# func0(i, j, min(i + j, 10)); +# } +# +# while(a < _int_5) +# { +# // v becomes (0, 0). +# ivec2 v = ivec2(vec2(_float_1_0) / two); +# +# // This loop is never iterated. +# while(v.x + v.y > _int_2) +# { +# } +# +# a++; +# } +# } +# return a; +# } +# +# void main() +# { +# _GLF_color = vec4(_int_0); +# +# // Always true. +# if(func1() == _int_5) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# +# /* +# This python script was used to generate the reference values: +# +# data0 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] +# data1 = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19] +# +# def func0(x, y, z): +# global data0 +# global data1 +# k = 1 +# i = 1 +# j = 1 +# +# while i <= y: +# if i > j: +# data1[k] = data0[j] +# k = k + 1 +# j = j + 1 +# i = i + 1 +# +# while i < 5 and k < 10: +# data1[k] = i +# k = k + 1 +# i = i + 1 +# +# for i in range(x, z): +# data0[i] = data1[i] +# +# def func1(): +# a = 1 +# i = 1 +# +# while i < 10: +# j = 1 +# while j < 10: +# func0(i, j, min(i + j, 10)) +# j = i + j +# while a < 5: +# a = a + 1 +# i = 2 * i +# return a +# +# print(func1()) +# print(data0) +# print(data1) +# */ +# +# int ref0[10] = int[10](_int_0, _int_2, _int_3, _int_4, _int_14, _int_15, _int_16, _int_17, _int_18, _int_19); +# int ref1[10] = int[10](_int_10, _int_2, _int_3, _int_4, _int_14, _int_15, _int_16, _int_17, _int_18, _int_19); +# +# // Verify the global arrays against reference and set output to zero if the check fails. +# for(int i = _int_0; i < _int_10; i++) +# { +# if(data0[i] != ref0[i] || data1[i] != ref1[i]) +# { +# _GLF_color = vec4(_int_0); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 437 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %75 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "func0(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %15 "func1(" + OpName %21 "data0" + OpName %33 "data1" + OpName %45 "k" + OpName %48 "buf1" + OpMemberName %48 0 "_GLF_uniform_int_values" + OpName %50 "" + OpName %54 "i" + OpName %55 "j" + OpName %75 "_GLF_color" + OpName %80 "a" + OpName %99 "S" + OpMemberName %99 0 "data" + OpMemberName %99 1 "leftIndex" + OpMemberName %99 2 "rightIndex" + OpName %173 "indexable" + OpName %227 "indexable" + OpName %231 "i" + OpName %249 "a" + OpName %252 "i" + OpName %260 "j" + OpName %272 "param" + OpName %274 "param" + OpName %276 "param" + OpName %292 "v" + OpName %295 "buf0" + OpMemberName %295 0 "_GLF_uniform_float_values" + OpName %297 "" + OpName %303 "buf2" + OpMemberName %303 0 "two" + OpName %305 "" + OpName %355 "ref0" + OpName %377 "ref1" + OpName %399 "i" + OpDecorate %47 ArrayStride 16 + OpMemberDecorate %48 0 Offset 0 + OpDecorate %48 Block + OpDecorate %50 DescriptorSet 0 + OpDecorate %50 Binding 1 + OpDecorate %75 Location 0 + OpDecorate %294 ArrayStride 16 + OpMemberDecorate %295 0 Offset 0 + OpDecorate %295 Block + OpDecorate %297 DescriptorSet 0 + OpDecorate %297 Binding 0 + OpMemberDecorate %303 0 Offset 0 + OpDecorate %303 Block + OpDecorate %305 DescriptorSet 0 + OpDecorate %305 Binding 2 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %14 = OpTypeFunction %6 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 10 + %19 = OpTypeArray %6 %18 + %20 = OpTypePointer Private %19 + %21 = OpVariable %20 Private + %22 = OpConstant %6 0 + %23 = OpConstant %6 1 + %24 = OpConstant %6 2 + %25 = OpConstant %6 3 + %26 = OpConstant %6 4 + %27 = OpConstant %6 5 + %28 = OpConstant %6 6 + %29 = OpConstant %6 7 + %30 = OpConstant %6 8 + %31 = OpConstant %6 9 + %32 = OpConstantComposite %19 %22 %23 %24 %25 %26 %27 %28 %29 %30 %31 + %33 = OpVariable %20 Private + %34 = OpConstant %6 10 + %35 = OpConstant %6 11 + %36 = OpConstant %6 12 + %37 = OpConstant %6 13 + %38 = OpConstant %6 14 + %39 = OpConstant %6 15 + %40 = OpConstant %6 16 + %41 = OpConstant %6 17 + %42 = OpConstant %6 18 + %43 = OpConstant %6 19 + %44 = OpConstantComposite %19 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 + %46 = OpConstant %17 17 + %47 = OpTypeArray %6 %46 + %48 = OpTypeStruct %47 + %49 = OpTypePointer Uniform %48 + %50 = OpVariable %49 Uniform + %51 = OpTypePointer Uniform %6 + %65 = OpTypeBool + %72 = OpTypeFloat 32 + %73 = OpTypeVector %72 4 + %74 = OpTypePointer Output %73 + %75 = OpVariable %74 Output + %99 = OpTypeStruct %6 %6 %6 + %164 = OpTypeArray %99 %18 + %172 = OpTypePointer Function %164 + %181 = OpTypePointer Private %6 + %226 = OpTypePointer Function %19 + %290 = OpTypeVector %6 2 + %291 = OpTypePointer Function %290 + %293 = OpConstant %17 1 + %294 = OpTypeArray %72 %293 + %295 = OpTypeStruct %294 + %296 = OpTypePointer Uniform %295 + %297 = OpVariable %296 Uniform + %298 = OpTypePointer Uniform %72 + %301 = OpTypeVector %72 2 + %303 = OpTypeStruct %72 + %304 = OpTypePointer Uniform %303 + %305 = OpVariable %304 Uniform + %316 = OpConstant %17 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %355 = OpVariable %226 Function + %377 = OpVariable %226 Function + %399 = OpVariable %7 Function + OpStore %21 %32 + OpStore %33 %44 + %332 = OpAccessChain %51 %50 %22 %35 + %333 = OpLoad %6 %332 + %334 = OpConvertSToF %72 %333 + %335 = OpCompositeConstruct %73 %334 %334 %334 %334 + OpStore %75 %335 + %336 = OpFunctionCall %6 %15 + %337 = OpAccessChain %51 %50 %22 %37 + %338 = OpLoad %6 %337 + %339 = OpIEqual %65 %336 %338 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %342 = OpAccessChain %51 %50 %22 %23 + %343 = OpLoad %6 %342 + %344 = OpConvertSToF %72 %343 + %345 = OpAccessChain %51 %50 %22 %35 + %346 = OpLoad %6 %345 + %347 = OpConvertSToF %72 %346 + %348 = OpAccessChain %51 %50 %22 %35 + %349 = OpLoad %6 %348 + %350 = OpConvertSToF %72 %349 + %351 = OpAccessChain %51 %50 %22 %23 + %352 = OpLoad %6 %351 + %353 = OpConvertSToF %72 %352 + %354 = OpCompositeConstruct %73 %344 %347 %350 %353 + OpStore %75 %354 + OpBranch %341 + %341 = OpLabel + %356 = OpAccessChain %51 %50 %22 %35 + %357 = OpLoad %6 %356 + %358 = OpAccessChain %51 %50 %22 %24 + %359 = OpLoad %6 %358 + %360 = OpAccessChain %51 %50 %22 %22 + %361 = OpLoad %6 %360 + %362 = OpAccessChain %51 %50 %22 %25 + %363 = OpLoad %6 %362 + %364 = OpAccessChain %51 %50 %22 %26 + %365 = OpLoad %6 %364 + %366 = OpAccessChain %51 %50 %22 %27 + %367 = OpLoad %6 %366 + %368 = OpAccessChain %51 %50 %22 %28 + %369 = OpLoad %6 %368 + %370 = OpAccessChain %51 %50 %22 %29 + %371 = OpLoad %6 %370 + %372 = OpAccessChain %51 %50 %22 %30 + %373 = OpLoad %6 %372 + %374 = OpAccessChain %51 %50 %22 %31 + %375 = OpLoad %6 %374 + %376 = OpCompositeConstruct %19 %357 %359 %361 %363 %365 %367 %369 %371 %373 %375 + OpStore %355 %376 + %378 = OpAccessChain %51 %50 %22 %34 + %379 = OpLoad %6 %378 + %380 = OpAccessChain %51 %50 %22 %24 + %381 = OpLoad %6 %380 + %382 = OpAccessChain %51 %50 %22 %22 + %383 = OpLoad %6 %382 + %384 = OpAccessChain %51 %50 %22 %25 + %385 = OpLoad %6 %384 + %386 = OpAccessChain %51 %50 %22 %26 + %387 = OpLoad %6 %386 + %388 = OpAccessChain %51 %50 %22 %27 + %389 = OpLoad %6 %388 + %390 = OpAccessChain %51 %50 %22 %28 + %391 = OpLoad %6 %390 + %392 = OpAccessChain %51 %50 %22 %29 + %393 = OpLoad %6 %392 + %394 = OpAccessChain %51 %50 %22 %30 + %395 = OpLoad %6 %394 + %396 = OpAccessChain %51 %50 %22 %31 + %397 = OpLoad %6 %396 + %398 = OpCompositeConstruct %19 %379 %381 %383 %385 %387 %389 %391 %393 %395 %397 + OpStore %377 %398 + %400 = OpAccessChain %51 %50 %22 %35 + %401 = OpLoad %6 %400 + OpStore %399 %401 + OpBranch %402 + %402 = OpLabel + OpLoopMerge %404 %405 None + OpBranch %406 + %406 = OpLabel + %407 = OpLoad %6 %399 + %408 = OpAccessChain %51 %50 %22 %34 + %409 = OpLoad %6 %408 + %410 = OpSLessThan %65 %407 %409 + OpBranchConditional %410 %403 %404 + %403 = OpLabel + %411 = OpLoad %6 %399 + %412 = OpAccessChain %181 %21 %411 + %413 = OpLoad %6 %412 + %414 = OpLoad %6 %399 + %415 = OpAccessChain %7 %355 %414 + %416 = OpLoad %6 %415 + %417 = OpINotEqual %65 %413 %416 + %418 = OpLogicalNot %65 %417 + OpSelectionMerge %420 None + OpBranchConditional %418 %419 %420 + %419 = OpLabel + %421 = OpLoad %6 %399 + %422 = OpAccessChain %181 %33 %421 + %423 = OpLoad %6 %422 + %424 = OpLoad %6 %399 + %425 = OpAccessChain %7 %377 %424 + %426 = OpLoad %6 %425 + %427 = OpINotEqual %65 %423 %426 + OpBranch %420 + %420 = OpLabel + %428 = OpPhi %65 %417 %403 %427 %419 + OpSelectionMerge %430 None + OpBranchConditional %428 %429 %430 + %429 = OpLabel + %431 = OpAccessChain %51 %50 %22 %35 + %432 = OpLoad %6 %431 + %433 = OpConvertSToF %72 %432 + %434 = OpCompositeConstruct %73 %433 %433 %433 %433 + OpStore %75 %434 + OpBranch %430 + %430 = OpLabel + OpBranch %405 + %405 = OpLabel + %435 = OpLoad %6 %399 + %436 = OpIAdd %6 %435 %23 + OpStore %399 %436 + OpBranch %402 + %404 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %45 = OpVariable %7 Function + %54 = OpVariable %7 Function + %55 = OpVariable %7 Function + %80 = OpVariable %7 Function + %173 = OpVariable %172 Function + %227 = OpVariable %226 Function + %231 = OpVariable %7 Function + %52 = OpAccessChain %51 %50 %22 %23 + %53 = OpLoad %6 %52 + OpStore %45 %53 + OpStore %54 %23 + %56 = OpAccessChain %51 %50 %22 %23 + %57 = OpLoad %6 %56 + OpStore %55 %57 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %6 %54 + %64 = OpLoad %6 %10 + %66 = OpSLessThanEqual %65 %63 %64 + OpBranchConditional %66 %59 %60 + %59 = OpLabel + %67 = OpLoad %6 %54 + %68 = OpLoad %6 %55 + %69 = OpSLessThanEqual %65 %67 %68 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %176 + %70 = OpLabel + %76 = OpAccessChain %51 %50 %22 %23 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %72 %77 + %79 = OpCompositeConstruct %73 %78 %78 %78 %78 + OpStore %75 %79 + %81 = OpAccessChain %51 %50 %22 %23 + %82 = OpLoad %6 %81 + %83 = OpSNegate %6 %82 + OpStore %80 %83 + OpBranch %84 + %84 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %89 = OpLoad %6 %80 + %90 = OpAccessChain %51 %50 %22 %23 + %91 = OpLoad %6 %90 + %92 = OpINotEqual %65 %89 %91 + OpBranchConditional %92 %85 %86 + %85 = OpLabel + %93 = OpAccessChain %51 %50 %22 %23 + %94 = OpLoad %6 %93 + %95 = OpAccessChain %51 %50 %22 %24 + %96 = OpLoad %6 %95 + %97 = OpAccessChain %51 %50 %22 %22 + %98 = OpLoad %6 %97 + %100 = OpCompositeConstruct %99 %94 %96 %98 + %101 = OpAccessChain %51 %50 %22 %23 + %102 = OpLoad %6 %101 + %103 = OpAccessChain %51 %50 %22 %24 + %104 = OpLoad %6 %103 + %105 = OpAccessChain %51 %50 %22 %22 + %106 = OpLoad %6 %105 + %107 = OpCompositeConstruct %99 %102 %104 %106 + %108 = OpAccessChain %51 %50 %22 %23 + %109 = OpLoad %6 %108 + %110 = OpAccessChain %51 %50 %22 %24 + %111 = OpLoad %6 %110 + %112 = OpAccessChain %51 %50 %22 %22 + %113 = OpLoad %6 %112 + %114 = OpCompositeConstruct %99 %109 %111 %113 + %115 = OpAccessChain %51 %50 %22 %23 + %116 = OpLoad %6 %115 + %117 = OpAccessChain %51 %50 %22 %24 + %118 = OpLoad %6 %117 + %119 = OpAccessChain %51 %50 %22 %22 + %120 = OpLoad %6 %119 + %121 = OpCompositeConstruct %99 %116 %118 %120 + %122 = OpAccessChain %51 %50 %22 %23 + %123 = OpLoad %6 %122 + %124 = OpAccessChain %51 %50 %22 %24 + %125 = OpLoad %6 %124 + %126 = OpAccessChain %51 %50 %22 %22 + %127 = OpLoad %6 %126 + %128 = OpCompositeConstruct %99 %123 %125 %127 + %129 = OpAccessChain %51 %50 %22 %23 + %130 = OpLoad %6 %129 + %131 = OpAccessChain %51 %50 %22 %24 + %132 = OpLoad %6 %131 + %133 = OpAccessChain %51 %50 %22 %22 + %134 = OpLoad %6 %133 + %135 = OpCompositeConstruct %99 %130 %132 %134 + %136 = OpAccessChain %51 %50 %22 %23 + %137 = OpLoad %6 %136 + %138 = OpAccessChain %51 %50 %22 %24 + %139 = OpLoad %6 %138 + %140 = OpAccessChain %51 %50 %22 %22 + %141 = OpLoad %6 %140 + %142 = OpCompositeConstruct %99 %137 %139 %141 + %143 = OpAccessChain %51 %50 %22 %23 + %144 = OpLoad %6 %143 + %145 = OpAccessChain %51 %50 %22 %24 + %146 = OpLoad %6 %145 + %147 = OpAccessChain %51 %50 %22 %22 + %148 = OpLoad %6 %147 + %149 = OpCompositeConstruct %99 %144 %146 %148 + %150 = OpAccessChain %51 %50 %22 %23 + %151 = OpLoad %6 %150 + %152 = OpAccessChain %51 %50 %22 %24 + %153 = OpLoad %6 %152 + %154 = OpAccessChain %51 %50 %22 %22 + %155 = OpLoad %6 %154 + %156 = OpCompositeConstruct %99 %151 %153 %155 + %157 = OpAccessChain %51 %50 %22 %23 + %158 = OpLoad %6 %157 + %159 = OpAccessChain %51 %50 %22 %24 + %160 = OpLoad %6 %159 + %161 = OpAccessChain %51 %50 %22 %22 + %162 = OpLoad %6 %161 + %163 = OpCompositeConstruct %99 %158 %160 %162 + %165 = OpCompositeConstruct %164 %100 %107 %114 %121 %128 %135 %142 %149 %156 %163 + %166 = OpLoad %6 %80 + %167 = OpAccessChain %51 %50 %22 %35 + %168 = OpLoad %6 %167 + %169 = OpAccessChain %51 %50 %22 %36 + %170 = OpLoad %6 %169 + %171 = OpExtInst %6 %1 SClamp %166 %168 %170 + OpStore %173 %165 + %174 = OpAccessChain %7 %173 %171 %22 + %175 = OpLoad %6 %174 + OpStore %80 %175 + OpBranch %87 + %87 = OpLabel + OpBranch %84 + %86 = OpLabel + OpBranch %71 + %176 = OpLabel + %177 = OpLoad %6 %45 + %178 = OpIAdd %6 %177 %23 + OpStore %45 %178 + %179 = OpLoad %6 %55 + %180 = OpIAdd %6 %179 %23 + OpStore %55 %180 + %182 = OpAccessChain %181 %21 %179 + %183 = OpLoad %6 %182 + %184 = OpAccessChain %181 %33 %177 + OpStore %184 %183 + OpBranch %71 + %71 = OpLabel + %185 = OpLoad %6 %54 + %186 = OpIAdd %6 %185 %23 + OpStore %54 %186 + OpBranch %61 + %61 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %187 + %187 = OpLabel + OpLoopMerge %189 %190 None + OpBranch %191 + %191 = OpLabel + %192 = OpLoad %6 %54 + %193 = OpSLessThan %65 %192 %27 + OpSelectionMerge %195 None + OpBranchConditional %193 %194 %195 + %194 = OpLabel + %196 = OpLoad %6 %45 + %197 = OpAccessChain %51 %50 %22 %34 + %198 = OpLoad %6 %197 + %199 = OpSLessThan %65 %196 %198 + OpBranch %195 + %195 = OpLabel + %200 = OpPhi %65 %193 %191 %199 %194 + OpBranchConditional %200 %188 %189 + %188 = OpLabel + %201 = OpLoad %6 %45 + %202 = OpIAdd %6 %201 %23 + OpStore %45 %202 + %203 = OpAccessChain %51 %50 %22 %35 + %204 = OpLoad %6 %203 + %205 = OpAccessChain %51 %50 %22 %23 + %206 = OpLoad %6 %205 + %207 = OpAccessChain %51 %50 %22 %24 + %208 = OpLoad %6 %207 + %209 = OpAccessChain %51 %50 %22 %22 + %210 = OpLoad %6 %209 + %211 = OpAccessChain %51 %50 %22 %25 + %212 = OpLoad %6 %211 + %213 = OpAccessChain %51 %50 %22 %37 + %214 = OpLoad %6 %213 + %215 = OpAccessChain %51 %50 %22 %38 + %216 = OpLoad %6 %215 + %217 = OpAccessChain %51 %50 %22 %39 + %218 = OpLoad %6 %217 + %219 = OpAccessChain %51 %50 %22 %40 + %220 = OpLoad %6 %219 + %221 = OpAccessChain %51 %50 %22 %36 + %222 = OpLoad %6 %221 + %223 = OpCompositeConstruct %19 %204 %206 %208 %210 %212 %214 %216 %218 %220 %222 + %224 = OpLoad %6 %54 + %225 = OpIAdd %6 %224 %23 + OpStore %54 %225 + OpStore %227 %223 + %228 = OpAccessChain %7 %227 %224 + %229 = OpLoad %6 %228 + %230 = OpAccessChain %181 %33 %201 + OpStore %230 %229 + OpBranch %190 + %190 = OpLabel + OpBranch %187 + %189 = OpLabel + %232 = OpLoad %6 %9 + OpStore %231 %232 + OpBranch %233 + %233 = OpLabel + OpLoopMerge %235 %236 None + OpBranch %237 + %237 = OpLabel + %238 = OpLoad %6 %231 + %239 = OpLoad %6 %11 + %240 = OpISub %6 %239 %23 + %241 = OpSLessThanEqual %65 %238 %240 + OpBranchConditional %241 %234 %235 + %234 = OpLabel + %242 = OpLoad %6 %231 + %243 = OpLoad %6 %231 + %244 = OpAccessChain %181 %33 %243 + %245 = OpLoad %6 %244 + %246 = OpAccessChain %181 %21 %242 + OpStore %246 %245 + OpBranch %236 + %236 = OpLabel + %247 = OpLoad %6 %231 + %248 = OpIAdd %6 %247 %23 + OpStore %231 %248 + OpBranch %233 + %235 = OpLabel + OpReturn + OpFunctionEnd + %15 = OpFunction %6 None %14 + %16 = OpLabel + %249 = OpVariable %7 Function + %252 = OpVariable %7 Function + %260 = OpVariable %7 Function + %272 = OpVariable %7 Function + %274 = OpVariable %7 Function + %276 = OpVariable %7 Function + %292 = OpVariable %291 Function + %250 = OpAccessChain %51 %50 %22 %23 + %251 = OpLoad %6 %250 + OpStore %249 %251 + OpStore %252 %23 + OpBranch %253 + %253 = OpLabel + OpLoopMerge %255 %256 None + OpBranch %257 + %257 = OpLabel + %258 = OpLoad %6 %252 + %259 = OpSLessThan %65 %258 %34 + OpBranchConditional %259 %254 %255 + %254 = OpLabel + OpStore %260 %23 + OpBranch %261 + %261 = OpLabel + OpLoopMerge %263 %264 None + OpBranch %265 + %265 = OpLabel + %266 = OpLoad %6 %260 + %267 = OpSLessThan %65 %266 %34 + OpBranchConditional %267 %262 %263 + %262 = OpLabel + %268 = OpLoad %6 %252 + %269 = OpLoad %6 %260 + %270 = OpIAdd %6 %268 %269 + %271 = OpExtInst %6 %1 SMin %270 %34 + %273 = OpLoad %6 %252 + OpStore %272 %273 + %275 = OpLoad %6 %260 + OpStore %274 %275 + OpStore %276 %271 + %277 = OpFunctionCall %2 %12 %272 %274 %276 + OpBranch %264 + %264 = OpLabel + %278 = OpLoad %6 %252 + %279 = OpLoad %6 %260 + %280 = OpIAdd %6 %279 %278 + OpStore %260 %280 + OpBranch %261 + %263 = OpLabel + OpBranch %281 + %281 = OpLabel + OpLoopMerge %283 %284 None + OpBranch %285 + %285 = OpLabel + %286 = OpLoad %6 %249 + %287 = OpAccessChain %51 %50 %22 %37 + %288 = OpLoad %6 %287 + %289 = OpSLessThan %65 %286 %288 + OpBranchConditional %289 %282 %283 + %282 = OpLabel + %299 = OpAccessChain %298 %297 %22 %22 + %300 = OpLoad %72 %299 + %302 = OpCompositeConstruct %301 %300 %300 + %306 = OpAccessChain %298 %305 %22 + %307 = OpLoad %72 %306 + %308 = OpCompositeConstruct %301 %307 %307 + %309 = OpFDiv %301 %302 %308 + %310 = OpConvertFToS %290 %309 + OpStore %292 %310 + OpBranch %311 + %311 = OpLabel + OpLoopMerge %313 %314 None + OpBranch %315 + %315 = OpLabel + %317 = OpAccessChain %7 %292 %316 + %318 = OpLoad %6 %317 + %319 = OpAccessChain %7 %292 %293 + %320 = OpLoad %6 %319 + %321 = OpIAdd %6 %318 %320 + %322 = OpAccessChain %51 %50 %22 %24 + %323 = OpLoad %6 %322 + %324 = OpSGreaterThan %65 %321 %323 + OpBranchConditional %324 %312 %313 + %312 = OpLabel + OpBranch %314 + %314 = OpLabel + OpBranch %311 + %313 = OpLabel + %325 = OpLoad %6 %249 + %326 = OpIAdd %6 %325 %23 + OpStore %249 %326 + OpBranch %284 + %284 = OpLabel + OpBranch %281 + %283 = OpLabel + OpBranch %256 + %256 = OpLabel + %327 = OpLoad %6 %252 + %328 = OpIMul %6 %327 %24 + OpStore %252 %328 + OpBranch %253 + %255 = OpLabel + %329 = OpLoad %6 %249 + OpReturnValue %329 + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE float STD140 DATA + 2.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 1 2 4 14 15 16 17 18 19 10 0 9 5 6 7 8 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-two-functions-modify-struct-array-element-return-from-loop.amber b/vulkan/amber/graphicsfuzz/cov-two-functions-modify-struct-array-element-return-from-loop.amber new file mode 100644 index 0000000..26b5696 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-two-functions-modify-struct-array-element-return-from-loop.amber @@ -0,0 +1,318 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_3 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 3] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# struct S { +# int data; +# }; +# +# S arr[10] = S[10](S(0), S(1), S(2), S(3), S(4), S(5), S(6), S(7), S(8), S(9)); +# +# layout(location = 0) out vec4 _GLF_color; +# +# void func0(inout S s) +# { +# // Iterates once. +# for(int i = 1; i > 0; i--) +# { +# s.data = -_int_1; +# } +# } +# +# int func1() +# { +# int index = _int_0; +# +# for(int i = _int_0; i < _int_3; i++) +# { +# // True on the second iteration. +# if(arr[index].data == -_int_1) +# { +# return _int_1; +# } +# +# index = _int_1; +# } +# +# // Never executed. +# return _int_0; +# } +# +# void main() +# { +# // Sets arr[0].data to -1. +# func0(arr[_int_1]); +# +# // Always true. +# if(func1() == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 137 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %118 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "S" + OpMemberName %7 0 "data" + OpName %11 "func0(struct-S-i11;" + OpName %10 "s" + OpName %14 "func1(" + OpName %20 "arr" + OpName %43 "i" + OpName %54 "buf0" + OpMemberName %54 0 "_GLF_uniform_int_values" + OpName %56 "" + OpName %64 "index" + OpName %67 "i" + OpName %102 "param" + OpName %118 "_GLF_color" + OpDecorate %53 ArrayStride 16 + OpMemberDecorate %54 0 Offset 0 + OpDecorate %54 Block + OpDecorate %56 DescriptorSet 0 + OpDecorate %56 Binding 0 + OpDecorate %118 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %2 %8 + %13 = OpTypeFunction %6 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 10 + %18 = OpTypeArray %7 %17 + %19 = OpTypePointer Private %18 + %20 = OpVariable %19 Private + %21 = OpConstant %6 0 + %22 = OpConstantComposite %7 %21 + %23 = OpConstant %6 1 + %24 = OpConstantComposite %7 %23 + %25 = OpConstant %6 2 + %26 = OpConstantComposite %7 %25 + %27 = OpConstant %6 3 + %28 = OpConstantComposite %7 %27 + %29 = OpConstant %6 4 + %30 = OpConstantComposite %7 %29 + %31 = OpConstant %6 5 + %32 = OpConstantComposite %7 %31 + %33 = OpConstant %6 6 + %34 = OpConstantComposite %7 %33 + %35 = OpConstant %6 7 + %36 = OpConstantComposite %7 %35 + %37 = OpConstant %6 8 + %38 = OpConstantComposite %7 %37 + %39 = OpConstant %6 9 + %40 = OpConstantComposite %7 %39 + %41 = OpConstantComposite %18 %22 %24 %26 %28 %30 %32 %34 %36 %38 %40 + %42 = OpTypePointer Function %6 + %50 = OpTypeBool + %52 = OpConstant %16 3 + %53 = OpTypeArray %6 %52 + %54 = OpTypeStruct %53 + %55 = OpTypePointer Uniform %54 + %56 = OpVariable %55 Uniform + %57 = OpTypePointer Uniform %6 + %80 = OpTypePointer Private %6 + %103 = OpTypePointer Private %7 + %115 = OpTypeFloat 32 + %116 = OpTypeVector %115 4 + %117 = OpTypePointer Output %116 + %118 = OpVariable %117 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %102 = OpVariable %8 Function + OpStore %20 %41 + %100 = OpAccessChain %57 %56 %21 %21 + %101 = OpLoad %6 %100 + %104 = OpAccessChain %103 %20 %101 + %105 = OpLoad %7 %104 + OpStore %102 %105 + %106 = OpFunctionCall %2 %11 %102 + %107 = OpLoad %7 %102 + %108 = OpAccessChain %103 %20 %101 + OpStore %108 %107 + %109 = OpFunctionCall %6 %14 + %110 = OpAccessChain %57 %56 %21 %21 + %111 = OpLoad %6 %110 + %112 = OpIEqual %50 %109 %111 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %132 + %113 = OpLabel + %119 = OpAccessChain %57 %56 %21 %21 + %120 = OpLoad %6 %119 + %121 = OpConvertSToF %115 %120 + %122 = OpAccessChain %57 %56 %21 %23 + %123 = OpLoad %6 %122 + %124 = OpConvertSToF %115 %123 + %125 = OpAccessChain %57 %56 %21 %23 + %126 = OpLoad %6 %125 + %127 = OpConvertSToF %115 %126 + %128 = OpAccessChain %57 %56 %21 %21 + %129 = OpLoad %6 %128 + %130 = OpConvertSToF %115 %129 + %131 = OpCompositeConstruct %116 %121 %124 %127 %130 + OpStore %118 %131 + OpBranch %114 + %132 = OpLabel + %133 = OpAccessChain %57 %56 %21 %23 + %134 = OpLoad %6 %133 + %135 = OpConvertSToF %115 %134 + %136 = OpCompositeConstruct %116 %135 %135 %135 %135 + OpStore %118 %136 + OpBranch %114 + %114 = OpLabel + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %9 + %10 = OpFunctionParameter %8 + %12 = OpLabel + %43 = OpVariable %42 Function + OpStore %43 %23 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %6 %43 + %51 = OpSGreaterThan %50 %49 %21 + OpBranchConditional %51 %45 %46 + %45 = OpLabel + %58 = OpAccessChain %57 %56 %21 %21 + %59 = OpLoad %6 %58 + %60 = OpSNegate %6 %59 + %61 = OpAccessChain %42 %10 %21 + OpStore %61 %60 + OpBranch %47 + %47 = OpLabel + %62 = OpLoad %6 %43 + %63 = OpISub %6 %62 %23 + OpStore %43 %63 + OpBranch %44 + %46 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %6 None %13 + %15 = OpLabel + %64 = OpVariable %42 Function + %67 = OpVariable %42 Function + %65 = OpAccessChain %57 %56 %21 %23 + %66 = OpLoad %6 %65 + OpStore %64 %66 + %68 = OpAccessChain %57 %56 %21 %23 + %69 = OpLoad %6 %68 + OpStore %67 %69 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %6 %67 + %76 = OpAccessChain %57 %56 %21 %25 + %77 = OpLoad %6 %76 + %78 = OpSLessThan %50 %75 %77 + OpBranchConditional %78 %71 %72 + %71 = OpLabel + %79 = OpLoad %6 %64 + %81 = OpAccessChain %80 %20 %79 %21 + %82 = OpLoad %6 %81 + %83 = OpAccessChain %57 %56 %21 %21 + %84 = OpLoad %6 %83 + %85 = OpSNegate %6 %84 + %86 = OpIEqual %50 %82 %85 + OpSelectionMerge %88 None + OpBranchConditional %86 %87 %88 + %87 = OpLabel + %89 = OpAccessChain %57 %56 %21 %21 + %90 = OpLoad %6 %89 + OpReturnValue %90 + %88 = OpLabel + %92 = OpAccessChain %57 %56 %21 %21 + %93 = OpLoad %6 %92 + OpStore %64 %93 + OpBranch %73 + %73 = OpLabel + %94 = OpLoad %6 %67 + %95 = OpIAdd %6 %94 %23 + OpStore %67 %95 + OpBranch %70 + %72 = OpLabel + %96 = OpAccessChain %57 %56 %21 %23 + %97 = OpLoad %6 %96 + OpReturnValue %97 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 3 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-two-loops-global-loop-counter-clamp-ivec-elements-index-array.amber b/vulkan/amber/graphicsfuzz/cov-two-loops-global-loop-counter-clamp-ivec-elements-index-array.amber new file mode 100644 index 0000000..1fab690 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-two-loops-global-loop-counter-clamp-ivec-elements-index-array.amber @@ -0,0 +1,394 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# const int _GLF_global_loop_bound = 90; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr0[20] = int[20](_int_0, _int_1, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0, _int_0); +# float arr1[2] = float[2](_float_0_0, _float_1_0); +# int a = 1; +# +# // Iterates six times. +# do +# { +# _GLF_global_loop_count++; +# +# if(a++ >= 6) +# { +# break; +# } +# +# arr1[_int_0] = arr1[_int_1]; +# } +# while(_GLF_global_loop_count < _GLF_global_loop_bound); +# +# // Iterates until global loop count is reached. +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count++; +# ivec2 v = ivec2(1, 20); +# +# // Always true. +# if(arr0[_int_1] == _int_1) +# { +# v.x -= 1; +# } +# +# // Always true. +# if(arr0[19] == 0) +# { +# // arr0[19] = 1. +# arr0[clamp(v.x + v.y * 16, _int_0, 19)] = 1; +# } +# } +# +# // Always true. +# if(arr0[19] == _int_1 && arr1[_int_0] == _float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 188 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %169 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %14 "arr0" + OpName %17 "buf1" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %66 "arr1" + OpName %68 "buf0" + OpMemberName %68 0 "_GLF_uniform_float_values" + OpName %70 "" + OpName %78 "a" + OpName %115 "v" + OpName %169 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %67 ArrayStride 16 + OpMemberDecorate %68 0 Offset 0 + OpDecorate %68 Block + OpDecorate %70 DescriptorSet 0 + OpDecorate %70 Binding 0 + OpDecorate %169 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 20 + %12 = OpTypeArray %6 %11 + %13 = OpTypePointer Function %12 + %15 = OpConstant %10 2 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypePointer Uniform %6 + %23 = OpConstant %6 1 + %63 = OpTypeFloat 32 + %64 = OpTypeArray %63 %15 + %65 = OpTypePointer Function %64 + %67 = OpTypeArray %63 %15 + %68 = OpTypeStruct %67 + %69 = OpTypePointer Uniform %68 + %70 = OpVariable %69 Uniform + %71 = OpTypePointer Uniform %63 + %77 = OpTypePointer Function %6 + %87 = OpConstant %6 6 + %88 = OpTypeBool + %97 = OpTypePointer Function %63 + %102 = OpConstant %6 90 + %113 = OpTypeVector %6 2 + %114 = OpTypePointer Function %113 + %116 = OpConstant %6 20 + %117 = OpConstantComposite %113 %23 %116 + %127 = OpConstant %10 0 + %132 = OpConstant %6 19 + %140 = OpConstant %10 1 + %143 = OpConstant %6 16 + %167 = OpTypeVector %63 4 + %168 = OpTypePointer Output %167 + %169 = OpVariable %168 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpVariable %13 Function + %66 = OpVariable %65 Function + %78 = OpVariable %77 Function + %115 = OpVariable %114 Function + OpStore %8 %9 + %21 = OpAccessChain %20 %19 %9 %9 + %22 = OpLoad %6 %21 + %24 = OpAccessChain %20 %19 %9 %23 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %20 %19 %9 %9 + %27 = OpLoad %6 %26 + %28 = OpAccessChain %20 %19 %9 %9 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %20 %19 %9 %9 + %31 = OpLoad %6 %30 + %32 = OpAccessChain %20 %19 %9 %9 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %20 %19 %9 %9 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %20 %19 %9 %9 + %37 = OpLoad %6 %36 + %38 = OpAccessChain %20 %19 %9 %9 + %39 = OpLoad %6 %38 + %40 = OpAccessChain %20 %19 %9 %9 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %20 %19 %9 %9 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %20 %19 %9 %9 + %45 = OpLoad %6 %44 + %46 = OpAccessChain %20 %19 %9 %9 + %47 = OpLoad %6 %46 + %48 = OpAccessChain %20 %19 %9 %9 + %49 = OpLoad %6 %48 + %50 = OpAccessChain %20 %19 %9 %9 + %51 = OpLoad %6 %50 + %52 = OpAccessChain %20 %19 %9 %9 + %53 = OpLoad %6 %52 + %54 = OpAccessChain %20 %19 %9 %9 + %55 = OpLoad %6 %54 + %56 = OpAccessChain %20 %19 %9 %9 + %57 = OpLoad %6 %56 + %58 = OpAccessChain %20 %19 %9 %9 + %59 = OpLoad %6 %58 + %60 = OpAccessChain %20 %19 %9 %9 + %61 = OpLoad %6 %60 + %62 = OpCompositeConstruct %12 %22 %25 %27 %29 %31 %33 %35 %37 %39 %41 %43 %45 %47 %49 %51 %53 %55 %57 %59 %61 + OpStore %14 %62 + %72 = OpAccessChain %71 %70 %9 %9 + %73 = OpLoad %63 %72 + %74 = OpAccessChain %71 %70 %9 %23 + %75 = OpLoad %63 %74 + %76 = OpCompositeConstruct %64 %73 %75 + OpStore %66 %76 + OpStore %78 %23 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %80 + %80 = OpLabel + %83 = OpLoad %6 %8 + %84 = OpIAdd %6 %83 %23 + OpStore %8 %84 + %85 = OpLoad %6 %78 + %86 = OpIAdd %6 %85 %23 + OpStore %78 %86 + %89 = OpSGreaterThanEqual %88 %85 %87 + OpSelectionMerge %91 None + OpBranchConditional %89 %90 %91 + %90 = OpLabel + OpBranch %81 + %91 = OpLabel + %93 = OpAccessChain %20 %19 %9 %9 + %94 = OpLoad %6 %93 + %95 = OpAccessChain %20 %19 %9 %23 + %96 = OpLoad %6 %95 + %98 = OpAccessChain %97 %66 %96 + %99 = OpLoad %63 %98 + %100 = OpAccessChain %97 %66 %94 + OpStore %100 %99 + OpBranch %82 + %82 = OpLabel + %101 = OpLoad %6 %8 + %103 = OpSLessThan %88 %101 %102 + OpBranchConditional %103 %79 %81 + %81 = OpLabel + OpBranch %104 + %104 = OpLabel + OpLoopMerge %106 %107 None + OpBranch %108 + %108 = OpLabel + %109 = OpLoad %6 %8 + %110 = OpSLessThan %88 %109 %102 + OpBranchConditional %110 %105 %106 + %105 = OpLabel + %111 = OpLoad %6 %8 + %112 = OpIAdd %6 %111 %23 + OpStore %8 %112 + OpStore %115 %117 + %118 = OpAccessChain %20 %19 %9 %23 + %119 = OpLoad %6 %118 + %120 = OpAccessChain %77 %14 %119 + %121 = OpLoad %6 %120 + %122 = OpAccessChain %20 %19 %9 %23 + %123 = OpLoad %6 %122 + %124 = OpIEqual %88 %121 %123 + OpSelectionMerge %126 None + OpBranchConditional %124 %125 %126 + %125 = OpLabel + %128 = OpAccessChain %77 %115 %127 + %129 = OpLoad %6 %128 + %130 = OpISub %6 %129 %23 + %131 = OpAccessChain %77 %115 %127 + OpStore %131 %130 + OpBranch %126 + %126 = OpLabel + %133 = OpAccessChain %77 %14 %132 + %134 = OpLoad %6 %133 + %135 = OpIEqual %88 %134 %9 + OpSelectionMerge %137 None + OpBranchConditional %135 %136 %137 + %136 = OpLabel + %138 = OpAccessChain %77 %115 %127 + %139 = OpLoad %6 %138 + %141 = OpAccessChain %77 %115 %140 + %142 = OpLoad %6 %141 + %144 = OpIMul %6 %142 %143 + %145 = OpIAdd %6 %139 %144 + %146 = OpAccessChain %20 %19 %9 %9 + %147 = OpLoad %6 %146 + %148 = OpExtInst %6 %1 SClamp %145 %147 %132 + %149 = OpAccessChain %77 %14 %148 + OpStore %149 %23 + OpBranch %137 + %137 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %104 + %106 = OpLabel + %150 = OpAccessChain %77 %14 %132 + %151 = OpLoad %6 %150 + %152 = OpAccessChain %20 %19 %9 %23 + %153 = OpLoad %6 %152 + %154 = OpIEqual %88 %151 %153 + OpSelectionMerge %156 None + OpBranchConditional %154 %155 %156 + %155 = OpLabel + %157 = OpAccessChain %20 %19 %9 %9 + %158 = OpLoad %6 %157 + %159 = OpAccessChain %97 %66 %158 + %160 = OpLoad %63 %159 + %161 = OpAccessChain %71 %70 %9 %23 + %162 = OpLoad %63 %161 + %163 = OpFOrdEqual %88 %160 %162 + OpBranch %156 + %156 = OpLabel + %164 = OpPhi %88 %154 %106 %163 %155 + OpSelectionMerge %166 None + OpBranchConditional %164 %165 %183 + %165 = OpLabel + %170 = OpAccessChain %20 %19 %9 %23 + %171 = OpLoad %6 %170 + %172 = OpConvertSToF %63 %171 + %173 = OpAccessChain %20 %19 %9 %9 + %174 = OpLoad %6 %173 + %175 = OpConvertSToF %63 %174 + %176 = OpAccessChain %20 %19 %9 %9 + %177 = OpLoad %6 %176 + %178 = OpConvertSToF %63 %177 + %179 = OpAccessChain %20 %19 %9 %23 + %180 = OpLoad %6 %179 + %181 = OpConvertSToF %63 %180 + %182 = OpCompositeConstruct %167 %172 %175 %178 %181 + OpStore %169 %182 + OpBranch %166 + %183 = OpLabel + %184 = OpAccessChain %20 %19 %9 %9 + %185 = OpLoad %6 %184 + %186 = OpConvertSToF %63 %185 + %187 = OpCompositeConstruct %167 %186 %186 %186 %186 + OpStore %169 %187 + OpBranch %166 + %166 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-two-loops-global-loop-counter-shift-right-zero-increment-array-element.amber b/vulkan/amber/graphicsfuzz/cov-two-loops-global-loop-counter-shift-right-zero-increment-array-element.amber new file mode 100644 index 0000000..010ce57 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-two-loops-global-loop-counter-shift-right-zero-increment-array-element.amber @@ -0,0 +1,350 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_9 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# #define _int_0 _GLF_uniform_int_values[3] +# #define _int_32 _GLF_uniform_int_values[4] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 9, 10, 0, 32] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int arr[32] = int[32](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1); +# +# // Iterated once. +# for(int i = _int_1; _GLF_global_loop_count < _GLF_global_loop_bound; ) +# { +# _GLF_global_loop_count ++; +# +# // Always true. +# if(_int_1 > _int_0) +# { +# break; +# } +# } +# +# // Iterated nine times until global loop count is reached. +# for(int i = _int_1; i < _int_32 && _GLF_global_loop_count < _GLF_global_loop_bound; i++) +# { +# _GLF_global_loop_count++; +# // arr[i] = arr[i - 1]; +# arr[i] += arr[i - (_int_1 >> _int_0)]; +# } +# +# // Always true. +# if(arr[_int_9] == _int_10 && arr[_int_10] == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 187 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %168 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %14 "arr" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %87 "i" + OpName %111 "i" + OpName %168 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %168 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 32 + %12 = OpTypeArray %6 %11 + %13 = OpTypePointer Function %12 + %15 = OpConstant %10 5 + %16 = OpTypeArray %6 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypePointer Uniform %6 + %86 = OpTypePointer Function %6 + %96 = OpConstant %6 10 + %97 = OpTypeBool + %100 = OpConstant %6 1 + %104 = OpConstant %6 3 + %120 = OpConstant %6 4 + %149 = OpConstant %6 2 + %165 = OpTypeFloat 32 + %166 = OpTypeVector %165 4 + %167 = OpTypePointer Output %166 + %168 = OpVariable %167 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpVariable %13 Function + %87 = OpVariable %86 Function + %111 = OpVariable %86 Function + OpStore %8 %9 + %21 = OpAccessChain %20 %19 %9 %9 + %22 = OpLoad %6 %21 + %23 = OpAccessChain %20 %19 %9 %9 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %20 %19 %9 %9 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %20 %19 %9 %9 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %20 %19 %9 %9 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %20 %19 %9 %9 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %20 %19 %9 %9 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %20 %19 %9 %9 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %20 %19 %9 %9 + %38 = OpLoad %6 %37 + %39 = OpAccessChain %20 %19 %9 %9 + %40 = OpLoad %6 %39 + %41 = OpAccessChain %20 %19 %9 %9 + %42 = OpLoad %6 %41 + %43 = OpAccessChain %20 %19 %9 %9 + %44 = OpLoad %6 %43 + %45 = OpAccessChain %20 %19 %9 %9 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %20 %19 %9 %9 + %48 = OpLoad %6 %47 + %49 = OpAccessChain %20 %19 %9 %9 + %50 = OpLoad %6 %49 + %51 = OpAccessChain %20 %19 %9 %9 + %52 = OpLoad %6 %51 + %53 = OpAccessChain %20 %19 %9 %9 + %54 = OpLoad %6 %53 + %55 = OpAccessChain %20 %19 %9 %9 + %56 = OpLoad %6 %55 + %57 = OpAccessChain %20 %19 %9 %9 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %20 %19 %9 %9 + %60 = OpLoad %6 %59 + %61 = OpAccessChain %20 %19 %9 %9 + %62 = OpLoad %6 %61 + %63 = OpAccessChain %20 %19 %9 %9 + %64 = OpLoad %6 %63 + %65 = OpAccessChain %20 %19 %9 %9 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %20 %19 %9 %9 + %68 = OpLoad %6 %67 + %69 = OpAccessChain %20 %19 %9 %9 + %70 = OpLoad %6 %69 + %71 = OpAccessChain %20 %19 %9 %9 + %72 = OpLoad %6 %71 + %73 = OpAccessChain %20 %19 %9 %9 + %74 = OpLoad %6 %73 + %75 = OpAccessChain %20 %19 %9 %9 + %76 = OpLoad %6 %75 + %77 = OpAccessChain %20 %19 %9 %9 + %78 = OpLoad %6 %77 + %79 = OpAccessChain %20 %19 %9 %9 + %80 = OpLoad %6 %79 + %81 = OpAccessChain %20 %19 %9 %9 + %82 = OpLoad %6 %81 + %83 = OpAccessChain %20 %19 %9 %9 + %84 = OpLoad %6 %83 + %85 = OpCompositeConstruct %12 %22 %24 %26 %28 %30 %32 %34 %36 %38 %40 %42 %44 %46 %48 %50 %52 %54 %56 %58 %60 %62 %64 %66 %68 %70 %72 %74 %76 %78 %80 %82 %84 + OpStore %14 %85 + %88 = OpAccessChain %20 %19 %9 %9 + %89 = OpLoad %6 %88 + OpStore %87 %89 + OpBranch %90 + %90 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %6 %8 + %98 = OpSLessThan %97 %95 %96 + OpBranchConditional %98 %91 %92 + %91 = OpLabel + %99 = OpLoad %6 %8 + %101 = OpIAdd %6 %99 %100 + OpStore %8 %101 + %102 = OpAccessChain %20 %19 %9 %9 + %103 = OpLoad %6 %102 + %105 = OpAccessChain %20 %19 %9 %104 + %106 = OpLoad %6 %105 + %107 = OpSGreaterThan %97 %103 %106 + OpSelectionMerge %109 None + OpBranchConditional %107 %108 %109 + %108 = OpLabel + OpBranch %92 + %109 = OpLabel + OpBranch %93 + %93 = OpLabel + OpBranch %90 + %92 = OpLabel + %112 = OpAccessChain %20 %19 %9 %9 + %113 = OpLoad %6 %112 + OpStore %111 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %116 %117 None + OpBranch %118 + %118 = OpLabel + %119 = OpLoad %6 %111 + %121 = OpAccessChain %20 %19 %9 %120 + %122 = OpLoad %6 %121 + %123 = OpSLessThan %97 %119 %122 + %124 = OpLoad %6 %8 + %125 = OpSLessThan %97 %124 %96 + %126 = OpLogicalAnd %97 %123 %125 + OpBranchConditional %126 %115 %116 + %115 = OpLabel + %127 = OpLoad %6 %8 + %128 = OpIAdd %6 %127 %100 + OpStore %8 %128 + %129 = OpLoad %6 %111 + %130 = OpLoad %6 %111 + %131 = OpAccessChain %20 %19 %9 %9 + %132 = OpLoad %6 %131 + %133 = OpAccessChain %20 %19 %9 %104 + %134 = OpLoad %6 %133 + %135 = OpShiftRightArithmetic %6 %132 %134 + %136 = OpISub %6 %130 %135 + %137 = OpAccessChain %86 %14 %136 + %138 = OpLoad %6 %137 + %139 = OpAccessChain %86 %14 %129 + %140 = OpLoad %6 %139 + %141 = OpIAdd %6 %140 %138 + %142 = OpAccessChain %86 %14 %129 + OpStore %142 %141 + OpBranch %117 + %117 = OpLabel + %143 = OpLoad %6 %111 + %144 = OpIAdd %6 %143 %100 + OpStore %111 %144 + OpBranch %114 + %116 = OpLabel + %145 = OpAccessChain %20 %19 %9 %100 + %146 = OpLoad %6 %145 + %147 = OpAccessChain %86 %14 %146 + %148 = OpLoad %6 %147 + %150 = OpAccessChain %20 %19 %9 %149 + %151 = OpLoad %6 %150 + %152 = OpIEqual %97 %148 %151 + OpSelectionMerge %154 None + OpBranchConditional %152 %153 %154 + %153 = OpLabel + %155 = OpAccessChain %20 %19 %9 %149 + %156 = OpLoad %6 %155 + %157 = OpAccessChain %86 %14 %156 + %158 = OpLoad %6 %157 + %159 = OpAccessChain %20 %19 %9 %9 + %160 = OpLoad %6 %159 + %161 = OpIEqual %97 %158 %160 + OpBranch %154 + %154 = OpLabel + %162 = OpPhi %97 %152 %116 %161 %153 + OpSelectionMerge %164 None + OpBranchConditional %162 %163 %182 + %163 = OpLabel + %169 = OpAccessChain %20 %19 %9 %9 + %170 = OpLoad %6 %169 + %171 = OpConvertSToF %165 %170 + %172 = OpAccessChain %20 %19 %9 %104 + %173 = OpLoad %6 %172 + %174 = OpConvertSToF %165 %173 + %175 = OpAccessChain %20 %19 %9 %104 + %176 = OpLoad %6 %175 + %177 = OpConvertSToF %165 %176 + %178 = OpAccessChain %20 %19 %9 %9 + %179 = OpLoad %6 %178 + %180 = OpConvertSToF %165 %179 + %181 = OpCompositeConstruct %166 %171 %174 %177 %180 + OpStore %168 %181 + OpBranch %164 + %182 = OpLabel + %183 = OpAccessChain %20 %19 %9 %104 + %184 = OpLoad %6 %183 + %185 = OpConvertSToF %165 %184 + %186 = OpCompositeConstruct %166 %185 %185 %185 %185 + OpStore %168 %186 + OpBranch %164 + %164 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 9 10 0 32 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-two-loops-increment-integer-global-counter-break-square-threshold.amber b/vulkan/amber/graphicsfuzz/cov-two-loops-increment-integer-global-counter-break-square-threshold.amber new file mode 100644 index 0000000..2d54d1b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-two-loops-increment-integer-global-counter-break-square-threshold.amber @@ -0,0 +1,296 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_20 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_5 _GLF_uniform_int_values[3] +# #define _int_3 _GLF_uniform_int_values[4] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [20, 1, 0, 5, 3] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[5]; +# }; +# +# const int _GLF_global_loop_bound = 10; +# int _GLF_global_loop_count = 0; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_1; +# +# for(int i = _int_0; i < _int_3; i++) +# { +# // Always true. +# if(gl_FragCoord.x > _float_0_0) +# { +# a++; +# } +# } +# +# while(_GLF_global_loop_count < _GLF_global_loop_bound) +# { +# _GLF_global_loop_count ++; +# +# // Breaks when a is five. +# if(a * a + _int_1 > _int_20) +# { +# break; +# } +# +# a++; +# } +# +# // Always true. +# if(a == _int_5) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 111 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %40 %92 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "_GLF_global_loop_count" + OpName %11 "a" + OpName %15 "buf1" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %22 "i" + OpName %40 "gl_FragCoord" + OpName %47 "buf0" + OpMemberName %47 0 "_GLF_uniform_float_values" + OpName %49 "" + OpName %92 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 1 + OpDecorate %40 BuiltIn FragCoord + OpDecorate %46 ArrayStride 16 + OpMemberDecorate %47 0 Offset 0 + OpDecorate %47 Block + OpDecorate %49 DescriptorSet 0 + OpDecorate %49 Binding 0 + OpDecorate %92 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypePointer Function %6 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 5 + %14 = OpTypeArray %6 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %6 1 + %19 = OpTypePointer Uniform %6 + %23 = OpConstant %6 2 + %32 = OpConstant %6 4 + %35 = OpTypeBool + %37 = OpTypeFloat 32 + %38 = OpTypeVector %37 4 + %39 = OpTypePointer Input %38 + %40 = OpVariable %39 Input + %41 = OpConstant %12 0 + %42 = OpTypePointer Input %37 + %45 = OpConstant %12 1 + %46 = OpTypeArray %37 %45 + %47 = OpTypeStruct %46 + %48 = OpTypePointer Uniform %47 + %49 = OpVariable %48 Uniform + %50 = OpTypePointer Uniform %37 + %66 = OpConstant %6 10 + %85 = OpConstant %6 3 + %91 = OpTypePointer Output %38 + %92 = OpVariable %91 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %22 = OpVariable %10 Function + OpStore %8 %9 + %20 = OpAccessChain %19 %17 %9 %18 + %21 = OpLoad %6 %20 + OpStore %11 %21 + %24 = OpAccessChain %19 %17 %9 %23 + %25 = OpLoad %6 %24 + OpStore %22 %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %6 %22 + %33 = OpAccessChain %19 %17 %9 %32 + %34 = OpLoad %6 %33 + %36 = OpSLessThan %35 %31 %34 + OpBranchConditional %36 %27 %28 + %27 = OpLabel + %43 = OpAccessChain %42 %40 %41 + %44 = OpLoad %37 %43 + %51 = OpAccessChain %50 %49 %9 %9 + %52 = OpLoad %37 %51 + %53 = OpFOrdGreaterThan %35 %44 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %55 + %54 = OpLabel + %56 = OpLoad %6 %11 + %57 = OpIAdd %6 %56 %18 + OpStore %11 %57 + OpBranch %55 + %55 = OpLabel + OpBranch %29 + %29 = OpLabel + %58 = OpLoad %6 %22 + %59 = OpIAdd %6 %58 %18 + OpStore %22 %59 + OpBranch %26 + %28 = OpLabel + OpBranch %60 + %60 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %6 %8 + %67 = OpSLessThan %35 %65 %66 + OpBranchConditional %67 %61 %62 + %61 = OpLabel + %68 = OpLoad %6 %8 + %69 = OpIAdd %6 %68 %18 + OpStore %8 %69 + %70 = OpLoad %6 %11 + %71 = OpLoad %6 %11 + %72 = OpIMul %6 %70 %71 + %73 = OpAccessChain %19 %17 %9 %18 + %74 = OpLoad %6 %73 + %75 = OpIAdd %6 %72 %74 + %76 = OpAccessChain %19 %17 %9 %9 + %77 = OpLoad %6 %76 + %78 = OpSGreaterThan %35 %75 %77 + OpSelectionMerge %80 None + OpBranchConditional %78 %79 %80 + %79 = OpLabel + OpBranch %62 + %80 = OpLabel + %82 = OpLoad %6 %11 + %83 = OpIAdd %6 %82 %18 + OpStore %11 %83 + OpBranch %63 + %63 = OpLabel + OpBranch %60 + %62 = OpLabel + %84 = OpLoad %6 %11 + %86 = OpAccessChain %19 %17 %9 %85 + %87 = OpLoad %6 %86 + %88 = OpIEqual %35 %84 %87 + OpSelectionMerge %90 None + OpBranchConditional %88 %89 %106 + %89 = OpLabel + %93 = OpAccessChain %19 %17 %9 %18 + %94 = OpLoad %6 %93 + %95 = OpConvertSToF %37 %94 + %96 = OpAccessChain %19 %17 %9 %23 + %97 = OpLoad %6 %96 + %98 = OpConvertSToF %37 %97 + %99 = OpAccessChain %19 %17 %9 %23 + %100 = OpLoad %6 %99 + %101 = OpConvertSToF %37 %100 + %102 = OpAccessChain %19 %17 %9 %18 + %103 = OpLoad %6 %102 + %104 = OpConvertSToF %37 %103 + %105 = OpCompositeConstruct %38 %95 %98 %101 %104 + OpStore %92 %105 + OpBranch %90 + %106 = OpLabel + %107 = OpAccessChain %19 %17 %9 %23 + %108 = OpLoad %6 %107 + %109 = OpConvertSToF %37 %108 + %110 = OpCompositeConstruct %38 %109 %109 %109 %109 + OpStore %92 %110 + OpBranch %90 + %90 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 20 1 0 5 3 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-two-loops-never-iterated.amber b/vulkan/amber/graphicsfuzz/cov-two-loops-never-iterated.amber new file mode 100644 index 0000000..4719392 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-two-loops-never-iterated.amber @@ -0,0 +1,215 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of one: 1 +# layout(set = 0, binding = 1) uniform buf1 +# { +# int one; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# +# // Never iterated. +# for(int i = _int_1; one != _int_1; _int_1) +# { +# _GLF_color = vec4(_int_0); +# } +# +# // Never iterated. +# for(int i = _int_1; i < one; i ++) +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %34 "i" + OpName %42 "buf1" + OpMemberName %42 0 "one" + OpName %44 "" + OpName %55 "i" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpMemberDecorate %42 0 Offset 0 + OpDecorate %42 Block + OpDecorate %44 DescriptorSet 0 + OpDecorate %44 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpConstant %10 1 + %33 = OpTypePointer Function %10 + %42 = OpTypeStruct %10 + %43 = OpTypePointer Uniform %42 + %44 = OpVariable %43 Uniform + %49 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %34 = OpVariable %33 Function + %55 = OpVariable %33 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %23 = OpAccessChain %18 %16 %17 %22 + %24 = OpLoad %10 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpAccessChain %18 %16 %17 %22 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %10 %29 + %31 = OpConvertSToF %6 %30 + %32 = OpCompositeConstruct %7 %21 %25 %28 %31 + OpStore %9 %32 + %35 = OpAccessChain %18 %16 %17 %17 + %36 = OpLoad %10 %35 + OpStore %34 %36 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %45 = OpAccessChain %18 %44 %17 + %46 = OpLoad %10 %45 + %47 = OpAccessChain %18 %16 %17 %17 + %48 = OpLoad %10 %47 + %50 = OpINotEqual %49 %46 %48 + OpBranchConditional %50 %38 %39 + %38 = OpLabel + %51 = OpAccessChain %18 %16 %17 %22 + %52 = OpLoad %10 %51 + %53 = OpConvertSToF %6 %52 + %54 = OpCompositeConstruct %7 %53 %53 %53 %53 + OpStore %9 %54 + OpBranch %40 + %40 = OpLabel + OpBranch %37 + %39 = OpLabel + %56 = OpAccessChain %18 %16 %17 %17 + %57 = OpLoad %10 %56 + OpStore %55 %57 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %10 %55 + %64 = OpAccessChain %18 %44 %17 + %65 = OpLoad %10 %64 + %66 = OpSLessThan %49 %63 %65 + OpBranchConditional %66 %59 %60 + %59 = OpLabel + %67 = OpAccessChain %18 %16 %17 %22 + %68 = OpLoad %10 %67 + %69 = OpConvertSToF %6 %68 + %70 = OpCompositeConstruct %7 %69 %69 %69 %69 + OpStore %9 %70 + OpBranch %61 + %61 = OpLabel + %71 = OpLoad %10 %55 + %72 = OpIAdd %10 %71 %22 + OpStore %55 %72 + OpBranch %58 + %60 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 STD140 DATA + 1 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-two-nested-loops-switch-case-matrix-array-increment.amber b/vulkan/amber/graphicsfuzz/cov-two-nested-loops-switch-case-matrix-array-increment.amber new file mode 100644 index 0000000..28b1f0b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-two-nested-loops-switch-case-matrix-array-increment.amber @@ -0,0 +1,571 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_3 _GLF_uniform_int_values[2] +# #define _int_8 _GLF_uniform_int_values[3] +# #define _int_5 _GLF_uniform_int_values[4] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_5_0 _GLF_uniform_float_values[1] +# #define _float_6_0 _GLF_uniform_float_values[2] +# #define _float_7_0 _GLF_uniform_float_values[3] +# #define _float_8_0 _GLF_uniform_float_values[4] +# #define _float_9_0 _GLF_uniform_float_values[5] +# #define _float_1_0 _GLF_uniform_float_values[6] +# #define _float_2_0 _GLF_uniform_float_values[7] +# #define _float_3_0 _GLF_uniform_float_values[8] +# #define _float_4_0 _GLF_uniform_float_values[9] +# #define _float_10_0 _GLF_uniform_float_values[10] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 5.0, 6.0, 7.0, 8.0, 9.0, 1.0, 2.0, 3.0, 4.0, 10.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[11]; +# }; +# // Contents of _GLF_uniform_int_values: [1, 0, 3, 8, 5] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[5]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# mat2x4 m24 = mat2x4(_float_0_0); +# int a = _int_0; +# +# for(int i = _int_1; i < _int_5; i++) +# { +# for(int j = 2; j < 5; j ++) +# { +# for(int k = _int_0; k < i; k++) +# { +# for(int l = 0; l < j; l++) +# { +# switch(a) +# { +# // a is 2 when is is 1 and j is 4. At that point k loops from 0 to 1 and l from 0 to 4. +# // This makes all the elements of m24 of value 1. +# case 2u: +# m24[_GLF_MAKE_IN_BOUNDS_INT(k, 2)][_GLF_MAKE_IN_BOUNDS_INT(l, 4)] = _float_1_0; +# break; +# // The cases below are never hit. +# case 553u: +# discard; +# case 554u: +# discard; +# case 556u: +# discard; +# case 558u: +# if(gl_FragCoord.y < _float_1_0) +# { +# discard; +# } +# } +# } +# } +# a++; +# } +# } +# +# float arr[9] = float[9](_float_1_0, _float_2_0, _float_3_0, _float_4_0, _float_5_0, _float_6_0, _float_7_0, _float_8_0, _float_9_0); +# int b = _int_1; +# +# for(int i = 0; i < 5; i++) +# { +# for(int j = 1; j < 5; j++) +# { +# if(gl_FragCoord.x < _float_10_0) +# { +# continue; +# } +# +# // Some pixels hit the continue above, but the switch-case below +# // only affects indices 5 and 7 which are not used for the final +# // color. +# int idx = min(b, _int_8); +# arr[idx] = _float_0_0; +# +# for(int k = 0; k < i; k++) +# { +# for(int l = _int_0; l < j; l++) +# { +# // Same as switch(idx) case 5 and 7. +# switch(idx - _int_5) +# { +# case 0: +# arr[idx] += _float_1_0; +# break; +# case 2: +# arr[idx] += m24[_int_1][_int_1]; +# break; +# } +# } +# } +# b++; +# } +# } +# +# +# // No other array indices can be read without the coverage point disappearing. +# _GLF_color.x = arr[0]; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 267 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %119 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %35 "m24" + OpName %38 "buf0" + OpMemberName %38 0 "_GLF_uniform_float_values" + OpName %40 "" + OpName %50 "a" + OpName %53 "i" + OpName %67 "j" + OpName %77 "k" + OpName %88 "l" + OpName %119 "gl_FragCoord" + OpName %144 "arr" + OpName %167 "b" + OpName %170 "i" + OpName %178 "j" + OpName %196 "idx" + OpName %205 "k" + OpName %214 "l" + OpDecorate %9 Location 0 + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %37 ArrayStride 16 + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 0 + OpDecorate %119 BuiltIn FragCoord + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 5 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpTypePointer Uniform %10 + %22 = OpConstant %10 1 + %33 = OpTypeMatrix %7 2 + %34 = OpTypePointer Function %33 + %36 = OpConstant %11 11 + %37 = OpTypeArray %6 %36 + %38 = OpTypeStruct %37 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %41 = OpTypePointer Uniform %6 + %44 = OpConstant %6 1 + %45 = OpConstant %6 0 + %49 = OpTypePointer Function %10 + %62 = OpConstant %10 4 + %65 = OpTypeBool + %68 = OpConstant %10 2 + %75 = OpConstant %10 5 + %107 = OpConstant %10 3 + %109 = OpConstant %10 6 + %112 = OpTypePointer Function %6 + %118 = OpTypePointer Input %7 + %119 = OpVariable %118 Input + %120 = OpConstant %11 1 + %121 = OpTypePointer Input %6 + %141 = OpConstant %11 9 + %142 = OpTypeArray %6 %141 + %143 = OpTypePointer Function %142 + %147 = OpConstant %10 7 + %150 = OpConstant %10 8 + %153 = OpConstant %10 9 + %186 = OpConstant %11 0 + %189 = OpConstant %10 10 + %265 = OpTypePointer Output %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %35 = OpVariable %34 Function + %50 = OpVariable %49 Function + %53 = OpVariable %49 Function + %67 = OpVariable %49 Function + %77 = OpVariable %49 Function + %88 = OpVariable %49 Function + %144 = OpVariable %143 Function + %167 = OpVariable %49 Function + %170 = OpVariable %49 Function + %178 = OpVariable %49 Function + %196 = OpVariable %49 Function + %205 = OpVariable %49 Function + %214 = OpVariable %49 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertSToF %6 %20 + %23 = OpAccessChain %18 %16 %17 %22 + %24 = OpLoad %10 %23 + %25 = OpConvertSToF %6 %24 + %26 = OpAccessChain %18 %16 %17 %22 + %27 = OpLoad %10 %26 + %28 = OpConvertSToF %6 %27 + %29 = OpAccessChain %18 %16 %17 %17 + %30 = OpLoad %10 %29 + %31 = OpConvertSToF %6 %30 + %32 = OpCompositeConstruct %7 %21 %25 %28 %31 + OpStore %9 %32 + %42 = OpAccessChain %41 %40 %17 %17 + %43 = OpLoad %6 %42 + %46 = OpCompositeConstruct %7 %43 %45 %45 %45 + %47 = OpCompositeConstruct %7 %45 %43 %45 %45 + %48 = OpCompositeConstruct %33 %46 %47 + OpStore %35 %48 + %51 = OpAccessChain %18 %16 %17 %22 + %52 = OpLoad %10 %51 + OpStore %50 %52 + %54 = OpAccessChain %18 %16 %17 %17 + %55 = OpLoad %10 %54 + OpStore %53 %55 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %10 %53 + %63 = OpAccessChain %18 %16 %17 %62 + %64 = OpLoad %10 %63 + %66 = OpSLessThan %65 %61 %64 + OpBranchConditional %66 %57 %58 + %57 = OpLabel + OpStore %67 %68 + OpBranch %69 + %69 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %10 %67 + %76 = OpSLessThan %65 %74 %75 + OpBranchConditional %76 %70 %71 + %70 = OpLabel + %78 = OpAccessChain %18 %16 %17 %22 + %79 = OpLoad %10 %78 + OpStore %77 %79 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %82 %83 None + OpBranch %84 + %84 = OpLabel + %85 = OpLoad %10 %77 + %86 = OpLoad %10 %53 + %87 = OpSLessThan %65 %85 %86 + OpBranchConditional %87 %81 %82 + %81 = OpLabel + OpStore %88 %17 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %10 %88 + %95 = OpLoad %10 %67 + %96 = OpSLessThan %65 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %10 %50 + OpSelectionMerge %103 None + OpSwitch %97 %103 2 %98 553 %99 554 %100 556 %101 558 %102 + %98 = OpLabel + %104 = OpLoad %10 %77 + %105 = OpExtInst %10 %1 SClamp %104 %17 %22 + %106 = OpLoad %10 %88 + %108 = OpExtInst %10 %1 SClamp %106 %17 %107 + %110 = OpAccessChain %41 %40 %17 %109 + %111 = OpLoad %6 %110 + %113 = OpAccessChain %112 %35 %105 %108 + OpStore %113 %111 + OpBranch %103 + %99 = OpLabel + OpTerminateInvocation + %100 = OpLabel + OpTerminateInvocation + %101 = OpLabel + OpTerminateInvocation + %102 = OpLabel + %122 = OpAccessChain %121 %119 %120 + %123 = OpLoad %6 %122 + %124 = OpAccessChain %41 %40 %17 %109 + %125 = OpLoad %6 %124 + %126 = OpFOrdLessThan %65 %123 %125 + OpSelectionMerge %128 None + OpBranchConditional %126 %127 %128 + %127 = OpLabel + OpTerminateInvocation + %128 = OpLabel + OpBranch %103 + %103 = OpLabel + OpBranch %92 + %92 = OpLabel + %131 = OpLoad %10 %88 + %132 = OpIAdd %10 %131 %22 + OpStore %88 %132 + OpBranch %89 + %91 = OpLabel + OpBranch %83 + %83 = OpLabel + %133 = OpLoad %10 %77 + %134 = OpIAdd %10 %133 %22 + OpStore %77 %134 + OpBranch %80 + %82 = OpLabel + %135 = OpLoad %10 %50 + %136 = OpIAdd %10 %135 %22 + OpStore %50 %136 + OpBranch %72 + %72 = OpLabel + %137 = OpLoad %10 %67 + %138 = OpIAdd %10 %137 %22 + OpStore %67 %138 + OpBranch %69 + %71 = OpLabel + OpBranch %59 + %59 = OpLabel + %139 = OpLoad %10 %53 + %140 = OpIAdd %10 %139 %22 + OpStore %53 %140 + OpBranch %56 + %58 = OpLabel + %145 = OpAccessChain %41 %40 %17 %109 + %146 = OpLoad %6 %145 + %148 = OpAccessChain %41 %40 %17 %147 + %149 = OpLoad %6 %148 + %151 = OpAccessChain %41 %40 %17 %150 + %152 = OpLoad %6 %151 + %154 = OpAccessChain %41 %40 %17 %153 + %155 = OpLoad %6 %154 + %156 = OpAccessChain %41 %40 %17 %22 + %157 = OpLoad %6 %156 + %158 = OpAccessChain %41 %40 %17 %68 + %159 = OpLoad %6 %158 + %160 = OpAccessChain %41 %40 %17 %107 + %161 = OpLoad %6 %160 + %162 = OpAccessChain %41 %40 %17 %62 + %163 = OpLoad %6 %162 + %164 = OpAccessChain %41 %40 %17 %75 + %165 = OpLoad %6 %164 + %166 = OpCompositeConstruct %142 %146 %149 %152 %155 %157 %159 %161 %163 %165 + OpStore %144 %166 + %168 = OpAccessChain %18 %16 %17 %17 + %169 = OpLoad %10 %168 + OpStore %167 %169 + OpStore %170 %17 + OpBranch %171 + %171 = OpLabel + OpLoopMerge %173 %174 None + OpBranch %175 + %175 = OpLabel + %176 = OpLoad %10 %170 + %177 = OpSLessThan %65 %176 %75 + OpBranchConditional %177 %172 %173 + %172 = OpLabel + OpStore %178 %22 + OpBranch %179 + %179 = OpLabel + OpLoopMerge %181 %182 None + OpBranch %183 + %183 = OpLabel + %184 = OpLoad %10 %178 + %185 = OpSLessThan %65 %184 %75 + OpBranchConditional %185 %180 %181 + %180 = OpLabel + %187 = OpAccessChain %121 %119 %186 + %188 = OpLoad %6 %187 + %190 = OpAccessChain %41 %40 %17 %189 + %191 = OpLoad %6 %190 + %192 = OpFOrdLessThan %65 %188 %191 + OpSelectionMerge %194 None + OpBranchConditional %192 %193 %194 + %193 = OpLabel + OpBranch %182 + %194 = OpLabel + %197 = OpLoad %10 %167 + %198 = OpAccessChain %18 %16 %17 %107 + %199 = OpLoad %10 %198 + %200 = OpExtInst %10 %1 SMin %197 %199 + OpStore %196 %200 + %201 = OpLoad %10 %196 + %202 = OpAccessChain %41 %40 %17 %17 + %203 = OpLoad %6 %202 + %204 = OpAccessChain %112 %144 %201 + OpStore %204 %203 + OpStore %205 %17 + OpBranch %206 + %206 = OpLabel + OpLoopMerge %208 %209 None + OpBranch %210 + %210 = OpLabel + %211 = OpLoad %10 %205 + %212 = OpLoad %10 %170 + %213 = OpSLessThan %65 %211 %212 + OpBranchConditional %213 %207 %208 + %207 = OpLabel + %215 = OpAccessChain %18 %16 %17 %22 + %216 = OpLoad %10 %215 + OpStore %214 %216 + OpBranch %217 + %217 = OpLabel + OpLoopMerge %219 %220 None + OpBranch %221 + %221 = OpLabel + %222 = OpLoad %10 %214 + %223 = OpLoad %10 %178 + %224 = OpSLessThan %65 %222 %223 + OpBranchConditional %224 %218 %219 + %218 = OpLabel + %225 = OpLoad %10 %196 + %226 = OpAccessChain %18 %16 %17 %62 + %227 = OpLoad %10 %226 + %228 = OpISub %10 %225 %227 + OpSelectionMerge %231 None + OpSwitch %228 %231 0 %229 2 %230 + %229 = OpLabel + %232 = OpLoad %10 %196 + %233 = OpAccessChain %41 %40 %17 %109 + %234 = OpLoad %6 %233 + %235 = OpAccessChain %112 %144 %232 + %236 = OpLoad %6 %235 + %237 = OpFAdd %6 %236 %234 + %238 = OpAccessChain %112 %144 %232 + OpStore %238 %237 + OpBranch %231 + %230 = OpLabel + %240 = OpLoad %10 %196 + %241 = OpAccessChain %18 %16 %17 %17 + %242 = OpLoad %10 %241 + %243 = OpAccessChain %18 %16 %17 %17 + %244 = OpLoad %10 %243 + %245 = OpAccessChain %112 %35 %242 %244 + %246 = OpLoad %6 %245 + %247 = OpAccessChain %112 %144 %240 + %248 = OpLoad %6 %247 + %249 = OpFAdd %6 %248 %246 + %250 = OpAccessChain %112 %144 %240 + OpStore %250 %249 + OpBranch %231 + %231 = OpLabel + OpBranch %220 + %220 = OpLabel + %253 = OpLoad %10 %214 + %254 = OpIAdd %10 %253 %22 + OpStore %214 %254 + OpBranch %217 + %219 = OpLabel + OpBranch %209 + %209 = OpLabel + %255 = OpLoad %10 %205 + %256 = OpIAdd %10 %255 %22 + OpStore %205 %256 + OpBranch %206 + %208 = OpLabel + %257 = OpLoad %10 %167 + %258 = OpIAdd %10 %257 %22 + OpStore %167 %258 + OpBranch %182 + %182 = OpLabel + %259 = OpLoad %10 %178 + %260 = OpIAdd %10 %259 %22 + OpStore %178 %260 + OpBranch %179 + %181 = OpLabel + OpBranch %174 + %174 = OpLabel + %261 = OpLoad %10 %170 + %262 = OpIAdd %10 %261 %22 + OpStore %170 %262 + OpBranch %171 + %173 = OpLabel + %263 = OpAccessChain %112 %144 %17 + %264 = OpLoad %6 %263 + %266 = OpAccessChain %265 %9 %186 + OpStore %266 %264 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 3 8 5 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 5.0 6.0 7.0 8.0 9.0 1.0 2.0 3.0 4.0 10.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-types-return-in-main-never-hit.amber b/vulkan/amber/graphicsfuzz/cov-types-return-in-main-never-hit.amber new file mode 100644 index 0000000..3bba256 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-types-return-in-main-never-hit.amber @@ -0,0 +1,156 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific types optimization path. + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--scalar-replacement=100' +# '--scalar-replacement=100' +# '--inline-entry-points-exhaustive' +# '--private-to-local' +# '--eliminate-local-single-block' +# '--eliminate-dead-branches' +# '--if-conversion' +# '--combine-access-chains' +# '--eliminate-dead-branches' +# '--redundancy-elimination' +# '--simplify-instructions' +# '--private-to-local' +# '--private-to-local' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# vec4 func() +# { +# return vec4(1, 0, 0, 1); +# } +# +# void main() +# { +# _GLF_color = vec4(0); +# +# if(one == 0) // Always false. +# return; +# +# _GLF_color = func(); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %17 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "func(" + OpName %17 "_GLF_color" + OpName %20 "buf0" + OpMemberName %20 0 "one" + OpName %22 "" + OpDecorate %17 Location 0 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeFunction %7 + %11 = OpConstant %6 1 + %12 = OpConstant %6 0 + %13 = OpConstantComposite %7 %11 %12 %12 %11 + %16 = OpTypePointer Output %7 + %17 = OpVariable %16 Output + %18 = OpConstantComposite %7 %12 %12 %12 %12 + %19 = OpTypeInt 32 1 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpConstant %19 0 + %24 = OpTypePointer Uniform %19 + %27 = OpTypeBool + %33 = OpTypePointer Function %7 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %34 = OpVariable %33 Function + OpStore %17 %18 + %25 = OpAccessChain %24 %22 %23 + %26 = OpLoad %19 %25 + %28 = OpIEqual %27 %26 %23 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %30 + %29 = OpLabel + OpReturn + %30 = OpLabel + OpStore %34 %13 + OpStore %17 %13 + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + OpReturnValue %13 + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-uadd-carry-bit-count-index-array.amber b/vulkan/amber/graphicsfuzz/cov-uadd-carry-bit-count-index-array.amber new file mode 100644 index 0000000..d82782d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-uadd-carry-bit-count-index-array.amber @@ -0,0 +1,295 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _GLF_MAKE_IN_BOUNDS_INT(IDX, SZ) clamp(IDX, 0, SZ - 1) +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _uint_1 _GLF_uniform_uint_values[0] +# #define _uint_0 _GLF_uniform_uint_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 0) uniform buf0 { +# int _GLF_uniform_int_values[2]; +# }; +# // Contents of _GLF_uniform_uint_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 { +# uint _GLF_uniform_uint_values[2]; +# }; +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 2) uniform buf2 { +# float _GLF_uniform_float_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of zero: 0 +# layout(set = 0, binding = 3) uniform buf3 { +# uint zero; +# }; +# void main() +# { +# uint a = _uint_1; +# // b becomes one and a becomes zero. +# uint b = uaddCarry(zero, _uint_1, a); +# vec4 v = vec4(_float_0_0); +# +# // bitCount(a) = 0. +# v[_GLF_MAKE_IN_BOUNDS_INT(bitCount(a), 4)] = _float_1_0; +# +# // Always true. +# if(a == _uint_0 && b == _uint_1 && v == vec4(_int_1, _int_0, _int_0, _int_0)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 111 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %92 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %11 "buf1" + OpMemberName %11 0 "_GLF_uniform_uint_values" + OpName %13 "" + OpName %19 "b" + OpName %20 "buf3" + OpMemberName %20 0 "zero" + OpName %22 "" + OpName %27 "ResType" + OpName %34 "v" + OpName %36 "buf2" + OpMemberName %36 0 "_GLF_uniform_float_values" + OpName %38 "" + OpName %68 "buf0" + OpMemberName %68 0 "_GLF_uniform_int_values" + OpName %70 "" + OpName %92 "_GLF_color" + OpDecorate %10 ArrayStride 16 + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 1 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 3 + OpDecorate %35 ArrayStride 16 + OpMemberDecorate %36 0 Offset 0 + OpDecorate %36 Block + OpDecorate %38 DescriptorSet 0 + OpDecorate %38 Binding 2 + OpDecorate %47 RelaxedPrecision + OpDecorate %67 ArrayStride 16 + OpMemberDecorate %68 0 Offset 0 + OpDecorate %68 Block + OpDecorate %70 DescriptorSet 0 + OpDecorate %70 Binding 0 + OpDecorate %92 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 2 + %10 = OpTypeArray %6 %9 + %11 = OpTypeStruct %10 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypePointer Uniform %6 + %20 = OpTypeStruct %6 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %27 = OpTypeStruct %6 %6 + %31 = OpTypeFloat 32 + %32 = OpTypeVector %31 4 + %33 = OpTypePointer Function %32 + %35 = OpTypeArray %31 %9 + %36 = OpTypeStruct %35 + %37 = OpTypePointer Uniform %36 + %38 = OpVariable %37 Uniform + %39 = OpConstant %14 1 + %40 = OpTypePointer Uniform %31 + %46 = OpConstant %14 3 + %50 = OpTypePointer Function %31 + %52 = OpTypeBool + %67 = OpTypeArray %14 %9 + %68 = OpTypeStruct %67 + %69 = OpTypePointer Uniform %68 + %70 = OpVariable %69 Uniform + %71 = OpTypePointer Uniform %14 + %85 = OpTypeVector %52 4 + %91 = OpTypePointer Output %32 + %92 = OpVariable %91 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %34 = OpVariable %33 Function + %17 = OpAccessChain %16 %13 %15 %15 + %18 = OpLoad %6 %17 + OpStore %8 %18 + %23 = OpAccessChain %16 %22 %15 + %24 = OpLoad %6 %23 + %25 = OpAccessChain %16 %13 %15 %15 + %26 = OpLoad %6 %25 + %28 = OpIAddCarry %27 %24 %26 + %29 = OpCompositeExtract %6 %28 1 + OpStore %8 %29 + %30 = OpCompositeExtract %6 %28 0 + OpStore %19 %30 + %41 = OpAccessChain %40 %38 %15 %39 + %42 = OpLoad %31 %41 + %43 = OpCompositeConstruct %32 %42 %42 %42 %42 + OpStore %34 %43 + %44 = OpLoad %6 %8 + %45 = OpBitCount %14 %44 + %47 = OpExtInst %14 %1 SClamp %45 %15 %46 + %48 = OpAccessChain %40 %38 %15 %15 + %49 = OpLoad %31 %48 + %51 = OpAccessChain %50 %34 %47 + OpStore %51 %49 + %53 = OpLoad %6 %8 + %54 = OpAccessChain %16 %13 %15 %39 + %55 = OpLoad %6 %54 + %56 = OpIEqual %52 %53 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + %59 = OpLoad %6 %19 + %60 = OpAccessChain %16 %13 %15 %15 + %61 = OpLoad %6 %60 + %62 = OpIEqual %52 %59 %61 + OpBranch %58 + %58 = OpLabel + %63 = OpPhi %52 %56 %5 %62 %57 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %65 + %64 = OpLabel + %66 = OpLoad %32 %34 + %72 = OpAccessChain %71 %70 %15 %39 + %73 = OpLoad %14 %72 + %74 = OpConvertSToF %31 %73 + %75 = OpAccessChain %71 %70 %15 %15 + %76 = OpLoad %14 %75 + %77 = OpConvertSToF %31 %76 + %78 = OpAccessChain %71 %70 %15 %15 + %79 = OpLoad %14 %78 + %80 = OpConvertSToF %31 %79 + %81 = OpAccessChain %71 %70 %15 %15 + %82 = OpLoad %14 %81 + %83 = OpConvertSToF %31 %82 + %84 = OpCompositeConstruct %32 %74 %77 %80 %83 + %86 = OpFOrdEqual %85 %66 %84 + %87 = OpAll %52 %86 + OpBranch %65 + %65 = OpLabel + %88 = OpPhi %52 %63 %58 %87 %64 + OpSelectionMerge %90 None + OpBranchConditional %88 %89 %106 + %89 = OpLabel + %93 = OpAccessChain %71 %70 %15 %39 + %94 = OpLoad %14 %93 + %95 = OpConvertSToF %31 %94 + %96 = OpAccessChain %71 %70 %15 %15 + %97 = OpLoad %14 %96 + %98 = OpConvertSToF %31 %97 + %99 = OpAccessChain %71 %70 %15 %15 + %100 = OpLoad %14 %99 + %101 = OpConvertSToF %31 %100 + %102 = OpAccessChain %71 %70 %15 %39 + %103 = OpLoad %14 %102 + %104 = OpConvertSToF %31 %103 + %105 = OpCompositeConstruct %32 %95 %98 %101 %104 + OpStore %92 %105 + OpBranch %90 + %106 = OpLabel + %107 = OpAccessChain %71 %70 %15 %15 + %108 = OpLoad %14 %107 + %109 = OpConvertSToF %31 %108 + %110 = OpCompositeConstruct %32 %109 %109 %109 %109 + OpStore %92 %110 + OpBranch %90 + %90 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE uint32 STD140 DATA + 0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END +# _GLF_uniform_uint_values +BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 3 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-ucarryadd-one-and-one.amber b/vulkan/amber/graphicsfuzz/cov-ucarryadd-one-and-one.amber new file mode 100644 index 0000000..d1e9872 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-ucarryadd-one-and-one.amber @@ -0,0 +1,188 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _uint_2 _GLF_uniform_uint_values[0] +# #define _uint_1 _GLF_uniform_uint_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_uint_values: [2, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# uint _GLF_uniform_uint_values[2]; +# }; +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# uint a = _uint_1; +# +# // Always true. +# if(uaddCarry(1u, 1u, a) == _uint_2) +# { +# _GLF_color = vec4(_int_1, float(a), _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 57 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %11 "buf0" + OpMemberName %11 0 "_GLF_uniform_uint_values" + OpName %13 "" + OpName %21 "ResType" + OpName %34 "_GLF_color" + OpName %36 "buf1" + OpMemberName %36 0 "_GLF_uniform_int_values" + OpName %38 "" + OpDecorate %10 ArrayStride 16 + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %34 Location 0 + OpDecorate %35 ArrayStride 16 + OpMemberDecorate %36 0 Offset 0 + OpDecorate %36 Block + OpDecorate %38 DescriptorSet 0 + OpDecorate %38 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 2 + %10 = OpTypeArray %6 %9 + %11 = OpTypeStruct %10 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpConstant %14 1 + %17 = OpTypePointer Uniform %6 + %20 = OpConstant %6 1 + %21 = OpTypeStruct %6 %6 + %27 = OpTypeBool + %31 = OpTypeFloat 32 + %32 = OpTypeVector %31 4 + %33 = OpTypePointer Output %32 + %34 = OpVariable %33 Output + %35 = OpTypeArray %14 %9 + %36 = OpTypeStruct %35 + %37 = OpTypePointer Uniform %36 + %38 = OpVariable %37 Uniform + %39 = OpTypePointer Uniform %14 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpAccessChain %17 %13 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %22 = OpIAddCarry %21 %20 %20 + %23 = OpCompositeExtract %6 %22 1 + OpStore %8 %23 + %24 = OpCompositeExtract %6 %22 0 + %25 = OpAccessChain %17 %13 %15 %15 + %26 = OpLoad %6 %25 + %28 = OpIEqual %27 %24 %26 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %52 + %29 = OpLabel + %40 = OpAccessChain %39 %38 %15 %15 + %41 = OpLoad %14 %40 + %42 = OpConvertSToF %31 %41 + %43 = OpLoad %6 %8 + %44 = OpConvertUToF %31 %43 + %45 = OpAccessChain %39 %38 %15 %16 + %46 = OpLoad %14 %45 + %47 = OpConvertSToF %31 %46 + %48 = OpAccessChain %39 %38 %15 %15 + %49 = OpLoad %14 %48 + %50 = OpConvertSToF %31 %49 + %51 = OpCompositeConstruct %32 %42 %44 %47 %50 + OpStore %34 %51 + OpBranch %30 + %52 = OpLabel + %53 = OpAccessChain %39 %38 %15 %16 + %54 = OpLoad %14 %53 + %55 = OpConvertSToF %31 %54 + %56 = OpCompositeConstruct %32 %55 %55 %55 %55 + OpStore %34 %56 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_uint_values +BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA + 2 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-undefined-inversesqrt-reflect.amber b/vulkan/amber/graphicsfuzz/cov-undefined-inversesqrt-reflect.amber new file mode 100644 index 0000000..591b8a6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-undefined-inversesqrt-reflect.amber @@ -0,0 +1,225 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific APFloat code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of v1: [0.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# highp vec2 v1; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat2 m24 = mat2x2(_float_1_0, _float_1_0, dot(v1.x, 1.0), _float_1_0); +# +# // a becomes 0.0. +# float a = float(m24); +# +# // Since a negative value is given to inversesqrt this results in an undefined value, +# // but not in undefined behavior. +# vec2 v2 = inversesqrt(vec2(-1.0, 1.0)); +# +# // Since v2 includes an undefined value this results in an undefined value, +# // but not in undefined behavior. +# vec2 v3 = reflect(v2, vec2(a, 1.0)); +# +# _GLF_color = vec4(_float_1_0, v3, _float_1_0); +# +# if (v1.y == _float_1_0) +# { +# _GLF_color.yz = vec2(0.0); +# } +# else +# { +# _GLF_color = vec4(0.0); +# } +# } +DEVICE_EXTENSION VK_KHR_shader_float_controls +DEVICE_PROPERTY FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32 +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpCapability SignedZeroInfNanPreserve + OpExtension "SPV_KHR_float_controls" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %53 + OpExecutionMode %4 OriginUpperLeft + OpExecutionMode %4 SignedZeroInfNanPreserve 32 + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "m24" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %24 "buf1" + OpMemberName %24 0 "v1" + OpName %26 "" + OpName %39 "a" + OpName %43 "v2" + OpName %46 "v3" + OpName %53 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 1 + OpDecorate %53 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeMatrix %7 2 + %9 = OpTypePointer Function %8 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 1 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %24 = OpTypeStruct %7 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpConstant %11 0 + %30 = OpConstant %6 1 + %34 = OpConstant %6 0 + %38 = OpTypePointer Function %6 + %42 = OpTypePointer Function %7 + %44 = OpConstant %6 -0x1.8p+128 + %45 = OpConstantComposite %7 %44 %30 + %51 = OpTypeVector %6 4 + %52 = OpTypePointer Output %51 + %53 = OpVariable %52 Output + %66 = OpTypeBool + %70 = OpConstantComposite %7 %34 %34 + %74 = OpConstantComposite %51 %34 %34 %34 %34 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %39 = OpVariable %38 Function + %43 = OpVariable %42 Function + %46 = OpVariable %42 Function + %20 = OpAccessChain %19 %16 %18 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %16 %18 %18 + %23 = OpLoad %6 %22 + %28 = OpAccessChain %19 %26 %18 %27 + %29 = OpLoad %6 %28 + %31 = OpFMul %6 %29 %30 + %32 = OpAccessChain %19 %16 %18 %18 + %33 = OpLoad %6 %32 + %35 = OpCompositeConstruct %7 %21 %23 + %36 = OpCompositeConstruct %7 %31 %33 + %37 = OpCompositeConstruct %8 %35 %36 + OpStore %10 %37 + %40 = OpLoad %8 %10 + %41 = OpCompositeExtract %6 %40 0 0 + OpStore %39 %41 + OpStore %43 %45 + %47 = OpLoad %7 %43 + %48 = OpLoad %6 %39 + %49 = OpCompositeConstruct %7 %48 %30 + %50 = OpExtInst %7 %1 Reflect %47 %49 + OpStore %46 %50 + %54 = OpAccessChain %19 %16 %18 %18 + %55 = OpLoad %6 %54 + %56 = OpLoad %7 %46 + %57 = OpAccessChain %19 %16 %18 %18 + %58 = OpLoad %6 %57 + %59 = OpCompositeExtract %6 %56 0 + %60 = OpCompositeExtract %6 %56 1 + %61 = OpCompositeConstruct %51 %55 %59 %60 %58 + OpStore %53 %61 + %62 = OpAccessChain %19 %26 %18 %12 + %63 = OpLoad %6 %62 + %64 = OpAccessChain %19 %16 %18 %18 + %65 = OpLoad %6 %64 + %67 = OpFOrdEqual %66 %63 %65 + OpSelectionMerge %69 None + OpBranchConditional %67 %68 %73 + %68 = OpLabel + %71 = OpLoad %51 %53 + %72 = OpVectorShuffle %51 %71 %70 0 4 5 3 + OpStore %53 %72 + OpBranch %69 + %73 = OpLabel + OpStore %53 %74 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# v1 +BUFFER variant_v1 DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_v1 AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-uniform-vector-copy.amber b/vulkan/amber/graphicsfuzz/cov-uniform-vector-copy.amber new file mode 100644 index 0000000..bca7198 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-uniform-vector-copy.amber @@ -0,0 +1,250 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[2]; +# }; +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# // Contents of injectionSwitch: [0.0, 1.0] +# layout(push_constant) uniform buf_push +# { +# highp vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# +# // Always false. +# if(injectionSwitch.x > injectionSwitch.y) +# a = _int_1; +# +# vec2 v = injectionSwitch; +# +# // Always true. +# if(a == _int_0 && v.x == _float_0_0 && v.y == _float_1_0) +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# else +# _GLF_color = vec4(_int_0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 92 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %73 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %21 "buf_push" + OpMemberName %21 0 "injectionSwitch" + OpName %23 "" + OpName %39 "v" + OpName %53 "buf0" + OpMemberName %53 0 "_GLF_uniform_float_values" + OpName %55 "" + OpName %73 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpMemberDecorate %21 0 Offset 0 + OpDecorate %21 Block + OpDecorate %52 ArrayStride 16 + OpMemberDecorate %53 0 Offset 0 + OpDecorate %53 Block + OpDecorate %55 DescriptorSet 0 + OpDecorate %55 Binding 0 + OpDecorate %73 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpTypePointer Uniform %6 + %19 = OpTypeFloat 32 + %20 = OpTypeVector %19 2 + %21 = OpTypeStruct %20 + %22 = OpTypePointer PushConstant %21 + %23 = OpVariable %22 PushConstant + %24 = OpConstant %9 0 + %25 = OpTypePointer PushConstant %19 + %28 = OpConstant %9 1 + %31 = OpTypeBool + %35 = OpConstant %6 1 + %38 = OpTypePointer Function %20 + %40 = OpTypePointer PushConstant %20 + %49 = OpTypePointer Function %19 + %52 = OpTypeArray %19 %10 + %53 = OpTypeStruct %52 + %54 = OpTypePointer Uniform %53 + %55 = OpVariable %54 Uniform + %56 = OpTypePointer Uniform %19 + %71 = OpTypeVector %19 4 + %72 = OpTypePointer Output %71 + %73 = OpVariable %72 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %39 = OpVariable %38 Function + %17 = OpAccessChain %16 %14 %15 %15 + %18 = OpLoad %6 %17 + OpStore %8 %18 + %26 = OpAccessChain %25 %23 %15 %24 + %27 = OpLoad %19 %26 + %29 = OpAccessChain %25 %23 %15 %28 + %30 = OpLoad %19 %29 + %32 = OpFOrdGreaterThan %31 %27 %30 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %34 + %33 = OpLabel + %36 = OpAccessChain %16 %14 %15 %35 + %37 = OpLoad %6 %36 + OpStore %8 %37 + OpBranch %34 + %34 = OpLabel + %41 = OpAccessChain %40 %23 %15 + %42 = OpLoad %20 %41 + OpStore %39 %42 + %43 = OpLoad %6 %8 + %44 = OpAccessChain %16 %14 %15 %15 + %45 = OpLoad %6 %44 + %46 = OpIEqual %31 %43 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + %50 = OpAccessChain %49 %39 %24 + %51 = OpLoad %19 %50 + %57 = OpAccessChain %56 %55 %15 %35 + %58 = OpLoad %19 %57 + %59 = OpFOrdEqual %31 %51 %58 + OpBranch %48 + %48 = OpLabel + %60 = OpPhi %31 %46 %34 %59 %47 + OpSelectionMerge %62 None + OpBranchConditional %60 %61 %62 + %61 = OpLabel + %63 = OpAccessChain %49 %39 %28 + %64 = OpLoad %19 %63 + %65 = OpAccessChain %56 %55 %15 %15 + %66 = OpLoad %19 %65 + %67 = OpFOrdEqual %31 %64 %66 + OpBranch %62 + %62 = OpLabel + %68 = OpPhi %31 %60 %48 %67 %61 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %87 + %69 = OpLabel + %74 = OpAccessChain %16 %14 %15 %35 + %75 = OpLoad %6 %74 + %76 = OpConvertSToF %19 %75 + %77 = OpAccessChain %16 %14 %15 %15 + %78 = OpLoad %6 %77 + %79 = OpConvertSToF %19 %78 + %80 = OpAccessChain %16 %14 %15 %15 + %81 = OpLoad %6 %80 + %82 = OpConvertSToF %19 %81 + %83 = OpAccessChain %16 %14 %15 %35 + %84 = OpLoad %6 %83 + %85 = OpConvertSToF %19 %84 + %86 = OpCompositeConstruct %71 %76 %79 %82 %85 + OpStore %73 %86 + OpBranch %70 + %87 = OpLabel + %88 = OpAccessChain %16 %14 %15 %15 + %89 = OpLoad %6 %88 + %90 = OpConvertSToF %19 %89 + %91 = OpCompositeConstruct %71 %90 %90 %90 %90 + OpStore %73 %91 + OpBranch %70 + %70 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS push_constant + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-uniform-vector-function-argument-mod-increment-integers.amber b/vulkan/amber/graphicsfuzz/cov-uniform-vector-function-argument-mod-increment-integers.amber new file mode 100644 index 0000000..bc5a74e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-uniform-vector-function-argument-mod-increment-integers.amber @@ -0,0 +1,324 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_32 _GLF_uniform_int_values[2] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 32] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# // Contents of resolution: [32.0, 32.0] +# layout(push_constant) uniform buf_push +# { +# vec2 resolution; +# }; +# +# int func(float a, float b) +# { +# int c = _int_1; +# int d = 1; +# +# for(int i = 0; i < 2; i ++) +# { +# while(d < 110) +# { +# // Always true, keeping c incremented at the +# // same rate as d. +# if(mod(float(d), b) > _float_0_0) +# { +# c++; +# } +# +# // Returns when c is 32. +# if(float(d) >= a) +# { +# return c; +# } +# +# d++; +# } +# } +# +# // Never executed. +# return _int_0; +# } +# +# void main() +# { +# // Always true. +# if(func(resolution.x, resolution.y) == _int_32) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 118 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %99 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "func(f1;f1;" + OpName %10 "a" + OpName %11 "b" + OpName %15 "c" + OpName %19 "buf0" + OpMemberName %19 0 "_GLF_uniform_int_values" + OpName %21 "" + OpName %27 "d" + OpName %28 "i" + OpName %52 "buf1" + OpMemberName %52 0 "_GLF_uniform_float_values" + OpName %54 "" + OpName %80 "buf_push" + OpMemberName %80 0 "resolution" + OpName %82 "" + OpName %83 "param" + OpName %88 "param" + OpName %99 "_GLF_color" + OpDecorate %18 ArrayStride 16 + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 0 + OpDecorate %51 ArrayStride 16 + OpMemberDecorate %52 0 Offset 0 + OpDecorate %52 Block + OpDecorate %54 DescriptorSet 0 + OpDecorate %54 Binding 1 + OpMemberDecorate %80 0 Offset 0 + OpDecorate %80 Block + OpDecorate %99 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeInt 32 1 + %9 = OpTypeFunction %8 %7 %7 + %14 = OpTypePointer Function %8 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 3 + %18 = OpTypeArray %8 %17 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpConstant %8 0 + %23 = OpConstant %8 1 + %24 = OpTypePointer Uniform %8 + %35 = OpConstant %8 2 + %36 = OpTypeBool + %44 = OpConstant %8 110 + %50 = OpConstant %16 1 + %51 = OpTypeArray %6 %50 + %52 = OpTypeStruct %51 + %53 = OpTypePointer Uniform %52 + %54 = OpVariable %53 Uniform + %55 = OpTypePointer Uniform %6 + %79 = OpTypeVector %6 2 + %80 = OpTypeStruct %79 + %81 = OpTypePointer PushConstant %80 + %82 = OpVariable %81 PushConstant + %84 = OpConstant %16 0 + %85 = OpTypePointer PushConstant %6 + %97 = OpTypeVector %6 4 + %98 = OpTypePointer Output %97 + %99 = OpVariable %98 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %83 = OpVariable %7 Function + %88 = OpVariable %7 Function + %86 = OpAccessChain %85 %82 %22 %84 + %87 = OpLoad %6 %86 + OpStore %83 %87 + %89 = OpAccessChain %85 %82 %22 %50 + %90 = OpLoad %6 %89 + OpStore %88 %90 + %91 = OpFunctionCall %8 %12 %83 %88 + %92 = OpAccessChain %24 %21 %22 %35 + %93 = OpLoad %8 %92 + %94 = OpIEqual %36 %91 %93 + OpSelectionMerge %96 None + OpBranchConditional %94 %95 %113 + %95 = OpLabel + %100 = OpAccessChain %24 %21 %22 %23 + %101 = OpLoad %8 %100 + %102 = OpConvertSToF %6 %101 + %103 = OpAccessChain %24 %21 %22 %22 + %104 = OpLoad %8 %103 + %105 = OpConvertSToF %6 %104 + %106 = OpAccessChain %24 %21 %22 %22 + %107 = OpLoad %8 %106 + %108 = OpConvertSToF %6 %107 + %109 = OpAccessChain %24 %21 %22 %23 + %110 = OpLoad %8 %109 + %111 = OpConvertSToF %6 %110 + %112 = OpCompositeConstruct %97 %102 %105 %108 %111 + OpStore %99 %112 + OpBranch %96 + %113 = OpLabel + %114 = OpAccessChain %24 %21 %22 %22 + %115 = OpLoad %8 %114 + %116 = OpConvertSToF %6 %115 + %117 = OpCompositeConstruct %97 %116 %116 %116 %116 + OpStore %99 %117 + OpBranch %96 + %96 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %8 None %9 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %15 = OpVariable %14 Function + %27 = OpVariable %14 Function + %28 = OpVariable %14 Function + %25 = OpAccessChain %24 %21 %22 %23 + %26 = OpLoad %8 %25 + OpStore %15 %26 + OpStore %27 %23 + OpStore %28 %22 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %8 %28 + %37 = OpSLessThan %36 %34 %35 + OpBranchConditional %37 %30 %31 + %30 = OpLabel + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %8 %27 + %45 = OpSLessThan %36 %43 %44 + OpBranchConditional %45 %39 %40 + %39 = OpLabel + %46 = OpLoad %8 %27 + %47 = OpConvertSToF %6 %46 + %48 = OpLoad %6 %11 + %49 = OpFMod %6 %47 %48 + %56 = OpAccessChain %55 %54 %22 %22 + %57 = OpLoad %6 %56 + %58 = OpFOrdGreaterThan %36 %49 %57 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %60 + %59 = OpLabel + %61 = OpLoad %8 %15 + %62 = OpIAdd %8 %61 %23 + OpStore %15 %62 + OpBranch %60 + %60 = OpLabel + %63 = OpLoad %8 %27 + %64 = OpConvertSToF %6 %63 + %65 = OpLoad %6 %10 + %66 = OpFOrdGreaterThanEqual %36 %64 %65 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %68 + %67 = OpLabel + %69 = OpLoad %8 %15 + OpReturnValue %69 + %68 = OpLabel + %71 = OpLoad %8 %27 + %72 = OpIAdd %8 %71 %23 + OpStore %27 %72 + OpBranch %41 + %41 = OpLabel + OpBranch %38 + %40 = OpLabel + OpBranch %32 + %32 = OpLabel + %73 = OpLoad %8 %28 + %74 = OpIAdd %8 %73 %23 + OpStore %28 %74 + OpBranch %29 + %31 = OpLabel + %75 = OpAccessChain %24 %21 %22 %22 + %76 = OpLoad %8 %75 + OpReturnValue %76 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 32.0 32.0 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 32 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS push_constant + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed.amber b/vulkan/amber/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed.amber new file mode 100644 index 0000000..af41535 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed.amber @@ -0,0 +1,291 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_10 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 10] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S +# { +# int data; +# }; +# +# void func(inout S s, int x) +# { +# // Always false. +# if (_int_1 == _int_0) +# { +# return; +# } +# +# s.data = x; +# } +# +# void main() +# { +# // This variable needs to be uninitialized to hit the coverage point. +# // However, the uninitialized values are never read. +# int index; +# +# S arr[10]; +# for (int i = 0; i < 10; i++) +# arr[i].data = 0; +# +# // Always false. +# if (_int_1 == _int_0) +# { +# // Uninitialized value access that is never executed. +# func(arr[index], index); +# } +# else +# { +# func(arr[_int_0], _int_1); +# } +# +# // Always true. +# if (arr[_int_0].data == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 112 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %93 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "S" + OpMemberName %7 0 "data" + OpName %13 "func(struct-S-i11;i1;" + OpName %11 "s" + OpName %12 "x" + OpName %18 "buf0" + OpMemberName %18 0 "_GLF_uniform_int_values" + OpName %20 "" + OpName %35 "i" + OpName %47 "arr" + OpName %59 "index" + OpName %61 "param" + OpName %64 "param" + OpName %72 "param" + OpName %75 "param" + OpName %93 "_GLF_color" + OpDecorate %17 ArrayStride 16 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %93 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Function %7 + %9 = OpTypePointer Function %6 + %10 = OpTypeFunction %2 %8 %9 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 3 + %17 = OpTypeArray %6 %16 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpConstant %6 0 + %22 = OpConstant %6 1 + %23 = OpTypePointer Uniform %6 + %28 = OpTypeBool + %42 = OpConstant %6 10 + %44 = OpConstant %15 10 + %45 = OpTypeArray %7 %44 + %46 = OpTypePointer Function %45 + %90 = OpTypeFloat 32 + %91 = OpTypeVector %90 4 + %92 = OpTypePointer Output %91 + %93 = OpVariable %92 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %35 = OpVariable %9 Function + %47 = OpVariable %46 Function + %59 = OpVariable %9 Function + %61 = OpVariable %8 Function + %64 = OpVariable %9 Function + %72 = OpVariable %8 Function + %75 = OpVariable %9 Function + OpStore %35 %21 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %6 %35 + %43 = OpSLessThan %28 %41 %42 + OpBranchConditional %43 %37 %38 + %37 = OpLabel + %48 = OpLoad %6 %35 + %49 = OpAccessChain %9 %47 %48 %21 + OpStore %49 %21 + OpBranch %39 + %39 = OpLabel + %50 = OpLoad %6 %35 + %51 = OpIAdd %6 %50 %22 + OpStore %35 %51 + OpBranch %36 + %38 = OpLabel + %52 = OpAccessChain %23 %20 %21 %22 + %53 = OpLoad %6 %52 + %54 = OpAccessChain %23 %20 %21 %21 + %55 = OpLoad %6 %54 + %56 = OpIEqual %28 %53 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %69 + %57 = OpLabel + %60 = OpLoad %6 %59 + %62 = OpAccessChain %8 %47 %60 + %63 = OpLoad %7 %62 + OpStore %61 %63 + %65 = OpLoad %6 %59 + OpStore %64 %65 + %66 = OpFunctionCall %2 %13 %61 %64 + %67 = OpLoad %7 %61 + %68 = OpAccessChain %8 %47 %60 + OpStore %68 %67 + OpBranch %58 + %69 = OpLabel + %70 = OpAccessChain %23 %20 %21 %21 + %71 = OpLoad %6 %70 + %73 = OpAccessChain %8 %47 %71 + %74 = OpLoad %7 %73 + OpStore %72 %74 + %76 = OpAccessChain %23 %20 %21 %22 + %77 = OpLoad %6 %76 + OpStore %75 %77 + %78 = OpFunctionCall %2 %13 %72 %75 + %79 = OpLoad %7 %72 + %80 = OpAccessChain %8 %47 %71 + OpStore %80 %79 + OpBranch %58 + %58 = OpLabel + %81 = OpAccessChain %23 %20 %21 %21 + %82 = OpLoad %6 %81 + %83 = OpAccessChain %9 %47 %82 %21 + %84 = OpLoad %6 %83 + %85 = OpAccessChain %23 %20 %21 %22 + %86 = OpLoad %6 %85 + %87 = OpIEqual %28 %84 %86 + OpSelectionMerge %89 None + OpBranchConditional %87 %88 %107 + %88 = OpLabel + %94 = OpAccessChain %23 %20 %21 %22 + %95 = OpLoad %6 %94 + %96 = OpConvertSToF %90 %95 + %97 = OpAccessChain %23 %20 %21 %21 + %98 = OpLoad %6 %97 + %99 = OpConvertSToF %90 %98 + %100 = OpAccessChain %23 %20 %21 %21 + %101 = OpLoad %6 %100 + %102 = OpConvertSToF %90 %101 + %103 = OpAccessChain %23 %20 %21 %22 + %104 = OpLoad %6 %103 + %105 = OpConvertSToF %90 %104 + %106 = OpCompositeConstruct %91 %96 %99 %102 %105 + OpStore %93 %106 + OpBranch %89 + %107 = OpLabel + %108 = OpAccessChain %23 %20 %21 %21 + %109 = OpLoad %6 %108 + %110 = OpConvertSToF %90 %109 + %111 = OpCompositeConstruct %91 %110 %110 %110 %110 + OpStore %93 %111 + OpBranch %89 + %89 = OpLabel + OpReturn + OpFunctionEnd + %13 = OpFunction %2 None %10 + %11 = OpFunctionParameter %8 + %12 = OpFunctionParameter %9 + %14 = OpLabel + %24 = OpAccessChain %23 %20 %21 %22 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %23 %20 %21 %21 + %27 = OpLoad %6 %26 + %29 = OpIEqual %28 %25 %27 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %31 + %30 = OpLabel + OpReturn + %31 = OpLabel + %33 = OpLoad %6 %12 + %34 = OpAccessChain %9 %11 %21 + OpStore %34 %33 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 10 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-unpack-unorm-mix-always-one.amber b/vulkan/amber/graphicsfuzz/cov-unpack-unorm-mix-always-one.amber new file mode 100644 index 0000000..af9f19b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-unpack-unorm-mix-always-one.amber @@ -0,0 +1,238 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _uint_1 _GLF_uniform_uint_values[0] +# #define _float_0_01 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# #define _float_255_0 _GLF_uniform_float_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_uint_values: 1 +# layout(set = 0, binding = 0) uniform buf0 +# { +# uint _GLF_uniform_uint_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.01, 1.0, 255.0] +# layout(set = 0, binding = 2) uniform buf2 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Mix always chooses 1. Unpack results in (0, 0, 0, 1/255). +# vec4 v = unpackUnorm4x8(_uint_1 / mix(_uint_1, 92382u, true)); +# +# // Always true. +# if (distance(v, vec4(_int_0, _int_0, _int_0, _float_1_0 / _float_255_0)) < _float_0_01) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %66 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %13 "buf0" + OpMemberName %13 0 "_GLF_uniform_uint_values" + OpName %15 "" + OpName %32 "buf1" + OpMemberName %32 0 "_GLF_uniform_int_values" + OpName %34 "" + OpName %47 "buf2" + OpMemberName %47 0 "_GLF_uniform_float_values" + OpName %49 "" + OpName %66 "_GLF_color" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %31 ArrayStride 16 + OpMemberDecorate %32 0 Offset 0 + OpDecorate %32 Block + OpDecorate %34 DescriptorSet 0 + OpDecorate %34 Binding 1 + OpDecorate %46 ArrayStride 16 + OpMemberDecorate %47 0 Offset 0 + OpDecorate %47 Block + OpDecorate %49 DescriptorSet 0 + OpDecorate %49 Binding 2 + OpDecorate %66 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 1 + %12 = OpTypeArray %10 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %10 + %23 = OpConstant %10 92382 + %24 = OpTypeBool + %25 = OpConstantTrue %24 + %30 = OpConstant %10 2 + %31 = OpTypeArray %16 %30 + %32 = OpTypeStruct %31 + %33 = OpTypePointer Uniform %32 + %34 = OpVariable %33 Uniform + %35 = OpTypePointer Uniform %16 + %45 = OpConstant %10 3 + %46 = OpTypeArray %6 %45 + %47 = OpTypeStruct %46 + %48 = OpTypePointer Uniform %47 + %49 = OpVariable %48 Uniform + %50 = OpConstant %16 1 + %51 = OpTypePointer Uniform %6 + %54 = OpConstant %16 2 + %65 = OpTypePointer Output %7 + %66 = OpVariable %65 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %19 = OpAccessChain %18 %15 %17 %17 + %20 = OpLoad %10 %19 + %21 = OpAccessChain %18 %15 %17 %17 + %22 = OpLoad %10 %21 + %26 = OpSelect %10 %25 %23 %22 + %27 = OpUDiv %10 %20 %26 + %28 = OpExtInst %7 %1 UnpackUnorm4x8 %27 + OpStore %9 %28 + %29 = OpLoad %7 %9 + %36 = OpAccessChain %35 %34 %17 %17 + %37 = OpLoad %16 %36 + %38 = OpConvertSToF %6 %37 + %39 = OpAccessChain %35 %34 %17 %17 + %40 = OpLoad %16 %39 + %41 = OpConvertSToF %6 %40 + %42 = OpAccessChain %35 %34 %17 %17 + %43 = OpLoad %16 %42 + %44 = OpConvertSToF %6 %43 + %52 = OpAccessChain %51 %49 %17 %50 + %53 = OpLoad %6 %52 + %55 = OpAccessChain %51 %49 %17 %54 + %56 = OpLoad %6 %55 + %57 = OpFDiv %6 %53 %56 + %58 = OpCompositeConstruct %7 %38 %41 %44 %57 + %59 = OpExtInst %6 %1 Distance %29 %58 + %60 = OpAccessChain %51 %49 %17 %17 + %61 = OpLoad %6 %60 + %62 = OpFOrdLessThan %24 %59 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %80 + %63 = OpLabel + %67 = OpAccessChain %35 %34 %17 %50 + %68 = OpLoad %16 %67 + %69 = OpConvertSToF %6 %68 + %70 = OpAccessChain %35 %34 %17 %17 + %71 = OpLoad %16 %70 + %72 = OpConvertSToF %6 %71 + %73 = OpAccessChain %35 %34 %17 %17 + %74 = OpLoad %16 %73 + %75 = OpConvertSToF %6 %74 + %76 = OpAccessChain %35 %34 %17 %50 + %77 = OpLoad %16 %76 + %78 = OpConvertSToF %6 %77 + %79 = OpCompositeConstruct %7 %69 %72 %75 %78 + OpStore %66 %79 + OpBranch %64 + %80 = OpLabel + %81 = OpAccessChain %35 %34 %17 %17 + %82 = OpLoad %16 %81 + %83 = OpConvertSToF %6 %82 + %84 = OpCompositeConstruct %7 %83 %83 %83 %83 + OpStore %66 %84 + OpBranch %64 + %64 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.01 1.0 255.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_uint_values +BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-unused-access-past-matrix-elements.amber b/vulkan/amber/graphicsfuzz/cov-unused-access-past-matrix-elements.amber new file mode 100644 index 0000000..37e7910 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-unused-access-past-matrix-elements.amber @@ -0,0 +1,315 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--vector-dce' +# '--scalar-replacement=100' +# '--eliminate-local-multi-store' +# '--copy-propagate-arrays' +# '--convert-local-access-chains' +# '--reduce-load-size' +# '--eliminate-dead-inserts' +# '--eliminate-dead-inserts' +# '--ccp' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_4 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_3_0 _GLF_uniform_float_values[2] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0, 2, 4] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 3.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat4x3 m43 = mat4x3(_float_0_0); +# m43[_int_1][_int_1] = _float_1_0; +# float sums[3] = float[3](_float_1_0, _float_1_0, _float_1_0); +# +# // Increases sums[1] by one, picking it from m43[1][1]. +# for(int i = _int_1; i < _int_4; i++) +# { +# sums[_int_1] += m43[i][_int_1]; +# } +# +# // Always false. +# if (_int_0 == 1) +# { +# // Static out of bound access is required +# // to hit the coverage point. Still, this +# // is never executed. +# int a = 4; +# sums[_int_2] += m43[a][_int_1]; +# } +# +# if(sums[_int_0] + sums[_int_1] == _float_3_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 137 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %116 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "m43" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %32 "buf0" + OpMemberName %32 0 "_GLF_uniform_int_values" + OpName %34 "" + OpName %45 "sums" + OpName %54 "i" + OpName %86 "a" + OpName %116 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %31 ArrayStride 16 + OpMemberDecorate %32 0 Offset 0 + OpDecorate %32 Block + OpDecorate %34 DescriptorSet 0 + OpDecorate %34 Binding 0 + OpDecorate %116 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeMatrix %7 4 + %9 = OpTypePointer Function %8 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 3 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpConstant %17 1 + %20 = OpTypePointer Uniform %6 + %23 = OpConstant %6 1 + %24 = OpConstant %6 0 + %30 = OpConstant %11 4 + %31 = OpTypeArray %17 %30 + %32 = OpTypeStruct %31 + %33 = OpTypePointer Uniform %32 + %34 = OpVariable %33 Uniform + %35 = OpTypePointer Uniform %17 + %42 = OpTypePointer Function %6 + %44 = OpTypePointer Function %13 + %53 = OpTypePointer Function %17 + %63 = OpConstant %17 3 + %66 = OpTypeBool + %87 = OpConstant %17 4 + %88 = OpConstant %17 2 + %114 = OpTypeVector %6 4 + %115 = OpTypePointer Output %114 + %116 = OpVariable %115 Output + %136 = OpConstantComposite %7 %24 %24 %24 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %45 = OpVariable %44 Function + %54 = OpVariable %53 Function + %86 = OpVariable %53 Function + %21 = OpAccessChain %20 %16 %18 %19 + %22 = OpLoad %6 %21 + %25 = OpCompositeConstruct %7 %22 %24 %24 + %26 = OpCompositeConstruct %7 %24 %22 %24 + %27 = OpCompositeConstruct %7 %24 %24 %22 + %28 = OpCompositeConstruct %7 %24 %24 %24 + %29 = OpCompositeConstruct %8 %25 %26 %27 %136 + OpStore %10 %29 + %36 = OpAccessChain %35 %34 %18 %18 + %37 = OpLoad %17 %36 + %38 = OpAccessChain %35 %34 %18 %18 + %39 = OpLoad %17 %38 + %40 = OpAccessChain %20 %16 %18 %18 + %41 = OpLoad %6 %40 + %43 = OpAccessChain %42 %10 %37 %39 + OpStore %43 %41 + %46 = OpAccessChain %20 %16 %18 %18 + %47 = OpLoad %6 %46 + %48 = OpAccessChain %20 %16 %18 %18 + %49 = OpLoad %6 %48 + %50 = OpAccessChain %20 %16 %18 %18 + %51 = OpLoad %6 %50 + %52 = OpCompositeConstruct %13 %47 %49 %51 + OpStore %45 %52 + %55 = OpAccessChain %35 %34 %18 %18 + %56 = OpLoad %17 %55 + OpStore %54 %56 + OpBranch %57 + %57 = OpLabel + %135 = OpPhi %17 %56 %5 %80 %60 + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %64 = OpAccessChain %35 %34 %18 %63 + %65 = OpLoad %17 %64 + %67 = OpSLessThan %66 %135 %65 + OpBranchConditional %67 %58 %59 + %58 = OpLabel + %68 = OpAccessChain %35 %34 %18 %18 + %69 = OpLoad %17 %68 + %71 = OpAccessChain %35 %34 %18 %18 + %72 = OpLoad %17 %71 + %73 = OpAccessChain %42 %10 %135 %72 + %74 = OpLoad %6 %73 + %75 = OpAccessChain %42 %45 %69 + %76 = OpLoad %6 %75 + %77 = OpFAdd %6 %76 %74 + %78 = OpAccessChain %42 %45 %69 + OpStore %78 %77 + OpBranch %60 + %60 = OpLabel + %80 = OpIAdd %17 %135 %19 + OpStore %54 %80 + OpBranch %57 + %59 = OpLabel + %81 = OpAccessChain %35 %34 %18 %19 + %82 = OpLoad %17 %81 + %83 = OpIEqual %66 %82 %19 + OpSelectionMerge %85 None + OpBranchConditional %83 %84 %85 + %84 = OpLabel + OpStore %86 %87 + %89 = OpAccessChain %35 %34 %18 %88 + %90 = OpLoad %17 %89 + %92 = OpAccessChain %35 %34 %18 %18 + %93 = OpLoad %17 %92 + %94 = OpAccessChain %42 %10 %87 %93 + %95 = OpLoad %6 %94 + %96 = OpAccessChain %42 %45 %90 + %97 = OpLoad %6 %96 + %98 = OpFAdd %6 %97 %95 + %99 = OpAccessChain %42 %45 %90 + OpStore %99 %98 + OpBranch %85 + %85 = OpLabel + %100 = OpAccessChain %35 %34 %18 %19 + %101 = OpLoad %17 %100 + %102 = OpAccessChain %42 %45 %101 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %35 %34 %18 %18 + %105 = OpLoad %17 %104 + %106 = OpAccessChain %42 %45 %105 + %107 = OpLoad %6 %106 + %108 = OpFAdd %6 %103 %107 + %109 = OpAccessChain %20 %16 %18 %88 + %110 = OpLoad %6 %109 + %111 = OpFOrdEqual %66 %108 %110 + OpSelectionMerge %113 None + OpBranchConditional %111 %112 %130 + %112 = OpLabel + %117 = OpAccessChain %35 %34 %18 %18 + %118 = OpLoad %17 %117 + %119 = OpConvertSToF %6 %118 + %120 = OpAccessChain %35 %34 %18 %19 + %121 = OpLoad %17 %120 + %122 = OpConvertSToF %6 %121 + %123 = OpAccessChain %35 %34 %18 %19 + %124 = OpLoad %17 %123 + %125 = OpConvertSToF %6 %124 + %126 = OpAccessChain %35 %34 %18 %18 + %127 = OpLoad %17 %126 + %128 = OpConvertSToF %6 %127 + %129 = OpCompositeConstruct %114 %119 %122 %125 %128 + OpStore %116 %129 + OpBranch %113 + %130 = OpLabel + %131 = OpAccessChain %35 %34 %18 %19 + %132 = OpLoad %17 %131 + %133 = OpConvertSToF %6 %132 + %134 = OpCompositeConstruct %114 %133 %133 %133 %133 + OpStore %116 %134 + OpBranch %113 + %113 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 3.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 2 4 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-unused-matrix-copy-inside-loop.amber b/vulkan/amber/graphicsfuzz/cov-unused-matrix-copy-inside-loop.amber new file mode 100644 index 0000000..f442446 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-unused-matrix-copy-inside-loop.amber @@ -0,0 +1,327 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# #define _int_100 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# #define _int_4 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [100, 0, 1, 4] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat4 m0 = mat4(_int_0); +# +# for(int c = _int_1; c < _int_100; c++) +# { +# // m1 has no dependency outside this block. +# mat4 m1 = m0; +# +# m1[c % _int_4][_int_1] = _float_1_0; +# m0[c % _int_4][_int_1] = _float_1_0; +# } +# +# // Always true. +# if(m0 == mat4(_int_0, _int_1, _int_0, _int_0, _int_0, _int_1, _int_0, _int_0, _int_0, _int_1, _int_0, _int_0, _int_0, _int_1, _int_0, _int_0)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 172 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %153 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "m0" + OpName %15 "buf1" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %32 "c" + OpName %46 "m1" + OpName %57 "buf0" + OpMemberName %57 0 "_GLF_uniform_float_values" + OpName %59 "" + OpName %153 "_GLF_color" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 1 + OpDecorate %56 ArrayStride 16 + OpMemberDecorate %57 0 Offset 0 + OpDecorate %57 Block + OpDecorate %59 DescriptorSet 0 + OpDecorate %59 Binding 0 + OpDecorate %153 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeMatrix %7 4 + %9 = OpTypePointer Function %8 + %11 = OpTypeInt 32 1 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 4 + %14 = OpTypeArray %11 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %11 0 + %19 = OpConstant %11 1 + %20 = OpTypePointer Uniform %11 + %24 = OpConstant %6 1 + %25 = OpConstant %6 0 + %31 = OpTypePointer Function %11 + %33 = OpConstant %11 2 + %44 = OpTypeBool + %49 = OpConstant %11 3 + %55 = OpConstant %12 1 + %56 = OpTypeArray %6 %55 + %57 = OpTypeStruct %56 + %58 = OpTypePointer Uniform %57 + %59 = OpVariable %58 Uniform + %60 = OpTypePointer Uniform %6 + %63 = OpTypePointer Function %6 + %132 = OpTypeVector %44 4 + %152 = OpTypePointer Output %7 + %153 = OpVariable %152 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %32 = OpVariable %31 Function + %46 = OpVariable %9 Function + %21 = OpAccessChain %20 %17 %18 %19 + %22 = OpLoad %11 %21 + %23 = OpConvertSToF %6 %22 + %26 = OpCompositeConstruct %7 %23 %25 %25 %25 + %27 = OpCompositeConstruct %7 %25 %23 %25 %25 + %28 = OpCompositeConstruct %7 %25 %25 %23 %25 + %29 = OpCompositeConstruct %7 %25 %25 %25 %23 + %30 = OpCompositeConstruct %8 %26 %27 %28 %29 + OpStore %10 %30 + %34 = OpAccessChain %20 %17 %18 %33 + %35 = OpLoad %11 %34 + OpStore %32 %35 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %11 %32 + %42 = OpAccessChain %20 %17 %18 %18 + %43 = OpLoad %11 %42 + %45 = OpSLessThan %44 %41 %43 + OpBranchConditional %45 %37 %38 + %37 = OpLabel + %47 = OpLoad %8 %10 + OpStore %46 %47 + %48 = OpLoad %11 %32 + %50 = OpAccessChain %20 %17 %18 %49 + %51 = OpLoad %11 %50 + %52 = OpSMod %11 %48 %51 + %53 = OpAccessChain %20 %17 %18 %33 + %54 = OpLoad %11 %53 + %61 = OpAccessChain %60 %59 %18 %18 + %62 = OpLoad %6 %61 + %64 = OpAccessChain %63 %46 %52 %54 + OpStore %64 %62 + %65 = OpLoad %11 %32 + %66 = OpAccessChain %20 %17 %18 %49 + %67 = OpLoad %11 %66 + %68 = OpSMod %11 %65 %67 + %69 = OpAccessChain %20 %17 %18 %33 + %70 = OpLoad %11 %69 + %71 = OpAccessChain %60 %59 %18 %18 + %72 = OpLoad %6 %71 + %73 = OpAccessChain %63 %10 %68 %70 + OpStore %73 %72 + OpBranch %39 + %39 = OpLabel + %74 = OpLoad %11 %32 + %75 = OpIAdd %11 %74 %19 + OpStore %32 %75 + OpBranch %36 + %38 = OpLabel + %76 = OpLoad %8 %10 + %77 = OpAccessChain %20 %17 %18 %19 + %78 = OpLoad %11 %77 + %79 = OpConvertSToF %6 %78 + %80 = OpAccessChain %20 %17 %18 %33 + %81 = OpLoad %11 %80 + %82 = OpConvertSToF %6 %81 + %83 = OpAccessChain %20 %17 %18 %19 + %84 = OpLoad %11 %83 + %85 = OpConvertSToF %6 %84 + %86 = OpAccessChain %20 %17 %18 %19 + %87 = OpLoad %11 %86 + %88 = OpConvertSToF %6 %87 + %89 = OpAccessChain %20 %17 %18 %19 + %90 = OpLoad %11 %89 + %91 = OpConvertSToF %6 %90 + %92 = OpAccessChain %20 %17 %18 %33 + %93 = OpLoad %11 %92 + %94 = OpConvertSToF %6 %93 + %95 = OpAccessChain %20 %17 %18 %19 + %96 = OpLoad %11 %95 + %97 = OpConvertSToF %6 %96 + %98 = OpAccessChain %20 %17 %18 %19 + %99 = OpLoad %11 %98 + %100 = OpConvertSToF %6 %99 + %101 = OpAccessChain %20 %17 %18 %19 + %102 = OpLoad %11 %101 + %103 = OpConvertSToF %6 %102 + %104 = OpAccessChain %20 %17 %18 %33 + %105 = OpLoad %11 %104 + %106 = OpConvertSToF %6 %105 + %107 = OpAccessChain %20 %17 %18 %19 + %108 = OpLoad %11 %107 + %109 = OpConvertSToF %6 %108 + %110 = OpAccessChain %20 %17 %18 %19 + %111 = OpLoad %11 %110 + %112 = OpConvertSToF %6 %111 + %113 = OpAccessChain %20 %17 %18 %19 + %114 = OpLoad %11 %113 + %115 = OpConvertSToF %6 %114 + %116 = OpAccessChain %20 %17 %18 %33 + %117 = OpLoad %11 %116 + %118 = OpConvertSToF %6 %117 + %119 = OpAccessChain %20 %17 %18 %19 + %120 = OpLoad %11 %119 + %121 = OpConvertSToF %6 %120 + %122 = OpAccessChain %20 %17 %18 %19 + %123 = OpLoad %11 %122 + %124 = OpConvertSToF %6 %123 + %125 = OpCompositeConstruct %7 %79 %82 %85 %88 + %126 = OpCompositeConstruct %7 %91 %94 %97 %100 + %127 = OpCompositeConstruct %7 %103 %106 %109 %112 + %128 = OpCompositeConstruct %7 %115 %118 %121 %124 + %129 = OpCompositeConstruct %8 %125 %126 %127 %128 + %130 = OpCompositeExtract %7 %76 0 + %131 = OpCompositeExtract %7 %129 0 + %133 = OpFOrdEqual %132 %130 %131 + %134 = OpAll %44 %133 + %135 = OpCompositeExtract %7 %76 1 + %136 = OpCompositeExtract %7 %129 1 + %137 = OpFOrdEqual %132 %135 %136 + %138 = OpAll %44 %137 + %139 = OpLogicalAnd %44 %134 %138 + %140 = OpCompositeExtract %7 %76 2 + %141 = OpCompositeExtract %7 %129 2 + %142 = OpFOrdEqual %132 %140 %141 + %143 = OpAll %44 %142 + %144 = OpLogicalAnd %44 %139 %143 + %145 = OpCompositeExtract %7 %76 3 + %146 = OpCompositeExtract %7 %129 3 + %147 = OpFOrdEqual %132 %145 %146 + %148 = OpAll %44 %147 + %149 = OpLogicalAnd %44 %144 %148 + OpSelectionMerge %151 None + OpBranchConditional %149 %150 %167 + %150 = OpLabel + %154 = OpAccessChain %20 %17 %18 %33 + %155 = OpLoad %11 %154 + %156 = OpConvertSToF %6 %155 + %157 = OpAccessChain %20 %17 %18 %19 + %158 = OpLoad %11 %157 + %159 = OpConvertSToF %6 %158 + %160 = OpAccessChain %20 %17 %18 %19 + %161 = OpLoad %11 %160 + %162 = OpConvertSToF %6 %161 + %163 = OpAccessChain %20 %17 %18 %33 + %164 = OpLoad %11 %163 + %165 = OpConvertSToF %6 %164 + %166 = OpCompositeConstruct %7 %156 %159 %162 %165 + OpStore %153 %166 + OpBranch %151 + %167 = OpLabel + %168 = OpAccessChain %20 %17 %18 %19 + %169 = OpLoad %11 %168 + %170 = OpConvertSToF %6 %169 + %171 = OpCompositeConstruct %7 %170 %170 %170 %170 + OpStore %153 %171 + OpBranch %151 + %151 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 100 0 1 4 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-val-cfg-case-fallthrough.amber b/vulkan/amber/graphicsfuzz/cov-val-cfg-case-fallthrough.amber new file mode 100644 index 0000000..641c1fd --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-val-cfg-case-fallthrough.amber @@ -0,0 +1,154 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific shader validation path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# void main() +# { +# int a = 0; +# +# switch(one) +# { +# case 2: +# case 3: +# a = 1; +# case 4: +# break; +# default: +# a = 2; +# break; +# } +# +# if (a == 2) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %10 "buf0" + OpMemberName %10 0 "one" + OpName %12 "" + OpName %33 "_GLF_color" + OpMemberDecorate %10 0 Offset 0 + OpDecorate %10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %10 = OpTypeStruct %6 + %11 = OpTypePointer Uniform %10 + %12 = OpVariable %11 Uniform + %13 = OpTypePointer Uniform %6 + %20 = OpConstant %6 1 + %22 = OpConstant %6 2 + %26 = OpTypeBool + %30 = OpTypeFloat 32 + %31 = OpTypeVector %30 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpConstant %30 1 + %35 = OpConstant %30 0 + %36 = OpConstantComposite %31 %34 %35 %35 %34 + %38 = OpConstantComposite %31 %35 %35 %35 %35 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %14 = OpAccessChain %13 %12 %9 + %15 = OpLoad %6 %14 + OpSelectionMerge %19 None + OpSwitch %15 %18 2 %16 3 %16 4 %17 + %18 = OpLabel + OpStore %8 %22 + OpBranch %19 + %16 = OpLabel + OpStore %8 %20 + OpBranch %17 + %17 = OpLabel + OpBranch %19 + %19 = OpLabel + %25 = OpLoad %6 %8 + %27 = OpIEqual %26 %25 %22 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %37 + %28 = OpLabel + OpStore %33 %36 + OpBranch %29 + %37 = OpLabel + OpStore %33 %38 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits.amber b/vulkan/amber/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits.amber new file mode 100644 index 0000000..221764e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits.amber @@ -0,0 +1,205 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers value, inst combine select and value tracking code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_2 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _int_1 _GLF_uniform_int_values[2] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [2, 0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int A[2]; +# for (int i = _int_0; i < _int_2; i++) +# { +# A[i] = i; +# } +# +# int a = min(~(A[_int_0]), ~(A[_int_1])); +# +# _GLF_color = vec4(_int_0); +# +# if (a == -_int_2) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 80 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %55 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %33 "A" + OpName %39 "a" + OpName %55 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %55 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 3 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypePointer Uniform %6 + %28 = OpTypeBool + %30 = OpConstant %9 2 + %31 = OpTypeArray %6 %30 + %32 = OpTypePointer Function %31 + %45 = OpConstant %6 2 + %52 = OpTypeFloat 32 + %53 = OpTypeVector %52 4 + %54 = OpTypePointer Output %53 + %55 = OpVariable %54 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %33 = OpVariable %32 Function + %39 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %6 %8 + %26 = OpAccessChain %17 %14 %15 %15 + %27 = OpLoad %6 %26 + %29 = OpSLessThan %28 %25 %27 + OpBranchConditional %29 %21 %22 + %21 = OpLabel + %34 = OpLoad %6 %8 + %35 = OpLoad %6 %8 + %36 = OpAccessChain %7 %33 %34 + OpStore %36 %35 + OpBranch %23 + %23 = OpLabel + %37 = OpLoad %6 %8 + %38 = OpIAdd %6 %37 %16 + OpStore %8 %38 + OpBranch %20 + %22 = OpLabel + %40 = OpAccessChain %17 %14 %15 %16 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %7 %33 %41 + %43 = OpLoad %6 %42 + %44 = OpNot %6 %43 + %46 = OpAccessChain %17 %14 %15 %45 + %47 = OpLoad %6 %46 + %48 = OpAccessChain %7 %33 %47 + %49 = OpLoad %6 %48 + %50 = OpNot %6 %49 + %51 = OpExtInst %6 %1 SMin %44 %50 + OpStore %39 %51 + %56 = OpAccessChain %17 %14 %15 %16 + %57 = OpLoad %6 %56 + %58 = OpConvertSToF %52 %57 + %59 = OpCompositeConstruct %53 %58 %58 %58 %58 + OpStore %55 %59 + %60 = OpLoad %6 %39 + %61 = OpAccessChain %17 %14 %15 %15 + %62 = OpLoad %6 %61 + %63 = OpSNegate %6 %62 + %64 = OpIEqual %28 %60 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpAccessChain %17 %14 %15 %45 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %52 %68 + %70 = OpAccessChain %17 %14 %15 %16 + %71 = OpLoad %6 %70 + %72 = OpConvertSToF %52 %71 + %73 = OpAccessChain %17 %14 %15 %16 + %74 = OpLoad %6 %73 + %75 = OpConvertSToF %52 %74 + %76 = OpAccessChain %17 %14 %15 %45 + %77 = OpLoad %6 %76 + %78 = OpConvertSToF %52 %77 + %79 = OpCompositeConstruct %53 %69 %72 %75 %78 + OpStore %55 %79 + OpBranch %66 + %66 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 2 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator.amber b/vulkan/amber/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator.amber new file mode 100644 index 0000000..d5100df --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator.amber @@ -0,0 +1,206 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that calculates modulo of constant one with a loop iterator + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_5 _GLF_uniform_int_values[0] +# #define _int_3 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# #define _int_1 _GLF_uniform_int_values[3] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [5, 3, 0, 1] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = _int_0; +# for (int i = _int_1; i < _int_5; i++) +# { +# // True when i = 1. +# if (1 % i == _int_0) +# { +# continue; +# } +# a++; +# } +# if (a == _int_3) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %56 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_int_values" + OpName %14 "" + OpName %20 "i" + OpName %56 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %56 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 4 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypePointer Uniform %6 + %21 = OpConstant %6 3 + %32 = OpTypeBool + %34 = OpConstant %6 1 + %53 = OpTypeFloat 32 + %54 = OpTypeVector %53 4 + %55 = OpTypePointer Output %54 + %56 = OpVariable %55 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %20 = OpVariable %7 Function + %18 = OpAccessChain %17 %14 %15 %16 + %19 = OpLoad %6 %18 + OpStore %8 %19 + %22 = OpAccessChain %17 %14 %15 %21 + %23 = OpLoad %6 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %20 + %30 = OpAccessChain %17 %14 %15 %15 + %31 = OpLoad %6 %30 + %33 = OpSLessThan %32 %29 %31 + OpBranchConditional %33 %25 %26 + %25 = OpLabel + %35 = OpLoad %6 %20 + %36 = OpSMod %6 %34 %35 + %37 = OpAccessChain %17 %14 %15 %16 + %38 = OpLoad %6 %37 + %39 = OpIEqual %32 %36 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %41 + %40 = OpLabel + OpBranch %27 + %41 = OpLabel + %43 = OpLoad %6 %8 + %44 = OpIAdd %6 %43 %34 + OpStore %8 %44 + OpBranch %27 + %27 = OpLabel + %45 = OpLoad %6 %20 + %46 = OpIAdd %6 %45 %34 + OpStore %20 %46 + OpBranch %24 + %26 = OpLabel + %47 = OpLoad %6 %8 + %48 = OpAccessChain %17 %14 %15 %34 + %49 = OpLoad %6 %48 + %50 = OpIEqual %32 %47 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %70 + %51 = OpLabel + %57 = OpAccessChain %17 %14 %15 %21 + %58 = OpLoad %6 %57 + %59 = OpConvertSToF %53 %58 + %60 = OpAccessChain %17 %14 %15 %16 + %61 = OpLoad %6 %60 + %62 = OpConvertSToF %53 %61 + %63 = OpAccessChain %17 %14 %15 %16 + %64 = OpLoad %6 %63 + %65 = OpConvertSToF %53 %64 + %66 = OpAccessChain %17 %14 %15 %21 + %67 = OpLoad %6 %66 + %68 = OpConvertSToF %53 %67 + %69 = OpCompositeConstruct %54 %59 %62 %65 %68 + OpStore %56 %69 + OpBranch %52 + %70 = OpLabel + %71 = OpAccessChain %17 %14 %15 %16 + %72 = OpLoad %6 %71 + %73 = OpConvertSToF %53 %72 + %74 = OpCompositeConstruct %54 %73 %73 %73 %73 + OpStore %56 %74 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 5 3 0 1 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-value-tracking-const-dfdy.amber b/vulkan/amber/graphicsfuzz/cov-value-tracking-const-dfdy.amber new file mode 100644 index 0000000..04affd3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-value-tracking-const-dfdy.amber @@ -0,0 +1,113 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific value tracking code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Constant vector doesn't change between fragments. +# vec4 diff = dFdy(acosh(vec4(8.0, 2.0, 3.5, 3.4))); +# +# if (diff == vec4(0)) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = diff; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %27 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "diff" + OpName %27 "_GLF_color" + OpDecorate %27 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 8 + %11 = OpConstant %6 2 + %12 = OpConstant %6 3.5 + %13 = OpConstant %6 3.4000001 + %14 = OpConstantComposite %7 %10 %11 %12 %13 + %18 = OpConstant %6 0 + %19 = OpConstantComposite %7 %18 %18 %18 %18 + %20 = OpTypeBool + %21 = OpTypeVector %20 4 + %26 = OpTypePointer Output %7 + %27 = OpVariable %26 Output + %28 = OpConstant %6 1 + %29 = OpConstantComposite %7 %28 %18 %18 %28 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %15 = OpExtInst %7 %1 Acosh %14 + %16 = OpDPdy %7 %15 + OpStore %9 %16 + %17 = OpLoad %7 %9 + %22 = OpFOrdEqual %21 %17 %19 + %23 = OpAll %20 %22 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %30 + %24 = OpLabel + OpStore %27 %29 + OpBranch %25 + %30 = OpLabel + %31 = OpLoad %7 %9 + OpStore %27 %31 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-value-tracking-constant-fold-refraction-dfxd-determinant.amber b/vulkan/amber/graphicsfuzz/cov-value-tracking-constant-fold-refraction-dfxd-determinant.amber new file mode 100644 index 0000000..8c63788 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-value-tracking-constant-fold-refraction-dfxd-determinant.amber @@ -0,0 +1,282 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that calculates refraction with certain values + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_0_1 _GLF_uniform_float_values[2] +# +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 0.1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float I = -1.0; +# // N becomes 0. +# float N = dFdx(determinant(mat3(1.0))); +# // Usually eta is normalized, but the spec doesn't forbid other values. +# float eta = -1.1; +# +# // Refraction calculated by the formula from the spec. +# float R; +# float k = _float_1_0 - eta * eta * (_float_1_0 - dot(N, I) * dot(N, I)); +# +# if (k < _float_0_0) +# { +# R = _float_0_0; +# } +# else +# { +# R = eta * I - (eta * dot(N, I) + sqrt(k)) * N; +# } +# +# if (abs(R - refract(I, N, eta)) < _float_0_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 116 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %91 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "I" + OpName %10 "N" + OpName %21 "eta" + OpName %23 "k" + OpName %27 "buf1" + OpMemberName %27 0 "_GLF_uniform_float_values" + OpName %29 "" + OpName %58 "R" + OpName %91 "_GLF_color" + OpName %94 "buf0" + OpMemberName %94 0 "_GLF_uniform_int_values" + OpName %96 "" + OpDecorate %26 ArrayStride 16 + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 Block + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 1 + OpDecorate %91 Location 0 + OpDecorate %93 ArrayStride 16 + OpMemberDecorate %94 0 RelaxedPrecision + OpMemberDecorate %94 0 Offset 0 + OpDecorate %94 Block + OpDecorate %96 DescriptorSet 0 + OpDecorate %96 Binding 0 + OpDecorate %99 RelaxedPrecision + OpDecorate %102 RelaxedPrecision + OpDecorate %105 RelaxedPrecision + OpDecorate %108 RelaxedPrecision + OpDecorate %113 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 -1 + %11 = OpTypeVector %6 3 + %12 = OpTypeMatrix %11 3 + %13 = OpConstant %6 1 + %14 = OpConstant %6 0 + %15 = OpConstantComposite %11 %13 %14 %14 + %16 = OpConstantComposite %11 %14 %13 %14 + %17 = OpConstantComposite %11 %14 %14 %13 + %18 = OpConstantComposite %12 %15 %16 %17 + %22 = OpConstant %6 -1.10000002 + %24 = OpTypeInt 32 0 + %25 = OpConstant %24 3 + %26 = OpTypeArray %6 %25 + %27 = OpTypeStruct %26 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %30 = OpTypeInt 32 1 + %31 = OpConstant %30 0 + %32 = OpTypePointer Uniform %6 + %51 = OpConstant %30 1 + %54 = OpTypeBool + %83 = OpConstant %30 2 + %89 = OpTypeVector %6 4 + %90 = OpTypePointer Output %89 + %91 = OpVariable %90 Output + %92 = OpConstant %24 2 + %93 = OpTypeArray %30 %92 + %94 = OpTypeStruct %93 + %95 = OpTypePointer Uniform %94 + %96 = OpVariable %95 Uniform + %97 = OpTypePointer Uniform %30 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %21 = OpVariable %7 Function + %23 = OpVariable %7 Function + %58 = OpVariable %7 Function + OpStore %8 %9 + %19 = OpExtInst %6 %1 Determinant %18 + %20 = OpDPdx %6 %19 + OpStore %10 %20 + OpStore %21 %22 + %33 = OpAccessChain %32 %29 %31 %31 + %34 = OpLoad %6 %33 + %35 = OpLoad %6 %21 + %36 = OpLoad %6 %21 + %37 = OpFMul %6 %35 %36 + %38 = OpAccessChain %32 %29 %31 %31 + %39 = OpLoad %6 %38 + %40 = OpLoad %6 %10 + %41 = OpLoad %6 %8 + %42 = OpFMul %6 %40 %41 + %43 = OpLoad %6 %10 + %44 = OpLoad %6 %8 + %45 = OpFMul %6 %43 %44 + %46 = OpFMul %6 %42 %45 + %47 = OpFSub %6 %39 %46 + %48 = OpFMul %6 %37 %47 + %49 = OpFSub %6 %34 %48 + OpStore %23 %49 + %50 = OpLoad %6 %23 + %52 = OpAccessChain %32 %29 %31 %51 + %53 = OpLoad %6 %52 + %55 = OpFOrdLessThan %54 %50 %53 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %61 + %56 = OpLabel + %59 = OpAccessChain %32 %29 %31 %51 + %60 = OpLoad %6 %59 + OpStore %58 %60 + OpBranch %57 + %61 = OpLabel + %62 = OpLoad %6 %21 + %63 = OpLoad %6 %8 + %64 = OpFMul %6 %62 %63 + %65 = OpLoad %6 %21 + %66 = OpLoad %6 %10 + %67 = OpLoad %6 %8 + %68 = OpFMul %6 %66 %67 + %69 = OpFMul %6 %65 %68 + %70 = OpLoad %6 %23 + %71 = OpExtInst %6 %1 Sqrt %70 + %72 = OpFAdd %6 %69 %71 + %73 = OpLoad %6 %10 + %74 = OpFMul %6 %72 %73 + %75 = OpFSub %6 %64 %74 + OpStore %58 %75 + OpBranch %57 + %57 = OpLabel + %76 = OpLoad %6 %58 + %77 = OpLoad %6 %8 + %78 = OpLoad %6 %10 + %79 = OpLoad %6 %21 + %80 = OpExtInst %6 %1 Refract %77 %78 %79 + %81 = OpFSub %6 %76 %80 + %82 = OpExtInst %6 %1 FAbs %81 + %84 = OpAccessChain %32 %29 %31 %83 + %85 = OpLoad %6 %84 + %86 = OpFOrdLessThan %54 %82 %85 + OpSelectionMerge %88 None + OpBranchConditional %86 %87 %111 + %87 = OpLabel + %98 = OpAccessChain %97 %96 %31 %31 + %99 = OpLoad %30 %98 + %100 = OpConvertSToF %6 %99 + %101 = OpAccessChain %97 %96 %31 %51 + %102 = OpLoad %30 %101 + %103 = OpConvertSToF %6 %102 + %104 = OpAccessChain %97 %96 %31 %51 + %105 = OpLoad %30 %104 + %106 = OpConvertSToF %6 %105 + %107 = OpAccessChain %97 %96 %31 %31 + %108 = OpLoad %30 %107 + %109 = OpConvertSToF %6 %108 + %110 = OpCompositeConstruct %89 %100 %103 %106 %109 + OpStore %91 %110 + OpBranch %88 + %111 = OpLabel + %112 = OpAccessChain %97 %96 %31 %51 + %113 = OpLoad %30 %112 + %114 = OpConvertSToF %6 %113 + %115 = OpCompositeConstruct %89 %114 %114 %114 %114 + OpStore %91 %115 + OpBranch %88 + %88 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 0.1 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-value-tracking-inclusive-or.amber b/vulkan/amber/graphicsfuzz/cov-value-tracking-inclusive-or.amber new file mode 100644 index 0000000..a8eafbd --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-value-tracking-inclusive-or.amber @@ -0,0 +1,160 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific value tracking path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int two; +# }; +# +# void main() +# { +# int a = 0; +# for (int i = 0; i < 2; i++) +# { +# a = (i | -2) - 1; +# } +# +# if (a == -2) +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# else +# { +# _GLF_color = vec4(0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %10 "i" + OpName %34 "_GLF_color" + OpName %40 "buf0" + OpMemberName %40 0 "two" + OpName %42 "" + OpDecorate %34 Location 0 + OpMemberDecorate %40 0 Offset 0 + OpDecorate %40 Block + OpDecorate %42 DescriptorSet 0 + OpDecorate %42 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpConstant %6 2 + %18 = OpTypeBool + %21 = OpConstant %6 -2 + %23 = OpConstant %6 1 + %31 = OpTypeFloat 32 + %32 = OpTypeVector %31 4 + %33 = OpTypePointer Output %32 + %34 = OpVariable %33 Output + %35 = OpConstant %31 1 + %36 = OpConstant %31 0 + %37 = OpConstantComposite %32 %35 %36 %36 %35 + %39 = OpConstantComposite %32 %36 %36 %36 %36 + %40 = OpTypeStruct %6 + %41 = OpTypePointer Uniform %40 + %42 = OpVariable %41 Uniform + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %16 = OpLoad %6 %10 + %19 = OpSLessThan %18 %16 %17 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + %20 = OpLoad %6 %10 + %22 = OpBitwiseOr %6 %20 %21 + %24 = OpISub %6 %22 %23 + OpStore %8 %24 + OpBranch %14 + %14 = OpLabel + %25 = OpLoad %6 %10 + %26 = OpIAdd %6 %25 %23 + OpStore %10 %26 + OpBranch %11 + %13 = OpLabel + %27 = OpLoad %6 %8 + %28 = OpIEqual %18 %27 %21 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %38 + %29 = OpLabel + OpStore %34 %37 + OpBranch %30 + %38 = OpLabel + OpStore %34 %39 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# two +BUFFER variant_two DATA_TYPE int32 DATA + 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-value-tracking-known-nonzero.amber b/vulkan/amber/graphicsfuzz/cov-value-tracking-known-nonzero.amber new file mode 100644 index 0000000..61fc114 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-value-tracking-known-nonzero.amber @@ -0,0 +1,213 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific value tracking path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_16384 _GLF_uniform_int_values[2] +# #define _int_98304 _GLF_uniform_int_values[3] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 16384, 98304] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int a = 65536; +# int sum = _int_0; +# +# // Always true. +# if (1 == _int_1) +# { +# a--; +# } +# for (int i = 0; i < a; i += _int_16384) +# { +# sum += i; +# } +# if (sum == _int_98304) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 76 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %57 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %10 "sum" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %30 "i" + OpName %57 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %57 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 65536 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 4 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpTypePointer Uniform %6 + %21 = OpConstant %6 1 + %24 = OpTypeBool + %42 = OpConstant %6 2 + %48 = OpConstant %6 3 + %54 = OpTypeFloat 32 + %55 = OpTypeVector %54 4 + %56 = OpTypePointer Output %55 + %57 = OpVariable %56 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %30 = OpVariable %7 Function + OpStore %8 %9 + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %6 %19 + OpStore %10 %20 + %22 = OpAccessChain %18 %16 %17 %21 + %23 = OpLoad %6 %22 + %25 = OpIEqual %24 %21 %23 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %27 + %26 = OpLabel + %28 = OpLoad %6 %8 + %29 = OpISub %6 %28 %21 + OpStore %8 %29 + OpBranch %27 + %27 = OpLabel + OpStore %30 %17 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %6 %30 + %37 = OpLoad %6 %8 + %38 = OpSLessThan %24 %36 %37 + OpBranchConditional %38 %32 %33 + %32 = OpLabel + %39 = OpLoad %6 %30 + %40 = OpLoad %6 %10 + %41 = OpIAdd %6 %40 %39 + OpStore %10 %41 + OpBranch %34 + %34 = OpLabel + %43 = OpAccessChain %18 %16 %17 %42 + %44 = OpLoad %6 %43 + %45 = OpLoad %6 %30 + %46 = OpIAdd %6 %45 %44 + OpStore %30 %46 + OpBranch %31 + %33 = OpLabel + %47 = OpLoad %6 %10 + %49 = OpAccessChain %18 %16 %17 %48 + %50 = OpLoad %6 %49 + %51 = OpIEqual %24 %47 %50 + OpSelectionMerge %53 None + OpBranchConditional %51 %52 %71 + %52 = OpLabel + %58 = OpAccessChain %18 %16 %17 %21 + %59 = OpLoad %6 %58 + %60 = OpConvertSToF %54 %59 + %61 = OpAccessChain %18 %16 %17 %17 + %62 = OpLoad %6 %61 + %63 = OpConvertSToF %54 %62 + %64 = OpAccessChain %18 %16 %17 %17 + %65 = OpLoad %6 %64 + %66 = OpConvertSToF %54 %65 + %67 = OpAccessChain %18 %16 %17 %21 + %68 = OpLoad %6 %67 + %69 = OpConvertSToF %54 %68 + %70 = OpCompositeConstruct %55 %60 %63 %66 %69 + OpStore %57 %70 + OpBranch %53 + %71 = OpLabel + %72 = OpAccessChain %18 %16 %17 %17 + %73 = OpLoad %6 %72 + %74 = OpConvertSToF %54 %73 + %75 = OpCompositeConstruct %55 %74 %74 %74 %74 + OpStore %57 %75 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 16384 98304 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-value-tracking-max-uintbitstofloat.amber b/vulkan/amber/graphicsfuzz/cov-value-tracking-max-uintbitstofloat.amber new file mode 100644 index 0000000..819b97d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-value-tracking-max-uintbitstofloat.amber @@ -0,0 +1,211 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific value tracking path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _uint_1065353216 _GLF_uniform_uint_values[0] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_uint_values: 1065353216 +# layout(set = 0, binding = 2) uniform buf2 +# { +# uint _GLF_uniform_uint_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float f = uintBitsToFloat(max(100u, _uint_1065353216)); +# if (f == _float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %37 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %13 "buf2" + OpMemberName %13 0 "_GLF_uniform_uint_values" + OpName %15 "" + OpName %25 "buf1" + OpMemberName %25 0 "_GLF_uniform_float_values" + OpName %27 "" + OpName %37 "_GLF_color" + OpName %40 "buf0" + OpMemberName %40 0 "_GLF_uniform_int_values" + OpName %42 "" + OpDecorate %12 ArrayStride 16 + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 2 + OpDecorate %24 ArrayStride 16 + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 1 + OpDecorate %37 Location 0 + OpDecorate %39 ArrayStride 16 + OpMemberDecorate %40 0 Offset 0 + OpDecorate %40 Block + OpDecorate %42 DescriptorSet 0 + OpDecorate %42 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 100 + %11 = OpConstant %9 1 + %12 = OpTypeArray %9 %11 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %9 + %24 = OpTypeArray %6 %11 + %25 = OpTypeStruct %24 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypePointer Uniform %6 + %31 = OpTypeBool + %35 = OpTypeVector %6 4 + %36 = OpTypePointer Output %35 + %37 = OpVariable %36 Output + %38 = OpConstant %9 2 + %39 = OpTypeArray %16 %38 + %40 = OpTypeStruct %39 + %41 = OpTypePointer Uniform %40 + %42 = OpVariable %41 Uniform + %43 = OpTypePointer Uniform %16 + %47 = OpConstant %16 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpAccessChain %18 %15 %17 %17 + %20 = OpLoad %9 %19 + %21 = OpExtInst %9 %1 UMax %10 %20 + %22 = OpBitcast %6 %21 + OpStore %8 %22 + %23 = OpLoad %6 %8 + %29 = OpAccessChain %28 %27 %17 %17 + %30 = OpLoad %6 %29 + %32 = OpFOrdEqual %31 %23 %30 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %58 + %33 = OpLabel + %44 = OpAccessChain %43 %42 %17 %17 + %45 = OpLoad %16 %44 + %46 = OpConvertSToF %6 %45 + %48 = OpAccessChain %43 %42 %17 %47 + %49 = OpLoad %16 %48 + %50 = OpConvertSToF %6 %49 + %51 = OpAccessChain %43 %42 %17 %47 + %52 = OpLoad %16 %51 + %53 = OpConvertSToF %6 %52 + %54 = OpAccessChain %43 %42 %17 %17 + %55 = OpLoad %16 %54 + %56 = OpConvertSToF %6 %55 + %57 = OpCompositeConstruct %35 %46 %50 %53 %56 + OpStore %37 %57 + OpBranch %34 + %58 = OpLabel + %59 = OpAccessChain %43 %42 %17 %47 + %60 = OpLoad %16 %59 + %61 = OpConvertSToF %6 %60 + %62 = OpCompositeConstruct %35 %61 %61 %61 %61 + OpStore %37 %62 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_uint_values +BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA + 1065353216 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop.amber b/vulkan/amber/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop.amber new file mode 100644 index 0000000..dbd22af --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop.amber @@ -0,0 +1,434 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that calculates negation of clamped loop iterator values + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# #define _int_4 _GLF_uniform_int_values[4] +# #define _int_5 _GLF_uniform_int_values[5] +# #define _int_10 _GLF_uniform_int_values[6] +# #define _int_15 _GLF_uniform_int_values[7] +# #define _int_6 _GLF_uniform_int_values[8] +# #define _int_7 _GLF_uniform_int_values[9] +# #define _int_8 _GLF_uniform_int_values[10] +# #define _int_9 _GLF_uniform_int_values[11] +# #define _int_11 _GLF_uniform_int_values[12] +# #define _int_12 _GLF_uniform_int_values[13] +# #define _int_13 _GLF_uniform_int_values[14] +# #define _int_14 _GLF_uniform_int_values[15] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2, 3, 4, 5, 10, 15, 6, 7, 8, 9, +# // 11, 12, 13, 14] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[16]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int data[15]; +# int ref[15]; +# ref[_int_0] = _int_0; +# ref[_int_1] = _int_1; +# ref[_int_2] = _int_2; +# ref[_int_3] = _int_3; +# ref[_int_4] = _int_4; +# ref[_int_5] = -_int_1; +# ref[_int_6] = -_int_1; +# ref[_int_7] = -_int_1; +# ref[_int_8] = -_int_1; +# ref[_int_9] = -_int_1; +# ref[_int_10] = -_int_2; +# ref[_int_11] = -_int_2; +# ref[_int_12] = -_int_2; +# ref[_int_13] = -_int_2; +# ref[_int_14] = -_int_2; +# +# for (int i = 0; i < _int_5; i++) +# { +# data[i] = ~clamp(~i, ~i, _int_1); +# } +# for (int i = _int_5; i < _int_10; i++) +# { +# data[i] = ~clamp(~i, 0, 1); +# } +# for (int i = _int_10; i < _int_15; i++) +# { +# data[i] = ~clamp(i, 0, 1); +# } +# for (int i = _int_0; i < _int_15; i++) +# { +# if (data[i] != ref[i]) +# { +# _GLF_color = vec4(_int_0); +# return; +# } +# } +# +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 228 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %207 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "ref" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %119 "i" + OpName %130 "data" + OpName %143 "i" + OpName %163 "i" + OpName %183 "i" + OpName %207 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %207 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 15 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %7 16 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpTypePointer Uniform %6 + %23 = OpTypePointer Function %6 + %25 = OpConstant %6 1 + %31 = OpConstant %6 2 + %37 = OpConstant %6 3 + %43 = OpConstant %6 4 + %49 = OpConstant %6 5 + %56 = OpConstant %6 8 + %63 = OpConstant %6 9 + %70 = OpConstant %6 10 + %77 = OpConstant %6 11 + %84 = OpConstant %6 6 + %91 = OpConstant %6 12 + %98 = OpConstant %6 13 + %105 = OpConstant %6 14 + %112 = OpConstant %6 15 + %128 = OpTypeBool + %172 = OpConstant %6 7 + %204 = OpTypeFloat 32 + %205 = OpTypeVector %204 4 + %206 = OpTypePointer Output %205 + %207 = OpVariable %206 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %119 = OpVariable %23 Function + %130 = OpVariable %10 Function + %143 = OpVariable %23 Function + %163 = OpVariable %23 Function + %183 = OpVariable %23 Function + %19 = OpAccessChain %18 %16 %17 %17 + %20 = OpLoad %6 %19 + %21 = OpAccessChain %18 %16 %17 %17 + %22 = OpLoad %6 %21 + %24 = OpAccessChain %23 %11 %20 + OpStore %24 %22 + %26 = OpAccessChain %18 %16 %17 %25 + %27 = OpLoad %6 %26 + %28 = OpAccessChain %18 %16 %17 %25 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %23 %11 %27 + OpStore %30 %29 + %32 = OpAccessChain %18 %16 %17 %31 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %18 %16 %17 %31 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %23 %11 %33 + OpStore %36 %35 + %38 = OpAccessChain %18 %16 %17 %37 + %39 = OpLoad %6 %38 + %40 = OpAccessChain %18 %16 %17 %37 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %23 %11 %39 + OpStore %42 %41 + %44 = OpAccessChain %18 %16 %17 %43 + %45 = OpLoad %6 %44 + %46 = OpAccessChain %18 %16 %17 %43 + %47 = OpLoad %6 %46 + %48 = OpAccessChain %23 %11 %45 + OpStore %48 %47 + %50 = OpAccessChain %18 %16 %17 %49 + %51 = OpLoad %6 %50 + %52 = OpAccessChain %18 %16 %17 %25 + %53 = OpLoad %6 %52 + %54 = OpSNegate %6 %53 + %55 = OpAccessChain %23 %11 %51 + OpStore %55 %54 + %57 = OpAccessChain %18 %16 %17 %56 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %18 %16 %17 %25 + %60 = OpLoad %6 %59 + %61 = OpSNegate %6 %60 + %62 = OpAccessChain %23 %11 %58 + OpStore %62 %61 + %64 = OpAccessChain %18 %16 %17 %63 + %65 = OpLoad %6 %64 + %66 = OpAccessChain %18 %16 %17 %25 + %67 = OpLoad %6 %66 + %68 = OpSNegate %6 %67 + %69 = OpAccessChain %23 %11 %65 + OpStore %69 %68 + %71 = OpAccessChain %18 %16 %17 %70 + %72 = OpLoad %6 %71 + %73 = OpAccessChain %18 %16 %17 %25 + %74 = OpLoad %6 %73 + %75 = OpSNegate %6 %74 + %76 = OpAccessChain %23 %11 %72 + OpStore %76 %75 + %78 = OpAccessChain %18 %16 %17 %77 + %79 = OpLoad %6 %78 + %80 = OpAccessChain %18 %16 %17 %25 + %81 = OpLoad %6 %80 + %82 = OpSNegate %6 %81 + %83 = OpAccessChain %23 %11 %79 + OpStore %83 %82 + %85 = OpAccessChain %18 %16 %17 %84 + %86 = OpLoad %6 %85 + %87 = OpAccessChain %18 %16 %17 %31 + %88 = OpLoad %6 %87 + %89 = OpSNegate %6 %88 + %90 = OpAccessChain %23 %11 %86 + OpStore %90 %89 + %92 = OpAccessChain %18 %16 %17 %91 + %93 = OpLoad %6 %92 + %94 = OpAccessChain %18 %16 %17 %31 + %95 = OpLoad %6 %94 + %96 = OpSNegate %6 %95 + %97 = OpAccessChain %23 %11 %93 + OpStore %97 %96 + %99 = OpAccessChain %18 %16 %17 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %18 %16 %17 %31 + %102 = OpLoad %6 %101 + %103 = OpSNegate %6 %102 + %104 = OpAccessChain %23 %11 %100 + OpStore %104 %103 + %106 = OpAccessChain %18 %16 %17 %105 + %107 = OpLoad %6 %106 + %108 = OpAccessChain %18 %16 %17 %31 + %109 = OpLoad %6 %108 + %110 = OpSNegate %6 %109 + %111 = OpAccessChain %23 %11 %107 + OpStore %111 %110 + %113 = OpAccessChain %18 %16 %17 %112 + %114 = OpLoad %6 %113 + %115 = OpAccessChain %18 %16 %17 %31 + %116 = OpLoad %6 %115 + %117 = OpSNegate %6 %116 + %118 = OpAccessChain %23 %11 %114 + OpStore %118 %117 + OpStore %119 %17 + OpBranch %120 + %120 = OpLabel + OpLoopMerge %122 %123 None + OpBranch %124 + %124 = OpLabel + %125 = OpLoad %6 %119 + %126 = OpAccessChain %18 %16 %17 %49 + %127 = OpLoad %6 %126 + %129 = OpSLessThan %128 %125 %127 + OpBranchConditional %129 %121 %122 + %121 = OpLabel + %131 = OpLoad %6 %119 + %132 = OpLoad %6 %119 + %133 = OpNot %6 %132 + %134 = OpLoad %6 %119 + %135 = OpNot %6 %134 + %136 = OpAccessChain %18 %16 %17 %25 + %137 = OpLoad %6 %136 + %138 = OpExtInst %6 %1 SClamp %133 %135 %137 + %139 = OpNot %6 %138 + %140 = OpAccessChain %23 %130 %131 + OpStore %140 %139 + OpBranch %123 + %123 = OpLabel + %141 = OpLoad %6 %119 + %142 = OpIAdd %6 %141 %25 + OpStore %119 %142 + OpBranch %120 + %122 = OpLabel + %144 = OpAccessChain %18 %16 %17 %49 + %145 = OpLoad %6 %144 + OpStore %143 %145 + OpBranch %146 + %146 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %151 = OpLoad %6 %143 + %152 = OpAccessChain %18 %16 %17 %84 + %153 = OpLoad %6 %152 + %154 = OpSLessThan %128 %151 %153 + OpBranchConditional %154 %147 %148 + %147 = OpLabel + %155 = OpLoad %6 %143 + %156 = OpLoad %6 %143 + %157 = OpNot %6 %156 + %158 = OpExtInst %6 %1 SClamp %157 %17 %25 + %159 = OpNot %6 %158 + %160 = OpAccessChain %23 %130 %155 + OpStore %160 %159 + OpBranch %149 + %149 = OpLabel + %161 = OpLoad %6 %143 + %162 = OpIAdd %6 %161 %25 + OpStore %143 %162 + OpBranch %146 + %148 = OpLabel + %164 = OpAccessChain %18 %16 %17 %84 + %165 = OpLoad %6 %164 + OpStore %163 %165 + OpBranch %166 + %166 = OpLabel + OpLoopMerge %168 %169 None + OpBranch %170 + %170 = OpLabel + %171 = OpLoad %6 %163 + %173 = OpAccessChain %18 %16 %17 %172 + %174 = OpLoad %6 %173 + %175 = OpSLessThan %128 %171 %174 + OpBranchConditional %175 %167 %168 + %167 = OpLabel + %176 = OpLoad %6 %163 + %177 = OpLoad %6 %163 + %178 = OpExtInst %6 %1 SClamp %177 %17 %25 + %179 = OpNot %6 %178 + %180 = OpAccessChain %23 %130 %176 + OpStore %180 %179 + OpBranch %169 + %169 = OpLabel + %181 = OpLoad %6 %163 + %182 = OpIAdd %6 %181 %25 + OpStore %163 %182 + OpBranch %166 + %168 = OpLabel + %184 = OpAccessChain %18 %16 %17 %17 + %185 = OpLoad %6 %184 + OpStore %183 %185 + OpBranch %186 + %186 = OpLabel + OpLoopMerge %188 %189 None + OpBranch %190 + %190 = OpLabel + %191 = OpLoad %6 %183 + %192 = OpAccessChain %18 %16 %17 %172 + %193 = OpLoad %6 %192 + %194 = OpSLessThan %128 %191 %193 + OpBranchConditional %194 %187 %188 + %187 = OpLabel + %195 = OpLoad %6 %183 + %196 = OpAccessChain %23 %130 %195 + %197 = OpLoad %6 %196 + %198 = OpLoad %6 %183 + %199 = OpAccessChain %23 %11 %198 + %200 = OpLoad %6 %199 + %201 = OpINotEqual %128 %197 %200 + OpSelectionMerge %203 None + OpBranchConditional %201 %202 %203 + %202 = OpLabel + %208 = OpAccessChain %18 %16 %17 %17 + %209 = OpLoad %6 %208 + %210 = OpConvertSToF %204 %209 + %211 = OpCompositeConstruct %205 %210 %210 %210 %210 + OpStore %207 %211 + OpReturn + %203 = OpLabel + OpBranch %189 + %189 = OpLabel + %213 = OpLoad %6 %183 + %214 = OpIAdd %6 %213 %25 + OpStore %183 %214 + OpBranch %186 + %188 = OpLabel + %215 = OpAccessChain %18 %16 %17 %25 + %216 = OpLoad %6 %215 + %217 = OpConvertSToF %204 %216 + %218 = OpAccessChain %18 %16 %17 %17 + %219 = OpLoad %6 %218 + %220 = OpConvertSToF %204 %219 + %221 = OpAccessChain %18 %16 %17 %17 + %222 = OpLoad %6 %221 + %223 = OpConvertSToF %204 %222 + %224 = OpAccessChain %18 %16 %17 %25 + %225 = OpLoad %6 %224 + %226 = OpConvertSToF %204 %225 + %227 = OpCompositeConstruct %205 %217 %220 %223 %226 + OpStore %207 %227 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 3 4 5 10 15 6 7 8 9 11 12 13 14 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-value-tracking-uniform-incident.amber b/vulkan/amber/graphicsfuzz/cov-value-tracking-uniform-incident.amber new file mode 100644 index 0000000..60b65b1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-value-tracking-uniform-incident.amber @@ -0,0 +1,164 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific value tracking code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float quarter; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 N = vec4(1, 2, 3, 4); +# vec4 I = vec4(4.0, 87.59, quarter, 92.51); +# vec4 Nref = vec4(17.05, -6.1, 4329.3705, 2.7); +# vec4 v = faceforward(N, I, Nref); +# +# if (v == vec4(-1, -2, -3, -4)) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %51 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "N" + OpName %15 "I" + OpName %17 "buf0" + OpMemberName %17 0 "quarter" + OpName %19 "" + OpName %27 "Nref" + OpName %33 "v" + OpName %51 "_GLF_color" + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %51 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstant %6 2 + %12 = OpConstant %6 3 + %13 = OpConstant %6 4 + %14 = OpConstantComposite %7 %10 %11 %12 %13 + %16 = OpConstant %6 87.5899963 + %17 = OpTypeStruct %6 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypeInt 32 1 + %21 = OpConstant %20 0 + %22 = OpTypePointer Uniform %6 + %25 = OpConstant %6 92.5100021 + %28 = OpConstant %6 17.0499992 + %29 = OpConstant %6 -6.0999999 + %30 = OpConstant %6 4329.37061 + %31 = OpConstant %6 2.70000005 + %32 = OpConstantComposite %7 %28 %29 %30 %31 + %39 = OpConstant %6 -1 + %40 = OpConstant %6 -2 + %41 = OpConstant %6 -3 + %42 = OpConstant %6 -4 + %43 = OpConstantComposite %7 %39 %40 %41 %42 + %44 = OpTypeBool + %45 = OpTypeVector %44 4 + %50 = OpTypePointer Output %7 + %51 = OpVariable %50 Output + %52 = OpConstant %6 0 + %53 = OpConstantComposite %7 %10 %52 %52 %10 + %55 = OpConstantComposite %7 %52 %52 %52 %52 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %15 = OpVariable %8 Function + %27 = OpVariable %8 Function + %33 = OpVariable %8 Function + OpStore %9 %14 + %23 = OpAccessChain %22 %19 %21 + %24 = OpLoad %6 %23 + %26 = OpCompositeConstruct %7 %13 %16 %24 %25 + OpStore %15 %26 + OpStore %27 %32 + %34 = OpLoad %7 %9 + %35 = OpLoad %7 %15 + %36 = OpLoad %7 %27 + %37 = OpExtInst %7 %1 FaceForward %34 %35 %36 + OpStore %33 %37 + %38 = OpLoad %7 %33 + %46 = OpFOrdEqual %45 %38 %43 + %47 = OpAll %44 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %54 + %48 = OpLabel + OpStore %51 %53 + OpBranch %49 + %54 = OpLabel + OpStore %51 %55 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# quarter +BUFFER variant_quarter DATA_TYPE float DATA + 0.25 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_quarter AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-variable-copy-in-function-tex-sample.amber b/vulkan/amber/graphicsfuzz/cov-variable-copy-in-function-tex-sample.amber new file mode 100644 index 0000000..8c70a7b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-variable-copy-in-function-tex-sample.amber @@ -0,0 +1,321 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 2) uniform sampler2D tex; +# +# float a = 1.0; +# float b = 2.0; +# vec4 v = vec4(1.0); +# +# // Effectively copies b = a. Sampling doesn't matter since +# // the same texel has been already sampled. +# void func() +# { +# if(b != a) +# { +# b = a; +# return; +# } +# v = texture(tex, vec2(0.0)); +# } +# +# void main() +# { +# v = texture(tex, vec2(0.0)); +# // b becomes 1. +# func(); +# // a becomes 2. +# a += v.a; +# // b becomes 2. +# func(); +# +# // Iterated once making a = 3. +# while((b > 1.0)) +# { +# b -= _float_1_0; +# a += _float_1_0; +# } +# +# if(a == 3.0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 100 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %74 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %6 "func(" + OpName %10 "a" + OpName %12 "b" + OpName %16 "v" + OpName %29 "tex" + OpName %54 "buf1" + OpMemberName %54 0 "_GLF_uniform_float_values" + OpName %56 "" + OpName %74 "_GLF_color" + OpName %77 "buf0" + OpMemberName %77 0 "_GLF_uniform_int_values" + OpName %79 "" + OpDecorate %29 RelaxedPrecision + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 2 + OpDecorate %30 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %53 ArrayStride 16 + OpMemberDecorate %54 0 Offset 0 + OpDecorate %54 Block + OpDecorate %56 DescriptorSet 0 + OpDecorate %56 Binding 1 + OpDecorate %74 Location 0 + OpDecorate %76 ArrayStride 16 + OpMemberDecorate %77 0 Offset 0 + OpDecorate %77 Block + OpDecorate %79 DescriptorSet 0 + OpDecorate %79 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeFloat 32 + %9 = OpTypePointer Private %8 + %10 = OpVariable %9 Private + %11 = OpConstant %8 1 + %12 = OpVariable %9 Private + %13 = OpConstant %8 2 + %14 = OpTypeVector %8 4 + %15 = OpTypePointer Private %14 + %16 = OpVariable %15 Private + %17 = OpConstantComposite %14 %11 %11 %11 %11 + %20 = OpTypeBool + %26 = OpTypeImage %8 2D 0 0 0 1 Unknown + %27 = OpTypeSampledImage %26 + %28 = OpTypePointer UniformConstant %27 + %29 = OpVariable %28 UniformConstant + %31 = OpTypeVector %8 2 + %32 = OpConstant %8 0 + %33 = OpConstantComposite %31 %32 %32 + %38 = OpTypeInt 32 0 + %39 = OpConstant %38 3 + %52 = OpConstant %38 1 + %53 = OpTypeArray %8 %52 + %54 = OpTypeStruct %53 + %55 = OpTypePointer Uniform %54 + %56 = OpVariable %55 Uniform + %57 = OpTypeInt 32 1 + %58 = OpConstant %57 0 + %59 = OpTypePointer Uniform %8 + %69 = OpConstant %8 3 + %73 = OpTypePointer Output %14 + %74 = OpVariable %73 Output + %75 = OpConstant %38 2 + %76 = OpTypeArray %57 %75 + %77 = OpTypeStruct %76 + %78 = OpTypePointer Uniform %77 + %79 = OpVariable %78 Uniform + %80 = OpTypePointer Uniform %57 + %84 = OpConstant %57 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %10 %11 + OpStore %12 %13 + OpStore %16 %17 + %35 = OpLoad %27 %29 + %36 = OpImageSampleImplicitLod %14 %35 %33 + OpStore %16 %36 + %37 = OpFunctionCall %2 %6 + %40 = OpAccessChain %9 %16 %39 + %41 = OpLoad %8 %40 + %42 = OpLoad %8 %10 + %43 = OpFAdd %8 %42 %41 + OpStore %10 %43 + %44 = OpFunctionCall %2 %6 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %49 + %49 = OpLabel + %50 = OpLoad %8 %12 + %51 = OpFOrdGreaterThan %20 %50 %11 + OpBranchConditional %51 %46 %47 + %46 = OpLabel + %60 = OpAccessChain %59 %56 %58 %58 + %61 = OpLoad %8 %60 + %62 = OpLoad %8 %12 + %63 = OpFSub %8 %62 %61 + OpStore %12 %63 + %64 = OpAccessChain %59 %56 %58 %58 + %65 = OpLoad %8 %64 + %66 = OpLoad %8 %10 + %67 = OpFAdd %8 %66 %65 + OpStore %10 %67 + OpBranch %48 + %48 = OpLabel + OpBranch %45 + %47 = OpLabel + %68 = OpLoad %8 %10 + %70 = OpFOrdEqual %20 %68 %69 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %95 + %71 = OpLabel + %81 = OpAccessChain %80 %79 %58 %58 + %82 = OpLoad %57 %81 + %83 = OpConvertSToF %8 %82 + %85 = OpAccessChain %80 %79 %58 %84 + %86 = OpLoad %57 %85 + %87 = OpConvertSToF %8 %86 + %88 = OpAccessChain %80 %79 %58 %84 + %89 = OpLoad %57 %88 + %90 = OpConvertSToF %8 %89 + %91 = OpAccessChain %80 %79 %58 %58 + %92 = OpLoad %57 %91 + %93 = OpConvertSToF %8 %92 + %94 = OpCompositeConstruct %14 %83 %87 %90 %93 + OpStore %74 %94 + OpBranch %72 + %95 = OpLabel + %96 = OpAccessChain %80 %79 %58 %84 + %97 = OpLoad %57 %96 + %98 = OpConvertSToF %8 %97 + %99 = OpCompositeConstruct %14 %98 %98 %98 %98 + OpStore %74 %99 + OpBranch %72 + %72 = OpLabel + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %18 = OpLoad %8 %12 + %19 = OpLoad %8 %10 + %21 = OpFUnordNotEqual %20 %18 %19 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %23 + %22 = OpLabel + %24 = OpLoad %8 %10 + OpStore %12 %24 + OpReturn + %23 = OpLabel + %30 = OpLoad %27 %29 + %34 = OpImageSampleImplicitLod %14 %30 %33 + OpStore %16 %34 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# tex +SAMPLER variant_tex + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-vec2-dot-max-uniform.amber b/vulkan/amber/graphicsfuzz/cov-vec2-dot-max-uniform.amber new file mode 100644 index 0000000..a7e4835 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-vec2-dot-max-uniform.amber @@ -0,0 +1,189 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-local-single-store' +# '--convert-local-access-chains' +# '--if-conversion' +# '--eliminate-local-single-block' +# '--simplify-instructions' +# '--inline-entry-points-exhaustive' +# '--private-to-local' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-return' +# '--combine-access-chains' +# '--reduce-load-size' +# '--reduce-load-size' +# '--combine-access-chains' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--redundancy-elimination' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-branches' +# '--eliminate-local-single-block' +# '--inline-entry-points-exhaustive' +# '--if-conversion' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_3 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_0 _GLF_uniform_int_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [3, 1, 0] +# layout(set = 0, binding = 0) uniform buf0 { +# int _GLF_uniform_int_values[3]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // f = (0, 1) * max((1, 1), (2, 3)) = (0, 1) * (2, 3) = 0 * 2 + 1 * 3 = 3 +# float f = dot(vec2(0, 1), max(vec2(_int_1, 1), vec2(2, 3))); +# +# // Always true. +# if(int(f) == _int_3) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 60 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %42 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %17 "buf0" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %42 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %42 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeVector %6 2 + %10 = OpConstant %6 0 + %11 = OpConstant %6 1 + %12 = OpConstantComposite %9 %10 %11 + %13 = OpTypeInt 32 1 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 3 + %16 = OpTypeArray %13 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %13 0 + %21 = OpConstant %13 1 + %22 = OpTypePointer Uniform %13 + %27 = OpConstant %6 2 + %28 = OpConstant %6 3 + %29 = OpConstantComposite %9 %27 %28 + %36 = OpTypeBool + %40 = OpTypeVector %6 4 + %41 = OpTypePointer Output %40 + %42 = OpVariable %41 Output + %46 = OpConstant %13 2 + %58 = OpConstantComposite %40 %10 %10 %10 %10 + %59 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpAccessChain %22 %19 %20 %21 + %24 = OpLoad %13 %23 + %26 = OpCompositeConstruct %9 %59 %11 + %30 = OpExtInst %9 %1 FMax %26 %29 + %31 = OpCompositeExtract %6 %30 1 + OpStore %8 %31 + %33 = OpConvertFToS %13 %31 + %34 = OpAccessChain %22 %19 %20 %20 + %35 = OpLoad %13 %34 + %37 = OpIEqual %36 %33 %35 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %57 + %38 = OpLabel + %45 = OpConvertSToF %6 %24 + %47 = OpAccessChain %22 %19 %20 %46 + %48 = OpLoad %13 %47 + %49 = OpConvertSToF %6 %48 + %56 = OpCompositeConstruct %40 %45 %49 %49 %45 + OpStore %42 %56 + OpBranch %39 + %57 = OpLabel + OpStore %42 %58 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 3 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-vec2-dot-minus-negative-zero.amber b/vulkan/amber/graphicsfuzz/cov-vec2-dot-minus-negative-zero.amber new file mode 100644 index 0000000..bbd0839 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-vec2-dot-minus-negative-zero.amber @@ -0,0 +1,196 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_2_0 _GLF_uniform_float_values[0] +# #define _float_1_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [2.0, 1.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // (1, 1 - (-0)) dot (1, 1) = (1, 1) dot (1, 1) = 1 * 1 + 1 * 1 = 2 +# float f = dot(vec2(_float_1_0, _float_1_0 - (- 0.0)), vec2(_float_1_0)); +# +# // Always true. +# if(f == _float_2_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %40 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "f" + OpName %12 "buf1" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %40 "_GLF_color" + OpName %42 "buf0" + OpMemberName %42 0 "_GLF_uniform_int_values" + OpName %44 "" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %40 Location 0 + OpDecorate %41 ArrayStride 16 + OpMemberDecorate %42 0 Offset 0 + OpDecorate %42 Block + OpDecorate %44 DescriptorSet 0 + OpDecorate %44 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 2 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 1 + %18 = OpTypePointer Uniform %6 + %23 = OpConstant %6 -0 + %25 = OpTypeVector %6 2 + %34 = OpTypeBool + %38 = OpTypeVector %6 4 + %39 = OpTypePointer Output %38 + %40 = OpVariable %39 Output + %41 = OpTypeArray %15 %10 + %42 = OpTypeStruct %41 + %43 = OpTypePointer Uniform %42 + %44 = OpVariable %43 Uniform + %45 = OpTypePointer Uniform %15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %6 %19 + %21 = OpAccessChain %18 %14 %16 %17 + %22 = OpLoad %6 %21 + %24 = OpFSub %6 %22 %23 + %26 = OpCompositeConstruct %25 %20 %24 + %27 = OpAccessChain %18 %14 %16 %17 + %28 = OpLoad %6 %27 + %29 = OpCompositeConstruct %25 %28 %28 + %30 = OpDot %6 %26 %29 + OpStore %8 %30 + %31 = OpLoad %6 %8 + %32 = OpAccessChain %18 %14 %16 %16 + %33 = OpLoad %6 %32 + %35 = OpFOrdEqual %34 %31 %33 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %59 + %36 = OpLabel + %46 = OpAccessChain %45 %44 %16 %16 + %47 = OpLoad %15 %46 + %48 = OpConvertSToF %6 %47 + %49 = OpAccessChain %45 %44 %16 %17 + %50 = OpLoad %15 %49 + %51 = OpConvertSToF %6 %50 + %52 = OpAccessChain %45 %44 %16 %17 + %53 = OpLoad %15 %52 + %54 = OpConvertSToF %6 %53 + %55 = OpAccessChain %45 %44 %16 %16 + %56 = OpLoad %15 %55 + %57 = OpConvertSToF %6 %56 + %58 = OpCompositeConstruct %38 %48 %51 %54 %57 + OpStore %40 %58 + OpBranch %37 + %59 = OpLabel + %60 = OpAccessChain %45 %44 %16 %17 + %61 = OpLoad %15 %60 + %62 = OpConvertSToF %6 %61 + %63 = OpCompositeConstruct %38 %62 %62 %62 %62 + OpStore %40 %63 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 2.0 1.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-vec2-duplicate-min-always-half.amber b/vulkan/amber/graphicsfuzz/cov-vec2-duplicate-min-always-half.amber new file mode 100644 index 0000000..6350c8c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-vec2-duplicate-min-always-half.amber @@ -0,0 +1,201 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific LLVM code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_5 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.5 +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // Same as min(gl_FragCoord.xy, vec2(0.5)) which always results in vec2(0.5). +# vec2 v0 = min(gl_FragCoord.xy, min(gl_FragCoord.xy, vec2(_float_0_5))); +# +# // Always true. +# if(v0 == vec2(_float_0_5)) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %42 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v0" + OpName %12 "gl_FragCoord" + OpName %20 "buf1" + OpMemberName %20 0 "_GLF_uniform_float_values" + OpName %22 "" + OpName %42 "_GLF_color" + OpName %45 "buf0" + OpMemberName %45 0 "_GLF_uniform_int_values" + OpName %47 "" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %19 ArrayStride 16 + OpMemberDecorate %20 0 Offset 0 + OpDecorate %20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 1 + OpDecorate %42 Location 0 + OpDecorate %44 ArrayStride 16 + OpMemberDecorate %45 0 Offset 0 + OpDecorate %45 Block + OpDecorate %47 DescriptorSet 0 + OpDecorate %47 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 1 + %19 = OpTypeArray %6 %18 + %20 = OpTypeStruct %19 + %21 = OpTypePointer Uniform %20 + %22 = OpVariable %21 Uniform + %23 = OpTypeInt 32 1 + %24 = OpConstant %23 0 + %25 = OpTypePointer Uniform %6 + %35 = OpTypeBool + %36 = OpTypeVector %35 2 + %41 = OpTypePointer Output %10 + %42 = OpVariable %41 Output + %43 = OpConstant %17 2 + %44 = OpTypeArray %23 %43 + %45 = OpTypeStruct %44 + %46 = OpTypePointer Uniform %45 + %47 = OpVariable %46 Uniform + %48 = OpTypePointer Uniform %23 + %52 = OpConstant %23 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %15 = OpLoad %10 %12 + %16 = OpVectorShuffle %7 %15 %15 0 1 + %26 = OpAccessChain %25 %22 %24 %24 + %27 = OpLoad %6 %26 + %28 = OpCompositeConstruct %7 %27 %27 + %29 = OpExtInst %7 %1 FMin %16 %28 + %30 = OpExtInst %7 %1 FMin %14 %29 + OpStore %9 %30 + %31 = OpLoad %7 %9 + %32 = OpAccessChain %25 %22 %24 %24 + %33 = OpLoad %6 %32 + %34 = OpCompositeConstruct %7 %33 %33 + %37 = OpFOrdEqual %36 %31 %34 + %38 = OpAll %35 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %63 + %39 = OpLabel + %49 = OpAccessChain %48 %47 %24 %24 + %50 = OpLoad %23 %49 + %51 = OpConvertSToF %6 %50 + %53 = OpAccessChain %48 %47 %24 %52 + %54 = OpLoad %23 %53 + %55 = OpConvertSToF %6 %54 + %56 = OpAccessChain %48 %47 %24 %52 + %57 = OpLoad %23 %56 + %58 = OpConvertSToF %6 %57 + %59 = OpAccessChain %48 %47 %24 %24 + %60 = OpLoad %23 %59 + %61 = OpConvertSToF %6 %60 + %62 = OpCompositeConstruct %10 %51 %55 %58 %61 + OpStore %42 %62 + OpBranch %40 + %63 = OpLabel + %64 = OpAccessChain %48 %47 %24 %52 + %65 = OpLoad %23 %64 + %66 = OpConvertSToF %6 %65 + %67 = OpCompositeConstruct %10 %66 %66 %66 %66 + OpStore %42 %67 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.5 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-vector-dce-inc-unused-comp.amber b/vulkan/amber/graphicsfuzz/cov-vector-dce-inc-unused-comp.amber new file mode 100644 index 0000000..00cf4e5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-vector-dce-inc-unused-comp.amber @@ -0,0 +1,166 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific vector DCE path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int zero; +# }; +# +# void main() +# { +# vec2 a = vec2(1); +# +# if (zero == 1) // Always false. +# a.x += 1.0; +# +# vec2 b = a.y + vec2(2, 3); +# +# if (b == vec2(3, 4)) // Always true. +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %51 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "a" + OpName %13 "buf0" + OpMemberName %13 0 "zero" + OpName %15 "" + OpName %32 "b" + OpName %51 "_GLF_color" + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %51 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstantComposite %7 %10 %10 + %12 = OpTypeInt 32 1 + %13 = OpTypeStruct %12 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %12 0 + %17 = OpTypePointer Uniform %12 + %20 = OpConstant %12 1 + %21 = OpTypeBool + %25 = OpTypeInt 32 0 + %26 = OpConstant %25 0 + %27 = OpTypePointer Function %6 + %33 = OpConstant %25 1 + %36 = OpConstant %6 2 + %37 = OpConstant %6 3 + %38 = OpConstantComposite %7 %36 %37 + %42 = OpConstant %6 4 + %43 = OpConstantComposite %7 %37 %42 + %44 = OpTypeVector %21 2 + %49 = OpTypeVector %6 4 + %50 = OpTypePointer Output %49 + %51 = OpVariable %50 Output + %52 = OpConstant %6 0 + %53 = OpConstantComposite %49 %10 %52 %52 %10 + %55 = OpConstantComposite %49 %52 %52 %52 %52 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %32 = OpVariable %8 Function + OpStore %9 %11 + %18 = OpAccessChain %17 %15 %16 + %19 = OpLoad %12 %18 + %22 = OpIEqual %21 %19 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %28 = OpAccessChain %27 %9 %26 + %29 = OpLoad %6 %28 + %30 = OpFAdd %6 %29 %10 + %31 = OpAccessChain %27 %9 %26 + OpStore %31 %30 + OpBranch %24 + %24 = OpLabel + %34 = OpAccessChain %27 %9 %33 + %35 = OpLoad %6 %34 + %39 = OpCompositeConstruct %7 %35 %35 + %40 = OpFAdd %7 %39 %38 + OpStore %32 %40 + %41 = OpLoad %7 %32 + %45 = OpFOrdEqual %44 %41 %43 + %46 = OpAll %21 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %54 + %47 = OpLabel + OpStore %51 %53 + OpBranch %48 + %54 = OpLabel + OpStore %51 %55 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-vector-dce-unused-component.amber b/vulkan/amber/graphicsfuzz/cov-vector-dce-unused-component.amber new file mode 100644 index 0000000..de9d8b6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-vector-dce-unused-component.amber @@ -0,0 +1,121 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific vector DCE path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 a = vec2(1); +# a.x += 0.5; +# vec2 b = fract(a); +# +# if (b.x == 0.5) // Always true. +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %31 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "a" + OpName %20 "b" + OpName %31 "_GLF_color" + OpDecorate %31 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstantComposite %7 %10 %10 + %12 = OpConstant %6 0.5 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Function %6 + %25 = OpTypeBool + %29 = OpTypeVector %6 4 + %30 = OpTypePointer Output %29 + %31 = OpVariable %30 Output + %32 = OpConstant %6 0 + %33 = OpConstantComposite %29 %10 %32 %32 %10 + %35 = OpConstantComposite %29 %32 %32 %32 %32 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %20 = OpVariable %8 Function + OpStore %9 %11 + %16 = OpAccessChain %15 %9 %14 + %17 = OpLoad %6 %16 + %18 = OpFAdd %6 %17 %12 + %19 = OpAccessChain %15 %9 %14 + OpStore %19 %18 + %21 = OpLoad %7 %9 + %22 = OpExtInst %7 %1 Fract %21 + OpStore %20 %22 + %23 = OpAccessChain %15 %20 %14 + %24 = OpLoad %6 %23 + %26 = OpFOrdEqual %25 %24 %12 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %34 + %27 = OpLabel + OpStore %31 %33 + OpBranch %28 + %34 = OpLabel + OpStore %31 %35 + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-vector-illegal-index-never-executed.amber b/vulkan/amber/graphicsfuzz/cov-vector-illegal-index-never-executed.amber new file mode 100644 index 0000000..f8476dd --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-vector-illegal-index-never-executed.amber @@ -0,0 +1,240 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--simplify-instructions' +# '--reduce-load-size' +# '--inline-entry-points-exhaustive' +# '--eliminate-local-single-block' +# '--redundancy-elimination' +# '--eliminate-dead-branches' +# '--eliminate-dead-inserts' +# '--redundancy-elimination' +# '--eliminate-local-single-block' +# '--eliminate-local-multi-store' +# '--simplify-instructions' +# '--eliminate-local-multi-store' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--merge-return' +# '--combine-access-chains' +# '--eliminate-local-multi-store' +# '--eliminate-local-single-block' +# '--eliminate-local-single-store' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-local-multi-store' +# '--eliminate-dead-branches' +# '--merge-return' +# '--ccp' +# '--eliminate-local-single-store' +# '--redundancy-elimination' +# '--eliminate-local-multi-store' +# '--eliminate-dead-code-aggressive' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _float_1_0 _GLF_uniform_float_values[0] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: 1.0 +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of zero: 0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# int zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec3 v = vec3(_int_1); +# // Static out of bound access required to hit the coverage point. +# int a = 3; +# +# // Always false. +# if(zero > _int_0) +# { +# // Out of bounds access but never executed. +# v[a] = _float_1_0; +# } +# +# _GLF_color = vec4(v[_int_1], _int_0, _int_0, _int_1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 66 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %51 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "v" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %27 "buf2" + OpMemberName %27 0 "zero" + OpName %29 "" + OpName %41 "buf0" + OpMemberName %41 0 "_GLF_uniform_float_values" + OpName %43 "" + OpName %51 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 Block + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 2 + OpDecorate %40 ArrayStride 16 + OpMemberDecorate %41 0 Offset 0 + OpDecorate %41 Block + OpDecorate %43 DescriptorSet 0 + OpDecorate %43 Binding 0 + OpDecorate %51 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 1 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %10 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %10 0 + %18 = OpConstant %10 1 + %19 = OpTypePointer Uniform %10 + %26 = OpConstant %10 3 + %27 = OpTypeStruct %10 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %34 = OpTypeBool + %39 = OpConstant %11 1 + %40 = OpTypeArray %6 %39 + %41 = OpTypeStruct %40 + %42 = OpTypePointer Uniform %41 + %43 = OpVariable %42 Uniform + %44 = OpTypePointer Uniform %6 + %47 = OpTypePointer Function %6 + %49 = OpTypeVector %6 4 + %50 = OpTypePointer Output %49 + %51 = OpVariable %50 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %10 %20 + %22 = OpConvertSToF %6 %21 + %23 = OpCompositeConstruct %7 %22 %22 %22 + OpStore %9 %23 + %30 = OpAccessChain %19 %29 %17 + %31 = OpLoad %10 %30 + %32 = OpAccessChain %19 %16 %17 %17 + %33 = OpLoad %10 %32 + %35 = OpSGreaterThan %34 %31 %33 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %37 + %36 = OpLabel + %45 = OpAccessChain %44 %43 %17 %17 + %46 = OpLoad %6 %45 + %48 = OpAccessChain %47 %9 %26 + OpStore %48 %46 + OpBranch %37 + %37 = OpLabel + %54 = OpAccessChain %47 %9 %21 + %55 = OpLoad %6 %54 + %58 = OpConvertSToF %6 %33 + %65 = OpCompositeConstruct %49 %55 %58 %58 %22 + OpStore %51 %65 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32[] STD140 DATA + 0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-vector-log2-cosh.amber b/vulkan/amber/graphicsfuzz/cov-vector-log2-cosh.amber new file mode 100644 index 0000000..aef14ae --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-vector-log2-cosh.amber @@ -0,0 +1,114 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific vector log2 and cosh code path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 v = log2(cosh(vec2(1, 100))); +# +# if (v.x < v.y) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %29 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v" + OpName %29 "_GLF_color" + OpDecorate %29 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstant %6 100 + %12 = OpConstantComposite %7 %10 %11 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 0 + %17 = OpTypePointer Function %6 + %20 = OpConstant %15 1 + %23 = OpTypeBool + %27 = OpTypeVector %6 4 + %28 = OpTypePointer Output %27 + %29 = OpVariable %28 Output + %30 = OpConstant %6 0 + %31 = OpConstantComposite %27 %10 %30 %30 %10 + %33 = OpConstantComposite %27 %30 %30 %30 %30 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %13 = OpExtInst %7 %1 Cosh %12 + %14 = OpExtInst %7 %1 Log2 %13 + OpStore %9 %14 + %18 = OpAccessChain %17 %9 %16 + %19 = OpLoad %6 %18 + %21 = OpAccessChain %17 %9 %20 + %22 = OpLoad %6 %21 + %24 = OpFOrdLessThan %23 %19 %22 + OpSelectionMerge %26 None + OpBranchConditional %24 %25 %32 + %25 = OpLabel + OpStore %29 %31 + OpBranch %26 + %32 = OpLabel + OpStore %29 %33 + OpBranch %26 + %26 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-wrap-op-kill-for-loop.amber b/vulkan/amber/graphicsfuzz/cov-wrap-op-kill-for-loop.amber new file mode 100644 index 0000000..4e899e5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-wrap-op-kill-for-loop.amber @@ -0,0 +1,195 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific OpKill wrapping code path + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--vector-dce' +# '--combine-access-chains' +# '--eliminate-local-multi-store' +# '--scalar-replacement=100' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-return' +# '--combine-access-chains' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-blocks' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int zero; +# }; +# +# void func(int x) +# { +# // Always false. +# if (x < zero) +# discard; +# +# if (x > 8) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +# +# void main() +# { +# _GLF_color = vec4(0); +# +# for (int i = 0; i < 10 + zero; i++) +# func(i); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "func(i1;" + OpName %9 "x" + OpName %13 "buf0" + OpMemberName %13 0 "zero" + OpName %15 "" + OpName %33 "_GLF_color" + OpName %39 "i" + OpName %51 "param" + OpMemberDecorate %13 0 Offset 0 + OpDecorate %13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 + %13 = OpTypeStruct %6 + %14 = OpTypePointer Uniform %13 + %15 = OpVariable %14 Uniform + %16 = OpConstant %6 0 + %17 = OpTypePointer Uniform %6 + %20 = OpTypeBool + %26 = OpConstant %6 8 + %30 = OpTypeFloat 32 + %31 = OpTypeVector %30 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpConstant %30 1 + %35 = OpConstant %30 0 + %36 = OpConstantComposite %31 %34 %35 %35 %34 + %38 = OpConstantComposite %31 %35 %35 %35 %35 + %46 = OpConstant %6 10 + %55 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %39 = OpVariable %7 Function + %51 = OpVariable %7 Function + OpStore %33 %38 + OpStore %39 %16 + OpBranch %40 + %40 = OpLabel + %57 = OpPhi %6 %16 %5 %56 %41 + %47 = OpAccessChain %17 %15 %16 + %48 = OpLoad %6 %47 + %49 = OpIAdd %6 %46 %48 + %50 = OpSLessThan %20 %57 %49 + OpLoopMerge %42 %41 None + OpBranchConditional %50 %41 %42 + %41 = OpLabel + OpStore %51 %57 + %53 = OpFunctionCall %2 %10 %51 + %56 = OpIAdd %6 %57 %55 + OpStore %39 %56 + OpBranch %40 + %42 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %12 = OpLoad %6 %9 + %18 = OpAccessChain %17 %15 %16 + %19 = OpLoad %6 %18 + %21 = OpSLessThan %20 %12 %19 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %23 + %22 = OpLabel + OpTerminateInvocation + %23 = OpLabel + %25 = OpLoad %6 %9 + %27 = OpSGreaterThan %20 %25 %26 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %37 + %28 = OpLabel + OpStore %33 %36 + OpBranch %29 + %37 = OpLabel + OpStore %33 %38 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-wrap-op-kill-two-branches.amber b/vulkan/amber/graphicsfuzz/cov-wrap-op-kill-two-branches.amber new file mode 100644 index 0000000..b75fe35 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-wrap-op-kill-two-branches.amber @@ -0,0 +1,242 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific OpKill wrapping path. + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-local-single-store' +# '--eliminate-dead-branches' +# '--merge-return' +# '--inline-entry-points-exhaustive' +# '--copy-propagate-arrays' +# '--if-conversion' +# '--reduce-load-size' +# '--convert-local-access-chains' +# '--if-conversion' +# '--redundancy-elimination' +# '--if-conversion' +# '--simplify-instructions' +# '--scalar-replacement=100' +# '--simplify-instructions' +# '--if-conversion' +# '--eliminate-dead-inserts' +# '--eliminate-dead-branches' +# '--eliminate-dead-code-aggressive' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int five; +# }; +# +# float func(float x) +# { +# if (x > 5.0) +# { +# if (gl_FragCoord.x < 0.5) +# discard; +# else if (gl_FragCoord.y < 0.5) +# discard; +# } +# +# return x + 1.0; +# } +# +# void main() +# { +# float f = 0.0; +# +# for(int i = 0; i < five; i++) +# f = func(float(i)); +# +# if (f == 5.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %20 %75 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "func(f1;" + OpName %9 "x" + OpName %20 "gl_FragCoord" + OpName %44 "f" + OpName %48 "i" + OpName %56 "buf0" + OpMemberName %56 0 "five" + OpName %58 "" + OpName %65 "param" + OpName %75 "_GLF_color" + OpDecorate %20 BuiltIn FragCoord + OpMemberDecorate %56 0 Offset 0 + OpDecorate %56 Block + OpDecorate %58 DescriptorSet 0 + OpDecorate %58 Binding 0 + OpDecorate %75 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %13 = OpConstant %6 5 + %14 = OpTypeBool + %18 = OpTypeVector %6 4 + %19 = OpTypePointer Input %18 + %20 = OpVariable %19 Input + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Input %6 + %26 = OpConstant %6 0.5 + %32 = OpConstant %21 1 + %40 = OpConstant %6 1 + %45 = OpConstant %6 0 + %46 = OpTypeInt 32 1 + %47 = OpTypePointer Function %46 + %49 = OpConstant %46 0 + %56 = OpTypeStruct %46 + %57 = OpTypePointer Uniform %56 + %58 = OpVariable %57 Uniform + %59 = OpTypePointer Uniform %46 + %68 = OpConstant %46 1 + %74 = OpTypePointer Output %18 + %75 = OpVariable %74 Output + %76 = OpConstantComposite %18 %40 %45 %45 %40 + %78 = OpConstantComposite %18 %45 %45 %45 %45 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %44 = OpVariable %7 Function + %48 = OpVariable %47 Function + %65 = OpVariable %7 Function + OpStore %44 %45 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + %55 = OpLoad %46 %48 + %60 = OpAccessChain %59 %58 %49 + %61 = OpLoad %46 %60 + %62 = OpSLessThan %14 %55 %61 + OpLoopMerge %52 %51 None + OpBranchConditional %62 %51 %52 + %51 = OpLabel + %63 = OpLoad %46 %48 + %64 = OpConvertSToF %6 %63 + OpStore %65 %64 + %66 = OpFunctionCall %6 %10 %65 + OpStore %44 %66 + %67 = OpLoad %46 %48 + %69 = OpIAdd %46 %67 %68 + OpStore %48 %69 + OpBranch %50 + %52 = OpLabel + %70 = OpLoad %6 %44 + %71 = OpFOrdEqual %14 %70 %13 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %77 + %72 = OpLabel + OpStore %75 %76 + OpBranch %73 + %77 = OpLabel + OpStore %75 %78 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %12 = OpLoad %6 %9 + %15 = OpFOrdGreaterThan %14 %12 %13 + OpSelectionMerge %17 None + OpBranchConditional %15 %16 %17 + %16 = OpLabel + %24 = OpAccessChain %23 %20 %22 + %25 = OpLoad %6 %24 + %27 = OpFOrdLessThan %14 %25 %26 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %31 + %28 = OpLabel + OpTerminateInvocation + %31 = OpLabel + %33 = OpAccessChain %23 %20 %32 + %34 = OpLoad %6 %33 + %35 = OpFOrdLessThan %14 %34 %26 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %37 + %36 = OpLabel + OpTerminateInvocation + %37 = OpLabel + OpBranch %29 + %29 = OpLabel + OpBranch %17 + %17 = OpLabel + %39 = OpLoad %6 %9 + %41 = OpFAdd %6 %39 %40 + OpReturnValue %41 + OpFunctionEnd +END + +# uniforms for variant + +# five +BUFFER variant_five DATA_TYPE int32 DATA + 5 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_five AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-write-past-matrix-elements-unused.amber b/vulkan/amber/graphicsfuzz/cov-write-past-matrix-elements-unused.amber new file mode 100644 index 0000000..4c943c8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-write-past-matrix-elements-unused.amber @@ -0,0 +1,249 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers specific NIR code paths + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--reduce-load-size' +# '--if-conversion' +# '--if-conversion' +# '--combine-access-chains' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--if-conversion' +# '--eliminate-local-single-store' +# '--redundancy-elimination' +# '--private-to-local' +# '--combine-access-chains' +# '--ccp' +# '--eliminate-local-multi-store' +# '--if-conversion' +# '--convert-local-access-chains' +# '--combine-access-chains' +# '--reduce-load-size' +# '--ccp' +# '--eliminate-dead-inserts' +# '--simplify-instructions' +# '--eliminate-dead-code-aggressive' +# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# +# precision highp int; +# precision highp float; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[3]; +# }; +# // Contents of _GLF_uniform_float_values: [1.0, 0.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# mat3x2 m32 = mat3x2(_float_1_0); +# int a = 3; +# +# // Always false. +# if (_int_0 == 1) +# { +# // Indexing past the matrix elements, but this +# // code is never executed and the values are not +# // used for the final results. +# m32[a][_int_0] = _float_1_0; +# } +# +# float sums[3] = float[3](_float_1_0, _float_1_0, _float_1_0); +# +# for(int c = _int_0; c < _int_2; c ++) +# { +# // This value is still unused later. +# sums[_int_2] += m32[c][_int_0]; +# } +# +# // This only depends on the initialized constant values. +# _GLF_color = vec4(sums[_int_0], _float_0_0, _float_0_0, sums[_int_1]); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 105 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %89 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "m32" + OpName %14 "buf1" + OpMemberName %14 0 "_GLF_uniform_float_values" + OpName %16 "" + OpName %33 "buf0" + OpMemberName %33 0 "_GLF_uniform_int_values" + OpName %35 "" + OpName %53 "sums" + OpName %89 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %32 ArrayStride 16 + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 0 + OpDecorate %89 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeMatrix %7 3 + %9 = OpTypePointer Function %8 + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 2 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %23 = OpConstant %6 0 + %30 = OpConstant %17 3 + %31 = OpConstant %11 3 + %32 = OpTypeArray %17 %31 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpTypePointer Uniform %17 + %39 = OpConstant %17 1 + %40 = OpTypeBool + %49 = OpTypePointer Function %6 + %51 = OpTypeArray %6 %31 + %52 = OpTypePointer Function %51 + %70 = OpConstant %17 2 + %87 = OpTypeVector %6 4 + %88 = OpTypePointer Output %87 + %89 = OpVariable %88 Output + %103 = OpConstantComposite %7 %23 %23 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %53 = OpVariable %52 Function + %20 = OpAccessChain %19 %16 %18 %18 + %21 = OpLoad %6 %20 + %24 = OpCompositeConstruct %7 %21 %23 + %25 = OpCompositeConstruct %7 %23 %21 + %27 = OpCompositeConstruct %8 %24 %25 %103 + OpStore %10 %27 + %37 = OpAccessChain %36 %35 %18 %18 + %38 = OpLoad %17 %37 + %41 = OpIEqual %40 %38 %39 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %43 + %42 = OpLabel + %50 = OpAccessChain %49 %10 %30 %38 + OpStore %50 %21 + OpBranch %43 + %43 = OpLabel + %60 = OpCompositeConstruct %51 %21 %21 %21 + OpStore %53 %60 + OpBranch %64 + %64 = OpLabel + %104 = OpPhi %17 %38 %43 %86 %65 + %71 = OpAccessChain %36 %35 %18 %70 + %72 = OpLoad %17 %71 + %73 = OpSLessThan %40 %104 %72 + OpLoopMerge %66 %65 None + OpBranchConditional %73 %65 %66 + %65 = OpLabel + %79 = OpAccessChain %49 %10 %104 %38 + %80 = OpLoad %6 %79 + %81 = OpAccessChain %49 %53 %72 + %82 = OpLoad %6 %81 + %83 = OpFAdd %6 %82 %80 + OpStore %81 %83 + %86 = OpIAdd %17 %104 %39 + OpBranch %64 + %66 = OpLabel + %92 = OpAccessChain %49 %53 %38 + %93 = OpLoad %6 %92 + %94 = OpAccessChain %19 %16 %18 %39 + %95 = OpLoad %6 %94 + %98 = OpAccessChain %36 %35 %18 %39 + %99 = OpLoad %17 %98 + %100 = OpAccessChain %49 %53 %99 + %101 = OpLoad %6 %100 + %102 = OpCompositeConstruct %87 %93 %95 %95 %101 + OpStore %89 %102 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-x86-instr-info-determinant-min.amber b/vulkan/amber/graphicsfuzz/cov-x86-instr-info-determinant-min.amber new file mode 100644 index 0000000..b28cf82 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-x86-instr-info-determinant-min.amber @@ -0,0 +1,280 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific x86 instr info code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_2 _GLF_uniform_int_values[2] +# #define _int_3 _GLF_uniform_int_values[3] +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_0_3 _GLF_uniform_float_values[1] +# #define _float_1_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_float_values: [0.0, 0.3, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 2, 3] +# layout(set = 0, binding = 1) uniform buf1 +# { +# int _GLF_uniform_int_values[4]; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# vec4 f1() +# { +# vec4 data; +# for (int i = _int_0; i < 2; i++) +# { +# data = vec4(_float_0_3); +# } +# +# // a becomes 0.0. +# float a = determinant(mat2(1.0, 0.0, 0.0, 0.0)); +# if (1.0 > min(a, 0.0)) +# { +# data = vec4(_float_1_0, a, a, _float_1_0); +# } +# +# return data; +# } +# +# void main() +# { +# vec4 color = vec4(_float_0_0); +# for (int i = _int_0; i < 2; i++) +# { +# color = f1(); +# } +# +# _GLF_color = +# vec4(color[_int_0], color[_int_1], color[_int_2], color[_int_3]); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 109 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %90 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "f1(" + OpName %13 "i" + OpName %17 "buf1" + OpMemberName %17 0 "_GLF_uniform_int_values" + OpName %19 "" + OpName %34 "data" + OpName %37 "buf0" + OpMemberName %37 0 "_GLF_uniform_float_values" + OpName %39 "" + OpName %48 "a" + OpName %72 "color" + OpName %76 "i" + OpName %90 "_GLF_color" + OpDecorate %16 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %36 ArrayStride 16 + OpMemberDecorate %37 0 Offset 0 + OpDecorate %37 Block + OpDecorate %39 DescriptorSet 0 + OpDecorate %39 Binding 0 + OpDecorate %90 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeFunction %7 + %11 = OpTypeInt 32 1 + %12 = OpTypePointer Function %11 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 4 + %16 = OpTypeArray %11 %15 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpConstant %11 0 + %21 = OpTypePointer Uniform %11 + %30 = OpConstant %11 2 + %31 = OpTypeBool + %33 = OpTypePointer Function %7 + %35 = OpConstant %14 3 + %36 = OpTypeArray %6 %35 + %37 = OpTypeStruct %36 + %38 = OpTypePointer Uniform %37 + %39 = OpVariable %38 Uniform + %40 = OpConstant %11 1 + %41 = OpTypePointer Uniform %6 + %47 = OpTypePointer Function %6 + %49 = OpTypeVector %6 2 + %50 = OpTypeMatrix %49 2 + %51 = OpConstant %6 1 + %52 = OpConstant %6 0 + %53 = OpConstantComposite %49 %51 %52 + %54 = OpConstantComposite %49 %52 %52 + %55 = OpConstantComposite %50 %53 %54 + %89 = OpTypePointer Output %7 + %90 = OpVariable %89 Output + %103 = OpConstant %11 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %72 = OpVariable %33 Function + %76 = OpVariable %12 Function + %73 = OpAccessChain %41 %39 %20 %20 + %74 = OpLoad %6 %73 + %75 = OpCompositeConstruct %7 %74 %74 %74 %74 + OpStore %72 %75 + %77 = OpAccessChain %21 %19 %20 %20 + %78 = OpLoad %11 %77 + OpStore %76 %78 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %11 %76 + %85 = OpSLessThan %31 %84 %30 + OpBranchConditional %85 %80 %81 + %80 = OpLabel + %86 = OpFunctionCall %7 %9 + OpStore %72 %86 + OpBranch %82 + %82 = OpLabel + %87 = OpLoad %11 %76 + %88 = OpIAdd %11 %87 %40 + OpStore %76 %88 + OpBranch %79 + %81 = OpLabel + %91 = OpAccessChain %21 %19 %20 %20 + %92 = OpLoad %11 %91 + %93 = OpAccessChain %47 %72 %92 + %94 = OpLoad %6 %93 + %95 = OpAccessChain %21 %19 %20 %40 + %96 = OpLoad %11 %95 + %97 = OpAccessChain %47 %72 %96 + %98 = OpLoad %6 %97 + %99 = OpAccessChain %21 %19 %20 %30 + %100 = OpLoad %11 %99 + %101 = OpAccessChain %47 %72 %100 + %102 = OpLoad %6 %101 + %104 = OpAccessChain %21 %19 %20 %103 + %105 = OpLoad %11 %104 + %106 = OpAccessChain %47 %72 %105 + %107 = OpLoad %6 %106 + %108 = OpCompositeConstruct %7 %94 %98 %102 %107 + OpStore %90 %108 + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %13 = OpVariable %12 Function + %34 = OpVariable %33 Function + %48 = OpVariable %47 Function + %22 = OpAccessChain %21 %19 %20 %20 + %23 = OpLoad %11 %22 + OpStore %13 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %11 %13 + %32 = OpSLessThan %31 %29 %30 + OpBranchConditional %32 %25 %26 + %25 = OpLabel + %42 = OpAccessChain %41 %39 %20 %40 + %43 = OpLoad %6 %42 + %44 = OpCompositeConstruct %7 %43 %43 %43 %43 + OpStore %34 %44 + OpBranch %27 + %27 = OpLabel + %45 = OpLoad %11 %13 + %46 = OpIAdd %11 %45 %40 + OpStore %13 %46 + OpBranch %24 + %26 = OpLabel + %56 = OpExtInst %6 %1 Determinant %55 + OpStore %48 %56 + %57 = OpLoad %6 %48 + %58 = OpExtInst %6 %1 FMin %57 %52 + %59 = OpFOrdGreaterThan %31 %51 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %60 %61 + %60 = OpLabel + %62 = OpAccessChain %41 %39 %20 %30 + %63 = OpLoad %6 %62 + %64 = OpLoad %6 %48 + %65 = OpLoad %6 %48 + %66 = OpAccessChain %41 %39 %20 %30 + %67 = OpLoad %6 %66 + %68 = OpCompositeConstruct %7 %63 %64 %65 %67 + OpStore %34 %68 + OpBranch %61 + %61 = OpLabel + %69 = OpLoad %7 %34 + OpReturnValue %69 + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 2 3 +END +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 0.3 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos.amber b/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos.amber new file mode 100644 index 0000000..9e14b29 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos.amber @@ -0,0 +1,215 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific X86 ISel lowering and AP Float code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _float_0_54 _GLF_uniform_float_values[0] +# #define _float_0_55 _GLF_uniform_float_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: [0.54, 0.55] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // uintbitstofloat(1) gives a very small denormalized value. The cos of this value +# // should be very close to 1; perhaps marginally smaller. The cosine of *that* value +# // should then be bounded below by 0.54, and might be slightly larger, +# // so that 0.55 is a suitable upper bound. +# vec2 v1 = cos(cos(intBitsToFloat(ivec2(-1, _int_1)))); +# _GLF_color = vec4(v1.x); +# +# if (v1.y > _float_0_54 && v1.y < _float_0_55) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 76 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %29 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v1" + OpName %15 "buf0" + OpMemberName %15 0 "_GLF_uniform_int_values" + OpName %17 "" + OpName %29 "_GLF_color" + OpName %40 "buf1" + OpMemberName %40 0 "_GLF_uniform_float_values" + OpName %42 "" + OpDecorate %14 ArrayStride 16 + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %29 Location 0 + OpDecorate %39 ArrayStride 16 + OpMemberDecorate %40 0 Offset 0 + OpDecorate %40 Block + OpDecorate %42 DescriptorSet 0 + OpDecorate %42 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeInt 32 1 + %11 = OpConstant %10 -1 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 2 + %14 = OpTypeArray %10 %13 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %10 0 + %19 = OpTypePointer Uniform %10 + %22 = OpTypeVector %10 2 + %27 = OpTypeVector %6 4 + %28 = OpTypePointer Output %27 + %29 = OpVariable %28 Output + %30 = OpConstant %12 0 + %31 = OpTypePointer Function %6 + %35 = OpTypeBool + %36 = OpConstant %12 1 + %39 = OpTypeArray %6 %13 + %40 = OpTypeStruct %39 + %41 = OpTypePointer Uniform %40 + %42 = OpVariable %41 Uniform + %43 = OpTypePointer Uniform %6 + %51 = OpConstant %10 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %20 = OpAccessChain %19 %17 %18 %18 + %21 = OpLoad %10 %20 + %23 = OpCompositeConstruct %22 %11 %21 + %24 = OpBitcast %7 %23 + %25 = OpExtInst %7 %1 Cos %24 + %26 = OpExtInst %7 %1 Cos %25 + OpStore %9 %26 + %32 = OpAccessChain %31 %9 %30 + %33 = OpLoad %6 %32 + %34 = OpCompositeConstruct %27 %33 %33 %33 %33 + OpStore %29 %34 + %37 = OpAccessChain %31 %9 %36 + %38 = OpLoad %6 %37 + %44 = OpAccessChain %43 %42 %18 %18 + %45 = OpLoad %6 %44 + %46 = OpFOrdGreaterThan %35 %38 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + %49 = OpAccessChain %31 %9 %36 + %50 = OpLoad %6 %49 + %52 = OpAccessChain %43 %42 %18 %51 + %53 = OpLoad %6 %52 + %54 = OpFOrdLessThan %35 %50 %53 + OpBranch %48 + %48 = OpLabel + %55 = OpPhi %35 %46 %5 %54 %47 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %71 + %56 = OpLabel + %58 = OpAccessChain %19 %17 %18 %18 + %59 = OpLoad %10 %58 + %60 = OpConvertSToF %6 %59 + %61 = OpAccessChain %19 %17 %18 %51 + %62 = OpLoad %10 %61 + %63 = OpConvertSToF %6 %62 + %64 = OpAccessChain %19 %17 %18 %51 + %65 = OpLoad %10 %64 + %66 = OpConvertSToF %6 %65 + %67 = OpAccessChain %19 %17 %18 %18 + %68 = OpLoad %10 %67 + %69 = OpConvertSToF %6 %68 + %70 = OpCompositeConstruct %27 %60 %63 %66 %69 + OpStore %29 %70 + OpBranch %57 + %71 = OpLabel + %72 = OpAccessChain %19 %17 %18 %51 + %73 = OpLoad %10 %72 + %74 = OpConvertSToF %6 %73 + %75 = OpCompositeConstruct %27 %74 %74 %74 %74 + OpStore %29 %75 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.54 0.55 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-determinant-exp-acos.amber b/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-determinant-exp-acos.amber new file mode 100644 index 0000000..6e2615b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-determinant-exp-acos.amber @@ -0,0 +1,206 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific x86 isel lowering code path + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--merge-blocks' +# spirv-opt commit hash: a187dd58a0485988841d325a85c8e6063f53500a + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _float_0_0 _GLF_uniform_float_values[0] +# #define _float_790_0 _GLF_uniform_float_values[1] +# #define _float_2_0 _GLF_uniform_float_values[2] +# #define _float_4_0 _GLF_uniform_float_values[3] +# #define _float_1_0 _GLF_uniform_float_values[4] +# +# precision highp float; +# +# // Contents of _GLF_uniform_float_values: [0.0, 790.0, 2.0, 4.0, 1.0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# float _GLF_uniform_float_values[5]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // a becomes 0. +# float a = determinant(mat2(_float_2_0, _float_4_0, _float_1_0, _float_2_0)); +# +# //b becomes 0. +# float b = float(mat2(a)); +# +# // This results in an undefined value, but not in undefined behavior. +# // v1.x becomes undefined and v1.y becomes 0. +# vec2 v1 = acos(exp(vec2(_float_790_0, b))); +# +# _GLF_color = vec4(v1.x); +# +# if (v1.y == _float_0_0) +# { +# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %54 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %12 "buf0" + OpMemberName %12 0 "_GLF_uniform_float_values" + OpName %14 "" + OpName %37 "b" + OpName %44 "v1" + OpName %54 "_GLF_color" + OpDecorate %11 ArrayStride 16 + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %54 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 5 + %11 = OpTypeArray %6 %10 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpConstant %15 2 + %18 = OpTypePointer Uniform %6 + %21 = OpConstant %15 3 + %24 = OpConstant %15 4 + %29 = OpTypeVector %6 2 + %30 = OpTypeMatrix %29 2 + %31 = OpConstant %6 1 + %32 = OpConstant %6 0 + %43 = OpTypePointer Function %29 + %45 = OpConstant %15 1 + %52 = OpTypeVector %6 4 + %53 = OpTypePointer Output %52 + %54 = OpVariable %53 Output + %55 = OpConstant %9 0 + %59 = OpConstant %9 1 + %64 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %37 = OpVariable %7 Function + %44 = OpVariable %43 Function + %19 = OpAccessChain %18 %14 %16 %17 + %20 = OpLoad %6 %19 + %22 = OpAccessChain %18 %14 %16 %21 + %23 = OpLoad %6 %22 + %25 = OpAccessChain %18 %14 %16 %24 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %18 %14 %16 %17 + %28 = OpLoad %6 %27 + %33 = OpCompositeConstruct %29 %20 %23 + %34 = OpCompositeConstruct %29 %26 %28 + %35 = OpCompositeConstruct %30 %33 %34 + %36 = OpExtInst %6 %1 Determinant %35 + OpStore %8 %36 + %38 = OpLoad %6 %8 + %39 = OpCompositeConstruct %29 %38 %32 + %40 = OpCompositeConstruct %29 %32 %38 + %41 = OpCompositeConstruct %30 %39 %40 + %42 = OpCompositeExtract %6 %41 0 0 + OpStore %37 %42 + %46 = OpAccessChain %18 %14 %16 %45 + %47 = OpLoad %6 %46 + %48 = OpLoad %6 %37 + %49 = OpCompositeConstruct %29 %47 %48 + %50 = OpExtInst %29 %1 Exp %49 + %51 = OpExtInst %29 %1 Acos %50 + OpStore %44 %51 + %56 = OpAccessChain %7 %44 %55 + %57 = OpLoad %6 %56 + %58 = OpCompositeConstruct %52 %57 %57 %57 %57 + OpStore %54 %58 + %60 = OpAccessChain %7 %44 %59 + %61 = OpLoad %6 %60 + %62 = OpAccessChain %18 %14 %16 %16 + %63 = OpLoad %6 %62 + %65 = OpFOrdEqual %64 %61 %63 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %67 + %66 = OpLabel + %68 = OpAccessChain %18 %14 %16 %24 + %69 = OpLoad %6 %68 + %70 = OpAccessChain %18 %14 %16 %16 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %18 %14 %16 %16 + %73 = OpLoad %6 %72 + %74 = OpAccessChain %18 %14 %16 %24 + %75 = OpLoad %6 %74 + %76 = OpCompositeConstruct %52 %69 %71 %73 %75 + OpStore %54 %76 + OpBranch %67 + %67 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 790.0 2.0 4.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float.amber b/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float.amber new file mode 100644 index 0000000..751206e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float.amber @@ -0,0 +1,225 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers specific X86 ISel lowering and machine value type code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# #define _uint_1 _GLF_uniform_uint_values[0] +# #define _uint_0 _GLF_uniform_uint_values[1] +# #define _float_0_0 _GLF_uniform_float_values[0] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# // Contents of _GLF_uniform_uint_values: 1 +# layout(set = 0, binding = 1) uniform buf1 +# { +# uint _GLF_uniform_uint_values[2]; +# }; +# +# // Contents of _GLF_uniform_float_values: 0.0 +# layout(set = 0, binding = 2) uniform buf2 +# { +# float _GLF_uniform_float_values[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# uint a = _uint_1 >> uint(_float_0_0); +# float b = uintBitsToFloat(a); +# uint c = floatBitsToUint(b); +# +# if (c == _uint_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(b); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 69 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %11 "buf1" + OpMemberName %11 0 "_GLF_uniform_uint_values" + OpName %13 "" + OpName %22 "buf2" + OpMemberName %22 0 "_GLF_uniform_float_values" + OpName %24 "" + OpName %31 "b" + OpName %34 "c" + OpName %46 "_GLF_color" + OpName %48 "buf0" + OpMemberName %48 0 "_GLF_uniform_int_values" + OpName %50 "" + OpDecorate %10 ArrayStride 16 + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 1 + OpDecorate %21 ArrayStride 16 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 2 + OpDecorate %46 Location 0 + OpDecorate %47 ArrayStride 16 + OpMemberDecorate %48 0 Offset 0 + OpDecorate %48 Block + OpDecorate %50 DescriptorSet 0 + OpDecorate %50 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 2 + %10 = OpTypeArray %6 %9 + %11 = OpTypeStruct %10 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypePointer Uniform %6 + %19 = OpTypeFloat 32 + %20 = OpConstant %6 1 + %21 = OpTypeArray %19 %20 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpTypePointer Uniform %19 + %30 = OpTypePointer Function %19 + %40 = OpTypeBool + %44 = OpTypeVector %19 4 + %45 = OpTypePointer Output %44 + %46 = OpVariable %45 Output + %47 = OpTypeArray %14 %9 + %48 = OpTypeStruct %47 + %49 = OpTypePointer Uniform %48 + %50 = OpVariable %49 Uniform + %51 = OpTypePointer Uniform %14 + %55 = OpConstant %14 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %31 = OpVariable %30 Function + %34 = OpVariable %7 Function + %17 = OpAccessChain %16 %13 %15 %15 + %18 = OpLoad %6 %17 + %26 = OpAccessChain %25 %24 %15 %15 + %27 = OpLoad %19 %26 + %28 = OpConvertFToU %6 %27 + %29 = OpShiftRightLogical %6 %18 %28 + OpStore %8 %29 + %32 = OpLoad %6 %8 + %33 = OpBitcast %19 %32 + OpStore %31 %33 + %35 = OpLoad %19 %31 + %36 = OpBitcast %6 %35 + OpStore %34 %36 + %37 = OpLoad %6 %34 + %38 = OpAccessChain %16 %13 %15 %15 + %39 = OpLoad %6 %38 + %41 = OpIEqual %40 %37 %39 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %66 + %42 = OpLabel + %52 = OpAccessChain %51 %50 %15 %15 + %53 = OpLoad %14 %52 + %54 = OpConvertSToF %19 %53 + %56 = OpAccessChain %51 %50 %15 %55 + %57 = OpLoad %14 %56 + %58 = OpConvertSToF %19 %57 + %59 = OpAccessChain %51 %50 %15 %55 + %60 = OpLoad %14 %59 + %61 = OpConvertSToF %19 %60 + %62 = OpAccessChain %51 %50 %15 %15 + %63 = OpLoad %14 %62 + %64 = OpConvertSToF %19 %63 + %65 = OpCompositeConstruct %44 %54 %58 %61 %64 + OpStore %46 %65 + OpBranch %43 + %66 = OpLabel + %67 = OpLoad %19 %31 + %68 = OpCompositeConstruct %44 %67 %67 %67 %67 + OpStore %46 %68 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 0.0 +END +# _GLF_uniform_uint_values +BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA + 1 0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift.amber b/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift.amber new file mode 100644 index 0000000..10a5501 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift.amber @@ -0,0 +1,311 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: A fragment shader that covers a specific X86 ISel lowering code path + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_0 _GLF_uniform_int_values[0] +# #define _int_1 _GLF_uniform_int_values[1] +# #define _int_4 _GLF_uniform_int_values[2] +# #define _int_2 _GLF_uniform_int_values[3] +# #define _float_1_0 _GLF_uniform_float_values[0] +# #define _float_0_0 _GLF_uniform_float_values[1] +# #define _float_2_0 _GLF_uniform_float_values[2] +# +# precision highp float; +# +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [0, 1, 4, 2] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[4]; +# }; +# +# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 2.0] +# layout(set = 0, binding = 1) uniform buf1 +# { +# float _GLF_uniform_float_values[3]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float A[2]; +# A[0] = _float_0_0; +# A[1] = _float_0_0; +# +# for (int i = _int_0; i < _int_2; i++) +# { +# for (int j = _int_0; j < _int_4; j++) +# { +# switch (j) +# { +# case 0: +# // Undefined behavior but doesn't matter because the value will be +# // overwritten in the next iteration. +# if ((1 << -1) < i) +# { +# continue; +# } +# A[i] = _float_2_0; +# break; +# case 1: +# A[i] = _float_1_0; +# break; +# } +# } +# } +# if (A[_int_0] == _float_1_0 && A[_int_1] == _float_1_0) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 127 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %108 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "A" + OpName %16 "buf1" + OpMemberName %16 0 "_GLF_uniform_float_values" + OpName %18 "" + OpName %29 "i" + OpName %32 "buf0" + OpMemberName %32 0 "_GLF_uniform_int_values" + OpName %34 "" + OpName %49 "j" + OpName %108 "_GLF_color" + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %31 ArrayStride 16 + OpMemberDecorate %32 0 Offset 0 + OpDecorate %32 Block + OpDecorate %34 DescriptorSet 0 + OpDecorate %34 Binding 0 + OpDecorate %108 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 2 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpConstant %7 3 + %15 = OpTypeArray %6 %14 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpConstant %12 1 + %20 = OpTypePointer Uniform %6 + %23 = OpTypePointer Function %6 + %28 = OpTypePointer Function %12 + %30 = OpConstant %7 4 + %31 = OpTypeArray %12 %30 + %32 = OpTypeStruct %31 + %33 = OpTypePointer Uniform %32 + %34 = OpVariable %33 Uniform + %35 = OpTypePointer Uniform %12 + %44 = OpConstant %12 3 + %47 = OpTypeBool + %58 = OpConstant %12 2 + %66 = OpConstant %12 -2147483648 + %106 = OpTypeVector %6 4 + %107 = OpTypePointer Output %106 + %108 = OpVariable %107 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %29 = OpVariable %28 Function + %49 = OpVariable %28 Function + %21 = OpAccessChain %20 %18 %13 %19 + %22 = OpLoad %6 %21 + %24 = OpAccessChain %23 %11 %13 + OpStore %24 %22 + %25 = OpAccessChain %20 %18 %13 %19 + %26 = OpLoad %6 %25 + %27 = OpAccessChain %23 %11 %19 + OpStore %27 %26 + %36 = OpAccessChain %35 %34 %13 %13 + %37 = OpLoad %12 %36 + OpStore %29 %37 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %12 %29 + %45 = OpAccessChain %35 %34 %13 %44 + %46 = OpLoad %12 %45 + %48 = OpSLessThan %47 %43 %46 + OpBranchConditional %48 %39 %40 + %39 = OpLabel + %50 = OpAccessChain %35 %34 %13 %13 + %51 = OpLoad %12 %50 + OpStore %49 %51 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %12 %49 + %59 = OpAccessChain %35 %34 %13 %58 + %60 = OpLoad %12 %59 + %61 = OpSLessThan %47 %57 %60 + OpBranchConditional %61 %53 %54 + %53 = OpLabel + %62 = OpLoad %12 %49 + OpSelectionMerge %65 None + OpSwitch %62 %65 0 %63 1 %64 + %63 = OpLabel + %67 = OpLoad %12 %29 + %68 = OpSLessThan %47 %66 %67 + OpSelectionMerge %70 None + OpBranchConditional %68 %69 %70 + %69 = OpLabel + OpBranch %55 + %70 = OpLabel + %72 = OpLoad %12 %29 + %73 = OpAccessChain %20 %18 %13 %58 + %74 = OpLoad %6 %73 + %75 = OpAccessChain %23 %11 %72 + OpStore %75 %74 + OpBranch %65 + %64 = OpLabel + %77 = OpLoad %12 %29 + %78 = OpAccessChain %20 %18 %13 %13 + %79 = OpLoad %6 %78 + %80 = OpAccessChain %23 %11 %77 + OpStore %80 %79 + OpBranch %65 + %65 = OpLabel + OpBranch %55 + %55 = OpLabel + %83 = OpLoad %12 %49 + %84 = OpIAdd %12 %83 %19 + OpStore %49 %84 + OpBranch %52 + %54 = OpLabel + OpBranch %41 + %41 = OpLabel + %85 = OpLoad %12 %29 + %86 = OpIAdd %12 %85 %19 + OpStore %29 %86 + OpBranch %38 + %40 = OpLabel + %87 = OpAccessChain %35 %34 %13 %13 + %88 = OpLoad %12 %87 + %89 = OpAccessChain %23 %11 %88 + %90 = OpLoad %6 %89 + %91 = OpAccessChain %20 %18 %13 %13 + %92 = OpLoad %6 %91 + %93 = OpFOrdEqual %47 %90 %92 + OpSelectionMerge %95 None + OpBranchConditional %93 %94 %95 + %94 = OpLabel + %96 = OpAccessChain %35 %34 %13 %19 + %97 = OpLoad %12 %96 + %98 = OpAccessChain %23 %11 %97 + %99 = OpLoad %6 %98 + %100 = OpAccessChain %20 %18 %13 %13 + %101 = OpLoad %6 %100 + %102 = OpFOrdEqual %47 %99 %101 + OpBranch %95 + %95 = OpLabel + %103 = OpPhi %47 %93 %40 %102 %94 + OpSelectionMerge %105 None + OpBranchConditional %103 %104 %122 + %104 = OpLabel + %109 = OpAccessChain %35 %34 %13 %19 + %110 = OpLoad %12 %109 + %111 = OpConvertSToF %6 %110 + %112 = OpAccessChain %35 %34 %13 %13 + %113 = OpLoad %12 %112 + %114 = OpConvertSToF %6 %113 + %115 = OpAccessChain %35 %34 %13 %13 + %116 = OpLoad %12 %115 + %117 = OpConvertSToF %6 %116 + %118 = OpAccessChain %35 %34 %13 %19 + %119 = OpLoad %12 %118 + %120 = OpConvertSToF %6 %119 + %121 = OpCompositeConstruct %106 %111 %114 %117 %120 + OpStore %108 %121 + OpBranch %105 + %122 = OpLabel + %123 = OpAccessChain %35 %34 %13 %19 + %124 = OpLoad %12 %123 + %125 = OpConvertSToF %6 %124 + %126 = OpCompositeConstruct %106 %125 %125 %125 %125 + OpStore %108 %126 + OpBranch %105 + %105 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_float_values +BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA + 1.0 0.0 2.0 +END +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 0 1 4 2 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index.amber b/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index.amber new file mode 100644 index 0000000..c73b000 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index.amber @@ -0,0 +1,224 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a coverage-gap found by the GraphicsFuzz project. + +# Short description: Covers a specific X86 ISel lowering and DAG selection code paths + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# #define _int_1 _GLF_uniform_int_values[0] +# #define _int_0 _GLF_uniform_int_values[1] +# +# precision highp float; +# precision highp int; +# +# // Contents of _GLF_uniform_int_values: [1, 0] +# layout(set = 0, binding = 0) uniform buf0 +# { +# int _GLF_uniform_int_values[2]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S { +# int a; +# int b; +# int c; +# }; +# +# void main() +# { +# S A[2]; +# +# A[_int_0] = S(_int_0, _int_0, _int_0); +# A[_int_1] = S(_int_0, _int_0, _int_0); +# +# // Always true. +# if (A[_int_0].b == _int_0) +# { +# // A[1].b becomes 1. +# A[clamp(_int_0, 1, 2)].b = _int_1; +# } +# +# if (A[_int_1].b == _int_1) +# { +# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); +# } +# else +# { +# _GLF_color = vec4(_int_1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 90 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %71 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "S" + OpMemberName %7 0 "a" + OpMemberName %7 1 "b" + OpMemberName %7 2 "c" + OpName %12 "A" + OpName %14 "buf0" + OpMemberName %14 0 "_GLF_uniform_int_values" + OpName %16 "" + OpName %71 "_GLF_color" + OpDecorate %13 ArrayStride 16 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %71 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypeInt 32 0 + %9 = OpConstant %8 2 + %10 = OpTypeArray %7 %9 + %11 = OpTypePointer Function %10 + %13 = OpTypeArray %6 %9 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %6 0 + %18 = OpConstant %6 1 + %19 = OpTypePointer Uniform %6 + %29 = OpTypePointer Function %7 + %43 = OpTypePointer Function %6 + %48 = OpTypeBool + %54 = OpConstant %6 2 + %68 = OpTypeFloat 32 + %69 = OpTypeVector %68 4 + %70 = OpTypePointer Output %69 + %71 = OpVariable %70 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpVariable %11 Function + %20 = OpAccessChain %19 %16 %17 %18 + %21 = OpLoad %6 %20 + %22 = OpAccessChain %19 %16 %17 %18 + %23 = OpLoad %6 %22 + %24 = OpAccessChain %19 %16 %17 %18 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %19 %16 %17 %18 + %27 = OpLoad %6 %26 + %28 = OpCompositeConstruct %7 %23 %25 %27 + %30 = OpAccessChain %29 %12 %21 + OpStore %30 %28 + %31 = OpAccessChain %19 %16 %17 %17 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %19 %16 %17 %18 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %19 %16 %17 %18 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %19 %16 %17 %18 + %38 = OpLoad %6 %37 + %39 = OpCompositeConstruct %7 %34 %36 %38 + %40 = OpAccessChain %29 %12 %32 + OpStore %40 %39 + %41 = OpAccessChain %19 %16 %17 %18 + %42 = OpLoad %6 %41 + %44 = OpAccessChain %43 %12 %42 %18 + %45 = OpLoad %6 %44 + %46 = OpAccessChain %19 %16 %17 %18 + %47 = OpLoad %6 %46 + %49 = OpIEqual %48 %45 %47 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %51 + %50 = OpLabel + %52 = OpAccessChain %19 %16 %17 %18 + %53 = OpLoad %6 %52 + %55 = OpExtInst %6 %1 SClamp %53 %18 %54 + %56 = OpAccessChain %19 %16 %17 %17 + %57 = OpLoad %6 %56 + %58 = OpAccessChain %43 %12 %55 %18 + OpStore %58 %57 + OpBranch %51 + %51 = OpLabel + %59 = OpAccessChain %19 %16 %17 %17 + %60 = OpLoad %6 %59 + %61 = OpAccessChain %43 %12 %60 %18 + %62 = OpLoad %6 %61 + %63 = OpAccessChain %19 %16 %17 %17 + %64 = OpLoad %6 %63 + %65 = OpIEqual %48 %62 %64 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %85 + %66 = OpLabel + %72 = OpAccessChain %19 %16 %17 %17 + %73 = OpLoad %6 %72 + %74 = OpConvertSToF %68 %73 + %75 = OpAccessChain %19 %16 %17 %18 + %76 = OpLoad %6 %75 + %77 = OpConvertSToF %68 %76 + %78 = OpAccessChain %19 %16 %17 %18 + %79 = OpLoad %6 %78 + %80 = OpConvertSToF %68 %79 + %81 = OpAccessChain %19 %16 %17 %17 + %82 = OpLoad %6 %81 + %83 = OpConvertSToF %68 %82 + %84 = OpCompositeConstruct %69 %74 %77 %80 %83 + OpStore %71 %84 + OpBranch %67 + %85 = OpLabel + %86 = OpAccessChain %19 %16 %17 %17 + %87 = OpLoad %6 %86 + %88 = OpConvertSToF %68 %87 + %89 = OpCompositeConstruct %69 %88 %88 %88 %88 + OpStore %71 %89 + OpBranch %67 + %67 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# _GLF_uniform_int_values +BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA + 1 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/create-color-in-do-while-for-loop.amber b/vulkan/amber/graphicsfuzz/create-color-in-do-while-for-loop.amber new file mode 100644 index 0000000..ef560fb --- /dev/null +++ b/vulkan/amber/graphicsfuzz/create-color-in-do-while-for-loop.amber @@ -0,0 +1,287 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader that creates the color inside two loops + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 v = vec2(0); +# float floats[9]; +# floats[1] = 0.0; +# int one = int(injectionSwitch.y); +# +# // Iterates once. +# do +# { +# for (int i = 0; i < one; i++) +# { +# if (i == 0) +# { +# bool alwaysFalse = injectionSwitch.x > injectionSwitch.y; +# +# if (!alwaysFalse) +# { +# floats[one] = 1.0; +# _GLF_color = vec4(1.0, 1.0, 0.0, 1.0); +# } +# +# v[one] = 1.0; +# +# if (alwaysFalse) +# discard; +# +# // Always false. +# if (injectionSwitch.y < 0.0) +# _GLF_color = vec4(0.0, 1.0, 0.0, 1.0); +# } +# } +# } while (one < 0); +# +# // Always true. +# if (gl_FragCoord.y >= 0.0) +# { +# // Always true. +# if (v.y == 1.0 && floats[1] == 1.0) +# _GLF_color = vec4(1, 0, 0, 1); +# } +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 107 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %67 %86 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v" + OpName %16 "floats" + OpName %22 "one" + OpName %23 "buf0" + OpMemberName %23 0 "injectionSwitch" + OpName %25 "" + OpName %36 "i" + OpName %51 "alwaysFalse" + OpName %67 "_GLF_color" + OpName %86 "gl_FragCoord" + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %67 Location 0 + OpDecorate %86 BuiltIn FragCoord + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %10 %10 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 9 + %14 = OpTypeArray %6 %13 + %15 = OpTypePointer Function %14 + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 1 + %19 = OpTypePointer Function %6 + %21 = OpTypePointer Function %17 + %23 = OpTypeStruct %7 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpConstant %17 0 + %27 = OpConstant %12 1 + %28 = OpTypePointer Uniform %6 + %44 = OpTypeBool + %50 = OpTypePointer Function %44 + %52 = OpConstant %12 0 + %63 = OpConstant %6 1 + %65 = OpTypeVector %6 4 + %66 = OpTypePointer Output %65 + %67 = OpVariable %66 Output + %68 = OpConstantComposite %65 %63 %63 %10 %63 + %80 = OpConstantComposite %65 %10 %63 %10 %63 + %85 = OpTypePointer Input %65 + %86 = OpVariable %85 Input + %87 = OpTypePointer Input %6 + %104 = OpConstantComposite %65 %63 %10 %10 %63 + %106 = OpConstantComposite %65 %10 %10 %10 %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %16 = OpVariable %15 Function + %22 = OpVariable %21 Function + %36 = OpVariable %21 Function + %51 = OpVariable %50 Function + OpStore %9 %11 + %20 = OpAccessChain %19 %16 %18 + OpStore %20 %10 + %29 = OpAccessChain %28 %25 %26 %27 + %30 = OpLoad %6 %29 + %31 = OpConvertFToS %17 %30 + OpStore %22 %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %33 + %33 = OpLabel + OpStore %36 %26 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %17 %36 + %43 = OpLoad %17 %22 + %45 = OpSLessThan %44 %42 %43 + OpBranchConditional %45 %38 %39 + %38 = OpLabel + %46 = OpLoad %17 %36 + %47 = OpIEqual %44 %46 %26 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %49 + %48 = OpLabel + %53 = OpAccessChain %28 %25 %26 %52 + %54 = OpLoad %6 %53 + %55 = OpAccessChain %28 %25 %26 %27 + %56 = OpLoad %6 %55 + %57 = OpFOrdGreaterThan %44 %54 %56 + OpStore %51 %57 + %58 = OpLoad %44 %51 + %59 = OpLogicalNot %44 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %60 %61 + %60 = OpLabel + %62 = OpLoad %17 %22 + %64 = OpAccessChain %19 %16 %62 + OpStore %64 %63 + OpStore %67 %68 + OpBranch %61 + %61 = OpLabel + %69 = OpLoad %17 %22 + %70 = OpAccessChain %19 %9 %69 + OpStore %70 %63 + %71 = OpLoad %44 %51 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %73 + %72 = OpLabel + OpTerminateInvocation + %73 = OpLabel + %75 = OpAccessChain %28 %25 %26 %27 + %76 = OpLoad %6 %75 + %77 = OpFOrdLessThan %44 %76 %10 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + OpStore %67 %80 + OpBranch %79 + %79 = OpLabel + OpBranch %49 + %49 = OpLabel + OpBranch %40 + %40 = OpLabel + %81 = OpLoad %17 %36 + %82 = OpIAdd %17 %81 %18 + OpStore %36 %82 + OpBranch %37 + %39 = OpLabel + OpBranch %35 + %35 = OpLabel + %83 = OpLoad %17 %22 + %84 = OpSLessThan %44 %83 %26 + OpBranchConditional %84 %32 %34 + %34 = OpLabel + %88 = OpAccessChain %87 %86 %27 + %89 = OpLoad %6 %88 + %90 = OpFOrdGreaterThanEqual %44 %89 %10 + OpSelectionMerge %92 None + OpBranchConditional %90 %91 %105 + %91 = OpLabel + %93 = OpAccessChain %19 %9 %27 + %94 = OpLoad %6 %93 + %95 = OpFOrdEqual %44 %94 %63 + OpSelectionMerge %97 None + OpBranchConditional %95 %96 %97 + %96 = OpLabel + %98 = OpAccessChain %19 %16 %18 + %99 = OpLoad %6 %98 + %100 = OpFOrdEqual %44 %99 %63 + OpBranch %97 + %97 = OpLabel + %101 = OpPhi %44 %95 %91 %100 %96 + OpSelectionMerge %103 None + OpBranchConditional %101 %102 %103 + %102 = OpLabel + OpStore %67 %104 + OpBranch %103 + %103 = OpLabel + OpBranch %92 + %105 = OpLabel + OpStore %67 %106 + OpBranch %92 + %92 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/dead-barriers-in-loops.amber b/vulkan/amber/graphicsfuzz/dead-barriers-in-loops.amber new file mode 100644 index 0000000..f99c513 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/dead-barriers-in-loops.amber @@ -0,0 +1,314 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# Short description: A compute shader with dead barriers + +# Checks that the output value is 42. +# Passes because main always writes 42 to out_data. + +# Derived from the following GLSL. + +# Compute shader GLSL: +# #version 310 es +# +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 injectionSwitch; +# }; +# +# layout(std430, binding = 0) buffer theSSBO +# { +# int out_data; +# }; +# +# layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +# void main() +# { +# out_data = 42; +# if (injectionSwitch.x > injectionSwitch.y) // false +# { +# barrier(); +# } +# +# if (injectionSwitch.x > injectionSwitch.y) // false +# { +# barrier(); +# } +# +# // single iteration loop +# for ( +# int i = int(injectionSwitch.y); // 1 +# i > 0; +# --i) +# { +# barrier(); +# } +# +# float GLF_live3s = 0.0; +# +# // single iteration loop +# do +# { +# // single iteration loop +# for ( +# int i = 1; +# i < 2; +# i++) +# { +# if (injectionSwitch.x > 1.0) // false +# { +# barrier(); +# } +# +# if (injectionSwitch.x > injectionSwitch.y) // false +# { +# barrier(); +# } +# +# // single iteration loop +# for ( +# int z = int(injectionSwitch.y); // 1 +# z > 0; +# --z) +# { +# GLF_live3s += 1.0; +# } +# +# if (i >= 1) // true +# { +# if (injectionSwitch.x > 1.0) // false +# { +# barrier(); +# } +# } +# } +# } while (injectionSwitch.x > injectionSwitch.y); // false +# +# } + +[compute shader spirv] +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 115 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %4 "main" + OpExecutionMode %4 LocalSize 1 1 1 + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "theSSBO" + OpMemberName %7 0 "out_data" + OpName %9 "" + OpName %16 "buf1" + OpMemberName %16 0 "injectionSwitch" + OpName %18 "" + OpName %41 "i" + OpName %56 "GLF_live3s" + OpName %62 "i" + OpName %84 "z" + OpMemberDecorate %7 0 Offset 0 + OpDecorate %7 BufferBlock + OpDecorate %9 DescriptorSet 0 + OpDecorate %9 Binding 0 + OpMemberDecorate %16 0 Offset 0 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Uniform %7 + %9 = OpVariable %8 Uniform + %10 = OpConstant %6 0 + %11 = OpConstant %6 42 + %12 = OpTypePointer Uniform %6 + %14 = OpTypeFloat 32 + %15 = OpTypeVector %14 2 + %16 = OpTypeStruct %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 0 + %21 = OpTypePointer Uniform %14 + %24 = OpConstant %19 1 + %27 = OpTypeBool + %31 = OpConstant %19 2 + %32 = OpConstant %19 264 + %40 = OpTypePointer Function %6 + %53 = OpConstant %6 1 + %55 = OpTypePointer Function %14 + %57 = OpConstant %14 0 + %69 = OpConstant %6 2 + %73 = OpConstant %14 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %41 = OpVariable %40 Function + %56 = OpVariable %55 Function + %62 = OpVariable %40 Function + %84 = OpVariable %40 Function + %13 = OpAccessChain %12 %9 %10 + OpStore %13 %11 + %22 = OpAccessChain %21 %18 %10 %20 + %23 = OpLoad %14 %22 + %25 = OpAccessChain %21 %18 %10 %24 + %26 = OpLoad %14 %25 + %28 = OpFOrdGreaterThan %27 %23 %26 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %30 + %29 = OpLabel + OpControlBarrier %31 %31 %32 + OpBranch %30 + %30 = OpLabel + %33 = OpAccessChain %21 %18 %10 %20 + %34 = OpLoad %14 %33 + %35 = OpAccessChain %21 %18 %10 %24 + %36 = OpLoad %14 %35 + %37 = OpFOrdGreaterThan %27 %34 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + OpControlBarrier %31 %31 %32 + OpBranch %39 + %39 = OpLabel + %42 = OpAccessChain %21 %18 %10 %24 + %43 = OpLoad %14 %42 + %44 = OpConvertFToS %6 %43 + OpStore %41 %44 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %49 + %49 = OpLabel + %50 = OpLoad %6 %41 + %51 = OpSGreaterThan %27 %50 %10 + OpBranchConditional %51 %46 %47 + %46 = OpLabel + OpControlBarrier %31 %31 %32 + OpBranch %48 + %48 = OpLabel + %52 = OpLoad %6 %41 + %54 = OpISub %6 %52 %53 + OpStore %41 %54 + OpBranch %45 + %47 = OpLabel + OpStore %56 %57 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %59 + %59 = OpLabel + OpStore %62 %53 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %6 %62 + %70 = OpSLessThan %27 %68 %69 + OpBranchConditional %70 %64 %65 + %64 = OpLabel + %71 = OpAccessChain %21 %18 %10 %20 + %72 = OpLoad %14 %71 + %74 = OpFOrdGreaterThan %27 %72 %73 + OpSelectionMerge %76 None + OpBranchConditional %74 %75 %76 + %75 = OpLabel + OpControlBarrier %31 %31 %32 + OpBranch %76 + %76 = OpLabel + %77 = OpAccessChain %21 %18 %10 %20 + %78 = OpLoad %14 %77 + %79 = OpAccessChain %21 %18 %10 %24 + %80 = OpLoad %14 %79 + %81 = OpFOrdGreaterThan %27 %78 %80 + OpSelectionMerge %83 None + OpBranchConditional %81 %82 %83 + %82 = OpLabel + OpControlBarrier %31 %31 %32 + OpBranch %83 + %83 = OpLabel + %85 = OpAccessChain %21 %18 %10 %24 + %86 = OpLoad %14 %85 + %87 = OpConvertFToS %6 %86 + OpStore %84 %87 + OpBranch %88 + %88 = OpLabel + OpLoopMerge %90 %91 None + OpBranch %92 + %92 = OpLabel + %93 = OpLoad %6 %84 + %94 = OpSGreaterThan %27 %93 %10 + OpBranchConditional %94 %89 %90 + %89 = OpLabel + %95 = OpLoad %14 %56 + %96 = OpFAdd %14 %95 %73 + OpStore %56 %96 + OpBranch %91 + %91 = OpLabel + %97 = OpLoad %6 %84 + %98 = OpISub %6 %97 %53 + OpStore %84 %98 + OpBranch %88 + %90 = OpLabel + %99 = OpLoad %6 %62 + %100 = OpSGreaterThanEqual %27 %99 %53 + OpSelectionMerge %102 None + OpBranchConditional %100 %101 %102 + %101 = OpLabel + %103 = OpAccessChain %21 %18 %10 %20 + %104 = OpLoad %14 %103 + %105 = OpFOrdGreaterThan %27 %104 %73 + OpSelectionMerge %107 None + OpBranchConditional %105 %106 %107 + %106 = OpLabel + OpControlBarrier %31 %31 %32 + OpBranch %107 + %107 = OpLabel + OpBranch %102 + %102 = OpLabel + OpBranch %66 + %66 = OpLabel + %108 = OpLoad %6 %62 + %109 = OpIAdd %6 %108 %53 + OpStore %62 %109 + OpBranch %63 + %65 = OpLabel + OpBranch %61 + %61 = OpLabel + %110 = OpAccessChain %21 %18 %10 %20 + %111 = OpLoad %14 %110 + %112 = OpAccessChain %21 %18 %10 %24 + %113 = OpLoad %14 %112 + %114 = OpFOrdGreaterThan %27 %111 %113 + OpBranchConditional %114 %58 %60 + %60 = OpLabel + OpReturn + OpFunctionEnd + + +[test] +## Uniforms +# injectionSwitch +uniform ubo 0:1 vec2 0 0.0 1.0 +## SSBO +ssbo 0 subdata int 0 0 + +compute 1 1 1 +probe ssbo int 0 0 == 42 diff --git a/vulkan/amber/graphicsfuzz/dead-struct-init.amber b/vulkan/amber/graphicsfuzz/dead-struct-init.amber new file mode 100644 index 0000000..93abd11 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/dead-struct-init.amber @@ -0,0 +1,114 @@ +#!amber + +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# A fragment shader that uses struct initializers. +# Derived from the following GLSL fragment shader. +# We check that all pixels are red. The test passes because main does +# some computation and then writes red to _GLF_color. + +# #version 310 es +# +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct S { +# bool b; +# }; +# +# S foo() +# { +# if(true) +# { +# return S(true); +# } +# return S(true); +# } +# void main(void) +# { +# foo(); +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource ESSL 310 + OpName %2 "main" + OpName %4 "S" + OpMemberName %4 0 "b" + OpName %5 "foo(" + OpName %3 "_GLF_color" + OpDecorate %3 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeBool + %4 = OpTypeStruct %8 + %9 = OpTypeFunction %4 + %10 = OpConstantTrue %8 + %11 = OpConstantComposite %4 %10 + %12 = OpTypeFloat 32 + %13 = OpTypeVector %12 4 + %14 = OpTypePointer Output %13 + %3 = OpVariable %14 Output + %15 = OpConstant %12 1 + %16 = OpConstant %12 0 + %17 = OpConstantComposite %13 %15 %16 %16 %15 + %2 = OpFunction %6 None %7 + %18 = OpLabel + %19 = OpFunctionCall %4 %5 + OpStore %3 %17 + OpReturn + OpFunctionEnd + %5 = OpFunction %4 None %9 + %20 = OpLabel + OpSelectionMerge %21 None + OpBranchConditional %10 %22 %21 + %22 = OpLabel + OpReturnValue %11 + %21 = OpLabel + OpReturnValue %11 + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/disc-and-add-in-func-in-loop.amber b/vulkan/amber/graphicsfuzz/disc-and-add-in-func-in-loop.amber new file mode 100644 index 0000000..c1ad29f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/disc-and-add-in-func-in-loop.amber @@ -0,0 +1,196 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with discard and add in function in loop + +# The test passes because main always outputs the color red and returns. +# red() has an unreachable discard and adds zero to the returned value. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# vec4 red() +# { +# if(injectionSwitch.x > 0.0) // always false +# discard; +# +# return vec4(1.0, 0.0, 0.0, 1.0) + injectionSwitch.x; // add zero +# } +# +# void main() +# { +# while(true) +# { +# while(injectionSwitch.y > 0.0) // always true +# { +# _GLF_color = red(); +# return; +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 102 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %12 "buf0" + OpMemberName %12 0 "injectionSwitch" + OpName %14 "" + OpName %52 "_GLF_color" + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %11 = OpTypeVector %6 2 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 0 + %23 = OpTypeBool + %28 = OpConstant %6 1 + %29 = OpConstantComposite %7 %28 %22 %22 %28 + %41 = OpConstantTrue %23 + %47 = OpConstant %17 1 + %51 = OpTypePointer Output %7 + %52 = OpVariable %51 Output + %63 = OpConstantFalse %23 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %60 + %60 = OpLabel + OpLoopMerge %59 %62 None + OpBranch %36 + %36 = OpLabel + %100 = OpPhi %23 %63 %60 %98 %66 + OpLoopMerge %38 %66 None + OpBranch %42 + %42 = OpLabel + %48 = OpAccessChain %19 %14 %16 %47 + %49 = OpLoad %6 %48 + %50 = OpFOrdGreaterThan %23 %49 %22 + OpLoopMerge %44 %45 None + OpBranchConditional %50 %43 %44 + %43 = OpLabel + OpBranch %81 + %81 = OpLabel + OpLoopMerge %82 %83 None + OpBranch %84 + %84 = OpLabel + %85 = OpAccessChain %19 %14 %16 %18 + %86 = OpLoad %6 %85 + %87 = OpFOrdGreaterThan %23 %86 %22 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpFunctionCall %2 %55 + %91 = OpUndef %7 + OpBranch %82 + %88 = OpLabel + %94 = OpCompositeConstruct %7 %86 %86 %86 %86 + %95 = OpFAdd %7 %29 %94 + OpBranch %82 + %83 = OpLabel + OpBranch %81 + %82 = OpLabel + %97 = OpPhi %7 %91 %89 %95 %88 + OpStore %52 %97 + OpBranch %44 + %45 = OpLabel + OpBranch %42 + %44 = OpLabel + %98 = OpPhi %23 %100 %42 %41 %82 + OpSelectionMerge %101 None + OpBranchConditional %98 %38 %66 + %101 = OpLabel + OpBranch %66 + %66 = OpLabel + OpBranch %36 + %38 = OpLabel + OpSelectionMerge %68 None + OpBranchConditional %98 %59 %68 + %68 = OpLabel + OpBranch %59 + %62 = OpLabel + OpBranch %60 + %59 = OpLabel + OpReturn + OpFunctionEnd + %55 = OpFunction %2 None %3 + %56 = OpLabel + OpTerminateInvocation + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/discard-continue-return.amber b/vulkan/amber/graphicsfuzz/discard-continue-return.amber new file mode 100644 index 0000000..f49f23e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/discard-continue-return.amber @@ -0,0 +1,179 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with a discard, continue, and return + +# The test passes because main always writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 06407250a169c6a03b3765e86619075af1a8c187 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 mand() +# { +# do +# { +# if(gl_FragCoord.x < 0.0) +# { +# if(1.0 > injectionSwitch.y) +# { +# discard; +# } +# continue; +# } +# return vec3(1.0); +# } +# while(false); +# return vec3(1.0); +# } +# void main() +# { +# mand(); +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 96 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %17 %51 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %17 "gl_FragCoord" + OpName %30 "buf0" + OpMemberName %30 0 "injectionSwitch" + OpName %32 "" + OpName %51 "_GLF_color" + OpDecorate %17 BuiltIn FragCoord + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 0 + OpDecorate %51 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %15 = OpTypeVector %6 4 + %16 = OpTypePointer Input %15 + %17 = OpVariable %16 Input + %18 = OpTypeInt 32 0 + %19 = OpConstant %18 0 + %20 = OpTypePointer Input %6 + %23 = OpConstant %6 0 + %24 = OpTypeBool + %28 = OpConstant %6 1 + %29 = OpTypeVector %6 2 + %30 = OpTypeStruct %29 + %31 = OpTypePointer Uniform %30 + %32 = OpVariable %31 Uniform + %33 = OpTypeInt 32 1 + %34 = OpConstant %33 0 + %35 = OpConstant %18 1 + %36 = OpTypePointer Uniform %6 + %46 = OpConstantFalse %24 + %50 = OpTypePointer Output %15 + %51 = OpVariable %50 Output + %52 = OpConstantComposite %15 %28 %23 %23 %28 + %65 = OpConstantTrue %24 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %75 + %75 = OpLabel + OpLoopMerge %76 %87 None + OpBranch %78 + %78 = OpLabel + %79 = OpAccessChain %20 %17 %19 + %80 = OpLoad %6 %79 + %81 = OpFOrdLessThan %24 %80 %23 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %82 + %83 = OpLabel + %84 = OpAccessChain %36 %32 %34 %35 + %85 = OpLoad %6 %84 + %86 = OpFOrdGreaterThan %24 %28 %85 + OpSelectionMerge %95 None + OpBranchConditional %86 %88 %87 + %88 = OpLabel + OpTerminateInvocation + %95 = OpLabel + OpBranch %87 + %87 = OpLabel + OpBranchConditional %46 %75 %76 + %82 = OpLabel + OpBranch %76 + %76 = OpLabel + %94 = OpPhi %24 %65 %82 %46 %87 + OpSelectionMerge %91 None + OpBranchConditional %94 %72 %91 + %91 = OpLabel + OpBranch %72 + %73 = OpLabel + OpBranch %71 + %72 = OpLabel + OpStore %51 %52 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/discard-in-array-manipulating-loop.amber b/vulkan/amber/graphicsfuzz/discard-in-array-manipulating-loop.amber new file mode 100644 index 0000000..c6206ee --- /dev/null +++ b/vulkan/amber/graphicsfuzz/discard-in-array-manipulating-loop.amber @@ -0,0 +1,164 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: An array-manipulating fragment shader with a discard + +# The test passes because the discard is not dynamically reachable, and +# data[0] ends up with the value 1.0 after the loop so that red is +# rendered + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float data[10] = float[](0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0); +# for(int i = 0; i < 10; i++) { +# if(gl_FragCoord.x < 0.0) { +# discard; +# } +# data[0] = data[i]; +# } +# _GLF_color = vec4(data[0], 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %38 %57 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "data" + OpName %25 "i" + OpName %38 "gl_FragCoord" + OpName %57 "_GLF_color" + OpDecorate %25 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %38 BuiltIn FragCoord + OpDecorate %48 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %57 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %6 0.100000001 + %13 = OpConstant %6 0.200000003 + %14 = OpConstant %6 0.300000012 + %15 = OpConstant %6 0.400000006 + %16 = OpConstant %6 0.5 + %17 = OpConstant %6 0.600000024 + %18 = OpConstant %6 0.699999988 + %19 = OpConstant %6 0.800000012 + %20 = OpConstant %6 0.899999976 + %21 = OpConstant %6 1 + %22 = OpConstantComposite %9 %12 %13 %14 %15 %16 %17 %18 %19 %20 %21 + %23 = OpTypeInt 32 1 + %24 = OpTypePointer Function %23 + %26 = OpConstant %23 0 + %33 = OpConstant %23 10 + %34 = OpTypeBool + %36 = OpTypeVector %6 4 + %37 = OpTypePointer Input %36 + %38 = OpVariable %37 Input + %39 = OpConstant %7 0 + %40 = OpTypePointer Input %6 + %43 = OpConstant %6 0 + %49 = OpTypePointer Function %6 + %54 = OpConstant %23 1 + %56 = OpTypePointer Output %36 + %57 = OpVariable %56 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %25 = OpVariable %24 Function + OpStore %11 %22 + OpStore %25 %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %23 %25 + %35 = OpSLessThan %34 %32 %33 + OpBranchConditional %35 %28 %29 + %28 = OpLabel + %41 = OpAccessChain %40 %38 %39 + %42 = OpLoad %6 %41 + %44 = OpFOrdLessThan %34 %42 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %45 %46 + %45 = OpLabel + OpTerminateInvocation + %46 = OpLabel + %48 = OpLoad %23 %25 + %50 = OpAccessChain %49 %11 %48 + %51 = OpLoad %6 %50 + %52 = OpAccessChain %49 %11 %26 + OpStore %52 %51 + OpBranch %30 + %30 = OpLabel + %53 = OpLoad %23 %25 + %55 = OpIAdd %23 %53 %54 + OpStore %25 %55 + OpBranch %27 + %29 = OpLabel + %58 = OpAccessChain %49 %11 %26 + %59 = OpLoad %6 %58 + %60 = OpCompositeConstruct %36 %59 %43 %43 %21 + OpStore %57 %60 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/discard-in-loop-in-function.amber b/vulkan/amber/graphicsfuzz/discard-in-loop-in-function.amber new file mode 100644 index 0000000..70fcbb4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/discard-in-loop-in-function.amber @@ -0,0 +1,180 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A shader with a discard nested in a loop in a function + +# The test passes because the discard is always reached, so we end up with the background color, black. + +# Optimized using spirv-opt with the following arguments: +# '--simplify-instructions' +# '--eliminate-dead-inserts' +# '--redundancy-elimination' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--convert-local-access-chains' +# '--convert-local-access-chains' +# '--eliminate-dead-code-aggressive' +# '--eliminate-local-single-store' +# '--if-conversion' +# '--simplify-instructions' +# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# void f() +# { +# do +# { +# if(1.0 > injectionSwitch.y) +# { +# if(gl_FragCoord.y < 0.0) +# { +# } +# continue; +# } +# discard; +# } +# while(false); +# } +# void main() +# { +# f(); +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %31 %44 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %6 "f(" + OpName %15 "buf0" + OpMemberName %15 0 "injectionSwitch" + OpName %17 "" + OpName %31 "gl_FragCoord" + OpName %44 "_GLF_color" + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %31 BuiltIn FragCoord + OpDecorate %44 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %12 = OpTypeFloat 32 + %13 = OpConstant %12 1 + %14 = OpTypeVector %12 2 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 1 + %22 = OpTypePointer Uniform %12 + %25 = OpTypeBool + %29 = OpTypeVector %12 4 + %30 = OpTypePointer Input %29 + %31 = OpVariable %30 Input + %32 = OpTypePointer Input %12 + %35 = OpConstant %12 0 + %41 = OpConstantFalse %25 + %43 = OpTypePointer Output %29 + %44 = OpVariable %43 Output + %45 = OpConstantComposite %29 %13 %35 %35 %13 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %42 = OpFunctionCall %2 %6 + OpStore %44 %45 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + OpBranch %8 + %8 = OpLabel + OpLoopMerge %10 %38 None + OpBranch %9 + %9 = OpLabel + %23 = OpAccessChain %22 %17 %19 %21 + %24 = OpLoad %12 %23 + %26 = OpFOrdGreaterThan %25 %13 %24 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + %33 = OpAccessChain %32 %31 %21 + %34 = OpLoad %12 %33 + %36 = OpFOrdLessThan %25 %34 %35 + OpSelectionMerge %46 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + OpBranch %38 + %46 = OpLabel + OpBranch %38 + %38 = OpLabel + OpBranchConditional %41 %8 %10 + %28 = OpLabel + OpTerminateInvocation + %10 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 0 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/discard-in-loop.amber b/vulkan/amber/graphicsfuzz/discard-in-loop.amber new file mode 100644 index 0000000..0b4ee05 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/discard-in-loop.amber @@ -0,0 +1,162 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A shader with a discard in a loop + +# The test passes because the discard is always reached, so the background colour will remain black. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# for(int i = 0; i < 10; i++) +# { +# if(gl_FragCoord.y < 0.0) +# { +# if(gl_FragCoord.x < 0.0) +# { +# break; +# } +# continue; +# } +# discard; +# } +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %22 %45 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %22 "gl_FragCoord" + OpName %45 "_GLF_color" + OpDecorate %22 BuiltIn FragCoord + OpDecorate %45 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeFloat 32 + %20 = OpTypeVector %19 4 + %21 = OpTypePointer Input %20 + %22 = OpVariable %21 Input + %23 = OpTypeInt 32 0 + %24 = OpConstant %23 1 + %25 = OpTypePointer Input %19 + %28 = OpConstant %19 0 + %32 = OpConstant %23 0 + %42 = OpConstant %6 1 + %44 = OpTypePointer Output %20 + %45 = OpVariable %44 Output + %46 = OpConstant %19 1 + %47 = OpConstantComposite %20 %46 %28 %28 %46 + %55 = OpConstantFalse %17 + %58 = OpConstantTrue %17 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %52 + %52 = OpLabel + OpLoopMerge %51 %54 None + OpBranch %10 + %10 = OpLabel + %61 = OpPhi %6 %9 %52 %43 %37 + %18 = OpSLessThan %17 %61 %16 + OpLoopMerge %12 %37 None + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %26 = OpAccessChain %25 %22 %24 + %27 = OpLoad %19 %26 + %29 = OpFOrdLessThan %17 %27 %28 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %31 + %30 = OpLabel + %33 = OpAccessChain %25 %22 %32 + %34 = OpLoad %19 %33 + %35 = OpFOrdLessThan %17 %34 %28 + OpSelectionMerge %63 None + OpBranchConditional %35 %36 %37 + %36 = OpLabel + OpBranch %12 + %63 = OpLabel + OpBranch %37 + %37 = OpLabel + %43 = OpIAdd %6 %61 %42 + OpBranch %10 + %31 = OpLabel + %50 = OpFunctionCall %2 %48 + OpBranch %12 + %12 = OpLabel + %62 = OpPhi %17 %55 %10 %55 %36 %58 %31 + OpSelectionMerge %59 None + OpBranchConditional %62 %51 %59 + %59 = OpLabel + OpStore %45 %47 + OpBranch %51 + %54 = OpLabel + OpBranch %52 + %51 = OpLabel + OpReturn + OpFunctionEnd + %48 = OpFunction %2 None %3 + %49 = OpLabel + OpTerminateInvocation + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 0 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/discards-in-control-flow.amber b/vulkan/amber/graphicsfuzz/discards-in-control-flow.amber new file mode 100644 index 0000000..82076f0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/discards-in-control-flow.amber @@ -0,0 +1,170 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with discards in loops and conditionals + +# The test passes because the fragment shader writes a red pixel, and then +# terminates without further output manipulation (the discards are not +# dynamically reachable) + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main(void) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# if(int(gl_FragCoord.x) < 2000) { +# } else { +# for(int ll = 0; ; ll++) { +# if(gl_FragCoord.x < 0.0) { +# discard; +# } +# if(ll >= 5) { +# break; +# } +# } +# if(int(gl_FragCoord.x) >= 2000) { +# discard; +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %14 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "gl_FragCoord" + OpName %29 "ll" + OpDecorate %9 Location 0 + OpDecorate %14 BuiltIn FragCoord + OpDecorate %29 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstant %6 0 + %12 = OpConstantComposite %7 %10 %11 %11 %10 + %13 = OpTypePointer Input %7 + %14 = OpVariable %13 Input + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 0 + %17 = OpTypePointer Input %6 + %20 = OpTypeInt 32 1 + %22 = OpConstant %20 2000 + %23 = OpTypeBool + %28 = OpTypePointer Function %20 + %30 = OpConstant %20 0 + %42 = OpConstant %20 5 + %48 = OpConstant %20 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %29 = OpVariable %28 Function + OpStore %9 %12 + %18 = OpAccessChain %17 %14 %16 + %19 = OpLoad %6 %18 + %21 = OpConvertFToS %20 %19 + %24 = OpSLessThan %23 %21 %22 + OpSelectionMerge %26 None + OpBranchConditional %24 %25 %27 + %25 = OpLabel + OpBranch %26 + %27 = OpLabel + OpStore %29 %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %32 + %32 = OpLabel + %35 = OpAccessChain %17 %14 %16 + %36 = OpLoad %6 %35 + %37 = OpFOrdLessThan %23 %36 %11 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + OpTerminateInvocation + %39 = OpLabel + %41 = OpLoad %20 %29 + %43 = OpSGreaterThanEqual %23 %41 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %45 + %44 = OpLabel + OpBranch %33 + %45 = OpLabel + OpBranch %34 + %34 = OpLabel + %47 = OpLoad %20 %29 + %49 = OpIAdd %20 %47 %48 + OpStore %29 %49 + OpBranch %31 + %33 = OpLabel + %50 = OpAccessChain %17 %14 %16 + %51 = OpLoad %6 %50 + %52 = OpConvertFToS %20 %51 + %53 = OpSGreaterThanEqual %23 %52 %22 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %55 + %54 = OpLabel + OpTerminateInvocation + %55 = OpLabel + OpBranch %26 + %26 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/do-while-false-if.amber b/vulkan/amber/graphicsfuzz/do-while-false-if.amber new file mode 100644 index 0000000..ed31004 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/do-while-false-if.amber @@ -0,0 +1,221 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: A fragment shader with false if return in do while loop + +# The test passes because the shader always writes color red. + +# Optimized using spirv-opt with the following arguments: +# '--inline-entry-points-exhaustive' +# '--ccp' +# '--eliminate-local-single-block' +# '--eliminate-dead-inserts' +# '--eliminate-dead-inserts' +# '--combine-access-chains' +# '--eliminate-local-single-block' +# '--reduce-load-size' +# '--eliminate-local-single-store' +# '--eliminate-dead-branches' +# '--reduce-load-size' +# '--eliminate-dead-code-aggressive' +# '--eliminate-local-multi-store' +# '--redundancy-elimination' +# spirv-opt commit hash: e28436f2b8a2f0705a07de908178d2ea2682c6d3 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# +# precision highp float; +# precision highp int; +# +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; //x == 0.0, y == 1.0 +# }; +# +# struct struct_base +# { +# float count; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { // loop_limit == 100 +# int loop_limit = (injectionSwitch.y > 0.0 ? 100 : 1); +# int loop_count = 0; +# +# bool bool_a = true; +# +# struct_base struct_a = struct_base(1.0); +# do +# { +# loop_count++; +# // Always false. +# if (injectionSwitch.x > injectionSwitch.y) +# { +# return ; +# } +# } +# // Always false. +# while ((struct_a.count != injectionSwitch.y) && (loop_count < loop_limit)); +# bool_a = struct_a.count < 1.0; +# // bool_a == false +# if (bool_a == false) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(1.0); +# }; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %70 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "buf0" + OpMemberName %11 0 "injectionSwitch" + OpName %13 "" + OpName %26 "loop_count" + OpName %30 "struct_base" + OpMemberName %30 0 "count" + OpName %32 "struct_a" + OpName %70 "_GLF_color" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %70 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 2 + %11 = OpTypeStruct %10 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpConstant %6 0 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 1 + %17 = OpTypePointer Uniform %9 + %20 = OpConstant %9 0 + %21 = OpTypeBool + %23 = OpConstant %6 100 + %24 = OpConstant %6 1 + %30 = OpTypeStruct %9 + %31 = OpTypePointer Function %30 + %33 = OpConstant %9 1 + %34 = OpConstantComposite %30 %33 + %41 = OpConstant %15 0 + %50 = OpTypePointer Function %9 + %64 = OpConstantFalse %21 + %68 = OpTypeVector %9 4 + %69 = OpTypePointer Output %68 + %70 = OpVariable %69 Output + %71 = OpConstantComposite %68 %33 %20 %20 %33 + %73 = OpConstantComposite %68 %33 %33 %33 %33 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %26 = OpVariable %7 Function + %32 = OpVariable %31 Function + %18 = OpAccessChain %17 %13 %14 %16 + %19 = OpLoad %9 %18 + %22 = OpFOrdGreaterThan %21 %19 %20 + %25 = OpSelect %6 %22 %23 %24 + OpStore %26 %14 + OpStore %32 %34 + OpBranch %35 + %35 = OpLabel + %74 = OpPhi %6 %14 %5 %40 %38 + OpLoopMerge %37 %38 None + OpBranch %36 + %36 = OpLabel + %40 = OpIAdd %6 %74 %24 + OpStore %26 %40 + %42 = OpAccessChain %17 %13 %14 %41 + %43 = OpLoad %9 %42 + %46 = OpFOrdGreaterThan %21 %43 %19 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + OpReturn + %48 = OpLabel + OpBranch %38 + %38 = OpLabel + %51 = OpAccessChain %50 %32 %14 + %52 = OpLoad %9 %51 + %55 = OpFUnordNotEqual %21 %52 %19 + %58 = OpSLessThan %21 %40 %25 + %59 = OpLogicalAnd %21 %55 %58 + OpBranchConditional %59 %35 %37 + %37 = OpLabel + %61 = OpLoad %9 %51 + %62 = OpFOrdLessThan %21 %61 %33 + %65 = OpLogicalEqual %21 %62 %64 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %72 + %66 = OpLabel + OpStore %70 %71 + OpBranch %67 + %72 = OpLabel + OpStore %70 %73 + OpBranch %67 + %67 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/do-while-false-loops.amber b/vulkan/amber/graphicsfuzz/do-while-false-loops.amber new file mode 100644 index 0000000..c13fd61 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/do-while-false-loops.amber @@ -0,0 +1,199 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: Code wrapped in nested single iteration loops + +# The test passes because the first return statement in 'f' is guaranteed to be hit on the first loop iteration, so that red is written to the framebuffer + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 f() +# { +# int iteration = 0; +# for( +# int k = 0; +# k < 100; +# k ++ +# ) +# { +# iteration ++; +# } +# if(iteration < 100) +# { +# return vec3(1.0, float(iteration - 1), float(iteration - 1)); +# } +# else +# { +# do +# { +# do +# { +# return vec3(1.0, 0.0, 0.0); +# } +# while(false); +# } +# while(false); +# } +# } +# void main() +# { +# _GLF_color = vec4(f(), 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 65 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %59 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "f(" + OpName %13 "iteration" + OpName %15 "k" + OpName %59 "_GLF_color" + OpDecorate %13 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %59 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeFunction %7 + %11 = OpTypeInt 32 1 + %12 = OpTypePointer Function %11 + %14 = OpConstant %11 0 + %22 = OpConstant %11 100 + %23 = OpTypeBool + %26 = OpConstant %11 1 + %34 = OpConstant %6 1 + %52 = OpConstant %6 0 + %53 = OpConstantComposite %7 %34 %52 %52 + %55 = OpConstantFalse %23 + %57 = OpTypeVector %6 4 + %58 = OpTypePointer Output %57 + %59 = OpVariable %58 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %60 = OpFunctionCall %7 %9 + %61 = OpCompositeExtract %6 %60 0 + %62 = OpCompositeExtract %6 %60 1 + %63 = OpCompositeExtract %6 %60 2 + %64 = OpCompositeConstruct %57 %61 %62 %63 %34 + OpStore %59 %64 + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %13 = OpVariable %12 Function + %15 = OpVariable %12 Function + OpStore %13 %14 + OpStore %15 %14 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %21 = OpLoad %11 %15 + %24 = OpSLessThan %23 %21 %22 + OpBranchConditional %24 %17 %18 + %17 = OpLabel + %25 = OpLoad %11 %13 + %27 = OpIAdd %11 %25 %26 + OpStore %13 %27 + OpBranch %19 + %19 = OpLabel + %28 = OpLoad %11 %15 + %29 = OpIAdd %11 %28 %26 + OpStore %15 %29 + OpBranch %16 + %18 = OpLabel + %30 = OpLoad %11 %13 + %31 = OpSLessThan %23 %30 %22 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %43 + %32 = OpLabel + %35 = OpLoad %11 %13 + %36 = OpISub %11 %35 %26 + %37 = OpConvertSToF %6 %36 + %38 = OpLoad %11 %13 + %39 = OpISub %11 %38 %26 + %40 = OpConvertSToF %6 %39 + %41 = OpCompositeConstruct %7 %34 %37 %40 + OpReturnValue %41 + %43 = OpLabel + OpBranch %44 + %44 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %45 + %45 = OpLabel + OpBranch %48 + %48 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %49 + %49 = OpLabel + OpReturnValue %53 + %51 = OpLabel + OpBranch %48 + %50 = OpLabel + OpUnreachable + %47 = OpLabel + OpBranch %44 + %46 = OpLabel + OpUnreachable + %33 = OpLabel + OpUnreachable + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/do-while-if-return.amber b/vulkan/amber/graphicsfuzz/do-while-if-return.amber new file mode 100644 index 0000000..81113bf --- /dev/null +++ b/vulkan/amber/graphicsfuzz/do-while-if-return.amber @@ -0,0 +1,231 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: A fragment shader with true if in a nested do while loop + +# The test passes because the shader always writes color red. + +# Optimized using spirv-opt with the following arguments: +# '--simplify-instructions' +# '--private-to-local' +# '--eliminate-local-multi-store' +# '--convert-local-access-chains' +# '--inline-entry-points-exhaustive' +# '--simplify-instructions' +# '--eliminate-dead-inserts' +# '--vector-dce' +# '--combine-access-chains' +# '--convert-local-access-chains' +# '--if-conversion' +# '--private-to-local' +# '--eliminate-local-single-store' +# '--copy-propagate-arrays' +# spirv-opt commit hash: 230f363e6da32791f640b02205e0645cc67c3f1d + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; // x == 0.0, y == 1.0 +# }; +# +# int func() +# { +# const int loop_limit = 100; +# int loop_count = 0; +# do +# { +# loop_count++; +# do +# { +# loop_count++; +# // Always true. +# if (injectionSwitch.x < injectionSwitch.y) +# { +# return 1; +# } +# // Always true. +# if (injectionSwitch.x < injectionSwitch.y) +# { +# break; +# } +# } while (loop_count < loop_limit); +# } while (loop_count < loop_limit); +# return 0; +# } +# void main() +# { +# if(func() == 1) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(1.0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %65 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "loop_count" + OpName %28 "buf0" + OpMemberName %28 0 "injectionSwitch" + OpName %30 "" + OpName %65 "_GLF_color" + OpMemberDecorate %28 0 Offset 0 + OpDecorate %28 Block + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 0 + OpDecorate %65 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 0 + %18 = OpConstant %6 1 + %26 = OpTypeFloat 32 + %27 = OpTypeVector %26 2 + %28 = OpTypeStruct %27 + %29 = OpTypePointer Uniform %28 + %30 = OpVariable %29 Uniform + %31 = OpTypeInt 32 0 + %32 = OpConstant %31 0 + %33 = OpTypePointer Uniform %26 + %36 = OpConstant %31 1 + %39 = OpTypeBool + %53 = OpConstant %6 100 + %63 = OpTypeVector %26 4 + %64 = OpTypePointer Output %63 + %65 = OpVariable %64 Output + %66 = OpConstant %26 1 + %67 = OpConstant %26 0 + %68 = OpConstantComposite %63 %66 %67 %67 %66 + %70 = OpConstantComposite %63 %66 %66 %66 %66 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %59 = OpFunctionCall %6 %8 + %60 = OpIEqual %39 %59 %18 + OpSelectionMerge %62 None + OpBranchConditional %60 %61 %69 + %61 = OpLabel + OpStore %65 %68 + OpBranch %62 + %69 = OpLabel + OpStore %65 %70 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + OpStore %11 %12 + OpBranch %13 + %13 = OpLabel + %71 = OpPhi %6 %12 %9 %25 %16 + OpLoopMerge %15 %16 None + OpBranch %14 + %14 = OpLabel + %19 = OpIAdd %6 %71 %18 + OpStore %11 %19 + OpBranch %20 + %20 = OpLabel + %72 = OpPhi %6 %19 %14 %25 %23 + OpLoopMerge %22 %23 None + OpBranch %21 + %21 = OpLabel + %25 = OpIAdd %6 %72 %18 + OpStore %11 %25 + %34 = OpAccessChain %33 %30 %12 %32 + %35 = OpLoad %26 %34 + %37 = OpAccessChain %33 %30 %12 %36 + %38 = OpLoad %26 %37 + %40 = OpFOrdLessThan %39 %35 %38 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %42 + %41 = OpLabel + OpReturnValue %18 + %42 = OpLabel + %44 = OpAccessChain %33 %30 %12 %32 + %45 = OpLoad %26 %44 + %46 = OpAccessChain %33 %30 %12 %36 + %47 = OpLoad %26 %46 + %48 = OpFOrdLessThan %39 %45 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %49 %50 + %49 = OpLabel + OpBranch %22 + %50 = OpLabel + OpBranch %23 + %23 = OpLabel + %54 = OpSLessThan %39 %25 %53 + OpBranchConditional %54 %20 %22 + %22 = OpLabel + OpBranch %16 + %16 = OpLabel + %56 = OpSLessThan %39 %25 %53 + OpBranchConditional %56 %13 %15 + %15 = OpLabel + OpReturnValue %12 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/do-while-loop-in-conditionals.amber b/vulkan/amber/graphicsfuzz/do-while-loop-in-conditionals.amber new file mode 100644 index 0000000..4257bd1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/do-while-loop-in-conditionals.amber @@ -0,0 +1,130 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with do-while loop in conditional nest + +# The test passes because the fragment shader writes red, and the +# do-while loop is not dynamically reachable. + +# Derived from the following GLSL. + +# Fragment shader GLSL: +# #version 310 es +# +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# if(true) +# { +# if(gl_FragCoord.x < 0.0) +# { +# do +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# while(gl_FragCoord.x < 0.0); +# } +# } +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %18 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %18 "gl_FragCoord" + OpDecorate %9 Location 0 + OpDecorate %18 BuiltIn FragCoord + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstant %6 0 + %12 = OpConstantComposite %7 %10 %11 %11 %10 + %13 = OpTypeBool + %14 = OpConstantTrue %13 + %17 = OpTypePointer Input %7 + %18 = OpVariable %17 Input + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 0 + %21 = OpTypePointer Input %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %9 %12 + OpSelectionMerge %16 None + OpBranchConditional %14 %15 %16 + %15 = OpLabel + %22 = OpAccessChain %21 %18 %20 + %23 = OpLoad %6 %22 + %24 = OpFOrdLessThan %13 %23 %11 + OpSelectionMerge %26 None + OpBranchConditional %24 %25 %26 + %25 = OpLabel + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %28 + %28 = OpLabel + OpStore %9 %12 + OpBranch %30 + %30 = OpLabel + %31 = OpAccessChain %21 %18 %20 + %32 = OpLoad %6 %31 + %33 = OpFOrdLessThan %13 %32 %11 + OpBranchConditional %33 %27 %29 + %29 = OpLabel + OpBranch %26 + %26 = OpLabel + OpBranch %16 + %16 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/do-while-with-always-true-if.amber b/vulkan/amber/graphicsfuzz/do-while-with-always-true-if.amber new file mode 100644 index 0000000..75c7208 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/do-while-with-always-true-if.amber @@ -0,0 +1,193 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with a do while that always returns + +# The test passes because the shader always writes the color red. The do while returns on first iteration. + +# Optimized using spirv-opt with the following arguments: +# '--redundancy-elimination' +# '--reduce-load-size' +# '--combine-access-chains' +# '--eliminate-dead-code-aggressive' +# '--eliminate-dead-branches' +# spirv-opt commit hash: 06407250a169c6a03b3765e86619075af1a8c187 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct _GLF_struct_12 +# { +# int count; +# }; +# +# bool puzzlelize(vec2 pos) +# { +# return true; +# } +# +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# +# vec2 grid; +# _GLF_struct_12 _GLF_struct_replacement_12; +# +# do +# { +# if (gl_FragCoord.y > -1.0) // Always true +# { +# return; +# } +# } while (_GLF_struct_replacement_12.count != 1); +# +# grid += vec2(1, _GLF_struct_replacement_12.count); +# vec2 position; +# position = grid; +# vec4(puzzlelize(position)); +# +# _GLF_color = vec4(1.0, 1.0, 1.0, 1.0); // This should not be reached +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %19 %28 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %12 "puzzlelize(vf2;" + OpName %11 "pos" + OpName %19 "_GLF_color" + OpName %28 "gl_FragCoord" + OpName %40 "_GLF_struct_12" + OpMemberName %40 0 "count" + OpName %42 "_GLF_struct_replacement_12" + OpName %49 "grid" + OpName %56 "position" + OpName %58 "param" + OpDecorate %19 Location 0 + OpDecorate %28 BuiltIn FragCoord + OpMemberDecorate %40 0 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeBool + %10 = OpTypeFunction %9 %8 + %14 = OpConstantTrue %9 + %17 = OpTypeVector %6 4 + %18 = OpTypePointer Output %17 + %19 = OpVariable %18 Output + %20 = OpConstant %6 1 + %21 = OpConstant %6 0 + %22 = OpConstantComposite %17 %20 %21 %21 %20 + %27 = OpTypePointer Input %17 + %28 = OpVariable %27 Input + %29 = OpTypeInt 32 0 + %30 = OpConstant %29 1 + %31 = OpTypePointer Input %6 + %34 = OpConstant %6 -1 + %39 = OpTypeInt 32 1 + %40 = OpTypeStruct %39 + %41 = OpTypePointer Function %40 + %43 = OpConstant %39 0 + %44 = OpTypePointer Function %39 + %47 = OpConstant %39 1 + %63 = OpConstantComposite %17 %20 %20 %20 %20 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %42 = OpVariable %41 Function + %49 = OpVariable %8 Function + %56 = OpVariable %8 Function + %58 = OpVariable %8 Function + OpStore %19 %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %24 + %24 = OpLabel + %32 = OpAccessChain %31 %28 %30 + %33 = OpLoad %6 %32 + %35 = OpFOrdGreaterThan %9 %33 %34 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %37 + %36 = OpLabel + OpReturn + %37 = OpLabel + OpBranch %26 + %26 = OpLabel + %45 = OpAccessChain %44 %42 %43 + %46 = OpLoad %39 %45 + %48 = OpINotEqual %9 %46 %47 + OpBranchConditional %48 %23 %25 + %25 = OpLabel + %51 = OpLoad %39 %45 + %52 = OpConvertSToF %6 %51 + %53 = OpCompositeConstruct %7 %20 %52 + %54 = OpLoad %7 %49 + %55 = OpFAdd %7 %54 %53 + OpStore %49 %55 + %57 = OpLoad %7 %49 + OpStore %56 %57 + %59 = OpLoad %7 %56 + OpStore %58 %59 + %60 = OpFunctionCall %9 %12 %58 + OpStore %19 %63 + OpReturn + OpFunctionEnd + %12 = OpFunction %9 None %10 + %11 = OpFunctionParameter %8 + %13 = OpLabel + OpReturnValue %14 + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/do-while-with-if-condition.amber b/vulkan/amber/graphicsfuzz/do-while-with-if-condition.amber new file mode 100644 index 0000000..16f16ae --- /dev/null +++ b/vulkan/amber/graphicsfuzz/do-while-with-if-condition.amber @@ -0,0 +1,208 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader that has nested if condition in do while + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-code-aggressive' +# '--copy-propagate-arrays' +# '--copy-propagate-arrays' +# '--vector-dce' +# '--redundancy-elimination' +# '--eliminate-local-single-block' +# '--redundancy-elimination' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--merge-return' +# '--combine-access-chains' +# '--redundancy-elimination' +# '--private-to-local' +# '--simplify-instructions' +# '--ccp' +# '--eliminate-local-multi-store' +# '--inline-entry-points-exhaustive' +# '--if-conversion' +# '--eliminate-dead-inserts' +# spirv-opt commit hash: ab7ac60f14ae66006bed5c989a2cfd4c4881704c + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float one() +# { +# return 1.0; +# } +# +# void main() +# { +# vec2 v = vec2(0); +# bool alwaysFalse = gl_FragCoord.x < -1.0; +# +# do +# { +# if (v.x < 2.0) // Always true +# { +# if (!alwaysFalse) +# v[int(one())] = 1.0; +# } +# } while (alwaysFalse); +# +# if (v[0] == 0.0 && v[1] == 1.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 72 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %23 %64 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "one(" + OpName %15 "v" + OpName %20 "alwaysFalse" + OpName %23 "gl_FragCoord" + OpName %64 "_GLF_color" + OpDecorate %23 BuiltIn FragCoord + OpDecorate %64 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpConstant %6 1 + %13 = OpTypeVector %6 2 + %14 = OpTypePointer Function %13 + %16 = OpConstant %6 0 + %17 = OpConstantComposite %13 %16 %16 + %18 = OpTypeBool + %19 = OpTypePointer Function %18 + %21 = OpTypeVector %6 4 + %22 = OpTypePointer Input %21 + %23 = OpVariable %22 Input + %24 = OpTypeInt 32 0 + %25 = OpConstant %24 0 + %26 = OpTypePointer Input %6 + %29 = OpConstant %6 -1 + %35 = OpTypePointer Function %6 + %38 = OpConstant %6 2 + %47 = OpTypeInt 32 1 + %56 = OpConstant %24 1 + %63 = OpTypePointer Output %21 + %64 = OpVariable %63 Output + %65 = OpConstantComposite %21 %10 %16 %16 %10 + %67 = OpConstantComposite %21 %16 %16 %16 %16 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %71 = OpVariable %35 Function + %15 = OpVariable %14 Function + %20 = OpVariable %19 Function + OpStore %15 %17 + %27 = OpAccessChain %26 %23 %25 + %28 = OpLoad %6 %27 + %30 = OpFOrdLessThan %18 %28 %29 + OpStore %20 %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %32 + %32 = OpLabel + %36 = OpAccessChain %35 %15 %25 + %37 = OpLoad %6 %36 + %39 = OpFOrdLessThan %18 %37 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %41 + %40 = OpLabel + %43 = OpLogicalNot %18 %30 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %45 + %44 = OpLabel + OpStore %71 %10 + %46 = OpLoad %6 %71 + %48 = OpConvertFToS %47 %46 + %49 = OpAccessChain %35 %15 %48 + OpStore %49 %10 + OpBranch %45 + %45 = OpLabel + OpBranch %41 + %41 = OpLabel + OpBranch %34 + %34 = OpLabel + OpBranchConditional %30 %31 %33 + %33 = OpLabel + %52 = OpLoad %6 %36 + %53 = OpFOrdEqual %18 %52 %16 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %55 + %54 = OpLabel + %57 = OpAccessChain %35 %15 %56 + %58 = OpLoad %6 %57 + %59 = OpFOrdEqual %18 %58 %10 + OpBranch %55 + %55 = OpLabel + %60 = OpPhi %18 %53 %33 %59 %54 + OpSelectionMerge %62 None + OpBranchConditional %60 %61 %66 + %61 = OpLabel + OpStore %64 %65 + OpBranch %62 + %66 = OpLabel + OpStore %64 %67 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + OpReturnValue %10 + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/early-return-and-barrier.amber b/vulkan/amber/graphicsfuzz/early-return-and-barrier.amber new file mode 100644 index 0000000..1fc571c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/early-return-and-barrier.amber @@ -0,0 +1,148 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# Short description: A compute shader with an early return and a barrier + +# Checks that the output value is 42. +# Passes because main always writes 42 to out_data. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a2ef7be242bcacaa9127a3ce011602ec54b2c9ed + +# Derived from the following GLSL. + +# Compute shader GLSL: +# #version 310 es +# +# precision highp float; +# +# layout(std430, binding = 0) buffer theSSBO { +# int out_data; +# }; +# +# layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +# void f(vec2 v) +# { +# if(1.0 < v.x) +# { +# return; +# } +# barrier(); +# } +# void main() +# { +# out_data = 42; +# mat2 m; +# for(int i = 1; i > 0; i --) +# { +# m = mat2(1.0); +# } +# f(vec2(1.0) * (m - mat2(1.0))); +# } + +[compute shader spirv] +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 87 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %4 "main" + OpExecutionMode %4 LocalSize 1 1 1 + OpSource ESSL 310 + OpName %4 "main" + OpName %27 "theSSBO" + OpMemberName %27 0 "out_data" + OpName %29 "" + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 BufferBlock + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %13 = OpConstant %6 1 + %14 = OpTypeInt 32 0 + %19 = OpTypeBool + %24 = OpConstant %14 2 + %25 = OpConstant %14 264 + %26 = OpTypeInt 32 1 + %27 = OpTypeStruct %26 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %30 = OpConstant %26 0 + %31 = OpConstant %26 42 + %32 = OpTypePointer Uniform %26 + %36 = OpConstant %26 1 + %44 = OpTypeMatrix %7 2 + %47 = OpConstant %6 0 + %48 = OpConstantComposite %7 %13 %47 + %49 = OpConstantComposite %7 %47 %13 + %50 = OpConstantComposite %44 %48 %49 + %53 = OpConstantComposite %7 %13 %13 + %86 = OpUndef %44 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %33 = OpAccessChain %32 %29 %30 + OpStore %33 %31 + OpBranch %37 + %37 = OpLabel + %85 = OpPhi %44 %86 %5 %50 %38 + %84 = OpPhi %26 %36 %5 %52 %38 + %43 = OpSGreaterThan %19 %84 %30 + OpLoopMerge %39 %38 None + OpBranchConditional %43 %38 %39 + %38 = OpLabel + %52 = OpISub %26 %84 %36 + OpBranch %37 + %39 = OpLabel + %55 = OpCompositeExtract %7 %85 0 + %57 = OpFSub %7 %55 %48 + %58 = OpCompositeExtract %7 %85 1 + %60 = OpFSub %7 %58 %49 + %61 = OpCompositeConstruct %44 %57 %60 + %62 = OpVectorTimesMatrix %7 %53 %61 + OpBranch %74 + %74 = OpLabel + OpLoopMerge %75 %76 None + OpBranch %77 + %77 = OpLabel + %79 = OpCompositeExtract %6 %62 0 + %80 = OpFOrdLessThan %19 %13 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + OpBranch %75 + %81 = OpLabel + OpControlBarrier %24 %24 %25 + OpBranch %75 + %76 = OpLabel + OpBranch %74 + %75 = OpLabel + OpReturn + OpFunctionEnd + + +[test] +## SSBO +ssbo 0 subdata int 0 0 + +compute 1 1 1 +probe ssbo int 0 0 == 42 diff --git a/vulkan/amber/graphicsfuzz/find-msb-from-lsb.amber b/vulkan/amber/graphicsfuzz/find-msb-from-lsb.amber new file mode 100644 index 0000000..47b9ea4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/find-msb-from-lsb.amber @@ -0,0 +1,191 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader that finds MSB from LSB + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // State of variables/expressions after "result += x;". +# // +# // i x i >> x findLSB findMSB result +# // 0 0 0 -1 -1 0 +# // 0 1 0 -1 -1 1 +# // 1 0 1 0 -1 1 +# // 1 1 0 -1 -1 2 +# +# int result = 0; +# for (int i = 0; i < 2; i++) +# { +# for (int x = 0; x < 2; x++) +# { +# // findMSB(findLSB(i >> x)) is always -1. +# for ( ; x > findMSB(findLSB(i >> x)) && x < 2; x++) +# { +# result += x; +# } +# } +# } +# if (result == 2) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 66 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %60 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "result" + OpName %10 "i" + OpName %20 "x" + OpName %60 "_GLF_color" + OpDecorate %60 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpConstant %6 2 + %18 = OpTypeBool + %47 = OpConstant %6 1 + %57 = OpTypeFloat 32 + %58 = OpTypeVector %57 4 + %59 = OpTypePointer Output %58 + %60 = OpVariable %59 Output + %61 = OpConstant %57 1 + %62 = OpConstant %57 0 + %63 = OpConstantComposite %58 %61 %62 %62 %61 + %65 = OpConstantComposite %58 %62 %62 %62 %61 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %20 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %16 = OpLoad %6 %10 + %19 = OpSLessThan %18 %16 %17 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + OpStore %20 %9 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %6 %20 + %27 = OpSLessThan %18 %26 %17 + OpBranchConditional %27 %22 %23 + %22 = OpLabel + OpBranch %28 + %28 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %10 + %35 = OpLoad %6 %20 + %36 = OpShiftRightArithmetic %6 %34 %35 + %37 = OpExtInst %6 %1 FindILsb %36 + %38 = OpExtInst %6 %1 FindSMsb %37 + %39 = OpSGreaterThan %18 %33 %38 + %40 = OpLoad %6 %20 + %41 = OpSLessThan %18 %40 %17 + %42 = OpLogicalAnd %18 %39 %41 + OpBranchConditional %42 %29 %30 + %29 = OpLabel + %43 = OpLoad %6 %20 + %44 = OpLoad %6 %8 + %45 = OpIAdd %6 %44 %43 + OpStore %8 %45 + OpBranch %31 + %31 = OpLabel + %46 = OpLoad %6 %20 + %48 = OpIAdd %6 %46 %47 + OpStore %20 %48 + OpBranch %28 + %30 = OpLabel + OpBranch %24 + %24 = OpLabel + %49 = OpLoad %6 %20 + %50 = OpIAdd %6 %49 %47 + OpStore %20 %50 + OpBranch %21 + %23 = OpLabel + OpBranch %14 + %14 = OpLabel + %51 = OpLoad %6 %10 + %52 = OpIAdd %6 %51 %47 + OpStore %10 %52 + OpBranch %11 + %13 = OpLabel + %53 = OpLoad %6 %8 + %54 = OpIEqual %18 %53 %17 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %64 + %55 = OpLabel + OpStore %60 %63 + OpBranch %56 + %64 = OpLabel + OpStore %60 %65 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/flag-always-false-if.amber b/vulkan/amber/graphicsfuzz/flag-always-false-if.amber new file mode 100644 index 0000000..2ac9cef --- /dev/null +++ b/vulkan/amber/graphicsfuzz/flag-always-false-if.amber @@ -0,0 +1,299 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: A fragment shader with recurrent always false if statement + +# The test passes because the shader always writes color red. + +# Optimized using spirv-opt with the following arguments: +# '--vector-dce' +# '--vector-dce' +# '--scalar-replacement=100' +# '--redundancy-elimination' +# '--redundancy-elimination' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--scalar-replacement=100' +# '--reduce-load-size' +# '--copy-propagate-arrays' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-code-aggressive' +# '--inline-entry-points-exhaustive' +# '--simplify-instructions' +# '--redundancy-elimination' +# '--ccp' +# '--eliminate-local-single-block' +# '--scalar-replacement=100' +# '--reduce-load-size' +# '--eliminate-local-single-block' +# '--reduce-load-size' +# '--eliminate-local-single-store' +# '--inline-entry-points-exhaustive' +# spirv-opt commit hash: 230f363e6da32791f640b02205e0645cc67c3f1d + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; // x == 0.0, y == 1.0 +# }; +# void main() +# { +# const int loop_limit = 100; +# int loop_count = 0; +# // Always false. +# if (injectionSwitch.x > injectionSwitch.y) +# { +# return; +# } +# // Always false. +# gl_FragCoord.x < log(1.0); +# for (; loop_count < loop_limit; loop_count++) +# { +# // Always false. +# if (injectionSwitch.x > injectionSwitch.y) +# { +# break; +# } +# // Always false. +# if (injectionSwitch.x > injectionSwitch.y) +# { +# _GLF_color = vec4(1.0); +# } +# else +# { +# // Always false. +# if (gl_FragCoord.x < 0.0) +# { +# return; +# } +# } +# // Always false. +# if (injectionSwitch.x > injectionSwitch.y) +# { +# _GLF_color = vec4(1.0); +# } +# else +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# // Always false. +# if (injectionSwitch.x > injectionSwitch.y) +# { +# return; +# } +# // Always false. +# if (gl_FragCoord.x < 0.0) +# { +# for (; loop_count < loop_limit; loop_count++) +# { +# } +# } +# } +# if(loop_count >= loop_limit) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(1.0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 109 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %30 %60 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "loop_count" + OpName %12 "buf0" + OpMemberName %12 0 "injectionSwitch" + OpName %14 "" + OpName %30 "gl_FragCoord" + OpName %60 "_GLF_color" + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %30 BuiltIn FragCoord + OpDecorate %60 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 2 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %10 + %20 = OpConstant %15 1 + %23 = OpTypeBool + %28 = OpTypeVector %10 4 + %29 = OpTypePointer Input %28 + %30 = OpVariable %29 Input + %31 = OpTypePointer Input %10 + %34 = OpConstant %10 0 + %42 = OpConstant %6 100 + %59 = OpTypePointer Output %28 + %60 = OpVariable %59 Output + %61 = OpConstant %10 1 + %62 = OpConstantComposite %28 %61 %61 %61 %61 + %78 = OpConstantComposite %28 %61 %34 %34 %61 + %100 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %18 = OpAccessChain %17 %14 %9 %16 + %19 = OpLoad %10 %18 + %21 = OpAccessChain %17 %14 %9 %20 + %22 = OpLoad %10 %21 + %24 = OpFOrdGreaterThan %23 %19 %22 + OpSelectionMerge %26 None + OpBranchConditional %24 %25 %26 + %25 = OpLabel + OpReturn + %26 = OpLabel + %32 = OpAccessChain %31 %30 %16 + %33 = OpLoad %10 %32 + %35 = OpFOrdLessThan %23 %33 %34 + OpBranch %36 + %36 = OpLabel + %41 = OpLoad %6 %8 + %43 = OpSLessThan %23 %41 %42 + OpLoopMerge %38 %39 None + OpBranchConditional %43 %37 %38 + %37 = OpLabel + OpSelectionMerge %50 None + OpBranchConditional %24 %49 %50 + %49 = OpLabel + OpBranch %38 + %50 = OpLabel + OpSelectionMerge %58 None + OpBranchConditional %24 %57 %63 + %57 = OpLabel + OpStore %60 %62 + OpBranch %58 + %63 = OpLabel + OpSelectionMerge %68 None + OpBranchConditional %35 %67 %68 + %67 = OpLabel + OpReturn + %68 = OpLabel + OpBranch %58 + %58 = OpLabel + OpSelectionMerge %76 None + OpBranchConditional %24 %75 %77 + %75 = OpLabel + OpStore %60 %62 + OpBranch %76 + %77 = OpLabel + OpStore %60 %78 + OpBranch %76 + %76 = OpLabel + OpSelectionMerge %85 None + OpBranchConditional %24 %84 %85 + %84 = OpLabel + OpReturn + %85 = OpLabel + OpSelectionMerge %91 None + OpBranchConditional %35 %90 %91 + %90 = OpLabel + OpBranch %92 + %92 = OpLabel + %97 = OpLoad %6 %8 + %98 = OpSLessThan %23 %97 %42 + OpLoopMerge %94 %93 None + OpBranchConditional %98 %93 %94 + %93 = OpLabel + %99 = OpLoad %6 %8 + %101 = OpIAdd %6 %99 %100 + OpStore %8 %101 + OpBranch %92 + %94 = OpLabel + OpBranch %91 + %91 = OpLabel + OpBranch %39 + %39 = OpLabel + %102 = OpLoad %6 %8 + %103 = OpIAdd %6 %102 %100 + OpStore %8 %103 + OpBranch %36 + %38 = OpLabel + %104 = OpLoad %6 %8 + %105 = OpSGreaterThanEqual %23 %104 %42 + OpSelectionMerge %107 None + OpBranchConditional %105 %106 %108 + %106 = OpLabel + OpStore %60 %78 + OpBranch %107 + %108 = OpLabel + OpStore %60 %62 + OpBranch %107 + %107 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/for-condition-always-false.amber b/vulkan/amber/graphicsfuzz/for-condition-always-false.amber new file mode 100644 index 0000000..f451f9b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/for-condition-always-false.amber @@ -0,0 +1,150 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with a for loop condition being always false + +# An always false condition is passed to a for loop inside a function. The test passes if red color is written after the for loop. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-code-aggressive' +# '--eliminate-local-single-block' +# '--private-to-local' +# '--convert-local-access-chains' +# '--simplify-instructions' +# '--eliminate-dead-inserts' +# '--copy-propagate-arrays' +# '--simplify-instructions' +# '--eliminate-dead-code-aggressive' +# '--eliminate-local-multi-store' +# spirv-opt commit hash: 9559cdbdf011c487f67f89e2d694bd4a18d5c1e0 + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# layout(location=0) out vec4 color; +# +# vec3 drawShape(vec2 pos) +# { +# bool c3; +# c3 = pos.y < 1.0; +# for( +# ivec2(8576, 72916); +# c3; +# bvec2(false, false) +# ) +# { +# return vec3(1.0); +# } +# return vec3(1.0); +# } +# void main() +# { +# drawShape(vec2(1.0)); +# color = vec4(1, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %12 "drawShape(vf2;" + OpName %11 "pos" + OpName %16 "c3" + OpName %43 "param" + OpName %47 "color" + OpDecorate %47 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeVector %6 3 + %10 = OpTypeFunction %9 %8 + %14 = OpTypeBool + %15 = OpTypePointer Function %14 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 1 + %19 = OpTypePointer Function %6 + %22 = OpConstant %6 1 + %35 = OpConstantComposite %9 %22 %22 %22 + %42 = OpConstantComposite %7 %22 %22 + %45 = OpTypeVector %6 4 + %46 = OpTypePointer Output %45 + %47 = OpVariable %46 Output + %48 = OpConstant %6 0 + %49 = OpConstantComposite %45 %22 %48 %48 %22 + %51 = OpUndef %14 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %43 = OpVariable %8 Function + OpStore %43 %42 + %44 = OpFunctionCall %9 %12 %43 + OpStore %47 %49 + OpReturn + OpFunctionEnd + %12 = OpFunction %9 None %10 + %11 = OpFunctionParameter %8 + %13 = OpLabel + %16 = OpVariable %15 Function + %20 = OpAccessChain %19 %11 %18 + %21 = OpLoad %6 %20 + %23 = OpFOrdLessThan %14 %21 %22 + OpStore %16 %23 + OpBranch %29 + %29 = OpLabel + %50 = OpPhi %14 %23 %13 %51 %32 + OpLoopMerge %31 %32 None + OpBranchConditional %50 %30 %31 + %30 = OpLabel + OpReturnValue %35 + %32 = OpLabel + OpBranch %29 + %31 = OpLabel + OpReturnValue %35 + OpFunctionEnd +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/for-loop-with-return.amber b/vulkan/amber/graphicsfuzz/for-loop-with-return.amber new file mode 100644 index 0000000..2cd5a32 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/for-loop-with-return.amber @@ -0,0 +1,148 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with a for loop that loops only once + +# The test passes because the shader always writes the color red. The for loop only goes through once. + +# Optimized using spirv-opt with the following arguments: +# '--vector-dce' +# '--eliminate-local-multi-store' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--ccp' +# '--eliminate-dead-inserts' +# '--convert-local-access-chains' +# '--vector-dce' +# '--eliminate-dead-code-aggressive' +# '--vector-dce' +# '--eliminate-local-multi-store' +# '--if-conversion' +# '--eliminate-dead-branches' +# spirv-opt commit hash: 06407250a169c6a03b3765e86619075af1a8c187 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 mand() +# { +# do +# { +# return vec3(1.0); +# } while (true); +# } +# void main() +# { +# mand(); +# +# for ( +# int i = 1; +# true; +# 1) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# return; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "mand(" + OpName %33 "_GLF_color" + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeFunction %7 + %15 = OpConstant %6 1 + %16 = OpConstantComposite %7 %15 %15 %15 + %31 = OpTypeVector %6 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpConstant %6 0 + %35 = OpConstantComposite %31 %15 %34 %34 %15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %21 = OpFunctionCall %7 %9 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %27 + %27 = OpLabel + OpStore %33 %35 + OpReturn + %29 = OpLabel + OpBranch %26 + %28 = OpLabel + OpUnreachable + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + OpBranch %11 + %11 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %12 + %12 = OpLabel + OpReturnValue %16 + %14 = OpLabel + OpBranch %11 + %13 = OpLabel + OpUnreachable + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/for-with-ifs-and-return.amber b/vulkan/amber/graphicsfuzz/for-with-ifs-and-return.amber new file mode 100644 index 0000000..30510af --- /dev/null +++ b/vulkan/amber/graphicsfuzz/for-with-ifs-and-return.amber @@ -0,0 +1,154 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with two ifs and return/continue inside a for loop + +# The test passes because the shader always writes the color red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# for( +# int i = 1; +# i < 2; +# ++i +# ) +# { +# if(gl_FragCoord.y < 0.0) +# { +# if(gl_FragCoord.x < 0.0) +# { +# _GLF_color = vec4(226.696, 1.0, 1.0, 1.0); +# } +# continue; +# } +# return; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %27 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %15 "i" + OpName %27 "gl_FragCoord" + OpDecorate %9 Location 0 + OpDecorate %15 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %27 BuiltIn FragCoord + OpDecorate %46 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstant %6 0 + %12 = OpConstantComposite %7 %10 %11 %11 %10 + %13 = OpTypeInt 32 1 + %14 = OpTypePointer Function %13 + %16 = OpConstant %13 1 + %23 = OpConstant %13 2 + %24 = OpTypeBool + %26 = OpTypePointer Input %7 + %27 = OpVariable %26 Input + %28 = OpTypeInt 32 0 + %29 = OpConstant %28 1 + %30 = OpTypePointer Input %6 + %36 = OpConstant %28 0 + %42 = OpConstant %6 226.695999 + %43 = OpConstantComposite %7 %42 %10 %10 %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %15 = OpVariable %14 Function + OpStore %9 %12 + OpStore %15 %16 + OpBranch %17 + %17 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + %22 = OpLoad %13 %15 + %25 = OpSLessThan %24 %22 %23 + OpBranchConditional %25 %18 %19 + %18 = OpLabel + %31 = OpAccessChain %30 %27 %29 + %32 = OpLoad %6 %31 + %33 = OpFOrdLessThan %24 %32 %11 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %35 + %34 = OpLabel + %37 = OpAccessChain %30 %27 %36 + %38 = OpLoad %6 %37 + %39 = OpFOrdLessThan %24 %38 %11 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %41 + %40 = OpLabel + OpStore %9 %43 + OpBranch %41 + %41 = OpLabel + OpBranch %20 + %35 = OpLabel + OpReturn + %20 = OpLabel + %46 = OpLoad %13 %15 + %47 = OpIAdd %13 %46 %16 + OpStore %15 %47 + OpBranch %17 + %19 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/frag-coord-func-call-and-ifs.amber b/vulkan/amber/graphicsfuzz/frag-coord-func-call-and-ifs.amber new file mode 100644 index 0000000..8992e20 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/frag-coord-func-call-and-ifs.amber @@ -0,0 +1,350 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with many uses of gl_FragCoord + +# The test passes because the shader always write red. + +# Optimized using spirv-opt with the following arguments: +# '--scalar-replacement=100' +# '--vector-dce' +# '--combine-access-chains' +# '--convert-local-access-chains' +# '--eliminate-dead-code-aggressive' +# '--private-to-local' +# '--combine-access-chains' +# '--reduce-load-size' +# '--eliminate-dead-inserts' +# '--combine-access-chains' +# '--eliminate-local-single-store' +# '--eliminate-local-single-block' +# '--inline-entry-points-exhaustive' +# '--combine-access-chains' +# spirv-opt commit hash: e95fbfb1f509ad7a7fdfb72ac35fe412d72fc4a4 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# // Always (0.0, 1.0). +# vec2 injectionSwitch; +# }; +# +# // coord is gl_FragCoord.xy. +# // Always returns 0. +# int alwaysZero(vec2 coord) +# { +# // injectionSwitch.y is 1.0. +# float a = coord.y < 50.0 ? injectionSwitch.y : 0.0; +# float b = gl_FragCoord.y < 50.0 ? 1.0 : 0.0; +# +# // a == b. Thus, the condition is always true. +# if (a - b < 1.0) +# { +# return 0; +# } +# return 1; +# } +# +# void main() +# { +# int zero = alwaysZero(gl_FragCoord.xy); +# +# // Always false. +# if (zero == 1) +# { +# return; +# } +# +# // All conditions below are true. +# // So _GLF_color will end up as red: (1.0, 0.0, 0.0, 1.0). +# _GLF_color = vec4(0.0, 1.0, 1.0, 1.0); +# +# // Always true. +# if (gl_FragCoord.x >= injectionSwitch.x) +# { +# // Always true. +# if (gl_FragCoord.y >= 0.0) +# { +# // _GLF_color.x = 1.0; +# _GLF_color.x = injectionSwitch.y; +# } +# } +# +# // Always true. +# if (gl_FragCoord.y >= 0.0) +# { +# // _GLF_color.y = 0.0; +# _GLF_color.y = injectionSwitch.x; +# } +# +# vec2 temp = vec2(gl_FragCoord.xy); +# +# // Always true. +# if (temp.y >= 0.0) +# { +# // _GLF_color.z = 0.0; +# _GLF_color.z = injectionSwitch.x; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 137 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %39 %68 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %12 "alwaysZero(vf2;" + OpName %11 "coord" + OpName %15 "a" + OpName %26 "buf0" + OpMemberName %26 0 "injectionSwitch" + OpName %28 "" + OpName %36 "b" + OpName %39 "gl_FragCoord" + OpName %57 "zero" + OpName %58 "param" + OpName %68 "_GLF_color" + OpName %95 "temp" + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 0 + OpDecorate %39 BuiltIn FragCoord + OpDecorate %68 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeInt 32 1 + %10 = OpTypeFunction %9 %8 + %14 = OpTypePointer Function %6 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 1 + %20 = OpConstant %6 50 + %21 = OpTypeBool + %26 = OpTypeStruct %7 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpConstant %9 0 + %30 = OpTypePointer Uniform %6 + %34 = OpConstant %6 0 + %37 = OpTypeVector %6 4 + %38 = OpTypePointer Input %37 + %39 = OpVariable %38 Input + %40 = OpTypePointer Input %6 + %44 = OpConstant %6 1 + %53 = OpConstant %9 1 + %56 = OpTypePointer Function %9 + %67 = OpTypePointer Output %37 + %68 = OpVariable %67 Output + %69 = OpConstantComposite %37 %34 %44 %44 %44 + %70 = OpConstant %16 0 + %85 = OpTypePointer Output %6 + %108 = OpConstant %16 2 + %136 = OpConstantFalse %21 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %111 = OpVariable %14 Function + %112 = OpVariable %14 Function + %113 = OpVariable %14 Function + %114 = OpVariable %56 Function + %57 = OpVariable %56 Function + %58 = OpVariable %8 Function + %95 = OpVariable %8 Function + %59 = OpLoad %37 %39 + %60 = OpVectorShuffle %7 %59 %59 0 1 + OpStore %58 %60 + OpBranch %115 + %115 = OpLabel + OpLoopMerge %116 %117 None + OpBranch %118 + %118 = OpLabel + %119 = OpAccessChain %14 %58 %17 + %120 = OpLoad %6 %119 + %121 = OpFOrdLessThan %21 %120 %20 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + %125 = OpAccessChain %30 %28 %29 %17 + %126 = OpLoad %6 %125 + OpStore %112 %126 + OpBranch %122 + %124 = OpLabel + OpStore %112 %34 + OpBranch %122 + %122 = OpLabel + %127 = OpLoad %6 %112 + OpStore %111 %127 + %128 = OpAccessChain %40 %39 %17 + %129 = OpLoad %6 %128 + %130 = OpFOrdLessThan %21 %129 %20 + %131 = OpSelect %6 %130 %44 %34 + OpStore %113 %131 + %132 = OpFSub %6 %127 %131 + %133 = OpFOrdLessThan %21 %132 %44 + OpSelectionMerge %134 None + OpBranchConditional %133 %135 %134 + %135 = OpLabel + OpStore %114 %29 + OpBranch %116 + %134 = OpLabel + OpStore %114 %53 + OpBranch %116 + %117 = OpLabel + OpBranchConditional %136 %115 %116 + %116 = OpLabel + %61 = OpLoad %9 %114 + OpStore %57 %61 + %63 = OpIEqual %21 %61 %53 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %65 + %64 = OpLabel + OpReturn + %65 = OpLabel + OpStore %68 %69 + %71 = OpAccessChain %40 %39 %70 + %72 = OpLoad %6 %71 + %73 = OpAccessChain %30 %28 %29 %70 + %74 = OpLoad %6 %73 + %75 = OpFOrdGreaterThanEqual %21 %72 %74 + OpSelectionMerge %77 None + OpBranchConditional %75 %76 %77 + %76 = OpLabel + %78 = OpAccessChain %40 %39 %17 + %79 = OpLoad %6 %78 + %80 = OpFOrdGreaterThanEqual %21 %79 %34 + OpSelectionMerge %82 None + OpBranchConditional %80 %81 %82 + %81 = OpLabel + %83 = OpAccessChain %30 %28 %29 %17 + %84 = OpLoad %6 %83 + %86 = OpAccessChain %85 %68 %70 + OpStore %86 %84 + OpBranch %82 + %82 = OpLabel + OpBranch %77 + %77 = OpLabel + %87 = OpAccessChain %40 %39 %17 + %88 = OpLoad %6 %87 + %89 = OpFOrdGreaterThanEqual %21 %88 %34 + OpSelectionMerge %91 None + OpBranchConditional %89 %90 %91 + %90 = OpLabel + %92 = OpAccessChain %30 %28 %29 %70 + %93 = OpLoad %6 %92 + %94 = OpAccessChain %85 %68 %17 + OpStore %94 %93 + OpBranch %91 + %91 = OpLabel + %96 = OpLoad %37 %39 + %97 = OpVectorShuffle %7 %96 %96 0 1 + %98 = OpCompositeExtract %6 %97 0 + %99 = OpCompositeExtract %6 %97 1 + %100 = OpCompositeConstruct %7 %98 %99 + OpStore %95 %100 + %102 = OpCompositeExtract %6 %100 1 + %103 = OpFOrdGreaterThanEqual %21 %102 %34 + OpSelectionMerge %105 None + OpBranchConditional %103 %104 %105 + %104 = OpLabel + %106 = OpAccessChain %30 %28 %29 %70 + %107 = OpLoad %6 %106 + %109 = OpAccessChain %85 %68 %108 + OpStore %109 %107 + OpBranch %105 + %105 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %9 None %10 + %11 = OpFunctionParameter %8 + %13 = OpLabel + %15 = OpVariable %14 Function + %23 = OpVariable %14 Function + %36 = OpVariable %14 Function + %18 = OpAccessChain %14 %11 %17 + %19 = OpLoad %6 %18 + %22 = OpFOrdLessThan %21 %19 %20 + OpSelectionMerge %25 None + OpBranchConditional %22 %24 %33 + %24 = OpLabel + %31 = OpAccessChain %30 %28 %29 %17 + %32 = OpLoad %6 %31 + OpStore %23 %32 + OpBranch %25 + %33 = OpLabel + OpStore %23 %34 + OpBranch %25 + %25 = OpLabel + %35 = OpLoad %6 %23 + OpStore %15 %35 + %41 = OpAccessChain %40 %39 %17 + %42 = OpLoad %6 %41 + %43 = OpFOrdLessThan %21 %42 %20 + %45 = OpSelect %6 %43 %44 %34 + OpStore %36 %45 + %48 = OpFSub %6 %35 %45 + %49 = OpFOrdLessThan %21 %48 %44 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %51 + %50 = OpLabel + OpReturnValue %29 + %51 = OpLabel + OpReturnValue %53 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/fragcoord-control-flow-2.amber b/vulkan/amber/graphicsfuzz/fragcoord-control-flow-2.amber new file mode 100644 index 0000000..d935b17 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/fragcoord-control-flow-2.amber @@ -0,0 +1,186 @@ +#!amber + +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# A fragment shader that uses FragCoord and somewhat complex control flow. +# Derived from the following GLSL fragment shader. +# We check that all pixels are red. The test passes because _GLF_color is +# initially set to red, all other writes to _GLF_color write red, and the discard +# statement only executes for pixels with an x coordinate >= 10000000. + +# #version 310 es +# +# precision highp float; +# precision highp int; +# +# layout(location=0) out vec4 _GLF_color; +# +# void main() { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# for (int i = 0; i < 1; i++) { +# if (int(gl_FragCoord.x) < 10000000) { +# } else { +# +# if (int(gl_FragCoord.x) < 10000000) { +# +# for (int j = 0; j < 1; j++) { +# for (int k = 0; k < 1; k++) { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# } +# vec4 backup; +# for (int l = 0; l < 1; l++) { +# backup = vec4(1.0, 0.0, 0.0, 1.0); +# } +# _GLF_color = backup; +# } else { +# discard; +# } +# } +# } +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft + OpSource ESSL 310 + OpName %2 "main" + OpName %3 "_GLF_color" + OpName %4 "gl_FragCoord" + OpDecorate %3 Location 0 + OpDecorate %4 BuiltIn FragCoord + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeFloat 32 + %8 = OpTypeVector %7 4 + %9 = OpTypePointer Output %8 + %3 = OpVariable %9 Output + %10 = OpConstant %7 1 + %11 = OpConstant %7 0 + %12 = OpConstantComposite %8 %10 %11 %11 %10 + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 0 + %15 = OpConstant %13 1 + %16 = OpTypeBool + %17 = OpTypePointer Input %8 + %4 = OpVariable %17 Input + %18 = OpTypeInt 32 0 + %19 = OpConstant %18 0 + %20 = OpTypePointer Input %7 + %21 = OpConstant %13 10000000 + %22 = OpUndef %8 + %2 = OpFunction %5 None %6 + %23 = OpLabel + OpStore %3 %12 + OpBranch %24 + %24 = OpLabel + %25 = OpPhi %8 %22 %23 %26 %27 + %28 = OpPhi %13 %14 %23 %29 %27 + %30 = OpSLessThan %16 %28 %15 + OpLoopMerge %31 %27 None + OpBranchConditional %30 %32 %31 + %32 = OpLabel + %33 = OpAccessChain %20 %4 %19 + %34 = OpLoad %7 %33 + %35 = OpConvertFToS %13 %34 + %36 = OpSLessThan %16 %35 %21 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpBranch %27 + %39 = OpLabel + OpSelectionMerge %40 None + OpBranchConditional %36 %41 %42 + %41 = OpLabel + OpBranch %43 + %43 = OpLabel + %44 = OpPhi %13 %14 %41 %45 %46 + %47 = OpSLessThan %16 %44 %15 + OpLoopMerge %48 %46 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + OpBranch %50 + %50 = OpLabel + %51 = OpPhi %13 %14 %49 %52 %53 + %54 = OpSLessThan %16 %51 %15 + OpLoopMerge %55 %53 None + OpBranchConditional %54 %53 %55 + %53 = OpLabel + OpStore %3 %12 + %52 = OpIAdd %13 %51 %15 + OpBranch %50 + %55 = OpLabel + OpBranch %46 + %46 = OpLabel + %45 = OpIAdd %13 %44 %15 + OpBranch %43 + %48 = OpLabel + OpBranch %56 + %56 = OpLabel + %57 = OpPhi %8 %25 %48 %12 %58 + %59 = OpPhi %13 %14 %48 %60 %58 + %61 = OpSLessThan %16 %59 %15 + OpLoopMerge %62 %58 None + OpBranchConditional %61 %58 %62 + %58 = OpLabel + %60 = OpIAdd %13 %59 %15 + OpBranch %56 + %62 = OpLabel + OpStore %3 %57 + OpBranch %40 + %42 = OpLabel + OpTerminateInvocation + %40 = OpLabel + OpBranch %27 + %37 = OpLabel + OpBranch %27 + %27 = OpLabel + %26 = OpPhi %8 %25 %38 %57 %40 %22 %37 + %29 = OpIAdd %13 %28 %15 + OpBranch %24 + %31 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/fragcoord-control-flow.amber b/vulkan/amber/graphicsfuzz/fragcoord-control-flow.amber new file mode 100644 index 0000000..34aa473 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/fragcoord-control-flow.amber @@ -0,0 +1,327 @@ +#!amber + +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# A fragment shader that uses FragCoord and somewhat complex control flow. +# Derived from the following GLSL fragment shader. +# We check that the top-left pixel is red. The test passes because _GLF_color is +# initially set to red, all other writes to _GLF_color write red, and the discard +# statement only executes for pixels with an x coordinate >= 180. + +# #version 310 es +# +# precision highp float; +# precision highp int; +# +# layout(location=0) out vec4 _GLF_color; +# +# void main() { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# for (int i = 0; i < 1; i++) { +# if (1.0 < gl_FragCoord.x) { +# break; +# } +# if (gl_FragCoord.x < 0.0) { +# return; +# } +# } +# do { +# if (gl_FragCoord.x < 40.0) { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } else { +# if (gl_FragCoord.x < 140.0) { +# } else { +# for (int j = 1; j > 0; j--) { +# if (gl_FragCoord.x < 160.0) { +# for (int k = 1; k > 0; k--) { +# if (gl_FragCoord.y < 0.0) { +# } else { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# } +# } else { +# if (gl_FragCoord.x < 180.0) { +# for (int l = 1; l != 0; l--) { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# } else { +# if (gl_FragCoord.x < 180.0) { +# for (int m = 0; m != 1; m++) { +# for (int n = 0; n < 1; n++) { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# } +# vec4 backup; +# for (int o = 1; o != 0; o--) { +# backup = vec4(1.0, 0.0, 0.0, 1.0); +# } +# _GLF_color = backup; +# } else { +# discard; +# } +# } +# } +# } +# } +# return; +# } +# } while (false); +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 125 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft + OpSource ESSL 310 + OpName %2 "main" + OpName %3 "_GLF_color" + OpName %4 "gl_FragCoord" + OpDecorate %3 Location 0 + OpDecorate %4 BuiltIn FragCoord + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeFloat 32 + %8 = OpTypeVector %7 4 + %9 = OpTypePointer Output %8 + %3 = OpVariable %9 Output + %10 = OpConstant %7 1 + %11 = OpConstant %7 0 + %12 = OpConstantComposite %8 %10 %11 %11 %10 + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 0 + %15 = OpConstant %13 1 + %16 = OpTypeBool + %17 = OpTypePointer Input %8 + %4 = OpVariable %17 Input + %18 = OpTypeInt 32 0 + %19 = OpConstant %18 0 + %20 = OpTypePointer Input %7 + %21 = OpConstant %7 40 + %22 = OpConstant %7 140 + %23 = OpConstant %7 160 + %24 = OpConstant %18 1 + %25 = OpConstant %7 180 + %26 = OpConstantFalse %16 + %27 = OpConstantTrue %16 + %28 = OpUndef %8 + %2 = OpFunction %5 None %6 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel + OpStore %3 %12 + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpPhi %13 %14 %30 %35 %36 + %37 = OpSLessThan %16 %34 %15 + OpLoopMerge %38 %36 None + OpBranchConditional %37 %39 %38 + %39 = OpLabel + %40 = OpAccessChain %20 %4 %19 + %41 = OpLoad %7 %40 + %42 = OpFOrdLessThan %16 %10 %41 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpBranch %38 + %43 = OpLabel + %45 = OpFOrdLessThan %16 %41 %11 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %36 + %47 = OpLabel + OpBranch %38 + %46 = OpLabel + OpBranch %36 + %36 = OpLabel + %35 = OpIAdd %13 %34 %15 + OpBranch %33 + %38 = OpLabel + %48 = OpPhi %16 %26 %33 %26 %44 %27 %47 + OpSelectionMerge %49 None + OpBranchConditional %48 %31 %49 + %49 = OpLabel + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpAccessChain %20 %4 %19 + %55 = OpLoad %7 %54 + %56 = OpFOrdLessThan %16 %55 %21 + OpSelectionMerge %57 None + OpBranchConditional %56 %52 %58 + %57 = OpLabel + OpBranch %52 + %52 = OpLabel + OpStore %3 %12 + OpBranchConditional %26 %50 %51 + %58 = OpLabel + %59 = OpFOrdLessThan %16 %55 %22 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %63 + %63 = OpLabel + %64 = OpPhi %8 %28 %62 %65 %66 + %67 = OpPhi %13 %15 %62 %68 %66 + %69 = OpSGreaterThan %16 %67 %14 + OpLoopMerge %70 %66 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpFOrdLessThan %16 %55 %23 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + OpBranch %76 + %76 = OpLabel + %77 = OpPhi %13 %15 %74 %78 %79 + %80 = OpSGreaterThan %16 %77 %14 + OpLoopMerge %81 %79 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + %83 = OpAccessChain %20 %4 %24 + %84 = OpLoad %7 %83 + %85 = OpFOrdLessThan %16 %84 %11 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + OpBranch %79 + %88 = OpLabel + OpStore %3 %12 + OpBranch %79 + %86 = OpLabel + OpBranch %79 + %79 = OpLabel + %78 = OpISub %13 %77 %15 + OpBranch %76 + %81 = OpLabel + OpBranch %66 + %75 = OpLabel + %89 = OpFOrdLessThan %16 %55 %25 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 + %91 = OpLabel + OpBranch %93 + %93 = OpLabel + %94 = OpPhi %13 %15 %91 %95 %96 + %97 = OpINotEqual %16 %94 %14 + OpLoopMerge %98 %96 None + OpBranchConditional %97 %96 %98 + %96 = OpLabel + OpStore %3 %12 + %95 = OpISub %13 %94 %15 + OpBranch %93 + %98 = OpLabel + OpBranch %90 + %92 = OpLabel + OpSelectionMerge %99 None + OpBranchConditional %89 %100 %101 + %100 = OpLabel + OpBranch %102 + %102 = OpLabel + %103 = OpPhi %13 %14 %100 %104 %105 + %106 = OpINotEqual %16 %103 %15 + OpLoopMerge %107 %105 None + OpBranchConditional %106 %108 %107 + %108 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpPhi %13 %14 %108 %111 %112 + %113 = OpSLessThan %16 %110 %15 + OpLoopMerge %114 %112 None + OpBranchConditional %113 %112 %114 + %112 = OpLabel + OpStore %3 %12 + %111 = OpIAdd %13 %110 %15 + OpBranch %109 + %114 = OpLabel + OpBranch %105 + %105 = OpLabel + %104 = OpIAdd %13 %103 %15 + OpBranch %102 + %107 = OpLabel + OpBranch %115 + %115 = OpLabel + %116 = OpPhi %8 %64 %107 %12 %117 + %118 = OpPhi %13 %15 %107 %119 %117 + %120 = OpINotEqual %16 %118 %14 + OpLoopMerge %121 %117 None + OpBranchConditional %120 %117 %121 + %117 = OpLabel + %119 = OpISub %13 %118 %15 + OpBranch %115 + %121 = OpLabel + OpStore %3 %116 + OpBranch %99 + %101 = OpLabel + OpTerminateInvocation + %99 = OpLabel + OpBranch %90 + %90 = OpLabel + %122 = OpPhi %8 %64 %98 %116 %99 + OpBranch %66 + %73 = OpLabel + OpBranch %66 + %66 = OpLabel + %65 = OpPhi %8 %64 %81 %122 %90 %28 %73 + %68 = OpISub %13 %67 %15 + OpBranch %63 + %70 = OpLabel + OpBranch %60 + %60 = OpLabel + OpBranch %51 + %51 = OpLabel + %123 = OpPhi %16 %27 %60 %48 %52 + OpSelectionMerge %124 None + OpBranchConditional %123 %31 %124 + %124 = OpLabel + OpBranch %31 + %32 = OpLabel + OpBranch %30 + %31 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/function-with-float-comparison.amber b/vulkan/amber/graphicsfuzz/function-with-float-comparison.amber new file mode 100644 index 0000000..77d6482 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/function-with-float-comparison.amber @@ -0,0 +1,486 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader that compares a float and a coordinate + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--redundancy-elimination' +# '--redundancy-elimination' +# '--private-to-local' +# '--eliminate-dead-inserts' +# '--eliminate-dead-code-aggressive' +# '--combine-access-chains' +# '--reduce-load-size' +# '--inline-entry-points-exhaustive' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--copy-propagate-arrays' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-branches' +# '--merge-return' +# '--combine-access-chains' +# '--eliminate-dead-inserts' +# '--eliminate-dead-branches' +# '--if-conversion' +# '--inline-entry-points-exhaustive' +# '--simplify-instructions' +# '--eliminate-local-single-store' +# '--eliminate-dead-branches' +# '--eliminate-local-single-block' +# '--eliminate-local-multi-store' +# '--convert-local-access-chains' +# '--ccp' +# spirv-opt commit hash: ab7ac60f14ae66006bed5c989a2cfd4c4881704c + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# // Always returns 5. +# float func() +# { +# float zero = 0.0; +# bool alwaysFalse = gl_FragCoord.x < 0.0; +# +# do +# { +# if (injectionSwitch.x < injectionSwitch.y) // Always true +# { +# while (int(zero) <= bitfieldInsert(101, 0, 0, 0)) +# { +# if (zero <= gl_FragCoord.x) +# return 5.0; // Always returns here +# +# zero++; +# } +# } +# } while (alwaysFalse); +# +# for (int u = 0; u < 1; u++) +# { +# if (!alwaysFalse) +# return zero; +# } +# +# return 0.0; +# } +# +# void main() +# { +# float c = 0.0; +# for (int i = 0; i < 1; i++) +# { +# if (!(gl_FragCoord.x < 0.0)) // Always true +# c = func(); +# } +# +# if (c == 5.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 261 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %18 %109 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "zero" + OpName %15 "alwaysFalse" + OpName %18 "gl_FragCoord" + OpName %30 "buf0" + OpMemberName %30 0 "injectionSwitch" + OpName %32 "" + OpName %67 "u" + OpName %86 "c" + OpName %87 "i" + OpName %109 "_GLF_color" + OpDecorate %18 BuiltIn FragCoord + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 0 + OpDecorate %109 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 0 + %13 = OpTypeBool + %14 = OpTypePointer Function %13 + %16 = OpTypeVector %6 4 + %17 = OpTypePointer Input %16 + %18 = OpVariable %17 Input + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 0 + %21 = OpTypePointer Input %6 + %29 = OpTypeVector %6 2 + %30 = OpTypeStruct %29 + %31 = OpTypePointer Uniform %30 + %32 = OpVariable %31 Uniform + %33 = OpTypeInt 32 1 + %34 = OpConstant %33 0 + %35 = OpTypePointer Uniform %6 + %38 = OpConstant %19 1 + %51 = OpConstant %33 101 + %60 = OpConstant %6 5 + %63 = OpConstant %6 1 + %66 = OpTypePointer Function %33 + %74 = OpConstant %33 1 + %108 = OpTypePointer Output %16 + %109 = OpVariable %108 Output + %110 = OpConstantComposite %16 %63 %12 %12 %63 + %112 = OpConstantComposite %16 %12 %12 %12 %12 + %119 = OpConstantFalse %13 + %121 = OpConstantTrue %13 + %211 = OpUndef %6 + %226 = OpUndef %13 + %228 = OpUndef %33 + %256 = OpUndef %6 + %260 = OpUndef %13 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %128 = OpVariable %14 Function %119 + %129 = OpVariable %10 Function + %130 = OpVariable %10 Function + %131 = OpVariable %14 Function + %132 = OpVariable %66 Function + %133 = OpVariable %10 Function + %86 = OpVariable %10 Function + %87 = OpVariable %66 Function + OpStore %86 %12 + OpStore %87 %34 + OpBranch %88 + %88 = OpLabel + %210 = OpPhi %6 %211 %5 %227 %91 + %188 = OpPhi %6 %12 %5 %225 %91 + %187 = OpPhi %33 %34 %5 %103 %91 + %94 = OpSLessThan %13 %187 %74 + OpLoopMerge %90 %91 None + OpBranchConditional %94 %89 %90 + %89 = OpLabel + %95 = OpAccessChain %21 %18 %20 + %96 = OpLoad %6 %95 + %97 = OpFOrdLessThan %13 %96 %12 + %98 = OpLogicalNot %13 %97 + OpSelectionMerge %100 None + OpBranchConditional %98 %99 %100 + %99 = OpLabel + OpStore %128 %119 + OpBranch %134 + %134 = OpLabel + %221 = OpPhi %33 %187 %99 %228 %136 + %209 = OpPhi %6 %210 %99 %211 %136 + %194 = OpPhi %13 %119 %99 %226 %136 + OpLoopMerge %135 %136 None + OpBranch %137 + %137 = OpLabel + OpStore %130 %12 + %138 = OpAccessChain %21 %18 %20 + %139 = OpLoad %6 %138 + %140 = OpFOrdLessThan %13 %139 %12 + OpStore %131 %140 + OpBranch %141 + %141 = OpLabel + %193 = OpPhi %13 %119 %137 %196 %143 + %190 = OpPhi %6 %12 %137 %201 %143 + %220 = OpPhi %33 %221 %137 %222 %143 + %208 = OpPhi %6 %209 %137 %212 %143 + OpLoopMerge %142 %143 None + OpBranch %144 + %144 = OpLabel + %145 = OpAccessChain %35 %32 %34 %20 + %146 = OpLoad %6 %145 + %147 = OpAccessChain %35 %32 %34 %38 + %148 = OpLoad %6 %147 + %149 = OpFOrdLessThan %13 %146 %148 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %150 + %151 = OpLabel + OpBranch %152 + %152 = OpLabel + %189 = OpPhi %6 %190 %151 %165 %158 + %154 = OpConvertFToS %33 %189 + %155 = OpBitFieldInsert %33 %51 %34 %34 %34 + %156 = OpSLessThanEqual %13 %154 %155 + OpLoopMerge %157 %158 None + OpBranchConditional %156 %159 %157 + %159 = OpLabel + %161 = OpFOrdLessThanEqual %13 %189 %139 + OpSelectionMerge %162 None + OpBranchConditional %161 %163 %162 + %163 = OpLabel + OpStore %128 %121 + OpStore %129 %60 + OpBranch %157 + %162 = OpLabel + %165 = OpFAdd %6 %189 %63 + OpStore %130 %165 + OpBranch %158 + %158 = OpLabel + OpBranch %152 + %157 = OpLabel + %206 = OpPhi %6 %208 %152 %60 %163 + %191 = OpPhi %13 %193 %152 %121 %163 + OpSelectionMerge %167 None + OpBranchConditional %191 %142 %167 + %167 = OpLabel + OpBranch %150 + %150 = OpLabel + %222 = OpPhi %33 %220 %144 %220 %167 + %212 = OpPhi %6 %208 %144 %206 %167 + %201 = OpPhi %6 %190 %144 %189 %167 + %196 = OpPhi %13 %193 %144 %191 %167 + OpBranch %143 + %143 = OpLabel + OpBranchConditional %140 %141 %142 + %142 = OpLabel + %217 = OpPhi %33 %220 %157 %222 %143 + %205 = OpPhi %6 %206 %157 %212 %143 + %199 = OpPhi %6 %189 %157 %201 %143 + %195 = OpPhi %13 %191 %157 %196 %143 + OpSelectionMerge %170 None + OpBranchConditional %195 %135 %170 + %170 = OpLabel + OpStore %132 %34 + OpBranch %171 + %171 = OpLabel + %197 = OpPhi %33 %34 %170 %183 %175 + %173 = OpSLessThan %13 %197 %74 + OpLoopMerge %174 %175 None + OpBranchConditional %173 %176 %174 + %176 = OpLabel + %178 = OpLogicalNot %13 %140 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %179 + %180 = OpLabel + OpStore %128 %121 + OpStore %129 %199 + OpBranch %174 + %179 = OpLabel + OpBranch %175 + %175 = OpLabel + %183 = OpIAdd %33 %197 %74 + OpStore %132 %183 + OpBranch %171 + %174 = OpLabel + %213 = OpPhi %6 %205 %171 %199 %180 + %202 = OpPhi %13 %195 %171 %121 %180 + OpSelectionMerge %185 None + OpBranchConditional %202 %135 %185 + %185 = OpLabel + OpStore %128 %121 + OpStore %129 %12 + OpBranch %135 + %136 = OpLabel + OpBranch %134 + %135 = OpLabel + %204 = OpPhi %6 %205 %142 %213 %174 %12 %185 + OpStore %133 %204 + OpStore %86 %204 + OpBranch %100 + %100 = OpLabel + %227 = OpPhi %6 %210 %89 %204 %135 + %225 = OpPhi %6 %188 %89 %204 %135 + %215 = OpPhi %33 %187 %89 %217 %135 + OpBranch %91 + %91 = OpLabel + %103 = OpIAdd %33 %215 %74 + OpStore %87 %103 + OpBranch %88 + %90 = OpLabel + %105 = OpFOrdEqual %13 %188 %60 + OpSelectionMerge %107 None + OpBranchConditional %105 %106 %111 + %106 = OpLabel + OpStore %109 %110 + OpBranch %107 + %111 = OpLabel + OpStore %109 %112 + OpBranch %107 + %107 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %120 = OpVariable %14 Function %119 + %114 = OpVariable %10 Function + %11 = OpVariable %10 Function + %15 = OpVariable %14 Function + %67 = OpVariable %66 Function + OpBranch %116 + %116 = OpLabel + %234 = OpPhi %13 %119 %9 %260 %118 + OpLoopMerge %113 %118 None + OpBranch %117 + %117 = OpLabel + OpStore %11 %12 + %22 = OpAccessChain %21 %18 %20 + %23 = OpLoad %6 %22 + %24 = OpFOrdLessThan %13 %23 %12 + OpStore %15 %24 + OpBranch %25 + %25 = OpLabel + %233 = OpPhi %13 %234 %117 %240 %28 + %230 = OpPhi %6 %12 %117 %247 %28 + %254 = OpPhi %6 %256 %117 %257 %28 + OpLoopMerge %27 %28 None + OpBranch %26 + %26 = OpLabel + %36 = OpAccessChain %35 %32 %34 %20 + %37 = OpLoad %6 %36 + %39 = OpAccessChain %35 %32 %34 %38 + %40 = OpLoad %6 %39 + %41 = OpFOrdLessThan %13 %37 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %43 + %42 = OpLabel + OpBranch %44 + %44 = OpLabel + %229 = OpPhi %6 %230 %42 %64 %47 + %50 = OpConvertFToS %33 %229 + %52 = OpBitFieldInsert %33 %51 %34 %34 %34 + %53 = OpSLessThanEqual %13 %50 %52 + OpLoopMerge %46 %47 None + OpBranchConditional %53 %45 %46 + %45 = OpLabel + %57 = OpFOrdLessThanEqual %13 %229 %23 + OpSelectionMerge %59 None + OpBranchConditional %57 %58 %59 + %58 = OpLabel + OpStore %120 %121 + OpStore %114 %60 + OpBranch %46 + %59 = OpLabel + %64 = OpFAdd %6 %229 %63 + OpStore %11 %64 + OpBranch %47 + %47 = OpLabel + OpBranch %44 + %46 = OpLabel + %252 = OpPhi %6 %254 %44 %60 %58 + %231 = OpPhi %13 %233 %44 %121 %58 + OpSelectionMerge %122 None + OpBranchConditional %231 %27 %122 + %122 = OpLabel + OpBranch %43 + %43 = OpLabel + %257 = OpPhi %6 %254 %26 %252 %122 + %247 = OpPhi %6 %230 %26 %229 %122 + %240 = OpPhi %13 %233 %26 %231 %122 + OpBranch %28 + %28 = OpLabel + OpBranchConditional %24 %25 %27 + %27 = OpLabel + %251 = OpPhi %6 %252 %46 %257 %28 + %245 = OpPhi %6 %229 %46 %247 %28 + %239 = OpPhi %13 %231 %46 %240 %28 + OpSelectionMerge %124 None + OpBranchConditional %239 %113 %124 + %124 = OpLabel + OpStore %67 %34 + OpBranch %68 + %68 = OpLabel + %241 = OpPhi %33 %34 %124 %83 %71 + %75 = OpSLessThan %13 %241 %74 + OpLoopMerge %70 %71 None + OpBranchConditional %75 %69 %70 + %69 = OpLabel + %77 = OpLogicalNot %13 %24 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + OpStore %120 %121 + OpStore %114 %245 + OpBranch %70 + %79 = OpLabel + OpBranch %71 + %71 = OpLabel + %83 = OpIAdd %33 %241 %74 + OpStore %67 %83 + OpBranch %68 + %70 = OpLabel + %258 = OpPhi %6 %251 %68 %245 %78 + %248 = OpPhi %13 %239 %68 %121 %78 + OpSelectionMerge %126 None + OpBranchConditional %248 %113 %126 + %126 = OpLabel + OpStore %120 %121 + OpStore %114 %12 + OpBranch %113 + %118 = OpLabel + OpBranch %116 + %113 = OpLabel + %250 = OpPhi %6 %251 %27 %258 %70 %12 %126 + OpReturnValue %250 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/function-with-uniform-return.amber b/vulkan/amber/graphicsfuzz/function-with-uniform-return.amber new file mode 100644 index 0000000..3efb893 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/function-with-uniform-return.amber @@ -0,0 +1,199 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with uniform value as a return + +# The test passes because shader always writes color red + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# float fx(){ +# if (gl_FragCoord.y >= 0.0) +# return injectionSwitch.y; +# +# while(true){ +# _GLF_color = vec4(1.0, 1.0, 1.0, 1.0); +# }; +# } +# +# void main() +# { +# float x2 = 1.0; +# float B = 1.0; +# +# _GLF_color = vec4(fx(), 0.0, 0.0, 1.0); +# +# while (x2 > 2.0){ +# float k0; +# k0 = fx() - fx(); +# B = k0; +# x2 = B; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %40 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "fx(" + OpName %12 "gl_FragCoord" + OpName %24 "buf0" + OpMemberName %24 0 "injectionSwitch" + OpName %26 "" + OpName %40 "_GLF_color" + OpName %45 "x2" + OpName %46 "B" + OpName %57 "k0" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %24 0 Offset 0 + OpDecorate %24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 0 + OpDecorate %40 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 1 + %15 = OpTypePointer Input %6 + %18 = OpConstant %6 0 + %19 = OpTypeBool + %23 = OpTypeVector %6 2 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Uniform %24 + %26 = OpVariable %25 Uniform + %27 = OpTypeInt 32 1 + %28 = OpConstant %27 0 + %29 = OpTypePointer Uniform %6 + %38 = OpConstantTrue %19 + %39 = OpTypePointer Output %10 + %40 = OpVariable %39 Output + %41 = OpConstant %6 1 + %42 = OpConstantComposite %10 %41 %41 %41 %41 + %44 = OpTypePointer Function %6 + %55 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %45 = OpVariable %44 Function + %46 = OpVariable %44 Function + %57 = OpVariable %44 Function + OpStore %45 %41 + OpStore %46 %41 + %47 = OpFunctionCall %6 %8 + %48 = OpCompositeConstruct %10 %47 %18 %18 %41 + OpStore %40 %48 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %6 %45 + %56 = OpFOrdGreaterThan %19 %54 %55 + OpBranchConditional %56 %50 %51 + %50 = OpLabel + %58 = OpFunctionCall %6 %8 + %59 = OpFunctionCall %6 %8 + %60 = OpFSub %6 %58 %59 + OpStore %57 %60 + %61 = OpLoad %6 %57 + OpStore %46 %61 + %62 = OpLoad %6 %46 + OpStore %45 %62 + OpBranch %52 + %52 = OpLabel + OpBranch %49 + %51 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %6 %16 + %20 = OpFOrdGreaterThanEqual %19 %17 %18 + OpSelectionMerge %22 None + OpBranchConditional %20 %21 %22 + %21 = OpLabel + %30 = OpAccessChain %29 %26 %28 %14 + %31 = OpLoad %6 %30 + OpReturnValue %31 + %22 = OpLabel + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + OpBranchConditional %38 %34 %35 + %34 = OpLabel + OpStore %40 %42 + OpBranch %36 + %36 = OpLabel + OpBranch %33 + %35 = OpLabel + %43 = OpUndef %6 + OpReturnValue %43 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/global-array-loops.amber b/vulkan/amber/graphicsfuzz/global-array-loops.amber new file mode 100644 index 0000000..540210b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/global-array-loops.amber @@ -0,0 +1,404 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A loop that writes then reads a global array + +# The test passes because the first 4-iteration loop increments acc, and then the +# shader writes red if acc == 4, which is always the case. + +# Optimized using spirv-opt with the following arguments: +# '--reduce-load-size' +# '--combine-access-chains' +# '--ccp' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-code-aggressive' +# '--eliminate-dead-branches' +# '--merge-return' +# '--combine-access-chains' +# '--scalar-replacement=100' +# '--private-to-local' +# '--convert-local-access-chains' +# '--private-to-local' +# '--scalar-replacement=100' +# '--eliminate-local-single-block' +# '--scalar-replacement=100' +# '--vector-dce' +# '--eliminate-local-multi-store' +# '--redundancy-elimination' +# '--eliminate-local-multi-store' +# '--vector-dce' +# '--inline-entry-points-exhaustive' +# spirv-opt commit hash: 18b3b94567a9251a6f8491a6d07c4422abadd22c + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# int globalNumbers[10]; +# +# // Sets globalNumbers[0] to 1. +# // We assume: +# // n == 0 +# // globalNumbers[0] == 0 +# int setGlobalNumberZeroToOne(int n) +# { +# for ( +# int i = 0; +# i <= n; +# i++) +# { +# if (globalNumbers[n] <= 1) +# { +# globalNumbers[n] = 1; +# } +# } +# return 2; +# } +# +# int yieldsZero() +# { +# for ( +# int i = 0; +# i < int(one); +# i++) +# { +# return i; +# } +# } +# +# void main() +# { +# int acc = 0; +# int localNumbers[2]; +# for ( +# int i = 0; +# i < 4; +# i++) +# { +# localNumbers[1] = yieldsZero(); +# globalNumbers[0] = 0; +# setGlobalNumberZeroToOne(localNumbers[1]); +# acc += globalNumbers[int(one) - 1]; // acc += 1; +# } +# +# // acc should be 4. +# +# if (acc == 4) +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# else +# _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 191 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %104 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %13 "yieldsZero(" + OpName %30 "globalNumbers" + OpName %46 "i" + OpName %54 "buf0" + OpMemberName %54 0 "one" + OpName %56 "" + OpName %67 "acc" + OpName %68 "i" + OpName %80 "localNumbers" + OpName %84 "param" + OpName %104 "_GLF_color" + OpDecorate %13 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpMemberDecorate %54 0 Offset 0 + OpDecorate %54 Block + OpDecorate %56 DescriptorSet 0 + OpDecorate %56 Binding 0 + OpDecorate %67 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + OpDecorate %86 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %95 RelaxedPrecision + OpDecorate %97 RelaxedPrecision + OpDecorate %104 Location 0 + OpDecorate %110 RelaxedPrecision + OpDecorate %122 RelaxedPrecision + OpDecorate %129 RelaxedPrecision + OpDecorate %131 RelaxedPrecision + OpDecorate %143 RelaxedPrecision + OpDecorate %144 RelaxedPrecision + OpDecorate %146 RelaxedPrecision + OpDecorate %147 RelaxedPrecision + OpDecorate %148 RelaxedPrecision + OpDecorate %161 RelaxedPrecision + OpDecorate %160 RelaxedPrecision + OpDecorate %156 RelaxedPrecision + OpDecorate %167 RelaxedPrecision + OpDecorate %168 RelaxedPrecision + OpDecorate %169 RelaxedPrecision + OpDecorate %178 RelaxedPrecision + OpDecorate %186 RelaxedPrecision + OpDecorate %190 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %12 = OpTypeFunction %6 + %16 = OpConstant %6 0 + %24 = OpTypeBool + %26 = OpTypeInt 32 0 + %27 = OpConstant %26 10 + %28 = OpTypeArray %6 %27 + %29 = OpTypePointer Private %28 + %32 = OpTypePointer Private %6 + %35 = OpConstant %6 1 + %53 = OpTypeFloat 32 + %54 = OpTypeStruct %53 + %55 = OpTypePointer Uniform %54 + %56 = OpVariable %55 Uniform + %57 = OpTypePointer Uniform %53 + %75 = OpConstant %6 4 + %77 = OpConstant %26 2 + %78 = OpTypeArray %6 %77 + %79 = OpTypePointer Function %78 + %102 = OpTypeVector %53 4 + %103 = OpTypePointer Output %102 + %104 = OpVariable %103 Output + %105 = OpConstant %53 1 + %106 = OpConstant %53 0 + %107 = OpConstantComposite %102 %105 %106 %106 %105 + %109 = OpConstantComposite %102 %106 %106 %106 %105 + %136 = OpConstantFalse %24 + %137 = OpTypePointer Function %24 + %139 = OpConstantTrue %24 + %142 = OpTypePointer Function %28 + %164 = OpUndef %6 + %165 = OpUndef %24 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %166 = OpVariable %137 Function %136 + %167 = OpVariable %7 Function + %168 = OpVariable %7 Function + %169 = OpVariable %7 Function + %30 = OpVariable %142 Function + %110 = OpVariable %7 Function + %67 = OpVariable %7 Function + %68 = OpVariable %7 Function + %80 = OpVariable %79 Function + %84 = OpVariable %7 Function + OpStore %67 %16 + OpStore %68 %16 + OpBranch %69 + %69 = OpLabel + %147 = OpPhi %6 %16 %5 %95 %72 + %146 = OpPhi %6 %16 %5 %97 %72 + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %76 = OpSLessThan %24 %146 %75 + OpBranchConditional %76 %70 %71 + %70 = OpLabel + OpStore %166 %136 + OpBranch %170 + %170 = OpLabel + %172 = OpPhi %24 %136 %70 %165 %171 + OpLoopMerge %173 %171 None + OpBranch %174 + %174 = OpLabel + OpStore %168 %16 + OpBranch %175 + %175 = OpLabel + %177 = OpPhi %24 %172 %174 %165 %176 + %178 = OpPhi %6 %16 %174 %164 %176 + OpLoopMerge %179 %176 None + OpBranch %180 + %180 = OpLabel + %181 = OpAccessChain %57 %56 %16 + %182 = OpLoad %53 %181 + %183 = OpConvertFToS %6 %182 + %184 = OpSLessThan %24 %178 %183 + OpBranchConditional %184 %185 %179 + %185 = OpLabel + OpStore %166 %139 + OpStore %167 %178 + OpBranch %179 + %176 = OpLabel + OpBranch %175 + %179 = OpLabel + %186 = OpPhi %6 %164 %180 %178 %185 + %187 = OpPhi %24 %177 %180 %139 %185 + OpSelectionMerge %188 None + OpBranchConditional %187 %173 %188 + %188 = OpLabel + %189 = OpUndef %6 + OpStore %166 %139 + OpStore %167 %189 + OpBranch %173 + %171 = OpLabel + OpBranch %170 + %173 = OpLabel + %190 = OpPhi %6 %186 %179 %189 %188 + OpStore %169 %190 + %81 = OpLoad %6 %169 + %143 = OpLoad %78 %80 + %144 = OpCompositeInsert %78 %81 %143 1 + OpStore %80 %144 + %83 = OpAccessChain %7 %30 %16 + OpStore %83 %16 + %85 = OpAccessChain %7 %80 %35 + %86 = OpCompositeExtract %6 %144 1 + OpStore %84 %86 + OpStore %110 %16 + OpBranch %112 + %112 = OpLabel + %148 = OpPhi %6 %16 %173 %129 %114 + OpLoopMerge %113 %114 None + OpBranch %115 + %115 = OpLabel + %118 = OpSLessThanEqual %24 %148 %86 + OpBranchConditional %118 %119 %113 + %119 = OpLabel + %121 = OpAccessChain %7 %30 %86 + %122 = OpLoad %6 %121 + %123 = OpSLessThanEqual %24 %122 %35 + OpSelectionMerge %124 None + OpBranchConditional %123 %125 %124 + %125 = OpLabel + OpStore %121 %35 + OpBranch %124 + %124 = OpLabel + OpBranch %114 + %114 = OpLabel + %129 = OpIAdd %6 %148 %35 + OpStore %110 %129 + OpBranch %112 + %113 = OpLabel + %88 = OpAccessChain %57 %56 %16 + %89 = OpLoad %53 %88 + %90 = OpConvertFToS %6 %89 + %91 = OpISub %6 %90 %35 + %92 = OpAccessChain %7 %30 %91 + %93 = OpLoad %6 %92 + %95 = OpIAdd %6 %147 %93 + OpStore %67 %95 + OpBranch %72 + %72 = OpLabel + %97 = OpIAdd %6 %146 %35 + OpStore %68 %97 + OpBranch %69 + %71 = OpLabel + %99 = OpIEqual %24 %147 %75 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %108 + %100 = OpLabel + OpStore %104 %107 + OpBranch %101 + %108 = OpLabel + OpStore %104 %109 + OpBranch %101 + %101 = OpLabel + OpReturn + OpFunctionEnd + %13 = OpFunction %6 None %12 + %14 = OpLabel + %138 = OpVariable %137 Function %136 + %131 = OpVariable %7 Function + %46 = OpVariable %7 Function + OpBranch %133 + %133 = OpLabel + %159 = OpPhi %24 %136 %14 %165 %135 + OpLoopMerge %130 %135 None + OpBranch %134 + %134 = OpLabel + OpStore %46 %16 + OpBranch %47 + %47 = OpLabel + %158 = OpPhi %24 %159 %134 %165 %50 + %156 = OpPhi %6 %16 %134 %164 %50 + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %58 = OpAccessChain %57 %56 %16 + %59 = OpLoad %53 %58 + %60 = OpConvertFToS %6 %59 + %61 = OpSLessThan %24 %156 %60 + OpBranchConditional %61 %48 %49 + %48 = OpLabel + OpStore %138 %139 + OpStore %131 %156 + OpBranch %49 + %50 = OpLabel + OpBranch %47 + %49 = OpLabel + %161 = OpPhi %6 %164 %51 %156 %48 + %157 = OpPhi %24 %158 %51 %139 %48 + OpSelectionMerge %140 None + OpBranchConditional %157 %130 %140 + %140 = OpLabel + %66 = OpUndef %6 + OpStore %138 %139 + OpStore %131 %66 + OpBranch %130 + %135 = OpLabel + OpBranch %133 + %130 = OpLabel + %160 = OpPhi %6 %161 %49 %66 %140 + OpReturnValue %160 + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/if-and-switch.amber b/vulkan/amber/graphicsfuzz/if-and-switch.amber new file mode 100644 index 0000000..c578586 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/if-and-switch.amber @@ -0,0 +1,169 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with a switch and some data flow + +# Checks that all pixels are red. +# Passes because main always writes red to _GLF_color. + +# Optimized using spirv-opt with the following arguments: +# '-Os' + +# Derived from the following GLSL. + +# Fragment shader GLSL: +# #version 310 es +# +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# void main() +# { +# float data[2]; +# data[0] = injectionSwitch.x; +# data[1] = injectionSwitch.x; +# +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# +# if (data[1] > 1.0) +# { +# switch (int(injectionSwitch.x)) +# { +# case 0: +# float temp = 1.0; +# case 1: +# data[int(injectionSwitch.x)] = temp; +# _GLF_color = vec4(0.0, 0.0, 0.0, 0.0); +# default: +# break; +# } +# } +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %30 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "data" + OpName %15 "buf0" + OpMemberName %15 0 "injectionSwitch" + OpName %17 "" + OpName %30 "_GLF_color" + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %30 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 2 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpTypeVector %6 2 + %15 = OpTypeStruct %14 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpConstant %7 0 + %19 = OpTypePointer Uniform %6 + %22 = OpTypePointer Function %6 + %24 = OpConstant %12 1 + %28 = OpTypeVector %6 4 + %29 = OpTypePointer Output %28 + %30 = OpVariable %29 Output + %31 = OpConstant %6 1 + %32 = OpConstant %6 0 + %33 = OpConstantComposite %28 %31 %32 %32 %31 + %36 = OpTypeBool + %53 = OpConstantComposite %28 %32 %32 %32 %32 + %57 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %20 = OpAccessChain %19 %17 %13 %18 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %22 %11 %13 + OpStore %23 %21 + %27 = OpAccessChain %22 %11 %24 + OpStore %27 %21 + OpStore %30 %33 + %35 = OpLoad %6 %27 + %37 = OpFOrdGreaterThan %36 %35 %31 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + %42 = OpConvertFToS %12 %21 + OpSelectionMerge %45 None + OpSwitch %42 %45 0 %43 1 %44 + %45 = OpLabel + OpBranch %39 + %43 = OpLabel + OpBranch %44 + %44 = OpLabel + %56 = OpPhi %6 %57 %38 %31 %43 + %52 = OpAccessChain %22 %11 %42 + OpStore %52 %56 + OpStore %30 %53 + OpBranch %45 + %39 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/increment-value-in-nested-for-loop.amber b/vulkan/amber/graphicsfuzz/increment-value-in-nested-for-loop.amber new file mode 100644 index 0000000..6e53721 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/increment-value-in-nested-for-loop.amber @@ -0,0 +1,413 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A frag. shader that increments a value in nested for loop + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: ab7ac60f14ae66006bed5c989a2cfd4c4881704c + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# // func returns 1 if "ref" > 0. +# int func(int ref) +# { +# bool alwaysFalse = gl_FragCoord.x < -1.0; +# +# if (!(injectionSwitch.x < 0.0)) +# { +# if (alwaysFalse) +# return 0; +# +# // Returns on first iteration. +# for (int i = 1; i < ref; i++) +# { +# if (alwaysFalse) +# continue; +# +# // Always true. +# if (i > 0) +# return 1; +# } +# } +# return 0; +# } +# +# void main() +# { +# bool alwaysFalse = injectionSwitch.x < -1.0; +# int value = 0; +# +# // Iterates once. +# for (int i = 0; i < (gl_FragCoord.y > -1.0 ? 10 : 100); i++) +# { +# for (int k = 0; k < 2; k++) +# { +# // After 2 iterations: value == 2 +# value += func(3); +# +# if (alwaysFalse) +# { +# while (alwaysFalse) +# { +# _GLF_color = vec4(i); +# } +# return; +# } +# } +# +# if (!alwaysFalse) +# break; +# } +# +# // Iterates 2 times. +# for (int i = 0; i < int(injectionSwitch.y + 1.0); i++) +# { +# // After 2 iterations: value == 4 +# value += func(3); +# // func(0) will always return 0. +# if (alwaysFalse || func(0) != 0) +# break; +# } +# +# if (value == 4) +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# else +# _GLF_color = vec4(0.0, 0.0, 0.0, 0.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 454 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %18 %110 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %18 "gl_FragCoord" + OpName %27 "buf0" + OpMemberName %27 0 "injectionSwitch" + OpName %29 "" + OpName %110 "_GLF_color" + OpDecorate %18 BuiltIn FragCoord + OpMemberDecorate %27 0 Offset 0 + OpDecorate %27 Block + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 0 + OpDecorate %110 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %12 = OpTypeBool + %15 = OpTypeFloat 32 + %16 = OpTypeVector %15 4 + %17 = OpTypePointer Input %16 + %18 = OpVariable %17 Input + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 0 + %21 = OpTypePointer Input %15 + %24 = OpConstant %15 -1 + %26 = OpTypeVector %15 2 + %27 = OpTypeStruct %26 + %28 = OpTypePointer Uniform %27 + %29 = OpVariable %28 Uniform + %30 = OpConstant %6 0 + %31 = OpTypePointer Uniform %15 + %34 = OpConstant %15 0 + %44 = OpConstant %6 1 + %78 = OpConstant %19 1 + %82 = OpConstant %6 10 + %83 = OpConstant %6 100 + %93 = OpConstant %6 2 + %95 = OpConstant %6 3 + %109 = OpTypePointer Output %16 + %110 = OpVariable %109 Output + %133 = OpConstant %15 1 + %155 = OpConstant %6 4 + %159 = OpConstantComposite %16 %133 %34 %34 %133 + %161 = OpConstantComposite %16 %34 %34 %34 %34 + %166 = OpConstantFalse %12 + %168 = OpConstantTrue %12 + %319 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %163 + %163 = OpLabel + %67 = OpAccessChain %31 %29 %30 %20 + %68 = OpLoad %15 %67 + %69 = OpFOrdLessThan %12 %68 %24 + OpLoopMerge %162 %165 None + OpBranch %72 + %72 = OpLabel + %337 = OpPhi %12 %166 %163 %335 %75 + %324 = OpPhi %6 %30 %163 %383 %75 + %317 = OpPhi %6 %319 %163 %441 %75 + %305 = OpPhi %6 %30 %163 %123 %75 + %79 = OpAccessChain %21 %18 %78 + %80 = OpLoad %15 %79 + %81 = OpFOrdGreaterThan %12 %80 %24 + %84 = OpSelect %6 %81 %82 %83 + %85 = OpSLessThan %12 %305 %84 + OpLoopMerge %74 %75 None + OpBranchConditional %85 %73 %74 + %73 = OpLabel + OpBranch %87 + %87 = OpLabel + %323 = OpPhi %6 %324 %73 %99 %90 + %316 = OpPhi %6 %317 %73 %312 %90 + %306 = OpPhi %6 %30 %73 %116 %90 + %94 = OpSLessThan %12 %306 %93 + OpLoopMerge %89 %90 None + OpBranchConditional %94 %88 %89 + %88 = OpLabel + OpBranch %187 + %187 = OpLabel + OpLoopMerge %188 %189 None + OpBranch %190 + %190 = OpLabel + %191 = OpAccessChain %21 %18 %20 + %192 = OpLoad %15 %191 + %193 = OpFOrdLessThan %12 %192 %24 + %196 = OpFOrdLessThan %12 %68 %34 + %197 = OpLogicalNot %12 %196 + OpSelectionMerge %198 None + OpBranchConditional %197 %199 %198 + %199 = OpLabel + OpSelectionMerge %201 None + OpBranchConditional %193 %202 %201 + %202 = OpLabel + OpBranch %188 + %201 = OpLabel + OpBranch %203 + %203 = OpLabel + %307 = OpPhi %6 %44 %201 %219 %205 + %209 = OpSLessThan %12 %307 %95 + OpLoopMerge %204 %205 None + OpBranchConditional %209 %210 %204 + %210 = OpLabel + OpSelectionMerge %212 None + OpBranchConditional %193 %213 %212 + %213 = OpLabel + OpBranch %205 + %212 = OpLabel + %215 = OpSGreaterThan %12 %307 %30 + OpSelectionMerge %216 None + OpBranchConditional %215 %217 %216 + %217 = OpLabel + OpBranch %204 + %216 = OpLabel + OpBranch %205 + %205 = OpLabel + %219 = OpIAdd %6 %307 %44 + OpBranch %203 + %204 = OpLabel + %313 = OpPhi %6 %316 %203 %44 %217 + %308 = OpPhi %12 %166 %203 %168 %217 + OpSelectionMerge %221 None + OpBranchConditional %308 %188 %221 + %221 = OpLabel + OpBranch %198 + %198 = OpLabel + OpBranch %188 + %189 = OpLabel + OpBranch %187 + %188 = OpLabel + %312 = OpPhi %6 %30 %202 %313 %204 %30 %198 + %99 = OpIAdd %6 %323 %312 + OpSelectionMerge %102 None + OpBranchConditional %69 %101 %102 + %101 = OpLabel + OpBranch %103 + %103 = OpLabel + OpLoopMerge %105 %104 None + OpBranchConditional %69 %104 %105 + %104 = OpLabel + %112 = OpConvertSToF %15 %305 + %113 = OpCompositeConstruct %16 %112 %112 %112 %112 + OpStore %110 %113 + OpBranch %103 + %105 = OpLabel + OpBranch %89 + %102 = OpLabel + OpBranch %90 + %90 = OpLabel + %116 = OpIAdd %6 %306 %44 + OpBranch %87 + %89 = OpLabel + %441 = OpPhi %6 %316 %87 %312 %105 + %383 = OpPhi %6 %323 %87 %99 %105 + %335 = OpPhi %12 %337 %87 %168 %105 + OpSelectionMerge %169 None + OpBranchConditional %335 %74 %169 + %169 = OpLabel + %118 = OpLogicalNot %12 %69 + OpSelectionMerge %120 None + OpBranchConditional %118 %119 %120 + %119 = OpLabel + OpBranch %74 + %120 = OpLabel + OpBranch %75 + %75 = OpLabel + %123 = OpIAdd %6 %305 %44 + OpBranch %72 + %74 = OpLabel + %382 = OpPhi %6 %324 %72 %383 %89 %383 %119 + %354 = OpPhi %12 %337 %72 %335 %89 %335 %119 + OpSelectionMerge %171 None + OpBranchConditional %354 %162 %171 + %171 = OpLabel + OpBranch %125 + %125 = OpLabel + %381 = OpPhi %6 %382 %171 %140 %128 + %365 = OpPhi %6 %319 %171 %361 %128 + %355 = OpPhi %6 %30 %171 %153 %128 + %131 = OpAccessChain %31 %29 %30 %78 + %132 = OpLoad %15 %131 + %134 = OpFAdd %15 %132 %133 + %135 = OpConvertFToS %6 %134 + %136 = OpSLessThan %12 %355 %135 + OpLoopMerge %127 %128 None + OpBranchConditional %136 %126 %127 + %126 = OpLabel + OpBranch %228 + %228 = OpLabel + OpLoopMerge %229 %230 None + OpBranch %231 + %231 = OpLabel + %232 = OpAccessChain %21 %18 %20 + %233 = OpLoad %15 %232 + %234 = OpFOrdLessThan %12 %233 %24 + %237 = OpFOrdLessThan %12 %68 %34 + %238 = OpLogicalNot %12 %237 + OpSelectionMerge %239 None + OpBranchConditional %238 %240 %239 + %240 = OpLabel + OpSelectionMerge %242 None + OpBranchConditional %234 %243 %242 + %243 = OpLabel + OpBranch %229 + %242 = OpLabel + OpBranch %244 + %244 = OpLabel + %356 = OpPhi %6 %44 %242 %260 %246 + %250 = OpSLessThan %12 %356 %95 + OpLoopMerge %245 %246 None + OpBranchConditional %250 %251 %245 + %251 = OpLabel + OpSelectionMerge %253 None + OpBranchConditional %234 %254 %253 + %254 = OpLabel + OpBranch %246 + %253 = OpLabel + %256 = OpSGreaterThan %12 %356 %30 + OpSelectionMerge %257 None + OpBranchConditional %256 %258 %257 + %258 = OpLabel + OpBranch %245 + %257 = OpLabel + OpBranch %246 + %246 = OpLabel + %260 = OpIAdd %6 %356 %44 + OpBranch %244 + %245 = OpLabel + %362 = OpPhi %6 %365 %244 %44 %258 + %357 = OpPhi %12 %166 %244 %168 %258 + OpSelectionMerge %262 None + OpBranchConditional %357 %229 %262 + %262 = OpLabel + OpBranch %239 + %239 = OpLabel + OpBranch %229 + %230 = OpLabel + OpBranch %228 + %229 = OpLabel + %361 = OpPhi %6 %30 %243 %362 %245 %30 %239 + %140 = OpIAdd %6 %381 %361 + %142 = OpLogicalNot %12 %69 + %453 = OpSelect %12 %142 %166 %69 + OpSelectionMerge %150 None + OpBranchConditional %453 %149 %150 + %149 = OpLabel + OpBranch %127 + %150 = OpLabel + OpBranch %128 + %128 = OpLabel + %153 = OpIAdd %6 %355 %44 + OpBranch %125 + %127 = OpLabel + %431 = OpPhi %6 %381 %125 %140 %149 + %156 = OpIEqual %12 %431 %155 + OpSelectionMerge %158 None + OpBranchConditional %156 %157 %160 + %160 = OpLabel + OpStore %110 %161 + OpBranch %158 + %157 = OpLabel + OpStore %110 %159 + OpBranch %158 + %158 = OpLabel + OpBranch %162 + %165 = OpLabel + OpBranch %163 + %162 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/index.txt b/vulkan/amber/graphicsfuzz/index.txt new file mode 100644 index 0000000..c645fb2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/index.txt @@ -0,0 +1,757 @@ +{ "access-new-vector-inside-if-condition.amber", "access-new-vector-inside-if-condition", "A shader that accesses a new vector within an if condition" }, +{ "always-discarding-function.amber", "always-discarding-function", "A fragment shader with an always discarding main function", "VK_KHR_shader_terminate_invocation"}, +{ "always-false-if-in-do-while.amber", "always-false-if-in-do-while", "A fragment shader with an always false if." }, +{ "always-false-if-with-discard-return.amber", "always-false-if-with-discard-return", "A fragment shader with discard keyword and a return", "VK_KHR_shader_terminate_invocation"}, +{ "arr-value-set-to-arr-value-squared.amber", "arr-value-set-to-arr-value-squared", "A fragment shader with an arr value set to itself squared" }, +{ "array-idx-multiplied-by-for-loop-idx.amber", "array-idx-multiplied-by-for-loop-idx", "A fragment shader with array index multiplied" }, +{ "assign-array-value-to-another-array.amber", "assign-array-value-to-another-array", "A fragment shader that assigns array values to other array" }, +{ "assign-array-value-to-another-array-2.amber", "assign-array-value-to-another-array-2", "A fragment shader that assigns array values to other array" }, +{ "barrier-in-loop-with-break.amber", "barrier-in-loop-with-break", "A compute shader with a barrier in a loop with a break" }, +{ "break-in-do-while-with-nested-if.amber", "break-in-do-while-with-nested-if", "A fragment shader with nested if" }, +{ "call-function-with-discard.amber", "call-function-with-discard", "Calls a function containing a discard", "VK_KHR_shader_terminate_invocation"}, +{ "call-if-while-switch.amber", "call-if-while-switch", "A fragment shader with a call, if, while, switch" }, +{ "color-set-in-for-loop.amber", "color-set-in-for-loop", "A fragment shader with color set in for loop" }, +{ "color-write-in-loop.amber", "color-write-in-loop", "A fragment shader that writes to color in a loop" }, +{ "complex-nested-loops-and-call.amber", "complex-nested-loops-and-call", "A fragment shader with complex nested loops, breaks, etc." , "VK_KHR_shader_terminate_invocation"}, +{ "conditional-return-in-infinite-while.amber", "conditional-return-in-infinite-while", "A shader with conditional return inside an infinite loop" }, +{ "continue-and-merge.amber", "continue-and-merge", "A fragment shader with two nested loops" }, +{ "control-flow-in-function.amber", "control-flow-in-function", "A fragment shader with a lot of control flow" }, +{ "control-flow-switch.amber", "control-flow-switch", "A fragment shader with somewhat complex control flow and a switch" }, +{ "cosh-return-inf-unused.amber", "cosh-return-inf-unused", "Cosh returns inf for one component which is never used", "VK_KHR_shader_terminate_invocation"}, +{ "cov-access-array-dot.amber", "cov-access-array-dot", "Covers instruction combine casting, combine shifting and DAG code paths" }, +{ "cov-analysis-reachable-from-many.amber", "cov-analysis-reachable-from-many", "A fragment shader that covers a specific LLVM analysis code path." , "VK_KHR_shader_terminate_invocation"}, +{ "cov-and-even-numbers-from-fragcoord.amber", "cov-and-even-numbers-from-fragcoord", "A fragment shader that covers specific NIR code paths" }, +{ "cov-apfloat-acos-ldexp.amber", "cov-apfloat-acos-ldexp", "A fragment shader that covers a specific AP float code path." }, +{ "cov-apfloat-determinant.amber", "cov-apfloat-determinant", "A fragment shader that covers a specific arbitrary precision float usage." }, +{ "cov-apfloat-mix-nan.amber", "cov-apfloat-mix-nan", "A fragment shader that covers a specific floating point code path" }, +{ "cov-apfloat-mod-zero.amber", "cov-apfloat-mod-zero", "A fragment shader that covers a specific floating point code path" }, +{ "cov-apfloat-module-small-number.amber", "cov-apfloat-module-small-number", "A fragment shader that covers a specific floating point code path" }, +{ "cov-apfloat-negative-step-func.amber", "cov-apfloat-negative-step-func", "A fragment shader that covers a specific floating point code path" }, +{ "cov-apfloat-sinh-negative-log2.amber", "cov-apfloat-sinh-negative-log2", "A fragment shader that covers a specific floating point code path", "VK_KHR_shader_float_controls", "FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32"}, +{ "cov-apfloat-tanh.amber", "cov-apfloat-tanh", "A fragment shader that covers a specific arbitrary precision float usage." }, +{ "cov-apfloat-undefined-matrix-mul.amber", "cov-apfloat-undefined-matrix-mul", "A fragment shader that covers a specific floating point code path" }, +{ "cov-apfloat-determinant-for-if.amber", "cov-apfloat-determinant-for-if", "A fragment shader that covers a specific APFloat code path" }, +{ "cov-apfloat-reflect-denorm.amber", "cov-apfloat-reflect-denorm", "A fragment shader that covers a specific floating point code path" }, +{ "cov-apfloat-unpackunorm-loop.amber", "cov-apfloat-unpackunorm-loop", "A fragment shader that covers a specific floating point code path" }, +{ "cov-array-accesses-clamp.amber", "cov-array-accesses-clamp", "A fragment shader that covers a specific inst combine select path" }, +{ "cov-array-cast-bool-float-div-by-zero-no-effect.amber", "cov-array-cast-bool-float-div-by-zero-no-effect", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-array-copies-loops-with-limiters.amber", "cov-array-copies-loops-with-limiters", "A fragment shader that covers specific NIR code paths" }, +{ "cov-array-set-element-condition-negative-modulus.amber", "cov-array-set-element-condition-negative-modulus", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-asin-undefined-smoothstep.amber", "cov-asin-undefined-smoothstep", "A fragment shader that covers a specific instruction simplify code path", "VK_KHR_shader_float_controls", "FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32"}, +{ "cov-atan-trunc-vec4.amber", "cov-atan-trunc-vec4", "A fragment shader that covers specific NIR code paths" }, +{ "cov-basic-block-discard-in-function.amber", "cov-basic-block-discard-in-function", "A fragment shader that covers a specific basic block code path", "VK_KHR_shader_terminate_invocation"}, +{ "cov-bitcount.amber", "cov-bitcount", "Covers specific inst combine add sub and inst combine simplify demanded code paths"}, +{ "cov-bitfieldExtract-undefined.amber", "cov-bitfieldExtract-undefined", "A fragment shader that covers a specific constant fold code path" }, +{ "cov-bitfieldinsert-undefined.amber", "cov-bitfieldinsert-undefined", "A fragment shader that covers a specific instruction simplify code path" }, +{ "cov-bitfieldreverse-left-shift-findmsb.amber", "cov-bitfieldreverse-left-shift-findmsb", "Covers specific DAG combiner and legalize vector ops code paths" }, +{ "cov-bitfieldreverse-loop-limit-underflow.amber", "cov-bitfieldreverse-loop-limit-underflow", "A fragment shader that covers specific NIR code paths" }, +{ "cov-bitwise-and-variable-and-its-negation.amber", "cov-bitwise-and-variable-and-its-negation", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-bitwise-inverse-uniform-condition.amber", "cov-bitwise-inverse-uniform-condition", "A fragment shader that covers specific BRW code paths" }, +{ "cov-bitwise-or-uniform-zero-tenth-bit-loop-limit-find-lsb.amber", "cov-bitwise-or-uniform-zero-tenth-bit-loop-limit-find-lsb", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-bitwise-shift-right-always-select-one.amber", "cov-bitwise-shift-right-always-select-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-bitwise-shift-right-full-bits-no-effect-clamp.amber", "cov-bitwise-shift-right-full-bits-no-effect-clamp", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-blockfrequency-several-for-loops.amber", "cov-blockfrequency-several-for-loops", "A fragment shader that covers a specific block frequency info code path." }, +{ "cov-branch-probability-identity-matrix.amber", "cov-branch-probability-identity-matrix", "A fragment shader that covers a specific branch propability path" }, +{ "cov-cast-float-to-int-and-back.amber", "cov-cast-float-to-int-and-back", "A fragment shader that covers specific NIR code paths" }, +{ "cov-clamp-loop-limit-increment-float-array.amber", "cov-clamp-loop-limit-increment-float-array", "A fragment shader that covers specific NIR code paths" }, +{ "cov-clamp-lower-limit-from-always-false.amber", "cov-clamp-lower-limit-from-always-false", "A fragment shader that covers specific BRW code paths" }, +{ "cov-clamp-min-bitcount-uniform.amber", "cov-clamp-min-bitcount-uniform", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-clamp-value-and-min-select-uniform.amber", "cov-clamp-value-and-min-select-uniform", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-clamp-vector-component-condition-using-matrix.amber", "cov-clamp-vector-component-condition-using-matrix", "A fragment shader that covers specific patch optimization code paths" }, +{ "cov-clamp-vector-element-ceil-negative.amber", "cov-clamp-vector-element-ceil-negative", "A fragment shader that covers specific NIR code paths" }, +{ "cov-clamp-vector-variable-negative-offset.amber", "cov-clamp-vector-variable-negative-offset", "A fragment shader that covers specific NIR code paths" }, +{ "cov-clear-yz-inside-condition.amber", "cov-clear-yz-inside-condition", "A fragment shader that covers specific NIR code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-color-output-undefined-in-unexecuted-branch.amber", "cov-color-output-undefined-in-unexecuted-branch", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-combine-and-or-xor-gt-lt.amber", "cov-combine-and-or-xor-gt-lt", "A fragment shader that covers a specific bitwise operator cobmining code path" }, +{ "cov-condition-bitfield-extract-integer.amber", "cov-condition-bitfield-extract-integer", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-condition-clamp-min-from-uniform-never-larger.amber", "cov-condition-clamp-min-from-uniform-never-larger", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-condition-increment-zero-to-one-divide-by-two.amber", "cov-condition-increment-zero-to-one-divide-by-two", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-condition-loop-index-bitwise-not.amber", "cov-condition-loop-index-bitwise-not", "A fragment shader that covers specific BRW code paths" }, +{ "cov-condition-matrix-determinant-uniform.amber", "cov-condition-matrix-determinant-uniform", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-conditional-discard-inside-loop.amber", "cov-conditional-discard-inside-loop", "A fragment shader that covers specific NIR code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-conditions-empty-blocks-index-array-one-divided-by-findlsb.amber", "cov-conditions-empty-blocks-index-array-one-divided-by-findlsb", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-const-folding-bitfieldinsert-div-one.amber", "cov-const-folding-bitfieldinsert-div-one", "A fragment shader that covers a specific const folding path" }, +{ "cov-color-overwrite-identity-matrix-multiply.amber", "cov-color-overwrite-identity-matrix-multiply", "A fragment shader that covers a specific DAG code paths" }, +{ "cov-const-folding-ceil-vec4.amber", "cov-const-folding-ceil-vec4", "A fragment shader that covers a specific constant folding code path" }, +{ "cov-const-folding-clamp.amber", "cov-const-folding-clamp", "A fragment shader that covers a specific const folding rule path." }, +{ "cov-const-folding-clamp-inside-while.amber", "cov-const-folding-clamp-inside-while", "A fragment shader that covers a specific constant folding path" }, +{ "cov-const-folding-clamp-max.amber", "cov-const-folding-clamp-max", "A fragment shader that covers a specific const folding rule path." }, +{ "cov-const-folding-clamp-min.amber", "cov-const-folding-clamp-min", "A fragment shader that covers a specific const folding rule path." }, +{ "cov-const-folding-clamp-vs-original.amber", "cov-const-folding-clamp-vs-original", "A fragment shader that covers a specific constant folding path" }, +{ "cov-const-folding-det-identity.amber", "cov-const-folding-det-identity", "A fragment shader that covers a specific const folding path" }, +{ "cov-const-folding-dot-condition-true.amber", "cov-const-folding-dot-condition-true", "A fragment shader that covers a specific const folding rule path." }, +{ "cov-const-folding-dot-determinant.amber", "cov-const-folding-dot-determinant", "A fragment shader that covers a specific const folding rule path." }, +{ "cov-const-folding-gte-const-first.amber", "cov-const-folding-gte-const-first", "A fragment shader that covers a specific constant folding path" }, +{ "cov-const-folding-min-as-loop-range.amber", "cov-const-folding-min-as-loop-range", "A fragment shader that covers a specific constant folding path" }, +{ "cov-const-folding-mod-one-one-lte.amber", "cov-const-folding-mod-one-one-lte", "A fragment shader that covers a specific const folding path" }, +{ "cov-const-folding-pow-large-exp.amber", "cov-const-folding-pow-large-exp", "A fragment shader that covers a specific const folding path" }, +{ "cov-const-folding-same-condition.amber", "cov-const-folding-same-condition", "A fragment shader that covers a specific constant folding code path" }, +{ "cov-const-folding-sinh-inf.amber", "cov-const-folding-sinh-inf", "A fragment shader that covers a specific const folding path" }, +{ "cov-const-folding-vector-shuffle.amber", "cov-const-folding-vector-shuffle", "A fragment shader that covers a specific const folding rule path." }, +{ "cov-constant-folding-atan-over-tanh.amber", "cov-constant-folding-atan-over-tanh", "A fragment shader that covers a specific constant folding code path." }, +{ "cov-constants-combine-add-sub.amber", "cov-constants-combine-add-sub", "A fragment shader that covers a specific constants and add/sub combining path" }, +{ "cov-constants-mix-uniform.amber", "cov-constants-mix-uniform", "A fragment shader that covers a specific constant handling path." }, +{ "cov-continue-break-discard-return-in-loop.amber", "cov-continue-break-discard-return-in-loop", "A fragment shader that covers specific NIR code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-copy-array-elements-except-first-nested-loop-replace-identical-values.amber", "cov-copy-array-elements-except-first-nested-loop-replace-identical-values", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-copy-output-color-swizzle-array-indexing.amber", "cov-copy-output-color-swizzle-array-indexing", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-copy-prop-arrays-no-stores.amber", "cov-copy-prop-arrays-no-stores", "A fragment shader that covers a specific propagate array copy path." }, +{ "cov-copy-prop-arrays-param-uniform.amber", "cov-copy-prop-arrays-param-uniform", "A fragment shader that covers a specific propagate array copy path." }, +{ "cov-cosh-clamped-to-one.amber", "cov-cosh-clamped-to-one", "A fragment shader that covers specific NIR code paths" }, +{ "cov-cumulate-loops-unreachable.amber", "cov-cumulate-loops-unreachable", "A fragment shader that covers specific NIR code paths" }, +{ "cov-dag-combiner-clamp-undefined-access-array.amber", "cov-dag-combiner-clamp-undefined-access-array", "A fragment shader that covers a specific DAG combiner code path" }, +{ "cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop.amber", "cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop", "Covers DAG combiner, cast combining and legalize vector types code paths" }, +{ "cov-dag-combiner-findmsb-loop.amber", "cov-dag-combiner-findmsb-loop", "A fragment shader that covers a specific DAG combiner code path" }, +{ "cov-dag-combiner-increment-color.amber", "cov-dag-combiner-increment-color", "A fragment shader that covers a specific DAG combiner code path" }, +{ "cov-dag-combiner-glf_color.amber", "cov-dag-combiner-glf_color", "A fragment shader that covers specific dag combiner code path" }, +{ "cov-dag-combiner-loop-bitfieldreverse.amber", "cov-dag-combiner-loop-bitfieldreverse", "A fragment shader that covers a specific DAG combiner code path" }, +{ "cov-dag-combiner-neg-div-pow2.amber", "cov-dag-combiner-neg-div-pow2", "A fragment shader that covers a specific DAG combiner code path" }, +{ "cov-dag-combiner-same-cond-nested.amber", "cov-dag-combiner-same-cond-nested", "A fragment shader that covers a specific DAG combiner code path" }, +{ "cov-dead-branch-func-return-arg.amber", "cov-dead-branch-func-return-arg", "A fragment shader that covers a specific dead branch elimination path" }, +{ "cov-dead-code-unreachable-merge.amber", "cov-dead-code-unreachable-merge", "A fragment shader that covers a specific dead code elimination path." }, +{ "cov-decrement-vector-elements-clamp-index.amber", "cov-decrement-vector-elements-clamp-index", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-derivative-uniform-vector-global-loop-count.amber", "cov-derivative-uniform-vector-global-loop-count", "A fragment shader that covers specific BRW code paths" }, +{ "cov-descending-loop-index-temporary-array.amber", "cov-descending-loop-index-temporary-array", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-descending-loop-min-max-always-zero.amber", "cov-descending-loop-min-max-always-zero", "A fragment shader that covers specific BRW code paths" }, +{ "cov-determinant-uninitialized-matrix-never-chosen.amber", "cov-determinant-uninitialized-matrix-never-chosen", "A fragment shader that covers specific BRW code paths" }, +{ "cov-dfdx-dfdy-after-nested-loops.amber", "cov-dfdx-dfdy-after-nested-loops", "A fragment shader that covers specific BRW code paths" }, +{ "cov-discard-condition-loop-same-condition-again.amber", "cov-discard-condition-loop-same-condition-again", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-divide-matrix-transpose-by-constant.amber", "cov-divide-matrix-transpose-by-constant", "A fragment shader that covers specific VTN code path" }, +{ "cov-do-while-loop-until-uniform-lt-itself.amber", "cov-do-while-loop-until-uniform-lt-itself", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-do-while-negative-iterator-nested-loops-increment-array-element.amber", "cov-do-while-negative-iterator-nested-loops-increment-array-element", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-do-while-switch-case-bitcount-findmsb.amber", "cov-do-while-switch-case-bitcount-findmsb", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-double-if-true-in-loop.amber", "cov-double-if-true-in-loop", "A fragment shader that covers specific NIR code paths" }, +{ "cov-double-negation-fragcoord-cast-ivec2-bitwise-and.amber", "cov-double-negation-fragcoord-cast-ivec2-bitwise-and", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-dummy-function-loop-array-element-increment-never-read.amber", "cov-dummy-function-loop-array-element-increment-never-read", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-empty-loop-minus-one-modulo-variable-one.amber", "cov-empty-loop-minus-one-modulo-variable-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-enable-bits-pixel-location-negate-not-equal-one.amber", "cov-enable-bits-pixel-location-negate-not-equal-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-exp2-two.amber", "cov-exp2-two", "A fragment shader that covers specific NIR code paths" }, +{ "cov-extend-uniform-vec2-to-vec3-matrix-multiply.amber", "cov-extend-uniform-vec2-to-vec3-matrix-multiply", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-find-msb-input-either-zero-or-minus-one.amber", "cov-find-msb-input-either-zero-or-minus-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-findlsb-division-by-zero.amber", "cov-findlsb-division-by-zero", "A fragment shader that covers a specific instruction simplify code path" }, +{ "cov-float-array-init-pow.amber", "cov-float-array-init-pow", "A fragment shader that covers specific arith builder code path" }, +{ "cov-fold-and-in-for-loop-range.amber", "cov-fold-and-in-for-loop-range", "A fragment shader that covers a specific folding path" }, +{ "cov-fold-bitwise-and-zero.amber", "cov-fold-bitwise-and-zero", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-fold-bitwise-or-full-mask.amber", "cov-fold-bitwise-or-full-mask", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-fold-bitwise-xor.amber", "cov-fold-bitwise-xor", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-fold-logical-and-const-variable.amber", "cov-fold-logical-and-const-variable", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-fold-logical-and-constant.amber", "cov-fold-logical-and-constant", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-fold-logical-or-constant.amber", "cov-fold-logical-or-constant", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-fold-negate-min-int-value.amber", "cov-fold-negate-min-int-value", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-fold-negate-variable.amber", "cov-fold-negate-variable", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-fold-shift-gte32.amber", "cov-fold-shift-gte32", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-fold-shift-right-arithmetic.amber", "cov-fold-shift-right-arithmetic", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-fold-switch-udiv.amber", "cov-fold-switch-udiv", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-clamp-cmp-const-first.amber", "cov-folding-clamp-cmp-const-first", "A fragment shader that covers a specific constant folding path" }, +{ "cov-folding-merge-add-sub-uniform.amber", "cov-folding-merge-add-sub-uniform", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-construct-extract.amber", "cov-folding-rules-construct-extract", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-dot-extract.amber", "cov-folding-rules-dot-extract", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-dot-no-extract.amber", "cov-folding-rules-dot-no-extract", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-merge-add-sub.amber", "cov-folding-rules-merge-add-sub", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-merge-div-mul.amber", "cov-folding-rules-merge-div-mul", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-merge-divs.amber", "cov-folding-rules-merge-divs", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-merge-mul-div.amber", "cov-folding-rules-merge-mul-div", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-merge-sub-add.amber", "cov-folding-rules-merge-sub-add", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-merge-sub-sub.amber", "cov-folding-rules-merge-sub-sub", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-merge-var-sub.amber", "cov-folding-rules-merge-var-sub", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-mix-uniform-weight.amber", "cov-folding-rules-mix-uniform-weight", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-negate-div.amber", "cov-folding-rules-negate-div", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-negate-sub.amber", "cov-folding-rules-negate-sub", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-redundant-mix.amber", "cov-folding-rules-redundant-mix", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-shuffle-extract.amber", "cov-folding-rules-shuffle-extract", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-shuffle-mix.amber", "cov-folding-rules-shuffle-mix", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-split-vector-init.amber", "cov-folding-rules-split-vector-init", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-vec-mix-uniform.amber", "cov-folding-rules-vec-mix-uniform", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-for-array-initializing-modulo.amber", "cov-for-array-initializing-modulo", "A fragment shader that covers a specific inst combine compares code path" }, +{ "cov-for-loop-condition-one-shift-right-integer-comparison-break.amber", "cov-for-loop-condition-one-shift-right-integer-comparison-break", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-for-loop-min-increment-array-element.amber", "cov-for-loop-min-increment-array-element", "A fragment shader that covers specific NIR code paths" }, +{ "cov-for-loop-start-negative-increment-variable.amber", "cov-for-loop-start-negative-increment-variable", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-for-loop-struct-as-iterator.amber", "cov-for-loop-struct-as-iterator", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-for-switch-fallthrough.amber", "cov-for-switch-fallthrough", "A fragment shader that covers a specific inst combine and or xor code path" }, +{ "cov-fract-asin-undefined-never-used.amber", "cov-fract-asin-undefined-never-used", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_float_controls", "FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32"}, +{ "cov-fract-smoothstep-undefined.amber", "cov-fract-smoothstep-undefined", "A fragment shader that covers a specific APFloat code path" }, +{ "cov-fract-trunc-always-zero.amber", "cov-fract-trunc-always-zero", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-fragcood-multiple-conditions-function-loop-global-counter.amber", "cov-fragcood-multiple-conditions-function-loop-global-counter", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-fragcoord-and-one-or-same-value.amber", "cov-fragcoord-and-one-or-same-value", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-fragcoord-bitwise-and-loop-reduce-value-index-array.amber", "cov-fragcoord-bitwise-and-loop-reduce-value-index-array", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-fragcoord-bitwise-not.amber", "cov-fragcoord-bitwise-not", "A fragment shader that covers specific BRW code paths" }, +{ "cov-fragcoord-clamp-array-access.amber", "cov-fragcoord-clamp-array-access", "A fragment shader that covers a specific instruction simplify path" }, +{ "cov-fragcoord-conditions-never-return-index-array-using-uniform.amber", "cov-fragcoord-conditions-never-return-index-array-using-uniform", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-fragcoord-integer-loop-reduce-to-range.amber", "cov-fragcoord-integer-loop-reduce-to-range", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-fragcoord-loop-limit-negative-decrease-sum-first-iteration.amber", "cov-fragcoord-loop-limit-negative-decrease-sum-first-iteration", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-fragcoord-multiple-conditions-function-global-loop-counter-simplified.amber", "cov-fragcoord-multiple-conditions-function-global-loop-counter-simplified", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-fragcoord-multiply.amber", "cov-fragcoord-multiply", "A fragment shader that covers specific NIR code paths" }, +{ "cov-fragcoord-select-always-one.amber", "cov-fragcoord-select-always-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-always-return-negative-bitfield-extract.amber", "cov-function-always-return-negative-bitfield-extract", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-argument-uniform-float-loop-never-return.amber", "cov-function-argument-uniform-float-loop-never-return", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-check-argument-one-always-return-minus-one.amber", "cov-function-check-argument-one-always-return-minus-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-clamp-min-identical-shift-right.amber", "cov-function-clamp-min-identical-shift-right", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-call-twice-clamp-global-variable.amber", "cov-function-call-twice-clamp-global-variable", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-divide-argument-until-lt-one.amber", "cov-function-divide-argument-until-lt-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-find-lsb-ivec2-one.amber", "cov-function-find-lsb-ivec2-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-fragcoord-condition-always-return.amber", "cov-function-fragcoord-condition-always-return", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-global-loop-counter-sample-texture.amber", "cov-function-global-loop-counter-sample-texture", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-global-variables-fragcoord-condition-call-twice.amber", "cov-function-global-variables-fragcoord-condition-call-twice", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-index-array-redundant-clamps.amber", "cov-function-index-array-redundant-clamps", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-infinite-loop-always-return.amber", "cov-function-infinite-loop-always-return", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-infinite-loop-return-identical-condition.amber", "cov-function-infinite-loop-return-identical-condition", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-large-array-max-clamp.amber", "cov-function-large-array-max-clamp", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-large-loop-always-return-first-iteration.amber", "cov-function-large-loop-always-return-first-iteration", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-large-loop-break-argument-lte-global-loop-bound.amber", "cov-function-large-loop-break-argument-lte-global-loop-bound", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-loop-check-determinant-zero-return-vector.amber", "cov-function-loop-check-determinant-zero-return-vector", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-loop-clamp-no-effect.amber", "cov-function-loop-clamp-no-effect", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-loop-condition-constant-array-always-false.amber", "cov-function-loop-condition-constant-array-always-false", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-function-loop-condition-uniform-shift-right.amber", "cov-function-loop-condition-uniform-shift-right", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-loop-condition-variable-less-than-min-itself.amber", "cov-function-loop-condition-variable-less-than-min-itself", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-loop-copy-array-elements-based-on-arguments.amber", "cov-function-loop-copy-array-elements-based-on-arguments", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-loop-modify-ivec-components-infinite-loop-never-executed.amber", "cov-function-loop-modify-ivec-components-infinite-loop-never-executed", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-loop-same-conditions-multiple-times-struct-array.amber", "cov-function-loop-same-conditions-multiple-times-struct-array", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-loop-switch-increment-array-element-return.amber", "cov-function-loop-switch-increment-array-element-return", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-max-all-ones-select-always-true.amber", "cov-function-max-all-ones-select-always-true", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-min-identical-integer-division-multiplication.amber", "cov-function-min-identical-integer-division-multiplication", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-min-integer-large-shift-unused.amber", "cov-function-min-integer-large-shift-unused", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-loop-variable-multiplied-unused.amber", "cov-function-loop-variable-multiplied-unused", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-loops-vector-mul-matrix-never-executed.amber", "cov-function-loops-vector-mul-matrix-never-executed", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-multiple-loops-compare-integer-return.amber", "cov-function-multiple-loops-compare-integer-return", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-nested-do-whiles-looped-once.amber", "cov-function-nested-do-whiles-looped-once", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-nested-loops-break-early-never-discard.amber", "cov-function-nested-loops-break-early-never-discard", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-function-nested-loops-limit-uniform-xor-uniform.amber", "cov-function-nested-loops-limit-uniform-xor-uniform", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-set-struct-field-zero-loop-reset-first-element.amber", "cov-function-set-struct-field-zero-loop-reset-first-element", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-parameter-zero-divided-by-uniform.amber", "cov-function-parameter-zero-divided-by-uniform", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-round-unpack-half-2x16.amber", "cov-function-round-unpack-half-2x16", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-struct-int-array-loop-check-element.amber", "cov-function-struct-int-array-loop-check-element", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-switch-case-constant-clamp-transpose-identity-matrices.amber", "cov-function-switch-case-constant-clamp-transpose-identity-matrices", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-trivial-switch-case.amber", "cov-function-trivial-switch-case", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-two-loops-limit-using-arguments-array-element-copies.amber", "cov-function-two-loops-limit-using-arguments-array-element-copies", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-undefined-shift-left-index-array-with-return-value.amber", "cov-function-undefined-shift-left-index-array-with-return-value", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-unpack-unorm-2x16-one.amber", "cov-function-unpack-unorm-2x16-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-unused-argument-single-loop-iteration-icrement-global-counter.amber", "cov-function-unused-argument-single-loop-iteration-icrement-global-counter", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-variable-plus-one-minus-one.amber", "cov-function-variable-plus-one-minus-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-function-vec2-never-discard.amber", "cov-function-vec2-never-discard", "A fragment shader that covers specific BRW code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-function-with-nested-loops-called-from-nested-loops.amber", "cov-function-with-nested-loops-called-from-nested-loops", "A fragment shader that covers specific BRW code paths" }, +{ "cov-global-loop-bound-true-logical-or.amber", "cov-global-loop-bound-true-logical-or", "A fragment shader that covers specific NIR code paths" }, +{ "cov-global-loop-count-array-struct-field-set-int-array-element.amber", "cov-global-loop-count-array-struct-field-set-int-array-element", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-global-loop-counter-accumulate-integer-condition-large-array-elements.amber", "cov-global-loop-counter-accumulate-integer-condition-large-array-elements", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-global-loop-counter-exhaust-calling-function-twice.amber", "cov-global-loop-counter-exhaust-calling-function-twice", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-global-loop-counter-findlsb-zero.amber", "cov-global-loop-counter-findlsb-zero", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-global-loop-counter-float-accumulate-matrix.amber", "cov-global-loop-counter-float-accumulate-matrix", "A fragment shader that covers specific BRW code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-global-loop-counter-for-loop-function-call-inside-never-called.amber", "cov-global-loop-counter-for-loop-function-call-inside-never-called", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-global-loop-counter-main-function-call.amber", "cov-global-loop-counter-main-function-call", "A fragment shader that covers specific NIR code paths" }, +{ "cov-global-loop-counter-multiply-one-minus.amber", "cov-global-loop-counter-multiply-one-minus", "A fragment shader that covers specific BRW code paths" }, +{ "cov-global-loop-counter-read-past-matrix-size-never-executed.amber", "cov-global-loop-counter-read-past-matrix-size-never-executed", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-global-loop-counter-select-one-or-zero-never-greater-than-one.amber", "cov-global-loop-counter-select-one-or-zero-never-greater-than-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-global-loop-counter-set-array-element-once-index-using-findmsb.amber", "cov-global-loop-counter-set-array-element-once-index-using-findmsb", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-global-loop-counter-squared-comparison.amber", "cov-global-loop-counter-squared-comparison", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-global-loop-counter-texture-sample-loop-condition-set-array-element.amber", "cov-global-loop-counter-texture-sample-loop-condition-set-array-element", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-if-conversion-identical-branches.amber", "cov-if-conversion-identical-branches", "A fragment shader that covers a specific if condition conversion path." }, +{ "cov-if-switch-fallthrough.amber", "cov-if-switch-fallthrough", "A fragment shader that covers a specific inst combine and or xor code path" }, +{ "cov-if-true-continue.amber", "cov-if-true-continue", "A fragment shader that covers specific NIR code paths" }, +{ "cov-if-true-discard-in-do-while-never-reached.amber", "cov-if-true-discard-in-do-while-never-reached", "A fragment shader that covers specific NIR code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-if-true-float-bits-to-int-one.amber", "cov-if-true-float-bits-to-int-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-inc-array-element-loop-lsb.amber", "cov-inc-array-element-loop-lsb", "A fragment shader that covers a specific SSCP path" }, +{ "cov-inc-inside-switch-and-for.amber", "cov-inc-inside-switch-and-for", "A fragment shader that covers a specific LLVM analysis code path." }, +{ "cov-increment-array-element-in-loop.amber", "cov-increment-array-element-in-loop", "A fragment shader that covers specific NIR code paths" }, +{ "cov-increment-array-element-usub-borrow.amber", "cov-increment-array-element-usub-borrow", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-increment-float-in-loop-abs.amber", "cov-increment-float-in-loop-abs", "A fragment shader that covers specific BRW code paths" }, +{ "cov-increment-global-counter-loop-function.amber", "cov-increment-global-counter-loop-function", "A fragment shader that covers specific NIR code paths" }, +{ "cov-increment-inside-clamp.amber", "cov-increment-inside-clamp", "A fragment shader that covers specific value tracking and simplification paths" }, +{ "cov-increment-int-loop-counter-mod-array.amber", "cov-increment-int-loop-counter-mod-array", "A fragment shader that covers specific BRW code paths" }, +{ "cov-increment-multiple-integers.amber", "cov-increment-multiple-integers", "A fragment shader that covers specific NIR code paths" }, +{ "cov-increment-one-array-element-check-index-from-fragcoord.amber", "cov-increment-one-array-element-check-index-from-fragcoord", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-increment-vector-array-matrix-element.amber", "cov-increment-vector-array-matrix-element", "A fragment shader that covers specific NIR code paths" }, +{ "cov-increment-vector-component-with-matrix-copy.amber", "cov-increment-vector-component-with-matrix-copy", "A fragment shader that covers specific NIR code paths" }, +{ "cov-increment-vector-function-call-conditional.amber", "cov-increment-vector-function-call-conditional", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-index-array-using-uniform-bitwise-or-one.amber", "cov-index-array-using-uniform-bitwise-or-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-initialize-integer-array-variable-divided-by-itself.amber", "cov-initialize-integer-array-variable-divided-by-itself", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-inline-pass-empty-block.amber", "cov-inline-pass-empty-block", "A fragment shader that covers a specific inlining optimization path." }, +{ "cov-inline-pass-nested-loops.amber", "cov-inline-pass-nested-loops", "A fragment shader that covers a specific inlining optimization path." }, +{ "cov-inline-pass-return-in-loop.amber", "cov-inline-pass-return-in-loop", "A fragment shader that covers a specific inlining optimization path." }, +{ "cov-inline-pass-unreachable-func.amber", "cov-inline-pass-unreachable-func", "A fragment shader that covers a specific inlining optimization path." }, +{ "cov-inst-combine-add-sub-ldexp.amber", "cov-inst-combine-add-sub-ldexp", "A fragment shader that covers specific inst combine add sub code paths" }, +{ "cov-inst-combine-add-sub-pre-increase.amber", "cov-inst-combine-add-sub-pre-increase", "Covers specific inst combine add sub and dag combiner code paths" }, +{ "cov-inst-combine-compares-while-modulo.amber", "cov-inst-combine-compares-while-modulo", "A fragment shader that covers a specific inst combine compares code path" }, +{ "cov-inst-combine-shifts-left-shift-for.amber", "cov-inst-combine-shifts-left-shift-for", "A fragment shader that covers a specific inst combine shifts code path" }, +{ "cov-inst-peephole-optimizer-acosh.amber", "cov-inst-peephole-optimizer-acosh", "A fragment shader that covers a specific peephole optimizer code path", "VK_KHR_shader_terminate_invocation"}, +{ "cov-inst-value-tracking-inversesqrt.amber", "cov-inst-value-tracking-inversesqrt", "A fragment shader that covers a specific value tracking path" }, +{ "cov-instr-emitter-pow-asinh.amber", "cov-instr-emitter-pow-asinh", "A fragment shader that covers a specific instruction emitter code path" }, +{ "cov-instruction-simplify-atanh-log-undefined.amber", "cov-instruction-simplify-atanh-log-undefined", "A fragment shader that covers a specific instruction simplification path", "VK_KHR_shader_float_controls", "FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32"}, +{ "cov-instruction-simplify-bit-shifting.amber", "cov-instruction-simplify-bit-shifting", "A fragment shader that covers a specific instruction simplification path" }, +{ "cov-instruction-simplify-inclusive-or.amber", "cov-instruction-simplify-inclusive-or", "A fragment shader that covers a specific instruction simplification path" }, +{ "cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result.amber", "cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result", "A fragment shader that covers a specific instruction simplification path" }, +{ "cov-instruction-simplify-mod-acos-undefined.amber", "cov-instruction-simplify-mod-acos-undefined", "A fragment shader that covers a specific instruction simplification path", "VK_KHR_shader_float_controls", "FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32"}, +{ "cov-instruction-simplify-mod-sqrt-undefined.amber", "cov-instruction-simplify-mod-sqrt-undefined", "A fragment shader that covers a specific instruction simplification path", "VK_KHR_shader_float_controls", "FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32"}, +{ "cov-instruction-simplify-sqrt.amber", "cov-instruction-simplify-sqrt", "A fragment shader that covers a specific instruction simplify code path" }, +{ "cov-instructions-first-value-phi.amber", "cov-instructions-first-value-phi", "A fragment shader that covers a specific instructions code path", "VK_KHR_shader_terminate_invocation"}, +{ "cov-inst-combine-add-sub-determinant.amber", "cov-inst-combine-add-sub-determinant", "A fragment shader that covers a specific inst combine add sub code path" }, +{ "cov-inst-combine-add-sub-increase-negative.amber", "cov-inst-combine-add-sub-increase-negative", "A fragment shader that covers a specific inst combine add sub code path" }, +{ "cov-inst-combine-add-sub-neg-func-arg.amber", "cov-inst-combine-add-sub-neg-func-arg", "A fragment shader that covers a specific add/sub combining path" }, +{ "cov-inst-combine-and-or-xor-pack-unpack.amber", "cov-inst-combine-and-or-xor-pack-unpack", "A fragment shader that covers a specific inst combine and or xor code path" }, +{ "cov-inst-combine-and-or-xor-switch.amber", "cov-inst-combine-and-or-xor-switch", "A fragment shader that covers a specific inst combine and or xor code path" }, +{ "cov-inst-combine-and-or-xor-xor-add.amber", "cov-inst-combine-and-or-xor-xor-add", "A fragment shader that covers a specific inst combine and or xor code path" }, +{ "cov-inst-combine-compares-combine-select-uaddcarry.amber", "cov-inst-combine-compares-combine-select-uaddcarry", "Covers a specific instruction combine compares and combine select code paths" }, +{ "cov-inst-combine-compares-isnan.amber", "cov-inst-combine-compares-isnan", "A fragment shader that covers a specific instruction combine compare code path" }, +{ "cov-inst-combine-compares-ldexp.amber", "cov-inst-combine-compares-ldexp", "A fragment shader that covers a specific instruction combine compares code path" }, +{ "cov-inst-combine-compares-ternary-vector-access.amber", "cov-inst-combine-compares-ternary-vector-access", "A fragment shader that covers a specific instruction combine compare code path" }, +{ "cov-inst-combine-shifts-bitfield-bitcount.amber", "cov-inst-combine-shifts-bitfield-bitcount", "A fragment shader that covers a specific instruction combine shifts code path" }, +{ "cov-inst-combine-shifts-mix-mix-clamp.amber", "cov-inst-combine-shifts-mix-mix-clamp", "A fragment shader that covers a specific instruction combine shifts code path" }, +{ "cov-instr-info-det-mat-min.amber", "cov-instr-info-det-mat-min", "A fragment shader that covers a specific instr info code path" }, +{ "cov-instructions-for-if-less-than-equal.amber", "cov-instructions-for-if-less-than-equal", "Covers specific instruction simplify and combine compare code paths" }, +{ "cov-inst-combine-and-or-xor-for-bitfieldinsert.amber", "cov-inst-combine-and-or-xor-for-bitfieldinsert", "A fragment shader that covers a specific inst combine and or xor code path" }, +{ "cov-inst-combine-compares-pre-increment-clamp.amber", "cov-inst-combine-compares-pre-increment-clamp", "A fragment shader that covers a specific inst combine compares code path" }, +{ "cov-inst-combine-mul-div-rem-if-undefined-divide-mix.amber", "cov-inst-combine-mul-div-rem-if-undefined-divide-mix", "A fragment shader that covers a specific inst combine mul div rem code path" }, +{ "cov-inst-combine-pack-unpack.amber", "cov-inst-combine-pack-unpack", "Covers specific combine shifts and combine simplify demanded code paths" }, +{ "cov-inst-combine-select-findlsb-uaddcarry.amber", "cov-inst-combine-select-findlsb-uaddcarry", "A fragment shader that covers a specific instruction combine select code path" }, +{ "cov-inst-combine-simplify-demanded-pack-unpack.amber", "cov-inst-combine-simplify-demanded-pack-unpack", "Covers a specific instruction combine simplify demanded code path" }, +{ "cov-inst-combine-simplify-demanded-packsnorm-unpackunorm.amber", "cov-inst-combine-simplify-demanded-packsnorm-unpackunorm", "Covers a specific instruction combine simplify demanded code path" }, +{ "cov-inst-combine-simplify-demanded-switch-or-xor.amber", "cov-inst-combine-simplify-demanded-switch-or-xor", "A fragment shader that covers a specific inst combine simplify demanded path" }, +{ "cov-inst-combine-vector-ops-asin.amber", "cov-inst-combine-vector-ops-asin", "A fragment shader that covers specific inst combine vector ops code paths" }, +{ "cov-int-div-round-to-zero.amber", "cov-int-div-round-to-zero", "A fragment shader that covers specific fast idiv code path" }, +{ "cov-int-full-bits-divide-by-two-loop.amber", "cov-int-full-bits-divide-by-two-loop", "A fragment shader that covers specific BRW code paths" }, +{ "cov-int-initialize-from-multiple-large-arrays.amber", "cov-int-initialize-from-multiple-large-arrays", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-integer-constant-mod-variable-increased-condition-array-element.amber", "cov-integer-constant-mod-variable-increased-condition-array-element", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-integer-minus-one-increased-before-indexing-array.amber", "cov-integer-minus-one-increased-before-indexing-array", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-integer-modulo-negative.amber", "cov-integer-modulo-negative", "A fragment shader that covers specific instruction combining code paths" }, +{ "cov-integer-variable-or-with-inversion.amber", "cov-integer-variable-or-with-inversion", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-intervalmap-set-stop.amber", "cov-intervalmap-set-stop", "A fragment shader that covers a specific interval map code path." }, +{ "cov-ir-builder-constant-fold-inst-combine-calls-value-tracking-findmsb-incr-if.amber", "cov-ir-builder-constant-fold-inst-combine-calls-value-tracking-findmsb-incr-if", "Covers IR builder, constant fold, inst combine calls and value tracking code paths"}, +{ "cov-irbuilder-matrix-cell-uniform.amber", "cov-irbuilder-matrix-cell-uniform", "A fragment shader that covers a specific IR builder path." }, +{ "cov-isnan-asinh-clamp-always-zero.amber", "cov-isnan-asinh-clamp-always-zero", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-ivec-from-uniform-float-shift-right-add-components.amber", "cov-ivec-from-uniform-float-shift-right-add-components", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-ivec-shift-right-by-large-number.amber", "cov-ivec-shift-right-by-large-number", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-large-for-loop-exit-early-set-iterator-array-element.amber", "cov-large-for-loop-exit-early-set-iterator-array-element", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-large-int-array-nested-loops-set-ivec-index-component-sum.amber", "cov-large-int-array-nested-loops-set-ivec-index-component-sum", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-large-loop-break-early-condition-iterator-divided.amber", "cov-large-loop-break-early-condition-iterator-divided", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-large-loop-multiply-integer-by-uniform-one.amber", "cov-large-loop-multiply-integer-by-uniform-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-large-number-of-false-conditions-return-discard-continue.amber", "cov-large-number-of-false-conditions-return-discard-continue", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-ldexp-exponent-undefined-divided-fragcoord-never-executed.amber", "cov-ldexp-exponent-undefined-divided-fragcoord-never-executed", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-ldexp-undefined-mat-vec-multiply.amber", "cov-ldexp-undefined-mat-vec-multiply", "Covers specific inst combine simplify demanded and inst combine shifts path" }, +{ "cov-left-shift-array-access.amber", "cov-left-shift-array-access", "A fragment shader that covers a specific inst combine shifts code path" }, +{ "cov-left-shift-right-shift-compare.amber", "cov-left-shift-right-shift-compare", "A fragment shader that covers a specific inst combine compares code path" }, +{ "cov-liveinterval-different-dest.amber", "cov-liveinterval-different-dest", "A fragment shader that covers a specific live interval code path." }, +{ "cov-loop-abs-multiply-offset.amber", "cov-loop-abs-multiply-offset", "A fragment shader that covers specific NIR code paths" }, +{ "cov-loop-array-element-bitfield-insert-undefined-never-read.amber", "cov-loop-array-element-bitfield-insert-undefined-never-read", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-array-element-copy-index-clamp-sign.amber", "cov-loop-array-element-copy-index-clamp-sign", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-array-index-decrement-never-negative.amber", "cov-loop-array-index-decrement-never-negative", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-array-struct-field-index-array-with-uniforms.amber", "cov-loop-array-struct-field-index-array-with-uniforms", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-break-after-first-iteration-set-array-element.amber", "cov-loop-break-after-first-iteration-set-array-element", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-break-floor-nan-never-executed.amber", "cov-loop-break-floor-nan-never-executed", "A fragment shader that covers specific NIR code paths" }, +{ "cov-loop-break-fragcoord-x-empty-loop.amber", "cov-loop-break-fragcoord-x-empty-loop", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-clamp-to-one-empty-condition.amber", "cov-loop-clamp-to-one-empty-condition", "A fragment shader that covers specific NIR code paths" }, +{ "cov-loop-condition-bitfield-extract-set-array-elements.amber", "cov-loop-condition-bitfield-extract-set-array-elements", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-condition-clamp-vec-of-ones.amber", "cov-loop-condition-clamp-vec-of-ones", "A fragment shader that covers specific NIR code paths" }, +{ "cov-loop-condition-constant-struct-field-data.amber", "cov-loop-condition-constant-struct-field-data", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-condition-divide-by-uniform-always-false.amber", "cov-loop-condition-divide-by-uniform-always-false", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-condition-double-negate.amber", "cov-loop-condition-double-negate", "A fragment shader that covers specific NIR code paths" }, +{ "cov-loop-condition-filter-some-iterations-never-discard.amber", "cov-loop-condition-filter-some-iterations-never-discard", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-loop-condition-increment-integer-fallback-global-counter.amber", "cov-loop-condition-increment-integer-fallback-global-counter", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-condition-logical-or-never-iterated.amber", "cov-loop-condition-logical-or-never-iterated", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-decrease-integer-never-break.amber", "cov-loop-decrease-integer-never-break", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-construct-vec4-from-vec4-clamp-same-min-max.amber", "cov-loop-construct-vec4-from-vec4-clamp-same-min-max", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-decrease-vector-components-assign-multiple-times.amber", "cov-loop-decrease-vector-components-assign-multiple-times", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-decrease-vector-component-only-first-iteration.amber", "cov-loop-decrease-vector-component-only-first-iteration", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-dfdx-constant-divide.amber", "cov-loop-dfdx-constant-divide", "A fragment shader that covers specific patch optimization code paths" }, +{ "cov-loop-exit-conditions-sampler-struct-integer-variable.amber", "cov-loop-exit-conditions-sampler-struct-integer-variable", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-divide-uninitialized-vector-min-unused.amber", "cov-loop-divide-uninitialized-vector-min-unused", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-find-lsb-eight-fragcoord-never-discard.amber", "cov-loop-find-lsb-eight-fragcoord-never-discard", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-loop-findmsb-findlsb.amber", "cov-loop-findmsb-findlsb", "A fragment shader that covers specific simplification and value tracking paths" }, +{ "cov-loop-fragcoord-identical-condition.amber", "cov-loop-fragcoord-identical-condition", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-loop-function-call-vector-matrix-multiplication.amber", "cov-loop-function-call-vector-matrix-multiplication", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-global-counter-break-set-ivec-elements.amber", "cov-loop-global-counter-break-set-ivec-elements", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-function-call-negative-argument.amber", "cov-loop-function-call-negative-argument", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-global-counter-increment-iterator-select-uniform.amber", "cov-loop-global-counter-increment-iterator-select-uniform", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-increase-iterator-condition-uniform-copy-array-elements.amber", "cov-loop-increase-iterator-condition-uniform-copy-array-elements", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-increment-array-elements-clamp-index.amber", "cov-loop-increment-array-elements-clamp-index", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-increment-array-index-array-usuborrow-feedback.amber", "cov-loop-increment-array-index-array-usuborrow-feedback", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-increment-integer-findmsb-minus-uniform.amber", "cov-loop-increment-integer-findmsb-minus-uniform", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-increment-integer-set-output-color-break.amber", "cov-loop-increment-integer-set-output-color-break", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-increment-matrix-element-break-after-first-iteration.amber", "cov-loop-increment-matrix-element-break-after-first-iteration", "A fragment shader that covers specific NIR code paths" }, +{ "cov-loop-increment-or-divide-by-loop-index.amber", "cov-loop-increment-or-divide-by-loop-index", "A fragment shader that covers specific NIR code paths" }, +{ "cov-loop-index-array-max-negative-zero.amber", "cov-loop-index-array-max-negative-zero", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-integer-half-minus-one.amber", "cov-loop-integer-half-minus-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-iterator-bitwise-negate.amber", "cov-loop-iterator-bitwise-negate", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-iterator-limit-xor-and-unifrom.amber", "cov-loop-iterator-limit-xor-and-unifrom", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-iterator-plus-one-variable-outside-index-array.amber", "cov-loop-iterator-plus-one-variable-outside-index-array", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-iterator-start-select-uniform-negative-integer.amber", "cov-loop-iterator-start-select-uniform-negative-integer", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-large-array-index-clamp-negative-value.amber", "cov-loop-large-array-index-clamp-negative-value", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-iterator-start-shift-left-right.amber", "cov-loop-iterator-start-shift-left-right", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-limiter-min-findlsb.amber", "cov-loop-limiter-min-findlsb", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-limiter-uniform-bitwise-and-one-always-break.amber", "cov-loop-limiter-uniform-bitwise-and-one-always-break", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-logical-xor.amber", "cov-loop-logical-xor", "A fragment shader that covers specific NIR code paths" }, +{ "cov-loop-multiple-iterator-variables-copy-array-elements.amber", "cov-loop-multiple-iterator-variables-copy-array-elements", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-never-iterated-constant-vector-condition.amber", "cov-loop-never-iterated-constant-vector-condition", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-read-array-index-from-array-data.amber", "cov-loop-read-array-index-from-array-data", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-max-divide-integer-by-ten.amber", "cov-loop-max-divide-integer-by-ten", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-overwrite-sample-texture-as-color-output.amber", "cov-loop-overwrite-sample-texture-as-color-output", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-min-max-clamp-increment-only-first-iteration.amber", "cov-loop-min-max-clamp-increment-only-first-iteration", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-replace-output-color-restore-original.amber", "cov-loop-replace-output-color-restore-original", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-returns-behind-true-and-false.amber", "cov-loop-returns-behind-true-and-false", "A fragment shader that covers specific NIR code paths" }, +{ "cov-loop-sampled-texel-integer-counter.amber", "cov-loop-sampled-texel-integer-counter", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-set-vector-components-pow-two.amber", "cov-loop-set-vector-components-pow-two", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-start-fragcoord-while-iterates-once.amber", "cov-loop-start-fragcoord-while-iterates-once", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-start-from-one-switch-case-invalid-color-never-executed.amber", "cov-loop-start-from-one-switch-case-invalid-color-never-executed", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-start-from-one-switch-case-never-executed.amber", "cov-loop-start-from-one-switch-case-never-executed", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-struct-array-field-set-value-self-dependency.amber", "cov-loop-struct-array-field-set-value-self-dependency", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-switch-discard-never-hit.amber", "cov-loop-switch-discard-never-hit", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-loop-two-iterators-increment-array-empty-do-while.amber", "cov-loop-two-iterators-increment-array-empty-do-while", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-variable-less-than-itself.amber", "cov-loop-variable-less-than-itself", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-loop-with-two-integers.amber", "cov-loop-with-two-integers", "A fragment shader that covers specific NIR code paths" }, +{ "cov-loops-and-conditions-fragcoord-always-false-floats-one.amber", "cov-loops-and-conditions-fragcoord-always-false-floats-one", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-loops-same-code-outside-loop.amber", "cov-loops-same-code-outside-loop", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-machine-scheduler-for-if-pow.amber", "cov-machine-scheduler-for-if-pow", "A fragment shader that covers a specific machine scheduler path", "VK_KHR_shader_terminate_invocation"}, +{ "cov-machine-basic-block-for-for-for-less-than.amber", "cov-machine-basic-block-for-for-for-less-than", "A fragment shader that covers a specific machine basic block code paths" }, +{ "cov-machinevaluetype-one-iter-loop.amber", "cov-machinevaluetype-one-iter-loop", "A fragment shader that covers a specific machine value type code path" }, +{ "cov-matching-conditions-break.amber", "cov-matching-conditions-break", "A fragment shader that covers specific NIR code paths" }, +{ "cov-matching-if-always-true-inside-loop.amber", "cov-matching-if-always-true-inside-loop", "A fragment shader that covers specific NIR code paths" }, +{ "cov-matrix-double-transpose.amber", "cov-matrix-double-transpose", "A fragment shader that covers specific NIR code paths" }, +{ "cov-matrix-mult-round-even-asinh.amber", "cov-matrix-mult-round-even-asinh", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-matrix-square-mul-with-vector.amber", "cov-matrix-square-mul-with-vector", "A fragment shader that covers specific NIR code paths" }, +{ "cov-max-clamp-same-minval.amber", "cov-max-clamp-same-minval", "A fragment shader that covers a specific instruction simplification path" }, +{ "cov-max-min-less-than.amber", "cov-max-min-less-than", "A fragment shader that covers a specific inst combine select code path" }, +{ "cov-mem-pass-sum-struct-members.amber", "cov-mem-pass-sum-struct-members", "A fragment shader that covers a specific mem pass code path." }, +{ "cov-mem-pass-unused-component.amber", "cov-mem-pass-unused-component", "A fragment shader that covers a specific mem pass code path." }, +{ "cov-merge-return-condition-twice.amber", "cov-merge-return-condition-twice", "A fragment shader that covers a specific return merge path." }, +{ "cov-min-identical-uint-uniform.amber", "cov-min-identical-uint-uniform", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-min-identical-uint-uniform-check-highest-bit.amber", "cov-min-identical-uint-uniform-check-highest-bit", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-min-intbitstofloat-undefined-never-used.amber", "cov-min-intbitstofloat-undefined-never-used", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-min-negative-constant-always-below-one.amber", "cov-min-negative-constant-always-below-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-min-nested-loop-same-value-for-variables.amber", "cov-min-nested-loop-same-value-for-variables", "A fragment shader that covers specific NIR code paths" }, +{ "cov-min-vec2-transpose-mat2-identity.amber", "cov-min-vec2-transpose-mat2-identity", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-missing-return-value-function-never-called.amber", "cov-missing-return-value-function-never-called", "A fragment shader that covers specific BRW code paths" }, +{ "cov-mix-uninitialized-float-never-selected.amber", "cov-mix-uninitialized-float-never-selected", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-mix-uninitialized-vector-select-only-defined-data.amber", "cov-mix-uninitialized-vector-select-only-defined-data", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-mod-acosh.amber", "cov-mod-acosh", "A fragment shader that calculates modulo of an acosh result" }, +{ "cov-mod-uint-bits-float.amber", "cov-mod-uint-bits-float", "A fragment shader that covers a specific APFloat path" }, +{ "cov-modf-clamp-for.amber", "cov-modf-clamp-for", "A fragment shader that covers a specific live intervals code path" }, +{ "cov-modf-integer-to-private.amber", "cov-modf-integer-to-private", "A fragment shader that covers a specific private to local path." }, +{ "cov-modulo-zero-never-executed.amber", "cov-modulo-zero-never-executed", "A fragment shader that covers specific NIR code paths" }, +{ "cov-multiple-fragcoord-conditions-false-never-return-sample-texture.amber", "cov-multiple-fragcoord-conditions-false-never-return-sample-texture", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-multiple-fragcoord-conditions-never-return-color-uninitialized.amber", "cov-multiple-fragcoord-conditions-never-return-color-uninitialized", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-multiple-functions-global-never-change.amber", "cov-multiple-functions-global-never-change", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-multiple-loops-same-condition-always-false-global-loop-counter.amber", "cov-multiple-loops-same-condition-always-false-global-loop-counter", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-multiple-one-iteration-loops-global-counter-write-matrices.amber", "cov-multiple-one-iteration-loops-global-counter-write-matrices", "A fragment shader that covers specific BRW code paths" }, +{ "cov-negative-integer-bitwise-or-uniform-increment-loop.amber", "cov-negative-integer-bitwise-or-uniform-increment-loop", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-functions-accumulate-global-matrix.amber", "cov-nested-functions-accumulate-global-matrix", "A fragment shader that covers specific NIR code paths" }, +{ "cov-nested-functions-compare-fragcood-length-zero-vector.amber", "cov-nested-functions-compare-fragcood-length-zero-vector", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-functions-loop-assign-global-array-element.amber", "cov-nested-functions-loop-assign-global-array-element", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-nested-functions-struct-arrays-vector-lengths.amber", "cov-nested-functions-struct-arrays-vector-lengths", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-functions-vec4-array-element-argument.amber", "cov-nested-functions-vec4-array-element-argument", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loop-continue-inner-copy-array-element.amber", "cov-nested-loop-continue-inner-copy-array-element", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loop-decrease-vector-components.amber", "cov-nested-loop-decrease-vector-components", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loop-initializer-value-increased-inside.amber", "cov-nested-loop-initializer-value-increased-inside", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loop-large-array-index-using-vector-components.amber", "cov-nested-loop-large-array-index-using-vector-components", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-nested-loop-not-greater-than-increment-array-element.amber", "cov-nested-loop-not-greater-than-increment-array-element", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loop-undefined-smoothstep-never-executed.amber", "cov-nested-loop-undefined-smoothstep-never-executed", "A fragment shader that covers specific BRW code paths" }, +{ "cov-nested-loops-assign-vector-elements-from-matrix-no-negative-indexing.amber", "cov-nested-loops-assign-vector-elements-from-matrix-no-negative-indexing", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-nested-loops-array-choose-red-last-iteration.amber", "cov-nested-loops-array-choose-red-last-iteration", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-clamp-ivec-push-constant-increment-global-counter.amber", "cov-nested-loops-clamp-ivec-push-constant-increment-global-counter", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-copy-array-elements-skip-first.amber", "cov-nested-loops-copy-array-elements-skip-first", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-decrease-ivec-component.amber", "cov-nested-loops-decrease-ivec-component", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-different-iteration-rates-function-copy-array-elements.amber", "cov-nested-loops-different-iteration-rates-function-copy-array-elements", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-divide-integer-constant-always-zero.amber", "cov-nested-loops-divide-integer-constant-always-zero", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-decrease-vector-component-by-matrix-element-global-loop-counter.amber", "cov-nested-loops-decrease-vector-component-by-matrix-element-global-loop-counter", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-float-array-select-by-fragcoord.amber", "cov-nested-loops-float-array-select-by-fragcoord", "A fragment shader that covers specific BRW code paths" }, +{ "cov-nested-loops-float-bits-to-int-increment-array.amber", "cov-nested-loops-float-bits-to-int-increment-array", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-fragcoord-conditions-empty-blocks.amber", "cov-nested-loops-fragcoord-conditions-empty-blocks", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-fragcoord-never-return-descending-loop.amber", "cov-nested-loops-fragcoord-never-return-descending-loop", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-global-counter-func-set-struct-field.amber", "cov-nested-loops-global-counter-func-set-struct-field", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-global-counter-increment-single-element.amber", "cov-nested-loops-global-counter-increment-single-element", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-global-loop-counter-do-while-accumulate-float.amber", "cov-nested-loops-global-loop-counter-do-while-accumulate-float", "A fragment shader that covers specific BRW code paths" }, +{ "cov-nested-loops-global-loop-counter-fragcoord-negative-always-false.amber", "cov-nested-loops-global-loop-counter-fragcoord-negative-always-false", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-global-loop-counter-index-array-vec2.amber", "cov-nested-loops-global-loop-counter-index-array-vec2", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-global-loop-counter-iterator-dependency.amber", "cov-nested-loops-global-loop-counter-iterator-dependency", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-global-loop-counter-output-color-from-backup.amber", "cov-nested-loops-global-loop-counter-output-color-from-backup", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-global-loop-counter-reached-second-iteration.amber", "cov-nested-loops-global-loop-counter-reached-second-iteration", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-identical-iterator-names-multiply-divide.amber", "cov-nested-loops-identical-iterator-names-multiply-divide", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-identical-iterators-compare-same-array-elements.amber", "cov-nested-loops-identical-iterators-compare-same-array-elements", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-increase-integer-dot-product.amber", "cov-nested-loops-increase-integer-dot-product", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-inner-loop-min-copy-array-elements.amber", "cov-nested-loops-inner-loop-min-copy-array-elements", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-iterator-times-two-while-min.amber", "cov-nested-loops-iterator-times-two-while-min", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-never-change-array-element-one.amber", "cov-nested-loops-never-change-array-element-one", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-nested-loops-redundant-condition.amber", "cov-nested-loops-redundant-condition", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-return-inside-while-never-executed.amber", "cov-nested-loops-return-inside-while-never-executed", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-sample-opposite-corners.amber", "cov-nested-loops-sample-opposite-corners", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-select-starting-value-fragcoord.amber", "cov-nested-loops-select-starting-value-fragcoord", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-set-struct-data-verify-in-function.amber", "cov-nested-loops-set-struct-data-verify-in-function", "A fragment shader that covers specific BRW code paths" }, +{ "cov-nested-loops-substract-matrix-element-change-float.amber", "cov-nested-loops-substract-matrix-element-change-float", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-switch-case-fallthrough-increment-array-element.amber", "cov-nested-loops-switch-case-fallthrough-increment-array-element", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-temporary-copy-output-color-index-matrix.amber", "cov-nested-loops-temporary-copy-output-color-index-matrix", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-while-min-iterator-condition-always-false.amber", "cov-nested-loops-while-min-iterator-condition-always-false", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-switch-add-zero-matrix-elements.amber", "cov-nested-loops-switch-add-zero-matrix-elements", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nested-loops-while-condition-integer-range-increment-variable.amber", "cov-nested-loops-while-condition-integer-range-increment-variable", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-nested-structs-function-set-inner-struct-field-return.amber", "cov-nested-structs-function-set-inner-struct-field-return", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-nir-array-access.amber", "cov-nir-array-access", "A fragment shader that covers a specific nir path" }, +{ "cov-nir-opt-large-constants-for-clamp-vector-access.amber", "cov-nir-opt-large-constants-for-clamp-vector-access", "A fragment shader that covers a specific nir opt large constants path" }, +{ "cov-nir-opt-loop-unroll-if-if-if-if-do-while.amber", "cov-nir-opt-loop-unroll-if-if-if-if-do-while", "A fragment shader that covers a specific nir opt loop unroll path" }, +{ "cov-nouble-negation-fragcoord-cast-ivec2-bitwise-and.amber", "cov-nouble-negation-fragcoord-cast-ivec2-bitwise-and", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-one-bitwise-and-bitwise-or-full-bits.amber", "cov-one-bitwise-and-bitwise-or-full-bits", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-one-minus-clamp-always-one-cast-to-int.amber", "cov-one-minus-clamp-always-one-cast-to-int", "A fragment shader that covers specific NIR code paths" }, +{ "cov-optimize-phis-for.amber", "cov-optimize-phis-for", "A fragment shader that cover specific optimize phis code paths" }, +{ "cov-optimize-phis-for-for-do-while-if-if.amber", "cov-optimize-phis-for-for-do-while-if-if", "A fragment shader that covers a specific optimize PHIs code path", "VK_KHR_shader_terminate_invocation"}, +{ "cov-not-clamp-matrix-access.amber", "cov-not-clamp-matrix-access", "A fragment shader that covers a specific selection dag code path" }, +{ "cov-packhalf-unpackunorm.amber", "cov-packhalf-unpackunorm", "A fragment shader that covers a specific inst combine shifts code path" }, +{ "cov-pattern-match-signum.amber", "cov-pattern-match-signum", "A fragment shader that covers a specific pattern matching path." }, +{ "cov-pattern-match-single-bit.amber", "cov-pattern-match-single-bit", "A fragment shader that covers a specific pattern matching path." }, +{ "cov-peephole-optimizer-target-instr-info-for-if-if-if.amber", "cov-peephole-optimizer-target-instr-info-for-if-if-if", "Covers peephole optimizer and instr info code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-pow-distance-uniform-vector-constant-one-vector.amber", "cov-pow-distance-uniform-vector-constant-one-vector", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-pow-identical-value-sqrt.amber", "cov-pow-identical-value-sqrt", "A fragment shader that covers specific SPIR-V lower math code paths" }, +{ "cov-pow-undefined.amber", "cov-pow-undefined", "A fragment shader that covers specific constant fold and selection dag code paths" }, +{ "cov-pow-undefined-result-condition-with-always-true.amber", "cov-pow-undefined-result-condition-with-always-true", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-rcp-negative-int.amber", "cov-rcp-negative-int", "A fragment shader that covers specific NIR code paths" }, +{ "cov-read-matrix-push-constant.amber", "cov-read-matrix-push-constant", "A fragment shader that covers specific SPIR-V reader code paths" }, +{ "cov-reciprocal-var-minus-one.amber", "cov-reciprocal-var-minus-one", "A fragment shader that covers specific NIR code paths" }, +{ "cov-reduce-load-replace-extract.amber", "cov-reduce-load-replace-extract", "A fragment shader that covers a specific load size reduction path." }, +{ "cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard.amber", "cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard", "Covers register coalescer, live intervals and target instr info code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-reinitialize-matrix-after-undefined-value.amber", "cov-reinitialize-matrix-after-undefined-value", "A fragment shader that covers specific NIR code paths" }, +{ "cov-repeating-conditions-fract-unused.amber", "cov-repeating-conditions-fract-unused", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-replace-copy-object.amber", "cov-replace-copy-object", "A fragment shader that covers a specific shader simplification path." }, +{ "cov-return-after-do-while.amber", "cov-return-after-do-while", "A fragment shader that covers a specific simplify cfg code path" }, +{ "cov-return-after-first-iteration.amber", "cov-return-after-first-iteration", "A fragment shader that covers specific BRW code paths" }, +{ "cov-return-partly-undefined-vector-from-array.amber", "cov-return-partly-undefined-vector-from-array", "A fragment shader that covers specific NIR code paths" }, +{ "cov-sample-texture-hundred-iterations.amber", "cov-sample-texture-hundred-iterations", "A fragment shader that covers specific NIR code paths" }, +{ "cov-sampler-as-function-argument.amber", "cov-sampler-as-function-argument", "A fragment shader that covers specific SPIR-V reader code paths" }, +{ "cov-scaled-number-nested-loops.amber", "cov-scaled-number-nested-loops", "A fragment shader that covers a specific scaled number code path." }, +{ "cov-selection-dag-assign-back-and-forth.amber", "cov-selection-dag-assign-back-and-forth", "A fragment shader that covers a specific selection DAG code path" }, +{ "cov-selection-dag-lt-gt.amber", "cov-selection-dag-lt-gt", "A fragment shader that covers a specific selection DAG code path" }, +{ "cov-scaled-number-nested-loops-array-access.amber", "cov-scaled-number-nested-loops-array-access", "A fragment shader that covers a specific scaled number path" }, +{ "cov-schedule-dag-rrlist-mix-log-cos.amber", "cov-schedule-dag-rrlist-mix-log-cos", "Covers a specific schedule dag register reduction list code path" }, +{ "cov-selection-dag-inverse-clamp.amber", "cov-selection-dag-inverse-clamp", "A fragment shader that covers a specific selection DAG code path" }, +{ "cov-selection-dag-same-cond-twice.amber", "cov-selection-dag-same-cond-twice", "A fragment shader that covers a specific selection DAG code path" }, +{ "cov-set-array-elements-to-uniform-check-value-break.amber", "cov-set-array-elements-to-uniform-check-value-break", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-set-output-color-function-call-nested-loop.amber", "cov-set-output-color-function-call-nested-loop", "A fragment shader that covers specific BRW code paths" }, +{ "cov-set-vector-cos-fragcoord.amber", "cov-set-vector-cos-fragcoord", "A fragment shader that covers a specific set vector code path." }, +{ "cov-sign-array-access-uaddcarry.amber", "cov-sign-array-access-uaddcarry", "A fragment shader that covers a specific inst combine compares code path" }, +{ "cov-simplification-unused-struct.amber", "cov-simplification-unused-struct", "A fragment shader that covers a specific shader simplification path." }, +{ "cov-simplification-while-inside-for.amber", "cov-simplification-while-inside-for", "A fragment shader that covers a specific code simplification path." }, +{ "cov-simplify-clamp-max-itself.amber", "cov-simplify-clamp-max-itself", "A fragment shader that covers a specific instruction simplification code path" }, +{ "cov-simplify-combine-compares-max-max-one.amber", "cov-simplify-combine-compares-max-max-one", "Covers specific instruction simplifying and combining code paths" }, +{ "cov-simplify-component-uniform-idx.amber", "cov-simplify-component-uniform-idx", "A fragment shader that covers a specific instruction simplification code path" }, +{ "cov-simplify-div-by-uint-one.amber", "cov-simplify-div-by-uint-one", "A fragment shader that covers a specific instruction simplification code path" }, +{ "cov-simplify-for-bitwise-condition.amber", "cov-simplify-for-bitwise-condition", "A fragment shader that covers a specific instruction simplify code path" }, +{ "cov-simplify-ldexp-exponent-zero.amber", "cov-simplify-ldexp-exponent-zero", "A fragment shader that covers a specific instruction simplification code path" }, +{ "cov-simplify-max-multiplied-values.amber", "cov-simplify-max-multiplied-values", "A fragment shader that covers a specific instruction simplify code path" }, +{ "cov-simplify-modulo-1.amber", "cov-simplify-modulo-1", "A fragment shader that covers a specific instruction simplification code path" }, +{ "cov-simplify-mul-identity.amber", "cov-simplify-mul-identity", "A fragment shader that covers a specific instruction simplification code path" }, +{ "cov-simplify-not-less-than-neg.amber", "cov-simplify-not-less-than-neg", "A fragment shader that covers a specific instruction simplification code path" }, +{ "cov-simplify-right-shift-greater-than-zero.amber", "cov-simplify-right-shift-greater-than-zero", "Covers specific instruction simplify and combine compare code paths" }, +{ "cov-simplify-select-fragcoord.amber", "cov-simplify-select-fragcoord", "A fragment shader that covers a specific instruction simplification code path" }, +{ "cov-simplify-sign-cosh.amber", "cov-simplify-sign-cosh", "A fragment shader that covers a specific instruction simplification path" }, +{ "cov-simplify-smoothstep-undef.amber", "cov-simplify-smoothstep-undef", "A fragment shader that covers a specific instruction simplification code path", "VK_KHR_shader_float_controls", "FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32"}, +{ "cov-sin-mul-mat-mat-mul-vec-mat.amber", "cov-sin-mul-mat-mat-mul-vec-mat", "A fragment shader that covers a specific dag combiner code path" }, +{ "cov-single-block-elim-self-assign.amber", "cov-single-block-elim-self-assign", "A fragment shader that covers a specific single block elimination path." }, +{ "cov-single-store-elim-assume-store.amber", "cov-single-store-elim-assume-store", "A fragment shader that covers a specific single store elimination path." }, +{ "cov-sinh-ldexp.amber", "cov-sinh-ldexp", "A fragment shader that covers a specific inst combine compares code path" }, +{ "cov-small-array-overwrite-most-uniform-value-check-data-break.amber", "cov-small-array-overwrite-most-uniform-value-check-data-break", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-ssa-rewrite-case-with-default.amber", "cov-ssa-rewrite-case-with-default", "A fragment shader that covers a specific SSA rewrite path." }, +{ "cov-step-sinh.amber", "cov-step-sinh", "A fragment shader that covers a specific APFloat code path" }, +{ "cov-struct-array-ivec-negative-modulus-empty-function.amber", "cov-struct-array-ivec-negative-modulus-empty-function", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-struct-float-array-mix-uniform-vectors.amber", "cov-struct-float-array-mix-uniform-vectors", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-struct-int-array-select-uniform-ivec.amber", "cov-struct-int-array-select-uniform-ivec", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-sum-uniform-vector-components-round.amber", "cov-sum-uniform-vector-components-round", "A fragment shader that covers specific NIR code paths" }, +{ "cov-switch-fallthrough-variable-from-first-case.amber", "cov-switch-fallthrough-variable-from-first-case", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-tail-duplicator-for-for-for.amber", "cov-tail-duplicator-for-for-for", "A fragment shader that covers a specific tail duplicator code path" }, +{ "cov-tail-duplicator-infinite-loops.amber", "cov-tail-duplicator-infinite-loops", "A fragment shader that covers a specific tail duplicator code path" }, +{ "cov-target-lowering-dfdx-cos.amber", "cov-target-lowering-dfdx-cos", "A fragment shader that covers a specific target lowering code path." }, +{ "cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal.amber", "cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal", "Covers target lowering and compare combining code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-texel-double-negation.amber", "cov-texel-double-negation", "A fragment shader that covers specific NIR code paths" }, +{ "cov-transpose-multiply.amber", "cov-transpose-multiply", "A fragment shader that covers specific NIR code paths" }, +{ "cov-trunc-fract-always-zero.amber", "cov-trunc-fract-always-zero", "A fragment shader that covers specific NIR code paths" }, +{ "cov-two-functions-loops-copy-elements-infinite-loops-never-executed.amber", "cov-two-functions-loops-copy-elements-infinite-loops-never-executed", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-two-functions-modify-struct-array-element-return-from-loop.amber", "cov-two-functions-modify-struct-array-element-return-from-loop", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-two-loops-global-loop-counter-clamp-ivec-elements-index-array.amber", "cov-two-loops-global-loop-counter-clamp-ivec-elements-index-array", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-two-loops-global-loop-counter-shift-right-zero-increment-array-element.amber", "cov-two-loops-global-loop-counter-shift-right-zero-increment-array-element", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-two-loops-increment-integer-global-counter-break-square-threshold.amber", "cov-two-loops-increment-integer-global-counter-break-square-threshold", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-two-loops-never-iterated.amber", "cov-two-loops-never-iterated", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-two-nested-loops-switch-case-matrix-array-increment.amber", "cov-two-nested-loops-switch-case-matrix-array-increment", "A fragment shader that covers specific LLVM code paths", "VK_KHR_shader_terminate_invocation"}, +{ "cov-types-return-in-main-never-hit.amber", "cov-types-return-in-main-never-hit", "A fragment shader that covers a specific types optimization path." }, +{ "cov-uadd-carry-bit-count-index-array.amber", "cov-uadd-carry-bit-count-index-array", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-ucarryadd-one-and-one.amber", "cov-ucarryadd-one-and-one", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-undefined-inversesqrt-reflect.amber", "cov-undefined-inversesqrt-reflect", "A fragment shader that covers a specific APFloat code path", "VK_KHR_shader_float_controls", "FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32"}, +{ "cov-uniform-vector-copy.amber", "cov-uniform-vector-copy", "A fragment shader that covers specific NIR code paths" }, +{ "cov-uniform-vector-function-argument-mod-increment-integers.amber", "cov-uniform-vector-function-argument-mod-increment-integers", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-uninitialized-values-passed-to-function-never-executed.amber", "cov-uninitialized-values-passed-to-function-never-executed", "A fragment shader that covers specific NIR code paths" }, +{ "cov-unpack-unorm-mix-always-one.amber", "cov-unpack-unorm-mix-always-one", "A fragment shader that covers specific NIR code paths" }, +{ "cov-unused-access-past-matrix-elements.amber", "cov-unused-access-past-matrix-elements", "A fragment shader that covers specific NIR code paths" }, +{ "cov-unused-matrix-copy-inside-loop.amber", "cov-unused-matrix-copy-inside-loop", "A fragment shader that covers specific NIR code paths" }, +{ "cov-val-cfg-case-fallthrough.amber", "cov-val-cfg-case-fallthrough", "A fragment shader that covers a specific shader validation path." }, +{ "cov-value-inst-combine-select-value-tracking-flip-bits.amber", "cov-value-inst-combine-select-value-tracking-flip-bits", "Covers value, inst combine select and value tracking code paths" }, +{ "cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator.amber", "cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator", "A fragment shader that calculates modulo of constant one with a loop iterator" }, +{ "cov-value-tracking-const-dfdy.amber", "cov-value-tracking-const-dfdy", "A fragment shader that covers a specific value tracking code path" }, +{ "cov-value-tracking-constant-fold-refraction-dfxd-determinant.amber", "cov-value-tracking-constant-fold-refraction-dfxd-determinant", "A fragment shader that calculates refraction with certain values" }, +{ "cov-value-tracking-inclusive-or.amber", "cov-value-tracking-inclusive-or", "A fragment shader that covers a specific value tracking path" }, +{ "cov-value-tracking-known-nonzero.amber", "cov-value-tracking-known-nonzero", "A fragment shader that covers a specific value tracking path" }, +{ "cov-value-tracking-max-uintbitstofloat.amber", "cov-value-tracking-max-uintbitstofloat", "A fragment shader that covers a specific value tracking path" }, +{ "cov-value-tracking-selection-dag-negation-clamp-loop.amber", "cov-value-tracking-selection-dag-negation-clamp-loop", "A fragment shader that calculates negation of clamped loop iterator values" }, +{ "cov-value-tracking-uniform-incident.amber", "cov-value-tracking-uniform-incident", "A fragment shader that covers a specific value tracking code path" }, +{ "cov-variable-copy-in-function-tex-sample.amber", "cov-variable-copy-in-function-tex-sample", "A fragment shader that covers specific NIR code paths" }, +{ "cov-vec2-dot-max-uniform.amber", "cov-vec2-dot-max-uniform", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-vec2-dot-minus-negative-zero.amber", "cov-vec2-dot-minus-negative-zero", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-vec2-duplicate-min-always-half.amber", "cov-vec2-duplicate-min-always-half", "A fragment shader that covers specific LLVM code paths" }, +{ "cov-vector-dce-inc-unused-comp.amber", "cov-vector-dce-inc-unused-comp", "A fragment shader that covers a specific vector DCE path." }, +{ "cov-vector-dce-unused-component.amber", "cov-vector-dce-unused-component", "A fragment shader that covers a specific vector DCE path." }, +{ "cov-vector-illegal-index-never-executed.amber", "cov-vector-illegal-index-never-executed", "A fragment shader that covers specific NIR code paths" }, +{ "cov-vector-log2-cosh.amber", "cov-vector-log2-cosh", "A fragment shader that covers a specific vector log2 and cosh code path." }, +{ "cov-wrap-op-kill-for-loop.amber", "cov-wrap-op-kill-for-loop", "A fragment shader that covers a specific OpKill wrapping code path", "VK_KHR_shader_terminate_invocation"}, +{ "cov-wrap-op-kill-two-branches.amber", "cov-wrap-op-kill-two-branches", "A fragment shader that covers a specific OpKill wrapping path." , "VK_KHR_shader_terminate_invocation"}, +{ "cov-write-past-matrix-elements-unused.amber", "cov-write-past-matrix-elements-unused", "A fragment shader that covers specific NIR code paths" }, +{ "cov-x86-instr-info-determinant-min.amber", "cov-x86-instr-info-determinant-min", "A fragment shader that covers a specific x86 instr info code path" }, +{ "cov-x86-isel-lowering-determinant-exp-acos.amber", "cov-x86-isel-lowering-determinant-exp-acos", "A fragment shader that covers a specific x86 isel lowering code path" }, +{ "cov-x86-isel-lowering-machine-value-type-uint-to-float.amber", "cov-x86-isel-lowering-machine-value-type-uint-to-float", "Covers specific X86 ISel lowering and machine value type code paths" }, +{ "cov-x86-isel-lowering-selection-dag-struct-array-clamp-index.amber", "cov-x86-isel-lowering-selection-dag-struct-array-clamp-index", "Covers a specific X86 ISel lowering and DAG selection code paths" }, +{ "cov-x86-isel-lowering-apfloat-nan-cos-cos.amber", "cov-x86-isel-lowering-apfloat-nan-cos-cos", "A fragment shader that covers a specific X86 ISel lowering and AP Float code paths"}, +{ "cov-x86-isel-lowering-negative-left-shift.amber", "cov-x86-isel-lowering-negative-left-shift", "A fragment shader that covers a specific X86 ISel lowering code path" }, +{ "create-color-in-do-while-for-loop.amber", "create-color-in-do-while-for-loop", "A fragment shader that creates the color inside two loops", "VK_KHR_shader_terminate_invocation"}, +{ "dead-barriers-in-loops.amber", "dead-barriers-in-loops", "A compute shader with dead barriers" }, +{ "dead-struct-init.amber", "dead-struct-init", "A fragment shader that uses struct initializers" }, +{ "disc-and-add-in-func-in-loop.amber", "disc-and-add-in-func-in-loop", "A fragment shader with discard and add in function in loop", "VK_KHR_shader_terminate_invocation"}, +{ "discard-continue-return.amber", "discard-continue-return", "A fragment shader with a discard, continue, and return", "VK_KHR_shader_terminate_invocation"}, +{ "discard-in-array-manipulating-loop.amber", "discard-in-array-manipulating-loop", "An array-manipulating fragment shader with a discard", "VK_KHR_shader_terminate_invocation"}, +{ "discard-in-loop.amber", "discard-in-loop", "A shader with a discard in a loop", "VK_KHR_shader_terminate_invocation"}, +{ "discard-in-loop-in-function.amber", "discard-in-loop-in-function", "A shader with a discard nested in a loop in a function", "VK_KHR_shader_terminate_invocation"}, +{ "discards-in-control-flow.amber", "discards-in-control-flow", "A fragment shader with discards in loops and conditionals", "VK_KHR_shader_terminate_invocation"}, +{ "do-while-false-if.amber", "do-while-false-if", "A fragment shader with false if return in do while loop" }, +{ "do-while-false-loops.amber", "do-while-false-loops", "Code wrapped in nested single iteration loops" }, +{ "do-while-if-return.amber", "do-while-if-return", "A fragment shader with true if in a nested do while loop" }, +{ "do-while-loop-in-conditionals.amber", "do-while-loop-in-conditionals", "A fragment shader with do-while loop in conditional nest" }, +{ "do-while-with-always-true-if.amber", "do-while-with-always-true-if", "A fragment shader with a do while that always returns" }, +{ "do-while-with-if-condition.amber", "do-while-with-if-condition", "A fragment shader that has nested if condition in do while" }, +{ "early-return-and-barrier.amber", "early-return-and-barrier", "A compute shader with an early return and a barrier" }, +{ "find-msb-from-lsb.amber", "find-msb-from-lsb", "A fragment shader that finds MSB from LSB" }, +{ "flag-always-false-if.amber", "flag-always-false-if", "A fragment shader with recurrent always false if statement" }, +{ "for-condition-always-false.amber", "for-condition-always-false", "A fragment shader that uses a for loop with condition always false" }, +{ "for-loop-with-return.amber", "for-loop-with-return", "A fragment shader with a for loop that loops only once" }, +{ "for-with-ifs-and-return.amber", "for-with-ifs-and-return", "A fragment shader with two ifs and return/continue inside a for loop" }, +{ "frag-coord-func-call-and-ifs.amber", "frag-coord-func-call-and-ifs", "A fragment shader with many uses of gl_FragCoord" }, +{ "fragcoord-control-flow.amber", "fragcoord-control-flow", "A fragment shader that uses FragCoord and somewhat complex control flow", "VK_KHR_shader_terminate_invocation"}, +{ "fragcoord-control-flow-2.amber", "fragcoord-control-flow-2", "A fragment shader that uses FragCoord and somewhat complex control flow", "VK_KHR_shader_terminate_invocation"}, +{ "function-with-float-comparison.amber", "function-with-float-comparison", "A fragment shader that compares a float and a coordinate" }, +{ "function-with-uniform-return.amber", "function-with-uniform-return", "A fragment shader with uniform value as a return" }, +{ "global-array-loops.amber", "global-array-loops", "A loop that writes then reads a global array" }, +{ "if-and-switch.amber", "if-and-switch", "A fragment shader with a switch and some data flow" }, +{ "increment-value-in-nested-for-loop.amber", "increment-value-in-nested-for-loop", "A frag. shader that increments a value in nested for loop" }, +{ "injection-switch-as-comparison.amber", "injection-switch-as-comparison", "A fragment shader with uniform comparison in loop" }, +{ "int-mat2-struct.amber", "int-mat2-struct", "Fragment shader using (int, mat2) struct" }, +{ "loop-call-discard.amber", "loop-call-discard", "A fragment shader with nested loops and a function call", "VK_KHR_shader_terminate_invocation"}, +{ "loop-dead-if-loop.amber", "loop-dead-if-loop", "A fragment shader with a loop, dead if, and a loop" }, +{ "loop-nested-ifs.amber", "loop-nested-ifs", "A fragment shader with a for loop containing nested ifs" }, +{ "loops-breaks-returns.amber", "loops-breaks-returns", "A compute shader with loops, breaks, returns" }, +{ "loops-ifs-continues-call.amber", "loops-ifs-continues-call", "A fragment shader with nested control flow and a call" }, +{ "mat-array-deep-control-flow.amber", "mat-array-deep-control-flow", "A fragment shader that uses an array of matrices and has deep control flow" }, +{ "mat-array-distance.amber", "mat-array-distance", "A fragment shader that uses an array of matrices and distance" }, +{ "mat-mul-in-loop.amber", "mat-mul-in-loop", "Shader with matrix multiplication in loop" }, +{ "matrices-and-return-in-loop.amber", "matrices-and-return-in-loop", "A fragment shader with matrices and a return in a loop" }, +{ "max-mix-conditional-discard.amber", "max-mix-conditional-discard", "A fragment shader with an expression used in two discard guards", "VK_KHR_shader_terminate_invocation"}, +{ "mix-floor-add.amber", "mix-floor-add", "A fragment shader with mix, uintBitsToFloat, and floor" }, +{ "modf-gl-color.amber", "modf-gl-color", "A fragment shader with modf of gl color" }, +{ "modf-temp-modf-color.amber", "modf-temp-modf-color", "A fragment shader that calls modf twice, once with color" }, +{ "nested-for-break-mat-color.amber", "nested-for-break-mat-color", "Two nested for loops modify a mat4 then writes red" }, +{ "nested-for-loops-switch-fallthrough.amber", "nested-for-loops-switch-fallthrough", "A fragment shader with few nested loops with fallthrough", "VK_KHR_shader_terminate_invocation"}, +{ "nested-for-loops-with-return.amber", "nested-for-loops-with-return", "A fragment shader with two nested for loops with return" }, +{ "nested-ifs-and-return-in-for-loop.amber", "nested-ifs-and-return-in-for-loop", "A fragment shader with return in nest of ifs, inside loop" }, +{ "nested-loops-switch.amber", "nested-loops-switch", "A fragment shader with nested loops and a switch" }, +{ "nested-switch-break-discard.amber", "nested-switch-break-discard", "Nested switches with break and discard", "VK_KHR_shader_terminate_invocation"}, +{ "one-sized-array.amber", "one-sized-array", "A fragment shader that uses a struct with an array of size one" }, +{ "pow-vec4.amber", "pow-vec4", "A fragment shader that uses pow" }, +{ "return-before-writing-wrong-color.amber", "return-before-writing-wrong-color", "A fragment shader with return before writing wrong color" }, +{ "return-float-from-while-loop.amber", "return-float-from-while-loop", "A fragment shader with unreachable while loop" }, +{ "return-in-loop-in-function.amber", "return-in-loop-in-function", "A fragment shader with early return from loop in function" }, +{ "return-inside-loop-in-function.amber", "return-inside-loop-in-function", "A fragment shader with return inside loop" }, +{ "returned-boolean-in-vector.amber", "returned-boolean-in-vector", "A fragment shader with returned boolean in vector" }, +{ "set-color-in-one-iteration-while-loop.amber", "set-color-in-one-iteration-while-loop", "A frag shader that sets the color in one iter while loop" }, +{ "similar-nested-ifs.amber", "similar-nested-ifs", "A fragment shader with similar nested ifs and loops" }, +{ "smoothstep-after-loop.amber", "smoothstep-after-loop", "Fragment shader with 1-iteration loop and smoothstep" }, +{ "spv-access-chains.amber", "spv-access-chains", "Equivalent shaders, one with extra access chains" }, +{ "spv-composite-phi.amber", "spv-composite-phi", "Equivalent shaders, one with id used by OpPhi hidden in composite" }, +{ "spv-composite2.amber", "spv-composite2", "Equivalent shaders, one where an id is hidden inside a composite" }, +{ "spv-composites.amber", "spv-composites", "Equivalent shaders; one obfuscates an id via composites" }, +{ "spv-copy-object.amber", "spv-copy-object", "Equivalent shaders; one features extra OpCopyObject instructions" }, +{ "spv-dead-break-and-unroll.amber", "spv-dead-break-and-unroll", "Equivalent shaders, one with a dead break and an Unroll annotation" }, +{ "spv-declare-bvec4.amber", "spv-declare-bvec4", "Equivalent shaders except one declares a bvec4" }, +{ "spv-double-branch-to-same-block.amber", "spv-double-branch-to-same-block", "Equivalent shaders, one with more complex branching", "VK_KHR_shader_terminate_invocation"}, +{ "spv-double-branch-to-same-block2.amber", "spv-double-branch-to-same-block2", "Equivalent shaders, one with more complex branching" }, +{ "spv-double-branch-to-same-block3.amber", "spv-double-branch-to-same-block3", "Equivalent shaders, one with more complex branching", "VK_KHR_shader_terminate_invocation"}, +{ "spv-load-from-frag-color.amber", "spv-load-from-frag-color", "Equivalent shaders, one with extra access chains and load" }, +{ "spv-null-in-phi-and-unroll.amber", "spv-null-in-phi-and-unroll", "Equivalent shaders, one that uses null for 0 and an Unroll annotation" }, +{ "spv-stable-bifurcation-Os-mutate-var-vector-shuffle.amber", "spv-stable-bifurcation-Os-mutate-var-vector-shuffle", "Three shaders diff: mutate var, vector shuffle" }, +{ "spv-stable-bubblesort-flag-complex-conditionals.amber", "spv-stable-bubblesort-flag-complex-conditionals", "Equivalent shaders, one with more complex conditionals" }, +{ "spv-stable-collatz-O-mutate-composite-construct-extract.amber", "spv-stable-collatz-O-mutate-composite-construct-extract", "Two shaders diff: mutate var, comp extract/construct" }, +{ "spv-stable-colorgrid-modulo-O-move-block-down.amber", "spv-stable-colorgrid-modulo-O-move-block-down", "Two shaders with diff: some blocks moved down" }, +{ "spv-stable-maze-O-dead-code.amber", "spv-stable-maze-O-dead-code", "Equivalent shaders, one with instructions propagated to predecessors" }, +{ "spv-stable-maze-O-memory-accesses.amber", "spv-stable-maze-O-memory-accesses", "Equivalent shaders, one extra memory accesses" }, +{ "spv-stable-maze-flatten-copy-composite.amber", "spv-stable-maze-flatten-copy-composite", "Three shaders with diff: conditional %270 is flattened" }, +{ "spv-stable-mergesort-O-prop-up-mutate-var.amber", "spv-stable-mergesort-O-prop-up-mutate-var", "Three shaders with diff: mutate var", "VK_KHR_shader_terminate_invocation"}, +{ "spv-stable-mergesort-dead-code.amber", "spv-stable-mergesort-dead-code", "Equivalent shaders, one with additional dead code", "VK_KHR_shader_terminate_invocation"}, +{ "spv-stable-mergesort-flatten-selection-dead-continues.amber", "spv-stable-mergesort-flatten-selection-dead-continues", "Shaders diff: selection %25 flattened; dead continues", "VK_KHR_shader_terminate_invocation"}, +{ "spv-stable-mergesort-func-inline-mutate-var.amber", "spv-stable-mergesort-func-inline-mutate-var", "Three shaders diff: mutated var", "VK_KHR_shader_terminate_invocation"}, +{ "spv-stable-orbit-O-mutate-variable.amber", "spv-stable-orbit-O-mutate-variable", "Two shaders with diff: variable mutated" }, +{ "spv-stable-orbit-Os-access-chain-mutate-pointer.amber", "spv-stable-orbit-Os-access-chain-mutate-pointer", "Three shaders with diff: added mutate pointer" }, +{ "spv-stable-pillars-O-op-select-to-op-phi.amber", "spv-stable-pillars-O-op-select-to-op-phi", "Three shaders diff: OpSelect -> OpPhi" }, +{ "spv-stable-pillars-volatile-nontemporal-store.amber", "spv-stable-pillars-volatile-nontemporal-store", "Equivalent shaders, one with additional memory usage" }, +{ "spv-stable-quicksort-dontinline.amber", "spv-stable-quicksort-dontinline", "Equivalent shaders, one with DontInline attribute" }, +{ "spv-stable-quicksort-mat-func-param.amber", "spv-stable-quicksort-mat-func-param", "Two shaders with diff: added mat3x3 func param" }, +{ "spv-stable-rects-Os-mutate-var-push-through-var.amber", "spv-stable-rects-Os-mutate-var-push-through-var", "Three shaders diff: new variable used and mutated" }, +{ "spv-stable-sampler-loop-extra-instructions.amber", "spv-stable-sampler-loop-extra-instructions", "Equivalent shaders, one with irrelevant extra instructions" }, +{ "spv-stable-sampler-polar-simple-O-access-chain.amber", "spv-stable-sampler-polar-simple-O-access-chain", "Equivalent shaders, one with an additional access chain" }, +{ "stable-binarysearch-tree-false-if-discard-loop.amber", "stable-binarysearch-tree-false-if-discard-loop", "A fragment shader with always false if with discard loop", "VK_KHR_shader_terminate_invocation"}, +{ "stable-binarysearch-tree-fragcoord-less-than-zero.amber", "stable-binarysearch-tree-fragcoord-less-than-zero", "A fragment shader with gl_FragCoord.x less than zero" }, +{ "stable-binarysearch-tree-nested-if-and-conditional.amber", "stable-binarysearch-tree-nested-if-and-conditional", "A fragment shader with nested if and conditional statement" }, +{ "stable-binarysearch-tree-with-loop-read-write-global.amber", "stable-binarysearch-tree-with-loop-read-write-global", "A pair of fragment shaders that both render red" }, +{ "stable-collatz-push-constant-with-nested-min-max.amber", "stable-collatz-push-constant-with-nested-min-max", "A fragment shader with push constant and nested min max" }, +{ "stable-colorgrid-modulo-double-always-false-discard.amber", "stable-colorgrid-modulo-double-always-false-discard", "A fragment shader with two always false discards", "VK_KHR_shader_terminate_invocation"}, +{ "stable-mergesort-for-always-false-if-discard.amber", "stable-mergesort-for-always-false-if-discard", "A fragment shader with for loop and always false if", "VK_KHR_shader_terminate_invocation"}, +{ "stable-mergesort-reversed-for-loop.amber", "stable-mergesort-reversed-for-loop", "A fragment shader with once iterated reversed for loop", "VK_KHR_shader_terminate_invocation"}, +{ "stable-colorgrid-modulo-float-mat-determinant-clamp.amber", "stable-colorgrid-modulo-float-mat-determinant-clamp", "A fragment shader with clamped float in determinant matrix" }, +{ "stable-colorgrid-modulo-injected-conditional-true.amber", "stable-colorgrid-modulo-injected-conditional-true", "A fragment shader with an always true conditional" }, +{ "stable-colorgrid-modulo-true-conditional-divided-1.amber", "stable-colorgrid-modulo-true-conditional-divided-1", "A fragment shader with true conditional divided by 1", "VK_KHR_shader_terminate_invocation"}, +{ "stable-colorgrid-modulo-true-conditional-simple-loop.amber", "stable-colorgrid-modulo-true-conditional-simple-loop", "A fragment shader with conditional and simple loop" }, +{ "stable-colorgrid-modulo-vec3-values-from-matrix.amber", "stable-colorgrid-modulo-vec3-values-from-matrix", "A fragment shader with vec3 values set from matrix4x2" }, +{ "stable-mergesort-clamped-conditional-bit-shift.amber", "stable-mergesort-clamped-conditional-bit-shift", "Two shaders with diff: conditional bit shift in a clamp", "VK_KHR_shader_terminate_invocation"}, +{ "stable-quicksort-conditional-bitwise-or-clamp.amber", "stable-quicksort-conditional-bitwise-or-clamp", "A fragment shader with conditional bitwise or clamped" }, +{ "stable-quicksort-for-loop-with-injection.amber", "stable-quicksort-for-loop-with-injection", "A fragment shader with a for loop containing injection" }, +{ "stable-quicksort-if-false-else-return.amber", "stable-quicksort-if-false-else-return", "A fragment shader with an always false if statement" }, +{ "stable-quicksort-max-value-as-index.amber", "stable-quicksort-max-value-as-index", "A fragment shader with greater of two values as index" }, +{ "stable-rects-vec4-clamp-conditional-min-mix.amber", "stable-rects-vec4-clamp-conditional-min-mix", "A fragment shader with min-mix in always false conditional" }, +{ "stable-triangle-array-nested-loop.amber", "stable-triangle-array-nested-loop", "A fragment shader with array and nested loops" }, +{ "stable-triangle-nested-for-loop-and-true-if.amber", "stable-triangle-nested-for-loop-and-true-if", "A fragment shader with nested for loop and always true if" }, +{ "stable-triangle-clamp-conditional-mix.amber", "stable-triangle-clamp-conditional-mix", "A fragment shader with mix conditional in a clamp" }, +{ "stable-triangle-nested-conditional-clamped-float.amber", "stable-triangle-nested-conditional-clamped-float", "A fragment shader with nested conditional float in clamp" }, +{ "struct-and-unreachable-infinite-loop.amber", "struct-and-unreachable-infinite-loop", "Fragment shader with struct and unreachable infinite loop" }, +{ "struct-array-data-as-loop-iterator.amber", "struct-array-data-as-loop-iterator", "A fragment shader that uses struct array data for loop iterator value" }, +{ "struct-array-index.amber", "struct-array-index", "A fragment shader with struct array and always true if" }, +{ "struct-controlled-loop.amber", "struct-controlled-loop", "Shader with loop controlled by struct" }, +{ "struct-used-as-temporary.amber", "struct-used-as-temporary", "A fragment shader that uses a temporary struct variable" }, +{ "switch-if-discard.amber", "switch-if-discard", "A fragment shader with a switch, if, and discard", "VK_KHR_shader_terminate_invocation"}, +{ "switch-inside-while-always-return.amber", "switch-inside-while-always-return", "A fragment shader with a switch inside while always return" }, +{ "switch-loop-switch-if.amber", "switch-loop-switch-if", "A nested switch-loop-switch" }, +{ "switch-with-empty-if-false.amber", "switch-with-empty-if-false", "A fragment shader with always false if in switch statement" }, +{ "switch-with-fall-through-cases.amber", "switch-with-fall-through-cases", "A fragment shader with switch cases that fall through" }, +{ "swizzle-struct-init-min.amber", "swizzle-struct-init-min", "A fragment shader that uses vector swizzles, struct initializers, and min" }, +{ "transpose-rectangular-matrix.amber", "transpose-rectangular-matrix", "Fragment shader that uses 'transpose'" }, +{ "two-2-iteration-loops.amber", "two-2-iteration-loops", "Fragment shader with pair of outer loops", "VK_KHR_shader_terminate_invocation"}, +{ "two-for-loops-with-barrier-function.amber", "two-for-loops-with-barrier-function", "A compute shader with two barrier functions" }, +{ "two-loops-mat-add.amber", "two-loops-mat-add", "A fragment shader with two for loops over a global matrix" }, +{ "two-loops-matrix.amber", "two-loops-matrix", "A fragment shader with two loops and some matrices" }, +{ "two-loops-set-struct.amber", "two-loops-set-struct", "A fragment shader with two loops that write to a struct" }, +{ "two-loops-with-break.amber", "two-loops-with-break", "A fragment shader with two loops with breaks" }, +{ "two-nested-do-whiles.amber", "two-nested-do-whiles", "A fragment shader with nested do while" }, +{ "two-nested-for-loops-with-returns.amber", "two-nested-for-loops-with-returns", "A compute shader with two nested for loops" }, +{ "two-nested-infinite-loops-discard.amber", "two-nested-infinite-loops-discard", "A fragment shader with an always false if function", "VK_KHR_shader_terminate_invocation"}, +{ "undefined-integer-in-function.amber", "undefined-integer-in-function", "A fragment shader with nested do while and undefined int" }, +{ "uninit-element-cast-in-loop.amber", "uninit-element-cast-in-loop", "A fragment shader with uninitialized element cast in loop" }, +{ "uninitialized-var-decrement-and-add.amber", "uninitialized-var-decrement-and-add", "A fragment shader that uses an uninitialized variable" }, +{ "undefined-assign-in-infinite-loop.amber", "undefined-assign-in-infinite-loop", "A fragment shader with uninitialized read in infinite loop" }, +{ "unreachable-barrier-in-loops.amber", "unreachable-barrier-in-loops", "A compute shader with an unreachable barrier in a loop nest" }, +{ "unreachable-continue-statement.amber", "unreachable-continue-statement", "A fragment shader with unreachable continue statement" }, +{ "unreachable-discard-statement-in-if.amber", "unreachable-discard-statement-in-if", "A fragment shader with discard keyword and a return", "VK_KHR_shader_terminate_invocation"}, +{ "unreachable-discard-statement.amber", "unreachable-discard-statement", "A fragment shader with unreachable discard statement", "VK_KHR_shader_terminate_invocation"}, +{ "unreachable-loops.amber", "unreachable-loops", "Fragment shader that writes red despite unreachable loops" }, +{ "unreachable-loops-in-switch.amber", "unreachable-loops-in-switch", "A fragment shader with unreachable loops in a switch" }, +{ "unreachable-return-in-loop.amber", "unreachable-return-in-loop", "A fragment shader with an unreachable return in a loop" }, +{ "unreachable-switch-case-with-discards.amber", "unreachable-switch-case-with-discards", "A shader with a switch statement containing unreachable discards", "VK_KHR_shader_terminate_invocation"}, +{ "uv-value-comparison-as-boolean.amber", "uv-value-comparison-as-boolean", "A fragment shader with uv value comparison as boolean" }, +{ "vec2-modf.amber", "vec2-modf", "A fragment shader with vec2 in modulus fraction function" }, +{ "vector-values-multiplied-by-fragcoord.amber", "vector-values-multiplied-by-fragcoord", "A shader that multiplies a vector by fragcoord" }, +{ "vectors-and-discard-in-function.amber", "vectors-and-discard-in-function", "A fragment shader that assigns vector values", "VK_KHR_shader_terminate_invocation"}, +{ "while-function-always-false.amber", "while-function-always-false", "A fragment shader with an always false while function" }, +{ "while-inside-switch.amber", "while-inside-switch", "A fragment shader that uses a while loop inside a switch", "VK_KHR_shader_terminate_invocation"}, +{ "write-before-break.amber", "write-before-break", "Fragment shader that writes red before loop break" }, +{ "write-red-in-loop-nest.amber", "write-red-in-loop-nest", "A fragment shader that writes red in a nest of loops" }, +{ "wrong-color-in-always-false-if.amber", "wrong-color-in-always-false-if", "A fragment shader with wrong color write in false if" }, diff --git a/vulkan/amber/graphicsfuzz/injection-switch-as-comparison.amber b/vulkan/amber/graphicsfuzz/injection-switch-as-comparison.amber new file mode 100644 index 0000000..9df758d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/injection-switch-as-comparison.amber @@ -0,0 +1,215 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with uniform comparison in loop + +# The test passes because main always writes the color red + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-inserts' +# '--combine-access-chains' +# '--eliminate-local-single-block' +# '--ccp' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-multi-store' +# '--simplify-instructions' +# '--private-to-local' +# '--combine-access-chains' +# '--simplify-instructions' +# '--if-conversion' +# '--eliminate-dead-code-aggressive' +# '--eliminate-dead-code-aggressive' +# '--ccp' +# '--copy-propagate-arrays' +# '--ccp' +# '--private-to-local' +# '--eliminate-dead-code-aggressive' +# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# float makeFrame() +# { +# for (int i = 0; i < 1; i++) +# { +# for (int _injected_loop_counter = 0; 1 < int(injectionSwitch.y); 1) +# { +# return 1.0; +# } +# } +# return 1.0; +# } +# +# void main() +# { +# makeFrame(); +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Writes the color red +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %49 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "makeFrame(" + OpName %30 "buf0" + OpMemberName %30 0 "injectionSwitch" + OpName %32 "" + OpName %49 "_GLF_color" + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 0 + OpDecorate %43 RelaxedPrecision + OpDecorate %49 Location 0 + OpDecorate %67 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypeInt 32 1 + %13 = OpConstant %10 0 + %20 = OpConstant %10 1 + %21 = OpTypeBool + %29 = OpTypeVector %6 2 + %30 = OpTypeStruct %29 + %31 = OpTypePointer Uniform %30 + %32 = OpVariable %31 Uniform + %33 = OpTypeInt 32 0 + %34 = OpConstant %33 1 + %35 = OpTypePointer Uniform %6 + %40 = OpConstant %6 1 + %47 = OpTypeVector %6 4 + %48 = OpTypePointer Output %47 + %49 = OpVariable %48 Output + %50 = OpConstant %6 0 + %51 = OpConstantComposite %47 %40 %50 %50 %40 + %59 = OpConstantFalse %21 + %62 = OpConstantTrue %21 + %79 = OpUndef %6 + %82 = OpUndef %21 + %83 = OpUndef %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %46 = OpFunctionCall %6 %8 + OpStore %49 %51 + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + OpBranch %56 + %56 = OpLabel + OpLoopMerge %52 %58 None + OpBranch %57 + %57 = OpLabel + OpBranch %14 + %14 = OpLabel + %70 = OpPhi %21 %59 %57 %68 %63 + %67 = OpPhi %10 %13 %57 %43 %63 + %77 = OpPhi %6 %79 %57 %80 %63 + %22 = OpSLessThan %21 %67 %20 + OpLoopMerge %16 %63 None + OpBranchConditional %22 %15 %16 + %15 = OpLabel + OpBranch %24 + %24 = OpLabel + %81 = OpPhi %6 %77 %15 %79 %27 + %73 = OpPhi %10 %67 %15 %83 %27 + %69 = OpPhi %21 %70 %15 %82 %27 + %36 = OpAccessChain %35 %32 %13 %34 + %37 = OpLoad %6 %36 + %38 = OpConvertFToS %10 %37 + %39 = OpSLessThan %21 %20 %38 + OpLoopMerge %26 %27 None + OpBranchConditional %39 %25 %26 + %25 = OpLabel + OpBranch %26 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + %80 = OpPhi %6 %81 %24 %40 %25 + %68 = OpPhi %21 %69 %24 %62 %25 + OpSelectionMerge %84 None + OpBranchConditional %68 %16 %84 + %84 = OpLabel + OpBranch %63 + %63 = OpLabel + %43 = OpIAdd %10 %73 %20 + OpBranch %14 + %16 = OpLabel + %76 = OpPhi %6 %77 %14 %80 %26 + %74 = OpPhi %21 %70 %14 %68 %26 + OpSelectionMerge %65 None + OpBranchConditional %74 %52 %65 + %65 = OpLabel + OpBranch %52 + %58 = OpLabel + OpBranch %56 + %52 = OpLabel + %75 = OpPhi %6 %76 %16 %40 %65 + OpReturnValue %75 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/int-mat2-struct.amber b/vulkan/amber/graphicsfuzz/int-mat2-struct.amber new file mode 100644 index 0000000..6e93f25 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/int-mat2-struct.amber @@ -0,0 +1,196 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: Fragment shader using (int, mat2) struct + +# The test passes because the struct instance is created and used in a way that guarantees writing red to the output buffer + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-local-single-block' +# '--eliminate-dead-branches' +# '--vector-dce' +# '--simplify-instructions' +# '--reduce-load-size' +# '--eliminate-local-multi-store' +# '--private-to-local' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--merge-return' +# '--ccp' +# '--reduce-load-size' +# '--eliminate-local-single-block' +# '--scalar-replacement=100' +# '--combine-access-chains' +# '--if-conversion' +# '--ccp' +# '--eliminate-dead-branches' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-block' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-inserts' +# '--eliminate-local-multi-store' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--vector-dce' +# '--eliminate-dead-inserts' +# '--private-to-local' +# '--eliminate-local-multi-store' +# spirv-opt commit hash: f1e5cd73f658abcc23ee96d78f2dc27c4b7028c1 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# struct S { +# int f1; +# mat2 f2; +# } ; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# S myS = S(1, transpose(gl_FragCoord.x < 0.0 ? mat2(1.0, 2.0, 3.0, 4.0) : mat2(0.5, -0.5, -0.5, 0.5))); +# _GLF_color = vec4(float(myS.f1), myS.f2[0][0] + myS.f2[1][0], myS.f2[0][1] + myS.f2[1][1], float(myS.f1)); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 81 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 %46 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "S" + OpMemberName %10 0 "f1" + OpMemberName %10 1 "f2" + OpName %16 "gl_FragCoord" + OpName %46 "_GLF_color" + OpMemberDecorate %10 0 RelaxedPrecision + OpDecorate %16 BuiltIn FragCoord + OpDecorate %46 Location 0 + OpDecorate %69 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFloat 32 + %8 = OpTypeVector %7 2 + %9 = OpTypeMatrix %8 2 + %10 = OpTypeStruct %6 %9 + %11 = OpTypePointer Function %10 + %13 = OpConstant %6 1 + %14 = OpTypeVector %7 4 + %15 = OpTypePointer Input %14 + %16 = OpVariable %15 Input + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 0 + %19 = OpTypePointer Input %7 + %22 = OpConstant %7 0 + %23 = OpTypeBool + %25 = OpTypePointer Function %9 + %29 = OpConstant %7 1 + %30 = OpConstant %7 2 + %31 = OpConstantComposite %8 %29 %30 + %32 = OpConstant %7 3 + %33 = OpConstant %7 4 + %34 = OpConstantComposite %8 %32 %33 + %35 = OpConstantComposite %9 %31 %34 + %37 = OpConstant %7 0.5 + %38 = OpConstant %7 -0.5 + %39 = OpConstantComposite %8 %37 %38 + %40 = OpConstantComposite %8 %38 %37 + %41 = OpConstantComposite %9 %39 %40 + %45 = OpTypePointer Output %14 + %46 = OpVariable %45 Output + %47 = OpConstant %6 0 + %48 = OpTypePointer Function %6 + %52 = OpTypePointer Function %7 + %58 = OpConstant %17 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %70 = OpVariable %25 Function + %69 = OpVariable %48 Function + %26 = OpVariable %25 Function + %20 = OpAccessChain %19 %16 %18 + %21 = OpLoad %7 %20 + %24 = OpFOrdLessThan %23 %21 %22 + OpSelectionMerge %28 None + OpBranchConditional %24 %27 %36 + %27 = OpLabel + OpStore %26 %35 + OpBranch %28 + %36 = OpLabel + OpStore %26 %41 + OpBranch %28 + %28 = OpLabel + %68 = OpPhi %9 %35 %27 %41 %36 + %43 = OpTranspose %9 %68 + %44 = OpCompositeConstruct %10 %13 %43 + %71 = OpCompositeExtract %6 %44 0 + OpStore %69 %71 + %72 = OpCompositeExtract %9 %44 1 + OpStore %70 %72 + %51 = OpConvertSToF %7 %71 + %73 = OpAccessChain %52 %70 %47 %18 + %77 = OpLoad %9 %70 + %54 = OpCompositeExtract %7 %77 0 0 + %74 = OpAccessChain %52 %70 %13 %18 + %78 = OpLoad %9 %70 + %56 = OpCompositeExtract %7 %78 1 0 + %57 = OpFAdd %7 %54 %56 + %75 = OpAccessChain %52 %70 %47 %58 + %79 = OpLoad %9 %70 + %60 = OpCompositeExtract %7 %79 0 1 + %76 = OpAccessChain %52 %70 %13 %58 + %80 = OpLoad %9 %70 + %62 = OpCompositeExtract %7 %80 1 1 + %63 = OpFAdd %7 %60 %62 + %66 = OpConvertSToF %7 %71 + %67 = OpCompositeConstruct %14 %51 %57 %63 %66 + OpStore %46 %67 + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/loop-call-discard.amber b/vulkan/amber/graphicsfuzz/loop-call-discard.amber new file mode 100644 index 0000000..4995d70 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/loop-call-discard.amber @@ -0,0 +1,333 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with nested loops and a function call + +# The test passes because the fragment shader enters the first loop, immediately breaks, and then +# writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 06407250a169c6a03b3765e86619075af1a8c187 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 mand() +# { +# float x, y; +# int iteration; +# iteration = 0; +# if (gl_FragCoord.y < 0.0) +# { +# return vec3(1.0); +# } +# for ( +# int k = 0; +# k < 50; +# k++) +# { +# if (x * x + y * y > 4.0) +# { +# if (injectionSwitch.x > injectionSwitch.y) +# { +# discard; +# } +# break; +# } +# float x_new; +# x_new = 1.0 - y; +# if (gl_FragCoord.x < 0.0) +# { +# discard; +# } +# y = 2.0 * y + 1.0; +# x = x_new; +# iteration++; +# } +# vec3 pickColor_inline_return_value_0; +# int i; +# i = iteration; +# pickColor_inline_return_value_0 = vec3(1.0, 1.0, float(i)); +# return pickColor_inline_return_value_0; +# } +# +# void main() +# { +# vec3 data[16]; +# data[1] = vec3(0.0); +# for ( +# int i = 0; +# i < 4; +# i++) +# { +# if (injectionSwitch.x < 1.0) // always true +# { +# break; +# } +# for ( +# int j = 0; +# j < 4; +# j++) +# { +# data[4 * j + i] = mand(); +# if (injectionSwitch.x > injectionSwitch.y) +# { +# discard; +# } +# } +# } +# vec4 sum; +# sum = vec4(1.0, 0.0, 0.0, 1.0); // red +# sum += data[1].xxyz; // sum is unchanged +# _GLF_color = sum; // red +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 270 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %17 %154 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %17 "gl_FragCoord" + OpName %55 "buf0" + OpMemberName %55 0 "injectionSwitch" + OpName %57 "" + OpName %101 "data" + OpName %154 "_GLF_color" + OpDecorate %17 BuiltIn FragCoord + OpMemberDecorate %55 0 Offset 0 + OpDecorate %55 Block + OpDecorate %57 DescriptorSet 0 + OpDecorate %57 Binding 0 + OpDecorate %128 RelaxedPrecision + OpDecorate %130 RelaxedPrecision + OpDecorate %142 RelaxedPrecision + OpDecorate %144 RelaxedPrecision + OpDecorate %154 Location 0 + OpDecorate %228 RelaxedPrecision + OpDecorate %230 RelaxedPrecision + OpDecorate %240 RelaxedPrecision + OpDecorate %241 RelaxedPrecision + OpDecorate %243 RelaxedPrecision + OpDecorate %253 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %11 = OpTypeInt 32 1 + %14 = OpConstant %11 0 + %15 = OpTypeVector %6 4 + %16 = OpTypePointer Input %15 + %17 = OpVariable %16 Input + %18 = OpTypeInt 32 0 + %19 = OpConstant %18 1 + %20 = OpTypePointer Input %6 + %23 = OpConstant %6 0 + %24 = OpTypeBool + %28 = OpConstant %6 1 + %29 = OpConstantComposite %7 %28 %28 %28 + %38 = OpConstant %11 50 + %50 = OpConstant %6 4 + %54 = OpTypeVector %6 2 + %55 = OpTypeStruct %54 + %56 = OpTypePointer Uniform %55 + %57 = OpVariable %56 Uniform + %58 = OpConstant %18 0 + %59 = OpTypePointer Uniform %6 + %78 = OpConstant %6 2 + %84 = OpConstant %11 1 + %90 = OpTypePointer Function %7 + %98 = OpConstant %18 16 + %99 = OpTypeArray %7 %98 + %100 = OpTypePointer Function %99 + %102 = OpConstantComposite %7 %23 %23 %23 + %111 = OpConstant %11 4 + %147 = OpConstantComposite %15 %28 %23 %23 %28 + %153 = OpTypePointer Output %15 + %154 = OpVariable %153 Output + %248 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %101 = OpVariable %100 Function + %103 = OpAccessChain %90 %101 %84 + OpStore %103 %102 + OpBranch %105 + %105 = OpLabel + %240 = OpPhi %11 %14 %5 %144 %122 + %252 = OpPhi %6 %248 %5 %251 %122 + %247 = OpPhi %6 %248 %5 %246 %122 + %112 = OpSLessThan %24 %240 %111 + OpLoopMerge %107 %122 None + OpBranchConditional %112 %106 %107 + %106 = OpLabel + %113 = OpAccessChain %59 %57 %14 %58 + %114 = OpLoad %6 %113 + %115 = OpFOrdLessThan %24 %114 %28 + OpSelectionMerge %117 None + OpBranchConditional %115 %116 %117 + %116 = OpLabel + OpBranch %107 + %117 = OpLabel + OpBranch %120 + %120 = OpLabel + %251 = OpPhi %6 %252 %117 %266 %139 + %246 = OpPhi %6 %247 %117 %264 %139 + %241 = OpPhi %11 %14 %117 %142 %139 + %126 = OpSLessThan %24 %241 %111 + OpLoopMerge %267 %139 None + OpBranchConditional %126 %121 %267 + %121 = OpLabel + %128 = OpIMul %11 %111 %241 + %130 = OpIAdd %11 %128 %240 + OpBranch %181 + %181 = OpLabel + OpLoopMerge %182 %183 None + OpBranch %184 + %184 = OpLabel + %185 = OpAccessChain %20 %17 %19 + %186 = OpLoad %6 %185 + %187 = OpFOrdLessThan %24 %186 %23 + OpSelectionMerge %188 None + OpBranchConditional %187 %189 %188 + %189 = OpLabel + OpBranch %182 + %188 = OpLabel + OpBranch %190 + %190 = OpLabel + %253 = OpPhi %11 %14 %188 %228 %220 + %249 = OpPhi %6 %251 %188 %225 %220 + %244 = OpPhi %6 %246 %188 %216 %220 + %243 = OpPhi %11 %14 %188 %230 %220 + %195 = OpSLessThan %24 %243 %38 + OpLoopMerge %191 %220 None + OpBranchConditional %195 %196 %191 + %196 = OpLabel + %199 = OpFMul %6 %244 %244 + %202 = OpFMul %6 %249 %249 + %203 = OpFAdd %6 %199 %202 + %204 = OpFOrdGreaterThan %24 %203 %50 + OpSelectionMerge %205 None + OpBranchConditional %204 %206 %205 + %206 = OpLabel + %209 = OpAccessChain %59 %57 %14 %19 + %210 = OpLoad %6 %209 + %211 = OpFOrdGreaterThan %24 %114 %210 + OpSelectionMerge %212 None + OpBranchConditional %211 %213 %212 + %213 = OpLabel + OpTerminateInvocation + %212 = OpLabel + OpBranch %191 + %205 = OpLabel + %216 = OpFSub %6 %28 %249 + %217 = OpAccessChain %20 %17 %58 + %218 = OpLoad %6 %217 + %219 = OpFOrdLessThan %24 %218 %23 + OpSelectionMerge %269 None + OpBranchConditional %219 %221 %220 + %221 = OpLabel + OpTerminateInvocation + %269 = OpLabel + OpBranch %220 + %220 = OpLabel + %224 = OpFMul %6 %78 %249 + %225 = OpFAdd %6 %224 %28 + %228 = OpIAdd %11 %253 %84 + %230 = OpIAdd %11 %243 %84 + OpBranch %190 + %191 = OpLabel + %233 = OpConvertSToF %6 %253 + %234 = OpCompositeConstruct %7 %28 %28 %233 + OpBranch %182 + %183 = OpLabel + OpBranch %181 + %182 = OpLabel + %266 = OpPhi %6 %251 %189 %249 %191 + %264 = OpPhi %6 %246 %189 %244 %191 + %255 = OpPhi %7 %29 %189 %234 %191 + %132 = OpAccessChain %90 %101 %130 + OpStore %132 %255 + %135 = OpAccessChain %59 %57 %14 %19 + %136 = OpLoad %6 %135 + %137 = OpFOrdGreaterThan %24 %114 %136 + OpSelectionMerge %268 None + OpBranchConditional %137 %138 %139 + %138 = OpLabel + OpTerminateInvocation + %268 = OpLabel + OpBranch %139 + %139 = OpLabel + %142 = OpIAdd %11 %241 %84 + OpBranch %120 + %267 = OpLabel + OpBranch %122 + %122 = OpLabel + %144 = OpIAdd %11 %240 %84 + OpBranch %105 + %107 = OpLabel + %149 = OpLoad %7 %103 + %150 = OpVectorShuffle %15 %149 %149 0 0 1 2 + %152 = OpFAdd %15 %147 %150 + OpStore %154 %152 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/loop-dead-if-loop.amber b/vulkan/amber/graphicsfuzz/loop-dead-if-loop.amber new file mode 100644 index 0000000..8753f53 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/loop-dead-if-loop.amber @@ -0,0 +1,266 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with a loop, dead if, and a loop + +# The test passes because the fragment shader contains two loops that do nothing (the if is never +# entered) and finishes by writing red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# for ( +# int k = 0; +# k < 4; +# k++) +# { +# +# if (0.0 > injectionSwitch.y) // always false +# { +# int donor_replacementGLF_dead0stack[10]; +# int donor_replacementGLF_dead0top; +# for ( +# int GLF_dead0j = 1; +# 1 <= donor_replacementGLF_dead0stack[0]; +# 1) +# { +# } +# donor_replacementGLF_dead0stack[donor_replacementGLF_dead0top >= 0 && donor_replacementGLF_dead0top < 9 ? ++donor_replacementGLF_dead0top : 0] = 1; +# } +# +# vec4 matrix_b = vec4(0.0); +# for ( +# int b = 3; +# b >= 0; +# b--) +# { +# matrix_b[b] = matrix_b[b] - 1.0; +# } +# } +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 90 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %88 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "k" + OpName %22 "buf0" + OpMemberName %22 0 "injectionSwitch" + OpName %24 "" + OpName %33 "GLF_dead0j" + OpName %43 "donor_replacementGLF_dead0stack" + OpName %47 "donor_replacementGLF_dead0top" + OpName %64 "matrix_b" + OpName %66 "b" + OpName %88 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %33 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %83 RelaxedPrecision + OpDecorate %84 RelaxedPrecision + OpDecorate %85 RelaxedPrecision + OpDecorate %86 RelaxedPrecision + OpDecorate %88 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 4 + %17 = OpTypeBool + %19 = OpTypeFloat 32 + %20 = OpConstant %19 0 + %21 = OpTypeVector %19 2 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpTypeInt 32 0 + %26 = OpConstant %25 1 + %27 = OpTypePointer Uniform %19 + %34 = OpConstant %6 1 + %40 = OpConstant %25 10 + %41 = OpTypeArray %6 %40 + %42 = OpTypePointer Function %41 + %51 = OpConstant %6 9 + %62 = OpTypeVector %19 4 + %63 = OpTypePointer Function %62 + %65 = OpConstantComposite %62 %20 %20 %20 %20 + %67 = OpConstant %6 3 + %77 = OpTypePointer Function %19 + %80 = OpConstant %19 1 + %87 = OpTypePointer Output %62 + %88 = OpVariable %87 Output + %89 = OpConstantComposite %62 %80 %20 %20 %80 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %33 = OpVariable %7 Function + %43 = OpVariable %42 Function + %47 = OpVariable %7 Function + %54 = OpVariable %7 Function + %64 = OpVariable %63 Function + %66 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %6 %8 + %18 = OpSLessThan %17 %15 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %28 = OpAccessChain %27 %24 %9 %26 + %29 = OpLoad %19 %28 + %30 = OpFOrdGreaterThan %17 %20 %29 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + OpStore %33 %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %44 = OpAccessChain %7 %43 %9 + %45 = OpLoad %6 %44 + %46 = OpSLessThanEqual %17 %34 %45 + OpBranchConditional %46 %36 %37 + %36 = OpLabel + OpBranch %38 + %38 = OpLabel + OpBranch %35 + %37 = OpLabel + %48 = OpLoad %6 %47 + %49 = OpSGreaterThanEqual %17 %48 %9 + %50 = OpLoad %6 %47 + %52 = OpSLessThan %17 %50 %51 + %53 = OpLogicalAnd %17 %49 %52 + OpSelectionMerge %56 None + OpBranchConditional %53 %55 %59 + %55 = OpLabel + %57 = OpLoad %6 %47 + %58 = OpIAdd %6 %57 %34 + OpStore %47 %58 + OpStore %54 %58 + OpBranch %56 + %59 = OpLabel + OpStore %54 %9 + OpBranch %56 + %56 = OpLabel + %60 = OpLoad %6 %54 + %61 = OpAccessChain %7 %43 %60 + OpStore %61 %34 + OpBranch %32 + %32 = OpLabel + OpStore %64 %65 + OpStore %66 %67 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %66 + %74 = OpSGreaterThanEqual %17 %73 %9 + OpBranchConditional %74 %69 %70 + %69 = OpLabel + %75 = OpLoad %6 %66 + %76 = OpLoad %6 %66 + %78 = OpAccessChain %77 %64 %76 + %79 = OpLoad %19 %78 + %81 = OpFSub %19 %79 %80 + %82 = OpAccessChain %77 %64 %75 + OpStore %82 %81 + OpBranch %71 + %71 = OpLabel + %83 = OpLoad %6 %66 + %84 = OpISub %6 %83 %34 + OpStore %66 %84 + OpBranch %68 + %70 = OpLabel + OpBranch %13 + %13 = OpLabel + %85 = OpLoad %6 %8 + %86 = OpIAdd %6 %85 %34 + OpStore %8 %86 + OpBranch %10 + %12 = OpLabel + OpStore %88 %89 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/loop-nested-ifs.amber b/vulkan/amber/graphicsfuzz/loop-nested-ifs.amber new file mode 100644 index 0000000..e32c02c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/loop-nested-ifs.amber @@ -0,0 +1,186 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with a for loop containing nested ifs + +# The test passes because the two-iteration loop only writes red to the output color variable. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# for ( +# int j = 0; +# j < 2; +# j++) +# { +# if (j < 1) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // red +# } +# if (j != 3) +# { +# if (j != 4) +# { +# if (j == 5) // always false +# { +# _GLF_color[0] = float(ldexp(1.0, 2)); +# } +# else +# { +# float a; +# a = float(ldexp(1.0, 2)); +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // red +# } +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 57 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %27 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "j" + OpName %27 "_GLF_color" + OpName %53 "a" + OpDecorate %8 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %27 Location 0 + OpDecorate %31 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypeBool + %20 = OpConstant %6 1 + %24 = OpTypeFloat 32 + %25 = OpTypeVector %24 4 + %26 = OpTypePointer Output %25 + %27 = OpVariable %26 Output + %28 = OpConstant %24 1 + %29 = OpConstant %24 0 + %30 = OpConstantComposite %25 %28 %29 %29 %28 + %32 = OpConstant %6 3 + %37 = OpConstant %6 4 + %42 = OpConstant %6 5 + %47 = OpTypeInt 32 0 + %48 = OpConstant %47 0 + %49 = OpTypePointer Output %24 + %52 = OpTypePointer Function %24 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %53 = OpVariable %52 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %6 %8 + %18 = OpSLessThan %17 %15 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %19 = OpLoad %6 %8 + %21 = OpSLessThan %17 %19 %20 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %23 + %22 = OpLabel + OpStore %27 %30 + OpBranch %23 + %23 = OpLabel + %31 = OpLoad %6 %8 + %33 = OpINotEqual %17 %31 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %35 + %34 = OpLabel + %36 = OpLoad %6 %8 + %38 = OpINotEqual %17 %36 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + %41 = OpLoad %6 %8 + %43 = OpIEqual %17 %41 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %51 + %44 = OpLabel + %46 = OpExtInst %24 %1 Ldexp %28 %16 + %50 = OpAccessChain %49 %27 %48 + OpStore %50 %46 + OpBranch %45 + %51 = OpLabel + %54 = OpExtInst %24 %1 Ldexp %28 %16 + OpStore %53 %54 + OpStore %27 %30 + OpBranch %45 + %45 = OpLabel + OpBranch %40 + %40 = OpLabel + OpBranch %35 + %35 = OpLabel + OpBranch %13 + %13 = OpLabel + %55 = OpLoad %6 %8 + %56 = OpIAdd %6 %55 %20 + OpStore %8 %56 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/loops-breaks-returns.amber b/vulkan/amber/graphicsfuzz/loops-breaks-returns.amber new file mode 100644 index 0000000..86375bb --- /dev/null +++ b/vulkan/amber/graphicsfuzz/loops-breaks-returns.amber @@ -0,0 +1,239 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A compute shader with loops, breaks, returns + +# The test passes because the shader immediately writes 42 to the 0th position +# in the SSBO and that is the only thing we check. All loops terminate. All +# other writes to the SSBO are at indices greater than 0. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-code-aggressive' +# '--simplify-instructions' +# '--redundancy-elimination' +# '--copy-propagate-arrays' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--eliminate-local-multi-store' +# '--eliminate-local-multi-store' +# '--eliminate-dead-inserts' +# '--eliminate-local-single-block' +# '--redundancy-elimination' +# '--eliminate-dead-branches' +# spirv-opt commit hash: 4a00a80c40484a6f6f72f48c9d34943cf8f180d4 + + + +# variant_compute_shader is derived from the following GLSL: +# #version 310 es +# +# layout(std430, binding = 0) buffer theSSBO +# { +# uint data_out[5]; +# }; +# +# layout(set = 0, binding = 1) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# layout(local_size_x = 100, local_size_y = 1, local_size_z = 1) in; +# +# void main() +# { +# data_out[0] = 42u; +# uint gid = uint(injectionSwitch.y); // 1 +# do +# { +# if (1u != gid) // always false +# { +# data_out[1] = 1u; +# return; +# } +# } while (false); +# +# uint d; +# while (true) +# { +# if (d != 0u) +# { +# data_out[1] = 2u; +# for (int i = 0; i < 1; ++i) +# { +# data_out[1] = 3u; +# return; +# } +# } +# break; +# } +# data_out[gid] = 7u; // gid == 1 +# } +SHADER compute variant_compute_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 86 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %4 "main" + OpExecutionMode %4 LocalSize 100 1 1 + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "theSSBO" + OpMemberName %9 0 "data_out" + OpName %11 "" + OpName %18 "gid" + OpName %21 "buf0" + OpMemberName %21 0 "injectionSwitch" + OpName %23 "" + OpName %48 "d" + OpName %57 "i" + OpDecorate %8 ArrayStride 4 + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 BufferBlock + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 0 + OpMemberDecorate %21 0 Offset 0 + OpDecorate %21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 1 + OpDecorate %76 BuiltIn WorkgroupSize + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpConstant %6 5 + %8 = OpTypeArray %6 %7 + %9 = OpTypeStruct %8 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpConstant %6 42 + %15 = OpTypePointer Uniform %6 + %17 = OpTypePointer Function %6 + %19 = OpTypeFloat 32 + %20 = OpTypeVector %19 2 + %21 = OpTypeStruct %20 + %22 = OpTypePointer Uniform %21 + %23 = OpVariable %22 Uniform + %24 = OpConstant %6 1 + %25 = OpTypePointer Uniform %19 + %34 = OpTypeBool + %38 = OpConstant %12 1 + %41 = OpConstantFalse %34 + %47 = OpConstantTrue %34 + %50 = OpConstant %6 0 + %54 = OpConstant %6 2 + %56 = OpTypePointer Function %12 + %65 = OpConstant %6 3 + %72 = OpConstant %6 7 + %74 = OpTypeVector %6 3 + %75 = OpConstant %6 100 + %76 = OpConstantComposite %74 %75 %24 %24 + %80 = OpUndef %6 + %85 = OpUndef %12 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %18 = OpVariable %17 Function + %48 = OpVariable %17 Function + %57 = OpVariable %56 Function + %16 = OpAccessChain %15 %11 %13 %13 + OpStore %16 %14 + %26 = OpAccessChain %25 %23 %13 %24 + %27 = OpLoad %19 %26 + %28 = OpConvertFToU %6 %27 + OpStore %18 %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %30 + %30 = OpLabel + %35 = OpINotEqual %34 %24 %28 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %37 + %36 = OpLabel + %39 = OpAccessChain %15 %11 %13 %38 + OpStore %39 %24 + OpReturn + %37 = OpLabel + OpBranch %32 + %32 = OpLabel + OpBranchConditional %41 %29 %31 + %31 = OpLabel + OpBranch %42 + %42 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + OpBranch %43 + %43 = OpLabel + %51 = OpINotEqual %34 %80 %50 + OpSelectionMerge %53 None + OpBranchConditional %51 %52 %53 + %52 = OpLabel + %55 = OpAccessChain %15 %11 %13 %38 + OpStore %55 %54 + OpStore %57 %13 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %64 = OpSLessThan %34 %13 %38 + OpBranchConditional %64 %59 %60 + %59 = OpLabel + OpStore %55 %65 + OpReturn + %61 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %53 + %53 = OpLabel + %82 = OpPhi %6 %28 %43 %28 %60 + OpBranch %44 + %45 = OpLabel + OpBranch %42 + %44 = OpLabel + %73 = OpAccessChain %15 %11 %13 %82 + OpStore %73 %72 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_ssbo DATA_TYPE uint32 DATA + 0 0 0 0 0 +END + +PIPELINE compute variant_pipeline + ATTACH variant_compute_shader + BIND BUFFER variant_ssbo AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1 +END + +RUN variant_pipeline 1 1 1 + +EXPECT variant_ssbo IDX 0 EQ 42 diff --git a/vulkan/amber/graphicsfuzz/loops-ifs-continues-call.amber b/vulkan/amber/graphicsfuzz/loops-ifs-continues-call.amber new file mode 100644 index 0000000..07f985f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/loops-ifs-continues-call.amber @@ -0,0 +1,294 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with nested control flow and a call + +# The test passes because all loops terminate or are not entered and the shader ends by writing red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# struct BinarySearchObject +# { +# int prime_numbers[10]; +# }; +# +# int binarySearch(BinarySearchObject obj) +# { +# while (injectionSwitch.x > 1.0) // always false +# { +# int m = int(injectionSwitch.x); +# if (obj.prime_numbers[m] == 1) +# { +# return 1; +# } +# } +# return 1; +# } +# +# void main() +# { +# BinarySearchObject obj; +# for ( +# int i = 0; +# i < 10; +# i++) +# { +# if (i != 3) +# { +# if ((i - int(injectionSwitch.x)) == 4) +# { +# obj.prime_numbers[i] = 11; +# } +# else +# { +# if (i == 6) +# { +# obj.prime_numbers[i] = 17; +# } +# continue; +# } +# } +# do +# { +# } while (0.0 > injectionSwitch.y); // always false +# } +# binarySearch(obj); +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 104 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %102 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "BinarySearchObject" + OpMemberName %10 0 "prime_numbers" + OpName %14 "binarySearch(struct-BinarySearchObject-i1[10]1;" + OpName %13 "obj" + OpName %23 "buf0" + OpMemberName %23 0 "injectionSwitch" + OpName %25 "" + OpName %35 "m" + OpName %49 "i" + OpName %72 "obj" + OpName %97 "param" + OpName %102 "_GLF_color" + OpMemberDecorate %10 0 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %35 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + OpDecorate %63 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %67 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %77 RelaxedPrecision + OpDecorate %82 RelaxedPrecision + OpDecorate %95 RelaxedPrecision + OpDecorate %96 RelaxedPrecision + OpDecorate %99 RelaxedPrecision + OpDecorate %102 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypeStruct %9 + %11 = OpTypePointer Function %10 + %12 = OpTypeFunction %6 %11 + %21 = OpTypeFloat 32 + %22 = OpTypeVector %21 2 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpConstant %6 0 + %27 = OpConstant %7 0 + %28 = OpTypePointer Uniform %21 + %31 = OpConstant %21 1 + %32 = OpTypeBool + %34 = OpTypePointer Function %6 + %42 = OpConstant %6 1 + %56 = OpConstant %6 10 + %59 = OpConstant %6 3 + %68 = OpConstant %6 4 + %74 = OpConstant %6 11 + %78 = OpConstant %6 6 + %83 = OpConstant %6 17 + %90 = OpConstant %21 0 + %91 = OpConstant %7 1 + %100 = OpTypeVector %21 4 + %101 = OpTypePointer Output %100 + %102 = OpVariable %101 Output + %103 = OpConstantComposite %100 %31 %90 %90 %31 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %49 = OpVariable %34 Function + %72 = OpVariable %11 Function + %97 = OpVariable %11 Function + OpStore %49 %26 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %49 + %57 = OpSLessThan %32 %55 %56 + OpBranchConditional %57 %51 %52 + %51 = OpLabel + %58 = OpLoad %6 %49 + %60 = OpINotEqual %32 %58 %59 + OpSelectionMerge %62 None + OpBranchConditional %60 %61 %62 + %61 = OpLabel + %63 = OpLoad %6 %49 + %64 = OpAccessChain %28 %25 %26 %27 + %65 = OpLoad %21 %64 + %66 = OpConvertFToS %6 %65 + %67 = OpISub %6 %63 %66 + %69 = OpIEqual %32 %67 %68 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %76 + %70 = OpLabel + %73 = OpLoad %6 %49 + %75 = OpAccessChain %34 %72 %26 %73 + OpStore %75 %74 + OpBranch %71 + %76 = OpLabel + %77 = OpLoad %6 %49 + %79 = OpIEqual %32 %77 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %80 %81 + %80 = OpLabel + %82 = OpLoad %6 %49 + %84 = OpAccessChain %34 %72 %26 %82 + OpStore %84 %83 + OpBranch %81 + %81 = OpLabel + OpBranch %53 + %71 = OpLabel + OpBranch %62 + %62 = OpLabel + OpBranch %86 + %86 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %87 + %87 = OpLabel + OpBranch %89 + %89 = OpLabel + %92 = OpAccessChain %28 %25 %26 %91 + %93 = OpLoad %21 %92 + %94 = OpFOrdGreaterThan %32 %90 %93 + OpBranchConditional %94 %86 %88 + %88 = OpLabel + OpBranch %53 + %53 = OpLabel + %95 = OpLoad %6 %49 + %96 = OpIAdd %6 %95 %42 + OpStore %49 %96 + OpBranch %50 + %52 = OpLabel + %98 = OpLoad %10 %72 + OpStore %97 %98 + %99 = OpFunctionCall %6 %14 %97 + OpStore %102 %103 + OpReturn + OpFunctionEnd + %14 = OpFunction %6 None %12 + %13 = OpFunctionParameter %11 + %15 = OpLabel + %35 = OpVariable %34 Function + OpBranch %16 + %16 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %29 = OpAccessChain %28 %25 %26 %27 + %30 = OpLoad %21 %29 + %33 = OpFOrdGreaterThan %32 %30 %31 + OpBranchConditional %33 %17 %18 + %17 = OpLabel + %36 = OpAccessChain %28 %25 %26 %27 + %37 = OpLoad %21 %36 + %38 = OpConvertFToS %6 %37 + OpStore %35 %38 + %39 = OpLoad %6 %35 + %40 = OpAccessChain %34 %13 %26 %39 + %41 = OpLoad %6 %40 + %43 = OpIEqual %32 %41 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %45 + %44 = OpLabel + OpReturnValue %42 + %45 = OpLabel + OpBranch %19 + %19 = OpLabel + OpBranch %16 + %18 = OpLabel + OpReturnValue %42 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/mat-array-deep-control-flow.amber b/vulkan/amber/graphicsfuzz/mat-array-deep-control-flow.amber new file mode 100644 index 0000000..1d6c96b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/mat-array-deep-control-flow.amber @@ -0,0 +1,189 @@ +#!amber + +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# A fragment shader that uses an array of matrices and has deep control flow. +# Derived from the following GLSL fragment shader. +# We check that the top-left pixel is red. The test passes because the +# first if statement checks if the x coordinate is less than 10 and if so writes +# red to _GLF_color and then returns. + +# #version 310 es +# +# precision highp float; +# precision highp int; +# +# layout(location=0) out vec4 _GLF_color; +# +# void main() { +# if (gl_FragCoord.x < 10.0) { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# return; +# } +# if(true) { +# if(true) { +# if(true) { +# mat4 one = mat4( +# 1.0, 1.0, 1.0, 1.0, +# 1.0, 1.0, 1.0, 1.0, +# 1.0, 1.0, 1.0, 1.0, +# 1.0, 1.0, 1.0, 1.0 +# ); +# mat4 m[4] = mat4[](one, one, one, one); +# for(int i = 0; i < 4; i ++) { +# for(int j = 0; j < 4; j ++) { +# vec2 v = vec2(1.0) / m[j < 4 ? 1 : 0][i].w; +# if(distance(vec2(1.0), v) < 1.0) { +# _GLF_color = vec4(1.0); +# } +# } +# } +# } +# } +# } +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft + OpSource ESSL 310 + OpName %2 "main" + OpName %3 "gl_FragCoord" + OpName %4 "_GLF_color" + OpName %5 "m" + OpDecorate %3 BuiltIn FragCoord + OpDecorate %4 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeFloat 32 + %9 = OpTypeVector %8 4 + %10 = OpTypePointer Input %9 + %3 = OpVariable %10 Input + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 0 + %13 = OpTypePointer Input %8 + %14 = OpConstant %8 10 + %15 = OpTypeBool + %16 = OpTypePointer Output %9 + %4 = OpVariable %16 Output + %17 = OpConstant %8 1 + %18 = OpConstant %8 0 + %19 = OpConstantComposite %9 %17 %18 %18 %17 + %20 = OpTypeMatrix %9 4 + %21 = OpConstantComposite %9 %17 %17 %17 %17 + %22 = OpConstantComposite %20 %21 %21 %21 %21 + %23 = OpConstant %11 4 + %24 = OpTypeArray %20 %23 + %25 = OpTypePointer Function %24 + %26 = OpTypeInt 32 1 + %27 = OpConstant %26 0 + %28 = OpConstant %26 4 + %29 = OpTypeVector %8 2 + %30 = OpConstantComposite %29 %17 %17 + %31 = OpConstant %26 1 + %32 = OpConstant %11 3 + %33 = OpTypePointer Function %8 + %34 = OpConstantComposite %24 %22 %22 %22 %22 + %2 = OpFunction %6 None %7 + %35 = OpLabel + %5 = OpVariable %25 Function + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpAccessChain %13 %3 %12 + %41 = OpLoad %8 %40 + %42 = OpFOrdLessThan %15 %41 %14 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpStore %4 %19 + OpBranch %37 + %43 = OpLabel + OpStore %5 %34 + OpBranch %45 + %45 = OpLabel + %46 = OpPhi %26 %27 %43 %47 %48 + %49 = OpSLessThan %15 %46 %28 + OpLoopMerge %50 %48 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpBranch %52 + %52 = OpLabel + %53 = OpPhi %26 %27 %51 %54 %55 + %56 = OpSLessThan %15 %53 %28 + OpLoopMerge %57 %55 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + %59 = OpSelect %26 %56 %31 %27 + %60 = OpAccessChain %33 %5 %59 %46 %32 + %61 = OpLoad %8 %60 + %62 = OpCompositeConstruct %29 %61 %61 + %63 = OpFDiv %29 %30 %62 + %64 = OpExtInst %8 %1 Distance %30 %63 + %65 = OpFOrdLessThan %15 %64 %17 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %55 + %67 = OpLabel + OpStore %4 %21 + OpBranch %55 + %66 = OpLabel + OpBranch %55 + %55 = OpLabel + %54 = OpIAdd %26 %53 %31 + OpBranch %52 + %57 = OpLabel + OpBranch %48 + %48 = OpLabel + %47 = OpIAdd %26 %46 %31 + OpBranch %45 + %50 = OpLabel + OpBranch %37 + %38 = OpLabel + OpBranch %36 + %37 = OpLabel + OpReturn + OpFunctionEnd +END + + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/mat-array-distance.amber b/vulkan/amber/graphicsfuzz/mat-array-distance.amber new file mode 100644 index 0000000..59cac11 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/mat-array-distance.amber @@ -0,0 +1,192 @@ +#!amber + +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# A fragment shader that uses an array of matrices and distance. +# Derived from the following GLSL fragment shader. +# We check that the top-left pixel is red. The test passes because the +# first if statement checks if the x coordinate is less than 10 and if so writes +# red to _GLF_color and then returns. + +# #version 310 es +# +# precision highp float; +# precision highp int; +# +# layout(location=0) out vec4 _GLF_color; +# +# void main() +# { +# if (gl_FragCoord.x < 10.0) { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# return; +# } +# mat4 m[4] = mat4[](mat4(1.0), mat4(1.0), mat4(1.0), mat4(1.0)); +# for(int i = 0; i < 4; i ++) { +# int l = 0; +# for(int j = 0; j < 4; j ++) { +# if(l >= 2) { +# break; +# } +# l++; +# vec2 v = m[j][i].xy; +# if(distance(vec2(1.0), v) < 1.0) { +# _GLF_color = vec4(1.0); +# } +# } +# } +# } + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft + OpSource ESSL 310 + OpName %2 "main" + OpName %3 "gl_FragCoord" + OpName %4 "_GLF_color" + OpName %5 "m" + OpDecorate %3 BuiltIn FragCoord + OpDecorate %4 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeFloat 32 + %9 = OpTypeVector %8 4 + %10 = OpTypePointer Input %9 + %3 = OpVariable %10 Input + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 0 + %13 = OpTypePointer Input %8 + %14 = OpConstant %8 10 + %15 = OpTypeBool + %16 = OpTypePointer Output %9 + %4 = OpVariable %16 Output + %17 = OpConstant %8 1 + %18 = OpConstant %8 0 + %19 = OpConstantComposite %9 %17 %18 %18 %17 + %20 = OpTypeMatrix %9 4 + %21 = OpConstant %11 4 + %22 = OpTypeArray %20 %21 + %23 = OpTypePointer Function %22 + %24 = OpConstantComposite %9 %17 %18 %18 %18 + %25 = OpConstantComposite %9 %18 %17 %18 %18 + %26 = OpConstantComposite %9 %18 %18 %17 %18 + %27 = OpConstantComposite %9 %18 %18 %18 %17 + %28 = OpConstantComposite %20 %24 %25 %26 %27 + %29 = OpConstantComposite %22 %28 %28 %28 %28 + %30 = OpTypeInt 32 1 + %31 = OpConstant %30 0 + %32 = OpConstant %30 4 + %33 = OpConstant %30 2 + %34 = OpConstant %30 1 + %35 = OpTypeVector %8 2 + %36 = OpTypePointer Function %9 + %37 = OpConstantComposite %35 %17 %17 + %38 = OpConstantComposite %9 %17 %17 %17 %17 + %2 = OpFunction %6 None %7 + %39 = OpLabel + %5 = OpVariable %23 Function + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpAccessChain %13 %3 %12 + %45 = OpLoad %8 %44 + %46 = OpFOrdLessThan %15 %45 %14 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + OpStore %4 %19 + OpBranch %41 + %47 = OpLabel + OpStore %5 %29 + OpBranch %49 + %49 = OpLabel + %50 = OpPhi %30 %31 %47 %51 %52 + %53 = OpSLessThan %15 %50 %32 + OpLoopMerge %54 %52 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + OpBranch %56 + %56 = OpLabel + %57 = OpPhi %30 %31 %55 %58 %59 + %60 = OpPhi %30 %31 %55 %61 %59 + %62 = OpSLessThan %15 %60 %32 + OpLoopMerge %63 %59 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + %65 = OpSGreaterThanEqual %15 %57 %33 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %66 + %67 = OpLabel + OpBranch %63 + %66 = OpLabel + %58 = OpIAdd %30 %57 %34 + %68 = OpAccessChain %36 %5 %60 %50 + %69 = OpLoad %9 %68 + %70 = OpVectorShuffle %35 %69 %69 0 1 + %71 = OpExtInst %8 %1 Distance %37 %70 + %72 = OpFOrdLessThan %15 %71 %17 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %59 + %74 = OpLabel + OpStore %4 %38 + OpBranch %59 + %73 = OpLabel + OpBranch %59 + %59 = OpLabel + %61 = OpIAdd %30 %60 %34 + OpBranch %56 + %63 = OpLabel + OpBranch %52 + %52 = OpLabel + %51 = OpIAdd %30 %50 %34 + OpBranch %49 + %54 = OpLabel + OpBranch %41 + %42 = OpLabel + OpBranch %40 + %41 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/mat-mul-in-loop.amber b/vulkan/amber/graphicsfuzz/mat-mul-in-loop.amber new file mode 100644 index 0000000..53ad180 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/mat-mul-in-loop.amber @@ -0,0 +1,175 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: Shader with matrix multiplication in loop + +# The test passes because 'm1' is the identity matrix, so that 'm2' is also the identity matrix, meaning that 'v' gets set to '(1.0, 0.0)'. As a result, the colour that is written is guaranteed to be red + +# Optimized using spirv-opt with the following arguments: +# '--simplify-instructions' +# '--combine-access-chains' +# '--eliminate-dead-branches' +# '--merge-return' +# '--combine-access-chains' +# '--eliminate-dead-code-aggressive' +# '--reduce-load-size' +# '--eliminate-local-single-block' +# '--private-to-local' +# '--inline-entry-points-exhaustive' +# '--copy-propagate-arrays' +# '--eliminate-local-multi-store' +# '--scalar-replacement=100' +# '--eliminate-dead-branches' +# '--eliminate-local-single-store' +# spirv-opt commit hash: f1e5cd73f658abcc23ee96d78f2dc27c4b7028c1 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main(void) +# { +# vec2 v; +# mat2 m1 = mat2(1.0, 0.0, 0.0, 1.0); +# for( +# int i = 0; +# i < 1; +# i++ +# ) +# { +# do +# { +# mat2 m2; +# m2 = m1 * m1; +# v = m2 * vec2(1.0, 0.0); +# } +# while(false); +# } +# _GLF_color = vec4(v, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "m1" + OpName %18 "i" + OpName %33 "m2" + OpName %38 "v" + OpName %46 "_GLF_color" + OpDecorate %46 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeMatrix %7 2 + %9 = OpTypePointer Function %8 + %11 = OpConstant %6 1 + %12 = OpConstant %6 0 + %13 = OpConstantComposite %7 %11 %12 + %14 = OpConstantComposite %7 %12 %11 + %15 = OpConstantComposite %8 %13 %14 + %16 = OpTypeInt 32 1 + %17 = OpTypePointer Function %16 + %19 = OpConstant %16 0 + %26 = OpConstant %16 1 + %27 = OpTypeBool + %37 = OpTypePointer Function %7 + %41 = OpConstantFalse %27 + %44 = OpTypeVector %6 4 + %45 = OpTypePointer Output %44 + %46 = OpVariable %45 Output + %53 = OpUndef %7 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %18 = OpVariable %17 Function + %33 = OpVariable %9 Function + %38 = OpVariable %37 Function + OpStore %10 %15 + OpStore %18 %19 + OpBranch %20 + %20 = OpLabel + %55 = OpPhi %8 %15 %5 %55 %23 + %52 = OpPhi %7 %53 %5 %40 %23 + %51 = OpPhi %16 %19 %5 %43 %23 + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %28 = OpSLessThan %27 %51 %26 + OpBranchConditional %28 %21 %22 + %21 = OpLabel + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %30 + %30 = OpLabel + %36 = OpMatrixTimesMatrix %8 %55 %55 + OpStore %33 %36 + %40 = OpMatrixTimesVector %7 %36 %13 + OpStore %38 %40 + OpBranch %32 + %32 = OpLabel + OpBranchConditional %41 %29 %31 + %31 = OpLabel + OpBranch %23 + %23 = OpLabel + %43 = OpIAdd %16 %51 %26 + OpStore %18 %43 + OpBranch %20 + %22 = OpLabel + %48 = OpCompositeExtract %6 %52 0 + %49 = OpCompositeExtract %6 %52 1 + %50 = OpCompositeConstruct %44 %48 %49 %12 %11 + OpStore %46 %50 + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/matrices-and-return-in-loop.amber b/vulkan/amber/graphicsfuzz/matrices-and-return-in-loop.amber new file mode 100644 index 0000000..e1f0f3e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/matrices-and-return-in-loop.amber @@ -0,0 +1,153 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with matrices and a return in a loop + +# Checks that all pixels are red. +# Passes because main always writes red to _GLF_color. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: a2ef7be242bcacaa9127a3ce011602ec54b2c9ed + +# Derived from the following GLSL. + +# Fragment shader GLSL: +# #version 310 es +# +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 f(mat2 m) +# { +# do +# { +# return vec3(1.0); +# } +# while(false); +# } +# +# void main() +# { +# mat2 m = mat2(0.0); +# if(gl_FragCoord.x >= 0.0) +# { +# m = mat2(1.0); +# } +# f(m * m); +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %31 %49 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %13 "f(mf22;" + OpName %12 "m" + OpName %31 "gl_FragCoord" + OpName %46 "param" + OpName %49 "_GLF_color" + OpDecorate %31 BuiltIn FragCoord + OpDecorate %49 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeMatrix %7 2 + %9 = OpTypePointer Function %8 + %10 = OpTypeVector %6 3 + %11 = OpTypeFunction %10 %9 + %19 = OpConstant %6 1 + %20 = OpConstantComposite %10 %19 %19 %19 + %22 = OpTypeBool + %26 = OpConstant %6 0 + %27 = OpConstantComposite %7 %26 %26 + %28 = OpConstantComposite %8 %27 %27 + %29 = OpTypeVector %6 4 + %30 = OpTypePointer Input %29 + %31 = OpVariable %30 Input + %32 = OpTypeInt 32 0 + %33 = OpConstant %32 0 + %34 = OpTypePointer Input %6 + %40 = OpConstantComposite %7 %19 %26 + %41 = OpConstantComposite %7 %26 %19 + %42 = OpConstantComposite %8 %40 %41 + %48 = OpTypePointer Output %29 + %49 = OpVariable %48 Output + %50 = OpConstantComposite %29 %19 %26 %26 %19 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %46 = OpVariable %9 Function + %35 = OpAccessChain %34 %31 %33 + %36 = OpLoad %6 %35 + %37 = OpFOrdGreaterThanEqual %22 %36 %26 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + OpBranch %39 + %39 = OpLabel + %51 = OpPhi %8 %28 %5 %42 %38 + %45 = OpMatrixTimesMatrix %8 %51 %51 + OpStore %46 %45 + %47 = OpFunctionCall %10 %13 %46 + OpStore %49 %50 + OpReturn + OpFunctionEnd + %13 = OpFunction %10 None %11 + %12 = OpFunctionParameter %9 + %14 = OpLabel + OpBranch %15 + %15 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %16 + %16 = OpLabel + OpReturnValue %20 + %18 = OpLabel + OpBranch %15 + %17 = OpLabel + OpUnreachable + OpFunctionEnd +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 + diff --git a/vulkan/amber/graphicsfuzz/max-mix-conditional-discard.amber b/vulkan/amber/graphicsfuzz/max-mix-conditional-discard.amber new file mode 100644 index 0000000..00bd613 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/max-mix-conditional-discard.amber @@ -0,0 +1,175 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with an expression used in two discard guards + +# The test passes because most of the code never executes; the shader just writes the color red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# mediump vec4 gv; +# +# void main() +# { +# if (injectionSwitch.x > 2.0) // always false +# { +# int temp = int(max(mix(vec4(1.0), vec4(1.0), gv), 8.6)[1]); +# +# if (temp < 150) +# { +# discard; +# } +# +# if (temp < 180) +# { +# discard; +# } +# } +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %51 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "buf0" + OpMemberName %8 0 "injectionSwitch" + OpName %10 "" + OpName %24 "temp" + OpName %29 "gv" + OpName %51 "_GLF_color" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 0 + OpDecorate %29 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %51 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeStruct %7 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %6 + %18 = OpConstant %6 2 + %19 = OpTypeBool + %23 = OpTypePointer Function %11 + %25 = OpTypeVector %6 4 + %26 = OpConstant %6 1 + %27 = OpConstantComposite %25 %26 %26 %26 %26 + %28 = OpTypePointer Private %25 + %29 = OpVariable %28 Private + %32 = OpConstant %6 8.60000038 + %35 = OpConstant %13 1 + %39 = OpConstant %11 150 + %45 = OpConstant %11 180 + %50 = OpTypePointer Output %25 + %51 = OpVariable %50 Output + %52 = OpConstant %6 0 + %53 = OpConstantComposite %25 %26 %52 %52 %26 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %24 = OpVariable %23 Function + %16 = OpAccessChain %15 %10 %12 %14 + %17 = OpLoad %6 %16 + %20 = OpFOrdGreaterThan %19 %17 %18 + OpSelectionMerge %22 None + OpBranchConditional %20 %21 %22 + %21 = OpLabel + %30 = OpLoad %25 %29 + %31 = OpExtInst %25 %1 FMix %27 %27 %30 + %33 = OpCompositeConstruct %25 %32 %32 %32 %32 + %34 = OpExtInst %25 %1 FMax %31 %33 + %36 = OpCompositeExtract %6 %34 1 + %37 = OpConvertFToS %11 %36 + OpStore %24 %37 + %38 = OpLoad %11 %24 + %40 = OpSLessThan %19 %38 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %42 + %41 = OpLabel + OpTerminateInvocation + %42 = OpLabel + %44 = OpLoad %11 %24 + %46 = OpSLessThan %19 %44 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %48 + %47 = OpLabel + OpTerminateInvocation + %48 = OpLabel + OpBranch %22 + %22 = OpLabel + OpStore %51 %53 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/mix-floor-add.amber b/vulkan/amber/graphicsfuzz/mix-floor-add.amber new file mode 100644 index 0000000..cde498e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/mix-floor-add.amber @@ -0,0 +1,109 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with mix, uintBitsToFloat, and floor + +# The test passes because the fragment shader computes a value and then writes the color red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 GLF_live6mand() +# { +# return mix(uintBitsToFloat(uvec3(38730u, 63193u, 63173u)), floor(vec3(463.499, 4.7, 0.7)), vec3(1.0) + vec3(1.0)); +# } +# void main() +# { +# GLF_live6mand(); +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %30 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "GLF_live6mand(" + OpName %30 "_GLF_color" + OpDecorate %30 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeFunction %7 + %11 = OpTypeInt 32 0 + %12 = OpTypeVector %11 3 + %13 = OpConstant %11 38730 + %14 = OpConstant %11 63193 + %15 = OpConstant %11 63173 + %16 = OpConstantComposite %12 %13 %14 %15 + %18 = OpConstant %6 463 + %19 = OpConstant %6 4 + %20 = OpConstant %6 0 + %21 = OpConstantComposite %7 %18 %19 %20 + %22 = OpConstant %6 2 + %23 = OpConstantComposite %7 %22 %22 %22 + %28 = OpTypeVector %6 4 + %29 = OpTypePointer Output %28 + %30 = OpVariable %29 Output + %31 = OpConstant %6 1 + %32 = OpConstantComposite %28 %31 %20 %20 %31 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %27 = OpFunctionCall %7 %9 + OpStore %30 %32 + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %17 = OpBitcast %7 %16 + %24 = OpExtInst %7 %1 FMix %17 %21 %23 + OpReturnValue %24 + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/modf-gl-color.amber b/vulkan/amber/graphicsfuzz/modf-gl-color.amber new file mode 100644 index 0000000..11b0766 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/modf-gl-color.amber @@ -0,0 +1,85 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with modf of gl color + +# The test passes because the shader writes the color red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# modf(vec4(1.0, 0.0, 0.0, 1.0), _GLF_color); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 14 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %12 "_GLF_color" + OpDecorate %12 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpConstant %6 1 + %9 = OpConstant %6 0 + %10 = OpConstantComposite %7 %8 %9 %9 %8 + %11 = OpTypePointer Output %7 + %12 = OpVariable %11 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %13 = OpExtInst %7 %1 Modf %10 %12 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/modf-temp-modf-color.amber b/vulkan/amber/graphicsfuzz/modf-temp-modf-color.amber new file mode 100644 index 0000000..6db51b6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/modf-temp-modf-color.amber @@ -0,0 +1,90 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader that calls modf twice, once with color + +# The test passes because the shader always writes the color red using modf. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 temp; +# modf(vec4(1.0), temp); +# modf(vec4(1.0, 0.0, 0.0, 1.0), _GLF_color); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 18 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "temp" + OpName %16 "_GLF_color" + OpDecorate %16 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpConstant %6 1 + %9 = OpConstantComposite %7 %8 %8 %8 %8 + %10 = OpTypePointer Function %7 + %13 = OpConstant %6 0 + %14 = OpConstantComposite %7 %8 %13 %13 %8 + %15 = OpTypePointer Output %7 + %16 = OpVariable %15 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %12 = OpExtInst %7 %1 Modf %9 %11 + %17 = OpExtInst %7 %1 Modf %14 %16 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/nested-for-break-mat-color.amber b/vulkan/amber/graphicsfuzz/nested-for-break-mat-color.amber new file mode 100644 index 0000000..a56e775 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/nested-for-break-mat-color.amber @@ -0,0 +1,232 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: Two nested for loops modify a mat4 then writes red + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 18b3b94567a9251a6f8491a6d07c4422abadd22c + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float one; +# }; +# +# mat4 m44; +# +# void main() +# { +# m44 = mat4( +# 1.0, 2.0, 3.0, 4.0, +# 5.0, 6.0, 7.0, 8.0, +# 9.0, 10.0, 11.0, 12.0, +# 13.0, 14.0, 15.0, 16.0 +# ); +# +# for ( +# int c = 0; +# c < 4; +# c++) +# { +# // Always false. +# if (gl_FragCoord.y < 0.0) +# { +# break; +# } +# +# for ( +# int r = 0; +# r < 4; +# r++) +# { +# m44[c][r] += one; +# } +# } +# +# // Red: +# // vec4(1.0, 0.0, 0.0, 1.0) +# vec4 c = vec4(0.0); +# c.x += m44[1][1] - 6.0; // += 1.0 +# c.w += m44[2][2] - 11.0; // += 1.0 +# _GLF_color = c; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 117 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 %106 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "m44" + OpName %46 "gl_FragCoord" + OpName %67 "buf0" + OpMemberName %67 0 "one" + OpName %69 "" + OpName %106 "_GLF_color" + OpDecorate %46 BuiltIn FragCoord + OpMemberDecorate %67 0 Offset 0 + OpDecorate %67 Block + OpDecorate %69 DescriptorSet 0 + OpDecorate %69 Binding 0 + OpDecorate %80 RelaxedPrecision + OpDecorate %82 RelaxedPrecision + OpDecorate %106 Location 0 + OpDecorate %115 RelaxedPrecision + OpDecorate %116 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeMatrix %7 4 + %11 = OpConstant %6 1 + %12 = OpConstant %6 2 + %13 = OpConstant %6 3 + %14 = OpConstant %6 4 + %15 = OpConstantComposite %7 %11 %12 %13 %14 + %16 = OpConstant %6 5 + %17 = OpConstant %6 6 + %18 = OpConstant %6 7 + %19 = OpConstant %6 8 + %20 = OpConstantComposite %7 %16 %17 %18 %19 + %21 = OpConstant %6 9 + %22 = OpConstant %6 10 + %23 = OpConstant %6 11 + %24 = OpConstant %6 12 + %25 = OpConstantComposite %7 %21 %22 %23 %24 + %26 = OpConstant %6 13 + %27 = OpConstant %6 14 + %28 = OpConstant %6 15 + %29 = OpConstant %6 16 + %30 = OpConstantComposite %7 %26 %27 %28 %29 + %31 = OpConstantComposite %8 %15 %20 %25 %30 + %32 = OpTypeInt 32 1 + %35 = OpConstant %32 0 + %42 = OpConstant %32 4 + %43 = OpTypeBool + %45 = OpTypePointer Input %7 + %46 = OpVariable %45 Input + %47 = OpTypeInt 32 0 + %48 = OpConstant %47 1 + %49 = OpTypePointer Input %6 + %52 = OpConstant %6 0 + %67 = OpTypeStruct %6 + %68 = OpTypePointer Uniform %67 + %69 = OpVariable %68 Uniform + %70 = OpTypePointer Uniform %6 + %79 = OpConstant %32 1 + %85 = OpConstantComposite %7 %52 %52 %52 %52 + %90 = OpTypePointer Function %6 + %95 = OpConstant %32 2 + %96 = OpConstant %47 2 + %105 = OpTypePointer Output %7 + %106 = OpVariable %105 Output + %108 = OpTypePointer Function %8 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %108 Function + OpStore %10 %31 + OpBranch %36 + %36 = OpLabel + %115 = OpPhi %32 %35 %5 %82 %39 + %44 = OpSLessThan %43 %115 %42 + OpLoopMerge %38 %39 None + OpBranchConditional %44 %37 %38 + %37 = OpLabel + %50 = OpAccessChain %49 %46 %48 + %51 = OpLoad %6 %50 + %53 = OpFOrdLessThan %43 %51 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %55 + %54 = OpLabel + OpBranch %38 + %55 = OpLabel + OpBranch %58 + %58 = OpLabel + %116 = OpPhi %32 %35 %55 %80 %59 + %64 = OpSLessThan %43 %116 %42 + OpLoopMerge %60 %59 None + OpBranchConditional %64 %59 %60 + %59 = OpLabel + %71 = OpAccessChain %70 %69 %35 + %72 = OpLoad %6 %71 + %74 = OpAccessChain %90 %10 %115 %116 + %75 = OpLoad %6 %74 + %76 = OpFAdd %6 %75 %72 + OpStore %74 %76 + %80 = OpIAdd %32 %116 %79 + OpBranch %58 + %60 = OpLabel + OpBranch %39 + %39 = OpLabel + %82 = OpIAdd %32 %115 %79 + OpBranch %36 + %38 = OpLabel + %86 = OpAccessChain %90 %10 %79 %48 + %87 = OpLoad %6 %86 + %88 = OpFSub %6 %87 %17 + %111 = OpCompositeInsert %7 %88 %85 0 + %97 = OpAccessChain %90 %10 %95 %96 + %98 = OpLoad %6 %97 + %99 = OpFSub %6 %98 %23 + %114 = OpCompositeInsert %7 %99 %111 3 + OpStore %106 %114 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 16 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16 + +EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/nested-for-loops-switch-fallthrough.amber b/vulkan/amber/graphicsfuzz/nested-for-loops-switch-fallthrough.amber new file mode 100644 index 0000000..9cc0b47 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/nested-for-loops-switch-fallthrough.amber @@ -0,0 +1,557 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with few nested loops with fallthrough + +# A fragment shader with several nested loops depending on each other and switch case with fallthrough. +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: ab7ac60f14ae66006bed5c989a2cfd4c4881704c + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float zero; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float sums[9]; +# int sum_index = 0; +# +# _GLF_color = vec4(0, 0, 0, 1); +# +# sums[0] = 0.0; +# +# // sum_index is modified in loops A and B like this: +# // A: 0 -> 1, 1 -> 2 +# // B: 2 -> 3 +# // A: 3 -> 4, 4 -> 5 +# // B: 5 -> 6. At this point we set red channel to 1. +# // A: 6: return from main. +# for(int i0 = 2; i0 < 5; i0++) +# { +# // Loop A: After this loop sum_index = sum_index + 2. +# for(int i1 = 2; i1 < 4; i1++) +# { +# for(int i2 = 0; i2 < i0; i2++) +# { +# for(int i3 = 0; i3 < i1; i3++) +# { +# switch(sum_index) +# { +# case 0: +# sums[sum_index]++; +# break; +# case 1: +# sums[sum_index]++; +# break; +# case 2: +# sums[sum_index]++; +# case 3: +# sums[sum_index]++; +# case 4: +# sums[sum_index]++; +# case 5: +# sums[sum_index]++; +# break; +# case 6: +# // This is hit eventually. +# return; +# case 7: +# sums[sum_index]++; +# break; +# case 8: +# sums[sum_index]++; +# } +# } +# } +# +# if(clamp(1.0, gl_FragCoord.y, gl_FragCoord.y) < 0.0) // Always false. +# continue; +# +# if(zero < 0.0) // Always false. +# sums[sum_index]++; +# +# if(gl_FragCoord.y < 0.0) // Always false. +# discard; +# +# sum_index++; +# } +# +# // Loop B: After this loop sum_index = sum_index + 1. +# // +# // Cases that are not supposed to be hit set the green channel +# // to one to mark an error. +# for(int i4 = 4; i4 < 5; i4++) +# { +# for(int i5 = 0; i5 < i0; i5++) +# { +# for(int i6 = 0; i6 < i4; i6++) +# { +# switch(sum_index) +# { +# case 0: +# sums[sum_index]++; +# _GLF_color.g = 1.0; +# case 1: +# sums[sum_index]++; +# _GLF_color.g = 1.0; +# case 2: +# sums[sum_index]++; +# break; +# case 3: +# sums[sum_index]++; +# _GLF_color.g = 1.0; +# case 4: +# sums[sum_index]++; +# _GLF_color.g = 1.0; +# break; +# case 5: +# sums[sum_index]++; +# if (sums[0] != 0.0) // Always true. +# _GLF_color.r = 1.0; +# break; +# case 6: +# sums[sum_index]++; +# _GLF_color.g = 1.0; +# case 7: +# sums[sum_index]++; +# _GLF_color.g = 1.0; +# case 8: +# sums[sum_index]++; +# _GLF_color.g = 1.0; +# } +# } +# } +# +# sum_index++; +# +# if (zero < 1.0) // Always true, but we run the loop only once anyway. +# break; +# } +# } +# +# // We never reach here. Both branches write incorrect color. +# if (sums[0] == 0.0) +# _GLF_color = vec4(0); +# else +# _GLF_color = vec4(1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 358 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 %117 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %13 "_GLF_color" + OpName %21 "sums" + OpName %117 "gl_FragCoord" + OpName %129 "buf0" + OpMemberName %129 0 "zero" + OpName %131 "" + OpDecorate %13 Location 0 + OpDecorate %117 BuiltIn FragCoord + OpMemberDecorate %129 0 Offset 0 + OpDecorate %129 Block + OpDecorate %131 DescriptorSet 0 + OpDecorate %131 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Output %11 + %13 = OpVariable %12 Output + %14 = OpConstant %10 0 + %15 = OpConstant %10 1 + %16 = OpConstantComposite %11 %14 %14 %14 %15 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 9 + %19 = OpTypeArray %10 %18 + %20 = OpTypePointer Function %19 + %22 = OpTypePointer Function %10 + %25 = OpConstant %6 2 + %32 = OpConstant %6 5 + %33 = OpTypeBool + %42 = OpConstant %6 4 + %112 = OpConstant %6 1 + %116 = OpTypePointer Input %11 + %117 = OpVariable %116 Input + %118 = OpConstant %17 1 + %119 = OpTypePointer Input %10 + %129 = OpTypeStruct %10 + %130 = OpTypePointer Uniform %129 + %131 = OpVariable %130 Uniform + %132 = OpTypePointer Uniform %10 + %193 = OpTypePointer Output %10 + %225 = OpConstant %17 0 + %265 = OpConstantComposite %11 %14 %14 %14 %14 + %267 = OpConstantComposite %11 %15 %15 %15 %15 + %272 = OpConstantFalse %33 + %275 = OpConstantTrue %33 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %21 = OpVariable %20 Function + OpBranch %269 + %269 = OpLabel + OpStore %13 %16 + %23 = OpAccessChain %22 %21 %9 + OpStore %23 %14 + OpLoopMerge %268 %271 None + OpBranch %26 + %26 = OpLabel + %300 = OpPhi %33 %272 %269 %312 %29 + %295 = OpPhi %6 %9 %269 %356 %29 + %284 = OpPhi %6 %25 %269 %259 %29 + %34 = OpSLessThan %33 %284 %32 + OpLoopMerge %28 %29 None + OpBranchConditional %34 %27 %28 + %27 = OpLabel + OpBranch %36 + %36 = OpLabel + %299 = OpPhi %33 %300 %27 %304 %39 + %294 = OpPhi %6 %295 %27 %357 %39 + %285 = OpPhi %6 %25 %27 %151 %39 + %43 = OpSLessThan %33 %285 %42 + OpLoopMerge %38 %39 None + OpBranchConditional %43 %37 %38 + %37 = OpLabel + OpBranch %45 + %45 = OpLabel + %298 = OpPhi %33 %299 %37 %296 %48 + %286 = OpPhi %6 %9 %37 %115 %48 + %52 = OpSLessThan %33 %286 %284 + OpLoopMerge %47 %48 None + OpBranchConditional %52 %46 %47 + %46 = OpLabel + OpBranch %54 + %54 = OpLabel + %289 = OpPhi %6 %9 %46 %113 %57 + %61 = OpSLessThan %33 %289 %285 + OpLoopMerge %56 %57 None + OpBranchConditional %61 %55 %56 + %55 = OpLabel + OpSelectionMerge %72 None + OpSwitch %294 %72 0 %63 1 %64 2 %65 3 %66 4 %67 5 %68 6 %69 7 %70 8 %71 + %63 = OpLabel + %74 = OpAccessChain %22 %21 %294 + %75 = OpLoad %10 %74 + %76 = OpFAdd %10 %75 %15 + OpStore %74 %76 + OpBranch %72 + %64 = OpLabel + %79 = OpAccessChain %22 %21 %294 + %80 = OpLoad %10 %79 + %81 = OpFAdd %10 %80 %15 + OpStore %79 %81 + OpBranch %72 + %65 = OpLabel + %84 = OpAccessChain %22 %21 %294 + %85 = OpLoad %10 %84 + %86 = OpFAdd %10 %85 %15 + OpStore %84 %86 + OpBranch %66 + %66 = OpLabel + %88 = OpAccessChain %22 %21 %294 + %89 = OpLoad %10 %88 + %90 = OpFAdd %10 %89 %15 + OpStore %88 %90 + OpBranch %67 + %67 = OpLabel + %92 = OpAccessChain %22 %21 %294 + %93 = OpLoad %10 %92 + %94 = OpFAdd %10 %93 %15 + OpStore %92 %94 + OpBranch %68 + %68 = OpLabel + %96 = OpAccessChain %22 %21 %294 + %97 = OpLoad %10 %96 + %98 = OpFAdd %10 %97 %15 + OpStore %96 %98 + OpBranch %72 + %69 = OpLabel + OpBranch %56 + %70 = OpLabel + %102 = OpAccessChain %22 %21 %294 + %103 = OpLoad %10 %102 + %104 = OpFAdd %10 %103 %15 + OpStore %102 %104 + OpBranch %72 + %71 = OpLabel + %107 = OpAccessChain %22 %21 %294 + %108 = OpLoad %10 %107 + %109 = OpFAdd %10 %108 %15 + OpStore %107 %109 + OpBranch %72 + %72 = OpLabel + OpBranch %57 + %57 = OpLabel + %113 = OpIAdd %6 %289 %112 + OpBranch %54 + %56 = OpLabel + %296 = OpPhi %33 %298 %54 %275 %69 + OpSelectionMerge %276 None + OpBranchConditional %296 %47 %276 + %276 = OpLabel + OpBranch %48 + %48 = OpLabel + %115 = OpIAdd %6 %286 %112 + OpBranch %45 + %47 = OpLabel + %304 = OpPhi %33 %298 %45 %296 %56 + OpSelectionMerge %278 None + OpBranchConditional %304 %38 %278 + %278 = OpLabel + %120 = OpAccessChain %119 %117 %118 + %121 = OpLoad %10 %120 + %124 = OpExtInst %10 %1 FClamp %15 %121 %121 + %125 = OpFOrdLessThan %33 %124 %14 + OpSelectionMerge %127 None + OpBranchConditional %125 %126 %127 + %126 = OpLabel + OpBranch %39 + %127 = OpLabel + %133 = OpAccessChain %132 %131 %9 + %134 = OpLoad %10 %133 + %135 = OpFOrdLessThan %33 %134 %14 + OpSelectionMerge %137 None + OpBranchConditional %135 %136 %137 + %136 = OpLabel + %139 = OpAccessChain %22 %21 %294 + %140 = OpLoad %10 %139 + %141 = OpFAdd %10 %140 %15 + OpStore %139 %141 + OpBranch %137 + %137 = OpLabel + %144 = OpFOrdLessThan %33 %121 %14 + OpSelectionMerge %146 None + OpBranchConditional %144 %145 %146 + %145 = OpLabel + OpTerminateInvocation + %146 = OpLabel + %149 = OpIAdd %6 %294 %112 + OpBranch %39 + %39 = OpLabel + %357 = OpPhi %6 %294 %126 %149 %146 + %151 = OpIAdd %6 %285 %112 + OpBranch %36 + %38 = OpLabel + %312 = OpPhi %33 %299 %36 %304 %47 + OpSelectionMerge %280 None + OpBranchConditional %312 %28 %280 + %280 = OpLabel + OpBranch %153 + %153 = OpLabel + %322 = OpPhi %6 %294 %280 %249 %156 + %313 = OpPhi %6 %42 %280 %257 %156 + %159 = OpSLessThan %33 %313 %32 + OpLoopMerge %155 %156 None + OpBranchConditional %159 %154 %155 + %154 = OpLabel + OpBranch %161 + %161 = OpLabel + %314 = OpPhi %6 %9 %154 %247 %164 + %168 = OpSLessThan %33 %314 %284 + OpLoopMerge %163 %164 None + OpBranchConditional %168 %162 %163 + %162 = OpLabel + OpBranch %170 + %170 = OpLabel + %326 = OpPhi %6 %9 %162 %245 %173 + %177 = OpSLessThan %33 %326 %313 + OpLoopMerge %172 %173 None + OpBranchConditional %177 %171 %172 + %171 = OpLabel + OpSelectionMerge %188 None + OpSwitch %322 %188 0 %179 1 %180 2 %181 3 %182 4 %183 5 %184 6 %185 7 %186 8 %187 + %179 = OpLabel + %190 = OpAccessChain %22 %21 %322 + %191 = OpLoad %10 %190 + %192 = OpFAdd %10 %191 %15 + OpStore %190 %192 + %194 = OpAccessChain %193 %13 %118 + OpStore %194 %15 + OpBranch %180 + %180 = OpLabel + %196 = OpAccessChain %22 %21 %322 + %197 = OpLoad %10 %196 + %198 = OpFAdd %10 %197 %15 + OpStore %196 %198 + %199 = OpAccessChain %193 %13 %118 + OpStore %199 %15 + OpBranch %181 + %181 = OpLabel + %201 = OpAccessChain %22 %21 %322 + %202 = OpLoad %10 %201 + %203 = OpFAdd %10 %202 %15 + OpStore %201 %203 + OpBranch %188 + %182 = OpLabel + %206 = OpAccessChain %22 %21 %322 + %207 = OpLoad %10 %206 + %208 = OpFAdd %10 %207 %15 + OpStore %206 %208 + %209 = OpAccessChain %193 %13 %118 + OpStore %209 %15 + OpBranch %183 + %183 = OpLabel + %211 = OpAccessChain %22 %21 %322 + %212 = OpLoad %10 %211 + %213 = OpFAdd %10 %212 %15 + OpStore %211 %213 + %214 = OpAccessChain %193 %13 %118 + OpStore %214 %15 + OpBranch %188 + %184 = OpLabel + %217 = OpAccessChain %22 %21 %322 + %218 = OpLoad %10 %217 + %219 = OpFAdd %10 %218 %15 + OpStore %217 %219 + %221 = OpLoad %10 %23 + %222 = OpFOrdNotEqual %33 %221 %14 + OpSelectionMerge %224 None + OpBranchConditional %222 %223 %224 + %223 = OpLabel + %226 = OpAccessChain %193 %13 %225 + OpStore %226 %15 + OpBranch %224 + %224 = OpLabel + OpBranch %188 + %185 = OpLabel + %229 = OpAccessChain %22 %21 %322 + %230 = OpLoad %10 %229 + %231 = OpFAdd %10 %230 %15 + OpStore %229 %231 + %232 = OpAccessChain %193 %13 %118 + OpStore %232 %15 + OpBranch %186 + %186 = OpLabel + %234 = OpAccessChain %22 %21 %322 + %235 = OpLoad %10 %234 + %236 = OpFAdd %10 %235 %15 + OpStore %234 %236 + %237 = OpAccessChain %193 %13 %118 + OpStore %237 %15 + OpBranch %187 + %187 = OpLabel + %239 = OpAccessChain %22 %21 %322 + %240 = OpLoad %10 %239 + %241 = OpFAdd %10 %240 %15 + OpStore %239 %241 + %242 = OpAccessChain %193 %13 %118 + OpStore %242 %15 + OpBranch %188 + %188 = OpLabel + OpBranch %173 + %173 = OpLabel + %245 = OpIAdd %6 %326 %112 + OpBranch %170 + %172 = OpLabel + OpBranch %164 + %164 = OpLabel + %247 = OpIAdd %6 %314 %112 + OpBranch %161 + %163 = OpLabel + %249 = OpIAdd %6 %322 %112 + %250 = OpAccessChain %132 %131 %9 + %251 = OpLoad %10 %250 + %252 = OpFOrdLessThan %33 %251 %15 + OpSelectionMerge %254 None + OpBranchConditional %252 %253 %254 + %253 = OpLabel + OpBranch %155 + %254 = OpLabel + OpBranch %156 + %156 = OpLabel + %257 = OpIAdd %6 %313 %112 + OpBranch %153 + %155 = OpLabel + %356 = OpPhi %6 %322 %153 %249 %253 + OpBranch %29 + %29 = OpLabel + %259 = OpIAdd %6 %284 %112 + OpBranch %26 + %28 = OpLabel + %342 = OpPhi %33 %300 %26 %312 %38 + OpSelectionMerge %282 None + OpBranchConditional %342 %268 %282 + %282 = OpLabel + %261 = OpLoad %10 %23 + %262 = OpFOrdEqual %33 %261 %14 + OpSelectionMerge %264 None + OpBranchConditional %262 %263 %266 + %263 = OpLabel + OpStore %13 %265 + OpBranch %264 + %266 = OpLabel + OpStore %13 %267 + OpBranch %264 + %264 = OpLabel + OpBranch %268 + %271 = OpLabel + OpBranch %269 + %268 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 64 64 + +EXPECT variant_framebuffer IDX 0 0 SIZE 64 64 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/nested-for-loops-with-return.amber b/vulkan/amber/graphicsfuzz/nested-for-loops-with-return.amber new file mode 100644 index 0000000..97f8be1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/nested-for-loops-with-return.amber @@ -0,0 +1,198 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with two nested for loops with return + +# The test passes because the shader always writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '--private-to-local' +# '--if-conversion' +# '--eliminate-dead-inserts' +# '--eliminate-dead-branches' +# '--reduce-load-size' +# '--vector-dce' +# '--ccp' +# '--redundancy-elimination' +# '--convert-local-access-chains' +# '--eliminate-dead-inserts' +# '--ccp' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-local-single-block' +# '--eliminate-local-single-block' +# '--copy-propagate-arrays' +# '--inline-entry-points-exhaustive' +# '--ccp' +# '--eliminate-local-multi-store' +# '--inline-entry-points-exhaustive' +# '--reduce-load-size' +# '--ccp' +# '--eliminate-local-single-block' +# '--eliminate-dead-branches' +# spirv-opt commit hash: 230c9e437146e48ec58adb4433890403c23c98fa + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float nb_mod(float limit) +# { +# if (float(1) >= limit) +# { +# return 1.0; +# } +# for ( +# int _injected_loop_counter = 0; +# _injected_loop_counter < 2; +# ++_injected_loop_counter) +# { +# for ( +# int _injected_loop_counter = 0; +# _injected_loop_counter < 1; +# ++_injected_loop_counter) +# { +# return 1.0; +# } +# } +# } +# void main() +# { +# nb_mod(gl_FragCoord.x); +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 66 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %48 %57 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "nb_mod(f1;" + OpName %9 "limit" + OpName %21 "_injected_loop_counter" + OpName %31 "_injected_loop_counter" + OpName %48 "gl_FragCoord" + OpName %49 "param" + OpName %57 "_GLF_color" + OpDecorate %21 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %48 BuiltIn FragCoord + OpDecorate %57 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %12 = OpConstant %6 1 + %14 = OpTypeBool + %19 = OpTypeInt 32 1 + %20 = OpTypePointer Function %19 + %22 = OpConstant %19 0 + %29 = OpConstant %19 2 + %38 = OpConstant %19 1 + %46 = OpTypeVector %6 4 + %47 = OpTypePointer Input %46 + %48 = OpVariable %47 Input + %50 = OpTypeInt 32 0 + %51 = OpConstant %50 0 + %52 = OpTypePointer Input %6 + %56 = OpTypePointer Output %46 + %57 = OpVariable %56 Output + %58 = OpConstant %6 0 + %59 = OpConstantComposite %46 %12 %58 %58 %12 + %63 = OpUndef %19 + %64 = OpConstantTrue %14 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %49 = OpVariable %7 Function + %53 = OpAccessChain %52 %48 %51 + %54 = OpLoad %6 %53 + OpStore %49 %54 + %55 = OpFunctionCall %6 %10 %49 + OpStore %57 %59 + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %21 = OpVariable %20 Function + %31 = OpVariable %20 Function + %13 = OpLoad %6 %9 + %15 = OpFOrdGreaterThanEqual %14 %12 %13 + OpSelectionMerge %17 None + OpBranchConditional %15 %16 %17 + %16 = OpLabel + OpReturnValue %12 + %17 = OpLabel + OpStore %21 %22 + OpBranch %23 + %23 = OpLabel + %30 = OpSLessThan %14 %22 %29 + OpLoopMerge %25 %34 None + OpBranch %24 + %24 = OpLabel + OpStore %31 %22 + OpBranch %32 + %32 = OpLabel + %39 = OpSLessThan %14 %22 %38 + OpLoopMerge %65 %35 None + OpBranch %33 + %65 = OpLabel + OpBranch %34 + %33 = OpLabel + OpReturnValue %12 + %35 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %23 + %25 = OpLabel + OpUnreachable + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/nested-ifs-and-return-in-for-loop.amber b/vulkan/amber/graphicsfuzz/nested-ifs-and-return-in-for-loop.amber new file mode 100644 index 0000000..9392c10 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/nested-ifs-and-return-in-for-loop.amber @@ -0,0 +1,174 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with return in nest of ifs, inside loop + +# The test passes because the fragment shader assigns red to _GLF_color then +# assigns black to _GLF_color in the loop. The other assignment to _GLF_color +# (in the if statement) is not dynamically reachable. + +# Derived from the following GLSL. + +# Fragment shader GLSL: +# #version 310 es +# +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# for( +# int i = 0; +# i < 10; +# i ++ +# ) +# { +# _GLF_color = vec4(1.0); +# if(1.0 > injectionSwitch.y) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# if(true) +# { +# return; +# } +# } +# } +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 46 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %15 "i" + OpName %28 "buf0" + OpMemberName %28 0 "injectionSwitch" + OpName %30 "" + OpDecorate %9 Location 0 + OpDecorate %15 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpMemberDecorate %28 0 Offset 0 + OpDecorate %28 Block + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 0 + OpDecorate %43 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstant %6 0 + %12 = OpConstantComposite %7 %10 %11 %11 %10 + %13 = OpTypeInt 32 1 + %14 = OpTypePointer Function %13 + %16 = OpConstant %13 0 + %23 = OpConstant %13 10 + %24 = OpTypeBool + %26 = OpConstantComposite %7 %10 %10 %10 %10 + %27 = OpTypeVector %6 2 + %28 = OpTypeStruct %27 + %29 = OpTypePointer Uniform %28 + %30 = OpVariable %29 Uniform + %31 = OpTypeInt 32 0 + %32 = OpConstant %31 1 + %33 = OpTypePointer Uniform %6 + %39 = OpConstantTrue %24 + %44 = OpConstant %13 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %15 = OpVariable %14 Function + OpStore %9 %12 + OpStore %15 %16 + OpBranch %17 + %17 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + %22 = OpLoad %13 %15 + %25 = OpSLessThan %24 %22 %23 + OpBranchConditional %25 %18 %19 + %18 = OpLabel + OpStore %9 %26 + %34 = OpAccessChain %33 %30 %16 %32 + %35 = OpLoad %6 %34 + %36 = OpFOrdGreaterThan %24 %10 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + OpStore %9 %12 + OpSelectionMerge %41 None + OpBranchConditional %39 %40 %41 + %40 = OpLabel + OpReturn + %41 = OpLabel + OpBranch %38 + %38 = OpLabel + OpBranch %20 + %20 = OpLabel + %43 = OpLoad %13 %15 + %45 = OpIAdd %13 %43 %44 + OpStore %15 %45 + OpBranch %17 + %19 = OpLabel + OpReturn + OpFunctionEnd +END + + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 255 255 255 diff --git a/vulkan/amber/graphicsfuzz/nested-loops-switch.amber b/vulkan/amber/graphicsfuzz/nested-loops-switch.amber new file mode 100644 index 0000000..a0c868a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/nested-loops-switch.amber @@ -0,0 +1,305 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with nested loops and a switch + +# The test passes because the fragment shader enters the outer loop, immediately breaks, and +# writes the color red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# void main() +# { +# int msb10; +# int i = 0; +# do +# { +# if (i >= int(injectionSwitch.x)) // always true +# { +# break; +# } +# if (0.0 > injectionSwitch.y) +# { +# float donor_replacementGLF_dead5sums[9]; +# for ( +# int GLF_dead5cols = 2; +# GLF_dead5cols <= 4; +# GLF_dead5cols++) +# { +# for ( +# int GLF_dead5rows = 2; +# GLF_dead5rows <= 4; +# GLF_dead5rows++) +# { +# for ( +# int GLF_dead5c = 0; +# GLF_dead5c < GLF_dead5cols; +# GLF_dead5c++) +# { +# for ( +# int GLF_dead5r = 0; +# GLF_dead5r < GLF_dead5rows; +# GLF_dead5r++) +# { +# switch (msb10) +# { +# case 1: +# case 8: +# donor_replacementGLF_dead5sums[msb10 >= 0 && msb10 < 9 ? msb10 : 0] += 1.0; +# } +# } +# } +# msb10++; +# } +# } +# } +# i++; +# } while (i < 200); +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 117 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %115 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %17 "buf0" + OpMemberName %17 0 "injectionSwitch" + OpName %19 "" + OpName %38 "GLF_dead5cols" + OpName %48 "GLF_dead5rows" + OpName %56 "GLF_dead5c" + OpName %65 "GLF_dead5r" + OpName %74 "msb10" + OpName %81 "donor_replacementGLF_dead5sums" + OpName %115 "_GLF_color" + OpMemberDecorate %17 0 Offset 0 + OpDecorate %17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %115 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %15 = OpTypeFloat 32 + %16 = OpTypeVector %15 2 + %17 = OpTypeStruct %16 + %18 = OpTypePointer Uniform %17 + %19 = OpVariable %18 Uniform + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 0 + %22 = OpTypePointer Uniform %15 + %26 = OpTypeBool + %31 = OpConstant %15 0 + %32 = OpConstant %20 1 + %39 = OpConstant %6 2 + %46 = OpConstant %6 4 + %78 = OpConstant %20 9 + %79 = OpTypeArray %15 %78 + %80 = OpTypePointer Function %79 + %85 = OpConstant %6 9 + %90 = OpConstant %15 1 + %91 = OpTypePointer Function %15 + %98 = OpConstant %6 1 + %111 = OpConstant %6 200 + %113 = OpTypeVector %15 4 + %114 = OpTypePointer Output %113 + %115 = OpVariable %114 Output + %116 = OpConstantComposite %113 %90 %31 %31 %90 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %38 = OpVariable %7 Function + %48 = OpVariable %7 Function + %56 = OpVariable %7 Function + %65 = OpVariable %7 Function + %74 = OpVariable %7 Function + %81 = OpVariable %80 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %11 + %11 = OpLabel + %14 = OpLoad %6 %8 + %23 = OpAccessChain %22 %19 %9 %21 + %24 = OpLoad %15 %23 + %25 = OpConvertFToS %6 %24 + %27 = OpSGreaterThanEqual %26 %14 %25 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %29 + %28 = OpLabel + OpBranch %12 + %29 = OpLabel + %33 = OpAccessChain %22 %19 %9 %32 + %34 = OpLoad %15 %33 + %35 = OpFOrdGreaterThan %26 %31 %34 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %37 + %36 = OpLabel + OpStore %38 %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %6 %38 + %47 = OpSLessThanEqual %26 %45 %46 + OpBranchConditional %47 %41 %42 + %41 = OpLabel + OpStore %48 %39 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %6 %48 + %55 = OpSLessThanEqual %26 %54 %46 + OpBranchConditional %55 %50 %51 + %50 = OpLabel + OpStore %56 %9 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %62 = OpLoad %6 %56 + %63 = OpLoad %6 %38 + %64 = OpSLessThan %26 %62 %63 + OpBranchConditional %64 %58 %59 + %58 = OpLabel + OpStore %65 %9 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %6 %65 + %72 = OpLoad %6 %48 + %73 = OpSLessThan %26 %71 %72 + OpBranchConditional %73 %67 %68 + %67 = OpLabel + %75 = OpLoad %6 %74 + OpSelectionMerge %77 None + OpSwitch %75 %77 1 %76 8 %76 + %76 = OpLabel + %82 = OpLoad %6 %74 + %83 = OpSGreaterThanEqual %26 %82 %9 + %84 = OpLoad %6 %74 + %86 = OpSLessThan %26 %84 %85 + %87 = OpLogicalAnd %26 %83 %86 + %88 = OpLoad %6 %74 + %89 = OpSelect %6 %87 %88 %9 + %92 = OpAccessChain %91 %81 %89 + %93 = OpLoad %15 %92 + %94 = OpFAdd %15 %93 %90 + %95 = OpAccessChain %91 %81 %89 + OpStore %95 %94 + OpBranch %77 + %77 = OpLabel + OpBranch %69 + %69 = OpLabel + %97 = OpLoad %6 %65 + %99 = OpIAdd %6 %97 %98 + OpStore %65 %99 + OpBranch %66 + %68 = OpLabel + OpBranch %60 + %60 = OpLabel + %100 = OpLoad %6 %56 + %101 = OpIAdd %6 %100 %98 + OpStore %56 %101 + OpBranch %57 + %59 = OpLabel + %102 = OpLoad %6 %74 + %103 = OpIAdd %6 %102 %98 + OpStore %74 %103 + OpBranch %52 + %52 = OpLabel + %104 = OpLoad %6 %48 + %105 = OpIAdd %6 %104 %98 + OpStore %48 %105 + OpBranch %49 + %51 = OpLabel + OpBranch %43 + %43 = OpLabel + %106 = OpLoad %6 %38 + %107 = OpIAdd %6 %106 %98 + OpStore %38 %107 + OpBranch %40 + %42 = OpLabel + OpBranch %37 + %37 = OpLabel + %108 = OpLoad %6 %8 + %109 = OpIAdd %6 %108 %98 + OpStore %8 %109 + OpBranch %13 + %13 = OpLabel + %110 = OpLoad %6 %8 + %112 = OpSLessThan %26 %110 %111 + OpBranchConditional %112 %10 %12 + %12 = OpLabel + OpStore %115 %116 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/nested-switch-break-discard.amber b/vulkan/amber/graphicsfuzz/nested-switch-break-discard.amber new file mode 100644 index 0000000..3fc7b3b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/nested-switch-break-discard.amber @@ -0,0 +1,161 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: Nested switches with break and discard + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +# +# switch (int(injectionSwitch.x)) // 0 +# { +# case 0: +# switch (1) +# { +# case 1: +# if (gl_FragCoord.y >= 0.0) // Always true. +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Red. +# break; +# } +# discard; +# } +# case 42: +# break; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %32 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "injectionSwitch" + OpName %16 "" + OpName %32 "gl_FragCoord" + OpDecorate %9 Location 0 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %32 BuiltIn FragCoord + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 0 + %11 = OpConstant %6 1 + %12 = OpConstantComposite %7 %10 %10 %10 %11 + %13 = OpTypeVector %6 2 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 0 + %21 = OpTypePointer Uniform %6 + %28 = OpConstant %17 1 + %31 = OpTypePointer Input %7 + %32 = OpVariable %31 Input + %33 = OpConstant %19 1 + %34 = OpTypePointer Input %6 + %37 = OpTypeBool + %41 = OpConstantComposite %7 %11 %10 %10 %11 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpStore %9 %12 + %22 = OpAccessChain %21 %16 %18 %20 + %23 = OpLoad %6 %22 + %24 = OpConvertFToS %17 %23 + OpSelectionMerge %27 None + OpSwitch %24 %27 0 %25 42 %26 + %25 = OpLabel + OpSelectionMerge %30 None + OpSwitch %28 %30 1 %29 + %29 = OpLabel + %35 = OpAccessChain %34 %32 %33 + %36 = OpLoad %6 %35 + %38 = OpFOrdGreaterThanEqual %37 %36 %10 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + OpStore %9 %41 + OpBranch %30 + %40 = OpLabel + OpTerminateInvocation + %30 = OpLabel + OpBranch %26 + %26 = OpLabel + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/one-sized-array.amber b/vulkan/amber/graphicsfuzz/one-sized-array.amber new file mode 100644 index 0000000..99860db --- /dev/null +++ b/vulkan/amber/graphicsfuzz/one-sized-array.amber @@ -0,0 +1,205 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader that uses a struct with an array of size one + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--wrap-opkill' +# '--eliminate-dead-branches' +# '--merge-return' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-functions' +# '--private-to-local' +# '--scalar-replacement=0' +# '--ssa-rewrite' +# '--ccp' +# '--loop-unroll' +# '--eliminate-dead-branches' +# '--simplify-instructions' +# '--scalar-replacement=0' +# '--eliminate-local-single-store' +# '--if-conversion' +# '--simplify-instructions' +# '--eliminate-dead-code-aggressive' +# '--eliminate-dead-branches' +# '--merge-blocks' +# spirv-opt commit hash: dd3d91691f1e1dc4c0f42818756cf5e165c8918c + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# struct S +# { +# int x[1]; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# int zero; +# }; +# +# // Function returns 1 or 2. +# int func(S s, int a) +# { +# _GLF_color = vec4(0); +# +# if(s.x[0] == a) +# return 1; +# +# return 2; +# } +# +# void main() +# { +# S s; +# s.x[0] = zero; +# +# int res = func(s, s.x[0]); +# +# // Always true. +# if (res == 1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 90 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %21 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %21 "_GLF_color" + OpName %38 "buf0" + OpMemberName %38 0 "zero" + OpName %40 "" + OpDecorate %21 Location 0 + OpMemberDecorate %38 0 RelaxedPrecision + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 0 + OpDecorate %43 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %74 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %86 RelaxedPrecision + OpDecorate %89 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 1 + %9 = OpTypeArray %6 %8 + %12 = OpTypePointer Function %6 + %18 = OpTypeFloat 32 + %19 = OpTypeVector %18 4 + %20 = OpTypePointer Output %19 + %21 = OpVariable %20 Output + %22 = OpConstant %18 0 + %23 = OpConstantComposite %19 %22 %22 %22 %22 + %24 = OpConstant %6 0 + %28 = OpTypeBool + %32 = OpConstant %6 1 + %34 = OpConstant %6 2 + %38 = OpTypeStruct %6 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %41 = OpTypePointer Uniform %6 + %56 = OpConstant %18 1 + %57 = OpConstantComposite %19 %56 %22 %22 %56 + %63 = OpConstant %7 0 + %80 = OpTypePointer Function %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %86 = OpVariable %80 Function + %81 = OpVariable %80 Function + %42 = OpAccessChain %41 %40 %24 + %43 = OpLoad %6 %42 + %82 = OpAccessChain %12 %81 %24 + OpStore %82 %43 + %83 = OpLoad %9 %81 + OpStore %86 %83 + %85 = OpAccessChain %12 %81 %24 + %50 = OpLoad %6 %85 + OpSelectionMerge %71 None + OpSwitch %63 %72 + %72 = OpLabel + OpStore %21 %23 + %88 = OpAccessChain %12 %86 %24 + %74 = OpLoad %6 %88 + %76 = OpIEqual %28 %74 %50 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + OpBranch %71 + %77 = OpLabel + OpBranch %71 + %71 = OpLabel + %89 = OpPhi %6 %32 %78 %34 %77 + %53 = OpIEqual %28 %89 %32 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %58 + %54 = OpLabel + OpStore %21 %57 + OpBranch %55 + %58 = OpLabel + OpStore %21 %23 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/pow-vec4.amber b/vulkan/amber/graphicsfuzz/pow-vec4.amber new file mode 100644 index 0000000..e247fd1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/pow-vec4.amber @@ -0,0 +1,104 @@ +#!amber + +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# A fragment shader that uses pow. +# Derived from the following GLSL fragment shader. +# We check that all pixels are red. The test passes because main does +# some computation and then writes red to _GLF_color. + +# #version 310 es +# +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 a = vec2(1.0); +# vec4 b = vec4(1.0); +# pow(vec4(a, vec2(1.0)), b); +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource ESSL 310 + OpName %2 "main" + OpName %4 "a" + OpName %5 "b" + OpName %3 "_GLF_color" + OpDecorate %3 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeFloat 32 + %9 = OpTypeVector %8 2 + %10 = OpTypePointer Function %9 + %11 = OpConstant %8 1 + %12 = OpConstantComposite %9 %11 %11 + %13 = OpTypeVector %8 4 + %14 = OpTypePointer Function %13 + %15 = OpConstantComposite %13 %11 %11 %11 %11 + %16 = OpTypePointer Output %13 + %3 = OpVariable %16 Output + %17 = OpConstant %8 0 + %18 = OpConstantComposite %13 %11 %17 %17 %11 + %2 = OpFunction %6 None %7 + %19 = OpLabel + %4 = OpVariable %10 Function + %5 = OpVariable %14 Function + OpStore %4 %12 + OpStore %5 %15 + %20 = OpLoad %9 %4 + %21 = OpCompositeExtract %8 %20 0 + %22 = OpCompositeExtract %8 %20 1 + %23 = OpCompositeExtract %8 %12 0 + %24 = OpCompositeExtract %8 %12 1 + %25 = OpCompositeConstruct %13 %21 %22 %23 %24 + %26 = OpLoad %13 %5 + %27 = OpExtInst %13 %1 Pow %25 %26 + OpStore %3 %18 + OpReturn + OpFunctionEnd +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/return-before-writing-wrong-color.amber b/vulkan/amber/graphicsfuzz/return-before-writing-wrong-color.amber new file mode 100644 index 0000000..e199754 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/return-before-writing-wrong-color.amber @@ -0,0 +1,162 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with return before writing wrong color + +# The test passes because the shader always writes color red. +# Main writes red and returns. Code after writing red is never executed. + +# Optimized using spirv-opt with the following arguments: +# '--private-to-local' +# '--eliminate-local-multi-store' +# '--redundancy-elimination' +# '--eliminate-dead-code-aggressive' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--reduce-load-size' +# '--combine-access-chains' +# '--combine-access-chains' +# '--eliminate-dead-branches' +# '--ccp' +# '--redundancy-elimination' +# '--simplify-instructions' +# '--vector-dce' +# '--ccp' +# '--private-to-local' +# '--eliminate-dead-inserts' +# spirv-opt commit hash: ad7f2c5c4c7f51360e9e079109a9217aa5ba5cc0 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# struct _GLF_struct_0 +# { +# int msb9; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_struct_0 _GLF_struct_replacement_0; +# +# do +# { +# for (int j = 0; 1 < findLSB(1024); 1) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Write color red +# return; // We always return here. The code below is never executed. +# } +# } while (_GLF_struct_replacement_0.msb9 > 1); +# _GLF_color = vec4(1.0, 1.0, _GLF_struct_replacement_0.msb9, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %27 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %27 "_GLF_color" + OpName %32 "_GLF_struct_0" + OpMemberName %32 0 "msb9" + OpName %34 "_GLF_struct_replacement_0" + OpDecorate %21 RelaxedPrecision + OpDecorate %27 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %13 = OpConstant %10 0 + %19 = OpConstant %10 1 + %20 = OpConstant %10 1024 + %22 = OpTypeBool + %24 = OpTypeFloat 32 + %25 = OpTypeVector %24 4 + %26 = OpTypePointer Output %25 + %27 = OpVariable %26 Output + %28 = OpConstant %24 1 + %29 = OpConstant %24 0 + %30 = OpConstantComposite %25 %28 %29 %29 %28 + %32 = OpTypeStruct %10 + %33 = OpTypePointer Function %32 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %34 = OpVariable %33 Function + OpBranch %6 + %6 = OpLabel + OpLoopMerge %8 %16 None + OpBranch %14 + %14 = OpLabel + %21 = OpExtInst %10 %1 FindILsb %20 + %23 = OpSLessThan %22 %19 %21 + OpLoopMerge %42 %17 None + OpBranchConditional %23 %15 %42 + %15 = OpLabel + OpStore %27 %30 + OpReturn + %17 = OpLabel + OpBranch %14 + %42 = OpLabel + OpBranch %16 + %16 = OpLabel + %35 = OpAccessChain %11 %34 %13 + %36 = OpLoad %10 %35 + %37 = OpSGreaterThan %22 %36 %19 + OpBranchConditional %37 %6 %8 + %8 = OpLabel + %39 = OpLoad %10 %35 + %40 = OpConvertSToF %24 %39 + %41 = OpCompositeConstruct %25 %28 %28 %40 %28 + OpStore %27 %41 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/return-float-from-while-loop.amber b/vulkan/amber/graphicsfuzz/return-float-from-while-loop.amber new file mode 100644 index 0000000..58cbe61 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/return-float-from-while-loop.amber @@ -0,0 +1,190 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with unreachable while loop + +# The test passes because the shader always writes the color red. +# The rest of the code is never reached. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# float deadCode() +# { +# float s; +# for (int i = 1; true; 1) +# { +# if (gl_FragCoord.x < 0.0) +# { +# if (injectionSwitch.x > 1.0) +# { +# return 1.0; +# } +# continue; +# } +# return s; +# } +# return 1.0; +# } +# +# void main() +# { +# if (injectionSwitch.x > 1.0) // Always false +# { +# vec4 c; +# c.y = deadCode(); +# _GLF_color = c; +# } +# +# // Always write color red because the other code is never reached. +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 120 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %23 %64 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %23 "gl_FragCoord" + OpName %34 "buf0" + OpMemberName %34 0 "injectionSwitch" + OpName %36 "" + OpName %64 "_GLF_color" + OpDecorate %23 BuiltIn FragCoord + OpMemberDecorate %34 0 Offset 0 + OpDecorate %34 Block + OpDecorate %36 DescriptorSet 0 + OpDecorate %36 Binding 0 + OpDecorate %64 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %10 = OpTypeInt 32 1 + %19 = OpTypeBool + %21 = OpTypeVector %6 4 + %22 = OpTypePointer Input %21 + %23 = OpVariable %22 Input + %24 = OpTypeInt 32 0 + %25 = OpConstant %24 0 + %26 = OpTypePointer Input %6 + %29 = OpConstant %6 0 + %33 = OpTypeVector %6 2 + %34 = OpTypeStruct %33 + %35 = OpTypePointer Uniform %34 + %36 = OpVariable %35 Uniform + %37 = OpConstant %10 0 + %38 = OpTypePointer Uniform %6 + %41 = OpConstant %6 1 + %63 = OpTypePointer Output %21 + %64 = OpVariable %63 Output + %66 = OpConstantComposite %21 %41 %29 %29 %41 + %110 = OpUndef %6 + %118 = OpUndef %21 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %53 = OpAccessChain %38 %36 %37 %25 + %54 = OpLoad %6 %53 + %55 = OpFOrdGreaterThan %19 %54 %41 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %57 + %56 = OpLabel + OpBranch %83 + %83 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %87 + %87 = OpLabel + OpLoopMerge %88 %100 None + OpBranch %91 + %91 = OpLabel + %92 = OpAccessChain %26 %23 %25 + %93 = OpLoad %6 %92 + %94 = OpFOrdLessThan %19 %93 %29 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + OpSelectionMerge %119 None + OpBranchConditional %55 %101 %100 + %101 = OpLabel + OpBranch %88 + %119 = OpLabel + OpBranch %100 + %100 = OpLabel + OpBranch %87 + %95 = OpLabel + OpBranch %88 + %88 = OpLabel + %113 = OpPhi %6 %41 %101 %110 %95 + OpBranch %84 + %85 = OpLabel + OpBranch %83 + %84 = OpLabel + %107 = OpCompositeInsert %21 %113 %118 1 + OpStore %64 %107 + OpBranch %57 + %57 = OpLabel + OpStore %64 %66 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/return-in-loop-in-function.amber b/vulkan/amber/graphicsfuzz/return-in-loop-in-function.amber new file mode 100644 index 0000000..48976b9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/return-in-loop-in-function.amber @@ -0,0 +1,184 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with early return from loop in function + +# The test passes because the fragment shader writes red. The f function always +# returns 1.0, so c is unchanged. + +# Optimized using spirv-opt with the following arguments: +# '--merge-blocks' +# spirv-opt commit hash: 4a00a80c40484a6f6f72f48c9d34943cf8f180d4 + +# Derived from the following GLSL. + +# Fragment shader GLSL: +# #version 310 es +# +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float f() +# { +# for( +# int i = 1; +# i < 10; +# i ++ +# ) +# { +# if(float(i) >= 1.0) +# { +# return 1.0; +# } +# } +# return 1.0; +# } +# void main() +# { +# vec4 c = vec4(1.0, 0.0, 0.0, 1.0); +# for( +# int i = 0; +# i < 1; +# i ++ +# ) +# { +# c.x = f(); +# } +# _GLF_color = c; +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %56 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f(" + OpName %12 "i" + OpName %36 "c" + OpName %39 "i" + OpName %56 "_GLF_color" + OpDecorate %12 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %56 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %13 = OpConstant %10 1 + %20 = OpConstant %10 10 + %21 = OpTypeBool + %25 = OpConstant %6 1 + %34 = OpTypeVector %6 4 + %35 = OpTypePointer Function %34 + %37 = OpConstant %6 0 + %38 = OpConstantComposite %34 %25 %37 %37 %25 + %40 = OpConstant %10 0 + %49 = OpTypeInt 32 0 + %50 = OpConstant %49 0 + %51 = OpTypePointer Function %6 + %55 = OpTypePointer Output %34 + %56 = OpVariable %55 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %36 = OpVariable %35 Function + %39 = OpVariable %11 Function + OpStore %36 %38 + OpStore %39 %40 + OpBranch %41 + %41 = OpLabel + %46 = OpLoad %10 %39 + %47 = OpSLessThan %21 %46 %13 + OpLoopMerge %43 %42 None + OpBranchConditional %47 %42 %43 + %42 = OpLabel + %48 = OpFunctionCall %6 %8 + %52 = OpAccessChain %51 %36 %50 + OpStore %52 %48 + %53 = OpLoad %10 %39 + %54 = OpIAdd %10 %53 %13 + OpStore %39 %54 + OpBranch %41 + %43 = OpLabel + %57 = OpLoad %34 %36 + OpStore %56 %57 + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %12 = OpVariable %11 Function + OpStore %12 %13 + OpBranch %14 + %14 = OpLabel + %19 = OpLoad %10 %12 + %22 = OpSLessThan %21 %19 %20 + OpLoopMerge %16 %28 None + OpBranchConditional %22 %15 %16 + %15 = OpLabel + %23 = OpLoad %10 %12 + %24 = OpConvertSToF %6 %23 + %26 = OpFOrdGreaterThanEqual %21 %24 %25 + OpSelectionMerge %58 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + OpReturnValue %25 + %58 = OpLabel + OpBranch %28 + %28 = OpLabel + %30 = OpLoad %10 %12 + %31 = OpIAdd %10 %30 %13 + OpStore %12 %31 + OpBranch %14 + %16 = OpLabel + OpReturnValue %25 + OpFunctionEnd +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/return-inside-loop-in-function.amber b/vulkan/amber/graphicsfuzz/return-inside-loop-in-function.amber new file mode 100644 index 0000000..5c244d5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/return-inside-loop-in-function.amber @@ -0,0 +1,223 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with return inside loop + +# The test passes because main always writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-inserts' +# '--private-to-local' +# '--eliminate-dead-inserts' +# '--ccp' +# '--vector-dce' +# '--vector-dce' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-inserts' +# '--redundancy-elimination' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-inserts' +# '--private-to-local' +# '--eliminate-dead-inserts' +# '--convert-local-access-chains' +# '--eliminate-local-multi-store' +# '--simplify-instructions' +# '--convert-local-access-chains' +# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 GLF_live4drawShape() +# { +# for (int i = 0; i < 0; i++) +# { +# return vec3(1.0); +# } +# } +# +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Writes the color red +# GLF_live4drawShape(); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 90 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %32 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "GLF_live4drawShape(" + OpName %13 "i" + OpName %32 "_GLF_color" + OpDecorate %13 RelaxedPrecision + OpDecorate %32 Location 0 + OpDecorate %51 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeFunction %7 + %11 = OpTypeInt 32 1 + %12 = OpTypePointer Function %11 + %14 = OpConstant %11 0 + %21 = OpTypeBool + %23 = OpConstant %6 1 + %24 = OpConstantComposite %7 %23 %23 %23 + %27 = OpConstant %11 1 + %30 = OpTypeVector %6 4 + %31 = OpTypePointer Output %30 + %32 = OpVariable %31 Output + %33 = OpConstant %6 0 + %34 = OpConstantComposite %30 %23 %33 %33 %23 + %37 = OpTypePointer Function %7 + %43 = OpConstantFalse %21 + %44 = OpTypePointer Function %21 + %46 = OpConstantTrue %21 + %76 = OpUndef %7 + %77 = OpUndef %11 + %78 = OpUndef %21 + %87 = OpUndef %7 + %88 = OpUndef %11 + %89 = OpUndef %21 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %49 = OpVariable %44 Function %43 + %50 = OpVariable %37 Function + %51 = OpVariable %12 Function + %52 = OpVariable %37 Function + OpStore %32 %34 + OpStore %49 %43 + OpBranch %53 + %53 = OpLabel + %71 = OpPhi %21 %43 %5 %78 %55 + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + OpStore %51 %14 + OpBranch %57 + %57 = OpLabel + %70 = OpPhi %21 %71 %56 %78 %59 + %68 = OpPhi %11 %14 %56 %77 %59 + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %62 = OpSLessThan %21 %68 %14 + OpBranchConditional %62 %63 %58 + %63 = OpLabel + OpStore %49 %46 + OpStore %50 %24 + OpBranch %58 + %59 = OpLabel + OpBranch %57 + %58 = OpLabel + %73 = OpPhi %7 %76 %60 %24 %63 + %69 = OpPhi %21 %70 %60 %46 %63 + OpSelectionMerge %65 None + OpBranchConditional %69 %54 %65 + %65 = OpLabel + %66 = OpUndef %7 + OpStore %49 %46 + OpBranch %54 + %55 = OpLabel + OpBranch %53 + %54 = OpLabel + %72 = OpPhi %7 %73 %58 %66 %65 + OpStore %52 %72 + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %45 = OpVariable %44 Function %43 + %38 = OpVariable %37 Function + %13 = OpVariable %12 Function + OpBranch %40 + %40 = OpLabel + %82 = OpPhi %21 %43 %10 %89 %42 + OpLoopMerge %36 %42 None + OpBranch %41 + %41 = OpLabel + OpStore %13 %14 + OpBranch %15 + %15 = OpLabel + %81 = OpPhi %21 %82 %41 %89 %18 + %79 = OpPhi %11 %14 %41 %88 %18 + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %22 = OpSLessThan %21 %79 %14 + OpBranchConditional %22 %16 %17 + %16 = OpLabel + OpStore %45 %46 + OpStore %38 %24 + OpBranch %17 + %18 = OpLabel + OpBranch %15 + %17 = OpLabel + %84 = OpPhi %7 %87 %19 %24 %16 + %80 = OpPhi %21 %81 %19 %46 %16 + OpSelectionMerge %47 None + OpBranchConditional %80 %36 %47 + %47 = OpLabel + %29 = OpUndef %7 + OpStore %45 %46 + OpBranch %36 + %42 = OpLabel + OpBranch %40 + %36 = OpLabel + %83 = OpPhi %7 %84 %17 %29 %47 + OpReturnValue %83 + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/returned-boolean-in-vector.amber b/vulkan/amber/graphicsfuzz/returned-boolean-in-vector.amber new file mode 100644 index 0000000..d68d601 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/returned-boolean-in-vector.amber @@ -0,0 +1,231 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with returned boolean in vector + +# The test passes because the shader always writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--merge-return' +# '--inline-entry-points-exhaustive' +# '--vector-dce' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--vector-dce' +# '--eliminate-dead-code-aggressive' +# '--scalar-replacement=100' +# '--eliminate-dead-branches' +# '--reduce-load-size' +# '--eliminate-local-multi-store' +# '--ccp' +# spirv-opt commit hash: ad7f2c5c4c7f51360e9e079109a9217aa5ba5cc0 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# bool puzzlelize() +# { +# for (int i = 0; i < 1; i++) +# { +# return true; +# } +# } +# void main() +# { +# vec2 uv; +# vec3 color; +# +# do +# { +# if (injectionSwitch.y < 0.0) +# { +# color = vec3(1.0); +# } +# } while (false); +# _GLF_color = vec4(color, 1.0) + vec4(puzzlelize()); +# +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 108 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %53 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %33 "buf0" + OpMemberName %33 0 "injectionSwitch" + OpName %35 "" + OpName %47 "color" + OpName %53 "_GLF_color" + OpMemberDecorate %33 0 Offset 0 + OpDecorate %33 Block + OpDecorate %35 DescriptorSet 0 + OpDecorate %35 Binding 0 + OpDecorate %53 Location 0 + OpDecorate %76 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeBool + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %13 = OpConstant %10 0 + %20 = OpConstant %10 1 + %22 = OpConstantTrue %6 + %31 = OpTypeFloat 32 + %32 = OpTypeVector %31 2 + %33 = OpTypeStruct %32 + %34 = OpTypePointer Uniform %33 + %35 = OpVariable %34 Uniform + %36 = OpTypeInt 32 0 + %37 = OpConstant %36 1 + %38 = OpTypePointer Uniform %31 + %41 = OpConstant %31 0 + %45 = OpTypeVector %31 3 + %46 = OpTypePointer Function %45 + %48 = OpConstant %31 1 + %49 = OpConstantComposite %45 %48 %48 %48 + %50 = OpConstantFalse %6 + %51 = OpTypeVector %31 4 + %52 = OpTypePointer Output %51 + %53 = OpVariable %52 Output + %63 = OpConstantComposite %51 %48 %41 %41 %48 + %65 = OpTypePointer Function %6 + %95 = OpUndef %45 + %106 = OpUndef %6 + %107 = OpUndef %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %74 = OpVariable %65 Function %50 + %75 = OpVariable %65 Function + %76 = OpVariable %11 Function + %77 = OpVariable %65 Function + %47 = OpVariable %46 Function + OpBranch %27 + %27 = OpLabel + %105 = OpPhi %6 %106 %5 %105 %30 + %94 = OpPhi %45 %95 %5 %93 %30 + OpLoopMerge %29 %30 None + OpBranch %28 + %28 = OpLabel + %39 = OpAccessChain %38 %35 %13 %37 + %40 = OpLoad %31 %39 + %42 = OpFOrdLessThan %6 %40 %41 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %44 + %43 = OpLabel + OpStore %47 %49 + OpBranch %44 + %44 = OpLabel + %93 = OpPhi %45 %94 %28 %49 %43 + OpBranch %30 + %30 = OpLabel + OpBranchConditional %50 %27 %29 + %29 = OpLabel + %55 = OpCompositeExtract %31 %93 0 + %56 = OpCompositeExtract %31 %93 1 + %57 = OpCompositeExtract %31 %93 2 + %58 = OpCompositeConstruct %51 %55 %56 %57 %48 + OpStore %74 %50 + OpBranch %78 + %78 = OpLabel + %103 = OpPhi %6 %105 %29 %106 %80 + %99 = OpPhi %6 %50 %29 %106 %80 + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + OpStore %76 %13 + OpBranch %82 + %82 = OpLabel + %102 = OpPhi %6 %103 %81 %106 %84 + %98 = OpPhi %6 %50 %81 %106 %84 + %96 = OpPhi %10 %13 %81 %107 %84 + OpLoopMerge %83 %84 None + OpBranch %85 + %85 = OpLabel + %87 = OpSLessThan %6 %13 %20 + OpBranchConditional %22 %88 %83 + %88 = OpLabel + OpStore %74 %22 + OpStore %75 %22 + OpBranch %83 + %84 = OpLabel + OpBranch %82 + %83 = OpLabel + %101 = OpPhi %6 %102 %85 %22 %88 + %97 = OpPhi %6 %50 %85 %22 %88 + OpSelectionMerge %90 None + OpBranchConditional %22 %79 %90 + %90 = OpLabel + OpStore %74 %22 + OpBranch %79 + %80 = OpLabel + OpBranch %78 + %79 = OpLabel + OpStore %77 %22 + %60 = OpSelect %31 %22 %48 %41 + %61 = OpCompositeConstruct %51 %60 %60 %60 %60 + %62 = OpFAdd %51 %58 %61 + OpStore %53 %62 + OpStore %53 %63 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/set-color-in-one-iteration-while-loop.amber b/vulkan/amber/graphicsfuzz/set-color-in-one-iteration-while-loop.amber new file mode 100644 index 0000000..e1bbbef --- /dev/null +++ b/vulkan/amber/graphicsfuzz/set-color-in-one-iteration-while-loop.amber @@ -0,0 +1,222 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A frag shader that sets the color in one iter while loop + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: ab7ac60f14ae66006bed5c989a2cfd4c4881704c + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# void main() +# { +# // Variable "val" will always end up as 1.0 or 0.0. +# int val = int(clamp(gl_FragCoord.x, 0.0, 1.0)); +# vec4 color = vec4(0); +# _GLF_color = color; +# +# do +# { +# // Loop iterates at least once. +# // Body of the loop is idempotent. +# for (int i = 0; i < val + int(injectionSwitch.y); i++) +# { +# // Always false. +# if (val < 0) +# return; +# else +# { +# if(val == 1) +# // Set red and alpha to 1.0. +# color.ra = vec2(val); +# else +# // Set red and alpha to 1.0. +# color.ra = vec2(val + 1); +# } +# } +# } +# while(val < 0); // Always false. +# +# _GLF_color = color; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 106 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %26 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %12 "gl_FragCoord" + OpName %26 "_GLF_color" + OpName %42 "buf0" + OpMemberName %42 0 "injectionSwitch" + OpName %44 "" + OpDecorate %12 BuiltIn FragCoord + OpDecorate %26 Location 0 + OpMemberDecorate %42 0 Offset 0 + OpDecorate %42 Block + OpDecorate %44 DescriptorSet 0 + OpDecorate %44 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Input %9 + %18 = OpConstant %9 0 + %19 = OpConstant %9 1 + %24 = OpConstantComposite %10 %18 %18 %18 %18 + %25 = OpTypePointer Output %10 + %26 = OpVariable %25 Output + %33 = OpConstant %6 0 + %41 = OpTypeVector %9 2 + %42 = OpTypeStruct %41 + %43 = OpTypePointer Uniform %42 + %44 = OpVariable %43 Uniform + %45 = OpConstant %13 1 + %46 = OpTypePointer Uniform %9 + %51 = OpTypeBool + %60 = OpConstant %6 1 + %85 = OpConstantFalse %51 + %88 = OpConstantTrue %51 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %82 + %82 = OpLabel + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %20 = OpExtInst %9 %1 FClamp %17 %18 %19 + %21 = OpConvertFToS %6 %20 + OpStore %26 %24 + OpLoopMerge %81 %84 None + OpBranch %28 + %28 = OpLabel + %99 = OpPhi %51 %85 %82 %97 %31 + %95 = OpPhi %10 %24 %82 %94 %31 + OpLoopMerge %30 %31 None + OpBranch %34 + %34 = OpLabel + %94 = OpPhi %10 %95 %28 %105 %37 + %93 = OpPhi %6 %33 %28 %77 %37 + %47 = OpAccessChain %46 %44 %33 %45 + %48 = OpLoad %9 %47 + %49 = OpConvertFToS %6 %48 + %50 = OpIAdd %6 %21 %49 + %52 = OpSLessThan %51 %93 %50 + OpLoopMerge %36 %37 None + OpBranchConditional %52 %35 %36 + %35 = OpLabel + %54 = OpSLessThan %51 %21 %33 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %58 + %55 = OpLabel + OpBranch %36 + %58 = OpLabel + %61 = OpIEqual %51 %21 %60 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %69 + %62 = OpLabel + %65 = OpConvertSToF %9 %21 + %66 = OpCompositeConstruct %41 %65 %65 + %68 = OpVectorShuffle %10 %94 %66 4 1 2 5 + OpBranch %63 + %69 = OpLabel + %71 = OpIAdd %6 %21 %60 + %72 = OpConvertSToF %9 %71 + %73 = OpCompositeConstruct %41 %72 %72 + %75 = OpVectorShuffle %10 %94 %73 4 1 2 5 + OpBranch %63 + %63 = OpLabel + %105 = OpPhi %10 %68 %62 %75 %69 + OpBranch %56 + %56 = OpLabel + OpBranch %37 + %37 = OpLabel + %77 = OpIAdd %6 %93 %60 + OpBranch %34 + %36 = OpLabel + %97 = OpPhi %51 %99 %34 %88 %55 + OpSelectionMerge %89 None + OpBranchConditional %97 %30 %89 + %89 = OpLabel + OpBranch %31 + %31 = OpLabel + %79 = OpSLessThan %51 %21 %33 + OpBranchConditional %79 %28 %30 + %30 = OpLabel + OpSelectionMerge %91 None + OpBranchConditional %97 %81 %91 + %91 = OpLabel + OpStore %26 %94 + OpBranch %81 + %84 = OpLabel + OpBranch %82 + %81 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/similar-nested-ifs.amber b/vulkan/amber/graphicsfuzz/similar-nested-ifs.amber new file mode 100644 index 0000000..6705a20 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/similar-nested-ifs.amber @@ -0,0 +1,252 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with similar nested ifs and loops + +# The test passes because most of the shader does not execute; the shader writes the color red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# float gv; +# +# void main() +# { +# float lv = (1.0 > injectionSwitch.y) ? abs(gv) : 260.0; +# if (int(lv) < 250) +# { +# if (int(lv) < 180) +# { +# clamp(lv, 1.0, 1.0); +# } +# else if (gl_FragCoord.y < 0.0) // always false +# { +# if (int(lv) < 210) +# { +# do +# { +# } while (true); +# } +# int GLF_live5_looplimiter6; +# for ( +# int GLF_live5r = 0; +# true; +# 1) +# { +# if (GLF_live5_looplimiter6 >= 6) +# { +# break; +# } +# GLF_live5_looplimiter6++; +# } +# } +# } +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 89 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %50 %87 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "lv" + OpName %11 "buf0" + OpMemberName %11 0 "injectionSwitch" + OpName %13 "" + OpName %27 "gv" + OpName %50 "gl_FragCoord" + OpName %70 "GLF_live5r" + OpName %76 "GLF_live5_looplimiter6" + OpName %87 "_GLF_color" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %50 BuiltIn FragCoord + OpDecorate %70 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %77 RelaxedPrecision + OpDecorate %83 RelaxedPrecision + OpDecorate %85 RelaxedPrecision + OpDecorate %87 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpTypeVector %6 2 + %11 = OpTypeStruct %10 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 1 + %18 = OpTypePointer Uniform %6 + %21 = OpTypeBool + %26 = OpTypePointer Private %6 + %27 = OpVariable %26 Private + %31 = OpConstant %6 260 + %35 = OpConstant %14 250 + %41 = OpConstant %14 180 + %48 = OpTypeVector %6 4 + %49 = OpTypePointer Input %48 + %50 = OpVariable %49 Input + %51 = OpTypePointer Input %6 + %54 = OpConstant %6 0 + %60 = OpConstant %14 210 + %68 = OpConstantTrue %21 + %69 = OpTypePointer Function %14 + %78 = OpConstant %14 6 + %84 = OpConstant %14 1 + %86 = OpTypePointer Output %48 + %87 = OpVariable %86 Output + %88 = OpConstantComposite %48 %9 %54 %54 %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %7 Function + %70 = OpVariable %69 Function + %76 = OpVariable %69 Function + %19 = OpAccessChain %18 %13 %15 %17 + %20 = OpLoad %6 %19 + %22 = OpFOrdGreaterThan %21 %9 %20 + OpSelectionMerge %25 None + OpBranchConditional %22 %24 %30 + %24 = OpLabel + %28 = OpLoad %6 %27 + %29 = OpExtInst %6 %1 FAbs %28 + OpStore %23 %29 + OpBranch %25 + %30 = OpLabel + OpStore %23 %31 + OpBranch %25 + %25 = OpLabel + %32 = OpLoad %6 %23 + OpStore %8 %32 + %33 = OpLoad %6 %8 + %34 = OpConvertFToS %14 %33 + %36 = OpSLessThan %21 %34 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + %39 = OpLoad %6 %8 + %40 = OpConvertFToS %14 %39 + %42 = OpSLessThan %21 %40 %41 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %47 + %43 = OpLabel + %45 = OpLoad %6 %8 + %46 = OpExtInst %6 %1 FClamp %45 %9 %9 + OpBranch %44 + %47 = OpLabel + %52 = OpAccessChain %51 %50 %17 + %53 = OpLoad %6 %52 + %55 = OpFOrdLessThan %21 %53 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %57 + %56 = OpLabel + %58 = OpLoad %6 %8 + %59 = OpConvertFToS %14 %58 + %61 = OpSLessThan %21 %59 %60 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %63 + %62 = OpLabel + OpBranch %64 + %64 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %65 + %65 = OpLabel + OpBranch %67 + %67 = OpLabel + OpBranchConditional %68 %64 %66 + %66 = OpLabel + OpBranch %63 + %63 = OpLabel + OpStore %70 %15 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + OpBranchConditional %68 %72 %73 + %72 = OpLabel + %77 = OpLoad %14 %76 + %79 = OpSGreaterThanEqual %21 %77 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %80 %81 + %80 = OpLabel + OpBranch %73 + %81 = OpLabel + %83 = OpLoad %14 %76 + %85 = OpIAdd %14 %83 %84 + OpStore %76 %85 + OpBranch %74 + %74 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %57 + %57 = OpLabel + OpBranch %44 + %44 = OpLabel + OpBranch %38 + %38 = OpLabel + OpStore %87 %88 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/smoothstep-after-loop.amber b/vulkan/amber/graphicsfuzz/smoothstep-after-loop.amber new file mode 100644 index 0000000..628fb05 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/smoothstep-after-loop.amber @@ -0,0 +1,130 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: Fragment shader with 1-iteration loop and smoothstep + +# The test passes because the loop exits immediately and red is written + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# while(true) +# { +# if(true) +# { +# break; +# } +# int GLF_live9r; +# vec2(1.0)[clamp(GLF_live9r, 0, 1)]; +# } +# float g = 3.0; +# _GLF_color = vec4(smoothstep(0.0, 1.0, g), 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %32 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %22 "GLF_live9r" + OpName %28 "g" + OpName %32 "_GLF_color" + OpDecorate %32 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %11 = OpTypeBool + %12 = OpConstantTrue %11 + %16 = OpTypeFloat 32 + %17 = OpTypeVector %16 2 + %18 = OpConstant %16 1 + %19 = OpConstantComposite %17 %18 %18 + %20 = OpTypeInt 32 1 + %21 = OpTypePointer Function %20 + %24 = OpConstant %20 0 + %25 = OpConstant %20 1 + %27 = OpTypePointer Function %16 + %29 = OpConstant %16 3 + %30 = OpTypeVector %16 4 + %31 = OpTypePointer Output %30 + %32 = OpVariable %31 Output + %33 = OpConstant %16 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %22 = OpVariable %21 Function + %28 = OpVariable %27 Function + OpBranch %6 + %6 = OpLabel + OpLoopMerge %8 %9 None + OpBranch %10 + %10 = OpLabel + OpBranchConditional %12 %7 %8 + %7 = OpLabel + OpSelectionMerge %14 None + OpBranchConditional %12 %13 %14 + %13 = OpLabel + OpBranch %8 + %14 = OpLabel + %23 = OpLoad %20 %22 + %26 = OpExtInst %20 %1 SClamp %23 %24 %25 + OpBranch %9 + %9 = OpLabel + OpBranch %6 + %8 = OpLabel + OpStore %28 %29 + %34 = OpLoad %16 %28 + %35 = OpExtInst %16 %1 SmoothStep %33 %18 %34 + %36 = OpCompositeConstruct %30 %35 %33 %33 %18 + OpStore %32 %36 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/spv-access-chains.amber b/vulkan/amber/graphicsfuzz/spv-access-chains.amber new file mode 100644 index 0000000..8a60603 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-access-chains.amber @@ -0,0 +1,1307 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with extra access chains + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 442 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %435 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "pos" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %26 "ipos" + OpName %42 "i" + OpName %55 "map" + OpName %62 "p" + OpName %65 "canwalk" + OpName %67 "v" + OpName %74 "directions" + OpName %171 "j" + OpName %208 "d" + OpName %435 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %435 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %24 = OpTypeVector %18 2 + %25 = OpTypePointer Function %24 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %29 = OpTypePointer Function %6 + %32 = OpConstant %6 16 + %35 = OpConstant %27 1 + %41 = OpTypePointer Function %18 + %49 = OpConstant %18 256 + %50 = OpTypeBool + %52 = OpConstant %27 256 + %53 = OpTypeArray %18 %52 + %54 = OpTypePointer Private %53 + %55 = OpVariable %54 Private + %57 = OpTypePointer Private %18 + %60 = OpConstant %18 1 + %63 = OpConstantComposite %24 %19 %19 + %64 = OpTypePointer Function %50 + %66 = OpConstantTrue %50 + %82 = OpConstant %18 2 + %86 = OpConstant %18 16 + %119 = OpConstant %18 14 + %162 = OpConstantFalse %50 + %169 = OpConstant %18 8 + %434 = OpTypePointer Output %10 + %435 = OpVariable %434 Output + %436 = OpConstant %6 1 + %437 = OpConstantComposite %10 %436 %436 %436 %436 + %440 = OpConstant %6 0 + %441 = OpConstantComposite %10 %440 %440 %440 %436 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %26 = OpVariable %25 Function + %42 = OpVariable %41 Function + %62 = OpVariable %25 Function + %65 = OpVariable %64 Function + %67 = OpVariable %41 Function + %74 = OpVariable %41 Function + %171 = OpVariable %41 Function + %208 = OpVariable %41 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + OpStore %9 %23 + %30 = OpAccessChain %29 %9 %28 + %31 = OpLoad %6 %30 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %36 = OpAccessChain %29 %9 %35 + %37 = OpLoad %6 %36 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %40 = OpCompositeConstruct %24 %34 %39 + OpStore %26 %40 + OpStore %42 %19 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %18 %42 + %51 = OpSLessThan %50 %48 %49 + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %56 = OpLoad %18 %42 + %58 = OpAccessChain %57 %55 %56 + OpStore %58 %19 + OpBranch %46 + %46 = OpLabel + %59 = OpLoad %18 %42 + %61 = OpIAdd %18 %59 %60 + OpStore %42 %61 + OpBranch %43 + %45 = OpLabel + OpStore %62 %63 + OpStore %65 %66 + OpStore %67 %19 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %72 = OpLoad %18 %67 + %73 = OpIAdd %18 %72 %60 + OpStore %67 %73 + OpStore %74 %19 + %75 = OpAccessChain %41 %62 %28 + %76 = OpLoad %18 %75 + %77 = OpSGreaterThan %50 %76 %19 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %41 %62 %28 + %81 = OpLoad %18 %80 + %83 = OpISub %18 %81 %82 + %84 = OpAccessChain %41 %62 %35 + %85 = OpLoad %18 %84 + %87 = OpIMul %18 %85 %86 + %88 = OpIAdd %18 %83 %87 + %89 = OpAccessChain %57 %55 %88 + %90 = OpLoad %18 %89 + %91 = OpIEqual %50 %90 %19 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %50 %77 %69 %91 %78 + OpSelectionMerge %94 None + OpBranchConditional %92 %93 %94 + %93 = OpLabel + %95 = OpLoad %18 %74 + %96 = OpIAdd %18 %95 %60 + OpStore %74 %96 + OpBranch %94 + %94 = OpLabel + %97 = OpAccessChain %41 %62 %35 + %98 = OpLoad %18 %97 + %99 = OpSGreaterThan %50 %98 %19 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %102 = OpAccessChain %41 %62 %28 + %103 = OpLoad %18 %102 + %104 = OpAccessChain %41 %62 %35 + %105 = OpLoad %18 %104 + %106 = OpISub %18 %105 %82 + %107 = OpIMul %18 %106 %86 + %108 = OpIAdd %18 %103 %107 + %109 = OpAccessChain %57 %55 %108 + %110 = OpLoad %18 %109 + %111 = OpIEqual %50 %110 %19 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %50 %99 %94 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %115 = OpLoad %18 %74 + %116 = OpIAdd %18 %115 %60 + OpStore %74 %116 + OpBranch %114 + %114 = OpLabel + %117 = OpAccessChain %41 %62 %28 + %118 = OpLoad %18 %117 + %120 = OpSLessThan %50 %118 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %41 %62 %28 + %124 = OpLoad %18 %123 + %125 = OpIAdd %18 %124 %82 + %126 = OpAccessChain %41 %62 %35 + %127 = OpLoad %18 %126 + %128 = OpIMul %18 %127 %86 + %129 = OpIAdd %18 %125 %128 + %130 = OpAccessChain %57 %55 %129 + %131 = OpLoad %18 %130 + %132 = OpIEqual %50 %131 %19 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %50 %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %136 = OpLoad %18 %74 + %137 = OpIAdd %18 %136 %60 + OpStore %74 %137 + OpBranch %135 + %135 = OpLabel + %138 = OpAccessChain %41 %62 %35 + %139 = OpLoad %18 %138 + %140 = OpSLessThan %50 %139 %119 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %41 %62 %28 + %144 = OpLoad %18 %143 + %145 = OpAccessChain %41 %62 %35 + %146 = OpLoad %18 %145 + %147 = OpIAdd %18 %146 %82 + %148 = OpIMul %18 %147 %86 + %149 = OpIAdd %18 %144 %148 + %150 = OpAccessChain %57 %55 %149 + %151 = OpLoad %18 %150 + %152 = OpIEqual %50 %151 %19 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %50 %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %156 = OpLoad %18 %74 + %157 = OpIAdd %18 %156 %60 + OpStore %74 %157 + OpBranch %155 + %155 = OpLabel + %158 = OpLoad %18 %74 + %159 = OpIEqual %50 %158 %19 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpStore %65 %162 + OpStore %42 %19 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %18 %42 + %170 = OpSLessThan %50 %168 %169 + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpStore %171 %19 + OpBranch %172 + %172 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %18 %171 + %178 = OpSLessThan %50 %177 %169 + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %179 = OpLoad %18 %171 + %180 = OpIMul %18 %179 %82 + %181 = OpLoad %18 %42 + %182 = OpIMul %18 %181 %82 + %183 = OpIMul %18 %182 %86 + %184 = OpIAdd %18 %180 %183 + %185 = OpAccessChain %57 %55 %184 + %186 = OpLoad %18 %185 + %187 = OpIEqual %50 %186 %19 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %190 = OpLoad %18 %171 + %191 = OpIMul %18 %190 %82 + %192 = OpAccessChain %41 %62 %28 + OpStore %192 %191 + %193 = OpLoad %18 %42 + %194 = OpIMul %18 %193 %82 + %195 = OpAccessChain %41 %62 %35 + OpStore %195 %194 + OpStore %65 %66 + OpBranch %189 + %189 = OpLabel + OpBranch %175 + %175 = OpLabel + %196 = OpLoad %18 %171 + %197 = OpIAdd %18 %196 %60 + OpStore %171 %197 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %198 = OpLoad %18 %42 + %199 = OpIAdd %18 %198 %60 + OpStore %42 %199 + OpBranch %163 + %165 = OpLabel + %200 = OpAccessChain %41 %62 %28 + %201 = OpLoad %18 %200 + %202 = OpAccessChain %41 %62 %35 + %203 = OpLoad %18 %202 + %204 = OpIMul %18 %203 %86 + %205 = OpIAdd %18 %201 %204 + %206 = OpAccessChain %57 %55 %205 + OpStore %206 %60 + OpBranch %161 + %207 = OpLabel + %209 = OpLoad %18 %67 + %210 = OpLoad %18 %74 + %211 = OpSMod %18 %209 %210 + OpStore %208 %211 + %212 = OpLoad %18 %74 + %213 = OpLoad %18 %67 + %214 = OpIAdd %18 %213 %212 + OpStore %67 %214 + %215 = OpLoad %18 %208 + %216 = OpSGreaterThanEqual %50 %215 %19 + OpSelectionMerge %218 None + OpBranchConditional %216 %217 %218 + %217 = OpLabel + %219 = OpAccessChain %41 %62 %28 + %220 = OpLoad %18 %219 + %221 = OpSGreaterThan %50 %220 %19 + OpBranch %218 + %218 = OpLabel + %222 = OpPhi %50 %216 %207 %221 %217 + OpSelectionMerge %224 None + OpBranchConditional %222 %223 %224 + %223 = OpLabel + %225 = OpAccessChain %41 %62 %28 + %226 = OpLoad %18 %225 + %227 = OpISub %18 %226 %82 + %228 = OpAccessChain %41 %62 %35 + %229 = OpLoad %18 %228 + %230 = OpIMul %18 %229 %86 + %231 = OpIAdd %18 %227 %230 + %232 = OpAccessChain %57 %55 %231 + %233 = OpLoad %18 %232 + %234 = OpIEqual %50 %233 %19 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %50 %222 %218 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %238 = OpLoad %18 %208 + %239 = OpISub %18 %238 %60 + OpStore %208 %239 + %240 = OpAccessChain %41 %62 %28 + %241 = OpLoad %18 %240 + %242 = OpAccessChain %41 %62 %35 + %243 = OpLoad %18 %242 + %244 = OpIMul %18 %243 %86 + %245 = OpIAdd %18 %241 %244 + %246 = OpAccessChain %57 %55 %245 + OpStore %246 %60 + %247 = OpAccessChain %41 %62 %28 + %248 = OpLoad %18 %247 + %249 = OpISub %18 %248 %60 + %250 = OpAccessChain %41 %62 %35 + %251 = OpLoad %18 %250 + %252 = OpIMul %18 %251 %86 + %253 = OpIAdd %18 %249 %252 + %254 = OpAccessChain %57 %55 %253 + OpStore %254 %60 + %255 = OpAccessChain %41 %62 %28 + %256 = OpLoad %18 %255 + %257 = OpISub %18 %256 %82 + %258 = OpAccessChain %41 %62 %35 + %259 = OpLoad %18 %258 + %260 = OpIMul %18 %259 %86 + %261 = OpIAdd %18 %257 %260 + %262 = OpAccessChain %57 %55 %261 + OpStore %262 %60 + %263 = OpAccessChain %41 %62 %28 + %264 = OpLoad %18 %263 + %265 = OpISub %18 %264 %82 + %266 = OpAccessChain %41 %62 %28 + OpStore %266 %265 + OpBranch %237 + %237 = OpLabel + %267 = OpLoad %18 %208 + %268 = OpSGreaterThanEqual %50 %267 %19 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %271 = OpAccessChain %41 %62 %35 + %272 = OpLoad %18 %271 + %273 = OpSGreaterThan %50 %272 %19 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %50 %268 %237 %273 %269 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %277 = OpAccessChain %41 %62 %28 + %278 = OpLoad %18 %277 + %279 = OpAccessChain %41 %62 %35 + %280 = OpLoad %18 %279 + %281 = OpISub %18 %280 %82 + %282 = OpIMul %18 %281 %86 + %283 = OpIAdd %18 %278 %282 + %284 = OpAccessChain %57 %55 %283 + %285 = OpLoad %18 %284 + %286 = OpIEqual %50 %285 %19 + OpBranch %276 + %276 = OpLabel + %287 = OpPhi %50 %274 %270 %286 %275 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %290 = OpLoad %18 %208 + %291 = OpISub %18 %290 %60 + OpStore %208 %291 + %292 = OpAccessChain %41 %62 %28 + %293 = OpLoad %18 %292 + %294 = OpAccessChain %41 %62 %35 + %295 = OpLoad %18 %294 + %296 = OpIMul %18 %295 %86 + %297 = OpIAdd %18 %293 %296 + %298 = OpAccessChain %57 %55 %297 + OpStore %298 %60 + %299 = OpAccessChain %41 %62 %28 + %300 = OpLoad %18 %299 + %301 = OpAccessChain %41 %62 %35 + %302 = OpLoad %18 %301 + %303 = OpISub %18 %302 %60 + %304 = OpIMul %18 %303 %86 + %305 = OpIAdd %18 %300 %304 + %306 = OpAccessChain %57 %55 %305 + OpStore %306 %60 + %307 = OpAccessChain %41 %62 %28 + %308 = OpLoad %18 %307 + %309 = OpAccessChain %41 %62 %35 + %310 = OpLoad %18 %309 + %311 = OpISub %18 %310 %82 + %312 = OpIMul %18 %311 %86 + %313 = OpIAdd %18 %308 %312 + %314 = OpAccessChain %57 %55 %313 + OpStore %314 %60 + %315 = OpAccessChain %41 %62 %35 + %316 = OpLoad %18 %315 + %317 = OpISub %18 %316 %82 + %318 = OpAccessChain %41 %62 %35 + OpStore %318 %317 + OpBranch %289 + %289 = OpLabel + %319 = OpLoad %18 %208 + %320 = OpSGreaterThanEqual %50 %319 %19 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %41 %62 %28 + %324 = OpLoad %18 %323 + %325 = OpSLessThan %50 %324 %119 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %50 %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %41 %62 %28 + %330 = OpLoad %18 %329 + %331 = OpIAdd %18 %330 %82 + %332 = OpAccessChain %41 %62 %35 + %333 = OpLoad %18 %332 + %334 = OpIMul %18 %333 %86 + %335 = OpIAdd %18 %331 %334 + %336 = OpAccessChain %57 %55 %335 + %337 = OpLoad %18 %336 + %338 = OpIEqual %50 %337 %19 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %50 %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %342 = OpLoad %18 %208 + %343 = OpISub %18 %342 %60 + OpStore %208 %343 + %344 = OpAccessChain %41 %62 %28 + %345 = OpLoad %18 %344 + %346 = OpAccessChain %41 %62 %35 + %347 = OpLoad %18 %346 + %348 = OpIMul %18 %347 %86 + %349 = OpIAdd %18 %345 %348 + %350 = OpAccessChain %57 %55 %349 + OpStore %350 %60 + %351 = OpAccessChain %41 %62 %28 + %352 = OpLoad %18 %351 + %353 = OpIAdd %18 %352 %60 + %354 = OpAccessChain %41 %62 %35 + %355 = OpLoad %18 %354 + %356 = OpIMul %18 %355 %86 + %357 = OpIAdd %18 %353 %356 + %358 = OpAccessChain %57 %55 %357 + OpStore %358 %60 + %359 = OpAccessChain %41 %62 %28 + %360 = OpLoad %18 %359 + %361 = OpIAdd %18 %360 %82 + %362 = OpAccessChain %41 %62 %35 + %363 = OpLoad %18 %362 + %364 = OpIMul %18 %363 %86 + %365 = OpIAdd %18 %361 %364 + %366 = OpAccessChain %57 %55 %365 + OpStore %366 %60 + %367 = OpAccessChain %41 %62 %28 + %368 = OpLoad %18 %367 + %369 = OpIAdd %18 %368 %82 + %370 = OpAccessChain %41 %62 %28 + OpStore %370 %369 + OpBranch %341 + %341 = OpLabel + %371 = OpLoad %18 %208 + %372 = OpSGreaterThanEqual %50 %371 %19 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %375 = OpAccessChain %41 %62 %35 + %376 = OpLoad %18 %375 + %377 = OpSLessThan %50 %376 %119 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %50 %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %381 = OpAccessChain %41 %62 %28 + %382 = OpLoad %18 %381 + %383 = OpAccessChain %41 %62 %35 + %384 = OpLoad %18 %383 + %385 = OpIAdd %18 %384 %82 + %386 = OpIMul %18 %385 %86 + %387 = OpIAdd %18 %382 %386 + %388 = OpAccessChain %57 %55 %387 + %389 = OpLoad %18 %388 + %390 = OpIEqual %50 %389 %19 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %50 %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %394 = OpLoad %18 %208 + %395 = OpISub %18 %394 %60 + OpStore %208 %395 + %396 = OpAccessChain %41 %62 %28 + %397 = OpLoad %18 %396 + %398 = OpAccessChain %41 %62 %35 + %399 = OpLoad %18 %398 + %400 = OpIMul %18 %399 %86 + %401 = OpIAdd %18 %397 %400 + %402 = OpAccessChain %57 %55 %401 + OpStore %402 %60 + %403 = OpAccessChain %41 %62 %28 + %404 = OpLoad %18 %403 + %405 = OpAccessChain %41 %62 %35 + %406 = OpLoad %18 %405 + %407 = OpIAdd %18 %406 %60 + %408 = OpIMul %18 %407 %86 + %409 = OpIAdd %18 %404 %408 + %410 = OpAccessChain %57 %55 %409 + OpStore %410 %60 + %411 = OpAccessChain %41 %62 %28 + %412 = OpLoad %18 %411 + %413 = OpAccessChain %41 %62 %35 + %414 = OpLoad %18 %413 + %415 = OpIAdd %18 %414 %82 + %416 = OpIMul %18 %415 %86 + %417 = OpIAdd %18 %412 %416 + %418 = OpAccessChain %57 %55 %417 + OpStore %418 %60 + %419 = OpAccessChain %41 %62 %35 + %420 = OpLoad %18 %419 + %421 = OpIAdd %18 %420 %82 + %422 = OpAccessChain %41 %62 %35 + OpStore %422 %421 + OpBranch %393 + %393 = OpLabel + OpBranch %161 + %161 = OpLabel + %423 = OpAccessChain %41 %26 %35 + %424 = OpLoad %18 %423 + %425 = OpIMul %18 %424 %86 + %426 = OpAccessChain %41 %26 %28 + %427 = OpLoad %18 %426 + %428 = OpIAdd %18 %425 %427 + %429 = OpAccessChain %57 %55 %428 + %430 = OpLoad %18 %429 + %431 = OpIEqual %50 %430 %60 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %435 %437 + OpReturn + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + %439 = OpLoad %50 %65 + OpBranchConditional %439 %68 %70 + %70 = OpLabel + OpStore %435 %441 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 64.0 64.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 64 64 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 742 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %435 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "pos" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %26 "ipos" + OpName %42 "i" + OpName %55 "map" + OpName %62 "p" + OpName %65 "canwalk" + OpName %67 "v" + OpName %74 "directions" + OpName %171 "j" + OpName %208 "d" + OpName %435 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %435 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %24 = OpTypeVector %18 2 + %25 = OpTypePointer Function %24 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %29 = OpTypePointer Function %6 + %32 = OpConstant %6 16 + %35 = OpConstant %27 1 + %41 = OpTypePointer Function %18 + %49 = OpConstant %18 256 + %50 = OpTypeBool + %52 = OpConstant %27 256 + %53 = OpTypeArray %18 %52 + %54 = OpTypePointer Private %53 + %55 = OpVariable %54 Private + %57 = OpTypePointer Private %18 + %60 = OpConstant %18 1 + %63 = OpConstantComposite %24 %19 %19 + %64 = OpTypePointer Function %50 + %66 = OpConstantTrue %50 + %82 = OpConstant %18 2 + %86 = OpConstant %18 16 + %119 = OpConstant %18 14 + %162 = OpConstantFalse %50 + %169 = OpConstant %18 8 + %434 = OpTypePointer Output %10 + %435 = OpVariable %434 Output + %436 = OpConstant %6 1 + %437 = OpConstantComposite %10 %436 %436 %436 %436 + %440 = OpConstant %6 0 + %441 = OpConstantComposite %10 %440 %440 %440 %436 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %26 = OpVariable %25 Function + %42 = OpVariable %41 Function + %62 = OpVariable %25 Function + %65 = OpVariable %64 Function + %67 = OpVariable %41 Function + %74 = OpVariable %41 Function + %171 = OpVariable %41 Function + %208 = OpVariable %41 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + OpStore %9 %23 + %30 = OpAccessChain %29 %9 %28 + %31 = OpLoad %6 %30 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %36 = OpAccessChain %29 %9 %35 + %37 = OpLoad %6 %36 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %40 = OpCompositeConstruct %24 %34 %39 + OpStore %26 %40 + OpStore %42 %19 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %18 %42 + %51 = OpSLessThan %50 %48 %49 + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %56 = OpLoad %18 %42 + %58 = OpAccessChain %57 %55 %56 + OpStore %58 %19 + OpBranch %46 + %46 = OpLabel + %59 = OpLoad %18 %42 + %61 = OpIAdd %18 %59 %60 + OpStore %42 %61 + OpBranch %43 + %45 = OpLabel + OpStore %62 %63 + OpStore %65 %66 + OpStore %67 %19 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %72 = OpLoad %18 %67 + %73 = OpIAdd %18 %72 %60 + OpStore %67 %73 + OpStore %74 %19 + %75 = OpAccessChain %41 %62 %28 + %76 = OpLoad %18 %75 + %77 = OpSGreaterThan %50 %76 %19 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %41 %62 %28 + %81 = OpLoad %18 %80 + %83 = OpISub %18 %81 %82 + %84 = OpAccessChain %41 %62 %35 + %85 = OpLoad %18 %84 + %87 = OpIMul %18 %85 %86 + %88 = OpIAdd %18 %83 %87 + %89 = OpAccessChain %57 %55 %88 + %90 = OpLoad %18 %89 + %91 = OpIEqual %50 %90 %19 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %50 %77 %69 %91 %78 + OpSelectionMerge %94 None + OpBranchConditional %92 %93 %94 + %93 = OpLabel + %95 = OpLoad %18 %74 + %96 = OpIAdd %18 %95 %60 + OpStore %74 %96 + OpBranch %94 + %94 = OpLabel + %97 = OpAccessChain %41 %62 %35 + %98 = OpLoad %18 %97 + %99 = OpSGreaterThan %50 %98 %19 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %102 = OpAccessChain %41 %62 %28 + %103 = OpLoad %18 %102 + %104 = OpAccessChain %41 %62 %35 + %105 = OpLoad %18 %104 + %106 = OpISub %18 %105 %82 + %107 = OpIMul %18 %106 %86 + %108 = OpIAdd %18 %103 %107 + %109 = OpAccessChain %57 %55 %108 + %110 = OpLoad %18 %109 + %111 = OpIEqual %50 %110 %19 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %50 %99 %94 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %115 = OpLoad %18 %74 + %116 = OpIAdd %18 %115 %60 + OpStore %74 %116 + OpBranch %114 + %114 = OpLabel + %117 = OpAccessChain %41 %62 %28 + %118 = OpLoad %18 %117 + %120 = OpSLessThan %50 %118 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %41 %62 %28 + %124 = OpLoad %18 %123 + %125 = OpIAdd %18 %124 %82 + %126 = OpAccessChain %41 %62 %35 + %127 = OpLoad %18 %126 + %128 = OpIMul %18 %127 %86 + %129 = OpIAdd %18 %125 %128 + %130 = OpAccessChain %57 %55 %129 + %131 = OpLoad %18 %130 + %132 = OpIEqual %50 %131 %19 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %50 %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %136 = OpLoad %18 %74 + %137 = OpIAdd %18 %136 %60 + OpStore %74 %137 + OpBranch %135 + %135 = OpLabel + %138 = OpAccessChain %41 %62 %35 + %139 = OpLoad %18 %138 + %140 = OpSLessThan %50 %139 %119 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %41 %62 %28 + %144 = OpLoad %18 %143 + %145 = OpAccessChain %41 %62 %35 + %146 = OpLoad %18 %145 + %147 = OpIAdd %18 %146 %82 + %148 = OpIMul %18 %147 %86 + %149 = OpIAdd %18 %144 %148 + %150 = OpAccessChain %57 %55 %149 + %151 = OpLoad %18 %150 + %152 = OpIEqual %50 %151 %19 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %50 %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %156 = OpLoad %18 %74 + %157 = OpIAdd %18 %156 %60 + OpStore %74 %157 + OpBranch %155 + %155 = OpLabel + %158 = OpLoad %18 %74 + %159 = OpIEqual %50 %158 %19 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpStore %65 %162 + OpStore %42 %19 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %18 %42 + %170 = OpSLessThan %50 %168 %169 + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpStore %171 %19 + OpBranch %172 + %172 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %18 %171 + %178 = OpSLessThan %50 %177 %169 + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %179 = OpLoad %18 %171 + %180 = OpIMul %18 %179 %82 + %181 = OpLoad %18 %42 + %182 = OpIMul %18 %181 %82 + %183 = OpIMul %18 %182 %86 + %184 = OpIAdd %18 %180 %183 + %185 = OpAccessChain %57 %55 %184 + %186 = OpLoad %18 %185 + %187 = OpIEqual %50 %186 %19 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %190 = OpLoad %18 %171 + %191 = OpIMul %18 %190 %82 + %192 = OpAccessChain %41 %62 %28 + OpStore %192 %191 + %193 = OpLoad %18 %42 + %194 = OpIMul %18 %193 %82 + %195 = OpAccessChain %41 %62 %35 + OpStore %195 %194 + OpStore %65 %66 + OpBranch %189 + %189 = OpLabel + OpBranch %175 + %175 = OpLabel + %196 = OpLoad %18 %171 + %197 = OpIAdd %18 %196 %60 + OpStore %171 %197 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %198 = OpLoad %18 %42 + %199 = OpIAdd %18 %198 %60 + OpStore %42 %199 + OpBranch %163 + %165 = OpLabel + %200 = OpAccessChain %41 %62 %28 + %201 = OpLoad %18 %200 + %202 = OpAccessChain %41 %62 %35 + %203 = OpLoad %18 %202 + %204 = OpIMul %18 %203 %86 + %205 = OpIAdd %18 %201 %204 + %206 = OpAccessChain %57 %55 %205 + OpStore %206 %60 + OpBranch %161 + %207 = OpLabel + %209 = OpLoad %18 %67 + %210 = OpLoad %18 %74 + %211 = OpSMod %18 %209 %210 + OpStore %208 %211 + %212 = OpLoad %18 %74 + %213 = OpLoad %18 %67 + %214 = OpIAdd %18 %213 %212 + OpStore %67 %214 + %215 = OpLoad %18 %208 + %216 = OpSGreaterThanEqual %50 %215 %19 + OpSelectionMerge %218 None + OpBranchConditional %216 %217 %218 + %217 = OpLabel + %219 = OpAccessChain %41 %62 %28 + %220 = OpLoad %18 %219 + %221 = OpSGreaterThan %50 %220 %19 + OpBranch %218 + %218 = OpLabel + %222 = OpPhi %50 %216 %207 %221 %217 + OpSelectionMerge %224 None + OpBranchConditional %222 %223 %224 + %223 = OpLabel + %225 = OpAccessChain %41 %62 %28 + %226 = OpLoad %18 %225 + %227 = OpISub %18 %226 %82 + %228 = OpAccessChain %41 %62 %35 + %229 = OpLoad %18 %228 + %230 = OpIMul %18 %229 %86 + %231 = OpIAdd %18 %227 %230 + %232 = OpAccessChain %57 %55 %231 + %233 = OpLoad %18 %232 + %234 = OpIEqual %50 %233 %19 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %50 %222 %218 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %238 = OpLoad %18 %208 + %239 = OpISub %18 %238 %60 + OpStore %208 %239 + %240 = OpAccessChain %41 %62 %28 + %241 = OpLoad %18 %240 + %242 = OpAccessChain %41 %62 %35 + %243 = OpLoad %18 %242 + %244 = OpIMul %18 %243 %86 + %245 = OpIAdd %18 %241 %244 + %246 = OpAccessChain %57 %55 %245 + OpStore %246 %60 + %247 = OpAccessChain %41 %62 %28 + %248 = OpLoad %18 %247 + %249 = OpISub %18 %248 %60 + %250 = OpAccessChain %41 %62 %35 + %251 = OpLoad %18 %250 + %252 = OpIMul %18 %251 %86 + %253 = OpIAdd %18 %249 %252 + %254 = OpAccessChain %57 %55 %253 + OpStore %254 %60 + %255 = OpAccessChain %41 %62 %28 + %256 = OpLoad %18 %255 + %257 = OpISub %18 %256 %82 + %258 = OpAccessChain %41 %62 %35 + %259 = OpLoad %18 %258 + %260 = OpIMul %18 %259 %86 + %261 = OpIAdd %18 %257 %260 + %262 = OpAccessChain %57 %55 %261 + OpStore %262 %60 + %263 = OpAccessChain %41 %62 %28 + %264 = OpLoad %18 %263 + %265 = OpISub %18 %264 %82 + %266 = OpAccessChain %41 %62 %28 + OpStore %266 %265 + OpBranch %237 + %237 = OpLabel + %267 = OpLoad %18 %208 + %268 = OpSGreaterThanEqual %50 %267 %19 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %271 = OpAccessChain %41 %62 %35 + %272 = OpLoad %18 %271 + %273 = OpSGreaterThan %50 %272 %19 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %50 %268 %237 %273 %269 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %277 = OpAccessChain %41 %62 %28 + %278 = OpLoad %18 %277 + %279 = OpAccessChain %41 %62 %35 + %280 = OpLoad %18 %279 + %281 = OpISub %18 %280 %82 + %282 = OpIMul %18 %281 %86 + %283 = OpIAdd %18 %278 %282 + %284 = OpAccessChain %57 %55 %283 + %285 = OpLoad %18 %284 + %286 = OpIEqual %50 %285 %19 + OpBranch %276 + %276 = OpLabel + %287 = OpPhi %50 %274 %270 %286 %275 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %290 = OpLoad %18 %208 + %291 = OpISub %18 %290 %60 + OpStore %208 %291 + %292 = OpAccessChain %41 %62 %28 + %293 = OpLoad %18 %292 + %294 = OpAccessChain %41 %62 %35 + %295 = OpLoad %18 %294 + %296 = OpIMul %18 %295 %86 + %297 = OpIAdd %18 %293 %296 + %298 = OpAccessChain %57 %55 %297 + OpStore %298 %60 + %299 = OpAccessChain %41 %62 %28 + %300 = OpLoad %18 %299 + %301 = OpAccessChain %41 %62 %35 + %302 = OpLoad %18 %301 + %303 = OpISub %18 %302 %60 + %304 = OpIMul %18 %303 %86 + %305 = OpIAdd %18 %300 %304 + %306 = OpAccessChain %57 %55 %305 + OpStore %306 %60 + %307 = OpAccessChain %41 %62 %28 + %308 = OpLoad %18 %307 + %309 = OpAccessChain %41 %62 %35 + %310 = OpLoad %18 %309 + %311 = OpISub %18 %310 %82 + %312 = OpIMul %18 %311 %86 + %313 = OpIAdd %18 %308 %312 + %314 = OpAccessChain %57 %55 %313 + OpStore %314 %60 + %315 = OpAccessChain %41 %62 %35 + %316 = OpLoad %18 %315 + %317 = OpISub %18 %316 %82 + %318 = OpAccessChain %41 %62 %35 + OpStore %318 %317 + OpBranch %289 + %289 = OpLabel + %319 = OpLoad %18 %208 + %320 = OpSGreaterThanEqual %50 %319 %19 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %41 %62 %28 + %324 = OpLoad %18 %323 + %325 = OpSLessThan %50 %324 %119 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %50 %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %41 %62 %28 + %330 = OpLoad %18 %329 + %331 = OpIAdd %18 %330 %82 + %332 = OpAccessChain %41 %62 %35 + %333 = OpLoad %18 %332 + %334 = OpIMul %18 %333 %86 + %335 = OpIAdd %18 %331 %334 + %336 = OpAccessChain %57 %55 %335 + %337 = OpLoad %18 %336 + %338 = OpIEqual %50 %337 %19 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %50 %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %342 = OpLoad %18 %208 + %343 = OpISub %18 %342 %60 + OpStore %208 %343 + %344 = OpAccessChain %41 %62 %28 + %345 = OpLoad %18 %344 + %346 = OpAccessChain %41 %62 %35 + %347 = OpLoad %18 %346 + %348 = OpIMul %18 %347 %86 + %349 = OpIAdd %18 %345 %348 + %350 = OpAccessChain %57 %55 %349 + OpStore %350 %60 + %351 = OpAccessChain %41 %62 %28 + %352 = OpLoad %18 %351 + %353 = OpIAdd %18 %352 %60 + %354 = OpAccessChain %41 %62 %35 + %355 = OpLoad %18 %354 + %356 = OpIMul %18 %355 %86 + %357 = OpIAdd %18 %353 %356 + %358 = OpAccessChain %57 %55 %357 + OpStore %358 %60 + %359 = OpAccessChain %41 %62 %28 + %360 = OpLoad %18 %359 + %361 = OpIAdd %18 %360 %82 + %362 = OpAccessChain %41 %62 %35 + %363 = OpLoad %18 %362 + %364 = OpIMul %18 %363 %86 + %365 = OpIAdd %18 %361 %364 + %366 = OpAccessChain %57 %55 %365 + OpStore %366 %60 + %367 = OpAccessChain %41 %62 %28 + %368 = OpLoad %18 %367 + %369 = OpIAdd %18 %368 %82 + %370 = OpAccessChain %41 %62 %28 + OpStore %370 %369 + OpBranch %341 + %341 = OpLabel + %371 = OpLoad %18 %208 + %372 = OpSGreaterThanEqual %50 %371 %19 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %375 = OpAccessChain %41 %62 %35 + %376 = OpLoad %18 %375 + %377 = OpSLessThan %50 %376 %119 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %50 %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %381 = OpAccessChain %41 %62 %28 + %382 = OpLoad %18 %381 + %383 = OpAccessChain %41 %62 %35 + %384 = OpLoad %18 %383 + %385 = OpIAdd %18 %384 %82 + %386 = OpIMul %18 %385 %86 + %387 = OpIAdd %18 %382 %386 + %388 = OpAccessChain %57 %55 %387 + %389 = OpLoad %18 %388 + %390 = OpIEqual %50 %389 %19 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %50 %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %394 = OpLoad %18 %208 + %395 = OpISub %18 %394 %60 + OpStore %208 %395 + %396 = OpAccessChain %41 %62 %28 + %397 = OpLoad %18 %396 + %398 = OpAccessChain %41 %62 %35 + %399 = OpLoad %18 %398 + %400 = OpIMul %18 %399 %86 + %401 = OpIAdd %18 %397 %400 + %402 = OpAccessChain %57 %55 %401 + OpStore %402 %60 + %403 = OpAccessChain %41 %62 %28 + %404 = OpLoad %18 %403 + %405 = OpAccessChain %41 %62 %35 + %406 = OpLoad %18 %405 + %407 = OpIAdd %18 %406 %60 + %408 = OpIMul %18 %407 %86 + %409 = OpIAdd %18 %404 %408 + %410 = OpAccessChain %57 %55 %409 + OpStore %410 %60 + %411 = OpAccessChain %41 %62 %28 + %412 = OpLoad %18 %411 + %413 = OpAccessChain %41 %62 %35 + %414 = OpLoad %18 %413 + %415 = OpIAdd %18 %414 %82 + %416 = OpIMul %18 %415 %86 + %417 = OpIAdd %18 %412 %416 + %418 = OpAccessChain %57 %55 %417 + OpStore %418 %60 + %419 = OpAccessChain %41 %62 %35 + %420 = OpLoad %18 %419 + %421 = OpIAdd %18 %420 %82 + %422 = OpAccessChain %41 %62 %35 + OpStore %422 %421 + OpBranch %393 + %393 = OpLabel + OpBranch %161 + %161 = OpLabel + %423 = OpAccessChain %41 %26 %35 + %424 = OpLoad %18 %423 + %425 = OpIMul %18 %424 %86 + %426 = OpAccessChain %41 %26 %28 + %427 = OpLoad %18 %426 + %428 = OpIAdd %18 %425 %427 + %429 = OpAccessChain %57 %55 %428 + %430 = OpLoad %18 %429 + %431 = OpIEqual %50 %430 %60 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %435 %437 + OpReturn + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + %439 = OpLoad %50 %65 + %740 = OpAccessChain %41 %208 + OpBranchConditional %439 %68 %70 + %70 = OpLabel + %741 = OpAccessChain %41 %740 + OpStore %435 %441 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 64.0 64.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 64 64 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-composite-phi.amber b/vulkan/amber/graphicsfuzz/spv-composite-phi.amber new file mode 100644 index 0000000..1a4a422 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-composite-phi.amber @@ -0,0 +1,539 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with id used by OpPhi hidden in composite + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 290 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %137 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %66 "c" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %137 "_GLF_color" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpDecorate %137 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %107 = OpConstant %76 2 + %116 = OpConstant %15 3 + %121 = OpConstant %6 1 + %136 = OpTypePointer Output %83 + %137 = OpVariable %136 Output + %149 = OpConstantFalse %26 + %152 = OpConstantTrue %26 + %261 = OpUndef %6 + %289 = OpConstant %6 0.125 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %81 = OpFMul %6 %80 %289 + %82 = OpExtInst %6 %1 Round %81 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpSelectionMerge %199 None + OpSwitch %77 %161 + %161 = OpLabel + OpBranch %162 + %162 = OpLabel + %248 = OpPhi %6 %14 %161 %251 %192 + %247 = OpPhi %15 %18 %161 %194 %192 + %165 = OpSLessThan %26 %247 %25 + OpLoopMerge %195 %192 None + OpBranchConditional %165 %166 %195 + %166 = OpLabel + %168 = OpSMod %15 %247 %29 + %169 = OpIEqual %26 %168 %31 + OpSelectionMerge %184 None + OpBranchConditional %169 %170 %173 + %170 = OpLabel + %172 = OpFAdd %6 %248 %35 + OpBranch %184 + %173 = OpLabel + %175 = OpConvertSToF %6 %247 + %177 = OpExtInst %6 %1 Round %82 + %178 = OpFMod %6 %175 %177 + %179 = OpFOrdLessThanEqual %26 %178 %44 + OpSelectionMerge %183 None + OpBranchConditional %179 %180 %183 + %180 = OpLabel + %182 = OpFAdd %6 %248 %48 + OpBranch %183 + %183 = OpLabel + %252 = OpPhi %6 %248 %173 %182 %180 + OpBranch %184 + %184 = OpLabel + %251 = OpPhi %6 %172 %170 %252 %183 + %186 = OpConvertSToF %6 %247 + %188 = OpFOrdGreaterThanEqual %26 %186 %89 + OpSelectionMerge %191 None + OpBranchConditional %188 %189 %191 + %189 = OpLabel + OpBranch %195 + %191 = OpLabel + OpBranch %192 + %192 = OpLabel + %194 = OpIAdd %15 %247 %18 + OpBranch %162 + %195 = OpLabel + %259 = OpPhi %6 %261 %162 %251 %189 + %257 = OpPhi %6 %248 %162 %251 %189 + %253 = OpPhi %26 %149 %162 %152 %189 + OpSelectionMerge %197 None + OpBranchConditional %253 %199 %197 + %197 = OpLabel + OpBranch %199 + %199 = OpLabel + %258 = OpPhi %6 %259 %195 %257 %197 + %93 = OpAccessChain %7 %66 %77 + OpStore %93 %258 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpSelectionMerge %245 None + OpSwitch %77 %207 + %207 = OpLabel + OpBranch %208 + %208 = OpLabel + %265 = OpPhi %6 %14 %207 %268 %238 + %264 = OpPhi %15 %18 %207 %240 %238 + %211 = OpSLessThan %26 %264 %25 + OpLoopMerge %241 %238 None + OpBranchConditional %211 %212 %241 + %212 = OpLabel + %214 = OpSMod %15 %264 %29 + %215 = OpIEqual %26 %214 %31 + OpSelectionMerge %230 None + OpBranchConditional %215 %216 %219 + %216 = OpLabel + %218 = OpFAdd %6 %265 %35 + OpBranch %230 + %219 = OpLabel + %221 = OpConvertSToF %6 %264 + %223 = OpExtInst %6 %1 Round %82 + %224 = OpFMod %6 %221 %223 + %225 = OpFOrdLessThanEqual %26 %224 %44 + OpSelectionMerge %229 None + OpBranchConditional %225 %226 %229 + %226 = OpLabel + %228 = OpFAdd %6 %265 %48 + OpBranch %229 + %229 = OpLabel + %269 = OpPhi %6 %265 %219 %228 %226 + OpBranch %230 + %230 = OpLabel + %268 = OpPhi %6 %218 %216 %269 %229 + %232 = OpConvertSToF %6 %264 + %234 = OpFOrdGreaterThanEqual %26 %232 %97 + OpSelectionMerge %237 None + OpBranchConditional %234 %235 %237 + %235 = OpLabel + OpBranch %241 + %237 = OpLabel + OpBranch %238 + %238 = OpLabel + %240 = OpIAdd %15 %264 %18 + OpBranch %208 + %241 = OpLabel + %276 = OpPhi %6 %261 %208 %268 %235 + %274 = OpPhi %6 %265 %208 %268 %235 + %270 = OpPhi %26 %149 %208 %152 %235 + OpSelectionMerge %243 None + OpBranchConditional %270 %245 %243 + %243 = OpLabel + OpBranch %245 + %245 = OpLabel + %275 = OpPhi %6 %276 %241 %274 %243 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %275 + %103 = OpLoad %6 %93 + %105 = OpLoad %6 %101 + %106 = OpFAdd %6 %103 %105 + %108 = OpAccessChain %7 %66 %107 + OpStore %108 %106 + OpBranch %110 + %110 = OpLabel + %285 = OpPhi %15 %31 %245 %135 %113 + %117 = OpSLessThan %26 %285 %116 + OpLoopMerge %112 %113 None + OpBranchConditional %117 %111 %112 + %111 = OpLabel + %119 = OpAccessChain %7 %66 %285 + %120 = OpLoad %6 %119 + %122 = OpFOrdGreaterThanEqual %26 %120 %121 + OpSelectionMerge %124 None + OpBranchConditional %122 %123 %124 + %123 = OpLabel + %128 = OpLoad %6 %119 + %131 = OpLoad %6 %119 + %132 = OpFMul %6 %128 %131 + OpStore %119 %132 + OpBranch %124 + %124 = OpLabel + OpBranch %113 + %113 = OpLabel + %135 = OpIAdd %15 %285 %18 + OpBranch %110 + %112 = OpLabel + %138 = OpLoad %64 %66 + %139 = OpExtInst %64 %1 FAbs %138 + %140 = OpExtInst %64 %1 Normalize %139 + %141 = OpCompositeExtract %6 %140 0 + %142 = OpCompositeExtract %6 %140 1 + %143 = OpCompositeExtract %6 %140 2 + %144 = OpCompositeConstruct %83 %141 %142 %143 %121 + OpStore %137 %144 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 505 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %137 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %66 "c" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %137 "_GLF_color" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpDecorate %137 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %107 = OpConstant %76 2 + %116 = OpConstant %15 3 + %121 = OpConstant %6 1 + %136 = OpTypePointer Output %83 + %137 = OpVariable %136 Output + %149 = OpConstantFalse %26 + %152 = OpConstantTrue %26 + %261 = OpUndef %6 + %289 = OpConstant %6 0.125 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %390 = OpCompositeConstruct %72 %121 %80 + %81 = OpFMul %6 %80 %289 + %82 = OpExtInst %6 %1 Round %81 + %410 = OpCompositeConstruct %72 %261 %14 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpSelectionMerge %199 None + OpSwitch %77 %161 + %161 = OpLabel + OpBranch %162 + %162 = OpLabel + %248 = OpPhi %6 %14 %161 %251 %192 + %247 = OpPhi %15 %18 %161 %194 %192 + %165 = OpSLessThan %26 %247 %25 + OpLoopMerge %195 %192 None + OpBranchConditional %165 %166 %195 + %166 = OpLabel + %168 = OpSMod %15 %247 %29 + %169 = OpIEqual %26 %168 %31 + OpSelectionMerge %184 None + OpBranchConditional %169 %170 %173 + %170 = OpLabel + %172 = OpFAdd %6 %248 %35 + OpBranch %184 + %173 = OpLabel + %175 = OpConvertSToF %6 %247 + %177 = OpExtInst %6 %1 Round %82 + %178 = OpFMod %6 %175 %177 + %179 = OpFOrdLessThanEqual %26 %178 %44 + OpSelectionMerge %183 None + OpBranchConditional %179 %180 %183 + %180 = OpLabel + %182 = OpFAdd %6 %248 %48 + OpBranch %183 + %183 = OpLabel + %252 = OpPhi %6 %248 %173 %182 %180 + OpBranch %184 + %184 = OpLabel + %251 = OpPhi %6 %172 %170 %252 %183 + %186 = OpConvertSToF %6 %247 + %188 = OpFOrdGreaterThanEqual %26 %186 %89 + OpSelectionMerge %191 None + OpBranchConditional %188 %189 %191 + %189 = OpLabel + OpBranch %195 + %191 = OpLabel + OpBranch %192 + %192 = OpLabel + %194 = OpIAdd %15 %247 %18 + OpBranch %162 + %195 = OpLabel + %259 = OpPhi %6 %261 %162 %251 %189 + %257 = OpPhi %6 %248 %162 %251 %189 + %253 = OpPhi %26 %149 %162 %152 %189 + OpSelectionMerge %197 None + OpBranchConditional %253 %199 %197 + %197 = OpLabel + OpBranch %199 + %199 = OpLabel + %258 = OpPhi %6 %259 %195 %257 %197 + %93 = OpAccessChain %7 %66 %77 + %415 = OpCompositeConstruct %83 %257 %35 %259 %35 + %460 = OpCompositeConstruct %64 %390 %14 + OpStore %93 %258 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpSelectionMerge %245 None + OpSwitch %77 %207 + %207 = OpLabel + %417 = OpCompositeConstruct %83 %410 %261 %248 + %504 = OpCompositeExtract %6 %460 2 + OpBranch %208 + %208 = OpLabel + %265 = OpPhi %6 %504 %207 %268 %238 + %264 = OpPhi %15 %18 %207 %240 %238 + %211 = OpSLessThan %26 %264 %25 + OpLoopMerge %241 %238 None + OpBranchConditional %211 %212 %241 + %212 = OpLabel + %214 = OpSMod %15 %264 %29 + %215 = OpIEqual %26 %214 %31 + OpSelectionMerge %230 None + OpBranchConditional %215 %216 %219 + %216 = OpLabel + %218 = OpFAdd %6 %265 %35 + OpBranch %230 + %219 = OpLabel + %221 = OpConvertSToF %6 %264 + %223 = OpExtInst %6 %1 Round %82 + %224 = OpFMod %6 %221 %223 + %225 = OpFOrdLessThanEqual %26 %224 %44 + OpSelectionMerge %229 None + OpBranchConditional %225 %226 %229 + %226 = OpLabel + %228 = OpFAdd %6 %265 %48 + OpBranch %229 + %229 = OpLabel + %269 = OpPhi %6 %265 %219 %228 %226 + OpBranch %230 + %230 = OpLabel + %268 = OpPhi %6 %218 %216 %269 %229 + %232 = OpConvertSToF %6 %264 + %234 = OpFOrdGreaterThanEqual %26 %232 %97 + OpSelectionMerge %237 None + OpBranchConditional %234 %235 %237 + %235 = OpLabel + OpBranch %241 + %237 = OpLabel + OpBranch %238 + %238 = OpLabel + %240 = OpIAdd %15 %264 %18 + OpBranch %208 + %241 = OpLabel + %276 = OpPhi %6 %261 %208 %268 %235 + %274 = OpPhi %6 %265 %208 %268 %235 + %270 = OpPhi %26 %149 %208 %152 %235 + OpSelectionMerge %243 None + OpBranchConditional %270 %245 %243 + %243 = OpLabel + OpBranch %245 + %245 = OpLabel + %275 = OpPhi %6 %276 %241 %274 %243 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %275 + %103 = OpLoad %6 %93 + %105 = OpLoad %6 %101 + %106 = OpFAdd %6 %103 %105 + %108 = OpAccessChain %7 %66 %107 + OpStore %108 %106 + OpBranch %110 + %110 = OpLabel + %285 = OpPhi %15 %31 %245 %135 %113 + %117 = OpSLessThan %26 %285 %116 + OpLoopMerge %112 %113 None + OpBranchConditional %117 %111 %112 + %111 = OpLabel + %119 = OpAccessChain %7 %66 %285 + %120 = OpLoad %6 %119 + %122 = OpFOrdGreaterThanEqual %26 %120 %121 + OpSelectionMerge %124 None + OpBranchConditional %122 %123 %124 + %123 = OpLabel + %128 = OpLoad %6 %119 + %131 = OpLoad %6 %119 + %132 = OpFMul %6 %128 %131 + OpStore %119 %132 + OpBranch %124 + %124 = OpLabel + OpBranch %113 + %113 = OpLabel + %135 = OpIAdd %15 %285 %18 + OpBranch %110 + %112 = OpLabel + %138 = OpLoad %64 %66 + %139 = OpExtInst %64 %1 FAbs %138 + %140 = OpExtInst %64 %1 Normalize %139 + %141 = OpCompositeExtract %6 %140 0 + %142 = OpCompositeExtract %6 %140 1 + %143 = OpCompositeExtract %6 %140 2 + %144 = OpCompositeConstruct %83 %141 %142 %143 %121 + OpStore %137 %144 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-composite2.amber b/vulkan/amber/graphicsfuzz/spv-composite2.amber new file mode 100644 index 0000000..c37a54f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-composite2.amber @@ -0,0 +1,301 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one where an id is hidden inside a composite + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 107 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %74 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %74 "_GLF_color" + OpName %100 "indexable" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %74 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %27 = OpTypeInt 32 0 + %32 = OpConstant %6 10 + %47 = OpConstant %18 10 + %51 = OpConstant %18 100 + %60 = OpTypeBool + %62 = OpConstant %18 4 + %65 = OpConstant %18 1000 + %71 = OpConstant %18 1 + %73 = OpTypePointer Output %10 + %74 = OpVariable %73 Output + %75 = OpConstant %27 16 + %76 = OpTypeArray %10 %75 + %77 = OpConstant %6 0 + %78 = OpConstant %6 1 + %79 = OpConstantComposite %10 %77 %77 %77 %78 + %80 = OpConstant %6 0.5 + %81 = OpConstantComposite %10 %80 %77 %77 %78 + %82 = OpConstantComposite %10 %77 %80 %77 %78 + %83 = OpConstantComposite %10 %80 %80 %77 %78 + %84 = OpConstantComposite %10 %77 %77 %80 %78 + %85 = OpConstantComposite %10 %80 %77 %80 %78 + %86 = OpConstantComposite %10 %77 %80 %80 %78 + %87 = OpConstantComposite %10 %80 %80 %80 %78 + %88 = OpConstantComposite %10 %78 %77 %77 %78 + %89 = OpConstantComposite %10 %77 %78 %77 %78 + %90 = OpConstantComposite %10 %78 %78 %77 %78 + %91 = OpConstantComposite %10 %77 %77 %78 %78 + %92 = OpConstantComposite %10 %78 %77 %78 %78 + %93 = OpConstantComposite %10 %77 %78 %78 %78 + %94 = OpConstantComposite %10 %78 %78 %78 %78 + %95 = OpConstantComposite %76 %79 %81 %82 %83 %84 %85 %86 %87 %79 %88 %89 %90 %91 %92 %93 %94 + %97 = OpConstant %18 16 + %99 = OpTypePointer Function %76 + %101 = OpTypePointer Function %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %100 = OpVariable %99 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + %31 = OpCompositeExtract %6 %23 0 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %37 = OpCompositeExtract %6 %23 1 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %48 = OpIMul %18 %39 %47 + %49 = OpIAdd %18 %34 %48 + OpBranch %53 + %53 = OpLabel + %106 = OpPhi %18 %51 %5 %69 %54 + %104 = OpPhi %18 %19 %5 %72 %54 + %61 = OpSLessThan %60 %104 %49 + OpLoopMerge %55 %54 None + OpBranchConditional %61 %54 %55 + %54 = OpLabel + %64 = OpIMul %18 %62 %106 + %67 = OpISub %18 %65 %106 + %68 = OpIMul %18 %64 %67 + %69 = OpSDiv %18 %68 %65 + %72 = OpIAdd %18 %104 %71 + OpBranch %53 + %55 = OpLabel + %98 = OpSMod %18 %106 %97 + OpStore %100 %95 + %102 = OpAccessChain %101 %100 %98 + %103 = OpLoad %10 %102 + OpStore %74 %103 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 395 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %74 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %74 "_GLF_color" + OpName %100 "indexable" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %74 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %27 = OpTypeInt 32 0 + %32 = OpConstant %6 10 + %47 = OpConstant %18 10 + %51 = OpConstant %18 100 + %60 = OpTypeBool + %62 = OpConstant %18 4 + %65 = OpConstant %18 1000 + %71 = OpConstant %18 1 + %73 = OpTypePointer Output %10 + %74 = OpVariable %73 Output + %75 = OpConstant %27 16 + %76 = OpTypeArray %10 %75 + %77 = OpConstant %6 0 + %78 = OpConstant %6 1 + %79 = OpConstantComposite %10 %77 %77 %77 %78 + %80 = OpConstant %6 0.5 + %81 = OpConstantComposite %10 %80 %77 %77 %78 + %82 = OpConstantComposite %10 %77 %80 %77 %78 + %83 = OpConstantComposite %10 %80 %80 %77 %78 + %84 = OpConstantComposite %10 %77 %77 %80 %78 + %85 = OpConstantComposite %10 %80 %77 %80 %78 + %86 = OpConstantComposite %10 %77 %80 %80 %78 + %87 = OpConstantComposite %10 %80 %80 %80 %78 + %88 = OpConstantComposite %10 %78 %77 %77 %78 + %89 = OpConstantComposite %10 %77 %78 %77 %78 + %90 = OpConstantComposite %10 %78 %78 %77 %78 + %91 = OpConstantComposite %10 %77 %77 %78 %78 + %92 = OpConstantComposite %10 %78 %77 %78 %78 + %93 = OpConstantComposite %10 %77 %78 %78 %78 + %94 = OpConstantComposite %10 %78 %78 %78 %78 + %95 = OpConstantComposite %76 %79 %81 %82 %83 %84 %85 %86 %87 %79 %88 %89 %90 %91 %92 %93 %94 + %97 = OpConstant %18 16 + %99 = OpTypePointer Function %76 + %101 = OpTypePointer Function %10 + %213 = OpConstantComposite %7 %77 %77 + %246 = OpConstant %6 0.5 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %100 = OpVariable %99 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %341 = OpCompositeConstruct %10 %77 %14 %246 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + %31 = OpCompositeExtract %6 %23 0 + %388 = OpCompositeExtract %6 %341 3 + %343 = OpCompositeConstruct %10 %388 %32 %213 + %394 = OpCompositeExtract %6 %343 1 + %33 = OpFMul %6 %31 %394 + %34 = OpConvertFToS %18 %33 + %37 = OpCompositeExtract %6 %23 1 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %48 = OpIMul %18 %39 %47 + %49 = OpIAdd %18 %34 %48 + OpBranch %53 + %53 = OpLabel + %106 = OpPhi %18 %51 %5 %69 %54 + %104 = OpPhi %18 %19 %5 %72 %54 + %61 = OpSLessThan %60 %104 %49 + OpLoopMerge %55 %54 None + OpBranchConditional %61 %54 %55 + %54 = OpLabel + %64 = OpIMul %18 %62 %106 + %67 = OpISub %18 %65 %106 + %68 = OpIMul %18 %64 %67 + %69 = OpSDiv %18 %68 %65 + %72 = OpIAdd %18 %104 %71 + OpBranch %53 + %55 = OpLabel + %98 = OpSMod %18 %106 %97 + OpStore %100 %95 + %102 = OpAccessChain %101 %100 %98 + %103 = OpLoad %10 %102 + OpStore %74 %103 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-composites.amber b/vulkan/amber/graphicsfuzz/spv-composites.amber new file mode 100644 index 0000000..7a0ae1c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-composites.amber @@ -0,0 +1,665 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders; one obfuscates an id via composites + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 366 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %246 %268 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %246 "gl_FragCoord" + OpName %249 "buf0" + OpMemberName %249 0 "resolution" + OpName %251 "" + OpName %268 "_GLF_color" + OpDecorate %246 BuiltIn FragCoord + OpMemberDecorate %249 0 Offset 0 + OpDecorate %249 Block + OpDecorate %251 DescriptorSet 0 + OpDecorate %251 Binding 0 + OpDecorate %268 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %20 = OpTypeInt 32 0 + %22 = OpTypePointer Function %6 + %25 = OpConstant %6 256 + %26 = OpTypeBool + %28 = OpConstant %20 0 + %31 = OpConstant %20 256 + %32 = OpTypeArray %6 %31 + %33 = OpConstant %6 115 + %34 = OpConstant %6 133 + %35 = OpConstant %6 150 + %36 = OpConstant %6 164 + %37 = OpConstant %6 176 + %38 = OpConstant %6 184 + %39 = OpConstant %6 190 + %40 = OpConstant %6 192 + %41 = OpConstant %6 191 + %42 = OpConstant %6 187 + %43 = OpConstant %6 181 + %44 = OpConstant %6 172 + %45 = OpConstant %6 163 + %46 = OpConstant %6 153 + %47 = OpConstant %6 143 + %48 = OpConstant %6 134 + %49 = OpConstant %6 126 + %50 = OpConstant %6 120 + %51 = OpConstant %6 116 + %52 = OpConstant %6 114 + %53 = OpConstant %6 117 + %54 = OpConstant %6 121 + %55 = OpConstant %6 127 + %56 = OpConstant %6 141 + %57 = OpConstant %6 148 + %58 = OpConstant %6 154 + %59 = OpConstant %6 159 + %60 = OpConstant %6 162 + %61 = OpConstant %6 161 + %62 = OpConstant %6 157 + %63 = OpConstant %6 151 + %64 = OpConstant %6 124 + %65 = OpConstant %6 113 + %66 = OpConstant %6 103 + %67 = OpConstant %6 94 + %68 = OpConstant %6 87 + %69 = OpConstant %6 82 + %70 = OpConstant %6 79 + %71 = OpConstant %6 80 + %72 = OpConstant %6 84 + %73 = OpConstant %6 91 + %74 = OpConstant %6 101 + %75 = OpConstant %6 130 + %76 = OpConstant %6 146 + %77 = OpConstant %6 182 + %78 = OpConstant %6 199 + %79 = OpConstant %6 215 + %80 = OpConstant %6 229 + %81 = OpConstant %6 240 + %82 = OpConstant %6 249 + %83 = OpConstant %6 254 + %84 = OpConstant %6 250 + %85 = OpConstant %6 243 + %86 = OpConstant %6 233 + %87 = OpConstant %6 223 + %88 = OpConstant %6 212 + %89 = OpConstant %6 200 + %90 = OpConstant %6 180 + %91 = OpConstant %6 166 + %92 = OpConstant %6 169 + %93 = OpConstant %6 174 + %94 = OpConstant %6 179 + %95 = OpConstant %6 185 + %96 = OpConstant %6 193 + %97 = OpConstant %6 195 + %98 = OpConstant %6 188 + %99 = OpConstant %6 171 + %100 = OpConstant %6 149 + %101 = OpConstant %6 137 + %102 = OpConstant %6 125 + %103 = OpConstant %6 105 + %104 = OpConstant %6 97 + %105 = OpConstant %6 93 + %106 = OpConstant %6 98 + %107 = OpConstant %6 106 + %108 = OpConstant %6 145 + %109 = OpConstant %6 177 + %110 = OpConstant %6 208 + %111 = OpConstant %6 221 + %112 = OpConstant %6 231 + %113 = OpConstant %6 239 + %114 = OpConstant %6 244 + %115 = OpConstant %6 242 + %116 = OpConstant %6 236 + %117 = OpConstant %6 228 + %118 = OpConstant %6 218 + %119 = OpConstant %6 207 + %120 = OpConstant %6 194 + %121 = OpConstant %6 158 + %122 = OpConstant %6 135 + %123 = OpConstant %6 132 + %124 = OpConstant %6 131 + %125 = OpConstant %6 138 + %126 = OpConstant %6 147 + %127 = OpConstant %6 155 + %128 = OpConstant %6 152 + %129 = OpConstant %6 139 + %130 = OpConstant %6 129 + %131 = OpConstant %6 118 + %132 = OpConstant %6 68 + %133 = OpConstant %6 58 + %134 = OpConstant %6 49 + %135 = OpConstant %6 43 + %136 = OpConstant %6 40 + %137 = OpConstant %6 41 + %138 = OpConstant %6 44 + %139 = OpConstant %6 51 + %140 = OpConstant %6 61 + %141 = OpConstant %6 73 + %142 = OpConstant %6 119 + %143 = OpConstant %6 173 + %144 = OpConstant %6 186 + %145 = OpConstant %6 128 + %146 = OpConstant %6 104 + %147 = OpConstant %6 86 + %148 = OpConstant %6 81 + %149 = OpConstant %6 77 + %150 = OpConstant %6 76 + %151 = OpConstant %6 89 + %152 = OpConstant %6 102 + %153 = OpConstant %6 92 + %154 = OpConstant %6 83 + %155 = OpConstant %6 62 + %156 = OpConstant %6 50 + %157 = OpConstant %6 38 + %158 = OpConstant %6 26 + %159 = OpConstant %6 16 + %160 = OpConstant %6 8 + %161 = OpConstant %6 2 + %162 = OpConstant %6 0 + %163 = OpConstant %6 4 + %164 = OpConstant %6 11 + %165 = OpConstant %6 21 + %166 = OpConstant %6 33 + %167 = OpConstant %6 48 + %168 = OpConstant %6 64 + %169 = OpConstant %6 144 + %170 = OpConstant %6 123 + %171 = OpConstant %6 112 + %172 = OpConstant %6 100 + %173 = OpConstant %6 90 + %174 = OpConstant %6 65 + %175 = OpConstant %6 67 + %176 = OpConstant %6 70 + %177 = OpConstant %6 75 + %178 = OpConstant %6 95 + %179 = OpConstant %6 88 + %180 = OpConstant %6 69 + %181 = OpConstant %6 47 + %182 = OpConstant %6 36 + %183 = OpConstant %6 18 + %184 = OpConstant %6 13 + %185 = OpConstant %6 15 + %186 = OpConstant %6 22 + %187 = OpConstant %6 32 + %188 = OpConstant %6 45 + %189 = OpConstant %6 60 + %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67 + %193 = OpTypePointer Function %32 + %215 = OpConstant %9 15 + %231 = OpConstant %9 1 + %236 = OpConstant %6 1 + %238 = OpConstant %9 0 + %239 = OpConstantComposite %10 %238 %238 %238 %231 + %242 = OpTypeVector %9 2 + %245 = OpTypePointer Input %10 + %246 = OpVariable %245 Input + %249 = OpTypeStruct %242 + %250 = OpTypePointer Uniform %249 + %251 = OpVariable %250 Uniform + %252 = OpTypePointer Uniform %242 + %259 = OpConstant %9 256 + %267 = OpTypePointer Output %10 + %268 = OpVariable %267 Output + %277 = OpConstantFalse %26 + %280 = OpConstantTrue %26 + %363 = OpUndef %10 + %365 = OpConstant %9 0.0666666701 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %285 = OpVariable %193 Function + %286 = OpVariable %193 Function + %288 = OpVariable %193 Function + %247 = OpLoad %10 %246 + %248 = OpVectorShuffle %242 %247 %247 0 1 + %253 = OpAccessChain %252 %251 %162 + %254 = OpLoad %242 %253 + %255 = OpFDiv %242 %248 %254 + %258 = OpCompositeExtract %9 %255 0 + %260 = OpFMul %9 %258 %259 + %261 = OpConvertFToS %6 %260 + %263 = OpCompositeExtract %9 %255 1 + %264 = OpFMul %9 %263 %259 + %265 = OpConvertFToS %6 %264 + %266 = OpCompositeConstruct %7 %261 %265 + OpSelectionMerge %341 None + OpSwitch %28 %291 + %291 = OpLabel + OpBranch %292 + %292 = OpLabel + %355 = OpPhi %7 %266 %291 %354 %337 + %295 = OpCompositeExtract %6 %355 1 + %296 = OpINotEqual %26 %295 %25 + OpLoopMerge %338 %337 None + OpBranchConditional %296 %297 %338 + %297 = OpLabel + %299 = OpCompositeExtract %6 %355 0 + OpStore %285 %190 + %302 = OpAccessChain %22 %285 %295 + %303 = OpLoad %6 %302 + %304 = OpIAdd %6 %303 %185 + %305 = OpSLessThan %26 %299 %304 + OpSelectionMerge %315 None + OpBranchConditional %305 %306 %315 + %306 = OpLabel + OpStore %286 %190 + %311 = OpAccessChain %22 %286 %295 + %312 = OpLoad %6 %311 + %313 = OpISub %6 %312 %185 + %314 = OpSGreaterThan %26 %299 %313 + OpBranch %315 + %315 = OpLabel + %316 = OpPhi %26 %305 %297 %314 %306 + OpSelectionMerge %333 None + OpBranchConditional %316 %317 %333 + %317 = OpLabel + OpStore %288 %190 + %322 = OpAccessChain %22 %288 %295 + %323 = OpLoad %6 %322 + %324 = OpISub %6 %299 %323 + %325 = OpConvertSToF %9 %324 + %326 = OpExtInst %9 %1 FAbs %325 + %327 = OpFSub %9 %215 %326 + %328 = OpFMul %9 %327 %365 + %332 = OpCompositeConstruct %10 %328 %328 %328 %231 + OpBranch %338 + %333 = OpLabel + %336 = OpIAdd %6 %295 %236 + %354 = OpCompositeInsert %7 %336 %355 1 + OpBranch %337 + %337 = OpLabel + OpBranch %292 + %338 = OpLabel + %361 = OpPhi %10 %363 %292 %332 %317 + %357 = OpPhi %26 %277 %292 %280 %317 + OpSelectionMerge %340 None + OpBranchConditional %357 %341 %340 + %340 = OpLabel + OpBranch %341 + %341 = OpLabel + %360 = OpPhi %10 %361 %338 %239 %340 + OpStore %268 %360 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 2249 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %246 %268 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %246 "gl_FragCoord" + OpName %249 "buf0" + OpMemberName %249 0 "resolution" + OpName %251 "" + OpName %268 "_GLF_color" + OpDecorate %246 BuiltIn FragCoord + OpMemberDecorate %249 0 Offset 0 + OpDecorate %249 Block + OpDecorate %251 DescriptorSet 0 + OpDecorate %251 Binding 0 + OpDecorate %268 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %20 = OpTypeInt 32 0 + %22 = OpTypePointer Function %6 + %25 = OpConstant %6 256 + %26 = OpTypeBool + %28 = OpConstant %20 0 + %31 = OpConstant %20 256 + %32 = OpTypeArray %6 %31 + %33 = OpConstant %6 115 + %34 = OpConstant %6 133 + %35 = OpConstant %6 150 + %36 = OpConstant %6 164 + %37 = OpConstant %6 176 + %38 = OpConstant %6 184 + %39 = OpConstant %6 190 + %40 = OpConstant %6 192 + %41 = OpConstant %6 191 + %42 = OpConstant %6 187 + %43 = OpConstant %6 181 + %44 = OpConstant %6 172 + %45 = OpConstant %6 163 + %46 = OpConstant %6 153 + %47 = OpConstant %6 143 + %48 = OpConstant %6 134 + %49 = OpConstant %6 126 + %50 = OpConstant %6 120 + %51 = OpConstant %6 116 + %52 = OpConstant %6 114 + %53 = OpConstant %6 117 + %54 = OpConstant %6 121 + %55 = OpConstant %6 127 + %56 = OpConstant %6 141 + %57 = OpConstant %6 148 + %58 = OpConstant %6 154 + %59 = OpConstant %6 159 + %60 = OpConstant %6 162 + %61 = OpConstant %6 161 + %62 = OpConstant %6 157 + %63 = OpConstant %6 151 + %64 = OpConstant %6 124 + %65 = OpConstant %6 113 + %66 = OpConstant %6 103 + %67 = OpConstant %6 94 + %68 = OpConstant %6 87 + %69 = OpConstant %6 82 + %70 = OpConstant %6 79 + %71 = OpConstant %6 80 + %72 = OpConstant %6 84 + %73 = OpConstant %6 91 + %74 = OpConstant %6 101 + %75 = OpConstant %6 130 + %76 = OpConstant %6 146 + %77 = OpConstant %6 182 + %78 = OpConstant %6 199 + %79 = OpConstant %6 215 + %80 = OpConstant %6 229 + %81 = OpConstant %6 240 + %82 = OpConstant %6 249 + %83 = OpConstant %6 254 + %84 = OpConstant %6 250 + %85 = OpConstant %6 243 + %86 = OpConstant %6 233 + %87 = OpConstant %6 223 + %88 = OpConstant %6 212 + %89 = OpConstant %6 200 + %90 = OpConstant %6 180 + %91 = OpConstant %6 166 + %92 = OpConstant %6 169 + %93 = OpConstant %6 174 + %94 = OpConstant %6 179 + %95 = OpConstant %6 185 + %96 = OpConstant %6 193 + %97 = OpConstant %6 195 + %98 = OpConstant %6 188 + %99 = OpConstant %6 171 + %100 = OpConstant %6 149 + %101 = OpConstant %6 137 + %102 = OpConstant %6 125 + %103 = OpConstant %6 105 + %104 = OpConstant %6 97 + %105 = OpConstant %6 93 + %106 = OpConstant %6 98 + %107 = OpConstant %6 106 + %108 = OpConstant %6 145 + %109 = OpConstant %6 177 + %110 = OpConstant %6 208 + %111 = OpConstant %6 221 + %112 = OpConstant %6 231 + %113 = OpConstant %6 239 + %114 = OpConstant %6 244 + %115 = OpConstant %6 242 + %116 = OpConstant %6 236 + %117 = OpConstant %6 228 + %118 = OpConstant %6 218 + %119 = OpConstant %6 207 + %120 = OpConstant %6 194 + %121 = OpConstant %6 158 + %122 = OpConstant %6 135 + %123 = OpConstant %6 132 + %124 = OpConstant %6 131 + %125 = OpConstant %6 138 + %126 = OpConstant %6 147 + %127 = OpConstant %6 155 + %128 = OpConstant %6 152 + %129 = OpConstant %6 139 + %130 = OpConstant %6 129 + %131 = OpConstant %6 118 + %132 = OpConstant %6 68 + %133 = OpConstant %6 58 + %134 = OpConstant %6 49 + %135 = OpConstant %6 43 + %136 = OpConstant %6 40 + %137 = OpConstant %6 41 + %138 = OpConstant %6 44 + %139 = OpConstant %6 51 + %140 = OpConstant %6 61 + %141 = OpConstant %6 73 + %142 = OpConstant %6 119 + %143 = OpConstant %6 173 + %144 = OpConstant %6 186 + %145 = OpConstant %6 128 + %146 = OpConstant %6 104 + %147 = OpConstant %6 86 + %148 = OpConstant %6 81 + %149 = OpConstant %6 77 + %150 = OpConstant %6 76 + %151 = OpConstant %6 89 + %152 = OpConstant %6 102 + %153 = OpConstant %6 92 + %154 = OpConstant %6 83 + %155 = OpConstant %6 62 + %156 = OpConstant %6 50 + %157 = OpConstant %6 38 + %158 = OpConstant %6 26 + %159 = OpConstant %6 16 + %160 = OpConstant %6 8 + %161 = OpConstant %6 2 + %162 = OpConstant %6 0 + %163 = OpConstant %6 4 + %164 = OpConstant %6 11 + %165 = OpConstant %6 21 + %166 = OpConstant %6 33 + %167 = OpConstant %6 48 + %168 = OpConstant %6 64 + %169 = OpConstant %6 144 + %170 = OpConstant %6 123 + %171 = OpConstant %6 112 + %172 = OpConstant %6 100 + %173 = OpConstant %6 90 + %174 = OpConstant %6 65 + %175 = OpConstant %6 67 + %176 = OpConstant %6 70 + %177 = OpConstant %6 75 + %178 = OpConstant %6 95 + %179 = OpConstant %6 88 + %180 = OpConstant %6 69 + %181 = OpConstant %6 47 + %182 = OpConstant %6 36 + %183 = OpConstant %6 18 + %184 = OpConstant %6 13 + %185 = OpConstant %6 15 + %186 = OpConstant %6 22 + %187 = OpConstant %6 32 + %188 = OpConstant %6 45 + %189 = OpConstant %6 60 + %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67 + %193 = OpTypePointer Function %32 + %215 = OpConstant %9 15 + %231 = OpConstant %9 1 + %236 = OpConstant %6 1 + %238 = OpConstant %9 0 + %239 = OpConstantComposite %10 %238 %238 %238 %231 + %242 = OpTypeVector %9 2 + %245 = OpTypePointer Input %10 + %246 = OpVariable %245 Input + %249 = OpTypeStruct %242 + %250 = OpTypePointer Uniform %249 + %251 = OpVariable %250 Uniform + %252 = OpTypePointer Uniform %242 + %259 = OpConstant %9 256 + %267 = OpTypePointer Output %10 + %268 = OpVariable %267 Output + %277 = OpConstantFalse %26 + %280 = OpConstantTrue %26 + %363 = OpUndef %10 + %365 = OpConstant %9 0.0666666701 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %285 = OpVariable %193 Function + %286 = OpVariable %193 Function + %288 = OpVariable %193 Function + %247 = OpLoad %10 %246 + %248 = OpVectorShuffle %242 %247 %247 0 1 + %253 = OpAccessChain %252 %251 %162 + %254 = OpLoad %242 %253 + %255 = OpFDiv %242 %248 %254 + %588 = OpCompositeConstruct %10 %254 %215 %215 + %474 = OpSNegate %6 %69 + %258 = OpCompositeExtract %9 %255 0 + %260 = OpFMul %9 %258 %259 + %2248 = OpCompositeExtract %9 %588 2 + %593 = OpCompositeConstruct %242 %238 %2248 + %547 = OpISub %6 %50 %162 + %261 = OpConvertFToS %6 %260 + %263 = OpCompositeExtract %9 %255 1 + %264 = OpFMul %9 %263 %259 + %265 = OpConvertFToS %6 %264 + %266 = OpCompositeConstruct %7 %261 %265 + OpSelectionMerge %341 None + OpSwitch %28 %291 + %291 = OpLabel + OpBranch %292 + %292 = OpLabel + %355 = OpPhi %7 %266 %291 %354 %337 + %295 = OpCompositeExtract %6 %355 1 + %296 = OpINotEqual %26 %295 %25 + OpLoopMerge %338 %337 None + OpBranchConditional %296 %297 %338 + %297 = OpLabel + %299 = OpCompositeExtract %6 %355 0 + OpStore %285 %190 + %302 = OpAccessChain %22 %285 %295 + %303 = OpLoad %6 %302 + %304 = OpIAdd %6 %303 %185 + %305 = OpSLessThan %26 %299 %304 + OpSelectionMerge %315 None + OpBranchConditional %305 %306 %315 + %306 = OpLabel + OpStore %286 %190 + %311 = OpAccessChain %22 %286 %295 + %312 = OpLoad %6 %311 + %313 = OpISub %6 %312 %185 + %314 = OpSGreaterThan %26 %299 %313 + OpBranch %315 + %315 = OpLabel + %316 = OpPhi %26 %305 %297 %314 %306 + OpSelectionMerge %333 None + OpBranchConditional %316 %317 %333 + %317 = OpLabel + OpStore %288 %190 + %322 = OpAccessChain %22 %288 %295 + %323 = OpLoad %6 %322 + %324 = OpISub %6 %299 %323 + %325 = OpConvertSToF %9 %324 + %639 = OpCompositeConstruct %249 %593 + %495 = OpIAdd %6 %73 %114 + %326 = OpExtInst %9 %1 FAbs %325 + %2247 = OpCompositeExtract %9 %639 0 1 + %327 = OpFSub %9 %2247 %326 + %328 = OpFMul %9 %327 %365 + %332 = OpCompositeConstruct %10 %328 %328 %328 %231 + OpBranch %338 + %333 = OpLabel + %336 = OpIAdd %6 %295 %236 + %354 = OpCompositeInsert %7 %336 %355 1 + OpBranch %337 + %337 = OpLabel + OpBranch %292 + %338 = OpLabel + %361 = OpPhi %10 %363 %292 %332 %317 + %357 = OpPhi %26 %277 %292 %280 %317 + OpSelectionMerge %340 None + OpBranchConditional %357 %341 %340 + %340 = OpLabel + OpBranch %341 + %341 = OpLabel + %360 = OpPhi %10 %361 %338 %239 %340 + OpStore %268 %360 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-copy-object.amber b/vulkan/amber/graphicsfuzz/spv-copy-object.amber new file mode 100644 index 0000000..a0a421b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-copy-object.amber @@ -0,0 +1,1308 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders; one features extra OpCopyObject instructions + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 442 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %435 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "pos" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %26 "ipos" + OpName %42 "i" + OpName %55 "map" + OpName %62 "p" + OpName %65 "canwalk" + OpName %67 "v" + OpName %74 "directions" + OpName %171 "j" + OpName %208 "d" + OpName %435 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %435 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %24 = OpTypeVector %18 2 + %25 = OpTypePointer Function %24 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %29 = OpTypePointer Function %6 + %32 = OpConstant %6 16 + %35 = OpConstant %27 1 + %41 = OpTypePointer Function %18 + %49 = OpConstant %18 256 + %50 = OpTypeBool + %52 = OpConstant %27 256 + %53 = OpTypeArray %18 %52 + %54 = OpTypePointer Private %53 + %55 = OpVariable %54 Private + %57 = OpTypePointer Private %18 + %60 = OpConstant %18 1 + %63 = OpConstantComposite %24 %19 %19 + %64 = OpTypePointer Function %50 + %66 = OpConstantTrue %50 + %82 = OpConstant %18 2 + %86 = OpConstant %18 16 + %119 = OpConstant %18 14 + %162 = OpConstantFalse %50 + %169 = OpConstant %18 8 + %434 = OpTypePointer Output %10 + %435 = OpVariable %434 Output + %436 = OpConstant %6 1 + %437 = OpConstantComposite %10 %436 %436 %436 %436 + %440 = OpConstant %6 0 + %441 = OpConstantComposite %10 %440 %440 %440 %436 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %26 = OpVariable %25 Function + %42 = OpVariable %41 Function + %62 = OpVariable %25 Function + %65 = OpVariable %64 Function + %67 = OpVariable %41 Function + %74 = OpVariable %41 Function + %171 = OpVariable %41 Function + %208 = OpVariable %41 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + OpStore %9 %23 + %30 = OpAccessChain %29 %9 %28 + %31 = OpLoad %6 %30 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %36 = OpAccessChain %29 %9 %35 + %37 = OpLoad %6 %36 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %40 = OpCompositeConstruct %24 %34 %39 + OpStore %26 %40 + OpStore %42 %19 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %18 %42 + %51 = OpSLessThan %50 %48 %49 + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %56 = OpLoad %18 %42 + %58 = OpAccessChain %57 %55 %56 + OpStore %58 %19 + OpBranch %46 + %46 = OpLabel + %59 = OpLoad %18 %42 + %61 = OpIAdd %18 %59 %60 + OpStore %42 %61 + OpBranch %43 + %45 = OpLabel + OpStore %62 %63 + OpStore %65 %66 + OpStore %67 %19 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %72 = OpLoad %18 %67 + %73 = OpIAdd %18 %72 %60 + OpStore %67 %73 + OpStore %74 %19 + %75 = OpAccessChain %41 %62 %28 + %76 = OpLoad %18 %75 + %77 = OpSGreaterThan %50 %76 %19 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %41 %62 %28 + %81 = OpLoad %18 %80 + %83 = OpISub %18 %81 %82 + %84 = OpAccessChain %41 %62 %35 + %85 = OpLoad %18 %84 + %87 = OpIMul %18 %85 %86 + %88 = OpIAdd %18 %83 %87 + %89 = OpAccessChain %57 %55 %88 + %90 = OpLoad %18 %89 + %91 = OpIEqual %50 %90 %19 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %50 %77 %69 %91 %78 + OpSelectionMerge %94 None + OpBranchConditional %92 %93 %94 + %93 = OpLabel + %95 = OpLoad %18 %74 + %96 = OpIAdd %18 %95 %60 + OpStore %74 %96 + OpBranch %94 + %94 = OpLabel + %97 = OpAccessChain %41 %62 %35 + %98 = OpLoad %18 %97 + %99 = OpSGreaterThan %50 %98 %19 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %102 = OpAccessChain %41 %62 %28 + %103 = OpLoad %18 %102 + %104 = OpAccessChain %41 %62 %35 + %105 = OpLoad %18 %104 + %106 = OpISub %18 %105 %82 + %107 = OpIMul %18 %106 %86 + %108 = OpIAdd %18 %103 %107 + %109 = OpAccessChain %57 %55 %108 + %110 = OpLoad %18 %109 + %111 = OpIEqual %50 %110 %19 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %50 %99 %94 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %115 = OpLoad %18 %74 + %116 = OpIAdd %18 %115 %60 + OpStore %74 %116 + OpBranch %114 + %114 = OpLabel + %117 = OpAccessChain %41 %62 %28 + %118 = OpLoad %18 %117 + %120 = OpSLessThan %50 %118 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %41 %62 %28 + %124 = OpLoad %18 %123 + %125 = OpIAdd %18 %124 %82 + %126 = OpAccessChain %41 %62 %35 + %127 = OpLoad %18 %126 + %128 = OpIMul %18 %127 %86 + %129 = OpIAdd %18 %125 %128 + %130 = OpAccessChain %57 %55 %129 + %131 = OpLoad %18 %130 + %132 = OpIEqual %50 %131 %19 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %50 %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %136 = OpLoad %18 %74 + %137 = OpIAdd %18 %136 %60 + OpStore %74 %137 + OpBranch %135 + %135 = OpLabel + %138 = OpAccessChain %41 %62 %35 + %139 = OpLoad %18 %138 + %140 = OpSLessThan %50 %139 %119 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %41 %62 %28 + %144 = OpLoad %18 %143 + %145 = OpAccessChain %41 %62 %35 + %146 = OpLoad %18 %145 + %147 = OpIAdd %18 %146 %82 + %148 = OpIMul %18 %147 %86 + %149 = OpIAdd %18 %144 %148 + %150 = OpAccessChain %57 %55 %149 + %151 = OpLoad %18 %150 + %152 = OpIEqual %50 %151 %19 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %50 %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %156 = OpLoad %18 %74 + %157 = OpIAdd %18 %156 %60 + OpStore %74 %157 + OpBranch %155 + %155 = OpLabel + %158 = OpLoad %18 %74 + %159 = OpIEqual %50 %158 %19 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpStore %65 %162 + OpStore %42 %19 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %18 %42 + %170 = OpSLessThan %50 %168 %169 + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpStore %171 %19 + OpBranch %172 + %172 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %18 %171 + %178 = OpSLessThan %50 %177 %169 + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %179 = OpLoad %18 %171 + %180 = OpIMul %18 %179 %82 + %181 = OpLoad %18 %42 + %182 = OpIMul %18 %181 %82 + %183 = OpIMul %18 %182 %86 + %184 = OpIAdd %18 %180 %183 + %185 = OpAccessChain %57 %55 %184 + %186 = OpLoad %18 %185 + %187 = OpIEqual %50 %186 %19 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %190 = OpLoad %18 %171 + %191 = OpIMul %18 %190 %82 + %192 = OpAccessChain %41 %62 %28 + OpStore %192 %191 + %193 = OpLoad %18 %42 + %194 = OpIMul %18 %193 %82 + %195 = OpAccessChain %41 %62 %35 + OpStore %195 %194 + OpStore %65 %66 + OpBranch %189 + %189 = OpLabel + OpBranch %175 + %175 = OpLabel + %196 = OpLoad %18 %171 + %197 = OpIAdd %18 %196 %60 + OpStore %171 %197 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %198 = OpLoad %18 %42 + %199 = OpIAdd %18 %198 %60 + OpStore %42 %199 + OpBranch %163 + %165 = OpLabel + %200 = OpAccessChain %41 %62 %28 + %201 = OpLoad %18 %200 + %202 = OpAccessChain %41 %62 %35 + %203 = OpLoad %18 %202 + %204 = OpIMul %18 %203 %86 + %205 = OpIAdd %18 %201 %204 + %206 = OpAccessChain %57 %55 %205 + OpStore %206 %60 + OpBranch %161 + %207 = OpLabel + %209 = OpLoad %18 %67 + %210 = OpLoad %18 %74 + %211 = OpSMod %18 %209 %210 + OpStore %208 %211 + %212 = OpLoad %18 %74 + %213 = OpLoad %18 %67 + %214 = OpIAdd %18 %213 %212 + OpStore %67 %214 + %215 = OpLoad %18 %208 + %216 = OpSGreaterThanEqual %50 %215 %19 + OpSelectionMerge %218 None + OpBranchConditional %216 %217 %218 + %217 = OpLabel + %219 = OpAccessChain %41 %62 %28 + %220 = OpLoad %18 %219 + %221 = OpSGreaterThan %50 %220 %19 + OpBranch %218 + %218 = OpLabel + %222 = OpPhi %50 %216 %207 %221 %217 + OpSelectionMerge %224 None + OpBranchConditional %222 %223 %224 + %223 = OpLabel + %225 = OpAccessChain %41 %62 %28 + %226 = OpLoad %18 %225 + %227 = OpISub %18 %226 %82 + %228 = OpAccessChain %41 %62 %35 + %229 = OpLoad %18 %228 + %230 = OpIMul %18 %229 %86 + %231 = OpIAdd %18 %227 %230 + %232 = OpAccessChain %57 %55 %231 + %233 = OpLoad %18 %232 + %234 = OpIEqual %50 %233 %19 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %50 %222 %218 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %238 = OpLoad %18 %208 + %239 = OpISub %18 %238 %60 + OpStore %208 %239 + %240 = OpAccessChain %41 %62 %28 + %241 = OpLoad %18 %240 + %242 = OpAccessChain %41 %62 %35 + %243 = OpLoad %18 %242 + %244 = OpIMul %18 %243 %86 + %245 = OpIAdd %18 %241 %244 + %246 = OpAccessChain %57 %55 %245 + OpStore %246 %60 + %247 = OpAccessChain %41 %62 %28 + %248 = OpLoad %18 %247 + %249 = OpISub %18 %248 %60 + %250 = OpAccessChain %41 %62 %35 + %251 = OpLoad %18 %250 + %252 = OpIMul %18 %251 %86 + %253 = OpIAdd %18 %249 %252 + %254 = OpAccessChain %57 %55 %253 + OpStore %254 %60 + %255 = OpAccessChain %41 %62 %28 + %256 = OpLoad %18 %255 + %257 = OpISub %18 %256 %82 + %258 = OpAccessChain %41 %62 %35 + %259 = OpLoad %18 %258 + %260 = OpIMul %18 %259 %86 + %261 = OpIAdd %18 %257 %260 + %262 = OpAccessChain %57 %55 %261 + OpStore %262 %60 + %263 = OpAccessChain %41 %62 %28 + %264 = OpLoad %18 %263 + %265 = OpISub %18 %264 %82 + %266 = OpAccessChain %41 %62 %28 + OpStore %266 %265 + OpBranch %237 + %237 = OpLabel + %267 = OpLoad %18 %208 + %268 = OpSGreaterThanEqual %50 %267 %19 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %271 = OpAccessChain %41 %62 %35 + %272 = OpLoad %18 %271 + %273 = OpSGreaterThan %50 %272 %19 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %50 %268 %237 %273 %269 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %277 = OpAccessChain %41 %62 %28 + %278 = OpLoad %18 %277 + %279 = OpAccessChain %41 %62 %35 + %280 = OpLoad %18 %279 + %281 = OpISub %18 %280 %82 + %282 = OpIMul %18 %281 %86 + %283 = OpIAdd %18 %278 %282 + %284 = OpAccessChain %57 %55 %283 + %285 = OpLoad %18 %284 + %286 = OpIEqual %50 %285 %19 + OpBranch %276 + %276 = OpLabel + %287 = OpPhi %50 %274 %270 %286 %275 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %290 = OpLoad %18 %208 + %291 = OpISub %18 %290 %60 + OpStore %208 %291 + %292 = OpAccessChain %41 %62 %28 + %293 = OpLoad %18 %292 + %294 = OpAccessChain %41 %62 %35 + %295 = OpLoad %18 %294 + %296 = OpIMul %18 %295 %86 + %297 = OpIAdd %18 %293 %296 + %298 = OpAccessChain %57 %55 %297 + OpStore %298 %60 + %299 = OpAccessChain %41 %62 %28 + %300 = OpLoad %18 %299 + %301 = OpAccessChain %41 %62 %35 + %302 = OpLoad %18 %301 + %303 = OpISub %18 %302 %60 + %304 = OpIMul %18 %303 %86 + %305 = OpIAdd %18 %300 %304 + %306 = OpAccessChain %57 %55 %305 + OpStore %306 %60 + %307 = OpAccessChain %41 %62 %28 + %308 = OpLoad %18 %307 + %309 = OpAccessChain %41 %62 %35 + %310 = OpLoad %18 %309 + %311 = OpISub %18 %310 %82 + %312 = OpIMul %18 %311 %86 + %313 = OpIAdd %18 %308 %312 + %314 = OpAccessChain %57 %55 %313 + OpStore %314 %60 + %315 = OpAccessChain %41 %62 %35 + %316 = OpLoad %18 %315 + %317 = OpISub %18 %316 %82 + %318 = OpAccessChain %41 %62 %35 + OpStore %318 %317 + OpBranch %289 + %289 = OpLabel + %319 = OpLoad %18 %208 + %320 = OpSGreaterThanEqual %50 %319 %19 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %41 %62 %28 + %324 = OpLoad %18 %323 + %325 = OpSLessThan %50 %324 %119 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %50 %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %41 %62 %28 + %330 = OpLoad %18 %329 + %331 = OpIAdd %18 %330 %82 + %332 = OpAccessChain %41 %62 %35 + %333 = OpLoad %18 %332 + %334 = OpIMul %18 %333 %86 + %335 = OpIAdd %18 %331 %334 + %336 = OpAccessChain %57 %55 %335 + %337 = OpLoad %18 %336 + %338 = OpIEqual %50 %337 %19 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %50 %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %342 = OpLoad %18 %208 + %343 = OpISub %18 %342 %60 + OpStore %208 %343 + %344 = OpAccessChain %41 %62 %28 + %345 = OpLoad %18 %344 + %346 = OpAccessChain %41 %62 %35 + %347 = OpLoad %18 %346 + %348 = OpIMul %18 %347 %86 + %349 = OpIAdd %18 %345 %348 + %350 = OpAccessChain %57 %55 %349 + OpStore %350 %60 + %351 = OpAccessChain %41 %62 %28 + %352 = OpLoad %18 %351 + %353 = OpIAdd %18 %352 %60 + %354 = OpAccessChain %41 %62 %35 + %355 = OpLoad %18 %354 + %356 = OpIMul %18 %355 %86 + %357 = OpIAdd %18 %353 %356 + %358 = OpAccessChain %57 %55 %357 + OpStore %358 %60 + %359 = OpAccessChain %41 %62 %28 + %360 = OpLoad %18 %359 + %361 = OpIAdd %18 %360 %82 + %362 = OpAccessChain %41 %62 %35 + %363 = OpLoad %18 %362 + %364 = OpIMul %18 %363 %86 + %365 = OpIAdd %18 %361 %364 + %366 = OpAccessChain %57 %55 %365 + OpStore %366 %60 + %367 = OpAccessChain %41 %62 %28 + %368 = OpLoad %18 %367 + %369 = OpIAdd %18 %368 %82 + %370 = OpAccessChain %41 %62 %28 + OpStore %370 %369 + OpBranch %341 + %341 = OpLabel + %371 = OpLoad %18 %208 + %372 = OpSGreaterThanEqual %50 %371 %19 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %375 = OpAccessChain %41 %62 %35 + %376 = OpLoad %18 %375 + %377 = OpSLessThan %50 %376 %119 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %50 %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %381 = OpAccessChain %41 %62 %28 + %382 = OpLoad %18 %381 + %383 = OpAccessChain %41 %62 %35 + %384 = OpLoad %18 %383 + %385 = OpIAdd %18 %384 %82 + %386 = OpIMul %18 %385 %86 + %387 = OpIAdd %18 %382 %386 + %388 = OpAccessChain %57 %55 %387 + %389 = OpLoad %18 %388 + %390 = OpIEqual %50 %389 %19 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %50 %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %394 = OpLoad %18 %208 + %395 = OpISub %18 %394 %60 + OpStore %208 %395 + %396 = OpAccessChain %41 %62 %28 + %397 = OpLoad %18 %396 + %398 = OpAccessChain %41 %62 %35 + %399 = OpLoad %18 %398 + %400 = OpIMul %18 %399 %86 + %401 = OpIAdd %18 %397 %400 + %402 = OpAccessChain %57 %55 %401 + OpStore %402 %60 + %403 = OpAccessChain %41 %62 %28 + %404 = OpLoad %18 %403 + %405 = OpAccessChain %41 %62 %35 + %406 = OpLoad %18 %405 + %407 = OpIAdd %18 %406 %60 + %408 = OpIMul %18 %407 %86 + %409 = OpIAdd %18 %404 %408 + %410 = OpAccessChain %57 %55 %409 + OpStore %410 %60 + %411 = OpAccessChain %41 %62 %28 + %412 = OpLoad %18 %411 + %413 = OpAccessChain %41 %62 %35 + %414 = OpLoad %18 %413 + %415 = OpIAdd %18 %414 %82 + %416 = OpIMul %18 %415 %86 + %417 = OpIAdd %18 %412 %416 + %418 = OpAccessChain %57 %55 %417 + OpStore %418 %60 + %419 = OpAccessChain %41 %62 %35 + %420 = OpLoad %18 %419 + %421 = OpIAdd %18 %420 %82 + %422 = OpAccessChain %41 %62 %35 + OpStore %422 %421 + OpBranch %393 + %393 = OpLabel + OpBranch %161 + %161 = OpLabel + %423 = OpAccessChain %41 %26 %35 + %424 = OpLoad %18 %423 + %425 = OpIMul %18 %424 %86 + %426 = OpAccessChain %41 %26 %28 + %427 = OpLoad %18 %426 + %428 = OpIAdd %18 %425 %427 + %429 = OpAccessChain %57 %55 %428 + %430 = OpLoad %18 %429 + %431 = OpIEqual %50 %430 %60 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %435 %437 + OpReturn + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + %439 = OpLoad %50 %65 + OpBranchConditional %439 %68 %70 + %70 = OpLabel + OpStore %435 %441 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 64.0 64.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 64 64 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 978 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %435 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "pos" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %26 "ipos" + OpName %42 "i" + OpName %55 "map" + OpName %62 "p" + OpName %65 "canwalk" + OpName %67 "v" + OpName %74 "directions" + OpName %171 "j" + OpName %208 "d" + OpName %435 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %435 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %24 = OpTypeVector %18 2 + %25 = OpTypePointer Function %24 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %29 = OpTypePointer Function %6 + %32 = OpConstant %6 16 + %35 = OpConstant %27 1 + %41 = OpTypePointer Function %18 + %49 = OpConstant %18 256 + %50 = OpTypeBool + %52 = OpConstant %27 256 + %53 = OpTypeArray %18 %52 + %54 = OpTypePointer Private %53 + %55 = OpVariable %54 Private + %57 = OpTypePointer Private %18 + %60 = OpConstant %18 1 + %63 = OpConstantComposite %24 %19 %19 + %64 = OpTypePointer Function %50 + %66 = OpConstantTrue %50 + %82 = OpConstant %18 2 + %86 = OpConstant %18 16 + %119 = OpConstant %18 14 + %162 = OpConstantFalse %50 + %169 = OpConstant %18 8 + %434 = OpTypePointer Output %10 + %435 = OpVariable %434 Output + %436 = OpConstant %6 1 + %437 = OpConstantComposite %10 %436 %436 %436 %436 + %440 = OpConstant %6 0 + %441 = OpConstantComposite %10 %440 %440 %440 %436 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %26 = OpVariable %25 Function + %42 = OpVariable %41 Function + %62 = OpVariable %25 Function + %65 = OpVariable %64 Function + %67 = OpVariable %41 Function + %74 = OpVariable %41 Function + %171 = OpVariable %41 Function + %208 = OpVariable %41 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + OpStore %9 %23 + %30 = OpAccessChain %29 %9 %28 + %31 = OpLoad %6 %30 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %36 = OpAccessChain %29 %9 %35 + %37 = OpLoad %6 %36 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %40 = OpCompositeConstruct %24 %34 %39 + OpStore %26 %40 + OpStore %42 %19 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %18 %42 + %51 = OpSLessThan %50 %48 %49 + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %56 = OpLoad %18 %42 + %58 = OpAccessChain %57 %55 %56 + OpStore %58 %19 + OpBranch %46 + %46 = OpLabel + %59 = OpLoad %18 %42 + %61 = OpIAdd %18 %59 %60 + OpStore %42 %61 + OpBranch %43 + %45 = OpLabel + OpStore %62 %63 + OpStore %65 %66 + OpStore %67 %19 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %72 = OpLoad %18 %67 + %73 = OpIAdd %18 %72 %60 + OpStore %67 %73 + OpStore %74 %19 + %75 = OpAccessChain %41 %62 %28 + %76 = OpLoad %18 %75 + %77 = OpSGreaterThan %50 %76 %19 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %41 %62 %28 + %81 = OpLoad %18 %80 + %83 = OpISub %18 %81 %82 + %84 = OpAccessChain %41 %62 %35 + %85 = OpLoad %18 %84 + %87 = OpIMul %18 %85 %86 + %88 = OpIAdd %18 %83 %87 + %89 = OpAccessChain %57 %55 %88 + %90 = OpLoad %18 %89 + %91 = OpIEqual %50 %90 %19 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %50 %77 %69 %91 %78 + OpSelectionMerge %94 None + OpBranchConditional %92 %93 %94 + %93 = OpLabel + %95 = OpLoad %18 %74 + %96 = OpIAdd %18 %95 %60 + OpStore %74 %96 + OpBranch %94 + %94 = OpLabel + %97 = OpAccessChain %41 %62 %35 + %98 = OpLoad %18 %97 + %99 = OpSGreaterThan %50 %98 %19 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %102 = OpAccessChain %41 %62 %28 + %103 = OpLoad %18 %102 + %104 = OpAccessChain %41 %62 %35 + %105 = OpLoad %18 %104 + %106 = OpISub %18 %105 %82 + %107 = OpIMul %18 %106 %86 + %108 = OpIAdd %18 %103 %107 + %109 = OpAccessChain %57 %55 %108 + %110 = OpLoad %18 %109 + %111 = OpIEqual %50 %110 %19 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %50 %99 %94 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %115 = OpLoad %18 %74 + %116 = OpIAdd %18 %115 %60 + OpStore %74 %116 + OpBranch %114 + %114 = OpLabel + %117 = OpAccessChain %41 %62 %28 + %118 = OpLoad %18 %117 + %120 = OpSLessThan %50 %118 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %41 %62 %28 + %124 = OpLoad %18 %123 + %125 = OpIAdd %18 %124 %82 + %126 = OpAccessChain %41 %62 %35 + %127 = OpLoad %18 %126 + %128 = OpIMul %18 %127 %86 + %129 = OpIAdd %18 %125 %128 + %130 = OpAccessChain %57 %55 %129 + %131 = OpLoad %18 %130 + %132 = OpIEqual %50 %131 %19 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %50 %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %136 = OpLoad %18 %74 + %137 = OpIAdd %18 %136 %60 + OpStore %74 %137 + OpBranch %135 + %135 = OpLabel + %138 = OpAccessChain %41 %62 %35 + %139 = OpLoad %18 %138 + %140 = OpSLessThan %50 %139 %119 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %41 %62 %28 + %144 = OpLoad %18 %143 + %145 = OpAccessChain %41 %62 %35 + %146 = OpLoad %18 %145 + %147 = OpIAdd %18 %146 %82 + %148 = OpIMul %18 %147 %86 + %149 = OpIAdd %18 %144 %148 + %150 = OpAccessChain %57 %55 %149 + %151 = OpLoad %18 %150 + %152 = OpIEqual %50 %151 %19 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %50 %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %156 = OpLoad %18 %74 + %157 = OpIAdd %18 %156 %60 + OpStore %74 %157 + OpBranch %155 + %155 = OpLabel + %158 = OpLoad %18 %74 + %159 = OpIEqual %50 %158 %19 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpStore %65 %162 + OpStore %42 %19 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %18 %42 + %170 = OpSLessThan %50 %168 %169 + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpStore %171 %19 + OpBranch %172 + %172 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %18 %171 + %178 = OpSLessThan %50 %177 %169 + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %179 = OpLoad %18 %171 + %180 = OpIMul %18 %179 %82 + %181 = OpLoad %18 %42 + %182 = OpIMul %18 %181 %82 + %183 = OpIMul %18 %182 %86 + %184 = OpIAdd %18 %180 %183 + %185 = OpAccessChain %57 %55 %184 + %186 = OpLoad %18 %185 + %187 = OpIEqual %50 %186 %19 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %190 = OpLoad %18 %171 + %191 = OpIMul %18 %190 %82 + %192 = OpAccessChain %41 %62 %28 + OpStore %192 %191 + %193 = OpLoad %18 %42 + %194 = OpIMul %18 %193 %82 + %195 = OpAccessChain %41 %62 %35 + OpStore %195 %194 + OpStore %65 %66 + OpBranch %189 + %189 = OpLabel + OpBranch %175 + %175 = OpLabel + %196 = OpLoad %18 %171 + %197 = OpIAdd %18 %196 %60 + OpStore %171 %197 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %198 = OpLoad %18 %42 + %199 = OpIAdd %18 %198 %60 + OpStore %42 %199 + OpBranch %163 + %165 = OpLabel + %200 = OpAccessChain %41 %62 %28 + %201 = OpLoad %18 %200 + %202 = OpAccessChain %41 %62 %35 + %203 = OpLoad %18 %202 + %204 = OpIMul %18 %203 %86 + %205 = OpIAdd %18 %201 %204 + %206 = OpAccessChain %57 %55 %205 + OpStore %206 %60 + OpBranch %161 + %207 = OpLabel + %209 = OpLoad %18 %67 + %210 = OpLoad %18 %74 + %211 = OpSMod %18 %209 %210 + OpStore %208 %211 + %212 = OpLoad %18 %74 + %213 = OpLoad %18 %67 + %214 = OpIAdd %18 %213 %212 + OpStore %67 %214 + %215 = OpLoad %18 %208 + %216 = OpSGreaterThanEqual %50 %215 %19 + OpSelectionMerge %218 None + OpBranchConditional %216 %217 %218 + %217 = OpLabel + %219 = OpAccessChain %41 %62 %28 + %220 = OpLoad %18 %219 + %221 = OpSGreaterThan %50 %220 %19 + OpBranch %218 + %218 = OpLabel + %222 = OpPhi %50 %216 %207 %221 %217 + OpSelectionMerge %224 None + OpBranchConditional %222 %223 %224 + %223 = OpLabel + %225 = OpAccessChain %41 %62 %28 + %226 = OpLoad %18 %225 + %227 = OpISub %18 %226 %82 + %228 = OpAccessChain %41 %62 %35 + %229 = OpLoad %18 %228 + %230 = OpIMul %18 %229 %86 + %231 = OpIAdd %18 %227 %230 + %232 = OpAccessChain %57 %55 %231 + %233 = OpLoad %18 %232 + %234 = OpIEqual %50 %233 %19 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %50 %222 %218 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %238 = OpLoad %18 %208 + %239 = OpISub %18 %238 %60 + OpStore %208 %239 + %240 = OpAccessChain %41 %62 %28 + %241 = OpLoad %18 %240 + %242 = OpAccessChain %41 %62 %35 + %243 = OpLoad %18 %242 + %244 = OpIMul %18 %243 %86 + %245 = OpIAdd %18 %241 %244 + %246 = OpAccessChain %57 %55 %245 + OpStore %246 %60 + %247 = OpAccessChain %41 %62 %28 + %248 = OpLoad %18 %247 + %249 = OpISub %18 %248 %60 + %250 = OpAccessChain %41 %62 %35 + %251 = OpLoad %18 %250 + %252 = OpIMul %18 %251 %86 + %253 = OpIAdd %18 %249 %252 + %254 = OpAccessChain %57 %55 %253 + OpStore %254 %60 + %255 = OpAccessChain %41 %62 %28 + %256 = OpLoad %18 %255 + %257 = OpISub %18 %256 %82 + %258 = OpAccessChain %41 %62 %35 + %259 = OpLoad %18 %258 + %260 = OpIMul %18 %259 %86 + %261 = OpIAdd %18 %257 %260 + %262 = OpAccessChain %57 %55 %261 + OpStore %262 %60 + %263 = OpAccessChain %41 %62 %28 + %264 = OpLoad %18 %263 + %265 = OpISub %18 %264 %82 + %266 = OpAccessChain %41 %62 %28 + OpStore %266 %265 + OpBranch %237 + %237 = OpLabel + %267 = OpLoad %18 %208 + %268 = OpSGreaterThanEqual %50 %267 %19 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %271 = OpAccessChain %41 %62 %35 + %272 = OpLoad %18 %271 + %273 = OpSGreaterThan %50 %272 %19 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %50 %268 %237 %273 %269 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %277 = OpAccessChain %41 %62 %28 + %278 = OpLoad %18 %277 + %279 = OpAccessChain %41 %62 %35 + %280 = OpLoad %18 %279 + %281 = OpISub %18 %280 %82 + %282 = OpIMul %18 %281 %86 + %283 = OpIAdd %18 %278 %282 + %284 = OpAccessChain %57 %55 %283 + %285 = OpLoad %18 %284 + %286 = OpIEqual %50 %285 %19 + OpBranch %276 + %276 = OpLabel + %287 = OpPhi %50 %274 %270 %286 %275 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %290 = OpLoad %18 %208 + %291 = OpISub %18 %290 %60 + OpStore %208 %291 + %292 = OpAccessChain %41 %62 %28 + %293 = OpLoad %18 %292 + %294 = OpAccessChain %41 %62 %35 + %295 = OpLoad %18 %294 + %296 = OpIMul %18 %295 %86 + %297 = OpIAdd %18 %293 %296 + %298 = OpAccessChain %57 %55 %297 + OpStore %298 %60 + %299 = OpAccessChain %41 %62 %28 + %300 = OpLoad %18 %299 + %301 = OpAccessChain %41 %62 %35 + %302 = OpLoad %18 %301 + %303 = OpISub %18 %302 %60 + %304 = OpIMul %18 %303 %86 + %305 = OpIAdd %18 %300 %304 + %306 = OpAccessChain %57 %55 %305 + OpStore %306 %60 + %307 = OpAccessChain %41 %62 %28 + %308 = OpLoad %18 %307 + %309 = OpAccessChain %41 %62 %35 + %310 = OpLoad %18 %309 + %311 = OpISub %18 %310 %82 + %312 = OpIMul %18 %311 %86 + %313 = OpIAdd %18 %308 %312 + %314 = OpAccessChain %57 %55 %313 + OpStore %314 %60 + %315 = OpAccessChain %41 %62 %35 + %316 = OpLoad %18 %315 + %317 = OpISub %18 %316 %82 + %318 = OpAccessChain %41 %62 %35 + OpStore %318 %317 + OpBranch %289 + %289 = OpLabel + %319 = OpLoad %18 %208 + %320 = OpSGreaterThanEqual %50 %319 %19 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %41 %62 %28 + %324 = OpLoad %18 %323 + %325 = OpSLessThan %50 %324 %119 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %50 %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %41 %62 %28 + %330 = OpLoad %18 %329 + %331 = OpIAdd %18 %330 %82 + %332 = OpAccessChain %41 %62 %35 + %333 = OpLoad %18 %332 + %334 = OpIMul %18 %333 %86 + %335 = OpIAdd %18 %331 %334 + %336 = OpAccessChain %57 %55 %335 + %337 = OpLoad %18 %336 + %338 = OpIEqual %50 %337 %19 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %50 %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %342 = OpLoad %18 %208 + %343 = OpISub %18 %342 %60 + OpStore %208 %343 + %344 = OpAccessChain %41 %62 %28 + %345 = OpLoad %18 %344 + %346 = OpAccessChain %41 %62 %35 + %347 = OpLoad %18 %346 + %348 = OpIMul %18 %347 %86 + %349 = OpIAdd %18 %345 %348 + %350 = OpAccessChain %57 %55 %349 + OpStore %350 %60 + %351 = OpAccessChain %41 %62 %28 + %352 = OpLoad %18 %351 + %353 = OpIAdd %18 %352 %60 + %354 = OpAccessChain %41 %62 %35 + %355 = OpLoad %18 %354 + %356 = OpIMul %18 %355 %86 + %357 = OpIAdd %18 %353 %356 + %358 = OpAccessChain %57 %55 %357 + OpStore %358 %60 + %359 = OpAccessChain %41 %62 %28 + %360 = OpLoad %18 %359 + %361 = OpIAdd %18 %360 %82 + %362 = OpAccessChain %41 %62 %35 + %363 = OpLoad %18 %362 + %364 = OpIMul %18 %363 %86 + %365 = OpIAdd %18 %361 %364 + %366 = OpAccessChain %57 %55 %365 + OpStore %366 %60 + %367 = OpAccessChain %41 %62 %28 + %368 = OpLoad %18 %367 + %369 = OpIAdd %18 %368 %82 + %370 = OpAccessChain %41 %62 %28 + OpStore %370 %369 + OpBranch %341 + %341 = OpLabel + %371 = OpLoad %18 %208 + %372 = OpSGreaterThanEqual %50 %371 %19 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %375 = OpAccessChain %41 %62 %35 + %376 = OpLoad %18 %375 + %377 = OpSLessThan %50 %376 %119 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %50 %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %381 = OpAccessChain %41 %62 %28 + %382 = OpLoad %18 %381 + %383 = OpAccessChain %41 %62 %35 + %384 = OpLoad %18 %383 + %385 = OpIAdd %18 %384 %82 + %386 = OpIMul %18 %385 %86 + %387 = OpIAdd %18 %382 %386 + %388 = OpAccessChain %57 %55 %387 + %389 = OpLoad %18 %388 + %390 = OpIEqual %50 %389 %19 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %50 %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %394 = OpLoad %18 %208 + %395 = OpISub %18 %394 %60 + OpStore %208 %395 + %396 = OpAccessChain %41 %62 %28 + %397 = OpLoad %18 %396 + %398 = OpAccessChain %41 %62 %35 + %399 = OpLoad %18 %398 + %400 = OpIMul %18 %399 %86 + %401 = OpIAdd %18 %397 %400 + %402 = OpAccessChain %57 %55 %401 + OpStore %402 %60 + %403 = OpAccessChain %41 %62 %28 + %404 = OpLoad %18 %403 + %405 = OpAccessChain %41 %62 %35 + %406 = OpLoad %18 %405 + %407 = OpIAdd %18 %406 %60 + %408 = OpIMul %18 %407 %86 + %409 = OpIAdd %18 %404 %408 + %410 = OpAccessChain %57 %55 %409 + OpStore %410 %60 + %411 = OpAccessChain %41 %62 %28 + %412 = OpLoad %18 %411 + %413 = OpAccessChain %41 %62 %35 + %414 = OpLoad %18 %413 + %415 = OpIAdd %18 %414 %82 + %416 = OpIMul %18 %415 %86 + %417 = OpIAdd %18 %412 %416 + %418 = OpAccessChain %57 %55 %417 + OpStore %418 %60 + %419 = OpAccessChain %41 %62 %35 + %420 = OpLoad %18 %419 + %421 = OpIAdd %18 %420 %82 + %422 = OpAccessChain %41 %62 %35 + OpStore %422 %421 + OpBranch %393 + %393 = OpLabel + OpBranch %161 + %161 = OpLabel + %423 = OpAccessChain %41 %26 %35 + %424 = OpLoad %18 %423 + %425 = OpIMul %18 %424 %86 + %426 = OpAccessChain %41 %26 %28 + %427 = OpLoad %18 %426 + %428 = OpIAdd %18 %425 %427 + %429 = OpAccessChain %57 %55 %428 + %430 = OpLoad %18 %429 + %431 = OpIEqual %50 %430 %60 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %435 %437 + OpReturn + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + %439 = OpLoad %50 %65 + %976 = OpCopyObject %41 %67 + OpBranchConditional %439 %68 %70 + %70 = OpLabel + %728 = OpCopyObject %41 %171 + %977 = OpCopyObject %41 %976 + OpStore %435 %441 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 64.0 64.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 64 64 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-dead-break-and-unroll.amber b/vulkan/amber/graphicsfuzz/spv-dead-break-and-unroll.amber new file mode 100644 index 0000000..b24486f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-dead-break-and-unroll.amber @@ -0,0 +1,1316 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with a dead break and an Unroll annotation + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 442 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %435 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "pos" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %26 "ipos" + OpName %42 "i" + OpName %55 "map" + OpName %62 "p" + OpName %65 "canwalk" + OpName %67 "v" + OpName %74 "directions" + OpName %171 "j" + OpName %208 "d" + OpName %435 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %435 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %24 = OpTypeVector %18 2 + %25 = OpTypePointer Function %24 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %29 = OpTypePointer Function %6 + %32 = OpConstant %6 16 + %35 = OpConstant %27 1 + %41 = OpTypePointer Function %18 + %49 = OpConstant %18 256 + %50 = OpTypeBool + %52 = OpConstant %27 256 + %53 = OpTypeArray %18 %52 + %54 = OpTypePointer Private %53 + %55 = OpVariable %54 Private + %57 = OpTypePointer Private %18 + %60 = OpConstant %18 1 + %63 = OpConstantComposite %24 %19 %19 + %64 = OpTypePointer Function %50 + %66 = OpConstantTrue %50 + %82 = OpConstant %18 2 + %86 = OpConstant %18 16 + %119 = OpConstant %18 14 + %162 = OpConstantFalse %50 + %169 = OpConstant %18 8 + %434 = OpTypePointer Output %10 + %435 = OpVariable %434 Output + %436 = OpConstant %6 1 + %437 = OpConstantComposite %10 %436 %436 %436 %436 + %440 = OpConstant %6 0 + %441 = OpConstantComposite %10 %440 %440 %440 %436 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %26 = OpVariable %25 Function + %42 = OpVariable %41 Function + %62 = OpVariable %25 Function + %65 = OpVariable %64 Function + %67 = OpVariable %41 Function + %74 = OpVariable %41 Function + %171 = OpVariable %41 Function + %208 = OpVariable %41 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + OpStore %9 %23 + %30 = OpAccessChain %29 %9 %28 + %31 = OpLoad %6 %30 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %36 = OpAccessChain %29 %9 %35 + %37 = OpLoad %6 %36 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %40 = OpCompositeConstruct %24 %34 %39 + OpStore %26 %40 + OpStore %42 %19 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %18 %42 + %51 = OpSLessThan %50 %48 %49 + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %56 = OpLoad %18 %42 + %58 = OpAccessChain %57 %55 %56 + OpStore %58 %19 + OpBranch %46 + %46 = OpLabel + %59 = OpLoad %18 %42 + %61 = OpIAdd %18 %59 %60 + OpStore %42 %61 + OpBranch %43 + %45 = OpLabel + OpStore %62 %63 + OpStore %65 %66 + OpStore %67 %19 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %72 = OpLoad %18 %67 + %73 = OpIAdd %18 %72 %60 + OpStore %67 %73 + OpStore %74 %19 + %75 = OpAccessChain %41 %62 %28 + %76 = OpLoad %18 %75 + %77 = OpSGreaterThan %50 %76 %19 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %41 %62 %28 + %81 = OpLoad %18 %80 + %83 = OpISub %18 %81 %82 + %84 = OpAccessChain %41 %62 %35 + %85 = OpLoad %18 %84 + %87 = OpIMul %18 %85 %86 + %88 = OpIAdd %18 %83 %87 + %89 = OpAccessChain %57 %55 %88 + %90 = OpLoad %18 %89 + %91 = OpIEqual %50 %90 %19 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %50 %77 %69 %91 %78 + OpSelectionMerge %94 None + OpBranchConditional %92 %93 %94 + %93 = OpLabel + %95 = OpLoad %18 %74 + %96 = OpIAdd %18 %95 %60 + OpStore %74 %96 + OpBranch %94 + %94 = OpLabel + %97 = OpAccessChain %41 %62 %35 + %98 = OpLoad %18 %97 + %99 = OpSGreaterThan %50 %98 %19 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %102 = OpAccessChain %41 %62 %28 + %103 = OpLoad %18 %102 + %104 = OpAccessChain %41 %62 %35 + %105 = OpLoad %18 %104 + %106 = OpISub %18 %105 %82 + %107 = OpIMul %18 %106 %86 + %108 = OpIAdd %18 %103 %107 + %109 = OpAccessChain %57 %55 %108 + %110 = OpLoad %18 %109 + %111 = OpIEqual %50 %110 %19 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %50 %99 %94 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %115 = OpLoad %18 %74 + %116 = OpIAdd %18 %115 %60 + OpStore %74 %116 + OpBranch %114 + %114 = OpLabel + %117 = OpAccessChain %41 %62 %28 + %118 = OpLoad %18 %117 + %120 = OpSLessThan %50 %118 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %41 %62 %28 + %124 = OpLoad %18 %123 + %125 = OpIAdd %18 %124 %82 + %126 = OpAccessChain %41 %62 %35 + %127 = OpLoad %18 %126 + %128 = OpIMul %18 %127 %86 + %129 = OpIAdd %18 %125 %128 + %130 = OpAccessChain %57 %55 %129 + %131 = OpLoad %18 %130 + %132 = OpIEqual %50 %131 %19 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %50 %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %136 = OpLoad %18 %74 + %137 = OpIAdd %18 %136 %60 + OpStore %74 %137 + OpBranch %135 + %135 = OpLabel + %138 = OpAccessChain %41 %62 %35 + %139 = OpLoad %18 %138 + %140 = OpSLessThan %50 %139 %119 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %41 %62 %28 + %144 = OpLoad %18 %143 + %145 = OpAccessChain %41 %62 %35 + %146 = OpLoad %18 %145 + %147 = OpIAdd %18 %146 %82 + %148 = OpIMul %18 %147 %86 + %149 = OpIAdd %18 %144 %148 + %150 = OpAccessChain %57 %55 %149 + %151 = OpLoad %18 %150 + %152 = OpIEqual %50 %151 %19 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %50 %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %156 = OpLoad %18 %74 + %157 = OpIAdd %18 %156 %60 + OpStore %74 %157 + OpBranch %155 + %155 = OpLabel + %158 = OpLoad %18 %74 + %159 = OpIEqual %50 %158 %19 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpStore %65 %162 + OpStore %42 %19 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %18 %42 + %170 = OpSLessThan %50 %168 %169 + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpStore %171 %19 + OpBranch %172 + %172 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %18 %171 + %178 = OpSLessThan %50 %177 %169 + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %179 = OpLoad %18 %171 + %180 = OpIMul %18 %179 %82 + %181 = OpLoad %18 %42 + %182 = OpIMul %18 %181 %82 + %183 = OpIMul %18 %182 %86 + %184 = OpIAdd %18 %180 %183 + %185 = OpAccessChain %57 %55 %184 + %186 = OpLoad %18 %185 + %187 = OpIEqual %50 %186 %19 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %190 = OpLoad %18 %171 + %191 = OpIMul %18 %190 %82 + %192 = OpAccessChain %41 %62 %28 + OpStore %192 %191 + %193 = OpLoad %18 %42 + %194 = OpIMul %18 %193 %82 + %195 = OpAccessChain %41 %62 %35 + OpStore %195 %194 + OpStore %65 %66 + OpBranch %189 + %189 = OpLabel + OpBranch %175 + %175 = OpLabel + %196 = OpLoad %18 %171 + %197 = OpIAdd %18 %196 %60 + OpStore %171 %197 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %198 = OpLoad %18 %42 + %199 = OpIAdd %18 %198 %60 + OpStore %42 %199 + OpBranch %163 + %165 = OpLabel + %200 = OpAccessChain %41 %62 %28 + %201 = OpLoad %18 %200 + %202 = OpAccessChain %41 %62 %35 + %203 = OpLoad %18 %202 + %204 = OpIMul %18 %203 %86 + %205 = OpIAdd %18 %201 %204 + %206 = OpAccessChain %57 %55 %205 + OpStore %206 %60 + OpBranch %161 + %207 = OpLabel + %209 = OpLoad %18 %67 + %210 = OpLoad %18 %74 + %211 = OpSMod %18 %209 %210 + OpStore %208 %211 + %212 = OpLoad %18 %74 + %213 = OpLoad %18 %67 + %214 = OpIAdd %18 %213 %212 + OpStore %67 %214 + %215 = OpLoad %18 %208 + %216 = OpSGreaterThanEqual %50 %215 %19 + OpSelectionMerge %218 None + OpBranchConditional %216 %217 %218 + %217 = OpLabel + %219 = OpAccessChain %41 %62 %28 + %220 = OpLoad %18 %219 + %221 = OpSGreaterThan %50 %220 %19 + OpBranch %218 + %218 = OpLabel + %222 = OpPhi %50 %216 %207 %221 %217 + OpSelectionMerge %224 None + OpBranchConditional %222 %223 %224 + %223 = OpLabel + %225 = OpAccessChain %41 %62 %28 + %226 = OpLoad %18 %225 + %227 = OpISub %18 %226 %82 + %228 = OpAccessChain %41 %62 %35 + %229 = OpLoad %18 %228 + %230 = OpIMul %18 %229 %86 + %231 = OpIAdd %18 %227 %230 + %232 = OpAccessChain %57 %55 %231 + %233 = OpLoad %18 %232 + %234 = OpIEqual %50 %233 %19 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %50 %222 %218 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %238 = OpLoad %18 %208 + %239 = OpISub %18 %238 %60 + OpStore %208 %239 + %240 = OpAccessChain %41 %62 %28 + %241 = OpLoad %18 %240 + %242 = OpAccessChain %41 %62 %35 + %243 = OpLoad %18 %242 + %244 = OpIMul %18 %243 %86 + %245 = OpIAdd %18 %241 %244 + %246 = OpAccessChain %57 %55 %245 + OpStore %246 %60 + %247 = OpAccessChain %41 %62 %28 + %248 = OpLoad %18 %247 + %249 = OpISub %18 %248 %60 + %250 = OpAccessChain %41 %62 %35 + %251 = OpLoad %18 %250 + %252 = OpIMul %18 %251 %86 + %253 = OpIAdd %18 %249 %252 + %254 = OpAccessChain %57 %55 %253 + OpStore %254 %60 + %255 = OpAccessChain %41 %62 %28 + %256 = OpLoad %18 %255 + %257 = OpISub %18 %256 %82 + %258 = OpAccessChain %41 %62 %35 + %259 = OpLoad %18 %258 + %260 = OpIMul %18 %259 %86 + %261 = OpIAdd %18 %257 %260 + %262 = OpAccessChain %57 %55 %261 + OpStore %262 %60 + %263 = OpAccessChain %41 %62 %28 + %264 = OpLoad %18 %263 + %265 = OpISub %18 %264 %82 + %266 = OpAccessChain %41 %62 %28 + OpStore %266 %265 + OpBranch %237 + %237 = OpLabel + %267 = OpLoad %18 %208 + %268 = OpSGreaterThanEqual %50 %267 %19 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %271 = OpAccessChain %41 %62 %35 + %272 = OpLoad %18 %271 + %273 = OpSGreaterThan %50 %272 %19 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %50 %268 %237 %273 %269 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %277 = OpAccessChain %41 %62 %28 + %278 = OpLoad %18 %277 + %279 = OpAccessChain %41 %62 %35 + %280 = OpLoad %18 %279 + %281 = OpISub %18 %280 %82 + %282 = OpIMul %18 %281 %86 + %283 = OpIAdd %18 %278 %282 + %284 = OpAccessChain %57 %55 %283 + %285 = OpLoad %18 %284 + %286 = OpIEqual %50 %285 %19 + OpBranch %276 + %276 = OpLabel + %287 = OpPhi %50 %274 %270 %286 %275 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %290 = OpLoad %18 %208 + %291 = OpISub %18 %290 %60 + OpStore %208 %291 + %292 = OpAccessChain %41 %62 %28 + %293 = OpLoad %18 %292 + %294 = OpAccessChain %41 %62 %35 + %295 = OpLoad %18 %294 + %296 = OpIMul %18 %295 %86 + %297 = OpIAdd %18 %293 %296 + %298 = OpAccessChain %57 %55 %297 + OpStore %298 %60 + %299 = OpAccessChain %41 %62 %28 + %300 = OpLoad %18 %299 + %301 = OpAccessChain %41 %62 %35 + %302 = OpLoad %18 %301 + %303 = OpISub %18 %302 %60 + %304 = OpIMul %18 %303 %86 + %305 = OpIAdd %18 %300 %304 + %306 = OpAccessChain %57 %55 %305 + OpStore %306 %60 + %307 = OpAccessChain %41 %62 %28 + %308 = OpLoad %18 %307 + %309 = OpAccessChain %41 %62 %35 + %310 = OpLoad %18 %309 + %311 = OpISub %18 %310 %82 + %312 = OpIMul %18 %311 %86 + %313 = OpIAdd %18 %308 %312 + %314 = OpAccessChain %57 %55 %313 + OpStore %314 %60 + %315 = OpAccessChain %41 %62 %35 + %316 = OpLoad %18 %315 + %317 = OpISub %18 %316 %82 + %318 = OpAccessChain %41 %62 %35 + OpStore %318 %317 + OpBranch %289 + %289 = OpLabel + %319 = OpLoad %18 %208 + %320 = OpSGreaterThanEqual %50 %319 %19 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %41 %62 %28 + %324 = OpLoad %18 %323 + %325 = OpSLessThan %50 %324 %119 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %50 %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %41 %62 %28 + %330 = OpLoad %18 %329 + %331 = OpIAdd %18 %330 %82 + %332 = OpAccessChain %41 %62 %35 + %333 = OpLoad %18 %332 + %334 = OpIMul %18 %333 %86 + %335 = OpIAdd %18 %331 %334 + %336 = OpAccessChain %57 %55 %335 + %337 = OpLoad %18 %336 + %338 = OpIEqual %50 %337 %19 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %50 %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %342 = OpLoad %18 %208 + %343 = OpISub %18 %342 %60 + OpStore %208 %343 + %344 = OpAccessChain %41 %62 %28 + %345 = OpLoad %18 %344 + %346 = OpAccessChain %41 %62 %35 + %347 = OpLoad %18 %346 + %348 = OpIMul %18 %347 %86 + %349 = OpIAdd %18 %345 %348 + %350 = OpAccessChain %57 %55 %349 + OpStore %350 %60 + %351 = OpAccessChain %41 %62 %28 + %352 = OpLoad %18 %351 + %353 = OpIAdd %18 %352 %60 + %354 = OpAccessChain %41 %62 %35 + %355 = OpLoad %18 %354 + %356 = OpIMul %18 %355 %86 + %357 = OpIAdd %18 %353 %356 + %358 = OpAccessChain %57 %55 %357 + OpStore %358 %60 + %359 = OpAccessChain %41 %62 %28 + %360 = OpLoad %18 %359 + %361 = OpIAdd %18 %360 %82 + %362 = OpAccessChain %41 %62 %35 + %363 = OpLoad %18 %362 + %364 = OpIMul %18 %363 %86 + %365 = OpIAdd %18 %361 %364 + %366 = OpAccessChain %57 %55 %365 + OpStore %366 %60 + %367 = OpAccessChain %41 %62 %28 + %368 = OpLoad %18 %367 + %369 = OpIAdd %18 %368 %82 + %370 = OpAccessChain %41 %62 %28 + OpStore %370 %369 + OpBranch %341 + %341 = OpLabel + %371 = OpLoad %18 %208 + %372 = OpSGreaterThanEqual %50 %371 %19 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %375 = OpAccessChain %41 %62 %35 + %376 = OpLoad %18 %375 + %377 = OpSLessThan %50 %376 %119 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %50 %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %381 = OpAccessChain %41 %62 %28 + %382 = OpLoad %18 %381 + %383 = OpAccessChain %41 %62 %35 + %384 = OpLoad %18 %383 + %385 = OpIAdd %18 %384 %82 + %386 = OpIMul %18 %385 %86 + %387 = OpIAdd %18 %382 %386 + %388 = OpAccessChain %57 %55 %387 + %389 = OpLoad %18 %388 + %390 = OpIEqual %50 %389 %19 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %50 %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %394 = OpLoad %18 %208 + %395 = OpISub %18 %394 %60 + OpStore %208 %395 + %396 = OpAccessChain %41 %62 %28 + %397 = OpLoad %18 %396 + %398 = OpAccessChain %41 %62 %35 + %399 = OpLoad %18 %398 + %400 = OpIMul %18 %399 %86 + %401 = OpIAdd %18 %397 %400 + %402 = OpAccessChain %57 %55 %401 + OpStore %402 %60 + %403 = OpAccessChain %41 %62 %28 + %404 = OpLoad %18 %403 + %405 = OpAccessChain %41 %62 %35 + %406 = OpLoad %18 %405 + %407 = OpIAdd %18 %406 %60 + %408 = OpIMul %18 %407 %86 + %409 = OpIAdd %18 %404 %408 + %410 = OpAccessChain %57 %55 %409 + OpStore %410 %60 + %411 = OpAccessChain %41 %62 %28 + %412 = OpLoad %18 %411 + %413 = OpAccessChain %41 %62 %35 + %414 = OpLoad %18 %413 + %415 = OpIAdd %18 %414 %82 + %416 = OpIMul %18 %415 %86 + %417 = OpIAdd %18 %412 %416 + %418 = OpAccessChain %57 %55 %417 + OpStore %418 %60 + %419 = OpAccessChain %41 %62 %35 + %420 = OpLoad %18 %419 + %421 = OpIAdd %18 %420 %82 + %422 = OpAccessChain %41 %62 %35 + OpStore %422 %421 + OpBranch %393 + %393 = OpLabel + OpBranch %161 + %161 = OpLabel + %423 = OpAccessChain %41 %26 %35 + %424 = OpLoad %18 %423 + %425 = OpIMul %18 %424 %86 + %426 = OpAccessChain %41 %26 %28 + %427 = OpLoad %18 %426 + %428 = OpIAdd %18 %425 %427 + %429 = OpAccessChain %57 %55 %428 + %430 = OpLoad %18 %429 + %431 = OpIEqual %50 %430 %60 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %435 %437 + OpReturn + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + %439 = OpLoad %50 %65 + OpBranchConditional %439 %68 %70 + %70 = OpLabel + OpStore %435 %441 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 64.0 64.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 64 64 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 761 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %435 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "pos" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %26 "ipos" + OpName %42 "i" + OpName %55 "map" + OpName %62 "p" + OpName %65 "canwalk" + OpName %67 "v" + OpName %74 "directions" + OpName %171 "j" + OpName %208 "d" + OpName %435 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %435 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %24 = OpTypeVector %18 2 + %25 = OpTypePointer Function %24 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %29 = OpTypePointer Function %6 + %32 = OpConstant %6 16 + %35 = OpConstant %27 1 + %41 = OpTypePointer Function %18 + %49 = OpConstant %18 256 + %50 = OpTypeBool + %52 = OpConstant %27 256 + %53 = OpTypeArray %18 %52 + %54 = OpTypePointer Private %53 + %55 = OpVariable %54 Private + %57 = OpTypePointer Private %18 + %60 = OpConstant %18 1 + %63 = OpConstantComposite %24 %19 %19 + %64 = OpTypePointer Function %50 + %66 = OpConstantTrue %50 + %82 = OpConstant %18 2 + %86 = OpConstant %18 16 + %119 = OpConstant %18 14 + %162 = OpConstantFalse %50 + %169 = OpConstant %18 8 + %434 = OpTypePointer Output %10 + %435 = OpVariable %434 Output + %436 = OpConstant %6 1 + %437 = OpConstantComposite %10 %436 %436 %436 %436 + %440 = OpConstant %6 0 + %441 = OpConstantComposite %10 %440 %440 %440 %436 + %551 = OpTypeMatrix %10 2 + %555 = OpTypePointer Private %551 + %556 = OpConstantComposite %10 %440 %440 %440 %440 + %557 = OpConstantComposite %551 %556 %556 + %558 = OpVariable %555 Private %557 + %760 = OpConstantNull %50 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %26 = OpVariable %25 Function + %42 = OpVariable %41 Function + %62 = OpVariable %25 Function + %65 = OpVariable %64 Function + %67 = OpVariable %41 Function + %74 = OpVariable %41 Function + %171 = OpVariable %41 Function + %208 = OpVariable %41 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %564 = OpISub %18 %49 %119 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %566 = OpSNegate %18 %564 + %23 = OpFDiv %7 %14 %22 + OpStore %9 %23 + %30 = OpAccessChain %29 %9 %28 + %31 = OpLoad %6 %30 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %36 = OpAccessChain %29 %9 %35 + %37 = OpLoad %6 %36 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %40 = OpCompositeConstruct %24 %34 %39 + OpStore %26 %40 + OpStore %42 %19 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %18 %42 + %51 = OpSLessThan %50 %48 %49 + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %56 = OpLoad %18 %42 + %58 = OpAccessChain %57 %55 %56 + OpStore %58 %19 + OpBranch %46 + %46 = OpLabel + %59 = OpLoad %18 %42 + %61 = OpIAdd %18 %59 %60 + OpStore %42 %61 + OpBranch %43 + %45 = OpLabel + OpStore %62 %63 + OpStore %65 %66 + OpStore %67 %19 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %72 = OpLoad %18 %67 + %73 = OpIAdd %18 %72 %60 + OpStore %67 %73 + OpStore %74 %19 + %75 = OpAccessChain %41 %62 %28 + %76 = OpLoad %18 %75 + %77 = OpSGreaterThan %50 %76 %19 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %41 %62 %28 + %81 = OpLoad %18 %80 + %83 = OpISub %18 %81 %82 + %84 = OpAccessChain %41 %62 %35 + %85 = OpLoad %18 %84 + %87 = OpIMul %18 %85 %86 + %88 = OpIAdd %18 %83 %87 + %89 = OpAccessChain %57 %55 %88 + %90 = OpLoad %18 %89 + %91 = OpIEqual %50 %90 %19 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %50 %77 %69 %91 %78 + OpSelectionMerge %94 None + OpBranchConditional %92 %93 %94 + %93 = OpLabel + %95 = OpLoad %18 %74 + %96 = OpIAdd %18 %95 %60 + OpStore %74 %96 + OpBranch %94 + %94 = OpLabel + %97 = OpAccessChain %41 %62 %35 + %98 = OpLoad %18 %97 + %99 = OpSGreaterThan %50 %98 %19 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %102 = OpAccessChain %41 %62 %28 + %103 = OpLoad %18 %102 + %104 = OpAccessChain %41 %62 %35 + %105 = OpLoad %18 %104 + %106 = OpISub %18 %105 %82 + %107 = OpIMul %18 %106 %86 + %108 = OpIAdd %18 %103 %107 + %109 = OpAccessChain %57 %55 %108 + %110 = OpLoad %18 %109 + %111 = OpIEqual %50 %110 %19 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %50 %99 %94 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %115 = OpLoad %18 %74 + %116 = OpIAdd %18 %115 %60 + OpStore %74 %116 + OpBranch %114 + %114 = OpLabel + %117 = OpAccessChain %41 %62 %28 + %118 = OpLoad %18 %117 + %120 = OpSLessThan %50 %118 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %41 %62 %28 + %124 = OpLoad %18 %123 + %125 = OpIAdd %18 %124 %82 + %126 = OpAccessChain %41 %62 %35 + %127 = OpLoad %18 %126 + %128 = OpIMul %18 %127 %86 + %129 = OpIAdd %18 %125 %128 + %130 = OpAccessChain %57 %55 %129 + %131 = OpLoad %18 %130 + %132 = OpIEqual %50 %131 %19 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %50 %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %136 = OpLoad %18 %74 + %137 = OpIAdd %18 %136 %60 + OpStore %74 %137 + OpBranch %135 + %135 = OpLabel + %594 = OpISub %18 %49 %566 + %138 = OpAccessChain %41 %62 %35 + %139 = OpLoad %18 %138 + %140 = OpSLessThan %50 %139 %119 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %41 %62 %28 + %144 = OpLoad %18 %143 + %145 = OpAccessChain %41 %62 %35 + %146 = OpLoad %18 %145 + %147 = OpIAdd %18 %146 %82 + %148 = OpIMul %18 %147 %86 + %149 = OpIAdd %18 %144 %148 + %150 = OpAccessChain %57 %55 %149 + %151 = OpLoad %18 %150 + %152 = OpIEqual %50 %151 %19 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %50 %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %156 = OpLoad %18 %74 + %157 = OpIAdd %18 %156 %60 + OpStore %74 %157 + OpBranch %155 + %155 = OpLabel + %158 = OpLoad %18 %74 + %159 = OpIEqual %50 %158 %19 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpStore %65 %162 + OpStore %42 %19 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %18 %42 + %170 = OpSLessThan %50 %168 %169 + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpStore %171 %19 + %609 = OpISub %18 %594 %168 + OpStore %558 %557 + OpBranchConditional %760 %166 %172 + %172 = OpLabel + OpLoopMerge %174 %175 Unroll + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %18 %171 + %178 = OpSLessThan %50 %177 %169 + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %179 = OpLoad %18 %171 + %180 = OpIMul %18 %179 %82 + %181 = OpLoad %18 %42 + %182 = OpIMul %18 %181 %82 + %183 = OpIMul %18 %182 %86 + %184 = OpIAdd %18 %180 %183 + %185 = OpAccessChain %57 %55 %184 + %186 = OpLoad %18 %185 + %187 = OpIEqual %50 %186 %19 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %190 = OpLoad %18 %171 + %191 = OpIMul %18 %190 %82 + %192 = OpAccessChain %41 %62 %28 + OpStore %192 %191 + %193 = OpLoad %18 %42 + %194 = OpIMul %18 %193 %82 + %195 = OpAccessChain %41 %62 %35 + OpStore %195 %194 + OpStore %65 %66 + OpBranch %189 + %189 = OpLabel + OpBranch %175 + %175 = OpLabel + %196 = OpLoad %18 %171 + %197 = OpIAdd %18 %196 %60 + OpStore %171 %197 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %198 = OpLoad %18 %42 + %199 = OpIAdd %18 %198 %60 + OpStore %42 %199 + OpBranch %163 + %165 = OpLabel + %200 = OpAccessChain %41 %62 %28 + %201 = OpLoad %18 %200 + %202 = OpAccessChain %41 %62 %35 + %203 = OpLoad %18 %202 + %204 = OpIMul %18 %203 %86 + %205 = OpIAdd %18 %201 %204 + %206 = OpAccessChain %57 %55 %205 + OpStore %206 %60 + OpBranch %161 + %207 = OpLabel + %209 = OpLoad %18 %67 + %210 = OpLoad %18 %74 + %211 = OpSMod %18 %209 %210 + OpStore %208 %211 + %212 = OpLoad %18 %74 + %213 = OpLoad %18 %67 + %214 = OpIAdd %18 %213 %212 + OpStore %67 %214 + %215 = OpLoad %18 %208 + %216 = OpSGreaterThanEqual %50 %215 %19 + OpSelectionMerge %218 None + OpBranchConditional %216 %217 %218 + %217 = OpLabel + %219 = OpAccessChain %41 %62 %28 + %220 = OpLoad %18 %219 + %221 = OpSGreaterThan %50 %220 %19 + OpBranch %218 + %218 = OpLabel + %222 = OpPhi %50 %216 %207 %221 %217 + OpSelectionMerge %224 None + OpBranchConditional %222 %223 %224 + %223 = OpLabel + %225 = OpAccessChain %41 %62 %28 + %226 = OpLoad %18 %225 + %227 = OpISub %18 %226 %82 + %228 = OpAccessChain %41 %62 %35 + %229 = OpLoad %18 %228 + %230 = OpIMul %18 %229 %86 + %231 = OpIAdd %18 %227 %230 + %232 = OpAccessChain %57 %55 %231 + %233 = OpLoad %18 %232 + %234 = OpIEqual %50 %233 %19 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %50 %222 %218 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %238 = OpLoad %18 %208 + %239 = OpISub %18 %238 %60 + OpStore %208 %239 + %240 = OpAccessChain %41 %62 %28 + %241 = OpLoad %18 %240 + %242 = OpAccessChain %41 %62 %35 + %243 = OpLoad %18 %242 + %244 = OpIMul %18 %243 %86 + %245 = OpIAdd %18 %241 %244 + %246 = OpAccessChain %57 %55 %245 + OpStore %246 %60 + %247 = OpAccessChain %41 %62 %28 + %248 = OpLoad %18 %247 + %249 = OpISub %18 %248 %60 + %250 = OpAccessChain %41 %62 %35 + %251 = OpLoad %18 %250 + %252 = OpIMul %18 %251 %86 + %253 = OpIAdd %18 %249 %252 + %254 = OpAccessChain %57 %55 %253 + OpStore %254 %60 + %255 = OpAccessChain %41 %62 %28 + %256 = OpLoad %18 %255 + %257 = OpISub %18 %256 %82 + %258 = OpAccessChain %41 %62 %35 + %259 = OpLoad %18 %258 + %260 = OpIMul %18 %259 %86 + %261 = OpIAdd %18 %257 %260 + %262 = OpAccessChain %57 %55 %261 + OpStore %262 %60 + %263 = OpAccessChain %41 %62 %28 + %264 = OpLoad %18 %263 + %265 = OpISub %18 %264 %82 + %266 = OpAccessChain %41 %62 %28 + OpStore %266 %265 + OpBranch %237 + %237 = OpLabel + %267 = OpLoad %18 %208 + %268 = OpSGreaterThanEqual %50 %267 %19 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %271 = OpAccessChain %41 %62 %35 + %272 = OpLoad %18 %271 + %273 = OpSGreaterThan %50 %272 %19 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %50 %268 %237 %273 %269 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %277 = OpAccessChain %41 %62 %28 + %278 = OpLoad %18 %277 + %279 = OpAccessChain %41 %62 %35 + %280 = OpLoad %18 %279 + %281 = OpISub %18 %280 %82 + %282 = OpIMul %18 %281 %86 + %283 = OpIAdd %18 %278 %282 + %284 = OpAccessChain %57 %55 %283 + %285 = OpLoad %18 %284 + %286 = OpIEqual %50 %285 %19 + OpBranch %276 + %276 = OpLabel + %287 = OpPhi %50 %274 %270 %286 %275 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %290 = OpLoad %18 %208 + %291 = OpISub %18 %290 %60 + OpStore %208 %291 + %292 = OpAccessChain %41 %62 %28 + %293 = OpLoad %18 %292 + %294 = OpAccessChain %41 %62 %35 + %295 = OpLoad %18 %294 + %296 = OpIMul %18 %295 %86 + %297 = OpIAdd %18 %293 %296 + %298 = OpAccessChain %57 %55 %297 + OpStore %298 %60 + %299 = OpAccessChain %41 %62 %28 + %300 = OpLoad %18 %299 + %301 = OpAccessChain %41 %62 %35 + %302 = OpLoad %18 %301 + %303 = OpISub %18 %302 %60 + %304 = OpIMul %18 %303 %86 + %305 = OpIAdd %18 %300 %304 + %306 = OpAccessChain %57 %55 %305 + OpStore %306 %60 + %307 = OpAccessChain %41 %62 %28 + %308 = OpLoad %18 %307 + %309 = OpAccessChain %41 %62 %35 + %310 = OpLoad %18 %309 + %311 = OpISub %18 %310 %82 + %312 = OpIMul %18 %311 %86 + %313 = OpIAdd %18 %308 %312 + %314 = OpAccessChain %57 %55 %313 + OpStore %314 %60 + %315 = OpAccessChain %41 %62 %35 + %316 = OpLoad %18 %315 + %317 = OpISub %18 %316 %82 + %318 = OpAccessChain %41 %62 %35 + OpStore %318 %317 + OpBranch %289 + %289 = OpLabel + %319 = OpLoad %18 %208 + %320 = OpSGreaterThanEqual %50 %319 %19 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %41 %62 %28 + %324 = OpLoad %18 %323 + %325 = OpSLessThan %50 %324 %119 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %50 %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %41 %62 %28 + %330 = OpLoad %18 %329 + %331 = OpIAdd %18 %330 %82 + %332 = OpAccessChain %41 %62 %35 + %333 = OpLoad %18 %332 + %334 = OpIMul %18 %333 %86 + %335 = OpIAdd %18 %331 %334 + %336 = OpAccessChain %57 %55 %335 + %337 = OpLoad %18 %336 + %338 = OpIEqual %50 %337 %19 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %50 %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %342 = OpLoad %18 %208 + %343 = OpISub %18 %342 %60 + OpStore %208 %343 + %344 = OpAccessChain %41 %62 %28 + %345 = OpLoad %18 %344 + %346 = OpAccessChain %41 %62 %35 + %347 = OpLoad %18 %346 + %348 = OpIMul %18 %347 %86 + %349 = OpIAdd %18 %345 %348 + %350 = OpAccessChain %57 %55 %349 + OpStore %350 %60 + %351 = OpAccessChain %41 %62 %28 + %352 = OpLoad %18 %351 + %353 = OpIAdd %18 %352 %60 + %354 = OpAccessChain %41 %62 %35 + %355 = OpLoad %18 %354 + %356 = OpIMul %18 %355 %86 + %357 = OpIAdd %18 %353 %356 + %358 = OpAccessChain %57 %55 %357 + OpStore %358 %60 + %359 = OpAccessChain %41 %62 %28 + %360 = OpLoad %18 %359 + %361 = OpIAdd %18 %360 %82 + %362 = OpAccessChain %41 %62 %35 + %363 = OpLoad %18 %362 + %364 = OpIMul %18 %363 %86 + %365 = OpIAdd %18 %361 %364 + %366 = OpAccessChain %57 %55 %365 + OpStore %366 %60 + %367 = OpAccessChain %41 %62 %28 + %368 = OpLoad %18 %367 + %369 = OpIAdd %18 %368 %82 + %370 = OpAccessChain %41 %62 %28 + OpStore %370 %369 + OpBranch %341 + %341 = OpLabel + %371 = OpLoad %18 %208 + %372 = OpSGreaterThanEqual %50 %371 %19 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %375 = OpAccessChain %41 %62 %35 + %376 = OpLoad %18 %375 + %377 = OpSLessThan %50 %376 %119 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %50 %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %381 = OpAccessChain %41 %62 %28 + %382 = OpLoad %18 %381 + %383 = OpAccessChain %41 %62 %35 + %384 = OpLoad %18 %383 + %385 = OpIAdd %18 %384 %82 + %386 = OpIMul %18 %385 %86 + %387 = OpIAdd %18 %382 %386 + %388 = OpAccessChain %57 %55 %387 + %389 = OpLoad %18 %388 + %390 = OpIEqual %50 %389 %19 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %50 %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %394 = OpLoad %18 %208 + %395 = OpISub %18 %394 %60 + OpStore %208 %395 + %396 = OpAccessChain %41 %62 %28 + %397 = OpLoad %18 %396 + %398 = OpAccessChain %41 %62 %35 + %399 = OpLoad %18 %398 + %400 = OpIMul %18 %399 %86 + %401 = OpIAdd %18 %397 %400 + %402 = OpAccessChain %57 %55 %401 + OpStore %402 %60 + %403 = OpAccessChain %41 %62 %28 + %404 = OpLoad %18 %403 + %405 = OpAccessChain %41 %62 %35 + %406 = OpLoad %18 %405 + %407 = OpIAdd %18 %406 %60 + %408 = OpIMul %18 %407 %86 + %409 = OpIAdd %18 %404 %408 + %410 = OpAccessChain %57 %55 %409 + OpStore %410 %60 + %411 = OpAccessChain %41 %62 %28 + %412 = OpLoad %18 %411 + %413 = OpAccessChain %41 %62 %35 + %414 = OpLoad %18 %413 + %415 = OpIAdd %18 %414 %82 + %416 = OpIMul %18 %415 %86 + %417 = OpIAdd %18 %412 %416 + %418 = OpAccessChain %57 %55 %417 + OpStore %418 %60 + %419 = OpAccessChain %41 %62 %35 + %420 = OpLoad %18 %419 + %421 = OpIAdd %18 %420 %82 + %422 = OpAccessChain %41 %62 %35 + OpStore %422 %421 + OpBranch %393 + %393 = OpLabel + OpBranch %161 + %161 = OpLabel + %423 = OpAccessChain %41 %26 %35 + %424 = OpLoad %18 %423 + %425 = OpIMul %18 %424 %86 + %426 = OpAccessChain %41 %26 %28 + %427 = OpLoad %18 %426 + %428 = OpIAdd %18 %425 %427 + %429 = OpAccessChain %57 %55 %428 + %430 = OpLoad %18 %429 + %431 = OpIEqual %50 %430 %60 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %435 %437 + OpReturn + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + %439 = OpLoad %50 %65 + OpBranchConditional %439 %68 %70 + %70 = OpLabel + OpStore %435 %441 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 64.0 64.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 64 64 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-declare-bvec4.amber b/vulkan/amber/graphicsfuzz/spv-declare-bvec4.amber new file mode 100644 index 0000000..768dbf2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-declare-bvec4.amber @@ -0,0 +1,601 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders except one declares a bvec4 + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 189 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %165 %180 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %15 "collision(vf2;vf4;" + OpName %13 "pos" + OpName %14 "quad" + OpName %19 "match(vf2;" + OpName %18 "pos" + OpName %69 "res" + OpName %75 "i" + OpName %105 "param" + OpName %107 "param" + OpName %109 "indexable" + OpName %135 "indexable" + OpName %140 "indexable" + OpName %154 "indexable" + OpName %163 "lin" + OpName %165 "gl_FragCoord" + OpName %168 "buf0" + OpMemberName %168 0 "resolution" + OpName %170 "" + OpName %180 "_GLF_color" + OpName %181 "param" + OpName %185 "index" + OpName %188 "state" + OpDecorate %165 BuiltIn FragCoord + OpMemberDecorate %168 0 Offset 0 + OpDecorate %168 Block + OpDecorate %170 DescriptorSet 0 + OpDecorate %170 Binding 0 + OpDecorate %180 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeVector %6 4 + %10 = OpTypePointer Function %9 + %11 = OpTypeBool + %12 = OpTypeFunction %11 %8 %10 + %17 = OpTypeFunction %9 %8 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Function %6 + %31 = OpConstantFalse %11 + %33 = OpConstant %21 1 + %46 = OpConstant %21 2 + %58 = OpConstant %21 3 + %66 = OpConstantTrue %11 + %70 = OpConstant %6 0.5 + %71 = OpConstant %6 1 + %72 = OpConstantComposite %9 %70 %70 %71 %71 + %73 = OpTypeInt 32 1 + %74 = OpTypePointer Function %73 + %76 = OpConstant %73 0 + %83 = OpConstant %73 8 + %85 = OpConstant %21 8 + %86 = OpTypeArray %9 %85 + %87 = OpConstant %6 4 + %88 = OpConstant %6 20 + %89 = OpConstantComposite %9 %87 %87 %88 %87 + %90 = OpConstantComposite %9 %87 %87 %87 %88 + %91 = OpConstantComposite %9 %87 %88 %88 %87 + %92 = OpConstant %6 8 + %93 = OpConstantComposite %9 %88 %87 %87 %92 + %94 = OpConstant %6 6 + %95 = OpConstant %6 2 + %96 = OpConstantComposite %9 %92 %94 %87 %95 + %97 = OpConstant %6 12 + %98 = OpConstantComposite %9 %95 %97 %95 %87 + %99 = OpConstant %6 16 + %100 = OpConstantComposite %9 %99 %95 %87 %87 + %101 = OpConstant %6 22 + %102 = OpConstantComposite %9 %97 %101 %87 %87 + %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102 + %108 = OpTypePointer Function %86 + %115 = OpConstant %21 16 + %116 = OpTypeArray %9 %115 + %117 = OpConstant %6 0 + %118 = OpConstantComposite %9 %117 %117 %117 %71 + %119 = OpConstantComposite %9 %70 %117 %117 %71 + %120 = OpConstantComposite %9 %117 %70 %117 %71 + %121 = OpConstantComposite %9 %70 %70 %117 %71 + %122 = OpConstantComposite %9 %117 %117 %70 %71 + %123 = OpConstantComposite %9 %70 %117 %70 %71 + %124 = OpConstantComposite %9 %117 %70 %70 %71 + %125 = OpConstantComposite %9 %70 %70 %70 %71 + %126 = OpConstantComposite %9 %71 %117 %117 %71 + %127 = OpConstantComposite %9 %117 %71 %117 %71 + %128 = OpConstantComposite %9 %71 %71 %117 %71 + %129 = OpConstantComposite %9 %117 %117 %71 %71 + %130 = OpConstantComposite %9 %71 %117 %71 %71 + %131 = OpConstantComposite %9 %117 %71 %71 %71 + %132 = OpConstantComposite %9 %71 %71 %71 %71 + %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132 + %146 = OpConstant %73 9 + %149 = OpConstant %73 11 + %151 = OpConstant %73 16 + %153 = OpTypePointer Function %116 + %158 = OpConstant %73 1 + %164 = OpTypePointer Input %9 + %165 = OpVariable %164 Input + %168 = OpTypeStruct %7 + %169 = OpTypePointer Uniform %168 + %170 = OpVariable %169 Uniform + %171 = OpTypePointer Uniform %7 + %176 = OpConstant %6 32 + %179 = OpTypePointer Output %9 + %180 = OpVariable %179 Output + %184 = OpTypePointer Private %73 + %185 = OpVariable %184 Private + %186 = OpTypeArray %73 %115 + %187 = OpTypePointer Private %186 + %188 = OpVariable %187 Private + %4 = OpFunction %2 None %3 + %5 = OpLabel + %163 = OpVariable %8 Function + %181 = OpVariable %8 Function + %166 = OpLoad %9 %165 + %167 = OpVectorShuffle %7 %166 %166 0 1 + %172 = OpAccessChain %171 %170 %76 + %173 = OpLoad %7 %172 + %174 = OpFDiv %7 %167 %173 + OpStore %163 %174 + %175 = OpLoad %7 %163 + %177 = OpVectorTimesScalar %7 %175 %176 + %178 = OpExtInst %7 %1 Floor %177 + OpStore %163 %178 + %182 = OpLoad %7 %163 + OpStore %181 %182 + %183 = OpFunctionCall %9 %19 %181 + OpStore %180 %183 + OpReturn + OpFunctionEnd + %15 = OpFunction %11 None %12 + %13 = OpFunctionParameter %8 + %14 = OpFunctionParameter %10 + %16 = OpLabel + %24 = OpAccessChain %23 %13 %22 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %23 %14 %22 + %27 = OpLoad %6 %26 + %28 = OpFOrdLessThan %11 %25 %27 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %30 + %29 = OpLabel + OpReturnValue %31 + %30 = OpLabel + %34 = OpAccessChain %23 %13 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %23 %14 %33 + %37 = OpLoad %6 %36 + %38 = OpFOrdLessThan %11 %35 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + OpReturnValue %31 + %40 = OpLabel + %42 = OpAccessChain %23 %13 %22 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %23 %14 %22 + %45 = OpLoad %6 %44 + %47 = OpAccessChain %23 %14 %46 + %48 = OpLoad %6 %47 + %49 = OpFAdd %6 %45 %48 + %50 = OpFOrdGreaterThan %11 %43 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %52 + %51 = OpLabel + OpReturnValue %31 + %52 = OpLabel + %54 = OpAccessChain %23 %13 %33 + %55 = OpLoad %6 %54 + %56 = OpAccessChain %23 %14 %33 + %57 = OpLoad %6 %56 + %59 = OpAccessChain %23 %14 %58 + %60 = OpLoad %6 %59 + %61 = OpFAdd %6 %57 %60 + %62 = OpFOrdGreaterThan %11 %55 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %64 + %63 = OpLabel + OpReturnValue %31 + %64 = OpLabel + OpReturnValue %66 + OpFunctionEnd + %19 = OpFunction %9 None %17 + %18 = OpFunctionParameter %8 + %20 = OpLabel + %69 = OpVariable %10 Function + %75 = OpVariable %74 Function + %105 = OpVariable %8 Function + %107 = OpVariable %10 Function + %109 = OpVariable %108 Function + %135 = OpVariable %108 Function + %140 = OpVariable %108 Function + %154 = OpVariable %153 Function + OpStore %69 %72 + OpStore %75 %76 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %73 %75 + %84 = OpSLessThan %11 %82 %83 + OpBranchConditional %84 %78 %79 + %78 = OpLabel + %104 = OpLoad %73 %75 + %106 = OpLoad %7 %18 + OpStore %105 %106 + OpStore %109 %103 + %110 = OpAccessChain %10 %109 %104 + %111 = OpLoad %9 %110 + OpStore %107 %111 + %112 = OpFunctionCall %11 %15 %105 %107 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %134 = OpLoad %73 %75 + OpStore %135 %103 + %136 = OpAccessChain %23 %135 %134 %22 + %137 = OpLoad %6 %136 + %138 = OpConvertFToS %73 %137 + %139 = OpLoad %73 %75 + OpStore %140 %103 + %141 = OpAccessChain %23 %140 %139 %33 + %142 = OpLoad %6 %141 + %143 = OpConvertFToS %73 %142 + %144 = OpIMul %73 %138 %143 + %145 = OpLoad %73 %75 + %147 = OpIMul %73 %145 %146 + %148 = OpIAdd %73 %144 %147 + %150 = OpIAdd %73 %148 %149 + %152 = OpSMod %73 %150 %151 + OpStore %154 %133 + %155 = OpAccessChain %10 %154 %152 + %156 = OpLoad %9 %155 + OpStore %69 %156 + OpBranch %114 + %114 = OpLabel + OpBranch %80 + %80 = OpLabel + %157 = OpLoad %73 %75 + %159 = OpIAdd %73 %157 %158 + OpStore %75 %159 + OpBranch %77 + %79 = OpLabel + %160 = OpLoad %9 %69 + OpReturnValue %160 + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 366 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %165 %180 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %15 "collision(vf2;vf4;" + OpName %13 "pos" + OpName %14 "quad" + OpName %19 "match(vf2;" + OpName %18 "pos" + OpName %69 "res" + OpName %75 "i" + OpName %105 "param" + OpName %107 "param" + OpName %109 "indexable" + OpName %135 "indexable" + OpName %140 "indexable" + OpName %154 "indexable" + OpName %163 "lin" + OpName %165 "gl_FragCoord" + OpName %168 "buf0" + OpMemberName %168 0 "resolution" + OpName %170 "" + OpName %180 "_GLF_color" + OpName %181 "param" + OpName %185 "index" + OpName %188 "state" + OpDecorate %165 BuiltIn FragCoord + OpMemberDecorate %168 0 Offset 0 + OpDecorate %168 Block + OpDecorate %170 DescriptorSet 0 + OpDecorate %170 Binding 0 + OpDecorate %180 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeVector %6 4 + %10 = OpTypePointer Function %9 + %11 = OpTypeBool + %12 = OpTypeFunction %11 %8 %10 + %17 = OpTypeFunction %9 %8 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Function %6 + %31 = OpConstantFalse %11 + %33 = OpConstant %21 1 + %46 = OpConstant %21 2 + %58 = OpConstant %21 3 + %66 = OpConstantTrue %11 + %70 = OpConstant %6 0.5 + %71 = OpConstant %6 1 + %72 = OpConstantComposite %9 %70 %70 %71 %71 + %73 = OpTypeInt 32 1 + %74 = OpTypePointer Function %73 + %76 = OpConstant %73 0 + %83 = OpConstant %73 8 + %85 = OpConstant %21 8 + %86 = OpTypeArray %9 %85 + %87 = OpConstant %6 4 + %88 = OpConstant %6 20 + %89 = OpConstantComposite %9 %87 %87 %88 %87 + %90 = OpConstantComposite %9 %87 %87 %87 %88 + %91 = OpConstantComposite %9 %87 %88 %88 %87 + %92 = OpConstant %6 8 + %93 = OpConstantComposite %9 %88 %87 %87 %92 + %94 = OpConstant %6 6 + %95 = OpConstant %6 2 + %96 = OpConstantComposite %9 %92 %94 %87 %95 + %97 = OpConstant %6 12 + %98 = OpConstantComposite %9 %95 %97 %95 %87 + %99 = OpConstant %6 16 + %100 = OpConstantComposite %9 %99 %95 %87 %87 + %101 = OpConstant %6 22 + %102 = OpConstantComposite %9 %97 %101 %87 %87 + %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102 + %108 = OpTypePointer Function %86 + %115 = OpConstant %21 16 + %116 = OpTypeArray %9 %115 + %117 = OpConstant %6 0 + %118 = OpConstantComposite %9 %117 %117 %117 %71 + %119 = OpConstantComposite %9 %70 %117 %117 %71 + %120 = OpConstantComposite %9 %117 %70 %117 %71 + %121 = OpConstantComposite %9 %70 %70 %117 %71 + %122 = OpConstantComposite %9 %117 %117 %70 %71 + %123 = OpConstantComposite %9 %70 %117 %70 %71 + %124 = OpConstantComposite %9 %117 %70 %70 %71 + %125 = OpConstantComposite %9 %70 %70 %70 %71 + %126 = OpConstantComposite %9 %71 %117 %117 %71 + %127 = OpConstantComposite %9 %117 %71 %117 %71 + %128 = OpConstantComposite %9 %71 %71 %117 %71 + %129 = OpConstantComposite %9 %117 %117 %71 %71 + %130 = OpConstantComposite %9 %71 %117 %71 %71 + %131 = OpConstantComposite %9 %117 %71 %71 %71 + %132 = OpConstantComposite %9 %71 %71 %71 %71 + %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132 + %146 = OpConstant %73 9 + %149 = OpConstant %73 11 + %151 = OpConstant %73 16 + %153 = OpTypePointer Function %116 + %158 = OpConstant %73 1 + %164 = OpTypePointer Input %9 + %165 = OpVariable %164 Input + %168 = OpTypeStruct %7 + %169 = OpTypePointer Uniform %168 + %170 = OpVariable %169 Uniform + %171 = OpTypePointer Uniform %7 + %176 = OpConstant %6 32 + %179 = OpTypePointer Output %9 + %180 = OpVariable %179 Output + %184 = OpTypePointer Private %73 + %185 = OpVariable %184 Private + %186 = OpTypeArray %73 %115 + %187 = OpTypePointer Private %186 + %188 = OpVariable %187 Private + %313 = OpTypeVector %11 4 + %363 = OpTypePointer Function %313 + %364 = OpConstantComposite %313 %31 %31 %31 %31 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %163 = OpVariable %8 Function + %181 = OpVariable %8 Function + %166 = OpLoad %9 %165 + %167 = OpVectorShuffle %7 %166 %166 0 1 + %172 = OpAccessChain %171 %170 %76 + %173 = OpLoad %7 %172 + %174 = OpFDiv %7 %167 %173 + OpStore %163 %174 + %175 = OpLoad %7 %163 + %177 = OpVectorTimesScalar %7 %175 %176 + %178 = OpExtInst %7 %1 Floor %177 + OpStore %163 %178 + %182 = OpLoad %7 %163 + OpStore %181 %182 + %183 = OpFunctionCall %9 %19 %181 + OpStore %180 %183 + OpReturn + OpFunctionEnd + %15 = OpFunction %11 None %12 + %13 = OpFunctionParameter %8 + %14 = OpFunctionParameter %10 + %16 = OpLabel + %365 = OpVariable %363 Function %364 + %24 = OpAccessChain %23 %13 %22 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %23 %14 %22 + %27 = OpLoad %6 %26 + %28 = OpFOrdLessThan %11 %25 %27 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %30 + %29 = OpLabel + OpReturnValue %31 + %30 = OpLabel + %34 = OpAccessChain %23 %13 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %23 %14 %33 + %37 = OpLoad %6 %36 + %38 = OpFOrdLessThan %11 %35 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + OpReturnValue %31 + %40 = OpLabel + %42 = OpAccessChain %23 %13 %22 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %23 %14 %22 + %45 = OpLoad %6 %44 + %47 = OpAccessChain %23 %14 %46 + %48 = OpLoad %6 %47 + %49 = OpFAdd %6 %45 %48 + %50 = OpFOrdGreaterThan %11 %43 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %52 + %51 = OpLabel + OpReturnValue %31 + %52 = OpLabel + %54 = OpAccessChain %23 %13 %33 + %55 = OpLoad %6 %54 + %56 = OpAccessChain %23 %14 %33 + %57 = OpLoad %6 %56 + %59 = OpAccessChain %23 %14 %58 + %60 = OpLoad %6 %59 + %61 = OpFAdd %6 %57 %60 + %62 = OpFOrdGreaterThan %11 %55 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %64 + %63 = OpLabel + OpReturnValue %31 + %64 = OpLabel + OpReturnValue %66 + OpFunctionEnd + %19 = OpFunction %9 None %17 + %18 = OpFunctionParameter %8 + %20 = OpLabel + %69 = OpVariable %10 Function + %75 = OpVariable %74 Function + %105 = OpVariable %8 Function + %107 = OpVariable %10 Function + %109 = OpVariable %108 Function + %135 = OpVariable %108 Function + %140 = OpVariable %108 Function + %154 = OpVariable %153 Function + OpStore %69 %72 + OpStore %75 %76 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %73 %75 + %84 = OpSLessThan %11 %82 %83 + OpBranchConditional %84 %78 %79 + %78 = OpLabel + %104 = OpLoad %73 %75 + %106 = OpLoad %7 %18 + OpStore %105 %106 + OpStore %109 %103 + %110 = OpAccessChain %10 %109 %104 + %111 = OpLoad %9 %110 + OpStore %107 %111 + %112 = OpFunctionCall %11 %15 %105 %107 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %134 = OpLoad %73 %75 + OpStore %135 %103 + %136 = OpAccessChain %23 %135 %134 %22 + %137 = OpLoad %6 %136 + %138 = OpConvertFToS %73 %137 + %139 = OpLoad %73 %75 + OpStore %140 %103 + %141 = OpAccessChain %23 %140 %139 %33 + %142 = OpLoad %6 %141 + %143 = OpConvertFToS %73 %142 + %144 = OpIMul %73 %138 %143 + %145 = OpLoad %73 %75 + %147 = OpIMul %73 %145 %146 + %148 = OpIAdd %73 %144 %147 + %150 = OpIAdd %73 %148 %149 + %152 = OpSMod %73 %150 %151 + OpStore %154 %133 + %155 = OpAccessChain %10 %154 %152 + %156 = OpLoad %9 %155 + OpStore %69 %156 + OpBranch %114 + %114 = OpLabel + OpBranch %80 + %80 = OpLabel + %157 = OpLoad %73 %75 + %159 = OpIAdd %73 %157 %158 + OpStore %75 %159 + OpBranch %77 + %79 = OpLabel + %160 = OpLoad %9 %69 + OpReturnValue %160 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-double-branch-to-same-block.amber b/vulkan/amber/graphicsfuzz/spv-double-branch-to-same-block.amber new file mode 100644 index 0000000..ae1bb58 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-double-branch-to-same-block.amber @@ -0,0 +1,1231 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with more complex branching + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 381 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpName %378 "buf1" + OpMemberName %378 0 "resolution" + OpName %380 "" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + OpMemberDecorate %378 0 Offset 0 + OpDecorate %378 Block + OpDecorate %380 DescriptorSet 0 + OpDecorate %380 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %378 = OpTypeStruct %158 + %379 = OpTypePointer Uniform %378 + %380 = OpVariable %379 Uniform + %4 = OpFunction %2 None %3 + %5 = OpLabel + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + %240 = OpFunctionCall %2 %14 + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %60 + %50 = OpLabel + %53 = OpLoad %6 %16 + %54 = OpIAdd %6 %53 %22 + OpStore %16 %54 + %55 = OpLoad %6 %18 + %56 = OpIAdd %6 %55 %22 + OpStore %18 %56 + %57 = OpAccessChain %43 %41 %55 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %43 %52 %53 + OpStore %59 %58 + OpBranch %51 + %60 = OpLabel + %61 = OpLoad %6 %16 + %62 = OpIAdd %6 %61 %22 + OpStore %16 %62 + %63 = OpLoad %6 %20 + %64 = OpIAdd %6 %63 %22 + OpStore %20 %64 + %65 = OpAccessChain %43 %41 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %43 %52 %61 + OpStore %67 %66 + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# injectionSwitch +BUFFER reference_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 534 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpName %378 "buf1" + OpMemberName %378 0 "resolution" + OpName %380 "" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + OpMemberDecorate %378 0 Offset 0 + OpDecorate %378 Block + OpDecorate %380 DescriptorSet 0 + OpDecorate %380 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %378 = OpTypeStruct %158 + %379 = OpTypePointer Uniform %378 + %380 = OpVariable %379 Uniform + %533 = OpConstantTrue %31 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranchConditional %533 %182 %170 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranchConditional %533 %170 %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + %240 = OpFunctionCall %2 %14 + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %60 + %50 = OpLabel + %53 = OpLoad %6 %16 + %54 = OpIAdd %6 %53 %22 + OpStore %16 %54 + %55 = OpLoad %6 %18 + %56 = OpIAdd %6 %55 %22 + OpStore %18 %56 + %57 = OpAccessChain %43 %41 %55 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %43 %52 %53 + OpStore %59 %58 + OpBranch %51 + %60 = OpLabel + %61 = OpLoad %6 %16 + %62 = OpIAdd %6 %61 %22 + OpStore %16 %62 + %63 = OpLoad %6 %20 + %64 = OpIAdd %6 %63 %22 + OpStore %20 %64 + %65 = OpAccessChain %43 %41 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %43 %52 %61 + OpStore %67 %66 + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-double-branch-to-same-block2.amber b/vulkan/amber/graphicsfuzz/spv-double-branch-to-same-block2.amber new file mode 100644 index 0000000..84968cf --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-double-branch-to-same-block2.amber @@ -0,0 +1,452 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with more complex branching + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 197 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 %139 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %16 "gl_FragCoord" + OpName %23 "buf1" + OpMemberName %23 0 "resolution" + OpName %25 "" + OpName %61 "data" + OpName %66 "buf0" + OpMemberName %66 0 "injectionSwitch" + OpName %68 "" + OpName %139 "_GLF_color" + OpDecorate %16 BuiltIn FragCoord + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 1 + OpMemberDecorate %66 0 Offset 0 + OpDecorate %66 Block + OpDecorate %68 DescriptorSet 0 + OpDecorate %68 Binding 0 + OpDecorate %139 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeBool + %14 = OpTypeVector %6 4 + %15 = OpTypePointer Input %14 + %16 = OpVariable %15 Input + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 1 + %19 = OpTypePointer Input %6 + %22 = OpTypeVector %6 2 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpTypeInt 32 1 + %27 = OpConstant %26 0 + %28 = OpTypePointer Uniform %6 + %56 = OpConstant %26 10 + %58 = OpConstant %17 10 + %59 = OpTypeArray %6 %58 + %60 = OpTypePointer Function %59 + %66 = OpTypeStruct %22 + %67 = OpTypePointer Uniform %66 + %68 = OpVariable %67 Uniform + %74 = OpConstant %26 1 + %83 = OpConstant %26 9 + %129 = OpConstant %17 0 + %138 = OpTypePointer Output %14 + %139 = OpVariable %138 Output + %144 = OpConstant %26 5 + %151 = OpConstant %6 1 + %195 = OpConstant %6 0.5 + %196 = OpConstant %6 0.100000001 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %61 = OpVariable %60 Function + OpBranch %50 + %50 = OpLabel + %183 = OpPhi %26 %27 %5 %75 %51 + %57 = OpSLessThan %8 %183 %56 + OpLoopMerge %52 %51 None + OpBranchConditional %57 %51 %52 + %51 = OpLabel + %64 = OpISub %26 %56 %183 + %65 = OpConvertSToF %6 %64 + %69 = OpAccessChain %28 %68 %27 %18 + %70 = OpLoad %6 %69 + %71 = OpFMul %6 %65 %70 + %72 = OpAccessChain %7 %61 %183 + OpStore %72 %71 + %75 = OpIAdd %26 %183 %74 + OpBranch %50 + %52 = OpLabel + OpBranch %77 + %77 = OpLabel + %184 = OpPhi %26 %27 %52 %128 %80 + %84 = OpSLessThan %8 %184 %83 + OpLoopMerge %79 %80 None + OpBranchConditional %84 %78 %79 + %78 = OpLabel + OpBranch %86 + %86 = OpLabel + %185 = OpPhi %26 %27 %78 %126 %89 + %92 = OpSLessThan %8 %185 %56 + OpLoopMerge %88 %89 None + OpBranchConditional %92 %87 %88 + %87 = OpLabel + %95 = OpIAdd %26 %184 %74 + %96 = OpSLessThan %8 %185 %95 + OpSelectionMerge %98 None + OpBranchConditional %96 %97 %98 + %97 = OpLabel + OpBranch %89 + %98 = OpLabel + %104 = OpAccessChain %7 %61 %184 + %105 = OpLoad %6 %104 + %107 = OpAccessChain %7 %61 %185 + %108 = OpLoad %6 %107 + %167 = OpAccessChain %19 %16 %18 + %168 = OpLoad %6 %167 + %169 = OpAccessChain %28 %25 %27 %18 + %170 = OpLoad %6 %169 + %171 = OpFMul %6 %170 %195 + %172 = OpFOrdLessThan %8 %168 %171 + OpSelectionMerge %181 None + OpBranchConditional %172 %173 %177 + %173 = OpLabel + %176 = OpFOrdGreaterThan %8 %105 %108 + OpBranch %181 + %177 = OpLabel + %180 = OpFOrdLessThan %8 %105 %108 + OpBranch %181 + %181 = OpLabel + %187 = OpPhi %8 %176 %173 %180 %177 + OpSelectionMerge %112 None + OpBranchConditional %187 %111 %112 + %111 = OpLabel + %116 = OpLoad %6 %104 + %120 = OpLoad %6 %107 + OpStore %104 %120 + OpStore %107 %116 + OpBranch %112 + %112 = OpLabel + OpBranch %89 + %89 = OpLabel + %126 = OpIAdd %26 %185 %74 + OpBranch %86 + %88 = OpLabel + OpBranch %80 + %80 = OpLabel + %128 = OpIAdd %26 %184 %74 + OpBranch %77 + %79 = OpLabel + %130 = OpAccessChain %19 %16 %129 + %131 = OpLoad %6 %130 + %132 = OpAccessChain %28 %25 %27 %129 + %133 = OpLoad %6 %132 + %134 = OpFMul %6 %133 %195 + %135 = OpFOrdLessThan %8 %131 %134 + OpSelectionMerge %137 None + OpBranchConditional %135 %136 %153 + %136 = OpLabel + %140 = OpAccessChain %7 %61 %27 + %141 = OpLoad %6 %140 + %143 = OpFMul %6 %141 %196 + %145 = OpAccessChain %7 %61 %144 + %146 = OpLoad %6 %145 + %147 = OpFMul %6 %146 %196 + %148 = OpAccessChain %7 %61 %83 + %149 = OpLoad %6 %148 + %150 = OpFMul %6 %149 %196 + %152 = OpCompositeConstruct %14 %143 %147 %150 %151 + OpStore %139 %152 + OpBranch %137 + %153 = OpLabel + %154 = OpAccessChain %7 %61 %144 + %155 = OpLoad %6 %154 + %156 = OpFMul %6 %155 %196 + %157 = OpAccessChain %7 %61 %83 + %158 = OpLoad %6 %157 + %159 = OpFMul %6 %158 %196 + %160 = OpAccessChain %7 %61 %27 + %161 = OpLoad %6 %160 + %162 = OpFMul %6 %161 %196 + %163 = OpCompositeConstruct %14 %156 %159 %162 %151 + OpStore %139 %163 + OpBranch %137 + %137 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# injectionSwitch +BUFFER reference_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 304 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 %139 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %16 "gl_FragCoord" + OpName %23 "buf1" + OpMemberName %23 0 "resolution" + OpName %25 "" + OpName %61 "data" + OpName %66 "buf0" + OpMemberName %66 0 "injectionSwitch" + OpName %68 "" + OpName %139 "_GLF_color" + OpDecorate %16 BuiltIn FragCoord + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 1 + OpMemberDecorate %66 0 Offset 0 + OpDecorate %66 Block + OpDecorate %68 DescriptorSet 0 + OpDecorate %68 Binding 0 + OpDecorate %139 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeBool + %14 = OpTypeVector %6 4 + %15 = OpTypePointer Input %14 + %16 = OpVariable %15 Input + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 1 + %19 = OpTypePointer Input %6 + %22 = OpTypeVector %6 2 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpTypeInt 32 1 + %27 = OpConstant %26 0 + %28 = OpTypePointer Uniform %6 + %56 = OpConstant %26 10 + %58 = OpConstant %17 10 + %59 = OpTypeArray %6 %58 + %60 = OpTypePointer Function %59 + %66 = OpTypeStruct %22 + %67 = OpTypePointer Uniform %66 + %68 = OpVariable %67 Uniform + %74 = OpConstant %26 1 + %83 = OpConstant %26 9 + %129 = OpConstant %17 0 + %138 = OpTypePointer Output %14 + %139 = OpVariable %138 Output + %144 = OpConstant %26 5 + %151 = OpConstant %6 1 + %195 = OpConstant %6 0.5 + %196 = OpConstant %6 0.100000001 + %303 = OpConstantTrue %8 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %61 = OpVariable %60 Function + OpBranch %50 + %50 = OpLabel + %183 = OpPhi %26 %27 %5 %75 %51 + %57 = OpSLessThan %8 %183 %56 + OpLoopMerge %52 %51 None + OpBranchConditional %57 %51 %52 + %51 = OpLabel + %64 = OpISub %26 %56 %183 + %65 = OpConvertSToF %6 %64 + %69 = OpAccessChain %28 %68 %27 %18 + %70 = OpLoad %6 %69 + %71 = OpFMul %6 %65 %70 + %72 = OpAccessChain %7 %61 %183 + OpStore %72 %71 + %75 = OpIAdd %26 %183 %74 + OpBranch %50 + %52 = OpLabel + OpBranch %77 + %77 = OpLabel + %184 = OpPhi %26 %27 %52 %128 %80 + %84 = OpSLessThan %8 %184 %83 + OpLoopMerge %79 %80 None + OpBranchConditional %84 %78 %79 + %78 = OpLabel + OpBranch %86 + %86 = OpLabel + %185 = OpPhi %26 %27 %78 %126 %89 + %92 = OpSLessThan %8 %185 %56 + OpLoopMerge %88 %89 None + OpBranchConditional %92 %87 %88 + %87 = OpLabel + %95 = OpIAdd %26 %184 %74 + %96 = OpSLessThan %8 %185 %95 + OpSelectionMerge %98 None + OpBranchConditional %96 %97 %98 + %97 = OpLabel + OpBranch %89 + %98 = OpLabel + %104 = OpAccessChain %7 %61 %184 + %105 = OpLoad %6 %104 + %107 = OpAccessChain %7 %61 %185 + %108 = OpLoad %6 %107 + %167 = OpAccessChain %19 %16 %18 + %168 = OpLoad %6 %167 + %169 = OpAccessChain %28 %25 %27 %18 + %170 = OpLoad %6 %169 + %171 = OpFMul %6 %170 %195 + %172 = OpFOrdLessThan %8 %168 %171 + OpSelectionMerge %181 None + OpBranchConditional %172 %173 %177 + %173 = OpLabel + %176 = OpFOrdGreaterThan %8 %105 %108 + OpBranch %181 + %177 = OpLabel + %180 = OpFOrdLessThan %8 %105 %108 + OpBranch %181 + %181 = OpLabel + %187 = OpPhi %8 %176 %173 %180 %177 + OpSelectionMerge %112 None + OpBranchConditional %187 %111 %112 + %111 = OpLabel + %116 = OpLoad %6 %104 + %120 = OpLoad %6 %107 + OpStore %104 %120 + OpStore %107 %116 + OpBranch %112 + %112 = OpLabel + OpBranch %89 + %89 = OpLabel + %126 = OpIAdd %26 %185 %74 + OpBranch %86 + %88 = OpLabel + OpBranch %80 + %80 = OpLabel + %128 = OpIAdd %26 %184 %74 + OpBranch %77 + %79 = OpLabel + %130 = OpAccessChain %19 %16 %129 + %131 = OpLoad %6 %130 + %132 = OpAccessChain %28 %25 %27 %129 + %133 = OpLoad %6 %132 + %134 = OpFMul %6 %133 %195 + %135 = OpFOrdLessThan %8 %131 %134 + OpSelectionMerge %137 None + OpBranchConditional %135 %136 %153 + %136 = OpLabel + %140 = OpAccessChain %7 %61 %27 + %141 = OpLoad %6 %140 + %143 = OpFMul %6 %141 %196 + %145 = OpAccessChain %7 %61 %144 + %146 = OpLoad %6 %145 + %147 = OpFMul %6 %146 %196 + %148 = OpAccessChain %7 %61 %83 + %149 = OpLoad %6 %148 + %150 = OpFMul %6 %149 %196 + %152 = OpCompositeConstruct %14 %143 %147 %150 %151 + OpStore %139 %152 + OpBranch %137 + %153 = OpLabel + %154 = OpAccessChain %7 %61 %144 + %155 = OpLoad %6 %154 + %156 = OpFMul %6 %155 %196 + %157 = OpAccessChain %7 %61 %83 + %158 = OpLoad %6 %157 + %159 = OpFMul %6 %158 %196 + %160 = OpAccessChain %7 %61 %27 + %161 = OpLoad %6 %160 + %162 = OpFMul %6 %161 %196 + %163 = OpCompositeConstruct %14 %156 %159 %162 %151 + OpStore %139 %163 + OpBranchConditional %303 %137 %137 + %137 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-double-branch-to-same-block3.amber b/vulkan/amber/graphicsfuzz/spv-double-branch-to-same-block3.amber new file mode 100644 index 0000000..55cd534 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-double-branch-to-same-block3.amber @@ -0,0 +1,1235 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with more complex branching + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 381 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpName %378 "buf1" + OpMemberName %378 0 "resolution" + OpName %380 "" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + OpMemberDecorate %378 0 Offset 0 + OpDecorate %378 Block + OpDecorate %380 DescriptorSet 0 + OpDecorate %380 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %378 = OpTypeStruct %158 + %379 = OpTypePointer Uniform %378 + %380 = OpVariable %379 Uniform + %4 = OpFunction %2 None %3 + %5 = OpLabel + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + %240 = OpFunctionCall %2 %14 + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %60 + %50 = OpLabel + %53 = OpLoad %6 %16 + %54 = OpIAdd %6 %53 %22 + OpStore %16 %54 + %55 = OpLoad %6 %18 + %56 = OpIAdd %6 %55 %22 + OpStore %18 %56 + %57 = OpAccessChain %43 %41 %55 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %43 %52 %53 + OpStore %59 %58 + OpBranch %51 + %60 = OpLabel + %61 = OpLoad %6 %16 + %62 = OpIAdd %6 %61 %22 + OpStore %16 %62 + %63 = OpLoad %6 %20 + %64 = OpIAdd %6 %63 %22 + OpStore %20 %64 + %65 = OpAccessChain %43 %41 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %43 %52 %61 + OpStore %67 %66 + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# injectionSwitch +BUFFER reference_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 637 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpName %378 "buf1" + OpMemberName %378 0 "resolution" + OpName %380 "" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + OpMemberDecorate %378 0 Offset 0 + OpDecorate %378 Block + OpDecorate %380 DescriptorSet 0 + OpDecorate %380 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %378 = OpTypeStruct %158 + %379 = OpTypePointer Uniform %378 + %380 = OpVariable %379 Uniform + %526 = OpConstantTrue %31 + %595 = OpConstant %157 256 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + %240 = OpFunctionCall %2 %14 + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %60 + %50 = OpLabel + %53 = OpLoad %6 %16 + %54 = OpIAdd %6 %53 %22 + OpStore %16 %54 + %55 = OpLoad %6 %18 + %56 = OpIAdd %6 %55 %22 + OpStore %18 %56 + %57 = OpAccessChain %43 %41 %55 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %43 %52 %53 + OpStore %59 %58 + OpBranch %51 + %60 = OpLabel + %61 = OpLoad %6 %16 + %62 = OpIAdd %6 %61 %22 + OpStore %16 %62 + %63 = OpLoad %6 %20 + %64 = OpIAdd %6 %63 %22 + OpStore %20 %64 + %65 = OpAccessChain %43 %41 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %43 %52 %61 + OpStore %67 %66 + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + %636 = OpFUnordGreaterThanEqual %31 %595 %373 + OpLoopMerge %70 %71 None + OpBranchConditional %636 %72 %71 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + OpBranch %579 + %579 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranchConditional %526 %71 %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-load-from-frag-color.amber b/vulkan/amber/graphicsfuzz/spv-load-from-frag-color.amber new file mode 100644 index 0000000..2b4cec1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-load-from-frag-color.amber @@ -0,0 +1,1452 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with extra access chains and load + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 1372 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %254 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "BST" + OpMemberName %7 0 "data" + OpMemberName %7 1 "leftIndex" + OpMemberName %7 2 "rightIndex" + OpName %47 "tree" + OpName %254 "_GLF_color" + OpDecorate %254 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypePointer Function %6 + %24 = OpConstant %6 0 + %27 = OpConstant %6 1 + %28 = OpConstant %6 -1 + %30 = OpConstant %6 2 + %40 = OpTypeBool + %43 = OpTypeInt 32 0 + %44 = OpConstant %43 10 + %45 = OpTypeArray %7 %44 + %141 = OpConstant %6 9 + %151 = OpConstant %6 5 + %158 = OpConstant %6 12 + %165 = OpConstant %6 15 + %172 = OpConstant %6 7 + %179 = OpConstant %6 8 + %192 = OpConstant %6 6 + %199 = OpConstant %6 17 + %206 = OpConstant %6 13 + %219 = OpConstant %6 20 + %251 = OpTypeFloat 32 + %252 = OpTypeVector %251 4 + %253 = OpTypePointer Output %252 + %254 = OpVariable %253 Output + %255 = OpConstant %251 1 + %256 = OpConstant %251 0 + %257 = OpConstantComposite %252 %255 %256 %256 %255 + %259 = OpConstantComposite %252 %256 %256 %255 %255 + %262 = OpConstant %43 0 + %263 = OpConstantFalse %40 + %266 = OpConstantTrue %40 + %1015 = OpTypePointer Function %45 + %1318 = OpUndef %6 + %1359 = OpConstantComposite %7 %141 %28 %28 + %1360 = OpConstantComposite %7 %151 %28 %28 + %1361 = OpConstantComposite %7 %158 %28 %28 + %1362 = OpConstant %6 3 + %1363 = OpConstantComposite %7 %165 %28 %28 + %1364 = OpConstant %6 4 + %1365 = OpConstantComposite %7 %172 %28 %28 + %1366 = OpConstantComposite %7 %179 %28 %28 + %1367 = OpConstantComposite %7 %30 %28 %28 + %1368 = OpConstantComposite %7 %192 %28 %28 + %1369 = OpConstantComposite %7 %199 %28 %28 + %1370 = OpConstantComposite %7 %206 %28 %28 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %47 = OpVariable %1015 Function + %148 = OpAccessChain %8 %47 %24 + OpStore %148 %1359 + OpSelectionMerge %347 None + OpSwitch %262 %288 + %288 = OpLabel + OpBranch %289 + %289 = OpLabel + %1212 = OpPhi %6 %24 %288 %1342 %343 + %293 = OpSLessThanEqual %40 %1212 %27 + OpLoopMerge %344 %343 None + OpBranchConditional %293 %294 %344 + %294 = OpLabel + %297 = OpAccessChain %9 %47 %1212 %24 + %298 = OpLoad %6 %297 + %299 = OpSLessThanEqual %40 %151 %298 + OpSelectionMerge %342 None + OpBranchConditional %299 %321 %300 + %300 = OpLabel + %302 = OpAccessChain %9 %47 %1212 %30 + %303 = OpLoad %6 %302 + %304 = OpIEqual %40 %303 %28 + OpSelectionMerge %320 None + OpBranchConditional %304 %309 %305 + %305 = OpLabel + %308 = OpLoad %6 %302 + OpBranch %343 + %309 = OpLabel + OpStore %302 %27 + %319 = OpAccessChain %8 %47 %27 + OpStore %319 %1360 + OpBranch %344 + %320 = OpLabel + OpUnreachable + %321 = OpLabel + %323 = OpAccessChain %9 %47 %1212 %27 + %324 = OpLoad %6 %323 + %325 = OpIEqual %40 %324 %28 + OpSelectionMerge %341 None + OpBranchConditional %325 %330 %326 + %326 = OpLabel + %329 = OpLoad %6 %323 + OpBranch %343 + %330 = OpLabel + OpStore %323 %27 + %340 = OpAccessChain %8 %47 %27 + OpStore %340 %1360 + OpBranch %344 + %341 = OpLabel + OpUnreachable + %342 = OpLabel + OpUnreachable + %343 = OpLabel + %1342 = OpPhi %6 %308 %305 %329 %326 + OpBranch %289 + %344 = OpLabel + %1213 = OpPhi %40 %263 %289 %266 %309 %266 %330 + OpSelectionMerge %346 None + OpBranchConditional %1213 %347 %346 + %346 = OpLabel + OpBranch %347 + %347 = OpLabel + OpSelectionMerge %424 None + OpSwitch %262 %365 + %365 = OpLabel + OpBranch %366 + %366 = OpLabel + %1220 = OpPhi %6 %24 %365 %1344 %420 + %370 = OpSLessThanEqual %40 %1220 %30 + OpLoopMerge %421 %420 None + OpBranchConditional %370 %371 %421 + %371 = OpLabel + %374 = OpAccessChain %9 %47 %1220 %24 + %375 = OpLoad %6 %374 + %376 = OpSLessThanEqual %40 %158 %375 + OpSelectionMerge %419 None + OpBranchConditional %376 %398 %377 + %377 = OpLabel + %379 = OpAccessChain %9 %47 %1220 %30 + %380 = OpLoad %6 %379 + %381 = OpIEqual %40 %380 %28 + OpSelectionMerge %397 None + OpBranchConditional %381 %386 %382 + %382 = OpLabel + %385 = OpLoad %6 %379 + OpBranch %420 + %386 = OpLabel + OpStore %379 %30 + %396 = OpAccessChain %8 %47 %30 + OpStore %396 %1361 + OpBranch %421 + %397 = OpLabel + OpUnreachable + %398 = OpLabel + %400 = OpAccessChain %9 %47 %1220 %27 + %401 = OpLoad %6 %400 + %402 = OpIEqual %40 %401 %28 + OpSelectionMerge %418 None + OpBranchConditional %402 %407 %403 + %403 = OpLabel + %406 = OpLoad %6 %400 + OpBranch %420 + %407 = OpLabel + OpStore %400 %30 + %417 = OpAccessChain %8 %47 %30 + OpStore %417 %1361 + OpBranch %421 + %418 = OpLabel + OpUnreachable + %419 = OpLabel + OpUnreachable + %420 = OpLabel + %1344 = OpPhi %6 %385 %382 %406 %403 + OpBranch %366 + %421 = OpLabel + %1221 = OpPhi %40 %263 %366 %266 %386 %266 %407 + OpSelectionMerge %423 None + OpBranchConditional %1221 %424 %423 + %423 = OpLabel + OpBranch %424 + %424 = OpLabel + OpSelectionMerge %501 None + OpSwitch %262 %442 + %442 = OpLabel + OpBranch %443 + %443 = OpLabel + %1228 = OpPhi %6 %24 %442 %1345 %497 + %447 = OpSLessThanEqual %40 %1228 %1362 + OpLoopMerge %498 %497 None + OpBranchConditional %447 %448 %498 + %448 = OpLabel + %451 = OpAccessChain %9 %47 %1228 %24 + %452 = OpLoad %6 %451 + %453 = OpSLessThanEqual %40 %165 %452 + OpSelectionMerge %496 None + OpBranchConditional %453 %475 %454 + %454 = OpLabel + %456 = OpAccessChain %9 %47 %1228 %30 + %457 = OpLoad %6 %456 + %458 = OpIEqual %40 %457 %28 + OpSelectionMerge %474 None + OpBranchConditional %458 %463 %459 + %459 = OpLabel + %462 = OpLoad %6 %456 + OpBranch %497 + %463 = OpLabel + OpStore %456 %1362 + %473 = OpAccessChain %8 %47 %1362 + OpStore %473 %1363 + OpBranch %498 + %474 = OpLabel + OpUnreachable + %475 = OpLabel + %477 = OpAccessChain %9 %47 %1228 %27 + %478 = OpLoad %6 %477 + %479 = OpIEqual %40 %478 %28 + OpSelectionMerge %495 None + OpBranchConditional %479 %484 %480 + %480 = OpLabel + %483 = OpLoad %6 %477 + OpBranch %497 + %484 = OpLabel + OpStore %477 %1362 + %494 = OpAccessChain %8 %47 %1362 + OpStore %494 %1363 + OpBranch %498 + %495 = OpLabel + OpUnreachable + %496 = OpLabel + OpUnreachable + %497 = OpLabel + %1345 = OpPhi %6 %462 %459 %483 %480 + OpBranch %443 + %498 = OpLabel + %1229 = OpPhi %40 %263 %443 %266 %463 %266 %484 + OpSelectionMerge %500 None + OpBranchConditional %1229 %501 %500 + %500 = OpLabel + OpBranch %501 + %501 = OpLabel + OpSelectionMerge %578 None + OpSwitch %262 %519 + %519 = OpLabel + OpBranch %520 + %520 = OpLabel + %1236 = OpPhi %6 %24 %519 %1346 %574 + %524 = OpSLessThanEqual %40 %1236 %1364 + OpLoopMerge %575 %574 None + OpBranchConditional %524 %525 %575 + %525 = OpLabel + %528 = OpAccessChain %9 %47 %1236 %24 + %529 = OpLoad %6 %528 + %530 = OpSLessThanEqual %40 %172 %529 + OpSelectionMerge %573 None + OpBranchConditional %530 %552 %531 + %531 = OpLabel + %533 = OpAccessChain %9 %47 %1236 %30 + %534 = OpLoad %6 %533 + %535 = OpIEqual %40 %534 %28 + OpSelectionMerge %551 None + OpBranchConditional %535 %540 %536 + %536 = OpLabel + %539 = OpLoad %6 %533 + OpBranch %574 + %540 = OpLabel + OpStore %533 %1364 + %550 = OpAccessChain %8 %47 %1364 + OpStore %550 %1365 + OpBranch %575 + %551 = OpLabel + OpUnreachable + %552 = OpLabel + %554 = OpAccessChain %9 %47 %1236 %27 + %555 = OpLoad %6 %554 + %556 = OpIEqual %40 %555 %28 + OpSelectionMerge %572 None + OpBranchConditional %556 %561 %557 + %557 = OpLabel + %560 = OpLoad %6 %554 + OpBranch %574 + %561 = OpLabel + OpStore %554 %1364 + %571 = OpAccessChain %8 %47 %1364 + OpStore %571 %1365 + OpBranch %575 + %572 = OpLabel + OpUnreachable + %573 = OpLabel + OpUnreachable + %574 = OpLabel + %1346 = OpPhi %6 %539 %536 %560 %557 + OpBranch %520 + %575 = OpLabel + %1237 = OpPhi %40 %263 %520 %266 %540 %266 %561 + OpSelectionMerge %577 None + OpBranchConditional %1237 %578 %577 + %577 = OpLabel + OpBranch %578 + %578 = OpLabel + OpSelectionMerge %655 None + OpSwitch %262 %596 + %596 = OpLabel + OpBranch %597 + %597 = OpLabel + %1244 = OpPhi %6 %24 %596 %1347 %651 + %601 = OpSLessThanEqual %40 %1244 %151 + OpLoopMerge %652 %651 None + OpBranchConditional %601 %602 %652 + %602 = OpLabel + %605 = OpAccessChain %9 %47 %1244 %24 + %606 = OpLoad %6 %605 + %607 = OpSLessThanEqual %40 %179 %606 + OpSelectionMerge %650 None + OpBranchConditional %607 %629 %608 + %608 = OpLabel + %610 = OpAccessChain %9 %47 %1244 %30 + %611 = OpLoad %6 %610 + %612 = OpIEqual %40 %611 %28 + OpSelectionMerge %628 None + OpBranchConditional %612 %617 %613 + %613 = OpLabel + %616 = OpLoad %6 %610 + OpBranch %651 + %617 = OpLabel + OpStore %610 %151 + %627 = OpAccessChain %8 %47 %151 + OpStore %627 %1366 + OpBranch %652 + %628 = OpLabel + OpUnreachable + %629 = OpLabel + %631 = OpAccessChain %9 %47 %1244 %27 + %632 = OpLoad %6 %631 + %633 = OpIEqual %40 %632 %28 + OpSelectionMerge %649 None + OpBranchConditional %633 %638 %634 + %634 = OpLabel + %637 = OpLoad %6 %631 + OpBranch %651 + %638 = OpLabel + OpStore %631 %151 + %648 = OpAccessChain %8 %47 %151 + OpStore %648 %1366 + OpBranch %652 + %649 = OpLabel + OpUnreachable + %650 = OpLabel + OpUnreachable + %651 = OpLabel + %1347 = OpPhi %6 %616 %613 %637 %634 + OpBranch %597 + %652 = OpLabel + %1245 = OpPhi %40 %263 %597 %266 %617 %266 %638 + OpSelectionMerge %654 None + OpBranchConditional %1245 %655 %654 + %654 = OpLabel + OpBranch %655 + %655 = OpLabel + OpSelectionMerge %732 None + OpSwitch %262 %673 + %673 = OpLabel + OpBranch %674 + %674 = OpLabel + %1252 = OpPhi %6 %24 %673 %1348 %728 + %678 = OpSLessThanEqual %40 %1252 %192 + OpLoopMerge %729 %728 None + OpBranchConditional %678 %679 %729 + %679 = OpLabel + %682 = OpAccessChain %9 %47 %1252 %24 + %683 = OpLoad %6 %682 + %684 = OpSLessThanEqual %40 %30 %683 + OpSelectionMerge %727 None + OpBranchConditional %684 %706 %685 + %685 = OpLabel + %687 = OpAccessChain %9 %47 %1252 %30 + %688 = OpLoad %6 %687 + %689 = OpIEqual %40 %688 %28 + OpSelectionMerge %705 None + OpBranchConditional %689 %694 %690 + %690 = OpLabel + %693 = OpLoad %6 %687 + OpBranch %728 + %694 = OpLabel + OpStore %687 %192 + %704 = OpAccessChain %8 %47 %192 + OpStore %704 %1367 + OpBranch %729 + %705 = OpLabel + OpUnreachable + %706 = OpLabel + %708 = OpAccessChain %9 %47 %1252 %27 + %709 = OpLoad %6 %708 + %710 = OpIEqual %40 %709 %28 + OpSelectionMerge %726 None + OpBranchConditional %710 %715 %711 + %711 = OpLabel + %714 = OpLoad %6 %708 + OpBranch %728 + %715 = OpLabel + OpStore %708 %192 + %725 = OpAccessChain %8 %47 %192 + OpStore %725 %1367 + OpBranch %729 + %726 = OpLabel + OpUnreachable + %727 = OpLabel + OpUnreachable + %728 = OpLabel + %1348 = OpPhi %6 %693 %690 %714 %711 + OpBranch %674 + %729 = OpLabel + %1253 = OpPhi %40 %263 %674 %266 %694 %266 %715 + OpSelectionMerge %731 None + OpBranchConditional %1253 %732 %731 + %731 = OpLabel + OpBranch %732 + %732 = OpLabel + OpSelectionMerge %809 None + OpSwitch %262 %750 + %750 = OpLabel + OpBranch %751 + %751 = OpLabel + %1260 = OpPhi %6 %24 %750 %1349 %805 + %755 = OpSLessThanEqual %40 %1260 %172 + OpLoopMerge %806 %805 None + OpBranchConditional %755 %756 %806 + %756 = OpLabel + %759 = OpAccessChain %9 %47 %1260 %24 + %760 = OpLoad %6 %759 + %761 = OpSLessThanEqual %40 %192 %760 + OpSelectionMerge %804 None + OpBranchConditional %761 %783 %762 + %762 = OpLabel + %764 = OpAccessChain %9 %47 %1260 %30 + %765 = OpLoad %6 %764 + %766 = OpIEqual %40 %765 %28 + OpSelectionMerge %782 None + OpBranchConditional %766 %771 %767 + %767 = OpLabel + %770 = OpLoad %6 %764 + OpBranch %805 + %771 = OpLabel + OpStore %764 %172 + %781 = OpAccessChain %8 %47 %172 + OpStore %781 %1368 + OpBranch %806 + %782 = OpLabel + OpUnreachable + %783 = OpLabel + %785 = OpAccessChain %9 %47 %1260 %27 + %786 = OpLoad %6 %785 + %787 = OpIEqual %40 %786 %28 + OpSelectionMerge %803 None + OpBranchConditional %787 %792 %788 + %788 = OpLabel + %791 = OpLoad %6 %785 + OpBranch %805 + %792 = OpLabel + OpStore %785 %172 + %802 = OpAccessChain %8 %47 %172 + OpStore %802 %1368 + OpBranch %806 + %803 = OpLabel + OpUnreachable + %804 = OpLabel + OpUnreachable + %805 = OpLabel + %1349 = OpPhi %6 %770 %767 %791 %788 + OpBranch %751 + %806 = OpLabel + %1261 = OpPhi %40 %263 %751 %266 %771 %266 %792 + OpSelectionMerge %808 None + OpBranchConditional %1261 %809 %808 + %808 = OpLabel + OpBranch %809 + %809 = OpLabel + OpSelectionMerge %886 None + OpSwitch %262 %827 + %827 = OpLabel + OpBranch %828 + %828 = OpLabel + %1268 = OpPhi %6 %24 %827 %1350 %882 + %832 = OpSLessThanEqual %40 %1268 %179 + OpLoopMerge %883 %882 None + OpBranchConditional %832 %833 %883 + %833 = OpLabel + %836 = OpAccessChain %9 %47 %1268 %24 + %837 = OpLoad %6 %836 + %838 = OpSLessThanEqual %40 %199 %837 + OpSelectionMerge %881 None + OpBranchConditional %838 %860 %839 + %839 = OpLabel + %841 = OpAccessChain %9 %47 %1268 %30 + %842 = OpLoad %6 %841 + %843 = OpIEqual %40 %842 %28 + OpSelectionMerge %859 None + OpBranchConditional %843 %848 %844 + %844 = OpLabel + %847 = OpLoad %6 %841 + OpBranch %882 + %848 = OpLabel + OpStore %841 %179 + %858 = OpAccessChain %8 %47 %179 + OpStore %858 %1369 + OpBranch %883 + %859 = OpLabel + OpUnreachable + %860 = OpLabel + %862 = OpAccessChain %9 %47 %1268 %27 + %863 = OpLoad %6 %862 + %864 = OpIEqual %40 %863 %28 + OpSelectionMerge %880 None + OpBranchConditional %864 %869 %865 + %865 = OpLabel + %868 = OpLoad %6 %862 + OpBranch %882 + %869 = OpLabel + OpStore %862 %179 + %879 = OpAccessChain %8 %47 %179 + OpStore %879 %1369 + OpBranch %883 + %880 = OpLabel + OpUnreachable + %881 = OpLabel + OpUnreachable + %882 = OpLabel + %1350 = OpPhi %6 %847 %844 %868 %865 + OpBranch %828 + %883 = OpLabel + %1269 = OpPhi %40 %263 %828 %266 %848 %266 %869 + OpSelectionMerge %885 None + OpBranchConditional %1269 %886 %885 + %885 = OpLabel + OpBranch %886 + %886 = OpLabel + OpSelectionMerge %963 None + OpSwitch %262 %904 + %904 = OpLabel + OpBranch %905 + %905 = OpLabel + %1276 = OpPhi %6 %24 %904 %1351 %959 + %909 = OpSLessThanEqual %40 %1276 %141 + OpLoopMerge %960 %959 None + OpBranchConditional %909 %910 %960 + %910 = OpLabel + %913 = OpAccessChain %9 %47 %1276 %24 + %914 = OpLoad %6 %913 + %915 = OpSLessThanEqual %40 %206 %914 + OpSelectionMerge %958 None + OpBranchConditional %915 %937 %916 + %916 = OpLabel + %918 = OpAccessChain %9 %47 %1276 %30 + %919 = OpLoad %6 %918 + %920 = OpIEqual %40 %919 %28 + OpSelectionMerge %936 None + OpBranchConditional %920 %925 %921 + %921 = OpLabel + %924 = OpLoad %6 %918 + OpBranch %959 + %925 = OpLabel + OpStore %918 %141 + %935 = OpAccessChain %8 %47 %141 + OpStore %935 %1370 + OpBranch %960 + %936 = OpLabel + OpUnreachable + %937 = OpLabel + %939 = OpAccessChain %9 %47 %1276 %27 + %940 = OpLoad %6 %939 + %941 = OpIEqual %40 %940 %28 + OpSelectionMerge %957 None + OpBranchConditional %941 %946 %942 + %942 = OpLabel + %945 = OpLoad %6 %939 + OpBranch %959 + %946 = OpLabel + OpStore %939 %141 + %956 = OpAccessChain %8 %47 %141 + OpStore %956 %1370 + OpBranch %960 + %957 = OpLabel + OpUnreachable + %958 = OpLabel + OpUnreachable + %959 = OpLabel + %1351 = OpPhi %6 %924 %921 %945 %942 + OpBranch %905 + %960 = OpLabel + %1277 = OpPhi %40 %263 %905 %266 %925 %266 %946 + OpSelectionMerge %962 None + OpBranchConditional %1277 %963 %962 + %962 = OpLabel + OpBranch %963 + %963 = OpLabel + OpBranch %213 + %213 = OpLabel + %1290 = OpPhi %6 %1318 %963 %1287 %216 + %1281 = OpPhi %6 %24 %963 %1352 %216 + %1280 = OpPhi %6 %24 %963 %246 %216 + %220 = OpSLessThan %40 %1280 %219 + OpLoopMerge %215 %216 None + OpBranchConditional %220 %214 %215 + %214 = OpLabel + OpSelectionMerge %1013 None + OpSwitch %262 %981 + %981 = OpLabel + OpBranch %982 + %982 = OpLabel + %1282 = OpPhi %6 %24 %981 %1371 %1009 + %985 = OpINotEqual %40 %1282 %28 + OpLoopMerge %1010 %1009 None + OpBranchConditional %985 %986 %1010 + %986 = OpLabel + %988 = OpAccessChain %8 %47 %1282 + %989 = OpLoad %7 %988 + %1019 = OpCompositeExtract %6 %989 0 + %1020 = OpCompositeExtract %6 %989 1 + %1021 = OpCompositeExtract %6 %989 2 + %993 = OpIEqual %40 %1019 %1280 + OpSelectionMerge %996 None + OpBranchConditional %993 %994 %996 + %994 = OpLabel + OpBranch %1010 + %996 = OpLabel + %1000 = OpSGreaterThan %40 %1280 %1019 + %1371 = OpSelect %6 %1000 %1021 %1020 + OpBranch %1009 + %1009 = OpLabel + OpBranch %982 + %1010 = OpLabel + %1288 = OpPhi %6 %1290 %982 %1280 %994 + %1284 = OpPhi %40 %263 %982 %266 %994 + OpSelectionMerge %1012 None + OpBranchConditional %1284 %1013 %1012 + %1012 = OpLabel + OpBranch %1013 + %1013 = OpLabel + %1287 = OpPhi %6 %1288 %1010 %28 %1012 + OpSelectionMerge %228 None + OpSwitch %1280 %227 9 %226 5 %226 12 %226 15 %226 7 %226 8 %226 2 %226 6 %226 17 %226 13 %226 + %226 = OpLabel + %231 = OpIEqual %40 %1287 %1280 + OpSelectionMerge %233 None + OpBranchConditional %231 %232 %233 + %232 = OpLabel + %235 = OpIAdd %6 %1281 %27 + OpBranch %233 + %233 = OpLabel + %1353 = OpPhi %6 %1281 %226 %235 %232 + OpBranch %228 + %227 = OpLabel + %238 = OpIEqual %40 %1287 %28 + OpSelectionMerge %240 None + OpBranchConditional %238 %239 %240 + %239 = OpLabel + %242 = OpIAdd %6 %1281 %27 + OpBranch %240 + %240 = OpLabel + %1354 = OpPhi %6 %1281 %227 %242 %239 + OpBranch %228 + %228 = OpLabel + %1352 = OpPhi %6 %1353 %233 %1354 %240 + OpBranch %216 + %216 = OpLabel + %246 = OpIAdd %6 %1280 %27 + OpBranch %213 + %215 = OpLabel + %248 = OpIEqual %40 %1281 %219 + OpSelectionMerge %250 None + OpBranchConditional %248 %249 %258 + %258 = OpLabel + OpStore %254 %259 + OpBranch %250 + %249 = OpLabel + OpStore %254 %257 + OpBranch %250 + %250 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 2550 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %254 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "BST" + OpMemberName %7 0 "data" + OpMemberName %7 1 "leftIndex" + OpMemberName %7 2 "rightIndex" + OpName %47 "tree" + OpName %254 "_GLF_color" + OpDecorate %254 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypePointer Function %6 + %24 = OpConstant %6 0 + %27 = OpConstant %6 1 + %28 = OpConstant %6 -1 + %30 = OpConstant %6 2 + %40 = OpTypeBool + %43 = OpTypeInt 32 0 + %44 = OpConstant %43 10 + %45 = OpTypeArray %7 %44 + %141 = OpConstant %6 9 + %151 = OpConstant %6 5 + %158 = OpConstant %6 12 + %165 = OpConstant %6 15 + %172 = OpConstant %6 7 + %179 = OpConstant %6 8 + %192 = OpConstant %6 6 + %199 = OpConstant %6 17 + %206 = OpConstant %6 13 + %219 = OpConstant %6 20 + %251 = OpTypeFloat 32 + %252 = OpTypeVector %251 4 + %253 = OpTypePointer Output %252 + %254 = OpVariable %253 Output + %255 = OpConstant %251 1 + %256 = OpConstant %251 0 + %257 = OpConstantComposite %252 %255 %256 %256 %255 + %259 = OpConstantComposite %252 %256 %256 %255 %255 + %262 = OpConstant %43 0 + %263 = OpConstantFalse %40 + %266 = OpConstantTrue %40 + %1015 = OpTypePointer Function %45 + %1318 = OpUndef %6 + %1359 = OpConstantComposite %7 %141 %28 %28 + %1360 = OpConstantComposite %7 %151 %28 %28 + %1361 = OpConstantComposite %7 %158 %28 %28 + %1362 = OpConstant %6 3 + %1363 = OpConstantComposite %7 %165 %28 %28 + %1364 = OpConstant %6 4 + %1365 = OpConstantComposite %7 %172 %28 %28 + %1366 = OpConstantComposite %7 %179 %28 %28 + %1367 = OpConstantComposite %7 %30 %28 %28 + %1368 = OpConstantComposite %7 %192 %28 %28 + %1369 = OpConstantComposite %7 %199 %28 %28 + %1370 = OpConstantComposite %7 %206 %28 %28 + %1502 = OpConstant %6 15 + %1505 = OpConstant %6 6 + %2288 = OpConstant %43 3 + %2300 = OpTypePointer Output %251 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %47 = OpVariable %1015 Function + %148 = OpAccessChain %8 %47 %24 + OpStore %148 %1359 + OpSelectionMerge %347 None + OpSwitch %262 %288 + %288 = OpLabel + OpBranch %289 + %289 = OpLabel + %1212 = OpPhi %6 %24 %288 %1342 %343 + %293 = OpSLessThanEqual %40 %1212 %27 + OpLoopMerge %344 %343 None + OpBranchConditional %293 %294 %344 + %294 = OpLabel + %297 = OpAccessChain %9 %47 %1212 %24 + %298 = OpLoad %6 %297 + %299 = OpSLessThanEqual %40 %151 %298 + OpSelectionMerge %342 None + OpBranchConditional %299 %321 %300 + %300 = OpLabel + %302 = OpAccessChain %9 %47 %1212 %30 + %303 = OpLoad %6 %302 + %304 = OpIEqual %40 %303 %28 + OpSelectionMerge %320 None + OpBranchConditional %304 %309 %305 + %305 = OpLabel + %308 = OpLoad %6 %302 + OpBranch %343 + %309 = OpLabel + OpStore %302 %27 + %319 = OpAccessChain %8 %47 %27 + OpStore %319 %1360 + OpBranch %344 + %320 = OpLabel + OpUnreachable + %321 = OpLabel + %323 = OpAccessChain %9 %47 %1212 %27 + %324 = OpLoad %6 %323 + %325 = OpIEqual %40 %324 %28 + OpSelectionMerge %341 None + OpBranchConditional %325 %330 %326 + %326 = OpLabel + %329 = OpLoad %6 %323 + OpBranch %343 + %330 = OpLabel + OpStore %323 %27 + %340 = OpAccessChain %8 %47 %27 + OpStore %340 %1360 + OpBranch %344 + %341 = OpLabel + OpUnreachable + %342 = OpLabel + OpUnreachable + %343 = OpLabel + %1342 = OpPhi %6 %308 %305 %329 %326 + OpBranch %289 + %344 = OpLabel + %1213 = OpPhi %40 %263 %289 %266 %309 %266 %330 + OpSelectionMerge %346 None + OpBranchConditional %1213 %347 %346 + %346 = OpLabel + OpBranch %347 + %347 = OpLabel + OpSelectionMerge %424 None + OpSwitch %262 %365 + %365 = OpLabel + OpBranch %366 + %366 = OpLabel + %1220 = OpPhi %6 %24 %365 %1344 %420 + %370 = OpSLessThanEqual %40 %1220 %30 + OpLoopMerge %421 %420 None + OpBranchConditional %370 %371 %421 + %371 = OpLabel + %374 = OpAccessChain %9 %47 %1220 %24 + %375 = OpLoad %6 %374 + %376 = OpSLessThanEqual %40 %158 %375 + OpSelectionMerge %419 None + OpBranchConditional %376 %398 %377 + %377 = OpLabel + %379 = OpAccessChain %9 %47 %1220 %30 + %380 = OpLoad %6 %379 + %381 = OpIEqual %40 %380 %28 + OpSelectionMerge %397 None + OpBranchConditional %381 %386 %382 + %382 = OpLabel + %385 = OpLoad %6 %379 + OpBranch %420 + %386 = OpLabel + OpStore %379 %30 + %396 = OpAccessChain %8 %47 %30 + OpStore %396 %1361 + OpBranch %421 + %397 = OpLabel + OpUnreachable + %398 = OpLabel + %400 = OpAccessChain %9 %47 %1220 %27 + %401 = OpLoad %6 %400 + %402 = OpIEqual %40 %401 %28 + OpSelectionMerge %418 None + OpBranchConditional %402 %407 %403 + %403 = OpLabel + %406 = OpLoad %6 %400 + OpBranch %420 + %407 = OpLabel + OpStore %400 %30 + %417 = OpAccessChain %8 %47 %30 + OpStore %417 %1361 + OpBranch %421 + %418 = OpLabel + OpUnreachable + %419 = OpLabel + OpUnreachable + %420 = OpLabel + %1344 = OpPhi %6 %385 %382 %406 %403 + OpBranch %366 + %421 = OpLabel + %1221 = OpPhi %40 %263 %366 %266 %386 %266 %407 + OpSelectionMerge %423 None + OpBranchConditional %1221 %424 %423 + %423 = OpLabel + OpBranch %424 + %424 = OpLabel + OpSelectionMerge %501 None + OpSwitch %262 %442 + %442 = OpLabel + OpBranch %443 + %443 = OpLabel + %1228 = OpPhi %6 %24 %442 %1345 %497 + %447 = OpSLessThanEqual %40 %1228 %1362 + OpLoopMerge %498 %497 None + OpBranchConditional %447 %448 %498 + %448 = OpLabel + %451 = OpAccessChain %9 %47 %1228 %24 + %452 = OpLoad %6 %451 + %453 = OpSLessThanEqual %40 %165 %452 + OpSelectionMerge %496 None + OpBranchConditional %453 %475 %454 + %454 = OpLabel + %456 = OpAccessChain %9 %47 %1228 %30 + %457 = OpLoad %6 %456 + %458 = OpIEqual %40 %457 %28 + OpSelectionMerge %474 None + OpBranchConditional %458 %463 %459 + %459 = OpLabel + %462 = OpLoad %6 %456 + OpBranch %497 + %463 = OpLabel + OpStore %456 %1362 + %473 = OpAccessChain %8 %47 %1362 + OpStore %473 %1363 + OpBranch %498 + %474 = OpLabel + OpUnreachable + %475 = OpLabel + %477 = OpAccessChain %9 %47 %1228 %27 + %478 = OpLoad %6 %477 + %479 = OpIEqual %40 %478 %28 + OpSelectionMerge %495 None + OpBranchConditional %479 %484 %480 + %480 = OpLabel + %483 = OpLoad %6 %477 + OpBranch %497 + %484 = OpLabel + OpStore %477 %1362 + %494 = OpAccessChain %8 %47 %1362 + OpStore %494 %1363 + OpBranch %498 + %495 = OpLabel + OpUnreachable + %496 = OpLabel + OpUnreachable + %497 = OpLabel + %1345 = OpPhi %6 %462 %459 %483 %480 + OpBranch %443 + %498 = OpLabel + %1229 = OpPhi %40 %263 %443 %266 %463 %266 %484 + OpSelectionMerge %500 None + OpBranchConditional %1229 %501 %500 + %500 = OpLabel + OpBranch %501 + %501 = OpLabel + OpSelectionMerge %578 None + OpSwitch %262 %519 + %519 = OpLabel + OpBranch %520 + %520 = OpLabel + %1236 = OpPhi %6 %24 %519 %1346 %574 + %524 = OpSLessThanEqual %40 %1236 %1364 + OpLoopMerge %575 %574 None + OpBranchConditional %524 %525 %575 + %525 = OpLabel + %528 = OpAccessChain %9 %47 %1236 %24 + %529 = OpLoad %6 %528 + %530 = OpSLessThanEqual %40 %172 %529 + OpSelectionMerge %573 None + OpBranchConditional %530 %552 %531 + %531 = OpLabel + %533 = OpAccessChain %9 %47 %1236 %30 + %534 = OpLoad %6 %533 + %535 = OpIEqual %40 %534 %28 + OpSelectionMerge %551 None + OpBranchConditional %535 %540 %536 + %536 = OpLabel + %539 = OpLoad %6 %533 + OpBranch %574 + %540 = OpLabel + OpStore %533 %1364 + %550 = OpAccessChain %8 %47 %1364 + OpStore %550 %1365 + OpBranch %575 + %551 = OpLabel + OpUnreachable + %552 = OpLabel + %554 = OpAccessChain %9 %47 %1236 %27 + %555 = OpLoad %6 %554 + %556 = OpIEqual %40 %555 %28 + OpSelectionMerge %572 None + OpBranchConditional %556 %561 %557 + %557 = OpLabel + %560 = OpLoad %6 %554 + OpBranch %574 + %561 = OpLabel + OpStore %554 %1364 + %571 = OpAccessChain %8 %47 %1364 + OpStore %571 %1365 + OpBranch %575 + %572 = OpLabel + OpUnreachable + %573 = OpLabel + OpUnreachable + %574 = OpLabel + %1346 = OpPhi %6 %539 %536 %560 %557 + OpBranch %520 + %575 = OpLabel + %1237 = OpPhi %40 %263 %520 %266 %540 %266 %561 + OpSelectionMerge %577 None + OpBranchConditional %1237 %578 %577 + %577 = OpLabel + OpBranch %578 + %578 = OpLabel + OpSelectionMerge %655 None + OpSwitch %262 %596 + %596 = OpLabel + OpBranch %597 + %597 = OpLabel + %1244 = OpPhi %6 %24 %596 %1347 %651 + %601 = OpSLessThanEqual %40 %1244 %151 + OpLoopMerge %652 %651 None + OpBranchConditional %601 %602 %652 + %602 = OpLabel + %605 = OpAccessChain %9 %47 %1244 %24 + %606 = OpLoad %6 %605 + %607 = OpSLessThanEqual %40 %179 %606 + OpSelectionMerge %650 None + OpBranchConditional %607 %629 %608 + %608 = OpLabel + %610 = OpAccessChain %9 %47 %1244 %30 + %611 = OpLoad %6 %610 + %612 = OpIEqual %40 %611 %28 + OpSelectionMerge %628 None + OpBranchConditional %612 %617 %613 + %613 = OpLabel + %616 = OpLoad %6 %610 + OpBranch %651 + %617 = OpLabel + OpStore %610 %151 + %627 = OpAccessChain %8 %47 %151 + OpStore %627 %1366 + OpBranch %652 + %628 = OpLabel + OpUnreachable + %629 = OpLabel + %631 = OpAccessChain %9 %47 %1244 %27 + %632 = OpLoad %6 %631 + %633 = OpIEqual %40 %632 %28 + OpSelectionMerge %649 None + OpBranchConditional %633 %638 %634 + %634 = OpLabel + %637 = OpLoad %6 %631 + OpBranch %651 + %638 = OpLabel + OpStore %631 %151 + %648 = OpAccessChain %8 %47 %151 + OpStore %648 %1366 + OpBranch %652 + %649 = OpLabel + OpUnreachable + %650 = OpLabel + OpUnreachable + %651 = OpLabel + %1347 = OpPhi %6 %616 %613 %637 %634 + OpBranch %597 + %652 = OpLabel + %1245 = OpPhi %40 %263 %597 %266 %617 %266 %638 + OpSelectionMerge %654 None + OpBranchConditional %1245 %655 %654 + %654 = OpLabel + OpBranch %655 + %655 = OpLabel + OpSelectionMerge %732 None + OpSwitch %262 %673 + %673 = OpLabel + OpBranch %674 + %674 = OpLabel + %1252 = OpPhi %6 %24 %673 %1348 %728 + %678 = OpSLessThanEqual %40 %1252 %192 + OpLoopMerge %729 %728 None + OpBranchConditional %678 %679 %729 + %679 = OpLabel + %682 = OpAccessChain %9 %47 %1252 %24 + %683 = OpLoad %6 %682 + %684 = OpSLessThanEqual %40 %30 %683 + OpSelectionMerge %727 None + OpBranchConditional %684 %706 %685 + %685 = OpLabel + %687 = OpAccessChain %9 %47 %1252 %30 + %688 = OpLoad %6 %687 + %689 = OpIEqual %40 %688 %28 + OpSelectionMerge %705 None + OpBranchConditional %689 %694 %690 + %690 = OpLabel + %693 = OpLoad %6 %687 + OpBranch %728 + %694 = OpLabel + OpStore %687 %192 + %704 = OpAccessChain %8 %47 %192 + OpStore %704 %1367 + OpBranch %729 + %705 = OpLabel + OpUnreachable + %706 = OpLabel + %708 = OpAccessChain %9 %47 %1252 %27 + %709 = OpLoad %6 %708 + %710 = OpIEqual %40 %709 %28 + OpSelectionMerge %726 None + OpBranchConditional %710 %715 %711 + %711 = OpLabel + %714 = OpLoad %6 %708 + OpBranch %728 + %715 = OpLabel + OpStore %708 %192 + %725 = OpAccessChain %8 %47 %192 + OpStore %725 %1367 + OpBranch %729 + %726 = OpLabel + OpUnreachable + %727 = OpLabel + OpUnreachable + %728 = OpLabel + %1348 = OpPhi %6 %693 %690 %714 %711 + OpBranch %674 + %729 = OpLabel + %1253 = OpPhi %40 %263 %674 %266 %694 %266 %715 + OpSelectionMerge %731 None + OpBranchConditional %1253 %732 %731 + %731 = OpLabel + OpBranch %732 + %732 = OpLabel + OpSelectionMerge %809 None + OpSwitch %262 %750 + %750 = OpLabel + OpBranch %751 + %751 = OpLabel + %1260 = OpPhi %6 %24 %750 %1349 %805 + %755 = OpSLessThanEqual %40 %1260 %172 + OpLoopMerge %806 %805 None + OpBranchConditional %755 %756 %806 + %756 = OpLabel + %759 = OpAccessChain %9 %47 %1260 %24 + %760 = OpLoad %6 %759 + %761 = OpSLessThanEqual %40 %192 %760 + OpSelectionMerge %804 None + OpBranchConditional %761 %783 %762 + %762 = OpLabel + %764 = OpAccessChain %9 %47 %1260 %30 + %765 = OpLoad %6 %764 + %766 = OpIEqual %40 %765 %28 + OpSelectionMerge %782 None + OpBranchConditional %766 %771 %767 + %767 = OpLabel + %770 = OpLoad %6 %764 + OpBranch %805 + %771 = OpLabel + OpStore %764 %172 + %781 = OpAccessChain %8 %47 %172 + OpStore %781 %1368 + OpBranch %806 + %782 = OpLabel + OpUnreachable + %783 = OpLabel + %785 = OpAccessChain %9 %47 %1260 %27 + %786 = OpLoad %6 %785 + %787 = OpIEqual %40 %786 %28 + OpSelectionMerge %803 None + OpBranchConditional %787 %792 %788 + %788 = OpLabel + %791 = OpLoad %6 %785 + OpBranch %805 + %792 = OpLabel + OpStore %785 %172 + %802 = OpAccessChain %8 %47 %172 + OpStore %802 %1368 + OpBranch %806 + %803 = OpLabel + OpUnreachable + %804 = OpLabel + OpUnreachable + %805 = OpLabel + %1349 = OpPhi %6 %770 %767 %791 %788 + OpBranch %751 + %806 = OpLabel + %1261 = OpPhi %40 %263 %751 %266 %771 %266 %792 + OpSelectionMerge %808 None + OpBranchConditional %1261 %809 %808 + %808 = OpLabel + OpBranch %809 + %809 = OpLabel + OpSelectionMerge %886 None + OpSwitch %262 %827 + %827 = OpLabel + OpBranch %828 + %828 = OpLabel + %1268 = OpPhi %6 %24 %827 %1350 %882 + %832 = OpSLessThanEqual %40 %1268 %179 + OpLoopMerge %883 %882 None + OpBranchConditional %832 %833 %883 + %833 = OpLabel + %836 = OpAccessChain %9 %47 %1268 %24 + %837 = OpLoad %6 %836 + %838 = OpSLessThanEqual %40 %199 %837 + OpSelectionMerge %881 None + OpBranchConditional %838 %860 %839 + %839 = OpLabel + %841 = OpAccessChain %9 %47 %1268 %30 + %842 = OpLoad %6 %841 + %843 = OpIEqual %40 %842 %28 + OpSelectionMerge %859 None + OpBranchConditional %843 %848 %844 + %844 = OpLabel + %847 = OpLoad %6 %841 + OpBranch %882 + %848 = OpLabel + OpStore %841 %179 + %858 = OpAccessChain %8 %47 %179 + OpStore %858 %1369 + OpBranch %883 + %859 = OpLabel + OpUnreachable + %860 = OpLabel + %862 = OpAccessChain %9 %47 %1268 %27 + %863 = OpLoad %6 %862 + %864 = OpIEqual %40 %863 %28 + OpSelectionMerge %880 None + OpBranchConditional %864 %869 %865 + %865 = OpLabel + %868 = OpLoad %6 %862 + OpBranch %882 + %869 = OpLabel + OpStore %862 %179 + %879 = OpAccessChain %8 %47 %179 + OpStore %879 %1369 + OpBranch %883 + %880 = OpLabel + OpUnreachable + %881 = OpLabel + OpUnreachable + %882 = OpLabel + %1350 = OpPhi %6 %847 %844 %868 %865 + OpBranch %828 + %883 = OpLabel + %1269 = OpPhi %40 %263 %828 %266 %848 %266 %869 + OpSelectionMerge %885 None + OpBranchConditional %1269 %886 %885 + %885 = OpLabel + OpBranch %886 + %886 = OpLabel + OpSelectionMerge %963 None + OpSwitch %262 %904 + %904 = OpLabel + OpBranch %905 + %905 = OpLabel + %1276 = OpPhi %6 %24 %904 %1351 %959 + %909 = OpSLessThanEqual %40 %1276 %141 + OpLoopMerge %960 %959 None + OpBranchConditional %909 %910 %960 + %910 = OpLabel + %913 = OpAccessChain %9 %47 %1276 %24 + %914 = OpLoad %6 %913 + %915 = OpSLessThanEqual %40 %206 %914 + OpSelectionMerge %958 None + OpBranchConditional %915 %937 %916 + %916 = OpLabel + %918 = OpAccessChain %9 %47 %1276 %30 + %919 = OpLoad %6 %918 + %920 = OpIEqual %40 %919 %28 + OpSelectionMerge %936 None + OpBranchConditional %920 %925 %921 + %921 = OpLabel + %924 = OpLoad %6 %918 + OpBranch %959 + %925 = OpLabel + OpStore %918 %141 + %935 = OpAccessChain %8 %47 %141 + OpStore %935 %1370 + OpBranch %960 + %936 = OpLabel + OpUnreachable + %937 = OpLabel + %939 = OpAccessChain %9 %47 %1276 %27 + %940 = OpLoad %6 %939 + %941 = OpIEqual %40 %940 %28 + OpSelectionMerge %957 None + OpBranchConditional %941 %946 %942 + %942 = OpLabel + %945 = OpLoad %6 %939 + OpBranch %959 + %946 = OpLabel + OpStore %939 %141 + %956 = OpAccessChain %8 %47 %141 + OpStore %956 %1370 + OpBranch %960 + %957 = OpLabel + OpUnreachable + %958 = OpLabel + OpUnreachable + %959 = OpLabel + %1351 = OpPhi %6 %924 %921 %945 %942 + OpBranch %905 + %960 = OpLabel + %1277 = OpPhi %40 %263 %905 %266 %925 %266 %946 + OpSelectionMerge %962 None + OpBranchConditional %1277 %963 %962 + %962 = OpLabel + OpBranch %963 + %963 = OpLabel + OpBranch %213 + %213 = OpLabel + %1290 = OpPhi %6 %1318 %963 %1287 %216 + %1281 = OpPhi %6 %24 %963 %1352 %216 + %1280 = OpPhi %6 %24 %963 %246 %216 + %220 = OpSLessThan %40 %1280 %219 + %2223 = OpISub %6 %1505 %1502 + %2353 = OpULessThanEqual %40 %2288 %2288 + %2354 = OpSelect %43 %2353 %2288 %2288 + %2355 = OpAccessChain %2300 %254 %2354 + OpLoopMerge %215 %216 None + OpBranchConditional %220 %214 %215 + %214 = OpLabel + OpSelectionMerge %1013 None + OpSwitch %262 %981 + %981 = OpLabel + OpBranch %982 + %982 = OpLabel + %1282 = OpPhi %6 %24 %981 %1371 %1009 + %985 = OpINotEqual %40 %1282 %28 + OpLoopMerge %1010 %1009 None + OpBranchConditional %985 %986 %1010 + %986 = OpLabel + %988 = OpAccessChain %8 %47 %1282 + %989 = OpLoad %7 %988 + %1019 = OpCompositeExtract %6 %989 0 + %1020 = OpCompositeExtract %6 %989 1 + %2356 = OpInBoundsAccessChain %2300 %2355 + %1021 = OpCompositeExtract %6 %989 2 + %993 = OpIEqual %40 %1019 %1280 + OpSelectionMerge %996 None + OpBranchConditional %993 %994 %996 + %994 = OpLabel + OpBranch %1010 + %996 = OpLabel + %2549 = OpLoad %251 %2356 + %1487 = OpSLessThanEqual %40 %1280 %1019 + %1000 = OpLogicalNot %40 %1487 + %1371 = OpSelect %6 %1000 %1021 %1020 + OpBranch %1009 + %1009 = OpLabel + OpBranch %982 + %1010 = OpLabel + %1288 = OpPhi %6 %1290 %982 %1280 %994 + %1284 = OpPhi %40 %263 %982 %266 %994 + OpSelectionMerge %1012 None + OpBranchConditional %1284 %1013 %1012 + %1012 = OpLabel + OpBranch %1013 + %1013 = OpLabel + %1287 = OpPhi %6 %1288 %1010 %28 %1012 + OpSelectionMerge %228 None + OpSwitch %1280 %227 9 %226 5 %226 12 %226 15 %226 7 %226 8 %226 2 %226 6 %226 17 %226 13 %226 + %226 = OpLabel + %231 = OpIEqual %40 %1287 %1280 + OpSelectionMerge %233 None + OpBranchConditional %231 %232 %233 + %232 = OpLabel + %235 = OpIAdd %6 %1281 %27 + OpBranch %233 + %233 = OpLabel + %1353 = OpPhi %6 %1281 %226 %235 %232 + OpBranch %228 + %227 = OpLabel + %238 = OpIEqual %40 %1287 %28 + OpSelectionMerge %240 None + OpBranchConditional %238 %239 %240 + %239 = OpLabel + %242 = OpIAdd %6 %1281 %27 + OpBranch %240 + %240 = OpLabel + %1354 = OpPhi %6 %1281 %227 %242 %239 + OpBranch %228 + %228 = OpLabel + %1352 = OpPhi %6 %1353 %233 %1354 %240 + OpBranch %216 + %216 = OpLabel + %246 = OpIAdd %6 %1280 %27 + OpBranch %213 + %215 = OpLabel + %248 = OpIEqual %40 %1281 %219 + OpSelectionMerge %250 None + OpBranchConditional %248 %249 %258 + %258 = OpLabel + OpStore %254 %259 + OpBranch %250 + %249 = OpLabel + OpStore %254 %257 + OpBranch %250 + %250 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-null-in-phi-and-unroll.amber b/vulkan/amber/graphicsfuzz/spv-null-in-phi-and-unroll.amber new file mode 100644 index 0000000..9735abb --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-null-in-phi-and-unroll.amber @@ -0,0 +1,452 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one that uses null for 0 and an Unroll annotation + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 295 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %165 %180 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %165 "gl_FragCoord" + OpName %168 "buf0" + OpMemberName %168 0 "resolution" + OpName %170 "" + OpName %180 "_GLF_color" + OpDecorate %165 BuiltIn FragCoord + OpMemberDecorate %168 0 Offset 0 + OpDecorate %168 Block + OpDecorate %170 DescriptorSet 0 + OpDecorate %170 Binding 0 + OpDecorate %180 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %9 = OpTypeVector %6 4 + %10 = OpTypePointer Function %9 + %11 = OpTypeBool + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Function %6 + %31 = OpConstantFalse %11 + %33 = OpConstant %21 1 + %66 = OpConstantTrue %11 + %70 = OpConstant %6 0.5 + %71 = OpConstant %6 1 + %72 = OpConstantComposite %9 %70 %70 %71 %71 + %73 = OpTypeInt 32 1 + %76 = OpConstant %73 0 + %83 = OpConstant %73 8 + %85 = OpConstant %21 8 + %86 = OpTypeArray %9 %85 + %87 = OpConstant %6 4 + %88 = OpConstant %6 20 + %89 = OpConstantComposite %9 %87 %87 %88 %87 + %90 = OpConstantComposite %9 %87 %87 %87 %88 + %91 = OpConstantComposite %9 %87 %88 %88 %87 + %92 = OpConstant %6 8 + %93 = OpConstantComposite %9 %88 %87 %87 %92 + %94 = OpConstant %6 6 + %95 = OpConstant %6 2 + %96 = OpConstantComposite %9 %92 %94 %87 %95 + %97 = OpConstant %6 12 + %98 = OpConstantComposite %9 %95 %97 %95 %87 + %99 = OpConstant %6 16 + %100 = OpConstantComposite %9 %99 %95 %87 %87 + %101 = OpConstant %6 22 + %102 = OpConstantComposite %9 %97 %101 %87 %87 + %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102 + %108 = OpTypePointer Function %86 + %115 = OpConstant %21 16 + %116 = OpTypeArray %9 %115 + %117 = OpConstant %6 0 + %118 = OpConstantComposite %9 %117 %117 %117 %71 + %119 = OpConstantComposite %9 %70 %117 %117 %71 + %120 = OpConstantComposite %9 %117 %70 %117 %71 + %121 = OpConstantComposite %9 %70 %70 %117 %71 + %122 = OpConstantComposite %9 %117 %117 %70 %71 + %123 = OpConstantComposite %9 %70 %117 %70 %71 + %124 = OpConstantComposite %9 %117 %70 %70 %71 + %125 = OpConstantComposite %9 %70 %70 %70 %71 + %126 = OpConstantComposite %9 %71 %117 %117 %71 + %127 = OpConstantComposite %9 %117 %71 %117 %71 + %128 = OpConstantComposite %9 %71 %71 %117 %71 + %129 = OpConstantComposite %9 %117 %117 %71 %71 + %130 = OpConstantComposite %9 %71 %117 %71 %71 + %131 = OpConstantComposite %9 %117 %71 %71 %71 + %132 = OpConstantComposite %9 %71 %71 %71 %71 + %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132 + %146 = OpConstant %73 9 + %149 = OpConstant %73 11 + %151 = OpConstant %73 16 + %153 = OpTypePointer Function %116 + %158 = OpConstant %73 1 + %164 = OpTypePointer Input %9 + %165 = OpVariable %164 Input + %168 = OpTypeStruct %7 + %169 = OpTypePointer Uniform %168 + %170 = OpVariable %169 Uniform + %171 = OpTypePointer Uniform %7 + %176 = OpConstant %6 32 + %179 = OpTypePointer Output %9 + %180 = OpVariable %179 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %199 = OpVariable %108 Function + %200 = OpVariable %108 Function + %201 = OpVariable %108 Function + %202 = OpVariable %153 Function + %166 = OpLoad %9 %165 + %167 = OpVectorShuffle %7 %166 %166 0 1 + %172 = OpAccessChain %171 %170 %76 + %173 = OpLoad %7 %172 + %174 = OpFDiv %7 %167 %173 + %177 = OpVectorTimesScalar %7 %174 %176 + %178 = OpExtInst %7 %1 Floor %177 + OpBranch %205 + %205 = OpLabel + %290 = OpPhi %9 %72 %5 %294 %233 + %289 = OpPhi %73 %76 %5 %235 %233 + %208 = OpSLessThan %11 %289 %83 + OpLoopMerge %236 %233 None + OpBranchConditional %208 %209 %236 + %209 = OpLabel + OpStore %199 %103 + %212 = OpAccessChain %10 %199 %289 + %213 = OpLoad %9 %212 + OpSelectionMerge %277 None + OpSwitch %22 %242 + %242 = OpLabel + %244 = OpCompositeExtract %6 %178 0 + %246 = OpCompositeExtract %6 %213 0 + %247 = OpFOrdLessThan %11 %244 %246 + OpSelectionMerge %249 None + OpBranchConditional %247 %248 %249 + %248 = OpLabel + OpBranch %277 + %249 = OpLabel + %251 = OpCompositeExtract %6 %178 1 + %253 = OpCompositeExtract %6 %213 1 + %254 = OpFOrdLessThan %11 %251 %253 + OpSelectionMerge %256 None + OpBranchConditional %254 %255 %256 + %255 = OpLabel + OpBranch %277 + %256 = OpLabel + %262 = OpCompositeExtract %6 %213 2 + %263 = OpFAdd %6 %246 %262 + %264 = OpFOrdGreaterThan %11 %244 %263 + OpSelectionMerge %266 None + OpBranchConditional %264 %265 %266 + %265 = OpLabel + OpBranch %277 + %266 = OpLabel + %272 = OpCompositeExtract %6 %213 3 + %273 = OpFAdd %6 %253 %272 + %274 = OpFOrdGreaterThan %11 %251 %273 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + OpBranch %277 + %276 = OpLabel + OpBranch %277 + %277 = OpLabel + %291 = OpPhi %11 %31 %248 %31 %255 %31 %265 %31 %275 %66 %276 + OpSelectionMerge %232 None + OpBranchConditional %291 %215 %232 + %215 = OpLabel + OpStore %200 %103 + %217 = OpAccessChain %23 %200 %289 %22 + %218 = OpLoad %6 %217 + %219 = OpConvertFToS %73 %218 + OpStore %201 %103 + %221 = OpAccessChain %23 %201 %289 %33 + %222 = OpLoad %6 %221 + %223 = OpConvertFToS %73 %222 + %224 = OpIMul %73 %219 %223 + %226 = OpIMul %73 %289 %146 + %227 = OpIAdd %73 %224 %226 + %228 = OpIAdd %73 %227 %149 + %229 = OpSMod %73 %228 %151 + OpStore %202 %133 + %230 = OpAccessChain %10 %202 %229 + %231 = OpLoad %9 %230 + OpBranch %232 + %232 = OpLabel + %294 = OpPhi %9 %290 %277 %231 %215 + OpBranch %233 + %233 = OpLabel + %235 = OpIAdd %73 %289 %158 + OpBranch %205 + %236 = OpLabel + OpStore %180 %290 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 426 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %165 %180 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %165 "gl_FragCoord" + OpName %168 "buf0" + OpMemberName %168 0 "resolution" + OpName %170 "" + OpName %180 "_GLF_color" + OpDecorate %165 BuiltIn FragCoord + OpMemberDecorate %168 0 Offset 0 + OpDecorate %168 Block + OpDecorate %170 DescriptorSet 0 + OpDecorate %170 Binding 0 + OpDecorate %180 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %9 = OpTypeVector %6 4 + %10 = OpTypePointer Function %9 + %11 = OpTypeBool + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Function %6 + %31 = OpConstantFalse %11 + %33 = OpConstant %21 1 + %66 = OpConstantTrue %11 + %70 = OpConstant %6 0.5 + %71 = OpConstant %6 1 + %72 = OpConstantComposite %9 %70 %70 %71 %71 + %73 = OpTypeInt 32 1 + %76 = OpConstant %73 0 + %83 = OpConstant %73 8 + %85 = OpConstant %21 8 + %86 = OpTypeArray %9 %85 + %87 = OpConstant %6 4 + %88 = OpConstant %6 20 + %89 = OpConstantComposite %9 %87 %87 %88 %87 + %90 = OpConstantComposite %9 %87 %87 %87 %88 + %91 = OpConstantComposite %9 %87 %88 %88 %87 + %92 = OpConstant %6 8 + %93 = OpConstantComposite %9 %88 %87 %87 %92 + %94 = OpConstant %6 6 + %95 = OpConstant %6 2 + %96 = OpConstantComposite %9 %92 %94 %87 %95 + %97 = OpConstant %6 12 + %98 = OpConstantComposite %9 %95 %97 %95 %87 + %99 = OpConstant %6 16 + %100 = OpConstantComposite %9 %99 %95 %87 %87 + %101 = OpConstant %6 22 + %102 = OpConstantComposite %9 %97 %101 %87 %87 + %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102 + %108 = OpTypePointer Function %86 + %115 = OpConstant %21 16 + %116 = OpTypeArray %9 %115 + %117 = OpConstant %6 0 + %118 = OpConstantComposite %9 %117 %117 %117 %71 + %119 = OpConstantComposite %9 %70 %117 %117 %71 + %120 = OpConstantComposite %9 %117 %70 %117 %71 + %121 = OpConstantComposite %9 %70 %70 %117 %71 + %122 = OpConstantComposite %9 %117 %117 %70 %71 + %123 = OpConstantComposite %9 %70 %117 %70 %71 + %124 = OpConstantComposite %9 %117 %70 %70 %71 + %125 = OpConstantComposite %9 %70 %70 %70 %71 + %126 = OpConstantComposite %9 %71 %117 %117 %71 + %127 = OpConstantComposite %9 %117 %71 %117 %71 + %128 = OpConstantComposite %9 %71 %71 %117 %71 + %129 = OpConstantComposite %9 %117 %117 %71 %71 + %130 = OpConstantComposite %9 %71 %117 %71 %71 + %131 = OpConstantComposite %9 %117 %71 %71 %71 + %132 = OpConstantComposite %9 %71 %71 %71 %71 + %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132 + %146 = OpConstant %73 9 + %149 = OpConstant %73 11 + %151 = OpConstant %73 16 + %153 = OpTypePointer Function %116 + %158 = OpConstant %73 1 + %164 = OpTypePointer Input %9 + %165 = OpVariable %164 Input + %168 = OpTypeStruct %7 + %169 = OpTypePointer Uniform %168 + %170 = OpVariable %169 Uniform + %171 = OpTypePointer Uniform %7 + %176 = OpConstant %6 32 + %179 = OpTypePointer Output %9 + %180 = OpVariable %179 Output + %425 = OpConstantNull %73 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %199 = OpVariable %108 Function + %200 = OpVariable %108 Function + %201 = OpVariable %108 Function + %202 = OpVariable %153 Function + %166 = OpLoad %9 %165 + %167 = OpVectorShuffle %7 %166 %166 0 1 + %172 = OpAccessChain %171 %170 %76 + %173 = OpLoad %7 %172 + %174 = OpFDiv %7 %167 %173 + %177 = OpVectorTimesScalar %7 %174 %176 + %178 = OpExtInst %7 %1 Floor %177 + OpBranch %205 + %205 = OpLabel + %290 = OpPhi %9 %72 %5 %294 %233 + %289 = OpPhi %73 %425 %5 %235 %233 + %208 = OpSLessThan %11 %289 %83 + OpLoopMerge %236 %233 Unroll + OpBranchConditional %208 %209 %236 + %209 = OpLabel + OpStore %199 %103 + %212 = OpAccessChain %10 %199 %289 + %213 = OpLoad %9 %212 + OpSelectionMerge %277 None + OpSwitch %22 %242 + %242 = OpLabel + %244 = OpCompositeExtract %6 %178 0 + %246 = OpCompositeExtract %6 %213 0 + %247 = OpFOrdLessThan %11 %244 %246 + OpSelectionMerge %249 None + OpBranchConditional %247 %248 %249 + %248 = OpLabel + OpBranch %277 + %249 = OpLabel + %251 = OpCompositeExtract %6 %178 1 + %253 = OpCompositeExtract %6 %213 1 + %254 = OpFOrdLessThan %11 %251 %253 + OpSelectionMerge %256 None + OpBranchConditional %254 %255 %256 + %255 = OpLabel + OpBranch %277 + %256 = OpLabel + %262 = OpCompositeExtract %6 %213 2 + %263 = OpFAdd %6 %246 %262 + %264 = OpFOrdGreaterThan %11 %244 %263 + OpSelectionMerge %266 None + OpBranchConditional %264 %265 %266 + %265 = OpLabel + OpBranch %277 + %266 = OpLabel + %272 = OpCompositeExtract %6 %213 3 + %273 = OpFAdd %6 %253 %272 + %274 = OpFOrdGreaterThan %11 %251 %273 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + OpBranch %277 + %276 = OpLabel + OpBranch %277 + %277 = OpLabel + %291 = OpPhi %11 %31 %248 %31 %255 %31 %265 %31 %275 %66 %276 + OpSelectionMerge %232 None + OpBranchConditional %291 %215 %232 + %215 = OpLabel + OpStore %200 %103 + %217 = OpAccessChain %23 %200 %289 %22 + %218 = OpLoad %6 %217 + %219 = OpConvertFToS %73 %218 + OpStore %201 %103 + %221 = OpAccessChain %23 %201 %289 %33 + %222 = OpLoad %6 %221 + %223 = OpConvertFToS %73 %222 + %224 = OpIMul %73 %219 %223 + %226 = OpIMul %73 %289 %146 + %227 = OpIAdd %73 %224 %226 + %228 = OpIAdd %73 %227 %149 + %229 = OpSMod %73 %228 %151 + OpStore %202 %133 + %230 = OpAccessChain %10 %202 %229 + %231 = OpLoad %9 %230 + OpBranch %232 + %232 = OpLabel + %294 = OpPhi %9 %290 %277 %231 %215 + OpBranch %233 + %233 = OpLabel + %235 = OpIAdd %73 %289 %158 + OpBranch %205 + %236 = OpLabel + OpStore %180 %290 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle.amber b/vulkan/amber/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle.amber new file mode 100644 index 0000000..7fe3860 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle.amber @@ -0,0 +1,446 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Three shaders diff: mutate var, vector shuffle + +# The test renders three images using semantically equivalent shaders, and then +# checks that the images are similar. +# The test passes because the shaders have the same semantics and so the images +# should be the same. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 107 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %74 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %74 "_GLF_color" + OpName %100 "indexable" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %74 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %27 = OpTypeInt 32 0 + %32 = OpConstant %6 10 + %47 = OpConstant %18 10 + %51 = OpConstant %18 100 + %60 = OpTypeBool + %62 = OpConstant %18 4 + %65 = OpConstant %18 1000 + %71 = OpConstant %18 1 + %73 = OpTypePointer Output %10 + %74 = OpVariable %73 Output + %75 = OpConstant %27 16 + %76 = OpTypeArray %10 %75 + %77 = OpConstant %6 0 + %78 = OpConstant %6 1 + %79 = OpConstantComposite %10 %77 %77 %77 %78 + %80 = OpConstant %6 0.5 + %81 = OpConstantComposite %10 %80 %77 %77 %78 + %82 = OpConstantComposite %10 %77 %80 %77 %78 + %83 = OpConstantComposite %10 %80 %80 %77 %78 + %84 = OpConstantComposite %10 %77 %77 %80 %78 + %85 = OpConstantComposite %10 %80 %77 %80 %78 + %86 = OpConstantComposite %10 %77 %80 %80 %78 + %87 = OpConstantComposite %10 %80 %80 %80 %78 + %88 = OpConstantComposite %10 %78 %77 %77 %78 + %89 = OpConstantComposite %10 %77 %78 %77 %78 + %90 = OpConstantComposite %10 %78 %78 %77 %78 + %91 = OpConstantComposite %10 %77 %77 %78 %78 + %92 = OpConstantComposite %10 %78 %77 %78 %78 + %93 = OpConstantComposite %10 %77 %78 %78 %78 + %94 = OpConstantComposite %10 %78 %78 %78 %78 + %95 = OpConstantComposite %76 %79 %81 %82 %83 %84 %85 %86 %87 %79 %88 %89 %90 %91 %92 %93 %94 + %97 = OpConstant %18 16 + %99 = OpTypePointer Function %76 + %101 = OpTypePointer Function %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %100 = OpVariable %99 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + %31 = OpCompositeExtract %6 %23 0 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %37 = OpCompositeExtract %6 %23 1 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %48 = OpIMul %18 %39 %47 + %49 = OpIAdd %18 %34 %48 + OpBranch %53 + %53 = OpLabel + %106 = OpPhi %18 %51 %5 %69 %54 + %104 = OpPhi %18 %19 %5 %72 %54 + %61 = OpSLessThan %60 %104 %49 + OpLoopMerge %55 %54 None + OpBranchConditional %61 %54 %55 + %54 = OpLabel + %64 = OpIMul %18 %62 %106 + %67 = OpISub %18 %65 %106 + %68 = OpIMul %18 %64 %67 + %69 = OpSDiv %18 %68 %65 + %72 = OpIAdd %18 %104 %71 + OpBranch %53 + %55 = OpLabel + %98 = OpSMod %18 %106 %97 + OpStore %100 %95 + %102 = OpAccessChain %101 %100 %98 + %103 = OpLoad %10 %102 + OpStore %74 %103 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 263 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %74 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %74 "_GLF_color" + OpName %100 "indexable" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %74 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %27 = OpTypeInt 32 0 + %32 = OpConstant %6 10 + %47 = OpConstant %18 10 + %51 = OpConstant %18 100 + %60 = OpTypeBool + %62 = OpConstant %18 4 + %65 = OpConstant %18 1000 + %71 = OpConstant %18 1 + %73 = OpTypePointer Output %10 + %74 = OpVariable %73 Output + %75 = OpConstant %27 16 + %76 = OpTypeArray %10 %75 + %77 = OpConstant %6 0 + %78 = OpConstant %6 1 + %79 = OpConstantComposite %10 %77 %77 %77 %78 + %80 = OpConstant %6 0.5 + %81 = OpConstantComposite %10 %80 %77 %77 %78 + %82 = OpConstantComposite %10 %77 %80 %77 %78 + %83 = OpConstantComposite %10 %80 %80 %77 %78 + %84 = OpConstantComposite %10 %77 %77 %80 %78 + %85 = OpConstantComposite %10 %80 %77 %80 %78 + %86 = OpConstantComposite %10 %77 %80 %80 %78 + %87 = OpConstantComposite %10 %80 %80 %80 %78 + %88 = OpConstantComposite %10 %78 %77 %77 %78 + %89 = OpConstantComposite %10 %77 %78 %77 %78 + %90 = OpConstantComposite %10 %78 %78 %77 %78 + %91 = OpConstantComposite %10 %77 %77 %78 %78 + %92 = OpConstantComposite %10 %78 %77 %78 %78 + %93 = OpConstantComposite %10 %77 %78 %78 %78 + %94 = OpConstantComposite %10 %78 %78 %78 %78 + %95 = OpConstantComposite %76 %79 %81 %82 %83 %84 %85 %86 %87 %79 %88 %89 %90 %91 %92 %93 %94 + %97 = OpConstant %18 16 + %99 = OpTypePointer Function %76 + %101 = OpTypePointer Function %10 + %234 = OpConstant %6 0 + %235 = OpConstantComposite %10 %234 %234 %234 %234 + %236 = OpConstantComposite %76 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %100 = OpVariable %99 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + %31 = OpCompositeExtract %6 %23 0 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %37 = OpCompositeExtract %6 %23 1 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %48 = OpIMul %18 %39 %47 + %49 = OpIAdd %18 %34 %48 + OpBranch %53 + %53 = OpLabel + %106 = OpPhi %18 %51 %5 %69 %54 + %104 = OpPhi %18 %19 %5 %72 %54 + %61 = OpSLessThan %60 %104 %49 + OpLoopMerge %55 %54 None + OpBranchConditional %61 %54 %55 + %54 = OpLabel + %64 = OpIMul %18 %62 %106 + %67 = OpISub %18 %65 %106 + %68 = OpIMul %18 %64 %67 + %69 = OpSDiv %18 %68 %65 + %72 = OpIAdd %18 %104 %71 + OpBranch %53 + %55 = OpLabel + %98 = OpSMod %18 %106 %97 + OpStore %100 %95 + %262 = OpLoad %76 %100 + OpStore %100 %236 + OpStore %100 %262 + %231 = OpVectorShuffle %7 %89 %85 1 4 + %102 = OpAccessChain %101 %100 %98 + %103 = OpLoad %10 %102 + OpStore %74 %103 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_2_vertex_shader PASSTHROUGH + +SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 237 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %74 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %74 "_GLF_color" + OpName %100 "indexable" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %74 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %27 = OpTypeInt 32 0 + %32 = OpConstant %6 10 + %47 = OpConstant %18 10 + %51 = OpConstant %18 100 + %60 = OpTypeBool + %62 = OpConstant %18 4 + %65 = OpConstant %18 1000 + %71 = OpConstant %18 1 + %73 = OpTypePointer Output %10 + %74 = OpVariable %73 Output + %75 = OpConstant %27 16 + %76 = OpTypeArray %10 %75 + %77 = OpConstant %6 0 + %78 = OpConstant %6 1 + %79 = OpConstantComposite %10 %77 %77 %77 %78 + %80 = OpConstant %6 0.5 + %81 = OpConstantComposite %10 %80 %77 %77 %78 + %82 = OpConstantComposite %10 %77 %80 %77 %78 + %83 = OpConstantComposite %10 %80 %80 %77 %78 + %84 = OpConstantComposite %10 %77 %77 %80 %78 + %85 = OpConstantComposite %10 %80 %77 %80 %78 + %86 = OpConstantComposite %10 %77 %80 %80 %78 + %87 = OpConstantComposite %10 %80 %80 %80 %78 + %88 = OpConstantComposite %10 %78 %77 %77 %78 + %89 = OpConstantComposite %10 %77 %78 %77 %78 + %90 = OpConstantComposite %10 %78 %78 %77 %78 + %91 = OpConstantComposite %10 %77 %77 %78 %78 + %92 = OpConstantComposite %10 %78 %77 %78 %78 + %93 = OpConstantComposite %10 %77 %78 %78 %78 + %94 = OpConstantComposite %10 %78 %78 %78 %78 + %95 = OpConstantComposite %76 %79 %81 %82 %83 %84 %85 %86 %87 %79 %88 %89 %90 %91 %92 %93 %94 + %97 = OpConstant %18 16 + %99 = OpTypePointer Function %76 + %101 = OpTypePointer Function %10 + %234 = OpConstant %6 0 + %235 = OpConstantComposite %10 %234 %234 %234 %234 + %236 = OpConstantComposite %76 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %100 = OpVariable %99 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + %31 = OpCompositeExtract %6 %23 0 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %37 = OpCompositeExtract %6 %23 1 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %48 = OpIMul %18 %39 %47 + %49 = OpIAdd %18 %34 %48 + OpBranch %53 + %53 = OpLabel + %106 = OpPhi %18 %51 %5 %69 %54 + %104 = OpPhi %18 %19 %5 %72 %54 + %61 = OpSLessThan %60 %104 %49 + OpLoopMerge %55 %54 None + OpBranchConditional %61 %54 %55 + %54 = OpLabel + %64 = OpIMul %18 %62 %106 + %67 = OpISub %18 %65 %106 + %68 = OpIMul %18 %64 %67 + %69 = OpSDiv %18 %68 %65 + %72 = OpIAdd %18 %104 %71 + OpBranch %53 + %55 = OpLabel + %98 = OpSMod %18 %106 %97 + OpStore %100 %95 + %231 = OpVectorShuffle %7 %89 %85 1 4 + %102 = OpAccessChain %101 %100 %98 + %103 = OpLoad %10 %102 + OpStore %74 %103 + OpReturn + OpFunctionEnd +END + +# uniforms for variant_2 + +# resolution +BUFFER variant_2_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_2_pipeline + ATTACH variant_2_vertex_shader + ATTACH variant_2_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_2_framebuffer AS color LOCATION 0 + BIND BUFFER variant_2_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_2_pipeline 0 0 0 255 + +CLEAR variant_2_pipeline +RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals.amber b/vulkan/amber/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals.amber new file mode 100644 index 0000000..1d1ed0c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals.amber @@ -0,0 +1,650 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with more complex conditionals + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 164 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 %139 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "checkSwap(f1;f1;" + OpName %10 "a" + OpName %11 "b" + OpName %16 "gl_FragCoord" + OpName %23 "buf1" + OpMemberName %23 0 "resolution" + OpName %25 "" + OpName %49 "i" + OpName %61 "data" + OpName %66 "buf0" + OpMemberName %66 0 "injectionSwitch" + OpName %68 "" + OpName %76 "i" + OpName %85 "j" + OpName %100 "doSwap" + OpName %103 "param" + OpName %106 "param" + OpName %113 "temp" + OpName %139 "_GLF_color" + OpDecorate %16 BuiltIn FragCoord + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 1 + OpMemberDecorate %66 0 Offset 0 + OpDecorate %66 Block + OpDecorate %68 DescriptorSet 0 + OpDecorate %68 Binding 0 + OpDecorate %139 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeBool + %9 = OpTypeFunction %8 %7 %7 + %14 = OpTypeVector %6 4 + %15 = OpTypePointer Input %14 + %16 = OpVariable %15 Input + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 1 + %19 = OpTypePointer Input %6 + %22 = OpTypeVector %6 2 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpTypeInt 32 1 + %27 = OpConstant %26 0 + %28 = OpTypePointer Uniform %6 + %31 = OpConstant %6 2 + %34 = OpTypePointer Function %8 + %48 = OpTypePointer Function %26 + %56 = OpConstant %26 10 + %58 = OpConstant %17 10 + %59 = OpTypeArray %6 %58 + %60 = OpTypePointer Function %59 + %66 = OpTypeStruct %22 + %67 = OpTypePointer Uniform %66 + %68 = OpVariable %67 Uniform + %74 = OpConstant %26 1 + %83 = OpConstant %26 9 + %129 = OpConstant %17 0 + %138 = OpTypePointer Output %14 + %139 = OpVariable %138 Output + %142 = OpConstant %6 10 + %144 = OpConstant %26 5 + %151 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %49 = OpVariable %48 Function + %61 = OpVariable %60 Function + %76 = OpVariable %48 Function + %85 = OpVariable %48 Function + %100 = OpVariable %34 Function + %103 = OpVariable %7 Function + %106 = OpVariable %7 Function + %113 = OpVariable %7 Function + OpStore %49 %27 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %26 %49 + %57 = OpSLessThan %8 %55 %56 + OpBranchConditional %57 %51 %52 + %51 = OpLabel + %62 = OpLoad %26 %49 + %63 = OpLoad %26 %49 + %64 = OpISub %26 %56 %63 + %65 = OpConvertSToF %6 %64 + %69 = OpAccessChain %28 %68 %27 %18 + %70 = OpLoad %6 %69 + %71 = OpFMul %6 %65 %70 + %72 = OpAccessChain %7 %61 %62 + OpStore %72 %71 + OpBranch %53 + %53 = OpLabel + %73 = OpLoad %26 %49 + %75 = OpIAdd %26 %73 %74 + OpStore %49 %75 + OpBranch %50 + %52 = OpLabel + OpStore %76 %27 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %26 %76 + %84 = OpSLessThan %8 %82 %83 + OpBranchConditional %84 %78 %79 + %78 = OpLabel + OpStore %85 %27 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %26 %85 + %92 = OpSLessThan %8 %91 %56 + OpBranchConditional %92 %87 %88 + %87 = OpLabel + %93 = OpLoad %26 %85 + %94 = OpLoad %26 %76 + %95 = OpIAdd %26 %94 %74 + %96 = OpSLessThan %8 %93 %95 + OpSelectionMerge %98 None + OpBranchConditional %96 %97 %98 + %97 = OpLabel + OpBranch %89 + %98 = OpLabel + %101 = OpLoad %26 %76 + %102 = OpLoad %26 %85 + %104 = OpAccessChain %7 %61 %101 + %105 = OpLoad %6 %104 + OpStore %103 %105 + %107 = OpAccessChain %7 %61 %102 + %108 = OpLoad %6 %107 + OpStore %106 %108 + %109 = OpFunctionCall %8 %12 %103 %106 + OpStore %100 %109 + %110 = OpLoad %8 %100 + OpSelectionMerge %112 None + OpBranchConditional %110 %111 %112 + %111 = OpLabel + %114 = OpLoad %26 %76 + %115 = OpAccessChain %7 %61 %114 + %116 = OpLoad %6 %115 + OpStore %113 %116 + %117 = OpLoad %26 %76 + %118 = OpLoad %26 %85 + %119 = OpAccessChain %7 %61 %118 + %120 = OpLoad %6 %119 + %121 = OpAccessChain %7 %61 %117 + OpStore %121 %120 + %122 = OpLoad %26 %85 + %123 = OpLoad %6 %113 + %124 = OpAccessChain %7 %61 %122 + OpStore %124 %123 + OpBranch %112 + %112 = OpLabel + OpBranch %89 + %89 = OpLabel + %125 = OpLoad %26 %85 + %126 = OpIAdd %26 %125 %74 + OpStore %85 %126 + OpBranch %86 + %88 = OpLabel + OpBranch %80 + %80 = OpLabel + %127 = OpLoad %26 %76 + %128 = OpIAdd %26 %127 %74 + OpStore %76 %128 + OpBranch %77 + %79 = OpLabel + %130 = OpAccessChain %19 %16 %129 + %131 = OpLoad %6 %130 + %132 = OpAccessChain %28 %25 %27 %129 + %133 = OpLoad %6 %132 + %134 = OpFDiv %6 %133 %31 + %135 = OpFOrdLessThan %8 %131 %134 + OpSelectionMerge %137 None + OpBranchConditional %135 %136 %153 + %136 = OpLabel + %140 = OpAccessChain %7 %61 %27 + %141 = OpLoad %6 %140 + %143 = OpFDiv %6 %141 %142 + %145 = OpAccessChain %7 %61 %144 + %146 = OpLoad %6 %145 + %147 = OpFDiv %6 %146 %142 + %148 = OpAccessChain %7 %61 %83 + %149 = OpLoad %6 %148 + %150 = OpFDiv %6 %149 %142 + %152 = OpCompositeConstruct %14 %143 %147 %150 %151 + OpStore %139 %152 + OpBranch %137 + %153 = OpLabel + %154 = OpAccessChain %7 %61 %144 + %155 = OpLoad %6 %154 + %156 = OpFDiv %6 %155 %142 + %157 = OpAccessChain %7 %61 %83 + %158 = OpLoad %6 %157 + %159 = OpFDiv %6 %158 %142 + %160 = OpAccessChain %7 %61 %27 + %161 = OpLoad %6 %160 + %162 = OpFDiv %6 %161 %142 + %163 = OpCompositeConstruct %14 %156 %159 %162 %151 + OpStore %139 %163 + OpBranch %137 + %137 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %8 None %9 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %35 = OpVariable %34 Function + %20 = OpAccessChain %19 %16 %18 + %21 = OpLoad %6 %20 + %29 = OpAccessChain %28 %25 %27 %18 + %30 = OpLoad %6 %29 + %32 = OpFDiv %6 %30 %31 + %33 = OpFOrdLessThan %8 %21 %32 + OpSelectionMerge %37 None + OpBranchConditional %33 %36 %41 + %36 = OpLabel + %38 = OpLoad %6 %10 + %39 = OpLoad %6 %11 + %40 = OpFOrdGreaterThan %8 %38 %39 + OpStore %35 %40 + OpBranch %37 + %41 = OpLabel + %42 = OpLoad %6 %10 + %43 = OpLoad %6 %11 + %44 = OpFOrdLessThan %8 %42 %43 + OpStore %35 %44 + OpBranch %37 + %37 = OpLabel + %45 = OpLoad %8 %35 + OpReturnValue %45 + OpFunctionEnd +END + +# uniforms for reference + +# injectionSwitch +BUFFER reference_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 816 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 %139 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "checkSwap(f1;f1;" + OpName %10 "a" + OpName %11 "b" + OpName %16 "gl_FragCoord" + OpName %23 "buf1" + OpMemberName %23 0 "resolution" + OpName %25 "" + OpName %49 "i" + OpName %61 "data" + OpName %66 "buf0" + OpMemberName %66 0 "injectionSwitch" + OpName %68 "" + OpName %76 "i" + OpName %85 "j" + OpName %100 "doSwap" + OpName %103 "param" + OpName %106 "param" + OpName %113 "temp" + OpName %139 "_GLF_color" + OpDecorate %16 BuiltIn FragCoord + OpMemberDecorate %23 0 Offset 0 + OpDecorate %23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 1 + OpMemberDecorate %66 0 Offset 0 + OpDecorate %66 Block + OpDecorate %68 DescriptorSet 0 + OpDecorate %68 Binding 0 + OpDecorate %139 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeBool + %9 = OpTypeFunction %8 %7 %7 + %14 = OpTypeVector %6 4 + %15 = OpTypePointer Input %14 + %16 = OpVariable %15 Input + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 1 + %19 = OpTypePointer Input %6 + %22 = OpTypeVector %6 2 + %23 = OpTypeStruct %22 + %24 = OpTypePointer Uniform %23 + %25 = OpVariable %24 Uniform + %26 = OpTypeInt 32 1 + %27 = OpConstant %26 0 + %28 = OpTypePointer Uniform %6 + %31 = OpConstant %6 2 + %34 = OpTypePointer Function %8 + %48 = OpTypePointer Function %26 + %56 = OpConstant %26 10 + %58 = OpConstant %17 10 + %59 = OpTypeArray %6 %58 + %60 = OpTypePointer Function %59 + %66 = OpTypeStruct %22 + %67 = OpTypePointer Uniform %66 + %68 = OpVariable %67 Uniform + %74 = OpConstant %26 1 + %83 = OpConstant %26 9 + %129 = OpConstant %17 0 + %138 = OpTypePointer Output %14 + %139 = OpVariable %138 Output + %142 = OpConstant %6 10 + %144 = OpConstant %26 5 + %151 = OpConstant %6 1 + %285 = OpConstant %6 0 + %387 = OpConstantFalse %8 + %815 = OpConstantTrue %8 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %49 = OpVariable %48 Function + %61 = OpVariable %60 Function + %76 = OpVariable %48 Function + %85 = OpVariable %48 Function + %100 = OpVariable %34 Function + %103 = OpVariable %7 Function + %106 = OpVariable %7 Function + %113 = OpVariable %7 Function + OpStore %49 %27 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %26 %49 + %57 = OpSLessThan %8 %55 %56 + OpBranchConditional %57 %51 %52 + %51 = OpLabel + %62 = OpLoad %26 %49 + %63 = OpLoad %26 %49 + %64 = OpISub %26 %56 %63 + %65 = OpConvertSToF %6 %64 + %69 = OpAccessChain %28 %68 %27 %18 + %70 = OpLoad %6 %69 + %71 = OpFMul %6 %65 %70 + %72 = OpAccessChain %7 %61 %62 + OpStore %72 %71 + OpBranch %53 + %53 = OpLabel + %73 = OpLoad %26 %49 + %75 = OpIAdd %26 %73 %74 + OpStore %49 %75 + OpBranch %50 + %52 = OpLabel + OpStore %76 %27 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %26 %76 + %84 = OpSLessThan %8 %82 %83 + OpBranchConditional %84 %78 %79 + %78 = OpLabel + OpStore %85 %27 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %26 %85 + %92 = OpSLessThan %8 %91 %56 + OpBranchConditional %92 %87 %88 + %87 = OpLabel + %93 = OpLoad %26 %85 + %94 = OpLoad %26 %76 + %95 = OpIAdd %26 %94 %74 + %96 = OpSLessThan %8 %93 %95 + OpSelectionMerge %98 None + OpBranchConditional %96 %97 %98 + %97 = OpLabel + OpBranch %89 + %98 = OpLabel + %101 = OpLoad %26 %76 + %102 = OpLoad %26 %85 + %104 = OpAccessChain %7 %61 %101 + %105 = OpLoad %6 %104 + OpStore %103 %105 + %107 = OpAccessChain %7 %61 %102 + %108 = OpLoad %6 %107 + OpStore %106 %108 + %109 = OpFunctionCall %8 %12 %103 %106 + OpStore %100 %109 + %110 = OpLoad %8 %100 + OpSelectionMerge %112 None + OpBranchConditional %110 %111 %112 + %111 = OpLabel + %114 = OpLoad %26 %76 + %115 = OpAccessChain %7 %61 %114 + %116 = OpLoad %6 %115 + OpStore %113 %116 + %117 = OpLoad %26 %76 + %118 = OpLoad %26 %85 + %119 = OpAccessChain %7 %61 %118 + %120 = OpLoad %6 %119 + %121 = OpAccessChain %7 %61 %117 + OpStore %121 %120 + %122 = OpLoad %26 %85 + %123 = OpLoad %6 %113 + %124 = OpAccessChain %7 %61 %122 + OpStore %124 %123 + OpBranch %112 + %112 = OpLabel + OpBranch %89 + %89 = OpLabel + %125 = OpLoad %26 %85 + %126 = OpIAdd %26 %125 %74 + OpStore %85 %126 + OpBranch %86 + %88 = OpLabel + OpBranch %80 + %80 = OpLabel + %127 = OpLoad %26 %76 + %128 = OpIAdd %26 %127 %74 + OpStore %76 %128 + OpBranch %77 + %79 = OpLabel + %130 = OpAccessChain %19 %16 %129 + %131 = OpLoad %6 %130 + %132 = OpAccessChain %28 %25 %27 %129 + %133 = OpLoad %6 %132 + %134 = OpFDiv %6 %133 %31 + %135 = OpFOrdLessThan %8 %131 %134 + OpSelectionMerge %137 None + OpBranchConditional %135 %136 %153 + %136 = OpLabel + %140 = OpAccessChain %7 %61 %27 + %141 = OpLoad %6 %140 + %143 = OpFDiv %6 %141 %142 + %145 = OpAccessChain %7 %61 %144 + %146 = OpLoad %6 %145 + %147 = OpFDiv %6 %146 %142 + %148 = OpAccessChain %7 %61 %83 + %149 = OpLoad %6 %148 + %150 = OpFDiv %6 %149 %142 + %152 = OpCompositeConstruct %14 %143 %147 %150 %151 + OpStore %139 %152 + OpBranch %137 + %153 = OpLabel + %154 = OpAccessChain %7 %61 %144 + %155 = OpLoad %6 %154 + %156 = OpFDiv %6 %155 %142 + %157 = OpAccessChain %7 %61 %83 + %158 = OpLoad %6 %157 + %159 = OpFDiv %6 %158 %142 + %160 = OpAccessChain %7 %61 %27 + %161 = OpLoad %6 %160 + %162 = OpFDiv %6 %161 %142 + %163 = OpCompositeConstruct %14 %156 %159 %162 %151 + OpStore %139 %163 + OpBranch %137 + %137 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %8 None %9 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %35 = OpVariable %34 Function + %20 = OpAccessChain %19 %16 %18 + %21 = OpLoad %6 %20 + %29 = OpAccessChain %28 %25 %27 %18 + %30 = OpLoad %6 %29 + %32 = OpFDiv %6 %30 %31 + %33 = OpFOrdLessThan %8 %21 %32 + OpBranch %36 + %36 = OpLabel + OpSelectionMerge %351 None + OpBranchConditional %33 %352 %354 + %352 = OpLabel + %353 = OpLoad %6 %10 + OpBranch %351 + %354 = OpLabel + %355 = OpCopyObject %6 %285 + OpBranch %351 + %351 = OpLabel + %38 = OpPhi %6 %353 %352 %355 %354 + OpSelectionMerge %386 None + OpBranchConditional %387 %385 %385 + %385 = OpLabel + OpSelectionMerge %356 None + OpBranchConditional %33 %357 %359 + %357 = OpLabel + %358 = OpLoad %6 %11 + OpBranch %356 + %359 = OpLabel + %360 = OpCopyObject %6 %285 + OpBranch %356 + %356 = OpLabel + %39 = OpPhi %6 %358 %357 %360 %359 + %40 = OpFOrdGreaterThan %8 %38 %39 + OpBranch %362 + %362 = OpLabel + OpSelectionMerge %479 None + OpBranchConditional %33 %480 %479 + %480 = OpLabel + OpStore %35 %40 + OpBranch %479 + %479 = OpLabel + OpBranchConditional %815 %361 %386 + %361 = OpLabel + OpBranch %386 + %386 = OpLabel + OpBranch %41 + %41 = OpLabel + OpSelectionMerge %363 None + OpBranchConditional %33 %366 %364 + %364 = OpLabel + %365 = OpLoad %6 %10 + OpBranch %363 + %366 = OpLabel + %367 = OpCopyObject %6 %285 + OpBranch %363 + %363 = OpLabel + %42 = OpPhi %6 %365 %364 %367 %366 + OpSelectionMerge %368 None + OpBranchConditional %33 %371 %369 + %369 = OpLabel + %370 = OpLoad %6 %11 + OpBranch %368 + %371 = OpLabel + %372 = OpCopyObject %6 %285 + OpBranch %368 + %368 = OpLabel + %43 = OpPhi %6 %370 %369 %372 %371 + %44 = OpFOrdLessThan %8 %42 %43 + OpSelectionMerge %373 None + OpBranchConditional %33 %373 %374 + %374 = OpLabel + OpStore %35 %44 + OpBranch %373 + %373 = OpLabel + OpBranch %37 + %37 = OpLabel + %45 = OpLoad %8 %35 + OpReturnValue %45 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract.amber b/vulkan/amber/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract.amber new file mode 100644 index 0000000..c9766f5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract.amber @@ -0,0 +1,329 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Two shaders diff: mutate var, comp extract/construct + +# The test renders two images using semantically equivalent shaders, and then +# checks that the images are similar. +# The test passes because the shaders have the same semantics and so the images +# should be the same. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 138 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 %76 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %47 "gl_FragCoord" + OpName %50 "buf0" + OpMemberName %50 0 "resolution" + OpName %52 "" + OpName %76 "_GLF_color" + OpName %104 "indexable" + OpDecorate %47 BuiltIn FragCoord + OpMemberDecorate %50 0 Offset 0 + OpDecorate %50 Block + OpDecorate %52 DescriptorSet 0 + OpDecorate %52 Binding 0 + OpDecorate %76 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %13 = OpConstant %6 0 + %20 = OpConstant %6 1 + %21 = OpTypeBool + %28 = OpConstant %6 3 + %33 = OpConstant %6 2 + %41 = OpTypeFloat 32 + %42 = OpTypeVector %41 2 + %45 = OpTypeVector %41 4 + %46 = OpTypePointer Input %45 + %47 = OpVariable %46 Input + %50 = OpTypeStruct %42 + %51 = OpTypePointer Uniform %50 + %52 = OpVariable %51 Uniform + %53 = OpTypePointer Uniform %42 + %58 = OpConstant %41 8 + %62 = OpTypeInt 32 0 + %68 = OpConstant %6 8 + %75 = OpTypePointer Output %45 + %76 = OpVariable %75 Output + %77 = OpConstant %62 16 + %78 = OpTypeArray %45 %77 + %79 = OpConstant %41 0 + %80 = OpConstant %41 1 + %81 = OpConstantComposite %45 %79 %79 %79 %80 + %82 = OpConstant %41 0.5 + %83 = OpConstantComposite %45 %82 %79 %79 %80 + %84 = OpConstantComposite %45 %79 %82 %79 %80 + %85 = OpConstantComposite %45 %82 %82 %79 %80 + %86 = OpConstantComposite %45 %79 %79 %82 %80 + %87 = OpConstantComposite %45 %82 %79 %82 %80 + %88 = OpConstantComposite %45 %79 %82 %82 %80 + %89 = OpConstantComposite %45 %82 %82 %82 %80 + %90 = OpConstantComposite %45 %80 %79 %79 %80 + %91 = OpConstantComposite %45 %79 %80 %79 %80 + %92 = OpConstantComposite %45 %80 %80 %79 %80 + %93 = OpConstantComposite %45 %79 %79 %80 %80 + %94 = OpConstantComposite %45 %80 %79 %80 %80 + %95 = OpConstantComposite %45 %79 %80 %80 %80 + %96 = OpConstantComposite %45 %80 %80 %80 %80 + %97 = OpConstantComposite %78 %81 %83 %84 %85 %86 %87 %88 %89 %81 %90 %91 %92 %93 %94 %95 %96 + %101 = OpConstant %6 16 + %103 = OpTypePointer Function %78 + %105 = OpTypePointer Function %45 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %104 = OpVariable %103 Function + %48 = OpLoad %45 %47 + %49 = OpVectorShuffle %42 %48 %48 0 1 + %54 = OpAccessChain %53 %52 %13 + %55 = OpLoad %42 %54 + %56 = OpFDiv %42 %49 %55 + %59 = OpVectorTimesScalar %42 %56 %58 + %60 = OpExtInst %42 %1 Floor %59 + %66 = OpCompositeExtract %41 %60 0 + %67 = OpConvertFToS %6 %66 + %69 = OpIMul %6 %67 %68 + %72 = OpCompositeExtract %41 %60 1 + %73 = OpConvertFToS %6 %72 + %74 = OpIAdd %6 %69 %73 + OpBranch %111 + %111 = OpLabel + %135 = OpPhi %6 %13 %5 %128 %129 + %134 = OpPhi %6 %74 %5 %137 %129 + %114 = OpSGreaterThan %21 %134 %20 + OpLoopMerge %130 %129 None + OpBranchConditional %114 %115 %130 + %115 = OpLabel + %117 = OpBitwiseAnd %6 %134 %20 + %118 = OpIEqual %21 %117 %20 + OpSelectionMerge %126 None + OpBranchConditional %118 %119 %123 + %119 = OpLabel + %121 = OpIMul %6 %28 %134 + %122 = OpIAdd %6 %121 %20 + OpBranch %126 + %123 = OpLabel + %125 = OpSDiv %6 %134 %33 + OpBranch %126 + %126 = OpLabel + %137 = OpPhi %6 %122 %119 %125 %123 + %128 = OpIAdd %6 %135 %20 + OpBranch %129 + %129 = OpLabel + OpBranch %111 + %130 = OpLabel + %102 = OpSMod %6 %135 %101 + OpStore %104 %97 + %106 = OpAccessChain %105 %104 %102 + %107 = OpLoad %45 %106 + OpStore %76 %107 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 502 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 %76 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %47 "gl_FragCoord" + OpName %50 "buf0" + OpMemberName %50 0 "resolution" + OpName %52 "" + OpName %76 "_GLF_color" + OpName %104 "indexable" + OpDecorate %47 BuiltIn FragCoord + OpMemberDecorate %50 0 Offset 0 + OpDecorate %50 Block + OpDecorate %52 DescriptorSet 0 + OpDecorate %52 Binding 0 + OpDecorate %76 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %13 = OpConstant %6 0 + %20 = OpConstant %6 1 + %21 = OpTypeBool + %28 = OpConstant %6 3 + %33 = OpConstant %6 2 + %41 = OpTypeFloat 32 + %42 = OpTypeVector %41 2 + %45 = OpTypeVector %41 4 + %46 = OpTypePointer Input %45 + %47 = OpVariable %46 Input + %50 = OpTypeStruct %42 + %51 = OpTypePointer Uniform %50 + %52 = OpVariable %51 Uniform + %53 = OpTypePointer Uniform %42 + %58 = OpConstant %41 8 + %62 = OpTypeInt 32 0 + %68 = OpConstant %6 8 + %75 = OpTypePointer Output %45 + %76 = OpVariable %75 Output + %77 = OpConstant %62 16 + %78 = OpTypeArray %45 %77 + %79 = OpConstant %41 0 + %80 = OpConstant %41 1 + %81 = OpConstantComposite %45 %79 %79 %79 %80 + %82 = OpConstant %41 0.5 + %83 = OpConstantComposite %45 %82 %79 %79 %80 + %84 = OpConstantComposite %45 %79 %82 %79 %80 + %85 = OpConstantComposite %45 %82 %82 %79 %80 + %86 = OpConstantComposite %45 %79 %79 %82 %80 + %87 = OpConstantComposite %45 %82 %79 %82 %80 + %88 = OpConstantComposite %45 %79 %82 %82 %80 + %89 = OpConstantComposite %45 %82 %82 %82 %80 + %90 = OpConstantComposite %45 %80 %79 %79 %80 + %91 = OpConstantComposite %45 %79 %80 %79 %80 + %92 = OpConstantComposite %45 %80 %80 %79 %80 + %93 = OpConstantComposite %45 %79 %79 %80 %80 + %94 = OpConstantComposite %45 %80 %79 %80 %80 + %95 = OpConstantComposite %45 %79 %80 %80 %80 + %96 = OpConstantComposite %45 %80 %80 %80 %80 + %97 = OpConstantComposite %78 %81 %83 %84 %85 %86 %87 %88 %89 %81 %90 %91 %92 %93 %94 %95 %96 + %101 = OpConstant %6 16 + %103 = OpTypePointer Function %78 + %105 = OpTypePointer Function %45 + %403 = OpConstant %41 0 + %404 = OpConstantComposite %45 %403 %403 %403 %403 + %405 = OpConstantComposite %78 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %104 = OpVariable %103 Function + %48 = OpLoad %45 %47 + %49 = OpVectorShuffle %42 %48 %48 0 1 + %238 = OpCompositeConstruct %45 %79 %58 %49 + %54 = OpAccessChain %53 %52 %13 + %55 = OpLoad %42 %54 + %239 = OpCompositeConstruct %78 %86 %94 %88 %95 %96 %88 %88 %87 %92 %48 %86 %85 %84 %83 %91 %90 + %56 = OpFDiv %42 %49 %55 + %59 = OpVectorTimesScalar %42 %56 %58 + %60 = OpExtInst %42 %1 Floor %59 + %241 = OpCompositeConstruct %45 %59 %82 %80 + %66 = OpCompositeExtract %41 %60 0 + %67 = OpConvertFToS %6 %66 + %69 = OpIMul %6 %67 %68 + %72 = OpCompositeExtract %41 %60 1 + %73 = OpConvertFToS %6 %72 + %74 = OpIAdd %6 %69 %73 + OpBranch %111 + %111 = OpLabel + %135 = OpPhi %6 %13 %5 %128 %129 + %134 = OpPhi %6 %74 %5 %137 %129 + %114 = OpSGreaterThan %21 %134 %20 + OpLoopMerge %130 %129 None + OpBranchConditional %114 %115 %130 + %115 = OpLabel + %117 = OpBitwiseAnd %6 %134 %20 + %118 = OpIEqual %21 %117 %20 + OpSelectionMerge %126 None + OpBranchConditional %118 %119 %123 + %119 = OpLabel + %121 = OpIMul %6 %28 %134 + %122 = OpIAdd %6 %121 %20 + OpBranch %126 + %123 = OpLabel + %125 = OpSDiv %6 %134 %33 + OpBranch %126 + %126 = OpLabel + %137 = OpPhi %6 %122 %119 %125 %123 + %128 = OpIAdd %6 %135 %20 + OpBranch %129 + %129 = OpLabel + OpBranch %111 + %130 = OpLabel + %102 = OpSMod %6 %135 %101 + OpStore %104 %97 + %501 = OpLoad %78 %104 + OpStore %104 %405 + OpStore %104 %501 + %248 = OpCompositeExtract %45 %239 1 + %245 = OpCompositeConstruct %78 %87 %87 %91 %81 %87 %89 %94 %81 %91 %238 %86 %88 %87 %92 %94 %241 + %106 = OpAccessChain %105 %104 %102 + %107 = OpLoad %45 %106 + OpStore %76 %107 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down.amber b/vulkan/amber/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down.amber new file mode 100644 index 0000000..041141a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down.amber @@ -0,0 +1,536 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Two shaders with diff: some blocks moved down + +# The test renders two images using semantically equivalent shaders, and then +# checks that the images are similar. +# The test passes because the shaders have the same semantics and so the images +# should be the same. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 290 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %137 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %66 "c" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %137 "_GLF_color" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpDecorate %137 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %107 = OpConstant %76 2 + %116 = OpConstant %15 3 + %121 = OpConstant %6 1 + %136 = OpTypePointer Output %83 + %137 = OpVariable %136 Output + %149 = OpConstantFalse %26 + %152 = OpConstantTrue %26 + %261 = OpUndef %6 + %289 = OpConstant %6 0.125 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %81 = OpFMul %6 %80 %289 + %82 = OpExtInst %6 %1 Round %81 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpSelectionMerge %199 None + OpSwitch %77 %161 + %161 = OpLabel + OpBranch %162 + %162 = OpLabel + %248 = OpPhi %6 %14 %161 %251 %192 + %247 = OpPhi %15 %18 %161 %194 %192 + %165 = OpSLessThan %26 %247 %25 + OpLoopMerge %195 %192 None + OpBranchConditional %165 %166 %195 + %166 = OpLabel + %168 = OpSMod %15 %247 %29 + %169 = OpIEqual %26 %168 %31 + OpSelectionMerge %184 None + OpBranchConditional %169 %170 %173 + %170 = OpLabel + %172 = OpFAdd %6 %248 %35 + OpBranch %184 + %173 = OpLabel + %175 = OpConvertSToF %6 %247 + %177 = OpExtInst %6 %1 Round %82 + %178 = OpFMod %6 %175 %177 + %179 = OpFOrdLessThanEqual %26 %178 %44 + OpSelectionMerge %183 None + OpBranchConditional %179 %180 %183 + %180 = OpLabel + %182 = OpFAdd %6 %248 %48 + OpBranch %183 + %183 = OpLabel + %252 = OpPhi %6 %248 %173 %182 %180 + OpBranch %184 + %184 = OpLabel + %251 = OpPhi %6 %172 %170 %252 %183 + %186 = OpConvertSToF %6 %247 + %188 = OpFOrdGreaterThanEqual %26 %186 %89 + OpSelectionMerge %191 None + OpBranchConditional %188 %189 %191 + %189 = OpLabel + OpBranch %195 + %191 = OpLabel + OpBranch %192 + %192 = OpLabel + %194 = OpIAdd %15 %247 %18 + OpBranch %162 + %195 = OpLabel + %259 = OpPhi %6 %261 %162 %251 %189 + %257 = OpPhi %6 %248 %162 %251 %189 + %253 = OpPhi %26 %149 %162 %152 %189 + OpSelectionMerge %197 None + OpBranchConditional %253 %199 %197 + %197 = OpLabel + OpBranch %199 + %199 = OpLabel + %258 = OpPhi %6 %259 %195 %257 %197 + %93 = OpAccessChain %7 %66 %77 + OpStore %93 %258 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpSelectionMerge %245 None + OpSwitch %77 %207 + %207 = OpLabel + OpBranch %208 + %208 = OpLabel + %265 = OpPhi %6 %14 %207 %268 %238 + %264 = OpPhi %15 %18 %207 %240 %238 + %211 = OpSLessThan %26 %264 %25 + OpLoopMerge %241 %238 None + OpBranchConditional %211 %212 %241 + %212 = OpLabel + %214 = OpSMod %15 %264 %29 + %215 = OpIEqual %26 %214 %31 + OpSelectionMerge %230 None + OpBranchConditional %215 %216 %219 + %216 = OpLabel + %218 = OpFAdd %6 %265 %35 + OpBranch %230 + %219 = OpLabel + %221 = OpConvertSToF %6 %264 + %223 = OpExtInst %6 %1 Round %82 + %224 = OpFMod %6 %221 %223 + %225 = OpFOrdLessThanEqual %26 %224 %44 + OpSelectionMerge %229 None + OpBranchConditional %225 %226 %229 + %226 = OpLabel + %228 = OpFAdd %6 %265 %48 + OpBranch %229 + %229 = OpLabel + %269 = OpPhi %6 %265 %219 %228 %226 + OpBranch %230 + %230 = OpLabel + %268 = OpPhi %6 %218 %216 %269 %229 + %232 = OpConvertSToF %6 %264 + %234 = OpFOrdGreaterThanEqual %26 %232 %97 + OpSelectionMerge %237 None + OpBranchConditional %234 %235 %237 + %235 = OpLabel + OpBranch %241 + %237 = OpLabel + OpBranch %238 + %238 = OpLabel + %240 = OpIAdd %15 %264 %18 + OpBranch %208 + %241 = OpLabel + %276 = OpPhi %6 %261 %208 %268 %235 + %274 = OpPhi %6 %265 %208 %268 %235 + %270 = OpPhi %26 %149 %208 %152 %235 + OpSelectionMerge %243 None + OpBranchConditional %270 %245 %243 + %243 = OpLabel + OpBranch %245 + %245 = OpLabel + %275 = OpPhi %6 %276 %241 %274 %243 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %275 + %103 = OpLoad %6 %93 + %105 = OpLoad %6 %101 + %106 = OpFAdd %6 %103 %105 + %108 = OpAccessChain %7 %66 %107 + OpStore %108 %106 + OpBranch %110 + %110 = OpLabel + %285 = OpPhi %15 %31 %245 %135 %113 + %117 = OpSLessThan %26 %285 %116 + OpLoopMerge %112 %113 None + OpBranchConditional %117 %111 %112 + %111 = OpLabel + %119 = OpAccessChain %7 %66 %285 + %120 = OpLoad %6 %119 + %122 = OpFOrdGreaterThanEqual %26 %120 %121 + OpSelectionMerge %124 None + OpBranchConditional %122 %123 %124 + %123 = OpLabel + %128 = OpLoad %6 %119 + %131 = OpLoad %6 %119 + %132 = OpFMul %6 %128 %131 + OpStore %119 %132 + OpBranch %124 + %124 = OpLabel + OpBranch %113 + %113 = OpLabel + %135 = OpIAdd %15 %285 %18 + OpBranch %110 + %112 = OpLabel + %138 = OpLoad %64 %66 + %139 = OpExtInst %64 %1 FAbs %138 + %140 = OpExtInst %64 %1 Normalize %139 + %141 = OpCompositeExtract %6 %140 0 + %142 = OpCompositeExtract %6 %140 1 + %143 = OpCompositeExtract %6 %140 2 + %144 = OpCompositeConstruct %83 %141 %142 %143 %121 + OpStore %137 %144 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 290 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %137 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %66 "c" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %137 "_GLF_color" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpDecorate %137 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %107 = OpConstant %76 2 + %116 = OpConstant %15 3 + %121 = OpConstant %6 1 + %136 = OpTypePointer Output %83 + %137 = OpVariable %136 Output + %149 = OpConstantFalse %26 + %152 = OpConstantTrue %26 + %261 = OpUndef %6 + %289 = OpConstant %6 0.125 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %81 = OpFMul %6 %80 %289 + %82 = OpExtInst %6 %1 Round %81 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpSelectionMerge %199 None + OpSwitch %77 %161 + %161 = OpLabel + OpBranch %162 + %162 = OpLabel + %248 = OpPhi %6 %14 %161 %251 %192 + %247 = OpPhi %15 %18 %161 %194 %192 + %165 = OpSLessThan %26 %247 %25 + OpLoopMerge %195 %192 None + OpBranchConditional %165 %166 %195 + %166 = OpLabel + %168 = OpSMod %15 %247 %29 + %169 = OpIEqual %26 %168 %31 + OpSelectionMerge %184 None + OpBranchConditional %169 %170 %173 + %170 = OpLabel + %172 = OpFAdd %6 %248 %35 + OpBranch %184 + %173 = OpLabel + %175 = OpConvertSToF %6 %247 + %177 = OpExtInst %6 %1 Round %82 + %178 = OpFMod %6 %175 %177 + %179 = OpFOrdLessThanEqual %26 %178 %44 + OpSelectionMerge %183 None + OpBranchConditional %179 %180 %183 + %180 = OpLabel + %182 = OpFAdd %6 %248 %48 + OpBranch %183 + %183 = OpLabel + %252 = OpPhi %6 %248 %173 %182 %180 + OpBranch %184 + %184 = OpLabel + %251 = OpPhi %6 %172 %170 %252 %183 + %186 = OpConvertSToF %6 %247 + %188 = OpFOrdGreaterThanEqual %26 %186 %89 + OpSelectionMerge %191 None + OpBranchConditional %188 %189 %191 + %189 = OpLabel + OpBranch %195 + %191 = OpLabel + OpBranch %192 + %192 = OpLabel + %194 = OpIAdd %15 %247 %18 + OpBranch %162 + %195 = OpLabel + %259 = OpPhi %6 %261 %162 %251 %189 + %257 = OpPhi %6 %248 %162 %251 %189 + %253 = OpPhi %26 %149 %162 %152 %189 + OpSelectionMerge %197 None + OpBranchConditional %253 %199 %197 + %197 = OpLabel + OpBranch %199 + %199 = OpLabel + %258 = OpPhi %6 %259 %195 %257 %197 + %93 = OpAccessChain %7 %66 %77 + OpStore %93 %258 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpSelectionMerge %245 None + OpSwitch %77 %207 + %207 = OpLabel + OpBranch %208 + %208 = OpLabel + %265 = OpPhi %6 %14 %207 %268 %238 + %264 = OpPhi %15 %18 %207 %240 %238 + %211 = OpSLessThan %26 %264 %25 + OpLoopMerge %241 %238 None + OpBranchConditional %211 %212 %241 + %212 = OpLabel + %214 = OpSMod %15 %264 %29 + %215 = OpIEqual %26 %214 %31 + OpSelectionMerge %230 None + OpBranchConditional %215 %216 %219 + %219 = OpLabel + %221 = OpConvertSToF %6 %264 + %223 = OpExtInst %6 %1 Round %82 + %224 = OpFMod %6 %221 %223 + %225 = OpFOrdLessThanEqual %26 %224 %44 + OpSelectionMerge %229 None + OpBranchConditional %225 %226 %229 + %226 = OpLabel + %228 = OpFAdd %6 %265 %48 + OpBranch %229 + %229 = OpLabel + %269 = OpPhi %6 %265 %219 %228 %226 + OpBranch %230 + %230 = OpLabel + %268 = OpPhi %6 %218 %216 %269 %229 + %232 = OpConvertSToF %6 %264 + %234 = OpFOrdGreaterThanEqual %26 %232 %97 + OpSelectionMerge %237 None + OpBranchConditional %234 %235 %237 + %235 = OpLabel + OpBranch %241 + %241 = OpLabel + %276 = OpPhi %6 %261 %208 %268 %235 + %274 = OpPhi %6 %265 %208 %268 %235 + %270 = OpPhi %26 %149 %208 %152 %235 + OpSelectionMerge %243 None + OpBranchConditional %270 %245 %243 + %216 = OpLabel + %218 = OpFAdd %6 %265 %35 + OpBranch %230 + %237 = OpLabel + OpBranch %238 + %238 = OpLabel + %240 = OpIAdd %15 %264 %18 + OpBranch %208 + %243 = OpLabel + OpBranch %245 + %245 = OpLabel + %275 = OpPhi %6 %276 %241 %274 %243 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %275 + %103 = OpLoad %6 %93 + %105 = OpLoad %6 %101 + %106 = OpFAdd %6 %103 %105 + %108 = OpAccessChain %7 %66 %107 + OpStore %108 %106 + OpBranch %110 + %110 = OpLabel + %285 = OpPhi %15 %31 %245 %135 %113 + %117 = OpSLessThan %26 %285 %116 + OpLoopMerge %112 %113 None + OpBranchConditional %117 %111 %112 + %111 = OpLabel + %119 = OpAccessChain %7 %66 %285 + %120 = OpLoad %6 %119 + %122 = OpFOrdGreaterThanEqual %26 %120 %121 + OpSelectionMerge %124 None + OpBranchConditional %122 %123 %124 + %123 = OpLabel + %128 = OpLoad %6 %119 + %131 = OpLoad %6 %119 + %132 = OpFMul %6 %128 %131 + OpStore %119 %132 + OpBranch %124 + %124 = OpLabel + OpBranch %113 + %113 = OpLabel + %135 = OpIAdd %15 %285 %18 + OpBranch %110 + %112 = OpLabel + %138 = OpLoad %64 %66 + %139 = OpExtInst %64 %1 FAbs %138 + %140 = OpExtInst %64 %1 Normalize %139 + %141 = OpCompositeExtract %6 %140 0 + %142 = OpCompositeExtract %6 %140 1 + %143 = OpCompositeExtract %6 %140 2 + %144 = OpCompositeConstruct %83 %141 %142 %143 %121 + OpStore %137 %144 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-maze-O-dead-code.amber b/vulkan/amber/graphicsfuzz/spv-stable-maze-O-dead-code.amber new file mode 100644 index 0000000..d528624 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-maze-O-dead-code.amber @@ -0,0 +1,965 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with instructions propagated to predecessors + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 653 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %435 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %55 "map" + OpName %435 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %435 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %24 = OpTypeVector %18 2 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %32 = OpConstant %6 16 + %41 = OpTypePointer Function %18 + %49 = OpConstant %18 256 + %50 = OpTypeBool + %52 = OpConstant %27 256 + %53 = OpTypeArray %18 %52 + %60 = OpConstant %18 1 + %63 = OpConstantComposite %24 %19 %19 + %66 = OpConstantTrue %50 + %82 = OpConstant %18 2 + %86 = OpConstant %18 16 + %119 = OpConstant %18 14 + %162 = OpConstantFalse %50 + %169 = OpConstant %18 8 + %434 = OpTypePointer Output %10 + %435 = OpVariable %434 Output + %436 = OpConstant %6 1 + %437 = OpConstantComposite %10 %436 %436 %436 %436 + %440 = OpConstant %6 0 + %441 = OpConstantComposite %10 %440 %440 %440 %436 + %447 = OpTypePointer Function %53 + %648 = OpConstant %18 32 + %649 = OpUndef %24 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %55 = OpVariable %447 Function + OpSelectionMerge %442 None + OpSwitch %28 %443 + %443 = OpLabel + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + %31 = OpCompositeExtract %6 %23 0 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %37 = OpCompositeExtract %6 %23 1 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + OpBranch %43 + %43 = OpLabel + %518 = OpPhi %18 %19 %443 %61 %44 + %51 = OpSLessThan %50 %518 %49 + OpLoopMerge %45 %44 None + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %58 = OpAccessChain %41 %55 %518 + OpStore %58 %19 + %61 = OpIAdd %18 %518 %60 + OpBranch %43 + %45 = OpLabel + OpBranch %68 + %68 = OpLabel + %591 = OpPhi %50 %66 %45 %569 %71 + %520 = OpPhi %24 %63 %45 %637 %71 + %519 = OpPhi %18 %19 %45 %621 %71 + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %73 = OpIAdd %18 %519 %60 + %76 = OpCompositeExtract %18 %520 0 + %77 = OpSGreaterThan %50 %76 %19 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %83 = OpISub %18 %76 %82 + %85 = OpCompositeExtract %18 %520 1 + %87 = OpIMul %18 %85 %86 + %88 = OpIAdd %18 %83 %87 + %89 = OpAccessChain %41 %55 %88 + %90 = OpLoad %18 %89 + %91 = OpIEqual %50 %90 %19 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %50 %77 %69 %91 %78 + %650 = OpSelect %18 %92 %60 %19 + %98 = OpCompositeExtract %18 %520 1 + %99 = OpSGreaterThan %50 %98 %19 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %106 = OpISub %18 %98 %82 + %107 = OpIMul %18 %106 %86 + %108 = OpIAdd %18 %76 %107 + %109 = OpAccessChain %41 %55 %108 + %110 = OpLoad %18 %109 + %111 = OpIEqual %50 %110 %19 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %50 %99 %79 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %116 = OpIAdd %18 %650 %60 + OpBranch %114 + %114 = OpLabel + %529 = OpPhi %18 %650 %101 %116 %113 + %120 = OpSLessThan %50 %76 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %125 = OpIAdd %18 %76 %82 + %128 = OpIMul %18 %98 %86 + %129 = OpIAdd %18 %125 %128 + %130 = OpAccessChain %41 %55 %129 + %131 = OpLoad %18 %130 + %132 = OpIEqual %50 %131 %19 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %50 %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %137 = OpIAdd %18 %529 %60 + OpBranch %135 + %135 = OpLabel + %533 = OpPhi %18 %529 %122 %137 %134 + %140 = OpSLessThan %50 %98 %119 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %147 = OpIAdd %18 %98 %82 + %148 = OpIMul %18 %147 %86 + %149 = OpIAdd %18 %76 %148 + %150 = OpAccessChain %41 %55 %149 + %151 = OpLoad %18 %150 + %152 = OpIEqual %50 %151 %19 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %50 %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %157 = OpIAdd %18 %533 %60 + OpBranch %155 + %155 = OpLabel + %534 = OpPhi %18 %533 %142 %157 %154 + %159 = OpIEqual %50 %534 %19 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpBranch %163 + %163 = OpLabel + %570 = OpPhi %50 %162 %160 %639 %166 + %568 = OpPhi %24 %520 %160 %619 %166 + %567 = OpPhi %18 %19 %160 %199 %166 + %170 = OpSLessThan %50 %567 %169 + OpLoopMerge %165 %166 None + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpBranch %172 + %172 = OpLabel + %619 = OpPhi %24 %568 %164 %644 %175 + %617 = OpPhi %18 %19 %164 %197 %175 + %639 = OpPhi %50 %570 %164 %651 %175 + %178 = OpSLessThan %50 %617 %169 + OpLoopMerge %174 %175 None + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %180 = OpIMul %18 %617 %82 + %182 = OpIMul %18 %567 %82 + %183 = OpIMul %18 %567 %648 + %184 = OpIAdd %18 %180 %183 + %185 = OpAccessChain %41 %55 %184 + %186 = OpLoad %18 %185 + %187 = OpIEqual %50 %186 %19 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %463 = OpCompositeInsert %24 %180 %649 0 + %465 = OpCompositeInsert %24 %182 %463 1 + OpBranch %189 + %189 = OpLabel + %644 = OpPhi %24 %619 %173 %465 %188 + %651 = OpSelect %50 %187 %66 %639 + OpBranch %175 + %175 = OpLabel + %197 = OpIAdd %18 %617 %60 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %199 = OpIAdd %18 %567 %60 + OpBranch %163 + %165 = OpLabel + %201 = OpCompositeExtract %18 %568 0 + %203 = OpCompositeExtract %18 %568 1 + %204 = OpIMul %18 %203 %86 + %205 = OpIAdd %18 %201 %204 + %206 = OpAccessChain %41 %55 %205 + OpStore %206 %60 + OpBranch %161 + %207 = OpLabel + %211 = OpSMod %18 %73 %534 + %214 = OpIAdd %18 %73 %534 + %216 = OpSGreaterThanEqual %50 %211 %19 + %652 = OpSelect %50 %216 %77 %216 + OpSelectionMerge %224 None + OpBranchConditional %652 %223 %224 + %223 = OpLabel + %227 = OpISub %18 %76 %82 + %230 = OpIMul %18 %98 %86 + %231 = OpIAdd %18 %227 %230 + %232 = OpAccessChain %41 %55 %231 + %233 = OpLoad %18 %232 + %234 = OpIEqual %50 %233 %19 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %50 %652 %207 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %239 = OpISub %18 %211 %60 + %244 = OpIMul %18 %98 %86 + %245 = OpIAdd %18 %76 %244 + %246 = OpAccessChain %41 %55 %245 + OpStore %246 %60 + %249 = OpISub %18 %76 %60 + %253 = OpIAdd %18 %249 %244 + %254 = OpAccessChain %41 %55 %253 + OpStore %254 %60 + %257 = OpISub %18 %76 %82 + %261 = OpIAdd %18 %257 %244 + %262 = OpAccessChain %41 %55 %261 + OpStore %262 %60 + %479 = OpCompositeInsert %24 %257 %520 0 + OpBranch %237 + %237 = OpLabel + %550 = OpPhi %24 %520 %224 %479 %236 + %549 = OpPhi %18 %211 %224 %239 %236 + %268 = OpSGreaterThanEqual %50 %549 %19 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %272 = OpCompositeExtract %18 %550 1 + %273 = OpSGreaterThan %50 %272 %19 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %50 %268 %237 %273 %269 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %278 = OpCompositeExtract %18 %550 0 + %280 = OpCompositeExtract %18 %550 1 + %281 = OpISub %18 %280 %82 + %282 = OpIMul %18 %281 %86 + %283 = OpIAdd %18 %278 %282 + %284 = OpAccessChain %41 %55 %283 + %285 = OpLoad %18 %284 + %286 = OpIEqual %50 %285 %19 + OpBranch %276 + %276 = OpLabel + %287 = OpPhi %50 %274 %270 %286 %275 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %291 = OpISub %18 %549 %60 + %293 = OpCompositeExtract %18 %550 0 + %295 = OpCompositeExtract %18 %550 1 + %296 = OpIMul %18 %295 %86 + %297 = OpIAdd %18 %293 %296 + %298 = OpAccessChain %41 %55 %297 + OpStore %298 %60 + %303 = OpISub %18 %295 %60 + %304 = OpIMul %18 %303 %86 + %305 = OpIAdd %18 %293 %304 + %306 = OpAccessChain %41 %55 %305 + OpStore %306 %60 + %311 = OpISub %18 %295 %82 + %312 = OpIMul %18 %311 %86 + %313 = OpIAdd %18 %293 %312 + %314 = OpAccessChain %41 %55 %313 + OpStore %314 %60 + %491 = OpCompositeInsert %24 %311 %550 1 + OpBranch %289 + %289 = OpLabel + %556 = OpPhi %24 %550 %276 %491 %288 + %555 = OpPhi %18 %549 %276 %291 %288 + %320 = OpSGreaterThanEqual %50 %555 %19 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %324 = OpCompositeExtract %18 %556 0 + %325 = OpSLessThan %50 %324 %119 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %50 %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %330 = OpCompositeExtract %18 %556 0 + %331 = OpIAdd %18 %330 %82 + %333 = OpCompositeExtract %18 %556 1 + %334 = OpIMul %18 %333 %86 + %335 = OpIAdd %18 %331 %334 + %336 = OpAccessChain %41 %55 %335 + %337 = OpLoad %18 %336 + %338 = OpIEqual %50 %337 %19 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %50 %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %343 = OpISub %18 %555 %60 + %345 = OpCompositeExtract %18 %556 0 + %347 = OpCompositeExtract %18 %556 1 + %348 = OpIMul %18 %347 %86 + %349 = OpIAdd %18 %345 %348 + %350 = OpAccessChain %41 %55 %349 + OpStore %350 %60 + %353 = OpIAdd %18 %345 %60 + %357 = OpIAdd %18 %353 %348 + %358 = OpAccessChain %41 %55 %357 + OpStore %358 %60 + %361 = OpIAdd %18 %345 %82 + %365 = OpIAdd %18 %361 %348 + %366 = OpAccessChain %41 %55 %365 + OpStore %366 %60 + %503 = OpCompositeInsert %24 %361 %556 0 + OpBranch %341 + %341 = OpLabel + %562 = OpPhi %24 %556 %328 %503 %340 + %561 = OpPhi %18 %555 %328 %343 %340 + %372 = OpSGreaterThanEqual %50 %561 %19 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %376 = OpCompositeExtract %18 %562 1 + %377 = OpSLessThan %50 %376 %119 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %50 %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %382 = OpCompositeExtract %18 %562 0 + %384 = OpCompositeExtract %18 %562 1 + %385 = OpIAdd %18 %384 %82 + %386 = OpIMul %18 %385 %86 + %387 = OpIAdd %18 %382 %386 + %388 = OpAccessChain %41 %55 %387 + %389 = OpLoad %18 %388 + %390 = OpIEqual %50 %389 %19 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %50 %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %397 = OpCompositeExtract %18 %562 0 + %399 = OpCompositeExtract %18 %562 1 + %400 = OpIMul %18 %399 %86 + %401 = OpIAdd %18 %397 %400 + %402 = OpAccessChain %41 %55 %401 + OpStore %402 %60 + %407 = OpIAdd %18 %399 %60 + %408 = OpIMul %18 %407 %86 + %409 = OpIAdd %18 %397 %408 + %410 = OpAccessChain %41 %55 %409 + OpStore %410 %60 + %415 = OpIAdd %18 %399 %82 + %416 = OpIMul %18 %415 %86 + %417 = OpIAdd %18 %397 %416 + %418 = OpAccessChain %41 %55 %417 + OpStore %418 %60 + %515 = OpCompositeInsert %24 %415 %562 1 + OpBranch %393 + %393 = OpLabel + %638 = OpPhi %24 %562 %380 %515 %392 + OpBranch %161 + %161 = OpLabel + %637 = OpPhi %24 %568 %165 %638 %393 + %621 = OpPhi %18 %73 %165 %214 %393 + %569 = OpPhi %50 %570 %165 %591 %393 + %425 = OpIMul %18 %39 %86 + %428 = OpIAdd %18 %425 %34 + %429 = OpAccessChain %41 %55 %428 + %430 = OpLoad %18 %429 + %431 = OpIEqual %50 %430 %60 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %435 %437 + OpBranch %70 + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranchConditional %569 %68 %70 + %70 = OpLabel + %592 = OpPhi %50 %66 %432 %162 %71 + OpSelectionMerge %445 None + OpBranchConditional %592 %442 %445 + %445 = OpLabel + OpStore %435 %441 + OpBranch %442 + %442 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 32.0 32.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 865 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %435 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %55 "map" + OpName %435 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %435 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %24 = OpTypeVector %18 2 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %32 = OpConstant %6 16 + %41 = OpTypePointer Function %18 + %49 = OpConstant %18 256 + %50 = OpTypeBool + %52 = OpConstant %27 256 + %53 = OpTypeArray %18 %52 + %60 = OpConstant %18 1 + %63 = OpConstantComposite %24 %19 %19 + %66 = OpConstantTrue %50 + %82 = OpConstant %18 2 + %86 = OpConstant %18 16 + %119 = OpConstant %18 14 + %162 = OpConstantFalse %50 + %169 = OpConstant %18 8 + %434 = OpTypePointer Output %10 + %435 = OpVariable %434 Output + %436 = OpConstant %6 1 + %437 = OpConstantComposite %10 %436 %436 %436 %436 + %440 = OpConstant %6 0 + %441 = OpConstantComposite %10 %440 %440 %440 %436 + %447 = OpTypePointer Function %53 + %648 = OpConstant %18 32 + %649 = OpUndef %24 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %55 = OpVariable %447 Function + OpSelectionMerge %442 None + OpSwitch %28 %443 + %443 = OpLabel + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + %31 = OpCompositeExtract %6 %23 0 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %37 = OpCompositeExtract %6 %23 1 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %753 = OpSLessThan %50 %19 %49 + %827 = OpIAdd %18 %19 %60 + %863 = OpSLessThan %50 %827 %49 + OpBranch %43 + %43 = OpLabel + %829 = OpPhi %50 %863 %443 %864 %44 + %755 = OpPhi %18 %827 %443 %828 %44 + %51 = OpPhi %50 %753 %443 %754 %44 + %518 = OpPhi %18 %19 %443 %61 %44 + OpLoopMerge %45 %44 None + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %754 = OpPhi %50 %829 %43 + %61 = OpPhi %18 %755 %43 + %58 = OpAccessChain %41 %55 %518 + OpStore %58 %19 + %828 = OpIAdd %18 %61 %60 + %864 = OpSLessThan %50 %828 %49 + OpBranch %43 + %45 = OpLabel + OpBranch %68 + %68 = OpLabel + %591 = OpPhi %50 %66 %45 %569 %71 + %520 = OpPhi %24 %63 %45 %637 %71 + %519 = OpPhi %18 %19 %45 %621 %71 + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %73 = OpIAdd %18 %519 %60 + %76 = OpCompositeExtract %18 %520 0 + %77 = OpSGreaterThan %50 %76 %19 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %83 = OpISub %18 %76 %82 + %85 = OpCompositeExtract %18 %520 1 + %87 = OpIMul %18 %85 %86 + %88 = OpIAdd %18 %83 %87 + %89 = OpAccessChain %41 %55 %88 + %90 = OpLoad %18 %89 + %91 = OpIEqual %50 %90 %19 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %50 %77 %69 %91 %78 + %650 = OpSelect %18 %92 %60 %19 + %98 = OpCompositeExtract %18 %520 1 + %99 = OpSGreaterThan %50 %98 %19 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %106 = OpISub %18 %98 %82 + %107 = OpIMul %18 %106 %86 + %108 = OpIAdd %18 %76 %107 + %109 = OpAccessChain %41 %55 %108 + %110 = OpLoad %18 %109 + %111 = OpIEqual %50 %110 %19 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %50 %99 %79 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %116 = OpIAdd %18 %650 %60 + OpBranch %114 + %114 = OpLabel + %529 = OpPhi %18 %650 %101 %116 %113 + %120 = OpSLessThan %50 %76 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %125 = OpIAdd %18 %76 %82 + %128 = OpIMul %18 %98 %86 + %129 = OpIAdd %18 %125 %128 + %130 = OpAccessChain %41 %55 %129 + %131 = OpLoad %18 %130 + %132 = OpIEqual %50 %131 %19 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %50 %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %137 = OpIAdd %18 %529 %60 + OpBranch %135 + %135 = OpLabel + %533 = OpPhi %18 %529 %122 %137 %134 + %140 = OpSLessThan %50 %98 %119 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %147 = OpIAdd %18 %98 %82 + %148 = OpIMul %18 %147 %86 + %149 = OpIAdd %18 %76 %148 + %150 = OpAccessChain %41 %55 %149 + %151 = OpLoad %18 %150 + %152 = OpIEqual %50 %151 %19 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %50 %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %157 = OpIAdd %18 %533 %60 + OpBranch %155 + %155 = OpLabel + %534 = OpPhi %18 %533 %142 %157 %154 + %159 = OpIEqual %50 %534 %19 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpBranch %163 + %163 = OpLabel + %570 = OpPhi %50 %162 %160 %639 %166 + %568 = OpPhi %24 %520 %160 %619 %166 + %567 = OpPhi %18 %19 %160 %199 %166 + %170 = OpSLessThan %50 %567 %169 + OpLoopMerge %165 %166 None + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpBranch %172 + %172 = OpLabel + %619 = OpPhi %24 %568 %164 %644 %175 + %617 = OpPhi %18 %19 %164 %197 %175 + %639 = OpPhi %50 %570 %164 %651 %175 + %178 = OpSLessThan %50 %617 %169 + OpLoopMerge %174 %175 None + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %180 = OpIMul %18 %617 %82 + %182 = OpIMul %18 %567 %82 + %183 = OpIMul %18 %567 %648 + %184 = OpIAdd %18 %180 %183 + %185 = OpAccessChain %41 %55 %184 + %186 = OpLoad %18 %185 + %187 = OpIEqual %50 %186 %19 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %463 = OpCompositeInsert %24 %180 %649 0 + %465 = OpCompositeInsert %24 %182 %463 1 + OpBranch %189 + %189 = OpLabel + %644 = OpPhi %24 %619 %173 %465 %188 + %651 = OpSelect %50 %187 %66 %639 + OpBranch %175 + %175 = OpLabel + %197 = OpIAdd %18 %617 %60 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %199 = OpIAdd %18 %567 %60 + OpBranch %163 + %165 = OpLabel + %201 = OpCompositeExtract %18 %568 0 + %203 = OpCompositeExtract %18 %568 1 + %204 = OpIMul %18 %203 %86 + %205 = OpIAdd %18 %201 %204 + %206 = OpAccessChain %41 %55 %205 + OpStore %206 %60 + OpBranch %161 + %207 = OpLabel + %211 = OpSMod %18 %73 %534 + %214 = OpIAdd %18 %73 %534 + %216 = OpSGreaterThanEqual %50 %211 %19 + %652 = OpSelect %50 %216 %77 %216 + OpSelectionMerge %224 None + OpBranchConditional %652 %223 %224 + %223 = OpLabel + %227 = OpISub %18 %76 %82 + %230 = OpIMul %18 %98 %86 + %231 = OpIAdd %18 %227 %230 + %232 = OpAccessChain %41 %55 %231 + %233 = OpLoad %18 %232 + %234 = OpIEqual %50 %233 %19 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %50 %652 %207 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %239 = OpISub %18 %211 %60 + %244 = OpIMul %18 %98 %86 + %245 = OpIAdd %18 %76 %244 + %246 = OpAccessChain %41 %55 %245 + OpStore %246 %60 + %249 = OpISub %18 %76 %60 + %253 = OpIAdd %18 %249 %244 + %254 = OpAccessChain %41 %55 %253 + OpStore %254 %60 + %257 = OpISub %18 %76 %82 + %261 = OpIAdd %18 %257 %244 + %262 = OpAccessChain %41 %55 %261 + OpStore %262 %60 + %479 = OpCompositeInsert %24 %257 %520 0 + OpBranch %237 + %237 = OpLabel + %550 = OpPhi %24 %520 %224 %479 %236 + %549 = OpPhi %18 %211 %224 %239 %236 + %268 = OpSGreaterThanEqual %50 %549 %19 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %272 = OpCompositeExtract %18 %550 1 + %273 = OpSGreaterThan %50 %272 %19 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %50 %268 %237 %273 %269 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %278 = OpCompositeExtract %18 %550 0 + %280 = OpCompositeExtract %18 %550 1 + %281 = OpISub %18 %280 %82 + %282 = OpIMul %18 %281 %86 + %283 = OpIAdd %18 %278 %282 + %284 = OpAccessChain %41 %55 %283 + %285 = OpLoad %18 %284 + %286 = OpIEqual %50 %285 %19 + OpBranch %276 + %276 = OpLabel + %287 = OpPhi %50 %274 %270 %286 %275 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %291 = OpISub %18 %549 %60 + %293 = OpCompositeExtract %18 %550 0 + %295 = OpCompositeExtract %18 %550 1 + %296 = OpIMul %18 %295 %86 + %297 = OpIAdd %18 %293 %296 + %298 = OpAccessChain %41 %55 %297 + OpStore %298 %60 + %303 = OpISub %18 %295 %60 + %304 = OpIMul %18 %303 %86 + %305 = OpIAdd %18 %293 %304 + %306 = OpAccessChain %41 %55 %305 + OpStore %306 %60 + %311 = OpISub %18 %295 %82 + %312 = OpIMul %18 %311 %86 + %313 = OpIAdd %18 %293 %312 + %314 = OpAccessChain %41 %55 %313 + OpStore %314 %60 + %491 = OpCompositeInsert %24 %311 %550 1 + OpBranch %289 + %289 = OpLabel + %556 = OpPhi %24 %550 %276 %491 %288 + %555 = OpPhi %18 %549 %276 %291 %288 + %320 = OpSGreaterThanEqual %50 %555 %19 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %324 = OpCompositeExtract %18 %556 0 + %325 = OpSLessThan %50 %324 %119 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %50 %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %330 = OpCompositeExtract %18 %556 0 + %331 = OpIAdd %18 %330 %82 + %333 = OpCompositeExtract %18 %556 1 + %334 = OpIMul %18 %333 %86 + %335 = OpIAdd %18 %331 %334 + %336 = OpAccessChain %41 %55 %335 + %337 = OpLoad %18 %336 + %338 = OpIEqual %50 %337 %19 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %50 %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %343 = OpISub %18 %555 %60 + %345 = OpCompositeExtract %18 %556 0 + %347 = OpCompositeExtract %18 %556 1 + %348 = OpIMul %18 %347 %86 + %349 = OpIAdd %18 %345 %348 + %350 = OpAccessChain %41 %55 %349 + OpStore %350 %60 + %353 = OpIAdd %18 %345 %60 + %357 = OpIAdd %18 %353 %348 + %358 = OpAccessChain %41 %55 %357 + OpStore %358 %60 + %361 = OpIAdd %18 %345 %82 + %365 = OpIAdd %18 %361 %348 + %366 = OpAccessChain %41 %55 %365 + OpStore %366 %60 + %503 = OpCompositeInsert %24 %361 %556 0 + OpBranch %341 + %341 = OpLabel + %562 = OpPhi %24 %556 %328 %503 %340 + %561 = OpPhi %18 %555 %328 %343 %340 + %372 = OpSGreaterThanEqual %50 %561 %19 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %376 = OpCompositeExtract %18 %562 1 + %377 = OpSLessThan %50 %376 %119 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %50 %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %382 = OpCompositeExtract %18 %562 0 + %384 = OpCompositeExtract %18 %562 1 + %385 = OpIAdd %18 %384 %82 + %386 = OpIMul %18 %385 %86 + %387 = OpIAdd %18 %382 %386 + %388 = OpAccessChain %41 %55 %387 + %389 = OpLoad %18 %388 + %390 = OpIEqual %50 %389 %19 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %50 %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %397 = OpCompositeExtract %18 %562 0 + %399 = OpCompositeExtract %18 %562 1 + %400 = OpIMul %18 %399 %86 + %401 = OpIAdd %18 %397 %400 + %402 = OpAccessChain %41 %55 %401 + OpStore %402 %60 + %407 = OpIAdd %18 %399 %60 + %408 = OpIMul %18 %407 %86 + %409 = OpIAdd %18 %397 %408 + %410 = OpAccessChain %41 %55 %409 + OpStore %410 %60 + %415 = OpIAdd %18 %399 %82 + %416 = OpIMul %18 %415 %86 + %417 = OpIAdd %18 %397 %416 + %418 = OpAccessChain %41 %55 %417 + OpStore %418 %60 + %515 = OpCompositeInsert %24 %415 %562 1 + OpBranch %393 + %393 = OpLabel + %638 = OpPhi %24 %562 %380 %515 %392 + OpBranch %161 + %161 = OpLabel + %637 = OpPhi %24 %568 %165 %638 %393 + %621 = OpPhi %18 %73 %165 %214 %393 + %569 = OpPhi %50 %570 %165 %591 %393 + %425 = OpIMul %18 %39 %86 + %428 = OpIAdd %18 %425 %34 + %429 = OpAccessChain %41 %55 %428 + %430 = OpLoad %18 %429 + %431 = OpIEqual %50 %430 %60 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %435 %437 + OpBranch %70 + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranchConditional %569 %68 %70 + %70 = OpLabel + %592 = OpPhi %50 %66 %432 %162 %71 + OpSelectionMerge %445 None + OpBranchConditional %592 %442 %445 + %445 = OpLabel + OpStore %435 %441 + OpBranch %442 + %442 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 32.0 32.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-maze-O-memory-accesses.amber b/vulkan/amber/graphicsfuzz/spv-stable-maze-O-memory-accesses.amber new file mode 100644 index 0000000..f3606da --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-maze-O-memory-accesses.amber @@ -0,0 +1,966 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one extra memory accesses + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 653 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %435 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %55 "map" + OpName %435 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %435 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %24 = OpTypeVector %18 2 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %32 = OpConstant %6 16 + %41 = OpTypePointer Function %18 + %49 = OpConstant %18 256 + %50 = OpTypeBool + %52 = OpConstant %27 256 + %53 = OpTypeArray %18 %52 + %60 = OpConstant %18 1 + %63 = OpConstantComposite %24 %19 %19 + %66 = OpConstantTrue %50 + %82 = OpConstant %18 2 + %86 = OpConstant %18 16 + %119 = OpConstant %18 14 + %162 = OpConstantFalse %50 + %169 = OpConstant %18 8 + %434 = OpTypePointer Output %10 + %435 = OpVariable %434 Output + %436 = OpConstant %6 1 + %437 = OpConstantComposite %10 %436 %436 %436 %436 + %440 = OpConstant %6 0 + %441 = OpConstantComposite %10 %440 %440 %440 %436 + %447 = OpTypePointer Function %53 + %648 = OpConstant %18 32 + %649 = OpUndef %24 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %55 = OpVariable %447 Function + OpSelectionMerge %442 None + OpSwitch %28 %443 + %443 = OpLabel + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + %31 = OpCompositeExtract %6 %23 0 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %37 = OpCompositeExtract %6 %23 1 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + OpBranch %43 + %43 = OpLabel + %518 = OpPhi %18 %19 %443 %61 %44 + %51 = OpSLessThan %50 %518 %49 + OpLoopMerge %45 %44 None + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %58 = OpAccessChain %41 %55 %518 + OpStore %58 %19 + %61 = OpIAdd %18 %518 %60 + OpBranch %43 + %45 = OpLabel + OpBranch %68 + %68 = OpLabel + %591 = OpPhi %50 %66 %45 %569 %71 + %520 = OpPhi %24 %63 %45 %637 %71 + %519 = OpPhi %18 %19 %45 %621 %71 + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %73 = OpIAdd %18 %519 %60 + %76 = OpCompositeExtract %18 %520 0 + %77 = OpSGreaterThan %50 %76 %19 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %83 = OpISub %18 %76 %82 + %85 = OpCompositeExtract %18 %520 1 + %87 = OpIMul %18 %85 %86 + %88 = OpIAdd %18 %83 %87 + %89 = OpAccessChain %41 %55 %88 + %90 = OpLoad %18 %89 + %91 = OpIEqual %50 %90 %19 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %50 %77 %69 %91 %78 + %650 = OpSelect %18 %92 %60 %19 + %98 = OpCompositeExtract %18 %520 1 + %99 = OpSGreaterThan %50 %98 %19 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %106 = OpISub %18 %98 %82 + %107 = OpIMul %18 %106 %86 + %108 = OpIAdd %18 %76 %107 + %109 = OpAccessChain %41 %55 %108 + %110 = OpLoad %18 %109 + %111 = OpIEqual %50 %110 %19 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %50 %99 %79 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %116 = OpIAdd %18 %650 %60 + OpBranch %114 + %114 = OpLabel + %529 = OpPhi %18 %650 %101 %116 %113 + %120 = OpSLessThan %50 %76 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %125 = OpIAdd %18 %76 %82 + %128 = OpIMul %18 %98 %86 + %129 = OpIAdd %18 %125 %128 + %130 = OpAccessChain %41 %55 %129 + %131 = OpLoad %18 %130 + %132 = OpIEqual %50 %131 %19 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %50 %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %137 = OpIAdd %18 %529 %60 + OpBranch %135 + %135 = OpLabel + %533 = OpPhi %18 %529 %122 %137 %134 + %140 = OpSLessThan %50 %98 %119 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %147 = OpIAdd %18 %98 %82 + %148 = OpIMul %18 %147 %86 + %149 = OpIAdd %18 %76 %148 + %150 = OpAccessChain %41 %55 %149 + %151 = OpLoad %18 %150 + %152 = OpIEqual %50 %151 %19 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %50 %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %157 = OpIAdd %18 %533 %60 + OpBranch %155 + %155 = OpLabel + %534 = OpPhi %18 %533 %142 %157 %154 + %159 = OpIEqual %50 %534 %19 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpBranch %163 + %163 = OpLabel + %570 = OpPhi %50 %162 %160 %639 %166 + %568 = OpPhi %24 %520 %160 %619 %166 + %567 = OpPhi %18 %19 %160 %199 %166 + %170 = OpSLessThan %50 %567 %169 + OpLoopMerge %165 %166 None + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpBranch %172 + %172 = OpLabel + %619 = OpPhi %24 %568 %164 %644 %175 + %617 = OpPhi %18 %19 %164 %197 %175 + %639 = OpPhi %50 %570 %164 %651 %175 + %178 = OpSLessThan %50 %617 %169 + OpLoopMerge %174 %175 None + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %180 = OpIMul %18 %617 %82 + %182 = OpIMul %18 %567 %82 + %183 = OpIMul %18 %567 %648 + %184 = OpIAdd %18 %180 %183 + %185 = OpAccessChain %41 %55 %184 + %186 = OpLoad %18 %185 + %187 = OpIEqual %50 %186 %19 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %463 = OpCompositeInsert %24 %180 %649 0 + %465 = OpCompositeInsert %24 %182 %463 1 + OpBranch %189 + %189 = OpLabel + %644 = OpPhi %24 %619 %173 %465 %188 + %651 = OpSelect %50 %187 %66 %639 + OpBranch %175 + %175 = OpLabel + %197 = OpIAdd %18 %617 %60 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %199 = OpIAdd %18 %567 %60 + OpBranch %163 + %165 = OpLabel + %201 = OpCompositeExtract %18 %568 0 + %203 = OpCompositeExtract %18 %568 1 + %204 = OpIMul %18 %203 %86 + %205 = OpIAdd %18 %201 %204 + %206 = OpAccessChain %41 %55 %205 + OpStore %206 %60 + OpBranch %161 + %207 = OpLabel + %211 = OpSMod %18 %73 %534 + %214 = OpIAdd %18 %73 %534 + %216 = OpSGreaterThanEqual %50 %211 %19 + %652 = OpSelect %50 %216 %77 %216 + OpSelectionMerge %224 None + OpBranchConditional %652 %223 %224 + %223 = OpLabel + %227 = OpISub %18 %76 %82 + %230 = OpIMul %18 %98 %86 + %231 = OpIAdd %18 %227 %230 + %232 = OpAccessChain %41 %55 %231 + %233 = OpLoad %18 %232 + %234 = OpIEqual %50 %233 %19 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %50 %652 %207 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %239 = OpISub %18 %211 %60 + %244 = OpIMul %18 %98 %86 + %245 = OpIAdd %18 %76 %244 + %246 = OpAccessChain %41 %55 %245 + OpStore %246 %60 + %249 = OpISub %18 %76 %60 + %253 = OpIAdd %18 %249 %244 + %254 = OpAccessChain %41 %55 %253 + OpStore %254 %60 + %257 = OpISub %18 %76 %82 + %261 = OpIAdd %18 %257 %244 + %262 = OpAccessChain %41 %55 %261 + OpStore %262 %60 + %479 = OpCompositeInsert %24 %257 %520 0 + OpBranch %237 + %237 = OpLabel + %550 = OpPhi %24 %520 %224 %479 %236 + %549 = OpPhi %18 %211 %224 %239 %236 + %268 = OpSGreaterThanEqual %50 %549 %19 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %272 = OpCompositeExtract %18 %550 1 + %273 = OpSGreaterThan %50 %272 %19 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %50 %268 %237 %273 %269 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %278 = OpCompositeExtract %18 %550 0 + %280 = OpCompositeExtract %18 %550 1 + %281 = OpISub %18 %280 %82 + %282 = OpIMul %18 %281 %86 + %283 = OpIAdd %18 %278 %282 + %284 = OpAccessChain %41 %55 %283 + %285 = OpLoad %18 %284 + %286 = OpIEqual %50 %285 %19 + OpBranch %276 + %276 = OpLabel + %287 = OpPhi %50 %274 %270 %286 %275 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %291 = OpISub %18 %549 %60 + %293 = OpCompositeExtract %18 %550 0 + %295 = OpCompositeExtract %18 %550 1 + %296 = OpIMul %18 %295 %86 + %297 = OpIAdd %18 %293 %296 + %298 = OpAccessChain %41 %55 %297 + OpStore %298 %60 + %303 = OpISub %18 %295 %60 + %304 = OpIMul %18 %303 %86 + %305 = OpIAdd %18 %293 %304 + %306 = OpAccessChain %41 %55 %305 + OpStore %306 %60 + %311 = OpISub %18 %295 %82 + %312 = OpIMul %18 %311 %86 + %313 = OpIAdd %18 %293 %312 + %314 = OpAccessChain %41 %55 %313 + OpStore %314 %60 + %491 = OpCompositeInsert %24 %311 %550 1 + OpBranch %289 + %289 = OpLabel + %556 = OpPhi %24 %550 %276 %491 %288 + %555 = OpPhi %18 %549 %276 %291 %288 + %320 = OpSGreaterThanEqual %50 %555 %19 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %324 = OpCompositeExtract %18 %556 0 + %325 = OpSLessThan %50 %324 %119 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %50 %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %330 = OpCompositeExtract %18 %556 0 + %331 = OpIAdd %18 %330 %82 + %333 = OpCompositeExtract %18 %556 1 + %334 = OpIMul %18 %333 %86 + %335 = OpIAdd %18 %331 %334 + %336 = OpAccessChain %41 %55 %335 + %337 = OpLoad %18 %336 + %338 = OpIEqual %50 %337 %19 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %50 %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %343 = OpISub %18 %555 %60 + %345 = OpCompositeExtract %18 %556 0 + %347 = OpCompositeExtract %18 %556 1 + %348 = OpIMul %18 %347 %86 + %349 = OpIAdd %18 %345 %348 + %350 = OpAccessChain %41 %55 %349 + OpStore %350 %60 + %353 = OpIAdd %18 %345 %60 + %357 = OpIAdd %18 %353 %348 + %358 = OpAccessChain %41 %55 %357 + OpStore %358 %60 + %361 = OpIAdd %18 %345 %82 + %365 = OpIAdd %18 %361 %348 + %366 = OpAccessChain %41 %55 %365 + OpStore %366 %60 + %503 = OpCompositeInsert %24 %361 %556 0 + OpBranch %341 + %341 = OpLabel + %562 = OpPhi %24 %556 %328 %503 %340 + %561 = OpPhi %18 %555 %328 %343 %340 + %372 = OpSGreaterThanEqual %50 %561 %19 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %376 = OpCompositeExtract %18 %562 1 + %377 = OpSLessThan %50 %376 %119 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %50 %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %382 = OpCompositeExtract %18 %562 0 + %384 = OpCompositeExtract %18 %562 1 + %385 = OpIAdd %18 %384 %82 + %386 = OpIMul %18 %385 %86 + %387 = OpIAdd %18 %382 %386 + %388 = OpAccessChain %41 %55 %387 + %389 = OpLoad %18 %388 + %390 = OpIEqual %50 %389 %19 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %50 %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %397 = OpCompositeExtract %18 %562 0 + %399 = OpCompositeExtract %18 %562 1 + %400 = OpIMul %18 %399 %86 + %401 = OpIAdd %18 %397 %400 + %402 = OpAccessChain %41 %55 %401 + OpStore %402 %60 + %407 = OpIAdd %18 %399 %60 + %408 = OpIMul %18 %407 %86 + %409 = OpIAdd %18 %397 %408 + %410 = OpAccessChain %41 %55 %409 + OpStore %410 %60 + %415 = OpIAdd %18 %399 %82 + %416 = OpIMul %18 %415 %86 + %417 = OpIAdd %18 %397 %416 + %418 = OpAccessChain %41 %55 %417 + OpStore %418 %60 + %515 = OpCompositeInsert %24 %415 %562 1 + OpBranch %393 + %393 = OpLabel + %638 = OpPhi %24 %562 %380 %515 %392 + OpBranch %161 + %161 = OpLabel + %637 = OpPhi %24 %568 %165 %638 %393 + %621 = OpPhi %18 %73 %165 %214 %393 + %569 = OpPhi %50 %570 %165 %591 %393 + %425 = OpIMul %18 %39 %86 + %428 = OpIAdd %18 %425 %34 + %429 = OpAccessChain %41 %55 %428 + %430 = OpLoad %18 %429 + %431 = OpIEqual %50 %430 %60 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %435 %437 + OpBranch %70 + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranchConditional %569 %68 %70 + %70 = OpLabel + %592 = OpPhi %50 %66 %432 %162 %71 + OpSelectionMerge %445 None + OpBranchConditional %592 %442 %445 + %445 = OpLabel + OpStore %435 %441 + OpBranch %442 + %442 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 32.0 32.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 822 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %435 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %55 "map" + OpName %435 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %435 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %24 = OpTypeVector %18 2 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %32 = OpConstant %6 16 + %41 = OpTypePointer Function %18 + %49 = OpConstant %18 256 + %50 = OpTypeBool + %52 = OpConstant %27 256 + %53 = OpTypeArray %18 %52 + %60 = OpConstant %18 1 + %63 = OpConstantComposite %24 %19 %19 + %66 = OpConstantTrue %50 + %82 = OpConstant %18 2 + %86 = OpConstant %18 16 + %119 = OpConstant %18 14 + %162 = OpConstantFalse %50 + %169 = OpConstant %18 8 + %434 = OpTypePointer Output %10 + %435 = OpVariable %434 Output + %436 = OpConstant %6 1 + %437 = OpConstantComposite %10 %436 %436 %436 %436 + %440 = OpConstant %6 0 + %441 = OpConstantComposite %10 %440 %440 %440 %436 + %447 = OpTypePointer Function %53 + %648 = OpConstant %18 32 + %649 = OpUndef %24 + %753 = OpTypePointer Private %24 + %754 = OpVariable %753 Private %63 + %759 = OpTypePointer Private %18 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %55 = OpVariable %447 Function + OpSelectionMerge %442 None + OpSwitch %28 %443 + %443 = OpLabel + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + %31 = OpCompositeExtract %6 %23 0 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %37 = OpCompositeExtract %6 %23 1 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %813 = OpULessThanEqual %50 %19 %60 + %814 = OpSelect %18 %813 %19 %60 + %815 = OpAccessChain %759 %754 %814 + OpBranch %43 + %43 = OpLabel + %518 = OpPhi %18 %19 %443 %61 %44 + %51 = OpSLessThan %50 %518 %49 + OpLoopMerge %45 %44 None + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %58 = OpAccessChain %41 %55 %518 + OpStore %58 %19 + %61 = OpIAdd %18 %518 %60 + OpBranch %43 + %45 = OpLabel + OpBranch %68 + %68 = OpLabel + %591 = OpPhi %50 %66 %45 %569 %71 + %520 = OpPhi %24 %63 %45 %637 %71 + %519 = OpPhi %18 %19 %45 %621 %71 + %821 = OpAccessChain %759 %815 + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %73 = OpIAdd %18 %519 %60 + OpStore %754 %520 + %755 = OpLoad %24 %754 + %76 = OpCompositeExtract %18 %520 0 + %77 = OpSGreaterThan %50 %76 %19 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %83 = OpISub %18 %76 %82 + %85 = OpCompositeExtract %18 %520 1 + %87 = OpIMul %18 %85 %86 + %88 = OpIAdd %18 %83 %87 + %89 = OpAccessChain %41 %55 %88 + %90 = OpLoad %18 %89 + %91 = OpIEqual %50 %90 %19 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %50 %77 %69 %91 %78 + %650 = OpSelect %18 %92 %60 %19 + %98 = OpCompositeExtract %18 %520 1 + %99 = OpSGreaterThan %50 %98 %19 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %106 = OpISub %18 %98 %82 + %107 = OpIMul %18 %106 %86 + %108 = OpIAdd %18 %76 %107 + %109 = OpAccessChain %41 %55 %108 + %110 = OpLoad %18 %109 + %111 = OpIEqual %50 %110 %19 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %50 %99 %79 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %116 = OpIAdd %18 %650 %60 + OpBranch %114 + %114 = OpLabel + %529 = OpPhi %18 %650 %101 %116 %113 + %120 = OpSLessThan %50 %76 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %125 = OpIAdd %18 %76 %82 + %128 = OpIMul %18 %98 %86 + %129 = OpIAdd %18 %125 %128 + %130 = OpAccessChain %41 %55 %129 + %131 = OpLoad %18 %130 + %132 = OpIEqual %50 %131 %19 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %50 %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %137 = OpIAdd %18 %529 %60 + OpBranch %135 + %135 = OpLabel + %533 = OpPhi %18 %529 %122 %137 %134 + %140 = OpSLessThan %50 %98 %119 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %147 = OpIAdd %18 %98 %82 + %148 = OpIMul %18 %147 %86 + %149 = OpIAdd %18 %76 %148 + %150 = OpAccessChain %41 %55 %149 + %151 = OpLoad %18 %150 + %152 = OpIEqual %50 %151 %19 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %50 %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %157 = OpIAdd %18 %533 %60 + OpBranch %155 + %155 = OpLabel + %534 = OpPhi %18 %533 %142 %157 %154 + %159 = OpIEqual %50 %534 %19 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpBranch %163 + %163 = OpLabel + %570 = OpPhi %50 %162 %160 %639 %166 + %568 = OpPhi %24 %520 %160 %619 %166 + %567 = OpPhi %18 %19 %160 %199 %166 + %170 = OpSLessThan %50 %567 %169 + OpLoopMerge %165 %166 None + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpBranch %172 + %172 = OpLabel + %619 = OpPhi %24 %568 %164 %644 %175 + %617 = OpPhi %18 %19 %164 %197 %175 + %639 = OpPhi %50 %570 %164 %651 %175 + %178 = OpSLessThan %50 %617 %169 + OpLoopMerge %174 %175 None + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %180 = OpIMul %18 %617 %82 + %182 = OpIMul %18 %567 %82 + %183 = OpIMul %18 %567 %648 + %184 = OpIAdd %18 %180 %183 + %185 = OpAccessChain %41 %55 %184 + %186 = OpLoad %18 %185 + %187 = OpIEqual %50 %186 %19 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %463 = OpCompositeInsert %24 %180 %649 0 + %465 = OpCompositeInsert %24 %182 %463 1 + OpBranch %189 + %189 = OpLabel + %644 = OpPhi %24 %619 %173 %465 %188 + %651 = OpSelect %50 %187 %66 %639 + OpBranch %175 + %175 = OpLabel + %197 = OpIAdd %18 %617 %60 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %199 = OpIAdd %18 %567 %60 + OpBranch %163 + %165 = OpLabel + %201 = OpCompositeExtract %18 %568 0 + %203 = OpCompositeExtract %18 %568 1 + %204 = OpIMul %18 %203 %86 + %205 = OpIAdd %18 %201 %204 + %206 = OpAccessChain %41 %55 %205 + OpStore %206 %60 + OpBranch %161 + %207 = OpLabel + %211 = OpSMod %18 %73 %534 + %214 = OpIAdd %18 %73 %534 + %216 = OpSGreaterThanEqual %50 %211 %19 + %652 = OpSelect %50 %216 %77 %216 + OpSelectionMerge %224 None + OpBranchConditional %652 %223 %224 + %223 = OpLabel + %227 = OpISub %18 %76 %82 + %230 = OpIMul %18 %98 %86 + %231 = OpIAdd %18 %227 %230 + %232 = OpAccessChain %41 %55 %231 + %233 = OpLoad %18 %232 + %234 = OpIEqual %50 %233 %19 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %50 %652 %207 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %239 = OpISub %18 %211 %60 + %244 = OpIMul %18 %98 %86 + %245 = OpIAdd %18 %76 %244 + %246 = OpAccessChain %41 %55 %245 + OpStore %246 %60 + %249 = OpISub %18 %76 %60 + %253 = OpIAdd %18 %249 %244 + %254 = OpAccessChain %41 %55 %253 + OpStore %254 %60 + %257 = OpISub %18 %76 %82 + %261 = OpIAdd %18 %257 %244 + %262 = OpAccessChain %41 %55 %261 + OpStore %262 %60 + %479 = OpCompositeInsert %24 %257 %520 0 + OpBranch %237 + %237 = OpLabel + %550 = OpPhi %24 %520 %224 %479 %236 + %549 = OpPhi %18 %211 %224 %239 %236 + %268 = OpSGreaterThanEqual %50 %549 %19 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %272 = OpCompositeExtract %18 %550 1 + %273 = OpSGreaterThan %50 %272 %19 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %50 %268 %237 %273 %269 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %278 = OpCompositeExtract %18 %550 0 + %280 = OpCompositeExtract %18 %550 1 + %281 = OpISub %18 %280 %82 + %282 = OpIMul %18 %281 %86 + %283 = OpIAdd %18 %278 %282 + %284 = OpAccessChain %41 %55 %283 + %285 = OpLoad %18 %284 + %286 = OpIEqual %50 %285 %19 + OpBranch %276 + %276 = OpLabel + %287 = OpPhi %50 %274 %270 %286 %275 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %291 = OpISub %18 %549 %60 + %293 = OpCompositeExtract %18 %550 0 + %295 = OpCompositeExtract %18 %550 1 + %296 = OpIMul %18 %295 %86 + %297 = OpIAdd %18 %293 %296 + %298 = OpAccessChain %41 %55 %297 + OpStore %298 %60 + %303 = OpISub %18 %295 %60 + %304 = OpIMul %18 %303 %86 + %305 = OpIAdd %18 %293 %304 + %306 = OpAccessChain %41 %55 %305 + OpStore %306 %60 + %311 = OpISub %18 %295 %82 + %312 = OpIMul %18 %311 %86 + %313 = OpIAdd %18 %293 %312 + %314 = OpAccessChain %41 %55 %313 + OpStore %314 %60 + %491 = OpCompositeInsert %24 %311 %550 1 + OpBranch %289 + %289 = OpLabel + %556 = OpPhi %24 %550 %276 %491 %288 + %555 = OpPhi %18 %549 %276 %291 %288 + %320 = OpSGreaterThanEqual %50 %555 %19 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %324 = OpCompositeExtract %18 %556 0 + %325 = OpSLessThan %50 %324 %119 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %50 %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %330 = OpCompositeExtract %18 %556 0 + %331 = OpIAdd %18 %330 %82 + %333 = OpCompositeExtract %18 %556 1 + %334 = OpIMul %18 %333 %86 + %335 = OpIAdd %18 %331 %334 + %336 = OpAccessChain %41 %55 %335 + %337 = OpLoad %18 %336 + %338 = OpIEqual %50 %337 %19 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %50 %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %343 = OpISub %18 %555 %60 + %345 = OpCompositeExtract %18 %556 0 + %347 = OpCompositeExtract %18 %556 1 + %348 = OpIMul %18 %347 %86 + %349 = OpIAdd %18 %345 %348 + %350 = OpAccessChain %41 %55 %349 + OpStore %350 %60 + %353 = OpIAdd %18 %345 %60 + %357 = OpIAdd %18 %353 %348 + %358 = OpAccessChain %41 %55 %357 + OpStore %358 %60 + %361 = OpIAdd %18 %345 %82 + %365 = OpIAdd %18 %361 %348 + %366 = OpAccessChain %41 %55 %365 + OpStore %366 %60 + %503 = OpCompositeInsert %24 %361 %556 0 + OpBranch %341 + %341 = OpLabel + %562 = OpPhi %24 %556 %328 %503 %340 + %561 = OpPhi %18 %555 %328 %343 %340 + %372 = OpSGreaterThanEqual %50 %561 %19 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %376 = OpCompositeExtract %18 %562 1 + %377 = OpSLessThan %50 %376 %119 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %50 %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %382 = OpCompositeExtract %18 %562 0 + %384 = OpCompositeExtract %18 %562 1 + %385 = OpIAdd %18 %384 %82 + %386 = OpIMul %18 %385 %86 + %387 = OpIAdd %18 %382 %386 + %388 = OpAccessChain %41 %55 %387 + %389 = OpLoad %18 %388 + %390 = OpIEqual %50 %389 %19 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %50 %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %397 = OpCompositeExtract %18 %562 0 + %399 = OpCompositeExtract %18 %562 1 + %400 = OpIMul %18 %399 %86 + %401 = OpIAdd %18 %397 %400 + %402 = OpAccessChain %41 %55 %401 + OpStore %402 %60 + %407 = OpIAdd %18 %399 %60 + %408 = OpIMul %18 %407 %86 + %409 = OpIAdd %18 %397 %408 + %410 = OpAccessChain %41 %55 %409 + OpStore %410 %60 + %415 = OpIAdd %18 %399 %82 + %416 = OpIMul %18 %415 %86 + %417 = OpIAdd %18 %397 %416 + %418 = OpAccessChain %41 %55 %417 + OpStore %418 %60 + %515 = OpCompositeInsert %24 %415 %562 1 + OpBranch %393 + %393 = OpLabel + %638 = OpPhi %24 %562 %380 %515 %392 + OpBranch %161 + %161 = OpLabel + %637 = OpPhi %24 %568 %165 %638 %393 + %621 = OpPhi %18 %73 %165 %214 %393 + %569 = OpPhi %50 %570 %165 %591 %393 + %425 = OpIMul %18 %39 %86 + %428 = OpIAdd %18 %425 %34 + %429 = OpAccessChain %41 %55 %428 + %430 = OpLoad %18 %429 + %431 = OpIEqual %50 %430 %60 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %435 %437 + OpBranch %70 + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranchConditional %569 %68 %70 + %70 = OpLabel + %592 = OpPhi %50 %66 %432 %162 %71 + OpSelectionMerge %445 None + OpBranchConditional %592 %442 %445 + %445 = OpLabel + OpStore %435 %441 + OpBranch %442 + %442 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 32.0 32.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-maze-flatten-copy-composite.amber b/vulkan/amber/graphicsfuzz/spv-stable-maze-flatten-copy-composite.amber new file mode 100644 index 0000000..303cc8d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-maze-flatten-copy-composite.amber @@ -0,0 +1,2011 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Three shaders with diff: conditional %270 is flattened + +# The test renders three images using semantically equivalent shaders, and then +# checks that the images are similar. +# The test passes because the shaders have the same semantics and so the images +# should be the same. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 442 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %435 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "pos" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %26 "ipos" + OpName %42 "i" + OpName %55 "map" + OpName %62 "p" + OpName %65 "canwalk" + OpName %67 "v" + OpName %74 "directions" + OpName %171 "j" + OpName %208 "d" + OpName %435 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %435 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %24 = OpTypeVector %18 2 + %25 = OpTypePointer Function %24 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %29 = OpTypePointer Function %6 + %32 = OpConstant %6 16 + %35 = OpConstant %27 1 + %41 = OpTypePointer Function %18 + %49 = OpConstant %18 256 + %50 = OpTypeBool + %52 = OpConstant %27 256 + %53 = OpTypeArray %18 %52 + %54 = OpTypePointer Private %53 + %55 = OpVariable %54 Private + %57 = OpTypePointer Private %18 + %60 = OpConstant %18 1 + %63 = OpConstantComposite %24 %19 %19 + %64 = OpTypePointer Function %50 + %66 = OpConstantTrue %50 + %82 = OpConstant %18 2 + %86 = OpConstant %18 16 + %119 = OpConstant %18 14 + %162 = OpConstantFalse %50 + %169 = OpConstant %18 8 + %434 = OpTypePointer Output %10 + %435 = OpVariable %434 Output + %436 = OpConstant %6 1 + %437 = OpConstantComposite %10 %436 %436 %436 %436 + %440 = OpConstant %6 0 + %441 = OpConstantComposite %10 %440 %440 %440 %436 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %26 = OpVariable %25 Function + %42 = OpVariable %41 Function + %62 = OpVariable %25 Function + %65 = OpVariable %64 Function + %67 = OpVariable %41 Function + %74 = OpVariable %41 Function + %171 = OpVariable %41 Function + %208 = OpVariable %41 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + OpStore %9 %23 + %30 = OpAccessChain %29 %9 %28 + %31 = OpLoad %6 %30 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %36 = OpAccessChain %29 %9 %35 + %37 = OpLoad %6 %36 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %40 = OpCompositeConstruct %24 %34 %39 + OpStore %26 %40 + OpStore %42 %19 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %18 %42 + %51 = OpSLessThan %50 %48 %49 + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %56 = OpLoad %18 %42 + %58 = OpAccessChain %57 %55 %56 + OpStore %58 %19 + OpBranch %46 + %46 = OpLabel + %59 = OpLoad %18 %42 + %61 = OpIAdd %18 %59 %60 + OpStore %42 %61 + OpBranch %43 + %45 = OpLabel + OpStore %62 %63 + OpStore %65 %66 + OpStore %67 %19 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %72 = OpLoad %18 %67 + %73 = OpIAdd %18 %72 %60 + OpStore %67 %73 + OpStore %74 %19 + %75 = OpAccessChain %41 %62 %28 + %76 = OpLoad %18 %75 + %77 = OpSGreaterThan %50 %76 %19 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %41 %62 %28 + %81 = OpLoad %18 %80 + %83 = OpISub %18 %81 %82 + %84 = OpAccessChain %41 %62 %35 + %85 = OpLoad %18 %84 + %87 = OpIMul %18 %85 %86 + %88 = OpIAdd %18 %83 %87 + %89 = OpAccessChain %57 %55 %88 + %90 = OpLoad %18 %89 + %91 = OpIEqual %50 %90 %19 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %50 %77 %69 %91 %78 + OpSelectionMerge %94 None + OpBranchConditional %92 %93 %94 + %93 = OpLabel + %95 = OpLoad %18 %74 + %96 = OpIAdd %18 %95 %60 + OpStore %74 %96 + OpBranch %94 + %94 = OpLabel + %97 = OpAccessChain %41 %62 %35 + %98 = OpLoad %18 %97 + %99 = OpSGreaterThan %50 %98 %19 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %102 = OpAccessChain %41 %62 %28 + %103 = OpLoad %18 %102 + %104 = OpAccessChain %41 %62 %35 + %105 = OpLoad %18 %104 + %106 = OpISub %18 %105 %82 + %107 = OpIMul %18 %106 %86 + %108 = OpIAdd %18 %103 %107 + %109 = OpAccessChain %57 %55 %108 + %110 = OpLoad %18 %109 + %111 = OpIEqual %50 %110 %19 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %50 %99 %94 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %115 = OpLoad %18 %74 + %116 = OpIAdd %18 %115 %60 + OpStore %74 %116 + OpBranch %114 + %114 = OpLabel + %117 = OpAccessChain %41 %62 %28 + %118 = OpLoad %18 %117 + %120 = OpSLessThan %50 %118 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %41 %62 %28 + %124 = OpLoad %18 %123 + %125 = OpIAdd %18 %124 %82 + %126 = OpAccessChain %41 %62 %35 + %127 = OpLoad %18 %126 + %128 = OpIMul %18 %127 %86 + %129 = OpIAdd %18 %125 %128 + %130 = OpAccessChain %57 %55 %129 + %131 = OpLoad %18 %130 + %132 = OpIEqual %50 %131 %19 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %50 %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %136 = OpLoad %18 %74 + %137 = OpIAdd %18 %136 %60 + OpStore %74 %137 + OpBranch %135 + %135 = OpLabel + %138 = OpAccessChain %41 %62 %35 + %139 = OpLoad %18 %138 + %140 = OpSLessThan %50 %139 %119 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %41 %62 %28 + %144 = OpLoad %18 %143 + %145 = OpAccessChain %41 %62 %35 + %146 = OpLoad %18 %145 + %147 = OpIAdd %18 %146 %82 + %148 = OpIMul %18 %147 %86 + %149 = OpIAdd %18 %144 %148 + %150 = OpAccessChain %57 %55 %149 + %151 = OpLoad %18 %150 + %152 = OpIEqual %50 %151 %19 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %50 %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %156 = OpLoad %18 %74 + %157 = OpIAdd %18 %156 %60 + OpStore %74 %157 + OpBranch %155 + %155 = OpLabel + %158 = OpLoad %18 %74 + %159 = OpIEqual %50 %158 %19 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpStore %65 %162 + OpStore %42 %19 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %18 %42 + %170 = OpSLessThan %50 %168 %169 + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpStore %171 %19 + OpBranch %172 + %172 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %18 %171 + %178 = OpSLessThan %50 %177 %169 + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %179 = OpLoad %18 %171 + %180 = OpIMul %18 %179 %82 + %181 = OpLoad %18 %42 + %182 = OpIMul %18 %181 %82 + %183 = OpIMul %18 %182 %86 + %184 = OpIAdd %18 %180 %183 + %185 = OpAccessChain %57 %55 %184 + %186 = OpLoad %18 %185 + %187 = OpIEqual %50 %186 %19 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %190 = OpLoad %18 %171 + %191 = OpIMul %18 %190 %82 + %192 = OpAccessChain %41 %62 %28 + OpStore %192 %191 + %193 = OpLoad %18 %42 + %194 = OpIMul %18 %193 %82 + %195 = OpAccessChain %41 %62 %35 + OpStore %195 %194 + OpStore %65 %66 + OpBranch %189 + %189 = OpLabel + OpBranch %175 + %175 = OpLabel + %196 = OpLoad %18 %171 + %197 = OpIAdd %18 %196 %60 + OpStore %171 %197 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %198 = OpLoad %18 %42 + %199 = OpIAdd %18 %198 %60 + OpStore %42 %199 + OpBranch %163 + %165 = OpLabel + %200 = OpAccessChain %41 %62 %28 + %201 = OpLoad %18 %200 + %202 = OpAccessChain %41 %62 %35 + %203 = OpLoad %18 %202 + %204 = OpIMul %18 %203 %86 + %205 = OpIAdd %18 %201 %204 + %206 = OpAccessChain %57 %55 %205 + OpStore %206 %60 + OpBranch %161 + %207 = OpLabel + %209 = OpLoad %18 %67 + %210 = OpLoad %18 %74 + %211 = OpSMod %18 %209 %210 + OpStore %208 %211 + %212 = OpLoad %18 %74 + %213 = OpLoad %18 %67 + %214 = OpIAdd %18 %213 %212 + OpStore %67 %214 + %215 = OpLoad %18 %208 + %216 = OpSGreaterThanEqual %50 %215 %19 + OpSelectionMerge %218 None + OpBranchConditional %216 %217 %218 + %217 = OpLabel + %219 = OpAccessChain %41 %62 %28 + %220 = OpLoad %18 %219 + %221 = OpSGreaterThan %50 %220 %19 + OpBranch %218 + %218 = OpLabel + %222 = OpPhi %50 %216 %207 %221 %217 + OpSelectionMerge %224 None + OpBranchConditional %222 %223 %224 + %223 = OpLabel + %225 = OpAccessChain %41 %62 %28 + %226 = OpLoad %18 %225 + %227 = OpISub %18 %226 %82 + %228 = OpAccessChain %41 %62 %35 + %229 = OpLoad %18 %228 + %230 = OpIMul %18 %229 %86 + %231 = OpIAdd %18 %227 %230 + %232 = OpAccessChain %57 %55 %231 + %233 = OpLoad %18 %232 + %234 = OpIEqual %50 %233 %19 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %50 %222 %218 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %238 = OpLoad %18 %208 + %239 = OpISub %18 %238 %60 + OpStore %208 %239 + %240 = OpAccessChain %41 %62 %28 + %241 = OpLoad %18 %240 + %242 = OpAccessChain %41 %62 %35 + %243 = OpLoad %18 %242 + %244 = OpIMul %18 %243 %86 + %245 = OpIAdd %18 %241 %244 + %246 = OpAccessChain %57 %55 %245 + OpStore %246 %60 + %247 = OpAccessChain %41 %62 %28 + %248 = OpLoad %18 %247 + %249 = OpISub %18 %248 %60 + %250 = OpAccessChain %41 %62 %35 + %251 = OpLoad %18 %250 + %252 = OpIMul %18 %251 %86 + %253 = OpIAdd %18 %249 %252 + %254 = OpAccessChain %57 %55 %253 + OpStore %254 %60 + %255 = OpAccessChain %41 %62 %28 + %256 = OpLoad %18 %255 + %257 = OpISub %18 %256 %82 + %258 = OpAccessChain %41 %62 %35 + %259 = OpLoad %18 %258 + %260 = OpIMul %18 %259 %86 + %261 = OpIAdd %18 %257 %260 + %262 = OpAccessChain %57 %55 %261 + OpStore %262 %60 + %263 = OpAccessChain %41 %62 %28 + %264 = OpLoad %18 %263 + %265 = OpISub %18 %264 %82 + %266 = OpAccessChain %41 %62 %28 + OpStore %266 %265 + OpBranch %237 + %237 = OpLabel + %267 = OpLoad %18 %208 + %268 = OpSGreaterThanEqual %50 %267 %19 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %271 = OpAccessChain %41 %62 %35 + %272 = OpLoad %18 %271 + %273 = OpSGreaterThan %50 %272 %19 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %50 %268 %237 %273 %269 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %277 = OpAccessChain %41 %62 %28 + %278 = OpLoad %18 %277 + %279 = OpAccessChain %41 %62 %35 + %280 = OpLoad %18 %279 + %281 = OpISub %18 %280 %82 + %282 = OpIMul %18 %281 %86 + %283 = OpIAdd %18 %278 %282 + %284 = OpAccessChain %57 %55 %283 + %285 = OpLoad %18 %284 + %286 = OpIEqual %50 %285 %19 + OpBranch %276 + %276 = OpLabel + %287 = OpPhi %50 %274 %270 %286 %275 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %290 = OpLoad %18 %208 + %291 = OpISub %18 %290 %60 + OpStore %208 %291 + %292 = OpAccessChain %41 %62 %28 + %293 = OpLoad %18 %292 + %294 = OpAccessChain %41 %62 %35 + %295 = OpLoad %18 %294 + %296 = OpIMul %18 %295 %86 + %297 = OpIAdd %18 %293 %296 + %298 = OpAccessChain %57 %55 %297 + OpStore %298 %60 + %299 = OpAccessChain %41 %62 %28 + %300 = OpLoad %18 %299 + %301 = OpAccessChain %41 %62 %35 + %302 = OpLoad %18 %301 + %303 = OpISub %18 %302 %60 + %304 = OpIMul %18 %303 %86 + %305 = OpIAdd %18 %300 %304 + %306 = OpAccessChain %57 %55 %305 + OpStore %306 %60 + %307 = OpAccessChain %41 %62 %28 + %308 = OpLoad %18 %307 + %309 = OpAccessChain %41 %62 %35 + %310 = OpLoad %18 %309 + %311 = OpISub %18 %310 %82 + %312 = OpIMul %18 %311 %86 + %313 = OpIAdd %18 %308 %312 + %314 = OpAccessChain %57 %55 %313 + OpStore %314 %60 + %315 = OpAccessChain %41 %62 %35 + %316 = OpLoad %18 %315 + %317 = OpISub %18 %316 %82 + %318 = OpAccessChain %41 %62 %35 + OpStore %318 %317 + OpBranch %289 + %289 = OpLabel + %319 = OpLoad %18 %208 + %320 = OpSGreaterThanEqual %50 %319 %19 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %41 %62 %28 + %324 = OpLoad %18 %323 + %325 = OpSLessThan %50 %324 %119 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %50 %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %41 %62 %28 + %330 = OpLoad %18 %329 + %331 = OpIAdd %18 %330 %82 + %332 = OpAccessChain %41 %62 %35 + %333 = OpLoad %18 %332 + %334 = OpIMul %18 %333 %86 + %335 = OpIAdd %18 %331 %334 + %336 = OpAccessChain %57 %55 %335 + %337 = OpLoad %18 %336 + %338 = OpIEqual %50 %337 %19 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %50 %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %342 = OpLoad %18 %208 + %343 = OpISub %18 %342 %60 + OpStore %208 %343 + %344 = OpAccessChain %41 %62 %28 + %345 = OpLoad %18 %344 + %346 = OpAccessChain %41 %62 %35 + %347 = OpLoad %18 %346 + %348 = OpIMul %18 %347 %86 + %349 = OpIAdd %18 %345 %348 + %350 = OpAccessChain %57 %55 %349 + OpStore %350 %60 + %351 = OpAccessChain %41 %62 %28 + %352 = OpLoad %18 %351 + %353 = OpIAdd %18 %352 %60 + %354 = OpAccessChain %41 %62 %35 + %355 = OpLoad %18 %354 + %356 = OpIMul %18 %355 %86 + %357 = OpIAdd %18 %353 %356 + %358 = OpAccessChain %57 %55 %357 + OpStore %358 %60 + %359 = OpAccessChain %41 %62 %28 + %360 = OpLoad %18 %359 + %361 = OpIAdd %18 %360 %82 + %362 = OpAccessChain %41 %62 %35 + %363 = OpLoad %18 %362 + %364 = OpIMul %18 %363 %86 + %365 = OpIAdd %18 %361 %364 + %366 = OpAccessChain %57 %55 %365 + OpStore %366 %60 + %367 = OpAccessChain %41 %62 %28 + %368 = OpLoad %18 %367 + %369 = OpIAdd %18 %368 %82 + %370 = OpAccessChain %41 %62 %28 + OpStore %370 %369 + OpBranch %341 + %341 = OpLabel + %371 = OpLoad %18 %208 + %372 = OpSGreaterThanEqual %50 %371 %19 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %375 = OpAccessChain %41 %62 %35 + %376 = OpLoad %18 %375 + %377 = OpSLessThan %50 %376 %119 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %50 %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %381 = OpAccessChain %41 %62 %28 + %382 = OpLoad %18 %381 + %383 = OpAccessChain %41 %62 %35 + %384 = OpLoad %18 %383 + %385 = OpIAdd %18 %384 %82 + %386 = OpIMul %18 %385 %86 + %387 = OpIAdd %18 %382 %386 + %388 = OpAccessChain %57 %55 %387 + %389 = OpLoad %18 %388 + %390 = OpIEqual %50 %389 %19 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %50 %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %394 = OpLoad %18 %208 + %395 = OpISub %18 %394 %60 + OpStore %208 %395 + %396 = OpAccessChain %41 %62 %28 + %397 = OpLoad %18 %396 + %398 = OpAccessChain %41 %62 %35 + %399 = OpLoad %18 %398 + %400 = OpIMul %18 %399 %86 + %401 = OpIAdd %18 %397 %400 + %402 = OpAccessChain %57 %55 %401 + OpStore %402 %60 + %403 = OpAccessChain %41 %62 %28 + %404 = OpLoad %18 %403 + %405 = OpAccessChain %41 %62 %35 + %406 = OpLoad %18 %405 + %407 = OpIAdd %18 %406 %60 + %408 = OpIMul %18 %407 %86 + %409 = OpIAdd %18 %404 %408 + %410 = OpAccessChain %57 %55 %409 + OpStore %410 %60 + %411 = OpAccessChain %41 %62 %28 + %412 = OpLoad %18 %411 + %413 = OpAccessChain %41 %62 %35 + %414 = OpLoad %18 %413 + %415 = OpIAdd %18 %414 %82 + %416 = OpIMul %18 %415 %86 + %417 = OpIAdd %18 %412 %416 + %418 = OpAccessChain %57 %55 %417 + OpStore %418 %60 + %419 = OpAccessChain %41 %62 %35 + %420 = OpLoad %18 %419 + %421 = OpIAdd %18 %420 %82 + %422 = OpAccessChain %41 %62 %35 + OpStore %422 %421 + OpBranch %393 + %393 = OpLabel + OpBranch %161 + %161 = OpLabel + %423 = OpAccessChain %41 %26 %35 + %424 = OpLoad %18 %423 + %425 = OpIMul %18 %424 %86 + %426 = OpAccessChain %41 %26 %28 + %427 = OpLoad %18 %426 + %428 = OpIAdd %18 %425 %427 + %429 = OpAccessChain %57 %55 %428 + %430 = OpLoad %18 %429 + %431 = OpIEqual %50 %430 %60 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %435 %437 + OpReturn + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + %439 = OpLoad %50 %65 + OpBranchConditional %439 %68 %70 + %70 = OpLabel + OpStore %435 %441 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 32.0 32.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 1443 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %435 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "pos" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %26 "ipos" + OpName %42 "i" + OpName %55 "map" + OpName %62 "p" + OpName %65 "canwalk" + OpName %67 "v" + OpName %74 "directions" + OpName %171 "j" + OpName %208 "d" + OpName %435 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %435 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %24 = OpTypeVector %18 2 + %25 = OpTypePointer Function %24 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %29 = OpTypePointer Function %6 + %32 = OpConstant %6 16 + %35 = OpConstant %27 1 + %41 = OpTypePointer Function %18 + %49 = OpConstant %18 256 + %50 = OpTypeBool + %52 = OpConstant %27 256 + %53 = OpTypeArray %18 %52 + %54 = OpTypePointer Private %53 + %55 = OpVariable %54 Private + %57 = OpTypePointer Private %18 + %60 = OpConstant %18 1 + %63 = OpConstantComposite %24 %19 %19 + %64 = OpTypePointer Function %50 + %66 = OpConstantTrue %50 + %82 = OpConstant %18 2 + %86 = OpConstant %18 16 + %119 = OpConstant %18 14 + %162 = OpConstantFalse %50 + %169 = OpConstant %18 8 + %434 = OpTypePointer Output %10 + %435 = OpVariable %434 Output + %436 = OpConstant %6 1 + %437 = OpConstantComposite %10 %436 %436 %436 %436 + %440 = OpConstant %6 0 + %441 = OpConstantComposite %10 %440 %440 %440 %436 + %542 = OpConstant %18 0 + %566 = OpConstantComposite %53 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %26 = OpVariable %25 Function + %42 = OpVariable %41 Function + %62 = OpVariable %25 Function + %65 = OpVariable %64 Function + %67 = OpVariable %41 Function + %74 = OpVariable %41 Function + %171 = OpVariable %41 Function + %208 = OpVariable %41 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + OpStore %9 %23 + %30 = OpAccessChain %29 %9 %28 + %31 = OpLoad %6 %30 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %36 = OpAccessChain %29 %9 %35 + %37 = OpLoad %6 %36 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %40 = OpCompositeConstruct %24 %34 %39 + OpStore %26 %40 + OpStore %42 %19 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %18 %42 + %51 = OpSLessThan %50 %48 %49 + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %56 = OpLoad %18 %42 + %58 = OpAccessChain %57 %55 %56 + OpStore %58 %19 + OpBranch %46 + %46 = OpLabel + %59 = OpLoad %18 %42 + %61 = OpIAdd %18 %59 %60 + OpStore %42 %61 + OpBranch %43 + %45 = OpLabel + OpStore %62 %63 + OpStore %65 %66 + OpStore %67 %19 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %72 = OpLoad %18 %67 + %73 = OpIAdd %18 %72 %60 + OpStore %67 %73 + OpStore %74 %19 + %75 = OpAccessChain %41 %62 %28 + %76 = OpLoad %18 %75 + %77 = OpSGreaterThan %50 %76 %19 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %41 %62 %28 + %81 = OpLoad %18 %80 + %83 = OpISub %18 %81 %82 + %84 = OpAccessChain %41 %62 %35 + %85 = OpLoad %18 %84 + %87 = OpIMul %18 %85 %86 + %88 = OpIAdd %18 %83 %87 + %89 = OpAccessChain %57 %55 %88 + %90 = OpLoad %18 %89 + %91 = OpIEqual %50 %90 %19 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %50 %77 %69 %91 %78 + OpSelectionMerge %94 None + OpBranchConditional %92 %93 %94 + %93 = OpLabel + %95 = OpLoad %18 %74 + %96 = OpIAdd %18 %95 %60 + OpStore %74 %96 + OpBranch %94 + %94 = OpLabel + %97 = OpAccessChain %41 %62 %35 + %98 = OpLoad %18 %97 + %99 = OpSGreaterThan %50 %98 %19 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %102 = OpAccessChain %41 %62 %28 + %103 = OpLoad %18 %102 + %104 = OpAccessChain %41 %62 %35 + %105 = OpLoad %18 %104 + %106 = OpISub %18 %105 %82 + %107 = OpIMul %18 %106 %86 + %108 = OpIAdd %18 %103 %107 + %109 = OpAccessChain %57 %55 %108 + %110 = OpLoad %18 %109 + %111 = OpIEqual %50 %110 %19 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %50 %99 %94 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %115 = OpLoad %18 %74 + %116 = OpIAdd %18 %115 %60 + OpStore %74 %116 + OpBranch %114 + %114 = OpLabel + %117 = OpAccessChain %41 %62 %28 + %118 = OpLoad %18 %117 + %120 = OpSLessThan %50 %118 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %41 %62 %28 + %124 = OpLoad %18 %123 + %125 = OpIAdd %18 %124 %82 + %126 = OpAccessChain %41 %62 %35 + %127 = OpLoad %18 %126 + %128 = OpIMul %18 %127 %86 + %129 = OpIAdd %18 %125 %128 + %130 = OpAccessChain %57 %55 %129 + %131 = OpLoad %18 %130 + %132 = OpIEqual %50 %131 %19 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %50 %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %136 = OpLoad %18 %74 + %137 = OpIAdd %18 %136 %60 + OpStore %74 %137 + OpBranch %135 + %135 = OpLabel + %138 = OpAccessChain %41 %62 %35 + %139 = OpLoad %18 %138 + %140 = OpSLessThan %50 %139 %119 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %41 %62 %28 + %144 = OpLoad %18 %143 + %145 = OpAccessChain %41 %62 %35 + %146 = OpLoad %18 %145 + %147 = OpIAdd %18 %146 %82 + %148 = OpIMul %18 %147 %86 + %149 = OpIAdd %18 %144 %148 + %150 = OpAccessChain %57 %55 %149 + %151 = OpLoad %18 %150 + %152 = OpIEqual %50 %151 %19 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %50 %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %156 = OpLoad %18 %74 + %157 = OpIAdd %18 %156 %60 + OpStore %74 %157 + OpBranch %155 + %155 = OpLabel + %158 = OpLoad %18 %74 + %159 = OpIEqual %50 %158 %19 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpStore %65 %162 + OpStore %42 %19 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %18 %42 + %170 = OpSLessThan %50 %168 %169 + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpStore %171 %19 + OpBranch %172 + %172 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %18 %171 + %178 = OpSLessThan %50 %177 %169 + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %179 = OpLoad %18 %171 + %180 = OpIMul %18 %179 %82 + %181 = OpLoad %18 %42 + %182 = OpIMul %18 %181 %82 + %183 = OpIMul %18 %182 %86 + %184 = OpIAdd %18 %180 %183 + %185 = OpAccessChain %57 %55 %184 + %186 = OpLoad %18 %185 + %187 = OpIEqual %50 %186 %19 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %190 = OpLoad %18 %171 + %191 = OpIMul %18 %190 %82 + %192 = OpAccessChain %41 %62 %28 + OpStore %192 %191 + %193 = OpLoad %18 %42 + %194 = OpIMul %18 %193 %82 + %195 = OpAccessChain %41 %62 %35 + OpStore %195 %194 + OpStore %65 %66 + OpBranch %189 + %189 = OpLabel + OpBranch %175 + %175 = OpLabel + %196 = OpLoad %18 %171 + %197 = OpIAdd %18 %196 %60 + OpStore %171 %197 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %198 = OpLoad %18 %42 + %199 = OpIAdd %18 %198 %60 + OpStore %42 %199 + OpBranch %163 + %165 = OpLabel + %200 = OpAccessChain %41 %62 %28 + %201 = OpLoad %18 %200 + %202 = OpAccessChain %41 %62 %35 + %203 = OpLoad %18 %202 + %204 = OpIMul %18 %203 %86 + %205 = OpIAdd %18 %201 %204 + %206 = OpAccessChain %57 %55 %205 + OpStore %206 %60 + OpBranch %161 + %207 = OpLabel + %209 = OpLoad %18 %67 + %210 = OpLoad %18 %74 + %211 = OpSMod %18 %209 %210 + OpStore %208 %211 + %212 = OpLoad %18 %74 + %213 = OpLoad %18 %67 + %214 = OpIAdd %18 %213 %212 + OpStore %67 %214 + %215 = OpLoad %18 %208 + %216 = OpSGreaterThanEqual %50 %215 %19 + OpSelectionMerge %218 None + OpBranchConditional %216 %217 %218 + %217 = OpLabel + %219 = OpAccessChain %41 %62 %28 + %220 = OpLoad %18 %219 + %221 = OpSGreaterThan %50 %220 %19 + OpBranch %218 + %218 = OpLabel + %222 = OpPhi %50 %216 %207 %221 %217 + OpSelectionMerge %224 None + OpBranchConditional %222 %223 %224 + %223 = OpLabel + %225 = OpAccessChain %41 %62 %28 + %226 = OpLoad %18 %225 + %227 = OpISub %18 %226 %82 + %228 = OpAccessChain %41 %62 %35 + %229 = OpLoad %18 %228 + %230 = OpIMul %18 %229 %86 + %231 = OpIAdd %18 %227 %230 + %232 = OpAccessChain %57 %55 %231 + %233 = OpLoad %18 %232 + %234 = OpIEqual %50 %233 %19 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %50 %222 %218 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %238 = OpLoad %18 %208 + %239 = OpISub %18 %238 %60 + OpStore %208 %239 + %240 = OpAccessChain %41 %62 %28 + %241 = OpLoad %18 %240 + %242 = OpAccessChain %41 %62 %35 + %243 = OpLoad %18 %242 + %244 = OpIMul %18 %243 %86 + %245 = OpIAdd %18 %241 %244 + %246 = OpAccessChain %57 %55 %245 + OpStore %246 %60 + %247 = OpAccessChain %41 %62 %28 + %248 = OpLoad %18 %247 + %249 = OpISub %18 %248 %60 + %250 = OpAccessChain %41 %62 %35 + %251 = OpLoad %18 %250 + %252 = OpIMul %18 %251 %86 + %253 = OpIAdd %18 %249 %252 + %254 = OpAccessChain %57 %55 %253 + OpStore %254 %60 + %255 = OpAccessChain %41 %62 %28 + %256 = OpLoad %18 %255 + %257 = OpISub %18 %256 %82 + %258 = OpAccessChain %41 %62 %35 + %259 = OpLoad %18 %258 + %260 = OpIMul %18 %259 %86 + %261 = OpIAdd %18 %257 %260 + %262 = OpAccessChain %57 %55 %261 + OpStore %262 %60 + %263 = OpAccessChain %41 %62 %28 + %264 = OpLoad %18 %263 + %265 = OpISub %18 %264 %82 + %266 = OpAccessChain %41 %62 %28 + OpStore %266 %265 + OpBranch %237 + %237 = OpLabel + %267 = OpLoad %18 %208 + %268 = OpSGreaterThanEqual %50 %267 %19 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %271 = OpAccessChain %41 %62 %35 + %272 = OpLoad %18 %271 + %273 = OpSGreaterThan %50 %272 %19 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %50 %268 %237 %273 %269 + OpBranch %275 + %275 = OpLabel + %277 = OpAccessChain %41 %62 %28 + OpSelectionMerge %1419 None + OpBranchConditional %274 %1420 %1422 + %1420 = OpLabel + %1421 = OpLoad %18 %277 + OpBranch %1419 + %1422 = OpLabel + %1423 = OpCopyObject %18 %542 + OpBranch %1419 + %1419 = OpLabel + %278 = OpPhi %18 %1421 %1420 %1423 %1422 + %279 = OpAccessChain %41 %62 %35 + OpSelectionMerge %1424 None + OpBranchConditional %274 %1425 %1427 + %1425 = OpLabel + %1426 = OpLoad %18 %279 + OpBranch %1424 + %1427 = OpLabel + %1428 = OpCopyObject %18 %542 + OpBranch %1424 + %1424 = OpLabel + %280 = OpPhi %18 %1426 %1425 %1428 %1427 + %281 = OpISub %18 %280 %82 + %282 = OpIMul %18 %281 %86 + OpSelectionMerge %1434 None + OpBranchConditional %274 %1435 %1437 + %1435 = OpLabel + %1436 = OpLoad %53 %55 + OpBranch %1434 + %1437 = OpLabel + %1438 = OpCopyObject %53 %566 + OpBranch %1434 + %1434 = OpLabel + %773 = OpPhi %53 %1436 %1435 %1438 %1437 + OpSelectionMerge %1439 None + OpBranchConditional %274 %1440 %1439 + %1440 = OpLabel + OpStore %55 %566 + OpBranch %1439 + %1439 = OpLabel + OpSelectionMerge %1441 None + OpBranchConditional %274 %1442 %1441 + %1442 = OpLabel + OpStore %55 %773 + OpBranch %1441 + %1441 = OpLabel + %283 = OpIAdd %18 %278 %282 + %284 = OpAccessChain %57 %55 %283 + OpSelectionMerge %1429 None + OpBranchConditional %274 %1430 %1432 + %1430 = OpLabel + %1431 = OpLoad %18 %284 + OpBranch %1429 + %1432 = OpLabel + %1433 = OpCopyObject %18 %542 + OpBranch %1429 + %1429 = OpLabel + %285 = OpPhi %18 %1431 %1430 %1433 %1432 + %286 = OpIEqual %50 %285 %19 + OpBranch %276 + %276 = OpLabel + %287 = OpSelect %50 %274 %286 %274 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %290 = OpLoad %18 %208 + %291 = OpISub %18 %290 %60 + OpStore %208 %291 + %292 = OpAccessChain %41 %62 %28 + %293 = OpLoad %18 %292 + %294 = OpAccessChain %41 %62 %35 + %295 = OpLoad %18 %294 + %296 = OpIMul %18 %295 %86 + %297 = OpIAdd %18 %293 %296 + %298 = OpAccessChain %57 %55 %297 + OpStore %298 %60 + %299 = OpAccessChain %41 %62 %28 + %300 = OpLoad %18 %299 + %301 = OpAccessChain %41 %62 %35 + %302 = OpLoad %18 %301 + %303 = OpISub %18 %302 %60 + %304 = OpIMul %18 %303 %86 + %305 = OpIAdd %18 %300 %304 + %306 = OpAccessChain %57 %55 %305 + OpStore %306 %60 + %307 = OpAccessChain %41 %62 %28 + %308 = OpLoad %18 %307 + %309 = OpAccessChain %41 %62 %35 + %310 = OpLoad %18 %309 + %311 = OpISub %18 %310 %82 + %800 = OpLoad %53 %55 + OpStore %55 %566 + OpStore %55 %800 + %312 = OpIMul %18 %311 %86 + %313 = OpIAdd %18 %308 %312 + %314 = OpAccessChain %57 %55 %313 + OpStore %314 %60 + %315 = OpAccessChain %41 %62 %35 + %316 = OpLoad %18 %315 + %317 = OpISub %18 %316 %82 + %318 = OpAccessChain %41 %62 %35 + OpStore %318 %317 + OpBranch %289 + %289 = OpLabel + %319 = OpLoad %18 %208 + %320 = OpSGreaterThanEqual %50 %319 %19 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %41 %62 %28 + %324 = OpLoad %18 %323 + %325 = OpSLessThan %50 %324 %119 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %50 %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %41 %62 %28 + %330 = OpLoad %18 %329 + %331 = OpIAdd %18 %330 %82 + %332 = OpAccessChain %41 %62 %35 + %333 = OpLoad %18 %332 + %334 = OpIMul %18 %333 %86 + %335 = OpIAdd %18 %331 %334 + %336 = OpAccessChain %57 %55 %335 + %337 = OpLoad %18 %336 + %338 = OpIEqual %50 %337 %19 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %50 %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %342 = OpLoad %18 %208 + %343 = OpISub %18 %342 %60 + OpStore %208 %343 + %344 = OpAccessChain %41 %62 %28 + %345 = OpLoad %18 %344 + %346 = OpAccessChain %41 %62 %35 + %347 = OpLoad %18 %346 + %348 = OpIMul %18 %347 %86 + %349 = OpIAdd %18 %345 %348 + %350 = OpAccessChain %57 %55 %349 + OpStore %350 %60 + %351 = OpAccessChain %41 %62 %28 + %352 = OpLoad %18 %351 + %353 = OpIAdd %18 %352 %60 + %354 = OpAccessChain %41 %62 %35 + %355 = OpLoad %18 %354 + %356 = OpIMul %18 %355 %86 + %357 = OpIAdd %18 %353 %356 + %358 = OpAccessChain %57 %55 %357 + OpStore %358 %60 + %359 = OpAccessChain %41 %62 %28 + %360 = OpLoad %18 %359 + %361 = OpIAdd %18 %360 %82 + %362 = OpAccessChain %41 %62 %35 + %363 = OpLoad %18 %362 + %364 = OpIMul %18 %363 %86 + %365 = OpIAdd %18 %361 %364 + %366 = OpAccessChain %57 %55 %365 + OpStore %366 %60 + %367 = OpAccessChain %41 %62 %28 + %368 = OpLoad %18 %367 + %369 = OpIAdd %18 %368 %82 + %370 = OpAccessChain %41 %62 %28 + OpStore %370 %369 + OpBranch %341 + %341 = OpLabel + %371 = OpLoad %18 %208 + %372 = OpSGreaterThanEqual %50 %371 %19 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %375 = OpAccessChain %41 %62 %35 + %376 = OpLoad %18 %375 + %377 = OpSLessThan %50 %376 %119 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %50 %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %381 = OpAccessChain %41 %62 %28 + %382 = OpLoad %18 %381 + %383 = OpAccessChain %41 %62 %35 + %384 = OpLoad %18 %383 + %385 = OpIAdd %18 %384 %82 + %386 = OpIMul %18 %385 %86 + %387 = OpIAdd %18 %382 %386 + %388 = OpAccessChain %57 %55 %387 + %389 = OpLoad %18 %388 + %390 = OpIEqual %50 %389 %19 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %50 %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %394 = OpLoad %18 %208 + %395 = OpISub %18 %394 %60 + OpStore %208 %395 + %396 = OpAccessChain %41 %62 %28 + %397 = OpLoad %18 %396 + %398 = OpAccessChain %41 %62 %35 + %399 = OpLoad %18 %398 + %400 = OpIMul %18 %399 %86 + %401 = OpIAdd %18 %397 %400 + %402 = OpAccessChain %57 %55 %401 + OpStore %402 %60 + %403 = OpAccessChain %41 %62 %28 + %404 = OpLoad %18 %403 + %405 = OpAccessChain %41 %62 %35 + %406 = OpLoad %18 %405 + %407 = OpIAdd %18 %406 %60 + %408 = OpIMul %18 %407 %86 + %409 = OpIAdd %18 %404 %408 + %410 = OpAccessChain %57 %55 %409 + OpStore %410 %60 + %411 = OpAccessChain %41 %62 %28 + %412 = OpLoad %18 %411 + %413 = OpAccessChain %41 %62 %35 + %414 = OpLoad %18 %413 + %415 = OpIAdd %18 %414 %82 + %416 = OpIMul %18 %415 %86 + %417 = OpIAdd %18 %412 %416 + %418 = OpAccessChain %57 %55 %417 + OpStore %418 %60 + %419 = OpAccessChain %41 %62 %35 + %420 = OpLoad %18 %419 + %421 = OpIAdd %18 %420 %82 + %422 = OpAccessChain %41 %62 %35 + OpStore %422 %421 + OpBranch %393 + %393 = OpLabel + OpBranch %161 + %161 = OpLabel + %423 = OpAccessChain %41 %26 %35 + %424 = OpLoad %18 %423 + %425 = OpIMul %18 %424 %86 + %426 = OpAccessChain %41 %26 %28 + %427 = OpLoad %18 %426 + %428 = OpIAdd %18 %425 %427 + %429 = OpAccessChain %57 %55 %428 + %430 = OpLoad %18 %429 + %431 = OpIEqual %50 %430 %60 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %435 %437 + OpReturn + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + %439 = OpLoad %50 %65 + OpBranchConditional %439 %68 %70 + %70 = OpLabel + OpStore %435 %441 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 32.0 32.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + + +SHADER vertex variant_2_vertex_shader PASSTHROUGH + +SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 801 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %435 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "pos" + OpName %12 "gl_FragCoord" + OpName %15 "buf0" + OpMemberName %15 0 "resolution" + OpName %17 "" + OpName %26 "ipos" + OpName %42 "i" + OpName %55 "map" + OpName %62 "p" + OpName %65 "canwalk" + OpName %67 "v" + OpName %74 "directions" + OpName %171 "j" + OpName %208 "d" + OpName %435 "_GLF_color" + OpDecorate %12 BuiltIn FragCoord + OpMemberDecorate %15 0 Offset 0 + OpDecorate %15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %435 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpTypeVector %6 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %15 = OpTypeStruct %7 + %16 = OpTypePointer Uniform %15 + %17 = OpVariable %16 Uniform + %18 = OpTypeInt 32 1 + %19 = OpConstant %18 0 + %20 = OpTypePointer Uniform %7 + %24 = OpTypeVector %18 2 + %25 = OpTypePointer Function %24 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 0 + %29 = OpTypePointer Function %6 + %32 = OpConstant %6 16 + %35 = OpConstant %27 1 + %41 = OpTypePointer Function %18 + %49 = OpConstant %18 256 + %50 = OpTypeBool + %52 = OpConstant %27 256 + %53 = OpTypeArray %18 %52 + %54 = OpTypePointer Private %53 + %55 = OpVariable %54 Private + %57 = OpTypePointer Private %18 + %60 = OpConstant %18 1 + %63 = OpConstantComposite %24 %19 %19 + %64 = OpTypePointer Function %50 + %66 = OpConstantTrue %50 + %82 = OpConstant %18 2 + %86 = OpConstant %18 16 + %119 = OpConstant %18 14 + %162 = OpConstantFalse %50 + %169 = OpConstant %18 8 + %434 = OpTypePointer Output %10 + %435 = OpVariable %434 Output + %436 = OpConstant %6 1 + %437 = OpConstantComposite %10 %436 %436 %436 %436 + %440 = OpConstant %6 0 + %441 = OpConstantComposite %10 %440 %440 %440 %436 + %542 = OpConstant %18 0 + %566 = OpConstantComposite %53 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %26 = OpVariable %25 Function + %42 = OpVariable %41 Function + %62 = OpVariable %25 Function + %65 = OpVariable %64 Function + %67 = OpVariable %41 Function + %74 = OpVariable %41 Function + %171 = OpVariable %41 Function + %208 = OpVariable %41 Function + %13 = OpLoad %10 %12 + %14 = OpVectorShuffle %7 %13 %13 0 1 + %21 = OpAccessChain %20 %17 %19 + %22 = OpLoad %7 %21 + %23 = OpFDiv %7 %14 %22 + OpStore %9 %23 + %30 = OpAccessChain %29 %9 %28 + %31 = OpLoad %6 %30 + %33 = OpFMul %6 %31 %32 + %34 = OpConvertFToS %18 %33 + %36 = OpAccessChain %29 %9 %35 + %37 = OpLoad %6 %36 + %38 = OpFMul %6 %37 %32 + %39 = OpConvertFToS %18 %38 + %40 = OpCompositeConstruct %24 %34 %39 + OpStore %26 %40 + OpStore %42 %19 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %18 %42 + %51 = OpSLessThan %50 %48 %49 + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %56 = OpLoad %18 %42 + %58 = OpAccessChain %57 %55 %56 + OpStore %58 %19 + OpBranch %46 + %46 = OpLabel + %59 = OpLoad %18 %42 + %61 = OpIAdd %18 %59 %60 + OpStore %42 %61 + OpBranch %43 + %45 = OpLabel + OpStore %62 %63 + OpStore %65 %66 + OpStore %67 %19 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %72 = OpLoad %18 %67 + %73 = OpIAdd %18 %72 %60 + OpStore %67 %73 + OpStore %74 %19 + %75 = OpAccessChain %41 %62 %28 + %76 = OpLoad %18 %75 + %77 = OpSGreaterThan %50 %76 %19 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %41 %62 %28 + %81 = OpLoad %18 %80 + %83 = OpISub %18 %81 %82 + %84 = OpAccessChain %41 %62 %35 + %85 = OpLoad %18 %84 + %87 = OpIMul %18 %85 %86 + %88 = OpIAdd %18 %83 %87 + %89 = OpAccessChain %57 %55 %88 + %90 = OpLoad %18 %89 + %91 = OpIEqual %50 %90 %19 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %50 %77 %69 %91 %78 + OpSelectionMerge %94 None + OpBranchConditional %92 %93 %94 + %93 = OpLabel + %95 = OpLoad %18 %74 + %96 = OpIAdd %18 %95 %60 + OpStore %74 %96 + OpBranch %94 + %94 = OpLabel + %97 = OpAccessChain %41 %62 %35 + %98 = OpLoad %18 %97 + %99 = OpSGreaterThan %50 %98 %19 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %102 = OpAccessChain %41 %62 %28 + %103 = OpLoad %18 %102 + %104 = OpAccessChain %41 %62 %35 + %105 = OpLoad %18 %104 + %106 = OpISub %18 %105 %82 + %107 = OpIMul %18 %106 %86 + %108 = OpIAdd %18 %103 %107 + %109 = OpAccessChain %57 %55 %108 + %110 = OpLoad %18 %109 + %111 = OpIEqual %50 %110 %19 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %50 %99 %94 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %115 = OpLoad %18 %74 + %116 = OpIAdd %18 %115 %60 + OpStore %74 %116 + OpBranch %114 + %114 = OpLabel + %117 = OpAccessChain %41 %62 %28 + %118 = OpLoad %18 %117 + %120 = OpSLessThan %50 %118 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %41 %62 %28 + %124 = OpLoad %18 %123 + %125 = OpIAdd %18 %124 %82 + %126 = OpAccessChain %41 %62 %35 + %127 = OpLoad %18 %126 + %128 = OpIMul %18 %127 %86 + %129 = OpIAdd %18 %125 %128 + %130 = OpAccessChain %57 %55 %129 + %131 = OpLoad %18 %130 + %132 = OpIEqual %50 %131 %19 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %50 %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %136 = OpLoad %18 %74 + %137 = OpIAdd %18 %136 %60 + OpStore %74 %137 + OpBranch %135 + %135 = OpLabel + %138 = OpAccessChain %41 %62 %35 + %139 = OpLoad %18 %138 + %140 = OpSLessThan %50 %139 %119 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %41 %62 %28 + %144 = OpLoad %18 %143 + %145 = OpAccessChain %41 %62 %35 + %146 = OpLoad %18 %145 + %147 = OpIAdd %18 %146 %82 + %148 = OpIMul %18 %147 %86 + %149 = OpIAdd %18 %144 %148 + %150 = OpAccessChain %57 %55 %149 + %151 = OpLoad %18 %150 + %152 = OpIEqual %50 %151 %19 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %50 %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %156 = OpLoad %18 %74 + %157 = OpIAdd %18 %156 %60 + OpStore %74 %157 + OpBranch %155 + %155 = OpLabel + %158 = OpLoad %18 %74 + %159 = OpIEqual %50 %158 %19 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpStore %65 %162 + OpStore %42 %19 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %18 %42 + %170 = OpSLessThan %50 %168 %169 + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpStore %171 %19 + OpBranch %172 + %172 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %18 %171 + %178 = OpSLessThan %50 %177 %169 + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %179 = OpLoad %18 %171 + %180 = OpIMul %18 %179 %82 + %181 = OpLoad %18 %42 + %182 = OpIMul %18 %181 %82 + %183 = OpIMul %18 %182 %86 + %184 = OpIAdd %18 %180 %183 + %185 = OpAccessChain %57 %55 %184 + %186 = OpLoad %18 %185 + %187 = OpIEqual %50 %186 %19 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %190 = OpLoad %18 %171 + %191 = OpIMul %18 %190 %82 + %192 = OpAccessChain %41 %62 %28 + OpStore %192 %191 + %193 = OpLoad %18 %42 + %194 = OpIMul %18 %193 %82 + %195 = OpAccessChain %41 %62 %35 + OpStore %195 %194 + OpStore %65 %66 + OpBranch %189 + %189 = OpLabel + OpBranch %175 + %175 = OpLabel + %196 = OpLoad %18 %171 + %197 = OpIAdd %18 %196 %60 + OpStore %171 %197 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %198 = OpLoad %18 %42 + %199 = OpIAdd %18 %198 %60 + OpStore %42 %199 + OpBranch %163 + %165 = OpLabel + %200 = OpAccessChain %41 %62 %28 + %201 = OpLoad %18 %200 + %202 = OpAccessChain %41 %62 %35 + %203 = OpLoad %18 %202 + %204 = OpIMul %18 %203 %86 + %205 = OpIAdd %18 %201 %204 + %206 = OpAccessChain %57 %55 %205 + OpStore %206 %60 + OpBranch %161 + %207 = OpLabel + %209 = OpLoad %18 %67 + %210 = OpLoad %18 %74 + %211 = OpSMod %18 %209 %210 + OpStore %208 %211 + %212 = OpLoad %18 %74 + %213 = OpLoad %18 %67 + %214 = OpIAdd %18 %213 %212 + OpStore %67 %214 + %215 = OpLoad %18 %208 + %216 = OpSGreaterThanEqual %50 %215 %19 + OpSelectionMerge %218 None + OpBranchConditional %216 %217 %218 + %217 = OpLabel + %219 = OpAccessChain %41 %62 %28 + %220 = OpLoad %18 %219 + %221 = OpSGreaterThan %50 %220 %19 + OpBranch %218 + %218 = OpLabel + %222 = OpPhi %50 %216 %207 %221 %217 + OpSelectionMerge %224 None + OpBranchConditional %222 %223 %224 + %223 = OpLabel + %225 = OpAccessChain %41 %62 %28 + %226 = OpLoad %18 %225 + %227 = OpISub %18 %226 %82 + %228 = OpAccessChain %41 %62 %35 + %229 = OpLoad %18 %228 + %230 = OpIMul %18 %229 %86 + %231 = OpIAdd %18 %227 %230 + %232 = OpAccessChain %57 %55 %231 + %233 = OpLoad %18 %232 + %234 = OpIEqual %50 %233 %19 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %50 %222 %218 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %238 = OpLoad %18 %208 + %239 = OpISub %18 %238 %60 + OpStore %208 %239 + %240 = OpAccessChain %41 %62 %28 + %241 = OpLoad %18 %240 + %242 = OpAccessChain %41 %62 %35 + %243 = OpLoad %18 %242 + %244 = OpIMul %18 %243 %86 + %245 = OpIAdd %18 %241 %244 + %246 = OpAccessChain %57 %55 %245 + OpStore %246 %60 + %247 = OpAccessChain %41 %62 %28 + %248 = OpLoad %18 %247 + %249 = OpISub %18 %248 %60 + %250 = OpAccessChain %41 %62 %35 + %251 = OpLoad %18 %250 + %252 = OpIMul %18 %251 %86 + %253 = OpIAdd %18 %249 %252 + %254 = OpAccessChain %57 %55 %253 + OpStore %254 %60 + %255 = OpAccessChain %41 %62 %28 + %256 = OpLoad %18 %255 + %257 = OpISub %18 %256 %82 + %258 = OpAccessChain %41 %62 %35 + %259 = OpLoad %18 %258 + %260 = OpIMul %18 %259 %86 + %261 = OpIAdd %18 %257 %260 + %262 = OpAccessChain %57 %55 %261 + OpStore %262 %60 + %263 = OpAccessChain %41 %62 %28 + %264 = OpLoad %18 %263 + %265 = OpISub %18 %264 %82 + %266 = OpAccessChain %41 %62 %28 + OpStore %266 %265 + OpBranch %237 + %237 = OpLabel + %267 = OpLoad %18 %208 + %268 = OpSGreaterThanEqual %50 %267 %19 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %271 = OpAccessChain %41 %62 %35 + %272 = OpLoad %18 %271 + %273 = OpSGreaterThan %50 %272 %19 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %50 %268 %237 %273 %269 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %277 = OpAccessChain %41 %62 %28 + %278 = OpLoad %18 %277 + %279 = OpAccessChain %41 %62 %35 + %280 = OpLoad %18 %279 + %281 = OpISub %18 %280 %82 + %282 = OpIMul %18 %281 %86 + %773 = OpLoad %53 %55 + OpStore %55 %566 + OpStore %55 %773 + %283 = OpIAdd %18 %278 %282 + %284 = OpAccessChain %57 %55 %283 + %285 = OpLoad %18 %284 + %286 = OpIEqual %50 %285 %19 + OpBranch %276 + %276 = OpLabel + %287 = OpPhi %50 %274 %270 %286 %275 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %290 = OpLoad %18 %208 + %291 = OpISub %18 %290 %60 + OpStore %208 %291 + %292 = OpAccessChain %41 %62 %28 + %293 = OpLoad %18 %292 + %294 = OpAccessChain %41 %62 %35 + %295 = OpLoad %18 %294 + %296 = OpIMul %18 %295 %86 + %297 = OpIAdd %18 %293 %296 + %298 = OpAccessChain %57 %55 %297 + OpStore %298 %60 + %299 = OpAccessChain %41 %62 %28 + %300 = OpLoad %18 %299 + %301 = OpAccessChain %41 %62 %35 + %302 = OpLoad %18 %301 + %303 = OpISub %18 %302 %60 + %304 = OpIMul %18 %303 %86 + %305 = OpIAdd %18 %300 %304 + %306 = OpAccessChain %57 %55 %305 + OpStore %306 %60 + %307 = OpAccessChain %41 %62 %28 + %308 = OpLoad %18 %307 + %309 = OpAccessChain %41 %62 %35 + %310 = OpLoad %18 %309 + %311 = OpISub %18 %310 %82 + %800 = OpLoad %53 %55 + OpStore %55 %566 + OpStore %55 %800 + %312 = OpIMul %18 %311 %86 + %313 = OpIAdd %18 %308 %312 + %314 = OpAccessChain %57 %55 %313 + OpStore %314 %60 + %315 = OpAccessChain %41 %62 %35 + %316 = OpLoad %18 %315 + %317 = OpISub %18 %316 %82 + %318 = OpAccessChain %41 %62 %35 + OpStore %318 %317 + OpBranch %289 + %289 = OpLabel + %319 = OpLoad %18 %208 + %320 = OpSGreaterThanEqual %50 %319 %19 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %41 %62 %28 + %324 = OpLoad %18 %323 + %325 = OpSLessThan %50 %324 %119 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %50 %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %41 %62 %28 + %330 = OpLoad %18 %329 + %331 = OpIAdd %18 %330 %82 + %332 = OpAccessChain %41 %62 %35 + %333 = OpLoad %18 %332 + %334 = OpIMul %18 %333 %86 + %335 = OpIAdd %18 %331 %334 + %336 = OpAccessChain %57 %55 %335 + %337 = OpLoad %18 %336 + %338 = OpIEqual %50 %337 %19 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %50 %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %342 = OpLoad %18 %208 + %343 = OpISub %18 %342 %60 + OpStore %208 %343 + %344 = OpAccessChain %41 %62 %28 + %345 = OpLoad %18 %344 + %346 = OpAccessChain %41 %62 %35 + %347 = OpLoad %18 %346 + %348 = OpIMul %18 %347 %86 + %349 = OpIAdd %18 %345 %348 + %350 = OpAccessChain %57 %55 %349 + OpStore %350 %60 + %351 = OpAccessChain %41 %62 %28 + %352 = OpLoad %18 %351 + %353 = OpIAdd %18 %352 %60 + %354 = OpAccessChain %41 %62 %35 + %355 = OpLoad %18 %354 + %356 = OpIMul %18 %355 %86 + %357 = OpIAdd %18 %353 %356 + %358 = OpAccessChain %57 %55 %357 + OpStore %358 %60 + %359 = OpAccessChain %41 %62 %28 + %360 = OpLoad %18 %359 + %361 = OpIAdd %18 %360 %82 + %362 = OpAccessChain %41 %62 %35 + %363 = OpLoad %18 %362 + %364 = OpIMul %18 %363 %86 + %365 = OpIAdd %18 %361 %364 + %366 = OpAccessChain %57 %55 %365 + OpStore %366 %60 + %367 = OpAccessChain %41 %62 %28 + %368 = OpLoad %18 %367 + %369 = OpIAdd %18 %368 %82 + %370 = OpAccessChain %41 %62 %28 + OpStore %370 %369 + OpBranch %341 + %341 = OpLabel + %371 = OpLoad %18 %208 + %372 = OpSGreaterThanEqual %50 %371 %19 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %375 = OpAccessChain %41 %62 %35 + %376 = OpLoad %18 %375 + %377 = OpSLessThan %50 %376 %119 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %50 %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %381 = OpAccessChain %41 %62 %28 + %382 = OpLoad %18 %381 + %383 = OpAccessChain %41 %62 %35 + %384 = OpLoad %18 %383 + %385 = OpIAdd %18 %384 %82 + %386 = OpIMul %18 %385 %86 + %387 = OpIAdd %18 %382 %386 + %388 = OpAccessChain %57 %55 %387 + %389 = OpLoad %18 %388 + %390 = OpIEqual %50 %389 %19 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %50 %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %394 = OpLoad %18 %208 + %395 = OpISub %18 %394 %60 + OpStore %208 %395 + %396 = OpAccessChain %41 %62 %28 + %397 = OpLoad %18 %396 + %398 = OpAccessChain %41 %62 %35 + %399 = OpLoad %18 %398 + %400 = OpIMul %18 %399 %86 + %401 = OpIAdd %18 %397 %400 + %402 = OpAccessChain %57 %55 %401 + OpStore %402 %60 + %403 = OpAccessChain %41 %62 %28 + %404 = OpLoad %18 %403 + %405 = OpAccessChain %41 %62 %35 + %406 = OpLoad %18 %405 + %407 = OpIAdd %18 %406 %60 + %408 = OpIMul %18 %407 %86 + %409 = OpIAdd %18 %404 %408 + %410 = OpAccessChain %57 %55 %409 + OpStore %410 %60 + %411 = OpAccessChain %41 %62 %28 + %412 = OpLoad %18 %411 + %413 = OpAccessChain %41 %62 %35 + %414 = OpLoad %18 %413 + %415 = OpIAdd %18 %414 %82 + %416 = OpIMul %18 %415 %86 + %417 = OpIAdd %18 %412 %416 + %418 = OpAccessChain %57 %55 %417 + OpStore %418 %60 + %419 = OpAccessChain %41 %62 %35 + %420 = OpLoad %18 %419 + %421 = OpIAdd %18 %420 %82 + %422 = OpAccessChain %41 %62 %35 + OpStore %422 %421 + OpBranch %393 + %393 = OpLabel + OpBranch %161 + %161 = OpLabel + %423 = OpAccessChain %41 %26 %35 + %424 = OpLoad %18 %423 + %425 = OpIMul %18 %424 %86 + %426 = OpAccessChain %41 %26 %28 + %427 = OpLoad %18 %426 + %428 = OpIAdd %18 %425 %427 + %429 = OpAccessChain %57 %55 %428 + %430 = OpLoad %18 %429 + %431 = OpIEqual %50 %430 %60 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %435 %437 + OpReturn + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + %439 = OpLoad %50 %65 + OpBranchConditional %439 %68 %70 + %70 = OpLabel + OpStore %435 %441 + OpReturn + OpFunctionEnd +END + +# uniforms for variant_2 + +# resolution +BUFFER variant_2_resolution DATA_TYPE vec2 STD140 DATA + 32.0 32.0 +END + +BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_2_pipeline + ATTACH variant_2_vertex_shader + ATTACH variant_2_fragment_shader + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER variant_2_framebuffer AS color LOCATION 0 + BIND BUFFER variant_2_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_2_pipeline 0 0 0 255 + +CLEAR variant_2_pipeline +RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var.amber b/vulkan/amber/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var.amber new file mode 100644 index 0000000..db59f52 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var.amber @@ -0,0 +1,1266 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Three shaders with diff: mutate var + +# The test renders three images using semantically equivalent shaders, and then +# checks that the images are similar. +# The test passes because the shaders have the same semantics and so the images +# should be the same. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 540 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %41 "data" + OpName %52 "temp" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %243 "gl_FragCoord" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %255 = OpConstant %157 0.5 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %373 = OpConstant %157 1 + %507 = OpTypePointer Function %39 + %539 = OpConstant %157 0.100000001 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %52 = OpVariable %507 Function + %41 = OpVariable %507 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpBranch %167 + %167 = OpLabel + %508 = OpPhi %6 %166 %5 %222 %170 + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + OpSelectionMerge %182 None + OpSwitch %508 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %185 = OpAccessChain %7 %41 %508 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %189 = OpAccessChain %7 %41 %508 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %192 = OpAccessChain %7 %41 %508 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %195 = OpAccessChain %7 %41 %508 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %198 = OpAccessChain %7 %41 %508 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %202 = OpAccessChain %7 %41 %508 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %206 = OpAccessChain %7 %41 %508 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %210 = OpAccessChain %7 %41 %508 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %214 = OpAccessChain %7 %41 %508 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %218 = OpAccessChain %7 %41 %508 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %222 = OpIAdd %6 %508 %22 + OpBranch %170 + %170 = OpLabel + %224 = OpSLessThan %31 %222 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpBranch %226 + %226 = OpLabel + %510 = OpPhi %6 %105 %169 %239 %227 + %232 = OpSLessThan %31 %510 %74 + OpLoopMerge %228 %227 None + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %235 = OpAccessChain %7 %41 %510 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %7 %52 %510 + OpStore %237 %236 + %239 = OpIAdd %6 %510 %22 + OpBranch %226 + %228 = OpLabel + OpBranch %389 + %389 = OpLabel + %511 = OpPhi %6 %22 %228 %426 %424 + %393 = OpSLessThanEqual %31 %511 %107 + OpLoopMerge %427 %424 None + OpBranchConditional %393 %394 %427 + %394 = OpLabel + OpBranch %396 + %396 = OpLabel + %519 = OpPhi %6 %105 %394 %410 %418 + %400 = OpSLessThan %31 %519 %107 + OpLoopMerge %423 %418 None + OpBranchConditional %400 %401 %423 + %401 = OpLabel + %405 = OpIAdd %6 %519 %511 + %406 = OpISub %6 %405 %22 + %409 = OpIMul %6 %136 %511 + %410 = OpIAdd %6 %519 %409 + %411 = OpISub %6 %410 %22 + %413 = OpExtInst %6 %1 SMin %411 %107 + OpBranch %437 + %437 = OpLabel + %532 = OpPhi %6 %519 %401 %456 %471 + %522 = OpPhi %6 %405 %401 %534 %471 + %521 = OpPhi %6 %519 %401 %533 %471 + %441 = OpSLessThanEqual %31 %521 %406 + %444 = OpSLessThanEqual %31 %522 %413 + %445 = OpLogicalAnd %31 %441 %444 + OpLoopMerge %472 %471 None + OpBranchConditional %445 %446 %472 + %446 = OpLabel + %448 = OpAccessChain %7 %41 %521 + %449 = OpLoad %6 %448 + %451 = OpAccessChain %7 %41 %522 + %452 = OpLoad %6 %451 + %453 = OpSLessThan %31 %449 %452 + %456 = OpIAdd %6 %532 %22 + OpSelectionMerge %470 None + OpBranchConditional %453 %454 %462 + %454 = OpLabel + %458 = OpIAdd %6 %521 %22 + %460 = OpLoad %6 %448 + %461 = OpAccessChain %7 %52 %532 + OpStore %461 %460 + OpBranch %470 + %462 = OpLabel + %466 = OpIAdd %6 %522 %22 + %468 = OpLoad %6 %451 + %469 = OpAccessChain %7 %52 %532 + OpStore %469 %468 + OpBranch %470 + %470 = OpLabel + %534 = OpPhi %6 %522 %454 %466 %462 + %533 = OpPhi %6 %458 %454 %521 %462 + OpBranch %471 + %471 = OpLabel + OpBranch %437 + %472 = OpLabel + OpBranch %473 + %473 = OpLabel + %531 = OpPhi %6 %532 %472 %483 %481 + %523 = OpPhi %6 %521 %472 %485 %481 + %476 = OpSLessThan %31 %523 %74 + %479 = OpSLessThanEqual %31 %523 %406 + %480 = OpLogicalAnd %31 %476 %479 + OpLoopMerge %490 %481 None + OpBranchConditional %480 %481 %490 + %481 = OpLabel + %483 = OpIAdd %6 %531 %22 + %485 = OpIAdd %6 %523 %22 + %486 = OpAccessChain %7 %41 %523 + %487 = OpLoad %6 %486 + %488 = OpAccessChain %7 %52 %531 + OpStore %488 %487 + OpBranch %473 + %490 = OpLabel + OpBranch %492 + %492 = OpLabel + %524 = OpPhi %6 %519 %490 %505 %497 + %496 = OpSLessThanEqual %31 %524 %413 + OpLoopMerge %506 %497 None + OpBranchConditional %496 %497 %506 + %497 = OpLabel + %500 = OpAccessChain %7 %52 %524 + %501 = OpLoad %6 %500 + %502 = OpAccessChain %7 %41 %524 + OpStore %502 %501 + %505 = OpIAdd %6 %524 %22 + OpBranch %492 + %506 = OpLabel + OpBranch %418 + %418 = OpLabel + OpBranch %396 + %423 = OpLabel + OpBranch %424 + %424 = OpLabel + %426 = OpIMul %6 %136 %511 + OpBranch %389 + %427 = OpLabel + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %7 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFMul %157 %258 %539 + %261 = OpFAdd %157 %255 %260 + OpBranch %252 + %262 = OpLabel + %267 = OpSLessThan %31 %248 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %7 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFMul %157 %272 %539 + %274 = OpFAdd %157 %255 %273 + OpBranch %269 + %275 = OpLabel + %280 = OpSLessThan %31 %248 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %7 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFMul %157 %285 %539 + %287 = OpFAdd %157 %255 %286 + OpBranch %282 + %288 = OpLabel + %293 = OpSLessThan %31 %248 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %7 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFMul %157 %298 %539 + %300 = OpFAdd %157 %255 %299 + OpBranch %295 + %301 = OpLabel + %306 = OpSLessThan %31 %248 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %315 = OpSLessThan %31 %248 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %7 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFMul %157 %321 %539 + %323 = OpFAdd %157 %255 %322 + OpBranch %317 + %324 = OpLabel + %329 = OpSLessThan %31 %248 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %7 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFMul %157 %335 %539 + %337 = OpFAdd %157 %255 %336 + OpBranch %331 + %338 = OpLabel + %343 = OpSLessThan %31 %248 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %7 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFMul %157 %349 %539 + %351 = OpFAdd %157 %255 %350 + OpBranch %345 + %352 = OpLabel + %357 = OpSLessThan %31 %248 %356 + OpSelectionMerge %358 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %7 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFMul %157 %363 %539 + %365 = OpFAdd %157 %255 %364 + OpBranch %345 + %366 = OpLabel + OpTerminateInvocation + %345 = OpLabel + %518 = OpPhi %157 %351 %344 %365 %358 + OpBranch %331 + %331 = OpLabel + %517 = OpPhi %157 %337 %330 %518 %345 + OpBranch %317 + %317 = OpLabel + %516 = OpPhi %157 %323 %316 %517 %331 + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + %515 = OpPhi %157 %300 %294 %516 %308 + OpBranch %282 + %282 = OpLabel + %514 = OpPhi %157 %287 %281 %515 %295 + OpBranch %269 + %269 = OpLabel + %513 = OpPhi %157 %274 %268 %514 %282 + OpBranch %252 + %252 = OpLabel + %512 = OpPhi %157 %261 %251 %513 %269 + %377 = OpCompositeConstruct %241 %512 %512 %512 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# injectionSwitch +BUFFER reference_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 677 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %41 "data" + OpName %52 "temp" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %243 "gl_FragCoord" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %255 = OpConstant %157 0.5 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %373 = OpConstant %157 1 + %507 = OpTypePointer Function %39 + %539 = OpConstant %157 0.100000001 + %670 = OpConstant %6 0 + %671 = OpConstantComposite %39 %670 %670 %670 %670 %670 %670 %670 %670 %670 %670 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %52 = OpVariable %507 Function + %41 = OpVariable %507 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpBranch %167 + %167 = OpLabel + %508 = OpPhi %6 %166 %5 %222 %170 + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %676 = OpLoad %39 %41 + OpStore %41 %671 + OpStore %41 %676 + %651 = OpIAdd %6 %508 %22 + OpSelectionMerge %182 None + OpSwitch %508 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %185 = OpAccessChain %7 %41 %508 + OpStore %185 %184 + %652 = OpIAdd %6 %508 %22 + OpBranch %182 + %173 = OpLabel + %189 = OpAccessChain %7 %41 %508 + OpStore %189 %188 + %653 = OpIAdd %6 %508 %22 + OpBranch %182 + %174 = OpLabel + %192 = OpAccessChain %7 %41 %508 + OpStore %192 %136 + %654 = OpIAdd %6 %508 %22 + OpBranch %182 + %175 = OpLabel + %195 = OpAccessChain %7 %41 %508 + OpStore %195 %22 + %655 = OpIAdd %6 %508 %22 + OpBranch %182 + %176 = OpLabel + %198 = OpAccessChain %7 %41 %508 + OpStore %198 %105 + %656 = OpIAdd %6 %508 %22 + OpBranch %182 + %177 = OpLabel + %202 = OpAccessChain %7 %41 %508 + OpStore %202 %201 + %657 = OpIAdd %6 %508 %22 + OpBranch %182 + %178 = OpLabel + %206 = OpAccessChain %7 %41 %508 + OpStore %206 %205 + %658 = OpIAdd %6 %508 %22 + OpBranch %182 + %179 = OpLabel + %210 = OpAccessChain %7 %41 %508 + OpStore %210 %209 + %659 = OpIAdd %6 %508 %22 + OpBranch %182 + %180 = OpLabel + %214 = OpAccessChain %7 %41 %508 + OpStore %214 %213 + %660 = OpIAdd %6 %508 %22 + OpBranch %182 + %181 = OpLabel + %218 = OpAccessChain %7 %41 %508 + OpStore %218 %217 + %661 = OpIAdd %6 %508 %22 + OpBranch %182 + %182 = OpLabel + %222 = OpPhi %6 %651 %168 %652 %172 %653 %173 %654 %174 %655 %175 %656 %176 %657 %177 %658 %178 %659 %179 %660 %180 %661 %181 + OpBranch %170 + %170 = OpLabel + %224 = OpSLessThan %31 %222 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpBranch %226 + %226 = OpLabel + %510 = OpPhi %6 %105 %169 %239 %227 + %232 = OpSLessThan %31 %510 %74 + OpLoopMerge %228 %227 None + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %235 = OpAccessChain %7 %41 %510 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %7 %52 %510 + OpStore %237 %236 + %239 = OpIAdd %6 %510 %22 + OpBranch %226 + %228 = OpLabel + OpBranch %389 + %389 = OpLabel + %511 = OpPhi %6 %22 %228 %426 %424 + %393 = OpSLessThanEqual %31 %511 %107 + OpLoopMerge %427 %424 None + OpBranchConditional %393 %394 %427 + %394 = OpLabel + OpBranch %396 + %396 = OpLabel + %519 = OpPhi %6 %105 %394 %410 %418 + %400 = OpSLessThan %31 %519 %107 + OpLoopMerge %423 %418 None + OpBranchConditional %400 %401 %423 + %401 = OpLabel + %405 = OpIAdd %6 %519 %511 + %406 = OpISub %6 %405 %22 + %409 = OpIMul %6 %136 %511 + %410 = OpIAdd %6 %519 %409 + %411 = OpISub %6 %410 %22 + %413 = OpExtInst %6 %1 SMin %411 %107 + OpBranch %437 + %437 = OpLabel + %532 = OpPhi %6 %519 %401 %456 %471 + %522 = OpPhi %6 %405 %401 %534 %471 + %521 = OpPhi %6 %519 %401 %533 %471 + %441 = OpSLessThanEqual %31 %521 %406 + %444 = OpSLessThanEqual %31 %522 %413 + %445 = OpLogicalAnd %31 %441 %444 + OpLoopMerge %472 %471 None + OpBranchConditional %445 %446 %472 + %446 = OpLabel + %448 = OpAccessChain %7 %41 %521 + %449 = OpLoad %6 %448 + %451 = OpAccessChain %7 %41 %522 + %452 = OpLoad %6 %451 + %453 = OpSLessThan %31 %449 %452 + %456 = OpIAdd %6 %532 %22 + OpSelectionMerge %470 None + OpBranchConditional %453 %454 %462 + %454 = OpLabel + %458 = OpIAdd %6 %521 %22 + %460 = OpLoad %6 %448 + %461 = OpAccessChain %7 %52 %532 + OpStore %461 %460 + OpBranch %470 + %462 = OpLabel + %466 = OpIAdd %6 %522 %22 + %468 = OpLoad %6 %451 + %469 = OpAccessChain %7 %52 %532 + OpStore %469 %468 + OpBranch %470 + %470 = OpLabel + %534 = OpPhi %6 %522 %454 %466 %462 + %533 = OpPhi %6 %458 %454 %521 %462 + OpBranch %471 + %471 = OpLabel + OpBranch %437 + %472 = OpLabel + OpBranch %473 + %473 = OpLabel + %531 = OpPhi %6 %532 %472 %483 %481 + %523 = OpPhi %6 %521 %472 %485 %481 + %476 = OpSLessThan %31 %523 %74 + %479 = OpSLessThanEqual %31 %523 %406 + %480 = OpLogicalAnd %31 %476 %479 + OpLoopMerge %490 %481 None + OpBranchConditional %480 %481 %490 + %481 = OpLabel + %483 = OpIAdd %6 %531 %22 + %485 = OpIAdd %6 %523 %22 + %486 = OpAccessChain %7 %41 %523 + %487 = OpLoad %6 %486 + %488 = OpAccessChain %7 %52 %531 + OpStore %488 %487 + OpBranch %473 + %490 = OpLabel + OpBranch %492 + %492 = OpLabel + %524 = OpPhi %6 %519 %490 %505 %497 + %496 = OpSLessThanEqual %31 %524 %413 + OpLoopMerge %506 %497 None + OpBranchConditional %496 %497 %506 + %497 = OpLabel + %500 = OpAccessChain %7 %52 %524 + %501 = OpLoad %6 %500 + %502 = OpAccessChain %7 %41 %524 + OpStore %502 %501 + %505 = OpIAdd %6 %524 %22 + OpBranch %492 + %506 = OpLabel + OpBranch %418 + %418 = OpLabel + OpBranch %396 + %423 = OpLabel + OpBranch %424 + %424 = OpLabel + %426 = OpIMul %6 %136 %511 + OpBranch %389 + %427 = OpLabel + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %7 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFMul %157 %258 %539 + %261 = OpFAdd %157 %255 %260 + OpBranch %252 + %262 = OpLabel + %267 = OpSLessThan %31 %248 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %7 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFMul %157 %272 %539 + %274 = OpFAdd %157 %255 %273 + OpBranch %269 + %275 = OpLabel + %280 = OpSLessThan %31 %248 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %7 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFMul %157 %285 %539 + %287 = OpFAdd %157 %255 %286 + OpBranch %282 + %288 = OpLabel + %293 = OpSLessThan %31 %248 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %7 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFMul %157 %298 %539 + %300 = OpFAdd %157 %255 %299 + OpBranch %295 + %301 = OpLabel + %306 = OpSLessThan %31 %248 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %315 = OpSLessThan %31 %248 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %7 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFMul %157 %321 %539 + %323 = OpFAdd %157 %255 %322 + OpBranch %317 + %324 = OpLabel + %329 = OpSLessThan %31 %248 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %7 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFMul %157 %335 %539 + %337 = OpFAdd %157 %255 %336 + OpBranch %331 + %338 = OpLabel + %343 = OpSLessThan %31 %248 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %7 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFMul %157 %349 %539 + %351 = OpFAdd %157 %255 %350 + OpBranch %345 + %352 = OpLabel + %357 = OpSLessThan %31 %248 %356 + OpSelectionMerge %358 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %7 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFMul %157 %363 %539 + %365 = OpFAdd %157 %255 %364 + OpBranch %345 + %366 = OpLabel + OpTerminateInvocation + %345 = OpLabel + %518 = OpPhi %157 %351 %344 %365 %358 + OpBranch %331 + %331 = OpLabel + %517 = OpPhi %157 %337 %330 %518 %345 + OpBranch %317 + %317 = OpLabel + %516 = OpPhi %157 %323 %316 %517 %331 + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + %515 = OpPhi %157 %300 %294 %516 %308 + OpBranch %282 + %282 = OpLabel + %514 = OpPhi %157 %287 %281 %515 %295 + OpBranch %269 + %269 = OpLabel + %513 = OpPhi %157 %274 %268 %514 %282 + OpBranch %252 + %252 = OpLabel + %512 = OpPhi %157 %261 %251 %513 %269 + %377 = OpCompositeConstruct %241 %512 %512 %512 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_2_vertex_shader PASSTHROUGH + +SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 672 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %41 "data" + OpName %52 "temp" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %243 "gl_FragCoord" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %255 = OpConstant %157 0.5 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %373 = OpConstant %157 1 + %507 = OpTypePointer Function %39 + %539 = OpConstant %157 0.100000001 + %670 = OpConstant %6 0 + %671 = OpConstantComposite %39 %670 %670 %670 %670 %670 %670 %670 %670 %670 %670 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %52 = OpVariable %507 Function + %41 = OpVariable %507 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpBranch %167 + %167 = OpLabel + %508 = OpPhi %6 %166 %5 %222 %170 + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %651 = OpIAdd %6 %508 %22 + OpSelectionMerge %182 None + OpSwitch %508 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %185 = OpAccessChain %7 %41 %508 + OpStore %185 %184 + %652 = OpIAdd %6 %508 %22 + OpBranch %182 + %173 = OpLabel + %189 = OpAccessChain %7 %41 %508 + OpStore %189 %188 + %653 = OpIAdd %6 %508 %22 + OpBranch %182 + %174 = OpLabel + %192 = OpAccessChain %7 %41 %508 + OpStore %192 %136 + %654 = OpIAdd %6 %508 %22 + OpBranch %182 + %175 = OpLabel + %195 = OpAccessChain %7 %41 %508 + OpStore %195 %22 + %655 = OpIAdd %6 %508 %22 + OpBranch %182 + %176 = OpLabel + %198 = OpAccessChain %7 %41 %508 + OpStore %198 %105 + %656 = OpIAdd %6 %508 %22 + OpBranch %182 + %177 = OpLabel + %202 = OpAccessChain %7 %41 %508 + OpStore %202 %201 + %657 = OpIAdd %6 %508 %22 + OpBranch %182 + %178 = OpLabel + %206 = OpAccessChain %7 %41 %508 + OpStore %206 %205 + %658 = OpIAdd %6 %508 %22 + OpBranch %182 + %179 = OpLabel + %210 = OpAccessChain %7 %41 %508 + OpStore %210 %209 + %659 = OpIAdd %6 %508 %22 + OpBranch %182 + %180 = OpLabel + %214 = OpAccessChain %7 %41 %508 + OpStore %214 %213 + %660 = OpIAdd %6 %508 %22 + OpBranch %182 + %181 = OpLabel + %218 = OpAccessChain %7 %41 %508 + OpStore %218 %217 + %661 = OpIAdd %6 %508 %22 + OpBranch %182 + %182 = OpLabel + %222 = OpPhi %6 %651 %168 %652 %172 %653 %173 %654 %174 %655 %175 %656 %176 %657 %177 %658 %178 %659 %179 %660 %180 %661 %181 + OpBranch %170 + %170 = OpLabel + %224 = OpSLessThan %31 %222 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpBranch %226 + %226 = OpLabel + %510 = OpPhi %6 %105 %169 %239 %227 + %232 = OpSLessThan %31 %510 %74 + OpLoopMerge %228 %227 None + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %235 = OpAccessChain %7 %41 %510 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %7 %52 %510 + OpStore %237 %236 + %239 = OpIAdd %6 %510 %22 + OpBranch %226 + %228 = OpLabel + OpBranch %389 + %389 = OpLabel + %511 = OpPhi %6 %22 %228 %426 %424 + %393 = OpSLessThanEqual %31 %511 %107 + OpLoopMerge %427 %424 None + OpBranchConditional %393 %394 %427 + %394 = OpLabel + OpBranch %396 + %396 = OpLabel + %519 = OpPhi %6 %105 %394 %410 %418 + %400 = OpSLessThan %31 %519 %107 + OpLoopMerge %423 %418 None + OpBranchConditional %400 %401 %423 + %401 = OpLabel + %405 = OpIAdd %6 %519 %511 + %406 = OpISub %6 %405 %22 + %409 = OpIMul %6 %136 %511 + %410 = OpIAdd %6 %519 %409 + %411 = OpISub %6 %410 %22 + %413 = OpExtInst %6 %1 SMin %411 %107 + OpBranch %437 + %437 = OpLabel + %532 = OpPhi %6 %519 %401 %456 %471 + %522 = OpPhi %6 %405 %401 %534 %471 + %521 = OpPhi %6 %519 %401 %533 %471 + %441 = OpSLessThanEqual %31 %521 %406 + %444 = OpSLessThanEqual %31 %522 %413 + %445 = OpLogicalAnd %31 %441 %444 + OpLoopMerge %472 %471 None + OpBranchConditional %445 %446 %472 + %446 = OpLabel + %448 = OpAccessChain %7 %41 %521 + %449 = OpLoad %6 %448 + %451 = OpAccessChain %7 %41 %522 + %452 = OpLoad %6 %451 + %453 = OpSLessThan %31 %449 %452 + %456 = OpIAdd %6 %532 %22 + OpSelectionMerge %470 None + OpBranchConditional %453 %454 %462 + %454 = OpLabel + %458 = OpIAdd %6 %521 %22 + %460 = OpLoad %6 %448 + %461 = OpAccessChain %7 %52 %532 + OpStore %461 %460 + OpBranch %470 + %462 = OpLabel + %466 = OpIAdd %6 %522 %22 + %468 = OpLoad %6 %451 + %469 = OpAccessChain %7 %52 %532 + OpStore %469 %468 + OpBranch %470 + %470 = OpLabel + %534 = OpPhi %6 %522 %454 %466 %462 + %533 = OpPhi %6 %458 %454 %521 %462 + OpBranch %471 + %471 = OpLabel + OpBranch %437 + %472 = OpLabel + OpBranch %473 + %473 = OpLabel + %531 = OpPhi %6 %532 %472 %483 %481 + %523 = OpPhi %6 %521 %472 %485 %481 + %476 = OpSLessThan %31 %523 %74 + %479 = OpSLessThanEqual %31 %523 %406 + %480 = OpLogicalAnd %31 %476 %479 + OpLoopMerge %490 %481 None + OpBranchConditional %480 %481 %490 + %481 = OpLabel + %483 = OpIAdd %6 %531 %22 + %485 = OpIAdd %6 %523 %22 + %486 = OpAccessChain %7 %41 %523 + %487 = OpLoad %6 %486 + %488 = OpAccessChain %7 %52 %531 + OpStore %488 %487 + OpBranch %473 + %490 = OpLabel + OpBranch %492 + %492 = OpLabel + %524 = OpPhi %6 %519 %490 %505 %497 + %496 = OpSLessThanEqual %31 %524 %413 + OpLoopMerge %506 %497 None + OpBranchConditional %496 %497 %506 + %497 = OpLabel + %500 = OpAccessChain %7 %52 %524 + %501 = OpLoad %6 %500 + %502 = OpAccessChain %7 %41 %524 + OpStore %502 %501 + %505 = OpIAdd %6 %524 %22 + OpBranch %492 + %506 = OpLabel + OpBranch %418 + %418 = OpLabel + OpBranch %396 + %423 = OpLabel + OpBranch %424 + %424 = OpLabel + %426 = OpIMul %6 %136 %511 + OpBranch %389 + %427 = OpLabel + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %7 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFMul %157 %258 %539 + %261 = OpFAdd %157 %255 %260 + OpBranch %252 + %262 = OpLabel + %267 = OpSLessThan %31 %248 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %7 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFMul %157 %272 %539 + %274 = OpFAdd %157 %255 %273 + OpBranch %269 + %275 = OpLabel + %280 = OpSLessThan %31 %248 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %7 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFMul %157 %285 %539 + %287 = OpFAdd %157 %255 %286 + OpBranch %282 + %288 = OpLabel + %293 = OpSLessThan %31 %248 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %7 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFMul %157 %298 %539 + %300 = OpFAdd %157 %255 %299 + OpBranch %295 + %301 = OpLabel + %306 = OpSLessThan %31 %248 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %315 = OpSLessThan %31 %248 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %7 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFMul %157 %321 %539 + %323 = OpFAdd %157 %255 %322 + OpBranch %317 + %324 = OpLabel + %329 = OpSLessThan %31 %248 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %7 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFMul %157 %335 %539 + %337 = OpFAdd %157 %255 %336 + OpBranch %331 + %338 = OpLabel + %343 = OpSLessThan %31 %248 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %7 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFMul %157 %349 %539 + %351 = OpFAdd %157 %255 %350 + OpBranch %345 + %352 = OpLabel + %357 = OpSLessThan %31 %248 %356 + OpSelectionMerge %358 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %7 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFMul %157 %363 %539 + %365 = OpFAdd %157 %255 %364 + OpBranch %345 + %366 = OpLabel + OpTerminateInvocation + %345 = OpLabel + %518 = OpPhi %157 %351 %344 %365 %358 + OpBranch %331 + %331 = OpLabel + %517 = OpPhi %157 %337 %330 %518 %345 + OpBranch %317 + %317 = OpLabel + %516 = OpPhi %157 %323 %316 %517 %331 + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + %515 = OpPhi %157 %300 %294 %516 %308 + OpBranch %282 + %282 = OpLabel + %514 = OpPhi %157 %287 %281 %515 %295 + OpBranch %269 + %269 = OpLabel + %513 = OpPhi %157 %274 %268 %514 %282 + OpBranch %252 + %252 = OpLabel + %512 = OpPhi %157 %261 %251 %513 %269 + %377 = OpCompositeConstruct %241 %512 %512 %512 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd +END + +# uniforms for variant_2 + +# injectionSwitch +BUFFER variant_2_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_2_pipeline + ATTACH variant_2_vertex_shader + ATTACH variant_2_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_2_framebuffer AS color LOCATION 0 + BIND BUFFER variant_2_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_2_pipeline 0 0 0 255 + +CLEAR variant_2_pipeline +RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-mergesort-dead-code.amber b/vulkan/amber/graphicsfuzz/spv-stable-mergesort-dead-code.amber new file mode 100644 index 0000000..1fe448e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-mergesort-dead-code.amber @@ -0,0 +1,1216 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with additional dead code + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 378 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + %240 = OpFunctionCall %2 %14 + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %60 + %50 = OpLabel + %53 = OpLoad %6 %16 + %54 = OpIAdd %6 %53 %22 + OpStore %16 %54 + %55 = OpLoad %6 %18 + %56 = OpIAdd %6 %55 %22 + OpStore %18 %56 + %57 = OpAccessChain %43 %41 %55 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %43 %52 %53 + OpStore %59 %58 + OpBranch %51 + %60 = OpLabel + %61 = OpLoad %6 %16 + %62 = OpIAdd %6 %61 %22 + OpStore %16 %62 + %63 = OpLoad %6 %20 + %64 = OpIAdd %6 %63 %22 + OpStore %20 %64 + %65 = OpAccessChain %43 %41 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %43 %52 %61 + OpStore %67 %66 + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# injectionSwitch +BUFFER reference_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 1343 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %518 = OpConstantFalse %31 + %715 = OpConstant %157 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + %1342 = OpAccessChain %163 %161 %105 %105 + %1341 = OpLoad %157 %1342 + %1340 = OpFUnordGreaterThan %31 %1341 %373 + OpSelectionMerge %485 None + OpBranchConditional %1340 %537 %485 + %537 = OpLabel + OpStore %254 %373 + OpBranchConditional %518 %485 %485 + %485 = OpLabel + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + %240 = OpFunctionCall %2 %14 + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + %720 = OpAccessChain %163 %161 %105 %22 + %719 = OpLoad %157 %720 + %718 = OpFUnordGreaterThanEqual %31 %715 %719 + OpBranchConditional %718 %359 %499 + %499 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %60 + %50 = OpLabel + %53 = OpLoad %6 %16 + %54 = OpIAdd %6 %53 %22 + OpStore %16 %54 + %55 = OpLoad %6 %18 + %56 = OpIAdd %6 %55 %22 + OpStore %18 %56 + %57 = OpAccessChain %43 %41 %55 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %43 %52 %53 + OpStore %59 %58 + OpBranch %51 + %60 = OpLabel + %61 = OpLoad %6 %16 + %62 = OpIAdd %6 %61 %22 + OpStore %16 %62 + %63 = OpLoad %6 %20 + %64 = OpIAdd %6 %63 %22 + OpStore %20 %64 + %65 = OpAccessChain %43 %41 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %43 %52 %61 + OpStore %67 %66 + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues.amber b/vulkan/amber/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues.amber new file mode 100644 index 0000000..133c5d7 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues.amber @@ -0,0 +1,2056 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Shaders diff: selection %25 flattened; dead continues + +# The test renders three images using semantically equivalent shaders, and then +# checks that the images are similar. +# The test passes because the shaders have the same semantics and so the images +# should be the same. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 378 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + %240 = OpFunctionCall %2 %14 + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %60 + %50 = OpLabel + %53 = OpLoad %6 %16 + %54 = OpIAdd %6 %53 %22 + OpStore %16 %54 + %55 = OpLoad %6 %18 + %56 = OpIAdd %6 %55 %22 + OpStore %18 %56 + %57 = OpAccessChain %43 %41 %55 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %43 %52 %53 + OpStore %59 %58 + OpBranch %51 + %60 = OpLabel + %61 = OpLoad %6 %16 + %62 = OpIAdd %6 %61 %22 + OpStore %16 %62 + %63 = OpLoad %6 %20 + %64 = OpIAdd %6 %63 %22 + OpStore %20 %64 + %65 = OpAccessChain %43 %41 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %43 %52 %61 + OpStore %67 %66 + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# injectionSwitch +BUFFER reference_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 648 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %484 = OpConstant %6 0 + %573 = OpConstantTrue %31 + %574 = OpConstantFalse %31 + %575 = OpConstant %157 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + %240 = OpFunctionCall %2 %14 + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + %646 = OpAccessChain %163 %161 %105 %105 + %647 = OpLoad %157 %646 + %643 = OpFOrdGreaterThanEqual %31 %373 %647 + OpLoopMerge %26 %27 None + OpBranchConditional %643 %28 %27 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpBranch %50 + %50 = OpLabel + OpSelectionMerge %479 None + OpBranchConditional %49 %480 %482 + %480 = OpLabel + %481 = OpLoad %6 %16 + OpBranch %479 + %482 = OpLabel + %483 = OpCopyObject %6 %484 + OpBranch %479 + %479 = OpLabel + %53 = OpPhi %6 %481 %480 %483 %482 + %54 = OpIAdd %6 %53 %22 + OpBranch %486 + %486 = OpLabel + OpSelectionMerge %536 None + OpBranchConditional %49 %537 %536 + %537 = OpLabel + OpStore %16 %54 + %622 = OpAccessChain %163 %161 %105 %105 + %623 = OpLoad %157 %622 + %621 = OpFUnordGreaterThan %31 %373 %623 + OpBranchConditional %621 %536 %27 + %536 = OpLabel + OpBranch %485 + %485 = OpLabel + %595 = OpAccessChain %163 %161 %105 %22 + %596 = OpLoad %157 %595 + %594 = OpFOrdGreaterThanEqual %31 %596 %575 + OpBranchConditional %594 %490 %27 + %490 = OpLabel + %491 = OpCopyObject %6 %484 + OpBranch %488 + %488 = OpLabel + OpSelectionMerge %538 None + OpBranchConditional %49 %539 %541 + %539 = OpLabel + %540 = OpLoad %6 %18 + OpBranch %538 + %541 = OpLabel + %542 = OpCopyObject %6 %484 + OpBranch %538 + %538 = OpLabel + %489 = OpPhi %6 %540 %539 %542 %541 + OpBranch %487 + %487 = OpLabel + %55 = OpSelect %6 %49 %489 %491 + %56 = OpIAdd %6 %55 %22 + OpSelectionMerge %492 None + OpBranchConditional %49 %493 %492 + %493 = OpLabel + OpStore %18 %56 + OpBranch %492 + %492 = OpLabel + %57 = OpAccessChain %43 %41 %55 + OpBranch %497 + %497 = OpLabel + %498 = OpCopyObject %6 %484 + OpBranch %495 + %495 = OpLabel + OpSelectionMerge %545 None + OpBranchConditional %49 %546 %548 + %546 = OpLabel + %547 = OpLoad %6 %57 + %598 = OpAccessChain %163 %161 %105 %22 + %599 = OpLoad %157 %598 + %597 = OpFUnordGreaterThan %31 %575 %599 + OpBranchConditional %597 %27 %545 + %548 = OpLabel + %549 = OpCopyObject %6 %484 + %619 = OpAccessChain %163 %161 %105 %22 + %620 = OpLoad %157 %619 + %618 = OpFUnordGreaterThanEqual %31 %620 %575 + OpBranchConditional %618 %545 %27 + %545 = OpLabel + %496 = OpPhi %6 %547 %546 %549 %548 + OpBranch %494 + %494 = OpLabel + %58 = OpSelect %6 %49 %496 %498 + %59 = OpAccessChain %43 %52 %53 + OpSelectionMerge %499 None + OpBranchConditional %49 %500 %499 + %500 = OpLabel + OpStore %59 %58 + OpBranch %499 + %499 = OpLabel + OpBranch %60 + %60 = OpLabel + OpSelectionMerge %501 None + OpBranchConditional %49 %504 %502 + %502 = OpLabel + %503 = OpLoad %6 %16 + OpBranch %501 + %504 = OpLabel + %505 = OpCopyObject %6 %484 + OpBranch %501 + %501 = OpLabel + %61 = OpPhi %6 %503 %502 %505 %504 + %62 = OpIAdd %6 %61 %22 + OpSelectionMerge %506 None + OpBranchConditional %49 %506 %507 + %507 = OpLabel + OpStore %16 %62 + OpBranch %506 + %506 = OpLabel + %602 = OpAccessChain %163 %161 %105 %105 + %603 = OpLoad %157 %602 + %601 = OpFUnordGreaterThan %31 %373 %603 + OpBranchConditional %601 %509 %27 + %509 = OpLabel + OpSelectionMerge %559 None + OpBranchConditional %49 %562 %560 + %560 = OpLabel + %561 = OpLoad %6 %20 + OpBranch %559 + %562 = OpLabel + %563 = OpCopyObject %6 %484 + OpBranch %559 + %559 = OpLabel + %510 = OpPhi %6 %561 %560 %563 %562 + OpBranch %511 + %511 = OpLabel + %512 = OpCopyObject %6 %484 + OpBranch %508 + %508 = OpLabel + %63 = OpSelect %6 %49 %512 %510 + %64 = OpIAdd %6 %63 %22 + OpSelectionMerge %513 None + OpBranchConditional %49 %513 %514 + %514 = OpLabel + OpStore %20 %64 + OpBranch %513 + %513 = OpLabel + %65 = OpAccessChain %43 %41 %63 + OpSelectionMerge %515 None + OpBranchConditional %49 %518 %516 + %516 = OpLabel + %517 = OpLoad %6 %65 + OpBranch %515 + %518 = OpLabel + %519 = OpCopyObject %6 %484 + OpBranch %515 + %515 = OpLabel + %66 = OpPhi %6 %517 %516 %519 %518 + %67 = OpAccessChain %43 %52 %61 + OpSelectionMerge %520 None + OpBranchConditional %49 %520 %521 + %521 = OpLabel + OpStore %67 %66 + OpBranch %520 + %520 = OpLabel + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_2_vertex_shader PASSTHROUGH + +SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 644 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %484 = OpConstant %6 0 + %573 = OpConstantTrue %31 + %574 = OpConstantFalse %31 + %575 = OpConstant %157 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + %240 = OpFunctionCall %2 %14 + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + %643 = OpFOrdGreaterThanEqual %31 %373 %575 + OpLoopMerge %26 %27 None + OpBranchConditional %643 %28 %27 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpBranch %50 + %50 = OpLabel + OpSelectionMerge %479 None + OpBranchConditional %49 %480 %482 + %480 = OpLabel + %481 = OpLoad %6 %16 + OpBranch %479 + %482 = OpLabel + %483 = OpCopyObject %6 %484 + OpBranch %479 + %479 = OpLabel + %53 = OpPhi %6 %481 %480 %483 %482 + %54 = OpIAdd %6 %53 %22 + OpBranch %486 + %486 = OpLabel + OpSelectionMerge %536 None + OpBranchConditional %49 %537 %536 + %537 = OpLabel + OpStore %16 %54 + %622 = OpAccessChain %163 %161 %105 %105 + %623 = OpLoad %157 %622 + %621 = OpFUnordGreaterThan %31 %373 %623 + OpBranchConditional %621 %536 %27 + %536 = OpLabel + OpBranch %485 + %485 = OpLabel + %595 = OpAccessChain %163 %161 %105 %22 + %596 = OpLoad %157 %595 + %594 = OpFOrdGreaterThanEqual %31 %596 %575 + OpBranchConditional %594 %490 %27 + %490 = OpLabel + %491 = OpCopyObject %6 %484 + OpBranch %488 + %488 = OpLabel + OpSelectionMerge %538 None + OpBranchConditional %49 %539 %541 + %539 = OpLabel + %540 = OpLoad %6 %18 + OpBranch %538 + %541 = OpLabel + %542 = OpCopyObject %6 %484 + OpBranch %538 + %538 = OpLabel + %489 = OpPhi %6 %540 %539 %542 %541 + OpBranch %487 + %487 = OpLabel + %55 = OpSelect %6 %49 %489 %491 + %56 = OpIAdd %6 %55 %22 + OpSelectionMerge %492 None + OpBranchConditional %49 %493 %492 + %493 = OpLabel + OpStore %18 %56 + OpBranch %492 + %492 = OpLabel + %57 = OpAccessChain %43 %41 %55 + OpBranch %497 + %497 = OpLabel + %498 = OpCopyObject %6 %484 + OpBranch %495 + %495 = OpLabel + OpSelectionMerge %545 None + OpBranchConditional %49 %546 %548 + %546 = OpLabel + %547 = OpLoad %6 %57 + %598 = OpAccessChain %163 %161 %105 %22 + %599 = OpLoad %157 %598 + %597 = OpFUnordGreaterThan %31 %575 %599 + OpBranchConditional %597 %27 %545 + %548 = OpLabel + %549 = OpCopyObject %6 %484 + %619 = OpAccessChain %163 %161 %105 %22 + %620 = OpLoad %157 %619 + %618 = OpFUnordGreaterThanEqual %31 %620 %575 + OpBranchConditional %618 %545 %27 + %545 = OpLabel + %496 = OpPhi %6 %547 %546 %549 %548 + OpBranch %494 + %494 = OpLabel + %58 = OpSelect %6 %49 %496 %498 + %59 = OpAccessChain %43 %52 %53 + OpSelectionMerge %499 None + OpBranchConditional %49 %500 %499 + %500 = OpLabel + OpStore %59 %58 + OpBranch %499 + %499 = OpLabel + OpBranch %60 + %60 = OpLabel + OpSelectionMerge %501 None + OpBranchConditional %49 %504 %502 + %502 = OpLabel + %503 = OpLoad %6 %16 + OpBranch %501 + %504 = OpLabel + %505 = OpCopyObject %6 %484 + OpBranch %501 + %501 = OpLabel + %61 = OpPhi %6 %503 %502 %505 %504 + %62 = OpIAdd %6 %61 %22 + OpSelectionMerge %506 None + OpBranchConditional %49 %506 %507 + %507 = OpLabel + OpStore %16 %62 + OpBranch %506 + %506 = OpLabel + %602 = OpAccessChain %163 %161 %105 %105 + %603 = OpLoad %157 %602 + %601 = OpFUnordGreaterThan %31 %373 %603 + OpBranchConditional %601 %509 %27 + %509 = OpLabel + OpSelectionMerge %559 None + OpBranchConditional %49 %562 %560 + %560 = OpLabel + %561 = OpLoad %6 %20 + OpBranch %559 + %562 = OpLabel + %563 = OpCopyObject %6 %484 + OpBranch %559 + %559 = OpLabel + %510 = OpPhi %6 %561 %560 %563 %562 + OpBranch %511 + %511 = OpLabel + %512 = OpCopyObject %6 %484 + OpBranch %508 + %508 = OpLabel + %63 = OpSelect %6 %49 %512 %510 + %64 = OpIAdd %6 %63 %22 + OpSelectionMerge %513 None + OpBranchConditional %49 %513 %514 + %514 = OpLabel + OpStore %20 %64 + OpBranch %513 + %513 = OpLabel + %65 = OpAccessChain %43 %41 %63 + OpSelectionMerge %515 None + OpBranchConditional %49 %518 %516 + %516 = OpLabel + %517 = OpLoad %6 %65 + OpBranch %515 + %518 = OpLabel + %519 = OpCopyObject %6 %484 + OpBranch %515 + %515 = OpLabel + %66 = OpPhi %6 %517 %516 %519 %518 + %67 = OpAccessChain %43 %52 %61 + OpSelectionMerge %520 None + OpBranchConditional %49 %520 %521 + %521 = OpLabel + OpStore %67 %66 + OpBranch %520 + %520 = OpLabel + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant_2 + +# injectionSwitch +BUFFER variant_2_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_2_pipeline + ATTACH variant_2_vertex_shader + ATTACH variant_2_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_2_framebuffer AS color LOCATION 0 + BIND BUFFER variant_2_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_2_pipeline 0 0 0 255 + +CLEAR variant_2_pipeline +RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var.amber b/vulkan/amber/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var.amber new file mode 100644 index 0000000..2c76ec9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var.amber @@ -0,0 +1,1947 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Three shaders diff: mutated var + +# The test renders three images using semantically equivalent shaders, and then +# checks that the images are similar. +# The test passes because the shaders have the same semantics and so the images +# should be the same. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 378 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + %240 = OpFunctionCall %2 %14 + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %60 + %50 = OpLabel + %53 = OpLoad %6 %16 + %54 = OpIAdd %6 %53 %22 + OpStore %16 %54 + %55 = OpLoad %6 %18 + %56 = OpIAdd %6 %55 %22 + OpStore %18 %56 + %57 = OpAccessChain %43 %41 %55 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %43 %52 %53 + OpStore %59 %58 + OpBranch %51 + %60 = OpLabel + %61 = OpLoad %6 %16 + %62 = OpIAdd %6 %61 %22 + OpStore %16 %62 + %63 = OpLoad %6 %20 + %64 = OpIAdd %6 %63 %22 + OpStore %20 %64 + %65 = OpAccessChain %43 %41 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %43 %52 %61 + OpStore %67 %66 + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# injectionSwitch +BUFFER reference_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 679 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %637 = OpConstant %6 0 + %638 = OpConstantComposite %39 %637 %637 %637 %637 %637 %637 %637 %637 %637 %637 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %488 = OpVariable %7 Function + %487 = OpVariable %7 Function + %486 = OpVariable %7 Function + %485 = OpVariable %7 Function + %484 = OpVariable %7 Function + %483 = OpVariable %7 Function + %482 = OpVariable %7 Function + %481 = OpVariable %7 Function + %480 = OpVariable %7 Function + %479 = OpVariable %7 Function + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + OpStore %479 %105 + OpStore %480 %107 + OpStore %481 %22 + OpBranch %489 + %489 = OpLabel + OpLoopMerge %527 %524 None + OpBranch %490 + %490 = OpLabel + %491 = OpLoad %6 %481 + %492 = OpLoad %6 %480 + %493 = OpSLessThanEqual %31 %491 %492 + OpBranchConditional %493 %494 %527 + %494 = OpLabel + %495 = OpLoad %6 %479 + OpStore %482 %495 + OpBranch %496 + %496 = OpLabel + OpLoopMerge %523 %518 None + OpBranch %497 + %497 = OpLabel + %498 = OpLoad %6 %482 + %499 = OpLoad %6 %480 + %500 = OpSLessThan %31 %498 %499 + OpBranchConditional %500 %501 %523 + %501 = OpLabel + %502 = OpLoad %6 %482 + OpStore %483 %502 + %503 = OpLoad %6 %482 + %504 = OpLoad %6 %481 + %505 = OpIAdd %6 %503 %504 + %678 = OpLoad %39 %41 + OpStore %41 %638 + OpStore %41 %678 + %506 = OpISub %6 %505 %22 + OpStore %484 %506 + %507 = OpLoad %6 %482 + %508 = OpLoad %6 %481 + %509 = OpIMul %6 %136 %508 + %510 = OpIAdd %6 %507 %509 + %511 = OpISub %6 %510 %22 + %512 = OpLoad %6 %480 + %513 = OpExtInst %6 %1 SMin %511 %512 + OpStore %485 %513 + %514 = OpLoad %6 %483 + OpStore %486 %514 + %515 = OpLoad %6 %484 + OpStore %487 %515 + %516 = OpLoad %6 %485 + OpStore %488 %516 + %517 = OpFunctionCall %2 %12 %486 %487 %488 + OpBranch %518 + %518 = OpLabel + %519 = OpLoad %6 %481 + %520 = OpIMul %6 %136 %519 + %521 = OpLoad %6 %482 + %522 = OpIAdd %6 %521 %520 + OpStore %482 %522 + OpBranch %496 + %523 = OpLabel + OpBranch %524 + %524 = OpLabel + %525 = OpLoad %6 %481 + %526 = OpIMul %6 %136 %525 + OpStore %481 %526 + OpBranch %489 + %527 = OpLabel + OpBranch %478 + %478 = OpLabel + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %60 + %50 = OpLabel + %53 = OpLoad %6 %16 + %54 = OpIAdd %6 %53 %22 + OpStore %16 %54 + %55 = OpLoad %6 %18 + %56 = OpIAdd %6 %55 %22 + OpStore %18 %56 + %57 = OpAccessChain %43 %41 %55 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %43 %52 %53 + OpStore %59 %58 + OpBranch %51 + %60 = OpLabel + %61 = OpLoad %6 %16 + %62 = OpIAdd %6 %61 %22 + OpStore %16 %62 + %63 = OpLoad %6 %20 + %64 = OpIAdd %6 %63 %22 + OpStore %20 %64 + %65 = OpAccessChain %43 %41 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %43 %52 %61 + OpStore %67 %66 + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_2_vertex_shader PASSTHROUGH + +SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 639 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %637 = OpConstant %6 0 + %638 = OpConstantComposite %39 %637 %637 %637 %637 %637 %637 %637 %637 %637 %637 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %488 = OpVariable %7 Function + %487 = OpVariable %7 Function + %486 = OpVariable %7 Function + %485 = OpVariable %7 Function + %484 = OpVariable %7 Function + %483 = OpVariable %7 Function + %482 = OpVariable %7 Function + %481 = OpVariable %7 Function + %480 = OpVariable %7 Function + %479 = OpVariable %7 Function + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + OpStore %479 %105 + OpStore %480 %107 + OpStore %481 %22 + OpBranch %489 + %489 = OpLabel + OpLoopMerge %527 %524 None + OpBranch %490 + %490 = OpLabel + %491 = OpLoad %6 %481 + %492 = OpLoad %6 %480 + %493 = OpSLessThanEqual %31 %491 %492 + OpBranchConditional %493 %494 %527 + %494 = OpLabel + %495 = OpLoad %6 %479 + OpStore %482 %495 + OpBranch %496 + %496 = OpLabel + OpLoopMerge %523 %518 None + OpBranch %497 + %497 = OpLabel + %498 = OpLoad %6 %482 + %499 = OpLoad %6 %480 + %500 = OpSLessThan %31 %498 %499 + OpBranchConditional %500 %501 %523 + %501 = OpLabel + %502 = OpLoad %6 %482 + OpStore %483 %502 + %503 = OpLoad %6 %482 + %504 = OpLoad %6 %481 + %505 = OpIAdd %6 %503 %504 + %506 = OpISub %6 %505 %22 + OpStore %484 %506 + %507 = OpLoad %6 %482 + %508 = OpLoad %6 %481 + %509 = OpIMul %6 %136 %508 + %510 = OpIAdd %6 %507 %509 + %511 = OpISub %6 %510 %22 + %512 = OpLoad %6 %480 + %513 = OpExtInst %6 %1 SMin %511 %512 + OpStore %485 %513 + %514 = OpLoad %6 %483 + OpStore %486 %514 + %515 = OpLoad %6 %484 + OpStore %487 %515 + %516 = OpLoad %6 %485 + OpStore %488 %516 + %517 = OpFunctionCall %2 %12 %486 %487 %488 + OpBranch %518 + %518 = OpLabel + %519 = OpLoad %6 %481 + %520 = OpIMul %6 %136 %519 + %521 = OpLoad %6 %482 + %522 = OpIAdd %6 %521 %520 + OpStore %482 %522 + OpBranch %496 + %523 = OpLabel + OpBranch %524 + %524 = OpLabel + %525 = OpLoad %6 %481 + %526 = OpIMul %6 %136 %525 + OpStore %481 %526 + OpBranch %489 + %527 = OpLabel + OpBranch %478 + %478 = OpLabel + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %60 + %50 = OpLabel + %53 = OpLoad %6 %16 + %54 = OpIAdd %6 %53 %22 + OpStore %16 %54 + %55 = OpLoad %6 %18 + %56 = OpIAdd %6 %55 %22 + OpStore %18 %56 + %57 = OpAccessChain %43 %41 %55 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %43 %52 %53 + OpStore %59 %58 + OpBranch %51 + %60 = OpLabel + %61 = OpLoad %6 %16 + %62 = OpIAdd %6 %61 %22 + OpStore %16 %62 + %63 = OpLoad %6 %20 + %64 = OpIAdd %6 %63 %22 + OpStore %20 %64 + %65 = OpAccessChain %43 %41 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %43 %52 %61 + OpStore %67 %66 + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant_2 + +# injectionSwitch +BUFFER variant_2_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_2_pipeline + ATTACH variant_2_vertex_shader + ATTACH variant_2_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_2_framebuffer AS color LOCATION 0 + BIND BUFFER variant_2_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_2_pipeline 0 0 0 255 + +CLEAR variant_2_pipeline +RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-orbit-O-mutate-variable.amber b/vulkan/amber/graphicsfuzz/spv-stable-orbit-O-mutate-variable.amber new file mode 100644 index 0000000..d8dace3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-orbit-O-mutate-variable.amber @@ -0,0 +1,418 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Two shaders with diff: variable mutated + +# The test renders two images using semantically equivalent shaders, and then +# checks that the images are similar. +# The test passes because the shaders have the same semantics and so the images +# should be the same. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 230 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %53 %138 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %53 "gl_FragCoord" + OpName %56 "buf0" + OpMemberName %56 0 "resolution" + OpName %58 "" + OpName %138 "_GLF_color" + OpName %163 "indexable" + OpDecorate %53 BuiltIn FragCoord + OpMemberDecorate %56 0 Offset 0 + OpDecorate %56 Block + OpDecorate %58 DescriptorSet 0 + OpDecorate %58 Binding 0 + OpDecorate %138 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %13 = OpTypeInt 32 0 + %18 = OpConstant %6 0 + %19 = OpTypeBool + %26 = OpConstant %6 1 + %38 = OpConstant %6 2 + %47 = OpTypeFloat 32 + %48 = OpTypeVector %47 2 + %51 = OpTypeVector %47 4 + %52 = OpTypePointer Input %51 + %53 = OpVariable %52 Input + %56 = OpTypeStruct %48 + %57 = OpTypePointer Uniform %56 + %58 = OpVariable %57 Uniform + %59 = OpTypePointer Uniform %48 + %67 = OpConstant %47 8 + %78 = OpConstant %6 5 + %82 = OpConstant %6 10 + %95 = OpConstant %6 8 + %107 = OpConstant %6 100 + %130 = OpConstant %6 15 + %132 = OpConstant %6 16 + %137 = OpTypePointer Output %51 + %138 = OpVariable %137 Output + %139 = OpConstant %13 16 + %140 = OpTypeArray %51 %139 + %141 = OpConstant %47 0 + %142 = OpConstant %47 1 + %143 = OpConstantComposite %51 %141 %141 %141 %142 + %144 = OpConstant %47 0.5 + %145 = OpConstantComposite %51 %144 %141 %141 %142 + %146 = OpConstantComposite %51 %141 %144 %141 %142 + %147 = OpConstantComposite %51 %144 %144 %141 %142 + %148 = OpConstantComposite %51 %141 %141 %144 %142 + %149 = OpConstantComposite %51 %144 %141 %144 %142 + %150 = OpConstantComposite %51 %141 %144 %144 %142 + %151 = OpConstantComposite %51 %144 %144 %144 %142 + %152 = OpConstantComposite %51 %142 %141 %141 %142 + %153 = OpConstantComposite %51 %141 %142 %141 %142 + %154 = OpConstantComposite %51 %142 %142 %141 %142 + %155 = OpConstantComposite %51 %141 %141 %142 %142 + %156 = OpConstantComposite %51 %142 %141 %142 %142 + %157 = OpConstantComposite %51 %141 %142 %142 %142 + %158 = OpConstantComposite %51 %142 %142 %142 %142 + %159 = OpConstantComposite %140 %143 %145 %146 %147 %148 %149 %150 %151 %143 %152 %153 %154 %155 %156 %157 %158 + %162 = OpTypePointer Function %140 + %164 = OpTypePointer Function %51 + %229 = OpUndef %7 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %163 = OpVariable %162 Function + %54 = OpLoad %51 %53 + %55 = OpVectorShuffle %48 %54 %54 0 1 + %60 = OpAccessChain %59 %58 %18 + %61 = OpLoad %48 %60 + %62 = OpFDiv %48 %55 %61 + %66 = OpCompositeExtract %47 %62 0 + %68 = OpFMul %47 %66 %67 + %69 = OpConvertFToS %6 %68 + %71 = OpCompositeExtract %47 %62 1 + %72 = OpFMul %47 %71 %67 + %73 = OpConvertFToS %6 %72 + %79 = OpBitwiseAnd %6 %69 %78 + %83 = OpBitwiseAnd %6 %73 %82 + %84 = OpBitwiseOr %6 %79 %83 + %88 = OpBitwiseAnd %6 %73 %78 + %91 = OpBitwiseAnd %6 %69 %82 + %92 = OpBitwiseOr %6 %88 %91 + %96 = OpIMul %6 %84 %95 + %98 = OpIAdd %6 %96 %92 + %99 = OpCompositeConstruct %7 %98 %18 + OpBranch %101 + %101 = OpLabel + %221 = OpPhi %7 %99 %5 %210 %104 + %220 = OpPhi %6 %18 %5 %113 %104 + %108 = OpSLessThan %19 %220 %107 + OpLoopMerge %103 %104 None + OpBranchConditional %108 %102 %103 + %102 = OpLabel + %170 = OpCompositeExtract %6 %221 0 + %171 = OpSGreaterThan %19 %170 %18 + OpSelectionMerge %176 None + OpBranchConditional %171 %172 %176 + %172 = OpLabel + %174 = OpCompositeExtract %6 %221 1 + %175 = OpISub %6 %174 %26 + %202 = OpCompositeInsert %7 %175 %221 1 + OpBranch %176 + %176 = OpLabel + %224 = OpPhi %7 %221 %102 %202 %172 + %178 = OpCompositeExtract %6 %224 0 + %179 = OpSLessThan %19 %178 %18 + OpSelectionMerge %184 None + OpBranchConditional %179 %180 %184 + %180 = OpLabel + %182 = OpCompositeExtract %6 %224 1 + %183 = OpIAdd %6 %182 %26 + %206 = OpCompositeInsert %7 %183 %224 1 + OpBranch %184 + %184 = OpLabel + %225 = OpPhi %7 %224 %176 %206 %180 + %186 = OpCompositeExtract %6 %225 1 + %187 = OpSDiv %6 %186 %38 + %189 = OpCompositeExtract %6 %225 0 + %190 = OpIAdd %6 %189 %187 + %210 = OpCompositeInsert %7 %190 %225 0 + OpBranch %104 + %104 = OpLabel + %113 = OpIAdd %6 %220 %26 + OpBranch %101 + %103 = OpLabel + %115 = OpCompositeExtract %6 %221 0 + %116 = OpSLessThan %19 %115 %18 + OpSelectionMerge %118 None + OpBranchConditional %116 %117 %118 + %117 = OpLabel + %121 = OpSNegate %6 %115 + %214 = OpCompositeInsert %7 %121 %229 0 + OpBranch %118 + %118 = OpLabel + %223 = OpPhi %7 %221 %103 %214 %117 + OpBranch %123 + %123 = OpLabel + %222 = OpPhi %7 %223 %118 %218 %124 + %129 = OpCompositeExtract %6 %222 0 + %131 = OpSGreaterThan %19 %129 %130 + OpLoopMerge %125 %124 None + OpBranchConditional %131 %124 %125 + %124 = OpLabel + %135 = OpISub %6 %129 %132 + %218 = OpCompositeInsert %7 %135 %229 0 + OpBranch %123 + %125 = OpLabel + OpStore %163 %159 + %165 = OpAccessChain %164 %163 %129 + %166 = OpLoad %51 %165 + OpStore %138 %166 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 399 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %53 %138 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %53 "gl_FragCoord" + OpName %56 "buf0" + OpMemberName %56 0 "resolution" + OpName %58 "" + OpName %138 "_GLF_color" + OpName %163 "indexable" + OpDecorate %53 BuiltIn FragCoord + OpMemberDecorate %56 0 Offset 0 + OpDecorate %56 Block + OpDecorate %58 DescriptorSet 0 + OpDecorate %58 Binding 0 + OpDecorate %138 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %13 = OpTypeInt 32 0 + %18 = OpConstant %6 0 + %19 = OpTypeBool + %26 = OpConstant %6 1 + %38 = OpConstant %6 2 + %47 = OpTypeFloat 32 + %48 = OpTypeVector %47 2 + %51 = OpTypeVector %47 4 + %52 = OpTypePointer Input %51 + %53 = OpVariable %52 Input + %56 = OpTypeStruct %48 + %57 = OpTypePointer Uniform %56 + %58 = OpVariable %57 Uniform + %59 = OpTypePointer Uniform %48 + %67 = OpConstant %47 8 + %78 = OpConstant %6 5 + %82 = OpConstant %6 10 + %95 = OpConstant %6 8 + %107 = OpConstant %6 100 + %130 = OpConstant %6 15 + %132 = OpConstant %6 16 + %137 = OpTypePointer Output %51 + %138 = OpVariable %137 Output + %139 = OpConstant %13 16 + %140 = OpTypeArray %51 %139 + %141 = OpConstant %47 0 + %142 = OpConstant %47 1 + %143 = OpConstantComposite %51 %141 %141 %141 %142 + %144 = OpConstant %47 0.5 + %145 = OpConstantComposite %51 %144 %141 %141 %142 + %146 = OpConstantComposite %51 %141 %144 %141 %142 + %147 = OpConstantComposite %51 %144 %144 %141 %142 + %148 = OpConstantComposite %51 %141 %141 %144 %142 + %149 = OpConstantComposite %51 %144 %141 %144 %142 + %150 = OpConstantComposite %51 %141 %144 %144 %142 + %151 = OpConstantComposite %51 %144 %144 %144 %142 + %152 = OpConstantComposite %51 %142 %141 %141 %142 + %153 = OpConstantComposite %51 %141 %142 %141 %142 + %154 = OpConstantComposite %51 %142 %142 %141 %142 + %155 = OpConstantComposite %51 %141 %141 %142 %142 + %156 = OpConstantComposite %51 %142 %141 %142 %142 + %157 = OpConstantComposite %51 %141 %142 %142 %142 + %158 = OpConstantComposite %51 %142 %142 %142 %142 + %159 = OpConstantComposite %140 %143 %145 %146 %147 %148 %149 %150 %151 %143 %152 %153 %154 %155 %156 %157 %158 + %162 = OpTypePointer Function %140 + %164 = OpTypePointer Function %51 + %229 = OpUndef %7 + %354 = OpConstant %47 0 + %355 = OpConstantComposite %51 %354 %354 %354 %354 + %356 = OpConstantComposite %140 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %163 = OpVariable %162 Function + %54 = OpLoad %51 %53 + %55 = OpVectorShuffle %48 %54 %54 0 1 + %60 = OpAccessChain %59 %58 %18 + %61 = OpLoad %48 %60 + %62 = OpFDiv %48 %55 %61 + %66 = OpCompositeExtract %47 %62 0 + %68 = OpFMul %47 %66 %67 + %69 = OpConvertFToS %6 %68 + %71 = OpCompositeExtract %47 %62 1 + %72 = OpFMul %47 %71 %67 + %73 = OpConvertFToS %6 %72 + %79 = OpBitwiseAnd %6 %69 %78 + %83 = OpBitwiseAnd %6 %73 %82 + %84 = OpBitwiseOr %6 %79 %83 + %88 = OpBitwiseAnd %6 %73 %78 + %91 = OpBitwiseAnd %6 %69 %82 + %92 = OpBitwiseOr %6 %88 %91 + %96 = OpIMul %6 %84 %95 + %98 = OpIAdd %6 %96 %92 + %99 = OpCompositeConstruct %7 %98 %18 + OpBranch %101 + %101 = OpLabel + %221 = OpPhi %7 %99 %5 %210 %104 + %220 = OpPhi %6 %18 %5 %113 %104 + %108 = OpSLessThan %19 %220 %107 + OpLoopMerge %103 %104 None + OpBranchConditional %108 %102 %103 + %102 = OpLabel + %170 = OpCompositeExtract %6 %221 0 + %171 = OpSGreaterThan %19 %170 %18 + OpSelectionMerge %176 None + OpBranchConditional %171 %172 %176 + %172 = OpLabel + %174 = OpCompositeExtract %6 %221 1 + %175 = OpISub %6 %174 %26 + %202 = OpCompositeInsert %7 %175 %221 1 + OpBranch %176 + %176 = OpLabel + %224 = OpPhi %7 %221 %102 %202 %172 + %178 = OpCompositeExtract %6 %224 0 + %179 = OpSLessThan %19 %178 %18 + OpSelectionMerge %184 None + OpBranchConditional %179 %180 %184 + %180 = OpLabel + %182 = OpCompositeExtract %6 %224 1 + %183 = OpIAdd %6 %182 %26 + %206 = OpCompositeInsert %7 %183 %224 1 + OpBranch %184 + %184 = OpLabel + %225 = OpPhi %7 %224 %176 %206 %180 + %186 = OpCompositeExtract %6 %225 1 + %187 = OpSDiv %6 %186 %38 + %189 = OpCompositeExtract %6 %225 0 + %190 = OpIAdd %6 %189 %187 + %210 = OpCompositeInsert %7 %190 %225 0 + OpBranch %104 + %104 = OpLabel + %113 = OpIAdd %6 %220 %26 + OpBranch %101 + %103 = OpLabel + %115 = OpCompositeExtract %6 %221 0 + %116 = OpSLessThan %19 %115 %18 + OpSelectionMerge %118 None + OpBranchConditional %116 %117 %118 + %117 = OpLabel + %121 = OpSNegate %6 %115 + %214 = OpCompositeInsert %7 %121 %229 0 + OpBranch %118 + %118 = OpLabel + %223 = OpPhi %7 %221 %103 %214 %117 + OpBranch %123 + %123 = OpLabel + %222 = OpPhi %7 %223 %118 %218 %124 + %129 = OpCompositeExtract %6 %222 0 + %131 = OpSGreaterThan %19 %129 %130 + OpLoopMerge %125 %124 None + OpBranchConditional %131 %124 %125 + %124 = OpLabel + %135 = OpISub %6 %129 %132 + %218 = OpCompositeInsert %7 %135 %229 0 + OpBranch %123 + %125 = OpLabel + OpStore %163 %159 + %398 = OpLoad %140 %163 + OpStore %163 %356 + OpStore %163 %398 + %165 = OpAccessChain %164 %163 %129 + %166 = OpLoad %51 %165 + OpStore %138 %166 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer.amber b/vulkan/amber/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer.amber new file mode 100644 index 0000000..1f046a5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer.amber @@ -0,0 +1,614 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Three shaders with diff: added mutate pointer + +# The test renders three images using semantically equivalent shaders, and then +# checks that the images are similar. +# The test passes because the shaders have the same semantics and so the images +# should be the same. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 229 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %53 %138 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %53 "gl_FragCoord" + OpName %56 "buf0" + OpMemberName %56 0 "resolution" + OpName %58 "" + OpName %138 "_GLF_color" + OpName %163 "indexable" + OpDecorate %53 BuiltIn FragCoord + OpMemberDecorate %56 0 Offset 0 + OpDecorate %56 Block + OpDecorate %58 DescriptorSet 0 + OpDecorate %58 Binding 0 + OpDecorate %138 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %13 = OpTypeInt 32 0 + %18 = OpConstant %6 0 + %19 = OpTypeBool + %26 = OpConstant %6 1 + %38 = OpConstant %6 2 + %47 = OpTypeFloat 32 + %48 = OpTypeVector %47 2 + %51 = OpTypeVector %47 4 + %52 = OpTypePointer Input %51 + %53 = OpVariable %52 Input + %56 = OpTypeStruct %48 + %57 = OpTypePointer Uniform %56 + %58 = OpVariable %57 Uniform + %59 = OpTypePointer Uniform %48 + %67 = OpConstant %47 8 + %78 = OpConstant %6 5 + %82 = OpConstant %6 10 + %95 = OpConstant %6 8 + %107 = OpConstant %6 100 + %130 = OpConstant %6 15 + %132 = OpConstant %6 16 + %137 = OpTypePointer Output %51 + %138 = OpVariable %137 Output + %139 = OpConstant %13 16 + %140 = OpTypeArray %51 %139 + %141 = OpConstant %47 0 + %142 = OpConstant %47 1 + %143 = OpConstantComposite %51 %141 %141 %141 %142 + %144 = OpConstant %47 0.5 + %145 = OpConstantComposite %51 %144 %141 %141 %142 + %146 = OpConstantComposite %51 %141 %144 %141 %142 + %147 = OpConstantComposite %51 %144 %144 %141 %142 + %148 = OpConstantComposite %51 %141 %141 %144 %142 + %149 = OpConstantComposite %51 %144 %141 %144 %142 + %150 = OpConstantComposite %51 %141 %144 %144 %142 + %151 = OpConstantComposite %51 %144 %144 %144 %142 + %152 = OpConstantComposite %51 %142 %141 %141 %142 + %153 = OpConstantComposite %51 %141 %142 %141 %142 + %154 = OpConstantComposite %51 %142 %142 %141 %142 + %155 = OpConstantComposite %51 %141 %141 %142 %142 + %156 = OpConstantComposite %51 %142 %141 %142 %142 + %157 = OpConstantComposite %51 %141 %142 %142 %142 + %158 = OpConstantComposite %51 %142 %142 %142 %142 + %159 = OpConstantComposite %140 %143 %145 %146 %147 %148 %149 %150 %151 %143 %152 %153 %154 %155 %156 %157 %158 + %162 = OpTypePointer Function %140 + %164 = OpTypePointer Function %51 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %163 = OpVariable %162 Function + %54 = OpLoad %51 %53 + %55 = OpVectorShuffle %48 %54 %54 0 1 + %60 = OpAccessChain %59 %58 %18 + %61 = OpLoad %48 %60 + %62 = OpFDiv %48 %55 %61 + %66 = OpCompositeExtract %47 %62 0 + %68 = OpFMul %47 %66 %67 + %69 = OpConvertFToS %6 %68 + %71 = OpCompositeExtract %47 %62 1 + %72 = OpFMul %47 %71 %67 + %73 = OpConvertFToS %6 %72 + %79 = OpBitwiseAnd %6 %69 %78 + %83 = OpBitwiseAnd %6 %73 %82 + %84 = OpBitwiseOr %6 %79 %83 + %88 = OpBitwiseAnd %6 %73 %78 + %91 = OpBitwiseAnd %6 %69 %82 + %92 = OpBitwiseOr %6 %88 %91 + %96 = OpIMul %6 %84 %95 + %98 = OpIAdd %6 %96 %92 + %99 = OpCompositeConstruct %7 %98 %18 + OpBranch %101 + %101 = OpLabel + %224 = OpPhi %7 %99 %5 %214 %104 + %193 = OpPhi %6 %18 %5 %113 %104 + %108 = OpSLessThan %19 %193 %107 + OpLoopMerge %103 %104 None + OpBranchConditional %108 %102 %103 + %102 = OpLabel + %170 = OpCompositeExtract %6 %224 0 + %171 = OpSGreaterThan %19 %170 %18 + OpSelectionMerge %176 None + OpBranchConditional %171 %172 %176 + %172 = OpLabel + %174 = OpCompositeExtract %6 %224 1 + %175 = OpISub %6 %174 %26 + %206 = OpCompositeInsert %7 %175 %224 1 + OpBranch %176 + %176 = OpLabel + %227 = OpPhi %7 %224 %102 %206 %172 + %178 = OpCompositeExtract %6 %227 0 + %179 = OpSLessThan %19 %178 %18 + OpSelectionMerge %184 None + OpBranchConditional %179 %180 %184 + %180 = OpLabel + %182 = OpCompositeExtract %6 %227 1 + %183 = OpIAdd %6 %182 %26 + %210 = OpCompositeInsert %7 %183 %227 1 + OpBranch %184 + %184 = OpLabel + %228 = OpPhi %7 %227 %176 %210 %180 + %186 = OpCompositeExtract %6 %228 1 + %187 = OpSDiv %6 %186 %38 + %189 = OpCompositeExtract %6 %228 0 + %190 = OpIAdd %6 %189 %187 + %214 = OpCompositeInsert %7 %190 %228 0 + OpBranch %104 + %104 = OpLabel + %113 = OpIAdd %6 %193 %26 + OpBranch %101 + %103 = OpLabel + %115 = OpCompositeExtract %6 %224 0 + %116 = OpSLessThan %19 %115 %18 + OpSelectionMerge %118 None + OpBranchConditional %116 %117 %118 + %117 = OpLabel + %121 = OpSNegate %6 %115 + %218 = OpCompositeInsert %7 %121 %224 0 + OpBranch %118 + %118 = OpLabel + %226 = OpPhi %7 %224 %103 %218 %117 + OpBranch %123 + %123 = OpLabel + %225 = OpPhi %7 %226 %118 %222 %124 + %129 = OpCompositeExtract %6 %225 0 + %131 = OpSGreaterThan %19 %129 %130 + OpLoopMerge %125 %124 None + OpBranchConditional %131 %124 %125 + %124 = OpLabel + %135 = OpISub %6 %129 %132 + %222 = OpCompositeInsert %7 %135 %225 0 + OpBranch %123 + %125 = OpLabel + OpStore %163 %159 + %165 = OpAccessChain %164 %163 %129 + %166 = OpLoad %51 %165 + OpStore %138 %166 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 549 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %53 %138 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %53 "gl_FragCoord" + OpName %56 "buf0" + OpMemberName %56 0 "resolution" + OpName %58 "" + OpName %138 "_GLF_color" + OpName %163 "indexable" + OpDecorate %53 BuiltIn FragCoord + OpMemberDecorate %56 0 Offset 0 + OpDecorate %56 Block + OpDecorate %58 DescriptorSet 0 + OpDecorate %58 Binding 0 + OpDecorate %138 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %13 = OpTypeInt 32 0 + %18 = OpConstant %6 0 + %19 = OpTypeBool + %26 = OpConstant %6 1 + %38 = OpConstant %6 2 + %47 = OpTypeFloat 32 + %48 = OpTypeVector %47 2 + %51 = OpTypeVector %47 4 + %52 = OpTypePointer Input %51 + %53 = OpVariable %52 Input + %56 = OpTypeStruct %48 + %57 = OpTypePointer Uniform %56 + %58 = OpVariable %57 Uniform + %59 = OpTypePointer Uniform %48 + %67 = OpConstant %47 8 + %78 = OpConstant %6 5 + %82 = OpConstant %6 10 + %95 = OpConstant %6 8 + %107 = OpConstant %6 100 + %130 = OpConstant %6 15 + %132 = OpConstant %6 16 + %137 = OpTypePointer Output %51 + %138 = OpVariable %137 Output + %139 = OpConstant %13 16 + %140 = OpTypeArray %51 %139 + %141 = OpConstant %47 0 + %142 = OpConstant %47 1 + %143 = OpConstantComposite %51 %141 %141 %141 %142 + %144 = OpConstant %47 0.5 + %145 = OpConstantComposite %51 %144 %141 %141 %142 + %146 = OpConstantComposite %51 %141 %144 %141 %142 + %147 = OpConstantComposite %51 %144 %144 %141 %142 + %148 = OpConstantComposite %51 %141 %141 %144 %142 + %149 = OpConstantComposite %51 %144 %141 %144 %142 + %150 = OpConstantComposite %51 %141 %144 %144 %142 + %151 = OpConstantComposite %51 %144 %144 %144 %142 + %152 = OpConstantComposite %51 %142 %141 %141 %142 + %153 = OpConstantComposite %51 %141 %142 %141 %142 + %154 = OpConstantComposite %51 %142 %142 %141 %142 + %155 = OpConstantComposite %51 %141 %141 %142 %142 + %156 = OpConstantComposite %51 %142 %141 %142 %142 + %157 = OpConstantComposite %51 %141 %142 %142 %142 + %158 = OpConstantComposite %51 %142 %142 %142 %142 + %159 = OpConstantComposite %140 %143 %145 %146 %147 %148 %149 %150 %151 %143 %152 %153 %154 %155 %156 %157 %158 + %162 = OpTypePointer Function %140 + %164 = OpTypePointer Function %51 + %440 = OpConstant %47 0 + %441 = OpConstantComposite %51 %440 %440 %440 %440 + %442 = OpConstantComposite %140 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %163 = OpVariable %162 Function + %54 = OpLoad %51 %53 + %55 = OpVectorShuffle %48 %54 %54 0 1 + %60 = OpAccessChain %59 %58 %18 + %61 = OpLoad %48 %60 + %62 = OpFDiv %48 %55 %61 + %66 = OpCompositeExtract %47 %62 0 + %68 = OpFMul %47 %66 %67 + %69 = OpConvertFToS %6 %68 + %330 = OpAccessChain %162 %163 + %71 = OpCompositeExtract %47 %62 1 + %72 = OpFMul %47 %71 %67 + %73 = OpConvertFToS %6 %72 + %79 = OpBitwiseAnd %6 %69 %78 + %83 = OpBitwiseAnd %6 %73 %82 + %84 = OpBitwiseOr %6 %79 %83 + %88 = OpBitwiseAnd %6 %73 %78 + %91 = OpBitwiseAnd %6 %69 %82 + %92 = OpBitwiseOr %6 %88 %91 + %96 = OpIMul %6 %84 %95 + %98 = OpIAdd %6 %96 %92 + %99 = OpCompositeConstruct %7 %98 %18 + OpBranch %101 + %101 = OpLabel + %224 = OpPhi %7 %99 %5 %214 %104 + %193 = OpPhi %6 %18 %5 %113 %104 + %108 = OpSLessThan %19 %193 %107 + OpLoopMerge %103 %104 None + OpBranchConditional %108 %102 %103 + %102 = OpLabel + %170 = OpCompositeExtract %6 %224 0 + %171 = OpSGreaterThan %19 %170 %18 + OpSelectionMerge %176 None + OpBranchConditional %171 %172 %176 + %172 = OpLabel + %174 = OpCompositeExtract %6 %224 1 + %175 = OpISub %6 %174 %26 + %206 = OpCompositeInsert %7 %175 %224 1 + OpBranch %176 + %176 = OpLabel + %227 = OpPhi %7 %224 %102 %206 %172 + %178 = OpCompositeExtract %6 %227 0 + %179 = OpSLessThan %19 %178 %18 + OpSelectionMerge %184 None + OpBranchConditional %179 %180 %184 + %180 = OpLabel + %182 = OpCompositeExtract %6 %227 1 + %183 = OpIAdd %6 %182 %26 + %210 = OpCompositeInsert %7 %183 %227 1 + OpBranch %184 + %184 = OpLabel + %228 = OpPhi %7 %227 %176 %210 %180 + %186 = OpCompositeExtract %6 %228 1 + %187 = OpSDiv %6 %186 %38 + %189 = OpCompositeExtract %6 %228 0 + %190 = OpIAdd %6 %189 %187 + %214 = OpCompositeInsert %7 %190 %228 0 + OpBranch %104 + %104 = OpLabel + %113 = OpIAdd %6 %193 %26 + OpBranch %101 + %103 = OpLabel + %115 = OpCompositeExtract %6 %224 0 + %116 = OpSLessThan %19 %115 %18 + OpSelectionMerge %118 None + OpBranchConditional %116 %117 %118 + %117 = OpLabel + %121 = OpSNegate %6 %115 + %218 = OpCompositeInsert %7 %121 %224 0 + OpBranch %118 + %118 = OpLabel + %226 = OpPhi %7 %224 %103 %218 %117 + OpBranch %123 + %123 = OpLabel + %225 = OpPhi %7 %226 %118 %222 %124 + %129 = OpCompositeExtract %6 %225 0 + %131 = OpSGreaterThan %19 %129 %130 + OpLoopMerge %125 %124 None + OpBranchConditional %131 %124 %125 + %124 = OpLabel + %135 = OpISub %6 %129 %132 + %222 = OpCompositeInsert %7 %135 %225 0 + OpBranch %123 + %125 = OpLabel + OpStore %163 %159 + %165 = OpAccessChain %164 %163 %129 + %548 = OpLoad %140 %330 + OpStore %330 %442 + OpStore %330 %548 + %166 = OpLoad %51 %165 + OpStore %138 %166 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_2_vertex_shader PASSTHROUGH + +SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 443 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %53 %138 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %53 "gl_FragCoord" + OpName %56 "buf0" + OpMemberName %56 0 "resolution" + OpName %58 "" + OpName %138 "_GLF_color" + OpName %163 "indexable" + OpDecorate %53 BuiltIn FragCoord + OpMemberDecorate %56 0 Offset 0 + OpDecorate %56 Block + OpDecorate %58 DescriptorSet 0 + OpDecorate %58 Binding 0 + OpDecorate %138 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %13 = OpTypeInt 32 0 + %18 = OpConstant %6 0 + %19 = OpTypeBool + %26 = OpConstant %6 1 + %38 = OpConstant %6 2 + %47 = OpTypeFloat 32 + %48 = OpTypeVector %47 2 + %51 = OpTypeVector %47 4 + %52 = OpTypePointer Input %51 + %53 = OpVariable %52 Input + %56 = OpTypeStruct %48 + %57 = OpTypePointer Uniform %56 + %58 = OpVariable %57 Uniform + %59 = OpTypePointer Uniform %48 + %67 = OpConstant %47 8 + %78 = OpConstant %6 5 + %82 = OpConstant %6 10 + %95 = OpConstant %6 8 + %107 = OpConstant %6 100 + %130 = OpConstant %6 15 + %132 = OpConstant %6 16 + %137 = OpTypePointer Output %51 + %138 = OpVariable %137 Output + %139 = OpConstant %13 16 + %140 = OpTypeArray %51 %139 + %141 = OpConstant %47 0 + %142 = OpConstant %47 1 + %143 = OpConstantComposite %51 %141 %141 %141 %142 + %144 = OpConstant %47 0.5 + %145 = OpConstantComposite %51 %144 %141 %141 %142 + %146 = OpConstantComposite %51 %141 %144 %141 %142 + %147 = OpConstantComposite %51 %144 %144 %141 %142 + %148 = OpConstantComposite %51 %141 %141 %144 %142 + %149 = OpConstantComposite %51 %144 %141 %144 %142 + %150 = OpConstantComposite %51 %141 %144 %144 %142 + %151 = OpConstantComposite %51 %144 %144 %144 %142 + %152 = OpConstantComposite %51 %142 %141 %141 %142 + %153 = OpConstantComposite %51 %141 %142 %141 %142 + %154 = OpConstantComposite %51 %142 %142 %141 %142 + %155 = OpConstantComposite %51 %141 %141 %142 %142 + %156 = OpConstantComposite %51 %142 %141 %142 %142 + %157 = OpConstantComposite %51 %141 %142 %142 %142 + %158 = OpConstantComposite %51 %142 %142 %142 %142 + %159 = OpConstantComposite %140 %143 %145 %146 %147 %148 %149 %150 %151 %143 %152 %153 %154 %155 %156 %157 %158 + %162 = OpTypePointer Function %140 + %164 = OpTypePointer Function %51 + %440 = OpConstant %47 0 + %441 = OpConstantComposite %51 %440 %440 %440 %440 + %442 = OpConstantComposite %140 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %163 = OpVariable %162 Function + %54 = OpLoad %51 %53 + %55 = OpVectorShuffle %48 %54 %54 0 1 + %60 = OpAccessChain %59 %58 %18 + %61 = OpLoad %48 %60 + %62 = OpFDiv %48 %55 %61 + %66 = OpCompositeExtract %47 %62 0 + %68 = OpFMul %47 %66 %67 + %69 = OpConvertFToS %6 %68 + %330 = OpAccessChain %162 %163 + %71 = OpCompositeExtract %47 %62 1 + %72 = OpFMul %47 %71 %67 + %73 = OpConvertFToS %6 %72 + %79 = OpBitwiseAnd %6 %69 %78 + %83 = OpBitwiseAnd %6 %73 %82 + %84 = OpBitwiseOr %6 %79 %83 + %88 = OpBitwiseAnd %6 %73 %78 + %91 = OpBitwiseAnd %6 %69 %82 + %92 = OpBitwiseOr %6 %88 %91 + %96 = OpIMul %6 %84 %95 + %98 = OpIAdd %6 %96 %92 + %99 = OpCompositeConstruct %7 %98 %18 + OpBranch %101 + %101 = OpLabel + %224 = OpPhi %7 %99 %5 %214 %104 + %193 = OpPhi %6 %18 %5 %113 %104 + %108 = OpSLessThan %19 %193 %107 + OpLoopMerge %103 %104 None + OpBranchConditional %108 %102 %103 + %102 = OpLabel + %170 = OpCompositeExtract %6 %224 0 + %171 = OpSGreaterThan %19 %170 %18 + OpSelectionMerge %176 None + OpBranchConditional %171 %172 %176 + %172 = OpLabel + %174 = OpCompositeExtract %6 %224 1 + %175 = OpISub %6 %174 %26 + %206 = OpCompositeInsert %7 %175 %224 1 + OpBranch %176 + %176 = OpLabel + %227 = OpPhi %7 %224 %102 %206 %172 + %178 = OpCompositeExtract %6 %227 0 + %179 = OpSLessThan %19 %178 %18 + OpSelectionMerge %184 None + OpBranchConditional %179 %180 %184 + %180 = OpLabel + %182 = OpCompositeExtract %6 %227 1 + %183 = OpIAdd %6 %182 %26 + %210 = OpCompositeInsert %7 %183 %227 1 + OpBranch %184 + %184 = OpLabel + %228 = OpPhi %7 %227 %176 %210 %180 + %186 = OpCompositeExtract %6 %228 1 + %187 = OpSDiv %6 %186 %38 + %189 = OpCompositeExtract %6 %228 0 + %190 = OpIAdd %6 %189 %187 + %214 = OpCompositeInsert %7 %190 %228 0 + OpBranch %104 + %104 = OpLabel + %113 = OpIAdd %6 %193 %26 + OpBranch %101 + %103 = OpLabel + %115 = OpCompositeExtract %6 %224 0 + %116 = OpSLessThan %19 %115 %18 + OpSelectionMerge %118 None + OpBranchConditional %116 %117 %118 + %117 = OpLabel + %121 = OpSNegate %6 %115 + %218 = OpCompositeInsert %7 %121 %224 0 + OpBranch %118 + %118 = OpLabel + %226 = OpPhi %7 %224 %103 %218 %117 + OpBranch %123 + %123 = OpLabel + %225 = OpPhi %7 %226 %118 %222 %124 + %129 = OpCompositeExtract %6 %225 0 + %131 = OpSGreaterThan %19 %129 %130 + OpLoopMerge %125 %124 None + OpBranchConditional %131 %124 %125 + %124 = OpLabel + %135 = OpISub %6 %129 %132 + %222 = OpCompositeInsert %7 %135 %225 0 + OpBranch %123 + %125 = OpLabel + OpStore %163 %159 + %165 = OpAccessChain %164 %163 %129 + %166 = OpLoad %51 %165 + OpStore %138 %166 + OpReturn + OpFunctionEnd +END + +# uniforms for variant_2 + +# resolution +BUFFER variant_2_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_2_pipeline + ATTACH variant_2_vertex_shader + ATTACH variant_2_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_2_framebuffer AS color LOCATION 0 + BIND BUFFER variant_2_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_2_pipeline 0 0 0 255 + +CLEAR variant_2_pipeline +RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi.amber b/vulkan/amber/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi.amber new file mode 100644 index 0000000..57d04a8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi.amber @@ -0,0 +1,1011 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Three shaders diff: OpSelect -> OpPhi + +# The test renders three images using semantically equivalent shaders, and then +# checks that the images are similar. +# The test passes because the shaders have the same semantics and so the images +# should be the same. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 366 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %246 %268 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %246 "gl_FragCoord" + OpName %249 "buf0" + OpMemberName %249 0 "resolution" + OpName %251 "" + OpName %268 "_GLF_color" + OpDecorate %246 BuiltIn FragCoord + OpMemberDecorate %249 0 Offset 0 + OpDecorate %249 Block + OpDecorate %251 DescriptorSet 0 + OpDecorate %251 Binding 0 + OpDecorate %268 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %20 = OpTypeInt 32 0 + %22 = OpTypePointer Function %6 + %25 = OpConstant %6 256 + %26 = OpTypeBool + %28 = OpConstant %20 0 + %31 = OpConstant %20 256 + %32 = OpTypeArray %6 %31 + %33 = OpConstant %6 115 + %34 = OpConstant %6 133 + %35 = OpConstant %6 150 + %36 = OpConstant %6 164 + %37 = OpConstant %6 176 + %38 = OpConstant %6 184 + %39 = OpConstant %6 190 + %40 = OpConstant %6 192 + %41 = OpConstant %6 191 + %42 = OpConstant %6 187 + %43 = OpConstant %6 181 + %44 = OpConstant %6 172 + %45 = OpConstant %6 163 + %46 = OpConstant %6 153 + %47 = OpConstant %6 143 + %48 = OpConstant %6 134 + %49 = OpConstant %6 126 + %50 = OpConstant %6 120 + %51 = OpConstant %6 116 + %52 = OpConstant %6 114 + %53 = OpConstant %6 117 + %54 = OpConstant %6 121 + %55 = OpConstant %6 127 + %56 = OpConstant %6 141 + %57 = OpConstant %6 148 + %58 = OpConstant %6 154 + %59 = OpConstant %6 159 + %60 = OpConstant %6 162 + %61 = OpConstant %6 161 + %62 = OpConstant %6 157 + %63 = OpConstant %6 151 + %64 = OpConstant %6 124 + %65 = OpConstant %6 113 + %66 = OpConstant %6 103 + %67 = OpConstant %6 94 + %68 = OpConstant %6 87 + %69 = OpConstant %6 82 + %70 = OpConstant %6 79 + %71 = OpConstant %6 80 + %72 = OpConstant %6 84 + %73 = OpConstant %6 91 + %74 = OpConstant %6 101 + %75 = OpConstant %6 130 + %76 = OpConstant %6 146 + %77 = OpConstant %6 182 + %78 = OpConstant %6 199 + %79 = OpConstant %6 215 + %80 = OpConstant %6 229 + %81 = OpConstant %6 240 + %82 = OpConstant %6 249 + %83 = OpConstant %6 254 + %84 = OpConstant %6 250 + %85 = OpConstant %6 243 + %86 = OpConstant %6 233 + %87 = OpConstant %6 223 + %88 = OpConstant %6 212 + %89 = OpConstant %6 200 + %90 = OpConstant %6 180 + %91 = OpConstant %6 166 + %92 = OpConstant %6 169 + %93 = OpConstant %6 174 + %94 = OpConstant %6 179 + %95 = OpConstant %6 185 + %96 = OpConstant %6 193 + %97 = OpConstant %6 195 + %98 = OpConstant %6 188 + %99 = OpConstant %6 171 + %100 = OpConstant %6 149 + %101 = OpConstant %6 137 + %102 = OpConstant %6 125 + %103 = OpConstant %6 105 + %104 = OpConstant %6 97 + %105 = OpConstant %6 93 + %106 = OpConstant %6 98 + %107 = OpConstant %6 106 + %108 = OpConstant %6 145 + %109 = OpConstant %6 177 + %110 = OpConstant %6 208 + %111 = OpConstant %6 221 + %112 = OpConstant %6 231 + %113 = OpConstant %6 239 + %114 = OpConstant %6 244 + %115 = OpConstant %6 242 + %116 = OpConstant %6 236 + %117 = OpConstant %6 228 + %118 = OpConstant %6 218 + %119 = OpConstant %6 207 + %120 = OpConstant %6 194 + %121 = OpConstant %6 158 + %122 = OpConstant %6 135 + %123 = OpConstant %6 132 + %124 = OpConstant %6 131 + %125 = OpConstant %6 138 + %126 = OpConstant %6 147 + %127 = OpConstant %6 155 + %128 = OpConstant %6 152 + %129 = OpConstant %6 139 + %130 = OpConstant %6 129 + %131 = OpConstant %6 118 + %132 = OpConstant %6 68 + %133 = OpConstant %6 58 + %134 = OpConstant %6 49 + %135 = OpConstant %6 43 + %136 = OpConstant %6 40 + %137 = OpConstant %6 41 + %138 = OpConstant %6 44 + %139 = OpConstant %6 51 + %140 = OpConstant %6 61 + %141 = OpConstant %6 73 + %142 = OpConstant %6 119 + %143 = OpConstant %6 173 + %144 = OpConstant %6 186 + %145 = OpConstant %6 128 + %146 = OpConstant %6 104 + %147 = OpConstant %6 86 + %148 = OpConstant %6 81 + %149 = OpConstant %6 77 + %150 = OpConstant %6 76 + %151 = OpConstant %6 89 + %152 = OpConstant %6 102 + %153 = OpConstant %6 92 + %154 = OpConstant %6 83 + %155 = OpConstant %6 62 + %156 = OpConstant %6 50 + %157 = OpConstant %6 38 + %158 = OpConstant %6 26 + %159 = OpConstant %6 16 + %160 = OpConstant %6 8 + %161 = OpConstant %6 2 + %162 = OpConstant %6 0 + %163 = OpConstant %6 4 + %164 = OpConstant %6 11 + %165 = OpConstant %6 21 + %166 = OpConstant %6 33 + %167 = OpConstant %6 48 + %168 = OpConstant %6 64 + %169 = OpConstant %6 144 + %170 = OpConstant %6 123 + %171 = OpConstant %6 112 + %172 = OpConstant %6 100 + %173 = OpConstant %6 90 + %174 = OpConstant %6 65 + %175 = OpConstant %6 67 + %176 = OpConstant %6 70 + %177 = OpConstant %6 75 + %178 = OpConstant %6 95 + %179 = OpConstant %6 88 + %180 = OpConstant %6 69 + %181 = OpConstant %6 47 + %182 = OpConstant %6 36 + %183 = OpConstant %6 18 + %184 = OpConstant %6 13 + %185 = OpConstant %6 15 + %186 = OpConstant %6 22 + %187 = OpConstant %6 32 + %188 = OpConstant %6 45 + %189 = OpConstant %6 60 + %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67 + %193 = OpTypePointer Function %32 + %215 = OpConstant %9 15 + %231 = OpConstant %9 1 + %236 = OpConstant %6 1 + %238 = OpConstant %9 0 + %239 = OpConstantComposite %10 %238 %238 %238 %231 + %242 = OpTypeVector %9 2 + %245 = OpTypePointer Input %10 + %246 = OpVariable %245 Input + %249 = OpTypeStruct %242 + %250 = OpTypePointer Uniform %249 + %251 = OpVariable %250 Uniform + %252 = OpTypePointer Uniform %242 + %259 = OpConstant %9 256 + %267 = OpTypePointer Output %10 + %268 = OpVariable %267 Output + %277 = OpConstantFalse %26 + %280 = OpConstantTrue %26 + %363 = OpUndef %10 + %365 = OpConstant %9 0.0666666701 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %285 = OpVariable %193 Function + %286 = OpVariable %193 Function + %288 = OpVariable %193 Function + %247 = OpLoad %10 %246 + %248 = OpVectorShuffle %242 %247 %247 0 1 + %253 = OpAccessChain %252 %251 %162 + %254 = OpLoad %242 %253 + %255 = OpFDiv %242 %248 %254 + %258 = OpCompositeExtract %9 %255 0 + %260 = OpFMul %9 %258 %259 + %261 = OpConvertFToS %6 %260 + %263 = OpCompositeExtract %9 %255 1 + %264 = OpFMul %9 %263 %259 + %265 = OpConvertFToS %6 %264 + %266 = OpCompositeConstruct %7 %261 %265 + OpSelectionMerge %341 None + OpSwitch %28 %291 + %291 = OpLabel + OpBranch %292 + %292 = OpLabel + %355 = OpPhi %7 %266 %291 %354 %337 + %295 = OpCompositeExtract %6 %355 1 + %296 = OpINotEqual %26 %295 %25 + OpLoopMerge %338 %337 None + OpBranchConditional %296 %297 %338 + %297 = OpLabel + %299 = OpCompositeExtract %6 %355 0 + OpStore %285 %190 + %302 = OpAccessChain %22 %285 %295 + %303 = OpLoad %6 %302 + %304 = OpIAdd %6 %303 %185 + %305 = OpSLessThan %26 %299 %304 + OpSelectionMerge %315 None + OpBranchConditional %305 %306 %315 + %306 = OpLabel + OpStore %286 %190 + %311 = OpAccessChain %22 %286 %295 + %312 = OpLoad %6 %311 + %313 = OpISub %6 %312 %185 + %314 = OpSGreaterThan %26 %299 %313 + OpBranch %315 + %315 = OpLabel + %316 = OpPhi %26 %305 %297 %314 %306 + OpSelectionMerge %333 None + OpBranchConditional %316 %317 %333 + %317 = OpLabel + OpStore %288 %190 + %322 = OpAccessChain %22 %288 %295 + %323 = OpLoad %6 %322 + %324 = OpISub %6 %299 %323 + %325 = OpConvertSToF %9 %324 + %326 = OpExtInst %9 %1 FAbs %325 + %327 = OpFSub %9 %215 %326 + %328 = OpFMul %9 %327 %365 + %332 = OpCompositeConstruct %10 %328 %328 %328 %231 + OpBranch %338 + %333 = OpLabel + %336 = OpIAdd %6 %295 %236 + %354 = OpCompositeInsert %7 %336 %355 1 + OpBranch %337 + %337 = OpLabel + OpBranch %292 + %338 = OpLabel + %361 = OpPhi %10 %363 %292 %332 %317 + %357 = OpPhi %26 %277 %292 %280 %317 + OpSelectionMerge %340 None + OpBranchConditional %357 %341 %340 + %340 = OpLabel + OpBranch %341 + %341 = OpLabel + %360 = OpPhi %10 %361 %338 %239 %340 + OpStore %268 %360 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 32.0 16.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 32 16 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 32 16 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 534 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %246 %268 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %246 "gl_FragCoord" + OpName %249 "buf0" + OpMemberName %249 0 "resolution" + OpName %251 "" + OpName %268 "_GLF_color" + OpDecorate %246 BuiltIn FragCoord + OpMemberDecorate %249 0 Offset 0 + OpDecorate %249 Block + OpDecorate %251 DescriptorSet 0 + OpDecorate %251 Binding 0 + OpDecorate %268 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %20 = OpTypeInt 32 0 + %22 = OpTypePointer Function %6 + %25 = OpConstant %6 256 + %26 = OpTypeBool + %28 = OpConstant %20 0 + %31 = OpConstant %20 256 + %32 = OpTypeArray %6 %31 + %33 = OpConstant %6 115 + %34 = OpConstant %6 133 + %35 = OpConstant %6 150 + %36 = OpConstant %6 164 + %37 = OpConstant %6 176 + %38 = OpConstant %6 184 + %39 = OpConstant %6 190 + %40 = OpConstant %6 192 + %41 = OpConstant %6 191 + %42 = OpConstant %6 187 + %43 = OpConstant %6 181 + %44 = OpConstant %6 172 + %45 = OpConstant %6 163 + %46 = OpConstant %6 153 + %47 = OpConstant %6 143 + %48 = OpConstant %6 134 + %49 = OpConstant %6 126 + %50 = OpConstant %6 120 + %51 = OpConstant %6 116 + %52 = OpConstant %6 114 + %53 = OpConstant %6 117 + %54 = OpConstant %6 121 + %55 = OpConstant %6 127 + %56 = OpConstant %6 141 + %57 = OpConstant %6 148 + %58 = OpConstant %6 154 + %59 = OpConstant %6 159 + %60 = OpConstant %6 162 + %61 = OpConstant %6 161 + %62 = OpConstant %6 157 + %63 = OpConstant %6 151 + %64 = OpConstant %6 124 + %65 = OpConstant %6 113 + %66 = OpConstant %6 103 + %67 = OpConstant %6 94 + %68 = OpConstant %6 87 + %69 = OpConstant %6 82 + %70 = OpConstant %6 79 + %71 = OpConstant %6 80 + %72 = OpConstant %6 84 + %73 = OpConstant %6 91 + %74 = OpConstant %6 101 + %75 = OpConstant %6 130 + %76 = OpConstant %6 146 + %77 = OpConstant %6 182 + %78 = OpConstant %6 199 + %79 = OpConstant %6 215 + %80 = OpConstant %6 229 + %81 = OpConstant %6 240 + %82 = OpConstant %6 249 + %83 = OpConstant %6 254 + %84 = OpConstant %6 250 + %85 = OpConstant %6 243 + %86 = OpConstant %6 233 + %87 = OpConstant %6 223 + %88 = OpConstant %6 212 + %89 = OpConstant %6 200 + %90 = OpConstant %6 180 + %91 = OpConstant %6 166 + %92 = OpConstant %6 169 + %93 = OpConstant %6 174 + %94 = OpConstant %6 179 + %95 = OpConstant %6 185 + %96 = OpConstant %6 193 + %97 = OpConstant %6 195 + %98 = OpConstant %6 188 + %99 = OpConstant %6 171 + %100 = OpConstant %6 149 + %101 = OpConstant %6 137 + %102 = OpConstant %6 125 + %103 = OpConstant %6 105 + %104 = OpConstant %6 97 + %105 = OpConstant %6 93 + %106 = OpConstant %6 98 + %107 = OpConstant %6 106 + %108 = OpConstant %6 145 + %109 = OpConstant %6 177 + %110 = OpConstant %6 208 + %111 = OpConstant %6 221 + %112 = OpConstant %6 231 + %113 = OpConstant %6 239 + %114 = OpConstant %6 244 + %115 = OpConstant %6 242 + %116 = OpConstant %6 236 + %117 = OpConstant %6 228 + %118 = OpConstant %6 218 + %119 = OpConstant %6 207 + %120 = OpConstant %6 194 + %121 = OpConstant %6 158 + %122 = OpConstant %6 135 + %123 = OpConstant %6 132 + %124 = OpConstant %6 131 + %125 = OpConstant %6 138 + %126 = OpConstant %6 147 + %127 = OpConstant %6 155 + %128 = OpConstant %6 152 + %129 = OpConstant %6 139 + %130 = OpConstant %6 129 + %131 = OpConstant %6 118 + %132 = OpConstant %6 68 + %133 = OpConstant %6 58 + %134 = OpConstant %6 49 + %135 = OpConstant %6 43 + %136 = OpConstant %6 40 + %137 = OpConstant %6 41 + %138 = OpConstant %6 44 + %139 = OpConstant %6 51 + %140 = OpConstant %6 61 + %141 = OpConstant %6 73 + %142 = OpConstant %6 119 + %143 = OpConstant %6 173 + %144 = OpConstant %6 186 + %145 = OpConstant %6 128 + %146 = OpConstant %6 104 + %147 = OpConstant %6 86 + %148 = OpConstant %6 81 + %149 = OpConstant %6 77 + %150 = OpConstant %6 76 + %151 = OpConstant %6 89 + %152 = OpConstant %6 102 + %153 = OpConstant %6 92 + %154 = OpConstant %6 83 + %155 = OpConstant %6 62 + %156 = OpConstant %6 50 + %157 = OpConstant %6 38 + %158 = OpConstant %6 26 + %159 = OpConstant %6 16 + %160 = OpConstant %6 8 + %161 = OpConstant %6 2 + %162 = OpConstant %6 0 + %163 = OpConstant %6 4 + %164 = OpConstant %6 11 + %165 = OpConstant %6 21 + %166 = OpConstant %6 33 + %167 = OpConstant %6 48 + %168 = OpConstant %6 64 + %169 = OpConstant %6 144 + %170 = OpConstant %6 123 + %171 = OpConstant %6 112 + %172 = OpConstant %6 100 + %173 = OpConstant %6 90 + %174 = OpConstant %6 65 + %175 = OpConstant %6 67 + %176 = OpConstant %6 70 + %177 = OpConstant %6 75 + %178 = OpConstant %6 95 + %179 = OpConstant %6 88 + %180 = OpConstant %6 69 + %181 = OpConstant %6 47 + %182 = OpConstant %6 36 + %183 = OpConstant %6 18 + %184 = OpConstant %6 13 + %185 = OpConstant %6 15 + %186 = OpConstant %6 22 + %187 = OpConstant %6 32 + %188 = OpConstant %6 45 + %189 = OpConstant %6 60 + %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67 + %193 = OpTypePointer Function %32 + %215 = OpConstant %9 15 + %231 = OpConstant %9 1 + %236 = OpConstant %6 1 + %238 = OpConstant %9 0 + %239 = OpConstantComposite %10 %238 %238 %238 %231 + %242 = OpTypeVector %9 2 + %245 = OpTypePointer Input %10 + %246 = OpVariable %245 Input + %249 = OpTypeStruct %242 + %250 = OpTypePointer Uniform %249 + %251 = OpVariable %250 Uniform + %252 = OpTypePointer Uniform %242 + %259 = OpConstant %9 256 + %267 = OpTypePointer Output %10 + %268 = OpVariable %267 Output + %277 = OpConstantFalse %26 + %280 = OpConstantTrue %26 + %363 = OpUndef %10 + %365 = OpConstant %9 0.0666666701 + %523 = OpConstant %6 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %285 = OpVariable %193 Function + %286 = OpVariable %193 Function + %288 = OpVariable %193 Function + %247 = OpLoad %10 %246 + %248 = OpVectorShuffle %242 %247 %247 0 1 + %253 = OpAccessChain %252 %251 %162 + %254 = OpLoad %242 %253 + %255 = OpFDiv %242 %248 %254 + %258 = OpCompositeExtract %9 %255 0 + %260 = OpFMul %9 %258 %259 + %261 = OpConvertFToS %6 %260 + %263 = OpCompositeExtract %9 %255 1 + %264 = OpFMul %9 %263 %259 + %265 = OpConvertFToS %6 %264 + %266 = OpCompositeConstruct %7 %261 %265 + OpSelectionMerge %341 None + OpSwitch %28 %291 + %291 = OpLabel + OpBranch %292 + %292 = OpLabel + %355 = OpPhi %7 %266 %291 %354 %337 + %295 = OpCompositeExtract %6 %355 1 + %296 = OpINotEqual %26 %295 %25 + OpLoopMerge %338 %337 None + OpBranchConditional %296 %297 %338 + %297 = OpLabel + %299 = OpCompositeExtract %6 %355 0 + OpStore %285 %190 + %302 = OpAccessChain %22 %285 %295 + %303 = OpLoad %6 %302 + %304 = OpIAdd %6 %303 %185 + %305 = OpSLessThan %26 %299 %304 + OpBranch %306 + %306 = OpLabel + OpSelectionMerge %516 None + OpBranchConditional %305 %517 %516 + %517 = OpLabel + OpStore %286 %190 + OpBranch %516 + %516 = OpLabel + %311 = OpAccessChain %22 %286 %295 + OpSelectionMerge %518 None + OpBranchConditional %305 %519 %521 + %519 = OpLabel + %520 = OpLoad %6 %311 + OpBranch %518 + %521 = OpLabel + %522 = OpCopyObject %6 %523 + OpBranch %518 + %518 = OpLabel + %312 = OpPhi %6 %520 %519 %522 %521 + %313 = OpISub %6 %312 %185 + %314 = OpSGreaterThan %26 %299 %313 + OpSelectionMerge %315 None + OpBranchConditional %305 %532 %533 + %532 = OpLabel + OpBranch %315 + %533 = OpLabel + OpBranch %315 + %315 = OpLabel + %316 = OpPhi %26 %314 %532 %305 %533 + OpSelectionMerge %333 None + OpBranchConditional %316 %317 %333 + %317 = OpLabel + OpStore %288 %190 + %322 = OpAccessChain %22 %288 %295 + %323 = OpLoad %6 %322 + %324 = OpISub %6 %299 %323 + %325 = OpConvertSToF %9 %324 + %326 = OpExtInst %9 %1 FAbs %325 + %327 = OpFSub %9 %215 %326 + %328 = OpFMul %9 %327 %365 + %332 = OpCompositeConstruct %10 %328 %328 %328 %231 + OpBranch %338 + %333 = OpLabel + %336 = OpIAdd %6 %295 %236 + %354 = OpCompositeInsert %7 %336 %355 1 + OpBranch %337 + %337 = OpLabel + OpBranch %292 + %338 = OpLabel + %361 = OpPhi %10 %363 %292 %332 %317 + %357 = OpPhi %26 %277 %292 %280 %317 + OpSelectionMerge %340 None + OpBranchConditional %357 %341 %340 + %340 = OpLabel + OpBranch %341 + %341 = OpLabel + %360 = OpPhi %10 %361 %338 %239 %340 + OpStore %268 %360 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 32.0 16.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 16 + + +SHADER vertex variant_2_vertex_shader PASSTHROUGH + +SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 524 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %246 %268 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %246 "gl_FragCoord" + OpName %249 "buf0" + OpMemberName %249 0 "resolution" + OpName %251 "" + OpName %268 "_GLF_color" + OpDecorate %246 BuiltIn FragCoord + OpMemberDecorate %249 0 Offset 0 + OpDecorate %249 Block + OpDecorate %251 DescriptorSet 0 + OpDecorate %251 Binding 0 + OpDecorate %268 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %20 = OpTypeInt 32 0 + %22 = OpTypePointer Function %6 + %25 = OpConstant %6 256 + %26 = OpTypeBool + %28 = OpConstant %20 0 + %31 = OpConstant %20 256 + %32 = OpTypeArray %6 %31 + %33 = OpConstant %6 115 + %34 = OpConstant %6 133 + %35 = OpConstant %6 150 + %36 = OpConstant %6 164 + %37 = OpConstant %6 176 + %38 = OpConstant %6 184 + %39 = OpConstant %6 190 + %40 = OpConstant %6 192 + %41 = OpConstant %6 191 + %42 = OpConstant %6 187 + %43 = OpConstant %6 181 + %44 = OpConstant %6 172 + %45 = OpConstant %6 163 + %46 = OpConstant %6 153 + %47 = OpConstant %6 143 + %48 = OpConstant %6 134 + %49 = OpConstant %6 126 + %50 = OpConstant %6 120 + %51 = OpConstant %6 116 + %52 = OpConstant %6 114 + %53 = OpConstant %6 117 + %54 = OpConstant %6 121 + %55 = OpConstant %6 127 + %56 = OpConstant %6 141 + %57 = OpConstant %6 148 + %58 = OpConstant %6 154 + %59 = OpConstant %6 159 + %60 = OpConstant %6 162 + %61 = OpConstant %6 161 + %62 = OpConstant %6 157 + %63 = OpConstant %6 151 + %64 = OpConstant %6 124 + %65 = OpConstant %6 113 + %66 = OpConstant %6 103 + %67 = OpConstant %6 94 + %68 = OpConstant %6 87 + %69 = OpConstant %6 82 + %70 = OpConstant %6 79 + %71 = OpConstant %6 80 + %72 = OpConstant %6 84 + %73 = OpConstant %6 91 + %74 = OpConstant %6 101 + %75 = OpConstant %6 130 + %76 = OpConstant %6 146 + %77 = OpConstant %6 182 + %78 = OpConstant %6 199 + %79 = OpConstant %6 215 + %80 = OpConstant %6 229 + %81 = OpConstant %6 240 + %82 = OpConstant %6 249 + %83 = OpConstant %6 254 + %84 = OpConstant %6 250 + %85 = OpConstant %6 243 + %86 = OpConstant %6 233 + %87 = OpConstant %6 223 + %88 = OpConstant %6 212 + %89 = OpConstant %6 200 + %90 = OpConstant %6 180 + %91 = OpConstant %6 166 + %92 = OpConstant %6 169 + %93 = OpConstant %6 174 + %94 = OpConstant %6 179 + %95 = OpConstant %6 185 + %96 = OpConstant %6 193 + %97 = OpConstant %6 195 + %98 = OpConstant %6 188 + %99 = OpConstant %6 171 + %100 = OpConstant %6 149 + %101 = OpConstant %6 137 + %102 = OpConstant %6 125 + %103 = OpConstant %6 105 + %104 = OpConstant %6 97 + %105 = OpConstant %6 93 + %106 = OpConstant %6 98 + %107 = OpConstant %6 106 + %108 = OpConstant %6 145 + %109 = OpConstant %6 177 + %110 = OpConstant %6 208 + %111 = OpConstant %6 221 + %112 = OpConstant %6 231 + %113 = OpConstant %6 239 + %114 = OpConstant %6 244 + %115 = OpConstant %6 242 + %116 = OpConstant %6 236 + %117 = OpConstant %6 228 + %118 = OpConstant %6 218 + %119 = OpConstant %6 207 + %120 = OpConstant %6 194 + %121 = OpConstant %6 158 + %122 = OpConstant %6 135 + %123 = OpConstant %6 132 + %124 = OpConstant %6 131 + %125 = OpConstant %6 138 + %126 = OpConstant %6 147 + %127 = OpConstant %6 155 + %128 = OpConstant %6 152 + %129 = OpConstant %6 139 + %130 = OpConstant %6 129 + %131 = OpConstant %6 118 + %132 = OpConstant %6 68 + %133 = OpConstant %6 58 + %134 = OpConstant %6 49 + %135 = OpConstant %6 43 + %136 = OpConstant %6 40 + %137 = OpConstant %6 41 + %138 = OpConstant %6 44 + %139 = OpConstant %6 51 + %140 = OpConstant %6 61 + %141 = OpConstant %6 73 + %142 = OpConstant %6 119 + %143 = OpConstant %6 173 + %144 = OpConstant %6 186 + %145 = OpConstant %6 128 + %146 = OpConstant %6 104 + %147 = OpConstant %6 86 + %148 = OpConstant %6 81 + %149 = OpConstant %6 77 + %150 = OpConstant %6 76 + %151 = OpConstant %6 89 + %152 = OpConstant %6 102 + %153 = OpConstant %6 92 + %154 = OpConstant %6 83 + %155 = OpConstant %6 62 + %156 = OpConstant %6 50 + %157 = OpConstant %6 38 + %158 = OpConstant %6 26 + %159 = OpConstant %6 16 + %160 = OpConstant %6 8 + %161 = OpConstant %6 2 + %162 = OpConstant %6 0 + %163 = OpConstant %6 4 + %164 = OpConstant %6 11 + %165 = OpConstant %6 21 + %166 = OpConstant %6 33 + %167 = OpConstant %6 48 + %168 = OpConstant %6 64 + %169 = OpConstant %6 144 + %170 = OpConstant %6 123 + %171 = OpConstant %6 112 + %172 = OpConstant %6 100 + %173 = OpConstant %6 90 + %174 = OpConstant %6 65 + %175 = OpConstant %6 67 + %176 = OpConstant %6 70 + %177 = OpConstant %6 75 + %178 = OpConstant %6 95 + %179 = OpConstant %6 88 + %180 = OpConstant %6 69 + %181 = OpConstant %6 47 + %182 = OpConstant %6 36 + %183 = OpConstant %6 18 + %184 = OpConstant %6 13 + %185 = OpConstant %6 15 + %186 = OpConstant %6 22 + %187 = OpConstant %6 32 + %188 = OpConstant %6 45 + %189 = OpConstant %6 60 + %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67 + %193 = OpTypePointer Function %32 + %215 = OpConstant %9 15 + %231 = OpConstant %9 1 + %236 = OpConstant %6 1 + %238 = OpConstant %9 0 + %239 = OpConstantComposite %10 %238 %238 %238 %231 + %242 = OpTypeVector %9 2 + %245 = OpTypePointer Input %10 + %246 = OpVariable %245 Input + %249 = OpTypeStruct %242 + %250 = OpTypePointer Uniform %249 + %251 = OpVariable %250 Uniform + %252 = OpTypePointer Uniform %242 + %259 = OpConstant %9 256 + %267 = OpTypePointer Output %10 + %268 = OpVariable %267 Output + %277 = OpConstantFalse %26 + %280 = OpConstantTrue %26 + %363 = OpUndef %10 + %365 = OpConstant %9 0.0666666701 + %523 = OpConstant %6 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %285 = OpVariable %193 Function + %286 = OpVariable %193 Function + %288 = OpVariable %193 Function + %247 = OpLoad %10 %246 + %248 = OpVectorShuffle %242 %247 %247 0 1 + %253 = OpAccessChain %252 %251 %162 + %254 = OpLoad %242 %253 + %255 = OpFDiv %242 %248 %254 + %258 = OpCompositeExtract %9 %255 0 + %260 = OpFMul %9 %258 %259 + %261 = OpConvertFToS %6 %260 + %263 = OpCompositeExtract %9 %255 1 + %264 = OpFMul %9 %263 %259 + %265 = OpConvertFToS %6 %264 + %266 = OpCompositeConstruct %7 %261 %265 + OpSelectionMerge %341 None + OpSwitch %28 %291 + %291 = OpLabel + OpBranch %292 + %292 = OpLabel + %355 = OpPhi %7 %266 %291 %354 %337 + %295 = OpCompositeExtract %6 %355 1 + %296 = OpINotEqual %26 %295 %25 + OpLoopMerge %338 %337 None + OpBranchConditional %296 %297 %338 + %297 = OpLabel + %299 = OpCompositeExtract %6 %355 0 + OpStore %285 %190 + %302 = OpAccessChain %22 %285 %295 + %303 = OpLoad %6 %302 + %304 = OpIAdd %6 %303 %185 + %305 = OpSLessThan %26 %299 %304 + OpBranch %306 + %306 = OpLabel + OpSelectionMerge %516 None + OpBranchConditional %305 %517 %516 + %517 = OpLabel + OpStore %286 %190 + OpBranch %516 + %516 = OpLabel + %311 = OpAccessChain %22 %286 %295 + OpSelectionMerge %518 None + OpBranchConditional %305 %519 %521 + %519 = OpLabel + %520 = OpLoad %6 %311 + OpBranch %518 + %521 = OpLabel + %522 = OpCopyObject %6 %523 + OpBranch %518 + %518 = OpLabel + %312 = OpPhi %6 %520 %519 %522 %521 + %313 = OpISub %6 %312 %185 + %314 = OpSGreaterThan %26 %299 %313 + OpBranch %315 + %315 = OpLabel + %316 = OpSelect %26 %305 %314 %305 + OpSelectionMerge %333 None + OpBranchConditional %316 %317 %333 + %317 = OpLabel + OpStore %288 %190 + %322 = OpAccessChain %22 %288 %295 + %323 = OpLoad %6 %322 + %324 = OpISub %6 %299 %323 + %325 = OpConvertSToF %9 %324 + %326 = OpExtInst %9 %1 FAbs %325 + %327 = OpFSub %9 %215 %326 + %328 = OpFMul %9 %327 %365 + %332 = OpCompositeConstruct %10 %328 %328 %328 %231 + OpBranch %338 + %333 = OpLabel + %336 = OpIAdd %6 %295 %236 + %354 = OpCompositeInsert %7 %336 %355 1 + OpBranch %337 + %337 = OpLabel + OpBranch %292 + %338 = OpLabel + %361 = OpPhi %10 %363 %292 %332 %317 + %357 = OpPhi %26 %277 %292 %280 %317 + OpSelectionMerge %340 None + OpBranchConditional %357 %341 %340 + %340 = OpLabel + OpBranch %341 + %341 = OpLabel + %360 = OpPhi %10 %361 %338 %239 %340 + OpStore %268 %360 + OpReturn + OpFunctionEnd +END + +# uniforms for variant_2 + +# resolution +BUFFER variant_2_resolution DATA_TYPE vec2 STD140 DATA + 32.0 16.0 +END + +BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_2_pipeline + ATTACH variant_2_vertex_shader + ATTACH variant_2_fragment_shader + FRAMEBUFFER_SIZE 32 16 + BIND BUFFER variant_2_framebuffer AS color LOCATION 0 + BIND BUFFER variant_2_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_2_pipeline 0 0 0 255 + +CLEAR variant_2_pipeline +RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 32 16 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store.amber b/vulkan/amber/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store.amber new file mode 100644 index 0000000..4f6b53d --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store.amber @@ -0,0 +1,733 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with additional memory usage + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 272 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %246 %268 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %13 "trace(vi2;" + OpName %12 "pos" + OpName %194 "indexable" + OpName %205 "indexable" + OpName %214 "p" + OpName %220 "indexable" + OpName %244 "pos" + OpName %246 "gl_FragCoord" + OpName %249 "buf0" + OpMemberName %249 0 "resolution" + OpName %251 "" + OpName %256 "ipos" + OpName %268 "_GLF_color" + OpName %269 "param" + OpDecorate %246 BuiltIn FragCoord + OpMemberDecorate %249 0 Offset 0 + OpDecorate %249 Block + OpDecorate %251 DescriptorSet 0 + OpDecorate %251 Binding 0 + OpDecorate %268 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypeFunction %10 %8 + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 1 + %22 = OpTypePointer Function %6 + %25 = OpConstant %6 256 + %26 = OpTypeBool + %28 = OpConstant %20 0 + %31 = OpConstant %20 256 + %32 = OpTypeArray %6 %31 + %33 = OpConstant %6 115 + %34 = OpConstant %6 133 + %35 = OpConstant %6 150 + %36 = OpConstant %6 164 + %37 = OpConstant %6 176 + %38 = OpConstant %6 184 + %39 = OpConstant %6 190 + %40 = OpConstant %6 192 + %41 = OpConstant %6 191 + %42 = OpConstant %6 187 + %43 = OpConstant %6 181 + %44 = OpConstant %6 172 + %45 = OpConstant %6 163 + %46 = OpConstant %6 153 + %47 = OpConstant %6 143 + %48 = OpConstant %6 134 + %49 = OpConstant %6 126 + %50 = OpConstant %6 120 + %51 = OpConstant %6 116 + %52 = OpConstant %6 114 + %53 = OpConstant %6 117 + %54 = OpConstant %6 121 + %55 = OpConstant %6 127 + %56 = OpConstant %6 141 + %57 = OpConstant %6 148 + %58 = OpConstant %6 154 + %59 = OpConstant %6 159 + %60 = OpConstant %6 162 + %61 = OpConstant %6 161 + %62 = OpConstant %6 157 + %63 = OpConstant %6 151 + %64 = OpConstant %6 124 + %65 = OpConstant %6 113 + %66 = OpConstant %6 103 + %67 = OpConstant %6 94 + %68 = OpConstant %6 87 + %69 = OpConstant %6 82 + %70 = OpConstant %6 79 + %71 = OpConstant %6 80 + %72 = OpConstant %6 84 + %73 = OpConstant %6 91 + %74 = OpConstant %6 101 + %75 = OpConstant %6 130 + %76 = OpConstant %6 146 + %77 = OpConstant %6 182 + %78 = OpConstant %6 199 + %79 = OpConstant %6 215 + %80 = OpConstant %6 229 + %81 = OpConstant %6 240 + %82 = OpConstant %6 249 + %83 = OpConstant %6 254 + %84 = OpConstant %6 250 + %85 = OpConstant %6 243 + %86 = OpConstant %6 233 + %87 = OpConstant %6 223 + %88 = OpConstant %6 212 + %89 = OpConstant %6 200 + %90 = OpConstant %6 180 + %91 = OpConstant %6 166 + %92 = OpConstant %6 169 + %93 = OpConstant %6 174 + %94 = OpConstant %6 179 + %95 = OpConstant %6 185 + %96 = OpConstant %6 193 + %97 = OpConstant %6 195 + %98 = OpConstant %6 188 + %99 = OpConstant %6 171 + %100 = OpConstant %6 149 + %101 = OpConstant %6 137 + %102 = OpConstant %6 125 + %103 = OpConstant %6 105 + %104 = OpConstant %6 97 + %105 = OpConstant %6 93 + %106 = OpConstant %6 98 + %107 = OpConstant %6 106 + %108 = OpConstant %6 145 + %109 = OpConstant %6 177 + %110 = OpConstant %6 208 + %111 = OpConstant %6 221 + %112 = OpConstant %6 231 + %113 = OpConstant %6 239 + %114 = OpConstant %6 244 + %115 = OpConstant %6 242 + %116 = OpConstant %6 236 + %117 = OpConstant %6 228 + %118 = OpConstant %6 218 + %119 = OpConstant %6 207 + %120 = OpConstant %6 194 + %121 = OpConstant %6 158 + %122 = OpConstant %6 135 + %123 = OpConstant %6 132 + %124 = OpConstant %6 131 + %125 = OpConstant %6 138 + %126 = OpConstant %6 147 + %127 = OpConstant %6 155 + %128 = OpConstant %6 152 + %129 = OpConstant %6 139 + %130 = OpConstant %6 129 + %131 = OpConstant %6 118 + %132 = OpConstant %6 68 + %133 = OpConstant %6 58 + %134 = OpConstant %6 49 + %135 = OpConstant %6 43 + %136 = OpConstant %6 40 + %137 = OpConstant %6 41 + %138 = OpConstant %6 44 + %139 = OpConstant %6 51 + %140 = OpConstant %6 61 + %141 = OpConstant %6 73 + %142 = OpConstant %6 119 + %143 = OpConstant %6 173 + %144 = OpConstant %6 186 + %145 = OpConstant %6 128 + %146 = OpConstant %6 104 + %147 = OpConstant %6 86 + %148 = OpConstant %6 81 + %149 = OpConstant %6 77 + %150 = OpConstant %6 76 + %151 = OpConstant %6 89 + %152 = OpConstant %6 102 + %153 = OpConstant %6 92 + %154 = OpConstant %6 83 + %155 = OpConstant %6 62 + %156 = OpConstant %6 50 + %157 = OpConstant %6 38 + %158 = OpConstant %6 26 + %159 = OpConstant %6 16 + %160 = OpConstant %6 8 + %161 = OpConstant %6 2 + %162 = OpConstant %6 0 + %163 = OpConstant %6 4 + %164 = OpConstant %6 11 + %165 = OpConstant %6 21 + %166 = OpConstant %6 33 + %167 = OpConstant %6 48 + %168 = OpConstant %6 64 + %169 = OpConstant %6 144 + %170 = OpConstant %6 123 + %171 = OpConstant %6 112 + %172 = OpConstant %6 100 + %173 = OpConstant %6 90 + %174 = OpConstant %6 65 + %175 = OpConstant %6 67 + %176 = OpConstant %6 70 + %177 = OpConstant %6 75 + %178 = OpConstant %6 95 + %179 = OpConstant %6 88 + %180 = OpConstant %6 69 + %181 = OpConstant %6 47 + %182 = OpConstant %6 36 + %183 = OpConstant %6 18 + %184 = OpConstant %6 13 + %185 = OpConstant %6 15 + %186 = OpConstant %6 22 + %187 = OpConstant %6 32 + %188 = OpConstant %6 45 + %189 = OpConstant %6 60 + %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67 + %193 = OpTypePointer Function %32 + %213 = OpTypePointer Function %9 + %215 = OpConstant %9 15 + %231 = OpConstant %9 1 + %236 = OpConstant %6 1 + %238 = OpConstant %9 0 + %239 = OpConstantComposite %10 %238 %238 %238 %231 + %242 = OpTypeVector %9 2 + %243 = OpTypePointer Function %242 + %245 = OpTypePointer Input %10 + %246 = OpVariable %245 Input + %249 = OpTypeStruct %242 + %250 = OpTypePointer Uniform %249 + %251 = OpVariable %250 Uniform + %252 = OpTypePointer Uniform %242 + %259 = OpConstant %9 256 + %267 = OpTypePointer Output %10 + %268 = OpVariable %267 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %244 = OpVariable %243 Function + %256 = OpVariable %8 Function + %269 = OpVariable %8 Function + %247 = OpLoad %10 %246 + %248 = OpVectorShuffle %242 %247 %247 0 1 + %253 = OpAccessChain %252 %251 %162 + %254 = OpLoad %242 %253 + %255 = OpFDiv %242 %248 %254 + OpStore %244 %255 + %257 = OpAccessChain %213 %244 %28 + %258 = OpLoad %9 %257 + %260 = OpFMul %9 %258 %259 + %261 = OpConvertFToS %6 %260 + %262 = OpAccessChain %213 %244 %21 + %263 = OpLoad %9 %262 + %264 = OpFMul %9 %263 %259 + %265 = OpConvertFToS %6 %264 + %266 = OpCompositeConstruct %7 %261 %265 + OpStore %256 %266 + %270 = OpLoad %7 %256 + OpStore %269 %270 + %271 = OpFunctionCall %10 %13 %269 + OpStore %268 %271 + OpReturn + OpFunctionEnd + %13 = OpFunction %10 None %11 + %12 = OpFunctionParameter %8 + %14 = OpLabel + %194 = OpVariable %193 Function + %205 = OpVariable %193 Function + %214 = OpVariable %213 Function + %220 = OpVariable %193 Function + OpBranch %15 + %15 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %23 = OpAccessChain %22 %12 %21 + %24 = OpLoad %6 %23 + %27 = OpINotEqual %26 %24 %25 + OpBranchConditional %27 %16 %17 + %16 = OpLabel + %29 = OpAccessChain %22 %12 %28 + %30 = OpLoad %6 %29 + %191 = OpAccessChain %22 %12 %21 + %192 = OpLoad %6 %191 + OpStore %194 %190 + %195 = OpAccessChain %22 %194 %192 + %196 = OpLoad %6 %195 + %197 = OpIAdd %6 %196 %185 + %198 = OpSLessThan %26 %30 %197 + OpSelectionMerge %200 None + OpBranchConditional %198 %199 %200 + %199 = OpLabel + %201 = OpAccessChain %22 %12 %28 + %202 = OpLoad %6 %201 + %203 = OpAccessChain %22 %12 %21 + %204 = OpLoad %6 %203 + OpStore %205 %190 + %206 = OpAccessChain %22 %205 %204 + %207 = OpLoad %6 %206 + %208 = OpISub %6 %207 %185 + %209 = OpSGreaterThan %26 %202 %208 + OpBranch %200 + %200 = OpLabel + %210 = OpPhi %26 %198 %16 %209 %199 + OpSelectionMerge %212 None + OpBranchConditional %210 %211 %212 + %211 = OpLabel + %216 = OpAccessChain %22 %12 %28 + %217 = OpLoad %6 %216 + %218 = OpAccessChain %22 %12 %21 + %219 = OpLoad %6 %218 + OpStore %220 %190 + %221 = OpAccessChain %22 %220 %219 + %222 = OpLoad %6 %221 + %223 = OpISub %6 %217 %222 + %224 = OpConvertSToF %9 %223 + %225 = OpExtInst %9 %1 FAbs %224 + %226 = OpFSub %9 %215 %225 + %227 = OpFDiv %9 %226 %215 + OpStore %214 %227 + %228 = OpLoad %9 %214 + %229 = OpLoad %9 %214 + %230 = OpLoad %9 %214 + %232 = OpCompositeConstruct %10 %228 %229 %230 %231 + OpReturnValue %232 + %212 = OpLabel + %234 = OpAccessChain %22 %12 %21 + %235 = OpLoad %6 %234 + %237 = OpIAdd %6 %235 %236 + OpStore %234 %237 + OpBranch %18 + %18 = OpLabel + OpBranch %15 + %17 = OpLabel + OpReturnValue %239 + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 32.0 16.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 32 16 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 32 16 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 472 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %246 %268 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %13 "trace(vi2;" + OpName %12 "pos" + OpName %194 "indexable" + OpName %205 "indexable" + OpName %214 "p" + OpName %220 "indexable" + OpName %244 "pos" + OpName %246 "gl_FragCoord" + OpName %249 "buf0" + OpMemberName %249 0 "resolution" + OpName %251 "" + OpName %256 "ipos" + OpName %268 "_GLF_color" + OpName %269 "param" + OpDecorate %246 BuiltIn FragCoord + OpMemberDecorate %249 0 Offset 0 + OpDecorate %249 Block + OpDecorate %251 DescriptorSet 0 + OpDecorate %251 Binding 0 + OpDecorate %268 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypeFunction %10 %8 + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 1 + %22 = OpTypePointer Function %6 + %25 = OpConstant %6 256 + %26 = OpTypeBool + %28 = OpConstant %20 0 + %31 = OpConstant %20 256 + %32 = OpTypeArray %6 %31 + %33 = OpConstant %6 115 + %34 = OpConstant %6 133 + %35 = OpConstant %6 150 + %36 = OpConstant %6 164 + %37 = OpConstant %6 176 + %38 = OpConstant %6 184 + %39 = OpConstant %6 190 + %40 = OpConstant %6 192 + %41 = OpConstant %6 191 + %42 = OpConstant %6 187 + %43 = OpConstant %6 181 + %44 = OpConstant %6 172 + %45 = OpConstant %6 163 + %46 = OpConstant %6 153 + %47 = OpConstant %6 143 + %48 = OpConstant %6 134 + %49 = OpConstant %6 126 + %50 = OpConstant %6 120 + %51 = OpConstant %6 116 + %52 = OpConstant %6 114 + %53 = OpConstant %6 117 + %54 = OpConstant %6 121 + %55 = OpConstant %6 127 + %56 = OpConstant %6 141 + %57 = OpConstant %6 148 + %58 = OpConstant %6 154 + %59 = OpConstant %6 159 + %60 = OpConstant %6 162 + %61 = OpConstant %6 161 + %62 = OpConstant %6 157 + %63 = OpConstant %6 151 + %64 = OpConstant %6 124 + %65 = OpConstant %6 113 + %66 = OpConstant %6 103 + %67 = OpConstant %6 94 + %68 = OpConstant %6 87 + %69 = OpConstant %6 82 + %70 = OpConstant %6 79 + %71 = OpConstant %6 80 + %72 = OpConstant %6 84 + %73 = OpConstant %6 91 + %74 = OpConstant %6 101 + %75 = OpConstant %6 130 + %76 = OpConstant %6 146 + %77 = OpConstant %6 182 + %78 = OpConstant %6 199 + %79 = OpConstant %6 215 + %80 = OpConstant %6 229 + %81 = OpConstant %6 240 + %82 = OpConstant %6 249 + %83 = OpConstant %6 254 + %84 = OpConstant %6 250 + %85 = OpConstant %6 243 + %86 = OpConstant %6 233 + %87 = OpConstant %6 223 + %88 = OpConstant %6 212 + %89 = OpConstant %6 200 + %90 = OpConstant %6 180 + %91 = OpConstant %6 166 + %92 = OpConstant %6 169 + %93 = OpConstant %6 174 + %94 = OpConstant %6 179 + %95 = OpConstant %6 185 + %96 = OpConstant %6 193 + %97 = OpConstant %6 195 + %98 = OpConstant %6 188 + %99 = OpConstant %6 171 + %100 = OpConstant %6 149 + %101 = OpConstant %6 137 + %102 = OpConstant %6 125 + %103 = OpConstant %6 105 + %104 = OpConstant %6 97 + %105 = OpConstant %6 93 + %106 = OpConstant %6 98 + %107 = OpConstant %6 106 + %108 = OpConstant %6 145 + %109 = OpConstant %6 177 + %110 = OpConstant %6 208 + %111 = OpConstant %6 221 + %112 = OpConstant %6 231 + %113 = OpConstant %6 239 + %114 = OpConstant %6 244 + %115 = OpConstant %6 242 + %116 = OpConstant %6 236 + %117 = OpConstant %6 228 + %118 = OpConstant %6 218 + %119 = OpConstant %6 207 + %120 = OpConstant %6 194 + %121 = OpConstant %6 158 + %122 = OpConstant %6 135 + %123 = OpConstant %6 132 + %124 = OpConstant %6 131 + %125 = OpConstant %6 138 + %126 = OpConstant %6 147 + %127 = OpConstant %6 155 + %128 = OpConstant %6 152 + %129 = OpConstant %6 139 + %130 = OpConstant %6 129 + %131 = OpConstant %6 118 + %132 = OpConstant %6 68 + %133 = OpConstant %6 58 + %134 = OpConstant %6 49 + %135 = OpConstant %6 43 + %136 = OpConstant %6 40 + %137 = OpConstant %6 41 + %138 = OpConstant %6 44 + %139 = OpConstant %6 51 + %140 = OpConstant %6 61 + %141 = OpConstant %6 73 + %142 = OpConstant %6 119 + %143 = OpConstant %6 173 + %144 = OpConstant %6 186 + %145 = OpConstant %6 128 + %146 = OpConstant %6 104 + %147 = OpConstant %6 86 + %148 = OpConstant %6 81 + %149 = OpConstant %6 77 + %150 = OpConstant %6 76 + %151 = OpConstant %6 89 + %152 = OpConstant %6 102 + %153 = OpConstant %6 92 + %154 = OpConstant %6 83 + %155 = OpConstant %6 62 + %156 = OpConstant %6 50 + %157 = OpConstant %6 38 + %158 = OpConstant %6 26 + %159 = OpConstant %6 16 + %160 = OpConstant %6 8 + %161 = OpConstant %6 2 + %162 = OpConstant %6 0 + %163 = OpConstant %6 4 + %164 = OpConstant %6 11 + %165 = OpConstant %6 21 + %166 = OpConstant %6 33 + %167 = OpConstant %6 48 + %168 = OpConstant %6 64 + %169 = OpConstant %6 144 + %170 = OpConstant %6 123 + %171 = OpConstant %6 112 + %172 = OpConstant %6 100 + %173 = OpConstant %6 90 + %174 = OpConstant %6 65 + %175 = OpConstant %6 67 + %176 = OpConstant %6 70 + %177 = OpConstant %6 75 + %178 = OpConstant %6 95 + %179 = OpConstant %6 88 + %180 = OpConstant %6 69 + %181 = OpConstant %6 47 + %182 = OpConstant %6 36 + %183 = OpConstant %6 18 + %184 = OpConstant %6 13 + %185 = OpConstant %6 15 + %186 = OpConstant %6 22 + %187 = OpConstant %6 32 + %188 = OpConstant %6 45 + %189 = OpConstant %6 60 + %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67 + %193 = OpTypePointer Function %32 + %213 = OpTypePointer Function %9 + %215 = OpConstant %9 15 + %231 = OpConstant %9 1 + %236 = OpConstant %6 1 + %238 = OpConstant %9 0 + %239 = OpConstantComposite %10 %238 %238 %238 %231 + %242 = OpTypeVector %9 2 + %243 = OpTypePointer Function %242 + %245 = OpTypePointer Input %10 + %246 = OpVariable %245 Input + %249 = OpTypeStruct %242 + %250 = OpTypePointer Uniform %249 + %251 = OpVariable %250 Uniform + %252 = OpTypePointer Uniform %242 + %259 = OpConstant %9 256 + %267 = OpTypePointer Output %10 + %268 = OpVariable %267 Output + %372 = OpConstant %6 0 + %391 = OpConstantComposite %32 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 %372 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %244 = OpVariable %243 Function + %256 = OpVariable %8 Function + %269 = OpVariable %8 Function + %247 = OpLoad %10 %246 + %248 = OpVectorShuffle %242 %247 %247 0 1 + %253 = OpAccessChain %252 %251 %162 + %254 = OpLoad %242 %253 + %255 = OpFDiv %242 %248 %254 + OpStore %244 %255 + %257 = OpAccessChain %213 %244 %28 + %258 = OpLoad %9 %257 + %260 = OpFMul %9 %258 %259 + %261 = OpConvertFToS %6 %260 + %262 = OpAccessChain %213 %244 %21 + %263 = OpLoad %9 %262 + %264 = OpFMul %9 %263 %259 + %265 = OpConvertFToS %6 %264 + %266 = OpCompositeConstruct %7 %261 %265 + OpStore %256 %266 + %270 = OpLoad %7 %256 + OpStore %269 %270 + %271 = OpFunctionCall %10 %13 %269 + OpStore %268 %271 + OpReturn + OpFunctionEnd + %13 = OpFunction %10 None %11 + %12 = OpFunctionParameter %8 + %14 = OpLabel + %194 = OpVariable %193 Function + %205 = OpVariable %193 Function + %214 = OpVariable %213 Function + %220 = OpVariable %193 Function + OpBranch %15 + %15 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %23 = OpAccessChain %22 %12 %21 + %24 = OpLoad %6 %23 + %27 = OpINotEqual %26 %24 %25 + OpBranchConditional %27 %16 %17 + %16 = OpLabel + %29 = OpAccessChain %22 %12 %28 + %30 = OpLoad %6 %29 + %191 = OpAccessChain %22 %12 %21 + %192 = OpLoad %6 %191 + OpStore %194 %190 + %195 = OpAccessChain %22 %194 %192 + %196 = OpLoad %6 %195 + %397 = OpLoad %32 %194 + OpStore %194 %391 + %471 = OpLoad %6 %23 + OpStore %23 %372 + OpStore %23 %471 + OpStore %194 %397 Volatile|Nontemporal + %197 = OpIAdd %6 %196 %185 + %198 = OpSLessThan %26 %30 %197 + OpSelectionMerge %200 None + OpBranchConditional %198 %199 %200 + %199 = OpLabel + %201 = OpAccessChain %22 %12 %28 + %202 = OpLoad %6 %201 + %203 = OpAccessChain %22 %12 %21 + %204 = OpLoad %6 %203 + OpStore %205 %190 + %206 = OpAccessChain %22 %205 %204 + %207 = OpLoad %6 %206 + %208 = OpISub %6 %207 %185 + %209 = OpSGreaterThan %26 %202 %208 + OpBranch %200 + %200 = OpLabel + %210 = OpPhi %26 %198 %16 %209 %199 + OpSelectionMerge %212 None + OpBranchConditional %210 %211 %212 + %211 = OpLabel + %216 = OpAccessChain %22 %12 %28 + %217 = OpLoad %6 %216 + %218 = OpAccessChain %22 %12 %21 + %219 = OpLoad %6 %218 + OpStore %220 %190 + %221 = OpAccessChain %22 %220 %219 + %222 = OpLoad %6 %221 + %223 = OpISub %6 %217 %222 + %224 = OpConvertSToF %9 %223 + %225 = OpExtInst %9 %1 FAbs %224 + %226 = OpFSub %9 %215 %225 + %227 = OpFDiv %9 %226 %215 + OpStore %214 %227 + %228 = OpLoad %9 %214 + %229 = OpLoad %9 %214 + %230 = OpLoad %9 %214 + %232 = OpCompositeConstruct %10 %228 %229 %230 %231 + OpReturnValue %232 + %212 = OpLabel + %234 = OpAccessChain %22 %12 %21 + %235 = OpLoad %6 %234 + %237 = OpIAdd %6 %235 %236 + OpStore %234 %237 + OpBranch %18 + %18 = OpLabel + OpBranch %15 + %17 = OpLabel + OpReturnValue %239 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 32.0 16.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 32 16 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 16 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-quicksort-dontinline.amber b/vulkan/amber/graphicsfuzz/spv-stable-quicksort-dontinline.amber new file mode 100644 index 0000000..35e66d5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-quicksort-dontinline.amber @@ -0,0 +1,1049 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with DontInline attribute + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 331 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %183 %324 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "swap(i1;i1;" + OpName %9 "i" + OpName %10 "j" + OpName %16 "performPartition(i1;i1;" + OpName %14 "l" + OpName %15 "h" + OpName %18 "quicksort(" + OpName %20 "temp" + OpName %24 "QuicksortObject" + OpMemberName %24 0 "numbers" + OpName %26 "obj" + OpName %40 "pivot" + OpName %44 "i" + OpName %48 "j" + OpName %69 "param" + OpName %71 "param" + OpName %78 "param" + OpName %80 "param" + OpName %86 "l" + OpName %87 "h" + OpName %89 "top" + OpName %92 "stack" + OpName %116 "p" + OpName %117 "param" + OpName %119 "param" + OpName %152 "i" + OpName %180 "uv" + OpName %183 "gl_FragCoord" + OpName %186 "buf0" + OpMemberName %186 0 "resolution" + OpName %188 "" + OpName %195 "color" + OpName %324 "_GLF_color" + OpDecorate %183 BuiltIn FragCoord + OpMemberDecorate %186 0 Offset 0 + OpDecorate %186 Block + OpDecorate %188 DescriptorSet 0 + OpDecorate %188 Binding 0 + OpDecorate %324 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeFunction %6 %7 %7 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 0 + %29 = OpTypePointer Private %6 + %46 = OpConstant %6 1 + %58 = OpTypeBool + %88 = OpConstant %6 9 + %90 = OpConstant %6 -1 + %91 = OpTypePointer Function %23 + %159 = OpConstant %6 10 + %177 = OpTypeFloat 32 + %178 = OpTypeVector %177 2 + %179 = OpTypePointer Function %178 + %181 = OpTypeVector %177 4 + %182 = OpTypePointer Input %181 + %183 = OpVariable %182 Input + %186 = OpTypeStruct %178 + %187 = OpTypePointer Uniform %186 + %188 = OpVariable %187 Uniform + %189 = OpTypePointer Uniform %178 + %193 = OpTypeVector %177 3 + %194 = OpTypePointer Function %193 + %196 = OpConstant %177 1 + %197 = OpConstant %177 2 + %198 = OpConstant %177 3 + %199 = OpConstantComposite %193 %196 %197 %198 + %203 = OpConstant %21 0 + %204 = OpTypePointer Function %177 + %211 = OpConstant %177 0.25 + %224 = OpConstant %177 0.5 + %228 = OpConstant %6 2 + %232 = OpConstant %21 1 + %239 = OpConstant %177 0.75 + %243 = OpConstant %6 3 + %247 = OpConstant %21 2 + %252 = OpConstant %6 4 + %265 = OpConstant %6 5 + %278 = OpConstant %6 6 + %291 = OpConstant %6 7 + %299 = OpConstant %6 8 + %323 = OpTypePointer Output %181 + %324 = OpVariable %323 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %152 = OpVariable %7 Function + %180 = OpVariable %179 Function + %195 = OpVariable %194 Function + OpStore %152 %27 + OpBranch %153 + %153 = OpLabel + OpLoopMerge %155 %156 None + OpBranch %157 + %157 = OpLabel + %158 = OpLoad %6 %152 + %160 = OpSLessThan %58 %158 %159 + OpBranchConditional %160 %154 %155 + %154 = OpLabel + %161 = OpLoad %6 %152 + %162 = OpLoad %6 %152 + %163 = OpISub %6 %159 %162 + %164 = OpAccessChain %29 %26 %27 %161 + OpStore %164 %163 + %165 = OpLoad %6 %152 + %166 = OpLoad %6 %152 + %167 = OpAccessChain %29 %26 %27 %166 + %168 = OpLoad %6 %167 + %169 = OpLoad %6 %152 + %170 = OpAccessChain %29 %26 %27 %169 + %171 = OpLoad %6 %170 + %172 = OpIMul %6 %168 %171 + %173 = OpAccessChain %29 %26 %27 %165 + OpStore %173 %172 + OpBranch %156 + %156 = OpLabel + %174 = OpLoad %6 %152 + %175 = OpIAdd %6 %174 %46 + OpStore %152 %175 + OpBranch %153 + %155 = OpLabel + %176 = OpFunctionCall %2 %18 + %184 = OpLoad %181 %183 + %185 = OpVectorShuffle %178 %184 %184 0 1 + %190 = OpAccessChain %189 %188 %27 + %191 = OpLoad %178 %190 + %192 = OpFDiv %178 %185 %191 + OpStore %180 %192 + OpStore %195 %199 + %200 = OpAccessChain %29 %26 %27 %27 + %201 = OpLoad %6 %200 + %202 = OpConvertSToF %177 %201 + %205 = OpAccessChain %204 %195 %203 + %206 = OpLoad %177 %205 + %207 = OpFAdd %177 %206 %202 + %208 = OpAccessChain %204 %195 %203 + OpStore %208 %207 + %209 = OpAccessChain %204 %180 %203 + %210 = OpLoad %177 %209 + %212 = OpFOrdGreaterThan %58 %210 %211 + OpSelectionMerge %214 None + OpBranchConditional %212 %213 %214 + %213 = OpLabel + %215 = OpAccessChain %29 %26 %27 %46 + %216 = OpLoad %6 %215 + %217 = OpConvertSToF %177 %216 + %218 = OpAccessChain %204 %195 %203 + %219 = OpLoad %177 %218 + %220 = OpFAdd %177 %219 %217 + %221 = OpAccessChain %204 %195 %203 + OpStore %221 %220 + OpBranch %214 + %214 = OpLabel + %222 = OpAccessChain %204 %180 %203 + %223 = OpLoad %177 %222 + %225 = OpFOrdGreaterThan %58 %223 %224 + OpSelectionMerge %227 None + OpBranchConditional %225 %226 %227 + %226 = OpLabel + %229 = OpAccessChain %29 %26 %27 %228 + %230 = OpLoad %6 %229 + %231 = OpConvertSToF %177 %230 + %233 = OpAccessChain %204 %195 %232 + %234 = OpLoad %177 %233 + %235 = OpFAdd %177 %234 %231 + %236 = OpAccessChain %204 %195 %232 + OpStore %236 %235 + OpBranch %227 + %227 = OpLabel + %237 = OpAccessChain %204 %180 %203 + %238 = OpLoad %177 %237 + %240 = OpFOrdGreaterThan %58 %238 %239 + OpSelectionMerge %242 None + OpBranchConditional %240 %241 %242 + %241 = OpLabel + %244 = OpAccessChain %29 %26 %27 %243 + %245 = OpLoad %6 %244 + %246 = OpConvertSToF %177 %245 + %248 = OpAccessChain %204 %195 %247 + %249 = OpLoad %177 %248 + %250 = OpFAdd %177 %249 %246 + %251 = OpAccessChain %204 %195 %247 + OpStore %251 %250 + OpBranch %242 + %242 = OpLabel + %253 = OpAccessChain %29 %26 %27 %252 + %254 = OpLoad %6 %253 + %255 = OpConvertSToF %177 %254 + %256 = OpAccessChain %204 %195 %232 + %257 = OpLoad %177 %256 + %258 = OpFAdd %177 %257 %255 + %259 = OpAccessChain %204 %195 %232 + OpStore %259 %258 + %260 = OpAccessChain %204 %180 %232 + %261 = OpLoad %177 %260 + %262 = OpFOrdGreaterThan %58 %261 %211 + OpSelectionMerge %264 None + OpBranchConditional %262 %263 %264 + %263 = OpLabel + %266 = OpAccessChain %29 %26 %27 %265 + %267 = OpLoad %6 %266 + %268 = OpConvertSToF %177 %267 + %269 = OpAccessChain %204 %195 %203 + %270 = OpLoad %177 %269 + %271 = OpFAdd %177 %270 %268 + %272 = OpAccessChain %204 %195 %203 + OpStore %272 %271 + OpBranch %264 + %264 = OpLabel + %273 = OpAccessChain %204 %180 %232 + %274 = OpLoad %177 %273 + %275 = OpFOrdGreaterThan %58 %274 %224 + OpSelectionMerge %277 None + OpBranchConditional %275 %276 %277 + %276 = OpLabel + %279 = OpAccessChain %29 %26 %27 %278 + %280 = OpLoad %6 %279 + %281 = OpConvertSToF %177 %280 + %282 = OpAccessChain %204 %195 %232 + %283 = OpLoad %177 %282 + %284 = OpFAdd %177 %283 %281 + %285 = OpAccessChain %204 %195 %232 + OpStore %285 %284 + OpBranch %277 + %277 = OpLabel + %286 = OpAccessChain %204 %180 %232 + %287 = OpLoad %177 %286 + %288 = OpFOrdGreaterThan %58 %287 %239 + OpSelectionMerge %290 None + OpBranchConditional %288 %289 %290 + %289 = OpLabel + %292 = OpAccessChain %29 %26 %27 %291 + %293 = OpLoad %6 %292 + %294 = OpConvertSToF %177 %293 + %295 = OpAccessChain %204 %195 %247 + %296 = OpLoad %177 %295 + %297 = OpFAdd %177 %296 %294 + %298 = OpAccessChain %204 %195 %247 + OpStore %298 %297 + OpBranch %290 + %290 = OpLabel + %300 = OpAccessChain %29 %26 %27 %299 + %301 = OpLoad %6 %300 + %302 = OpConvertSToF %177 %301 + %303 = OpAccessChain %204 %195 %247 + %304 = OpLoad %177 %303 + %305 = OpFAdd %177 %304 %302 + %306 = OpAccessChain %204 %195 %247 + OpStore %306 %305 + %307 = OpAccessChain %204 %180 %203 + %308 = OpLoad %177 %307 + %309 = OpAccessChain %204 %180 %232 + %310 = OpLoad %177 %309 + %311 = OpFSub %177 %308 %310 + %312 = OpExtInst %177 %1 FAbs %311 + %313 = OpFOrdLessThan %58 %312 %211 + OpSelectionMerge %315 None + OpBranchConditional %313 %314 %315 + %314 = OpLabel + %316 = OpAccessChain %29 %26 %27 %88 + %317 = OpLoad %6 %316 + %318 = OpConvertSToF %177 %317 + %319 = OpAccessChain %204 %195 %203 + %320 = OpLoad %177 %319 + %321 = OpFAdd %177 %320 %318 + %322 = OpAccessChain %204 %195 %203 + OpStore %322 %321 + OpBranch %315 + %315 = OpLabel + %325 = OpLoad %193 %195 + %326 = OpExtInst %193 %1 Normalize %325 + %327 = OpCompositeExtract %177 %326 0 + %328 = OpCompositeExtract %177 %326 1 + %329 = OpCompositeExtract %177 %326 2 + %330 = OpCompositeConstruct %181 %327 %328 %329 %196 + OpStore %324 %330 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %20 = OpVariable %7 Function + %28 = OpLoad %6 %9 + %30 = OpAccessChain %29 %26 %27 %28 + %31 = OpLoad %6 %30 + OpStore %20 %31 + %32 = OpLoad %6 %9 + %33 = OpLoad %6 %10 + %34 = OpAccessChain %29 %26 %27 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %29 %26 %27 %32 + OpStore %36 %35 + %37 = OpLoad %6 %10 + %38 = OpLoad %6 %20 + %39 = OpAccessChain %29 %26 %27 %37 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %16 = OpFunction %6 None %13 + %14 = OpFunctionParameter %7 + %15 = OpFunctionParameter %7 + %17 = OpLabel + %40 = OpVariable %7 Function + %44 = OpVariable %7 Function + %48 = OpVariable %7 Function + %69 = OpVariable %7 Function + %71 = OpVariable %7 Function + %78 = OpVariable %7 Function + %80 = OpVariable %7 Function + %41 = OpLoad %6 %15 + %42 = OpAccessChain %29 %26 %27 %41 + %43 = OpLoad %6 %42 + OpStore %40 %43 + %45 = OpLoad %6 %14 + %47 = OpISub %6 %45 %46 + OpStore %44 %47 + %49 = OpLoad %6 %14 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %48 + %56 = OpLoad %6 %15 + %57 = OpISub %6 %56 %46 + %59 = OpSLessThanEqual %58 %55 %57 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %48 + %61 = OpAccessChain %29 %26 %27 %60 + %62 = OpLoad %6 %61 + %63 = OpLoad %6 %40 + %64 = OpSLessThanEqual %58 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpLoad %6 %44 + %68 = OpIAdd %6 %67 %46 + OpStore %44 %68 + %70 = OpLoad %6 %44 + OpStore %69 %70 + %72 = OpLoad %6 %48 + OpStore %71 %72 + %73 = OpFunctionCall %2 %11 %69 %71 + OpBranch %66 + %66 = OpLabel + OpBranch %53 + %53 = OpLabel + %74 = OpLoad %6 %48 + %75 = OpIAdd %6 %74 %46 + OpStore %48 %75 + OpBranch %50 + %52 = OpLabel + %76 = OpLoad %6 %44 + %77 = OpIAdd %6 %76 %46 + OpStore %44 %77 + %79 = OpLoad %6 %44 + OpStore %78 %79 + %81 = OpLoad %6 %15 + OpStore %80 %81 + %82 = OpFunctionCall %2 %11 %78 %80 + %83 = OpLoad %6 %44 + OpReturnValue %83 + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %86 = OpVariable %7 Function + %87 = OpVariable %7 Function + %89 = OpVariable %7 Function + %92 = OpVariable %91 Function + %116 = OpVariable %7 Function + %117 = OpVariable %7 Function + %119 = OpVariable %7 Function + OpStore %86 %27 + OpStore %87 %88 + OpStore %89 %90 + %93 = OpLoad %6 %89 + %94 = OpIAdd %6 %93 %46 + OpStore %89 %94 + %95 = OpLoad %6 %86 + %96 = OpAccessChain %7 %92 %94 + OpStore %96 %95 + %97 = OpLoad %6 %89 + %98 = OpIAdd %6 %97 %46 + OpStore %89 %98 + %99 = OpLoad %6 %87 + %100 = OpAccessChain %7 %92 %98 + OpStore %100 %99 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %6 %89 + %107 = OpSGreaterThanEqual %58 %106 %27 + OpBranchConditional %107 %102 %103 + %102 = OpLabel + %108 = OpLoad %6 %89 + %109 = OpISub %6 %108 %46 + OpStore %89 %109 + %110 = OpAccessChain %7 %92 %108 + %111 = OpLoad %6 %110 + OpStore %87 %111 + %112 = OpLoad %6 %89 + %113 = OpISub %6 %112 %46 + OpStore %89 %113 + %114 = OpAccessChain %7 %92 %112 + %115 = OpLoad %6 %114 + OpStore %86 %115 + %118 = OpLoad %6 %86 + OpStore %117 %118 + %120 = OpLoad %6 %87 + OpStore %119 %120 + %121 = OpFunctionCall %6 %16 %117 %119 + OpStore %116 %121 + %122 = OpLoad %6 %116 + %123 = OpISub %6 %122 %46 + %124 = OpLoad %6 %86 + %125 = OpSGreaterThan %58 %123 %124 + OpSelectionMerge %127 None + OpBranchConditional %125 %126 %127 + %126 = OpLabel + %128 = OpLoad %6 %89 + %129 = OpIAdd %6 %128 %46 + OpStore %89 %129 + %130 = OpLoad %6 %86 + %131 = OpAccessChain %7 %92 %129 + OpStore %131 %130 + %132 = OpLoad %6 %89 + %133 = OpIAdd %6 %132 %46 + OpStore %89 %133 + %134 = OpLoad %6 %116 + %135 = OpISub %6 %134 %46 + %136 = OpAccessChain %7 %92 %133 + OpStore %136 %135 + OpBranch %127 + %127 = OpLabel + %137 = OpLoad %6 %116 + %138 = OpIAdd %6 %137 %46 + %139 = OpLoad %6 %87 + %140 = OpSLessThan %58 %138 %139 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpLoad %6 %89 + %144 = OpIAdd %6 %143 %46 + OpStore %89 %144 + %145 = OpLoad %6 %116 + %146 = OpIAdd %6 %145 %46 + %147 = OpAccessChain %7 %92 %144 + OpStore %147 %146 + %148 = OpLoad %6 %89 + %149 = OpIAdd %6 %148 %46 + OpStore %89 %149 + %150 = OpLoad %6 %87 + %151 = OpAccessChain %7 %92 %149 + OpStore %151 %150 + OpBranch %142 + %142 = OpLabel + OpBranch %104 + %104 = OpLabel + OpBranch %101 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 331 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %183 %324 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "swap(i1;i1;" + OpName %9 "i" + OpName %10 "j" + OpName %16 "performPartition(i1;i1;" + OpName %14 "l" + OpName %15 "h" + OpName %18 "quicksort(" + OpName %20 "temp" + OpName %24 "QuicksortObject" + OpMemberName %24 0 "numbers" + OpName %26 "obj" + OpName %40 "pivot" + OpName %44 "i" + OpName %48 "j" + OpName %69 "param" + OpName %71 "param" + OpName %78 "param" + OpName %80 "param" + OpName %86 "l" + OpName %87 "h" + OpName %89 "top" + OpName %92 "stack" + OpName %116 "p" + OpName %117 "param" + OpName %119 "param" + OpName %152 "i" + OpName %180 "uv" + OpName %183 "gl_FragCoord" + OpName %186 "buf0" + OpMemberName %186 0 "resolution" + OpName %188 "" + OpName %195 "color" + OpName %324 "_GLF_color" + OpDecorate %183 BuiltIn FragCoord + OpMemberDecorate %186 0 Offset 0 + OpDecorate %186 Block + OpDecorate %188 DescriptorSet 0 + OpDecorate %188 Binding 0 + OpDecorate %324 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeFunction %6 %7 %7 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 0 + %29 = OpTypePointer Private %6 + %46 = OpConstant %6 1 + %58 = OpTypeBool + %88 = OpConstant %6 9 + %90 = OpConstant %6 -1 + %91 = OpTypePointer Function %23 + %159 = OpConstant %6 10 + %177 = OpTypeFloat 32 + %178 = OpTypeVector %177 2 + %179 = OpTypePointer Function %178 + %181 = OpTypeVector %177 4 + %182 = OpTypePointer Input %181 + %183 = OpVariable %182 Input + %186 = OpTypeStruct %178 + %187 = OpTypePointer Uniform %186 + %188 = OpVariable %187 Uniform + %189 = OpTypePointer Uniform %178 + %193 = OpTypeVector %177 3 + %194 = OpTypePointer Function %193 + %196 = OpConstant %177 1 + %197 = OpConstant %177 2 + %198 = OpConstant %177 3 + %199 = OpConstantComposite %193 %196 %197 %198 + %203 = OpConstant %21 0 + %204 = OpTypePointer Function %177 + %211 = OpConstant %177 0.25 + %224 = OpConstant %177 0.5 + %228 = OpConstant %6 2 + %232 = OpConstant %21 1 + %239 = OpConstant %177 0.75 + %243 = OpConstant %6 3 + %247 = OpConstant %21 2 + %252 = OpConstant %6 4 + %265 = OpConstant %6 5 + %278 = OpConstant %6 6 + %291 = OpConstant %6 7 + %299 = OpConstant %6 8 + %323 = OpTypePointer Output %181 + %324 = OpVariable %323 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %152 = OpVariable %7 Function + %180 = OpVariable %179 Function + %195 = OpVariable %194 Function + OpStore %152 %27 + OpBranch %153 + %153 = OpLabel + OpLoopMerge %155 %156 None + OpBranch %157 + %157 = OpLabel + %158 = OpLoad %6 %152 + %160 = OpSLessThan %58 %158 %159 + OpBranchConditional %160 %154 %155 + %154 = OpLabel + %161 = OpLoad %6 %152 + %162 = OpLoad %6 %152 + %163 = OpISub %6 %159 %162 + %164 = OpAccessChain %29 %26 %27 %161 + OpStore %164 %163 + %165 = OpLoad %6 %152 + %166 = OpLoad %6 %152 + %167 = OpAccessChain %29 %26 %27 %166 + %168 = OpLoad %6 %167 + %169 = OpLoad %6 %152 + %170 = OpAccessChain %29 %26 %27 %169 + %171 = OpLoad %6 %170 + %172 = OpIMul %6 %168 %171 + %173 = OpAccessChain %29 %26 %27 %165 + OpStore %173 %172 + OpBranch %156 + %156 = OpLabel + %174 = OpLoad %6 %152 + %175 = OpIAdd %6 %174 %46 + OpStore %152 %175 + OpBranch %153 + %155 = OpLabel + %176 = OpFunctionCall %2 %18 + %184 = OpLoad %181 %183 + %185 = OpVectorShuffle %178 %184 %184 0 1 + %190 = OpAccessChain %189 %188 %27 + %191 = OpLoad %178 %190 + %192 = OpFDiv %178 %185 %191 + OpStore %180 %192 + OpStore %195 %199 + %200 = OpAccessChain %29 %26 %27 %27 + %201 = OpLoad %6 %200 + %202 = OpConvertSToF %177 %201 + %205 = OpAccessChain %204 %195 %203 + %206 = OpLoad %177 %205 + %207 = OpFAdd %177 %206 %202 + %208 = OpAccessChain %204 %195 %203 + OpStore %208 %207 + %209 = OpAccessChain %204 %180 %203 + %210 = OpLoad %177 %209 + %212 = OpFOrdGreaterThan %58 %210 %211 + OpSelectionMerge %214 None + OpBranchConditional %212 %213 %214 + %213 = OpLabel + %215 = OpAccessChain %29 %26 %27 %46 + %216 = OpLoad %6 %215 + %217 = OpConvertSToF %177 %216 + %218 = OpAccessChain %204 %195 %203 + %219 = OpLoad %177 %218 + %220 = OpFAdd %177 %219 %217 + %221 = OpAccessChain %204 %195 %203 + OpStore %221 %220 + OpBranch %214 + %214 = OpLabel + %222 = OpAccessChain %204 %180 %203 + %223 = OpLoad %177 %222 + %225 = OpFOrdGreaterThan %58 %223 %224 + OpSelectionMerge %227 None + OpBranchConditional %225 %226 %227 + %226 = OpLabel + %229 = OpAccessChain %29 %26 %27 %228 + %230 = OpLoad %6 %229 + %231 = OpConvertSToF %177 %230 + %233 = OpAccessChain %204 %195 %232 + %234 = OpLoad %177 %233 + %235 = OpFAdd %177 %234 %231 + %236 = OpAccessChain %204 %195 %232 + OpStore %236 %235 + OpBranch %227 + %227 = OpLabel + %237 = OpAccessChain %204 %180 %203 + %238 = OpLoad %177 %237 + %240 = OpFOrdGreaterThan %58 %238 %239 + OpSelectionMerge %242 None + OpBranchConditional %240 %241 %242 + %241 = OpLabel + %244 = OpAccessChain %29 %26 %27 %243 + %245 = OpLoad %6 %244 + %246 = OpConvertSToF %177 %245 + %248 = OpAccessChain %204 %195 %247 + %249 = OpLoad %177 %248 + %250 = OpFAdd %177 %249 %246 + %251 = OpAccessChain %204 %195 %247 + OpStore %251 %250 + OpBranch %242 + %242 = OpLabel + %253 = OpAccessChain %29 %26 %27 %252 + %254 = OpLoad %6 %253 + %255 = OpConvertSToF %177 %254 + %256 = OpAccessChain %204 %195 %232 + %257 = OpLoad %177 %256 + %258 = OpFAdd %177 %257 %255 + %259 = OpAccessChain %204 %195 %232 + OpStore %259 %258 + %260 = OpAccessChain %204 %180 %232 + %261 = OpLoad %177 %260 + %262 = OpFOrdGreaterThan %58 %261 %211 + OpSelectionMerge %264 None + OpBranchConditional %262 %263 %264 + %263 = OpLabel + %266 = OpAccessChain %29 %26 %27 %265 + %267 = OpLoad %6 %266 + %268 = OpConvertSToF %177 %267 + %269 = OpAccessChain %204 %195 %203 + %270 = OpLoad %177 %269 + %271 = OpFAdd %177 %270 %268 + %272 = OpAccessChain %204 %195 %203 + OpStore %272 %271 + OpBranch %264 + %264 = OpLabel + %273 = OpAccessChain %204 %180 %232 + %274 = OpLoad %177 %273 + %275 = OpFOrdGreaterThan %58 %274 %224 + OpSelectionMerge %277 None + OpBranchConditional %275 %276 %277 + %276 = OpLabel + %279 = OpAccessChain %29 %26 %27 %278 + %280 = OpLoad %6 %279 + %281 = OpConvertSToF %177 %280 + %282 = OpAccessChain %204 %195 %232 + %283 = OpLoad %177 %282 + %284 = OpFAdd %177 %283 %281 + %285 = OpAccessChain %204 %195 %232 + OpStore %285 %284 + OpBranch %277 + %277 = OpLabel + %286 = OpAccessChain %204 %180 %232 + %287 = OpLoad %177 %286 + %288 = OpFOrdGreaterThan %58 %287 %239 + OpSelectionMerge %290 None + OpBranchConditional %288 %289 %290 + %289 = OpLabel + %292 = OpAccessChain %29 %26 %27 %291 + %293 = OpLoad %6 %292 + %294 = OpConvertSToF %177 %293 + %295 = OpAccessChain %204 %195 %247 + %296 = OpLoad %177 %295 + %297 = OpFAdd %177 %296 %294 + %298 = OpAccessChain %204 %195 %247 + OpStore %298 %297 + OpBranch %290 + %290 = OpLabel + %300 = OpAccessChain %29 %26 %27 %299 + %301 = OpLoad %6 %300 + %302 = OpConvertSToF %177 %301 + %303 = OpAccessChain %204 %195 %247 + %304 = OpLoad %177 %303 + %305 = OpFAdd %177 %304 %302 + %306 = OpAccessChain %204 %195 %247 + OpStore %306 %305 + %307 = OpAccessChain %204 %180 %203 + %308 = OpLoad %177 %307 + %309 = OpAccessChain %204 %180 %232 + %310 = OpLoad %177 %309 + %311 = OpFSub %177 %308 %310 + %312 = OpExtInst %177 %1 FAbs %311 + %313 = OpFOrdLessThan %58 %312 %211 + OpSelectionMerge %315 None + OpBranchConditional %313 %314 %315 + %314 = OpLabel + %316 = OpAccessChain %29 %26 %27 %88 + %317 = OpLoad %6 %316 + %318 = OpConvertSToF %177 %317 + %319 = OpAccessChain %204 %195 %203 + %320 = OpLoad %177 %319 + %321 = OpFAdd %177 %320 %318 + %322 = OpAccessChain %204 %195 %203 + OpStore %322 %321 + OpBranch %315 + %315 = OpLabel + %325 = OpLoad %193 %195 + %326 = OpExtInst %193 %1 Normalize %325 + %327 = OpCompositeExtract %177 %326 0 + %328 = OpCompositeExtract %177 %326 1 + %329 = OpCompositeExtract %177 %326 2 + %330 = OpCompositeConstruct %181 %327 %328 %329 %196 + OpStore %324 %330 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %20 = OpVariable %7 Function + %28 = OpLoad %6 %9 + %30 = OpAccessChain %29 %26 %27 %28 + %31 = OpLoad %6 %30 + OpStore %20 %31 + %32 = OpLoad %6 %9 + %33 = OpLoad %6 %10 + %34 = OpAccessChain %29 %26 %27 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %29 %26 %27 %32 + OpStore %36 %35 + %37 = OpLoad %6 %10 + %38 = OpLoad %6 %20 + %39 = OpAccessChain %29 %26 %27 %37 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %16 = OpFunction %6 DontInline %13 + %14 = OpFunctionParameter %7 + %15 = OpFunctionParameter %7 + %17 = OpLabel + %40 = OpVariable %7 Function + %44 = OpVariable %7 Function + %48 = OpVariable %7 Function + %69 = OpVariable %7 Function + %71 = OpVariable %7 Function + %78 = OpVariable %7 Function + %80 = OpVariable %7 Function + %41 = OpLoad %6 %15 + %42 = OpAccessChain %29 %26 %27 %41 + %43 = OpLoad %6 %42 + OpStore %40 %43 + %45 = OpLoad %6 %14 + %47 = OpISub %6 %45 %46 + OpStore %44 %47 + %49 = OpLoad %6 %14 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %48 + %56 = OpLoad %6 %15 + %57 = OpISub %6 %56 %46 + %59 = OpSLessThanEqual %58 %55 %57 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %48 + %61 = OpAccessChain %29 %26 %27 %60 + %62 = OpLoad %6 %61 + %63 = OpLoad %6 %40 + %64 = OpSLessThanEqual %58 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpLoad %6 %44 + %68 = OpIAdd %6 %67 %46 + OpStore %44 %68 + %70 = OpLoad %6 %44 + OpStore %69 %70 + %72 = OpLoad %6 %48 + OpStore %71 %72 + %73 = OpFunctionCall %2 %11 %69 %71 + OpBranch %66 + %66 = OpLabel + OpBranch %53 + %53 = OpLabel + %74 = OpLoad %6 %48 + %75 = OpIAdd %6 %74 %46 + OpStore %48 %75 + OpBranch %50 + %52 = OpLabel + %76 = OpLoad %6 %44 + %77 = OpIAdd %6 %76 %46 + OpStore %44 %77 + %79 = OpLoad %6 %44 + OpStore %78 %79 + %81 = OpLoad %6 %15 + OpStore %80 %81 + %82 = OpFunctionCall %2 %11 %78 %80 + %83 = OpLoad %6 %44 + OpReturnValue %83 + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %86 = OpVariable %7 Function + %87 = OpVariable %7 Function + %89 = OpVariable %7 Function + %92 = OpVariable %91 Function + %116 = OpVariable %7 Function + %117 = OpVariable %7 Function + %119 = OpVariable %7 Function + OpStore %86 %27 + OpStore %87 %88 + OpStore %89 %90 + %93 = OpLoad %6 %89 + %94 = OpIAdd %6 %93 %46 + OpStore %89 %94 + %95 = OpLoad %6 %86 + %96 = OpAccessChain %7 %92 %94 + OpStore %96 %95 + %97 = OpLoad %6 %89 + %98 = OpIAdd %6 %97 %46 + OpStore %89 %98 + %99 = OpLoad %6 %87 + %100 = OpAccessChain %7 %92 %98 + OpStore %100 %99 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %6 %89 + %107 = OpSGreaterThanEqual %58 %106 %27 + OpBranchConditional %107 %102 %103 + %102 = OpLabel + %108 = OpLoad %6 %89 + %109 = OpISub %6 %108 %46 + OpStore %89 %109 + %110 = OpAccessChain %7 %92 %108 + %111 = OpLoad %6 %110 + OpStore %87 %111 + %112 = OpLoad %6 %89 + %113 = OpISub %6 %112 %46 + OpStore %89 %113 + %114 = OpAccessChain %7 %92 %112 + %115 = OpLoad %6 %114 + OpStore %86 %115 + %118 = OpLoad %6 %86 + OpStore %117 %118 + %120 = OpLoad %6 %87 + OpStore %119 %120 + %121 = OpFunctionCall %6 %16 %117 %119 + OpStore %116 %121 + %122 = OpLoad %6 %116 + %123 = OpISub %6 %122 %46 + %124 = OpLoad %6 %86 + %125 = OpSGreaterThan %58 %123 %124 + OpSelectionMerge %127 None + OpBranchConditional %125 %126 %127 + %126 = OpLabel + %128 = OpLoad %6 %89 + %129 = OpIAdd %6 %128 %46 + OpStore %89 %129 + %130 = OpLoad %6 %86 + %131 = OpAccessChain %7 %92 %129 + OpStore %131 %130 + %132 = OpLoad %6 %89 + %133 = OpIAdd %6 %132 %46 + OpStore %89 %133 + %134 = OpLoad %6 %116 + %135 = OpISub %6 %134 %46 + %136 = OpAccessChain %7 %92 %133 + OpStore %136 %135 + OpBranch %127 + %127 = OpLabel + %137 = OpLoad %6 %116 + %138 = OpIAdd %6 %137 %46 + %139 = OpLoad %6 %87 + %140 = OpSLessThan %58 %138 %139 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpLoad %6 %89 + %144 = OpIAdd %6 %143 %46 + OpStore %89 %144 + %145 = OpLoad %6 %116 + %146 = OpIAdd %6 %145 %46 + %147 = OpAccessChain %7 %92 %144 + OpStore %147 %146 + %148 = OpLoad %6 %89 + %149 = OpIAdd %6 %148 %46 + OpStore %89 %149 + %150 = OpLoad %6 %87 + %151 = OpAccessChain %7 %92 %149 + OpStore %151 %150 + OpBranch %142 + %142 = OpLabel + OpBranch %104 + %104 = OpLabel + OpBranch %101 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-quicksort-mat-func-param.amber b/vulkan/amber/graphicsfuzz/spv-stable-quicksort-mat-func-param.amber new file mode 100644 index 0000000..6d21882 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-quicksort-mat-func-param.amber @@ -0,0 +1,1057 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Two shaders with diff: added mat3x3 func param + +# The test renders two images using semantically equivalent shaders, and then +# checks that the images are similar. +# The test passes because the shaders have the same semantics and so the images +# should be the same. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 331 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %183 %324 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "swap(i1;i1;" + OpName %9 "i" + OpName %10 "j" + OpName %16 "performPartition(i1;i1;" + OpName %14 "l" + OpName %15 "h" + OpName %18 "quicksort(" + OpName %20 "temp" + OpName %24 "QuicksortObject" + OpMemberName %24 0 "numbers" + OpName %26 "obj" + OpName %40 "pivot" + OpName %44 "i" + OpName %48 "j" + OpName %69 "param" + OpName %71 "param" + OpName %78 "param" + OpName %80 "param" + OpName %86 "l" + OpName %87 "h" + OpName %89 "top" + OpName %92 "stack" + OpName %116 "p" + OpName %117 "param" + OpName %119 "param" + OpName %152 "i" + OpName %180 "uv" + OpName %183 "gl_FragCoord" + OpName %186 "buf0" + OpMemberName %186 0 "resolution" + OpName %188 "" + OpName %195 "color" + OpName %324 "_GLF_color" + OpDecorate %183 BuiltIn FragCoord + OpMemberDecorate %186 0 Offset 0 + OpDecorate %186 Block + OpDecorate %188 DescriptorSet 0 + OpDecorate %188 Binding 0 + OpDecorate %324 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeFunction %6 %7 %7 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 0 + %29 = OpTypePointer Private %6 + %46 = OpConstant %6 1 + %58 = OpTypeBool + %88 = OpConstant %6 9 + %90 = OpConstant %6 -1 + %91 = OpTypePointer Function %23 + %159 = OpConstant %6 10 + %177 = OpTypeFloat 32 + %178 = OpTypeVector %177 2 + %179 = OpTypePointer Function %178 + %181 = OpTypeVector %177 4 + %182 = OpTypePointer Input %181 + %183 = OpVariable %182 Input + %186 = OpTypeStruct %178 + %187 = OpTypePointer Uniform %186 + %188 = OpVariable %187 Uniform + %189 = OpTypePointer Uniform %178 + %193 = OpTypeVector %177 3 + %194 = OpTypePointer Function %193 + %196 = OpConstant %177 1 + %197 = OpConstant %177 2 + %198 = OpConstant %177 3 + %199 = OpConstantComposite %193 %196 %197 %198 + %203 = OpConstant %21 0 + %204 = OpTypePointer Function %177 + %211 = OpConstant %177 0.25 + %224 = OpConstant %177 0.5 + %228 = OpConstant %6 2 + %232 = OpConstant %21 1 + %239 = OpConstant %177 0.75 + %243 = OpConstant %6 3 + %247 = OpConstant %21 2 + %252 = OpConstant %6 4 + %265 = OpConstant %6 5 + %278 = OpConstant %6 6 + %291 = OpConstant %6 7 + %299 = OpConstant %6 8 + %323 = OpTypePointer Output %181 + %324 = OpVariable %323 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %152 = OpVariable %7 Function + %180 = OpVariable %179 Function + %195 = OpVariable %194 Function + OpStore %152 %27 + OpBranch %153 + %153 = OpLabel + OpLoopMerge %155 %156 None + OpBranch %157 + %157 = OpLabel + %158 = OpLoad %6 %152 + %160 = OpSLessThan %58 %158 %159 + OpBranchConditional %160 %154 %155 + %154 = OpLabel + %161 = OpLoad %6 %152 + %162 = OpLoad %6 %152 + %163 = OpISub %6 %159 %162 + %164 = OpAccessChain %29 %26 %27 %161 + OpStore %164 %163 + %165 = OpLoad %6 %152 + %166 = OpLoad %6 %152 + %167 = OpAccessChain %29 %26 %27 %166 + %168 = OpLoad %6 %167 + %169 = OpLoad %6 %152 + %170 = OpAccessChain %29 %26 %27 %169 + %171 = OpLoad %6 %170 + %172 = OpIMul %6 %168 %171 + %173 = OpAccessChain %29 %26 %27 %165 + OpStore %173 %172 + OpBranch %156 + %156 = OpLabel + %174 = OpLoad %6 %152 + %175 = OpIAdd %6 %174 %46 + OpStore %152 %175 + OpBranch %153 + %155 = OpLabel + %176 = OpFunctionCall %2 %18 + %184 = OpLoad %181 %183 + %185 = OpVectorShuffle %178 %184 %184 0 1 + %190 = OpAccessChain %189 %188 %27 + %191 = OpLoad %178 %190 + %192 = OpFDiv %178 %185 %191 + OpStore %180 %192 + OpStore %195 %199 + %200 = OpAccessChain %29 %26 %27 %27 + %201 = OpLoad %6 %200 + %202 = OpConvertSToF %177 %201 + %205 = OpAccessChain %204 %195 %203 + %206 = OpLoad %177 %205 + %207 = OpFAdd %177 %206 %202 + %208 = OpAccessChain %204 %195 %203 + OpStore %208 %207 + %209 = OpAccessChain %204 %180 %203 + %210 = OpLoad %177 %209 + %212 = OpFOrdGreaterThan %58 %210 %211 + OpSelectionMerge %214 None + OpBranchConditional %212 %213 %214 + %213 = OpLabel + %215 = OpAccessChain %29 %26 %27 %46 + %216 = OpLoad %6 %215 + %217 = OpConvertSToF %177 %216 + %218 = OpAccessChain %204 %195 %203 + %219 = OpLoad %177 %218 + %220 = OpFAdd %177 %219 %217 + %221 = OpAccessChain %204 %195 %203 + OpStore %221 %220 + OpBranch %214 + %214 = OpLabel + %222 = OpAccessChain %204 %180 %203 + %223 = OpLoad %177 %222 + %225 = OpFOrdGreaterThan %58 %223 %224 + OpSelectionMerge %227 None + OpBranchConditional %225 %226 %227 + %226 = OpLabel + %229 = OpAccessChain %29 %26 %27 %228 + %230 = OpLoad %6 %229 + %231 = OpConvertSToF %177 %230 + %233 = OpAccessChain %204 %195 %232 + %234 = OpLoad %177 %233 + %235 = OpFAdd %177 %234 %231 + %236 = OpAccessChain %204 %195 %232 + OpStore %236 %235 + OpBranch %227 + %227 = OpLabel + %237 = OpAccessChain %204 %180 %203 + %238 = OpLoad %177 %237 + %240 = OpFOrdGreaterThan %58 %238 %239 + OpSelectionMerge %242 None + OpBranchConditional %240 %241 %242 + %241 = OpLabel + %244 = OpAccessChain %29 %26 %27 %243 + %245 = OpLoad %6 %244 + %246 = OpConvertSToF %177 %245 + %248 = OpAccessChain %204 %195 %247 + %249 = OpLoad %177 %248 + %250 = OpFAdd %177 %249 %246 + %251 = OpAccessChain %204 %195 %247 + OpStore %251 %250 + OpBranch %242 + %242 = OpLabel + %253 = OpAccessChain %29 %26 %27 %252 + %254 = OpLoad %6 %253 + %255 = OpConvertSToF %177 %254 + %256 = OpAccessChain %204 %195 %232 + %257 = OpLoad %177 %256 + %258 = OpFAdd %177 %257 %255 + %259 = OpAccessChain %204 %195 %232 + OpStore %259 %258 + %260 = OpAccessChain %204 %180 %232 + %261 = OpLoad %177 %260 + %262 = OpFOrdGreaterThan %58 %261 %211 + OpSelectionMerge %264 None + OpBranchConditional %262 %263 %264 + %263 = OpLabel + %266 = OpAccessChain %29 %26 %27 %265 + %267 = OpLoad %6 %266 + %268 = OpConvertSToF %177 %267 + %269 = OpAccessChain %204 %195 %203 + %270 = OpLoad %177 %269 + %271 = OpFAdd %177 %270 %268 + %272 = OpAccessChain %204 %195 %203 + OpStore %272 %271 + OpBranch %264 + %264 = OpLabel + %273 = OpAccessChain %204 %180 %232 + %274 = OpLoad %177 %273 + %275 = OpFOrdGreaterThan %58 %274 %224 + OpSelectionMerge %277 None + OpBranchConditional %275 %276 %277 + %276 = OpLabel + %279 = OpAccessChain %29 %26 %27 %278 + %280 = OpLoad %6 %279 + %281 = OpConvertSToF %177 %280 + %282 = OpAccessChain %204 %195 %232 + %283 = OpLoad %177 %282 + %284 = OpFAdd %177 %283 %281 + %285 = OpAccessChain %204 %195 %232 + OpStore %285 %284 + OpBranch %277 + %277 = OpLabel + %286 = OpAccessChain %204 %180 %232 + %287 = OpLoad %177 %286 + %288 = OpFOrdGreaterThan %58 %287 %239 + OpSelectionMerge %290 None + OpBranchConditional %288 %289 %290 + %289 = OpLabel + %292 = OpAccessChain %29 %26 %27 %291 + %293 = OpLoad %6 %292 + %294 = OpConvertSToF %177 %293 + %295 = OpAccessChain %204 %195 %247 + %296 = OpLoad %177 %295 + %297 = OpFAdd %177 %296 %294 + %298 = OpAccessChain %204 %195 %247 + OpStore %298 %297 + OpBranch %290 + %290 = OpLabel + %300 = OpAccessChain %29 %26 %27 %299 + %301 = OpLoad %6 %300 + %302 = OpConvertSToF %177 %301 + %303 = OpAccessChain %204 %195 %247 + %304 = OpLoad %177 %303 + %305 = OpFAdd %177 %304 %302 + %306 = OpAccessChain %204 %195 %247 + OpStore %306 %305 + %307 = OpAccessChain %204 %180 %203 + %308 = OpLoad %177 %307 + %309 = OpAccessChain %204 %180 %232 + %310 = OpLoad %177 %309 + %311 = OpFSub %177 %308 %310 + %312 = OpExtInst %177 %1 FAbs %311 + %313 = OpFOrdLessThan %58 %312 %211 + OpSelectionMerge %315 None + OpBranchConditional %313 %314 %315 + %314 = OpLabel + %316 = OpAccessChain %29 %26 %27 %88 + %317 = OpLoad %6 %316 + %318 = OpConvertSToF %177 %317 + %319 = OpAccessChain %204 %195 %203 + %320 = OpLoad %177 %319 + %321 = OpFAdd %177 %320 %318 + %322 = OpAccessChain %204 %195 %203 + OpStore %322 %321 + OpBranch %315 + %315 = OpLabel + %325 = OpLoad %193 %195 + %326 = OpExtInst %193 %1 Normalize %325 + %327 = OpCompositeExtract %177 %326 0 + %328 = OpCompositeExtract %177 %326 1 + %329 = OpCompositeExtract %177 %326 2 + %330 = OpCompositeConstruct %181 %327 %328 %329 %196 + OpStore %324 %330 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %20 = OpVariable %7 Function + %28 = OpLoad %6 %9 + %30 = OpAccessChain %29 %26 %27 %28 + %31 = OpLoad %6 %30 + OpStore %20 %31 + %32 = OpLoad %6 %9 + %33 = OpLoad %6 %10 + %34 = OpAccessChain %29 %26 %27 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %29 %26 %27 %32 + OpStore %36 %35 + %37 = OpLoad %6 %10 + %38 = OpLoad %6 %20 + %39 = OpAccessChain %29 %26 %27 %37 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %16 = OpFunction %6 None %13 + %14 = OpFunctionParameter %7 + %15 = OpFunctionParameter %7 + %17 = OpLabel + %40 = OpVariable %7 Function + %44 = OpVariable %7 Function + %48 = OpVariable %7 Function + %69 = OpVariable %7 Function + %71 = OpVariable %7 Function + %78 = OpVariable %7 Function + %80 = OpVariable %7 Function + %41 = OpLoad %6 %15 + %42 = OpAccessChain %29 %26 %27 %41 + %43 = OpLoad %6 %42 + OpStore %40 %43 + %45 = OpLoad %6 %14 + %47 = OpISub %6 %45 %46 + OpStore %44 %47 + %49 = OpLoad %6 %14 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %48 + %56 = OpLoad %6 %15 + %57 = OpISub %6 %56 %46 + %59 = OpSLessThanEqual %58 %55 %57 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %48 + %61 = OpAccessChain %29 %26 %27 %60 + %62 = OpLoad %6 %61 + %63 = OpLoad %6 %40 + %64 = OpSLessThanEqual %58 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpLoad %6 %44 + %68 = OpIAdd %6 %67 %46 + OpStore %44 %68 + %70 = OpLoad %6 %44 + OpStore %69 %70 + %72 = OpLoad %6 %48 + OpStore %71 %72 + %73 = OpFunctionCall %2 %11 %69 %71 + OpBranch %66 + %66 = OpLabel + OpBranch %53 + %53 = OpLabel + %74 = OpLoad %6 %48 + %75 = OpIAdd %6 %74 %46 + OpStore %48 %75 + OpBranch %50 + %52 = OpLabel + %76 = OpLoad %6 %44 + %77 = OpIAdd %6 %76 %46 + OpStore %44 %77 + %79 = OpLoad %6 %44 + OpStore %78 %79 + %81 = OpLoad %6 %15 + OpStore %80 %81 + %82 = OpFunctionCall %2 %11 %78 %80 + %83 = OpLoad %6 %44 + OpReturnValue %83 + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %86 = OpVariable %7 Function + %87 = OpVariable %7 Function + %89 = OpVariable %7 Function + %92 = OpVariable %91 Function + %116 = OpVariable %7 Function + %117 = OpVariable %7 Function + %119 = OpVariable %7 Function + OpStore %86 %27 + OpStore %87 %88 + OpStore %89 %90 + %93 = OpLoad %6 %89 + %94 = OpIAdd %6 %93 %46 + OpStore %89 %94 + %95 = OpLoad %6 %86 + %96 = OpAccessChain %7 %92 %94 + OpStore %96 %95 + %97 = OpLoad %6 %89 + %98 = OpIAdd %6 %97 %46 + OpStore %89 %98 + %99 = OpLoad %6 %87 + %100 = OpAccessChain %7 %92 %98 + OpStore %100 %99 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %6 %89 + %107 = OpSGreaterThanEqual %58 %106 %27 + OpBranchConditional %107 %102 %103 + %102 = OpLabel + %108 = OpLoad %6 %89 + %109 = OpISub %6 %108 %46 + OpStore %89 %109 + %110 = OpAccessChain %7 %92 %108 + %111 = OpLoad %6 %110 + OpStore %87 %111 + %112 = OpLoad %6 %89 + %113 = OpISub %6 %112 %46 + OpStore %89 %113 + %114 = OpAccessChain %7 %92 %112 + %115 = OpLoad %6 %114 + OpStore %86 %115 + %118 = OpLoad %6 %86 + OpStore %117 %118 + %120 = OpLoad %6 %87 + OpStore %119 %120 + %121 = OpFunctionCall %6 %16 %117 %119 + OpStore %116 %121 + %122 = OpLoad %6 %116 + %123 = OpISub %6 %122 %46 + %124 = OpLoad %6 %86 + %125 = OpSGreaterThan %58 %123 %124 + OpSelectionMerge %127 None + OpBranchConditional %125 %126 %127 + %126 = OpLabel + %128 = OpLoad %6 %89 + %129 = OpIAdd %6 %128 %46 + OpStore %89 %129 + %130 = OpLoad %6 %86 + %131 = OpAccessChain %7 %92 %129 + OpStore %131 %130 + %132 = OpLoad %6 %89 + %133 = OpIAdd %6 %132 %46 + OpStore %89 %133 + %134 = OpLoad %6 %116 + %135 = OpISub %6 %134 %46 + %136 = OpAccessChain %7 %92 %133 + OpStore %136 %135 + OpBranch %127 + %127 = OpLabel + %137 = OpLoad %6 %116 + %138 = OpIAdd %6 %137 %46 + %139 = OpLoad %6 %87 + %140 = OpSLessThan %58 %138 %139 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpLoad %6 %89 + %144 = OpIAdd %6 %143 %46 + OpStore %89 %144 + %145 = OpLoad %6 %116 + %146 = OpIAdd %6 %145 %46 + %147 = OpAccessChain %7 %92 %144 + OpStore %147 %146 + %148 = OpLoad %6 %89 + %149 = OpIAdd %6 %148 %46 + OpStore %89 %149 + %150 = OpLoad %6 %87 + %151 = OpAccessChain %7 %92 %149 + OpStore %151 %150 + OpBranch %142 + %142 = OpLabel + OpBranch %104 + %104 = OpLabel + OpBranch %101 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 529 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %183 %324 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "swap(i1;i1;" + OpName %9 "i" + OpName %10 "j" + OpName %16 "performPartition(i1;i1;" + OpName %14 "l" + OpName %15 "h" + OpName %18 "quicksort(" + OpName %20 "temp" + OpName %24 "QuicksortObject" + OpMemberName %24 0 "numbers" + OpName %26 "obj" + OpName %40 "pivot" + OpName %44 "i" + OpName %48 "j" + OpName %69 "param" + OpName %71 "param" + OpName %78 "param" + OpName %80 "param" + OpName %86 "l" + OpName %87 "h" + OpName %89 "top" + OpName %92 "stack" + OpName %116 "p" + OpName %117 "param" + OpName %119 "param" + OpName %152 "i" + OpName %180 "uv" + OpName %183 "gl_FragCoord" + OpName %186 "buf0" + OpMemberName %186 0 "resolution" + OpName %188 "" + OpName %195 "color" + OpName %324 "_GLF_color" + OpDecorate %183 BuiltIn FragCoord + OpMemberDecorate %186 0 Offset 0 + OpDecorate %186 Block + OpDecorate %188 DescriptorSet 0 + OpDecorate %188 Binding 0 + OpDecorate %324 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %13 = OpTypeFunction %6 %7 %7 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 0 + %29 = OpTypePointer Private %6 + %46 = OpConstant %6 1 + %58 = OpTypeBool + %88 = OpConstant %6 9 + %90 = OpConstant %6 -1 + %91 = OpTypePointer Function %23 + %159 = OpConstant %6 10 + %177 = OpTypeFloat 32 + %178 = OpTypeVector %177 2 + %179 = OpTypePointer Function %178 + %181 = OpTypeVector %177 4 + %182 = OpTypePointer Input %181 + %183 = OpVariable %182 Input + %186 = OpTypeStruct %178 + %187 = OpTypePointer Uniform %186 + %188 = OpVariable %187 Uniform + %189 = OpTypePointer Uniform %178 + %193 = OpTypeVector %177 3 + %194 = OpTypePointer Function %193 + %196 = OpConstant %177 1 + %197 = OpConstant %177 2 + %198 = OpConstant %177 3 + %199 = OpConstantComposite %193 %196 %197 %198 + %203 = OpConstant %21 0 + %204 = OpTypePointer Function %177 + %211 = OpConstant %177 0.25 + %224 = OpConstant %177 0.5 + %228 = OpConstant %6 2 + %232 = OpConstant %21 1 + %239 = OpConstant %177 0.75 + %243 = OpConstant %6 3 + %247 = OpConstant %21 2 + %252 = OpConstant %6 4 + %265 = OpConstant %6 5 + %278 = OpConstant %6 6 + %291 = OpConstant %6 7 + %299 = OpConstant %6 8 + %323 = OpTypePointer Output %181 + %324 = OpVariable %323 Output + %438 = OpTypeMatrix %193 3 + %521 = OpConstant %177 0 + %522 = OpConstantComposite %193 %521 %521 %521 + %527 = OpConstantComposite %438 %522 %522 %522 + %8 = OpTypeFunction %2 %7 %7 %438 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %152 = OpVariable %7 Function + %180 = OpVariable %179 Function + %195 = OpVariable %194 Function + OpStore %152 %27 + OpBranch %153 + %153 = OpLabel + OpLoopMerge %155 %156 None + OpBranch %157 + %157 = OpLabel + %158 = OpLoad %6 %152 + %160 = OpSLessThan %58 %158 %159 + OpBranchConditional %160 %154 %155 + %154 = OpLabel + %161 = OpLoad %6 %152 + %162 = OpLoad %6 %152 + %163 = OpISub %6 %159 %162 + %164 = OpAccessChain %29 %26 %27 %161 + OpStore %164 %163 + %165 = OpLoad %6 %152 + %166 = OpLoad %6 %152 + %167 = OpAccessChain %29 %26 %27 %166 + %168 = OpLoad %6 %167 + %169 = OpLoad %6 %152 + %170 = OpAccessChain %29 %26 %27 %169 + %171 = OpLoad %6 %170 + %172 = OpIMul %6 %168 %171 + %173 = OpAccessChain %29 %26 %27 %165 + OpStore %173 %172 + OpBranch %156 + %156 = OpLabel + %174 = OpLoad %6 %152 + %175 = OpIAdd %6 %174 %46 + OpStore %152 %175 + OpBranch %153 + %155 = OpLabel + %176 = OpFunctionCall %2 %18 + %184 = OpLoad %181 %183 + %185 = OpVectorShuffle %178 %184 %184 0 1 + %190 = OpAccessChain %189 %188 %27 + %191 = OpLoad %178 %190 + %192 = OpFDiv %178 %185 %191 + OpStore %180 %192 + OpStore %195 %199 + %200 = OpAccessChain %29 %26 %27 %27 + %201 = OpLoad %6 %200 + %202 = OpConvertSToF %177 %201 + %205 = OpAccessChain %204 %195 %203 + %206 = OpLoad %177 %205 + %207 = OpFAdd %177 %206 %202 + %208 = OpAccessChain %204 %195 %203 + OpStore %208 %207 + %209 = OpAccessChain %204 %180 %203 + %210 = OpLoad %177 %209 + %212 = OpFOrdGreaterThan %58 %210 %211 + OpSelectionMerge %214 None + OpBranchConditional %212 %213 %214 + %213 = OpLabel + %215 = OpAccessChain %29 %26 %27 %46 + %216 = OpLoad %6 %215 + %217 = OpConvertSToF %177 %216 + %218 = OpAccessChain %204 %195 %203 + %219 = OpLoad %177 %218 + %220 = OpFAdd %177 %219 %217 + %221 = OpAccessChain %204 %195 %203 + OpStore %221 %220 + OpBranch %214 + %214 = OpLabel + %222 = OpAccessChain %204 %180 %203 + %223 = OpLoad %177 %222 + %225 = OpFOrdGreaterThan %58 %223 %224 + OpSelectionMerge %227 None + OpBranchConditional %225 %226 %227 + %226 = OpLabel + %229 = OpAccessChain %29 %26 %27 %228 + %230 = OpLoad %6 %229 + %231 = OpConvertSToF %177 %230 + %233 = OpAccessChain %204 %195 %232 + %234 = OpLoad %177 %233 + %235 = OpFAdd %177 %234 %231 + %236 = OpAccessChain %204 %195 %232 + OpStore %236 %235 + OpBranch %227 + %227 = OpLabel + %237 = OpAccessChain %204 %180 %203 + %238 = OpLoad %177 %237 + %240 = OpFOrdGreaterThan %58 %238 %239 + OpSelectionMerge %242 None + OpBranchConditional %240 %241 %242 + %241 = OpLabel + %244 = OpAccessChain %29 %26 %27 %243 + %245 = OpLoad %6 %244 + %246 = OpConvertSToF %177 %245 + %248 = OpAccessChain %204 %195 %247 + %249 = OpLoad %177 %248 + %250 = OpFAdd %177 %249 %246 + %251 = OpAccessChain %204 %195 %247 + OpStore %251 %250 + OpBranch %242 + %242 = OpLabel + %253 = OpAccessChain %29 %26 %27 %252 + %254 = OpLoad %6 %253 + %255 = OpConvertSToF %177 %254 + %256 = OpAccessChain %204 %195 %232 + %257 = OpLoad %177 %256 + %258 = OpFAdd %177 %257 %255 + %259 = OpAccessChain %204 %195 %232 + OpStore %259 %258 + %260 = OpAccessChain %204 %180 %232 + %261 = OpLoad %177 %260 + %262 = OpFOrdGreaterThan %58 %261 %211 + OpSelectionMerge %264 None + OpBranchConditional %262 %263 %264 + %263 = OpLabel + %266 = OpAccessChain %29 %26 %27 %265 + %267 = OpLoad %6 %266 + %268 = OpConvertSToF %177 %267 + %269 = OpAccessChain %204 %195 %203 + %270 = OpLoad %177 %269 + %271 = OpFAdd %177 %270 %268 + %272 = OpAccessChain %204 %195 %203 + OpStore %272 %271 + OpBranch %264 + %264 = OpLabel + %273 = OpAccessChain %204 %180 %232 + %274 = OpLoad %177 %273 + %275 = OpFOrdGreaterThan %58 %274 %224 + OpSelectionMerge %277 None + OpBranchConditional %275 %276 %277 + %276 = OpLabel + %279 = OpAccessChain %29 %26 %27 %278 + %280 = OpLoad %6 %279 + %281 = OpConvertSToF %177 %280 + %282 = OpAccessChain %204 %195 %232 + %283 = OpLoad %177 %282 + %284 = OpFAdd %177 %283 %281 + %285 = OpAccessChain %204 %195 %232 + OpStore %285 %284 + OpBranch %277 + %277 = OpLabel + %286 = OpAccessChain %204 %180 %232 + %287 = OpLoad %177 %286 + %288 = OpFOrdGreaterThan %58 %287 %239 + OpSelectionMerge %290 None + OpBranchConditional %288 %289 %290 + %289 = OpLabel + %292 = OpAccessChain %29 %26 %27 %291 + %293 = OpLoad %6 %292 + %294 = OpConvertSToF %177 %293 + %295 = OpAccessChain %204 %195 %247 + %296 = OpLoad %177 %295 + %297 = OpFAdd %177 %296 %294 + %298 = OpAccessChain %204 %195 %247 + OpStore %298 %297 + OpBranch %290 + %290 = OpLabel + %300 = OpAccessChain %29 %26 %27 %299 + %301 = OpLoad %6 %300 + %302 = OpConvertSToF %177 %301 + %303 = OpAccessChain %204 %195 %247 + %304 = OpLoad %177 %303 + %305 = OpFAdd %177 %304 %302 + %306 = OpAccessChain %204 %195 %247 + OpStore %306 %305 + %307 = OpAccessChain %204 %180 %203 + %308 = OpLoad %177 %307 + %309 = OpAccessChain %204 %180 %232 + %310 = OpLoad %177 %309 + %311 = OpFSub %177 %308 %310 + %312 = OpExtInst %177 %1 FAbs %311 + %313 = OpFOrdLessThan %58 %312 %211 + OpSelectionMerge %315 None + OpBranchConditional %313 %314 %315 + %314 = OpLabel + %316 = OpAccessChain %29 %26 %27 %88 + %317 = OpLoad %6 %316 + %318 = OpConvertSToF %177 %317 + %319 = OpAccessChain %204 %195 %203 + %320 = OpLoad %177 %319 + %321 = OpFAdd %177 %320 %318 + %322 = OpAccessChain %204 %195 %203 + OpStore %322 %321 + OpBranch %315 + %315 = OpLabel + %325 = OpLoad %193 %195 + %326 = OpExtInst %193 %1 Normalize %325 + %327 = OpCompositeExtract %177 %326 0 + %328 = OpCompositeExtract %177 %326 1 + %329 = OpCompositeExtract %177 %326 2 + %330 = OpCompositeConstruct %181 %327 %328 %329 %196 + OpStore %324 %330 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %528 = OpFunctionParameter %438 + %12 = OpLabel + %20 = OpVariable %7 Function + %28 = OpLoad %6 %9 + %30 = OpAccessChain %29 %26 %27 %28 + %31 = OpLoad %6 %30 + OpStore %20 %31 + %32 = OpLoad %6 %9 + %33 = OpLoad %6 %10 + %34 = OpAccessChain %29 %26 %27 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %29 %26 %27 %32 + OpStore %36 %35 + %37 = OpLoad %6 %10 + %38 = OpLoad %6 %20 + %39 = OpAccessChain %29 %26 %27 %37 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %16 = OpFunction %6 None %13 + %14 = OpFunctionParameter %7 + %15 = OpFunctionParameter %7 + %17 = OpLabel + %40 = OpVariable %7 Function + %44 = OpVariable %7 Function + %48 = OpVariable %7 Function + %69 = OpVariable %7 Function + %71 = OpVariable %7 Function + %78 = OpVariable %7 Function + %80 = OpVariable %7 Function + %41 = OpLoad %6 %15 + %42 = OpAccessChain %29 %26 %27 %41 + %43 = OpLoad %6 %42 + OpStore %40 %43 + %45 = OpLoad %6 %14 + %47 = OpISub %6 %45 %46 + OpStore %44 %47 + %49 = OpLoad %6 %14 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %48 + %56 = OpLoad %6 %15 + %57 = OpISub %6 %56 %46 + %59 = OpSLessThanEqual %58 %55 %57 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %48 + %61 = OpAccessChain %29 %26 %27 %60 + %62 = OpLoad %6 %61 + %63 = OpLoad %6 %40 + %64 = OpSLessThanEqual %58 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpLoad %6 %44 + %68 = OpIAdd %6 %67 %46 + OpStore %44 %68 + %70 = OpLoad %6 %44 + OpStore %69 %70 + %72 = OpLoad %6 %48 + OpStore %71 %72 + %73 = OpFunctionCall %2 %11 %69 %71 %527 + OpBranch %66 + %66 = OpLabel + OpBranch %53 + %53 = OpLabel + %74 = OpLoad %6 %48 + %75 = OpIAdd %6 %74 %46 + OpStore %48 %75 + OpBranch %50 + %52 = OpLabel + %76 = OpLoad %6 %44 + %77 = OpIAdd %6 %76 %46 + OpStore %44 %77 + %79 = OpLoad %6 %44 + OpStore %78 %79 + %81 = OpLoad %6 %15 + OpStore %80 %81 + %82 = OpFunctionCall %2 %11 %78 %80 %527 + %83 = OpLoad %6 %44 + OpReturnValue %83 + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %86 = OpVariable %7 Function + %87 = OpVariable %7 Function + %89 = OpVariable %7 Function + %92 = OpVariable %91 Function + %116 = OpVariable %7 Function + %117 = OpVariable %7 Function + %119 = OpVariable %7 Function + OpStore %86 %27 + OpStore %87 %88 + OpStore %89 %90 + %93 = OpLoad %6 %89 + %94 = OpIAdd %6 %93 %46 + OpStore %89 %94 + %95 = OpLoad %6 %86 + %96 = OpAccessChain %7 %92 %94 + OpStore %96 %95 + %97 = OpLoad %6 %89 + %98 = OpIAdd %6 %97 %46 + OpStore %89 %98 + %99 = OpLoad %6 %87 + %100 = OpAccessChain %7 %92 %98 + OpStore %100 %99 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %6 %89 + %107 = OpSGreaterThanEqual %58 %106 %27 + OpBranchConditional %107 %102 %103 + %102 = OpLabel + %108 = OpLoad %6 %89 + %109 = OpISub %6 %108 %46 + OpStore %89 %109 + %110 = OpAccessChain %7 %92 %108 + %111 = OpLoad %6 %110 + OpStore %87 %111 + %112 = OpLoad %6 %89 + %113 = OpISub %6 %112 %46 + OpStore %89 %113 + %114 = OpAccessChain %7 %92 %112 + %115 = OpLoad %6 %114 + OpStore %86 %115 + %118 = OpLoad %6 %86 + OpStore %117 %118 + %120 = OpLoad %6 %87 + OpStore %119 %120 + %121 = OpFunctionCall %6 %16 %117 %119 + OpStore %116 %121 + %122 = OpLoad %6 %116 + %123 = OpISub %6 %122 %46 + %124 = OpLoad %6 %86 + %125 = OpSGreaterThan %58 %123 %124 + OpSelectionMerge %127 None + OpBranchConditional %125 %126 %127 + %126 = OpLabel + %128 = OpLoad %6 %89 + %129 = OpIAdd %6 %128 %46 + OpStore %89 %129 + %130 = OpLoad %6 %86 + %131 = OpAccessChain %7 %92 %129 + OpStore %131 %130 + %132 = OpLoad %6 %89 + %133 = OpIAdd %6 %132 %46 + OpStore %89 %133 + %134 = OpLoad %6 %116 + %135 = OpISub %6 %134 %46 + %136 = OpAccessChain %7 %92 %133 + OpStore %136 %135 + OpBranch %127 + %127 = OpLabel + %137 = OpLoad %6 %116 + %138 = OpIAdd %6 %137 %46 + %139 = OpLoad %6 %87 + %140 = OpSLessThan %58 %138 %139 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpLoad %6 %89 + %144 = OpIAdd %6 %143 %46 + OpStore %89 %144 + %145 = OpLoad %6 %116 + %146 = OpIAdd %6 %145 %46 + %147 = OpAccessChain %7 %92 %144 + OpStore %147 %146 + %148 = OpLoad %6 %89 + %149 = OpIAdd %6 %148 %46 + OpStore %89 %149 + %150 = OpLoad %6 %87 + %151 = OpAccessChain %7 %92 %149 + OpStore %151 %150 + OpBranch %142 + %142 = OpLabel + OpBranch %104 + %104 = OpLabel + OpBranch %101 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var.amber b/vulkan/amber/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var.amber new file mode 100644 index 0000000..745c128 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var.amber @@ -0,0 +1,688 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Three shaders diff: new variable used and mutated + +# The test renders three images using semantically equivalent shaders, and then +# checks that the images are similar. +# The test passes because the shaders have the same semantics and so the images +# should be the same. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 286 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %165 %180 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %165 "gl_FragCoord" + OpName %168 "buf0" + OpMemberName %168 0 "resolution" + OpName %170 "" + OpName %180 "_GLF_color" + OpDecorate %165 BuiltIn FragCoord + OpMemberDecorate %168 0 Offset 0 + OpDecorate %168 Block + OpDecorate %170 DescriptorSet 0 + OpDecorate %170 Binding 0 + OpDecorate %180 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %9 = OpTypeVector %6 4 + %10 = OpTypePointer Function %9 + %11 = OpTypeBool + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Function %6 + %31 = OpConstantFalse %11 + %33 = OpConstant %21 1 + %66 = OpConstantTrue %11 + %70 = OpConstant %6 0.5 + %71 = OpConstant %6 1 + %72 = OpConstantComposite %9 %70 %70 %71 %71 + %73 = OpTypeInt 32 1 + %76 = OpConstant %73 0 + %83 = OpConstant %73 8 + %85 = OpConstant %21 8 + %86 = OpTypeArray %9 %85 + %87 = OpConstant %6 4 + %88 = OpConstant %6 20 + %89 = OpConstantComposite %9 %87 %87 %88 %87 + %90 = OpConstantComposite %9 %87 %87 %87 %88 + %91 = OpConstantComposite %9 %87 %88 %88 %87 + %92 = OpConstant %6 8 + %93 = OpConstantComposite %9 %88 %87 %87 %92 + %94 = OpConstant %6 6 + %95 = OpConstant %6 2 + %96 = OpConstantComposite %9 %92 %94 %87 %95 + %97 = OpConstant %6 12 + %98 = OpConstantComposite %9 %95 %97 %95 %87 + %99 = OpConstant %6 16 + %100 = OpConstantComposite %9 %99 %95 %87 %87 + %101 = OpConstant %6 22 + %102 = OpConstantComposite %9 %97 %101 %87 %87 + %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102 + %108 = OpTypePointer Function %86 + %115 = OpConstant %21 16 + %116 = OpTypeArray %9 %115 + %117 = OpConstant %6 0 + %118 = OpConstantComposite %9 %117 %117 %117 %71 + %119 = OpConstantComposite %9 %70 %117 %117 %71 + %120 = OpConstantComposite %9 %117 %70 %117 %71 + %121 = OpConstantComposite %9 %70 %70 %117 %71 + %122 = OpConstantComposite %9 %117 %117 %70 %71 + %123 = OpConstantComposite %9 %70 %117 %70 %71 + %124 = OpConstantComposite %9 %117 %70 %70 %71 + %125 = OpConstantComposite %9 %70 %70 %70 %71 + %126 = OpConstantComposite %9 %71 %117 %117 %71 + %127 = OpConstantComposite %9 %117 %71 %117 %71 + %128 = OpConstantComposite %9 %71 %71 %117 %71 + %129 = OpConstantComposite %9 %117 %117 %71 %71 + %130 = OpConstantComposite %9 %71 %117 %71 %71 + %131 = OpConstantComposite %9 %117 %71 %71 %71 + %132 = OpConstantComposite %9 %71 %71 %71 %71 + %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132 + %146 = OpConstant %73 9 + %149 = OpConstant %73 11 + %151 = OpConstant %73 16 + %153 = OpTypePointer Function %116 + %158 = OpConstant %73 1 + %164 = OpTypePointer Input %9 + %165 = OpVariable %164 Input + %168 = OpTypeStruct %7 + %169 = OpTypePointer Uniform %168 + %170 = OpVariable %169 Uniform + %171 = OpTypePointer Uniform %7 + %176 = OpConstant %6 32 + %179 = OpTypePointer Output %9 + %180 = OpVariable %179 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %199 = OpVariable %108 Function + %200 = OpVariable %108 Function + %201 = OpVariable %108 Function + %202 = OpVariable %153 Function + %166 = OpLoad %9 %165 + %167 = OpVectorShuffle %7 %166 %166 0 1 + %172 = OpAccessChain %171 %170 %76 + %173 = OpLoad %7 %172 + %174 = OpFDiv %7 %167 %173 + %177 = OpVectorTimesScalar %7 %174 %176 + %178 = OpExtInst %7 %1 Floor %177 + OpBranch %205 + %205 = OpLabel + %280 = OpPhi %9 %72 %5 %285 %233 + %279 = OpPhi %73 %76 %5 %235 %233 + %208 = OpSLessThan %11 %279 %83 + OpLoopMerge %236 %233 None + OpBranchConditional %208 %209 %236 + %209 = OpLabel + OpStore %199 %103 + %212 = OpAccessChain %10 %199 %279 + %213 = OpLoad %9 %212 + OpSelectionMerge %277 None + OpSwitch %22 %242 + %242 = OpLabel + %244 = OpCompositeExtract %6 %178 0 + %246 = OpCompositeExtract %6 %213 0 + %247 = OpFOrdLessThan %11 %244 %246 + OpSelectionMerge %249 None + OpBranchConditional %247 %248 %249 + %248 = OpLabel + OpBranch %277 + %249 = OpLabel + %251 = OpCompositeExtract %6 %178 1 + %253 = OpCompositeExtract %6 %213 1 + %254 = OpFOrdLessThan %11 %251 %253 + OpSelectionMerge %256 None + OpBranchConditional %254 %255 %256 + %255 = OpLabel + OpBranch %277 + %256 = OpLabel + %262 = OpCompositeExtract %6 %213 2 + %263 = OpFAdd %6 %246 %262 + %264 = OpFOrdGreaterThan %11 %244 %263 + OpSelectionMerge %266 None + OpBranchConditional %264 %265 %266 + %265 = OpLabel + OpBranch %277 + %266 = OpLabel + %272 = OpCompositeExtract %6 %213 3 + %273 = OpFAdd %6 %253 %272 + %274 = OpFOrdGreaterThan %11 %251 %273 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + OpBranch %277 + %276 = OpLabel + OpBranch %277 + %277 = OpLabel + %282 = OpPhi %11 %31 %248 %31 %255 %31 %265 %31 %275 %66 %276 + OpSelectionMerge %232 None + OpBranchConditional %282 %215 %232 + %215 = OpLabel + OpStore %200 %103 + %217 = OpAccessChain %23 %200 %279 %22 + %218 = OpLoad %6 %217 + %219 = OpConvertFToS %73 %218 + OpStore %201 %103 + %221 = OpAccessChain %23 %201 %279 %33 + %222 = OpLoad %6 %221 + %223 = OpConvertFToS %73 %222 + %224 = OpIMul %73 %219 %223 + %226 = OpIMul %73 %279 %146 + %227 = OpIAdd %73 %224 %226 + %228 = OpIAdd %73 %227 %149 + %229 = OpSMod %73 %228 %151 + OpStore %202 %133 + %230 = OpAccessChain %10 %202 %229 + %231 = OpLoad %9 %230 + OpBranch %232 + %232 = OpLabel + %285 = OpPhi %9 %280 %277 %231 %215 + OpBranch %233 + %233 = OpLabel + %235 = OpIAdd %73 %279 %158 + OpBranch %205 + %236 = OpLabel + OpStore %180 %280 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 517 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %165 %180 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %165 "gl_FragCoord" + OpName %168 "buf0" + OpMemberName %168 0 "resolution" + OpName %170 "" + OpName %180 "_GLF_color" + OpDecorate %165 BuiltIn FragCoord + OpMemberDecorate %168 0 Offset 0 + OpDecorate %168 Block + OpDecorate %170 DescriptorSet 0 + OpDecorate %170 Binding 0 + OpDecorate %180 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %9 = OpTypeVector %6 4 + %10 = OpTypePointer Function %9 + %11 = OpTypeBool + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Function %6 + %31 = OpConstantFalse %11 + %33 = OpConstant %21 1 + %66 = OpConstantTrue %11 + %70 = OpConstant %6 0.5 + %71 = OpConstant %6 1 + %72 = OpConstantComposite %9 %70 %70 %71 %71 + %73 = OpTypeInt 32 1 + %76 = OpConstant %73 0 + %83 = OpConstant %73 8 + %85 = OpConstant %21 8 + %86 = OpTypeArray %9 %85 + %87 = OpConstant %6 4 + %88 = OpConstant %6 20 + %89 = OpConstantComposite %9 %87 %87 %88 %87 + %90 = OpConstantComposite %9 %87 %87 %87 %88 + %91 = OpConstantComposite %9 %87 %88 %88 %87 + %92 = OpConstant %6 8 + %93 = OpConstantComposite %9 %88 %87 %87 %92 + %94 = OpConstant %6 6 + %95 = OpConstant %6 2 + %96 = OpConstantComposite %9 %92 %94 %87 %95 + %97 = OpConstant %6 12 + %98 = OpConstantComposite %9 %95 %97 %95 %87 + %99 = OpConstant %6 16 + %100 = OpConstantComposite %9 %99 %95 %87 %87 + %101 = OpConstant %6 22 + %102 = OpConstantComposite %9 %97 %101 %87 %87 + %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102 + %108 = OpTypePointer Function %86 + %115 = OpConstant %21 16 + %116 = OpTypeArray %9 %115 + %117 = OpConstant %6 0 + %118 = OpConstantComposite %9 %117 %117 %117 %71 + %119 = OpConstantComposite %9 %70 %117 %117 %71 + %120 = OpConstantComposite %9 %117 %70 %117 %71 + %121 = OpConstantComposite %9 %70 %70 %117 %71 + %122 = OpConstantComposite %9 %117 %117 %70 %71 + %123 = OpConstantComposite %9 %70 %117 %70 %71 + %124 = OpConstantComposite %9 %117 %70 %70 %71 + %125 = OpConstantComposite %9 %70 %70 %70 %71 + %126 = OpConstantComposite %9 %71 %117 %117 %71 + %127 = OpConstantComposite %9 %117 %71 %117 %71 + %128 = OpConstantComposite %9 %71 %71 %117 %71 + %129 = OpConstantComposite %9 %117 %117 %71 %71 + %130 = OpConstantComposite %9 %71 %117 %71 %71 + %131 = OpConstantComposite %9 %117 %71 %71 %71 + %132 = OpConstantComposite %9 %71 %71 %71 %71 + %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132 + %146 = OpConstant %73 9 + %149 = OpConstant %73 11 + %151 = OpConstant %73 16 + %153 = OpTypePointer Function %116 + %158 = OpConstant %73 1 + %164 = OpTypePointer Input %9 + %165 = OpVariable %164 Input + %168 = OpTypeStruct %7 + %169 = OpTypePointer Uniform %168 + %170 = OpVariable %169 Uniform + %171 = OpTypePointer Uniform %7 + %176 = OpConstant %6 32 + %179 = OpTypePointer Output %9 + %180 = OpVariable %179 Output + %386 = OpConstantComposite %9 %117 %117 %117 %117 + %387 = OpConstantComposite %86 %386 %386 %386 %386 %386 %386 %386 %386 + %498 = OpConstant %6 0 + %499 = OpConstantComposite %9 %498 %498 %498 %498 + %503 = OpConstantComposite %86 %499 %499 %499 %499 %499 %499 %499 %499 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %389 = OpVariable %108 Function %387 + %199 = OpVariable %108 Function + %200 = OpVariable %108 Function + %201 = OpVariable %108 Function + %202 = OpVariable %153 Function + OpStore %389 %103 + %388 = OpLoad %86 %389 + %166 = OpLoad %9 %165 + %167 = OpVectorShuffle %7 %166 %166 0 1 + %172 = OpAccessChain %171 %170 %76 + %173 = OpLoad %7 %172 + %174 = OpFDiv %7 %167 %173 + %177 = OpVectorTimesScalar %7 %174 %176 + %178 = OpExtInst %7 %1 Floor %177 + OpBranch %205 + %205 = OpLabel + %280 = OpPhi %9 %72 %5 %285 %233 + %279 = OpPhi %73 %76 %5 %235 %233 + %208 = OpSLessThan %11 %279 %83 + OpLoopMerge %236 %233 None + OpBranchConditional %208 %209 %236 + %209 = OpLabel + OpStore %199 %388 + %212 = OpAccessChain %10 %199 %279 + %213 = OpLoad %9 %212 + OpSelectionMerge %277 None + OpSwitch %22 %242 + %242 = OpLabel + %244 = OpCompositeExtract %6 %178 0 + %246 = OpCompositeExtract %6 %213 0 + %247 = OpFOrdLessThan %11 %244 %246 + OpSelectionMerge %249 None + OpBranchConditional %247 %248 %249 + %248 = OpLabel + OpBranch %277 + %249 = OpLabel + %251 = OpCompositeExtract %6 %178 1 + %253 = OpCompositeExtract %6 %213 1 + %254 = OpFOrdLessThan %11 %251 %253 + OpSelectionMerge %256 None + OpBranchConditional %254 %255 %256 + %255 = OpLabel + OpBranch %277 + %256 = OpLabel + %262 = OpCompositeExtract %6 %213 2 + %263 = OpFAdd %6 %246 %262 + %264 = OpFOrdGreaterThan %11 %244 %263 + OpSelectionMerge %266 None + OpBranchConditional %264 %265 %266 + %265 = OpLabel + OpBranch %277 + %266 = OpLabel + %272 = OpCompositeExtract %6 %213 3 + %273 = OpFAdd %6 %253 %272 + %274 = OpFOrdGreaterThan %11 %251 %273 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + OpBranch %277 + %276 = OpLabel + OpBranch %277 + %277 = OpLabel + %282 = OpPhi %11 %31 %248 %31 %255 %31 %265 %31 %275 %66 %276 + OpSelectionMerge %232 None + OpBranchConditional %282 %215 %232 + %215 = OpLabel + OpStore %200 %103 + %217 = OpAccessChain %23 %200 %279 %22 + %218 = OpLoad %6 %217 + %219 = OpConvertFToS %73 %218 + OpStore %201 %103 + %221 = OpAccessChain %23 %201 %279 %33 + %222 = OpLoad %6 %221 + %516 = OpLoad %86 %389 + OpStore %389 %503 + OpStore %389 %516 + %223 = OpConvertFToS %73 %222 + %224 = OpIMul %73 %219 %223 + %226 = OpIMul %73 %279 %146 + %227 = OpIAdd %73 %224 %226 + %228 = OpIAdd %73 %227 %149 + %229 = OpSMod %73 %228 %151 + OpStore %202 %133 + %230 = OpAccessChain %10 %202 %229 + %231 = OpLoad %9 %230 + OpBranch %232 + %232 = OpLabel + %285 = OpPhi %9 %280 %277 %231 %215 + OpBranch %233 + %233 = OpLabel + %235 = OpIAdd %73 %279 %158 + OpBranch %205 + %236 = OpLabel + OpStore %180 %280 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_2_vertex_shader PASSTHROUGH + +SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 504 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %165 %180 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %165 "gl_FragCoord" + OpName %168 "buf0" + OpMemberName %168 0 "resolution" + OpName %170 "" + OpName %180 "_GLF_color" + OpDecorate %165 BuiltIn FragCoord + OpMemberDecorate %168 0 Offset 0 + OpDecorate %168 Block + OpDecorate %170 DescriptorSet 0 + OpDecorate %170 Binding 0 + OpDecorate %180 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %9 = OpTypeVector %6 4 + %10 = OpTypePointer Function %9 + %11 = OpTypeBool + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Function %6 + %31 = OpConstantFalse %11 + %33 = OpConstant %21 1 + %66 = OpConstantTrue %11 + %70 = OpConstant %6 0.5 + %71 = OpConstant %6 1 + %72 = OpConstantComposite %9 %70 %70 %71 %71 + %73 = OpTypeInt 32 1 + %76 = OpConstant %73 0 + %83 = OpConstant %73 8 + %85 = OpConstant %21 8 + %86 = OpTypeArray %9 %85 + %87 = OpConstant %6 4 + %88 = OpConstant %6 20 + %89 = OpConstantComposite %9 %87 %87 %88 %87 + %90 = OpConstantComposite %9 %87 %87 %87 %88 + %91 = OpConstantComposite %9 %87 %88 %88 %87 + %92 = OpConstant %6 8 + %93 = OpConstantComposite %9 %88 %87 %87 %92 + %94 = OpConstant %6 6 + %95 = OpConstant %6 2 + %96 = OpConstantComposite %9 %92 %94 %87 %95 + %97 = OpConstant %6 12 + %98 = OpConstantComposite %9 %95 %97 %95 %87 + %99 = OpConstant %6 16 + %100 = OpConstantComposite %9 %99 %95 %87 %87 + %101 = OpConstant %6 22 + %102 = OpConstantComposite %9 %97 %101 %87 %87 + %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102 + %108 = OpTypePointer Function %86 + %115 = OpConstant %21 16 + %116 = OpTypeArray %9 %115 + %117 = OpConstant %6 0 + %118 = OpConstantComposite %9 %117 %117 %117 %71 + %119 = OpConstantComposite %9 %70 %117 %117 %71 + %120 = OpConstantComposite %9 %117 %70 %117 %71 + %121 = OpConstantComposite %9 %70 %70 %117 %71 + %122 = OpConstantComposite %9 %117 %117 %70 %71 + %123 = OpConstantComposite %9 %70 %117 %70 %71 + %124 = OpConstantComposite %9 %117 %70 %70 %71 + %125 = OpConstantComposite %9 %70 %70 %70 %71 + %126 = OpConstantComposite %9 %71 %117 %117 %71 + %127 = OpConstantComposite %9 %117 %71 %117 %71 + %128 = OpConstantComposite %9 %71 %71 %117 %71 + %129 = OpConstantComposite %9 %117 %117 %71 %71 + %130 = OpConstantComposite %9 %71 %117 %71 %71 + %131 = OpConstantComposite %9 %117 %71 %71 %71 + %132 = OpConstantComposite %9 %71 %71 %71 %71 + %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132 + %146 = OpConstant %73 9 + %149 = OpConstant %73 11 + %151 = OpConstant %73 16 + %153 = OpTypePointer Function %116 + %158 = OpConstant %73 1 + %164 = OpTypePointer Input %9 + %165 = OpVariable %164 Input + %168 = OpTypeStruct %7 + %169 = OpTypePointer Uniform %168 + %170 = OpVariable %169 Uniform + %171 = OpTypePointer Uniform %7 + %176 = OpConstant %6 32 + %179 = OpTypePointer Output %9 + %180 = OpVariable %179 Output + %386 = OpConstantComposite %9 %117 %117 %117 %117 + %387 = OpConstantComposite %86 %386 %386 %386 %386 %386 %386 %386 %386 + %498 = OpConstant %6 0 + %499 = OpConstantComposite %9 %498 %498 %498 %498 + %503 = OpConstantComposite %86 %499 %499 %499 %499 %499 %499 %499 %499 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %389 = OpVariable %108 Function %387 + %199 = OpVariable %108 Function + %200 = OpVariable %108 Function + %201 = OpVariable %108 Function + %202 = OpVariable %153 Function + OpStore %389 %103 + %388 = OpLoad %86 %389 + %166 = OpLoad %9 %165 + %167 = OpVectorShuffle %7 %166 %166 0 1 + %172 = OpAccessChain %171 %170 %76 + %173 = OpLoad %7 %172 + %174 = OpFDiv %7 %167 %173 + %177 = OpVectorTimesScalar %7 %174 %176 + %178 = OpExtInst %7 %1 Floor %177 + OpBranch %205 + %205 = OpLabel + %280 = OpPhi %9 %72 %5 %285 %233 + %279 = OpPhi %73 %76 %5 %235 %233 + %208 = OpSLessThan %11 %279 %83 + OpLoopMerge %236 %233 None + OpBranchConditional %208 %209 %236 + %209 = OpLabel + OpStore %199 %388 + %212 = OpAccessChain %10 %199 %279 + %213 = OpLoad %9 %212 + OpSelectionMerge %277 None + OpSwitch %22 %242 + %242 = OpLabel + %244 = OpCompositeExtract %6 %178 0 + %246 = OpCompositeExtract %6 %213 0 + %247 = OpFOrdLessThan %11 %244 %246 + OpSelectionMerge %249 None + OpBranchConditional %247 %248 %249 + %248 = OpLabel + OpBranch %277 + %249 = OpLabel + %251 = OpCompositeExtract %6 %178 1 + %253 = OpCompositeExtract %6 %213 1 + %254 = OpFOrdLessThan %11 %251 %253 + OpSelectionMerge %256 None + OpBranchConditional %254 %255 %256 + %255 = OpLabel + OpBranch %277 + %256 = OpLabel + %262 = OpCompositeExtract %6 %213 2 + %263 = OpFAdd %6 %246 %262 + %264 = OpFOrdGreaterThan %11 %244 %263 + OpSelectionMerge %266 None + OpBranchConditional %264 %265 %266 + %265 = OpLabel + OpBranch %277 + %266 = OpLabel + %272 = OpCompositeExtract %6 %213 3 + %273 = OpFAdd %6 %253 %272 + %274 = OpFOrdGreaterThan %11 %251 %273 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + OpBranch %277 + %276 = OpLabel + OpBranch %277 + %277 = OpLabel + %282 = OpPhi %11 %31 %248 %31 %255 %31 %265 %31 %275 %66 %276 + OpSelectionMerge %232 None + OpBranchConditional %282 %215 %232 + %215 = OpLabel + OpStore %200 %103 + %217 = OpAccessChain %23 %200 %279 %22 + %218 = OpLoad %6 %217 + %219 = OpConvertFToS %73 %218 + OpStore %201 %103 + %221 = OpAccessChain %23 %201 %279 %33 + %222 = OpLoad %6 %221 + %223 = OpConvertFToS %73 %222 + %224 = OpIMul %73 %219 %223 + %226 = OpIMul %73 %279 %146 + %227 = OpIAdd %73 %224 %226 + %228 = OpIAdd %73 %227 %149 + %229 = OpSMod %73 %228 %151 + OpStore %202 %133 + %230 = OpAccessChain %10 %202 %229 + %231 = OpLoad %9 %230 + OpBranch %232 + %232 = OpLabel + %285 = OpPhi %9 %280 %277 %231 %215 + OpBranch %233 + %233 = OpLabel + %235 = OpIAdd %73 %279 %158 + OpBranch %205 + %236 = OpLabel + OpStore %180 %280 + OpReturn + OpFunctionEnd +END + +# uniforms for variant_2 + +# resolution +BUFFER variant_2_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_2_pipeline + ATTACH variant_2_vertex_shader + ATTACH variant_2_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_2_framebuffer AS color LOCATION 0 + BIND BUFFER variant_2_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_2_pipeline 0 0 0 255 + +CLEAR variant_2_pipeline +RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-sampler-loop-extra-instructions.amber b/vulkan/amber/graphicsfuzz/spv-stable-sampler-loop-extra-instructions.amber new file mode 100644 index 0000000..8112b80 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-sampler-loop-extra-instructions.amber @@ -0,0 +1,398 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with irrelevant extra instructions + +# The test passes because both shaders render the same image. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 %73 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "i" + OpName %13 "coord" + OpName %16 "gl_FragCoord" + OpName %22 "texel" + OpName %26 "tex" + OpName %73 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %16 BuiltIn FragCoord + OpDecorate %26 RelaxedPrecision + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 0 + OpDecorate %27 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %69 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %73 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 2 + %12 = OpTypePointer Function %11 + %14 = OpTypeVector %10 4 + %15 = OpTypePointer Input %14 + %16 = OpVariable %15 Input + %19 = OpConstant %10 0.00390625 + %21 = OpTypePointer Function %14 + %23 = OpTypeImage %10 2D 0 0 0 1 Unknown + %24 = OpTypeSampledImage %23 + %25 = OpTypePointer UniformConstant %24 + %26 = OpVariable %25 UniformConstant + %35 = OpTypeInt 32 0 + %36 = OpConstant %35 0 + %37 = OpTypePointer Function %10 + %40 = OpConstant %35 1 + %44 = OpConstant %35 2 + %48 = OpConstant %10 1 + %49 = OpTypeBool + %52 = OpConstant %6 16 + %61 = OpConstant %10 256 + %70 = OpConstant %6 1 + %72 = OpTypePointer Output %14 + %73 = OpVariable %72 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %13 = OpVariable %12 Function + %22 = OpVariable %21 Function + OpStore %8 %9 + %17 = OpLoad %14 %16 + %18 = OpVectorShuffle %11 %17 %17 0 1 + %20 = OpVectorTimesScalar %11 %18 %19 + OpStore %13 %20 + %27 = OpLoad %24 %26 + %28 = OpLoad %11 %13 + %29 = OpImageSampleImplicitLod %14 %27 %28 + OpStore %22 %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %38 = OpAccessChain %37 %22 %36 + %39 = OpLoad %10 %38 + %41 = OpAccessChain %37 %22 %40 + %42 = OpLoad %10 %41 + %43 = OpFAdd %10 %39 %42 + %45 = OpAccessChain %37 %22 %44 + %46 = OpLoad %10 %45 + %47 = OpFAdd %10 %43 %46 + %50 = OpFOrdGreaterThan %49 %47 %48 + %51 = OpLoad %6 %8 + %53 = OpSLessThan %49 %51 %52 + %54 = OpLogicalAnd %49 %50 %53 + OpBranchConditional %54 %31 %32 + %31 = OpLabel + %55 = OpLoad %14 %22 + %56 = OpVectorShuffle %11 %55 %55 0 2 + %57 = OpLoad %14 %22 + %58 = OpVectorShuffle %11 %57 %57 1 1 + %59 = OpFAdd %11 %56 %58 + OpStore %13 %59 + %60 = OpLoad %11 %13 + %62 = OpVectorTimesScalar %11 %60 %61 + %63 = OpExtInst %11 %1 Floor %62 + %64 = OpCompositeConstruct %11 %61 %61 + %65 = OpFDiv %11 %63 %64 + OpStore %13 %65 + %66 = OpLoad %24 %26 + %67 = OpLoad %11 %13 + %68 = OpImageSampleImplicitLod %14 %66 %67 + OpStore %22 %68 + %69 = OpLoad %6 %8 + %71 = OpIAdd %6 %69 %70 + OpStore %8 %71 + OpBranch %33 + %33 = OpLabel + OpBranch %30 + %32 = OpLabel + %74 = OpLoad %14 %22 + OpStore %73 %74 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# tex +SAMPLER reference_tex + + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER reference_tex DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 377 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 %73 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %8 "i" + OpName %13 "coord" + OpName %16 "gl_FragCoord" + OpName %22 "texel" + OpName %26 "tex" + OpName %73 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %16 BuiltIn FragCoord + OpDecorate %26 RelaxedPrecision + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 0 + OpDecorate %27 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %69 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %73 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 2 + %12 = OpTypePointer Function %11 + %14 = OpTypeVector %10 4 + %15 = OpTypePointer Input %14 + %16 = OpVariable %15 Input + %19 = OpConstant %10 0.00390625 + %21 = OpTypePointer Function %14 + %23 = OpTypeImage %10 2D 0 0 0 1 Unknown + %24 = OpTypeSampledImage %23 + %25 = OpTypePointer UniformConstant %24 + %26 = OpVariable %25 UniformConstant + %35 = OpTypeInt 32 0 + %36 = OpConstant %35 0 + %37 = OpTypePointer Function %10 + %40 = OpConstant %35 1 + %44 = OpConstant %35 2 + %48 = OpConstant %10 1 + %49 = OpTypeBool + %52 = OpConstant %6 16 + %61 = OpConstant %10 256 + %70 = OpConstant %6 1 + %72 = OpTypePointer Output %14 + %73 = OpVariable %72 Output + %178 = OpTypeVector %6 3 + %179 = OpTypeVector %6 4 + %180 = OpTypeVector %35 2 + %181 = OpTypeVector %35 3 + %182 = OpTypeVector %10 3 + %183 = OpTypeMatrix %182 2 + %187 = OpTypeMatrix %14 4 + %222 = OpConstantComposite %180 %36 %36 + %225 = OpConstant %10 0 + %226 = OpConstantComposite %11 %225 %225 + %231 = OpConstantComposite %14 %225 %225 %225 %225 + %265 = OpTypeStruct %180 %180 + %267 = OpTypeStruct %35 %35 + %279 = OpTypePointer Function %265 + %280 = OpConstantComposite %265 %222 %222 + %294 = OpConstant %35 3 + %323 = OpTypePointer Function %35 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %293 = OpVariable %12 Function %226 + %288 = OpVariable %21 Function %231 + %281 = OpVariable %279 Function %280 + %8 = OpVariable %7 Function + %13 = OpVariable %12 Function + %22 = OpVariable %21 Function + %188 = OpCompositeConstruct %180 %44 %40 + OpStore %8 %9 + %266 = OpIAddCarry %265 %188 %222 + %299 = OpULessThanEqual %49 %9 %70 + %344 = OpULessThanEqual %49 %294 %294 + %345 = OpSelect %35 %344 %294 %294 + OpStore %281 %266 + %346 = OpAccessChain %37 %288 %345 + %300 = OpSelect %6 %299 %9 %70 + %301 = OpAccessChain %37 %293 %300 + %17 = OpLoad %14 %16 + %360 = OpULessThanEqual %49 %36 %294 + %361 = OpSelect %35 %360 %36 %294 + %362 = OpAccessChain %37 %22 %361 + %223 = OpCompositeExtract %180 %266 0 + %189 = OpCompositeConstruct %14 %19 %19 %61 %61 + %18 = OpVectorShuffle %11 %17 %17 0 1 + %20 = OpVectorTimesScalar %11 %18 %19 + %227 = OpFSub %11 %20 %226 + %190 = OpCompositeConstruct %182 %61 %48 %48 + %228 = OpFSub %10 %48 %225 + OpStore %13 %20 + %191 = OpCompositeConstruct %180 %36 %40 + %27 = OpLoad %24 %26 + %28 = OpLoad %11 %13 + %29 = OpImageSampleImplicitLod %14 %27 %28 + OpStore %22 %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %38 = OpAccessChain %37 %22 %36 + %39 = OpLoad %10 %38 + %41 = OpAccessChain %37 %22 %40 + %42 = OpLoad %10 %41 + %232 = OpFSub %14 %189 %231 + %43 = OpFAdd %10 %39 %42 + %45 = OpAccessChain %37 %22 %44 + %46 = OpLoad %10 %45 + %47 = OpFAdd %10 %43 %46 + %234 = OpCopyObject %10 %61 + %50 = OpFOrdGreaterThan %49 %47 %48 + %235 = OpISub %35 %40 %36 + %51 = OpLoad %6 %8 + %53 = OpSLessThan %49 %51 %52 + %54 = OpLogicalAnd %49 %50 %53 + OpBranchConditional %54 %31 %32 + %31 = OpLabel + %55 = OpLoad %14 %22 + %56 = OpVectorShuffle %11 %55 %55 0 2 + %57 = OpLoad %14 %22 + %58 = OpVectorShuffle %11 %57 %57 1 1 + %59 = OpFAdd %11 %56 %58 + OpStore %13 %59 + %60 = OpLoad %11 %13 + %268 = OpUMulExtended %267 %36 %40 + %321 = OpULessThanEqual %49 %9 %70 + %322 = OpSelect %6 %321 %9 %70 + %324 = OpAccessChain %323 %281 %40 %322 + %243 = OpCompositeExtract %35 %268 0 + %62 = OpVectorTimesScalar %11 %60 %61 + %63 = OpExtInst %11 %1 Floor %62 + %64 = OpCompositeConstruct %11 %61 %61 + %65 = OpFDiv %11 %63 %64 + %205 = OpCompositeConstruct %181 %188 %40 + OpStore %13 %65 + %66 = OpLoad %24 %26 + %67 = OpLoad %11 %13 + %68 = OpImageSampleImplicitLod %14 %66 %67 + OpStore %22 %68 + %69 = OpLoad %6 %8 + %71 = OpIAdd %6 %69 %70 + %376 = OpAccessChain %323 %324 + %207 = OpCompositeConstruct %183 %190 %190 + OpStore %376 %361 + %244 = OpFMul %10 %234 %48 + OpStore %8 %71 + OpBranch %33 + %33 = OpLabel + %208 = OpCompositeConstruct %14 %39 %42 %58 + OpBranch %30 + %32 = OpLabel + %209 = OpCompositeConstruct %183 %190 %190 + %74 = OpLoad %14 %22 + OpStore %73 %74 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# tex +SAMPLER variant_tex + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/spv-stable-sampler-polar-simple-O-access-chain.amber b/vulkan/amber/graphicsfuzz/spv-stable-sampler-polar-simple-O-access-chain.amber new file mode 100644 index 0000000..7773801 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/spv-stable-sampler-polar-simple-O-access-chain.amber @@ -0,0 +1,369 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Equivalent shaders, one with an additional access chain + +# The test passes because both shaders render the same image. + +SHADER vertex texgen_vert PASSTHROUGH + +SHADER fragment texgen_frag GLSL +#version 430 +precision highp float; + +layout(location = 0) out vec4 _GLF_color; + +void main() +{ + _GLF_color = vec4( + floor(gl_FragCoord.x) * (1.0 / 255.0), + (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0), + floor(gl_FragCoord.y) * (1.0 / 255.0), + 1.0); +} +END +BUFFER default_texture FORMAT B8G8R8A8_UNORM + +PIPELINE graphics texgen_pipeline + ATTACH texgen_vert + ATTACH texgen_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER default_texture AS color LOCATION 0 +END + +CLEAR_COLOR texgen_pipeline 0 0 0 255 +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +SHADER vertex reference_vertex_shader PASSTHROUGH + +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 254 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %115 %130 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %115 "gl_FragCoord" + OpName %130 "_GLF_color" + OpName %134 "tex" + OpDecorate %115 BuiltIn FragCoord + OpDecorate %130 Location 0 + OpDecorate %134 RelaxedPrecision + OpDecorate %134 DescriptorSet 0 + OpDecorate %134 Binding 0 + OpDecorate %135 RelaxedPrecision + OpDecorate %137 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %19 = OpConstant %6 0.318309873 + %22 = OpConstant %6 0.00100000005 + %23 = OpTypeBool + %27 = OpConstant %6 0 + %32 = OpTypeInt 32 0 + %36 = OpConstant %32 0 + %55 = OpConstant %6 0.970000029 + %56 = OpConstant %6 0.189999998 + %73 = OpConstant %6 0.5 + %81 = OpConstant %6 1 + %98 = OpConstantComposite %7 %73 %73 + %113 = OpTypeVector %6 4 + %114 = OpTypePointer Input %113 + %115 = OpVariable %114 Input + %118 = OpConstant %6 0.00390625 + %124 = OpConstant %6 256 + %129 = OpTypePointer Output %113 + %130 = OpVariable %129 Output + %131 = OpTypeImage %6 2D 0 0 0 1 Unknown + %132 = OpTypeSampledImage %131 + %133 = OpTypePointer UniformConstant %132 + %134 = OpVariable %133 UniformConstant + %253 = OpConstantComposite %7 %118 %118 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %116 = OpLoad %113 %115 + %117 = OpVectorShuffle %7 %116 %116 0 1 + %119 = OpVectorTimesScalar %7 %117 %118 + %160 = OpFSub %7 %119 %98 + %162 = OpExtInst %6 %1 Length %160 + OpSelectionMerge %235 None + OpSwitch %36 %176 + %176 = OpLabel + %179 = OpFOrdLessThan %23 %162 %22 + OpSelectionMerge %181 None + OpBranchConditional %179 %180 %181 + %180 = OpLabel + OpBranch %235 + %181 = OpLabel + %183 = OpExtInst %7 %1 FAbs %160 + %185 = OpCompositeExtract %6 %183 1 + %187 = OpCompositeExtract %6 %183 0 + %188 = OpFOrdGreaterThan %23 %185 %187 + OpSelectionMerge %201 None + OpBranchConditional %188 %189 %195 + %189 = OpLabel + %194 = OpFDiv %6 %187 %185 + OpBranch %201 + %195 = OpLabel + %200 = OpFDiv %6 %185 %187 + OpBranch %201 + %201 = OpLabel + %247 = OpPhi %6 %194 %189 %200 %195 + %203 = OpFMul %6 %56 %247 + %205 = OpFMul %6 %203 %247 + %206 = OpFSub %6 %55 %205 + %208 = OpFMul %6 %206 %247 + %210 = OpFMul %6 %208 %19 + %215 = OpFOrdLessThan %23 %185 %187 + OpSelectionMerge %219 None + OpBranchConditional %215 %216 %219 + %216 = OpLabel + %218 = OpFSub %6 %73 %210 + OpBranch %219 + %219 = OpLabel + %248 = OpPhi %6 %210 %201 %218 %216 + %221 = OpCompositeExtract %6 %160 0 + %222 = OpFOrdLessThan %23 %221 %27 + OpSelectionMerge %226 None + OpBranchConditional %222 %223 %226 + %223 = OpLabel + %225 = OpFSub %6 %81 %248 + OpBranch %226 + %226 = OpLabel + %249 = OpPhi %6 %248 %219 %225 %223 + %228 = OpCompositeExtract %6 %160 1 + %229 = OpFOrdLessThan %23 %228 %27 + OpSelectionMerge %233 None + OpBranchConditional %229 %230 %233 + %230 = OpLabel + %232 = OpFNegate %6 %249 + OpBranch %233 + %233 = OpLabel + %250 = OpPhi %6 %249 %226 %232 %230 + OpBranch %235 + %235 = OpLabel + %251 = OpPhi %6 %27 %180 %250 %233 + %167 = OpCompositeConstruct %7 %162 %251 + %125 = OpVectorTimesScalar %7 %167 %124 + %126 = OpExtInst %7 %1 Floor %125 + %128 = OpFMul %7 %126 %253 + %135 = OpLoad %132 %134 + %137 = OpImageSampleImplicitLod %113 %135 %128 + %140 = OpCompositeExtract %6 %137 0 + %141 = OpCompositeExtract %6 %137 1 + %142 = OpCompositeExtract %6 %137 2 + %143 = OpCompositeConstruct %113 %140 %141 %142 %81 + OpStore %130 %143 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# tex +SAMPLER reference_tex + + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER reference_tex DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 529 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %115 %130 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %115 "gl_FragCoord" + OpName %130 "_GLF_color" + OpName %134 "tex" + OpDecorate %115 BuiltIn FragCoord + OpDecorate %130 Location 0 + OpDecorate %134 RelaxedPrecision + OpDecorate %134 DescriptorSet 0 + OpDecorate %134 Binding 0 + OpDecorate %135 RelaxedPrecision + OpDecorate %137 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %19 = OpConstant %6 0.318309873 + %22 = OpConstant %6 0.00100000005 + %23 = OpTypeBool + %27 = OpConstant %6 0 + %32 = OpTypeInt 32 0 + %36 = OpConstant %32 0 + %55 = OpConstant %6 0.970000029 + %56 = OpConstant %6 0.189999998 + %73 = OpConstant %6 0.5 + %81 = OpConstant %6 1 + %98 = OpConstantComposite %7 %73 %73 + %113 = OpTypeVector %6 4 + %114 = OpTypePointer Input %113 + %115 = OpVariable %114 Input + %118 = OpConstant %6 0.00390625 + %124 = OpConstant %6 256 + %129 = OpTypePointer Output %113 + %130 = OpVariable %129 Output + %131 = OpTypeImage %6 2D 0 0 0 1 Unknown + %132 = OpTypeSampledImage %131 + %133 = OpTypePointer UniformConstant %132 + %134 = OpVariable %133 UniformConstant + %253 = OpConstantComposite %7 %118 %118 + %379 = OpTypeInt 32 1 + %380 = OpConstant %379 3 + %383 = OpConstant %379 0 + %384 = OpTypePointer Input %6 + %475 = OpConstantFalse %23 + %526 = OpTypePointer Function %23 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %527 = OpVariable %526 Function %475 + %116 = OpLoad %113 %115 + %117 = OpVectorShuffle %7 %116 %116 0 1 + %119 = OpVectorTimesScalar %7 %117 %118 + %160 = OpFSub %7 %119 %98 + %162 = OpExtInst %6 %1 Length %160 + OpSelectionMerge %235 None + OpSwitch %36 %176 + %176 = OpLabel + %179 = OpFOrdLessThan %23 %162 %22 + OpSelectionMerge %181 None + OpBranchConditional %179 %180 %181 + %180 = OpLabel + OpBranch %235 + %181 = OpLabel + %183 = OpExtInst %7 %1 FAbs %160 + %185 = OpCompositeExtract %6 %183 1 + %187 = OpCompositeExtract %6 %183 0 + %188 = OpFOrdGreaterThan %23 %185 %187 + OpSelectionMerge %201 None + OpBranchConditional %188 %189 %195 + %189 = OpLabel + %194 = OpFDiv %6 %187 %185 + OpBranch %201 + %195 = OpLabel + %200 = OpFDiv %6 %185 %187 + OpBranch %201 + %201 = OpLabel + %247 = OpPhi %6 %194 %189 %200 %195 + %203 = OpFMul %6 %56 %247 + %205 = OpFMul %6 %203 %247 + %206 = OpFSub %6 %55 %205 + %208 = OpFMul %6 %206 %247 + %210 = OpFMul %6 %208 %19 + %215 = OpFOrdLessThan %23 %185 %187 + OpSelectionMerge %219 None + OpBranchConditional %215 %216 %219 + %216 = OpLabel + %218 = OpFSub %6 %73 %210 + OpBranch %219 + %219 = OpLabel + %248 = OpPhi %6 %210 %201 %218 %216 + %221 = OpCompositeExtract %6 %160 0 + %222 = OpFOrdLessThan %23 %221 %27 + OpSelectionMerge %226 None + OpBranchConditional %222 %223 %226 + %223 = OpLabel + %225 = OpFSub %6 %81 %248 + OpBranch %226 + %226 = OpLabel + %249 = OpPhi %6 %248 %219 %225 %223 + %228 = OpCompositeExtract %6 %160 1 + %229 = OpFOrdLessThan %23 %228 %27 + OpSelectionMerge %233 None + OpBranchConditional %229 %230 %233 + %230 = OpLabel + %232 = OpFNegate %6 %249 + OpBranch %233 + %233 = OpLabel + %250 = OpPhi %6 %249 %226 %232 %230 + OpBranch %235 + %235 = OpLabel + %251 = OpPhi %6 %27 %180 %250 %233 + %167 = OpCompositeConstruct %7 %162 %251 + %125 = OpVectorTimesScalar %7 %167 %124 + %126 = OpExtInst %7 %1 Floor %125 + %128 = OpFMul %7 %126 %253 + %135 = OpLoad %132 %134 + %137 = OpImageSampleImplicitLod %113 %135 %128 + %140 = OpCompositeExtract %6 %137 0 + %141 = OpCompositeExtract %6 %137 1 + %142 = OpCompositeExtract %6 %137 2 + OpStore %527 %179 + %528 = OpLoad %23 %527 + %381 = OpULessThanEqual %23 %383 %380 + %382 = OpSelect %379 %381 %383 %380 + %385 = OpAccessChain %384 %115 %382 + %143 = OpCompositeConstruct %113 %140 %141 %142 %81 + OpStore %130 %143 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# tex +SAMPLER variant_tex + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop.amber b/vulkan/amber/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop.amber new file mode 100644 index 0000000..31b316e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop.amber @@ -0,0 +1,2115 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with always false if with discard loop + +# The test passes because both shaders render the same image. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 230f363e6da32791f640b02205e0645cc67c3f1d + + + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct BST +# { +# int data; +# int leftIndex; +# int rightIndex; +# }; +# +# BST tree[10]; +# +# void makeTreeNode(inout BST tree, int data) +# { +# tree.data = data; +# tree.leftIndex = -1; +# tree.rightIndex = -1; +# } +# void insert(int treeIndex, int data) +# { +# int baseIndex = 0; +# while (baseIndex <= treeIndex) +# { +# if (data <= tree[baseIndex].data) +# { +# if (tree[baseIndex].leftIndex == -1) +# { +# tree[baseIndex].leftIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].leftIndex; +# continue; +# } +# } +# else +# { +# if (tree[baseIndex].rightIndex == -1) +# { +# tree[baseIndex].rightIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].rightIndex; +# continue; +# } +# } +# } +# } +# int search(int target) +# { +# BST currentNode; +# int index = 0; +# while (index != -1) +# { +# currentNode = tree[index]; +# if (currentNode.data == target) +# { +# return target; +# } +# index = target > currentNode.data ? currentNode.rightIndex : currentNode.leftIndex; +# } +# return -1; +# } +# void main() +# { +# int treeIndex = 0; +# makeTreeNode(tree[0], 9); +# treeIndex++; +# insert(treeIndex, 5); +# treeIndex++; +# insert(treeIndex, 12); +# treeIndex++; +# insert(treeIndex, 15); +# treeIndex++; +# insert(treeIndex, 7); +# treeIndex++; +# insert(treeIndex, 8); +# treeIndex++; +# insert(treeIndex, 2); +# treeIndex++; +# insert(treeIndex, 6); +# treeIndex++; +# insert(treeIndex, 17); +# treeIndex++; +# insert(treeIndex, 13); +# int count = 0; +# for (int i = 0; i < 20; i++) +# { +# int result = search(i); +# switch (i) +# { +# case 9: +# case 5: +# case 12: +# case 15: +# case 7: +# case 8: +# case 2: +# case 6: +# case 17: +# case 13: +# if (result == i) +# { +# count++; +# } +# break; +# default: +# if (result == -1) +# { +# count++; +# } +# break; +# } +# } +# if (count == 20) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 1.0, 1.0); +# } +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 1372 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %254 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "BST" + OpMemberName %7 0 "data" + OpMemberName %7 1 "leftIndex" + OpMemberName %7 2 "rightIndex" + OpName %47 "tree" + OpName %254 "_GLF_color" + OpDecorate %254 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypePointer Function %6 + %24 = OpConstant %6 0 + %27 = OpConstant %6 1 + %28 = OpConstant %6 -1 + %30 = OpConstant %6 2 + %40 = OpTypeBool + %43 = OpTypeInt 32 0 + %44 = OpConstant %43 10 + %45 = OpTypeArray %7 %44 + %141 = OpConstant %6 9 + %151 = OpConstant %6 5 + %158 = OpConstant %6 12 + %165 = OpConstant %6 15 + %172 = OpConstant %6 7 + %179 = OpConstant %6 8 + %192 = OpConstant %6 6 + %199 = OpConstant %6 17 + %206 = OpConstant %6 13 + %219 = OpConstant %6 20 + %251 = OpTypeFloat 32 + %252 = OpTypeVector %251 4 + %253 = OpTypePointer Output %252 + %254 = OpVariable %253 Output + %255 = OpConstant %251 1 + %256 = OpConstant %251 0 + %257 = OpConstantComposite %252 %255 %256 %256 %255 + %259 = OpConstantComposite %252 %256 %256 %255 %255 + %262 = OpConstant %43 0 + %263 = OpConstantFalse %40 + %266 = OpConstantTrue %40 + %1015 = OpTypePointer Function %45 + %1318 = OpUndef %6 + %1359 = OpConstantComposite %7 %141 %28 %28 + %1360 = OpConstantComposite %7 %151 %28 %28 + %1361 = OpConstantComposite %7 %158 %28 %28 + %1362 = OpConstant %6 3 + %1363 = OpConstantComposite %7 %165 %28 %28 + %1364 = OpConstant %6 4 + %1365 = OpConstantComposite %7 %172 %28 %28 + %1366 = OpConstantComposite %7 %179 %28 %28 + %1367 = OpConstantComposite %7 %30 %28 %28 + %1368 = OpConstantComposite %7 %192 %28 %28 + %1369 = OpConstantComposite %7 %199 %28 %28 + %1370 = OpConstantComposite %7 %206 %28 %28 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %47 = OpVariable %1015 Function + %148 = OpAccessChain %8 %47 %24 + OpStore %148 %1359 + OpSelectionMerge %347 None + OpSwitch %262 %288 + %288 = OpLabel + OpBranch %289 + %289 = OpLabel + %1212 = OpPhi %6 %24 %288 %1342 %343 + %293 = OpSLessThanEqual %40 %1212 %27 + OpLoopMerge %344 %343 None + OpBranchConditional %293 %294 %344 + %294 = OpLabel + %297 = OpAccessChain %9 %47 %1212 %24 + %298 = OpLoad %6 %297 + %299 = OpSLessThanEqual %40 %151 %298 + OpSelectionMerge %342 None + OpBranchConditional %299 %300 %321 + %321 = OpLabel + %323 = OpAccessChain %9 %47 %1212 %30 + %324 = OpLoad %6 %323 + %325 = OpIEqual %40 %324 %28 + OpSelectionMerge %341 None + OpBranchConditional %325 %326 %337 + %337 = OpLabel + %340 = OpLoad %6 %323 + OpBranch %343 + %326 = OpLabel + OpStore %323 %27 + %336 = OpAccessChain %8 %47 %27 + OpStore %336 %1360 + OpBranch %344 + %341 = OpLabel + OpUnreachable + %300 = OpLabel + %302 = OpAccessChain %9 %47 %1212 %27 + %303 = OpLoad %6 %302 + %304 = OpIEqual %40 %303 %28 + OpSelectionMerge %320 None + OpBranchConditional %304 %305 %316 + %316 = OpLabel + %319 = OpLoad %6 %302 + OpBranch %343 + %305 = OpLabel + OpStore %302 %27 + %315 = OpAccessChain %8 %47 %27 + OpStore %315 %1360 + OpBranch %344 + %320 = OpLabel + OpUnreachable + %342 = OpLabel + OpUnreachable + %343 = OpLabel + %1342 = OpPhi %6 %319 %316 %340 %337 + OpBranch %289 + %344 = OpLabel + %1213 = OpPhi %40 %263 %289 %266 %305 %266 %326 + OpSelectionMerge %346 None + OpBranchConditional %1213 %347 %346 + %346 = OpLabel + OpBranch %347 + %347 = OpLabel + OpSelectionMerge %424 None + OpSwitch %262 %365 + %365 = OpLabel + OpBranch %366 + %366 = OpLabel + %1220 = OpPhi %6 %24 %365 %1344 %420 + %370 = OpSLessThanEqual %40 %1220 %30 + OpLoopMerge %421 %420 None + OpBranchConditional %370 %371 %421 + %371 = OpLabel + %374 = OpAccessChain %9 %47 %1220 %24 + %375 = OpLoad %6 %374 + %376 = OpSLessThanEqual %40 %158 %375 + OpSelectionMerge %419 None + OpBranchConditional %376 %377 %398 + %398 = OpLabel + %400 = OpAccessChain %9 %47 %1220 %30 + %401 = OpLoad %6 %400 + %402 = OpIEqual %40 %401 %28 + OpSelectionMerge %418 None + OpBranchConditional %402 %403 %414 + %414 = OpLabel + %417 = OpLoad %6 %400 + OpBranch %420 + %403 = OpLabel + OpStore %400 %30 + %413 = OpAccessChain %8 %47 %30 + OpStore %413 %1361 + OpBranch %421 + %418 = OpLabel + OpUnreachable + %377 = OpLabel + %379 = OpAccessChain %9 %47 %1220 %27 + %380 = OpLoad %6 %379 + %381 = OpIEqual %40 %380 %28 + OpSelectionMerge %397 None + OpBranchConditional %381 %382 %393 + %393 = OpLabel + %396 = OpLoad %6 %379 + OpBranch %420 + %382 = OpLabel + OpStore %379 %30 + %392 = OpAccessChain %8 %47 %30 + OpStore %392 %1361 + OpBranch %421 + %397 = OpLabel + OpUnreachable + %419 = OpLabel + OpUnreachable + %420 = OpLabel + %1344 = OpPhi %6 %396 %393 %417 %414 + OpBranch %366 + %421 = OpLabel + %1221 = OpPhi %40 %263 %366 %266 %382 %266 %403 + OpSelectionMerge %423 None + OpBranchConditional %1221 %424 %423 + %423 = OpLabel + OpBranch %424 + %424 = OpLabel + OpSelectionMerge %501 None + OpSwitch %262 %442 + %442 = OpLabel + OpBranch %443 + %443 = OpLabel + %1228 = OpPhi %6 %24 %442 %1345 %497 + %447 = OpSLessThanEqual %40 %1228 %1362 + OpLoopMerge %498 %497 None + OpBranchConditional %447 %448 %498 + %448 = OpLabel + %451 = OpAccessChain %9 %47 %1228 %24 + %452 = OpLoad %6 %451 + %453 = OpSLessThanEqual %40 %165 %452 + OpSelectionMerge %496 None + OpBranchConditional %453 %454 %475 + %475 = OpLabel + %477 = OpAccessChain %9 %47 %1228 %30 + %478 = OpLoad %6 %477 + %479 = OpIEqual %40 %478 %28 + OpSelectionMerge %495 None + OpBranchConditional %479 %480 %491 + %491 = OpLabel + %494 = OpLoad %6 %477 + OpBranch %497 + %480 = OpLabel + OpStore %477 %1362 + %490 = OpAccessChain %8 %47 %1362 + OpStore %490 %1363 + OpBranch %498 + %495 = OpLabel + OpUnreachable + %454 = OpLabel + %456 = OpAccessChain %9 %47 %1228 %27 + %457 = OpLoad %6 %456 + %458 = OpIEqual %40 %457 %28 + OpSelectionMerge %474 None + OpBranchConditional %458 %459 %470 + %470 = OpLabel + %473 = OpLoad %6 %456 + OpBranch %497 + %459 = OpLabel + OpStore %456 %1362 + %469 = OpAccessChain %8 %47 %1362 + OpStore %469 %1363 + OpBranch %498 + %474 = OpLabel + OpUnreachable + %496 = OpLabel + OpUnreachable + %497 = OpLabel + %1345 = OpPhi %6 %473 %470 %494 %491 + OpBranch %443 + %498 = OpLabel + %1229 = OpPhi %40 %263 %443 %266 %459 %266 %480 + OpSelectionMerge %500 None + OpBranchConditional %1229 %501 %500 + %500 = OpLabel + OpBranch %501 + %501 = OpLabel + OpSelectionMerge %578 None + OpSwitch %262 %519 + %519 = OpLabel + OpBranch %520 + %520 = OpLabel + %1236 = OpPhi %6 %24 %519 %1346 %574 + %524 = OpSLessThanEqual %40 %1236 %1364 + OpLoopMerge %575 %574 None + OpBranchConditional %524 %525 %575 + %525 = OpLabel + %528 = OpAccessChain %9 %47 %1236 %24 + %529 = OpLoad %6 %528 + %530 = OpSLessThanEqual %40 %172 %529 + OpSelectionMerge %573 None + OpBranchConditional %530 %531 %552 + %552 = OpLabel + %554 = OpAccessChain %9 %47 %1236 %30 + %555 = OpLoad %6 %554 + %556 = OpIEqual %40 %555 %28 + OpSelectionMerge %572 None + OpBranchConditional %556 %557 %568 + %568 = OpLabel + %571 = OpLoad %6 %554 + OpBranch %574 + %557 = OpLabel + OpStore %554 %1364 + %567 = OpAccessChain %8 %47 %1364 + OpStore %567 %1365 + OpBranch %575 + %572 = OpLabel + OpUnreachable + %531 = OpLabel + %533 = OpAccessChain %9 %47 %1236 %27 + %534 = OpLoad %6 %533 + %535 = OpIEqual %40 %534 %28 + OpSelectionMerge %551 None + OpBranchConditional %535 %536 %547 + %547 = OpLabel + %550 = OpLoad %6 %533 + OpBranch %574 + %536 = OpLabel + OpStore %533 %1364 + %546 = OpAccessChain %8 %47 %1364 + OpStore %546 %1365 + OpBranch %575 + %551 = OpLabel + OpUnreachable + %573 = OpLabel + OpUnreachable + %574 = OpLabel + %1346 = OpPhi %6 %550 %547 %571 %568 + OpBranch %520 + %575 = OpLabel + %1237 = OpPhi %40 %263 %520 %266 %536 %266 %557 + OpSelectionMerge %577 None + OpBranchConditional %1237 %578 %577 + %577 = OpLabel + OpBranch %578 + %578 = OpLabel + OpSelectionMerge %655 None + OpSwitch %262 %596 + %596 = OpLabel + OpBranch %597 + %597 = OpLabel + %1244 = OpPhi %6 %24 %596 %1347 %651 + %601 = OpSLessThanEqual %40 %1244 %151 + OpLoopMerge %652 %651 None + OpBranchConditional %601 %602 %652 + %602 = OpLabel + %605 = OpAccessChain %9 %47 %1244 %24 + %606 = OpLoad %6 %605 + %607 = OpSLessThanEqual %40 %179 %606 + OpSelectionMerge %650 None + OpBranchConditional %607 %608 %629 + %629 = OpLabel + %631 = OpAccessChain %9 %47 %1244 %30 + %632 = OpLoad %6 %631 + %633 = OpIEqual %40 %632 %28 + OpSelectionMerge %649 None + OpBranchConditional %633 %634 %645 + %645 = OpLabel + %648 = OpLoad %6 %631 + OpBranch %651 + %634 = OpLabel + OpStore %631 %151 + %644 = OpAccessChain %8 %47 %151 + OpStore %644 %1366 + OpBranch %652 + %649 = OpLabel + OpUnreachable + %608 = OpLabel + %610 = OpAccessChain %9 %47 %1244 %27 + %611 = OpLoad %6 %610 + %612 = OpIEqual %40 %611 %28 + OpSelectionMerge %628 None + OpBranchConditional %612 %613 %624 + %624 = OpLabel + %627 = OpLoad %6 %610 + OpBranch %651 + %613 = OpLabel + OpStore %610 %151 + %623 = OpAccessChain %8 %47 %151 + OpStore %623 %1366 + OpBranch %652 + %628 = OpLabel + OpUnreachable + %650 = OpLabel + OpUnreachable + %651 = OpLabel + %1347 = OpPhi %6 %627 %624 %648 %645 + OpBranch %597 + %652 = OpLabel + %1245 = OpPhi %40 %263 %597 %266 %613 %266 %634 + OpSelectionMerge %654 None + OpBranchConditional %1245 %655 %654 + %654 = OpLabel + OpBranch %655 + %655 = OpLabel + OpSelectionMerge %732 None + OpSwitch %262 %673 + %673 = OpLabel + OpBranch %674 + %674 = OpLabel + %1252 = OpPhi %6 %24 %673 %1348 %728 + %678 = OpSLessThanEqual %40 %1252 %192 + OpLoopMerge %729 %728 None + OpBranchConditional %678 %679 %729 + %679 = OpLabel + %682 = OpAccessChain %9 %47 %1252 %24 + %683 = OpLoad %6 %682 + %684 = OpSLessThanEqual %40 %30 %683 + OpSelectionMerge %727 None + OpBranchConditional %684 %685 %706 + %706 = OpLabel + %708 = OpAccessChain %9 %47 %1252 %30 + %709 = OpLoad %6 %708 + %710 = OpIEqual %40 %709 %28 + OpSelectionMerge %726 None + OpBranchConditional %710 %711 %722 + %722 = OpLabel + %725 = OpLoad %6 %708 + OpBranch %728 + %711 = OpLabel + OpStore %708 %192 + %721 = OpAccessChain %8 %47 %192 + OpStore %721 %1367 + OpBranch %729 + %726 = OpLabel + OpUnreachable + %685 = OpLabel + %687 = OpAccessChain %9 %47 %1252 %27 + %688 = OpLoad %6 %687 + %689 = OpIEqual %40 %688 %28 + OpSelectionMerge %705 None + OpBranchConditional %689 %690 %701 + %701 = OpLabel + %704 = OpLoad %6 %687 + OpBranch %728 + %690 = OpLabel + OpStore %687 %192 + %700 = OpAccessChain %8 %47 %192 + OpStore %700 %1367 + OpBranch %729 + %705 = OpLabel + OpUnreachable + %727 = OpLabel + OpUnreachable + %728 = OpLabel + %1348 = OpPhi %6 %704 %701 %725 %722 + OpBranch %674 + %729 = OpLabel + %1253 = OpPhi %40 %263 %674 %266 %690 %266 %711 + OpSelectionMerge %731 None + OpBranchConditional %1253 %732 %731 + %731 = OpLabel + OpBranch %732 + %732 = OpLabel + OpSelectionMerge %809 None + OpSwitch %262 %750 + %750 = OpLabel + OpBranch %751 + %751 = OpLabel + %1260 = OpPhi %6 %24 %750 %1349 %805 + %755 = OpSLessThanEqual %40 %1260 %172 + OpLoopMerge %806 %805 None + OpBranchConditional %755 %756 %806 + %756 = OpLabel + %759 = OpAccessChain %9 %47 %1260 %24 + %760 = OpLoad %6 %759 + %761 = OpSLessThanEqual %40 %192 %760 + OpSelectionMerge %804 None + OpBranchConditional %761 %762 %783 + %783 = OpLabel + %785 = OpAccessChain %9 %47 %1260 %30 + %786 = OpLoad %6 %785 + %787 = OpIEqual %40 %786 %28 + OpSelectionMerge %803 None + OpBranchConditional %787 %788 %799 + %799 = OpLabel + %802 = OpLoad %6 %785 + OpBranch %805 + %788 = OpLabel + OpStore %785 %172 + %798 = OpAccessChain %8 %47 %172 + OpStore %798 %1368 + OpBranch %806 + %803 = OpLabel + OpUnreachable + %762 = OpLabel + %764 = OpAccessChain %9 %47 %1260 %27 + %765 = OpLoad %6 %764 + %766 = OpIEqual %40 %765 %28 + OpSelectionMerge %782 None + OpBranchConditional %766 %767 %778 + %778 = OpLabel + %781 = OpLoad %6 %764 + OpBranch %805 + %767 = OpLabel + OpStore %764 %172 + %777 = OpAccessChain %8 %47 %172 + OpStore %777 %1368 + OpBranch %806 + %782 = OpLabel + OpUnreachable + %804 = OpLabel + OpUnreachable + %805 = OpLabel + %1349 = OpPhi %6 %781 %778 %802 %799 + OpBranch %751 + %806 = OpLabel + %1261 = OpPhi %40 %263 %751 %266 %767 %266 %788 + OpSelectionMerge %808 None + OpBranchConditional %1261 %809 %808 + %808 = OpLabel + OpBranch %809 + %809 = OpLabel + OpSelectionMerge %886 None + OpSwitch %262 %827 + %827 = OpLabel + OpBranch %828 + %828 = OpLabel + %1268 = OpPhi %6 %24 %827 %1350 %882 + %832 = OpSLessThanEqual %40 %1268 %179 + OpLoopMerge %883 %882 None + OpBranchConditional %832 %833 %883 + %833 = OpLabel + %836 = OpAccessChain %9 %47 %1268 %24 + %837 = OpLoad %6 %836 + %838 = OpSLessThanEqual %40 %199 %837 + OpSelectionMerge %881 None + OpBranchConditional %838 %839 %860 + %860 = OpLabel + %862 = OpAccessChain %9 %47 %1268 %30 + %863 = OpLoad %6 %862 + %864 = OpIEqual %40 %863 %28 + OpSelectionMerge %880 None + OpBranchConditional %864 %865 %876 + %876 = OpLabel + %879 = OpLoad %6 %862 + OpBranch %882 + %865 = OpLabel + OpStore %862 %179 + %875 = OpAccessChain %8 %47 %179 + OpStore %875 %1369 + OpBranch %883 + %880 = OpLabel + OpUnreachable + %839 = OpLabel + %841 = OpAccessChain %9 %47 %1268 %27 + %842 = OpLoad %6 %841 + %843 = OpIEqual %40 %842 %28 + OpSelectionMerge %859 None + OpBranchConditional %843 %844 %855 + %855 = OpLabel + %858 = OpLoad %6 %841 + OpBranch %882 + %844 = OpLabel + OpStore %841 %179 + %854 = OpAccessChain %8 %47 %179 + OpStore %854 %1369 + OpBranch %883 + %859 = OpLabel + OpUnreachable + %881 = OpLabel + OpUnreachable + %882 = OpLabel + %1350 = OpPhi %6 %858 %855 %879 %876 + OpBranch %828 + %883 = OpLabel + %1269 = OpPhi %40 %263 %828 %266 %844 %266 %865 + OpSelectionMerge %885 None + OpBranchConditional %1269 %886 %885 + %885 = OpLabel + OpBranch %886 + %886 = OpLabel + OpSelectionMerge %963 None + OpSwitch %262 %904 + %904 = OpLabel + OpBranch %905 + %905 = OpLabel + %1276 = OpPhi %6 %24 %904 %1351 %959 + %909 = OpSLessThanEqual %40 %1276 %141 + OpLoopMerge %960 %959 None + OpBranchConditional %909 %910 %960 + %910 = OpLabel + %913 = OpAccessChain %9 %47 %1276 %24 + %914 = OpLoad %6 %913 + %915 = OpSLessThanEqual %40 %206 %914 + OpSelectionMerge %958 None + OpBranchConditional %915 %916 %937 + %937 = OpLabel + %939 = OpAccessChain %9 %47 %1276 %30 + %940 = OpLoad %6 %939 + %941 = OpIEqual %40 %940 %28 + OpSelectionMerge %957 None + OpBranchConditional %941 %942 %953 + %953 = OpLabel + %956 = OpLoad %6 %939 + OpBranch %959 + %942 = OpLabel + OpStore %939 %141 + %952 = OpAccessChain %8 %47 %141 + OpStore %952 %1370 + OpBranch %960 + %957 = OpLabel + OpUnreachable + %916 = OpLabel + %918 = OpAccessChain %9 %47 %1276 %27 + %919 = OpLoad %6 %918 + %920 = OpIEqual %40 %919 %28 + OpSelectionMerge %936 None + OpBranchConditional %920 %921 %932 + %932 = OpLabel + %935 = OpLoad %6 %918 + OpBranch %959 + %921 = OpLabel + OpStore %918 %141 + %931 = OpAccessChain %8 %47 %141 + OpStore %931 %1370 + OpBranch %960 + %936 = OpLabel + OpUnreachable + %958 = OpLabel + OpUnreachable + %959 = OpLabel + %1351 = OpPhi %6 %935 %932 %956 %953 + OpBranch %905 + %960 = OpLabel + %1277 = OpPhi %40 %263 %905 %266 %921 %266 %942 + OpSelectionMerge %962 None + OpBranchConditional %1277 %963 %962 + %962 = OpLabel + OpBranch %963 + %963 = OpLabel + OpBranch %213 + %213 = OpLabel + %1290 = OpPhi %6 %1318 %963 %1287 %216 + %1281 = OpPhi %6 %24 %963 %1352 %216 + %1280 = OpPhi %6 %24 %963 %246 %216 + %220 = OpSLessThan %40 %1280 %219 + OpLoopMerge %215 %216 None + OpBranchConditional %220 %214 %215 + %214 = OpLabel + OpSelectionMerge %1013 None + OpSwitch %262 %981 + %981 = OpLabel + OpBranch %982 + %982 = OpLabel + %1282 = OpPhi %6 %24 %981 %1371 %1009 + %985 = OpINotEqual %40 %1282 %28 + OpLoopMerge %1010 %1009 None + OpBranchConditional %985 %986 %1010 + %986 = OpLabel + %988 = OpAccessChain %8 %47 %1282 + %989 = OpLoad %7 %988 + %1019 = OpCompositeExtract %6 %989 0 + %1020 = OpCompositeExtract %6 %989 1 + %1021 = OpCompositeExtract %6 %989 2 + %993 = OpIEqual %40 %1019 %1280 + OpSelectionMerge %996 None + OpBranchConditional %993 %994 %996 + %994 = OpLabel + OpBranch %1010 + %996 = OpLabel + %1000 = OpSGreaterThan %40 %1280 %1019 + %1371 = OpSelect %6 %1000 %1021 %1020 + OpBranch %1009 + %1009 = OpLabel + OpBranch %982 + %1010 = OpLabel + %1288 = OpPhi %6 %1290 %982 %1280 %994 + %1284 = OpPhi %40 %263 %982 %266 %994 + OpSelectionMerge %1012 None + OpBranchConditional %1284 %1013 %1012 + %1012 = OpLabel + OpBranch %1013 + %1013 = OpLabel + %1287 = OpPhi %6 %1288 %1010 %28 %1012 + OpSelectionMerge %228 None + OpSwitch %1280 %227 9 %226 5 %226 12 %226 15 %226 7 %226 8 %226 2 %226 6 %226 17 %226 13 %226 + %226 = OpLabel + %231 = OpIEqual %40 %1287 %1280 + OpSelectionMerge %233 None + OpBranchConditional %231 %232 %233 + %232 = OpLabel + %235 = OpIAdd %6 %1281 %27 + OpBranch %233 + %233 = OpLabel + %1354 = OpPhi %6 %1281 %226 %235 %232 + OpBranch %228 + %227 = OpLabel + %238 = OpIEqual %40 %1287 %28 + OpSelectionMerge %240 None + OpBranchConditional %238 %239 %240 + %239 = OpLabel + %242 = OpIAdd %6 %1281 %27 + OpBranch %240 + %240 = OpLabel + %1353 = OpPhi %6 %1281 %227 %242 %239 + OpBranch %228 + %228 = OpLabel + %1352 = OpPhi %6 %1353 %240 %1354 %233 + OpBranch %216 + %216 = OpLabel + %246 = OpIAdd %6 %1280 %27 + OpBranch %213 + %215 = OpLabel + %248 = OpIEqual %40 %1281 %219 + OpSelectionMerge %250 None + OpBranchConditional %248 %249 %258 + %258 = OpLabel + OpStore %254 %259 + OpBranch %250 + %249 = OpLabel + OpStore %254 %257 + OpBranch %250 + %250 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# struct BST +# { +# int data; +# int leftIndex; +# int rightIndex; +# }; +# +# BST tree[10]; +# +# void makeTreeNode(inout BST tree, int data) +# { +# tree.data = data; +# tree.leftIndex = -1; +# tree.rightIndex = -1; +# } +# void insert(int treeIndex, int data) +# { +# int baseIndex = 0; +# while (baseIndex <= treeIndex) +# { +# if (data <= tree[baseIndex].data) +# { +# if (tree[baseIndex].leftIndex == -1) +# { +# // Always false. +# if ((injectionSwitch.y < injectionSwitch.x)) +# { +# do +# { +# // This is never reached. +# discard; +# } +# // Always false. +# while (injectionSwitch.y < injectionSwitch.x); +# } +# tree[baseIndex].leftIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# // Iterates once. +# for (int int_i = 0; int_i < int((injectionSwitch.y)); int_i++) +# { +# return; +# } +# } +# else +# { +# baseIndex = tree[baseIndex].leftIndex; +# continue; +# } +# } +# else +# { +# if (tree[baseIndex].rightIndex == -1) +# { +# tree[baseIndex].rightIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].rightIndex; +# continue; +# } +# } +# } +# } +# int search(int target) +# { +# BST currentNode; +# int index = 0; +# while (index != -1) +# { +# currentNode = tree[index]; +# if (currentNode.data == target) +# { +# return target; +# } +# index = target > currentNode.data ? currentNode.rightIndex : currentNode.leftIndex; +# } +# return -1; +# } +# void main() +# { +# int treeIndex = 0; +# makeTreeNode(tree[0], 9); +# treeIndex++; +# insert(treeIndex, 5); +# treeIndex++; +# // gl_FragCoord.y < 0.0 == false +# // Iterates once, +# for (int int_i = 0; (gl_FragCoord.y < 0.0) || (int_i != int(injectionSwitch.y)); int_i++) +# { +# insert(treeIndex, 12); +# } +# treeIndex++; +# insert(treeIndex, 15); +# treeIndex++; +# insert(treeIndex, 7); +# treeIndex++; +# insert(treeIndex, 8); +# treeIndex++; +# insert(treeIndex, 2); +# treeIndex++; +# insert(treeIndex, 6); +# treeIndex++; +# insert(treeIndex, 17); +# treeIndex++; +# insert(treeIndex, 13); +# int count = 0; +# for (int i = 0; i < 20; i++) +# { +# int result = search(i); +# switch (i) +# { +# case 9: +# case 5: +# case 12: +# case 15: +# case 7: +# case 8: +# case 2: +# case 6: +# case 17: +# case 13: +# if (result == i) +# { +# count++; +# } +# break; +# default: +# if (result == -1) +# { +# count++; +# } +# break; +# } +# } +# if (count == 20) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 1.0, 1.0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 1740 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %204 %315 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "BST" + OpMemberName %7 0 "data" + OpMemberName %7 1 "leftIndex" + OpMemberName %7 2 "rightIndex" + OpName %47 "tree" + OpName %63 "buf0" + OpMemberName %63 0 "injectionSwitch" + OpName %65 "" + OpName %204 "gl_FragCoord" + OpName %315 "_GLF_color" + OpMemberDecorate %63 0 Offset 0 + OpDecorate %63 Block + OpDecorate %65 DescriptorSet 0 + OpDecorate %65 Binding 0 + OpDecorate %204 BuiltIn FragCoord + OpDecorate %315 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypePointer Function %6 + %24 = OpConstant %6 0 + %27 = OpConstant %6 1 + %28 = OpConstant %6 -1 + %30 = OpConstant %6 2 + %40 = OpTypeBool + %43 = OpTypeInt 32 0 + %44 = OpConstant %43 10 + %45 = OpTypeArray %7 %44 + %61 = OpTypeFloat 32 + %62 = OpTypeVector %61 2 + %63 = OpTypeStruct %62 + %64 = OpTypePointer Uniform %63 + %65 = OpVariable %64 Uniform + %66 = OpConstant %43 1 + %67 = OpTypePointer Uniform %61 + %70 = OpConstant %43 0 + %179 = OpConstant %6 9 + %189 = OpConstant %6 5 + %202 = OpTypeVector %61 4 + %203 = OpTypePointer Input %202 + %204 = OpVariable %203 Input + %205 = OpTypePointer Input %61 + %208 = OpConstant %61 0 + %219 = OpConstant %6 12 + %228 = OpConstant %6 15 + %235 = OpConstant %6 7 + %242 = OpConstant %6 8 + %255 = OpConstant %6 6 + %262 = OpConstant %6 17 + %269 = OpConstant %6 13 + %282 = OpConstant %6 20 + %314 = OpTypePointer Output %202 + %315 = OpVariable %314 Output + %316 = OpConstant %61 1 + %317 = OpConstantComposite %202 %316 %208 %208 %316 + %319 = OpConstantComposite %202 %208 %208 %316 %316 + %322 = OpConstantFalse %40 + %325 = OpConstantTrue %40 + %1301 = OpTypePointer Function %45 + %1620 = OpUndef %6 + %1727 = OpConstantComposite %7 %179 %28 %28 + %1728 = OpConstantComposite %7 %189 %28 %28 + %1729 = OpConstant %6 3 + %1730 = OpConstantComposite %7 %219 %28 %28 + %1731 = OpConstantComposite %7 %228 %28 %28 + %1732 = OpConstant %6 4 + %1733 = OpConstantComposite %7 %235 %28 %28 + %1734 = OpConstantComposite %7 %242 %28 %28 + %1735 = OpConstantComposite %7 %30 %28 %28 + %1736 = OpConstantComposite %7 %255 %28 %28 + %1737 = OpConstantComposite %7 %262 %28 %28 + %1738 = OpConstantComposite %7 %269 %28 %28 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %47 = OpVariable %1301 Function + %186 = OpAccessChain %8 %47 %24 + OpStore %186 %1727 + OpSelectionMerge %432 None + OpSwitch %70 %350 + %350 = OpLabel + OpBranch %351 + %351 = OpLabel + %1501 = OpPhi %40 %322 %350 %1674 %428 + %1498 = OpPhi %6 %24 %350 %1671 %428 + %355 = OpSLessThanEqual %40 %1498 %27 + OpLoopMerge %429 %428 None + OpBranchConditional %355 %356 %429 + %356 = OpLabel + %359 = OpAccessChain %9 %47 %1498 %24 + %360 = OpLoad %6 %359 + %361 = OpSLessThanEqual %40 %189 %360 + OpSelectionMerge %427 None + OpBranchConditional %361 %362 %406 + %406 = OpLabel + %408 = OpAccessChain %9 %47 %1498 %30 + %409 = OpLoad %6 %408 + %410 = OpIEqual %40 %409 %28 + OpSelectionMerge %426 None + OpBranchConditional %410 %411 %422 + %422 = OpLabel + %425 = OpLoad %6 %408 + OpBranch %428 + %411 = OpLabel + OpStore %408 %27 + %421 = OpAccessChain %8 %47 %27 + OpStore %421 %1728 + OpBranch %429 + %426 = OpLabel + OpUnreachable + %362 = OpLabel + %364 = OpAccessChain %9 %47 %1498 %27 + %365 = OpLoad %6 %364 + %366 = OpIEqual %40 %365 %28 + OpSelectionMerge %405 None + OpBranchConditional %366 %367 %401 + %401 = OpLabel + %404 = OpLoad %6 %364 + OpBranch %428 + %367 = OpLabel + %368 = OpAccessChain %67 %65 %24 %66 + %369 = OpLoad %61 %368 + %370 = OpAccessChain %67 %65 %24 %70 + %371 = OpLoad %61 %370 + %372 = OpFOrdLessThan %40 %369 %371 + OpSelectionMerge %378 None + OpBranchConditional %372 %373 %378 + %373 = OpLabel + OpBranch %374 + %374 = OpLabel + OpLoopMerge %377 %376 None + OpBranch %375 + %375 = OpLabel + OpTerminateInvocation + %376 = OpLabel + OpBranch %374 + %377 = OpLabel + OpUnreachable + %378 = OpLabel + OpStore %364 %27 + %388 = OpAccessChain %8 %47 %27 + OpStore %388 %1728 + OpBranch %389 + %389 = OpLabel + %394 = OpConvertFToS %6 %369 + %395 = OpSLessThan %40 %24 %394 + OpLoopMerge %398 %397 None + OpBranchConditional %395 %396 %398 + %396 = OpLabel + OpBranch %398 + %397 = OpLabel + OpBranch %389 + %398 = OpLabel + %1499 = OpPhi %40 %1501 %389 %325 %396 + OpSelectionMerge %400 None + OpBranchConditional %1499 %429 %400 + %400 = OpLabel + OpBranch %405 + %405 = OpLabel + OpBranch %427 + %427 = OpLabel + OpBranch %428 + %428 = OpLabel + %1674 = OpPhi %40 %1501 %401 %1501 %422 %1499 %427 + %1671 = OpPhi %6 %404 %401 %425 %422 %1498 %427 + OpBranch %351 + %429 = OpLabel + %1502 = OpPhi %40 %1501 %351 %1499 %398 %325 %411 + OpSelectionMerge %431 None + OpBranchConditional %1502 %432 %431 + %431 = OpLabel + OpBranch %432 + %432 = OpLabel + OpBranch %197 + %197 = OpLabel + %1509 = OpPhi %6 %24 %432 %225 %200 + OpLoopMerge %199 %200 None + OpBranch %201 + %201 = OpLabel + %206 = OpAccessChain %205 %204 %66 + %207 = OpLoad %61 %206 + %209 = OpFOrdLessThan %40 %207 %208 + %210 = OpLogicalNot %40 %209 + OpSelectionMerge %212 None + OpBranchConditional %210 %211 %212 + %211 = OpLabel + %214 = OpAccessChain %67 %65 %24 %66 + %215 = OpLoad %61 %214 + %216 = OpConvertFToS %6 %215 + %217 = OpINotEqual %40 %1509 %216 + OpBranch %212 + %212 = OpLabel + %218 = OpPhi %40 %209 %201 %217 %211 + OpBranchConditional %218 %198 %199 + %198 = OpLabel + OpSelectionMerge %534 None + OpSwitch %70 %452 + %452 = OpLabel + OpBranch %453 + %453 = OpLabel + %1662 = OpPhi %40 %322 %452 %1726 %530 + %1659 = OpPhi %6 %24 %452 %1723 %530 + %457 = OpSLessThanEqual %40 %1659 %30 + OpLoopMerge %531 %530 None + OpBranchConditional %457 %458 %531 + %458 = OpLabel + %461 = OpAccessChain %9 %47 %1659 %24 + %462 = OpLoad %6 %461 + %463 = OpSLessThanEqual %40 %219 %462 + OpSelectionMerge %529 None + OpBranchConditional %463 %464 %508 + %508 = OpLabel + %510 = OpAccessChain %9 %47 %1659 %30 + %511 = OpLoad %6 %510 + %512 = OpIEqual %40 %511 %28 + OpSelectionMerge %528 None + OpBranchConditional %512 %513 %524 + %524 = OpLabel + %527 = OpLoad %6 %510 + OpBranch %530 + %513 = OpLabel + OpStore %510 %30 + %523 = OpAccessChain %8 %47 %30 + OpStore %523 %1730 + OpBranch %531 + %528 = OpLabel + OpUnreachable + %464 = OpLabel + %466 = OpAccessChain %9 %47 %1659 %27 + %467 = OpLoad %6 %466 + %468 = OpIEqual %40 %467 %28 + OpSelectionMerge %507 None + OpBranchConditional %468 %469 %503 + %503 = OpLabel + %506 = OpLoad %6 %466 + OpBranch %530 + %469 = OpLabel + %470 = OpAccessChain %67 %65 %24 %66 + %471 = OpLoad %61 %470 + %472 = OpAccessChain %67 %65 %24 %70 + %473 = OpLoad %61 %472 + %474 = OpFOrdLessThan %40 %471 %473 + OpSelectionMerge %480 None + OpBranchConditional %474 %475 %480 + %475 = OpLabel + OpBranch %476 + %476 = OpLabel + OpLoopMerge %479 %478 None + OpBranch %477 + %477 = OpLabel + OpTerminateInvocation + %478 = OpLabel + OpBranch %476 + %479 = OpLabel + OpUnreachable + %480 = OpLabel + OpStore %466 %30 + %490 = OpAccessChain %8 %47 %30 + OpStore %490 %1730 + OpBranch %491 + %491 = OpLabel + %496 = OpConvertFToS %6 %471 + %497 = OpSLessThan %40 %24 %496 + OpLoopMerge %500 %499 None + OpBranchConditional %497 %498 %500 + %498 = OpLabel + OpBranch %500 + %499 = OpLabel + OpBranch %491 + %500 = OpLabel + %1660 = OpPhi %40 %1662 %491 %325 %498 + OpSelectionMerge %502 None + OpBranchConditional %1660 %531 %502 + %502 = OpLabel + OpBranch %507 + %507 = OpLabel + OpBranch %529 + %529 = OpLabel + OpBranch %530 + %530 = OpLabel + %1726 = OpPhi %40 %1662 %503 %1662 %524 %1660 %529 + %1723 = OpPhi %6 %506 %503 %527 %524 %1659 %529 + OpBranch %453 + %531 = OpLabel + %1663 = OpPhi %40 %1662 %453 %1660 %500 %325 %513 + OpSelectionMerge %533 None + OpBranchConditional %1663 %534 %533 + %533 = OpLabel + OpBranch %534 + %534 = OpLabel + OpBranch %200 + %200 = OpLabel + %225 = OpIAdd %6 %1509 %27 + OpBranch %197 + %199 = OpLabel + OpSelectionMerge %636 None + OpSwitch %70 %554 + %554 = OpLabel + OpBranch %555 + %555 = OpLabel + %1515 = OpPhi %40 %322 %554 %1685 %632 + %1512 = OpPhi %6 %24 %554 %1682 %632 + %559 = OpSLessThanEqual %40 %1512 %1729 + OpLoopMerge %633 %632 None + OpBranchConditional %559 %560 %633 + %560 = OpLabel + %563 = OpAccessChain %9 %47 %1512 %24 + %564 = OpLoad %6 %563 + %565 = OpSLessThanEqual %40 %228 %564 + OpSelectionMerge %631 None + OpBranchConditional %565 %566 %610 + %610 = OpLabel + %612 = OpAccessChain %9 %47 %1512 %30 + %613 = OpLoad %6 %612 + %614 = OpIEqual %40 %613 %28 + OpSelectionMerge %630 None + OpBranchConditional %614 %615 %626 + %626 = OpLabel + %629 = OpLoad %6 %612 + OpBranch %632 + %615 = OpLabel + OpStore %612 %1729 + %625 = OpAccessChain %8 %47 %1729 + OpStore %625 %1731 + OpBranch %633 + %630 = OpLabel + OpUnreachable + %566 = OpLabel + %568 = OpAccessChain %9 %47 %1512 %27 + %569 = OpLoad %6 %568 + %570 = OpIEqual %40 %569 %28 + OpSelectionMerge %609 None + OpBranchConditional %570 %571 %605 + %605 = OpLabel + %608 = OpLoad %6 %568 + OpBranch %632 + %571 = OpLabel + %572 = OpAccessChain %67 %65 %24 %66 + %573 = OpLoad %61 %572 + %574 = OpAccessChain %67 %65 %24 %70 + %575 = OpLoad %61 %574 + %576 = OpFOrdLessThan %40 %573 %575 + OpSelectionMerge %582 None + OpBranchConditional %576 %577 %582 + %577 = OpLabel + OpBranch %578 + %578 = OpLabel + OpLoopMerge %581 %580 None + OpBranch %579 + %579 = OpLabel + OpTerminateInvocation + %580 = OpLabel + OpBranch %578 + %581 = OpLabel + OpUnreachable + %582 = OpLabel + OpStore %568 %1729 + %592 = OpAccessChain %8 %47 %1729 + OpStore %592 %1731 + OpBranch %593 + %593 = OpLabel + %598 = OpConvertFToS %6 %573 + %599 = OpSLessThan %40 %24 %598 + OpLoopMerge %602 %601 None + OpBranchConditional %599 %600 %602 + %600 = OpLabel + OpBranch %602 + %601 = OpLabel + OpBranch %593 + %602 = OpLabel + %1513 = OpPhi %40 %1515 %593 %325 %600 + OpSelectionMerge %604 None + OpBranchConditional %1513 %633 %604 + %604 = OpLabel + OpBranch %609 + %609 = OpLabel + OpBranch %631 + %631 = OpLabel + OpBranch %632 + %632 = OpLabel + %1685 = OpPhi %40 %1515 %605 %1515 %626 %1513 %631 + %1682 = OpPhi %6 %608 %605 %629 %626 %1512 %631 + OpBranch %555 + %633 = OpLabel + %1516 = OpPhi %40 %1515 %555 %1513 %602 %325 %615 + OpSelectionMerge %635 None + OpBranchConditional %1516 %636 %635 + %635 = OpLabel + OpBranch %636 + %636 = OpLabel + OpSelectionMerge %738 None + OpSwitch %70 %656 + %656 = OpLabel + OpBranch %657 + %657 = OpLabel + %1526 = OpPhi %40 %322 %656 %1689 %734 + %1523 = OpPhi %6 %24 %656 %1686 %734 + %661 = OpSLessThanEqual %40 %1523 %1732 + OpLoopMerge %735 %734 None + OpBranchConditional %661 %662 %735 + %662 = OpLabel + %665 = OpAccessChain %9 %47 %1523 %24 + %666 = OpLoad %6 %665 + %667 = OpSLessThanEqual %40 %235 %666 + OpSelectionMerge %733 None + OpBranchConditional %667 %668 %712 + %712 = OpLabel + %714 = OpAccessChain %9 %47 %1523 %30 + %715 = OpLoad %6 %714 + %716 = OpIEqual %40 %715 %28 + OpSelectionMerge %732 None + OpBranchConditional %716 %717 %728 + %728 = OpLabel + %731 = OpLoad %6 %714 + OpBranch %734 + %717 = OpLabel + OpStore %714 %1732 + %727 = OpAccessChain %8 %47 %1732 + OpStore %727 %1733 + OpBranch %735 + %732 = OpLabel + OpUnreachable + %668 = OpLabel + %670 = OpAccessChain %9 %47 %1523 %27 + %671 = OpLoad %6 %670 + %672 = OpIEqual %40 %671 %28 + OpSelectionMerge %711 None + OpBranchConditional %672 %673 %707 + %707 = OpLabel + %710 = OpLoad %6 %670 + OpBranch %734 + %673 = OpLabel + %674 = OpAccessChain %67 %65 %24 %66 + %675 = OpLoad %61 %674 + %676 = OpAccessChain %67 %65 %24 %70 + %677 = OpLoad %61 %676 + %678 = OpFOrdLessThan %40 %675 %677 + OpSelectionMerge %684 None + OpBranchConditional %678 %679 %684 + %679 = OpLabel + OpBranch %680 + %680 = OpLabel + OpLoopMerge %683 %682 None + OpBranch %681 + %681 = OpLabel + OpTerminateInvocation + %682 = OpLabel + OpBranch %680 + %683 = OpLabel + OpUnreachable + %684 = OpLabel + OpStore %670 %1732 + %694 = OpAccessChain %8 %47 %1732 + OpStore %694 %1733 + OpBranch %695 + %695 = OpLabel + %700 = OpConvertFToS %6 %675 + %701 = OpSLessThan %40 %24 %700 + OpLoopMerge %704 %703 None + OpBranchConditional %701 %702 %704 + %702 = OpLabel + OpBranch %704 + %703 = OpLabel + OpBranch %695 + %704 = OpLabel + %1524 = OpPhi %40 %1526 %695 %325 %702 + OpSelectionMerge %706 None + OpBranchConditional %1524 %735 %706 + %706 = OpLabel + OpBranch %711 + %711 = OpLabel + OpBranch %733 + %733 = OpLabel + OpBranch %734 + %734 = OpLabel + %1689 = OpPhi %40 %1526 %707 %1526 %728 %1524 %733 + %1686 = OpPhi %6 %710 %707 %731 %728 %1523 %733 + OpBranch %657 + %735 = OpLabel + %1527 = OpPhi %40 %1526 %657 %1524 %704 %325 %717 + OpSelectionMerge %737 None + OpBranchConditional %1527 %738 %737 + %737 = OpLabel + OpBranch %738 + %738 = OpLabel + OpSelectionMerge %840 None + OpSwitch %70 %758 + %758 = OpLabel + OpBranch %759 + %759 = OpLabel + %1537 = OpPhi %40 %322 %758 %1693 %836 + %1534 = OpPhi %6 %24 %758 %1690 %836 + %763 = OpSLessThanEqual %40 %1534 %189 + OpLoopMerge %837 %836 None + OpBranchConditional %763 %764 %837 + %764 = OpLabel + %767 = OpAccessChain %9 %47 %1534 %24 + %768 = OpLoad %6 %767 + %769 = OpSLessThanEqual %40 %242 %768 + OpSelectionMerge %835 None + OpBranchConditional %769 %770 %814 + %814 = OpLabel + %816 = OpAccessChain %9 %47 %1534 %30 + %817 = OpLoad %6 %816 + %818 = OpIEqual %40 %817 %28 + OpSelectionMerge %834 None + OpBranchConditional %818 %819 %830 + %830 = OpLabel + %833 = OpLoad %6 %816 + OpBranch %836 + %819 = OpLabel + OpStore %816 %189 + %829 = OpAccessChain %8 %47 %189 + OpStore %829 %1734 + OpBranch %837 + %834 = OpLabel + OpUnreachable + %770 = OpLabel + %772 = OpAccessChain %9 %47 %1534 %27 + %773 = OpLoad %6 %772 + %774 = OpIEqual %40 %773 %28 + OpSelectionMerge %813 None + OpBranchConditional %774 %775 %809 + %809 = OpLabel + %812 = OpLoad %6 %772 + OpBranch %836 + %775 = OpLabel + %776 = OpAccessChain %67 %65 %24 %66 + %777 = OpLoad %61 %776 + %778 = OpAccessChain %67 %65 %24 %70 + %779 = OpLoad %61 %778 + %780 = OpFOrdLessThan %40 %777 %779 + OpSelectionMerge %786 None + OpBranchConditional %780 %781 %786 + %781 = OpLabel + OpBranch %782 + %782 = OpLabel + OpLoopMerge %785 %784 None + OpBranch %783 + %783 = OpLabel + OpTerminateInvocation + %784 = OpLabel + OpBranch %782 + %785 = OpLabel + OpUnreachable + %786 = OpLabel + OpStore %772 %189 + %796 = OpAccessChain %8 %47 %189 + OpStore %796 %1734 + OpBranch %797 + %797 = OpLabel + %802 = OpConvertFToS %6 %777 + %803 = OpSLessThan %40 %24 %802 + OpLoopMerge %806 %805 None + OpBranchConditional %803 %804 %806 + %804 = OpLabel + OpBranch %806 + %805 = OpLabel + OpBranch %797 + %806 = OpLabel + %1535 = OpPhi %40 %1537 %797 %325 %804 + OpSelectionMerge %808 None + OpBranchConditional %1535 %837 %808 + %808 = OpLabel + OpBranch %813 + %813 = OpLabel + OpBranch %835 + %835 = OpLabel + OpBranch %836 + %836 = OpLabel + %1693 = OpPhi %40 %1537 %809 %1537 %830 %1535 %835 + %1690 = OpPhi %6 %812 %809 %833 %830 %1534 %835 + OpBranch %759 + %837 = OpLabel + %1538 = OpPhi %40 %1537 %759 %1535 %806 %325 %819 + OpSelectionMerge %839 None + OpBranchConditional %1538 %840 %839 + %839 = OpLabel + OpBranch %840 + %840 = OpLabel + OpSelectionMerge %942 None + OpSwitch %70 %860 + %860 = OpLabel + OpBranch %861 + %861 = OpLabel + %1548 = OpPhi %40 %322 %860 %1697 %938 + %1545 = OpPhi %6 %24 %860 %1694 %938 + %865 = OpSLessThanEqual %40 %1545 %255 + OpLoopMerge %939 %938 None + OpBranchConditional %865 %866 %939 + %866 = OpLabel + %869 = OpAccessChain %9 %47 %1545 %24 + %870 = OpLoad %6 %869 + %871 = OpSLessThanEqual %40 %30 %870 + OpSelectionMerge %937 None + OpBranchConditional %871 %872 %916 + %916 = OpLabel + %918 = OpAccessChain %9 %47 %1545 %30 + %919 = OpLoad %6 %918 + %920 = OpIEqual %40 %919 %28 + OpSelectionMerge %936 None + OpBranchConditional %920 %921 %932 + %932 = OpLabel + %935 = OpLoad %6 %918 + OpBranch %938 + %921 = OpLabel + OpStore %918 %255 + %931 = OpAccessChain %8 %47 %255 + OpStore %931 %1735 + OpBranch %939 + %936 = OpLabel + OpUnreachable + %872 = OpLabel + %874 = OpAccessChain %9 %47 %1545 %27 + %875 = OpLoad %6 %874 + %876 = OpIEqual %40 %875 %28 + OpSelectionMerge %915 None + OpBranchConditional %876 %877 %911 + %911 = OpLabel + %914 = OpLoad %6 %874 + OpBranch %938 + %877 = OpLabel + %878 = OpAccessChain %67 %65 %24 %66 + %879 = OpLoad %61 %878 + %880 = OpAccessChain %67 %65 %24 %70 + %881 = OpLoad %61 %880 + %882 = OpFOrdLessThan %40 %879 %881 + OpSelectionMerge %888 None + OpBranchConditional %882 %883 %888 + %883 = OpLabel + OpBranch %884 + %884 = OpLabel + OpLoopMerge %887 %886 None + OpBranch %885 + %885 = OpLabel + OpTerminateInvocation + %886 = OpLabel + OpBranch %884 + %887 = OpLabel + OpUnreachable + %888 = OpLabel + OpStore %874 %255 + %898 = OpAccessChain %8 %47 %255 + OpStore %898 %1735 + OpBranch %899 + %899 = OpLabel + %904 = OpConvertFToS %6 %879 + %905 = OpSLessThan %40 %24 %904 + OpLoopMerge %908 %907 None + OpBranchConditional %905 %906 %908 + %906 = OpLabel + OpBranch %908 + %907 = OpLabel + OpBranch %899 + %908 = OpLabel + %1546 = OpPhi %40 %1548 %899 %325 %906 + OpSelectionMerge %910 None + OpBranchConditional %1546 %939 %910 + %910 = OpLabel + OpBranch %915 + %915 = OpLabel + OpBranch %937 + %937 = OpLabel + OpBranch %938 + %938 = OpLabel + %1697 = OpPhi %40 %1548 %911 %1548 %932 %1546 %937 + %1694 = OpPhi %6 %914 %911 %935 %932 %1545 %937 + OpBranch %861 + %939 = OpLabel + %1549 = OpPhi %40 %1548 %861 %1546 %908 %325 %921 + OpSelectionMerge %941 None + OpBranchConditional %1549 %942 %941 + %941 = OpLabel + OpBranch %942 + %942 = OpLabel + OpSelectionMerge %1044 None + OpSwitch %70 %962 + %962 = OpLabel + OpBranch %963 + %963 = OpLabel + %1559 = OpPhi %40 %322 %962 %1701 %1040 + %1556 = OpPhi %6 %24 %962 %1698 %1040 + %967 = OpSLessThanEqual %40 %1556 %235 + OpLoopMerge %1041 %1040 None + OpBranchConditional %967 %968 %1041 + %968 = OpLabel + %971 = OpAccessChain %9 %47 %1556 %24 + %972 = OpLoad %6 %971 + %973 = OpSLessThanEqual %40 %255 %972 + OpSelectionMerge %1039 None + OpBranchConditional %973 %974 %1018 + %1018 = OpLabel + %1020 = OpAccessChain %9 %47 %1556 %30 + %1021 = OpLoad %6 %1020 + %1022 = OpIEqual %40 %1021 %28 + OpSelectionMerge %1038 None + OpBranchConditional %1022 %1023 %1034 + %1034 = OpLabel + %1037 = OpLoad %6 %1020 + OpBranch %1040 + %1023 = OpLabel + OpStore %1020 %235 + %1033 = OpAccessChain %8 %47 %235 + OpStore %1033 %1736 + OpBranch %1041 + %1038 = OpLabel + OpUnreachable + %974 = OpLabel + %976 = OpAccessChain %9 %47 %1556 %27 + %977 = OpLoad %6 %976 + %978 = OpIEqual %40 %977 %28 + OpSelectionMerge %1017 None + OpBranchConditional %978 %979 %1013 + %1013 = OpLabel + %1016 = OpLoad %6 %976 + OpBranch %1040 + %979 = OpLabel + %980 = OpAccessChain %67 %65 %24 %66 + %981 = OpLoad %61 %980 + %982 = OpAccessChain %67 %65 %24 %70 + %983 = OpLoad %61 %982 + %984 = OpFOrdLessThan %40 %981 %983 + OpSelectionMerge %990 None + OpBranchConditional %984 %985 %990 + %985 = OpLabel + OpBranch %986 + %986 = OpLabel + OpLoopMerge %989 %988 None + OpBranch %987 + %987 = OpLabel + OpTerminateInvocation + %988 = OpLabel + OpBranch %986 + %989 = OpLabel + OpUnreachable + %990 = OpLabel + OpStore %976 %235 + %1000 = OpAccessChain %8 %47 %235 + OpStore %1000 %1736 + OpBranch %1001 + %1001 = OpLabel + %1006 = OpConvertFToS %6 %981 + %1007 = OpSLessThan %40 %24 %1006 + OpLoopMerge %1010 %1009 None + OpBranchConditional %1007 %1008 %1010 + %1008 = OpLabel + OpBranch %1010 + %1009 = OpLabel + OpBranch %1001 + %1010 = OpLabel + %1557 = OpPhi %40 %1559 %1001 %325 %1008 + OpSelectionMerge %1012 None + OpBranchConditional %1557 %1041 %1012 + %1012 = OpLabel + OpBranch %1017 + %1017 = OpLabel + OpBranch %1039 + %1039 = OpLabel + OpBranch %1040 + %1040 = OpLabel + %1701 = OpPhi %40 %1559 %1013 %1559 %1034 %1557 %1039 + %1698 = OpPhi %6 %1016 %1013 %1037 %1034 %1556 %1039 + OpBranch %963 + %1041 = OpLabel + %1560 = OpPhi %40 %1559 %963 %1557 %1010 %325 %1023 + OpSelectionMerge %1043 None + OpBranchConditional %1560 %1044 %1043 + %1043 = OpLabel + OpBranch %1044 + %1044 = OpLabel + OpSelectionMerge %1146 None + OpSwitch %70 %1064 + %1064 = OpLabel + OpBranch %1065 + %1065 = OpLabel + %1570 = OpPhi %40 %322 %1064 %1705 %1142 + %1567 = OpPhi %6 %24 %1064 %1702 %1142 + %1069 = OpSLessThanEqual %40 %1567 %242 + OpLoopMerge %1143 %1142 None + OpBranchConditional %1069 %1070 %1143 + %1070 = OpLabel + %1073 = OpAccessChain %9 %47 %1567 %24 + %1074 = OpLoad %6 %1073 + %1075 = OpSLessThanEqual %40 %262 %1074 + OpSelectionMerge %1141 None + OpBranchConditional %1075 %1076 %1120 + %1120 = OpLabel + %1122 = OpAccessChain %9 %47 %1567 %30 + %1123 = OpLoad %6 %1122 + %1124 = OpIEqual %40 %1123 %28 + OpSelectionMerge %1140 None + OpBranchConditional %1124 %1125 %1136 + %1136 = OpLabel + %1139 = OpLoad %6 %1122 + OpBranch %1142 + %1125 = OpLabel + OpStore %1122 %242 + %1135 = OpAccessChain %8 %47 %242 + OpStore %1135 %1737 + OpBranch %1143 + %1140 = OpLabel + OpUnreachable + %1076 = OpLabel + %1078 = OpAccessChain %9 %47 %1567 %27 + %1079 = OpLoad %6 %1078 + %1080 = OpIEqual %40 %1079 %28 + OpSelectionMerge %1119 None + OpBranchConditional %1080 %1081 %1115 + %1115 = OpLabel + %1118 = OpLoad %6 %1078 + OpBranch %1142 + %1081 = OpLabel + %1082 = OpAccessChain %67 %65 %24 %66 + %1083 = OpLoad %61 %1082 + %1084 = OpAccessChain %67 %65 %24 %70 + %1085 = OpLoad %61 %1084 + %1086 = OpFOrdLessThan %40 %1083 %1085 + OpSelectionMerge %1092 None + OpBranchConditional %1086 %1087 %1092 + %1087 = OpLabel + OpBranch %1088 + %1088 = OpLabel + OpLoopMerge %1091 %1090 None + OpBranch %1089 + %1089 = OpLabel + OpTerminateInvocation + %1090 = OpLabel + OpBranch %1088 + %1091 = OpLabel + OpUnreachable + %1092 = OpLabel + OpStore %1078 %242 + %1102 = OpAccessChain %8 %47 %242 + OpStore %1102 %1737 + OpBranch %1103 + %1103 = OpLabel + %1108 = OpConvertFToS %6 %1083 + %1109 = OpSLessThan %40 %24 %1108 + OpLoopMerge %1112 %1111 None + OpBranchConditional %1109 %1110 %1112 + %1110 = OpLabel + OpBranch %1112 + %1111 = OpLabel + OpBranch %1103 + %1112 = OpLabel + %1568 = OpPhi %40 %1570 %1103 %325 %1110 + OpSelectionMerge %1114 None + OpBranchConditional %1568 %1143 %1114 + %1114 = OpLabel + OpBranch %1119 + %1119 = OpLabel + OpBranch %1141 + %1141 = OpLabel + OpBranch %1142 + %1142 = OpLabel + %1705 = OpPhi %40 %1570 %1115 %1570 %1136 %1568 %1141 + %1702 = OpPhi %6 %1118 %1115 %1139 %1136 %1567 %1141 + OpBranch %1065 + %1143 = OpLabel + %1571 = OpPhi %40 %1570 %1065 %1568 %1112 %325 %1125 + OpSelectionMerge %1145 None + OpBranchConditional %1571 %1146 %1145 + %1145 = OpLabel + OpBranch %1146 + %1146 = OpLabel + OpSelectionMerge %1248 None + OpSwitch %70 %1166 + %1166 = OpLabel + OpBranch %1167 + %1167 = OpLabel + %1581 = OpPhi %40 %322 %1166 %1709 %1244 + %1578 = OpPhi %6 %24 %1166 %1706 %1244 + %1171 = OpSLessThanEqual %40 %1578 %179 + OpLoopMerge %1245 %1244 None + OpBranchConditional %1171 %1172 %1245 + %1172 = OpLabel + %1175 = OpAccessChain %9 %47 %1578 %24 + %1176 = OpLoad %6 %1175 + %1177 = OpSLessThanEqual %40 %269 %1176 + OpSelectionMerge %1243 None + OpBranchConditional %1177 %1178 %1222 + %1222 = OpLabel + %1224 = OpAccessChain %9 %47 %1578 %30 + %1225 = OpLoad %6 %1224 + %1226 = OpIEqual %40 %1225 %28 + OpSelectionMerge %1242 None + OpBranchConditional %1226 %1227 %1238 + %1238 = OpLabel + %1241 = OpLoad %6 %1224 + OpBranch %1244 + %1227 = OpLabel + OpStore %1224 %179 + %1237 = OpAccessChain %8 %47 %179 + OpStore %1237 %1738 + OpBranch %1245 + %1242 = OpLabel + OpUnreachable + %1178 = OpLabel + %1180 = OpAccessChain %9 %47 %1578 %27 + %1181 = OpLoad %6 %1180 + %1182 = OpIEqual %40 %1181 %28 + OpSelectionMerge %1221 None + OpBranchConditional %1182 %1183 %1217 + %1217 = OpLabel + %1220 = OpLoad %6 %1180 + OpBranch %1244 + %1183 = OpLabel + %1184 = OpAccessChain %67 %65 %24 %66 + %1185 = OpLoad %61 %1184 + %1186 = OpAccessChain %67 %65 %24 %70 + %1187 = OpLoad %61 %1186 + %1188 = OpFOrdLessThan %40 %1185 %1187 + OpSelectionMerge %1194 None + OpBranchConditional %1188 %1189 %1194 + %1189 = OpLabel + OpBranch %1190 + %1190 = OpLabel + OpLoopMerge %1193 %1192 None + OpBranch %1191 + %1191 = OpLabel + OpTerminateInvocation + %1192 = OpLabel + OpBranch %1190 + %1193 = OpLabel + OpUnreachable + %1194 = OpLabel + OpStore %1180 %179 + %1204 = OpAccessChain %8 %47 %179 + OpStore %1204 %1738 + OpBranch %1205 + %1205 = OpLabel + %1210 = OpConvertFToS %6 %1185 + %1211 = OpSLessThan %40 %24 %1210 + OpLoopMerge %1214 %1213 None + OpBranchConditional %1211 %1212 %1214 + %1212 = OpLabel + OpBranch %1214 + %1213 = OpLabel + OpBranch %1205 + %1214 = OpLabel + %1579 = OpPhi %40 %1581 %1205 %325 %1212 + OpSelectionMerge %1216 None + OpBranchConditional %1579 %1245 %1216 + %1216 = OpLabel + OpBranch %1221 + %1221 = OpLabel + OpBranch %1243 + %1243 = OpLabel + OpBranch %1244 + %1244 = OpLabel + %1709 = OpPhi %40 %1581 %1217 %1581 %1238 %1579 %1243 + %1706 = OpPhi %6 %1220 %1217 %1241 %1238 %1578 %1243 + OpBranch %1167 + %1245 = OpLabel + %1582 = OpPhi %40 %1581 %1167 %1579 %1214 %325 %1227 + OpSelectionMerge %1247 None + OpBranchConditional %1582 %1248 %1247 + %1247 = OpLabel + OpBranch %1248 + %1248 = OpLabel + OpBranch %276 + %276 = OpLabel + %1593 = OpPhi %6 %1620 %1248 %1590 %279 + %1584 = OpPhi %6 %24 %1248 %1710 %279 + %1583 = OpPhi %6 %24 %1248 %309 %279 + %283 = OpSLessThan %40 %1583 %282 + OpLoopMerge %278 %279 None + OpBranchConditional %283 %277 %278 + %277 = OpLabel + OpSelectionMerge %1299 None + OpSwitch %70 %1267 + %1267 = OpLabel + OpBranch %1268 + %1268 = OpLabel + %1585 = OpPhi %6 %24 %1267 %1739 %1295 + %1271 = OpINotEqual %40 %1585 %28 + OpLoopMerge %1296 %1295 None + OpBranchConditional %1271 %1272 %1296 + %1272 = OpLabel + %1274 = OpAccessChain %8 %47 %1585 + %1275 = OpLoad %7 %1274 + %1305 = OpCompositeExtract %6 %1275 0 + %1306 = OpCompositeExtract %6 %1275 1 + %1307 = OpCompositeExtract %6 %1275 2 + %1279 = OpIEqual %40 %1305 %1583 + OpSelectionMerge %1282 None + OpBranchConditional %1279 %1280 %1282 + %1280 = OpLabel + OpBranch %1296 + %1282 = OpLabel + %1286 = OpSGreaterThan %40 %1583 %1305 + %1739 = OpSelect %6 %1286 %1307 %1306 + OpBranch %1295 + %1295 = OpLabel + OpBranch %1268 + %1296 = OpLabel + %1591 = OpPhi %6 %1593 %1268 %1583 %1280 + %1587 = OpPhi %40 %322 %1268 %325 %1280 + OpSelectionMerge %1298 None + OpBranchConditional %1587 %1299 %1298 + %1298 = OpLabel + OpBranch %1299 + %1299 = OpLabel + %1590 = OpPhi %6 %1591 %1296 %28 %1298 + OpSelectionMerge %291 None + OpSwitch %1583 %290 9 %289 5 %289 12 %289 15 %289 7 %289 8 %289 2 %289 6 %289 17 %289 13 %289 + %289 = OpLabel + %294 = OpIEqual %40 %1590 %1583 + OpSelectionMerge %296 None + OpBranchConditional %294 %295 %296 + %295 = OpLabel + %298 = OpIAdd %6 %1584 %27 + OpBranch %296 + %296 = OpLabel + %1712 = OpPhi %6 %1584 %289 %298 %295 + OpBranch %291 + %290 = OpLabel + %301 = OpIEqual %40 %1590 %28 + OpSelectionMerge %303 None + OpBranchConditional %301 %302 %303 + %302 = OpLabel + %305 = OpIAdd %6 %1584 %27 + OpBranch %303 + %303 = OpLabel + %1711 = OpPhi %6 %1584 %290 %305 %302 + OpBranch %291 + %291 = OpLabel + %1710 = OpPhi %6 %1711 %303 %1712 %296 + OpBranch %279 + %279 = OpLabel + %309 = OpIAdd %6 %1583 %27 + OpBranch %276 + %278 = OpLabel + %311 = OpIEqual %40 %1584 %282 + OpSelectionMerge %313 None + OpBranchConditional %311 %312 %318 + %318 = OpLabel + OpStore %315 %319 + OpBranch %313 + %312 = OpLabel + OpStore %315 %317 + OpBranch %313 + %313 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero.amber b/vulkan/amber/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero.amber new file mode 100644 index 0000000..25b4ac2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero.amber @@ -0,0 +1,1195 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with gl_FragCoord.x less than zero + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct BST { +# int data; +# int leftIndex; +# int rightIndex; +# } ; +# +# BST tree[10]; +# +# void makeTreeNode(inout BST tree, int data) +# { +# tree.data = data; +# tree.leftIndex = - 1; +# tree.rightIndex = - 1; +# } +# void insert(int treeIndex, int data) +# { +# int baseIndex = 0; +# while(baseIndex <= treeIndex) +# { +# if(data <= tree[baseIndex].data) +# { +# if(tree[baseIndex].leftIndex == - 1) +# { +# tree[baseIndex].leftIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].leftIndex; +# continue; +# } +# } +# else +# { +# if(tree[baseIndex].rightIndex == - 1) +# { +# tree[baseIndex].rightIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].rightIndex; +# continue; +# } +# } +# } +# } +# int search(int target) +# { +# BST currentNode; +# int index = 0; +# while(index != - 1) +# { +# currentNode = tree[index]; +# if(currentNode.data == target) +# { +# return target; +# } +# index = target > currentNode.data ? currentNode.rightIndex : currentNode.leftIndex; +# } +# return - 1; +# } +# void main() +# { +# int treeIndex = 0; +# makeTreeNode(tree[0], 9); +# treeIndex ++; +# insert(treeIndex, 5); +# treeIndex ++; +# insert(treeIndex, 12); +# treeIndex ++; +# insert(treeIndex, 15); +# treeIndex ++; +# insert(treeIndex, 7); +# treeIndex ++; +# insert(treeIndex, 8); +# treeIndex ++; +# insert(treeIndex, 2); +# treeIndex ++; +# insert(treeIndex, 6); +# treeIndex ++; +# insert(treeIndex, 17); +# treeIndex ++; +# insert(treeIndex, 13); +# int count = 0; +# for(int i = 0; i < 20; i ++) +# { +# int result = search(i); +# switch(i) +# { +# case 9: +# case 5: +# case 12: +# case 15: +# case 7: +# case 8: +# case 2: +# case 6: +# case 17: +# case 13: +# if(result == i) +# { +# count ++; +# } +# break; +# default: +# if(result == - 1) +# { +# count ++; +# } +# break; +# } +# } +# if(count == 20) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 1.0, 1.0); +# } +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 260 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %254 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "BST" + OpMemberName %7 0 "data" + OpMemberName %7 1 "leftIndex" + OpMemberName %7 2 "rightIndex" + OpName %13 "makeTreeNode(struct-BST-i1-i1-i11;i1;" + OpName %11 "tree" + OpName %12 "data" + OpName %18 "insert(i1;i1;" + OpName %16 "treeIndex" + OpName %17 "data" + OpName %22 "search(i1;" + OpName %21 "target" + OpName %32 "baseIndex" + OpName %47 "tree" + OpName %65 "param" + OpName %69 "param" + OpName %91 "param" + OpName %94 "param" + OpName %105 "index" + OpName %113 "currentNode" + OpName %140 "treeIndex" + OpName %142 "param" + OpName %145 "param" + OpName %152 "param" + OpName %154 "param" + OpName %159 "param" + OpName %161 "param" + OpName %166 "param" + OpName %168 "param" + OpName %173 "param" + OpName %175 "param" + OpName %180 "param" + OpName %182 "param" + OpName %186 "param" + OpName %188 "param" + OpName %193 "param" + OpName %195 "param" + OpName %200 "param" + OpName %202 "param" + OpName %207 "param" + OpName %209 "param" + OpName %211 "count" + OpName %212 "i" + OpName %221 "result" + OpName %222 "param" + OpName %254 "_GLF_color" + OpDecorate %254 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypePointer Function %6 + %10 = OpTypeFunction %2 %8 %9 + %15 = OpTypeFunction %2 %9 %9 + %20 = OpTypeFunction %6 %9 + %24 = OpConstant %6 0 + %27 = OpConstant %6 1 + %28 = OpConstant %6 -1 + %30 = OpConstant %6 2 + %40 = OpTypeBool + %43 = OpTypeInt 32 0 + %44 = OpConstant %43 10 + %45 = OpTypeArray %7 %44 + %46 = OpTypePointer Private %45 + %47 = OpVariable %46 Private + %49 = OpTypePointer Private %6 + %66 = OpTypePointer Private %7 + %141 = OpConstant %6 9 + %151 = OpConstant %6 5 + %158 = OpConstant %6 12 + %165 = OpConstant %6 15 + %172 = OpConstant %6 7 + %179 = OpConstant %6 8 + %192 = OpConstant %6 6 + %199 = OpConstant %6 17 + %206 = OpConstant %6 13 + %219 = OpConstant %6 20 + %251 = OpTypeFloat 32 + %252 = OpTypeVector %251 4 + %253 = OpTypePointer Output %252 + %254 = OpVariable %253 Output + %255 = OpConstant %251 1 + %256 = OpConstant %251 0 + %257 = OpConstantComposite %252 %255 %256 %256 %255 + %259 = OpConstantComposite %252 %256 %256 %255 %255 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %140 = OpVariable %9 Function + %142 = OpVariable %8 Function + %145 = OpVariable %9 Function + %152 = OpVariable %9 Function + %154 = OpVariable %9 Function + %159 = OpVariable %9 Function + %161 = OpVariable %9 Function + %166 = OpVariable %9 Function + %168 = OpVariable %9 Function + %173 = OpVariable %9 Function + %175 = OpVariable %9 Function + %180 = OpVariable %9 Function + %182 = OpVariable %9 Function + %186 = OpVariable %9 Function + %188 = OpVariable %9 Function + %193 = OpVariable %9 Function + %195 = OpVariable %9 Function + %200 = OpVariable %9 Function + %202 = OpVariable %9 Function + %207 = OpVariable %9 Function + %209 = OpVariable %9 Function + %211 = OpVariable %9 Function + %212 = OpVariable %9 Function + %221 = OpVariable %9 Function + %222 = OpVariable %9 Function + OpStore %140 %24 + %143 = OpAccessChain %66 %47 %24 + %144 = OpLoad %7 %143 + OpStore %142 %144 + OpStore %145 %141 + %146 = OpFunctionCall %2 %13 %142 %145 + %147 = OpLoad %7 %142 + %148 = OpAccessChain %66 %47 %24 + OpStore %148 %147 + %149 = OpLoad %6 %140 + %150 = OpIAdd %6 %149 %27 + OpStore %140 %150 + %153 = OpLoad %6 %140 + OpStore %152 %153 + OpStore %154 %151 + %155 = OpFunctionCall %2 %18 %152 %154 + %156 = OpLoad %6 %140 + %157 = OpIAdd %6 %156 %27 + OpStore %140 %157 + %160 = OpLoad %6 %140 + OpStore %159 %160 + OpStore %161 %158 + %162 = OpFunctionCall %2 %18 %159 %161 + %163 = OpLoad %6 %140 + %164 = OpIAdd %6 %163 %27 + OpStore %140 %164 + %167 = OpLoad %6 %140 + OpStore %166 %167 + OpStore %168 %165 + %169 = OpFunctionCall %2 %18 %166 %168 + %170 = OpLoad %6 %140 + %171 = OpIAdd %6 %170 %27 + OpStore %140 %171 + %174 = OpLoad %6 %140 + OpStore %173 %174 + OpStore %175 %172 + %176 = OpFunctionCall %2 %18 %173 %175 + %177 = OpLoad %6 %140 + %178 = OpIAdd %6 %177 %27 + OpStore %140 %178 + %181 = OpLoad %6 %140 + OpStore %180 %181 + OpStore %182 %179 + %183 = OpFunctionCall %2 %18 %180 %182 + %184 = OpLoad %6 %140 + %185 = OpIAdd %6 %184 %27 + OpStore %140 %185 + %187 = OpLoad %6 %140 + OpStore %186 %187 + OpStore %188 %30 + %189 = OpFunctionCall %2 %18 %186 %188 + %190 = OpLoad %6 %140 + %191 = OpIAdd %6 %190 %27 + OpStore %140 %191 + %194 = OpLoad %6 %140 + OpStore %193 %194 + OpStore %195 %192 + %196 = OpFunctionCall %2 %18 %193 %195 + %197 = OpLoad %6 %140 + %198 = OpIAdd %6 %197 %27 + OpStore %140 %198 + %201 = OpLoad %6 %140 + OpStore %200 %201 + OpStore %202 %199 + %203 = OpFunctionCall %2 %18 %200 %202 + %204 = OpLoad %6 %140 + %205 = OpIAdd %6 %204 %27 + OpStore %140 %205 + %208 = OpLoad %6 %140 + OpStore %207 %208 + OpStore %209 %206 + %210 = OpFunctionCall %2 %18 %207 %209 + OpStore %211 %24 + OpStore %212 %24 + OpBranch %213 + %213 = OpLabel + OpLoopMerge %215 %216 None + OpBranch %217 + %217 = OpLabel + %218 = OpLoad %6 %212 + %220 = OpSLessThan %40 %218 %219 + OpBranchConditional %220 %214 %215 + %214 = OpLabel + %223 = OpLoad %6 %212 + OpStore %222 %223 + %224 = OpFunctionCall %6 %22 %222 + OpStore %221 %224 + %225 = OpLoad %6 %212 + OpSelectionMerge %228 None + OpSwitch %225 %227 9 %226 5 %226 12 %226 15 %226 7 %226 8 %226 2 %226 6 %226 17 %226 13 %226 + %227 = OpLabel + %237 = OpLoad %6 %221 + %238 = OpIEqual %40 %237 %28 + OpSelectionMerge %240 None + OpBranchConditional %238 %239 %240 + %239 = OpLabel + %241 = OpLoad %6 %211 + %242 = OpIAdd %6 %241 %27 + OpStore %211 %242 + OpBranch %240 + %240 = OpLabel + OpBranch %228 + %226 = OpLabel + %229 = OpLoad %6 %221 + %230 = OpLoad %6 %212 + %231 = OpIEqual %40 %229 %230 + OpSelectionMerge %233 None + OpBranchConditional %231 %232 %233 + %232 = OpLabel + %234 = OpLoad %6 %211 + %235 = OpIAdd %6 %234 %27 + OpStore %211 %235 + OpBranch %233 + %233 = OpLabel + OpBranch %228 + %228 = OpLabel + OpBranch %216 + %216 = OpLabel + %245 = OpLoad %6 %212 + %246 = OpIAdd %6 %245 %27 + OpStore %212 %246 + OpBranch %213 + %215 = OpLabel + %247 = OpLoad %6 %211 + %248 = OpIEqual %40 %247 %219 + OpSelectionMerge %250 None + OpBranchConditional %248 %249 %258 + %249 = OpLabel + OpStore %254 %257 + OpBranch %250 + %258 = OpLabel + OpStore %254 %259 + OpBranch %250 + %250 = OpLabel + OpReturn + OpFunctionEnd + %13 = OpFunction %2 None %10 + %11 = OpFunctionParameter %8 + %12 = OpFunctionParameter %9 + %14 = OpLabel + %25 = OpLoad %6 %12 + %26 = OpAccessChain %9 %11 %24 + OpStore %26 %25 + %29 = OpAccessChain %9 %11 %27 + OpStore %29 %28 + %31 = OpAccessChain %9 %11 %30 + OpStore %31 %28 + OpReturn + OpFunctionEnd + %18 = OpFunction %2 None %15 + %16 = OpFunctionParameter %9 + %17 = OpFunctionParameter %9 + %19 = OpLabel + %32 = OpVariable %9 Function + %65 = OpVariable %8 Function + %69 = OpVariable %9 Function + %91 = OpVariable %8 Function + %94 = OpVariable %9 Function + OpStore %32 %24 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %6 %32 + %39 = OpLoad %6 %16 + %41 = OpSLessThanEqual %40 %38 %39 + OpBranchConditional %41 %34 %35 + %34 = OpLabel + %42 = OpLoad %6 %17 + %48 = OpLoad %6 %32 + %50 = OpAccessChain %49 %47 %48 %24 + %51 = OpLoad %6 %50 + %52 = OpSLessThanEqual %40 %42 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %80 + %53 = OpLabel + %55 = OpLoad %6 %32 + %56 = OpAccessChain %49 %47 %55 %27 + %57 = OpLoad %6 %56 + %58 = OpIEqual %40 %57 %28 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %75 + %59 = OpLabel + %61 = OpLoad %6 %32 + %62 = OpLoad %6 %16 + %63 = OpAccessChain %49 %47 %61 %27 + OpStore %63 %62 + %64 = OpLoad %6 %16 + %67 = OpAccessChain %66 %47 %64 + %68 = OpLoad %7 %67 + OpStore %65 %68 + %70 = OpLoad %6 %17 + OpStore %69 %70 + %71 = OpFunctionCall %2 %13 %65 %69 + %72 = OpLoad %7 %65 + %73 = OpAccessChain %66 %47 %64 + OpStore %73 %72 + OpReturn + %75 = OpLabel + %76 = OpLoad %6 %32 + %77 = OpAccessChain %49 %47 %76 %27 + %78 = OpLoad %6 %77 + OpStore %32 %78 + OpBranch %36 + %60 = OpLabel + OpUnreachable + %80 = OpLabel + %81 = OpLoad %6 %32 + %82 = OpAccessChain %49 %47 %81 %30 + %83 = OpLoad %6 %82 + %84 = OpIEqual %40 %83 %28 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %100 + %85 = OpLabel + %87 = OpLoad %6 %32 + %88 = OpLoad %6 %16 + %89 = OpAccessChain %49 %47 %87 %30 + OpStore %89 %88 + %90 = OpLoad %6 %16 + %92 = OpAccessChain %66 %47 %90 + %93 = OpLoad %7 %92 + OpStore %91 %93 + %95 = OpLoad %6 %17 + OpStore %94 %95 + %96 = OpFunctionCall %2 %13 %91 %94 + %97 = OpLoad %7 %91 + %98 = OpAccessChain %66 %47 %90 + OpStore %98 %97 + OpReturn + %100 = OpLabel + %101 = OpLoad %6 %32 + %102 = OpAccessChain %49 %47 %101 %30 + %103 = OpLoad %6 %102 + OpStore %32 %103 + OpBranch %36 + %86 = OpLabel + OpUnreachable + %54 = OpLabel + OpUnreachable + %36 = OpLabel + OpBranch %33 + %35 = OpLabel + OpReturn + OpFunctionEnd + %22 = OpFunction %6 None %20 + %21 = OpFunctionParameter %9 + %23 = OpLabel + %105 = OpVariable %9 Function + %113 = OpVariable %8 Function + %129 = OpVariable %9 Function + OpStore %105 %24 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %108 %109 None + OpBranch %110 + %110 = OpLabel + %111 = OpLoad %6 %105 + %112 = OpINotEqual %40 %111 %28 + OpBranchConditional %112 %107 %108 + %107 = OpLabel + %114 = OpLoad %6 %105 + %115 = OpAccessChain %66 %47 %114 + %116 = OpLoad %7 %115 + OpStore %113 %116 + %117 = OpAccessChain %9 %113 %24 + %118 = OpLoad %6 %117 + %119 = OpLoad %6 %21 + %120 = OpIEqual %40 %118 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpLoad %6 %21 + OpReturnValue %123 + %122 = OpLabel + %125 = OpLoad %6 %21 + %126 = OpAccessChain %9 %113 %24 + %127 = OpLoad %6 %126 + %128 = OpSGreaterThan %40 %125 %127 + OpSelectionMerge %131 None + OpBranchConditional %128 %130 %134 + %130 = OpLabel + %132 = OpAccessChain %9 %113 %30 + %133 = OpLoad %6 %132 + OpStore %129 %133 + OpBranch %131 + %134 = OpLabel + %135 = OpAccessChain %9 %113 %27 + %136 = OpLoad %6 %135 + OpStore %129 %136 + OpBranch %131 + %131 = OpLabel + %137 = OpLoad %6 %129 + OpStore %105 %137 + OpBranch %109 + %109 = OpLabel + OpBranch %106 + %108 = OpLabel + OpReturnValue %28 + OpFunctionEnd +END + + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct BST { +# int data; +# int leftIndex; +# int rightIndex; +# } ; +# +# BST tree[10]; +# +# void makeTreeNode(inout BST tree, int data) +# { +# tree.data = data; +# tree.leftIndex = - 1; +# tree.rightIndex = - 1; +# } +# void insert(int treeIndex, int data) +# { +# int baseIndex = 0; +# while(baseIndex <= treeIndex) +# { +# if(data <= tree[baseIndex].data) +# { +# if(tree[baseIndex].leftIndex == - 1) +# { +# tree[baseIndex].leftIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].leftIndex; +# continue; +# } +# } +# else +# { +# if(tree[baseIndex].rightIndex == - 1) +# { +# tree[baseIndex].rightIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].rightIndex; +# continue; +# } +# } +# } +# } +# int search(int target) +# { +# BST currentNode; +# int index = 0; +# while(index != - 1) +# { +# currentNode = tree[index]; +# if(currentNode.data == target) +# { +# return target; +# } +# index = target > currentNode.data ? currentNode.rightIndex : currentNode.leftIndex; +# } +# return - 1; +# } +# void main() +# { +# int treeIndex = 0; +# makeTreeNode(tree[0], 9); +# treeIndex ++; +# insert(treeIndex, 5); +# treeIndex ++; +# insert(treeIndex, 12); +# treeIndex ++; +# insert(treeIndex, 15); +# treeIndex ++; +# insert(treeIndex, 7); +# treeIndex ++; +# insert(treeIndex, 8); +# treeIndex ++; +# insert(treeIndex, 2); +# treeIndex ++; +# insert(treeIndex, 6); +# treeIndex ++; +# insert(treeIndex, 17); +# treeIndex ++; +# insert(treeIndex, 13); +# int count = 0; +# for(int i = 0; i < 20; i ++) +# { +# int result = search(i); +# switch(i) +# { +# case 9: +# case 5: +# case 12: +# case 15: +# case 7: +# case 8: +# case 2: +# case 6: +# case 17: +# case 13: +# // Always false: gl_Frag_Coord.x < 0.0 +# // Thus, the end result is the same as in the reference shader. +# if((result == i) || (gl_FragCoord.x < 0.0)) +# { +# count ++; +# } +# break; +# default: +# if(result == - 1) +# { +# count ++; +# } +# break; +# } +# } +# if(count == 20) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 1.0, 1.0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 271 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %238 %266 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "BST" + OpMemberName %7 0 "data" + OpMemberName %7 1 "leftIndex" + OpMemberName %7 2 "rightIndex" + OpName %13 "makeTreeNode(struct-BST-i1-i1-i11;i1;" + OpName %11 "tree" + OpName %12 "data" + OpName %18 "insert(i1;i1;" + OpName %16 "treeIndex" + OpName %17 "data" + OpName %22 "search(i1;" + OpName %21 "target" + OpName %32 "baseIndex" + OpName %47 "tree" + OpName %65 "param" + OpName %69 "param" + OpName %91 "param" + OpName %94 "param" + OpName %105 "index" + OpName %113 "currentNode" + OpName %140 "treeIndex" + OpName %142 "param" + OpName %145 "param" + OpName %152 "param" + OpName %154 "param" + OpName %159 "param" + OpName %161 "param" + OpName %166 "param" + OpName %168 "param" + OpName %173 "param" + OpName %175 "param" + OpName %180 "param" + OpName %182 "param" + OpName %186 "param" + OpName %188 "param" + OpName %193 "param" + OpName %195 "param" + OpName %200 "param" + OpName %202 "param" + OpName %207 "param" + OpName %209 "param" + OpName %211 "count" + OpName %212 "i" + OpName %221 "result" + OpName %222 "param" + OpName %238 "gl_FragCoord" + OpName %266 "_GLF_color" + OpDecorate %238 BuiltIn FragCoord + OpDecorate %266 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypePointer Function %6 + %10 = OpTypeFunction %2 %8 %9 + %15 = OpTypeFunction %2 %9 %9 + %20 = OpTypeFunction %6 %9 + %24 = OpConstant %6 0 + %27 = OpConstant %6 1 + %28 = OpConstant %6 -1 + %30 = OpConstant %6 2 + %40 = OpTypeBool + %43 = OpTypeInt 32 0 + %44 = OpConstant %43 10 + %45 = OpTypeArray %7 %44 + %46 = OpTypePointer Private %45 + %47 = OpVariable %46 Private + %49 = OpTypePointer Private %6 + %66 = OpTypePointer Private %7 + %141 = OpConstant %6 9 + %151 = OpConstant %6 5 + %158 = OpConstant %6 12 + %165 = OpConstant %6 15 + %172 = OpConstant %6 7 + %179 = OpConstant %6 8 + %192 = OpConstant %6 6 + %199 = OpConstant %6 17 + %206 = OpConstant %6 13 + %219 = OpConstant %6 20 + %235 = OpTypeFloat 32 + %236 = OpTypeVector %235 4 + %237 = OpTypePointer Input %236 + %238 = OpVariable %237 Input + %239 = OpConstant %43 0 + %240 = OpTypePointer Input %235 + %243 = OpConstant %235 0 + %265 = OpTypePointer Output %236 + %266 = OpVariable %265 Output + %267 = OpConstant %235 1 + %268 = OpConstantComposite %236 %267 %243 %243 %267 + %270 = OpConstantComposite %236 %243 %243 %267 %267 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %140 = OpVariable %9 Function + %142 = OpVariable %8 Function + %145 = OpVariable %9 Function + %152 = OpVariable %9 Function + %154 = OpVariable %9 Function + %159 = OpVariable %9 Function + %161 = OpVariable %9 Function + %166 = OpVariable %9 Function + %168 = OpVariable %9 Function + %173 = OpVariable %9 Function + %175 = OpVariable %9 Function + %180 = OpVariable %9 Function + %182 = OpVariable %9 Function + %186 = OpVariable %9 Function + %188 = OpVariable %9 Function + %193 = OpVariable %9 Function + %195 = OpVariable %9 Function + %200 = OpVariable %9 Function + %202 = OpVariable %9 Function + %207 = OpVariable %9 Function + %209 = OpVariable %9 Function + %211 = OpVariable %9 Function + %212 = OpVariable %9 Function + %221 = OpVariable %9 Function + %222 = OpVariable %9 Function + OpStore %140 %24 + %143 = OpAccessChain %66 %47 %24 + %144 = OpLoad %7 %143 + OpStore %142 %144 + OpStore %145 %141 + %146 = OpFunctionCall %2 %13 %142 %145 + %147 = OpLoad %7 %142 + %148 = OpAccessChain %66 %47 %24 + OpStore %148 %147 + %149 = OpLoad %6 %140 + %150 = OpIAdd %6 %149 %27 + OpStore %140 %150 + %153 = OpLoad %6 %140 + OpStore %152 %153 + OpStore %154 %151 + %155 = OpFunctionCall %2 %18 %152 %154 + %156 = OpLoad %6 %140 + %157 = OpIAdd %6 %156 %27 + OpStore %140 %157 + %160 = OpLoad %6 %140 + OpStore %159 %160 + OpStore %161 %158 + %162 = OpFunctionCall %2 %18 %159 %161 + %163 = OpLoad %6 %140 + %164 = OpIAdd %6 %163 %27 + OpStore %140 %164 + %167 = OpLoad %6 %140 + OpStore %166 %167 + OpStore %168 %165 + %169 = OpFunctionCall %2 %18 %166 %168 + %170 = OpLoad %6 %140 + %171 = OpIAdd %6 %170 %27 + OpStore %140 %171 + %174 = OpLoad %6 %140 + OpStore %173 %174 + OpStore %175 %172 + %176 = OpFunctionCall %2 %18 %173 %175 + %177 = OpLoad %6 %140 + %178 = OpIAdd %6 %177 %27 + OpStore %140 %178 + %181 = OpLoad %6 %140 + OpStore %180 %181 + OpStore %182 %179 + %183 = OpFunctionCall %2 %18 %180 %182 + %184 = OpLoad %6 %140 + %185 = OpIAdd %6 %184 %27 + OpStore %140 %185 + %187 = OpLoad %6 %140 + OpStore %186 %187 + OpStore %188 %30 + %189 = OpFunctionCall %2 %18 %186 %188 + %190 = OpLoad %6 %140 + %191 = OpIAdd %6 %190 %27 + OpStore %140 %191 + %194 = OpLoad %6 %140 + OpStore %193 %194 + OpStore %195 %192 + %196 = OpFunctionCall %2 %18 %193 %195 + %197 = OpLoad %6 %140 + %198 = OpIAdd %6 %197 %27 + OpStore %140 %198 + %201 = OpLoad %6 %140 + OpStore %200 %201 + OpStore %202 %199 + %203 = OpFunctionCall %2 %18 %200 %202 + %204 = OpLoad %6 %140 + %205 = OpIAdd %6 %204 %27 + OpStore %140 %205 + %208 = OpLoad %6 %140 + OpStore %207 %208 + OpStore %209 %206 + %210 = OpFunctionCall %2 %18 %207 %209 + OpStore %211 %24 + OpStore %212 %24 + OpBranch %213 + %213 = OpLabel + OpLoopMerge %215 %216 None + OpBranch %217 + %217 = OpLabel + %218 = OpLoad %6 %212 + %220 = OpSLessThan %40 %218 %219 + OpBranchConditional %220 %214 %215 + %214 = OpLabel + %223 = OpLoad %6 %212 + OpStore %222 %223 + %224 = OpFunctionCall %6 %22 %222 + OpStore %221 %224 + %225 = OpLoad %6 %212 + OpSelectionMerge %228 None + OpSwitch %225 %227 9 %226 5 %226 12 %226 15 %226 7 %226 8 %226 2 %226 6 %226 17 %226 13 %226 + %227 = OpLabel + %251 = OpLoad %6 %221 + %252 = OpIEqual %40 %251 %28 + OpSelectionMerge %254 None + OpBranchConditional %252 %253 %254 + %253 = OpLabel + %255 = OpLoad %6 %211 + %256 = OpIAdd %6 %255 %27 + OpStore %211 %256 + OpBranch %254 + %254 = OpLabel + OpBranch %228 + %226 = OpLabel + %229 = OpLoad %6 %221 + %230 = OpLoad %6 %212 + %231 = OpIEqual %40 %229 %230 + %232 = OpLogicalNot %40 %231 + OpSelectionMerge %234 None + OpBranchConditional %232 %233 %234 + %233 = OpLabel + %241 = OpAccessChain %240 %238 %239 + %242 = OpLoad %235 %241 + %244 = OpFOrdLessThan %40 %242 %243 + OpBranch %234 + %234 = OpLabel + %245 = OpPhi %40 %231 %226 %244 %233 + OpSelectionMerge %247 None + OpBranchConditional %245 %246 %247 + %246 = OpLabel + %248 = OpLoad %6 %211 + %249 = OpIAdd %6 %248 %27 + OpStore %211 %249 + OpBranch %247 + %247 = OpLabel + OpBranch %228 + %228 = OpLabel + OpBranch %216 + %216 = OpLabel + %259 = OpLoad %6 %212 + %260 = OpIAdd %6 %259 %27 + OpStore %212 %260 + OpBranch %213 + %215 = OpLabel + %261 = OpLoad %6 %211 + %262 = OpIEqual %40 %261 %219 + OpSelectionMerge %264 None + OpBranchConditional %262 %263 %269 + %263 = OpLabel + OpStore %266 %268 + OpBranch %264 + %269 = OpLabel + OpStore %266 %270 + OpBranch %264 + %264 = OpLabel + OpReturn + OpFunctionEnd + %13 = OpFunction %2 None %10 + %11 = OpFunctionParameter %8 + %12 = OpFunctionParameter %9 + %14 = OpLabel + %25 = OpLoad %6 %12 + %26 = OpAccessChain %9 %11 %24 + OpStore %26 %25 + %29 = OpAccessChain %9 %11 %27 + OpStore %29 %28 + %31 = OpAccessChain %9 %11 %30 + OpStore %31 %28 + OpReturn + OpFunctionEnd + %18 = OpFunction %2 None %15 + %16 = OpFunctionParameter %9 + %17 = OpFunctionParameter %9 + %19 = OpLabel + %32 = OpVariable %9 Function + %65 = OpVariable %8 Function + %69 = OpVariable %9 Function + %91 = OpVariable %8 Function + %94 = OpVariable %9 Function + OpStore %32 %24 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %6 %32 + %39 = OpLoad %6 %16 + %41 = OpSLessThanEqual %40 %38 %39 + OpBranchConditional %41 %34 %35 + %34 = OpLabel + %42 = OpLoad %6 %17 + %48 = OpLoad %6 %32 + %50 = OpAccessChain %49 %47 %48 %24 + %51 = OpLoad %6 %50 + %52 = OpSLessThanEqual %40 %42 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %80 + %53 = OpLabel + %55 = OpLoad %6 %32 + %56 = OpAccessChain %49 %47 %55 %27 + %57 = OpLoad %6 %56 + %58 = OpIEqual %40 %57 %28 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %75 + %59 = OpLabel + %61 = OpLoad %6 %32 + %62 = OpLoad %6 %16 + %63 = OpAccessChain %49 %47 %61 %27 + OpStore %63 %62 + %64 = OpLoad %6 %16 + %67 = OpAccessChain %66 %47 %64 + %68 = OpLoad %7 %67 + OpStore %65 %68 + %70 = OpLoad %6 %17 + OpStore %69 %70 + %71 = OpFunctionCall %2 %13 %65 %69 + %72 = OpLoad %7 %65 + %73 = OpAccessChain %66 %47 %64 + OpStore %73 %72 + OpReturn + %75 = OpLabel + %76 = OpLoad %6 %32 + %77 = OpAccessChain %49 %47 %76 %27 + %78 = OpLoad %6 %77 + OpStore %32 %78 + OpBranch %36 + %60 = OpLabel + OpUnreachable + %80 = OpLabel + %81 = OpLoad %6 %32 + %82 = OpAccessChain %49 %47 %81 %30 + %83 = OpLoad %6 %82 + %84 = OpIEqual %40 %83 %28 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %100 + %85 = OpLabel + %87 = OpLoad %6 %32 + %88 = OpLoad %6 %16 + %89 = OpAccessChain %49 %47 %87 %30 + OpStore %89 %88 + %90 = OpLoad %6 %16 + %92 = OpAccessChain %66 %47 %90 + %93 = OpLoad %7 %92 + OpStore %91 %93 + %95 = OpLoad %6 %17 + OpStore %94 %95 + %96 = OpFunctionCall %2 %13 %91 %94 + %97 = OpLoad %7 %91 + %98 = OpAccessChain %66 %47 %90 + OpStore %98 %97 + OpReturn + %100 = OpLabel + %101 = OpLoad %6 %32 + %102 = OpAccessChain %49 %47 %101 %30 + %103 = OpLoad %6 %102 + OpStore %32 %103 + OpBranch %36 + %86 = OpLabel + OpUnreachable + %54 = OpLabel + OpUnreachable + %36 = OpLabel + OpBranch %33 + %35 = OpLabel + OpReturn + OpFunctionEnd + %22 = OpFunction %6 None %20 + %21 = OpFunctionParameter %9 + %23 = OpLabel + %105 = OpVariable %9 Function + %113 = OpVariable %8 Function + %129 = OpVariable %9 Function + OpStore %105 %24 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %108 %109 None + OpBranch %110 + %110 = OpLabel + %111 = OpLoad %6 %105 + %112 = OpINotEqual %40 %111 %28 + OpBranchConditional %112 %107 %108 + %107 = OpLabel + %114 = OpLoad %6 %105 + %115 = OpAccessChain %66 %47 %114 + %116 = OpLoad %7 %115 + OpStore %113 %116 + %117 = OpAccessChain %9 %113 %24 + %118 = OpLoad %6 %117 + %119 = OpLoad %6 %21 + %120 = OpIEqual %40 %118 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpLoad %6 %21 + OpReturnValue %123 + %122 = OpLabel + %125 = OpLoad %6 %21 + %126 = OpAccessChain %9 %113 %24 + %127 = OpLoad %6 %126 + %128 = OpSGreaterThan %40 %125 %127 + OpSelectionMerge %131 None + OpBranchConditional %128 %130 %134 + %130 = OpLabel + %132 = OpAccessChain %9 %113 %30 + %133 = OpLoad %6 %132 + OpStore %129 %133 + OpBranch %131 + %134 = OpLabel + %135 = OpAccessChain %9 %113 %27 + %136 = OpLoad %6 %135 + OpStore %129 %136 + OpBranch %131 + %131 = OpLabel + %137 = OpLoad %6 %129 + OpStore %105 %137 + OpBranch %109 + %109 = OpLabel + OpBranch %106 + %108 = OpLabel + OpReturnValue %28 + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional.amber b/vulkan/amber/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional.amber new file mode 100644 index 0000000..2a95fd3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional.amber @@ -0,0 +1,1267 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with nested if and conditional statement + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct BST +# { +# int data; +# int leftIndex; +# int rightIndex; +# }; +# +# BST tree[10]; +# +# void makeTreeNode(inout BST tree, int data) +# { +# tree.data = data; +# tree.leftIndex = -1; +# tree.rightIndex = -1; +# } +# void insert(int treeIndex, int data) +# { +# int baseIndex = 0; +# while (baseIndex <= treeIndex) +# { +# if (data <= tree[baseIndex].data) +# { +# if (tree[baseIndex].leftIndex == -1) +# { +# tree[baseIndex].leftIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].leftIndex; +# continue; +# } +# } +# else +# { +# if (tree[baseIndex].rightIndex == -1) +# { +# tree[baseIndex].rightIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].rightIndex; +# continue; +# } +# } +# } +# } +# int search(int target) +# { +# BST currentNode; +# int index = 0; +# while (index != -1) +# { +# currentNode = tree[index]; +# if (currentNode.data == target) +# { +# return target; +# } +# index = target > currentNode.data ? currentNode.rightIndex : currentNode.leftIndex; +# } +# return -1; +# } +# void main() +# { +# int treeIndex = 0; +# makeTreeNode(tree[0], 9); +# treeIndex++; +# insert(treeIndex, 5); +# treeIndex++; +# insert(treeIndex, 12); +# treeIndex++; +# insert(treeIndex, 15); +# treeIndex++; +# insert(treeIndex, 7); +# treeIndex++; +# insert(treeIndex, 8); +# treeIndex++; +# insert(treeIndex, 2); +# treeIndex++; +# insert(treeIndex, 6); +# treeIndex++; +# insert(treeIndex, 17); +# treeIndex++; +# insert(treeIndex, 13); +# int count = 0; +# for (int i = 0; i < 20; i++) +# { +# int result = search(i); +# switch (i) +# { +# case 9: +# case 5: +# case 12: +# case 15: +# case 7: +# case 8: +# case 2: +# case 6: +# case 17: +# case 13: +# if (result == i) +# { +# count++; +# } +# break; +# default: +# if (result == -1) +# { +# count++; +# } +# break; +# } +# } +# if (count == 20) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 1.0, 1.0); +# } +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 260 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %254 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "BST" + OpMemberName %7 0 "data" + OpMemberName %7 1 "leftIndex" + OpMemberName %7 2 "rightIndex" + OpName %13 "makeTreeNode(struct-BST-i1-i1-i11;i1;" + OpName %11 "tree" + OpName %12 "data" + OpName %18 "insert(i1;i1;" + OpName %16 "treeIndex" + OpName %17 "data" + OpName %22 "search(i1;" + OpName %21 "target" + OpName %32 "baseIndex" + OpName %47 "tree" + OpName %65 "param" + OpName %69 "param" + OpName %91 "param" + OpName %94 "param" + OpName %105 "index" + OpName %113 "currentNode" + OpName %140 "treeIndex" + OpName %142 "param" + OpName %145 "param" + OpName %152 "param" + OpName %154 "param" + OpName %159 "param" + OpName %161 "param" + OpName %166 "param" + OpName %168 "param" + OpName %173 "param" + OpName %175 "param" + OpName %180 "param" + OpName %182 "param" + OpName %186 "param" + OpName %188 "param" + OpName %193 "param" + OpName %195 "param" + OpName %200 "param" + OpName %202 "param" + OpName %207 "param" + OpName %209 "param" + OpName %211 "count" + OpName %212 "i" + OpName %221 "result" + OpName %222 "param" + OpName %254 "_GLF_color" + OpDecorate %254 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypePointer Function %6 + %10 = OpTypeFunction %2 %8 %9 + %15 = OpTypeFunction %2 %9 %9 + %20 = OpTypeFunction %6 %9 + %24 = OpConstant %6 0 + %27 = OpConstant %6 1 + %28 = OpConstant %6 -1 + %30 = OpConstant %6 2 + %40 = OpTypeBool + %43 = OpTypeInt 32 0 + %44 = OpConstant %43 10 + %45 = OpTypeArray %7 %44 + %46 = OpTypePointer Private %45 + %47 = OpVariable %46 Private + %49 = OpTypePointer Private %6 + %66 = OpTypePointer Private %7 + %141 = OpConstant %6 9 + %151 = OpConstant %6 5 + %158 = OpConstant %6 12 + %165 = OpConstant %6 15 + %172 = OpConstant %6 7 + %179 = OpConstant %6 8 + %192 = OpConstant %6 6 + %199 = OpConstant %6 17 + %206 = OpConstant %6 13 + %219 = OpConstant %6 20 + %251 = OpTypeFloat 32 + %252 = OpTypeVector %251 4 + %253 = OpTypePointer Output %252 + %254 = OpVariable %253 Output + %255 = OpConstant %251 1 + %256 = OpConstant %251 0 + %257 = OpConstantComposite %252 %255 %256 %256 %255 + %259 = OpConstantComposite %252 %256 %256 %255 %255 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %140 = OpVariable %9 Function + %142 = OpVariable %8 Function + %145 = OpVariable %9 Function + %152 = OpVariable %9 Function + %154 = OpVariable %9 Function + %159 = OpVariable %9 Function + %161 = OpVariable %9 Function + %166 = OpVariable %9 Function + %168 = OpVariable %9 Function + %173 = OpVariable %9 Function + %175 = OpVariable %9 Function + %180 = OpVariable %9 Function + %182 = OpVariable %9 Function + %186 = OpVariable %9 Function + %188 = OpVariable %9 Function + %193 = OpVariable %9 Function + %195 = OpVariable %9 Function + %200 = OpVariable %9 Function + %202 = OpVariable %9 Function + %207 = OpVariable %9 Function + %209 = OpVariable %9 Function + %211 = OpVariable %9 Function + %212 = OpVariable %9 Function + %221 = OpVariable %9 Function + %222 = OpVariable %9 Function + OpStore %140 %24 + %143 = OpAccessChain %66 %47 %24 + %144 = OpLoad %7 %143 + OpStore %142 %144 + OpStore %145 %141 + %146 = OpFunctionCall %2 %13 %142 %145 + %147 = OpLoad %7 %142 + %148 = OpAccessChain %66 %47 %24 + OpStore %148 %147 + %149 = OpLoad %6 %140 + %150 = OpIAdd %6 %149 %27 + OpStore %140 %150 + %153 = OpLoad %6 %140 + OpStore %152 %153 + OpStore %154 %151 + %155 = OpFunctionCall %2 %18 %152 %154 + %156 = OpLoad %6 %140 + %157 = OpIAdd %6 %156 %27 + OpStore %140 %157 + %160 = OpLoad %6 %140 + OpStore %159 %160 + OpStore %161 %158 + %162 = OpFunctionCall %2 %18 %159 %161 + %163 = OpLoad %6 %140 + %164 = OpIAdd %6 %163 %27 + OpStore %140 %164 + %167 = OpLoad %6 %140 + OpStore %166 %167 + OpStore %168 %165 + %169 = OpFunctionCall %2 %18 %166 %168 + %170 = OpLoad %6 %140 + %171 = OpIAdd %6 %170 %27 + OpStore %140 %171 + %174 = OpLoad %6 %140 + OpStore %173 %174 + OpStore %175 %172 + %176 = OpFunctionCall %2 %18 %173 %175 + %177 = OpLoad %6 %140 + %178 = OpIAdd %6 %177 %27 + OpStore %140 %178 + %181 = OpLoad %6 %140 + OpStore %180 %181 + OpStore %182 %179 + %183 = OpFunctionCall %2 %18 %180 %182 + %184 = OpLoad %6 %140 + %185 = OpIAdd %6 %184 %27 + OpStore %140 %185 + %187 = OpLoad %6 %140 + OpStore %186 %187 + OpStore %188 %30 + %189 = OpFunctionCall %2 %18 %186 %188 + %190 = OpLoad %6 %140 + %191 = OpIAdd %6 %190 %27 + OpStore %140 %191 + %194 = OpLoad %6 %140 + OpStore %193 %194 + OpStore %195 %192 + %196 = OpFunctionCall %2 %18 %193 %195 + %197 = OpLoad %6 %140 + %198 = OpIAdd %6 %197 %27 + OpStore %140 %198 + %201 = OpLoad %6 %140 + OpStore %200 %201 + OpStore %202 %199 + %203 = OpFunctionCall %2 %18 %200 %202 + %204 = OpLoad %6 %140 + %205 = OpIAdd %6 %204 %27 + OpStore %140 %205 + %208 = OpLoad %6 %140 + OpStore %207 %208 + OpStore %209 %206 + %210 = OpFunctionCall %2 %18 %207 %209 + OpStore %211 %24 + OpStore %212 %24 + OpBranch %213 + %213 = OpLabel + OpLoopMerge %215 %216 None + OpBranch %217 + %217 = OpLabel + %218 = OpLoad %6 %212 + %220 = OpSLessThan %40 %218 %219 + OpBranchConditional %220 %214 %215 + %214 = OpLabel + %223 = OpLoad %6 %212 + OpStore %222 %223 + %224 = OpFunctionCall %6 %22 %222 + OpStore %221 %224 + %225 = OpLoad %6 %212 + OpSelectionMerge %228 None + OpSwitch %225 %227 9 %226 5 %226 12 %226 15 %226 7 %226 8 %226 2 %226 6 %226 17 %226 13 %226 + %227 = OpLabel + %237 = OpLoad %6 %221 + %238 = OpIEqual %40 %237 %28 + OpSelectionMerge %240 None + OpBranchConditional %238 %239 %240 + %239 = OpLabel + %241 = OpLoad %6 %211 + %242 = OpIAdd %6 %241 %27 + OpStore %211 %242 + OpBranch %240 + %240 = OpLabel + OpBranch %228 + %226 = OpLabel + %229 = OpLoad %6 %221 + %230 = OpLoad %6 %212 + %231 = OpIEqual %40 %229 %230 + OpSelectionMerge %233 None + OpBranchConditional %231 %232 %233 + %232 = OpLabel + %234 = OpLoad %6 %211 + %235 = OpIAdd %6 %234 %27 + OpStore %211 %235 + OpBranch %233 + %233 = OpLabel + OpBranch %228 + %228 = OpLabel + OpBranch %216 + %216 = OpLabel + %245 = OpLoad %6 %212 + %246 = OpIAdd %6 %245 %27 + OpStore %212 %246 + OpBranch %213 + %215 = OpLabel + %247 = OpLoad %6 %211 + %248 = OpIEqual %40 %247 %219 + OpSelectionMerge %250 None + OpBranchConditional %248 %249 %258 + %249 = OpLabel + OpStore %254 %257 + OpBranch %250 + %258 = OpLabel + OpStore %254 %259 + OpBranch %250 + %250 = OpLabel + OpReturn + OpFunctionEnd + %13 = OpFunction %2 None %10 + %11 = OpFunctionParameter %8 + %12 = OpFunctionParameter %9 + %14 = OpLabel + %25 = OpLoad %6 %12 + %26 = OpAccessChain %9 %11 %24 + OpStore %26 %25 + %29 = OpAccessChain %9 %11 %27 + OpStore %29 %28 + %31 = OpAccessChain %9 %11 %30 + OpStore %31 %28 + OpReturn + OpFunctionEnd + %18 = OpFunction %2 None %15 + %16 = OpFunctionParameter %9 + %17 = OpFunctionParameter %9 + %19 = OpLabel + %32 = OpVariable %9 Function + %65 = OpVariable %8 Function + %69 = OpVariable %9 Function + %91 = OpVariable %8 Function + %94 = OpVariable %9 Function + OpStore %32 %24 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %6 %32 + %39 = OpLoad %6 %16 + %41 = OpSLessThanEqual %40 %38 %39 + OpBranchConditional %41 %34 %35 + %34 = OpLabel + %42 = OpLoad %6 %17 + %48 = OpLoad %6 %32 + %50 = OpAccessChain %49 %47 %48 %24 + %51 = OpLoad %6 %50 + %52 = OpSLessThanEqual %40 %42 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %80 + %53 = OpLabel + %55 = OpLoad %6 %32 + %56 = OpAccessChain %49 %47 %55 %27 + %57 = OpLoad %6 %56 + %58 = OpIEqual %40 %57 %28 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %75 + %59 = OpLabel + %61 = OpLoad %6 %32 + %62 = OpLoad %6 %16 + %63 = OpAccessChain %49 %47 %61 %27 + OpStore %63 %62 + %64 = OpLoad %6 %16 + %67 = OpAccessChain %66 %47 %64 + %68 = OpLoad %7 %67 + OpStore %65 %68 + %70 = OpLoad %6 %17 + OpStore %69 %70 + %71 = OpFunctionCall %2 %13 %65 %69 + %72 = OpLoad %7 %65 + %73 = OpAccessChain %66 %47 %64 + OpStore %73 %72 + OpReturn + %75 = OpLabel + %76 = OpLoad %6 %32 + %77 = OpAccessChain %49 %47 %76 %27 + %78 = OpLoad %6 %77 + OpStore %32 %78 + OpBranch %36 + %60 = OpLabel + OpUnreachable + %80 = OpLabel + %81 = OpLoad %6 %32 + %82 = OpAccessChain %49 %47 %81 %30 + %83 = OpLoad %6 %82 + %84 = OpIEqual %40 %83 %28 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %100 + %85 = OpLabel + %87 = OpLoad %6 %32 + %88 = OpLoad %6 %16 + %89 = OpAccessChain %49 %47 %87 %30 + OpStore %89 %88 + %90 = OpLoad %6 %16 + %92 = OpAccessChain %66 %47 %90 + %93 = OpLoad %7 %92 + OpStore %91 %93 + %95 = OpLoad %6 %17 + OpStore %94 %95 + %96 = OpFunctionCall %2 %13 %91 %94 + %97 = OpLoad %7 %91 + %98 = OpAccessChain %66 %47 %90 + OpStore %98 %97 + OpReturn + %100 = OpLabel + %101 = OpLoad %6 %32 + %102 = OpAccessChain %49 %47 %101 %30 + %103 = OpLoad %6 %102 + OpStore %32 %103 + OpBranch %36 + %86 = OpLabel + OpUnreachable + %54 = OpLabel + OpUnreachable + %36 = OpLabel + OpBranch %33 + %35 = OpLabel + OpReturn + OpFunctionEnd + %22 = OpFunction %6 None %20 + %21 = OpFunctionParameter %9 + %23 = OpLabel + %105 = OpVariable %9 Function + %113 = OpVariable %8 Function + %129 = OpVariable %9 Function + OpStore %105 %24 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %108 %109 None + OpBranch %110 + %110 = OpLabel + %111 = OpLoad %6 %105 + %112 = OpINotEqual %40 %111 %28 + OpBranchConditional %112 %107 %108 + %107 = OpLabel + %114 = OpLoad %6 %105 + %115 = OpAccessChain %66 %47 %114 + %116 = OpLoad %7 %115 + OpStore %113 %116 + %117 = OpAccessChain %9 %113 %24 + %118 = OpLoad %6 %117 + %119 = OpLoad %6 %21 + %120 = OpIEqual %40 %118 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpLoad %6 %21 + OpReturnValue %123 + %122 = OpLabel + %125 = OpLoad %6 %21 + %126 = OpAccessChain %9 %113 %24 + %127 = OpLoad %6 %126 + %128 = OpSGreaterThan %40 %125 %127 + OpSelectionMerge %131 None + OpBranchConditional %128 %130 %134 + %130 = OpLabel + %132 = OpAccessChain %9 %113 %30 + %133 = OpLoad %6 %132 + OpStore %129 %133 + OpBranch %131 + %134 = OpLabel + %135 = OpAccessChain %9 %113 %27 + %136 = OpLoad %6 %135 + OpStore %129 %136 + OpBranch %131 + %131 = OpLabel + %137 = OpLoad %6 %129 + OpStore %105 %137 + OpBranch %109 + %109 = OpLabel + OpBranch %106 + %108 = OpLabel + OpReturnValue %28 + OpFunctionEnd +END + + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; // x == 0.0, y == 1.0 +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# struct BST +# { +# int data; +# int leftIndex; +# int rightIndex; +# }; +# +# BST tree[10]; +# +# void makeTreeNode(inout BST tree, int data) +# { +# tree.data = data; +# tree.leftIndex = -1; +# tree.rightIndex = -1; +# } +# void insert(int treeIndex, int data) +# { +# int baseIndex = 0; +# while (baseIndex <= treeIndex) +# { +# if (data <= tree[baseIndex].data) +# { +# if (tree[baseIndex].leftIndex == -1) +# { +# tree[baseIndex].leftIndex = treeIndex; +# // Always true. +# if (injectionSwitch.x < injectionSwitch.y) +# { +# makeTreeNode(tree[treeIndex], data); +# } +# // Always true. +# if (injectionSwitch.x < injectionSwitch.y) +# { +# return; +# } +# } +# else +# { +# baseIndex = tree[baseIndex].leftIndex; +# continue; +# } +# } +# else +# { +# // Conditional statement's result is irrelevant. +# if ((injectionSwitch.x < injectionSwitch.y ? tree[baseIndex].rightIndex : tree[baseIndex].rightIndex) == -1) +# { +# tree[baseIndex].rightIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].rightIndex; +# continue; +# } +# } +# // Always false. +# if (injectionSwitch.x > injectionSwitch.y) +# { +# return; +# } +# } +# } +# int search(int target) +# { +# BST currentNode; +# int index = 0; +# while (index != -1) +# { +# currentNode = tree[index]; +# if (currentNode.data == target) +# { +# return target; +# } +# index = target > currentNode.data ? currentNode.rightIndex : currentNode.leftIndex; +# } +# return -1; +# } +# void main() +# { +# int treeIndex = 0; +# makeTreeNode(tree[0], 9); +# treeIndex++; +# insert(treeIndex, 5); +# treeIndex++; +# insert(treeIndex, 12); +# treeIndex++; +# insert(treeIndex, 15); +# treeIndex++; +# insert(treeIndex, 7); +# treeIndex++; +# insert(treeIndex, 8); +# treeIndex++; +# insert(treeIndex, 2); +# treeIndex++; +# insert(treeIndex, 6); +# treeIndex++; +# insert(treeIndex, 17); +# treeIndex++; +# insert(treeIndex, 13); +# int count = 0; +# for (int i = 0; i < 20; i++) +# { +# int result = search(i); +# switch (i) +# { +# case 9: +# case 5: +# case 12: +# case 15: +# case 7: +# case 8: +# case 2: +# case 6: +# case 17: +# case 13: +# if (result == i) +# { +# count++; +# } +# break; +# default: +# if (result == -1) +# { +# count++; +# } +# break; +# } +# } +# if (count == 20) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 1.0, 1.0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 302 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %296 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "BST" + OpMemberName %7 0 "data" + OpMemberName %7 1 "leftIndex" + OpMemberName %7 2 "rightIndex" + OpName %13 "makeTreeNode(struct-BST-i1-i1-i11;i1;" + OpName %11 "tree" + OpName %12 "data" + OpName %18 "insert(i1;i1;" + OpName %16 "treeIndex" + OpName %17 "data" + OpName %22 "search(i1;" + OpName %21 "target" + OpName %32 "baseIndex" + OpName %47 "tree" + OpName %66 "buf0" + OpMemberName %66 0 "injectionSwitch" + OpName %68 "" + OpName %80 "param" + OpName %84 "param" + OpName %126 "param" + OpName %129 "param" + OpName %148 "index" + OpName %156 "currentNode" + OpName %183 "treeIndex" + OpName %185 "param" + OpName %188 "param" + OpName %195 "param" + OpName %197 "param" + OpName %202 "param" + OpName %204 "param" + OpName %209 "param" + OpName %211 "param" + OpName %216 "param" + OpName %218 "param" + OpName %223 "param" + OpName %225 "param" + OpName %229 "param" + OpName %231 "param" + OpName %236 "param" + OpName %238 "param" + OpName %243 "param" + OpName %245 "param" + OpName %250 "param" + OpName %252 "param" + OpName %254 "count" + OpName %255 "i" + OpName %264 "result" + OpName %265 "param" + OpName %296 "_GLF_color" + OpMemberDecorate %66 0 Offset 0 + OpDecorate %66 Block + OpDecorate %68 DescriptorSet 0 + OpDecorate %68 Binding 0 + OpDecorate %296 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypePointer Function %6 + %10 = OpTypeFunction %2 %8 %9 + %15 = OpTypeFunction %2 %9 %9 + %20 = OpTypeFunction %6 %9 + %24 = OpConstant %6 0 + %27 = OpConstant %6 1 + %28 = OpConstant %6 -1 + %30 = OpConstant %6 2 + %40 = OpTypeBool + %43 = OpTypeInt 32 0 + %44 = OpConstant %43 10 + %45 = OpTypeArray %7 %44 + %46 = OpTypePointer Private %45 + %47 = OpVariable %46 Private + %49 = OpTypePointer Private %6 + %64 = OpTypeFloat 32 + %65 = OpTypeVector %64 2 + %66 = OpTypeStruct %65 + %67 = OpTypePointer Uniform %66 + %68 = OpVariable %67 Uniform + %69 = OpConstant %43 0 + %70 = OpTypePointer Uniform %64 + %73 = OpConstant %43 1 + %81 = OpTypePointer Private %7 + %184 = OpConstant %6 9 + %194 = OpConstant %6 5 + %201 = OpConstant %6 12 + %208 = OpConstant %6 15 + %215 = OpConstant %6 7 + %222 = OpConstant %6 8 + %235 = OpConstant %6 6 + %242 = OpConstant %6 17 + %249 = OpConstant %6 13 + %262 = OpConstant %6 20 + %294 = OpTypeVector %64 4 + %295 = OpTypePointer Output %294 + %296 = OpVariable %295 Output + %297 = OpConstant %64 1 + %298 = OpConstant %64 0 + %299 = OpConstantComposite %294 %297 %298 %298 %297 + %301 = OpConstantComposite %294 %298 %298 %297 %297 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %183 = OpVariable %9 Function + %185 = OpVariable %8 Function + %188 = OpVariable %9 Function + %195 = OpVariable %9 Function + %197 = OpVariable %9 Function + %202 = OpVariable %9 Function + %204 = OpVariable %9 Function + %209 = OpVariable %9 Function + %211 = OpVariable %9 Function + %216 = OpVariable %9 Function + %218 = OpVariable %9 Function + %223 = OpVariable %9 Function + %225 = OpVariable %9 Function + %229 = OpVariable %9 Function + %231 = OpVariable %9 Function + %236 = OpVariable %9 Function + %238 = OpVariable %9 Function + %243 = OpVariable %9 Function + %245 = OpVariable %9 Function + %250 = OpVariable %9 Function + %252 = OpVariable %9 Function + %254 = OpVariable %9 Function + %255 = OpVariable %9 Function + %264 = OpVariable %9 Function + %265 = OpVariable %9 Function + OpStore %183 %24 + %186 = OpAccessChain %81 %47 %24 + %187 = OpLoad %7 %186 + OpStore %185 %187 + OpStore %188 %184 + %189 = OpFunctionCall %2 %13 %185 %188 + %190 = OpLoad %7 %185 + %191 = OpAccessChain %81 %47 %24 + OpStore %191 %190 + %192 = OpLoad %6 %183 + %193 = OpIAdd %6 %192 %27 + OpStore %183 %193 + %196 = OpLoad %6 %183 + OpStore %195 %196 + OpStore %197 %194 + %198 = OpFunctionCall %2 %18 %195 %197 + %199 = OpLoad %6 %183 + %200 = OpIAdd %6 %199 %27 + OpStore %183 %200 + %203 = OpLoad %6 %183 + OpStore %202 %203 + OpStore %204 %201 + %205 = OpFunctionCall %2 %18 %202 %204 + %206 = OpLoad %6 %183 + %207 = OpIAdd %6 %206 %27 + OpStore %183 %207 + %210 = OpLoad %6 %183 + OpStore %209 %210 + OpStore %211 %208 + %212 = OpFunctionCall %2 %18 %209 %211 + %213 = OpLoad %6 %183 + %214 = OpIAdd %6 %213 %27 + OpStore %183 %214 + %217 = OpLoad %6 %183 + OpStore %216 %217 + OpStore %218 %215 + %219 = OpFunctionCall %2 %18 %216 %218 + %220 = OpLoad %6 %183 + %221 = OpIAdd %6 %220 %27 + OpStore %183 %221 + %224 = OpLoad %6 %183 + OpStore %223 %224 + OpStore %225 %222 + %226 = OpFunctionCall %2 %18 %223 %225 + %227 = OpLoad %6 %183 + %228 = OpIAdd %6 %227 %27 + OpStore %183 %228 + %230 = OpLoad %6 %183 + OpStore %229 %230 + OpStore %231 %30 + %232 = OpFunctionCall %2 %18 %229 %231 + %233 = OpLoad %6 %183 + %234 = OpIAdd %6 %233 %27 + OpStore %183 %234 + %237 = OpLoad %6 %183 + OpStore %236 %237 + OpStore %238 %235 + %239 = OpFunctionCall %2 %18 %236 %238 + %240 = OpLoad %6 %183 + %241 = OpIAdd %6 %240 %27 + OpStore %183 %241 + %244 = OpLoad %6 %183 + OpStore %243 %244 + OpStore %245 %242 + %246 = OpFunctionCall %2 %18 %243 %245 + %247 = OpLoad %6 %183 + %248 = OpIAdd %6 %247 %27 + OpStore %183 %248 + %251 = OpLoad %6 %183 + OpStore %250 %251 + OpStore %252 %249 + %253 = OpFunctionCall %2 %18 %250 %252 + OpStore %254 %24 + OpStore %255 %24 + OpBranch %256 + %256 = OpLabel + OpLoopMerge %258 %259 None + OpBranch %260 + %260 = OpLabel + %261 = OpLoad %6 %255 + %263 = OpSLessThan %40 %261 %262 + OpBranchConditional %263 %257 %258 + %257 = OpLabel + %266 = OpLoad %6 %255 + OpStore %265 %266 + %267 = OpFunctionCall %6 %22 %265 + OpStore %264 %267 + %268 = OpLoad %6 %255 + OpSelectionMerge %271 None + OpSwitch %268 %270 9 %269 5 %269 12 %269 15 %269 7 %269 8 %269 2 %269 6 %269 17 %269 13 %269 + %270 = OpLabel + %280 = OpLoad %6 %264 + %281 = OpIEqual %40 %280 %28 + OpSelectionMerge %283 None + OpBranchConditional %281 %282 %283 + %282 = OpLabel + %284 = OpLoad %6 %254 + %285 = OpIAdd %6 %284 %27 + OpStore %254 %285 + OpBranch %283 + %283 = OpLabel + OpBranch %271 + %269 = OpLabel + %272 = OpLoad %6 %264 + %273 = OpLoad %6 %255 + %274 = OpIEqual %40 %272 %273 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %277 = OpLoad %6 %254 + %278 = OpIAdd %6 %277 %27 + OpStore %254 %278 + OpBranch %276 + %276 = OpLabel + OpBranch %271 + %271 = OpLabel + OpBranch %259 + %259 = OpLabel + %288 = OpLoad %6 %255 + %289 = OpIAdd %6 %288 %27 + OpStore %255 %289 + OpBranch %256 + %258 = OpLabel + %290 = OpLoad %6 %254 + %291 = OpIEqual %40 %290 %262 + OpSelectionMerge %293 None + OpBranchConditional %291 %292 %300 + %292 = OpLabel + OpStore %296 %299 + OpBranch %293 + %300 = OpLabel + OpStore %296 %301 + OpBranch %293 + %293 = OpLabel + OpReturn + OpFunctionEnd + %13 = OpFunction %2 None %10 + %11 = OpFunctionParameter %8 + %12 = OpFunctionParameter %9 + %14 = OpLabel + %25 = OpLoad %6 %12 + %26 = OpAccessChain %9 %11 %24 + OpStore %26 %25 + %29 = OpAccessChain %9 %11 %27 + OpStore %29 %28 + %31 = OpAccessChain %9 %11 %30 + OpStore %31 %28 + OpReturn + OpFunctionEnd + %18 = OpFunction %2 None %15 + %16 = OpFunctionParameter %9 + %17 = OpFunctionParameter %9 + %19 = OpLabel + %32 = OpVariable %9 Function + %80 = OpVariable %8 Function + %84 = OpVariable %9 Function + %108 = OpVariable %9 Function + %126 = OpVariable %8 Function + %129 = OpVariable %9 Function + OpStore %32 %24 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %6 %32 + %39 = OpLoad %6 %16 + %41 = OpSLessThanEqual %40 %38 %39 + OpBranchConditional %41 %34 %35 + %34 = OpLabel + %42 = OpLoad %6 %17 + %48 = OpLoad %6 %32 + %50 = OpAccessChain %49 %47 %48 %24 + %51 = OpLoad %6 %50 + %52 = OpSLessThanEqual %40 %42 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %102 + %53 = OpLabel + %55 = OpLoad %6 %32 + %56 = OpAccessChain %49 %47 %55 %27 + %57 = OpLoad %6 %56 + %58 = OpIEqual %40 %57 %28 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %97 + %59 = OpLabel + %61 = OpLoad %6 %32 + %62 = OpLoad %6 %16 + %63 = OpAccessChain %49 %47 %61 %27 + OpStore %63 %62 + %71 = OpAccessChain %70 %68 %24 %69 + %72 = OpLoad %64 %71 + %74 = OpAccessChain %70 %68 %24 %73 + %75 = OpLoad %64 %74 + %76 = OpFOrdLessThan %40 %72 %75 + OpSelectionMerge %78 None + OpBranchConditional %76 %77 %78 + %77 = OpLabel + %79 = OpLoad %6 %16 + %82 = OpAccessChain %81 %47 %79 + %83 = OpLoad %7 %82 + OpStore %80 %83 + %85 = OpLoad %6 %17 + OpStore %84 %85 + %86 = OpFunctionCall %2 %13 %80 %84 + %87 = OpLoad %7 %80 + %88 = OpAccessChain %81 %47 %79 + OpStore %88 %87 + OpBranch %78 + %78 = OpLabel + %89 = OpAccessChain %70 %68 %24 %69 + %90 = OpLoad %64 %89 + %91 = OpAccessChain %70 %68 %24 %73 + %92 = OpLoad %64 %91 + %93 = OpFOrdLessThan %40 %90 %92 + OpSelectionMerge %95 None + OpBranchConditional %93 %94 %95 + %94 = OpLabel + OpReturn + %95 = OpLabel + OpBranch %60 + %97 = OpLabel + %98 = OpLoad %6 %32 + %99 = OpAccessChain %49 %47 %98 %27 + %100 = OpLoad %6 %99 + OpStore %32 %100 + OpBranch %36 + %60 = OpLabel + OpBranch %54 + %102 = OpLabel + %103 = OpAccessChain %70 %68 %24 %69 + %104 = OpLoad %64 %103 + %105 = OpAccessChain %70 %68 %24 %73 + %106 = OpLoad %64 %105 + %107 = OpFOrdLessThan %40 %104 %106 + OpSelectionMerge %110 None + OpBranchConditional %107 %109 %114 + %109 = OpLabel + %111 = OpLoad %6 %32 + %112 = OpAccessChain %49 %47 %111 %30 + %113 = OpLoad %6 %112 + OpStore %108 %113 + OpBranch %110 + %114 = OpLabel + %115 = OpLoad %6 %32 + %116 = OpAccessChain %49 %47 %115 %30 + %117 = OpLoad %6 %116 + OpStore %108 %117 + OpBranch %110 + %110 = OpLabel + %118 = OpLoad %6 %108 + %119 = OpIEqual %40 %118 %28 + OpSelectionMerge %121 None + OpBranchConditional %119 %120 %135 + %120 = OpLabel + %122 = OpLoad %6 %32 + %123 = OpLoad %6 %16 + %124 = OpAccessChain %49 %47 %122 %30 + OpStore %124 %123 + %125 = OpLoad %6 %16 + %127 = OpAccessChain %81 %47 %125 + %128 = OpLoad %7 %127 + OpStore %126 %128 + %130 = OpLoad %6 %17 + OpStore %129 %130 + %131 = OpFunctionCall %2 %13 %126 %129 + %132 = OpLoad %7 %126 + %133 = OpAccessChain %81 %47 %125 + OpStore %133 %132 + OpReturn + %135 = OpLabel + %136 = OpLoad %6 %32 + %137 = OpAccessChain %49 %47 %136 %30 + %138 = OpLoad %6 %137 + OpStore %32 %138 + OpBranch %36 + %121 = OpLabel + OpUnreachable + %54 = OpLabel + %140 = OpAccessChain %70 %68 %24 %69 + %141 = OpLoad %64 %140 + %142 = OpAccessChain %70 %68 %24 %73 + %143 = OpLoad %64 %142 + %144 = OpFOrdGreaterThan %40 %141 %143 + OpSelectionMerge %146 None + OpBranchConditional %144 %145 %146 + %145 = OpLabel + OpReturn + %146 = OpLabel + OpBranch %36 + %36 = OpLabel + OpBranch %33 + %35 = OpLabel + OpReturn + OpFunctionEnd + %22 = OpFunction %6 None %20 + %21 = OpFunctionParameter %9 + %23 = OpLabel + %148 = OpVariable %9 Function + %156 = OpVariable %8 Function + %172 = OpVariable %9 Function + OpStore %148 %24 + OpBranch %149 + %149 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %154 = OpLoad %6 %148 + %155 = OpINotEqual %40 %154 %28 + OpBranchConditional %155 %150 %151 + %150 = OpLabel + %157 = OpLoad %6 %148 + %158 = OpAccessChain %81 %47 %157 + %159 = OpLoad %7 %158 + OpStore %156 %159 + %160 = OpAccessChain %9 %156 %24 + %161 = OpLoad %6 %160 + %162 = OpLoad %6 %21 + %163 = OpIEqual %40 %161 %162 + OpSelectionMerge %165 None + OpBranchConditional %163 %164 %165 + %164 = OpLabel + %166 = OpLoad %6 %21 + OpReturnValue %166 + %165 = OpLabel + %168 = OpLoad %6 %21 + %169 = OpAccessChain %9 %156 %24 + %170 = OpLoad %6 %169 + %171 = OpSGreaterThan %40 %168 %170 + OpSelectionMerge %174 None + OpBranchConditional %171 %173 %177 + %173 = OpLabel + %175 = OpAccessChain %9 %156 %30 + %176 = OpLoad %6 %175 + OpStore %172 %176 + OpBranch %174 + %177 = OpLabel + %178 = OpAccessChain %9 %156 %27 + %179 = OpLoad %6 %178 + OpStore %172 %179 + OpBranch %174 + %174 = OpLabel + %180 = OpLoad %6 %172 + OpStore %148 %180 + OpBranch %152 + %152 = OpLabel + OpBranch %149 + %151 = OpLabel + OpReturnValue %28 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global.amber b/vulkan/amber/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global.amber new file mode 100644 index 0000000..b3214f0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global.amber @@ -0,0 +1,1340 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A pair of fragment shaders that both render red + +# The test passes because both shaders are equivalent; we check that both shaders +# render the same image. Both shaders manipulate a binary search tree and should render red. +# The variant shader has a redundant loop that should not affect the rendered image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct BST +# { +# int data; +# int leftIndex; +# int rightIndex; +# }; +# +# BST tree[10]; +# +# void makeTreeNode(inout BST node, int data) +# { +# node.data = data; +# node.leftIndex = -1; +# node.rightIndex = -1; +# } +# void insert(int treeIndex, int data) +# { +# int baseIndex = 0; +# while (baseIndex <= treeIndex) +# { +# if (data <= tree[baseIndex].data) +# { +# if (tree[baseIndex].leftIndex == -1) +# { +# tree[baseIndex].leftIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].leftIndex; +# continue; +# } +# } +# else +# { +# if (tree[baseIndex].rightIndex == -1) +# { +# tree[baseIndex].rightIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].rightIndex; +# continue; +# } +# } +# } +# } +# int search(int target) +# { +# BST currentNode; +# int index = 0; +# while (index != -1) +# { +# currentNode = tree[index]; +# if (currentNode.data == target) +# { +# return target; +# } +# index = target > currentNode.data ? currentNode.rightIndex : currentNode.leftIndex; +# } +# return -1; +# } +# void main() +# { +# int treeIndex = 0; +# makeTreeNode(tree[0], 9); +# treeIndex++; +# insert(treeIndex, 5); +# treeIndex++; +# insert(treeIndex, 12); +# treeIndex++; +# insert(treeIndex, 15); +# treeIndex++; +# insert(treeIndex, 7); +# treeIndex++; +# insert(treeIndex, 8); +# treeIndex++; +# insert(treeIndex, 2); +# treeIndex++; +# insert(treeIndex, 6); +# treeIndex++; +# insert(treeIndex, 17); +# treeIndex++; +# insert(treeIndex, 13); +# int count = 0; +# for ( +# int i = 0; +# i < 20; +# i++) +# { +# int result = search(i); +# switch (i) +# { +# case 9: +# case 5: +# case 12: +# case 15: +# case 7: +# case 8: +# case 2: +# case 6: +# case 17: +# case 13: +# if (result == i) +# { +# count++; +# } +# break; +# default: +# if (result == -1) +# { +# count++; +# } +# break; +# } +# } +# if (count == 20) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 1.0, 1.0); +# } +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 260 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %254 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "BST" + OpMemberName %7 0 "data" + OpMemberName %7 1 "leftIndex" + OpMemberName %7 2 "rightIndex" + OpName %13 "makeTreeNode(struct-BST-i1-i1-i11;i1;" + OpName %11 "node" + OpName %12 "data" + OpName %18 "insert(i1;i1;" + OpName %16 "treeIndex" + OpName %17 "data" + OpName %22 "search(i1;" + OpName %21 "target" + OpName %32 "baseIndex" + OpName %47 "tree" + OpName %65 "param" + OpName %69 "param" + OpName %91 "param" + OpName %94 "param" + OpName %105 "index" + OpName %113 "currentNode" + OpName %140 "treeIndex" + OpName %142 "param" + OpName %145 "param" + OpName %152 "param" + OpName %154 "param" + OpName %159 "param" + OpName %161 "param" + OpName %166 "param" + OpName %168 "param" + OpName %173 "param" + OpName %175 "param" + OpName %180 "param" + OpName %182 "param" + OpName %186 "param" + OpName %188 "param" + OpName %193 "param" + OpName %195 "param" + OpName %200 "param" + OpName %202 "param" + OpName %207 "param" + OpName %209 "param" + OpName %211 "count" + OpName %212 "i" + OpName %221 "result" + OpName %222 "param" + OpName %254 "_GLF_color" + OpDecorate %254 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypePointer Function %6 + %10 = OpTypeFunction %2 %8 %9 + %15 = OpTypeFunction %2 %9 %9 + %20 = OpTypeFunction %6 %9 + %24 = OpConstant %6 0 + %27 = OpConstant %6 1 + %28 = OpConstant %6 -1 + %30 = OpConstant %6 2 + %40 = OpTypeBool + %43 = OpTypeInt 32 0 + %44 = OpConstant %43 10 + %45 = OpTypeArray %7 %44 + %46 = OpTypePointer Private %45 + %47 = OpVariable %46 Private + %49 = OpTypePointer Private %6 + %66 = OpTypePointer Private %7 + %141 = OpConstant %6 9 + %151 = OpConstant %6 5 + %158 = OpConstant %6 12 + %165 = OpConstant %6 15 + %172 = OpConstant %6 7 + %179 = OpConstant %6 8 + %192 = OpConstant %6 6 + %199 = OpConstant %6 17 + %206 = OpConstant %6 13 + %219 = OpConstant %6 20 + %251 = OpTypeFloat 32 + %252 = OpTypeVector %251 4 + %253 = OpTypePointer Output %252 + %254 = OpVariable %253 Output + %255 = OpConstant %251 1 + %256 = OpConstant %251 0 + %257 = OpConstantComposite %252 %255 %256 %256 %255 + %259 = OpConstantComposite %252 %256 %256 %255 %255 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %140 = OpVariable %9 Function + %142 = OpVariable %8 Function + %145 = OpVariable %9 Function + %152 = OpVariable %9 Function + %154 = OpVariable %9 Function + %159 = OpVariable %9 Function + %161 = OpVariable %9 Function + %166 = OpVariable %9 Function + %168 = OpVariable %9 Function + %173 = OpVariable %9 Function + %175 = OpVariable %9 Function + %180 = OpVariable %9 Function + %182 = OpVariable %9 Function + %186 = OpVariable %9 Function + %188 = OpVariable %9 Function + %193 = OpVariable %9 Function + %195 = OpVariable %9 Function + %200 = OpVariable %9 Function + %202 = OpVariable %9 Function + %207 = OpVariable %9 Function + %209 = OpVariable %9 Function + %211 = OpVariable %9 Function + %212 = OpVariable %9 Function + %221 = OpVariable %9 Function + %222 = OpVariable %9 Function + OpStore %140 %24 + %143 = OpAccessChain %66 %47 %24 + %144 = OpLoad %7 %143 + OpStore %142 %144 + OpStore %145 %141 + %146 = OpFunctionCall %2 %13 %142 %145 + %147 = OpLoad %7 %142 + %148 = OpAccessChain %66 %47 %24 + OpStore %148 %147 + %149 = OpLoad %6 %140 + %150 = OpIAdd %6 %149 %27 + OpStore %140 %150 + %153 = OpLoad %6 %140 + OpStore %152 %153 + OpStore %154 %151 + %155 = OpFunctionCall %2 %18 %152 %154 + %156 = OpLoad %6 %140 + %157 = OpIAdd %6 %156 %27 + OpStore %140 %157 + %160 = OpLoad %6 %140 + OpStore %159 %160 + OpStore %161 %158 + %162 = OpFunctionCall %2 %18 %159 %161 + %163 = OpLoad %6 %140 + %164 = OpIAdd %6 %163 %27 + OpStore %140 %164 + %167 = OpLoad %6 %140 + OpStore %166 %167 + OpStore %168 %165 + %169 = OpFunctionCall %2 %18 %166 %168 + %170 = OpLoad %6 %140 + %171 = OpIAdd %6 %170 %27 + OpStore %140 %171 + %174 = OpLoad %6 %140 + OpStore %173 %174 + OpStore %175 %172 + %176 = OpFunctionCall %2 %18 %173 %175 + %177 = OpLoad %6 %140 + %178 = OpIAdd %6 %177 %27 + OpStore %140 %178 + %181 = OpLoad %6 %140 + OpStore %180 %181 + OpStore %182 %179 + %183 = OpFunctionCall %2 %18 %180 %182 + %184 = OpLoad %6 %140 + %185 = OpIAdd %6 %184 %27 + OpStore %140 %185 + %187 = OpLoad %6 %140 + OpStore %186 %187 + OpStore %188 %30 + %189 = OpFunctionCall %2 %18 %186 %188 + %190 = OpLoad %6 %140 + %191 = OpIAdd %6 %190 %27 + OpStore %140 %191 + %194 = OpLoad %6 %140 + OpStore %193 %194 + OpStore %195 %192 + %196 = OpFunctionCall %2 %18 %193 %195 + %197 = OpLoad %6 %140 + %198 = OpIAdd %6 %197 %27 + OpStore %140 %198 + %201 = OpLoad %6 %140 + OpStore %200 %201 + OpStore %202 %199 + %203 = OpFunctionCall %2 %18 %200 %202 + %204 = OpLoad %6 %140 + %205 = OpIAdd %6 %204 %27 + OpStore %140 %205 + %208 = OpLoad %6 %140 + OpStore %207 %208 + OpStore %209 %206 + %210 = OpFunctionCall %2 %18 %207 %209 + OpStore %211 %24 + OpStore %212 %24 + OpBranch %213 + %213 = OpLabel + OpLoopMerge %215 %216 None + OpBranch %217 + %217 = OpLabel + %218 = OpLoad %6 %212 + %220 = OpSLessThan %40 %218 %219 + OpBranchConditional %220 %214 %215 + %214 = OpLabel + %223 = OpLoad %6 %212 + OpStore %222 %223 + %224 = OpFunctionCall %6 %22 %222 + OpStore %221 %224 + %225 = OpLoad %6 %212 + OpSelectionMerge %228 None + OpSwitch %225 %227 9 %226 5 %226 12 %226 15 %226 7 %226 8 %226 2 %226 6 %226 17 %226 13 %226 + %227 = OpLabel + %237 = OpLoad %6 %221 + %238 = OpIEqual %40 %237 %28 + OpSelectionMerge %240 None + OpBranchConditional %238 %239 %240 + %239 = OpLabel + %241 = OpLoad %6 %211 + %242 = OpIAdd %6 %241 %27 + OpStore %211 %242 + OpBranch %240 + %240 = OpLabel + OpBranch %228 + %226 = OpLabel + %229 = OpLoad %6 %221 + %230 = OpLoad %6 %212 + %231 = OpIEqual %40 %229 %230 + OpSelectionMerge %233 None + OpBranchConditional %231 %232 %233 + %232 = OpLabel + %234 = OpLoad %6 %211 + %235 = OpIAdd %6 %234 %27 + OpStore %211 %235 + OpBranch %233 + %233 = OpLabel + OpBranch %228 + %228 = OpLabel + OpBranch %216 + %216 = OpLabel + %245 = OpLoad %6 %212 + %246 = OpIAdd %6 %245 %27 + OpStore %212 %246 + OpBranch %213 + %215 = OpLabel + %247 = OpLoad %6 %211 + %248 = OpIEqual %40 %247 %219 + OpSelectionMerge %250 None + OpBranchConditional %248 %249 %258 + %249 = OpLabel + OpStore %254 %257 + OpBranch %250 + %258 = OpLabel + OpStore %254 %259 + OpBranch %250 + %250 = OpLabel + OpReturn + OpFunctionEnd + %13 = OpFunction %2 None %10 + %11 = OpFunctionParameter %8 + %12 = OpFunctionParameter %9 + %14 = OpLabel + %25 = OpLoad %6 %12 + %26 = OpAccessChain %9 %11 %24 + OpStore %26 %25 + %29 = OpAccessChain %9 %11 %27 + OpStore %29 %28 + %31 = OpAccessChain %9 %11 %30 + OpStore %31 %28 + OpReturn + OpFunctionEnd + %18 = OpFunction %2 None %15 + %16 = OpFunctionParameter %9 + %17 = OpFunctionParameter %9 + %19 = OpLabel + %32 = OpVariable %9 Function + %65 = OpVariable %8 Function + %69 = OpVariable %9 Function + %91 = OpVariable %8 Function + %94 = OpVariable %9 Function + OpStore %32 %24 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %6 %32 + %39 = OpLoad %6 %16 + %41 = OpSLessThanEqual %40 %38 %39 + OpBranchConditional %41 %34 %35 + %34 = OpLabel + %42 = OpLoad %6 %17 + %48 = OpLoad %6 %32 + %50 = OpAccessChain %49 %47 %48 %24 + %51 = OpLoad %6 %50 + %52 = OpSLessThanEqual %40 %42 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %80 + %53 = OpLabel + %55 = OpLoad %6 %32 + %56 = OpAccessChain %49 %47 %55 %27 + %57 = OpLoad %6 %56 + %58 = OpIEqual %40 %57 %28 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %75 + %59 = OpLabel + %61 = OpLoad %6 %32 + %62 = OpLoad %6 %16 + %63 = OpAccessChain %49 %47 %61 %27 + OpStore %63 %62 + %64 = OpLoad %6 %16 + %67 = OpAccessChain %66 %47 %64 + %68 = OpLoad %7 %67 + OpStore %65 %68 + %70 = OpLoad %6 %17 + OpStore %69 %70 + %71 = OpFunctionCall %2 %13 %65 %69 + %72 = OpLoad %7 %65 + %73 = OpAccessChain %66 %47 %64 + OpStore %73 %72 + OpReturn + %75 = OpLabel + %76 = OpLoad %6 %32 + %77 = OpAccessChain %49 %47 %76 %27 + %78 = OpLoad %6 %77 + OpStore %32 %78 + OpBranch %36 + %60 = OpLabel + OpUnreachable + %80 = OpLabel + %81 = OpLoad %6 %32 + %82 = OpAccessChain %49 %47 %81 %30 + %83 = OpLoad %6 %82 + %84 = OpIEqual %40 %83 %28 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %100 + %85 = OpLabel + %87 = OpLoad %6 %32 + %88 = OpLoad %6 %16 + %89 = OpAccessChain %49 %47 %87 %30 + OpStore %89 %88 + %90 = OpLoad %6 %16 + %92 = OpAccessChain %66 %47 %90 + %93 = OpLoad %7 %92 + OpStore %91 %93 + %95 = OpLoad %6 %17 + OpStore %94 %95 + %96 = OpFunctionCall %2 %13 %91 %94 + %97 = OpLoad %7 %91 + %98 = OpAccessChain %66 %47 %90 + OpStore %98 %97 + OpReturn + %100 = OpLabel + %101 = OpLoad %6 %32 + %102 = OpAccessChain %49 %47 %101 %30 + %103 = OpLoad %6 %102 + OpStore %32 %103 + OpBranch %36 + %86 = OpLabel + OpUnreachable + %54 = OpLabel + OpUnreachable + %36 = OpLabel + OpBranch %33 + %35 = OpLabel + OpReturn + OpFunctionEnd + %22 = OpFunction %6 None %20 + %21 = OpFunctionParameter %9 + %23 = OpLabel + %105 = OpVariable %9 Function + %113 = OpVariable %8 Function + %129 = OpVariable %9 Function + OpStore %105 %24 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %108 %109 None + OpBranch %110 + %110 = OpLabel + %111 = OpLoad %6 %105 + %112 = OpINotEqual %40 %111 %28 + OpBranchConditional %112 %107 %108 + %107 = OpLabel + %114 = OpLoad %6 %105 + %115 = OpAccessChain %66 %47 %114 + %116 = OpLoad %7 %115 + OpStore %113 %116 + %117 = OpAccessChain %9 %113 %24 + %118 = OpLoad %6 %117 + %119 = OpLoad %6 %21 + %120 = OpIEqual %40 %118 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpLoad %6 %21 + OpReturnValue %123 + %122 = OpLabel + %125 = OpLoad %6 %21 + %126 = OpAccessChain %9 %113 %24 + %127 = OpLoad %6 %126 + %128 = OpSGreaterThan %40 %125 %127 + OpSelectionMerge %131 None + OpBranchConditional %128 %130 %134 + %130 = OpLabel + %132 = OpAccessChain %9 %113 %30 + %133 = OpLoad %6 %132 + OpStore %129 %133 + OpBranch %131 + %134 = OpLabel + %135 = OpAccessChain %9 %113 %27 + %136 = OpLoad %6 %135 + OpStore %129 %136 + OpBranch %131 + %131 = OpLabel + %137 = OpLoad %6 %129 + OpStore %105 %137 + OpBranch %109 + %109 = OpLabel + OpBranch %106 + %108 = OpLabel + OpReturnValue %28 + OpFunctionEnd +END + + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# struct BST +# { +# int data; +# int leftIndex; +# int rightIndex; +# }; +# +# BST tree[10]; +# +# +# // Start of additional globals and functions just in the variant shader. +# +# layout(set = 0, binding = 0) uniform buf0 { +# // Always (0.0, 1.0). +# vec2 injectionSwitch; +# }; +# +# struct QuicksortObject +# { +# int numbers[10]; +# }; +# +# QuicksortObject obj; +# +# // "a" is always 2. +# // Thus, always returns 2. +# int identity(int a) +# { +# obj.numbers[a] = a; +# return obj.numbers[2]; +# } +# // End of additional globals and functions just in the variant shader. +# +# void makeTreeNode(inout BST node, int data) +# { +# node.data = data; +# node.leftIndex = -1; +# node.rightIndex = -1; +# } +# void insert(int treeIndex, int data) +# { +# int baseIndex = 0; +# while (baseIndex <= treeIndex) +# { +# if (data <= tree[baseIndex].data) +# { +# if (tree[baseIndex].leftIndex == -1) +# { +# tree[baseIndex].leftIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].leftIndex; +# continue; +# } +# } +# else +# { +# if (tree[baseIndex].rightIndex == -1) +# { +# tree[baseIndex].rightIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].rightIndex; +# continue; +# } +# } +# } +# } +# int search(int target) +# { +# BST currentNode; +# int index = 0; +# while (index != -1) +# { +# currentNode = tree[index]; +# if (currentNode.data == target) +# { +# return target; +# } +# index = target > currentNode.data ? currentNode.rightIndex : currentNode.leftIndex; +# } +# return -1; +# } +# void main() +# { +# int treeIndex = 0; +# makeTreeNode(tree[0], 9); +# treeIndex++; +# insert(treeIndex, 5); +# treeIndex++; +# insert(treeIndex, 12); +# treeIndex++; +# insert(treeIndex, 15); +# treeIndex++; +# insert(treeIndex, 7); +# treeIndex++; +# insert(treeIndex, 8); +# treeIndex++; +# insert(treeIndex, 2); +# treeIndex++; +# insert(treeIndex, 6); +# treeIndex++; +# insert(treeIndex, 17); +# treeIndex++; +# insert(treeIndex, 13); +# +# +# // Start of code that does nothing. +# +# // The following code essentially just stores the value 2 in "pp" and then checks that pp == 2 +# // but it does so by writing 2 into the global struct "obj" and then reading it back. +# int pp = 0; +# int looplimiter0 = 0; +# +# // This loop iterates 2 times because of "looplimiter0". +# for ( +# int i = 0; +# i < 10000; +# i++) +# { +# // "injectionSwitch.y" is 1.0. +# if (looplimiter0 >= int(injectionSwitch.y)) +# { +# // "identity(2)" returns 2, so "pp" becomes 2. +# pp = identity(1 + int(injectionSwitch.y)); +# break; +# } +# looplimiter0++; +# } +# // "pp" is always 2. +# if (pp != 2) +# { +# return; +# } +# +# // End of code that does nothing. +# +# int count = 0; +# for ( +# int i = 0; +# i < 20; +# i++) +# { +# int result = search(i); +# switch (i) +# { +# case 9: +# case 5: +# case 12: +# case 15: +# case 7: +# case 8: +# case 2: +# case 6: +# case 17: +# case 13: +# if (result == i) +# { +# count++; +# } +# break; +# default: +# if (result == -1) +# { +# count++; +# } +# break; +# } +# } +# if (count == 20) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 1.0, 1.0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 314 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %308 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "identity(i1;" + OpName %9 "a" + OpName %12 "BST" + OpMemberName %12 0 "data" + OpMemberName %12 1 "leftIndex" + OpMemberName %12 2 "rightIndex" + OpName %17 "makeTreeNode(struct-BST-i1-i1-i11;i1;" + OpName %15 "node" + OpName %16 "data" + OpName %22 "insert(i1;i1;" + OpName %20 "treeIndex" + OpName %21 "data" + OpName %25 "search(i1;" + OpName %24 "target" + OpName %30 "QuicksortObject" + OpMemberName %30 0 "numbers" + OpName %32 "obj" + OpName %49 "baseIndex" + OpName %62 "tree" + OpName %79 "param" + OpName %83 "param" + OpName %105 "param" + OpName %108 "param" + OpName %119 "index" + OpName %127 "currentNode" + OpName %154 "treeIndex" + OpName %156 "param" + OpName %159 "param" + OpName %166 "param" + OpName %168 "param" + OpName %173 "param" + OpName %175 "param" + OpName %180 "param" + OpName %182 "param" + OpName %187 "param" + OpName %189 "param" + OpName %194 "param" + OpName %196 "param" + OpName %200 "param" + OpName %202 "param" + OpName %207 "param" + OpName %209 "param" + OpName %214 "param" + OpName %216 "param" + OpName %221 "param" + OpName %223 "param" + OpName %225 "pp" + OpName %226 "looplimiter0" + OpName %227 "i" + OpName %239 "buf0" + OpMemberName %239 0 "injectionSwitch" + OpName %241 "" + OpName %254 "param" + OpName %266 "count" + OpName %267 "i" + OpName %276 "result" + OpName %277 "param" + OpName %308 "_GLF_color" + OpMemberDecorate %239 0 Offset 0 + OpDecorate %239 Block + OpDecorate %241 DescriptorSet 0 + OpDecorate %241 Binding 0 + OpDecorate %308 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %12 = OpTypeStruct %6 %6 %6 + %13 = OpTypePointer Function %12 + %14 = OpTypeFunction %2 %13 %7 + %19 = OpTypeFunction %2 %7 %7 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 10 + %29 = OpTypeArray %6 %28 + %30 = OpTypeStruct %29 + %31 = OpTypePointer Private %30 + %32 = OpVariable %31 Private + %33 = OpConstant %6 0 + %36 = OpTypePointer Private %6 + %38 = OpConstant %6 2 + %45 = OpConstant %6 1 + %46 = OpConstant %6 -1 + %57 = OpTypeBool + %60 = OpTypeArray %12 %28 + %61 = OpTypePointer Private %60 + %62 = OpVariable %61 Private + %80 = OpTypePointer Private %12 + %155 = OpConstant %6 9 + %165 = OpConstant %6 5 + %172 = OpConstant %6 12 + %179 = OpConstant %6 15 + %186 = OpConstant %6 7 + %193 = OpConstant %6 8 + %206 = OpConstant %6 6 + %213 = OpConstant %6 17 + %220 = OpConstant %6 13 + %234 = OpConstant %6 10000 + %237 = OpTypeFloat 32 + %238 = OpTypeVector %237 2 + %239 = OpTypeStruct %238 + %240 = OpTypePointer Uniform %239 + %241 = OpVariable %240 Uniform + %242 = OpConstant %27 1 + %243 = OpTypePointer Uniform %237 + %274 = OpConstant %6 20 + %306 = OpTypeVector %237 4 + %307 = OpTypePointer Output %306 + %308 = OpVariable %307 Output + %309 = OpConstant %237 1 + %310 = OpConstant %237 0 + %311 = OpConstantComposite %306 %309 %310 %310 %309 + %313 = OpConstantComposite %306 %310 %310 %309 %309 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %154 = OpVariable %7 Function + %156 = OpVariable %13 Function + %159 = OpVariable %7 Function + %166 = OpVariable %7 Function + %168 = OpVariable %7 Function + %173 = OpVariable %7 Function + %175 = OpVariable %7 Function + %180 = OpVariable %7 Function + %182 = OpVariable %7 Function + %187 = OpVariable %7 Function + %189 = OpVariable %7 Function + %194 = OpVariable %7 Function + %196 = OpVariable %7 Function + %200 = OpVariable %7 Function + %202 = OpVariable %7 Function + %207 = OpVariable %7 Function + %209 = OpVariable %7 Function + %214 = OpVariable %7 Function + %216 = OpVariable %7 Function + %221 = OpVariable %7 Function + %223 = OpVariable %7 Function + %225 = OpVariable %7 Function + %226 = OpVariable %7 Function + %227 = OpVariable %7 Function + %254 = OpVariable %7 Function + %266 = OpVariable %7 Function + %267 = OpVariable %7 Function + %276 = OpVariable %7 Function + %277 = OpVariable %7 Function + OpStore %154 %33 + %157 = OpAccessChain %80 %62 %33 + %158 = OpLoad %12 %157 + OpStore %156 %158 + OpStore %159 %155 + %160 = OpFunctionCall %2 %17 %156 %159 + %161 = OpLoad %12 %156 + %162 = OpAccessChain %80 %62 %33 + OpStore %162 %161 + %163 = OpLoad %6 %154 + %164 = OpIAdd %6 %163 %45 + OpStore %154 %164 + %167 = OpLoad %6 %154 + OpStore %166 %167 + OpStore %168 %165 + %169 = OpFunctionCall %2 %22 %166 %168 + %170 = OpLoad %6 %154 + %171 = OpIAdd %6 %170 %45 + OpStore %154 %171 + %174 = OpLoad %6 %154 + OpStore %173 %174 + OpStore %175 %172 + %176 = OpFunctionCall %2 %22 %173 %175 + %177 = OpLoad %6 %154 + %178 = OpIAdd %6 %177 %45 + OpStore %154 %178 + %181 = OpLoad %6 %154 + OpStore %180 %181 + OpStore %182 %179 + %183 = OpFunctionCall %2 %22 %180 %182 + %184 = OpLoad %6 %154 + %185 = OpIAdd %6 %184 %45 + OpStore %154 %185 + %188 = OpLoad %6 %154 + OpStore %187 %188 + OpStore %189 %186 + %190 = OpFunctionCall %2 %22 %187 %189 + %191 = OpLoad %6 %154 + %192 = OpIAdd %6 %191 %45 + OpStore %154 %192 + %195 = OpLoad %6 %154 + OpStore %194 %195 + OpStore %196 %193 + %197 = OpFunctionCall %2 %22 %194 %196 + %198 = OpLoad %6 %154 + %199 = OpIAdd %6 %198 %45 + OpStore %154 %199 + %201 = OpLoad %6 %154 + OpStore %200 %201 + OpStore %202 %38 + %203 = OpFunctionCall %2 %22 %200 %202 + %204 = OpLoad %6 %154 + %205 = OpIAdd %6 %204 %45 + OpStore %154 %205 + %208 = OpLoad %6 %154 + OpStore %207 %208 + OpStore %209 %206 + %210 = OpFunctionCall %2 %22 %207 %209 + %211 = OpLoad %6 %154 + %212 = OpIAdd %6 %211 %45 + OpStore %154 %212 + %215 = OpLoad %6 %154 + OpStore %214 %215 + OpStore %216 %213 + %217 = OpFunctionCall %2 %22 %214 %216 + %218 = OpLoad %6 %154 + %219 = OpIAdd %6 %218 %45 + OpStore %154 %219 + %222 = OpLoad %6 %154 + OpStore %221 %222 + OpStore %223 %220 + %224 = OpFunctionCall %2 %22 %221 %223 + OpStore %225 %33 + OpStore %226 %33 + OpStore %227 %33 + OpBranch %228 + %228 = OpLabel + OpLoopMerge %230 %231 None + OpBranch %232 + %232 = OpLabel + %233 = OpLoad %6 %227 + %235 = OpSLessThan %57 %233 %234 + OpBranchConditional %235 %229 %230 + %229 = OpLabel + %236 = OpLoad %6 %226 + %244 = OpAccessChain %243 %241 %33 %242 + %245 = OpLoad %237 %244 + %246 = OpConvertFToS %6 %245 + %247 = OpSGreaterThanEqual %57 %236 %246 + OpSelectionMerge %249 None + OpBranchConditional %247 %248 %249 + %248 = OpLabel + %250 = OpAccessChain %243 %241 %33 %242 + %251 = OpLoad %237 %250 + %252 = OpConvertFToS %6 %251 + %253 = OpIAdd %6 %45 %252 + OpStore %254 %253 + %255 = OpFunctionCall %6 %10 %254 + OpStore %225 %255 + OpBranch %230 + %249 = OpLabel + %257 = OpLoad %6 %226 + %258 = OpIAdd %6 %257 %45 + OpStore %226 %258 + OpBranch %231 + %231 = OpLabel + %259 = OpLoad %6 %227 + %260 = OpIAdd %6 %259 %45 + OpStore %227 %260 + OpBranch %228 + %230 = OpLabel + %261 = OpLoad %6 %225 + %262 = OpINotEqual %57 %261 %38 + OpSelectionMerge %264 None + OpBranchConditional %262 %263 %264 + %263 = OpLabel + OpReturn + %264 = OpLabel + OpStore %266 %33 + OpStore %267 %33 + OpBranch %268 + %268 = OpLabel + OpLoopMerge %270 %271 None + OpBranch %272 + %272 = OpLabel + %273 = OpLoad %6 %267 + %275 = OpSLessThan %57 %273 %274 + OpBranchConditional %275 %269 %270 + %269 = OpLabel + %278 = OpLoad %6 %267 + OpStore %277 %278 + %279 = OpFunctionCall %6 %25 %277 + OpStore %276 %279 + %280 = OpLoad %6 %267 + OpSelectionMerge %283 None + OpSwitch %280 %282 9 %281 5 %281 12 %281 15 %281 7 %281 8 %281 2 %281 6 %281 17 %281 13 %281 + %282 = OpLabel + %292 = OpLoad %6 %276 + %293 = OpIEqual %57 %292 %46 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %295 + %294 = OpLabel + %296 = OpLoad %6 %266 + %297 = OpIAdd %6 %296 %45 + OpStore %266 %297 + OpBranch %295 + %295 = OpLabel + OpBranch %283 + %281 = OpLabel + %284 = OpLoad %6 %276 + %285 = OpLoad %6 %267 + %286 = OpIEqual %57 %284 %285 + OpSelectionMerge %288 None + OpBranchConditional %286 %287 %288 + %287 = OpLabel + %289 = OpLoad %6 %266 + %290 = OpIAdd %6 %289 %45 + OpStore %266 %290 + OpBranch %288 + %288 = OpLabel + OpBranch %283 + %283 = OpLabel + OpBranch %271 + %271 = OpLabel + %300 = OpLoad %6 %267 + %301 = OpIAdd %6 %300 %45 + OpStore %267 %301 + OpBranch %268 + %270 = OpLabel + %302 = OpLoad %6 %266 + %303 = OpIEqual %57 %302 %274 + OpSelectionMerge %305 None + OpBranchConditional %303 %304 %312 + %304 = OpLabel + OpStore %308 %311 + OpBranch %305 + %312 = OpLabel + OpStore %308 %313 + OpBranch %305 + %305 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %34 = OpLoad %6 %9 + %35 = OpLoad %6 %9 + %37 = OpAccessChain %36 %32 %33 %34 + OpStore %37 %35 + %39 = OpAccessChain %36 %32 %33 %38 + %40 = OpLoad %6 %39 + OpReturnValue %40 + OpFunctionEnd + %17 = OpFunction %2 None %14 + %15 = OpFunctionParameter %13 + %16 = OpFunctionParameter %7 + %18 = OpLabel + %43 = OpLoad %6 %16 + %44 = OpAccessChain %7 %15 %33 + OpStore %44 %43 + %47 = OpAccessChain %7 %15 %45 + OpStore %47 %46 + %48 = OpAccessChain %7 %15 %38 + OpStore %48 %46 + OpReturn + OpFunctionEnd + %22 = OpFunction %2 None %19 + %20 = OpFunctionParameter %7 + %21 = OpFunctionParameter %7 + %23 = OpLabel + %49 = OpVariable %7 Function + %79 = OpVariable %13 Function + %83 = OpVariable %7 Function + %105 = OpVariable %13 Function + %108 = OpVariable %7 Function + OpStore %49 %33 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %49 + %56 = OpLoad %6 %20 + %58 = OpSLessThanEqual %57 %55 %56 + OpBranchConditional %58 %51 %52 + %51 = OpLabel + %59 = OpLoad %6 %21 + %63 = OpLoad %6 %49 + %64 = OpAccessChain %36 %62 %63 %33 + %65 = OpLoad %6 %64 + %66 = OpSLessThanEqual %57 %59 %65 + OpSelectionMerge %68 None + OpBranchConditional %66 %67 %94 + %67 = OpLabel + %69 = OpLoad %6 %49 + %70 = OpAccessChain %36 %62 %69 %45 + %71 = OpLoad %6 %70 + %72 = OpIEqual %57 %71 %46 + OpSelectionMerge %74 None + OpBranchConditional %72 %73 %89 + %73 = OpLabel + %75 = OpLoad %6 %49 + %76 = OpLoad %6 %20 + %77 = OpAccessChain %36 %62 %75 %45 + OpStore %77 %76 + %78 = OpLoad %6 %20 + %81 = OpAccessChain %80 %62 %78 + %82 = OpLoad %12 %81 + OpStore %79 %82 + %84 = OpLoad %6 %21 + OpStore %83 %84 + %85 = OpFunctionCall %2 %17 %79 %83 + %86 = OpLoad %12 %79 + %87 = OpAccessChain %80 %62 %78 + OpStore %87 %86 + OpReturn + %89 = OpLabel + %90 = OpLoad %6 %49 + %91 = OpAccessChain %36 %62 %90 %45 + %92 = OpLoad %6 %91 + OpStore %49 %92 + OpBranch %53 + %74 = OpLabel + OpUnreachable + %94 = OpLabel + %95 = OpLoad %6 %49 + %96 = OpAccessChain %36 %62 %95 %38 + %97 = OpLoad %6 %96 + %98 = OpIEqual %57 %97 %46 + OpSelectionMerge %100 None + OpBranchConditional %98 %99 %114 + %99 = OpLabel + %101 = OpLoad %6 %49 + %102 = OpLoad %6 %20 + %103 = OpAccessChain %36 %62 %101 %38 + OpStore %103 %102 + %104 = OpLoad %6 %20 + %106 = OpAccessChain %80 %62 %104 + %107 = OpLoad %12 %106 + OpStore %105 %107 + %109 = OpLoad %6 %21 + OpStore %108 %109 + %110 = OpFunctionCall %2 %17 %105 %108 + %111 = OpLoad %12 %105 + %112 = OpAccessChain %80 %62 %104 + OpStore %112 %111 + OpReturn + %114 = OpLabel + %115 = OpLoad %6 %49 + %116 = OpAccessChain %36 %62 %115 %38 + %117 = OpLoad %6 %116 + OpStore %49 %117 + OpBranch %53 + %100 = OpLabel + OpUnreachable + %68 = OpLabel + OpUnreachable + %53 = OpLabel + OpBranch %50 + %52 = OpLabel + OpReturn + OpFunctionEnd + %25 = OpFunction %6 None %8 + %24 = OpFunctionParameter %7 + %26 = OpLabel + %119 = OpVariable %7 Function + %127 = OpVariable %13 Function + %143 = OpVariable %7 Function + OpStore %119 %33 + OpBranch %120 + %120 = OpLabel + OpLoopMerge %122 %123 None + OpBranch %124 + %124 = OpLabel + %125 = OpLoad %6 %119 + %126 = OpINotEqual %57 %125 %46 + OpBranchConditional %126 %121 %122 + %121 = OpLabel + %128 = OpLoad %6 %119 + %129 = OpAccessChain %80 %62 %128 + %130 = OpLoad %12 %129 + OpStore %127 %130 + %131 = OpAccessChain %7 %127 %33 + %132 = OpLoad %6 %131 + %133 = OpLoad %6 %24 + %134 = OpIEqual %57 %132 %133 + OpSelectionMerge %136 None + OpBranchConditional %134 %135 %136 + %135 = OpLabel + %137 = OpLoad %6 %24 + OpReturnValue %137 + %136 = OpLabel + %139 = OpLoad %6 %24 + %140 = OpAccessChain %7 %127 %33 + %141 = OpLoad %6 %140 + %142 = OpSGreaterThan %57 %139 %141 + OpSelectionMerge %145 None + OpBranchConditional %142 %144 %148 + %144 = OpLabel + %146 = OpAccessChain %7 %127 %38 + %147 = OpLoad %6 %146 + OpStore %143 %147 + OpBranch %145 + %148 = OpLabel + %149 = OpAccessChain %7 %127 %45 + %150 = OpLoad %6 %149 + OpStore %143 %150 + OpBranch %145 + %145 = OpLabel + %151 = OpLoad %6 %143 + OpStore %119 %151 + OpBranch %123 + %123 = OpLabel + OpBranch %120 + %122 = OpLabel + OpReturnValue %46 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 +EXPECT reference_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max.amber b/vulkan/amber/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max.amber new file mode 100644 index 0000000..4efee72 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max.amber @@ -0,0 +1,551 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with push constant and nested min max + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 resolution; +# }; +# const vec4 pal[16] = vec4[16](vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); +# +# int collatz(int v) +# { +# int count = 0; +# while(v > 1) +# { +# if((v & 1) == 1) +# { +# v = 3 * v + 1; +# } +# else +# { +# v /= 2; +# } +# count ++; +# } +# return count; +# } +# void main() +# { +# vec2 lin = gl_FragCoord.xy / resolution; +# lin = floor(lin * 8.0); +# int v = int(lin.x) * 8 + int(lin.y); +# _GLF_color = pal[collatz(v) % 16]; +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 108 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 %76 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "collatz(i1;" + OpName %9 "v" + OpName %12 "count" + OpName %44 "lin" + OpName %47 "gl_FragCoord" + OpName %50 "buf0" + OpMemberName %50 0 "resolution" + OpName %52 "" + OpName %61 "v" + OpName %76 "_GLF_color" + OpName %98 "param" + OpName %104 "indexable" + OpDecorate %47 BuiltIn FragCoord + OpMemberDecorate %50 0 Offset 0 + OpDecorate %50 Block + OpDecorate %52 DescriptorSet 0 + OpDecorate %52 Binding 0 + OpDecorate %76 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %13 = OpConstant %6 0 + %20 = OpConstant %6 1 + %21 = OpTypeBool + %28 = OpConstant %6 3 + %33 = OpConstant %6 2 + %41 = OpTypeFloat 32 + %42 = OpTypeVector %41 2 + %43 = OpTypePointer Function %42 + %45 = OpTypeVector %41 4 + %46 = OpTypePointer Input %45 + %47 = OpVariable %46 Input + %50 = OpTypeStruct %42 + %51 = OpTypePointer Uniform %50 + %52 = OpVariable %51 Uniform + %53 = OpTypePointer Uniform %42 + %58 = OpConstant %41 8 + %62 = OpTypeInt 32 0 + %63 = OpConstant %62 0 + %64 = OpTypePointer Function %41 + %68 = OpConstant %6 8 + %70 = OpConstant %62 1 + %75 = OpTypePointer Output %45 + %76 = OpVariable %75 Output + %77 = OpConstant %62 16 + %78 = OpTypeArray %45 %77 + %79 = OpConstant %41 0 + %80 = OpConstant %41 1 + %81 = OpConstantComposite %45 %79 %79 %79 %80 + %82 = OpConstant %41 0.5 + %83 = OpConstantComposite %45 %82 %79 %79 %80 + %84 = OpConstantComposite %45 %79 %82 %79 %80 + %85 = OpConstantComposite %45 %82 %82 %79 %80 + %86 = OpConstantComposite %45 %79 %79 %82 %80 + %87 = OpConstantComposite %45 %82 %79 %82 %80 + %88 = OpConstantComposite %45 %79 %82 %82 %80 + %89 = OpConstantComposite %45 %82 %82 %82 %80 + %90 = OpConstantComposite %45 %80 %79 %79 %80 + %91 = OpConstantComposite %45 %79 %80 %79 %80 + %92 = OpConstantComposite %45 %80 %80 %79 %80 + %93 = OpConstantComposite %45 %79 %79 %80 %80 + %94 = OpConstantComposite %45 %80 %79 %80 %80 + %95 = OpConstantComposite %45 %79 %80 %80 %80 + %96 = OpConstantComposite %45 %80 %80 %80 %80 + %97 = OpConstantComposite %78 %81 %83 %84 %85 %86 %87 %88 %89 %81 %90 %91 %92 %93 %94 %95 %96 + %101 = OpConstant %6 16 + %103 = OpTypePointer Function %78 + %105 = OpTypePointer Function %45 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %44 = OpVariable %43 Function + %61 = OpVariable %7 Function + %98 = OpVariable %7 Function + %104 = OpVariable %103 Function + %48 = OpLoad %45 %47 + %49 = OpVectorShuffle %42 %48 %48 0 1 + %54 = OpAccessChain %53 %52 %13 + %55 = OpLoad %42 %54 + %56 = OpFDiv %42 %49 %55 + OpStore %44 %56 + %57 = OpLoad %42 %44 + %59 = OpVectorTimesScalar %42 %57 %58 + %60 = OpExtInst %42 %1 Floor %59 + OpStore %44 %60 + %65 = OpAccessChain %64 %44 %63 + %66 = OpLoad %41 %65 + %67 = OpConvertFToS %6 %66 + %69 = OpIMul %6 %67 %68 + %71 = OpAccessChain %64 %44 %70 + %72 = OpLoad %41 %71 + %73 = OpConvertFToS %6 %72 + %74 = OpIAdd %6 %69 %73 + OpStore %61 %74 + %99 = OpLoad %6 %61 + OpStore %98 %99 + %100 = OpFunctionCall %6 %10 %98 + %102 = OpSMod %6 %100 %101 + OpStore %104 %97 + %106 = OpAccessChain %105 %104 %102 + %107 = OpLoad %45 %106 + OpStore %76 %107 + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %12 = OpVariable %7 Function + OpStore %12 %13 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %18 + %18 = OpLabel + %19 = OpLoad %6 %9 + %22 = OpSGreaterThan %21 %19 %20 + OpBranchConditional %22 %15 %16 + %15 = OpLabel + %23 = OpLoad %6 %9 + %24 = OpBitwiseAnd %6 %23 %20 + %25 = OpIEqual %21 %24 %20 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %32 + %26 = OpLabel + %29 = OpLoad %6 %9 + %30 = OpIMul %6 %28 %29 + %31 = OpIAdd %6 %30 %20 + OpStore %9 %31 + OpBranch %27 + %32 = OpLabel + %34 = OpLoad %6 %9 + %35 = OpSDiv %6 %34 %33 + OpStore %9 %35 + OpBranch %27 + %27 = OpLabel + %36 = OpLoad %6 %12 + %37 = OpIAdd %6 %36 %20 + OpStore %12 %37 + OpBranch %17 + %17 = OpLabel + OpBranch %14 + %16 = OpLabel + %38 = OpLoad %6 %12 + OpReturnValue %38 + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(push_constant) uniform buf_push { +# vec2 resolution; +# }; +# const vec4 pal[16] = vec4[16](vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); +# +# int collatz(int v) +# { +# int count = 0; +# while(v > 1) +# { +# if((v & 1) == 1) +# { +# v = 3 * v + 1; +# } +# else +# { +# v /= 2; +# } +# count ++; +# } +# return count; +# } +# void main() +# { +# // vec2 max_c == (gl_FragCoord.xy / resolution). +# vec2 max_c = max( // This should return the same result. +# gl_FragCoord.xy / resolution, +# gl_FragCoord.xy / (vec2(resolution.x, resolution.y)) +# ); +# // vec2 max_a == (gl_FragCoord.xy / resolution) +# vec2 max_a = max( +# // gl_FragCoord.y < 0 is always false. +# // mix operation returns vec2(0.0 , 0.0). +# // cosine of 0 is 1. +# // anything divided by 1 stays the same. +# max_c / cos(mix(vec2(1.0, 0.0), vec2(0.0, 218.851), bvec2(true, (gl_FragCoord.y < 0.0)))), +# gl_FragCoord.xy / resolution +# ); +# // vec2 max_d == vec2(1.0, 1.0) +# vec2 max_d = max( +# // Same cosine fucntion as in max_a. +# 1.0 / cos(mix(vec2(1.0, 0.0), vec2(0.0, 218.851), bvec2(true, (gl_FragCoord.y < 0.0)))), +# vec2(1.0, 1.0) +# ); +# // vec2 max_b == vec2(1.0, 1.0) +# vec2 max_b = max( +# vec2(1.0, 1.0), +# max_d // max_d == vec2(1.0, 1.0) +# ); +# // vec2 lin == (gl_FragCoord.xy / resolution) +# vec2 lin = min( +# max_a, // max_a == gl_FragCoord.xy / resolution +# max_b // max_b == vec2(1.0, 1.0) +# ); +# lin = floor(lin * 8.0); +# int v = int(lin.x) * 8 + int(lin.y); +# _GLF_color = pal[collatz(v) % 16]; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 157 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 %127 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %10 "collatz(i1;" + OpName %9 "v" + OpName %12 "count" + OpName %44 "max_c" + OpName %47 "gl_FragCoord" + OpName %50 "buf_push" + OpMemberName %50 0 "resolution" + OpName %52 "" + OpName %70 "max_a" + OpName %93 "max_d" + OpName %104 "max_b" + OpName %107 "lin" + OpName %115 "v" + OpName %127 "_GLF_color" + OpName %147 "param" + OpName %153 "indexable" + OpDecorate %47 BuiltIn FragCoord + OpMemberDecorate %50 0 Offset 0 + OpDecorate %50 Block + OpDecorate %127 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %13 = OpConstant %6 0 + %20 = OpConstant %6 1 + %21 = OpTypeBool + %28 = OpConstant %6 3 + %33 = OpConstant %6 2 + %41 = OpTypeFloat 32 + %42 = OpTypeVector %41 2 + %43 = OpTypePointer Function %42 + %45 = OpTypeVector %41 4 + %46 = OpTypePointer Input %45 + %47 = OpVariable %46 Input + %50 = OpTypeStruct %42 + %51 = OpTypePointer PushConstant %50 + %52 = OpVariable %51 PushConstant + %53 = OpTypePointer PushConstant %42 + %59 = OpTypeInt 32 0 + %60 = OpConstant %59 0 + %61 = OpTypePointer PushConstant %41 + %64 = OpConstant %59 1 + %72 = OpConstant %41 1 + %73 = OpConstant %41 0 + %74 = OpConstantComposite %42 %72 %73 + %75 = OpConstant %41 218.850998 + %76 = OpConstantComposite %42 %73 %75 + %77 = OpConstantTrue %21 + %78 = OpTypePointer Input %41 + %82 = OpTypeVector %21 2 + %102 = OpConstantComposite %42 %72 %72 + %112 = OpConstant %41 8 + %116 = OpTypePointer Function %41 + %120 = OpConstant %6 8 + %126 = OpTypePointer Output %45 + %127 = OpVariable %126 Output + %128 = OpConstant %59 16 + %129 = OpTypeArray %45 %128 + %130 = OpConstantComposite %45 %73 %73 %73 %72 + %131 = OpConstant %41 0.5 + %132 = OpConstantComposite %45 %131 %73 %73 %72 + %133 = OpConstantComposite %45 %73 %131 %73 %72 + %134 = OpConstantComposite %45 %131 %131 %73 %72 + %135 = OpConstantComposite %45 %73 %73 %131 %72 + %136 = OpConstantComposite %45 %131 %73 %131 %72 + %137 = OpConstantComposite %45 %73 %131 %131 %72 + %138 = OpConstantComposite %45 %131 %131 %131 %72 + %139 = OpConstantComposite %45 %72 %73 %73 %72 + %140 = OpConstantComposite %45 %73 %72 %73 %72 + %141 = OpConstantComposite %45 %72 %72 %73 %72 + %142 = OpConstantComposite %45 %73 %73 %72 %72 + %143 = OpConstantComposite %45 %72 %73 %72 %72 + %144 = OpConstantComposite %45 %73 %72 %72 %72 + %145 = OpConstantComposite %45 %72 %72 %72 %72 + %146 = OpConstantComposite %129 %130 %132 %133 %134 %135 %136 %137 %138 %130 %139 %140 %141 %142 %143 %144 %145 + %150 = OpConstant %6 16 + %152 = OpTypePointer Function %129 + %154 = OpTypePointer Function %45 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %44 = OpVariable %43 Function + %70 = OpVariable %43 Function + %93 = OpVariable %43 Function + %104 = OpVariable %43 Function + %107 = OpVariable %43 Function + %115 = OpVariable %7 Function + %147 = OpVariable %7 Function + %153 = OpVariable %152 Function + %48 = OpLoad %45 %47 + %49 = OpVectorShuffle %42 %48 %48 0 1 + %54 = OpAccessChain %53 %52 %13 + %55 = OpLoad %42 %54 + %56 = OpFDiv %42 %49 %55 + %57 = OpLoad %45 %47 + %58 = OpVectorShuffle %42 %57 %57 0 1 + %62 = OpAccessChain %61 %52 %13 %60 + %63 = OpLoad %41 %62 + %65 = OpAccessChain %61 %52 %13 %64 + %66 = OpLoad %41 %65 + %67 = OpCompositeConstruct %42 %63 %66 + %68 = OpFDiv %42 %58 %67 + %69 = OpExtInst %42 %1 FMax %56 %68 + OpStore %44 %69 + %71 = OpLoad %42 %44 + %79 = OpAccessChain %78 %47 %64 + %80 = OpLoad %41 %79 + %81 = OpFOrdLessThan %21 %80 %73 + %83 = OpCompositeConstruct %82 %77 %81 + %84 = OpSelect %42 %83 %76 %74 + %85 = OpExtInst %42 %1 Cos %84 + %86 = OpFDiv %42 %71 %85 + %87 = OpLoad %45 %47 + %88 = OpVectorShuffle %42 %87 %87 0 1 + %89 = OpAccessChain %53 %52 %13 + %90 = OpLoad %42 %89 + %91 = OpFDiv %42 %88 %90 + %92 = OpExtInst %42 %1 FMax %86 %91 + OpStore %70 %92 + %94 = OpAccessChain %78 %47 %64 + %95 = OpLoad %41 %94 + %96 = OpFOrdLessThan %21 %95 %73 + %97 = OpCompositeConstruct %82 %77 %96 + %98 = OpSelect %42 %97 %76 %74 + %99 = OpExtInst %42 %1 Cos %98 + %100 = OpCompositeConstruct %42 %72 %72 + %101 = OpFDiv %42 %100 %99 + %103 = OpExtInst %42 %1 FMax %101 %102 + OpStore %93 %103 + %105 = OpLoad %42 %93 + %106 = OpExtInst %42 %1 FMax %102 %105 + OpStore %104 %106 + %108 = OpLoad %42 %70 + %109 = OpLoad %42 %104 + %110 = OpExtInst %42 %1 FMin %108 %109 + OpStore %107 %110 + %111 = OpLoad %42 %107 + %113 = OpVectorTimesScalar %42 %111 %112 + %114 = OpExtInst %42 %1 Floor %113 + OpStore %107 %114 + %117 = OpAccessChain %116 %107 %60 + %118 = OpLoad %41 %117 + %119 = OpConvertFToS %6 %118 + %121 = OpIMul %6 %119 %120 + %122 = OpAccessChain %116 %107 %64 + %123 = OpLoad %41 %122 + %124 = OpConvertFToS %6 %123 + %125 = OpIAdd %6 %121 %124 + OpStore %115 %125 + %148 = OpLoad %6 %115 + OpStore %147 %148 + %149 = OpFunctionCall %6 %10 %147 + %151 = OpSMod %6 %149 %150 + OpStore %153 %146 + %155 = OpAccessChain %154 %153 %151 + %156 = OpLoad %45 %155 + OpStore %127 %156 + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %12 = OpVariable %7 Function + OpStore %12 %13 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %18 + %18 = OpLabel + %19 = OpLoad %6 %9 + %22 = OpSGreaterThan %21 %19 %20 + OpBranchConditional %22 %15 %16 + %15 = OpLabel + %23 = OpLoad %6 %9 + %24 = OpBitwiseAnd %6 %23 %20 + %25 = OpIEqual %21 %24 %20 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %32 + %26 = OpLabel + %29 = OpLoad %6 %9 + %30 = OpIMul %6 %28 %29 + %31 = OpIAdd %6 %30 %20 + OpStore %9 %31 + OpBranch %27 + %32 = OpLabel + %34 = OpLoad %6 %9 + %35 = OpSDiv %6 %34 %33 + OpStore %9 %35 + OpBranch %27 + %27 = OpLabel + %36 = OpLoad %6 %12 + %37 = OpIAdd %6 %36 %20 + OpStore %12 %37 + OpBranch %17 + %17 = OpLabel + OpBranch %14 + %16 = OpLabel + %38 = OpLoad %6 %12 + OpReturnValue %38 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS push_constant +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard.amber b/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard.amber new file mode 100644 index 0000000..e77b966 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard.amber @@ -0,0 +1,702 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: A fragment shader with two always false discards + +# The test passes because both shaders render the same image. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 717e7877cac15d393fd3bb1bd872679de8b59add + + + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# float compute_value(float limit, float thirty_two) +# { +# float result = -0.5; +# for (int i = 1; i < 800; i++) +# { +# if ((i % 32) == 0) +# { +# result += 0.4; +# } +# else +# { +# if (mod(float(i), round(thirty_two)) <= 0.01) +# { +# result += 100.0; +# } +# } +# if (float(i) >= limit) +# { +# return result; +# } +# } +# return result; +# } +# void main() +# { +# vec3 c = vec3(7.0, 8.0, 9.0); +# float thirty_two = round(resolution.x / 8.0); +# c.x = compute_value(gl_FragCoord.x, thirty_two); +# c.y = compute_value(gl_FragCoord.y, thirty_two); +# c.z = c.x + c.y; +# for (int i = 0; i < 3; i++) +# { +# if (c[i] >= 1.0) +# { +# c[i] = c[i] * c[i]; +# } +# } +# _GLF_color = vec4(normalize(abs(c)), 1.0); +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 290 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %137 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %66 "c" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %137 "_GLF_color" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpDecorate %137 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %107 = OpConstant %76 2 + %116 = OpConstant %15 3 + %121 = OpConstant %6 1 + %136 = OpTypePointer Output %83 + %137 = OpVariable %136 Output + %149 = OpConstantFalse %26 + %152 = OpConstantTrue %26 + %261 = OpUndef %6 + %289 = OpConstant %6 0.125 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %81 = OpFMul %6 %80 %289 + %82 = OpExtInst %6 %1 Round %81 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpSelectionMerge %199 None + OpSwitch %77 %161 + %161 = OpLabel + OpBranch %162 + %162 = OpLabel + %248 = OpPhi %6 %14 %161 %251 %192 + %247 = OpPhi %15 %18 %161 %194 %192 + %165 = OpSLessThan %26 %247 %25 + OpLoopMerge %195 %192 None + OpBranchConditional %165 %166 %195 + %166 = OpLabel + %168 = OpSMod %15 %247 %29 + %169 = OpIEqual %26 %168 %31 + OpSelectionMerge %184 None + OpBranchConditional %169 %170 %173 + %170 = OpLabel + %172 = OpFAdd %6 %248 %35 + OpBranch %184 + %173 = OpLabel + %175 = OpConvertSToF %6 %247 + %177 = OpExtInst %6 %1 Round %82 + %178 = OpFMod %6 %175 %177 + %179 = OpFOrdLessThanEqual %26 %178 %44 + OpSelectionMerge %183 None + OpBranchConditional %179 %180 %183 + %180 = OpLabel + %182 = OpFAdd %6 %248 %48 + OpBranch %183 + %183 = OpLabel + %252 = OpPhi %6 %248 %173 %182 %180 + OpBranch %184 + %184 = OpLabel + %251 = OpPhi %6 %172 %170 %252 %183 + %186 = OpConvertSToF %6 %247 + %188 = OpFOrdGreaterThanEqual %26 %186 %89 + OpSelectionMerge %191 None + OpBranchConditional %188 %189 %191 + %189 = OpLabel + OpBranch %195 + %191 = OpLabel + OpBranch %192 + %192 = OpLabel + %194 = OpIAdd %15 %247 %18 + OpBranch %162 + %195 = OpLabel + %259 = OpPhi %6 %261 %162 %251 %189 + %257 = OpPhi %6 %248 %162 %251 %189 + %253 = OpPhi %26 %149 %162 %152 %189 + OpSelectionMerge %197 None + OpBranchConditional %253 %199 %197 + %197 = OpLabel + OpBranch %199 + %199 = OpLabel + %258 = OpPhi %6 %259 %195 %257 %197 + %93 = OpAccessChain %7 %66 %77 + OpStore %93 %258 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpSelectionMerge %245 None + OpSwitch %77 %207 + %207 = OpLabel + OpBranch %208 + %208 = OpLabel + %265 = OpPhi %6 %14 %207 %268 %238 + %264 = OpPhi %15 %18 %207 %240 %238 + %211 = OpSLessThan %26 %264 %25 + OpLoopMerge %241 %238 None + OpBranchConditional %211 %212 %241 + %212 = OpLabel + %214 = OpSMod %15 %264 %29 + %215 = OpIEqual %26 %214 %31 + OpSelectionMerge %230 None + OpBranchConditional %215 %216 %219 + %216 = OpLabel + %218 = OpFAdd %6 %265 %35 + OpBranch %230 + %219 = OpLabel + %221 = OpConvertSToF %6 %264 + %223 = OpExtInst %6 %1 Round %82 + %224 = OpFMod %6 %221 %223 + %225 = OpFOrdLessThanEqual %26 %224 %44 + OpSelectionMerge %229 None + OpBranchConditional %225 %226 %229 + %226 = OpLabel + %228 = OpFAdd %6 %265 %48 + OpBranch %229 + %229 = OpLabel + %269 = OpPhi %6 %265 %219 %228 %226 + OpBranch %230 + %230 = OpLabel + %268 = OpPhi %6 %218 %216 %269 %229 + %232 = OpConvertSToF %6 %264 + %234 = OpFOrdGreaterThanEqual %26 %232 %97 + OpSelectionMerge %237 None + OpBranchConditional %234 %235 %237 + %235 = OpLabel + OpBranch %241 + %237 = OpLabel + OpBranch %238 + %238 = OpLabel + %240 = OpIAdd %15 %264 %18 + OpBranch %208 + %241 = OpLabel + %276 = OpPhi %6 %261 %208 %268 %235 + %274 = OpPhi %6 %265 %208 %268 %235 + %270 = OpPhi %26 %149 %208 %152 %235 + OpSelectionMerge %243 None + OpBranchConditional %270 %245 %243 + %243 = OpLabel + OpBranch %245 + %245 = OpLabel + %275 = OpPhi %6 %276 %241 %274 %243 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %275 + %103 = OpLoad %6 %93 + %105 = OpLoad %6 %101 + %106 = OpFAdd %6 %103 %105 + %108 = OpAccessChain %7 %66 %107 + OpStore %108 %106 + OpBranch %110 + %110 = OpLabel + %285 = OpPhi %15 %31 %245 %135 %113 + %117 = OpSLessThan %26 %285 %116 + OpLoopMerge %112 %113 None + OpBranchConditional %117 %111 %112 + %111 = OpLabel + %119 = OpAccessChain %7 %66 %285 + %120 = OpLoad %6 %119 + %122 = OpFOrdGreaterThanEqual %26 %120 %121 + OpSelectionMerge %124 None + OpBranchConditional %122 %123 %124 + %123 = OpLabel + %128 = OpLoad %6 %119 + %131 = OpLoad %6 %119 + %132 = OpFMul %6 %128 %131 + OpStore %119 %132 + OpBranch %124 + %124 = OpLabel + OpBranch %113 + %113 = OpLabel + %135 = OpIAdd %15 %285 %18 + OpBranch %110 + %112 = OpLabel + %138 = OpLoad %64 %66 + %139 = OpExtInst %64 %1 FAbs %138 + %140 = OpExtInst %64 %1 Normalize %139 + %141 = OpCompositeExtract %6 %140 0 + %142 = OpCompositeExtract %6 %140 1 + %143 = OpCompositeExtract %6 %140 2 + %144 = OpCompositeConstruct %83 %141 %142 %143 %121 + OpStore %137 %144 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 injectionSwitch; // x == 0.0, y == 1.0 +# }; +# float compute_value(float limit, float thirty_two) +# { +# float result = -0.5; +# for (int i = 1; i < 800; i++) +# { +# if ((i % 32) == 0) +# { +# result += 0.4; +# } +# else +# { +# if (mod(float(i), round(thirty_two)) <= 0.01) +# { +# result += 100.0; +# } +# // Always false. +# if (injectionSwitch.x > injectionSwitch.y) +# { +# discard; +# } +# } +# if (float(i) >= limit) +# { +# return result; +# } +# } +# return result; +# } +# void main() +# { +# vec3 c = vec3(7.0, 8.0, 9.0); +# float thirty_two = round(resolution.x / 8.0); +# c.x = compute_value(gl_FragCoord.x, thirty_two); +# c.y = compute_value(gl_FragCoord.y, thirty_two); +# c.z = c.x + c.y; +# for (int i = 0; i < 3; i++) +# { +# if (c[i] >= 1.0) +# { +# c[i] = c[i] * c[i]; +# // Always false. +# if ((injectionSwitch.x > injectionSwitch.y)) +# { +# discard; +# } +# } +# } +# _GLF_color = vec4(normalize(abs(c)), 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 325 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %97 %156 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %52 "buf1" + OpMemberName %52 0 "injectionSwitch" + OpName %54 "" + OpName %82 "c" + OpName %88 "buf0" + OpMemberName %88 0 "resolution" + OpName %90 "" + OpName %97 "gl_FragCoord" + OpName %156 "_GLF_color" + OpMemberDecorate %52 0 Offset 0 + OpDecorate %52 Block + OpDecorate %54 DescriptorSet 0 + OpDecorate %54 Binding 1 + OpMemberDecorate %88 0 Offset 0 + OpDecorate %88 Block + OpDecorate %90 DescriptorSet 0 + OpDecorate %90 Binding 0 + OpDecorate %97 BuiltIn FragCoord + OpDecorate %156 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %51 = OpTypeVector %6 2 + %52 = OpTypeStruct %51 + %53 = OpTypePointer Uniform %52 + %54 = OpVariable %53 Uniform + %55 = OpTypeInt 32 0 + %56 = OpConstant %55 0 + %57 = OpTypePointer Uniform %6 + %60 = OpConstant %55 1 + %80 = OpTypeVector %6 3 + %81 = OpTypePointer Function %80 + %83 = OpConstant %6 7 + %84 = OpConstant %6 8 + %85 = OpConstant %6 9 + %86 = OpConstantComposite %80 %83 %84 %85 + %88 = OpTypeStruct %51 + %89 = OpTypePointer Uniform %88 + %90 = OpVariable %89 Uniform + %95 = OpTypeVector %6 4 + %96 = OpTypePointer Input %95 + %97 = OpVariable %96 Input + %99 = OpTypePointer Input %6 + %118 = OpConstant %55 2 + %127 = OpConstant %15 3 + %132 = OpConstant %6 1 + %155 = OpTypePointer Output %95 + %156 = OpVariable %155 Output + %168 = OpConstantFalse %26 + %171 = OpConstantTrue %26 + %296 = OpUndef %6 + %324 = OpConstant %6 0.125 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %82 = OpVariable %81 Function + OpStore %82 %86 + %91 = OpAccessChain %57 %90 %31 %56 + %92 = OpLoad %6 %91 + %93 = OpFMul %6 %92 %324 + %94 = OpExtInst %6 %1 Round %93 + %100 = OpAccessChain %99 %97 %56 + %101 = OpLoad %6 %100 + OpSelectionMerge %225 None + OpSwitch %56 %180 + %180 = OpLabel + OpBranch %181 + %181 = OpLabel + %283 = OpPhi %6 %14 %180 %286 %218 + %282 = OpPhi %15 %18 %180 %220 %218 + %184 = OpSLessThan %26 %282 %25 + OpLoopMerge %221 %218 None + OpBranchConditional %184 %185 %221 + %185 = OpLabel + %187 = OpSMod %15 %282 %29 + %188 = OpIEqual %26 %187 %31 + OpSelectionMerge %210 None + OpBranchConditional %188 %189 %192 + %189 = OpLabel + %191 = OpFAdd %6 %283 %35 + OpBranch %210 + %192 = OpLabel + %194 = OpConvertSToF %6 %282 + %196 = OpExtInst %6 %1 Round %94 + %197 = OpFMod %6 %194 %196 + %198 = OpFOrdLessThanEqual %26 %197 %44 + OpSelectionMerge %202 None + OpBranchConditional %198 %199 %202 + %199 = OpLabel + %201 = OpFAdd %6 %283 %48 + OpBranch %202 + %202 = OpLabel + %287 = OpPhi %6 %283 %192 %201 %199 + %203 = OpAccessChain %57 %54 %31 %56 + %204 = OpLoad %6 %203 + %205 = OpAccessChain %57 %54 %31 %60 + %206 = OpLoad %6 %205 + %207 = OpFOrdGreaterThan %26 %204 %206 + OpSelectionMerge %209 None + OpBranchConditional %207 %208 %209 + %208 = OpLabel + OpTerminateInvocation + %209 = OpLabel + OpBranch %210 + %210 = OpLabel + %286 = OpPhi %6 %191 %189 %287 %209 + %212 = OpConvertSToF %6 %282 + %214 = OpFOrdGreaterThanEqual %26 %212 %101 + OpSelectionMerge %217 None + OpBranchConditional %214 %215 %217 + %215 = OpLabel + OpBranch %221 + %217 = OpLabel + OpBranch %218 + %218 = OpLabel + %220 = OpIAdd %15 %282 %18 + OpBranch %181 + %221 = OpLabel + %294 = OpPhi %6 %296 %181 %286 %215 + %292 = OpPhi %6 %283 %181 %286 %215 + %288 = OpPhi %26 %168 %181 %171 %215 + OpSelectionMerge %223 None + OpBranchConditional %288 %225 %223 + %223 = OpLabel + OpBranch %225 + %225 = OpLabel + %293 = OpPhi %6 %294 %221 %292 %223 + %105 = OpAccessChain %7 %82 %56 + OpStore %105 %293 + %107 = OpAccessChain %99 %97 %60 + %108 = OpLoad %6 %107 + OpSelectionMerge %279 None + OpSwitch %56 %234 + %234 = OpLabel + OpBranch %235 + %235 = OpLabel + %300 = OpPhi %6 %14 %234 %303 %272 + %299 = OpPhi %15 %18 %234 %274 %272 + %238 = OpSLessThan %26 %299 %25 + OpLoopMerge %275 %272 None + OpBranchConditional %238 %239 %275 + %239 = OpLabel + %241 = OpSMod %15 %299 %29 + %242 = OpIEqual %26 %241 %31 + OpSelectionMerge %264 None + OpBranchConditional %242 %243 %246 + %243 = OpLabel + %245 = OpFAdd %6 %300 %35 + OpBranch %264 + %246 = OpLabel + %248 = OpConvertSToF %6 %299 + %250 = OpExtInst %6 %1 Round %94 + %251 = OpFMod %6 %248 %250 + %252 = OpFOrdLessThanEqual %26 %251 %44 + OpSelectionMerge %256 None + OpBranchConditional %252 %253 %256 + %253 = OpLabel + %255 = OpFAdd %6 %300 %48 + OpBranch %256 + %256 = OpLabel + %304 = OpPhi %6 %300 %246 %255 %253 + %257 = OpAccessChain %57 %54 %31 %56 + %258 = OpLoad %6 %257 + %259 = OpAccessChain %57 %54 %31 %60 + %260 = OpLoad %6 %259 + %261 = OpFOrdGreaterThan %26 %258 %260 + OpSelectionMerge %263 None + OpBranchConditional %261 %262 %263 + %262 = OpLabel + OpTerminateInvocation + %263 = OpLabel + OpBranch %264 + %264 = OpLabel + %303 = OpPhi %6 %245 %243 %304 %263 + %266 = OpConvertSToF %6 %299 + %268 = OpFOrdGreaterThanEqual %26 %266 %108 + OpSelectionMerge %271 None + OpBranchConditional %268 %269 %271 + %269 = OpLabel + OpBranch %275 + %271 = OpLabel + OpBranch %272 + %272 = OpLabel + %274 = OpIAdd %15 %299 %18 + OpBranch %235 + %275 = OpLabel + %311 = OpPhi %6 %296 %235 %303 %269 + %309 = OpPhi %6 %300 %235 %303 %269 + %305 = OpPhi %26 %168 %235 %171 %269 + OpSelectionMerge %277 None + OpBranchConditional %305 %279 %277 + %277 = OpLabel + OpBranch %279 + %279 = OpLabel + %310 = OpPhi %6 %311 %275 %309 %277 + %112 = OpAccessChain %7 %82 %60 + OpStore %112 %310 + %114 = OpLoad %6 %105 + %116 = OpLoad %6 %112 + %117 = OpFAdd %6 %114 %116 + %119 = OpAccessChain %7 %82 %118 + OpStore %119 %117 + OpBranch %121 + %121 = OpLabel + %320 = OpPhi %15 %31 %279 %154 %124 + %128 = OpSLessThan %26 %320 %127 + OpLoopMerge %123 %124 None + OpBranchConditional %128 %122 %123 + %122 = OpLabel + %130 = OpAccessChain %7 %82 %320 + %131 = OpLoad %6 %130 + %133 = OpFOrdGreaterThanEqual %26 %131 %132 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %139 = OpLoad %6 %130 + %142 = OpLoad %6 %130 + %143 = OpFMul %6 %139 %142 + OpStore %130 %143 + %145 = OpAccessChain %57 %54 %31 %56 + %146 = OpLoad %6 %145 + %147 = OpAccessChain %57 %54 %31 %60 + %148 = OpLoad %6 %147 + %149 = OpFOrdGreaterThan %26 %146 %148 + OpSelectionMerge %151 None + OpBranchConditional %149 %150 %151 + %150 = OpLabel + OpTerminateInvocation + %151 = OpLabel + OpBranch %135 + %135 = OpLabel + OpBranch %124 + %124 = OpLabel + %154 = OpIAdd %15 %320 %18 + OpBranch %121 + %123 = OpLabel + %157 = OpLoad %80 %82 + %158 = OpExtInst %80 %1 FAbs %157 + %159 = OpExtInst %80 %1 Normalize %158 + %160 = OpCompositeExtract %6 %159 0 + %161 = OpCompositeExtract %6 %159 1 + %162 = OpCompositeExtract %6 %159 2 + %163 = OpCompositeConstruct %95 %160 %161 %162 %132 + OpStore %156 %163 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp.amber b/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp.amber new file mode 100644 index 0000000..827edc8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp.amber @@ -0,0 +1,689 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: A fragment shader with clamped float in determinant matrix + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# float compute_value(float limit, float thirty_two) +# { +# float result = -0.5; +# for (int i = 1; i < 800; i++) +# { +# if ((i % 32) == 0) +# { +# result += 0.4; +# } +# else +# { +# if (mod(float(i), round(thirty_two)) <= 0.01) +# { +# result += 100.0; +# } +# } +# if (float(i) >= limit) +# { +# return result; +# } +# } +# return result; +# } +# void main() +# { +# vec3 c = vec3(7.0, 8.0, 9.0); +# float thirty_two = round(resolution.x / 8.0); +# c.x = compute_value(gl_FragCoord.x, thirty_two); +# c.y = compute_value(gl_FragCoord.y, thirty_two); +# c.z = c.x + c.y; +# for (int i = 0; i < 3; i++) +# { +# if (c[i] >= 1.0) +# { +# c[i] = c[i] * c[i]; +# } +# } +# _GLF_color = vec4(normalize(abs(c)), 1.0); +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 145 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %137 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "compute_value(f1;f1;" + OpName %9 "limit" + OpName %10 "thirty_two" + OpName %13 "result" + OpName %17 "i" + OpName %66 "c" + OpName %71 "thirty_two" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %86 "param" + OpName %90 "param" + OpName %94 "param" + OpName %98 "param" + OpName %109 "i" + OpName %137 "_GLF_color" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpDecorate %137 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 %7 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %16 = OpTypePointer Function %15 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %107 = OpConstant %76 2 + %116 = OpConstant %15 3 + %121 = OpConstant %6 1 + %136 = OpTypePointer Output %83 + %137 = OpVariable %136 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + %71 = OpVariable %7 Function + %86 = OpVariable %7 Function + %90 = OpVariable %7 Function + %94 = OpVariable %7 Function + %98 = OpVariable %7 Function + %109 = OpVariable %16 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %81 = OpFDiv %6 %80 %68 + %82 = OpExtInst %6 %1 Round %81 + OpStore %71 %82 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpStore %86 %89 + %91 = OpLoad %6 %71 + OpStore %90 %91 + %92 = OpFunctionCall %6 %11 %86 %90 + %93 = OpAccessChain %7 %66 %77 + OpStore %93 %92 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpStore %94 %97 + %99 = OpLoad %6 %71 + OpStore %98 %99 + %100 = OpFunctionCall %6 %11 %94 %98 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %100 + %102 = OpAccessChain %7 %66 %77 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %7 %66 %95 + %105 = OpLoad %6 %104 + %106 = OpFAdd %6 %103 %105 + %108 = OpAccessChain %7 %66 %107 + OpStore %108 %106 + OpStore %109 %31 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %115 = OpLoad %15 %109 + %117 = OpSLessThan %26 %115 %116 + OpBranchConditional %117 %111 %112 + %111 = OpLabel + %118 = OpLoad %15 %109 + %119 = OpAccessChain %7 %66 %118 + %120 = OpLoad %6 %119 + %122 = OpFOrdGreaterThanEqual %26 %120 %121 + OpSelectionMerge %124 None + OpBranchConditional %122 %123 %124 + %123 = OpLabel + %125 = OpLoad %15 %109 + %126 = OpLoad %15 %109 + %127 = OpAccessChain %7 %66 %126 + %128 = OpLoad %6 %127 + %129 = OpLoad %15 %109 + %130 = OpAccessChain %7 %66 %129 + %131 = OpLoad %6 %130 + %132 = OpFMul %6 %128 %131 + %133 = OpAccessChain %7 %66 %125 + OpStore %133 %132 + OpBranch %124 + %124 = OpLabel + OpBranch %113 + %113 = OpLabel + %134 = OpLoad %15 %109 + %135 = OpIAdd %15 %134 %18 + OpStore %109 %135 + OpBranch %110 + %112 = OpLabel + %138 = OpLoad %64 %66 + %139 = OpExtInst %64 %1 FAbs %138 + %140 = OpExtInst %64 %1 Normalize %139 + %141 = OpCompositeExtract %6 %140 0 + %142 = OpCompositeExtract %6 %140 1 + %143 = OpCompositeExtract %6 %140 2 + %144 = OpCompositeConstruct %83 %141 %142 %143 %121 + OpStore %137 %144 + OpReturn + OpFunctionEnd + %11 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %13 = OpVariable %7 Function + %17 = OpVariable %16 Function + OpStore %13 %14 + OpStore %17 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %15 %17 + %27 = OpSLessThan %26 %24 %25 + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %28 = OpLoad %15 %17 + %30 = OpSMod %15 %28 %29 + %32 = OpIEqual %26 %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %38 + %33 = OpLabel + %36 = OpLoad %6 %13 + %37 = OpFAdd %6 %36 %35 + OpStore %13 %37 + OpBranch %34 + %38 = OpLabel + %39 = OpLoad %15 %17 + %40 = OpConvertSToF %6 %39 + %41 = OpLoad %6 %10 + %42 = OpExtInst %6 %1 Round %41 + %43 = OpFMod %6 %40 %42 + %45 = OpFOrdLessThanEqual %26 %43 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + %49 = OpLoad %6 %13 + %50 = OpFAdd %6 %49 %48 + OpStore %13 %50 + OpBranch %47 + %47 = OpLabel + OpBranch %34 + %34 = OpLabel + %51 = OpLoad %15 %17 + %52 = OpConvertSToF %6 %51 + %53 = OpLoad %6 %9 + %54 = OpFOrdGreaterThanEqual %26 %52 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + %57 = OpLoad %6 %13 + OpReturnValue %57 + %56 = OpLabel + OpBranch %22 + %22 = OpLabel + %59 = OpLoad %15 %17 + %60 = OpIAdd %15 %59 %18 + OpStore %17 %60 + OpBranch %19 + %21 = OpLabel + %61 = OpLoad %6 %13 + OpReturnValue %61 + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# float compute_value(float limit, float thirty_two) +# { +# float result = -0.5; +# for (int i = 1; i < 800; i++) +# { +# if ((i % 32) == 0) +# { +# result += 0.4; +# } +# else +# { +# if (mod(float(i), round(thirty_two)) <= 0.01) +# { +# result += 100.0; +# } +# } +# if (float(i) >= limit) +# { +# // clamp_a == 1.0 +# float clamp_a = clamp((1.0), (1.0), ((gl_FragCoord.y < 0.0) ? (-1.0) : (false ? exp(result) : 1.0))); +# // det_a == 1.0 +# float det_a = determinant(mat4(1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, clamp_a)); +# // Type casting matrix to float takes the first value in matrix. +# // float_a == result +# float float_a = float(mat4x3(((result) / det_a), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0)); +# // Returns result. +# return float_a; +# } +# } +# return result; +# } +# void main() +# { +# vec3 c = vec3(7.0, 8.0, 9.0); +# float thirty_two = round(resolution.x / 8.0); +# c.x = compute_value(gl_FragCoord.x, thirty_two); +# c.y = compute_value(gl_FragCoord.y, thirty_two); +# c.z = c.x + c.y; +# for (int i = 0; i < 3; i++) +# { +# if (c[i] >= 1.0) +# { +# c[i] = c[i] * c[i]; +# } +# } +# _GLF_color = vec4(normalize(abs(c)), 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 185 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %61 %177 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "compute_value(f1;f1;" + OpName %9 "limit" + OpName %10 "thirty_two" + OpName %13 "result" + OpName %17 "i" + OpName %57 "clamp_a" + OpName %61 "gl_FragCoord" + OpName %84 "det_a" + OpName %93 "float_a" + OpName %113 "c" + OpName %118 "thirty_two" + OpName %120 "buf0" + OpMemberName %120 0 "resolution" + OpName %122 "" + OpName %129 "param" + OpName %132 "param" + OpName %136 "param" + OpName %139 "param" + OpName %150 "i" + OpName %177 "_GLF_color" + OpDecorate %61 BuiltIn FragCoord + OpMemberDecorate %120 0 Offset 0 + OpDecorate %120 Block + OpDecorate %122 DescriptorSet 0 + OpDecorate %122 Binding 0 + OpDecorate %177 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 %7 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %16 = OpTypePointer Function %15 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %58 = OpConstant %6 1 + %59 = OpTypeVector %6 4 + %60 = OpTypePointer Input %59 + %61 = OpVariable %60 Input + %62 = OpTypeInt 32 0 + %63 = OpConstant %62 1 + %64 = OpTypePointer Input %6 + %67 = OpConstant %6 0 + %72 = OpConstant %6 -1 + %74 = OpConstantFalse %26 + %86 = OpTypeMatrix %59 4 + %97 = OpTypeVector %6 3 + %98 = OpTypeMatrix %97 4 + %112 = OpTypePointer Function %97 + %114 = OpConstant %6 7 + %115 = OpConstant %6 8 + %116 = OpConstant %6 9 + %117 = OpConstantComposite %97 %114 %115 %116 + %119 = OpTypeVector %6 2 + %120 = OpTypeStruct %119 + %121 = OpTypePointer Uniform %120 + %122 = OpVariable %121 Uniform + %123 = OpConstant %62 0 + %124 = OpTypePointer Uniform %6 + %148 = OpConstant %62 2 + %157 = OpConstant %15 3 + %176 = OpTypePointer Output %59 + %177 = OpVariable %176 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %113 = OpVariable %112 Function + %118 = OpVariable %7 Function + %129 = OpVariable %7 Function + %132 = OpVariable %7 Function + %136 = OpVariable %7 Function + %139 = OpVariable %7 Function + %150 = OpVariable %16 Function + OpStore %113 %117 + %125 = OpAccessChain %124 %122 %31 %123 + %126 = OpLoad %6 %125 + %127 = OpFDiv %6 %126 %115 + %128 = OpExtInst %6 %1 Round %127 + OpStore %118 %128 + %130 = OpAccessChain %64 %61 %123 + %131 = OpLoad %6 %130 + OpStore %129 %131 + %133 = OpLoad %6 %118 + OpStore %132 %133 + %134 = OpFunctionCall %6 %11 %129 %132 + %135 = OpAccessChain %7 %113 %123 + OpStore %135 %134 + %137 = OpAccessChain %64 %61 %63 + %138 = OpLoad %6 %137 + OpStore %136 %138 + %140 = OpLoad %6 %118 + OpStore %139 %140 + %141 = OpFunctionCall %6 %11 %136 %139 + %142 = OpAccessChain %7 %113 %63 + OpStore %142 %141 + %143 = OpAccessChain %7 %113 %123 + %144 = OpLoad %6 %143 + %145 = OpAccessChain %7 %113 %63 + %146 = OpLoad %6 %145 + %147 = OpFAdd %6 %144 %146 + %149 = OpAccessChain %7 %113 %148 + OpStore %149 %147 + OpStore %150 %31 + OpBranch %151 + %151 = OpLabel + OpLoopMerge %153 %154 None + OpBranch %155 + %155 = OpLabel + %156 = OpLoad %15 %150 + %158 = OpSLessThan %26 %156 %157 + OpBranchConditional %158 %152 %153 + %152 = OpLabel + %159 = OpLoad %15 %150 + %160 = OpAccessChain %7 %113 %159 + %161 = OpLoad %6 %160 + %162 = OpFOrdGreaterThanEqual %26 %161 %58 + OpSelectionMerge %164 None + OpBranchConditional %162 %163 %164 + %163 = OpLabel + %165 = OpLoad %15 %150 + %166 = OpLoad %15 %150 + %167 = OpAccessChain %7 %113 %166 + %168 = OpLoad %6 %167 + %169 = OpLoad %15 %150 + %170 = OpAccessChain %7 %113 %169 + %171 = OpLoad %6 %170 + %172 = OpFMul %6 %168 %171 + %173 = OpAccessChain %7 %113 %165 + OpStore %173 %172 + OpBranch %164 + %164 = OpLabel + OpBranch %154 + %154 = OpLabel + %174 = OpLoad %15 %150 + %175 = OpIAdd %15 %174 %18 + OpStore %150 %175 + OpBranch %151 + %153 = OpLabel + %178 = OpLoad %97 %113 + %179 = OpExtInst %97 %1 FAbs %178 + %180 = OpExtInst %97 %1 Normalize %179 + %181 = OpCompositeExtract %6 %180 0 + %182 = OpCompositeExtract %6 %180 1 + %183 = OpCompositeExtract %6 %180 2 + %184 = OpCompositeConstruct %59 %181 %182 %183 %58 + OpStore %177 %184 + OpReturn + OpFunctionEnd + %11 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %13 = OpVariable %7 Function + %17 = OpVariable %16 Function + %57 = OpVariable %7 Function + %69 = OpVariable %7 Function + %75 = OpVariable %7 Function + %84 = OpVariable %7 Function + %93 = OpVariable %7 Function + OpStore %13 %14 + OpStore %17 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %15 %17 + %27 = OpSLessThan %26 %24 %25 + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %28 = OpLoad %15 %17 + %30 = OpSMod %15 %28 %29 + %32 = OpIEqual %26 %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %38 + %33 = OpLabel + %36 = OpLoad %6 %13 + %37 = OpFAdd %6 %36 %35 + OpStore %13 %37 + OpBranch %34 + %38 = OpLabel + %39 = OpLoad %15 %17 + %40 = OpConvertSToF %6 %39 + %41 = OpLoad %6 %10 + %42 = OpExtInst %6 %1 Round %41 + %43 = OpFMod %6 %40 %42 + %45 = OpFOrdLessThanEqual %26 %43 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + %49 = OpLoad %6 %13 + %50 = OpFAdd %6 %49 %48 + OpStore %13 %50 + OpBranch %47 + %47 = OpLabel + OpBranch %34 + %34 = OpLabel + %51 = OpLoad %15 %17 + %52 = OpConvertSToF %6 %51 + %53 = OpLoad %6 %9 + %54 = OpFOrdGreaterThanEqual %26 %52 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + %65 = OpAccessChain %64 %61 %63 + %66 = OpLoad %6 %65 + %68 = OpFOrdLessThan %26 %66 %67 + OpSelectionMerge %71 None + OpBranchConditional %68 %70 %73 + %70 = OpLabel + OpStore %69 %72 + OpBranch %71 + %73 = OpLabel + OpSelectionMerge %77 None + OpBranchConditional %74 %76 %80 + %76 = OpLabel + %78 = OpLoad %6 %13 + %79 = OpExtInst %6 %1 Exp %78 + OpStore %75 %79 + OpBranch %77 + %80 = OpLabel + OpStore %75 %58 + OpBranch %77 + %77 = OpLabel + %81 = OpLoad %6 %75 + OpStore %69 %81 + OpBranch %71 + %71 = OpLabel + %82 = OpLoad %6 %69 + %83 = OpExtInst %6 %1 FClamp %58 %58 %82 + OpStore %57 %83 + %85 = OpLoad %6 %57 + %87 = OpCompositeConstruct %59 %58 %58 %58 %58 + %88 = OpCompositeConstruct %59 %67 %58 %58 %67 + %89 = OpCompositeConstruct %59 %67 %67 %58 %67 + %90 = OpCompositeConstruct %59 %67 %67 %67 %85 + %91 = OpCompositeConstruct %86 %87 %88 %89 %90 + %92 = OpExtInst %6 %1 Determinant %91 + OpStore %84 %92 + %94 = OpLoad %6 %13 + %95 = OpLoad %6 %84 + %96 = OpFDiv %6 %94 %95 + %99 = OpCompositeConstruct %97 %96 %67 %67 + %100 = OpCompositeConstruct %97 %67 %67 %67 + %101 = OpCompositeConstruct %97 %67 %58 %58 + %102 = OpCompositeConstruct %97 %58 %67 %58 + %103 = OpCompositeConstruct %98 %99 %100 %101 %102 + %104 = OpCompositeExtract %6 %103 0 0 + OpStore %93 %104 + %105 = OpLoad %6 %93 + OpReturnValue %105 + %56 = OpLabel + OpBranch %22 + %22 = OpLabel + %107 = OpLoad %15 %17 + %108 = OpIAdd %15 %107 %18 + OpStore %17 %108 + OpBranch %19 + %21 = OpLabel + %109 = OpLoad %6 %13 + OpReturnValue %109 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 STD140 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true.amber b/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true.amber new file mode 100644 index 0000000..91c360f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true.amber @@ -0,0 +1,661 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with an always true conditional + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# float compute_value(float limit, float thirty_two) +# { +# float result = -0.5; +# for (int i = 1; i < 800; i++) +# { +# if ((i % 32) == 0) +# { +# result += 0.4; +# } +# else +# { +# if (mod(float(i), round(thirty_two)) <= 0.01) +# { +# result += 100.0; +# } +# } +# if (float(i) >= limit) +# { +# return result; +# } +# } +# return result; +# } +# void main() +# { +# vec3 c = vec3(7.0, 8.0, 9.0); +# float thirty_two = round(resolution.x / 8.0); +# c.x = compute_value(gl_FragCoord.x, thirty_two); +# c.y = compute_value(gl_FragCoord.y, thirty_two); +# c.z = c.x + c.y; +# for (int i = 0; i < 3; i++) +# { +# if (c[i] >= 1.0) +# { +# c[i] = c[i] * c[i]; +# } +# } +# _GLF_color = vec4(normalize(abs(c)), 1.0); +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 145 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %137 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "compute_value(f1;f1;" + OpName %9 "limit" + OpName %10 "thirty_two" + OpName %13 "result" + OpName %17 "i" + OpName %66 "c" + OpName %71 "thirty_two" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %86 "param" + OpName %90 "param" + OpName %94 "param" + OpName %98 "param" + OpName %109 "i" + OpName %137 "_GLF_color" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpDecorate %137 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 %7 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %16 = OpTypePointer Function %15 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %107 = OpConstant %76 2 + %116 = OpConstant %15 3 + %121 = OpConstant %6 1 + %136 = OpTypePointer Output %83 + %137 = OpVariable %136 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + %71 = OpVariable %7 Function + %86 = OpVariable %7 Function + %90 = OpVariable %7 Function + %94 = OpVariable %7 Function + %98 = OpVariable %7 Function + %109 = OpVariable %16 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %81 = OpFDiv %6 %80 %68 + %82 = OpExtInst %6 %1 Round %81 + OpStore %71 %82 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpStore %86 %89 + %91 = OpLoad %6 %71 + OpStore %90 %91 + %92 = OpFunctionCall %6 %11 %86 %90 + %93 = OpAccessChain %7 %66 %77 + OpStore %93 %92 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpStore %94 %97 + %99 = OpLoad %6 %71 + OpStore %98 %99 + %100 = OpFunctionCall %6 %11 %94 %98 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %100 + %102 = OpAccessChain %7 %66 %77 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %7 %66 %95 + %105 = OpLoad %6 %104 + %106 = OpFAdd %6 %103 %105 + %108 = OpAccessChain %7 %66 %107 + OpStore %108 %106 + OpStore %109 %31 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %115 = OpLoad %15 %109 + %117 = OpSLessThan %26 %115 %116 + OpBranchConditional %117 %111 %112 + %111 = OpLabel + %118 = OpLoad %15 %109 + %119 = OpAccessChain %7 %66 %118 + %120 = OpLoad %6 %119 + %122 = OpFOrdGreaterThanEqual %26 %120 %121 + OpSelectionMerge %124 None + OpBranchConditional %122 %123 %124 + %123 = OpLabel + %125 = OpLoad %15 %109 + %126 = OpLoad %15 %109 + %127 = OpAccessChain %7 %66 %126 + %128 = OpLoad %6 %127 + %129 = OpLoad %15 %109 + %130 = OpAccessChain %7 %66 %129 + %131 = OpLoad %6 %130 + %132 = OpFMul %6 %128 %131 + %133 = OpAccessChain %7 %66 %125 + OpStore %133 %132 + OpBranch %124 + %124 = OpLabel + OpBranch %113 + %113 = OpLabel + %134 = OpLoad %15 %109 + %135 = OpIAdd %15 %134 %18 + OpStore %109 %135 + OpBranch %110 + %112 = OpLabel + %138 = OpLoad %64 %66 + %139 = OpExtInst %64 %1 FAbs %138 + %140 = OpExtInst %64 %1 Normalize %139 + %141 = OpCompositeExtract %6 %140 0 + %142 = OpCompositeExtract %6 %140 1 + %143 = OpCompositeExtract %6 %140 2 + %144 = OpCompositeConstruct %83 %141 %142 %143 %121 + OpStore %137 %144 + OpReturn + OpFunctionEnd + %11 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %13 = OpVariable %7 Function + %17 = OpVariable %16 Function + OpStore %13 %14 + OpStore %17 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %15 %17 + %27 = OpSLessThan %26 %24 %25 + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %28 = OpLoad %15 %17 + %30 = OpSMod %15 %28 %29 + %32 = OpIEqual %26 %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %38 + %33 = OpLabel + %36 = OpLoad %6 %13 + %37 = OpFAdd %6 %36 %35 + OpStore %13 %37 + OpBranch %34 + %38 = OpLabel + %39 = OpLoad %15 %17 + %40 = OpConvertSToF %6 %39 + %41 = OpLoad %6 %10 + %42 = OpExtInst %6 %1 Round %41 + %43 = OpFMod %6 %40 %42 + %45 = OpFOrdLessThanEqual %26 %43 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + %49 = OpLoad %6 %13 + %50 = OpFAdd %6 %49 %48 + OpStore %13 %50 + OpBranch %47 + %47 = OpLabel + OpBranch %34 + %34 = OpLabel + %51 = OpLoad %15 %17 + %52 = OpConvertSToF %6 %51 + %53 = OpLoad %6 %9 + %54 = OpFOrdGreaterThanEqual %26 %52 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + %57 = OpLoad %6 %13 + OpReturnValue %57 + %56 = OpLabel + OpBranch %22 + %22 = OpLabel + %59 = OpLoad %15 %17 + %60 = OpIAdd %15 %59 %18 + OpStore %17 %60 + OpBranch %19 + %21 = OpLabel + %61 = OpLoad %6 %13 + OpReturnValue %61 + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# layout(set = 0, binding = 1) uniform buf1 +# { +# highp vec2 injectionSwitch; +# }; +# float compute_value(float limit, float thirty_two) +# { +# float result = -0.5; +# for (int i = 1; i < 800; i++) +# { +# if ((i % 32) == 0) +# { +# result += 0.4; +# } +# else +# { +# if (mod(float(i), round(thirty_two)) <= 0.01) +# { +# result += 100.0; +# } +# } +# if (float(i) >= limit) +# { +# return result; +# } +# } +# return result; +# } +# void main() +# { +# vec3 c = vec3(7.0, 8.0, 9.0); +# float thirty_two = round(resolution.x / 8.0); +# c.x = compute_value(gl_FragCoord.x, thirty_two); +# c.y = compute_value(gl_FragCoord.y, thirty_two); +# c.z = c.x + c.y; +# for (int i = 0; i < 3; i++) +# { +# if (c[i] >= 1.0) +# { +# c[i] = c[i] * c[i]; +# } +# } +# // Conditional statement always returns absolute value of vec3 c. +# // The end result should be the same as in reference shader. +# _GLF_color = vec4(normalize(((injectionSwitch.x < injectionSwitch.y) ? abs(c) : c)), 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 159 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %137 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "compute_value(f1;f1;" + OpName %9 "limit" + OpName %10 "thirty_two" + OpName %13 "result" + OpName %17 "i" + OpName %66 "c" + OpName %71 "thirty_two" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %86 "param" + OpName %90 "param" + OpName %94 "param" + OpName %98 "param" + OpName %109 "i" + OpName %137 "_GLF_color" + OpName %138 "buf1" + OpMemberName %138 0 "injectionSwitch" + OpName %140 "" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpDecorate %137 Location 0 + OpMemberDecorate %138 0 Offset 0 + OpDecorate %138 Block + OpDecorate %140 DescriptorSet 0 + OpDecorate %140 Binding 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 %7 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %16 = OpTypePointer Function %15 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %107 = OpConstant %76 2 + %116 = OpConstant %15 3 + %121 = OpConstant %6 1 + %136 = OpTypePointer Output %83 + %137 = OpVariable %136 Output + %138 = OpTypeStruct %72 + %139 = OpTypePointer Uniform %138 + %140 = OpVariable %139 Uniform + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + %71 = OpVariable %7 Function + %86 = OpVariable %7 Function + %90 = OpVariable %7 Function + %94 = OpVariable %7 Function + %98 = OpVariable %7 Function + %109 = OpVariable %16 Function + %146 = OpVariable %65 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %81 = OpFDiv %6 %80 %68 + %82 = OpExtInst %6 %1 Round %81 + OpStore %71 %82 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpStore %86 %89 + %91 = OpLoad %6 %71 + OpStore %90 %91 + %92 = OpFunctionCall %6 %11 %86 %90 + %93 = OpAccessChain %7 %66 %77 + OpStore %93 %92 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpStore %94 %97 + %99 = OpLoad %6 %71 + OpStore %98 %99 + %100 = OpFunctionCall %6 %11 %94 %98 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %100 + %102 = OpAccessChain %7 %66 %77 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %7 %66 %95 + %105 = OpLoad %6 %104 + %106 = OpFAdd %6 %103 %105 + %108 = OpAccessChain %7 %66 %107 + OpStore %108 %106 + OpStore %109 %31 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %115 = OpLoad %15 %109 + %117 = OpSLessThan %26 %115 %116 + OpBranchConditional %117 %111 %112 + %111 = OpLabel + %118 = OpLoad %15 %109 + %119 = OpAccessChain %7 %66 %118 + %120 = OpLoad %6 %119 + %122 = OpFOrdGreaterThanEqual %26 %120 %121 + OpSelectionMerge %124 None + OpBranchConditional %122 %123 %124 + %123 = OpLabel + %125 = OpLoad %15 %109 + %126 = OpLoad %15 %109 + %127 = OpAccessChain %7 %66 %126 + %128 = OpLoad %6 %127 + %129 = OpLoad %15 %109 + %130 = OpAccessChain %7 %66 %129 + %131 = OpLoad %6 %130 + %132 = OpFMul %6 %128 %131 + %133 = OpAccessChain %7 %66 %125 + OpStore %133 %132 + OpBranch %124 + %124 = OpLabel + OpBranch %113 + %113 = OpLabel + %134 = OpLoad %15 %109 + %135 = OpIAdd %15 %134 %18 + OpStore %109 %135 + OpBranch %110 + %112 = OpLabel + %141 = OpAccessChain %78 %140 %31 %77 + %142 = OpLoad %6 %141 + %143 = OpAccessChain %78 %140 %31 %95 + %144 = OpLoad %6 %143 + %145 = OpFOrdLessThan %26 %142 %144 + OpSelectionMerge %148 None + OpBranchConditional %145 %147 %151 + %147 = OpLabel + %149 = OpLoad %64 %66 + %150 = OpExtInst %64 %1 FAbs %149 + OpStore %146 %150 + OpBranch %148 + %151 = OpLabel + %152 = OpLoad %64 %66 + OpStore %146 %152 + OpBranch %148 + %148 = OpLabel + %153 = OpLoad %64 %146 + %154 = OpExtInst %64 %1 Normalize %153 + %155 = OpCompositeExtract %6 %154 0 + %156 = OpCompositeExtract %6 %154 1 + %157 = OpCompositeExtract %6 %154 2 + %158 = OpCompositeConstruct %83 %155 %156 %157 %121 + OpStore %137 %158 + OpReturn + OpFunctionEnd + %11 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %13 = OpVariable %7 Function + %17 = OpVariable %16 Function + OpStore %13 %14 + OpStore %17 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %15 %17 + %27 = OpSLessThan %26 %24 %25 + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %28 = OpLoad %15 %17 + %30 = OpSMod %15 %28 %29 + %32 = OpIEqual %26 %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %38 + %33 = OpLabel + %36 = OpLoad %6 %13 + %37 = OpFAdd %6 %36 %35 + OpStore %13 %37 + OpBranch %34 + %38 = OpLabel + %39 = OpLoad %15 %17 + %40 = OpConvertSToF %6 %39 + %41 = OpLoad %6 %10 + %42 = OpExtInst %6 %1 Round %41 + %43 = OpFMod %6 %40 %42 + %45 = OpFOrdLessThanEqual %26 %43 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + %49 = OpLoad %6 %13 + %50 = OpFAdd %6 %49 %48 + OpStore %13 %50 + OpBranch %47 + %47 = OpLabel + OpBranch %34 + %34 = OpLabel + %51 = OpLoad %15 %17 + %52 = OpConvertSToF %6 %51 + %53 = OpLoad %6 %9 + %54 = OpFOrdGreaterThanEqual %26 %52 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + %57 = OpLoad %6 %13 + OpReturnValue %57 + %56 = OpLabel + OpBranch %22 + %22 = OpLabel + %59 = OpLoad %15 %17 + %60 = OpIAdd %15 %59 %18 + OpStore %17 %60 + OpBranch %19 + %21 = OpLabel + %61 = OpLoad %6 %13 + OpReturnValue %61 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1.amber b/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1.amber new file mode 100644 index 0000000..b59a51b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1.amber @@ -0,0 +1,626 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with true conditional divided by 1 + +# The test passes because both shaders render the same image. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-local-multi-store' +# '--combine-access-chains' +# '--copy-propagate-arrays' +# '--scalar-replacement=100' +# '--eliminate-dead-code-aggressive' +# '--inline-entry-points-exhaustive' +# '--private-to-local' +# '--eliminate-dead-branches' +# '--eliminate-dead-inserts' +# '--vector-dce' +# '--simplify-instructions' +# '--vector-dce' +# '--eliminate-local-single-block' +# '--eliminate-local-single-block' +# '--private-to-local' +# '--combine-access-chains' +# '--reduce-load-size' +# '--ccp' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--vector-dce' +# '--eliminate-local-single-store' +# '--redundancy-elimination' +# '--inline-entry-points-exhaustive' +# '--reduce-load-size' +# '--simplify-instructions' +# '--eliminate-dead-inserts' +# '--eliminate-dead-code-aggressive' +# '--if-conversion' +# '--eliminate-dead-inserts' +# spirv-opt commit hash: 7afbc0c8be3f4dd48a7e521deb18f5c29a6c9892 + + + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# float compute_value(float limit, float thirty_two) +# { +# float result = -0.5; +# for (int i = 1; i < 800; i++) +# { +# if ((i % 32) == 0) +# { +# result += 0.4; +# } +# else +# { +# if (mod(float(i), round(thirty_two)) <= 0.01) +# { +# result += 100.0; +# } +# } +# if (float(i) >= limit) +# { +# return result; +# } +# } +# return result; +# } +# void main() +# { +# vec3 c = vec3(7.0, 8.0, 9.0); +# float thirty_two = round(resolution.x / 8.0); +# c.x = compute_value(gl_FragCoord.x, thirty_two); +# c.y = compute_value(gl_FragCoord.y, thirty_two); +# c.z = c.x + c.y; +# for (int i = 0; i < 3; i++) +# { +# if (c[i] >= 1.0) +# { +# c[i] = c[i] * c[i]; +# } +# } +# _GLF_color = vec4(normalize(abs(c)), 1.0); +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 154 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %137 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "compute_value(f1;f1;" + OpName %9 "limit" + OpName %10 "thirty_two" + OpName %66 "c" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %86 "param" + OpName %90 "param" + OpName %94 "param" + OpName %98 "param" + OpName %137 "_GLF_color" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpDecorate %137 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 %7 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %107 = OpConstant %76 2 + %116 = OpConstant %15 3 + %121 = OpConstant %6 1 + %136 = OpTypePointer Output %83 + %137 = OpVariable %136 Output + %153 = OpConstant %6 0.125 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + %86 = OpVariable %7 Function + %90 = OpVariable %7 Function + %94 = OpVariable %7 Function + %98 = OpVariable %7 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %81 = OpFMul %6 %80 %153 + %82 = OpExtInst %6 %1 Round %81 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpStore %86 %89 + OpStore %90 %82 + %92 = OpFunctionCall %6 %11 %86 %90 + %93 = OpAccessChain %7 %66 %77 + OpStore %93 %92 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpStore %94 %97 + OpStore %98 %82 + %100 = OpFunctionCall %6 %11 %94 %98 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %100 + %103 = OpLoad %6 %93 + %105 = OpLoad %6 %101 + %106 = OpFAdd %6 %103 %105 + %108 = OpAccessChain %7 %66 %107 + OpStore %108 %106 + OpBranch %110 + %110 = OpLabel + %145 = OpPhi %15 %31 %5 %135 %113 + %117 = OpSLessThan %26 %145 %116 + OpLoopMerge %112 %113 None + OpBranchConditional %117 %111 %112 + %111 = OpLabel + %119 = OpAccessChain %7 %66 %145 + %120 = OpLoad %6 %119 + %122 = OpFOrdGreaterThanEqual %26 %120 %121 + OpSelectionMerge %124 None + OpBranchConditional %122 %123 %124 + %123 = OpLabel + %128 = OpLoad %6 %119 + %131 = OpLoad %6 %119 + %132 = OpFMul %6 %128 %131 + OpStore %119 %132 + OpBranch %124 + %124 = OpLabel + OpBranch %113 + %113 = OpLabel + %135 = OpIAdd %15 %145 %18 + OpBranch %110 + %112 = OpLabel + %138 = OpLoad %64 %66 + %139 = OpExtInst %64 %1 FAbs %138 + %140 = OpExtInst %64 %1 Normalize %139 + %141 = OpCompositeExtract %6 %140 0 + %142 = OpCompositeExtract %6 %140 1 + %143 = OpCompositeExtract %6 %140 2 + %144 = OpCompositeConstruct %83 %141 %142 %143 %121 + OpStore %137 %144 + OpReturn + OpFunctionEnd + %11 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + OpBranch %19 + %19 = OpLabel + %148 = OpPhi %6 %14 %12 %151 %22 + %147 = OpPhi %15 %18 %12 %60 %22 + %27 = OpSLessThan %26 %147 %25 + OpLoopMerge %21 %22 None + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %30 = OpSMod %15 %147 %29 + %32 = OpIEqual %26 %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %38 + %33 = OpLabel + %37 = OpFAdd %6 %148 %35 + OpBranch %34 + %38 = OpLabel + %40 = OpConvertSToF %6 %147 + %41 = OpLoad %6 %10 + %42 = OpExtInst %6 %1 Round %41 + %43 = OpFMod %6 %40 %42 + %45 = OpFOrdLessThanEqual %26 %43 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + %50 = OpFAdd %6 %148 %48 + OpBranch %47 + %47 = OpLabel + %152 = OpPhi %6 %148 %38 %50 %46 + OpBranch %34 + %34 = OpLabel + %151 = OpPhi %6 %37 %33 %152 %47 + %52 = OpConvertSToF %6 %147 + %53 = OpLoad %6 %9 + %54 = OpFOrdGreaterThanEqual %26 %52 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + OpReturnValue %151 + %56 = OpLabel + OpBranch %22 + %22 = OpLabel + %60 = OpIAdd %15 %147 %18 + OpBranch %19 + %21 = OpLabel + OpReturnValue %148 + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 injectionSwitch; //x == 0.0, y == 1.0 +# }; +# +# float compute_value(float limit, float thirty_two) +# { +# float result = -0.5; +# for (int i = 1; i < 800; i++) +# { +# if ((i % 32) == 0) +# { +# result += 0.4; +# } +# else +# { +# if (mod(float(i), round(thirty_two)) <= 0.01) +# { +# result += 100.0; +# } +# } +# if (float(i) >= limit) +# { +# return result; +# } +# } +# return result; +# } +# void main() +# { +# vec3 c = vec3(7.0, 8.0, 9.0); +# float thirty_two = round(resolution.x / 8.0); +# c.x = compute_value(gl_FragCoord.x, thirty_two); +# c.y = compute_value(gl_FragCoord.y, thirty_two); +# // Always true, x / 1 = x, end result should be same as the reference result. +# c.z = c.x + (true ? ((c) / 1.0) : (vec3(1.0))).y; +# for (int i = 0; i < 3; i++) +# { +# if (c[i] >= 1.0) +# { +# // Always false. +# if ((injectionSwitch.x > injectionSwitch.y)) +# { +# discard; +# } +# c[i] = c[i] * c[i]; +# } +# } +# _GLF_color = vec4(normalize(abs(c)), 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 174 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %157 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "compute_value(f1;f1;" + OpName %9 "limit" + OpName %10 "thirty_two" + OpName %66 "c" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %86 "param" + OpName %90 "param" + OpName %94 "param" + OpName %98 "param" + OpName %134 "buf1" + OpMemberName %134 0 "injectionSwitch" + OpName %136 "" + OpName %157 "_GLF_color" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpMemberDecorate %134 0 Offset 0 + OpDecorate %134 Block + OpDecorate %136 DescriptorSet 0 + OpDecorate %136 Binding 1 + OpDecorate %157 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 %7 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %109 = OpConstant %6 1 + %117 = OpConstant %76 2 + %126 = OpConstant %15 3 + %134 = OpTypeStruct %72 + %135 = OpTypePointer Uniform %134 + %136 = OpVariable %135 Uniform + %156 = OpTypePointer Output %83 + %157 = OpVariable %156 Output + %173 = OpConstant %6 0.125 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + %86 = OpVariable %7 Function + %90 = OpVariable %7 Function + %94 = OpVariable %7 Function + %98 = OpVariable %7 Function + %105 = OpVariable %65 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %81 = OpFMul %6 %80 %173 + %82 = OpExtInst %6 %1 Round %81 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpStore %86 %89 + OpStore %90 %82 + %92 = OpFunctionCall %6 %11 %86 %90 + %93 = OpAccessChain %7 %66 %77 + OpStore %93 %92 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpStore %94 %97 + OpStore %98 %82 + %100 = OpFunctionCall %6 %11 %94 %98 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %100 + %103 = OpLoad %6 %93 + %108 = OpLoad %64 %66 + OpStore %105 %108 + %114 = OpAccessChain %7 %105 %95 + %115 = OpLoad %6 %114 + %116 = OpFAdd %6 %103 %115 + %118 = OpAccessChain %7 %66 %117 + OpStore %118 %116 + OpBranch %120 + %120 = OpLabel + %165 = OpPhi %15 %31 %5 %155 %123 + %127 = OpSLessThan %26 %165 %126 + OpLoopMerge %122 %123 None + OpBranchConditional %127 %121 %122 + %121 = OpLabel + %129 = OpAccessChain %7 %66 %165 + %130 = OpLoad %6 %129 + %131 = OpFOrdGreaterThanEqual %26 %130 %109 + OpSelectionMerge %133 None + OpBranchConditional %131 %132 %133 + %132 = OpLabel + %137 = OpAccessChain %78 %136 %31 %77 + %138 = OpLoad %6 %137 + %139 = OpAccessChain %78 %136 %31 %95 + %140 = OpLoad %6 %139 + %141 = OpFOrdGreaterThan %26 %138 %140 + OpSelectionMerge %143 None + OpBranchConditional %141 %142 %143 + %142 = OpLabel + OpTerminateInvocation + %143 = OpLabel + %148 = OpLoad %6 %129 + %151 = OpLoad %6 %129 + %152 = OpFMul %6 %148 %151 + OpStore %129 %152 + OpBranch %133 + %133 = OpLabel + OpBranch %123 + %123 = OpLabel + %155 = OpIAdd %15 %165 %18 + OpBranch %120 + %122 = OpLabel + %158 = OpLoad %64 %66 + %159 = OpExtInst %64 %1 FAbs %158 + %160 = OpExtInst %64 %1 Normalize %159 + %161 = OpCompositeExtract %6 %160 0 + %162 = OpCompositeExtract %6 %160 1 + %163 = OpCompositeExtract %6 %160 2 + %164 = OpCompositeConstruct %83 %161 %162 %163 %109 + OpStore %157 %164 + OpReturn + OpFunctionEnd + %11 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + OpBranch %19 + %19 = OpLabel + %168 = OpPhi %6 %14 %12 %171 %22 + %167 = OpPhi %15 %18 %12 %60 %22 + %27 = OpSLessThan %26 %167 %25 + OpLoopMerge %21 %22 None + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %30 = OpSMod %15 %167 %29 + %32 = OpIEqual %26 %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %38 + %38 = OpLabel + %40 = OpConvertSToF %6 %167 + %41 = OpLoad %6 %10 + %42 = OpExtInst %6 %1 Round %41 + %43 = OpFMod %6 %40 %42 + %45 = OpFOrdLessThanEqual %26 %43 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + %50 = OpFAdd %6 %168 %48 + OpBranch %47 + %47 = OpLabel + %172 = OpPhi %6 %168 %38 %50 %46 + OpBranch %34 + %33 = OpLabel + %37 = OpFAdd %6 %168 %35 + OpBranch %34 + %34 = OpLabel + %171 = OpPhi %6 %37 %33 %172 %47 + %52 = OpConvertSToF %6 %167 + %53 = OpLoad %6 %9 + %54 = OpFOrdGreaterThanEqual %26 %52 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + OpReturnValue %171 + %56 = OpLabel + OpBranch %22 + %22 = OpLabel + %60 = OpIAdd %15 %167 %18 + OpBranch %19 + %21 = OpLabel + OpReturnValue %168 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop.amber b/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop.amber new file mode 100644 index 0000000..88c6e03 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop.amber @@ -0,0 +1,702 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with conditional and simple loop + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# float compute_value(float limit, float thirty_two) +# { +# float result = -0.5; +# for (int i = 1; i < 800; i++) +# { +# if ((i % 32) == 0) +# { +# result += 0.4; +# } +# else +# { +# if (mod(float(i), round(thirty_two)) <= 0.01) +# { +# result += 100.0; +# } +# } +# if (float(i) >= limit) +# { +# return result; +# } +# } +# return result; +# } +# void main() +# { +# vec3 c = vec3(7.0, 8.0, 9.0); +# float thirty_two = round(resolution.x / 8.0); +# c.x = compute_value(gl_FragCoord.x, thirty_two); +# c.y = compute_value(gl_FragCoord.y, thirty_two); +# c.z = c.x + c.y; +# for (int i = 0; i < 3; i++) +# { +# if (c[i] >= 1.0) +# { +# c[i] = c[i] * c[i]; +# } +# } +# _GLF_color = vec4(normalize(abs(c)), 1.0); +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 145 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %137 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "compute_value(f1;f1;" + OpName %9 "limit" + OpName %10 "thirty_two" + OpName %13 "result" + OpName %17 "i" + OpName %66 "c" + OpName %71 "thirty_two" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %86 "param" + OpName %90 "param" + OpName %94 "param" + OpName %98 "param" + OpName %109 "i" + OpName %137 "_GLF_color" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpDecorate %137 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 %7 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %16 = OpTypePointer Function %15 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %107 = OpConstant %76 2 + %116 = OpConstant %15 3 + %121 = OpConstant %6 1 + %136 = OpTypePointer Output %83 + %137 = OpVariable %136 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + %71 = OpVariable %7 Function + %86 = OpVariable %7 Function + %90 = OpVariable %7 Function + %94 = OpVariable %7 Function + %98 = OpVariable %7 Function + %109 = OpVariable %16 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %81 = OpFDiv %6 %80 %68 + %82 = OpExtInst %6 %1 Round %81 + OpStore %71 %82 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpStore %86 %89 + %91 = OpLoad %6 %71 + OpStore %90 %91 + %92 = OpFunctionCall %6 %11 %86 %90 + %93 = OpAccessChain %7 %66 %77 + OpStore %93 %92 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpStore %94 %97 + %99 = OpLoad %6 %71 + OpStore %98 %99 + %100 = OpFunctionCall %6 %11 %94 %98 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %100 + %102 = OpAccessChain %7 %66 %77 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %7 %66 %95 + %105 = OpLoad %6 %104 + %106 = OpFAdd %6 %103 %105 + %108 = OpAccessChain %7 %66 %107 + OpStore %108 %106 + OpStore %109 %31 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %115 = OpLoad %15 %109 + %117 = OpSLessThan %26 %115 %116 + OpBranchConditional %117 %111 %112 + %111 = OpLabel + %118 = OpLoad %15 %109 + %119 = OpAccessChain %7 %66 %118 + %120 = OpLoad %6 %119 + %122 = OpFOrdGreaterThanEqual %26 %120 %121 + OpSelectionMerge %124 None + OpBranchConditional %122 %123 %124 + %123 = OpLabel + %125 = OpLoad %15 %109 + %126 = OpLoad %15 %109 + %127 = OpAccessChain %7 %66 %126 + %128 = OpLoad %6 %127 + %129 = OpLoad %15 %109 + %130 = OpAccessChain %7 %66 %129 + %131 = OpLoad %6 %130 + %132 = OpFMul %6 %128 %131 + %133 = OpAccessChain %7 %66 %125 + OpStore %133 %132 + OpBranch %124 + %124 = OpLabel + OpBranch %113 + %113 = OpLabel + %134 = OpLoad %15 %109 + %135 = OpIAdd %15 %134 %18 + OpStore %109 %135 + OpBranch %110 + %112 = OpLabel + %138 = OpLoad %64 %66 + %139 = OpExtInst %64 %1 FAbs %138 + %140 = OpExtInst %64 %1 Normalize %139 + %141 = OpCompositeExtract %6 %140 0 + %142 = OpCompositeExtract %6 %140 1 + %143 = OpCompositeExtract %6 %140 2 + %144 = OpCompositeConstruct %83 %141 %142 %143 %121 + OpStore %137 %144 + OpReturn + OpFunctionEnd + %11 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %13 = OpVariable %7 Function + %17 = OpVariable %16 Function + OpStore %13 %14 + OpStore %17 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %15 %17 + %27 = OpSLessThan %26 %24 %25 + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %28 = OpLoad %15 %17 + %30 = OpSMod %15 %28 %29 + %32 = OpIEqual %26 %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %38 + %33 = OpLabel + %36 = OpLoad %6 %13 + %37 = OpFAdd %6 %36 %35 + OpStore %13 %37 + OpBranch %34 + %38 = OpLabel + %39 = OpLoad %15 %17 + %40 = OpConvertSToF %6 %39 + %41 = OpLoad %6 %10 + %42 = OpExtInst %6 %1 Round %41 + %43 = OpFMod %6 %40 %42 + %45 = OpFOrdLessThanEqual %26 %43 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + %49 = OpLoad %6 %13 + %50 = OpFAdd %6 %49 %48 + OpStore %13 %50 + OpBranch %47 + %47 = OpLabel + OpBranch %34 + %34 = OpLabel + %51 = OpLoad %15 %17 + %52 = OpConvertSToF %6 %51 + %53 = OpLoad %6 %9 + %54 = OpFOrdGreaterThanEqual %26 %52 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + %57 = OpLoad %6 %13 + OpReturnValue %57 + %56 = OpLabel + OpBranch %22 + %22 = OpLabel + %59 = OpLoad %15 %17 + %60 = OpIAdd %15 %59 %18 + OpStore %17 %60 + OpBranch %19 + %21 = OpLabel + %61 = OpLoad %6 %13 + OpReturnValue %61 + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 injectionSwitch; //x == 1.0, y == 0.0 +# }; +# float compute_value(float limit, float thirty_two) +# { +# float result = -0.5; +# for (int i = 1; i < 800; i++) +# { +# if ((i % 32) == 0) +# { +# result += 0.4; +# } +# else +# { +# if (mod(float(i), round(thirty_two)) <= 0.01) +# { +# result += 100.0; +# } +# } +# if (float(i) >= limit) +# { +# return result; +# } +# } +# return result; +# } +# void main() +# { +# vec3 c = vec3(7.0, 8.0, 9.0); +# float thirty_two = round(resolution.x / 8.0); +# c.x = compute_value(gl_FragCoord.x, thirty_two); +# c.y = compute_value(gl_FragCoord.y, thirty_two); +# // Always true and result should be the same as in reference shader. +# c.z = c.x + (true ? c : c * injectionSwitch.x).y; +# for (int i = 0; i < 3; i++) +# { +# if (c[i] >= 1.0) +# { +# c[i] = c[i] * c[i]; +# } +# float j = 0.0; +# // Always true, iterates once before break. +# while (injectionSwitch.x > injectionSwitch.y) +# { +# if (j >= injectionSwitch.x) +# { +# break; +# } +# j++; +# } +# } +# _GLF_color = vec4(normalize(abs(c)), 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 179 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %171 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "compute_value(f1;f1;" + OpName %9 "limit" + OpName %10 "thirty_two" + OpName %13 "result" + OpName %17 "i" + OpName %66 "c" + OpName %71 "thirty_two" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %86 "param" + OpName %90 "param" + OpName %94 "param" + OpName %98 "param" + OpName %111 "buf1" + OpMemberName %111 0 "injectionSwitch" + OpName %113 "" + OpName %122 "i" + OpName %147 "j" + OpName %171 "_GLF_color" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpMemberDecorate %111 0 Offset 0 + OpDecorate %111 Block + OpDecorate %113 DescriptorSet 0 + OpDecorate %113 Binding 1 + OpDecorate %171 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 %7 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %16 = OpTypePointer Function %15 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %104 = OpConstantTrue %26 + %111 = OpTypeStruct %72 + %112 = OpTypePointer Uniform %111 + %113 = OpVariable %112 Uniform + %120 = OpConstant %76 2 + %129 = OpConstant %15 3 + %134 = OpConstant %6 1 + %148 = OpConstant %6 0 + %170 = OpTypePointer Output %83 + %171 = OpVariable %170 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + %71 = OpVariable %7 Function + %86 = OpVariable %7 Function + %90 = OpVariable %7 Function + %94 = OpVariable %7 Function + %98 = OpVariable %7 Function + %105 = OpVariable %65 Function + %122 = OpVariable %16 Function + %147 = OpVariable %7 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %81 = OpFDiv %6 %80 %68 + %82 = OpExtInst %6 %1 Round %81 + OpStore %71 %82 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpStore %86 %89 + %91 = OpLoad %6 %71 + OpStore %90 %91 + %92 = OpFunctionCall %6 %11 %86 %90 + %93 = OpAccessChain %7 %66 %77 + OpStore %93 %92 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpStore %94 %97 + %99 = OpLoad %6 %71 + OpStore %98 %99 + %100 = OpFunctionCall %6 %11 %94 %98 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %100 + %102 = OpAccessChain %7 %66 %77 + %103 = OpLoad %6 %102 + OpSelectionMerge %107 None + OpBranchConditional %104 %106 %109 + %106 = OpLabel + %108 = OpLoad %64 %66 + OpStore %105 %108 + OpBranch %107 + %109 = OpLabel + %110 = OpLoad %64 %66 + %114 = OpAccessChain %78 %113 %31 %77 + %115 = OpLoad %6 %114 + %116 = OpVectorTimesScalar %64 %110 %115 + OpStore %105 %116 + OpBranch %107 + %107 = OpLabel + %117 = OpAccessChain %7 %105 %95 + %118 = OpLoad %6 %117 + %119 = OpFAdd %6 %103 %118 + %121 = OpAccessChain %7 %66 %120 + OpStore %121 %119 + OpStore %122 %31 + OpBranch %123 + %123 = OpLabel + OpLoopMerge %125 %126 None + OpBranch %127 + %127 = OpLabel + %128 = OpLoad %15 %122 + %130 = OpSLessThan %26 %128 %129 + OpBranchConditional %130 %124 %125 + %124 = OpLabel + %131 = OpLoad %15 %122 + %132 = OpAccessChain %7 %66 %131 + %133 = OpLoad %6 %132 + %135 = OpFOrdGreaterThanEqual %26 %133 %134 + OpSelectionMerge %137 None + OpBranchConditional %135 %136 %137 + %136 = OpLabel + %138 = OpLoad %15 %122 + %139 = OpLoad %15 %122 + %140 = OpAccessChain %7 %66 %139 + %141 = OpLoad %6 %140 + %142 = OpLoad %15 %122 + %143 = OpAccessChain %7 %66 %142 + %144 = OpLoad %6 %143 + %145 = OpFMul %6 %141 %144 + %146 = OpAccessChain %7 %66 %138 + OpStore %146 %145 + OpBranch %137 + %137 = OpLabel + OpStore %147 %148 + OpBranch %149 + %149 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %154 = OpAccessChain %78 %113 %31 %77 + %155 = OpLoad %6 %154 + %156 = OpAccessChain %78 %113 %31 %95 + %157 = OpLoad %6 %156 + %158 = OpFOrdGreaterThan %26 %155 %157 + OpBranchConditional %158 %150 %151 + %150 = OpLabel + %159 = OpLoad %6 %147 + %160 = OpAccessChain %78 %113 %31 %77 + %161 = OpLoad %6 %160 + %162 = OpFOrdGreaterThanEqual %26 %159 %161 + OpSelectionMerge %164 None + OpBranchConditional %162 %163 %164 + %163 = OpLabel + OpBranch %151 + %164 = OpLabel + %166 = OpLoad %6 %147 + %167 = OpFAdd %6 %166 %134 + OpStore %147 %167 + OpBranch %152 + %152 = OpLabel + OpBranch %149 + %151 = OpLabel + OpBranch %126 + %126 = OpLabel + %168 = OpLoad %15 %122 + %169 = OpIAdd %15 %168 %18 + OpStore %122 %169 + OpBranch %123 + %125 = OpLabel + %172 = OpLoad %64 %66 + %173 = OpExtInst %64 %1 FAbs %172 + %174 = OpExtInst %64 %1 Normalize %173 + %175 = OpCompositeExtract %6 %174 0 + %176 = OpCompositeExtract %6 %174 1 + %177 = OpCompositeExtract %6 %174 2 + %178 = OpCompositeConstruct %83 %175 %176 %177 %134 + OpStore %171 %178 + OpReturn + OpFunctionEnd + %11 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %13 = OpVariable %7 Function + %17 = OpVariable %16 Function + OpStore %13 %14 + OpStore %17 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %15 %17 + %27 = OpSLessThan %26 %24 %25 + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %28 = OpLoad %15 %17 + %30 = OpSMod %15 %28 %29 + %32 = OpIEqual %26 %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %38 + %33 = OpLabel + %36 = OpLoad %6 %13 + %37 = OpFAdd %6 %36 %35 + OpStore %13 %37 + OpBranch %34 + %38 = OpLabel + %39 = OpLoad %15 %17 + %40 = OpConvertSToF %6 %39 + %41 = OpLoad %6 %10 + %42 = OpExtInst %6 %1 Round %41 + %43 = OpFMod %6 %40 %42 + %45 = OpFOrdLessThanEqual %26 %43 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + %49 = OpLoad %6 %13 + %50 = OpFAdd %6 %49 %48 + OpStore %13 %50 + OpBranch %47 + %47 = OpLabel + OpBranch %34 + %34 = OpLabel + %51 = OpLoad %15 %17 + %52 = OpConvertSToF %6 %51 + %53 = OpLoad %6 %9 + %54 = OpFOrdGreaterThanEqual %26 %52 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + %57 = OpLoad %6 %13 + OpReturnValue %57 + %56 = OpLabel + OpBranch %22 + %22 = OpLabel + %59 = OpLoad %15 %17 + %60 = OpIAdd %15 %59 %18 + OpStore %17 %60 + OpBranch %19 + %21 = OpLabel + %61 = OpLoad %6 %13 + OpReturnValue %61 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 1.0 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix.amber b/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix.amber new file mode 100644 index 0000000..5dbc1b1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix.amber @@ -0,0 +1,663 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with vec3 values set from matrix4x2 + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# +# float compute_value(float limit, float thirty_two) +# { +# float result = -0.5; +# for (int i = 1; i < 800; i++) +# { +# if ((i % 32) == 0) +# { +# result += 0.4; +# } +# else +# { +# if (mod(float(i), round(thirty_two)) <= 0.01) +# { +# result += 100.0; +# } +# } +# if (float(i) >= limit) +# { +# return result; +# } +# } +# return result; +# } +# +# void main() +# { +# vec3 c = vec3(7.0, 8.0, 9.0); +# float thirty_two = round(resolution.x / 8.0); +# c.x = compute_value(gl_FragCoord.x, thirty_two); +# c.y = compute_value(gl_FragCoord.y, thirty_two); +# c.z = c.x + c.y; +# for (int i = 0; i < 3; i++) +# { +# if (c[i] >= 1.0) +# { +# c[i] = c[i] * c[i]; +# } +# } +# _GLF_color = vec4(normalize(abs(c)), 1.0); +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 145 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %137 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "compute_value(f1;f1;" + OpName %9 "limit" + OpName %10 "thirty_two" + OpName %13 "result" + OpName %17 "i" + OpName %66 "c" + OpName %71 "thirty_two" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %86 "param" + OpName %90 "param" + OpName %94 "param" + OpName %98 "param" + OpName %109 "i" + OpName %137 "_GLF_color" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpDecorate %137 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 %7 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %16 = OpTypePointer Function %15 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %107 = OpConstant %76 2 + %116 = OpConstant %15 3 + %121 = OpConstant %6 1 + %136 = OpTypePointer Output %83 + %137 = OpVariable %136 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + %71 = OpVariable %7 Function + %86 = OpVariable %7 Function + %90 = OpVariable %7 Function + %94 = OpVariable %7 Function + %98 = OpVariable %7 Function + %109 = OpVariable %16 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %81 = OpFDiv %6 %80 %68 + %82 = OpExtInst %6 %1 Round %81 + OpStore %71 %82 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpStore %86 %89 + %91 = OpLoad %6 %71 + OpStore %90 %91 + %92 = OpFunctionCall %6 %11 %86 %90 + %93 = OpAccessChain %7 %66 %77 + OpStore %93 %92 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpStore %94 %97 + %99 = OpLoad %6 %71 + OpStore %98 %99 + %100 = OpFunctionCall %6 %11 %94 %98 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %100 + %102 = OpAccessChain %7 %66 %77 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %7 %66 %95 + %105 = OpLoad %6 %104 + %106 = OpFAdd %6 %103 %105 + %108 = OpAccessChain %7 %66 %107 + OpStore %108 %106 + OpStore %109 %31 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %115 = OpLoad %15 %109 + %117 = OpSLessThan %26 %115 %116 + OpBranchConditional %117 %111 %112 + %111 = OpLabel + %118 = OpLoad %15 %109 + %119 = OpAccessChain %7 %66 %118 + %120 = OpLoad %6 %119 + %122 = OpFOrdGreaterThanEqual %26 %120 %121 + OpSelectionMerge %124 None + OpBranchConditional %122 %123 %124 + %123 = OpLabel + %125 = OpLoad %15 %109 + %126 = OpLoad %15 %109 + %127 = OpAccessChain %7 %66 %126 + %128 = OpLoad %6 %127 + %129 = OpLoad %15 %109 + %130 = OpAccessChain %7 %66 %129 + %131 = OpLoad %6 %130 + %132 = OpFMul %6 %128 %131 + %133 = OpAccessChain %7 %66 %125 + OpStore %133 %132 + OpBranch %124 + %124 = OpLabel + OpBranch %113 + %113 = OpLabel + %134 = OpLoad %15 %109 + %135 = OpIAdd %15 %134 %18 + OpStore %109 %135 + OpBranch %110 + %112 = OpLabel + %138 = OpLoad %64 %66 + %139 = OpExtInst %64 %1 FAbs %138 + %140 = OpExtInst %64 %1 Normalize %139 + %141 = OpCompositeExtract %6 %140 0 + %142 = OpCompositeExtract %6 %140 1 + %143 = OpCompositeExtract %6 %140 2 + %144 = OpCompositeConstruct %83 %141 %142 %143 %121 + OpStore %137 %144 + OpReturn + OpFunctionEnd + %11 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %13 = OpVariable %7 Function + %17 = OpVariable %16 Function + OpStore %13 %14 + OpStore %17 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %15 %17 + %27 = OpSLessThan %26 %24 %25 + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %28 = OpLoad %15 %17 + %30 = OpSMod %15 %28 %29 + %32 = OpIEqual %26 %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %38 + %33 = OpLabel + %36 = OpLoad %6 %13 + %37 = OpFAdd %6 %36 %35 + OpStore %13 %37 + OpBranch %34 + %38 = OpLabel + %39 = OpLoad %15 %17 + %40 = OpConvertSToF %6 %39 + %41 = OpLoad %6 %10 + %42 = OpExtInst %6 %1 Round %41 + %43 = OpFMod %6 %40 %42 + %45 = OpFOrdLessThanEqual %26 %43 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + %49 = OpLoad %6 %13 + %50 = OpFAdd %6 %49 %48 + OpStore %13 %50 + OpBranch %47 + %47 = OpLabel + OpBranch %34 + %34 = OpLabel + %51 = OpLoad %15 %17 + %52 = OpConvertSToF %6 %51 + %53 = OpLoad %6 %9 + %54 = OpFOrdGreaterThanEqual %26 %52 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + %57 = OpLoad %6 %13 + OpReturnValue %57 + %56 = OpLabel + OpBranch %22 + %22 = OpLabel + %59 = OpLoad %15 %17 + %60 = OpIAdd %15 %59 %18 + OpStore %17 %60 + OpBranch %19 + %21 = OpLabel + %61 = OpLoad %6 %13 + OpReturnValue %61 + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# +# float compute_value(float limit, float thirty_two) +# { +# float result = -0.5; +# for (int i = 1; i < 800; i++) +# { +# if ((i % 32) == 0) +# { +# result += 0.4; +# } +# else +# { +# if (mod(float(i), round(thirty_two)) <= 0.01) +# { +# result += 100.0; +# } +# } +# if (float(i) >= limit) +# { +# return result; +# } +# } +# return result; +# } +# +# void main() +# { +# vec3 c = vec3(7.0, 8.0, 9.0); +# float thirty_two = round(resolution.x / 8.0); +# c.x = compute_value(gl_FragCoord.x, thirty_two); +# c.y = compute_value(gl_FragCoord.y, thirty_two); +# // Line below is the same as c.z = c.x + c.y. +# // Extra calculations for c.x and c.y should not have effect on end result (compared to reference shader). +# c.z = ((c)*mat3(1.0)).x + (vec3(mat4x2(c, 1.0, exp(0.0), abs(0.0), 1.0, sqrt(0.0)))).y; +# for (int i = 0; i < 3; i++) +# { +# if (c[i] >= 1.0) +# { +# c[i] = c[i] * c[i]; +# // gl_FragCoord.y cannot be below 0.0, +# // therefore this if statement should have no effect. +# if ((gl_FragCoord.y < 0.0)) +# { +# break; +# } +# } +# } +# _GLF_color = vec4(normalize(abs(c)), 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 171 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %85 %163 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "compute_value(f1;f1;" + OpName %9 "limit" + OpName %10 "thirty_two" + OpName %13 "result" + OpName %17 "i" + OpName %66 "c" + OpName %71 "thirty_two" + OpName %73 "buf0" + OpMemberName %73 0 "resolution" + OpName %75 "" + OpName %85 "gl_FragCoord" + OpName %86 "param" + OpName %90 "param" + OpName %94 "param" + OpName %98 "param" + OpName %130 "i" + OpName %163 "_GLF_color" + OpMemberDecorate %73 0 Offset 0 + OpDecorate %73 Block + OpDecorate %75 DescriptorSet 0 + OpDecorate %75 Binding 0 + OpDecorate %85 BuiltIn FragCoord + OpDecorate %163 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 %7 + %14 = OpConstant %6 -0.5 + %15 = OpTypeInt 32 1 + %16 = OpTypePointer Function %15 + %18 = OpConstant %15 1 + %25 = OpConstant %15 800 + %26 = OpTypeBool + %29 = OpConstant %15 32 + %31 = OpConstant %15 0 + %35 = OpConstant %6 0.400000006 + %44 = OpConstant %6 0.00999999978 + %48 = OpConstant %6 100 + %64 = OpTypeVector %6 3 + %65 = OpTypePointer Function %64 + %67 = OpConstant %6 7 + %68 = OpConstant %6 8 + %69 = OpConstant %6 9 + %70 = OpConstantComposite %64 %67 %68 %69 + %72 = OpTypeVector %6 2 + %73 = OpTypeStruct %72 + %74 = OpTypePointer Uniform %73 + %75 = OpVariable %74 Uniform + %76 = OpTypeInt 32 0 + %77 = OpConstant %76 0 + %78 = OpTypePointer Uniform %6 + %83 = OpTypeVector %6 4 + %84 = OpTypePointer Input %83 + %85 = OpVariable %84 Input + %87 = OpTypePointer Input %6 + %95 = OpConstant %76 1 + %103 = OpTypeMatrix %64 3 + %104 = OpConstant %6 1 + %105 = OpConstant %6 0 + %106 = OpConstantComposite %64 %104 %105 %105 + %107 = OpConstantComposite %64 %105 %104 %105 + %108 = OpConstantComposite %64 %105 %105 %104 + %109 = OpConstantComposite %103 %106 %107 %108 + %113 = OpTypeMatrix %72 4 + %128 = OpConstant %76 2 + %137 = OpConstant %15 3 + %162 = OpTypePointer Output %83 + %163 = OpVariable %162 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %66 = OpVariable %65 Function + %71 = OpVariable %7 Function + %86 = OpVariable %7 Function + %90 = OpVariable %7 Function + %94 = OpVariable %7 Function + %98 = OpVariable %7 Function + %130 = OpVariable %16 Function + OpStore %66 %70 + %79 = OpAccessChain %78 %75 %31 %77 + %80 = OpLoad %6 %79 + %81 = OpFDiv %6 %80 %68 + %82 = OpExtInst %6 %1 Round %81 + OpStore %71 %82 + %88 = OpAccessChain %87 %85 %77 + %89 = OpLoad %6 %88 + OpStore %86 %89 + %91 = OpLoad %6 %71 + OpStore %90 %91 + %92 = OpFunctionCall %6 %11 %86 %90 + %93 = OpAccessChain %7 %66 %77 + OpStore %93 %92 + %96 = OpAccessChain %87 %85 %95 + %97 = OpLoad %6 %96 + OpStore %94 %97 + %99 = OpLoad %6 %71 + OpStore %98 %99 + %100 = OpFunctionCall %6 %11 %94 %98 + %101 = OpAccessChain %7 %66 %95 + OpStore %101 %100 + %102 = OpLoad %64 %66 + %110 = OpVectorTimesMatrix %64 %102 %109 + %111 = OpCompositeExtract %6 %110 0 + %112 = OpLoad %64 %66 + %114 = OpCompositeExtract %6 %112 0 + %115 = OpCompositeExtract %6 %112 1 + %116 = OpCompositeExtract %6 %112 2 + %117 = OpCompositeConstruct %72 %114 %115 + %118 = OpCompositeConstruct %72 %116 %104 + %119 = OpCompositeConstruct %72 %104 %105 + %120 = OpCompositeConstruct %72 %104 %105 + %121 = OpCompositeConstruct %113 %117 %118 %119 %120 + %122 = OpCompositeExtract %6 %121 0 0 + %123 = OpCompositeExtract %6 %121 0 1 + %124 = OpCompositeExtract %6 %121 1 0 + %125 = OpCompositeConstruct %64 %122 %123 %124 + %126 = OpCompositeExtract %6 %125 1 + %127 = OpFAdd %6 %111 %126 + %129 = OpAccessChain %7 %66 %128 + OpStore %129 %127 + OpStore %130 %31 + OpBranch %131 + %131 = OpLabel + OpLoopMerge %133 %134 None + OpBranch %135 + %135 = OpLabel + %136 = OpLoad %15 %130 + %138 = OpSLessThan %26 %136 %137 + OpBranchConditional %138 %132 %133 + %132 = OpLabel + %139 = OpLoad %15 %130 + %140 = OpAccessChain %7 %66 %139 + %141 = OpLoad %6 %140 + %142 = OpFOrdGreaterThanEqual %26 %141 %104 + OpSelectionMerge %144 None + OpBranchConditional %142 %143 %144 + %143 = OpLabel + %145 = OpLoad %15 %130 + %146 = OpLoad %15 %130 + %147 = OpAccessChain %7 %66 %146 + %148 = OpLoad %6 %147 + %149 = OpLoad %15 %130 + %150 = OpAccessChain %7 %66 %149 + %151 = OpLoad %6 %150 + %152 = OpFMul %6 %148 %151 + %153 = OpAccessChain %7 %66 %145 + OpStore %153 %152 + %154 = OpAccessChain %87 %85 %95 + %155 = OpLoad %6 %154 + %156 = OpFOrdLessThan %26 %155 %105 + OpSelectionMerge %158 None + OpBranchConditional %156 %157 %158 + %157 = OpLabel + OpBranch %133 + %158 = OpLabel + OpBranch %144 + %144 = OpLabel + OpBranch %134 + %134 = OpLabel + %160 = OpLoad %15 %130 + %161 = OpIAdd %15 %160 %18 + OpStore %130 %161 + OpBranch %131 + %133 = OpLabel + %164 = OpLoad %64 %66 + %165 = OpExtInst %64 %1 FAbs %164 + %166 = OpExtInst %64 %1 Normalize %165 + %167 = OpCompositeExtract %6 %166 0 + %168 = OpCompositeExtract %6 %166 1 + %169 = OpCompositeExtract %6 %166 2 + %170 = OpCompositeConstruct %83 %167 %168 %169 %104 + OpStore %163 %170 + OpReturn + OpFunctionEnd + %11 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %13 = OpVariable %7 Function + %17 = OpVariable %16 Function + OpStore %13 %14 + OpStore %17 %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %15 %17 + %27 = OpSLessThan %26 %24 %25 + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %28 = OpLoad %15 %17 + %30 = OpSMod %15 %28 %29 + %32 = OpIEqual %26 %30 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %38 + %33 = OpLabel + %36 = OpLoad %6 %13 + %37 = OpFAdd %6 %36 %35 + OpStore %13 %37 + OpBranch %34 + %38 = OpLabel + %39 = OpLoad %15 %17 + %40 = OpConvertSToF %6 %39 + %41 = OpLoad %6 %10 + %42 = OpExtInst %6 %1 Round %41 + %43 = OpFMod %6 %40 %42 + %45 = OpFOrdLessThanEqual %26 %43 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + %49 = OpLoad %6 %13 + %50 = OpFAdd %6 %49 %48 + OpStore %13 %50 + OpBranch %47 + %47 = OpLabel + OpBranch %34 + %34 = OpLabel + %51 = OpLoad %15 %17 + %52 = OpConvertSToF %6 %51 + %53 = OpLoad %6 %9 + %54 = OpFOrdGreaterThanEqual %26 %52 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %56 + %55 = OpLabel + %57 = OpLoad %6 %13 + OpReturnValue %57 + %56 = OpLabel + OpBranch %22 + %22 = OpLabel + %59 = OpLoad %15 %17 + %60 = OpIAdd %15 %59 %18 + OpStore %17 %60 + OpBranch %19 + %21 = OpLabel + %61 = OpLoad %6 %13 + OpReturnValue %61 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift.amber b/vulkan/amber/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift.amber new file mode 100644 index 0000000..ebee1e3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift.amber @@ -0,0 +1,1606 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: Two shaders with diff: conditional bit shift in a clamp + +# The test renders two images using semantically equivalent shaders, and then +# checks that the images are similar. +# The test passes because the shaders have the same semantics and so the images +# should be the same. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# const int N = 10; +# +# int data[10], temp[10]; +# +# void merge(int from, int mid, int to) +# { +# int k = from, i = from, j = mid + 1; +# while(i <= mid && j <= to) +# { +# if(data[i] < data[j]) +# { +# temp[k ++] = data[i ++]; +# } +# else +# { +# temp[k ++] = data[j ++]; +# } +# } +# while(i < N && i <= mid) +# { +# temp[k ++] = data[i ++]; +# } +# for(int i = from; i <= to; i ++) +# { +# data[i] = temp[i]; +# } +# } +# void mergeSort() +# { +# int low = 0; +# int high = N - 1; +# for(int m = 1; m <= high; m = 2 * m) +# { +# for(int i = low; i < high; i += 2 * m) +# { +# int from = i; +# int mid = i + m - 1; +# int to = min(i + 2 * m - 1, high); +# merge(from, mid, to); +# } +# } +# } +# void main() +# { +# int i = int(injectionSwitch.x); +# do +# { +# switch(i) +# { +# case 0: +# data[i] = 4; +# break; +# case 1: +# data[i] = 3; +# break; +# case 2: +# data[i] = 2; +# break; +# case 3: +# data[i] = 1; +# break; +# case 4: +# data[i] = 0; +# break; +# case 5: +# data[i] = - 1; +# break; +# case 6: +# data[i] = - 2; +# break; +# case 7: +# data[i] = - 3; +# break; +# case 8: +# data[i] = - 4; +# break; +# case 9: +# data[i] = - 5; +# break; +# } +# i ++; +# } +# while(i < 10); +# for(int j = 0; j < 10; j ++) +# { +# temp[j] = data[j]; +# } +# mergeSort(); +# float grey; +# if(int(gl_FragCoord[1]) < 30) +# { +# grey = 0.5 + float(data[0]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 60) +# { +# grey = 0.5 + float(data[1]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 90) +# { +# grey = 0.5 + float(data[2]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 120) +# { +# grey = 0.5 + float(data[3]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 150) +# { +# discard; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 180) +# { +# grey = 0.5 + float(data[5]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 210) +# { +# grey = 0.5 + float(data[6]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 240) +# { +# grey = 0.5 + float(data[7]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 270) +# { +# grey = 0.5 + float(data[8]) / 10.0; +# } +# else +# { +# discard; +# } +# } +# } +# } +# } +# } +# } +# } +# } +# _GLF_color = vec4(vec3(grey), 1.0); +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 378 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + %240 = OpFunctionCall %2 %14 + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %60 + %50 = OpLabel + %53 = OpLoad %6 %16 + %54 = OpIAdd %6 %53 %22 + OpStore %16 %54 + %55 = OpLoad %6 %18 + %56 = OpIAdd %6 %55 %22 + OpStore %18 %56 + %57 = OpAccessChain %43 %41 %55 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %43 %52 %53 + OpStore %59 %58 + OpBranch %51 + %60 = OpLabel + %61 = OpLoad %6 %16 + %62 = OpIAdd %6 %61 %22 + OpStore %16 %62 + %63 = OpLoad %6 %20 + %64 = OpIAdd %6 %63 %22 + OpStore %20 %64 + %65 = OpAccessChain %43 %41 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %43 %52 %61 + OpStore %67 %66 + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# injectionSwitch +BUFFER reference_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# const int N = 10; +# +# int data[10], temp[10]; +# +# void merge(int from, int mid, int to) +# { +# int k = from, i = from, j = mid + 1; +# while(i <= mid && j <= to) +# { +# if(data[i] < data[j]) +# { +# temp[k ++] = data[i ++]; +# } +# else +# { +# temp[k ++] = data[j ++]; +# } +# } +# while(i < N && i <= mid) +# { +# temp[k ++] = data[i ++]; +# } +# for(int i = from; i <= to; i ++) +# { +# data[i] = temp[i]; +# } +# } +# int func(int m, int high) +# { +# // int x == 1, bitshifted to left by 4, x == 16. +# int x = (gl_FragCoord.x >= 0.0) ? 1 << ((false ? ((high) << 0) : 4)) : 1; +# // int x == 16, bitshifted to right by 4, x == 1. +# x = x >> int(4); +# // returns 2 * m. +# return clamp(2 * m, 2 * m, (2 * m) / x); +# } +# void mergeSort() +# { +# int low = 0; +# int high = N - 1; +# for(int m = 1; m <= high; m = 2 * m) +# { +# for(int i = low; i < high; i += func(m, high)) +# { +# int from = i; +# int mid = i + m - 1; +# int to = min(i + 2 * m - 1, high); +# merge(from, mid, to); +# } +# } +# } +# void main() +# { +# int i = int(injectionSwitch.x); +# do +# { +# switch(i) +# { +# case 0: +# data[i] = 4; +# break; +# case 1: +# data[i] = 3; +# break; +# case 2: +# data[i] = 2; +# break; +# case 3: +# data[i] = 1; +# break; +# case 4: +# data[i] = 0; +# break; +# case 5: +# data[i] = - 1; +# break; +# case 6: +# data[i] = - 2; +# break; +# case 7: +# data[i] = - 3; +# break; +# case 8: +# data[i] = - 4; +# break; +# case 9: +# data[i] = - 5; +# break; +# } +# i ++; +# } +# while(i < 10); +# for(int j = 0; j < 10; j ++) +# { +# temp[j] = data[j]; +# } +# mergeSort(); +# float grey; +# if(int(gl_FragCoord[1]) < 30) +# { +# grey = 0.5 + float(data[0]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 60) +# { +# grey = 0.5 + float(data[1]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 90) +# { +# grey = 0.5 + float(data[2]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 120) +# { +# grey = 0.5 + float(data[3]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 150) +# { +# discard; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 180) +# { +# grey = 0.5 + float(data[5]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 210) +# { +# grey = 0.5 + float(data[6]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 240) +# { +# grey = 0.5 + float(data[7]) / 10.0; +# } +# else +# { +# if(int(gl_FragCoord[1]) < 270) +# { +# grey = 0.5 + float(data[8]) / 10.0; +# } +# else +# { +# discard; +# } +# } +# } +# } +# } +# } +# } +# } +# } +# _GLF_color = vec4(vec3(grey), 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 418 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %113 %409 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %17 "func(i1;i1;" + OpName %15 "m" + OpName %16 "high" + OpName %19 "mergeSort(" + OpName %21 "k" + OpName %23 "i" + OpName %25 "j" + OpName %46 "data" + OpName %57 "temp" + OpName %92 "i" + OpName %109 "x" + OpName %113 "gl_FragCoord" + OpName %150 "low" + OpName %151 "high" + OpName %153 "m" + OpName %162 "i" + OpName %172 "from" + OpName %174 "mid" + OpName %179 "to" + OpName %187 "param" + OpName %189 "param" + OpName %191 "param" + OpName %194 "param" + OpName %196 "param" + OpName %203 "i" + OpName %205 "buf0" + OpMemberName %205 0 "injectionSwitch" + OpName %207 "" + OpName %269 "j" + OpName %294 "grey" + OpName %409 "_GLF_color" + OpDecorate %113 BuiltIn FragCoord + OpMemberDecorate %205 0 Offset 0 + OpDecorate %205 Block + OpDecorate %207 DescriptorSet 0 + OpDecorate %207 Binding 0 + OpDecorate %409 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %14 = OpTypeFunction %6 %7 %7 + %27 = OpConstant %6 1 + %36 = OpTypeBool + %42 = OpTypeInt 32 0 + %43 = OpConstant %42 10 + %44 = OpTypeArray %6 %43 + %45 = OpTypePointer Private %44 + %46 = OpVariable %45 Private + %48 = OpTypePointer Private %6 + %57 = OpVariable %45 Private + %79 = OpConstant %6 10 + %110 = OpTypeFloat 32 + %111 = OpTypeVector %110 4 + %112 = OpTypePointer Input %111 + %113 = OpVariable %112 Input + %114 = OpConstant %42 0 + %115 = OpTypePointer Input %110 + %118 = OpConstant %110 0 + %123 = OpConstantFalse %36 + %128 = OpConstant %6 0 + %131 = OpConstant %6 4 + %138 = OpConstant %6 2 + %152 = OpConstant %6 9 + %204 = OpTypeVector %110 2 + %205 = OpTypeStruct %204 + %206 = OpTypePointer Uniform %205 + %207 = OpVariable %206 Uniform + %208 = OpTypePointer Uniform %110 + %232 = OpConstant %6 3 + %245 = OpConstant %6 -1 + %249 = OpConstant %6 -2 + %253 = OpConstant %6 -3 + %257 = OpConstant %6 -4 + %261 = OpConstant %6 -5 + %285 = OpConstant %42 1 + %289 = OpConstant %6 30 + %293 = OpTypePointer Function %110 + %295 = OpConstant %110 0.5 + %299 = OpConstant %110 10 + %306 = OpConstant %6 60 + %319 = OpConstant %6 90 + %332 = OpConstant %6 120 + %345 = OpConstant %6 150 + %354 = OpConstant %6 180 + %358 = OpConstant %6 5 + %368 = OpConstant %6 210 + %372 = OpConstant %6 6 + %382 = OpConstant %6 240 + %386 = OpConstant %6 7 + %396 = OpConstant %6 270 + %400 = OpConstant %6 8 + %408 = OpTypePointer Output %111 + %409 = OpVariable %408 Output + %411 = OpTypeVector %110 3 + %413 = OpConstant %110 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %203 = OpVariable %7 Function + %269 = OpVariable %7 Function + %294 = OpVariable %293 Function + %209 = OpAccessChain %208 %207 %128 %114 + %210 = OpLoad %110 %209 + %211 = OpConvertFToS %6 %210 + OpStore %203 %211 + OpBranch %212 + %212 = OpLabel + OpLoopMerge %214 %215 None + OpBranch %213 + %213 = OpLabel + %216 = OpLoad %6 %203 + OpSelectionMerge %227 None + OpSwitch %216 %227 0 %217 1 %218 2 %219 3 %220 4 %221 5 %222 6 %223 7 %224 8 %225 9 %226 + %217 = OpLabel + %228 = OpLoad %6 %203 + %229 = OpAccessChain %48 %46 %228 + OpStore %229 %131 + OpBranch %227 + %218 = OpLabel + %231 = OpLoad %6 %203 + %233 = OpAccessChain %48 %46 %231 + OpStore %233 %232 + OpBranch %227 + %219 = OpLabel + %235 = OpLoad %6 %203 + %236 = OpAccessChain %48 %46 %235 + OpStore %236 %138 + OpBranch %227 + %220 = OpLabel + %238 = OpLoad %6 %203 + %239 = OpAccessChain %48 %46 %238 + OpStore %239 %27 + OpBranch %227 + %221 = OpLabel + %241 = OpLoad %6 %203 + %242 = OpAccessChain %48 %46 %241 + OpStore %242 %128 + OpBranch %227 + %222 = OpLabel + %244 = OpLoad %6 %203 + %246 = OpAccessChain %48 %46 %244 + OpStore %246 %245 + OpBranch %227 + %223 = OpLabel + %248 = OpLoad %6 %203 + %250 = OpAccessChain %48 %46 %248 + OpStore %250 %249 + OpBranch %227 + %224 = OpLabel + %252 = OpLoad %6 %203 + %254 = OpAccessChain %48 %46 %252 + OpStore %254 %253 + OpBranch %227 + %225 = OpLabel + %256 = OpLoad %6 %203 + %258 = OpAccessChain %48 %46 %256 + OpStore %258 %257 + OpBranch %227 + %226 = OpLabel + %260 = OpLoad %6 %203 + %262 = OpAccessChain %48 %46 %260 + OpStore %262 %261 + OpBranch %227 + %227 = OpLabel + %265 = OpLoad %6 %203 + %266 = OpIAdd %6 %265 %27 + OpStore %203 %266 + OpBranch %215 + %215 = OpLabel + %267 = OpLoad %6 %203 + %268 = OpSLessThan %36 %267 %79 + OpBranchConditional %268 %212 %214 + %214 = OpLabel + OpStore %269 %128 + OpBranch %270 + %270 = OpLabel + OpLoopMerge %272 %273 None + OpBranch %274 + %274 = OpLabel + %275 = OpLoad %6 %269 + %276 = OpSLessThan %36 %275 %79 + OpBranchConditional %276 %271 %272 + %271 = OpLabel + %277 = OpLoad %6 %269 + %278 = OpLoad %6 %269 + %279 = OpAccessChain %48 %46 %278 + %280 = OpLoad %6 %279 + %281 = OpAccessChain %48 %57 %277 + OpStore %281 %280 + OpBranch %273 + %273 = OpLabel + %282 = OpLoad %6 %269 + %283 = OpIAdd %6 %282 %27 + OpStore %269 %283 + OpBranch %270 + %272 = OpLabel + %284 = OpFunctionCall %2 %19 + %286 = OpAccessChain %115 %113 %285 + %287 = OpLoad %110 %286 + %288 = OpConvertFToS %6 %287 + %290 = OpSLessThan %36 %288 %289 + OpSelectionMerge %292 None + OpBranchConditional %290 %291 %302 + %291 = OpLabel + %296 = OpAccessChain %48 %46 %128 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %110 %297 + %300 = OpFDiv %110 %298 %299 + %301 = OpFAdd %110 %295 %300 + OpStore %294 %301 + OpBranch %292 + %302 = OpLabel + %303 = OpAccessChain %115 %113 %285 + %304 = OpLoad %110 %303 + %305 = OpConvertFToS %6 %304 + %307 = OpSLessThan %36 %305 %306 + OpSelectionMerge %309 None + OpBranchConditional %307 %308 %315 + %308 = OpLabel + %310 = OpAccessChain %48 %46 %27 + %311 = OpLoad %6 %310 + %312 = OpConvertSToF %110 %311 + %313 = OpFDiv %110 %312 %299 + %314 = OpFAdd %110 %295 %313 + OpStore %294 %314 + OpBranch %309 + %315 = OpLabel + %316 = OpAccessChain %115 %113 %285 + %317 = OpLoad %110 %316 + %318 = OpConvertFToS %6 %317 + %320 = OpSLessThan %36 %318 %319 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %328 + %321 = OpLabel + %323 = OpAccessChain %48 %46 %138 + %324 = OpLoad %6 %323 + %325 = OpConvertSToF %110 %324 + %326 = OpFDiv %110 %325 %299 + %327 = OpFAdd %110 %295 %326 + OpStore %294 %327 + OpBranch %322 + %328 = OpLabel + %329 = OpAccessChain %115 %113 %285 + %330 = OpLoad %110 %329 + %331 = OpConvertFToS %6 %330 + %333 = OpSLessThan %36 %331 %332 + OpSelectionMerge %335 None + OpBranchConditional %333 %334 %341 + %334 = OpLabel + %336 = OpAccessChain %48 %46 %232 + %337 = OpLoad %6 %336 + %338 = OpConvertSToF %110 %337 + %339 = OpFDiv %110 %338 %299 + %340 = OpFAdd %110 %295 %339 + OpStore %294 %340 + OpBranch %335 + %341 = OpLabel + %342 = OpAccessChain %115 %113 %285 + %343 = OpLoad %110 %342 + %344 = OpConvertFToS %6 %343 + %346 = OpSLessThan %36 %344 %345 + OpSelectionMerge %348 None + OpBranchConditional %346 %347 %350 + %347 = OpLabel + OpTerminateInvocation + %350 = OpLabel + %351 = OpAccessChain %115 %113 %285 + %352 = OpLoad %110 %351 + %353 = OpConvertFToS %6 %352 + %355 = OpSLessThan %36 %353 %354 + OpSelectionMerge %357 None + OpBranchConditional %355 %356 %364 + %356 = OpLabel + %359 = OpAccessChain %48 %46 %358 + %360 = OpLoad %6 %359 + %361 = OpConvertSToF %110 %360 + %362 = OpFDiv %110 %361 %299 + %363 = OpFAdd %110 %295 %362 + OpStore %294 %363 + OpBranch %357 + %364 = OpLabel + %365 = OpAccessChain %115 %113 %285 + %366 = OpLoad %110 %365 + %367 = OpConvertFToS %6 %366 + %369 = OpSLessThan %36 %367 %368 + OpSelectionMerge %371 None + OpBranchConditional %369 %370 %378 + %370 = OpLabel + %373 = OpAccessChain %48 %46 %372 + %374 = OpLoad %6 %373 + %375 = OpConvertSToF %110 %374 + %376 = OpFDiv %110 %375 %299 + %377 = OpFAdd %110 %295 %376 + OpStore %294 %377 + OpBranch %371 + %378 = OpLabel + %379 = OpAccessChain %115 %113 %285 + %380 = OpLoad %110 %379 + %381 = OpConvertFToS %6 %380 + %383 = OpSLessThan %36 %381 %382 + OpSelectionMerge %385 None + OpBranchConditional %383 %384 %392 + %384 = OpLabel + %387 = OpAccessChain %48 %46 %386 + %388 = OpLoad %6 %387 + %389 = OpConvertSToF %110 %388 + %390 = OpFDiv %110 %389 %299 + %391 = OpFAdd %110 %295 %390 + OpStore %294 %391 + OpBranch %385 + %392 = OpLabel + %393 = OpAccessChain %115 %113 %285 + %394 = OpLoad %110 %393 + %395 = OpConvertFToS %6 %394 + %397 = OpSLessThan %36 %395 %396 + OpSelectionMerge %399 None + OpBranchConditional %397 %398 %406 + %398 = OpLabel + %401 = OpAccessChain %48 %46 %400 + %402 = OpLoad %6 %401 + %403 = OpConvertSToF %110 %402 + %404 = OpFDiv %110 %403 %299 + %405 = OpFAdd %110 %295 %404 + OpStore %294 %405 + OpBranch %399 + %406 = OpLabel + OpTerminateInvocation + %399 = OpLabel + OpBranch %385 + %385 = OpLabel + OpBranch %371 + %371 = OpLabel + OpBranch %357 + %357 = OpLabel + OpBranch %348 + %348 = OpLabel + OpBranch %335 + %335 = OpLabel + OpBranch %322 + %322 = OpLabel + OpBranch %309 + %309 = OpLabel + OpBranch %292 + %292 = OpLabel + %410 = OpLoad %110 %294 + %412 = OpCompositeConstruct %411 %410 %410 %410 + %414 = OpCompositeExtract %110 %412 0 + %415 = OpCompositeExtract %110 %412 1 + %416 = OpCompositeExtract %110 %412 2 + %417 = OpCompositeConstruct %111 %414 %415 %416 %413 + OpStore %409 %417 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %21 = OpVariable %7 Function + %23 = OpVariable %7 Function + %25 = OpVariable %7 Function + %92 = OpVariable %7 Function + %22 = OpLoad %6 %9 + OpStore %21 %22 + %24 = OpLoad %6 %9 + OpStore %23 %24 + %26 = OpLoad %6 %10 + %28 = OpIAdd %6 %26 %27 + OpStore %25 %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %6 %23 + %35 = OpLoad %6 %10 + %37 = OpSLessThanEqual %36 %34 %35 + %38 = OpLoad %6 %25 + %39 = OpLoad %6 %11 + %40 = OpSLessThanEqual %36 %38 %39 + %41 = OpLogicalAnd %36 %37 %40 + OpBranchConditional %41 %30 %31 + %30 = OpLabel + %47 = OpLoad %6 %23 + %49 = OpAccessChain %48 %46 %47 + %50 = OpLoad %6 %49 + %51 = OpLoad %6 %25 + %52 = OpAccessChain %48 %46 %51 + %53 = OpLoad %6 %52 + %54 = OpSLessThan %36 %50 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %55 %65 + %55 = OpLabel + %58 = OpLoad %6 %21 + %59 = OpIAdd %6 %58 %27 + OpStore %21 %59 + %60 = OpLoad %6 %23 + %61 = OpIAdd %6 %60 %27 + OpStore %23 %61 + %62 = OpAccessChain %48 %46 %60 + %63 = OpLoad %6 %62 + %64 = OpAccessChain %48 %57 %58 + OpStore %64 %63 + OpBranch %56 + %65 = OpLabel + %66 = OpLoad %6 %21 + %67 = OpIAdd %6 %66 %27 + OpStore %21 %67 + %68 = OpLoad %6 %25 + %69 = OpIAdd %6 %68 %27 + OpStore %25 %69 + %70 = OpAccessChain %48 %46 %68 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %48 %57 %66 + OpStore %72 %71 + OpBranch %56 + %56 = OpLabel + OpBranch %32 + %32 = OpLabel + OpBranch %29 + %31 = OpLabel + OpBranch %73 + %73 = OpLabel + OpLoopMerge %75 %76 None + OpBranch %77 + %77 = OpLabel + %78 = OpLoad %6 %23 + %80 = OpSLessThan %36 %78 %79 + %81 = OpLoad %6 %23 + %82 = OpLoad %6 %10 + %83 = OpSLessThanEqual %36 %81 %82 + %84 = OpLogicalAnd %36 %80 %83 + OpBranchConditional %84 %74 %75 + %74 = OpLabel + %85 = OpLoad %6 %21 + %86 = OpIAdd %6 %85 %27 + OpStore %21 %86 + %87 = OpLoad %6 %23 + %88 = OpIAdd %6 %87 %27 + OpStore %23 %88 + %89 = OpAccessChain %48 %46 %87 + %90 = OpLoad %6 %89 + %91 = OpAccessChain %48 %57 %85 + OpStore %91 %90 + OpBranch %76 + %76 = OpLabel + OpBranch %73 + %75 = OpLabel + %93 = OpLoad %6 %9 + OpStore %92 %93 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %96 %97 None + OpBranch %98 + %98 = OpLabel + %99 = OpLoad %6 %92 + %100 = OpLoad %6 %11 + %101 = OpSLessThanEqual %36 %99 %100 + OpBranchConditional %101 %95 %96 + %95 = OpLabel + %102 = OpLoad %6 %92 + %103 = OpLoad %6 %92 + %104 = OpAccessChain %48 %57 %103 + %105 = OpLoad %6 %104 + %106 = OpAccessChain %48 %46 %102 + OpStore %106 %105 + OpBranch %97 + %97 = OpLabel + %107 = OpLoad %6 %92 + %108 = OpIAdd %6 %107 %27 + OpStore %92 %108 + OpBranch %94 + %96 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpFunction %6 None %14 + %15 = OpFunctionParameter %7 + %16 = OpFunctionParameter %7 + %18 = OpLabel + %109 = OpVariable %7 Function + %120 = OpVariable %7 Function + %124 = OpVariable %7 Function + %116 = OpAccessChain %115 %113 %114 + %117 = OpLoad %110 %116 + %119 = OpFOrdGreaterThanEqual %36 %117 %118 + OpSelectionMerge %122 None + OpBranchConditional %119 %121 %134 + %121 = OpLabel + OpSelectionMerge %126 None + OpBranchConditional %123 %125 %130 + %125 = OpLabel + %127 = OpLoad %6 %16 + %129 = OpShiftLeftLogical %6 %127 %128 + OpStore %124 %129 + OpBranch %126 + %130 = OpLabel + OpStore %124 %131 + OpBranch %126 + %126 = OpLabel + %132 = OpLoad %6 %124 + %133 = OpShiftLeftLogical %6 %27 %132 + OpStore %120 %133 + OpBranch %122 + %134 = OpLabel + OpStore %120 %27 + OpBranch %122 + %122 = OpLabel + %135 = OpLoad %6 %120 + OpStore %109 %135 + %136 = OpLoad %6 %109 + %137 = OpShiftRightArithmetic %6 %136 %131 + OpStore %109 %137 + %139 = OpLoad %6 %15 + %140 = OpIMul %6 %138 %139 + %141 = OpLoad %6 %15 + %142 = OpIMul %6 %138 %141 + %143 = OpLoad %6 %15 + %144 = OpIMul %6 %138 %143 + %145 = OpLoad %6 %109 + %146 = OpSDiv %6 %144 %145 + %147 = OpExtInst %6 %1 SClamp %140 %142 %146 + OpReturnValue %147 + OpFunctionEnd + %19 = OpFunction %2 None %3 + %20 = OpLabel + %150 = OpVariable %7 Function + %151 = OpVariable %7 Function + %153 = OpVariable %7 Function + %162 = OpVariable %7 Function + %172 = OpVariable %7 Function + %174 = OpVariable %7 Function + %179 = OpVariable %7 Function + %187 = OpVariable %7 Function + %189 = OpVariable %7 Function + %191 = OpVariable %7 Function + %194 = OpVariable %7 Function + %196 = OpVariable %7 Function + OpStore %150 %128 + OpStore %151 %152 + OpStore %153 %27 + OpBranch %154 + %154 = OpLabel + OpLoopMerge %156 %157 None + OpBranch %158 + %158 = OpLabel + %159 = OpLoad %6 %153 + %160 = OpLoad %6 %151 + %161 = OpSLessThanEqual %36 %159 %160 + OpBranchConditional %161 %155 %156 + %155 = OpLabel + %163 = OpLoad %6 %150 + OpStore %162 %163 + OpBranch %164 + %164 = OpLabel + OpLoopMerge %166 %167 None + OpBranch %168 + %168 = OpLabel + %169 = OpLoad %6 %162 + %170 = OpLoad %6 %151 + %171 = OpSLessThan %36 %169 %170 + OpBranchConditional %171 %165 %166 + %165 = OpLabel + %173 = OpLoad %6 %162 + OpStore %172 %173 + %175 = OpLoad %6 %162 + %176 = OpLoad %6 %153 + %177 = OpIAdd %6 %175 %176 + %178 = OpISub %6 %177 %27 + OpStore %174 %178 + %180 = OpLoad %6 %162 + %181 = OpLoad %6 %153 + %182 = OpIMul %6 %138 %181 + %183 = OpIAdd %6 %180 %182 + %184 = OpISub %6 %183 %27 + %185 = OpLoad %6 %151 + %186 = OpExtInst %6 %1 SMin %184 %185 + OpStore %179 %186 + %188 = OpLoad %6 %172 + OpStore %187 %188 + %190 = OpLoad %6 %174 + OpStore %189 %190 + %192 = OpLoad %6 %179 + OpStore %191 %192 + %193 = OpFunctionCall %2 %12 %187 %189 %191 + OpBranch %167 + %167 = OpLabel + %195 = OpLoad %6 %153 + OpStore %194 %195 + %197 = OpLoad %6 %151 + OpStore %196 %197 + %198 = OpFunctionCall %6 %17 %194 %196 + %199 = OpLoad %6 %162 + %200 = OpIAdd %6 %199 %198 + OpStore %162 %200 + OpBranch %164 + %166 = OpLabel + OpBranch %157 + %157 = OpLabel + %201 = OpLoad %6 %153 + %202 = OpIMul %6 %138 %201 + OpStore %153 %202 + OpBranch %154 + %156 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-mergesort-for-always-false-if-discard.amber b/vulkan/amber/graphicsfuzz/stable-mergesort-for-always-false-if-discard.amber new file mode 100644 index 0000000..0668052 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-mergesort-for-always-false-if-discard.amber @@ -0,0 +1,1236 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: A fragment shader with for loop and always false if + +# The test passes because both shaders render the same image. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 717e7877cac15d393fd3bb1bd872679de8b59add + + + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# const int N = 10; +# +# int data[10], temp[10]; +# +# void merge(int from, int mid, int to) +# { +# int k = from, i = from, j = mid + 1; +# while (i <= mid && j <= to) +# { +# if (data[i] < data[j]) +# { +# temp[k++] = data[i++]; +# } +# else +# { +# temp[k++] = data[j++]; +# } +# } +# while (i < N && i <= mid) +# { +# temp[k++] = data[i++]; +# } +# for (int i = from; i <= to; i++) +# { +# data[i] = temp[i]; +# } +# } +# void mergeSort() +# { +# int low = 0; +# int high = N - 1; +# for (int m = 1; m <= high; m = 2 * m) +# { +# for (int i = low; i < high; i += 2 * m) +# { +# int from = i; +# int mid = i + m - 1; +# int to = min(i + 2 * m - 1, high); +# merge(from, mid, to); +# } +# } +# } +# void main() +# { +# int i = int(injectionSwitch.x); +# do +# { +# switch (i) +# { +# case 0: +# data[i] = 4; +# break; +# case 1: +# data[i] = 3; +# break; +# case 2: +# data[i] = 2; +# break; +# case 3: +# data[i] = 1; +# break; +# case 4: +# data[i] = 0; +# break; +# case 5: +# data[i] = -1; +# break; +# case 6: +# data[i] = -2; +# break; +# case 7: +# data[i] = -3; +# break; +# case 8: +# data[i] = -4; +# break; +# case 9: +# data[i] = -5; +# break; +# } +# i++; +# } while (i < 10); +# for (int j = 0; j < 10; j++) +# { +# temp[j] = data[j]; +# } +# mergeSort(); +# float grey; +# if (int(gl_FragCoord[1]) < 30) +# { +# grey = 0.5 + float(data[0]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 60) +# { +# grey = 0.5 + float(data[1]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 90) +# { +# grey = 0.5 + float(data[2]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 120) +# { +# grey = 0.5 + float(data[3]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 150) +# { +# discard; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 180) +# { +# grey = 0.5 + float(data[5]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 210) +# { +# grey = 0.5 + float(data[6]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 240) +# { +# grey = 0.5 + float(data[7]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 270) +# { +# grey = 0.5 + float(data[8]) / 10.0; +# } +# else +# { +# discard; +# } +# } +# } +# } +# } +# } +# } +# } +# } +# _GLF_color = vec4(vec3(grey), 1.0); +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 540 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %41 "data" + OpName %52 "temp" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %243 "gl_FragCoord" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %255 = OpConstant %157 0.5 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %373 = OpConstant %157 1 + %507 = OpTypePointer Function %39 + %539 = OpConstant %157 0.100000001 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %52 = OpVariable %507 Function + %41 = OpVariable %507 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpBranch %167 + %167 = OpLabel + %508 = OpPhi %6 %166 %5 %222 %170 + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + OpSelectionMerge %182 None + OpSwitch %508 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %185 = OpAccessChain %7 %41 %508 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %189 = OpAccessChain %7 %41 %508 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %192 = OpAccessChain %7 %41 %508 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %195 = OpAccessChain %7 %41 %508 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %198 = OpAccessChain %7 %41 %508 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %202 = OpAccessChain %7 %41 %508 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %206 = OpAccessChain %7 %41 %508 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %210 = OpAccessChain %7 %41 %508 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %214 = OpAccessChain %7 %41 %508 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %218 = OpAccessChain %7 %41 %508 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %222 = OpIAdd %6 %508 %22 + OpBranch %170 + %170 = OpLabel + %224 = OpSLessThan %31 %222 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpBranch %226 + %226 = OpLabel + %510 = OpPhi %6 %105 %169 %239 %227 + %232 = OpSLessThan %31 %510 %74 + OpLoopMerge %228 %227 None + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %235 = OpAccessChain %7 %41 %510 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %7 %52 %510 + OpStore %237 %236 + %239 = OpIAdd %6 %510 %22 + OpBranch %226 + %228 = OpLabel + OpBranch %389 + %389 = OpLabel + %511 = OpPhi %6 %22 %228 %426 %424 + %393 = OpSLessThanEqual %31 %511 %107 + OpLoopMerge %427 %424 None + OpBranchConditional %393 %394 %427 + %394 = OpLabel + OpBranch %396 + %396 = OpLabel + %519 = OpPhi %6 %105 %394 %410 %418 + %400 = OpSLessThan %31 %519 %107 + OpLoopMerge %423 %418 None + OpBranchConditional %400 %401 %423 + %401 = OpLabel + %405 = OpIAdd %6 %519 %511 + %406 = OpISub %6 %405 %22 + %409 = OpIMul %6 %136 %511 + %410 = OpIAdd %6 %519 %409 + %411 = OpISub %6 %410 %22 + %413 = OpExtInst %6 %1 SMin %411 %107 + OpBranch %437 + %437 = OpLabel + %532 = OpPhi %6 %519 %401 %456 %471 + %522 = OpPhi %6 %405 %401 %534 %471 + %521 = OpPhi %6 %519 %401 %533 %471 + %441 = OpSLessThanEqual %31 %521 %406 + %444 = OpSLessThanEqual %31 %522 %413 + %445 = OpLogicalAnd %31 %441 %444 + OpLoopMerge %472 %471 None + OpBranchConditional %445 %446 %472 + %446 = OpLabel + %448 = OpAccessChain %7 %41 %521 + %449 = OpLoad %6 %448 + %451 = OpAccessChain %7 %41 %522 + %452 = OpLoad %6 %451 + %453 = OpSLessThan %31 %449 %452 + %456 = OpIAdd %6 %532 %22 + OpSelectionMerge %470 None + OpBranchConditional %453 %454 %462 + %454 = OpLabel + %458 = OpIAdd %6 %521 %22 + %460 = OpLoad %6 %448 + %461 = OpAccessChain %7 %52 %532 + OpStore %461 %460 + OpBranch %470 + %462 = OpLabel + %466 = OpIAdd %6 %522 %22 + %468 = OpLoad %6 %451 + %469 = OpAccessChain %7 %52 %532 + OpStore %469 %468 + OpBranch %470 + %470 = OpLabel + %534 = OpPhi %6 %522 %454 %466 %462 + %533 = OpPhi %6 %458 %454 %521 %462 + OpBranch %471 + %471 = OpLabel + OpBranch %437 + %472 = OpLabel + OpBranch %473 + %473 = OpLabel + %531 = OpPhi %6 %532 %472 %483 %481 + %523 = OpPhi %6 %521 %472 %485 %481 + %476 = OpSLessThan %31 %523 %74 + %479 = OpSLessThanEqual %31 %523 %406 + %480 = OpLogicalAnd %31 %476 %479 + OpLoopMerge %490 %481 None + OpBranchConditional %480 %481 %490 + %481 = OpLabel + %483 = OpIAdd %6 %531 %22 + %485 = OpIAdd %6 %523 %22 + %486 = OpAccessChain %7 %41 %523 + %487 = OpLoad %6 %486 + %488 = OpAccessChain %7 %52 %531 + OpStore %488 %487 + OpBranch %473 + %490 = OpLabel + OpBranch %492 + %492 = OpLabel + %524 = OpPhi %6 %519 %490 %505 %497 + %496 = OpSLessThanEqual %31 %524 %413 + OpLoopMerge %506 %497 None + OpBranchConditional %496 %497 %506 + %497 = OpLabel + %500 = OpAccessChain %7 %52 %524 + %501 = OpLoad %6 %500 + %502 = OpAccessChain %7 %41 %524 + OpStore %502 %501 + %505 = OpIAdd %6 %524 %22 + OpBranch %492 + %506 = OpLabel + OpBranch %418 + %418 = OpLabel + OpBranch %396 + %423 = OpLabel + OpBranch %424 + %424 = OpLabel + %426 = OpIMul %6 %136 %511 + OpBranch %389 + %427 = OpLabel + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %7 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFMul %157 %258 %539 + %261 = OpFAdd %157 %255 %260 + OpBranch %252 + %262 = OpLabel + %267 = OpSLessThan %31 %248 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %7 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFMul %157 %272 %539 + %274 = OpFAdd %157 %255 %273 + OpBranch %269 + %275 = OpLabel + %280 = OpSLessThan %31 %248 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %7 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFMul %157 %285 %539 + %287 = OpFAdd %157 %255 %286 + OpBranch %282 + %288 = OpLabel + %293 = OpSLessThan %31 %248 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %7 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFMul %157 %298 %539 + %300 = OpFAdd %157 %255 %299 + OpBranch %295 + %301 = OpLabel + %306 = OpSLessThan %31 %248 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %315 = OpSLessThan %31 %248 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %7 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFMul %157 %321 %539 + %323 = OpFAdd %157 %255 %322 + OpBranch %317 + %324 = OpLabel + %329 = OpSLessThan %31 %248 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %7 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFMul %157 %335 %539 + %337 = OpFAdd %157 %255 %336 + OpBranch %331 + %338 = OpLabel + %343 = OpSLessThan %31 %248 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %7 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFMul %157 %349 %539 + %351 = OpFAdd %157 %255 %350 + OpBranch %345 + %352 = OpLabel + %357 = OpSLessThan %31 %248 %356 + OpSelectionMerge %358 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %7 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFMul %157 %363 %539 + %365 = OpFAdd %157 %255 %364 + OpBranch %345 + %366 = OpLabel + OpTerminateInvocation + %345 = OpLabel + %518 = OpPhi %157 %351 %344 %365 %358 + OpBranch %331 + %331 = OpLabel + %517 = OpPhi %157 %337 %330 %518 %345 + OpBranch %317 + %317 = OpLabel + %516 = OpPhi %157 %323 %316 %517 %331 + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + %515 = OpPhi %157 %300 %294 %516 %308 + OpBranch %282 + %282 = OpLabel + %514 = OpPhi %157 %287 %281 %515 %295 + OpBranch %269 + %269 = OpLabel + %513 = OpPhi %157 %274 %268 %514 %282 + OpBranch %252 + %252 = OpLabel + %512 = OpPhi %157 %261 %251 %513 %269 + %377 = OpCompositeConstruct %241 %512 %512 %512 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# injectionSwitch +BUFFER reference_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; // x == 0.0, y == 1.0 +# }; +# const int N = 10; +# +# int data[10], temp[10]; +# +# void merge(int from, int mid, int to) +# { +# int k = from, i = from, j = mid + 1; +# while (i <= mid && j <= to) +# { +# if (data[i] < data[j]) +# { +# temp[k++] = data[i++]; +# } +# else +# { +# temp[k++] = data[j++]; +# } +# } +# while (i < N && i <= mid) +# { +# temp[k++] = data[i++]; +# } +# for (int i = from; i <= to; i++) +# { +# data[i] = temp[i]; +# } +# } +# void mergeSort() +# { +# int low = 0; +# int high = N - 1; +# for (int m = 1; m <= high; m = 2 * m) +# { +# for (int i = low; i < high; i += 2 * m) +# { +# int from = i; +# int mid = i + m - 1; +# int to = min(i + 2 * m - 1, high); +# merge(from, mid, to); +# } +# } +# } +# void main() +# { +# int i = int(injectionSwitch.x); +# do +# { +# switch (i) +# { +# case 0: +# data[i] = 4; +# break; +# case 1: +# data[i] = 3; +# break; +# case 2: +# data[i] = 2; +# break; +# case 3: +# data[i] = 1; +# break; +# case 4: +# data[i] = 0; +# break; +# case 5: +# data[i] = -1; +# break; +# case 6: +# data[i] = -2; +# break; +# case 7: +# data[i] = -3; +# break; +# case 8: +# data[i] = -4; +# break; +# case 9: +# data[i] = -5; +# break; +# } +# i++; +# } while (i < 10); +# for (int j = 0; j < 10; j++) +# { +# temp[j] = data[j]; +# } +# mergeSort(); +# float grey; +# if (int(gl_FragCoord[1]) < 30) +# { +# grey = 0.5 + float(data[0]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 60) +# { +# grey = 0.5 + float(data[1]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 90) +# { +# grey = 0.5 + float(data[2]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 120) +# { +# grey = 0.5 + float(data[3]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 150) +# { +# discard; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 180) +# { +# grey = 0.5 + float(data[5]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 210) +# { +# grey = 0.5 + float(data[6]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 240) +# { +# grey = 0.5 + float(data[7]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 270) +# { +# grey = 0.5 + float(data[8]) / 10.0; +# } +# else +# { +# discard; +# } +# } +# } +# } +# // Code block bellow should not affect output image. +# // Always false. +# if (injectionSwitch.x > injectionSwitch.y) +# { +# _GLF_color = vec4(1.0); +# } +# vec2 a = vec2(1.0, 1.0); +# for (int i = 0; i <= 32; i++) +# { +# // Always false. +# if (a.x < 0.0) +# { +# // Always false. +# if (injectionSwitch.x > injectionSwitch.y) +# { +# discard; +# } +# a.y++; +# } +# a.x += a.y; +# } +# // End of block. +# } +# } +# } +# } +# } +# _GLF_color = vec4(vec3(grey), 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 602 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %376 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %41 "data" + OpName %52 "temp" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %243 "gl_FragCoord" + OpName %376 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %376 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %255 = OpConstant %157 0.5 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %375 = OpTypePointer Output %241 + %376 = OpVariable %375 Output + %377 = OpConstant %157 1 + %378 = OpConstantComposite %241 %377 %377 %377 %377 + %381 = OpConstantComposite %158 %377 %377 + %389 = OpConstant %6 32 + %393 = OpConstant %157 0 + %552 = OpTypePointer Function %39 + %601 = OpConstant %157 0.100000001 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %52 = OpVariable %552 Function + %41 = OpVariable %552 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpBranch %167 + %167 = OpLabel + %561 = OpPhi %6 %166 %5 %222 %170 + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + OpSelectionMerge %182 None + OpSwitch %561 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %185 = OpAccessChain %7 %41 %561 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %189 = OpAccessChain %7 %41 %561 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %192 = OpAccessChain %7 %41 %561 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %195 = OpAccessChain %7 %41 %561 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %198 = OpAccessChain %7 %41 %561 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %202 = OpAccessChain %7 %41 %561 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %206 = OpAccessChain %7 %41 %561 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %210 = OpAccessChain %7 %41 %561 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %214 = OpAccessChain %7 %41 %561 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %218 = OpAccessChain %7 %41 %561 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %222 = OpIAdd %6 %561 %22 + OpBranch %170 + %170 = OpLabel + %224 = OpSLessThan %31 %222 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpBranch %226 + %226 = OpLabel + %563 = OpPhi %6 %105 %169 %239 %227 + %232 = OpSLessThan %31 %563 %74 + OpLoopMerge %228 %227 None + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %235 = OpAccessChain %7 %41 %563 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %7 %52 %563 + OpStore %237 %236 + %239 = OpIAdd %6 %563 %22 + OpBranch %226 + %228 = OpLabel + OpBranch %434 + %434 = OpLabel + %564 = OpPhi %6 %22 %228 %471 %469 + %438 = OpSLessThanEqual %31 %564 %107 + OpLoopMerge %472 %469 None + OpBranchConditional %438 %439 %472 + %439 = OpLabel + OpBranch %441 + %441 = OpLabel + %579 = OpPhi %6 %105 %439 %455 %463 + %445 = OpSLessThan %31 %579 %107 + OpLoopMerge %468 %463 None + OpBranchConditional %445 %446 %468 + %446 = OpLabel + %450 = OpIAdd %6 %579 %564 + %451 = OpISub %6 %450 %22 + %454 = OpIMul %6 %136 %564 + %455 = OpIAdd %6 %579 %454 + %456 = OpISub %6 %455 %22 + %458 = OpExtInst %6 %1 SMin %456 %107 + OpBranch %482 + %482 = OpLabel + %592 = OpPhi %6 %579 %446 %501 %516 + %582 = OpPhi %6 %450 %446 %594 %516 + %581 = OpPhi %6 %579 %446 %593 %516 + %486 = OpSLessThanEqual %31 %581 %451 + %489 = OpSLessThanEqual %31 %582 %458 + %490 = OpLogicalAnd %31 %486 %489 + OpLoopMerge %517 %516 None + OpBranchConditional %490 %491 %517 + %491 = OpLabel + %493 = OpAccessChain %7 %41 %581 + %494 = OpLoad %6 %493 + %496 = OpAccessChain %7 %41 %582 + %497 = OpLoad %6 %496 + %498 = OpSLessThan %31 %494 %497 + %501 = OpIAdd %6 %592 %22 + OpSelectionMerge %515 None + OpBranchConditional %498 %499 %507 + %499 = OpLabel + %503 = OpIAdd %6 %581 %22 + %505 = OpLoad %6 %493 + %506 = OpAccessChain %7 %52 %592 + OpStore %506 %505 + OpBranch %515 + %507 = OpLabel + %511 = OpIAdd %6 %582 %22 + %513 = OpLoad %6 %496 + %514 = OpAccessChain %7 %52 %592 + OpStore %514 %513 + OpBranch %515 + %515 = OpLabel + %594 = OpPhi %6 %582 %499 %511 %507 + %593 = OpPhi %6 %503 %499 %581 %507 + OpBranch %516 + %516 = OpLabel + OpBranch %482 + %517 = OpLabel + OpBranch %518 + %518 = OpLabel + %591 = OpPhi %6 %592 %517 %528 %526 + %583 = OpPhi %6 %581 %517 %530 %526 + %521 = OpSLessThan %31 %583 %74 + %524 = OpSLessThanEqual %31 %583 %451 + %525 = OpLogicalAnd %31 %521 %524 + OpLoopMerge %535 %526 None + OpBranchConditional %525 %526 %535 + %526 = OpLabel + %528 = OpIAdd %6 %591 %22 + %530 = OpIAdd %6 %583 %22 + %531 = OpAccessChain %7 %41 %583 + %532 = OpLoad %6 %531 + %533 = OpAccessChain %7 %52 %591 + OpStore %533 %532 + OpBranch %518 + %535 = OpLabel + OpBranch %537 + %537 = OpLabel + %584 = OpPhi %6 %579 %535 %550 %542 + %541 = OpSLessThanEqual %31 %584 %458 + OpLoopMerge %551 %542 None + OpBranchConditional %541 %542 %551 + %542 = OpLabel + %545 = OpAccessChain %7 %52 %584 + %546 = OpLoad %6 %545 + %547 = OpAccessChain %7 %41 %584 + OpStore %547 %546 + %550 = OpIAdd %6 %584 %22 + OpBranch %537 + %551 = OpLabel + OpBranch %463 + %463 = OpLabel + OpBranch %441 + %468 = OpLabel + OpBranch %469 + %469 = OpLabel + %471 = OpIMul %6 %136 %564 + OpBranch %434 + %472 = OpLabel + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %7 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFMul %157 %258 %601 + %261 = OpFAdd %157 %255 %260 + OpBranch %252 + %262 = OpLabel + %267 = OpSLessThan %31 %248 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %7 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFMul %157 %272 %601 + %274 = OpFAdd %157 %255 %273 + OpBranch %269 + %275 = OpLabel + %280 = OpSLessThan %31 %248 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %7 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFMul %157 %285 %601 + %287 = OpFAdd %157 %255 %286 + OpBranch %282 + %288 = OpLabel + %293 = OpSLessThan %31 %248 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %7 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFMul %157 %298 %601 + %300 = OpFAdd %157 %255 %299 + OpBranch %295 + %301 = OpLabel + %306 = OpSLessThan %31 %248 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %315 = OpSLessThan %31 %248 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %7 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFMul %157 %321 %601 + %323 = OpFAdd %157 %255 %322 + OpBranch %317 + %324 = OpLabel + %329 = OpSLessThan %31 %248 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %7 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFMul %157 %335 %601 + %337 = OpFAdd %157 %255 %336 + OpBranch %331 + %338 = OpLabel + %343 = OpSLessThan %31 %248 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %7 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFMul %157 %349 %601 + %351 = OpFAdd %157 %255 %350 + OpBranch %345 + %352 = OpLabel + %357 = OpSLessThan %31 %248 %356 + OpSelectionMerge %358 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %7 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFMul %157 %363 %601 + %365 = OpFAdd %157 %255 %364 + OpBranch %345 + %366 = OpLabel + OpTerminateInvocation + %345 = OpLabel + %577 = OpPhi %157 %351 %344 %365 %358 + OpBranch %331 + %331 = OpLabel + %576 = OpPhi %157 %337 %330 %577 %345 + OpBranch %317 + %317 = OpLabel + %575 = OpPhi %157 %323 %316 %576 %331 + %370 = OpAccessChain %163 %161 %105 %244 + %371 = OpLoad %157 %370 + %372 = OpFOrdGreaterThan %31 %165 %371 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + OpStore %376 %378 + OpBranch %374 + %374 = OpLabel + OpBranch %383 + %383 = OpLabel + %566 = OpPhi %158 %381 %374 %560 %386 + %565 = OpPhi %6 %105 %374 %415 %386 + %390 = OpSLessThanEqual %31 %565 %389 + OpLoopMerge %385 %386 None + OpBranchConditional %390 %384 %385 + %384 = OpLabel + %392 = OpCompositeExtract %157 %566 0 + %394 = OpFOrdLessThan %31 %392 %393 + OpSelectionMerge %396 None + OpBranchConditional %394 %395 %396 + %395 = OpLabel + OpSelectionMerge %403 None + OpBranchConditional %372 %402 %403 + %402 = OpLabel + OpTerminateInvocation + %403 = OpLabel + %406 = OpCompositeExtract %157 %566 1 + %407 = OpFAdd %157 %406 %377 + %556 = OpCompositeInsert %158 %407 %566 1 + OpBranch %396 + %396 = OpLabel + %567 = OpPhi %158 %566 %384 %556 %403 + %409 = OpCompositeExtract %157 %567 1 + %411 = OpCompositeExtract %157 %567 0 + %412 = OpFAdd %157 %411 %409 + %560 = OpCompositeInsert %158 %412 %567 0 + OpBranch %386 + %386 = OpLabel + %415 = OpIAdd %6 %565 %22 + OpBranch %383 + %385 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + %572 = OpPhi %157 %300 %294 %575 %308 + OpBranch %282 + %282 = OpLabel + %571 = OpPhi %157 %287 %281 %572 %295 + OpBranch %269 + %269 = OpLabel + %570 = OpPhi %157 %274 %268 %571 %282 + OpBranch %252 + %252 = OpLabel + %569 = OpPhi %157 %261 %251 %570 %269 + %422 = OpCompositeConstruct %241 %569 %569 %569 %377 + OpStore %376 %422 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-mergesort-reversed-for-loop.amber b/vulkan/amber/graphicsfuzz/stable-mergesort-reversed-for-loop.amber new file mode 100644 index 0000000..1c1397e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-mergesort-reversed-for-loop.amber @@ -0,0 +1,1555 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with once iterated reversed for loop + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# const int N = 10; +# +# int data[10], temp[10]; +# +# void merge(int from, int mid, int to) +# { +# int k = from, i = from, j = mid + 1; +# while (i <= mid && j <= to) +# { +# if (data[i] < data[j]) +# { +# temp[k++] = data[i++]; +# } +# else +# { +# temp[k++] = data[j++]; +# } +# } +# while (i < N && i <= mid) +# { +# temp[k++] = data[i++]; +# } +# for (int i = from; i <= to; i++) +# { +# data[i] = temp[i]; +# } +# } +# void mergeSort() +# { +# int low = 0; +# int high = N - 1; +# for (int m = 1; m <= high; m = 2 * m) +# { +# for (int i = low; i < high; i += 2 * m) +# { +# int from = i; +# int mid = i + m - 1; +# int to = min(i + 2 * m - 1, high); +# merge(from, mid, to); +# } +# } +# } +# void main() +# { +# int i = int(injectionSwitch.x); +# do +# { +# switch (i) +# { +# case 0: +# data[i] = 4; +# break; +# case 1: +# data[i] = 3; +# break; +# case 2: +# data[i] = 2; +# break; +# case 3: +# data[i] = 1; +# break; +# case 4: +# data[i] = 0; +# break; +# case 5: +# data[i] = -1; +# break; +# case 6: +# data[i] = -2; +# break; +# case 7: +# data[i] = -3; +# break; +# case 8: +# data[i] = -4; +# break; +# case 9: +# data[i] = -5; +# break; +# } +# i++; +# } while (i < 10); +# for (int j = 0; j < 10; j++) +# { +# temp[j] = data[j]; +# } +# mergeSort(); +# float grey; +# if (int(gl_FragCoord[1]) < 30) +# { +# grey = 0.5 + float(data[0]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 60) +# { +# grey = 0.5 + float(data[1]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 90) +# { +# grey = 0.5 + float(data[2]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 120) +# { +# grey = 0.5 + float(data[3]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 150) +# { +# discard; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 180) +# { +# grey = 0.5 + float(data[5]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 210) +# { +# grey = 0.5 + float(data[6]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 240) +# { +# grey = 0.5 + float(data[7]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 270) +# { +# grey = 0.5 + float(data[8]) / 10.0; +# } +# else +# { +# discard; +# } +# } +# } +# } +# } +# } +# } +# } +# } +# _GLF_color = vec4(vec3(grey), 1.0); +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 378 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %369 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %369 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %369 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %314 = OpConstant %6 180 + %318 = OpConstant %6 5 + %328 = OpConstant %6 210 + %332 = OpConstant %6 6 + %342 = OpConstant %6 240 + %346 = OpConstant %6 7 + %356 = OpConstant %6 270 + %360 = OpConstant %6 8 + %368 = OpTypePointer Output %241 + %369 = OpVariable %368 Output + %371 = OpTypeVector %157 3 + %373 = OpConstant %157 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + %240 = OpFunctionCall %2 %14 + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %310 + %307 = OpLabel + OpTerminateInvocation + %310 = OpLabel + %311 = OpAccessChain %245 %243 %244 + %312 = OpLoad %157 %311 + %313 = OpConvertFToS %6 %312 + %315 = OpSLessThan %31 %313 %314 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %324 + %316 = OpLabel + %319 = OpAccessChain %43 %41 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %157 %320 + %322 = OpFDiv %157 %321 %259 + %323 = OpFAdd %157 %255 %322 + OpStore %254 %323 + OpBranch %317 + %324 = OpLabel + %325 = OpAccessChain %245 %243 %244 + %326 = OpLoad %157 %325 + %327 = OpConvertFToS %6 %326 + %329 = OpSLessThan %31 %327 %328 + OpSelectionMerge %331 None + OpBranchConditional %329 %330 %338 + %330 = OpLabel + %333 = OpAccessChain %43 %41 %332 + %334 = OpLoad %6 %333 + %335 = OpConvertSToF %157 %334 + %336 = OpFDiv %157 %335 %259 + %337 = OpFAdd %157 %255 %336 + OpStore %254 %337 + OpBranch %331 + %338 = OpLabel + %339 = OpAccessChain %245 %243 %244 + %340 = OpLoad %157 %339 + %341 = OpConvertFToS %6 %340 + %343 = OpSLessThan %31 %341 %342 + OpSelectionMerge %345 None + OpBranchConditional %343 %344 %352 + %344 = OpLabel + %347 = OpAccessChain %43 %41 %346 + %348 = OpLoad %6 %347 + %349 = OpConvertSToF %157 %348 + %350 = OpFDiv %157 %349 %259 + %351 = OpFAdd %157 %255 %350 + OpStore %254 %351 + OpBranch %345 + %352 = OpLabel + %353 = OpAccessChain %245 %243 %244 + %354 = OpLoad %157 %353 + %355 = OpConvertFToS %6 %354 + %357 = OpSLessThan %31 %355 %356 + OpSelectionMerge %359 None + OpBranchConditional %357 %358 %366 + %358 = OpLabel + %361 = OpAccessChain %43 %41 %360 + %362 = OpLoad %6 %361 + %363 = OpConvertSToF %157 %362 + %364 = OpFDiv %157 %363 %259 + %365 = OpFAdd %157 %255 %364 + OpStore %254 %365 + OpBranch %359 + %366 = OpLabel + OpTerminateInvocation + %359 = OpLabel + OpBranch %345 + %345 = OpLabel + OpBranch %331 + %331 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %370 = OpLoad %157 %254 + %372 = OpCompositeConstruct %371 %370 %370 %370 + %374 = OpCompositeExtract %157 %372 0 + %375 = OpCompositeExtract %157 %372 1 + %376 = OpCompositeExtract %157 %372 2 + %377 = OpCompositeConstruct %241 %374 %375 %376 %373 + OpStore %369 %377 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %60 + %50 = OpLabel + %53 = OpLoad %6 %16 + %54 = OpIAdd %6 %53 %22 + OpStore %16 %54 + %55 = OpLoad %6 %18 + %56 = OpIAdd %6 %55 %22 + OpStore %18 %56 + %57 = OpAccessChain %43 %41 %55 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %43 %52 %53 + OpStore %59 %58 + OpBranch %51 + %60 = OpLabel + %61 = OpLoad %6 %16 + %62 = OpIAdd %6 %61 %22 + OpStore %16 %62 + %63 = OpLoad %6 %20 + %64 = OpIAdd %6 %63 %22 + OpStore %20 %64 + %65 = OpAccessChain %43 %41 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %43 %52 %61 + OpStore %67 %66 + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# injectionSwitch +BUFFER reference_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# const int N = 10; +# +# int data[10], temp[10]; +# +# void merge(int from, int mid, int to) +# { +# int k = from, i = from, j = mid + 1; +# while (i <= mid && j <= to) +# { +# if (data[i] < data[j]) +# { +# temp[k++] = data[i++]; +# } +# else +# { +# temp[k++] = data[j++]; +# } +# } +# while (i < N && i <= mid) +# { +# temp[k++] = data[i++]; +# } +# for (int i = from; i <= to; i++) +# { +# data[i] = temp[i]; +# } +# } +# void mergeSort() +# { +# int low = 0; +# int high = N - 1; +# for (int m = 1; m <= high; m = 2 * m) +# { +# for (int i = low; i < high; i += 2 * m) +# { +# int from = i; +# int mid = i + m - 1; +# int to = min(i + 2 * m - 1, high); +# merge(from, mid, to); +# } +# } +# } +# void main() +# { +# int i = int(injectionSwitch.x); +# do +# { +# switch (i) +# { +# case 0: +# data[i] = 4; +# break; +# case 1: +# data[i] = 3; +# break; +# case 2: +# data[i] = 2; +# break; +# case 3: +# data[i] = 1; +# break; +# case 4: +# data[i] = 0; +# break; +# case 5: +# data[i] = -1; +# break; +# case 6: +# data[i] = -2; +# break; +# case 7: +# data[i] = -3; +# break; +# case 8: +# data[i] = -4; +# break; +# case 9: +# data[i] = -5; +# break; +# } +# i++; +# } while (i < 10); +# for (int j = 0; j < 10; j++) +# { +# temp[j] = data[j]; +# } +# mergeSort(); +# float grey; +# if (int(gl_FragCoord[1]) < 30) +# { +# grey = 0.5 + float(data[0]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 60) +# { +# grey = 0.5 + float(data[1]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 90) +# { +# grey = 0.5 + float(data[2]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 120) +# { +# grey = 0.5 + float(data[3]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 150) +# { +# // Iterates once. +# for (int int_i = 1; int_i > int((injectionSwitch.x)); int_i--) +# { +# discard; +# } +# } +# else +# { +# if (int(gl_FragCoord[1]) < 180) +# { +# grey = 0.5 + float(data[5]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 210) +# { +# grey = 0.5 + float(data[6]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 240) +# { +# grey = 0.5 + float(data[7]) / 10.0; +# } +# else +# { +# if (int(gl_FragCoord[1]) < 270) +# { +# grey = 0.5 + float(data[8]) / 10.0; +# } +# else +# { +# discard; +# } +# } +# } +# } +# } +# } +# } +# } +# } +# _GLF_color = vec4(vec3(grey), 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 391 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %243 %382 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "merge(i1;i1;i1;" + OpName %9 "from" + OpName %10 "mid" + OpName %11 "to" + OpName %14 "mergeSort(" + OpName %16 "k" + OpName %18 "i" + OpName %20 "j" + OpName %41 "data" + OpName %52 "temp" + OpName %87 "i" + OpName %104 "low" + OpName %106 "high" + OpName %108 "m" + OpName %117 "i" + OpName %127 "from" + OpName %129 "mid" + OpName %134 "to" + OpName %143 "param" + OpName %145 "param" + OpName %147 "param" + OpName %156 "i" + OpName %159 "buf0" + OpMemberName %159 0 "injectionSwitch" + OpName %161 "" + OpName %225 "j" + OpName %243 "gl_FragCoord" + OpName %254 "grey" + OpName %309 "int_i" + OpName %382 "_GLF_color" + OpMemberDecorate %159 0 Offset 0 + OpDecorate %159 Block + OpDecorate %161 DescriptorSet 0 + OpDecorate %161 Binding 0 + OpDecorate %243 BuiltIn FragCoord + OpDecorate %382 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 %7 + %22 = OpConstant %6 1 + %31 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %6 %38 + %40 = OpTypePointer Private %39 + %41 = OpVariable %40 Private + %43 = OpTypePointer Private %6 + %52 = OpVariable %40 Private + %74 = OpConstant %6 10 + %105 = OpConstant %6 0 + %107 = OpConstant %6 9 + %136 = OpConstant %6 2 + %157 = OpTypeFloat 32 + %158 = OpTypeVector %157 2 + %159 = OpTypeStruct %158 + %160 = OpTypePointer Uniform %159 + %161 = OpVariable %160 Uniform + %162 = OpConstant %37 0 + %163 = OpTypePointer Uniform %157 + %184 = OpConstant %6 4 + %188 = OpConstant %6 3 + %201 = OpConstant %6 -1 + %205 = OpConstant %6 -2 + %209 = OpConstant %6 -3 + %213 = OpConstant %6 -4 + %217 = OpConstant %6 -5 + %241 = OpTypeVector %157 4 + %242 = OpTypePointer Input %241 + %243 = OpVariable %242 Input + %244 = OpConstant %37 1 + %245 = OpTypePointer Input %157 + %249 = OpConstant %6 30 + %253 = OpTypePointer Function %157 + %255 = OpConstant %157 0.5 + %259 = OpConstant %157 10 + %266 = OpConstant %6 60 + %279 = OpConstant %6 90 + %292 = OpConstant %6 120 + %305 = OpConstant %6 150 + %327 = OpConstant %6 180 + %331 = OpConstant %6 5 + %341 = OpConstant %6 210 + %345 = OpConstant %6 6 + %355 = OpConstant %6 240 + %359 = OpConstant %6 7 + %369 = OpConstant %6 270 + %373 = OpConstant %6 8 + %381 = OpTypePointer Output %241 + %382 = OpVariable %381 Output + %384 = OpTypeVector %157 3 + %386 = OpConstant %157 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %156 = OpVariable %7 Function + %225 = OpVariable %7 Function + %254 = OpVariable %253 Function + %309 = OpVariable %7 Function + %164 = OpAccessChain %163 %161 %105 %162 + %165 = OpLoad %157 %164 + %166 = OpConvertFToS %6 %165 + OpStore %156 %166 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %168 + %168 = OpLabel + %171 = OpLoad %6 %156 + OpSelectionMerge %182 None + OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 + %172 = OpLabel + %183 = OpLoad %6 %156 + %185 = OpAccessChain %43 %41 %183 + OpStore %185 %184 + OpBranch %182 + %173 = OpLabel + %187 = OpLoad %6 %156 + %189 = OpAccessChain %43 %41 %187 + OpStore %189 %188 + OpBranch %182 + %174 = OpLabel + %191 = OpLoad %6 %156 + %192 = OpAccessChain %43 %41 %191 + OpStore %192 %136 + OpBranch %182 + %175 = OpLabel + %194 = OpLoad %6 %156 + %195 = OpAccessChain %43 %41 %194 + OpStore %195 %22 + OpBranch %182 + %176 = OpLabel + %197 = OpLoad %6 %156 + %198 = OpAccessChain %43 %41 %197 + OpStore %198 %105 + OpBranch %182 + %177 = OpLabel + %200 = OpLoad %6 %156 + %202 = OpAccessChain %43 %41 %200 + OpStore %202 %201 + OpBranch %182 + %178 = OpLabel + %204 = OpLoad %6 %156 + %206 = OpAccessChain %43 %41 %204 + OpStore %206 %205 + OpBranch %182 + %179 = OpLabel + %208 = OpLoad %6 %156 + %210 = OpAccessChain %43 %41 %208 + OpStore %210 %209 + OpBranch %182 + %180 = OpLabel + %212 = OpLoad %6 %156 + %214 = OpAccessChain %43 %41 %212 + OpStore %214 %213 + OpBranch %182 + %181 = OpLabel + %216 = OpLoad %6 %156 + %218 = OpAccessChain %43 %41 %216 + OpStore %218 %217 + OpBranch %182 + %182 = OpLabel + %221 = OpLoad %6 %156 + %222 = OpIAdd %6 %221 %22 + OpStore %156 %222 + OpBranch %170 + %170 = OpLabel + %223 = OpLoad %6 %156 + %224 = OpSLessThan %31 %223 %74 + OpBranchConditional %224 %167 %169 + %169 = OpLabel + OpStore %225 %105 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %6 %225 + %232 = OpSLessThan %31 %231 %74 + OpBranchConditional %232 %227 %228 + %227 = OpLabel + %233 = OpLoad %6 %225 + %234 = OpLoad %6 %225 + %235 = OpAccessChain %43 %41 %234 + %236 = OpLoad %6 %235 + %237 = OpAccessChain %43 %52 %233 + OpStore %237 %236 + OpBranch %229 + %229 = OpLabel + %238 = OpLoad %6 %225 + %239 = OpIAdd %6 %238 %22 + OpStore %225 %239 + OpBranch %226 + %228 = OpLabel + %240 = OpFunctionCall %2 %14 + %246 = OpAccessChain %245 %243 %244 + %247 = OpLoad %157 %246 + %248 = OpConvertFToS %6 %247 + %250 = OpSLessThan %31 %248 %249 + OpSelectionMerge %252 None + OpBranchConditional %250 %251 %262 + %251 = OpLabel + %256 = OpAccessChain %43 %41 %105 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %157 %257 + %260 = OpFDiv %157 %258 %259 + %261 = OpFAdd %157 %255 %260 + OpStore %254 %261 + OpBranch %252 + %262 = OpLabel + %263 = OpAccessChain %245 %243 %244 + %264 = OpLoad %157 %263 + %265 = OpConvertFToS %6 %264 + %267 = OpSLessThan %31 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %275 + %268 = OpLabel + %270 = OpAccessChain %43 %41 %22 + %271 = OpLoad %6 %270 + %272 = OpConvertSToF %157 %271 + %273 = OpFDiv %157 %272 %259 + %274 = OpFAdd %157 %255 %273 + OpStore %254 %274 + OpBranch %269 + %275 = OpLabel + %276 = OpAccessChain %245 %243 %244 + %277 = OpLoad %157 %276 + %278 = OpConvertFToS %6 %277 + %280 = OpSLessThan %31 %278 %279 + OpSelectionMerge %282 None + OpBranchConditional %280 %281 %288 + %281 = OpLabel + %283 = OpAccessChain %43 %41 %136 + %284 = OpLoad %6 %283 + %285 = OpConvertSToF %157 %284 + %286 = OpFDiv %157 %285 %259 + %287 = OpFAdd %157 %255 %286 + OpStore %254 %287 + OpBranch %282 + %288 = OpLabel + %289 = OpAccessChain %245 %243 %244 + %290 = OpLoad %157 %289 + %291 = OpConvertFToS %6 %290 + %293 = OpSLessThan %31 %291 %292 + OpSelectionMerge %295 None + OpBranchConditional %293 %294 %301 + %294 = OpLabel + %296 = OpAccessChain %43 %41 %188 + %297 = OpLoad %6 %296 + %298 = OpConvertSToF %157 %297 + %299 = OpFDiv %157 %298 %259 + %300 = OpFAdd %157 %255 %299 + OpStore %254 %300 + OpBranch %295 + %301 = OpLabel + %302 = OpAccessChain %245 %243 %244 + %303 = OpLoad %157 %302 + %304 = OpConvertFToS %6 %303 + %306 = OpSLessThan %31 %304 %305 + OpSelectionMerge %308 None + OpBranchConditional %306 %307 %323 + %307 = OpLabel + OpStore %309 %22 + OpBranch %310 + %310 = OpLabel + OpLoopMerge %312 %313 None + OpBranch %314 + %314 = OpLabel + %315 = OpLoad %6 %309 + %316 = OpAccessChain %163 %161 %105 %162 + %317 = OpLoad %157 %316 + %318 = OpConvertFToS %6 %317 + %319 = OpSGreaterThan %31 %315 %318 + OpBranchConditional %319 %311 %312 + %311 = OpLabel + OpTerminateInvocation + %313 = OpLabel + OpBranch %310 + %312 = OpLabel + OpBranch %308 + %323 = OpLabel + %324 = OpAccessChain %245 %243 %244 + %325 = OpLoad %157 %324 + %326 = OpConvertFToS %6 %325 + %328 = OpSLessThan %31 %326 %327 + OpSelectionMerge %330 None + OpBranchConditional %328 %329 %337 + %329 = OpLabel + %332 = OpAccessChain %43 %41 %331 + %333 = OpLoad %6 %332 + %334 = OpConvertSToF %157 %333 + %335 = OpFDiv %157 %334 %259 + %336 = OpFAdd %157 %255 %335 + OpStore %254 %336 + OpBranch %330 + %337 = OpLabel + %338 = OpAccessChain %245 %243 %244 + %339 = OpLoad %157 %338 + %340 = OpConvertFToS %6 %339 + %342 = OpSLessThan %31 %340 %341 + OpSelectionMerge %344 None + OpBranchConditional %342 %343 %351 + %343 = OpLabel + %346 = OpAccessChain %43 %41 %345 + %347 = OpLoad %6 %346 + %348 = OpConvertSToF %157 %347 + %349 = OpFDiv %157 %348 %259 + %350 = OpFAdd %157 %255 %349 + OpStore %254 %350 + OpBranch %344 + %351 = OpLabel + %352 = OpAccessChain %245 %243 %244 + %353 = OpLoad %157 %352 + %354 = OpConvertFToS %6 %353 + %356 = OpSLessThan %31 %354 %355 + OpSelectionMerge %358 None + OpBranchConditional %356 %357 %365 + %357 = OpLabel + %360 = OpAccessChain %43 %41 %359 + %361 = OpLoad %6 %360 + %362 = OpConvertSToF %157 %361 + %363 = OpFDiv %157 %362 %259 + %364 = OpFAdd %157 %255 %363 + OpStore %254 %364 + OpBranch %358 + %365 = OpLabel + %366 = OpAccessChain %245 %243 %244 + %367 = OpLoad %157 %366 + %368 = OpConvertFToS %6 %367 + %370 = OpSLessThan %31 %368 %369 + OpSelectionMerge %372 None + OpBranchConditional %370 %371 %379 + %371 = OpLabel + %374 = OpAccessChain %43 %41 %373 + %375 = OpLoad %6 %374 + %376 = OpConvertSToF %157 %375 + %377 = OpFDiv %157 %376 %259 + %378 = OpFAdd %157 %255 %377 + OpStore %254 %378 + OpBranch %372 + %379 = OpLabel + OpTerminateInvocation + %372 = OpLabel + OpBranch %358 + %358 = OpLabel + OpBranch %344 + %344 = OpLabel + OpBranch %330 + %330 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %295 + %295 = OpLabel + OpBranch %282 + %282 = OpLabel + OpBranch %269 + %269 = OpLabel + OpBranch %252 + %252 = OpLabel + %383 = OpLoad %157 %254 + %385 = OpCompositeConstruct %384 %383 %383 %383 + %387 = OpCompositeExtract %157 %385 0 + %388 = OpCompositeExtract %157 %385 1 + %389 = OpCompositeExtract %157 %385 2 + %390 = OpCompositeConstruct %241 %387 %388 %389 %386 + OpStore %382 %390 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %11 = OpFunctionParameter %7 + %13 = OpLabel + %16 = OpVariable %7 Function + %18 = OpVariable %7 Function + %20 = OpVariable %7 Function + %87 = OpVariable %7 Function + %17 = OpLoad %6 %9 + OpStore %16 %17 + %19 = OpLoad %6 %9 + OpStore %18 %19 + %21 = OpLoad %6 %10 + %23 = OpIAdd %6 %21 %22 + OpStore %20 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %18 + %30 = OpLoad %6 %10 + %32 = OpSLessThanEqual %31 %29 %30 + %33 = OpLoad %6 %20 + %34 = OpLoad %6 %11 + %35 = OpSLessThanEqual %31 %33 %34 + %36 = OpLogicalAnd %31 %32 %35 + OpBranchConditional %36 %25 %26 + %25 = OpLabel + %42 = OpLoad %6 %18 + %44 = OpAccessChain %43 %41 %42 + %45 = OpLoad %6 %44 + %46 = OpLoad %6 %20 + %47 = OpAccessChain %43 %41 %46 + %48 = OpLoad %6 %47 + %49 = OpSLessThan %31 %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %60 + %50 = OpLabel + %53 = OpLoad %6 %16 + %54 = OpIAdd %6 %53 %22 + OpStore %16 %54 + %55 = OpLoad %6 %18 + %56 = OpIAdd %6 %55 %22 + OpStore %18 %56 + %57 = OpAccessChain %43 %41 %55 + %58 = OpLoad %6 %57 + %59 = OpAccessChain %43 %52 %53 + OpStore %59 %58 + OpBranch %51 + %60 = OpLabel + %61 = OpLoad %6 %16 + %62 = OpIAdd %6 %61 %22 + OpStore %16 %62 + %63 = OpLoad %6 %20 + %64 = OpIAdd %6 %63 %22 + OpStore %20 %64 + %65 = OpAccessChain %43 %41 %63 + %66 = OpLoad %6 %65 + %67 = OpAccessChain %43 %52 %61 + OpStore %67 %66 + OpBranch %51 + %51 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %6 %18 + %75 = OpSLessThan %31 %73 %74 + %76 = OpLoad %6 %18 + %77 = OpLoad %6 %10 + %78 = OpSLessThanEqual %31 %76 %77 + %79 = OpLogicalAnd %31 %75 %78 + OpBranchConditional %79 %69 %70 + %69 = OpLabel + %80 = OpLoad %6 %16 + %81 = OpIAdd %6 %80 %22 + OpStore %16 %81 + %82 = OpLoad %6 %18 + %83 = OpIAdd %6 %82 %22 + OpStore %18 %83 + %84 = OpAccessChain %43 %41 %82 + %85 = OpLoad %6 %84 + %86 = OpAccessChain %43 %52 %80 + OpStore %86 %85 + OpBranch %71 + %71 = OpLabel + OpBranch %68 + %70 = OpLabel + %88 = OpLoad %6 %9 + OpStore %87 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %6 %87 + %95 = OpLoad %6 %11 + %96 = OpSLessThanEqual %31 %94 %95 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %97 = OpLoad %6 %87 + %98 = OpLoad %6 %87 + %99 = OpAccessChain %43 %52 %98 + %100 = OpLoad %6 %99 + %101 = OpAccessChain %43 %41 %97 + OpStore %101 %100 + OpBranch %92 + %92 = OpLabel + %102 = OpLoad %6 %87 + %103 = OpIAdd %6 %102 %22 + OpStore %87 %103 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %104 = OpVariable %7 Function + %106 = OpVariable %7 Function + %108 = OpVariable %7 Function + %117 = OpVariable %7 Function + %127 = OpVariable %7 Function + %129 = OpVariable %7 Function + %134 = OpVariable %7 Function + %143 = OpVariable %7 Function + %145 = OpVariable %7 Function + %147 = OpVariable %7 Function + OpStore %104 %105 + OpStore %106 %107 + OpStore %108 %22 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %6 %108 + %115 = OpLoad %6 %106 + %116 = OpSLessThanEqual %31 %114 %115 + OpBranchConditional %116 %110 %111 + %110 = OpLabel + %118 = OpLoad %6 %104 + OpStore %117 %118 + OpBranch %119 + %119 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %6 %117 + %125 = OpLoad %6 %106 + %126 = OpSLessThan %31 %124 %125 + OpBranchConditional %126 %120 %121 + %120 = OpLabel + %128 = OpLoad %6 %117 + OpStore %127 %128 + %130 = OpLoad %6 %117 + %131 = OpLoad %6 %108 + %132 = OpIAdd %6 %130 %131 + %133 = OpISub %6 %132 %22 + OpStore %129 %133 + %135 = OpLoad %6 %117 + %137 = OpLoad %6 %108 + %138 = OpIMul %6 %136 %137 + %139 = OpIAdd %6 %135 %138 + %140 = OpISub %6 %139 %22 + %141 = OpLoad %6 %106 + %142 = OpExtInst %6 %1 SMin %140 %141 + OpStore %134 %142 + %144 = OpLoad %6 %127 + OpStore %143 %144 + %146 = OpLoad %6 %129 + OpStore %145 %146 + %148 = OpLoad %6 %134 + OpStore %147 %148 + %149 = OpFunctionCall %2 %12 %143 %145 %147 + OpBranch %122 + %122 = OpLabel + %150 = OpLoad %6 %108 + %151 = OpIMul %6 %136 %150 + %152 = OpLoad %6 %117 + %153 = OpIAdd %6 %152 %151 + OpStore %117 %153 + OpBranch %119 + %121 = OpLabel + OpBranch %112 + %112 = OpLabel + %154 = OpLoad %6 %108 + %155 = OpIMul %6 %136 %154 + OpStore %108 %155 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp.amber b/vulkan/amber/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp.amber new file mode 100644 index 0000000..1b45fef --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp.amber @@ -0,0 +1,1314 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with conditional bitwise or clamped + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# struct QuicksortObject +# { +# int numbers[10]; +# }; +# +# QuicksortObject obj; +# +# void swap(int i, int j) +# { +# int temp = obj.numbers[i]; +# obj.numbers[i] = obj.numbers[j]; +# obj.numbers[j] = temp; +# } +# int performPartition(int l, int h) +# { +# int pivot = obj.numbers[h]; +# int i = l - 1; +# for (int j = l; j <= h - 1; j++) +# { +# if (obj.numbers[j] <= pivot) +# { +# i++; +# swap(i, j); +# } +# } +# i++; +# swap(i, h); +# return i; +# } +# void quicksort() +# { +# int l = 0, h = 9; +# int stack[10]; +# int top = -1; +# stack[++top] = l; +# stack[++top] = h; +# while (top >= 0) +# { +# h = stack[top--]; +# l = stack[top--]; +# int p = performPartition(l, h); +# if (p - 1 > l) +# { +# stack[++top] = l; +# stack[++top] = p - 1; +# } +# if (p + 1 < h) +# { +# stack[++top] = p + 1; +# stack[++top] = h; +# } +# } +# } +# void main() +# { +# for (int i = 0; i < 10; i++) +# { +# obj.numbers[i] = (10 - i); +# obj.numbers[i] = obj.numbers[i] * obj.numbers[i]; +# } +# quicksort(); +# vec2 uv = gl_FragCoord.xy / resolution; +# vec3 color = vec3(1.0, 2.0, 3.0); +# color.x += float(obj.numbers[0]); +# if (uv.x > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[1]); +# } +# if (uv.x > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[2]); +# } +# if (uv.x > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[3]); +# } +# color.y += float(obj.numbers[4]); +# if (uv.y > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[5]); +# } +# if (uv.y > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[6]); +# } +# if (uv.y > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[7]); +# } +# color.z += float(obj.numbers[8]); +# if (abs(uv.x - uv.y) < 0.25) +# { +# color.x += float(obj.numbers[9]); +# } +# _GLF_color = vec4(normalize(color), 1.0); +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 331 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %183 %324 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "swap(i1;i1;" + OpName %9 "i" + OpName %10 "j" + OpName %16 "performPartition(i1;i1;" + OpName %14 "l" + OpName %15 "h" + OpName %18 "quicksort(" + OpName %20 "temp" + OpName %24 "QuicksortObject" + OpMemberName %24 0 "numbers" + OpName %26 "obj" + OpName %40 "pivot" + OpName %44 "i" + OpName %48 "j" + OpName %69 "param" + OpName %71 "param" + OpName %78 "param" + OpName %80 "param" + OpName %86 "l" + OpName %87 "h" + OpName %89 "top" + OpName %92 "stack" + OpName %116 "p" + OpName %117 "param" + OpName %119 "param" + OpName %152 "i" + OpName %180 "uv" + OpName %183 "gl_FragCoord" + OpName %186 "buf0" + OpMemberName %186 0 "resolution" + OpName %188 "" + OpName %195 "color" + OpName %324 "_GLF_color" + OpDecorate %183 BuiltIn FragCoord + OpMemberDecorate %186 0 Offset 0 + OpDecorate %186 Block + OpDecorate %188 DescriptorSet 0 + OpDecorate %188 Binding 0 + OpDecorate %324 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeFunction %6 %7 %7 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 0 + %29 = OpTypePointer Private %6 + %46 = OpConstant %6 1 + %58 = OpTypeBool + %88 = OpConstant %6 9 + %90 = OpConstant %6 -1 + %91 = OpTypePointer Function %23 + %159 = OpConstant %6 10 + %177 = OpTypeFloat 32 + %178 = OpTypeVector %177 2 + %179 = OpTypePointer Function %178 + %181 = OpTypeVector %177 4 + %182 = OpTypePointer Input %181 + %183 = OpVariable %182 Input + %186 = OpTypeStruct %178 + %187 = OpTypePointer Uniform %186 + %188 = OpVariable %187 Uniform + %189 = OpTypePointer Uniform %178 + %193 = OpTypeVector %177 3 + %194 = OpTypePointer Function %193 + %196 = OpConstant %177 1 + %197 = OpConstant %177 2 + %198 = OpConstant %177 3 + %199 = OpConstantComposite %193 %196 %197 %198 + %203 = OpConstant %21 0 + %204 = OpTypePointer Function %177 + %211 = OpConstant %177 0.25 + %224 = OpConstant %177 0.5 + %228 = OpConstant %6 2 + %232 = OpConstant %21 1 + %239 = OpConstant %177 0.75 + %243 = OpConstant %6 3 + %247 = OpConstant %21 2 + %252 = OpConstant %6 4 + %265 = OpConstant %6 5 + %278 = OpConstant %6 6 + %291 = OpConstant %6 7 + %299 = OpConstant %6 8 + %323 = OpTypePointer Output %181 + %324 = OpVariable %323 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %152 = OpVariable %7 Function + %180 = OpVariable %179 Function + %195 = OpVariable %194 Function + OpStore %152 %27 + OpBranch %153 + %153 = OpLabel + OpLoopMerge %155 %156 None + OpBranch %157 + %157 = OpLabel + %158 = OpLoad %6 %152 + %160 = OpSLessThan %58 %158 %159 + OpBranchConditional %160 %154 %155 + %154 = OpLabel + %161 = OpLoad %6 %152 + %162 = OpLoad %6 %152 + %163 = OpISub %6 %159 %162 + %164 = OpAccessChain %29 %26 %27 %161 + OpStore %164 %163 + %165 = OpLoad %6 %152 + %166 = OpLoad %6 %152 + %167 = OpAccessChain %29 %26 %27 %166 + %168 = OpLoad %6 %167 + %169 = OpLoad %6 %152 + %170 = OpAccessChain %29 %26 %27 %169 + %171 = OpLoad %6 %170 + %172 = OpIMul %6 %168 %171 + %173 = OpAccessChain %29 %26 %27 %165 + OpStore %173 %172 + OpBranch %156 + %156 = OpLabel + %174 = OpLoad %6 %152 + %175 = OpIAdd %6 %174 %46 + OpStore %152 %175 + OpBranch %153 + %155 = OpLabel + %176 = OpFunctionCall %2 %18 + %184 = OpLoad %181 %183 + %185 = OpVectorShuffle %178 %184 %184 0 1 + %190 = OpAccessChain %189 %188 %27 + %191 = OpLoad %178 %190 + %192 = OpFDiv %178 %185 %191 + OpStore %180 %192 + OpStore %195 %199 + %200 = OpAccessChain %29 %26 %27 %27 + %201 = OpLoad %6 %200 + %202 = OpConvertSToF %177 %201 + %205 = OpAccessChain %204 %195 %203 + %206 = OpLoad %177 %205 + %207 = OpFAdd %177 %206 %202 + %208 = OpAccessChain %204 %195 %203 + OpStore %208 %207 + %209 = OpAccessChain %204 %180 %203 + %210 = OpLoad %177 %209 + %212 = OpFOrdGreaterThan %58 %210 %211 + OpSelectionMerge %214 None + OpBranchConditional %212 %213 %214 + %213 = OpLabel + %215 = OpAccessChain %29 %26 %27 %46 + %216 = OpLoad %6 %215 + %217 = OpConvertSToF %177 %216 + %218 = OpAccessChain %204 %195 %203 + %219 = OpLoad %177 %218 + %220 = OpFAdd %177 %219 %217 + %221 = OpAccessChain %204 %195 %203 + OpStore %221 %220 + OpBranch %214 + %214 = OpLabel + %222 = OpAccessChain %204 %180 %203 + %223 = OpLoad %177 %222 + %225 = OpFOrdGreaterThan %58 %223 %224 + OpSelectionMerge %227 None + OpBranchConditional %225 %226 %227 + %226 = OpLabel + %229 = OpAccessChain %29 %26 %27 %228 + %230 = OpLoad %6 %229 + %231 = OpConvertSToF %177 %230 + %233 = OpAccessChain %204 %195 %232 + %234 = OpLoad %177 %233 + %235 = OpFAdd %177 %234 %231 + %236 = OpAccessChain %204 %195 %232 + OpStore %236 %235 + OpBranch %227 + %227 = OpLabel + %237 = OpAccessChain %204 %180 %203 + %238 = OpLoad %177 %237 + %240 = OpFOrdGreaterThan %58 %238 %239 + OpSelectionMerge %242 None + OpBranchConditional %240 %241 %242 + %241 = OpLabel + %244 = OpAccessChain %29 %26 %27 %243 + %245 = OpLoad %6 %244 + %246 = OpConvertSToF %177 %245 + %248 = OpAccessChain %204 %195 %247 + %249 = OpLoad %177 %248 + %250 = OpFAdd %177 %249 %246 + %251 = OpAccessChain %204 %195 %247 + OpStore %251 %250 + OpBranch %242 + %242 = OpLabel + %253 = OpAccessChain %29 %26 %27 %252 + %254 = OpLoad %6 %253 + %255 = OpConvertSToF %177 %254 + %256 = OpAccessChain %204 %195 %232 + %257 = OpLoad %177 %256 + %258 = OpFAdd %177 %257 %255 + %259 = OpAccessChain %204 %195 %232 + OpStore %259 %258 + %260 = OpAccessChain %204 %180 %232 + %261 = OpLoad %177 %260 + %262 = OpFOrdGreaterThan %58 %261 %211 + OpSelectionMerge %264 None + OpBranchConditional %262 %263 %264 + %263 = OpLabel + %266 = OpAccessChain %29 %26 %27 %265 + %267 = OpLoad %6 %266 + %268 = OpConvertSToF %177 %267 + %269 = OpAccessChain %204 %195 %203 + %270 = OpLoad %177 %269 + %271 = OpFAdd %177 %270 %268 + %272 = OpAccessChain %204 %195 %203 + OpStore %272 %271 + OpBranch %264 + %264 = OpLabel + %273 = OpAccessChain %204 %180 %232 + %274 = OpLoad %177 %273 + %275 = OpFOrdGreaterThan %58 %274 %224 + OpSelectionMerge %277 None + OpBranchConditional %275 %276 %277 + %276 = OpLabel + %279 = OpAccessChain %29 %26 %27 %278 + %280 = OpLoad %6 %279 + %281 = OpConvertSToF %177 %280 + %282 = OpAccessChain %204 %195 %232 + %283 = OpLoad %177 %282 + %284 = OpFAdd %177 %283 %281 + %285 = OpAccessChain %204 %195 %232 + OpStore %285 %284 + OpBranch %277 + %277 = OpLabel + %286 = OpAccessChain %204 %180 %232 + %287 = OpLoad %177 %286 + %288 = OpFOrdGreaterThan %58 %287 %239 + OpSelectionMerge %290 None + OpBranchConditional %288 %289 %290 + %289 = OpLabel + %292 = OpAccessChain %29 %26 %27 %291 + %293 = OpLoad %6 %292 + %294 = OpConvertSToF %177 %293 + %295 = OpAccessChain %204 %195 %247 + %296 = OpLoad %177 %295 + %297 = OpFAdd %177 %296 %294 + %298 = OpAccessChain %204 %195 %247 + OpStore %298 %297 + OpBranch %290 + %290 = OpLabel + %300 = OpAccessChain %29 %26 %27 %299 + %301 = OpLoad %6 %300 + %302 = OpConvertSToF %177 %301 + %303 = OpAccessChain %204 %195 %247 + %304 = OpLoad %177 %303 + %305 = OpFAdd %177 %304 %302 + %306 = OpAccessChain %204 %195 %247 + OpStore %306 %305 + %307 = OpAccessChain %204 %180 %203 + %308 = OpLoad %177 %307 + %309 = OpAccessChain %204 %180 %232 + %310 = OpLoad %177 %309 + %311 = OpFSub %177 %308 %310 + %312 = OpExtInst %177 %1 FAbs %311 + %313 = OpFOrdLessThan %58 %312 %211 + OpSelectionMerge %315 None + OpBranchConditional %313 %314 %315 + %314 = OpLabel + %316 = OpAccessChain %29 %26 %27 %88 + %317 = OpLoad %6 %316 + %318 = OpConvertSToF %177 %317 + %319 = OpAccessChain %204 %195 %203 + %320 = OpLoad %177 %319 + %321 = OpFAdd %177 %320 %318 + %322 = OpAccessChain %204 %195 %203 + OpStore %322 %321 + OpBranch %315 + %315 = OpLabel + %325 = OpLoad %193 %195 + %326 = OpExtInst %193 %1 Normalize %325 + %327 = OpCompositeExtract %177 %326 0 + %328 = OpCompositeExtract %177 %326 1 + %329 = OpCompositeExtract %177 %326 2 + %330 = OpCompositeConstruct %181 %327 %328 %329 %196 + OpStore %324 %330 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %20 = OpVariable %7 Function + %28 = OpLoad %6 %9 + %30 = OpAccessChain %29 %26 %27 %28 + %31 = OpLoad %6 %30 + OpStore %20 %31 + %32 = OpLoad %6 %9 + %33 = OpLoad %6 %10 + %34 = OpAccessChain %29 %26 %27 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %29 %26 %27 %32 + OpStore %36 %35 + %37 = OpLoad %6 %10 + %38 = OpLoad %6 %20 + %39 = OpAccessChain %29 %26 %27 %37 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %16 = OpFunction %6 None %13 + %14 = OpFunctionParameter %7 + %15 = OpFunctionParameter %7 + %17 = OpLabel + %40 = OpVariable %7 Function + %44 = OpVariable %7 Function + %48 = OpVariable %7 Function + %69 = OpVariable %7 Function + %71 = OpVariable %7 Function + %78 = OpVariable %7 Function + %80 = OpVariable %7 Function + %41 = OpLoad %6 %15 + %42 = OpAccessChain %29 %26 %27 %41 + %43 = OpLoad %6 %42 + OpStore %40 %43 + %45 = OpLoad %6 %14 + %47 = OpISub %6 %45 %46 + OpStore %44 %47 + %49 = OpLoad %6 %14 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %48 + %56 = OpLoad %6 %15 + %57 = OpISub %6 %56 %46 + %59 = OpSLessThanEqual %58 %55 %57 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %48 + %61 = OpAccessChain %29 %26 %27 %60 + %62 = OpLoad %6 %61 + %63 = OpLoad %6 %40 + %64 = OpSLessThanEqual %58 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpLoad %6 %44 + %68 = OpIAdd %6 %67 %46 + OpStore %44 %68 + %70 = OpLoad %6 %44 + OpStore %69 %70 + %72 = OpLoad %6 %48 + OpStore %71 %72 + %73 = OpFunctionCall %2 %11 %69 %71 + OpBranch %66 + %66 = OpLabel + OpBranch %53 + %53 = OpLabel + %74 = OpLoad %6 %48 + %75 = OpIAdd %6 %74 %46 + OpStore %48 %75 + OpBranch %50 + %52 = OpLabel + %76 = OpLoad %6 %44 + %77 = OpIAdd %6 %76 %46 + OpStore %44 %77 + %79 = OpLoad %6 %44 + OpStore %78 %79 + %81 = OpLoad %6 %15 + OpStore %80 %81 + %82 = OpFunctionCall %2 %11 %78 %80 + %83 = OpLoad %6 %44 + OpReturnValue %83 + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %86 = OpVariable %7 Function + %87 = OpVariable %7 Function + %89 = OpVariable %7 Function + %92 = OpVariable %91 Function + %116 = OpVariable %7 Function + %117 = OpVariable %7 Function + %119 = OpVariable %7 Function + OpStore %86 %27 + OpStore %87 %88 + OpStore %89 %90 + %93 = OpLoad %6 %89 + %94 = OpIAdd %6 %93 %46 + OpStore %89 %94 + %95 = OpLoad %6 %86 + %96 = OpAccessChain %7 %92 %94 + OpStore %96 %95 + %97 = OpLoad %6 %89 + %98 = OpIAdd %6 %97 %46 + OpStore %89 %98 + %99 = OpLoad %6 %87 + %100 = OpAccessChain %7 %92 %98 + OpStore %100 %99 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %6 %89 + %107 = OpSGreaterThanEqual %58 %106 %27 + OpBranchConditional %107 %102 %103 + %102 = OpLabel + %108 = OpLoad %6 %89 + %109 = OpISub %6 %108 %46 + OpStore %89 %109 + %110 = OpAccessChain %7 %92 %108 + %111 = OpLoad %6 %110 + OpStore %87 %111 + %112 = OpLoad %6 %89 + %113 = OpISub %6 %112 %46 + OpStore %89 %113 + %114 = OpAccessChain %7 %92 %112 + %115 = OpLoad %6 %114 + OpStore %86 %115 + %118 = OpLoad %6 %86 + OpStore %117 %118 + %120 = OpLoad %6 %87 + OpStore %119 %120 + %121 = OpFunctionCall %6 %16 %117 %119 + OpStore %116 %121 + %122 = OpLoad %6 %116 + %123 = OpISub %6 %122 %46 + %124 = OpLoad %6 %86 + %125 = OpSGreaterThan %58 %123 %124 + OpSelectionMerge %127 None + OpBranchConditional %125 %126 %127 + %126 = OpLabel + %128 = OpLoad %6 %89 + %129 = OpIAdd %6 %128 %46 + OpStore %89 %129 + %130 = OpLoad %6 %86 + %131 = OpAccessChain %7 %92 %129 + OpStore %131 %130 + %132 = OpLoad %6 %89 + %133 = OpIAdd %6 %132 %46 + OpStore %89 %133 + %134 = OpLoad %6 %116 + %135 = OpISub %6 %134 %46 + %136 = OpAccessChain %7 %92 %133 + OpStore %136 %135 + OpBranch %127 + %127 = OpLabel + %137 = OpLoad %6 %116 + %138 = OpIAdd %6 %137 %46 + %139 = OpLoad %6 %87 + %140 = OpSLessThan %58 %138 %139 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpLoad %6 %89 + %144 = OpIAdd %6 %143 %46 + OpStore %89 %144 + %145 = OpLoad %6 %116 + %146 = OpIAdd %6 %145 %46 + %147 = OpAccessChain %7 %92 %144 + OpStore %147 %146 + %148 = OpLoad %6 %89 + %149 = OpIAdd %6 %148 %46 + OpStore %89 %149 + %150 = OpLoad %6 %87 + %151 = OpAccessChain %7 %92 %149 + OpStore %151 %150 + OpBranch %142 + %142 = OpLabel + OpBranch %104 + %104 = OpLabel + OpBranch %101 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# struct QuicksortObject +# { +# int numbers[10]; +# }; +# +# QuicksortObject obj; +# +# void swap(int i, int j) +# { +# int temp = obj.numbers[i]; +# obj.numbers[i] = obj.numbers[j]; +# obj.numbers[j] = temp; +# } +# int performPartition(int l, int h) +# { +# int pivot = obj.numbers[h]; +# int i = l - 1; +# for (int j = l; j <= h - 1; j++) +# { +# if (obj.numbers[j] <= pivot) +# { +# i++; +# swap(i, j); +# } +# } +# i++; +# swap(i, h); +# return i; +# } +# void quicksort() +# { +# int l = 0, h = 9; +# int stack[10]; +# int top = -1; +# stack[++top] = l; +# // gl_FragCoord.y >= 0.0 is always true. +# // h | (h << 0) == h +# // int_a == h +# int int_a = ((gl_FragCoord.y >= 0.0) ? (h | ((false ? 1 : (h << 0)))) : 1); +# // clamp_a == h +# int clamp_a = (clamp(h, h, int_a)); +# stack[++top] = (clamp_a / 1); +# while (top >= 0) +# { +# h = stack[top--]; +# l = stack[top--]; +# int p = performPartition(l, h); +# if (p - 1 > l) +# { +# stack[++top] = l; +# stack[++top] = p - 1; +# } +# if (p + 1 < h) +# { +# stack[++top] = p + 1; +# stack[++top] = h; +# } +# } +# } +# void main() +# { +# for (int i = 0; i < 10; i++) +# { +# obj.numbers[i] = (10 - i); +# obj.numbers[i] = obj.numbers[i] * obj.numbers[i]; +# } +# quicksort(); +# vec2 uv = gl_FragCoord.xy / resolution; +# vec3 color = vec3(1.0, 2.0, 3.0); +# color.x += float(obj.numbers[0]); +# if (uv.x > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[1]); +# } +# if (uv.x > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[2]); +# } +# if (uv.x > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[3]); +# } +# color.y += float(obj.numbers[4]); +# if (uv.y > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[5]); +# } +# if (uv.y > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[6]); +# } +# if (uv.y > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[7]); +# } +# color.z += float(obj.numbers[8]); +# if (abs(uv.x - uv.y) < 0.25) +# { +# color.x += float(obj.numbers[9]); +# } +# _GLF_color = vec4(normalize(color), 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 358 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %101 %351 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %11 "swap(i1;i1;" + OpName %9 "i" + OpName %10 "j" + OpName %16 "performPartition(i1;i1;" + OpName %14 "l" + OpName %15 "h" + OpName %18 "quicksort(" + OpName %20 "temp" + OpName %24 "QuicksortObject" + OpMemberName %24 0 "numbers" + OpName %26 "obj" + OpName %40 "pivot" + OpName %44 "i" + OpName %48 "j" + OpName %69 "param" + OpName %71 "param" + OpName %78 "param" + OpName %80 "param" + OpName %86 "l" + OpName %87 "h" + OpName %89 "top" + OpName %92 "stack" + OpName %97 "int_a" + OpName %101 "gl_FragCoord" + OpName %123 "clamp_a" + OpName %148 "p" + OpName %149 "param" + OpName %151 "param" + OpName %184 "i" + OpName %211 "uv" + OpName %214 "buf0" + OpMemberName %214 0 "resolution" + OpName %216 "" + OpName %223 "color" + OpName %351 "_GLF_color" + OpDecorate %101 BuiltIn FragCoord + OpMemberDecorate %214 0 Offset 0 + OpDecorate %214 Block + OpDecorate %216 DescriptorSet 0 + OpDecorate %216 Binding 0 + OpDecorate %351 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeFunction %6 %7 %7 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 0 + %29 = OpTypePointer Private %6 + %46 = OpConstant %6 1 + %58 = OpTypeBool + %88 = OpConstant %6 9 + %90 = OpConstant %6 -1 + %91 = OpTypePointer Function %23 + %98 = OpTypeFloat 32 + %99 = OpTypeVector %98 4 + %100 = OpTypePointer Input %99 + %101 = OpVariable %100 Input + %102 = OpConstant %21 1 + %103 = OpTypePointer Input %98 + %106 = OpConstant %98 0 + %112 = OpConstantFalse %58 + %191 = OpConstant %6 10 + %209 = OpTypeVector %98 2 + %210 = OpTypePointer Function %209 + %214 = OpTypeStruct %209 + %215 = OpTypePointer Uniform %214 + %216 = OpVariable %215 Uniform + %217 = OpTypePointer Uniform %209 + %221 = OpTypeVector %98 3 + %222 = OpTypePointer Function %221 + %224 = OpConstant %98 1 + %225 = OpConstant %98 2 + %226 = OpConstant %98 3 + %227 = OpConstantComposite %221 %224 %225 %226 + %231 = OpConstant %21 0 + %232 = OpTypePointer Function %98 + %239 = OpConstant %98 0.25 + %252 = OpConstant %98 0.5 + %256 = OpConstant %6 2 + %266 = OpConstant %98 0.75 + %270 = OpConstant %6 3 + %274 = OpConstant %21 2 + %279 = OpConstant %6 4 + %292 = OpConstant %6 5 + %305 = OpConstant %6 6 + %318 = OpConstant %6 7 + %326 = OpConstant %6 8 + %350 = OpTypePointer Output %99 + %351 = OpVariable %350 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %184 = OpVariable %7 Function + %211 = OpVariable %210 Function + %223 = OpVariable %222 Function + OpStore %184 %27 + OpBranch %185 + %185 = OpLabel + OpLoopMerge %187 %188 None + OpBranch %189 + %189 = OpLabel + %190 = OpLoad %6 %184 + %192 = OpSLessThan %58 %190 %191 + OpBranchConditional %192 %186 %187 + %186 = OpLabel + %193 = OpLoad %6 %184 + %194 = OpLoad %6 %184 + %195 = OpISub %6 %191 %194 + %196 = OpAccessChain %29 %26 %27 %193 + OpStore %196 %195 + %197 = OpLoad %6 %184 + %198 = OpLoad %6 %184 + %199 = OpAccessChain %29 %26 %27 %198 + %200 = OpLoad %6 %199 + %201 = OpLoad %6 %184 + %202 = OpAccessChain %29 %26 %27 %201 + %203 = OpLoad %6 %202 + %204 = OpIMul %6 %200 %203 + %205 = OpAccessChain %29 %26 %27 %197 + OpStore %205 %204 + OpBranch %188 + %188 = OpLabel + %206 = OpLoad %6 %184 + %207 = OpIAdd %6 %206 %46 + OpStore %184 %207 + OpBranch %185 + %187 = OpLabel + %208 = OpFunctionCall %2 %18 + %212 = OpLoad %99 %101 + %213 = OpVectorShuffle %209 %212 %212 0 1 + %218 = OpAccessChain %217 %216 %27 + %219 = OpLoad %209 %218 + %220 = OpFDiv %209 %213 %219 + OpStore %211 %220 + OpStore %223 %227 + %228 = OpAccessChain %29 %26 %27 %27 + %229 = OpLoad %6 %228 + %230 = OpConvertSToF %98 %229 + %233 = OpAccessChain %232 %223 %231 + %234 = OpLoad %98 %233 + %235 = OpFAdd %98 %234 %230 + %236 = OpAccessChain %232 %223 %231 + OpStore %236 %235 + %237 = OpAccessChain %232 %211 %231 + %238 = OpLoad %98 %237 + %240 = OpFOrdGreaterThan %58 %238 %239 + OpSelectionMerge %242 None + OpBranchConditional %240 %241 %242 + %241 = OpLabel + %243 = OpAccessChain %29 %26 %27 %46 + %244 = OpLoad %6 %243 + %245 = OpConvertSToF %98 %244 + %246 = OpAccessChain %232 %223 %231 + %247 = OpLoad %98 %246 + %248 = OpFAdd %98 %247 %245 + %249 = OpAccessChain %232 %223 %231 + OpStore %249 %248 + OpBranch %242 + %242 = OpLabel + %250 = OpAccessChain %232 %211 %231 + %251 = OpLoad %98 %250 + %253 = OpFOrdGreaterThan %58 %251 %252 + OpSelectionMerge %255 None + OpBranchConditional %253 %254 %255 + %254 = OpLabel + %257 = OpAccessChain %29 %26 %27 %256 + %258 = OpLoad %6 %257 + %259 = OpConvertSToF %98 %258 + %260 = OpAccessChain %232 %223 %102 + %261 = OpLoad %98 %260 + %262 = OpFAdd %98 %261 %259 + %263 = OpAccessChain %232 %223 %102 + OpStore %263 %262 + OpBranch %255 + %255 = OpLabel + %264 = OpAccessChain %232 %211 %231 + %265 = OpLoad %98 %264 + %267 = OpFOrdGreaterThan %58 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %269 + %268 = OpLabel + %271 = OpAccessChain %29 %26 %27 %270 + %272 = OpLoad %6 %271 + %273 = OpConvertSToF %98 %272 + %275 = OpAccessChain %232 %223 %274 + %276 = OpLoad %98 %275 + %277 = OpFAdd %98 %276 %273 + %278 = OpAccessChain %232 %223 %274 + OpStore %278 %277 + OpBranch %269 + %269 = OpLabel + %280 = OpAccessChain %29 %26 %27 %279 + %281 = OpLoad %6 %280 + %282 = OpConvertSToF %98 %281 + %283 = OpAccessChain %232 %223 %102 + %284 = OpLoad %98 %283 + %285 = OpFAdd %98 %284 %282 + %286 = OpAccessChain %232 %223 %102 + OpStore %286 %285 + %287 = OpAccessChain %232 %211 %102 + %288 = OpLoad %98 %287 + %289 = OpFOrdGreaterThan %58 %288 %239 + OpSelectionMerge %291 None + OpBranchConditional %289 %290 %291 + %290 = OpLabel + %293 = OpAccessChain %29 %26 %27 %292 + %294 = OpLoad %6 %293 + %295 = OpConvertSToF %98 %294 + %296 = OpAccessChain %232 %223 %231 + %297 = OpLoad %98 %296 + %298 = OpFAdd %98 %297 %295 + %299 = OpAccessChain %232 %223 %231 + OpStore %299 %298 + OpBranch %291 + %291 = OpLabel + %300 = OpAccessChain %232 %211 %102 + %301 = OpLoad %98 %300 + %302 = OpFOrdGreaterThan %58 %301 %252 + OpSelectionMerge %304 None + OpBranchConditional %302 %303 %304 + %303 = OpLabel + %306 = OpAccessChain %29 %26 %27 %305 + %307 = OpLoad %6 %306 + %308 = OpConvertSToF %98 %307 + %309 = OpAccessChain %232 %223 %102 + %310 = OpLoad %98 %309 + %311 = OpFAdd %98 %310 %308 + %312 = OpAccessChain %232 %223 %102 + OpStore %312 %311 + OpBranch %304 + %304 = OpLabel + %313 = OpAccessChain %232 %211 %102 + %314 = OpLoad %98 %313 + %315 = OpFOrdGreaterThan %58 %314 %266 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %317 + %316 = OpLabel + %319 = OpAccessChain %29 %26 %27 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %98 %320 + %322 = OpAccessChain %232 %223 %274 + %323 = OpLoad %98 %322 + %324 = OpFAdd %98 %323 %321 + %325 = OpAccessChain %232 %223 %274 + OpStore %325 %324 + OpBranch %317 + %317 = OpLabel + %327 = OpAccessChain %29 %26 %27 %326 + %328 = OpLoad %6 %327 + %329 = OpConvertSToF %98 %328 + %330 = OpAccessChain %232 %223 %274 + %331 = OpLoad %98 %330 + %332 = OpFAdd %98 %331 %329 + %333 = OpAccessChain %232 %223 %274 + OpStore %333 %332 + %334 = OpAccessChain %232 %211 %231 + %335 = OpLoad %98 %334 + %336 = OpAccessChain %232 %211 %102 + %337 = OpLoad %98 %336 + %338 = OpFSub %98 %335 %337 + %339 = OpExtInst %98 %1 FAbs %338 + %340 = OpFOrdLessThan %58 %339 %239 + OpSelectionMerge %342 None + OpBranchConditional %340 %341 %342 + %341 = OpLabel + %343 = OpAccessChain %29 %26 %27 %88 + %344 = OpLoad %6 %343 + %345 = OpConvertSToF %98 %344 + %346 = OpAccessChain %232 %223 %231 + %347 = OpLoad %98 %346 + %348 = OpFAdd %98 %347 %345 + %349 = OpAccessChain %232 %223 %231 + OpStore %349 %348 + OpBranch %342 + %342 = OpLabel + %352 = OpLoad %221 %223 + %353 = OpExtInst %221 %1 Normalize %352 + %354 = OpCompositeExtract %98 %353 0 + %355 = OpCompositeExtract %98 %353 1 + %356 = OpCompositeExtract %98 %353 2 + %357 = OpCompositeConstruct %99 %354 %355 %356 %224 + OpStore %351 %357 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %20 = OpVariable %7 Function + %28 = OpLoad %6 %9 + %30 = OpAccessChain %29 %26 %27 %28 + %31 = OpLoad %6 %30 + OpStore %20 %31 + %32 = OpLoad %6 %9 + %33 = OpLoad %6 %10 + %34 = OpAccessChain %29 %26 %27 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %29 %26 %27 %32 + OpStore %36 %35 + %37 = OpLoad %6 %10 + %38 = OpLoad %6 %20 + %39 = OpAccessChain %29 %26 %27 %37 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %16 = OpFunction %6 None %13 + %14 = OpFunctionParameter %7 + %15 = OpFunctionParameter %7 + %17 = OpLabel + %40 = OpVariable %7 Function + %44 = OpVariable %7 Function + %48 = OpVariable %7 Function + %69 = OpVariable %7 Function + %71 = OpVariable %7 Function + %78 = OpVariable %7 Function + %80 = OpVariable %7 Function + %41 = OpLoad %6 %15 + %42 = OpAccessChain %29 %26 %27 %41 + %43 = OpLoad %6 %42 + OpStore %40 %43 + %45 = OpLoad %6 %14 + %47 = OpISub %6 %45 %46 + OpStore %44 %47 + %49 = OpLoad %6 %14 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %48 + %56 = OpLoad %6 %15 + %57 = OpISub %6 %56 %46 + %59 = OpSLessThanEqual %58 %55 %57 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %48 + %61 = OpAccessChain %29 %26 %27 %60 + %62 = OpLoad %6 %61 + %63 = OpLoad %6 %40 + %64 = OpSLessThanEqual %58 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpLoad %6 %44 + %68 = OpIAdd %6 %67 %46 + OpStore %44 %68 + %70 = OpLoad %6 %44 + OpStore %69 %70 + %72 = OpLoad %6 %48 + OpStore %71 %72 + %73 = OpFunctionCall %2 %11 %69 %71 + OpBranch %66 + %66 = OpLabel + OpBranch %53 + %53 = OpLabel + %74 = OpLoad %6 %48 + %75 = OpIAdd %6 %74 %46 + OpStore %48 %75 + OpBranch %50 + %52 = OpLabel + %76 = OpLoad %6 %44 + %77 = OpIAdd %6 %76 %46 + OpStore %44 %77 + %79 = OpLoad %6 %44 + OpStore %78 %79 + %81 = OpLoad %6 %15 + OpStore %80 %81 + %82 = OpFunctionCall %2 %11 %78 %80 + %83 = OpLoad %6 %44 + OpReturnValue %83 + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %86 = OpVariable %7 Function + %87 = OpVariable %7 Function + %89 = OpVariable %7 Function + %92 = OpVariable %91 Function + %97 = OpVariable %7 Function + %108 = OpVariable %7 Function + %113 = OpVariable %7 Function + %123 = OpVariable %7 Function + %148 = OpVariable %7 Function + %149 = OpVariable %7 Function + %151 = OpVariable %7 Function + OpStore %86 %27 + OpStore %87 %88 + OpStore %89 %90 + %93 = OpLoad %6 %89 + %94 = OpIAdd %6 %93 %46 + OpStore %89 %94 + %95 = OpLoad %6 %86 + %96 = OpAccessChain %7 %92 %94 + OpStore %96 %95 + %104 = OpAccessChain %103 %101 %102 + %105 = OpLoad %98 %104 + %107 = OpFOrdGreaterThanEqual %58 %105 %106 + OpSelectionMerge %110 None + OpBranchConditional %107 %109 %121 + %109 = OpLabel + %111 = OpLoad %6 %87 + OpSelectionMerge %115 None + OpBranchConditional %112 %114 %116 + %114 = OpLabel + OpStore %113 %46 + OpBranch %115 + %116 = OpLabel + %117 = OpLoad %6 %87 + %118 = OpShiftLeftLogical %6 %117 %27 + OpStore %113 %118 + OpBranch %115 + %115 = OpLabel + %119 = OpLoad %6 %113 + %120 = OpBitwiseOr %6 %111 %119 + OpStore %108 %120 + OpBranch %110 + %121 = OpLabel + OpStore %108 %46 + OpBranch %110 + %110 = OpLabel + %122 = OpLoad %6 %108 + OpStore %97 %122 + %124 = OpLoad %6 %87 + %125 = OpLoad %6 %87 + %126 = OpLoad %6 %97 + %127 = OpExtInst %6 %1 SClamp %124 %125 %126 + OpStore %123 %127 + %128 = OpLoad %6 %89 + %129 = OpIAdd %6 %128 %46 + OpStore %89 %129 + %130 = OpLoad %6 %123 + %131 = OpSDiv %6 %130 %46 + %132 = OpAccessChain %7 %92 %129 + OpStore %132 %131 + OpBranch %133 + %133 = OpLabel + OpLoopMerge %135 %136 None + OpBranch %137 + %137 = OpLabel + %138 = OpLoad %6 %89 + %139 = OpSGreaterThanEqual %58 %138 %27 + OpBranchConditional %139 %134 %135 + %134 = OpLabel + %140 = OpLoad %6 %89 + %141 = OpISub %6 %140 %46 + OpStore %89 %141 + %142 = OpAccessChain %7 %92 %140 + %143 = OpLoad %6 %142 + OpStore %87 %143 + %144 = OpLoad %6 %89 + %145 = OpISub %6 %144 %46 + OpStore %89 %145 + %146 = OpAccessChain %7 %92 %144 + %147 = OpLoad %6 %146 + OpStore %86 %147 + %150 = OpLoad %6 %86 + OpStore %149 %150 + %152 = OpLoad %6 %87 + OpStore %151 %152 + %153 = OpFunctionCall %6 %16 %149 %151 + OpStore %148 %153 + %154 = OpLoad %6 %148 + %155 = OpISub %6 %154 %46 + %156 = OpLoad %6 %86 + %157 = OpSGreaterThan %58 %155 %156 + OpSelectionMerge %159 None + OpBranchConditional %157 %158 %159 + %158 = OpLabel + %160 = OpLoad %6 %89 + %161 = OpIAdd %6 %160 %46 + OpStore %89 %161 + %162 = OpLoad %6 %86 + %163 = OpAccessChain %7 %92 %161 + OpStore %163 %162 + %164 = OpLoad %6 %89 + %165 = OpIAdd %6 %164 %46 + OpStore %89 %165 + %166 = OpLoad %6 %148 + %167 = OpISub %6 %166 %46 + %168 = OpAccessChain %7 %92 %165 + OpStore %168 %167 + OpBranch %159 + %159 = OpLabel + %169 = OpLoad %6 %148 + %170 = OpIAdd %6 %169 %46 + %171 = OpLoad %6 %87 + %172 = OpSLessThan %58 %170 %171 + OpSelectionMerge %174 None + OpBranchConditional %172 %173 %174 + %173 = OpLabel + %175 = OpLoad %6 %89 + %176 = OpIAdd %6 %175 %46 + OpStore %89 %176 + %177 = OpLoad %6 %148 + %178 = OpIAdd %6 %177 %46 + %179 = OpAccessChain %7 %92 %176 + OpStore %179 %178 + %180 = OpLoad %6 %89 + %181 = OpIAdd %6 %180 %46 + OpStore %89 %181 + %182 = OpLoad %6 %87 + %183 = OpAccessChain %7 %92 %181 + OpStore %183 %182 + OpBranch %174 + %174 = OpLabel + OpBranch %136 + %136 = OpLabel + OpBranch %133 + %135 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-quicksort-for-loop-with-injection.amber b/vulkan/amber/graphicsfuzz/stable-quicksort-for-loop-with-injection.amber new file mode 100644 index 0000000..9ef350c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-quicksort-for-loop-with-injection.amber @@ -0,0 +1,1438 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: A fragment shader with a for loop containing injection + +# The test passes because both shaders render the same image. + +# reference_vertex_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# vec4 _GLF_FragCoord; +# +# layout(location = 0) in vec4 _GLF_pos; +# +# layout(location = 0) out vec4 frag_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 resolution; +# }; +# struct QuicksortObject { +# int numbers[10]; +# } ; +# +# QuicksortObject obj; +# +# void swap(int i, int j) +# { +# int temp = obj.numbers[i]; +# obj.numbers[i] = obj.numbers[j]; +# obj.numbers[j] = temp; +# } +# int performPartition(int l, int h) +# { +# int pivot = obj.numbers[h]; +# int i = (l - 1); +# for(int j = l; j <= h - 1; j ++) +# { +# if(obj.numbers[j] <= pivot) +# { +# i ++; +# swap(i, j); +# } +# } +# swap(i + 1, h); +# return (i + 1); +# } +# void quicksort() +# { +# int l = 0, h = 9; +# int stack[10]; +# int top = - 1; +# stack[++ top] = l; +# stack[++ top] = h; +# while(top >= 0) +# { +# h = stack[top --]; +# l = stack[top --]; +# int p = performPartition(l, h); +# if(p - 1 > l) +# { +# stack[++ top] = l; +# stack[++ top] = p - 1; +# } +# if(p + 1 < h) +# { +# stack[++ top] = p + 1; +# stack[++ top] = h; +# } +# } +# } +# void main() +# { +# _GLF_FragCoord = (_GLF_pos + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0); +# for(int i = 0; i < 10; i ++) +# { +# obj.numbers[i] = (10 - i); +# obj.numbers[i] = obj.numbers[i] * obj.numbers[i]; +# } +# quicksort(); +# vec2 uv = _GLF_FragCoord.xy / resolution; +# vec3 color = vec3(1.0, 2.0, 3.0); +# color.x += float(obj.numbers[0]); +# if(uv.x > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[1]); +# } +# if(uv.x > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[2]); +# } +# if(uv.x > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[3]); +# } +# color.y += float(obj.numbers[4]); +# if(uv.y > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[5]); +# } +# if(uv.y > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[6]); +# } +# if(uv.y > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[7]); +# } +# color.z += float(obj.numbers[8]); +# if(abs(uv.x - uv.y) < 0.25) +# { +# color.x += float(obj.numbers[9]); +# } +# frag_color = vec4(normalize(color), 1.0); +# gl_Position = _GLF_pos; +# } +SHADER vertex reference_vertex_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 345 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main" %157 %333 %342 + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "swap(i1;i1;" + OpName %9 "i" + OpName %10 "j" + OpName %16 "performPartition(i1;i1;" + OpName %14 "l" + OpName %15 "h" + OpName %18 "quicksort(" + OpName %20 "temp" + OpName %24 "QuicksortObject" + OpMemberName %24 0 "numbers" + OpName %26 "obj" + OpName %40 "pivot" + OpName %44 "i" + OpName %48 "j" + OpName %69 "param" + OpName %71 "param" + OpName %78 "param" + OpName %79 "param" + OpName %86 "l" + OpName %87 "h" + OpName %89 "top" + OpName %92 "stack" + OpName %116 "p" + OpName %117 "param" + OpName %119 "param" + OpName %155 "_GLF_FragCoord" + OpName %157 "_GLF_pos" + OpName %166 "i" + OpName %193 "uv" + OpName %196 "buf0" + OpMemberName %196 0 "resolution" + OpName %198 "" + OpName %205 "color" + OpName %333 "frag_color" + OpName %340 "gl_PerVertex" + OpMemberName %340 0 "gl_Position" + OpMemberName %340 1 "gl_PointSize" + OpName %342 "" + OpDecorate %157 Location 0 + OpMemberDecorate %196 0 Offset 0 + OpDecorate %196 Block + OpDecorate %198 DescriptorSet 0 + OpDecorate %198 Binding 0 + OpDecorate %333 Location 0 + OpMemberDecorate %340 0 BuiltIn Position + OpMemberDecorate %340 1 BuiltIn PointSize + OpDecorate %340 Block + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeFunction %6 %7 %7 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 0 + %29 = OpTypePointer Private %6 + %46 = OpConstant %6 1 + %58 = OpTypeBool + %88 = OpConstant %6 9 + %90 = OpConstant %6 -1 + %91 = OpTypePointer Function %23 + %152 = OpTypeFloat 32 + %153 = OpTypeVector %152 4 + %154 = OpTypePointer Private %153 + %155 = OpVariable %154 Private + %156 = OpTypePointer Input %153 + %157 = OpVariable %156 Input + %159 = OpConstant %152 1 + %160 = OpConstant %152 0 + %161 = OpConstantComposite %153 %159 %159 %160 %160 + %163 = OpConstant %152 128 + %164 = OpConstantComposite %153 %163 %163 %159 %159 + %173 = OpConstant %6 10 + %191 = OpTypeVector %152 2 + %192 = OpTypePointer Function %191 + %196 = OpTypeStruct %191 + %197 = OpTypePointer Uniform %196 + %198 = OpVariable %197 Uniform + %199 = OpTypePointer Uniform %191 + %203 = OpTypeVector %152 3 + %204 = OpTypePointer Function %203 + %206 = OpConstant %152 2 + %207 = OpConstant %152 3 + %208 = OpConstantComposite %203 %159 %206 %207 + %212 = OpConstant %21 0 + %213 = OpTypePointer Function %152 + %220 = OpConstant %152 0.25 + %233 = OpConstant %152 0.5 + %237 = OpConstant %6 2 + %241 = OpConstant %21 1 + %248 = OpConstant %152 0.75 + %252 = OpConstant %6 3 + %256 = OpConstant %21 2 + %261 = OpConstant %6 4 + %274 = OpConstant %6 5 + %287 = OpConstant %6 6 + %300 = OpConstant %6 7 + %308 = OpConstant %6 8 + %332 = OpTypePointer Output %153 + %333 = OpVariable %332 Output + %340 = OpTypeStruct %153 %152 + %341 = OpTypePointer Output %340 + %342 = OpVariable %341 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %166 = OpVariable %7 Function + %193 = OpVariable %192 Function + %205 = OpVariable %204 Function + %158 = OpLoad %153 %157 + %162 = OpFAdd %153 %158 %161 + %165 = OpFMul %153 %162 %164 + OpStore %155 %165 + OpStore %166 %27 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %172 = OpLoad %6 %166 + %174 = OpSLessThan %58 %172 %173 + OpBranchConditional %174 %168 %169 + %168 = OpLabel + %175 = OpLoad %6 %166 + %176 = OpLoad %6 %166 + %177 = OpISub %6 %173 %176 + %178 = OpAccessChain %29 %26 %27 %175 + OpStore %178 %177 + %179 = OpLoad %6 %166 + %180 = OpLoad %6 %166 + %181 = OpAccessChain %29 %26 %27 %180 + %182 = OpLoad %6 %181 + %183 = OpLoad %6 %166 + %184 = OpAccessChain %29 %26 %27 %183 + %185 = OpLoad %6 %184 + %186 = OpIMul %6 %182 %185 + %187 = OpAccessChain %29 %26 %27 %179 + OpStore %187 %186 + OpBranch %170 + %170 = OpLabel + %188 = OpLoad %6 %166 + %189 = OpIAdd %6 %188 %46 + OpStore %166 %189 + OpBranch %167 + %169 = OpLabel + %190 = OpFunctionCall %2 %18 + %194 = OpLoad %153 %155 + %195 = OpVectorShuffle %191 %194 %194 0 1 + %200 = OpAccessChain %199 %198 %27 + %201 = OpLoad %191 %200 + %202 = OpFDiv %191 %195 %201 + OpStore %193 %202 + OpStore %205 %208 + %209 = OpAccessChain %29 %26 %27 %27 + %210 = OpLoad %6 %209 + %211 = OpConvertSToF %152 %210 + %214 = OpAccessChain %213 %205 %212 + %215 = OpLoad %152 %214 + %216 = OpFAdd %152 %215 %211 + %217 = OpAccessChain %213 %205 %212 + OpStore %217 %216 + %218 = OpAccessChain %213 %193 %212 + %219 = OpLoad %152 %218 + %221 = OpFOrdGreaterThan %58 %219 %220 + OpSelectionMerge %223 None + OpBranchConditional %221 %222 %223 + %222 = OpLabel + %224 = OpAccessChain %29 %26 %27 %46 + %225 = OpLoad %6 %224 + %226 = OpConvertSToF %152 %225 + %227 = OpAccessChain %213 %205 %212 + %228 = OpLoad %152 %227 + %229 = OpFAdd %152 %228 %226 + %230 = OpAccessChain %213 %205 %212 + OpStore %230 %229 + OpBranch %223 + %223 = OpLabel + %231 = OpAccessChain %213 %193 %212 + %232 = OpLoad %152 %231 + %234 = OpFOrdGreaterThan %58 %232 %233 + OpSelectionMerge %236 None + OpBranchConditional %234 %235 %236 + %235 = OpLabel + %238 = OpAccessChain %29 %26 %27 %237 + %239 = OpLoad %6 %238 + %240 = OpConvertSToF %152 %239 + %242 = OpAccessChain %213 %205 %241 + %243 = OpLoad %152 %242 + %244 = OpFAdd %152 %243 %240 + %245 = OpAccessChain %213 %205 %241 + OpStore %245 %244 + OpBranch %236 + %236 = OpLabel + %246 = OpAccessChain %213 %193 %212 + %247 = OpLoad %152 %246 + %249 = OpFOrdGreaterThan %58 %247 %248 + OpSelectionMerge %251 None + OpBranchConditional %249 %250 %251 + %250 = OpLabel + %253 = OpAccessChain %29 %26 %27 %252 + %254 = OpLoad %6 %253 + %255 = OpConvertSToF %152 %254 + %257 = OpAccessChain %213 %205 %256 + %258 = OpLoad %152 %257 + %259 = OpFAdd %152 %258 %255 + %260 = OpAccessChain %213 %205 %256 + OpStore %260 %259 + OpBranch %251 + %251 = OpLabel + %262 = OpAccessChain %29 %26 %27 %261 + %263 = OpLoad %6 %262 + %264 = OpConvertSToF %152 %263 + %265 = OpAccessChain %213 %205 %241 + %266 = OpLoad %152 %265 + %267 = OpFAdd %152 %266 %264 + %268 = OpAccessChain %213 %205 %241 + OpStore %268 %267 + %269 = OpAccessChain %213 %193 %241 + %270 = OpLoad %152 %269 + %271 = OpFOrdGreaterThan %58 %270 %220 + OpSelectionMerge %273 None + OpBranchConditional %271 %272 %273 + %272 = OpLabel + %275 = OpAccessChain %29 %26 %27 %274 + %276 = OpLoad %6 %275 + %277 = OpConvertSToF %152 %276 + %278 = OpAccessChain %213 %205 %212 + %279 = OpLoad %152 %278 + %280 = OpFAdd %152 %279 %277 + %281 = OpAccessChain %213 %205 %212 + OpStore %281 %280 + OpBranch %273 + %273 = OpLabel + %282 = OpAccessChain %213 %193 %241 + %283 = OpLoad %152 %282 + %284 = OpFOrdGreaterThan %58 %283 %233 + OpSelectionMerge %286 None + OpBranchConditional %284 %285 %286 + %285 = OpLabel + %288 = OpAccessChain %29 %26 %27 %287 + %289 = OpLoad %6 %288 + %290 = OpConvertSToF %152 %289 + %291 = OpAccessChain %213 %205 %241 + %292 = OpLoad %152 %291 + %293 = OpFAdd %152 %292 %290 + %294 = OpAccessChain %213 %205 %241 + OpStore %294 %293 + OpBranch %286 + %286 = OpLabel + %295 = OpAccessChain %213 %193 %241 + %296 = OpLoad %152 %295 + %297 = OpFOrdGreaterThan %58 %296 %248 + OpSelectionMerge %299 None + OpBranchConditional %297 %298 %299 + %298 = OpLabel + %301 = OpAccessChain %29 %26 %27 %300 + %302 = OpLoad %6 %301 + %303 = OpConvertSToF %152 %302 + %304 = OpAccessChain %213 %205 %256 + %305 = OpLoad %152 %304 + %306 = OpFAdd %152 %305 %303 + %307 = OpAccessChain %213 %205 %256 + OpStore %307 %306 + OpBranch %299 + %299 = OpLabel + %309 = OpAccessChain %29 %26 %27 %308 + %310 = OpLoad %6 %309 + %311 = OpConvertSToF %152 %310 + %312 = OpAccessChain %213 %205 %256 + %313 = OpLoad %152 %312 + %314 = OpFAdd %152 %313 %311 + %315 = OpAccessChain %213 %205 %256 + OpStore %315 %314 + %316 = OpAccessChain %213 %193 %212 + %317 = OpLoad %152 %316 + %318 = OpAccessChain %213 %193 %241 + %319 = OpLoad %152 %318 + %320 = OpFSub %152 %317 %319 + %321 = OpExtInst %152 %1 FAbs %320 + %322 = OpFOrdLessThan %58 %321 %220 + OpSelectionMerge %324 None + OpBranchConditional %322 %323 %324 + %323 = OpLabel + %325 = OpAccessChain %29 %26 %27 %88 + %326 = OpLoad %6 %325 + %327 = OpConvertSToF %152 %326 + %328 = OpAccessChain %213 %205 %212 + %329 = OpLoad %152 %328 + %330 = OpFAdd %152 %329 %327 + %331 = OpAccessChain %213 %205 %212 + OpStore %331 %330 + OpBranch %324 + %324 = OpLabel + %334 = OpLoad %203 %205 + %335 = OpExtInst %203 %1 Normalize %334 + %336 = OpCompositeExtract %152 %335 0 + %337 = OpCompositeExtract %152 %335 1 + %338 = OpCompositeExtract %152 %335 2 + %339 = OpCompositeConstruct %153 %336 %337 %338 %159 + OpStore %333 %339 + %343 = OpLoad %153 %157 + %344 = OpAccessChain %332 %342 %27 + OpStore %344 %343 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %20 = OpVariable %7 Function + %28 = OpLoad %6 %9 + %30 = OpAccessChain %29 %26 %27 %28 + %31 = OpLoad %6 %30 + OpStore %20 %31 + %32 = OpLoad %6 %9 + %33 = OpLoad %6 %10 + %34 = OpAccessChain %29 %26 %27 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %29 %26 %27 %32 + OpStore %36 %35 + %37 = OpLoad %6 %10 + %38 = OpLoad %6 %20 + %39 = OpAccessChain %29 %26 %27 %37 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %16 = OpFunction %6 None %13 + %14 = OpFunctionParameter %7 + %15 = OpFunctionParameter %7 + %17 = OpLabel + %40 = OpVariable %7 Function + %44 = OpVariable %7 Function + %48 = OpVariable %7 Function + %69 = OpVariable %7 Function + %71 = OpVariable %7 Function + %78 = OpVariable %7 Function + %79 = OpVariable %7 Function + %41 = OpLoad %6 %15 + %42 = OpAccessChain %29 %26 %27 %41 + %43 = OpLoad %6 %42 + OpStore %40 %43 + %45 = OpLoad %6 %14 + %47 = OpISub %6 %45 %46 + OpStore %44 %47 + %49 = OpLoad %6 %14 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %48 + %56 = OpLoad %6 %15 + %57 = OpISub %6 %56 %46 + %59 = OpSLessThanEqual %58 %55 %57 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %48 + %61 = OpAccessChain %29 %26 %27 %60 + %62 = OpLoad %6 %61 + %63 = OpLoad %6 %40 + %64 = OpSLessThanEqual %58 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpLoad %6 %44 + %68 = OpIAdd %6 %67 %46 + OpStore %44 %68 + %70 = OpLoad %6 %44 + OpStore %69 %70 + %72 = OpLoad %6 %48 + OpStore %71 %72 + %73 = OpFunctionCall %2 %11 %69 %71 + OpBranch %66 + %66 = OpLabel + OpBranch %53 + %53 = OpLabel + %74 = OpLoad %6 %48 + %75 = OpIAdd %6 %74 %46 + OpStore %48 %75 + OpBranch %50 + %52 = OpLabel + %76 = OpLoad %6 %44 + %77 = OpIAdd %6 %76 %46 + OpStore %78 %77 + %80 = OpLoad %6 %15 + OpStore %79 %80 + %81 = OpFunctionCall %2 %11 %78 %79 + %82 = OpLoad %6 %44 + %83 = OpIAdd %6 %82 %46 + OpReturnValue %83 + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %86 = OpVariable %7 Function + %87 = OpVariable %7 Function + %89 = OpVariable %7 Function + %92 = OpVariable %91 Function + %116 = OpVariable %7 Function + %117 = OpVariable %7 Function + %119 = OpVariable %7 Function + OpStore %86 %27 + OpStore %87 %88 + OpStore %89 %90 + %93 = OpLoad %6 %89 + %94 = OpIAdd %6 %93 %46 + OpStore %89 %94 + %95 = OpLoad %6 %86 + %96 = OpAccessChain %7 %92 %94 + OpStore %96 %95 + %97 = OpLoad %6 %89 + %98 = OpIAdd %6 %97 %46 + OpStore %89 %98 + %99 = OpLoad %6 %87 + %100 = OpAccessChain %7 %92 %98 + OpStore %100 %99 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %6 %89 + %107 = OpSGreaterThanEqual %58 %106 %27 + OpBranchConditional %107 %102 %103 + %102 = OpLabel + %108 = OpLoad %6 %89 + %109 = OpISub %6 %108 %46 + OpStore %89 %109 + %110 = OpAccessChain %7 %92 %108 + %111 = OpLoad %6 %110 + OpStore %87 %111 + %112 = OpLoad %6 %89 + %113 = OpISub %6 %112 %46 + OpStore %89 %113 + %114 = OpAccessChain %7 %92 %112 + %115 = OpLoad %6 %114 + OpStore %86 %115 + %118 = OpLoad %6 %86 + OpStore %117 %118 + %120 = OpLoad %6 %87 + OpStore %119 %120 + %121 = OpFunctionCall %6 %16 %117 %119 + OpStore %116 %121 + %122 = OpLoad %6 %116 + %123 = OpISub %6 %122 %46 + %124 = OpLoad %6 %86 + %125 = OpSGreaterThan %58 %123 %124 + OpSelectionMerge %127 None + OpBranchConditional %125 %126 %127 + %126 = OpLabel + %128 = OpLoad %6 %89 + %129 = OpIAdd %6 %128 %46 + OpStore %89 %129 + %130 = OpLoad %6 %86 + %131 = OpAccessChain %7 %92 %129 + OpStore %131 %130 + %132 = OpLoad %6 %89 + %133 = OpIAdd %6 %132 %46 + OpStore %89 %133 + %134 = OpLoad %6 %116 + %135 = OpISub %6 %134 %46 + %136 = OpAccessChain %7 %92 %133 + OpStore %136 %135 + OpBranch %127 + %127 = OpLabel + %137 = OpLoad %6 %116 + %138 = OpIAdd %6 %137 %46 + %139 = OpLoad %6 %87 + %140 = OpSLessThan %58 %138 %139 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpLoad %6 %89 + %144 = OpIAdd %6 %143 %46 + OpStore %89 %144 + %145 = OpLoad %6 %116 + %146 = OpIAdd %6 %145 %46 + %147 = OpAccessChain %7 %92 %144 + OpStore %147 %146 + %148 = OpLoad %6 %89 + %149 = OpIAdd %6 %148 %46 + OpStore %89 %149 + %150 = OpLoad %6 %87 + %151 = OpAccessChain %7 %92 %149 + OpStore %151 %150 + OpBranch %142 + %142 = OpLabel + OpBranch %104 + %104 = OpLabel + OpBranch %101 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# reference_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(location = 0) in vec4 frag_color; +# +# void main() +# { +# _GLF_color = frag_color; +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 13 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %11 "frag_color" + OpDecorate %9 Location 0 + OpDecorate %11 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %7 + %11 = OpVariable %10 Input + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %7 %11 + OpStore %9 %12 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_GRID POS 0 0 SIZE 256 256 CELLS 8 8 + + +# variant_vertex_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# vec4 _GLF_FragCoord; +# +# layout(location = 0) in vec4 _GLF_pos; +# +# layout(location = 0) out vec4 frag_color; +# +# layout(set = 0, binding = 1) uniform buf1 { +# vec2 resolution; +# }; +# +# layout(set = 0, binding = 0) uniform buf0 { +# highp vec2 injectionSwitch; +# }; +# +# struct QuicksortObject { +# int numbers[10]; +# } ; +# +# QuicksortObject obj; +# +# void swap(int i, int j) +# { +# int temp = obj.numbers[i]; +# obj.numbers[i] = obj.numbers[j]; +# obj.numbers[j] = temp; +# } +# int performPartition(int l, int h) +# { +# int pivot = obj.numbers[h]; +# int i = (l - 1); +# for(int j = l; j <= h - 1; j ++) +# { +# if(obj.numbers[j] <= pivot) +# { +# i ++; +# swap(i, j); +# } +# } +# swap(i + 1, h); +# return (i + 1); +# } +# void quicksort() +# { +# int l = 0, h = 9; +# int stack[10]; +# int top = - 1; +# stack[++ top] = l; +# stack[++ top] = h; +# while(top >= 0) +# { +# h = stack[top --]; +# l = stack[top --]; +# int p = performPartition(l, h); +# if(p - 1 > l) +# { +# stack[++ top] = l; +# stack[++ top] = p - 1; +# } +# if(p + 1 < h) +# { +# stack[++ top] = p + 1; +# stack[++ top] = h; +# } +# } +# } +# void main() +# { +# _GLF_FragCoord = (_GLF_pos + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0); +# for(int i = 0; i < 10; i ++) +# { +# obj.numbers[i] = (10 - i); +# // injectionSwitch.x is always less than injectionSwitch.y, +# // therefore this break; should always be unreachable. +# if((injectionSwitch.x > injectionSwitch.y)) +# { +# break; +# } +# obj.numbers[i] = obj.numbers[i] * obj.numbers[i]; +# } +# quicksort(); +# vec2 uv = _GLF_FragCoord.xy / resolution; +# vec3 color = vec3(1.0, 2.0, 3.0); +# color.x += float(obj.numbers[0]); +# if(uv.x > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[1]); +# } +# if(uv.x > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[2]); +# } +# if(uv.x > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[3]); +# } +# color.y += float(obj.numbers[4]); +# if(uv.y > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[5]); +# } +# if(uv.y > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[6]); +# } +# if(uv.y > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[7]); +# } +# color.z += float(obj.numbers[8]); +# if(abs(uv.x - uv.y) < 0.25) +# { +# color.x += float(obj.numbers[9]); +# } +# frag_color = vec4(normalize(color), 1.0); +# gl_Position = _GLF_pos; +# } +SHADER vertex variant_vertex_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 357 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main" %157 %345 %354 + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "swap(i1;i1;" + OpName %9 "i" + OpName %10 "j" + OpName %16 "performPartition(i1;i1;" + OpName %14 "l" + OpName %15 "h" + OpName %18 "quicksort(" + OpName %20 "temp" + OpName %24 "QuicksortObject" + OpMemberName %24 0 "numbers" + OpName %26 "obj" + OpName %40 "pivot" + OpName %44 "i" + OpName %48 "j" + OpName %69 "param" + OpName %71 "param" + OpName %78 "param" + OpName %79 "param" + OpName %86 "l" + OpName %87 "h" + OpName %89 "top" + OpName %92 "stack" + OpName %116 "p" + OpName %117 "param" + OpName %119 "param" + OpName %155 "_GLF_FragCoord" + OpName %157 "_GLF_pos" + OpName %166 "i" + OpName %180 "buf0" + OpMemberName %180 0 "injectionSwitch" + OpName %182 "" + OpName %207 "uv" + OpName %210 "buf1" + OpMemberName %210 0 "resolution" + OpName %212 "" + OpName %219 "color" + OpName %345 "frag_color" + OpName %352 "gl_PerVertex" + OpMemberName %352 0 "gl_Position" + OpMemberName %352 1 "gl_PointSize" + OpName %354 "" + OpDecorate %157 Location 0 + OpMemberDecorate %180 0 Offset 0 + OpDecorate %180 Block + OpDecorate %182 DescriptorSet 0 + OpDecorate %182 Binding 0 + OpMemberDecorate %210 0 Offset 0 + OpDecorate %210 Block + OpDecorate %212 DescriptorSet 0 + OpDecorate %212 Binding 1 + OpDecorate %345 Location 0 + OpMemberDecorate %352 0 BuiltIn Position + OpMemberDecorate %352 1 BuiltIn PointSize + OpDecorate %352 Block + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeFunction %6 %7 %7 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 0 + %29 = OpTypePointer Private %6 + %46 = OpConstant %6 1 + %58 = OpTypeBool + %88 = OpConstant %6 9 + %90 = OpConstant %6 -1 + %91 = OpTypePointer Function %23 + %152 = OpTypeFloat 32 + %153 = OpTypeVector %152 4 + %154 = OpTypePointer Private %153 + %155 = OpVariable %154 Private + %156 = OpTypePointer Input %153 + %157 = OpVariable %156 Input + %159 = OpConstant %152 1 + %160 = OpConstant %152 0 + %161 = OpConstantComposite %153 %159 %159 %160 %160 + %163 = OpConstant %152 128 + %164 = OpConstantComposite %153 %163 %163 %159 %159 + %173 = OpConstant %6 10 + %179 = OpTypeVector %152 2 + %180 = OpTypeStruct %179 + %181 = OpTypePointer Uniform %180 + %182 = OpVariable %181 Uniform + %183 = OpConstant %21 0 + %184 = OpTypePointer Uniform %152 + %187 = OpConstant %21 1 + %206 = OpTypePointer Function %179 + %210 = OpTypeStruct %179 + %211 = OpTypePointer Uniform %210 + %212 = OpVariable %211 Uniform + %213 = OpTypePointer Uniform %179 + %217 = OpTypeVector %152 3 + %218 = OpTypePointer Function %217 + %220 = OpConstant %152 2 + %221 = OpConstant %152 3 + %222 = OpConstantComposite %217 %159 %220 %221 + %226 = OpTypePointer Function %152 + %233 = OpConstant %152 0.25 + %246 = OpConstant %152 0.5 + %250 = OpConstant %6 2 + %260 = OpConstant %152 0.75 + %264 = OpConstant %6 3 + %268 = OpConstant %21 2 + %273 = OpConstant %6 4 + %286 = OpConstant %6 5 + %299 = OpConstant %6 6 + %312 = OpConstant %6 7 + %320 = OpConstant %6 8 + %344 = OpTypePointer Output %153 + %345 = OpVariable %344 Output + %352 = OpTypeStruct %153 %152 + %353 = OpTypePointer Output %352 + %354 = OpVariable %353 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %166 = OpVariable %7 Function + %207 = OpVariable %206 Function + %219 = OpVariable %218 Function + %158 = OpLoad %153 %157 + %162 = OpFAdd %153 %158 %161 + %165 = OpFMul %153 %162 %164 + OpStore %155 %165 + OpStore %166 %27 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %172 = OpLoad %6 %166 + %174 = OpSLessThan %58 %172 %173 + OpBranchConditional %174 %168 %169 + %168 = OpLabel + %175 = OpLoad %6 %166 + %176 = OpLoad %6 %166 + %177 = OpISub %6 %173 %176 + %178 = OpAccessChain %29 %26 %27 %175 + OpStore %178 %177 + %185 = OpAccessChain %184 %182 %27 %183 + %186 = OpLoad %152 %185 + %188 = OpAccessChain %184 %182 %27 %187 + %189 = OpLoad %152 %188 + %190 = OpFOrdGreaterThan %58 %186 %189 + OpSelectionMerge %192 None + OpBranchConditional %190 %191 %192 + %191 = OpLabel + OpBranch %169 + %192 = OpLabel + %194 = OpLoad %6 %166 + %195 = OpLoad %6 %166 + %196 = OpAccessChain %29 %26 %27 %195 + %197 = OpLoad %6 %196 + %198 = OpLoad %6 %166 + %199 = OpAccessChain %29 %26 %27 %198 + %200 = OpLoad %6 %199 + %201 = OpIMul %6 %197 %200 + %202 = OpAccessChain %29 %26 %27 %194 + OpStore %202 %201 + OpBranch %170 + %170 = OpLabel + %203 = OpLoad %6 %166 + %204 = OpIAdd %6 %203 %46 + OpStore %166 %204 + OpBranch %167 + %169 = OpLabel + %205 = OpFunctionCall %2 %18 + %208 = OpLoad %153 %155 + %209 = OpVectorShuffle %179 %208 %208 0 1 + %214 = OpAccessChain %213 %212 %27 + %215 = OpLoad %179 %214 + %216 = OpFDiv %179 %209 %215 + OpStore %207 %216 + OpStore %219 %222 + %223 = OpAccessChain %29 %26 %27 %27 + %224 = OpLoad %6 %223 + %225 = OpConvertSToF %152 %224 + %227 = OpAccessChain %226 %219 %183 + %228 = OpLoad %152 %227 + %229 = OpFAdd %152 %228 %225 + %230 = OpAccessChain %226 %219 %183 + OpStore %230 %229 + %231 = OpAccessChain %226 %207 %183 + %232 = OpLoad %152 %231 + %234 = OpFOrdGreaterThan %58 %232 %233 + OpSelectionMerge %236 None + OpBranchConditional %234 %235 %236 + %235 = OpLabel + %237 = OpAccessChain %29 %26 %27 %46 + %238 = OpLoad %6 %237 + %239 = OpConvertSToF %152 %238 + %240 = OpAccessChain %226 %219 %183 + %241 = OpLoad %152 %240 + %242 = OpFAdd %152 %241 %239 + %243 = OpAccessChain %226 %219 %183 + OpStore %243 %242 + OpBranch %236 + %236 = OpLabel + %244 = OpAccessChain %226 %207 %183 + %245 = OpLoad %152 %244 + %247 = OpFOrdGreaterThan %58 %245 %246 + OpSelectionMerge %249 None + OpBranchConditional %247 %248 %249 + %248 = OpLabel + %251 = OpAccessChain %29 %26 %27 %250 + %252 = OpLoad %6 %251 + %253 = OpConvertSToF %152 %252 + %254 = OpAccessChain %226 %219 %187 + %255 = OpLoad %152 %254 + %256 = OpFAdd %152 %255 %253 + %257 = OpAccessChain %226 %219 %187 + OpStore %257 %256 + OpBranch %249 + %249 = OpLabel + %258 = OpAccessChain %226 %207 %183 + %259 = OpLoad %152 %258 + %261 = OpFOrdGreaterThan %58 %259 %260 + OpSelectionMerge %263 None + OpBranchConditional %261 %262 %263 + %262 = OpLabel + %265 = OpAccessChain %29 %26 %27 %264 + %266 = OpLoad %6 %265 + %267 = OpConvertSToF %152 %266 + %269 = OpAccessChain %226 %219 %268 + %270 = OpLoad %152 %269 + %271 = OpFAdd %152 %270 %267 + %272 = OpAccessChain %226 %219 %268 + OpStore %272 %271 + OpBranch %263 + %263 = OpLabel + %274 = OpAccessChain %29 %26 %27 %273 + %275 = OpLoad %6 %274 + %276 = OpConvertSToF %152 %275 + %277 = OpAccessChain %226 %219 %187 + %278 = OpLoad %152 %277 + %279 = OpFAdd %152 %278 %276 + %280 = OpAccessChain %226 %219 %187 + OpStore %280 %279 + %281 = OpAccessChain %226 %207 %187 + %282 = OpLoad %152 %281 + %283 = OpFOrdGreaterThan %58 %282 %233 + OpSelectionMerge %285 None + OpBranchConditional %283 %284 %285 + %284 = OpLabel + %287 = OpAccessChain %29 %26 %27 %286 + %288 = OpLoad %6 %287 + %289 = OpConvertSToF %152 %288 + %290 = OpAccessChain %226 %219 %183 + %291 = OpLoad %152 %290 + %292 = OpFAdd %152 %291 %289 + %293 = OpAccessChain %226 %219 %183 + OpStore %293 %292 + OpBranch %285 + %285 = OpLabel + %294 = OpAccessChain %226 %207 %187 + %295 = OpLoad %152 %294 + %296 = OpFOrdGreaterThan %58 %295 %246 + OpSelectionMerge %298 None + OpBranchConditional %296 %297 %298 + %297 = OpLabel + %300 = OpAccessChain %29 %26 %27 %299 + %301 = OpLoad %6 %300 + %302 = OpConvertSToF %152 %301 + %303 = OpAccessChain %226 %219 %187 + %304 = OpLoad %152 %303 + %305 = OpFAdd %152 %304 %302 + %306 = OpAccessChain %226 %219 %187 + OpStore %306 %305 + OpBranch %298 + %298 = OpLabel + %307 = OpAccessChain %226 %207 %187 + %308 = OpLoad %152 %307 + %309 = OpFOrdGreaterThan %58 %308 %260 + OpSelectionMerge %311 None + OpBranchConditional %309 %310 %311 + %310 = OpLabel + %313 = OpAccessChain %29 %26 %27 %312 + %314 = OpLoad %6 %313 + %315 = OpConvertSToF %152 %314 + %316 = OpAccessChain %226 %219 %268 + %317 = OpLoad %152 %316 + %318 = OpFAdd %152 %317 %315 + %319 = OpAccessChain %226 %219 %268 + OpStore %319 %318 + OpBranch %311 + %311 = OpLabel + %321 = OpAccessChain %29 %26 %27 %320 + %322 = OpLoad %6 %321 + %323 = OpConvertSToF %152 %322 + %324 = OpAccessChain %226 %219 %268 + %325 = OpLoad %152 %324 + %326 = OpFAdd %152 %325 %323 + %327 = OpAccessChain %226 %219 %268 + OpStore %327 %326 + %328 = OpAccessChain %226 %207 %183 + %329 = OpLoad %152 %328 + %330 = OpAccessChain %226 %207 %187 + %331 = OpLoad %152 %330 + %332 = OpFSub %152 %329 %331 + %333 = OpExtInst %152 %1 FAbs %332 + %334 = OpFOrdLessThan %58 %333 %233 + OpSelectionMerge %336 None + OpBranchConditional %334 %335 %336 + %335 = OpLabel + %337 = OpAccessChain %29 %26 %27 %88 + %338 = OpLoad %6 %337 + %339 = OpConvertSToF %152 %338 + %340 = OpAccessChain %226 %219 %183 + %341 = OpLoad %152 %340 + %342 = OpFAdd %152 %341 %339 + %343 = OpAccessChain %226 %219 %183 + OpStore %343 %342 + OpBranch %336 + %336 = OpLabel + %346 = OpLoad %217 %219 + %347 = OpExtInst %217 %1 Normalize %346 + %348 = OpCompositeExtract %152 %347 0 + %349 = OpCompositeExtract %152 %347 1 + %350 = OpCompositeExtract %152 %347 2 + %351 = OpCompositeConstruct %153 %348 %349 %350 %159 + OpStore %345 %351 + %355 = OpLoad %153 %157 + %356 = OpAccessChain %344 %354 %27 + OpStore %356 %355 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %20 = OpVariable %7 Function + %28 = OpLoad %6 %9 + %30 = OpAccessChain %29 %26 %27 %28 + %31 = OpLoad %6 %30 + OpStore %20 %31 + %32 = OpLoad %6 %9 + %33 = OpLoad %6 %10 + %34 = OpAccessChain %29 %26 %27 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %29 %26 %27 %32 + OpStore %36 %35 + %37 = OpLoad %6 %10 + %38 = OpLoad %6 %20 + %39 = OpAccessChain %29 %26 %27 %37 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %16 = OpFunction %6 None %13 + %14 = OpFunctionParameter %7 + %15 = OpFunctionParameter %7 + %17 = OpLabel + %40 = OpVariable %7 Function + %44 = OpVariable %7 Function + %48 = OpVariable %7 Function + %69 = OpVariable %7 Function + %71 = OpVariable %7 Function + %78 = OpVariable %7 Function + %79 = OpVariable %7 Function + %41 = OpLoad %6 %15 + %42 = OpAccessChain %29 %26 %27 %41 + %43 = OpLoad %6 %42 + OpStore %40 %43 + %45 = OpLoad %6 %14 + %47 = OpISub %6 %45 %46 + OpStore %44 %47 + %49 = OpLoad %6 %14 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %48 + %56 = OpLoad %6 %15 + %57 = OpISub %6 %56 %46 + %59 = OpSLessThanEqual %58 %55 %57 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %48 + %61 = OpAccessChain %29 %26 %27 %60 + %62 = OpLoad %6 %61 + %63 = OpLoad %6 %40 + %64 = OpSLessThanEqual %58 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpLoad %6 %44 + %68 = OpIAdd %6 %67 %46 + OpStore %44 %68 + %70 = OpLoad %6 %44 + OpStore %69 %70 + %72 = OpLoad %6 %48 + OpStore %71 %72 + %73 = OpFunctionCall %2 %11 %69 %71 + OpBranch %66 + %66 = OpLabel + OpBranch %53 + %53 = OpLabel + %74 = OpLoad %6 %48 + %75 = OpIAdd %6 %74 %46 + OpStore %48 %75 + OpBranch %50 + %52 = OpLabel + %76 = OpLoad %6 %44 + %77 = OpIAdd %6 %76 %46 + OpStore %78 %77 + %80 = OpLoad %6 %15 + OpStore %79 %80 + %81 = OpFunctionCall %2 %11 %78 %79 + %82 = OpLoad %6 %44 + %83 = OpIAdd %6 %82 %46 + OpReturnValue %83 + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %86 = OpVariable %7 Function + %87 = OpVariable %7 Function + %89 = OpVariable %7 Function + %92 = OpVariable %91 Function + %116 = OpVariable %7 Function + %117 = OpVariable %7 Function + %119 = OpVariable %7 Function + OpStore %86 %27 + OpStore %87 %88 + OpStore %89 %90 + %93 = OpLoad %6 %89 + %94 = OpIAdd %6 %93 %46 + OpStore %89 %94 + %95 = OpLoad %6 %86 + %96 = OpAccessChain %7 %92 %94 + OpStore %96 %95 + %97 = OpLoad %6 %89 + %98 = OpIAdd %6 %97 %46 + OpStore %89 %98 + %99 = OpLoad %6 %87 + %100 = OpAccessChain %7 %92 %98 + OpStore %100 %99 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %6 %89 + %107 = OpSGreaterThanEqual %58 %106 %27 + OpBranchConditional %107 %102 %103 + %102 = OpLabel + %108 = OpLoad %6 %89 + %109 = OpISub %6 %108 %46 + OpStore %89 %109 + %110 = OpAccessChain %7 %92 %108 + %111 = OpLoad %6 %110 + OpStore %87 %111 + %112 = OpLoad %6 %89 + %113 = OpISub %6 %112 %46 + OpStore %89 %113 + %114 = OpAccessChain %7 %92 %112 + %115 = OpLoad %6 %114 + OpStore %86 %115 + %118 = OpLoad %6 %86 + OpStore %117 %118 + %120 = OpLoad %6 %87 + OpStore %119 %120 + %121 = OpFunctionCall %6 %16 %117 %119 + OpStore %116 %121 + %122 = OpLoad %6 %116 + %123 = OpISub %6 %122 %46 + %124 = OpLoad %6 %86 + %125 = OpSGreaterThan %58 %123 %124 + OpSelectionMerge %127 None + OpBranchConditional %125 %126 %127 + %126 = OpLabel + %128 = OpLoad %6 %89 + %129 = OpIAdd %6 %128 %46 + OpStore %89 %129 + %130 = OpLoad %6 %86 + %131 = OpAccessChain %7 %92 %129 + OpStore %131 %130 + %132 = OpLoad %6 %89 + %133 = OpIAdd %6 %132 %46 + OpStore %89 %133 + %134 = OpLoad %6 %116 + %135 = OpISub %6 %134 %46 + %136 = OpAccessChain %7 %92 %133 + OpStore %136 %135 + OpBranch %127 + %127 = OpLabel + %137 = OpLoad %6 %116 + %138 = OpIAdd %6 %137 %46 + %139 = OpLoad %6 %87 + %140 = OpSLessThan %58 %138 %139 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpLoad %6 %89 + %144 = OpIAdd %6 %143 %46 + OpStore %89 %144 + %145 = OpLoad %6 %116 + %146 = OpIAdd %6 %145 %46 + %147 = OpAccessChain %7 %92 %144 + OpStore %147 %146 + %148 = OpLoad %6 %89 + %149 = OpIAdd %6 %148 %46 + OpStore %89 %149 + %150 = OpLoad %6 %87 + %151 = OpAccessChain %7 %92 %149 + OpStore %151 %150 + OpBranch %142 + %142 = OpLabel + OpBranch %104 + %104 = OpLabel + OpBranch %101 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(location = 0) in vec4 frag_color; +# +# void main() +# { +# _GLF_color = frag_color; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 13 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %11 "frag_color" + OpDecorate %9 Location 0 + OpDecorate %11 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %7 + %11 = OpVariable %10 Input + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %7 %11 + OpStore %9 %12 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_GRID POS 0 0 SIZE 256 256 CELLS 8 8 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-quicksort-if-false-else-return.amber b/vulkan/amber/graphicsfuzz/stable-quicksort-if-false-else-return.amber new file mode 100644 index 0000000..5278e5f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-quicksort-if-false-else-return.amber @@ -0,0 +1,1737 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: A fragment shader with an always false if statement + +# The test passes because both shaders render the same image. + +# Optimized using spirv-opt with the following arguments: +# '--scalar-replacement=100' +# '--copy-propagate-arrays' +# '--inline-entry-points-exhaustive' +# '--inline-entry-points-exhaustive' +# spirv-opt commit hash: 8dfdbeff84f3e058ca33a08755ab47bc572a1c50 + + + +# reference_vertex_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# vec4 _GLF_FragCoord; +# +# layout(location = 0) in vec4 _GLF_pos; +# +# layout(location = 0) out vec4 frag_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 resolution; +# }; +# struct QuicksortObject { +# int numbers[10]; +# } ; +# +# QuicksortObject obj; +# +# void swap(int i, int j) +# { +# int temp = obj.numbers[i]; +# obj.numbers[i] = obj.numbers[j]; +# obj.numbers[j] = temp; +# } +# int performPartition(int l, int h) +# { +# int pivot = obj.numbers[h]; +# int i = (l - 1); +# for(int j = l; j <= h - 1; j ++) +# { +# if(obj.numbers[j] <= pivot) +# { +# i ++; +# swap(i, j); +# } +# } +# swap(i + 1, h); +# return (i + 1); +# } +# void quicksort() +# { +# int l = 0, h = 9; +# int stack[10]; +# int top = - 1; +# stack[++ top] = l; +# stack[++ top] = h; +# while(top >= 0) +# { +# h = stack[top --]; +# l = stack[top --]; +# int p = performPartition(l, h); +# if(p - 1 > l) +# { +# stack[++ top] = l; +# stack[++ top] = p - 1; +# } +# if(p + 1 < h) +# { +# stack[++ top] = p + 1; +# stack[++ top] = h; +# } +# } +# } +# void main() +# { +# _GLF_FragCoord = (_GLF_pos + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0); +# for(int i = 0; i < 10; i ++) +# { +# obj.numbers[i] = (10 - i); +# obj.numbers[i] = obj.numbers[i] * obj.numbers[i]; +# } +# quicksort(); +# vec2 uv = _GLF_FragCoord.xy / resolution; +# vec3 color = vec3(1.0, 2.0, 3.0); +# color.x += float(obj.numbers[0]); +# if(uv.x > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[1]); +# } +# if(uv.x > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[2]); +# } +# if(uv.x > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[3]); +# } +# color.y += float(obj.numbers[4]); +# if(uv.y > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[5]); +# } +# if(uv.y > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[6]); +# } +# if(uv.y > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[7]); +# } +# color.z += float(obj.numbers[8]); +# if(abs(uv.x - uv.y) < 0.25) +# { +# color.x += float(obj.numbers[9]); +# } +# frag_color = vec4(normalize(color), 1.0); +# gl_Position = _GLF_pos; +# } +SHADER vertex reference_vertex_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 479 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main" %157 %333 %342 + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "swap(i1;i1;" + OpName %9 "i" + OpName %10 "j" + OpName %16 "performPartition(i1;i1;" + OpName %14 "l" + OpName %15 "h" + OpName %18 "quicksort(" + OpName %20 "temp" + OpName %24 "QuicksortObject" + OpMemberName %24 0 "numbers" + OpName %26 "obj" + OpName %40 "pivot" + OpName %44 "i" + OpName %48 "j" + OpName %69 "param" + OpName %71 "param" + OpName %78 "param" + OpName %79 "param" + OpName %86 "l" + OpName %87 "h" + OpName %89 "top" + OpName %92 "stack" + OpName %116 "p" + OpName %117 "param" + OpName %119 "param" + OpName %155 "_GLF_FragCoord" + OpName %157 "_GLF_pos" + OpName %166 "i" + OpName %193 "uv" + OpName %196 "buf0" + OpMemberName %196 0 "resolution" + OpName %198 "" + OpName %205 "color" + OpName %333 "frag_color" + OpName %340 "gl_PerVertex" + OpMemberName %340 0 "gl_Position" + OpMemberName %340 1 "gl_PointSize" + OpName %342 "" + OpDecorate %157 Location 0 + OpMemberDecorate %196 0 Offset 0 + OpDecorate %196 Block + OpDecorate %198 DescriptorSet 0 + OpDecorate %198 Binding 0 + OpDecorate %333 Location 0 + OpMemberDecorate %340 0 BuiltIn Position + OpMemberDecorate %340 1 BuiltIn PointSize + OpDecorate %340 Block + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeFunction %6 %7 %7 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 0 + %29 = OpTypePointer Private %6 + %46 = OpConstant %6 1 + %58 = OpTypeBool + %88 = OpConstant %6 9 + %90 = OpConstant %6 -1 + %91 = OpTypePointer Function %23 + %152 = OpTypeFloat 32 + %153 = OpTypeVector %152 4 + %154 = OpTypePointer Private %153 + %155 = OpVariable %154 Private + %156 = OpTypePointer Input %153 + %157 = OpVariable %156 Input + %159 = OpConstant %152 1 + %160 = OpConstant %152 0 + %161 = OpConstantComposite %153 %159 %159 %160 %160 + %163 = OpConstant %152 128 + %164 = OpConstantComposite %153 %163 %163 %159 %159 + %173 = OpConstant %6 10 + %191 = OpTypeVector %152 2 + %192 = OpTypePointer Function %191 + %196 = OpTypeStruct %191 + %197 = OpTypePointer Uniform %196 + %198 = OpVariable %197 Uniform + %199 = OpTypePointer Uniform %191 + %203 = OpTypeVector %152 3 + %204 = OpTypePointer Function %203 + %206 = OpConstant %152 2 + %207 = OpConstant %152 3 + %208 = OpConstantComposite %203 %159 %206 %207 + %212 = OpConstant %21 0 + %213 = OpTypePointer Function %152 + %220 = OpConstant %152 0.25 + %233 = OpConstant %152 0.5 + %237 = OpConstant %6 2 + %241 = OpConstant %21 1 + %248 = OpConstant %152 0.75 + %252 = OpConstant %6 3 + %256 = OpConstant %21 2 + %261 = OpConstant %6 4 + %274 = OpConstant %6 5 + %287 = OpConstant %6 6 + %300 = OpConstant %6 7 + %308 = OpConstant %6 8 + %332 = OpTypePointer Output %153 + %333 = OpVariable %332 Output + %340 = OpTypeStruct %153 %152 + %341 = OpTypePointer Output %340 + %342 = OpVariable %341 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %466 = OpVariable %7 Function + %453 = OpVariable %7 Function + %409 = OpVariable %7 Function + %410 = OpVariable %7 Function + %411 = OpVariable %7 Function + %412 = OpVariable %7 Function + %413 = OpVariable %7 Function + %414 = OpVariable %7 Function + %415 = OpVariable %7 Function + %416 = OpVariable %7 Function + %345 = OpVariable %7 Function + %346 = OpVariable %7 Function + %347 = OpVariable %7 Function + %348 = OpVariable %91 Function + %349 = OpVariable %7 Function + %350 = OpVariable %7 Function + %351 = OpVariable %7 Function + %166 = OpVariable %7 Function + %193 = OpVariable %192 Function + %205 = OpVariable %204 Function + %158 = OpLoad %153 %157 + %162 = OpFAdd %153 %158 %161 + %165 = OpFMul %153 %162 %164 + OpStore %155 %165 + OpStore %166 %27 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %172 = OpLoad %6 %166 + %174 = OpSLessThan %58 %172 %173 + OpBranchConditional %174 %168 %169 + %168 = OpLabel + %175 = OpLoad %6 %166 + %176 = OpLoad %6 %166 + %177 = OpISub %6 %173 %176 + %178 = OpAccessChain %29 %26 %27 %175 + OpStore %178 %177 + %179 = OpLoad %6 %166 + %180 = OpLoad %6 %166 + %181 = OpAccessChain %29 %26 %27 %180 + %182 = OpLoad %6 %181 + %183 = OpLoad %6 %166 + %184 = OpAccessChain %29 %26 %27 %183 + %185 = OpLoad %6 %184 + %186 = OpIMul %6 %182 %185 + %187 = OpAccessChain %29 %26 %27 %179 + OpStore %187 %186 + OpBranch %170 + %170 = OpLabel + %188 = OpLoad %6 %166 + %189 = OpIAdd %6 %188 %46 + OpStore %166 %189 + OpBranch %167 + %169 = OpLabel + OpStore %345 %27 + OpStore %346 %88 + OpStore %347 %90 + %353 = OpLoad %6 %347 + %354 = OpIAdd %6 %353 %46 + OpStore %347 %354 + %355 = OpLoad %6 %345 + %356 = OpAccessChain %7 %348 %354 + OpStore %356 %355 + %357 = OpLoad %6 %347 + %358 = OpIAdd %6 %357 %46 + OpStore %347 %358 + %359 = OpLoad %6 %346 + %360 = OpAccessChain %7 %348 %358 + OpStore %360 %359 + OpBranch %361 + %361 = OpLabel + OpLoopMerge %408 %407 None + OpBranch %362 + %362 = OpLabel + %363 = OpLoad %6 %347 + %364 = OpSGreaterThanEqual %58 %363 %27 + OpBranchConditional %364 %365 %408 + %365 = OpLabel + %366 = OpLoad %6 %347 + %367 = OpISub %6 %366 %46 + OpStore %347 %367 + %368 = OpAccessChain %7 %348 %366 + %369 = OpLoad %6 %368 + OpStore %346 %369 + %370 = OpLoad %6 %347 + %371 = OpISub %6 %370 %46 + OpStore %347 %371 + %372 = OpAccessChain %7 %348 %370 + %373 = OpLoad %6 %372 + OpStore %345 %373 + %374 = OpLoad %6 %345 + OpStore %350 %374 + %375 = OpLoad %6 %346 + OpStore %351 %375 + %418 = OpLoad %6 %351 + %419 = OpAccessChain %29 %26 %27 %418 + %420 = OpLoad %6 %419 + OpStore %409 %420 + %421 = OpLoad %6 %350 + %422 = OpISub %6 %421 %46 + OpStore %410 %422 + %423 = OpLoad %6 %350 + OpStore %411 %423 + OpBranch %424 + %424 = OpLabel + OpLoopMerge %446 %443 None + OpBranch %425 + %425 = OpLabel + %426 = OpLoad %6 %411 + %427 = OpLoad %6 %351 + %428 = OpISub %6 %427 %46 + %429 = OpSLessThanEqual %58 %426 %428 + OpBranchConditional %429 %430 %446 + %430 = OpLabel + %431 = OpLoad %6 %411 + %432 = OpAccessChain %29 %26 %27 %431 + %433 = OpLoad %6 %432 + %434 = OpLoad %6 %409 + %435 = OpSLessThanEqual %58 %433 %434 + OpSelectionMerge %442 None + OpBranchConditional %435 %436 %442 + %436 = OpLabel + %437 = OpLoad %6 %410 + %438 = OpIAdd %6 %437 %46 + OpStore %410 %438 + %439 = OpLoad %6 %410 + OpStore %412 %439 + %440 = OpLoad %6 %411 + OpStore %413 %440 + %455 = OpLoad %6 %412 + %456 = OpAccessChain %29 %26 %27 %455 + %457 = OpLoad %6 %456 + OpStore %453 %457 + %458 = OpLoad %6 %412 + %459 = OpLoad %6 %413 + %460 = OpAccessChain %29 %26 %27 %459 + %461 = OpLoad %6 %460 + %462 = OpAccessChain %29 %26 %27 %458 + OpStore %462 %461 + %463 = OpLoad %6 %413 + %464 = OpLoad %6 %453 + %465 = OpAccessChain %29 %26 %27 %463 + OpStore %465 %464 + OpBranch %442 + %442 = OpLabel + OpBranch %443 + %443 = OpLabel + %444 = OpLoad %6 %411 + %445 = OpIAdd %6 %444 %46 + OpStore %411 %445 + OpBranch %424 + %446 = OpLabel + %447 = OpLoad %6 %410 + %448 = OpIAdd %6 %447 %46 + OpStore %414 %448 + %449 = OpLoad %6 %351 + OpStore %415 %449 + %468 = OpLoad %6 %414 + %469 = OpAccessChain %29 %26 %27 %468 + %470 = OpLoad %6 %469 + OpStore %466 %470 + %471 = OpLoad %6 %414 + %472 = OpLoad %6 %415 + %473 = OpAccessChain %29 %26 %27 %472 + %474 = OpLoad %6 %473 + %475 = OpAccessChain %29 %26 %27 %471 + OpStore %475 %474 + %476 = OpLoad %6 %415 + %477 = OpLoad %6 %466 + %478 = OpAccessChain %29 %26 %27 %476 + OpStore %478 %477 + %451 = OpLoad %6 %410 + %452 = OpIAdd %6 %451 %46 + OpStore %416 %452 + %376 = OpLoad %6 %416 + OpStore %349 %376 + %377 = OpLoad %6 %349 + %378 = OpISub %6 %377 %46 + %379 = OpLoad %6 %345 + %380 = OpSGreaterThan %58 %378 %379 + OpSelectionMerge %391 None + OpBranchConditional %380 %381 %391 + %381 = OpLabel + %382 = OpLoad %6 %347 + %383 = OpIAdd %6 %382 %46 + OpStore %347 %383 + %384 = OpLoad %6 %345 + %385 = OpAccessChain %7 %348 %383 + OpStore %385 %384 + %386 = OpLoad %6 %347 + %387 = OpIAdd %6 %386 %46 + OpStore %347 %387 + %388 = OpLoad %6 %349 + %389 = OpISub %6 %388 %46 + %390 = OpAccessChain %7 %348 %387 + OpStore %390 %389 + OpBranch %391 + %391 = OpLabel + %392 = OpLoad %6 %349 + %393 = OpIAdd %6 %392 %46 + %394 = OpLoad %6 %346 + %395 = OpSLessThan %58 %393 %394 + OpSelectionMerge %406 None + OpBranchConditional %395 %396 %406 + %396 = OpLabel + %397 = OpLoad %6 %347 + %398 = OpIAdd %6 %397 %46 + OpStore %347 %398 + %399 = OpLoad %6 %349 + %400 = OpIAdd %6 %399 %46 + %401 = OpAccessChain %7 %348 %398 + OpStore %401 %400 + %402 = OpLoad %6 %347 + %403 = OpIAdd %6 %402 %46 + OpStore %347 %403 + %404 = OpLoad %6 %346 + %405 = OpAccessChain %7 %348 %403 + OpStore %405 %404 + OpBranch %406 + %406 = OpLabel + OpBranch %407 + %407 = OpLabel + OpBranch %361 + %408 = OpLabel + %194 = OpLoad %153 %155 + %195 = OpVectorShuffle %191 %194 %194 0 1 + %200 = OpAccessChain %199 %198 %27 + %201 = OpLoad %191 %200 + %202 = OpFDiv %191 %195 %201 + OpStore %193 %202 + OpStore %205 %208 + %209 = OpAccessChain %29 %26 %27 %27 + %210 = OpLoad %6 %209 + %211 = OpConvertSToF %152 %210 + %214 = OpAccessChain %213 %205 %212 + %215 = OpLoad %152 %214 + %216 = OpFAdd %152 %215 %211 + %217 = OpAccessChain %213 %205 %212 + OpStore %217 %216 + %218 = OpAccessChain %213 %193 %212 + %219 = OpLoad %152 %218 + %221 = OpFOrdGreaterThan %58 %219 %220 + OpSelectionMerge %223 None + OpBranchConditional %221 %222 %223 + %222 = OpLabel + %224 = OpAccessChain %29 %26 %27 %46 + %225 = OpLoad %6 %224 + %226 = OpConvertSToF %152 %225 + %227 = OpAccessChain %213 %205 %212 + %228 = OpLoad %152 %227 + %229 = OpFAdd %152 %228 %226 + %230 = OpAccessChain %213 %205 %212 + OpStore %230 %229 + OpBranch %223 + %223 = OpLabel + %231 = OpAccessChain %213 %193 %212 + %232 = OpLoad %152 %231 + %234 = OpFOrdGreaterThan %58 %232 %233 + OpSelectionMerge %236 None + OpBranchConditional %234 %235 %236 + %235 = OpLabel + %238 = OpAccessChain %29 %26 %27 %237 + %239 = OpLoad %6 %238 + %240 = OpConvertSToF %152 %239 + %242 = OpAccessChain %213 %205 %241 + %243 = OpLoad %152 %242 + %244 = OpFAdd %152 %243 %240 + %245 = OpAccessChain %213 %205 %241 + OpStore %245 %244 + OpBranch %236 + %236 = OpLabel + %246 = OpAccessChain %213 %193 %212 + %247 = OpLoad %152 %246 + %249 = OpFOrdGreaterThan %58 %247 %248 + OpSelectionMerge %251 None + OpBranchConditional %249 %250 %251 + %250 = OpLabel + %253 = OpAccessChain %29 %26 %27 %252 + %254 = OpLoad %6 %253 + %255 = OpConvertSToF %152 %254 + %257 = OpAccessChain %213 %205 %256 + %258 = OpLoad %152 %257 + %259 = OpFAdd %152 %258 %255 + %260 = OpAccessChain %213 %205 %256 + OpStore %260 %259 + OpBranch %251 + %251 = OpLabel + %262 = OpAccessChain %29 %26 %27 %261 + %263 = OpLoad %6 %262 + %264 = OpConvertSToF %152 %263 + %265 = OpAccessChain %213 %205 %241 + %266 = OpLoad %152 %265 + %267 = OpFAdd %152 %266 %264 + %268 = OpAccessChain %213 %205 %241 + OpStore %268 %267 + %269 = OpAccessChain %213 %193 %241 + %270 = OpLoad %152 %269 + %271 = OpFOrdGreaterThan %58 %270 %220 + OpSelectionMerge %273 None + OpBranchConditional %271 %272 %273 + %272 = OpLabel + %275 = OpAccessChain %29 %26 %27 %274 + %276 = OpLoad %6 %275 + %277 = OpConvertSToF %152 %276 + %278 = OpAccessChain %213 %205 %212 + %279 = OpLoad %152 %278 + %280 = OpFAdd %152 %279 %277 + %281 = OpAccessChain %213 %205 %212 + OpStore %281 %280 + OpBranch %273 + %273 = OpLabel + %282 = OpAccessChain %213 %193 %241 + %283 = OpLoad %152 %282 + %284 = OpFOrdGreaterThan %58 %283 %233 + OpSelectionMerge %286 None + OpBranchConditional %284 %285 %286 + %285 = OpLabel + %288 = OpAccessChain %29 %26 %27 %287 + %289 = OpLoad %6 %288 + %290 = OpConvertSToF %152 %289 + %291 = OpAccessChain %213 %205 %241 + %292 = OpLoad %152 %291 + %293 = OpFAdd %152 %292 %290 + %294 = OpAccessChain %213 %205 %241 + OpStore %294 %293 + OpBranch %286 + %286 = OpLabel + %295 = OpAccessChain %213 %193 %241 + %296 = OpLoad %152 %295 + %297 = OpFOrdGreaterThan %58 %296 %248 + OpSelectionMerge %299 None + OpBranchConditional %297 %298 %299 + %298 = OpLabel + %301 = OpAccessChain %29 %26 %27 %300 + %302 = OpLoad %6 %301 + %303 = OpConvertSToF %152 %302 + %304 = OpAccessChain %213 %205 %256 + %305 = OpLoad %152 %304 + %306 = OpFAdd %152 %305 %303 + %307 = OpAccessChain %213 %205 %256 + OpStore %307 %306 + OpBranch %299 + %299 = OpLabel + %309 = OpAccessChain %29 %26 %27 %308 + %310 = OpLoad %6 %309 + %311 = OpConvertSToF %152 %310 + %312 = OpAccessChain %213 %205 %256 + %313 = OpLoad %152 %312 + %314 = OpFAdd %152 %313 %311 + %315 = OpAccessChain %213 %205 %256 + OpStore %315 %314 + %316 = OpAccessChain %213 %193 %212 + %317 = OpLoad %152 %316 + %318 = OpAccessChain %213 %193 %241 + %319 = OpLoad %152 %318 + %320 = OpFSub %152 %317 %319 + %321 = OpExtInst %152 %1 FAbs %320 + %322 = OpFOrdLessThan %58 %321 %220 + OpSelectionMerge %324 None + OpBranchConditional %322 %323 %324 + %323 = OpLabel + %325 = OpAccessChain %29 %26 %27 %88 + %326 = OpLoad %6 %325 + %327 = OpConvertSToF %152 %326 + %328 = OpAccessChain %213 %205 %212 + %329 = OpLoad %152 %328 + %330 = OpFAdd %152 %329 %327 + %331 = OpAccessChain %213 %205 %212 + OpStore %331 %330 + OpBranch %324 + %324 = OpLabel + %334 = OpLoad %203 %205 + %335 = OpExtInst %203 %1 Normalize %334 + %336 = OpCompositeExtract %152 %335 0 + %337 = OpCompositeExtract %152 %335 1 + %338 = OpCompositeExtract %152 %335 2 + %339 = OpCompositeConstruct %153 %336 %337 %338 %159 + OpStore %333 %339 + %343 = OpLoad %153 %157 + %344 = OpAccessChain %332 %342 %27 + OpStore %344 %343 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %20 = OpVariable %7 Function + %28 = OpLoad %6 %9 + %30 = OpAccessChain %29 %26 %27 %28 + %31 = OpLoad %6 %30 + OpStore %20 %31 + %32 = OpLoad %6 %9 + %33 = OpLoad %6 %10 + %34 = OpAccessChain %29 %26 %27 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %29 %26 %27 %32 + OpStore %36 %35 + %37 = OpLoad %6 %10 + %38 = OpLoad %6 %20 + %39 = OpAccessChain %29 %26 %27 %37 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %16 = OpFunction %6 None %13 + %14 = OpFunctionParameter %7 + %15 = OpFunctionParameter %7 + %17 = OpLabel + %40 = OpVariable %7 Function + %44 = OpVariable %7 Function + %48 = OpVariable %7 Function + %69 = OpVariable %7 Function + %71 = OpVariable %7 Function + %78 = OpVariable %7 Function + %79 = OpVariable %7 Function + %41 = OpLoad %6 %15 + %42 = OpAccessChain %29 %26 %27 %41 + %43 = OpLoad %6 %42 + OpStore %40 %43 + %45 = OpLoad %6 %14 + %47 = OpISub %6 %45 %46 + OpStore %44 %47 + %49 = OpLoad %6 %14 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %48 + %56 = OpLoad %6 %15 + %57 = OpISub %6 %56 %46 + %59 = OpSLessThanEqual %58 %55 %57 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %48 + %61 = OpAccessChain %29 %26 %27 %60 + %62 = OpLoad %6 %61 + %63 = OpLoad %6 %40 + %64 = OpSLessThanEqual %58 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpLoad %6 %44 + %68 = OpIAdd %6 %67 %46 + OpStore %44 %68 + %70 = OpLoad %6 %44 + OpStore %69 %70 + %72 = OpLoad %6 %48 + OpStore %71 %72 + %73 = OpFunctionCall %2 %11 %69 %71 + OpBranch %66 + %66 = OpLabel + OpBranch %53 + %53 = OpLabel + %74 = OpLoad %6 %48 + %75 = OpIAdd %6 %74 %46 + OpStore %48 %75 + OpBranch %50 + %52 = OpLabel + %76 = OpLoad %6 %44 + %77 = OpIAdd %6 %76 %46 + OpStore %78 %77 + %80 = OpLoad %6 %15 + OpStore %79 %80 + %81 = OpFunctionCall %2 %11 %78 %79 + %82 = OpLoad %6 %44 + %83 = OpIAdd %6 %82 %46 + OpReturnValue %83 + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %86 = OpVariable %7 Function + %87 = OpVariable %7 Function + %89 = OpVariable %7 Function + %92 = OpVariable %91 Function + %116 = OpVariable %7 Function + %117 = OpVariable %7 Function + %119 = OpVariable %7 Function + OpStore %86 %27 + OpStore %87 %88 + OpStore %89 %90 + %93 = OpLoad %6 %89 + %94 = OpIAdd %6 %93 %46 + OpStore %89 %94 + %95 = OpLoad %6 %86 + %96 = OpAccessChain %7 %92 %94 + OpStore %96 %95 + %97 = OpLoad %6 %89 + %98 = OpIAdd %6 %97 %46 + OpStore %89 %98 + %99 = OpLoad %6 %87 + %100 = OpAccessChain %7 %92 %98 + OpStore %100 %99 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %6 %89 + %107 = OpSGreaterThanEqual %58 %106 %27 + OpBranchConditional %107 %102 %103 + %102 = OpLabel + %108 = OpLoad %6 %89 + %109 = OpISub %6 %108 %46 + OpStore %89 %109 + %110 = OpAccessChain %7 %92 %108 + %111 = OpLoad %6 %110 + OpStore %87 %111 + %112 = OpLoad %6 %89 + %113 = OpISub %6 %112 %46 + OpStore %89 %113 + %114 = OpAccessChain %7 %92 %112 + %115 = OpLoad %6 %114 + OpStore %86 %115 + %118 = OpLoad %6 %86 + OpStore %117 %118 + %120 = OpLoad %6 %87 + OpStore %119 %120 + %121 = OpFunctionCall %6 %16 %117 %119 + OpStore %116 %121 + %122 = OpLoad %6 %116 + %123 = OpISub %6 %122 %46 + %124 = OpLoad %6 %86 + %125 = OpSGreaterThan %58 %123 %124 + OpSelectionMerge %127 None + OpBranchConditional %125 %126 %127 + %126 = OpLabel + %128 = OpLoad %6 %89 + %129 = OpIAdd %6 %128 %46 + OpStore %89 %129 + %130 = OpLoad %6 %86 + %131 = OpAccessChain %7 %92 %129 + OpStore %131 %130 + %132 = OpLoad %6 %89 + %133 = OpIAdd %6 %132 %46 + OpStore %89 %133 + %134 = OpLoad %6 %116 + %135 = OpISub %6 %134 %46 + %136 = OpAccessChain %7 %92 %133 + OpStore %136 %135 + OpBranch %127 + %127 = OpLabel + %137 = OpLoad %6 %116 + %138 = OpIAdd %6 %137 %46 + %139 = OpLoad %6 %87 + %140 = OpSLessThan %58 %138 %139 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpLoad %6 %89 + %144 = OpIAdd %6 %143 %46 + OpStore %89 %144 + %145 = OpLoad %6 %116 + %146 = OpIAdd %6 %145 %46 + %147 = OpAccessChain %7 %92 %144 + OpStore %147 %146 + %148 = OpLoad %6 %89 + %149 = OpIAdd %6 %148 %46 + OpStore %89 %149 + %150 = OpLoad %6 %87 + %151 = OpAccessChain %7 %92 %149 + OpStore %151 %150 + OpBranch %142 + %142 = OpLabel + OpBranch %104 + %104 = OpLabel + OpBranch %101 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# reference_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(location = 0) in vec4 frag_color; +# +# void main() +# { +# _GLF_color = frag_color; +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 13 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %11 "frag_color" + OpDecorate %9 Location 0 + OpDecorate %11 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %7 + %11 = OpVariable %10 Input + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %7 %11 + OpStore %9 %12 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_GRID POS 0 0 SIZE 256 256 CELLS 8 8 + + +# variant_vertex_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# vec4 _GLF_FragCoord; +# +# layout(location = 0) in vec4 _GLF_pos; +# +# layout(location = 0) out vec4 frag_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 resolution; +# }; +# struct QuicksortObject { +# int numbers[10]; +# } ; +# +# QuicksortObject obj; +# +# void swap(int i, int j) +# { +# int temp = obj.numbers[i]; +# obj.numbers[i] = obj.numbers[j]; +# obj.numbers[j] = temp; +# } +# int performPartition(int l, int h) +# { +# int pivot = obj.numbers[h]; +# int i = (l - 1); +# for(int j = l; j <= h - 1; j ++) +# { +# if(obj.numbers[j] <= pivot) +# { +# i ++; +# swap(i, j); +# } +# } +# swap(i + 1, h); +# // Wrapping return (i + 1); in if else statement +# // below should have no effect. +# if(false) +# { +# } +# else +# { +# return (i + 1); +# } +# } +# void quicksort() +# { +# int l = 0, h = 9; +# int stack[10]; +# int top = - 1; +# stack[++ top] = l; +# stack[++ top] = h; +# while(top >= 0) +# { +# h = stack[top --]; +# l = stack[top --]; +# int p = performPartition(l, h); +# if(p - 1 > l) +# { +# stack[++ top] = l; +# stack[++ top] = p - 1; +# } +# if(p + 1 < h) +# { +# stack[++ top] = p + 1; +# stack[++ top] = h; +# } +# } +# } +# void main() +# { +# _GLF_FragCoord = (_GLF_pos + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0); +# for(int i = 0; i < 10; i ++) +# { +# obj.numbers[i] = (10 - i); +# obj.numbers[i] = obj.numbers[i] * obj.numbers[i]; +# } +# quicksort(); +# vec2 uv = _GLF_FragCoord.xy / resolution; +# vec3 color = vec3(1.0, 2.0, 3.0); +# color.x += float(obj.numbers[0]); +# if(uv.x > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[1]); +# } +# if(uv.x > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[2]); +# } +# if(uv.x > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[3]); +# } +# color.y += float(obj.numbers[4]); +# if(uv.y > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[5]); +# } +# if(uv.y > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[6]); +# } +# if(uv.y > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[7]); +# } +# color.z += float(obj.numbers[8]); +# if(abs(uv.x - uv.y) < 0.25) +# { +# color.x += float(obj.numbers[9]); +# } +# frag_color = vec4(normalize(color), 1.0); +# gl_Position = _GLF_pos; +# } +SHADER vertex variant_vertex_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 439 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main" %161 %337 %346 + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "swap(i1;i1;" + OpName %9 "i" + OpName %10 "j" + OpName %16 "performPartition(i1;i1;" + OpName %14 "l" + OpName %15 "h" + OpName %18 "quicksort(" + OpName %20 "temp" + OpName %24 "QuicksortObject" + OpMemberName %24 0 "numbers" + OpName %26 "obj" + OpName %40 "pivot" + OpName %44 "i" + OpName %48 "j" + OpName %69 "param" + OpName %71 "param" + OpName %78 "param" + OpName %79 "param" + OpName %90 "l" + OpName %91 "h" + OpName %93 "top" + OpName %96 "stack" + OpName %120 "p" + OpName %121 "param" + OpName %123 "param" + OpName %159 "_GLF_FragCoord" + OpName %161 "_GLF_pos" + OpName %170 "i" + OpName %197 "uv" + OpName %200 "buf0" + OpMemberName %200 0 "resolution" + OpName %202 "" + OpName %209 "color" + OpName %337 "frag_color" + OpName %344 "gl_PerVertex" + OpMemberName %344 0 "gl_Position" + OpMemberName %344 1 "gl_PointSize" + OpName %346 "" + OpDecorate %161 Location 0 + OpMemberDecorate %200 0 Offset 0 + OpDecorate %200 Block + OpDecorate %202 DescriptorSet 0 + OpDecorate %202 Binding 0 + OpDecorate %337 Location 0 + OpMemberDecorate %344 0 BuiltIn Position + OpMemberDecorate %344 1 BuiltIn PointSize + OpDecorate %344 Block + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeFunction %6 %7 %7 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 0 + %29 = OpTypePointer Private %6 + %46 = OpConstant %6 1 + %58 = OpTypeBool + %82 = OpConstantFalse %58 + %92 = OpConstant %6 9 + %94 = OpConstant %6 -1 + %95 = OpTypePointer Function %23 + %156 = OpTypeFloat 32 + %157 = OpTypeVector %156 4 + %158 = OpTypePointer Private %157 + %159 = OpVariable %158 Private + %160 = OpTypePointer Input %157 + %161 = OpVariable %160 Input + %163 = OpConstant %156 1 + %164 = OpConstant %156 0 + %165 = OpConstantComposite %157 %163 %163 %164 %164 + %167 = OpConstant %156 128 + %168 = OpConstantComposite %157 %167 %167 %163 %163 + %177 = OpConstant %6 10 + %195 = OpTypeVector %156 2 + %196 = OpTypePointer Function %195 + %200 = OpTypeStruct %195 + %201 = OpTypePointer Uniform %200 + %202 = OpVariable %201 Uniform + %203 = OpTypePointer Uniform %195 + %207 = OpTypeVector %156 3 + %208 = OpTypePointer Function %207 + %210 = OpConstant %156 2 + %211 = OpConstant %156 3 + %212 = OpConstantComposite %207 %163 %210 %211 + %216 = OpConstant %21 0 + %217 = OpTypePointer Function %156 + %224 = OpConstant %156 0.25 + %237 = OpConstant %156 0.5 + %241 = OpConstant %6 2 + %245 = OpConstant %21 1 + %252 = OpConstant %156 0.75 + %256 = OpConstant %6 3 + %260 = OpConstant %21 2 + %265 = OpConstant %6 4 + %278 = OpConstant %6 5 + %291 = OpConstant %6 6 + %304 = OpConstant %6 7 + %312 = OpConstant %6 8 + %336 = OpTypePointer Output %157 + %337 = OpVariable %336 Output + %344 = OpTypeStruct %157 %156 + %345 = OpTypePointer Output %344 + %346 = OpVariable %345 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %349 = OpVariable %7 Function + %350 = OpVariable %7 Function + %351 = OpVariable %7 Function + %352 = OpVariable %95 Function + %353 = OpVariable %7 Function + %354 = OpVariable %7 Function + %355 = OpVariable %7 Function + %170 = OpVariable %7 Function + %197 = OpVariable %196 Function + %209 = OpVariable %208 Function + %162 = OpLoad %157 %161 + %166 = OpFAdd %157 %162 %165 + %169 = OpFMul %157 %166 %168 + OpStore %159 %169 + OpStore %170 %27 + OpBranch %171 + %171 = OpLabel + OpLoopMerge %173 %174 None + OpBranch %175 + %175 = OpLabel + %176 = OpLoad %6 %170 + %178 = OpSLessThan %58 %176 %177 + OpBranchConditional %178 %172 %173 + %172 = OpLabel + %179 = OpLoad %6 %170 + %180 = OpLoad %6 %170 + %181 = OpISub %6 %177 %180 + %182 = OpAccessChain %29 %26 %27 %179 + OpStore %182 %181 + %183 = OpLoad %6 %170 + %184 = OpLoad %6 %170 + %185 = OpAccessChain %29 %26 %27 %184 + %186 = OpLoad %6 %185 + %187 = OpLoad %6 %170 + %188 = OpAccessChain %29 %26 %27 %187 + %189 = OpLoad %6 %188 + %190 = OpIMul %6 %186 %189 + %191 = OpAccessChain %29 %26 %27 %183 + OpStore %191 %190 + OpBranch %174 + %174 = OpLabel + %192 = OpLoad %6 %170 + %193 = OpIAdd %6 %192 %46 + OpStore %170 %193 + OpBranch %171 + %173 = OpLabel + OpStore %349 %27 + OpStore %350 %92 + OpStore %351 %94 + %357 = OpLoad %6 %351 + %358 = OpIAdd %6 %357 %46 + OpStore %351 %358 + %359 = OpLoad %6 %349 + %360 = OpAccessChain %7 %352 %358 + OpStore %360 %359 + %361 = OpLoad %6 %351 + %362 = OpIAdd %6 %361 %46 + OpStore %351 %362 + %363 = OpLoad %6 %350 + %364 = OpAccessChain %7 %352 %362 + OpStore %364 %363 + OpBranch %365 + %365 = OpLabel + OpLoopMerge %412 %411 None + OpBranch %366 + %366 = OpLabel + %367 = OpLoad %6 %351 + %368 = OpSGreaterThanEqual %58 %367 %27 + OpBranchConditional %368 %369 %412 + %369 = OpLabel + %370 = OpLoad %6 %351 + %371 = OpISub %6 %370 %46 + OpStore %351 %371 + %372 = OpAccessChain %7 %352 %370 + %373 = OpLoad %6 %372 + OpStore %350 %373 + %374 = OpLoad %6 %351 + %375 = OpISub %6 %374 %46 + OpStore %351 %375 + %376 = OpAccessChain %7 %352 %374 + %377 = OpLoad %6 %376 + OpStore %349 %377 + %378 = OpLoad %6 %349 + OpStore %354 %378 + %379 = OpLoad %6 %350 + OpStore %355 %379 + %380 = OpFunctionCall %6 %16 %354 %355 + OpStore %353 %380 + %381 = OpLoad %6 %353 + %382 = OpISub %6 %381 %46 + %383 = OpLoad %6 %349 + %384 = OpSGreaterThan %58 %382 %383 + OpSelectionMerge %395 None + OpBranchConditional %384 %385 %395 + %385 = OpLabel + %386 = OpLoad %6 %351 + %387 = OpIAdd %6 %386 %46 + OpStore %351 %387 + %388 = OpLoad %6 %349 + %389 = OpAccessChain %7 %352 %387 + OpStore %389 %388 + %390 = OpLoad %6 %351 + %391 = OpIAdd %6 %390 %46 + OpStore %351 %391 + %392 = OpLoad %6 %353 + %393 = OpISub %6 %392 %46 + %394 = OpAccessChain %7 %352 %391 + OpStore %394 %393 + OpBranch %395 + %395 = OpLabel + %396 = OpLoad %6 %353 + %397 = OpIAdd %6 %396 %46 + %398 = OpLoad %6 %350 + %399 = OpSLessThan %58 %397 %398 + OpSelectionMerge %410 None + OpBranchConditional %399 %400 %410 + %400 = OpLabel + %401 = OpLoad %6 %351 + %402 = OpIAdd %6 %401 %46 + OpStore %351 %402 + %403 = OpLoad %6 %353 + %404 = OpIAdd %6 %403 %46 + %405 = OpAccessChain %7 %352 %402 + OpStore %405 %404 + %406 = OpLoad %6 %351 + %407 = OpIAdd %6 %406 %46 + OpStore %351 %407 + %408 = OpLoad %6 %350 + %409 = OpAccessChain %7 %352 %407 + OpStore %409 %408 + OpBranch %410 + %410 = OpLabel + OpBranch %411 + %411 = OpLabel + OpBranch %365 + %412 = OpLabel + %198 = OpLoad %157 %159 + %199 = OpVectorShuffle %195 %198 %198 0 1 + %204 = OpAccessChain %203 %202 %27 + %205 = OpLoad %195 %204 + %206 = OpFDiv %195 %199 %205 + OpStore %197 %206 + OpStore %209 %212 + %213 = OpAccessChain %29 %26 %27 %27 + %214 = OpLoad %6 %213 + %215 = OpConvertSToF %156 %214 + %218 = OpAccessChain %217 %209 %216 + %219 = OpLoad %156 %218 + %220 = OpFAdd %156 %219 %215 + %221 = OpAccessChain %217 %209 %216 + OpStore %221 %220 + %222 = OpAccessChain %217 %197 %216 + %223 = OpLoad %156 %222 + %225 = OpFOrdGreaterThan %58 %223 %224 + OpSelectionMerge %227 None + OpBranchConditional %225 %226 %227 + %226 = OpLabel + %228 = OpAccessChain %29 %26 %27 %46 + %229 = OpLoad %6 %228 + %230 = OpConvertSToF %156 %229 + %231 = OpAccessChain %217 %209 %216 + %232 = OpLoad %156 %231 + %233 = OpFAdd %156 %232 %230 + %234 = OpAccessChain %217 %209 %216 + OpStore %234 %233 + OpBranch %227 + %227 = OpLabel + %235 = OpAccessChain %217 %197 %216 + %236 = OpLoad %156 %235 + %238 = OpFOrdGreaterThan %58 %236 %237 + OpSelectionMerge %240 None + OpBranchConditional %238 %239 %240 + %239 = OpLabel + %242 = OpAccessChain %29 %26 %27 %241 + %243 = OpLoad %6 %242 + %244 = OpConvertSToF %156 %243 + %246 = OpAccessChain %217 %209 %245 + %247 = OpLoad %156 %246 + %248 = OpFAdd %156 %247 %244 + %249 = OpAccessChain %217 %209 %245 + OpStore %249 %248 + OpBranch %240 + %240 = OpLabel + %250 = OpAccessChain %217 %197 %216 + %251 = OpLoad %156 %250 + %253 = OpFOrdGreaterThan %58 %251 %252 + OpSelectionMerge %255 None + OpBranchConditional %253 %254 %255 + %254 = OpLabel + %257 = OpAccessChain %29 %26 %27 %256 + %258 = OpLoad %6 %257 + %259 = OpConvertSToF %156 %258 + %261 = OpAccessChain %217 %209 %260 + %262 = OpLoad %156 %261 + %263 = OpFAdd %156 %262 %259 + %264 = OpAccessChain %217 %209 %260 + OpStore %264 %263 + OpBranch %255 + %255 = OpLabel + %266 = OpAccessChain %29 %26 %27 %265 + %267 = OpLoad %6 %266 + %268 = OpConvertSToF %156 %267 + %269 = OpAccessChain %217 %209 %245 + %270 = OpLoad %156 %269 + %271 = OpFAdd %156 %270 %268 + %272 = OpAccessChain %217 %209 %245 + OpStore %272 %271 + %273 = OpAccessChain %217 %197 %245 + %274 = OpLoad %156 %273 + %275 = OpFOrdGreaterThan %58 %274 %224 + OpSelectionMerge %277 None + OpBranchConditional %275 %276 %277 + %276 = OpLabel + %279 = OpAccessChain %29 %26 %27 %278 + %280 = OpLoad %6 %279 + %281 = OpConvertSToF %156 %280 + %282 = OpAccessChain %217 %209 %216 + %283 = OpLoad %156 %282 + %284 = OpFAdd %156 %283 %281 + %285 = OpAccessChain %217 %209 %216 + OpStore %285 %284 + OpBranch %277 + %277 = OpLabel + %286 = OpAccessChain %217 %197 %245 + %287 = OpLoad %156 %286 + %288 = OpFOrdGreaterThan %58 %287 %237 + OpSelectionMerge %290 None + OpBranchConditional %288 %289 %290 + %289 = OpLabel + %292 = OpAccessChain %29 %26 %27 %291 + %293 = OpLoad %6 %292 + %294 = OpConvertSToF %156 %293 + %295 = OpAccessChain %217 %209 %245 + %296 = OpLoad %156 %295 + %297 = OpFAdd %156 %296 %294 + %298 = OpAccessChain %217 %209 %245 + OpStore %298 %297 + OpBranch %290 + %290 = OpLabel + %299 = OpAccessChain %217 %197 %245 + %300 = OpLoad %156 %299 + %301 = OpFOrdGreaterThan %58 %300 %252 + OpSelectionMerge %303 None + OpBranchConditional %301 %302 %303 + %302 = OpLabel + %305 = OpAccessChain %29 %26 %27 %304 + %306 = OpLoad %6 %305 + %307 = OpConvertSToF %156 %306 + %308 = OpAccessChain %217 %209 %260 + %309 = OpLoad %156 %308 + %310 = OpFAdd %156 %309 %307 + %311 = OpAccessChain %217 %209 %260 + OpStore %311 %310 + OpBranch %303 + %303 = OpLabel + %313 = OpAccessChain %29 %26 %27 %312 + %314 = OpLoad %6 %313 + %315 = OpConvertSToF %156 %314 + %316 = OpAccessChain %217 %209 %260 + %317 = OpLoad %156 %316 + %318 = OpFAdd %156 %317 %315 + %319 = OpAccessChain %217 %209 %260 + OpStore %319 %318 + %320 = OpAccessChain %217 %197 %216 + %321 = OpLoad %156 %320 + %322 = OpAccessChain %217 %197 %245 + %323 = OpLoad %156 %322 + %324 = OpFSub %156 %321 %323 + %325 = OpExtInst %156 %1 FAbs %324 + %326 = OpFOrdLessThan %58 %325 %224 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %29 %26 %27 %92 + %330 = OpLoad %6 %329 + %331 = OpConvertSToF %156 %330 + %332 = OpAccessChain %217 %209 %216 + %333 = OpLoad %156 %332 + %334 = OpFAdd %156 %333 %331 + %335 = OpAccessChain %217 %209 %216 + OpStore %335 %334 + OpBranch %328 + %328 = OpLabel + %338 = OpLoad %207 %209 + %339 = OpExtInst %207 %1 Normalize %338 + %340 = OpCompositeExtract %156 %339 0 + %341 = OpCompositeExtract %156 %339 1 + %342 = OpCompositeExtract %156 %339 2 + %343 = OpCompositeConstruct %157 %340 %341 %342 %163 + OpStore %337 %343 + %347 = OpLoad %157 %161 + %348 = OpAccessChain %336 %346 %27 + OpStore %348 %347 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %20 = OpVariable %7 Function + %28 = OpLoad %6 %9 + %30 = OpAccessChain %29 %26 %27 %28 + %31 = OpLoad %6 %30 + OpStore %20 %31 + %32 = OpLoad %6 %9 + %33 = OpLoad %6 %10 + %34 = OpAccessChain %29 %26 %27 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %29 %26 %27 %32 + OpStore %36 %35 + %37 = OpLoad %6 %10 + %38 = OpLoad %6 %20 + %39 = OpAccessChain %29 %26 %27 %37 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %16 = OpFunction %6 None %13 + %14 = OpFunctionParameter %7 + %15 = OpFunctionParameter %7 + %17 = OpLabel + %426 = OpVariable %7 Function + %413 = OpVariable %7 Function + %40 = OpVariable %7 Function + %44 = OpVariable %7 Function + %48 = OpVariable %7 Function + %69 = OpVariable %7 Function + %71 = OpVariable %7 Function + %78 = OpVariable %7 Function + %79 = OpVariable %7 Function + %41 = OpLoad %6 %15 + %42 = OpAccessChain %29 %26 %27 %41 + %43 = OpLoad %6 %42 + OpStore %40 %43 + %45 = OpLoad %6 %14 + %47 = OpISub %6 %45 %46 + OpStore %44 %47 + %49 = OpLoad %6 %14 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %48 + %56 = OpLoad %6 %15 + %57 = OpISub %6 %56 %46 + %59 = OpSLessThanEqual %58 %55 %57 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %48 + %61 = OpAccessChain %29 %26 %27 %60 + %62 = OpLoad %6 %61 + %63 = OpLoad %6 %40 + %64 = OpSLessThanEqual %58 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpLoad %6 %44 + %68 = OpIAdd %6 %67 %46 + OpStore %44 %68 + %70 = OpLoad %6 %44 + OpStore %69 %70 + %72 = OpLoad %6 %48 + OpStore %71 %72 + %415 = OpLoad %6 %69 + %416 = OpAccessChain %29 %26 %27 %415 + %417 = OpLoad %6 %416 + OpStore %413 %417 + %418 = OpLoad %6 %69 + %419 = OpLoad %6 %71 + %420 = OpAccessChain %29 %26 %27 %419 + %421 = OpLoad %6 %420 + %422 = OpAccessChain %29 %26 %27 %418 + OpStore %422 %421 + %423 = OpLoad %6 %71 + %424 = OpLoad %6 %413 + %425 = OpAccessChain %29 %26 %27 %423 + OpStore %425 %424 + OpBranch %66 + %66 = OpLabel + OpBranch %53 + %53 = OpLabel + %74 = OpLoad %6 %48 + %75 = OpIAdd %6 %74 %46 + OpStore %48 %75 + OpBranch %50 + %52 = OpLabel + %76 = OpLoad %6 %44 + %77 = OpIAdd %6 %76 %46 + OpStore %78 %77 + %80 = OpLoad %6 %15 + OpStore %79 %80 + %428 = OpLoad %6 %78 + %429 = OpAccessChain %29 %26 %27 %428 + %430 = OpLoad %6 %429 + OpStore %426 %430 + %431 = OpLoad %6 %78 + %432 = OpLoad %6 %79 + %433 = OpAccessChain %29 %26 %27 %432 + %434 = OpLoad %6 %433 + %435 = OpAccessChain %29 %26 %27 %431 + OpStore %435 %434 + %436 = OpLoad %6 %79 + %437 = OpLoad %6 %426 + %438 = OpAccessChain %29 %26 %27 %436 + OpStore %438 %437 + OpSelectionMerge %84 None + OpBranchConditional %82 %83 %85 + %83 = OpLabel + OpBranch %84 + %85 = OpLabel + %86 = OpLoad %6 %44 + %87 = OpIAdd %6 %86 %46 + OpReturnValue %87 + %84 = OpLabel + %89 = OpUndef %6 + OpReturnValue %89 + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %90 = OpVariable %7 Function + %91 = OpVariable %7 Function + %93 = OpVariable %7 Function + %96 = OpVariable %95 Function + %120 = OpVariable %7 Function + %121 = OpVariable %7 Function + %123 = OpVariable %7 Function + OpStore %90 %27 + OpStore %91 %92 + OpStore %93 %94 + %97 = OpLoad %6 %93 + %98 = OpIAdd %6 %97 %46 + OpStore %93 %98 + %99 = OpLoad %6 %90 + %100 = OpAccessChain %7 %96 %98 + OpStore %100 %99 + %101 = OpLoad %6 %93 + %102 = OpIAdd %6 %101 %46 + OpStore %93 %102 + %103 = OpLoad %6 %91 + %104 = OpAccessChain %7 %96 %102 + OpStore %104 %103 + OpBranch %105 + %105 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %110 = OpLoad %6 %93 + %111 = OpSGreaterThanEqual %58 %110 %27 + OpBranchConditional %111 %106 %107 + %106 = OpLabel + %112 = OpLoad %6 %93 + %113 = OpISub %6 %112 %46 + OpStore %93 %113 + %114 = OpAccessChain %7 %96 %112 + %115 = OpLoad %6 %114 + OpStore %91 %115 + %116 = OpLoad %6 %93 + %117 = OpISub %6 %116 %46 + OpStore %93 %117 + %118 = OpAccessChain %7 %96 %116 + %119 = OpLoad %6 %118 + OpStore %90 %119 + %122 = OpLoad %6 %90 + OpStore %121 %122 + %124 = OpLoad %6 %91 + OpStore %123 %124 + %125 = OpFunctionCall %6 %16 %121 %123 + OpStore %120 %125 + %126 = OpLoad %6 %120 + %127 = OpISub %6 %126 %46 + %128 = OpLoad %6 %90 + %129 = OpSGreaterThan %58 %127 %128 + OpSelectionMerge %131 None + OpBranchConditional %129 %130 %131 + %130 = OpLabel + %132 = OpLoad %6 %93 + %133 = OpIAdd %6 %132 %46 + OpStore %93 %133 + %134 = OpLoad %6 %90 + %135 = OpAccessChain %7 %96 %133 + OpStore %135 %134 + %136 = OpLoad %6 %93 + %137 = OpIAdd %6 %136 %46 + OpStore %93 %137 + %138 = OpLoad %6 %120 + %139 = OpISub %6 %138 %46 + %140 = OpAccessChain %7 %96 %137 + OpStore %140 %139 + OpBranch %131 + %131 = OpLabel + %141 = OpLoad %6 %120 + %142 = OpIAdd %6 %141 %46 + %143 = OpLoad %6 %91 + %144 = OpSLessThan %58 %142 %143 + OpSelectionMerge %146 None + OpBranchConditional %144 %145 %146 + %145 = OpLabel + %147 = OpLoad %6 %93 + %148 = OpIAdd %6 %147 %46 + OpStore %93 %148 + %149 = OpLoad %6 %120 + %150 = OpIAdd %6 %149 %46 + %151 = OpAccessChain %7 %96 %148 + OpStore %151 %150 + %152 = OpLoad %6 %93 + %153 = OpIAdd %6 %152 %46 + OpStore %93 %153 + %154 = OpLoad %6 %91 + %155 = OpAccessChain %7 %96 %153 + OpStore %155 %154 + OpBranch %146 + %146 = OpLabel + OpBranch %108 + %108 = OpLabel + OpBranch %105 + %107 = OpLabel + OpReturn + OpFunctionEnd +END + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(location = 0) in vec4 frag_color; +# +# void main() +# { +# _GLF_color = frag_color; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 13 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %11 "frag_color" + OpDecorate %9 Location 0 + OpDecorate %11 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %7 + %11 = OpVariable %10 Input + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %7 %11 + OpStore %9 %12 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_GRID POS 0 0 SIZE 256 256 CELLS 8 8 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-quicksort-max-value-as-index.amber b/vulkan/amber/graphicsfuzz/stable-quicksort-max-value-as-index.amber new file mode 100644 index 0000000..e418eb8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-quicksort-max-value-as-index.amber @@ -0,0 +1,1442 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: A fragment shader with greater of two values as index + +# The test passes because both shaders render the same image. + +# reference_vertex_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# vec4 _GLF_FragCoord; +# +# layout(location = 0) in vec4 _GLF_pos; +# +# layout(location = 0) out vec4 frag_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# struct QuicksortObject +# { +# int numbers[10]; +# }; +# +# QuicksortObject obj; +# +# void swap(int i, int j) +# { +# int temp = obj.numbers[i]; +# obj.numbers[i] = obj.numbers[j]; +# obj.numbers[j] = temp; +# } +# int performPartition(int l, int h) +# { +# int pivot = obj.numbers[h]; +# int i = (l - 1); +# for (int j = l; j <= h - 1; j++) +# { +# if (obj.numbers[j] <= pivot) +# { +# i++; +# swap(i, j); +# } +# } +# swap(i + 1, h); +# return (i + 1); +# } +# void quicksort() +# { +# int l = 0, h = 9; +# int stack[10]; +# int top = -1; +# stack[++top] = l; +# stack[++top] = h; +# while (top >= 0) +# { +# h = stack[top--]; +# l = stack[top--]; +# int p = performPartition(l, h); +# if (p - 1 > l) +# { +# stack[++top] = l; +# stack[++top] = p - 1; +# } +# if (p + 1 < h) +# { +# stack[++top] = p + 1; +# stack[++top] = h; +# } +# } +# } +# void main() +# { +# _GLF_FragCoord = (_GLF_pos + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0); +# for (int i = 0; i < 10; i++) +# { +# obj.numbers[i] = (10 - i); +# obj.numbers[i] = obj.numbers[i] * obj.numbers[i]; +# } +# quicksort(); +# vec2 uv = _GLF_FragCoord.xy / resolution; +# vec3 color = vec3(1.0, 2.0, 3.0); +# color.x += float(obj.numbers[0]); +# if (uv.x > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[1]); +# } +# if (uv.x > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[2]); +# } +# if (uv.x > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[3]); +# } +# color.y += float(obj.numbers[4]); +# if (uv.y > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[5]); +# } +# if (uv.y > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[6]); +# } +# if (uv.y > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[7]); +# } +# color.z += float(obj.numbers[8]); +# if (abs(uv.x - uv.y) < 0.25) +# { +# color.x += float(obj.numbers[9]); +# } +# frag_color = vec4(normalize(color), 1.0); +# gl_Position = _GLF_pos; +# } +SHADER vertex reference_vertex_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 345 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main" %157 %333 %342 + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "swap(i1;i1;" + OpName %9 "i" + OpName %10 "j" + OpName %16 "performPartition(i1;i1;" + OpName %14 "l" + OpName %15 "h" + OpName %18 "quicksort(" + OpName %20 "temp" + OpName %24 "QuicksortObject" + OpMemberName %24 0 "numbers" + OpName %26 "obj" + OpName %40 "pivot" + OpName %44 "i" + OpName %48 "j" + OpName %69 "param" + OpName %71 "param" + OpName %78 "param" + OpName %79 "param" + OpName %86 "l" + OpName %87 "h" + OpName %89 "top" + OpName %92 "stack" + OpName %116 "p" + OpName %117 "param" + OpName %119 "param" + OpName %155 "_GLF_FragCoord" + OpName %157 "_GLF_pos" + OpName %166 "i" + OpName %193 "uv" + OpName %196 "buf0" + OpMemberName %196 0 "resolution" + OpName %198 "" + OpName %205 "color" + OpName %333 "frag_color" + OpName %340 "gl_PerVertex" + OpMemberName %340 0 "gl_Position" + OpMemberName %340 1 "gl_PointSize" + OpName %342 "" + OpDecorate %157 Location 0 + OpMemberDecorate %196 0 Offset 0 + OpDecorate %196 Block + OpDecorate %198 DescriptorSet 0 + OpDecorate %198 Binding 0 + OpDecorate %333 Location 0 + OpMemberDecorate %340 0 BuiltIn Position + OpMemberDecorate %340 1 BuiltIn PointSize + OpDecorate %340 Block + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeFunction %6 %7 %7 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 0 + %29 = OpTypePointer Private %6 + %46 = OpConstant %6 1 + %58 = OpTypeBool + %88 = OpConstant %6 9 + %90 = OpConstant %6 -1 + %91 = OpTypePointer Function %23 + %152 = OpTypeFloat 32 + %153 = OpTypeVector %152 4 + %154 = OpTypePointer Private %153 + %155 = OpVariable %154 Private + %156 = OpTypePointer Input %153 + %157 = OpVariable %156 Input + %159 = OpConstant %152 1 + %160 = OpConstant %152 0 + %161 = OpConstantComposite %153 %159 %159 %160 %160 + %163 = OpConstant %152 128 + %164 = OpConstantComposite %153 %163 %163 %159 %159 + %173 = OpConstant %6 10 + %191 = OpTypeVector %152 2 + %192 = OpTypePointer Function %191 + %196 = OpTypeStruct %191 + %197 = OpTypePointer Uniform %196 + %198 = OpVariable %197 Uniform + %199 = OpTypePointer Uniform %191 + %203 = OpTypeVector %152 3 + %204 = OpTypePointer Function %203 + %206 = OpConstant %152 2 + %207 = OpConstant %152 3 + %208 = OpConstantComposite %203 %159 %206 %207 + %212 = OpConstant %21 0 + %213 = OpTypePointer Function %152 + %220 = OpConstant %152 0.25 + %233 = OpConstant %152 0.5 + %237 = OpConstant %6 2 + %241 = OpConstant %21 1 + %248 = OpConstant %152 0.75 + %252 = OpConstant %6 3 + %256 = OpConstant %21 2 + %261 = OpConstant %6 4 + %274 = OpConstant %6 5 + %287 = OpConstant %6 6 + %300 = OpConstant %6 7 + %308 = OpConstant %6 8 + %332 = OpTypePointer Output %153 + %333 = OpVariable %332 Output + %340 = OpTypeStruct %153 %152 + %341 = OpTypePointer Output %340 + %342 = OpVariable %341 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %166 = OpVariable %7 Function + %193 = OpVariable %192 Function + %205 = OpVariable %204 Function + %158 = OpLoad %153 %157 + %162 = OpFAdd %153 %158 %161 + %165 = OpFMul %153 %162 %164 + OpStore %155 %165 + OpStore %166 %27 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %172 = OpLoad %6 %166 + %174 = OpSLessThan %58 %172 %173 + OpBranchConditional %174 %168 %169 + %168 = OpLabel + %175 = OpLoad %6 %166 + %176 = OpLoad %6 %166 + %177 = OpISub %6 %173 %176 + %178 = OpAccessChain %29 %26 %27 %175 + OpStore %178 %177 + %179 = OpLoad %6 %166 + %180 = OpLoad %6 %166 + %181 = OpAccessChain %29 %26 %27 %180 + %182 = OpLoad %6 %181 + %183 = OpLoad %6 %166 + %184 = OpAccessChain %29 %26 %27 %183 + %185 = OpLoad %6 %184 + %186 = OpIMul %6 %182 %185 + %187 = OpAccessChain %29 %26 %27 %179 + OpStore %187 %186 + OpBranch %170 + %170 = OpLabel + %188 = OpLoad %6 %166 + %189 = OpIAdd %6 %188 %46 + OpStore %166 %189 + OpBranch %167 + %169 = OpLabel + %190 = OpFunctionCall %2 %18 + %194 = OpLoad %153 %155 + %195 = OpVectorShuffle %191 %194 %194 0 1 + %200 = OpAccessChain %199 %198 %27 + %201 = OpLoad %191 %200 + %202 = OpFDiv %191 %195 %201 + OpStore %193 %202 + OpStore %205 %208 + %209 = OpAccessChain %29 %26 %27 %27 + %210 = OpLoad %6 %209 + %211 = OpConvertSToF %152 %210 + %214 = OpAccessChain %213 %205 %212 + %215 = OpLoad %152 %214 + %216 = OpFAdd %152 %215 %211 + %217 = OpAccessChain %213 %205 %212 + OpStore %217 %216 + %218 = OpAccessChain %213 %193 %212 + %219 = OpLoad %152 %218 + %221 = OpFOrdGreaterThan %58 %219 %220 + OpSelectionMerge %223 None + OpBranchConditional %221 %222 %223 + %222 = OpLabel + %224 = OpAccessChain %29 %26 %27 %46 + %225 = OpLoad %6 %224 + %226 = OpConvertSToF %152 %225 + %227 = OpAccessChain %213 %205 %212 + %228 = OpLoad %152 %227 + %229 = OpFAdd %152 %228 %226 + %230 = OpAccessChain %213 %205 %212 + OpStore %230 %229 + OpBranch %223 + %223 = OpLabel + %231 = OpAccessChain %213 %193 %212 + %232 = OpLoad %152 %231 + %234 = OpFOrdGreaterThan %58 %232 %233 + OpSelectionMerge %236 None + OpBranchConditional %234 %235 %236 + %235 = OpLabel + %238 = OpAccessChain %29 %26 %27 %237 + %239 = OpLoad %6 %238 + %240 = OpConvertSToF %152 %239 + %242 = OpAccessChain %213 %205 %241 + %243 = OpLoad %152 %242 + %244 = OpFAdd %152 %243 %240 + %245 = OpAccessChain %213 %205 %241 + OpStore %245 %244 + OpBranch %236 + %236 = OpLabel + %246 = OpAccessChain %213 %193 %212 + %247 = OpLoad %152 %246 + %249 = OpFOrdGreaterThan %58 %247 %248 + OpSelectionMerge %251 None + OpBranchConditional %249 %250 %251 + %250 = OpLabel + %253 = OpAccessChain %29 %26 %27 %252 + %254 = OpLoad %6 %253 + %255 = OpConvertSToF %152 %254 + %257 = OpAccessChain %213 %205 %256 + %258 = OpLoad %152 %257 + %259 = OpFAdd %152 %258 %255 + %260 = OpAccessChain %213 %205 %256 + OpStore %260 %259 + OpBranch %251 + %251 = OpLabel + %262 = OpAccessChain %29 %26 %27 %261 + %263 = OpLoad %6 %262 + %264 = OpConvertSToF %152 %263 + %265 = OpAccessChain %213 %205 %241 + %266 = OpLoad %152 %265 + %267 = OpFAdd %152 %266 %264 + %268 = OpAccessChain %213 %205 %241 + OpStore %268 %267 + %269 = OpAccessChain %213 %193 %241 + %270 = OpLoad %152 %269 + %271 = OpFOrdGreaterThan %58 %270 %220 + OpSelectionMerge %273 None + OpBranchConditional %271 %272 %273 + %272 = OpLabel + %275 = OpAccessChain %29 %26 %27 %274 + %276 = OpLoad %6 %275 + %277 = OpConvertSToF %152 %276 + %278 = OpAccessChain %213 %205 %212 + %279 = OpLoad %152 %278 + %280 = OpFAdd %152 %279 %277 + %281 = OpAccessChain %213 %205 %212 + OpStore %281 %280 + OpBranch %273 + %273 = OpLabel + %282 = OpAccessChain %213 %193 %241 + %283 = OpLoad %152 %282 + %284 = OpFOrdGreaterThan %58 %283 %233 + OpSelectionMerge %286 None + OpBranchConditional %284 %285 %286 + %285 = OpLabel + %288 = OpAccessChain %29 %26 %27 %287 + %289 = OpLoad %6 %288 + %290 = OpConvertSToF %152 %289 + %291 = OpAccessChain %213 %205 %241 + %292 = OpLoad %152 %291 + %293 = OpFAdd %152 %292 %290 + %294 = OpAccessChain %213 %205 %241 + OpStore %294 %293 + OpBranch %286 + %286 = OpLabel + %295 = OpAccessChain %213 %193 %241 + %296 = OpLoad %152 %295 + %297 = OpFOrdGreaterThan %58 %296 %248 + OpSelectionMerge %299 None + OpBranchConditional %297 %298 %299 + %298 = OpLabel + %301 = OpAccessChain %29 %26 %27 %300 + %302 = OpLoad %6 %301 + %303 = OpConvertSToF %152 %302 + %304 = OpAccessChain %213 %205 %256 + %305 = OpLoad %152 %304 + %306 = OpFAdd %152 %305 %303 + %307 = OpAccessChain %213 %205 %256 + OpStore %307 %306 + OpBranch %299 + %299 = OpLabel + %309 = OpAccessChain %29 %26 %27 %308 + %310 = OpLoad %6 %309 + %311 = OpConvertSToF %152 %310 + %312 = OpAccessChain %213 %205 %256 + %313 = OpLoad %152 %312 + %314 = OpFAdd %152 %313 %311 + %315 = OpAccessChain %213 %205 %256 + OpStore %315 %314 + %316 = OpAccessChain %213 %193 %212 + %317 = OpLoad %152 %316 + %318 = OpAccessChain %213 %193 %241 + %319 = OpLoad %152 %318 + %320 = OpFSub %152 %317 %319 + %321 = OpExtInst %152 %1 FAbs %320 + %322 = OpFOrdLessThan %58 %321 %220 + OpSelectionMerge %324 None + OpBranchConditional %322 %323 %324 + %323 = OpLabel + %325 = OpAccessChain %29 %26 %27 %88 + %326 = OpLoad %6 %325 + %327 = OpConvertSToF %152 %326 + %328 = OpAccessChain %213 %205 %212 + %329 = OpLoad %152 %328 + %330 = OpFAdd %152 %329 %327 + %331 = OpAccessChain %213 %205 %212 + OpStore %331 %330 + OpBranch %324 + %324 = OpLabel + %334 = OpLoad %203 %205 + %335 = OpExtInst %203 %1 Normalize %334 + %336 = OpCompositeExtract %152 %335 0 + %337 = OpCompositeExtract %152 %335 1 + %338 = OpCompositeExtract %152 %335 2 + %339 = OpCompositeConstruct %153 %336 %337 %338 %159 + OpStore %333 %339 + %343 = OpLoad %153 %157 + %344 = OpAccessChain %332 %342 %27 + OpStore %344 %343 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %20 = OpVariable %7 Function + %28 = OpLoad %6 %9 + %30 = OpAccessChain %29 %26 %27 %28 + %31 = OpLoad %6 %30 + OpStore %20 %31 + %32 = OpLoad %6 %9 + %33 = OpLoad %6 %10 + %34 = OpAccessChain %29 %26 %27 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %29 %26 %27 %32 + OpStore %36 %35 + %37 = OpLoad %6 %10 + %38 = OpLoad %6 %20 + %39 = OpAccessChain %29 %26 %27 %37 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %16 = OpFunction %6 None %13 + %14 = OpFunctionParameter %7 + %15 = OpFunctionParameter %7 + %17 = OpLabel + %40 = OpVariable %7 Function + %44 = OpVariable %7 Function + %48 = OpVariable %7 Function + %69 = OpVariable %7 Function + %71 = OpVariable %7 Function + %78 = OpVariable %7 Function + %79 = OpVariable %7 Function + %41 = OpLoad %6 %15 + %42 = OpAccessChain %29 %26 %27 %41 + %43 = OpLoad %6 %42 + OpStore %40 %43 + %45 = OpLoad %6 %14 + %47 = OpISub %6 %45 %46 + OpStore %44 %47 + %49 = OpLoad %6 %14 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %48 + %56 = OpLoad %6 %15 + %57 = OpISub %6 %56 %46 + %59 = OpSLessThanEqual %58 %55 %57 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %48 + %61 = OpAccessChain %29 %26 %27 %60 + %62 = OpLoad %6 %61 + %63 = OpLoad %6 %40 + %64 = OpSLessThanEqual %58 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpLoad %6 %44 + %68 = OpIAdd %6 %67 %46 + OpStore %44 %68 + %70 = OpLoad %6 %44 + OpStore %69 %70 + %72 = OpLoad %6 %48 + OpStore %71 %72 + %73 = OpFunctionCall %2 %11 %69 %71 + OpBranch %66 + %66 = OpLabel + OpBranch %53 + %53 = OpLabel + %74 = OpLoad %6 %48 + %75 = OpIAdd %6 %74 %46 + OpStore %48 %75 + OpBranch %50 + %52 = OpLabel + %76 = OpLoad %6 %44 + %77 = OpIAdd %6 %76 %46 + OpStore %78 %77 + %80 = OpLoad %6 %15 + OpStore %79 %80 + %81 = OpFunctionCall %2 %11 %78 %79 + %82 = OpLoad %6 %44 + %83 = OpIAdd %6 %82 %46 + OpReturnValue %83 + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %86 = OpVariable %7 Function + %87 = OpVariable %7 Function + %89 = OpVariable %7 Function + %92 = OpVariable %91 Function + %116 = OpVariable %7 Function + %117 = OpVariable %7 Function + %119 = OpVariable %7 Function + OpStore %86 %27 + OpStore %87 %88 + OpStore %89 %90 + %93 = OpLoad %6 %89 + %94 = OpIAdd %6 %93 %46 + OpStore %89 %94 + %95 = OpLoad %6 %86 + %96 = OpAccessChain %7 %92 %94 + OpStore %96 %95 + %97 = OpLoad %6 %89 + %98 = OpIAdd %6 %97 %46 + OpStore %89 %98 + %99 = OpLoad %6 %87 + %100 = OpAccessChain %7 %92 %98 + OpStore %100 %99 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %6 %89 + %107 = OpSGreaterThanEqual %58 %106 %27 + OpBranchConditional %107 %102 %103 + %102 = OpLabel + %108 = OpLoad %6 %89 + %109 = OpISub %6 %108 %46 + OpStore %89 %109 + %110 = OpAccessChain %7 %92 %108 + %111 = OpLoad %6 %110 + OpStore %87 %111 + %112 = OpLoad %6 %89 + %113 = OpISub %6 %112 %46 + OpStore %89 %113 + %114 = OpAccessChain %7 %92 %112 + %115 = OpLoad %6 %114 + OpStore %86 %115 + %118 = OpLoad %6 %86 + OpStore %117 %118 + %120 = OpLoad %6 %87 + OpStore %119 %120 + %121 = OpFunctionCall %6 %16 %117 %119 + OpStore %116 %121 + %122 = OpLoad %6 %116 + %123 = OpISub %6 %122 %46 + %124 = OpLoad %6 %86 + %125 = OpSGreaterThan %58 %123 %124 + OpSelectionMerge %127 None + OpBranchConditional %125 %126 %127 + %126 = OpLabel + %128 = OpLoad %6 %89 + %129 = OpIAdd %6 %128 %46 + OpStore %89 %129 + %130 = OpLoad %6 %86 + %131 = OpAccessChain %7 %92 %129 + OpStore %131 %130 + %132 = OpLoad %6 %89 + %133 = OpIAdd %6 %132 %46 + OpStore %89 %133 + %134 = OpLoad %6 %116 + %135 = OpISub %6 %134 %46 + %136 = OpAccessChain %7 %92 %133 + OpStore %136 %135 + OpBranch %127 + %127 = OpLabel + %137 = OpLoad %6 %116 + %138 = OpIAdd %6 %137 %46 + %139 = OpLoad %6 %87 + %140 = OpSLessThan %58 %138 %139 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpLoad %6 %89 + %144 = OpIAdd %6 %143 %46 + OpStore %89 %144 + %145 = OpLoad %6 %116 + %146 = OpIAdd %6 %145 %46 + %147 = OpAccessChain %7 %92 %144 + OpStore %147 %146 + %148 = OpLoad %6 %89 + %149 = OpIAdd %6 %148 %46 + OpStore %89 %149 + %150 = OpLoad %6 %87 + %151 = OpAccessChain %7 %92 %149 + OpStore %151 %150 + OpBranch %142 + %142 = OpLabel + OpBranch %104 + %104 = OpLabel + OpBranch %101 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# reference_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(location = 0) in vec4 frag_color; +# +# void main() +# { +# _GLF_color = frag_color; +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 13 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %11 "frag_color" + OpDecorate %9 Location 0 + OpDecorate %11 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %7 + %11 = OpVariable %10 Input + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %7 %11 + OpStore %9 %12 + OpReturn + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_GRID POS 0 0 SIZE 256 256 CELLS 8 8 + + +# variant_vertex_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# highp vec2 injectionSwitch; +# }; +# vec4 _GLF_FragCoord; +# +# layout(location = 0) in vec4 _GLF_pos; +# +# layout(location = 0) out vec4 frag_color; +# +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 resolution; +# }; +# struct QuicksortObject +# { +# int numbers[10]; +# }; +# +# QuicksortObject obj; +# +# void swap(int i, int j) +# { +# int temp = obj.numbers[i]; +# obj.numbers[i] = obj.numbers[j]; +# obj.numbers[j] = temp; +# } +# int performPartition(int l, int h) +# { +# int pivot = obj.numbers[h]; +# int i = (l - 1); +# for (int j = l; j <= h - 1; j++) +# { +# if (obj.numbers[j] <= pivot) +# { +# i++; +# swap(i, j); +# } +# } +# swap(i + 1, h); +# return (i + 1); +# } +# void quicksort() +# { +# int l = 0, h = 9; +# int stack[10]; +# int top = -1; +# stack[++top] = l; +# stack[++top] = h; +# while (top >= 0) +# { +# h = stack[top--]; +# l = stack[top--]; +# int p = performPartition(l, h); +# if (p - 1 > l) +# { +# stack[++top] = l; +# stack[++top] = p - 1; +# } +# if (p + 1 < h) +# { +# stack[++top] = p + 1; +# stack[++top] = h; +# } +# } +# } +# void main() +# { +# _GLF_FragCoord = (_GLF_pos + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0); +# for (int i = 0; i < 10; i++) +# { +# obj.numbers[i] = (10 - i); +# obj.numbers[i] = obj.numbers[i] * obj.numbers[i]; +# } +# quicksort(); +# vec2 uv = _GLF_FragCoord.xy / resolution; +# vec3 color = vec3(1.0, 2.0, 3.0); +# color.x += float(obj.numbers[0]); +# if (uv.x > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[1]); +# } +# if (uv.x > (2.0 / 4.0)) +# { +# // Assigned value for color.y is set by float(obj.numbers[2]); below. +# // Therefore it is the same as reference shader and should not affect the output. +# // [ max((2*1 = 2), 2) ] [ max((2*1 = 2), 2) ] +# color.y += max(float(obj.numbers[max((2) * int((injectionSwitch.y)), 2)]), float(obj.numbers[max((2) * int((injectionSwitch.y)), 2)])); +# } +# if (uv.x > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[3]); +# } +# color.y += float(obj.numbers[4]); +# if (uv.y > (1.0 / 4.0)) +# { +# color.x += float(obj.numbers[5]); +# } +# if (uv.y > (2.0 / 4.0)) +# { +# color.y += float(obj.numbers[6]); +# } +# if (uv.y > (3.0 / 4.0)) +# { +# color.z += float(obj.numbers[7]); +# } +# color.z += float(obj.numbers[8]); +# if (abs(uv.x - uv.y) < 0.25) +# { +# color.x += float(obj.numbers[9]); +# } +# frag_color = vec4(normalize(color), 1.0); +# gl_Position = _GLF_pos; +# } +SHADER vertex variant_vertex_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 363 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main" %157 %351 %360 + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "swap(i1;i1;" + OpName %9 "i" + OpName %10 "j" + OpName %16 "performPartition(i1;i1;" + OpName %14 "l" + OpName %15 "h" + OpName %18 "quicksort(" + OpName %20 "temp" + OpName %24 "QuicksortObject" + OpMemberName %24 0 "numbers" + OpName %26 "obj" + OpName %40 "pivot" + OpName %44 "i" + OpName %48 "j" + OpName %69 "param" + OpName %71 "param" + OpName %78 "param" + OpName %79 "param" + OpName %86 "l" + OpName %87 "h" + OpName %89 "top" + OpName %92 "stack" + OpName %116 "p" + OpName %117 "param" + OpName %119 "param" + OpName %155 "_GLF_FragCoord" + OpName %157 "_GLF_pos" + OpName %166 "i" + OpName %193 "uv" + OpName %196 "buf1" + OpMemberName %196 0 "resolution" + OpName %198 "" + OpName %205 "color" + OpName %238 "buf0" + OpMemberName %238 0 "injectionSwitch" + OpName %240 "" + OpName %351 "frag_color" + OpName %358 "gl_PerVertex" + OpMemberName %358 0 "gl_Position" + OpMemberName %358 1 "gl_PointSize" + OpName %360 "" + OpDecorate %157 Location 0 + OpMemberDecorate %196 0 Offset 0 + OpDecorate %196 Block + OpDecorate %198 DescriptorSet 0 + OpDecorate %198 Binding 1 + OpMemberDecorate %238 0 Offset 0 + OpDecorate %238 Block + OpDecorate %240 DescriptorSet 0 + OpDecorate %240 Binding 0 + OpDecorate %351 Location 0 + OpMemberDecorate %358 0 BuiltIn Position + OpMemberDecorate %358 1 BuiltIn PointSize + OpDecorate %358 Block + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %2 %7 %7 + %13 = OpTypeFunction %6 %7 %7 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypeStruct %23 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 0 + %29 = OpTypePointer Private %6 + %46 = OpConstant %6 1 + %58 = OpTypeBool + %88 = OpConstant %6 9 + %90 = OpConstant %6 -1 + %91 = OpTypePointer Function %23 + %152 = OpTypeFloat 32 + %153 = OpTypeVector %152 4 + %154 = OpTypePointer Private %153 + %155 = OpVariable %154 Private + %156 = OpTypePointer Input %153 + %157 = OpVariable %156 Input + %159 = OpConstant %152 1 + %160 = OpConstant %152 0 + %161 = OpConstantComposite %153 %159 %159 %160 %160 + %163 = OpConstant %152 128 + %164 = OpConstantComposite %153 %163 %163 %159 %159 + %173 = OpConstant %6 10 + %191 = OpTypeVector %152 2 + %192 = OpTypePointer Function %191 + %196 = OpTypeStruct %191 + %197 = OpTypePointer Uniform %196 + %198 = OpVariable %197 Uniform + %199 = OpTypePointer Uniform %191 + %203 = OpTypeVector %152 3 + %204 = OpTypePointer Function %203 + %206 = OpConstant %152 2 + %207 = OpConstant %152 3 + %208 = OpConstantComposite %203 %159 %206 %207 + %212 = OpConstant %21 0 + %213 = OpTypePointer Function %152 + %220 = OpConstant %152 0.25 + %233 = OpConstant %152 0.5 + %237 = OpConstant %6 2 + %238 = OpTypeStruct %191 + %239 = OpTypePointer Uniform %238 + %240 = OpVariable %239 Uniform + %241 = OpConstant %21 1 + %242 = OpTypePointer Uniform %152 + %266 = OpConstant %152 0.75 + %270 = OpConstant %6 3 + %274 = OpConstant %21 2 + %279 = OpConstant %6 4 + %292 = OpConstant %6 5 + %305 = OpConstant %6 6 + %318 = OpConstant %6 7 + %326 = OpConstant %6 8 + %350 = OpTypePointer Output %153 + %351 = OpVariable %350 Output + %358 = OpTypeStruct %153 %152 + %359 = OpTypePointer Output %358 + %360 = OpVariable %359 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %166 = OpVariable %7 Function + %193 = OpVariable %192 Function + %205 = OpVariable %204 Function + %158 = OpLoad %153 %157 + %162 = OpFAdd %153 %158 %161 + %165 = OpFMul %153 %162 %164 + OpStore %155 %165 + OpStore %166 %27 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %172 = OpLoad %6 %166 + %174 = OpSLessThan %58 %172 %173 + OpBranchConditional %174 %168 %169 + %168 = OpLabel + %175 = OpLoad %6 %166 + %176 = OpLoad %6 %166 + %177 = OpISub %6 %173 %176 + %178 = OpAccessChain %29 %26 %27 %175 + OpStore %178 %177 + %179 = OpLoad %6 %166 + %180 = OpLoad %6 %166 + %181 = OpAccessChain %29 %26 %27 %180 + %182 = OpLoad %6 %181 + %183 = OpLoad %6 %166 + %184 = OpAccessChain %29 %26 %27 %183 + %185 = OpLoad %6 %184 + %186 = OpIMul %6 %182 %185 + %187 = OpAccessChain %29 %26 %27 %179 + OpStore %187 %186 + OpBranch %170 + %170 = OpLabel + %188 = OpLoad %6 %166 + %189 = OpIAdd %6 %188 %46 + OpStore %166 %189 + OpBranch %167 + %169 = OpLabel + %190 = OpFunctionCall %2 %18 + %194 = OpLoad %153 %155 + %195 = OpVectorShuffle %191 %194 %194 0 1 + %200 = OpAccessChain %199 %198 %27 + %201 = OpLoad %191 %200 + %202 = OpFDiv %191 %195 %201 + OpStore %193 %202 + OpStore %205 %208 + %209 = OpAccessChain %29 %26 %27 %27 + %210 = OpLoad %6 %209 + %211 = OpConvertSToF %152 %210 + %214 = OpAccessChain %213 %205 %212 + %215 = OpLoad %152 %214 + %216 = OpFAdd %152 %215 %211 + %217 = OpAccessChain %213 %205 %212 + OpStore %217 %216 + %218 = OpAccessChain %213 %193 %212 + %219 = OpLoad %152 %218 + %221 = OpFOrdGreaterThan %58 %219 %220 + OpSelectionMerge %223 None + OpBranchConditional %221 %222 %223 + %222 = OpLabel + %224 = OpAccessChain %29 %26 %27 %46 + %225 = OpLoad %6 %224 + %226 = OpConvertSToF %152 %225 + %227 = OpAccessChain %213 %205 %212 + %228 = OpLoad %152 %227 + %229 = OpFAdd %152 %228 %226 + %230 = OpAccessChain %213 %205 %212 + OpStore %230 %229 + OpBranch %223 + %223 = OpLabel + %231 = OpAccessChain %213 %193 %212 + %232 = OpLoad %152 %231 + %234 = OpFOrdGreaterThan %58 %232 %233 + OpSelectionMerge %236 None + OpBranchConditional %234 %235 %236 + %235 = OpLabel + %243 = OpAccessChain %242 %240 %27 %241 + %244 = OpLoad %152 %243 + %245 = OpConvertFToS %6 %244 + %246 = OpIMul %6 %237 %245 + %247 = OpExtInst %6 %1 SMax %246 %237 + %248 = OpAccessChain %29 %26 %27 %247 + %249 = OpLoad %6 %248 + %250 = OpConvertSToF %152 %249 + %251 = OpAccessChain %242 %240 %27 %241 + %252 = OpLoad %152 %251 + %253 = OpConvertFToS %6 %252 + %254 = OpIMul %6 %237 %253 + %255 = OpExtInst %6 %1 SMax %254 %237 + %256 = OpAccessChain %29 %26 %27 %255 + %257 = OpLoad %6 %256 + %258 = OpConvertSToF %152 %257 + %259 = OpExtInst %152 %1 FMax %250 %258 + %260 = OpAccessChain %213 %205 %241 + %261 = OpLoad %152 %260 + %262 = OpFAdd %152 %261 %259 + %263 = OpAccessChain %213 %205 %241 + OpStore %263 %262 + OpBranch %236 + %236 = OpLabel + %264 = OpAccessChain %213 %193 %212 + %265 = OpLoad %152 %264 + %267 = OpFOrdGreaterThan %58 %265 %266 + OpSelectionMerge %269 None + OpBranchConditional %267 %268 %269 + %268 = OpLabel + %271 = OpAccessChain %29 %26 %27 %270 + %272 = OpLoad %6 %271 + %273 = OpConvertSToF %152 %272 + %275 = OpAccessChain %213 %205 %274 + %276 = OpLoad %152 %275 + %277 = OpFAdd %152 %276 %273 + %278 = OpAccessChain %213 %205 %274 + OpStore %278 %277 + OpBranch %269 + %269 = OpLabel + %280 = OpAccessChain %29 %26 %27 %279 + %281 = OpLoad %6 %280 + %282 = OpConvertSToF %152 %281 + %283 = OpAccessChain %213 %205 %241 + %284 = OpLoad %152 %283 + %285 = OpFAdd %152 %284 %282 + %286 = OpAccessChain %213 %205 %241 + OpStore %286 %285 + %287 = OpAccessChain %213 %193 %241 + %288 = OpLoad %152 %287 + %289 = OpFOrdGreaterThan %58 %288 %220 + OpSelectionMerge %291 None + OpBranchConditional %289 %290 %291 + %290 = OpLabel + %293 = OpAccessChain %29 %26 %27 %292 + %294 = OpLoad %6 %293 + %295 = OpConvertSToF %152 %294 + %296 = OpAccessChain %213 %205 %212 + %297 = OpLoad %152 %296 + %298 = OpFAdd %152 %297 %295 + %299 = OpAccessChain %213 %205 %212 + OpStore %299 %298 + OpBranch %291 + %291 = OpLabel + %300 = OpAccessChain %213 %193 %241 + %301 = OpLoad %152 %300 + %302 = OpFOrdGreaterThan %58 %301 %233 + OpSelectionMerge %304 None + OpBranchConditional %302 %303 %304 + %303 = OpLabel + %306 = OpAccessChain %29 %26 %27 %305 + %307 = OpLoad %6 %306 + %308 = OpConvertSToF %152 %307 + %309 = OpAccessChain %213 %205 %241 + %310 = OpLoad %152 %309 + %311 = OpFAdd %152 %310 %308 + %312 = OpAccessChain %213 %205 %241 + OpStore %312 %311 + OpBranch %304 + %304 = OpLabel + %313 = OpAccessChain %213 %193 %241 + %314 = OpLoad %152 %313 + %315 = OpFOrdGreaterThan %58 %314 %266 + OpSelectionMerge %317 None + OpBranchConditional %315 %316 %317 + %316 = OpLabel + %319 = OpAccessChain %29 %26 %27 %318 + %320 = OpLoad %6 %319 + %321 = OpConvertSToF %152 %320 + %322 = OpAccessChain %213 %205 %274 + %323 = OpLoad %152 %322 + %324 = OpFAdd %152 %323 %321 + %325 = OpAccessChain %213 %205 %274 + OpStore %325 %324 + OpBranch %317 + %317 = OpLabel + %327 = OpAccessChain %29 %26 %27 %326 + %328 = OpLoad %6 %327 + %329 = OpConvertSToF %152 %328 + %330 = OpAccessChain %213 %205 %274 + %331 = OpLoad %152 %330 + %332 = OpFAdd %152 %331 %329 + %333 = OpAccessChain %213 %205 %274 + OpStore %333 %332 + %334 = OpAccessChain %213 %193 %212 + %335 = OpLoad %152 %334 + %336 = OpAccessChain %213 %193 %241 + %337 = OpLoad %152 %336 + %338 = OpFSub %152 %335 %337 + %339 = OpExtInst %152 %1 FAbs %338 + %340 = OpFOrdLessThan %58 %339 %220 + OpSelectionMerge %342 None + OpBranchConditional %340 %341 %342 + %341 = OpLabel + %343 = OpAccessChain %29 %26 %27 %88 + %344 = OpLoad %6 %343 + %345 = OpConvertSToF %152 %344 + %346 = OpAccessChain %213 %205 %212 + %347 = OpLoad %152 %346 + %348 = OpFAdd %152 %347 %345 + %349 = OpAccessChain %213 %205 %212 + OpStore %349 %348 + OpBranch %342 + %342 = OpLabel + %352 = OpLoad %203 %205 + %353 = OpExtInst %203 %1 Normalize %352 + %354 = OpCompositeExtract %152 %353 0 + %355 = OpCompositeExtract %152 %353 1 + %356 = OpCompositeExtract %152 %353 2 + %357 = OpCompositeConstruct %153 %354 %355 %356 %159 + OpStore %351 %357 + %361 = OpLoad %153 %157 + %362 = OpAccessChain %350 %360 %27 + OpStore %362 %361 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %8 + %9 = OpFunctionParameter %7 + %10 = OpFunctionParameter %7 + %12 = OpLabel + %20 = OpVariable %7 Function + %28 = OpLoad %6 %9 + %30 = OpAccessChain %29 %26 %27 %28 + %31 = OpLoad %6 %30 + OpStore %20 %31 + %32 = OpLoad %6 %9 + %33 = OpLoad %6 %10 + %34 = OpAccessChain %29 %26 %27 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %29 %26 %27 %32 + OpStore %36 %35 + %37 = OpLoad %6 %10 + %38 = OpLoad %6 %20 + %39 = OpAccessChain %29 %26 %27 %37 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %16 = OpFunction %6 None %13 + %14 = OpFunctionParameter %7 + %15 = OpFunctionParameter %7 + %17 = OpLabel + %40 = OpVariable %7 Function + %44 = OpVariable %7 Function + %48 = OpVariable %7 Function + %69 = OpVariable %7 Function + %71 = OpVariable %7 Function + %78 = OpVariable %7 Function + %79 = OpVariable %7 Function + %41 = OpLoad %6 %15 + %42 = OpAccessChain %29 %26 %27 %41 + %43 = OpLoad %6 %42 + OpStore %40 %43 + %45 = OpLoad %6 %14 + %47 = OpISub %6 %45 %46 + OpStore %44 %47 + %49 = OpLoad %6 %14 + OpStore %48 %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %6 %48 + %56 = OpLoad %6 %15 + %57 = OpISub %6 %56 %46 + %59 = OpSLessThanEqual %58 %55 %57 + OpBranchConditional %59 %51 %52 + %51 = OpLabel + %60 = OpLoad %6 %48 + %61 = OpAccessChain %29 %26 %27 %60 + %62 = OpLoad %6 %61 + %63 = OpLoad %6 %40 + %64 = OpSLessThanEqual %58 %62 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %65 %66 + %65 = OpLabel + %67 = OpLoad %6 %44 + %68 = OpIAdd %6 %67 %46 + OpStore %44 %68 + %70 = OpLoad %6 %44 + OpStore %69 %70 + %72 = OpLoad %6 %48 + OpStore %71 %72 + %73 = OpFunctionCall %2 %11 %69 %71 + OpBranch %66 + %66 = OpLabel + OpBranch %53 + %53 = OpLabel + %74 = OpLoad %6 %48 + %75 = OpIAdd %6 %74 %46 + OpStore %48 %75 + OpBranch %50 + %52 = OpLabel + %76 = OpLoad %6 %44 + %77 = OpIAdd %6 %76 %46 + OpStore %78 %77 + %80 = OpLoad %6 %15 + OpStore %79 %80 + %81 = OpFunctionCall %2 %11 %78 %79 + %82 = OpLoad %6 %44 + %83 = OpIAdd %6 %82 %46 + OpReturnValue %83 + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %86 = OpVariable %7 Function + %87 = OpVariable %7 Function + %89 = OpVariable %7 Function + %92 = OpVariable %91 Function + %116 = OpVariable %7 Function + %117 = OpVariable %7 Function + %119 = OpVariable %7 Function + OpStore %86 %27 + OpStore %87 %88 + OpStore %89 %90 + %93 = OpLoad %6 %89 + %94 = OpIAdd %6 %93 %46 + OpStore %89 %94 + %95 = OpLoad %6 %86 + %96 = OpAccessChain %7 %92 %94 + OpStore %96 %95 + %97 = OpLoad %6 %89 + %98 = OpIAdd %6 %97 %46 + OpStore %89 %98 + %99 = OpLoad %6 %87 + %100 = OpAccessChain %7 %92 %98 + OpStore %100 %99 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %6 %89 + %107 = OpSGreaterThanEqual %58 %106 %27 + OpBranchConditional %107 %102 %103 + %102 = OpLabel + %108 = OpLoad %6 %89 + %109 = OpISub %6 %108 %46 + OpStore %89 %109 + %110 = OpAccessChain %7 %92 %108 + %111 = OpLoad %6 %110 + OpStore %87 %111 + %112 = OpLoad %6 %89 + %113 = OpISub %6 %112 %46 + OpStore %89 %113 + %114 = OpAccessChain %7 %92 %112 + %115 = OpLoad %6 %114 + OpStore %86 %115 + %118 = OpLoad %6 %86 + OpStore %117 %118 + %120 = OpLoad %6 %87 + OpStore %119 %120 + %121 = OpFunctionCall %6 %16 %117 %119 + OpStore %116 %121 + %122 = OpLoad %6 %116 + %123 = OpISub %6 %122 %46 + %124 = OpLoad %6 %86 + %125 = OpSGreaterThan %58 %123 %124 + OpSelectionMerge %127 None + OpBranchConditional %125 %126 %127 + %126 = OpLabel + %128 = OpLoad %6 %89 + %129 = OpIAdd %6 %128 %46 + OpStore %89 %129 + %130 = OpLoad %6 %86 + %131 = OpAccessChain %7 %92 %129 + OpStore %131 %130 + %132 = OpLoad %6 %89 + %133 = OpIAdd %6 %132 %46 + OpStore %89 %133 + %134 = OpLoad %6 %116 + %135 = OpISub %6 %134 %46 + %136 = OpAccessChain %7 %92 %133 + OpStore %136 %135 + OpBranch %127 + %127 = OpLabel + %137 = OpLoad %6 %116 + %138 = OpIAdd %6 %137 %46 + %139 = OpLoad %6 %87 + %140 = OpSLessThan %58 %138 %139 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpLoad %6 %89 + %144 = OpIAdd %6 %143 %46 + OpStore %89 %144 + %145 = OpLoad %6 %116 + %146 = OpIAdd %6 %145 %46 + %147 = OpAccessChain %7 %92 %144 + OpStore %147 %146 + %148 = OpLoad %6 %89 + %149 = OpIAdd %6 %148 %46 + OpStore %89 %149 + %150 = OpLoad %6 %87 + %151 = OpAccessChain %7 %92 %149 + OpStore %151 %150 + OpBranch %142 + %142 = OpLabel + OpBranch %104 + %104 = OpLabel + OpBranch %101 + %103 = OpLabel + OpReturn + OpFunctionEnd +END + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(location = 0) in vec4 frag_color; +# +# void main() +# { +# _GLF_color = frag_color; +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 13 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %11 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %11 "frag_color" + OpDecorate %9 Location 0 + OpDecorate %11 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypePointer Input %7 + %11 = OpVariable %10 Input + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %7 %11 + OpStore %9 %12 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_GRID POS 0 0 SIZE 256 256 CELLS 8 8 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix.amber b/vulkan/amber/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix.amber new file mode 100644 index 0000000..0ad7299 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix.amber @@ -0,0 +1,742 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with min-mix in always false conditional + +# The test passes because both shaders render the same image. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 resolution; +# }; +# const vec4 pal[16] = vec4[16](vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); +# +# const vec4 picdata[8] = vec4[8](vec4(4, 4, 20, 4), vec4(4, 4, 4, 20), vec4(4, 20, 20, 4), vec4(20, 4, 4, 8), vec4(8, 6, 4, 2), vec4(2, 12, 2, 4), vec4(16, 2, 4, 4), vec4(12, 22, 4, 4)); +# +# int index; +# +# int state[16]; +# +# bool collision(vec2 pos, vec4 quad) +# { +# if(pos.x < quad.x) +# { +# return false; +# } +# if(pos.y < quad.y) +# { +# return false; +# } +# if(pos.x > quad.x + quad.z) +# { +# return false; +# } +# if(pos.y > quad.y + quad.w) +# { +# return false; +# } +# return true; +# } +# vec4 match(vec2 pos) +# { +# int i; +# vec4 res = vec4(0.5, 0.5, 1.0, 1.0); +# for( i = 0; +# i < 8; i ++) +# { +# if(collision(pos, picdata[i])) +# { +# res = pal[(int(picdata[i].x) * int(picdata[i].y) + i * 9 + 11) % 16]; +# } +# } +# return res; +# } +# void main() +# { +# vec2 lin = gl_FragCoord.xy / resolution; +# lin = floor(lin * 32.0); +# _GLF_color = match(lin.xy); +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 189 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %165 %180 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %15 "collision(vf2;vf4;" + OpName %13 "pos" + OpName %14 "quad" + OpName %19 "match(vf2;" + OpName %18 "pos" + OpName %69 "res" + OpName %75 "i" + OpName %105 "param" + OpName %107 "param" + OpName %109 "indexable" + OpName %135 "indexable" + OpName %140 "indexable" + OpName %154 "indexable" + OpName %163 "lin" + OpName %165 "gl_FragCoord" + OpName %168 "buf0" + OpMemberName %168 0 "resolution" + OpName %170 "" + OpName %180 "_GLF_color" + OpName %181 "param" + OpName %185 "index" + OpName %188 "state" + OpDecorate %165 BuiltIn FragCoord + OpMemberDecorate %168 0 Offset 0 + OpDecorate %168 Block + OpDecorate %170 DescriptorSet 0 + OpDecorate %170 Binding 0 + OpDecorate %180 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeVector %6 4 + %10 = OpTypePointer Function %9 + %11 = OpTypeBool + %12 = OpTypeFunction %11 %8 %10 + %17 = OpTypeFunction %9 %8 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Function %6 + %31 = OpConstantFalse %11 + %33 = OpConstant %21 1 + %46 = OpConstant %21 2 + %58 = OpConstant %21 3 + %66 = OpConstantTrue %11 + %70 = OpConstant %6 0.5 + %71 = OpConstant %6 1 + %72 = OpConstantComposite %9 %70 %70 %71 %71 + %73 = OpTypeInt 32 1 + %74 = OpTypePointer Function %73 + %76 = OpConstant %73 0 + %83 = OpConstant %73 8 + %85 = OpConstant %21 8 + %86 = OpTypeArray %9 %85 + %87 = OpConstant %6 4 + %88 = OpConstant %6 20 + %89 = OpConstantComposite %9 %87 %87 %88 %87 + %90 = OpConstantComposite %9 %87 %87 %87 %88 + %91 = OpConstantComposite %9 %87 %88 %88 %87 + %92 = OpConstant %6 8 + %93 = OpConstantComposite %9 %88 %87 %87 %92 + %94 = OpConstant %6 6 + %95 = OpConstant %6 2 + %96 = OpConstantComposite %9 %92 %94 %87 %95 + %97 = OpConstant %6 12 + %98 = OpConstantComposite %9 %95 %97 %95 %87 + %99 = OpConstant %6 16 + %100 = OpConstantComposite %9 %99 %95 %87 %87 + %101 = OpConstant %6 22 + %102 = OpConstantComposite %9 %97 %101 %87 %87 + %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102 + %108 = OpTypePointer Function %86 + %115 = OpConstant %21 16 + %116 = OpTypeArray %9 %115 + %117 = OpConstant %6 0 + %118 = OpConstantComposite %9 %117 %117 %117 %71 + %119 = OpConstantComposite %9 %70 %117 %117 %71 + %120 = OpConstantComposite %9 %117 %70 %117 %71 + %121 = OpConstantComposite %9 %70 %70 %117 %71 + %122 = OpConstantComposite %9 %117 %117 %70 %71 + %123 = OpConstantComposite %9 %70 %117 %70 %71 + %124 = OpConstantComposite %9 %117 %70 %70 %71 + %125 = OpConstantComposite %9 %70 %70 %70 %71 + %126 = OpConstantComposite %9 %71 %117 %117 %71 + %127 = OpConstantComposite %9 %117 %71 %117 %71 + %128 = OpConstantComposite %9 %71 %71 %117 %71 + %129 = OpConstantComposite %9 %117 %117 %71 %71 + %130 = OpConstantComposite %9 %71 %117 %71 %71 + %131 = OpConstantComposite %9 %117 %71 %71 %71 + %132 = OpConstantComposite %9 %71 %71 %71 %71 + %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132 + %146 = OpConstant %73 9 + %149 = OpConstant %73 11 + %151 = OpConstant %73 16 + %153 = OpTypePointer Function %116 + %158 = OpConstant %73 1 + %164 = OpTypePointer Input %9 + %165 = OpVariable %164 Input + %168 = OpTypeStruct %7 + %169 = OpTypePointer Uniform %168 + %170 = OpVariable %169 Uniform + %171 = OpTypePointer Uniform %7 + %176 = OpConstant %6 32 + %179 = OpTypePointer Output %9 + %180 = OpVariable %179 Output + %184 = OpTypePointer Private %73 + %185 = OpVariable %184 Private + %186 = OpTypeArray %73 %115 + %187 = OpTypePointer Private %186 + %188 = OpVariable %187 Private + %4 = OpFunction %2 None %3 + %5 = OpLabel + %163 = OpVariable %8 Function + %181 = OpVariable %8 Function + %166 = OpLoad %9 %165 + %167 = OpVectorShuffle %7 %166 %166 0 1 + %172 = OpAccessChain %171 %170 %76 + %173 = OpLoad %7 %172 + %174 = OpFDiv %7 %167 %173 + OpStore %163 %174 + %175 = OpLoad %7 %163 + %177 = OpVectorTimesScalar %7 %175 %176 + %178 = OpExtInst %7 %1 Floor %177 + OpStore %163 %178 + %182 = OpLoad %7 %163 + OpStore %181 %182 + %183 = OpFunctionCall %9 %19 %181 + OpStore %180 %183 + OpReturn + OpFunctionEnd + %15 = OpFunction %11 None %12 + %13 = OpFunctionParameter %8 + %14 = OpFunctionParameter %10 + %16 = OpLabel + %24 = OpAccessChain %23 %13 %22 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %23 %14 %22 + %27 = OpLoad %6 %26 + %28 = OpFOrdLessThan %11 %25 %27 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %30 + %29 = OpLabel + OpReturnValue %31 + %30 = OpLabel + %34 = OpAccessChain %23 %13 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %23 %14 %33 + %37 = OpLoad %6 %36 + %38 = OpFOrdLessThan %11 %35 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + OpReturnValue %31 + %40 = OpLabel + %42 = OpAccessChain %23 %13 %22 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %23 %14 %22 + %45 = OpLoad %6 %44 + %47 = OpAccessChain %23 %14 %46 + %48 = OpLoad %6 %47 + %49 = OpFAdd %6 %45 %48 + %50 = OpFOrdGreaterThan %11 %43 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %52 + %51 = OpLabel + OpReturnValue %31 + %52 = OpLabel + %54 = OpAccessChain %23 %13 %33 + %55 = OpLoad %6 %54 + %56 = OpAccessChain %23 %14 %33 + %57 = OpLoad %6 %56 + %59 = OpAccessChain %23 %14 %58 + %60 = OpLoad %6 %59 + %61 = OpFAdd %6 %57 %60 + %62 = OpFOrdGreaterThan %11 %55 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %64 + %63 = OpLabel + OpReturnValue %31 + %64 = OpLabel + OpReturnValue %66 + OpFunctionEnd + %19 = OpFunction %9 None %17 + %18 = OpFunctionParameter %8 + %20 = OpLabel + %69 = OpVariable %10 Function + %75 = OpVariable %74 Function + %105 = OpVariable %8 Function + %107 = OpVariable %10 Function + %109 = OpVariable %108 Function + %135 = OpVariable %108 Function + %140 = OpVariable %108 Function + %154 = OpVariable %153 Function + OpStore %69 %72 + OpStore %75 %76 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %73 %75 + %84 = OpSLessThan %11 %82 %83 + OpBranchConditional %84 %78 %79 + %78 = OpLabel + %104 = OpLoad %73 %75 + %106 = OpLoad %7 %18 + OpStore %105 %106 + OpStore %109 %103 + %110 = OpAccessChain %10 %109 %104 + %111 = OpLoad %9 %110 + OpStore %107 %111 + %112 = OpFunctionCall %11 %15 %105 %107 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %134 = OpLoad %73 %75 + OpStore %135 %103 + %136 = OpAccessChain %23 %135 %134 %22 + %137 = OpLoad %6 %136 + %138 = OpConvertFToS %73 %137 + %139 = OpLoad %73 %75 + OpStore %140 %103 + %141 = OpAccessChain %23 %140 %139 %33 + %142 = OpLoad %6 %141 + %143 = OpConvertFToS %73 %142 + %144 = OpIMul %73 %138 %143 + %145 = OpLoad %73 %75 + %147 = OpIMul %73 %145 %146 + %148 = OpIAdd %73 %144 %147 + %150 = OpIAdd %73 %148 %149 + %152 = OpSMod %73 %150 %151 + OpStore %154 %133 + %155 = OpAccessChain %10 %154 %152 + %156 = OpLoad %9 %155 + OpStore %69 %156 + OpBranch %114 + %114 = OpLabel + OpBranch %80 + %80 = OpLabel + %157 = OpLoad %73 %75 + %159 = OpIAdd %73 %157 %158 + OpStore %75 %159 + OpBranch %77 + %79 = OpLabel + %160 = OpLoad %9 %69 + OpReturnValue %160 + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 resolution; +# }; +# const vec4 pal[16] = vec4[16](vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); +# +# const vec4 picdata[8] = vec4[8](vec4(4, 4, 20, 4), vec4(4, 4, 4, 20), vec4(4, 20, 20, 4), vec4(20, 4, 4, 8), vec4(8, 6, 4, 2), vec4(2, 12, 2, 4), vec4(16, 2, 4, 4), vec4(12, 22, 4, 4)); +# +# bool collision(vec2 pos, vec4 quad) +# { +# if(pos.x < quad.x) +# { +# return false; +# } +# if(pos.y < quad.y) +# { +# return false; +# } +# if(pos.x > quad.x + quad.z) +# { +# return false; +# } +# if(pos.y > quad.y + quad.w) +# { +# return false; +# } +# return true; +# } +# vec4 match(vec2 pos) +# { +# int i; +# // res == vec4 ( x, 0.5, 1.0, 1.0) where x is the result of the calculation, x == 0.5. +# // The end result should be the same as in reference. +# vec4 res = vec4(clamp(0.5, 0.5, (gl_FragCoord.x < 0.0) ? -1.0 : (min(gl_FragCoord.x >= 0.0 ? (mix(1.0, 0.5, (gl_FragCoord.x >= 0.0))) : 1.0, 0.5))), 0.5, 1.0, 1.0); +# for( i = 0; +# i < 8; i ++) +# { +# if(collision(pos, picdata[i])) +# { +# res = pal[(int(picdata[i].x) * int(picdata[i].y) + i * 9 + 11) % 16]; +# } +# } +# return res; +# } +# void main() +# { +# vec2 lin = gl_FragCoord.xy / resolution; +# lin = floor(lin * 32.0); +# _GLF_color = match(lin.xy); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 208 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %72 %204 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %15 "collision(vf2;vf4;" + OpName %13 "pos" + OpName %14 "quad" + OpName %19 "match(vf2;" + OpName %18 "pos" + OpName %69 "res" + OpName %72 "gl_FragCoord" + OpName %102 "i" + OpName %132 "param" + OpName %134 "param" + OpName %136 "indexable" + OpName %161 "indexable" + OpName %166 "indexable" + OpName %180 "indexable" + OpName %189 "lin" + OpName %192 "buf0" + OpMemberName %192 0 "resolution" + OpName %194 "" + OpName %204 "_GLF_color" + OpName %205 "param" + OpDecorate %72 BuiltIn FragCoord + OpMemberDecorate %192 0 Offset 0 + OpDecorate %192 Block + OpDecorate %194 DescriptorSet 0 + OpDecorate %194 Binding 0 + OpDecorate %204 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeVector %6 4 + %10 = OpTypePointer Function %9 + %11 = OpTypeBool + %12 = OpTypeFunction %11 %8 %10 + %17 = OpTypeFunction %9 %8 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Function %6 + %31 = OpConstantFalse %11 + %33 = OpConstant %21 1 + %46 = OpConstant %21 2 + %58 = OpConstant %21 3 + %66 = OpConstantTrue %11 + %70 = OpConstant %6 0.5 + %71 = OpTypePointer Input %9 + %72 = OpVariable %71 Input + %73 = OpTypePointer Input %6 + %76 = OpConstant %6 0 + %81 = OpConstant %6 -1 + %89 = OpConstant %6 1 + %100 = OpTypeInt 32 1 + %101 = OpTypePointer Function %100 + %103 = OpConstant %100 0 + %110 = OpConstant %100 8 + %112 = OpConstant %21 8 + %113 = OpTypeArray %9 %112 + %114 = OpConstant %6 4 + %115 = OpConstant %6 20 + %116 = OpConstantComposite %9 %114 %114 %115 %114 + %117 = OpConstantComposite %9 %114 %114 %114 %115 + %118 = OpConstantComposite %9 %114 %115 %115 %114 + %119 = OpConstant %6 8 + %120 = OpConstantComposite %9 %115 %114 %114 %119 + %121 = OpConstant %6 6 + %122 = OpConstant %6 2 + %123 = OpConstantComposite %9 %119 %121 %114 %122 + %124 = OpConstant %6 12 + %125 = OpConstantComposite %9 %122 %124 %122 %114 + %126 = OpConstant %6 16 + %127 = OpConstantComposite %9 %126 %122 %114 %114 + %128 = OpConstant %6 22 + %129 = OpConstantComposite %9 %124 %128 %114 %114 + %130 = OpConstantComposite %113 %116 %117 %118 %120 %123 %125 %127 %129 + %135 = OpTypePointer Function %113 + %142 = OpConstant %21 16 + %143 = OpTypeArray %9 %142 + %144 = OpConstantComposite %9 %76 %76 %76 %89 + %145 = OpConstantComposite %9 %70 %76 %76 %89 + %146 = OpConstantComposite %9 %76 %70 %76 %89 + %147 = OpConstantComposite %9 %70 %70 %76 %89 + %148 = OpConstantComposite %9 %76 %76 %70 %89 + %149 = OpConstantComposite %9 %70 %76 %70 %89 + %150 = OpConstantComposite %9 %76 %70 %70 %89 + %151 = OpConstantComposite %9 %70 %70 %70 %89 + %152 = OpConstantComposite %9 %89 %76 %76 %89 + %153 = OpConstantComposite %9 %76 %89 %76 %89 + %154 = OpConstantComposite %9 %89 %89 %76 %89 + %155 = OpConstantComposite %9 %76 %76 %89 %89 + %156 = OpConstantComposite %9 %89 %76 %89 %89 + %157 = OpConstantComposite %9 %76 %89 %89 %89 + %158 = OpConstantComposite %9 %89 %89 %89 %89 + %159 = OpConstantComposite %143 %144 %145 %146 %147 %148 %149 %150 %151 %144 %152 %153 %154 %155 %156 %157 %158 + %172 = OpConstant %100 9 + %175 = OpConstant %100 11 + %177 = OpConstant %100 16 + %179 = OpTypePointer Function %143 + %184 = OpConstant %100 1 + %192 = OpTypeStruct %7 + %193 = OpTypePointer Uniform %192 + %194 = OpVariable %193 Uniform + %195 = OpTypePointer Uniform %7 + %200 = OpConstant %6 32 + %203 = OpTypePointer Output %9 + %204 = OpVariable %203 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %189 = OpVariable %8 Function + %205 = OpVariable %8 Function + %190 = OpLoad %9 %72 + %191 = OpVectorShuffle %7 %190 %190 0 1 + %196 = OpAccessChain %195 %194 %103 + %197 = OpLoad %7 %196 + %198 = OpFDiv %7 %191 %197 + OpStore %189 %198 + %199 = OpLoad %7 %189 + %201 = OpVectorTimesScalar %7 %199 %200 + %202 = OpExtInst %7 %1 Floor %201 + OpStore %189 %202 + %206 = OpLoad %7 %189 + OpStore %205 %206 + %207 = OpFunctionCall %9 %19 %205 + OpStore %204 %207 + OpReturn + OpFunctionEnd + %15 = OpFunction %11 None %12 + %13 = OpFunctionParameter %8 + %14 = OpFunctionParameter %10 + %16 = OpLabel + %24 = OpAccessChain %23 %13 %22 + %25 = OpLoad %6 %24 + %26 = OpAccessChain %23 %14 %22 + %27 = OpLoad %6 %26 + %28 = OpFOrdLessThan %11 %25 %27 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %30 + %29 = OpLabel + OpReturnValue %31 + %30 = OpLabel + %34 = OpAccessChain %23 %13 %33 + %35 = OpLoad %6 %34 + %36 = OpAccessChain %23 %14 %33 + %37 = OpLoad %6 %36 + %38 = OpFOrdLessThan %11 %35 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + OpReturnValue %31 + %40 = OpLabel + %42 = OpAccessChain %23 %13 %22 + %43 = OpLoad %6 %42 + %44 = OpAccessChain %23 %14 %22 + %45 = OpLoad %6 %44 + %47 = OpAccessChain %23 %14 %46 + %48 = OpLoad %6 %47 + %49 = OpFAdd %6 %45 %48 + %50 = OpFOrdGreaterThan %11 %43 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %51 %52 + %51 = OpLabel + OpReturnValue %31 + %52 = OpLabel + %54 = OpAccessChain %23 %13 %33 + %55 = OpLoad %6 %54 + %56 = OpAccessChain %23 %14 %33 + %57 = OpLoad %6 %56 + %59 = OpAccessChain %23 %14 %58 + %60 = OpLoad %6 %59 + %61 = OpFAdd %6 %57 %60 + %62 = OpFOrdGreaterThan %11 %55 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %64 + %63 = OpLabel + OpReturnValue %31 + %64 = OpLabel + OpReturnValue %66 + OpFunctionEnd + %19 = OpFunction %9 None %17 + %18 = OpFunctionParameter %8 + %20 = OpLabel + %69 = OpVariable %10 Function + %78 = OpVariable %23 Function + %86 = OpVariable %23 Function + %102 = OpVariable %101 Function + %132 = OpVariable %8 Function + %134 = OpVariable %10 Function + %136 = OpVariable %135 Function + %161 = OpVariable %135 Function + %166 = OpVariable %135 Function + %180 = OpVariable %179 Function + %74 = OpAccessChain %73 %72 %22 + %75 = OpLoad %6 %74 + %77 = OpFOrdLessThan %11 %75 %76 + OpSelectionMerge %80 None + OpBranchConditional %77 %79 %82 + %79 = OpLabel + OpStore %78 %81 + OpBranch %80 + %82 = OpLabel + %83 = OpAccessChain %73 %72 %22 + %84 = OpLoad %6 %83 + %85 = OpFOrdGreaterThanEqual %11 %84 %76 + OpSelectionMerge %88 None + OpBranchConditional %85 %87 %94 + %87 = OpLabel + %90 = OpAccessChain %73 %72 %22 + %91 = OpLoad %6 %90 + %92 = OpFOrdGreaterThanEqual %11 %91 %76 + %93 = OpSelect %6 %92 %70 %89 + OpStore %86 %93 + OpBranch %88 + %94 = OpLabel + OpStore %86 %89 + OpBranch %88 + %88 = OpLabel + %95 = OpLoad %6 %86 + %96 = OpExtInst %6 %1 FMin %95 %70 + OpStore %78 %96 + OpBranch %80 + %80 = OpLabel + %97 = OpLoad %6 %78 + %98 = OpExtInst %6 %1 FClamp %70 %70 %97 + %99 = OpCompositeConstruct %9 %98 %70 %89 %89 + OpStore %69 %99 + OpStore %102 %103 + OpBranch %104 + %104 = OpLabel + OpLoopMerge %106 %107 None + OpBranch %108 + %108 = OpLabel + %109 = OpLoad %100 %102 + %111 = OpSLessThan %11 %109 %110 + OpBranchConditional %111 %105 %106 + %105 = OpLabel + %131 = OpLoad %100 %102 + %133 = OpLoad %7 %18 + OpStore %132 %133 + OpStore %136 %130 + %137 = OpAccessChain %10 %136 %131 + %138 = OpLoad %9 %137 + OpStore %134 %138 + %139 = OpFunctionCall %11 %15 %132 %134 + OpSelectionMerge %141 None + OpBranchConditional %139 %140 %141 + %140 = OpLabel + %160 = OpLoad %100 %102 + OpStore %161 %130 + %162 = OpAccessChain %23 %161 %160 %22 + %163 = OpLoad %6 %162 + %164 = OpConvertFToS %100 %163 + %165 = OpLoad %100 %102 + OpStore %166 %130 + %167 = OpAccessChain %23 %166 %165 %33 + %168 = OpLoad %6 %167 + %169 = OpConvertFToS %100 %168 + %170 = OpIMul %100 %164 %169 + %171 = OpLoad %100 %102 + %173 = OpIMul %100 %171 %172 + %174 = OpIAdd %100 %170 %173 + %176 = OpIAdd %100 %174 %175 + %178 = OpSMod %100 %176 %177 + OpStore %180 %159 + %181 = OpAccessChain %10 %180 %178 + %182 = OpLoad %9 %181 + OpStore %69 %182 + OpBranch %141 + %141 = OpLabel + OpBranch %107 + %107 = OpLabel + %183 = OpLoad %100 %102 + %185 = OpIAdd %100 %183 %184 + OpStore %102 %185 + OpBranch %104 + %106 = OpLabel + %186 = OpLoad %9 %69 + OpReturnValue %186 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-triangle-array-nested-loop.amber b/vulkan/amber/graphicsfuzz/stable-triangle-array-nested-loop.amber new file mode 100644 index 0000000..778b2e4 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-triangle-array-nested-loop.amber @@ -0,0 +1,896 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with array and nested loops + +# The test passes because both shaders render the same image. + +# Optimized using spirv-opt with the following arguments: +# '--private-to-local' +# '--copy-propagate-arrays' +# '--if-conversion' +# '--private-to-local' +# '--eliminate-dead-inserts' +# '--if-conversion' +# '--if-conversion' +# '--scalar-replacement=100' +# '--private-to-local' +# '--reduce-load-size' +# '--ccp' +# '--scalar-replacement=100' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--merge-return' +# '--private-to-local' +# '--redundancy-elimination' +# '--combine-access-chains' +# '--eliminate-local-multi-store' +# '--ccp' +# '--convert-local-access-chains' +# '--reduce-load-size' +# '--private-to-local' +# '--vector-dce' +# spirv-opt commit hash: 230f363e6da32791f640b02205e0645cc67c3f1d + + + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# float cross2d(vec2 a, vec2 b) +# { +# return ((a.x) * (b.y) - (b.x) * (a.y)); +# } +# int pointInTriangle(vec2 p, vec2 a, vec2 b, vec2 c) +# { +# float pab = cross2d(vec2(p.x - a.x, p.y - a.y), vec2(b.x - a.x, b.y - a.y)); +# float pbc = cross2d(vec2(p.x - b.x, p.y - b.y), vec2(c.x - b.x, c.y - b.y)); +# if (!((pab < 0.0 && pbc < 0.0) || (pab >= 0.0 && pbc >= 0.0))) +# { +# return 0; +# } +# float pca = cross2d(vec2(p.x - c.x, p.y - c.y), vec2(a.x - c.x, a.y - c.y)); +# if (!((pab < 0.0 && pca < 0.0) || (pab >= 0.0 && pca >= 0.0))) +# { +# return 0; +# } +# return 1; +# } +# void main() +# { +# vec2 pos = gl_FragCoord.xy / resolution; +# if (pointInTriangle(pos, vec2(0.7, 0.3), vec2(0.5, 0.9), vec2(0.1, 0.4)) == 1) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +# } +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 207 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %162 %191 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "cross2d(vf2;vf2;" + OpName %10 "a" + OpName %11 "b" + OpName %20 "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %16 "p" + OpName %17 "a" + OpName %18 "b" + OpName %19 "c" + OpName %39 "pab" + OpName %62 "param" + OpName %63 "param" + OpName %65 "pbc" + OpName %88 "param" + OpName %89 "param" + OpName %112 "pca" + OpName %135 "param" + OpName %136 "param" + OpName %159 "pos" + OpName %162 "gl_FragCoord" + OpName %165 "buf0" + OpMemberName %165 0 "resolution" + OpName %167 "" + OpName %181 "param" + OpName %183 "param" + OpName %184 "param" + OpName %185 "param" + OpName %191 "_GLF_color" + OpDecorate %162 BuiltIn FragCoord + OpMemberDecorate %165 0 Offset 0 + OpDecorate %165 Block + OpDecorate %167 DescriptorSet 0 + OpDecorate %167 Binding 0 + OpDecorate %191 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %6 %8 %8 + %14 = OpTypeInt 32 1 + %15 = OpTypeFunction %14 %8 %8 %8 %8 + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 0 + %24 = OpTypePointer Function %6 + %27 = OpConstant %22 1 + %91 = OpTypeBool + %93 = OpConstant %6 0 + %110 = OpConstant %14 0 + %156 = OpConstant %14 1 + %160 = OpTypeVector %6 4 + %161 = OpTypePointer Input %160 + %162 = OpVariable %161 Input + %165 = OpTypeStruct %7 + %166 = OpTypePointer Uniform %165 + %167 = OpVariable %166 Uniform + %168 = OpTypePointer Uniform %7 + %172 = OpConstant %6 0.699999988 + %173 = OpConstant %6 0.300000012 + %174 = OpConstantComposite %7 %172 %173 + %175 = OpConstant %6 0.5 + %176 = OpConstant %6 0.899999976 + %177 = OpConstantComposite %7 %175 %176 + %178 = OpConstant %6 0.100000001 + %179 = OpConstant %6 0.400000006 + %180 = OpConstantComposite %7 %178 %179 + %190 = OpTypePointer Output %160 + %191 = OpVariable %190 Output + %192 = OpConstant %6 1 + %193 = OpConstantComposite %160 %192 %93 %93 %192 + %195 = OpConstantComposite %160 %93 %93 %93 %192 + %197 = OpTypePointer Function %14 + %201 = OpConstantFalse %91 + %202 = OpTypePointer Function %91 + %204 = OpConstantTrue %91 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %159 = OpVariable %8 Function + %181 = OpVariable %8 Function + %183 = OpVariable %8 Function + %184 = OpVariable %8 Function + %185 = OpVariable %8 Function + %163 = OpLoad %160 %162 + %164 = OpVectorShuffle %7 %163 %163 0 1 + %169 = OpAccessChain %168 %167 %110 + %170 = OpLoad %7 %169 + %171 = OpFDiv %7 %164 %170 + OpStore %159 %171 + OpStore %181 %171 + OpStore %183 %174 + OpStore %184 %177 + OpStore %185 %180 + %186 = OpFunctionCall %14 %20 %181 %183 %184 %185 + %187 = OpIEqual %91 %186 %156 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %194 + %188 = OpLabel + OpStore %191 %193 + OpBranch %189 + %194 = OpLabel + OpStore %191 %195 + OpBranch %189 + %189 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %6 None %9 + %10 = OpFunctionParameter %8 + %11 = OpFunctionParameter %8 + %13 = OpLabel + %25 = OpAccessChain %24 %10 %23 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %24 %11 %27 + %29 = OpLoad %6 %28 + %30 = OpFMul %6 %26 %29 + %31 = OpAccessChain %24 %11 %23 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %24 %10 %27 + %34 = OpLoad %6 %33 + %35 = OpFMul %6 %32 %34 + %36 = OpFSub %6 %30 %35 + OpReturnValue %36 + OpFunctionEnd + %20 = OpFunction %14 None %15 + %16 = OpFunctionParameter %8 + %17 = OpFunctionParameter %8 + %18 = OpFunctionParameter %8 + %19 = OpFunctionParameter %8 + %21 = OpLabel + %203 = OpVariable %202 Function %201 + %198 = OpVariable %197 Function + %39 = OpVariable %24 Function + %62 = OpVariable %8 Function + %63 = OpVariable %8 Function + %65 = OpVariable %24 Function + %88 = OpVariable %8 Function + %89 = OpVariable %8 Function + %112 = OpVariable %24 Function + %135 = OpVariable %8 Function + %136 = OpVariable %8 Function + OpSelectionMerge %196 None + OpSwitch %23 %200 + %200 = OpLabel + %40 = OpAccessChain %24 %16 %23 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %24 %17 %23 + %43 = OpLoad %6 %42 + %44 = OpFSub %6 %41 %43 + %45 = OpAccessChain %24 %16 %27 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %24 %17 %27 + %48 = OpLoad %6 %47 + %49 = OpFSub %6 %46 %48 + %50 = OpCompositeConstruct %7 %44 %49 + %51 = OpAccessChain %24 %18 %23 + %52 = OpLoad %6 %51 + %54 = OpLoad %6 %42 + %55 = OpFSub %6 %52 %54 + %56 = OpAccessChain %24 %18 %27 + %57 = OpLoad %6 %56 + %59 = OpLoad %6 %47 + %60 = OpFSub %6 %57 %59 + %61 = OpCompositeConstruct %7 %55 %60 + OpStore %62 %50 + OpStore %63 %61 + %64 = OpFunctionCall %6 %12 %62 %63 + OpStore %39 %64 + %67 = OpLoad %6 %40 + %69 = OpLoad %6 %51 + %70 = OpFSub %6 %67 %69 + %72 = OpLoad %6 %45 + %74 = OpLoad %6 %56 + %75 = OpFSub %6 %72 %74 + %76 = OpCompositeConstruct %7 %70 %75 + %77 = OpAccessChain %24 %19 %23 + %78 = OpLoad %6 %77 + %80 = OpLoad %6 %51 + %81 = OpFSub %6 %78 %80 + %82 = OpAccessChain %24 %19 %27 + %83 = OpLoad %6 %82 + %85 = OpLoad %6 %56 + %86 = OpFSub %6 %83 %85 + %87 = OpCompositeConstruct %7 %81 %86 + OpStore %88 %76 + OpStore %89 %87 + %90 = OpFunctionCall %6 %12 %88 %89 + OpStore %65 %90 + %94 = OpFOrdLessThan %91 %64 %93 + %96 = OpFOrdLessThan %91 %90 %93 + %97 = OpLogicalAnd %91 %94 %96 + %98 = OpLogicalNot %91 %97 + OpSelectionMerge %100 None + OpBranchConditional %98 %99 %100 + %99 = OpLabel + %102 = OpFOrdGreaterThanEqual %91 %64 %93 + %104 = OpFOrdGreaterThanEqual %91 %90 %93 + %105 = OpLogicalAnd %91 %102 %104 + OpBranch %100 + %100 = OpLabel + %106 = OpPhi %91 %97 %200 %105 %99 + %107 = OpLogicalNot %91 %106 + OpSelectionMerge %109 None + OpBranchConditional %107 %108 %109 + %108 = OpLabel + OpStore %203 %204 + OpStore %198 %110 + OpBranch %196 + %109 = OpLabel + %114 = OpLoad %6 %40 + %116 = OpLoad %6 %77 + %117 = OpFSub %6 %114 %116 + %119 = OpLoad %6 %45 + %121 = OpLoad %6 %82 + %122 = OpFSub %6 %119 %121 + %123 = OpCompositeConstruct %7 %117 %122 + %125 = OpLoad %6 %42 + %127 = OpLoad %6 %77 + %128 = OpFSub %6 %125 %127 + %130 = OpLoad %6 %47 + %132 = OpLoad %6 %82 + %133 = OpFSub %6 %130 %132 + %134 = OpCompositeConstruct %7 %128 %133 + OpStore %135 %123 + OpStore %136 %134 + %137 = OpFunctionCall %6 %12 %135 %136 + OpStore %112 %137 + %139 = OpFOrdLessThan %91 %64 %93 + %141 = OpFOrdLessThan %91 %137 %93 + %142 = OpLogicalAnd %91 %139 %141 + %143 = OpLogicalNot %91 %142 + OpSelectionMerge %145 None + OpBranchConditional %143 %144 %145 + %144 = OpLabel + %147 = OpFOrdGreaterThanEqual %91 %64 %93 + %149 = OpFOrdGreaterThanEqual %91 %137 %93 + %150 = OpLogicalAnd %91 %147 %149 + OpBranch %145 + %145 = OpLabel + %151 = OpPhi %91 %142 %109 %150 %144 + %152 = OpLogicalNot %91 %151 + OpSelectionMerge %154 None + OpBranchConditional %152 %153 %154 + %153 = OpLabel + OpStore %203 %204 + OpStore %198 %110 + OpBranch %196 + %154 = OpLabel + OpStore %203 %204 + OpStore %198 %156 + OpBranch %196 + %196 = OpLabel + %206 = OpPhi %14 %110 %108 %110 %153 %156 %154 + OpReturnValue %206 + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# float cross2d(vec2 a, vec2 b) +# { +# return ((a.x) * (b.y) - (b.x) * (a.y)); +# } +# int pointInTriangle(vec2 p, vec2 a, vec2 b, vec2 c) +# { +# const int array_size = 256; +# int array_a[array_size]; +# float pab = cross2d(vec2(p.x - a.x, p.y - a.y), vec2(b.x - a.x, b.y - a.y)); +# float pbc = cross2d(vec2(p.x - b.x, p.y - b.y), vec2(c.x - b.x, c.y - b.y)); +# if (!((pab < 0.0 && pbc < 0.0) || (pab >= 0.0 && pbc >= 0.0))) +# { +# // Injected live code block has no impact on rest of the code in the shader. +# // Initialize array to known values. +# for (int i = 0; i < array_size; i++) +# { +# array_a[i] = 0; +# } +# // Total loop iteration count: 6x4x4x4 = 384. +# for (int int_a = 0; int_a < 6; ) +# { +# int_a++; +# int int_c = 1; +# int int_h = 1; +# int int_d = 0; +# do +# { +# int_d++; +# int int_e = 0; +# for (int int_f = 0; int_f < 4; int_c++) +# { +# int_f++; +# for (int int_g = 0; int_g < 4; int_e++) +# { +# int_g++; +# if (array_a[clamp(int_e * 2 + 32, 0, array_size - 1)] == 0) +# { +# int_h = int_c; +# } +# } +# } +# array_a[clamp(1 + int_h * 16, 0, array_size - 1)] = 1; +# } while (int_d < 4); +# } +# return 0; +# } +# float pca = cross2d(vec2(p.x - c.x, p.y - c.y), vec2(a.x - c.x, a.y - c.y)); +# if (!((pab < 0.0 && pca < 0.0) || (pab >= 0.0 && pca >= 0.0))) +# { +# return 0; +# } +# return 1; +# } +# void main() +# { +# vec2 pos = gl_FragCoord.xy / resolution; +# if (pointInTriangle(pos, vec2(0.7, 0.3), vec2(0.5, 0.9), vec2(0.1, 0.4)) == 1) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 318 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %247 %276 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "cross2d(vf2;vf2;" + OpName %10 "a" + OpName %11 "b" + OpName %20 "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %16 "p" + OpName %17 "a" + OpName %18 "b" + OpName %19 "c" + OpName %39 "pab" + OpName %62 "param" + OpName %63 "param" + OpName %65 "pbc" + OpName %88 "param" + OpName %89 "param" + OpName %111 "i" + OpName %124 "array_a" + OpName %130 "int_a" + OpName %141 "int_c" + OpName %142 "int_h" + OpName %143 "int_d" + OpName %150 "int_e" + OpName %151 "int_f" + OpName %162 "int_g" + OpName %198 "pca" + OpName %221 "param" + OpName %222 "param" + OpName %244 "pos" + OpName %247 "gl_FragCoord" + OpName %250 "buf0" + OpMemberName %250 0 "resolution" + OpName %252 "" + OpName %266 "param" + OpName %268 "param" + OpName %269 "param" + OpName %270 "param" + OpName %276 "_GLF_color" + OpDecorate %247 BuiltIn FragCoord + OpMemberDecorate %250 0 Offset 0 + OpDecorate %250 Block + OpDecorate %252 DescriptorSet 0 + OpDecorate %252 Binding 0 + OpDecorate %276 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %6 %8 %8 + %14 = OpTypeInt 32 1 + %15 = OpTypeFunction %14 %8 %8 %8 %8 + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 0 + %24 = OpTypePointer Function %6 + %27 = OpConstant %22 1 + %91 = OpTypeBool + %93 = OpConstant %6 0 + %110 = OpTypePointer Function %14 + %112 = OpConstant %14 0 + %119 = OpConstant %14 256 + %121 = OpConstant %22 256 + %122 = OpTypeArray %14 %121 + %123 = OpTypePointer Function %122 + %128 = OpConstant %14 1 + %137 = OpConstant %14 6 + %158 = OpConstant %14 4 + %173 = OpConstant %14 2 + %175 = OpConstant %14 32 + %177 = OpConstant %14 255 + %190 = OpConstant %14 16 + %245 = OpTypeVector %6 4 + %246 = OpTypePointer Input %245 + %247 = OpVariable %246 Input + %250 = OpTypeStruct %7 + %251 = OpTypePointer Uniform %250 + %252 = OpVariable %251 Uniform + %253 = OpTypePointer Uniform %7 + %257 = OpConstant %6 0.699999988 + %258 = OpConstant %6 0.300000012 + %259 = OpConstantComposite %7 %257 %258 + %260 = OpConstant %6 0.5 + %261 = OpConstant %6 0.899999976 + %262 = OpConstantComposite %7 %260 %261 + %263 = OpConstant %6 0.100000001 + %264 = OpConstant %6 0.400000006 + %265 = OpConstantComposite %7 %263 %264 + %275 = OpTypePointer Output %245 + %276 = OpVariable %275 Output + %277 = OpConstant %6 1 + %278 = OpConstantComposite %245 %277 %93 %93 %277 + %280 = OpConstantComposite %245 %93 %93 %93 %277 + %285 = OpConstantFalse %91 + %286 = OpTypePointer Function %91 + %288 = OpConstantTrue %91 + %317 = OpConstant %14 17 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %244 = OpVariable %8 Function + %266 = OpVariable %8 Function + %268 = OpVariable %8 Function + %269 = OpVariable %8 Function + %270 = OpVariable %8 Function + %248 = OpLoad %245 %247 + %249 = OpVectorShuffle %7 %248 %248 0 1 + %254 = OpAccessChain %253 %252 %112 + %255 = OpLoad %7 %254 + %256 = OpFDiv %7 %249 %255 + OpStore %244 %256 + OpStore %266 %256 + OpStore %268 %259 + OpStore %269 %262 + OpStore %270 %265 + %271 = OpFunctionCall %14 %20 %266 %268 %269 %270 + %272 = OpIEqual %91 %271 %128 + OpSelectionMerge %274 None + OpBranchConditional %272 %273 %279 + %273 = OpLabel + OpStore %276 %278 + OpBranch %274 + %279 = OpLabel + OpStore %276 %280 + OpBranch %274 + %274 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %6 None %9 + %10 = OpFunctionParameter %8 + %11 = OpFunctionParameter %8 + %13 = OpLabel + %25 = OpAccessChain %24 %10 %23 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %24 %11 %27 + %29 = OpLoad %6 %28 + %30 = OpFMul %6 %26 %29 + %31 = OpAccessChain %24 %11 %23 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %24 %10 %27 + %34 = OpLoad %6 %33 + %35 = OpFMul %6 %32 %34 + %36 = OpFSub %6 %30 %35 + OpReturnValue %36 + OpFunctionEnd + %20 = OpFunction %14 None %15 + %16 = OpFunctionParameter %8 + %17 = OpFunctionParameter %8 + %18 = OpFunctionParameter %8 + %19 = OpFunctionParameter %8 + %21 = OpLabel + %287 = OpVariable %286 Function %285 + %282 = OpVariable %110 Function + %39 = OpVariable %24 Function + %62 = OpVariable %8 Function + %63 = OpVariable %8 Function + %65 = OpVariable %24 Function + %88 = OpVariable %8 Function + %89 = OpVariable %8 Function + %111 = OpVariable %110 Function + %124 = OpVariable %123 Function + %130 = OpVariable %110 Function + %141 = OpVariable %110 Function + %142 = OpVariable %110 Function + %143 = OpVariable %110 Function + %150 = OpVariable %110 Function + %151 = OpVariable %110 Function + %162 = OpVariable %110 Function + %198 = OpVariable %24 Function + %221 = OpVariable %8 Function + %222 = OpVariable %8 Function + OpSelectionMerge %281 None + OpSwitch %23 %284 + %284 = OpLabel + %40 = OpAccessChain %24 %16 %23 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %24 %17 %23 + %43 = OpLoad %6 %42 + %44 = OpFSub %6 %41 %43 + %45 = OpAccessChain %24 %16 %27 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %24 %17 %27 + %48 = OpLoad %6 %47 + %49 = OpFSub %6 %46 %48 + %50 = OpCompositeConstruct %7 %44 %49 + %51 = OpAccessChain %24 %18 %23 + %52 = OpLoad %6 %51 + %54 = OpLoad %6 %42 + %55 = OpFSub %6 %52 %54 + %56 = OpAccessChain %24 %18 %27 + %57 = OpLoad %6 %56 + %59 = OpLoad %6 %47 + %60 = OpFSub %6 %57 %59 + %61 = OpCompositeConstruct %7 %55 %60 + OpStore %62 %50 + OpStore %63 %61 + %64 = OpFunctionCall %6 %12 %62 %63 + OpStore %39 %64 + %67 = OpLoad %6 %40 + %69 = OpLoad %6 %51 + %70 = OpFSub %6 %67 %69 + %72 = OpLoad %6 %45 + %74 = OpLoad %6 %56 + %75 = OpFSub %6 %72 %74 + %76 = OpCompositeConstruct %7 %70 %75 + %77 = OpAccessChain %24 %19 %23 + %78 = OpLoad %6 %77 + %80 = OpLoad %6 %51 + %81 = OpFSub %6 %78 %80 + %82 = OpAccessChain %24 %19 %27 + %83 = OpLoad %6 %82 + %85 = OpLoad %6 %56 + %86 = OpFSub %6 %83 %85 + %87 = OpCompositeConstruct %7 %81 %86 + OpStore %88 %76 + OpStore %89 %87 + %90 = OpFunctionCall %6 %12 %88 %89 + OpStore %65 %90 + %94 = OpFOrdLessThan %91 %64 %93 + %96 = OpFOrdLessThan %91 %90 %93 + %97 = OpLogicalAnd %91 %94 %96 + %98 = OpLogicalNot %91 %97 + OpSelectionMerge %100 None + OpBranchConditional %98 %99 %100 + %99 = OpLabel + %102 = OpFOrdGreaterThanEqual %91 %64 %93 + %104 = OpFOrdGreaterThanEqual %91 %90 %93 + %105 = OpLogicalAnd %91 %102 %104 + OpBranch %100 + %100 = OpLabel + %106 = OpPhi %91 %97 %284 %105 %99 + %107 = OpLogicalNot %91 %106 + OpSelectionMerge %109 None + OpBranchConditional %107 %108 %109 + %108 = OpLabel + OpStore %111 %112 + OpBranch %113 + %113 = OpLabel + %290 = OpPhi %14 %112 %108 %129 %116 + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %120 = OpSLessThan %91 %290 %119 + OpBranchConditional %120 %114 %115 + %114 = OpLabel + %126 = OpAccessChain %110 %124 %290 + OpStore %126 %112 + OpBranch %116 + %116 = OpLabel + %129 = OpIAdd %14 %290 %128 + OpStore %111 %129 + OpBranch %113 + %115 = OpLabel + OpStore %130 %112 + OpBranch %131 + %131 = OpLabel + %291 = OpPhi %14 %112 %115 %306 %134 + OpLoopMerge %133 %134 None + OpBranch %135 + %135 = OpLabel + %138 = OpSLessThan %91 %291 %137 + OpBranchConditional %138 %132 %133 + %132 = OpLabel + %140 = OpIAdd %14 %291 %128 + OpStore %130 %140 + OpStore %141 %128 + OpStore %142 %128 + OpStore %143 %112 + OpBranch %144 + %144 = OpLabel + %296 = OpPhi %14 %128 %132 %295 %147 + %293 = OpPhi %14 %112 %132 %149 %147 + %306 = OpPhi %14 %140 %132 %306 %147 + %301 = OpPhi %14 %128 %132 %300 %147 + OpLoopMerge %146 %147 None + OpBranch %145 + %145 = OpLabel + %149 = OpIAdd %14 %293 %128 + OpStore %143 %149 + OpStore %150 %112 + OpStore %151 %112 + OpBranch %152 + %152 = OpLabel + %300 = OpPhi %14 %301 %145 %188 %155 + %295 = OpPhi %14 %296 %145 %311 %155 + %294 = OpPhi %14 %112 %145 %161 %155 + %303 = OpPhi %14 %112 %145 %302 %155 + OpLoopMerge %154 %155 None + OpBranch %156 + %156 = OpLabel + %159 = OpSLessThan %91 %294 %158 + OpBranchConditional %159 %153 %154 + %153 = OpLabel + %161 = OpIAdd %14 %294 %128 + OpStore %151 %161 + OpStore %162 %112 + OpBranch %163 + %163 = OpLabel + %302 = OpPhi %14 %303 %153 %186 %166 + %298 = OpPhi %14 %112 %153 %171 %166 + %311 = OpPhi %14 %295 %153 %312 %166 + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %169 = OpSLessThan %91 %298 %158 + OpBranchConditional %169 %164 %165 + %164 = OpLabel + %171 = OpIAdd %14 %298 %128 + OpStore %162 %171 + %174 = OpIMul %14 %302 %173 + %176 = OpIAdd %14 %174 %175 + %178 = OpExtInst %14 %1 SClamp %176 %112 %177 + %179 = OpAccessChain %110 %124 %178 + %180 = OpLoad %14 %179 + %181 = OpIEqual %91 %180 %112 + OpSelectionMerge %183 None + OpBranchConditional %181 %182 %183 + %182 = OpLabel + OpStore %142 %300 + OpBranch %183 + %183 = OpLabel + %312 = OpPhi %14 %311 %164 %300 %182 + OpBranch %166 + %166 = OpLabel + %186 = OpIAdd %14 %302 %128 + OpStore %150 %186 + OpBranch %163 + %165 = OpLabel + OpBranch %155 + %155 = OpLabel + %188 = OpIAdd %14 %300 %128 + OpStore %141 %188 + OpBranch %152 + %154 = OpLabel + %191 = OpIMul %14 %295 %190 + %192 = OpIAdd %14 %128 %191 + %193 = OpExtInst %14 %1 SClamp %192 %112 %177 + %194 = OpAccessChain %110 %124 %193 + OpStore %194 %128 + OpBranch %147 + %147 = OpLabel + %196 = OpSLessThan %91 %149 %158 + OpBranchConditional %196 %144 %146 + %146 = OpLabel + OpBranch %134 + %134 = OpLabel + OpBranch %131 + %133 = OpLabel + OpStore %287 %288 + OpStore %282 %112 + OpBranch %281 + %109 = OpLabel + %200 = OpLoad %6 %40 + %202 = OpLoad %6 %77 + %203 = OpFSub %6 %200 %202 + %205 = OpLoad %6 %45 + %207 = OpLoad %6 %82 + %208 = OpFSub %6 %205 %207 + %209 = OpCompositeConstruct %7 %203 %208 + %211 = OpLoad %6 %42 + %213 = OpLoad %6 %77 + %214 = OpFSub %6 %211 %213 + %216 = OpLoad %6 %47 + %218 = OpLoad %6 %82 + %219 = OpFSub %6 %216 %218 + %220 = OpCompositeConstruct %7 %214 %219 + OpStore %221 %209 + OpStore %222 %220 + %223 = OpFunctionCall %6 %12 %221 %222 + OpStore %198 %223 + %225 = OpFOrdLessThan %91 %64 %93 + %227 = OpFOrdLessThan %91 %223 %93 + %228 = OpLogicalAnd %91 %225 %227 + %229 = OpLogicalNot %91 %228 + OpSelectionMerge %231 None + OpBranchConditional %229 %230 %231 + %230 = OpLabel + %233 = OpFOrdGreaterThanEqual %91 %64 %93 + %235 = OpFOrdGreaterThanEqual %91 %223 %93 + %236 = OpLogicalAnd %91 %233 %235 + OpBranch %231 + %231 = OpLabel + %237 = OpPhi %91 %228 %109 %236 %230 + %238 = OpLogicalNot %91 %237 + OpSelectionMerge %240 None + OpBranchConditional %238 %239 %240 + %239 = OpLabel + OpStore %287 %288 + OpStore %282 %112 + OpBranch %281 + %240 = OpLabel + OpStore %287 %288 + OpStore %282 %128 + OpBranch %281 + %281 = OpLabel + %292 = OpPhi %14 %112 %133 %112 %239 %128 %240 + OpReturnValue %292 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-triangle-clamp-conditional-mix.amber b/vulkan/amber/graphicsfuzz/stable-triangle-clamp-conditional-mix.amber new file mode 100644 index 0000000..58333ba --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-triangle-clamp-conditional-mix.amber @@ -0,0 +1,745 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with mix conditional in a clamp + +# The test passes because both shaders render the same image. + +# Optimized using spirv-opt with the following arguments: +# '--vector-dce' +# '--simplify-instructions' +# '--redundancy-elimination' +# '--ccp' +# '--vector-dce' +# spirv-opt commit hash: b78f4b1518e0052491f4e7e01ace4ee915cb5de2 + + + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# float cross2d(vec2 a, vec2 b) +# { +# return ((a.x) * (b.y) - (b.x) * (a.y)); +# } +# int pointInTriangle(vec2 p, vec2 a, vec2 b, vec2 c) +# { +# float pab = cross2d(vec2(p.x - a.x, p.y - a.y), vec2(b.x - a.x, b.y - a.y)); +# float pbc = cross2d(vec2(p.x - b.x, p.y - b.y), vec2(c.x - b.x, c.y - b.y)); +# if (!((pab < 0.0 && pbc < 0.0) || (pab >= 0.0 && pbc >= 0.0))) +# { +# return 0; +# } +# float pca = cross2d(vec2(p.x - c.x, p.y - c.y), vec2(a.x - c.x, a.y - c.y)); +# if (!((pab < 0.0 && pca < 0.0) || (pab >= 0.0 && pca >= 0.0))) +# { +# return 0; +# } +# return 1; +# } +# void main() +# { +# vec2 pos = gl_FragCoord.xy / resolution; +# if (pointInTriangle(pos, vec2(0.7, 0.3), vec2(0.5, 0.9), vec2(0.1, 0.4)) == 1) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +# } +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 196 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %162 %191 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "cross2d(vf2;vf2;" + OpName %10 "a" + OpName %11 "b" + OpName %20 "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %16 "p" + OpName %17 "a" + OpName %18 "b" + OpName %19 "c" + OpName %39 "pab" + OpName %62 "param" + OpName %63 "param" + OpName %65 "pbc" + OpName %88 "param" + OpName %89 "param" + OpName %112 "pca" + OpName %135 "param" + OpName %136 "param" + OpName %159 "pos" + OpName %162 "gl_FragCoord" + OpName %165 "buf0" + OpMemberName %165 0 "resolution" + OpName %167 "" + OpName %181 "param" + OpName %183 "param" + OpName %184 "param" + OpName %185 "param" + OpName %191 "_GLF_color" + OpDecorate %162 BuiltIn FragCoord + OpMemberDecorate %165 0 Offset 0 + OpDecorate %165 Block + OpDecorate %167 DescriptorSet 0 + OpDecorate %167 Binding 0 + OpDecorate %191 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %6 %8 %8 + %14 = OpTypeInt 32 1 + %15 = OpTypeFunction %14 %8 %8 %8 %8 + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 0 + %24 = OpTypePointer Function %6 + %27 = OpConstant %22 1 + %91 = OpTypeBool + %93 = OpConstant %6 0 + %110 = OpConstant %14 0 + %156 = OpConstant %14 1 + %160 = OpTypeVector %6 4 + %161 = OpTypePointer Input %160 + %162 = OpVariable %161 Input + %165 = OpTypeStruct %7 + %166 = OpTypePointer Uniform %165 + %167 = OpVariable %166 Uniform + %168 = OpTypePointer Uniform %7 + %172 = OpConstant %6 0.699999988 + %173 = OpConstant %6 0.300000012 + %174 = OpConstantComposite %7 %172 %173 + %175 = OpConstant %6 0.5 + %176 = OpConstant %6 0.899999976 + %177 = OpConstantComposite %7 %175 %176 + %178 = OpConstant %6 0.100000001 + %179 = OpConstant %6 0.400000006 + %180 = OpConstantComposite %7 %178 %179 + %190 = OpTypePointer Output %160 + %191 = OpVariable %190 Output + %192 = OpConstant %6 1 + %193 = OpConstantComposite %160 %192 %93 %93 %192 + %195 = OpConstantComposite %160 %93 %93 %93 %192 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %159 = OpVariable %8 Function + %181 = OpVariable %8 Function + %183 = OpVariable %8 Function + %184 = OpVariable %8 Function + %185 = OpVariable %8 Function + %163 = OpLoad %160 %162 + %164 = OpVectorShuffle %7 %163 %163 0 1 + %169 = OpAccessChain %168 %167 %110 + %170 = OpLoad %7 %169 + %171 = OpFDiv %7 %164 %170 + OpStore %159 %171 + %182 = OpLoad %7 %159 + OpStore %181 %182 + OpStore %183 %174 + OpStore %184 %177 + OpStore %185 %180 + %186 = OpFunctionCall %14 %20 %181 %183 %184 %185 + %187 = OpIEqual %91 %186 %156 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %194 + %188 = OpLabel + OpStore %191 %193 + OpBranch %189 + %194 = OpLabel + OpStore %191 %195 + OpBranch %189 + %189 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %6 None %9 + %10 = OpFunctionParameter %8 + %11 = OpFunctionParameter %8 + %13 = OpLabel + %25 = OpAccessChain %24 %10 %23 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %24 %11 %27 + %29 = OpLoad %6 %28 + %30 = OpFMul %6 %26 %29 + %31 = OpAccessChain %24 %11 %23 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %24 %10 %27 + %34 = OpLoad %6 %33 + %35 = OpFMul %6 %32 %34 + %36 = OpFSub %6 %30 %35 + OpReturnValue %36 + OpFunctionEnd + %20 = OpFunction %14 None %15 + %16 = OpFunctionParameter %8 + %17 = OpFunctionParameter %8 + %18 = OpFunctionParameter %8 + %19 = OpFunctionParameter %8 + %21 = OpLabel + %39 = OpVariable %24 Function + %62 = OpVariable %8 Function + %63 = OpVariable %8 Function + %65 = OpVariable %24 Function + %88 = OpVariable %8 Function + %89 = OpVariable %8 Function + %112 = OpVariable %24 Function + %135 = OpVariable %8 Function + %136 = OpVariable %8 Function + %40 = OpAccessChain %24 %16 %23 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %24 %17 %23 + %43 = OpLoad %6 %42 + %44 = OpFSub %6 %41 %43 + %45 = OpAccessChain %24 %16 %27 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %24 %17 %27 + %48 = OpLoad %6 %47 + %49 = OpFSub %6 %46 %48 + %50 = OpCompositeConstruct %7 %44 %49 + %51 = OpAccessChain %24 %18 %23 + %52 = OpLoad %6 %51 + %54 = OpLoad %6 %42 + %55 = OpFSub %6 %52 %54 + %56 = OpAccessChain %24 %18 %27 + %57 = OpLoad %6 %56 + %59 = OpLoad %6 %47 + %60 = OpFSub %6 %57 %59 + %61 = OpCompositeConstruct %7 %55 %60 + OpStore %62 %50 + OpStore %63 %61 + %64 = OpFunctionCall %6 %12 %62 %63 + OpStore %39 %64 + %67 = OpLoad %6 %40 + %69 = OpLoad %6 %51 + %70 = OpFSub %6 %67 %69 + %72 = OpLoad %6 %45 + %74 = OpLoad %6 %56 + %75 = OpFSub %6 %72 %74 + %76 = OpCompositeConstruct %7 %70 %75 + %77 = OpAccessChain %24 %19 %23 + %78 = OpLoad %6 %77 + %80 = OpLoad %6 %51 + %81 = OpFSub %6 %78 %80 + %82 = OpAccessChain %24 %19 %27 + %83 = OpLoad %6 %82 + %85 = OpLoad %6 %56 + %86 = OpFSub %6 %83 %85 + %87 = OpCompositeConstruct %7 %81 %86 + OpStore %88 %76 + OpStore %89 %87 + %90 = OpFunctionCall %6 %12 %88 %89 + OpStore %65 %90 + %92 = OpLoad %6 %39 + %94 = OpFOrdLessThan %91 %92 %93 + %95 = OpLoad %6 %65 + %96 = OpFOrdLessThan %91 %95 %93 + %97 = OpLogicalAnd %91 %94 %96 + %98 = OpLogicalNot %91 %97 + OpSelectionMerge %100 None + OpBranchConditional %98 %99 %100 + %99 = OpLabel + %101 = OpLoad %6 %39 + %102 = OpFOrdGreaterThanEqual %91 %101 %93 + %103 = OpLoad %6 %65 + %104 = OpFOrdGreaterThanEqual %91 %103 %93 + %105 = OpLogicalAnd %91 %102 %104 + OpBranch %100 + %100 = OpLabel + %106 = OpPhi %91 %97 %21 %105 %99 + %107 = OpLogicalNot %91 %106 + OpSelectionMerge %109 None + OpBranchConditional %107 %108 %109 + %108 = OpLabel + OpReturnValue %110 + %109 = OpLabel + %114 = OpLoad %6 %40 + %116 = OpLoad %6 %77 + %117 = OpFSub %6 %114 %116 + %119 = OpLoad %6 %45 + %121 = OpLoad %6 %82 + %122 = OpFSub %6 %119 %121 + %123 = OpCompositeConstruct %7 %117 %122 + %125 = OpLoad %6 %42 + %127 = OpLoad %6 %77 + %128 = OpFSub %6 %125 %127 + %130 = OpLoad %6 %47 + %132 = OpLoad %6 %82 + %133 = OpFSub %6 %130 %132 + %134 = OpCompositeConstruct %7 %128 %133 + OpStore %135 %123 + OpStore %136 %134 + %137 = OpFunctionCall %6 %12 %135 %136 + OpStore %112 %137 + %138 = OpLoad %6 %39 + %139 = OpFOrdLessThan %91 %138 %93 + %140 = OpLoad %6 %112 + %141 = OpFOrdLessThan %91 %140 %93 + %142 = OpLogicalAnd %91 %139 %141 + %143 = OpLogicalNot %91 %142 + OpSelectionMerge %145 None + OpBranchConditional %143 %144 %145 + %144 = OpLabel + %146 = OpLoad %6 %39 + %147 = OpFOrdGreaterThanEqual %91 %146 %93 + %148 = OpLoad %6 %112 + %149 = OpFOrdGreaterThanEqual %91 %148 %93 + %150 = OpLogicalAnd %91 %147 %149 + OpBranch %145 + %145 = OpLabel + %151 = OpPhi %91 %142 %109 %150 %144 + %152 = OpLogicalNot %91 %151 + OpSelectionMerge %154 None + OpBranchConditional %152 %153 %154 + %153 = OpLabel + OpReturnValue %110 + %154 = OpLabel + OpReturnValue %156 + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# float cross2d(vec2 a, vec2 b) +# { +# return ((a.x) * (b.y) - (b.x) * (a.y)); +# } +# int pointInTriangle(vec2 p, vec2 a, vec2 b, vec2 c) +# { +# // var_y == c.y +# float var_y = ( +# // Always true. +# (resolution.x == resolution.y) ? +# // mix == vec2(c.y, c.y), so var_y == c.y. +# mix(vec2(c.y, c.y), vec2(1.0, max((true ? c.y : 1.0), c.y)), bvec2(false, false)).y : +# (-1.0) +# ); +# // clamp_y == c.y +# float clamp_y = clamp(c.y, c.y, var_y); +# float pab = cross2d(vec2(p.x - a.x, p.y - a.y), vec2(b.x - a.x, b.y - a.y)); +# float pbc = cross2d(vec2(p.x - b.x, p.y - b.y), vec2(c.x - b.x, clamp_y - b.y)); +# if (!((pab < 0.0 && pbc < 0.0) || (pab >= 0.0 && pbc >= 0.0))) +# { +# return 0; +# } +# float pca = cross2d(vec2(p.x - c.x, p.y - c.y), vec2(a.x - c.x, a.y - c.y)); +# if (!((pab < 0.0 && pca < 0.0) || (pab >= 0.0 && pca >= 0.0))) +# { +# return 0; +# } +# return 1; +# } +# void main() +# { +# vec2 pos = gl_FragCoord.xy / resolution; +# if (pointInTriangle(pos, vec2(0.7, 0.3), vec2(0.5, 0.9), vec2(0.1, 0.4)) == 1) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 238 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %207 %233 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "cross2d(vf2;vf2;" + OpName %10 "a" + OpName %11 "b" + OpName %20 "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %16 "p" + OpName %17 "a" + OpName %18 "b" + OpName %19 "c" + OpName %39 "var_y" + OpName %40 "buf0" + OpMemberName %40 0 "resolution" + OpName %42 "" + OpName %80 "clamp_y" + OpName %87 "pab" + OpName %110 "param" + OpName %111 "param" + OpName %113 "pbc" + OpName %135 "param" + OpName %136 "param" + OpName %157 "pca" + OpName %180 "param" + OpName %181 "param" + OpName %204 "pos" + OpName %207 "gl_FragCoord" + OpName %223 "param" + OpName %225 "param" + OpName %226 "param" + OpName %227 "param" + OpName %233 "_GLF_color" + OpMemberDecorate %40 0 Offset 0 + OpDecorate %40 Block + OpDecorate %42 DescriptorSet 0 + OpDecorate %42 Binding 0 + OpDecorate %207 BuiltIn FragCoord + OpDecorate %233 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %6 %8 %8 + %14 = OpTypeInt 32 1 + %15 = OpTypeFunction %14 %8 %8 %8 %8 + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 0 + %24 = OpTypePointer Function %6 + %27 = OpConstant %22 1 + %40 = OpTypeStruct %7 + %41 = OpTypePointer Uniform %40 + %42 = OpVariable %41 Uniform + %43 = OpConstant %14 0 + %44 = OpTypePointer Uniform %6 + %49 = OpTypeBool + %59 = OpConstant %6 1 + %60 = OpConstantTrue %49 + %72 = OpTypeVector %49 2 + %73 = OpConstantFalse %49 + %74 = OpConstantComposite %72 %73 %73 + %78 = OpConstant %6 -1 + %139 = OpConstant %6 0 + %201 = OpConstant %14 1 + %205 = OpTypeVector %6 4 + %206 = OpTypePointer Input %205 + %207 = OpVariable %206 Input + %210 = OpTypePointer Uniform %7 + %214 = OpConstant %6 0.699999988 + %215 = OpConstant %6 0.300000012 + %216 = OpConstantComposite %7 %214 %215 + %217 = OpConstant %6 0.5 + %218 = OpConstant %6 0.899999976 + %219 = OpConstantComposite %7 %217 %218 + %220 = OpConstant %6 0.100000001 + %221 = OpConstant %6 0.400000006 + %222 = OpConstantComposite %7 %220 %221 + %232 = OpTypePointer Output %205 + %233 = OpVariable %232 Output + %234 = OpConstantComposite %205 %59 %139 %139 %59 + %236 = OpConstantComposite %205 %139 %139 %139 %59 + %237 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %204 = OpVariable %8 Function + %223 = OpVariable %8 Function + %225 = OpVariable %8 Function + %226 = OpVariable %8 Function + %227 = OpVariable %8 Function + %208 = OpLoad %205 %207 + %209 = OpVectorShuffle %7 %208 %208 0 1 + %211 = OpAccessChain %210 %42 %43 + %212 = OpLoad %7 %211 + %213 = OpFDiv %7 %209 %212 + OpStore %204 %213 + %224 = OpLoad %7 %204 + OpStore %223 %224 + OpStore %225 %216 + OpStore %226 %219 + OpStore %227 %222 + %228 = OpFunctionCall %14 %20 %223 %225 %226 %227 + %229 = OpIEqual %49 %228 %201 + OpSelectionMerge %231 None + OpBranchConditional %229 %230 %235 + %230 = OpLabel + OpStore %233 %234 + OpBranch %231 + %235 = OpLabel + OpStore %233 %236 + OpBranch %231 + %231 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %6 None %9 + %10 = OpFunctionParameter %8 + %11 = OpFunctionParameter %8 + %13 = OpLabel + %25 = OpAccessChain %24 %10 %23 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %24 %11 %27 + %29 = OpLoad %6 %28 + %30 = OpFMul %6 %26 %29 + %31 = OpAccessChain %24 %11 %23 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %24 %10 %27 + %34 = OpLoad %6 %33 + %35 = OpFMul %6 %32 %34 + %36 = OpFSub %6 %30 %35 + OpReturnValue %36 + OpFunctionEnd + %20 = OpFunction %14 None %15 + %16 = OpFunctionParameter %8 + %17 = OpFunctionParameter %8 + %18 = OpFunctionParameter %8 + %19 = OpFunctionParameter %8 + %21 = OpLabel + %39 = OpVariable %24 Function + %51 = OpVariable %24 Function + %61 = OpVariable %24 Function + %80 = OpVariable %24 Function + %87 = OpVariable %24 Function + %110 = OpVariable %8 Function + %111 = OpVariable %8 Function + %113 = OpVariable %24 Function + %135 = OpVariable %8 Function + %136 = OpVariable %8 Function + %157 = OpVariable %24 Function + %180 = OpVariable %8 Function + %181 = OpVariable %8 Function + %45 = OpAccessChain %44 %42 %43 %23 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %44 %42 %43 %27 + %48 = OpLoad %6 %47 + %50 = OpFOrdEqual %49 %46 %48 + OpSelectionMerge %53 None + OpBranchConditional %50 %52 %77 + %52 = OpLabel + %54 = OpAccessChain %24 %19 %27 + %57 = OpLoad %6 %54 + %58 = OpCompositeConstruct %7 %237 %57 + OpSelectionMerge %63 None + OpBranchConditional %60 %62 %66 + %62 = OpLabel + %65 = OpLoad %6 %54 + OpStore %61 %65 + OpBranch %63 + %66 = OpLabel + OpStore %61 %59 + OpBranch %63 + %63 = OpLabel + %67 = OpLoad %6 %61 + %69 = OpLoad %6 %54 + %70 = OpExtInst %6 %1 FMax %67 %69 + %71 = OpCompositeConstruct %7 %59 %70 + %75 = OpVectorShuffle %7 %71 %58 2 3 + OpStore %51 %57 + OpBranch %53 + %77 = OpLabel + OpStore %51 %78 + OpBranch %53 + %53 = OpLabel + %79 = OpLoad %6 %51 + OpStore %39 %79 + %81 = OpAccessChain %24 %19 %27 + %82 = OpLoad %6 %81 + %84 = OpLoad %6 %81 + %85 = OpLoad %6 %39 + %86 = OpExtInst %6 %1 FClamp %82 %84 %85 + OpStore %80 %86 + %88 = OpAccessChain %24 %16 %23 + %89 = OpLoad %6 %88 + %90 = OpAccessChain %24 %17 %23 + %91 = OpLoad %6 %90 + %92 = OpFSub %6 %89 %91 + %93 = OpAccessChain %24 %16 %27 + %94 = OpLoad %6 %93 + %95 = OpAccessChain %24 %17 %27 + %96 = OpLoad %6 %95 + %97 = OpFSub %6 %94 %96 + %98 = OpCompositeConstruct %7 %92 %97 + %99 = OpAccessChain %24 %18 %23 + %100 = OpLoad %6 %99 + %102 = OpLoad %6 %90 + %103 = OpFSub %6 %100 %102 + %104 = OpAccessChain %24 %18 %27 + %105 = OpLoad %6 %104 + %107 = OpLoad %6 %95 + %108 = OpFSub %6 %105 %107 + %109 = OpCompositeConstruct %7 %103 %108 + OpStore %110 %98 + OpStore %111 %109 + %112 = OpFunctionCall %6 %12 %110 %111 + OpStore %87 %112 + %115 = OpLoad %6 %88 + %117 = OpLoad %6 %99 + %118 = OpFSub %6 %115 %117 + %120 = OpLoad %6 %93 + %122 = OpLoad %6 %104 + %123 = OpFSub %6 %120 %122 + %124 = OpCompositeConstruct %7 %118 %123 + %125 = OpAccessChain %24 %19 %23 + %126 = OpLoad %6 %125 + %128 = OpLoad %6 %99 + %129 = OpFSub %6 %126 %128 + %130 = OpLoad %6 %80 + %132 = OpLoad %6 %104 + %133 = OpFSub %6 %130 %132 + %134 = OpCompositeConstruct %7 %129 %133 + OpStore %135 %124 + OpStore %136 %134 + %137 = OpFunctionCall %6 %12 %135 %136 + OpStore %113 %137 + %138 = OpLoad %6 %87 + %140 = OpFOrdLessThan %49 %138 %139 + %141 = OpLoad %6 %113 + %142 = OpFOrdLessThan %49 %141 %139 + %143 = OpLogicalAnd %49 %140 %142 + %144 = OpLogicalNot %49 %143 + OpSelectionMerge %146 None + OpBranchConditional %144 %145 %146 + %145 = OpLabel + %147 = OpLoad %6 %87 + %148 = OpFOrdGreaterThanEqual %49 %147 %139 + %149 = OpLoad %6 %113 + %150 = OpFOrdGreaterThanEqual %49 %149 %139 + %151 = OpLogicalAnd %49 %148 %150 + OpBranch %146 + %146 = OpLabel + %152 = OpPhi %49 %143 %53 %151 %145 + %153 = OpLogicalNot %49 %152 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + OpReturnValue %43 + %155 = OpLabel + %159 = OpLoad %6 %88 + %161 = OpLoad %6 %125 + %162 = OpFSub %6 %159 %161 + %164 = OpLoad %6 %93 + %166 = OpLoad %6 %81 + %167 = OpFSub %6 %164 %166 + %168 = OpCompositeConstruct %7 %162 %167 + %170 = OpLoad %6 %90 + %172 = OpLoad %6 %125 + %173 = OpFSub %6 %170 %172 + %175 = OpLoad %6 %95 + %177 = OpLoad %6 %81 + %178 = OpFSub %6 %175 %177 + %179 = OpCompositeConstruct %7 %173 %178 + OpStore %180 %168 + OpStore %181 %179 + %182 = OpFunctionCall %6 %12 %180 %181 + OpStore %157 %182 + %183 = OpLoad %6 %87 + %184 = OpFOrdLessThan %49 %183 %139 + %185 = OpLoad %6 %157 + %186 = OpFOrdLessThan %49 %185 %139 + %187 = OpLogicalAnd %49 %184 %186 + %188 = OpLogicalNot %49 %187 + OpSelectionMerge %190 None + OpBranchConditional %188 %189 %190 + %189 = OpLabel + %191 = OpLoad %6 %87 + %192 = OpFOrdGreaterThanEqual %49 %191 %139 + %193 = OpLoad %6 %157 + %194 = OpFOrdGreaterThanEqual %49 %193 %139 + %195 = OpLogicalAnd %49 %192 %194 + OpBranch %190 + %190 = OpLabel + %196 = OpPhi %49 %187 %155 %195 %189 + %197 = OpLogicalNot %49 %196 + OpSelectionMerge %199 None + OpBranchConditional %197 %198 %199 + %198 = OpLabel + OpReturnValue %43 + %199 = OpLabel + OpReturnValue %201 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-triangle-nested-conditional-clamped-float.amber b/vulkan/amber/graphicsfuzz/stable-triangle-nested-conditional-clamped-float.amber new file mode 100644 index 0000000..9744af2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-triangle-nested-conditional-clamped-float.amber @@ -0,0 +1,766 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with nested conditional float in clamp + +# The test passes because both shaders render the same imgae. + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# float cross2d(vec2 a, vec2 b) +# { +# return ((a.x) * (b.y) - (b.x) * (a.y)); +# } +# int pointInTriangle(vec2 p, vec2 a, vec2 b, vec2 c) +# { +# float pab = cross2d(vec2(p.x - a.x, p.y - a.y), vec2(b.x - a.x, b.y - a.y)); +# float pbc = cross2d(vec2(p.x - b.x, p.y - b.y), vec2(c.x - b.x, c.y - b.y)); +# if (!((pab < 0.0 && pbc < 0.0) || (pab >= 0.0 && pbc >= 0.0))) +# { +# return 0; +# } +# float pca = cross2d(vec2(p.x - c.x, p.y - c.y), vec2(a.x - c.x, a.y - c.y)); +# if (!((pab < 0.0 && pca < 0.0) || (pab >= 0.0 && pca >= 0.0))) +# { +# return 0; +# } +# return 1; +# } +# void main() +# { +# vec2 pos = gl_FragCoord.xy / resolution; +# if (pointInTriangle(pos, vec2(0.7, 0.3), vec2(0.5, 0.9), vec2(0.1, 0.4)) == 1) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +# } +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 196 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %162 %191 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "cross2d(vf2;vf2;" + OpName %10 "a" + OpName %11 "b" + OpName %20 "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %16 "p" + OpName %17 "a" + OpName %18 "b" + OpName %19 "c" + OpName %39 "pab" + OpName %62 "param" + OpName %63 "param" + OpName %65 "pbc" + OpName %88 "param" + OpName %89 "param" + OpName %112 "pca" + OpName %135 "param" + OpName %136 "param" + OpName %159 "pos" + OpName %162 "gl_FragCoord" + OpName %165 "buf0" + OpMemberName %165 0 "resolution" + OpName %167 "" + OpName %181 "param" + OpName %183 "param" + OpName %184 "param" + OpName %185 "param" + OpName %191 "_GLF_color" + OpDecorate %162 BuiltIn FragCoord + OpMemberDecorate %165 0 Offset 0 + OpDecorate %165 Block + OpDecorate %167 DescriptorSet 0 + OpDecorate %167 Binding 0 + OpDecorate %191 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %6 %8 %8 + %14 = OpTypeInt 32 1 + %15 = OpTypeFunction %14 %8 %8 %8 %8 + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 0 + %24 = OpTypePointer Function %6 + %27 = OpConstant %22 1 + %91 = OpTypeBool + %93 = OpConstant %6 0 + %110 = OpConstant %14 0 + %156 = OpConstant %14 1 + %160 = OpTypeVector %6 4 + %161 = OpTypePointer Input %160 + %162 = OpVariable %161 Input + %165 = OpTypeStruct %7 + %166 = OpTypePointer Uniform %165 + %167 = OpVariable %166 Uniform + %168 = OpTypePointer Uniform %7 + %172 = OpConstant %6 0.699999988 + %173 = OpConstant %6 0.300000012 + %174 = OpConstantComposite %7 %172 %173 + %175 = OpConstant %6 0.5 + %176 = OpConstant %6 0.899999976 + %177 = OpConstantComposite %7 %175 %176 + %178 = OpConstant %6 0.100000001 + %179 = OpConstant %6 0.400000006 + %180 = OpConstantComposite %7 %178 %179 + %190 = OpTypePointer Output %160 + %191 = OpVariable %190 Output + %192 = OpConstant %6 1 + %193 = OpConstantComposite %160 %192 %93 %93 %192 + %195 = OpConstantComposite %160 %93 %93 %93 %192 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %159 = OpVariable %8 Function + %181 = OpVariable %8 Function + %183 = OpVariable %8 Function + %184 = OpVariable %8 Function + %185 = OpVariable %8 Function + %163 = OpLoad %160 %162 + %164 = OpVectorShuffle %7 %163 %163 0 1 + %169 = OpAccessChain %168 %167 %110 + %170 = OpLoad %7 %169 + %171 = OpFDiv %7 %164 %170 + OpStore %159 %171 + %182 = OpLoad %7 %159 + OpStore %181 %182 + OpStore %183 %174 + OpStore %184 %177 + OpStore %185 %180 + %186 = OpFunctionCall %14 %20 %181 %183 %184 %185 + %187 = OpIEqual %91 %186 %156 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %194 + %188 = OpLabel + OpStore %191 %193 + OpBranch %189 + %194 = OpLabel + OpStore %191 %195 + OpBranch %189 + %189 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %6 None %9 + %10 = OpFunctionParameter %8 + %11 = OpFunctionParameter %8 + %13 = OpLabel + %25 = OpAccessChain %24 %10 %23 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %24 %11 %27 + %29 = OpLoad %6 %28 + %30 = OpFMul %6 %26 %29 + %31 = OpAccessChain %24 %11 %23 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %24 %10 %27 + %34 = OpLoad %6 %33 + %35 = OpFMul %6 %32 %34 + %36 = OpFSub %6 %30 %35 + OpReturnValue %36 + OpFunctionEnd + %20 = OpFunction %14 None %15 + %16 = OpFunctionParameter %8 + %17 = OpFunctionParameter %8 + %18 = OpFunctionParameter %8 + %19 = OpFunctionParameter %8 + %21 = OpLabel + %39 = OpVariable %24 Function + %62 = OpVariable %8 Function + %63 = OpVariable %8 Function + %65 = OpVariable %24 Function + %88 = OpVariable %8 Function + %89 = OpVariable %8 Function + %112 = OpVariable %24 Function + %135 = OpVariable %8 Function + %136 = OpVariable %8 Function + %40 = OpAccessChain %24 %16 %23 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %24 %17 %23 + %43 = OpLoad %6 %42 + %44 = OpFSub %6 %41 %43 + %45 = OpAccessChain %24 %16 %27 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %24 %17 %27 + %48 = OpLoad %6 %47 + %49 = OpFSub %6 %46 %48 + %50 = OpCompositeConstruct %7 %44 %49 + %51 = OpAccessChain %24 %18 %23 + %52 = OpLoad %6 %51 + %53 = OpAccessChain %24 %17 %23 + %54 = OpLoad %6 %53 + %55 = OpFSub %6 %52 %54 + %56 = OpAccessChain %24 %18 %27 + %57 = OpLoad %6 %56 + %58 = OpAccessChain %24 %17 %27 + %59 = OpLoad %6 %58 + %60 = OpFSub %6 %57 %59 + %61 = OpCompositeConstruct %7 %55 %60 + OpStore %62 %50 + OpStore %63 %61 + %64 = OpFunctionCall %6 %12 %62 %63 + OpStore %39 %64 + %66 = OpAccessChain %24 %16 %23 + %67 = OpLoad %6 %66 + %68 = OpAccessChain %24 %18 %23 + %69 = OpLoad %6 %68 + %70 = OpFSub %6 %67 %69 + %71 = OpAccessChain %24 %16 %27 + %72 = OpLoad %6 %71 + %73 = OpAccessChain %24 %18 %27 + %74 = OpLoad %6 %73 + %75 = OpFSub %6 %72 %74 + %76 = OpCompositeConstruct %7 %70 %75 + %77 = OpAccessChain %24 %19 %23 + %78 = OpLoad %6 %77 + %79 = OpAccessChain %24 %18 %23 + %80 = OpLoad %6 %79 + %81 = OpFSub %6 %78 %80 + %82 = OpAccessChain %24 %19 %27 + %83 = OpLoad %6 %82 + %84 = OpAccessChain %24 %18 %27 + %85 = OpLoad %6 %84 + %86 = OpFSub %6 %83 %85 + %87 = OpCompositeConstruct %7 %81 %86 + OpStore %88 %76 + OpStore %89 %87 + %90 = OpFunctionCall %6 %12 %88 %89 + OpStore %65 %90 + %92 = OpLoad %6 %39 + %94 = OpFOrdLessThan %91 %92 %93 + %95 = OpLoad %6 %65 + %96 = OpFOrdLessThan %91 %95 %93 + %97 = OpLogicalAnd %91 %94 %96 + %98 = OpLogicalNot %91 %97 + OpSelectionMerge %100 None + OpBranchConditional %98 %99 %100 + %99 = OpLabel + %101 = OpLoad %6 %39 + %102 = OpFOrdGreaterThanEqual %91 %101 %93 + %103 = OpLoad %6 %65 + %104 = OpFOrdGreaterThanEqual %91 %103 %93 + %105 = OpLogicalAnd %91 %102 %104 + OpBranch %100 + %100 = OpLabel + %106 = OpPhi %91 %97 %21 %105 %99 + %107 = OpLogicalNot %91 %106 + OpSelectionMerge %109 None + OpBranchConditional %107 %108 %109 + %108 = OpLabel + OpReturnValue %110 + %109 = OpLabel + %113 = OpAccessChain %24 %16 %23 + %114 = OpLoad %6 %113 + %115 = OpAccessChain %24 %19 %23 + %116 = OpLoad %6 %115 + %117 = OpFSub %6 %114 %116 + %118 = OpAccessChain %24 %16 %27 + %119 = OpLoad %6 %118 + %120 = OpAccessChain %24 %19 %27 + %121 = OpLoad %6 %120 + %122 = OpFSub %6 %119 %121 + %123 = OpCompositeConstruct %7 %117 %122 + %124 = OpAccessChain %24 %17 %23 + %125 = OpLoad %6 %124 + %126 = OpAccessChain %24 %19 %23 + %127 = OpLoad %6 %126 + %128 = OpFSub %6 %125 %127 + %129 = OpAccessChain %24 %17 %27 + %130 = OpLoad %6 %129 + %131 = OpAccessChain %24 %19 %27 + %132 = OpLoad %6 %131 + %133 = OpFSub %6 %130 %132 + %134 = OpCompositeConstruct %7 %128 %133 + OpStore %135 %123 + OpStore %136 %134 + %137 = OpFunctionCall %6 %12 %135 %136 + OpStore %112 %137 + %138 = OpLoad %6 %39 + %139 = OpFOrdLessThan %91 %138 %93 + %140 = OpLoad %6 %112 + %141 = OpFOrdLessThan %91 %140 %93 + %142 = OpLogicalAnd %91 %139 %141 + %143 = OpLogicalNot %91 %142 + OpSelectionMerge %145 None + OpBranchConditional %143 %144 %145 + %144 = OpLabel + %146 = OpLoad %6 %39 + %147 = OpFOrdGreaterThanEqual %91 %146 %93 + %148 = OpLoad %6 %112 + %149 = OpFOrdGreaterThanEqual %91 %148 %93 + %150 = OpLogicalAnd %91 %147 %149 + OpBranch %145 + %145 = OpLabel + %151 = OpPhi %91 %142 %109 %150 %144 + %152 = OpLogicalNot %91 %151 + OpSelectionMerge %154 None + OpBranchConditional %152 %153 %154 + %153 = OpLabel + OpReturnValue %110 + %154 = OpLabel + OpReturnValue %156 + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(push_constant) uniform buf_push +# { +# vec2 injectionSwitch; // x == 0.0, y == 1.0 +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# float cross2d(vec2 a, vec2 b) +# { +# return ((a.x) * (b.y) - (b.x) * (a.y)); +# } +# int pointInTriangle(vec2 p, vec2 a, vec2 b, vec2 c) +# { +# float pab = cross2d(vec2(p.x - a.x, p.y - a.y), vec2(b.x - a.x, b.y - a.y)); +# float pbc = cross2d(vec2(p.x - b.x, p.y - b.y), vec2(c.x - b.x, c.y - b.y)); +# if (!((pab < 0.0 && pbc < 0.0) || (pab >= 0.0 && pbc >= 0.0))) +# { +# return 0; +# } +# float pca = cross2d(vec2(p.x - c.x, p.y - c.y), vec2(a.x - c.x, a.y - c.y)); +# if (!((pab < 0.0 && pca < 0.0) || (pab >= 0.0 && pca >= 0.0))) +# { +# return 0; +# } +# return 1; +# } +# void main() +# { +# // float_b == 0.4 +# float float_b = ((gl_FragCoord.x >= 0.0) ? (true ? 0.4 : (float(injectionSwitch.y))) : (-1.0)); +# // float_a == 0.4 +# float float_a = (float(clamp(0.4, 0.4, float_b))); +# vec2 pos = gl_FragCoord.xy / resolution; +# if ((pointInTriangle(pos, vec2(0.7, 0.3), vec2(0.5, 0.9), vec2(0.1, float_a))) == 1) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 223 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %162 %218 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %12 "cross2d(vf2;vf2;" + OpName %10 "a" + OpName %11 "b" + OpName %20 "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %16 "p" + OpName %17 "a" + OpName %18 "b" + OpName %19 "c" + OpName %39 "pab" + OpName %62 "param" + OpName %63 "param" + OpName %65 "pbc" + OpName %88 "param" + OpName %89 "param" + OpName %112 "pca" + OpName %135 "param" + OpName %136 "param" + OpName %159 "float_b" + OpName %162 "gl_FragCoord" + OpName %176 "buf_push" + OpMemberName %176 0 "injectionSwitch" + OpName %178 "" + OpName %186 "float_a" + OpName %189 "pos" + OpName %192 "buf0" + OpMemberName %192 0 "resolution" + OpName %194 "" + OpName %208 "param" + OpName %210 "param" + OpName %211 "param" + OpName %212 "param" + OpName %218 "_GLF_color" + OpDecorate %162 BuiltIn FragCoord + OpMemberDecorate %176 0 Offset 0 + OpDecorate %176 Block + OpMemberDecorate %192 0 Offset 0 + OpDecorate %192 Block + OpDecorate %194 DescriptorSet 0 + OpDecorate %194 Binding 0 + OpDecorate %218 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %6 %8 %8 + %14 = OpTypeInt 32 1 + %15 = OpTypeFunction %14 %8 %8 %8 %8 + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 0 + %24 = OpTypePointer Function %6 + %27 = OpConstant %22 1 + %91 = OpTypeBool + %93 = OpConstant %6 0 + %110 = OpConstant %14 0 + %156 = OpConstant %14 1 + %160 = OpTypeVector %6 4 + %161 = OpTypePointer Input %160 + %162 = OpVariable %161 Input + %163 = OpTypePointer Input %6 + %170 = OpConstantTrue %91 + %174 = OpConstant %6 0.400000006 + %176 = OpTypeStruct %7 + %177 = OpTypePointer PushConstant %176 + %178 = OpVariable %177 PushConstant + %179 = OpTypePointer PushConstant %6 + %184 = OpConstant %6 -1 + %192 = OpTypeStruct %7 + %193 = OpTypePointer Uniform %192 + %194 = OpVariable %193 Uniform + %195 = OpTypePointer Uniform %7 + %199 = OpConstant %6 0.699999988 + %200 = OpConstant %6 0.300000012 + %201 = OpConstantComposite %7 %199 %200 + %202 = OpConstant %6 0.5 + %203 = OpConstant %6 0.899999976 + %204 = OpConstantComposite %7 %202 %203 + %205 = OpConstant %6 0.100000001 + %217 = OpTypePointer Output %160 + %218 = OpVariable %217 Output + %219 = OpConstant %6 1 + %220 = OpConstantComposite %160 %219 %93 %93 %219 + %222 = OpConstantComposite %160 %93 %93 %93 %219 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %159 = OpVariable %24 Function + %167 = OpVariable %24 Function + %171 = OpVariable %24 Function + %186 = OpVariable %24 Function + %189 = OpVariable %8 Function + %208 = OpVariable %8 Function + %210 = OpVariable %8 Function + %211 = OpVariable %8 Function + %212 = OpVariable %8 Function + %164 = OpAccessChain %163 %162 %23 + %165 = OpLoad %6 %164 + %166 = OpFOrdGreaterThanEqual %91 %165 %93 + OpSelectionMerge %169 None + OpBranchConditional %166 %168 %183 + %168 = OpLabel + OpSelectionMerge %173 None + OpBranchConditional %170 %172 %175 + %172 = OpLabel + OpStore %171 %174 + OpBranch %173 + %175 = OpLabel + %180 = OpAccessChain %179 %178 %110 %27 + %181 = OpLoad %6 %180 + OpStore %171 %181 + OpBranch %173 + %173 = OpLabel + %182 = OpLoad %6 %171 + OpStore %167 %182 + OpBranch %169 + %183 = OpLabel + OpStore %167 %184 + OpBranch %169 + %169 = OpLabel + %185 = OpLoad %6 %167 + OpStore %159 %185 + %187 = OpLoad %6 %159 + %188 = OpExtInst %6 %1 FClamp %174 %174 %187 + OpStore %186 %188 + %190 = OpLoad %160 %162 + %191 = OpVectorShuffle %7 %190 %190 0 1 + %196 = OpAccessChain %195 %194 %110 + %197 = OpLoad %7 %196 + %198 = OpFDiv %7 %191 %197 + OpStore %189 %198 + %206 = OpLoad %6 %186 + %207 = OpCompositeConstruct %7 %205 %206 + %209 = OpLoad %7 %189 + OpStore %208 %209 + OpStore %210 %201 + OpStore %211 %204 + OpStore %212 %207 + %213 = OpFunctionCall %14 %20 %208 %210 %211 %212 + %214 = OpIEqual %91 %213 %156 + OpSelectionMerge %216 None + OpBranchConditional %214 %215 %221 + %215 = OpLabel + OpStore %218 %220 + OpBranch %216 + %221 = OpLabel + OpStore %218 %222 + OpBranch %216 + %216 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %6 None %9 + %10 = OpFunctionParameter %8 + %11 = OpFunctionParameter %8 + %13 = OpLabel + %25 = OpAccessChain %24 %10 %23 + %26 = OpLoad %6 %25 + %28 = OpAccessChain %24 %11 %27 + %29 = OpLoad %6 %28 + %30 = OpFMul %6 %26 %29 + %31 = OpAccessChain %24 %11 %23 + %32 = OpLoad %6 %31 + %33 = OpAccessChain %24 %10 %27 + %34 = OpLoad %6 %33 + %35 = OpFMul %6 %32 %34 + %36 = OpFSub %6 %30 %35 + OpReturnValue %36 + OpFunctionEnd + %20 = OpFunction %14 None %15 + %16 = OpFunctionParameter %8 + %17 = OpFunctionParameter %8 + %18 = OpFunctionParameter %8 + %19 = OpFunctionParameter %8 + %21 = OpLabel + %39 = OpVariable %24 Function + %62 = OpVariable %8 Function + %63 = OpVariable %8 Function + %65 = OpVariable %24 Function + %88 = OpVariable %8 Function + %89 = OpVariable %8 Function + %112 = OpVariable %24 Function + %135 = OpVariable %8 Function + %136 = OpVariable %8 Function + %40 = OpAccessChain %24 %16 %23 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %24 %17 %23 + %43 = OpLoad %6 %42 + %44 = OpFSub %6 %41 %43 + %45 = OpAccessChain %24 %16 %27 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %24 %17 %27 + %48 = OpLoad %6 %47 + %49 = OpFSub %6 %46 %48 + %50 = OpCompositeConstruct %7 %44 %49 + %51 = OpAccessChain %24 %18 %23 + %52 = OpLoad %6 %51 + %53 = OpAccessChain %24 %17 %23 + %54 = OpLoad %6 %53 + %55 = OpFSub %6 %52 %54 + %56 = OpAccessChain %24 %18 %27 + %57 = OpLoad %6 %56 + %58 = OpAccessChain %24 %17 %27 + %59 = OpLoad %6 %58 + %60 = OpFSub %6 %57 %59 + %61 = OpCompositeConstruct %7 %55 %60 + OpStore %62 %50 + OpStore %63 %61 + %64 = OpFunctionCall %6 %12 %62 %63 + OpStore %39 %64 + %66 = OpAccessChain %24 %16 %23 + %67 = OpLoad %6 %66 + %68 = OpAccessChain %24 %18 %23 + %69 = OpLoad %6 %68 + %70 = OpFSub %6 %67 %69 + %71 = OpAccessChain %24 %16 %27 + %72 = OpLoad %6 %71 + %73 = OpAccessChain %24 %18 %27 + %74 = OpLoad %6 %73 + %75 = OpFSub %6 %72 %74 + %76 = OpCompositeConstruct %7 %70 %75 + %77 = OpAccessChain %24 %19 %23 + %78 = OpLoad %6 %77 + %79 = OpAccessChain %24 %18 %23 + %80 = OpLoad %6 %79 + %81 = OpFSub %6 %78 %80 + %82 = OpAccessChain %24 %19 %27 + %83 = OpLoad %6 %82 + %84 = OpAccessChain %24 %18 %27 + %85 = OpLoad %6 %84 + %86 = OpFSub %6 %83 %85 + %87 = OpCompositeConstruct %7 %81 %86 + OpStore %88 %76 + OpStore %89 %87 + %90 = OpFunctionCall %6 %12 %88 %89 + OpStore %65 %90 + %92 = OpLoad %6 %39 + %94 = OpFOrdLessThan %91 %92 %93 + %95 = OpLoad %6 %65 + %96 = OpFOrdLessThan %91 %95 %93 + %97 = OpLogicalAnd %91 %94 %96 + %98 = OpLogicalNot %91 %97 + OpSelectionMerge %100 None + OpBranchConditional %98 %99 %100 + %99 = OpLabel + %101 = OpLoad %6 %39 + %102 = OpFOrdGreaterThanEqual %91 %101 %93 + %103 = OpLoad %6 %65 + %104 = OpFOrdGreaterThanEqual %91 %103 %93 + %105 = OpLogicalAnd %91 %102 %104 + OpBranch %100 + %100 = OpLabel + %106 = OpPhi %91 %97 %21 %105 %99 + %107 = OpLogicalNot %91 %106 + OpSelectionMerge %109 None + OpBranchConditional %107 %108 %109 + %108 = OpLabel + OpReturnValue %110 + %109 = OpLabel + %113 = OpAccessChain %24 %16 %23 + %114 = OpLoad %6 %113 + %115 = OpAccessChain %24 %19 %23 + %116 = OpLoad %6 %115 + %117 = OpFSub %6 %114 %116 + %118 = OpAccessChain %24 %16 %27 + %119 = OpLoad %6 %118 + %120 = OpAccessChain %24 %19 %27 + %121 = OpLoad %6 %120 + %122 = OpFSub %6 %119 %121 + %123 = OpCompositeConstruct %7 %117 %122 + %124 = OpAccessChain %24 %17 %23 + %125 = OpLoad %6 %124 + %126 = OpAccessChain %24 %19 %23 + %127 = OpLoad %6 %126 + %128 = OpFSub %6 %125 %127 + %129 = OpAccessChain %24 %17 %27 + %130 = OpLoad %6 %129 + %131 = OpAccessChain %24 %19 %27 + %132 = OpLoad %6 %131 + %133 = OpFSub %6 %130 %132 + %134 = OpCompositeConstruct %7 %128 %133 + OpStore %135 %123 + OpStore %136 %134 + %137 = OpFunctionCall %6 %12 %135 %136 + OpStore %112 %137 + %138 = OpLoad %6 %39 + %139 = OpFOrdLessThan %91 %138 %93 + %140 = OpLoad %6 %112 + %141 = OpFOrdLessThan %91 %140 %93 + %142 = OpLogicalAnd %91 %139 %141 + %143 = OpLogicalNot %91 %142 + OpSelectionMerge %145 None + OpBranchConditional %143 %144 %145 + %144 = OpLabel + %146 = OpLoad %6 %39 + %147 = OpFOrdGreaterThanEqual %91 %146 %93 + %148 = OpLoad %6 %112 + %149 = OpFOrdGreaterThanEqual %91 %148 %93 + %150 = OpLogicalAnd %91 %147 %149 + OpBranch %145 + %145 = OpLabel + %151 = OpPhi %91 %142 %109 %150 %144 + %152 = OpLogicalNot %91 %151 + OpSelectionMerge %154 None + OpBranchConditional %152 %153 %154 + %153 = OpLabel + OpReturnValue %110 + %154 = OpLabel + OpReturnValue %156 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_injectionSwitch AS push_constant +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if.amber b/vulkan/amber/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if.amber new file mode 100644 index 0000000..946faab --- /dev/null +++ b/vulkan/amber/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if.amber @@ -0,0 +1,771 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with nested for loop and always true if + +# The test passes because both shaders render the same image. + +# Optimized using spirv-opt with the following arguments: +# '--if-conversion' +# '--eliminate-local-multi-store' +# '--eliminate-dead-inserts' +# '--scalar-replacement=100' +# '--simplify-instructions' +# '--reduce-load-size' +# '--copy-propagate-arrays' +# '--private-to-local' +# '--ccp' +# '--redundancy-elimination' +# '--vector-dce' +# '--eliminate-local-multi-store' +# '--eliminate-dead-code-aggressive' +# '--private-to-local' +# '--convert-local-access-chains' +# '--if-conversion' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-code-aggressive' +# '--eliminate-local-single-block' +# '--if-conversion' +# spirv-opt commit hash: 230f363e6da32791f640b02205e0645cc67c3f1d + + + +SHADER vertex reference_vertex_shader PASSTHROUGH + +# reference_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# float cross2d(vec2 a, vec2 b) +# { +# return ((a.x) * (b.y) - (b.x) * (a.y)); +# } +# int pointInTriangle(vec2 p, vec2 a, vec2 b, vec2 c) +# { +# float pab = cross2d(vec2(p.x - a.x, p.y - a.y), vec2(b.x - a.x, b.y - a.y)); +# float pbc = cross2d(vec2(p.x - b.x, p.y - b.y), vec2(c.x - b.x, c.y - b.y)); +# if (!((pab < 0.0 && pbc < 0.0) || (pab >= 0.0 && pbc >= 0.0))) +# { +# return 0; +# } +# float pca = cross2d(vec2(p.x - c.x, p.y - c.y), vec2(a.x - c.x, a.y - c.y)); +# if (!((pab < 0.0 && pca < 0.0) || (pab >= 0.0 && pca >= 0.0))) +# { +# return 0; +# } +# return 1; +# } +# void main() +# { +# vec2 pos = gl_FragCoord.xy / resolution; +# if (pointInTriangle(pos, vec2(0.7, 0.3), vec2(0.5, 0.9), vec2(0.1, 0.4)) == 1) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +# } +# } +SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 236 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %162 %191 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %20 "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %16 "p" + OpName %17 "a" + OpName %18 "b" + OpName %19 "c" + OpName %62 "param" + OpName %63 "param" + OpName %88 "param" + OpName %89 "param" + OpName %135 "param" + OpName %136 "param" + OpName %162 "gl_FragCoord" + OpName %165 "buf0" + OpMemberName %165 0 "resolution" + OpName %167 "" + OpName %181 "param" + OpName %183 "param" + OpName %184 "param" + OpName %185 "param" + OpName %191 "_GLF_color" + OpDecorate %162 BuiltIn FragCoord + OpMemberDecorate %165 0 Offset 0 + OpDecorate %165 Block + OpDecorate %167 DescriptorSet 0 + OpDecorate %167 Binding 0 + OpDecorate %191 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %14 = OpTypeInt 32 1 + %15 = OpTypeFunction %14 %8 %8 %8 %8 + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 0 + %24 = OpTypePointer Function %6 + %27 = OpConstant %22 1 + %91 = OpTypeBool + %93 = OpConstant %6 0 + %110 = OpConstant %14 0 + %156 = OpConstant %14 1 + %160 = OpTypeVector %6 4 + %161 = OpTypePointer Input %160 + %162 = OpVariable %161 Input + %165 = OpTypeStruct %7 + %166 = OpTypePointer Uniform %165 + %167 = OpVariable %166 Uniform + %168 = OpTypePointer Uniform %7 + %172 = OpConstant %6 0.699999988 + %173 = OpConstant %6 0.300000012 + %174 = OpConstantComposite %7 %172 %173 + %175 = OpConstant %6 0.5 + %176 = OpConstant %6 0.899999976 + %177 = OpConstantComposite %7 %175 %176 + %178 = OpConstant %6 0.100000001 + %179 = OpConstant %6 0.400000006 + %180 = OpConstantComposite %7 %178 %179 + %190 = OpTypePointer Output %160 + %191 = OpVariable %190 Output + %192 = OpConstant %6 1 + %193 = OpConstantComposite %160 %192 %93 %93 %192 + %195 = OpConstantComposite %160 %93 %93 %93 %192 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %181 = OpVariable %8 Function + %183 = OpVariable %8 Function + %184 = OpVariable %8 Function + %185 = OpVariable %8 Function + %163 = OpLoad %160 %162 + %164 = OpVectorShuffle %7 %163 %163 0 1 + %169 = OpAccessChain %168 %167 %110 + %170 = OpLoad %7 %169 + %171 = OpFDiv %7 %164 %170 + OpStore %181 %171 + OpStore %183 %174 + OpStore %184 %177 + OpStore %185 %180 + %186 = OpFunctionCall %14 %20 %181 %183 %184 %185 + %187 = OpIEqual %91 %186 %156 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %194 + %188 = OpLabel + OpStore %191 %193 + OpBranch %189 + %194 = OpLabel + OpStore %191 %195 + OpBranch %189 + %189 = OpLabel + OpReturn + OpFunctionEnd + %20 = OpFunction %14 None %15 + %16 = OpFunctionParameter %8 + %17 = OpFunctionParameter %8 + %18 = OpFunctionParameter %8 + %19 = OpFunctionParameter %8 + %21 = OpLabel + %223 = OpVariable %24 Function + %210 = OpVariable %24 Function + %197 = OpVariable %24 Function + %62 = OpVariable %8 Function + %63 = OpVariable %8 Function + %88 = OpVariable %8 Function + %89 = OpVariable %8 Function + %135 = OpVariable %8 Function + %136 = OpVariable %8 Function + %40 = OpAccessChain %24 %16 %23 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %24 %17 %23 + %43 = OpLoad %6 %42 + %44 = OpFSub %6 %41 %43 + %45 = OpAccessChain %24 %16 %27 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %24 %17 %27 + %48 = OpLoad %6 %47 + %49 = OpFSub %6 %46 %48 + %50 = OpCompositeConstruct %7 %44 %49 + %51 = OpAccessChain %24 %18 %23 + %52 = OpLoad %6 %51 + %54 = OpLoad %6 %42 + %55 = OpFSub %6 %52 %54 + %56 = OpAccessChain %24 %18 %27 + %57 = OpLoad %6 %56 + %59 = OpLoad %6 %47 + %60 = OpFSub %6 %57 %59 + %61 = OpCompositeConstruct %7 %55 %60 + OpStore %62 %50 + OpStore %63 %61 + %199 = OpAccessChain %24 %62 %23 + %200 = OpLoad %6 %199 + %201 = OpAccessChain %24 %63 %27 + %202 = OpLoad %6 %201 + %203 = OpFMul %6 %200 %202 + %204 = OpAccessChain %24 %63 %23 + %205 = OpLoad %6 %204 + %206 = OpAccessChain %24 %62 %27 + %207 = OpLoad %6 %206 + %208 = OpFMul %6 %205 %207 + %209 = OpFSub %6 %203 %208 + OpStore %197 %209 + %67 = OpLoad %6 %40 + %69 = OpLoad %6 %51 + %70 = OpFSub %6 %67 %69 + %72 = OpLoad %6 %45 + %74 = OpLoad %6 %56 + %75 = OpFSub %6 %72 %74 + %76 = OpCompositeConstruct %7 %70 %75 + %77 = OpAccessChain %24 %19 %23 + %78 = OpLoad %6 %77 + %80 = OpLoad %6 %51 + %81 = OpFSub %6 %78 %80 + %82 = OpAccessChain %24 %19 %27 + %83 = OpLoad %6 %82 + %85 = OpLoad %6 %56 + %86 = OpFSub %6 %83 %85 + %87 = OpCompositeConstruct %7 %81 %86 + OpStore %88 %76 + OpStore %89 %87 + %212 = OpAccessChain %24 %88 %23 + %213 = OpLoad %6 %212 + %214 = OpAccessChain %24 %89 %27 + %215 = OpLoad %6 %214 + %216 = OpFMul %6 %213 %215 + %217 = OpAccessChain %24 %89 %23 + %218 = OpLoad %6 %217 + %219 = OpAccessChain %24 %88 %27 + %220 = OpLoad %6 %219 + %221 = OpFMul %6 %218 %220 + %222 = OpFSub %6 %216 %221 + OpStore %210 %222 + %94 = OpFOrdLessThan %91 %209 %93 + %96 = OpFOrdLessThan %91 %222 %93 + %97 = OpLogicalAnd %91 %94 %96 + %98 = OpLogicalNot %91 %97 + OpSelectionMerge %100 None + OpBranchConditional %98 %99 %100 + %99 = OpLabel + %102 = OpFOrdGreaterThanEqual %91 %209 %93 + %104 = OpFOrdGreaterThanEqual %91 %222 %93 + %105 = OpLogicalAnd %91 %102 %104 + OpBranch %100 + %100 = OpLabel + %106 = OpPhi %91 %97 %21 %105 %99 + %107 = OpLogicalNot %91 %106 + OpSelectionMerge %109 None + OpBranchConditional %107 %108 %109 + %108 = OpLabel + OpReturnValue %110 + %109 = OpLabel + %114 = OpLoad %6 %40 + %116 = OpLoad %6 %77 + %117 = OpFSub %6 %114 %116 + %119 = OpLoad %6 %45 + %121 = OpLoad %6 %82 + %122 = OpFSub %6 %119 %121 + %123 = OpCompositeConstruct %7 %117 %122 + %125 = OpLoad %6 %42 + %127 = OpLoad %6 %77 + %128 = OpFSub %6 %125 %127 + %130 = OpLoad %6 %47 + %132 = OpLoad %6 %82 + %133 = OpFSub %6 %130 %132 + %134 = OpCompositeConstruct %7 %128 %133 + OpStore %135 %123 + OpStore %136 %134 + %225 = OpAccessChain %24 %135 %23 + %226 = OpLoad %6 %225 + %227 = OpAccessChain %24 %136 %27 + %228 = OpLoad %6 %227 + %229 = OpFMul %6 %226 %228 + %230 = OpAccessChain %24 %136 %23 + %231 = OpLoad %6 %230 + %232 = OpAccessChain %24 %135 %27 + %233 = OpLoad %6 %232 + %234 = OpFMul %6 %231 %233 + %235 = OpFSub %6 %229 %234 + OpStore %223 %235 + %141 = OpFOrdLessThan %91 %235 %93 + %142 = OpLogicalAnd %91 %94 %141 + %143 = OpLogicalNot %91 %142 + OpSelectionMerge %145 None + OpBranchConditional %143 %144 %145 + %144 = OpLabel + %147 = OpFOrdGreaterThanEqual %91 %209 %93 + %149 = OpFOrdGreaterThanEqual %91 %235 %93 + %150 = OpLogicalAnd %91 %147 %149 + OpBranch %145 + %145 = OpLabel + %151 = OpPhi %91 %142 %109 %150 %144 + %152 = OpLogicalNot %91 %151 + OpSelectionMerge %154 None + OpBranchConditional %152 %153 %154 + %153 = OpLabel + OpReturnValue %110 + %154 = OpLabel + OpReturnValue %156 + OpFunctionEnd +END + +# uniforms for reference + +# resolution +BUFFER reference_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END + +BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics reference_pipeline + ATTACH reference_vertex_shader + ATTACH reference_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER reference_framebuffer AS color LOCATION 0 + BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR reference_pipeline 0 0 0 255 + +CLEAR reference_pipeline +RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 resolution; +# }; +# layout(set = 0, binding = 1) uniform buf1 +# { +# vec2 injectionSwitch; // x == 0.0, y == 1.0 +# }; +# +# void func() +# { +# vec4 vec4_a = vec4(1.0, 1.0, 1.0, 1.0); +# // Iterates once. +# for (int int_i = 0; int_i < int(injectionSwitch.y); int_i++) +# { +# // _GLF_color == 1.0, 1.0, 1.0, 1.0 +# _GLF_color = vec4_a; +# // Iterates once. +# for (int int_j = 0; int_j < int(injectionSwitch.y); int_j++) +# { +# // _GLF_color == 1.0, 1.0, 1.0, 1.0 +# _GLF_color = vec4_a; +# } +# } +# } +# +# float cross2d(vec2 a, vec2 b) +# { +# return ((a.x) * (b.y) - (b.x) * (a.y)); +# } +# int pointInTriangle(vec2 p, vec2 a, vec2 b, vec2 c) +# { +# float pab = cross2d(vec2(p.x - a.x, p.y - a.y), vec2(b.x - a.x, b.y - a.y)); +# float pbc = cross2d(vec2(p.x - b.x, p.y - b.y), vec2(c.x - b.x, c.y - b.y)); +# if (!((pab < 0.0 && pbc < 0.0) || (pab >= 0.0 && pbc >= 0.0))) +# { +# func(); +# return 0; +# } +# float pca = cross2d(vec2(p.x - c.x, p.y - c.y), vec2(a.x - c.x, a.y - c.y)); +# if (!((pab < 0.0 && pca < 0.0) || (pab >= 0.0 && pca >= 0.0))) +# { +# return 0; +# } +# return 1; +# } +# void main() +# { +# vec2 pos = gl_FragCoord.xy / resolution; +# if (pointInTriangle(pos, vec2(0.7, 0.3), vec2(0.5, 0.9), vec2(0.1, 0.4)) == 1) +# { +# // Always true. +# if ((injectionSwitch.y >= injectionSwitch.x)) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# } +# else +# { +# _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 307 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %50 %204 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %22 "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %18 "p" + OpName %19 "a" + OpName %20 "b" + OpName %21 "c" + OpName %38 "buf1" + OpMemberName %38 0 "injectionSwitch" + OpName %40 "" + OpName %50 "_GLF_color" + OpName %107 "param" + OpName %108 "param" + OpName %133 "param" + OpName %134 "param" + OpName %179 "param" + OpName %180 "param" + OpName %204 "gl_FragCoord" + OpName %207 "buf0" + OpMemberName %207 0 "resolution" + OpName %209 "" + OpName %223 "param" + OpName %225 "param" + OpName %226 "param" + OpName %227 "param" + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 1 + OpDecorate %50 Location 0 + OpDecorate %204 BuiltIn FragCoord + OpMemberDecorate %207 0 Offset 0 + OpDecorate %207 Block + OpDecorate %209 DescriptorSet 0 + OpDecorate %209 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %8 = OpTypeFloat 32 + %9 = OpTypeVector %8 2 + %10 = OpTypePointer Function %9 + %16 = OpTypeInt 32 1 + %17 = OpTypeFunction %16 %10 %10 %10 %10 + %24 = OpTypeVector %8 4 + %27 = OpConstant %8 1 + %28 = OpConstantComposite %24 %27 %27 %27 %27 + %31 = OpConstant %16 0 + %38 = OpTypeStruct %9 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %41 = OpTypeInt 32 0 + %42 = OpConstant %41 1 + %43 = OpTypePointer Uniform %8 + %47 = OpTypeBool + %49 = OpTypePointer Output %24 + %50 = OpVariable %49 Output + %65 = OpConstant %16 1 + %69 = OpConstant %41 0 + %70 = OpTypePointer Function %8 + %137 = OpConstant %8 0 + %203 = OpTypePointer Input %24 + %204 = OpVariable %203 Input + %207 = OpTypeStruct %9 + %208 = OpTypePointer Uniform %207 + %209 = OpVariable %208 Uniform + %210 = OpTypePointer Uniform %9 + %214 = OpConstant %8 0.699999988 + %215 = OpConstant %8 0.300000012 + %216 = OpConstantComposite %9 %214 %215 + %217 = OpConstant %8 0.5 + %218 = OpConstant %8 0.899999976 + %219 = OpConstantComposite %9 %217 %218 + %220 = OpConstant %8 0.100000001 + %221 = OpConstant %8 0.400000006 + %222 = OpConstantComposite %9 %220 %221 + %239 = OpConstantComposite %24 %27 %137 %137 %27 + %241 = OpConstantComposite %24 %137 %137 %137 %27 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %223 = OpVariable %10 Function + %225 = OpVariable %10 Function + %226 = OpVariable %10 Function + %227 = OpVariable %10 Function + %205 = OpLoad %24 %204 + %206 = OpVectorShuffle %9 %205 %205 0 1 + %211 = OpAccessChain %210 %209 %31 + %212 = OpLoad %9 %211 + %213 = OpFDiv %9 %206 %212 + OpStore %223 %213 + OpStore %225 %216 + OpStore %226 %219 + OpStore %227 %222 + %228 = OpFunctionCall %16 %22 %223 %225 %226 %227 + %229 = OpIEqual %47 %228 %65 + OpSelectionMerge %231 None + OpBranchConditional %229 %230 %240 + %230 = OpLabel + %232 = OpAccessChain %43 %40 %31 %42 + %233 = OpLoad %8 %232 + %234 = OpAccessChain %43 %40 %31 %69 + %235 = OpLoad %8 %234 + %236 = OpFOrdGreaterThanEqual %47 %233 %235 + OpSelectionMerge %238 None + OpBranchConditional %236 %237 %238 + %237 = OpLabel + OpStore %50 %239 + OpBranch %238 + %238 = OpLabel + OpBranch %231 + %240 = OpLabel + OpStore %50 %241 + OpBranch %231 + %231 = OpLabel + OpReturn + OpFunctionEnd + %22 = OpFunction %16 None %17 + %18 = OpFunctionParameter %10 + %19 = OpFunctionParameter %10 + %20 = OpFunctionParameter %10 + %21 = OpFunctionParameter %10 + %23 = OpLabel + %294 = OpVariable %70 Function + %261 = OpVariable %70 Function + %248 = OpVariable %70 Function + %107 = OpVariable %10 Function + %108 = OpVariable %10 Function + %133 = OpVariable %10 Function + %134 = OpVariable %10 Function + %179 = OpVariable %10 Function + %180 = OpVariable %10 Function + %85 = OpAccessChain %70 %18 %69 + %86 = OpLoad %8 %85 + %87 = OpAccessChain %70 %19 %69 + %88 = OpLoad %8 %87 + %89 = OpFSub %8 %86 %88 + %90 = OpAccessChain %70 %18 %42 + %91 = OpLoad %8 %90 + %92 = OpAccessChain %70 %19 %42 + %93 = OpLoad %8 %92 + %94 = OpFSub %8 %91 %93 + %95 = OpCompositeConstruct %9 %89 %94 + %96 = OpAccessChain %70 %20 %69 + %97 = OpLoad %8 %96 + %99 = OpLoad %8 %87 + %100 = OpFSub %8 %97 %99 + %101 = OpAccessChain %70 %20 %42 + %102 = OpLoad %8 %101 + %104 = OpLoad %8 %92 + %105 = OpFSub %8 %102 %104 + %106 = OpCompositeConstruct %9 %100 %105 + OpStore %107 %95 + OpStore %108 %106 + %250 = OpAccessChain %70 %107 %69 + %251 = OpLoad %8 %250 + %252 = OpAccessChain %70 %108 %42 + %253 = OpLoad %8 %252 + %254 = OpFMul %8 %251 %253 + %255 = OpAccessChain %70 %108 %69 + %256 = OpLoad %8 %255 + %257 = OpAccessChain %70 %107 %42 + %258 = OpLoad %8 %257 + %259 = OpFMul %8 %256 %258 + %260 = OpFSub %8 %254 %259 + OpStore %248 %260 + %112 = OpLoad %8 %85 + %114 = OpLoad %8 %96 + %115 = OpFSub %8 %112 %114 + %117 = OpLoad %8 %90 + %119 = OpLoad %8 %101 + %120 = OpFSub %8 %117 %119 + %121 = OpCompositeConstruct %9 %115 %120 + %122 = OpAccessChain %70 %21 %69 + %123 = OpLoad %8 %122 + %125 = OpLoad %8 %96 + %126 = OpFSub %8 %123 %125 + %127 = OpAccessChain %70 %21 %42 + %128 = OpLoad %8 %127 + %130 = OpLoad %8 %101 + %131 = OpFSub %8 %128 %130 + %132 = OpCompositeConstruct %9 %126 %131 + OpStore %133 %121 + OpStore %134 %132 + %263 = OpAccessChain %70 %133 %69 + %264 = OpLoad %8 %263 + %265 = OpAccessChain %70 %134 %42 + %266 = OpLoad %8 %265 + %267 = OpFMul %8 %264 %266 + %268 = OpAccessChain %70 %134 %69 + %269 = OpLoad %8 %268 + %270 = OpAccessChain %70 %133 %42 + %271 = OpLoad %8 %270 + %272 = OpFMul %8 %269 %271 + %273 = OpFSub %8 %267 %272 + OpStore %261 %273 + %138 = OpFOrdLessThan %47 %260 %137 + %140 = OpFOrdLessThan %47 %273 %137 + %141 = OpLogicalAnd %47 %138 %140 + %142 = OpLogicalNot %47 %141 + OpSelectionMerge %144 None + OpBranchConditional %142 %143 %144 + %143 = OpLabel + %146 = OpFOrdGreaterThanEqual %47 %260 %137 + %148 = OpFOrdGreaterThanEqual %47 %273 %137 + %149 = OpLogicalAnd %47 %146 %148 + OpBranch %144 + %144 = OpLabel + %150 = OpPhi %47 %141 %23 %149 %143 + %151 = OpLogicalNot %47 %150 + OpSelectionMerge %153 None + OpBranchConditional %151 %152 %153 + %152 = OpLabel + OpBranch %275 + %275 = OpLabel + %276 = OpPhi %16 %31 %152 %292 %291 + OpLoopMerge %293 %291 None + OpBranch %277 + %277 = OpLabel + %278 = OpAccessChain %43 %40 %31 %42 + %279 = OpLoad %8 %278 + %280 = OpConvertFToS %16 %279 + %281 = OpSLessThan %47 %276 %280 + OpBranchConditional %281 %282 %293 + %282 = OpLabel + OpStore %50 %28 + OpBranch %283 + %283 = OpLabel + %284 = OpPhi %16 %31 %282 %289 %288 + OpLoopMerge %290 %288 None + OpBranch %285 + %285 = OpLabel + %286 = OpSLessThan %47 %284 %280 + OpBranchConditional %286 %287 %290 + %287 = OpLabel + OpStore %50 %28 + OpBranch %288 + %288 = OpLabel + %289 = OpIAdd %16 %284 %65 + OpBranch %283 + %290 = OpLabel + OpBranch %291 + %291 = OpLabel + %292 = OpIAdd %16 %276 %65 + OpBranch %275 + %293 = OpLabel + OpReturnValue %31 + %153 = OpLabel + %158 = OpLoad %8 %85 + %160 = OpLoad %8 %122 + %161 = OpFSub %8 %158 %160 + %163 = OpLoad %8 %90 + %165 = OpLoad %8 %127 + %166 = OpFSub %8 %163 %165 + %167 = OpCompositeConstruct %9 %161 %166 + %169 = OpLoad %8 %87 + %171 = OpLoad %8 %122 + %172 = OpFSub %8 %169 %171 + %174 = OpLoad %8 %92 + %176 = OpLoad %8 %127 + %177 = OpFSub %8 %174 %176 + %178 = OpCompositeConstruct %9 %172 %177 + OpStore %179 %167 + OpStore %180 %178 + %296 = OpAccessChain %70 %179 %69 + %297 = OpLoad %8 %296 + %298 = OpAccessChain %70 %180 %42 + %299 = OpLoad %8 %298 + %300 = OpFMul %8 %297 %299 + %301 = OpAccessChain %70 %180 %69 + %302 = OpLoad %8 %301 + %303 = OpAccessChain %70 %179 %42 + %304 = OpLoad %8 %303 + %305 = OpFMul %8 %302 %304 + %306 = OpFSub %8 %300 %305 + OpStore %294 %306 + %185 = OpFOrdLessThan %47 %306 %137 + %186 = OpLogicalAnd %47 %138 %185 + %187 = OpLogicalNot %47 %186 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %191 = OpFOrdGreaterThanEqual %47 %260 %137 + %193 = OpFOrdGreaterThanEqual %47 %306 %137 + %194 = OpLogicalAnd %47 %191 %193 + OpBranch %189 + %189 = OpLabel + %195 = OpPhi %47 %186 %153 %194 %188 + %196 = OpLogicalNot %47 %195 + OpSelectionMerge %198 None + OpBranchConditional %196 %197 %198 + %197 = OpLabel + OpReturnValue %31 + %198 = OpLabel + OpReturnValue %65 + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 256.0 256.0 +END +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005 diff --git a/vulkan/amber/graphicsfuzz/struct-and-unreachable-infinite-loop.amber b/vulkan/amber/graphicsfuzz/struct-and-unreachable-infinite-loop.amber new file mode 100644 index 0000000..dd7af73 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/struct-and-unreachable-infinite-loop.amber @@ -0,0 +1,207 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: Fragment shader with struct and unreachable infinite loop + +# The test passes because 'tree[0].rightIndex' is set to 1, so that the infinite loop is not reached and the output colour red is written + +# Optimized using spirv-opt with the following arguments: +# '--redundancy-elimination' +# '--eliminate-dead-inserts' +# '--combine-access-chains' +# '--vector-dce' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--merge-return' +# '--private-to-local' +# '--simplify-instructions' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-local-multi-store' +# '--eliminate-local-single-store' +# '--eliminate-local-single-block' +# '--simplify-instructions' +# '--copy-propagate-arrays' +# '--vector-dce' +# '--simplify-instructions' +# '--reduce-load-size' +# '--vector-dce' +# '--eliminate-dead-branches' +# '--merge-return' +# '--redundancy-elimination' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--private-to-local' +# '--vector-dce' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--private-to-local' +# '--private-to-local' +# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# struct BST { +# int data; +# int leftIndex; +# int rightIndex; +# } ; +# +# BST tree[10]; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void makeTreeNode(inout BST tree) +# { +# tree.rightIndex = 1; +# } +# void main() +# { +# makeTreeNode(tree[0]); +# if (tree[0].rightIndex == 0) { +# while(true) +# { +# } +# } +# +# _GLF_color = vec4(float(tree[0].rightIndex), 0.0, 0.0, 1.0); +# +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "BST" + OpMemberName %7 0 "data" + OpMemberName %7 1 "leftIndex" + OpMemberName %7 2 "rightIndex" + OpName %11 "makeTreeNode(struct-BST-i1-i1-i11;" + OpName %10 "tree" + OpName %21 "tree" + OpName %23 "param" + OpName %46 "_GLF_color" + OpMemberDecorate %7 0 RelaxedPrecision + OpMemberDecorate %7 1 RelaxedPrecision + OpMemberDecorate %7 2 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %46 Location 0 + OpDecorate %48 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypeFunction %2 %8 + %13 = OpConstant %6 2 + %14 = OpConstant %6 1 + %15 = OpTypePointer Function %6 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 10 + %19 = OpTypeArray %7 %18 + %20 = OpTypePointer Private %19 + %22 = OpConstant %6 0 + %24 = OpTypePointer Private %7 + %30 = OpTypePointer Private %6 + %33 = OpTypeBool + %42 = OpConstantTrue %33 + %43 = OpTypeFloat 32 + %44 = OpTypeVector %43 4 + %45 = OpTypePointer Output %44 + %46 = OpVariable %45 Output + %50 = OpConstant %43 0 + %51 = OpConstant %43 1 + %53 = OpTypePointer Function %19 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %21 = OpVariable %53 Function + %23 = OpVariable %8 Function + %54 = OpLoad %19 %21 + %26 = OpCompositeExtract %7 %54 0 + OpStore %23 %26 + %27 = OpFunctionCall %2 %11 %23 + %28 = OpLoad %7 %23 + %55 = OpLoad %19 %21 + %56 = OpCompositeInsert %19 %28 %55 0 + OpStore %21 %56 + %31 = OpAccessChain %15 %21 %22 %13 + %57 = OpLoad %19 %21 + %32 = OpCompositeExtract %6 %57 0 2 + %34 = OpIEqual %33 %32 %22 + OpSelectionMerge %36 None + OpBranchConditional %34 %35 %36 + %35 = OpLabel + OpBranch %37 + %37 = OpLabel + OpLoopMerge %39 %37 None + OpBranch %37 + %39 = OpLabel + OpUnreachable + %36 = OpLabel + %58 = OpLoad %19 %21 + %48 = OpCompositeExtract %6 %58 0 2 + %49 = OpConvertSToF %43 %48 + %52 = OpCompositeConstruct %44 %49 %50 %50 %51 + OpStore %46 %52 + OpReturn + OpFunctionEnd + %11 = OpFunction %2 None %9 + %10 = OpFunctionParameter %8 + %12 = OpLabel + %16 = OpAccessChain %15 %10 %13 + OpStore %16 %14 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/struct-array-data-as-loop-iterator.amber b/vulkan/amber/graphicsfuzz/struct-array-data-as-loop-iterator.amber new file mode 100644 index 0000000..1c635e9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/struct-array-data-as-loop-iterator.amber @@ -0,0 +1,284 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader that uses struct array data for loop iterator value + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: ab7ac60f14ae66006bed5c989a2cfd4c4881704c + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float zero; +# }; +# +# struct S +# { +# int a; +# }; +# +# // Always returns given parameter value. +# int func(int x) +# { +# S arr[9]; +# arr[0].a = 1; +# +# for (int i = 0; i < 1 + int(zero); i++) +# { +# // Always true. +# if (zero < 1.0) +# return x; +# +# i = arr[i].a; +# } +# +# return -1; +# } +# +# void main() +# { +# for (int i = 0; i < 2; i++) +# { +# switch (func(i)) +# { +# case -1: +# return; +# case 0: +# if (func(5) == 5) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# return; +# } +# } +# _GLF_color = vec4(0); // Should never be reached. +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 204 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %79 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %12 "S" + OpMemberName %12 0 "a" + OpName %29 "buf0" + OpMemberName %29 0 "zero" + OpName %31 "" + OpName %79 "_GLF_color" + OpMemberDecorate %29 0 Offset 0 + OpDecorate %29 Block + OpDecorate %31 DescriptorSet 0 + OpDecorate %31 Binding 0 + OpDecorate %79 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %12 = OpTypeStruct %6 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 9 + %15 = OpTypeArray %12 %14 + %16 = OpTypePointer Function %15 + %18 = OpConstant %6 0 + %19 = OpConstant %6 1 + %28 = OpTypeFloat 32 + %29 = OpTypeStruct %28 + %30 = OpTypePointer Uniform %29 + %31 = OpVariable %30 Uniform + %32 = OpTypePointer Uniform %28 + %37 = OpTypeBool + %41 = OpConstant %28 1 + %52 = OpConstant %6 -1 + %62 = OpConstant %6 2 + %71 = OpConstant %6 5 + %77 = OpTypeVector %28 4 + %78 = OpTypePointer Output %77 + %79 = OpVariable %78 Output + %80 = OpConstant %28 0 + %81 = OpConstantComposite %77 %41 %80 %80 %41 + %83 = OpConstantComposite %77 %80 %80 %80 %80 + %92 = OpConstantFalse %37 + %95 = OpConstantTrue %37 + %188 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %144 = OpVariable %16 Function + %109 = OpVariable %16 Function + OpBranch %89 + %89 = OpLabel + OpLoopMerge %88 %91 None + OpBranch %56 + %56 = OpLabel + %186 = OpPhi %6 %188 %89 %182 %59 + %177 = OpPhi %6 %18 %89 %87 %59 + %63 = OpSLessThan %37 %177 %62 + OpLoopMerge %58 %59 None + OpBranchConditional %63 %57 %58 + %57 = OpLabel + OpBranch %112 + %112 = OpLabel + %116 = OpAccessChain %7 %109 %18 %18 + OpStore %116 %19 + OpLoopMerge %113 %114 None + OpBranch %117 + %117 = OpLabel + %178 = OpPhi %6 %18 %112 %138 %119 + %122 = OpAccessChain %32 %31 %18 + %123 = OpLoad %28 %122 + %124 = OpConvertFToS %6 %123 + %125 = OpIAdd %6 %19 %124 + %126 = OpSLessThan %37 %178 %125 + OpLoopMerge %118 %119 None + OpBranchConditional %126 %127 %118 + %127 = OpLabel + %130 = OpFOrdLessThan %37 %123 %41 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %131 + %132 = OpLabel + OpBranch %118 + %131 = OpLabel + %135 = OpAccessChain %7 %109 %178 %18 + %136 = OpLoad %6 %135 + OpBranch %119 + %119 = OpLabel + %138 = OpIAdd %6 %136 %19 + OpBranch %117 + %118 = OpLabel + %183 = OpPhi %6 %186 %117 %177 %132 + %179 = OpPhi %37 %92 %117 %95 %132 + OpSelectionMerge %140 None + OpBranchConditional %179 %113 %140 + %140 = OpLabel + OpBranch %113 + %114 = OpLabel + OpBranch %112 + %113 = OpLabel + %182 = OpPhi %6 %183 %118 %52 %140 + OpSelectionMerge %69 None + OpSwitch %182 %69 -1 %67 0 %68 + %68 = OpLabel + OpBranch %147 + %147 = OpLabel + %151 = OpAccessChain %7 %144 %18 %18 + OpStore %151 %19 + OpLoopMerge %148 %149 None + OpBranch %152 + %152 = OpLabel + %189 = OpPhi %6 %18 %147 %173 %154 + %161 = OpSLessThan %37 %189 %125 + OpLoopMerge %153 %154 None + OpBranchConditional %161 %162 %153 + %162 = OpLabel + %165 = OpFOrdLessThan %37 %123 %41 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %166 + %167 = OpLabel + OpBranch %153 + %166 = OpLabel + %170 = OpAccessChain %7 %144 %189 %18 + %171 = OpLoad %6 %170 + OpBranch %154 + %154 = OpLabel + %173 = OpIAdd %6 %171 %19 + OpBranch %152 + %153 = OpLabel + %194 = OpPhi %6 %188 %152 %71 %167 + %190 = OpPhi %37 %92 %152 %95 %167 + OpSelectionMerge %175 None + OpBranchConditional %190 %148 %175 + %175 = OpLabel + OpBranch %148 + %149 = OpLabel + OpBranch %147 + %148 = OpLabel + %193 = OpPhi %6 %194 %153 %52 %175 + %74 = OpIEqual %37 %193 %71 + OpSelectionMerge %76 None + OpBranchConditional %74 %75 %82 + %82 = OpLabel + OpStore %79 %83 + OpBranch %76 + %75 = OpLabel + OpStore %79 %81 + OpBranch %76 + %76 = OpLabel + OpBranch %58 + %67 = OpLabel + OpBranch %58 + %69 = OpLabel + OpBranch %59 + %59 = OpLabel + %87 = OpIAdd %6 %177 %19 + OpBranch %56 + %58 = OpLabel + %203 = OpPhi %37 %92 %56 %95 %67 %95 %76 + OpSelectionMerge %96 None + OpBranchConditional %203 %88 %96 + %96 = OpLabel + OpStore %79 %83 + OpBranch %88 + %91 = OpLabel + OpBranch %89 + %88 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/struct-array-index.amber b/vulkan/amber/graphicsfuzz/struct-array-index.amber new file mode 100644 index 0000000..aa58b4a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/struct-array-index.amber @@ -0,0 +1,198 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: A fragment shader with struct array and always true if + +# The test passes because the shader always writes the color red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; // x == 0.0, y == 1.0 +# }; +# struct struct_base +# { +# int data; +# int leftIndex; +# int rightIndex; +# }; +# +# struct_base struct_array[3] = struct_base[3](struct_base(1, 1, 1), struct_base(1, 1, 1), struct_base(1, 1, 1)); +# +# +# void main() +# { +# int index = 1; +# struct_array[1].rightIndex = 1; +# // Always true. +# if (struct_array[1].leftIndex == 1) +# { +# // index == 1 +# index = struct_array[int(injectionSwitch.x)].rightIndex; +# } +# else +# { +# // index == 1 +# index = struct_array[int(injectionSwitch.y)].leftIndex; +# } +# // Always true. +# if(struct_array[1].leftIndex == 1) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(1.0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 60 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %54 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %7 "struct_base" + OpMemberName %7 0 "data" + OpMemberName %7 1 "leftIndex" + OpMemberName %7 2 "rightIndex" + OpName %12 "struct_array" + OpName %17 "index" + OpName %29 "buf0" + OpMemberName %29 0 "injectionSwitch" + OpName %31 "" + OpName %54 "_GLF_color" + OpMemberDecorate %29 0 Offset 0 + OpDecorate %29 Block + OpDecorate %31 DescriptorSet 0 + OpDecorate %31 Binding 0 + OpDecorate %54 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypeInt 32 0 + %9 = OpConstant %8 3 + %10 = OpTypeArray %7 %9 + %11 = OpTypePointer Private %10 + %12 = OpVariable %11 Private + %13 = OpConstant %6 1 + %14 = OpConstantComposite %7 %13 %13 %13 + %15 = OpConstantComposite %10 %14 %14 %14 + %16 = OpTypePointer Function %6 + %18 = OpConstant %6 2 + %19 = OpTypePointer Private %6 + %23 = OpTypeBool + %27 = OpTypeFloat 32 + %28 = OpTypeVector %27 2 + %29 = OpTypeStruct %28 + %30 = OpTypePointer Uniform %29 + %31 = OpVariable %30 Uniform + %32 = OpConstant %6 0 + %33 = OpConstant %8 0 + %34 = OpTypePointer Uniform %27 + %41 = OpConstant %8 1 + %52 = OpTypeVector %27 4 + %53 = OpTypePointer Output %52 + %54 = OpVariable %53 Output + %55 = OpConstant %27 1 + %56 = OpConstant %27 0 + %57 = OpConstantComposite %52 %55 %56 %56 %55 + %59 = OpConstantComposite %52 %55 %55 %55 %55 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %17 = OpVariable %16 Function + OpStore %12 %15 + OpStore %17 %13 + %20 = OpAccessChain %19 %12 %13 %18 + OpStore %20 %13 + %21 = OpAccessChain %19 %12 %13 %13 + %22 = OpLoad %6 %21 + %24 = OpIEqual %23 %22 %13 + OpSelectionMerge %26 None + OpBranchConditional %24 %25 %40 + %25 = OpLabel + %35 = OpAccessChain %34 %31 %32 %33 + %36 = OpLoad %27 %35 + %37 = OpConvertFToS %6 %36 + %38 = OpAccessChain %19 %12 %37 %18 + %39 = OpLoad %6 %38 + OpStore %17 %39 + OpBranch %26 + %40 = OpLabel + %42 = OpAccessChain %34 %31 %32 %41 + %43 = OpLoad %27 %42 + %44 = OpConvertFToS %6 %43 + %45 = OpAccessChain %19 %12 %44 %13 + %46 = OpLoad %6 %45 + OpStore %17 %46 + OpBranch %26 + %26 = OpLabel + %47 = OpAccessChain %19 %12 %13 %13 + %48 = OpLoad %6 %47 + %49 = OpIEqual %23 %48 %13 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %58 + %50 = OpLabel + OpStore %54 %57 + OpBranch %51 + %58 = OpLabel + OpStore %54 %59 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 STD140 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/struct-controlled-loop.amber b/vulkan/amber/graphicsfuzz/struct-controlled-loop.amber new file mode 100644 index 0000000..29b5e5a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/struct-controlled-loop.amber @@ -0,0 +1,207 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: Shader with loop controlled by struct + +# The test passes because 'sums[0]' ends up being 0, so that the colour that is written is guaranteed to be red + +# Optimized using spirv-opt with the following arguments: +# '--private-to-local' +# '--eliminate-dead-branches' +# '--merge-return' +# '--reduce-load-size' +# '--eliminate-dead-code-aggressive' +# '--ccp' +# '--eliminate-dead-code-aggressive' +# '--if-conversion' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-store' +# '--ccp' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-store' +# '--eliminate-dead-inserts' +# '--eliminate-local-multi-store' +# '--copy-propagate-arrays' +# '--combine-access-chains' +# '--redundancy-elimination' +# '--if-conversion' +# '--eliminate-local-multi-store' +# '--eliminate-dead-code-aggressive' +# spirv-opt commit hash: f1e5cd73f658abcc23ee96d78f2dc27c4b7028c1 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# struct S { +# int f0; +# bvec3 f1; +# } ; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float sums[9]; +# for( +# S ll = S(0, bvec3(true)); +# ll.f0 != int((injectionSwitch.y)); +# ll.f0 ++ +# ) +# { +# sums[0] = 0.0; +# } +# int overall_region = 0; +# _GLF_color = vec4(1.0, vec2(sums[overall_region]), 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %50 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "S" + OpMemberName %9 0 "f0" + OpMemberName %9 1 "f1" + OpName %11 "ll" + OpName %26 "buf0" + OpMemberName %26 0 "injectionSwitch" + OpName %28 "" + OpName %39 "sums" + OpName %50 "_GLF_color" + OpMemberDecorate %9 0 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpMemberDecorate %26 0 Offset 0 + OpDecorate %26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 0 + OpDecorate %44 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %50 Location 0 + OpDecorate %59 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeBool + %8 = OpTypeVector %7 3 + %9 = OpTypeStruct %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpConstant %6 0 + %13 = OpConstantTrue %7 + %14 = OpConstantComposite %8 %13 %13 %13 + %15 = OpConstantComposite %9 %12 %14 + %24 = OpTypeFloat 32 + %25 = OpTypeVector %24 2 + %26 = OpTypeStruct %25 + %27 = OpTypePointer Uniform %26 + %28 = OpVariable %27 Uniform + %29 = OpTypeInt 32 0 + %30 = OpConstant %29 1 + %31 = OpTypePointer Uniform %24 + %36 = OpConstant %29 9 + %37 = OpTypeArray %24 %36 + %38 = OpTypePointer Function %37 + %40 = OpConstant %24 0 + %41 = OpTypePointer Function %24 + %45 = OpConstant %6 1 + %48 = OpTypeVector %24 4 + %49 = OpTypePointer Output %48 + %50 = OpVariable %49 Output + %51 = OpConstant %24 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %39 = OpVariable %38 Function + OpStore %11 %15 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %59 = OpLoad %9 %11 + %23 = OpCompositeExtract %6 %59 0 + %32 = OpAccessChain %31 %28 %12 %30 + %33 = OpLoad %24 %32 + %34 = OpConvertFToS %6 %33 + %35 = OpINotEqual %7 %23 %34 + OpBranchConditional %35 %17 %18 + %17 = OpLabel + %42 = OpAccessChain %41 %39 %12 + OpStore %42 %40 + OpBranch %19 + %19 = OpLabel + %60 = OpLoad %9 %11 + %44 = OpCompositeExtract %6 %60 0 + %46 = OpIAdd %6 %44 %45 + %61 = OpLoad %9 %11 + %62 = OpCompositeInsert %9 %46 %61 0 + OpStore %11 %62 + OpBranch %16 + %18 = OpLabel + %53 = OpAccessChain %41 %39 %12 + %54 = OpLoad %24 %53 + %55 = OpCompositeConstruct %25 %54 %54 + %56 = OpCompositeExtract %24 %55 0 + %57 = OpCompositeExtract %24 %55 1 + %58 = OpCompositeConstruct %48 %51 %56 %57 %51 + OpStore %50 %58 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/struct-used-as-temporary.amber b/vulkan/amber/graphicsfuzz/struct-used-as-temporary.amber new file mode 100644 index 0000000..d5f6679 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/struct-used-as-temporary.amber @@ -0,0 +1,117 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug reduced by GraphicsFuzz. + +# Short description: A fragment shader that uses a temporary struct variable + +# The test passes because the fragment shader is provided with a red vec4 +# as input, and copies this through to the output (via a struct) + +# The following GLSL, produced by SPIRV-Cross (and then manually edited for +# readability) shows what the shader does. + +# Fragment shader GLSL: +# #version 310 es +# precision mediump float; +# precision highp int; +# +# struct S +# { +# highp vec4 v; +# }; +# +# layout(binding = 0, std140) uniform somename +# { +# highp vec4 v; +# } buf; +# +# layout(location = 0) out highp vec4 color; +# +# S undef; +# +# void main() +# { +# S temp = undef; +# temp.v = buf.v; +# color = temp.v; +# } + +SHADER vertex gfz_vert PASSTHROUGH + +SHADER fragment gfz_frag SPIRV-ASM TARGET_ENV spv1.3 +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpDecorate %9 Location 0 + OpMemberDecorate %10 0 Offset 0 + OpDecorate %10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %21 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpTypeStruct %7 + %11 = OpTypePointer Uniform %10 + %12 = OpVariable %11 Uniform + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %7 + %18 = OpTypeStruct %7 + %19 = OpUndef %18 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %7 %16 + %20 = OpCompositeInsert %18 %17 %19 0 + %21 = OpCompositeExtract %7 %20 0 + OpStore %9 %21 + OpReturn + OpFunctionEnd +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +# f +BUFFER f DATA_TYPE vec4 DATA + 1.0 0.0 0.0 1.0 +END + +PIPELINE graphics gfz_pipeline + ATTACH gfz_vert + ATTACH gfz_frag + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +BIND BUFFER f AS uniform DESCRIPTOR_SET 0 BINDING 0 +END + +CLEAR_COLOR gfz_pipeline 0 0 0 255 +CLEAR gfz_pipeline +RUN gfz_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT framebuffer IDX 0 0 SIZE 256 256 EQ_RGB 255 0 0 diff --git a/vulkan/amber/graphicsfuzz/switch-if-discard.amber b/vulkan/amber/graphicsfuzz/switch-if-discard.amber new file mode 100644 index 0000000..70be9d8 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/switch-if-discard.amber @@ -0,0 +1,140 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with a switch, if, and discard + +# The test passes because the shader always writes the color red; +# the switch is always skipped. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# switch (int(injectionSwitch.y)) // always 1 +# { +# case -1: +# if (injectionSwitch.y > injectionSwitch.x) +# { +# discard; +# } +# } +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "buf0" + OpMemberName %8 0 "injectionSwitch" + OpName %10 "" + OpName %34 "_GLF_color" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 0 + OpDecorate %34 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeStruct %7 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 1 + %15 = OpTypePointer Uniform %6 + %23 = OpConstant %13 0 + %26 = OpTypeBool + %32 = OpTypeVector %6 4 + %33 = OpTypePointer Output %32 + %34 = OpVariable %33 Output + %35 = OpConstant %6 1 + %36 = OpConstant %6 0 + %37 = OpConstantComposite %32 %35 %36 %36 %35 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %16 = OpAccessChain %15 %10 %12 %14 + %17 = OpLoad %6 %16 + %18 = OpConvertFToS %11 %17 + OpSelectionMerge %20 None + OpSwitch %18 %20 -1 %19 + %19 = OpLabel + %21 = OpAccessChain %15 %10 %12 %14 + %22 = OpLoad %6 %21 + %24 = OpAccessChain %15 %10 %12 %23 + %25 = OpLoad %6 %24 + %27 = OpFOrdGreaterThan %26 %22 %25 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %29 + %28 = OpLabel + OpTerminateInvocation + %29 = OpLabel + OpBranch %20 + %20 = OpLabel + OpStore %34 %37 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/switch-inside-while-always-return.amber b/vulkan/amber/graphicsfuzz/switch-inside-while-always-return.amber new file mode 100644 index 0000000..449b2c5 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/switch-inside-while-always-return.amber @@ -0,0 +1,172 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with a switch inside while always return + +# The test passes because main always writes the color red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float zero; +# }; +# +# int merge() +# { +# if (zero < 0.0) +# { +# return 0; +# } +# } +# +# void main() +# { +# _GLF_color = vec4(1, 0, 0, 1); +# do +# { +# switch (int(zero)) +# { +# case 0: +# return; // We always end up here +# } +# } while (false); +# +# int res = merge(); +# _GLF_color = vec4(int(res)); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %27 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "merge(" + OpName %11 "buf0" + OpMemberName %11 0 "zero" + OpName %13 "" + OpName %27 "_GLF_color" + OpName %43 "res" + OpDecorate %8 RelaxedPrecision + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %27 Location 0 + OpDecorate %43 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypeFloat 32 + %11 = OpTypeStruct %10 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpConstant %6 0 + %15 = OpTypePointer Uniform %10 + %18 = OpConstant %10 0 + %19 = OpTypeBool + %25 = OpTypeVector %10 4 + %26 = OpTypePointer Output %25 + %27 = OpVariable %26 Output + %28 = OpConstant %10 1 + %29 = OpConstantComposite %25 %28 %18 %18 %28 + %41 = OpConstantFalse %19 + %42 = OpTypePointer Function %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %43 = OpVariable %42 Function + OpStore %27 %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %31 + %31 = OpLabel + %34 = OpAccessChain %15 %13 %14 + %35 = OpLoad %10 %34 + %36 = OpConvertFToS %6 %35 + OpSelectionMerge %38 None + OpSwitch %36 %38 0 %37 + %37 = OpLabel + OpReturn + %38 = OpLabel + OpBranch %33 + %33 = OpLabel + OpBranchConditional %41 %30 %32 + %32 = OpLabel + %44 = OpFunctionCall %6 %8 + OpStore %43 %44 + %45 = OpLoad %6 %43 + %46 = OpConvertSToF %10 %45 + %47 = OpCompositeConstruct %25 %46 %46 %46 %46 + OpStore %27 %47 + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %16 = OpAccessChain %15 %13 %14 + %17 = OpLoad %10 %16 + %20 = OpFOrdLessThan %19 %17 %18 + OpSelectionMerge %22 None + OpBranchConditional %20 %21 %22 + %21 = OpLabel + OpReturnValue %14 + %22 = OpLabel + %24 = OpUndef %6 + OpReturnValue %24 + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE float DATA + 0.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/switch-loop-switch-if.amber b/vulkan/amber/graphicsfuzz/switch-loop-switch-if.amber new file mode 100644 index 0000000..d52daa1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/switch-loop-switch-if.amber @@ -0,0 +1,241 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A nested switch-loop-switch + +# The test passes because the shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = int(injectionSwitch.x); // 0 +# +# switch (i) // 0 +# { +# case 0: +# do +# { +# ++i; +# switch (i) // 1 +# { +# case 1: +# continue; // Exit loop. +# case 2: +# i += 5; +# break; +# default: +# i += 7; +# } +# } while (i > 200); // Always false. +# +# // Always false. +# if (i > 100) +# { +# i -= 2; +# break; +# } +# +# default: +# // i == 1. +# i -= 3; +# // i == -2. +# } +# +# // Always true. +# if (i == -2) +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Red. +# else +# _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 76 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %70 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %11 "buf0" + OpMemberName %11 0 "injectionSwitch" + OpName %13 "" + OpName %70 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + OpDecorate %61 RelaxedPrecision + OpDecorate %63 RelaxedPrecision + OpDecorate %70 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 2 + %11 = OpTypeStruct %10 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpConstant %6 0 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 0 + %17 = OpTypePointer Uniform %9 + %30 = OpConstant %6 1 + %38 = OpConstant %6 5 + %42 = OpConstant %6 7 + %47 = OpConstant %6 200 + %48 = OpTypeBool + %51 = OpConstant %6 100 + %55 = OpConstant %6 2 + %59 = OpConstant %6 3 + %64 = OpConstant %6 -2 + %68 = OpTypeVector %9 4 + %69 = OpTypePointer Output %68 + %70 = OpVariable %69 Output + %71 = OpConstant %9 1 + %72 = OpConstant %9 0 + %73 = OpConstantComposite %68 %71 %72 %72 %71 + %75 = OpConstantComposite %68 %72 %72 %72 %71 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %18 = OpAccessChain %17 %13 %14 %16 + %19 = OpLoad %9 %18 + %20 = OpConvertFToS %6 %19 + OpStore %8 %20 + %21 = OpLoad %6 %8 + OpSelectionMerge %24 None + OpSwitch %21 %23 0 %22 + %23 = OpLabel + %60 = OpLoad %6 %8 + %61 = OpISub %6 %60 %59 + OpStore %8 %61 + OpBranch %24 + %22 = OpLabel + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %26 + %26 = OpLabel + %29 = OpLoad %6 %8 + %31 = OpIAdd %6 %29 %30 + OpStore %8 %31 + %32 = OpLoad %6 %8 + OpSelectionMerge %36 None + OpSwitch %32 %35 1 %33 2 %34 + %35 = OpLabel + %43 = OpLoad %6 %8 + %44 = OpIAdd %6 %43 %42 + OpStore %8 %44 + OpBranch %36 + %33 = OpLabel + OpBranch %28 + %34 = OpLabel + %39 = OpLoad %6 %8 + %40 = OpIAdd %6 %39 %38 + OpStore %8 %40 + OpBranch %36 + %36 = OpLabel + OpBranch %28 + %28 = OpLabel + %46 = OpLoad %6 %8 + %49 = OpSGreaterThan %48 %46 %47 + OpBranchConditional %49 %25 %27 + %27 = OpLabel + %50 = OpLoad %6 %8 + %52 = OpSGreaterThan %48 %50 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %53 %54 + %53 = OpLabel + %56 = OpLoad %6 %8 + %57 = OpISub %6 %56 %55 + OpStore %8 %57 + OpBranch %24 + %54 = OpLabel + OpBranch %23 + %24 = OpLabel + %63 = OpLoad %6 %8 + %65 = OpIEqual %48 %63 %64 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %74 + %66 = OpLabel + OpStore %70 %73 + OpBranch %67 + %74 = OpLabel + OpStore %70 %75 + OpBranch %67 + %67 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/switch-with-empty-if-false.amber b/vulkan/amber/graphicsfuzz/switch-with-empty-if-false.amber new file mode 100644 index 0000000..67a5864 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/switch-with-empty-if-false.amber @@ -0,0 +1,115 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with always false if in switch statement + +# The test passes because the shader always writes the color red + +# Optimized using spirv-opt with the following arguments: +# '--private-to-local' +# '--eliminate-local-multi-store' +# '--simplify-instructions' +# '--eliminate-dead-inserts' +# spirv-opt commit hash: 4a00a80c40484a6f6f72f48c9d34943cf8f180d4 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# switch (0) +# { +# case 0: +# if (false) +# { +# } +# } +# +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 22 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %18 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %18 "_GLF_color" + OpDecorate %18 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpConstant %6 0 + %10 = OpTypeBool + %11 = OpConstantFalse %10 + %15 = OpTypeFloat 32 + %16 = OpTypeVector %15 4 + %17 = OpTypePointer Output %16 + %18 = OpVariable %17 Output + %19 = OpConstant %15 1 + %20 = OpConstant %15 0 + %21 = OpConstantComposite %16 %19 %20 %20 %19 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %9 None + OpSwitch %7 %9 0 %8 + %8 = OpLabel + OpSelectionMerge %13 None + OpBranchConditional %11 %12 %13 + %12 = OpLabel + OpBranch %13 + %13 = OpLabel + OpBranch %9 + %9 = OpLabel + OpStore %18 %21 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/switch-with-fall-through-cases.amber b/vulkan/amber/graphicsfuzz/switch-with-fall-through-cases.amber new file mode 100644 index 0000000..57defee --- /dev/null +++ b/vulkan/amber/graphicsfuzz/switch-with-fall-through-cases.amber @@ -0,0 +1,202 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with switch cases that fall through + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--ccp' +# '--eliminate-local-single-block' +# '--combine-access-chains' +# '--copy-propagate-arrays' +# '--eliminate-local-single-store' +# '--eliminate-local-multi-store' +# '--eliminate-local-single-block' +# '--private-to-local' +# spirv-opt commit hash: ab7ac60f14ae66006bed5c989a2cfd4c4881704c + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# void main() +# { +# for(int i = 0; i < 2 + int(injectionSwitch.x); i++) +# { +# int value = i; +# float y = 0.5; +# +# switch(value) +# { +# case 0: +# y += 0.5; +# // Always falls through. +# case 1: +# y = clamp(1.0, 0.5, y); +# // Always falls through. +# case 2: +# default: +# // Always ends up here. +# // Always true. +# if (y == 1.0) +# { +# _GLF_color = vec4(value + 1, 0, 0, 1); +# return; +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 66 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %52 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %19 "buf0" + OpMemberName %19 0 "injectionSwitch" + OpName %21 "" + OpName %31 "value" + OpName %34 "y" + OpName %52 "_GLF_color" + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 0 + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypeFloat 32 + %18 = OpTypeVector %17 2 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 0 + %24 = OpTypePointer Uniform %17 + %29 = OpTypeBool + %33 = OpTypePointer Function %17 + %35 = OpConstant %17 0.5 + %43 = OpConstant %17 1 + %50 = OpTypeVector %17 4 + %51 = OpTypePointer Output %50 + %52 = OpVariable %51 Output + %54 = OpConstant %6 1 + %57 = OpConstant %17 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %31 = OpVariable %7 Function + %34 = OpVariable %33 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %63 = OpPhi %6 %9 %5 %62 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %25 = OpAccessChain %24 %21 %9 %23 + %26 = OpLoad %17 %25 + %27 = OpConvertFToS %6 %26 + %28 = OpIAdd %6 %16 %27 + %30 = OpSLessThan %29 %63 %28 + OpBranchConditional %30 %11 %12 + %11 = OpLabel + OpStore %31 %63 + OpStore %34 %35 + OpSelectionMerge %40 None + OpSwitch %63 %39 0 %37 1 %38 2 %39 + %39 = OpLabel + %65 = OpPhi %17 %35 %11 %45 %38 + %47 = OpFOrdEqual %29 %65 %43 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %49 + %48 = OpLabel + %55 = OpIAdd %6 %63 %54 + %56 = OpConvertSToF %17 %55 + %58 = OpCompositeConstruct %50 %56 %57 %57 %43 + OpStore %52 %58 + OpReturn + %49 = OpLabel + OpBranch %40 + %37 = OpLabel + %42 = OpFAdd %17 %35 %35 + OpStore %34 %42 + OpBranch %38 + %38 = OpLabel + %64 = OpPhi %17 %35 %11 %42 %37 + %45 = OpExtInst %17 %1 FClamp %43 %35 %64 + OpStore %34 %45 + OpBranch %39 + %40 = OpLabel + OpBranch %13 + %13 = OpLabel + %62 = OpIAdd %6 %63 %54 + OpStore %8 %62 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/swizzle-struct-init-min.amber b/vulkan/amber/graphicsfuzz/swizzle-struct-init-min.amber new file mode 100644 index 0000000..a7817fa --- /dev/null +++ b/vulkan/amber/graphicsfuzz/swizzle-struct-init-min.amber @@ -0,0 +1,157 @@ +#!amber + +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# A fragment shader that uses vector swizzles, struct initializers, and min. +# Derived from the following GLSL fragment shader. +# We check that the top-left pixel is red. The test passes because the +# first if statement checks if the x coordinate is less than 10 and if so writes +# red to _GLF_color and then returns. + +# #version 310 es +# +# precision highp float; +# precision highp int; +# +# struct S { +# vec2 s2; +# }; +# +# layout(location=0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# void main() +# { +# if (gl_FragCoord.x < 10.0) { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# return; +# } +# vec4 v4 = vec4(injectionSwitch.y); +# vec2 p = S(v4.xy).s2; +# v4.xy = p; +# v4.xy = (min(vec4(1.0), v4)).xy; +# _GLF_color = vec4(v4.x, 0.0, 0.0, 1.0); +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft + OpSource ESSL 310 + OpName %2 "main" + OpName %3 "gl_FragCoord" + OpName %4 "_GLF_color" + OpName %5 "buf0" + OpMemberName %5 0 "injectionSwitch" + OpName %6 "" + OpDecorate %3 BuiltIn FragCoord + OpDecorate %4 Location 0 + OpMemberDecorate %5 0 Offset 0 + OpDecorate %5 Block + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 0 + %7 = OpTypeVoid + %8 = OpTypeFunction %7 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %3 = OpVariable %11 Input + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 0 + %14 = OpTypePointer Input %9 + %15 = OpConstant %9 10 + %16 = OpTypeBool + %17 = OpTypePointer Output %10 + %4 = OpVariable %17 Output + %18 = OpConstant %9 1 + %19 = OpConstant %9 0 + %20 = OpConstantComposite %10 %18 %19 %19 %18 + %21 = OpTypeVector %9 2 + %5 = OpTypeStruct %21 + %22 = OpTypePointer Uniform %5 + %6 = OpVariable %22 Uniform + %23 = OpTypeInt 32 1 + %24 = OpConstant %23 0 + %25 = OpConstant %12 1 + %26 = OpTypePointer Uniform %9 + %27 = OpConstantComposite %10 %18 %18 %18 %18 + %2 = OpFunction %7 None %8 + %28 = OpLabel + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpAccessChain %14 %3 %13 + %34 = OpLoad %9 %33 + %35 = OpFOrdLessThan %16 %34 %15 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %36 + %37 = OpLabel + OpStore %4 %20 + OpBranch %30 + %36 = OpLabel + %38 = OpAccessChain %26 %6 %24 %25 + %39 = OpLoad %9 %38 + %40 = OpCompositeConstruct %10 %39 %39 %39 %39 + %41 = OpVectorShuffle %10 %40 %40 4 5 2 3 + %42 = OpExtInst %10 %1 FMin %27 %41 + %43 = OpCompositeExtract %9 %42 0 + %44 = OpCompositeConstruct %10 %43 %19 %19 %18 + OpStore %4 %44 + OpBranch %30 + %31 = OpLabel + OpBranch %29 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/transpose-rectangular-matrix.amber b/vulkan/amber/graphicsfuzz/transpose-rectangular-matrix.amber new file mode 100644 index 0000000..3318996 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/transpose-rectangular-matrix.amber @@ -0,0 +1,152 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: Fragment shader that uses 'transpose' + +# The test passes because 'f' is invoked with a vector whose components are less than or equal to 1.0, so that it returns vec3(1.0, 0.0, 0.0), meaning that the output colour red is written + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 f(vec2 pos) +# { +# if(pos.y > 1.0) +# { +# vec3 v; +# return v; +# } +# return vec3(1.0, 0.0, 0.0); +# } +# void main() +# { +# _GLF_color = vec4(f(vec2(transpose((gl_FragCoord.y < 1.0) ? mat4x3(1.0) : transpose(mat3x4(1.0))))), 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 99 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 %36 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %34 "_GLF_color" + OpName %36 "gl_FragCoord" + OpDecorate %34 Location 0 + OpDecorate %36 BuiltIn FragCoord + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %9 = OpTypeVector %6 3 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 1 + %19 = OpConstant %6 1 + %20 = OpTypeBool + %28 = OpConstant %6 0 + %29 = OpConstantComposite %9 %19 %28 %28 + %32 = OpTypeVector %6 4 + %33 = OpTypePointer Output %32 + %34 = OpVariable %33 Output + %35 = OpTypePointer Input %32 + %36 = OpVariable %35 Input + %37 = OpTypePointer Input %6 + %41 = OpTypeMatrix %9 4 + %46 = OpConstantComposite %9 %28 %19 %28 + %47 = OpConstantComposite %9 %28 %28 %19 + %48 = OpConstantComposite %9 %28 %28 %28 + %49 = OpConstantComposite %41 %29 %46 %47 %48 + %51 = OpTypeMatrix %32 3 + %52 = OpConstantComposite %32 %19 %28 %28 %28 + %53 = OpConstantComposite %32 %28 %19 %28 %28 + %54 = OpConstantComposite %32 %28 %28 %19 %28 + %55 = OpConstantComposite %51 %52 %53 %54 + %97 = OpUndef %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %38 = OpAccessChain %37 %36 %15 + %39 = OpLoad %6 %38 + %40 = OpFOrdLessThan %20 %39 %19 + OpSelectionMerge %45 None + OpBranchConditional %40 %44 %50 + %44 = OpLabel + OpBranch %45 + %50 = OpLabel + %56 = OpTranspose %41 %55 + OpBranch %45 + %45 = OpLabel + %94 = OpPhi %41 %49 %44 %56 %50 + %58 = OpTranspose %51 %94 + %60 = OpCompositeExtract %6 %58 0 1 + OpBranch %82 + %82 = OpLabel + OpLoopMerge %83 %84 None + OpBranch %85 + %85 = OpLabel + %88 = OpFOrdGreaterThan %20 %60 %19 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + OpBranch %83 + %89 = OpLabel + OpBranch %83 + %84 = OpLabel + OpBranch %82 + %83 = OpLabel + %98 = OpPhi %9 %97 %90 %29 %89 + %64 = OpCompositeExtract %6 %98 0 + %65 = OpCompositeExtract %6 %98 1 + %66 = OpCompositeExtract %6 %98 2 + %67 = OpCompositeConstruct %32 %64 %65 %66 %19 + OpStore %34 %67 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/two-2-iteration-loops.amber b/vulkan/amber/graphicsfuzz/two-2-iteration-loops.amber new file mode 100644 index 0000000..a678c0c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/two-2-iteration-loops.amber @@ -0,0 +1,331 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: Fragment shader with pair of outer loops + +# The test passes because fragments in the top-left quadrant write red, and all other fragments are guaranteed to be discarded + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# if (gl_FragCoord.x < 128.0 && gl_FragCoord.y < 128.0) { +# return; +# } +# int odd_index = 0; +# while(odd_index <= 1) +# { +# _GLF_color.x += 0.25; +# odd_index ++; +# } +# int even_index = 1; +# while(even_index >= 0) +# { +# _GLF_color.x += 0.25; +# if(injectionSwitch.x > injectionSwitch.y) +# { +# // Unreachable +# continue; +# } +# if(even_index >= 1) +# { +# // Guaranteed to be reached during the first loop iteration +# discard; +# } +# int ll; // Uninitialized, but unreachable due to the above discard +# for( +# int j = 1; +# true; +# j ++ +# ) +# { +# if(ll >= 3) +# { +# break; +# } +# ll ++; +# if(uint(j) < uint(1)) +# { +# continue; +# } +# if(injectionSwitch.x > injectionSwitch.y) +# { +# break; +# } +# } +# if(injectionSwitch.x > injectionSwitch.y) +# { +# _GLF_color = vec4(1.0); +# } +# even_index --; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 125 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %15 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %15 "gl_FragCoord" + OpName %35 "odd_index" + OpName %53 "even_index" + OpName %66 "buf0" + OpMemberName %66 0 "injectionSwitch" + OpName %68 "" + OpName %83 "j" + OpName %90 "ll" + OpDecorate %9 Location 0 + OpDecorate %15 BuiltIn FragCoord + OpDecorate %35 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %59 RelaxedPrecision + OpMemberDecorate %66 0 Offset 0 + OpDecorate %66 Block + OpDecorate %68 DescriptorSet 0 + OpDecorate %68 Binding 0 + OpDecorate %78 RelaxedPrecision + OpDecorate %83 RelaxedPrecision + OpDecorate %90 RelaxedPrecision + OpDecorate %91 RelaxedPrecision + OpDecorate %97 RelaxedPrecision + OpDecorate %98 RelaxedPrecision + OpDecorate %99 RelaxedPrecision + OpDecorate %113 RelaxedPrecision + OpDecorate %114 RelaxedPrecision + OpDecorate %123 RelaxedPrecision + OpDecorate %124 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstant %6 0 + %12 = OpConstantComposite %7 %10 %11 %11 %10 + %13 = OpTypeBool + %14 = OpTypePointer Input %7 + %15 = OpVariable %14 Input + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 0 + %18 = OpTypePointer Input %6 + %21 = OpConstant %6 128 + %25 = OpConstant %16 1 + %33 = OpTypeInt 32 1 + %34 = OpTypePointer Function %33 + %36 = OpConstant %33 0 + %43 = OpConstant %33 1 + %45 = OpConstant %6 0.25 + %46 = OpTypePointer Output %6 + %65 = OpTypeVector %6 2 + %66 = OpTypeStruct %65 + %67 = OpTypePointer Uniform %66 + %68 = OpVariable %67 Uniform + %69 = OpTypePointer Uniform %6 + %89 = OpConstantTrue %13 + %92 = OpConstant %33 3 + %122 = OpConstantComposite %7 %10 %10 %10 %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %35 = OpVariable %34 Function + %53 = OpVariable %34 Function + %83 = OpVariable %34 Function + %90 = OpVariable %34 Function + OpStore %9 %12 + %19 = OpAccessChain %18 %15 %17 + %20 = OpLoad %6 %19 + %22 = OpFOrdLessThan %13 %20 %21 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %26 = OpAccessChain %18 %15 %25 + %27 = OpLoad %6 %26 + %28 = OpFOrdLessThan %13 %27 %21 + OpBranch %24 + %24 = OpLabel + %29 = OpPhi %13 %22 %5 %28 %23 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %31 + %30 = OpLabel + OpReturn + %31 = OpLabel + OpStore %35 %36 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %33 %35 + %44 = OpSLessThanEqual %13 %42 %43 + OpBranchConditional %44 %38 %39 + %38 = OpLabel + %47 = OpAccessChain %46 %9 %17 + %48 = OpLoad %6 %47 + %49 = OpFAdd %6 %48 %45 + %50 = OpAccessChain %46 %9 %17 + OpStore %50 %49 + %51 = OpLoad %33 %35 + %52 = OpIAdd %33 %51 %43 + OpStore %35 %52 + OpBranch %40 + %40 = OpLabel + OpBranch %37 + %39 = OpLabel + OpStore %53 %43 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %33 %53 + %60 = OpSGreaterThanEqual %13 %59 %36 + OpBranchConditional %60 %55 %56 + %55 = OpLabel + %61 = OpAccessChain %46 %9 %17 + %62 = OpLoad %6 %61 + %63 = OpFAdd %6 %62 %45 + %64 = OpAccessChain %46 %9 %17 + OpStore %64 %63 + %70 = OpAccessChain %69 %68 %36 %17 + %71 = OpLoad %6 %70 + %72 = OpAccessChain %69 %68 %36 %25 + %73 = OpLoad %6 %72 + %74 = OpFOrdGreaterThan %13 %71 %73 + OpSelectionMerge %76 None + OpBranchConditional %74 %75 %76 + %75 = OpLabel + OpBranch %57 + %76 = OpLabel + %78 = OpLoad %33 %53 + %79 = OpSGreaterThanEqual %13 %78 %43 + OpSelectionMerge %81 None + OpBranchConditional %79 %80 %81 + %80 = OpLabel + OpTerminateInvocation + %81 = OpLabel + OpStore %83 %43 + OpBranch %84 + %84 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + OpBranchConditional %89 %85 %86 + %85 = OpLabel + %91 = OpLoad %33 %90 + %93 = OpSGreaterThanEqual %13 %91 %92 + OpSelectionMerge %95 None + OpBranchConditional %93 %94 %95 + %94 = OpLabel + OpBranch %86 + %95 = OpLabel + %97 = OpLoad %33 %90 + %98 = OpIAdd %33 %97 %43 + OpStore %90 %98 + %99 = OpLoad %33 %83 + %100 = OpBitcast %16 %99 + %101 = OpULessThan %13 %100 %25 + OpSelectionMerge %103 None + OpBranchConditional %101 %102 %103 + %102 = OpLabel + OpBranch %87 + %103 = OpLabel + %105 = OpAccessChain %69 %68 %36 %17 + %106 = OpLoad %6 %105 + %107 = OpAccessChain %69 %68 %36 %25 + %108 = OpLoad %6 %107 + %109 = OpFOrdGreaterThan %13 %106 %108 + OpSelectionMerge %111 None + OpBranchConditional %109 %110 %111 + %110 = OpLabel + OpBranch %86 + %111 = OpLabel + OpBranch %87 + %87 = OpLabel + %113 = OpLoad %33 %83 + %114 = OpIAdd %33 %113 %43 + OpStore %83 %114 + OpBranch %84 + %86 = OpLabel + %115 = OpAccessChain %69 %68 %36 %17 + %116 = OpLoad %6 %115 + %117 = OpAccessChain %69 %68 %36 %25 + %118 = OpLoad %6 %117 + %119 = OpFOrdGreaterThan %13 %116 %118 + OpSelectionMerge %121 None + OpBranchConditional %119 %120 %121 + %120 = OpLabel + OpStore %9 %122 + OpBranch %121 + %121 = OpLabel + %123 = OpLoad %33 %53 + %124 = OpISub %33 %123 %43 + OpStore %53 %124 + OpBranch %57 + %57 = OpLabel + OpBranch %54 + %56 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 100 100 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/two-for-loops-with-barrier-function.amber b/vulkan/amber/graphicsfuzz/two-for-loops-with-barrier-function.amber new file mode 100644 index 0000000..769267c --- /dev/null +++ b/vulkan/amber/graphicsfuzz/two-for-loops-with-barrier-function.amber @@ -0,0 +1,291 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A compute shader with two barrier functions + +# The test passes because main always outputs 42. + +# variant_compute_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(std430, binding = 0) buffer doesNotMatter +# { +# uint _compute_data[]; +# }; +# layout(local_size_x = 1, local_size_y = 18, local_size_z = 6) in; +# mediump vec4 GLF_live2gl_FragCoord; +# layout(set = 0, binding = 1) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# void main() +# { +# int GLF_live2_looplimiter1 = 0; +# for ( +# int i = 0; +# i < 1; +# ++i) +# { +# if (GLF_live2_looplimiter1 >= 3) //always false +# { +# for ( +# int j = 0; +# j < 1; +# ++j) +# { +# if (int(GLF_live2gl_FragCoord.x) < 120) +# { +# } +# else +# { +# barrier(); +# } +# } +# break; +# } +# } +# float GLF_dead3x = (injectionSwitch.x > injectionSwitch.y ? GLF_live2gl_FragCoord.x : 0.0); // always 0.0 +# for ( +# int GLF_dead3k = 0; +# GLF_dead3k < 2; +# ++GLF_dead3k) +# { +# if (GLF_dead3x > 4.0) //always false +# { +# break; +# } +# GLF_dead3x = GLF_live2gl_FragCoord.x; +# barrier(); +# } +# +# _compute_data[0] = 42u; +# } +SHADER compute variant_compute_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 106 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %4 "main" + OpExecutionMode %4 LocalSize 1 18 6 + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "GLF_live2_looplimiter1" + OpName %10 "i" + OpName %25 "j" + OpName %36 "GLF_live2gl_FragCoord" + OpName %56 "GLF_dead3x" + OpName %58 "buf0" + OpMemberName %58 0 "injectionSwitch" + OpName %60 "" + OpName %76 "GLF_dead3k" + OpName %96 "doesNotMatter" + OpMemberName %96 0 "_compute_data" + OpName %98 "" + OpDecorate %36 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpMemberDecorate %58 0 Offset 0 + OpDecorate %58 Block + OpDecorate %60 DescriptorSet 0 + OpDecorate %60 Binding 1 + OpDecorate %72 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %92 RelaxedPrecision + OpDecorate %95 ArrayStride 4 + OpMemberDecorate %96 0 Offset 0 + OpDecorate %96 BufferBlock + OpDecorate %98 DescriptorSet 0 + OpDecorate %98 Binding 0 + OpDecorate %105 BuiltIn WorkgroupSize + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpConstant %6 1 + %18 = OpTypeBool + %21 = OpConstant %6 3 + %33 = OpTypeFloat 32 + %34 = OpTypeVector %33 4 + %35 = OpTypePointer Private %34 + %36 = OpVariable %35 Private + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 0 + %39 = OpTypePointer Private %33 + %43 = OpConstant %6 120 + %48 = OpConstant %37 2 + %49 = OpConstant %37 264 + %55 = OpTypePointer Function %33 + %57 = OpTypeVector %33 2 + %58 = OpTypeStruct %57 + %59 = OpTypePointer Uniform %58 + %60 = OpVariable %59 Uniform + %61 = OpTypePointer Uniform %33 + %64 = OpConstant %37 1 + %74 = OpConstant %33 0 + %83 = OpConstant %6 2 + %86 = OpConstant %33 4 + %95 = OpTypeRuntimeArray %37 + %96 = OpTypeStruct %95 + %97 = OpTypePointer Uniform %96 + %98 = OpVariable %97 Uniform + %99 = OpConstant %37 42 + %100 = OpTypePointer Uniform %37 + %102 = OpTypeVector %37 3 + %103 = OpConstant %37 18 + %104 = OpConstant %37 6 + %105 = OpConstantComposite %102 %64 %103 %104 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %25 = OpVariable %7 Function + %56 = OpVariable %55 Function + %68 = OpVariable %55 Function + %76 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %16 = OpLoad %6 %10 + %19 = OpSLessThan %18 %16 %17 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + %20 = OpLoad %6 %8 + %22 = OpSGreaterThanEqual %18 %20 %21 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + OpStore %25 %9 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %6 %25 + %32 = OpSLessThan %18 %31 %17 + OpBranchConditional %32 %27 %28 + %27 = OpLabel + %40 = OpAccessChain %39 %36 %38 + %41 = OpLoad %33 %40 + %42 = OpConvertFToS %6 %41 + %44 = OpSLessThan %18 %42 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %45 %47 + %45 = OpLabel + OpBranch %46 + %47 = OpLabel + OpControlBarrier %48 %48 %49 + OpBranch %46 + %46 = OpLabel + OpBranch %29 + %29 = OpLabel + %50 = OpLoad %6 %25 + %51 = OpIAdd %6 %50 %17 + OpStore %25 %51 + OpBranch %26 + %28 = OpLabel + OpBranch %13 + %24 = OpLabel + OpBranch %14 + %14 = OpLabel + %53 = OpLoad %6 %10 + %54 = OpIAdd %6 %53 %17 + OpStore %10 %54 + OpBranch %11 + %13 = OpLabel + %62 = OpAccessChain %61 %60 %9 %38 + %63 = OpLoad %33 %62 + %65 = OpAccessChain %61 %60 %9 %64 + %66 = OpLoad %33 %65 + %67 = OpFOrdGreaterThan %18 %63 %66 + OpSelectionMerge %70 None + OpBranchConditional %67 %69 %73 + %69 = OpLabel + %71 = OpAccessChain %39 %36 %38 + %72 = OpLoad %33 %71 + OpStore %68 %72 + OpBranch %70 + %73 = OpLabel + OpStore %68 %74 + OpBranch %70 + %70 = OpLabel + %75 = OpLoad %33 %68 + OpStore %56 %75 + OpStore %76 %9 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %6 %76 + %84 = OpSLessThan %18 %82 %83 + OpBranchConditional %84 %78 %79 + %78 = OpLabel + %85 = OpLoad %33 %56 + %87 = OpFOrdGreaterThan %18 %85 %86 + OpSelectionMerge %89 None + OpBranchConditional %87 %88 %89 + %88 = OpLabel + OpBranch %79 + %89 = OpLabel + %91 = OpAccessChain %39 %36 %38 + %92 = OpLoad %33 %91 + OpStore %56 %92 + OpControlBarrier %48 %48 %49 + OpBranch %80 + %80 = OpLabel + %93 = OpLoad %6 %76 + %94 = OpIAdd %6 %93 %17 + OpStore %76 %94 + OpBranch %77 + %79 = OpLabel + %101 = OpAccessChain %100 %98 %9 %9 + OpStore %101 %99 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_ssbo DATA_TYPE uint32 DATA + 0 0 0 0 0 0 0 0 0 0 +END + +PIPELINE compute variant_pipeline + ATTACH variant_compute_shader + BIND BUFFER variant_ssbo AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1 +END + +RUN variant_pipeline 1 6 2 + +EXPECT variant_ssbo IDX 0 EQ 42 \ No newline at end of file diff --git a/vulkan/amber/graphicsfuzz/two-loops-mat-add.amber b/vulkan/amber/graphicsfuzz/two-loops-mat-add.amber new file mode 100644 index 0000000..13033cc --- /dev/null +++ b/vulkan/amber/graphicsfuzz/two-loops-mat-add.amber @@ -0,0 +1,273 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with two for loops over a global matrix + +# The test passes because the shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-code-aggressive' +# '--vector-dce' +# '--ccp' +# '--ccp' +# '--eliminate-dead-code-aggressive' +# '--eliminate-local-multi-store' +# '--eliminate-dead-branches' +# '--inline-entry-points-exhaustive' +# '--copy-propagate-arrays' +# '--eliminate-local-single-store' +# '--eliminate-local-multi-store' +# '--convert-local-access-chains' +# '--inline-entry-points-exhaustive' +# '--convert-local-access-chains' +# '--ccp' +# '--redundancy-elimination' +# spirv-opt commit hash: 18b3b94567a9251a6f8491a6d07c4422abadd22c + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# mat4 m44; +# +# void main() +# { +# // Always true. +# if (injectionSwitch.x < 1.0) { +# m44 = mat4( +# 1.0, 2.0, 3.0, 4.0, +# 5.0, 6.0, 7.0, 8.0, +# 9.0, 10.0, 11.0, 12.0, +# 13.0, 14.0, 15.0, 16.0 +# ); +# } +# +# float s = 0.0; +# int c = 0; +# for ( +# int i = 0; +# i < 4; +# i++) +# { +# s += m44[c][i]; +# } +# +# // 0 iteration loop. +# for ( +# int i = 4; +# i < 4; +# i++) +# { +# s += m44[c][i]; +# } +# +# // Always true (1+2+3+4==10). +# if (s == 10.0) +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# else +# _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 104 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %92 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "buf0" + OpMemberName %8 0 "injectionSwitch" + OpName %10 "" + OpName %26 "m44" + OpName %48 "s" + OpName %51 "c" + OpName %52 "i" + OpName %71 "i" + OpName %92 "_GLF_color" + OpMemberDecorate %8 0 Offset 0 + OpDecorate %8 Block + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 0 + OpDecorate %51 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %70 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %86 RelaxedPrecision + OpDecorate %92 Location 0 + OpDecorate %96 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeStruct %7 + %9 = OpTypePointer Uniform %8 + %10 = OpVariable %9 Uniform + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %6 + %18 = OpConstant %6 1 + %19 = OpTypeBool + %23 = OpTypeVector %6 4 + %24 = OpTypeMatrix %23 4 + %25 = OpTypePointer Private %24 + %26 = OpVariable %25 Private + %27 = OpConstant %6 2 + %28 = OpConstant %6 3 + %29 = OpConstant %6 4 + %30 = OpConstantComposite %23 %18 %27 %28 %29 + %31 = OpConstant %6 5 + %32 = OpConstant %6 6 + %33 = OpConstant %6 7 + %34 = OpConstant %6 8 + %35 = OpConstantComposite %23 %31 %32 %33 %34 + %36 = OpConstant %6 9 + %37 = OpConstant %6 10 + %38 = OpConstant %6 11 + %39 = OpConstant %6 12 + %40 = OpConstantComposite %23 %36 %37 %38 %39 + %41 = OpConstant %6 13 + %42 = OpConstant %6 14 + %43 = OpConstant %6 15 + %44 = OpConstant %6 16 + %45 = OpConstantComposite %23 %41 %42 %43 %44 + %46 = OpConstantComposite %24 %30 %35 %40 %45 + %47 = OpTypePointer Function %6 + %49 = OpConstant %6 0 + %50 = OpTypePointer Function %11 + %59 = OpConstant %11 4 + %63 = OpTypePointer Private %6 + %69 = OpConstant %11 1 + %91 = OpTypePointer Output %23 + %92 = OpVariable %91 Output + %93 = OpConstantComposite %23 %18 %49 %49 %18 + %95 = OpConstantComposite %23 %49 %49 %49 %18 + %102 = OpConstantTrue %19 + %103 = OpConstantFalse %19 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %48 = OpVariable %47 Function + %51 = OpVariable %50 Function + %52 = OpVariable %50 Function + %71 = OpVariable %50 Function + %16 = OpAccessChain %15 %10 %12 %14 + %17 = OpLoad %6 %16 + %20 = OpFOrdLessThan %19 %17 %18 + OpSelectionMerge %22 None + OpBranchConditional %20 %21 %22 + %21 = OpLabel + OpStore %26 %46 + OpBranch %22 + %22 = OpLabel + OpStore %48 %49 + OpStore %51 %12 + OpStore %52 %12 + OpBranch %53 + %53 = OpLabel + %99 = OpPhi %6 %49 %22 %67 %56 + %96 = OpPhi %11 %12 %22 %70 %56 + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %60 = OpSLessThan %19 %96 %59 + OpBranchConditional %60 %54 %55 + %54 = OpLabel + %64 = OpAccessChain %63 %26 %12 %96 + %65 = OpLoad %6 %64 + %67 = OpFAdd %6 %99 %65 + OpStore %48 %67 + OpBranch %56 + %56 = OpLabel + %70 = OpIAdd %11 %96 %69 + OpStore %52 %70 + OpBranch %53 + %55 = OpLabel + OpStore %71 %59 + OpBranch %72 + %72 = OpLabel + %98 = OpPhi %6 %99 %55 %84 %75 + %97 = OpPhi %11 %59 %55 %86 %75 + OpLoopMerge %74 %75 None + OpBranch %76 + %76 = OpLabel + %78 = OpSLessThan %19 %59 %59 + OpBranchConditional %103 %73 %74 + %73 = OpLabel + %81 = OpAccessChain %63 %26 %12 %59 + %82 = OpLoad %6 %81 + %84 = OpFAdd %6 %98 %82 + OpStore %48 %84 + OpBranch %75 + %75 = OpLabel + %86 = OpIAdd %11 %59 %69 + OpStore %71 %86 + OpBranch %72 + %74 = OpLabel + %88 = OpFOrdEqual %19 %98 %37 + OpSelectionMerge %90 None + OpBranchConditional %88 %89 %94 + %89 = OpLabel + OpStore %92 %93 + OpBranch %90 + %94 = OpLabel + OpStore %92 %95 + OpBranch %90 + %90 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/two-loops-matrix.amber b/vulkan/amber/graphicsfuzz/two-loops-matrix.amber new file mode 100644 index 0000000..eb65d8a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/two-loops-matrix.amber @@ -0,0 +1,212 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with two loops and some matrices + +# The test passes because the fragment shader always writes red; the loops do nothing. +# The second loop condition is always false. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# mat4 matrix_a_uni; +# }; +# void main() +# { +# vec4 matrix_b; +# vec4 matrix_u; +# for ( +# int x = 4; +# x >= 1; +# x--) +# { +# matrix_u[x] = 1.0; +# } +# for ( +# int b = 4; +# matrix_a_uni[0][0] < -1.0; +# b--) +# { +# matrix_b[b] = (b > 1 ? min(matrix_b, matrix_b) : matrix_u)[1]; +# } +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 69 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %66 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + OpName %22 "matrix_u" + OpName %29 "b" + OpName %36 "buf0" + OpMemberName %36 0 "matrix_a_uni" + OpName %38 "" + OpName %47 "matrix_b" + OpName %66 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpMemberDecorate %36 0 ColMajor + OpMemberDecorate %36 0 Offset 0 + OpMemberDecorate %36 0 MatrixStride 16 + OpDecorate %36 Block + OpDecorate %38 DescriptorSet 0 + OpDecorate %38 Binding 0 + OpDecorate %48 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %63 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %66 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 4 + %16 = OpConstant %6 1 + %17 = OpTypeBool + %19 = OpTypeFloat 32 + %20 = OpTypeVector %19 4 + %21 = OpTypePointer Function %20 + %24 = OpConstant %19 1 + %25 = OpTypePointer Function %19 + %35 = OpTypeMatrix %20 4 + %36 = OpTypeStruct %35 + %37 = OpTypePointer Uniform %36 + %38 = OpVariable %37 Uniform + %39 = OpConstant %6 0 + %40 = OpTypeInt 32 0 + %41 = OpConstant %40 0 + %42 = OpTypePointer Uniform %19 + %45 = OpConstant %19 -1 + %59 = OpConstant %40 1 + %65 = OpTypePointer Output %20 + %66 = OpVariable %65 Output + %67 = OpConstant %19 0 + %68 = OpConstantComposite %20 %24 %67 %67 %24 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %21 Function + %29 = OpVariable %7 Function + %47 = OpVariable %21 Function + %51 = OpVariable %21 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %6 %8 + %18 = OpSGreaterThanEqual %17 %15 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %23 = OpLoad %6 %8 + %26 = OpAccessChain %25 %22 %23 + OpStore %26 %24 + OpBranch %13 + %13 = OpLabel + %27 = OpLoad %6 %8 + %28 = OpISub %6 %27 %16 + OpStore %8 %28 + OpBranch %10 + %12 = OpLabel + OpStore %29 %9 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %43 = OpAccessChain %42 %38 %39 %39 %41 + %44 = OpLoad %19 %43 + %46 = OpFOrdLessThan %17 %44 %45 + OpBranchConditional %46 %31 %32 + %31 = OpLabel + %48 = OpLoad %6 %29 + %49 = OpLoad %6 %29 + %50 = OpSGreaterThan %17 %49 %16 + OpSelectionMerge %53 None + OpBranchConditional %50 %52 %57 + %52 = OpLabel + %54 = OpLoad %20 %47 + %55 = OpLoad %20 %47 + %56 = OpExtInst %20 %1 FMin %54 %55 + OpStore %51 %56 + OpBranch %53 + %57 = OpLabel + %58 = OpLoad %20 %22 + OpStore %51 %58 + OpBranch %53 + %53 = OpLabel + %60 = OpAccessChain %25 %51 %59 + %61 = OpLoad %19 %60 + %62 = OpAccessChain %25 %47 %48 + OpStore %62 %61 + OpBranch %33 + %33 = OpLabel + %63 = OpLoad %6 %29 + %64 = OpISub %6 %63 %16 + OpStore %29 %64 + OpBranch %30 + %32 = OpLabel + OpStore %66 %68 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# matrix_a_uni +BUFFER variant_matrix_a_uni DATA_TYPE mat4x4 DATA + 1.0 5.0 3.0 7.0 9.0 6.0 7.0 8.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_matrix_a_uni AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/two-loops-set-struct.amber b/vulkan/amber/graphicsfuzz/two-loops-set-struct.amber new file mode 100644 index 0000000..ece4bf6 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/two-loops-set-struct.amber @@ -0,0 +1,206 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with two loops that write to a struct + +# The test passes because the shader always writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '--private-to-local' +# '--private-to-local' +# '--eliminate-dead-inserts' +# '--if-conversion' +# '--eliminate-dead-code-aggressive' +# '--eliminate-dead-code-aggressive' +# '--vector-dce' +# '--convert-local-access-chains' +# '--convert-local-access-chains' +# '--eliminate-local-single-block' +# '--eliminate-dead-code-aggressive' +# '--redundancy-elimination' +# '--eliminate-local-multi-store' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-code-aggressive' +# '--eliminate-dead-branches' +# '--eliminate-dead-inserts' +# '--simplify-instructions' +# '--eliminate-local-multi-store' +# '--private-to-local' +# '--combine-access-chains' +# '--eliminate-local-single-store' +# '--eliminate-dead-branches' +# '--merge-return' +# spirv-opt commit hash: 06407250a169c6a03b3765e86619075af1a8c187 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# struct StructType +# { +# vec3 col; +# bvec4 bbbb; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# void main() +# { +# StructType s; +# +# for ( +# int i = 0; +# i < int(injectionSwitch.y); // i < 1 +# i++) +# { +# s.col = vec3(1.0, 0.0, 0.0); +# } +# +# for ( +# int i = 0; +# i < int(injectionSwitch.y); // i < 1 +# i++) +# { +# s.col = vec3(1.0, 0.0, 0.0);; +# } +# _GLF_color = vec4(s.col, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %58 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %18 "buf0" + OpMemberName %18 0 "injectionSwitch" + OpName %20 "" + OpName %31 "StructType" + OpMemberName %31 0 "col" + OpMemberName %31 1 "bbbb" + OpName %58 "_GLF_color" + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %41 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %58 Location 0 + OpDecorate %70 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpConstant %6 0 + %16 = OpTypeFloat 32 + %17 = OpTypeVector %16 2 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 1 + %23 = OpTypePointer Uniform %16 + %27 = OpTypeBool + %29 = OpTypeVector %16 3 + %30 = OpTypeVector %27 4 + %31 = OpTypeStruct %29 %30 + %34 = OpConstant %16 1 + %35 = OpConstant %16 0 + %36 = OpConstantComposite %29 %34 %35 %35 + %40 = OpConstant %6 1 + %56 = OpTypeVector %16 4 + %57 = OpTypePointer Output %56 + %58 = OpVariable %57 Output + %74 = OpUndef %31 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %10 + %10 = OpLabel + %73 = OpPhi %31 %74 %5 %66 %11 + %70 = OpPhi %6 %9 %5 %41 %11 + %24 = OpAccessChain %23 %20 %9 %22 + %25 = OpLoad %16 %24 + %26 = OpConvertFToS %6 %25 + %28 = OpSLessThan %27 %70 %26 + OpLoopMerge %12 %11 None + OpBranchConditional %28 %11 %12 + %11 = OpLabel + %66 = OpCompositeInsert %31 %36 %73 0 + %41 = OpIAdd %6 %70 %40 + OpBranch %10 + %12 = OpLabel + OpBranch %43 + %43 = OpLabel + %72 = OpPhi %31 %73 %12 %68 %44 + %71 = OpPhi %6 %9 %12 %55 %44 + %52 = OpSLessThan %27 %71 %26 + OpLoopMerge %45 %44 None + OpBranchConditional %52 %44 %45 + %44 = OpLabel + %68 = OpCompositeInsert %31 %36 %72 0 + %55 = OpIAdd %6 %71 %40 + OpBranch %43 + %45 = OpLabel + %60 = OpCompositeExtract %29 %72 0 + %61 = OpCompositeExtract %16 %60 0 + %62 = OpCompositeExtract %16 %60 1 + %63 = OpCompositeExtract %16 %60 2 + %64 = OpCompositeConstruct %56 %61 %62 %63 %34 + OpStore %58 %64 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/two-loops-with-break.amber b/vulkan/amber/graphicsfuzz/two-loops-with-break.amber new file mode 100644 index 0000000..dbc0987 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/two-loops-with-break.amber @@ -0,0 +1,217 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with two loops with breaks + +# The test passes because the fragment shader always writes red; the loops do nothing. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec4 GLF_live15c = vec4(0.0); +# for ( +# int GLF_live15i = 0; +# GLF_live15i < 4; +# GLF_live15i++) +# { +# if (GLF_live15i >= 3) +# { +# break; +# } +# if (GLF_live15c[1] >= 1.0) +# { +# GLF_live15c[GLF_live15i] = 1.0; +# } +# } +# vec4 GLF_live15d = vec4(0.0); +# for ( +# int GLF_live15i = 0; +# GLF_live15i < 4; +# GLF_live15i++) +# { +# if (GLF_live15i >= 3) +# { +# break; +# } +# if (GLF_live15d[1] >= 1.0) +# { +# GLF_live15d[GLF_live15i] = 1.0; +# } +# } +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %69 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "GLF_live15c" + OpName %14 "GLF_live15i" + OpName %45 "GLF_live15d" + OpName %46 "GLF_live15i" + OpName %69 "_GLF_color" + OpDecorate %14 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %67 RelaxedPrecision + OpDecorate %69 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypeInt 32 1 + %13 = OpTypePointer Function %12 + %15 = OpConstant %12 0 + %22 = OpConstant %12 4 + %23 = OpTypeBool + %26 = OpConstant %12 3 + %31 = OpTypeInt 32 0 + %32 = OpConstant %31 1 + %33 = OpTypePointer Function %6 + %36 = OpConstant %6 1 + %43 = OpConstant %12 1 + %68 = OpTypePointer Output %7 + %69 = OpVariable %68 Output + %70 = OpConstantComposite %7 %36 %10 %10 %36 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %14 = OpVariable %13 Function + %45 = OpVariable %8 Function + %46 = OpVariable %13 Function + OpStore %9 %11 + OpStore %14 %15 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %21 = OpLoad %12 %14 + %24 = OpSLessThan %23 %21 %22 + OpBranchConditional %24 %17 %18 + %17 = OpLabel + %25 = OpLoad %12 %14 + %27 = OpSGreaterThanEqual %23 %25 %26 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %29 + %28 = OpLabel + OpBranch %18 + %29 = OpLabel + %34 = OpAccessChain %33 %9 %32 + %35 = OpLoad %6 %34 + %37 = OpFOrdGreaterThanEqual %23 %35 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + %40 = OpLoad %12 %14 + %41 = OpAccessChain %33 %9 %40 + OpStore %41 %36 + OpBranch %39 + %39 = OpLabel + OpBranch %19 + %19 = OpLabel + %42 = OpLoad %12 %14 + %44 = OpIAdd %12 %42 %43 + OpStore %14 %44 + OpBranch %16 + %18 = OpLabel + OpStore %45 %11 + OpStore %46 %15 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %12 %46 + %53 = OpSLessThan %23 %52 %22 + OpBranchConditional %53 %48 %49 + %48 = OpLabel + %54 = OpLoad %12 %46 + %55 = OpSGreaterThanEqual %23 %54 %26 + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %57 + %56 = OpLabel + OpBranch %49 + %57 = OpLabel + %59 = OpAccessChain %33 %45 %32 + %60 = OpLoad %6 %59 + %61 = OpFOrdGreaterThanEqual %23 %60 %36 + OpSelectionMerge %63 None + OpBranchConditional %61 %62 %63 + %62 = OpLabel + %64 = OpLoad %12 %46 + %65 = OpAccessChain %33 %45 %64 + OpStore %65 %36 + OpBranch %63 + %63 = OpLabel + OpBranch %50 + %50 = OpLabel + %66 = OpLoad %12 %46 + %67 = OpIAdd %12 %66 %43 + OpStore %46 %67 + OpBranch %47 + %49 = OpLabel + OpStore %69 %70 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/two-nested-do-whiles.amber b/vulkan/amber/graphicsfuzz/two-nested-do-whiles.amber new file mode 100644 index 0000000..40791b9 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/two-nested-do-whiles.amber @@ -0,0 +1,252 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with nested do while + +# The test passes because the shader always writes color red. main() writes red and then returns at the end. + +# Optimized using spirv-opt with the following arguments: +# '--ccp' +# '--redundancy-elimination' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-branches' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# spirv-opt commit hash: ad7f2c5c4c7f51360e9e079109a9217aa5ba5cc0 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Write color red +# +# int i = 0; +# if (injectionSwitch.y < 0.0) // Always false +# { +# } +# else +# { +# if (gl_FragCoord.y < -1.0) // Always false +# { +# } +# else +# { +# do +# { +# if (i >= 256) // Always false +# { +# break; +# } +# do +# { +# for (int i = 0; i < 1; i++) +# { +# if (gl_FragCoord.y < -1.0) // Always false +# { +# for (int i = 0; i < 1; i++) +# { +# } +# continue; +# } +# return; +# } +# } while (false); +# } while (false); +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 87 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %32 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %15 "i" + OpName %18 "buf0" + OpMemberName %18 0 "injectionSwitch" + OpName %20 "" + OpName %32 "gl_FragCoord" + OpName %55 "i" + OpName %69 "i" + OpDecorate %9 Location 0 + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %32 BuiltIn FragCoord + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstant %6 0 + %12 = OpConstantComposite %7 %10 %11 %11 %10 + %13 = OpTypeInt 32 1 + %14 = OpTypePointer Function %13 + %16 = OpConstant %13 0 + %17 = OpTypeVector %6 2 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 1 + %23 = OpTypePointer Uniform %6 + %26 = OpTypeBool + %31 = OpTypePointer Input %7 + %32 = OpVariable %31 Input + %33 = OpTypePointer Input %6 + %36 = OpConstant %6 -1 + %46 = OpConstant %13 256 + %62 = OpConstant %13 1 + %83 = OpConstantFalse %26 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %15 = OpVariable %14 Function + %55 = OpVariable %14 Function + %69 = OpVariable %14 Function + OpStore %9 %12 + OpStore %15 %16 + %24 = OpAccessChain %23 %20 %16 %22 + %25 = OpLoad %6 %24 + %27 = OpFOrdLessThan %26 %25 %11 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %30 + %28 = OpLabel + OpBranch %29 + %30 = OpLabel + %34 = OpAccessChain %33 %32 %22 + %35 = OpLoad %6 %34 + %37 = OpFOrdLessThan %26 %35 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %40 + %38 = OpLabel + OpBranch %39 + %40 = OpLabel + OpBranch %41 + %41 = OpLabel + OpLoopMerge %43 %53 None + OpBranch %42 + %42 = OpLabel + %45 = OpLoad %13 %15 + %47 = OpSGreaterThanEqual %26 %45 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %48 %49 + %48 = OpLabel + OpBranch %43 + %49 = OpLabel + OpBranch %51 + %51 = OpLabel + OpStore %55 %16 + OpLoopMerge %84 %58 None + OpBranch %56 + %56 = OpLabel + %61 = OpLoad %13 %55 + %63 = OpSLessThan %26 %61 %62 + OpLoopMerge %85 %72 None + OpBranchConditional %63 %57 %85 + %57 = OpLabel + OpSelectionMerge %68 None + OpBranchConditional %37 %67 %68 + %67 = OpLabel + OpStore %69 %16 + OpBranch %70 + %70 = OpLabel + %75 = OpLoad %13 %69 + %76 = OpSLessThan %26 %75 %62 + OpLoopMerge %86 %71 None + OpBranchConditional %76 %71 %86 + %71 = OpLabel + %77 = OpLoad %13 %69 + %78 = OpIAdd %13 %77 %62 + OpStore %69 %78 + OpBranch %70 + %86 = OpLabel + OpBranch %72 + %72 = OpLabel + %81 = OpLoad %13 %55 + %82 = OpIAdd %13 %81 %62 + OpStore %55 %82 + OpBranch %56 + %68 = OpLabel + OpReturn + %85 = OpLabel + OpBranch %58 + %58 = OpLabel + OpBranchConditional %83 %51 %84 + %84 = OpLabel + OpBranch %53 + %53 = OpLabel + OpBranchConditional %83 %41 %43 + %43 = OpLabel + OpBranch %39 + %39 = OpLabel + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/two-nested-for-loops-with-returns.amber b/vulkan/amber/graphicsfuzz/two-nested-for-loops-with-returns.amber new file mode 100644 index 0000000..f4a086b --- /dev/null +++ b/vulkan/amber/graphicsfuzz/two-nested-for-loops-with-returns.amber @@ -0,0 +1,211 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A compute shader with two nested for loops + +# The test passes because main always outputs 42.0. + +# Optimized using spirv-opt with the following arguments: +# '--private-to-local' +# '--eliminate-local-multi-store' +# '--simplify-instructions' +# '--eliminate-dead-inserts' +# '--eliminate-dead-branches' +# spirv-opt commit hash: 4a00a80c40484a6f6f72f48c9d34943cf8f180d4 + + + +# variant_compute_shader is derived from the following GLSL: +# #version 310 es +# +# precision highp float; +# +# layout(std430, binding = 0) buffer doesNotMatter +# { +# float _compute_data[]; +# }; +# +# float nb_mod() +# { +# float s = 0.0; +# +# // Loop is entered, but we always return 42.0 during the first iteration. +# for ( +# int i = 5; +# i < 800; +# i++) +# { +# int GLF_live1_looplimiter2; +# +# // Loop is entered and we possibly return. +# for ( +# int GLF_live1i = 0; +# GLF_live1i < 20; +# ++GLF_live1i) +# { +# // GLF_live1_looplimiter2 is undefined, so we may break; doesn't matter. +# if (GLF_live1_looplimiter2 >= 5) +# { +# ++s; +# break; +# } +# // If we didn't break, we return 42.0 here. +# return 42.0; +# } +# +# if (float(i) <= s) // Always false: s is 0.0 or 1.0. +# { +# break; +# } +# // We return 42.0 and we don't loop. +# return 42.0; +# } +# // Unreachable at runtime. +# return s; +# } +# +# void main() +# { +# _compute_data[0] = nb_mod(); // Always returns 42.0. +# } +SHADER compute variant_compute_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 82 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %4 "main" + OpExecutionMode %4 LocalSize 1 1 1 + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "nb_mod(" + OpName %11 "s" + OpName %15 "i" + OpName %26 "GLF_live1i" + OpName %36 "GLF_live1_looplimiter2" + OpName %64 "doesNotMatter" + OpMemberName %64 0 "_compute_data" + OpName %66 "" + OpDecorate %63 ArrayStride 4 + OpMemberDecorate %64 0 Offset 0 + OpDecorate %64 BufferBlock + OpDecorate %66 DescriptorSet 0 + OpDecorate %66 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 0 + %13 = OpTypeInt 32 1 + %14 = OpTypePointer Function %13 + %16 = OpConstant %13 5 + %23 = OpConstant %13 800 + %24 = OpTypeBool + %27 = OpConstant %13 0 + %34 = OpConstant %13 20 + %42 = OpConstant %6 1 + %45 = OpConstant %6 42 + %48 = OpConstant %13 1 + %63 = OpTypeRuntimeArray %6 + %64 = OpTypeStruct %63 + %65 = OpTypePointer Uniform %64 + %66 = OpVariable %65 Uniform + %68 = OpTypePointer Uniform %6 + %74 = OpUndef %13 + %81 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %67 = OpFunctionCall %6 %8 + %69 = OpAccessChain %68 %66 %27 %27 + OpStore %69 %67 + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %15 = OpVariable %14 Function + %26 = OpVariable %14 Function + %36 = OpVariable %14 Function + OpStore %11 %12 + OpStore %15 %16 + OpBranch %17 + %17 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + %25 = OpSLessThan %24 %16 %23 + OpBranchConditional %25 %18 %19 + %18 = OpLabel + OpStore %26 %27 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %35 = OpSLessThan %24 %27 %34 + OpBranchConditional %35 %29 %30 + %29 = OpLabel + %38 = OpSGreaterThanEqual %24 %74 %16 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + %43 = OpFAdd %6 %12 %42 + OpStore %11 %43 + OpBranch %30 + %40 = OpLabel + OpReturnValue %45 + %31 = OpLabel + OpBranch %28 + %30 = OpLabel + %79 = OpPhi %6 %12 %32 %43 %39 + %51 = OpConvertSToF %6 %16 + %53 = OpFOrdLessThanEqual %24 %51 %79 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %55 + %54 = OpLabel + OpBranch %19 + %55 = OpLabel + OpReturnValue %45 + %20 = OpLabel + OpBranch %17 + %19 = OpLabel + %80 = OpPhi %6 %12 %21 %79 %54 + OpReturnValue %80 + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_ssbo DATA_TYPE float DATA + 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +END + +PIPELINE compute variant_pipeline + ATTACH variant_compute_shader + BIND BUFFER variant_ssbo AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN variant_pipeline 7 3 4 + +EXPECT variant_ssbo IDX 0 EQ 42.0 diff --git a/vulkan/amber/graphicsfuzz/two-nested-infinite-loops-discard.amber b/vulkan/amber/graphicsfuzz/two-nested-infinite-loops-discard.amber new file mode 100644 index 0000000..79b4de7 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/two-nested-infinite-loops-discard.amber @@ -0,0 +1,209 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with an always false if function + +# The test passes because main always writes the color red. (Additionally the discard statement is never reached). + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-local-single-block' +# '--reduce-load-size' +# '--combine-access-chains' +# '--eliminate-local-multi-store' +# '--reduce-load-size' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--merge-return' +# '--copy-propagate-arrays' +# '--copy-propagate-arrays' +# '--eliminate-dead-inserts' +# '--merge-blocks' +# '--copy-propagate-arrays' +# '--combine-access-chains' +# '--simplify-instructions' +# '--convert-local-access-chains' +# spirv-opt commit hash: 4a00a80c40484a6f6f72f48c9d34943cf8f180d4 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# +# // END OF GENERATED HEADER +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# vec3 mand() +# { +# for ( +# int k = 0; +# k < 1000; +# 1) +# { +# discard; +# } +# return vec3(1.0); +# } +# void main() +# { +# if (injectionSwitch.x > injectionSwitch.y) +# { +# for ( +# int j = 0; +# j < 4; +# 1) +# { +# mand(); +# } +# } +# +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %57 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "mand(" + OpName %13 "k" + OpName %31 "buf0" + OpMemberName %31 0 "injectionSwitch" + OpName %33 "" + OpName %45 "j" + OpName %57 "_GLF_color" + OpDecorate %13 RelaxedPrecision + OpMemberDecorate %31 0 Offset 0 + OpDecorate %31 Block + OpDecorate %33 DescriptorSet 0 + OpDecorate %33 Binding 0 + OpDecorate %45 RelaxedPrecision + OpDecorate %57 Location 0 + OpDecorate %14 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeFunction %7 + %11 = OpTypeInt 32 1 + %12 = OpTypePointer Function %11 + %14 = OpConstant %11 0 + %21 = OpConstant %11 1000 + %22 = OpTypeBool + %25 = OpConstant %11 1 + %26 = OpConstant %6 1 + %27 = OpConstantComposite %7 %26 %26 %26 + %30 = OpTypeVector %6 2 + %31 = OpTypeStruct %30 + %32 = OpTypePointer Uniform %31 + %33 = OpVariable %32 Uniform + %34 = OpTypeInt 32 0 + %35 = OpConstant %34 0 + %36 = OpTypePointer Uniform %6 + %39 = OpConstant %34 1 + %52 = OpConstant %11 4 + %55 = OpTypeVector %6 4 + %56 = OpTypePointer Output %55 + %57 = OpVariable %56 Output + %58 = OpConstant %6 0 + %59 = OpConstantComposite %55 %26 %58 %58 %26 + %62 = OpUndef %11 + %63 = OpConstantTrue %22 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %45 = OpVariable %12 Function + %37 = OpAccessChain %36 %33 %14 %35 + %38 = OpLoad %6 %37 + %40 = OpAccessChain %36 %33 %14 %39 + %41 = OpLoad %6 %40 + %42 = OpFOrdGreaterThan %22 %38 %41 + OpSelectionMerge %44 None + OpBranchConditional %42 %43 %44 + %43 = OpLabel + OpStore %45 %14 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %48 %47 None + OpBranchConditional %63 %47 %48 + %47 = OpLabel + %54 = OpFunctionCall %7 %9 + OpBranch %46 + %48 = OpLabel + OpBranch %44 + %44 = OpLabel + OpStore %57 %59 + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %13 = OpVariable %12 Function + OpStore %13 %14 + OpBranch %15 + %15 = OpLabel + OpLoopMerge %17 %18 None + OpBranchConditional %63 %16 %17 + %16 = OpLabel + OpTerminateInvocation + %18 = OpLabel + OpBranch %15 + %17 = OpLabel + OpReturnValue %27 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/undefined-assign-in-infinite-loop.amber b/vulkan/amber/graphicsfuzz/undefined-assign-in-infinite-loop.amber new file mode 100644 index 0000000..95411d0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/undefined-assign-in-infinite-loop.amber @@ -0,0 +1,164 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with uninitialized read in infinite loop + +# The test passes because the shader always writes the color red. Uninitialized read in loop is never reached. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Write color red +# +# int donor_replacementGLF_dead6tree[1]; +# int GLF_dead6currentNode; +# int GLF_dead6index = 0; +# +# if (injectionSwitch.y < 0.0){ // always false +# while (true) +# { +# GLF_dead6currentNode = donor_replacementGLF_dead6tree[GLF_dead6index]; +# GLF_dead6index = GLF_dead6currentNode; +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 44 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %15 "GLF_dead6index" + OpName %18 "buf0" + OpMemberName %18 0 "injectionSwitch" + OpName %20 "" + OpName %36 "GLF_dead6currentNode" + OpName %39 "donor_replacementGLF_dead6tree" + OpDecorate %9 Location 0 + OpDecorate %15 RelaxedPrecision + OpMemberDecorate %18 0 Offset 0 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %36 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstant %6 0 + %12 = OpConstantComposite %7 %10 %11 %11 %10 + %13 = OpTypeInt 32 1 + %14 = OpTypePointer Function %13 + %16 = OpConstant %13 0 + %17 = OpTypeVector %6 2 + %18 = OpTypeStruct %17 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 1 + %23 = OpTypePointer Uniform %6 + %26 = OpTypeBool + %35 = OpConstantTrue %26 + %37 = OpTypeArray %13 %22 + %38 = OpTypePointer Function %37 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %15 = OpVariable %14 Function + %36 = OpVariable %14 Function + %39 = OpVariable %38 Function + OpStore %9 %12 + OpStore %15 %16 + %24 = OpAccessChain %23 %20 %16 %22 + %25 = OpLoad %6 %24 + %27 = OpFOrdLessThan %26 %25 %11 + OpSelectionMerge %29 None + OpBranchConditional %27 %28 %29 + %28 = OpLabel + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + OpBranchConditional %35 %31 %32 + %31 = OpLabel + %40 = OpLoad %13 %15 + %41 = OpAccessChain %14 %39 %40 + %42 = OpLoad %13 %41 + OpStore %36 %42 + %43 = OpLoad %13 %36 + OpStore %15 %43 + OpBranch %33 + %33 = OpLabel + OpBranch %30 + %32 = OpLabel + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/undefined-integer-in-function.amber b/vulkan/amber/graphicsfuzz/undefined-integer-in-function.amber new file mode 100644 index 0000000..2d9b6d0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/undefined-integer-in-function.amber @@ -0,0 +1,231 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with nested do while and undefined int + +# The test passes because the shader always writes color red. performPartition() writes the color red and then always returns early. + +# Optimized using spirv-opt with the following arguments: +# '--if-conversion' +# '--redundancy-elimination' +# '--eliminate-local-multi-store' +# '--ccp' +# '--eliminate-local-multi-store' +# '--eliminate-dead-inserts' +# '--ccp' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-inserts' +# '--ccp' +# '--eliminate-dead-branches' +# '--private-to-local' +# '--eliminate-dead-branches' +# spirv-opt commit hash: ad7f2c5c4c7f51360e9e079109a9217aa5ba5cc0 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# int performPartition() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Write color red +# int i; +# do +# { +# if (injectionSwitch.y < 0.0) // Always false +# { +# } +# else +# { +# for (int GLF_live0i = 0; GLF_live0i < 1; GLF_live0i++) +# { +# if (injectionSwitch.y < 0.0) // Always false +# { +# break; +# } +# return 1; // We always return here. The code below is never executed. +# } +# if (injectionSwitch.y < 0.0) +# { +# do +# { +# return 1; +# } while (false); +# } +# } +# } while (false); +# return i; +# } +# +# void main() +# { +# performPartition(); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 80 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "performPartition(" + OpName %13 "_GLF_color" + OpName %22 "buf0" + OpMemberName %22 0 "injectionSwitch" + OpName %24 "" + OpName %37 "GLF_live0i" + OpName %66 "i" + OpDecorate %8 RelaxedPrecision + OpDecorate %13 Location 0 + OpMemberDecorate %22 0 Offset 0 + OpDecorate %22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %37 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %70 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Output %11 + %13 = OpVariable %12 Output + %14 = OpConstant %10 1 + %15 = OpConstant %10 0 + %16 = OpConstantComposite %11 %14 %15 %15 %14 + %21 = OpTypeVector %10 2 + %22 = OpTypeStruct %21 + %23 = OpTypePointer Uniform %22 + %24 = OpVariable %23 Uniform + %25 = OpConstant %6 0 + %26 = OpTypeInt 32 0 + %27 = OpConstant %26 1 + %28 = OpTypePointer Uniform %10 + %31 = OpTypeBool + %36 = OpTypePointer Function %6 + %44 = OpConstant %6 1 + %65 = OpConstantFalse %31 + %74 = OpUndef %6 + %78 = OpConstantTrue %31 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %70 = OpFunctionCall %6 %8 + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %37 = OpVariable %36 Function + %66 = OpVariable %36 Function + OpStore %13 %16 + OpBranch %17 + %17 = OpLabel + %73 = OpPhi %6 %74 %9 %72 %34 + OpLoopMerge %19 %34 None + OpBranch %18 + %18 = OpLabel + %29 = OpAccessChain %28 %24 %25 %27 + %30 = OpLoad %10 %29 + %32 = OpFOrdLessThan %31 %30 %15 + OpSelectionMerge %79 None + OpBranchConditional %32 %33 %35 + %35 = OpLabel + OpStore %37 %25 + OpBranch %38 + %38 = OpLabel + %45 = OpSLessThan %31 %25 %44 + OpLoopMerge %49 %41 None + OpBranch %39 + %39 = OpLabel + OpSelectionMerge %50 None + OpBranchConditional %32 %49 %50 + %49 = OpLabel + OpSelectionMerge %59 None + OpBranchConditional %32 %58 %59 + %50 = OpLabel + OpReturnValue %44 + %41 = OpLabel + OpBranch %38 + %58 = OpLabel + OpBranch %60 + %60 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %61 + %61 = OpLabel + OpReturnValue %44 + %63 = OpLabel + OpBranch %60 + %62 = OpLabel + OpUnreachable + %59 = OpLabel + OpBranch %34 + %33 = OpLabel + OpBranch %34 + %79 = OpLabel + OpBranch %34 + %34 = OpLabel + %72 = OpPhi %6 %73 %33 %73 %59 %25 %79 + OpBranchConditional %65 %17 %19 + %19 = OpLabel + OpReturnValue %72 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/uninit-element-cast-in-loop.amber b/vulkan/amber/graphicsfuzz/uninit-element-cast-in-loop.amber new file mode 100644 index 0000000..0f95cf2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/uninit-element-cast-in-loop.amber @@ -0,0 +1,180 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with uninitialized element cast in loop + +# The test passes because main always writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '--inline-entry-points-exhaustive' +# '--eliminate-local-single-block' +# '--ccp' +# '--eliminate-local-multi-store' +# '--inline-entry-points-exhaustive' +# '--combine-access-chains' +# '--combine-access-chains' +# '--reduce-load-size' +# '--copy-propagate-arrays' +# '--reduce-load-size' +# '--eliminate-local-multi-store' +# '--scalar-replacement=100' +# '--convert-local-access-chains' +# '--scalar-replacement=100' +# '--vector-dce' +# '--eliminate-dead-inserts' +# '--scalar-replacement=100' +# '--eliminate-dead-inserts' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--ccp' +# '--copy-propagate-arrays' +# '--combine-access-chains' +# '--eliminate-local-multi-store' +# spirv-opt commit hash: 06407250a169c6a03b3765e86619075af1a8c187 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 { vec2 injectionSwitch; }; +# +# void main() +# { +# while(true) +# { +# while(false) +# break; +# +# float uninit[1]; +# float(uninit[0]); +# +# if (injectionSwitch.x < injectionSwitch.y) // always true +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# return; +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %46 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %32 "buf0" + OpMemberName %32 0 "injectionSwitch" + OpName %34 "" + OpName %46 "_GLF_color" + OpMemberDecorate %32 0 Offset 0 + OpDecorate %32 Block + OpDecorate %34 DescriptorSet 0 + OpDecorate %34 Binding 0 + OpDecorate %46 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %11 = OpTypeBool + %12 = OpConstantTrue %11 + %18 = OpConstantFalse %11 + %20 = OpTypeFloat 32 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 1 + %23 = OpTypeArray %20 %22 + %24 = OpTypePointer Function %23 + %26 = OpTypeInt 32 1 + %27 = OpConstant %26 0 + %28 = OpTypePointer Function %20 + %31 = OpTypeVector %20 2 + %32 = OpTypeStruct %31 + %33 = OpTypePointer Uniform %32 + %34 = OpVariable %33 Uniform + %35 = OpConstant %21 0 + %36 = OpTypePointer Uniform %20 + %44 = OpTypeVector %20 4 + %45 = OpTypePointer Output %44 + %46 = OpVariable %45 Output + %47 = OpConstant %20 1 + %48 = OpConstant %20 0 + %49 = OpConstantComposite %44 %47 %48 %48 %47 + %54 = OpUndef %20 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %51 = OpVariable %28 Function + OpBranch %6 + %6 = OpLabel + %53 = OpPhi %20 %54 %5 %52 %43 + OpLoopMerge %8 %43 None + OpBranch %13 + %13 = OpLabel + %52 = OpPhi %20 %53 %6 %54 %16 + %37 = OpAccessChain %36 %34 %27 %35 + %38 = OpLoad %20 %37 + %39 = OpAccessChain %36 %34 %27 %22 + %40 = OpLoad %20 %39 + %41 = OpFOrdLessThan %11 %38 %40 + OpSelectionMerge %55 None + OpBranchConditional %41 %42 %43 + %16 = OpLabel + OpBranch %13 + %42 = OpLabel + OpStore %46 %49 + OpReturn + %55 = OpLabel + OpBranch %43 + %43 = OpLabel + OpBranch %6 + %8 = OpLabel + OpUnreachable + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/uninitialized-var-decrement-and-add.amber b/vulkan/amber/graphicsfuzz/uninitialized-var-decrement-and-add.amber new file mode 100644 index 0000000..b4de31a --- /dev/null +++ b/vulkan/amber/graphicsfuzz/uninitialized-var-decrement-and-add.amber @@ -0,0 +1,133 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader that uses an uninitialized variable + +# The test passes because the shader always writes the color red. +# The update to _GLF_color.x has no effect on visible pixels. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# +# uint foo; +# +# // For visible pixels, this is equivalent to: _GLF_color.x = _GLF_color.x; +# _GLF_color.x = gl_FragCoord.x > -1.0 ? _GLF_color.x : float(178493u + (--foo)); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %14 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "gl_FragCoord" + OpName %33 "foo" + OpDecorate %9 Location 0 + OpDecorate %14 BuiltIn FragCoord + OpDecorate %33 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstant %6 0 + %12 = OpConstantComposite %7 %10 %11 %11 %10 + %13 = OpTypePointer Input %7 + %14 = OpVariable %13 Input + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 0 + %17 = OpTypePointer Input %6 + %20 = OpConstant %6 -1 + %21 = OpTypeBool + %23 = OpTypePointer Function %6 + %27 = OpTypePointer Output %6 + %31 = OpConstant %15 178493 + %32 = OpTypePointer Function %15 + %35 = OpTypeInt 32 1 + %36 = OpConstant %35 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %24 = OpVariable %23 Function + %33 = OpVariable %32 Function + OpStore %9 %12 + %18 = OpAccessChain %17 %14 %16 + %19 = OpLoad %6 %18 + %22 = OpFOrdGreaterThan %21 %19 %20 + OpSelectionMerge %26 None + OpBranchConditional %22 %25 %30 + %25 = OpLabel + %28 = OpAccessChain %27 %9 %16 + %29 = OpLoad %6 %28 + OpStore %24 %29 + OpBranch %26 + %30 = OpLabel + %34 = OpLoad %15 %33 + %37 = OpISub %15 %34 %36 + OpStore %33 %37 + %38 = OpIAdd %15 %31 %37 + %39 = OpConvertUToF %6 %38 + OpStore %24 %39 + OpBranch %26 + %26 = OpLabel + %40 = OpLoad %6 %24 + %41 = OpAccessChain %27 %9 %16 + OpStore %41 %40 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/unreachable-barrier-in-loops.amber b/vulkan/amber/graphicsfuzz/unreachable-barrier-in-loops.amber new file mode 100644 index 0000000..5bbee9f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/unreachable-barrier-in-loops.amber @@ -0,0 +1,373 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# Short description: A compute shader with an unreachable barrier in a loop nest + +# The test passes because the compute shader has a single global invocation that +# is guaranteed to set 'value' to (0.0, 0.0, 0.0, 1.0), and that writes the +# components of 'value', cast to integers, to '_compute_data' at the end of +# execution. The early return is unreachable. + +# Derived from the following GLSL. + +# Compute shader GLSL: +# #version 310 es +# +# precision highp float; +# +# layout(set = 0, binding = 2) uniform buf2 { +# vec2 resolution; +# }; +# +# layout(set = 0, binding = 1) uniform buf1 { +# vec2 injectionSwitch; +# }; +# +# layout(std430, binding = 0) buffer doesNotMatter { +# int _compute_data[]; +# }; +# +# layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +# +# void main(void) +# { +# vec4 value; +# float A[1]; +# A[0] = 0.0; +# for(int i = 0; i < 50; i++) { +# if(i > 0) { +# A[0] += A[0]; +# } +# } +# do { +# if(gl_GlobalInvocationID.x < 100u) { +# value = vec4(0.0, 0.0, 0.0, 1.0); +# for(int m = 0; m < 1; m++) { +# for(int l = 0; l < 1; l++) { +# if(injectionSwitch.x > injectionSwitch.y) +# return; +# } +# } +# for(int n = 0; n < 1; n ++) { +# if(injectionSwitch.x > injectionSwitch.y) +# barrier(); +# } +# } else { +# if(gl_GlobalInvocationID.x < 120u) { +# value = vec4(A[0] / resolution.x, A[0] / resolution.y, 0.0, 1.0); +# } else { +# if(injectionSwitch.x > injectionSwitch.y) +# continue; +# } +# } +# } while(false); +# _compute_data[0] = int(value.x); +# _compute_data[1] = int(value.y); +# _compute_data[2] = int(value.z); +# _compute_data[3] = int(value.w); +# } + +[compute shader spirv] +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 168 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %4 "main" %47 + OpExecutionMode %4 LocalSize 1 1 1 + OpSource ESSL 310 + OpName %4 "main" + OpName %11 "A" + OpName %18 "i" + OpName %47 "gl_GlobalInvocationID" + OpName %58 "value" + OpName %61 "m" + OpName %69 "l" + OpName %78 "buf1" + OpMemberName %78 0 "injectionSwitch" + OpName %80 "" + OpName %94 "n" + OpName %122 "buf2" + OpMemberName %122 0 "resolution" + OpName %124 "" + OpName %145 "doesNotMatter" + OpMemberName %145 0 "_compute_data" + OpName %147 "" + OpDecorate %47 BuiltIn GlobalInvocationId + OpMemberDecorate %78 0 Offset 0 + OpDecorate %78 Block + OpDecorate %80 DescriptorSet 0 + OpDecorate %80 Binding 1 + OpMemberDecorate %122 0 Offset 0 + OpDecorate %122 Block + OpDecorate %124 DescriptorSet 0 + OpDecorate %124 Binding 2 + OpDecorate %144 ArrayStride 4 + OpMemberDecorate %145 0 Offset 0 + OpDecorate %145 BufferBlock + OpDecorate %147 DescriptorSet 0 + OpDecorate %147 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 1 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Function %9 + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpConstant %6 0 + %15 = OpTypePointer Function %6 + %17 = OpTypePointer Function %12 + %25 = OpConstant %12 50 + %26 = OpTypeBool + %39 = OpConstant %12 1 + %45 = OpTypeVector %7 3 + %46 = OpTypePointer Input %45 + %47 = OpVariable %46 Input + %48 = OpConstant %7 0 + %49 = OpTypePointer Input %7 + %52 = OpConstant %7 100 + %56 = OpTypeVector %6 4 + %57 = OpTypePointer Function %56 + %59 = OpConstant %6 1 + %60 = OpConstantComposite %56 %14 %14 %14 %59 + %77 = OpTypeVector %6 2 + %78 = OpTypeStruct %77 + %79 = OpTypePointer Uniform %78 + %80 = OpVariable %79 Uniform + %81 = OpTypePointer Uniform %6 + %109 = OpConstant %7 2 + %110 = OpConstant %7 264 + %116 = OpConstant %7 120 + %122 = OpTypeStruct %77 + %123 = OpTypePointer Uniform %122 + %124 = OpVariable %123 Uniform + %143 = OpConstantFalse %26 + %144 = OpTypeRuntimeArray %12 + %145 = OpTypeStruct %144 + %146 = OpTypePointer Uniform %145 + %147 = OpVariable %146 Uniform + %151 = OpTypePointer Uniform %12 + %157 = OpConstant %12 2 + %162 = OpConstant %12 3 + %163 = OpConstant %7 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + %18 = OpVariable %17 Function + %58 = OpVariable %57 Function + %61 = OpVariable %17 Function + %69 = OpVariable %17 Function + %94 = OpVariable %17 Function + %16 = OpAccessChain %15 %11 %13 + OpStore %16 %14 + OpStore %18 %13 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %12 %18 + %27 = OpSLessThan %26 %24 %25 + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %28 = OpLoad %12 %18 + %29 = OpSGreaterThan %26 %28 %13 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %31 + %30 = OpLabel + %32 = OpAccessChain %15 %11 %13 + %33 = OpLoad %6 %32 + %34 = OpAccessChain %15 %11 %13 + %35 = OpLoad %6 %34 + %36 = OpFAdd %6 %35 %33 + %37 = OpAccessChain %15 %11 %13 + OpStore %37 %36 + OpBranch %31 + %31 = OpLabel + OpBranch %22 + %22 = OpLabel + %38 = OpLoad %12 %18 + %40 = OpIAdd %12 %38 %39 + OpStore %18 %40 + OpBranch %19 + %21 = OpLabel + OpBranch %41 + %41 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %42 + %42 = OpLabel + %50 = OpAccessChain %49 %47 %48 + %51 = OpLoad %7 %50 + %53 = OpULessThan %26 %51 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %113 + %54 = OpLabel + OpStore %58 %60 + OpStore %61 %13 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpLoad %12 %61 + %68 = OpSLessThan %26 %67 %39 + OpBranchConditional %68 %63 %64 + %63 = OpLabel + OpStore %69 %13 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %12 %69 + %76 = OpSLessThan %26 %75 %39 + OpBranchConditional %76 %71 %72 + %71 = OpLabel + %82 = OpAccessChain %81 %80 %13 %48 + %83 = OpLoad %6 %82 + %84 = OpAccessChain %81 %80 %13 %8 + %85 = OpLoad %6 %84 + %86 = OpFOrdGreaterThan %26 %83 %85 + OpSelectionMerge %88 None + OpBranchConditional %86 %87 %88 + %87 = OpLabel + OpReturn + %88 = OpLabel + OpBranch %73 + %73 = OpLabel + %90 = OpLoad %12 %69 + %91 = OpIAdd %12 %90 %39 + OpStore %69 %91 + OpBranch %70 + %72 = OpLabel + OpBranch %65 + %65 = OpLabel + %92 = OpLoad %12 %61 + %93 = OpIAdd %12 %92 %39 + OpStore %61 %93 + OpBranch %62 + %64 = OpLabel + OpStore %94 %13 + OpBranch %95 + %95 = OpLabel + OpLoopMerge %97 %98 None + OpBranch %99 + %99 = OpLabel + %100 = OpLoad %12 %94 + %101 = OpSLessThan %26 %100 %39 + OpBranchConditional %101 %96 %97 + %96 = OpLabel + %102 = OpAccessChain %81 %80 %13 %48 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %81 %80 %13 %8 + %105 = OpLoad %6 %104 + %106 = OpFOrdGreaterThan %26 %103 %105 + OpSelectionMerge %108 None + OpBranchConditional %106 %107 %108 + %107 = OpLabel + OpControlBarrier %109 %109 %110 + OpBranch %108 + %108 = OpLabel + OpBranch %98 + %98 = OpLabel + %111 = OpLoad %12 %94 + %112 = OpIAdd %12 %111 %39 + OpStore %94 %112 + OpBranch %95 + %97 = OpLabel + OpBranch %55 + %113 = OpLabel + %114 = OpAccessChain %49 %47 %48 + %115 = OpLoad %7 %114 + %117 = OpULessThan %26 %115 %116 + OpSelectionMerge %119 None + OpBranchConditional %117 %118 %134 + %118 = OpLabel + %120 = OpAccessChain %15 %11 %13 + %121 = OpLoad %6 %120 + %125 = OpAccessChain %81 %124 %13 %48 + %126 = OpLoad %6 %125 + %127 = OpFDiv %6 %121 %126 + %128 = OpAccessChain %15 %11 %13 + %129 = OpLoad %6 %128 + %130 = OpAccessChain %81 %124 %13 %8 + %131 = OpLoad %6 %130 + %132 = OpFDiv %6 %129 %131 + %133 = OpCompositeConstruct %56 %127 %132 %14 %59 + OpStore %58 %133 + OpBranch %119 + %134 = OpLabel + %135 = OpAccessChain %81 %80 %13 %48 + %136 = OpLoad %6 %135 + %137 = OpAccessChain %81 %80 %13 %8 + %138 = OpLoad %6 %137 + %139 = OpFOrdGreaterThan %26 %136 %138 + OpSelectionMerge %141 None + OpBranchConditional %139 %140 %141 + %140 = OpLabel + OpBranch %44 + %141 = OpLabel + OpBranch %119 + %119 = OpLabel + OpBranch %55 + %55 = OpLabel + OpBranch %44 + %44 = OpLabel + OpBranchConditional %143 %41 %43 + %43 = OpLabel + %148 = OpAccessChain %15 %58 %48 + %149 = OpLoad %6 %148 + %150 = OpConvertFToS %12 %149 + %152 = OpAccessChain %151 %147 %13 %13 + OpStore %152 %150 + %153 = OpAccessChain %15 %58 %8 + %154 = OpLoad %6 %153 + %155 = OpConvertFToS %12 %154 + %156 = OpAccessChain %151 %147 %13 %39 + OpStore %156 %155 + %158 = OpAccessChain %15 %58 %109 + %159 = OpLoad %6 %158 + %160 = OpConvertFToS %12 %159 + %161 = OpAccessChain %151 %147 %13 %157 + OpStore %161 %160 + %164 = OpAccessChain %15 %58 %163 + %165 = OpLoad %6 %164 + %166 = OpConvertFToS %12 %165 + %167 = OpAccessChain %151 %147 %13 %162 + OpStore %167 %166 + OpReturn + OpFunctionEnd + + +[test] +## Uniforms +# injectionSwitch +uniform ubo 0:1 vec2 0 0.0 1.0 +# resolution +uniform ubo 0:2 vec2 0 256.0 256.0 +## SSBO +ssbo 0 subdata int 0 0 0 0 0 + +compute 3 1 1 +probe ssbo int 0 0 == 0 +probe ssbo int 0 4 == 0 +probe ssbo int 0 8 == 0 +probe ssbo int 0 12 == 1 diff --git a/vulkan/amber/graphicsfuzz/unreachable-continue-statement.amber b/vulkan/amber/graphicsfuzz/unreachable-continue-statement.amber new file mode 100644 index 0000000..318c942 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/unreachable-continue-statement.amber @@ -0,0 +1,182 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with unreachable continue statement + +# The test passes because the shader always writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-local-single-store' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--combine-access-chains' +# '--vector-dce' +# '--eliminate-dead-branches' +# spirv-opt commit hash: 06407250a169c6a03b3765e86619075af1a8c187 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# vec3 computeColor() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# +# for ( +# int _injected_loop_counter = 1; +# true; +# 1) +# { +# if (injectionSwitch.x > 1.0) // Always false +# { +# if (injectionSwitch.x > 1.0) +# { +# } +# continue; +# } +# return vec3(1.0); +# } +# return vec3(1.0); +# } +# void main() +# { +# computeColor(); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %13 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "computeColor(" + OpName %13 "_GLF_color" + OpName %19 "_injected_loop_counter" + OpName %29 "buf0" + OpMemberName %29 0 "injectionSwitch" + OpName %31 "" + OpDecorate %13 Location 0 + OpDecorate %19 RelaxedPrecision + OpMemberDecorate %29 0 Offset 0 + OpDecorate %29 Block + OpDecorate %31 DescriptorSet 0 + OpDecorate %31 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeFunction %7 + %11 = OpTypeVector %6 4 + %12 = OpTypePointer Output %11 + %13 = OpVariable %12 Output + %14 = OpConstant %6 1 + %15 = OpConstant %6 0 + %16 = OpConstantComposite %11 %14 %15 %15 %14 + %17 = OpTypeInt 32 1 + %18 = OpTypePointer Function %17 + %20 = OpConstant %17 1 + %26 = OpTypeBool + %27 = OpConstantTrue %26 + %28 = OpTypeVector %6 2 + %29 = OpTypeStruct %28 + %30 = OpTypePointer Uniform %29 + %31 = OpVariable %30 Uniform + %32 = OpConstant %17 0 + %33 = OpTypeInt 32 0 + %34 = OpConstant %33 0 + %35 = OpTypePointer Uniform %6 + %47 = OpConstantComposite %7 %14 %14 %14 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %51 = OpFunctionCall %7 %9 + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %19 = OpVariable %18 Function + OpStore %13 %16 + OpStore %19 %20 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %23 %45 None + OpBranch %22 + %22 = OpLabel + %36 = OpAccessChain %35 %31 %32 %34 + %37 = OpLoad %6 %36 + %38 = OpFOrdGreaterThan %26 %37 %14 + OpSelectionMerge %40 None + OpBranchConditional %38 %39 %40 + %39 = OpLabel + %41 = OpAccessChain %35 %31 %32 %34 + %42 = OpLoad %6 %41 + %43 = OpFOrdGreaterThan %26 %42 %14 + OpSelectionMerge %52 None + OpBranchConditional %43 %44 %45 + %44 = OpLabel + OpBranch %45 + %52 = OpLabel + OpBranch %45 + %45 = OpLabel + OpBranch %21 + %40 = OpLabel + OpReturnValue %47 + %23 = OpLabel + OpUnreachable + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/unreachable-discard-statement-in-if.amber b/vulkan/amber/graphicsfuzz/unreachable-discard-statement-in-if.amber new file mode 100644 index 0000000..f5dcbc1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/unreachable-discard-statement-in-if.amber @@ -0,0 +1,189 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with discard keyword and a return + +# The test passes because main always writes the color red; the discard statement is unreachable. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--merge-blocks' +# spirv-opt commit hash: 230c9e437146e48ec58adb4433890403c23c98fa + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# vec3 computePoint() +# { +# if (injectionSwitch.x > injectionSwitch.y) // always false +# { +# discard; +# return vec3(1.0); +# } +# } +# void main() +# { +# +# computePoint(); +# if (false) +# { +# } +# if (gl_FragCoord.x < 0.0) +# { +# return; +# } +# computePoint(); +# +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %40 %51 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "computePoint(" + OpName %12 "buf0" + OpMemberName %12 0 "injectionSwitch" + OpName %14 "" + OpName %40 "gl_FragCoord" + OpName %51 "_GLF_color" + OpMemberDecorate %12 0 Offset 0 + OpDecorate %12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %40 BuiltIn FragCoord + OpDecorate %51 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeFunction %7 + %11 = OpTypeVector %6 2 + %12 = OpTypeStruct %11 + %13 = OpTypePointer Uniform %12 + %14 = OpVariable %13 Uniform + %15 = OpTypeInt 32 1 + %16 = OpConstant %15 0 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %17 1 + %25 = OpTypeBool + %30 = OpConstant %6 1 + %31 = OpConstantComposite %7 %30 %30 %30 + %35 = OpConstantFalse %25 + %38 = OpTypeVector %6 4 + %39 = OpTypePointer Input %38 + %40 = OpVariable %39 Input + %41 = OpTypePointer Input %6 + %44 = OpConstant %6 0 + %50 = OpTypePointer Output %38 + %51 = OpVariable %50 Output + %52 = OpConstantComposite %38 %30 %44 %44 %30 + %57 = OpTypePointer Function %25 + %59 = OpConstantTrue %25 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %58 = OpVariable %57 Function %35 + OpBranch %54 + %54 = OpLabel + %34 = OpFunctionCall %7 %9 + OpLoopMerge %53 %56 None + OpBranch %37 + %37 = OpLabel + %42 = OpAccessChain %41 %40 %18 + %43 = OpLoad %6 %42 + %45 = OpFOrdLessThan %25 %43 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + OpStore %58 %59 + OpBranch %53 + %47 = OpLabel + %49 = OpFunctionCall %7 %9 + OpStore %51 %52 + OpStore %58 %59 + OpBranch %53 + %56 = OpLabel + OpBranch %54 + %53 = OpLabel + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %20 = OpAccessChain %19 %14 %16 %18 + %21 = OpLoad %6 %20 + %23 = OpAccessChain %19 %14 %16 %22 + %24 = OpLoad %6 %23 + %26 = OpFOrdGreaterThan %25 %21 %24 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + OpTerminateInvocation + %28 = OpLabel + %33 = OpUndef %7 + OpReturnValue %33 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/unreachable-discard-statement.amber b/vulkan/amber/graphicsfuzz/unreachable-discard-statement.amber new file mode 100644 index 0000000..deb0f16 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/unreachable-discard-statement.amber @@ -0,0 +1,198 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with unreachable discard statement + +# The test passes because the shader always writes the color red. The discard statement is never reached. + +# Optimized using spirv-opt with the following arguments: +# '--scalar-replacement=100' +# '--private-to-local' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--private-to-local' +# '--copy-propagate-arrays' +# '--scalar-replacement=100' +# '--combine-access-chains' +# '--vector-dce' +# '--convert-local-access-chains' +# '--if-conversion' +# '--eliminate-dead-branches' +# '--merge-return' +# '--ccp' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--combine-access-chains' +# '--eliminate-local-single-block' +# '--copy-propagate-arrays' +# '--ccp' +# '--private-to-local' +# '--private-to-local' +# spirv-opt commit hash: 06407250a169c6a03b3765e86619075af1a8c187 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# vec3 mand() +# { +# for (int k = 0; k < 1000; k++) +# return vec3(1.0); +# +# discard; // This statement is never reached +# return vec3(1.0); +# } +# +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# +# for (int i = 0; i < 4; i++) +# mand(); +# +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %35 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "mand(" + OpName %13 "k" + OpName %35 "_GLF_color" + OpName %38 "i" + OpDecorate %13 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %35 Location 0 + OpDecorate %38 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeFunction %7 + %11 = OpTypeInt 32 1 + %12 = OpTypePointer Function %11 + %14 = OpConstant %11 0 + %21 = OpConstant %11 1000 + %22 = OpTypeBool + %24 = OpConstant %6 1 + %25 = OpConstantComposite %7 %24 %24 %24 + %28 = OpConstant %11 1 + %33 = OpTypeVector %6 4 + %34 = OpTypePointer Output %33 + %35 = OpVariable %34 Output + %36 = OpConstant %6 0 + %37 = OpConstantComposite %33 %24 %36 %36 %24 + %45 = OpConstant %11 4 + %51 = OpTypePointer Function %7 + %57 = OpConstantFalse %22 + %58 = OpTypePointer Function %22 + %60 = OpConstantTrue %22 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %38 = OpVariable %12 Function + OpStore %35 %37 + OpStore %38 %14 + OpBranch %39 + %39 = OpLabel + %44 = OpLoad %11 %38 + %46 = OpSLessThan %22 %44 %45 + OpLoopMerge %41 %40 None + OpBranchConditional %46 %40 %41 + %40 = OpLabel + %47 = OpFunctionCall %7 %9 + %48 = OpLoad %11 %38 + %49 = OpIAdd %11 %48 %28 + OpStore %38 %49 + OpBranch %39 + %41 = OpLabel + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %59 = OpVariable %58 Function %57 + %52 = OpVariable %51 Function + %13 = OpVariable %12 Function + OpBranch %54 + %54 = OpLabel + OpStore %13 %14 + OpLoopMerge %50 %56 None + OpBranch %15 + %15 = OpLabel + %20 = OpLoad %11 %13 + %23 = OpSLessThan %22 %20 %21 + OpLoopMerge %17 %18 None + OpBranchConditional %23 %16 %17 + %16 = OpLabel + OpStore %59 %60 + OpStore %52 %25 + OpBranch %17 + %18 = OpLabel + OpBranch %15 + %17 = OpLabel + %62 = OpLoad %22 %59 + OpSelectionMerge %61 None + OpBranchConditional %62 %50 %61 + %61 = OpLabel + OpTerminateInvocation + %56 = OpLabel + OpBranch %54 + %50 = OpLabel + %53 = OpLoad %7 %52 + OpReturnValue %53 + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/unreachable-loops-in-switch.amber b/vulkan/amber/graphicsfuzz/unreachable-loops-in-switch.amber new file mode 100644 index 0000000..8801663 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/unreachable-loops-in-switch.amber @@ -0,0 +1,193 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with unreachable loops in a switch + +# The test passes because the fragment shader writes a red pixel, and then +# terminates without further output manipulation. + +# Derived from the following GLSL. + +# Fragment shader GLSL: +# #version 310 es +# +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# float data[1]; +# for(int i = 0; i < 1; i++) { +# if(data[i] < data[0]) { +# if(false) { +# if(float(i) >= 1.0) { } +# } +# switch(0) { +# case 1: +# for(; 1 > 0;) { } +# for(;;) { } +# case 0: +# data[0] = 2.0; +# break; +# } +# } +# } +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %15 "i" + OpName %30 "data" + OpDecorate %9 Location 0 + OpDecorate %15 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %65 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstant %6 0 + %12 = OpConstantComposite %7 %10 %11 %11 %10 + %13 = OpTypeInt 32 1 + %14 = OpTypePointer Function %13 + %16 = OpConstant %13 0 + %23 = OpConstant %13 1 + %24 = OpTypeBool + %26 = OpTypeInt 32 0 + %27 = OpConstant %26 1 + %28 = OpTypeArray %6 %27 + %29 = OpTypePointer Function %28 + %32 = OpTypePointer Function %6 + %40 = OpConstantFalse %24 + %56 = OpConstantTrue %24 + %61 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %15 = OpVariable %14 Function + %30 = OpVariable %29 Function + OpStore %9 %12 + OpStore %15 %16 + OpBranch %17 + %17 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + %22 = OpLoad %13 %15 + %25 = OpSLessThan %24 %22 %23 + OpBranchConditional %25 %18 %19 + %18 = OpLabel + %31 = OpLoad %13 %15 + %33 = OpAccessChain %32 %30 %31 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %32 %30 %16 + %36 = OpLoad %6 %35 + %37 = OpFOrdLessThan %24 %34 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + OpSelectionMerge %42 None + OpBranchConditional %40 %41 %42 + %41 = OpLabel + %43 = OpLoad %13 %15 + %44 = OpConvertSToF %6 %43 + %45 = OpFOrdGreaterThanEqual %24 %44 %10 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %47 + %46 = OpLabel + OpBranch %47 + %47 = OpLabel + OpBranch %42 + %42 = OpLabel + OpSelectionMerge %50 None + OpSwitch %16 %50 1 %48 0 %49 + %48 = OpLabel + OpBranch %51 + %51 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + OpBranchConditional %56 %52 %53 + %52 = OpLabel + OpBranch %54 + %54 = OpLabel + OpBranch %51 + %53 = OpLabel + OpBranch %57 + %57 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %58 + %58 = OpLabel + OpBranch %60 + %60 = OpLabel + OpBranch %57 + %59 = OpLabel + OpBranch %49 + %49 = OpLabel + %62 = OpAccessChain %32 %30 %16 + OpStore %62 %61 + OpBranch %50 + %50 = OpLabel + OpBranch %39 + %39 = OpLabel + OpBranch %20 + %20 = OpLabel + %65 = OpLoad %13 %15 + %66 = OpIAdd %13 %65 %23 + OpStore %15 %66 + OpBranch %17 + %19 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/unreachable-loops.amber b/vulkan/amber/graphicsfuzz/unreachable-loops.amber new file mode 100644 index 0000000..958679f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/unreachable-loops.amber @@ -0,0 +1,166 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: Fragment shader that writes red despite unreachable loops + +# The test passes because red is written, and the loops inside the if (one of +# which would be infinite) are dynamically unreachable due to the runtime content +# of 'injected'. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injected; +# }; +# +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# if (injected.x > injected.y) { +# do +# { +# } +# while(false); +# { +# for( +# int m = 1; +# true; +# 1 +# ) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# } +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %14 "buf0" + OpMemberName %14 0 "injected" + OpName %16 "" + OpName %37 "m" + OpDecorate %9 Location 0 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %37 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstant %6 0 + %12 = OpConstantComposite %7 %10 %11 %11 %10 + %13 = OpTypeVector %6 2 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 0 + %21 = OpTypePointer Uniform %6 + %24 = OpConstant %19 1 + %27 = OpTypeBool + %35 = OpConstantFalse %27 + %36 = OpTypePointer Function %17 + %38 = OpConstant %17 1 + %44 = OpConstantTrue %27 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %37 = OpVariable %36 Function + OpStore %9 %12 + %22 = OpAccessChain %21 %16 %18 %20 + %23 = OpLoad %6 %22 + %25 = OpAccessChain %21 %16 %18 %24 + %26 = OpLoad %6 %25 + %28 = OpFOrdGreaterThan %27 %23 %26 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %30 + %29 = OpLabel + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %32 + %32 = OpLabel + OpBranch %34 + %34 = OpLabel + OpBranchConditional %35 %31 %33 + %33 = OpLabel + OpStore %37 %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + OpBranchConditional %44 %40 %41 + %40 = OpLabel + OpStore %9 %12 + OpBranch %42 + %42 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# resolution +BUFFER variant_resolution DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics gfz_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR gfz_pipeline 0 0 0 255 + +CLEAR gfz_pipeline +RUN gfz_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer IDX 0 0 SIZE 256 256 EQ_RGB 255 0 0 \ No newline at end of file diff --git a/vulkan/amber/graphicsfuzz/unreachable-return-in-loop.amber b/vulkan/amber/graphicsfuzz/unreachable-return-in-loop.amber new file mode 100644 index 0000000..7cd587f --- /dev/null +++ b/vulkan/amber/graphicsfuzz/unreachable-return-in-loop.amber @@ -0,0 +1,150 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with an unreachable return in a loop + +# The test passes because main always writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '--simplify-instructions' +# '--eliminate-local-single-store' +# '--simplify-instructions' +# '--inline-entry-points-exhaustive' +# '--reduce-load-size' +# '--eliminate-dead-branches' +# '--merge-return' +# '--inline-entry-points-exhaustive' +# '--private-to-local' +# '--eliminate-dead-branches' +# '--merge-return' +# '--copy-propagate-arrays' +# '--convert-local-access-chains' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-store' +# '--copy-propagate-arrays' +# '--scalar-replacement=100' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-dead-branches' +# '--if-conversion' +# '--copy-propagate-arrays' +# '--reduce-load-size' +# '--eliminate-local-multi-store' +# '--eliminate-dead-code-aggressive' +# '--convert-local-access-chains' +# '--private-to-local' +# '--if-conversion' +# spirv-opt commit hash: ad7f2c5c4c7f51360e9e079109a9217aa5ba5cc0 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# for(int i = 1; i < 0; i++) +# return; +# +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %25 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %25 "_GLF_color" + OpDecorate %25 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %9 = OpConstant %6 1 + %16 = OpConstant %6 0 + %17 = OpTypeBool + %22 = OpTypeFloat 32 + %23 = OpTypeVector %22 4 + %24 = OpTypePointer Output %23 + %25 = OpVariable %24 Output + %26 = OpConstant %22 1 + %27 = OpConstant %22 0 + %28 = OpConstantComposite %23 %26 %27 %27 %26 + %33 = OpConstantFalse %17 + %36 = OpConstantTrue %17 + %42 = OpUndef %17 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %30 + %30 = OpLabel + %41 = OpPhi %17 %33 %5 %42 %32 + OpLoopMerge %29 %32 None + OpBranch %10 + %10 = OpLabel + %40 = OpPhi %17 %41 %30 %42 %13 + %18 = OpSLessThan %17 %9 %16 + OpLoopMerge %12 %13 None + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %12 + %13 = OpLabel + OpBranch %10 + %12 = OpLabel + %39 = OpPhi %17 %40 %10 %36 %11 + OpSelectionMerge %37 None + OpBranchConditional %39 %29 %37 + %37 = OpLabel + OpStore %25 %28 + OpBranch %29 + %32 = OpLabel + OpBranch %30 + %29 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/unreachable-switch-case-with-discards.amber b/vulkan/amber/graphicsfuzz/unreachable-switch-case-with-discards.amber new file mode 100644 index 0000000..bb70d8e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/unreachable-switch-case-with-discards.amber @@ -0,0 +1,228 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A shader with a switch statement containing unreachable discards + +# The test passes because the shader always writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '-O' +# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# vec3 drawShape(vec2 square) +# { +# switch(int(injectionSwitch.x)) +# { +# case 0: +# return vec3(1.0, 0.0, 0.0); +# case 67: +# do +# { +# if(1.0 < square.x) +# { +# } +# else +# { +# discard; +# } +# discard; +# } +# while(true); +# } +# return vec3(1.0); +# } +# void main() +# { +# vec2 center; +# vec3 color = vec3(0.0); +# for( +# int i = 0; +# i < 1; +# i++ +# ) +# { +# color = drawShape(center); +# if(length(color) <= 0.0) +# { +# continue; +# } +# } +# _GLF_color = vec4(color, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 139 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %78 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %14 "buf0" + OpMemberName %14 0 "injectionSwitch" + OpName %16 "" + OpName %78 "_GLF_color" + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %75 RelaxedPrecision + OpDecorate %78 Location 0 + OpDecorate %132 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %9 = OpTypeVector %6 3 + %14 = OpTypeStruct %7 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 0 + %21 = OpTypePointer Uniform %6 + %28 = OpConstant %6 1 + %29 = OpConstant %6 0 + %30 = OpConstantComposite %9 %28 %29 %29 + %39 = OpTypeBool + %48 = OpConstantComposite %9 %28 %28 %28 + %53 = OpConstantComposite %9 %29 %29 %29 + %62 = OpConstant %17 1 + %76 = OpTypeVector %6 4 + %77 = OpTypePointer Output %76 + %78 = OpVariable %77 Output + %135 = OpUndef %7 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %56 + %56 = OpLabel + %133 = OpPhi %9 %53 %5 %137 %59 + %132 = OpPhi %17 %18 %5 %75 %59 + %63 = OpSLessThan %39 %132 %62 + OpLoopMerge %58 %59 None + OpBranchConditional %63 %57 %58 + %57 = OpLabel + OpBranch %104 + %104 = OpLabel + OpLoopMerge %105 %106 None + OpBranch %107 + %107 = OpLabel + %108 = OpAccessChain %21 %16 %18 %20 + %109 = OpLoad %6 %108 + %110 = OpConvertFToS %17 %109 + OpSelectionMerge %111 None + OpSwitch %110 %111 0 %112 67 %113 + %113 = OpLabel + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %119 = OpCompositeExtract %6 %135 0 + %120 = OpFOrdLessThan %39 %28 %119 + OpSelectionMerge %122 None + OpBranchConditional %120 %122 %123 + %123 = OpLabel + %124 = OpFunctionCall %2 %84 + %125 = OpUndef %9 + OpBranch %115 + %122 = OpLabel + %126 = OpFunctionCall %2 %84 + %127 = OpUndef %9 + OpBranch %115 + %116 = OpLabel + OpBranch %114 + %115 = OpLabel + %138 = OpPhi %9 %125 %123 %127 %122 + OpBranch %105 + %112 = OpLabel + OpBranch %105 + %111 = OpLabel + OpBranch %105 + %106 = OpLabel + OpBranch %104 + %105 = OpLabel + %137 = OpPhi %9 %138 %115 %30 %112 %48 %111 + %69 = OpExtInst %6 %1 Length %137 + %70 = OpFOrdLessThanEqual %39 %69 %29 + OpSelectionMerge %72 None + OpBranchConditional %70 %71 %72 + %71 = OpLabel + OpBranch %59 + %72 = OpLabel + OpBranch %59 + %59 = OpLabel + %75 = OpIAdd %17 %132 %62 + OpBranch %56 + %58 = OpLabel + %80 = OpCompositeExtract %6 %133 0 + %81 = OpCompositeExtract %6 %133 1 + %82 = OpCompositeExtract %6 %133 2 + %83 = OpCompositeConstruct %76 %80 %81 %82 %28 + OpStore %78 %83 + OpReturn + OpFunctionEnd + %84 = OpFunction %2 None %3 + %85 = OpLabel + OpTerminateInvocation + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/uv-value-comparison-as-boolean.amber b/vulkan/amber/graphicsfuzz/uv-value-comparison-as-boolean.amber new file mode 100644 index 0000000..6c8dac1 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/uv-value-comparison-as-boolean.amber @@ -0,0 +1,167 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with uv value comparison as boolean + +# The test passes because the shader always writes the color red. + +# Optimized using spirv-opt with the following arguments: +# '--scalar-replacement=100' +# '--vector-dce' +# '--redundancy-elimination' +# '--ccp' +# '--redundancy-elimination' +# '--copy-propagate-arrays' +# '--eliminate-dead-code-aggressive' +# '--redundancy-elimination' +# '--vector-dce' +# '--inline-entry-points-exhaustive' +# '--private-to-local' +# '--if-conversion' +# '--if-conversion' +# '--eliminate-dead-code-aggressive' +# '--if-conversion' +# '--simplify-instructions' +# '--eliminate-local-multi-store' +# spirv-opt commit hash: ad7f2c5c4c7f51360e9e079109a9217aa5ba5cc0 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 uv; +# bool c1 = uv.y < 0.25; +# +# for (int i = 0; i < 1; i++) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Writes the color red +# return; +# } +# if (c1) +# { +# return; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "c1" + OpName %12 "uv" + OpName %22 "i" + OpName %34 "_GLF_color" + OpDecorate %22 RelaxedPrecision + OpDecorate %34 Location 0 + OpDecorate %39 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeBool + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 2 + %11 = OpTypePointer Function %10 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 1 + %15 = OpTypePointer Function %9 + %18 = OpConstant %9 0.25 + %20 = OpTypeInt 32 1 + %21 = OpTypePointer Function %20 + %23 = OpConstant %20 0 + %30 = OpConstant %20 1 + %32 = OpTypeVector %9 4 + %33 = OpTypePointer Output %32 + %34 = OpVariable %33 Output + %35 = OpConstant %9 1 + %36 = OpConstant %9 0 + %37 = OpConstantComposite %32 %35 %36 %36 %35 + %47 = OpUndef %20 + %48 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %12 = OpVariable %11 Function + %22 = OpVariable %21 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %19 = OpFOrdLessThan %6 %17 %18 + OpStore %8 %19 + OpStore %22 %23 + OpBranch %24 + %24 = OpLabel + %46 = OpPhi %6 %19 %5 %48 %27 + %45 = OpPhi %20 %23 %5 %47 %27 + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %31 = OpSLessThan %6 %45 %30 + OpBranchConditional %31 %25 %26 + %25 = OpLabel + OpStore %34 %37 + OpReturn + %27 = OpLabel + %39 = OpLoad %20 %22 + %40 = OpIAdd %20 %39 %30 + OpStore %22 %40 + OpBranch %24 + %26 = OpLabel + OpSelectionMerge %43 None + OpBranchConditional %46 %42 %43 + %42 = OpLabel + OpReturn + %43 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/vec2-modf.amber b/vulkan/amber/graphicsfuzz/vec2-modf.amber new file mode 100644 index 0000000..095dc26 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/vec2-modf.amber @@ -0,0 +1,129 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by the GraphicsFuzz project. + +# Short description: A fragment shader with vec2 in modulus fraction function + +# The test passes because the shader always writes the color red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 320 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# vec2 uv = vec2(1.0, 1.0); +# uv.x = (modf(1.0, uv.y)); +# // uv.y == 1.0, uv.x == 0.0 +# if (uv.y > 0.0 && uv.x < 1.0) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# } +# else +# { +# _GLF_color = vec4(1.0); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %34 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 320 + OpName %4 "main" + OpName %9 "uv" + OpName %34 "_GLF_color" + OpDecorate %34 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstantComposite %7 %10 %10 + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 1 + %14 = OpTypePointer Function %6 + %17 = OpConstant %12 0 + %19 = OpTypeBool + %22 = OpConstant %6 0 + %32 = OpTypeVector %6 4 + %33 = OpTypePointer Output %32 + %34 = OpVariable %33 Output + %35 = OpConstantComposite %32 %10 %22 %22 %10 + %37 = OpConstantComposite %32 %10 %10 %10 %10 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + OpStore %9 %11 + %15 = OpAccessChain %14 %9 %13 + %16 = OpExtInst %6 %1 Modf %10 %15 + %18 = OpAccessChain %14 %9 %17 + OpStore %18 %16 + %20 = OpAccessChain %14 %9 %13 + %21 = OpLoad %6 %20 + %23 = OpFOrdGreaterThan %19 %21 %22 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + %26 = OpAccessChain %14 %9 %17 + %27 = OpLoad %6 %26 + %28 = OpFOrdLessThan %19 %27 %10 + OpBranch %25 + %25 = OpLabel + %29 = OpPhi %19 %23 %5 %28 %24 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %36 + %30 = OpLabel + OpStore %34 %35 + OpBranch %31 + %36 = OpLabel + OpStore %34 %37 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/vector-values-multiplied-by-fragcoord.amber b/vulkan/amber/graphicsfuzz/vector-values-multiplied-by-fragcoord.amber new file mode 100644 index 0000000..96e35fc --- /dev/null +++ b/vulkan/amber/graphicsfuzz/vector-values-multiplied-by-fragcoord.amber @@ -0,0 +1,311 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A shader that multiplies a vector by fragcoord + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# // Returns 1. +# float func() +# { +# vec4 value; +# bool alwaysFalse = gl_FragCoord.x < -1.0; +# +# if (alwaysFalse) +# { +# vec2 a; +# value.xy = a; +# } +# +# if (!alwaysFalse) +# { +# value.xy = injectionSwitch.xy; // x == 0.0, y == 1.0 +# } +# +# //At this point all components of value are guaranteed to be initialized. +# value.zw = gl_FragCoord.xy * value.xy * vec2(2) + value.xy; +# +# // Iterates twice. +# for (int i = 0; i < int(injectionSwitch.y) + 1; i++) +# { +# value.x = float(i); +# } +# +# // Always true. +# if (value.x == 1.0 && value.y == 1.0) +# return 1.0; +# else +# return 0.0; +# } +# +# void main() +# { +# int count = 0; +# +# // Iterates twice. +# for (int i = 0; i < int(injectionSwitch.y) + 1; i++) +# { +# count += int(func()); +# } +# +# // Always true. +# if (count == 2) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 129 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %15 %125 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "func(" + OpName %12 "alwaysFalse" + OpName %15 "gl_FragCoord" + OpName %27 "value" + OpName %30 "a" + OpName %38 "buf0" + OpMemberName %38 0 "injectionSwitch" + OpName %40 "" + OpName %62 "i" + OpName %100 "count" + OpName %101 "i" + OpName %125 "_GLF_color" + OpDecorate %15 BuiltIn FragCoord + OpMemberDecorate %38 0 Offset 0 + OpDecorate %38 Block + OpDecorate %40 DescriptorSet 0 + OpDecorate %40 Binding 0 + OpDecorate %125 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypeBool + %11 = OpTypePointer Function %10 + %13 = OpTypeVector %6 4 + %14 = OpTypePointer Input %13 + %15 = OpVariable %14 Input + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 0 + %18 = OpTypePointer Input %6 + %21 = OpConstant %6 -1 + %26 = OpTypePointer Function %13 + %28 = OpTypeVector %6 2 + %29 = OpTypePointer Function %28 + %38 = OpTypeStruct %28 + %39 = OpTypePointer Uniform %38 + %40 = OpVariable %39 Uniform + %41 = OpTypeInt 32 1 + %42 = OpConstant %41 0 + %43 = OpTypePointer Uniform %28 + %53 = OpConstant %6 2 + %54 = OpConstantComposite %28 %53 %53 + %61 = OpTypePointer Function %41 + %69 = OpConstant %16 1 + %70 = OpTypePointer Uniform %6 + %74 = OpConstant %41 1 + %79 = OpTypePointer Function %6 + %85 = OpConstant %6 1 + %97 = OpConstant %6 0 + %120 = OpConstant %41 2 + %124 = OpTypePointer Output %13 + %125 = OpVariable %124 Output + %126 = OpConstantComposite %13 %85 %97 %97 %85 + %128 = OpConstantComposite %13 %97 %97 %97 %85 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %100 = OpVariable %61 Function + %101 = OpVariable %61 Function + OpStore %100 %42 + OpStore %101 %42 + OpBranch %102 + %102 = OpLabel + OpLoopMerge %104 %105 None + OpBranch %106 + %106 = OpLabel + %107 = OpLoad %41 %101 + %108 = OpAccessChain %70 %40 %42 %69 + %109 = OpLoad %6 %108 + %110 = OpConvertFToS %41 %109 + %111 = OpIAdd %41 %110 %74 + %112 = OpSLessThan %10 %107 %111 + OpBranchConditional %112 %103 %104 + %103 = OpLabel + %113 = OpFunctionCall %6 %8 + %114 = OpConvertFToS %41 %113 + %115 = OpLoad %41 %100 + %116 = OpIAdd %41 %115 %114 + OpStore %100 %116 + OpBranch %105 + %105 = OpLabel + %117 = OpLoad %41 %101 + %118 = OpIAdd %41 %117 %74 + OpStore %101 %118 + OpBranch %102 + %104 = OpLabel + %119 = OpLoad %41 %100 + %121 = OpIEqual %10 %119 %120 + OpSelectionMerge %123 None + OpBranchConditional %121 %122 %127 + %122 = OpLabel + OpStore %125 %126 + OpBranch %123 + %127 = OpLabel + OpStore %125 %128 + OpBranch %123 + %123 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %12 = OpVariable %11 Function + %27 = OpVariable %26 Function + %30 = OpVariable %29 Function + %62 = OpVariable %61 Function + %19 = OpAccessChain %18 %15 %17 + %20 = OpLoad %6 %19 + %22 = OpFOrdLessThan %10 %20 %21 + OpStore %12 %22 + %23 = OpLoad %10 %12 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + %31 = OpLoad %28 %30 + %32 = OpLoad %13 %27 + %33 = OpVectorShuffle %13 %32 %31 4 5 2 3 + OpStore %27 %33 + OpBranch %25 + %25 = OpLabel + %34 = OpLoad %10 %12 + %35 = OpLogicalNot %10 %34 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %37 + %36 = OpLabel + %44 = OpAccessChain %43 %40 %42 + %45 = OpLoad %28 %44 + %46 = OpLoad %13 %27 + %47 = OpVectorShuffle %13 %46 %45 4 5 2 3 + OpStore %27 %47 + OpBranch %37 + %37 = OpLabel + %48 = OpLoad %13 %15 + %49 = OpVectorShuffle %28 %48 %48 0 1 + %50 = OpLoad %13 %27 + %51 = OpVectorShuffle %28 %50 %50 0 1 + %52 = OpFMul %28 %49 %51 + %55 = OpFMul %28 %52 %54 + %56 = OpLoad %13 %27 + %57 = OpVectorShuffle %28 %56 %56 0 1 + %58 = OpFAdd %28 %55 %57 + %59 = OpLoad %13 %27 + %60 = OpVectorShuffle %13 %59 %58 0 1 4 5 + OpStore %27 %60 + OpStore %62 %42 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %41 %62 + %71 = OpAccessChain %70 %40 %42 %69 + %72 = OpLoad %6 %71 + %73 = OpConvertFToS %41 %72 + %75 = OpIAdd %41 %73 %74 + %76 = OpSLessThan %10 %68 %75 + OpBranchConditional %76 %64 %65 + %64 = OpLabel + %77 = OpLoad %41 %62 + %78 = OpConvertSToF %6 %77 + %80 = OpAccessChain %79 %27 %17 + OpStore %80 %78 + OpBranch %66 + %66 = OpLabel + %81 = OpLoad %41 %62 + %82 = OpIAdd %41 %81 %74 + OpStore %62 %82 + OpBranch %63 + %65 = OpLabel + %83 = OpAccessChain %79 %27 %17 + %84 = OpLoad %6 %83 + %86 = OpFOrdEqual %10 %84 %85 + OpSelectionMerge %88 None + OpBranchConditional %86 %87 %88 + %87 = OpLabel + %89 = OpAccessChain %79 %27 %69 + %90 = OpLoad %6 %89 + %91 = OpFOrdEqual %10 %90 %85 + OpBranch %88 + %88 = OpLabel + %92 = OpPhi %10 %86 %65 %91 %87 + OpSelectionMerge %94 None + OpBranchConditional %92 %93 %96 + %93 = OpLabel + OpReturnValue %85 + %96 = OpLabel + OpReturnValue %97 + %94 = OpLabel + OpUnreachable + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/vectors-and-discard-in-function.amber b/vulkan/amber/graphicsfuzz/vectors-and-discard-in-function.amber new file mode 100644 index 0000000..ac3e137 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/vectors-and-discard-in-function.amber @@ -0,0 +1,179 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader that assigns vector values + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--eliminate-dead-branches' +# '--eliminate-dead-inserts' +# '--combine-access-chains' +# '--eliminate-local-multi-store' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--vector-dce' +# '--combine-access-chains' +# '--eliminate-local-single-store' +# '--eliminate-local-multi-store' +# '--eliminate-dead-inserts' +# '--if-conversion' +# '--copy-propagate-arrays' +# '--combine-access-chains' +# spirv-opt commit hash: e82a428605f6ce0a07337b36f8ba3935c9f165ac + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func() +# { +# vec4 tmp; +# float tmp2[1]; +# float tmp3; +# vec2 coord = vec2(1.0); +# +# if (int(coord.y) < 180) // Always true +# tmp3 = tmp2[0]; +# else +# discard; +# +# tmp = vec4(tmp3); +# return 1; +# } +# +# void main() +# { +# if (func() == 1) +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# else +# _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %49 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "func(" + OpName %13 "coord" + OpName %27 "tmp3" + OpName %30 "tmp2" + OpName %38 "tmp" + OpName %49 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %49 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 2 + %12 = OpTypePointer Function %11 + %14 = OpConstant %10 1 + %15 = OpConstantComposite %11 %14 %14 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 1 + %18 = OpTypePointer Function %10 + %22 = OpConstant %6 180 + %23 = OpTypeBool + %28 = OpTypeArray %10 %17 + %29 = OpTypePointer Function %28 + %31 = OpConstant %6 0 + %36 = OpTypeVector %10 4 + %37 = OpTypePointer Function %36 + %41 = OpConstant %6 1 + %48 = OpTypePointer Output %36 + %49 = OpVariable %48 Output + %50 = OpConstant %10 0 + %51 = OpConstantComposite %36 %14 %50 %50 %14 + %53 = OpConstantComposite %36 %50 %50 %50 %14 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %44 = OpFunctionCall %6 %8 + %45 = OpIEqual %23 %44 %41 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %52 + %46 = OpLabel + OpStore %49 %51 + OpBranch %47 + %52 = OpLabel + OpStore %49 %53 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %13 = OpVariable %12 Function + %27 = OpVariable %18 Function + %30 = OpVariable %29 Function + %38 = OpVariable %37 Function + OpStore %13 %15 + %19 = OpAccessChain %18 %13 %17 + %20 = OpLoad %10 %19 + %21 = OpConvertFToS %6 %20 + %24 = OpSLessThan %23 %21 %22 + OpSelectionMerge %26 None + OpBranchConditional %24 %25 %34 + %25 = OpLabel + %32 = OpAccessChain %18 %30 %31 + %33 = OpLoad %10 %32 + OpStore %27 %33 + OpBranch %26 + %34 = OpLabel + OpTerminateInvocation + %26 = OpLabel + %40 = OpCompositeConstruct %36 %33 %33 %33 %33 + OpStore %38 %40 + OpReturnValue %41 + OpFunctionEnd +END + + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/while-function-always-false.amber b/vulkan/amber/graphicsfuzz/while-function-always-false.amber new file mode 100644 index 0000000..24fc2f3 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/while-function-always-false.amber @@ -0,0 +1,166 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with an always false while function + +# The test passes because the shader always writes the color red (while function in the shader is always false) + +# Optimized using spirv-opt with the following arguments: +# '--redundancy-elimination' +# '--reduce-load-size' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--vector-dce' +# '--eliminate-dead-branches' +# spirv-opt commit hash: 230c9e437146e48ec58adb4433890403c23c98fa + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# do +# { +# for( +# int j = int(injectionSwitch.x); +# j < 2; +# ++j +# ) +# { +# return; +# } +# } +# while(0.0 > injectionSwitch.y); +# int(injectionSwitch.y); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %19 "j" + OpName %21 "buf0" + OpMemberName %21 0 "injectionSwitch" + OpName %23 "" + OpDecorate %9 Location 0 + OpDecorate %19 RelaxedPrecision + OpMemberDecorate %21 0 Offset 0 + OpDecorate %21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 0 + OpDecorate %30 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 1 + %11 = OpConstant %6 0 + %12 = OpConstantComposite %7 %10 %11 %11 %10 + %17 = OpTypeInt 32 1 + %18 = OpTypePointer Function %17 + %20 = OpTypeVector %6 2 + %21 = OpTypeStruct %20 + %22 = OpTypePointer Uniform %21 + %23 = OpVariable %22 Uniform + %24 = OpConstant %17 0 + %25 = OpTypeInt 32 0 + %26 = OpConstant %25 0 + %27 = OpTypePointer Uniform %6 + %37 = OpConstant %17 2 + %38 = OpTypeBool + %42 = OpConstant %17 1 + %44 = OpConstant %25 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %19 = OpVariable %18 Function + OpStore %9 %12 + OpBranch %13 + %13 = OpLabel + %28 = OpAccessChain %27 %23 %24 %26 + %29 = OpLoad %6 %28 + %30 = OpConvertFToS %17 %29 + OpStore %19 %30 + OpLoopMerge %15 %33 None + OpBranch %31 + %31 = OpLabel + %36 = OpLoad %17 %19 + %39 = OpSLessThan %38 %36 %37 + OpLoopMerge %51 %34 None + OpBranchConditional %39 %32 %51 + %32 = OpLabel + OpReturn + %34 = OpLabel + OpBranch %31 + %51 = OpLabel + OpBranch %33 + %33 = OpLabel + %45 = OpAccessChain %27 %23 %24 %44 + %46 = OpLoad %6 %45 + %47 = OpFOrdGreaterThan %38 %11 %46 + OpBranchConditional %47 %13 %15 + %15 = OpLabel + %50 = OpConvertFToS %17 %46 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/while-inside-switch.amber b/vulkan/amber/graphicsfuzz/while-inside-switch.amber new file mode 100644 index 0000000..04b286e --- /dev/null +++ b/vulkan/amber/graphicsfuzz/while-inside-switch.amber @@ -0,0 +1,169 @@ +#!amber + +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +# A test for a bug found by GraphicsFuzz. + +# A fragment shader that uses a while loop inside a switch. +# Derived from the following GLSL fragment shader. +# We check that the top-left pixel is red. The test passes because the +# first if statement checks if the x coordinate is less than 10 and if so writes +# red to _GLF_color and then returns. + +# #version 310 es +# +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# +# void main() +# { +# if (gl_FragCoord.x < 10.0) { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# return; +# } +# switch(int(injectionSwitch.x)) +# { +# case 0: +# while(bool(1.0)) +# { +# discard; +# } +# } +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# return; +# } + +SHADER vertex variant_vertex_shader PASSTHROUGH + +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft + OpSource ESSL 310 + OpName %2 "main" + OpName %3 "gl_FragCoord" + OpName %4 "_GLF_color" + OpName %5 "buf0" + OpMemberName %5 0 "injectionSwitch" + OpName %6 "" + OpDecorate %3 BuiltIn FragCoord + OpDecorate %4 Location 0 + OpMemberDecorate %5 0 Offset 0 + OpDecorate %5 Block + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 0 + %7 = OpTypeVoid + %8 = OpTypeFunction %7 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %3 = OpVariable %11 Input + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 0 + %14 = OpTypePointer Input %9 + %15 = OpConstant %9 10 + %16 = OpTypeBool + %17 = OpTypePointer Output %10 + %4 = OpVariable %17 Output + %18 = OpConstant %9 1 + %19 = OpConstant %9 0 + %20 = OpConstantComposite %10 %18 %19 %19 %18 + %21 = OpTypeVector %9 2 + %5 = OpTypeStruct %21 + %22 = OpTypePointer Uniform %5 + %6 = OpVariable %22 Uniform + %23 = OpTypeInt 32 1 + %24 = OpConstant %23 0 + %25 = OpTypePointer Uniform %9 + %2 = OpFunction %7 None %8 + %26 = OpLabel + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpAccessChain %14 %3 %13 + %32 = OpLoad %9 %31 + %33 = OpFOrdLessThan %16 %32 %15 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + OpStore %4 %20 + OpBranch %28 + %34 = OpLabel + %36 = OpAccessChain %25 %6 %24 %13 + %37 = OpLoad %9 %36 + %38 = OpConvertFToS %23 %37 + OpSelectionMerge %39 None + OpSwitch %38 %39 0 %40 + %40 = OpLabel + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + OpTerminateInvocation + %43 = OpLabel + OpBranch %41 + %42 = OpLabel + OpUnreachable + %39 = OpLabel + OpStore %4 %20 + OpBranch %28 + %29 = OpLabel + OpBranch %27 + %28 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/graphicsfuzz/write-before-break.amber b/vulkan/amber/graphicsfuzz/write-before-break.amber new file mode 100644 index 0000000..a96b867 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/write-before-break.amber @@ -0,0 +1,342 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: Fragment shader that writes red before loop break + +# The test passes because the write of red is the only reachable write and is +# guaranteed to be reached, and all loops are designed to terminate after a small +# number of iterations. For the loop with guard '1 < z' this is guaranteed due +# to the runtime value of 'injected'. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# int injected; +# }; +# +# void main() +# { +# int idx = 0; +# mat4x3 m43 = mat4x3(1.0); +# float GLF_live6sums[9]; +# int ll_1 = 0; +# for(int GLF_live6rows = 2;;) +# { +# if(ll_1 >= injected) { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# break; +# } +# ll_1++; +# +# int z = injected; +# int ll_2 = 0; +# for( +# int ctr = 0; +# ctr < 1; +# ctr ++ +# ) +# { +# if(ll_2 >= injected) { +# break; +# } +# ll_2++; +# +# mat4x3 tempm43; +# tempm43 = m43; +# int ll_3 = 0; +# for( +# int c = 0; +# 1 < z; // False, because 'injected' is 1 +# c ++ +# ) +# { +# int d = 0; +# tempm43[c >= 0 && c < 4 ? c : 0][d >= 0 && d < 3 ? d : 0] = 1.0; +# } +# GLF_live6sums[idx >= 0 && idx < 9 ? idx : 0] += m43[ctr][1]; +# } +# idx ++; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 126 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %42 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "idx" + OpName %14 "m43" + OpName %22 "ll_1" + OpName %23 "GLF_live6rows" + OpName %30 "buf0" + OpMemberName %30 0 "injected" + OpName %32 "" + OpName %42 "_GLF_color" + OpName %48 "z" + OpName %51 "ll_2" + OpName %52 "ctr" + OpName %69 "tempm43" + OpName %71 "ll_3" + OpName %72 "c" + OpName %80 "d" + OpName %105 "GLF_live6sums" + OpDecorate %8 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpMemberDecorate %30 0 RelaxedPrecision + OpMemberDecorate %30 0 Offset 0 + OpDecorate %30 Block + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 0 + OpDecorate %35 RelaxedPrecision + OpDecorate %42 Location 0 + OpDecorate %45 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + OpDecorate %62 RelaxedPrecision + OpDecorate %67 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %78 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %83 RelaxedPrecision + OpDecorate %87 RelaxedPrecision + OpDecorate %89 RelaxedPrecision + OpDecorate %91 RelaxedPrecision + OpDecorate %95 RelaxedPrecision + OpDecorate %99 RelaxedPrecision + OpDecorate %100 RelaxedPrecision + OpDecorate %106 RelaxedPrecision + OpDecorate %108 RelaxedPrecision + OpDecorate %112 RelaxedPrecision + OpDecorate %114 RelaxedPrecision + OpDecorate %122 RelaxedPrecision + OpDecorate %123 RelaxedPrecision + OpDecorate %124 RelaxedPrecision + OpDecorate %125 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 3 + %12 = OpTypeMatrix %11 4 + %13 = OpTypePointer Function %12 + %15 = OpConstant %10 1 + %16 = OpConstant %10 0 + %17 = OpConstantComposite %11 %15 %16 %16 + %18 = OpConstantComposite %11 %16 %15 %16 + %19 = OpConstantComposite %11 %16 %16 %15 + %20 = OpConstantComposite %11 %16 %16 %16 + %21 = OpConstantComposite %12 %17 %18 %19 %20 + %24 = OpConstant %6 2 + %30 = OpTypeStruct %6 + %31 = OpTypePointer Uniform %30 + %32 = OpVariable %31 Uniform + %33 = OpTypePointer Uniform %6 + %36 = OpTypeBool + %40 = OpTypeVector %10 4 + %41 = OpTypePointer Output %40 + %42 = OpVariable %41 Output + %43 = OpConstantComposite %40 %15 %16 %16 %15 + %46 = OpConstant %6 1 + %84 = OpConstant %6 4 + %92 = OpConstant %6 3 + %97 = OpTypePointer Function %10 + %101 = OpTypeInt 32 0 + %102 = OpConstant %101 9 + %103 = OpTypeArray %10 %102 + %104 = OpTypePointer Function %103 + %109 = OpConstant %6 9 + %115 = OpConstant %101 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %14 = OpVariable %13 Function + %22 = OpVariable %7 Function + %23 = OpVariable %7 Function + %48 = OpVariable %7 Function + %51 = OpVariable %7 Function + %52 = OpVariable %7 Function + %69 = OpVariable %13 Function + %71 = OpVariable %7 Function + %72 = OpVariable %7 Function + %80 = OpVariable %7 Function + %105 = OpVariable %104 Function + OpStore %8 %9 + OpStore %14 %21 + OpStore %22 %9 + OpStore %23 %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %26 + %26 = OpLabel + %29 = OpLoad %6 %22 + %34 = OpAccessChain %33 %32 %9 + %35 = OpLoad %6 %34 + %37 = OpSGreaterThanEqual %36 %29 %35 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + OpStore %42 %43 + OpBranch %27 + %39 = OpLabel + %45 = OpLoad %6 %22 + %47 = OpIAdd %6 %45 %46 + OpStore %22 %47 + %49 = OpAccessChain %33 %32 %9 + %50 = OpLoad %6 %49 + OpStore %48 %50 + OpStore %51 %9 + OpStore %52 %9 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %6 %52 + %59 = OpSLessThan %36 %58 %46 + OpBranchConditional %59 %54 %55 + %54 = OpLabel + %60 = OpLoad %6 %51 + %61 = OpAccessChain %33 %32 %9 + %62 = OpLoad %6 %61 + %63 = OpSGreaterThanEqual %36 %60 %62 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %65 + %64 = OpLabel + OpBranch %55 + %65 = OpLabel + %67 = OpLoad %6 %51 + %68 = OpIAdd %6 %67 %46 + OpStore %51 %68 + %70 = OpLoad %12 %14 + OpStore %69 %70 + OpStore %71 %9 + OpStore %72 %9 + OpBranch %73 + %73 = OpLabel + OpLoopMerge %75 %76 None + OpBranch %77 + %77 = OpLabel + %78 = OpLoad %6 %48 + %79 = OpSLessThan %36 %46 %78 + OpBranchConditional %79 %74 %75 + %74 = OpLabel + OpStore %80 %9 + %81 = OpLoad %6 %72 + %82 = OpSGreaterThanEqual %36 %81 %9 + %83 = OpLoad %6 %72 + %85 = OpSLessThan %36 %83 %84 + %86 = OpLogicalAnd %36 %82 %85 + %87 = OpLoad %6 %72 + %88 = OpSelect %6 %86 %87 %9 + %89 = OpLoad %6 %80 + %90 = OpSGreaterThanEqual %36 %89 %9 + %91 = OpLoad %6 %80 + %93 = OpSLessThan %36 %91 %92 + %94 = OpLogicalAnd %36 %90 %93 + %95 = OpLoad %6 %80 + %96 = OpSelect %6 %94 %95 %9 + %98 = OpAccessChain %97 %69 %88 %96 + OpStore %98 %15 + OpBranch %76 + %76 = OpLabel + %99 = OpLoad %6 %72 + %100 = OpIAdd %6 %99 %46 + OpStore %72 %100 + OpBranch %73 + %75 = OpLabel + %106 = OpLoad %6 %8 + %107 = OpSGreaterThanEqual %36 %106 %9 + %108 = OpLoad %6 %8 + %110 = OpSLessThan %36 %108 %109 + %111 = OpLogicalAnd %36 %107 %110 + %112 = OpLoad %6 %8 + %113 = OpSelect %6 %111 %112 %9 + %114 = OpLoad %6 %52 + %116 = OpAccessChain %97 %14 %114 %115 + %117 = OpLoad %10 %116 + %118 = OpAccessChain %97 %105 %113 + %119 = OpLoad %10 %118 + %120 = OpFAdd %10 %119 %117 + %121 = OpAccessChain %97 %105 %113 + OpStore %121 %120 + OpBranch %56 + %56 = OpLabel + %122 = OpLoad %6 %52 + %123 = OpIAdd %6 %122 %46 + OpStore %52 %123 + OpBranch %53 + %55 = OpLabel + %124 = OpLoad %6 %8 + %125 = OpIAdd %6 %124 %46 + OpStore %8 %125 + OpBranch %28 + %28 = OpLabel + OpBranch %25 + %27 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injected +BUFFER variant_injected DATA_TYPE int32 DATA + 1 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics gfz_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER variant_injected AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR gfz_pipeline 0 0 0 255 + +CLEAR gfz_pipeline +RUN gfz_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer IDX 0 0 SIZE 256 256 EQ_RGB 255 0 0 \ No newline at end of file diff --git a/vulkan/amber/graphicsfuzz/write-red-after-search.amber b/vulkan/amber/graphicsfuzz/write-red-after-search.amber new file mode 100644 index 0000000..d65b6a2 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/write-red-after-search.amber @@ -0,0 +1,1065 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader performing a search computation, then writing red regardless + +# The test passes because the uniform values used to run the shader guarantee +# that red will be written at the end, regardless of what the prior computation +# does. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 { +# vec2 injectionSwitch; +# }; +# struct BST { +# int data; +# int leftIndex; +# int rightIndex; +# } ; +# +# BST tree[10]; +# +# struct Obj { +# float odd_numbers[10]; +# float even_numbers[10]; +# } ; +# +# void makeTreeNode(inout BST tree, int data) +# { +# tree.data = data; +# tree.leftIndex = - 1; +# tree.rightIndex = - 1; +# } +# void insert(int treeIndex, int data) +# { +# int baseIndex = 0; +# while(baseIndex <= treeIndex) +# { +# if(data <= tree[baseIndex].data) +# { +# if(tree[baseIndex].leftIndex == - 1) +# { +# tree[baseIndex].leftIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# baseIndex = tree[baseIndex].leftIndex; +# continue; +# } +# } +# else +# { +# if(tree[baseIndex].rightIndex == - 1) +# { +# tree[baseIndex].rightIndex = treeIndex; +# makeTreeNode(tree[treeIndex], data); +# return; +# } +# else +# { +# int GLF_live8i = 1; +# float GLF_live8A[50]; +# GLF_live8A[GLF_live8i >= 0 && GLF_live8i < 50 ? GLF_live8i : 0] += GLF_live8A[(1 - 1) >= 0 && (1 - 1) < 50 ? 1 - 1 : 0]; +# do +# { +# baseIndex = tree[baseIndex].rightIndex; +# } +# while((injectionSwitch.x > injectionSwitch.y)); +# continue; +# } +# } +# } +# } +# int search(int target) +# { +# BST currentNode; +# int index = 0; +# while(index != - 1) +# { +# currentNode = tree[index]; +# if(currentNode.data == target) +# { +# return target; +# } +# index = target > currentNode.data ? currentNode.rightIndex : currentNode.leftIndex; +# } +# return - 1; +# } +# vec3 hueColor(float angle) +# { +# float nodeData = float(search(15)); +# return (30.0 + angle * vec3(1.0, 5.0, nodeData)) / 50.0; +# } +# float makeFrame(float v) +# { +# v *= 6.5; +# if(v < 1.5) +# { +# return float(search(100)); +# } +# if(v < 4.0) +# { +# return 0.0; +# } +# if(v < float(search(6))) +# { +# return 1.0; +# } +# return 10.0 + float(search(30)); +# } +# void main() +# { +# int treeIndex = 0; +# makeTreeNode(tree[0], 9); +# treeIndex ++; +# insert(treeIndex, 5); +# treeIndex ++; +# int GLF_live1_looplimiter2 = 0; +# for( +# int GLF_live1i = 0; +# 1 < 4; +# GLF_live1i ++ +# ) +# { +# if(GLF_live1_looplimiter2 >= 7) +# { +# break; +# } +# GLF_live1_looplimiter2 ++; +# } +# insert(treeIndex, 12); +# treeIndex ++; +# insert(treeIndex, 15); +# treeIndex ++; +# insert(treeIndex, 7); +# treeIndex ++; +# insert(treeIndex, 8); +# treeIndex ++; +# insert(treeIndex, 2); +# treeIndex ++; +# insert(treeIndex, 6); +# treeIndex ++; +# Obj GLF_live4obj; +# int GLF_live4_looplimiter3 = 0; +# for( +# int GLF_live4i = 0; +# 1 < 9; +# GLF_live4i ++ +# ) +# { +# if(GLF_live4_looplimiter3 >= 3) +# { +# break; +# } +# GLF_live4_looplimiter3 ++; +# int GLF_live4index = 1; +# GLF_live4obj.even_numbers[GLF_live4index >= 0 && GLF_live4index < 10 ? GLF_live4index : 0] = GLF_live4obj.even_numbers[1 >= 0 && 1 < 10 ? 1 : 0]; +# GLF_live4obj.even_numbers[GLF_live4i >= 0 && GLF_live4i < 10 ? GLF_live4i : 0] = 1.0; +# } +# insert(treeIndex, 17); +# if((injectionSwitch.x > injectionSwitch.y)) +# { +# return; +# } +# treeIndex ++; +# insert(treeIndex, 13); +# vec2 z = (gl_FragCoord.yx / vec2(256.0, 256.0)); +# float x = makeFrame(z.x); +# float y = makeFrame(z.y); +# int sum = - 100; +# for( +# int target = 0; +# target < 20; +# target ++ +# ) +# { +# int result = search(target); +# if(result > 0) +# { +# } +# else +# { +# switch(result) +# { +# case - 1: +# sum += 1; +# break; +# case 0: +# return; +# } +# } +# } +# float a = x + y * float(sum); +# _GLF_color = vec4(injectionSwitch.x < injectionSwitch.y ? vec3(1.0, 0.0, 0.0) : hueColor(a), 1.); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 456 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %381 %436 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "BST" + OpMemberName %7 0 "data" + OpMemberName %7 1 "leftIndex" + OpMemberName %7 2 "rightIndex" + OpName %13 "makeTreeNode(struct-BST-i1-i1-i11;i1;" + OpName %11 "tree" + OpName %12 "data" + OpName %18 "insert(i1;i1;" + OpName %16 "treeIndex" + OpName %17 "data" + OpName %22 "search(i1;" + OpName %21 "target" + OpName %29 "hueColor(f1;" + OpName %28 "angle" + OpName %33 "makeFrame(f1;" + OpName %32 "v" + OpName %43 "baseIndex" + OpName %58 "tree" + OpName %76 "param" + OpName %80 "param" + OpName %102 "param" + OpName %105 "param" + OpName %112 "GLF_live8i" + OpName %116 "GLF_live8A" + OpName %139 "buf0" + OpMemberName %139 0 "injectionSwitch" + OpName %141 "" + OpName %151 "index" + OpName %159 "currentNode" + OpName %186 "nodeData" + OpName %188 "param" + OpName %214 "param" + OpName %227 "param" + OpName %236 "param" + OpName %242 "treeIndex" + OpName %244 "param" + OpName %247 "param" + OpName %254 "param" + OpName %256 "param" + OpName %260 "GLF_live1_looplimiter2" + OpName %261 "GLF_live1i" + OpName %279 "param" + OpName %281 "param" + OpName %285 "param" + OpName %287 "param" + OpName %291 "param" + OpName %293 "param" + OpName %298 "param" + OpName %300 "param" + OpName %304 "param" + OpName %306 "param" + OpName %310 "param" + OpName %312 "param" + OpName %316 "GLF_live4_looplimiter3" + OpName %317 "GLF_live4i" + OpName %331 "GLF_live4index" + OpName %333 "Obj" + OpMemberName %333 0 "odd_numbers" + OpMemberName %333 1 "even_numbers" + OpName %335 "GLF_live4obj" + OpName %358 "param" + OpName %360 "param" + OpName %373 "param" + OpName %375 "param" + OpName %378 "z" + OpName %381 "gl_FragCoord" + OpName %387 "x" + OpName %388 "param" + OpName %392 "y" + OpName %393 "param" + OpName %397 "sum" + OpName %399 "target" + OpName %408 "result" + OpName %409 "param" + OpName %428 "a" + OpName %436 "_GLF_color" + OpName %448 "param" + OpMemberDecorate %7 0 RelaxedPrecision + OpMemberDecorate %7 1 RelaxedPrecision + OpMemberDecorate %7 2 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %59 RelaxedPrecision + OpDecorate %62 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %87 RelaxedPrecision + OpDecorate %89 RelaxedPrecision + OpDecorate %92 RelaxedPrecision + OpDecorate %94 RelaxedPrecision + OpDecorate %98 RelaxedPrecision + OpDecorate %99 RelaxedPrecision + OpDecorate %101 RelaxedPrecision + OpDecorate %106 RelaxedPrecision + OpDecorate %112 RelaxedPrecision + OpDecorate %117 RelaxedPrecision + OpDecorate %119 RelaxedPrecision + OpDecorate %123 RelaxedPrecision + OpDecorate %135 RelaxedPrecision + OpDecorate %137 RelaxedPrecision + OpMemberDecorate %139 0 Offset 0 + OpDecorate %139 Block + OpDecorate %141 DescriptorSet 0 + OpDecorate %141 Binding 0 + OpDecorate %151 RelaxedPrecision + OpDecorate %157 RelaxedPrecision + OpDecorate %160 RelaxedPrecision + OpDecorate %164 RelaxedPrecision + OpDecorate %165 RelaxedPrecision + OpDecorate %169 RelaxedPrecision + OpDecorate %171 RelaxedPrecision + OpDecorate %173 RelaxedPrecision + OpDecorate %179 RelaxedPrecision + OpDecorate %182 RelaxedPrecision + OpDecorate %183 RelaxedPrecision + OpDecorate %189 RelaxedPrecision + OpDecorate %215 RelaxedPrecision + OpDecorate %228 RelaxedPrecision + OpDecorate %237 RelaxedPrecision + OpDecorate %242 RelaxedPrecision + OpDecorate %251 RelaxedPrecision + OpDecorate %252 RelaxedPrecision + OpDecorate %255 RelaxedPrecision + OpDecorate %258 RelaxedPrecision + OpDecorate %259 RelaxedPrecision + OpDecorate %260 RelaxedPrecision + OpDecorate %261 RelaxedPrecision + OpDecorate %268 RelaxedPrecision + OpDecorate %274 RelaxedPrecision + OpDecorate %275 RelaxedPrecision + OpDecorate %276 RelaxedPrecision + OpDecorate %277 RelaxedPrecision + OpDecorate %280 RelaxedPrecision + OpDecorate %283 RelaxedPrecision + OpDecorate %284 RelaxedPrecision + OpDecorate %286 RelaxedPrecision + OpDecorate %289 RelaxedPrecision + OpDecorate %290 RelaxedPrecision + OpDecorate %292 RelaxedPrecision + OpDecorate %295 RelaxedPrecision + OpDecorate %296 RelaxedPrecision + OpDecorate %299 RelaxedPrecision + OpDecorate %302 RelaxedPrecision + OpDecorate %303 RelaxedPrecision + OpDecorate %305 RelaxedPrecision + OpDecorate %308 RelaxedPrecision + OpDecorate %309 RelaxedPrecision + OpDecorate %311 RelaxedPrecision + OpDecorate %314 RelaxedPrecision + OpDecorate %315 RelaxedPrecision + OpDecorate %316 RelaxedPrecision + OpDecorate %317 RelaxedPrecision + OpDecorate %323 RelaxedPrecision + OpDecorate %329 RelaxedPrecision + OpDecorate %330 RelaxedPrecision + OpDecorate %331 RelaxedPrecision + OpDecorate %336 RelaxedPrecision + OpDecorate %338 RelaxedPrecision + OpDecorate %342 RelaxedPrecision + OpDecorate %347 RelaxedPrecision + OpDecorate %349 RelaxedPrecision + OpDecorate %352 RelaxedPrecision + OpDecorate %355 RelaxedPrecision + OpDecorate %356 RelaxedPrecision + OpDecorate %359 RelaxedPrecision + OpDecorate %370 RelaxedPrecision + OpDecorate %371 RelaxedPrecision + OpDecorate %374 RelaxedPrecision + OpDecorate %381 BuiltIn FragCoord + OpDecorate %397 RelaxedPrecision + OpDecorate %399 RelaxedPrecision + OpDecorate %405 RelaxedPrecision + OpDecorate %408 RelaxedPrecision + OpDecorate %410 RelaxedPrecision + OpDecorate %411 RelaxedPrecision + OpDecorate %412 RelaxedPrecision + OpDecorate %417 RelaxedPrecision + OpDecorate %421 RelaxedPrecision + OpDecorate %422 RelaxedPrecision + OpDecorate %426 RelaxedPrecision + OpDecorate %427 RelaxedPrecision + OpDecorate %431 RelaxedPrecision + OpDecorate %436 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 %6 %6 + %8 = OpTypePointer Function %7 + %9 = OpTypePointer Function %6 + %10 = OpTypeFunction %2 %8 %9 + %15 = OpTypeFunction %2 %9 %9 + %20 = OpTypeFunction %6 %9 + %24 = OpTypeFloat 32 + %25 = OpTypePointer Function %24 + %26 = OpTypeVector %24 3 + %27 = OpTypeFunction %26 %25 + %31 = OpTypeFunction %24 %25 + %35 = OpConstant %6 0 + %38 = OpConstant %6 1 + %39 = OpConstant %6 -1 + %41 = OpConstant %6 2 + %51 = OpTypeBool + %54 = OpTypeInt 32 0 + %55 = OpConstant %54 10 + %56 = OpTypeArray %7 %55 + %57 = OpTypePointer Private %56 + %58 = OpVariable %57 Private + %60 = OpTypePointer Private %6 + %77 = OpTypePointer Private %7 + %113 = OpConstant %54 50 + %114 = OpTypeArray %24 %113 + %115 = OpTypePointer Function %114 + %120 = OpConstant %6 50 + %138 = OpTypeVector %24 2 + %139 = OpTypeStruct %138 + %140 = OpTypePointer Uniform %139 + %141 = OpVariable %140 Uniform + %142 = OpConstant %54 0 + %143 = OpTypePointer Uniform %24 + %146 = OpConstant %54 1 + %187 = OpConstant %6 15 + %191 = OpConstant %24 30 + %193 = OpConstant %24 1 + %194 = OpConstant %24 5 + %200 = OpConstant %24 50 + %205 = OpConstant %24 6.5 + %209 = OpConstant %24 1.5 + %213 = OpConstant %6 100 + %219 = OpConstant %24 4 + %223 = OpConstant %24 0 + %226 = OpConstant %6 6 + %234 = OpConstant %24 10 + %235 = OpConstant %6 30 + %243 = OpConstant %6 9 + %253 = OpConstant %6 5 + %267 = OpConstantTrue %51 + %269 = OpConstant %6 7 + %278 = OpConstant %6 12 + %297 = OpConstant %6 8 + %324 = OpConstant %6 3 + %332 = OpTypeArray %24 %55 + %333 = OpTypeStruct %332 %332 + %334 = OpTypePointer Function %333 + %339 = OpConstant %6 10 + %357 = OpConstant %6 17 + %372 = OpConstant %6 13 + %377 = OpTypePointer Function %138 + %379 = OpTypeVector %24 4 + %380 = OpTypePointer Input %379 + %381 = OpVariable %380 Input + %384 = OpConstant %24 256 + %385 = OpConstantComposite %138 %384 %384 + %398 = OpConstant %6 -100 + %406 = OpConstant %6 20 + %435 = OpTypePointer Output %379 + %436 = OpVariable %435 Output + %442 = OpTypePointer Function %26 + %446 = OpConstantComposite %26 %193 %223 %223 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %242 = OpVariable %9 Function + %244 = OpVariable %8 Function + %247 = OpVariable %9 Function + %254 = OpVariable %9 Function + %256 = OpVariable %9 Function + %260 = OpVariable %9 Function + %261 = OpVariable %9 Function + %279 = OpVariable %9 Function + %281 = OpVariable %9 Function + %285 = OpVariable %9 Function + %287 = OpVariable %9 Function + %291 = OpVariable %9 Function + %293 = OpVariable %9 Function + %298 = OpVariable %9 Function + %300 = OpVariable %9 Function + %304 = OpVariable %9 Function + %306 = OpVariable %9 Function + %310 = OpVariable %9 Function + %312 = OpVariable %9 Function + %316 = OpVariable %9 Function + %317 = OpVariable %9 Function + %331 = OpVariable %9 Function + %335 = OpVariable %334 Function + %358 = OpVariable %9 Function + %360 = OpVariable %9 Function + %373 = OpVariable %9 Function + %375 = OpVariable %9 Function + %378 = OpVariable %377 Function + %387 = OpVariable %25 Function + %388 = OpVariable %25 Function + %392 = OpVariable %25 Function + %393 = OpVariable %25 Function + %397 = OpVariable %9 Function + %399 = OpVariable %9 Function + %408 = OpVariable %9 Function + %409 = OpVariable %9 Function + %428 = OpVariable %25 Function + %443 = OpVariable %442 Function + %448 = OpVariable %25 Function + OpStore %242 %35 + %245 = OpAccessChain %77 %58 %35 + %246 = OpLoad %7 %245 + OpStore %244 %246 + OpStore %247 %243 + %248 = OpFunctionCall %2 %13 %244 %247 + %249 = OpLoad %7 %244 + %250 = OpAccessChain %77 %58 %35 + OpStore %250 %249 + %251 = OpLoad %6 %242 + %252 = OpIAdd %6 %251 %38 + OpStore %242 %252 + %255 = OpLoad %6 %242 + OpStore %254 %255 + OpStore %256 %253 + %257 = OpFunctionCall %2 %18 %254 %256 + %258 = OpLoad %6 %242 + %259 = OpIAdd %6 %258 %38 + OpStore %242 %259 + OpStore %260 %35 + OpStore %261 %35 + OpBranch %262 + %262 = OpLabel + OpLoopMerge %264 %265 None + OpBranch %266 + %266 = OpLabel + OpBranchConditional %267 %263 %264 + %263 = OpLabel + %268 = OpLoad %6 %260 + %270 = OpSGreaterThanEqual %51 %268 %269 + OpSelectionMerge %272 None + OpBranchConditional %270 %271 %272 + %271 = OpLabel + OpBranch %264 + %272 = OpLabel + %274 = OpLoad %6 %260 + %275 = OpIAdd %6 %274 %38 + OpStore %260 %275 + OpBranch %265 + %265 = OpLabel + %276 = OpLoad %6 %261 + %277 = OpIAdd %6 %276 %38 + OpStore %261 %277 + OpBranch %262 + %264 = OpLabel + %280 = OpLoad %6 %242 + OpStore %279 %280 + OpStore %281 %278 + %282 = OpFunctionCall %2 %18 %279 %281 + %283 = OpLoad %6 %242 + %284 = OpIAdd %6 %283 %38 + OpStore %242 %284 + %286 = OpLoad %6 %242 + OpStore %285 %286 + OpStore %287 %187 + %288 = OpFunctionCall %2 %18 %285 %287 + %289 = OpLoad %6 %242 + %290 = OpIAdd %6 %289 %38 + OpStore %242 %290 + %292 = OpLoad %6 %242 + OpStore %291 %292 + OpStore %293 %269 + %294 = OpFunctionCall %2 %18 %291 %293 + %295 = OpLoad %6 %242 + %296 = OpIAdd %6 %295 %38 + OpStore %242 %296 + %299 = OpLoad %6 %242 + OpStore %298 %299 + OpStore %300 %297 + %301 = OpFunctionCall %2 %18 %298 %300 + %302 = OpLoad %6 %242 + %303 = OpIAdd %6 %302 %38 + OpStore %242 %303 + %305 = OpLoad %6 %242 + OpStore %304 %305 + OpStore %306 %41 + %307 = OpFunctionCall %2 %18 %304 %306 + %308 = OpLoad %6 %242 + %309 = OpIAdd %6 %308 %38 + OpStore %242 %309 + %311 = OpLoad %6 %242 + OpStore %310 %311 + OpStore %312 %226 + %313 = OpFunctionCall %2 %18 %310 %312 + %314 = OpLoad %6 %242 + %315 = OpIAdd %6 %314 %38 + OpStore %242 %315 + OpStore %316 %35 + OpStore %317 %35 + OpBranch %318 + %318 = OpLabel + OpLoopMerge %320 %321 None + OpBranch %322 + %322 = OpLabel + OpBranchConditional %267 %319 %320 + %319 = OpLabel + %323 = OpLoad %6 %316 + %325 = OpSGreaterThanEqual %51 %323 %324 + OpSelectionMerge %327 None + OpBranchConditional %325 %326 %327 + %326 = OpLabel + OpBranch %320 + %327 = OpLabel + %329 = OpLoad %6 %316 + %330 = OpIAdd %6 %329 %38 + OpStore %316 %330 + OpStore %331 %38 + %336 = OpLoad %6 %331 + %337 = OpSGreaterThanEqual %51 %336 %35 + %338 = OpLoad %6 %331 + %340 = OpSLessThan %51 %338 %339 + %341 = OpLogicalAnd %51 %337 %340 + %342 = OpLoad %6 %331 + %343 = OpSelect %6 %341 %342 %35 + %344 = OpAccessChain %25 %335 %38 %38 + %345 = OpLoad %24 %344 + %346 = OpAccessChain %25 %335 %38 %343 + OpStore %346 %345 + %347 = OpLoad %6 %317 + %348 = OpSGreaterThanEqual %51 %347 %35 + %349 = OpLoad %6 %317 + %350 = OpSLessThan %51 %349 %339 + %351 = OpLogicalAnd %51 %348 %350 + %352 = OpLoad %6 %317 + %353 = OpSelect %6 %351 %352 %35 + %354 = OpAccessChain %25 %335 %38 %353 + OpStore %354 %193 + OpBranch %321 + %321 = OpLabel + %355 = OpLoad %6 %317 + %356 = OpIAdd %6 %355 %38 + OpStore %317 %356 + OpBranch %318 + %320 = OpLabel + %359 = OpLoad %6 %242 + OpStore %358 %359 + OpStore %360 %357 + %361 = OpFunctionCall %2 %18 %358 %360 + %362 = OpAccessChain %143 %141 %35 %142 + %363 = OpLoad %24 %362 + %364 = OpAccessChain %143 %141 %35 %146 + %365 = OpLoad %24 %364 + %366 = OpFOrdGreaterThan %51 %363 %365 + OpSelectionMerge %368 None + OpBranchConditional %366 %367 %368 + %367 = OpLabel + OpReturn + %368 = OpLabel + %370 = OpLoad %6 %242 + %371 = OpIAdd %6 %370 %38 + OpStore %242 %371 + %374 = OpLoad %6 %242 + OpStore %373 %374 + OpStore %375 %372 + %376 = OpFunctionCall %2 %18 %373 %375 + %382 = OpLoad %379 %381 + %383 = OpVectorShuffle %138 %382 %382 1 0 + %386 = OpFDiv %138 %383 %385 + OpStore %378 %386 + %389 = OpAccessChain %25 %378 %142 + %390 = OpLoad %24 %389 + OpStore %388 %390 + %391 = OpFunctionCall %24 %33 %388 + OpStore %387 %391 + %394 = OpAccessChain %25 %378 %146 + %395 = OpLoad %24 %394 + OpStore %393 %395 + %396 = OpFunctionCall %24 %33 %393 + OpStore %392 %396 + OpStore %397 %398 + OpStore %399 %35 + OpBranch %400 + %400 = OpLabel + OpLoopMerge %402 %403 None + OpBranch %404 + %404 = OpLabel + %405 = OpLoad %6 %399 + %407 = OpSLessThan %51 %405 %406 + OpBranchConditional %407 %401 %402 + %401 = OpLabel + %410 = OpLoad %6 %399 + OpStore %409 %410 + %411 = OpFunctionCall %6 %22 %409 + OpStore %408 %411 + %412 = OpLoad %6 %408 + %413 = OpSGreaterThan %51 %412 %35 + OpSelectionMerge %415 None + OpBranchConditional %413 %414 %416 + %414 = OpLabel + OpBranch %415 + %416 = OpLabel + %417 = OpLoad %6 %408 + OpSelectionMerge %420 None + OpSwitch %417 %420 -1 %418 0 %419 + %418 = OpLabel + %421 = OpLoad %6 %397 + %422 = OpIAdd %6 %421 %38 + OpStore %397 %422 + OpBranch %420 + %419 = OpLabel + OpReturn + %420 = OpLabel + OpBranch %415 + %415 = OpLabel + OpBranch %403 + %403 = OpLabel + %426 = OpLoad %6 %399 + %427 = OpIAdd %6 %426 %38 + OpStore %399 %427 + OpBranch %400 + %402 = OpLabel + %429 = OpLoad %24 %387 + %430 = OpLoad %24 %392 + %431 = OpLoad %6 %397 + %432 = OpConvertSToF %24 %431 + %433 = OpFMul %24 %430 %432 + %434 = OpFAdd %24 %429 %433 + OpStore %428 %434 + %437 = OpAccessChain %143 %141 %35 %142 + %438 = OpLoad %24 %437 + %439 = OpAccessChain %143 %141 %35 %146 + %440 = OpLoad %24 %439 + %441 = OpFOrdLessThan %51 %438 %440 + OpSelectionMerge %445 None + OpBranchConditional %441 %444 %447 + %444 = OpLabel + OpStore %443 %446 + OpBranch %445 + %447 = OpLabel + %449 = OpLoad %24 %428 + OpStore %448 %449 + %450 = OpFunctionCall %26 %29 %448 + OpStore %443 %450 + OpBranch %445 + %445 = OpLabel + %451 = OpLoad %26 %443 + %452 = OpCompositeExtract %24 %451 0 + %453 = OpCompositeExtract %24 %451 1 + %454 = OpCompositeExtract %24 %451 2 + %455 = OpCompositeConstruct %379 %452 %453 %454 %193 + OpStore %436 %455 + OpReturn + OpFunctionEnd + %13 = OpFunction %2 None %10 + %11 = OpFunctionParameter %8 + %12 = OpFunctionParameter %9 + %14 = OpLabel + %36 = OpLoad %6 %12 + %37 = OpAccessChain %9 %11 %35 + OpStore %37 %36 + %40 = OpAccessChain %9 %11 %38 + OpStore %40 %39 + %42 = OpAccessChain %9 %11 %41 + OpStore %42 %39 + OpReturn + OpFunctionEnd + %18 = OpFunction %2 None %15 + %16 = OpFunctionParameter %9 + %17 = OpFunctionParameter %9 + %19 = OpLabel + %43 = OpVariable %9 Function + %76 = OpVariable %8 Function + %80 = OpVariable %9 Function + %102 = OpVariable %8 Function + %105 = OpVariable %9 Function + %112 = OpVariable %9 Function + %116 = OpVariable %115 Function + OpStore %43 %35 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %6 %43 + %50 = OpLoad %6 %16 + %52 = OpSLessThanEqual %51 %49 %50 + OpBranchConditional %52 %45 %46 + %45 = OpLabel + %53 = OpLoad %6 %17 + %59 = OpLoad %6 %43 + %61 = OpAccessChain %60 %58 %59 %35 + %62 = OpLoad %6 %61 + %63 = OpSLessThanEqual %51 %53 %62 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %91 + %64 = OpLabel + %66 = OpLoad %6 %43 + %67 = OpAccessChain %60 %58 %66 %38 + %68 = OpLoad %6 %67 + %69 = OpIEqual %51 %68 %39 + OpSelectionMerge %71 None + OpBranchConditional %69 %70 %86 + %70 = OpLabel + %72 = OpLoad %6 %43 + %73 = OpLoad %6 %16 + %74 = OpAccessChain %60 %58 %72 %38 + OpStore %74 %73 + %75 = OpLoad %6 %16 + %78 = OpAccessChain %77 %58 %75 + %79 = OpLoad %7 %78 + OpStore %76 %79 + %81 = OpLoad %6 %17 + OpStore %80 %81 + %82 = OpFunctionCall %2 %13 %76 %80 + %83 = OpLoad %7 %76 + %84 = OpAccessChain %77 %58 %75 + OpStore %84 %83 + OpReturn + %86 = OpLabel + %87 = OpLoad %6 %43 + %88 = OpAccessChain %60 %58 %87 %38 + %89 = OpLoad %6 %88 + OpStore %43 %89 + OpBranch %47 + %71 = OpLabel + OpBranch %65 + %91 = OpLabel + %92 = OpLoad %6 %43 + %93 = OpAccessChain %60 %58 %92 %41 + %94 = OpLoad %6 %93 + %95 = OpIEqual %51 %94 %39 + OpSelectionMerge %97 None + OpBranchConditional %95 %96 %111 + %96 = OpLabel + %98 = OpLoad %6 %43 + %99 = OpLoad %6 %16 + %100 = OpAccessChain %60 %58 %98 %41 + OpStore %100 %99 + %101 = OpLoad %6 %16 + %103 = OpAccessChain %77 %58 %101 + %104 = OpLoad %7 %103 + OpStore %102 %104 + %106 = OpLoad %6 %17 + OpStore %105 %106 + %107 = OpFunctionCall %2 %13 %102 %105 + %108 = OpLoad %7 %102 + %109 = OpAccessChain %77 %58 %101 + OpStore %109 %108 + OpReturn + %111 = OpLabel + OpStore %112 %38 + %117 = OpLoad %6 %112 + %118 = OpSGreaterThanEqual %51 %117 %35 + %119 = OpLoad %6 %112 + %121 = OpSLessThan %51 %119 %120 + %122 = OpLogicalAnd %51 %118 %121 + %123 = OpLoad %6 %112 + %124 = OpSelect %6 %122 %123 %35 + %125 = OpAccessChain %25 %116 %35 + %126 = OpLoad %24 %125 + %127 = OpAccessChain %25 %116 %124 + %128 = OpLoad %24 %127 + %129 = OpFAdd %24 %128 %126 + %130 = OpAccessChain %25 %116 %124 + OpStore %130 %129 + OpBranch %131 + %131 = OpLabel + OpLoopMerge %133 %134 None + OpBranch %132 + %132 = OpLabel + %135 = OpLoad %6 %43 + %136 = OpAccessChain %60 %58 %135 %41 + %137 = OpLoad %6 %136 + OpStore %43 %137 + OpBranch %134 + %134 = OpLabel + %144 = OpAccessChain %143 %141 %35 %142 + %145 = OpLoad %24 %144 + %147 = OpAccessChain %143 %141 %35 %146 + %148 = OpLoad %24 %147 + %149 = OpFOrdGreaterThan %51 %145 %148 + OpBranchConditional %149 %131 %133 + %133 = OpLabel + OpBranch %47 + %97 = OpLabel + OpBranch %65 + %65 = OpLabel + OpBranch %47 + %47 = OpLabel + OpBranch %44 + %46 = OpLabel + OpReturn + OpFunctionEnd + %22 = OpFunction %6 None %20 + %21 = OpFunctionParameter %9 + %23 = OpLabel + %151 = OpVariable %9 Function + %159 = OpVariable %8 Function + %175 = OpVariable %9 Function + OpStore %151 %35 + OpBranch %152 + %152 = OpLabel + OpLoopMerge %154 %155 None + OpBranch %156 + %156 = OpLabel + %157 = OpLoad %6 %151 + %158 = OpINotEqual %51 %157 %39 + OpBranchConditional %158 %153 %154 + %153 = OpLabel + %160 = OpLoad %6 %151 + %161 = OpAccessChain %77 %58 %160 + %162 = OpLoad %7 %161 + OpStore %159 %162 + %163 = OpAccessChain %9 %159 %35 + %164 = OpLoad %6 %163 + %165 = OpLoad %6 %21 + %166 = OpIEqual %51 %164 %165 + OpSelectionMerge %168 None + OpBranchConditional %166 %167 %168 + %167 = OpLabel + %169 = OpLoad %6 %21 + OpReturnValue %169 + %168 = OpLabel + %171 = OpLoad %6 %21 + %172 = OpAccessChain %9 %159 %35 + %173 = OpLoad %6 %172 + %174 = OpSGreaterThan %51 %171 %173 + OpSelectionMerge %177 None + OpBranchConditional %174 %176 %180 + %176 = OpLabel + %178 = OpAccessChain %9 %159 %41 + %179 = OpLoad %6 %178 + OpStore %175 %179 + OpBranch %177 + %180 = OpLabel + %181 = OpAccessChain %9 %159 %38 + %182 = OpLoad %6 %181 + OpStore %175 %182 + OpBranch %177 + %177 = OpLabel + %183 = OpLoad %6 %175 + OpStore %151 %183 + OpBranch %155 + %155 = OpLabel + OpBranch %152 + %154 = OpLabel + OpReturnValue %39 + OpFunctionEnd + %29 = OpFunction %26 None %27 + %28 = OpFunctionParameter %25 + %30 = OpLabel + %186 = OpVariable %25 Function + %188 = OpVariable %9 Function + OpStore %188 %187 + %189 = OpFunctionCall %6 %22 %188 + %190 = OpConvertSToF %24 %189 + OpStore %186 %190 + %192 = OpLoad %24 %28 + %195 = OpLoad %24 %186 + %196 = OpCompositeConstruct %26 %193 %194 %195 + %197 = OpVectorTimesScalar %26 %196 %192 + %198 = OpCompositeConstruct %26 %191 %191 %191 + %199 = OpFAdd %26 %198 %197 + %201 = OpCompositeConstruct %26 %200 %200 %200 + %202 = OpFDiv %26 %199 %201 + OpReturnValue %202 + OpFunctionEnd + %33 = OpFunction %24 None %31 + %32 = OpFunctionParameter %25 + %34 = OpLabel + %214 = OpVariable %9 Function + %227 = OpVariable %9 Function + %236 = OpVariable %9 Function + %206 = OpLoad %24 %32 + %207 = OpFMul %24 %206 %205 + OpStore %32 %207 + %208 = OpLoad %24 %32 + %210 = OpFOrdLessThan %51 %208 %209 + OpSelectionMerge %212 None + OpBranchConditional %210 %211 %212 + %211 = OpLabel + OpStore %214 %213 + %215 = OpFunctionCall %6 %22 %214 + %216 = OpConvertSToF %24 %215 + OpReturnValue %216 + %212 = OpLabel + %218 = OpLoad %24 %32 + %220 = OpFOrdLessThan %51 %218 %219 + OpSelectionMerge %222 None + OpBranchConditional %220 %221 %222 + %221 = OpLabel + OpReturnValue %223 + %222 = OpLabel + %225 = OpLoad %24 %32 + OpStore %227 %226 + %228 = OpFunctionCall %6 %22 %227 + %229 = OpConvertSToF %24 %228 + %230 = OpFOrdLessThan %51 %225 %229 + OpSelectionMerge %232 None + OpBranchConditional %230 %231 %232 + %231 = OpLabel + OpReturnValue %193 + %232 = OpLabel + OpStore %236 %235 + %237 = OpFunctionCall %6 %22 %236 + %238 = OpConvertSToF %24 %237 + %239 = OpFAdd %24 %234 %238 + OpReturnValue %239 + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics gfz_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR gfz_pipeline 0 0 0 255 + +CLEAR gfz_pipeline +RUN gfz_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer IDX 0 0 SIZE 256 256 EQ_RGB 255 0 0 \ No newline at end of file diff --git a/vulkan/amber/graphicsfuzz/write-red-in-loop-nest.amber b/vulkan/amber/graphicsfuzz/write-red-in-loop-nest.amber new file mode 100644 index 0000000..956aff7 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/write-red-in-loop-nest.amber @@ -0,0 +1,323 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader that writes red in a nest of loops + +# The test passes because the write of red is reachable, it is the only reachable +# write, and the would-be-infinite loop is not reachable. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int idx; +# mat4x3 m43; +# m43 = mat4x3(1.0); +# float sums[9]; +# int ll1 = 0; +# for( +# int rows = 2; +# true; +# 1 +# ) +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# if(ll1 >= 5) { +# break; +# } +# ll1++; +# +# int ll4 = 10; +# int ll2 = 0; +# for( +# int c = 0; +# c < 1; +# c ++ +# ) +# { +# if(ll2 >= 0) { +# break; // Immediately breaks the loop +# } +# ll2++; +# +# mat4x3 tempm43; +# tempm43 = m43; +# int ll3 = 0; +# for( +# int d = 0; +# 1 < ll4; // This loop is not reachable +# d ++ +# ) +# { +# int r; +# tempm43[d >= 0 && d < 4 ? d : 0][r >= 0 && r < 3 ? r : 0] = 1.0; +# } +# sums[idx >= 0 && idx < 9 ? idx : 0] += m43[c][1]; +# } +# idx ++; +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 120 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "m43" + OpName %20 "ll1" + OpName %22 "rows" + OpName %33 "_GLF_color" + OpName %44 "ll4" + OpName %46 "ll2" + OpName %47 "c" + OpName %62 "tempm43" + OpName %64 "ll3" + OpName %65 "d" + OpName %81 "r" + OpName %98 "sums" + OpName %99 "idx" + OpDecorate %20 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %33 Location 0 + OpDecorate %35 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + OpDecorate %61 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %65 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %82 RelaxedPrecision + OpDecorate %84 RelaxedPrecision + OpDecorate %88 RelaxedPrecision + OpDecorate %92 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %99 RelaxedPrecision + OpDecorate %100 RelaxedPrecision + OpDecorate %102 RelaxedPrecision + OpDecorate %106 RelaxedPrecision + OpDecorate %108 RelaxedPrecision + OpDecorate %116 RelaxedPrecision + OpDecorate %117 RelaxedPrecision + OpDecorate %118 RelaxedPrecision + OpDecorate %119 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeMatrix %7 4 + %9 = OpTypePointer Function %8 + %11 = OpConstant %6 1 + %12 = OpConstant %6 0 + %13 = OpConstantComposite %7 %11 %12 %12 + %14 = OpConstantComposite %7 %12 %11 %12 + %15 = OpConstantComposite %7 %12 %12 %11 + %16 = OpConstantComposite %7 %12 %12 %12 + %17 = OpConstantComposite %8 %13 %14 %15 %16 + %18 = OpTypeInt 32 1 + %19 = OpTypePointer Function %18 + %21 = OpConstant %18 0 + %23 = OpConstant %18 2 + %29 = OpTypeBool + %30 = OpConstantTrue %29 + %31 = OpTypeVector %6 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpConstantComposite %31 %11 %12 %12 %11 + %36 = OpConstant %18 5 + %42 = OpConstant %18 1 + %45 = OpConstant %18 10 + %76 = OpConstant %18 4 + %85 = OpConstant %18 3 + %90 = OpTypePointer Function %6 + %94 = OpTypeInt 32 0 + %95 = OpConstant %94 9 + %96 = OpTypeArray %6 %95 + %97 = OpTypePointer Function %96 + %103 = OpConstant %18 9 + %109 = OpConstant %94 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %10 = OpVariable %9 Function + %20 = OpVariable %19 Function + %22 = OpVariable %19 Function + %44 = OpVariable %19 Function + %46 = OpVariable %19 Function + %47 = OpVariable %19 Function + %62 = OpVariable %9 Function + %64 = OpVariable %19 Function + %65 = OpVariable %19 Function + %81 = OpVariable %19 Function + %98 = OpVariable %97 Function + %99 = OpVariable %19 Function + OpStore %10 %17 + OpStore %20 %21 + OpStore %22 %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + OpBranchConditional %30 %25 %26 + %25 = OpLabel + OpStore %33 %34 + %35 = OpLoad %18 %20 + %37 = OpSGreaterThanEqual %29 %35 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + OpBranch %26 + %39 = OpLabel + %41 = OpLoad %18 %20 + %43 = OpIAdd %18 %41 %42 + OpStore %20 %43 + OpStore %44 %45 + OpStore %46 %21 + OpStore %47 %21 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %18 %47 + %54 = OpSLessThan %29 %53 %42 + OpBranchConditional %54 %49 %50 + %49 = OpLabel + %55 = OpLoad %18 %46 + %56 = OpSGreaterThanEqual %29 %55 %21 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + OpBranch %50 + %58 = OpLabel + %60 = OpLoad %18 %46 + %61 = OpIAdd %18 %60 %42 + OpStore %46 %61 + %63 = OpLoad %8 %10 + OpStore %62 %63 + OpStore %64 %21 + OpStore %65 %21 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %18 %44 + %72 = OpSLessThan %29 %42 %71 + OpBranchConditional %72 %67 %68 + %67 = OpLabel + %73 = OpLoad %18 %65 + %74 = OpSGreaterThanEqual %29 %73 %21 + %75 = OpLoad %18 %65 + %77 = OpSLessThan %29 %75 %76 + %78 = OpLogicalAnd %29 %74 %77 + %79 = OpLoad %18 %65 + %80 = OpSelect %18 %78 %79 %21 + %82 = OpLoad %18 %81 + %83 = OpSGreaterThanEqual %29 %82 %21 + %84 = OpLoad %18 %81 + %86 = OpSLessThan %29 %84 %85 + %87 = OpLogicalAnd %29 %83 %86 + %88 = OpLoad %18 %81 + %89 = OpSelect %18 %87 %88 %21 + %91 = OpAccessChain %90 %62 %80 %89 + OpStore %91 %11 + OpBranch %69 + %69 = OpLabel + %92 = OpLoad %18 %65 + %93 = OpIAdd %18 %92 %42 + OpStore %65 %93 + OpBranch %66 + %68 = OpLabel + %100 = OpLoad %18 %99 + %101 = OpSGreaterThanEqual %29 %100 %21 + %102 = OpLoad %18 %99 + %104 = OpSLessThan %29 %102 %103 + %105 = OpLogicalAnd %29 %101 %104 + %106 = OpLoad %18 %99 + %107 = OpSelect %18 %105 %106 %21 + %108 = OpLoad %18 %47 + %110 = OpAccessChain %90 %10 %108 %109 + %111 = OpLoad %6 %110 + %112 = OpAccessChain %90 %98 %107 + %113 = OpLoad %6 %112 + %114 = OpFAdd %6 %113 %111 + %115 = OpAccessChain %90 %98 %107 + OpStore %115 %114 + OpBranch %51 + %51 = OpLabel + %116 = OpLoad %18 %47 + %117 = OpIAdd %18 %116 %42 + OpStore %47 %117 + OpBranch %48 + %50 = OpLabel + %118 = OpLoad %18 %99 + %119 = OpIAdd %18 %118 %42 + OpStore %99 %119 + OpBranch %27 + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injected +BUFFER variant_injected DATA_TYPE int32 DATA + 1 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics gfz_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER variant_injected AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR gfz_pipeline 0 0 0 255 + +CLEAR gfz_pipeline +RUN gfz_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer IDX 0 0 SIZE 256 256 EQ_RGB 255 0 0 \ No newline at end of file diff --git a/vulkan/amber/graphicsfuzz/wrong-color-in-always-false-if.amber b/vulkan/amber/graphicsfuzz/wrong-color-in-always-false-if.amber new file mode 100644 index 0000000..30f11f0 --- /dev/null +++ b/vulkan/amber/graphicsfuzz/wrong-color-in-always-false-if.amber @@ -0,0 +1,151 @@ +#!amber + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# A test for a bug found by GraphicsFuzz. + +# Short description: A fragment shader with wrong color write in false if + +# The test passes because the shader always writes color red. +# Wrong color mix and write is inside a false if statement. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# void main() +# { +# float height; +# height = 256.0; +# +# if (injectionSwitch.y < 0.0) // always false +# { +# _GLF_color = mix(vec4(30.18, 8840.7235, 469.970, 18.24), vec4(9.9, 0.1, 1169.5387, 55.79), vec4(7612.9451, 797.011, height, 9.0)); +# } +# +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Write color red +# } +SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %28 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "height" + OpName %11 "buf0" + OpMemberName %11 0 "injectionSwitch" + OpName %13 "" + OpName %28 "_GLF_color" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %28 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 256 + %10 = OpTypeVector %6 2 + %11 = OpTypeStruct %10 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 1 + %18 = OpTypePointer Uniform %6 + %21 = OpConstant %6 0 + %22 = OpTypeBool + %26 = OpTypeVector %6 4 + %27 = OpTypePointer Output %26 + %28 = OpVariable %27 Output + %29 = OpConstant %6 30.1800003 + %30 = OpConstant %6 8840.72363 + %31 = OpConstant %6 469.970001 + %32 = OpConstant %6 18.2399998 + %33 = OpConstantComposite %26 %29 %30 %31 %32 + %34 = OpConstant %6 9.89999962 + %35 = OpConstant %6 0.100000001 + %36 = OpConstant %6 1169.5387 + %37 = OpConstant %6 55.7900009 + %38 = OpConstantComposite %26 %34 %35 %36 %37 + %39 = OpConstant %6 7612.94531 + %40 = OpConstant %6 797.010986 + %42 = OpConstant %6 9 + %45 = OpConstant %6 1 + %46 = OpConstantComposite %26 %45 %21 %21 %45 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + %19 = OpAccessChain %18 %13 %15 %17 + %20 = OpLoad %6 %19 + %23 = OpFOrdLessThan %22 %20 %21 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + %41 = OpLoad %6 %8 + %43 = OpCompositeConstruct %26 %39 %40 %41 %42 + %44 = OpExtInst %26 %1 FMix %33 %38 %43 + OpStore %28 %44 + OpBranch %25 + %25 = OpLabel + OpStore %28 %46 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA + 0.0 1.0 +END + +BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics variant_pipeline + ATTACH variant_vertex_shader + ATTACH variant_fragment_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER variant_framebuffer AS color LOCATION 0 + BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 +END +CLEAR_COLOR variant_pipeline 0 0 0 255 + +CLEAR variant_pipeline +RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/ldexp/README.TXT b/vulkan/amber/ldexp/README.TXT new file mode 100644 index 0000000..9fec3a3 --- /dev/null +++ b/vulkan/amber/ldexp/README.TXT @@ -0,0 +1,63 @@ +How the Amber files were generated: + +1. Wrote template.glsl. + +This base shader is a compute shader with 64 invocations that receives 3 +buffers. + + a. One to receive the significands (some kind of floating point) for the + ldexp operation. + + b. Another one that contains the exponents (some kind of integer) for the + ldexp operation. + + c. Another one to store the results in the same kind of floating point type + as the significands. + +The numbers (the buffer contents) will be the same for scalars, vec2 and vec4, +but when interpreted as scalars, vec2 and vec4 the number of actual operations +varies. As the shader always has 64 invocations, we pass the actual operation +count in a push constant and check the invocation index against it. + +We run the ldexp operation and store the result in the results buffer. + +2. Run gen_shaders.py. + +This generates glsl versions of all shaders for all desired type combinations +of significands and exponents. These are the ldexp*.glsl files. + +3. Compile all generated shaders to SPIR-V with gen_spv.sh. + +This generates the ldexp*.spv files. Unfortunately, glslangValidator will fail +to compile variants in which the exponent is a 64-bit integer. Keep reading for +the fix to this issue below. + +4. Disassemble the generated SPIR-V files with gen_spvasm.sh. + +This generates the ldexp*.spvasm files. + +5. Manually add the missing variants glslang was not able to compile + +Based on the 16-bit exponent variants, we can generate 64-bit ones but we need +to: + + a. Replace the Int16 with the Int64 capability. + b. Remove unneeded 16-bit storage capabilities if we do not use Float16. + c. Adjust the stride in the input exponents array. + +6. Manually change the generated SPIR-V assembly + +glslang likes to cast the exponent to a 32-bit integer sometimes, so we need to +remove and change a couple of instructions to make sure the ldexp operations +have the right exponent type. This applies to almost every generated file. + +7. Wrote template.amber + +This will be used to generate .amber files based on each of the final .spvasm +files. + +8. Run gen_amber.py + +This will generate the final .amber files with the right significands, +exponents, buffer contents, shaders, result checks, etc. + diff --git a/vulkan/amber/ldexp/exp64_needed_fixes.txt b/vulkan/amber/ldexp/exp64_needed_fixes.txt new file mode 100644 index 0000000..acca077 --- /dev/null +++ b/vulkan/amber/ldexp/exp64_needed_fixes.txt @@ -0,0 +1,9 @@ +ldexp_f16vec2_i64vec2.glsl.spv.spvasm +ldexp_f16vec4_i64vec4.glsl.spv.spvasm +ldexp_f32vec2_i64vec2.glsl.spv.spvasm +ldexp_f32vec4_i64vec4.glsl.spv.spvasm +ldexp_f64vec2_i64vec2.glsl.spv.spvasm +ldexp_f64vec4_i64vec4.glsl.spv.spvasm +ldexp_float16_t_int64_t.glsl.spv.spvasm +ldexp_float32_t_int64_t.glsl.spv.spvasm +ldexp_float64_t_int64_t.glsl.spv.spvasm diff --git a/vulkan/amber/ldexp/gen_amber.py b/vulkan/amber/ldexp/gen_amber.py new file mode 100755 index 0000000..8151190 --- /dev/null +++ b/vulkan/amber/ldexp/gen_amber.py @@ -0,0 +1,168 @@ +#!/usr/bin/env python +# +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import sys +import re +import math + +# These are fixed. +significands = [ + -1.0, -1.0, -1.0, -1.0, + -1.0, -1.0, -1.0, -1.0, + 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, + 1.25, 1.25, 1.25, 1.25, + 1.25, 1.25, 1.25, 1.25, + 2.0, 2.0, 2.0, 2.0, + 2.0, 2.0, 2.0, 2.0, +] + +initial_results = [ + .0, .0, .0, .0, .0, .0, .0, .0, + .0, .0, .0, .0, .0, .0, .0, .0, + .0, .0, .0, .0, .0, .0, .0, .0, + .0, .0, .0, .0, .0, .0, .0, .0, +] + +fixed_exponents = [1, 0, -1, -2] +optional_exponents = [-14, -126, -1022] +target_exponent_count = 8 +exponent_replicas = len(set(significands)) # To pair each exponent with reach significand. + +def get_component_count_from_type_name(type_name): + if 'vec' in type_name: + return int(type_name[-1]) + return 1 + +def get_bits_from_type_name(type_name): + match_obj = re.search(r'^[a-z]*?([0-9]+).*', type_name) + if match_obj is not None: + return int(match_obj.group(1)) + return 0 + +def min_exponent(bit_count): + return {16: -14, 32: -126, 64: -1022}[bit_count] + +def bits_min(bit_count): + return -(2**(bit_count - 1)) + +def get_amber_float_type(bit_count): + return {16: 'float16', 32: 'float', 64: 'double'}[bit_count] + +def get_amber_int_type(bit_count): + return 'int' + str(bit_count) + +def read_full_file(file_name): + with open(file_name, 'r') as stream: + contents = stream.read() + return contents + +def get_features(asm): + caps = re.findall(r'OpCapability \w+', asm) + caps = [x.split()[1] for x in caps] + caps = [x for x in caps if x != 'Shader'] + cap_to_feature = { + 'Float16': ['Float16Int8Features.shaderFloat16'], + 'Float64': ['shaderFloat64'], + 'Int16': ['shaderInt16'], + 'Int64': ['shaderInt64'], + 'Int8': ['Float16Int8Features.shaderInt8'], + 'StorageBuffer16BitAccess': ['Storage16BitFeatures.storageBuffer16BitAccess', 'Storage16BitFeatures.uniformAndStorageBuffer16BitAccess'], + 'UniformAndStorageBuffer8BitAccess': ['Storage8BitFeatures.uniformAndStorageBuffer8BitAccess'], + } + features = [] + for c in caps: + cap_features = cap_to_feature[c] + for f in cap_features: + features.append('DEVICE_FEATURE %s' % (f,)) + return '\n'.join(features) + +amber_template = read_full_file('template.amber') + +for arg_idx in range(1, len(sys.argv), 1): + spirv_asm = read_full_file(sys.argv[arg_idx]) + device_features = get_features(spirv_asm) + + file_name = sys.argv[arg_idx] + simplified_name = file_name.replace('_t', '') + match_obj = re.match(r'^ldexp_(.*?)_(.*?).glsl.spv.spvasm', simplified_name) + + if match_obj is None: + print('%s does not match the expected file name' % (file_name, ), file=sys.stderr) + continue + + significand_type = match_obj.group(1) + exponent_type = match_obj.group(2) + + component_count = get_component_count_from_type_name(significand_type) + inv_count = int(len(significands) / component_count) + + significand_bits = get_bits_from_type_name(significand_type) + exponent_bits = get_bits_from_type_name(exponent_type) + + if significand_bits == 0 or exponent_bits == 0: + print('Unknown bits in significand or exponent: (%s, %s)' % (significand_bits, exponent_bits), file=sys.stderr) + continue + + smallest_int_exponent = bits_min(exponent_bits) # For the integer exponent operand in the ldexp call. + smallest_float_exponent = min_exponent(significand_bits) # According to the exponent bits in the float type. + + # Try exponents in the limits. + used_exponents = [x for x in fixed_exponents] + for opt_exp in optional_exponents: + if opt_exp > smallest_int_exponent and opt_exp > smallest_float_exponent: + used_exponents.append(opt_exp) + + # Try really small exponents, only taking into account the integer exponent operand. + # Results when using these exponents may be flushed to zero according to the spec. + # At the same time, the upper part of these numbers is all zeros except in the most significant bit. + # If they get truncated by mistake, it results in a positive exponent. + while len(used_exponents) < target_exponent_count: + missing = target_exponent_count - len(used_exponents) + used_exponents.append(smallest_int_exponent + missing + 2) # +2 to make them non-obvious. + + # Repeat exponents multipe times to combine them with each significand. + replica = [x for x in used_exponents] + for replica_idx in range(0, exponent_replicas - 1): + used_exponents.extend(replica) + + amber_float_type = get_amber_float_type(significand_bits) + amber_int_type = get_amber_int_type(exponent_bits) + + expects = [] + for (idx, significand) in enumerate(significands): + exponent = used_exponents[idx] + result = math.ldexp(significand, exponent) + offset = int((significand_bits * idx) / 8) # in bytes + expect = 'EXPECT results IDX %s TOLERANCE .0001 EQ %s\n' % (offset, result) + expects.append(expect) + expects_str = ''.join(expects) + + amber_contents = amber_template.format(device_features=device_features, + spirv_asm=spirv_asm, + significands='\n'.join(str(x) for x in significands), + exponents='\n'.join(str(x) for x in used_exponents), + initial_results='\n'.join(str(x) for x in initial_results), + count=inv_count, + amber_float_type=amber_float_type, + amber_int_type=amber_int_type, + expects=expects_str) + + output_file_name = 'ldexp_%s_%s.amber' % (significand_type, exponent_type) + with open(output_file_name, 'w') as stream: + stream.write(amber_contents) + diff --git a/vulkan/amber/ldexp/gen_shaders.py b/vulkan/amber/ldexp/gen_shaders.py new file mode 100755 index 0000000..a371d09 --- /dev/null +++ b/vulkan/amber/ldexp/gen_shaders.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import sys + +TEMPLATE_NAME = 'template.glsl' +with open(TEMPLATE_NAME, 'r') as stream: + template = stream.read() + +COMPONENT_COUNTS = [1, 2, 4] + +FLOAT16 = ['float16_t', 'f16vec2', 'f16vec3', 'f16vec4'] +FLOAT32 = ['float32_t', 'f32vec2', 'f32vec3', 'f32vec4'] +FLOAT64 = ['float64_t', 'f64vec2', 'f64vec3', 'f64vec4'] + +INT8 = ['int8_t', 'i8vec2', 'i8vec3', 'i8vec4'] +INT16 = ['int16_t', 'i16vec2', 'i16vec3', 'i16vec4'] +INT32 = ['int32_t', 'i32vec2', 'i32vec3', 'i32vec4'] +INT64 = ['int64_t', 'i64vec2', 'i64vec3', 'i64vec4'] + +for component_count in COMPONENT_COUNTS: + type_index = component_count - 1 + for significand_type in (FLOAT16[type_index], FLOAT32[type_index], FLOAT64[type_index]): + for exponent_type in (INT8[type_index], INT16[type_index], INT32[type_index], INT64[type_index]): + shader_code = template.format(significand_type=significand_type, exponent_type=exponent_type) + file_name = 'ldexp_{significand_type}_{exponent_type}.glsl'.format(significand_type=significand_type, exponent_type=exponent_type) + with open(file_name, 'w') as stream: + stream.write(shader_code) + +sys.exit() diff --git a/vulkan/amber/ldexp/gen_spv.sh b/vulkan/amber/ldexp/gen_spv.sh new file mode 100755 index 0000000..f43cf83 --- /dev/null +++ b/vulkan/amber/ldexp/gen_spv.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +for f in ldexp_f*.glsl; do + glslangValidator -V -o ${f}.spv --target-env vulkan1.0 -S comp ${f} +done \ No newline at end of file diff --git a/vulkan/amber/ldexp/gen_spvasm.sh b/vulkan/amber/ldexp/gen_spvasm.sh new file mode 100755 index 0000000..e1c8a77 --- /dev/null +++ b/vulkan/amber/ldexp/gen_spvasm.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +for f in ldexp*.spv; do + spirv-dis -o ${f}.spvasm $f +done diff --git a/vulkan/amber/ldexp/glsl_fails.txt b/vulkan/amber/ldexp/glsl_fails.txt new file mode 100644 index 0000000..4b3b1e2 --- /dev/null +++ b/vulkan/amber/ldexp/glsl_fails.txt @@ -0,0 +1,9 @@ +ldexp_f16vec2_i64vec2.glsl +ldexp_f16vec4_i64vec4.glsl +ldexp_f32vec2_i64vec2.glsl +ldexp_f32vec4_i64vec4.glsl +ldexp_f64vec2_i64vec2.glsl +ldexp_f64vec4_i64vec4.glsl +ldexp_float16_t_int64_t.glsl +ldexp_float32_t_int64_t.glsl +ldexp_float64_t_int64_t.glsl diff --git a/vulkan/amber/ldexp/ldexp_f16vec2_i16vec2.amber b/vulkan/amber/ldexp/ldexp_f16vec2_i16vec2.amber new file mode 100644 index 0000000..0a0fccf --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec2_i16vec2.amber @@ -0,0 +1,307 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE shaderInt16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v2half ArrayStride 4 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v2short ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v2half_0 ArrayStride 4 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%_ptr_Function_v2half = OpTypePointer Function %v2half +%_runtimearr_v2half = OpTypeRuntimeArray %v2half +%SignificandBlock = OpTypeStruct %_runtimearr_v2half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v2half = OpTypePointer Uniform %v2half + %short = OpTypeInt 16 1 + %v2short = OpTypeVector %short 2 +%_ptr_Function_v2short = OpTypePointer Function %v2short +%_runtimearr_v2short = OpTypeRuntimeArray %v2short +%ExponentsBlock = OpTypeStruct %_runtimearr_v2short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v2short = OpTypePointer Uniform %v2short +%_runtimearr_v2half_0 = OpTypeRuntimeArray %v2half +%ResultsBlock = OpTypeStruct %_runtimearr_v2half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v2half Function + %e = OpVariable %_ptr_Function_v2short Function + %r = OpVariable %_ptr_Function_v2half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v2half %__0 %int_0 %33 + %36 = OpLoad %v2half %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v2short %__1 %int_0 %45 + %48 = OpLoad %v2short %47 + OpStore %e %48 + %50 = OpLoad %v2half %s + %51 = OpLoad %v2short %e + %52 = OpExtInst %v2half %1 Ldexp %50 %51 + OpStore %r %52 + %57 = OpLoad %uint %idx + %58 = OpLoad %v2half %r + %59 = OpAccessChain %_ptr_Uniform_v2half %__2 %int_0 %57 + OpStore %59 %58 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float16 DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int16 DATA +1 +0 +-1 +-2 +-32762 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-32762 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-32762 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-32762 +-32763 +-32764 +-32765 +END + +BUFFER results DATA_TYPE float16 DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +16 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 2 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 6 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 10 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 14 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 18 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 20 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 22 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 24 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 26 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 30 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 34 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 38 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 42 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 46 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 48 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 50 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 52 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 54 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 58 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 62 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_f16vec2_i16vec2.glsl b/vulkan/amber/ldexp/ldexp_f16vec2_i16vec2.glsl new file mode 100644 index 0000000..4b4b9c2 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec2_i16vec2.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f16vec2 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i16vec2 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f16vec2 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f16vec2 s = significands[idx]; + const i16vec2 e = exponents[idx]; + const f16vec2 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f16vec2_i16vec2.glsl.spv b/vulkan/amber/ldexp/ldexp_f16vec2_i16vec2.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..7d6cf8ac5cf325915790fd22e2308b3699d10bbc GIT binary patch literal 1996 zcmY+E>rNCw5QQ7|rho!+^M)=LMFkNQ5JeC)WFhVk1Y`U+8FxpRxXhBB!Qfl@Aij^6 z#KiOUOv~7$s5({Er)sJT3f)r`W4eqn6|cE<&s!{x}MoBzH z@r2DY#V**Ihb^z(ZuqU;=!;Ymwxivs84$179`{b;qu1>yPW&i&)oM3B>ptDnKc~?? zjS^|N%hr?H8mft{zoJUU9E68a_$h4oQPa^VKaFuMK96(F@-cf3+&$9Fx1?LW(%WYz z?I?(nIAbekeua!ClE!R)!SvzOf#;HR$J%ARi81>@eA@cQl71V0PA84od;O`))HFff ziXO%#H6izwJF?tdrgHfMvY8FDC!cx1u_F&Q=c=9bnf+1U!3bMB&HhVZe=@PYGuL&EfQ zO){jcVd)7mj!0vV=nj8}RSBmmJSNSqrT(JroqoYgzuIt-pA!qhk4>77tHtI zqtjoyo9~&^tB}urkb@st(aW(H zaB|p_pF(re)MPh`622Q;&1{F63IA6dCeHr{@OswML)rAWq2F+UU2I-9zAg2^EjQ=|AObZ={ZZh2%d@CQs_i;%~ zJm2lUGG0p}cE<&!#giI@|!{13(ihjVM9&$?Jzw$4$`pUrC(2iL^X>4)hLOlD4wu+ zrq~5r^RVUBAEN8{d}tVE1zp-V1NSZ^C zw&P%r&m`;?4r1i7*A)pdIG7LE@jsXC=0ola2|0c8Qh!y#&ZtW+ad?<3G1tpW+4SOg h*JP8kr3p?+uS<9@^hPcm_{jUE*|-^@|ES`MrNCw5QQ7|rho!+^M)=LMFkNQ5JeC)WFhVk1Y`U+8FxpRxXh59!Qfl@Aij^6 z#KiOUOv~D&s5({Er)sJT3f)r`W4eqn6|&=3Ca0!3A*)xGTx@4V#5Zw75II6G;D4K?An!}RDlNW+Ggemw~i)hPZ~qa>c9 zc*5qHVi#=9!)`+njmjQ z595-WkbBD=S#B;<9r**YnGLfipLxKsBM&y`s)YLvpWiRo9VAX|W-=k+I6Rp_i`gA& zQIlHq>1ttfTrGz?YcVTV3!7T(Ahp1qwXO(veiw7gYL)D41V{C>6JNeO1dP}otDPu^6$u|E`I8=C)mt{nS-f&SDHKcs0-%Z z9nVZ|J05nx_0Ri*;klRR;e!Xvd&5J2_obN|Z^LY{A4oPk@T_dUXHKs|KKnrqeq=>2 z$6mn6VNZSv%}G;}-6%@`nD9{wNVd@RlREhb`5B>4CaY{#=CJF8W;e>2O%>;tukk;gl% zNQlud-vM?UPh~rf8QH56-WCpG64fGFC@GfJ&;Qr s9_C8S^|CITUL5a+Y;v|V!Aa?t6844O$b|zRdA~FpHzV{PRa}+)1w$Ez00000 literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f16vec2_i64vec2.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f16vec2_i64vec2.glsl.spv.spvasm new file mode 100644 index 0000000..261284e --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec2_i64vec2.glsl.spv.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int64 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v2half ArrayStride 4 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v2long ArrayStride 16 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v2half_0 ArrayStride 4 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%_ptr_Function_v2half = OpTypePointer Function %v2half +%_runtimearr_v2half = OpTypeRuntimeArray %v2half +%SignificandBlock = OpTypeStruct %_runtimearr_v2half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v2half = OpTypePointer Uniform %v2half + %long = OpTypeInt 64 1 + %v2long = OpTypeVector %long 2 +%_ptr_Function_v2long = OpTypePointer Function %v2long +%_runtimearr_v2long = OpTypeRuntimeArray %v2long +%ExponentsBlock = OpTypeStruct %_runtimearr_v2long +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v2long = OpTypePointer Uniform %v2long +%_runtimearr_v2half_0 = OpTypeRuntimeArray %v2half +%ResultsBlock = OpTypeStruct %_runtimearr_v2half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v2half Function + %e = OpVariable %_ptr_Function_v2long Function + %r = OpVariable %_ptr_Function_v2half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v2half %__0 %int_0 %33 + %36 = OpLoad %v2half %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v2long %__1 %int_0 %45 + %48 = OpLoad %v2long %47 + OpStore %e %48 + %50 = OpLoad %v2half %s + %51 = OpLoad %v2long %e + %52 = OpExtInst %v2half %1 Ldexp %50 %51 + OpStore %r %52 + %57 = OpLoad %uint %idx + %58 = OpLoad %v2half %r + %59 = OpAccessChain %_ptr_Uniform_v2half %__2 %int_0 %57 + OpStore %59 %58 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.amber b/vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.amber new file mode 100644 index 0000000..127f523 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.amber @@ -0,0 +1,311 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE Float16Int8Features.shaderInt8 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess +DEVICE_FEATURE Storage8BitFeatures.uniformAndStorageBuffer8BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int8 + OpCapability StorageBuffer16BitAccess + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_16bit_storage" + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v2half ArrayStride 4 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v2char ArrayStride 2 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v2half_0 ArrayStride 4 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%_ptr_Function_v2half = OpTypePointer Function %v2half +%_runtimearr_v2half = OpTypeRuntimeArray %v2half +%SignificandBlock = OpTypeStruct %_runtimearr_v2half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v2half = OpTypePointer Uniform %v2half + %char = OpTypeInt 8 1 + %v2char = OpTypeVector %char 2 +%_ptr_Function_v2char = OpTypePointer Function %v2char +%_runtimearr_v2char = OpTypeRuntimeArray %v2char +%ExponentsBlock = OpTypeStruct %_runtimearr_v2char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v2char = OpTypePointer Uniform %v2char + %v2int = OpTypeVector %int 2 +%_runtimearr_v2half_0 = OpTypeRuntimeArray %v2half +%ResultsBlock = OpTypeStruct %_runtimearr_v2half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v2half Function + %e = OpVariable %_ptr_Function_v2char Function + %r = OpVariable %_ptr_Function_v2half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v2half %__0 %int_0 %33 + %36 = OpLoad %v2half %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v2char %__1 %int_0 %45 + %48 = OpLoad %v2char %47 + OpStore %e %48 + %50 = OpLoad %v2half %s + %51 = OpLoad %v2char %e + %54 = OpExtInst %v2half %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v2half %r + %61 = OpAccessChain %_ptr_Uniform_v2half %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float16 DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int8 DATA +1 +0 +-1 +-2 +-122 +-123 +-124 +-125 +1 +0 +-1 +-2 +-122 +-123 +-124 +-125 +1 +0 +-1 +-2 +-122 +-123 +-124 +-125 +1 +0 +-1 +-2 +-122 +-123 +-124 +-125 +END + +BUFFER results DATA_TYPE float16 DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +16 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 2 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 6 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 8 TOLERANCE .0001 EQ -1.88079096131566e-37 +EXPECT results IDX 10 TOLERANCE .0001 EQ -9.4039548065783e-38 +EXPECT results IDX 12 TOLERANCE .0001 EQ -4.70197740328915e-38 +EXPECT results IDX 14 TOLERANCE .0001 EQ -2.350988701644575e-38 +EXPECT results IDX 16 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 18 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 20 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 22 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 24 TOLERANCE .0001 EQ 9.4039548065783e-38 +EXPECT results IDX 26 TOLERANCE .0001 EQ 4.70197740328915e-38 +EXPECT results IDX 28 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 30 TOLERANCE .0001 EQ 1.1754943508222875e-38 +EXPECT results IDX 32 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 34 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 38 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 40 TOLERANCE .0001 EQ 2.350988701644575e-37 +EXPECT results IDX 42 TOLERANCE .0001 EQ 1.1754943508222875e-37 +EXPECT results IDX 44 TOLERANCE .0001 EQ 5.877471754111438e-38 +EXPECT results IDX 46 TOLERANCE .0001 EQ 2.938735877055719e-38 +EXPECT results IDX 48 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 50 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 52 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 54 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 56 TOLERANCE .0001 EQ 3.76158192263132e-37 +EXPECT results IDX 58 TOLERANCE .0001 EQ 1.88079096131566e-37 +EXPECT results IDX 60 TOLERANCE .0001 EQ 9.4039548065783e-38 +EXPECT results IDX 62 TOLERANCE .0001 EQ 4.70197740328915e-38 + diff --git a/vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.glsl b/vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.glsl new file mode 100644 index 0000000..4576fc5 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f16vec2 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i8vec2 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f16vec2 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f16vec2 s = significands[idx]; + const i8vec2 e = exponents[idx]; + const f16vec2 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.glsl.spv b/vulkan/amber/ldexp/ldexp_f16vec2_i8vec2.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..cfc6a8c889a67fd79d0a283eeac6dc0ded6ae60a GIT binary patch literal 2048 zcmY+E>rNCw5QQ7|rho!+^9C*#MFkNQ5Jhm&kcGHE5RCEPWZWHL;xbEi27_ZdUA;-uB~4+G_P#?~%|Os^?g{%Y-@wh$+ch2@n+T`^Zp4rOEg$|=b1mK^(G zgrDeu{P<9jbY@*6?h3(iiOVO3@V*UeV_ zi|*4s{d4NA(yaO}u~&ABe&zQgDDb9PUOQ=6Gg zN;nQrrO;w_hg$3lwdm8;!sfVI4tLgKR<0H{wb(&wfjetm6Yl&j=9bnf*x3r2bMCxh zhVZ4mrMQ!CNHKc4AsJHEu=J!DN2IYw)WfKBS;8p`k4dv@sXuRfr(f{8;(QA|;hT`f z`?y@{Fi(8sg83eN)Ve8MmT-42!?$E}sC`?ST=<67FZ(d68WYmI`IvIay-lpo4fSNoXPEyPcXvFqnay45+?Qrf#NlNp-1o2#V0a%$lY3!H=x!CD{`=Iqc0Zp-0lxWLNSM<^V2dw!_Sb|1%B~=l=zGBkO5F zHa%|YH(X#Bdn_B@mik~f7A5QxJL7VeGXHnwurE&}+{6Dn3erp!dt^ZjJz4?7ZPG{FdwkvUzhFX zL+(onIeqd{e?!8X(G$7E;bE@CTrZol>BaHBl1rNCw5QQ7|rho!+^M)=LMFkNQ5JeC)WFhVk1Y`U+8FxpRxXhBB!Qfl@Aij^6 z#KiOUOv~7$s5({Er)sJT3f)r`W4eqn6|cE<&s!{x}MoBzH z@r2DY#V**Ihb^z(ZuqU;=!;Ymwxivs84$179`{b;qu1>yPW&i&)oM3B>ptDnKc~?? zjS^|N%hr?H8mft{zoJUU9E68a_$h4oQPa^VKaFuMK96(F@-cf3+&$9Fx1?LW(%WYz z?I?(nIAbekeua!ClE!R)!SvzOf#;HR$J%ARi81>@eA@cQl71V0PA84od;O`))HFff ziXO%#H6izwJF?tdrgHfMvY8EYARi6Kj<~QnS0&tc`22ps?jUh$Gm{Ak$KlBoTFma` zYtg5xh0Srb9M0EbR<0H{wb(&wf%CPl2hZUclbN3N;p;FF==)!^%rgL^b1~7oNu8ge79urJ}#F!%o88EV7><* zwXRE7CET6O@D14%#w}^yd`vmFrNR8&ai=OxzxcBR0jc-eRunUhQ z><>HQauzcGH|4M&ixTeP{~^xD(wyI7BKAarkMF>CJWI0ET4nq8%fjpfwTO|&JFG~E z(J$Wtb{tP-JB}IIs}kN84r1g@OFxqkgM;~i9shILZa(C$NyzDwm-;Uxycs=^OB^2N qO3d}LE}LE)?}lu0wlu*>>6a4rh2F@810Q+6G#fV~^dD7RmHY)0#f9Gh literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f16vec4_i16vec4.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f16vec4_i16vec4.glsl.spv.spvasm new file mode 100644 index 0000000..4ec08b9 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec4_i16vec4.glsl.spv.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4half ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4short ArrayStride 8 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4half_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_runtimearr_v4half = OpTypeRuntimeArray %v4half +%SignificandBlock = OpTypeStruct %_runtimearr_v4half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half + %short = OpTypeInt 16 1 + %v4short = OpTypeVector %short 4 +%_ptr_Function_v4short = OpTypePointer Function %v4short +%_runtimearr_v4short = OpTypeRuntimeArray %v4short +%ExponentsBlock = OpTypeStruct %_runtimearr_v4short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4short = OpTypePointer Uniform %v4short +%_runtimearr_v4half_0 = OpTypeRuntimeArray %v4half +%ResultsBlock = OpTypeStruct %_runtimearr_v4half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4half Function + %e = OpVariable %_ptr_Function_v4short Function + %r = OpVariable %_ptr_Function_v4half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4half %__0 %int_0 %33 + %36 = OpLoad %v4half %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4short %__1 %int_0 %45 + %48 = OpLoad %v4short %47 + OpStore %e %48 + %50 = OpLoad %v4half %s + %51 = OpLoad %v4short %e + %52 = OpExtInst %v4half %1 Ldexp %50 %51 + OpStore %r %52 + %57 = OpLoad %uint %idx + %58 = OpLoad %v4half %r + %59 = OpAccessChain %_ptr_Uniform_v4half %__2 %int_0 %57 + OpStore %59 %58 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.amber b/vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.amber new file mode 100644 index 0000000..eb341ff --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.amber @@ -0,0 +1,304 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4half ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4int ArrayStride 16 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4half_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_runtimearr_v4half = OpTypeRuntimeArray %v4half +%SignificandBlock = OpTypeStruct %_runtimearr_v4half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_runtimearr_v4int = OpTypeRuntimeArray %v4int +%ExponentsBlock = OpTypeStruct %_runtimearr_v4int +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int +%_runtimearr_v4half_0 = OpTypeRuntimeArray %v4half +%ResultsBlock = OpTypeStruct %_runtimearr_v4half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4half Function + %e = OpVariable %_ptr_Function_v4int Function + %r = OpVariable %_ptr_Function_v4half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4half %__0 %int_0 %33 + %36 = OpLoad %v4half %35 + OpStore %s %36 + %44 = OpLoad %uint %idx + %46 = OpAccessChain %_ptr_Uniform_v4int %__1 %int_0 %44 + %47 = OpLoad %v4int %46 + OpStore %e %47 + %49 = OpLoad %v4half %s + %50 = OpLoad %v4int %e + %51 = OpExtInst %v4half %1 Ldexp %49 %50 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %v4half %r + %58 = OpAccessChain %_ptr_Uniform_v4half %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float16 DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int32 DATA +1 +0 +-1 +-2 +-2147483642 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-2147483642 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-2147483642 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-2147483642 +-2147483643 +-2147483644 +-2147483645 +END + +BUFFER results DATA_TYPE float16 DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +8 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 2 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 6 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 10 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 14 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 18 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 20 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 22 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 24 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 26 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 30 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 34 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 38 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 42 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 46 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 48 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 50 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 52 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 54 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 58 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 62 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.glsl b/vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.glsl new file mode 100644 index 0000000..1910388 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f16vec4 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i32vec4 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f16vec4 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f16vec4 s = significands[idx]; + const i32vec4 e = exponents[idx]; + const f16vec4 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.glsl.spv b/vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..29cba1d98a9c6a8a250ee876f0e27a86b771cb4b GIT binary patch literal 1972 zcmY+E=}r_u6om_BQ$PXP+`s|cK?DUvkxfGe;`~4`#($l5riG3}H<@k>zLgK+`?w?~ zp0Bz~#v+%y);YKDEhuzPSB&X0##GFPescy*w~e4L=KkA3V|r9`u=n13v$O9lEPo7B zFG=IJe;BBy*Ocv@TK%9tm!!?P#ie<$E}H_%=K57rlHDyi_QQxc*#X6giNb73=msh1 zhxm6nMKRRs-u8!gUUK9&gSHo(owUM+n(*6UdUPD5VZ%$mo&0&H=ken)#M=t5?DqYC{1#- zavoR8Xd+q8))!14K^<@|Nw=+C)=rGs50cZ?Ka}j-h;!Om&fe?KLZ+q(vMYKRm(=9B zUGB(obD8d_ACS##m;?1_Fm{B6&ABS!zVpxT7wp?34>vQJlyICsmATgE?Z5>mT=eO< zusM#)`JG(M%5h=C#T$eRzmw~V{Lb%UZW&j}&Q`8D$1WOX2p(@4Jp4|)A^G%lO){ja zVd+UBj!0vV=+3BgRl=#tACu;-W$~izoqq9GmFHXNiP(fJ_Ty^dVV=aO#pip7!F64_ zD&g)-?%$Bjf%~R3wcrh_U*5y0I3}c-|CnlSN#pZ($DOJ){SqHnEp=H<_AclPu3z?z z56->3ju<%j>=zvRyD!b03KC|C{XnwW;Xjn!C7IP0sOLRULmXMwrg#Tna(EX%<;_UL z$y?z2`ELAbZabfu@PEYls}gnwFSX>sVXov{FE3@&i^E-$ fP0f}jI3>L<;l0oswO|mV?w4lcW`zDD#udq5Tsnm* literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.glsl.spv.spvasm new file mode 100644 index 0000000..13b021b --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec4_i32vec4.glsl.spv.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4half ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4int ArrayStride 16 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4half_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_runtimearr_v4half = OpTypeRuntimeArray %v4half +%SignificandBlock = OpTypeStruct %_runtimearr_v4half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_runtimearr_v4int = OpTypeRuntimeArray %v4int +%ExponentsBlock = OpTypeStruct %_runtimearr_v4int +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int +%_runtimearr_v4half_0 = OpTypeRuntimeArray %v4half +%ResultsBlock = OpTypeStruct %_runtimearr_v4half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4half Function + %e = OpVariable %_ptr_Function_v4int Function + %r = OpVariable %_ptr_Function_v4half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4half %__0 %int_0 %33 + %36 = OpLoad %v4half %35 + OpStore %s %36 + %44 = OpLoad %uint %idx + %46 = OpAccessChain %_ptr_Uniform_v4int %__1 %int_0 %44 + %47 = OpLoad %v4int %46 + OpStore %e %47 + %49 = OpLoad %v4half %s + %50 = OpLoad %v4int %e + %51 = OpExtInst %v4half %1 Ldexp %49 %50 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %v4half %r + %58 = OpAccessChain %_ptr_Uniform_v4half %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.amber b/vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.amber new file mode 100644 index 0000000..058506f --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.amber @@ -0,0 +1,307 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE shaderInt64 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int64 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4half ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4long ArrayStride 32 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4half_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_runtimearr_v4half = OpTypeRuntimeArray %v4half +%SignificandBlock = OpTypeStruct %_runtimearr_v4half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half + %long = OpTypeInt 64 1 + %v4long = OpTypeVector %long 4 +%_ptr_Function_v4long = OpTypePointer Function %v4long +%_runtimearr_v4long = OpTypeRuntimeArray %v4long +%ExponentsBlock = OpTypeStruct %_runtimearr_v4long +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4long = OpTypePointer Uniform %v4long +%_runtimearr_v4half_0 = OpTypeRuntimeArray %v4half +%ResultsBlock = OpTypeStruct %_runtimearr_v4half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4half Function + %e = OpVariable %_ptr_Function_v4long Function + %r = OpVariable %_ptr_Function_v4half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4half %__0 %int_0 %33 + %36 = OpLoad %v4half %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4long %__1 %int_0 %45 + %48 = OpLoad %v4long %47 + OpStore %e %48 + %50 = OpLoad %v4half %s + %51 = OpLoad %v4long %e + %52 = OpExtInst %v4half %1 Ldexp %50 %51 + OpStore %r %52 + %57 = OpLoad %uint %idx + %58 = OpLoad %v4half %r + %59 = OpAccessChain %_ptr_Uniform_v4half %__2 %int_0 %57 + OpStore %59 %58 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float16 DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int64 DATA +1 +0 +-1 +-2 +-9223372036854775802 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-9223372036854775802 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-9223372036854775802 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-9223372036854775802 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +END + +BUFFER results DATA_TYPE float16 DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +8 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 2 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 6 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 10 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 14 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 18 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 20 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 22 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 24 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 26 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 30 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 34 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 38 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 42 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 46 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 48 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 50 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 52 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 54 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 58 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 62 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.glsl b/vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.glsl new file mode 100644 index 0000000..1c41e1a --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f16vec4 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i16vec4 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f16vec4 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f16vec4 s = significands[idx]; + const i16vec4 e = exponents[idx]; + const f16vec4 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.glsl.spv b/vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..09d3fb508232b92ad974f57f7525efce744e034a GIT binary patch literal 1996 zcmY+E>rNCw5QQ7|rho!+^M)=LMFkNQ5JeC)WFhVk1Y`U+8FxpRxXh59!Qfl@Aij^6 z#KiOUOv~D&s5({Er)sJT3f)r`W4eqn6|&=3Ca0!3A*)xGTx@4V#5Zw75II6G;D4K?An!}RDlNW+Ggemw~i)hPZ~qa>c9 zc*5qHVi#=9!)`+njmjQ z595-WkbBD=S#B;<9r**YnGJIw9}UNjxUe}_CER!T{C>giAaQCllL-mO;mHhI%(W&TcV}~aLpF!nH>JsiZ&>}Z52LDaOPV(yQ_gK^Fn@R4sY=r?{&D4!m*r%8 z0VZ!knmMr#^aiFDKH|&`o4fSNoHr$166#J%<8yWI$fhoS>ar);%!HYP;k_#jFFxvm zd3SuoXL8%|umi4t-XBcfy*v*eJYe1%9{Rg4&D?k!W{dqmve|)WW%E6AdKL274|4D$ zD|$Kh0!|Kl@>6I|nwsne-_Li0tGVqkGvWV=!^HXj0A9~~dMKM7H}o4Wu#3&h#B;@qTOZ^uT-i#i| uB@PdBCFXirmrXB@cSANgTbkgc^h*i*LT}{4fsedjnvI(g`j0BEO8x@InT8wy literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.glsl.spv.spvasm new file mode 100644 index 0000000..af97a94 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec4_i64vec4.glsl.spv.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int64 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4half ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4long ArrayStride 32 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4half_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_runtimearr_v4half = OpTypeRuntimeArray %v4half +%SignificandBlock = OpTypeStruct %_runtimearr_v4half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half + %long = OpTypeInt 64 1 + %v4long = OpTypeVector %long 4 +%_ptr_Function_v4long = OpTypePointer Function %v4long +%_runtimearr_v4long = OpTypeRuntimeArray %v4long +%ExponentsBlock = OpTypeStruct %_runtimearr_v4long +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4long = OpTypePointer Uniform %v4long +%_runtimearr_v4half_0 = OpTypeRuntimeArray %v4half +%ResultsBlock = OpTypeStruct %_runtimearr_v4half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4half Function + %e = OpVariable %_ptr_Function_v4long Function + %r = OpVariable %_ptr_Function_v4half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4half %__0 %int_0 %33 + %36 = OpLoad %v4half %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4long %__1 %int_0 %45 + %48 = OpLoad %v4long %47 + OpStore %e %48 + %50 = OpLoad %v4half %s + %51 = OpLoad %v4long %e + %52 = OpExtInst %v4half %1 Ldexp %50 %51 + OpStore %r %52 + %57 = OpLoad %uint %idx + %58 = OpLoad %v4half %r + %59 = OpAccessChain %_ptr_Uniform_v4half %__2 %int_0 %57 + OpStore %59 %58 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.amber b/vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.amber new file mode 100644 index 0000000..67ce016 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.amber @@ -0,0 +1,311 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE Float16Int8Features.shaderInt8 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess +DEVICE_FEATURE Storage8BitFeatures.uniformAndStorageBuffer8BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int8 + OpCapability StorageBuffer16BitAccess + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_16bit_storage" + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4half ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4char ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4half_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_runtimearr_v4half = OpTypeRuntimeArray %v4half +%SignificandBlock = OpTypeStruct %_runtimearr_v4half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half + %char = OpTypeInt 8 1 + %v4char = OpTypeVector %char 4 +%_ptr_Function_v4char = OpTypePointer Function %v4char +%_runtimearr_v4char = OpTypeRuntimeArray %v4char +%ExponentsBlock = OpTypeStruct %_runtimearr_v4char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4char = OpTypePointer Uniform %v4char + %v4int = OpTypeVector %int 4 +%_runtimearr_v4half_0 = OpTypeRuntimeArray %v4half +%ResultsBlock = OpTypeStruct %_runtimearr_v4half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4half Function + %e = OpVariable %_ptr_Function_v4char Function + %r = OpVariable %_ptr_Function_v4half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4half %__0 %int_0 %33 + %36 = OpLoad %v4half %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4char %__1 %int_0 %45 + %48 = OpLoad %v4char %47 + OpStore %e %48 + %50 = OpLoad %v4half %s + %51 = OpLoad %v4char %e + %54 = OpExtInst %v4half %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v4half %r + %61 = OpAccessChain %_ptr_Uniform_v4half %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float16 DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int8 DATA +1 +0 +-1 +-2 +-122 +-123 +-124 +-125 +1 +0 +-1 +-2 +-122 +-123 +-124 +-125 +1 +0 +-1 +-2 +-122 +-123 +-124 +-125 +1 +0 +-1 +-2 +-122 +-123 +-124 +-125 +END + +BUFFER results DATA_TYPE float16 DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +8 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 2 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 6 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 8 TOLERANCE .0001 EQ -1.88079096131566e-37 +EXPECT results IDX 10 TOLERANCE .0001 EQ -9.4039548065783e-38 +EXPECT results IDX 12 TOLERANCE .0001 EQ -4.70197740328915e-38 +EXPECT results IDX 14 TOLERANCE .0001 EQ -2.350988701644575e-38 +EXPECT results IDX 16 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 18 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 20 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 22 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 24 TOLERANCE .0001 EQ 9.4039548065783e-38 +EXPECT results IDX 26 TOLERANCE .0001 EQ 4.70197740328915e-38 +EXPECT results IDX 28 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 30 TOLERANCE .0001 EQ 1.1754943508222875e-38 +EXPECT results IDX 32 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 34 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 38 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 40 TOLERANCE .0001 EQ 2.350988701644575e-37 +EXPECT results IDX 42 TOLERANCE .0001 EQ 1.1754943508222875e-37 +EXPECT results IDX 44 TOLERANCE .0001 EQ 5.877471754111438e-38 +EXPECT results IDX 46 TOLERANCE .0001 EQ 2.938735877055719e-38 +EXPECT results IDX 48 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 50 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 52 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 54 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 56 TOLERANCE .0001 EQ 3.76158192263132e-37 +EXPECT results IDX 58 TOLERANCE .0001 EQ 1.88079096131566e-37 +EXPECT results IDX 60 TOLERANCE .0001 EQ 9.4039548065783e-38 +EXPECT results IDX 62 TOLERANCE .0001 EQ 4.70197740328915e-38 + diff --git a/vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.glsl b/vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.glsl new file mode 100644 index 0000000..d737edb --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f16vec4 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i8vec4 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f16vec4 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f16vec4 s = significands[idx]; + const i8vec4 e = exponents[idx]; + const f16vec4 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.glsl.spv b/vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..55cf2036efad51c31d4156fd943f504c719e3264 GIT binary patch literal 2048 zcmY+E=}r_u6om_BQ$PXP+`wT`R1iS{Q3MAK8Hn=(!5IH_+L;zQ4n1VLG5A(Ki0|W) zn0UVGE*Xkk?po*EzI8LX?&*>-UB;M_+0uW`py{>|^ySQ-&Gfs$H1A9I=+4332k-69 zzPGgcDNMXLX|?^sK((E@wTmg!Yl;@XT05vM#7Sded1X;o%vF;^*<8PB3bMN;$9@&UO)H8MKT2LVTlFux zPxtiCskcs}L>la(jij~)Z(#lSv83 z`BSNDeRc;f-We|XbX?dR$L0J^E@tJpu;F3{;ll6ax+cH#yO>+bRj{*_YtFIrh8cp# zE`x{Pi8mylo^D8nR5dI;DZ~+J>=E4=l`cy-W%*;$>{=Sn+urFHe_eULg`S8_$l`rm zEj-MV7`6C(4>7oIN|z?ymZlcGVfD*CjEZAInl~R)%^hic-h(@3Y5FBT zu3GBSnshJlshgB$PV57{;lo9YJafb5F1<2mYP%%x&PWq;ymw{8OB`PI1e=*Kb9`{` zNrOuaUVPr&@y=#8cj37&&79x?mz{9m!#?1H`#>5DV&LNQ{=~p}D9s#sD`t&7C#iJ! z^RoHAdA$<#>p*$!h?_Hzku4F);tW~5(8$brFp@E!iTY&Rcj zUrMOyQxyIU32#PE)RG5>xsr3eY|5q=hxoly8KM7* HaZU0M_oa?? literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.glsl.spv.spvasm new file mode 100644 index 0000000..5030738 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f16vec4_i8vec4.glsl.spv.spvasm @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int8 + OpCapability StorageBuffer16BitAccess + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_16bit_storage" + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4half ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4char ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4half_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_runtimearr_v4half = OpTypeRuntimeArray %v4half +%SignificandBlock = OpTypeStruct %_runtimearr_v4half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half + %char = OpTypeInt 8 1 + %v4char = OpTypeVector %char 4 +%_ptr_Function_v4char = OpTypePointer Function %v4char +%_runtimearr_v4char = OpTypeRuntimeArray %v4char +%ExponentsBlock = OpTypeStruct %_runtimearr_v4char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4char = OpTypePointer Uniform %v4char + %v4int = OpTypeVector %int 4 +%_runtimearr_v4half_0 = OpTypeRuntimeArray %v4half +%ResultsBlock = OpTypeStruct %_runtimearr_v4half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4half Function + %e = OpVariable %_ptr_Function_v4char Function + %r = OpVariable %_ptr_Function_v4half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4half %__0 %int_0 %33 + %36 = OpLoad %v4half %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4char %__1 %int_0 %45 + %48 = OpLoad %v4char %47 + OpStore %e %48 + %50 = OpLoad %v4half %s + %51 = OpLoad %v4char %e + %54 = OpExtInst %v4half %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v4half %r + %61 = OpAccessChain %_ptr_Uniform_v4half %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.amber b/vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.amber new file mode 100644 index 0000000..a165dc2 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.amber @@ -0,0 +1,306 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderInt16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v2float ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v2short ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v2float_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_runtimearr_v2float = OpTypeRuntimeArray %v2float +%SignificandBlock = OpTypeStruct %_runtimearr_v2float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %short = OpTypeInt 16 1 + %v2short = OpTypeVector %short 2 +%_ptr_Function_v2short = OpTypePointer Function %v2short +%_runtimearr_v2short = OpTypeRuntimeArray %v2short +%ExponentsBlock = OpTypeStruct %_runtimearr_v2short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v2short = OpTypePointer Uniform %v2short + %v2int = OpTypeVector %int 2 +%_runtimearr_v2float_0 = OpTypeRuntimeArray %v2float +%ResultsBlock = OpTypeStruct %_runtimearr_v2float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v2float Function + %e = OpVariable %_ptr_Function_v2short Function + %r = OpVariable %_ptr_Function_v2float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %33 + %36 = OpLoad %v2float %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v2short %__1 %int_0 %45 + %48 = OpLoad %v2short %47 + OpStore %e %48 + %50 = OpLoad %v2float %s + %51 = OpLoad %v2short %e + %54 = OpExtInst %v2float %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v2float %r + %61 = OpAccessChain %_ptr_Uniform_v2float %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int16 DATA +1 +0 +-1 +-2 +-14 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-32763 +-32764 +-32765 +END + +BUFFER results DATA_TYPE float DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +16 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 16 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 20 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 48 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 52 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 68 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 76 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 80 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 84 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 92 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 96 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 100 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 104 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 108 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 116 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 124 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.glsl b/vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.glsl new file mode 100644 index 0000000..8d53443 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f32vec2 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i16vec2 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f32vec2 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f32vec2 s = significands[idx]; + const i16vec2 e = exponents[idx]; + const f32vec2 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.glsl.spv b/vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..df4c019886a12edd5d90ac8184c387b1ed8a372e GIT binary patch literal 2004 zcmY+E>rNCw5QQ7|rho!+^9C*#MFkNQ5Jh0okcGHE5RCEPWZfNM;xa>a27_O%7#a{mLoG?v|X?gAhN_0r~N%gsDjA z2Fd9M|964BDpYIU&WCqid|Yq(ZO=bHZ3PWAQEvyy@rj=V4KMk6>c^^)|F1?tJbCd1 z&2z;r*_uZ!uNF1xt-bJzR1!qtUfA@Bmu!#wXYujtD2$VOn7nF5jnBGI_w>(cL}y_l z4R_IcQd`3`vGtc!$(Y07C=5OYje6L0G|Eq7T#GN_T(f+aF?8VWk!HRH-RhOzIX{g; zKTP6`t(f^0GMY#lv-vsGhf@chE7EOi7xgB_9Qg5B>mN({ZTLCuG-mJhr!G^~1bHiZ z7?)Iq+*|I-a&wvP$RCi+Y?uT2XgGGoh0VDx;l9Hc_j86h5T`cwq=e(}R0=I-cc{fX zQ;R-bEo_df<#1;$X60&OQ;Qv>7Pzz4HQ~0BL zK5E^RE=#yOm*HEoIn=%_O)h-H>X&^ORgDShvSds-ccj65Gk40;^oxI7x$H)olkNqW zyh&;9un+VGrk3MjZrI$VSLV#!E(vvKr181@yRxZ^pStV`HZx)7VCvqJ<_^RnBJC0e|&n3Jy9K^_*k$xc|1_$#2JN|XqZa(C`l#tUWFZDMh yycs=_OB^2NO3d}LDVts#@0M(Gwl%>i>57DXp*M2js7RCdOS5q^LjO_4HOXK4i-uhQ literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.glsl.spv.spvasm new file mode 100644 index 0000000..5c9d192 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec2_i16vec2.glsl.spv.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v2float ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v2short ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v2float_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_runtimearr_v2float = OpTypeRuntimeArray %v2float +%SignificandBlock = OpTypeStruct %_runtimearr_v2float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %short = OpTypeInt 16 1 + %v2short = OpTypeVector %short 2 +%_ptr_Function_v2short = OpTypePointer Function %v2short +%_runtimearr_v2short = OpTypeRuntimeArray %v2short +%ExponentsBlock = OpTypeStruct %_runtimearr_v2short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v2short = OpTypePointer Uniform %v2short + %v2int = OpTypeVector %int 2 +%_runtimearr_v2float_0 = OpTypeRuntimeArray %v2float +%ResultsBlock = OpTypeStruct %_runtimearr_v2float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v2float Function + %e = OpVariable %_ptr_Function_v2short Function + %r = OpVariable %_ptr_Function_v2float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %33 + %36 = OpLoad %v2float %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v2short %__1 %int_0 %45 + %48 = OpLoad %v2short %47 + OpStore %e %48 + %50 = OpLoad %v2float %s + %51 = OpLoad %v2short %e + %54 = OpExtInst %v2float %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v2float %r + %61 = OpAccessChain %_ptr_Uniform_v2float %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.amber b/vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.amber new file mode 100644 index 0000000..d6aaee1 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.amber @@ -0,0 +1,299 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v2float ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v2int ArrayStride 8 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v2float_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_runtimearr_v2float = OpTypeRuntimeArray %v2float +%SignificandBlock = OpTypeStruct %_runtimearr_v2float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_runtimearr_v2int = OpTypeRuntimeArray %v2int +%ExponentsBlock = OpTypeStruct %_runtimearr_v2int +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v2int = OpTypePointer Uniform %v2int +%_runtimearr_v2float_0 = OpTypeRuntimeArray %v2float +%ResultsBlock = OpTypeStruct %_runtimearr_v2float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v2float Function + %e = OpVariable %_ptr_Function_v2int Function + %r = OpVariable %_ptr_Function_v2float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %33 + %36 = OpLoad %v2float %35 + OpStore %s %36 + %44 = OpLoad %uint %idx + %46 = OpAccessChain %_ptr_Uniform_v2int %__1 %int_0 %44 + %47 = OpLoad %v2int %46 + OpStore %e %47 + %49 = OpLoad %v2float %s + %50 = OpLoad %v2int %e + %51 = OpExtInst %v2float %1 Ldexp %49 %50 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %v2float %r + %58 = OpAccessChain %_ptr_Uniform_v2float %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int32 DATA +1 +0 +-1 +-2 +-14 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-2147483643 +-2147483644 +-2147483645 +END + +BUFFER results DATA_TYPE float DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +16 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 16 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 20 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 48 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 52 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 68 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 76 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 80 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 84 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 92 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 96 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 100 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 104 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 108 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 116 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 124 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.glsl b/vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.glsl new file mode 100644 index 0000000..56b2f29 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f32vec2 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i32vec2 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f32vec2 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f32vec2 s = significands[idx]; + const i32vec2 e = exponents[idx]; + const f32vec2 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.glsl.spv b/vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..99712804a46741d5100f54a7833c6d1a0fc648aa GIT binary patch literal 1928 zcmY+EYflqV5QY!5v??edH*a78?;zd)Q3OFl3Q0d0@q^!*rd{dAvL)TE!GGls@&9;9 zOnjfSJF*@#%)B#m-kF^_wlKI@c5c8qS9Y)Umox4Ly=T~!ysp*`Yb$ZmT3KCtO#G57 zpnPmpIYY7sCC800!cTNeethGS9SIeXg8t$EE>LvCu3D?_ef&_5+l^Mxs|Tkiov;}u z^+qpD+Q&f>HtWgPlOR@&;(s-U#8VVc*g940oUeJ*sn@#AM&}^AL`vH!sZ{-UGdXsbxIO4V$~vVb1hx@msQ~gP%IQ3v6b< zjKS2oEzKQ#)B&?+397U-k`#=WdpV4<0c4g@^v`Ni(N{gjr(Wm+a*51K9(T zWo?0c-UB)Kk#%i~cK|1cckxqbNt&9x1%BW7Zg3^D4KovdM+_6^_W-<=^|UOT9=G)u zF0jQO%Eq^=KG^+=g!jUmu$)Jk|C@4n5B&IZ5C0EwK9T19789|j5`26Iw(&fZoz^P( z|0Aoy?4Mf1$YT#{5@PhrcYuv!UAA$s$LA7u3kNas*z1Ob7#z$8Z2T`|+kD7 zUg~d3*co-nB@PdBC1$<6l1(qhyCs{PT}^O7dRxMKp*M2jz(?LM&BkVg{-cT;lE2A> BeDweT literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.glsl.spv.spvasm new file mode 100644 index 0000000..8185067 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec2_i32vec2.glsl.spv.spvasm @@ -0,0 +1,124 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v2float ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v2int ArrayStride 8 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v2float_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_runtimearr_v2float = OpTypeRuntimeArray %v2float +%SignificandBlock = OpTypeStruct %_runtimearr_v2float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_runtimearr_v2int = OpTypeRuntimeArray %v2int +%ExponentsBlock = OpTypeStruct %_runtimearr_v2int +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v2int = OpTypePointer Uniform %v2int +%_runtimearr_v2float_0 = OpTypeRuntimeArray %v2float +%ResultsBlock = OpTypeStruct %_runtimearr_v2float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v2float Function + %e = OpVariable %_ptr_Function_v2int Function + %r = OpVariable %_ptr_Function_v2float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %33 + %36 = OpLoad %v2float %35 + OpStore %s %36 + %44 = OpLoad %uint %idx + %46 = OpAccessChain %_ptr_Uniform_v2int %__1 %int_0 %44 + %47 = OpLoad %v2int %46 + OpStore %e %47 + %49 = OpLoad %v2float %s + %50 = OpLoad %v2int %e + %51 = OpExtInst %v2float %1 Ldexp %49 %50 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %v2float %r + %58 = OpAccessChain %_ptr_Uniform_v2float %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f32vec2_i64vec2.amber b/vulkan/amber/ldexp/ldexp_f32vec2_i64vec2.amber new file mode 100644 index 0000000..cbb2c55 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec2_i64vec2.amber @@ -0,0 +1,302 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderInt64 + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v2float ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v2long ArrayStride 16 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v2float_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_runtimearr_v2float = OpTypeRuntimeArray %v2float +%SignificandBlock = OpTypeStruct %_runtimearr_v2float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %long = OpTypeInt 64 1 + %v2long = OpTypeVector %long 2 +%_ptr_Function_v2long = OpTypePointer Function %v2long +%_runtimearr_v2long = OpTypeRuntimeArray %v2long +%ExponentsBlock = OpTypeStruct %_runtimearr_v2long +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v2long = OpTypePointer Uniform %v2long + %v2int = OpTypeVector %int 2 +%_runtimearr_v2float_0 = OpTypeRuntimeArray %v2float +%ResultsBlock = OpTypeStruct %_runtimearr_v2float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v2float Function + %e = OpVariable %_ptr_Function_v2long Function + %r = OpVariable %_ptr_Function_v2float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %33 + %36 = OpLoad %v2float %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v2long %__1 %int_0 %45 + %48 = OpLoad %v2long %47 + OpStore %e %48 + %50 = OpLoad %v2float %s + %51 = OpLoad %v2long %e + %54 = OpExtInst %v2float %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v2float %r + %61 = OpAccessChain %_ptr_Uniform_v2float %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int64 DATA +1 +0 +-1 +-2 +-14 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +END + +BUFFER results DATA_TYPE float DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +16 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 16 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 20 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 48 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 52 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 68 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 76 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 80 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 84 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 92 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 96 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 100 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 104 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 108 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 116 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 124 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_f32vec2_i64vec2.glsl b/vulkan/amber/ldexp/ldexp_f32vec2_i64vec2.glsl new file mode 100644 index 0000000..8d53443 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec2_i64vec2.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f32vec2 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i16vec2 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f32vec2 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f32vec2 s = significands[idx]; + const i16vec2 e = exponents[idx]; + const f32vec2 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f32vec2_i64vec2.glsl.spv b/vulkan/amber/ldexp/ldexp_f32vec2_i64vec2.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..f9ba778cb16c2d7366b73605b8df43c11f29b1f6 GIT binary patch literal 1968 zcmY+E+fGwa5QZ1Dv??edCr@ZOC@P4kfGC1RLkdYRjCkQ))3jUIvFwuWjls9_L3|$% ziHZNWR!8b0!^}T3>z~=P26Fv#Md$jQb49nK-<(m`?>*>2;XzmMxKcf+E~i;@d39}t zyelq;^08s%49M=69M|InKhY8S@r_E#5-K4%{owyDkXMCDwYK~5LoGe3H=|B1Iy-5_ zjX0~-J8^b&9A$B%mVG^mQq{=+S7SgtdGW-}GsQ0Wnuo1gwcV(<_LDDCS=>(clV(J` z=zDy3njXDvCuvqsvNx@EitDka_%5LOyW;*qnhDAN>5w=Si-mA=X65Ma|{QUt7w9}6}6@%6(M`eJy|xFxt{zH+02GHkdKCAPh8lX zYZC4oKEI!H%z-$yv1cS4!?OW;%B$Cv<00x+LM0gr}t0wcyYD z-su;-sW{(4Pxx-j;(aWaI?NLvxnRBrAGK~smn7U>?BbiUIn=%-O)h-n>X&_(RE^ux zCCQX>?ns0AX6}@v=@KOq~B0;H_>?%d+WlTfgA~TkNrHd^_rc-B^*ZPwb54Jn8zsDTjS|D&ZdfAL4u_ z&G{`RVyhB-dpmzAV%K2 z^h*gbIG7LE_%~(Se8_zzA!kTl>TgMSGkPMII6TainDw$Pn_i6fwQO>BG{ITvvV?u1 VH*(=9OOy9Yv#}YW|ES`IZZ3O48QS^2#IPmrVg>bAzfW$?laL`(Z?!?2zKbL}6+Yx(c#-~v#4R+Z^ zGF!tmiH%ppWXwT$7=@q0rXRH&jOw!-*OK!**DT&e3>~ohq#1BYxB8{G&raefh|(lS zE9Y^gj3$!hY<}=(lbL^sFhTvtrWqvo_h;sCFO){dY zQR!(Rj!9#WsfTgts)SROKOxPoW$~izoqqAxmFHXNiP)4Z-pAF#!#s&mi_iBEgX_9< zRl?nc+`l241NTj7YQY;-zwE=fIHshlk_pw^lE&woxl@&+%<6^L>kYCFbKCjMh~F9KljrvWeMvOMF85G2u`Tt% zZt%m;KCv^d=5ZeXrW*F;iG+K^e+cubH0QUF$Sq5V@g3L>XGM0#Rkr^pSLL%GaFL^q zcX%ctN56arzQb6P?J(wLKbP>>K8rfhm~xUXbWv!w~nNY^Cn3%yYbMopT!Uz&}Z5&Dl9*Cc-dbliqT literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f32vec2_i8vec2.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f32vec2_i8vec2.glsl.spv.spvasm new file mode 100644 index 0000000..2b32332 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec2_i8vec2.glsl.spv.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Int8 + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v2float ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v2char ArrayStride 2 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v2float_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_runtimearr_v2float = OpTypeRuntimeArray %v2float +%SignificandBlock = OpTypeStruct %_runtimearr_v2float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %char = OpTypeInt 8 1 + %v2char = OpTypeVector %char 2 +%_ptr_Function_v2char = OpTypePointer Function %v2char +%_runtimearr_v2char = OpTypeRuntimeArray %v2char +%ExponentsBlock = OpTypeStruct %_runtimearr_v2char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v2char = OpTypePointer Uniform %v2char + %v2int = OpTypeVector %int 2 +%_runtimearr_v2float_0 = OpTypeRuntimeArray %v2float +%ResultsBlock = OpTypeStruct %_runtimearr_v2float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v2float Function + %e = OpVariable %_ptr_Function_v2char Function + %r = OpVariable %_ptr_Function_v2float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %33 + %36 = OpLoad %v2float %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v2char %__1 %int_0 %45 + %48 = OpLoad %v2char %47 + OpStore %e %48 + %50 = OpLoad %v2float %s + %51 = OpLoad %v2char %e + %54 = OpExtInst %v2float %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v2float %r + %61 = OpAccessChain %_ptr_Uniform_v2float %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.amber b/vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.amber new file mode 100644 index 0000000..639fdd4 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.amber @@ -0,0 +1,306 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderInt16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4short ArrayStride 8 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4float_0 ArrayStride 16 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%SignificandBlock = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %short = OpTypeInt 16 1 + %v4short = OpTypeVector %short 4 +%_ptr_Function_v4short = OpTypePointer Function %v4short +%_runtimearr_v4short = OpTypeRuntimeArray %v4short +%ExponentsBlock = OpTypeStruct %_runtimearr_v4short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4short = OpTypePointer Uniform %v4short + %v4int = OpTypeVector %int 4 +%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float +%ResultsBlock = OpTypeStruct %_runtimearr_v4float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4float Function + %e = OpVariable %_ptr_Function_v4short Function + %r = OpVariable %_ptr_Function_v4float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %33 + %36 = OpLoad %v4float %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4short %__1 %int_0 %45 + %48 = OpLoad %v4short %47 + OpStore %e %48 + %50 = OpLoad %v4float %s + %51 = OpLoad %v4short %e + %54 = OpExtInst %v4float %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v4float %r + %61 = OpAccessChain %_ptr_Uniform_v4float %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int16 DATA +1 +0 +-1 +-2 +-14 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-32763 +-32764 +-32765 +END + +BUFFER results DATA_TYPE float DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +8 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 16 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 20 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 48 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 52 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 68 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 76 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 80 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 84 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 92 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 96 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 100 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 104 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 108 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 116 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 124 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.glsl b/vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.glsl new file mode 100644 index 0000000..26d2dc5 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f32vec4 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i16vec4 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f32vec4 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f32vec4 s = significands[idx]; + const i16vec4 e = exponents[idx]; + const f32vec4 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.glsl.spv b/vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..71dd84e2cd326763fa7dc5b387c01e03ff1a9657 GIT binary patch literal 2004 zcmY+E=}r_u6om_BQ$PXP+`wT`R1iS{Q3M7J8Hn=(!5IH_#+ep64&7wBG5A(Ki0|W) zn0UVGE*Xnl?po*EzI7qjJzX-U%NSEK+xpEJG~G6W9?kr>gU0lz=5YVL_h$FNTUz}X zBwn0E?fQ|gnqE`1cdE6++CrQ(7nWBR!MbX4D4Xk7O+j|IbXst$8~i-g)tHz3I0-|NOKSG}J`B9VEvmeiAgiPeG#|HXV%W(;V00i#*pX-en9OuzRGLZ$YX`=^yTZceT$ga)`4{(dhB=Uj8+%g1asE{5TA$s43mmxU z({W*Q9GCMuxtNvX!iI|-gbTlu>ze$|?_zE#SHaF!uDQU@8)gU|y9^$FC*F{Jdb%MQ zQq{2Zq!34>u}5@=zr(VGQ02)xyI(iBXHs_Yi~Y zrgT}t-MP%aC7T2HZE0%38&<#U!>BkWq|1^q)!dQB=kJa?Woh~)KCW7JBCSdH0-w4` zY39T`(i=Wp#KpZ$P~ z9Cf_IGYL8RY3hDyHf~1fKVn>y`~`6GhIaq} literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.glsl.spv.spvasm new file mode 100644 index 0000000..d9aa6f8 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec4_i16vec4.glsl.spv.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4short ArrayStride 8 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4float_0 ArrayStride 16 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%SignificandBlock = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %short = OpTypeInt 16 1 + %v4short = OpTypeVector %short 4 +%_ptr_Function_v4short = OpTypePointer Function %v4short +%_runtimearr_v4short = OpTypeRuntimeArray %v4short +%ExponentsBlock = OpTypeStruct %_runtimearr_v4short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4short = OpTypePointer Uniform %v4short + %v4int = OpTypeVector %int 4 +%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float +%ResultsBlock = OpTypeStruct %_runtimearr_v4float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4float Function + %e = OpVariable %_ptr_Function_v4short Function + %r = OpVariable %_ptr_Function_v4float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %33 + %36 = OpLoad %v4float %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4short %__1 %int_0 %45 + %48 = OpLoad %v4short %47 + OpStore %e %48 + %50 = OpLoad %v4float %s + %51 = OpLoad %v4short %e + %54 = OpExtInst %v4float %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v4float %r + %61 = OpAccessChain %_ptr_Uniform_v4float %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.amber b/vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.amber new file mode 100644 index 0000000..9c2015b --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.amber @@ -0,0 +1,299 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4int ArrayStride 16 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4float_0 ArrayStride 16 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%SignificandBlock = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_runtimearr_v4int = OpTypeRuntimeArray %v4int +%ExponentsBlock = OpTypeStruct %_runtimearr_v4int +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int +%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float +%ResultsBlock = OpTypeStruct %_runtimearr_v4float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4float Function + %e = OpVariable %_ptr_Function_v4int Function + %r = OpVariable %_ptr_Function_v4float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %33 + %36 = OpLoad %v4float %35 + OpStore %s %36 + %44 = OpLoad %uint %idx + %46 = OpAccessChain %_ptr_Uniform_v4int %__1 %int_0 %44 + %47 = OpLoad %v4int %46 + OpStore %e %47 + %49 = OpLoad %v4float %s + %50 = OpLoad %v4int %e + %51 = OpExtInst %v4float %1 Ldexp %49 %50 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %v4float %r + %58 = OpAccessChain %_ptr_Uniform_v4float %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int32 DATA +1 +0 +-1 +-2 +-14 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-2147483643 +-2147483644 +-2147483645 +END + +BUFFER results DATA_TYPE float DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +8 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 16 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 20 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 48 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 52 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 68 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 76 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 80 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 84 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 92 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 96 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 100 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 104 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 108 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 116 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 124 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.glsl b/vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.glsl new file mode 100644 index 0000000..0bf5955 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f32vec4 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i32vec4 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f32vec4 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f32vec4 s = significands[idx]; + const i32vec4 e = exponents[idx]; + const f32vec4 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.glsl.spv b/vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..91df99982c2d81e3fd30580ad47ea25d1760c028 GIT binary patch literal 1928 zcmY+E+fEZv6oxmnv??edCr@Aj&mf`#qR2@@3P~@Fc;Q{sv?EL`Q_`6ld@CQs_wkUJ z_iT_T(3QNd)(&e+anf2^SzRW7#T8IK zH>{cg+5M7}Mi>z%JEAzTQOS-32Be@L;@{;I-Jq-1>U$qQ)Z^nuE9lmPv(t9i43m1J z8z#pmK@v9W$=A~$7Dw?vjsf8mg%h^Ul)K$muoE3bt$=*l_xP?C zAHVHHangvAH|<7F{9cNiW;;is_Kh*}1t`ZUM2 z_&m=wk9QG62kcAIfwxPVfOC6ir=2K>k~l*v35_^M6G?NjxjW>eseM^?*T+lRiF5CR zxYz!Nl71U;PB+bYjNvros+u6Xf@@k*m1n!$mt}LA&()8}W;ST*nFkpA!oucUlW^bs z^ZNzI9LU3sJuBguKbN}R=k4UV=+n4tKE`E!o{L!-7dBkHLAdbqTvz4ixtLqZHQ;9} z*PUY*9Ww-vw+tSB9&b!OJzbZKscKw$R)`bQ*b}-lDP56pD)OhKd24CB=zFJM{0-&# z7J4E!Ba8i5Ej-MV7`6C(4>7oINLM7>UC8{KvN>?ylBO2CarMi4m=wp1bVV|yn%mO& z{M~VKEn#KRGRZ!NaUVLi18iRhVxu@%2o2a zUXjoK;UY&Jdsvl_qhG!Q-!Rr>8wPuPAz`;*kfV;hu1m;)!F=!y|D|l354Eo()C?&K z|AvH}!AmW9aF{DO>*cjV9c9HY4;OF|JGg0!wp! A5dZ)H literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.glsl.spv.spvasm new file mode 100644 index 0000000..a0f769e --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec4_i32vec4.glsl.spv.spvasm @@ -0,0 +1,124 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4int ArrayStride 16 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4float_0 ArrayStride 16 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%SignificandBlock = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_runtimearr_v4int = OpTypeRuntimeArray %v4int +%ExponentsBlock = OpTypeStruct %_runtimearr_v4int +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int +%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float +%ResultsBlock = OpTypeStruct %_runtimearr_v4float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4float Function + %e = OpVariable %_ptr_Function_v4int Function + %r = OpVariable %_ptr_Function_v4float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %33 + %36 = OpLoad %v4float %35 + OpStore %s %36 + %44 = OpLoad %uint %idx + %46 = OpAccessChain %_ptr_Uniform_v4int %__1 %int_0 %44 + %47 = OpLoad %v4int %46 + OpStore %e %47 + %49 = OpLoad %v4float %s + %50 = OpLoad %v4int %e + %51 = OpExtInst %v4float %1 Ldexp %49 %50 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %v4float %r + %58 = OpAccessChain %_ptr_Uniform_v4float %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f32vec4_i64vec4.amber b/vulkan/amber/ldexp/ldexp_f32vec4_i64vec4.amber new file mode 100644 index 0000000..4103a11 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec4_i64vec4.amber @@ -0,0 +1,302 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderInt64 + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4long ArrayStride 32 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4float_0 ArrayStride 16 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%SignificandBlock = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %long = OpTypeInt 64 1 + %v4long = OpTypeVector %long 4 +%_ptr_Function_v4long = OpTypePointer Function %v4long +%_runtimearr_v4long = OpTypeRuntimeArray %v4long +%ExponentsBlock = OpTypeStruct %_runtimearr_v4long +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4long = OpTypePointer Uniform %v4long + %v4int = OpTypeVector %int 4 +%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float +%ResultsBlock = OpTypeStruct %_runtimearr_v4float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4float Function + %e = OpVariable %_ptr_Function_v4long Function + %r = OpVariable %_ptr_Function_v4float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %33 + %36 = OpLoad %v4float %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4long %__1 %int_0 %45 + %48 = OpLoad %v4long %47 + OpStore %e %48 + %50 = OpLoad %v4float %s + %51 = OpLoad %v4long %e + %54 = OpExtInst %v4float %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v4float %r + %61 = OpAccessChain %_ptr_Uniform_v4float %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int64 DATA +1 +0 +-1 +-2 +-14 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +END + +BUFFER results DATA_TYPE float DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +8 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 16 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 20 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 48 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 52 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 68 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 76 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 80 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 84 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 92 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 96 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 100 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 104 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 108 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 116 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 124 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_f32vec4_i64vec4.glsl b/vulkan/amber/ldexp/ldexp_f32vec4_i64vec4.glsl new file mode 100644 index 0000000..26d2dc5 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec4_i64vec4.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f32vec4 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i16vec4 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f32vec4 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f32vec4 s = significands[idx]; + const i16vec4 e = exponents[idx]; + const f32vec4 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f32vec4_i64vec4.glsl.spv b/vulkan/amber/ldexp/ldexp_f32vec4_i64vec4.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..99ea84d3a6c55d3fdca9f372ab30a610c6b337e1 GIT binary patch literal 1968 zcmY+EYfn=_5QZ08S``$Kn>X-qQB<&^0-^}C8d6C5!H6IH)->&ro>)$so`b3X${*tY z@sgPMKD%A1ONNtAB&WP+`$yqIm@e`epAK#>;D4`OP(GULb0$EikSE`2}KU9-utr2#sVXxDQ z>QP#)b)&R-7N$|XntttsiE3p3t1%*;tazeEPq9n3=4q>1Y1eD5X-B+Jibc_4p6HnTyK&phBb5*Ie- zhJ^bbU);|a=0Kd<*ozX5$4d@c%JdFN$$S8hb`}W~BoOClH>KX4jlQ zYkQ|(@UG%~3q9dmkj4A>TfgB^^k(yVl3IWpk)~N19ytrqwU|Fsm91 z(t%`7Id`SO{M~UUkfvY!^U7r>T#nldFnNp8%!z%VH!!vE5od1L+@)9MT$Bt+sJkMK z&)2;to4WX^%bs8}6J`#E_r5f|_^1o!-SH7$?c3a?&I4)YL>+k93I9Fp1DJacrQyH_ zFPQho2hSsE=Ez$yYwR^iaR9H&=KI$5O60RI^mTXrmXLn&+nEjv@G4gna7ZPIh%Xff1$Bt~zu`2tegtvx+ z7nGP{+@(4qbG8S!^2#O`Cj&A(~IXlkWEfW6I_xm ZO4t{ABNvXMGVbg0P=(*hYhmGk|&B5M#@9oaMxArki zy(Eo0{$aqKep9x0>WzcOVv@ENmsggEUp57l%?+xiB)eB~?1vF?vO|g!6NRZs=msh1 zkN9^vMKRPH-u8!gUUKBOf{quQowUQIy6`(;dUPD5Vbe>$o&70Ni*P*ZuLuVpPj@}5T!|u zR?g!}8BHY1+4_PRAgBY*CFzc}%X$-I_JicK{SPJkHsYL4mb3Q;vyiE4g1i+yOiJqV z+*|I*a&wvKsvnZgY|zv*4={Fwh0VDt;lA_F?-vYnAP+b8l!W8_>CCl0y8{>R3>SSm zE^LnDa(*`#vvOS6aIu4M;dgUgk>CAY%q`<8+1bi9=h#KV48dcU!Nc#y8<9^>*CZpV z8kL?B;+Qn{nC^^AS0$XP{0V7xEsGaz@AQkmt~}pDPsDD?;(c5#Jj|0AwfKAwF}SWv zS0&t?&;1*+IdI>UrWU+W^~*kti{qAbRWhNP+tT>F2Y0H{^hf_bi_g0|-nrc7 zEum*av)Y?@NP03|xHPpBOj~q?sdc#jLUCCABVpK{nsFpjV=veW8Xp zvZ|M4Pr&4`H$UY)l!lXCp-<+3U(IdjGb4UyoKK$L3;d0|r$yQHxT*hO;k(=;*~GTg z2fMK(VV~F;SMxZJe^U+n@RGRZ!NaU6!#P|+uhqEF(<0{)-Se4Iyz(tNa z-r<>q9R2bg_zq)Dw!@f{{anIZgF%kES?L!Na$qnYe22d-+s%jCmlA3Q6or37!kf_( vwdBEJuH;-Vo3iP};l7eh&6XxOEnSnaFZ4z&7&U3?erYytM(96cT$B6-;Vgz- literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f32vec4_i8vec4.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f32vec4_i8vec4.glsl.spv.spvasm new file mode 100644 index 0000000..a0bb8ba --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f32vec4_i8vec4.glsl.spv.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Int8 + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4char ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4float_0 ArrayStride 16 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%SignificandBlock = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %char = OpTypeInt 8 1 + %v4char = OpTypeVector %char 4 +%_ptr_Function_v4char = OpTypePointer Function %v4char +%_runtimearr_v4char = OpTypeRuntimeArray %v4char +%ExponentsBlock = OpTypeStruct %_runtimearr_v4char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4char = OpTypePointer Uniform %v4char + %v4int = OpTypeVector %int 4 +%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float +%ResultsBlock = OpTypeStruct %_runtimearr_v4float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4float Function + %e = OpVariable %_ptr_Function_v4char Function + %r = OpVariable %_ptr_Function_v4float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %33 + %36 = OpLoad %v4float %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4char %__1 %int_0 %45 + %48 = OpLoad %v4char %47 + OpStore %e %48 + %50 = OpLoad %v4float %s + %51 = OpLoad %v4char %e + %54 = OpExtInst %v4float %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v4float %r + %61 = OpAccessChain %_ptr_Uniform_v4float %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f64vec2_i16vec2.amber b/vulkan/amber/ldexp/ldexp_f64vec2_i16vec2.amber new file mode 100644 index 0000000..fc35217 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec2_i16vec2.amber @@ -0,0 +1,308 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderFloat64 +DEVICE_FEATURE shaderInt16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v2double ArrayStride 16 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v2short ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v2double_0 ArrayStride 16 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 + %v2double = OpTypeVector %double 2 +%_ptr_Function_v2double = OpTypePointer Function %v2double +%_runtimearr_v2double = OpTypeRuntimeArray %v2double +%SignificandBlock = OpTypeStruct %_runtimearr_v2double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v2double = OpTypePointer Uniform %v2double + %short = OpTypeInt 16 1 + %v2short = OpTypeVector %short 2 +%_ptr_Function_v2short = OpTypePointer Function %v2short +%_runtimearr_v2short = OpTypeRuntimeArray %v2short +%ExponentsBlock = OpTypeStruct %_runtimearr_v2short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v2short = OpTypePointer Uniform %v2short + %v2int = OpTypeVector %int 2 +%_runtimearr_v2double_0 = OpTypeRuntimeArray %v2double +%ResultsBlock = OpTypeStruct %_runtimearr_v2double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v2double Function + %e = OpVariable %_ptr_Function_v2short Function + %r = OpVariable %_ptr_Function_v2double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v2double %__0 %int_0 %33 + %36 = OpLoad %v2double %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v2short %__1 %int_0 %45 + %48 = OpLoad %v2short %47 + OpStore %e %48 + %50 = OpLoad %v2double %s + %51 = OpLoad %v2short %e + %54 = OpExtInst %v2double %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v2double %r + %61 = OpAccessChain %_ptr_Uniform_v2double %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE double DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int16 DATA +1 +0 +-1 +-2 +-14 +-126 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-126 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-126 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-126 +-32764 +-32765 +END + +BUFFER results DATA_TYPE double DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +16 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 32 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 40 TOLERANCE .0001 EQ -1.1754943508222875e-38 +EXPECT results IDX 48 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 80 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 96 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 104 TOLERANCE .0001 EQ 5.877471754111438e-39 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 128 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 136 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 144 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 152 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 160 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 168 TOLERANCE .0001 EQ 1.4693679385278594e-38 +EXPECT results IDX 176 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 184 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 192 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 200 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 208 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 216 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 224 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 232 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 240 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 248 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_f64vec2_i16vec2.glsl b/vulkan/amber/ldexp/ldexp_f64vec2_i16vec2.glsl new file mode 100644 index 0000000..8d72d2b --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec2_i16vec2.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f64vec2 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i16vec2 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f64vec2 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f64vec2 s = significands[idx]; + const i16vec2 e = exponents[idx]; + const f64vec2 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f64vec2_i16vec2.glsl.spv b/vulkan/amber/ldexp/ldexp_f64vec2_i16vec2.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..2ffe813a3c8fb625bf101cf7489d82532816f029 GIT binary patch literal 2012 zcmY+E>rNCw5QQ7|rh)=;^9C*#MFkNQ5Jhm&kcGHE5RCEPWZWHL;xbEiW(~fT590fH zNlZLn&$O&fimFppeX6FqAlExnGN#8EQ!?B7%^5Pi)`Py3;jv7=9WwHj%;Elf@6GOk zx4iZ-OuRU0wf&<&Ien&R?^bJvwZ%ATEUv6B$!)Hf9LmN9lv9x1D>?DQ2tUz5`SGcQ zsYvJw$>|6GcY(YrRBPVOhj(6l>^Fk87o43o!@8RA+hKBi5+q^WOTL~4v1;W1t5Fb7 zUOZvrOtA~L=26qDwd#IzFZv>tgso^VY6Qefw#WTWeEhl<#fcv!ubQp;XWgfJ`sdVJ zohXrpyJ$VBt)ZIO`b(;0%wc#Gg`dK@A2l3}^3xdC;`2DyEZ;>89k_W1=3CIMKIxsa z(^eEjNu042GrvMc6G>w>KWF-J>cDeZx^3;E-o%)LAnr8(v83OIpVLlb_TE71GF45G zx1xs$Nma_*oNE&9JA8gWXP5(VYGY4HI1W#z&|-Fn zTD&v0=+o80=D1o8ch_Q8t`;`6*g`9sUl>5>8ooT$)`={dwCv{em|X=UeCr-=r+w$K_IodEz4% z%=h4<)(z>hguC+@zA2kS?OW31!Z)IR*@rRJn3S$a#+7qh8q7Cyrz}ms_$QRhPNX^M zUVzD)lI9NkKyP4bIiBgv<}ST5XYTe$s5>i-&*k5dOYo6~sh7R1!Hu82!6L4Xd)pdo4bSF8|+K6yWU^Y zPMmumr6=uwEaBVmbGjksIfjDERW(6&MXf1GRmgU^E6e6G*ONaio7terXC83uiVK@_ zRl5J>U6YI|YfO4ZjN{VS;3GV_--i$PN*dx7xsbxH~xy@bbFlYL;_-)zL!A~9D z1vWEa#$f8)k>(CQ>VVm^@!ZXA<6-C4FZ%|=b1%=s2M?J2!b5-erI}Mf!Yr{LNVaKG^-Dg!jUmu$;%a|C@4n4@(m6;r}7dC(@kXVj}ibf{*XOHlAm) zL#>kkKe8;${;5TbJod06Ax6J^2iQ1PWg7>3d@f5n3%FgvU=gMwJzd56>-+R!PGCU|f=t|ySs~^;t< zopi!hm^7NbFgZF7lCafCzMcfJY83ygF(96zc*6FXVi$bP!%m~#Z8bal(HE&C>_+=h zJ0M>6J-$1QkKT5pIB7=7n@+d&S@-Fl{yDAgX_QFAUGkpP*1%ls{bf~h?jSsj!cSqV z8MTc@`Du)6@p+tUp6?=t4&2N*@ODWPaBlbPq#FfM5@&2BvEk=vB56!EcZa+;wJ*!= zd4EZ7;@tZnKJENtNxuz0rfS z#D&edCgHx}^ZNzI9EejJdq%=BJexv~*`0hX`m|a$AFE|JUyE5;Eo^GBgVX}&Yh4x2 z*J5sItpPt6OT5U&z6atm`G&6F52S%}=36($r*EiW24ku4J}h zX2ky)!^HW20p7}bT9!?Z+xiU`*kX@m%!~@wTO|&J3N;VqhG!QY#bZ1jblOf3kh!x2Ql*I zrC&;j!NGjM#=j}s=0ol)2{}XZQh!Uro6!@w#NlDC#H^QX+4N$(uVs_7qY2JRS0(HV Wy^#w?RhqnCnvKl}{YMoyB!2-?PJX`t literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f64vec2_i64vec2.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f64vec2_i64vec2.glsl.spv.spvasm new file mode 100644 index 0000000..1042478 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec2_i64vec2.glsl.spv.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v2double ArrayStride 16 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v2long ArrayStride 16 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v2double_0 ArrayStride 16 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 + %v2double = OpTypeVector %double 2 +%_ptr_Function_v2double = OpTypePointer Function %v2double +%_runtimearr_v2double = OpTypeRuntimeArray %v2double +%SignificandBlock = OpTypeStruct %_runtimearr_v2double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v2double = OpTypePointer Uniform %v2double + %long = OpTypeInt 64 1 + %v2long = OpTypeVector %long 2 +%_ptr_Function_v2long = OpTypePointer Function %v2long +%_runtimearr_v2long = OpTypeRuntimeArray %v2long +%ExponentsBlock = OpTypeStruct %_runtimearr_v2long +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v2long = OpTypePointer Uniform %v2long + %v2int = OpTypeVector %int 2 +%_runtimearr_v2double_0 = OpTypeRuntimeArray %v2double +%ResultsBlock = OpTypeStruct %_runtimearr_v2double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v2double Function + %e = OpVariable %_ptr_Function_v2long Function + %r = OpVariable %_ptr_Function_v2double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v2double %__0 %int_0 %33 + %36 = OpLoad %v2double %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v2long %__1 %int_0 %45 + %48 = OpLoad %v2long %47 + OpStore %e %48 + %50 = OpLoad %v2double %s + %51 = OpLoad %v2long %e + %54 = OpExtInst %v2double %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v2double %r + %61 = OpAccessChain %_ptr_Uniform_v2double %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.amber b/vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.amber new file mode 100644 index 0000000..6abb866 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.amber @@ -0,0 +1,307 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderFloat64 +DEVICE_FEATURE Float16Int8Features.shaderInt8 +DEVICE_FEATURE Storage8BitFeatures.uniformAndStorageBuffer8BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int8 + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v2double ArrayStride 16 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v2char ArrayStride 2 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v2double_0 ArrayStride 16 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 + %v2double = OpTypeVector %double 2 +%_ptr_Function_v2double = OpTypePointer Function %v2double +%_runtimearr_v2double = OpTypeRuntimeArray %v2double +%SignificandBlock = OpTypeStruct %_runtimearr_v2double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v2double = OpTypePointer Uniform %v2double + %char = OpTypeInt 8 1 + %v2char = OpTypeVector %char 2 +%_ptr_Function_v2char = OpTypePointer Function %v2char +%_runtimearr_v2char = OpTypeRuntimeArray %v2char +%ExponentsBlock = OpTypeStruct %_runtimearr_v2char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v2char = OpTypePointer Uniform %v2char + %v2int = OpTypeVector %int 2 +%_runtimearr_v2double_0 = OpTypeRuntimeArray %v2double +%ResultsBlock = OpTypeStruct %_runtimearr_v2double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v2double Function + %e = OpVariable %_ptr_Function_v2char Function + %r = OpVariable %_ptr_Function_v2double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v2double %__0 %int_0 %33 + %36 = OpLoad %v2double %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v2char %__1 %int_0 %45 + %48 = OpLoad %v2char %47 + OpStore %e %48 + %50 = OpLoad %v2double %s + %51 = OpLoad %v2char %e + %54 = OpExtInst %v2double %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v2double %r + %61 = OpAccessChain %_ptr_Uniform_v2double %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE double DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int8 DATA +1 +0 +-1 +-2 +-14 +-126 +-124 +-125 +1 +0 +-1 +-2 +-14 +-126 +-124 +-125 +1 +0 +-1 +-2 +-14 +-126 +-124 +-125 +1 +0 +-1 +-2 +-14 +-126 +-124 +-125 +END + +BUFFER results DATA_TYPE double DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +16 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 32 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 40 TOLERANCE .0001 EQ -1.1754943508222875e-38 +EXPECT results IDX 48 TOLERANCE .0001 EQ -4.70197740328915e-38 +EXPECT results IDX 56 TOLERANCE .0001 EQ -2.350988701644575e-38 +EXPECT results IDX 64 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 80 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 96 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 104 TOLERANCE .0001 EQ 5.877471754111438e-39 +EXPECT results IDX 112 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 120 TOLERANCE .0001 EQ 1.1754943508222875e-38 +EXPECT results IDX 128 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 136 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 144 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 152 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 160 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 168 TOLERANCE .0001 EQ 1.4693679385278594e-38 +EXPECT results IDX 176 TOLERANCE .0001 EQ 5.877471754111438e-38 +EXPECT results IDX 184 TOLERANCE .0001 EQ 2.938735877055719e-38 +EXPECT results IDX 192 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 200 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 208 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 216 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 224 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 232 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 240 TOLERANCE .0001 EQ 9.4039548065783e-38 +EXPECT results IDX 248 TOLERANCE .0001 EQ 4.70197740328915e-38 + diff --git a/vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.glsl b/vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.glsl new file mode 100644 index 0000000..d81fa8b --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f64vec2 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i8vec2 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f64vec2 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f64vec2 s = significands[idx]; + const i8vec2 e = exponents[idx]; + const f64vec2 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.glsl.spv b/vulkan/amber/ldexp/ldexp_f64vec2_i8vec2.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..b050c93a32b9c8b6fa780aaa86763ce90ff08908 GIT binary patch literal 2012 zcmY+E>rNCw5QQ7|rh)=;^9C*#MFkNR5Jhm&kcGHE2pHqP$+$bh#ASx;3p@@2@m#L`AtPVK9PGXK-tO#s zYaheZOVYUG9|qj*Gi7_X-Z*G1CTVMNd1VRz6;nXj*no0MvU?@Rei-2=Iw(Irl`u64 zT_FYi;QuaARE2uO+y3y*OOE_j(D8z^lXlot7k(#9kB);hYvyohC$1k}(J2VHAD}n|{=CG|JCnTuaX5T(f)^F?8VO9T;#)xB8^F&raef zh|(lyE9ZWNj3$!BY<|J?PGi8-7kFi`jbvnak8QLEefU zCM0zs_m(@d++1e5@&{!z8#MXM1CAYWVRNoYxbN`!{eoc*#Ho!vCE++cok5G)9cr;J z)S^#U3!CF=Iow@~S-D!+)M5vz1@5kORk-`Rm|Iq>WM?aA&bf<*8N!$Kmf>!`Va4d_ zx@1^cBhpi19F@i%RS#p*RSBmmJTA?yW&Wb=oqoaVit{b>gl|$7@8fc*!#wek3+8+9 zQR{|uRl?o*9N(19q4q6la^V|MzwE=9YD`MkB;(4tEe+-$0SxbbX>#zv3uYhi!Sg_xIr3J_8hc(+>%t4N`Mw3c68Y>4 zIrx!Py(D`ACx^ZHDfCd9n(RtZ!W_WW+;*55@qfl);{3k=Z{$5K%BIIn{e}zdVvl6w z+fpCw#*&16VrN{=9^`h|oT9Lxvo_}68-`H=fkLQcQD)ZdWs yX7ofZad?<3G1tqcYrNCw5QQ7|rh)=;^9C*#MFkNQ5Jhm&kcGHE5RCEPWZWHL;xbEiW(~fT590fH zNlZLn&$O&fimFppeX6FqAlExnGN#8EQ!?B7%^5Pi)`Py3;jv7=9WwHj%;Elf@6GOk zx4iZ-OuRU0wf&<&Ien&R?^bJvwZ%ATEUv6B$!)Hf9LmN9lv9x1D>?DQ2tUz5`SGcQ zsYvJw$>|6GcY(YrRBPVOhj(6l>^Fk87o43o!@8RA+hKBi5+q^WOTL~4v1;W1t5Fb7 zUOZvrOtA~L=26qDwd#IzFZv>tgso^VY6Qefw#WTWeEhl<#fcv!ubQp;XWgfJ`sdVJ zohXrpyJ$VBt)ZIO`b(;0%wc#Gg`dK@A2l3}^3xdC;`2DyEZ;>89k_W1=3CIMKIxsa z(^eEjNu042GrvMc6G>w>KWF-J>cDeZx^3;E-o%)LAnr8(v83OIpVLlb_TE71GF45G zx1xs$NmadJpEJyXIJL2-BpipQQ)n@} zLoIlyMW3z~HpkU+xVsj!a<#CjrM0u%;O<&ig}c9txuvxVcD91%oI7urA$;sIy@R{? zhK1?rx@1^cBhpi19F@i%)gAs0%MwmmcwCxYOZ|D7 z7tHtIqt*@SvV^X(m|FOVGdFDR(kpZ3ZjXezv(orn-8-_Wi=Vpe2{tof=3sd5O2dnf zx?tYj)t$?1?o#KTG;^X3yzGSg9`*qY?|o@F@WBh_{qe!`K$+BlI6tT$lU> DXAFka literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f64vec4_i16vec4.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f64vec4_i16vec4.glsl.spv.spvasm new file mode 100644 index 0000000..98d2e32 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec4_i16vec4.glsl.spv.spvasm @@ -0,0 +1,130 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4double ArrayStride 32 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4short ArrayStride 8 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4double_0 ArrayStride 32 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 + %v4double = OpTypeVector %double 4 +%_ptr_Function_v4double = OpTypePointer Function %v4double +%_runtimearr_v4double = OpTypeRuntimeArray %v4double +%SignificandBlock = OpTypeStruct %_runtimearr_v4double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4double = OpTypePointer Uniform %v4double + %short = OpTypeInt 16 1 + %v4short = OpTypeVector %short 4 +%_ptr_Function_v4short = OpTypePointer Function %v4short +%_runtimearr_v4short = OpTypeRuntimeArray %v4short +%ExponentsBlock = OpTypeStruct %_runtimearr_v4short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4short = OpTypePointer Uniform %v4short + %v4int = OpTypeVector %int 4 +%_runtimearr_v4double_0 = OpTypeRuntimeArray %v4double +%ResultsBlock = OpTypeStruct %_runtimearr_v4double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4double Function + %e = OpVariable %_ptr_Function_v4short Function + %r = OpVariable %_ptr_Function_v4double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4double %__0 %int_0 %33 + %36 = OpLoad %v4double %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4short %__1 %int_0 %45 + %48 = OpLoad %v4short %47 + OpStore %e %48 + %50 = OpLoad %v4double %s + %51 = OpLoad %v4short %e + %54 = OpExtInst %v4double %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v4double %r + %61 = OpAccessChain %_ptr_Uniform_v4double %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.amber b/vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.amber new file mode 100644 index 0000000..74404e6 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.amber @@ -0,0 +1,300 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderFloat64 + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4double ArrayStride 32 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4int ArrayStride 16 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4double_0 ArrayStride 32 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 + %v4double = OpTypeVector %double 4 +%_ptr_Function_v4double = OpTypePointer Function %v4double +%_runtimearr_v4double = OpTypeRuntimeArray %v4double +%SignificandBlock = OpTypeStruct %_runtimearr_v4double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4double = OpTypePointer Uniform %v4double + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_runtimearr_v4int = OpTypeRuntimeArray %v4int +%ExponentsBlock = OpTypeStruct %_runtimearr_v4int +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int +%_runtimearr_v4double_0 = OpTypeRuntimeArray %v4double +%ResultsBlock = OpTypeStruct %_runtimearr_v4double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4double Function + %e = OpVariable %_ptr_Function_v4int Function + %r = OpVariable %_ptr_Function_v4double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4double %__0 %int_0 %33 + %36 = OpLoad %v4double %35 + OpStore %s %36 + %44 = OpLoad %uint %idx + %46 = OpAccessChain %_ptr_Uniform_v4int %__1 %int_0 %44 + %47 = OpLoad %v4int %46 + OpStore %e %47 + %49 = OpLoad %v4double %s + %50 = OpLoad %v4int %e + %51 = OpExtInst %v4double %1 Ldexp %49 %50 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %v4double %r + %58 = OpAccessChain %_ptr_Uniform_v4double %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE double DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int32 DATA +1 +0 +-1 +-2 +-14 +-126 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-126 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-126 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-126 +-2147483644 +-2147483645 +END + +BUFFER results DATA_TYPE double DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +8 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 32 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 40 TOLERANCE .0001 EQ -1.1754943508222875e-38 +EXPECT results IDX 48 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 80 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 96 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 104 TOLERANCE .0001 EQ 5.877471754111438e-39 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 128 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 136 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 144 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 152 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 160 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 168 TOLERANCE .0001 EQ 1.4693679385278594e-38 +EXPECT results IDX 176 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 184 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 192 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 200 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 208 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 216 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 224 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 232 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 240 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 248 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.glsl b/vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.glsl new file mode 100644 index 0000000..6df9948 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f64vec4 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i32vec4 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f64vec4 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f64vec4 s = significands[idx]; + const i32vec4 e = exponents[idx]; + const f64vec4 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.glsl.spv b/vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..9c596039bf1e4f544b015492f4def3bcbccc3e1d GIT binary patch literal 1936 zcmY+EYflqV5QY!5v|dm^Zr;EG-a$kKL=glHDJ1=1#1DRJns$YaWlOq?!GGls@&9;9 zOnjencBCFM%)B#m-kF^_Q0Sj4JJ;u&E4$bF%^7k1-h;j%e9@IWuGaQzi)q$cTwYls z@3JePd~8TL1G4)iM~yhaPjpy*d?S)A36+q7e(--6D5^rWR^R#fp`IQ#T2Z$iogTO2 zW}MX<-8efuin6#_&%Pci-j)T9=DS}mK8)iT^$i&FJteR9R!vGh!T<#va$53F(T2QxTq&=B)*P z(f3Zj;C03M7J9-rEsOnFE_IkEK61f)4?b#Lm##>-JD=klvN_bgDNQbXW9papFrgaL z(p!>A<=m16^LNLciZuP=pHeP+3OV6jfXSPYW=^~ZdIM7nA93b}&0Xp+XZp1|w`EfY zKXrH)*vx<#gW&TUY>^!9x(fbhyLzMGpB-tSz|*rS(yD(ix_$AVMRiWe)$ftajeQV4)*w5!fxRpMjm@zlMsW0`GAf8g>0J- zxi2N;49ZLWbqPD8F1f_vVXnlimshgs#dtSlle4V}&Ps1ecrWxuE*$vC`=!~~jL?5n HaZU0UFyVb} literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.glsl.spv.spvasm new file mode 100644 index 0000000..2d28a7c --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec4_i32vec4.glsl.spv.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4double ArrayStride 32 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4int ArrayStride 16 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4double_0 ArrayStride 32 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 + %v4double = OpTypeVector %double 4 +%_ptr_Function_v4double = OpTypePointer Function %v4double +%_runtimearr_v4double = OpTypeRuntimeArray %v4double +%SignificandBlock = OpTypeStruct %_runtimearr_v4double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4double = OpTypePointer Uniform %v4double + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_runtimearr_v4int = OpTypeRuntimeArray %v4int +%ExponentsBlock = OpTypeStruct %_runtimearr_v4int +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int +%_runtimearr_v4double_0 = OpTypeRuntimeArray %v4double +%ResultsBlock = OpTypeStruct %_runtimearr_v4double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4double Function + %e = OpVariable %_ptr_Function_v4int Function + %r = OpVariable %_ptr_Function_v4double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4double %__0 %int_0 %33 + %36 = OpLoad %v4double %35 + OpStore %s %36 + %44 = OpLoad %uint %idx + %46 = OpAccessChain %_ptr_Uniform_v4int %__1 %int_0 %44 + %47 = OpLoad %v4int %46 + OpStore %e %47 + %49 = OpLoad %v4double %s + %50 = OpLoad %v4int %e + %51 = OpExtInst %v4double %1 Ldexp %49 %50 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %v4double %r + %58 = OpAccessChain %_ptr_Uniform_v4double %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.amber b/vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.amber new file mode 100644 index 0000000..725f8e1 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.amber @@ -0,0 +1,304 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderFloat64 +DEVICE_FEATURE shaderInt64 + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4double ArrayStride 32 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4long ArrayStride 32 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4double_0 ArrayStride 32 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 + %v4double = OpTypeVector %double 4 +%_ptr_Function_v4double = OpTypePointer Function %v4double +%_runtimearr_v4double = OpTypeRuntimeArray %v4double +%SignificandBlock = OpTypeStruct %_runtimearr_v4double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4double = OpTypePointer Uniform %v4double + %long = OpTypeInt 64 1 + %v4long = OpTypeVector %long 4 +%_ptr_Function_v4long = OpTypePointer Function %v4long +%_runtimearr_v4long = OpTypeRuntimeArray %v4long +%ExponentsBlock = OpTypeStruct %_runtimearr_v4long +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4long = OpTypePointer Uniform %v4long + %v4int = OpTypeVector %int 4 +%_runtimearr_v4double_0 = OpTypeRuntimeArray %v4double +%ResultsBlock = OpTypeStruct %_runtimearr_v4double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4double Function + %e = OpVariable %_ptr_Function_v4long Function + %r = OpVariable %_ptr_Function_v4double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4double %__0 %int_0 %33 + %36 = OpLoad %v4double %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4long %__1 %int_0 %45 + %48 = OpLoad %v4long %47 + OpStore %e %48 + %50 = OpLoad %v4double %s + %51 = OpLoad %v4long %e + %54 = OpExtInst %v4double %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v4double %r + %61 = OpAccessChain %_ptr_Uniform_v4double %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE double DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int64 DATA +1 +0 +-1 +-2 +-14 +-126 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-126 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-126 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-126 +-9223372036854775804 +-9223372036854775805 +END + +BUFFER results DATA_TYPE double DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +8 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 32 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 40 TOLERANCE .0001 EQ -1.1754943508222875e-38 +EXPECT results IDX 48 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 80 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 96 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 104 TOLERANCE .0001 EQ 5.877471754111438e-39 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 128 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 136 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 144 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 152 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 160 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 168 TOLERANCE .0001 EQ 1.4693679385278594e-38 +EXPECT results IDX 176 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 184 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 192 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 200 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 208 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 216 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 224 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 232 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 240 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 248 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.glsl b/vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.glsl new file mode 100644 index 0000000..4d64a41 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f64vec4 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i16vec4 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f64vec4 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f64vec4 s = significands[idx]; + const i16vec4 e = exponents[idx]; + const f64vec4 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.glsl.spv b/vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..cea4b7b06dd8db84fbb1ad03a404627b496997f3 GIT binary patch literal 1976 zcmY+EYflqV5QYzJX;n}_Zr;FhQB)9bfGC2Ch7^*1FyaTlHBGz1#K{F{Wa6^_Med3f6wSRHO7?jY090#1pm86}w<-9(5Y^ZmZcjh`&gsQ8zw_ z+ad9a?eX1Na{RU%CuuWI-*mdI&$>_d^v`K^&*D@X?y~hbTLUwR^;cBMn8WBOjy^@L zX598P%6BoYCH*+pEZ;>89k`isXzj8lV9eh6X*UkzG|AY?V#CkTL|jZZcZaRl*_UPa ztiP-`G3I@koOS-OxNpPH>A9HY7;!FB(*$`dYRyP$LjEoHW%;=*ebwj!;;qG#VZ_4IS`<67h@J*;+_F+mj zW~Bqkv~q4sgZY2QovJkb;-672yWw)&UVzD)lV(or1HFN%g^xIM!{#o%GUq@tAffJ} zG(KPVj%@1Ur!ISf%}kg%7~Z?m@ZzH`n0LoVd?~ZJOPzbt%!xYivJ?J$*atB8?n}dg z4_+|uj}M*)(#(;!V%FHpk|2jyWb=J1dL{DN7jp0;8+u9h1Wpcn^Hb=dG&R{3`eY8^ zYG!-PjQE}Lm^i-|;O(rZRoV2oqrY&0ee98Je7ov{-Qb6xePU;P&XdglO*!n#QwjI* z{}AUhY0hsk5nGes<2$fD&$?_^t88~+Lzw-b7BTX8hvyPv^vidEJ;$bO&#@%?g@m_; zgBW>>(k~^%;9x#r&%Y(x&xhPs5^{#+rT(^rH=`$ViNnKOiTPf3WYdf1eJz`uT}^Oa aI*_n0^hPcmfi!u)G#fu7^dD8+l>7x%C4Th) literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.glsl.spv.spvasm new file mode 100644 index 0000000..9b43fe1 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec4_i64vec4.glsl.spv.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4double ArrayStride 32 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4long ArrayStride 32 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4double_0 ArrayStride 32 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 + %v4double = OpTypeVector %double 4 +%_ptr_Function_v4double = OpTypePointer Function %v4double +%_runtimearr_v4double = OpTypeRuntimeArray %v4double +%SignificandBlock = OpTypeStruct %_runtimearr_v4double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4double = OpTypePointer Uniform %v4double + %long = OpTypeInt 64 1 + %v4long = OpTypeVector %long 4 +%_ptr_Function_v4long = OpTypePointer Function %v4long +%_runtimearr_v4long = OpTypeRuntimeArray %v4long +%ExponentsBlock = OpTypeStruct %_runtimearr_v4long +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4long = OpTypePointer Uniform %v4long + %v4int = OpTypeVector %int 4 +%_runtimearr_v4double_0 = OpTypeRuntimeArray %v4double +%ResultsBlock = OpTypeStruct %_runtimearr_v4double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4double Function + %e = OpVariable %_ptr_Function_v4long Function + %r = OpVariable %_ptr_Function_v4double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4double %__0 %int_0 %33 + %36 = OpLoad %v4double %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4long %__1 %int_0 %45 + %48 = OpLoad %v4long %47 + OpStore %e %48 + %50 = OpLoad %v4double %s + %51 = OpLoad %v4long %e + %54 = OpExtInst %v4double %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v4double %r + %61 = OpAccessChain %_ptr_Uniform_v4double %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.amber b/vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.amber new file mode 100644 index 0000000..9664b01 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.amber @@ -0,0 +1,307 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderFloat64 +DEVICE_FEATURE Float16Int8Features.shaderInt8 +DEVICE_FEATURE Storage8BitFeatures.uniformAndStorageBuffer8BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int8 + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4double ArrayStride 32 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4char ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4double_0 ArrayStride 32 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 + %v4double = OpTypeVector %double 4 +%_ptr_Function_v4double = OpTypePointer Function %v4double +%_runtimearr_v4double = OpTypeRuntimeArray %v4double +%SignificandBlock = OpTypeStruct %_runtimearr_v4double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4double = OpTypePointer Uniform %v4double + %char = OpTypeInt 8 1 + %v4char = OpTypeVector %char 4 +%_ptr_Function_v4char = OpTypePointer Function %v4char +%_runtimearr_v4char = OpTypeRuntimeArray %v4char +%ExponentsBlock = OpTypeStruct %_runtimearr_v4char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4char = OpTypePointer Uniform %v4char + %v4int = OpTypeVector %int 4 +%_runtimearr_v4double_0 = OpTypeRuntimeArray %v4double +%ResultsBlock = OpTypeStruct %_runtimearr_v4double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4double Function + %e = OpVariable %_ptr_Function_v4char Function + %r = OpVariable %_ptr_Function_v4double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4double %__0 %int_0 %33 + %36 = OpLoad %v4double %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4char %__1 %int_0 %45 + %48 = OpLoad %v4char %47 + OpStore %e %48 + %50 = OpLoad %v4double %s + %51 = OpLoad %v4char %e + %54 = OpExtInst %v4double %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v4double %r + %61 = OpAccessChain %_ptr_Uniform_v4double %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE double DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int8 DATA +1 +0 +-1 +-2 +-14 +-126 +-124 +-125 +1 +0 +-1 +-2 +-14 +-126 +-124 +-125 +1 +0 +-1 +-2 +-14 +-126 +-124 +-125 +1 +0 +-1 +-2 +-14 +-126 +-124 +-125 +END + +BUFFER results DATA_TYPE double DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +8 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 32 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 40 TOLERANCE .0001 EQ -1.1754943508222875e-38 +EXPECT results IDX 48 TOLERANCE .0001 EQ -4.70197740328915e-38 +EXPECT results IDX 56 TOLERANCE .0001 EQ -2.350988701644575e-38 +EXPECT results IDX 64 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 80 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 96 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 104 TOLERANCE .0001 EQ 5.877471754111438e-39 +EXPECT results IDX 112 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 120 TOLERANCE .0001 EQ 1.1754943508222875e-38 +EXPECT results IDX 128 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 136 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 144 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 152 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 160 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 168 TOLERANCE .0001 EQ 1.4693679385278594e-38 +EXPECT results IDX 176 TOLERANCE .0001 EQ 5.877471754111438e-38 +EXPECT results IDX 184 TOLERANCE .0001 EQ 2.938735877055719e-38 +EXPECT results IDX 192 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 200 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 208 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 216 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 224 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 232 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 240 TOLERANCE .0001 EQ 9.4039548065783e-38 +EXPECT results IDX 248 TOLERANCE .0001 EQ 4.70197740328915e-38 + diff --git a/vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.glsl b/vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.glsl new file mode 100644 index 0000000..69a7c6f --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + f64vec4 significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + i8vec4 exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + f64vec4 results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const f64vec4 s = significands[idx]; + const i8vec4 e = exponents[idx]; + const f64vec4 r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.glsl.spv b/vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..91c5888be8fb489b1bb0d3907da2e06721622ace GIT binary patch literal 2012 zcmY+E=}r_;5QQ(yrh)>pxq-u?s32~DC<23q48-|Cz!?8^+L;zQ4&7wBG5A(Ki0|W) zn0UV1ePz6)s5(`3PgU2gOrdwCVoZ-Qree1ApEG27tp|N6$8)*%hm3p`bFlZ`d%Lsm zt$qwsFG=H$e;9DL&y?-mdgGw6n53=6rRB%?ub2YL#s-vAlHDsg_QME2(Lwp~sf4LX z=n5(55C3<8qAJuI-u8!gUUKBOf{quQowUQIy6`(;dUPD5Vbe>$o&HV) zVe3q>3%2HA+iS#4zr7oMkxIij+KpNP@rvzn?=(4j6GutvN9pT!-2ANjbWi`BW_%i@ z(r}lpC$lwFlURR6m5ezE52Nr?*z}{8qfveq<63ea=bGiah@k^F@4$ddy45GWeRdK@ zL6jyrTRHbDWHga1X7dZCAEypHm!&(_F6&K<*$F+wgNbSoTel|Lw(*;FOuGY>d+#D&edCgHxr=l2VSIS{8d_LPL<@N@<(W_PH? zJ5!53T`g>mtL1QaEoS9vVN*+MXSu=MwXOMk z)6;dyu(C#^r^GlajXkP6W71U#rz$)y&8}tsqV1i2!E1{1E%bzMQWo#ya;d{S@sSJW zd+<@~hICcJ-T55fl+B^`EopM$8&SXP!bvYc!$ zz~oIyGbi?e-oVttN1VA~bC+J3Gr2ty>ds2zb9L{?rY?T!vM1Qggqefky(2X8<;R3tZ zBiZ=2)Car44?p|F&bXW>x&NDT*q5gg?&1F-&S%n`-(n)RB*DjbU^|{=*;%c!-Gvol z_Jdl)$m1QJONh}g-vM?UtFj%(oa`48-Wm>K6e%K z>k{6Kp2#H*4|65vdfAXoFOGLpHaT0G;Iwp2!oJWOxp35^$@`_*xEZ1UsN$;RFV{wf Ax&QzG literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.glsl.spv.spvasm new file mode 100644 index 0000000..9299770 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_f64vec4_i8vec4.glsl.spv.spvasm @@ -0,0 +1,130 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int8 + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_v4double ArrayStride 32 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_v4char ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_v4double_0 ArrayStride 32 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 + %v4double = OpTypeVector %double 4 +%_ptr_Function_v4double = OpTypePointer Function %v4double +%_runtimearr_v4double = OpTypeRuntimeArray %v4double +%SignificandBlock = OpTypeStruct %_runtimearr_v4double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_v4double = OpTypePointer Uniform %v4double + %char = OpTypeInt 8 1 + %v4char = OpTypeVector %char 4 +%_ptr_Function_v4char = OpTypePointer Function %v4char +%_runtimearr_v4char = OpTypeRuntimeArray %v4char +%ExponentsBlock = OpTypeStruct %_runtimearr_v4char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_v4char = OpTypePointer Uniform %v4char + %v4int = OpTypeVector %int 4 +%_runtimearr_v4double_0 = OpTypeRuntimeArray %v4double +%ResultsBlock = OpTypeStruct %_runtimearr_v4double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_v4double Function + %e = OpVariable %_ptr_Function_v4char Function + %r = OpVariable %_ptr_Function_v4double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpAccessChain %_ptr_Uniform_v4double %__0 %int_0 %33 + %36 = OpLoad %v4double %35 + OpStore %s %36 + %45 = OpLoad %uint %idx + %47 = OpAccessChain %_ptr_Uniform_v4char %__1 %int_0 %45 + %48 = OpLoad %v4char %47 + OpStore %e %48 + %50 = OpLoad %v4double %s + %51 = OpLoad %v4char %e + %54 = OpExtInst %v4double %1 Ldexp %50 %51 + OpStore %r %54 + %59 = OpLoad %uint %idx + %60 = OpLoad %v4double %r + %61 = OpAccessChain %_ptr_Uniform_v4double %__2 %int_0 %59 + OpStore %61 %60 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_float16_int16.amber b/vulkan/amber/ldexp/ldexp_float16_int16.amber new file mode 100644 index 0000000..be6f9c8 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float16_int16.amber @@ -0,0 +1,305 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE shaderInt16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_half ArrayStride 2 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_short ArrayStride 2 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_half_0 ArrayStride 2 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 +%_ptr_Function_half = OpTypePointer Function %half +%_runtimearr_half = OpTypeRuntimeArray %half +%SignificandBlock = OpTypeStruct %_runtimearr_half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_half = OpTypePointer Uniform %half + %short = OpTypeInt 16 1 +%_ptr_Function_short = OpTypePointer Function %short +%_runtimearr_short = OpTypeRuntimeArray %short +%ExponentsBlock = OpTypeStruct %_runtimearr_short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_short = OpTypePointer Uniform %short +%_runtimearr_half_0 = OpTypeRuntimeArray %half +%ResultsBlock = OpTypeStruct %_runtimearr_half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_half Function + %e = OpVariable %_ptr_Function_short Function + %r = OpVariable %_ptr_Function_half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_half %__0 %int_0 %32 + %35 = OpLoad %half %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_short %__1 %int_0 %43 + %46 = OpLoad %short %45 + OpStore %e %46 + %48 = OpLoad %half %s + %49 = OpLoad %short %e + %50 = OpExtInst %half %1 Ldexp %48 %49 + OpStore %r %50 + %55 = OpLoad %uint %idx + %56 = OpLoad %half %r + %57 = OpAccessChain %_ptr_Uniform_half %__2 %int_0 %55 + OpStore %57 %56 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float16 DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int16 DATA +1 +0 +-1 +-2 +-32762 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-32762 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-32762 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-32762 +-32763 +-32764 +-32765 +END + +BUFFER results DATA_TYPE float16 DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +32 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 2 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 6 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 10 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 14 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 18 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 20 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 22 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 24 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 26 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 30 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 34 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 38 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 42 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 46 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 48 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 50 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 52 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 54 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 58 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 62 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_float16_int32.amber b/vulkan/amber/ldexp/ldexp_float16_int32.amber new file mode 100644 index 0000000..1d8ef83 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float16_int32.amber @@ -0,0 +1,302 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_half ArrayStride 2 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_half_0 ArrayStride 2 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 +%_ptr_Function_half = OpTypePointer Function %half +%_runtimearr_half = OpTypeRuntimeArray %half +%SignificandBlock = OpTypeStruct %_runtimearr_half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_half = OpTypePointer Uniform %half +%_ptr_Function_int = OpTypePointer Function %int +%_runtimearr_int = OpTypeRuntimeArray %int +%ExponentsBlock = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_runtimearr_half_0 = OpTypeRuntimeArray %half +%ResultsBlock = OpTypeStruct %_runtimearr_half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_half Function + %e = OpVariable %_ptr_Function_int Function + %r = OpVariable %_ptr_Function_half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_half %__0 %int_0 %32 + %35 = OpLoad %half %34 + OpStore %s %35 + %42 = OpLoad %uint %idx + %44 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %42 + %45 = OpLoad %int %44 + OpStore %e %45 + %47 = OpLoad %half %s + %48 = OpLoad %int %e + %49 = OpExtInst %half %1 Ldexp %47 %48 + OpStore %r %49 + %54 = OpLoad %uint %idx + %55 = OpLoad %half %r + %56 = OpAccessChain %_ptr_Uniform_half %__2 %int_0 %54 + OpStore %56 %55 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float16 DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int32 DATA +1 +0 +-1 +-2 +-2147483642 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-2147483642 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-2147483642 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-2147483642 +-2147483643 +-2147483644 +-2147483645 +END + +BUFFER results DATA_TYPE float16 DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +32 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 2 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 6 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 10 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 14 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 18 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 20 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 22 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 24 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 26 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 30 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 34 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 38 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 42 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 46 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 48 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 50 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 52 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 54 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 58 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 62 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_float16_int64.amber b/vulkan/amber/ldexp/ldexp_float16_int64.amber new file mode 100644 index 0000000..3002f2e --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float16_int64.amber @@ -0,0 +1,305 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE shaderInt64 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int64 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_half ArrayStride 2 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_long ArrayStride 8 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_half_0 ArrayStride 2 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 +%_ptr_Function_half = OpTypePointer Function %half +%_runtimearr_half = OpTypeRuntimeArray %half +%SignificandBlock = OpTypeStruct %_runtimearr_half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_half = OpTypePointer Uniform %half + %long = OpTypeInt 64 1 +%_ptr_Function_long = OpTypePointer Function %long +%_runtimearr_long = OpTypeRuntimeArray %long +%ExponentsBlock = OpTypeStruct %_runtimearr_long +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_long = OpTypePointer Uniform %long +%_runtimearr_half_0 = OpTypeRuntimeArray %half +%ResultsBlock = OpTypeStruct %_runtimearr_half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_half Function + %e = OpVariable %_ptr_Function_long Function + %r = OpVariable %_ptr_Function_half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_half %__0 %int_0 %32 + %35 = OpLoad %half %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_long %__1 %int_0 %43 + %46 = OpLoad %long %45 + OpStore %e %46 + %48 = OpLoad %half %s + %49 = OpLoad %long %e + %50 = OpExtInst %half %1 Ldexp %48 %49 + OpStore %r %50 + %55 = OpLoad %uint %idx + %56 = OpLoad %half %r + %57 = OpAccessChain %_ptr_Uniform_half %__2 %int_0 %55 + OpStore %57 %56 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float16 DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int64 DATA +1 +0 +-1 +-2 +-9223372036854775802 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-9223372036854775802 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-9223372036854775802 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-9223372036854775802 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +END + +BUFFER results DATA_TYPE float16 DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +32 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 2 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 6 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 10 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 14 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 18 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 20 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 22 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 24 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 26 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 30 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 34 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 38 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 42 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 46 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 48 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 50 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 52 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 54 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 58 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 62 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_float16_int8.amber b/vulkan/amber/ldexp/ldexp_float16_int8.amber new file mode 100644 index 0000000..99f7552 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float16_int8.amber @@ -0,0 +1,308 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE Float16Int8Features.shaderFloat16 +DEVICE_FEATURE Float16Int8Features.shaderInt8 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess +DEVICE_FEATURE Storage8BitFeatures.uniformAndStorageBuffer8BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int8 + OpCapability StorageBuffer16BitAccess + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_16bit_storage" + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_half ArrayStride 2 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_char ArrayStride 1 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_half_0 ArrayStride 2 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 +%_ptr_Function_half = OpTypePointer Function %half +%_runtimearr_half = OpTypeRuntimeArray %half +%SignificandBlock = OpTypeStruct %_runtimearr_half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_half = OpTypePointer Uniform %half + %char = OpTypeInt 8 1 +%_ptr_Function_char = OpTypePointer Function %char +%_runtimearr_char = OpTypeRuntimeArray %char +%ExponentsBlock = OpTypeStruct %_runtimearr_char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_char = OpTypePointer Uniform %char +%_runtimearr_half_0 = OpTypeRuntimeArray %half +%ResultsBlock = OpTypeStruct %_runtimearr_half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_half Function + %e = OpVariable %_ptr_Function_char Function + %r = OpVariable %_ptr_Function_half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_half %__0 %int_0 %32 + %35 = OpLoad %half %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_char %__1 %int_0 %43 + %46 = OpLoad %char %45 + OpStore %e %46 + %48 = OpLoad %half %s + %49 = OpLoad %char %e + %51 = OpExtInst %half %1 Ldexp %48 %49 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %half %r + %58 = OpAccessChain %_ptr_Uniform_half %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float16 DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int8 DATA +1 +0 +-1 +-2 +-122 +-123 +-124 +-125 +1 +0 +-1 +-2 +-122 +-123 +-124 +-125 +1 +0 +-1 +-2 +-122 +-123 +-124 +-125 +1 +0 +-1 +-2 +-122 +-123 +-124 +-125 +END + +BUFFER results DATA_TYPE float16 DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +32 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 2 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 6 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 8 TOLERANCE .0001 EQ -1.88079096131566e-37 +EXPECT results IDX 10 TOLERANCE .0001 EQ -9.4039548065783e-38 +EXPECT results IDX 12 TOLERANCE .0001 EQ -4.70197740328915e-38 +EXPECT results IDX 14 TOLERANCE .0001 EQ -2.350988701644575e-38 +EXPECT results IDX 16 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 18 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 20 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 22 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 24 TOLERANCE .0001 EQ 9.4039548065783e-38 +EXPECT results IDX 26 TOLERANCE .0001 EQ 4.70197740328915e-38 +EXPECT results IDX 28 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 30 TOLERANCE .0001 EQ 1.1754943508222875e-38 +EXPECT results IDX 32 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 34 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 38 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 40 TOLERANCE .0001 EQ 2.350988701644575e-37 +EXPECT results IDX 42 TOLERANCE .0001 EQ 1.1754943508222875e-37 +EXPECT results IDX 44 TOLERANCE .0001 EQ 5.877471754111438e-38 +EXPECT results IDX 46 TOLERANCE .0001 EQ 2.938735877055719e-38 +EXPECT results IDX 48 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 50 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 52 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 54 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 56 TOLERANCE .0001 EQ 3.76158192263132e-37 +EXPECT results IDX 58 TOLERANCE .0001 EQ 1.88079096131566e-37 +EXPECT results IDX 60 TOLERANCE .0001 EQ 9.4039548065783e-38 +EXPECT results IDX 62 TOLERANCE .0001 EQ 4.70197740328915e-38 + diff --git a/vulkan/amber/ldexp/ldexp_float16_t_int16_t.glsl b/vulkan/amber/ldexp/ldexp_float16_t_int16_t.glsl new file mode 100644 index 0000000..ddb4f92 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float16_t_int16_t.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + float16_t significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + int16_t exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + float16_t results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const float16_t s = significands[idx]; + const int16_t e = exponents[idx]; + const float16_t r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_float16_t_int16_t.glsl.spv b/vulkan/amber/ldexp/ldexp_float16_t_int16_t.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..0c5dbe0f9d1cb194eb97e6e6090216f926ace4db GIT binary patch literal 1964 zcmY+E>rNCw5QQ7|rho!+^9JmScMw4VQG|eoEX4hRV2uAJ>+T2>ml?7%7AhSZ65l{={IG2x868t%*RQ4erb6@ZgbfbP&PKGoRaKb$#F9X@e>`AAD>E? zO$l8g1^wXvE>Kj3dc)iP@Xm{mnr*-9`DZ7cprt07-5@zS_LHFHC0|ecST&0O)hLOl zD4w8wrq~5r^RVMJqE@rB8-9^Wf+*Y#+dlD%?Q!okK6)L6ancNvSDmQ!S@-Fl{yDAa zG)$!7E?ZA(Yp5o+{)#FYa}XSc!Ka|r4BL)I`Du)6@p+tUmXFzU;O>)Vz9rr2m)<@* zi9$b2;*71F`4uvnNE);G1v7wC2cApPU2B)M6Jz%M__XtnCH*%1oNgMk_Xbm!scVAl ziXJ8fomi?*N-R%oI%CZD~01Q3uRk@e#k1*^Y-DyMEa(n7q4L z9zJ-$>=&L1;d|1|h1oMZ?E8|<9DX3XM>40Wlh6Li!H=wHGwdBs4)5Tn&_iizvU~oY z@!eoIYloQ$|2G^a&fhVgHXM z+{6DvoD0&N-(n)RD8a{fU^|{CveQ~+yX&XI?4Mf1$YT#n5@PhrcYqzovTVn}9#2hWgq^`hE^&C6D>2v0nrwP;yf0;wv!w~v atUrA(^hPcm>(b=?(rny}(0^2MRq_`h1%!S8 literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_float16_t_int16_t.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_float16_t_int16_t.glsl.spv.spvasm new file mode 100644 index 0000000..6095155 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float16_t_int16_t.glsl.spv.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_half ArrayStride 2 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_short ArrayStride 2 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_half_0 ArrayStride 2 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 +%_ptr_Function_half = OpTypePointer Function %half +%_runtimearr_half = OpTypeRuntimeArray %half +%SignificandBlock = OpTypeStruct %_runtimearr_half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_half = OpTypePointer Uniform %half + %short = OpTypeInt 16 1 +%_ptr_Function_short = OpTypePointer Function %short +%_runtimearr_short = OpTypeRuntimeArray %short +%ExponentsBlock = OpTypeStruct %_runtimearr_short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_short = OpTypePointer Uniform %short +%_runtimearr_half_0 = OpTypeRuntimeArray %half +%ResultsBlock = OpTypeStruct %_runtimearr_half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_half Function + %e = OpVariable %_ptr_Function_short Function + %r = OpVariable %_ptr_Function_half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_half %__0 %int_0 %32 + %35 = OpLoad %half %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_short %__1 %int_0 %43 + %46 = OpLoad %short %45 + OpStore %e %46 + %48 = OpLoad %half %s + %49 = OpLoad %short %e + %50 = OpExtInst %half %1 Ldexp %48 %49 + OpStore %r %50 + %55 = OpLoad %uint %idx + %56 = OpLoad %half %r + %57 = OpAccessChain %_ptr_Uniform_half %__2 %int_0 %55 + OpStore %57 %56 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_float16_t_int32_t.glsl b/vulkan/amber/ldexp/ldexp_float16_t_int32_t.glsl new file mode 100644 index 0000000..aa4d9aa --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float16_t_int32_t.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + float16_t significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + int32_t exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + float16_t results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const float16_t s = significands[idx]; + const int32_t e = exponents[idx]; + const float16_t r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_float16_t_int32_t.glsl.spv b/vulkan/amber/ldexp/ldexp_float16_t_int32_t.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..80c3bc9c9e5c047f0977b5b855f0172575e5e5e8 GIT binary patch literal 1940 zcmY+E>rNCw5QQ7|rho!+^9Jq$UO@x}L=giTvJm$Nf-(M^jJqRDTxQ75VDPPc5Z}j3 zV&eIFre$qXRGq5oQ#Dl$h2EKpF+IkZirLU_&ammV9`wZ=za2KFPdNvB@4YuW``*&( z$1wGhH17C^fpYpy+1{x)4jKzd+FDp%S%mAdDWGg@P&p;py^>=;jPMg3k{_Q+m`w@Y zAO-#4|1MBeg?hu={_xIAj{H{8@q)9HcGy%CekV+ij)OF8dg<4bAW@Cte>F7Ub#Poq>C z?y~h{wuWgE>#wMiF$dvc6n+Yue$;X_%Fkk4OU~n5vwX~)19zV^^DXICzx4LmNgM@H zn&fQd+^>+)M6#I8FPH(GI`CYQ?pV95ofxwpB&Y3vEZMi==XA1|y*HS-OkERXSM)F` zsSCMX?#Oa;nd!u8MK(ULoN19 zE&6n|usN=l!`-!*m8*qKE#4rtz}>a32zP%MbIWR#>}&S0{ED&bUxC!~36nZIazr(f{8;(QA|;hU1heq1hfm?u7R!F&%s zYF(GEO1L|h;~TO$)V?WAE_|cvm-jHP8dK8joSa+I^oMU!G5px{!meFjRW@_MM=xNw z@xfEeZSI1Z8@%)gFMG#^ml=Y|WBzd9gBQ#m9q(*zJ05oG`eUD9cy8x;_}~GvPk1JT z??^KTX3eay?@Bhi@IBc*l6g&;eD+Naeq>dfV9#)J*!xeR`_j~8*Su@K8|-H5@U;B= zpKzEsfA8Rpyr&1U>G7q0!v%J+IobHO)Caqrm+&6gxyyN&`@boNeJ@D3hyRB-A4zk5 zi;38x1Rvjl?Rb`CXSK?9w~vL{H?@e7#~z+Yh|w?K0d^eAvK_~)>=g;Sg@YJ*>~&Q_ z3=ZZ4cKlCeyZMm2CLw1)Ug|%SuruzHOB^2NO3d~0TsFNp-gVjJY-xfu=@$~-3%!vG S2R`zCX*O;~=s&8sCix3G_JgVb literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_float16_t_int32_t.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_float16_t_int32_t.glsl.spv.spvasm new file mode 100644 index 0000000..f18189b --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float16_t_int32_t.glsl.spv.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_half ArrayStride 2 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_half_0 ArrayStride 2 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 +%_ptr_Function_half = OpTypePointer Function %half +%_runtimearr_half = OpTypeRuntimeArray %half +%SignificandBlock = OpTypeStruct %_runtimearr_half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_half = OpTypePointer Uniform %half +%_ptr_Function_int = OpTypePointer Function %int +%_runtimearr_int = OpTypeRuntimeArray %int +%ExponentsBlock = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_runtimearr_half_0 = OpTypeRuntimeArray %half +%ResultsBlock = OpTypeStruct %_runtimearr_half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_half Function + %e = OpVariable %_ptr_Function_int Function + %r = OpVariable %_ptr_Function_half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_half %__0 %int_0 %32 + %35 = OpLoad %half %34 + OpStore %s %35 + %42 = OpLoad %uint %idx + %44 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %42 + %45 = OpLoad %int %44 + OpStore %e %45 + %47 = OpLoad %half %s + %48 = OpLoad %int %e + %49 = OpExtInst %half %1 Ldexp %47 %48 + OpStore %r %49 + %54 = OpLoad %uint %idx + %55 = OpLoad %half %r + %56 = OpAccessChain %_ptr_Uniform_half %__2 %int_0 %54 + OpStore %56 %55 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_float16_t_int64_t.glsl b/vulkan/amber/ldexp/ldexp_float16_t_int64_t.glsl new file mode 100644 index 0000000..ddb4f92 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float16_t_int64_t.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + float16_t significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + int16_t exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + float16_t results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const float16_t s = significands[idx]; + const int16_t e = exponents[idx]; + const float16_t r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_float16_t_int64_t.glsl.spv b/vulkan/amber/ldexp/ldexp_float16_t_int64_t.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..1703b9322d515cd1adc1a486c6bb405d56e51c42 GIT binary patch literal 1964 zcmY+E>rNCw5QUq)DxiSeyrH||9Yjz-6d|A?3vquS7~{XmxI4ncWrpkw2H(mD@qN4` zCZ4ZnTGl2-)v2mJRa4baEKFC8=`+Su&ANVbMohta(C2eJkn6W2#`G(9fA_ujW_!wPlY1s18ug5{68m0egl*LmL zPuMA7j&`DUK)h;u+&xJSU&m3B`ce9-6SqF=KHbwlrxl+> zsWjXb>&a{l)g;zmRV8Eg!-FXN6t?`R?P!#r#kiK7#kpqrm^}yXere`g)-86ib$T2} zL6jyrTP61^WHga1X7h_?5T_127o@w^u4pI5>;=h5=O0VymKqcQLoDR@u&0(429X3^Rl;n?r_s`9>9^ zrz?_CWsOPK#W*gFJ+2-mq-zpRO?Xn8x0d-!ws-mkuPV;B&=bBJve=Kyr4IANM=qG} z!AGsD(lrTpXL5W^Hiz2RrOAbFO#Sj6CRF2wG&?8frZoNGn^FuvHodSTmsgX`T=3Bg z7;b#<)N`A=^v2vaBz+R%%$Yj)slz+KrVcX&lXqLXAi+l+Fnh&E{7!B=9(L^dWxrtZ z?&f*;-~qE=cqWDKNi!E_&+M@8OE!A&1KE9&SxudM_D>FeWLcYG?{IQ>2S0@#N>h{F z^Z$(R2D@21%uM*d;V^Oj{=sW`PcyRVab3UR0=w9(Y^PQWI}Y}^ zEMd2B5F?MhK9dlGgZY3R|B7rkA99~d$QhKE`Y$Bx3_fy+!^2#Oxn5Rf(~IMMDVv;4 cO|WkL*?XZka^YB$ChwPK<7R~Zqlzn%zj#rEsQ>@~ literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_float16_t_int64_t.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_float16_t_int64_t.glsl.spv.spvasm new file mode 100644 index 0000000..4d4e38b --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float16_t_int64_t.glsl.spv.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int64 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_half ArrayStride 2 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_long ArrayStride 8 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_half_0 ArrayStride 2 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 +%_ptr_Function_half = OpTypePointer Function %half +%_runtimearr_half = OpTypeRuntimeArray %half +%SignificandBlock = OpTypeStruct %_runtimearr_half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_half = OpTypePointer Uniform %half + %long = OpTypeInt 64 1 +%_ptr_Function_long = OpTypePointer Function %long +%_runtimearr_long = OpTypeRuntimeArray %long +%ExponentsBlock = OpTypeStruct %_runtimearr_long +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_long = OpTypePointer Uniform %long +%_runtimearr_half_0 = OpTypeRuntimeArray %half +%ResultsBlock = OpTypeStruct %_runtimearr_half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_half Function + %e = OpVariable %_ptr_Function_long Function + %r = OpVariable %_ptr_Function_half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_half %__0 %int_0 %32 + %35 = OpLoad %half %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_long %__1 %int_0 %43 + %46 = OpLoad %long %45 + OpStore %e %46 + %48 = OpLoad %half %s + %49 = OpLoad %long %e + %50 = OpExtInst %half %1 Ldexp %48 %49 + OpStore %r %50 + %55 = OpLoad %uint %idx + %56 = OpLoad %half %r + %57 = OpAccessChain %_ptr_Uniform_half %__2 %int_0 %55 + OpStore %57 %56 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_float16_t_int8_t.glsl b/vulkan/amber/ldexp/ldexp_float16_t_int8_t.glsl new file mode 100644 index 0000000..3543622 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float16_t_int8_t.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + float16_t significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + int8_t exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + float16_t results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const float16_t s = significands[idx]; + const int8_t e = exponents[idx]; + const float16_t r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_float16_t_int8_t.glsl.spv b/vulkan/amber/ldexp/ldexp_float16_t_int8_t.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..00655df78d76a72dea6856e890a9129c9499d8c8 GIT binary patch literal 2000 zcmY+E>rNCw5QQ7|rho!+^M>wa27_2W)3YCyjeriVvC8aBQ3+i{Sn zNAX;bl5mQ`30tSiU9de5+Fm1W`t6b2RKT2P>2VbhOV4o3A^j%&$To@*A5{cynUlZN|} zZuLuVogT+g5T!|uR?g!}88MROY<XlutVzM1B`89VRNoZxbOV4`vv<>$*f6JUU21lVbd$aDq0@9dtFhk`@7&R>s7Mc$~9-$MFWT6 zWjthlH{OVH%ydmMqN-8pnh?jNvB&iNDn%mOMM{H6#;@Hf> zu3cSKHoOpH7JRUYfm6$E?lK#^QQIRS56|==P9NR@Hhtg}pSru!U=pJbK6@rc{$6f7 z9CqyHWxx2;-OuZYfrHO}!I_XhEe$Vl4|muPBpY4+L)kr&S+Pz%`=^FDvaHRpcQ84; zgJ1FHku~&cLIVJUH-5&dsta kn^_$0E7{a+iou$VXYYmCs0Cw9n!4ZO#&LxHtBxy@f8Yv?g8%>k literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_float16_t_int8_t.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_float16_t_int8_t.glsl.spv.spvasm new file mode 100644 index 0000000..55cd5b3 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float16_t_int8_t.glsl.spv.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability Int8 + OpCapability StorageBuffer16BitAccess + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_16bit_storage" + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_half ArrayStride 2 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_char ArrayStride 1 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_half_0 ArrayStride 2 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %half = OpTypeFloat 16 +%_ptr_Function_half = OpTypePointer Function %half +%_runtimearr_half = OpTypeRuntimeArray %half +%SignificandBlock = OpTypeStruct %_runtimearr_half +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_half = OpTypePointer Uniform %half + %char = OpTypeInt 8 1 +%_ptr_Function_char = OpTypePointer Function %char +%_runtimearr_char = OpTypeRuntimeArray %char +%ExponentsBlock = OpTypeStruct %_runtimearr_char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_char = OpTypePointer Uniform %char +%_runtimearr_half_0 = OpTypeRuntimeArray %half +%ResultsBlock = OpTypeStruct %_runtimearr_half_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_half Function + %e = OpVariable %_ptr_Function_char Function + %r = OpVariable %_ptr_Function_half Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_half %__0 %int_0 %32 + %35 = OpLoad %half %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_char %__1 %int_0 %43 + %46 = OpLoad %char %45 + OpStore %e %46 + %48 = OpLoad %half %s + %49 = OpLoad %char %e + %51 = OpExtInst %half %1 Ldexp %48 %49 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %half %r + %58 = OpAccessChain %_ptr_Uniform_half %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_float32_int16.amber b/vulkan/amber/ldexp/ldexp_float32_int16.amber new file mode 100644 index 0000000..7a664f9 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float32_int16.amber @@ -0,0 +1,303 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderInt16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_short ArrayStride 2 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_float_0 ArrayStride 4 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%_runtimearr_float = OpTypeRuntimeArray %float +%SignificandBlock = OpTypeStruct %_runtimearr_float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %short = OpTypeInt 16 1 +%_ptr_Function_short = OpTypePointer Function %short +%_runtimearr_short = OpTypeRuntimeArray %short +%ExponentsBlock = OpTypeStruct %_runtimearr_short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_short = OpTypePointer Uniform %short +%_runtimearr_float_0 = OpTypeRuntimeArray %float +%ResultsBlock = OpTypeStruct %_runtimearr_float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_float Function + %e = OpVariable %_ptr_Function_short Function + %r = OpVariable %_ptr_Function_float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %32 + %35 = OpLoad %float %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_short %__1 %int_0 %43 + %46 = OpLoad %short %45 + OpStore %e %46 + %48 = OpLoad %float %s + %49 = OpLoad %short %e + %51 = OpExtInst %float %1 Ldexp %48 %49 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %float %r + %58 = OpAccessChain %_ptr_Uniform_float %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int16 DATA +1 +0 +-1 +-2 +-14 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-32763 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-32763 +-32764 +-32765 +END + +BUFFER results DATA_TYPE float DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +32 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 16 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 20 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 48 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 52 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 68 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 76 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 80 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 84 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 92 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 96 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 100 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 104 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 108 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 116 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 124 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_float32_int32.amber b/vulkan/amber/ldexp/ldexp_float32_int32.amber new file mode 100644 index 0000000..7d468d4 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float32_int32.amber @@ -0,0 +1,297 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_float_0 ArrayStride 4 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%_runtimearr_float = OpTypeRuntimeArray %float +%SignificandBlock = OpTypeStruct %_runtimearr_float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int +%_runtimearr_int = OpTypeRuntimeArray %int +%ExponentsBlock = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_runtimearr_float_0 = OpTypeRuntimeArray %float +%ResultsBlock = OpTypeStruct %_runtimearr_float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_float Function + %e = OpVariable %_ptr_Function_int Function + %r = OpVariable %_ptr_Function_float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %32 + %35 = OpLoad %float %34 + OpStore %s %35 + %42 = OpLoad %uint %idx + %44 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %42 + %45 = OpLoad %int %44 + OpStore %e %45 + %47 = OpLoad %float %s + %48 = OpLoad %int %e + %49 = OpExtInst %float %1 Ldexp %47 %48 + OpStore %r %49 + %54 = OpLoad %uint %idx + %55 = OpLoad %float %r + %56 = OpAccessChain %_ptr_Uniform_float %__2 %int_0 %54 + OpStore %56 %55 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int32 DATA +1 +0 +-1 +-2 +-14 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-2147483643 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-2147483643 +-2147483644 +-2147483645 +END + +BUFFER results DATA_TYPE float DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +32 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 16 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 20 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 48 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 52 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 68 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 76 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 80 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 84 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 92 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 96 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 100 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 104 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 108 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 116 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 124 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_float32_int64.amber b/vulkan/amber/ldexp/ldexp_float32_int64.amber new file mode 100644 index 0000000..eb54978 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float32_int64.amber @@ -0,0 +1,299 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderInt64 + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_long ArrayStride 8 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_float_0 ArrayStride 4 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%_runtimearr_float = OpTypeRuntimeArray %float +%SignificandBlock = OpTypeStruct %_runtimearr_float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %long = OpTypeInt 64 1 +%_ptr_Function_long = OpTypePointer Function %long +%_runtimearr_long = OpTypeRuntimeArray %long +%ExponentsBlock = OpTypeStruct %_runtimearr_long +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_long = OpTypePointer Uniform %long +%_runtimearr_float_0 = OpTypeRuntimeArray %float +%ResultsBlock = OpTypeStruct %_runtimearr_float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_float Function + %e = OpVariable %_ptr_Function_long Function + %r = OpVariable %_ptr_Function_float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %32 + %35 = OpLoad %float %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_long %__1 %int_0 %43 + %46 = OpLoad %long %45 + OpStore %e %46 + %48 = OpLoad %float %s + %49 = OpLoad %long %e + %51 = OpExtInst %float %1 Ldexp %48 %49 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %float %r + %58 = OpAccessChain %_ptr_Uniform_float %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int64 DATA +1 +0 +-1 +-2 +-14 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-9223372036854775803 +-9223372036854775804 +-9223372036854775805 +END + +BUFFER results DATA_TYPE float DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +32 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 16 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 20 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 28 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 32 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 48 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 52 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 60 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 68 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 76 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 80 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 84 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 92 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 96 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 100 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 104 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 108 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 116 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 124 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_float32_int8.amber b/vulkan/amber/ldexp/ldexp_float32_int8.amber new file mode 100644 index 0000000..a84933d --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float32_int8.amber @@ -0,0 +1,302 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE Float16Int8Features.shaderInt8 +DEVICE_FEATURE Storage8BitFeatures.uniformAndStorageBuffer8BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Int8 + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_char ArrayStride 1 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_float_0 ArrayStride 4 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%_runtimearr_float = OpTypeRuntimeArray %float +%SignificandBlock = OpTypeStruct %_runtimearr_float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %char = OpTypeInt 8 1 +%_ptr_Function_char = OpTypePointer Function %char +%_runtimearr_char = OpTypeRuntimeArray %char +%ExponentsBlock = OpTypeStruct %_runtimearr_char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_char = OpTypePointer Uniform %char +%_runtimearr_float_0 = OpTypeRuntimeArray %float +%ResultsBlock = OpTypeStruct %_runtimearr_float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_float Function + %e = OpVariable %_ptr_Function_char Function + %r = OpVariable %_ptr_Function_float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %32 + %35 = OpLoad %float %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_char %__1 %int_0 %43 + %46 = OpLoad %char %45 + OpStore %e %46 + %48 = OpLoad %float %s + %49 = OpLoad %char %e + %51 = OpExtInst %float %1 Ldexp %48 %49 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %float %r + %58 = OpAccessChain %_ptr_Uniform_float %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE float DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int8 DATA +1 +0 +-1 +-2 +-14 +-123 +-124 +-125 +1 +0 +-1 +-2 +-14 +-123 +-124 +-125 +1 +0 +-1 +-2 +-14 +-123 +-124 +-125 +1 +0 +-1 +-2 +-14 +-123 +-124 +-125 +END + +BUFFER results DATA_TYPE float DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +32 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 4 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 12 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 16 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 20 TOLERANCE .0001 EQ -9.4039548065783e-38 +EXPECT results IDX 24 TOLERANCE .0001 EQ -4.70197740328915e-38 +EXPECT results IDX 28 TOLERANCE .0001 EQ -2.350988701644575e-38 +EXPECT results IDX 32 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 36 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 40 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 44 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 48 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 52 TOLERANCE .0001 EQ 4.70197740328915e-38 +EXPECT results IDX 56 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 60 TOLERANCE .0001 EQ 1.1754943508222875e-38 +EXPECT results IDX 64 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 68 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 76 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 80 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 84 TOLERANCE .0001 EQ 1.1754943508222875e-37 +EXPECT results IDX 88 TOLERANCE .0001 EQ 5.877471754111438e-38 +EXPECT results IDX 92 TOLERANCE .0001 EQ 2.938735877055719e-38 +EXPECT results IDX 96 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 100 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 104 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 108 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 116 TOLERANCE .0001 EQ 1.88079096131566e-37 +EXPECT results IDX 120 TOLERANCE .0001 EQ 9.4039548065783e-38 +EXPECT results IDX 124 TOLERANCE .0001 EQ 4.70197740328915e-38 + diff --git a/vulkan/amber/ldexp/ldexp_float32_t_int16_t.glsl b/vulkan/amber/ldexp/ldexp_float32_t_int16_t.glsl new file mode 100644 index 0000000..bc17a88 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float32_t_int16_t.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + float32_t significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + int16_t exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + float32_t results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const float32_t s = significands[idx]; + const int16_t e = exponents[idx]; + const float32_t r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_float32_t_int16_t.glsl.spv b/vulkan/amber/ldexp/ldexp_float32_t_int16_t.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..c521aa15e9fad4efb97c10b755b9807c973cd808 GIT binary patch literal 1956 zcmY+E>rNCw5QQ7|rho!+^9JmScMw4VQG|eoEX4hRV2uAJF7Ub#Poq>C z?y~h{wuWgE>#wMiF$dvc6n+Yue$;X_%Fkk4OU~n5vwRmZbl~ojX1*oe>X+U=JBgzp zN|T(eock3rnn)J2`2{n8QwN?)(j9A;wG(6ZgXFaRk0tvy{G3h}v-buwm#J%l?1~;H zC3PXU%N<#6E;C*EL$a9-vnQWgl|d~`*FF{VV?NN1@k@l zsC8YsD&g*Ij&I23Q2VAdx$upuU*5yGYD`I2trX3)H2vY5RE)QPO)u;k3|Cc}x!|K0 zFx>cv*K(V?^v2w{+an>)oT-DKI=lmH>M&C^!0mL$aJm+t^Oj%C@7gFUWD z*ex8y$YZb1B*frgK48bcD%;J6+~*Q<2IQsw3kf@ek6hyLFjr!(mo?e+;&@-mCTB|% btXY5dUg(WnIM$`f`=!~q8KM8E;;Q5?k)DKh literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_float32_t_int16_t.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_float32_t_int16_t.glsl.spv.spvasm new file mode 100644 index 0000000..f6a6a51 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float32_t_int16_t.glsl.spv.spvasm @@ -0,0 +1,126 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_short ArrayStride 2 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_float_0 ArrayStride 4 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%_runtimearr_float = OpTypeRuntimeArray %float +%SignificandBlock = OpTypeStruct %_runtimearr_float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %short = OpTypeInt 16 1 +%_ptr_Function_short = OpTypePointer Function %short +%_runtimearr_short = OpTypeRuntimeArray %short +%ExponentsBlock = OpTypeStruct %_runtimearr_short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_short = OpTypePointer Uniform %short +%_runtimearr_float_0 = OpTypeRuntimeArray %float +%ResultsBlock = OpTypeStruct %_runtimearr_float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_float Function + %e = OpVariable %_ptr_Function_short Function + %r = OpVariable %_ptr_Function_float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %32 + %35 = OpLoad %float %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_short %__1 %int_0 %43 + %46 = OpLoad %short %45 + OpStore %e %46 + %48 = OpLoad %float %s + %49 = OpLoad %short %e + %51 = OpExtInst %float %1 Ldexp %48 %49 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %float %r + %58 = OpAccessChain %_ptr_Uniform_float %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_float32_t_int32_t.glsl b/vulkan/amber/ldexp/ldexp_float32_t_int32_t.glsl new file mode 100644 index 0000000..76324ce --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float32_t_int32_t.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + float32_t significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + int32_t exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + float32_t results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const float32_t s = significands[idx]; + const int32_t e = exponents[idx]; + const float32_t r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_float32_t_int32_t.glsl.spv b/vulkan/amber/ldexp/ldexp_float32_t_int32_t.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..d3ca4be8ef2556727ae5c53bcae493febc2e90ca GIT binary patch literal 1896 zcmY+EYflqV5QYzQX;n}_Zr;!q@CxD$5Je1VNFnJ5BYyB()3hsWEL+lD4E`&Bi2uh+ zV&eOp-I4W>VdkBg^Umzdfzsf7#km3JT*YnbH)q@pde5*cdtGnrH(4E)ck3S8p_TK7ME>hpkT7Z-%GG-KZU< z%~n5350An$YB$rb$6=xx!GAS|#1n`o>YOTe&euHXHXFTmtGgF}kxHXpycc&u;uYWH zyOZSbZ7)vJR-C@+_S&CypYG|O)9#(bsWjYW@5yWp$R*xiQ6=a0qk}m56t!D%$7qzF z#kiK7#kuDB&SU7neL*_(c3Bf}Zs+v47l(10sqD zg!_ii?w1^MAWm)UnuKF`E`uKPc8ay=(`wm#td`+oEoNo4u&Koxq!zeX>#}gM7IVvL z4f)v$x-;&;F+=!x%kY7Vd=tX-bX78;tV!vb7^kGMr*vmpx+>vRg=eIBYnearz0)sv zLvg-^p77n2#eOW8I?NLvxnRBrAGNMYS0&tC%<*;E9BSW?CKtX*^~-yhR*jp|RWE_N zB~5?$W)X1q?Sn;(mDC0hl2PxgRhNmC}DeUpP9S<@!i zGn^du{!{3_G&R{Ze?xpX*k)^ZPJaGR7$(l&J9sni>49u|e68Pbfi1Qu8{fA2V7E&W z-UB;bE@C ote2Ov>BV?AWRtV43D%@vNq8^xMlKxq$or+)*o@GBRB>JM7xY(qh5!Hn literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_float32_t_int32_t.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_float32_t_int32_t.glsl.spv.spvasm new file mode 100644 index 0000000..f324692 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float32_t_int32_t.glsl.spv.spvasm @@ -0,0 +1,122 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_float_0 ArrayStride 4 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%_runtimearr_float = OpTypeRuntimeArray %float +%SignificandBlock = OpTypeStruct %_runtimearr_float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int +%_runtimearr_int = OpTypeRuntimeArray %int +%ExponentsBlock = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_runtimearr_float_0 = OpTypeRuntimeArray %float +%ResultsBlock = OpTypeStruct %_runtimearr_float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_float Function + %e = OpVariable %_ptr_Function_int Function + %r = OpVariable %_ptr_Function_float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %32 + %35 = OpLoad %float %34 + OpStore %s %35 + %42 = OpLoad %uint %idx + %44 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %42 + %45 = OpLoad %int %44 + OpStore %e %45 + %47 = OpLoad %float %s + %48 = OpLoad %int %e + %49 = OpExtInst %float %1 Ldexp %47 %48 + OpStore %r %49 + %54 = OpLoad %uint %idx + %55 = OpLoad %float %r + %56 = OpAccessChain %_ptr_Uniform_float %__2 %int_0 %54 + OpStore %56 %55 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_float32_t_int64_t.glsl b/vulkan/amber/ldexp/ldexp_float32_t_int64_t.glsl new file mode 100644 index 0000000..bc17a88 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float32_t_int64_t.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + float32_t significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + int16_t exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + float32_t results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const float32_t s = significands[idx]; + const int16_t e = exponents[idx]; + const float32_t r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_float32_t_int64_t.glsl.spv b/vulkan/amber/ldexp/ldexp_float32_t_int64_t.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..a323ac97377e5e923d3bb42ca8eee3804a0342d6 GIT binary patch literal 1920 zcmY+EYflqV5QYzJX;n}_Zr;FFyo2=yh$5tDNFnJ5BYyB()3hsWEZe5L82nfM5dV*t z#KiYGyCe0GVdkBg^UmzdfqZVMy3j(HBLI!)wL(& zU2=Jpk4-3NRCZ2s+zKQ7L?`9PHzlb_sD$M8ga5lgK^5wa=I+N2&G@L*2?ovJwBHTe zVbW|3!sO^UNWykA`PvU+)hPT|V^ll^@r0dI#m@PfhuvnQ*KT$9qc2iP*o*d~PC&fm zdwh2iAHD5Gang#CH{D+Qv+mP9{d3yAlPHmfyXZZstwFii`%9|i+(CF4g`dK9E9w}H z^3xdC;>9T}V7M_>pt)>2g z@11_Zn~L)-^n`Cw7W=VW>M&1y*vDkpIXGoV-KqmV)V;*fQ@5KwsEk>bqTwLgBW@2^@W5O9Lxu7{2Q`uKIFcXkTWhX z^V(&DX`^|+kYcDJ=J;s00lu$M{temp!e#ub~#rTPi$d6AY%!Y(+ zkdl7ze;4pnq0#iWKD_hO!=N2@{qXd-6SdSu(2cUgqcDqFe)jb^OjX1CuSQuso_M16 zsbc4B&4Z5LOjO)m-L-Z_J27T2Oiw!hSn_Yf&*|nddv7>*nT96FuIOP} z(hzdH+?M6$GSibkBAeMTd-9nF9NY3>b1qA`@9^3El3@untaBnSUu7AZ%mk; zu1Lm|H7;Ejp@RT%fE%$r2clrgdD$cji6TTa=*pJJl4)erEE|~AZ zN3E;UH3@g;3VcmAhuYVr$%SuR{qi0rRpW+q&5CDkO4A>{X~lR8*!04#!En{2nF~I8 z0mF@tc)hT>OK;4L+&&3$=1d*@)ZraqQ-_&?$-6BLCqC+c*)u-kcM99_uw&OR`vsGC zx5&c>514(zGbKDL&0Ls0v%|h8+33OdW%o(uHFfgYKRNi3Wo?GN!^z|s$tjDGnJu;W;g?Ks%u zvV`5jL5w{1`dmT`4(0=P{428Ee8_zvA!kTl>c5n*Gx*3Q4i9rB=6YF`O)rl3m27f0 dHNm>|=kJBy$c1A~n!I0{jhhkrk1DQ6{sI)kgkJyv literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_float32_t_int8_t.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_float32_t_int8_t.glsl.spv.spvasm new file mode 100644 index 0000000..86bcbff --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float32_t_int8_t.glsl.spv.spvasm @@ -0,0 +1,126 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Int8 + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_char ArrayStride 1 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_float_0 ArrayStride 4 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%_runtimearr_float = OpTypeRuntimeArray %float +%SignificandBlock = OpTypeStruct %_runtimearr_float +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %char = OpTypeInt 8 1 +%_ptr_Function_char = OpTypePointer Function %char +%_runtimearr_char = OpTypeRuntimeArray %char +%ExponentsBlock = OpTypeStruct %_runtimearr_char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_char = OpTypePointer Uniform %char +%_runtimearr_float_0 = OpTypeRuntimeArray %float +%ResultsBlock = OpTypeStruct %_runtimearr_float_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_float Function + %e = OpVariable %_ptr_Function_char Function + %r = OpVariable %_ptr_Function_float Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %32 + %35 = OpLoad %float %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_char %__1 %int_0 %43 + %46 = OpLoad %char %45 + OpStore %e %46 + %48 = OpLoad %float %s + %49 = OpLoad %char %e + %51 = OpExtInst %float %1 Ldexp %48 %49 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %float %r + %58 = OpAccessChain %_ptr_Uniform_float %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_float64_int16.amber b/vulkan/amber/ldexp/ldexp_float64_int16.amber new file mode 100644 index 0000000..48e2112 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float64_int16.amber @@ -0,0 +1,305 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderFloat64 +DEVICE_FEATURE shaderInt16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess +DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_double ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_short ArrayStride 2 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_double_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 +%_ptr_Function_double = OpTypePointer Function %double +%_runtimearr_double = OpTypeRuntimeArray %double +%SignificandBlock = OpTypeStruct %_runtimearr_double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_double = OpTypePointer Uniform %double + %short = OpTypeInt 16 1 +%_ptr_Function_short = OpTypePointer Function %short +%_runtimearr_short = OpTypeRuntimeArray %short +%ExponentsBlock = OpTypeStruct %_runtimearr_short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_short = OpTypePointer Uniform %short +%_runtimearr_double_0 = OpTypeRuntimeArray %double +%ResultsBlock = OpTypeStruct %_runtimearr_double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_double Function + %e = OpVariable %_ptr_Function_short Function + %r = OpVariable %_ptr_Function_double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_double %__0 %int_0 %32 + %35 = OpLoad %double %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_short %__1 %int_0 %43 + %46 = OpLoad %short %45 + OpStore %e %46 + %48 = OpLoad %double %s + %49 = OpLoad %short %e + %51 = OpExtInst %double %1 Ldexp %48 %49 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %double %r + %58 = OpAccessChain %_ptr_Uniform_double %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE double DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int16 DATA +1 +0 +-1 +-2 +-14 +-126 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-126 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-126 +-32764 +-32765 +1 +0 +-1 +-2 +-14 +-126 +-32764 +-32765 +END + +BUFFER results DATA_TYPE double DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +32 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 32 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 40 TOLERANCE .0001 EQ -1.1754943508222875e-38 +EXPECT results IDX 48 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 80 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 96 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 104 TOLERANCE .0001 EQ 5.877471754111438e-39 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 128 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 136 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 144 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 152 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 160 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 168 TOLERANCE .0001 EQ 1.4693679385278594e-38 +EXPECT results IDX 176 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 184 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 192 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 200 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 208 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 216 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 224 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 232 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 240 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 248 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_float64_int32.amber b/vulkan/amber/ldexp/ldexp_float64_int32.amber new file mode 100644 index 0000000..2fd5b8a --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float64_int32.amber @@ -0,0 +1,298 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderFloat64 + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_double ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_double_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 +%_ptr_Function_double = OpTypePointer Function %double +%_runtimearr_double = OpTypeRuntimeArray %double +%SignificandBlock = OpTypeStruct %_runtimearr_double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_double = OpTypePointer Uniform %double +%_ptr_Function_int = OpTypePointer Function %int +%_runtimearr_int = OpTypeRuntimeArray %int +%ExponentsBlock = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_runtimearr_double_0 = OpTypeRuntimeArray %double +%ResultsBlock = OpTypeStruct %_runtimearr_double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_double Function + %e = OpVariable %_ptr_Function_int Function + %r = OpVariable %_ptr_Function_double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_double %__0 %int_0 %32 + %35 = OpLoad %double %34 + OpStore %s %35 + %42 = OpLoad %uint %idx + %44 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %42 + %45 = OpLoad %int %44 + OpStore %e %45 + %47 = OpLoad %double %s + %48 = OpLoad %int %e + %49 = OpExtInst %double %1 Ldexp %47 %48 + OpStore %r %49 + %54 = OpLoad %uint %idx + %55 = OpLoad %double %r + %56 = OpAccessChain %_ptr_Uniform_double %__2 %int_0 %54 + OpStore %56 %55 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE double DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int32 DATA +1 +0 +-1 +-2 +-14 +-126 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-126 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-126 +-2147483644 +-2147483645 +1 +0 +-1 +-2 +-14 +-126 +-2147483644 +-2147483645 +END + +BUFFER results DATA_TYPE double DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +32 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 32 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 40 TOLERANCE .0001 EQ -1.1754943508222875e-38 +EXPECT results IDX 48 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 80 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 96 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 104 TOLERANCE .0001 EQ 5.877471754111438e-39 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 128 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 136 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 144 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 152 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 160 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 168 TOLERANCE .0001 EQ 1.4693679385278594e-38 +EXPECT results IDX 176 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 184 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 192 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 200 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 208 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 216 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 224 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 232 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 240 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 248 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_float64_int64.amber b/vulkan/amber/ldexp/ldexp_float64_int64.amber new file mode 100644 index 0000000..1e14022 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float64_int64.amber @@ -0,0 +1,301 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderFloat64 +DEVICE_FEATURE shaderInt64 + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_double ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_long ArrayStride 8 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_double_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 +%_ptr_Function_double = OpTypePointer Function %double +%_runtimearr_double = OpTypeRuntimeArray %double +%SignificandBlock = OpTypeStruct %_runtimearr_double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_double = OpTypePointer Uniform %double + %long = OpTypeInt 64 1 +%_ptr_Function_long = OpTypePointer Function %long +%_runtimearr_long = OpTypeRuntimeArray %long +%ExponentsBlock = OpTypeStruct %_runtimearr_long +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_long = OpTypePointer Uniform %long +%_runtimearr_double_0 = OpTypeRuntimeArray %double +%ResultsBlock = OpTypeStruct %_runtimearr_double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_double Function + %e = OpVariable %_ptr_Function_long Function + %r = OpVariable %_ptr_Function_double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_double %__0 %int_0 %32 + %35 = OpLoad %double %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_long %__1 %int_0 %43 + %46 = OpLoad %long %45 + OpStore %e %46 + %48 = OpLoad %double %s + %49 = OpLoad %long %e + %51 = OpExtInst %double %1 Ldexp %48 %49 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %double %r + %58 = OpAccessChain %_ptr_Uniform_double %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE double DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int64 DATA +1 +0 +-1 +-2 +-14 +-126 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-126 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-126 +-9223372036854775804 +-9223372036854775805 +1 +0 +-1 +-2 +-14 +-126 +-9223372036854775804 +-9223372036854775805 +END + +BUFFER results DATA_TYPE double DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +32 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 32 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 40 TOLERANCE .0001 EQ -1.1754943508222875e-38 +EXPECT results IDX 48 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 56 TOLERANCE .0001 EQ -0.0 +EXPECT results IDX 64 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 80 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 96 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 104 TOLERANCE .0001 EQ 5.877471754111438e-39 +EXPECT results IDX 112 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 120 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 128 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 136 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 144 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 152 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 160 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 168 TOLERANCE .0001 EQ 1.4693679385278594e-38 +EXPECT results IDX 176 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 184 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 192 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 200 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 208 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 216 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 224 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 232 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 240 TOLERANCE .0001 EQ 0.0 +EXPECT results IDX 248 TOLERANCE .0001 EQ 0.0 + diff --git a/vulkan/amber/ldexp/ldexp_float64_int8.amber b/vulkan/amber/ldexp/ldexp_float64_int8.amber new file mode 100644 index 0000000..902f11e --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float64_int8.amber @@ -0,0 +1,304 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderFloat64 +DEVICE_FEATURE Float16Int8Features.shaderInt8 +DEVICE_FEATURE Storage8BitFeatures.uniformAndStorageBuffer8BitAccess + +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int8 + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_double ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_char ArrayStride 1 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_double_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 +%_ptr_Function_double = OpTypePointer Function %double +%_runtimearr_double = OpTypeRuntimeArray %double +%SignificandBlock = OpTypeStruct %_runtimearr_double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_double = OpTypePointer Uniform %double + %char = OpTypeInt 8 1 +%_ptr_Function_char = OpTypePointer Function %char +%_runtimearr_char = OpTypeRuntimeArray %char +%ExponentsBlock = OpTypeStruct %_runtimearr_char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_char = OpTypePointer Uniform %char +%_runtimearr_double_0 = OpTypeRuntimeArray %double +%ResultsBlock = OpTypeStruct %_runtimearr_double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_double Function + %e = OpVariable %_ptr_Function_char Function + %r = OpVariable %_ptr_Function_double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_double %__0 %int_0 %32 + %35 = OpLoad %double %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_char %__1 %int_0 %43 + %46 = OpLoad %char %45 + OpStore %e %46 + %48 = OpLoad %double %s + %49 = OpLoad %char %e + %51 = OpExtInst %double %1 Ldexp %48 %49 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %double %r + %58 = OpAccessChain %_ptr_Uniform_double %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER significands DATA_TYPE double DATA +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +-1.0 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +1.25 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +END + +BUFFER exponents DATA_TYPE int8 DATA +1 +0 +-1 +-2 +-14 +-126 +-124 +-125 +1 +0 +-1 +-2 +-14 +-126 +-124 +-125 +1 +0 +-1 +-2 +-14 +-126 +-124 +-125 +1 +0 +-1 +-2 +-14 +-126 +-124 +-125 +END + +BUFFER results DATA_TYPE double DATA +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +END + +BUFFER pc DATA_TYPE uint32 DATA +32 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +EXPECT results IDX 0 TOLERANCE .0001 EQ -2.0 +EXPECT results IDX 8 TOLERANCE .0001 EQ -1.0 +EXPECT results IDX 16 TOLERANCE .0001 EQ -0.5 +EXPECT results IDX 24 TOLERANCE .0001 EQ -0.25 +EXPECT results IDX 32 TOLERANCE .0001 EQ -6.103515625e-05 +EXPECT results IDX 40 TOLERANCE .0001 EQ -1.1754943508222875e-38 +EXPECT results IDX 48 TOLERANCE .0001 EQ -4.70197740328915e-38 +EXPECT results IDX 56 TOLERANCE .0001 EQ -2.350988701644575e-38 +EXPECT results IDX 64 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 72 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 80 TOLERANCE .0001 EQ 0.25 +EXPECT results IDX 88 TOLERANCE .0001 EQ 0.125 +EXPECT results IDX 96 TOLERANCE .0001 EQ 3.0517578125e-05 +EXPECT results IDX 104 TOLERANCE .0001 EQ 5.877471754111438e-39 +EXPECT results IDX 112 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 120 TOLERANCE .0001 EQ 1.1754943508222875e-38 +EXPECT results IDX 128 TOLERANCE .0001 EQ 2.5 +EXPECT results IDX 136 TOLERANCE .0001 EQ 1.25 +EXPECT results IDX 144 TOLERANCE .0001 EQ 0.625 +EXPECT results IDX 152 TOLERANCE .0001 EQ 0.3125 +EXPECT results IDX 160 TOLERANCE .0001 EQ 7.62939453125e-05 +EXPECT results IDX 168 TOLERANCE .0001 EQ 1.4693679385278594e-38 +EXPECT results IDX 176 TOLERANCE .0001 EQ 5.877471754111438e-38 +EXPECT results IDX 184 TOLERANCE .0001 EQ 2.938735877055719e-38 +EXPECT results IDX 192 TOLERANCE .0001 EQ 4.0 +EXPECT results IDX 200 TOLERANCE .0001 EQ 2.0 +EXPECT results IDX 208 TOLERANCE .0001 EQ 1.0 +EXPECT results IDX 216 TOLERANCE .0001 EQ 0.5 +EXPECT results IDX 224 TOLERANCE .0001 EQ 0.0001220703125 +EXPECT results IDX 232 TOLERANCE .0001 EQ 2.350988701644575e-38 +EXPECT results IDX 240 TOLERANCE .0001 EQ 9.4039548065783e-38 +EXPECT results IDX 248 TOLERANCE .0001 EQ 4.70197740328915e-38 + diff --git a/vulkan/amber/ldexp/ldexp_float64_t_int16_t.glsl b/vulkan/amber/ldexp/ldexp_float64_t_int16_t.glsl new file mode 100644 index 0000000..d385c6d --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float64_t_int16_t.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + float64_t significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + int16_t exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + float64_t results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const float64_t s = significands[idx]; + const int16_t e = exponents[idx]; + const float64_t r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_float64_t_int16_t.glsl.spv b/vulkan/amber/ldexp/ldexp_float64_t_int16_t.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..ad1187d347cbda17c4a6bdce171f2e765f53f1cc GIT binary patch literal 1964 zcmY+E>rNCw5QQ7|rh)=;^9JsUcMw4VQG_fSvJm$Nf-(M^jJqRDTxQ75VDPPc5Z}j3 zV&eIFre$qXRGq5oQ#Dl$h5ng}F@46EirLU_&WP!^9`uDAPvrXTh>@>i_IKZVZ?^Zm z#g&g?>LqF1^$!B&44AUL+i31L=aaNOzqGs{x4C2rC>tA6PDysZ8-g(KP-wwK7aC+PcTWZ4ZhUwu^kcKTU{dycEs!{x}MoBzH z@r3PD#m?E92OX~&xBSjd^hGKS<7g*p2gED3$K8|U@O2y|sUM}UI&tf>?$bT}b6W99 zluE;0ww}z^P)%a}6;(23KRk%SPhrcC+Kxu~S&VDRS)6N@?>vSM-0Xq*mUL@Cdh7H! zj)Evna<+2rSIB50SYu?A!2jx>?NL8_Ha!p$W1p zdYFK$h-;`p!1#Eg@*I@Fh(#!=P zy@27yN4%EX+@&|>#@#*%app`N{M6wcU{i;gg2}rr4JSV8fY~cP;&*b}@vvjpFZ%_P zcQ?<&2M?J2!ZRs+Pnx+fduE4yUsCVE4`laA<}`Kk**`h>kri!*y~D}j9sCq}C{0av z&;K*N8|-H7Ff-x*hQq}9`v|seljDGnJu;W;k?Ks%u ziiF+5L5w{1`bc5b%Gx*3Q4i9rB=6YF^O)rl3rEGFG dHNl$oXYYmH$c1BFn!I0{jhhkrk1DQ8{sIC}gu4I$ literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_float64_t_int16_t.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_float64_t_int16_t.glsl.spv.spvasm new file mode 100644 index 0000000..59a5fc8 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float64_t_int16_t.glsl.spv.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_double ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_short ArrayStride 2 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_double_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 +%_ptr_Function_double = OpTypePointer Function %double +%_runtimearr_double = OpTypeRuntimeArray %double +%SignificandBlock = OpTypeStruct %_runtimearr_double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_double = OpTypePointer Uniform %double + %short = OpTypeInt 16 1 +%_ptr_Function_short = OpTypePointer Function %short +%_runtimearr_short = OpTypeRuntimeArray %short +%ExponentsBlock = OpTypeStruct %_runtimearr_short +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_short = OpTypePointer Uniform %short +%_runtimearr_double_0 = OpTypeRuntimeArray %double +%ResultsBlock = OpTypeStruct %_runtimearr_double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_double Function + %e = OpVariable %_ptr_Function_short Function + %r = OpVariable %_ptr_Function_double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_double %__0 %int_0 %32 + %35 = OpLoad %double %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_short %__1 %int_0 %43 + %46 = OpLoad %short %45 + OpStore %e %46 + %48 = OpLoad %double %s + %49 = OpLoad %short %e + %51 = OpExtInst %double %1 Ldexp %48 %49 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %double %r + %58 = OpAccessChain %_ptr_Uniform_double %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_float64_t_int32_t.glsl b/vulkan/amber/ldexp/ldexp_float64_t_int32_t.glsl new file mode 100644 index 0000000..d671d61 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float64_t_int32_t.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + float64_t significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + int32_t exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + float64_t results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const float64_t s = significands[idx]; + const int32_t e = exponents[idx]; + const float64_t r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_float64_t_int32_t.glsl.spv b/vulkan/amber/ldexp/ldexp_float64_t_int32_t.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..970d3bb1eed63d5d7a3b498de5da6ca963f1647e GIT binary patch literal 1904 zcmY+EYflqV5QY!5v|dm^Zr;Ea@CxD$5JgPUkV4WAM*QHnrfFBYv22^}V(P#0hxmWI zBqqMk*&V5e3^VV{oOfnt4&+9ci_VQW=ZbDuzd2KG)O*kugfF^+$JN?VZ9Ps}>l>So z$-C@wC?A_p&Y0{`$w?!O@DrVsAK#RuBB2tJ(+~dd0(n)a*6RBoKh)!PqZRb)!JyX( zn_*IK^uwfm5+q@>o_y^Ev1;W1t1%{?ym-RaK(TYa=5eQ9>oyym!|01t5_Y4*s1*<| z`X1k%#_hM=C{7wt@}|>me%5`ur+-efdm1Iua2LEMwKXUgdw)@toI47SqwrJMY(y=i zQGOcZT6`Agn&&%@p#wLw4ZK~@1f1I+^tw?HC2_`95F37uCX&Wvb9dZ(Q~Q$azV{cj z6X)Is@oDEDOZsj2IsG)|IVMtWpI~@yXL=DVDrc6HjCI>&V zrA@GBI63V7r_go;6ri>=DWx2HbX z?V5!5z|Jk_Vdnp)9QM5~;U4}U;(R2{`7I`5{PV}hcVHXO6WM94g5T{^VfIZeV&t)h zXA)xc%Xff{V?(xatjOM!uv<8Yk;h)QB*frgK49a2F5Biq?zV)Sae1l#Lc-3tPcCtI rm@6^s<)v(TG2R{7(erYx~BlI6t+?M%K35kL5?Y1$PwmM!Tn2LF{m#Q)v0gPM(MvA!{RB4C+waocFxy4=(U>tPP?}keUVDSezX^L z1L76mGeCGb)W9(pVR4|M2R%qW$#IC4a~*fUr{CJ_QQiH{1kTD zQP*gcpT@WrpT)W6`OahLz|D*UZ*)Rw4(QxdF z3!8IA!hOSM_lu4>5T`bFO~NsJD}^5OcJj68(`wm#td`+?EoNo4u&Koxq!u_|>#}gZ z7IRB$4g1*&x-;&QV}|hYmf-{E`6h+w>8fN>SyR$AF-}WkPwUQ%bXCHs3eQUO)>41T z_fEgy4aNBudcrp^i~U$Gb(kkUa>0BLK5AW)u1dJOnBnWPIn=%(O)h*>>X-L0qZ;$l zbqP5)rRfjfoMOBMYx%C zOx|tjf&?FR!0Z(t@jIDqJnY!|WxrtZ?q+%T-~qEwcxHv~Ni!E_&+M@8OX@lNK=zPi zNmD1E{gZXF2nKQx5xoEa4vhAL8^s{<43IiP%#KKE4Cnc%I2lYnA=3 zp9`~pY7rxkJ*-HG(J$WtHjY)<#=#!fB?HaXjxV9oo}_d;*v!m%k$-Y?C@W`zEuitCcU7R-Fg literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_float64_t_int64_t.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_float64_t_int64_t.glsl.spv.spvasm new file mode 100644 index 0000000..6a490e7 --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float64_t_int64_t.glsl.spv.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_double ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_long ArrayStride 8 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_double_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 +%_ptr_Function_double = OpTypePointer Function %double +%_runtimearr_double = OpTypeRuntimeArray %double +%SignificandBlock = OpTypeStruct %_runtimearr_double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_double = OpTypePointer Uniform %double + %long = OpTypeInt 64 1 +%_ptr_Function_long = OpTypePointer Function %long +%_runtimearr_long = OpTypeRuntimeArray %long +%ExponentsBlock = OpTypeStruct %_runtimearr_long +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_long = OpTypePointer Uniform %long +%_runtimearr_double_0 = OpTypeRuntimeArray %double +%ResultsBlock = OpTypeStruct %_runtimearr_double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_double Function + %e = OpVariable %_ptr_Function_long Function + %r = OpVariable %_ptr_Function_double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_double %__0 %int_0 %32 + %35 = OpLoad %double %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_long %__1 %int_0 %43 + %46 = OpLoad %long %45 + OpStore %e %46 + %48 = OpLoad %double %s + %49 = OpLoad %long %e + %51 = OpExtInst %double %1 Ldexp %48 %49 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %double %r + %58 = OpAccessChain %_ptr_Uniform_double %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/ldexp_float64_t_int8_t.glsl b/vulkan/amber/ldexp/ldexp_float64_t_int8_t.glsl new file mode 100644 index 0000000..e5c1bbe --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float64_t_int8_t.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock { + float64_t significands[]; +}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock { + int8_t exponents[]; +}; +layout (set=0, binding=2, std430) buffer ResultsBlock { + float64_t results[]; +}; + +layout (push_constant, std430) uniform PushConstantBlock { + uint count; +}; + +void main() +{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) { + const float64_t s = significands[idx]; + const int8_t e = exponents[idx]; + const float64_t r = ldexp(s, e); + results[idx] = r; + } +} diff --git a/vulkan/amber/ldexp/ldexp_float64_t_int8_t.glsl.spv b/vulkan/amber/ldexp/ldexp_float64_t_int8_t.glsl.spv new file mode 100644 index 0000000000000000000000000000000000000000..f53ce476ac74916d1bd426fd8a2c963f5e90d5c3 GIT binary patch literal 1964 zcmY+EYflqV5QY!*rh)=;^9Ht}qJnq>L=gfSQi%OPz!<-6)^?>E%P#3|4gM>Ci2uh+ zV&eOp-6QpwVdkBg^Umzdv4z38iZKJmn2OodU(T2rv>x<@9M9+4A2ae*%;Elf@9pk^ zxArkiy(Eph{!zf)Ayc+@>y5+4Qj)fomRBC*zhnw18yithN%o-R*bgK8L`UVvrxIpM zLRUyZ|L}hoD5^re;q82Q=Ot~w6?DDe^rRCu)rH>;)An(YhD|U1dJ-h6QT(q)NjydI zgsoG>&e@tr9j_5L{mx$WMJf&BXfJ97#4EPP{a(_36GutvN9pTM-2ANjbWi`BX55QX zX}HVQli3=oNvyx3O2!<9M^X4GZ2D2l(I`KQaVdFUogypIJL2B5{|>SGH5Yxhg!TF zYSE{wh0Srb9PY2htXwT@YGqtSJIDT7mlf;(F6NfiD%sfznltXAVTSPWmgybb&o?ei zPgf=5%9@a_iE&aIds26%q^lB6Rd`yOx0d;fws-mkuPe^C&=bB{S?tH8gag3pu_nn?vmz(&WN7p?-M}Q>rm5y(J;%rZoNGn^BCnfK4y#8cbeQnz`Vk z7ckuTh}UwPyY$A~$Q_UnXU^2YPaWO?Hg%XOn7rH4aN?s5m_6eoekZpb4?A}KvR^QH zck?`a@POGTJk!GS(#(a~Gdt{ilC3^`U-p1xQBxwU>94Ijc;3huu193pIXGoV-L#`V)V;*fE~w*Y{$VK zS0(Hg4r1i7*XI&qa4;XR<6o2Q=0ola2|2^^Qvaodoxw*gad?<3G1tqwYgroof literal 0 HcmV?d00001 diff --git a/vulkan/amber/ldexp/ldexp_float64_t_int8_t.glsl.spv.spvasm b/vulkan/amber/ldexp/ldexp_float64_t_int8_t.glsl.spv.spvasm new file mode 100644 index 0000000..a9ff23d --- /dev/null +++ b/vulkan/amber/ldexp/ldexp_float64_t_int8_t.glsl.spv.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int8 + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %idx "idx" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %PushConstantBlock "PushConstantBlock" + OpMemberName %PushConstantBlock 0 "count" + OpName %_ "" + OpName %s "s" + OpName %SignificandBlock "SignificandBlock" + OpMemberName %SignificandBlock 0 "significands" + OpName %__0 "" + OpName %e "e" + OpName %ExponentsBlock "ExponentsBlock" + OpMemberName %ExponentsBlock 0 "exponents" + OpName %__1 "" + OpName %r "r" + OpName %ResultsBlock "ResultsBlock" + OpMemberName %ResultsBlock 0 "results" + OpName %__2 "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %PushConstantBlock Block + OpMemberDecorate %PushConstantBlock 0 Offset 0 + OpDecorate %_runtimearr_double ArrayStride 8 + OpDecorate %SignificandBlock BufferBlock + OpMemberDecorate %SignificandBlock 0 NonWritable + OpMemberDecorate %SignificandBlock 0 Offset 0 + OpDecorate %__0 NonWritable + OpDecorate %__0 Binding 0 + OpDecorate %__0 DescriptorSet 0 + OpDecorate %_runtimearr_char ArrayStride 1 + OpDecorate %ExponentsBlock BufferBlock + OpMemberDecorate %ExponentsBlock 0 NonWritable + OpMemberDecorate %ExponentsBlock 0 Offset 0 + OpDecorate %__1 NonWritable + OpDecorate %__1 Binding 1 + OpDecorate %__1 DescriptorSet 0 + OpDecorate %_runtimearr_double_0 ArrayStride 8 + OpDecorate %ResultsBlock BufferBlock + OpMemberDecorate %ResultsBlock 0 Offset 0 + OpDecorate %__2 Binding 2 + OpDecorate %__2 DescriptorSet 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%PushConstantBlock = OpTypeStruct %uint +%_ptr_PushConstant_PushConstantBlock = OpTypePointer PushConstant %PushConstantBlock + %_ = OpVariable %_ptr_PushConstant_PushConstantBlock PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %double = OpTypeFloat 64 +%_ptr_Function_double = OpTypePointer Function %double +%_runtimearr_double = OpTypeRuntimeArray %double +%SignificandBlock = OpTypeStruct %_runtimearr_double +%_ptr_Uniform_SignificandBlock = OpTypePointer Uniform %SignificandBlock + %__0 = OpVariable %_ptr_Uniform_SignificandBlock Uniform +%_ptr_Uniform_double = OpTypePointer Uniform %double + %char = OpTypeInt 8 1 +%_ptr_Function_char = OpTypePointer Function %char +%_runtimearr_char = OpTypeRuntimeArray %char +%ExponentsBlock = OpTypeStruct %_runtimearr_char +%_ptr_Uniform_ExponentsBlock = OpTypePointer Uniform %ExponentsBlock + %__1 = OpVariable %_ptr_Uniform_ExponentsBlock Uniform +%_ptr_Uniform_char = OpTypePointer Uniform %char +%_runtimearr_double_0 = OpTypeRuntimeArray %double +%ResultsBlock = OpTypeStruct %_runtimearr_double_0 +%_ptr_Uniform_ResultsBlock = OpTypePointer Uniform %ResultsBlock + %__2 = OpVariable %_ptr_Uniform_ResultsBlock Uniform + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function + %s = OpVariable %_ptr_Function_double Function + %e = OpVariable %_ptr_Function_char Function + %r = OpVariable %_ptr_Function_double Function + %11 = OpLoad %uint %gl_LocalInvocationIndex + OpStore %idx %11 + %12 = OpLoad %uint %idx + %19 = OpAccessChain %_ptr_PushConstant_uint %_ %int_0 + %20 = OpLoad %uint %19 + %22 = OpULessThan %bool %12 %20 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %32 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Uniform_double %__0 %int_0 %32 + %35 = OpLoad %double %34 + OpStore %s %35 + %43 = OpLoad %uint %idx + %45 = OpAccessChain %_ptr_Uniform_char %__1 %int_0 %43 + %46 = OpLoad %char %45 + OpStore %e %46 + %48 = OpLoad %double %s + %49 = OpLoad %char %e + %51 = OpExtInst %double %1 Ldexp %48 %49 + OpStore %r %51 + %56 = OpLoad %uint %idx + %57 = OpLoad %double %r + %58 = OpAccessChain %_ptr_Uniform_double %__2 %int_0 %56 + OpStore %58 %57 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/vulkan/amber/ldexp/template.amber b/vulkan/amber/ldexp/template.amber new file mode 100644 index 0000000..21e6ef2 --- /dev/null +++ b/vulkan/amber/ldexp/template.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright (c) 2025 The Khronos Group Inc. +# Copyright (c) 2025 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{device_features} + +SHADER compute compute_shader SPIRV-ASM +{spirv_asm} +END + +BUFFER significands DATA_TYPE {amber_float_type} DATA +{significands} +END + +BUFFER exponents DATA_TYPE {amber_int_type} DATA +{exponents} +END + +BUFFER results DATA_TYPE {amber_float_type} DATA +{initial_results} +END + +BUFFER pc DATA_TYPE uint32 DATA +{count} +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER significands AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER exponents AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER pc AS push_constant +END + +RUN pipeline 1 1 1 + +{expects} diff --git a/vulkan/amber/ldexp/template.glsl b/vulkan/amber/ldexp/template.glsl new file mode 100644 index 0000000..300132d --- /dev/null +++ b/vulkan/amber/ldexp/template.glsl @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types : enable + +layout (local_size_x=64, local_size_y=1, local_size_z=1) in; + +layout (set=0, binding=0, std430) readonly buffer SignificandBlock {{ + {significand_type} significands[]; +}}; +layout (set=0, binding=1, std430) readonly buffer ExponentsBlock {{ + {exponent_type} exponents[]; +}}; +layout (set=0, binding=2, std430) buffer ResultsBlock {{ + {significand_type} results[]; +}}; + +layout (push_constant, std430) uniform PushConstantBlock {{ + uint count; +}}; + +void main() +{{ + const uint idx = gl_LocalInvocationIndex; + if (idx < count) {{ + const {significand_type} s = significands[idx]; + const {exponent_type} e = exponents[idx]; + const {significand_type} r = ldexp(s, e); + results[idx] = r; + }} +}} diff --git a/vulkan/amber/memory_model/message_passing/permuted_index/barrier.amber b/vulkan/amber/memory_model/message_passing/permuted_index/barrier.amber new file mode 100644 index 0000000..2c90c24 --- /dev/null +++ b/vulkan/amber/memory_model/message_passing/permuted_index/barrier.amber @@ -0,0 +1,87 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_KHR_memory_scope_semantics: enable + +layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in; + +struct S +{ + uint data; + uint flag; +}; + +layout(set = 0, binding = 0, std430) buffer Buf0 +{ + S arr[]; +} buf; + +layout(set = 0, binding = 1, std430) buffer Buf1 +{ + uint failures; +} bufOut; + +uint permute(uint x) +{ + return (x * 419u) & 0xffff; +} + +void main() +{ + // Message passing using data and flag pairs. The data is written to an index i, but the flag + // used for synchronization is from a different index calculated using permute(i). + + uint i0 = gl_GlobalInvocationID.x; + atomicStore(buf.arr[i0].data, 1u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + + // This barrier makes sure the order of the atomic store above and below does not change. + // This guarantees the data is always written before the flag. + memoryBarrierBuffer(); + + atomicStore(buf.arr[permute(i0)].flag, 1u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + + // Read from an index which is presumably written by a different workgroup. + uint i1 = (i0 * 4099u) & 0xffff; + uint flag = atomicLoad(buf.arr[permute(i1)].flag, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + + // This barrier makes sure the atomic loads keep their execution order. That is, the flag is always read first. + memoryBarrierBuffer(); + + uint data = atomicLoad(buf.arr[i1].data, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + + // The flag should never be written before data. + if (flag > data) + { + atomicAdd(bufOut.failures, 1u); + } +} +END + +BUFFER buf0 DATA_TYPE uint32 SIZE 131072 FILL 0 +BUFFER buf1 DATA_TYPE uint32 SIZE 1 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER buf0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER buf1 AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 256 1 1 + +EXPECT buf1 IDX 0 EQ 0 diff --git a/vulkan/amber/memory_model/message_passing/permuted_index/release_acquire.amber b/vulkan/amber/memory_model/message_passing/permuted_index/release_acquire.amber new file mode 100644 index 0000000..e854b3d --- /dev/null +++ b/vulkan/amber/memory_model/message_passing/permuted_index/release_acquire.amber @@ -0,0 +1,78 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_KHR_memory_scope_semantics: enable + +layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in; + +struct S +{ + uint data; + uint flag; +}; + +layout(set = 0, binding = 0, std430) buffer Buf0 +{ + S arr[]; +} buf; + +layout(set = 0, binding = 1, std430) buffer Buf1 +{ + uint failures; +} bufOut; + +uint permute(uint x) +{ + return (x * 419u) & 0xffff; +} + +void main() +{ + // Message passing using data and flag pairs. The data is written to an index i, but the flag + // used for synchronization is from a different index calculated using permute(i). + + uint i0 = gl_GlobalInvocationID.x; + atomicStore(buf.arr[i0].data, 1u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + atomicStore(buf.arr[permute(i0)].flag, 1u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + + // Read from an index which is presumably written by a different workgroup. + uint i1 = (i0 * 4099u) & 0xffff; + uint flag = atomicLoad(buf.arr[permute(i1)].flag, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + uint data = atomicLoad(buf.arr[i1].data, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + + // The flag should never be written before data. + if (flag > data) + { + atomicAdd(bufOut.failures, 1u); + } +} +END + +BUFFER buf0 DATA_TYPE uint32 SIZE 131072 FILL 0 +BUFFER buf1 DATA_TYPE uint32 SIZE 1 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER buf0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER buf1 AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 256 1 1 + +EXPECT buf1 IDX 0 EQ 0 diff --git a/vulkan/amber/memory_model/message_passing/permuted_index/release_acquire_atomic_payload.amber b/vulkan/amber/memory_model/message_passing/permuted_index/release_acquire_atomic_payload.amber new file mode 100644 index 0000000..77fb54d --- /dev/null +++ b/vulkan/amber/memory_model/message_passing/permuted_index/release_acquire_atomic_payload.amber @@ -0,0 +1,78 @@ +#!amber + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER compute compute_shader GLSL +#version 450 +#extension GL_KHR_memory_scope_semantics: enable + +layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in; + +struct S +{ + uint data; + uint flag; +}; + +layout(set = 0, binding = 0, std430) buffer Buf0 +{ + coherent S arr[]; +} buf; + +layout(set = 0, binding = 1, std430) buffer Buf1 +{ + uint failures; +} bufOut; + +uint permute(uint x) +{ + return (x * 419u) & 0xffff; +} + +void main() +{ + // Message passing using data and flag pairs. The data is written to an index i, but the flag + // used for synchronization is from a different index calculated using permute(i). + + uint i0 = gl_GlobalInvocationID.x; + buf.arr[i0].data = 1u; + atomicStore(buf.arr[permute(i0)].flag, 1u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + + // Read from an index which is presumably written by a different workgroup. + uint i1 = (i0 * 4099u) & 0xffff; + uint flag = atomicLoad(buf.arr[permute(i1)].flag, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + uint data = buf.arr[i1].data; + + // The flag should never be written before data. + if (flag > data) + { + atomicAdd(bufOut.failures, 1u); + } +} +END + +BUFFER buf0 DATA_TYPE uint32 SIZE 131072 FILL 0 +BUFFER buf1 DATA_TYPE uint32 SIZE 1 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER buf0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER buf1 AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 256 1 1 + +EXPECT buf1 IDX 0 EQ 0 diff --git a/vulkan/amber/non_robust_buffer_access/unexecuted_oob_overflow.amber b/vulkan/amber/non_robust_buffer_access/unexecuted_oob_overflow.amber new file mode 100644 index 0000000..8ed89cc --- /dev/null +++ b/vulkan/amber/non_robust_buffer_access/unexecuted_oob_overflow.amber @@ -0,0 +1,105 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Overview of the test: +# data_out array composed of values read from two input arrays of half +# it's size, executed in 4 work groups, result equal to: +# data_out[2 * i ] = data_in0[i] +# data_out[2 * i + 1] = data_in1[i] +# +# data_in2 is used for condition and condition_index increment to avoid +# optimizing away the loop: +# data_in2 = (cond0, inc0, cond1, inc1, ... condN, incN) +# +# Each iteration of the for-loop uses alternating (if-else) path while +# still always accessing and modifying the same index value (but +# swapping between used index variables), equivalent to: +# if (i % 2 == 0) +# data_out[base + index_out--] = data_in0[base + index_in ] +# else +# data_out[base + index_out--] = data_in1[base + index_in--] +# +# The unexecuted if-else path accesses out of bounds or overlapping +# with valid result indices. +SHADER compute test_overflow GLSL +#version 430 + +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; +layout(set = 0, binding = 0) readonly buffer In0 { int data_in0[512]; }; +layout(set = 0, binding = 1) readonly buffer In1 { int data_in1[512]; }; +layout(set = 0, binding = 2) readonly buffer In2 { int data_in2[8]; }; +layout(set = 0, binding = 3) writeonly buffer Out0 { int data_out0[1024]; }; + +void main() +{ + uint base_index_in = 128 * gl_WorkGroupID.x; + uint base_index_out = 256 * gl_WorkGroupID.x; + int index_in0 = 127; + int index_in1 = 383; + int index_out0 = 255; + int index_out1 = 383; + int condition_index = 0; + for(int i = 0; i < 256; ++i) + { + if (data_in2[condition_index] == 0) + { + data_out0[base_index_out + index_out0] = data_in1[base_index_in + index_in0]; + --index_out0; + --index_in1; + } + else + { + data_out0[base_index_out + index_out1] = data_in0[base_index_in + index_in1]; + --index_out1; + --index_in1; + } + condition_index += data_in2[condition_index + 1]; + int temp0 = index_in0; + index_in0 = index_in1; + index_in1 = temp0; + int temp1 = index_out0; + index_out0 = index_out1; + index_out1 = temp1; + } +} +END + +BUFFER data_in0 DATA_TYPE int32 SIZE 512 SERIES_FROM 0 INC_BY 2 +BUFFER data_in1 DATA_TYPE int32 SIZE 512 SERIES_FROM 1 INC_BY 2 +BUFFER data_in2 DATA_TYPE int32 DATA + 0 + 2 + 1 + 2 + 0 + 2 + 1 + -6 +END +BUFFER data_out DATA_TYPE int32 SIZE 1024 FILL -1 + +BUFFER expected DATA_TYPE int32 SIZE 1024 SERIES_FROM 0 INC_BY 1 + +PIPELINE compute pipeline + ATTACH test_overflow + BIND BUFFER data_in0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data_in1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data_in2 AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER data_out AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN pipeline 4 1 1 + +EXPECT data_out EQ_BUFFER expected diff --git a/vulkan/amber/non_robust_buffer_access/unexecuted_oob_underflow.amber b/vulkan/amber/non_robust_buffer_access/unexecuted_oob_underflow.amber new file mode 100644 index 0000000..dc82127 --- /dev/null +++ b/vulkan/amber/non_robust_buffer_access/unexecuted_oob_underflow.amber @@ -0,0 +1,105 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Overview of the test: +# data_out array composed of values read from two input arrays of half +# it's size, executed in 4 work groups, result equal to: +# data_out[2 * i ] = data_in0[i] +# data_out[2 * i + 1] = data_in1[i] +# +# data_in2 is used for condition and condition_index increment to avoid +# optimizing away the loop: +# data_in2 = (cond0, inc0, cond1, inc1, ... condN, incN) +# +# Each iteration of the for-loop uses alternating (if-else) path while +# still always accessing and modifying the same index value (but +# swapping between used index variables), equivalent to: +# if (i % 2 == 0) +# data_out[base + index_out++] = data_in0[base + index_in ] +# else +# data_out[base + index_out++] = data_in1[base + index_in++] +# +# The unexecuted if-else path accesses out of bounds or overlapping +# with valid result indices. +SHADER compute test_underflow GLSL +#version 430 + +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; +layout(set = 0, binding = 0) readonly buffer In0 { int data_in0[512]; }; +layout(set = 0, binding = 1) readonly buffer In1 { int data_in1[512]; }; +layout(set = 0, binding = 2) readonly buffer In2 { int data_in2[8]; }; +layout(set = 0, binding = 3) writeonly buffer Out0 { int data_out0[1024]; }; + +void main() +{ + uint base_index_in = 128 * gl_WorkGroupID.x; + uint base_index_out = 256 * gl_WorkGroupID.x; + int index_in0 = 0; + int index_in1 = -128; + int index_out0 = 0; + int index_out1 = -128; + int condition_index = 0; + for(int i = 0; i < 256; ++i) + { + if (data_in2[condition_index] == 0) + { + data_out0[base_index_out + index_out0] = data_in0[base_index_in + index_in0]; + ++index_out0; + ++index_in1; + } + else + { + data_out0[base_index_out + index_out1] = data_in1[base_index_in + index_in1]; + ++index_out1; + ++index_in1; + } + condition_index += data_in2[condition_index + 1]; + int temp0 = index_in0; + index_in0 = index_in1; + index_in1 = temp0; + int temp1 = index_out0; + index_out0 = index_out1; + index_out1 = temp1; + } +} +END + +BUFFER data_in0 DATA_TYPE int32 SIZE 512 SERIES_FROM 0 INC_BY 2 +BUFFER data_in1 DATA_TYPE int32 SIZE 512 SERIES_FROM 1 INC_BY 2 +BUFFER data_in2 DATA_TYPE int32 DATA + 0 + 2 + 1 + 2 + 0 + 2 + 1 + -6 +END +BUFFER data_out DATA_TYPE int32 SIZE 1024 FILL -1 + +BUFFER expected DATA_TYPE int32 SIZE 1024 SERIES_FROM 0 INC_BY 1 + +PIPELINE compute pipeline + ATTACH test_underflow + BIND BUFFER data_in0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data_in1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data_in2 AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER data_out AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN pipeline 4 1 1 + +EXPECT data_out EQ_BUFFER expected diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_uint16.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_uint16.amber new file mode 100644 index 0000000..e80767a --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_uint16.amber @@ -0,0 +1,94 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_EXT_primitive_topology_list_restart + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[65536]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[65535] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 65536 FILL 0.0 + +BUFFER indices DATA_TYPE uint16 DATA +0 1 1 65535 65535 2 2 0 +END + +BUFFER indices_ref DATA_TYPE uint16 DATA +0 1 1 3 3 2 2 0 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS LINE_LIST INDEXED START_IDX 0 COUNT 8 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS LINE_LIST INDEXED START_IDX 0 COUNT 8 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_uint8.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_uint8.amber new file mode 100644 index 0000000..8ed2513 --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_uint8.amber @@ -0,0 +1,95 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE IndexTypeUint8Features.indexTypeUint8 +DEVICE_EXTENSION VK_EXT_primitive_topology_list_restart + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[256]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[255] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 256 FILL 0.0 + +BUFFER indices DATA_TYPE uint8 DATA +0 1 1 255 255 2 2 0 +END + +BUFFER indices_ref DATA_TYPE uint8 DATA +0 1 1 3 3 2 2 0 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS LINE_LIST INDEXED START_IDX 0 COUNT 8 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS LINE_LIST INDEXED START_IDX 0 COUNT 8 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_with_adjacency_uint16.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_with_adjacency_uint16.amber new file mode 100644 index 0000000..b398319 --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_with_adjacency_uint16.amber @@ -0,0 +1,113 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_EXT_primitive_topology_list_restart + +DEVICE_FEATURE geometryShader + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[65536]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[65535] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +SHADER geometry geom_shader GLSL +#version 430 +layout(lines_adjacency) in; +layout(line_strip, max_vertices = 2) out; + +void main (void) +{ + for (int i = 1; i < 3; i++) + { + gl_Position = gl_in[i].gl_Position; + EmitVertex(); + } + EndPrimitive(); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 65536 FILL 0.0 + +BUFFER indices DATA_TYPE uint16 DATA +65535 0 1 65535 65535 1 65535 65535 65535 65535 2 65535 65535 2 0 65535 +END + +BUFFER indices_ref DATA_TYPE uint16 DATA +3 0 1 3 3 1 3 3 3 3 2 3 3 2 0 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + ATTACH geom_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS LINE_LIST_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 16 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS LINE_LIST_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 16 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_with_adjacency_uint8.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_with_adjacency_uint8.amber new file mode 100644 index 0000000..ed79428 --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_list_with_adjacency_uint8.amber @@ -0,0 +1,114 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE IndexTypeUint8Features.indexTypeUint8 +DEVICE_EXTENSION VK_EXT_primitive_topology_list_restart + +DEVICE_FEATURE geometryShader + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[256]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[255] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +SHADER geometry geom_shader GLSL +#version 430 +layout(lines_adjacency) in; +layout(line_strip, max_vertices = 2) out; + +void main (void) +{ + for (int i = 1; i < 3; i++) + { + gl_Position = gl_in[i].gl_Position; + EmitVertex(); + } + EndPrimitive(); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 256 FILL 0.0 + +BUFFER indices DATA_TYPE uint8 DATA +255 0 1 255 255 1 255 255 255 255 2 255 255 2 0 255 +END + +BUFFER indices_ref DATA_TYPE uint8 DATA +3 0 1 3 3 1 3 3 3 3 2 3 3 2 0 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + ATTACH geom_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS LINE_LIST_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 16 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS LINE_LIST_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 16 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_uint16.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_uint16.amber new file mode 100644 index 0000000..72b8bce --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_uint16.amber @@ -0,0 +1,92 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[65536]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[65535] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 65536 FILL 0.0 + +BUFFER indices DATA_TYPE uint16 DATA +0 1 65535 2 0 +END + +BUFFER indices_ref DATA_TYPE uint16 DATA +0 1 3 2 0 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS LINE_STRIP INDEXED START_IDX 0 COUNT 5 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS LINE_STRIP INDEXED START_IDX 0 COUNT 5 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_uint8.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_uint8.amber new file mode 100644 index 0000000..e718ef0 --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_uint8.amber @@ -0,0 +1,94 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE IndexTypeUint8Features.indexTypeUint8 + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[256]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[255] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 256 FILL 0.0 + +BUFFER indices DATA_TYPE uint8 DATA +0 1 255 2 0 +END + +BUFFER indices_ref DATA_TYPE uint8 DATA +0 1 3 2 0 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS LINE_STRIP INDEXED START_IDX 0 COUNT 5 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS LINE_STRIP INDEXED START_IDX 0 COUNT 5 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_with_adjacency_uint16.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_with_adjacency_uint16.amber new file mode 100644 index 0000000..567c5db --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_with_adjacency_uint16.amber @@ -0,0 +1,111 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE geometryShader + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[65536]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[65535] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +SHADER geometry geom_shader GLSL +#version 430 +layout(lines_adjacency) in; +layout(line_strip, max_vertices = 2) out; + +void main (void) +{ + for (int i = 1; i < 3; i++) + { + gl_Position = gl_in[i].gl_Position; + EmitVertex(); + } + EndPrimitive(); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 65536 FILL 0.0 + +BUFFER indices DATA_TYPE uint16 DATA +65535 0 1 65535 2 0 65535 +END + +BUFFER indices_ref DATA_TYPE uint16 DATA +3 0 1 3 2 0 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + ATTACH geom_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS LINE_STRIP_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 7 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS LINE_STRIP_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 7 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_with_adjacency_uint8.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_with_adjacency_uint8.amber new file mode 100644 index 0000000..e7fd171 --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_line_strip_with_adjacency_uint8.amber @@ -0,0 +1,113 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE IndexTypeUint8Features.indexTypeUint8 + +DEVICE_FEATURE geometryShader + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[256]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[255] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +SHADER geometry geom_shader GLSL +#version 430 +layout(lines_adjacency) in; +layout(line_strip, max_vertices = 2) out; + +void main (void) +{ + for (int i = 1; i < 3; i++) + { + gl_Position = gl_in[i].gl_Position; + EmitVertex(); + } + EndPrimitive(); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 256 FILL 0.0 + +BUFFER indices DATA_TYPE uint8 DATA +255 0 1 255 2 0 255 +END + +BUFFER indices_ref DATA_TYPE uint8 DATA +3 0 1 3 2 0 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + ATTACH geom_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS LINE_STRIP_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 7 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS LINE_STRIP_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 7 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_patch_list_uint16.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_patch_list_uint16.amber new file mode 100644 index 0000000..2bccd40 --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_patch_list_uint16.amber @@ -0,0 +1,132 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_EXT_primitive_topology_list_restart + +DEVICE_FEATURE tessellationShader + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[65536]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[65535] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +SHADER tessellation_control tcs_shader GLSL +#version 430 +layout(vertices = 4) out; + +void main (void) +{ + if (gl_InvocationID == 0) + { + gl_TessLevelInner[0] = 2.0f; + gl_TessLevelInner[1] = 2.0f; + gl_TessLevelOuter[0] = 2.0f; + gl_TessLevelOuter[1] = 2.0f; + gl_TessLevelOuter[2] = 2.0f; + gl_TessLevelOuter[3] = 2.0f; + } + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +} +END + +SHADER tessellation_evaluation tes_shader GLSL +#version 430 +layout(quads, equal_spacing, ccw) in; +void main (void) +{ + const float u = gl_TessCoord.x; + const float v = gl_TessCoord.y; + gl_Position = (1 - u) * (1 - v) * gl_in[0].gl_Position + (1 - u) * v * gl_in[1].gl_Position + u * (1 - v) * gl_in[2].gl_Position + u * v * gl_in[3].gl_Position; +} +END + +BUFFER position DATA_TYPE vec4 SIZE 65536 FILL 0.0 + +BUFFER indices DATA_TYPE uint16 DATA +0 1 65535 2 +END + +BUFFER indices_ref DATA_TYPE uint16 DATA +0 1 3 2 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + ATTACH tcs_shader + ATTACH tes_shader + PATCH_CONTROL_POINTS 4 + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + ATTACH tcs_shader + ATTACH tes_shader + PATCH_CONTROL_POINTS 4 + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS PATCH_LIST INDEXED START_IDX 0 COUNT 4 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS PATCH_LIST INDEXED START_IDX 0 COUNT 4 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_patch_list_uint8.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_patch_list_uint8.amber new file mode 100644 index 0000000..057fb45 --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_patch_list_uint8.amber @@ -0,0 +1,136 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE IndexTypeUint8Features.indexTypeUint8 +DEVICE_EXTENSION VK_EXT_primitive_topology_list_restart + +DEVICE_FEATURE tessellationShader + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[256]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[255] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +SHADER tessellation_control tcs_shader GLSL +#version 430 +layout(vertices = 4) out; + +void main (void) +{ + if (gl_InvocationID == 0) + { + gl_TessLevelInner[0] = 2.0f; + gl_TessLevelInner[1] = 2.0f; + gl_TessLevelOuter[0] = 2.0f; + gl_TessLevelOuter[1] = 2.0f; + gl_TessLevelOuter[2] = 2.0f; + gl_TessLevelOuter[3] = 2.0f; + } + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +} +END + +SHADER tessellation_evaluation tes_shader GLSL +#version 430 +layout(quads, equal_spacing, ccw) in; +void main (void) +{ + const float u = gl_TessCoord.x; + const float v = gl_TessCoord.y; + gl_Position = (1 - u) * (1 - v) * gl_in[0].gl_Position + (1 - u) * v * gl_in[1].gl_Position + u * (1 - v) * gl_in[2].gl_Position + u * v * gl_in[3].gl_Position; +} +END + +BUFFER position DATA_TYPE vec4 SIZE 256 FILL 0.0 + +BUFFER indices DATA_TYPE uint8 DATA +0 1 255 2 +END + +BUFFER indices_ref DATA_TYPE uint8 DATA +0 1 3 2 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + ATTACH tcs_shader + + ATTACH tes_shader + + PATCH_CONTROL_POINTS 4 + + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + ATTACH tcs_shader + ATTACH tes_shader + PATCH_CONTROL_POINTS 4 + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS PATCH_LIST INDEXED START_IDX 0 COUNT 4 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS PATCH_LIST INDEXED START_IDX 0 COUNT 4 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_point_list_uint16.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_point_list_uint16.amber new file mode 100644 index 0000000..3a9052f --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_point_list_uint16.amber @@ -0,0 +1,102 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_EXT_primitive_topology_list_restart + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[65536]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[65535] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec4 position; +void main() +{ + gl_Position = position; + gl_PointSize = 1.0; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 65536 FILL 0.0 + +BUFFER indices DATA_TYPE uint16 DATA +0 1 2 65535 +END + +BUFFER indices_ref DATA_TYPE uint16 DATA +0 1 2 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS POINT_LIST INDEXED START_IDX 0 COUNT 4 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS POINT_LIST INDEXED START_IDX 0 COUNT 4 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_point_list_uint8.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_point_list_uint8.amber new file mode 100644 index 0000000..6ff5f1c --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_point_list_uint8.amber @@ -0,0 +1,103 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE IndexTypeUint8Features.indexTypeUint8 +DEVICE_EXTENSION VK_EXT_primitive_topology_list_restart + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[256]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[255] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader GLSL +#version 430 +layout(location = 0) in vec4 position; +void main() +{ + gl_Position = position; + gl_PointSize = 1.0; +} +END + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 256 FILL 0.0 + +BUFFER indices DATA_TYPE uint8 DATA +0 1 2 255 +END + +BUFFER indices_ref DATA_TYPE uint8 DATA +0 1 2 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS POINT_LIST INDEXED START_IDX 0 COUNT 4 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS POINT_LIST INDEXED START_IDX 0 COUNT 4 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_fan_uint16.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_fan_uint16.amber new file mode 100644 index 0000000..3e0380f --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_fan_uint16.amber @@ -0,0 +1,92 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[65536]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[65535] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 65536 FILL 0.0 + +BUFFER indices DATA_TYPE uint16 DATA +0 1 2 65535 +END + +BUFFER indices_ref DATA_TYPE uint16 DATA +0 1 2 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS TRIANGLE_FAN INDEXED START_IDX 0 COUNT 4 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS TRIANGLE_FAN INDEXED START_IDX 0 COUNT 4 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_fan_uint8.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_fan_uint8.amber new file mode 100644 index 0000000..933f459 --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_fan_uint8.amber @@ -0,0 +1,94 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE IndexTypeUint8Features.indexTypeUint8 + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[256]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[255] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 256 FILL 0.0 + +BUFFER indices DATA_TYPE uint8 DATA +0 1 2 255 +END + +BUFFER indices_ref DATA_TYPE uint8 DATA +0 1 2 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS TRIANGLE_FAN INDEXED START_IDX 0 COUNT 4 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS TRIANGLE_FAN INDEXED START_IDX 0 COUNT 4 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_uint16.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_uint16.amber new file mode 100644 index 0000000..b26ebf3 --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_uint16.amber @@ -0,0 +1,94 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_EXT_primitive_topology_list_restart + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[65536]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[65535] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 65536 FILL 0.0 + +BUFFER indices DATA_TYPE uint16 DATA +0 1 2 0 2 65535 +END + +BUFFER indices_ref DATA_TYPE uint16 DATA +0 1 2 0 2 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS TRIANGLE_LIST INDEXED START_IDX 0 COUNT 6 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS TRIANGLE_LIST INDEXED START_IDX 0 COUNT 6 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_uint8.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_uint8.amber new file mode 100644 index 0000000..383a330 --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_uint8.amber @@ -0,0 +1,95 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE IndexTypeUint8Features.indexTypeUint8 +DEVICE_EXTENSION VK_EXT_primitive_topology_list_restart + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[256]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[255] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 256 FILL 0.0 + +BUFFER indices DATA_TYPE uint8 DATA +0 1 2 0 2 255 +END + +BUFFER indices_ref DATA_TYPE uint8 DATA +0 1 2 0 2 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS TRIANGLE_LIST INDEXED START_IDX 0 COUNT 6 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS TRIANGLE_LIST INDEXED START_IDX 0 COUNT 6 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_with_adjacency_uint16.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_with_adjacency_uint16.amber new file mode 100644 index 0000000..a6d0a0c --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_with_adjacency_uint16.amber @@ -0,0 +1,113 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_EXT_primitive_topology_list_restart + +DEVICE_FEATURE geometryShader + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[65536]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[65535] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +SHADER geometry geom_shader GLSL +#version 430 +layout(triangles_adjacency) in; +layout(triangle_strip, max_vertices = 3) out; + +void main (void) +{ + for (int i = 0; i < 6; i += 2) + { + gl_Position = gl_in[i].gl_Position; + EmitVertex(); + } + EndPrimitive(); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 65536 FILL 0.0 + +BUFFER indices DATA_TYPE uint16 DATA +0 65535 1 65535 2 65535 0 65535 2 65535 65535 65535 +END + +BUFFER indices_ref DATA_TYPE uint16 DATA +0 3 1 3 2 3 0 3 2 3 3 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + ATTACH geom_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS TRIANGLE_LIST_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 12 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS TRIANGLE_LIST_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 12 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_with_adjacency_uint8.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_with_adjacency_uint8.amber new file mode 100644 index 0000000..df701e8 --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_list_with_adjacency_uint8.amber @@ -0,0 +1,114 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE IndexTypeUint8Features.indexTypeUint8 +DEVICE_EXTENSION VK_EXT_primitive_topology_list_restart + +DEVICE_FEATURE geometryShader + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[256]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[255] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +SHADER geometry geom_shader GLSL +#version 430 +layout(triangles_adjacency) in; +layout(triangle_strip, max_vertices = 3) out; + +void main (void) +{ + for (int i = 0; i < 6; i += 2) + { + gl_Position = gl_in[i].gl_Position; + EmitVertex(); + } + EndPrimitive(); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 256 FILL 0.0 + +BUFFER indices DATA_TYPE uint8 DATA +0 255 1 255 2 255 0 255 2 255 255 255 +END + +BUFFER indices_ref DATA_TYPE uint8 DATA +0 3 1 3 2 3 0 3 2 3 3 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + ATTACH geom_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS TRIANGLE_LIST_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 12 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS TRIANGLE_LIST_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 12 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_uint16.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_uint16.amber new file mode 100644 index 0000000..6f6c5dc --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_uint16.amber @@ -0,0 +1,92 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[65536]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[65535] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 65536 FILL 0.0 + +BUFFER indices DATA_TYPE uint16 DATA +1 0 2 65535 +END + +BUFFER indices_ref DATA_TYPE uint16 DATA +1 0 2 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS TRIANGLE_STRIP INDEXED START_IDX 0 COUNT 4 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS TRIANGLE_STRIP INDEXED START_IDX 0 COUNT 4 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_uint8.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_uint8.amber new file mode 100644 index 0000000..30cb60c --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_uint8.amber @@ -0,0 +1,94 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE IndexTypeUint8Features.indexTypeUint8 + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[256]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[255] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 256 FILL 0.0 + +BUFFER indices DATA_TYPE uint8 DATA +1 0 2 255 +END + +BUFFER indices_ref DATA_TYPE uint8 DATA +1 0 2 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS TRIANGLE_STRIP INDEXED START_IDX 0 COUNT 4 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS TRIANGLE_STRIP INDEXED START_IDX 0 COUNT 4 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_with_adjacency_uint16.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_with_adjacency_uint16.amber new file mode 100644 index 0000000..fe5a41c --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_with_adjacency_uint16.amber @@ -0,0 +1,111 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE geometryShader + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[65536]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[65535] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +SHADER geometry geom_shader GLSL +#version 430 +layout(triangles_adjacency) in; +layout(triangle_strip, max_vertices = 3) out; + +void main (void) +{ + for (int i = 0; i < 6; i += 2) + { + gl_Position = gl_in[i].gl_Position; + EmitVertex(); + } + EndPrimitive(); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 65536 FILL 0.0 + +BUFFER indices DATA_TYPE uint16 DATA +1 65535 0 65535 2 65535 65535 65535 +END + +BUFFER indices_ref DATA_TYPE uint16 DATA +1 3 0 3 2 3 3 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + ATTACH geom_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS TRIANGLE_STRIP_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 8 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS TRIANGLE_STRIP_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 8 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_with_adjacency_uint8.amber b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_with_adjacency_uint8.amber new file mode 100644 index 0000000..c65c572 --- /dev/null +++ b/vulkan/amber/pipeline/input_assembly/primitive_restart/restart_disabled_triangle_strip_with_adjacency_uint8.amber @@ -0,0 +1,113 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE IndexTypeUint8Features.indexTypeUint8 + +DEVICE_FEATURE geometryShader + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) buffer block0 +{ + vec4 pos[256]; +}; + +void main() +{ + pos[0] = vec4(-0.5, -0.5, 0.0, 1.0); + pos[1] = vec4(-0.5, 0.5, 0.0, 1.0); + pos[2] = vec4(0.5, 0.5, 0.0, 1.0); + pos[3] = pos[255] = vec4(0.5, -0.5, 0.0, 1.0); +} +END + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +void main() +{ + color_out = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +SHADER geometry geom_shader GLSL +#version 430 +layout(triangles_adjacency) in; +layout(triangle_strip, max_vertices = 3) out; + +void main (void) +{ + for (int i = 0; i < 6; i += 2) + { + gl_Position = gl_in[i].gl_Position; + EmitVertex(); + } + EndPrimitive(); +} +END + +BUFFER position DATA_TYPE vec4 SIZE 256 FILL 0.0 + +BUFFER indices DATA_TYPE uint8 DATA +1 255 0 255 2 255 255 255 +END + +BUFFER indices_ref DATA_TYPE uint8 DATA +1 3 0 3 2 3 3 3 +END + +PIPELINE compute compute_pipeline + ATTACH compute_shader + FRAMEBUFFER_SIZE 64 64 + + BIND BUFFER position AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN compute_pipeline 1 1 1 + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 +IMAGE framebuffer_ref FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics graphics_pipeline + ATTACH vert_shader + ATTACH frag_shader + ATTACH geom_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE graphics graphics_pipeline_ref + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + INDEX_DATA indices_ref + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer_ref AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 0 0 0 0 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS TRIANGLE_STRIP_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 8 +CLEAR_COLOR graphics_pipeline_ref 0 0 0 0 +CLEAR graphics_pipeline_ref +RUN graphics_pipeline_ref DRAW_ARRAY AS TRIANGLE_STRIP_WITH_ADJACENCY INDEXED START_IDX 0 COUNT 8 +EXPECT framebuffer EQ_BUFFER framebuffer_ref diff --git a/vulkan/amber/pipeline/layer_read_from_frag.amber b/vulkan/amber/pipeline/layer_read_from_frag.amber new file mode 100644 index 0000000..136163b --- /dev/null +++ b/vulkan/amber/pipeline/layer_read_from_frag.amber @@ -0,0 +1,62 @@ +#!amber + +DEVICE_FEATURE geometryShader + +SHADER vertex vert GLSL +#version 460 +layout (location=0) in vec4 inPos; + +void main() +{ + gl_Position = inPos; +} + +END + +SHADER fragment frag GLSL +#version 460 +layout (location=0) out vec4 outColor; + +void main() +{ + if (gl_Layer == 0) + outColor = vec4(0.0,1.0,0.0,0.0); + else + outColor = vec4(1.0,0.0,0.0,0.0); +} + +END + +BUFFER position DATA_TYPE vec4 DATA +-1 -1 0 1 + 1 -1 0 1 +-1 0 0 1 + +-1 0 0 1 + 1 -1 0 1 + 1 0 0 1 + +-1 0 0 1 + 1 0 0 1 +-1 1 0 1 + +-1 1 0 1 + 1 0 0 1 + 1 1 0 1 + +END + +BUFFER framebuffer FORMAT R8G8B8A8_UNORM + +PIPELINE graphics graphics_pipeline + ATTACH vert + ATTACH frag + VERTEX_DATA position LOCATION 0 + FRAMEBUFFER_SIZE 1 1 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 255 255 255 255 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 12 +EXPECT framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 0 255 0 0 \ No newline at end of file diff --git a/vulkan/amber/pipeline/nonuniform_interpolant_indexing/centroid.amber b/vulkan/amber/pipeline/nonuniform_interpolant_indexing/centroid.amber new file mode 100644 index 0000000..2670bf1 --- /dev/null +++ b/vulkan/amber/pipeline/nonuniform_interpolant_indexing/centroid.amber @@ -0,0 +1,84 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE sampleRateShading + +SHADER vertex vert_shader GLSL +#version 440 +layout(location = 0) in vec4 inPosNDC; +layout(location = 1) in vec2 inPosScreen; +layout(location = 0) out vec2 outPosScreenArr[10]; + +void main (void) +{ + gl_Position = inPosNDC; + + for (int i = 0; i < 10; i++) + outPosScreenArr[i] = inPosScreen + vec2(i); +} +END + +SHADER fragment frag_shader GLSL +#version 440 +layout(location = 0) sample in vec2 inPosScreenArr[10]; +layout(location = 0) out vec4 fs_out_color; + +void main (void) +{ + int index = int(gl_FragCoord.x) % 10; + vec2 ref = interpolateAtCentroid(inPosScreenArr[0]) + vec2(index); + + if (distance(ref, interpolateAtCentroid(inPosScreenArr[index])) < 0.01 + && abs(ref.y - interpolateAtCentroid(inPosScreenArr[index].y)) < 0.01 + && abs(ref.y - interpolateAtCentroid(inPosScreenArr[index])).y < 0.01) + { + fs_out_color = vec4(0.0, 1.0, 0.0, 1.0); + } + else + { + fs_out_color = vec4(1.0, 0.0, 0.0, 1.0); + } +} +END + +BUFFER position DATA_TYPE vec4 DATA +-1.0 -1.0 0.0 1.0 + 1.0 -1.0 0.0 1.0 + 1.0 1.0 0.0 1.0 +-1.0 1.0 0.0 1.0 +END + +BUFFER position_screen DATA_TYPE vec2 DATA + 0.0 0.0 +64.0 0.0 +64.0 64.0 + 0.0 64.0 +END + +IMAGE framebufferMS FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 SAMPLES 4 +IMAGE framebuffer FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA position_screen LOCATION 1 + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebufferMS AS color LOCATION 0 + BIND BUFFER framebuffer AS resolve +END + +RUN pipeline DRAW_ARRAY AS TRIANGLE_FAN START_IDX 0 COUNT 4 +EXPECT framebuffer IDX 0 0 SIZE 64 64 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/pipeline/nonuniform_interpolant_indexing/offset.amber b/vulkan/amber/pipeline/nonuniform_interpolant_indexing/offset.amber new file mode 100644 index 0000000..8c200fa --- /dev/null +++ b/vulkan/amber/pipeline/nonuniform_interpolant_indexing/offset.amber @@ -0,0 +1,85 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE sampleRateShading + +SHADER vertex vert_shader GLSL +#version 440 +layout(location = 0) in vec4 inPosNDC; +layout(location = 1) in vec2 inPosScreen; +layout(location = 0) out vec2 outPosScreenArr[10]; + +void main (void) +{ + gl_Position = inPosNDC; + + for (int i = 0; i < 10; i++) + outPosScreenArr[i] = inPosScreen + vec2(i); +} +END + +SHADER fragment frag_shader GLSL +#version 440 +layout(location = 0) sample in vec2 inPosScreenArr[10]; +layout(location = 0) out vec4 fs_out_color; + +void main (void) +{ + vec2 offset = vec2(0.75, -0.33); + int index = int(gl_FragCoord.x) % 10; + vec2 ref = interpolateAtOffset(inPosScreenArr[0], offset) + vec2(index); + + if (distance(ref, interpolateAtOffset(inPosScreenArr[index], offset)) < 0.01 + && abs(ref.y - interpolateAtOffset(inPosScreenArr[index].y, offset)) < 0.01 + && abs(ref.y - interpolateAtOffset(inPosScreenArr[index], offset)).y < 0.01) + { + fs_out_color = vec4(0.0, 1.0, 0.0, 1.0); + } + else + { + fs_out_color = vec4(1.0, 0.0, 0.0, 1.0); + } +} +END + +BUFFER position DATA_TYPE vec4 DATA +-1.0 -1.0 0.0 1.0 + 1.0 -1.0 0.0 1.0 + 1.0 1.0 0.0 1.0 +-1.0 1.0 0.0 1.0 +END + +BUFFER position_screen DATA_TYPE vec2 DATA + 0.0 0.0 +64.0 0.0 +64.0 64.0 + 0.0 64.0 +END + +IMAGE framebufferMS FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 SAMPLES 4 +IMAGE framebuffer FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA position_screen LOCATION 1 + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebufferMS AS color LOCATION 0 + BIND BUFFER framebuffer AS resolve +END + +RUN pipeline DRAW_ARRAY AS TRIANGLE_FAN START_IDX 0 COUNT 4 +EXPECT framebuffer IDX 0 0 SIZE 64 64 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/pipeline/nonuniform_interpolant_indexing/sample.amber b/vulkan/amber/pipeline/nonuniform_interpolant_indexing/sample.amber new file mode 100644 index 0000000..d41fb18 --- /dev/null +++ b/vulkan/amber/pipeline/nonuniform_interpolant_indexing/sample.amber @@ -0,0 +1,84 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE sampleRateShading + +SHADER vertex vert_shader GLSL +#version 440 +layout(location = 0) in vec4 inPosNDC; +layout(location = 1) in vec2 inPosScreen; +layout(location = 0) out vec2 outPosScreenArr[10]; + +void main (void) +{ + gl_Position = inPosNDC; + + for (int i = 0; i < 10; i++) + outPosScreenArr[i] = inPosScreen + vec2(i); +} +END + +SHADER fragment frag_shader GLSL +#version 440 +layout(location = 0) sample in vec2 inPosScreenArr[10]; +layout(location = 0) out vec4 fs_out_color; + +void main (void) +{ + int index = int(gl_FragCoord.x) % 10; + vec2 ref = interpolateAtSample(inPosScreenArr[0], gl_SampleID) + vec2(index); + + if (distance(ref, interpolateAtSample(inPosScreenArr[index], gl_SampleID)) < 0.01 + && abs(ref.y - interpolateAtSample(inPosScreenArr[index].y, gl_SampleID)) < 0.01 + && abs(ref.y - interpolateAtSample(inPosScreenArr[index], gl_SampleID)).y < 0.01) + { + fs_out_color = vec4(0.0, 1.0, 0.0, 1.0); + } + else + { + fs_out_color = vec4(1.0, 0.0, 0.0, 1.0); + } +} +END + +BUFFER position DATA_TYPE vec4 DATA +-1.0 -1.0 0.0 1.0 + 1.0 -1.0 0.0 1.0 + 1.0 1.0 0.0 1.0 +-1.0 1.0 0.0 1.0 +END + +BUFFER position_screen DATA_TYPE vec2 DATA + 0.0 0.0 +64.0 0.0 +64.0 64.0 + 0.0 64.0 +END + +IMAGE framebufferMS FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 SAMPLES 4 +IMAGE framebuffer FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA position_screen LOCATION 1 + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebufferMS AS color LOCATION 0 + BIND BUFFER framebuffer AS resolve +END + +RUN pipeline DRAW_ARRAY AS TRIANGLE_FAN START_IDX 0 COUNT 4 +EXPECT framebuffer IDX 0 0 SIZE 64 64 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/pipeline/position_to_ssbo.amber b/vulkan/amber/pipeline/position_to_ssbo.amber new file mode 100644 index 0000000..7f16367 --- /dev/null +++ b/vulkan/amber/pipeline/position_to_ssbo.amber @@ -0,0 +1,43 @@ +# Copyright 2019 Google LLC. +# Copyright 2019 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[require] +vertexPipelineStoresAndAtomics + +[vertex shader] +#version 430 + +layout(location = 0) in vec4 position_in; +layout(binding = 0) buffer DataOut +{ + vec4 values[]; +} dataOut; + +void main() +{ + gl_Position = position_in; + dataOut.values[gl_VertexIndex] = position_in; +} + +[vertex data] +0/R32G32B32A32_SFLOAT +0.1 0.2 0.3 0.4 +0.5 0.6 0.7 0.8 +0.9 1.0 1.1 1.2 + +[test] +ssbo 0 48 +draw arrays TRIANGLE_STRIP 0 3 +probe ssbo float 0 0 == 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 diff --git a/vulkan/amber/pipeline/primitive_id_from_tess.amber b/vulkan/amber/pipeline/primitive_id_from_tess.amber new file mode 100644 index 0000000..db52be5 --- /dev/null +++ b/vulkan/amber/pipeline/primitive_id_from_tess.amber @@ -0,0 +1,114 @@ +#!amber +# +# Copyright 2020 The Khronos Group Inc. +# Copyright 2020 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE geometryShader +DEVICE_FEATURE tessellationShader + +SHADER vertex vert GLSL +#version 450 +layout (location=0) in vec4 in_pos; +void main(void) +{ + gl_Position = in_pos; +} +END + +SHADER tessellation_control tesc GLSL +#version 450 +layout (vertices = 3) out; +void main(void) +{ + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 1.0; + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 1.0; + gl_TessLevelOuter[2] = 1.0; + gl_TessLevelOuter[3] = 1.0; + + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +} +END + +SHADER tessellation_evaluation tese GLSL +#version 450 +layout (triangles, fractional_odd_spacing, cw) in; +void main(void) +{ + gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position) + + (gl_TessCoord.y * gl_in[1].gl_Position) + + (gl_TessCoord.z * gl_in[2].gl_Position); +} +END + +SHADER fragment frag GLSL +#version 450 +layout (location=0) out vec4 out_color; +void main(void) +{ + vec4 primitive_color; + switch (gl_PrimitiveID) { + case 0: + case 1: + primitive_color = vec4(0, 0, 1, 1); + break; + case 2: + case 3: + primitive_color = vec4(1, 0, 1, 1); + break; + default: + primitive_color = vec4(0, 0, 0, 1); + break; + } + out_color = primitive_color; +} +END + +BUFFER position DATA_TYPE vec4 DATA +-1 -1 0 1 + 1 -1 0 1 +-1 0 0 1 + +-1 0 0 1 + 1 -1 0 1 + 1 0 0 1 + +-1 0 0 1 + 1 0 0 1 +-1 1 0 1 + +-1 1 0 1 + 1 0 0 1 + 1 1 0 1 + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics graphics_pipeline + ATTACH vert + ATTACH tesc + ATTACH tese + ATTACH frag + VERTEX_DATA position LOCATION 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR graphics_pipeline 255 255 255 255 +CLEAR graphics_pipeline +RUN graphics_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 12 +EXPECT framebuffer IDX 0 0 SIZE 250 125 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 0 125 SIZE 250 125 EQ_RGBA 255 0 255 255 diff --git a/vulkan/amber/pipeline/reinterpolate_at_centroid.amber b/vulkan/amber/pipeline/reinterpolate_at_centroid.amber new file mode 100644 index 0000000..9374218 --- /dev/null +++ b/vulkan/amber/pipeline/reinterpolate_at_centroid.amber @@ -0,0 +1,52 @@ +#!amber +DEVICE_FEATURE sampleRateShading +SHADER vertex vert_shader GLSL +#version 440 +layout(location = 0) in vec4 vs_in_position_ndc; +layout(location = 1) in float vs_in_position_screen; +layout(location = 0) out float vs_out_pos_screen; +void main (void) +{ + gl_Position = vs_in_position_ndc; + vs_out_pos_screen = vs_in_position_screen; +} +END +SHADER fragment frag_shader GLSL +#version 440 +layout(location = 0) centroid in float fs_in_pos_screen; +layout(location = 0) out vec4 fs_out_color; +void main (void) +{ + const float threshold = 0.0005; + const float a = interpolateAtCentroid(fs_in_pos_screen); + const float b = fs_in_pos_screen; + const bool valuesEqual = (abs(a - b) < threshold); + if (valuesEqual) + fs_out_color = vec4(0.0, 1.0, 0.0, 1.0); + else + fs_out_color = vec4(1.0, 0.0, 0.0, 1.0); +} +END +BUFFER position DATA_TYPE vec4 DATA + 1.0 -1.0 0.0 1.0 + 1.0 1.0 0.0 1.0 +-1.0 -1.0 0.0 1.0 +-1.0 1.0 0.0 1.0 +END +BUFFER position_screen DATA_TYPE float DATA +64.0 +64.0 + 0.0 + 0.0 +END +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA position_screen LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + FRAMEBUFFER_SIZE 64 64 +END +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +EXPECT framebuffer IDX 0 0 SIZE 64 64 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/pipeline/reinterpolate_at_sample.amber b/vulkan/amber/pipeline/reinterpolate_at_sample.amber new file mode 100644 index 0000000..2d1b6f2 --- /dev/null +++ b/vulkan/amber/pipeline/reinterpolate_at_sample.amber @@ -0,0 +1,52 @@ +#!amber +DEVICE_FEATURE sampleRateShading +SHADER vertex vert_shader GLSL +#version 440 +layout(location = 0) in vec4 vs_in_position_ndc; +layout(location = 1) in float vs_in_position_screen; +layout(location = 0) out float vs_out_pos_screen; +void main (void) +{ + gl_Position = vs_in_position_ndc; + vs_out_pos_screen = vs_in_position_screen; +} +END +SHADER fragment frag_shader GLSL +#version 440 +layout(location = 0) sample in float fs_in_pos_screen; +layout(location = 0) out vec4 fs_out_color; +void main (void) +{ + const float threshold = 0.0005; + const float a = interpolateAtSample(fs_in_pos_screen, gl_SampleID); + const float b = fs_in_pos_screen; + const bool valuesEqual = (abs(a - b) < threshold); + if (valuesEqual) + fs_out_color = vec4(0.0, 1.0, 0.0, 1.0); + else + fs_out_color = vec4(1.0, 0.0, 0.0, 1.0); +} +END +BUFFER position DATA_TYPE vec4 DATA + 1.0 -1.0 0.0 1.0 + 1.0 1.0 0.0 1.0 +-1.0 -1.0 0.0 1.0 +-1.0 1.0 0.0 1.0 +END +BUFFER position_screen DATA_TYPE float DATA +64.0 +64.0 + 0.0 + 0.0 +END +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + VERTEX_DATA position LOCATION 0 + VERTEX_DATA position_screen LOCATION 1 + BIND BUFFER framebuffer AS color LOCATION 0 + FRAMEBUFFER_SIZE 64 64 +END +RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +EXPECT framebuffer IDX 0 0 SIZE 64 64 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/rasterization/depth_bias/d16_unorm.amber b/vulkan/amber/rasterization/depth_bias/d16_unorm.amber new file mode 100644 index 0000000..7b30914 --- /dev/null +++ b/vulkan/amber/rasterization/depth_bias/d16_unorm.amber @@ -0,0 +1,186 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This test draws two quads with depth values 0.3 and 0.5. Based on the equation in +# Vulkan spec 26.12.3 the effective constant bias o is calculated as follows: + +# Both quads have a constant depth value, thus the maximum depth slope m is zero. +# For minimun resolveble difference r there are two values accepted: r0 = 2^-16 +# and r1 = 2^-15. It is constant throughout the range of the entire depth buffer. + +# Using r0 the constant bias o value is: +# 16384 * r0 = 16384 * 2^-16 = 0.25. + +# Adding this to the existing quad depth values should result as: +# 0.3 + 0.25 = 0.55 and 0.5 + 0.25 = 0.75. + +# For r1 the same calculation for o is: +# 16384 * r1 = 16384 * 2^-15 = 0.5. + +# Adding this to the existing quad depth values should result as: +# 0.3 + 0.5 = 0.8 and 0.5 + 0.5 = 1.0 + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; +layout(location = 0) out vec4 frag_color; + +layout(set = 0, binding = 0) readonly buffer block1 { + vec4 in_color; + float depth; +}; + +void main() { + gl_Position = vec4(position.xy, depth, 1.0); + frag_color = in_color; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) in vec4 frag_color; +layout(location = 0) out vec4 final_color; + +void main() { + final_color = frag_color; +} +END + +SHADER vertex vert_shader_tex GLSL +#version 430 +layout(location = 0) in vec4 position; +layout(location = 1) in vec2 texcoords_in; +layout(location = 0) out vec2 texcoords_out; +void main() { + gl_Position = position; + texcoords_out = texcoords_in; +} +END + +SHADER fragment frag_shader_tex GLSL +#version 430 +layout(location = 0) in vec2 texcoords_in; +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) sampler2D tex_sampler; +void main() { + float f = texture(tex_sampler, texcoords_in).r; + color_out = vec4(f, f, f, 1); +} +END + +BUFFER data_buf1 DATA_TYPE float DATA 1.0 0.0 0.0 1.0 0.3 END +BUFFER data_buf2 DATA_TYPE float DATA 0.0 1.0 0.0 1.0 0.5 END + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END +BUFFER texcoords DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER depthstencil FORMAT D16_UNORM +BUFFER ddump FORMAT R32_SFLOAT +BUFFER results DATA_TYPE float SIZE 2 FILL 0 +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +SAMPLER sampler + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + BIND BUFFER data_buf1 AS storage DESCRIPTOR_SET 0 BINDING 0 + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 16384.0 clamp 0.0 slope 2.0 + END +END + +DERIVE_PIPELINE pipeline2 FROM pipeline1 + BIND BUFFER data_buf2 AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +PIPELINE graphics depthdump + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoords LOCATION 1 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump AS color LOCATION 0 +END + +SHADER compute verification_shader GLSL +#version 430 +layout(local_size_x=1,local_size_y=1) in; +uniform layout (set=0, binding=0, r32f) image2D texture; +layout(set = 0, binding = 1) buffer Result { + float result0; + float result1; +}; + +void main () { + float ref0_0 = 0.55; + float ref0_1 = 0.8; + float depth0 = imageLoad(texture, ivec2(0, 0)).r; + if (distance(ref0_0, depth0) < 0.003 || distance(ref0_1, depth0) < 0.003) + result0 = 1.0; + else + result0 = 0.0; + + float ref1_0 = 0.75; + float ref1_1 = 1.0; + float depth1 = imageLoad(texture, ivec2(255, 255)).r; + if (distance(ref1_0, depth1) < 0.003 || distance(ref1_1, depth1) < 0.003) + result1 = 1.0; + else + result1 = 0.0; +} +END + +PIPELINE compute verification_pipeline + ATTACH verification_shader + BIND BUFFER ddump AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 1 + FRAMEBUFFER_SIZE 256 256 +END + +CLEAR_DEPTH pipeline1 1.0 +CLEAR_COLOR pipeline1 255 255 255 255 +CLEAR pipeline1 +RUN pipeline1 DRAW_RECT POS 0 0 SIZE 200 200 +RUN pipeline2 DRAW_RECT POS 56 56 SIZE 200 200 +RUN depthdump DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN verification_pipeline 1 1 1 + +EXPECT results IDX 0 EQ 1.0 +EXPECT results IDX 4 EQ 1.0 diff --git a/vulkan/amber/rasterization/depth_bias/d16_unorm_constant_one.amber b/vulkan/amber/rasterization/depth_bias/d16_unorm_constant_one.amber new file mode 100644 index 0000000..8de0c61 --- /dev/null +++ b/vulkan/amber/rasterization/depth_bias/d16_unorm_constant_one.amber @@ -0,0 +1,232 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() { + gl_Position = position; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) out vec4 final_color; + +void main() { + final_color = vec4(1.0f); +} +END + +SHADER vertex vert_shader_tex GLSL +#version 430 +layout(location = 0) in vec2 texcoords_in; +layout(location = 0) out vec2 texcoords_out; +void main() { + gl_Position = vec4(texcoords_in * 2.0f - 1.0f, 0.0f, 1.0f); + texcoords_out = texcoords_in; +} +END + +SHADER fragment frag_shader_tex GLSL +#version 430 +layout(location = 0) in vec2 texcoords_in; +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) sampler2D tex_sampler; +void main() { + float f = texture(tex_sampler, texcoords_in).r; + color_out = vec4(f, f, f, 1); +} +END + +BUFFER position_buf1 DATA_TYPE vec4 DATA +-1 -1 0.3 1.0 + 1 -1 0.5 1.0 +-1 1 0.3 1.0 + 1 1 0.5 1.0 +END + +BUFFER texcoords DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +0.0 1.0 +1.0 1.0 +END + +BUFFER depthstencil1 FORMAT D16_UNORM +BUFFER depthstencil2 FORMAT D16_UNORM +BUFFER depthstencil3 FORMAT D16_UNORM +BUFFER ddump1 FORMAT R32_SFLOAT +BUFFER ddump2 FORMAT R32_SFLOAT +BUFFER ddump3 FORMAT R32_SFLOAT +BUFFER results DATA_TYPE float SIZE 2 FILL 0 +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +SAMPLER sampler + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil1 AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics pipeline2 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil2 AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 1.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics pipeline3 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil3 AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant -1.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics depthdump1 + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA texcoords LOCATION 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump1 AS color LOCATION 0 +END + +PIPELINE graphics depthdump2 + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA texcoords LOCATION 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump2 AS color LOCATION 0 +END + +PIPELINE graphics depthdump3 + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil3 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA texcoords LOCATION 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump3 AS color LOCATION 0 +END + +SHADER compute verification_shader GLSL +#version 430 +layout(local_size_x=1,local_size_y=1) in; +uniform layout (set=0, binding=0, r32f) image2D texture1; +uniform layout (set=0, binding=1, r32f) image2D texture2; +uniform layout (set=0, binding=2, r32f) image2D texture3; +layout(set = 0, binding = 3) buffer Result { + float result0; + float result1; +}; + +void main () { + float r0 = 1.0f / pow(2.0f, 16.0f); + float r1 = 1.0f / pow(2.0f, 15.0f); + float depth1_1 = imageLoad(texture1, ivec2(0, 0)).r; + float depth1_2 = imageLoad(texture1, ivec2(255, 255)).r; + float depth2_1 = imageLoad(texture2, ivec2(0, 0)).r; + float depth2_2 = imageLoad(texture2, ivec2(255, 255)).r; + float depth3_1 = imageLoad(texture3, ivec2(0, 0)).r; + float depth3_2 = imageLoad(texture3, ivec2(255, 55)).r; + + const float epsilon = 0.00001f; + + if ((distance(depth1_1 + r0, depth2_1) < epsilon || distance(depth1_1 + r1, depth2_1) < epsilon) && (distance(depth1_2 + r0, depth2_2) < epsilon || distance(depth1_2 + r1, depth2_2) < epsilon)) + result0 = 1.0; + else + result0 = 0.0; + + if ((distance(depth1_1 - r0, depth3_1) < epsilon || distance(depth1_1 - r1, depth3_1) < epsilon) && (distance(depth1_2 - r0, depth3_2) < epsilon || distance(depth1_2 - r1, depth3_2) < epsilon)) + result1 = 1.0; + else + result1 = 0.0; +} +END + +PIPELINE compute verification_pipeline + ATTACH verification_shader + BIND BUFFER ddump1 AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ddump2 AS storage_image DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER ddump3 AS storage_image DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 3 + FRAMEBUFFER_SIZE 256 256 +END + +CLEAR_DEPTH pipeline1 1.0 +CLEAR_COLOR pipeline1 255 255 255 255 +CLEAR pipeline1 +CLEAR_DEPTH pipeline2 1.0 +CLEAR_COLOR pipeline2 255 255 255 255 +CLEAR pipeline2 +CLEAR_DEPTH pipeline3 1.0 +CLEAR_COLOR pipeline3 255 255 255 255 +CLEAR pipeline3 +RUN pipeline1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline3 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN depthdump1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN depthdump2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN depthdump3 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN verification_pipeline 1 1 1 + +EXPECT results IDX 0 EQ 1.0 +EXPECT results IDX 4 EQ 1.0 diff --git a/vulkan/amber/rasterization/depth_bias/d16_unorm_constant_one_greater.amber b/vulkan/amber/rasterization/depth_bias/d16_unorm_constant_one_greater.amber new file mode 100644 index 0000000..e7c92c4 --- /dev/null +++ b/vulkan/amber/rasterization/depth_bias/d16_unorm_constant_one_greater.amber @@ -0,0 +1,104 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() { + gl_Position = position; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) out vec4 final_color; + +layout(set = 0, binding = 0) readonly buffer block1 { + vec4 in_color; +}; + +void main() { + final_color = in_color; +} +END + +BUFFER position_buf1 DATA_TYPE vec4 DATA +-1 -1 0.3 1.0 + 1 -1 0.5 1.0 +-1 1 0.3 1.0 + 1 1 0.5 1.0 +END + +BUFFER data_buf1 DATA_TYPE float DATA 1.0 0.0 0.0 1.0 END +BUFFER data_buf2 DATA_TYPE float DATA 0.0 1.0 0.0 1.0 END + +BUFFER depthstencil FORMAT D16_UNORM +BUFFER framebuffer FORMAT R8G8B8A8_UNORM + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + BIND BUFFER data_buf1 AS storage DESCRIPTOR_SET 0 BINDING 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics pipeline2 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + BIND BUFFER data_buf2 AS storage DESCRIPTOR_SET 0 BINDING 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 2.0 clamp 0.0 slope 0.0 + END +END + +CLEAR_DEPTH pipeline1 1.0 +CLEAR_COLOR pipeline1 255 255 255 255 +CLEAR pipeline1 +CLEAR_DEPTH pipeline2 1.0 +CLEAR_COLOR pipeline2 255 255 255 255 +CLEAR pipeline2 +RUN pipeline1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +EXPECT framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/rasterization/depth_bias/d16_unorm_constant_one_less.amber b/vulkan/amber/rasterization/depth_bias/d16_unorm_constant_one_less.amber new file mode 100644 index 0000000..13d5d1f --- /dev/null +++ b/vulkan/amber/rasterization/depth_bias/d16_unorm_constant_one_less.amber @@ -0,0 +1,104 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() { + gl_Position = position; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) out vec4 final_color; + +layout(set = 0, binding = 0) readonly buffer block1 { + vec4 in_color; +}; + +void main() { + final_color = in_color; +} +END + +BUFFER position_buf1 DATA_TYPE vec4 DATA +-1 -1 0.3 1.0 + 1 -1 0.5 1.0 +-1 1 0.3 1.0 + 1 1 0.5 1.0 +END + +BUFFER data_buf1 DATA_TYPE float DATA 1.0 0.0 0.0 1.0 END +BUFFER data_buf2 DATA_TYPE float DATA 0.0 1.0 0.0 1.0 END + +BUFFER depthstencil FORMAT D16_UNORM +BUFFER framebuffer FORMAT R8G8B8A8_UNORM + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + BIND BUFFER data_buf1 AS storage DESCRIPTOR_SET 0 BINDING 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics pipeline2 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + BIND BUFFER data_buf2 AS storage DESCRIPTOR_SET 0 BINDING 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant -1.0 clamp 0.0 slope 0.0 + END +END + +CLEAR_DEPTH pipeline1 1.0 +CLEAR_COLOR pipeline1 255 255 255 255 +CLEAR pipeline1 +CLEAR_DEPTH pipeline2 1.0 +CLEAR_COLOR pipeline2 255 255 255 255 +CLEAR pipeline2 +RUN pipeline1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +EXPECT framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/rasterization/depth_bias/d16_unorm_slope.amber b/vulkan/amber/rasterization/depth_bias/d16_unorm_slope.amber new file mode 100644 index 0000000..ac90ba4 --- /dev/null +++ b/vulkan/amber/rasterization/depth_bias/d16_unorm_slope.amber @@ -0,0 +1,232 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() { + gl_Position = position; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) out vec4 final_color; + +void main() { + final_color = vec4(1.0f); +} +END + +SHADER vertex vert_shader_tex GLSL +#version 430 +layout(location = 0) in vec2 texcoords_in; +layout(location = 0) out vec2 texcoords_out; +void main() { + gl_Position = vec4(texcoords_in * 2.0f - 1.0f, 0.0f, 1.0f); + texcoords_out = texcoords_in; +} +END + +SHADER fragment frag_shader_tex GLSL +#version 430 +layout(location = 0) in vec2 texcoords_in; +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) sampler2D tex_sampler; +void main() { + float f = texture(tex_sampler, texcoords_in).r; + color_out = vec4(f, f, f, 1); +} +END + +BUFFER position_buf1 DATA_TYPE vec4 DATA +-1 -1 0.3 1.0 + 1 -1 0.5 1.0 +-1 1 0.3 1.0 + 1 1 0.5 1.0 +END + +BUFFER texcoords DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +0.0 1.0 +1.0 1.0 +END + +BUFFER depthstencil1 FORMAT D16_UNORM +BUFFER depthstencil2 FORMAT D16_UNORM +BUFFER depthstencil3 FORMAT D16_UNORM +BUFFER ddump1 FORMAT R32_SFLOAT +BUFFER ddump2 FORMAT R32_SFLOAT +BUFFER ddump3 FORMAT R32_SFLOAT +BUFFER results DATA_TYPE float SIZE 2 FILL 0 +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +SAMPLER sampler + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil1 AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics pipeline2 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil2 AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 1.0 + END +END + +PIPELINE graphics pipeline3 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil3 AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope -1.0 + END +END + +PIPELINE graphics depthdump1 + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA texcoords LOCATION 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump1 AS color LOCATION 0 +END + +PIPELINE graphics depthdump2 + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA texcoords LOCATION 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump2 AS color LOCATION 0 +END + +PIPELINE graphics depthdump3 + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil3 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA texcoords LOCATION 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump3 AS color LOCATION 0 +END + +SHADER compute verification_shader GLSL +#version 430 +layout(local_size_x=1,local_size_y=1) in; +uniform layout (set=0, binding=0, r32f) image2D texture1; +uniform layout (set=0, binding=1, r32f) image2D texture2; +uniform layout (set=0, binding=2, r32f) image2D texture3; +layout(set = 0, binding = 3) buffer Result { + float result0; + float result1; +}; + +void main () { + float depth1_1 = imageLoad(texture1, ivec2(0, 0)).r; + float depth1_2 = imageLoad(texture1, ivec2(255, 255)).r; + float depth2_1 = imageLoad(texture2, ivec2(0, 0)).r; + float depth2_2 = imageLoad(texture2, ivec2(255, 255)).r; + float depth3_1 = imageLoad(texture3, ivec2(0, 0)).r; + float depth3_2 = imageLoad(texture3, ivec2(255, 55)).r; + + float m = 0.2f / 256.0f; + + const float epsilon = 0.00002f; + + if (distance(depth1_1 + m, depth2_1) < epsilon && distance(depth1_2 + m, depth2_2) < epsilon) + result0 = 1.0; + else + result0 = 0.0; + + if (distance(depth1_1 - m, depth3_1) < epsilon && distance(depth1_2 - m, depth3_2) < epsilon) + result1 = 1.0; + else + result1 = 0.0; +} +END + +PIPELINE compute verification_pipeline + ATTACH verification_shader + BIND BUFFER ddump1 AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ddump2 AS storage_image DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER ddump3 AS storage_image DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 3 + FRAMEBUFFER_SIZE 256 256 +END + +CLEAR_DEPTH pipeline1 1.0 +CLEAR_COLOR pipeline1 255 255 255 255 +CLEAR pipeline1 +CLEAR_DEPTH pipeline2 1.0 +CLEAR_COLOR pipeline2 255 255 255 255 +CLEAR pipeline2 +CLEAR_DEPTH pipeline3 1.0 +CLEAR_COLOR pipeline3 255 255 255 255 +CLEAR pipeline3 +RUN pipeline1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline3 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN depthdump1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN depthdump2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN depthdump3 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN verification_pipeline 1 1 1 + +EXPECT results IDX 0 EQ 1.0 +EXPECT results IDX 4 EQ 1.0 diff --git a/vulkan/amber/rasterization/depth_bias/d24_unorm.amber b/vulkan/amber/rasterization/depth_bias/d24_unorm.amber new file mode 100644 index 0000000..b7b19f8 --- /dev/null +++ b/vulkan/amber/rasterization/depth_bias/d24_unorm.amber @@ -0,0 +1,186 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This test draws two quads with depth values 0.3 and 0.5. Based on the equation in +# Vulkan spec 26.12.3 the effective constant bias o is calculated as follows: + +# Both quads have a constant depth value, thus the maximum depth slope m is zero. +# For minimun resolveble difference r there are two values accepted: r0 = 2^-24 +# and r1 = 2^-23. It is constant throughout the range of the entire depth buffer. + +# Using r0 the constant bias o value is: +# 4194304 * r0 = 4194304 * 2^-24 = 0.25. + +# Adding this to the existing quad depth values should result as: +# 0.3 + 0.25 = 0.55 and 0.5 + 0.25 = 0.75. + +# For r1 the same calculation for o is: +# 4194304 * r1 = 4194304 * 2^-23 = 0.5. + +# Adding this to the existing quad depth values should result as: +# 0.3 + 0.5 = 0.8 and 0.5 + 0.5 = 1.0 + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; +layout(location = 0) out vec4 frag_color; + +layout(set = 0, binding = 0) readonly buffer block1 { + vec4 in_color; + float depth; +}; + +void main() { + gl_Position = vec4(position.xy, depth, 1.0); + frag_color = in_color; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) in vec4 frag_color; +layout(location = 0) out vec4 final_color; + +void main() { + final_color = frag_color; +} +END + +SHADER vertex vert_shader_tex GLSL +#version 430 +layout(location = 0) in vec4 position; +layout(location = 1) in vec2 texcoords_in; +layout(location = 0) out vec2 texcoords_out; +void main() { + gl_Position = position; + texcoords_out = texcoords_in; +} +END + +SHADER fragment frag_shader_tex GLSL +#version 430 +layout(location = 0) in vec2 texcoords_in; +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) sampler2D tex_sampler; +void main() { + float f = texture(tex_sampler, texcoords_in).r; + color_out = vec4(f, f, f, 1); +} +END + +BUFFER data_buf1 DATA_TYPE float DATA 1.0 0.0 0.0 1.0 0.3 END +BUFFER data_buf2 DATA_TYPE float DATA 0.0 1.0 0.0 1.0 0.5 END + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END +BUFFER texcoords DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +BUFFER depthstencil FORMAT D24_UNORM_S8_UINT +BUFFER ddump FORMAT R32_SFLOAT +BUFFER results DATA_TYPE float SIZE 2 FILL 0 +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +SAMPLER sampler + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + BIND BUFFER data_buf1 AS storage DESCRIPTOR_SET 0 BINDING 0 + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 4194304.0 clamp 0.0 slope 2.0 + END +END + +DERIVE_PIPELINE pipeline2 FROM pipeline1 + BIND BUFFER data_buf2 AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +PIPELINE graphics depthdump + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoords LOCATION 1 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump AS color LOCATION 0 +END + +SHADER compute verification_shader GLSL +#version 430 +layout(local_size_x=1,local_size_y=1) in; +uniform layout (set=0, binding=0, r32f) image2D texture; +layout(set = 0, binding = 1) buffer Result { + float result0; + float result1; +}; + +void main () { + float ref0_0 = 0.55; + float ref0_1 = 0.8; + float depth0 = imageLoad(texture, ivec2(0, 0)).r; + if (distance(ref0_0, depth0) < 0.003 || distance(ref0_1, depth0) < 0.003) + result0 = 1.0; + else + result0 = 0.0; + + float ref1_0 = 0.75; + float ref1_1 = 1.0; + float depth1 = imageLoad(texture, ivec2(255, 255)).r; + if (distance(ref1_0, depth1) < 0.003 || distance(ref1_1, depth1) < 0.003) + result1 = 1.0; + else + result1 = 0.0; +} +END + +PIPELINE compute verification_pipeline + ATTACH verification_shader + BIND BUFFER ddump AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 1 + FRAMEBUFFER_SIZE 256 256 +END + +CLEAR_DEPTH pipeline1 1.0 +CLEAR_COLOR pipeline1 255 255 255 255 +CLEAR pipeline1 +RUN pipeline1 DRAW_RECT POS 0 0 SIZE 200 200 +RUN pipeline2 DRAW_RECT POS 56 56 SIZE 200 200 +RUN depthdump DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN verification_pipeline 1 1 1 + +EXPECT results IDX 0 EQ 1.0 +EXPECT results IDX 4 EQ 1.0 diff --git a/vulkan/amber/rasterization/depth_bias/d24_unorm_constant_one.amber b/vulkan/amber/rasterization/depth_bias/d24_unorm_constant_one.amber new file mode 100644 index 0000000..1931fce --- /dev/null +++ b/vulkan/amber/rasterization/depth_bias/d24_unorm_constant_one.amber @@ -0,0 +1,232 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() { + gl_Position = position; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) out vec4 final_color; + +void main() { + final_color = vec4(1.0f); +} +END + +SHADER vertex vert_shader_tex GLSL +#version 430 +layout(location = 0) in vec2 texcoords_in; +layout(location = 0) out vec2 texcoords_out; +void main() { + gl_Position = vec4(texcoords_in * 2.0f - 1.0f, 0.0f, 1.0f); + texcoords_out = texcoords_in; +} +END + +SHADER fragment frag_shader_tex GLSL +#version 430 +layout(location = 0) in vec2 texcoords_in; +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) sampler2D tex_sampler; +void main() { + float f = texture(tex_sampler, texcoords_in).r; + color_out = vec4(f, f, f, 1); +} +END + +BUFFER position_buf1 DATA_TYPE vec4 DATA +-1 -1 0.3 1.0 + 1 -1 0.5 1.0 +-1 1 0.3 1.0 + 1 1 0.5 1.0 +END + +BUFFER texcoords DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +0.0 1.0 +1.0 1.0 +END + +BUFFER depthstencil1 FORMAT D24_UNORM_S8_UINT +BUFFER depthstencil2 FORMAT D24_UNORM_S8_UINT +BUFFER depthstencil3 FORMAT D24_UNORM_S8_UINT +BUFFER ddump1 FORMAT R32_SFLOAT +BUFFER ddump2 FORMAT R32_SFLOAT +BUFFER ddump3 FORMAT R32_SFLOAT +BUFFER results DATA_TYPE float SIZE 2 FILL 0 +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +SAMPLER sampler + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil1 AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics pipeline2 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil2 AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 1.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics pipeline3 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil3 AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant -1.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics depthdump1 + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA texcoords LOCATION 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump1 AS color LOCATION 0 +END + +PIPELINE graphics depthdump2 + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA texcoords LOCATION 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump2 AS color LOCATION 0 +END + +PIPELINE graphics depthdump3 + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil3 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA texcoords LOCATION 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump3 AS color LOCATION 0 +END + +SHADER compute verification_shader GLSL +#version 430 +layout(local_size_x=1,local_size_y=1) in; +uniform layout (set=0, binding=0, r32f) image2D texture1; +uniform layout (set=0, binding=1, r32f) image2D texture2; +uniform layout (set=0, binding=2, r32f) image2D texture3; +layout(set = 0, binding = 3) buffer Result { + float result0; + float result1; +}; + +void main () { + float r0 = 1.0f / pow(2.0f, 24.0f); + float r1 = 1.0f / pow(2.0f, 23.0f); + float depth1_1 = imageLoad(texture1, ivec2(0, 0)).r; + float depth1_2 = imageLoad(texture1, ivec2(255, 255)).r; + float depth2_1 = imageLoad(texture2, ivec2(0, 0)).r; + float depth2_2 = imageLoad(texture2, ivec2(255, 255)).r; + float depth3_1 = imageLoad(texture3, ivec2(0, 0)).r; + float depth3_2 = imageLoad(texture3, ivec2(255, 55)).r; + + const float epsilon = 0.00001f; + + if ((distance(depth1_1 + r0, depth2_1) < epsilon || distance(depth1_1 + r1, depth2_1) < epsilon) && (distance(depth1_2 + r0, depth2_2) < epsilon || distance(depth1_2 + r1, depth2_2) < epsilon)) + result0 = 1.0; + else + result0 = 0.0; + + if ((distance(depth1_1 - r0, depth3_1) < epsilon || distance(depth1_1 - r1, depth3_1) < epsilon) && (distance(depth1_2 - r0, depth3_2) < epsilon || distance(depth1_2 - r1, depth3_2) < epsilon)) + result1 = 1.0; + else + result1 = 0.0; +} +END + +PIPELINE compute verification_pipeline + ATTACH verification_shader + BIND BUFFER ddump1 AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ddump2 AS storage_image DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER ddump3 AS storage_image DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 3 + FRAMEBUFFER_SIZE 256 256 +END + +CLEAR_DEPTH pipeline1 1.0 +CLEAR_COLOR pipeline1 255 255 255 255 +CLEAR pipeline1 +CLEAR_DEPTH pipeline2 1.0 +CLEAR_COLOR pipeline2 255 255 255 255 +CLEAR pipeline2 +CLEAR_DEPTH pipeline3 1.0 +CLEAR_COLOR pipeline3 255 255 255 255 +CLEAR pipeline3 +RUN pipeline1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline3 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN depthdump1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN depthdump2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN depthdump3 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN verification_pipeline 1 1 1 + +EXPECT results IDX 0 EQ 1.0 +EXPECT results IDX 4 EQ 1.0 diff --git a/vulkan/amber/rasterization/depth_bias/d24_unorm_constant_one_greater.amber b/vulkan/amber/rasterization/depth_bias/d24_unorm_constant_one_greater.amber new file mode 100644 index 0000000..b5620f6 --- /dev/null +++ b/vulkan/amber/rasterization/depth_bias/d24_unorm_constant_one_greater.amber @@ -0,0 +1,104 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() { + gl_Position = position; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) out vec4 final_color; + +layout(set = 0, binding = 0) readonly buffer block1 { + vec4 in_color; +}; + +void main() { + final_color = in_color; +} +END + +BUFFER position_buf1 DATA_TYPE vec4 DATA +-1 -1 0.3 1.0 + 1 -1 0.5 1.0 +-1 1 0.3 1.0 + 1 1 0.5 1.0 +END + +BUFFER data_buf1 DATA_TYPE float DATA 1.0 0.0 0.0 1.0 END +BUFFER data_buf2 DATA_TYPE float DATA 0.0 1.0 0.0 1.0 END + +BUFFER depthstencil FORMAT D24_UNORM_S8_UINT +BUFFER framebuffer FORMAT R8G8B8A8_UNORM + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + BIND BUFFER data_buf1 AS storage DESCRIPTOR_SET 0 BINDING 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics pipeline2 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + BIND BUFFER data_buf2 AS storage DESCRIPTOR_SET 0 BINDING 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 1.0 clamp 0.0 slope 0.0 + END +END + +CLEAR_DEPTH pipeline1 1.0 +CLEAR_COLOR pipeline1 255 255 255 255 +CLEAR pipeline1 +CLEAR_DEPTH pipeline2 1.0 +CLEAR_COLOR pipeline2 255 255 255 255 +CLEAR pipeline2 +RUN pipeline1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +EXPECT framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/rasterization/depth_bias/d24_unorm_constant_one_less.amber b/vulkan/amber/rasterization/depth_bias/d24_unorm_constant_one_less.amber new file mode 100644 index 0000000..f5b36f6 --- /dev/null +++ b/vulkan/amber/rasterization/depth_bias/d24_unorm_constant_one_less.amber @@ -0,0 +1,104 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() { + gl_Position = position; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) out vec4 final_color; + +layout(set = 0, binding = 0) readonly buffer block1 { + vec4 in_color; +}; + +void main() { + final_color = in_color; +} +END + +BUFFER position_buf1 DATA_TYPE vec4 DATA +-1 -1 0.3 1.0 + 1 -1 0.5 1.0 +-1 1 0.3 1.0 + 1 1 0.5 1.0 +END + +BUFFER data_buf1 DATA_TYPE float DATA 1.0 0.0 0.0 1.0 END +BUFFER data_buf2 DATA_TYPE float DATA 0.0 1.0 0.0 1.0 END + +BUFFER depthstencil FORMAT D24_UNORM_S8_UINT +BUFFER framebuffer FORMAT R8G8B8A8_UNORM + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + BIND BUFFER data_buf1 AS storage DESCRIPTOR_SET 0 BINDING 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics pipeline2 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + BIND BUFFER data_buf2 AS storage DESCRIPTOR_SET 0 BINDING 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant -1.0 clamp 0.0 slope 0.0 + END +END + +CLEAR_DEPTH pipeline1 1.0 +CLEAR_COLOR pipeline1 255 255 255 255 +CLEAR pipeline1 +CLEAR_DEPTH pipeline2 1.0 +CLEAR_COLOR pipeline2 255 255 255 255 +CLEAR pipeline2 +RUN pipeline1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +EXPECT framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/rasterization/depth_bias/d32_sfloat.amber b/vulkan/amber/rasterization/depth_bias/d32_sfloat.amber new file mode 100644 index 0000000..918bbca --- /dev/null +++ b/vulkan/amber/rasterization/depth_bias/d32_sfloat.amber @@ -0,0 +1,153 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This test draws two quads with depth values 0.3 and 0.5. Based on the equation in +# Vulkan spec 26.12.3 the effective constant bias o is calculated as follows: + +# Both quads have a constant depth value, thus the maximum depth slope m is zero. +# The maximum exponent e is taken from the constant depth value. +# For depth value 0.3 e is -2, and for value 0.5 it's -1. + +# 32bit float format has a mantissa size of 23 making n = 23. +# The minimum resolvable difference r is calculated as r = 2^(e-n). + +# Thus the constant bias o values are: +# 4194304 * r = 4194304 * 2^(-2-23) = 4194304 * 2^-25 = 0.125 +# and +# 4194304 * r = 4194304 * 2^(-1-23) = 4194304 * 2^-24 = 0.25 + +# Adding this to the existing quad depth values should result as +# 0.3 + 0.125 = 0.425 and 0.5 + 0.25 = 0.75. + +# The depth buffer is dumped as a RGBA8 image making the expected results +# roughly 0.425 * 255 = 108 and 0.75 * 255 = 191. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; +layout(location = 0) out vec4 frag_color; + +layout(set = 0, binding = 0) readonly buffer block1 { + vec4 in_color; + float depth; +}; + +void main() { + gl_Position = vec4(position.xy, depth, 1.0); + frag_color = in_color; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) in vec4 frag_color; +layout(location = 0) out vec4 final_color; + +void main() { + final_color = frag_color; +} +END + +SHADER vertex vert_shader_tex GLSL +#version 430 +layout(location = 0) in vec4 position; +layout(location = 1) in vec2 texcoords_in; +layout(location = 0) out vec2 texcoords_out; +void main() { + gl_Position = position; + texcoords_out = texcoords_in; +} +END + +SHADER fragment frag_shader_tex GLSL +#version 430 +layout(location = 0) in vec2 texcoords_in; +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) sampler2D tex_sampler; +void main() { + float f = texture(tex_sampler, texcoords_in).r; + color_out = vec4(f, f, f, 1); +} +END + +BUFFER data_buf1 DATA_TYPE float DATA 1.0 0.0 0.0 1.0 0.3 END +BUFFER data_buf2 DATA_TYPE float DATA 0.0 1.0 0.0 1.0 0.5 END + +BUFFER position DATA_TYPE vec2 DATA +-1.0 -1.0 + 1.0 -1.0 +-1.0 1.0 + 1.0 1.0 +END +BUFFER texcoords DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +0.0 1.0 +1.0 1.0 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER ddump FORMAT B8G8R8A8_UNORM +BUFFER depthstencil FORMAT D32_SFLOAT + +SAMPLER sampler + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + BIND BUFFER data_buf1 AS storage DESCRIPTOR_SET 0 BINDING 0 + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 4194304.0 clamp 0.0 slope 2.0 + END +END + +DERIVE_PIPELINE pipeline2 FROM pipeline1 + BIND BUFFER data_buf2 AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +PIPELINE graphics depthdump + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoords LOCATION 1 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump AS color LOCATION 0 +END + +CLEAR_DEPTH pipeline1 1.0 +CLEAR_COLOR pipeline1 255 255 255 255 +CLEAR pipeline1 +RUN pipeline1 DRAW_RECT POS 0 0 SIZE 200 200 +RUN pipeline2 DRAW_RECT POS 56 56 SIZE 200 200 +RUN depthdump DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 + +EXPECT ddump IDX 0 0 SIZE 1 1 EQ_RGBA 108 108 108 255 TOLERANCE 5% 5% 5% 0 +EXPECT ddump IDX 255 0 SIZE 1 1 EQ_RGBA 255 255 255 255 TOLERANCE 5% 5% 5% 0 +EXPECT ddump IDX 0 255 SIZE 1 1 EQ_RGBA 255 255 255 255 TOLERANCE 5% 5% 5% 0 +EXPECT ddump IDX 255 255 SIZE 1 1 EQ_RGBA 191 191 191 255 TOLERANCE 5% 5% 5% 0 \ No newline at end of file diff --git a/vulkan/amber/rasterization/depth_bias/d32_sfloat_constant_one.amber b/vulkan/amber/rasterization/depth_bias/d32_sfloat_constant_one.amber new file mode 100644 index 0000000..5d12c47 --- /dev/null +++ b/vulkan/amber/rasterization/depth_bias/d32_sfloat_constant_one.amber @@ -0,0 +1,232 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() { + gl_Position = position; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) out vec4 final_color; + +void main() { + final_color = vec4(1.0f); +} +END + +SHADER vertex vert_shader_tex GLSL +#version 430 +layout(location = 0) in vec2 texcoords_in; +layout(location = 0) out vec2 texcoords_out; +void main() { + gl_Position = vec4(texcoords_in * 2.0f - 1.0f, 0.0f, 1.0f); + texcoords_out = texcoords_in; +} +END + +SHADER fragment frag_shader_tex GLSL +#version 430 +layout(location = 0) in vec2 texcoords_in; +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) sampler2D tex_sampler; +void main() { + float f = texture(tex_sampler, texcoords_in).r; + color_out = vec4(f, f, f, 1); +} +END + +BUFFER position_buf1 DATA_TYPE vec4 DATA +-1 -1 0.3 1.0 + 1 -1 0.5 1.0 +-1 1 0.3 1.0 + 1 1 0.5 1.0 +END + +BUFFER texcoords DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +0.0 1.0 +1.0 1.0 +END + +BUFFER depthstencil1 FORMAT D32_SFLOAT +BUFFER depthstencil2 FORMAT D32_SFLOAT +BUFFER depthstencil3 FORMAT D32_SFLOAT +BUFFER ddump1 FORMAT R32_SFLOAT +BUFFER ddump2 FORMAT R32_SFLOAT +BUFFER ddump3 FORMAT R32_SFLOAT +BUFFER results DATA_TYPE float SIZE 2 FILL 0 +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +SAMPLER sampler + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil1 AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics pipeline2 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil2 AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 1.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics pipeline3 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil3 AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant -1.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics depthdump1 + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA texcoords LOCATION 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump1 AS color LOCATION 0 +END + +PIPELINE graphics depthdump2 + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA texcoords LOCATION 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump2 AS color LOCATION 0 +END + +PIPELINE graphics depthdump3 + ATTACH vert_shader_tex + ATTACH frag_shader_tex + BIND BUFFER depthstencil3 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA texcoords LOCATION 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER ddump3 AS color LOCATION 0 +END + +SHADER compute verification_shader GLSL +#version 430 +layout(local_size_x=1,local_size_y=1) in; +uniform layout (set=0, binding=0, r32f) image2D texture1; +uniform layout (set=0, binding=1, r32f) image2D texture2; +uniform layout (set=0, binding=2, r32f) image2D texture3; +layout(set = 0, binding = 3) buffer Result { + float result0; + float result1; +}; + +void main () { + float r0 = 1.0f / pow(2.0f, 25.0f); + float r1 = 1.0f / pow(2.0f, 24.0f); + float depth1_1 = imageLoad(texture1, ivec2(0, 0)).r; + float depth1_2 = imageLoad(texture1, ivec2(255, 255)).r; + float depth2_1 = imageLoad(texture2, ivec2(0, 0)).r; + float depth2_2 = imageLoad(texture2, ivec2(255, 255)).r; + float depth3_1 = imageLoad(texture3, ivec2(0, 0)).r; + float depth3_2 = imageLoad(texture3, ivec2(255, 55)).r; + + const float epsilon = 0.00001f; + + if ((distance(depth1_1 + r0, depth2_1) < epsilon || distance(depth1_1 + r1, depth2_1) < epsilon) && (distance(depth1_2 + r0, depth2_2) < epsilon || distance(depth1_2 + r1, depth2_2) < epsilon)) + result0 = 1.0; + else + result0 = 0.0; + + if ((distance(depth1_1 - r0, depth3_1) < epsilon || distance(depth1_1 - r1, depth3_1) < epsilon) && (distance(depth1_2 - r0, depth3_2) < epsilon || distance(depth1_2 - r1, depth3_2) < epsilon)) + result1 = 1.0; + else + result1 = 0.0; +} +END + +PIPELINE compute verification_pipeline + ATTACH verification_shader + BIND BUFFER ddump1 AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER ddump2 AS storage_image DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER ddump3 AS storage_image DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 3 + FRAMEBUFFER_SIZE 256 256 +END + +CLEAR_DEPTH pipeline1 1.0 +CLEAR_COLOR pipeline1 255 255 255 255 +CLEAR pipeline1 +CLEAR_DEPTH pipeline2 1.0 +CLEAR_COLOR pipeline2 255 255 255 255 +CLEAR pipeline2 +CLEAR_DEPTH pipeline3 1.0 +CLEAR_COLOR pipeline3 255 255 255 255 +CLEAR pipeline3 +RUN pipeline1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline3 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN depthdump1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN depthdump2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN depthdump3 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN verification_pipeline 1 1 1 + +EXPECT results IDX 0 EQ 1.0 +EXPECT results IDX 4 EQ 1.0 diff --git a/vulkan/amber/rasterization/depth_bias/d32_sfloat_constant_one_greater.amber b/vulkan/amber/rasterization/depth_bias/d32_sfloat_constant_one_greater.amber new file mode 100644 index 0000000..7964b3d --- /dev/null +++ b/vulkan/amber/rasterization/depth_bias/d32_sfloat_constant_one_greater.amber @@ -0,0 +1,104 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() { + gl_Position = position; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) out vec4 final_color; + +layout(set = 0, binding = 0) readonly buffer block1 { + vec4 in_color; +}; + +void main() { + final_color = in_color; +} +END + +BUFFER position_buf1 DATA_TYPE vec4 DATA +-1 -1 0.3 1.0 + 1 -1 0.5 1.0 +-1 1 0.3 1.0 + 1 1 0.5 1.0 +END + +BUFFER data_buf1 DATA_TYPE float DATA 1.0 0.0 0.0 1.0 END +BUFFER data_buf2 DATA_TYPE float DATA 0.0 1.0 0.0 1.0 END + +BUFFER depthstencil FORMAT D32_SFLOAT +BUFFER framebuffer FORMAT R8G8B8A8_UNORM + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + BIND BUFFER data_buf1 AS storage DESCRIPTOR_SET 0 BINDING 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics pipeline2 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + BIND BUFFER data_buf2 AS storage DESCRIPTOR_SET 0 BINDING 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 1.0 clamp 0.0 slope 0.0 + END +END + +CLEAR_DEPTH pipeline1 1.0 +CLEAR_COLOR pipeline1 255 255 255 255 +CLEAR pipeline1 +CLEAR_DEPTH pipeline2 1.0 +CLEAR_COLOR pipeline2 255 255 255 255 +CLEAR pipeline2 +RUN pipeline1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +EXPECT framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/rasterization/depth_bias/d32_sfloat_constant_one_less.amber b/vulkan/amber/rasterization/depth_bias/d32_sfloat_constant_one_less.amber new file mode 100644 index 0000000..479b00e --- /dev/null +++ b/vulkan/amber/rasterization/depth_bias/d32_sfloat_constant_one_less.amber @@ -0,0 +1,104 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() { + gl_Position = position; +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) out vec4 final_color; + +layout(set = 0, binding = 0) readonly buffer block1 { + vec4 in_color; +}; + +void main() { + final_color = in_color; +} +END + +BUFFER position_buf1 DATA_TYPE vec4 DATA +-1 -1 0.3 1.0 + 1 -1 0.5 1.0 +-1 1 0.3 1.0 + 1 1 0.5 1.0 +END + +BUFFER data_buf1 DATA_TYPE float DATA 1.0 0.0 0.0 1.0 END +BUFFER data_buf2 DATA_TYPE float DATA 0.0 1.0 0.0 1.0 END + +BUFFER depthstencil FORMAT D32_SFLOAT +BUFFER framebuffer FORMAT R8G8B8A8_UNORM + +PIPELINE graphics pipeline1 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + BIND BUFFER data_buf1 AS storage DESCRIPTOR_SET 0 BINDING 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END +END + +PIPELINE graphics pipeline2 + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position_buf1 LOCATION 0 + BIND BUFFER data_buf2 AS storage DESCRIPTOR_SET 0 BINDING 0 + + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depthstencil AS depth_stencil + + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant -1.0 clamp 0.0 slope 0.0 + END +END + +CLEAR_DEPTH pipeline1 1.0 +CLEAR_COLOR pipeline1 255 255 255 255 +CLEAR pipeline1 +CLEAR_DEPTH pipeline2 1.0 +CLEAR_COLOR pipeline2 255 255 255 255 +CLEAR pipeline2 +RUN pipeline1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +RUN pipeline2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4 +EXPECT framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/rasterization/line_continuity/line-strip.amber b/vulkan/amber/rasterization/line_continuity/line-strip.amber new file mode 100644 index 0000000..6312d0e --- /dev/null +++ b/vulkan/amber/rasterization/line_continuity/line-strip.amber @@ -0,0 +1,188 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) out vec4 color; + +void main() +{ + color = vec4(1); +} +END + +SHADER fragment frag_shader_tex GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0, rgba8) readonly image2D texture; +void main() +{ + color_out = imageLoad(texture, ivec2(gl_FragCoord.xy)); +} +END + +SHADER compute compute_shader GLSL +#version 430 +layout(local_size_x=32, local_size_y=4) in; +uniform layout (set=0, binding=0, rgba8) image2D img; + +int w = 256; +int h = 256; +vec4 bg = vec4(0, 0, 0, 1); +vec4 marked = vec4(0, 1, 1, 1); +vec4 error = vec4(1, 0, 0, 1); + +shared ivec2 stack[256]; +shared int stackPtr; +shared bool done; +shared ivec2 pixel; + +void pushMarkedPixel(ivec2 p) +{ + imageStore(img, p, marked); + int slot = atomicAdd(stackPtr, 1); + stack[slot] = p; +} + +ivec2 popMarkedPixel() +{ + int slot = atomicAdd(stackPtr, -1) - 1; + ivec2 p = stack[slot]; + imageStore(img, p, bg); + + return p; +} + +void main () +{ + if (gl_LocalInvocationIndex == 0) + { + stack[0] = ivec2(-1); + stackPtr = 0; + done = false; + + // Use this to break the lines and verify the checker is correct. + //for (int x = 0; x < w; x++) + // imageStore(img, ivec2(x, 128), bg); + //memoryBarrierImage(); + } + + barrier(); + + // Search for any pixel belonging to a line. + // Use 32 x 4 block for the search. + ivec2 p = ivec2(gl_LocalInvocationID) + ivec2(0, 128); + vec4 c = imageLoad(img, p); + // Any of the pixels found by a thread will do as a starting point. + if (c != bg) + stack[0] = p; + + memoryBarrierImage(); + barrier(); + + if (gl_LocalInvocationIndex == 0 && stack[0] != ivec2(-1)) + { + imageStore(img, stack[0], marked); + stackPtr++; + } + + memoryBarrierImage(); + barrier(); + + while (!done) + { + if (gl_LocalInvocationIndex == 0 && stackPtr != 0) + pixel = popMarkedPixel(); + + memoryBarrierImage(); + barrier(); + + if (gl_LocalInvocationID.x < 3 && gl_LocalInvocationID.y < 3) + { + ivec2 p = pixel + ivec2(gl_LocalInvocationID) - ivec2(1); + if (p.x >= 0 && p.y >= 0 && p.x < w && p.y < h) + { + vec4 c = imageLoad(img, p); + if (c != marked && c != bg) + { + pushMarkedPixel(p); + } + } + } + + memoryBarrierImage(); + barrier(); + + if (gl_LocalInvocationIndex == 0 && stackPtr < 1) + done = true; + + barrier(); + } +} +END + +BUFFER position DATA_TYPE R8G8B8A8_SNORM DATA +-120 -120 0 127 +-119 120 0 127 + 120 119 0 127 + 10 20 0 127 + -80 20 0 127 + -80 95 0 127 + -83 95 0 127 + -83 -95 0 127 + -85 95 0 127 +END + +BUFFER texture FORMAT R8G8B8A8_UNORM +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position LOCATION 0 + + BIND BUFFER texture AS color LOCATION 0 + FRAMEBUFFER_SIZE 256 256 +END + +PIPELINE graphics tex_pipeline + ATTACH vert_shader + ATTACH frag_shader_tex + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE compute verification_pipeline + ATTACH compute_shader + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 +END + +CLEAR_COLOR pipeline 0 0 0 255 +CLEAR pipeline + +RUN pipeline DRAW_ARRAY AS LINE_STRIP START_IDX 0 COUNT 9 +RUN verification_pipeline 1 1 1 +RUN tex_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# Everything should be clear color since the checker consumes +# the drawn pixels if they are continuous. +EXPECT framebuffer IDX 0 0 SIZE 256 255 EQ_RGBA 0 0 0 255 diff --git a/vulkan/amber/rasterization/line_continuity/polygon-mode-lines.amber b/vulkan/amber/rasterization/line_continuity/polygon-mode-lines.amber new file mode 100644 index 0000000..fd085eb --- /dev/null +++ b/vulkan/amber/rasterization/line_continuity/polygon-mode-lines.amber @@ -0,0 +1,193 @@ +#!amber +# Copyright 2020 Google LLC. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE fillModeNonSolid + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) out vec4 color; + +void main() +{ + color = vec4(1); +} +END + +SHADER fragment frag_shader_tex GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0, rgba8) readonly image2D texture; +void main() +{ + color_out = imageLoad(texture, ivec2(gl_FragCoord.xy)); +} +END + +SHADER compute compute_shader GLSL +#version 430 +layout(local_size_x=32, local_size_y=4) in; +uniform layout (set=0, binding=0, rgba8) image2D img; + +int w = 256; +int h = 256; +vec4 bg = vec4(0, 0, 0, 1); +vec4 marked = vec4(0, 1, 1, 1); +vec4 error = vec4(1, 0, 0, 1); + +shared ivec2 stack[256]; +shared int stackPtr; +shared bool done; +shared ivec2 pixel; + +void pushMarkedPixel(ivec2 p) +{ + imageStore(img, p, marked); + int slot = atomicAdd(stackPtr, 1); + stack[slot] = p; +} + +ivec2 popMarkedPixel() +{ + int slot = atomicAdd(stackPtr, -1) - 1; + ivec2 p = stack[slot]; + imageStore(img, p, bg); + + return p; +} + +void main () +{ + if (gl_LocalInvocationIndex == 0) + { + stack[0] = ivec2(-1); + stackPtr = 0; + done = false; + + // Use this to break the lines and verify the checker is correct. + //for (int x = 0; x < w; x++) + // imageStore(img, ivec2(x, 128), bg); + //memoryBarrierImage(); + } + + barrier(); + + // Search for any pixel belonging to a line. + // Use 32 x 4 block for the search. + ivec2 p = ivec2(gl_LocalInvocationID) + ivec2(0, 10); + vec4 c = imageLoad(img, p); + // Any of the pixels found by a thread will do as a starting point. + if (c != bg) + stack[0] = p; + + memoryBarrierImage(); + barrier(); + + if (gl_LocalInvocationIndex == 0 && stack[0] != ivec2(-1)) + { + imageStore(img, stack[0], marked); + stackPtr++; + } + + memoryBarrierImage(); + barrier(); + + while (!done) + { + if (gl_LocalInvocationIndex == 0 && stackPtr != 0) + pixel = popMarkedPixel(); + + memoryBarrierImage(); + barrier(); + + if (gl_LocalInvocationID.x < 3 && gl_LocalInvocationID.y < 3) + { + ivec2 p = pixel + ivec2(gl_LocalInvocationID) - ivec2(1); + if (p.x >= 0 && p.y >= 0 && p.x < w && p.y < h) + { + vec4 c = imageLoad(img, p); + if (c != marked && c != bg) + { + pushMarkedPixel(p); + } + } + } + + memoryBarrierImage(); + barrier(); + + if (gl_LocalInvocationIndex == 0 && stackPtr < 1) + done = true; + + barrier(); + } +} +END + +BUFFER position DATA_TYPE R8G8B8A8_SNORM DATA +-120 -120 0 127 + 0 120 0 127 + 120 -120 0 127 + + 0 0 0 127 +120 0 0 127 + 60 -60 0 127 + +-100 100 0 127 + 110 100 0 127 + 110 103 0 127 +END + +BUFFER texture FORMAT R8G8B8A8_UNORM +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA position LOCATION 0 + POLYGON_MODE line + + BIND BUFFER texture AS color LOCATION 0 + FRAMEBUFFER_SIZE 256 256 +END + +PIPELINE graphics tex_pipeline + ATTACH vert_shader + ATTACH frag_shader_tex + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +PIPELINE compute verification_pipeline + ATTACH compute_shader + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 +END + +CLEAR_COLOR pipeline 0 0 0 255 +CLEAR pipeline + +RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 9 +RUN verification_pipeline 1 1 1 +RUN tex_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# Everything should be clear color since the checker consumes +# the drawn pixels if they are continuous. +EXPECT framebuffer IDX 0 0 SIZE 256 255 EQ_RGBA 0 0 0 255 diff --git a/vulkan/amber/ray_tracing/barycentrics.amber b/vulkan/amber/ray_tracing/barycentrics.amber new file mode 100644 index 0000000..b564fe8 --- /dev/null +++ b/vulkan/amber/ray_tracing/barycentrics.amber @@ -0,0 +1,111 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_acceleration_structure +DEVICE_EXTENSION VK_KHR_ray_tracing_pipeline +DEVICE_EXTENSION VK_KHR_buffer_device_address +DEVICE_FEATURE RayTracingPipelineFeaturesKHR.rayTracingPipeline +DEVICE_FEATURE AccelerationStructureFeaturesKHR.accelerationStructure +DEVICE_FEATURE BufferDeviceAddressFeatures.bufferDeviceAddress + +SHADER ray_generation raygeneration1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(push_constant) uniform block1 { + uint width; + }; + + layout(location = 0) rayPayloadEXT float payload; + layout(set = 0, binding = 0) uniform accelerationStructureEXT gScene; + layout(set = 0, binding = 1, r32f) uniform image1D result; + + // Launch a set of rays 0.0...1.0 in screen space + void main() + { + uvec2 dims = gl_LaunchSizeEXT.xy; + uvec2 index = gl_LaunchIDEXT.xy; + payload = -1.0; + // Screen position for the ray + vec2 fragCoord = ((index.xy + vec2(0.5f)) / dims) * 2.0f - 1.0f; + + // Should show part of the triangle. Trianlge should be centered at 0, 0, 1.0s + float TMin = 1.0e-4f; + float TMax = 1.0e+38f; + vec3 Origin = vec3(fragCoord.x, fragCoord.y, 0.0); + vec3 Direction = vec3(0, 0, 1); + traceRayEXT(gScene, gl_RayFlagsNoneEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); + imageStore(result, int(index.y * width + index.x), vec4(payload, 0, 0, 0)); +} +END + +SHADER miss miss1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT float payload; + + void main() { + payload = 0.0; // Miss is 0.0 + } +END + +SHADER closest_hit closesthit1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + hitAttributeEXT vec2 barycentrics; + layout(location = 0) rayPayloadInEXT float payload; + + void main() + { + // Hit is 1.0 + // First two digits of the x barycentrics + payload = round(barycentrics.x * 100); + } +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL triangle_blas + GEOMETRY TRIANGLES + 0.0 -0.75 1.0 + -0.75 0.75 1.0 + 0.75 0.75 1.0 + END +END +ACCELERATION_STRUCTURE TOP_LEVEL triangle_tlas + BOTTOM_LEVEL_INSTANCE triangle_blas END +END + +# Buffer to hold output +IMAGE outbuf FORMAT R32_SFLOAT DIM_1D WIDTH 64 FILL 0 + +BUFFER push_const_buf DATA_TYPE uint32 DATA 8 END + +PIPELINE raytracing my_rtpipeline + MAX_RAY_PAYLOAD_SIZE 16 + MAX_RAY_HIT_ATTRIBUTE_SIZE 8 + MAX_RAY_RECURSION_DEPTH 1 + BIND ACCELERATION_STRUCTURE triangle_tlas DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER outbuf AS storage_image DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER push_const_buf AS push_constant + SHADER_GROUP group_rgen raygeneration1 + SHADER_GROUP group_miss1 miss1 + SHADER_GROUP group_hits closesthit1 + # Build shader tables + SHADER_BINDING_TABLE sbt_raygen + group_rgen + END + SHADER_BINDING_TABLE sbt_miss + group_miss1 + END + SHADER_BINDING_TABLE sbt_hit + group_hits + END +END + +RUN my_rtpipeline RAYGEN sbt_raygen MISS sbt_miss HIT sbt_hit 8 8 1 + +EXPECT outbuf IDX 0 TOLERANCE 1 EQ 0 0 0 0 0 0 0 0 +EXPECT outbuf IDX 32 TOLERANCE 1 EQ 0 0 0 0 0 0 0 0 +EXPECT outbuf IDX 64 TOLERANCE 1 EQ 0 0 0 21 4 0 0 0 +EXPECT outbuf IDX 96 TOLERANCE 1 EQ 0 0 0 29 12 0 0 0 +EXPECT outbuf IDX 128 TOLERANCE 1 EQ 0 0 54 38 21 4 0 0 +EXPECT outbuf IDX 160 TOLERANCE 1 EQ 0 0 62 46 29 12 0 0 +EXPECT outbuf IDX 192 TOLERANCE 1 EQ 0 88 71 54 38 21 4 0 +EXPECT outbuf IDX 224 TOLERANCE 1 EQ 0 0 0 0 0 0 0 0 diff --git a/vulkan/amber/ray_tracing/basic.amber b/vulkan/amber/ray_tracing/basic.amber new file mode 100644 index 0000000..97aea8f --- /dev/null +++ b/vulkan/amber/ray_tracing/basic.amber @@ -0,0 +1,110 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_acceleration_structure +DEVICE_EXTENSION VK_KHR_ray_tracing_pipeline +DEVICE_EXTENSION VK_KHR_buffer_device_address +DEVICE_FEATURE RayTracingPipelineFeaturesKHR.rayTracingPipeline +DEVICE_FEATURE AccelerationStructureFeaturesKHR.accelerationStructure +DEVICE_FEATURE BufferDeviceAddressFeatures.bufferDeviceAddress + +SHADER ray_generation r1 GLSL +#version 460 core +#extension GL_EXT_ray_tracing : require +layout(set = 0, binding = 0, r32i) uniform iimage2D result; + +void main() +{ + ivec2 p = ivec2(gl_LaunchIDEXT); + ivec3 v = ivec3(gl_LaunchIDEXT); + int r = v.x + 256 * (v.y + 256 * v.z) + 1; + ivec4 c = ivec4(r,0,0,1); + imageStore(result, p, c); +} +END + +SHADER intersection i1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + hitAttributeEXT vec3 hitAttribute; + void main() + { + reportIntersectionEXT(0.95f, 0x7Eu); + } +END + +SHADER miss m1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT uvec4 hitValue; + void main() + { + hitValue = uvec4(1,0,0,1); + } +END + +SHADER closest_hit c1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + hitAttributeEXT vec3 attribs; + layout(location = 0) rayPayloadInEXT vec3 hitValue; + void main() + { + } +END + +SHADER any_hit a1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + hitAttributeEXT vec3 attribs; + layout(location = 0) rayPayloadInEXT vec3 hitValue; + void main() + { + } +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL blas1 + GEOMETRY AABBS + 0.0 0.0 -0.1 1.0 1.0 0.1 + END +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL blas2 + GEOMETRY TRIANGLES + -1.0 1.0 0.1 + 1.0 1.0 0.1 + -1.0 -1.0 0.1 + 1.0 -1.0 0.1 + -1.0 -1.0 0.1 + 1.0 1.0 0.1 + END +END + +ACCELERATION_STRUCTURE TOP_LEVEL tlas1 + BOTTOM_LEVEL_INSTANCE blas2 + END +END + +IMAGE img1 FORMAT R32_SINT DIM_2D WIDTH 2 HEIGHT 2 FILL 0 + +PIPELINE raytracing my_rtpipeline + BIND BUFFER img1 AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND ACCELERATION_STRUCTURE tlas1 DESCRIPTOR_SET 0 BINDING 1 + SHADER_GROUP g1 r1 + SHADER_GROUP g2 m1 + SHADER_GROUP g3 a1 c1 i1 + + SHADER_BINDING_TABLE raygen_sbt + g1 + END + SHADER_BINDING_TABLE miss_sbt + g2 + END + SHADER_BINDING_TABLE hit_sbt + g3 + END +END + +RUN my_rtpipeline RAYGEN raygen_sbt 2 2 1 + +EXPECT img1 IDX 0 EQ 1 2 257 258 +#EXPECT img1 IDX 0 EQ 1 diff --git a/vulkan/amber/ray_tracing/basic2.amber b/vulkan/amber/ray_tracing/basic2.amber new file mode 100644 index 0000000..80ed5cb --- /dev/null +++ b/vulkan/amber/ray_tracing/basic2.amber @@ -0,0 +1,202 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_acceleration_structure +DEVICE_EXTENSION VK_KHR_ray_tracing_pipeline +DEVICE_EXTENSION VK_KHR_buffer_device_address +DEVICE_FEATURE RayTracingPipelineFeaturesKHR.rayTracingPipeline +DEVICE_FEATURE AccelerationStructureFeaturesKHR.accelerationStructure +DEVICE_FEATURE BufferDeviceAddressFeatures.bufferDeviceAddress + +SHADER ray_generation raygen1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadEXT vec3 hitValue; + layout(set = 0, binding = 0) uniform accelerationStructureEXT topLevelAS; + void main() + { + traceRayEXT(topLevelAS, 0u, 0xFFu, 0, 0, 0, vec3(0.5, 0.5, 0.0), 0.0, vec3(0.0, 0.0, -1.0), 9.0, 0); + } +END +SHADER ray_generation raygen2 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadEXT vec3 hitValue; + layout(set = 0, binding = 0) uniform accelerationStructureEXT topLevelAS; + void main() + { + traceRayEXT(topLevelAS, 0u, 0xFFu, 0, 0, 0, vec3(0.5, 0.5, 0.0), 0.0, vec3(0.0, 0.0, -1.0), 9.0, 0); + } +END + +SHADER miss miss1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT vec3 hitValue; + void main() + { + hitValue = vec3(1,0,0); + } +END + +SHADER miss miss2 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT vec3 hitValue; + void main() + { + hitValue = vec3(1,0,0); + } +END + +SHADER closest_hit closesthit1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + hitAttributeEXT vec3 attribs; + layout(location = 0) rayPayloadInEXT vec3 hitValue; + void main() + { + } +END + +SHADER closest_hit closesthit2 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + hitAttributeEXT vec3 attribs; + layout(location = 0) rayPayloadInEXT vec3 hitValue; + void main() + { + } +END + +SHADER any_hit anyhit1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + hitAttributeEXT vec3 attribs; + layout(location = 0) rayPayloadInEXT vec3 hitValue; + void main() + { + } +END + +SHADER any_hit anyhit2 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + hitAttributeEXT vec3 attribs; + layout(location = 0) rayPayloadInEXT vec3 hitValue; + void main() + { + } +END + +SHADER intersection intersection1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + hitAttributeEXT vec3 hitAttribute; + void main() + { + reportIntersectionEXT(0.95f, 0x7Eu); + } +END + +SHADER intersection intersection2 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + hitAttributeEXT vec3 hitAttribute; + void main() + { + reportIntersectionEXT(0.95f, 0x7Eu); + } +END + +SHADER callable call1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) callableDataInEXT float dummy; + void main() + { + } +END + +SHADER callable call2 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) callableDataInEXT float dummy; + void main() + { + } +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL triangles + GEOMETRY TRIANGLES + 0.0 -0.75 1.0 + -0.75 0.75 1.0 + 0.75 0.75 1.0 + END + GEOMETRY TRIANGLES + 0.0 -0.75 1.0 + -0.75 0.75 1.0 + 0.75 0.75 1.0 + END +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL aabbs + GEOMETRY AABBS + -0.5 -0.75 -1.0 0.50 0.75 1.0 + -0.33 -0.75 -1.0 0.33 0.75 1.0 + END + GEOMETRY AABBS + -1.50 -1.75 -1.0 1.50 1.75 1.0 + -2.33 -2.75 -2.0 2.33 2.75 2.0 + -3.50 -3.75 -3.0 3.50 3.75 3.0 + END +END + +ACCELERATION_STRUCTURE TOP_LEVEL tlas1 + BOTTOM_LEVEL_INSTANCE triangles + END + BOTTOM_LEVEL_INSTANCE triangles + INDEX 0 + OFFSET 1 + FLAGS TRIANGLE_FACING_CULL_DISABLE TRIANGLE_FLIP_FACING FORCE_OPAQUE FORCE_OPACITY_MICROMAP_2_STATE + TRANSFORM + 1 0 0 0.5 + 0 1 0 0.5 + 0 0 1 0.3 + END + END + BOTTOM_LEVEL_INSTANCE aabbs + INDEX 0 + OFFSET 1 + MASK 0x0F + FLAGS + FORCE_NO_OPAQUE + DISABLE_OPACITY_MICROMAPS + 1 + END + END +END + +PIPELINE raytracing my_rtpipeline + BIND ACCELERATION_STRUCTURE tlas1 DESCRIPTOR_SET 0 BINDING 0 + SHADER_GROUP g1 raygen1 + SHADER_GROUP g2 miss1 + SHADER_GROUP g3 anyhit1 closesthit1 intersection1 + SHADER_GROUP g4 raygen2 + SHADER_GROUP g5 miss2 + SHADER_GROUP g6 anyhit2 closesthit2 intersection2 + SHADER_GROUP g7 call1 + SHADER_GROUP g8 call2 + SHADER_BINDING_TABLE sbt1 + g1 + END + SHADER_BINDING_TABLE sbt2 + g2 + g5 + END + SHADER_BINDING_TABLE sbt3 + g3 + g6 + END +END + +RUN my_rtpipeline RAYGEN sbt1 MISS sbt2 HIT sbt3 1920 1080 1 diff --git a/vulkan/amber/ray_tracing/basic_lib.amber b/vulkan/amber/ray_tracing/basic_lib.amber new file mode 100644 index 0000000..0948e6c --- /dev/null +++ b/vulkan/amber/ray_tracing/basic_lib.amber @@ -0,0 +1,156 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_acceleration_structure +DEVICE_EXTENSION VK_KHR_ray_tracing_pipeline +DEVICE_EXTENSION VK_KHR_buffer_device_address +DEVICE_EXTENSION VK_KHR_pipeline_library +DEVICE_FEATURE RayTracingPipelineFeaturesKHR.rayTracingPipeline +DEVICE_FEATURE AccelerationStructureFeaturesKHR.accelerationStructure +DEVICE_FEATURE BufferDeviceAddressFeatures.bufferDeviceAddress + +SHADER ray_generation raygen1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadEXT uint payload; + layout(set = 0, binding = 0) uniform accelerationStructureEXT topLevelAS; + layout(set = 0, binding = 1, r32ui) uniform uimage2D result; + void main() + { + for (uint i = 0; i < 3; i++) + { + payload = 0; + // Set origin to trigger miss + traceRayEXT( + topLevelAS, // accelerationStructureEXT topLevel, + 0u, // uint rayFlags + 0xFFu, // uint cullMask, + 0, // uint sbtRecordOffset, + 0, // uint sbtRecordStride, + i, // uint missIndex, + vec3(0.0, 0.0, 0.0), // vec3 origin, + 0.0, // float Tmin, + vec3(0.0, 0.0, -1.0), // vec3 direction, + 0.25, // float Tmax, + 0 // int payload + ); + imageStore(result, ivec2(i, 0), uvec4(payload, 0u, 0u, 0u)); + } + } +END + +SHADER miss miss1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT uint payload; + void main() + { + payload = 1; + } +END + +SHADER miss miss2 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT uint payload; + void main() + { + payload = 2; + } +END + +SHADER miss miss3 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT uint payload; + void main() + { + payload = 3; + } +END + +SHADER closest_hit closesthit1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + hitAttributeEXT vec3 attribs; + layout(location = 0) rayPayloadInEXT uint payload; + void main() + { + } +END + +SHADER any_hit anyhit1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + hitAttributeEXT vec3 attribs; + layout(location = 0) rayPayloadInEXT uint payload; + void main() + { + } +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL triangles + GEOMETRY TRIANGLES + -1 -1 1 + -1 1 1 + 1 1 1 + END + GEOMETRY TRIANGLES + 1 1 1 + 1 -1 1 + -1 -1 1 + END +END + +ACCELERATION_STRUCTURE TOP_LEVEL tlas1 + BOTTOM_LEVEL_INSTANCE triangles + END +END + +IMAGE img1 FORMAT R32_UINT DIM_2D WIDTH 4 HEIGHT 1 FILL 0 + +PIPELINE raytracing my_rtlib_bottom + MAX_RAY_PAYLOAD_SIZE 16 + MAX_RAY_HIT_ATTRIBUTE_SIZE 16 + BIND ACCELERATION_STRUCTURE tlas1 DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER img1 AS storage_image DESCRIPTOR_SET 0 BINDING 1 + + FLAGS LIBRARY + SHADER_GROUP g_miss3 miss3 +END + +PIPELINE raytracing my_rtlib + USE_LIBRARY my_rtlib_bottom + MAX_RAY_PAYLOAD_SIZE 16 + MAX_RAY_HIT_ATTRIBUTE_SIZE 16 + BIND ACCELERATION_STRUCTURE tlas1 DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER img1 AS storage_image DESCRIPTOR_SET 0 BINDING 1 + + FLAGS LIBRARY + SHADER_GROUP g_miss2 miss2 +END + +PIPELINE raytracing my_rtpipeline + USE_LIBRARY my_rtlib + MAX_RAY_PAYLOAD_SIZE 16 + MAX_RAY_HIT_ATTRIBUTE_SIZE 16 + BIND ACCELERATION_STRUCTURE tlas1 DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER img1 AS storage_image DESCRIPTOR_SET 0 BINDING 1 + SHADER_GROUP g_rgen raygen1 + SHADER_GROUP g_miss1 miss1 + SHADER_GROUP g_hits anyhit1 closesthit1 + SHADER_BINDING_TABLE sbt_raygen + g_rgen + END + SHADER_BINDING_TABLE sbt_miss + g_miss1 + g_miss2 + g_miss3 + END + SHADER_BINDING_TABLE sbt_hit + g_hits + END +END + +RUN my_rtpipeline RAYGEN sbt_raygen MISS sbt_miss HIT sbt_hit 1 1 1 + +EXPECT img1 IDX 0 EQ 1 2 3 diff --git a/vulkan/amber/ray_tracing/different-payload-sizes.amber b/vulkan/amber/ray_tracing/different-payload-sizes.amber new file mode 100644 index 0000000..493a947 --- /dev/null +++ b/vulkan/amber/ray_tracing/different-payload-sizes.amber @@ -0,0 +1,87 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_acceleration_structure +DEVICE_EXTENSION VK_KHR_ray_tracing_pipeline +DEVICE_EXTENSION VK_KHR_buffer_device_address +DEVICE_EXTENSION VK_KHR_pipeline_library +DEVICE_FEATURE RayTracingPipelineFeaturesKHR.rayTracingPipeline +DEVICE_FEATURE AccelerationStructureFeaturesKHR.accelerationStructure +DEVICE_FEATURE BufferDeviceAddressFeatures.bufferDeviceAddress + +SHADER ray_generation raygen1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadEXT uint payload0; + layout(location = 1) rayPayloadEXT uvec4 payload1; + layout(set = 0, binding = 0) uniform accelerationStructureEXT topLevelAS; + layout(set = 0, binding = 1, r32ui) uniform uimage2D result; + void main() + { + float TMin = 0.1; + float TMax = 10; + uint flags = gl_RayFlagsNoneEXT; + uint mask = 0xFF; + vec3 Origin = vec3(0, 0, 0); // Set origin to trigger miss + vec3 Direction = vec3(0, 0, -1); + + payload0 = 100; + traceRayEXT(topLevelAS, flags, mask, 0, 0, 0, Origin, TMin, Direction, TMax, 0); + imageStore(result, ivec2(0, 0), uvec4(payload0, 0u, 0u, 0u)); + + payload1 = uvec4(200); + traceRayEXT(topLevelAS, flags, mask, 0, 0, 1, Origin, TMin, Direction, TMax, 1); + imageStore(result, ivec2(1, 0), uvec4(payload1.x, 0u, 0u, 0u)); + } +END + +SHADER miss miss1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT uint payload; + void main() + { + payload = 1; + } +END + +SHADER miss miss2 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 1) rayPayloadInEXT uvec4 payload; + void main() + { + payload.x = 2; + } +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL triangle_blas + GEOMETRY TRIANGLES + 0.0 -0.75 1.0 + -0.75 0.75 1.0 + 0.75 0.75 1.0 + END +END +ACCELERATION_STRUCTURE TOP_LEVEL triangle_tlas + BOTTOM_LEVEL_INSTANCE triangle_blas END +END + +IMAGE img1 FORMAT R32_UINT DIM_2D WIDTH 2 HEIGHT 1 FILL 0 + +PIPELINE raytracing my_rtpipeline + BIND ACCELERATION_STRUCTURE triangle_tlas DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER img1 AS storage_image DESCRIPTOR_SET 0 BINDING 1 + SHADER_GROUP g_rgen raygen1 + SHADER_GROUP g_miss1 miss1 + SHADER_GROUP g_miss2 miss2 + SHADER_BINDING_TABLE sbt_raygen + g_rgen + END + SHADER_BINDING_TABLE sbt_miss + g_miss1 + g_miss2 + END +END + +RUN my_rtpipeline RAYGEN sbt_raygen MISS sbt_miss 1 1 1 + +EXPECT img1 IDX 0 EQ 1 2 diff --git a/vulkan/amber/ray_tracing/divergent-as.amber b/vulkan/amber/ray_tracing/divergent-as.amber new file mode 100644 index 0000000..9be71d8 --- /dev/null +++ b/vulkan/amber/ray_tracing/divergent-as.amber @@ -0,0 +1,102 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_acceleration_structure +DEVICE_EXTENSION VK_KHR_ray_tracing_pipeline +DEVICE_EXTENSION VK_KHR_buffer_device_address +DEVICE_EXTENSION VK_KHR_pipeline_library +DEVICE_FEATURE RayTracingPipelineFeaturesKHR.rayTracingPipeline +DEVICE_FEATURE AccelerationStructureFeaturesKHR.accelerationStructure +DEVICE_FEATURE BufferDeviceAddressFeatures.bufferDeviceAddress + +SHADER ray_generation raygen1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadEXT int payload; + layout(set = 0, binding = 0) uniform accelerationStructureEXT topLevelAS1; + layout(set = 0, binding = 1) uniform accelerationStructureEXT topLevelAS2; + layout(set = 0, binding = 2, r32i) uniform iimage1D result; + void main() + { + float TMin = 0.1; + float TMax = 10; + uint flags = gl_RayFlagsNoneEXT; + uint mask = 0xFF; + int index = int(gl_LaunchIDEXT.x); + vec3 Origin = vec3(0, 0, 0); + vec3 Direction = vec3(0, 0, 1); + + payload = -1; + if (index % 3 == 0) { + traceRayEXT(topLevelAS1, flags, mask, 0, 0, 0, Origin, TMin, Direction, TMax, 0); + } else { + traceRayEXT(topLevelAS2, flags, mask, 0, 0, 0, Origin, TMin, Direction, TMax, 0); + } + imageStore(result, index, ivec4(payload + index, 0u, 0u, 0u)); + } +END + +SHADER miss miss1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT int payload; + void main() + { + payload = 10; + } +END + +SHADER closest_hit closesthit1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT int payload; + void main() + { + payload = 20; + } +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL triangle_blas + GEOMETRY TRIANGLES + 0.0 -0.75 1.0 + -0.75 0.75 1.0 + 0.75 0.75 1.0 + END +END +ACCELERATION_STRUCTURE TOP_LEVEL triangle_tlas + BOTTOM_LEVEL_INSTANCE triangle_blas END +END + +ACCELERATION_STRUCTURE TOP_LEVEL triangle_tlas2 + BOTTOM_LEVEL_INSTANCE triangle_blas + TRANSFORM + 1 0 0 0.0 + 0 1 0 0.0 + 0 0 1 -2.0 + END + END +END + +IMAGE outbuf FORMAT R32_SINT DIM_1D WIDTH 6 FILL 0 + +PIPELINE raytracing my_rtpipeline + BIND ACCELERATION_STRUCTURE triangle_tlas DESCRIPTOR_SET 0 BINDING 0 + BIND ACCELERATION_STRUCTURE triangle_tlas2 DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER outbuf AS storage_image DESCRIPTOR_SET 0 BINDING 2 + SHADER_GROUP g_rgen raygen1 + SHADER_GROUP g_miss miss1 + SHADER_GROUP g_hits closesthit1 + SHADER_BINDING_TABLE sbt_raygen + g_rgen + END + SHADER_BINDING_TABLE sbt_miss + g_miss + END + SHADER_BINDING_TABLE sbt_hit + g_hits + END +END + +RUN my_rtpipeline RAYGEN sbt_raygen MISS sbt_miss HIT sbt_hit 6 1 1 + +EXPECT outbuf IDX 0 EQ 20 11 12 23 14 15 + diff --git a/vulkan/amber/ray_tracing/flags-accept-first.amber b/vulkan/amber/ray_tracing/flags-accept-first.amber new file mode 100644 index 0000000..f3e5fa5 --- /dev/null +++ b/vulkan/amber/ray_tracing/flags-accept-first.amber @@ -0,0 +1,89 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_acceleration_structure +DEVICE_EXTENSION VK_KHR_ray_tracing_pipeline +DEVICE_EXTENSION VK_KHR_buffer_device_address +DEVICE_FEATURE RayTracingPipelineFeaturesKHR.rayTracingPipeline +DEVICE_FEATURE AccelerationStructureFeaturesKHR.accelerationStructure +DEVICE_FEATURE BufferDeviceAddressFeatures.bufferDeviceAddress + +SHADER ray_generation raygeneration1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadEXT int payload; + layout(set = 0, binding = 0) uniform accelerationStructureEXT gScene; + + void main() + { + float TMin = 0.1; + float TMax = 10; + vec3 Origin = vec3(0, 0, -3); + vec3 Direction = vec3(0, 0, 1); + + payload = 0; + traceRayEXT(gScene, gl_RayFlagsNoneEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); + + payload = 1; + traceRayEXT(gScene, gl_RayFlagsTerminateOnFirstHitEXT , 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); +} +END + +SHADER intersection intersection1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + hitAttributeEXT float hitAttribute; + + void main() + { + reportIntersectionEXT(0.6f, gl_HitKindFrontFacingTriangleEXT); + // In case of gl_RayFlagsTerminateOnFirstHitEXT, we should never reach this part of the code, + // even though this would be the closest hit + reportIntersectionEXT(0.5f, gl_HitKindFrontFacingTriangleEXT); + } +END + +SHADER closest_hit closesthit1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT int payload; + layout(set = 0, binding = 1, r32f) uniform image1D result; + hitAttributeEXT float hitAttribute; + + void main() + { + imageStore(result, payload, vec4(gl_HitTEXT, 0, 0, 0)); + } +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL proc_blas + GEOMETRY AABBS + -2.0 -2.0 -2.0 2.0 2.0 2.0 + END +END + +ACCELERATION_STRUCTURE TOP_LEVEL proc_tlas + BOTTOM_LEVEL_INSTANCE proc_blas + END +END + +IMAGE outbuf FORMAT R32_SFLOAT DIM_1D WIDTH 2 FILL 0 + +PIPELINE raytracing my_rtpipeline + MAX_RAY_PAYLOAD_SIZE 16 + MAX_RAY_HIT_ATTRIBUTE_SIZE 8 + MAX_RAY_RECURSION_DEPTH 1 + BIND ACCELERATION_STRUCTURE proc_tlas DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER outbuf AS storage_image DESCRIPTOR_SET 0 BINDING 1 + SHADER_GROUP group_rgen raygeneration1 + SHADER_GROUP group_hits intersection1 closesthit1 + SHADER_BINDING_TABLE sbt_raygen + group_rgen + END + SHADER_BINDING_TABLE sbt_hit + group_hits + END +END + +RUN my_rtpipeline RAYGEN sbt_raygen HIT sbt_hit 2 1 1 + +EXPECT outbuf IDX 0 EQ 0.5 0.6 diff --git a/vulkan/amber/ray_tracing/flags-culling.amber b/vulkan/amber/ray_tracing/flags-culling.amber new file mode 100644 index 0000000..4720dc6 --- /dev/null +++ b/vulkan/amber/ray_tracing/flags-culling.amber @@ -0,0 +1,114 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_acceleration_structure +DEVICE_EXTENSION VK_KHR_ray_tracing_pipeline +DEVICE_EXTENSION VK_KHR_buffer_device_address +DEVICE_FEATURE RayTracingPipelineFeaturesKHR.rayTracingPipeline +DEVICE_FEATURE AccelerationStructureFeaturesKHR.accelerationStructure +DEVICE_FEATURE BufferDeviceAddressFeatures.bufferDeviceAddress + +SHADER ray_generation raygeneration1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadEXT int payload; + layout(set = 0, binding = 0) uniform accelerationStructureEXT gScene; + + void main() + { + float TMin = 0.1; + float TMax = 10; + vec3 Origin; + vec3 Direction = vec3(0, 0, 1); + + // Ray origin at -1, 0: front facing opaque first (at z = 1) + Origin = vec3(-1, 0, -2); + + payload = 0; + traceRayEXT(gScene, gl_RayFlagsNoneEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); + + payload = 1; + traceRayEXT(gScene, gl_RayFlagsCullFrontFacingTrianglesEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); + + payload = 2; + traceRayEXT(gScene, gl_RayFlagsCullOpaqueEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); + + Origin = vec3(1, 0, -2); + + payload = 3; + traceRayEXT(gScene, gl_RayFlagsNoneEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); + + payload = 4; + traceRayEXT(gScene, gl_RayFlagsCullBackFacingTrianglesEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); + + payload = 5; + traceRayEXT(gScene, gl_RayFlagsCullNoOpaqueEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); +} +END + +SHADER closest_hit closesthit1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT int payload; + layout(set = 0, binding = 1, r32f) uniform image1D result; + + void main() + { + imageStore(result, payload, vec4(round(gl_HitTEXT), 0, 0, 0)); + } +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL triangle_blas + # Front facing opaque triangle at -1, 0, 1 + GEOMETRY TRIANGLES + FLAGS OPAQUE + -1.0 -0.75 1.0 + -1.75 0.75 1.0 + -0.25 0.75 1.0 + END + # Back facing triangle at -1, 0, 2 + GEOMETRY TRIANGLES + -1.0 -0.75 2.0 + -0.25 0.75 2.0 + -1.75 0.75 2.0 + END + # Back facing triangle at 1, 0, 1 + GEOMETRY TRIANGLES + 1.0 -0.75 1.0 + 1.75 0.75 1.0 + 0.25 0.75 1.0 + END + # Front facing opaque triangle at 1, 0, 2 + GEOMETRY TRIANGLES + FLAGS OPAQUE + 1.0 -0.75 2.0 + 0.25 0.75 2.0 + 1.75 0.75 2.0 + END +END + +ACCELERATION_STRUCTURE TOP_LEVEL triangle_tlas + BOTTOM_LEVEL_INSTANCE triangle_blas + END +END + +IMAGE outbuf FORMAT R32_SFLOAT DIM_1D WIDTH 6 FILL 0 + +PIPELINE raytracing my_rtpipeline + MAX_RAY_PAYLOAD_SIZE 16 + MAX_RAY_HIT_ATTRIBUTE_SIZE 8 + MAX_RAY_RECURSION_DEPTH 1 + BIND ACCELERATION_STRUCTURE triangle_tlas DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER outbuf AS storage_image DESCRIPTOR_SET 0 BINDING 1 + SHADER_GROUP group_rgen raygeneration1 + SHADER_GROUP group_hits closesthit1 + SHADER_BINDING_TABLE sbt_raygen + group_rgen + END + SHADER_BINDING_TABLE sbt_hit + group_hits + END +END + +RUN my_rtpipeline RAYGEN sbt_raygen HIT sbt_hit 1 1 1 + +EXPECT outbuf IDX 0 EQ 3 4 4 3 4 4 diff --git a/vulkan/amber/ray_tracing/flags-force-non-opaque.amber b/vulkan/amber/ray_tracing/flags-force-non-opaque.amber new file mode 100644 index 0000000..7927542 --- /dev/null +++ b/vulkan/amber/ray_tracing/flags-force-non-opaque.amber @@ -0,0 +1,80 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_acceleration_structure +DEVICE_EXTENSION VK_KHR_ray_tracing_pipeline +DEVICE_EXTENSION VK_KHR_buffer_device_address +DEVICE_FEATURE RayTracingPipelineFeaturesKHR.rayTracingPipeline +DEVICE_FEATURE AccelerationStructureFeaturesKHR.accelerationStructure +DEVICE_FEATURE BufferDeviceAddressFeatures.bufferDeviceAddress + +SHADER ray_generation raygeneration1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadEXT int payload; + layout(set = 0, binding = 0) uniform accelerationStructureEXT gScene; + + void main() + { + float TMin = 0.1; + float TMax = 10; + vec3 Origin = vec3(0, 0, -2); + vec3 Direction = vec3(0, 0, 1); + + // Geometry below is explicitly marked opaque + + // Since we force none opaque, we will call AHS + payload = 0; + traceRayEXT(gScene, gl_RayFlagsNoOpaqueEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); + + // In this case instead, we will not call AHS + payload = 1; + traceRayEXT(gScene, gl_RayFlagsNoneEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); +} +END + +SHADER any_hit anyhit1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT int payload; + layout(set = 0, binding = 1, r32i) uniform iimage1D result; + + void main() + { + imageStore(result, payload, ivec4(1, 0, 0, 0)); + } +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL triangle_blas + GEOMETRY TRIANGLES + 0.0 -0.75 1.0 + -0.75 0.75 1.0 + 0.75 0.75 1.0 + END +END +ACCELERATION_STRUCTURE TOP_LEVEL triangle_tlas + BOTTOM_LEVEL_INSTANCE triangle_blas + FLAGS FORCE_OPAQUE + END +END + +IMAGE outbuf FORMAT R32_SINT DIM_1D WIDTH 2 FILL 0 + +PIPELINE raytracing my_rtpipeline + MAX_RAY_PAYLOAD_SIZE 16 + MAX_RAY_HIT_ATTRIBUTE_SIZE 8 + MAX_RAY_RECURSION_DEPTH 1 + BIND ACCELERATION_STRUCTURE triangle_tlas DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER outbuf AS storage_image DESCRIPTOR_SET 0 BINDING 1 + SHADER_GROUP group_rgen raygeneration1 + SHADER_GROUP group_hits anyhit1 + SHADER_BINDING_TABLE sbt_raygen + group_rgen + END + SHADER_BINDING_TABLE sbt_hit + group_hits + END +END + +RUN my_rtpipeline RAYGEN sbt_raygen HIT sbt_hit 2 1 1 + +EXPECT outbuf IDX 0 EQ 1 0 diff --git a/vulkan/amber/ray_tracing/flags-force-opaque.amber b/vulkan/amber/ray_tracing/flags-force-opaque.amber new file mode 100644 index 0000000..72272d3 --- /dev/null +++ b/vulkan/amber/ray_tracing/flags-force-opaque.amber @@ -0,0 +1,76 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_acceleration_structure +DEVICE_EXTENSION VK_KHR_ray_tracing_pipeline +DEVICE_EXTENSION VK_KHR_buffer_device_address +DEVICE_FEATURE RayTracingPipelineFeaturesKHR.rayTracingPipeline +DEVICE_FEATURE AccelerationStructureFeaturesKHR.accelerationStructure +DEVICE_FEATURE BufferDeviceAddressFeatures.bufferDeviceAddress + +SHADER ray_generation raygeneration1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadEXT int payload; + layout(set = 0, binding = 0) uniform accelerationStructureEXT gScene; + + void main() + { + float TMin = 0.1; + float TMax = 10; + vec3 Origin = vec3(0, 0, -2); + vec3 Direction = vec3(0, 0, 1); + + // Since we force opaque, we should never call AHS + payload = 0; + traceRayEXT(gScene, gl_RayFlagsOpaqueEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); + + // In this case instead, we will call AHS + payload = 1; + traceRayEXT(gScene, gl_RayFlagsNoneEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); +} +END + +SHADER any_hit anyhit1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT int payload; + layout(set = 0, binding = 1, r32i) uniform iimage1D result; + + void main() + { + imageStore(result, payload, ivec4(1, 0, 0, 0)); + } +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL triangle_blas + GEOMETRY TRIANGLES + 0.0 -0.75 1.0 + -0.75 0.75 1.0 + 0.75 0.75 1.0 + END +END +ACCELERATION_STRUCTURE TOP_LEVEL triangle_tlas + BOTTOM_LEVEL_INSTANCE triangle_blas END +END + +IMAGE outbuf FORMAT R32_SINT DIM_1D WIDTH 2 FILL 0 + +PIPELINE raytracing my_rtpipeline + MAX_RAY_PAYLOAD_SIZE 16 + MAX_RAY_HIT_ATTRIBUTE_SIZE 8 + MAX_RAY_RECURSION_DEPTH 1 + BIND ACCELERATION_STRUCTURE triangle_tlas DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER outbuf AS storage_image DESCRIPTOR_SET 0 BINDING 1 + SHADER_GROUP group_rgen raygeneration1 + SHADER_GROUP group_hits anyhit1 + SHADER_BINDING_TABLE sbt_raygen + group_rgen + END + SHADER_BINDING_TABLE sbt_hit + group_hits + END +END + +RUN my_rtpipeline RAYGEN sbt_raygen HIT sbt_hit 2 1 1 + +EXPECT outbuf IDX 0 EQ 0 1 diff --git a/vulkan/amber/ray_tracing/flags-skip-chit.amber b/vulkan/amber/ray_tracing/flags-skip-chit.amber new file mode 100644 index 0000000..1004afe --- /dev/null +++ b/vulkan/amber/ray_tracing/flags-skip-chit.amber @@ -0,0 +1,74 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_acceleration_structure +DEVICE_EXTENSION VK_KHR_ray_tracing_pipeline +DEVICE_EXTENSION VK_KHR_buffer_device_address +DEVICE_FEATURE RayTracingPipelineFeaturesKHR.rayTracingPipeline +DEVICE_FEATURE AccelerationStructureFeaturesKHR.accelerationStructure +DEVICE_FEATURE BufferDeviceAddressFeatures.bufferDeviceAddress + +SHADER ray_generation raygeneration1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadEXT int payload; + layout(set = 0, binding = 0) uniform accelerationStructureEXT gScene; + + void main() + { + float TMin = 0.1; + float TMax = 10; + vec3 Origin = vec3(0, 0, -2); + vec3 Direction = vec3(0, 0, 1); + + payload = 0; + traceRayEXT(gScene, gl_RayFlagsNoneEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); + + payload = 1; + traceRayEXT(gScene, gl_RayFlagsSkipClosestHitShaderEXT, 0xff, 0, 0, 0, Origin, TMin, Direction, TMax, 0); +} +END + +SHADER closest_hit closesthit1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT int payload; + layout(set = 0, binding = 1, r32i) uniform iimage1D result; + + void main() + { + imageStore(result, payload, ivec4(1, 0, 0, 0)); + } +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL triangle_blas + GEOMETRY TRIANGLES + 0.0 -0.75 1.0 + -0.75 0.75 1.0 + 0.75 0.75 1.0 + END +END +ACCELERATION_STRUCTURE TOP_LEVEL triangle_tlas + BOTTOM_LEVEL_INSTANCE triangle_blas END +END + +IMAGE outbuf FORMAT R32_SINT DIM_1D WIDTH 2 FILL 0 + +PIPELINE raytracing my_rtpipeline + MAX_RAY_PAYLOAD_SIZE 16 + MAX_RAY_HIT_ATTRIBUTE_SIZE 8 + MAX_RAY_RECURSION_DEPTH 1 + BIND ACCELERATION_STRUCTURE triangle_tlas DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER outbuf AS storage_image DESCRIPTOR_SET 0 BINDING 1 + SHADER_GROUP group_rgen raygeneration1 + SHADER_GROUP group_hits closesthit1 + SHADER_BINDING_TABLE sbt_raygen + group_rgen + END + SHADER_BINDING_TABLE sbt_hit + group_hits + END +END + +RUN my_rtpipeline RAYGEN sbt_raygen HIT sbt_hit 2 1 1 + +EXPECT outbuf IDX 0 EQ 1 0 diff --git a/vulkan/amber/ray_tracing/rt-sample.amber b/vulkan/amber/ray_tracing/rt-sample.amber new file mode 100644 index 0000000..f0863a4 --- /dev/null +++ b/vulkan/amber/ray_tracing/rt-sample.amber @@ -0,0 +1,112 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_deferred_host_operations +DEVICE_EXTENSION VK_KHR_acceleration_structure +DEVICE_EXTENSION VK_KHR_ray_tracing_pipeline +DEVICE_EXTENSION VK_KHR_buffer_device_address +DEVICE_FEATURE RayTracingPipelineFeaturesKHR.rayTracingPipeline +DEVICE_FEATURE AccelerationStructureFeaturesKHR.accelerationStructure +DEVICE_FEATURE BufferDeviceAddressFeatures.bufferDeviceAddress + +SHADER ray_generation raygen1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadEXT uint payload; + layout(set = 0, binding = 0) uniform accelerationStructureEXT topLevelAS; + layout(r32ui, set = 0, binding = 1) uniform uimage2D result; + void main() + { + payload = 1u; + traceRayEXT( + topLevelAS, + gl_RayFlagsNoneEXT, /* rayFlags */ + 0xFFu, /* cullMask */ + 0, /* sbtRecordOffset */ + 0, /* sbtRecordStride */ + 0, /* missIndex */ + vec3(gl_LaunchIDEXT.x + 0.4, 0.4, 0.0), /* origin */ + 0.0, /* Tmin */ + vec3(0.0, 0.0, 1.0), /* direction */ + 3.5, /* Tmax */ + 0 /* payload */); + imageStore(result, ivec2(gl_LaunchIDEXT.xy), uvec4(payload, 0u, 0u, 0u)); + } +END + +SHADER miss miss1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT uint payload; + void main() + { + payload += 1000; + } +END + +SHADER closest_hit closesthit1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT uint payload; + void main() + { + payload += 100; + } +END + +SHADER any_hit anyhit1 GLSL + #version 460 core + #extension GL_EXT_ray_tracing : require + layout(location = 0) rayPayloadInEXT uint payload; + void main() + { + payload += 10 * gl_PrimitiveID; + } +END + +ACCELERATION_STRUCTURE BOTTOM_LEVEL triangles + GEOMETRY TRIANGLES + 0.0 0.0 1.0 + 1.0 0.0 1.0 + 0.0 1.0 1.0 + + 1.0 0.0 2.0 + 2.0 0.0 2.0 + 1.0 1.0 2.0 + + 2.0 0.0 3.0 + 3.0 0.0 3.0 + 2.0 1.0 3.0 + + 3.0 0.0 4.0 + 4.0 0.0 4.0 + 3.0 1.0 4.0 + END +END + +ACCELERATION_STRUCTURE TOP_LEVEL tlas1 + BOTTOM_LEVEL_INSTANCE triangles + END +END + +IMAGE img1 FORMAT R32_UINT DIM_2D WIDTH 4 HEIGHT 1 FILL 0 + +PIPELINE raytracing my_rtpipeline + BIND ACCELERATION_STRUCTURE tlas1 DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER img1 AS storage_image DESCRIPTOR_SET 0 BINDING 1 + SHADER_GROUP rgen_group raygen1 + SHADER_GROUP miss_group miss1 + SHADER_GROUP tri_group anyhit1 closesthit1 + SHADER_BINDING_TABLE sbt1 + rgen_group + END + SHADER_BINDING_TABLE sbt2 + miss_group + END + SHADER_BINDING_TABLE sbt3 + tri_group + END +END + +RUN my_rtpipeline RAYGEN sbt1 MISS sbt2 HIT sbt3 4 1 1 + +EXPECT img1 IDX 0 EQ 101 111 121 1001 diff --git a/vulkan/amber/reconvergence/maximal/fragment/demote_entire_quad.amber b/vulkan/amber/reconvergence/maximal/fragment/demote_entire_quad.amber new file mode 100644 index 0000000..d844456 --- /dev/null +++ b/vulkan/amber/reconvergence/maximal/fragment/demote_entire_quad.amber @@ -0,0 +1,127 @@ +#!amber + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL TARGET_ENV spv1.3 +#version 450 + +#extension GL_EXT_maximal_reconvergence : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_EXT_demote_to_helper_invocation : require + +layout(binding = 0) readonly buffer X { uvec4 fragments; }; +layout(binding = 1) buffer Y { uint result; }; +layout(location = 0) out vec4 dEQP_FragColor; + +void main() +[[maximally_reconverges]] +{ + const uvec4 fullBallot = subgroupBallot( ! helperInvocationEXT() ); + const uint fragmentID = uint(gl_FragCoord.y) * 16 + uint(gl_FragCoord.x); + const uvec4 quadBallot = subgroupBallot((fragments[gl_SubgroupInvocationID % 4] - fragmentID) == 0); + const bool quadSubgroup = subgroupBallotBitCount(quadBallot) == 4; + + if (quadSubgroup && subgroupInverseBallot(quadBallot)) + { + switch (gl_SubgroupInvocationID % 4) + { + case 0: + { + while (true) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 1: + { + do + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + while (quadSubgroup); + demote; + } + break; + case 2: + { + while (quadSubgroup) + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 3: + { + for (;;) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + } + } + + const uvec4 nonHelperBallot = subgroupBallot( ! helperInvocationEXT() ); + const uvec4 demotedBallot = nonHelperBallot ^ fullBallot; + const uint writeInvocation = subgroupBallotFindLSB(nonHelperBallot); + + if (quadSubgroup && gl_SubgroupInvocationID == writeInvocation) + { + result = (demotedBallot == quadBallot) ? 1 : 0; + } + + dEQP_FragColor = vec4(1.0); +} +END + +BUFFER vertices DATA_TYPE R32G32_SFLOAT DATA +-1.0 3.5 -1.0 -1.0 3.5 -1.0 +END + +BUFFER fragments DATA_TYPE R32G32B32A32_UINT DATA + 34 35 50 51 +END + +BUFFER result DATA_TYPE R32_UINT DATA 99 END + +BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics mainPipeline + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 16 16 + + BIND BUFFER fragments AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA vertices LOCATION 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR mainPipeline 0 0 0 0 +CLEAR mainPipeline + +RUN mainPipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3 + +EXPECT result IDX 0 EQ 1 + diff --git a/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_backslash.amber b/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_backslash.amber new file mode 100644 index 0000000..a432eb3 --- /dev/null +++ b/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_backslash.amber @@ -0,0 +1,127 @@ +#!amber + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL TARGET_ENV spv1.3 +#version 450 + +#extension GL_EXT_maximal_reconvergence : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_EXT_demote_to_helper_invocation : require + +layout(binding = 0) readonly buffer X { uvec4 fragments; }; +layout(binding = 1) buffer Y { uint result; }; +layout(location = 0) out vec4 dEQP_FragColor; + +void main() +[[maximally_reconverges]] +{ + const uvec4 fullBallot = subgroupBallot( ! helperInvocationEXT() ); + const uint fragmentID = uint(gl_FragCoord.y) * 16 + uint(gl_FragCoord.x); + const uvec4 quadBallot = subgroupBallot((fragments[gl_SubgroupInvocationID % 4] - fragmentID) == 0); + const bool quadSubgroup = subgroupBallotBitCount(quadBallot) == 2; + + if (quadSubgroup && subgroupInverseBallot(quadBallot)) + { + switch (gl_SubgroupInvocationID % 4) + { + case 0: + { + while (true) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 1: + { + do + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + while (quadSubgroup); + demote; + } + break; + case 2: + { + while (quadSubgroup) + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 3: + { + for (;;) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + } + } + + const uvec4 nonHelperBallot = subgroupBallot( ! helperInvocationEXT() ); + const uvec4 demotedBallot = nonHelperBallot ^ fullBallot; + const uint writeInvocation = subgroupBallotFindLSB(nonHelperBallot); + + if (quadSubgroup && gl_SubgroupInvocationID == writeInvocation) + { + result = (demotedBallot == quadBallot) ? 1 : 0; + } + + dEQP_FragColor = vec4(1.0); +} +END + +BUFFER vertices DATA_TYPE R32G32_SFLOAT DATA +-1.0 3.5 -1.0 -1.0 3.5 -1.0 +END + +BUFFER fragments DATA_TYPE R32G32B32A32_UINT DATA + 34 256 256 51 +END + +BUFFER result DATA_TYPE R32_UINT DATA 99 END + +BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics mainPipeline + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 16 16 + + BIND BUFFER fragments AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA vertices LOCATION 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR mainPipeline 0 0 0 0 +CLEAR mainPipeline + +RUN mainPipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3 + +EXPECT result IDX 0 EQ 1 + diff --git a/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_bottom.amber b/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_bottom.amber new file mode 100644 index 0000000..4fdee2c --- /dev/null +++ b/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_bottom.amber @@ -0,0 +1,127 @@ +#!amber + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL TARGET_ENV spv1.3 +#version 450 + +#extension GL_EXT_maximal_reconvergence : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_EXT_demote_to_helper_invocation : require + +layout(binding = 0) readonly buffer X { uvec4 fragments; }; +layout(binding = 1) buffer Y { uint result; }; +layout(location = 0) out vec4 dEQP_FragColor; + +void main() +[[maximally_reconverges]] +{ + const uvec4 fullBallot = subgroupBallot( ! helperInvocationEXT() ); + const uint fragmentID = uint(gl_FragCoord.y) * 16 + uint(gl_FragCoord.x); + const uvec4 quadBallot = subgroupBallot((fragments[gl_SubgroupInvocationID % 4] - fragmentID) == 0); + const bool quadSubgroup = subgroupBallotBitCount(quadBallot) == 2; + + if (quadSubgroup && subgroupInverseBallot(quadBallot)) + { + switch (gl_SubgroupInvocationID % 4) + { + case 0: + { + while (true) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 1: + { + do + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + while (quadSubgroup); + demote; + } + break; + case 2: + { + while (quadSubgroup) + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 3: + { + for (;;) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + } + } + + const uvec4 nonHelperBallot = subgroupBallot( ! helperInvocationEXT() ); + const uvec4 demotedBallot = nonHelperBallot ^ fullBallot; + const uint writeInvocation = subgroupBallotFindLSB(nonHelperBallot); + + if (quadSubgroup && gl_SubgroupInvocationID == writeInvocation) + { + result = (demotedBallot == quadBallot) ? 1 : 0; + } + + dEQP_FragColor = vec4(1.0); +} +END + +BUFFER vertices DATA_TYPE R32G32_SFLOAT DATA +-1.0 3.5 -1.0 -1.0 3.5 -1.0 +END + +BUFFER fragments DATA_TYPE R32G32B32A32_UINT DATA + 256 256 50 51 +END + +BUFFER result DATA_TYPE R32_UINT DATA 99 END + +BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics mainPipeline + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 16 16 + + BIND BUFFER fragments AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA vertices LOCATION 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR mainPipeline 0 0 0 0 +CLEAR mainPipeline + +RUN mainPipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3 + +EXPECT result IDX 0 EQ 1 + diff --git a/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_left.amber b/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_left.amber new file mode 100644 index 0000000..4eea468 --- /dev/null +++ b/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_left.amber @@ -0,0 +1,127 @@ +#!amber + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL TARGET_ENV spv1.3 +#version 450 + +#extension GL_EXT_maximal_reconvergence : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_EXT_demote_to_helper_invocation : require + +layout(binding = 0) readonly buffer X { uvec4 fragments; }; +layout(binding = 1) buffer Y { uint result; }; +layout(location = 0) out vec4 dEQP_FragColor; + +void main() +[[maximally_reconverges]] +{ + const uvec4 fullBallot = subgroupBallot( ! helperInvocationEXT() ); + const uint fragmentID = uint(gl_FragCoord.y) * 16 + uint(gl_FragCoord.x); + const uvec4 quadBallot = subgroupBallot((fragments[gl_SubgroupInvocationID % 4] - fragmentID) == 0); + const bool quadSubgroup = subgroupBallotBitCount(quadBallot) == 2; + + if (quadSubgroup && subgroupInverseBallot(quadBallot)) + { + switch (gl_SubgroupInvocationID % 4) + { + case 0: + { + while (true) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 1: + { + do + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + while (quadSubgroup); + demote; + } + break; + case 2: + { + while (quadSubgroup) + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 3: + { + for (;;) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + } + } + + const uvec4 nonHelperBallot = subgroupBallot( ! helperInvocationEXT() ); + const uvec4 demotedBallot = nonHelperBallot ^ fullBallot; + const uint writeInvocation = subgroupBallotFindLSB(nonHelperBallot); + + if (quadSubgroup && gl_SubgroupInvocationID == writeInvocation) + { + result = (demotedBallot == quadBallot) ? 1 : 0; + } + + dEQP_FragColor = vec4(1.0); +} +END + +BUFFER vertices DATA_TYPE R32G32_SFLOAT DATA +-1.0 3.5 -1.0 -1.0 3.5 -1.0 +END + +BUFFER fragments DATA_TYPE R32G32B32A32_UINT DATA + 34 256 50 256 +END + +BUFFER result DATA_TYPE R32_UINT DATA 99 END + +BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics mainPipeline + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 16 16 + + BIND BUFFER fragments AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA vertices LOCATION 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR mainPipeline 0 0 0 0 +CLEAR mainPipeline + +RUN mainPipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3 + +EXPECT result IDX 0 EQ 1 + diff --git a/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_right.amber b/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_right.amber new file mode 100644 index 0000000..f449e2e --- /dev/null +++ b/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_right.amber @@ -0,0 +1,127 @@ +#!amber + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL TARGET_ENV spv1.3 +#version 450 + +#extension GL_EXT_maximal_reconvergence : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_EXT_demote_to_helper_invocation : require + +layout(binding = 0) readonly buffer X { uvec4 fragments; }; +layout(binding = 1) buffer Y { uint result; }; +layout(location = 0) out vec4 dEQP_FragColor; + +void main() +[[maximally_reconverges]] +{ + const uvec4 fullBallot = subgroupBallot( ! helperInvocationEXT() ); + const uint fragmentID = uint(gl_FragCoord.y) * 16 + uint(gl_FragCoord.x); + const uvec4 quadBallot = subgroupBallot((fragments[gl_SubgroupInvocationID % 4] - fragmentID) == 0); + const bool quadSubgroup = subgroupBallotBitCount(quadBallot) == 2; + + if (quadSubgroup && subgroupInverseBallot(quadBallot)) + { + switch (gl_SubgroupInvocationID % 4) + { + case 0: + { + while (true) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 1: + { + do + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + while (quadSubgroup); + demote; + } + break; + case 2: + { + while (quadSubgroup) + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 3: + { + for (;;) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + } + } + + const uvec4 nonHelperBallot = subgroupBallot( ! helperInvocationEXT() ); + const uvec4 demotedBallot = nonHelperBallot ^ fullBallot; + const uint writeInvocation = subgroupBallotFindLSB(nonHelperBallot); + + if (quadSubgroup && gl_SubgroupInvocationID == writeInvocation) + { + result = (demotedBallot == quadBallot) ? 1 : 0; + } + + dEQP_FragColor = vec4(1.0); +} +END + +BUFFER vertices DATA_TYPE R32G32_SFLOAT DATA +-1.0 3.5 -1.0 -1.0 3.5 -1.0 +END + +BUFFER fragments DATA_TYPE R32G32B32A32_UINT DATA + 256 35 256 51 +END + +BUFFER result DATA_TYPE R32_UINT DATA 99 END + +BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics mainPipeline + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 16 16 + + BIND BUFFER fragments AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA vertices LOCATION 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR mainPipeline 0 0 0 0 +CLEAR mainPipeline + +RUN mainPipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3 + +EXPECT result IDX 0 EQ 1 + diff --git a/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_slash.amber b/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_slash.amber new file mode 100644 index 0000000..404da24 --- /dev/null +++ b/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_slash.amber @@ -0,0 +1,127 @@ +#!amber + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL TARGET_ENV spv1.3 +#version 450 + +#extension GL_EXT_maximal_reconvergence : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_EXT_demote_to_helper_invocation : require + +layout(binding = 0) readonly buffer X { uvec4 fragments; }; +layout(binding = 1) buffer Y { uint result; }; +layout(location = 0) out vec4 dEQP_FragColor; + +void main() +[[maximally_reconverges]] +{ + const uvec4 fullBallot = subgroupBallot( ! helperInvocationEXT() ); + const uint fragmentID = uint(gl_FragCoord.y) * 16 + uint(gl_FragCoord.x); + const uvec4 quadBallot = subgroupBallot((fragments[gl_SubgroupInvocationID % 4] - fragmentID) == 0); + const bool quadSubgroup = subgroupBallotBitCount(quadBallot) == 2; + + if (quadSubgroup && subgroupInverseBallot(quadBallot)) + { + switch (gl_SubgroupInvocationID % 4) + { + case 0: + { + while (true) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 1: + { + do + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + while (quadSubgroup); + demote; + } + break; + case 2: + { + while (quadSubgroup) + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 3: + { + for (;;) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + } + } + + const uvec4 nonHelperBallot = subgroupBallot( ! helperInvocationEXT() ); + const uvec4 demotedBallot = nonHelperBallot ^ fullBallot; + const uint writeInvocation = subgroupBallotFindLSB(nonHelperBallot); + + if (quadSubgroup && gl_SubgroupInvocationID == writeInvocation) + { + result = (demotedBallot == quadBallot) ? 1 : 0; + } + + dEQP_FragColor = vec4(1.0); +} +END + +BUFFER vertices DATA_TYPE R32G32_SFLOAT DATA +-1.0 3.5 -1.0 -1.0 3.5 -1.0 +END + +BUFFER fragments DATA_TYPE R32G32B32A32_UINT DATA + 256 35 50 256 +END + +BUFFER result DATA_TYPE R32_UINT DATA 99 END + +BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics mainPipeline + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 16 16 + + BIND BUFFER fragments AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA vertices LOCATION 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR mainPipeline 0 0 0 0 +CLEAR mainPipeline + +RUN mainPipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3 + +EXPECT result IDX 0 EQ 1 + diff --git a/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_top.amber b/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_top.amber new file mode 100644 index 0000000..fbd9b55 --- /dev/null +++ b/vulkan/amber/reconvergence/maximal/fragment/demote_half_quad_top.amber @@ -0,0 +1,127 @@ +#!amber + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL TARGET_ENV spv1.3 +#version 450 + +#extension GL_EXT_maximal_reconvergence : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_EXT_demote_to_helper_invocation : require + +layout(binding = 0) readonly buffer X { uvec4 fragments; }; +layout(binding = 1) buffer Y { uint result; }; +layout(location = 0) out vec4 dEQP_FragColor; + +void main() +[[maximally_reconverges]] +{ + const uvec4 fullBallot = subgroupBallot( ! helperInvocationEXT() ); + const uint fragmentID = uint(gl_FragCoord.y) * 16 + uint(gl_FragCoord.x); + const uvec4 quadBallot = subgroupBallot((fragments[gl_SubgroupInvocationID % 4] - fragmentID) == 0); + const bool quadSubgroup = subgroupBallotBitCount(quadBallot) == 2; + + if (quadSubgroup && subgroupInverseBallot(quadBallot)) + { + switch (gl_SubgroupInvocationID % 4) + { + case 0: + { + while (true) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 1: + { + do + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + while (quadSubgroup); + demote; + } + break; + case 2: + { + while (quadSubgroup) + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 3: + { + for (;;) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + } + } + + const uvec4 nonHelperBallot = subgroupBallot( ! helperInvocationEXT() ); + const uvec4 demotedBallot = nonHelperBallot ^ fullBallot; + const uint writeInvocation = subgroupBallotFindLSB(nonHelperBallot); + + if (quadSubgroup && gl_SubgroupInvocationID == writeInvocation) + { + result = (demotedBallot == quadBallot) ? 1 : 0; + } + + dEQP_FragColor = vec4(1.0); +} +END + +BUFFER vertices DATA_TYPE R32G32_SFLOAT DATA +-1.0 3.5 -1.0 -1.0 3.5 -1.0 +END + +BUFFER fragments DATA_TYPE R32G32B32A32_UINT DATA + 34 35 256 256 +END + +BUFFER result DATA_TYPE R32_UINT DATA 99 END + +BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics mainPipeline + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 16 16 + + BIND BUFFER fragments AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA vertices LOCATION 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR mainPipeline 0 0 0 0 +CLEAR mainPipeline + +RUN mainPipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3 + +EXPECT result IDX 0 EQ 1 + diff --git a/vulkan/amber/reconvergence/maximal/fragment/demote_invocation.amber b/vulkan/amber/reconvergence/maximal/fragment/demote_invocation.amber new file mode 100644 index 0000000..4374734 --- /dev/null +++ b/vulkan/amber/reconvergence/maximal/fragment/demote_invocation.amber @@ -0,0 +1,127 @@ +#!amber + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL TARGET_ENV spv1.3 +#version 450 + +#extension GL_EXT_maximal_reconvergence : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_EXT_demote_to_helper_invocation : require + +layout(binding = 0) readonly buffer X { uvec4 fragments; }; +layout(binding = 1) buffer Y { uint result; }; +layout(location = 0) out vec4 dEQP_FragColor; + +void main() +[[maximally_reconverges]] +{ + const uvec4 fullBallot = subgroupBallot( ! helperInvocationEXT() ); + const uint fragmentID = uint(gl_FragCoord.y) * 16 + uint(gl_FragCoord.x); + const uvec4 quadBallot = subgroupBallot((fragments[gl_SubgroupInvocationID % 4] - fragmentID) == 0); + const bool quadSubgroup = subgroupBallotBitCount(quadBallot) == 1; + + if (quadSubgroup && subgroupInverseBallot(quadBallot)) + { + switch (gl_SubgroupInvocationID % 4) + { + case 0: + { + while (true) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 1: + { + do + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + while (quadSubgroup); + demote; + } + break; + case 2: + { + while (quadSubgroup) + { + subgroupMemoryBarrierBuffer(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + case 3: + { + for (;;) + { + subgroupMemoryBarrier(); + if (subgroupElect()) + { + break; + } + } + demote; + } + break; + } + } + + const uvec4 nonHelperBallot = subgroupBallot( ! helperInvocationEXT() ); + const uvec4 demotedBallot = nonHelperBallot ^ fullBallot; + const uint writeInvocation = subgroupBallotFindLSB(nonHelperBallot); + + if (quadSubgroup && gl_SubgroupInvocationID == writeInvocation) + { + result = (demotedBallot == quadBallot) ? 1 : 0; + } + + dEQP_FragColor = vec4(1.0); +} +END + +BUFFER vertices DATA_TYPE R32G32_SFLOAT DATA +-1.0 3.5 -1.0 -1.0 3.5 -1.0 +END + +BUFFER fragments DATA_TYPE R32G32B32A32_UINT DATA + 256 256 256 51 +END + +BUFFER result DATA_TYPE R32_UINT DATA 99 END + +BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics mainPipeline + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 16 16 + + BIND BUFFER fragments AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA vertices LOCATION 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR mainPipeline 0 0 0 0 +CLEAR mainPipeline + +RUN mainPipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3 + +EXPECT result IDX 0 EQ 1 + diff --git a/vulkan/amber/reconvergence/maximal/fragment/terminate_invocation.amber b/vulkan/amber/reconvergence/maximal/fragment/terminate_invocation.amber new file mode 100644 index 0000000..b83bc31 --- /dev/null +++ b/vulkan/amber/reconvergence/maximal/fragment/terminate_invocation.amber @@ -0,0 +1,81 @@ +#!amber + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL TARGET_ENV spv1.6 +#version 450 + +#extension GL_EXT_maximal_reconvergence : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_EXT_terminate_invocation : require + +#define UINT_MAX 0xFFFFFFFF + +layout(binding = 0) readonly buffer X { uint fragment; }; +layout(binding = 1) buffer Y { uint result; }; +layout(location = 0) out vec4 dEQP_FragColor; + +void resetBit(in out uvec4 ballot, uint bit) { if (bit < gl_SubgroupSize) ballot[bit/32] &= (UINT_MAX ^ (1u << (bit % 32))); } +uvec4 ballotResetBit(uvec4 ballot, uint bit) { resetBit(ballot, bit); return ballot; } +uint findBallotLSB(uvec4 ballot) { return subgroupBallotBitCount(ballot) > 0 ? subgroupBallotFindLSB(ballot) : UINT_MAX; } + +void main() +[[maximally_reconverges]] +{ + const uint fragmentID = uint(gl_FragCoord.y) * 16 + uint(gl_FragCoord.x); + const uvec4 terminateSubgroupBallot = subgroupBallot(fragmentID == fragment); + const uint terminateInvocationID = findBallotLSB(terminateSubgroupBallot); + const bool terminateSubgroup = terminateInvocationID < gl_SubgroupSize; + const uvec4 referenceBallot = ballotResetBit(subgroupBallot(true), terminateInvocationID); + + + if (terminateSubgroup && (gl_SubgroupInvocationID == terminateInvocationID)) + { + terminateInvocation; + } + + const uvec4 resultBallot = subgroupBallot(true); + + const uvec4 nonHelperBallot = subgroupBallot( ! gl_HelperInvocation ); + const uint writeInvocation = subgroupBallotFindLSB(nonHelperBallot); + + if (terminateSubgroup && (gl_SubgroupInvocationID == writeInvocation)) + { + result = (resultBallot == referenceBallot) ? 1 : 0; + } + + dEQP_FragColor = vec4(1.0); +} +END + +BUFFER vertices DATA_TYPE R32G32_SFLOAT DATA +-1.0 3.5 -1.0 -1.0 3.5 -1.0 +END + +BUFFER fragments DATA_TYPE R32_UINT DATA + 136 +END + +BUFFER result DATA_TYPE R32_UINT DATA 99 END + +BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics mainPipeline + ATTACH vert_shader + ATTACH frag_shader + + FRAMEBUFFER_SIZE 16 16 + + BIND BUFFER fragments AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA vertices LOCATION 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR mainPipeline 0 0 0 0 +CLEAR mainPipeline + +RUN mainPipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3 + +EXPECT result IDX 0 EQ 1 + diff --git a/vulkan/amber/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size.amber b/vulkan/amber/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size.amber new file mode 100644 index 0000000..5ed4591 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size.amber @@ -0,0 +1,209 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated from the following GLSL code, but array stride changed +# from 4 to 8. +# +# SHADER compute compute_shader GLSL +# #version 320 es +# layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +# layout(binding = 0) buffer Out0 +# { +# uint values[]; +# } sb; +# +# void main (void) +# { +# uvec3 size = gl_NumWorkGroups * gl_WorkGroupSize; +# uint groupNdx = size.x * size.y * gl_GlobalInvocationID.z + size.x * gl_GlobalInvocationID.y + gl_GlobalInvocationID.x; +# uint numValuesPerInv = uint(sb.values.length()) / (size.x * size.y * size.z); +# uint offset = numValuesPerInv * groupNdx; +# +# for (uint ndx = 0u; ndx < numValuesPerInv; ndx++) +# sb.values[offset + ndx] = offset + ndx; +# } +SHADER compute compute_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 83 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_NumWorkGroups %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpSource ESSL 320 + OpName %main "main" + OpName %size "size" + OpName %gl_NumWorkGroups "gl_NumWorkGroups" + OpName %groupNdx "groupNdx" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %numValuesPerInv "numValuesPerInv" + OpName %Out0 "Out0" + OpMemberName %Out0 0 "values" + OpName %sb "sb" + OpName %offset "offset" + OpName %ndx "ndx" + OpDecorate %gl_NumWorkGroups BuiltIn NumWorkgroups + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_uint ArrayStride 8 + OpMemberDecorate %Out0 0 Offset 0 + OpDecorate %Out0 BufferBlock + OpDecorate %sb DescriptorSet 0 + OpDecorate %sb Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_NumWorkGroups = OpVariable %_ptr_Input_v3uint Input + %uint_1 = OpConstant %uint 1 + %14 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_2 = OpConstant %uint 2 +%_ptr_Input_uint = OpTypePointer Input %uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %Out0 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_Out0 = OpTypePointer Uniform %Out0 + %sb = OpVariable %_ptr_Uniform_Out0 Uniform + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %size = OpVariable %_ptr_Function_v3uint Function + %groupNdx = OpVariable %_ptr_Function_uint Function +%numValuesPerInv = OpVariable %_ptr_Function_uint Function + %offset = OpVariable %_ptr_Function_uint Function + %ndx = OpVariable %_ptr_Function_uint Function + %12 = OpLoad %v3uint %gl_NumWorkGroups + %15 = OpIMul %v3uint %12 %14 + OpStore %size %15 + %19 = OpAccessChain %_ptr_Function_uint %size %uint_0 + %20 = OpLoad %uint %19 + %21 = OpAccessChain %_ptr_Function_uint %size %uint_1 + %22 = OpLoad %uint %21 + %23 = OpIMul %uint %20 %22 + %27 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %28 = OpLoad %uint %27 + %29 = OpIMul %uint %23 %28 + %30 = OpAccessChain %_ptr_Function_uint %size %uint_0 + %31 = OpLoad %uint %30 + %32 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1 + %33 = OpLoad %uint %32 + %34 = OpIMul %uint %31 %33 + %35 = OpIAdd %uint %29 %34 + %36 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %37 = OpLoad %uint %36 + %38 = OpIAdd %uint %35 %37 + OpStore %groupNdx %38 + %44 = OpArrayLength %uint %sb 0 + %46 = OpBitcast %int %44 + %47 = OpBitcast %uint %46 + %48 = OpAccessChain %_ptr_Function_uint %size %uint_0 + %49 = OpLoad %uint %48 + %50 = OpAccessChain %_ptr_Function_uint %size %uint_1 + %51 = OpLoad %uint %50 + %52 = OpIMul %uint %49 %51 + %53 = OpAccessChain %_ptr_Function_uint %size %uint_2 + %54 = OpLoad %uint %53 + %55 = OpIMul %uint %52 %54 + %56 = OpUDiv %uint %47 %55 + OpStore %numValuesPerInv %56 + %58 = OpLoad %uint %numValuesPerInv + %59 = OpLoad %uint %groupNdx + %60 = OpIMul %uint %58 %59 + OpStore %offset %60 + OpStore %ndx %uint_0 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpLoad %uint %ndx + %68 = OpLoad %uint %numValuesPerInv + %70 = OpULessThan %bool %67 %68 + OpBranchConditional %70 %63 %64 + %63 = OpLabel + %72 = OpLoad %uint %offset + %73 = OpLoad %uint %ndx + %74 = OpIAdd %uint %72 %73 + %75 = OpLoad %uint %offset + %76 = OpLoad %uint %ndx + %77 = OpIAdd %uint %75 %76 + %79 = OpAccessChain %_ptr_Uniform_uint %sb %int_0 %74 + OpStore %79 %77 + OpBranch %65 + %65 = OpLabel + %80 = OpLoad %uint %ndx + %82 = OpIAdd %uint %80 %int_1 + OpStore %ndx %82 + OpBranch %62 + %64 = OpLabel + OpReturn + OpFunctionEnd +END + +# Because the array stride was doubled the verification shader +# skips every second element. +SHADER compute compute_shader_verify GLSL +#version 320 es +layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +layout(binding = 0) buffer Buf0 +{ + uint values[]; +}; + +layout(binding = 1) buffer Buf1 +{ + int result; +}; + +void main() +{ + result = 1; + + for (uint i = 0u; i < 512u; i++) + if (values[i*2u] != i) + result = 0; +} +END + +BUFFER buf DATA_TYPE uint32 SIZE 1024 FILL 0 +BUFFER result DATA_TYPE int32 SIZE 1 FILL 0 + +PIPELINE compute verify + ATTACH compute_shader_verify + + BIND BUFFER buf AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER buf AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN pipeline 4 2 2 +RUN verify 1 1 1 + +EXPECT result IDX 0 EQ 1 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_16bit.amber b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_16bit.amber new file mode 100644 index 0000000..849c75f --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_16bit.amber @@ -0,0 +1,352 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderInt16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess + +# Based on the following GLSL shader with the bit size and signedness replaced. +# +##version 430 +# +#layout(set = 0, binding = 0) buffer block0 +#{ +# uvec2 inputs[]; +#}; +# +#layout(set = 0, binding = 1) buffer block1 +#{ +# uvec2 outputs[]; +#}; +# +#void main() +#{ +# for (int i = 0; i < inputs.length(); i++) +# { +# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y); +# } +#} +SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %i "i" + OpName %block0 "block0" + OpMemberName %block0 0 "inputs" + OpName %_ "" + OpName %block1 "block1" + OpMemberName %block1 0 "outputs" + OpName %__0 "" + OpName %ResType "ResType" + OpDecorate %_runtimearr_v2int16 ArrayStride 4 + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_v2int16_0 ArrayStride 4 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %int16 = OpTypeInt 16 1 + %v2int16 = OpTypeVector %int16 2 +%_runtimearr_v2int16 = OpTypeRuntimeArray %v2int16 + %block0 = OpTypeStruct %_runtimearr_v2int16 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int16 = OpTypePointer Uniform %int16 + %uint_1 = OpConstant %uint 1 +%_runtimearr_v2int16_0 = OpTypeRuntimeArray %v2int16 + %block1 = OpTypeStruct %_runtimearr_v2int16_0 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform + %ResType = OpTypeStruct %int16 %int16 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %22 = OpArrayLength %uint %_ 0 + %23 = OpBitcast %int %22 + %25 = OpSLessThan %bool %15 %23 + OpBranchConditional %25 %11 %12 + %11 = OpLabel + %26 = OpLoad %int %i + %29 = OpAccessChain %_ptr_Uniform_int16 %_ %int_0 %26 %uint_0 + %30 = OpLoad %int16 %29 + %31 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Uniform_int16 %_ %int_0 %31 %uint_1 + %34 = OpLoad %int16 %33 + %39 = OpLoad %int %i + %40 = OpAccessChain %_ptr_Uniform_int16 %__0 %int_0 %39 %uint_0 + %41 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_int16 %__0 %int_0 %41 %uint_1 + %44 = OpSMulExtended %ResType %30 %34 + %45 = OpCompositeExtract %int16 %44 0 + OpStore %42 %45 + %46 = OpCompositeExtract %int16 %44 1 + OpStore %40 %46 + OpBranch %13 + %13 = OpLabel + %47 = OpLoad %int %i + %49 = OpIAdd %int %47 %int_1 + OpStore %i %49 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER input DATA_TYPE vec2 DATA +7350 -12219 +15023 20842 +18703 88 +24124 29171 +-860 -29546 +1622 -593 +-28977 28118 +28457 23421 +-22777 28781 +-2460 28086 +-2893 -6539 +32294 19319 +24932 28893 +32482 -12742 +9 -18417 +30885 -19284 +26853 612 +1584 -29545 +-7405 9558 +-27185 26318 +-28993 -331 +13923 7029 +-27220 29223 +-4376 -26270 +5699 16276 +-7494 10951 +12737 24481 +7560 22801 +-20261 -5702 +-17512 -8738 +1314 -9588 +-19230 13099 +24434 1905 +-28228 30533 +-22446 -24956 +18708 -15805 +-21110 26086 +-31734 -12715 +14487 26561 +-30241 22330 +10344 -27752 +-24508 13028 +29660 -13794 +-13890 -27355 +-1021 -15663 +-8841 -1767 +6314 7320 +-29351 19285 +-15710 18978 +8916 -7829 +6942 23810 +16220 -4022 +-109 11963 +-25476 -20294 +21051 9581 +-9121 -2331 +-2297 -9354 +-11544 -30237 +-19897 -31390 +25917 26993 +6852 18997 +21861 -261 +28749 18916 +1701 -5242 +28526 29006 +-30653 22584 +-32712 20573 +-24587 -31275 +20480 21349 +13365 18866 +599 -5229 +9069 -1452 +20851 -5281 +25037 28578 +-371 -12710 +-21466 27120 +-9063 -18134 +8697 3778 +23973 7393 +-28460 24080 +25738 23469 +6696 -15630 +31936 22683 +-24812 5246 +-12963 7062 +11975 -17170 +-14002 -17466 +-20417 -31378 +-7755 -610 +10597 26209 +-9391 29672 +-16098 7355 +30321 16188 +-8129 11868 +8145 -19395 +22659 -17674 +-15973 -6540 +2527 23635 +-5976 -24627 +12582 -6037 +END + +BUFFER output DATA_TYPE vec2 SIZE 100 FILL 0.0 + +BUFFER ref DATA_TYPE vec2 DATA +-1371 40206 +4777 43894 +25 7464 +10737 61172 +387 47128 +-15 21194 +-12433 33802 +10169 55813 +-10003 11771 +-1055 48920 +288 42959 +9519 50602 +10991 54100 +-6316 39732 +-3 30855 +-9088 4828 +250 50036 +-715 58960 +-1080 1890 +-10917 1682 +146 28427 +1493 19519 +-12138 25908 +1754 7376 +1415 23484 +-1253 49814 +4757 59745 +2630 15880 +1762 53790 +2334 58832 +-193 49816 +-3844 26614 +710 16210 +-13152 43948 +8547 26184 +-4512 18492 +-8403 23548 +6156 58194 +5871 27351 +-10304 1414 +-4381 46528 +-4872 1168 +-6243 11208 +5797 48758 +244 1139 +238 24479 +705 15600 +-8637 397 +-4550 44420 +-1066 58012 +2522 7228 +-996 37016 +-20 6753 +7888 61976 +3077 35359 +324 27387 +327 55866 +5326 11192 +9530 8750 +10674 46317 +1986 12948 +-88 61447 +8297 63892 +-137 61790 +12625 33156 +-10564 54952 +-10269 5208 +11733 24537 +6671 36864 +3847 27098 +-48 13557 +-201 4548 +-1681 51885 +10917 50874 +71 62354 +-8884 63904 +2507 49690 +501 23730 +2704 23045 +-10458 58688 +9216 65346 +-1597 2512 +11053 34880 +-1987 56280 +-1397 9086 +-3138 41218 +3731 44116 +9775 30226 +72 11958 +4237 60741 +-4252 9320 +-1807 22762 +7489 37244 +-1473 59556 +-2411 35021 +-6111 15330 +1593 64572 +911 22349 +2245 42632 +-1160 64226 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT output EQ_BUFFER ref diff --git a/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_32bit.amber b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_32bit.amber new file mode 100644 index 0000000..424dc21 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_32bit.amber @@ -0,0 +1,347 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Based on the following GLSL shader with the bit size and signedness replaced. +# +##version 430 +# +#layout(set = 0, binding = 0) buffer block0 +#{ +# uvec2 inputs[]; +#}; +# +#layout(set = 0, binding = 1) buffer block1 +#{ +# uvec2 outputs[]; +#}; +# +#void main() +#{ +# for (int i = 0; i < inputs.length(); i++) +# { +# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y); +# } +#} +SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %i "i" + OpName %block0 "block0" + OpMemberName %block0 0 "inputs" + OpName %_ "" + OpName %block1 "block1" + OpMemberName %block1 0 "outputs" + OpName %__0 "" + OpName %ResType "ResType" + OpDecorate %_runtimearr_v2int ArrayStride 8 + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_v2int_0 ArrayStride 8 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v2int = OpTypeVector %int 2 +%_runtimearr_v2int = OpTypeRuntimeArray %v2int + %block0 = OpTypeStruct %_runtimearr_v2int +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_1 = OpConstant %uint 1 +%_runtimearr_v2int_0 = OpTypeRuntimeArray %v2int + %block1 = OpTypeStruct %_runtimearr_v2int_0 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform + %ResType = OpTypeStruct %int %int + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %22 = OpArrayLength %uint %_ 0 + %23 = OpBitcast %int %22 + %25 = OpSLessThan %bool %15 %23 + OpBranchConditional %25 %11 %12 + %11 = OpLabel + %26 = OpLoad %int %i + %29 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %26 %uint_0 + %30 = OpLoad %int %29 + %31 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %31 %uint_1 + %34 = OpLoad %int %33 + %39 = OpLoad %int %i + %40 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %39 %uint_0 + %41 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %41 %uint_1 + %44 = OpSMulExtended %ResType %30 %34 + %45 = OpCompositeExtract %int %44 0 + OpStore %42 %45 + %46 = OpCompositeExtract %int %44 1 + OpStore %40 %46 + OpBranch %13 + %13 = OpLabel + %47 = OpLoad %int %i + %49 = OpIAdd %int %47 %int_1 + OpStore %i %49 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER input DATA_TYPE vec2 DATA +-1688415477 -1849538876 +-1481161046 744443859 +-1047670911 342274412 +-1827862998 1915433998 +-195042304 -1970463961 +801168252 1040837728 +1758076917 1813037937 +772583113 -235749179 +-1492104695 240250521 +1146754311 -951649756 +-1752427050 -273554598 +-198244568 1149890980 +1415955024 -170357798 +-392141427 1921737045 +-1982962339 1536567313 +2015459914 -1632381635 +1425575678 2013863686 +1163278386 -1099315059 +156477432 1396884814 +1866220579 -134589108 +-674328528 14024616 +1900782750 -147987763 +1175322954 -731675741 +1398920429 -867225467 +786396560 -961394750 +304845773 -1511657678 +-1447530579 -1969621860 +1989276516 -447488030 +798071327 250508216 +-1507337754 1704953542 +350717264 -206442856 +1737071508 -1466339354 +-613851517 1819017879 +-1959669685 -993553400 +-1279847794 1371991305 +841282716 -71067838 +662437510 219460683 +-949914278 -1537001995 +-753441359 -416011652 +-1804834881 -561077734 +530063191 30739824 +-1772459661 -1979269210 +-1628760980 1088408830 +-292087972 1349917076 +82063311 -1294048029 +-164894006 -33010556 +1345659270 -1874246652 +797702488 -1883280086 +-379848047 -401995031 +1866861183 63846898 +-1268084053 -1601253168 +-1352512374 -1027574469 +-452386253 1212120983 +77263884 -1063574311 +-51056879 1793250518 +-1522750215 580161721 +-696795907 -1419078861 +1696855925 1431878830 +1957271165 1507136709 +362886400 401065303 +2141067993 -2101529066 +813276885 -1759033824 +628010636 -962027929 +1611711174 931385598 +-743228013 1991083983 +-885940180 1855310978 +-1837536569 -1179815970 +-1674065935 249848291 +1721815126 1309759389 +1630564439 -1058094870 +304274878 -683892373 +-824137058 -1910622390 +-145799827 406823059 +957660435 -505946420 +-1134047445 1764822477 +-884906579 835754281 +1182999626 -105981451 +1260490530 1036649831 +-993962359 -1149737432 +1879371260 12970323 +766931165 418850793 +-593935654 1468884213 +-104102766 -1114729647 +-962365003 -1657152180 +-281527800 -1963845302 +-910583728 1281673320 +-1452868981 683800575 +-1849911805 1838620371 +-260092072 -885018734 +-1877235907 575712371 +1668446534 -1288209609 +-1328805947 1822494657 +-1985897411 -1950188863 +1816377140 -1523362028 +-195981023 -1694970898 +-290106126 -1843065952 +425345233 -2063941252 +662896189 90948277 +-1928404187 409097225 +151362884 493861462 +END + +BUFFER output DATA_TYPE vec2 SIZE 100 FILL 0.0 + +BUFFER ref DATA_TYPE vec2 DATA +727081220 2115802732 +-256728671 1005827102 +-83490961 1974582124 +-815175225 1829035596 +89482364 3953638400 +194154247 1912905344 +742138397 2464135717 +-42406804 1708867757 +-83464881 3899235681 +-254090052 3323841276 +111615396 1636986684 +-53075990 675626400 +-56163171 2728978464 +-175459476 4048233681 +-709424521 3658040109 +-766012760 2826417570 +668437008 772938740 +-297746027 939918218 +50892342 3987670416 +-58480763 1471273316 +-2201926 1495166848 +-65493535 3802943110 +-200223945 2368843806 +-282465346 987959073 +-176028704 2635204384 +-107293589 2464170250 +663820624 926544236 +-207260584 759757384 +46548299 2478093128 +-598360981 1924852708 +-16857655 3283584896 +-593051388 3414881016 +-259980300 1629996357 +453329756 2085019224 +-408836651 359734526 +-13920512 10687544 +33848683 1891748162 +339937429 123662626 +72978526 1962429372 +235776571 3667617638 +3793753 4136116496 +816810604 1778331026 +-412752348 3415757608 +-91803852 889814320 +-24725187 3699720333 +1267353 3131639848 +-587221557 1290935832 +-349780827 2529779824 +35552547 774551545 +27751851 3082695438 +472768118 1755060976 +323589701 1411560910 +-127671955 1659336981 +-19133064 1961791020 +-21317456 1639705654 +-205692227 2618888177 +230224882 3139562855 +565706770 291773830 +686821346 2973995569 +33886438 982647552 +-1047625351 1433736358 +-333083223 638916768 +-140667840 857907796 +349507801 607395956 +-344549630 297684701 +-382702459 3698484824 +504766355 2719080850 +-97384331 3906771891 +525071175 2703425214 +-401700817 3681152902 +-48450024 210709610 +366618557 3021816748 +-13810288 3686530455 +-112812238 4134675748 +-465985486 1860244591 +-172193270 1556983221 +-29191379 1234203858 +304236843 3978313902 +266077865 1776819048 +5675491 4045374644 +74792124 58287141 +-203126741 3839632034 +27019167 964741170 +371314879 853959356 +128726718 3480981072 +-271729862 832856192 +-231310876 3021647221 +-791923500 4207476345 +53594437 2122344496 +-251631238 2916686951 +-500424965 1575399434 +-563855688 1026254469 +901723982 1283841021 +-644242383 2078866448 +77342179 1138890670 +124490988 1190493504 +-204399129 1655633468 +14037188 2831612705 +-183681213 1144528973 +17404625 10632408 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT output EQ_BUFFER ref diff --git a/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_64bit.amber b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_64bit.amber new file mode 100644 index 0000000..446d761 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_64bit.amber @@ -0,0 +1,351 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderInt64 + +# Based on the following GLSL shader with the bit size and signedness replaced. +# +##version 430 +# +#layout(set = 0, binding = 0) buffer block0 +#{ +# uvec2 inputs[]; +#}; +# +#layout(set = 0, binding = 1) buffer block1 +#{ +# uvec2 outputs[]; +#}; +# +#void main() +#{ +# for (int i = 0; i < inputs.length(); i++) +# { +# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y); +# } +#} +SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %i "i" + OpName %block0 "block0" + OpMemberName %block0 0 "inputs" + OpName %_ "" + OpName %block1 "block1" + OpMemberName %block1 0 "outputs" + OpName %__0 "" + OpName %ResType "ResType" + OpDecorate %_runtimearr_v2int64 ArrayStride 16 + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_v2int64_0 ArrayStride 16 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %int64 = OpTypeInt 64 1 + %v2int64 = OpTypeVector %int64 2 +%_runtimearr_v2int64 = OpTypeRuntimeArray %v2int64 + %block0 = OpTypeStruct %_runtimearr_v2int64 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int64 = OpTypePointer Uniform %int64 + %uint_1 = OpConstant %uint 1 +%_runtimearr_v2int64_0 = OpTypeRuntimeArray %v2int64 + %block1 = OpTypeStruct %_runtimearr_v2int64_0 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform + %ResType = OpTypeStruct %int64 %int64 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %22 = OpArrayLength %uint %_ 0 + %23 = OpBitcast %int %22 + %25 = OpSLessThan %bool %15 %23 + OpBranchConditional %25 %11 %12 + %11 = OpLabel + %26 = OpLoad %int %i + %29 = OpAccessChain %_ptr_Uniform_int64 %_ %int_0 %26 %uint_0 + %30 = OpLoad %int64 %29 + %31 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Uniform_int64 %_ %int_0 %31 %uint_1 + %34 = OpLoad %int64 %33 + %39 = OpLoad %int %i + %40 = OpAccessChain %_ptr_Uniform_int64 %__0 %int_0 %39 %uint_0 + %41 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_int64 %__0 %int_0 %41 %uint_1 + %44 = OpSMulExtended %ResType %30 %34 + %45 = OpCompositeExtract %int64 %44 0 + OpStore %42 %45 + %46 = OpCompositeExtract %int64 %44 1 + OpStore %40 %46 + OpBranch %13 + %13 = OpLabel + %47 = OpLoad %int %i + %49 = OpIAdd %int %47 %int_1 + OpStore %i %49 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER input DATA_TYPE vec2 DATA +1697764898295313179 -1583815216942774417 +-2246452991613323635 8449535288700877271 +2627416114117125672 -3124152984911932855 +-43236709873099735 5854596458334164933 +1326191744341573901 7821745812728949170 +8592853852586992073 8962340303954228345 +3450233008175849062 3434398775107695252 +-3457489862136449503 -8242049484325355856 +8476309775168192332 325016089025950883 +-4658061731586298919 -8636700033051074267 +5460984615438580671 3444654861238435749 +5231502016886101487 3906026667361622303 +3824711396609006609 326968134426258840 +-2611829131785124508 9122956541996048943 +-2852218615961598190 -2625218596838806527 +6389515874332832393 -6220860328261661659 +-697615062979211803 6214354049728894508 +-184495438367305326 -6887859517889343362 +6587234633400457053 6109412609740539816 +-3492590926084338331 6964585038076285479 +-204111142063688267 8353380412273099113 +-1237456780349845975 6670311352088939599 +7387564251892977132 1066823458182476643 +3990222572748067264 -9040852442983627533 +-3833646326003576865 3721852972811450790 +-6695242774736179440 -8103418607213822136 +-2328879918742440140 7225363341964433291 +-7542772690176292549 -426976033402051203 +1617274125906413816 -7656388193350439422 +8569965583708318638 8385696770313281848 +1703368282708394806 -4288821867150061483 +-268154532431338793 -4392415026205607651 +1376140118615043366 8028175655715292757 +789804692495955764 -6176368912034498428 +1754561195400458949 -6648024157014454131 +6953740701293409820 -7529273068025306996 +1706774089671422948 -8802100611433058608 +8432973703101825660 960618579237171048 +3721317874630288440 -4472244691724083929 +-4449810435855136010 9213564267976826988 +4697734840921284265 -3400320814619238115 +-8931677661882785580 1929937673544182591 +4142895729976105834 214196578295932203 +5476219201484961838 -7501172159253783554 +4603643939439558499 4461895756534532238 +-1022386484792474944 4238733490050515506 +-6303846855748324450 -46877539132248855 +-7048596888373414568 -5943161222445717295 +2412780422431743511 8791175714421969674 +-6324564171665737949 8648951073520141918 +-2107881076773966289 1533565632616994436 +-4353092475609153459 7059766930202303198 +1638958496455493327 8323386020198446516 +-1430986942716414687 9176326755468460291 +-4599246887793665267 -7505258031068907000 +397602220609075218 8754495651306845054 +4266223548804666356 -3621244848036107150 +963126893632761247 -3021502904315924572 +-8136700769576331373 907122548413391755 +-6876437201644182059 4047774924491901045 +8422459303650285730 -2332449808823712165 +6766778283886494632 3843213820868412637 +5267170145407363405 -7406558741189627850 +-8839009461440025767 4663626692825132093 +-9035161479743184320 3622562546233149040 +774129511061721995 -1449614165071558892 +4418914969519337310 -4967381247098871242 +198755165562704483 8325542368179910814 +-8843753664145695349 -7144509066542594396 +-7973650506145373754 -296406849925611532 +1666413654961554570 -6160074733085504670 +1984285944735974846 5131123222740165166 +-4619032543213329882 -3165835901649814549 +-2409100302499853405 -7726640975681101571 +270385218610809896 4557484775140773164 +6683790639213623203 2393997450535340975 +-3055156318310326779 -6337770036195457325 +1493785318301288415 -9189131934558846428 +-5091923148371263260 -3993997588931776509 +-2111174227404174029 3936874778829962068 +9192395369785567563 2384429532603406947 +2325480784279339846 -5322530634674281260 +3283921804497305256 8643923201765552058 +9205874698264908049 -297333111257791769 +1017922243577204195 8693507873015348903 +5105931140756185137 -8406479672369158862 +1380693136954900411 5288222515028451556 +8573910080780030569 875122851623918364 +7920188104431955540 4129089782007822146 +1445250113519123979 -1694134315801486087 +186999331782705563 8886310864219830127 +-2985256322091953876 8483587433804314276 +3375085833274768875 -913470821975130597 +-7499516031753708617 -31874520914662947 +-5235745604665639494 4311904513569258794 +7934031081038130715 8180088875172312000 +5693625679296583596 -6464280221967264491 +-10733339538926761 -4977777627264765306 +-6590587127685028941 -7426802994960408225 +2807847132181960923 -7448910087284167377 +END + +BUFFER output DATA_TYPE vec2 SIZE 100 FILL 0.0 + +BUFFER ref DATA_TYPE vec2 DATA +-145768048278163416 17061410397170738613 +-1028988300114002110 11054313174839309675 +-444980960473316196 909338473290019176 +-13722393907651130 8182191462607133325 +562328760117796721 3543451456882561034 +4174833244354867073 17342250395234569217 +642361382028563158 8174892294129090296 +1544814760882151667 12776028976972395696 +149345436868935662 15304165007357099364 +2180887952388403016 4391238703868743517 +1019757585813135483 12842155461797217051 +1107750305780870931 14592297663442190065 +67792925682229433 7201638291036759832 +-1291696982903029221 15059538090738976092 +405908886844901600 15089658311482400530 +-2154758891900322901 9274389852205038029 +-235013126135107123 2945447124082282844 +68889049259187951 12636305815025567196 +2181638893661056376 11905869041486618632 +-1318630887420147924 16946845560454849635 +-92429211855956241 17169073443800628285 +-447462271754015974 12035760710113249959 +427242163238015258 18363463965376570948 +-1955630400179518914 13699247936124885312 +-773484356812829606 2719796324539969946 +2941134471417901932 14035369641159961728 +-912193692582352044 7913758452310402364 +174588163159632782 9741012625970710735 +-671255505769640237 397137483130118640 +3895816650886461500 8824053926038699024 +-396028866096829959 13153328533747806446 +63851159472376865 16139944649092141403 +598907566287754541 3988227272362811806 +-264443694226957438 14569856680580816 +-632326505174783467 3322375238350964353 +-2838257655392907413 1278524441691428688 +-814409155254997862 15398755723818508608 +439149108647499904 8650175859252446816 +-902199545054267225 9965726826156104840 +-2222539341752826045 2779780894818000840 +-865941734612810874 7433700250311311909 +-934451149684878386 14959917992327933996 +48105729989631685 16400002358480219342 +-2226846257963472707 1452086604421732260 +1113528722245160465 18101451213082329322 +-234926218716353378 6200458842198477184 +16019565647100159 5994469016148697806 +2270912825170905800 11812232300588780760 +1149860190457407848 9516590528868803046 +-2965338807949067730 7316171474836705498 +-175238186428322033 10686979897718987324 +-1665975208449778027 14950581212070679750 +739517184310338900 4261769027801736332 +-711843982694449939 909001895699857507 +1871253512465550834 3889392748958321256 +188694920760188130 14567351590051753692 +-837494139071258229 6592610435724202664 +-157756333296977184 9991554290685668060 +-400123984388915905 10564586481134822865 +-1508898804224654718 10379520407206572633 +-1064955610276111834 3846532138484518294 +1409797616287690938 4285230152095008776 +-2114823349091702567 2864626277947369022 +-2234640449164972083 12060901831988895797 +-1774320576298004805 8919989781212462080 +-60833993270083104 1841825438323266524 +-1189935484788276204 3301009097545906644 +89703881897795948 7608656209836327194 +3425226586506881369 16637457050396421900 +128122590061988693 14960879754860653240 +-556479377053180398 11156377127145581268 +551946492611809435 16125473259773117476 +792719788259791974 3683803325084523234 +1009080683151575126 5736182954816495639 +66801843854825641 12337861797692645088 +867414741932377836 5825418944520259949 +1049663728878666993 6402452514290195487 +-744119955094989792 17254737587896572252 +1102477960140693113 17671799961633538732 +-450563445580016405 12720935151533528508 +1188210716617579985 271015046486054401 +-670982514053175987 15210844955179159032 +1538806402108324711 4135834641442233872 +-148384525472198959 17052049625857919063 +479722329495967122 3057820272302278933 +-2326855415338992695 10602730000913211026 +395810366534883398 6130862794095518348 +406750622737425888 9680708028969834108 +1772842277364204764 6700366800448290216 +-132730621861789082 1010340495187676339 +90082791140948390 7795600848420798261 +-1372908027540673267 13795600718127515696 +-167132065042963254 16558981015188550089 +12958573049466781 393889326407646203 +-1223849315328970508 4260564545974530692 +3518294563091429608 4926886786656433472 +-1995213449207922426 6484502489347050780 +2896347301681938 1783742857161842058 +2653421764993115249 6426170027497247341 +-1133826150722767792 17396045847600942901 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT output EQ_BUFFER ref diff --git a/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_8bit.amber b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_8bit.amber new file mode 100644 index 0000000..801c06d --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/signed_8bit.amber @@ -0,0 +1,352 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE Float16Int8Features.shaderInt8 +DEVICE_FEATURE Storage8BitFeatures.storageBuffer8BitAccess + +# Based on the following GLSL shader with the bit size and signedness replaced. +# +##version 430 +# +#layout(set = 0, binding = 0) buffer block0 +#{ +# uvec2 inputs[]; +#}; +# +#layout(set = 0, binding = 1) buffer block1 +#{ +# uvec2 outputs[]; +#}; +# +#void main() +#{ +# for (int i = 0; i < inputs.length(); i++) +# { +# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y); +# } +#} +SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpCapability Int8 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %i "i" + OpName %block0 "block0" + OpMemberName %block0 0 "inputs" + OpName %_ "" + OpName %block1 "block1" + OpMemberName %block1 0 "outputs" + OpName %__0 "" + OpName %ResType "ResType" + OpDecorate %_runtimearr_v2int8 ArrayStride 2 + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_v2int8_0 ArrayStride 2 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %int8 = OpTypeInt 8 1 + %v2int8 = OpTypeVector %int8 2 +%_runtimearr_v2int8 = OpTypeRuntimeArray %v2int8 + %block0 = OpTypeStruct %_runtimearr_v2int8 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int8 = OpTypePointer Uniform %int8 + %uint_1 = OpConstant %uint 1 +%_runtimearr_v2int8_0 = OpTypeRuntimeArray %v2int8 + %block1 = OpTypeStruct %_runtimearr_v2int8_0 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform + %ResType = OpTypeStruct %int8 %int8 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %22 = OpArrayLength %uint %_ 0 + %23 = OpBitcast %int %22 + %25 = OpSLessThan %bool %15 %23 + OpBranchConditional %25 %11 %12 + %11 = OpLabel + %26 = OpLoad %int %i + %29 = OpAccessChain %_ptr_Uniform_int8 %_ %int_0 %26 %uint_0 + %30 = OpLoad %int8 %29 + %31 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Uniform_int8 %_ %int_0 %31 %uint_1 + %34 = OpLoad %int8 %33 + %39 = OpLoad %int %i + %40 = OpAccessChain %_ptr_Uniform_int8 %__0 %int_0 %39 %uint_0 + %41 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_int8 %__0 %int_0 %41 %uint_1 + %44 = OpSMulExtended %ResType %30 %34 + %45 = OpCompositeExtract %int8 %44 0 + OpStore %42 %45 + %46 = OpCompositeExtract %int8 %44 1 + OpStore %40 %46 + OpBranch %13 + %13 = OpLabel + %47 = OpLoad %int %i + %49 = OpIAdd %int %47 %int_1 + OpStore %i %49 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER input DATA_TYPE vec2 DATA +54 23 +17 -105 +-7 -92 +-3 -13 +-123 76 +42 -38 +-23 89 +65 67 +-36 -113 +113 119 +-62 71 +-62 7 +-93 -97 +-111 -11 +72 -53 +22 12 +50 -56 +-71 -91 +100 -91 +62 -61 +-19 12 +108 -41 +22 -2 +82 75 +-30 79 +-70 -32 +-17 14 +-8 25 +-12 -18 +-47 -5 +116 55 +74 -122 +22 0 +-46 -25 +99 -96 +-116 -97 +-114 -93 +-94 104 +-25 -45 +-109 -120 +-94 -71 +-53 -112 +-26 39 +15 -101 +-101 87 +121 115 +-19 -7 +35 -12 +-67 -50 +-34 81 +92 -117 +121 95 +-35 -104 +-100 -4 +124 40 +45 -22 +24 -16 +-51 -83 +91 18 +-100 -11 +-55 -119 +-15 127 +105 62 +120 34 +-45 110 +56 50 +-91 114 +14 -62 +-127 108 +100 -24 +123 -95 +32 -106 +-6 -62 +-13 13 +80 119 +30 22 +101 14 +49 -115 +-68 -94 +-80 8 +75 -103 +0 -71 +-5 8 +-2 -112 +-127 -87 +-124 -108 +-115 107 +114 -50 +37 62 +27 66 +-6 46 +-110 -102 +-98 3 +-107 26 +-51 101 +-1 -92 +4 9 +47 -44 +64 -8 +-31 45 +END + +BUFFER output DATA_TYPE vec2 SIZE 100 FILL 0.0 + +BUFFER ref DATA_TYPE vec2 DATA +4 218 +-7 7 +2 132 +0 39 +-37 124 +-7 196 +-8 1 +17 3 +15 228 +52 135 +-18 206 +-2 78 +35 61 +4 197 +-15 24 +1 8 +-11 16 +25 61 +-36 116 +-15 58 +-1 28 +-18 180 +-1 212 +24 6 +-10 190 +8 192 +-1 18 +-1 56 +0 216 +0 235 +24 236 +-36 188 +0 0 +4 126 +-38 224 +43 244 +41 106 +-39 208 +4 101 +51 24 +26 18 +23 48 +-4 10 +-6 21 +-35 173 +54 91 +0 133 +-2 92 +13 22 +-11 62 +-43 244 +44 231 +14 56 +1 144 +19 96 +-4 34 +-2 128 +16 137 +6 102 +4 76 +25 145 +-8 143 +25 110 +15 240 +-20 170 +10 240 +-41 122 +-4 156 +-54 108 +-10 160 +-46 91 +-14 192 +1 116 +-1 87 +37 48 +2 148 +5 134 +-23 253 +24 248 +-3 128 +-31 211 +0 0 +-1 216 +0 224 +43 41 +52 80 +-49 239 +-23 188 +8 246 +6 246 +-2 236 +43 212 +-2 218 +-11 34 +-21 225 +0 92 +0 36 +-9 236 +-2 0 +-6 141 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT output EQ_BUFFER ref diff --git a/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_16bit.amber b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_16bit.amber new file mode 100644 index 0000000..c3e84de --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_16bit.amber @@ -0,0 +1,352 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderInt16 +DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess + +# Based on the following GLSL shader with the bit size and signedness replaced. +# +##version 430 +# +#layout(set = 0, binding = 0) buffer block0 +#{ +# uvec2 inputs[]; +#}; +# +#layout(set = 0, binding = 1) buffer block1 +#{ +# uvec2 outputs[]; +#}; +# +#void main() +#{ +# for (int i = 0; i < inputs.length(); i++) +# { +# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y); +# } +#} +SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %i "i" + OpName %block0 "block0" + OpMemberName %block0 0 "inputs" + OpName %_ "" + OpName %block1 "block1" + OpMemberName %block1 0 "outputs" + OpName %__0 "" + OpName %ResType "ResType" + OpDecorate %_runtimearr_v2uint16 ArrayStride 4 + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_v2uint16_0 ArrayStride 4 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint16 = OpTypeInt 16 0 + %v2uint16 = OpTypeVector %uint16 2 +%_runtimearr_v2uint16 = OpTypeRuntimeArray %v2uint16 + %block0 = OpTypeStruct %_runtimearr_v2uint16 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint16 = OpTypePointer Uniform %uint16 + %uint_1 = OpConstant %uint 1 +%_runtimearr_v2uint16_0 = OpTypeRuntimeArray %v2uint16 + %block1 = OpTypeStruct %_runtimearr_v2uint16_0 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform + %ResType = OpTypeStruct %uint16 %uint16 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %22 = OpArrayLength %uint %_ 0 + %23 = OpBitcast %int %22 + %25 = OpSLessThan %bool %15 %23 + OpBranchConditional %25 %11 %12 + %11 = OpLabel + %26 = OpLoad %int %i + %29 = OpAccessChain %_ptr_Uniform_uint16 %_ %int_0 %26 %uint_0 + %30 = OpLoad %uint16 %29 + %31 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Uniform_uint16 %_ %int_0 %31 %uint_1 + %34 = OpLoad %uint16 %33 + %39 = OpLoad %int %i + %40 = OpAccessChain %_ptr_Uniform_uint16 %__0 %int_0 %39 %uint_0 + %41 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_uint16 %__0 %int_0 %41 %uint_1 + %44 = OpUMulExtended %ResType %30 %34 + %45 = OpCompositeExtract %uint16 %44 0 + OpStore %42 %45 + %46 = OpCompositeExtract %uint16 %44 1 + OpStore %40 %46 + OpBranch %13 + %13 = OpLabel + %47 = OpLoad %int %i + %49 = OpIAdd %int %47 %int_1 + OpStore %i %49 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER input DATA_TYPE vec2 DATA +42562 51047 +11454 34834 +54106 38314 +40502 35639 +46671 16948 +19195 17759 +34768 21323 +23670 5891 +50547 4126 +26425 10425 +31623 17511 +37010 43453 +62450 20493 +58067 59096 +1444 50652 +51678 65270 +9275 10238 +15478 39529 +46419 35448 +7821 21827 +35803 40236 +52166 25400 +52942 37349 +2307 15715 +5466 26618 +41251 50955 +3956 18204 +33994 3010 +46684 31450 +27106 1767 +19604 41877 +18094 47611 +39955 39812 +25853 22653 +28210 61922 +5789 56509 +53416 51668 +40907 58472 +26863 60301 +4496 30592 +63496 4581 +47280 16059 +25687 30146 +553 43704 +14393 29756 +20918 31852 +59296 32965 +53888 49300 +11229 56176 +7335 30275 +64041 44405 +54410 49903 +26120 42367 +56233 35088 +38328 17589 +6656 56461 +11043 18390 +46764 34653 +13902 63708 +40361 17925 +45873 61016 +62746 15250 +45598 10482 +51734 29301 +6471 37406 +44847 4814 +21998 34595 +18993 34503 +48869 24358 +9794 26021 +13113 50601 +15379 44388 +19440 19278 +61501 35868 +15384 43422 +44092 60889 +36299 35507 +2670 22960 +60182 42790 +50855 7406 +63144 50062 +37699 31232 +992 53789 +47985 62529 +62919 29018 +63308 6597 +57886 2324 +37541 42415 +52084 55964 +51123 37352 +19258 8052 +63122 40146 +49819 14529 +48576 11228 +38719 52312 +38307 35490 +11747 22912 +17931 56057 +40391 53776 +8491 20975 +END + +BUFFER output DATA_TYPE vec2 SIZE 100 FILL 0.0 + +BUFFER ref DATA_TYPE vec2 DATA +33152 12942 +6088 5468 +31631 48068 +22025 20378 +12069 26124 +5201 31269 +11312 14832 +2127 44898 +3182 21370 +4203 32817 +8449 36689 +24539 7626 +19528 842 +52360 62472 +1116 3312 +51468 16212 +1448 61322 +9335 51302 +25107 48360 +2604 53223 +21981 22692 +20218 9552 +30171 44102 +553 13097 +2220 4068 +32073 8577 +1098 56496 +1561 20244 +22403 8792 +730 55022 +12526 52772 +13145 2714 +24271 64204 +8936 18313 +26654 23076 +4991 40425 +42112 45856 +36497 46712 +24717 12451 +2098 47104 +4438 26408 +11585 34960 +11815 52462 +368 51064 +6535 348 +10166 41160 +29826 15904 +40537 45568 +9625 16304 +3388 31157 +43392 2493 +41431 214 +16885 50680 +30107 11152 +10286 47896 +5734 20992 +3098 50242 +24727 4220 +13514 15112 +11039 19021 +42709 9944 +14600 50900 +7293 4188 +23130 10254 +3693 29778 +3294 17874 +11612 16778 +9999 21015 +18163 20734 +3888 45706 +10124 44449 +10416 20076 +5718 29472 +33659 41644 +10192 61136 +40965 35548 +19666 37617 +935 27040 +39294 16196 +5746 62274 +48234 51504 +17965 60928 +814 12384 +45783 19377 +27859 16118 +6372 47484 +2052 47192 +24296 38859 +44476 49840 +29137 23864 +2366 7240 +38667 15300 +11044 40667 +8322 20736 +30906 12712 +20744 36646 +4106 56448 +15337 32435 +33143 6768 +2717 37413 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT output EQ_BUFFER ref diff --git a/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_32bit.amber b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_32bit.amber new file mode 100644 index 0000000..74385c0 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_32bit.amber @@ -0,0 +1,347 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Based on the following GLSL shader with the bit size and signedness replaced. +# +##version 430 +# +#layout(set = 0, binding = 0) buffer block0 +#{ +# uvec2 inputs[]; +#}; +# +#layout(set = 0, binding = 1) buffer block1 +#{ +# uvec2 outputs[]; +#}; +# +#void main() +#{ +# for (int i = 0; i < inputs.length(); i++) +# { +# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y); +# } +#} +SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %i "i" + OpName %block0 "block0" + OpMemberName %block0 0 "inputs" + OpName %_ "" + OpName %block1 "block1" + OpMemberName %block1 0 "outputs" + OpName %__0 "" + OpName %ResType "ResType" + OpDecorate %_runtimearr_v2uint ArrayStride 8 + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_v2uint_0 ArrayStride 8 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_runtimearr_v2uint = OpTypeRuntimeArray %v2uint + %block0 = OpTypeStruct %_runtimearr_v2uint +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_1 = OpConstant %uint 1 +%_runtimearr_v2uint_0 = OpTypeRuntimeArray %v2uint + %block1 = OpTypeStruct %_runtimearr_v2uint_0 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform + %ResType = OpTypeStruct %uint %uint + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %22 = OpArrayLength %uint %_ 0 + %23 = OpBitcast %int %22 + %25 = OpSLessThan %bool %15 %23 + OpBranchConditional %25 %11 %12 + %11 = OpLabel + %26 = OpLoad %int %i + %29 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %26 %uint_0 + %30 = OpLoad %uint %29 + %31 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %31 %uint_1 + %34 = OpLoad %uint %33 + %39 = OpLoad %int %i + %40 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %39 %uint_0 + %41 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %41 %uint_1 + %44 = OpUMulExtended %ResType %30 %34 + %45 = OpCompositeExtract %uint %44 0 + OpStore %42 %45 + %46 = OpCompositeExtract %uint %44 1 + OpStore %40 %46 + OpBranch %13 + %13 = OpLabel + %47 = OpLoad %int %i + %49 = OpIAdd %int %47 %int_1 + OpStore %i %49 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER input DATA_TYPE vec2 DATA +2962221445 2512357233 +3789122521 2360927079 +3126710769 4237048712 +3450346476 3359844139 +94806377 4176395575 +2505831010 1864285603 +2587666881 3180595175 +1760139454 1333464393 +2662063710 3988426238 +1620701239 2274489002 +4178476734 4027454678 +4138610613 789091278 +877569916 3268430962 +2091090268 2526026778 +2218320674 1944536768 +3358807101 1721850717 +1310625641 1021215095 +2559921287 3147405671 +3426825096 3366749261 +193280126 1630393860 +806703691 611831745 +617252110 2059054537 +3192490298 3697173440 +233565399 3738398375 +3265405378 2586233254 +1997635143 1046770245 +1003964692 2781173411 +3150161328 1444350366 +3286393115 818761563 +199203858 50343326 +2592440577 880832212 +3621582282 3885792925 +4096279666 3980058751 +1972037796 4134419876 +3092182916 1513146139 +687264091 2094313291 +211201465 4281886835 +918994736 1664508957 +1359468098 4005296660 +3105199532 2512989029 +2771531842 1096876270 +1644352258 2921976300 +2796761006 1107575466 +2364773908 3513200185 +2340278760 2494630437 +1543807791 55075231 +105573679 2745920320 +207131789 3490775728 +43482968 3145068859 +983194023 3910748438 +878731095 474750269 +2606042437 3379809937 +1783998855 1731331375 +3523693680 3647137441 +69388600 2315368538 +2229861702 4218479664 +3057781209 3160244051 +3251886892 4211147762 +2364360504 3258121340 +3474156187 1655469883 +754629039 293234877 +3295778802 3983964943 +1246407887 2288222548 +1999249847 1415299685 +2875502936 730628200 +3091047271 69135450 +3412213777 2952373559 +2020039668 2925939610 +2711239594 3621216325 +4279136611 2868571096 +3843539824 3483753708 +3715243829 1865198592 +1684933350 2954692183 +3377437368 28335340 +3067911493 1690343903 +1407935362 334461086 +51781303 617558780 +92816274 132855267 +2892897568 3496167897 +3683544373 2509349181 +1954871720 593434031 +598062133 2817321612 +3437230024 2771934350 +391546715 3800564614 +2177122555 1356727648 +2051654929 844599681 +2014766276 654332760 +1932357807 4059066842 +1143676992 2480778159 +2490554570 111208950 +462729577 2605038307 +2973905305 497751761 +2914557244 1883785118 +4127892478 54281635 +1893973055 2095722936 +802337054 3691890517 +1540993921 2602046888 +1022800787 3804104117 +677776472 2009973172 +521004900 1549302883 +END + +BUFFER output DATA_TYPE vec2 SIZE 100 FILL 0.0 + +BUFFER ref DATA_TYPE vec2 DATA +1732762547 1994798773 +2082866142 3641954127 +3084546382 2902856456 +2699118662 3594626212 +92189045 60109455 +1087688066 3774459494 +1916270888 1979020327 +546472912 3433575470 +2472066494 2924242756 +858275951 3144974982 +3918219746 1651034836 +760364704 1043813030 +667822706 2977916216 +1229846387 914436952 +1004339687 4067665280 +1346544459 1106528553 +311627678 2944832207 +1875942287 4168972625 +2686227871 3985547240 +73370228 930362872 +114917505 1249554315 +295917447 387509758 +2748144403 1652840832 +203298523 467722817 +1966278063 946812364 +486864016 1739499299 +650109701 2365865916 +1059364682 3328406176 +626494261 1343150489 +2334961 3631316252 +531669978 142426836 +3276560178 815016162 +3795938969 1739699342 +1898322314 4108590352 +1089397035 2742793964 +335123930 751340201 +210558244 633025051 +356155207 3142740080 +1267779858 3658428712 +1816854895 1169420508 +707811561 2813480284 +1118694973 3492882392 +721221760 2147517836 +1934339322 3711959668 +1359295711 1422550664 +19796558 1525557553 +67496884 1061351616 +168348341 2607561456 +31841203 3003396424 +895239526 3441644378 +97131781 932680379 +2050755574 2396588565 +719142423 2674377417 +2992198604 3626218096 +37406613 1846738352 +2190150842 3722564896 +2249920478 3391150171 +3188423860 3036853144 +1793581390 771333920 +1339093068 3056311993 +51521592 753937971 +3057128565 708128046 +664046646 3449946860 +658803078 4181261107 +489159378 3182693312 +49756128 1516267062 +2345566109 4109351079 +1376148797 827706568 +2285927785 1186452690 +2857997919 4008938632 +3117589772 621570880 +1613438958 85171200 +1159137906 297080874 +22282087 1199358368 +1207419086 199965723 +109639854 2924108348 +7445457 3988716068 +2871065 584524918 +2354862076 3540308000 +2152123268 2544065185 +270103897 750350808 +392304121 2838691580 +2218358212 1023889648 +346474952 2033773218 +687726392 1216824608 +403455248 2995908241 +306947058 2416586592 +1826223335 2256483334 +660589174 4282764224 +64487559 1743531036 +280660640 3792476699 +344651425 3716195305 +1278333263 3832327944 +52170071 4035043514 +924161349 1347247176 +689677093 1864966390 +933589981 296706472 +905906940 4178105839 +317188102 562496992 +187939590 953478060 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT output EQ_BUFFER ref diff --git a/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_64bit.amber b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_64bit.amber new file mode 100644 index 0000000..155a6f8 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_64bit.amber @@ -0,0 +1,351 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderInt64 + +# Based on the following GLSL shader with the bit size and signedness replaced. +# +##version 430 +# +#layout(set = 0, binding = 0) buffer block0 +#{ +# uvec2 inputs[]; +#}; +# +#layout(set = 0, binding = 1) buffer block1 +#{ +# uvec2 outputs[]; +#}; +# +#void main() +#{ +# for (int i = 0; i < inputs.length(); i++) +# { +# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y); +# } +#} +SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %i "i" + OpName %block0 "block0" + OpMemberName %block0 0 "inputs" + OpName %_ "" + OpName %block1 "block1" + OpMemberName %block1 0 "outputs" + OpName %__0 "" + OpName %ResType "ResType" + OpDecorate %_runtimearr_v2uint64 ArrayStride 16 + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_v2uint64_0 ArrayStride 16 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint64 = OpTypeInt 64 0 + %v2uint64 = OpTypeVector %uint64 2 +%_runtimearr_v2uint64 = OpTypeRuntimeArray %v2uint64 + %block0 = OpTypeStruct %_runtimearr_v2uint64 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint64 = OpTypePointer Uniform %uint64 + %uint_1 = OpConstant %uint 1 +%_runtimearr_v2uint64_0 = OpTypeRuntimeArray %v2uint64 + %block1 = OpTypeStruct %_runtimearr_v2uint64_0 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform + %ResType = OpTypeStruct %uint64 %uint64 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %22 = OpArrayLength %uint %_ 0 + %23 = OpBitcast %int %22 + %25 = OpSLessThan %bool %15 %23 + OpBranchConditional %25 %11 %12 + %11 = OpLabel + %26 = OpLoad %int %i + %29 = OpAccessChain %_ptr_Uniform_uint64 %_ %int_0 %26 %uint_0 + %30 = OpLoad %uint64 %29 + %31 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Uniform_uint64 %_ %int_0 %31 %uint_1 + %34 = OpLoad %uint64 %33 + %39 = OpLoad %int %i + %40 = OpAccessChain %_ptr_Uniform_uint64 %__0 %int_0 %39 %uint_0 + %41 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_uint64 %__0 %int_0 %41 %uint_1 + %44 = OpUMulExtended %ResType %30 %34 + %45 = OpCompositeExtract %uint64 %44 0 + OpStore %42 %45 + %46 = OpCompositeExtract %uint64 %44 1 + OpStore %40 %46 + OpBranch %13 + %13 = OpLabel + %47 = OpLoad %int %i + %49 = OpIAdd %int %47 %int_1 + OpStore %i %49 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER input DATA_TYPE vec2 DATA +10094288367415119808 1585044416077535558 +1888758149242584402 13735935725321126321 +15944051223964681736 1731946580463699378 +14230337528211632464 17329268761692637369 +5508706484046391021 9889059313707222819 +10591992408819184703 15377370230438219904 +6005665344539703407 16257832239706650257 +355313408763532328 1280904805853334496 +11405211680956869123 823051038796631050 +4095929435154054010 5061337309657092962 +2316441975305767128 5159918860500078605 +8491474951551896353 3955559687522444900 +2721057669544809267 9388196049200524131 +17067810391095662475 15126590013504238451 +3734157293172879053 11200502616118249132 +14962400930642880638 10862760690373815346 +14065099498423709147 10277388316157826761 +5624450429005896998 13764686283483127833 +12589082655240429546 14066115263437631987 +18410197572295736664 10917780363314260877 +17521599162635819557 3649803441919196859 +15385811163204971407 14392877099205421598 +11935502018751233554 17146067988496153848 +13830697343515674162 18274429202917173726 +11280369176771485221 10681916208201421336 +17898416034547720769 17560089668057624977 +8793970216262107881 17681530417044917593 +7431034359200911091 6778926520675712578 +5996313108013259362 14406559955132669934 +5656733788212271227 17234480472733182679 +17667575984470783395 13821598998243704477 +7641659812818653057 167481054796026660 +5013238065194306839 1358065335748893941 +11299540603646371410 18023693357028342744 +12689980231749630828 5179311415301396511 +15726002655573876885 2798467024200474978 +7277572188975415895 10855608033996957488 +1492591637881730681 10218288704697954027 +14252642771243793129 4123140648524334614 +7789196198485669091 9075943778809166416 +2574117355812736631 15309206106717527666 +3674470655233383817 5800010337634120485 +13208167359142417338 3105942311702332436 +13450438530965130999 12085154638668978777 +9848090507526100142 13023968381247910231 +13002195050098702823 10338412060445406759 +7994766691674000792 3850872962513579911 +4020480539724509173 8704004968327816238 +11742758694977385016 1701873357902620120 +12968025479666304361 632029467618714131 +8784031599896875534 4797818446121775516 +1973832460769375992 9170149018032891246 +3730004258462369508 14374440384501245421 +12051735551210976831 4306295835576489947 +15928194234311509309 16320387629392238220 +12618067261357507298 16744747955873671751 +5204875820039951670 11577651554673980571 +11131994098105813205 7940355326084960035 +5871348567459097940 4886642900176074880 +1559335015169460699 2557344399587374974 +17251672562959904445 16181871442717325508 +4152452541889262718 4415679213469427219 +12750358863276780773 10946738095287651944 +4894664882300905785 11297118915389062283 +16223787495147748246 7135250498641485382 +11582594101915655812 10894819324918288843 +7576280808124342035 14862228941201291263 +15412491000270354745 9823474528985886680 +2938971052182423559 4977741946844009247 +7651145024934740158 17016143062141774335 +13374597074993356357 15597464994273158074 +16323465184486276103 4388038433914719407 +5228978508079586634 4458732941677800367 +1271636809190249588 11124628681314802591 +15412357495164404494 7750122116953999890 +10219754867553929823 12572945121094913430 +18287391403148276595 14004925528427805990 +6365103445149002821 2958886156715782504 +2444878943809587327 17702409156699692162 +462982434220535393 10605902611919764660 +12980000794949824904 17009905983313476712 +5223800341610013633 8590893444731791961 +9087428225057297816 15161385906279990780 +6831574038701029563 12268584502667126861 +242021581535622491 1463701764264692971 +4392111212166762680 9521989650499039985 +8011924068051422185 760804195312997618 +5982254671385889932 7412259631532296771 +16482773045869450589 13616148511758920490 +14136040722786307253 2212642776109219055 +17301156833959806060 7803549334969109513 +374143880623214877 9530644935337363359 +16529617380314091321 15583241728968930482 +16309565321233977039 13995230058057177576 +2711595102399333973 18097871744055939419 +9146141962961360941 4670159655128934978 +330973046690336184 12831229675870452548 +16672269577760031928 8538496358806954669 +10054645438318101222 9243374992250196050 +12357502882746024658 1541715316514891786 +END + +BUFFER output DATA_TYPE vec2 SIZE 100 FILL 0.0 + +BUFFER ref DATA_TYPE vec2 DATA +867356068209941624 14778067601375268480 +1406419497934490561 8550080122851948466 +1496971220815045394 8975966436525103504 +13368285623230306824 14025039989914919632 +2953145820469090788 16515106986971794791 +8829579252445819953 2544171494810734464 +5293026198509609600 9970982149051211999 +24672248449415164 5706347886422481664 +508874156013556422 6868593445030791198 +1123823282039985263 2979931846761042612 +647954597834384337 5962784446141657848 +1820838185413757618 14810219385469239012 +1384841832292533207 15103844094065409465 +13995844967692079498 12633945062006457457 +2267307355924582845 2681062505162604476 +8810930536768458223 4406341419172532380 +7836206144189668195 4867298759011029747 +4196881322954231043 14467767125266929846 +9599498262781802877 9886746835180688670 +10896150168094484760 3182317357244322168 +3466757747393446379 11140469801656372999 +12004616546895054180 4193311705143693506 +11093932255611774869 16666100670636677488 +13701501924736433168 5211791742133068124 +6532098990606307780 12805432242825702776 +17038117362445446587 18292005118068512721 +8429175969705805604 7334793217220794369 +2730803641680786246 8690552178248529062 +4683007687164658736 12357724908464104732 +5284990544826778543 4334883988626701645 +13237791425554788440 7147990644918640375 +69379899278122708 484520771754803492 +369078944717430796 11657405651751996163 +11040401173325228246 4124580187884403504 +3562978876468624963 9752340262302650900 +2385716399504568839 1082545119799389706 +4282732541144174474 5335448370421821776 +826798063286973187 12645494354948882195 +3185692311022251465 3354082078240949766 +3832346049638326873 9336374506453071088 +2136295325914998985 13095473220469023486 +1155324088659138211 14939485269444792269 +2223904971895476661 2905918657023341192 +8811887287811060670 4159049216283265503 +6953054635180120332 1175758087296290 +7287033938405606691 8793616100437118001 +1668957446991916115 7417298858434597672 +1897043860585758421 945177290283192838 +1083372116586346001 15925765090883434304 +444315495852770457 12189775322856216779 +2284641054968938331 6419130543375232648 +981221278376300886 10330887923255834256 +2906568423834648016 11654517704151029012 +2813414573773747626 2579996159716954341 +14092151064788896843 17446803705067641692 +11453856308594839663 5523233056896393390 +3266714081844607684 13814960474290786226 +4791739304976741660 15323598086332739615 +1555352189903467867 5835811774659824128 +216176722146186094 6840796291434718922 +15133529606644143152 17171500923204149428 +993991042585730539 15307463268183120218 +7566367188676059324 12513982188559205128 +2997581091025157762 11692951559997963763 +6275404881861491964 5828562854797926148 +6840788246966719162 10269193241572439724 +6104080993547936166 7160176606218995949 +8207638820400969583 6599481207385800472 +793063503703004068 3963213344162676185 +7057775497576068947 15841260065026976578 +11308760443368942840 4810988446940146978 +3882961259612171768 18116755600320453833 +1263888013632057361 17152139196831249302 +766882614254684505 11236891719146172428 +6475270227655684743 8185149483209310972 +6965587888429948134 1515575589204338346 +13883943620994753061 13431678730564307474 +1020972394622048317 7214786734761013512 +2346226912943432028 7719699129102873726 +266190423022717192 4932738619466029108 +11968973619583110818 3830010706662653760 +2432793122298714147 2335344837003892761 +7468960682989960953 16164617581216086432 +4543552132838583090 12781954127172618303 +19203790894930783 12464233401191415433 +2267155512050348353 10817601149091671352 +330438012212142311 3336305105825330754 +2403785981367614292 8152682470811713700 +12166476901364805159 10357316182941081666 +1695584232267662675 12561877102523173115 +7318930124815970288 12615217107922663372 +193304166128220055 6146245761054632963 +13963712094423909519 4334392027804314018 +12373788995256522445 13253958077539656344 +2660312312511245900 16889820913918207287 +2315527500399388422 17176185736536104346 +230219011096861236 6233832247807839456 +7717140353545592706 357216377668558936 +5038225598464785880 2909802612996591020 +1032797516574167952 2800974998360648756 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT output EQ_BUFFER ref diff --git a/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_8bit.amber b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_8bit.amber new file mode 100644 index 0000000..8d75ba1 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/mul_extended/unsigned_8bit.amber @@ -0,0 +1,352 @@ +#!amber +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE Float16Int8Features.shaderInt8 +DEVICE_FEATURE Storage8BitFeatures.storageBuffer8BitAccess + +# Based on the following GLSL shader with the bit size and signedness replaced. +# +##version 430 +# +#layout(set = 0, binding = 0) buffer block0 +#{ +# uvec2 inputs[]; +#}; +# +#layout(set = 0, binding = 1) buffer block1 +#{ +# uvec2 outputs[]; +#}; +# +#void main() +#{ +# for (int i = 0; i < inputs.length(); i++) +# { +# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y); +# } +#} +SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpCapability Int8 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %i "i" + OpName %block0 "block0" + OpMemberName %block0 0 "inputs" + OpName %_ "" + OpName %block1 "block1" + OpMemberName %block1 0 "outputs" + OpName %__0 "" + OpName %ResType "ResType" + OpDecorate %_runtimearr_v2uint8 ArrayStride 2 + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_v2uint8_0 ArrayStride 2 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint8 = OpTypeInt 8 0 + %v2uint8 = OpTypeVector %uint8 2 +%_runtimearr_v2uint8 = OpTypeRuntimeArray %v2uint8 + %block0 = OpTypeStruct %_runtimearr_v2uint8 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint8 = OpTypePointer Uniform %uint8 + %uint_1 = OpConstant %uint 1 +%_runtimearr_v2uint8_0 = OpTypeRuntimeArray %v2uint8 + %block1 = OpTypeStruct %_runtimearr_v2uint8_0 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform + %ResType = OpTypeStruct %uint8 %uint8 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %22 = OpArrayLength %uint %_ 0 + %23 = OpBitcast %int %22 + %25 = OpSLessThan %bool %15 %23 + OpBranchConditional %25 %11 %12 + %11 = OpLabel + %26 = OpLoad %int %i + %29 = OpAccessChain %_ptr_Uniform_uint8 %_ %int_0 %26 %uint_0 + %30 = OpLoad %uint8 %29 + %31 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Uniform_uint8 %_ %int_0 %31 %uint_1 + %34 = OpLoad %uint8 %33 + %39 = OpLoad %int %i + %40 = OpAccessChain %_ptr_Uniform_uint8 %__0 %int_0 %39 %uint_0 + %41 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_uint8 %__0 %int_0 %41 %uint_1 + %44 = OpUMulExtended %ResType %30 %34 + %45 = OpCompositeExtract %uint8 %44 0 + OpStore %42 %45 + %46 = OpCompositeExtract %uint8 %44 1 + OpStore %40 %46 + OpBranch %13 + %13 = OpLabel + %47 = OpLoad %int %i + %49 = OpIAdd %int %47 %int_1 + OpStore %i %49 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER input DATA_TYPE vec2 DATA +154 114 +78 71 +95 58 +31 187 +107 68 +30 1 +188 217 +36 208 +81 158 +229 102 +71 124 +113 254 +90 82 +74 140 +105 63 +14 253 +86 174 +198 55 +187 98 +53 56 +135 153 +196 82 +19 156 +25 163 +188 56 +35 150 +250 105 +98 160 +223 0 +185 58 +204 65 +62 220 +169 255 +54 37 +115 83 +11 88 +217 244 +149 73 +74 4 +110 146 +45 88 +137 6 +192 82 +78 211 +252 73 +119 51 +254 200 +119 26 +230 194 +171 128 +192 28 +203 215 +61 232 +80 231 +47 139 +127 158 +140 29 +192 207 +52 71 +196 36 +244 201 +129 22 +177 161 +167 132 +89 238 +35 207 +148 0 +20 22 +138 40 +255 15 +46 167 +141 238 +85 249 +91 218 +127 188 +96 96 +143 116 +23 108 +110 100 +194 43 +227 43 +141 156 +92 246 +68 185 +147 48 +232 2 +64 186 +47 7 +180 68 +47 26 +41 204 +49 145 +160 82 +96 179 +79 188 +199 104 +21 108 +79 52 +15 237 +207 39 +END + +BUFFER output DATA_TYPE vec2 SIZE 100 FILL 0.0 + +BUFFER ref DATA_TYPE vec2 DATA +68 148 +21 162 +21 134 +22 165 +28 108 +0 30 +159 92 +29 64 +49 254 +91 62 +34 100 +112 30 +28 212 +40 120 +25 215 +13 214 +58 116 +42 138 +71 150 +11 152 +80 175 +62 200 +11 148 +15 235 +41 32 +20 130 +102 138 +61 64 +0 0 +41 234 +51 204 +53 72 +168 87 +7 206 +37 73 +3 200 +206 212 +42 125 +1 40 +62 188 +15 120 +3 54 +61 128 +64 74 +71 220 +23 181 +198 112 +12 22 +174 76 +85 128 +21 0 +170 125 +55 72 +72 48 +25 133 +78 98 +15 220 +155 64 +14 108 +27 144 +191 148 +11 22 +111 81 +86 28 +82 190 +28 77 +0 0 +1 184 +21 144 +14 241 +30 2 +131 22 +82 173 +77 126 +93 68 +36 0 +64 204 +9 180 +42 248 +32 150 +38 33 +85 236 +88 104 +49 36 +27 144 +1 208 +46 128 +1 73 +47 208 +4 198 +32 172 +27 193 +51 64 +67 32 +58 4 +80 216 +8 220 +16 12 +13 227 +31 137 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT output EQ_BUFFER ref diff --git a/vulkan/amber/spirv_assembly/instruction/compute/ptr_access_chain/workgroup.amber b/vulkan/amber/spirv_assembly/instruction/compute/ptr_access_chain/workgroup.amber new file mode 100644 index 0000000..f0980c9 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/ptr_access_chain/workgroup.amber @@ -0,0 +1,120 @@ +# Test OpPtrAccessChain applied to workgroup memory. +# +# Derived from the following OpenCL C: +# +#int get_data(local int *d); +# +#int get_data(local int *d) { +# return d[1]; +#} +# +#kernel void foo(global int *A, global int*B, global int*C) __attribute__((reqd_work_group_size(16,1,1))) { +# local int data[17]; +# uint i = get_local_id(0); +# data[i] = A[i] * B[i]; +# +# if (i == 0) data[16] = 0; +# barrier(CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE); +# C[i] = get_data(&data[i]); +#} +# +# Compiled with `clspv -no-inline-single -cl-opt-disable ` with a (correct) ArrayStride decoration +# added. This is allowed but not needed so provides a baseline for comparison. + +[require] +VK_KHR_workgroup_memory_explicit_layout +VariablePointerFeatures.variablePointers + +[compute shader spirv] + OpCapability Shader + OpCapability VariablePointers + OpCapability WorkgroupMemoryExplicitLayoutKHR + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpExtension "SPV_KHR_variable_pointers" + OpExtension "SPV_KHR_workgroup_memory_explicit_layout" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %30 "main" %gl_LocalInvocationID %20 %22 %23 %24 + OpExecutionMode %30 LocalSize 16 1 1 + OpSource OpenCL_C 120 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 1 + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 2 + OpDecorate %_arr_uint_uint_17 ArrayStride 4 + OpDecorate %_ptr_Workgroup_uint ArrayStride 4 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_3 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %6 = OpTypeFunction %uint %_ptr_Workgroup_uint + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_17 = OpConstant %uint 17 +%_arr_uint_uint_17 = OpTypeArray %uint %uint_17 +%_ptr_Workgroup__arr_uint_uint_17 = OpTypePointer Workgroup %_arr_uint_uint_17 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_16 = OpConstant %uint 16 + %uint_264 = OpConstant %uint 264 + %20 = OpVariable %_ptr_Workgroup__arr_uint_uint_17 Workgroup +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %22 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer + %23 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer + %24 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer + %25 = OpFunction %uint Pure %6 + %26 = OpFunctionParameter %_ptr_Workgroup_uint + %27 = OpLabel + %28 = OpPtrAccessChain %_ptr_Workgroup_uint %26 %uint_1 + %29 = OpLoad %uint %28 + OpReturnValue %29 + OpFunctionEnd + %30 = OpFunction %void None %8 + %31 = OpLabel + %32 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %34 = OpAccessChain %_ptr_StorageBuffer_uint %22 %uint_0 %33 + %35 = OpLoad %uint %34 + %36 = OpAccessChain %_ptr_StorageBuffer_uint %23 %uint_0 %33 + %37 = OpLoad %uint %36 + %38 = OpIMul %uint %37 %35 + %39 = OpAccessChain %_ptr_Workgroup_uint %20 %33 + OpStore %39 %38 + %40 = OpIEqual %bool %33 %uint_0 + OpSelectionMerge %43 None + OpBranchConditional %40 %41 %43 + %41 = OpLabel + %42 = OpAccessChain %_ptr_Workgroup_uint %20 %uint_16 + OpStore %42 %uint_0 + OpBranch %43 + %43 = OpLabel + OpControlBarrier %uint_2 %uint_1 %uint_264 + %44 = OpFunctionCall %uint %25 %39 + %45 = OpAccessChain %_ptr_StorageBuffer_uint %24 %uint_0 %33 + OpStore %45 %44 + OpReturn + OpFunctionEnd + +[test] +# A[] +ssbo 0:0 subdata int 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# B[] +ssbo 0:1 subdata int 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +# The answer array C[] +ssbo 0:2 subdata int 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 + +compute 1 1 1 + +probe ssbo int 0:2 0 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/ptr_access_chain/workgroup_bad_stride.amber b/vulkan/amber/spirv_assembly/instruction/compute/ptr_access_chain/workgroup_bad_stride.amber new file mode 100644 index 0000000..18f2983 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/ptr_access_chain/workgroup_bad_stride.amber @@ -0,0 +1,120 @@ +# Test OpPtrAccessChain applied to workgroup memory. +# +# Derived from the following OpenCL C: +# +#int get_data(local int *d); +# +#int get_data(local int *d) { +# return d[1]; +#} +# +#kernel void foo(global int *A, global int*B, global int*C) __attribute__((reqd_work_group_size(16,1,1))) { +# local int data[17]; +# uint i = get_local_id(0); +# data[i] = A[i] * B[i]; +# +# if (i == 0) data[16] = 0; +# barrier(CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE); +# C[i] = get_data(&data[i]); +#} +# +# Compiled with `clspv -no-inline-single -cl-opt-disable ` with an incorrect ArrayStride decoration +# added. This decoration should be ignored, so it should give the same results as ArrayStride == 4. + +[require] +VK_KHR_workgroup_memory_explicit_layout +VariablePointerFeatures.variablePointers + +[compute shader spirv] + OpCapability Shader + OpCapability VariablePointers + OpCapability WorkgroupMemoryExplicitLayoutKHR + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpExtension "SPV_KHR_variable_pointers" + OpExtension "SPV_KHR_workgroup_memory_explicit_layout" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %30 "main" %gl_LocalInvocationID %20 %22 %23 %24 + OpExecutionMode %30 LocalSize 16 1 1 + OpSource OpenCL_C 120 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 1 + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 2 + OpDecorate %_arr_uint_uint_17 ArrayStride 4 + OpDecorate %_ptr_Workgroup_uint ArrayStride 8 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_3 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %6 = OpTypeFunction %uint %_ptr_Workgroup_uint + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_17 = OpConstant %uint 17 +%_arr_uint_uint_17 = OpTypeArray %uint %uint_17 +%_ptr_Workgroup__arr_uint_uint_17 = OpTypePointer Workgroup %_arr_uint_uint_17 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_16 = OpConstant %uint 16 + %uint_264 = OpConstant %uint 264 + %20 = OpVariable %_ptr_Workgroup__arr_uint_uint_17 Workgroup +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %22 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer + %23 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer + %24 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer + %25 = OpFunction %uint Pure %6 + %26 = OpFunctionParameter %_ptr_Workgroup_uint + %27 = OpLabel + %28 = OpPtrAccessChain %_ptr_Workgroup_uint %26 %uint_1 + %29 = OpLoad %uint %28 + OpReturnValue %29 + OpFunctionEnd + %30 = OpFunction %void None %8 + %31 = OpLabel + %32 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %34 = OpAccessChain %_ptr_StorageBuffer_uint %22 %uint_0 %33 + %35 = OpLoad %uint %34 + %36 = OpAccessChain %_ptr_StorageBuffer_uint %23 %uint_0 %33 + %37 = OpLoad %uint %36 + %38 = OpIMul %uint %37 %35 + %39 = OpAccessChain %_ptr_Workgroup_uint %20 %33 + OpStore %39 %38 + %40 = OpIEqual %bool %33 %uint_0 + OpSelectionMerge %43 None + OpBranchConditional %40 %41 %43 + %41 = OpLabel + %42 = OpAccessChain %_ptr_Workgroup_uint %20 %uint_16 + OpStore %42 %uint_0 + OpBranch %43 + %43 = OpLabel + OpControlBarrier %uint_2 %uint_1 %uint_264 + %44 = OpFunctionCall %uint %25 %39 + %45 = OpAccessChain %_ptr_StorageBuffer_uint %24 %uint_0 %33 + OpStore %45 %44 + OpReturn + OpFunctionEnd + +[test] +# A[] +ssbo 0:0 subdata int 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# B[] +ssbo 0:1 subdata int 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +# The answer array C[] +ssbo 0:2 subdata int 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 + +compute 1 1 1 + +probe ssbo int 0:2 0 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan.amber new file mode 100644 index 0000000..3c3d788 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan.amber @@ -0,0 +1,69 @@ +# Test SGreaterThan with unsigned int params +# Google bug b/73133282 +# +# Derived from the following OpenCL C, but cleaned up to be more generic. +# +# kernel void foo(global int *A, global int*B, global int*C) __attribute__((reqd_work_group_size(1,1,1))) { +# uint i = get_global_id(0); +# C[i] = A[i] > B[i]; +# } + +[compute shader spirv] + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %18 "main" %gl_GlobalInvocationID + OpExecutionMode %18 LocalSize 1 1 1 + OpSource OpenCL_C 120 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 BufferBlock + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 2 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_3 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_3 = OpTypePointer Uniform %_struct_3 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Uniform__struct_3 Uniform + %16 = OpVariable %_ptr_Uniform__struct_3 Uniform + %17 = OpVariable %_ptr_Uniform__struct_3 Uniform + %18 = OpFunction %void None %6 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %22 = OpAccessChain %_ptr_Uniform_uint %15 %uint_0 %21 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_Uniform_uint %16 %uint_0 %21 + %25 = OpLoad %uint %24 + %26 = OpSGreaterThan %bool %23 %25 + %27 = OpSelect %uint %26 %uint_1 %uint_0 + %28 = OpAccessChain %_ptr_Uniform_uint %17 %uint_0 %21 + OpStore %28 %27 + OpReturn + OpFunctionEnd + +[test] +# A[] +ssbo 0:0 subdata int 0 -8 -7 -6 -5 -4 -3 -2 0 0 1 2 3 4 5 6 7 +# B[] +ssbo 0:1 subdata int 0 -9 -7 -5 2 -1 1 0 0 1 0 2 -2 4 8 4 -4 +# The answer array C[] +ssbo 0:2 subdata int 0 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 + +compute 16 1 1 + +probe ssbo int 0:2 0 == 1 0 0 0 0 0 0 0 0 1 0 1 0 0 1 1 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal.amber new file mode 100644 index 0000000..607a53b --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal.amber @@ -0,0 +1,69 @@ +# Test SGreaterThanEqual with unsigned int params +# Google bug b/73133282 +# +# Derived from the following OpenCL C, but cleaned up to be more generic. +# +# kernel void foo(global int *A, global int*B, global int*C) __attribute__((reqd_work_group_size(1,1,1))) { +# uint i = get_global_id(0); +# C[i] = A[i] >= B[i]; +# } + +[compute shader spirv] + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %18 "main" %gl_GlobalInvocationID + OpExecutionMode %18 LocalSize 1 1 1 + OpSource OpenCL_C 120 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 BufferBlock + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 2 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_3 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_3 = OpTypePointer Uniform %_struct_3 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Uniform__struct_3 Uniform + %16 = OpVariable %_ptr_Uniform__struct_3 Uniform + %17 = OpVariable %_ptr_Uniform__struct_3 Uniform + %18 = OpFunction %void None %6 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %22 = OpAccessChain %_ptr_Uniform_uint %15 %uint_0 %21 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_Uniform_uint %16 %uint_0 %21 + %25 = OpLoad %uint %24 + %26 = OpSGreaterThanEqual %bool %23 %25 + %27 = OpSelect %uint %26 %uint_1 %uint_0 + %28 = OpAccessChain %_ptr_Uniform_uint %17 %uint_0 %21 + OpStore %28 %27 + OpReturn + OpFunctionEnd + +[test] +# A[] +ssbo 0:0 subdata int 0 -8 -7 -6 -5 -4 -3 -2 0 0 1 2 3 4 5 6 7 +# B[] +ssbo 0:1 subdata int 0 -9 -7 -5 2 -1 1 0 0 1 0 2 -2 4 8 4 -4 +# The answer array C[] +ssbo 0:2 subdata int 0 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 + +compute 16 1 1 + +probe ssbo int 0:2 0 == 1 1 0 0 0 0 0 1 0 1 1 1 1 0 1 1 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan.amber new file mode 100644 index 0000000..2a75eed --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan.amber @@ -0,0 +1,69 @@ +# Test SLessThan with unsigned int params +# Google bug b/73133282 +# +# Derived from the following OpenCL C, but cleaned up to be more generic. +# +# kernel void foo(global int *A, global int*B, global int*C) __attribute__((reqd_work_group_size(1,1,1))) { +# uint i = get_global_id(0); +# C[i] = A[i] < B[i]; +# } + +[compute shader spirv] + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %18 "main" %gl_GlobalInvocationID + OpExecutionMode %18 LocalSize 1 1 1 + OpSource OpenCL_C 120 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 BufferBlock + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 2 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_3 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_3 = OpTypePointer Uniform %_struct_3 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Uniform__struct_3 Uniform + %16 = OpVariable %_ptr_Uniform__struct_3 Uniform + %17 = OpVariable %_ptr_Uniform__struct_3 Uniform + %18 = OpFunction %void None %6 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %22 = OpAccessChain %_ptr_Uniform_uint %15 %uint_0 %21 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_Uniform_uint %16 %uint_0 %21 + %25 = OpLoad %uint %24 + %26 = OpSLessThan %bool %23 %25 + %27 = OpSelect %uint %26 %uint_1 %uint_0 + %28 = OpAccessChain %_ptr_Uniform_uint %17 %uint_0 %21 + OpStore %28 %27 + OpReturn + OpFunctionEnd + +[test] +# A[] +ssbo 0:0 subdata int 0 -8 -7 -6 -5 -4 -3 -2 0 0 1 2 3 4 5 6 7 +# B[] +ssbo 0:1 subdata int 0 -9 -7 -5 2 -1 1 0 0 1 0 2 -2 4 8 4 -4 +# The answer array C[] +ssbo 0:2 subdata int 0 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 + +compute 16 1 1 + +probe ssbo int 0:2 0 == 0 0 1 1 1 1 1 0 1 0 0 0 0 1 0 0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal.amber new file mode 100644 index 0000000..736d42c --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal.amber @@ -0,0 +1,69 @@ +# Test SLessThanEqual with unsigned int params +# Google bug b/73133282 +# +# Derived from the following OpenCL C, but cleaned up to be more generic. +# +# kernel void foo(global int *A, global int*B, global int*C) __attribute__((reqd_work_group_size(1,1,1))) { +# uint i = get_global_id(0); +# C[i] = A[i] < B[i]; +# } + +[compute shader spirv] + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %18 "main" %gl_GlobalInvocationID + OpExecutionMode %18 LocalSize 1 1 1 + OpSource OpenCL_C 120 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 BufferBlock + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 2 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_3 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_3 = OpTypePointer Uniform %_struct_3 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Uniform__struct_3 Uniform + %16 = OpVariable %_ptr_Uniform__struct_3 Uniform + %17 = OpVariable %_ptr_Uniform__struct_3 Uniform + %18 = OpFunction %void None %6 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %22 = OpAccessChain %_ptr_Uniform_uint %15 %uint_0 %21 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_Uniform_uint %16 %uint_0 %21 + %25 = OpLoad %uint %24 + %26 = OpSLessThanEqual %bool %23 %25 + %27 = OpSelect %uint %26 %uint_1 %uint_0 + %28 = OpAccessChain %_ptr_Uniform_uint %17 %uint_0 %21 + OpStore %28 %27 + OpReturn + OpFunctionEnd + +[test] +# A[] +ssbo 0:0 subdata int 0 -8 -7 -6 -5 -4 -3 -2 0 0 1 2 3 4 5 6 7 +# B[] +ssbo 0:1 subdata int 0 -9 -7 -5 2 -1 1 0 0 1 0 2 -2 4 8 4 -4 +# The answer array C[] +ssbo 0:2 subdata int 0 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 + +compute 16 1 1 + +probe ssbo int 0:2 0 == 0 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_findumsb.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_findumsb.amber new file mode 100644 index 0000000..d34980b --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_findumsb.amber @@ -0,0 +1,76 @@ +#!amber +# Test GLSL.std.450 FindUMsb instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + %glsl = OpExtInstImport "GLSL.std.450" + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_int ArrayStride 4 + OpDecorate %struct_int2 BufferBlock + OpMemberDecorate %struct_int2 0 Offset 0 + OpDecorate %input DescriptorSet 0 + OpDecorate %input Binding 0 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 1 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %ra_int = OpTypeRuntimeArray %int + %int2 = OpTypeVector %int 2 + %ptr_int = OpTypePointer Uniform %int + %struct_int2 = OpTypeStruct %ra_int + %ptr_struct_int2 = OpTypePointer Uniform %struct_int2 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input = OpVariable %ptr_struct_int2 Uniform + + %output = OpVariable %ptr_struct_int2 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr = OpAccessChain %ptr_int %input %uint_0 %index + %invalue = OpLoad %int %in_ptr + + %outvalue = OpExtInst %int %glsl FindUMsb %invalue + %out_ptr = OpAccessChain %ptr_int %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA + 0 -1 +END + +BUFFER data1 DATA_TYPE int32 DATA + 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA +-1 31 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN compute_pipeline 2 1 1 + +EXPECT data1 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp.amber new file mode 100644 index 0000000..db6ef7e --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp.amber @@ -0,0 +1,97 @@ +#!amber +# Test GLSL.std.450 UClamp instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + %glsl = OpExtInstImport "GLSL.std.450" + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_int ArrayStride 4 + OpDecorate %struct_int4 BufferBlock + OpMemberDecorate %struct_int4 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %input2 DescriptorSet 0 + OpDecorate %input2 Binding 2 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 3 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %ra_int = OpTypeRuntimeArray %int + %int4 = OpTypeVector %int 4 + %ptr_input_int = OpTypePointer Input %int + %ptr_int = OpTypePointer Uniform %int + %struct_int4 = OpTypeStruct %ra_int + %ptr_struct_int4 = OpTypePointer Uniform %struct_int4 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_int4 Uniform + %input1 = OpVariable %ptr_struct_int4 Uniform + %input2 = OpVariable %ptr_struct_int4 Uniform + + %output = OpVariable %ptr_struct_int4 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index + %invalue0 = OpLoad %int %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index + %invalue1 = OpLoad %int %in_ptr1 + %in_ptr2 = OpAccessChain %ptr_int %input2 %uint_0 %index + %invalue2 = OpLoad %int %in_ptr2 + + %outvalue = OpExtInst %int %glsl UClamp %invalue0 %invalue1 %invalue2 + %out_ptr = OpAccessChain %ptr_int %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-9 -5 -3 +END + +BUFFER data1 DATA_TYPE int32 DATA + 5 4 -2 +END + +BUFFER data2 DATA_TYPE int32 DATA + 5 -4 -1 +END + +BUFFER data3 DATA_TYPE int32 DATA + 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA + 5 -5 -2 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER data3 AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN compute_pipeline 3 1 1 + +EXPECT data3 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_umax.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_umax.amber new file mode 100644 index 0000000..5313c23 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_umax.amber @@ -0,0 +1,91 @@ +#!amber +# Test GLSL.std.450 UMax instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + %glsl = OpExtInstImport "GLSL.std.450" + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_int ArrayStride 4 + OpDecorate %struct_uint3 BufferBlock + OpMemberDecorate %struct_uint3 0 Offset 0 + OpDecorate %struct_int3 BufferBlock + OpMemberDecorate %struct_int3 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 2 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %ra_int = OpTypeRuntimeArray %int + %ra_uint = OpTypeRuntimeArray %uint + %struct_uint3 = OpTypeStruct %ra_uint + %ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3 + %int3 = OpTypeVector %int 3 + %ptr_int = OpTypePointer Uniform %int + %struct_int3 = OpTypeStruct %ra_int + %ptr_struct_int3 = OpTypePointer Uniform %struct_int3 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_int3 Uniform + %input1 = OpVariable %ptr_struct_int3 Uniform + + %output = OpVariable %ptr_struct_int3 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index + %invalue0 = OpLoad %int %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index + %invalue1 = OpLoad %int %in_ptr1 + + %outvalue = OpExtInst %int %glsl UMax %invalue0 %invalue1 + %out_ptr = OpAccessChain %ptr_int %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 +END + +BUFFER data1 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 +END + +BUFFER data2 DATA_TYPE int32 DATA + 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 -1 -2 -3 -4 -5 -6 -7 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN compute_pipeline 15 1 1 + +EXPECT data2 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_umin.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_umin.amber new file mode 100644 index 0000000..8fc7936 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_int_umin.amber @@ -0,0 +1,91 @@ +#!amber +# Test GLSL.std.450 UMin instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + %glsl = OpExtInstImport "GLSL.std.450" + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_int ArrayStride 4 + OpDecorate %struct_uint3 BufferBlock + OpMemberDecorate %struct_uint3 0 Offset 0 + OpDecorate %struct_int3 BufferBlock + OpMemberDecorate %struct_int3 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 2 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %ra_int = OpTypeRuntimeArray %int + %ra_uint = OpTypeRuntimeArray %uint + %struct_uint3 = OpTypeStruct %ra_uint + %ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3 + %int3 = OpTypeVector %int 3 + %ptr_int = OpTypePointer Uniform %int + %struct_int3 = OpTypeStruct %ra_int + %ptr_struct_int3 = OpTypePointer Uniform %struct_int3 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_int3 Uniform + %input1 = OpVariable %ptr_struct_int3 Uniform + + %output = OpVariable %ptr_struct_int3 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index + %invalue0 = OpLoad %int %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index + %invalue1 = OpLoad %int %in_ptr1 + + %outvalue = OpExtInst %int %glsl UMin %invalue0 %invalue1 + %out_ptr = OpAccessChain %ptr_int %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 +END + +BUFFER data1 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 +END + +BUFFER data2 DATA_TYPE int32 DATA + 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN compute_pipeline 15 1 1 + +EXPECT data2 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_findsmsb.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_findsmsb.amber new file mode 100644 index 0000000..d3cf262 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_findsmsb.amber @@ -0,0 +1,74 @@ +#!amber +# Test GLSL.std.450 FindSMsb instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + %glsl = OpExtInstImport "GLSL.std.450" + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_uint ArrayStride 4 + OpDecorate %struct_uint2 BufferBlock + OpMemberDecorate %struct_uint2 0 Offset 0 + OpDecorate %input DescriptorSet 0 + OpDecorate %input Binding 0 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 1 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %ra_uint = OpTypeRuntimeArray %uint + %uint2 = OpTypeVector %uint 2 + %struct_uint2 = OpTypeStruct %ra_uint + %ptr_struct_uint2 = OpTypePointer Uniform %struct_uint2 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input = OpVariable %ptr_struct_uint2 Uniform + + %output = OpVariable %ptr_struct_uint2 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr = OpAccessChain %ptr_uint %input %uint_0 %index + %invalue = OpLoad %uint %in_ptr + + %outvalue = OpExtInst %uint %glsl FindSMsb %invalue + %out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA + 0 -8 -7 -6 -5 -4 -3 -2 0 -1 1 2 3 4 5 6 +END + +BUFFER data1 DATA_TYPE int32 DATA + 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA +-1 2 2 2 2 1 1 0 -1 -1 0 1 1 2 2 2 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN compute_pipeline 16 1 1 + +EXPECT data1 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs.amber new file mode 100644 index 0000000..b61e14a --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs.amber @@ -0,0 +1,74 @@ +#!amber +# Test GLSL.std.450 SAbs instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + %glsl = OpExtInstImport "GLSL.std.450" + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_uint ArrayStride 4 + OpDecorate %struct_uint2 BufferBlock + OpMemberDecorate %struct_uint2 0 Offset 0 + OpDecorate %input DescriptorSet 0 + OpDecorate %input Binding 0 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 1 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %ra_uint = OpTypeRuntimeArray %uint + %uint2 = OpTypeVector %uint 2 + %struct_uint2 = OpTypeStruct %ra_uint + %ptr_struct_uint2 = OpTypePointer Uniform %struct_uint2 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input = OpVariable %ptr_struct_uint2 Uniform + + %output = OpVariable %ptr_struct_uint2 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr = OpAccessChain %ptr_uint %input %uint_0 %index + %invalue = OpLoad %uint %in_ptr + + %outvalue = OpExtInst %uint %glsl SAbs %invalue + %out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 +END + +BUFFER data1 DATA_TYPE int32 DATA + 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN compute_pipeline 15 1 1 + +EXPECT data1 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp.amber new file mode 100644 index 0000000..366dabf --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp.amber @@ -0,0 +1,94 @@ +#!amber +# Test GLSL.std.450 SClamp instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + %glsl = OpExtInstImport "GLSL.std.450" + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_uint ArrayStride 4 + OpDecorate %struct_uint4 BufferBlock + OpMemberDecorate %struct_uint4 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %input2 DescriptorSet 0 + OpDecorate %input2 Binding 2 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 3 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %ra_uint = OpTypeRuntimeArray %uint + %uint4 = OpTypeVector %uint 4 + %struct_uint4 = OpTypeStruct %ra_uint + %ptr_struct_uint4 = OpTypePointer Uniform %struct_uint4 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_uint4 Uniform + %input1 = OpVariable %ptr_struct_uint4 Uniform + %input2 = OpVariable %ptr_struct_uint4 Uniform + + %output = OpVariable %ptr_struct_uint4 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_uint %input0 %uint_0 %index + %invalue0 = OpLoad %uint %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_uint %input1 %uint_0 %index + %invalue1 = OpLoad %uint %in_ptr1 + %in_ptr2 = OpAccessChain %ptr_uint %input2 %uint_0 %index + %invalue2 = OpLoad %uint %in_ptr2 + + %outvalue = OpExtInst %uint %glsl SClamp %invalue0 %invalue1 %invalue2 + %out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-9 -5 -3 0 0 3 5 9 +END + +BUFFER data1 DATA_TYPE int32 DATA +-5 -4 -3 -1 0 1 4 5 +END + +BUFFER data2 DATA_TYPE int32 DATA + 5 4 3 2 1 2 5 6 +END + +BUFFER data3 DATA_TYPE int32 DATA + 8 8 8 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA +-5 -4 -3 0 0 2 5 6 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER data3 AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN compute_pipeline 8 1 1 + +EXPECT data3 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax.amber new file mode 100644 index 0000000..2fbcaa9 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax.amber @@ -0,0 +1,83 @@ +#!amber +# Test GLSL.std.450 SMax instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + %glsl = OpExtInstImport "GLSL.std.450" + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_uint ArrayStride 4 + OpDecorate %struct_uint3 BufferBlock + OpMemberDecorate %struct_uint3 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 2 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %ra_uint = OpTypeRuntimeArray %uint + %struct_uint3 = OpTypeStruct %ra_uint + %ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_uint3 Uniform + %input1 = OpVariable %ptr_struct_uint3 Uniform + + %output = OpVariable %ptr_struct_uint3 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_uint %input0 %uint_0 %index + %invalue0 = OpLoad %uint %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_uint %input1 %uint_0 %index + %invalue1 = OpLoad %uint %in_ptr1 + + %outvalue = OpExtInst %uint %glsl SMax %invalue0 %invalue1 + %out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 +END + +BUFFER data1 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 +END + +BUFFER data2 DATA_TYPE int32 DATA + 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN compute_pipeline 15 1 1 + +EXPECT data2 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin.amber new file mode 100644 index 0000000..a3c6389 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin.amber @@ -0,0 +1,83 @@ +#!amber +# Test GLSL.std.450 SMin instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + %glsl = OpExtInstImport "GLSL.std.450" + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_uint ArrayStride 4 + OpDecorate %struct_uint3 BufferBlock + OpMemberDecorate %struct_uint3 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 2 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %ra_uint = OpTypeRuntimeArray %uint + %struct_uint3 = OpTypeStruct %ra_uint + %ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_uint3 Uniform + %input1 = OpVariable %ptr_struct_uint3 Uniform + + %output = OpVariable %ptr_struct_uint3 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_uint %input0 %uint_0 %index + %invalue0 = OpLoad %uint %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_uint %input1 %uint_0 %index + %invalue1 = OpLoad %uint %in_ptr1 + + %outvalue = OpExtInst %uint %glsl SMin %invalue0 %invalue1 + %out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 +END + +BUFFER data1 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 +END + +BUFFER data2 DATA_TYPE int32 DATA + 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 -1 -2 -3 -4 -5 -6 -7 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN compute_pipeline 15 1 1 + +EXPECT data2 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_ssign.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_ssign.amber new file mode 100644 index 0000000..1414e71 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/glsl_uint_ssign.amber @@ -0,0 +1,74 @@ +#!amber +# Test GLSL.std.450 SSign instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + %glsl = OpExtInstImport "GLSL.std.450" + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_uint ArrayStride 4 + OpDecorate %struct_uint2 BufferBlock + OpMemberDecorate %struct_uint2 0 Offset 0 + OpDecorate %input DescriptorSet 0 + OpDecorate %input Binding 0 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 1 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %ra_uint = OpTypeRuntimeArray %uint + %uint2 = OpTypeVector %uint 2 + %struct_uint2 = OpTypeStruct %ra_uint + %ptr_struct_uint2 = OpTypePointer Uniform %struct_uint2 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input = OpVariable %ptr_struct_uint2 Uniform + + %output = OpVariable %ptr_struct_uint2 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr = OpAccessChain %ptr_uint %input %uint_0 %index + %invalue = OpLoad %uint %in_ptr + + %outvalue = OpExtInst %uint %glsl SSign %invalue + %out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 +END + +BUFFER data1 DATA_TYPE int32 DATA + 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA +-1 -1 -1 -1 -1 -1 -1 0 1 1 1 1 1 1 1 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN compute_pipeline 15 1 1 + +EXPECT data1 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_atomicumax.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_atomicumax.amber new file mode 100644 index 0000000..639944a --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_atomicumax.amber @@ -0,0 +1,76 @@ +#!amber +# Test OpAtomicUMax instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + %glsl = OpExtInstImport "GLSL.std.450" + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_int ArrayStride 4 + OpDecorate %struct_int2 BufferBlock + OpMemberDecorate %struct_int2 0 Offset 0 + OpDecorate %input DescriptorSet 0 + OpDecorate %input Binding 0 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 1 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %ra_int = OpTypeRuntimeArray %int + %int2 = OpTypeVector %int 2 + %ptr_int = OpTypePointer Uniform %int + %struct_int2 = OpTypeStruct %ra_int + %ptr_struct_int2 = OpTypePointer Uniform %struct_int2 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input = OpVariable %ptr_struct_int2 Uniform + + %output = OpVariable %ptr_struct_int2 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr = OpAccessChain %ptr_int %input %uint_0 %index + %invalue = OpLoad %int %in_ptr + + %out_ptr = OpAccessChain %ptr_int %output %uint_0 %index + %result = OpAtomicUMax %int %out_ptr %uint_1 %uint_0 %invalue + + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 +END + +BUFFER data1 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 +END + +BUFFER expected0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 -1 -2 -3 -4 -5 -6 -7 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN compute_pipeline 15 1 1 + +EXPECT data1 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_atomicumin.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_atomicumin.amber new file mode 100644 index 0000000..ff0f7ab --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_atomicumin.amber @@ -0,0 +1,76 @@ +#!amber +# Test OpAtomicUMin instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + %glsl = OpExtInstImport "GLSL.std.450" + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_int ArrayStride 4 + OpDecorate %struct_int2 BufferBlock + OpMemberDecorate %struct_int2 0 Offset 0 + OpDecorate %input DescriptorSet 0 + OpDecorate %input Binding 0 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 1 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %ra_int = OpTypeRuntimeArray %int + %int2 = OpTypeVector %int 2 + %ptr_int = OpTypePointer Uniform %int + %struct_int2 = OpTypeStruct %ra_int + %ptr_struct_int2 = OpTypePointer Uniform %struct_int2 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input = OpVariable %ptr_struct_int2 Uniform + + %output = OpVariable %ptr_struct_int2 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr = OpAccessChain %ptr_int %input %uint_0 %index + %invalue = OpLoad %int %in_ptr + + %out_ptr = OpAccessChain %ptr_int %output %uint_0 %index + %result = OpAtomicUMin %int %out_ptr %uint_1 %uint_0 %invalue + + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 +END + +BUFFER data1 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 +END + +BUFFER expected0 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN compute_pipeline 15 1 1 + +EXPECT data1 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ugreaterthan.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ugreaterthan.amber new file mode 100644 index 0000000..e98409d --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ugreaterthan.amber @@ -0,0 +1,94 @@ +#!amber +# Test OpUGreaterThan instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_int ArrayStride 4 + OpDecorate %struct_uint3 BufferBlock + OpMemberDecorate %struct_uint3 0 Offset 0 + OpDecorate %struct_int3 BufferBlock + OpMemberDecorate %struct_int3 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 2 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %ra_int = OpTypeRuntimeArray %int + %ra_uint = OpTypeRuntimeArray %uint + %struct_uint3 = OpTypeStruct %ra_uint + %ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3 + %int3 = OpTypeVector %int 3 + %ptr_int = OpTypePointer Uniform %int + %struct_int3 = OpTypeStruct %ra_int + %ptr_struct_int3 = OpTypePointer Uniform %struct_int3 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_int3 Uniform + %input1 = OpVariable %ptr_struct_int3 Uniform + + %output = OpVariable %ptr_struct_int3 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index + %invalue0 = OpLoad %int %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index + %invalue1 = OpLoad %int %in_ptr1 + + %result = OpUGreaterThan %bool %invalue0 %invalue1 + %outvalue = OpSelect %int %result %int_1 %int_0 + + %out_ptr = OpAccessChain %ptr_int %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA + 0 -65536 0 1 32768 +END + +BUFFER data1 DATA_TYPE int32 DATA + 1 32768 0 0 -65536 +END + +BUFFER data2 DATA_TYPE int32 DATA + 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA + 0 1 0 1 0 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN compute_pipeline 5 1 1 + +EXPECT data2 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ugreaterthanequal.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ugreaterthanequal.amber new file mode 100644 index 0000000..5b77d90 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ugreaterthanequal.amber @@ -0,0 +1,94 @@ +#!amber +# Test OpUGreaterThanEqual instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_int ArrayStride 4 + OpDecorate %struct_uint3 BufferBlock + OpMemberDecorate %struct_uint3 0 Offset 0 + OpDecorate %struct_int3 BufferBlock + OpMemberDecorate %struct_int3 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 2 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %ra_int = OpTypeRuntimeArray %int + %ra_uint = OpTypeRuntimeArray %uint + %struct_uint3 = OpTypeStruct %ra_uint + %ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3 + %int3 = OpTypeVector %int 3 + %ptr_int = OpTypePointer Uniform %int + %struct_int3 = OpTypeStruct %ra_int + %ptr_struct_int3 = OpTypePointer Uniform %struct_int3 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_int3 Uniform + %input1 = OpVariable %ptr_struct_int3 Uniform + + %output = OpVariable %ptr_struct_int3 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index + %invalue0 = OpLoad %int %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index + %invalue1 = OpLoad %int %in_ptr1 + + %result = OpUGreaterThanEqual %bool %invalue0 %invalue1 + %outvalue = OpSelect %int %result %int_1 %int_0 + + %out_ptr = OpAccessChain %ptr_int %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA + 0 -65536 0 1 32768 +END + +BUFFER data1 DATA_TYPE int32 DATA + 1 32768 0 0 -65536 +END + +BUFFER data2 DATA_TYPE int32 DATA + 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA + 0 1 1 1 0 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN compute_pipeline 5 1 1 + +EXPECT data2 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ulessthan.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ulessthan.amber new file mode 100644 index 0000000..8da2aa0 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ulessthan.amber @@ -0,0 +1,94 @@ +#!amber +# Test OpULessThan instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_int ArrayStride 4 + OpDecorate %struct_uint3 BufferBlock + OpMemberDecorate %struct_uint3 0 Offset 0 + OpDecorate %struct_int3 BufferBlock + OpMemberDecorate %struct_int3 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 2 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %ra_int = OpTypeRuntimeArray %int + %ra_uint = OpTypeRuntimeArray %uint + %struct_uint3 = OpTypeStruct %ra_uint + %ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3 + %int3 = OpTypeVector %int 3 + %ptr_int = OpTypePointer Uniform %int + %struct_int3 = OpTypeStruct %ra_int + %ptr_struct_int3 = OpTypePointer Uniform %struct_int3 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_int3 Uniform + %input1 = OpVariable %ptr_struct_int3 Uniform + + %output = OpVariable %ptr_struct_int3 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index + %invalue0 = OpLoad %int %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index + %invalue1 = OpLoad %int %in_ptr1 + + %result = OpULessThan %bool %invalue0 %invalue1 + %outvalue = OpSelect %int %result %int_1 %int_0 + + %out_ptr = OpAccessChain %ptr_int %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA + 0 -65536 0 1 32768 +END + +BUFFER data1 DATA_TYPE int32 DATA + 1 32768 0 0 -65536 +END + +BUFFER data2 DATA_TYPE int32 DATA + 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA + 1 0 0 0 1 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN compute_pipeline 5 1 1 + +EXPECT data2 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ulessthanequal.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ulessthanequal.amber new file mode 100644 index 0000000..f7a3271 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/int_ulessthanequal.amber @@ -0,0 +1,94 @@ +#!amber +# Test OpULessThanEqual instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_int ArrayStride 4 + OpDecorate %struct_uint3 BufferBlock + OpMemberDecorate %struct_uint3 0 Offset 0 + OpDecorate %struct_int3 BufferBlock + OpMemberDecorate %struct_int3 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 2 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %ra_int = OpTypeRuntimeArray %int + %ra_uint = OpTypeRuntimeArray %uint + %struct_uint3 = OpTypeStruct %ra_uint + %ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3 + %int3 = OpTypeVector %int 3 + %ptr_int = OpTypePointer Uniform %int + %struct_int3 = OpTypeStruct %ra_int + %ptr_struct_int3 = OpTypePointer Uniform %struct_int3 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_int3 Uniform + %input1 = OpVariable %ptr_struct_int3 Uniform + + %output = OpVariable %ptr_struct_int3 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index + %invalue0 = OpLoad %int %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index + %invalue1 = OpLoad %int %in_ptr1 + + %result = OpULessThanEqual %bool %invalue0 %invalue1 + %outvalue = OpSelect %int %result %int_1 %int_0 + + %out_ptr = OpAccessChain %ptr_int %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA + 0 -65536 0 1 32768 +END + +BUFFER data1 DATA_TYPE int32 DATA + 1 32768 0 0 -65536 +END + +BUFFER data2 DATA_TYPE int32 DATA + 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA + 1 0 1 0 1 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN compute_pipeline 5 1 1 + +EXPECT data2 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_atomicsmax.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_atomicsmax.amber new file mode 100644 index 0000000..42f8529 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_atomicsmax.amber @@ -0,0 +1,74 @@ +#!amber +# Test OpAtomicSMax instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + %glsl = OpExtInstImport "GLSL.std.450" + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_uint ArrayStride 4 + OpDecorate %struct_uint2 BufferBlock + OpMemberDecorate %struct_uint2 0 Offset 0 + OpDecorate %input DescriptorSet 0 + OpDecorate %input Binding 0 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 1 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %ra_uint = OpTypeRuntimeArray %uint + %uint2 = OpTypeVector %uint 2 + %struct_uint2 = OpTypeStruct %ra_uint + %ptr_struct_uint2 = OpTypePointer Uniform %struct_uint2 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input = OpVariable %ptr_struct_uint2 Uniform + + %output = OpVariable %ptr_struct_uint2 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr = OpAccessChain %ptr_uint %input %uint_0 %index + %invalue = OpLoad %uint %in_ptr + + %out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index + %result = OpAtomicSMax %uint %out_ptr %uint_1 %uint_0 %invalue + + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 +END + +BUFFER data1 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 +END + +BUFFER expected0 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN compute_pipeline 15 1 1 + +EXPECT data1 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_atomicsmin.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_atomicsmin.amber new file mode 100644 index 0000000..df29596 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_atomicsmin.amber @@ -0,0 +1,73 @@ +#!amber +# Test OpAtomicSMin instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_uint ArrayStride 4 + OpDecorate %struct_uint2 BufferBlock + OpMemberDecorate %struct_uint2 0 Offset 0 + OpDecorate %input DescriptorSet 0 + OpDecorate %input Binding 0 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 1 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %ra_uint = OpTypeRuntimeArray %uint + %uint2 = OpTypeVector %uint 2 + %struct_uint2 = OpTypeStruct %ra_uint + %ptr_struct_uint2 = OpTypePointer Uniform %struct_uint2 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input = OpVariable %ptr_struct_uint2 Uniform + + %output = OpVariable %ptr_struct_uint2 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr = OpAccessChain %ptr_uint %input %uint_0 %index + %invalue = OpLoad %uint %in_ptr + + %out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index + %result = OpAtomicSMin %uint %out_ptr %uint_1 %uint_0 %invalue + + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 +END + +BUFFER data1 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 +END + +BUFFER expected0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 -1 -2 -3 -4 -5 -6 -7 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN compute_pipeline 15 1 1 + +EXPECT data1 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_sdiv.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_sdiv.amber new file mode 100644 index 0000000..5a2f88a --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_sdiv.amber @@ -0,0 +1,82 @@ +#!amber +# Test OpSDiv instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_uint ArrayStride 4 + OpDecorate %struct_uint3 BufferBlock + OpMemberDecorate %struct_uint3 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 2 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %ra_uint = OpTypeRuntimeArray %uint + %struct_uint3 = OpTypeStruct %ra_uint + %ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_uint3 Uniform + %input1 = OpVariable %ptr_struct_uint3 Uniform + + %output = OpVariable %ptr_struct_uint3 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_uint %input0 %uint_0 %index + %invalue0 = OpLoad %uint %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_uint %input1 %uint_0 %index + %invalue1 = OpLoad %uint %in_ptr1 + + %outvalue = OpSDiv %uint %invalue0 %invalue1 + %out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA + 0 -2 3 4 -5 +END + +BUFFER data1 DATA_TYPE int32 DATA + 1 -1 -1 1 1 +END + +BUFFER data2 DATA_TYPE int32 DATA + 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA + 0 2 -3 4 -5 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN compute_pipeline 5 1 1 + +EXPECT data2 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_smulextended.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_smulextended.amber new file mode 100644 index 0000000..4512b8b --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_smulextended.amber @@ -0,0 +1,102 @@ +#!amber +# Test OpSMulExtended instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_uint ArrayStride 4 + OpDecorate %struct_uint4 BufferBlock + OpMemberDecorate %struct_uint4 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %output0 DescriptorSet 0 + OpDecorate %output0 Binding 2 + OpDecorate %output1 DescriptorSet 0 + OpDecorate %output1 Binding 3 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %ra_uint = OpTypeRuntimeArray %uint + %uint4 = OpTypeVector %uint 4 + %struct_uint4 = OpTypeStruct %ra_uint + %ptr_struct_uint4 = OpTypePointer Uniform %struct_uint4 + %resulttype = OpTypeStruct %uint %uint +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_uint4 Uniform + %input1 = OpVariable %ptr_struct_uint4 Uniform + + %output0 = OpVariable %ptr_struct_uint4 Uniform + %output1 = OpVariable %ptr_struct_uint4 Uniform + + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_uint %input0 %uint_0 %index + %invalue0 = OpLoad %uint %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_uint %input1 %uint_0 %index + %invalue1 = OpLoad %uint %in_ptr1 + + %outvalue = OpSMulExtended %resulttype %invalue0 %invalue1 + %outvalue0 = OpCompositeExtract %uint %outvalue 0 + %out_ptr0 = OpAccessChain %ptr_uint %output0 %uint_0 %index + OpStore %out_ptr0 %outvalue0 + %outvalue1 = OpCompositeExtract %uint %outvalue 1 + %out_ptr1 = OpAccessChain %ptr_uint %output1 %uint_0 %index + OpStore %out_ptr1 %outvalue1 + + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 +END + +BUFFER data1 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 +END + +BUFFER data2 DATA_TYPE int32 DATA + 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 +END + +BUFFER data3 DATA_TYPE int32 DATA + 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA +-49 -36 -25 -16 -9 -4 -1 0 -1 -4 -9 -16 -25 -36 -49 +END + +BUFFER expected1 DATA_TYPE int32 DATA +-1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER data3 AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN compute_pipeline 15 1 1 + +EXPECT data2 EQ_BUFFER expected0 +EXPECT data3 EQ_BUFFER expected1 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_snegate.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_snegate.amber new file mode 100644 index 0000000..8d9ef89 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_snegate.amber @@ -0,0 +1,73 @@ +#!amber +# Test OpSNegate instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_uint ArrayStride 4 + OpDecorate %struct_uint2 BufferBlock + OpMemberDecorate %struct_uint2 0 Offset 0 + OpDecorate %input DescriptorSet 0 + OpDecorate %input Binding 0 + OpDecorate %output DescriptorSet 0 + OpDecorate %output Binding 1 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %ra_uint = OpTypeRuntimeArray %uint + %uint2 = OpTypeVector %uint 2 + %struct_uint2 = OpTypeStruct %ra_uint + %ptr_struct_uint2 = OpTypePointer Uniform %struct_uint2 + +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input = OpVariable %ptr_struct_uint2 Uniform + + %output = OpVariable %ptr_struct_uint2 Uniform + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr = OpAccessChain %ptr_uint %input %uint_0 %index + %invalue = OpLoad %uint %in_ptr + + %outvalue = OpSNegate %uint %invalue + %out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index + OpStore %out_ptr %outvalue + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA + 0 -1 1 +END + +BUFFER data1 DATA_TYPE int32 DATA + 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA + 0 1 -1 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN compute_pipeline 3 1 1 + +EXPECT data1 EQ_BUFFER expected0 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_umulextended.amber b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_umulextended.amber new file mode 100644 index 0000000..2c8478d --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/signed_op/uint_umulextended.amber @@ -0,0 +1,100 @@ +#!amber +# Test OpUMulExtended instruction + +SHADER compute test SPIRV-ASM + OpCapability Shader + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %struct_uint4 BufferBlock + OpMemberDecorate %struct_uint4 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %output0 DescriptorSet 0 + OpDecorate %output0 Binding 2 + OpDecorate %output1 DescriptorSet 0 + OpDecorate %output1 Binding 3 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint4 = OpTypeVector %uint 4 + %struct_uint4 = OpTypeStruct %uint4 + %ptr_struct_uint4 = OpTypePointer Uniform %struct_uint4 + %resulttype = OpTypeStruct %uint %uint +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_uint4 Uniform + %input1 = OpVariable %ptr_struct_uint4 Uniform + + %output0 = OpVariable %ptr_struct_uint4 Uniform + %output1 = OpVariable %ptr_struct_uint4 Uniform + + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_uint %input0 %uint_0 %index + %invalue0 = OpLoad %uint %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_uint %input1 %uint_0 %index + %invalue1 = OpLoad %uint %in_ptr1 + + %outvalue = OpUMulExtended %resulttype %invalue0 %invalue1 + %outvalue0 = OpCompositeExtract %uint %outvalue 0 + %out_ptr0 = OpAccessChain %ptr_uint %output0 %uint_0 %index + OpStore %out_ptr0 %outvalue0 + %outvalue1 = OpCompositeExtract %uint %outvalue 1 + %out_ptr1 = OpAccessChain %ptr_uint %output1 %uint_0 %index + OpStore %out_ptr1 %outvalue1 + + + OpReturn + OpFunctionEnd +END +BUFFER data0 DATA_TYPE int32 DATA +-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 +END + +BUFFER data1 DATA_TYPE int32 DATA + 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 +END + +BUFFER data2 DATA_TYPE int32 DATA + 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 +END + +BUFFER data3 DATA_TYPE int32 DATA + 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 +END + +BUFFER expected0 DATA_TYPE int32 DATA +-49 -36 -25 -16 -9 -4 -1 0 -1 -4 -9 -16 -25 -36 -49 +END + +BUFFER expected1 DATA_TYPE int32 DATA + 6 5 4 3 2 1 0 0 0 1 2 3 4 5 6 +END + +PIPELINE compute compute_pipeline + ATTACH test + BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER data3 AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN compute_pipeline 15 1 1 + +EXPECT data2 EQ_BUFFER expected0 +EXPECT data3 EQ_BUFFER expected1 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/switch/switch-case-to-merge-block.amber b/vulkan/amber/spirv_assembly/instruction/compute/switch/switch-case-to-merge-block.amber new file mode 100644 index 0000000..aee4ce5 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/switch/switch-case-to-merge-block.amber @@ -0,0 +1,117 @@ +#!amber +# +# Copyright 2020 The Khronos Group Inc. +# Copyright 2020 Valve Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER compute comp SPIRV-ASM TARGET_ENV spv1.0 +; SPIR-V +; Version: 1.0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpMemberDecorate %InputBlock 0 Offset 0 + OpDecorate %InputBlock BufferBlock + OpDecorate %inputBuffer DescriptorSet 0 + OpDecorate %inputBuffer Binding 0 + OpMemberDecorate %OutputBlock 0 Offset 0 + OpDecorate %OutputBlock BufferBlock + OpDecorate %outputBuffer DescriptorSet 0 + OpDecorate %outputBuffer Binding 1 + %void = OpTypeVoid + %voidFunc = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 + %uint_5 = OpConstant %uint 5 + %uint_6 = OpConstant %uint 6 + %uint_7 = OpConstant %uint 7 + %uint_8 = OpConstant %uint 8 + %InputBlock = OpTypeStruct %uint + %InputBlock_ptr = OpTypePointer Uniform %InputBlock + %inputBuffer = OpVariable %InputBlock_ptr Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_uniform_ptr = OpTypePointer Uniform %uint +%uint_Function_ptr = OpTypePointer Function %uint + %OutputBlock = OpTypeStruct %uint + %OutputBlock_ptr = OpTypePointer Uniform %OutputBlock + %outputBuffer = OpVariable %OutputBlock_ptr Uniform + %main = OpFunction %void None %voidFunc + %mainLabel = OpLabel +; +; %aux will contain value 4 by default and it should not be modified. +; + %aux = OpVariable %uint_Function_ptr Function + OpStore %aux %uint_4 + %ptrIn = OpAccessChain %uint_uniform_ptr %inputBuffer %int_0 + %inputVal = OpLoad %uint %ptrIn +; +; From fauly.asm in https://gitlab.freedesktop.org/mesa/mesa/-/issues/3460 +; +; OpSelectionMerge %3153 None +; OpSwitch %166 %3152 0 %3153 1 %3151 2 %3150 3 %3149 +; %3152 = OpLabel +; OpBranch %3153 +; %3151 = OpLabel +; OpBranch %3153 +; %3150 = OpLabel +; %345 = OpAccessChain %_ptr_StorageBuffer_v4float %71 %uint_0 %uint_37 +; %346 = OpLoad %v4float %345 +; %347 = OpBitcast %v4uint %346 +; %348 = OpCompositeExtract %uint %347 0 +; %188 = OpShiftLeftLogical %uint %348 %uint_1 +; OpBranch %3153 +; %3149 = OpLabel +; OpBranch %3153 +; %3153 = OpLabel +; +; Similar structure replicated below. +; Value 0 jumps to the merge label while the others store unexpected values in %aux. +; + OpSelectionMerge %mergeLabel None + OpSwitch %inputVal %defaultLabel 0 %mergeLabel 1 %val1Label 2 %val2Label 3 %val3Label + %defaultLabel = OpLabel + OpStore %aux %uint_5 + OpBranch %mergeLabel + %val1Label = OpLabel + OpStore %aux %uint_6 + OpBranch %mergeLabel + %val2Label = OpLabel + OpStore %aux %uint_7 + OpBranch %mergeLabel + %val3Label = OpLabel + OpStore %aux %uint_8 + OpBranch %mergeLabel + %mergeLabel = OpLabel + %ptrOut = OpAccessChain %uint_uniform_ptr %outputBuffer %int_0 + %aux_val = OpLoad %uint %aux + OpStore %ptrOut %aux_val + OpReturn + OpFunctionEnd +END + +BUFFER inputBuffer DATA_TYPE uint32 DATA 0 END +BUFFER outputBuffer DATA_TYPE uint32 DATA 0 END + +# Store 0 as the input value to make the switch go directly to the merge label. +PIPELINE compute compute_pipeline + ATTACH comp + BIND BUFFER inputBuffer AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER outputBuffer AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN compute_pipeline 1 1 1 +# Expect 4, the initial value stored in %aux before the switch. +EXPECT outputBuffer IDX 0 EQ 4 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/undef/undefined_constant_composite.amber b/vulkan/amber/spirv_assembly/instruction/compute/undef/undefined_constant_composite.amber new file mode 100644 index 0000000..b2e76b1 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/undef/undefined_constant_composite.amber @@ -0,0 +1,135 @@ +#!amber + +# Copyright 2020 Valve Corporation. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +SHADER compute comp SPIRV-ASM +; +; The shader below is based on the following GLSL shader: +; +; #version 450 +; +; struct Pair { +; int first; +; int second; +; }; +; +; const Pair constant_pair = { 100, 200 }; +; +; layout(set=0, binding=0, std430) buffer InputBlock { +; int array[10]; +; } inputValues; +; +; layout(set=0, binding=1, std430) buffer OutputBlock { +; int array[10]; +; } outputValues; +; +; int add_second (int value, Pair pair) { +; return value + pair.second; +; } +; +; void main() { +; uint idx = gl_GlobalInvocationID.x; +; outputValues.array[idx] = add_second(inputValues.array[idx], constant_pair); +; } +; +; However, the first element of constant_pair has been modified to be undefined. +; + OpCapability Shader + %std450 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %OutputBlock 0 Offset 0 + OpDecorate %OutputBlock BufferBlock + OpDecorate %outputValues DescriptorSet 0 + OpDecorate %outputValues Binding 1 + OpMemberDecorate %InputBlock 0 Offset 0 + OpDecorate %InputBlock BufferBlock + OpDecorate %inputValues DescriptorSet 0 + OpDecorate %inputValues Binding 0 + %void = OpTypeVoid + %void_func = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_200 = OpConstant %int 200 + %uint_0 = OpConstant %uint 0 + %uint_10 = OpConstant %uint 10 + %_ptr_Function_int = OpTypePointer Function %int + %Pair = OpTypeStruct %int %int + %_ptr_Function_Pair = OpTypePointer Function %Pair + %add_second_func_type = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_Pair + %_ptr_Function_uint = OpTypePointer Function %uint + %_ptr_Input_v3uint = OpTypePointer Input %v3uint + %_ptr_Input_uint = OpTypePointer Input %uint + %_arr_int_uint_10 = OpTypeArray %int %uint_10 + %OutputBlock = OpTypeStruct %_arr_int_uint_10 +%_ptr_Uniform_OutputBlock = OpTypePointer Uniform %OutputBlock + %outputValues = OpVariable %_ptr_Uniform_OutputBlock Uniform + %InputBlock = OpTypeStruct %_arr_int_uint_10 + %_ptr_Uniform_InputBlock = OpTypePointer Uniform %InputBlock + %inputValues = OpVariable %_ptr_Uniform_InputBlock Uniform + ; Replaced %int_100 with an undefined int. + %undef_int = OpUndef %int + ; Composed a constant Pair with the undefined int in the first member. + %const_Pair = OpConstantComposite %Pair %undef_int %int_200 + %_ptr_Uniform_int = OpTypePointer Uniform %int + %gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %main = OpFunction %void None %void_func + %main_label = OpLabel + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_Pair Function + %gidx_ptr = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %gidx = OpLoad %uint %gidx_ptr + %input_value_ptr = OpAccessChain %_ptr_Uniform_int %inputValues %int_0 %gidx + %input_value = OpLoad %int %input_value_ptr + OpStore %param_1 %input_value + OpStore %param_2 %const_Pair + %retval = OpFunctionCall %int %add_second %param_1 %param_2 + %output_value_ptr = OpAccessChain %_ptr_Uniform_int %outputValues %int_0 %gidx + OpStore %output_value_ptr %retval + OpReturn + OpFunctionEnd + %add_second = OpFunction %int None %add_second_func_type + %value_ptr = OpFunctionParameter %_ptr_Function_int + %pair = OpFunctionParameter %_ptr_Function_Pair + %add_second_label = OpLabel + %value = OpLoad %int %value_ptr + ; Access the second struct member, which is defined. + %pair_second_ptr = OpAccessChain %_ptr_Function_int %pair %int_1 + %pair_second = OpLoad %int %pair_second_ptr + %add_result = OpIAdd %int %value %pair_second + OpReturnValue %add_result + OpFunctionEnd +END + +BUFFER input_buffer DATA_TYPE int32 SIZE 10 SERIES_FROM 1000 INC_BY 1 +BUFFER output_buffer DATA_TYPE int32 SIZE 10 FILL 0 +BUFFER reference_buffer DATA_TYPE int32 SIZE 10 SERIES_FROM 1200 INC_BY 1 + +PIPELINE compute compute_pipeline + ATTACH comp + BIND BUFFER input_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN compute_pipeline 10 1 1 +EXPECT output_buffer EQ_BUFFER reference_buffer diff --git a/vulkan/amber/spirv_assembly/instruction/compute/undef/undefined_spec_constant_composite.amber b/vulkan/amber/spirv_assembly/instruction/compute/undef/undefined_spec_constant_composite.amber new file mode 100644 index 0000000..5c04910 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/undef/undefined_spec_constant_composite.amber @@ -0,0 +1,155 @@ +#!amber + +# Copyright 2020 Valve Corporation. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +SHADER compute comp SPIRV-ASM +; +; The shader below is based on the following GLSL shader: +; +; #version 450 +; +; struct Pair { +; int first; +; int second; +; }; +; +; const Pair constant_pair = { 100, 200 }; +; +; layout (constant_id=0) const int constantFirst = 0; +; +; Pair spec_constant_pair = { constantFirst, 200 }; +; +; layout(set=0, binding=0, std430) buffer InputBlock { +; int array[10]; +; } inputValues; +; +; layout(set=0, binding=1, std430) buffer OutputBlock { +; int array[10]; +; } outputValues; +; +; int add_first_and_second (int value, Pair p1, Pair p2) { +; return value + p1.first + p2.second; +; } +; +; void main() { +; uint idx = gl_GlobalInvocationID.x; +; outputValues.array[idx] = add_first_and_second(inputValues.array[idx], spec_constant_pair, constant_pair); +; } +; +; However, both the constant_pair and the spec_constant_pair have one of their members replaced by undefined values. +; + OpCapability Shader + %std450 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %OutputBlock 0 Offset 0 + OpDecorate %OutputBlock BufferBlock + OpDecorate %outputValues DescriptorSet 0 + OpDecorate %outputValues Binding 1 + OpMemberDecorate %InputBlock 0 Offset 0 + OpDecorate %InputBlock BufferBlock + OpDecorate %inputValues DescriptorSet 0 + OpDecorate %inputValues Binding 0 + OpDecorate %spec_constant SpecId 0 + %void = OpTypeVoid + %void_func = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_200 = OpConstant %int 200 + %uint_0 = OpConstant %uint 0 + %uint_10 = OpConstant %uint 10 + %_ptr_Function_int = OpTypePointer Function %int + %Pair = OpTypeStruct %int %int + %_ptr_Function_Pair = OpTypePointer Function %Pair +%add_pair_members_func_type = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_Pair %_ptr_Function_Pair + %_ptr_Function_uint = OpTypePointer Function %uint + %_ptr_Input_v3uint = OpTypePointer Input %v3uint + %_ptr_Input_uint = OpTypePointer Input %uint + %_arr_int_uint_10 = OpTypeArray %int %uint_10 + %OutputBlock = OpTypeStruct %_arr_int_uint_10 + %_ptr_Uniform_OutputBlock = OpTypePointer Uniform %OutputBlock + %outputValues = OpVariable %_ptr_Uniform_OutputBlock Uniform + %InputBlock = OpTypeStruct %_arr_int_uint_10 + %_ptr_Uniform_InputBlock = OpTypePointer Uniform %InputBlock + %inputValues = OpVariable %_ptr_Uniform_InputBlock Uniform + ; Replaced %int_100 with an undefined int. + %undef_int = OpUndef %int + ; Composed a spec constant Pair with an undefined int in the second member. + %spec_constant = OpSpecConstant %int 0 + %spec_const_Pair = OpSpecConstantComposite %Pair %spec_constant %undef_int + ; Composed a constant Pair with the undefined int in the first member. + %const_Pair = OpConstantComposite %Pair %undef_int %int_200 + %_ptr_Uniform_int = OpTypePointer Uniform %int + %gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %main = OpFunction %void None %void_func + %main_label = OpLabel + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_Pair Function + %param_3 = OpVariable %_ptr_Function_Pair Function + %gidx_ptr = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %gidx = OpLoad %uint %gidx_ptr + %input_value_ptr = OpAccessChain %_ptr_Uniform_int %inputValues %int_0 %gidx + %input_value = OpLoad %int %input_value_ptr + OpStore %param_1 %input_value + OpStore %param_2 %spec_const_Pair + OpStore %param_3 %const_Pair + ; Pass the input value as the first argument. + ; Pass the specialization constant Pair as the second argument. + ; Pass the constant Pair as the third argument. + %retval = OpFunctionCall %int %add_pair_members %param_1 %param_2 %param_3 + %output_value_ptr = OpAccessChain %_ptr_Uniform_int %outputValues %int_0 %gidx + OpStore %output_value_ptr %retval + OpReturn + OpFunctionEnd + %add_pair_members = OpFunction %int None %add_pair_members_func_type + %value_ptr = OpFunctionParameter %_ptr_Function_int + %pair_1 = OpFunctionParameter %_ptr_Function_Pair + %pair_2 = OpFunctionParameter %_ptr_Function_Pair + %add_pair_members_label = OpLabel + %value = OpLoad %int %value_ptr + ; Access the first struct member from the first pair. + ; Access the second struct member from the second pair. + ; Both should be defined according to the function call above. + %pair_1_first_ptr = OpAccessChain %_ptr_Function_int %pair_1 %int_0 + %pair_2_second_ptr = OpAccessChain %_ptr_Function_int %pair_2 %int_1 + %pair_1_first = OpLoad %int %pair_1_first_ptr + %pair_2_second = OpLoad %int %pair_2_second_ptr + %partial_result = OpIAdd %int %value %pair_1_first + %final_result = OpIAdd %int %partial_result %pair_2_second + OpReturnValue %final_result + OpFunctionEnd + +END + +BUFFER input_buffer DATA_TYPE int32 SIZE 10 SERIES_FROM 1000 INC_BY 1 +BUFFER output_buffer DATA_TYPE int32 SIZE 10 FILL 0 +BUFFER reference_buffer DATA_TYPE int32 SIZE 10 SERIES_FROM 1600 INC_BY 1 + +PIPELINE compute compute_pipeline + ATTACH comp SPECIALIZE 0 AS int32 400 + BIND BUFFER input_buffer AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN compute_pipeline 10 1 1 +EXPECT output_buffer EQ_BUFFER reference_buffer diff --git a/vulkan/amber/spirv_assembly/instruction/compute/unreachable/unreachable-switch-merge-in-loop.amber b/vulkan/amber/spirv_assembly/instruction/compute/unreachable/unreachable-switch-merge-in-loop.amber new file mode 100644 index 0000000..9ef9341 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/unreachable/unreachable-switch-merge-in-loop.amber @@ -0,0 +1,150 @@ +#!amber + +# Copyright 2020 Valve Corporation. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +SHADER vertex vtx_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 30 +; Schema: 0 +; +; Originally created from code like this one: +; +; #version 450 +; layout(location=0) in vec4 position; +; void main() { gl_Position = position; } +; + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %position + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %position "position" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %position Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %_arr_float_uint_1 = OpTypeArray %float %uint_1 + %gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int_0 = OpConstant %int 0 + %_ptr_Input_v4float = OpTypePointer Input %v4float + %position = OpVariable %_ptr_Input_v4float Input + %_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 +; +; The rest of code below has been manually tuned. +; The assignment to gl_Position is in the OpLoad, OpAccessChain and OpStore sequence. +; It's wrapped inside a loop statement roughly equivalent to this: +; +; for (;;) { +; switch (1) { +; default: +; gl_Position = position; +; goto end; +; } +; } +; end: +; return; +; +; Which means the code jumps directly from the end of the default block to the +; loop exit, something that cannot be directly done in GLSL because it has no +; goto nor any other equivalent instruction to directly exit the loop. +; +; The switch's merge block is unreachable and marked with OpUnreachable. +; According to VK-GL-CTS issue #952, at least one driver goes into an infinite +; loop when doing so. +; + %main_start = OpLabel + OpBranch %loop_start + %loop_start = OpLabel + OpLoopMerge %loop_exit %loop_end None + OpBranch %select_start + %select_start = OpLabel + OpSelectionMerge %select_merge None + OpSwitch %int_1 %switch_default + %switch_default = OpLabel + %25 = OpLoad %v4float %position + %27 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %27 %25 + OpBranch %loop_exit + %select_merge = OpLabel + OpUnreachable + %loop_end = OpLabel + OpBranch %loop_start + %loop_exit = OpLabel + OpReturn + OpFunctionEnd + +END + +SHADER fragment frag_shader GLSL +#version 450 + +layout(location = 0) out vec4 color_out; + +void main() { + // Red color. + color_out = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +# Full-screen quad. +BUFFER position_buf DATA_TYPE vec2 DATA +-1 -1 + 1 -1 +-1 1 +-1 1 + 1 -1 + 1 1 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vtx_shader + ATTACH frag_shader + + VERTEX_DATA position_buf LOCATION 0 + + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR pipeline + +RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT framebuffer IDX 0 0 SIZE 64 64 EQ_RGBA 255 0 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/compute/vector_shuffle/vector_shuffle.amber b/vulkan/amber/spirv_assembly/instruction/compute/vector_shuffle/vector_shuffle.amber new file mode 100644 index 0000000..dde4168 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/compute/vector_shuffle/vector_shuffle.amber @@ -0,0 +1,84 @@ +# Test OpVectorShuffle with indices of -1 +# +# Derived from the following OpenCL C: +# +# kernel void swizzle (global float4 *p, global float *res) +# { +# res[0] = p[0].x + p[0].y; +# } + +[require] +VariablePointerFeatures.variablePointers + +[compute shader spirv] +; SPIR-V +; Version: 1.0 +; Generator: Google Clspv; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "main" + OpSource OpenCL_C 120 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %_struct_4 Block + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_7 0 Offset 0 + OpDecorate %_struct_7 Block + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %12 SpecId 0 + OpDecorate %13 SpecId 1 + OpDecorate %14 SpecId 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %_struct_4 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer__struct_4 = OpTypePointer StorageBuffer %_struct_4 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_7 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_7 = OpTypePointer StorageBuffer %_struct_7 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %12 = OpSpecConstant %uint 1 + %13 = OpSpecConstant %uint 1 + %14 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %12 %13 %14 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %29 = OpUndef %v4float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %16 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_4 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_7 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_StorageBuffer_v4float %17 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_float %18 %uint_0 %uint_0 + %28 = OpLoad %v4float %25 + %30 = OpVectorShuffle %v4float %28 %29 1 4294967295 4294967295 4294967295 + %31 = OpFAdd %v4float %28 %30 + %32 = OpCompositeExtract %float %31 0 + OpStore %27 %32 + OpReturn + OpFunctionEnd + +[test] +# 'p'[] +ssbo 0:0 subdata float 0 2.0 4.0 9.0 -3.0 +# The result buffer 'res' [] +ssbo 0:1 subdata float 0 0.0 + +compute 1 1 1 + +probe ssbo float 0:1 0 == 6.0 diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_comp.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_comp.amber new file mode 100644 index 0000000..c5455eb --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_comp.amber @@ -0,0 +1,211 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A compute shader test for FrexpStruct. + +# SHADER compute comp_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296 / 1; +# const uint half_ndp = ndp / 2; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uint in_values[half_ndp]; +# }; +# +# layout(set = 0, binding = 1) buffer block1 { +# float frexp_out[ndp]; +# }; +# +# layout(set = 0, binding = 2) buffer block2 { +# float frexpStruct_out[ndp]; +# }; +# +# struct frexpStructType +# { +# float x; +# int exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (float orig) +# { +# float x; +# int exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# for (uint ndx = 0; ndx < ndp; ndx += 2) +# { +# uint in_uint = in_values[ndx/2]; +# float in_float = uintBitsToFloat(in_uint); +# float x; +# int exp; +# +# x = frexp(in_float, exp); +# frexpStructType res = frexpStruct(in_float); +# +# frexp_out[ndx] = intBitsToFloat(exp); +# frexp_out[ndx+1] = x; +# frexpStruct_out[ndx] = intBitsToFloat(res.exp); +# frexpStruct_out[ndx+1] = res.x; +# } +# +# return; +# } +# END + +SHADER compute comp_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %_arr_uint_uint_648 ArrayStride 4 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_float_uint_1296 ArrayStride 4 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_arr_float_uint_1296_0 ArrayStride 4 + OpMemberDecorate %block2 0 Offset 0 + OpDecorate %block2 BufferBlock + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 +%frexpStructType = OpTypeStruct %float %int + %10 = OpTypeFunction %frexpStructType %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %uint_1296 = OpConstant %uint 1296 + %bool = OpTypeBool + %uint_648 = OpConstant %uint 648 +%_arr_uint_uint_648 = OpTypeArray %uint %uint_648 + %block0 = OpTypeStruct %_arr_uint_uint_648 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_arr_float_uint_1296 = OpTypeArray %float %uint_1296 + %block1 = OpTypeStruct %_arr_float_uint_1296 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1296_0 = OpTypeArray %float %uint_1296 + %block2 = OpTypeStruct %_arr_float_uint_1296_0 +%_ptr_Uniform_block2 = OpTypePointer Uniform %block2 + %__1 = OpVariable %_ptr_Uniform_block2 Uniform + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_uint Function + %in_float = OpVariable %_ptr_Function_float Function + %x_0 = OpVariable %_ptr_Function_float Function + %exp_0 = OpVariable %_ptr_Function_int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + OpStore %ndx %uint_0 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %uint %ndx + %39 = OpULessThan %bool %36 %uint_1296 + OpBranchConditional %39 %32 %33 + %32 = OpLabel + %47 = OpLoad %uint %ndx + %49 = OpUDiv %uint %47 %uint_2 + %51 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %49 + %52 = OpLoad %uint %51 + OpStore %in_uint %52 + %54 = OpLoad %uint %in_uint + %55 = OpBitcast %float %54 + OpStore %in_float %55 + %57 = OpLoad %float %in_float + %59 = OpExtInst %float %1 Frexp %57 %exp_0 + OpStore %x_0 %59 + %62 = OpLoad %float %in_float + %63 = OpExtInst %frexpStructType %1 FrexpStruct %62 + OpStore %res_0 %63 + %68 = OpLoad %uint %ndx + %69 = OpLoad %int %exp_0 + %70 = OpBitcast %float %69 + %72 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %68 + OpStore %72 %70 + %73 = OpLoad %uint %ndx + %75 = OpIAdd %uint %73 %uint_1 + %76 = OpLoad %float %x_0 + %77 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %75 + OpStore %77 %76 + %82 = OpLoad %uint %ndx + %84 = OpAccessChain %_ptr_Function_int %res_0 %int_1 + %85 = OpLoad %int %84 + %86 = OpBitcast %float %85 + %87 = OpAccessChain %_ptr_Uniform_float %__1 %int_0 %82 + OpStore %87 %86 + %88 = OpLoad %uint %ndx + %89 = OpIAdd %uint %88 %uint_1 + %90 = OpAccessChain %_ptr_Function_float %res_0 %int_0 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Uniform_float %__1 %int_0 %89 + OpStore %92 %91 + OpBranch %34 + %34 = OpLabel + %93 = OpLoad %uint %ndx + %94 = OpIAdd %uint %93 %uint_2 + OpStore %ndx %94 + OpBranch %31 + %33 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt + +BUFFER buf_frexp DATA_TYPE float SIZE 1296 FILL 0.0 +BUFFER buf_frexpStruct DATA_TYPE float SIZE 1296 FILL 1.0 + +PIPELINE compute test_pipeline + ATTACH comp_shader + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER buf_frexp AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER buf_frexpStruct AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN test_pipeline 1 1 1 + +EXPECT buf_frexp EQ_BUFFER buf_frexpStruct diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag.amber new file mode 100644 index 0000000..f5b61e3 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag.amber @@ -0,0 +1,283 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A fragment shader test for FrexpStruct. + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uint in_values[ndp]; +# }; +# +# layout (location = 0) flat in uint ndx_in; +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# struct frexpStructType +# { +# float x; +# int exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (float orig) +# { +# float x; +# int exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# uint in_uint = in_values[ndx_in]; +# float in_float = uintBitsToFloat(in_uint); +# float x; +# int exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.r = x; +# frexp_exp_out.r = intBitsToFloat(exp); +# frexpStruct_x_out.r = res.x; +# frexpStruct_exp_out.r = intBitsToFloat(res.exp); +# +# return; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out + OpExecutionMode %main OriginUpperLeft + OpDecorate %_arr_uint_uint_1296 ArrayStride 4 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 +%frexpStructType = OpTypeStruct %float %int + %10 = OpTypeFunction %frexpStructType %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1296 = OpConstant %uint 1296 +%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296 + %block0 = OpTypeStruct %_arr_uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %ndx_in = OpVariable %_ptr_Input_uint Input +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %58 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_uint Function + %in_float = OpVariable %_ptr_Function_float Function + %x_0 = OpVariable %_ptr_Function_float Function + %exp_0 = OpVariable %_ptr_Function_int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %38 = OpLoad %uint %ndx_in + %40 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %38 + %41 = OpLoad %uint %40 + OpStore %in_uint %41 + %43 = OpLoad %uint %in_uint + %44 = OpBitcast %float %43 + OpStore %in_float %44 + %46 = OpLoad %float %in_float + %48 = OpExtInst %float %1 Frexp %46 %exp_0 + OpStore %x_0 %48 + %51 = OpLoad %float %in_float + %52 = OpExtInst %frexpStructType %1 FrexpStruct %51 + OpStore %res_0 %52 + OpStore %frexp_x_out %58 + OpStore %frexp_exp_out %58 + OpStore %frexpStruct_x_out %58 + OpStore %frexpStruct_exp_out %58 + %62 = OpLoad %float %x_0 + %65 = OpAccessChain %_ptr_Output_float %frexp_x_out %uint_0 + OpStore %65 %62 + %66 = OpLoad %int %exp_0 + %67 = OpBitcast %float %66 + %68 = OpAccessChain %_ptr_Output_float %frexp_exp_out %uint_0 + OpStore %68 %67 + %69 = OpAccessChain %_ptr_Function_float %res_0 %int_0 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Output_float %frexpStruct_x_out %uint_0 + OpStore %71 %70 + %73 = OpAccessChain %_ptr_Function_int %res_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpBitcast %float %74 + %76 = OpAccessChain %_ptr_Output_float %frexpStruct_exp_out %uint_0 + OpStore %76 %75 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_geom.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_geom.amber new file mode 100644 index 0000000..8908cb1 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_geom.amber @@ -0,0 +1,425 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A geometry shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE geometryShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER geometry geom_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uint in_values[ndp]; +# }; +# +# layout (triangles) in; +# layout (triangle_strip, max_vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out float frexp_x_out; +# layout (location = 1) flat out float frexp_exp_out; +# layout (location = 2) flat out float frexpStruct_x_out; +# layout (location = 3) flat out float frexpStruct_exp_out; +# +# struct frexpStructType +# { +# float x; +# int exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (float orig) +# { +# float x; +# int exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# for (int vertex = 0; vertex < 3; vertex++) +# { +# uint in_uint = in_values[ndx_in[vertex]]; +# float in_float = uintBitsToFloat(in_uint); +# float x; +# int exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = x; +# frexp_exp_out = intBitsToFloat(exp); +# frexpStruct_x_out = res.x; +# frexpStruct_exp_out = intBitsToFloat(res.exp); +# +# gl_Position = gl_in[vertex].gl_Position; +# EmitVertex(); +# } +# +# EndPrimitive(); +# } +# END + +SHADER geometry geom_shader SPIRV-ASM + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0 %gl_in + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_uint_uint_1296 ArrayStride 4 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 +%frexpStructType = OpTypeStruct %float %int + %10 = OpTypeFunction %frexpStructType %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1296 = OpConstant %uint 1296 +%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296 + %block0 = OpTypeStruct %_arr_uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %uint_3 = OpConstant %uint 3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Output_float = OpTypePointer Output %float +%frexp_x_out = OpVariable %_ptr_Output_float Output +%frexp_exp_out = OpVariable %_ptr_Output_float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_float Output + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3 +%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %vertex = OpVariable %_ptr_Function_int Function + %in_uint = OpVariable %_ptr_Function_uint Function + %in_float = OpVariable %_ptr_Function_float Function + %x_0 = OpVariable %_ptr_Function_float Function + %exp_0 = OpVariable %_ptr_Function_int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + OpStore %vertex %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %vertex + %37 = OpSLessThan %bool %34 %int_3 + OpBranchConditional %37 %30 %31 + %30 = OpLabel + %50 = OpLoad %int %vertex + %52 = OpAccessChain %_ptr_Input_uint %ndx_in %50 + %53 = OpLoad %uint %52 + %55 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %53 + %56 = OpLoad %uint %55 + OpStore %in_uint %56 + %58 = OpLoad %uint %in_uint + %59 = OpBitcast %float %58 + OpStore %in_float %59 + %61 = OpLoad %float %in_float + %63 = OpExtInst %float %1 Frexp %61 %exp_0 + OpStore %x_0 %63 + %66 = OpLoad %float %in_float + %67 = OpExtInst %frexpStructType %1 FrexpStruct %66 + OpStore %res_0 %67 + %70 = OpLoad %float %x_0 + OpStore %frexp_x_out %70 + %72 = OpLoad %int %exp_0 + %73 = OpBitcast %float %72 + OpStore %frexp_exp_out %73 + %75 = OpAccessChain %_ptr_Function_float %res_0 %int_0 + %76 = OpLoad %float %75 + OpStore %frexpStruct_x_out %76 + %79 = OpAccessChain %_ptr_Function_int %res_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpBitcast %float %80 + OpStore %frexpStruct_exp_out %81 + %92 = OpLoad %int %vertex + %94 = OpAccessChain %_ptr_Input_v4float %gl_in %92 %int_0 + %95 = OpLoad %v4float %94 + %97 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %97 %95 + OpEmitVertex + OpBranch %32 + %32 = OpLabel + %98 = OpLoad %int %vertex + %99 = OpIAdd %int %98 %int_1 + OpStore %vertex %99 + OpBranch %29 + %31 = OpLabel + OpEndPrimitive + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in float frexp_x_in; +# layout (location = 1) flat in float frexp_exp_in; +# layout (location = 2) flat in float frexpStruct_x_in; +# layout (location = 3) flat in float frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.r = frexp_x_in; +# frexp_exp_out.r = frexp_exp_in; +# frexpStruct_x_out.r = frexpStruct_x_in; +# frexpStruct_exp_out.r = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_float = OpTypePointer Input %float + %frexp_x_in = OpVariable %_ptr_Input_float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float +%frexp_exp_in = OpVariable %_ptr_Input_float Input +%frexpStruct_x_in = OpVariable %_ptr_Input_float Input +%frexpStruct_exp_in = OpVariable %_ptr_Input_float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %frexp_x_out %12 + OpStore %frexp_exp_out %12 + OpStore %frexpStruct_x_out %12 + OpStore %frexpStruct_exp_out %12 + %18 = OpLoad %float %frexp_x_in + %22 = OpAccessChain %_ptr_Output_float %frexp_x_out %uint_0 + OpStore %22 %18 + %24 = OpLoad %float %frexp_exp_in + %25 = OpAccessChain %_ptr_Output_float %frexp_exp_out %uint_0 + OpStore %25 %24 + %27 = OpLoad %float %frexpStruct_x_in + %28 = OpAccessChain %_ptr_Output_float %frexpStruct_x_out %uint_0 + OpStore %28 %27 + %30 = OpLoad %float %frexpStruct_exp_in + %31 = OpAccessChain %_ptr_Output_float %frexpStruct_exp_out %uint_0 + OpStore %31 %30 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH geom_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_tesc.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_tesc.amber new file mode 100644 index 0000000..1308ff2 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_tesc.amber @@ -0,0 +1,581 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation control shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out float frexp_x_out[]; +# layout (location = 1) flat out float frexp_exp_out[]; +# layout (location = 2) flat out float frexpStruct_x_out[]; +# layout (location = 3) flat out float frexpStruct_exp_out[]; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uint in_values[ndp]; +# }; +# +# struct frexpStructType +# { +# float x; +# int exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (float orig) +# { +# float x; +# int exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# uint in_uint = in_values[ndx_in[gl_InvocationID]]; +# float in_float = uintBitsToFloat(in_uint); +# float x; +# int exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out[gl_InvocationID] = x; +# frexp_exp_out[gl_InvocationID] = intBitsToFloat(exp); +# frexpStruct_x_out[gl_InvocationID] = res.x; +# frexpStruct_exp_out[gl_InvocationID] = intBitsToFloat(res.exp); +# +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_uint_uint_1296 ArrayStride 4 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 +%frexpStructType = OpTypeStruct %float %int + %10 = OpTypeFunction %frexpStructType %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1296 = OpConstant %uint 1296 +%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296 + %block0 = OpTypeStruct %_arr_uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 + %uint_32 = OpConstant %uint 32 +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Output__arr_float_uint_3 = OpTypePointer Output %_arr_float_uint_3 +%frexp_x_out = OpVariable %_ptr_Output__arr_float_uint_3 Output +%_ptr_Output_float = OpTypePointer Output %float +%frexp_exp_out = OpVariable %_ptr_Output__arr_float_uint_3 Output +%frexpStruct_x_out = OpVariable %_ptr_Output__arr_float_uint_3 Output +%frexpStruct_exp_out = OpVariable %_ptr_Output__arr_float_uint_3 Output + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %float_1 = OpConstant %float 1 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_uint Function + %in_float = OpVariable %_ptr_Function_float Function + %x_0 = OpVariable %_ptr_Function_float Function + %exp_0 = OpVariable %_ptr_Function_int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %42 = OpLoad %int %gl_InvocationID + %44 = OpAccessChain %_ptr_Input_uint %ndx_in %42 + %45 = OpLoad %uint %44 + %47 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %45 + %48 = OpLoad %uint %47 + OpStore %in_uint %48 + %50 = OpLoad %uint %in_uint + %51 = OpBitcast %float %50 + OpStore %in_float %51 + %53 = OpLoad %float %in_float + %55 = OpExtInst %float %1 Frexp %53 %exp_0 + OpStore %x_0 %55 + %58 = OpLoad %float %in_float + %59 = OpExtInst %frexpStructType %1 FrexpStruct %58 + OpStore %res_0 %59 + %64 = OpLoad %int %gl_InvocationID + %65 = OpLoad %float %x_0 + %67 = OpAccessChain %_ptr_Output_float %frexp_x_out %64 + OpStore %67 %65 + %69 = OpLoad %int %gl_InvocationID + %70 = OpLoad %int %exp_0 + %71 = OpBitcast %float %70 + %72 = OpAccessChain %_ptr_Output_float %frexp_exp_out %69 + OpStore %72 %71 + %74 = OpLoad %int %gl_InvocationID + %75 = OpAccessChain %_ptr_Function_float %res_0 %int_0 + %76 = OpLoad %float %75 + %77 = OpAccessChain %_ptr_Output_float %frexpStruct_x_out %74 + OpStore %77 %76 + %79 = OpLoad %int %gl_InvocationID + %81 = OpAccessChain %_ptr_Function_int %res_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpBitcast %float %82 + %84 = OpAccessChain %_ptr_Output_float %frexpStruct_exp_out %79 + OpStore %84 %83 + %90 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %90 %float_1 + %91 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %91 %float_1 + %96 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %96 %float_1 + %97 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %97 %float_1 + %99 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %99 %float_1 + %101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %101 %float_1 + %109 = OpLoad %int %gl_InvocationID + %114 = OpLoad %int %gl_InvocationID + %116 = OpAccessChain %_ptr_Input_v4float %gl_in %114 %int_0 + %117 = OpLoad %v4float %116 + %119 = OpAccessChain %_ptr_Output_v4float %gl_out %109 %int_0 + OpStore %119 %117 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# layout (triangles) in; +# +# layout (location = 0) flat in float frexp_x_in[]; +# layout (location = 1) flat in float frexp_exp_in[]; +# layout (location = 2) flat in float frexpStruct_x_in[]; +# layout (location = 3) flat in float frexpStruct_exp_in[]; +# +# layout (location = 0) flat out float frexp_x_out; +# layout (location = 1) flat out float frexp_exp_out; +# layout (location = 2) flat out float frexpStruct_x_out; +# layout (location = 3) flat out float frexpStruct_exp_out; +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# frexp_x_out = frexp_x_in[0]; +# frexp_exp_out = frexp_exp_in[0]; +# frexpStruct_x_out = frexpStruct_x_in[0]; +# frexpStruct_exp_out = frexpStruct_exp_in[0]; +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output_float = OpTypePointer Output %float +%frexp_x_out = OpVariable %_ptr_Output_float Output +%_arr_float_uint_32 = OpTypeArray %float %uint_32 +%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32 + %frexp_x_in = OpVariable %_ptr_Input__arr_float_uint_32 Input +%frexp_exp_out = OpVariable %_ptr_Output_float Output +%frexp_exp_in = OpVariable %_ptr_Input__arr_float_uint_32 Input +%frexpStruct_x_out = OpVariable %_ptr_Output_float Output +%frexpStruct_x_in = OpVariable %_ptr_Input__arr_float_uint_32 Input +%frexpStruct_exp_out = OpVariable %_ptr_Output_float Output +%frexpStruct_exp_in = OpVariable %_ptr_Input__arr_float_uint_32 Input + %main = OpFunction %void None %3 + %5 = OpLabel + %21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %22 = OpLoad %float %21 + %29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %30 = OpLoad %v4float %29 + %31 = OpVectorTimesScalar %v4float %30 %22 + %32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %36 = OpLoad %v4float %35 + %37 = OpVectorTimesScalar %v4float %36 %33 + %38 = OpFAdd %v4float %31 %37 + %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %44 = OpLoad %v4float %43 + %45 = OpVectorTimesScalar %v4float %44 %41 + %46 = OpFAdd %v4float %38 %45 + %48 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %48 %46 + %54 = OpAccessChain %_ptr_Input_float %frexp_x_in %int_0 + %55 = OpLoad %float %54 + OpStore %frexp_x_out %55 + %58 = OpAccessChain %_ptr_Input_float %frexp_exp_in %int_0 + %59 = OpLoad %float %58 + OpStore %frexp_exp_out %59 + %62 = OpAccessChain %_ptr_Input_float %frexpStruct_x_in %int_0 + %63 = OpLoad %float %62 + OpStore %frexpStruct_x_out %63 + %66 = OpAccessChain %_ptr_Input_float %frexpStruct_exp_in %int_0 + %67 = OpLoad %float %66 + OpStore %frexpStruct_exp_out %67 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in float frexp_x_in; +# layout (location = 1) flat in float frexp_exp_in; +# layout (location = 2) flat in float frexpStruct_x_in; +# layout (location = 3) flat in float frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.r = frexp_x_in; +# frexp_exp_out.r = frexp_exp_in; +# frexpStruct_x_out.r = frexpStruct_x_in; +# frexpStruct_exp_out.r = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_float = OpTypePointer Input %float + %frexp_x_in = OpVariable %_ptr_Input_float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float +%frexp_exp_in = OpVariable %_ptr_Input_float Input +%frexpStruct_x_in = OpVariable %_ptr_Input_float Input +%frexpStruct_exp_in = OpVariable %_ptr_Input_float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %frexp_x_out %12 + OpStore %frexp_exp_out %12 + OpStore %frexpStruct_x_out %12 + OpStore %frexpStruct_exp_out %12 + %18 = OpLoad %float %frexp_x_in + %22 = OpAccessChain %_ptr_Output_float %frexp_x_out %uint_0 + OpStore %22 %18 + %24 = OpLoad %float %frexp_exp_in + %25 = OpAccessChain %_ptr_Output_float %frexp_exp_out %uint_0 + OpStore %25 %24 + %27 = OpLoad %float %frexpStruct_x_in + %28 = OpAccessChain %_ptr_Output_float %frexpStruct_x_out %uint_0 + OpStore %28 %27 + %30 = OpLoad %float %frexpStruct_exp_in + %31 = OpAccessChain %_ptr_Output_float %frexpStruct_exp_out %uint_0 + OpStore %31 %30 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_tese.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_tese.amber new file mode 100644 index 0000000..c055166 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_tese.amber @@ -0,0 +1,537 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation evaluation shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out uint ndx_out[]; +# +# void main () +# { +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID]; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3 + %ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output_uint = OpTypePointer Output %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %16 %float_1 + %18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %18 %float_1 + %23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %23 %float_1 + %24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %24 %float_1 + %26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %26 %float_1 + %28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %28 %float_1 + %39 = OpLoad %int %gl_InvocationID + %47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0 + %48 = OpLoad %v4float %47 + %50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0 + OpStore %50 %48 + %60 = OpAccessChain %_ptr_Input_uint %ndx_in %39 + %61 = OpLoad %uint %60 + %63 = OpAccessChain %_ptr_Output_uint %ndx_out %39 + OpStore %63 %61 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (triangles) in; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out float frexp_x_out; +# layout (location = 1) flat out float frexp_exp_out; +# layout (location = 2) flat out float frexpStruct_x_out; +# layout (location = 3) flat out float frexpStruct_exp_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uint in_values[ndp]; +# }; +# +# struct frexpStructType +# { +# float x; +# int exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (float orig) +# { +# float x; +# int exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# uint in_uint = in_values[ndx_in[0]]; +# float in_float = uintBitsToFloat(in_uint); +# float x; +# int exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = x; +# frexp_exp_out = intBitsToFloat(exp); +# frexpStruct_x_out = res.x; +# frexpStruct_exp_out = intBitsToFloat(res.exp); +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %_arr_uint_uint_1296 ArrayStride 4 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 +%frexpStructType = OpTypeStruct %float %int + %10 = OpTypeFunction %frexpStructType %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1296 = OpConstant %uint 1296 +%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296 + %block0 = OpTypeStruct %_arr_uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %__0 = OpVariable %_ptr_Uniform_block0 Uniform +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Output_float = OpTypePointer Output %float +%frexp_x_out = OpVariable %_ptr_Output_float Output +%frexp_exp_out = OpVariable %_ptr_Output_float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_uint Function + %in_float = OpVariable %_ptr_Function_float Function + %x_0 = OpVariable %_ptr_Function_float Function + %exp_0 = OpVariable %_ptr_Function_int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %41 = OpLoad %float %40 + %48 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %49 = OpLoad %v4float %48 + %50 = OpVectorTimesScalar %v4float %49 %41 + %51 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %52 = OpLoad %float %51 + %54 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %55 = OpLoad %v4float %54 + %56 = OpVectorTimesScalar %v4float %55 %52 + %57 = OpFAdd %v4float %50 %56 + %59 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %60 = OpLoad %float %59 + %62 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %63 = OpLoad %v4float %62 + %64 = OpVectorTimesScalar %v4float %63 %60 + %65 = OpFAdd %v4float %57 %64 + %67 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %67 %65 + %79 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0 + %80 = OpLoad %uint %79 + %82 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %80 + %83 = OpLoad %uint %82 + OpStore %in_uint %83 + %85 = OpLoad %uint %in_uint + %86 = OpBitcast %float %85 + OpStore %in_float %86 + %88 = OpLoad %float %in_float + %90 = OpExtInst %float %1 Frexp %88 %exp_0 + OpStore %x_0 %90 + %93 = OpLoad %float %in_float + %94 = OpExtInst %frexpStructType %1 FrexpStruct %93 + OpStore %res_0 %94 + %97 = OpLoad %float %x_0 + OpStore %frexp_x_out %97 + %99 = OpLoad %int %exp_0 + %100 = OpBitcast %float %99 + OpStore %frexp_exp_out %100 + %102 = OpAccessChain %_ptr_Function_float %res_0 %int_0 + %103 = OpLoad %float %102 + OpStore %frexpStruct_x_out %103 + %105 = OpAccessChain %_ptr_Function_int %res_0 %int_1 + %106 = OpLoad %int %105 + %107 = OpBitcast %float %106 + OpStore %frexpStruct_exp_out %107 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in float frexp_x_in; +# layout (location = 1) flat in float frexp_exp_in; +# layout (location = 2) flat in float frexpStruct_x_in; +# layout (location = 3) flat in float frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.r = frexp_x_in; +# frexp_exp_out.r = frexp_exp_in; +# frexpStruct_x_out.r = frexpStruct_x_in; +# frexpStruct_exp_out.r = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_float = OpTypePointer Input %float + %frexp_x_in = OpVariable %_ptr_Input_float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float +%frexp_exp_in = OpVariable %_ptr_Input_float Input +%frexpStruct_x_in = OpVariable %_ptr_Input_float Input +%frexpStruct_exp_in = OpVariable %_ptr_Input_float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %frexp_x_out %12 + OpStore %frexp_exp_out %12 + OpStore %frexpStruct_x_out %12 + OpStore %frexpStruct_exp_out %12 + %18 = OpLoad %float %frexp_x_in + %22 = OpAccessChain %_ptr_Output_float %frexp_x_out %uint_0 + OpStore %22 %18 + %24 = OpLoad %float %frexp_exp_in + %25 = OpAccessChain %_ptr_Output_float %frexp_exp_out %uint_0 + OpStore %25 %24 + %27 = OpLoad %float %frexpStruct_x_in + %28 = OpAccessChain %_ptr_Output_float %frexpStruct_x_out %uint_0 + OpStore %28 %27 + %30 = OpLoad %float %frexpStruct_exp_in + %31 = OpAccessChain %_ptr_Output_float %frexpStruct_exp_out %uint_0 + OpStore %31 %30 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_vert.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_vert.amber new file mode 100644 index 0000000..66f7d96 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_1_vert.amber @@ -0,0 +1,330 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A vertex shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out float frexp_x_out; +# layout (location = 1) flat out float frexp_exp_out; +# layout (location = 2) flat out float frexpStruct_x_out; +# layout (location = 3) flat out float frexpStruct_exp_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uint in_values[ndp]; +# }; +# +# struct frexpStructType +# { +# float x; +# int exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (float orig) +# { +# float x; +# int exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# uint ndx = xcoord + ycoord * ndpSqrt; +# +# uint in_uint = in_values[ndx]; +# float in_float = uintBitsToFloat(in_uint); +# float x; +# int exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = x; +# frexp_exp_out = intBitsToFloat(exp); +# frexpStruct_x_out = res.x; +# frexpStruct_exp_out = intBitsToFloat(res.exp); +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0 + OpDecorate %position Location 0 + OpDecorate %_arr_uint_uint_1296 ArrayStride 4 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 +%frexpStructType = OpTypeStruct %float %int + %10 = OpTypeFunction %frexpStructType %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float_36 = OpConstant %float 36 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0_027777778 = OpConstant %float 0.027777778 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %uint_1 = OpConstant %uint 1 + %uint_36 = OpConstant %uint 36 + %uint_1296 = OpConstant %uint 1296 +%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296 + %block0 = OpTypeStruct %_arr_uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Output_float = OpTypePointer Output %float +%frexp_x_out = OpVariable %_ptr_Output_float Output +%frexp_exp_out = OpVariable %_ptr_Output_float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_float Output + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %xcoord = OpVariable %_ptr_Function_uint Function + %ycoord = OpVariable %_ptr_Function_uint Function + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_uint Function + %in_float = OpVariable %_ptr_Function_float Function + %x_0 = OpVariable %_ptr_Function_float Function + %exp_0 = OpVariable %_ptr_Function_int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %36 = OpAccessChain %_ptr_Input_float %position %uint_0 + %37 = OpLoad %float %36 + %39 = OpFAdd %float %37 %float_0_027777778 + %41 = OpFAdd %float %39 %float_1 + %43 = OpFDiv %float %41 %float_2 + %44 = OpFMul %float %float_36 %43 + %45 = OpFSub %float %44 %float_1 + %46 = OpConvertFToU %uint %45 + OpStore %xcoord %46 + %49 = OpAccessChain %_ptr_Input_float %position %uint_1 + %50 = OpLoad %float %49 + %51 = OpFAdd %float %50 %float_0_027777778 + %52 = OpFAdd %float %51 %float_1 + %53 = OpFDiv %float %52 %float_2 + %54 = OpFMul %float %float_36 %53 + %55 = OpFSub %float %54 %float_1 + %56 = OpConvertFToU %uint %55 + OpStore %ycoord %56 + %58 = OpLoad %uint %xcoord + %59 = OpLoad %uint %ycoord + %61 = OpIMul %uint %59 %uint_36 + %62 = OpIAdd %uint %58 %61 + OpStore %ndx %62 + %70 = OpLoad %uint %ndx + %72 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %70 + %73 = OpLoad %uint %72 + OpStore %in_uint %73 + %75 = OpLoad %uint %in_uint + %76 = OpBitcast %float %75 + OpStore %in_float %76 + %78 = OpLoad %float %in_float + %80 = OpExtInst %float %1 Frexp %78 %exp_0 + OpStore %x_0 %80 + %83 = OpLoad %float %in_float + %84 = OpExtInst %frexpStructType %1 FrexpStruct %83 + OpStore %res_0 %84 + %87 = OpLoad %float %x_0 + OpStore %frexp_x_out %87 + %89 = OpLoad %int %exp_0 + %90 = OpBitcast %float %89 + OpStore %frexp_exp_out %90 + %92 = OpAccessChain %_ptr_Function_float %res_0 %int_0 + %93 = OpLoad %float %92 + OpStore %frexpStruct_x_out %93 + %96 = OpAccessChain %_ptr_Function_int %res_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpBitcast %float %97 + OpStore %frexpStruct_exp_out %98 + %104 = OpLoad %v2float %position + %106 = OpCompositeExtract %float %104 0 + %107 = OpCompositeExtract %float %104 1 + %108 = OpCompositeConstruct %v4float %106 %107 %float_0 %float_1 + %110 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %110 %108 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in float frexp_x_in; +# layout (location = 1) flat in float frexp_exp_in; +# layout (location = 2) flat in float frexpStruct_x_in; +# layout (location = 3) flat in float frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.r = frexp_x_in; +# frexp_exp_out.r = frexp_exp_in; +# frexpStruct_x_out.r = frexpStruct_x_in; +# frexpStruct_exp_out.r = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_float = OpTypePointer Input %float + %frexp_x_in = OpVariable %_ptr_Input_float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float +%frexp_exp_in = OpVariable %_ptr_Input_float Input +%frexpStruct_x_in = OpVariable %_ptr_Input_float Input +%frexpStruct_exp_in = OpVariable %_ptr_Input_float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %frexp_x_out %12 + OpStore %frexp_exp_out %12 + OpStore %frexpStruct_x_out %12 + OpStore %frexpStruct_exp_out %12 + %18 = OpLoad %float %frexp_x_in + %22 = OpAccessChain %_ptr_Output_float %frexp_x_out %uint_0 + OpStore %22 %18 + %24 = OpLoad %float %frexp_exp_in + %25 = OpAccessChain %_ptr_Output_float %frexp_exp_out %uint_0 + OpStore %25 %24 + %27 = OpLoad %float %frexpStruct_x_in + %28 = OpAccessChain %_ptr_Output_float %frexpStruct_x_out %uint_0 + OpStore %28 %27 + %30 = OpLoad %float %frexpStruct_exp_in + %31 = OpAccessChain %_ptr_Output_float %frexpStruct_exp_out %uint_0 + OpStore %31 %30 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_comp.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_comp.amber new file mode 100644 index 0000000..a5af11a --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_comp.amber @@ -0,0 +1,215 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A compute shader test for FrexpStruct. + +# SHADER compute comp_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296 / 2; +# const uint half_ndp = ndp / 2; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec2 in_values[half_ndp]; +# }; +# +# layout(set = 0, binding = 1) buffer block1 { +# vec2 frexp_out[ndp]; +# }; +# +# layout(set = 0, binding = 2) buffer block2 { +# vec2 frexpStruct_out[ndp]; +# }; +# +# struct frexpStructType +# { +# vec2 x; +# ivec2 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec2 orig) +# { +# vec2 x; +# ivec2 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# for (uint ndx = 0; ndx < ndp; ndx += 2) +# { +# uvec2 in_uint = in_values[ndx/2]; +# vec2 in_float = uintBitsToFloat(in_uint); +# vec2 x; +# ivec2 exp; +# +# x = frexp(in_float, exp); +# frexpStructType res = frexpStruct(in_float); +# +# frexp_out[ndx] = intBitsToFloat(exp); +# frexp_out[ndx+1] = x; +# frexpStruct_out[ndx] = intBitsToFloat(res.exp); +# frexpStruct_out[ndx+1] = res.x; +# } +# +# return; +# } +# END + +SHADER compute comp_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %_arr_v2uint_uint_324 ArrayStride 8 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_v2float_uint_648 ArrayStride 8 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_arr_v2float_uint_648_0 ArrayStride 8 + OpMemberDecorate %block2 0 Offset 0 + OpDecorate %block2 BufferBlock + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%frexpStructType = OpTypeStruct %v2float %v2int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v2float +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %uint_648 = OpConstant %uint 648 + %bool = OpTypeBool + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_324 = OpConstant %uint 324 +%_arr_v2uint_uint_324 = OpTypeArray %v2uint %uint_324 + %block0 = OpTypeStruct %_arr_v2uint_uint_324 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint +%_arr_v2float_uint_648 = OpTypeArray %v2float %uint_648 + %block1 = OpTypeStruct %_arr_v2float_uint_648 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %uint_1 = OpConstant %uint 1 +%_arr_v2float_uint_648_0 = OpTypeArray %v2float %uint_648 + %block2 = OpTypeStruct %_arr_v2float_uint_648_0 +%_ptr_Uniform_block2 = OpTypePointer Uniform %block2 + %__1 = OpVariable %_ptr_Uniform_block2 Uniform + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_v2uint Function + %in_float = OpVariable %_ptr_Function_v2float Function + %x_0 = OpVariable %_ptr_Function_v2float Function + %exp_0 = OpVariable %_ptr_Function_v2int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + OpStore %ndx %uint_0 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %uint %ndx + %41 = OpULessThan %bool %38 %uint_648 + OpBranchConditional %41 %34 %35 + %34 = OpLabel + %51 = OpLoad %uint %ndx + %53 = OpUDiv %uint %51 %uint_2 + %55 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %53 + %56 = OpLoad %v2uint %55 + OpStore %in_uint %56 + %58 = OpLoad %v2uint %in_uint + %59 = OpBitcast %v2float %58 + OpStore %in_float %59 + %61 = OpLoad %v2float %in_float + %63 = OpExtInst %v2float %1 Frexp %61 %exp_0 + OpStore %x_0 %63 + %66 = OpLoad %v2float %in_float + %67 = OpExtInst %frexpStructType %1 FrexpStruct %66 + OpStore %res_0 %67 + %72 = OpLoad %uint %ndx + %73 = OpLoad %v2int %exp_0 + %74 = OpBitcast %v2float %73 + %76 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %72 + OpStore %76 %74 + %77 = OpLoad %uint %ndx + %79 = OpIAdd %uint %77 %uint_1 + %80 = OpLoad %v2float %x_0 + %81 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %79 + OpStore %81 %80 + %86 = OpLoad %uint %ndx + %88 = OpAccessChain %_ptr_Function_v2int %res_0 %int_1 + %89 = OpLoad %v2int %88 + %90 = OpBitcast %v2float %89 + %91 = OpAccessChain %_ptr_Uniform_v2float %__1 %int_0 %86 + OpStore %91 %90 + %92 = OpLoad %uint %ndx + %93 = OpIAdd %uint %92 %uint_1 + %94 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0 + %95 = OpLoad %v2float %94 + %96 = OpAccessChain %_ptr_Uniform_v2float %__1 %int_0 %93 + OpStore %96 %95 + OpBranch %36 + %36 = OpLabel + %97 = OpLoad %uint %ndx + %98 = OpIAdd %uint %97 %uint_2 + OpStore %ndx %98 + OpBranch %33 + %35 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt + +BUFFER buf_frexp DATA_TYPE vec2 SIZE 648 FILL 0.0 +BUFFER buf_frexpStruct DATA_TYPE vec2 SIZE 648 FILL 1.0 + +PIPELINE compute test_pipeline + ATTACH comp_shader + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER buf_frexp AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER buf_frexpStruct AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN test_pipeline 1 1 1 + +EXPECT buf_frexp EQ_BUFFER buf_frexpStruct diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_frag.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_frag.amber new file mode 100644 index 0000000..d127317 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_frag.amber @@ -0,0 +1,288 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A fragment shader test for FrexpStruct. + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec2 in_values[ndp]; +# }; +# +# layout (location = 0) flat in uint ndx_in; +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# struct frexpStructType +# { +# vec2 x; +# ivec2 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec2 orig) +# { +# vec2 x; +# ivec2 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# uvec2 in_uint = in_values[ndx_in]; +# vec2 in_float = uintBitsToFloat(in_uint); +# vec2 x; +# ivec2 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.rg = x; +# frexp_exp_out.rg = intBitsToFloat(exp); +# frexpStruct_x_out.rg = res.x; +# frexpStruct_exp_out.rg = intBitsToFloat(res.exp); +# +# return; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out + OpExecutionMode %main OriginUpperLeft + OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%frexpStructType = OpTypeStruct %v2float %v2int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v2float +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296 + %block0 = OpTypeStruct %_arr_v2uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %ndx_in = OpVariable %_ptr_Input_uint Input +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %61 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v2uint Function + %in_float = OpVariable %_ptr_Function_v2float Function + %x_0 = OpVariable %_ptr_Function_v2float Function + %exp_0 = OpVariable %_ptr_Function_v2int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %41 = OpLoad %uint %ndx_in + %43 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %41 + %44 = OpLoad %v2uint %43 + OpStore %in_uint %44 + %46 = OpLoad %v2uint %in_uint + %47 = OpBitcast %v2float %46 + OpStore %in_float %47 + %49 = OpLoad %v2float %in_float + %51 = OpExtInst %v2float %1 Frexp %49 %exp_0 + OpStore %x_0 %51 + %54 = OpLoad %v2float %in_float + %55 = OpExtInst %frexpStructType %1 FrexpStruct %54 + OpStore %res_0 %55 + OpStore %frexp_x_out %61 + OpStore %frexp_exp_out %61 + OpStore %frexpStruct_x_out %61 + OpStore %frexpStruct_exp_out %61 + %65 = OpLoad %v2float %x_0 + %66 = OpLoad %v4float %frexp_x_out + %67 = OpVectorShuffle %v4float %66 %65 4 5 2 3 + OpStore %frexp_x_out %67 + %68 = OpLoad %v2int %exp_0 + %69 = OpBitcast %v2float %68 + %70 = OpLoad %v4float %frexp_exp_out + %71 = OpVectorShuffle %v4float %70 %69 4 5 2 3 + OpStore %frexp_exp_out %71 + %72 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0 + %73 = OpLoad %v2float %72 + %74 = OpLoad %v4float %frexpStruct_x_out + %75 = OpVectorShuffle %v4float %74 %73 4 5 2 3 + OpStore %frexpStruct_x_out %75 + %77 = OpAccessChain %_ptr_Function_v2int %res_0 %int_1 + %78 = OpLoad %v2int %77 + %79 = OpBitcast %v2float %78 + %80 = OpLoad %v4float %frexpStruct_exp_out + %81 = OpVectorShuffle %v4float %80 %79 4 5 2 3 + OpStore %frexpStruct_exp_out %81 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_geom.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_geom.amber new file mode 100644 index 0000000..5687303 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_geom.amber @@ -0,0 +1,431 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A geometry shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE geometryShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER geometry geom_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec2 in_values[ndp]; +# }; +# +# layout (triangles) in; +# layout (triangle_strip, max_vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec2 frexp_x_out; +# layout (location = 1) flat out vec2 frexp_exp_out; +# layout (location = 2) flat out vec2 frexpStruct_x_out; +# layout (location = 3) flat out vec2 frexpStruct_exp_out; +# +# struct frexpStructType +# { +# vec2 x; +# ivec2 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec2 orig) +# { +# vec2 x; +# ivec2 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# for (int vertex = 0; vertex < 3; vertex++) +# { +# uvec2 in_uint = in_values[ndx_in[vertex]]; +# vec2 in_float = uintBitsToFloat(in_uint); +# vec2 x; +# ivec2 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = x; +# frexp_exp_out = intBitsToFloat(exp); +# frexpStruct_x_out = res.x; +# frexpStruct_exp_out = intBitsToFloat(res.exp); +# +# gl_Position = gl_in[vertex].gl_Position; +# EmitVertex(); +# } +# +# EndPrimitive(); +# } +# END + +SHADER geometry geom_shader SPIRV-ASM + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0 %gl_in + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%frexpStructType = OpTypeStruct %v2float %v2int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v2float +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296 + %block0 = OpTypeStruct %_arr_v2uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %uint_3 = OpConstant %uint 3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint +%_ptr_Output_v2float = OpTypePointer Output %v2float +%frexp_x_out = OpVariable %_ptr_Output_v2float Output +%frexp_exp_out = OpVariable %_ptr_Output_v2float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v2float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v2float Output + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3 +%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %vertex = OpVariable %_ptr_Function_int Function + %in_uint = OpVariable %_ptr_Function_v2uint Function + %in_float = OpVariable %_ptr_Function_v2float Function + %x_0 = OpVariable %_ptr_Function_v2float Function + %exp_0 = OpVariable %_ptr_Function_v2int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + OpStore %vertex %int_0 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %vertex + %40 = OpSLessThan %bool %37 %int_3 + OpBranchConditional %40 %33 %34 + %33 = OpLabel + %54 = OpLoad %int %vertex + %56 = OpAccessChain %_ptr_Input_uint %ndx_in %54 + %57 = OpLoad %uint %56 + %59 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %57 + %60 = OpLoad %v2uint %59 + OpStore %in_uint %60 + %62 = OpLoad %v2uint %in_uint + %63 = OpBitcast %v2float %62 + OpStore %in_float %63 + %65 = OpLoad %v2float %in_float + %67 = OpExtInst %v2float %1 Frexp %65 %exp_0 + OpStore %x_0 %67 + %70 = OpLoad %v2float %in_float + %71 = OpExtInst %frexpStructType %1 FrexpStruct %70 + OpStore %res_0 %71 + %74 = OpLoad %v2float %x_0 + OpStore %frexp_x_out %74 + %76 = OpLoad %v2int %exp_0 + %77 = OpBitcast %v2float %76 + OpStore %frexp_exp_out %77 + %79 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0 + %80 = OpLoad %v2float %79 + OpStore %frexpStruct_x_out %80 + %83 = OpAccessChain %_ptr_Function_v2int %res_0 %int_1 + %84 = OpLoad %v2int %83 + %85 = OpBitcast %v2float %84 + OpStore %frexpStruct_exp_out %85 + %96 = OpLoad %int %vertex + %98 = OpAccessChain %_ptr_Input_v4float %gl_in %96 %int_0 + %99 = OpLoad %v4float %98 + %101 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %101 %99 + OpEmitVertex + OpBranch %35 + %35 = OpLabel + %102 = OpLoad %int %vertex + %103 = OpIAdd %int %102 %int_1 + OpStore %vertex %103 + OpBranch %32 + %34 = OpLabel + OpEndPrimitive + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec2 frexp_x_in; +# layout (location = 1) flat in vec2 frexp_exp_in; +# layout (location = 2) flat in vec2 frexpStruct_x_in; +# layout (location = 3) flat in vec2 frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.rg = frexp_x_in; +# frexp_exp_out.rg = frexp_exp_in; +# frexpStruct_x_out.rg = frexpStruct_x_in; +# frexpStruct_exp_out.rg = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %frexp_x_in = OpVariable %_ptr_Input_v2float Input +%frexp_exp_in = OpVariable %_ptr_Input_v2float Input +%frexpStruct_x_in = OpVariable %_ptr_Input_v2float Input +%frexpStruct_exp_in = OpVariable %_ptr_Input_v2float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %frexp_x_out %12 + OpStore %frexp_exp_out %12 + OpStore %frexpStruct_x_out %12 + OpStore %frexpStruct_exp_out %12 + %19 = OpLoad %v2float %frexp_x_in + %20 = OpLoad %v4float %frexp_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 2 3 + OpStore %frexp_x_out %21 + %23 = OpLoad %v2float %frexp_exp_in + %24 = OpLoad %v4float %frexp_exp_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 2 3 + OpStore %frexp_exp_out %25 + %27 = OpLoad %v2float %frexpStruct_x_in + %28 = OpLoad %v4float %frexpStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 2 3 + OpStore %frexpStruct_x_out %29 + %31 = OpLoad %v2float %frexpStruct_exp_in + %32 = OpLoad %v4float %frexpStruct_exp_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 2 3 + OpStore %frexpStruct_exp_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH geom_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_tesc.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_tesc.amber new file mode 100644 index 0000000..deb6a17 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_tesc.amber @@ -0,0 +1,589 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation control shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec2 frexp_x_out[]; +# layout (location = 1) flat out vec2 frexp_exp_out[]; +# layout (location = 2) flat out vec2 frexpStruct_x_out[]; +# layout (location = 3) flat out vec2 frexpStruct_exp_out[]; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec2 in_values[ndp]; +# }; +# +# struct frexpStructType +# { +# vec2 x; +# ivec2 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec2 orig) +# { +# vec2 x; +# ivec2 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# uvec2 in_uint = in_values[ndx_in[gl_InvocationID]]; +# vec2 in_float = uintBitsToFloat(in_uint); +# vec2 x; +# ivec2 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out[gl_InvocationID] = x; +# frexp_exp_out[gl_InvocationID] = intBitsToFloat(exp); +# frexpStruct_x_out[gl_InvocationID] = res.x; +# frexpStruct_exp_out[gl_InvocationID] = intBitsToFloat(res.exp); +# +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%frexpStructType = OpTypeStruct %v2float %v2int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v2float +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296 + %block0 = OpTypeStruct %_arr_v2uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 + %uint_32 = OpConstant %uint 32 +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint + %uint_3 = OpConstant %uint 3 +%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 +%_ptr_Output__arr_v2float_uint_3 = OpTypePointer Output %_arr_v2float_uint_3 +%frexp_x_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output +%_ptr_Output_v2float = OpTypePointer Output %v2float +%frexp_exp_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output +%frexpStruct_x_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output +%frexpStruct_exp_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v2uint Function + %in_float = OpVariable %_ptr_Function_v2float Function + %x_0 = OpVariable %_ptr_Function_v2float Function + %exp_0 = OpVariable %_ptr_Function_v2int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %45 = OpLoad %int %gl_InvocationID + %47 = OpAccessChain %_ptr_Input_uint %ndx_in %45 + %48 = OpLoad %uint %47 + %50 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %48 + %51 = OpLoad %v2uint %50 + OpStore %in_uint %51 + %53 = OpLoad %v2uint %in_uint + %54 = OpBitcast %v2float %53 + OpStore %in_float %54 + %56 = OpLoad %v2float %in_float + %58 = OpExtInst %v2float %1 Frexp %56 %exp_0 + OpStore %x_0 %58 + %61 = OpLoad %v2float %in_float + %62 = OpExtInst %frexpStructType %1 FrexpStruct %61 + OpStore %res_0 %62 + %67 = OpLoad %int %gl_InvocationID + %68 = OpLoad %v2float %x_0 + %70 = OpAccessChain %_ptr_Output_v2float %frexp_x_out %67 + OpStore %70 %68 + %72 = OpLoad %int %gl_InvocationID + %73 = OpLoad %v2int %exp_0 + %74 = OpBitcast %v2float %73 + %75 = OpAccessChain %_ptr_Output_v2float %frexp_exp_out %72 + OpStore %75 %74 + %77 = OpLoad %int %gl_InvocationID + %78 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0 + %79 = OpLoad %v2float %78 + %80 = OpAccessChain %_ptr_Output_v2float %frexpStruct_x_out %77 + OpStore %80 %79 + %82 = OpLoad %int %gl_InvocationID + %84 = OpAccessChain %_ptr_Function_v2int %res_0 %int_1 + %85 = OpLoad %v2int %84 + %86 = OpBitcast %v2float %85 + %87 = OpAccessChain %_ptr_Output_v2float %frexpStruct_exp_out %82 + OpStore %87 %86 + %94 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %94 %float_1 + %95 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %95 %float_1 + %100 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %100 %float_1 + %101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %101 %float_1 + %103 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %103 %float_1 + %105 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %105 %float_1 + %113 = OpLoad %int %gl_InvocationID + %118 = OpLoad %int %gl_InvocationID + %120 = OpAccessChain %_ptr_Input_v4float %gl_in %118 %int_0 + %121 = OpLoad %v4float %120 + %123 = OpAccessChain %_ptr_Output_v4float %gl_out %113 %int_0 + OpStore %123 %121 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# layout (triangles) in; +# +# layout (location = 0) flat in vec2 frexp_x_in[]; +# layout (location = 1) flat in vec2 frexp_exp_in[]; +# layout (location = 2) flat in vec2 frexpStruct_x_in[]; +# layout (location = 3) flat in vec2 frexpStruct_exp_in[]; +# +# layout (location = 0) flat out vec2 frexp_x_out; +# layout (location = 1) flat out vec2 frexp_exp_out; +# layout (location = 2) flat out vec2 frexpStruct_x_out; +# layout (location = 3) flat out vec2 frexpStruct_exp_out; +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# frexp_x_out = frexp_x_in[0]; +# frexp_exp_out = frexp_exp_in[0]; +# frexpStruct_x_out = frexpStruct_x_in[0]; +# frexpStruct_exp_out = frexpStruct_exp_in[0]; +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v2float = OpTypeVector %float 2 +%_ptr_Output_v2float = OpTypePointer Output %v2float +%frexp_x_out = OpVariable %_ptr_Output_v2float Output +%_arr_v2float_uint_32 = OpTypeArray %v2float %uint_32 +%_ptr_Input__arr_v2float_uint_32 = OpTypePointer Input %_arr_v2float_uint_32 + %frexp_x_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input +%_ptr_Input_v2float = OpTypePointer Input %v2float +%frexp_exp_out = OpVariable %_ptr_Output_v2float Output +%frexp_exp_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input +%frexpStruct_x_out = OpVariable %_ptr_Output_v2float Output +%frexpStruct_x_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input +%frexpStruct_exp_out = OpVariable %_ptr_Output_v2float Output +%frexpStruct_exp_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input + %main = OpFunction %void None %3 + %5 = OpLabel + %21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %22 = OpLoad %float %21 + %29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %30 = OpLoad %v4float %29 + %31 = OpVectorTimesScalar %v4float %30 %22 + %32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %36 = OpLoad %v4float %35 + %37 = OpVectorTimesScalar %v4float %36 %33 + %38 = OpFAdd %v4float %31 %37 + %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %44 = OpLoad %v4float %43 + %45 = OpVectorTimesScalar %v4float %44 %41 + %46 = OpFAdd %v4float %38 %45 + %48 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %48 %46 + %56 = OpAccessChain %_ptr_Input_v2float %frexp_x_in %int_0 + %57 = OpLoad %v2float %56 + OpStore %frexp_x_out %57 + %60 = OpAccessChain %_ptr_Input_v2float %frexp_exp_in %int_0 + %61 = OpLoad %v2float %60 + OpStore %frexp_exp_out %61 + %64 = OpAccessChain %_ptr_Input_v2float %frexpStruct_x_in %int_0 + %65 = OpLoad %v2float %64 + OpStore %frexpStruct_x_out %65 + %68 = OpAccessChain %_ptr_Input_v2float %frexpStruct_exp_in %int_0 + %69 = OpLoad %v2float %68 + OpStore %frexpStruct_exp_out %69 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec2 frexp_x_in; +# layout (location = 1) flat in vec2 frexp_exp_in; +# layout (location = 2) flat in vec2 frexpStruct_x_in; +# layout (location = 3) flat in vec2 frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.rg = frexp_x_in; +# frexp_exp_out.rg = frexp_exp_in; +# frexpStruct_x_out.rg = frexpStruct_x_in; +# frexpStruct_exp_out.rg = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %frexp_x_in = OpVariable %_ptr_Input_v2float Input +%frexp_exp_in = OpVariable %_ptr_Input_v2float Input +%frexpStruct_x_in = OpVariable %_ptr_Input_v2float Input +%frexpStruct_exp_in = OpVariable %_ptr_Input_v2float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %frexp_x_out %12 + OpStore %frexp_exp_out %12 + OpStore %frexpStruct_x_out %12 + OpStore %frexpStruct_exp_out %12 + %19 = OpLoad %v2float %frexp_x_in + %20 = OpLoad %v4float %frexp_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 2 3 + OpStore %frexp_x_out %21 + %23 = OpLoad %v2float %frexp_exp_in + %24 = OpLoad %v4float %frexp_exp_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 2 3 + OpStore %frexp_exp_out %25 + %27 = OpLoad %v2float %frexpStruct_x_in + %28 = OpLoad %v4float %frexpStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 2 3 + OpStore %frexpStruct_x_out %29 + %31 = OpLoad %v2float %frexpStruct_exp_in + %32 = OpLoad %v4float %frexpStruct_exp_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 2 3 + OpStore %frexpStruct_exp_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_tese.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_tese.amber new file mode 100644 index 0000000..d82076f --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_tese.amber @@ -0,0 +1,542 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation evaluation shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out uint ndx_out[]; +# +# void main () +# { +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID]; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3 + %ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output_uint = OpTypePointer Output %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %16 %float_1 + %18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %18 %float_1 + %23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %23 %float_1 + %24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %24 %float_1 + %26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %26 %float_1 + %28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %28 %float_1 + %39 = OpLoad %int %gl_InvocationID + %47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0 + %48 = OpLoad %v4float %47 + %50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0 + OpStore %50 %48 + %60 = OpAccessChain %_ptr_Input_uint %ndx_in %39 + %61 = OpLoad %uint %60 + %63 = OpAccessChain %_ptr_Output_uint %ndx_out %39 + OpStore %63 %61 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (triangles) in; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec2 frexp_x_out; +# layout (location = 1) flat out vec2 frexp_exp_out; +# layout (location = 2) flat out vec2 frexpStruct_x_out; +# layout (location = 3) flat out vec2 frexpStruct_exp_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec2 in_values[ndp]; +# }; +# +# struct frexpStructType +# { +# vec2 x; +# ivec2 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec2 orig) +# { +# vec2 x; +# ivec2 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# uvec2 in_uint = in_values[ndx_in[0]]; +# vec2 in_float = uintBitsToFloat(in_uint); +# vec2 x; +# ivec2 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = x; +# frexp_exp_out = intBitsToFloat(exp); +# frexpStruct_x_out = res.x; +# frexpStruct_exp_out = intBitsToFloat(res.exp); +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%frexpStructType = OpTypeStruct %v2float %v2int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v2float +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296 + %block0 = OpTypeStruct %_arr_v2uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %__0 = OpVariable %_ptr_Uniform_block0 Uniform +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint +%_ptr_Output_v2float = OpTypePointer Output %v2float +%frexp_x_out = OpVariable %_ptr_Output_v2float Output +%frexp_exp_out = OpVariable %_ptr_Output_v2float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v2float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v2float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v2uint Function + %in_float = OpVariable %_ptr_Function_v2float Function + %x_0 = OpVariable %_ptr_Function_v2float Function + %exp_0 = OpVariable %_ptr_Function_v2int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %42 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %43 = OpLoad %float %42 + %50 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %51 = OpLoad %v4float %50 + %52 = OpVectorTimesScalar %v4float %51 %43 + %53 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %54 = OpLoad %float %53 + %56 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %57 = OpLoad %v4float %56 + %58 = OpVectorTimesScalar %v4float %57 %54 + %59 = OpFAdd %v4float %52 %58 + %61 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %62 = OpLoad %float %61 + %64 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %65 = OpLoad %v4float %64 + %66 = OpVectorTimesScalar %v4float %65 %62 + %67 = OpFAdd %v4float %59 %66 + %69 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %69 %67 + %82 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0 + %83 = OpLoad %uint %82 + %85 = OpAccessChain %_ptr_Uniform_v2uint %__0 %int_0 %83 + %86 = OpLoad %v2uint %85 + OpStore %in_uint %86 + %88 = OpLoad %v2uint %in_uint + %89 = OpBitcast %v2float %88 + OpStore %in_float %89 + %91 = OpLoad %v2float %in_float + %93 = OpExtInst %v2float %1 Frexp %91 %exp_0 + OpStore %x_0 %93 + %96 = OpLoad %v2float %in_float + %97 = OpExtInst %frexpStructType %1 FrexpStruct %96 + OpStore %res_0 %97 + %100 = OpLoad %v2float %x_0 + OpStore %frexp_x_out %100 + %102 = OpLoad %v2int %exp_0 + %103 = OpBitcast %v2float %102 + OpStore %frexp_exp_out %103 + %105 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0 + %106 = OpLoad %v2float %105 + OpStore %frexpStruct_x_out %106 + %108 = OpAccessChain %_ptr_Function_v2int %res_0 %int_1 + %109 = OpLoad %v2int %108 + %110 = OpBitcast %v2float %109 + OpStore %frexpStruct_exp_out %110 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec2 frexp_x_in; +# layout (location = 1) flat in vec2 frexp_exp_in; +# layout (location = 2) flat in vec2 frexpStruct_x_in; +# layout (location = 3) flat in vec2 frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.rg = frexp_x_in; +# frexp_exp_out.rg = frexp_exp_in; +# frexpStruct_x_out.rg = frexpStruct_x_in; +# frexpStruct_exp_out.rg = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %frexp_x_in = OpVariable %_ptr_Input_v2float Input +%frexp_exp_in = OpVariable %_ptr_Input_v2float Input +%frexpStruct_x_in = OpVariable %_ptr_Input_v2float Input +%frexpStruct_exp_in = OpVariable %_ptr_Input_v2float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %frexp_x_out %12 + OpStore %frexp_exp_out %12 + OpStore %frexpStruct_x_out %12 + OpStore %frexpStruct_exp_out %12 + %19 = OpLoad %v2float %frexp_x_in + %20 = OpLoad %v4float %frexp_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 2 3 + OpStore %frexp_x_out %21 + %23 = OpLoad %v2float %frexp_exp_in + %24 = OpLoad %v4float %frexp_exp_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 2 3 + OpStore %frexp_exp_out %25 + %27 = OpLoad %v2float %frexpStruct_x_in + %28 = OpLoad %v4float %frexpStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 2 3 + OpStore %frexpStruct_x_out %29 + %31 = OpLoad %v2float %frexpStruct_exp_in + %32 = OpLoad %v4float %frexpStruct_exp_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 2 3 + OpStore %frexpStruct_exp_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_vert.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_vert.amber new file mode 100644 index 0000000..80e022e --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_2_vert.amber @@ -0,0 +1,335 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A vertex shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out vec2 frexp_x_out; +# layout (location = 1) flat out vec2 frexp_exp_out; +# layout (location = 2) flat out vec2 frexpStruct_x_out; +# layout (location = 3) flat out vec2 frexpStruct_exp_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec2 in_values[ndp]; +# }; +# +# struct frexpStructType +# { +# vec2 x; +# ivec2 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec2 orig) +# { +# vec2 x; +# ivec2 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# uint ndx = xcoord + ycoord * ndpSqrt; +# +# uvec2 in_uint = in_values[ndx]; +# vec2 in_float = uintBitsToFloat(in_uint); +# vec2 x; +# ivec2 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = x; +# frexp_exp_out = intBitsToFloat(exp); +# frexpStruct_x_out = res.x; +# frexpStruct_exp_out = intBitsToFloat(res.exp); +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0 + OpDecorate %position Location 0 + OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%frexpStructType = OpTypeStruct %v2float %v2int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v2float +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float_36 = OpConstant %float 36 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0_027777778 = OpConstant %float 0.027777778 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %uint_1 = OpConstant %uint 1 + %uint_36 = OpConstant %uint 36 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296 + %block0 = OpTypeStruct %_arr_v2uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint +%_ptr_Output_v2float = OpTypePointer Output %v2float +%frexp_x_out = OpVariable %_ptr_Output_v2float Output +%frexp_exp_out = OpVariable %_ptr_Output_v2float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v2float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v2float Output + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %xcoord = OpVariable %_ptr_Function_uint Function + %ycoord = OpVariable %_ptr_Function_uint Function + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_v2uint Function + %in_float = OpVariable %_ptr_Function_v2float Function + %x_0 = OpVariable %_ptr_Function_v2float Function + %exp_0 = OpVariable %_ptr_Function_v2int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %37 = OpAccessChain %_ptr_Input_float %position %uint_0 + %38 = OpLoad %float %37 + %40 = OpFAdd %float %38 %float_0_027777778 + %42 = OpFAdd %float %40 %float_1 + %44 = OpFDiv %float %42 %float_2 + %45 = OpFMul %float %float_36 %44 + %46 = OpFSub %float %45 %float_1 + %47 = OpConvertFToU %uint %46 + OpStore %xcoord %47 + %50 = OpAccessChain %_ptr_Input_float %position %uint_1 + %51 = OpLoad %float %50 + %52 = OpFAdd %float %51 %float_0_027777778 + %53 = OpFAdd %float %52 %float_1 + %54 = OpFDiv %float %53 %float_2 + %55 = OpFMul %float %float_36 %54 + %56 = OpFSub %float %55 %float_1 + %57 = OpConvertFToU %uint %56 + OpStore %ycoord %57 + %59 = OpLoad %uint %xcoord + %60 = OpLoad %uint %ycoord + %62 = OpIMul %uint %60 %uint_36 + %63 = OpIAdd %uint %59 %62 + OpStore %ndx %63 + %73 = OpLoad %uint %ndx + %75 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %73 + %76 = OpLoad %v2uint %75 + OpStore %in_uint %76 + %78 = OpLoad %v2uint %in_uint + %79 = OpBitcast %v2float %78 + OpStore %in_float %79 + %81 = OpLoad %v2float %in_float + %83 = OpExtInst %v2float %1 Frexp %81 %exp_0 + OpStore %x_0 %83 + %86 = OpLoad %v2float %in_float + %87 = OpExtInst %frexpStructType %1 FrexpStruct %86 + OpStore %res_0 %87 + %90 = OpLoad %v2float %x_0 + OpStore %frexp_x_out %90 + %92 = OpLoad %v2int %exp_0 + %93 = OpBitcast %v2float %92 + OpStore %frexp_exp_out %93 + %95 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0 + %96 = OpLoad %v2float %95 + OpStore %frexpStruct_x_out %96 + %99 = OpAccessChain %_ptr_Function_v2int %res_0 %int_1 + %100 = OpLoad %v2int %99 + %101 = OpBitcast %v2float %100 + OpStore %frexpStruct_exp_out %101 + %107 = OpLoad %v2float %position + %109 = OpCompositeExtract %float %107 0 + %110 = OpCompositeExtract %float %107 1 + %111 = OpCompositeConstruct %v4float %109 %110 %float_0 %float_1 + %113 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %113 %111 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec2 frexp_x_in; +# layout (location = 1) flat in vec2 frexp_exp_in; +# layout (location = 2) flat in vec2 frexpStruct_x_in; +# layout (location = 3) flat in vec2 frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.rg = frexp_x_in; +# frexp_exp_out.rg = frexp_exp_in; +# frexpStruct_x_out.rg = frexpStruct_x_in; +# frexpStruct_exp_out.rg = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %frexp_x_in = OpVariable %_ptr_Input_v2float Input +%frexp_exp_in = OpVariable %_ptr_Input_v2float Input +%frexpStruct_x_in = OpVariable %_ptr_Input_v2float Input +%frexpStruct_exp_in = OpVariable %_ptr_Input_v2float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %frexp_x_out %12 + OpStore %frexp_exp_out %12 + OpStore %frexpStruct_x_out %12 + OpStore %frexpStruct_exp_out %12 + %19 = OpLoad %v2float %frexp_x_in + %20 = OpLoad %v4float %frexp_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 2 3 + OpStore %frexp_x_out %21 + %23 = OpLoad %v2float %frexp_exp_in + %24 = OpLoad %v4float %frexp_exp_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 2 3 + OpStore %frexp_exp_out %25 + %27 = OpLoad %v2float %frexpStruct_x_in + %28 = OpLoad %v4float %frexpStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 2 3 + OpStore %frexpStruct_x_out %29 + %31 = OpLoad %v2float %frexpStruct_exp_in + %32 = OpLoad %v4float %frexpStruct_exp_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 2 3 + OpStore %frexpStruct_exp_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_comp.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_comp.amber new file mode 100644 index 0000000..a637659 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_comp.amber @@ -0,0 +1,215 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A compute shader test for FrexpStruct. + +# SHADER compute comp_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296 / 3; +# const uint half_ndp = ndp / 2; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec3 in_values[half_ndp]; +# }; +# +# layout(set = 0, binding = 1) buffer block1 { +# vec3 frexp_out[ndp]; +# }; +# +# layout(set = 0, binding = 2) buffer block2 { +# vec3 frexpStruct_out[ndp]; +# }; +# +# struct frexpStructType +# { +# vec3 x; +# ivec3 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec3 orig) +# { +# vec3 x; +# ivec3 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# for (uint ndx = 0; ndx < ndp; ndx += 2) +# { +# uvec3 in_uint = in_values[ndx/2]; +# vec3 in_float = uintBitsToFloat(in_uint); +# vec3 x; +# ivec3 exp; +# +# x = frexp(in_float, exp); +# frexpStructType res = frexpStruct(in_float); +# +# frexp_out[ndx] = intBitsToFloat(exp); +# frexp_out[ndx+1] = x; +# frexpStruct_out[ndx] = intBitsToFloat(res.exp); +# frexpStruct_out[ndx+1] = res.x; +# } +# +# return; +# } +# END + +SHADER compute comp_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %_arr_v3uint_uint_216 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_v3float_uint_432 ArrayStride 16 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_arr_v3float_uint_432_0 ArrayStride 16 + OpMemberDecorate %block2 0 Offset 0 + OpDecorate %block2 BufferBlock + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%frexpStructType = OpTypeStruct %v3float %v3int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v3float +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %uint_432 = OpConstant %uint 432 + %bool = OpTypeBool + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_216 = OpConstant %uint 216 +%_arr_v3uint_uint_216 = OpTypeArray %v3uint %uint_216 + %block0 = OpTypeStruct %_arr_v3uint_uint_216 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint +%_arr_v3float_uint_432 = OpTypeArray %v3float %uint_432 + %block1 = OpTypeStruct %_arr_v3float_uint_432 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %uint_1 = OpConstant %uint 1 +%_arr_v3float_uint_432_0 = OpTypeArray %v3float %uint_432 + %block2 = OpTypeStruct %_arr_v3float_uint_432_0 +%_ptr_Uniform_block2 = OpTypePointer Uniform %block2 + %__1 = OpVariable %_ptr_Uniform_block2 Uniform + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_v3uint Function + %in_float = OpVariable %_ptr_Function_v3float Function + %x_0 = OpVariable %_ptr_Function_v3float Function + %exp_0 = OpVariable %_ptr_Function_v3int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + OpStore %ndx %uint_0 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %uint %ndx + %41 = OpULessThan %bool %38 %uint_432 + OpBranchConditional %41 %34 %35 + %34 = OpLabel + %51 = OpLoad %uint %ndx + %53 = OpUDiv %uint %51 %uint_2 + %55 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %53 + %56 = OpLoad %v3uint %55 + OpStore %in_uint %56 + %58 = OpLoad %v3uint %in_uint + %59 = OpBitcast %v3float %58 + OpStore %in_float %59 + %61 = OpLoad %v3float %in_float + %63 = OpExtInst %v3float %1 Frexp %61 %exp_0 + OpStore %x_0 %63 + %66 = OpLoad %v3float %in_float + %67 = OpExtInst %frexpStructType %1 FrexpStruct %66 + OpStore %res_0 %67 + %72 = OpLoad %uint %ndx + %73 = OpLoad %v3int %exp_0 + %74 = OpBitcast %v3float %73 + %76 = OpAccessChain %_ptr_Uniform_v3float %__0 %int_0 %72 + OpStore %76 %74 + %77 = OpLoad %uint %ndx + %79 = OpIAdd %uint %77 %uint_1 + %80 = OpLoad %v3float %x_0 + %81 = OpAccessChain %_ptr_Uniform_v3float %__0 %int_0 %79 + OpStore %81 %80 + %86 = OpLoad %uint %ndx + %88 = OpAccessChain %_ptr_Function_v3int %res_0 %int_1 + %89 = OpLoad %v3int %88 + %90 = OpBitcast %v3float %89 + %91 = OpAccessChain %_ptr_Uniform_v3float %__1 %int_0 %86 + OpStore %91 %90 + %92 = OpLoad %uint %ndx + %93 = OpIAdd %uint %92 %uint_1 + %94 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0 + %95 = OpLoad %v3float %94 + %96 = OpAccessChain %_ptr_Uniform_v3float %__1 %int_0 %93 + OpStore %96 %95 + OpBranch %36 + %36 = OpLabel + %97 = OpLoad %uint %ndx + %98 = OpIAdd %uint %97 %uint_2 + OpStore %ndx %98 + OpBranch %33 + %35 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt + +BUFFER buf_frexp DATA_TYPE vec3 SIZE 432 FILL 0.0 +BUFFER buf_frexpStruct DATA_TYPE vec3 SIZE 432 FILL 1.0 + +PIPELINE compute test_pipeline + ATTACH comp_shader + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER buf_frexp AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER buf_frexpStruct AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN test_pipeline 1 1 1 + +EXPECT buf_frexp EQ_BUFFER buf_frexpStruct diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_frag.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_frag.amber new file mode 100644 index 0000000..d11db06 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_frag.amber @@ -0,0 +1,288 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A fragment shader test for FrexpStruct. + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec3 in_values[ndp]; +# }; +# +# layout (location = 0) flat in uint ndx_in; +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# struct frexpStructType +# { +# vec3 x; +# ivec3 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec3 orig) +# { +# vec3 x; +# ivec3 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# uvec3 in_uint = in_values[ndx_in]; +# vec3 in_float = uintBitsToFloat(in_uint); +# vec3 x; +# ivec3 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.rgb = x; +# frexp_exp_out.rgb = intBitsToFloat(exp); +# frexpStruct_x_out.rgb = res.x; +# frexpStruct_exp_out.rgb = intBitsToFloat(res.exp); +# +# return; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out + OpExecutionMode %main OriginUpperLeft + OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%frexpStructType = OpTypeStruct %v3float %v3int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v3float +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296 + %block0 = OpTypeStruct %_arr_v3uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %ndx_in = OpVariable %_ptr_Input_uint Input +%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %61 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v3uint Function + %in_float = OpVariable %_ptr_Function_v3float Function + %x_0 = OpVariable %_ptr_Function_v3float Function + %exp_0 = OpVariable %_ptr_Function_v3int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %41 = OpLoad %uint %ndx_in + %43 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %41 + %44 = OpLoad %v3uint %43 + OpStore %in_uint %44 + %46 = OpLoad %v3uint %in_uint + %47 = OpBitcast %v3float %46 + OpStore %in_float %47 + %49 = OpLoad %v3float %in_float + %51 = OpExtInst %v3float %1 Frexp %49 %exp_0 + OpStore %x_0 %51 + %54 = OpLoad %v3float %in_float + %55 = OpExtInst %frexpStructType %1 FrexpStruct %54 + OpStore %res_0 %55 + OpStore %frexp_x_out %61 + OpStore %frexp_exp_out %61 + OpStore %frexpStruct_x_out %61 + OpStore %frexpStruct_exp_out %61 + %65 = OpLoad %v3float %x_0 + %66 = OpLoad %v4float %frexp_x_out + %67 = OpVectorShuffle %v4float %66 %65 4 5 6 3 + OpStore %frexp_x_out %67 + %68 = OpLoad %v3int %exp_0 + %69 = OpBitcast %v3float %68 + %70 = OpLoad %v4float %frexp_exp_out + %71 = OpVectorShuffle %v4float %70 %69 4 5 6 3 + OpStore %frexp_exp_out %71 + %72 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0 + %73 = OpLoad %v3float %72 + %74 = OpLoad %v4float %frexpStruct_x_out + %75 = OpVectorShuffle %v4float %74 %73 4 5 6 3 + OpStore %frexpStruct_x_out %75 + %77 = OpAccessChain %_ptr_Function_v3int %res_0 %int_1 + %78 = OpLoad %v3int %77 + %79 = OpBitcast %v3float %78 + %80 = OpLoad %v4float %frexpStruct_exp_out + %81 = OpVectorShuffle %v4float %80 %79 4 5 6 3 + OpStore %frexpStruct_exp_out %81 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_geom.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_geom.amber new file mode 100644 index 0000000..2d7bec8 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_geom.amber @@ -0,0 +1,431 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A geometry shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE geometryShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER geometry geom_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec3 in_values[ndp]; +# }; +# +# layout (triangles) in; +# layout (triangle_strip, max_vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec3 frexp_x_out; +# layout (location = 1) flat out vec3 frexp_exp_out; +# layout (location = 2) flat out vec3 frexpStruct_x_out; +# layout (location = 3) flat out vec3 frexpStruct_exp_out; +# +# struct frexpStructType +# { +# vec3 x; +# ivec3 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec3 orig) +# { +# vec3 x; +# ivec3 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# for (int vertex = 0; vertex < 3; vertex++) +# { +# uvec3 in_uint = in_values[ndx_in[vertex]]; +# vec3 in_float = uintBitsToFloat(in_uint); +# vec3 x; +# ivec3 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = x; +# frexp_exp_out = intBitsToFloat(exp); +# frexpStruct_x_out = res.x; +# frexpStruct_exp_out = intBitsToFloat(res.exp); +# +# gl_Position = gl_in[vertex].gl_Position; +# EmitVertex(); +# } +# +# EndPrimitive(); +# } +# END + +SHADER geometry geom_shader SPIRV-ASM + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0 %gl_in + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%frexpStructType = OpTypeStruct %v3float %v3int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v3float +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296 + %block0 = OpTypeStruct %_arr_v3uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %uint_3 = OpConstant %uint 3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint +%_ptr_Output_v3float = OpTypePointer Output %v3float +%frexp_x_out = OpVariable %_ptr_Output_v3float Output +%frexp_exp_out = OpVariable %_ptr_Output_v3float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v3float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v3float Output + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3 +%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %vertex = OpVariable %_ptr_Function_int Function + %in_uint = OpVariable %_ptr_Function_v3uint Function + %in_float = OpVariable %_ptr_Function_v3float Function + %x_0 = OpVariable %_ptr_Function_v3float Function + %exp_0 = OpVariable %_ptr_Function_v3int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + OpStore %vertex %int_0 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %vertex + %40 = OpSLessThan %bool %37 %int_3 + OpBranchConditional %40 %33 %34 + %33 = OpLabel + %54 = OpLoad %int %vertex + %56 = OpAccessChain %_ptr_Input_uint %ndx_in %54 + %57 = OpLoad %uint %56 + %59 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %57 + %60 = OpLoad %v3uint %59 + OpStore %in_uint %60 + %62 = OpLoad %v3uint %in_uint + %63 = OpBitcast %v3float %62 + OpStore %in_float %63 + %65 = OpLoad %v3float %in_float + %67 = OpExtInst %v3float %1 Frexp %65 %exp_0 + OpStore %x_0 %67 + %70 = OpLoad %v3float %in_float + %71 = OpExtInst %frexpStructType %1 FrexpStruct %70 + OpStore %res_0 %71 + %74 = OpLoad %v3float %x_0 + OpStore %frexp_x_out %74 + %76 = OpLoad %v3int %exp_0 + %77 = OpBitcast %v3float %76 + OpStore %frexp_exp_out %77 + %79 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0 + %80 = OpLoad %v3float %79 + OpStore %frexpStruct_x_out %80 + %83 = OpAccessChain %_ptr_Function_v3int %res_0 %int_1 + %84 = OpLoad %v3int %83 + %85 = OpBitcast %v3float %84 + OpStore %frexpStruct_exp_out %85 + %96 = OpLoad %int %vertex + %98 = OpAccessChain %_ptr_Input_v4float %gl_in %96 %int_0 + %99 = OpLoad %v4float %98 + %101 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %101 %99 + OpEmitVertex + OpBranch %35 + %35 = OpLabel + %102 = OpLoad %int %vertex + %103 = OpIAdd %int %102 %int_1 + OpStore %vertex %103 + OpBranch %32 + %34 = OpLabel + OpEndPrimitive + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec3 frexp_x_in; +# layout (location = 1) flat in vec3 frexp_exp_in; +# layout (location = 2) flat in vec3 frexpStruct_x_in; +# layout (location = 3) flat in vec3 frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.rgb = frexp_x_in; +# frexp_exp_out.rgb = frexp_exp_in; +# frexpStruct_x_out.rgb = frexpStruct_x_in; +# frexpStruct_exp_out.rgb = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %frexp_x_in = OpVariable %_ptr_Input_v3float Input +%frexp_exp_in = OpVariable %_ptr_Input_v3float Input +%frexpStruct_x_in = OpVariable %_ptr_Input_v3float Input +%frexpStruct_exp_in = OpVariable %_ptr_Input_v3float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %frexp_x_out %12 + OpStore %frexp_exp_out %12 + OpStore %frexpStruct_x_out %12 + OpStore %frexpStruct_exp_out %12 + %19 = OpLoad %v3float %frexp_x_in + %20 = OpLoad %v4float %frexp_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 6 3 + OpStore %frexp_x_out %21 + %23 = OpLoad %v3float %frexp_exp_in + %24 = OpLoad %v4float %frexp_exp_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 6 3 + OpStore %frexp_exp_out %25 + %27 = OpLoad %v3float %frexpStruct_x_in + %28 = OpLoad %v4float %frexpStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 6 3 + OpStore %frexpStruct_x_out %29 + %31 = OpLoad %v3float %frexpStruct_exp_in + %32 = OpLoad %v4float %frexpStruct_exp_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 6 3 + OpStore %frexpStruct_exp_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH geom_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_tesc.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_tesc.amber new file mode 100644 index 0000000..d8cc50e --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_tesc.amber @@ -0,0 +1,587 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation control shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec3 frexp_x_out[]; +# layout (location = 1) flat out vec3 frexp_exp_out[]; +# layout (location = 2) flat out vec3 frexpStruct_x_out[]; +# layout (location = 3) flat out vec3 frexpStruct_exp_out[]; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec3 in_values[ndp]; +# }; +# +# struct frexpStructType +# { +# vec3 x; +# ivec3 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec3 orig) +# { +# vec3 x; +# ivec3 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# uvec3 in_uint = in_values[ndx_in[gl_InvocationID]]; +# vec3 in_float = uintBitsToFloat(in_uint); +# vec3 x; +# ivec3 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out[gl_InvocationID] = x; +# frexp_exp_out[gl_InvocationID] = intBitsToFloat(exp); +# frexpStruct_x_out[gl_InvocationID] = res.x; +# frexpStruct_exp_out[gl_InvocationID] = intBitsToFloat(res.exp); +# +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%frexpStructType = OpTypeStruct %v3float %v3int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v3float +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296 + %block0 = OpTypeStruct %_arr_v3uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 + %uint_32 = OpConstant %uint 32 +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint + %uint_3 = OpConstant %uint 3 +%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3 +%_ptr_Output__arr_v3float_uint_3 = OpTypePointer Output %_arr_v3float_uint_3 +%frexp_x_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output +%_ptr_Output_v3float = OpTypePointer Output %v3float +%frexp_exp_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output +%frexpStruct_x_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output +%frexpStruct_exp_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v3uint Function + %in_float = OpVariable %_ptr_Function_v3float Function + %x_0 = OpVariable %_ptr_Function_v3float Function + %exp_0 = OpVariable %_ptr_Function_v3int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %45 = OpLoad %int %gl_InvocationID + %47 = OpAccessChain %_ptr_Input_uint %ndx_in %45 + %48 = OpLoad %uint %47 + %50 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %48 + %51 = OpLoad %v3uint %50 + OpStore %in_uint %51 + %53 = OpLoad %v3uint %in_uint + %54 = OpBitcast %v3float %53 + OpStore %in_float %54 + %56 = OpLoad %v3float %in_float + %58 = OpExtInst %v3float %1 Frexp %56 %exp_0 + OpStore %x_0 %58 + %61 = OpLoad %v3float %in_float + %62 = OpExtInst %frexpStructType %1 FrexpStruct %61 + OpStore %res_0 %62 + %67 = OpLoad %int %gl_InvocationID + %68 = OpLoad %v3float %x_0 + %70 = OpAccessChain %_ptr_Output_v3float %frexp_x_out %67 + OpStore %70 %68 + %72 = OpLoad %int %gl_InvocationID + %73 = OpLoad %v3int %exp_0 + %74 = OpBitcast %v3float %73 + %75 = OpAccessChain %_ptr_Output_v3float %frexp_exp_out %72 + OpStore %75 %74 + %77 = OpLoad %int %gl_InvocationID + %78 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0 + %79 = OpLoad %v3float %78 + %80 = OpAccessChain %_ptr_Output_v3float %frexpStruct_x_out %77 + OpStore %80 %79 + %82 = OpLoad %int %gl_InvocationID + %84 = OpAccessChain %_ptr_Function_v3int %res_0 %int_1 + %85 = OpLoad %v3int %84 + %86 = OpBitcast %v3float %85 + %87 = OpAccessChain %_ptr_Output_v3float %frexpStruct_exp_out %82 + OpStore %87 %86 + %94 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %94 %float_1 + %95 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %95 %float_1 + %100 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %100 %float_1 + %101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %101 %float_1 + %103 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %103 %float_1 + %105 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %105 %float_1 + %113 = OpLoad %int %gl_InvocationID + %118 = OpLoad %int %gl_InvocationID + %120 = OpAccessChain %_ptr_Input_v4float %gl_in %118 %int_0 + %121 = OpLoad %v4float %120 + %123 = OpAccessChain %_ptr_Output_v4float %gl_out %113 %int_0 + OpStore %123 %121 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# layout (triangles) in; +# +# layout (location = 0) flat in vec3 frexp_x_in[]; +# layout (location = 1) flat in vec3 frexp_exp_in[]; +# layout (location = 2) flat in vec3 frexpStruct_x_in[]; +# layout (location = 3) flat in vec3 frexpStruct_exp_in[]; +# +# layout (location = 0) flat out vec3 frexp_x_out; +# layout (location = 1) flat out vec3 frexp_exp_out; +# layout (location = 2) flat out vec3 frexpStruct_x_out; +# layout (location = 3) flat out vec3 frexpStruct_exp_out; +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# frexp_x_out = frexp_x_in[0]; +# frexp_exp_out = frexp_exp_in[0]; +# frexpStruct_x_out = frexpStruct_x_in[0]; +# frexpStruct_exp_out = frexpStruct_exp_in[0]; +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output_v3float = OpTypePointer Output %v3float +%frexp_x_out = OpVariable %_ptr_Output_v3float Output +%_arr_v3float_uint_32 = OpTypeArray %v3float %uint_32 +%_ptr_Input__arr_v3float_uint_32 = OpTypePointer Input %_arr_v3float_uint_32 + %frexp_x_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input +%frexp_exp_out = OpVariable %_ptr_Output_v3float Output +%frexp_exp_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input +%frexpStruct_x_out = OpVariable %_ptr_Output_v3float Output +%frexpStruct_x_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input +%frexpStruct_exp_out = OpVariable %_ptr_Output_v3float Output +%frexpStruct_exp_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input + %main = OpFunction %void None %3 + %5 = OpLabel + %21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %22 = OpLoad %float %21 + %29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %30 = OpLoad %v4float %29 + %31 = OpVectorTimesScalar %v4float %30 %22 + %32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %36 = OpLoad %v4float %35 + %37 = OpVectorTimesScalar %v4float %36 %33 + %38 = OpFAdd %v4float %31 %37 + %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %44 = OpLoad %v4float %43 + %45 = OpVectorTimesScalar %v4float %44 %41 + %46 = OpFAdd %v4float %38 %45 + %48 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %48 %46 + %54 = OpAccessChain %_ptr_Input_v3float %frexp_x_in %int_0 + %55 = OpLoad %v3float %54 + OpStore %frexp_x_out %55 + %58 = OpAccessChain %_ptr_Input_v3float %frexp_exp_in %int_0 + %59 = OpLoad %v3float %58 + OpStore %frexp_exp_out %59 + %62 = OpAccessChain %_ptr_Input_v3float %frexpStruct_x_in %int_0 + %63 = OpLoad %v3float %62 + OpStore %frexpStruct_x_out %63 + %66 = OpAccessChain %_ptr_Input_v3float %frexpStruct_exp_in %int_0 + %67 = OpLoad %v3float %66 + OpStore %frexpStruct_exp_out %67 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec3 frexp_x_in; +# layout (location = 1) flat in vec3 frexp_exp_in; +# layout (location = 2) flat in vec3 frexpStruct_x_in; +# layout (location = 3) flat in vec3 frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.rgb = frexp_x_in; +# frexp_exp_out.rgb = frexp_exp_in; +# frexpStruct_x_out.rgb = frexpStruct_x_in; +# frexpStruct_exp_out.rgb = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %frexp_x_in = OpVariable %_ptr_Input_v3float Input +%frexp_exp_in = OpVariable %_ptr_Input_v3float Input +%frexpStruct_x_in = OpVariable %_ptr_Input_v3float Input +%frexpStruct_exp_in = OpVariable %_ptr_Input_v3float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %frexp_x_out %12 + OpStore %frexp_exp_out %12 + OpStore %frexpStruct_x_out %12 + OpStore %frexpStruct_exp_out %12 + %19 = OpLoad %v3float %frexp_x_in + %20 = OpLoad %v4float %frexp_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 6 3 + OpStore %frexp_x_out %21 + %23 = OpLoad %v3float %frexp_exp_in + %24 = OpLoad %v4float %frexp_exp_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 6 3 + OpStore %frexp_exp_out %25 + %27 = OpLoad %v3float %frexpStruct_x_in + %28 = OpLoad %v4float %frexpStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 6 3 + OpStore %frexpStruct_x_out %29 + %31 = OpLoad %v3float %frexpStruct_exp_in + %32 = OpLoad %v4float %frexpStruct_exp_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 6 3 + OpStore %frexpStruct_exp_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_tese.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_tese.amber new file mode 100644 index 0000000..3befa8c --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_tese.amber @@ -0,0 +1,541 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation evaluation shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out uint ndx_out[]; +# +# void main () +# { +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID]; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3 + %ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output_uint = OpTypePointer Output %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %16 %float_1 + %18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %18 %float_1 + %23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %23 %float_1 + %24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %24 %float_1 + %26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %26 %float_1 + %28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %28 %float_1 + %39 = OpLoad %int %gl_InvocationID + %47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0 + %48 = OpLoad %v4float %47 + %50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0 + OpStore %50 %48 + %60 = OpAccessChain %_ptr_Input_uint %ndx_in %39 + %61 = OpLoad %uint %60 + %63 = OpAccessChain %_ptr_Output_uint %ndx_out %39 + OpStore %63 %61 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (triangles) in; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec3 frexp_x_out; +# layout (location = 1) flat out vec3 frexp_exp_out; +# layout (location = 2) flat out vec3 frexpStruct_x_out; +# layout (location = 3) flat out vec3 frexpStruct_exp_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec3 in_values[ndp]; +# }; +# +# struct frexpStructType +# { +# vec3 x; +# ivec3 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec3 orig) +# { +# vec3 x; +# ivec3 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# uvec3 in_uint = in_values[ndx_in[0]]; +# vec3 in_float = uintBitsToFloat(in_uint); +# vec3 x; +# ivec3 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = x; +# frexp_exp_out = intBitsToFloat(exp); +# frexpStruct_x_out = res.x; +# frexpStruct_exp_out = intBitsToFloat(res.exp); +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%frexpStructType = OpTypeStruct %v3float %v3int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v3float +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int_0 = OpConstant %int 0 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296 + %block0 = OpTypeStruct %_arr_v3uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %__0 = OpVariable %_ptr_Uniform_block0 Uniform +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint +%_ptr_Output_v3float = OpTypePointer Output %v3float +%frexp_x_out = OpVariable %_ptr_Output_v3float Output +%frexp_exp_out = OpVariable %_ptr_Output_v3float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v3float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v3float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v3uint Function + %in_float = OpVariable %_ptr_Function_v3float Function + %x_0 = OpVariable %_ptr_Function_v3float Function + %exp_0 = OpVariable %_ptr_Function_v3int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %41 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %42 = OpLoad %float %41 + %49 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %50 = OpLoad %v4float %49 + %51 = OpVectorTimesScalar %v4float %50 %42 + %52 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %53 = OpLoad %float %52 + %55 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %56 = OpLoad %v4float %55 + %57 = OpVectorTimesScalar %v4float %56 %53 + %58 = OpFAdd %v4float %51 %57 + %60 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %61 = OpLoad %float %60 + %63 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %64 = OpLoad %v4float %63 + %65 = OpVectorTimesScalar %v4float %64 %61 + %66 = OpFAdd %v4float %58 %65 + %68 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %68 %66 + %81 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0 + %82 = OpLoad %uint %81 + %84 = OpAccessChain %_ptr_Uniform_v3uint %__0 %int_0 %82 + %85 = OpLoad %v3uint %84 + OpStore %in_uint %85 + %87 = OpLoad %v3uint %in_uint + %88 = OpBitcast %v3float %87 + OpStore %in_float %88 + %90 = OpLoad %v3float %in_float + %92 = OpExtInst %v3float %1 Frexp %90 %exp_0 + OpStore %x_0 %92 + %95 = OpLoad %v3float %in_float + %96 = OpExtInst %frexpStructType %1 FrexpStruct %95 + OpStore %res_0 %96 + %99 = OpLoad %v3float %x_0 + OpStore %frexp_x_out %99 + %101 = OpLoad %v3int %exp_0 + %102 = OpBitcast %v3float %101 + OpStore %frexp_exp_out %102 + %104 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0 + %105 = OpLoad %v3float %104 + OpStore %frexpStruct_x_out %105 + %107 = OpAccessChain %_ptr_Function_v3int %res_0 %int_1 + %108 = OpLoad %v3int %107 + %109 = OpBitcast %v3float %108 + OpStore %frexpStruct_exp_out %109 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec3 frexp_x_in; +# layout (location = 1) flat in vec3 frexp_exp_in; +# layout (location = 2) flat in vec3 frexpStruct_x_in; +# layout (location = 3) flat in vec3 frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.rgb = frexp_x_in; +# frexp_exp_out.rgb = frexp_exp_in; +# frexpStruct_x_out.rgb = frexpStruct_x_in; +# frexpStruct_exp_out.rgb = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %frexp_x_in = OpVariable %_ptr_Input_v3float Input +%frexp_exp_in = OpVariable %_ptr_Input_v3float Input +%frexpStruct_x_in = OpVariable %_ptr_Input_v3float Input +%frexpStruct_exp_in = OpVariable %_ptr_Input_v3float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %frexp_x_out %12 + OpStore %frexp_exp_out %12 + OpStore %frexpStruct_x_out %12 + OpStore %frexpStruct_exp_out %12 + %19 = OpLoad %v3float %frexp_x_in + %20 = OpLoad %v4float %frexp_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 6 3 + OpStore %frexp_x_out %21 + %23 = OpLoad %v3float %frexp_exp_in + %24 = OpLoad %v4float %frexp_exp_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 6 3 + OpStore %frexp_exp_out %25 + %27 = OpLoad %v3float %frexpStruct_x_in + %28 = OpLoad %v4float %frexpStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 6 3 + OpStore %frexpStruct_x_out %29 + %31 = OpLoad %v3float %frexpStruct_exp_in + %32 = OpLoad %v4float %frexpStruct_exp_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 6 3 + OpStore %frexpStruct_exp_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_vert.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_vert.amber new file mode 100644 index 0000000..dad818d --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_3_vert.amber @@ -0,0 +1,336 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A vertex shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out vec3 frexp_x_out; +# layout (location = 1) flat out vec3 frexp_exp_out; +# layout (location = 2) flat out vec3 frexpStruct_x_out; +# layout (location = 3) flat out vec3 frexpStruct_exp_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec3 in_values[ndp]; +# }; +# +# struct frexpStructType +# { +# vec3 x; +# ivec3 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec3 orig) +# { +# vec3 x; +# ivec3 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# uint ndx = xcoord + ycoord * ndpSqrt; +# +# uvec3 in_uint = in_values[ndx]; +# vec3 in_float = uintBitsToFloat(in_uint); +# vec3 x; +# ivec3 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = x; +# frexp_exp_out = intBitsToFloat(exp); +# frexpStruct_x_out = res.x; +# frexpStruct_exp_out = intBitsToFloat(res.exp); +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0 + OpDecorate %position Location 0 + OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%frexpStructType = OpTypeStruct %v3float %v3int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v3float +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float_36 = OpConstant %float 36 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0_027777778 = OpConstant %float 0.027777778 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %uint_1 = OpConstant %uint 1 + %uint_36 = OpConstant %uint 36 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296 + %block0 = OpTypeStruct %_arr_v3uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint +%_ptr_Output_v3float = OpTypePointer Output %v3float +%frexp_x_out = OpVariable %_ptr_Output_v3float Output +%frexp_exp_out = OpVariable %_ptr_Output_v3float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v3float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v3float Output + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %xcoord = OpVariable %_ptr_Function_uint Function + %ycoord = OpVariable %_ptr_Function_uint Function + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_v3uint Function + %in_float = OpVariable %_ptr_Function_v3float Function + %x_0 = OpVariable %_ptr_Function_v3float Function + %exp_0 = OpVariable %_ptr_Function_v3int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %38 = OpAccessChain %_ptr_Input_float %position %uint_0 + %39 = OpLoad %float %38 + %41 = OpFAdd %float %39 %float_0_027777778 + %43 = OpFAdd %float %41 %float_1 + %45 = OpFDiv %float %43 %float_2 + %46 = OpFMul %float %float_36 %45 + %47 = OpFSub %float %46 %float_1 + %48 = OpConvertFToU %uint %47 + OpStore %xcoord %48 + %51 = OpAccessChain %_ptr_Input_float %position %uint_1 + %52 = OpLoad %float %51 + %53 = OpFAdd %float %52 %float_0_027777778 + %54 = OpFAdd %float %53 %float_1 + %55 = OpFDiv %float %54 %float_2 + %56 = OpFMul %float %float_36 %55 + %57 = OpFSub %float %56 %float_1 + %58 = OpConvertFToU %uint %57 + OpStore %ycoord %58 + %60 = OpLoad %uint %xcoord + %61 = OpLoad %uint %ycoord + %63 = OpIMul %uint %61 %uint_36 + %64 = OpIAdd %uint %60 %63 + OpStore %ndx %64 + %74 = OpLoad %uint %ndx + %76 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %74 + %77 = OpLoad %v3uint %76 + OpStore %in_uint %77 + %79 = OpLoad %v3uint %in_uint + %80 = OpBitcast %v3float %79 + OpStore %in_float %80 + %82 = OpLoad %v3float %in_float + %84 = OpExtInst %v3float %1 Frexp %82 %exp_0 + OpStore %x_0 %84 + %87 = OpLoad %v3float %in_float + %88 = OpExtInst %frexpStructType %1 FrexpStruct %87 + OpStore %res_0 %88 + %91 = OpLoad %v3float %x_0 + OpStore %frexp_x_out %91 + %93 = OpLoad %v3int %exp_0 + %94 = OpBitcast %v3float %93 + OpStore %frexp_exp_out %94 + %96 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0 + %97 = OpLoad %v3float %96 + OpStore %frexpStruct_x_out %97 + %100 = OpAccessChain %_ptr_Function_v3int %res_0 %int_1 + %101 = OpLoad %v3int %100 + %102 = OpBitcast %v3float %101 + OpStore %frexpStruct_exp_out %102 + %108 = OpLoad %v2float %position + %110 = OpCompositeExtract %float %108 0 + %111 = OpCompositeExtract %float %108 1 + %112 = OpCompositeConstruct %v4float %110 %111 %float_0 %float_1 + %114 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %114 %112 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec3 frexp_x_in; +# layout (location = 1) flat in vec3 frexp_exp_in; +# layout (location = 2) flat in vec3 frexpStruct_x_in; +# layout (location = 3) flat in vec3 frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# frexp_x_out = clear_value; +# frexp_exp_out = clear_value; +# frexpStruct_x_out = clear_value; +# frexpStruct_exp_out = clear_value; +# frexp_x_out.rgb = frexp_x_in; +# frexp_exp_out.rgb = frexp_exp_in; +# frexpStruct_x_out.rgb = frexpStruct_x_in; +# frexpStruct_exp_out.rgb = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %frexp_x_in = OpVariable %_ptr_Input_v3float Input +%frexp_exp_in = OpVariable %_ptr_Input_v3float Input +%frexpStruct_x_in = OpVariable %_ptr_Input_v3float Input +%frexpStruct_exp_in = OpVariable %_ptr_Input_v3float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %frexp_x_out %12 + OpStore %frexp_exp_out %12 + OpStore %frexpStruct_x_out %12 + OpStore %frexpStruct_exp_out %12 + %19 = OpLoad %v3float %frexp_x_in + %20 = OpLoad %v4float %frexp_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 6 3 + OpStore %frexp_x_out %21 + %23 = OpLoad %v3float %frexp_exp_in + %24 = OpLoad %v4float %frexp_exp_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 6 3 + OpStore %frexp_exp_out %25 + %27 = OpLoad %v3float %frexpStruct_x_in + %28 = OpLoad %v4float %frexpStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 6 3 + OpStore %frexpStruct_x_out %29 + %31 = OpLoad %v3float %frexpStruct_exp_in + %32 = OpLoad %v4float %frexpStruct_exp_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 6 3 + OpStore %frexpStruct_exp_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_comp.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_comp.amber new file mode 100644 index 0000000..a41dee0 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_comp.amber @@ -0,0 +1,215 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A compute shader test for FrexpStruct. + +# SHADER compute comp_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296 / 4; +# const uint half_ndp = ndp / 2; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec4 in_values[half_ndp]; +# }; +# +# layout(set = 0, binding = 1) buffer block1 { +# vec4 frexp_out[ndp]; +# }; +# +# layout(set = 0, binding = 2) buffer block2 { +# vec4 frexpStruct_out[ndp]; +# }; +# +# struct frexpStructType +# { +# vec4 x; +# ivec4 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec4 orig) +# { +# vec4 x; +# ivec4 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# for (uint ndx = 0; ndx < ndp; ndx += 2) +# { +# uvec4 in_uint = in_values[ndx/2]; +# vec4 in_float = uintBitsToFloat(in_uint); +# vec4 x; +# ivec4 exp; +# +# x = frexp(in_float, exp); +# frexpStructType res = frexpStruct(in_float); +# +# frexp_out[ndx] = intBitsToFloat(exp); +# frexp_out[ndx+1] = x; +# frexpStruct_out[ndx] = intBitsToFloat(res.exp); +# frexpStruct_out[ndx+1] = res.x; +# } +# +# return; +# } +# END + +SHADER compute comp_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %_arr_v4uint_uint_162 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_v4float_uint_324 ArrayStride 16 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_arr_v4float_uint_324_0 ArrayStride 16 + OpMemberDecorate %block2 0 Offset 0 + OpDecorate %block2 BufferBlock + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%frexpStructType = OpTypeStruct %v4float %v4int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v4float +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %uint_324 = OpConstant %uint 324 + %bool = OpTypeBool + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_162 = OpConstant %uint 162 +%_arr_v4uint_uint_162 = OpTypeArray %v4uint %uint_162 + %block0 = OpTypeStruct %_arr_v4uint_uint_162 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint +%_arr_v4float_uint_324 = OpTypeArray %v4float %uint_324 + %block1 = OpTypeStruct %_arr_v4float_uint_324 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %uint_1 = OpConstant %uint 1 +%_arr_v4float_uint_324_0 = OpTypeArray %v4float %uint_324 + %block2 = OpTypeStruct %_arr_v4float_uint_324_0 +%_ptr_Uniform_block2 = OpTypePointer Uniform %block2 + %__1 = OpVariable %_ptr_Uniform_block2 Uniform + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_v4uint Function + %in_float = OpVariable %_ptr_Function_v4float Function + %x_0 = OpVariable %_ptr_Function_v4float Function + %exp_0 = OpVariable %_ptr_Function_v4int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + OpStore %ndx %uint_0 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %uint %ndx + %41 = OpULessThan %bool %38 %uint_324 + OpBranchConditional %41 %34 %35 + %34 = OpLabel + %51 = OpLoad %uint %ndx + %53 = OpUDiv %uint %51 %uint_2 + %55 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %53 + %56 = OpLoad %v4uint %55 + OpStore %in_uint %56 + %58 = OpLoad %v4uint %in_uint + %59 = OpBitcast %v4float %58 + OpStore %in_float %59 + %61 = OpLoad %v4float %in_float + %63 = OpExtInst %v4float %1 Frexp %61 %exp_0 + OpStore %x_0 %63 + %66 = OpLoad %v4float %in_float + %67 = OpExtInst %frexpStructType %1 FrexpStruct %66 + OpStore %res_0 %67 + %72 = OpLoad %uint %ndx + %73 = OpLoad %v4int %exp_0 + %74 = OpBitcast %v4float %73 + %76 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %72 + OpStore %76 %74 + %77 = OpLoad %uint %ndx + %79 = OpIAdd %uint %77 %uint_1 + %80 = OpLoad %v4float %x_0 + %81 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %79 + OpStore %81 %80 + %86 = OpLoad %uint %ndx + %88 = OpAccessChain %_ptr_Function_v4int %res_0 %int_1 + %89 = OpLoad %v4int %88 + %90 = OpBitcast %v4float %89 + %91 = OpAccessChain %_ptr_Uniform_v4float %__1 %int_0 %86 + OpStore %91 %90 + %92 = OpLoad %uint %ndx + %93 = OpIAdd %uint %92 %uint_1 + %94 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0 + %95 = OpLoad %v4float %94 + %96 = OpAccessChain %_ptr_Uniform_v4float %__1 %int_0 %93 + OpStore %96 %95 + OpBranch %36 + %36 = OpLabel + %97 = OpLoad %uint %ndx + %98 = OpIAdd %uint %97 %uint_2 + OpStore %ndx %98 + OpBranch %33 + %35 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt + +BUFFER buf_frexp DATA_TYPE vec4 SIZE 324 FILL 0.0 +BUFFER buf_frexpStruct DATA_TYPE vec4 SIZE 324 FILL 1.0 + +PIPELINE compute test_pipeline + ATTACH comp_shader + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER buf_frexp AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER buf_frexpStruct AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN test_pipeline 1 1 1 + +EXPECT buf_frexp EQ_BUFFER buf_frexpStruct diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_frag.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_frag.amber new file mode 100644 index 0000000..d75a75f --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_frag.amber @@ -0,0 +1,267 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A fragment shader test for FrexpStruct. + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec4 in_values[ndp]; +# }; +# +# layout (location = 0) flat in uint ndx_in; +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# struct frexpStructType +# { +# vec4 x; +# ivec4 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec4 orig) +# { +# vec4 x; +# ivec4 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# uvec4 in_uint = in_values[ndx_in]; +# vec4 in_float = uintBitsToFloat(in_uint); +# vec4 x; +# ivec4 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out.rgba = x; +# frexp_exp_out.rgba = intBitsToFloat(exp); +# frexpStruct_x_out.rgba = res.x; +# frexpStruct_exp_out.rgba = intBitsToFloat(res.exp); +# +# return; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out + OpExecutionMode %main OriginUpperLeft + OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%frexpStructType = OpTypeStruct %v4float %v4int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v4float +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296 + %block0 = OpTypeStruct %_arr_v4uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %ndx_in = OpVariable %_ptr_Input_uint Input +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v4uint Function + %in_float = OpVariable %_ptr_Function_v4float Function + %x_0 = OpVariable %_ptr_Function_v4float Function + %exp_0 = OpVariable %_ptr_Function_v4int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %41 = OpLoad %uint %ndx_in + %43 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %41 + %44 = OpLoad %v4uint %43 + OpStore %in_uint %44 + %46 = OpLoad %v4uint %in_uint + %47 = OpBitcast %v4float %46 + OpStore %in_float %47 + %49 = OpLoad %v4float %in_float + %51 = OpExtInst %v4float %1 Frexp %49 %exp_0 + OpStore %x_0 %51 + %54 = OpLoad %v4float %in_float + %55 = OpExtInst %frexpStructType %1 FrexpStruct %54 + OpStore %res_0 %55 + %58 = OpLoad %v4float %x_0 + OpStore %frexp_x_out %58 + %60 = OpLoad %v4int %exp_0 + %61 = OpBitcast %v4float %60 + OpStore %frexp_exp_out %61 + %63 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0 + %64 = OpLoad %v4float %63 + OpStore %frexpStruct_x_out %64 + %67 = OpAccessChain %_ptr_Function_v4int %res_0 %int_1 + %68 = OpLoad %v4int %67 + %69 = OpBitcast %v4float %68 + OpStore %frexpStruct_exp_out %69 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_geom.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_geom.amber new file mode 100644 index 0000000..98453b0 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_geom.amber @@ -0,0 +1,408 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A geometry shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE geometryShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER geometry geom_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec4 in_values[ndp]; +# }; +# +# layout (triangles) in; +# layout (triangle_strip, max_vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec4 frexp_x_out; +# layout (location = 1) flat out vec4 frexp_exp_out; +# layout (location = 2) flat out vec4 frexpStruct_x_out; +# layout (location = 3) flat out vec4 frexpStruct_exp_out; +# +# struct frexpStructType +# { +# vec4 x; +# ivec4 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec4 orig) +# { +# vec4 x; +# ivec4 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# for (int vertex = 0; vertex < 3; vertex++) +# { +# uvec4 in_uint = in_values[ndx_in[vertex]]; +# vec4 in_float = uintBitsToFloat(in_uint); +# vec4 x; +# ivec4 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = x; +# frexp_exp_out = intBitsToFloat(exp); +# frexpStruct_x_out = res.x; +# frexpStruct_exp_out = intBitsToFloat(res.exp); +# +# gl_Position = gl_in[vertex].gl_Position; +# EmitVertex(); +# } +# +# EndPrimitive(); +# } +# END + +SHADER geometry geom_shader SPIRV-ASM + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0 %gl_in + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%frexpStructType = OpTypeStruct %v4float %v4int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v4float +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296 + %block0 = OpTypeStruct %_arr_v4uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %uint_3 = OpConstant %uint 3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3 +%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %vertex = OpVariable %_ptr_Function_int Function + %in_uint = OpVariable %_ptr_Function_v4uint Function + %in_float = OpVariable %_ptr_Function_v4float Function + %x_0 = OpVariable %_ptr_Function_v4float Function + %exp_0 = OpVariable %_ptr_Function_v4int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + OpStore %vertex %int_0 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %vertex + %40 = OpSLessThan %bool %37 %int_3 + OpBranchConditional %40 %33 %34 + %33 = OpLabel + %54 = OpLoad %int %vertex + %56 = OpAccessChain %_ptr_Input_uint %ndx_in %54 + %57 = OpLoad %uint %56 + %59 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %57 + %60 = OpLoad %v4uint %59 + OpStore %in_uint %60 + %62 = OpLoad %v4uint %in_uint + %63 = OpBitcast %v4float %62 + OpStore %in_float %63 + %65 = OpLoad %v4float %in_float + %67 = OpExtInst %v4float %1 Frexp %65 %exp_0 + OpStore %x_0 %67 + %70 = OpLoad %v4float %in_float + %71 = OpExtInst %frexpStructType %1 FrexpStruct %70 + OpStore %res_0 %71 + %74 = OpLoad %v4float %x_0 + OpStore %frexp_x_out %74 + %76 = OpLoad %v4int %exp_0 + %77 = OpBitcast %v4float %76 + OpStore %frexp_exp_out %77 + %79 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0 + %80 = OpLoad %v4float %79 + OpStore %frexpStruct_x_out %80 + %83 = OpAccessChain %_ptr_Function_v4int %res_0 %int_1 + %84 = OpLoad %v4int %83 + %85 = OpBitcast %v4float %84 + OpStore %frexpStruct_exp_out %85 + %95 = OpLoad %int %vertex + %97 = OpAccessChain %_ptr_Input_v4float %gl_in %95 %int_0 + %98 = OpLoad %v4float %97 + %99 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %99 %98 + OpEmitVertex + OpBranch %35 + %35 = OpLabel + %100 = OpLoad %int %vertex + %101 = OpIAdd %int %100 %int_1 + OpStore %vertex %101 + OpBranch %32 + %34 = OpLabel + OpEndPrimitive + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec4 frexp_x_in; +# layout (location = 1) flat in vec4 frexp_exp_in; +# layout (location = 2) flat in vec4 frexpStruct_x_in; +# layout (location = 3) flat in vec4 frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# +# void main () +# { +# frexp_x_out.rgba = frexp_x_in; +# frexp_exp_out.rgba = frexp_exp_in; +# frexpStruct_x_out.rgba = frexpStruct_x_in; +# frexpStruct_exp_out.rgba = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %frexp_x_in = OpVariable %_ptr_Input_v4float Input +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexp_exp_in = OpVariable %_ptr_Input_v4float Input +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_in = OpVariable %_ptr_Input_v4float Input +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_in = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %v4float %frexp_x_in + OpStore %frexp_x_out %12 + %15 = OpLoad %v4float %frexp_exp_in + OpStore %frexp_exp_out %15 + %18 = OpLoad %v4float %frexpStruct_x_in + OpStore %frexpStruct_x_out %18 + %21 = OpLoad %v4float %frexpStruct_exp_in + OpStore %frexpStruct_exp_out %21 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH geom_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_tesc.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_tesc.amber new file mode 100644 index 0000000..4526adb --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_tesc.amber @@ -0,0 +1,563 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation control shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec4 frexp_x_out[]; +# layout (location = 1) flat out vec4 frexp_exp_out[]; +# layout (location = 2) flat out vec4 frexpStruct_x_out[]; +# layout (location = 3) flat out vec4 frexpStruct_exp_out[]; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec4 in_values[ndp]; +# }; +# +# struct frexpStructType +# { +# vec4 x; +# ivec4 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec4 orig) +# { +# vec4 x; +# ivec4 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# uvec4 in_uint = in_values[ndx_in[gl_InvocationID]]; +# vec4 in_float = uintBitsToFloat(in_uint); +# vec4 x; +# ivec4 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out[gl_InvocationID] = x; +# frexp_exp_out[gl_InvocationID] = intBitsToFloat(exp); +# frexpStruct_x_out[gl_InvocationID] = res.x; +# frexpStruct_exp_out[gl_InvocationID] = intBitsToFloat(res.exp); +# +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%frexpStructType = OpTypeStruct %v4float %v4int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v4float +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296 + %block0 = OpTypeStruct %_arr_v4uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 + %uint_32 = OpConstant %uint 32 +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint + %uint_3 = OpConstant %uint 3 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 +%frexp_x_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_exp_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%frexpStruct_x_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%frexpStruct_exp_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v4uint Function + %in_float = OpVariable %_ptr_Function_v4float Function + %x_0 = OpVariable %_ptr_Function_v4float Function + %exp_0 = OpVariable %_ptr_Function_v4int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %45 = OpLoad %int %gl_InvocationID + %47 = OpAccessChain %_ptr_Input_uint %ndx_in %45 + %48 = OpLoad %uint %47 + %50 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %48 + %51 = OpLoad %v4uint %50 + OpStore %in_uint %51 + %53 = OpLoad %v4uint %in_uint + %54 = OpBitcast %v4float %53 + OpStore %in_float %54 + %56 = OpLoad %v4float %in_float + %58 = OpExtInst %v4float %1 Frexp %56 %exp_0 + OpStore %x_0 %58 + %61 = OpLoad %v4float %in_float + %62 = OpExtInst %frexpStructType %1 FrexpStruct %61 + OpStore %res_0 %62 + %67 = OpLoad %int %gl_InvocationID + %68 = OpLoad %v4float %x_0 + %70 = OpAccessChain %_ptr_Output_v4float %frexp_x_out %67 + OpStore %70 %68 + %72 = OpLoad %int %gl_InvocationID + %73 = OpLoad %v4int %exp_0 + %74 = OpBitcast %v4float %73 + %75 = OpAccessChain %_ptr_Output_v4float %frexp_exp_out %72 + OpStore %75 %74 + %77 = OpLoad %int %gl_InvocationID + %78 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0 + %79 = OpLoad %v4float %78 + %80 = OpAccessChain %_ptr_Output_v4float %frexpStruct_x_out %77 + OpStore %80 %79 + %82 = OpLoad %int %gl_InvocationID + %84 = OpAccessChain %_ptr_Function_v4int %res_0 %int_1 + %85 = OpLoad %v4int %84 + %86 = OpBitcast %v4float %85 + %87 = OpAccessChain %_ptr_Output_v4float %frexpStruct_exp_out %82 + OpStore %87 %86 + %94 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %94 %float_1 + %95 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %95 %float_1 + %100 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %100 %float_1 + %101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %101 %float_1 + %103 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %103 %float_1 + %105 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %105 %float_1 + %112 = OpLoad %int %gl_InvocationID + %117 = OpLoad %int %gl_InvocationID + %119 = OpAccessChain %_ptr_Input_v4float %gl_in %117 %int_0 + %120 = OpLoad %v4float %119 + %121 = OpAccessChain %_ptr_Output_v4float %gl_out %112 %int_0 + OpStore %121 %120 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# layout (triangles) in; +# +# layout (location = 0) flat in vec4 frexp_x_in[]; +# layout (location = 1) flat in vec4 frexp_exp_in[]; +# layout (location = 2) flat in vec4 frexpStruct_x_in[]; +# layout (location = 3) flat in vec4 frexpStruct_exp_in[]; +# +# layout (location = 0) flat out vec4 frexp_x_out; +# layout (location = 1) flat out vec4 frexp_exp_out; +# layout (location = 2) flat out vec4 frexpStruct_x_out; +# layout (location = 3) flat out vec4 frexpStruct_exp_out; +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# frexp_x_out = frexp_x_in[0]; +# frexp_exp_out = frexp_exp_in[0]; +# frexpStruct_x_out = frexpStruct_x_in[0]; +# frexpStruct_exp_out = frexpStruct_exp_in[0]; +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output +%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32 +%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32 + %frexp_x_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexp_exp_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input + %main = OpFunction %void None %3 + %5 = OpLabel + %21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %22 = OpLoad %float %21 + %29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %30 = OpLoad %v4float %29 + %31 = OpVectorTimesScalar %v4float %30 %22 + %32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %36 = OpLoad %v4float %35 + %37 = OpVectorTimesScalar %v4float %36 %33 + %38 = OpFAdd %v4float %31 %37 + %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %44 = OpLoad %v4float %43 + %45 = OpVectorTimesScalar %v4float %44 %41 + %46 = OpFAdd %v4float %38 %45 + %48 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %48 %46 + %53 = OpAccessChain %_ptr_Input_v4float %frexp_x_in %int_0 + %54 = OpLoad %v4float %53 + OpStore %frexp_x_out %54 + %57 = OpAccessChain %_ptr_Input_v4float %frexp_exp_in %int_0 + %58 = OpLoad %v4float %57 + OpStore %frexp_exp_out %58 + %61 = OpAccessChain %_ptr_Input_v4float %frexpStruct_x_in %int_0 + %62 = OpLoad %v4float %61 + OpStore %frexpStruct_x_out %62 + %65 = OpAccessChain %_ptr_Input_v4float %frexpStruct_exp_in %int_0 + %66 = OpLoad %v4float %65 + OpStore %frexpStruct_exp_out %66 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec4 frexp_x_in; +# layout (location = 1) flat in vec4 frexp_exp_in; +# layout (location = 2) flat in vec4 frexpStruct_x_in; +# layout (location = 3) flat in vec4 frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# +# void main () +# { +# frexp_x_out.rgba = frexp_x_in; +# frexp_exp_out.rgba = frexp_exp_in; +# frexpStruct_x_out.rgba = frexpStruct_x_in; +# frexpStruct_exp_out.rgba = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %frexp_x_in = OpVariable %_ptr_Input_v4float Input +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexp_exp_in = OpVariable %_ptr_Input_v4float Input +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_in = OpVariable %_ptr_Input_v4float Input +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_in = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %v4float %frexp_x_in + OpStore %frexp_x_out %12 + %15 = OpLoad %v4float %frexp_exp_in + OpStore %frexp_exp_out %15 + %18 = OpLoad %v4float %frexpStruct_x_in + OpStore %frexpStruct_x_out %18 + %21 = OpLoad %v4float %frexpStruct_exp_in + OpStore %frexpStruct_exp_out %21 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_tese.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_tese.amber new file mode 100644 index 0000000..460df88 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_tese.amber @@ -0,0 +1,519 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation evaluation shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out uint ndx_out[]; +# +# void main () +# { +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID]; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3 + %ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output_uint = OpTypePointer Output %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %16 %float_1 + %18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %18 %float_1 + %23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %23 %float_1 + %24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %24 %float_1 + %26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %26 %float_1 + %28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %28 %float_1 + %39 = OpLoad %int %gl_InvocationID + %47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0 + %48 = OpLoad %v4float %47 + %50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0 + OpStore %50 %48 + %60 = OpAccessChain %_ptr_Input_uint %ndx_in %39 + %61 = OpLoad %uint %60 + %63 = OpAccessChain %_ptr_Output_uint %ndx_out %39 + OpStore %63 %61 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (triangles) in; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec4 frexp_x_out; +# layout (location = 1) flat out vec4 frexp_exp_out; +# layout (location = 2) flat out vec4 frexpStruct_x_out; +# layout (location = 3) flat out vec4 frexpStruct_exp_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec4 in_values[ndp]; +# }; +# +# struct frexpStructType +# { +# vec4 x; +# ivec4 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec4 orig) +# { +# vec4 x; +# ivec4 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# uvec4 in_uint = in_values[ndx_in[0]]; +# vec4 in_float = uintBitsToFloat(in_uint); +# vec4 x; +# ivec4 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = x; +# frexp_exp_out = intBitsToFloat(exp); +# frexpStruct_x_out = res.x; +# frexpStruct_exp_out = intBitsToFloat(res.exp); +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%frexpStructType = OpTypeStruct %v4float %v4int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v4float +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296 + %block0 = OpTypeStruct %_arr_v4uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %__0 = OpVariable %_ptr_Uniform_block0 Uniform +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint +%frexp_x_out = OpVariable %_ptr_Output_v4float Output +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v4uint Function + %in_float = OpVariable %_ptr_Function_v4float Function + %x_0 = OpVariable %_ptr_Function_v4float Function + %exp_0 = OpVariable %_ptr_Function_v4int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %41 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %42 = OpLoad %float %41 + %49 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %50 = OpLoad %v4float %49 + %51 = OpVectorTimesScalar %v4float %50 %42 + %52 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %53 = OpLoad %float %52 + %55 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %56 = OpLoad %v4float %55 + %57 = OpVectorTimesScalar %v4float %56 %53 + %58 = OpFAdd %v4float %51 %57 + %60 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %61 = OpLoad %float %60 + %63 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %64 = OpLoad %v4float %63 + %65 = OpVectorTimesScalar %v4float %64 %61 + %66 = OpFAdd %v4float %58 %65 + %68 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %68 %66 + %81 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0 + %82 = OpLoad %uint %81 + %84 = OpAccessChain %_ptr_Uniform_v4uint %__0 %int_0 %82 + %85 = OpLoad %v4uint %84 + OpStore %in_uint %85 + %87 = OpLoad %v4uint %in_uint + %88 = OpBitcast %v4float %87 + OpStore %in_float %88 + %90 = OpLoad %v4float %in_float + %92 = OpExtInst %v4float %1 Frexp %90 %exp_0 + OpStore %x_0 %92 + %95 = OpLoad %v4float %in_float + %96 = OpExtInst %frexpStructType %1 FrexpStruct %95 + OpStore %res_0 %96 + %98 = OpLoad %v4float %x_0 + OpStore %frexp_x_out %98 + %100 = OpLoad %v4int %exp_0 + %101 = OpBitcast %v4float %100 + OpStore %frexp_exp_out %101 + %103 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0 + %104 = OpLoad %v4float %103 + OpStore %frexpStruct_x_out %104 + %106 = OpAccessChain %_ptr_Function_v4int %res_0 %int_1 + %107 = OpLoad %v4int %106 + %108 = OpBitcast %v4float %107 + OpStore %frexpStruct_exp_out %108 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec4 frexp_x_in; +# layout (location = 1) flat in vec4 frexp_exp_in; +# layout (location = 2) flat in vec4 frexpStruct_x_in; +# layout (location = 3) flat in vec4 frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# +# void main () +# { +# frexp_x_out.rgba = frexp_x_in; +# frexp_exp_out.rgba = frexp_exp_in; +# frexpStruct_x_out.rgba = frexpStruct_x_in; +# frexpStruct_exp_out.rgba = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %frexp_x_in = OpVariable %_ptr_Input_v4float Input +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexp_exp_in = OpVariable %_ptr_Input_v4float Input +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_in = OpVariable %_ptr_Input_v4float Input +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_in = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %v4float %frexp_x_in + OpStore %frexp_x_out %12 + %15 = OpLoad %v4float %frexp_exp_in + OpStore %frexp_exp_out %15 + %18 = OpLoad %v4float %frexpStruct_x_in + OpStore %frexpStruct_x_out %18 + %21 = OpLoad %v4float %frexpStruct_exp_in + OpStore %frexpStruct_exp_out %21 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_vert.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_vert.amber new file mode 100644 index 0000000..63f209c --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/frexpstruct_4_vert.amber @@ -0,0 +1,313 @@ +#!amber + +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A vertex shader test for FrexpStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out vec4 frexp_x_out; +# layout (location = 1) flat out vec4 frexp_exp_out; +# layout (location = 2) flat out vec4 frexpStruct_x_out; +# layout (location = 3) flat out vec4 frexpStruct_exp_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec4 in_values[ndp]; +# }; +# +# struct frexpStructType +# { +# vec4 x; +# ivec4 exp; +# }; +# +# // Replaced with native function in SPIR-V. +# frexpStructType frexpStruct (vec4 orig) +# { +# vec4 x; +# ivec4 exp; +# x = frexp(orig, exp); +# frexpStructType res = { x, exp }; +# return res; +# } +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# uint ndx = xcoord + ycoord * ndpSqrt; +# +# uvec4 in_uint = in_values[ndx]; +# vec4 in_float = uintBitsToFloat(in_uint); +# vec4 x; +# ivec4 exp; +# frexpStructType res; +# +# x = frexp(in_float, exp); +# res = frexpStruct(in_float); +# +# frexp_x_out = x; +# frexp_exp_out = intBitsToFloat(exp); +# frexpStruct_x_out = res.x; +# frexpStruct_exp_out = intBitsToFloat(res.exp); +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0 + OpDecorate %position Location 0 + OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %frexp_x_out Flat + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_exp_out Flat + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexpStruct_x_out Flat + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_exp_out Flat + OpDecorate %frexpStruct_exp_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%frexpStructType = OpTypeStruct %v4float %v4int + %12 = OpTypeFunction %frexpStructType %_ptr_Function_v4float +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float_36 = OpConstant %float 36 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0_027777778 = OpConstant %float 0.027777778 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %uint_1 = OpConstant %uint 1 + %uint_36 = OpConstant %uint 36 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296 + %block0 = OpTypeStruct %_arr_v4uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output + %float_0 = OpConstant %float 0 + %main = OpFunction %void None %3 + %5 = OpLabel + %xcoord = OpVariable %_ptr_Function_uint Function + %ycoord = OpVariable %_ptr_Function_uint Function + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_v4uint Function + %in_float = OpVariable %_ptr_Function_v4float Function + %x_0 = OpVariable %_ptr_Function_v4float Function + %exp_0 = OpVariable %_ptr_Function_v4int Function + %res_0 = OpVariable %_ptr_Function_frexpStructType Function + %38 = OpAccessChain %_ptr_Input_float %position %uint_0 + %39 = OpLoad %float %38 + %41 = OpFAdd %float %39 %float_0_027777778 + %43 = OpFAdd %float %41 %float_1 + %45 = OpFDiv %float %43 %float_2 + %46 = OpFMul %float %float_36 %45 + %47 = OpFSub %float %46 %float_1 + %48 = OpConvertFToU %uint %47 + OpStore %xcoord %48 + %51 = OpAccessChain %_ptr_Input_float %position %uint_1 + %52 = OpLoad %float %51 + %53 = OpFAdd %float %52 %float_0_027777778 + %54 = OpFAdd %float %53 %float_1 + %55 = OpFDiv %float %54 %float_2 + %56 = OpFMul %float %float_36 %55 + %57 = OpFSub %float %56 %float_1 + %58 = OpConvertFToU %uint %57 + OpStore %ycoord %58 + %60 = OpLoad %uint %xcoord + %61 = OpLoad %uint %ycoord + %63 = OpIMul %uint %61 %uint_36 + %64 = OpIAdd %uint %60 %63 + OpStore %ndx %64 + %74 = OpLoad %uint %ndx + %76 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %74 + %77 = OpLoad %v4uint %76 + OpStore %in_uint %77 + %79 = OpLoad %v4uint %in_uint + %80 = OpBitcast %v4float %79 + OpStore %in_float %80 + %82 = OpLoad %v4float %in_float + %84 = OpExtInst %v4float %1 Frexp %82 %exp_0 + OpStore %x_0 %84 + %87 = OpLoad %v4float %in_float + %88 = OpExtInst %frexpStructType %1 FrexpStruct %87 + OpStore %res_0 %88 + %91 = OpLoad %v4float %x_0 + OpStore %frexp_x_out %91 + %93 = OpLoad %v4int %exp_0 + %94 = OpBitcast %v4float %93 + OpStore %frexp_exp_out %94 + %96 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0 + %97 = OpLoad %v4float %96 + OpStore %frexpStruct_x_out %97 + %100 = OpAccessChain %_ptr_Function_v4int %res_0 %int_1 + %101 = OpLoad %v4int %100 + %102 = OpBitcast %v4float %101 + OpStore %frexpStruct_exp_out %102 + %107 = OpLoad %v2float %position + %109 = OpCompositeExtract %float %107 0 + %110 = OpCompositeExtract %float %107 1 + %111 = OpCompositeConstruct %v4float %109 %110 %float_0 %float_1 + %112 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %112 %111 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec4 frexp_x_in; +# layout (location = 1) flat in vec4 frexp_exp_in; +# layout (location = 2) flat in vec4 frexpStruct_x_in; +# layout (location = 3) flat in vec4 frexpStruct_exp_in; +# +# layout (location = 0) out vec4 frexp_x_out; +# layout (location = 1) out vec4 frexp_exp_out; +# layout (location = 2) out vec4 frexpStruct_x_out; +# layout (location = 3) out vec4 frexpStruct_exp_out; +# +# +# void main () +# { +# frexp_x_out.rgba = frexp_x_in; +# frexp_exp_out.rgba = frexp_exp_in; +# frexpStruct_x_out.rgba = frexpStruct_x_in; +# frexpStruct_exp_out.rgba = frexpStruct_exp_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %frexp_x_out Location 0 + OpDecorate %frexp_x_in Flat + OpDecorate %frexp_x_in Location 0 + OpDecorate %frexp_exp_out Location 1 + OpDecorate %frexp_exp_in Flat + OpDecorate %frexp_exp_in Location 1 + OpDecorate %frexpStruct_x_out Location 2 + OpDecorate %frexpStruct_x_in Flat + OpDecorate %frexpStruct_x_in Location 2 + OpDecorate %frexpStruct_exp_out Location 3 + OpDecorate %frexpStruct_exp_in Flat + OpDecorate %frexpStruct_exp_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%frexp_x_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %frexp_x_in = OpVariable %_ptr_Input_v4float Input +%frexp_exp_out = OpVariable %_ptr_Output_v4float Output +%frexp_exp_in = OpVariable %_ptr_Input_v4float Input +%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_x_in = OpVariable %_ptr_Input_v4float Input +%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output +%frexpStruct_exp_in = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %v4float %frexp_x_in + OpStore %frexp_x_out %12 + %15 = OpLoad %v4float %frexp_exp_in + OpStore %frexp_exp_out %15 + %18 = OpLoad %v4float %frexpStruct_x_in + OpStore %frexpStruct_x_out %18 + %21 = OpLoad %v4float %frexpStruct_exp_in + OpStore %frexpStruct_exp_out %21 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER frexp_x AS color LOCATION 0 + BIND BUFFER frexp_exp AS color LOCATION 1 + BIND BUFFER frexpStruct_x AS color LOCATION 2 + BIND BUFFER frexpStruct_exp AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT frexp_x EQ_BUFFER frexpStruct_x +EXPECT frexp_exp EQ_BUFFER frexpStruct_exp diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/grid_vertices.txt b/vulkan/amber/spirv_assembly/instruction/float32/comparison/grid_vertices.txt new file mode 100644 index 0000000..5218e7c --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/grid_vertices.txt @@ -0,0 +1,1297 @@ +# 36x36 grid +-0.944444 -0.944444 -1.000000 -0.944444 -1.000000 -1.000000 -0.944444 -0.944444 -1.000000 -1.000000 -0.944444 -1.000000 +-0.888889 -0.944444 -0.944444 -0.944444 -0.944444 -1.000000 -0.888889 -0.944444 -0.944444 -1.000000 -0.888889 -1.000000 +-0.833333 -0.944444 -0.888889 -0.944444 -0.888889 -1.000000 -0.833333 -0.944444 -0.888889 -1.000000 -0.833333 -1.000000 +-0.777778 -0.944444 -0.833333 -0.944444 -0.833333 -1.000000 -0.777778 -0.944444 -0.833333 -1.000000 -0.777778 -1.000000 +-0.722222 -0.944444 -0.777778 -0.944444 -0.777778 -1.000000 -0.722222 -0.944444 -0.777778 -1.000000 -0.722222 -1.000000 +-0.666667 -0.944444 -0.722222 -0.944444 -0.722222 -1.000000 -0.666667 -0.944444 -0.722222 -1.000000 -0.666667 -1.000000 +-0.611111 -0.944444 -0.666667 -0.944444 -0.666667 -1.000000 -0.611111 -0.944444 -0.666667 -1.000000 -0.611111 -1.000000 +-0.555556 -0.944444 -0.611111 -0.944444 -0.611111 -1.000000 -0.555556 -0.944444 -0.611111 -1.000000 -0.555556 -1.000000 +-0.500000 -0.944444 -0.555556 -0.944444 -0.555556 -1.000000 -0.500000 -0.944444 -0.555556 -1.000000 -0.500000 -1.000000 +-0.444444 -0.944444 -0.500000 -0.944444 -0.500000 -1.000000 -0.444444 -0.944444 -0.500000 -1.000000 -0.444444 -1.000000 +-0.388889 -0.944444 -0.444444 -0.944444 -0.444444 -1.000000 -0.388889 -0.944444 -0.444444 -1.000000 -0.388889 -1.000000 +-0.333333 -0.944444 -0.388889 -0.944444 -0.388889 -1.000000 -0.333333 -0.944444 -0.388889 -1.000000 -0.333333 -1.000000 +-0.277778 -0.944444 -0.333333 -0.944444 -0.333333 -1.000000 -0.277778 -0.944444 -0.333333 -1.000000 -0.277778 -1.000000 +-0.222222 -0.944444 -0.277778 -0.944444 -0.277778 -1.000000 -0.222222 -0.944444 -0.277778 -1.000000 -0.222222 -1.000000 +-0.166667 -0.944444 -0.222222 -0.944444 -0.222222 -1.000000 -0.166667 -0.944444 -0.222222 -1.000000 -0.166667 -1.000000 +-0.111111 -0.944444 -0.166667 -0.944444 -0.166667 -1.000000 -0.111111 -0.944444 -0.166667 -1.000000 -0.111111 -1.000000 +-0.055556 -0.944444 -0.111111 -0.944444 -0.111111 -1.000000 -0.055556 -0.944444 -0.111111 -1.000000 -0.055556 -1.000000 + 0.000000 -0.944444 -0.055556 -0.944444 -0.055556 -1.000000 0.000000 -0.944444 -0.055556 -1.000000 0.000000 -1.000000 + 0.055556 -0.944444 0.000000 -0.944444 0.000000 -1.000000 0.055556 -0.944444 0.000000 -1.000000 0.055556 -1.000000 + 0.111111 -0.944444 0.055556 -0.944444 0.055556 -1.000000 0.111111 -0.944444 0.055556 -1.000000 0.111111 -1.000000 + 0.166667 -0.944444 0.111111 -0.944444 0.111111 -1.000000 0.166667 -0.944444 0.111111 -1.000000 0.166667 -1.000000 + 0.222222 -0.944444 0.166667 -0.944444 0.166667 -1.000000 0.222222 -0.944444 0.166667 -1.000000 0.222222 -1.000000 + 0.277778 -0.944444 0.222222 -0.944444 0.222222 -1.000000 0.277778 -0.944444 0.222222 -1.000000 0.277778 -1.000000 + 0.333333 -0.944444 0.277778 -0.944444 0.277778 -1.000000 0.333333 -0.944444 0.277778 -1.000000 0.333333 -1.000000 + 0.388889 -0.944444 0.333333 -0.944444 0.333333 -1.000000 0.388889 -0.944444 0.333333 -1.000000 0.388889 -1.000000 + 0.444444 -0.944444 0.388889 -0.944444 0.388889 -1.000000 0.444444 -0.944444 0.388889 -1.000000 0.444444 -1.000000 + 0.500000 -0.944444 0.444444 -0.944444 0.444444 -1.000000 0.500000 -0.944444 0.444444 -1.000000 0.500000 -1.000000 + 0.555556 -0.944444 0.500000 -0.944444 0.500000 -1.000000 0.555556 -0.944444 0.500000 -1.000000 0.555556 -1.000000 + 0.611111 -0.944444 0.555556 -0.944444 0.555556 -1.000000 0.611111 -0.944444 0.555556 -1.000000 0.611111 -1.000000 + 0.666667 -0.944444 0.611111 -0.944444 0.611111 -1.000000 0.666667 -0.944444 0.611111 -1.000000 0.666667 -1.000000 + 0.722222 -0.944444 0.666667 -0.944444 0.666667 -1.000000 0.722222 -0.944444 0.666667 -1.000000 0.722222 -1.000000 + 0.777778 -0.944444 0.722222 -0.944444 0.722222 -1.000000 0.777778 -0.944444 0.722222 -1.000000 0.777778 -1.000000 + 0.833333 -0.944444 0.777778 -0.944444 0.777778 -1.000000 0.833333 -0.944444 0.777778 -1.000000 0.833333 -1.000000 + 0.888889 -0.944444 0.833333 -0.944444 0.833333 -1.000000 0.888889 -0.944444 0.833333 -1.000000 0.888889 -1.000000 + 0.944444 -0.944444 0.888889 -0.944444 0.888889 -1.000000 0.944444 -0.944444 0.888889 -1.000000 0.944444 -1.000000 + 1.000000 -0.944444 0.944444 -0.944444 0.944444 -1.000000 1.000000 -0.944444 0.944444 -1.000000 1.000000 -1.000000 +-0.944444 -0.888889 -1.000000 -0.888889 -1.000000 -0.944444 -0.944444 -0.888889 -1.000000 -0.944444 -0.944444 -0.944444 +-0.888889 -0.888889 -0.944444 -0.888889 -0.944444 -0.944444 -0.888889 -0.888889 -0.944444 -0.944444 -0.888889 -0.944444 +-0.833333 -0.888889 -0.888889 -0.888889 -0.888889 -0.944444 -0.833333 -0.888889 -0.888889 -0.944444 -0.833333 -0.944444 +-0.777778 -0.888889 -0.833333 -0.888889 -0.833333 -0.944444 -0.777778 -0.888889 -0.833333 -0.944444 -0.777778 -0.944444 +-0.722222 -0.888889 -0.777778 -0.888889 -0.777778 -0.944444 -0.722222 -0.888889 -0.777778 -0.944444 -0.722222 -0.944444 +-0.666667 -0.888889 -0.722222 -0.888889 -0.722222 -0.944444 -0.666667 -0.888889 -0.722222 -0.944444 -0.666667 -0.944444 +-0.611111 -0.888889 -0.666667 -0.888889 -0.666667 -0.944444 -0.611111 -0.888889 -0.666667 -0.944444 -0.611111 -0.944444 +-0.555556 -0.888889 -0.611111 -0.888889 -0.611111 -0.944444 -0.555556 -0.888889 -0.611111 -0.944444 -0.555556 -0.944444 +-0.500000 -0.888889 -0.555556 -0.888889 -0.555556 -0.944444 -0.500000 -0.888889 -0.555556 -0.944444 -0.500000 -0.944444 +-0.444444 -0.888889 -0.500000 -0.888889 -0.500000 -0.944444 -0.444444 -0.888889 -0.500000 -0.944444 -0.444444 -0.944444 +-0.388889 -0.888889 -0.444444 -0.888889 -0.444444 -0.944444 -0.388889 -0.888889 -0.444444 -0.944444 -0.388889 -0.944444 +-0.333333 -0.888889 -0.388889 -0.888889 -0.388889 -0.944444 -0.333333 -0.888889 -0.388889 -0.944444 -0.333333 -0.944444 +-0.277778 -0.888889 -0.333333 -0.888889 -0.333333 -0.944444 -0.277778 -0.888889 -0.333333 -0.944444 -0.277778 -0.944444 +-0.222222 -0.888889 -0.277778 -0.888889 -0.277778 -0.944444 -0.222222 -0.888889 -0.277778 -0.944444 -0.222222 -0.944444 +-0.166667 -0.888889 -0.222222 -0.888889 -0.222222 -0.944444 -0.166667 -0.888889 -0.222222 -0.944444 -0.166667 -0.944444 +-0.111111 -0.888889 -0.166667 -0.888889 -0.166667 -0.944444 -0.111111 -0.888889 -0.166667 -0.944444 -0.111111 -0.944444 +-0.055556 -0.888889 -0.111111 -0.888889 -0.111111 -0.944444 -0.055556 -0.888889 -0.111111 -0.944444 -0.055556 -0.944444 + 0.000000 -0.888889 -0.055556 -0.888889 -0.055556 -0.944444 0.000000 -0.888889 -0.055556 -0.944444 0.000000 -0.944444 + 0.055556 -0.888889 0.000000 -0.888889 0.000000 -0.944444 0.055556 -0.888889 0.000000 -0.944444 0.055556 -0.944444 + 0.111111 -0.888889 0.055556 -0.888889 0.055556 -0.944444 0.111111 -0.888889 0.055556 -0.944444 0.111111 -0.944444 + 0.166667 -0.888889 0.111111 -0.888889 0.111111 -0.944444 0.166667 -0.888889 0.111111 -0.944444 0.166667 -0.944444 + 0.222222 -0.888889 0.166667 -0.888889 0.166667 -0.944444 0.222222 -0.888889 0.166667 -0.944444 0.222222 -0.944444 + 0.277778 -0.888889 0.222222 -0.888889 0.222222 -0.944444 0.277778 -0.888889 0.222222 -0.944444 0.277778 -0.944444 + 0.333333 -0.888889 0.277778 -0.888889 0.277778 -0.944444 0.333333 -0.888889 0.277778 -0.944444 0.333333 -0.944444 + 0.388889 -0.888889 0.333333 -0.888889 0.333333 -0.944444 0.388889 -0.888889 0.333333 -0.944444 0.388889 -0.944444 + 0.444444 -0.888889 0.388889 -0.888889 0.388889 -0.944444 0.444444 -0.888889 0.388889 -0.944444 0.444444 -0.944444 + 0.500000 -0.888889 0.444444 -0.888889 0.444444 -0.944444 0.500000 -0.888889 0.444444 -0.944444 0.500000 -0.944444 + 0.555556 -0.888889 0.500000 -0.888889 0.500000 -0.944444 0.555556 -0.888889 0.500000 -0.944444 0.555556 -0.944444 + 0.611111 -0.888889 0.555556 -0.888889 0.555556 -0.944444 0.611111 -0.888889 0.555556 -0.944444 0.611111 -0.944444 + 0.666667 -0.888889 0.611111 -0.888889 0.611111 -0.944444 0.666667 -0.888889 0.611111 -0.944444 0.666667 -0.944444 + 0.722222 -0.888889 0.666667 -0.888889 0.666667 -0.944444 0.722222 -0.888889 0.666667 -0.944444 0.722222 -0.944444 + 0.777778 -0.888889 0.722222 -0.888889 0.722222 -0.944444 0.777778 -0.888889 0.722222 -0.944444 0.777778 -0.944444 + 0.833333 -0.888889 0.777778 -0.888889 0.777778 -0.944444 0.833333 -0.888889 0.777778 -0.944444 0.833333 -0.944444 + 0.888889 -0.888889 0.833333 -0.888889 0.833333 -0.944444 0.888889 -0.888889 0.833333 -0.944444 0.888889 -0.944444 + 0.944444 -0.888889 0.888889 -0.888889 0.888889 -0.944444 0.944444 -0.888889 0.888889 -0.944444 0.944444 -0.944444 + 1.000000 -0.888889 0.944444 -0.888889 0.944444 -0.944444 1.000000 -0.888889 0.944444 -0.944444 1.000000 -0.944444 +-0.944444 -0.833333 -1.000000 -0.833333 -1.000000 -0.888889 -0.944444 -0.833333 -1.000000 -0.888889 -0.944444 -0.888889 +-0.888889 -0.833333 -0.944444 -0.833333 -0.944444 -0.888889 -0.888889 -0.833333 -0.944444 -0.888889 -0.888889 -0.888889 +-0.833333 -0.833333 -0.888889 -0.833333 -0.888889 -0.888889 -0.833333 -0.833333 -0.888889 -0.888889 -0.833333 -0.888889 +-0.777778 -0.833333 -0.833333 -0.833333 -0.833333 -0.888889 -0.777778 -0.833333 -0.833333 -0.888889 -0.777778 -0.888889 +-0.722222 -0.833333 -0.777778 -0.833333 -0.777778 -0.888889 -0.722222 -0.833333 -0.777778 -0.888889 -0.722222 -0.888889 +-0.666667 -0.833333 -0.722222 -0.833333 -0.722222 -0.888889 -0.666667 -0.833333 -0.722222 -0.888889 -0.666667 -0.888889 +-0.611111 -0.833333 -0.666667 -0.833333 -0.666667 -0.888889 -0.611111 -0.833333 -0.666667 -0.888889 -0.611111 -0.888889 +-0.555556 -0.833333 -0.611111 -0.833333 -0.611111 -0.888889 -0.555556 -0.833333 -0.611111 -0.888889 -0.555556 -0.888889 +-0.500000 -0.833333 -0.555556 -0.833333 -0.555556 -0.888889 -0.500000 -0.833333 -0.555556 -0.888889 -0.500000 -0.888889 +-0.444444 -0.833333 -0.500000 -0.833333 -0.500000 -0.888889 -0.444444 -0.833333 -0.500000 -0.888889 -0.444444 -0.888889 +-0.388889 -0.833333 -0.444444 -0.833333 -0.444444 -0.888889 -0.388889 -0.833333 -0.444444 -0.888889 -0.388889 -0.888889 +-0.333333 -0.833333 -0.388889 -0.833333 -0.388889 -0.888889 -0.333333 -0.833333 -0.388889 -0.888889 -0.333333 -0.888889 +-0.277778 -0.833333 -0.333333 -0.833333 -0.333333 -0.888889 -0.277778 -0.833333 -0.333333 -0.888889 -0.277778 -0.888889 +-0.222222 -0.833333 -0.277778 -0.833333 -0.277778 -0.888889 -0.222222 -0.833333 -0.277778 -0.888889 -0.222222 -0.888889 +-0.166667 -0.833333 -0.222222 -0.833333 -0.222222 -0.888889 -0.166667 -0.833333 -0.222222 -0.888889 -0.166667 -0.888889 +-0.111111 -0.833333 -0.166667 -0.833333 -0.166667 -0.888889 -0.111111 -0.833333 -0.166667 -0.888889 -0.111111 -0.888889 +-0.055556 -0.833333 -0.111111 -0.833333 -0.111111 -0.888889 -0.055556 -0.833333 -0.111111 -0.888889 -0.055556 -0.888889 + 0.000000 -0.833333 -0.055556 -0.833333 -0.055556 -0.888889 0.000000 -0.833333 -0.055556 -0.888889 0.000000 -0.888889 + 0.055556 -0.833333 0.000000 -0.833333 0.000000 -0.888889 0.055556 -0.833333 0.000000 -0.888889 0.055556 -0.888889 + 0.111111 -0.833333 0.055556 -0.833333 0.055556 -0.888889 0.111111 -0.833333 0.055556 -0.888889 0.111111 -0.888889 + 0.166667 -0.833333 0.111111 -0.833333 0.111111 -0.888889 0.166667 -0.833333 0.111111 -0.888889 0.166667 -0.888889 + 0.222222 -0.833333 0.166667 -0.833333 0.166667 -0.888889 0.222222 -0.833333 0.166667 -0.888889 0.222222 -0.888889 + 0.277778 -0.833333 0.222222 -0.833333 0.222222 -0.888889 0.277778 -0.833333 0.222222 -0.888889 0.277778 -0.888889 + 0.333333 -0.833333 0.277778 -0.833333 0.277778 -0.888889 0.333333 -0.833333 0.277778 -0.888889 0.333333 -0.888889 + 0.388889 -0.833333 0.333333 -0.833333 0.333333 -0.888889 0.388889 -0.833333 0.333333 -0.888889 0.388889 -0.888889 + 0.444444 -0.833333 0.388889 -0.833333 0.388889 -0.888889 0.444444 -0.833333 0.388889 -0.888889 0.444444 -0.888889 + 0.500000 -0.833333 0.444444 -0.833333 0.444444 -0.888889 0.500000 -0.833333 0.444444 -0.888889 0.500000 -0.888889 + 0.555556 -0.833333 0.500000 -0.833333 0.500000 -0.888889 0.555556 -0.833333 0.500000 -0.888889 0.555556 -0.888889 + 0.611111 -0.833333 0.555556 -0.833333 0.555556 -0.888889 0.611111 -0.833333 0.555556 -0.888889 0.611111 -0.888889 + 0.666667 -0.833333 0.611111 -0.833333 0.611111 -0.888889 0.666667 -0.833333 0.611111 -0.888889 0.666667 -0.888889 + 0.722222 -0.833333 0.666667 -0.833333 0.666667 -0.888889 0.722222 -0.833333 0.666667 -0.888889 0.722222 -0.888889 + 0.777778 -0.833333 0.722222 -0.833333 0.722222 -0.888889 0.777778 -0.833333 0.722222 -0.888889 0.777778 -0.888889 + 0.833333 -0.833333 0.777778 -0.833333 0.777778 -0.888889 0.833333 -0.833333 0.777778 -0.888889 0.833333 -0.888889 + 0.888889 -0.833333 0.833333 -0.833333 0.833333 -0.888889 0.888889 -0.833333 0.833333 -0.888889 0.888889 -0.888889 + 0.944444 -0.833333 0.888889 -0.833333 0.888889 -0.888889 0.944444 -0.833333 0.888889 -0.888889 0.944444 -0.888889 + 1.000000 -0.833333 0.944444 -0.833333 0.944444 -0.888889 1.000000 -0.833333 0.944444 -0.888889 1.000000 -0.888889 +-0.944444 -0.777778 -1.000000 -0.777778 -1.000000 -0.833333 -0.944444 -0.777778 -1.000000 -0.833333 -0.944444 -0.833333 +-0.888889 -0.777778 -0.944444 -0.777778 -0.944444 -0.833333 -0.888889 -0.777778 -0.944444 -0.833333 -0.888889 -0.833333 +-0.833333 -0.777778 -0.888889 -0.777778 -0.888889 -0.833333 -0.833333 -0.777778 -0.888889 -0.833333 -0.833333 -0.833333 +-0.777778 -0.777778 -0.833333 -0.777778 -0.833333 -0.833333 -0.777778 -0.777778 -0.833333 -0.833333 -0.777778 -0.833333 +-0.722222 -0.777778 -0.777778 -0.777778 -0.777778 -0.833333 -0.722222 -0.777778 -0.777778 -0.833333 -0.722222 -0.833333 +-0.666667 -0.777778 -0.722222 -0.777778 -0.722222 -0.833333 -0.666667 -0.777778 -0.722222 -0.833333 -0.666667 -0.833333 +-0.611111 -0.777778 -0.666667 -0.777778 -0.666667 -0.833333 -0.611111 -0.777778 -0.666667 -0.833333 -0.611111 -0.833333 +-0.555556 -0.777778 -0.611111 -0.777778 -0.611111 -0.833333 -0.555556 -0.777778 -0.611111 -0.833333 -0.555556 -0.833333 +-0.500000 -0.777778 -0.555556 -0.777778 -0.555556 -0.833333 -0.500000 -0.777778 -0.555556 -0.833333 -0.500000 -0.833333 +-0.444444 -0.777778 -0.500000 -0.777778 -0.500000 -0.833333 -0.444444 -0.777778 -0.500000 -0.833333 -0.444444 -0.833333 +-0.388889 -0.777778 -0.444444 -0.777778 -0.444444 -0.833333 -0.388889 -0.777778 -0.444444 -0.833333 -0.388889 -0.833333 +-0.333333 -0.777778 -0.388889 -0.777778 -0.388889 -0.833333 -0.333333 -0.777778 -0.388889 -0.833333 -0.333333 -0.833333 +-0.277778 -0.777778 -0.333333 -0.777778 -0.333333 -0.833333 -0.277778 -0.777778 -0.333333 -0.833333 -0.277778 -0.833333 +-0.222222 -0.777778 -0.277778 -0.777778 -0.277778 -0.833333 -0.222222 -0.777778 -0.277778 -0.833333 -0.222222 -0.833333 +-0.166667 -0.777778 -0.222222 -0.777778 -0.222222 -0.833333 -0.166667 -0.777778 -0.222222 -0.833333 -0.166667 -0.833333 +-0.111111 -0.777778 -0.166667 -0.777778 -0.166667 -0.833333 -0.111111 -0.777778 -0.166667 -0.833333 -0.111111 -0.833333 +-0.055556 -0.777778 -0.111111 -0.777778 -0.111111 -0.833333 -0.055556 -0.777778 -0.111111 -0.833333 -0.055556 -0.833333 + 0.000000 -0.777778 -0.055556 -0.777778 -0.055556 -0.833333 0.000000 -0.777778 -0.055556 -0.833333 0.000000 -0.833333 + 0.055556 -0.777778 0.000000 -0.777778 0.000000 -0.833333 0.055556 -0.777778 0.000000 -0.833333 0.055556 -0.833333 + 0.111111 -0.777778 0.055556 -0.777778 0.055556 -0.833333 0.111111 -0.777778 0.055556 -0.833333 0.111111 -0.833333 + 0.166667 -0.777778 0.111111 -0.777778 0.111111 -0.833333 0.166667 -0.777778 0.111111 -0.833333 0.166667 -0.833333 + 0.222222 -0.777778 0.166667 -0.777778 0.166667 -0.833333 0.222222 -0.777778 0.166667 -0.833333 0.222222 -0.833333 + 0.277778 -0.777778 0.222222 -0.777778 0.222222 -0.833333 0.277778 -0.777778 0.222222 -0.833333 0.277778 -0.833333 + 0.333333 -0.777778 0.277778 -0.777778 0.277778 -0.833333 0.333333 -0.777778 0.277778 -0.833333 0.333333 -0.833333 + 0.388889 -0.777778 0.333333 -0.777778 0.333333 -0.833333 0.388889 -0.777778 0.333333 -0.833333 0.388889 -0.833333 + 0.444444 -0.777778 0.388889 -0.777778 0.388889 -0.833333 0.444444 -0.777778 0.388889 -0.833333 0.444444 -0.833333 + 0.500000 -0.777778 0.444444 -0.777778 0.444444 -0.833333 0.500000 -0.777778 0.444444 -0.833333 0.500000 -0.833333 + 0.555556 -0.777778 0.500000 -0.777778 0.500000 -0.833333 0.555556 -0.777778 0.500000 -0.833333 0.555556 -0.833333 + 0.611111 -0.777778 0.555556 -0.777778 0.555556 -0.833333 0.611111 -0.777778 0.555556 -0.833333 0.611111 -0.833333 + 0.666667 -0.777778 0.611111 -0.777778 0.611111 -0.833333 0.666667 -0.777778 0.611111 -0.833333 0.666667 -0.833333 + 0.722222 -0.777778 0.666667 -0.777778 0.666667 -0.833333 0.722222 -0.777778 0.666667 -0.833333 0.722222 -0.833333 + 0.777778 -0.777778 0.722222 -0.777778 0.722222 -0.833333 0.777778 -0.777778 0.722222 -0.833333 0.777778 -0.833333 + 0.833333 -0.777778 0.777778 -0.777778 0.777778 -0.833333 0.833333 -0.777778 0.777778 -0.833333 0.833333 -0.833333 + 0.888889 -0.777778 0.833333 -0.777778 0.833333 -0.833333 0.888889 -0.777778 0.833333 -0.833333 0.888889 -0.833333 + 0.944444 -0.777778 0.888889 -0.777778 0.888889 -0.833333 0.944444 -0.777778 0.888889 -0.833333 0.944444 -0.833333 + 1.000000 -0.777778 0.944444 -0.777778 0.944444 -0.833333 1.000000 -0.777778 0.944444 -0.833333 1.000000 -0.833333 +-0.944444 -0.722222 -1.000000 -0.722222 -1.000000 -0.777778 -0.944444 -0.722222 -1.000000 -0.777778 -0.944444 -0.777778 +-0.888889 -0.722222 -0.944444 -0.722222 -0.944444 -0.777778 -0.888889 -0.722222 -0.944444 -0.777778 -0.888889 -0.777778 +-0.833333 -0.722222 -0.888889 -0.722222 -0.888889 -0.777778 -0.833333 -0.722222 -0.888889 -0.777778 -0.833333 -0.777778 +-0.777778 -0.722222 -0.833333 -0.722222 -0.833333 -0.777778 -0.777778 -0.722222 -0.833333 -0.777778 -0.777778 -0.777778 +-0.722222 -0.722222 -0.777778 -0.722222 -0.777778 -0.777778 -0.722222 -0.722222 -0.777778 -0.777778 -0.722222 -0.777778 +-0.666667 -0.722222 -0.722222 -0.722222 -0.722222 -0.777778 -0.666667 -0.722222 -0.722222 -0.777778 -0.666667 -0.777778 +-0.611111 -0.722222 -0.666667 -0.722222 -0.666667 -0.777778 -0.611111 -0.722222 -0.666667 -0.777778 -0.611111 -0.777778 +-0.555556 -0.722222 -0.611111 -0.722222 -0.611111 -0.777778 -0.555556 -0.722222 -0.611111 -0.777778 -0.555556 -0.777778 +-0.500000 -0.722222 -0.555556 -0.722222 -0.555556 -0.777778 -0.500000 -0.722222 -0.555556 -0.777778 -0.500000 -0.777778 +-0.444444 -0.722222 -0.500000 -0.722222 -0.500000 -0.777778 -0.444444 -0.722222 -0.500000 -0.777778 -0.444444 -0.777778 +-0.388889 -0.722222 -0.444444 -0.722222 -0.444444 -0.777778 -0.388889 -0.722222 -0.444444 -0.777778 -0.388889 -0.777778 +-0.333333 -0.722222 -0.388889 -0.722222 -0.388889 -0.777778 -0.333333 -0.722222 -0.388889 -0.777778 -0.333333 -0.777778 +-0.277778 -0.722222 -0.333333 -0.722222 -0.333333 -0.777778 -0.277778 -0.722222 -0.333333 -0.777778 -0.277778 -0.777778 +-0.222222 -0.722222 -0.277778 -0.722222 -0.277778 -0.777778 -0.222222 -0.722222 -0.277778 -0.777778 -0.222222 -0.777778 +-0.166667 -0.722222 -0.222222 -0.722222 -0.222222 -0.777778 -0.166667 -0.722222 -0.222222 -0.777778 -0.166667 -0.777778 +-0.111111 -0.722222 -0.166667 -0.722222 -0.166667 -0.777778 -0.111111 -0.722222 -0.166667 -0.777778 -0.111111 -0.777778 +-0.055556 -0.722222 -0.111111 -0.722222 -0.111111 -0.777778 -0.055556 -0.722222 -0.111111 -0.777778 -0.055556 -0.777778 + 0.000000 -0.722222 -0.055556 -0.722222 -0.055556 -0.777778 0.000000 -0.722222 -0.055556 -0.777778 0.000000 -0.777778 + 0.055556 -0.722222 0.000000 -0.722222 0.000000 -0.777778 0.055556 -0.722222 0.000000 -0.777778 0.055556 -0.777778 + 0.111111 -0.722222 0.055556 -0.722222 0.055556 -0.777778 0.111111 -0.722222 0.055556 -0.777778 0.111111 -0.777778 + 0.166667 -0.722222 0.111111 -0.722222 0.111111 -0.777778 0.166667 -0.722222 0.111111 -0.777778 0.166667 -0.777778 + 0.222222 -0.722222 0.166667 -0.722222 0.166667 -0.777778 0.222222 -0.722222 0.166667 -0.777778 0.222222 -0.777778 + 0.277778 -0.722222 0.222222 -0.722222 0.222222 -0.777778 0.277778 -0.722222 0.222222 -0.777778 0.277778 -0.777778 + 0.333333 -0.722222 0.277778 -0.722222 0.277778 -0.777778 0.333333 -0.722222 0.277778 -0.777778 0.333333 -0.777778 + 0.388889 -0.722222 0.333333 -0.722222 0.333333 -0.777778 0.388889 -0.722222 0.333333 -0.777778 0.388889 -0.777778 + 0.444444 -0.722222 0.388889 -0.722222 0.388889 -0.777778 0.444444 -0.722222 0.388889 -0.777778 0.444444 -0.777778 + 0.500000 -0.722222 0.444444 -0.722222 0.444444 -0.777778 0.500000 -0.722222 0.444444 -0.777778 0.500000 -0.777778 + 0.555556 -0.722222 0.500000 -0.722222 0.500000 -0.777778 0.555556 -0.722222 0.500000 -0.777778 0.555556 -0.777778 + 0.611111 -0.722222 0.555556 -0.722222 0.555556 -0.777778 0.611111 -0.722222 0.555556 -0.777778 0.611111 -0.777778 + 0.666667 -0.722222 0.611111 -0.722222 0.611111 -0.777778 0.666667 -0.722222 0.611111 -0.777778 0.666667 -0.777778 + 0.722222 -0.722222 0.666667 -0.722222 0.666667 -0.777778 0.722222 -0.722222 0.666667 -0.777778 0.722222 -0.777778 + 0.777778 -0.722222 0.722222 -0.722222 0.722222 -0.777778 0.777778 -0.722222 0.722222 -0.777778 0.777778 -0.777778 + 0.833333 -0.722222 0.777778 -0.722222 0.777778 -0.777778 0.833333 -0.722222 0.777778 -0.777778 0.833333 -0.777778 + 0.888889 -0.722222 0.833333 -0.722222 0.833333 -0.777778 0.888889 -0.722222 0.833333 -0.777778 0.888889 -0.777778 + 0.944444 -0.722222 0.888889 -0.722222 0.888889 -0.777778 0.944444 -0.722222 0.888889 -0.777778 0.944444 -0.777778 + 1.000000 -0.722222 0.944444 -0.722222 0.944444 -0.777778 1.000000 -0.722222 0.944444 -0.777778 1.000000 -0.777778 +-0.944444 -0.666667 -1.000000 -0.666667 -1.000000 -0.722222 -0.944444 -0.666667 -1.000000 -0.722222 -0.944444 -0.722222 +-0.888889 -0.666667 -0.944444 -0.666667 -0.944444 -0.722222 -0.888889 -0.666667 -0.944444 -0.722222 -0.888889 -0.722222 +-0.833333 -0.666667 -0.888889 -0.666667 -0.888889 -0.722222 -0.833333 -0.666667 -0.888889 -0.722222 -0.833333 -0.722222 +-0.777778 -0.666667 -0.833333 -0.666667 -0.833333 -0.722222 -0.777778 -0.666667 -0.833333 -0.722222 -0.777778 -0.722222 +-0.722222 -0.666667 -0.777778 -0.666667 -0.777778 -0.722222 -0.722222 -0.666667 -0.777778 -0.722222 -0.722222 -0.722222 +-0.666667 -0.666667 -0.722222 -0.666667 -0.722222 -0.722222 -0.666667 -0.666667 -0.722222 -0.722222 -0.666667 -0.722222 +-0.611111 -0.666667 -0.666667 -0.666667 -0.666667 -0.722222 -0.611111 -0.666667 -0.666667 -0.722222 -0.611111 -0.722222 +-0.555556 -0.666667 -0.611111 -0.666667 -0.611111 -0.722222 -0.555556 -0.666667 -0.611111 -0.722222 -0.555556 -0.722222 +-0.500000 -0.666667 -0.555556 -0.666667 -0.555556 -0.722222 -0.500000 -0.666667 -0.555556 -0.722222 -0.500000 -0.722222 +-0.444444 -0.666667 -0.500000 -0.666667 -0.500000 -0.722222 -0.444444 -0.666667 -0.500000 -0.722222 -0.444444 -0.722222 +-0.388889 -0.666667 -0.444444 -0.666667 -0.444444 -0.722222 -0.388889 -0.666667 -0.444444 -0.722222 -0.388889 -0.722222 +-0.333333 -0.666667 -0.388889 -0.666667 -0.388889 -0.722222 -0.333333 -0.666667 -0.388889 -0.722222 -0.333333 -0.722222 +-0.277778 -0.666667 -0.333333 -0.666667 -0.333333 -0.722222 -0.277778 -0.666667 -0.333333 -0.722222 -0.277778 -0.722222 +-0.222222 -0.666667 -0.277778 -0.666667 -0.277778 -0.722222 -0.222222 -0.666667 -0.277778 -0.722222 -0.222222 -0.722222 +-0.166667 -0.666667 -0.222222 -0.666667 -0.222222 -0.722222 -0.166667 -0.666667 -0.222222 -0.722222 -0.166667 -0.722222 +-0.111111 -0.666667 -0.166667 -0.666667 -0.166667 -0.722222 -0.111111 -0.666667 -0.166667 -0.722222 -0.111111 -0.722222 +-0.055556 -0.666667 -0.111111 -0.666667 -0.111111 -0.722222 -0.055556 -0.666667 -0.111111 -0.722222 -0.055556 -0.722222 + 0.000000 -0.666667 -0.055556 -0.666667 -0.055556 -0.722222 0.000000 -0.666667 -0.055556 -0.722222 0.000000 -0.722222 + 0.055556 -0.666667 0.000000 -0.666667 0.000000 -0.722222 0.055556 -0.666667 0.000000 -0.722222 0.055556 -0.722222 + 0.111111 -0.666667 0.055556 -0.666667 0.055556 -0.722222 0.111111 -0.666667 0.055556 -0.722222 0.111111 -0.722222 + 0.166667 -0.666667 0.111111 -0.666667 0.111111 -0.722222 0.166667 -0.666667 0.111111 -0.722222 0.166667 -0.722222 + 0.222222 -0.666667 0.166667 -0.666667 0.166667 -0.722222 0.222222 -0.666667 0.166667 -0.722222 0.222222 -0.722222 + 0.277778 -0.666667 0.222222 -0.666667 0.222222 -0.722222 0.277778 -0.666667 0.222222 -0.722222 0.277778 -0.722222 + 0.333333 -0.666667 0.277778 -0.666667 0.277778 -0.722222 0.333333 -0.666667 0.277778 -0.722222 0.333333 -0.722222 + 0.388889 -0.666667 0.333333 -0.666667 0.333333 -0.722222 0.388889 -0.666667 0.333333 -0.722222 0.388889 -0.722222 + 0.444444 -0.666667 0.388889 -0.666667 0.388889 -0.722222 0.444444 -0.666667 0.388889 -0.722222 0.444444 -0.722222 + 0.500000 -0.666667 0.444444 -0.666667 0.444444 -0.722222 0.500000 -0.666667 0.444444 -0.722222 0.500000 -0.722222 + 0.555556 -0.666667 0.500000 -0.666667 0.500000 -0.722222 0.555556 -0.666667 0.500000 -0.722222 0.555556 -0.722222 + 0.611111 -0.666667 0.555556 -0.666667 0.555556 -0.722222 0.611111 -0.666667 0.555556 -0.722222 0.611111 -0.722222 + 0.666667 -0.666667 0.611111 -0.666667 0.611111 -0.722222 0.666667 -0.666667 0.611111 -0.722222 0.666667 -0.722222 + 0.722222 -0.666667 0.666667 -0.666667 0.666667 -0.722222 0.722222 -0.666667 0.666667 -0.722222 0.722222 -0.722222 + 0.777778 -0.666667 0.722222 -0.666667 0.722222 -0.722222 0.777778 -0.666667 0.722222 -0.722222 0.777778 -0.722222 + 0.833333 -0.666667 0.777778 -0.666667 0.777778 -0.722222 0.833333 -0.666667 0.777778 -0.722222 0.833333 -0.722222 + 0.888889 -0.666667 0.833333 -0.666667 0.833333 -0.722222 0.888889 -0.666667 0.833333 -0.722222 0.888889 -0.722222 + 0.944444 -0.666667 0.888889 -0.666667 0.888889 -0.722222 0.944444 -0.666667 0.888889 -0.722222 0.944444 -0.722222 + 1.000000 -0.666667 0.944444 -0.666667 0.944444 -0.722222 1.000000 -0.666667 0.944444 -0.722222 1.000000 -0.722222 +-0.944444 -0.611111 -1.000000 -0.611111 -1.000000 -0.666667 -0.944444 -0.611111 -1.000000 -0.666667 -0.944444 -0.666667 +-0.888889 -0.611111 -0.944444 -0.611111 -0.944444 -0.666667 -0.888889 -0.611111 -0.944444 -0.666667 -0.888889 -0.666667 +-0.833333 -0.611111 -0.888889 -0.611111 -0.888889 -0.666667 -0.833333 -0.611111 -0.888889 -0.666667 -0.833333 -0.666667 +-0.777778 -0.611111 -0.833333 -0.611111 -0.833333 -0.666667 -0.777778 -0.611111 -0.833333 -0.666667 -0.777778 -0.666667 +-0.722222 -0.611111 -0.777778 -0.611111 -0.777778 -0.666667 -0.722222 -0.611111 -0.777778 -0.666667 -0.722222 -0.666667 +-0.666667 -0.611111 -0.722222 -0.611111 -0.722222 -0.666667 -0.666667 -0.611111 -0.722222 -0.666667 -0.666667 -0.666667 +-0.611111 -0.611111 -0.666667 -0.611111 -0.666667 -0.666667 -0.611111 -0.611111 -0.666667 -0.666667 -0.611111 -0.666667 +-0.555556 -0.611111 -0.611111 -0.611111 -0.611111 -0.666667 -0.555556 -0.611111 -0.611111 -0.666667 -0.555556 -0.666667 +-0.500000 -0.611111 -0.555556 -0.611111 -0.555556 -0.666667 -0.500000 -0.611111 -0.555556 -0.666667 -0.500000 -0.666667 +-0.444444 -0.611111 -0.500000 -0.611111 -0.500000 -0.666667 -0.444444 -0.611111 -0.500000 -0.666667 -0.444444 -0.666667 +-0.388889 -0.611111 -0.444444 -0.611111 -0.444444 -0.666667 -0.388889 -0.611111 -0.444444 -0.666667 -0.388889 -0.666667 +-0.333333 -0.611111 -0.388889 -0.611111 -0.388889 -0.666667 -0.333333 -0.611111 -0.388889 -0.666667 -0.333333 -0.666667 +-0.277778 -0.611111 -0.333333 -0.611111 -0.333333 -0.666667 -0.277778 -0.611111 -0.333333 -0.666667 -0.277778 -0.666667 +-0.222222 -0.611111 -0.277778 -0.611111 -0.277778 -0.666667 -0.222222 -0.611111 -0.277778 -0.666667 -0.222222 -0.666667 +-0.166667 -0.611111 -0.222222 -0.611111 -0.222222 -0.666667 -0.166667 -0.611111 -0.222222 -0.666667 -0.166667 -0.666667 +-0.111111 -0.611111 -0.166667 -0.611111 -0.166667 -0.666667 -0.111111 -0.611111 -0.166667 -0.666667 -0.111111 -0.666667 +-0.055556 -0.611111 -0.111111 -0.611111 -0.111111 -0.666667 -0.055556 -0.611111 -0.111111 -0.666667 -0.055556 -0.666667 + 0.000000 -0.611111 -0.055556 -0.611111 -0.055556 -0.666667 0.000000 -0.611111 -0.055556 -0.666667 0.000000 -0.666667 + 0.055556 -0.611111 0.000000 -0.611111 0.000000 -0.666667 0.055556 -0.611111 0.000000 -0.666667 0.055556 -0.666667 + 0.111111 -0.611111 0.055556 -0.611111 0.055556 -0.666667 0.111111 -0.611111 0.055556 -0.666667 0.111111 -0.666667 + 0.166667 -0.611111 0.111111 -0.611111 0.111111 -0.666667 0.166667 -0.611111 0.111111 -0.666667 0.166667 -0.666667 + 0.222222 -0.611111 0.166667 -0.611111 0.166667 -0.666667 0.222222 -0.611111 0.166667 -0.666667 0.222222 -0.666667 + 0.277778 -0.611111 0.222222 -0.611111 0.222222 -0.666667 0.277778 -0.611111 0.222222 -0.666667 0.277778 -0.666667 + 0.333333 -0.611111 0.277778 -0.611111 0.277778 -0.666667 0.333333 -0.611111 0.277778 -0.666667 0.333333 -0.666667 + 0.388889 -0.611111 0.333333 -0.611111 0.333333 -0.666667 0.388889 -0.611111 0.333333 -0.666667 0.388889 -0.666667 + 0.444444 -0.611111 0.388889 -0.611111 0.388889 -0.666667 0.444444 -0.611111 0.388889 -0.666667 0.444444 -0.666667 + 0.500000 -0.611111 0.444444 -0.611111 0.444444 -0.666667 0.500000 -0.611111 0.444444 -0.666667 0.500000 -0.666667 + 0.555556 -0.611111 0.500000 -0.611111 0.500000 -0.666667 0.555556 -0.611111 0.500000 -0.666667 0.555556 -0.666667 + 0.611111 -0.611111 0.555556 -0.611111 0.555556 -0.666667 0.611111 -0.611111 0.555556 -0.666667 0.611111 -0.666667 + 0.666667 -0.611111 0.611111 -0.611111 0.611111 -0.666667 0.666667 -0.611111 0.611111 -0.666667 0.666667 -0.666667 + 0.722222 -0.611111 0.666667 -0.611111 0.666667 -0.666667 0.722222 -0.611111 0.666667 -0.666667 0.722222 -0.666667 + 0.777778 -0.611111 0.722222 -0.611111 0.722222 -0.666667 0.777778 -0.611111 0.722222 -0.666667 0.777778 -0.666667 + 0.833333 -0.611111 0.777778 -0.611111 0.777778 -0.666667 0.833333 -0.611111 0.777778 -0.666667 0.833333 -0.666667 + 0.888889 -0.611111 0.833333 -0.611111 0.833333 -0.666667 0.888889 -0.611111 0.833333 -0.666667 0.888889 -0.666667 + 0.944444 -0.611111 0.888889 -0.611111 0.888889 -0.666667 0.944444 -0.611111 0.888889 -0.666667 0.944444 -0.666667 + 1.000000 -0.611111 0.944444 -0.611111 0.944444 -0.666667 1.000000 -0.611111 0.944444 -0.666667 1.000000 -0.666667 +-0.944444 -0.555556 -1.000000 -0.555556 -1.000000 -0.611111 -0.944444 -0.555556 -1.000000 -0.611111 -0.944444 -0.611111 +-0.888889 -0.555556 -0.944444 -0.555556 -0.944444 -0.611111 -0.888889 -0.555556 -0.944444 -0.611111 -0.888889 -0.611111 +-0.833333 -0.555556 -0.888889 -0.555556 -0.888889 -0.611111 -0.833333 -0.555556 -0.888889 -0.611111 -0.833333 -0.611111 +-0.777778 -0.555556 -0.833333 -0.555556 -0.833333 -0.611111 -0.777778 -0.555556 -0.833333 -0.611111 -0.777778 -0.611111 +-0.722222 -0.555556 -0.777778 -0.555556 -0.777778 -0.611111 -0.722222 -0.555556 -0.777778 -0.611111 -0.722222 -0.611111 +-0.666667 -0.555556 -0.722222 -0.555556 -0.722222 -0.611111 -0.666667 -0.555556 -0.722222 -0.611111 -0.666667 -0.611111 +-0.611111 -0.555556 -0.666667 -0.555556 -0.666667 -0.611111 -0.611111 -0.555556 -0.666667 -0.611111 -0.611111 -0.611111 +-0.555556 -0.555556 -0.611111 -0.555556 -0.611111 -0.611111 -0.555556 -0.555556 -0.611111 -0.611111 -0.555556 -0.611111 +-0.500000 -0.555556 -0.555556 -0.555556 -0.555556 -0.611111 -0.500000 -0.555556 -0.555556 -0.611111 -0.500000 -0.611111 +-0.444444 -0.555556 -0.500000 -0.555556 -0.500000 -0.611111 -0.444444 -0.555556 -0.500000 -0.611111 -0.444444 -0.611111 +-0.388889 -0.555556 -0.444444 -0.555556 -0.444444 -0.611111 -0.388889 -0.555556 -0.444444 -0.611111 -0.388889 -0.611111 +-0.333333 -0.555556 -0.388889 -0.555556 -0.388889 -0.611111 -0.333333 -0.555556 -0.388889 -0.611111 -0.333333 -0.611111 +-0.277778 -0.555556 -0.333333 -0.555556 -0.333333 -0.611111 -0.277778 -0.555556 -0.333333 -0.611111 -0.277778 -0.611111 +-0.222222 -0.555556 -0.277778 -0.555556 -0.277778 -0.611111 -0.222222 -0.555556 -0.277778 -0.611111 -0.222222 -0.611111 +-0.166667 -0.555556 -0.222222 -0.555556 -0.222222 -0.611111 -0.166667 -0.555556 -0.222222 -0.611111 -0.166667 -0.611111 +-0.111111 -0.555556 -0.166667 -0.555556 -0.166667 -0.611111 -0.111111 -0.555556 -0.166667 -0.611111 -0.111111 -0.611111 +-0.055556 -0.555556 -0.111111 -0.555556 -0.111111 -0.611111 -0.055556 -0.555556 -0.111111 -0.611111 -0.055556 -0.611111 + 0.000000 -0.555556 -0.055556 -0.555556 -0.055556 -0.611111 0.000000 -0.555556 -0.055556 -0.611111 0.000000 -0.611111 + 0.055556 -0.555556 0.000000 -0.555556 0.000000 -0.611111 0.055556 -0.555556 0.000000 -0.611111 0.055556 -0.611111 + 0.111111 -0.555556 0.055556 -0.555556 0.055556 -0.611111 0.111111 -0.555556 0.055556 -0.611111 0.111111 -0.611111 + 0.166667 -0.555556 0.111111 -0.555556 0.111111 -0.611111 0.166667 -0.555556 0.111111 -0.611111 0.166667 -0.611111 + 0.222222 -0.555556 0.166667 -0.555556 0.166667 -0.611111 0.222222 -0.555556 0.166667 -0.611111 0.222222 -0.611111 + 0.277778 -0.555556 0.222222 -0.555556 0.222222 -0.611111 0.277778 -0.555556 0.222222 -0.611111 0.277778 -0.611111 + 0.333333 -0.555556 0.277778 -0.555556 0.277778 -0.611111 0.333333 -0.555556 0.277778 -0.611111 0.333333 -0.611111 + 0.388889 -0.555556 0.333333 -0.555556 0.333333 -0.611111 0.388889 -0.555556 0.333333 -0.611111 0.388889 -0.611111 + 0.444444 -0.555556 0.388889 -0.555556 0.388889 -0.611111 0.444444 -0.555556 0.388889 -0.611111 0.444444 -0.611111 + 0.500000 -0.555556 0.444444 -0.555556 0.444444 -0.611111 0.500000 -0.555556 0.444444 -0.611111 0.500000 -0.611111 + 0.555556 -0.555556 0.500000 -0.555556 0.500000 -0.611111 0.555556 -0.555556 0.500000 -0.611111 0.555556 -0.611111 + 0.611111 -0.555556 0.555556 -0.555556 0.555556 -0.611111 0.611111 -0.555556 0.555556 -0.611111 0.611111 -0.611111 + 0.666667 -0.555556 0.611111 -0.555556 0.611111 -0.611111 0.666667 -0.555556 0.611111 -0.611111 0.666667 -0.611111 + 0.722222 -0.555556 0.666667 -0.555556 0.666667 -0.611111 0.722222 -0.555556 0.666667 -0.611111 0.722222 -0.611111 + 0.777778 -0.555556 0.722222 -0.555556 0.722222 -0.611111 0.777778 -0.555556 0.722222 -0.611111 0.777778 -0.611111 + 0.833333 -0.555556 0.777778 -0.555556 0.777778 -0.611111 0.833333 -0.555556 0.777778 -0.611111 0.833333 -0.611111 + 0.888889 -0.555556 0.833333 -0.555556 0.833333 -0.611111 0.888889 -0.555556 0.833333 -0.611111 0.888889 -0.611111 + 0.944444 -0.555556 0.888889 -0.555556 0.888889 -0.611111 0.944444 -0.555556 0.888889 -0.611111 0.944444 -0.611111 + 1.000000 -0.555556 0.944444 -0.555556 0.944444 -0.611111 1.000000 -0.555556 0.944444 -0.611111 1.000000 -0.611111 +-0.944444 -0.500000 -1.000000 -0.500000 -1.000000 -0.555556 -0.944444 -0.500000 -1.000000 -0.555556 -0.944444 -0.555556 +-0.888889 -0.500000 -0.944444 -0.500000 -0.944444 -0.555556 -0.888889 -0.500000 -0.944444 -0.555556 -0.888889 -0.555556 +-0.833333 -0.500000 -0.888889 -0.500000 -0.888889 -0.555556 -0.833333 -0.500000 -0.888889 -0.555556 -0.833333 -0.555556 +-0.777778 -0.500000 -0.833333 -0.500000 -0.833333 -0.555556 -0.777778 -0.500000 -0.833333 -0.555556 -0.777778 -0.555556 +-0.722222 -0.500000 -0.777778 -0.500000 -0.777778 -0.555556 -0.722222 -0.500000 -0.777778 -0.555556 -0.722222 -0.555556 +-0.666667 -0.500000 -0.722222 -0.500000 -0.722222 -0.555556 -0.666667 -0.500000 -0.722222 -0.555556 -0.666667 -0.555556 +-0.611111 -0.500000 -0.666667 -0.500000 -0.666667 -0.555556 -0.611111 -0.500000 -0.666667 -0.555556 -0.611111 -0.555556 +-0.555556 -0.500000 -0.611111 -0.500000 -0.611111 -0.555556 -0.555556 -0.500000 -0.611111 -0.555556 -0.555556 -0.555556 +-0.500000 -0.500000 -0.555556 -0.500000 -0.555556 -0.555556 -0.500000 -0.500000 -0.555556 -0.555556 -0.500000 -0.555556 +-0.444444 -0.500000 -0.500000 -0.500000 -0.500000 -0.555556 -0.444444 -0.500000 -0.500000 -0.555556 -0.444444 -0.555556 +-0.388889 -0.500000 -0.444444 -0.500000 -0.444444 -0.555556 -0.388889 -0.500000 -0.444444 -0.555556 -0.388889 -0.555556 +-0.333333 -0.500000 -0.388889 -0.500000 -0.388889 -0.555556 -0.333333 -0.500000 -0.388889 -0.555556 -0.333333 -0.555556 +-0.277778 -0.500000 -0.333333 -0.500000 -0.333333 -0.555556 -0.277778 -0.500000 -0.333333 -0.555556 -0.277778 -0.555556 +-0.222222 -0.500000 -0.277778 -0.500000 -0.277778 -0.555556 -0.222222 -0.500000 -0.277778 -0.555556 -0.222222 -0.555556 +-0.166667 -0.500000 -0.222222 -0.500000 -0.222222 -0.555556 -0.166667 -0.500000 -0.222222 -0.555556 -0.166667 -0.555556 +-0.111111 -0.500000 -0.166667 -0.500000 -0.166667 -0.555556 -0.111111 -0.500000 -0.166667 -0.555556 -0.111111 -0.555556 +-0.055556 -0.500000 -0.111111 -0.500000 -0.111111 -0.555556 -0.055556 -0.500000 -0.111111 -0.555556 -0.055556 -0.555556 + 0.000000 -0.500000 -0.055556 -0.500000 -0.055556 -0.555556 0.000000 -0.500000 -0.055556 -0.555556 0.000000 -0.555556 + 0.055556 -0.500000 0.000000 -0.500000 0.000000 -0.555556 0.055556 -0.500000 0.000000 -0.555556 0.055556 -0.555556 + 0.111111 -0.500000 0.055556 -0.500000 0.055556 -0.555556 0.111111 -0.500000 0.055556 -0.555556 0.111111 -0.555556 + 0.166667 -0.500000 0.111111 -0.500000 0.111111 -0.555556 0.166667 -0.500000 0.111111 -0.555556 0.166667 -0.555556 + 0.222222 -0.500000 0.166667 -0.500000 0.166667 -0.555556 0.222222 -0.500000 0.166667 -0.555556 0.222222 -0.555556 + 0.277778 -0.500000 0.222222 -0.500000 0.222222 -0.555556 0.277778 -0.500000 0.222222 -0.555556 0.277778 -0.555556 + 0.333333 -0.500000 0.277778 -0.500000 0.277778 -0.555556 0.333333 -0.500000 0.277778 -0.555556 0.333333 -0.555556 + 0.388889 -0.500000 0.333333 -0.500000 0.333333 -0.555556 0.388889 -0.500000 0.333333 -0.555556 0.388889 -0.555556 + 0.444444 -0.500000 0.388889 -0.500000 0.388889 -0.555556 0.444444 -0.500000 0.388889 -0.555556 0.444444 -0.555556 + 0.500000 -0.500000 0.444444 -0.500000 0.444444 -0.555556 0.500000 -0.500000 0.444444 -0.555556 0.500000 -0.555556 + 0.555556 -0.500000 0.500000 -0.500000 0.500000 -0.555556 0.555556 -0.500000 0.500000 -0.555556 0.555556 -0.555556 + 0.611111 -0.500000 0.555556 -0.500000 0.555556 -0.555556 0.611111 -0.500000 0.555556 -0.555556 0.611111 -0.555556 + 0.666667 -0.500000 0.611111 -0.500000 0.611111 -0.555556 0.666667 -0.500000 0.611111 -0.555556 0.666667 -0.555556 + 0.722222 -0.500000 0.666667 -0.500000 0.666667 -0.555556 0.722222 -0.500000 0.666667 -0.555556 0.722222 -0.555556 + 0.777778 -0.500000 0.722222 -0.500000 0.722222 -0.555556 0.777778 -0.500000 0.722222 -0.555556 0.777778 -0.555556 + 0.833333 -0.500000 0.777778 -0.500000 0.777778 -0.555556 0.833333 -0.500000 0.777778 -0.555556 0.833333 -0.555556 + 0.888889 -0.500000 0.833333 -0.500000 0.833333 -0.555556 0.888889 -0.500000 0.833333 -0.555556 0.888889 -0.555556 + 0.944444 -0.500000 0.888889 -0.500000 0.888889 -0.555556 0.944444 -0.500000 0.888889 -0.555556 0.944444 -0.555556 + 1.000000 -0.500000 0.944444 -0.500000 0.944444 -0.555556 1.000000 -0.500000 0.944444 -0.555556 1.000000 -0.555556 +-0.944444 -0.444444 -1.000000 -0.444444 -1.000000 -0.500000 -0.944444 -0.444444 -1.000000 -0.500000 -0.944444 -0.500000 +-0.888889 -0.444444 -0.944444 -0.444444 -0.944444 -0.500000 -0.888889 -0.444444 -0.944444 -0.500000 -0.888889 -0.500000 +-0.833333 -0.444444 -0.888889 -0.444444 -0.888889 -0.500000 -0.833333 -0.444444 -0.888889 -0.500000 -0.833333 -0.500000 +-0.777778 -0.444444 -0.833333 -0.444444 -0.833333 -0.500000 -0.777778 -0.444444 -0.833333 -0.500000 -0.777778 -0.500000 +-0.722222 -0.444444 -0.777778 -0.444444 -0.777778 -0.500000 -0.722222 -0.444444 -0.777778 -0.500000 -0.722222 -0.500000 +-0.666667 -0.444444 -0.722222 -0.444444 -0.722222 -0.500000 -0.666667 -0.444444 -0.722222 -0.500000 -0.666667 -0.500000 +-0.611111 -0.444444 -0.666667 -0.444444 -0.666667 -0.500000 -0.611111 -0.444444 -0.666667 -0.500000 -0.611111 -0.500000 +-0.555556 -0.444444 -0.611111 -0.444444 -0.611111 -0.500000 -0.555556 -0.444444 -0.611111 -0.500000 -0.555556 -0.500000 +-0.500000 -0.444444 -0.555556 -0.444444 -0.555556 -0.500000 -0.500000 -0.444444 -0.555556 -0.500000 -0.500000 -0.500000 +-0.444444 -0.444444 -0.500000 -0.444444 -0.500000 -0.500000 -0.444444 -0.444444 -0.500000 -0.500000 -0.444444 -0.500000 +-0.388889 -0.444444 -0.444444 -0.444444 -0.444444 -0.500000 -0.388889 -0.444444 -0.444444 -0.500000 -0.388889 -0.500000 +-0.333333 -0.444444 -0.388889 -0.444444 -0.388889 -0.500000 -0.333333 -0.444444 -0.388889 -0.500000 -0.333333 -0.500000 +-0.277778 -0.444444 -0.333333 -0.444444 -0.333333 -0.500000 -0.277778 -0.444444 -0.333333 -0.500000 -0.277778 -0.500000 +-0.222222 -0.444444 -0.277778 -0.444444 -0.277778 -0.500000 -0.222222 -0.444444 -0.277778 -0.500000 -0.222222 -0.500000 +-0.166667 -0.444444 -0.222222 -0.444444 -0.222222 -0.500000 -0.166667 -0.444444 -0.222222 -0.500000 -0.166667 -0.500000 +-0.111111 -0.444444 -0.166667 -0.444444 -0.166667 -0.500000 -0.111111 -0.444444 -0.166667 -0.500000 -0.111111 -0.500000 +-0.055556 -0.444444 -0.111111 -0.444444 -0.111111 -0.500000 -0.055556 -0.444444 -0.111111 -0.500000 -0.055556 -0.500000 + 0.000000 -0.444444 -0.055556 -0.444444 -0.055556 -0.500000 0.000000 -0.444444 -0.055556 -0.500000 0.000000 -0.500000 + 0.055556 -0.444444 0.000000 -0.444444 0.000000 -0.500000 0.055556 -0.444444 0.000000 -0.500000 0.055556 -0.500000 + 0.111111 -0.444444 0.055556 -0.444444 0.055556 -0.500000 0.111111 -0.444444 0.055556 -0.500000 0.111111 -0.500000 + 0.166667 -0.444444 0.111111 -0.444444 0.111111 -0.500000 0.166667 -0.444444 0.111111 -0.500000 0.166667 -0.500000 + 0.222222 -0.444444 0.166667 -0.444444 0.166667 -0.500000 0.222222 -0.444444 0.166667 -0.500000 0.222222 -0.500000 + 0.277778 -0.444444 0.222222 -0.444444 0.222222 -0.500000 0.277778 -0.444444 0.222222 -0.500000 0.277778 -0.500000 + 0.333333 -0.444444 0.277778 -0.444444 0.277778 -0.500000 0.333333 -0.444444 0.277778 -0.500000 0.333333 -0.500000 + 0.388889 -0.444444 0.333333 -0.444444 0.333333 -0.500000 0.388889 -0.444444 0.333333 -0.500000 0.388889 -0.500000 + 0.444444 -0.444444 0.388889 -0.444444 0.388889 -0.500000 0.444444 -0.444444 0.388889 -0.500000 0.444444 -0.500000 + 0.500000 -0.444444 0.444444 -0.444444 0.444444 -0.500000 0.500000 -0.444444 0.444444 -0.500000 0.500000 -0.500000 + 0.555556 -0.444444 0.500000 -0.444444 0.500000 -0.500000 0.555556 -0.444444 0.500000 -0.500000 0.555556 -0.500000 + 0.611111 -0.444444 0.555556 -0.444444 0.555556 -0.500000 0.611111 -0.444444 0.555556 -0.500000 0.611111 -0.500000 + 0.666667 -0.444444 0.611111 -0.444444 0.611111 -0.500000 0.666667 -0.444444 0.611111 -0.500000 0.666667 -0.500000 + 0.722222 -0.444444 0.666667 -0.444444 0.666667 -0.500000 0.722222 -0.444444 0.666667 -0.500000 0.722222 -0.500000 + 0.777778 -0.444444 0.722222 -0.444444 0.722222 -0.500000 0.777778 -0.444444 0.722222 -0.500000 0.777778 -0.500000 + 0.833333 -0.444444 0.777778 -0.444444 0.777778 -0.500000 0.833333 -0.444444 0.777778 -0.500000 0.833333 -0.500000 + 0.888889 -0.444444 0.833333 -0.444444 0.833333 -0.500000 0.888889 -0.444444 0.833333 -0.500000 0.888889 -0.500000 + 0.944444 -0.444444 0.888889 -0.444444 0.888889 -0.500000 0.944444 -0.444444 0.888889 -0.500000 0.944444 -0.500000 + 1.000000 -0.444444 0.944444 -0.444444 0.944444 -0.500000 1.000000 -0.444444 0.944444 -0.500000 1.000000 -0.500000 +-0.944444 -0.388889 -1.000000 -0.388889 -1.000000 -0.444444 -0.944444 -0.388889 -1.000000 -0.444444 -0.944444 -0.444444 +-0.888889 -0.388889 -0.944444 -0.388889 -0.944444 -0.444444 -0.888889 -0.388889 -0.944444 -0.444444 -0.888889 -0.444444 +-0.833333 -0.388889 -0.888889 -0.388889 -0.888889 -0.444444 -0.833333 -0.388889 -0.888889 -0.444444 -0.833333 -0.444444 +-0.777778 -0.388889 -0.833333 -0.388889 -0.833333 -0.444444 -0.777778 -0.388889 -0.833333 -0.444444 -0.777778 -0.444444 +-0.722222 -0.388889 -0.777778 -0.388889 -0.777778 -0.444444 -0.722222 -0.388889 -0.777778 -0.444444 -0.722222 -0.444444 +-0.666667 -0.388889 -0.722222 -0.388889 -0.722222 -0.444444 -0.666667 -0.388889 -0.722222 -0.444444 -0.666667 -0.444444 +-0.611111 -0.388889 -0.666667 -0.388889 -0.666667 -0.444444 -0.611111 -0.388889 -0.666667 -0.444444 -0.611111 -0.444444 +-0.555556 -0.388889 -0.611111 -0.388889 -0.611111 -0.444444 -0.555556 -0.388889 -0.611111 -0.444444 -0.555556 -0.444444 +-0.500000 -0.388889 -0.555556 -0.388889 -0.555556 -0.444444 -0.500000 -0.388889 -0.555556 -0.444444 -0.500000 -0.444444 +-0.444444 -0.388889 -0.500000 -0.388889 -0.500000 -0.444444 -0.444444 -0.388889 -0.500000 -0.444444 -0.444444 -0.444444 +-0.388889 -0.388889 -0.444444 -0.388889 -0.444444 -0.444444 -0.388889 -0.388889 -0.444444 -0.444444 -0.388889 -0.444444 +-0.333333 -0.388889 -0.388889 -0.388889 -0.388889 -0.444444 -0.333333 -0.388889 -0.388889 -0.444444 -0.333333 -0.444444 +-0.277778 -0.388889 -0.333333 -0.388889 -0.333333 -0.444444 -0.277778 -0.388889 -0.333333 -0.444444 -0.277778 -0.444444 +-0.222222 -0.388889 -0.277778 -0.388889 -0.277778 -0.444444 -0.222222 -0.388889 -0.277778 -0.444444 -0.222222 -0.444444 +-0.166667 -0.388889 -0.222222 -0.388889 -0.222222 -0.444444 -0.166667 -0.388889 -0.222222 -0.444444 -0.166667 -0.444444 +-0.111111 -0.388889 -0.166667 -0.388889 -0.166667 -0.444444 -0.111111 -0.388889 -0.166667 -0.444444 -0.111111 -0.444444 +-0.055556 -0.388889 -0.111111 -0.388889 -0.111111 -0.444444 -0.055556 -0.388889 -0.111111 -0.444444 -0.055556 -0.444444 + 0.000000 -0.388889 -0.055556 -0.388889 -0.055556 -0.444444 0.000000 -0.388889 -0.055556 -0.444444 0.000000 -0.444444 + 0.055556 -0.388889 0.000000 -0.388889 0.000000 -0.444444 0.055556 -0.388889 0.000000 -0.444444 0.055556 -0.444444 + 0.111111 -0.388889 0.055556 -0.388889 0.055556 -0.444444 0.111111 -0.388889 0.055556 -0.444444 0.111111 -0.444444 + 0.166667 -0.388889 0.111111 -0.388889 0.111111 -0.444444 0.166667 -0.388889 0.111111 -0.444444 0.166667 -0.444444 + 0.222222 -0.388889 0.166667 -0.388889 0.166667 -0.444444 0.222222 -0.388889 0.166667 -0.444444 0.222222 -0.444444 + 0.277778 -0.388889 0.222222 -0.388889 0.222222 -0.444444 0.277778 -0.388889 0.222222 -0.444444 0.277778 -0.444444 + 0.333333 -0.388889 0.277778 -0.388889 0.277778 -0.444444 0.333333 -0.388889 0.277778 -0.444444 0.333333 -0.444444 + 0.388889 -0.388889 0.333333 -0.388889 0.333333 -0.444444 0.388889 -0.388889 0.333333 -0.444444 0.388889 -0.444444 + 0.444444 -0.388889 0.388889 -0.388889 0.388889 -0.444444 0.444444 -0.388889 0.388889 -0.444444 0.444444 -0.444444 + 0.500000 -0.388889 0.444444 -0.388889 0.444444 -0.444444 0.500000 -0.388889 0.444444 -0.444444 0.500000 -0.444444 + 0.555556 -0.388889 0.500000 -0.388889 0.500000 -0.444444 0.555556 -0.388889 0.500000 -0.444444 0.555556 -0.444444 + 0.611111 -0.388889 0.555556 -0.388889 0.555556 -0.444444 0.611111 -0.388889 0.555556 -0.444444 0.611111 -0.444444 + 0.666667 -0.388889 0.611111 -0.388889 0.611111 -0.444444 0.666667 -0.388889 0.611111 -0.444444 0.666667 -0.444444 + 0.722222 -0.388889 0.666667 -0.388889 0.666667 -0.444444 0.722222 -0.388889 0.666667 -0.444444 0.722222 -0.444444 + 0.777778 -0.388889 0.722222 -0.388889 0.722222 -0.444444 0.777778 -0.388889 0.722222 -0.444444 0.777778 -0.444444 + 0.833333 -0.388889 0.777778 -0.388889 0.777778 -0.444444 0.833333 -0.388889 0.777778 -0.444444 0.833333 -0.444444 + 0.888889 -0.388889 0.833333 -0.388889 0.833333 -0.444444 0.888889 -0.388889 0.833333 -0.444444 0.888889 -0.444444 + 0.944444 -0.388889 0.888889 -0.388889 0.888889 -0.444444 0.944444 -0.388889 0.888889 -0.444444 0.944444 -0.444444 + 1.000000 -0.388889 0.944444 -0.388889 0.944444 -0.444444 1.000000 -0.388889 0.944444 -0.444444 1.000000 -0.444444 +-0.944444 -0.333333 -1.000000 -0.333333 -1.000000 -0.388889 -0.944444 -0.333333 -1.000000 -0.388889 -0.944444 -0.388889 +-0.888889 -0.333333 -0.944444 -0.333333 -0.944444 -0.388889 -0.888889 -0.333333 -0.944444 -0.388889 -0.888889 -0.388889 +-0.833333 -0.333333 -0.888889 -0.333333 -0.888889 -0.388889 -0.833333 -0.333333 -0.888889 -0.388889 -0.833333 -0.388889 +-0.777778 -0.333333 -0.833333 -0.333333 -0.833333 -0.388889 -0.777778 -0.333333 -0.833333 -0.388889 -0.777778 -0.388889 +-0.722222 -0.333333 -0.777778 -0.333333 -0.777778 -0.388889 -0.722222 -0.333333 -0.777778 -0.388889 -0.722222 -0.388889 +-0.666667 -0.333333 -0.722222 -0.333333 -0.722222 -0.388889 -0.666667 -0.333333 -0.722222 -0.388889 -0.666667 -0.388889 +-0.611111 -0.333333 -0.666667 -0.333333 -0.666667 -0.388889 -0.611111 -0.333333 -0.666667 -0.388889 -0.611111 -0.388889 +-0.555556 -0.333333 -0.611111 -0.333333 -0.611111 -0.388889 -0.555556 -0.333333 -0.611111 -0.388889 -0.555556 -0.388889 +-0.500000 -0.333333 -0.555556 -0.333333 -0.555556 -0.388889 -0.500000 -0.333333 -0.555556 -0.388889 -0.500000 -0.388889 +-0.444444 -0.333333 -0.500000 -0.333333 -0.500000 -0.388889 -0.444444 -0.333333 -0.500000 -0.388889 -0.444444 -0.388889 +-0.388889 -0.333333 -0.444444 -0.333333 -0.444444 -0.388889 -0.388889 -0.333333 -0.444444 -0.388889 -0.388889 -0.388889 +-0.333333 -0.333333 -0.388889 -0.333333 -0.388889 -0.388889 -0.333333 -0.333333 -0.388889 -0.388889 -0.333333 -0.388889 +-0.277778 -0.333333 -0.333333 -0.333333 -0.333333 -0.388889 -0.277778 -0.333333 -0.333333 -0.388889 -0.277778 -0.388889 +-0.222222 -0.333333 -0.277778 -0.333333 -0.277778 -0.388889 -0.222222 -0.333333 -0.277778 -0.388889 -0.222222 -0.388889 +-0.166667 -0.333333 -0.222222 -0.333333 -0.222222 -0.388889 -0.166667 -0.333333 -0.222222 -0.388889 -0.166667 -0.388889 +-0.111111 -0.333333 -0.166667 -0.333333 -0.166667 -0.388889 -0.111111 -0.333333 -0.166667 -0.388889 -0.111111 -0.388889 +-0.055556 -0.333333 -0.111111 -0.333333 -0.111111 -0.388889 -0.055556 -0.333333 -0.111111 -0.388889 -0.055556 -0.388889 + 0.000000 -0.333333 -0.055556 -0.333333 -0.055556 -0.388889 0.000000 -0.333333 -0.055556 -0.388889 0.000000 -0.388889 + 0.055556 -0.333333 0.000000 -0.333333 0.000000 -0.388889 0.055556 -0.333333 0.000000 -0.388889 0.055556 -0.388889 + 0.111111 -0.333333 0.055556 -0.333333 0.055556 -0.388889 0.111111 -0.333333 0.055556 -0.388889 0.111111 -0.388889 + 0.166667 -0.333333 0.111111 -0.333333 0.111111 -0.388889 0.166667 -0.333333 0.111111 -0.388889 0.166667 -0.388889 + 0.222222 -0.333333 0.166667 -0.333333 0.166667 -0.388889 0.222222 -0.333333 0.166667 -0.388889 0.222222 -0.388889 + 0.277778 -0.333333 0.222222 -0.333333 0.222222 -0.388889 0.277778 -0.333333 0.222222 -0.388889 0.277778 -0.388889 + 0.333333 -0.333333 0.277778 -0.333333 0.277778 -0.388889 0.333333 -0.333333 0.277778 -0.388889 0.333333 -0.388889 + 0.388889 -0.333333 0.333333 -0.333333 0.333333 -0.388889 0.388889 -0.333333 0.333333 -0.388889 0.388889 -0.388889 + 0.444444 -0.333333 0.388889 -0.333333 0.388889 -0.388889 0.444444 -0.333333 0.388889 -0.388889 0.444444 -0.388889 + 0.500000 -0.333333 0.444444 -0.333333 0.444444 -0.388889 0.500000 -0.333333 0.444444 -0.388889 0.500000 -0.388889 + 0.555556 -0.333333 0.500000 -0.333333 0.500000 -0.388889 0.555556 -0.333333 0.500000 -0.388889 0.555556 -0.388889 + 0.611111 -0.333333 0.555556 -0.333333 0.555556 -0.388889 0.611111 -0.333333 0.555556 -0.388889 0.611111 -0.388889 + 0.666667 -0.333333 0.611111 -0.333333 0.611111 -0.388889 0.666667 -0.333333 0.611111 -0.388889 0.666667 -0.388889 + 0.722222 -0.333333 0.666667 -0.333333 0.666667 -0.388889 0.722222 -0.333333 0.666667 -0.388889 0.722222 -0.388889 + 0.777778 -0.333333 0.722222 -0.333333 0.722222 -0.388889 0.777778 -0.333333 0.722222 -0.388889 0.777778 -0.388889 + 0.833333 -0.333333 0.777778 -0.333333 0.777778 -0.388889 0.833333 -0.333333 0.777778 -0.388889 0.833333 -0.388889 + 0.888889 -0.333333 0.833333 -0.333333 0.833333 -0.388889 0.888889 -0.333333 0.833333 -0.388889 0.888889 -0.388889 + 0.944444 -0.333333 0.888889 -0.333333 0.888889 -0.388889 0.944444 -0.333333 0.888889 -0.388889 0.944444 -0.388889 + 1.000000 -0.333333 0.944444 -0.333333 0.944444 -0.388889 1.000000 -0.333333 0.944444 -0.388889 1.000000 -0.388889 +-0.944444 -0.277778 -1.000000 -0.277778 -1.000000 -0.333333 -0.944444 -0.277778 -1.000000 -0.333333 -0.944444 -0.333333 +-0.888889 -0.277778 -0.944444 -0.277778 -0.944444 -0.333333 -0.888889 -0.277778 -0.944444 -0.333333 -0.888889 -0.333333 +-0.833333 -0.277778 -0.888889 -0.277778 -0.888889 -0.333333 -0.833333 -0.277778 -0.888889 -0.333333 -0.833333 -0.333333 +-0.777778 -0.277778 -0.833333 -0.277778 -0.833333 -0.333333 -0.777778 -0.277778 -0.833333 -0.333333 -0.777778 -0.333333 +-0.722222 -0.277778 -0.777778 -0.277778 -0.777778 -0.333333 -0.722222 -0.277778 -0.777778 -0.333333 -0.722222 -0.333333 +-0.666667 -0.277778 -0.722222 -0.277778 -0.722222 -0.333333 -0.666667 -0.277778 -0.722222 -0.333333 -0.666667 -0.333333 +-0.611111 -0.277778 -0.666667 -0.277778 -0.666667 -0.333333 -0.611111 -0.277778 -0.666667 -0.333333 -0.611111 -0.333333 +-0.555556 -0.277778 -0.611111 -0.277778 -0.611111 -0.333333 -0.555556 -0.277778 -0.611111 -0.333333 -0.555556 -0.333333 +-0.500000 -0.277778 -0.555556 -0.277778 -0.555556 -0.333333 -0.500000 -0.277778 -0.555556 -0.333333 -0.500000 -0.333333 +-0.444444 -0.277778 -0.500000 -0.277778 -0.500000 -0.333333 -0.444444 -0.277778 -0.500000 -0.333333 -0.444444 -0.333333 +-0.388889 -0.277778 -0.444444 -0.277778 -0.444444 -0.333333 -0.388889 -0.277778 -0.444444 -0.333333 -0.388889 -0.333333 +-0.333333 -0.277778 -0.388889 -0.277778 -0.388889 -0.333333 -0.333333 -0.277778 -0.388889 -0.333333 -0.333333 -0.333333 +-0.277778 -0.277778 -0.333333 -0.277778 -0.333333 -0.333333 -0.277778 -0.277778 -0.333333 -0.333333 -0.277778 -0.333333 +-0.222222 -0.277778 -0.277778 -0.277778 -0.277778 -0.333333 -0.222222 -0.277778 -0.277778 -0.333333 -0.222222 -0.333333 +-0.166667 -0.277778 -0.222222 -0.277778 -0.222222 -0.333333 -0.166667 -0.277778 -0.222222 -0.333333 -0.166667 -0.333333 +-0.111111 -0.277778 -0.166667 -0.277778 -0.166667 -0.333333 -0.111111 -0.277778 -0.166667 -0.333333 -0.111111 -0.333333 +-0.055556 -0.277778 -0.111111 -0.277778 -0.111111 -0.333333 -0.055556 -0.277778 -0.111111 -0.333333 -0.055556 -0.333333 + 0.000000 -0.277778 -0.055556 -0.277778 -0.055556 -0.333333 0.000000 -0.277778 -0.055556 -0.333333 0.000000 -0.333333 + 0.055556 -0.277778 0.000000 -0.277778 0.000000 -0.333333 0.055556 -0.277778 0.000000 -0.333333 0.055556 -0.333333 + 0.111111 -0.277778 0.055556 -0.277778 0.055556 -0.333333 0.111111 -0.277778 0.055556 -0.333333 0.111111 -0.333333 + 0.166667 -0.277778 0.111111 -0.277778 0.111111 -0.333333 0.166667 -0.277778 0.111111 -0.333333 0.166667 -0.333333 + 0.222222 -0.277778 0.166667 -0.277778 0.166667 -0.333333 0.222222 -0.277778 0.166667 -0.333333 0.222222 -0.333333 + 0.277778 -0.277778 0.222222 -0.277778 0.222222 -0.333333 0.277778 -0.277778 0.222222 -0.333333 0.277778 -0.333333 + 0.333333 -0.277778 0.277778 -0.277778 0.277778 -0.333333 0.333333 -0.277778 0.277778 -0.333333 0.333333 -0.333333 + 0.388889 -0.277778 0.333333 -0.277778 0.333333 -0.333333 0.388889 -0.277778 0.333333 -0.333333 0.388889 -0.333333 + 0.444444 -0.277778 0.388889 -0.277778 0.388889 -0.333333 0.444444 -0.277778 0.388889 -0.333333 0.444444 -0.333333 + 0.500000 -0.277778 0.444444 -0.277778 0.444444 -0.333333 0.500000 -0.277778 0.444444 -0.333333 0.500000 -0.333333 + 0.555556 -0.277778 0.500000 -0.277778 0.500000 -0.333333 0.555556 -0.277778 0.500000 -0.333333 0.555556 -0.333333 + 0.611111 -0.277778 0.555556 -0.277778 0.555556 -0.333333 0.611111 -0.277778 0.555556 -0.333333 0.611111 -0.333333 + 0.666667 -0.277778 0.611111 -0.277778 0.611111 -0.333333 0.666667 -0.277778 0.611111 -0.333333 0.666667 -0.333333 + 0.722222 -0.277778 0.666667 -0.277778 0.666667 -0.333333 0.722222 -0.277778 0.666667 -0.333333 0.722222 -0.333333 + 0.777778 -0.277778 0.722222 -0.277778 0.722222 -0.333333 0.777778 -0.277778 0.722222 -0.333333 0.777778 -0.333333 + 0.833333 -0.277778 0.777778 -0.277778 0.777778 -0.333333 0.833333 -0.277778 0.777778 -0.333333 0.833333 -0.333333 + 0.888889 -0.277778 0.833333 -0.277778 0.833333 -0.333333 0.888889 -0.277778 0.833333 -0.333333 0.888889 -0.333333 + 0.944444 -0.277778 0.888889 -0.277778 0.888889 -0.333333 0.944444 -0.277778 0.888889 -0.333333 0.944444 -0.333333 + 1.000000 -0.277778 0.944444 -0.277778 0.944444 -0.333333 1.000000 -0.277778 0.944444 -0.333333 1.000000 -0.333333 +-0.944444 -0.222222 -1.000000 -0.222222 -1.000000 -0.277778 -0.944444 -0.222222 -1.000000 -0.277778 -0.944444 -0.277778 +-0.888889 -0.222222 -0.944444 -0.222222 -0.944444 -0.277778 -0.888889 -0.222222 -0.944444 -0.277778 -0.888889 -0.277778 +-0.833333 -0.222222 -0.888889 -0.222222 -0.888889 -0.277778 -0.833333 -0.222222 -0.888889 -0.277778 -0.833333 -0.277778 +-0.777778 -0.222222 -0.833333 -0.222222 -0.833333 -0.277778 -0.777778 -0.222222 -0.833333 -0.277778 -0.777778 -0.277778 +-0.722222 -0.222222 -0.777778 -0.222222 -0.777778 -0.277778 -0.722222 -0.222222 -0.777778 -0.277778 -0.722222 -0.277778 +-0.666667 -0.222222 -0.722222 -0.222222 -0.722222 -0.277778 -0.666667 -0.222222 -0.722222 -0.277778 -0.666667 -0.277778 +-0.611111 -0.222222 -0.666667 -0.222222 -0.666667 -0.277778 -0.611111 -0.222222 -0.666667 -0.277778 -0.611111 -0.277778 +-0.555556 -0.222222 -0.611111 -0.222222 -0.611111 -0.277778 -0.555556 -0.222222 -0.611111 -0.277778 -0.555556 -0.277778 +-0.500000 -0.222222 -0.555556 -0.222222 -0.555556 -0.277778 -0.500000 -0.222222 -0.555556 -0.277778 -0.500000 -0.277778 +-0.444444 -0.222222 -0.500000 -0.222222 -0.500000 -0.277778 -0.444444 -0.222222 -0.500000 -0.277778 -0.444444 -0.277778 +-0.388889 -0.222222 -0.444444 -0.222222 -0.444444 -0.277778 -0.388889 -0.222222 -0.444444 -0.277778 -0.388889 -0.277778 +-0.333333 -0.222222 -0.388889 -0.222222 -0.388889 -0.277778 -0.333333 -0.222222 -0.388889 -0.277778 -0.333333 -0.277778 +-0.277778 -0.222222 -0.333333 -0.222222 -0.333333 -0.277778 -0.277778 -0.222222 -0.333333 -0.277778 -0.277778 -0.277778 +-0.222222 -0.222222 -0.277778 -0.222222 -0.277778 -0.277778 -0.222222 -0.222222 -0.277778 -0.277778 -0.222222 -0.277778 +-0.166667 -0.222222 -0.222222 -0.222222 -0.222222 -0.277778 -0.166667 -0.222222 -0.222222 -0.277778 -0.166667 -0.277778 +-0.111111 -0.222222 -0.166667 -0.222222 -0.166667 -0.277778 -0.111111 -0.222222 -0.166667 -0.277778 -0.111111 -0.277778 +-0.055556 -0.222222 -0.111111 -0.222222 -0.111111 -0.277778 -0.055556 -0.222222 -0.111111 -0.277778 -0.055556 -0.277778 + 0.000000 -0.222222 -0.055556 -0.222222 -0.055556 -0.277778 0.000000 -0.222222 -0.055556 -0.277778 0.000000 -0.277778 + 0.055556 -0.222222 0.000000 -0.222222 0.000000 -0.277778 0.055556 -0.222222 0.000000 -0.277778 0.055556 -0.277778 + 0.111111 -0.222222 0.055556 -0.222222 0.055556 -0.277778 0.111111 -0.222222 0.055556 -0.277778 0.111111 -0.277778 + 0.166667 -0.222222 0.111111 -0.222222 0.111111 -0.277778 0.166667 -0.222222 0.111111 -0.277778 0.166667 -0.277778 + 0.222222 -0.222222 0.166667 -0.222222 0.166667 -0.277778 0.222222 -0.222222 0.166667 -0.277778 0.222222 -0.277778 + 0.277778 -0.222222 0.222222 -0.222222 0.222222 -0.277778 0.277778 -0.222222 0.222222 -0.277778 0.277778 -0.277778 + 0.333333 -0.222222 0.277778 -0.222222 0.277778 -0.277778 0.333333 -0.222222 0.277778 -0.277778 0.333333 -0.277778 + 0.388889 -0.222222 0.333333 -0.222222 0.333333 -0.277778 0.388889 -0.222222 0.333333 -0.277778 0.388889 -0.277778 + 0.444444 -0.222222 0.388889 -0.222222 0.388889 -0.277778 0.444444 -0.222222 0.388889 -0.277778 0.444444 -0.277778 + 0.500000 -0.222222 0.444444 -0.222222 0.444444 -0.277778 0.500000 -0.222222 0.444444 -0.277778 0.500000 -0.277778 + 0.555556 -0.222222 0.500000 -0.222222 0.500000 -0.277778 0.555556 -0.222222 0.500000 -0.277778 0.555556 -0.277778 + 0.611111 -0.222222 0.555556 -0.222222 0.555556 -0.277778 0.611111 -0.222222 0.555556 -0.277778 0.611111 -0.277778 + 0.666667 -0.222222 0.611111 -0.222222 0.611111 -0.277778 0.666667 -0.222222 0.611111 -0.277778 0.666667 -0.277778 + 0.722222 -0.222222 0.666667 -0.222222 0.666667 -0.277778 0.722222 -0.222222 0.666667 -0.277778 0.722222 -0.277778 + 0.777778 -0.222222 0.722222 -0.222222 0.722222 -0.277778 0.777778 -0.222222 0.722222 -0.277778 0.777778 -0.277778 + 0.833333 -0.222222 0.777778 -0.222222 0.777778 -0.277778 0.833333 -0.222222 0.777778 -0.277778 0.833333 -0.277778 + 0.888889 -0.222222 0.833333 -0.222222 0.833333 -0.277778 0.888889 -0.222222 0.833333 -0.277778 0.888889 -0.277778 + 0.944444 -0.222222 0.888889 -0.222222 0.888889 -0.277778 0.944444 -0.222222 0.888889 -0.277778 0.944444 -0.277778 + 1.000000 -0.222222 0.944444 -0.222222 0.944444 -0.277778 1.000000 -0.222222 0.944444 -0.277778 1.000000 -0.277778 +-0.944444 -0.166667 -1.000000 -0.166667 -1.000000 -0.222222 -0.944444 -0.166667 -1.000000 -0.222222 -0.944444 -0.222222 +-0.888889 -0.166667 -0.944444 -0.166667 -0.944444 -0.222222 -0.888889 -0.166667 -0.944444 -0.222222 -0.888889 -0.222222 +-0.833333 -0.166667 -0.888889 -0.166667 -0.888889 -0.222222 -0.833333 -0.166667 -0.888889 -0.222222 -0.833333 -0.222222 +-0.777778 -0.166667 -0.833333 -0.166667 -0.833333 -0.222222 -0.777778 -0.166667 -0.833333 -0.222222 -0.777778 -0.222222 +-0.722222 -0.166667 -0.777778 -0.166667 -0.777778 -0.222222 -0.722222 -0.166667 -0.777778 -0.222222 -0.722222 -0.222222 +-0.666667 -0.166667 -0.722222 -0.166667 -0.722222 -0.222222 -0.666667 -0.166667 -0.722222 -0.222222 -0.666667 -0.222222 +-0.611111 -0.166667 -0.666667 -0.166667 -0.666667 -0.222222 -0.611111 -0.166667 -0.666667 -0.222222 -0.611111 -0.222222 +-0.555556 -0.166667 -0.611111 -0.166667 -0.611111 -0.222222 -0.555556 -0.166667 -0.611111 -0.222222 -0.555556 -0.222222 +-0.500000 -0.166667 -0.555556 -0.166667 -0.555556 -0.222222 -0.500000 -0.166667 -0.555556 -0.222222 -0.500000 -0.222222 +-0.444444 -0.166667 -0.500000 -0.166667 -0.500000 -0.222222 -0.444444 -0.166667 -0.500000 -0.222222 -0.444444 -0.222222 +-0.388889 -0.166667 -0.444444 -0.166667 -0.444444 -0.222222 -0.388889 -0.166667 -0.444444 -0.222222 -0.388889 -0.222222 +-0.333333 -0.166667 -0.388889 -0.166667 -0.388889 -0.222222 -0.333333 -0.166667 -0.388889 -0.222222 -0.333333 -0.222222 +-0.277778 -0.166667 -0.333333 -0.166667 -0.333333 -0.222222 -0.277778 -0.166667 -0.333333 -0.222222 -0.277778 -0.222222 +-0.222222 -0.166667 -0.277778 -0.166667 -0.277778 -0.222222 -0.222222 -0.166667 -0.277778 -0.222222 -0.222222 -0.222222 +-0.166667 -0.166667 -0.222222 -0.166667 -0.222222 -0.222222 -0.166667 -0.166667 -0.222222 -0.222222 -0.166667 -0.222222 +-0.111111 -0.166667 -0.166667 -0.166667 -0.166667 -0.222222 -0.111111 -0.166667 -0.166667 -0.222222 -0.111111 -0.222222 +-0.055556 -0.166667 -0.111111 -0.166667 -0.111111 -0.222222 -0.055556 -0.166667 -0.111111 -0.222222 -0.055556 -0.222222 + 0.000000 -0.166667 -0.055556 -0.166667 -0.055556 -0.222222 0.000000 -0.166667 -0.055556 -0.222222 0.000000 -0.222222 + 0.055556 -0.166667 0.000000 -0.166667 0.000000 -0.222222 0.055556 -0.166667 0.000000 -0.222222 0.055556 -0.222222 + 0.111111 -0.166667 0.055556 -0.166667 0.055556 -0.222222 0.111111 -0.166667 0.055556 -0.222222 0.111111 -0.222222 + 0.166667 -0.166667 0.111111 -0.166667 0.111111 -0.222222 0.166667 -0.166667 0.111111 -0.222222 0.166667 -0.222222 + 0.222222 -0.166667 0.166667 -0.166667 0.166667 -0.222222 0.222222 -0.166667 0.166667 -0.222222 0.222222 -0.222222 + 0.277778 -0.166667 0.222222 -0.166667 0.222222 -0.222222 0.277778 -0.166667 0.222222 -0.222222 0.277778 -0.222222 + 0.333333 -0.166667 0.277778 -0.166667 0.277778 -0.222222 0.333333 -0.166667 0.277778 -0.222222 0.333333 -0.222222 + 0.388889 -0.166667 0.333333 -0.166667 0.333333 -0.222222 0.388889 -0.166667 0.333333 -0.222222 0.388889 -0.222222 + 0.444444 -0.166667 0.388889 -0.166667 0.388889 -0.222222 0.444444 -0.166667 0.388889 -0.222222 0.444444 -0.222222 + 0.500000 -0.166667 0.444444 -0.166667 0.444444 -0.222222 0.500000 -0.166667 0.444444 -0.222222 0.500000 -0.222222 + 0.555556 -0.166667 0.500000 -0.166667 0.500000 -0.222222 0.555556 -0.166667 0.500000 -0.222222 0.555556 -0.222222 + 0.611111 -0.166667 0.555556 -0.166667 0.555556 -0.222222 0.611111 -0.166667 0.555556 -0.222222 0.611111 -0.222222 + 0.666667 -0.166667 0.611111 -0.166667 0.611111 -0.222222 0.666667 -0.166667 0.611111 -0.222222 0.666667 -0.222222 + 0.722222 -0.166667 0.666667 -0.166667 0.666667 -0.222222 0.722222 -0.166667 0.666667 -0.222222 0.722222 -0.222222 + 0.777778 -0.166667 0.722222 -0.166667 0.722222 -0.222222 0.777778 -0.166667 0.722222 -0.222222 0.777778 -0.222222 + 0.833333 -0.166667 0.777778 -0.166667 0.777778 -0.222222 0.833333 -0.166667 0.777778 -0.222222 0.833333 -0.222222 + 0.888889 -0.166667 0.833333 -0.166667 0.833333 -0.222222 0.888889 -0.166667 0.833333 -0.222222 0.888889 -0.222222 + 0.944444 -0.166667 0.888889 -0.166667 0.888889 -0.222222 0.944444 -0.166667 0.888889 -0.222222 0.944444 -0.222222 + 1.000000 -0.166667 0.944444 -0.166667 0.944444 -0.222222 1.000000 -0.166667 0.944444 -0.222222 1.000000 -0.222222 +-0.944444 -0.111111 -1.000000 -0.111111 -1.000000 -0.166667 -0.944444 -0.111111 -1.000000 -0.166667 -0.944444 -0.166667 +-0.888889 -0.111111 -0.944444 -0.111111 -0.944444 -0.166667 -0.888889 -0.111111 -0.944444 -0.166667 -0.888889 -0.166667 +-0.833333 -0.111111 -0.888889 -0.111111 -0.888889 -0.166667 -0.833333 -0.111111 -0.888889 -0.166667 -0.833333 -0.166667 +-0.777778 -0.111111 -0.833333 -0.111111 -0.833333 -0.166667 -0.777778 -0.111111 -0.833333 -0.166667 -0.777778 -0.166667 +-0.722222 -0.111111 -0.777778 -0.111111 -0.777778 -0.166667 -0.722222 -0.111111 -0.777778 -0.166667 -0.722222 -0.166667 +-0.666667 -0.111111 -0.722222 -0.111111 -0.722222 -0.166667 -0.666667 -0.111111 -0.722222 -0.166667 -0.666667 -0.166667 +-0.611111 -0.111111 -0.666667 -0.111111 -0.666667 -0.166667 -0.611111 -0.111111 -0.666667 -0.166667 -0.611111 -0.166667 +-0.555556 -0.111111 -0.611111 -0.111111 -0.611111 -0.166667 -0.555556 -0.111111 -0.611111 -0.166667 -0.555556 -0.166667 +-0.500000 -0.111111 -0.555556 -0.111111 -0.555556 -0.166667 -0.500000 -0.111111 -0.555556 -0.166667 -0.500000 -0.166667 +-0.444444 -0.111111 -0.500000 -0.111111 -0.500000 -0.166667 -0.444444 -0.111111 -0.500000 -0.166667 -0.444444 -0.166667 +-0.388889 -0.111111 -0.444444 -0.111111 -0.444444 -0.166667 -0.388889 -0.111111 -0.444444 -0.166667 -0.388889 -0.166667 +-0.333333 -0.111111 -0.388889 -0.111111 -0.388889 -0.166667 -0.333333 -0.111111 -0.388889 -0.166667 -0.333333 -0.166667 +-0.277778 -0.111111 -0.333333 -0.111111 -0.333333 -0.166667 -0.277778 -0.111111 -0.333333 -0.166667 -0.277778 -0.166667 +-0.222222 -0.111111 -0.277778 -0.111111 -0.277778 -0.166667 -0.222222 -0.111111 -0.277778 -0.166667 -0.222222 -0.166667 +-0.166667 -0.111111 -0.222222 -0.111111 -0.222222 -0.166667 -0.166667 -0.111111 -0.222222 -0.166667 -0.166667 -0.166667 +-0.111111 -0.111111 -0.166667 -0.111111 -0.166667 -0.166667 -0.111111 -0.111111 -0.166667 -0.166667 -0.111111 -0.166667 +-0.055556 -0.111111 -0.111111 -0.111111 -0.111111 -0.166667 -0.055556 -0.111111 -0.111111 -0.166667 -0.055556 -0.166667 + 0.000000 -0.111111 -0.055556 -0.111111 -0.055556 -0.166667 0.000000 -0.111111 -0.055556 -0.166667 0.000000 -0.166667 + 0.055556 -0.111111 0.000000 -0.111111 0.000000 -0.166667 0.055556 -0.111111 0.000000 -0.166667 0.055556 -0.166667 + 0.111111 -0.111111 0.055556 -0.111111 0.055556 -0.166667 0.111111 -0.111111 0.055556 -0.166667 0.111111 -0.166667 + 0.166667 -0.111111 0.111111 -0.111111 0.111111 -0.166667 0.166667 -0.111111 0.111111 -0.166667 0.166667 -0.166667 + 0.222222 -0.111111 0.166667 -0.111111 0.166667 -0.166667 0.222222 -0.111111 0.166667 -0.166667 0.222222 -0.166667 + 0.277778 -0.111111 0.222222 -0.111111 0.222222 -0.166667 0.277778 -0.111111 0.222222 -0.166667 0.277778 -0.166667 + 0.333333 -0.111111 0.277778 -0.111111 0.277778 -0.166667 0.333333 -0.111111 0.277778 -0.166667 0.333333 -0.166667 + 0.388889 -0.111111 0.333333 -0.111111 0.333333 -0.166667 0.388889 -0.111111 0.333333 -0.166667 0.388889 -0.166667 + 0.444444 -0.111111 0.388889 -0.111111 0.388889 -0.166667 0.444444 -0.111111 0.388889 -0.166667 0.444444 -0.166667 + 0.500000 -0.111111 0.444444 -0.111111 0.444444 -0.166667 0.500000 -0.111111 0.444444 -0.166667 0.500000 -0.166667 + 0.555556 -0.111111 0.500000 -0.111111 0.500000 -0.166667 0.555556 -0.111111 0.500000 -0.166667 0.555556 -0.166667 + 0.611111 -0.111111 0.555556 -0.111111 0.555556 -0.166667 0.611111 -0.111111 0.555556 -0.166667 0.611111 -0.166667 + 0.666667 -0.111111 0.611111 -0.111111 0.611111 -0.166667 0.666667 -0.111111 0.611111 -0.166667 0.666667 -0.166667 + 0.722222 -0.111111 0.666667 -0.111111 0.666667 -0.166667 0.722222 -0.111111 0.666667 -0.166667 0.722222 -0.166667 + 0.777778 -0.111111 0.722222 -0.111111 0.722222 -0.166667 0.777778 -0.111111 0.722222 -0.166667 0.777778 -0.166667 + 0.833333 -0.111111 0.777778 -0.111111 0.777778 -0.166667 0.833333 -0.111111 0.777778 -0.166667 0.833333 -0.166667 + 0.888889 -0.111111 0.833333 -0.111111 0.833333 -0.166667 0.888889 -0.111111 0.833333 -0.166667 0.888889 -0.166667 + 0.944444 -0.111111 0.888889 -0.111111 0.888889 -0.166667 0.944444 -0.111111 0.888889 -0.166667 0.944444 -0.166667 + 1.000000 -0.111111 0.944444 -0.111111 0.944444 -0.166667 1.000000 -0.111111 0.944444 -0.166667 1.000000 -0.166667 +-0.944444 -0.055556 -1.000000 -0.055556 -1.000000 -0.111111 -0.944444 -0.055556 -1.000000 -0.111111 -0.944444 -0.111111 +-0.888889 -0.055556 -0.944444 -0.055556 -0.944444 -0.111111 -0.888889 -0.055556 -0.944444 -0.111111 -0.888889 -0.111111 +-0.833333 -0.055556 -0.888889 -0.055556 -0.888889 -0.111111 -0.833333 -0.055556 -0.888889 -0.111111 -0.833333 -0.111111 +-0.777778 -0.055556 -0.833333 -0.055556 -0.833333 -0.111111 -0.777778 -0.055556 -0.833333 -0.111111 -0.777778 -0.111111 +-0.722222 -0.055556 -0.777778 -0.055556 -0.777778 -0.111111 -0.722222 -0.055556 -0.777778 -0.111111 -0.722222 -0.111111 +-0.666667 -0.055556 -0.722222 -0.055556 -0.722222 -0.111111 -0.666667 -0.055556 -0.722222 -0.111111 -0.666667 -0.111111 +-0.611111 -0.055556 -0.666667 -0.055556 -0.666667 -0.111111 -0.611111 -0.055556 -0.666667 -0.111111 -0.611111 -0.111111 +-0.555556 -0.055556 -0.611111 -0.055556 -0.611111 -0.111111 -0.555556 -0.055556 -0.611111 -0.111111 -0.555556 -0.111111 +-0.500000 -0.055556 -0.555556 -0.055556 -0.555556 -0.111111 -0.500000 -0.055556 -0.555556 -0.111111 -0.500000 -0.111111 +-0.444444 -0.055556 -0.500000 -0.055556 -0.500000 -0.111111 -0.444444 -0.055556 -0.500000 -0.111111 -0.444444 -0.111111 +-0.388889 -0.055556 -0.444444 -0.055556 -0.444444 -0.111111 -0.388889 -0.055556 -0.444444 -0.111111 -0.388889 -0.111111 +-0.333333 -0.055556 -0.388889 -0.055556 -0.388889 -0.111111 -0.333333 -0.055556 -0.388889 -0.111111 -0.333333 -0.111111 +-0.277778 -0.055556 -0.333333 -0.055556 -0.333333 -0.111111 -0.277778 -0.055556 -0.333333 -0.111111 -0.277778 -0.111111 +-0.222222 -0.055556 -0.277778 -0.055556 -0.277778 -0.111111 -0.222222 -0.055556 -0.277778 -0.111111 -0.222222 -0.111111 +-0.166667 -0.055556 -0.222222 -0.055556 -0.222222 -0.111111 -0.166667 -0.055556 -0.222222 -0.111111 -0.166667 -0.111111 +-0.111111 -0.055556 -0.166667 -0.055556 -0.166667 -0.111111 -0.111111 -0.055556 -0.166667 -0.111111 -0.111111 -0.111111 +-0.055556 -0.055556 -0.111111 -0.055556 -0.111111 -0.111111 -0.055556 -0.055556 -0.111111 -0.111111 -0.055556 -0.111111 + 0.000000 -0.055556 -0.055556 -0.055556 -0.055556 -0.111111 0.000000 -0.055556 -0.055556 -0.111111 0.000000 -0.111111 + 0.055556 -0.055556 0.000000 -0.055556 0.000000 -0.111111 0.055556 -0.055556 0.000000 -0.111111 0.055556 -0.111111 + 0.111111 -0.055556 0.055556 -0.055556 0.055556 -0.111111 0.111111 -0.055556 0.055556 -0.111111 0.111111 -0.111111 + 0.166667 -0.055556 0.111111 -0.055556 0.111111 -0.111111 0.166667 -0.055556 0.111111 -0.111111 0.166667 -0.111111 + 0.222222 -0.055556 0.166667 -0.055556 0.166667 -0.111111 0.222222 -0.055556 0.166667 -0.111111 0.222222 -0.111111 + 0.277778 -0.055556 0.222222 -0.055556 0.222222 -0.111111 0.277778 -0.055556 0.222222 -0.111111 0.277778 -0.111111 + 0.333333 -0.055556 0.277778 -0.055556 0.277778 -0.111111 0.333333 -0.055556 0.277778 -0.111111 0.333333 -0.111111 + 0.388889 -0.055556 0.333333 -0.055556 0.333333 -0.111111 0.388889 -0.055556 0.333333 -0.111111 0.388889 -0.111111 + 0.444444 -0.055556 0.388889 -0.055556 0.388889 -0.111111 0.444444 -0.055556 0.388889 -0.111111 0.444444 -0.111111 + 0.500000 -0.055556 0.444444 -0.055556 0.444444 -0.111111 0.500000 -0.055556 0.444444 -0.111111 0.500000 -0.111111 + 0.555556 -0.055556 0.500000 -0.055556 0.500000 -0.111111 0.555556 -0.055556 0.500000 -0.111111 0.555556 -0.111111 + 0.611111 -0.055556 0.555556 -0.055556 0.555556 -0.111111 0.611111 -0.055556 0.555556 -0.111111 0.611111 -0.111111 + 0.666667 -0.055556 0.611111 -0.055556 0.611111 -0.111111 0.666667 -0.055556 0.611111 -0.111111 0.666667 -0.111111 + 0.722222 -0.055556 0.666667 -0.055556 0.666667 -0.111111 0.722222 -0.055556 0.666667 -0.111111 0.722222 -0.111111 + 0.777778 -0.055556 0.722222 -0.055556 0.722222 -0.111111 0.777778 -0.055556 0.722222 -0.111111 0.777778 -0.111111 + 0.833333 -0.055556 0.777778 -0.055556 0.777778 -0.111111 0.833333 -0.055556 0.777778 -0.111111 0.833333 -0.111111 + 0.888889 -0.055556 0.833333 -0.055556 0.833333 -0.111111 0.888889 -0.055556 0.833333 -0.111111 0.888889 -0.111111 + 0.944444 -0.055556 0.888889 -0.055556 0.888889 -0.111111 0.944444 -0.055556 0.888889 -0.111111 0.944444 -0.111111 + 1.000000 -0.055556 0.944444 -0.055556 0.944444 -0.111111 1.000000 -0.055556 0.944444 -0.111111 1.000000 -0.111111 +-0.944444 0.000000 -1.000000 0.000000 -1.000000 -0.055556 -0.944444 0.000000 -1.000000 -0.055556 -0.944444 -0.055556 +-0.888889 0.000000 -0.944444 0.000000 -0.944444 -0.055556 -0.888889 0.000000 -0.944444 -0.055556 -0.888889 -0.055556 +-0.833333 0.000000 -0.888889 0.000000 -0.888889 -0.055556 -0.833333 0.000000 -0.888889 -0.055556 -0.833333 -0.055556 +-0.777778 0.000000 -0.833333 0.000000 -0.833333 -0.055556 -0.777778 0.000000 -0.833333 -0.055556 -0.777778 -0.055556 +-0.722222 0.000000 -0.777778 0.000000 -0.777778 -0.055556 -0.722222 0.000000 -0.777778 -0.055556 -0.722222 -0.055556 +-0.666667 0.000000 -0.722222 0.000000 -0.722222 -0.055556 -0.666667 0.000000 -0.722222 -0.055556 -0.666667 -0.055556 +-0.611111 0.000000 -0.666667 0.000000 -0.666667 -0.055556 -0.611111 0.000000 -0.666667 -0.055556 -0.611111 -0.055556 +-0.555556 0.000000 -0.611111 0.000000 -0.611111 -0.055556 -0.555556 0.000000 -0.611111 -0.055556 -0.555556 -0.055556 +-0.500000 0.000000 -0.555556 0.000000 -0.555556 -0.055556 -0.500000 0.000000 -0.555556 -0.055556 -0.500000 -0.055556 +-0.444444 0.000000 -0.500000 0.000000 -0.500000 -0.055556 -0.444444 0.000000 -0.500000 -0.055556 -0.444444 -0.055556 +-0.388889 0.000000 -0.444444 0.000000 -0.444444 -0.055556 -0.388889 0.000000 -0.444444 -0.055556 -0.388889 -0.055556 +-0.333333 0.000000 -0.388889 0.000000 -0.388889 -0.055556 -0.333333 0.000000 -0.388889 -0.055556 -0.333333 -0.055556 +-0.277778 0.000000 -0.333333 0.000000 -0.333333 -0.055556 -0.277778 0.000000 -0.333333 -0.055556 -0.277778 -0.055556 +-0.222222 0.000000 -0.277778 0.000000 -0.277778 -0.055556 -0.222222 0.000000 -0.277778 -0.055556 -0.222222 -0.055556 +-0.166667 0.000000 -0.222222 0.000000 -0.222222 -0.055556 -0.166667 0.000000 -0.222222 -0.055556 -0.166667 -0.055556 +-0.111111 0.000000 -0.166667 0.000000 -0.166667 -0.055556 -0.111111 0.000000 -0.166667 -0.055556 -0.111111 -0.055556 +-0.055556 0.000000 -0.111111 0.000000 -0.111111 -0.055556 -0.055556 0.000000 -0.111111 -0.055556 -0.055556 -0.055556 + 0.000000 0.000000 -0.055556 0.000000 -0.055556 -0.055556 0.000000 0.000000 -0.055556 -0.055556 0.000000 -0.055556 + 0.055556 0.000000 0.000000 0.000000 0.000000 -0.055556 0.055556 0.000000 0.000000 -0.055556 0.055556 -0.055556 + 0.111111 0.000000 0.055556 0.000000 0.055556 -0.055556 0.111111 0.000000 0.055556 -0.055556 0.111111 -0.055556 + 0.166667 0.000000 0.111111 0.000000 0.111111 -0.055556 0.166667 0.000000 0.111111 -0.055556 0.166667 -0.055556 + 0.222222 0.000000 0.166667 0.000000 0.166667 -0.055556 0.222222 0.000000 0.166667 -0.055556 0.222222 -0.055556 + 0.277778 0.000000 0.222222 0.000000 0.222222 -0.055556 0.277778 0.000000 0.222222 -0.055556 0.277778 -0.055556 + 0.333333 0.000000 0.277778 0.000000 0.277778 -0.055556 0.333333 0.000000 0.277778 -0.055556 0.333333 -0.055556 + 0.388889 0.000000 0.333333 0.000000 0.333333 -0.055556 0.388889 0.000000 0.333333 -0.055556 0.388889 -0.055556 + 0.444444 0.000000 0.388889 0.000000 0.388889 -0.055556 0.444444 0.000000 0.388889 -0.055556 0.444444 -0.055556 + 0.500000 0.000000 0.444444 0.000000 0.444444 -0.055556 0.500000 0.000000 0.444444 -0.055556 0.500000 -0.055556 + 0.555556 0.000000 0.500000 0.000000 0.500000 -0.055556 0.555556 0.000000 0.500000 -0.055556 0.555556 -0.055556 + 0.611111 0.000000 0.555556 0.000000 0.555556 -0.055556 0.611111 0.000000 0.555556 -0.055556 0.611111 -0.055556 + 0.666667 0.000000 0.611111 0.000000 0.611111 -0.055556 0.666667 0.000000 0.611111 -0.055556 0.666667 -0.055556 + 0.722222 0.000000 0.666667 0.000000 0.666667 -0.055556 0.722222 0.000000 0.666667 -0.055556 0.722222 -0.055556 + 0.777778 0.000000 0.722222 0.000000 0.722222 -0.055556 0.777778 0.000000 0.722222 -0.055556 0.777778 -0.055556 + 0.833333 0.000000 0.777778 0.000000 0.777778 -0.055556 0.833333 0.000000 0.777778 -0.055556 0.833333 -0.055556 + 0.888889 0.000000 0.833333 0.000000 0.833333 -0.055556 0.888889 0.000000 0.833333 -0.055556 0.888889 -0.055556 + 0.944444 0.000000 0.888889 0.000000 0.888889 -0.055556 0.944444 0.000000 0.888889 -0.055556 0.944444 -0.055556 + 1.000000 0.000000 0.944444 0.000000 0.944444 -0.055556 1.000000 0.000000 0.944444 -0.055556 1.000000 -0.055556 +-0.944444 0.055556 -1.000000 0.055556 -1.000000 0.000000 -0.944444 0.055556 -1.000000 0.000000 -0.944444 0.000000 +-0.888889 0.055556 -0.944444 0.055556 -0.944444 0.000000 -0.888889 0.055556 -0.944444 0.000000 -0.888889 0.000000 +-0.833333 0.055556 -0.888889 0.055556 -0.888889 0.000000 -0.833333 0.055556 -0.888889 0.000000 -0.833333 0.000000 +-0.777778 0.055556 -0.833333 0.055556 -0.833333 0.000000 -0.777778 0.055556 -0.833333 0.000000 -0.777778 0.000000 +-0.722222 0.055556 -0.777778 0.055556 -0.777778 0.000000 -0.722222 0.055556 -0.777778 0.000000 -0.722222 0.000000 +-0.666667 0.055556 -0.722222 0.055556 -0.722222 0.000000 -0.666667 0.055556 -0.722222 0.000000 -0.666667 0.000000 +-0.611111 0.055556 -0.666667 0.055556 -0.666667 0.000000 -0.611111 0.055556 -0.666667 0.000000 -0.611111 0.000000 +-0.555556 0.055556 -0.611111 0.055556 -0.611111 0.000000 -0.555556 0.055556 -0.611111 0.000000 -0.555556 0.000000 +-0.500000 0.055556 -0.555556 0.055556 -0.555556 0.000000 -0.500000 0.055556 -0.555556 0.000000 -0.500000 0.000000 +-0.444444 0.055556 -0.500000 0.055556 -0.500000 0.000000 -0.444444 0.055556 -0.500000 0.000000 -0.444444 0.000000 +-0.388889 0.055556 -0.444444 0.055556 -0.444444 0.000000 -0.388889 0.055556 -0.444444 0.000000 -0.388889 0.000000 +-0.333333 0.055556 -0.388889 0.055556 -0.388889 0.000000 -0.333333 0.055556 -0.388889 0.000000 -0.333333 0.000000 +-0.277778 0.055556 -0.333333 0.055556 -0.333333 0.000000 -0.277778 0.055556 -0.333333 0.000000 -0.277778 0.000000 +-0.222222 0.055556 -0.277778 0.055556 -0.277778 0.000000 -0.222222 0.055556 -0.277778 0.000000 -0.222222 0.000000 +-0.166667 0.055556 -0.222222 0.055556 -0.222222 0.000000 -0.166667 0.055556 -0.222222 0.000000 -0.166667 0.000000 +-0.111111 0.055556 -0.166667 0.055556 -0.166667 0.000000 -0.111111 0.055556 -0.166667 0.000000 -0.111111 0.000000 +-0.055556 0.055556 -0.111111 0.055556 -0.111111 0.000000 -0.055556 0.055556 -0.111111 0.000000 -0.055556 0.000000 + 0.000000 0.055556 -0.055556 0.055556 -0.055556 0.000000 0.000000 0.055556 -0.055556 0.000000 0.000000 0.000000 + 0.055556 0.055556 0.000000 0.055556 0.000000 0.000000 0.055556 0.055556 0.000000 0.000000 0.055556 0.000000 + 0.111111 0.055556 0.055556 0.055556 0.055556 0.000000 0.111111 0.055556 0.055556 0.000000 0.111111 0.000000 + 0.166667 0.055556 0.111111 0.055556 0.111111 0.000000 0.166667 0.055556 0.111111 0.000000 0.166667 0.000000 + 0.222222 0.055556 0.166667 0.055556 0.166667 0.000000 0.222222 0.055556 0.166667 0.000000 0.222222 0.000000 + 0.277778 0.055556 0.222222 0.055556 0.222222 0.000000 0.277778 0.055556 0.222222 0.000000 0.277778 0.000000 + 0.333333 0.055556 0.277778 0.055556 0.277778 0.000000 0.333333 0.055556 0.277778 0.000000 0.333333 0.000000 + 0.388889 0.055556 0.333333 0.055556 0.333333 0.000000 0.388889 0.055556 0.333333 0.000000 0.388889 0.000000 + 0.444444 0.055556 0.388889 0.055556 0.388889 0.000000 0.444444 0.055556 0.388889 0.000000 0.444444 0.000000 + 0.500000 0.055556 0.444444 0.055556 0.444444 0.000000 0.500000 0.055556 0.444444 0.000000 0.500000 0.000000 + 0.555556 0.055556 0.500000 0.055556 0.500000 0.000000 0.555556 0.055556 0.500000 0.000000 0.555556 0.000000 + 0.611111 0.055556 0.555556 0.055556 0.555556 0.000000 0.611111 0.055556 0.555556 0.000000 0.611111 0.000000 + 0.666667 0.055556 0.611111 0.055556 0.611111 0.000000 0.666667 0.055556 0.611111 0.000000 0.666667 0.000000 + 0.722222 0.055556 0.666667 0.055556 0.666667 0.000000 0.722222 0.055556 0.666667 0.000000 0.722222 0.000000 + 0.777778 0.055556 0.722222 0.055556 0.722222 0.000000 0.777778 0.055556 0.722222 0.000000 0.777778 0.000000 + 0.833333 0.055556 0.777778 0.055556 0.777778 0.000000 0.833333 0.055556 0.777778 0.000000 0.833333 0.000000 + 0.888889 0.055556 0.833333 0.055556 0.833333 0.000000 0.888889 0.055556 0.833333 0.000000 0.888889 0.000000 + 0.944444 0.055556 0.888889 0.055556 0.888889 0.000000 0.944444 0.055556 0.888889 0.000000 0.944444 0.000000 + 1.000000 0.055556 0.944444 0.055556 0.944444 0.000000 1.000000 0.055556 0.944444 0.000000 1.000000 0.000000 +-0.944444 0.111111 -1.000000 0.111111 -1.000000 0.055556 -0.944444 0.111111 -1.000000 0.055556 -0.944444 0.055556 +-0.888889 0.111111 -0.944444 0.111111 -0.944444 0.055556 -0.888889 0.111111 -0.944444 0.055556 -0.888889 0.055556 +-0.833333 0.111111 -0.888889 0.111111 -0.888889 0.055556 -0.833333 0.111111 -0.888889 0.055556 -0.833333 0.055556 +-0.777778 0.111111 -0.833333 0.111111 -0.833333 0.055556 -0.777778 0.111111 -0.833333 0.055556 -0.777778 0.055556 +-0.722222 0.111111 -0.777778 0.111111 -0.777778 0.055556 -0.722222 0.111111 -0.777778 0.055556 -0.722222 0.055556 +-0.666667 0.111111 -0.722222 0.111111 -0.722222 0.055556 -0.666667 0.111111 -0.722222 0.055556 -0.666667 0.055556 +-0.611111 0.111111 -0.666667 0.111111 -0.666667 0.055556 -0.611111 0.111111 -0.666667 0.055556 -0.611111 0.055556 +-0.555556 0.111111 -0.611111 0.111111 -0.611111 0.055556 -0.555556 0.111111 -0.611111 0.055556 -0.555556 0.055556 +-0.500000 0.111111 -0.555556 0.111111 -0.555556 0.055556 -0.500000 0.111111 -0.555556 0.055556 -0.500000 0.055556 +-0.444444 0.111111 -0.500000 0.111111 -0.500000 0.055556 -0.444444 0.111111 -0.500000 0.055556 -0.444444 0.055556 +-0.388889 0.111111 -0.444444 0.111111 -0.444444 0.055556 -0.388889 0.111111 -0.444444 0.055556 -0.388889 0.055556 +-0.333333 0.111111 -0.388889 0.111111 -0.388889 0.055556 -0.333333 0.111111 -0.388889 0.055556 -0.333333 0.055556 +-0.277778 0.111111 -0.333333 0.111111 -0.333333 0.055556 -0.277778 0.111111 -0.333333 0.055556 -0.277778 0.055556 +-0.222222 0.111111 -0.277778 0.111111 -0.277778 0.055556 -0.222222 0.111111 -0.277778 0.055556 -0.222222 0.055556 +-0.166667 0.111111 -0.222222 0.111111 -0.222222 0.055556 -0.166667 0.111111 -0.222222 0.055556 -0.166667 0.055556 +-0.111111 0.111111 -0.166667 0.111111 -0.166667 0.055556 -0.111111 0.111111 -0.166667 0.055556 -0.111111 0.055556 +-0.055556 0.111111 -0.111111 0.111111 -0.111111 0.055556 -0.055556 0.111111 -0.111111 0.055556 -0.055556 0.055556 + 0.000000 0.111111 -0.055556 0.111111 -0.055556 0.055556 0.000000 0.111111 -0.055556 0.055556 0.000000 0.055556 + 0.055556 0.111111 0.000000 0.111111 0.000000 0.055556 0.055556 0.111111 0.000000 0.055556 0.055556 0.055556 + 0.111111 0.111111 0.055556 0.111111 0.055556 0.055556 0.111111 0.111111 0.055556 0.055556 0.111111 0.055556 + 0.166667 0.111111 0.111111 0.111111 0.111111 0.055556 0.166667 0.111111 0.111111 0.055556 0.166667 0.055556 + 0.222222 0.111111 0.166667 0.111111 0.166667 0.055556 0.222222 0.111111 0.166667 0.055556 0.222222 0.055556 + 0.277778 0.111111 0.222222 0.111111 0.222222 0.055556 0.277778 0.111111 0.222222 0.055556 0.277778 0.055556 + 0.333333 0.111111 0.277778 0.111111 0.277778 0.055556 0.333333 0.111111 0.277778 0.055556 0.333333 0.055556 + 0.388889 0.111111 0.333333 0.111111 0.333333 0.055556 0.388889 0.111111 0.333333 0.055556 0.388889 0.055556 + 0.444444 0.111111 0.388889 0.111111 0.388889 0.055556 0.444444 0.111111 0.388889 0.055556 0.444444 0.055556 + 0.500000 0.111111 0.444444 0.111111 0.444444 0.055556 0.500000 0.111111 0.444444 0.055556 0.500000 0.055556 + 0.555556 0.111111 0.500000 0.111111 0.500000 0.055556 0.555556 0.111111 0.500000 0.055556 0.555556 0.055556 + 0.611111 0.111111 0.555556 0.111111 0.555556 0.055556 0.611111 0.111111 0.555556 0.055556 0.611111 0.055556 + 0.666667 0.111111 0.611111 0.111111 0.611111 0.055556 0.666667 0.111111 0.611111 0.055556 0.666667 0.055556 + 0.722222 0.111111 0.666667 0.111111 0.666667 0.055556 0.722222 0.111111 0.666667 0.055556 0.722222 0.055556 + 0.777778 0.111111 0.722222 0.111111 0.722222 0.055556 0.777778 0.111111 0.722222 0.055556 0.777778 0.055556 + 0.833333 0.111111 0.777778 0.111111 0.777778 0.055556 0.833333 0.111111 0.777778 0.055556 0.833333 0.055556 + 0.888889 0.111111 0.833333 0.111111 0.833333 0.055556 0.888889 0.111111 0.833333 0.055556 0.888889 0.055556 + 0.944444 0.111111 0.888889 0.111111 0.888889 0.055556 0.944444 0.111111 0.888889 0.055556 0.944444 0.055556 + 1.000000 0.111111 0.944444 0.111111 0.944444 0.055556 1.000000 0.111111 0.944444 0.055556 1.000000 0.055556 +-0.944444 0.166667 -1.000000 0.166667 -1.000000 0.111111 -0.944444 0.166667 -1.000000 0.111111 -0.944444 0.111111 +-0.888889 0.166667 -0.944444 0.166667 -0.944444 0.111111 -0.888889 0.166667 -0.944444 0.111111 -0.888889 0.111111 +-0.833333 0.166667 -0.888889 0.166667 -0.888889 0.111111 -0.833333 0.166667 -0.888889 0.111111 -0.833333 0.111111 +-0.777778 0.166667 -0.833333 0.166667 -0.833333 0.111111 -0.777778 0.166667 -0.833333 0.111111 -0.777778 0.111111 +-0.722222 0.166667 -0.777778 0.166667 -0.777778 0.111111 -0.722222 0.166667 -0.777778 0.111111 -0.722222 0.111111 +-0.666667 0.166667 -0.722222 0.166667 -0.722222 0.111111 -0.666667 0.166667 -0.722222 0.111111 -0.666667 0.111111 +-0.611111 0.166667 -0.666667 0.166667 -0.666667 0.111111 -0.611111 0.166667 -0.666667 0.111111 -0.611111 0.111111 +-0.555556 0.166667 -0.611111 0.166667 -0.611111 0.111111 -0.555556 0.166667 -0.611111 0.111111 -0.555556 0.111111 +-0.500000 0.166667 -0.555556 0.166667 -0.555556 0.111111 -0.500000 0.166667 -0.555556 0.111111 -0.500000 0.111111 +-0.444444 0.166667 -0.500000 0.166667 -0.500000 0.111111 -0.444444 0.166667 -0.500000 0.111111 -0.444444 0.111111 +-0.388889 0.166667 -0.444444 0.166667 -0.444444 0.111111 -0.388889 0.166667 -0.444444 0.111111 -0.388889 0.111111 +-0.333333 0.166667 -0.388889 0.166667 -0.388889 0.111111 -0.333333 0.166667 -0.388889 0.111111 -0.333333 0.111111 +-0.277778 0.166667 -0.333333 0.166667 -0.333333 0.111111 -0.277778 0.166667 -0.333333 0.111111 -0.277778 0.111111 +-0.222222 0.166667 -0.277778 0.166667 -0.277778 0.111111 -0.222222 0.166667 -0.277778 0.111111 -0.222222 0.111111 +-0.166667 0.166667 -0.222222 0.166667 -0.222222 0.111111 -0.166667 0.166667 -0.222222 0.111111 -0.166667 0.111111 +-0.111111 0.166667 -0.166667 0.166667 -0.166667 0.111111 -0.111111 0.166667 -0.166667 0.111111 -0.111111 0.111111 +-0.055556 0.166667 -0.111111 0.166667 -0.111111 0.111111 -0.055556 0.166667 -0.111111 0.111111 -0.055556 0.111111 + 0.000000 0.166667 -0.055556 0.166667 -0.055556 0.111111 0.000000 0.166667 -0.055556 0.111111 0.000000 0.111111 + 0.055556 0.166667 0.000000 0.166667 0.000000 0.111111 0.055556 0.166667 0.000000 0.111111 0.055556 0.111111 + 0.111111 0.166667 0.055556 0.166667 0.055556 0.111111 0.111111 0.166667 0.055556 0.111111 0.111111 0.111111 + 0.166667 0.166667 0.111111 0.166667 0.111111 0.111111 0.166667 0.166667 0.111111 0.111111 0.166667 0.111111 + 0.222222 0.166667 0.166667 0.166667 0.166667 0.111111 0.222222 0.166667 0.166667 0.111111 0.222222 0.111111 + 0.277778 0.166667 0.222222 0.166667 0.222222 0.111111 0.277778 0.166667 0.222222 0.111111 0.277778 0.111111 + 0.333333 0.166667 0.277778 0.166667 0.277778 0.111111 0.333333 0.166667 0.277778 0.111111 0.333333 0.111111 + 0.388889 0.166667 0.333333 0.166667 0.333333 0.111111 0.388889 0.166667 0.333333 0.111111 0.388889 0.111111 + 0.444444 0.166667 0.388889 0.166667 0.388889 0.111111 0.444444 0.166667 0.388889 0.111111 0.444444 0.111111 + 0.500000 0.166667 0.444444 0.166667 0.444444 0.111111 0.500000 0.166667 0.444444 0.111111 0.500000 0.111111 + 0.555556 0.166667 0.500000 0.166667 0.500000 0.111111 0.555556 0.166667 0.500000 0.111111 0.555556 0.111111 + 0.611111 0.166667 0.555556 0.166667 0.555556 0.111111 0.611111 0.166667 0.555556 0.111111 0.611111 0.111111 + 0.666667 0.166667 0.611111 0.166667 0.611111 0.111111 0.666667 0.166667 0.611111 0.111111 0.666667 0.111111 + 0.722222 0.166667 0.666667 0.166667 0.666667 0.111111 0.722222 0.166667 0.666667 0.111111 0.722222 0.111111 + 0.777778 0.166667 0.722222 0.166667 0.722222 0.111111 0.777778 0.166667 0.722222 0.111111 0.777778 0.111111 + 0.833333 0.166667 0.777778 0.166667 0.777778 0.111111 0.833333 0.166667 0.777778 0.111111 0.833333 0.111111 + 0.888889 0.166667 0.833333 0.166667 0.833333 0.111111 0.888889 0.166667 0.833333 0.111111 0.888889 0.111111 + 0.944444 0.166667 0.888889 0.166667 0.888889 0.111111 0.944444 0.166667 0.888889 0.111111 0.944444 0.111111 + 1.000000 0.166667 0.944444 0.166667 0.944444 0.111111 1.000000 0.166667 0.944444 0.111111 1.000000 0.111111 +-0.944444 0.222222 -1.000000 0.222222 -1.000000 0.166667 -0.944444 0.222222 -1.000000 0.166667 -0.944444 0.166667 +-0.888889 0.222222 -0.944444 0.222222 -0.944444 0.166667 -0.888889 0.222222 -0.944444 0.166667 -0.888889 0.166667 +-0.833333 0.222222 -0.888889 0.222222 -0.888889 0.166667 -0.833333 0.222222 -0.888889 0.166667 -0.833333 0.166667 +-0.777778 0.222222 -0.833333 0.222222 -0.833333 0.166667 -0.777778 0.222222 -0.833333 0.166667 -0.777778 0.166667 +-0.722222 0.222222 -0.777778 0.222222 -0.777778 0.166667 -0.722222 0.222222 -0.777778 0.166667 -0.722222 0.166667 +-0.666667 0.222222 -0.722222 0.222222 -0.722222 0.166667 -0.666667 0.222222 -0.722222 0.166667 -0.666667 0.166667 +-0.611111 0.222222 -0.666667 0.222222 -0.666667 0.166667 -0.611111 0.222222 -0.666667 0.166667 -0.611111 0.166667 +-0.555556 0.222222 -0.611111 0.222222 -0.611111 0.166667 -0.555556 0.222222 -0.611111 0.166667 -0.555556 0.166667 +-0.500000 0.222222 -0.555556 0.222222 -0.555556 0.166667 -0.500000 0.222222 -0.555556 0.166667 -0.500000 0.166667 +-0.444444 0.222222 -0.500000 0.222222 -0.500000 0.166667 -0.444444 0.222222 -0.500000 0.166667 -0.444444 0.166667 +-0.388889 0.222222 -0.444444 0.222222 -0.444444 0.166667 -0.388889 0.222222 -0.444444 0.166667 -0.388889 0.166667 +-0.333333 0.222222 -0.388889 0.222222 -0.388889 0.166667 -0.333333 0.222222 -0.388889 0.166667 -0.333333 0.166667 +-0.277778 0.222222 -0.333333 0.222222 -0.333333 0.166667 -0.277778 0.222222 -0.333333 0.166667 -0.277778 0.166667 +-0.222222 0.222222 -0.277778 0.222222 -0.277778 0.166667 -0.222222 0.222222 -0.277778 0.166667 -0.222222 0.166667 +-0.166667 0.222222 -0.222222 0.222222 -0.222222 0.166667 -0.166667 0.222222 -0.222222 0.166667 -0.166667 0.166667 +-0.111111 0.222222 -0.166667 0.222222 -0.166667 0.166667 -0.111111 0.222222 -0.166667 0.166667 -0.111111 0.166667 +-0.055556 0.222222 -0.111111 0.222222 -0.111111 0.166667 -0.055556 0.222222 -0.111111 0.166667 -0.055556 0.166667 + 0.000000 0.222222 -0.055556 0.222222 -0.055556 0.166667 0.000000 0.222222 -0.055556 0.166667 0.000000 0.166667 + 0.055556 0.222222 0.000000 0.222222 0.000000 0.166667 0.055556 0.222222 0.000000 0.166667 0.055556 0.166667 + 0.111111 0.222222 0.055556 0.222222 0.055556 0.166667 0.111111 0.222222 0.055556 0.166667 0.111111 0.166667 + 0.166667 0.222222 0.111111 0.222222 0.111111 0.166667 0.166667 0.222222 0.111111 0.166667 0.166667 0.166667 + 0.222222 0.222222 0.166667 0.222222 0.166667 0.166667 0.222222 0.222222 0.166667 0.166667 0.222222 0.166667 + 0.277778 0.222222 0.222222 0.222222 0.222222 0.166667 0.277778 0.222222 0.222222 0.166667 0.277778 0.166667 + 0.333333 0.222222 0.277778 0.222222 0.277778 0.166667 0.333333 0.222222 0.277778 0.166667 0.333333 0.166667 + 0.388889 0.222222 0.333333 0.222222 0.333333 0.166667 0.388889 0.222222 0.333333 0.166667 0.388889 0.166667 + 0.444444 0.222222 0.388889 0.222222 0.388889 0.166667 0.444444 0.222222 0.388889 0.166667 0.444444 0.166667 + 0.500000 0.222222 0.444444 0.222222 0.444444 0.166667 0.500000 0.222222 0.444444 0.166667 0.500000 0.166667 + 0.555556 0.222222 0.500000 0.222222 0.500000 0.166667 0.555556 0.222222 0.500000 0.166667 0.555556 0.166667 + 0.611111 0.222222 0.555556 0.222222 0.555556 0.166667 0.611111 0.222222 0.555556 0.166667 0.611111 0.166667 + 0.666667 0.222222 0.611111 0.222222 0.611111 0.166667 0.666667 0.222222 0.611111 0.166667 0.666667 0.166667 + 0.722222 0.222222 0.666667 0.222222 0.666667 0.166667 0.722222 0.222222 0.666667 0.166667 0.722222 0.166667 + 0.777778 0.222222 0.722222 0.222222 0.722222 0.166667 0.777778 0.222222 0.722222 0.166667 0.777778 0.166667 + 0.833333 0.222222 0.777778 0.222222 0.777778 0.166667 0.833333 0.222222 0.777778 0.166667 0.833333 0.166667 + 0.888889 0.222222 0.833333 0.222222 0.833333 0.166667 0.888889 0.222222 0.833333 0.166667 0.888889 0.166667 + 0.944444 0.222222 0.888889 0.222222 0.888889 0.166667 0.944444 0.222222 0.888889 0.166667 0.944444 0.166667 + 1.000000 0.222222 0.944444 0.222222 0.944444 0.166667 1.000000 0.222222 0.944444 0.166667 1.000000 0.166667 +-0.944444 0.277778 -1.000000 0.277778 -1.000000 0.222222 -0.944444 0.277778 -1.000000 0.222222 -0.944444 0.222222 +-0.888889 0.277778 -0.944444 0.277778 -0.944444 0.222222 -0.888889 0.277778 -0.944444 0.222222 -0.888889 0.222222 +-0.833333 0.277778 -0.888889 0.277778 -0.888889 0.222222 -0.833333 0.277778 -0.888889 0.222222 -0.833333 0.222222 +-0.777778 0.277778 -0.833333 0.277778 -0.833333 0.222222 -0.777778 0.277778 -0.833333 0.222222 -0.777778 0.222222 +-0.722222 0.277778 -0.777778 0.277778 -0.777778 0.222222 -0.722222 0.277778 -0.777778 0.222222 -0.722222 0.222222 +-0.666667 0.277778 -0.722222 0.277778 -0.722222 0.222222 -0.666667 0.277778 -0.722222 0.222222 -0.666667 0.222222 +-0.611111 0.277778 -0.666667 0.277778 -0.666667 0.222222 -0.611111 0.277778 -0.666667 0.222222 -0.611111 0.222222 +-0.555556 0.277778 -0.611111 0.277778 -0.611111 0.222222 -0.555556 0.277778 -0.611111 0.222222 -0.555556 0.222222 +-0.500000 0.277778 -0.555556 0.277778 -0.555556 0.222222 -0.500000 0.277778 -0.555556 0.222222 -0.500000 0.222222 +-0.444444 0.277778 -0.500000 0.277778 -0.500000 0.222222 -0.444444 0.277778 -0.500000 0.222222 -0.444444 0.222222 +-0.388889 0.277778 -0.444444 0.277778 -0.444444 0.222222 -0.388889 0.277778 -0.444444 0.222222 -0.388889 0.222222 +-0.333333 0.277778 -0.388889 0.277778 -0.388889 0.222222 -0.333333 0.277778 -0.388889 0.222222 -0.333333 0.222222 +-0.277778 0.277778 -0.333333 0.277778 -0.333333 0.222222 -0.277778 0.277778 -0.333333 0.222222 -0.277778 0.222222 +-0.222222 0.277778 -0.277778 0.277778 -0.277778 0.222222 -0.222222 0.277778 -0.277778 0.222222 -0.222222 0.222222 +-0.166667 0.277778 -0.222222 0.277778 -0.222222 0.222222 -0.166667 0.277778 -0.222222 0.222222 -0.166667 0.222222 +-0.111111 0.277778 -0.166667 0.277778 -0.166667 0.222222 -0.111111 0.277778 -0.166667 0.222222 -0.111111 0.222222 +-0.055556 0.277778 -0.111111 0.277778 -0.111111 0.222222 -0.055556 0.277778 -0.111111 0.222222 -0.055556 0.222222 + 0.000000 0.277778 -0.055556 0.277778 -0.055556 0.222222 0.000000 0.277778 -0.055556 0.222222 0.000000 0.222222 + 0.055556 0.277778 0.000000 0.277778 0.000000 0.222222 0.055556 0.277778 0.000000 0.222222 0.055556 0.222222 + 0.111111 0.277778 0.055556 0.277778 0.055556 0.222222 0.111111 0.277778 0.055556 0.222222 0.111111 0.222222 + 0.166667 0.277778 0.111111 0.277778 0.111111 0.222222 0.166667 0.277778 0.111111 0.222222 0.166667 0.222222 + 0.222222 0.277778 0.166667 0.277778 0.166667 0.222222 0.222222 0.277778 0.166667 0.222222 0.222222 0.222222 + 0.277778 0.277778 0.222222 0.277778 0.222222 0.222222 0.277778 0.277778 0.222222 0.222222 0.277778 0.222222 + 0.333333 0.277778 0.277778 0.277778 0.277778 0.222222 0.333333 0.277778 0.277778 0.222222 0.333333 0.222222 + 0.388889 0.277778 0.333333 0.277778 0.333333 0.222222 0.388889 0.277778 0.333333 0.222222 0.388889 0.222222 + 0.444444 0.277778 0.388889 0.277778 0.388889 0.222222 0.444444 0.277778 0.388889 0.222222 0.444444 0.222222 + 0.500000 0.277778 0.444444 0.277778 0.444444 0.222222 0.500000 0.277778 0.444444 0.222222 0.500000 0.222222 + 0.555556 0.277778 0.500000 0.277778 0.500000 0.222222 0.555556 0.277778 0.500000 0.222222 0.555556 0.222222 + 0.611111 0.277778 0.555556 0.277778 0.555556 0.222222 0.611111 0.277778 0.555556 0.222222 0.611111 0.222222 + 0.666667 0.277778 0.611111 0.277778 0.611111 0.222222 0.666667 0.277778 0.611111 0.222222 0.666667 0.222222 + 0.722222 0.277778 0.666667 0.277778 0.666667 0.222222 0.722222 0.277778 0.666667 0.222222 0.722222 0.222222 + 0.777778 0.277778 0.722222 0.277778 0.722222 0.222222 0.777778 0.277778 0.722222 0.222222 0.777778 0.222222 + 0.833333 0.277778 0.777778 0.277778 0.777778 0.222222 0.833333 0.277778 0.777778 0.222222 0.833333 0.222222 + 0.888889 0.277778 0.833333 0.277778 0.833333 0.222222 0.888889 0.277778 0.833333 0.222222 0.888889 0.222222 + 0.944444 0.277778 0.888889 0.277778 0.888889 0.222222 0.944444 0.277778 0.888889 0.222222 0.944444 0.222222 + 1.000000 0.277778 0.944444 0.277778 0.944444 0.222222 1.000000 0.277778 0.944444 0.222222 1.000000 0.222222 +-0.944444 0.333333 -1.000000 0.333333 -1.000000 0.277778 -0.944444 0.333333 -1.000000 0.277778 -0.944444 0.277778 +-0.888889 0.333333 -0.944444 0.333333 -0.944444 0.277778 -0.888889 0.333333 -0.944444 0.277778 -0.888889 0.277778 +-0.833333 0.333333 -0.888889 0.333333 -0.888889 0.277778 -0.833333 0.333333 -0.888889 0.277778 -0.833333 0.277778 +-0.777778 0.333333 -0.833333 0.333333 -0.833333 0.277778 -0.777778 0.333333 -0.833333 0.277778 -0.777778 0.277778 +-0.722222 0.333333 -0.777778 0.333333 -0.777778 0.277778 -0.722222 0.333333 -0.777778 0.277778 -0.722222 0.277778 +-0.666667 0.333333 -0.722222 0.333333 -0.722222 0.277778 -0.666667 0.333333 -0.722222 0.277778 -0.666667 0.277778 +-0.611111 0.333333 -0.666667 0.333333 -0.666667 0.277778 -0.611111 0.333333 -0.666667 0.277778 -0.611111 0.277778 +-0.555556 0.333333 -0.611111 0.333333 -0.611111 0.277778 -0.555556 0.333333 -0.611111 0.277778 -0.555556 0.277778 +-0.500000 0.333333 -0.555556 0.333333 -0.555556 0.277778 -0.500000 0.333333 -0.555556 0.277778 -0.500000 0.277778 +-0.444444 0.333333 -0.500000 0.333333 -0.500000 0.277778 -0.444444 0.333333 -0.500000 0.277778 -0.444444 0.277778 +-0.388889 0.333333 -0.444444 0.333333 -0.444444 0.277778 -0.388889 0.333333 -0.444444 0.277778 -0.388889 0.277778 +-0.333333 0.333333 -0.388889 0.333333 -0.388889 0.277778 -0.333333 0.333333 -0.388889 0.277778 -0.333333 0.277778 +-0.277778 0.333333 -0.333333 0.333333 -0.333333 0.277778 -0.277778 0.333333 -0.333333 0.277778 -0.277778 0.277778 +-0.222222 0.333333 -0.277778 0.333333 -0.277778 0.277778 -0.222222 0.333333 -0.277778 0.277778 -0.222222 0.277778 +-0.166667 0.333333 -0.222222 0.333333 -0.222222 0.277778 -0.166667 0.333333 -0.222222 0.277778 -0.166667 0.277778 +-0.111111 0.333333 -0.166667 0.333333 -0.166667 0.277778 -0.111111 0.333333 -0.166667 0.277778 -0.111111 0.277778 +-0.055556 0.333333 -0.111111 0.333333 -0.111111 0.277778 -0.055556 0.333333 -0.111111 0.277778 -0.055556 0.277778 + 0.000000 0.333333 -0.055556 0.333333 -0.055556 0.277778 0.000000 0.333333 -0.055556 0.277778 0.000000 0.277778 + 0.055556 0.333333 0.000000 0.333333 0.000000 0.277778 0.055556 0.333333 0.000000 0.277778 0.055556 0.277778 + 0.111111 0.333333 0.055556 0.333333 0.055556 0.277778 0.111111 0.333333 0.055556 0.277778 0.111111 0.277778 + 0.166667 0.333333 0.111111 0.333333 0.111111 0.277778 0.166667 0.333333 0.111111 0.277778 0.166667 0.277778 + 0.222222 0.333333 0.166667 0.333333 0.166667 0.277778 0.222222 0.333333 0.166667 0.277778 0.222222 0.277778 + 0.277778 0.333333 0.222222 0.333333 0.222222 0.277778 0.277778 0.333333 0.222222 0.277778 0.277778 0.277778 + 0.333333 0.333333 0.277778 0.333333 0.277778 0.277778 0.333333 0.333333 0.277778 0.277778 0.333333 0.277778 + 0.388889 0.333333 0.333333 0.333333 0.333333 0.277778 0.388889 0.333333 0.333333 0.277778 0.388889 0.277778 + 0.444444 0.333333 0.388889 0.333333 0.388889 0.277778 0.444444 0.333333 0.388889 0.277778 0.444444 0.277778 + 0.500000 0.333333 0.444444 0.333333 0.444444 0.277778 0.500000 0.333333 0.444444 0.277778 0.500000 0.277778 + 0.555556 0.333333 0.500000 0.333333 0.500000 0.277778 0.555556 0.333333 0.500000 0.277778 0.555556 0.277778 + 0.611111 0.333333 0.555556 0.333333 0.555556 0.277778 0.611111 0.333333 0.555556 0.277778 0.611111 0.277778 + 0.666667 0.333333 0.611111 0.333333 0.611111 0.277778 0.666667 0.333333 0.611111 0.277778 0.666667 0.277778 + 0.722222 0.333333 0.666667 0.333333 0.666667 0.277778 0.722222 0.333333 0.666667 0.277778 0.722222 0.277778 + 0.777778 0.333333 0.722222 0.333333 0.722222 0.277778 0.777778 0.333333 0.722222 0.277778 0.777778 0.277778 + 0.833333 0.333333 0.777778 0.333333 0.777778 0.277778 0.833333 0.333333 0.777778 0.277778 0.833333 0.277778 + 0.888889 0.333333 0.833333 0.333333 0.833333 0.277778 0.888889 0.333333 0.833333 0.277778 0.888889 0.277778 + 0.944444 0.333333 0.888889 0.333333 0.888889 0.277778 0.944444 0.333333 0.888889 0.277778 0.944444 0.277778 + 1.000000 0.333333 0.944444 0.333333 0.944444 0.277778 1.000000 0.333333 0.944444 0.277778 1.000000 0.277778 +-0.944444 0.388889 -1.000000 0.388889 -1.000000 0.333333 -0.944444 0.388889 -1.000000 0.333333 -0.944444 0.333333 +-0.888889 0.388889 -0.944444 0.388889 -0.944444 0.333333 -0.888889 0.388889 -0.944444 0.333333 -0.888889 0.333333 +-0.833333 0.388889 -0.888889 0.388889 -0.888889 0.333333 -0.833333 0.388889 -0.888889 0.333333 -0.833333 0.333333 +-0.777778 0.388889 -0.833333 0.388889 -0.833333 0.333333 -0.777778 0.388889 -0.833333 0.333333 -0.777778 0.333333 +-0.722222 0.388889 -0.777778 0.388889 -0.777778 0.333333 -0.722222 0.388889 -0.777778 0.333333 -0.722222 0.333333 +-0.666667 0.388889 -0.722222 0.388889 -0.722222 0.333333 -0.666667 0.388889 -0.722222 0.333333 -0.666667 0.333333 +-0.611111 0.388889 -0.666667 0.388889 -0.666667 0.333333 -0.611111 0.388889 -0.666667 0.333333 -0.611111 0.333333 +-0.555556 0.388889 -0.611111 0.388889 -0.611111 0.333333 -0.555556 0.388889 -0.611111 0.333333 -0.555556 0.333333 +-0.500000 0.388889 -0.555556 0.388889 -0.555556 0.333333 -0.500000 0.388889 -0.555556 0.333333 -0.500000 0.333333 +-0.444444 0.388889 -0.500000 0.388889 -0.500000 0.333333 -0.444444 0.388889 -0.500000 0.333333 -0.444444 0.333333 +-0.388889 0.388889 -0.444444 0.388889 -0.444444 0.333333 -0.388889 0.388889 -0.444444 0.333333 -0.388889 0.333333 +-0.333333 0.388889 -0.388889 0.388889 -0.388889 0.333333 -0.333333 0.388889 -0.388889 0.333333 -0.333333 0.333333 +-0.277778 0.388889 -0.333333 0.388889 -0.333333 0.333333 -0.277778 0.388889 -0.333333 0.333333 -0.277778 0.333333 +-0.222222 0.388889 -0.277778 0.388889 -0.277778 0.333333 -0.222222 0.388889 -0.277778 0.333333 -0.222222 0.333333 +-0.166667 0.388889 -0.222222 0.388889 -0.222222 0.333333 -0.166667 0.388889 -0.222222 0.333333 -0.166667 0.333333 +-0.111111 0.388889 -0.166667 0.388889 -0.166667 0.333333 -0.111111 0.388889 -0.166667 0.333333 -0.111111 0.333333 +-0.055556 0.388889 -0.111111 0.388889 -0.111111 0.333333 -0.055556 0.388889 -0.111111 0.333333 -0.055556 0.333333 + 0.000000 0.388889 -0.055556 0.388889 -0.055556 0.333333 0.000000 0.388889 -0.055556 0.333333 0.000000 0.333333 + 0.055556 0.388889 0.000000 0.388889 0.000000 0.333333 0.055556 0.388889 0.000000 0.333333 0.055556 0.333333 + 0.111111 0.388889 0.055556 0.388889 0.055556 0.333333 0.111111 0.388889 0.055556 0.333333 0.111111 0.333333 + 0.166667 0.388889 0.111111 0.388889 0.111111 0.333333 0.166667 0.388889 0.111111 0.333333 0.166667 0.333333 + 0.222222 0.388889 0.166667 0.388889 0.166667 0.333333 0.222222 0.388889 0.166667 0.333333 0.222222 0.333333 + 0.277778 0.388889 0.222222 0.388889 0.222222 0.333333 0.277778 0.388889 0.222222 0.333333 0.277778 0.333333 + 0.333333 0.388889 0.277778 0.388889 0.277778 0.333333 0.333333 0.388889 0.277778 0.333333 0.333333 0.333333 + 0.388889 0.388889 0.333333 0.388889 0.333333 0.333333 0.388889 0.388889 0.333333 0.333333 0.388889 0.333333 + 0.444444 0.388889 0.388889 0.388889 0.388889 0.333333 0.444444 0.388889 0.388889 0.333333 0.444444 0.333333 + 0.500000 0.388889 0.444444 0.388889 0.444444 0.333333 0.500000 0.388889 0.444444 0.333333 0.500000 0.333333 + 0.555556 0.388889 0.500000 0.388889 0.500000 0.333333 0.555556 0.388889 0.500000 0.333333 0.555556 0.333333 + 0.611111 0.388889 0.555556 0.388889 0.555556 0.333333 0.611111 0.388889 0.555556 0.333333 0.611111 0.333333 + 0.666667 0.388889 0.611111 0.388889 0.611111 0.333333 0.666667 0.388889 0.611111 0.333333 0.666667 0.333333 + 0.722222 0.388889 0.666667 0.388889 0.666667 0.333333 0.722222 0.388889 0.666667 0.333333 0.722222 0.333333 + 0.777778 0.388889 0.722222 0.388889 0.722222 0.333333 0.777778 0.388889 0.722222 0.333333 0.777778 0.333333 + 0.833333 0.388889 0.777778 0.388889 0.777778 0.333333 0.833333 0.388889 0.777778 0.333333 0.833333 0.333333 + 0.888889 0.388889 0.833333 0.388889 0.833333 0.333333 0.888889 0.388889 0.833333 0.333333 0.888889 0.333333 + 0.944444 0.388889 0.888889 0.388889 0.888889 0.333333 0.944444 0.388889 0.888889 0.333333 0.944444 0.333333 + 1.000000 0.388889 0.944444 0.388889 0.944444 0.333333 1.000000 0.388889 0.944444 0.333333 1.000000 0.333333 +-0.944444 0.444444 -1.000000 0.444444 -1.000000 0.388889 -0.944444 0.444444 -1.000000 0.388889 -0.944444 0.388889 +-0.888889 0.444444 -0.944444 0.444444 -0.944444 0.388889 -0.888889 0.444444 -0.944444 0.388889 -0.888889 0.388889 +-0.833333 0.444444 -0.888889 0.444444 -0.888889 0.388889 -0.833333 0.444444 -0.888889 0.388889 -0.833333 0.388889 +-0.777778 0.444444 -0.833333 0.444444 -0.833333 0.388889 -0.777778 0.444444 -0.833333 0.388889 -0.777778 0.388889 +-0.722222 0.444444 -0.777778 0.444444 -0.777778 0.388889 -0.722222 0.444444 -0.777778 0.388889 -0.722222 0.388889 +-0.666667 0.444444 -0.722222 0.444444 -0.722222 0.388889 -0.666667 0.444444 -0.722222 0.388889 -0.666667 0.388889 +-0.611111 0.444444 -0.666667 0.444444 -0.666667 0.388889 -0.611111 0.444444 -0.666667 0.388889 -0.611111 0.388889 +-0.555556 0.444444 -0.611111 0.444444 -0.611111 0.388889 -0.555556 0.444444 -0.611111 0.388889 -0.555556 0.388889 +-0.500000 0.444444 -0.555556 0.444444 -0.555556 0.388889 -0.500000 0.444444 -0.555556 0.388889 -0.500000 0.388889 +-0.444444 0.444444 -0.500000 0.444444 -0.500000 0.388889 -0.444444 0.444444 -0.500000 0.388889 -0.444444 0.388889 +-0.388889 0.444444 -0.444444 0.444444 -0.444444 0.388889 -0.388889 0.444444 -0.444444 0.388889 -0.388889 0.388889 +-0.333333 0.444444 -0.388889 0.444444 -0.388889 0.388889 -0.333333 0.444444 -0.388889 0.388889 -0.333333 0.388889 +-0.277778 0.444444 -0.333333 0.444444 -0.333333 0.388889 -0.277778 0.444444 -0.333333 0.388889 -0.277778 0.388889 +-0.222222 0.444444 -0.277778 0.444444 -0.277778 0.388889 -0.222222 0.444444 -0.277778 0.388889 -0.222222 0.388889 +-0.166667 0.444444 -0.222222 0.444444 -0.222222 0.388889 -0.166667 0.444444 -0.222222 0.388889 -0.166667 0.388889 +-0.111111 0.444444 -0.166667 0.444444 -0.166667 0.388889 -0.111111 0.444444 -0.166667 0.388889 -0.111111 0.388889 +-0.055556 0.444444 -0.111111 0.444444 -0.111111 0.388889 -0.055556 0.444444 -0.111111 0.388889 -0.055556 0.388889 + 0.000000 0.444444 -0.055556 0.444444 -0.055556 0.388889 0.000000 0.444444 -0.055556 0.388889 0.000000 0.388889 + 0.055556 0.444444 0.000000 0.444444 0.000000 0.388889 0.055556 0.444444 0.000000 0.388889 0.055556 0.388889 + 0.111111 0.444444 0.055556 0.444444 0.055556 0.388889 0.111111 0.444444 0.055556 0.388889 0.111111 0.388889 + 0.166667 0.444444 0.111111 0.444444 0.111111 0.388889 0.166667 0.444444 0.111111 0.388889 0.166667 0.388889 + 0.222222 0.444444 0.166667 0.444444 0.166667 0.388889 0.222222 0.444444 0.166667 0.388889 0.222222 0.388889 + 0.277778 0.444444 0.222222 0.444444 0.222222 0.388889 0.277778 0.444444 0.222222 0.388889 0.277778 0.388889 + 0.333333 0.444444 0.277778 0.444444 0.277778 0.388889 0.333333 0.444444 0.277778 0.388889 0.333333 0.388889 + 0.388889 0.444444 0.333333 0.444444 0.333333 0.388889 0.388889 0.444444 0.333333 0.388889 0.388889 0.388889 + 0.444444 0.444444 0.388889 0.444444 0.388889 0.388889 0.444444 0.444444 0.388889 0.388889 0.444444 0.388889 + 0.500000 0.444444 0.444444 0.444444 0.444444 0.388889 0.500000 0.444444 0.444444 0.388889 0.500000 0.388889 + 0.555556 0.444444 0.500000 0.444444 0.500000 0.388889 0.555556 0.444444 0.500000 0.388889 0.555556 0.388889 + 0.611111 0.444444 0.555556 0.444444 0.555556 0.388889 0.611111 0.444444 0.555556 0.388889 0.611111 0.388889 + 0.666667 0.444444 0.611111 0.444444 0.611111 0.388889 0.666667 0.444444 0.611111 0.388889 0.666667 0.388889 + 0.722222 0.444444 0.666667 0.444444 0.666667 0.388889 0.722222 0.444444 0.666667 0.388889 0.722222 0.388889 + 0.777778 0.444444 0.722222 0.444444 0.722222 0.388889 0.777778 0.444444 0.722222 0.388889 0.777778 0.388889 + 0.833333 0.444444 0.777778 0.444444 0.777778 0.388889 0.833333 0.444444 0.777778 0.388889 0.833333 0.388889 + 0.888889 0.444444 0.833333 0.444444 0.833333 0.388889 0.888889 0.444444 0.833333 0.388889 0.888889 0.388889 + 0.944444 0.444444 0.888889 0.444444 0.888889 0.388889 0.944444 0.444444 0.888889 0.388889 0.944444 0.388889 + 1.000000 0.444444 0.944444 0.444444 0.944444 0.388889 1.000000 0.444444 0.944444 0.388889 1.000000 0.388889 +-0.944444 0.500000 -1.000000 0.500000 -1.000000 0.444444 -0.944444 0.500000 -1.000000 0.444444 -0.944444 0.444444 +-0.888889 0.500000 -0.944444 0.500000 -0.944444 0.444444 -0.888889 0.500000 -0.944444 0.444444 -0.888889 0.444444 +-0.833333 0.500000 -0.888889 0.500000 -0.888889 0.444444 -0.833333 0.500000 -0.888889 0.444444 -0.833333 0.444444 +-0.777778 0.500000 -0.833333 0.500000 -0.833333 0.444444 -0.777778 0.500000 -0.833333 0.444444 -0.777778 0.444444 +-0.722222 0.500000 -0.777778 0.500000 -0.777778 0.444444 -0.722222 0.500000 -0.777778 0.444444 -0.722222 0.444444 +-0.666667 0.500000 -0.722222 0.500000 -0.722222 0.444444 -0.666667 0.500000 -0.722222 0.444444 -0.666667 0.444444 +-0.611111 0.500000 -0.666667 0.500000 -0.666667 0.444444 -0.611111 0.500000 -0.666667 0.444444 -0.611111 0.444444 +-0.555556 0.500000 -0.611111 0.500000 -0.611111 0.444444 -0.555556 0.500000 -0.611111 0.444444 -0.555556 0.444444 +-0.500000 0.500000 -0.555556 0.500000 -0.555556 0.444444 -0.500000 0.500000 -0.555556 0.444444 -0.500000 0.444444 +-0.444444 0.500000 -0.500000 0.500000 -0.500000 0.444444 -0.444444 0.500000 -0.500000 0.444444 -0.444444 0.444444 +-0.388889 0.500000 -0.444444 0.500000 -0.444444 0.444444 -0.388889 0.500000 -0.444444 0.444444 -0.388889 0.444444 +-0.333333 0.500000 -0.388889 0.500000 -0.388889 0.444444 -0.333333 0.500000 -0.388889 0.444444 -0.333333 0.444444 +-0.277778 0.500000 -0.333333 0.500000 -0.333333 0.444444 -0.277778 0.500000 -0.333333 0.444444 -0.277778 0.444444 +-0.222222 0.500000 -0.277778 0.500000 -0.277778 0.444444 -0.222222 0.500000 -0.277778 0.444444 -0.222222 0.444444 +-0.166667 0.500000 -0.222222 0.500000 -0.222222 0.444444 -0.166667 0.500000 -0.222222 0.444444 -0.166667 0.444444 +-0.111111 0.500000 -0.166667 0.500000 -0.166667 0.444444 -0.111111 0.500000 -0.166667 0.444444 -0.111111 0.444444 +-0.055556 0.500000 -0.111111 0.500000 -0.111111 0.444444 -0.055556 0.500000 -0.111111 0.444444 -0.055556 0.444444 + 0.000000 0.500000 -0.055556 0.500000 -0.055556 0.444444 0.000000 0.500000 -0.055556 0.444444 0.000000 0.444444 + 0.055556 0.500000 0.000000 0.500000 0.000000 0.444444 0.055556 0.500000 0.000000 0.444444 0.055556 0.444444 + 0.111111 0.500000 0.055556 0.500000 0.055556 0.444444 0.111111 0.500000 0.055556 0.444444 0.111111 0.444444 + 0.166667 0.500000 0.111111 0.500000 0.111111 0.444444 0.166667 0.500000 0.111111 0.444444 0.166667 0.444444 + 0.222222 0.500000 0.166667 0.500000 0.166667 0.444444 0.222222 0.500000 0.166667 0.444444 0.222222 0.444444 + 0.277778 0.500000 0.222222 0.500000 0.222222 0.444444 0.277778 0.500000 0.222222 0.444444 0.277778 0.444444 + 0.333333 0.500000 0.277778 0.500000 0.277778 0.444444 0.333333 0.500000 0.277778 0.444444 0.333333 0.444444 + 0.388889 0.500000 0.333333 0.500000 0.333333 0.444444 0.388889 0.500000 0.333333 0.444444 0.388889 0.444444 + 0.444444 0.500000 0.388889 0.500000 0.388889 0.444444 0.444444 0.500000 0.388889 0.444444 0.444444 0.444444 + 0.500000 0.500000 0.444444 0.500000 0.444444 0.444444 0.500000 0.500000 0.444444 0.444444 0.500000 0.444444 + 0.555556 0.500000 0.500000 0.500000 0.500000 0.444444 0.555556 0.500000 0.500000 0.444444 0.555556 0.444444 + 0.611111 0.500000 0.555556 0.500000 0.555556 0.444444 0.611111 0.500000 0.555556 0.444444 0.611111 0.444444 + 0.666667 0.500000 0.611111 0.500000 0.611111 0.444444 0.666667 0.500000 0.611111 0.444444 0.666667 0.444444 + 0.722222 0.500000 0.666667 0.500000 0.666667 0.444444 0.722222 0.500000 0.666667 0.444444 0.722222 0.444444 + 0.777778 0.500000 0.722222 0.500000 0.722222 0.444444 0.777778 0.500000 0.722222 0.444444 0.777778 0.444444 + 0.833333 0.500000 0.777778 0.500000 0.777778 0.444444 0.833333 0.500000 0.777778 0.444444 0.833333 0.444444 + 0.888889 0.500000 0.833333 0.500000 0.833333 0.444444 0.888889 0.500000 0.833333 0.444444 0.888889 0.444444 + 0.944444 0.500000 0.888889 0.500000 0.888889 0.444444 0.944444 0.500000 0.888889 0.444444 0.944444 0.444444 + 1.000000 0.500000 0.944444 0.500000 0.944444 0.444444 1.000000 0.500000 0.944444 0.444444 1.000000 0.444444 +-0.944444 0.555556 -1.000000 0.555556 -1.000000 0.500000 -0.944444 0.555556 -1.000000 0.500000 -0.944444 0.500000 +-0.888889 0.555556 -0.944444 0.555556 -0.944444 0.500000 -0.888889 0.555556 -0.944444 0.500000 -0.888889 0.500000 +-0.833333 0.555556 -0.888889 0.555556 -0.888889 0.500000 -0.833333 0.555556 -0.888889 0.500000 -0.833333 0.500000 +-0.777778 0.555556 -0.833333 0.555556 -0.833333 0.500000 -0.777778 0.555556 -0.833333 0.500000 -0.777778 0.500000 +-0.722222 0.555556 -0.777778 0.555556 -0.777778 0.500000 -0.722222 0.555556 -0.777778 0.500000 -0.722222 0.500000 +-0.666667 0.555556 -0.722222 0.555556 -0.722222 0.500000 -0.666667 0.555556 -0.722222 0.500000 -0.666667 0.500000 +-0.611111 0.555556 -0.666667 0.555556 -0.666667 0.500000 -0.611111 0.555556 -0.666667 0.500000 -0.611111 0.500000 +-0.555556 0.555556 -0.611111 0.555556 -0.611111 0.500000 -0.555556 0.555556 -0.611111 0.500000 -0.555556 0.500000 +-0.500000 0.555556 -0.555556 0.555556 -0.555556 0.500000 -0.500000 0.555556 -0.555556 0.500000 -0.500000 0.500000 +-0.444444 0.555556 -0.500000 0.555556 -0.500000 0.500000 -0.444444 0.555556 -0.500000 0.500000 -0.444444 0.500000 +-0.388889 0.555556 -0.444444 0.555556 -0.444444 0.500000 -0.388889 0.555556 -0.444444 0.500000 -0.388889 0.500000 +-0.333333 0.555556 -0.388889 0.555556 -0.388889 0.500000 -0.333333 0.555556 -0.388889 0.500000 -0.333333 0.500000 +-0.277778 0.555556 -0.333333 0.555556 -0.333333 0.500000 -0.277778 0.555556 -0.333333 0.500000 -0.277778 0.500000 +-0.222222 0.555556 -0.277778 0.555556 -0.277778 0.500000 -0.222222 0.555556 -0.277778 0.500000 -0.222222 0.500000 +-0.166667 0.555556 -0.222222 0.555556 -0.222222 0.500000 -0.166667 0.555556 -0.222222 0.500000 -0.166667 0.500000 +-0.111111 0.555556 -0.166667 0.555556 -0.166667 0.500000 -0.111111 0.555556 -0.166667 0.500000 -0.111111 0.500000 +-0.055556 0.555556 -0.111111 0.555556 -0.111111 0.500000 -0.055556 0.555556 -0.111111 0.500000 -0.055556 0.500000 + 0.000000 0.555556 -0.055556 0.555556 -0.055556 0.500000 0.000000 0.555556 -0.055556 0.500000 0.000000 0.500000 + 0.055556 0.555556 0.000000 0.555556 0.000000 0.500000 0.055556 0.555556 0.000000 0.500000 0.055556 0.500000 + 0.111111 0.555556 0.055556 0.555556 0.055556 0.500000 0.111111 0.555556 0.055556 0.500000 0.111111 0.500000 + 0.166667 0.555556 0.111111 0.555556 0.111111 0.500000 0.166667 0.555556 0.111111 0.500000 0.166667 0.500000 + 0.222222 0.555556 0.166667 0.555556 0.166667 0.500000 0.222222 0.555556 0.166667 0.500000 0.222222 0.500000 + 0.277778 0.555556 0.222222 0.555556 0.222222 0.500000 0.277778 0.555556 0.222222 0.500000 0.277778 0.500000 + 0.333333 0.555556 0.277778 0.555556 0.277778 0.500000 0.333333 0.555556 0.277778 0.500000 0.333333 0.500000 + 0.388889 0.555556 0.333333 0.555556 0.333333 0.500000 0.388889 0.555556 0.333333 0.500000 0.388889 0.500000 + 0.444444 0.555556 0.388889 0.555556 0.388889 0.500000 0.444444 0.555556 0.388889 0.500000 0.444444 0.500000 + 0.500000 0.555556 0.444444 0.555556 0.444444 0.500000 0.500000 0.555556 0.444444 0.500000 0.500000 0.500000 + 0.555556 0.555556 0.500000 0.555556 0.500000 0.500000 0.555556 0.555556 0.500000 0.500000 0.555556 0.500000 + 0.611111 0.555556 0.555556 0.555556 0.555556 0.500000 0.611111 0.555556 0.555556 0.500000 0.611111 0.500000 + 0.666667 0.555556 0.611111 0.555556 0.611111 0.500000 0.666667 0.555556 0.611111 0.500000 0.666667 0.500000 + 0.722222 0.555556 0.666667 0.555556 0.666667 0.500000 0.722222 0.555556 0.666667 0.500000 0.722222 0.500000 + 0.777778 0.555556 0.722222 0.555556 0.722222 0.500000 0.777778 0.555556 0.722222 0.500000 0.777778 0.500000 + 0.833333 0.555556 0.777778 0.555556 0.777778 0.500000 0.833333 0.555556 0.777778 0.500000 0.833333 0.500000 + 0.888889 0.555556 0.833333 0.555556 0.833333 0.500000 0.888889 0.555556 0.833333 0.500000 0.888889 0.500000 + 0.944444 0.555556 0.888889 0.555556 0.888889 0.500000 0.944444 0.555556 0.888889 0.500000 0.944444 0.500000 + 1.000000 0.555556 0.944444 0.555556 0.944444 0.500000 1.000000 0.555556 0.944444 0.500000 1.000000 0.500000 +-0.944444 0.611111 -1.000000 0.611111 -1.000000 0.555556 -0.944444 0.611111 -1.000000 0.555556 -0.944444 0.555556 +-0.888889 0.611111 -0.944444 0.611111 -0.944444 0.555556 -0.888889 0.611111 -0.944444 0.555556 -0.888889 0.555556 +-0.833333 0.611111 -0.888889 0.611111 -0.888889 0.555556 -0.833333 0.611111 -0.888889 0.555556 -0.833333 0.555556 +-0.777778 0.611111 -0.833333 0.611111 -0.833333 0.555556 -0.777778 0.611111 -0.833333 0.555556 -0.777778 0.555556 +-0.722222 0.611111 -0.777778 0.611111 -0.777778 0.555556 -0.722222 0.611111 -0.777778 0.555556 -0.722222 0.555556 +-0.666667 0.611111 -0.722222 0.611111 -0.722222 0.555556 -0.666667 0.611111 -0.722222 0.555556 -0.666667 0.555556 +-0.611111 0.611111 -0.666667 0.611111 -0.666667 0.555556 -0.611111 0.611111 -0.666667 0.555556 -0.611111 0.555556 +-0.555556 0.611111 -0.611111 0.611111 -0.611111 0.555556 -0.555556 0.611111 -0.611111 0.555556 -0.555556 0.555556 +-0.500000 0.611111 -0.555556 0.611111 -0.555556 0.555556 -0.500000 0.611111 -0.555556 0.555556 -0.500000 0.555556 +-0.444444 0.611111 -0.500000 0.611111 -0.500000 0.555556 -0.444444 0.611111 -0.500000 0.555556 -0.444444 0.555556 +-0.388889 0.611111 -0.444444 0.611111 -0.444444 0.555556 -0.388889 0.611111 -0.444444 0.555556 -0.388889 0.555556 +-0.333333 0.611111 -0.388889 0.611111 -0.388889 0.555556 -0.333333 0.611111 -0.388889 0.555556 -0.333333 0.555556 +-0.277778 0.611111 -0.333333 0.611111 -0.333333 0.555556 -0.277778 0.611111 -0.333333 0.555556 -0.277778 0.555556 +-0.222222 0.611111 -0.277778 0.611111 -0.277778 0.555556 -0.222222 0.611111 -0.277778 0.555556 -0.222222 0.555556 +-0.166667 0.611111 -0.222222 0.611111 -0.222222 0.555556 -0.166667 0.611111 -0.222222 0.555556 -0.166667 0.555556 +-0.111111 0.611111 -0.166667 0.611111 -0.166667 0.555556 -0.111111 0.611111 -0.166667 0.555556 -0.111111 0.555556 +-0.055556 0.611111 -0.111111 0.611111 -0.111111 0.555556 -0.055556 0.611111 -0.111111 0.555556 -0.055556 0.555556 + 0.000000 0.611111 -0.055556 0.611111 -0.055556 0.555556 0.000000 0.611111 -0.055556 0.555556 0.000000 0.555556 + 0.055556 0.611111 0.000000 0.611111 0.000000 0.555556 0.055556 0.611111 0.000000 0.555556 0.055556 0.555556 + 0.111111 0.611111 0.055556 0.611111 0.055556 0.555556 0.111111 0.611111 0.055556 0.555556 0.111111 0.555556 + 0.166667 0.611111 0.111111 0.611111 0.111111 0.555556 0.166667 0.611111 0.111111 0.555556 0.166667 0.555556 + 0.222222 0.611111 0.166667 0.611111 0.166667 0.555556 0.222222 0.611111 0.166667 0.555556 0.222222 0.555556 + 0.277778 0.611111 0.222222 0.611111 0.222222 0.555556 0.277778 0.611111 0.222222 0.555556 0.277778 0.555556 + 0.333333 0.611111 0.277778 0.611111 0.277778 0.555556 0.333333 0.611111 0.277778 0.555556 0.333333 0.555556 + 0.388889 0.611111 0.333333 0.611111 0.333333 0.555556 0.388889 0.611111 0.333333 0.555556 0.388889 0.555556 + 0.444444 0.611111 0.388889 0.611111 0.388889 0.555556 0.444444 0.611111 0.388889 0.555556 0.444444 0.555556 + 0.500000 0.611111 0.444444 0.611111 0.444444 0.555556 0.500000 0.611111 0.444444 0.555556 0.500000 0.555556 + 0.555556 0.611111 0.500000 0.611111 0.500000 0.555556 0.555556 0.611111 0.500000 0.555556 0.555556 0.555556 + 0.611111 0.611111 0.555556 0.611111 0.555556 0.555556 0.611111 0.611111 0.555556 0.555556 0.611111 0.555556 + 0.666667 0.611111 0.611111 0.611111 0.611111 0.555556 0.666667 0.611111 0.611111 0.555556 0.666667 0.555556 + 0.722222 0.611111 0.666667 0.611111 0.666667 0.555556 0.722222 0.611111 0.666667 0.555556 0.722222 0.555556 + 0.777778 0.611111 0.722222 0.611111 0.722222 0.555556 0.777778 0.611111 0.722222 0.555556 0.777778 0.555556 + 0.833333 0.611111 0.777778 0.611111 0.777778 0.555556 0.833333 0.611111 0.777778 0.555556 0.833333 0.555556 + 0.888889 0.611111 0.833333 0.611111 0.833333 0.555556 0.888889 0.611111 0.833333 0.555556 0.888889 0.555556 + 0.944444 0.611111 0.888889 0.611111 0.888889 0.555556 0.944444 0.611111 0.888889 0.555556 0.944444 0.555556 + 1.000000 0.611111 0.944444 0.611111 0.944444 0.555556 1.000000 0.611111 0.944444 0.555556 1.000000 0.555556 +-0.944444 0.666667 -1.000000 0.666667 -1.000000 0.611111 -0.944444 0.666667 -1.000000 0.611111 -0.944444 0.611111 +-0.888889 0.666667 -0.944444 0.666667 -0.944444 0.611111 -0.888889 0.666667 -0.944444 0.611111 -0.888889 0.611111 +-0.833333 0.666667 -0.888889 0.666667 -0.888889 0.611111 -0.833333 0.666667 -0.888889 0.611111 -0.833333 0.611111 +-0.777778 0.666667 -0.833333 0.666667 -0.833333 0.611111 -0.777778 0.666667 -0.833333 0.611111 -0.777778 0.611111 +-0.722222 0.666667 -0.777778 0.666667 -0.777778 0.611111 -0.722222 0.666667 -0.777778 0.611111 -0.722222 0.611111 +-0.666667 0.666667 -0.722222 0.666667 -0.722222 0.611111 -0.666667 0.666667 -0.722222 0.611111 -0.666667 0.611111 +-0.611111 0.666667 -0.666667 0.666667 -0.666667 0.611111 -0.611111 0.666667 -0.666667 0.611111 -0.611111 0.611111 +-0.555556 0.666667 -0.611111 0.666667 -0.611111 0.611111 -0.555556 0.666667 -0.611111 0.611111 -0.555556 0.611111 +-0.500000 0.666667 -0.555556 0.666667 -0.555556 0.611111 -0.500000 0.666667 -0.555556 0.611111 -0.500000 0.611111 +-0.444444 0.666667 -0.500000 0.666667 -0.500000 0.611111 -0.444444 0.666667 -0.500000 0.611111 -0.444444 0.611111 +-0.388889 0.666667 -0.444444 0.666667 -0.444444 0.611111 -0.388889 0.666667 -0.444444 0.611111 -0.388889 0.611111 +-0.333333 0.666667 -0.388889 0.666667 -0.388889 0.611111 -0.333333 0.666667 -0.388889 0.611111 -0.333333 0.611111 +-0.277778 0.666667 -0.333333 0.666667 -0.333333 0.611111 -0.277778 0.666667 -0.333333 0.611111 -0.277778 0.611111 +-0.222222 0.666667 -0.277778 0.666667 -0.277778 0.611111 -0.222222 0.666667 -0.277778 0.611111 -0.222222 0.611111 +-0.166667 0.666667 -0.222222 0.666667 -0.222222 0.611111 -0.166667 0.666667 -0.222222 0.611111 -0.166667 0.611111 +-0.111111 0.666667 -0.166667 0.666667 -0.166667 0.611111 -0.111111 0.666667 -0.166667 0.611111 -0.111111 0.611111 +-0.055556 0.666667 -0.111111 0.666667 -0.111111 0.611111 -0.055556 0.666667 -0.111111 0.611111 -0.055556 0.611111 + 0.000000 0.666667 -0.055556 0.666667 -0.055556 0.611111 0.000000 0.666667 -0.055556 0.611111 0.000000 0.611111 + 0.055556 0.666667 0.000000 0.666667 0.000000 0.611111 0.055556 0.666667 0.000000 0.611111 0.055556 0.611111 + 0.111111 0.666667 0.055556 0.666667 0.055556 0.611111 0.111111 0.666667 0.055556 0.611111 0.111111 0.611111 + 0.166667 0.666667 0.111111 0.666667 0.111111 0.611111 0.166667 0.666667 0.111111 0.611111 0.166667 0.611111 + 0.222222 0.666667 0.166667 0.666667 0.166667 0.611111 0.222222 0.666667 0.166667 0.611111 0.222222 0.611111 + 0.277778 0.666667 0.222222 0.666667 0.222222 0.611111 0.277778 0.666667 0.222222 0.611111 0.277778 0.611111 + 0.333333 0.666667 0.277778 0.666667 0.277778 0.611111 0.333333 0.666667 0.277778 0.611111 0.333333 0.611111 + 0.388889 0.666667 0.333333 0.666667 0.333333 0.611111 0.388889 0.666667 0.333333 0.611111 0.388889 0.611111 + 0.444444 0.666667 0.388889 0.666667 0.388889 0.611111 0.444444 0.666667 0.388889 0.611111 0.444444 0.611111 + 0.500000 0.666667 0.444444 0.666667 0.444444 0.611111 0.500000 0.666667 0.444444 0.611111 0.500000 0.611111 + 0.555556 0.666667 0.500000 0.666667 0.500000 0.611111 0.555556 0.666667 0.500000 0.611111 0.555556 0.611111 + 0.611111 0.666667 0.555556 0.666667 0.555556 0.611111 0.611111 0.666667 0.555556 0.611111 0.611111 0.611111 + 0.666667 0.666667 0.611111 0.666667 0.611111 0.611111 0.666667 0.666667 0.611111 0.611111 0.666667 0.611111 + 0.722222 0.666667 0.666667 0.666667 0.666667 0.611111 0.722222 0.666667 0.666667 0.611111 0.722222 0.611111 + 0.777778 0.666667 0.722222 0.666667 0.722222 0.611111 0.777778 0.666667 0.722222 0.611111 0.777778 0.611111 + 0.833333 0.666667 0.777778 0.666667 0.777778 0.611111 0.833333 0.666667 0.777778 0.611111 0.833333 0.611111 + 0.888889 0.666667 0.833333 0.666667 0.833333 0.611111 0.888889 0.666667 0.833333 0.611111 0.888889 0.611111 + 0.944444 0.666667 0.888889 0.666667 0.888889 0.611111 0.944444 0.666667 0.888889 0.611111 0.944444 0.611111 + 1.000000 0.666667 0.944444 0.666667 0.944444 0.611111 1.000000 0.666667 0.944444 0.611111 1.000000 0.611111 +-0.944444 0.722222 -1.000000 0.722222 -1.000000 0.666667 -0.944444 0.722222 -1.000000 0.666667 -0.944444 0.666667 +-0.888889 0.722222 -0.944444 0.722222 -0.944444 0.666667 -0.888889 0.722222 -0.944444 0.666667 -0.888889 0.666667 +-0.833333 0.722222 -0.888889 0.722222 -0.888889 0.666667 -0.833333 0.722222 -0.888889 0.666667 -0.833333 0.666667 +-0.777778 0.722222 -0.833333 0.722222 -0.833333 0.666667 -0.777778 0.722222 -0.833333 0.666667 -0.777778 0.666667 +-0.722222 0.722222 -0.777778 0.722222 -0.777778 0.666667 -0.722222 0.722222 -0.777778 0.666667 -0.722222 0.666667 +-0.666667 0.722222 -0.722222 0.722222 -0.722222 0.666667 -0.666667 0.722222 -0.722222 0.666667 -0.666667 0.666667 +-0.611111 0.722222 -0.666667 0.722222 -0.666667 0.666667 -0.611111 0.722222 -0.666667 0.666667 -0.611111 0.666667 +-0.555556 0.722222 -0.611111 0.722222 -0.611111 0.666667 -0.555556 0.722222 -0.611111 0.666667 -0.555556 0.666667 +-0.500000 0.722222 -0.555556 0.722222 -0.555556 0.666667 -0.500000 0.722222 -0.555556 0.666667 -0.500000 0.666667 +-0.444444 0.722222 -0.500000 0.722222 -0.500000 0.666667 -0.444444 0.722222 -0.500000 0.666667 -0.444444 0.666667 +-0.388889 0.722222 -0.444444 0.722222 -0.444444 0.666667 -0.388889 0.722222 -0.444444 0.666667 -0.388889 0.666667 +-0.333333 0.722222 -0.388889 0.722222 -0.388889 0.666667 -0.333333 0.722222 -0.388889 0.666667 -0.333333 0.666667 +-0.277778 0.722222 -0.333333 0.722222 -0.333333 0.666667 -0.277778 0.722222 -0.333333 0.666667 -0.277778 0.666667 +-0.222222 0.722222 -0.277778 0.722222 -0.277778 0.666667 -0.222222 0.722222 -0.277778 0.666667 -0.222222 0.666667 +-0.166667 0.722222 -0.222222 0.722222 -0.222222 0.666667 -0.166667 0.722222 -0.222222 0.666667 -0.166667 0.666667 +-0.111111 0.722222 -0.166667 0.722222 -0.166667 0.666667 -0.111111 0.722222 -0.166667 0.666667 -0.111111 0.666667 +-0.055556 0.722222 -0.111111 0.722222 -0.111111 0.666667 -0.055556 0.722222 -0.111111 0.666667 -0.055556 0.666667 + 0.000000 0.722222 -0.055556 0.722222 -0.055556 0.666667 0.000000 0.722222 -0.055556 0.666667 0.000000 0.666667 + 0.055556 0.722222 0.000000 0.722222 0.000000 0.666667 0.055556 0.722222 0.000000 0.666667 0.055556 0.666667 + 0.111111 0.722222 0.055556 0.722222 0.055556 0.666667 0.111111 0.722222 0.055556 0.666667 0.111111 0.666667 + 0.166667 0.722222 0.111111 0.722222 0.111111 0.666667 0.166667 0.722222 0.111111 0.666667 0.166667 0.666667 + 0.222222 0.722222 0.166667 0.722222 0.166667 0.666667 0.222222 0.722222 0.166667 0.666667 0.222222 0.666667 + 0.277778 0.722222 0.222222 0.722222 0.222222 0.666667 0.277778 0.722222 0.222222 0.666667 0.277778 0.666667 + 0.333333 0.722222 0.277778 0.722222 0.277778 0.666667 0.333333 0.722222 0.277778 0.666667 0.333333 0.666667 + 0.388889 0.722222 0.333333 0.722222 0.333333 0.666667 0.388889 0.722222 0.333333 0.666667 0.388889 0.666667 + 0.444444 0.722222 0.388889 0.722222 0.388889 0.666667 0.444444 0.722222 0.388889 0.666667 0.444444 0.666667 + 0.500000 0.722222 0.444444 0.722222 0.444444 0.666667 0.500000 0.722222 0.444444 0.666667 0.500000 0.666667 + 0.555556 0.722222 0.500000 0.722222 0.500000 0.666667 0.555556 0.722222 0.500000 0.666667 0.555556 0.666667 + 0.611111 0.722222 0.555556 0.722222 0.555556 0.666667 0.611111 0.722222 0.555556 0.666667 0.611111 0.666667 + 0.666667 0.722222 0.611111 0.722222 0.611111 0.666667 0.666667 0.722222 0.611111 0.666667 0.666667 0.666667 + 0.722222 0.722222 0.666667 0.722222 0.666667 0.666667 0.722222 0.722222 0.666667 0.666667 0.722222 0.666667 + 0.777778 0.722222 0.722222 0.722222 0.722222 0.666667 0.777778 0.722222 0.722222 0.666667 0.777778 0.666667 + 0.833333 0.722222 0.777778 0.722222 0.777778 0.666667 0.833333 0.722222 0.777778 0.666667 0.833333 0.666667 + 0.888889 0.722222 0.833333 0.722222 0.833333 0.666667 0.888889 0.722222 0.833333 0.666667 0.888889 0.666667 + 0.944444 0.722222 0.888889 0.722222 0.888889 0.666667 0.944444 0.722222 0.888889 0.666667 0.944444 0.666667 + 1.000000 0.722222 0.944444 0.722222 0.944444 0.666667 1.000000 0.722222 0.944444 0.666667 1.000000 0.666667 +-0.944444 0.777778 -1.000000 0.777778 -1.000000 0.722222 -0.944444 0.777778 -1.000000 0.722222 -0.944444 0.722222 +-0.888889 0.777778 -0.944444 0.777778 -0.944444 0.722222 -0.888889 0.777778 -0.944444 0.722222 -0.888889 0.722222 +-0.833333 0.777778 -0.888889 0.777778 -0.888889 0.722222 -0.833333 0.777778 -0.888889 0.722222 -0.833333 0.722222 +-0.777778 0.777778 -0.833333 0.777778 -0.833333 0.722222 -0.777778 0.777778 -0.833333 0.722222 -0.777778 0.722222 +-0.722222 0.777778 -0.777778 0.777778 -0.777778 0.722222 -0.722222 0.777778 -0.777778 0.722222 -0.722222 0.722222 +-0.666667 0.777778 -0.722222 0.777778 -0.722222 0.722222 -0.666667 0.777778 -0.722222 0.722222 -0.666667 0.722222 +-0.611111 0.777778 -0.666667 0.777778 -0.666667 0.722222 -0.611111 0.777778 -0.666667 0.722222 -0.611111 0.722222 +-0.555556 0.777778 -0.611111 0.777778 -0.611111 0.722222 -0.555556 0.777778 -0.611111 0.722222 -0.555556 0.722222 +-0.500000 0.777778 -0.555556 0.777778 -0.555556 0.722222 -0.500000 0.777778 -0.555556 0.722222 -0.500000 0.722222 +-0.444444 0.777778 -0.500000 0.777778 -0.500000 0.722222 -0.444444 0.777778 -0.500000 0.722222 -0.444444 0.722222 +-0.388889 0.777778 -0.444444 0.777778 -0.444444 0.722222 -0.388889 0.777778 -0.444444 0.722222 -0.388889 0.722222 +-0.333333 0.777778 -0.388889 0.777778 -0.388889 0.722222 -0.333333 0.777778 -0.388889 0.722222 -0.333333 0.722222 +-0.277778 0.777778 -0.333333 0.777778 -0.333333 0.722222 -0.277778 0.777778 -0.333333 0.722222 -0.277778 0.722222 +-0.222222 0.777778 -0.277778 0.777778 -0.277778 0.722222 -0.222222 0.777778 -0.277778 0.722222 -0.222222 0.722222 +-0.166667 0.777778 -0.222222 0.777778 -0.222222 0.722222 -0.166667 0.777778 -0.222222 0.722222 -0.166667 0.722222 +-0.111111 0.777778 -0.166667 0.777778 -0.166667 0.722222 -0.111111 0.777778 -0.166667 0.722222 -0.111111 0.722222 +-0.055556 0.777778 -0.111111 0.777778 -0.111111 0.722222 -0.055556 0.777778 -0.111111 0.722222 -0.055556 0.722222 + 0.000000 0.777778 -0.055556 0.777778 -0.055556 0.722222 0.000000 0.777778 -0.055556 0.722222 0.000000 0.722222 + 0.055556 0.777778 0.000000 0.777778 0.000000 0.722222 0.055556 0.777778 0.000000 0.722222 0.055556 0.722222 + 0.111111 0.777778 0.055556 0.777778 0.055556 0.722222 0.111111 0.777778 0.055556 0.722222 0.111111 0.722222 + 0.166667 0.777778 0.111111 0.777778 0.111111 0.722222 0.166667 0.777778 0.111111 0.722222 0.166667 0.722222 + 0.222222 0.777778 0.166667 0.777778 0.166667 0.722222 0.222222 0.777778 0.166667 0.722222 0.222222 0.722222 + 0.277778 0.777778 0.222222 0.777778 0.222222 0.722222 0.277778 0.777778 0.222222 0.722222 0.277778 0.722222 + 0.333333 0.777778 0.277778 0.777778 0.277778 0.722222 0.333333 0.777778 0.277778 0.722222 0.333333 0.722222 + 0.388889 0.777778 0.333333 0.777778 0.333333 0.722222 0.388889 0.777778 0.333333 0.722222 0.388889 0.722222 + 0.444444 0.777778 0.388889 0.777778 0.388889 0.722222 0.444444 0.777778 0.388889 0.722222 0.444444 0.722222 + 0.500000 0.777778 0.444444 0.777778 0.444444 0.722222 0.500000 0.777778 0.444444 0.722222 0.500000 0.722222 + 0.555556 0.777778 0.500000 0.777778 0.500000 0.722222 0.555556 0.777778 0.500000 0.722222 0.555556 0.722222 + 0.611111 0.777778 0.555556 0.777778 0.555556 0.722222 0.611111 0.777778 0.555556 0.722222 0.611111 0.722222 + 0.666667 0.777778 0.611111 0.777778 0.611111 0.722222 0.666667 0.777778 0.611111 0.722222 0.666667 0.722222 + 0.722222 0.777778 0.666667 0.777778 0.666667 0.722222 0.722222 0.777778 0.666667 0.722222 0.722222 0.722222 + 0.777778 0.777778 0.722222 0.777778 0.722222 0.722222 0.777778 0.777778 0.722222 0.722222 0.777778 0.722222 + 0.833333 0.777778 0.777778 0.777778 0.777778 0.722222 0.833333 0.777778 0.777778 0.722222 0.833333 0.722222 + 0.888889 0.777778 0.833333 0.777778 0.833333 0.722222 0.888889 0.777778 0.833333 0.722222 0.888889 0.722222 + 0.944444 0.777778 0.888889 0.777778 0.888889 0.722222 0.944444 0.777778 0.888889 0.722222 0.944444 0.722222 + 1.000000 0.777778 0.944444 0.777778 0.944444 0.722222 1.000000 0.777778 0.944444 0.722222 1.000000 0.722222 +-0.944444 0.833333 -1.000000 0.833333 -1.000000 0.777778 -0.944444 0.833333 -1.000000 0.777778 -0.944444 0.777778 +-0.888889 0.833333 -0.944444 0.833333 -0.944444 0.777778 -0.888889 0.833333 -0.944444 0.777778 -0.888889 0.777778 +-0.833333 0.833333 -0.888889 0.833333 -0.888889 0.777778 -0.833333 0.833333 -0.888889 0.777778 -0.833333 0.777778 +-0.777778 0.833333 -0.833333 0.833333 -0.833333 0.777778 -0.777778 0.833333 -0.833333 0.777778 -0.777778 0.777778 +-0.722222 0.833333 -0.777778 0.833333 -0.777778 0.777778 -0.722222 0.833333 -0.777778 0.777778 -0.722222 0.777778 +-0.666667 0.833333 -0.722222 0.833333 -0.722222 0.777778 -0.666667 0.833333 -0.722222 0.777778 -0.666667 0.777778 +-0.611111 0.833333 -0.666667 0.833333 -0.666667 0.777778 -0.611111 0.833333 -0.666667 0.777778 -0.611111 0.777778 +-0.555556 0.833333 -0.611111 0.833333 -0.611111 0.777778 -0.555556 0.833333 -0.611111 0.777778 -0.555556 0.777778 +-0.500000 0.833333 -0.555556 0.833333 -0.555556 0.777778 -0.500000 0.833333 -0.555556 0.777778 -0.500000 0.777778 +-0.444444 0.833333 -0.500000 0.833333 -0.500000 0.777778 -0.444444 0.833333 -0.500000 0.777778 -0.444444 0.777778 +-0.388889 0.833333 -0.444444 0.833333 -0.444444 0.777778 -0.388889 0.833333 -0.444444 0.777778 -0.388889 0.777778 +-0.333333 0.833333 -0.388889 0.833333 -0.388889 0.777778 -0.333333 0.833333 -0.388889 0.777778 -0.333333 0.777778 +-0.277778 0.833333 -0.333333 0.833333 -0.333333 0.777778 -0.277778 0.833333 -0.333333 0.777778 -0.277778 0.777778 +-0.222222 0.833333 -0.277778 0.833333 -0.277778 0.777778 -0.222222 0.833333 -0.277778 0.777778 -0.222222 0.777778 +-0.166667 0.833333 -0.222222 0.833333 -0.222222 0.777778 -0.166667 0.833333 -0.222222 0.777778 -0.166667 0.777778 +-0.111111 0.833333 -0.166667 0.833333 -0.166667 0.777778 -0.111111 0.833333 -0.166667 0.777778 -0.111111 0.777778 +-0.055556 0.833333 -0.111111 0.833333 -0.111111 0.777778 -0.055556 0.833333 -0.111111 0.777778 -0.055556 0.777778 + 0.000000 0.833333 -0.055556 0.833333 -0.055556 0.777778 0.000000 0.833333 -0.055556 0.777778 0.000000 0.777778 + 0.055556 0.833333 0.000000 0.833333 0.000000 0.777778 0.055556 0.833333 0.000000 0.777778 0.055556 0.777778 + 0.111111 0.833333 0.055556 0.833333 0.055556 0.777778 0.111111 0.833333 0.055556 0.777778 0.111111 0.777778 + 0.166667 0.833333 0.111111 0.833333 0.111111 0.777778 0.166667 0.833333 0.111111 0.777778 0.166667 0.777778 + 0.222222 0.833333 0.166667 0.833333 0.166667 0.777778 0.222222 0.833333 0.166667 0.777778 0.222222 0.777778 + 0.277778 0.833333 0.222222 0.833333 0.222222 0.777778 0.277778 0.833333 0.222222 0.777778 0.277778 0.777778 + 0.333333 0.833333 0.277778 0.833333 0.277778 0.777778 0.333333 0.833333 0.277778 0.777778 0.333333 0.777778 + 0.388889 0.833333 0.333333 0.833333 0.333333 0.777778 0.388889 0.833333 0.333333 0.777778 0.388889 0.777778 + 0.444444 0.833333 0.388889 0.833333 0.388889 0.777778 0.444444 0.833333 0.388889 0.777778 0.444444 0.777778 + 0.500000 0.833333 0.444444 0.833333 0.444444 0.777778 0.500000 0.833333 0.444444 0.777778 0.500000 0.777778 + 0.555556 0.833333 0.500000 0.833333 0.500000 0.777778 0.555556 0.833333 0.500000 0.777778 0.555556 0.777778 + 0.611111 0.833333 0.555556 0.833333 0.555556 0.777778 0.611111 0.833333 0.555556 0.777778 0.611111 0.777778 + 0.666667 0.833333 0.611111 0.833333 0.611111 0.777778 0.666667 0.833333 0.611111 0.777778 0.666667 0.777778 + 0.722222 0.833333 0.666667 0.833333 0.666667 0.777778 0.722222 0.833333 0.666667 0.777778 0.722222 0.777778 + 0.777778 0.833333 0.722222 0.833333 0.722222 0.777778 0.777778 0.833333 0.722222 0.777778 0.777778 0.777778 + 0.833333 0.833333 0.777778 0.833333 0.777778 0.777778 0.833333 0.833333 0.777778 0.777778 0.833333 0.777778 + 0.888889 0.833333 0.833333 0.833333 0.833333 0.777778 0.888889 0.833333 0.833333 0.777778 0.888889 0.777778 + 0.944444 0.833333 0.888889 0.833333 0.888889 0.777778 0.944444 0.833333 0.888889 0.777778 0.944444 0.777778 + 1.000000 0.833333 0.944444 0.833333 0.944444 0.777778 1.000000 0.833333 0.944444 0.777778 1.000000 0.777778 +-0.944444 0.888889 -1.000000 0.888889 -1.000000 0.833333 -0.944444 0.888889 -1.000000 0.833333 -0.944444 0.833333 +-0.888889 0.888889 -0.944444 0.888889 -0.944444 0.833333 -0.888889 0.888889 -0.944444 0.833333 -0.888889 0.833333 +-0.833333 0.888889 -0.888889 0.888889 -0.888889 0.833333 -0.833333 0.888889 -0.888889 0.833333 -0.833333 0.833333 +-0.777778 0.888889 -0.833333 0.888889 -0.833333 0.833333 -0.777778 0.888889 -0.833333 0.833333 -0.777778 0.833333 +-0.722222 0.888889 -0.777778 0.888889 -0.777778 0.833333 -0.722222 0.888889 -0.777778 0.833333 -0.722222 0.833333 +-0.666667 0.888889 -0.722222 0.888889 -0.722222 0.833333 -0.666667 0.888889 -0.722222 0.833333 -0.666667 0.833333 +-0.611111 0.888889 -0.666667 0.888889 -0.666667 0.833333 -0.611111 0.888889 -0.666667 0.833333 -0.611111 0.833333 +-0.555556 0.888889 -0.611111 0.888889 -0.611111 0.833333 -0.555556 0.888889 -0.611111 0.833333 -0.555556 0.833333 +-0.500000 0.888889 -0.555556 0.888889 -0.555556 0.833333 -0.500000 0.888889 -0.555556 0.833333 -0.500000 0.833333 +-0.444444 0.888889 -0.500000 0.888889 -0.500000 0.833333 -0.444444 0.888889 -0.500000 0.833333 -0.444444 0.833333 +-0.388889 0.888889 -0.444444 0.888889 -0.444444 0.833333 -0.388889 0.888889 -0.444444 0.833333 -0.388889 0.833333 +-0.333333 0.888889 -0.388889 0.888889 -0.388889 0.833333 -0.333333 0.888889 -0.388889 0.833333 -0.333333 0.833333 +-0.277778 0.888889 -0.333333 0.888889 -0.333333 0.833333 -0.277778 0.888889 -0.333333 0.833333 -0.277778 0.833333 +-0.222222 0.888889 -0.277778 0.888889 -0.277778 0.833333 -0.222222 0.888889 -0.277778 0.833333 -0.222222 0.833333 +-0.166667 0.888889 -0.222222 0.888889 -0.222222 0.833333 -0.166667 0.888889 -0.222222 0.833333 -0.166667 0.833333 +-0.111111 0.888889 -0.166667 0.888889 -0.166667 0.833333 -0.111111 0.888889 -0.166667 0.833333 -0.111111 0.833333 +-0.055556 0.888889 -0.111111 0.888889 -0.111111 0.833333 -0.055556 0.888889 -0.111111 0.833333 -0.055556 0.833333 + 0.000000 0.888889 -0.055556 0.888889 -0.055556 0.833333 0.000000 0.888889 -0.055556 0.833333 0.000000 0.833333 + 0.055556 0.888889 0.000000 0.888889 0.000000 0.833333 0.055556 0.888889 0.000000 0.833333 0.055556 0.833333 + 0.111111 0.888889 0.055556 0.888889 0.055556 0.833333 0.111111 0.888889 0.055556 0.833333 0.111111 0.833333 + 0.166667 0.888889 0.111111 0.888889 0.111111 0.833333 0.166667 0.888889 0.111111 0.833333 0.166667 0.833333 + 0.222222 0.888889 0.166667 0.888889 0.166667 0.833333 0.222222 0.888889 0.166667 0.833333 0.222222 0.833333 + 0.277778 0.888889 0.222222 0.888889 0.222222 0.833333 0.277778 0.888889 0.222222 0.833333 0.277778 0.833333 + 0.333333 0.888889 0.277778 0.888889 0.277778 0.833333 0.333333 0.888889 0.277778 0.833333 0.333333 0.833333 + 0.388889 0.888889 0.333333 0.888889 0.333333 0.833333 0.388889 0.888889 0.333333 0.833333 0.388889 0.833333 + 0.444444 0.888889 0.388889 0.888889 0.388889 0.833333 0.444444 0.888889 0.388889 0.833333 0.444444 0.833333 + 0.500000 0.888889 0.444444 0.888889 0.444444 0.833333 0.500000 0.888889 0.444444 0.833333 0.500000 0.833333 + 0.555556 0.888889 0.500000 0.888889 0.500000 0.833333 0.555556 0.888889 0.500000 0.833333 0.555556 0.833333 + 0.611111 0.888889 0.555556 0.888889 0.555556 0.833333 0.611111 0.888889 0.555556 0.833333 0.611111 0.833333 + 0.666667 0.888889 0.611111 0.888889 0.611111 0.833333 0.666667 0.888889 0.611111 0.833333 0.666667 0.833333 + 0.722222 0.888889 0.666667 0.888889 0.666667 0.833333 0.722222 0.888889 0.666667 0.833333 0.722222 0.833333 + 0.777778 0.888889 0.722222 0.888889 0.722222 0.833333 0.777778 0.888889 0.722222 0.833333 0.777778 0.833333 + 0.833333 0.888889 0.777778 0.888889 0.777778 0.833333 0.833333 0.888889 0.777778 0.833333 0.833333 0.833333 + 0.888889 0.888889 0.833333 0.888889 0.833333 0.833333 0.888889 0.888889 0.833333 0.833333 0.888889 0.833333 + 0.944444 0.888889 0.888889 0.888889 0.888889 0.833333 0.944444 0.888889 0.888889 0.833333 0.944444 0.833333 + 1.000000 0.888889 0.944444 0.888889 0.944444 0.833333 1.000000 0.888889 0.944444 0.833333 1.000000 0.833333 +-0.944444 0.944444 -1.000000 0.944444 -1.000000 0.888889 -0.944444 0.944444 -1.000000 0.888889 -0.944444 0.888889 +-0.888889 0.944444 -0.944444 0.944444 -0.944444 0.888889 -0.888889 0.944444 -0.944444 0.888889 -0.888889 0.888889 +-0.833333 0.944444 -0.888889 0.944444 -0.888889 0.888889 -0.833333 0.944444 -0.888889 0.888889 -0.833333 0.888889 +-0.777778 0.944444 -0.833333 0.944444 -0.833333 0.888889 -0.777778 0.944444 -0.833333 0.888889 -0.777778 0.888889 +-0.722222 0.944444 -0.777778 0.944444 -0.777778 0.888889 -0.722222 0.944444 -0.777778 0.888889 -0.722222 0.888889 +-0.666667 0.944444 -0.722222 0.944444 -0.722222 0.888889 -0.666667 0.944444 -0.722222 0.888889 -0.666667 0.888889 +-0.611111 0.944444 -0.666667 0.944444 -0.666667 0.888889 -0.611111 0.944444 -0.666667 0.888889 -0.611111 0.888889 +-0.555556 0.944444 -0.611111 0.944444 -0.611111 0.888889 -0.555556 0.944444 -0.611111 0.888889 -0.555556 0.888889 +-0.500000 0.944444 -0.555556 0.944444 -0.555556 0.888889 -0.500000 0.944444 -0.555556 0.888889 -0.500000 0.888889 +-0.444444 0.944444 -0.500000 0.944444 -0.500000 0.888889 -0.444444 0.944444 -0.500000 0.888889 -0.444444 0.888889 +-0.388889 0.944444 -0.444444 0.944444 -0.444444 0.888889 -0.388889 0.944444 -0.444444 0.888889 -0.388889 0.888889 +-0.333333 0.944444 -0.388889 0.944444 -0.388889 0.888889 -0.333333 0.944444 -0.388889 0.888889 -0.333333 0.888889 +-0.277778 0.944444 -0.333333 0.944444 -0.333333 0.888889 -0.277778 0.944444 -0.333333 0.888889 -0.277778 0.888889 +-0.222222 0.944444 -0.277778 0.944444 -0.277778 0.888889 -0.222222 0.944444 -0.277778 0.888889 -0.222222 0.888889 +-0.166667 0.944444 -0.222222 0.944444 -0.222222 0.888889 -0.166667 0.944444 -0.222222 0.888889 -0.166667 0.888889 +-0.111111 0.944444 -0.166667 0.944444 -0.166667 0.888889 -0.111111 0.944444 -0.166667 0.888889 -0.111111 0.888889 +-0.055556 0.944444 -0.111111 0.944444 -0.111111 0.888889 -0.055556 0.944444 -0.111111 0.888889 -0.055556 0.888889 + 0.000000 0.944444 -0.055556 0.944444 -0.055556 0.888889 0.000000 0.944444 -0.055556 0.888889 0.000000 0.888889 + 0.055556 0.944444 0.000000 0.944444 0.000000 0.888889 0.055556 0.944444 0.000000 0.888889 0.055556 0.888889 + 0.111111 0.944444 0.055556 0.944444 0.055556 0.888889 0.111111 0.944444 0.055556 0.888889 0.111111 0.888889 + 0.166667 0.944444 0.111111 0.944444 0.111111 0.888889 0.166667 0.944444 0.111111 0.888889 0.166667 0.888889 + 0.222222 0.944444 0.166667 0.944444 0.166667 0.888889 0.222222 0.944444 0.166667 0.888889 0.222222 0.888889 + 0.277778 0.944444 0.222222 0.944444 0.222222 0.888889 0.277778 0.944444 0.222222 0.888889 0.277778 0.888889 + 0.333333 0.944444 0.277778 0.944444 0.277778 0.888889 0.333333 0.944444 0.277778 0.888889 0.333333 0.888889 + 0.388889 0.944444 0.333333 0.944444 0.333333 0.888889 0.388889 0.944444 0.333333 0.888889 0.388889 0.888889 + 0.444444 0.944444 0.388889 0.944444 0.388889 0.888889 0.444444 0.944444 0.388889 0.888889 0.444444 0.888889 + 0.500000 0.944444 0.444444 0.944444 0.444444 0.888889 0.500000 0.944444 0.444444 0.888889 0.500000 0.888889 + 0.555556 0.944444 0.500000 0.944444 0.500000 0.888889 0.555556 0.944444 0.500000 0.888889 0.555556 0.888889 + 0.611111 0.944444 0.555556 0.944444 0.555556 0.888889 0.611111 0.944444 0.555556 0.888889 0.611111 0.888889 + 0.666667 0.944444 0.611111 0.944444 0.611111 0.888889 0.666667 0.944444 0.611111 0.888889 0.666667 0.888889 + 0.722222 0.944444 0.666667 0.944444 0.666667 0.888889 0.722222 0.944444 0.666667 0.888889 0.722222 0.888889 + 0.777778 0.944444 0.722222 0.944444 0.722222 0.888889 0.777778 0.944444 0.722222 0.888889 0.777778 0.888889 + 0.833333 0.944444 0.777778 0.944444 0.777778 0.888889 0.833333 0.944444 0.777778 0.888889 0.833333 0.888889 + 0.888889 0.944444 0.833333 0.944444 0.833333 0.888889 0.888889 0.944444 0.833333 0.888889 0.888889 0.888889 + 0.944444 0.944444 0.888889 0.944444 0.888889 0.888889 0.944444 0.944444 0.888889 0.888889 0.944444 0.888889 + 1.000000 0.944444 0.944444 0.944444 0.944444 0.888889 1.000000 0.944444 0.944444 0.888889 1.000000 0.888889 +-0.944444 1.000000 -1.000000 1.000000 -1.000000 0.944444 -0.944444 1.000000 -1.000000 0.944444 -0.944444 0.944444 +-0.888889 1.000000 -0.944444 1.000000 -0.944444 0.944444 -0.888889 1.000000 -0.944444 0.944444 -0.888889 0.944444 +-0.833333 1.000000 -0.888889 1.000000 -0.888889 0.944444 -0.833333 1.000000 -0.888889 0.944444 -0.833333 0.944444 +-0.777778 1.000000 -0.833333 1.000000 -0.833333 0.944444 -0.777778 1.000000 -0.833333 0.944444 -0.777778 0.944444 +-0.722222 1.000000 -0.777778 1.000000 -0.777778 0.944444 -0.722222 1.000000 -0.777778 0.944444 -0.722222 0.944444 +-0.666667 1.000000 -0.722222 1.000000 -0.722222 0.944444 -0.666667 1.000000 -0.722222 0.944444 -0.666667 0.944444 +-0.611111 1.000000 -0.666667 1.000000 -0.666667 0.944444 -0.611111 1.000000 -0.666667 0.944444 -0.611111 0.944444 +-0.555556 1.000000 -0.611111 1.000000 -0.611111 0.944444 -0.555556 1.000000 -0.611111 0.944444 -0.555556 0.944444 +-0.500000 1.000000 -0.555556 1.000000 -0.555556 0.944444 -0.500000 1.000000 -0.555556 0.944444 -0.500000 0.944444 +-0.444444 1.000000 -0.500000 1.000000 -0.500000 0.944444 -0.444444 1.000000 -0.500000 0.944444 -0.444444 0.944444 +-0.388889 1.000000 -0.444444 1.000000 -0.444444 0.944444 -0.388889 1.000000 -0.444444 0.944444 -0.388889 0.944444 +-0.333333 1.000000 -0.388889 1.000000 -0.388889 0.944444 -0.333333 1.000000 -0.388889 0.944444 -0.333333 0.944444 +-0.277778 1.000000 -0.333333 1.000000 -0.333333 0.944444 -0.277778 1.000000 -0.333333 0.944444 -0.277778 0.944444 +-0.222222 1.000000 -0.277778 1.000000 -0.277778 0.944444 -0.222222 1.000000 -0.277778 0.944444 -0.222222 0.944444 +-0.166667 1.000000 -0.222222 1.000000 -0.222222 0.944444 -0.166667 1.000000 -0.222222 0.944444 -0.166667 0.944444 +-0.111111 1.000000 -0.166667 1.000000 -0.166667 0.944444 -0.111111 1.000000 -0.166667 0.944444 -0.111111 0.944444 +-0.055556 1.000000 -0.111111 1.000000 -0.111111 0.944444 -0.055556 1.000000 -0.111111 0.944444 -0.055556 0.944444 + 0.000000 1.000000 -0.055556 1.000000 -0.055556 0.944444 0.000000 1.000000 -0.055556 0.944444 0.000000 0.944444 + 0.055556 1.000000 0.000000 1.000000 0.000000 0.944444 0.055556 1.000000 0.000000 0.944444 0.055556 0.944444 + 0.111111 1.000000 0.055556 1.000000 0.055556 0.944444 0.111111 1.000000 0.055556 0.944444 0.111111 0.944444 + 0.166667 1.000000 0.111111 1.000000 0.111111 0.944444 0.166667 1.000000 0.111111 0.944444 0.166667 0.944444 + 0.222222 1.000000 0.166667 1.000000 0.166667 0.944444 0.222222 1.000000 0.166667 0.944444 0.222222 0.944444 + 0.277778 1.000000 0.222222 1.000000 0.222222 0.944444 0.277778 1.000000 0.222222 0.944444 0.277778 0.944444 + 0.333333 1.000000 0.277778 1.000000 0.277778 0.944444 0.333333 1.000000 0.277778 0.944444 0.333333 0.944444 + 0.388889 1.000000 0.333333 1.000000 0.333333 0.944444 0.388889 1.000000 0.333333 0.944444 0.388889 0.944444 + 0.444444 1.000000 0.388889 1.000000 0.388889 0.944444 0.444444 1.000000 0.388889 0.944444 0.444444 0.944444 + 0.500000 1.000000 0.444444 1.000000 0.444444 0.944444 0.500000 1.000000 0.444444 0.944444 0.500000 0.944444 + 0.555556 1.000000 0.500000 1.000000 0.500000 0.944444 0.555556 1.000000 0.500000 0.944444 0.555556 0.944444 + 0.611111 1.000000 0.555556 1.000000 0.555556 0.944444 0.611111 1.000000 0.555556 0.944444 0.611111 0.944444 + 0.666667 1.000000 0.611111 1.000000 0.611111 0.944444 0.666667 1.000000 0.611111 0.944444 0.666667 0.944444 + 0.722222 1.000000 0.666667 1.000000 0.666667 0.944444 0.722222 1.000000 0.666667 0.944444 0.722222 0.944444 + 0.777778 1.000000 0.722222 1.000000 0.722222 0.944444 0.777778 1.000000 0.722222 0.944444 0.777778 0.944444 + 0.833333 1.000000 0.777778 1.000000 0.777778 0.944444 0.833333 1.000000 0.777778 0.944444 0.833333 0.944444 + 0.888889 1.000000 0.833333 1.000000 0.833333 0.944444 0.888889 1.000000 0.833333 0.944444 0.888889 0.944444 + 0.944444 1.000000 0.888889 1.000000 0.888889 0.944444 0.944444 1.000000 0.888889 0.944444 0.944444 0.944444 + 1.000000 1.000000 0.944444 1.000000 0.944444 0.944444 1.000000 1.000000 0.944444 0.944444 1.000000 0.944444 diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/input.txt b/vulkan/amber/spirv_assembly/instruction/float32/comparison/input.txt new file mode 100644 index 0000000..4777a11 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/input.txt @@ -0,0 +1,444 @@ +# Zero +0x00000000 0x80000000 +# One +0x3F800000 0xBF800000 +# Infinity +0x7F800000 0xFF800000 +# Largest number less than one +0x3F7FFFFF 0xBF7FFFFF +# Smallest number greater than one +0x3F800001 0xBF800001 +# Pi +0x40490FDB 0xC0490FDB +# Random values +0x07AFC3A1 0x64E79E95 0x19FE2471 0x2C9DB77E 0x2E493787 0x113BD6FB 0x301FB86B 0x213173BE 0x05AC27AA 0x709578E1 0x50AFD1F0 0x3046495C +0x28ECDDD1 0x69F73F5B 0x3669D464 0x3E49F1A5 0x65357EE5 0x7A464B87 0x5B5C6066 0x2D0F9171 0x6BC4B2BE 0x2E6278B5 0x3106D28B 0x0A0BD697 +0x1647B840 0x70B42FAE 0x1BFD1DFC 0x7BFF652C 0x6575BA6F 0x0072CC2C 0x16B7C1ED 0x6D257E10 0x655A6AC1 0x30B5E65E 0x19C3358F 0x13A3A249 +0x41F1BD59 0x49E2EDFA 0x34D51607 0x479DE504 0x3A7866DC 0x0584E7F7 0x77E42E60 0x636544AD 0x6F7C2753 0x2E4E02C4 0x21AF3652 0x54B1A638 +0x28944E4B 0x7D0B96B8 0x01C137A9 0x14590109 0x2B6E0F6E 0x32C80A35 0x1E64D7A1 0x41B5C7AE 0x237C39E3 0x3A61F59D 0x3DB52CDA 0x08F1F453 +0x3AD4C1C9 0x546CEEC7 0x76177263 0x202F2C8B 0x0522D525 0x0FDAA7F2 0x33D2CED4 0x4714927F 0x59BD95ED 0x68A7E4DB 0x0EB27783 0x1435FCC9 +0x6E2CCCD3 0x0696A5E3 0x779B4176 0x5DA8F426 0x34E4A8A7 0x194A77C8 0x325A9A5E 0x5D78F6F2 0x16560E80 0x341BD207 0x71D1F7FC 0x41C41DEE +0x66E3DC3C 0x1036CF9D 0x0379E59C 0x0A601620 0x4A98C53A 0x412F1276 0x13520A73 0x056D8704 0x159C013D 0x09697CD6 0x259CB38F 0x1ABED663 +0x194424C9 0x596F8263 0x61D368E2 0x7301BAB6 0x4217673E 0x7085E065 0x0737B77F 0x30443411 0x771C8648 0x7ED2F8F5 0x0DED2837 0x2C012EEF +0x181D70BD 0x4047C295 0x097A25E1 0x2E737F3D 0x7463949D 0x7B4C1DDD 0x70379D2C 0x5B4770D9 0x0B82ED7A 0x73B182C8 0x65A786F9 0x561BB2B5 +0x34E0953F 0x78F9916C 0x5B8939B9 0x4A7C967C 0x02630E43 0x0125ED48 0x653B6CDF 0x1BA7330C 0x5A956FAB 0x470ED5C1 0x0EA8EDC2 0x1CACD6E9 +0x3794B626 0x15E0A541 0x4CF10AFB 0x2EB13C6E 0x14B39E36 0x5ADE3332 0x5AB26B5D 0x2CD10EF3 0x1B25F5C8 0x642C913F 0x5B448E30 0x0F898A65 +0x5F78AF1C 0x4B7C2B5C 0x6AD0FB3E 0x6AFB9C97 0x3F2DAE25 0x50788238 0x41174F4C 0x740E4364 0x497213A4 0x1CA08905 0x3E8AD9E0 0x4BD521E7 +0x1DC6764D 0x23C646C0 0x677C54F3 0x785BE5F8 0x6AD51C81 0x762542B5 0x1508BCE1 0x2269D2A8 0x0C05E7F6 0x61F9C7DC 0x511B0F16 0x20B9862C +0x3CD7FB0F 0x2BCD7A74 0x4D8A951F 0x57FDF0D7 0x0FFA0BB3 0x28CF2350 0x67877B3C 0x6F72BACF 0x744B4EAC 0x5258767A 0x5A6E5766 0x3378FCD1 +0x22D0F8B2 0x1B85A6B2 0x27874035 0x6C430C57 0x38262FB7 0x66121A16 0x38182E3E 0x55ECA604 0x09D860D6 0x1F948332 0x4E488BFC 0x74AD7D57 +0x15B9C5E7 0x635148DE 0x17174FFF 0x21BFADDE 0x454B10BA 0x68325F16 0x4279340A 0x02230BC9 0x13FFD98A 0x1003C92A 0x5A20FCA0 0x23F9E53D +0x38D2EC7A 0x41A877DC 0x136CA00C 0x2D1E3B26 0x1400EE57 0x6DDAF773 0x609737F8 0x36D1E709 0x09609E25 0x081E782D 0x2314F360 0x4186CDDD +0x6E309243 0x5B2D219F 0x177373E1 0x7808F319 0x7AC1A4D1 0x65BBFFDE 0x6CB67071 0x107B6AB8 0x490D48BC 0x03CDC070 0x323B1896 0x0E585976 +0x6C001F86 0x74B44CA1 0x107B6540 0x7FFFF910 0x04B815CB 0x6A9C61E0 0x23F9DE4D 0x3D8B0245 0x2C44D9BD 0x37667E5A 0x6AA93D6B 0x4045C814 +0x254175CD 0x4B407563 0x7717AF1D 0x2EA213F2 0x535EED91 0x1A2CA27E 0x7028E1CF 0x418F7FD4 0x7559C41D 0x079C55B1 0x399872EE 0x701B68EE +0x6D58558F 0x264EE35F 0x0096D3A6 0x36659E4B 0x2A1CA3CF 0x32D1EC3D 0x44BDF7C1 0x161CC356 0x278638DE 0x55395D01 0x161CBC66 0x2C3E4EA9 +0x3FD5BEE2 0x3A169AB4 0x69C950EE 0x6C1A989F 0x717D190E 0x54728E59 0x2C6060B3 0x16BE8EDB 0x1FB303BD 0x23780FD0 0x4560A2CD 0x7311F14E +0x3DA4B24E 0x3589849D 0x34A17122 0x32FE766B 0x3D25DA4E 0x6E39E410 0x2319DF59 0x2A7E2FDD 0x1488C76F 0x23B0B300 0x60E3CE28 0x3EA56B3F +0x56829F3D 0x25A1C5E9 0x54C22E95 0x7E08D81B 0x7ADB22EB 0x6ADEEAFB 0x2A4726C4 0x3AB0E1CD 0x24F585AF 0x141077B2 0x26CB7A6C 0x16729EBD +0x6883060B 0x532BDB1F 0x2D312D98 0x083609C8 0x76A3EAEF 0x7291D066 0x7B47FB16 0x34489D3E 0x281B5503 0x2FE96C39 0x674713A9 0x65412F51 +0x1E235049 0x0A60F303 0x0FBF5F2E 0x32AC17B9 0x2E11A603 0x70A32D56 0x715182F8 0x04944540 0x1644F33F 0x4613B18D 0x029D1D5B 0x1120162A +0x30F29C88 0x2CE4441F 0x4BD0F7F7 0x55E82238 0x40F4BBD1 0x729C7263 0x6C5AC0F5 0x2977C1DC 0x45C84D82 0x198BEE8E 0x31ADCBA5 0x3C6C3872 +0x0C1DBEF4 0x2CF5C6BB 0x70B4D5B0 0x343913F7 0x5CDF32F4 0x57FBE959 0x197A4348 0x7B02833E 0x625CDC5C 0x2939A276 0x2DAE9AF7 0x106E825F +0x19DCCFCC 0x1F001DEF 0x1502C79F 0x3021C30B 0x6513CF7C 0x179FE4FA 0x4141D936 0x16066C04 0x44842919 0x0D12D12D 0x6BEE8E3C 0x0578E4EA +0x7FAF4391 0x58494F32 0x2EF0A6C7 0x45779113 0x71D53DC0 0x609E726C 0x01E3C985 0x7DF2FCB4 0x0D943927 0x72989F35 0x322C10AB 0x6A736C1C +0x4A94888F 0x4BA653F3 0x6575EF5A 0x2CF164EB 0x74DFF669 0x13248A51 0x3D5FE74B 0x0EBCC635 0x3224A840 0x5262AEEA 0x3EDE8940 0x173877BC +0x6A0293E5 0x00206276 0x2D3EE3C0 0x2E86BCFE 0x0D3333A4 0x192D71FD 0x33FFA1E9 0x0CE27735 0x7176C12F 0x62F048B0 0x525A0848 0x634BFEEF +0x438EBB1C 0x543DD1CE 0x613EFBA3 0x5122F443 0x46D67103 0x136B0C4E 0x3B96605F 0x116AF992 0x5F116041 0x210C4FB9 0x3E5C5E7E 0x53F156AA +0x3430DA0A 0x7BBC45C9 0x62AE1CDF 0x6655824A 0x4E1EF4B3 0x218CA61F 0x7D8DFA06 0x38218898 0x21AD0896 0x2ACCDDC7 0x66A84597 0x2EE03C3A +0x43FA4FC4 0x1AA7E780 0x3BC2B36F 0x357110F3 0x7D983030 0x0E1CBBB7 0x18BD0FE2 0x4126EB4C 0x625A8D85 0x79FC0B85 0x1249DF8F 0x2930FE89 +0x0D6717D3 0x4DE03FEF 0x3A9BF81B 0x6C787814 0x6EEC8FA8 0x78F85699 0x4069CEBE 0x231D69B3 0x74B49C62 0x2317EB9D 0x0972EBFD 0x42D39116 +0x44A491BC 0x0700E604 0x7AF519AE 0x66519A52 0x31CDC3CB 0x619D5F45 0x1531D68C 0x75C8138F 0x7C4546C5 0x50F489FB 0x2B392482 0x79DD76F5 +0x5F1145B3 0x43F63464 0x3B046241 0x416BD338 0x3DF23FE9 0x4D4E41D1 0x6A9CD1C1 0x4B5957BC 0x1B2E81C0 0x2538C9DD 0x37D1CFD0 0x0A1B1168 +0x1E312076 0x783B9E8E 0x2D387B1B 0x12E5BCD9 0x1B538A2B 0x36AB6719 0x55B94DEF 0x5FF81BE7 0x3DAC4D1D 0x50AE679D 0x4649B63A 0x6F7A10E8 +0x324BC6E3 0x5B7B8CC6 0x65422477 0x2E910DA8 0x2C7016C2 0x107B48F9 0x286E849E 0x0B815C75 0x54717D5D 0x6372E6DF 0x4CED2FAD 0x1263BD46 +0x30C128B0 0x378A016F 0x5DBD1502 0x4BEFAA70 0x5CC2CB4C 0x158EE4D2 0x560ABBD9 0x7AF3EBC2 0x0DCA8360 0x034336F4 0x0DD9A89B 0x291E0D8B +0x39EE9E0D 0x6392F68A 0x09162972 0x779AEB2A 0x34415E28 0x4F5FDFAC 0x6714FC12 0x668D250B 0x2ADB6C73 0x4C572089 0x151E32B3 0x574B8335 +0x5CD26982 0x3D8CB751 0x62CCDFAA 0x3143E6DF 0x20FF9E31 0x2FBA0F57 0x43A7A425 0x51C0C6E1 0x674410C6 0x2164B927 0x1DB07152 0x4406DC12 +0x36F39DF9 0x73BB2D2B 0x3EFAC7D5 0x44BE2159 0x76FE641F 0x4CD47070 0x6DDC2EE4 0x30ED022D 0x306766FB 0x76F25857 0x2887ED57 0x64A8C523 +0x46523803 0x0F9CE96A 0x4B35EA2E 0x712DA476 0x5BF409F3 0x60541CE1 0x487927AB 0x38C67376 0x1DE0D433 0x2B460755 0x6A0A5A55 0x3EE07264 +0x5B0016AD 0x2DB1FE7B 0x10A13945 0x42442773 0x4F16B7A2 0x2E51AA97 0x064B0386 0x060A559C 0x220CD7C2 0x4545CB5B 0x4AC876F5 0x190B3BE2 +0x121A3BCB 0x38A4A5DA 0x49F83E0F 0x4281A2C6 0x2F96FE31 0x72802B66 0x272A67E9 0x75E93634 0x021D14D0 0x72605217 0x6716DAAB 0x5E111EC4 +0x52B46EF9 0x2F900256 0x16D7923A 0x7095432C 0x5AD609AC 0x00E1EC8F 0x2F75B590 0x35D62059 0x2E93EB0A 0x4016EED5 0x781A47CC 0x7DAAA2AD +0x6E68996D 0x7E654B52 0x03B4F849 0x1075712F 0x43AB16AD 0x4E7D6F3E 0x2980AD11 0x55C55279 0x07221518 0x7378EB20 0x1846F53F 0x36B91349 +0x65F91687 0x3F715D29 0x2CA2497E 0x68162B57 0x31D1AF40 0x13B92429 0x46274A1B 0x04861E39 0x4349267F 0x5CFEDC55 0x751B6165 0x1E1F302B +0x5DE0C8E5 0x249116F5 0x53F55084 0x0C74B3EF 0x64A805CB 0x4C0F9851 0x0A1F569C 0x53109F38 0x4A74E3A3 0x0DD44EE5 0x63861067 0x0E1FFA51 +0x5C51BE24 0x0D06BD79 0x63E54CCA 0x6373D33C 0x007FA899 0x7C2C4209 0x1A2CE686 0x6678BF20 0x3B9D9F32 0x46CF3004 0x4E8EEA78 0x6D6F4E73 +0x5A88542D 0x14B63493 0x71F56CAC 0x1DD17AAC 0x71B510E9 0x6710CE12 0x3BF0AAD8 0x4F95D9CE 0x0BA1E507 0x0FE5FB5C 0x5C0A8DBD 0x7049EAD2 +0x5BF593AD 0x6629E45A 0x435A8A0A 0x266A7751 0x73FE333F 0x26E09A72 0x348A71A2 0x504FF163 0x33E757EB 0x186FBE6C 0x33C3C4A0 0x34670084 +0x149C0075 0x4DF0AB26 0x1ADFBFA5 0x50399FA8 0x14BFDB2A 0x696EAA1D 0x3DA8EE1B 0x6F482F57 0x7E24DEB0 0x2F9E5AC7 0x0D19AA03 0x6FD9EF99 +0x16AF28D9 0x490A54DB 0x3F6FC967 0x22510DE1 0x58F05038 0x1B7A5725 0x129AF8B3 0x34E5E3E5 0x01A43B7F 0x55F582BE 0x5B505B36 0x75A26EBE +0x7CD61D30 0x0FDACCD8 0x45F26022 0x30BD751B 0x284A8B44 0x79B624C2 0x6524759F 0x3CE68BBA 0x47A6CFE8 0x00043544 0x0D202B62 0x5C66AB12 +0x6972DF61 0x4AC9197D 0x4BAEDA69 0x6797BE12 0x7A677444 0x58C8846C 0x5771ADAB 0x11169D1E 0x21D2D948 0x16E17713 0x3367AAFF 0x7AC32980 +0x325BCE38 0x4602A3B2 0x2FA90D65 0x340009B7 0x1BF82670 0x0AF9689C 0x29A27875 0x18CE43A0 0x1AD43574 0x6F94D897 0x498BB8BB 0x431EC0B9 +0x694AFD59 0x2EB02E5B 0x00054C73 0x30F1CD41 0x2EB4639F 0x0D2577D5 0x0D587853 0x18274301 0x57EE9152 0x590752BC 0x7FBF0113 0x52560596 +0x31CFD729 0x5730AEBE 0x636CA2B4 0x53A2B071 0x6E1225D1 0x16D44DB3 0x4E65D9F1 0x206DF409 0x5CD6F166 0x7E0EE756 0x546DFDC0 0x78CF17D6 +0x09084FF2 0x7E107636 0x119D5B77 0x23DC8567 0x6DA54ECD 0x5B291432 0x66FB4620 0x56F04C27 0x09D9428D 0x67009293 0x07E21968 0x388DA62D +0x74260A68 0x153A91BC 0x50B4E92E 0x4C149BBA 0x6E41E478 0x5073EA41 0x1E6AA150 0x2011BBA1 0x27A498FF 0x01D74405 0x73B46C12 0x15B6BED1 +0x18AB91B8 0x421A4603 0x3624B2DA 0x7582831E 0x40292D5A 0x0A92B09B 0x6E519AF5 0x49317D4C 0x08A326D1 0x7FEEF66C 0x6D0E02B3 0x7648759E +0x5B180A9E 0x540948D3 0x4D38C1C5 0x64F14D2C 0x3B09DB66 0x551ADB2E 0x1D7EF359 0x2F2FE5CE 0x6A556CEA 0x6E33DC87 0x7B448188 0x58975162 +0x3EA7C6C8 0x19AF22D9 0x78A90D04 0x664C5FC7 0x1B8666DE 0x6C5D7916 0x7C031E98 0x3431F896 0x2E77BF1A 0x3227D173 0x29B47BB5 0x6EA0EC74 +0x3CBA820E 0x180616AA 0x37D269C0 0x455DA8DF 0x17F50D16 0x24E06C74 0x3BA61E7D 0x730D17B4 0x78E9B547 0x08DEE043 0x57FE64E0 0x33F390AE +0x5DF9BB71 0x757D5839 0x6323767C 0x484F285B 0x63B134C0 0x5E67F805 0x20E679BD 0x2258FB88 0x78171ADE 0x198F86C1 0x08A55B50 0x139D81BC +0x05ECFFD8 0x04A879E8 0x47CF7A52 0x3464BEF2 0x36D04B5B 0x7183F607 0x2305AB66 0x738ACD69 0x098A0CB1 0x5AD81526 0x38E87648 0x217F19C7 +0x7FB8819A 0x748E94C6 0x148C317C 0x78A236E2 0x7D6D7509 0x6C8A965C 0x2C95C790 0x5B67307A 0x6207EE96 0x0FB93E0C 0x23B658D5 0x45B92356 +0x6E213611 0x449CD292 0x68121EDF 0x663850EF 0x5E2C5954 0x70B77A2F 0x79D5D2AB 0x6419592C 0x755FF417 0x41A54CFE 0x187E181E 0x2C303F73 +0x33294305 0x3B83C384 0x1FBB0CDC 0x3CB34FB7 0x165BD8AA 0x58A38325 0x5E32697E 0x16145A45 0x4D3217EB 0x72BE9AFA 0x0EB69127 0x4A9F8CF4 +0x5F493157 0x3B4C58B7 0x2606BD6E 0x41511FED 0x4B0596C3 0x49BD1643 0x070A4343 0x3926CCD5 0x0E59E8D5 0x6F1C6222 0x1F5F1DC4 0x6C864229 +0x5FD3DC51 0x1934F070 0x509F9B55 0x5533D069 0x5ADA3D6E 0x691DB373 0x01640FDC 0x0E038073 0x24A176F7 0x211F1CB8 0x4AB6D02A 0x3AFD4FA2 +0x79C29FDD 0x28E939A9 0x5111A9E7 0x46F4B7C8 0x1BA7D4A3 0x5FC83B0E 0x119444BC 0x7AF105FA 0x1B1493C5 0x379B022A 0x3C4225E7 0x661A2A88 +0x0158186D 0x434C692B 0x1F40F75D 0x0FB20143 0x3268CB4D 0x3EA01522 0x7C38436C 0x123CA79F 0x57D50592 0x4CD7DEC2 0x67707808 0x32AF4300 +0x35F59235 0x68D487E4 0x40B2C373 0x5A97092D 0x09F3A49C 0x0B69939E 0x159458CF 0x03B6447A 0x3452CD47 0x66A602B6 0x4AAAFC42 0x4FFAA1EA +0x466E3DC4 0x5C3F40FF 0x4AEBA7E5 0x6182D189 0x13DA4329 0x072DCDCC 0x479CFC11 0x15325B97 0x4A7A36F7 0x66DDF36F 0x24E45CDA 0x7CE30245 +0x257E0891 0x211CA046 0x0F1FA9E4 0x7D530E23 0x6DF47F08 0x769021EC 0x30025123 0x23EA113E 0x5F64A9D0 0x70B51496 0x7E811A6B 0x69584E6C +0x7C1EA834 0x1415733A 0x6D0E92E6 0x3071757B 0x7ABB75F0 0x37B98F29 0x006C1766 0x4129B3B4 0x13F8D028 0x4B57BF4B 0x22AC853D 0x27D31351 +0x52858D17 0x6A49814E 0x3D056EE8 0x1CFFC40F 0x512774BD 0x61E9CBC2 0x19E2C654 0x76A57D4E 0x03066C09 0x29027038 0x73F88B71 0x70FAEB11 +0x1F929224 0x23FADC94 0x14E4FC4F 0x7EF73BF4 0x14AFF12B 0x136616BA 0x684F8A60 0x10CE995F 0x277B89F4 0x555E1D47 0x41400EDB 0x2236FFE4 +0x0D17AC70 0x41AC2641 0x6360B398 0x21107C98 0x0D03E58C 0x060D38D5 0x48E38FE9 0x5F8972A3 0x7056BA24 0x05E8FED2 0x7C8936B2 0x417E2EE1 +0x67D2CA94 0x166BFD06 0x3823AC30 0x6AD9369D 0x3F6E6D3E 0x2C1C37A1 0x5BD421AF 0x5F00FF62 0x50171436 0x70B91DFE 0x5DF83B56 0x64C70561 +0x041F34B9 0x4647C5B7 0x75959EC0 0x2B9ABEAD 0x1BA5E2FE 0x36D5AD9B 0x4DD1BE92 0x28BD8F6E 0x7881D3DC 0x3132722A 0x49CE0C06 0x0585B968 +0x373FAB00 0x12B19BEF 0x650F2C0C 0x27966524 0x189A9AC1 0x619862BE 0x69149405 0x006D6556 0x78045FC5 0x21384035 0x6B469BF3 0x3772CD03 +0x4D5477D7 0x471ABDA2 0x1673CC66 0x1D6B8C0D 0x37D3DBA1 0x746C07BC 0x0232916E 0x3BF3105A 0x3AB3CD73 0x77C8302E 0x678DCF07 0x5659B071 +0x2E9DDDCA 0x355F8D99 0x7F173FDF 0x271FB1A6 0x6691FFC4 0x48E54BE5 0x2CA56B0F 0x1DD1AAC4 0x5B96E7D5 0x11B4971B 0x45680FE8 0x74318296 +0x734CF9D9 0x2E7CA3ED 0x749EE7EC 0x6B51599E 0x4FB4E423 0x5FE583E0 0x22C426A2 0x1D095BFA 0x27004182 0x3937F308 0x3A74E807 0x5ED41D23 +0x2DA3FAC4 0x3CA77975 0x1AC72D7D 0x6857C838 0x346FA9A3 0x0254FC85 0x3EB178A9 0x630D876D 0x37B48A1E 0x3DC8B889 0x0A2D3914 0x1E4689E2 +0x06AE046E 0x36D2A423 0x3C1834A6 0x6244EC43 0x48873B3E 0x0180448E 0x56766EDA 0x3BD43517 0x2FFCE87C 0x4B1556C6 0x27258EB6 0x7FB1CC9F +0x2AFADAA6 0x49E9B558 0x1CBB2899 0x51FB1C29 0x0321A860 0x573010A0 0x30CF394C 0x30C5A324 0x13D78A15 0x4B9666CA 0x191D6B5C 0x484733B8 +0x4DEB634F 0x57CEE406 0x2B54BB26 0x059FED6D 0x15979C8F 0x3581F43A 0x23E67750 0x1C45A0FD 0x6C54985D 0x5FFEABF6 0x7E8A8D41 0x34DBD39B +0x617EF085 0x5500FC1B 0x70B008B2 0x117BD901 0x201652E1 0x17D59768 0x112DA5A0 0x4B112D88 0x61BF4CC0 0x2DE8CE39 0x1D0C49B1 0x64E0F520 +0x0518DED9 0x4DDB82FD 0x15A69845 0x18F068EE 0x1971E9C7 0x2EC403A1 0x61379CA6 0x675D4D16 0x0692E7A7 0x0C8C57CC 0x6CFD3A84 0x1C2A8436 +0x420E4C06 0x10E3B1D4 0x38702534 0x2E62E463 0x70E25DCA 0x36FAB275 0x633EB7FE 0x52614E4F 0x0BFBAE90 0x53EEC0B1 0x63DD2750 0x2C120171 +0x6BC45819 0x750ACCF0 0x77232EF9 0x4D83A4DA 0x22F39B29 0x142F78AA 0x326499FA 0x280C7A02 0x620AFBA8 0x480B323F 0x40FCE2F0 0x7B7CE56F +0x76CF35E1 0x22347F97 0x62DA3286 0x7D621D88 0x2EC0D763 0x4FD76D0A 0x198CA1BF 0x70CF236A 0x60BB1EDE 0x51FCC6F3 0x1F3207CD 0x519D7CA8 +0x08F77968 0x0270BFCC 0x23FECAF8 0x14F327F8 0x565F807D 0x07DBF248 0x41052969 0x4223D896 0x7CE6BF39 0x38285863 0x0FA77D70 0x1FDA5A62 +0x4C57D10D 0x420C176B 0x47E6D465 0x2E62CCB5 0x0A1749AA 0x08E3B755 0x29DFB225 0x00E67F8B 0x2B1836EC 0x0CB9E4AB 0x7E489D14 0x59D90E50 +0x5C9151B5 0x17D53ED3 0x4AA831BA 0x3D4C7093 0x69D205C6 0x69DA3987 0x0EE9ED3B 0x72C97F2E 0x6C4AF953 0x32E8B833 0x07BCA726 0x42AA79D0 +0x3AC4AA7C 0x48C1D08F 0x04CE5267 0x37AB69B5 0x00EA28F2 0x1475CFD7 0x5785C417 0x4D41FA00 0x5681E742 0x1F6C987C 0x7BA4C6B5 0x609930ED +0x28504FD2 0x258478DA 0x617FB078 0x536886BE 0x323E5D85 0x5FC84D8C 0x2D41950E 0x0ECFAF3A 0x779D8C5F 0x77E9C6C8 0x4C1C1FCD 0x616F9225 +0x61C40050 0x5B060D09 0x54391153 0x4E0EF9A3 0x0DEEC53C 0x5BF5B879 0x10B97374 0x48B36FB8 0x24B78909 0x1587C5DB 0x005ED96D 0x25A1B1FB +0x29FD95B2 0x57E49D85 0x72E3ABFB 0x007F7CF5 0x77513601 0x6E8872B1 0x6118ADE2 0x1FA185D3 0x140CEB8B 0x42985E5A 0x730A0C92 0x464B4911 +0x2260ABE7 0x204BA1A0 0x551AF84B 0x19FE3846 0x18356869 0x21371819 0x7B6DCA6C 0x79F968B9 0x7C3D2522 0x4FA6DBBF 0x4808625C 0x0A2BEA5E +0x2B9C9439 0x58C1D5D0 0x52DF5A17 0x50541D42 0x6E499BAB 0x533E3384 0x75F5CF3D 0x1847315E 0x2B22D109 0x68D97B39 0x18C6AE53 0x2274070B +0x5761EDEA 0x79DF5C35 0x42158CDE 0x6B6ED975 0x3C77BA8F 0x351F9970 0x31BA2286 0x5ED86676 0x556B3B11 0x06D51AD2 0x78D69EBD 0x6DA0A37A +0x280C32EB 0x74446929 0x679A0C33 0x2449580D 0x43EB44E8 0x2FA26E8F 0x2E75426B 0x6F87D921 0x08644460 0x01549C82 0x3FDBF663 0x76ADE00B +0x5492D007 0x35D1C5A1 0x0EF51169 0x7FB5A110 0x1EAB40DA 0x27BBBFBC 0x2229A81B 0x760D2EC4 0x219B1BF1 0x643F34FA 0x617C0839 0x5E12D681 +0x195ECE6A 0x13362AC0 0x3CEB3CF7 0x6ECA097B 0x1A0B4592 0x35C1DBB4 0x5C6AACF5 0x4217787D 0x2A0644DD 0x4404B928 0x6660D08A 0x6DF189C6 +0x73A727B8 0x14D612F5 0x5D7962E7 0x7C0B6C18 0x162AAF78 0x1D55594B 0x72B94C23 0x6ABD7F7F 0x53271EEC 0x01AE5D8D 0x6A73208F 0x71D25FC6 +0x296A1D49 0x0C9CC8AB 0x67DF8E8A 0x4B05393B 0x70DBFDA5 0x495B96C3 0x29180FBC 0x0A3ACC0F 0x5C91C183 0x66034CB3 0x7904D58B 0x769D0715 +0x1BC52868 0x556F8280 0x38B47F92 0x45CB6D45 0x19743BA9 0x1F15501C 0x33BCF70B 0x0D1B6361 0x33EB6312 0x113659F3 0x0926CF79 0x4A16128A +0x2E8BB33E 0x7BE01B9C 0x34D39209 0x01B2D22A 0x7D8E7929 0x1F46B298 0x738531F0 0x26F89673 0x2BE37B43 0x5B64C07A 0x71FDCFAE 0x1CBF78E8 +0x24C0573D 0x1B15DF6A 0x26FA44F8 0x015218C1 0x01192C1D 0x1FFF1A83 0x77EF1FD6 0x1CDE5485 0x756E9D03 0x30A39F69 0x62A9C1CB 0x0EE2D8AC +0x4FB8EF85 0x1666B8D6 0x1BFE3C0D 0x03A45297 0x279D12C9 0x25250B86 0x4DBA6521 0x5628C607 0x21052723 0x028DF72A 0x57DB9831 0x1E93A04C +0x21D4A9C3 0x4B60CA21 0x458C36BF 0x4DB82506 0x26C58A9B 0x378A066D 0x6A779DEF 0x4B85E1D9 0x529FE5D7 0x1171E2E7 0x4CD7FA9A 0x53B911F5 +0x3170FD6A 0x44C71A70 0x7097667A 0x26DF9A6D 0x756AB9D9 0x53412845 0x35C2731A 0x4523A95F 0x69A7E11C 0x51C0AF27 0x48C7FBF6 0x1144F3E5 +0x76E5BAAE 0x16826118 0x676DB9ED 0x17EAE1D1 0x19105842 0x3F49521E 0x367E821D 0x3AE50205 0x0AAA1C40 0x7C0AB8DD 0x089D270C 0x316FA6DB +0x3394BF4A 0x7314C4FB 0x7CF588B4 0x0634A522 0x0486A7E2 0x49CD834E 0x59EDB717 0x35F7A54C 0x0E949DBF 0x4A851D91 0x5CD73FB9 0x03FF5798 +0x1DC645D7 0x1299B2D3 0x492300F7 0x076E26F3 0x645A61FB 0x11EAFCEE 0x18B31AD8 0x5B401CA9 0x286D5E06 0x0020D4C5 0x732AFE7A 0x417DB648 +0x3F6A26E4 0x29A98097 0x7C62B84E 0x4A144324 0x25B43974 0x04FFDF5A 0x7B83E9FF 0x5948F8BF 0x7814A455 0x787972B4 0x5F7D9DE1 0x7C9B4C37 +0x4246F602 0x396B54F8 0x3292F183 0x50DB93C1 0x03F07289 0x0F6A313C 0x54DAEB5A 0x21B6B860 0x2203E410 0x1DFDEC51 0x2924DF53 0x065E460B +0x2FE8E93F 0x41D7FA2C 0x619E62B4 0x58564745 0x41F8CEF1 0x54C9612E 0x19D3FD8E 0x0162F5D5 0x7E72E1C5 0x1636B5DC 0x4B7738F9 0x24271B3A +0x1B369536 0x46FB22F9 0x7D7013F9 0x134B398B 0x3F7495AD 0x5CEDB1DA 0x0FE685C2 0x01BB8BAF 0x165906D2 0x42797745 0x52971F71 0x1A49795B +0x51E3A881 0x27720ACB 0x3C0031BC 0x73E78C91 0x456FF71C 0x6525110F 0x7A45D29C 0x7558E05C 0x26FD0B3B 0x5BE43550 0x4DAF27A1 0x68F5DA2D +0x30AD967E 0x6783252F 0x6A58D002 0x2F207844 0x7DB9DB0B 0x35D008FC 0x5347937E 0x18F07041 0x7CCB2BF5 0x50B7A777 0x2C3BA9CC 0x3C3FC1A2 +0x2DA55951 0x3C222F8E 0x3DFB4D51 0x43FE6023 0x7E9BA6D3 0x10926CC2 0x5E47D97E 0x507F4F55 0x3804778D 0x1A480B3A 0x4466DBE6 0x7D746EAA +0x7F6D1C4A 0x3EACAE83 0x72CD4F06 0x266A2785 0x1A90E3D3 0x407C76A7 0x0F6001B2 0x4B3E7A52 0x27FF9BD7 0x79B8D1B5 0x7A5EF296 0x25B976E2 +0x2F88DAB1 0x4DA68614 0x3EA9E724 0x2C5406A6 0x1E5E2D8B 0x6AE590F0 0x6893C848 0x4C0386DC 0x2707C07F 0x268F1599 0x1001E6FF 0x25A36752 +0x3721825C 0x6E49C07D 0x7622B6A7 0x6F25F9E9 0x0891CBB8 0x3A89928E 0x6C9A6893 0x07FEE802 0x79364111 0x5F67B799 0x2E690F87 0x13C724E4 +0x1FE42E41 0x3DC9113A 0x5F059F36 0x47E3CA18 0x3781E2EF 0x596491CC 0x6D9D40FA 0x670ABDA0 0x270B17E0 0x2C47281E 0x135EC446 0x4569456B +0x172CB90F 0x7BF28C8E 0x116CCC47 0x3E34798E 0x2281A227 0x216EB346 0x63D7E0E0 0x59A32483 0x0FB873C4 0x59FA9788 0x48C91E6D 0x184A3F7C +0x14842A16 0x35638700 0x2049277E 0x0DBA6B27 0x14CB3E9A 0x4EB23705 0x2181900B 0x34AF6CDB 0x0C7B483F 0x00872F42 0x7C9336F3 0x43FD2B2E +0x59EBC10E 0x6A3077ED 0x2B07E8CE 0x00F6D8EF 0x1677A00C 0x3E66AD14 0x46601E5A 0x2DA4591B 0x3A5939A2 0x57CCEAA2 0x6BD8D2A9 0x5CDADBCA +0x793B9DE8 0x4FB0B389 0x367E004D 0x08F411AC 0x29AB4B11 0x7F471EBA 0x213E5128 0x3E2F7527 0x34AAA5BB 0x418778A6 0x4BE9E04E 0x4975E455 +0x1039AFAC 0x6D6B705A 0x7E255130 0x1CB4F7EB 0x6DF29F9C 0x7AB88823 0x60B2231A 0x47DE60AA 0x64E90010 0x0BBA0BE8 0x48D53999 0x7B60A01C +0x4A20B8FD 0x0F3557F4 0x2904F937 0x0479F29F 0x67024296 0x14DDCBE0 0x6154CE69 0x603DE07E 0x648E7F6A 0x17D2CEB7 0x6931F22B 0x0E39CA7B +0x1719ED71 0x0A704353 0x4C693FA3 0x4BC4932C 0x4BF7BBFA 0x18531FF1 0x153A7781 0x5C316BA6 0x05BE904B 0x135FC8B1 0x78E66391 0x73B12FE7 +0x0E1850D4 0x599886AB 0x3B8F9092 0x730150E5 0x65529294 0x0464CA2B 0x6E61F101 0x2F734B91 0x139A221F 0x1766EA39 0x33ED3E30 0x7A9C64B5 +0x2C44B619 0x15420C9A 0x5ADA4534 0x10D33583 0x2D14DB51 0x440C375F 0x1F0CFFFF 0x442EC8C2 0x4E7C7AB2 0x6B763FA2 0x0FF35BEF 0x1A7436AC +0x03C95F93 0x252DD370 0x76A5A252 0x0987EFDF 0x388D9C22 0x6F8C05E4 0x7D391FC6 0x46A5ECF6 0x49248C8F 0x38C8B058 0x39A73DDB 0x2E771F23 +0x3D2D7A84 0x28092EDD 0x5DEA6AB4 0x50C79CA3 0x3F701916 0x11D7A8E5 0x4B640159 0x6BB4CF2F 0x2719B57F 0x263E468D 0x7C8804B3 0x542E90D0 +0x6A4A7DEC 0x1B9504B2 0x185D5992 0x38C6F89E 0x070B4454 0x2850B581 0x533B2F4B 0x0AD4A3E7 0x4D7E88F2 0x49E0D19D 0x145C93C6 0x060C2514 +0x396CD781 0x1195B38D 0x4CB2120A 0x02916411 0x4A5E63E5 0x06594FE6 0x31088334 0x078BDE69 0x2E627EC3 0x0EF2EDE9 0x58537B0D 0x6DD297D9 +0x20CA96CE 0x23B77C66 0x59876708 0x47E44C4D 0x49F5C2F3 0x560F6BBB 0x1C12DD1D 0x344040DF 0x71A4706D 0x347036AF 0x6D07397D 0x78AFB4C1 +0x5CC0EC31 0x404268C8 0x038458A9 0x2A3F7523 0x0A233A66 0x17E0EC6F 0x304B9A37 0x439011E7 0x29769FFC 0x7CFDAC41 0x462175F8 0x73D503E2 +0x0356FC27 0x7729F92D 0x7B60E24B 0x31B97AEA 0x061CE716 0x53B45D58 0x1F8C12C3 0x26E77DE4 0x776BD9BE 0x791379CC 0x6ECBCA31 0x41619CB1 +0x4F22E587 0x0ADEA74E 0x75A1DD90 0x40C755F5 0x3F4EDDFD 0x62A9170E 0x39770AB6 0x1C0FCA2E 0x22EB7FD6 0x3CFB635F 0x464F3F51 0x2D0EBA3C +0x54DC4FCF 0x769AD988 0x709ECC24 0x7E52EFCB 0x739885CA 0x36C0421C 0x7227F3AD 0x76EF81F1 0x2DEA3B49 0x6D88D5F9 0x28A8FCDC 0x3407225F +0x413D3351 0x48350F9F 0x5AEEA043 0x38A90D10 0x4148896B 0x49BA6A74 0x7A0AA9C1 0x106B6EF3 0x549911C2 0x6FAC8752 0x5132C4E8 0x13E7EFC0 +0x52559E60 0x0AA9CF9E 0x2FF7B9EE 0x75411E36 0x47A532FE 0x7646F940 0x224FD873 0x1C8182CD 0x6CE1D2C8 0x12EEA497 0x1AD47298 0x607A5892 +0x49AEE6B3 0x0CFC6646 0x5769DA84 0x779921FD 0x7A853C3F 0x0012D760 0x2BA0445C 0x3BC26F90 0x4847E6FF 0x068EE4A0 0x746B7CA0 0x0990706B +0x50494F14 0x6E762662 0x19FBDF5E 0x24E260D7 0x5E22ADB4 0x6B2EA446 0x38CA5097 0x30784C14 0x75D873E4 0x68C20A85 0x25B96A4A 0x3D7DA6E2 +0x5F0903C5 0x480942BD 0x59FF29AF 0x4BEAD68E 0x5AF7E754 0x74D39C48 0x2C652F20 0x24A6CE08 0x01D0028E 0x03CF09A4 0x1C3FF005 0x7C553ECD +0x03E1E104 0x47E03461 0x3817AE5D 0x4C29C804 0x4E6F1901 0x2C832AFE 0x55BA386F 0x1EB86816 0x1AF95160 0x6FB617CD 0x439AC8ED 0x791BFF14 +0x5AE4BC13 0x7C651984 0x29944B28 0x50BD2FF7 0x65272409 0x4F4DB572 0x0E3AD6DA 0x443027CF 0x1756F830 0x683A0089 0x101AFE5D 0x724EDF84 +0x5D0D9CD1 0x3C802D7D 0x16F5AD8C 0x5EDD9F5F 0x404F3722 0x33359D91 0x5B32DE2C 0x44311826 0x7B15D1F3 0x134A8C8A 0x105AE02A 0x4984EAF4 +0x3FCDB788 0x66151899 0x683D530A 0x5AC708E8 0x55CB3066 0x2BD81BF7 0x53E307FC 0x30AFEC79 0x283D357B 0x7D775324 0x016D1C71 0x0D645985 +0x4CC50896 0x0FA7F34B 0x51948154 0x641C00C6 0x77E1F3D4 0x61AF7FB1 0x566AE04B 0x54EF90A6 0x1E2FAD2E 0x6D608DD7 0x33CD3005 0x5E7EE450 +0x20962B69 0x0F000E32 0x22AFFC77 0x1BABFD5C 0x224A9ABC 0x330ADCA1 0x6530E850 0x62185244 0x191FF53B 0x4D6E3B5B 0x3CDF5B2C 0x6EEB25A1 +0x79465752 0x10C26328 0x1F9B121B 0x21838CCE 0x0E39B64C 0x21082E8C 0x2EE7E653 0x5AFEBEE2 0x30B021D7 0x007C67A7 0x3F1ABFA9 0x289215AB +0x622BE758 0x15859FF4 0x7D81A651 0x005B9486 0x02E62DCB 0x314ED657 0x5EDA78D7 0x237C5934 0x404EE489 0x018A754E 0x3F285690 0x62997F45 +0x349551EF 0x24593EE1 0x44B1D189 0x4DB5472A 0x71C77A3C 0x01912CB5 0x3CA06CCC 0x6B0DD18E 0x12538FDD 0x5C3B7EE7 0x0C915E5C 0x208D4629 +0x7D43AD73 0x3B7944AF 0x7B8C050B 0x2DF3CF4A 0x3BF5AC56 0x3AA6C4B4 0x5685E4F5 0x1E2193AE 0x502C64A8 0x54078B47 0x1E7D2835 0x53129274 +0x0556619E 0x7D57A10C 0x768EEBA8 0x45A54627 0x7EE2165A 0x35B74239 0x283EC56C 0x33776849 0x5A10811A 0x6CF096F5 0x012CAF74 0x4BD7FB56 +0x6E81C3AA 0x3DCD1C40 0x36E5CCE4 0x00D55387 0x1A089B27 0x43772B41 0x216299B0 0x174C489A 0x7EF06FF0 0x1CEE9EBB 0x454017E4 0x3AE61C47 +0x57956370 0x1BC5FCD9 0x5907AFF5 0x27C1C818 0x6FCD8820 0x7784D82A 0x7AD45A8C 0x7523E9BE 0x74DC7936 0x71634635 0x3AC92FE5 0x73BE8F90 +0x271A886E 0x6307F551 0x2735F7DA 0x012B0988 0x4FF88C46 0x2862A74E 0x4D0304DE 0x3E7A4FF0 0x662FC38E 0x03E8D1C2 0x3F4FA377 0x00385EB5 +0x475FFD03 0x60B23D27 0x1784A74F 0x46506CF4 0x7DA0DBE3 0x5CC4BF33 0x0136893B 0x55363F53 0x788ABC0C 0x5A3E3930 0x7CF8076B 0x6858442D +0x51C3115B 0x77CC61F8 0x5D7C2DEB 0x469F8A91 0x692FA82D 0x18455DD1 0x3A5E1A22 0x104A309B 0x7B4D5322 0x619411FC 0x11753A23 0x4B45DF69 +0x09F6B94A 0x5E783F01 0x09C02F59 0x70267CD8 0x626110C3 0x490FD2D1 0x705EDB8D 0x29C10DC7 0x29C20FF8 0x07E382DC 0x70117ABB 0x2762EBDB +0x64A8420F 0x714803F6 0x7C992B2E 0x5D32FE1B 0x4B863D26 0x7991329A 0x458B4248 0x1D494E81 0x715D9492 0x23077034 0x63E8D913 0x5A8D3CBF +0x3B4CCE05 0x1E46F335 0x6AD76D5A 0x369A2127 0x7FDB0531 0x7C4CA77D 0x01E00090 0x09D1BE7B 0x5AC4E67E 0x0BA02FEA 0x79F83B53 0x3D25F741 +0x54B002BB 0x6A5716E0 0x66E70508 0x7E7212B3 0x723A99BC 0x56F87FC3 0x25D4FE8F 0x56E2DBCB 0x484083B9 0x226E29BD 0x3415D9E6 0x13C6C0E0 +0x1BFF5C57 0x79A11C2F 0x31100F61 0x0D5CF0E9 0x1CA88C63 0x14F8E874 0x67EA2DA8 0x57F55A68 0x333FDBA9 0x52C19B02 0x0E8F7B8F 0x331AE0DA +0x4F0E427F 0x106F7C20 0x3CEC9F55 0x29D328FD 0x1C0FAC0A 0x36E4DAA8 0x66F9203F 0x70BFAEC5 0x213BF188 0x4DE02547 0x6F31C178 0x13768B44 +0x24D8A50B 0x1506C007 0x6A59670F 0x6D1928C4 0x3774E9C5 0x1E6F40F6 0x00DFE9A4 0x5374461C 0x18105D25 0x31EFF906 0x60D13706 0x34B8E988 +0x46E8E17A 0x48BB64AE 0x0CAE43F0 0x7A28BD24 0x1B7CFFB1 0x1B3DBF7F 0x2D439DFE 0x6A8B4230 0x2BAD3B9F 0x6A303D54 0x145E6B2E 0x47BCE7A9 +0x211517FC 0x7B578B6D 0x387C966E 0x42510985 0x4937B0B4 0x27AE57E7 0x55C794C9 0x6E1055BF 0x3CB517EE 0x4020FBD9 0x5B297E84 0x742A01B3 +0x5E903CCF 0x5C096828 0x479E47D0 0x76A099F4 0x0DF9612E 0x286F7ED6 0x2B59837C 0x54E242A9 0x712AE384 0x3807C76C 0x4F0AFFCD 0x0CA7E335 +0x534586EB 0x7C4E9DCB 0x77332566 0x7EF2C28B 0x667EDB1F 0x0B919094 0x46AFAA34 0x0793F31C 0x06E91C01 0x7F2C40A3 0x49E4FCA1 0x5020CCB5 +0x26DA988A 0x1FAC916A 0x3E312275 0x638FB078 0x5FCD8D43 0x195AA0F9 0x57B9B22C 0x3E5DCA12 0x75640921 0x1F57F9FC 0x34FE6406 0x035D6A50 +0x47C778D2 0x6057E782 0x583FACF9 0x38F25C56 0x185FAEEE 0x274AACC6 0x459A3F8C 0x6BA535DA 0x23994A91 0x3CCD64F2 0x6A97F865 0x0A1825B1 +0x485EF586 0x3147A299 0x11AC18CD 0x4F481187 0x3073E33C 0x5B91156E 0x1F68DE3C 0x574E7BC6 0x7B3DA6D8 0x5D9A00B1 0x3ADE2C3F 0x5B0B341C +0x76F4A1AA 0x1297DE6B 0x1968FE2E 0x6C58AACC 0x31EFD867 0x4E676235 0x6FB6151C 0x79B75139 0x2EBF49B7 0x47F5C215 0x32A9AD8F 0x471EF8A6 +0x6F406EDB 0x7843ED1B 0x32C42E80 0x12D9B96C 0x3511520D 0x1D5C26E5 0x1CF1DF1D 0x7D704793 0x4EA3C97E 0x2E9DF7EA 0x4CB8591A 0x7F17ACBB +0x0A2F0D58 0x6C213757 0x56662881 0x056CB431 0x49BB3808 0x114454C0 0x6077E84D 0x40AFD9B3 0x23DC332B 0x79E0E67B 0x2D08847F 0x55CC0B92 +0x484848B0 0x1CBE999B 0x4F835CCB 0x77079268 0x64B45BB0 0x022D0A5B 0x3E268B0E 0x53F4CA8B 0x7A70F776 0x70EAB98E 0x66CE83F7 0x2F824984 +0x0E46E073 0x03C06315 0x2CF29117 0x5CEAA9F1 0x325E5AFF 0x79AAEA32 0x5C0256AC 0x3C8D6858 0x65CC2189 0x32687F2E 0x41FA1C89 0x2F875991 +0x43ACD3EE 0x227204D6 0x70373344 0x6789071A 0x1C52EB51 0x1D3FB7C3 0x3D5512AC 0x649B3402 0x39FE515E 0x0CD86F78 0x5BA2C66A 0x1EB2AD0E +0x0F0579D3 0x19C95178 0x72A77799 0x09767149 0x0AB40B06 0x5975FB91 0x38F8BACD 0x18FAEB79 0x5D365EA6 0x65EB4BE5 0x75E5956A 0x0F94B9A5 +0x5F963617 0x51E7EC17 0x4C2221FD 0x456257A0 0x04506B45 0x0E1C3E86 0x74E9B131 0x47FD3F33 0x308E435C 0x6520E476 0x2F86464D 0x4CE12EAE +0x02609C39 0x6CDB58FA 0x317C62B0 0x3C5EED98 0x79B3C872 0x0D1F291A 0x5B119AA6 0x08B94245 0x26E87A92 0x4DB91240 0x122FB38E 0x319C8598 +0x272F0DD1 0x4B286E5C 0x4A977111 0x04656C77 0x3113BA41 0x407D067B 0x13FA261C 0x10A9F058 0x1264F292 0x601C481A 0x560C47F8 0x16B55DD7 +0x6E3886A0 0x4AF5F929 0x5EB29D0B 0x1EC6C9FD 0x3016DD9F 0x0E38E358 0x6BA7F8AB 0x327779D9 0x7B143C52 0x1D245B5B 0x6ED66771 0x74C804C4 +0x2A438475 0x49E80217 0x7D814709 0x512BFF07 0x17A11457 0x0FB0FA98 0x02C8849F 0x3ED02228 0x5AD968F4 0x4D5FF5B0 0x43358E9F 0x0BED2335 +0x0DDCFC2B 0x572FB4BC 0x1C97138D 0x2041EEBE 0x374BFCD6 0x72A35B85 0x36F74C95 0x25848376 0x3D9954AE 0x15A9E9A0 0x444B4D73 0x6DB0324E +0x23E2CCF9 0x2FF3461E 0x2027AC27 0x1EF7094B 0x4D17A179 0x0EFE1398 0x13BF0E10 0x775B25EE 0x58E615AF 0x11405519 0x488724F5 0x70872A07 +0x20F14FB1 0x4B4FA994 0x2F574C2F 0x7BCAB8A5 0x18AF9F44 0x728CDACF 0x07B7DBDA 0x268C9B70 0x49BC8F8B 0x244EEF67 0x46CE8A2E 0x01088C61 +0x16F24AEC 0x7DC5D6C3 0x268D0FD7 0x548B9F9B 0x136FC064 0x6AD85D4B 0x423BD1E9 0x37528D5D 0x1ACBA369 0x62637E10 0x564996A8 0x67E344E3 +0x716191A8 0x6A08A4B8 0x5F3E6AD1 0x4A47A757 0x7B48F9D2 0x27C58FC7 0x3ACED15E 0x1C3A4983 0x7315395B 0x6A261D8E 0x18050229 0x0BC4D8A0 +0x5CB2F85D 0x1FBCDE03 0x32517410 0x266F87E8 0x440BCD6B 0x791FFE3E 0x27781449 0x5AFE1857 0x76E5D501 0x4E052420 0x2F89B7F2 0x0A559565 +0x38DD816B 0x71C589DB 0x41A822C2 0x53A924D5 0x542907EB 0x17F1B96B 0x3B8C69B8 0x458A9993 0x01FA5E23 0x1ACAD489 0x0FD240EB 0x7D4357F5 +0x42906450 0x4AA11249 0x197DA179 0x35A59DAC 0x34C72FD7 0x3182A3A2 0x416A764C 0x117A2834 0x513F81A5 0x73BBEA5C 0x37E9B01C 0x154B4F10 +0x6CDBE89A 0x5F61C465 0x70496768 0x63C1BD9B 0x2D66E886 0x1FD31F5A 0x6E175301 0x664469F1 0x1198A936 0x2FBF75C3 0x39ED8EC6 0x65C1B121 +0x47B12F2E 0x7579F87E 0x2B4C4AB5 0x49AB8D52 0x1044CD08 0x3B1E8BA0 0x46EEE547 0x52D53158 0x05BF9DE9 0x606C86C0 0x087ACF04 0x3A86CDC1 +0x11EF2A62 0x49E54550 0x4C00F5F5 0x632EAC08 0x3DA12FAC 0x03EAA612 0x7879FB18 0x2A7D1846 0x634C6A77 0x68C36280 0x0E3ED5E2 0x10B352FD +0x089681DB 0x7C5628E3 0x76F7BCEF 0x1A2F2B11 0x2C159EA6 0x30E54BB5 0x7FF0DC32 0x73C6CDD5 0x265F4434 0x2B3D26E7 0x3D725B27 0x36A4113C +0x665BB287 0x0461406E 0x09794294 0x6C1B5071 0x64CDC72F 0x11F41199 0x26A21E32 0x76BCF191 0x5BD956E9 0x72A31427 0x59EB9D99 0x197A8696 +0x768DBA39 0x526598B2 0x43F79EDC 0x59DA24B1 0x3B28FB32 0x523674BE 0x6A8D77AE 0x43BF7D0D 0x4E8C9DA1 0x6185349D 0x5DEEA81E 0x7AA23C48 +0x126A8053 0x5DDF8451 0x6E690A1D 0x38C9C487 0x091CAB38 0x2BDB6544 0x6F6DD5C3 0x6F785DC0 0x303CA5B2 0x78E71857 0x5B93AE31 0x150A6CE1 +0x0ADB29F0 0x0235CC63 0x0BC75E73 0x66B480DA 0x74D8E08A 0x65B2FC0C 0x002F0770 0x6B669AC4 0x381894BE 0x4426A64C 0x4540BF75 0x73418FF1 +0x165D1B0B 0x2FCE3723 0x37010CFE 0x64E9B8AC 0x11536BC1 0x14EFB51D 0x5F8BF4F4 0x23BDEC14 0x72CF396E 0x4DF4FF11 0x5C87B09B 0x7BEBE4A6 +0x79D06455 0x4BF5865E 0x6B644266 0x2A0D0A08 0x44DC9EB5 0x46F7F097 0x3F1776E9 0x4FB7C8A6 0x492DBCFA 0x4ADED55C 0x366C4980 0x3E069D85 +0x3091D169 0x369B50F0 0x296D3849 0x68AA6627 0x7AC1F73C 0x6EADF7BE 0x5BEBF618 0x111F1247 0x1E7C2EE1 0x12ED0317 0x7608CAF4 0x2FCF9AA2 +0x27DCB834 0x5594BFE8 0x538D86B6 0x1AABF1A2 0x2389BEFA 0x30153751 0x1697D648 0x1D5A234F 0x7C0ABDAF 0x01FC18AF 0x47672D57 0x40E75C65 +0x48F40946 0x067EA441 0x109F250B 0x1221C641 0x515D799D 0x470B6E8B 0x502863C6 0x01EF4B06 0x7DA6BF7B 0x79959C0F 0x6A99B12E 0x7868B6B7 +0x684393CD 0x4685A746 0x0987C8FF 0x06BFC2AE 0x5972AA5D 0x7F9093F3 0x368F5D51 0x014F6291 0x552553DB 0x0A1CE407 0x1BFB5433 0x78AF12D5 +0x3A321B59 0x32932A7C 0x16093625 0x363CD908 0x348F432B 0x5D70637C 0x7724356D 0x7D834C71 0x63EF07BD 0x07C35A78 0x0FA512B2 0x354C815B +0x4ECEC903 0x5FCD7678 0x373BCC61 0x4C75887E 0x59631287 0x21D57D8F 0x44DE3F36 0x41A6A654 0x685B24D6 0x4E660835 0x48666903 0x41CDCF33 +0x4DF69C28 0x7EF5C654 0x431D31C5 0x231BF003 0x0912AA5B 0x5F1885F8 0x1BCB02D9 0x4344C5B4 0x11ABB074 0x31D438FE 0x79819EBD 0x463AF39F +0x0F449C7A 0x70A5D42A 0x43BE4011 0x7333A438 0x78692EA3 0x536352C3 0x28802593 0x4737F7A6 0x3330C93C 0x5FBBF1F4 0x13AD8025 0x0C93DBC3 +0x01916F84 0x588BBF5B 0x4E3A8218 0x69EC945A 0x26F1C790 0x16A0EB1B 0x2BBA638D 0x74E863B8 0x1596B16F 0x6ED79552 0x180453BB 0x1EA95BCA +0x4DF01B4B 0x33CF5694 0x61EE217F 0x5F9BCBBF 0x65A38F92 0x5B6FC03C 0x25D6BF5F 0x74E82C0D 0x4C159466 0x6994FF70 0x681BD045 0x447EC309 +0x3CF85233 0x109BF5D8 0x0BB6BAB0 0x70291B6F 0x7057E7CC 0x1F643AD5 0x7CBCF733 0x71E95750 0x77EFFA30 0x4AF7794B 0x5BD5EBAA 0x1EE1C1C0 +0x61986466 0x07904F38 0x13CA2578 0x772F15D5 0x7667E48A 0x2BCE7933 0x15D8719F 0x4457FFD5 0x5F9DCFC8 0x77C6931E 0x23F3CB95 0x45415F5A +0x5336535A 0x49CA8AF4 0x3A298B67 0x1F4BE7C1 0x335F8A64 0x22455BAC 0x63CAAACA 0x7057DC97 0x32E15184 0x6F81657A 0x6080F807 0x23393951 +0x0EE5A04F 0x5D3DEF3A 0x152290A1 0x06D59A7F 0x28356885 0x70F87C4C 0x25B75C3F 0x09CDCCEB 0x7888CB84 0x398181B7 0x00FCE2C0 0x6EF0B00E +0x654FFAEB 0x16D5545F 0x3348AFE4 0x44EDCAB3 0x0E9BE77E 0x573C7B79 0x0A2F2A0D 0x61D23AD8 0x2107066D 0x4458B575 0x011E2299 0x546690D1 +0x669E1121 0x64E8CD64 0x44BE6D68 0x197F62A6 0x546A32DE 0x253F656F 0x3CB89BF7 0x634FD32E 0x027D54A9 0x51DB2C98 0x6A256DAD 0x2AB2BD2E +0x42D3A8E4 0x0FDCC9ED 0x34808A19 0x3B5C7468 0x495E4BA4 0x357D6CD9 0x2A4D2477 0x2EAE468F 0x4C52C139 0x5D95D45B 0x739C1142 0x5AEEA8B7 +0x34D24FD4 0x7DCB3B50 0x3CC0E38F 0x55D95641 0x4223F0C5 0x3DDF0629 0x2A3FE712 0x28C201E6 0x22C7D38D 0x6EFE547A 0x4241648C 0x7732066B +0x143DB9EA 0x7EFA0083 0x5A81D999 0x16BB0E93 0x50D52D1C 0x44A74747 0x416DCBC2 0x13A8D600 0x54841134 0x75EE55DB 0x4F054A69 0x1DE25CD8 +0x2B6BC2B5 0x79526EE0 0x4C90A368 0x77BE83EE 0x56E8433B 0x402CB4AA 0x52AD2CA5 0x0BBA930F 0x3DF7EFFA 0x0F6E1034 0x6193E950 0x001BE0BF +0x4D4D165D 0x0BD3D062 0x28DDE2A6 0x7014E9EA 0x7AD224DC 0x6B1F4732 0x6746F056 0x0F0FDEC6 0x6A1947B6 0x41C8C9EF 0x25CAED5A 0x3AEE74D2 +0x06701136 0x6738B91C 0x4E974AD2 0x5AF4226A 0x5D270EF7 0x1D9C953B 0x78D67F43 0x0892D1AC 0x16EF041B 0x456722AB 0x0051559A 0x6DD74756 +0x0593D755 0x52FE823F 0x7991DA65 0x438BC750 0x626C9274 0x5B25C3B5 0x43A7A80F 0x2FB9A8D1 0x66F99417 0x6C858AB5 0x1FCE92BC 0x61CBB8F4 +0x57A4D1E8 0x07158312 0x70DB97BA 0x41BE199E 0x48DE4D01 0x16A68514 0x7CAC8E70 0x4F4E5E38 0x7DDF3E30 0x4B43D942 0x2A4280A2 0x5B064D28 +0x68E06E7E 0x2318FFE5 0x63991ED4 0x7FCF7299 0x68802290 0x63EA746F 0x6DA6B9F0 0x6E13F9E6 0x36E8F6AE 0x67389455 0x319FC136 0x19558922 +0x425E580B 0x75476945 0x490F31F4 0x2957EC22 0x61CCF3FB 0x68DDC4B0 0x0B23A516 0x3971C5E3 0x6FF347C2 0x7BFF3CD1 0x7B2FDF81 0x38D194C3 +0x12A5C1E5 0x77DC6DF1 0x081FF2FB 0x10850016 0x43204733 0x3262739E 0x6B8B4D3E 0x2C00B5B1 0x557B7383 0x4F246C12 0x2BD0284B 0x3DFB9614 +0x330EE081 0x1976E23B 0x2C0F8FFA 0x69F7D730 0x00AF7690 0x5DAF5130 0x034D6052 0x430DCE9B 0x52F6BA75 0x4C5C9246 0x6C65BABE 0x34C3AE70 +0x353A56F6 0x77895FD4 0x6E357453 0x252D9EB8 0x73889CA5 0x696553D4 0x5DFF337C 0x062E5E8B 0x6141C1C5 0x661F2677 0x16B35EA1 0x246208F9 +0x18819A15 0x023EABDF 0x5062BEAA 0x6DFD0D99 0x516317F1 0x7C32E6F5 0x2BF8A3AD 0x0471F873 0x15A9C930 0x580833A7 0x6E69CFA3 0x16593FC1 +0x35B784D7 0x71B72FF5 0x59670E5C 0x08AE3F4C 0x3E13C23C 0x45CCC91A 0x3D71EDBD 0x734E1932 0x3D5628EF 0x2BA76210 0x187BB7EB 0x30DEC594 +0x150CB5E5 0x767AEB67 0x370D241F 0x764E77AA 0x5C9A11DE 0x4DC082C0 0x1AB080A3 0x751BABF4 0x4FFF2E9F 0x6B133F4E 0x6318B98D 0x21624691 +0x67462643 0x0F115D3A 0x25D43F04 0x7CEFEF74 0x671990E1 0x143E0EA7 0x13492F35 0x1CD115B8 0x05F53E9C 0x6CB03D91 0x257F5504 0x440900D8 +0x327D06AC 0x62F142C1 0x37571A0B 0x6FD32F9B 0x0E98A4D2 0x4FD2D1F6 0x20B1F52F 0x23A55AB7 0x464DBD5D 0x57BF194F 0x19F3D261 0x22E7CF3B +0x257F9C0F 0x34A45305 0x18037B2F 0x757ECAAF 0x1FB79253 0x7B1C34BC 0x16E11140 0x06FDB896 0x0A2D91F6 0x3CB55044 0x03EDA80A 0x714722D7 +0x50F35EEB 0x1736D73F 0x0E18388F 0x56E89D87 0x03E714D1 0x33978D94 0x1AF19E60 0x36641B7D 0x1688D055 0x5248B86B 0x26374B18 0x25217527 +0x221B8A61 0x46E94047 0x48C6CFDE 0x686947BE 0x1EA85996 0x62BAA240 0x0B5116F9 0x4427F5A6 0x175EF545 0x23549229 0x39A6C055 0x37168798 +0x1E70C6E5 0x5087D195 0x3E14402E 0x289E58DC 0x0D3D21D9 0x4201E839 0x19E57BB3 0x5E3080C4 0x5938BF78 0x27FDB443 0x35191E4B 0x5D1FD449 +0x5B9541D7 0x500ABCAB 0x1383EFC6 0x721E122C 0x22537516 0x39BB3ADE 0x173F8754 0x446EFF77 0x00A47B26 0x60065732 0x2CD84735 0x1F4CD4BC +0x42C0F972 0x38295E2F 0x6374CA62 0x5A1FEEB7 0x5B7DF058 0x1D1B8AB7 0x1136764F 0x79EEB73D 0x6DA35C4C 0x4F4AB67E 0x228D1019 0x7AE07E25 +0x114C9EB7 0x3C728BCD 0x5910FEE9 0x6A855E2F 0x64704010 0x0E2A1D35 0x47A53279 0x400581E7 0x5E34D9E0 0x5B29223F 0x32239413 0x00884EF7 +0x14E45D1E 0x49631B67 0x44F74E6E 0x1588D844 0x2969729A 0x71CF95A4 0x34D5AD00 0x6C2A6C0C 0x29F8F3D3 0x184A7763 0x464A5AC4 0x0576E42B +0x3566021A 0x5780D113 0x7F659B68 0x23095E67 0x26CB8791 0x21F2AB82 0x1DE9DC8C 0x38182648 0x5E65374F 0x76FADB76 0x229D8478 0x42D5775F +0x0524F8AB 0x6A42B6F1 0x02DAF946 0x6359D28B 0x456BD930 0x34FE8D59 0x63E22182 0x5A50364E 0x7E61A8C1 0x28D96FF1 0x6FD90E92 0x27CB1B5B +0x1AA90595 0x24AEBB93 0x13F58767 0x44A1F968 0x3CF932F6 0x5A3FE22B 0x4A18DD93 0x725F3510 0x31C0B33F 0x497E78FB 0x15689377 0x588C3AD0 +0x6B71247D 0x33527004 0x10A46119 0x49D65BCC 0x2A4D4B7A 0x3341E591 0x0CABD32B 0x2F724425 0x1D849C82 0x0F86CC71 0x12CC16B0 0x62F075B2 +0x448559CB 0x76AE3833 0x3D40AC01 0x42E7028C 0x1F87A824 0x2D19BA93 0x6AB21DE7 0x3A30ADB9 0x51C87626 0x7EA7A54E 0x7ED2A721 0x0EC1A91C +0x58E7877A 0x48EB84B4 0x0120DE2D 0x0AA83AB9 0x1269FDAF 0x168971A4 0x63347589 0x7DDB222D 0x49DBE1A8 0x73D8D6A2 0x47B17DF9 0x74292D22 +0x271ABC33 0x545D5125 0x239B7147 0x449F58B5 0x63E41D96 0x366787F8 0x278FCE68 0x28697761 0x2D15C02B 0x64D07A69 0x6B5079ED 0x4C9D684F +0x11EA34FC 0x560297D4 0x06CE1608 0x63B2AB23 0x54AA3D23 0x05A0BD29 0x7274543F 0x2D91C49D 0x4E8C41DD 0x7395326C 0x3839FF56 0x60F63F8C +0x0A1EA411 0x1B6E74DF 0x5ED161B9 0x53FA85B9 0x0F474B82 0x2682DFB3 0x4823B2DC 0x366207B5 0x7AE030D8 0x6BBF2423 0x7B01606B 0x5EC44E6E +0x2226AC1B 0x22912ED3 0x072DC5D0 0x4F3C6C46 0x0761A93C 0x727E3FBD 0x1BD9D495 0x194BDE38 0x4880D792 0x22A7EA9D 0x7CFE895B 0x1D2B14B5 +0x2848A7C6 0x6F72DD9B 0x4ABCD952 0x76D4E9A3 0x63081007 0x02F6D8A8 0x57CB2930 0x6D26B418 0x1E654D87 0x369C8AE9 0x412139D2 0x2DAC9909 +0x5D1F6A9C 0x0944ECAE 0x640EA0BF 0x57FF9B74 0x750410D1 0x5F10012A 0x36C3E9E3 0x172ABCED 0x01A12FFD 0x3DF1AFB3 0x66672933 0x0902D939 +0x306FEF70 0x0240FDC9 0x224EB771 0x78F0C702 0x24E8E866 0x1F4D40CD 0x161BDBB7 0x4D31902D 0x0EC01E68 0x60D8B509 0x440679D0 0x71C82E6F +0x63CF8DB1 0x1BD1A300 0x5EEEE288 0x0234DB39 0x526E2DEA 0x20101C5A 0x2FE17442 0x2F8D9886 0x29550908 0x13F01501 0x078D33FB 0x1E5919D9 +0x7300162B 0x3E511DDE 0x3583D6C6 0x74A14628 0x7C42CD91 0x1BEAFFFA 0x7DA41F61 0x2CB2BD01 0x1E2BFDC3 0x1FF2D6D3 0x25A38404 0x4314E629 +0x3F4017A0 0x3BBF5FBB 0x10467656 0x4E003608 0x1C9814C5 0x544CF027 0x3FC86477 0x0067A276 0x701E9327 0x1EB746FF 0x029C7DAF 0x428CC111 +0x3EC76359 0x327DF1F2 0x721A5998 0x681C6C61 0x466E06F3 0x79A78D93 0x0675863B 0x396E1D1F 0x37F8AB71 0x3BF95D01 0x2E0F6347 0x343B7902 +0x57E45CFB 0x2BB382A9 0x60EE3603 0x76105ABE 0x4BA6597C 0x0691BA07 0x392540E8 0x0AE6711C 0x425119C3 0x496BB73E 0x58E6A724 0x5EE92E88 +0x1DB8A765 0x18AF0B9B 0x5F50D0FE 0x0DD73A8D 0x3766529B 0x61ED4EAE 0x5063FB9E 0x762DB5F4 0x146B40A0 0x427E5536 0x5E4A2256 0x5AD94793 +0x3C25E2C9 0x64BFA891 0x144764B2 0x741E8E3A 0x20B90592 0x4256C7FA 0x285A073C 0x789D628E 0x6E0A4AA3 0x09483D40 0x6EADBD4C 0x39B0A41F +0x0FD9F747 0x27D2FE34 0x4497153B 0x522B110A 0x713EB573 0x1D7DBC5F 0x31143F92 0x0EF75CD8 0x362CC7FA 0x10651091 0x1CCE9765 0x6D931A95 +0x72525F3F 0x6D329304 0x63C0D08A 0x06BD9FDF 0x2FB0E83A 0x420AF2E0 0x6196E772 0x6BD6CB04 0x26CA9B71 0x75DE4C25 0x5FF5593E 0x4783A103 +0x3835141F 0x084F607B 0x40210391 0x263F5EC2 0x11979DBB 0x2ECEC0DE 0x5FF002E1 0x21719502 0x56A1BF12 0x2487181C 0x739CA60D 0x47E07485 +0x4204D47B 0x24B0E59F 0x56D7D15E 0x78319C75 0x3515F630 0x73A668C3 0x65C4B70B 0x2768556F 0x60D8FBC7 0x49858795 0x2E25F54E 0x1089E402 +0x0B907A75 0x0FBCDCC1 0x7C60AF06 0x325B15E6 0x059B28E6 0x5C560844 0x79DEB6E9 0x3DD03D05 0x64A568BF 0x39FFBA7B 0x640F9BC7 0x763D067A +0x68CE7B59 0x43FF9EA8 0x17AE9B7D 0x3F703A6B 0x6886B6C4 0x0B4B418A 0x0750AEF1 0x2A8B8B3F 0x2FFC2729 0x5E28804F 0x22BD27B4 0x65121D5A +0x51CEE912 0x0881DEBF 0x0C7A72C9 0x32A7E4DA 0x52076654 0x3AA06818 0x4331C8DC 0x5D97E0C9 0x4A5D44D9 0x3F9277E2 0x0FF2F6AF 0x4FF86DBF +0x1BE88026 0x09D1AD99 0x0DC8AAC4 0x008DE8E6 0x43D16814 0x71D8468B 0x76CAEF60 0x2C9FE36D 0x35D7E533 0x0E798ADD 0x6C101DD8 0x1E5E9BF7 +0x19C4CC67 0x7360CCC9 0x48EA2736 0x49C0F391 0x51894D18 0x6BA74EEA 0x2ED310EB 0x2358362B 0x74292DAA 0x3B4D83B4 0x56001B05 0x463093FE +0x75EDEBCC 0x1931E3E1 0x23C874C8 0x404B30A5 0x58C45BC3 0x33BB6B77 0x10439E64 0x74ACDBE9 0x3D8D1910 0x1E0C4928 0x753AC4CF 0x015E8124 +0x0FE48FB3 0x6C05B430 0x2DFE6491 0x45BC74E6 0x7A7F3F0D 0x1A0E826A 0x641B10DD 0x14440B75 0x0D6F4F33 0x2D053813 0x5E04FF06 0x5EF89C4C +0x18AC86FE 0x0CD80FF1 0x0250D277 0x0CD5B4A8 0x482593A5 0x5850ED7C 0x530648A6 0x3E137F72 0x7182D15D 0x76CEBD6E 0x7E5EB017 0x4A472D20 +0x2A8A28E6 0x0EA24E7C 0x3EF40909 0x681741F6 0x2CAE97A4 0x342ECDD9 0x6975C31B 0x3C932758 0x20348209 0x177427AC 0x024F9C3E 0x1AB3C116 +0x3182AA16 0x666AAD1C 0x2EF7CC8B 0x3EF1F94A 0x136FE52F 0x0CFCCB91 0x1DEA9596 0x2C1C6C2D 0x19D4DB82 0x203B680D 0x38F220D5 0x61FA6F28 +0x788C5589 0x0BF8697C 0x200DEE9A 0x6A0F26E6 0x02C726EA 0x1E6C9EB1 0x34565406 0x2D514FD0 0x2D0EED2D 0x734A5D0F 0x156891C7 0x59BD84D2 +0x27792AE8 0x7EDE54E2 0x1650AC2A 0x47ADACF1 0x16527C8E 0x18A04868 0x62616E08 0x47D526A5 0x7F0AF584 0x11593A93 0x06C71FEF 0x127ADAB4 +0x1E560625 0x24B1B585 0x3E9746E1 0x382AE1A7 0x44ED1D92 0x778967B7 0x1A2550CF 0x3D79731B 0x0381D133 0x3A333F69 0x27889A01 0x0648F81D +0x589FDE1B 0x5BDEEE07 0x339A47EE 0x05AECB48 0x4F294B16 0x4902D9B5 0x5F6C501A 0x76A275FF 0x47E12E97 0x75BCFC44 0x3E5022F0 0x5E33AB25 +0x0E5D44AD 0x20B190F8 0x2608D1CA 0x0D683A31 0x320ACB8C 0x2CCFF1B9 0x1FE314E5 0x5060D1B1 0x5181A73E 0x5E7A5BC7 0x088BB358 0x166EC4D0 +0x5603C37E 0x22B10428 0x53E837EB 0x598594B1 0x5CE44391 0x7B70D1EC 0x5FCE8CCE 0x358421AC 0x574FBFF3 0x1368D4BC 0x3B32ECF5 0x26790B0A +0x5C6BAE71 0x1A9F3D0F 0x1D1B8109 0x244CDD08 0x105C3954 0x5B6BA3F9 0x0280882E 0x1EB97E01 0x7C1D34F2 0x288959F8 0x2C21B832 0x2E28007E +0x55594BB2 0x4C04CD18 0x7E88D22F 0x26DAF2F0 0x2A7F28DF 0x07148587 0x3D49B7C1 0x0082EC5D 0x29C589AF 0x1131EFAC 0x5A08810E 0x06A9CD41 +0x0CA2C199 0x39D70DDC 0x3C2DEEED 0x63F2818C 0x4D3FE299 0x7760DBE2 0x0A6B8C96 0x29AB910A 0x120018F2 0x27870D9F 0x4DF86E13 0x225C5246 +0x02F2B199 0x5078F641 0x4115D047 0x7F0FE68B 0x79025039 0x6D378879 0x2D37E709 0x4E5B9BEB 0x393C5591 0x2BC0B938 0x75368EDC 0x63BB7E70 +0x32D53EBF 0x3280469D 0x643E6ACD 0x5C9AC86F 0x43B23649 0x3E46EBDB 0x634495B0 0x5054F7E2 0x781DF9B8 0x1F72849D 0x3447796F 0x455DDC51 +0x16D36080 0x3EB30605 0x6F096D5B 0x28D37972 0x663A13A5 0x3D01DB6E 0x4B2FCBB8 0x692CC53E 0x0D7AD1AF 0x0C459BFF 0x683CABC9 0x067D21E9 +0x797D2478 0x157492D2 0x54D8BDD4 0x32B97A0A 0x41354C0A 0x4A0F4CB0 0x1674F87A 0x740A8AC9 0x7C8F934D 0x7AB36348 0x50A55338 0x4041C997 +0x38FA4F23 0x33E9E8E8 0x1096C179 0x311848DB 0x535C6D86 0x44DE3AE8 0x7676252C 0x6A2FCE06 0x039140EE 0x657F9288 0x13034778 0x69CB5493 +0x22816DF6 0x5E331330 0x52F819D1 0x2FFC3FA6 0x6A78AF2F 0x3B34C59A 0x3679618F 0x63F5D3A7 0x50A9586C 0x0B521F63 0x16AF4DB1 0x11DEA476 +0x55616C14 0x2D24462C 0x05E92F3F 0x51F0FF61 0x27D7A974 0x568E8278 0x1232C8F8 0x60D1F897 0x0A786B60 0x22C98A72 0x11EA4173 0x5DD4D8E6 +0x67A7C55A 0x0860669F 0x4804A6EC 0x6B390648 0x6DDFF927 0x5B07EE64 0x55045ADB 0x1061671E 0x393B0194 0x27FC74AC 0x405DA6C4 0x23B3B0C3 +0x63313A46 0x76D70853 0x07A9846B 0x33DA92B2 0x022927B6 0x1E58D21C 0x45B93728 0x578A93CA 0x4B7D1848 0x4BA26668 0x297B932C 0x7354C1BC +0x2230E8E0 0x3BAE5C24 0x5426BA54 0x2CA95440 0x5E77E696 0x6610FBC7 0x0A7E2D27 0x461FABF1 0x6E716266 0x5282D413 0x3158B239 0x5C515B8E +0x2D8AC278 0x065D0D15 0x6CB2C2AC 0x66C5C40C 0x2E5981C1 0x2D106970 0x0A7974D0 0x118ABC08 0x23E771C3 0x1222F93B 0x45654EBA 0x26109979 +0x307BCB57 0x0B1E85E3 0x7D9B2D44 0x7BF8E3A0 0x56C0EC4B 0x2716C070 0x6F4DA55C 0x78F1D52B 0x62C51C94 0x43745FB0 0x259B296B 0x413D032B +0x29855B77 0x30195692 0x075CAF1C 0x17F6BDDE 0x029C2AA6 0x38B56155 0x7448196C 0x3026ED1E 0x3F126E6A 0x60FADC18 0x16ECB12A 0x6D6BF02C +0x0E0B4588 0x216625FA 0x7EF6AC34 0x31F2B74B 0x33891F35 0x445BFAEE 0x580350C4 0x6404EA8D 0x4F7A80D1 0x559E7E08 0x5FFDCE2D 0x263B6D1C +0x7CB53E78 0x4F4B7389 0x1F2D4247 0x5F7A5B0D 0x12BFD33A 0x44C86BB3 0x20B75E38 0x3C452EB1 0x74E1C245 0x28140D54 0x543BEC8F 0x777DECEB +0x60C96EA9 0x488405FB 0x27A4DA09 0x1FDBDD14 0x297EE213 0x3E918B34 0x0D47CD40 0x378A279B 0x5FF7B12E 0x0C3E7974 0x697CDEE6 0x1380D064 +0x509A7462 0x41802FAB 0x7785BAF1 0x2014F534 0x171EADB3 0x5783891E 0x46506250 0x13D3EC2C 0x26CEFCA7 0x657DA498 0x734E4739 0x398ECFE1 +0x2A46104B 0x1405A571 0x75D3FE93 0x1F27D290 0x3C19B2C5 0x4A0FEB22 0x16A5BF7C 0x1CE3216E 0x1293F11E 0x3E4A9985 0x3CBEFE82 0x3C12D331 +0x7CDC24B9 0x4A06CBC2 0x739CFACD 0x5CD3D5E8 0x56454536 0x5D19D9B3 0x7054A64C 0x26DFB999 0x1E9A095E 0x67DA613D 0x46F4AECD 0x35B8B712 +0x3F5DEA5B 0x0D45111D 0x498CA33E 0x662CE702 0x72C2B5B5 0x3CDAEA77 0x1FBBB6E4 0x1D08C600 0x50E08FE8 0x158FB577 0x3C309891 0x0CFA42AD +0x5F9FA099 0x52D6580D 0x29DD641B 0x723391B7 0x1120F192 0x669C629E 0x2E4664E9 0x0DFD164C 0x30A32E60 0x21E35FB6 0x6AD0EC34 0x06E87397 +0x7EFD3969 0x5B259280 0x2DC82D30 0x1D9742C8 0x42FFF3BD 0x74BCDBFD 0x534FF9DA 0x025DDE18 0x0201ED1A 0x1CDC9D18 0x688AC51A 0x74C4A2D0 +0x59B7878F 0x08467BFE 0x11CD68D0 0x2A981777 0x1DD63175 0x4DFE0161 0x37925A24 0x7D75D20F 0x20D4596E 0x616FBE3F 0x6FA963C6 0x31F54B01 +0x480C20DD 0x1DEFC8AF 0x3FF2614D 0x78AF4F3E 0x3FD32865 0x2AC34D81 0x7F97C2D5 0x3ED061CF 0x05E8E001 0x2D5FF005 0x5C67A497 0x48E8D3BE +0x221CCC02 0x2FB79E71 0x4B46B1D6 0x241EB91C 0x4C943B89 0x33D176F0 0x18E35BEC 0x264BC318 0x3C17F2EF 0x2AB0C4BD 0x50E3DA8F 0x59EE2464 +0x78AEC61E 0x087634B3 0x5763F673 0x19831F8D 0x69E5F2F2 0x470D5A3A 0x4B786A8E 0x31F213D0 0x64FD22E9 0x0B6ACBDB 0x2AA1630E 0x24D04B4F +0x362E195C 0x2A3925E3 0x63A0AD1E 0x3C16F95D 0x579915E8 0x400851B5 0x04FFCD1B 0x79B5E1EA 0x6FBFF026 0x50467EF1 0x1DD49B06 0x3C542BAF +0x0417F5E1 0x36B7F6F3 0x629FEEC7 0x402FE8D0 0x6168BBB0 0x3383C956 0x1A1E0D35 0x5A1781CE 0x3BF9FE09 0x718203A8 0x739AA15B 0x25DFF0FB +0x388F5DE2 0x3F130BE9 0x57D204CB 0x1D8C80CC 0x4A7DD7C4 0x027367D9 0x425CCC1B 0x00ABF120 0x2CAC8DBC 0x25FD7939 0x3CC2EA7D 0x0445A3A4 +0x6605CAEE 0x41C2B798 0x7DFB858E 0x55C5BB14 0x12093689 0x1BD02095 0x1219E6C3 0x16212C6B 0x52881788 0x74B9D58A 0x5651153B 0x33F0D338 +0x283D9EE0 0x706F2270 0x0E085506 0x64379CE9 0x61F12619 0x01A2F662 0x0A178DE4 0x1A8083FB 0x40B6024B 0x61E992B0 0x380D04C7 0x0B33DA10 +0x645CFA89 0x7A69D0E2 0x0BDFCB30 0x11098846 0x20674A1B 0x48A2B5AE 0x154F2BEA 0x066D1509 0x0A656D46 0x134AB179 0x5C32D01D 0x1C6EA3D0 +0x2F1AD20E 0x6E4CB6E0 0x328FD03B 0x01A2E996 0x63068C6A 0x08E0E576 0x3593BCCE 0x0B442B4A 0x795007E7 0x439C11D4 0x6F7BC833 0x5B412E00 +0x453F0836 0x79935618 0x75C1B1FB 0x05F50A82 0x5B7CE8C8 0x2DCEB6C3 0x1128E492 0x3FD9E351 0x283887A5 0x1D08AFC2 0x50E36B97 0x489FD1C1 +0x65AB6570 0x66329782 0x4F0CE6CA 0x7010D2B7 0x797D48FB 0x2B3FB6E8 0x0C7F7687 0x28981B09 0x198C6DC8 0x3F0F46C2 0x2A3B049F 0x7C92FA33 +0x47F02C38 0x5FCEC16D 0x07D7257D 0x4140341F 0x236AD341 0x7752EDB1 0x1C81621F 0x68A9DB78 0x70E643C9 0x1243141B 0x6E9EE5FA 0x4C632C91 +0x4011CADE 0x7FC7CA8C 0x0C3D0FE2 0x684A5283 0x1CD07A4E 0x5D207B7A 0x30EA2444 0x027BDFBF 0x435312FC 0x7FF70B0F 0x728CB276 0x3CD05BF7 +0x2B36C1F7 0x7F0C28FD 0x65687700 0x44C32FBF 0x3E1B6FBF 0x0FA37B9F 0x415629F2 0x060B9BF7 0x6F723D0C 0x492D4F70 0x474BD017 0x12DD104D +0x40803D21 0x63CD3236 0x7B86EBC5 0x316680EA 0x76104651 0x6A25D1BF 0x7DC9AD7B 0x3622112F 0x69ED9C4B 0x0A06BD5D 0x1E6C63B3 0x06BE169A +0x672738D7 0x4F5687F7 0x0939F659 0x2A7A4BD3 0x4F4D9306 0x7BC6A8CF 0x674AA7CA 0x7A8454FD 0x7AD2D1CC 0x4CB31ECA 0x3F4784BD 0x38EE418B +0x5C569A69 0x009DAEAF 0x3EF9DD82 0x4BC8D775 0x49CAFE1F 0x0645AD99 0x5EA5E7C3 0x0A4B3B40 0x6A12DFD0 0x5A2CD388 0x3BB1BC2A 0x60232621 +0x4452A548 0x397B69A5 0x16453751 0x2E404193 0x43822703 0x34B19B04 0x34FE582D 0x2AA95FDA 0x040822FB 0x3E384E86 0x5523ABAE 0x5355B602 +0x39FEF755 0x3C6E5378 0x4DDA0AFF 0x34D1C921 0x09217243 0x0D218FBC 0x6DC00AAC 0x65780CAC 0x0DBF3E6C 0x2CB9E82F 0x3140E422 0x578A3C8B +0x32FF95C8 0x0FE6CBE5 0x61D577CC 0x1D127598 0x6A139F6D 0x1D8733F6 0x7D359BBA 0x2E6644B5 0x57029D9C 0x137AD30B 0x5CA68649 0x1A84C49F +0x482C6E0F 0x11A4DE76 0x452E2479 0x4C34910A 0x4FDD2CFD 0x1A51D027 0x1F8A470C 0x09DC2452 0x56C023A0 0x6D64520C 0x3EADED74 0x5FE195E3 +0x7A85E1C8 0x2C6DF820 0x4559A28F 0x08452034 0x5927E04F 0x769A86B1 0x5FCF5CC0 0x0C277618 0x06815296 0x41A4D48C 0x2939EBB0 0x7094F204 +0x5F2C0882 0x266F876A 0x1EFB36B9 0x362EA61E 0x39EA5A75 0x7BA1BD02 0x50B36ABD 0x0216C884 0x0D469B79 0x15E18F37 0x4E4B598F 0x5D23C876 +0x30335F5E 0x6DD5A09B 0x66FFECC8 0x06F382FE 0x5B39F2A7 0x25ADDA3C 0x66D518E1 0x55BFD470 0x521BD25D 0x2C2EBB71 0x5E04F4A4 0x2B43B2AC +0x22C94222 0x3DD45164 0x376B28C4 0x294A94B9 0x7F7925F0 0x60A51475 0x19DF86BD 0x5EA52E73 0x07149BDF 0x38DABD76 0x14D3D491 0x40FEF655 +0x347C7A79 0x65873F4F 0x4315BED9 0x41C315F2 0x7B68CE86 0x11611868 0x1EE6DE68 0x2B9C2DE4 0x7F36B904 0x05E6CB30 0x328FB0E3 0x5A70ABAB +0x2B94A56D 0x1964C9C4 0x3030801B 0x7DB077CA 0x45938535 0x0E3574C0 0x28F42A76 0x685CC758 0x4C09C624 0x605F533B 0x11A75C11 0x4B82EC15 +0x410467B0 0x2B86E2CE 0x2A281A88 0x4819038F 0x6461A044 0x3EFBEF19 0x0917F9E4 0x18DE1ABD 0x24832E68 0x4C2DB8BE 0x5AA130AF 0x1FEBFCEE +0x5D8ED126 0x79880F17 0x4B882AD3 0x5CC58A2A 0x7F6EDA48 0x7E17DBB6 0x373635D6 0x2B037FB5 0x177CA57A 0x6766B5F1 0x28B3F77F 0x5D102AB0 +0x759C2AB1 0x51A821F5 0x456CF208 0x41A5F0D6 0x32077530 0x57144E19 0x0D28DCEB 0x730BDCE0 0x029B30E7 0x3750F773 0x3B24E070 0x66FCD12B +0x764CE68C 0x443CDA54 0x7FDAEBE9 0x1AD014F5 0x106A9312 0x5A7C1C98 0x3ABC11E3 0x6DF96439 0x54042BB0 0x06443CB6 0x4ABEEE63 0x537305F8 +0x045C186C 0x01F52439 0x7E7685AD 0x1BD8BDE7 0x695BDA2B 0x272A7D2C 0x78E8E897 0x5EF804DC 0x78D29F21 0x3E55DA9F 0x209DF5B2 0x2ADA1452 +0x156A28B8 0x2DC6D29D 0x1DE5F132 0x1805599F 0x6517CA10 0x590AD1A2 0x7F022ACA 0x5B64B09D 0x1D47ABF7 0x7EDD16B3 0x7634C592 0x2DB23F09 +0x5959334C 0x30F0D775 0x1BABA342 0x2D5D5EFC 0x3735142C 0x666A91A6 0x00D064F4 0x3B912C98 0x685FB5DF 0x7F46EAA1 0x5769EA7F 0x51BB900A +0x267167CD 0x5052D316 0x30B394E7 0x1F4406EE 0x0EA8ADB5 0x51518A99 0x4A1E1B40 0x2412D66D 0x7F185D37 0x68040C73 0x3C18300C 0x64302747 +0x410EDE15 0x3B1A5AD7 0x3F94D7E4 0x5E568A0C 0x39F7718A 0x35C99D76 0x0C08C916 0x1350A4D6 0x66BA74EC 0x27B46C58 0x40AE03D2 0x1DEF8918 +0x0E1EFDFE 0x417E68C6 0x5980B5B0 0x767EB3DE 0x40C55367 0x30EAA030 0x483A43E8 0x6736BB34 0x013D7346 0x78EDD8CF 0x067AC223 0x0FE620FC +0x4A3F6369 0x5098DD63 0x33F8F769 0x4957C0A0 0x389CE9D6 0x70112776 0x2D87E7E7 0x79ABC7EC 0x2B2B824D 0x6D1CBFCC 0x580251F8 0x6522F3D7 +0x22E65D42 0x640B1B0E 0x787398AE 0x09A0D22E 0x0BBF8767 0x39219C80 0x27905B46 0x19DE8565 0x7AA00547 0x011110F7 0x105D3943 0x3B6558AE +0x31FBB127 0x58977D2C 0x229C13E3 0x3339246D 0x518555FB 0x2916D606 0x431F4569 0x1BC4B964 0x79AFB369 0x77183CD3 0x651C7A04 0x324C9D40 +0x67296449 0x12A461EC 0x2BF8652C 0x1254E696 0x7FC121B8 0x03FAB724 0x7777DA6D 0x22A77EFA 0x6805D233 0x6FEB731B 0x2C485129 0x73C5599A +0x290D0F9C 0x53D8AC6F 0x0DA3DEFF 0x23AD14E3 0x54E9BD66 0x1E011843 0x5F126D91 0x06E56E8D 0x7698956F 0x01AE8174 0x3A1E92FB 0x481DEB6A +0x2AC5577A 0x7D3DD864 0x63E2A4CF 0x24750AE4 0x74561537 0x48FF1ED3 0x56C1A824 0x5B7F7980 0x5BA380BF 0x02BA0D50 0x6DD46016 0x5B64A277 +0x06B4C474 0x654C3A84 0x7E0C2172 0x6EBA96A7 0x5537AD9F 0x2A54729B 0x627FF041 0x7E44BD3B 0x7E2D1F0A 0x7023CF41 0x21F1D21E 0x5316DC71 +0x0E24E784 0x01043FB0 0x59FC4AFE 0x04BD7CF3 0x02B2C124 0x141ADDF9 0x4CDB685D 0x2D78189F 0x1158B65E 0x30BE0D2C 0x51ED2383 0x05AECB95 +0x79BD2C00 0x28AECBA7 0x612E4516 0x5560ACBF 0x2B68D8F7 0x4F02A52C 0x30C54F37 0x321D9D6B 0x344EDFB0 0x2ED170A9 0x20D83413 0x09868D50 +0x5925E344 0x03582454 0x07CB4A8B 0x5753024E 0x737BF395 0x29BD1CAA 0x2A69DEBF 0x01A0DB19 0x2AC15C5A 0x046629BE 0x065E580C 0x2D741D7E +0x188107B7 0x5339C06A 0x5AEC361D 0x29D9BE15 0x03F7CD96 0x2CD959A0 0x2F8889AB 0x7DB4F996 0x55882547 0x10B6CEC1 0x5315A656 0x00F0FE3E +0x5FB973ED 0x03DAF58D 0x330E9BAA 0x1408539E 0x32AC6636 0x53E6CFBD 0x1D8EE0EE 0x0BD2497A 0x573EF411 0x255A2B79 0x63254BC8 0x4ABAE7A7 +0x4F174823 0x0D8F2A88 0x4C5BC2C0 0x79D8A47D 0x11F55446 0x52BA1ACD 0x274CC1FC 0x2A765BFD 0x25F3DB37 0x0238F819 0x54501A13 0x29EBA8CD +0x2F1251BA 0x03D8A3BE 0x27A0A264 0x049A7701 0x148F727F 0x7AB648BA 0x058B7540 0x7448E66C 0x7E913E47 0x389A10EA 0x08513A0A 0x313DA47D +0x0C80E0A7 0x25E01AF8 0x3D0FEDF7 0x63BFD4B8 0x4B3A4672 0x203539BF 0x2E7ABC5F 0x1A518E95 0x2DC46447 0x7AD67F20 0x142A3313 0x3FB9B88D +0x4D9099ED 0x3B76F50F 0x6A30148B 0x73847524 0x3DAFED28 0x3E802E9E 0x1D701DF1 0x6CC23EE2 0x4258D25C 0x4510C055 0x715CB5E4 0x56E844DB +0x3FC7090F 0x76E82B24 0x4B312B47 0x3E584756 0x2F823C0E 0x53826552 0x6F95EBD3 0x3C031CB5 0x7962804A 0x2CA5D9CA 0x1FC2F16D 0x449CC6BC +0x4CDB138A 0x4E3DADCD 0x5EEE5552 0x7A9F77D1 0x49142CED 0x73188865 0x3A59305F 0x16A4C6DA 0x2E8F7D74 0x248944EA 0x0A293BFE 0x6C3F6A9C +0x63097388 0x279959EF 0x5901A97F 0x256245E4 0x6CAA1A45 0x4A5E5F63 0x7C4A8ABF 0x2C712354 0x41468A87 0x477BB606 0x6AC96AAB 0x70C8C695 +0x1AFE1B58 0x5A5F567E 0x2CCBE34A 0x14609BA3 0x07053049 0x4C8ED4B7 0x58FD625F 0x53E043D3 0x1ACC8284 0x37EBB7B1 0x4E7FBBA4 0x63E0AF71 +0x2B044016 0x08D8EC03 0x7A85764B 0x5993BD8A 0x2D6230ED 0x04AEB249 0x45D32827 0x106BA475 0x2C480C39 0x1ED4D1A6 0x35CDEA59 0x18F2267E +0x69333109 0x32187518 0x456349D2 0x2A79BB90 0x79942B1F 0x302CB47D 0x1B428225 0x14924677 0x0A8C0AFC 0x480E656F 0x28F2E21A 0x11913B45 +0x149D3A26 0x01F0447A 0x65717F18 0x2F69BCAB 0x39DBFC2B 0x33F13ABC 0x134A6C1C 0x64E03C42 0x3CCA26C0 0x0DCFE268 0x3E73F9CC 0x6A2C57AD +0x127E94B1 0x044721F3 0x7A97FC23 0x3EC6A0EA 0x231BF399 0x3065E67C 0x57B8C768 0x0C4F24A2 0x627E5B95 0x1D1C113B 0x36C8E032 0x5C1286B4 +0x4D48C5B8 0x520B6257 0x70A4CD2B 0x57D4D0B4 0x1A19C7C6 0x1997AF46 0x69660BF9 0x2EB701ED 0x1B87F3C0 0x4ED78B11 0x5E20BE98 0x5563EFEB +0x02C8C5CE 0x716B2AB4 0x3A442C2D 0x3F92EC8E 0x7F3B0D1C 0x78B825FA 0x29BF443B 0x11B9A1CE 0x7CFF47ED 0x2457405E 0x508042B8 0x201B3B87 +0x54BD26DB 0x28390A21 0x2C6A6029 0x373B8270 0x45551B5C 0x6333405C 0x134E0924 0x129DE114 0x353EA2B3 0x03F2D64F 0x6A72B1C9 0x4F586A7A +0x1D8A8595 0x53D8BDC2 0x7E0F6C67 0x39127955 0x22B048D4 0x5C302AFF 0x0E766941 0x25790EA2 0x4D9B55B3 0x48BA956E 0x650BFB30 0x4CD662D0 +0x4172BB68 0x0ECB3F6B 0x5E90049E 0x3E720356 0x33227FCA 0x2F104756 0x5E8D3EDD 0x07DFA6A5 0x57495177 0x0AF79F06 0x3F1B2915 0x1C9E6CD3 +0x6E2ADF62 0x52693239 0x2F3C4DE8 0x23698216 0x565C0888 0x19AEFFB1 0x72C1EC90 0x73E68E1E 0x6D87BD73 0x70D158F7 0x2CF90773 0x10380647 +0x4D0183F6 0x3B6F70B4 0x35B114E9 0x1A9CD9A9 0x042A0623 0x1ABD1019 0x67733C79 0x459CC18B 0x29884F85 0x46034117 0x040EC4E1 0x5CAACF4F +0x7513886E 0x629C03BE 0x648A75F4 0x4C5CD9E5 0x6D93A2C5 0x23A59F09 0x68FB46B9 0x5BBE8227 0x760ED142 0x183794A1 0x7F28043D 0x4C6AD9CA +0x31E69452 0x71E9F0CD 0x405167E8 0x1F6E51C5 0x62BB49C4 0x6D4A6F5C 0x2FA6580D 0x2FBCCDBA 0x28B9E010 0x65576CF6 0x4A59A764 0x2CE3E633 +0x00147D10 0x31CCE3DD 0x7280A7BF 0x299CCC95 0x77D024F5 0x768F6CA0 0x06479BE4 0x6CE3AD63 0x592B705F 0x6AD211D8 0x39408748 0x46BF1324 +0x0E77B0E1 0x223BCE01 0x227D954B 0x04868223 0x3A7362A2 0x21A59989 0x50F15BED 0x6C59F6F4 0x138F8A56 0x1142C3D6 0x0BC848BA 0x764AD41B +0x7E8D3332 0x3B6EA0C7 0x2607A1D5 0x27471342 0x20C60DBD 0x70614939 0x542AF976 0x20DA8ACD 0x222E2D17 0x46ABA135 0x4A775762 0x19FE520C +0x3D3B0DD5 0x50BEF346 0x06E1FF6F 0x16667E34 0x3B91051E 0x402286B7 0x5D259158 0x4A08B5FF 0x625E54B9 0x7FA326A4 0x4E8F3822 0x1CD1B75B +0x2148C02D 0x1F809410 0x092BAE50 0x34D84A83 0x30C357E6 0x14F3F70A 0x2B231E9E 0x2F508B18 0x506297D1 0x512AC074 0x56979E5A 0x7128A58E +0x418C09AD 0x2AC297D0 0x1203305C 0x63BA36C4 0x716E3905 0x5C7A87BE 0x7DB888D0 0x2EA946DB 0x2D397B05 0x049A883F 0x450FC50F 0x68CA8023 +0x44BD0EF7 0x22355668 0x32D33623 0x271B63B0 0x21D87D0C 0x01626E45 0x43ED1B0B 0x43213D39 0x20E30255 0x4D18C95B 0x77F987BC 0x51A65A3B +0x620CC065 0x231CA65B 0x00F6E553 0x326F5836 0x744766CF 0x578E83AE 0x2397FDC5 0x35D3707C 0x02511B7E 0x359B2E21 0x198DA741 0x73BF5484 +0x1215B5DF 0x17463011 0x22689B5F 0x3F4F30E4 0x1BE0B851 0x6778606E 0x2819B108 0x609DC748 0x09ADB6D6 0x5AECE72B 0x07B92AF8 0x2B8633E2 +0x5C4F5570 0x4BA64603 0x6EA7711B 0x7D3257C6 0x18BF0F5F 0x66A0F8D8 0x4ED8B201 0x7ACBCFC4 0x09BD9F33 0x4FCF9755 0x2D3B27FB 0x7E050602 +0x275E1B03 0x50D325C0 0x33D8767E 0x29AF3681 0x066E53E1 0x4D661DBF 0x1D6E8B05 0x188409C0 0x64AC4DD1 0x3FD72664 0x57D33AA5 0x008D0622 +0x274F86D3 0x7FECEBAD 0x612ACD6A 0x30FD3DA9 0x5AD9D2D8 0x68E3F862 0x5C83718C 0x37292848 0x348A3E65 0x4B2AE2A7 0x345B800E 0x4D494DC4 +0x31CBDB7F 0x03343210 0x48151D89 0x3B897AB2 0x5303C965 0x75504584 0x398E80B4 0x7A61E468 0x46236B44 0x6D66F733 0x24111AE9 0x4C91BF25 +0x3ACD14F2 0x417FA5EF 0x6515C8E5 0x1F7962C3 0x0156CC53 0x3CE9038A 0x200668E5 0x28A65326 0x3CD5EF37 0x0131364F 0x59A390D0 0x17AFC20F +0x6A152EB1 0x3627025C 0x4ED8EA58 0x1E9F6D17 0x0151E503 0x03346A66 0x6BE8BADB 0x331DC083 0x06689C76 0x33FDD864 0x6EA73B35 0x596C65DB +0x294E1DE8 0x2835BBEA 0x53CE4A43 0x6F71892C 0x159CB31D 0x77DF652D 0x3C034851 0x5069C80F 0x395F0B1C 0x21191137 0x6FE32AD3 0x3AB5D76F +0x5E0214C1 0x0FE993B8 0x635C2A96 0x1AD803F9 0x111ACA08 0x3CFFBB66 0x3287C608 0x7B2FF8B9 0x7326BDC2 0x0160B060 0x19CF65D0 0x7478A2C5 +0x04951AC7 0x05B820AC 0x27966348 0x0AFDB73D 0x39B5F910 0x163D9E7E 0x646A1D19 0x630416F9 0x3E735A68 0x3838675C 0x5275A025 0x54100D85 +0x3017CC89 0x0E78E877 0x2479D594 0x6976D7A5 0x2F91F9AE 0x145D0067 0x242CAF15 0x0D940E6F 0x24469420 0x0788D9AB 0x286C1268 0x35615E28 +0x44889511 0x5AF3D871 0x309156E1 0x37AF52D3 0x5C5488D1 0x4A60BCB2 0x2C27F598 0x60E9A398 0x5018DD5E 0x53BE58E1 0x6BE75AD6 0x09CED66E +0x69FBF75F 0x505177EF 0x6CD2ED67 0x286F51C7 0x0889DF4B 0x3F488D8D 0x7C7F5F4C 0x38A1ABD5 0x4DC17604 0x20F934E0 0x2218837A 0x7D536FB2 +0x35563548 0x4645328F 0x0AE77E21 0x599CC968 0x4DCE0C3A 0x3353908A 0x0EFE2790 0x1256A14B 0x0E4768FB 0x3F8F7E71 0x4A05F41E 0x6A9BF1CC +0x09F03B23 0x762DE9B7 0x4B859565 0x5A091881 0x49EC4298 0x376CF03B 0x63D7EEF0 0x33E839F7 0x07BE682A 0x50AADC57 0x5C578BBE 0x10484775 +0x0FF369E4 0x58D6EB0A 0x48E9F34A 0x5DB4DFE8 0x79D01FEA 0x6B0276C5 0x5B084F9A 0x2F265532 0x3147A954 0x65EFCDBC 0x08C31E9A 0x7F15B58F +0x19435E46 0x17C1462A 0x116C56DA 0x278AC741 0x5750C49C 0x5B724AF9 0x1226B90D 0x6140FFBF 0x51A034B0 0x5DAC4E72 0x3B4A1841 0x1B8C7748 +0x15193EAD 0x1F220731 0x4F74B13F 0x1CD7A6D7 0x6FCCE388 0x2BCC3CFD 0x2D1FEE4D 0x7FC04D6D 0x04A32807 0x7609E197 0x5D752D55 0x7E7347F1 +0x610C585C 0x387D7CF0 0x2D999D24 0x125401B1 0x1E6D4AAC 0x365CBBBE 0x1169B740 0x37B0A8F2 0x4E1E01E9 0x22D60E1A 0x5F3B7033 0x256EC685 +0x7E485913 0x71622940 0x06AFC644 0x4FE88DC3 0x4F0E77B3 0x41F9DE85 0x6B75050B 0x6427B660 0x611BE5B6 0x3AE9B64A 0x00FF5D38 0x50E8C93F +0x66B5F347 0x2E1F4B85 0x50A916AC 0x6B591B4E 0x24292D1C 0x2E1E4401 0x69CC6340 0x05358579 0x669BC0F1 0x17660064 0x1789872A 0x05090B9D +0x4DC2BC22 0x28F33E6A 0x3CB9B48F 0x1BE0BE0B 0x4BC94C84 0x1BF524C2 0x414F8490 0x4A11A598 0x0D574E03 0x47FF4AD5 0x19FA335B 0x5C65C5B6 +0x09F9295A 0x056F3867 0x408D7C16 0x6B150F11 0x4058EEB1 0x418CD94E 0x3BFDD850 0x270EE1F9 0x6FAC24D3 0x0CA6EEFC 0x1267FD47 0x13D551F0 +0x3AC532FD 0x7C346087 0x190AD769 0x2160F3EF 0x139A60EB 0x30945E93 0x2669FF8C 0x615D1D0E 0x59879CFD 0x6323B41C 0x7D3DDB19 0x2550E981 +0x7F18D8DE 0x3E8D5FAA 0x6F628F19 0x0C7026E1 0x068CAA7F 0x095CC275 0x68D5EC97 0x1085D3D9 0x0ECBFADC 0x296368AE 0x7B9AE2EA 0x4F24E98D +0x6AF041FC 0x3798BB3A 0x7633CB86 0x5A9C66D0 0x443FAA36 0x089BC8CE 0x6E71B8C0 0x7F04DD34 0x04D02955 0x077C9029 0x2065D123 0x186A8A41 +0x3810EEBC 0x46CFD0AF 0x79C7A74F 0x11988BB9 0x29F384CB 0x77058268 0x36E9753A 0x290C5DAA 0x3592E212 0x264C0454 0x357C848B 0x3C1F8C91 diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_comp.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_comp.amber new file mode 100644 index 0000000..c54c5e1 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_comp.amber @@ -0,0 +1,195 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A compute shader test for ModfStruct. + +# SHADER compute comp_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296 / 1; +# const uint half_ndp = ndp / 2; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uint in_values[half_ndp]; +# }; +# +# layout(set = 0, binding = 1) buffer block1 { +# float modf_out[ndp]; +# }; +# +# layout(set = 0, binding = 2) buffer block2 { +# float modfStruct_out[ndp]; +# }; +# +# struct modfStructType +# { +# float x; +# float i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (float orig) +# { +# float x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# for (uint ndx = 0; ndx < ndp; ndx += 2) +# { +# uint in_uint = in_values[ndx/2]; +# float in_float = uintBitsToFloat(in_uint); +# modf_out[ndx+1] = modf(in_float, modf_out[ndx]); +# modfStructType res = modfStruct(in_float); +# modfStruct_out[ndx] = res.i; +# modfStruct_out[ndx+1] = res.x; +# } +# +# return; +# } +# END + +SHADER compute comp_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %_arr_uint_uint_648 ArrayStride 4 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_float_uint_1296 ArrayStride 4 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_arr_float_uint_1296_0 ArrayStride 4 + OpMemberDecorate %block2 0 Offset 0 + OpDecorate %block2 BufferBlock + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%modfStructType = OpTypeStruct %float %float + %9 = OpTypeFunction %modfStructType %_ptr_Function_float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %uint_1296 = OpConstant %uint 1296 + %bool = OpTypeBool + %uint_648 = OpConstant %uint 648 +%_arr_uint_uint_648 = OpTypeArray %uint %uint_648 + %block0 = OpTypeStruct %_arr_uint_uint_648 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_arr_float_uint_1296 = OpTypeArray %float %uint_1296 + %block1 = OpTypeStruct %_arr_float_uint_1296 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_arr_float_uint_1296_0 = OpTypeArray %float %uint_1296 + %block2 = OpTypeStruct %_arr_float_uint_1296_0 +%_ptr_Uniform_block2 = OpTypePointer Uniform %block2 + %__1 = OpVariable %_ptr_Uniform_block2 Uniform + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_uint Function + %in_float = OpVariable %_ptr_Function_float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + OpStore %ndx %uint_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %uint %ndx + %37 = OpULessThan %bool %34 %uint_1296 + OpBranchConditional %37 %30 %31 + %30 = OpLabel + %46 = OpLoad %uint %ndx + %48 = OpUDiv %uint %46 %uint_2 + %50 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %48 + %51 = OpLoad %uint %50 + OpStore %in_uint %51 + %53 = OpLoad %uint %in_uint + %54 = OpBitcast %float %53 + OpStore %in_float %54 + %59 = OpLoad %uint %ndx + %61 = OpIAdd %uint %59 %uint_1 + %62 = OpLoad %float %in_float + %63 = OpLoad %uint %ndx + %65 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %63 + %66 = OpExtInst %float %1 Modf %62 %65 + %67 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %61 + OpStore %67 %66 + %70 = OpLoad %float %in_float + %71 = OpExtInst %modfStructType %1 ModfStruct %70 + OpStore %res_0 %71 + %76 = OpLoad %uint %ndx + %78 = OpAccessChain %_ptr_Function_float %res_0 %int_1 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %__1 %int_0 %76 + OpStore %80 %79 + %81 = OpLoad %uint %ndx + %82 = OpIAdd %uint %81 %uint_1 + %83 = OpAccessChain %_ptr_Function_float %res_0 %int_0 + %84 = OpLoad %float %83 + %85 = OpAccessChain %_ptr_Uniform_float %__1 %int_0 %82 + OpStore %85 %84 + OpBranch %32 + %32 = OpLabel + %86 = OpLoad %uint %ndx + %87 = OpIAdd %uint %86 %uint_2 + OpStore %ndx %87 + OpBranch %29 + %31 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt + +BUFFER buf_modf DATA_TYPE float SIZE 1296 FILL 0.0 +BUFFER buf_modfStruct DATA_TYPE float SIZE 1296 FILL 1.0 + +PIPELINE compute test_pipeline + ATTACH comp_shader + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER buf_modf AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER buf_modfStruct AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN test_pipeline 1 1 1 + +EXPECT buf_modf EQ_BUFFER buf_modfStruct diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_frag.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_frag.amber new file mode 100644 index 0000000..c868b02 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_frag.amber @@ -0,0 +1,278 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A fragment shader test for ModfStruct. + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uint in_values[ndp]; +# }; +# +# layout (location = 0) flat in uint ndx_in; +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# struct modfStructType +# { +# float x; +# float i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (float orig) +# { +# float x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# uint in_uint = in_values[ndx_in]; +# float in_float = uintBitsToFloat(in_uint); +# float x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.r = x; +# modf_i_out.r = i; +# modfStruct_x_out.r = res.x; +# modfStruct_i_out.r = res.i; +# +# return; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out + OpExecutionMode %main OriginUpperLeft + OpDecorate %_arr_uint_uint_1296 ArrayStride 4 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%modfStructType = OpTypeStruct %float %float + %9 = OpTypeFunction %modfStructType %_ptr_Function_float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1296 = OpConstant %uint 1296 +%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296 + %block0 = OpTypeStruct %_arr_uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %ndx_in = OpVariable %_ptr_Input_uint Input +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %57 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_uint Function + %in_float = OpVariable %_ptr_Function_float Function + %x_0 = OpVariable %_ptr_Function_float Function + %i_0 = OpVariable %_ptr_Function_float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %37 = OpLoad %uint %ndx_in + %39 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %37 + %40 = OpLoad %uint %39 + OpStore %in_uint %40 + %42 = OpLoad %uint %in_uint + %43 = OpBitcast %float %42 + OpStore %in_float %43 + %45 = OpLoad %float %in_float + %47 = OpExtInst %float %1 Modf %45 %i_0 + OpStore %x_0 %47 + %50 = OpLoad %float %in_float + %51 = OpExtInst %modfStructType %1 ModfStruct %50 + OpStore %res_0 %51 + OpStore %modf_x_out %57 + OpStore %modf_i_out %57 + OpStore %modfStruct_x_out %57 + OpStore %modfStruct_i_out %57 + %61 = OpLoad %float %x_0 + %64 = OpAccessChain %_ptr_Output_float %modf_x_out %uint_0 + OpStore %64 %61 + %65 = OpLoad %float %i_0 + %66 = OpAccessChain %_ptr_Output_float %modf_i_out %uint_0 + OpStore %66 %65 + %67 = OpAccessChain %_ptr_Function_float %res_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Output_float %modfStruct_x_out %uint_0 + OpStore %69 %68 + %71 = OpAccessChain %_ptr_Function_float %res_0 %int_1 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Output_float %modfStruct_i_out %uint_0 + OpStore %73 %72 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_geom.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_geom.amber new file mode 100644 index 0000000..6d53085 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_geom.amber @@ -0,0 +1,421 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A geometry shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE geometryShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER geometry geom_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uint in_values[ndp]; +# }; +# +# layout (triangles) in; +# layout (triangle_strip, max_vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out float modf_x_out; +# layout (location = 1) flat out float modf_i_out; +# layout (location = 2) flat out float modfStruct_x_out; +# layout (location = 3) flat out float modfStruct_i_out; +# +# struct modfStructType +# { +# float x; +# float i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (float orig) +# { +# float x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# for (int vertex = 0; vertex < 3; vertex++) +# { +# uint in_uint = in_values[ndx_in[vertex]]; +# float in_float = uintBitsToFloat(in_uint); +# float x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = x; +# modf_i_out = i; +# modfStruct_x_out = res.x; +# modfStruct_i_out = res.i; +# +# gl_Position = gl_in[vertex].gl_Position; +# EmitVertex(); +# } +# +# EndPrimitive(); +# } +# END + +SHADER geometry geom_shader SPIRV-ASM + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0 %gl_in + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_uint_uint_1296 ArrayStride 4 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%modfStructType = OpTypeStruct %float %float + %9 = OpTypeFunction %modfStructType %_ptr_Function_float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1296 = OpConstant %uint 1296 +%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296 + %block0 = OpTypeStruct %_arr_uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %uint_3 = OpConstant %uint 3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Output_float = OpTypePointer Output %float + %modf_x_out = OpVariable %_ptr_Output_float Output + %modf_i_out = OpVariable %_ptr_Output_float Output +%modfStruct_x_out = OpVariable %_ptr_Output_float Output +%modfStruct_i_out = OpVariable %_ptr_Output_float Output + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3 +%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %vertex = OpVariable %_ptr_Function_int Function + %in_uint = OpVariable %_ptr_Function_uint Function + %in_float = OpVariable %_ptr_Function_float Function + %x_0 = OpVariable %_ptr_Function_float Function + %i_0 = OpVariable %_ptr_Function_float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + OpStore %vertex %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %vertex + %37 = OpSLessThan %bool %34 %int_3 + OpBranchConditional %37 %30 %31 + %30 = OpLabel + %50 = OpLoad %int %vertex + %52 = OpAccessChain %_ptr_Input_uint %ndx_in %50 + %53 = OpLoad %uint %52 + %55 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %53 + %56 = OpLoad %uint %55 + OpStore %in_uint %56 + %58 = OpLoad %uint %in_uint + %59 = OpBitcast %float %58 + OpStore %in_float %59 + %61 = OpLoad %float %in_float + %63 = OpExtInst %float %1 Modf %61 %i_0 + OpStore %x_0 %63 + %66 = OpLoad %float %in_float + %67 = OpExtInst %modfStructType %1 ModfStruct %66 + OpStore %res_0 %67 + %70 = OpLoad %float %x_0 + OpStore %modf_x_out %70 + %72 = OpLoad %float %i_0 + OpStore %modf_i_out %72 + %74 = OpAccessChain %_ptr_Function_float %res_0 %int_0 + %75 = OpLoad %float %74 + OpStore %modfStruct_x_out %75 + %78 = OpAccessChain %_ptr_Function_float %res_0 %int_1 + %79 = OpLoad %float %78 + OpStore %modfStruct_i_out %79 + %90 = OpLoad %int %vertex + %92 = OpAccessChain %_ptr_Input_v4float %gl_in %90 %int_0 + %93 = OpLoad %v4float %92 + %95 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %95 %93 + OpEmitVertex + OpBranch %32 + %32 = OpLabel + %96 = OpLoad %int %vertex + %97 = OpIAdd %int %96 %int_1 + OpStore %vertex %97 + OpBranch %29 + %31 = OpLabel + OpEndPrimitive + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in float modf_x_in; +# layout (location = 1) flat in float modf_i_in; +# layout (location = 2) flat in float modfStruct_x_in; +# layout (location = 3) flat in float modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.r = modf_x_in; +# modf_i_out.r = modf_i_in; +# modfStruct_x_out.r = modfStruct_x_in; +# modfStruct_i_out.r = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_float = OpTypePointer Input %float + %modf_x_in = OpVariable %_ptr_Input_float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float + %modf_i_in = OpVariable %_ptr_Input_float Input +%modfStruct_x_in = OpVariable %_ptr_Input_float Input +%modfStruct_i_in = OpVariable %_ptr_Input_float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %modf_x_out %12 + OpStore %modf_i_out %12 + OpStore %modfStruct_x_out %12 + OpStore %modfStruct_i_out %12 + %18 = OpLoad %float %modf_x_in + %22 = OpAccessChain %_ptr_Output_float %modf_x_out %uint_0 + OpStore %22 %18 + %24 = OpLoad %float %modf_i_in + %25 = OpAccessChain %_ptr_Output_float %modf_i_out %uint_0 + OpStore %25 %24 + %27 = OpLoad %float %modfStruct_x_in + %28 = OpAccessChain %_ptr_Output_float %modfStruct_x_out %uint_0 + OpStore %28 %27 + %30 = OpLoad %float %modfStruct_i_in + %31 = OpAccessChain %_ptr_Output_float %modfStruct_i_out %uint_0 + OpStore %31 %30 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH geom_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_tesc.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_tesc.amber new file mode 100644 index 0000000..8f7eb4e --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_tesc.amber @@ -0,0 +1,576 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation control shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out float modf_x_out[]; +# layout (location = 1) flat out float modf_i_out[]; +# layout (location = 2) flat out float modfStruct_x_out[]; +# layout (location = 3) flat out float modfStruct_i_out[]; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uint in_values[ndp]; +# }; +# +# struct modfStructType +# { +# float x; +# float i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (float orig) +# { +# float x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# uint in_uint = in_values[ndx_in[gl_InvocationID]]; +# float in_float = uintBitsToFloat(in_uint); +# float x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out[gl_InvocationID] = x; +# modf_i_out[gl_InvocationID] = i; +# modfStruct_x_out[gl_InvocationID] = res.x; +# modfStruct_i_out[gl_InvocationID] = res.i; +# +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_uint_uint_1296 ArrayStride 4 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%modfStructType = OpTypeStruct %float %float + %9 = OpTypeFunction %modfStructType %_ptr_Function_float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1296 = OpConstant %uint 1296 +%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296 + %block0 = OpTypeStruct %_arr_uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_32 = OpConstant %uint 32 +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Output__arr_float_uint_3 = OpTypePointer Output %_arr_float_uint_3 + %modf_x_out = OpVariable %_ptr_Output__arr_float_uint_3 Output +%_ptr_Output_float = OpTypePointer Output %float + %modf_i_out = OpVariable %_ptr_Output__arr_float_uint_3 Output +%modfStruct_x_out = OpVariable %_ptr_Output__arr_float_uint_3 Output +%modfStruct_i_out = OpVariable %_ptr_Output__arr_float_uint_3 Output + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %float_1 = OpConstant %float 1 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_uint Function + %in_float = OpVariable %_ptr_Function_float Function + %x_0 = OpVariable %_ptr_Function_float Function + %i_0 = OpVariable %_ptr_Function_float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %41 = OpLoad %int %gl_InvocationID + %43 = OpAccessChain %_ptr_Input_uint %ndx_in %41 + %44 = OpLoad %uint %43 + %46 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %44 + %47 = OpLoad %uint %46 + OpStore %in_uint %47 + %49 = OpLoad %uint %in_uint + %50 = OpBitcast %float %49 + OpStore %in_float %50 + %52 = OpLoad %float %in_float + %54 = OpExtInst %float %1 Modf %52 %i_0 + OpStore %x_0 %54 + %57 = OpLoad %float %in_float + %58 = OpExtInst %modfStructType %1 ModfStruct %57 + OpStore %res_0 %58 + %63 = OpLoad %int %gl_InvocationID + %64 = OpLoad %float %x_0 + %66 = OpAccessChain %_ptr_Output_float %modf_x_out %63 + OpStore %66 %64 + %68 = OpLoad %int %gl_InvocationID + %69 = OpLoad %float %i_0 + %70 = OpAccessChain %_ptr_Output_float %modf_i_out %68 + OpStore %70 %69 + %72 = OpLoad %int %gl_InvocationID + %73 = OpAccessChain %_ptr_Function_float %res_0 %int_0 + %74 = OpLoad %float %73 + %75 = OpAccessChain %_ptr_Output_float %modfStruct_x_out %72 + OpStore %75 %74 + %77 = OpLoad %int %gl_InvocationID + %79 = OpAccessChain %_ptr_Function_float %res_0 %int_1 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Output_float %modfStruct_i_out %77 + OpStore %81 %80 + %87 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %87 %float_1 + %88 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %88 %float_1 + %93 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %93 %float_1 + %94 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %94 %float_1 + %96 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %96 %float_1 + %98 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %98 %float_1 + %106 = OpLoad %int %gl_InvocationID + %111 = OpLoad %int %gl_InvocationID + %113 = OpAccessChain %_ptr_Input_v4float %gl_in %111 %int_0 + %114 = OpLoad %v4float %113 + %116 = OpAccessChain %_ptr_Output_v4float %gl_out %106 %int_0 + OpStore %116 %114 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# layout (triangles) in; +# +# layout (location = 0) flat in float modf_x_in[]; +# layout (location = 1) flat in float modf_i_in[]; +# layout (location = 2) flat in float modfStruct_x_in[]; +# layout (location = 3) flat in float modfStruct_i_in[]; +# +# layout (location = 0) flat out float modf_x_out; +# layout (location = 1) flat out float modf_i_out; +# layout (location = 2) flat out float modfStruct_x_out; +# layout (location = 3) flat out float modfStruct_i_out; +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# modf_x_out = modf_x_in[0]; +# modf_i_out = modf_i_in[0]; +# modfStruct_x_out = modfStruct_x_in[0]; +# modfStruct_i_out = modfStruct_i_in[0]; +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output_float = OpTypePointer Output %float + %modf_x_out = OpVariable %_ptr_Output_float Output +%_arr_float_uint_32 = OpTypeArray %float %uint_32 +%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32 + %modf_x_in = OpVariable %_ptr_Input__arr_float_uint_32 Input + %modf_i_out = OpVariable %_ptr_Output_float Output + %modf_i_in = OpVariable %_ptr_Input__arr_float_uint_32 Input +%modfStruct_x_out = OpVariable %_ptr_Output_float Output +%modfStruct_x_in = OpVariable %_ptr_Input__arr_float_uint_32 Input +%modfStruct_i_out = OpVariable %_ptr_Output_float Output +%modfStruct_i_in = OpVariable %_ptr_Input__arr_float_uint_32 Input + %main = OpFunction %void None %3 + %5 = OpLabel + %21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %22 = OpLoad %float %21 + %29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %30 = OpLoad %v4float %29 + %31 = OpVectorTimesScalar %v4float %30 %22 + %32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %36 = OpLoad %v4float %35 + %37 = OpVectorTimesScalar %v4float %36 %33 + %38 = OpFAdd %v4float %31 %37 + %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %44 = OpLoad %v4float %43 + %45 = OpVectorTimesScalar %v4float %44 %41 + %46 = OpFAdd %v4float %38 %45 + %48 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %48 %46 + %54 = OpAccessChain %_ptr_Input_float %modf_x_in %int_0 + %55 = OpLoad %float %54 + OpStore %modf_x_out %55 + %58 = OpAccessChain %_ptr_Input_float %modf_i_in %int_0 + %59 = OpLoad %float %58 + OpStore %modf_i_out %59 + %62 = OpAccessChain %_ptr_Input_float %modfStruct_x_in %int_0 + %63 = OpLoad %float %62 + OpStore %modfStruct_x_out %63 + %66 = OpAccessChain %_ptr_Input_float %modfStruct_i_in %int_0 + %67 = OpLoad %float %66 + OpStore %modfStruct_i_out %67 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in float modf_x_in; +# layout (location = 1) flat in float modf_i_in; +# layout (location = 2) flat in float modfStruct_x_in; +# layout (location = 3) flat in float modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.r = modf_x_in; +# modf_i_out.r = modf_i_in; +# modfStruct_x_out.r = modfStruct_x_in; +# modfStruct_i_out.r = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_float = OpTypePointer Input %float + %modf_x_in = OpVariable %_ptr_Input_float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float + %modf_i_in = OpVariable %_ptr_Input_float Input +%modfStruct_x_in = OpVariable %_ptr_Input_float Input +%modfStruct_i_in = OpVariable %_ptr_Input_float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %modf_x_out %12 + OpStore %modf_i_out %12 + OpStore %modfStruct_x_out %12 + OpStore %modfStruct_i_out %12 + %18 = OpLoad %float %modf_x_in + %22 = OpAccessChain %_ptr_Output_float %modf_x_out %uint_0 + OpStore %22 %18 + %24 = OpLoad %float %modf_i_in + %25 = OpAccessChain %_ptr_Output_float %modf_i_out %uint_0 + OpStore %25 %24 + %27 = OpLoad %float %modfStruct_x_in + %28 = OpAccessChain %_ptr_Output_float %modfStruct_x_out %uint_0 + OpStore %28 %27 + %30 = OpLoad %float %modfStruct_i_in + %31 = OpAccessChain %_ptr_Output_float %modfStruct_i_out %uint_0 + OpStore %31 %30 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_tese.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_tese.amber new file mode 100644 index 0000000..b603d28 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_tese.amber @@ -0,0 +1,532 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation evaluation shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out uint ndx_out[]; +# +# void main () +# { +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID]; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3 + %ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output_uint = OpTypePointer Output %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %16 %float_1 + %18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %18 %float_1 + %23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %23 %float_1 + %24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %24 %float_1 + %26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %26 %float_1 + %28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %28 %float_1 + %39 = OpLoad %int %gl_InvocationID + %47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0 + %48 = OpLoad %v4float %47 + %50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0 + OpStore %50 %48 + %60 = OpAccessChain %_ptr_Input_uint %ndx_in %39 + %61 = OpLoad %uint %60 + %63 = OpAccessChain %_ptr_Output_uint %ndx_out %39 + OpStore %63 %61 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (triangles) in; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out float modf_x_out; +# layout (location = 1) flat out float modf_i_out; +# layout (location = 2) flat out float modfStruct_x_out; +# layout (location = 3) flat out float modfStruct_i_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uint in_values[ndp]; +# }; +# +# struct modfStructType +# { +# float x; +# float i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (float orig) +# { +# float x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# uint in_uint = in_values[ndx_in[0]]; +# float in_float = uintBitsToFloat(in_uint); +# float x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = x; +# modf_i_out = i; +# modfStruct_x_out = res.x; +# modfStruct_i_out = res.i; +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %_arr_uint_uint_1296 ArrayStride 4 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%modfStructType = OpTypeStruct %float %float + %9 = OpTypeFunction %modfStructType %_ptr_Function_float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1296 = OpConstant %uint 1296 +%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296 + %block0 = OpTypeStruct %_arr_uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %__0 = OpVariable %_ptr_Uniform_block0 Uniform +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Output_float = OpTypePointer Output %float + %modf_x_out = OpVariable %_ptr_Output_float Output + %modf_i_out = OpVariable %_ptr_Output_float Output +%modfStruct_x_out = OpVariable %_ptr_Output_float Output +%modfStruct_i_out = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_uint Function + %in_float = OpVariable %_ptr_Function_float Function + %x_0 = OpVariable %_ptr_Function_float Function + %i_0 = OpVariable %_ptr_Function_float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %39 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %40 = OpLoad %float %39 + %47 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %48 = OpLoad %v4float %47 + %49 = OpVectorTimesScalar %v4float %48 %40 + %50 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %51 = OpLoad %float %50 + %53 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %54 = OpLoad %v4float %53 + %55 = OpVectorTimesScalar %v4float %54 %51 + %56 = OpFAdd %v4float %49 %55 + %58 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %59 = OpLoad %float %58 + %61 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %62 = OpLoad %v4float %61 + %63 = OpVectorTimesScalar %v4float %62 %59 + %64 = OpFAdd %v4float %56 %63 + %66 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %66 %64 + %78 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0 + %79 = OpLoad %uint %78 + %81 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %79 + %82 = OpLoad %uint %81 + OpStore %in_uint %82 + %84 = OpLoad %uint %in_uint + %85 = OpBitcast %float %84 + OpStore %in_float %85 + %87 = OpLoad %float %in_float + %89 = OpExtInst %float %1 Modf %87 %i_0 + OpStore %x_0 %89 + %92 = OpLoad %float %in_float + %93 = OpExtInst %modfStructType %1 ModfStruct %92 + OpStore %res_0 %93 + %96 = OpLoad %float %x_0 + OpStore %modf_x_out %96 + %98 = OpLoad %float %i_0 + OpStore %modf_i_out %98 + %100 = OpAccessChain %_ptr_Function_float %res_0 %int_0 + %101 = OpLoad %float %100 + OpStore %modfStruct_x_out %101 + %103 = OpAccessChain %_ptr_Function_float %res_0 %int_1 + %104 = OpLoad %float %103 + OpStore %modfStruct_i_out %104 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in float modf_x_in; +# layout (location = 1) flat in float modf_i_in; +# layout (location = 2) flat in float modfStruct_x_in; +# layout (location = 3) flat in float modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.r = modf_x_in; +# modf_i_out.r = modf_i_in; +# modfStruct_x_out.r = modfStruct_x_in; +# modfStruct_i_out.r = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_float = OpTypePointer Input %float + %modf_x_in = OpVariable %_ptr_Input_float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float + %modf_i_in = OpVariable %_ptr_Input_float Input +%modfStruct_x_in = OpVariable %_ptr_Input_float Input +%modfStruct_i_in = OpVariable %_ptr_Input_float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %modf_x_out %12 + OpStore %modf_i_out %12 + OpStore %modfStruct_x_out %12 + OpStore %modfStruct_i_out %12 + %18 = OpLoad %float %modf_x_in + %22 = OpAccessChain %_ptr_Output_float %modf_x_out %uint_0 + OpStore %22 %18 + %24 = OpLoad %float %modf_i_in + %25 = OpAccessChain %_ptr_Output_float %modf_i_out %uint_0 + OpStore %25 %24 + %27 = OpLoad %float %modfStruct_x_in + %28 = OpAccessChain %_ptr_Output_float %modfStruct_x_out %uint_0 + OpStore %28 %27 + %30 = OpLoad %float %modfStruct_i_in + %31 = OpAccessChain %_ptr_Output_float %modfStruct_i_out %uint_0 + OpStore %31 %30 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_vert.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_vert.amber new file mode 100644 index 0000000..4a23bcb --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_1_vert.amber @@ -0,0 +1,323 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A vertex shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out float modf_x_out; +# layout (location = 1) flat out float modf_i_out; +# layout (location = 2) flat out float modfStruct_x_out; +# layout (location = 3) flat out float modfStruct_i_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uint in_values[ndp]; +# }; +# +# struct modfStructType +# { +# float x; +# float i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (float orig) +# { +# float x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# uint ndx = xcoord + ycoord * ndpSqrt; +# +# uint in_uint = in_values[ndx]; +# float in_float = uintBitsToFloat(in_uint); +# float x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = x; +# modf_i_out = i; +# modfStruct_x_out = res.x; +# modfStruct_i_out = i; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0 + OpDecorate %position Location 0 + OpDecorate %_arr_uint_uint_1296 ArrayStride 4 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%modfStructType = OpTypeStruct %float %float + %9 = OpTypeFunction %modfStructType %_ptr_Function_float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float_36 = OpConstant %float 36 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0_027777778 = OpConstant %float 0.027777778 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %uint_1 = OpConstant %uint 1 + %uint_36 = OpConstant %uint 36 + %uint_1296 = OpConstant %uint 1296 +%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296 + %block0 = OpTypeStruct %_arr_uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Output_float = OpTypePointer Output %float + %modf_x_out = OpVariable %_ptr_Output_float Output + %modf_i_out = OpVariable %_ptr_Output_float Output +%modfStruct_x_out = OpVariable %_ptr_Output_float Output +%modfStruct_i_out = OpVariable %_ptr_Output_float Output + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %xcoord = OpVariable %_ptr_Function_uint Function + %ycoord = OpVariable %_ptr_Function_uint Function + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_uint Function + %in_float = OpVariable %_ptr_Function_float Function + %x_0 = OpVariable %_ptr_Function_float Function + %i_0 = OpVariable %_ptr_Function_float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %34 = OpAccessChain %_ptr_Input_float %position %uint_0 + %35 = OpLoad %float %34 + %37 = OpFAdd %float %35 %float_0_027777778 + %39 = OpFAdd %float %37 %float_1 + %41 = OpFDiv %float %39 %float_2 + %42 = OpFMul %float %float_36 %41 + %43 = OpFSub %float %42 %float_1 + %44 = OpConvertFToU %uint %43 + OpStore %xcoord %44 + %47 = OpAccessChain %_ptr_Input_float %position %uint_1 + %48 = OpLoad %float %47 + %49 = OpFAdd %float %48 %float_0_027777778 + %50 = OpFAdd %float %49 %float_1 + %51 = OpFDiv %float %50 %float_2 + %52 = OpFMul %float %float_36 %51 + %53 = OpFSub %float %52 %float_1 + %54 = OpConvertFToU %uint %53 + OpStore %ycoord %54 + %56 = OpLoad %uint %xcoord + %57 = OpLoad %uint %ycoord + %59 = OpIMul %uint %57 %uint_36 + %60 = OpIAdd %uint %56 %59 + OpStore %ndx %60 + %69 = OpLoad %uint %ndx + %71 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %69 + %72 = OpLoad %uint %71 + OpStore %in_uint %72 + %74 = OpLoad %uint %in_uint + %75 = OpBitcast %float %74 + OpStore %in_float %75 + %77 = OpLoad %float %in_float + %79 = OpExtInst %float %1 Modf %77 %i_0 + OpStore %x_0 %79 + %82 = OpLoad %float %in_float + %83 = OpExtInst %modfStructType %1 ModfStruct %82 + OpStore %res_0 %83 + %86 = OpLoad %float %x_0 + OpStore %modf_x_out %86 + %88 = OpLoad %float %i_0 + OpStore %modf_i_out %88 + %90 = OpAccessChain %_ptr_Function_float %res_0 %int_0 + %91 = OpLoad %float %90 + OpStore %modfStruct_x_out %91 + %93 = OpLoad %float %i_0 + OpStore %modfStruct_i_out %93 + %99 = OpLoad %v2float %position + %101 = OpCompositeExtract %float %99 0 + %102 = OpCompositeExtract %float %99 1 + %103 = OpCompositeConstruct %v4float %101 %102 %float_0 %float_1 + %105 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %105 %103 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in float modf_x_in; +# layout (location = 1) flat in float modf_i_in; +# layout (location = 2) flat in float modfStruct_x_in; +# layout (location = 3) flat in float modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.r = modf_x_in; +# modf_i_out.r = modf_i_in; +# modfStruct_x_out.r = modfStruct_x_in; +# modfStruct_i_out.r = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_float = OpTypePointer Input %float + %modf_x_in = OpVariable %_ptr_Input_float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float + %modf_i_in = OpVariable %_ptr_Input_float Input +%modfStruct_x_in = OpVariable %_ptr_Input_float Input +%modfStruct_i_in = OpVariable %_ptr_Input_float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %modf_x_out %12 + OpStore %modf_i_out %12 + OpStore %modfStruct_x_out %12 + OpStore %modfStruct_i_out %12 + %18 = OpLoad %float %modf_x_in + %22 = OpAccessChain %_ptr_Output_float %modf_x_out %uint_0 + OpStore %22 %18 + %24 = OpLoad %float %modf_i_in + %25 = OpAccessChain %_ptr_Output_float %modf_i_out %uint_0 + OpStore %25 %24 + %27 = OpLoad %float %modfStruct_x_in + %28 = OpAccessChain %_ptr_Output_float %modfStruct_x_out %uint_0 + OpStore %28 %27 + %30 = OpLoad %float %modfStruct_i_in + %31 = OpAccessChain %_ptr_Output_float %modfStruct_i_out %uint_0 + OpStore %31 %30 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_comp.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_comp.amber new file mode 100644 index 0000000..67aaaa2 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_comp.amber @@ -0,0 +1,198 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A compute shader test for ModfStruct. + +# SHADER compute comp_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296 / 2; +# const uint half_ndp = ndp / 2; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec2 in_values[half_ndp]; +# }; +# +# layout(set = 0, binding = 1) buffer block1 { +# vec2 modf_out[ndp]; +# }; +# +# layout(set = 0, binding = 2) buffer block2 { +# vec2 modfStruct_out[ndp]; +# }; +# +# struct modfStructType +# { +# vec2 x; +# vec2 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec2 orig) +# { +# vec2 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# for (uint ndx = 0; ndx < ndp; ndx += 2) +# { +# uvec2 in_uint = in_values[ndx/2]; +# vec2 in_float = uintBitsToFloat(in_uint); +# modf_out[ndx+1] = modf(in_float, modf_out[ndx]); +# modfStructType res = modfStruct(in_float); +# modfStruct_out[ndx] = res.i; +# modfStruct_out[ndx+1] = res.x; +# } +# +# return; +# } +# END + +SHADER compute comp_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %_arr_v2uint_uint_324 ArrayStride 8 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_v2float_uint_648 ArrayStride 8 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_arr_v2float_uint_648_0 ArrayStride 8 + OpMemberDecorate %block2 0 Offset 0 + OpDecorate %block2 BufferBlock + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%modfStructType = OpTypeStruct %v2float %v2float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v2float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %uint_648 = OpConstant %uint 648 + %bool = OpTypeBool + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_324 = OpConstant %uint 324 +%_arr_v2uint_uint_324 = OpTypeArray %v2uint %uint_324 + %block0 = OpTypeStruct %_arr_v2uint_uint_324 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint +%_arr_v2float_uint_648 = OpTypeArray %v2float %uint_648 + %block1 = OpTypeStruct %_arr_v2float_uint_648 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_arr_v2float_uint_648_0 = OpTypeArray %v2float %uint_648 + %block2 = OpTypeStruct %_arr_v2float_uint_648_0 +%_ptr_Uniform_block2 = OpTypePointer Uniform %block2 + %__1 = OpVariable %_ptr_Uniform_block2 Uniform + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_v2uint Function + %in_float = OpVariable %_ptr_Function_v2float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + OpStore %ndx %uint_0 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %uint %ndx + %38 = OpULessThan %bool %35 %uint_648 + OpBranchConditional %38 %31 %32 + %31 = OpLabel + %49 = OpLoad %uint %ndx + %51 = OpUDiv %uint %49 %uint_2 + %53 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %51 + %54 = OpLoad %v2uint %53 + OpStore %in_uint %54 + %56 = OpLoad %v2uint %in_uint + %57 = OpBitcast %v2float %56 + OpStore %in_float %57 + %62 = OpLoad %uint %ndx + %64 = OpIAdd %uint %62 %uint_1 + %65 = OpLoad %v2float %in_float + %66 = OpLoad %uint %ndx + %68 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %66 + %69 = OpExtInst %v2float %1 Modf %65 %68 + %70 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %64 + OpStore %70 %69 + %73 = OpLoad %v2float %in_float + %74 = OpExtInst %modfStructType %1 ModfStruct %73 + OpStore %res_0 %74 + %79 = OpLoad %uint %ndx + %81 = OpAccessChain %_ptr_Function_v2float %res_0 %int_1 + %82 = OpLoad %v2float %81 + %83 = OpAccessChain %_ptr_Uniform_v2float %__1 %int_0 %79 + OpStore %83 %82 + %84 = OpLoad %uint %ndx + %85 = OpIAdd %uint %84 %uint_1 + %86 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0 + %87 = OpLoad %v2float %86 + %88 = OpAccessChain %_ptr_Uniform_v2float %__1 %int_0 %85 + OpStore %88 %87 + OpBranch %33 + %33 = OpLabel + %89 = OpLoad %uint %ndx + %90 = OpIAdd %uint %89 %uint_2 + OpStore %ndx %90 + OpBranch %30 + %32 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt + +BUFFER buf_modf DATA_TYPE vec2 SIZE 648 FILL 0.0 +BUFFER buf_modfStruct DATA_TYPE vec2 SIZE 648 FILL 1.0 + +PIPELINE compute test_pipeline + ATTACH comp_shader + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER buf_modf AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER buf_modfStruct AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN test_pipeline 1 1 1 + +EXPECT buf_modf EQ_BUFFER buf_modfStruct diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_frag.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_frag.amber new file mode 100644 index 0000000..0f34df9 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_frag.amber @@ -0,0 +1,282 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A fragment shader test for ModfStruct. + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec2 in_values[ndp]; +# }; +# +# layout (location = 0) flat in uint ndx_in; +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# struct modfStructType +# { +# vec2 x; +# vec2 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec2 orig) +# { +# vec2 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# uvec2 in_uint = in_values[ndx_in]; +# vec2 in_float = uintBitsToFloat(in_uint); +# vec2 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.rg = x; +# modf_i_out.rg = i; +# modfStruct_x_out.rg = res.x; +# modfStruct_i_out.rg = res.i; +# +# return; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out + OpExecutionMode %main OriginUpperLeft + OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%modfStructType = OpTypeStruct %v2float %v2float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v2float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296 + %block0 = OpTypeStruct %_arr_v2uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %ndx_in = OpVariable %_ptr_Input_uint Input +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %59 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v2uint Function + %in_float = OpVariable %_ptr_Function_v2float Function + %x_0 = OpVariable %_ptr_Function_v2float Function + %i_0 = OpVariable %_ptr_Function_v2float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %39 = OpLoad %uint %ndx_in + %41 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %39 + %42 = OpLoad %v2uint %41 + OpStore %in_uint %42 + %44 = OpLoad %v2uint %in_uint + %45 = OpBitcast %v2float %44 + OpStore %in_float %45 + %47 = OpLoad %v2float %in_float + %49 = OpExtInst %v2float %1 Modf %47 %i_0 + OpStore %x_0 %49 + %52 = OpLoad %v2float %in_float + %53 = OpExtInst %modfStructType %1 ModfStruct %52 + OpStore %res_0 %53 + OpStore %modf_x_out %59 + OpStore %modf_i_out %59 + OpStore %modfStruct_x_out %59 + OpStore %modfStruct_i_out %59 + %63 = OpLoad %v2float %x_0 + %64 = OpLoad %v4float %modf_x_out + %65 = OpVectorShuffle %v4float %64 %63 4 5 2 3 + OpStore %modf_x_out %65 + %66 = OpLoad %v2float %i_0 + %67 = OpLoad %v4float %modf_i_out + %68 = OpVectorShuffle %v4float %67 %66 4 5 2 3 + OpStore %modf_i_out %68 + %69 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0 + %70 = OpLoad %v2float %69 + %71 = OpLoad %v4float %modfStruct_x_out + %72 = OpVectorShuffle %v4float %71 %70 4 5 2 3 + OpStore %modfStruct_x_out %72 + %74 = OpAccessChain %_ptr_Function_v2float %res_0 %int_1 + %75 = OpLoad %v2float %74 + %76 = OpLoad %v4float %modfStruct_i_out + %77 = OpVectorShuffle %v4float %76 %75 4 5 2 3 + OpStore %modfStruct_i_out %77 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_geom.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_geom.amber new file mode 100644 index 0000000..1b28aa4 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_geom.amber @@ -0,0 +1,425 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A geometry shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE geometryShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER geometry geom_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec2 in_values[ndp]; +# }; +# +# layout (triangles) in; +# layout (triangle_strip, max_vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec2 modf_x_out; +# layout (location = 1) flat out vec2 modf_i_out; +# layout (location = 2) flat out vec2 modfStruct_x_out; +# layout (location = 3) flat out vec2 modfStruct_i_out; +# +# struct modfStructType +# { +# vec2 x; +# vec2 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec2 orig) +# { +# vec2 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# for (int vertex = 0; vertex < 3; vertex++) +# { +# uvec2 in_uint = in_values[ndx_in[vertex]]; +# vec2 in_float = uintBitsToFloat(in_uint); +# vec2 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = x; +# modf_i_out = i; +# modfStruct_x_out = res.x; +# modfStruct_i_out = res.i; +# +# gl_Position = gl_in[vertex].gl_Position; +# EmitVertex(); +# } +# +# EndPrimitive(); +# } +# END + +SHADER geometry geom_shader SPIRV-ASM + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0 %gl_in + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%modfStructType = OpTypeStruct %v2float %v2float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v2float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296 + %block0 = OpTypeStruct %_arr_v2uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %uint_3 = OpConstant %uint 3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint +%_ptr_Output_v2float = OpTypePointer Output %v2float + %modf_x_out = OpVariable %_ptr_Output_v2float Output + %modf_i_out = OpVariable %_ptr_Output_v2float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v2float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v2float Output + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3 +%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %vertex = OpVariable %_ptr_Function_int Function + %in_uint = OpVariable %_ptr_Function_v2uint Function + %in_float = OpVariable %_ptr_Function_v2float Function + %x_0 = OpVariable %_ptr_Function_v2float Function + %i_0 = OpVariable %_ptr_Function_v2float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + OpStore %vertex %int_0 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %int %vertex + %38 = OpSLessThan %bool %35 %int_3 + OpBranchConditional %38 %31 %32 + %31 = OpLabel + %52 = OpLoad %int %vertex + %54 = OpAccessChain %_ptr_Input_uint %ndx_in %52 + %55 = OpLoad %uint %54 + %57 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %55 + %58 = OpLoad %v2uint %57 + OpStore %in_uint %58 + %60 = OpLoad %v2uint %in_uint + %61 = OpBitcast %v2float %60 + OpStore %in_float %61 + %63 = OpLoad %v2float %in_float + %65 = OpExtInst %v2float %1 Modf %63 %i_0 + OpStore %x_0 %65 + %68 = OpLoad %v2float %in_float + %69 = OpExtInst %modfStructType %1 ModfStruct %68 + OpStore %res_0 %69 + %72 = OpLoad %v2float %x_0 + OpStore %modf_x_out %72 + %74 = OpLoad %v2float %i_0 + OpStore %modf_i_out %74 + %76 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0 + %77 = OpLoad %v2float %76 + OpStore %modfStruct_x_out %77 + %80 = OpAccessChain %_ptr_Function_v2float %res_0 %int_1 + %81 = OpLoad %v2float %80 + OpStore %modfStruct_i_out %81 + %92 = OpLoad %int %vertex + %94 = OpAccessChain %_ptr_Input_v4float %gl_in %92 %int_0 + %95 = OpLoad %v4float %94 + %97 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %97 %95 + OpEmitVertex + OpBranch %33 + %33 = OpLabel + %98 = OpLoad %int %vertex + %99 = OpIAdd %int %98 %int_1 + OpStore %vertex %99 + OpBranch %30 + %32 = OpLabel + OpEndPrimitive + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec2 modf_x_in; +# layout (location = 1) flat in vec2 modf_i_in; +# layout (location = 2) flat in vec2 modfStruct_x_in; +# layout (location = 3) flat in vec2 modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.rg = modf_x_in; +# modf_i_out.rg = modf_i_in; +# modfStruct_x_out.rg = modfStruct_x_in; +# modfStruct_i_out.rg = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %modf_x_in = OpVariable %_ptr_Input_v2float Input + %modf_i_in = OpVariable %_ptr_Input_v2float Input +%modfStruct_x_in = OpVariable %_ptr_Input_v2float Input +%modfStruct_i_in = OpVariable %_ptr_Input_v2float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %modf_x_out %12 + OpStore %modf_i_out %12 + OpStore %modfStruct_x_out %12 + OpStore %modfStruct_i_out %12 + %19 = OpLoad %v2float %modf_x_in + %20 = OpLoad %v4float %modf_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 2 3 + OpStore %modf_x_out %21 + %23 = OpLoad %v2float %modf_i_in + %24 = OpLoad %v4float %modf_i_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 2 3 + OpStore %modf_i_out %25 + %27 = OpLoad %v2float %modfStruct_x_in + %28 = OpLoad %v4float %modfStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 2 3 + OpStore %modfStruct_x_out %29 + %31 = OpLoad %v2float %modfStruct_i_in + %32 = OpLoad %v4float %modfStruct_i_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 2 3 + OpStore %modfStruct_i_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH geom_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_tesc.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_tesc.amber new file mode 100644 index 0000000..efe95ed --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_tesc.amber @@ -0,0 +1,583 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation control shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec2 modf_x_out[]; +# layout (location = 1) flat out vec2 modf_i_out[]; +# layout (location = 2) flat out vec2 modfStruct_x_out[]; +# layout (location = 3) flat out vec2 modfStruct_i_out[]; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec2 in_values[ndp]; +# }; +# +# struct modfStructType +# { +# vec2 x; +# vec2 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec2 orig) +# { +# vec2 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# uvec2 in_uint = in_values[ndx_in[gl_InvocationID]]; +# vec2 in_float = uintBitsToFloat(in_uint); +# vec2 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out[gl_InvocationID] = x; +# modf_i_out[gl_InvocationID] = i; +# modfStruct_x_out[gl_InvocationID] = res.x; +# modfStruct_i_out[gl_InvocationID] = res.i; +# +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%modfStructType = OpTypeStruct %v2float %v2float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v2float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296 + %block0 = OpTypeStruct %_arr_v2uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_32 = OpConstant %uint 32 +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint + %uint_3 = OpConstant %uint 3 +%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 +%_ptr_Output__arr_v2float_uint_3 = OpTypePointer Output %_arr_v2float_uint_3 + %modf_x_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output +%_ptr_Output_v2float = OpTypePointer Output %v2float + %modf_i_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output +%modfStruct_x_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output +%modfStruct_i_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v2uint Function + %in_float = OpVariable %_ptr_Function_v2float Function + %x_0 = OpVariable %_ptr_Function_v2float Function + %i_0 = OpVariable %_ptr_Function_v2float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %43 = OpLoad %int %gl_InvocationID + %45 = OpAccessChain %_ptr_Input_uint %ndx_in %43 + %46 = OpLoad %uint %45 + %48 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %46 + %49 = OpLoad %v2uint %48 + OpStore %in_uint %49 + %51 = OpLoad %v2uint %in_uint + %52 = OpBitcast %v2float %51 + OpStore %in_float %52 + %54 = OpLoad %v2float %in_float + %56 = OpExtInst %v2float %1 Modf %54 %i_0 + OpStore %x_0 %56 + %59 = OpLoad %v2float %in_float + %60 = OpExtInst %modfStructType %1 ModfStruct %59 + OpStore %res_0 %60 + %65 = OpLoad %int %gl_InvocationID + %66 = OpLoad %v2float %x_0 + %68 = OpAccessChain %_ptr_Output_v2float %modf_x_out %65 + OpStore %68 %66 + %70 = OpLoad %int %gl_InvocationID + %71 = OpLoad %v2float %i_0 + %72 = OpAccessChain %_ptr_Output_v2float %modf_i_out %70 + OpStore %72 %71 + %74 = OpLoad %int %gl_InvocationID + %75 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0 + %76 = OpLoad %v2float %75 + %77 = OpAccessChain %_ptr_Output_v2float %modfStruct_x_out %74 + OpStore %77 %76 + %79 = OpLoad %int %gl_InvocationID + %81 = OpAccessChain %_ptr_Function_v2float %res_0 %int_1 + %82 = OpLoad %v2float %81 + %83 = OpAccessChain %_ptr_Output_v2float %modfStruct_i_out %79 + OpStore %83 %82 + %90 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %90 %float_1 + %91 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %91 %float_1 + %96 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %96 %float_1 + %97 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %97 %float_1 + %99 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %99 %float_1 + %101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %101 %float_1 + %109 = OpLoad %int %gl_InvocationID + %114 = OpLoad %int %gl_InvocationID + %116 = OpAccessChain %_ptr_Input_v4float %gl_in %114 %int_0 + %117 = OpLoad %v4float %116 + %119 = OpAccessChain %_ptr_Output_v4float %gl_out %109 %int_0 + OpStore %119 %117 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# layout (triangles) in; +# +# layout (location = 0) flat in vec2 modf_x_in[]; +# layout (location = 1) flat in vec2 modf_i_in[]; +# layout (location = 2) flat in vec2 modfStruct_x_in[]; +# layout (location = 3) flat in vec2 modfStruct_i_in[]; +# +# layout (location = 0) flat out vec2 modf_x_out; +# layout (location = 1) flat out vec2 modf_i_out; +# layout (location = 2) flat out vec2 modfStruct_x_out; +# layout (location = 3) flat out vec2 modfStruct_i_out; +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# modf_x_out = modf_x_in[0]; +# modf_i_out = modf_i_in[0]; +# modfStruct_x_out = modfStruct_x_in[0]; +# modfStruct_i_out = modfStruct_i_in[0]; +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v2float = OpTypeVector %float 2 +%_ptr_Output_v2float = OpTypePointer Output %v2float + %modf_x_out = OpVariable %_ptr_Output_v2float Output +%_arr_v2float_uint_32 = OpTypeArray %v2float %uint_32 +%_ptr_Input__arr_v2float_uint_32 = OpTypePointer Input %_arr_v2float_uint_32 + %modf_x_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input +%_ptr_Input_v2float = OpTypePointer Input %v2float + %modf_i_out = OpVariable %_ptr_Output_v2float Output + %modf_i_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input +%modfStruct_x_out = OpVariable %_ptr_Output_v2float Output +%modfStruct_x_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input +%modfStruct_i_out = OpVariable %_ptr_Output_v2float Output +%modfStruct_i_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input + %main = OpFunction %void None %3 + %5 = OpLabel + %21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %22 = OpLoad %float %21 + %29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %30 = OpLoad %v4float %29 + %31 = OpVectorTimesScalar %v4float %30 %22 + %32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %36 = OpLoad %v4float %35 + %37 = OpVectorTimesScalar %v4float %36 %33 + %38 = OpFAdd %v4float %31 %37 + %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %44 = OpLoad %v4float %43 + %45 = OpVectorTimesScalar %v4float %44 %41 + %46 = OpFAdd %v4float %38 %45 + %48 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %48 %46 + %56 = OpAccessChain %_ptr_Input_v2float %modf_x_in %int_0 + %57 = OpLoad %v2float %56 + OpStore %modf_x_out %57 + %60 = OpAccessChain %_ptr_Input_v2float %modf_i_in %int_0 + %61 = OpLoad %v2float %60 + OpStore %modf_i_out %61 + %64 = OpAccessChain %_ptr_Input_v2float %modfStruct_x_in %int_0 + %65 = OpLoad %v2float %64 + OpStore %modfStruct_x_out %65 + %68 = OpAccessChain %_ptr_Input_v2float %modfStruct_i_in %int_0 + %69 = OpLoad %v2float %68 + OpStore %modfStruct_i_out %69 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec2 modf_x_in; +# layout (location = 1) flat in vec2 modf_i_in; +# layout (location = 2) flat in vec2 modfStruct_x_in; +# layout (location = 3) flat in vec2 modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.rg = modf_x_in; +# modf_i_out.rg = modf_i_in; +# modfStruct_x_out.rg = modfStruct_x_in; +# modfStruct_i_out.rg = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %modf_x_in = OpVariable %_ptr_Input_v2float Input + %modf_i_in = OpVariable %_ptr_Input_v2float Input +%modfStruct_x_in = OpVariable %_ptr_Input_v2float Input +%modfStruct_i_in = OpVariable %_ptr_Input_v2float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %modf_x_out %12 + OpStore %modf_i_out %12 + OpStore %modfStruct_x_out %12 + OpStore %modfStruct_i_out %12 + %19 = OpLoad %v2float %modf_x_in + %20 = OpLoad %v4float %modf_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 2 3 + OpStore %modf_x_out %21 + %23 = OpLoad %v2float %modf_i_in + %24 = OpLoad %v4float %modf_i_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 2 3 + OpStore %modf_i_out %25 + %27 = OpLoad %v2float %modfStruct_x_in + %28 = OpLoad %v4float %modfStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 2 3 + OpStore %modfStruct_x_out %29 + %31 = OpLoad %v2float %modfStruct_i_in + %32 = OpLoad %v4float %modfStruct_i_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 2 3 + OpStore %modfStruct_i_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_tese.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_tese.amber new file mode 100644 index 0000000..c53de09 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_tese.amber @@ -0,0 +1,536 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation evaluation shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out uint ndx_out[]; +# +# void main () +# { +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID]; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3 + %ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output_uint = OpTypePointer Output %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %16 %float_1 + %18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %18 %float_1 + %23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %23 %float_1 + %24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %24 %float_1 + %26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %26 %float_1 + %28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %28 %float_1 + %39 = OpLoad %int %gl_InvocationID + %47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0 + %48 = OpLoad %v4float %47 + %50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0 + OpStore %50 %48 + %60 = OpAccessChain %_ptr_Input_uint %ndx_in %39 + %61 = OpLoad %uint %60 + %63 = OpAccessChain %_ptr_Output_uint %ndx_out %39 + OpStore %63 %61 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (triangles) in; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec2 modf_x_out; +# layout (location = 1) flat out vec2 modf_i_out; +# layout (location = 2) flat out vec2 modfStruct_x_out; +# layout (location = 3) flat out vec2 modfStruct_i_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec2 in_values[ndp]; +# }; +# +# struct modfStructType +# { +# vec2 x; +# vec2 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec2 orig) +# { +# vec2 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# uvec2 in_uint = in_values[ndx_in[0]]; +# vec2 in_float = uintBitsToFloat(in_uint); +# vec2 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = x; +# modf_i_out = i; +# modfStruct_x_out = res.x; +# modfStruct_i_out = res.i; +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%modfStructType = OpTypeStruct %v2float %v2float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v2float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296 + %block0 = OpTypeStruct %_arr_v2uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %__0 = OpVariable %_ptr_Uniform_block0 Uniform +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint +%_ptr_Output_v2float = OpTypePointer Output %v2float + %modf_x_out = OpVariable %_ptr_Output_v2float Output + %modf_i_out = OpVariable %_ptr_Output_v2float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v2float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v2float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v2uint Function + %in_float = OpVariable %_ptr_Function_v2float Function + %x_0 = OpVariable %_ptr_Function_v2float Function + %i_0 = OpVariable %_ptr_Function_v2float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %41 = OpLoad %float %40 + %48 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %49 = OpLoad %v4float %48 + %50 = OpVectorTimesScalar %v4float %49 %41 + %51 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %52 = OpLoad %float %51 + %54 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %55 = OpLoad %v4float %54 + %56 = OpVectorTimesScalar %v4float %55 %52 + %57 = OpFAdd %v4float %50 %56 + %59 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %60 = OpLoad %float %59 + %62 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %63 = OpLoad %v4float %62 + %64 = OpVectorTimesScalar %v4float %63 %60 + %65 = OpFAdd %v4float %57 %64 + %67 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %67 %65 + %80 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0 + %81 = OpLoad %uint %80 + %83 = OpAccessChain %_ptr_Uniform_v2uint %__0 %int_0 %81 + %84 = OpLoad %v2uint %83 + OpStore %in_uint %84 + %86 = OpLoad %v2uint %in_uint + %87 = OpBitcast %v2float %86 + OpStore %in_float %87 + %89 = OpLoad %v2float %in_float + %91 = OpExtInst %v2float %1 Modf %89 %i_0 + OpStore %x_0 %91 + %94 = OpLoad %v2float %in_float + %95 = OpExtInst %modfStructType %1 ModfStruct %94 + OpStore %res_0 %95 + %98 = OpLoad %v2float %x_0 + OpStore %modf_x_out %98 + %100 = OpLoad %v2float %i_0 + OpStore %modf_i_out %100 + %102 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0 + %103 = OpLoad %v2float %102 + OpStore %modfStruct_x_out %103 + %105 = OpAccessChain %_ptr_Function_v2float %res_0 %int_1 + %106 = OpLoad %v2float %105 + OpStore %modfStruct_i_out %106 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec2 modf_x_in; +# layout (location = 1) flat in vec2 modf_i_in; +# layout (location = 2) flat in vec2 modfStruct_x_in; +# layout (location = 3) flat in vec2 modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.rg = modf_x_in; +# modf_i_out.rg = modf_i_in; +# modfStruct_x_out.rg = modfStruct_x_in; +# modfStruct_i_out.rg = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %modf_x_in = OpVariable %_ptr_Input_v2float Input + %modf_i_in = OpVariable %_ptr_Input_v2float Input +%modfStruct_x_in = OpVariable %_ptr_Input_v2float Input +%modfStruct_i_in = OpVariable %_ptr_Input_v2float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %modf_x_out %12 + OpStore %modf_i_out %12 + OpStore %modfStruct_x_out %12 + OpStore %modfStruct_i_out %12 + %19 = OpLoad %v2float %modf_x_in + %20 = OpLoad %v4float %modf_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 2 3 + OpStore %modf_x_out %21 + %23 = OpLoad %v2float %modf_i_in + %24 = OpLoad %v4float %modf_i_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 2 3 + OpStore %modf_i_out %25 + %27 = OpLoad %v2float %modfStruct_x_in + %28 = OpLoad %v4float %modfStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 2 3 + OpStore %modfStruct_x_out %29 + %31 = OpLoad %v2float %modfStruct_i_in + %32 = OpLoad %v4float %modfStruct_i_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 2 3 + OpStore %modfStruct_i_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_vert.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_vert.amber new file mode 100644 index 0000000..5fa743d --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_2_vert.amber @@ -0,0 +1,327 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A vertex shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out vec2 modf_x_out; +# layout (location = 1) flat out vec2 modf_i_out; +# layout (location = 2) flat out vec2 modfStruct_x_out; +# layout (location = 3) flat out vec2 modfStruct_i_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec2 in_values[ndp]; +# }; +# +# struct modfStructType +# { +# vec2 x; +# vec2 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec2 orig) +# { +# vec2 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# uint ndx = xcoord + ycoord * ndpSqrt; +# +# uvec2 in_uint = in_values[ndx]; +# vec2 in_float = uintBitsToFloat(in_uint); +# vec2 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = x; +# modf_i_out = i; +# modfStruct_x_out = res.x; +# modfStruct_i_out = i; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0 + OpDecorate %position Location 0 + OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%modfStructType = OpTypeStruct %v2float %v2float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v2float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float_36 = OpConstant %float 36 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0_027777778 = OpConstant %float 0.027777778 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %uint_1 = OpConstant %uint 1 + %uint_36 = OpConstant %uint 36 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296 + %block0 = OpTypeStruct %_arr_v2uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint +%_ptr_Output_v2float = OpTypePointer Output %v2float + %modf_x_out = OpVariable %_ptr_Output_v2float Output + %modf_i_out = OpVariable %_ptr_Output_v2float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v2float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v2float Output + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %xcoord = OpVariable %_ptr_Function_uint Function + %ycoord = OpVariable %_ptr_Function_uint Function + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_v2uint Function + %in_float = OpVariable %_ptr_Function_v2float Function + %x_0 = OpVariable %_ptr_Function_v2float Function + %i_0 = OpVariable %_ptr_Function_v2float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %34 = OpAccessChain %_ptr_Input_float %position %uint_0 + %35 = OpLoad %float %34 + %37 = OpFAdd %float %35 %float_0_027777778 + %39 = OpFAdd %float %37 %float_1 + %41 = OpFDiv %float %39 %float_2 + %42 = OpFMul %float %float_36 %41 + %43 = OpFSub %float %42 %float_1 + %44 = OpConvertFToU %uint %43 + OpStore %xcoord %44 + %47 = OpAccessChain %_ptr_Input_float %position %uint_1 + %48 = OpLoad %float %47 + %49 = OpFAdd %float %48 %float_0_027777778 + %50 = OpFAdd %float %49 %float_1 + %51 = OpFDiv %float %50 %float_2 + %52 = OpFMul %float %float_36 %51 + %53 = OpFSub %float %52 %float_1 + %54 = OpConvertFToU %uint %53 + OpStore %ycoord %54 + %56 = OpLoad %uint %xcoord + %57 = OpLoad %uint %ycoord + %59 = OpIMul %uint %57 %uint_36 + %60 = OpIAdd %uint %56 %59 + OpStore %ndx %60 + %71 = OpLoad %uint %ndx + %73 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %71 + %74 = OpLoad %v2uint %73 + OpStore %in_uint %74 + %76 = OpLoad %v2uint %in_uint + %77 = OpBitcast %v2float %76 + OpStore %in_float %77 + %79 = OpLoad %v2float %in_float + %81 = OpExtInst %v2float %1 Modf %79 %i_0 + OpStore %x_0 %81 + %84 = OpLoad %v2float %in_float + %85 = OpExtInst %modfStructType %1 ModfStruct %84 + OpStore %res_0 %85 + %88 = OpLoad %v2float %x_0 + OpStore %modf_x_out %88 + %90 = OpLoad %v2float %i_0 + OpStore %modf_i_out %90 + %92 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0 + %93 = OpLoad %v2float %92 + OpStore %modfStruct_x_out %93 + %95 = OpLoad %v2float %i_0 + OpStore %modfStruct_i_out %95 + %101 = OpLoad %v2float %position + %103 = OpCompositeExtract %float %101 0 + %104 = OpCompositeExtract %float %101 1 + %105 = OpCompositeConstruct %v4float %103 %104 %float_0 %float_1 + %107 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %107 %105 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec2 modf_x_in; +# layout (location = 1) flat in vec2 modf_i_in; +# layout (location = 2) flat in vec2 modfStruct_x_in; +# layout (location = 3) flat in vec2 modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.rg = modf_x_in; +# modf_i_out.rg = modf_i_in; +# modfStruct_x_out.rg = modfStruct_x_in; +# modfStruct_i_out.rg = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %modf_x_in = OpVariable %_ptr_Input_v2float Input + %modf_i_in = OpVariable %_ptr_Input_v2float Input +%modfStruct_x_in = OpVariable %_ptr_Input_v2float Input +%modfStruct_i_in = OpVariable %_ptr_Input_v2float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %modf_x_out %12 + OpStore %modf_i_out %12 + OpStore %modfStruct_x_out %12 + OpStore %modfStruct_i_out %12 + %19 = OpLoad %v2float %modf_x_in + %20 = OpLoad %v4float %modf_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 2 3 + OpStore %modf_x_out %21 + %23 = OpLoad %v2float %modf_i_in + %24 = OpLoad %v4float %modf_i_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 2 3 + OpStore %modf_i_out %25 + %27 = OpLoad %v2float %modfStruct_x_in + %28 = OpLoad %v4float %modfStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 2 3 + OpStore %modfStruct_x_out %29 + %31 = OpLoad %v2float %modfStruct_i_in + %32 = OpLoad %v4float %modfStruct_i_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 2 3 + OpStore %modfStruct_i_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_comp.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_comp.amber new file mode 100644 index 0000000..ab999e5 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_comp.amber @@ -0,0 +1,198 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A compute shader test for ModfStruct. + +# SHADER compute comp_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296 / 3; +# const uint half_ndp = ndp / 2; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec3 in_values[half_ndp]; +# }; +# +# layout(set = 0, binding = 1) buffer block1 { +# vec3 modf_out[ndp]; +# }; +# +# layout(set = 0, binding = 2) buffer block2 { +# vec3 modfStruct_out[ndp]; +# }; +# +# struct modfStructType +# { +# vec3 x; +# vec3 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec3 orig) +# { +# vec3 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# for (uint ndx = 0; ndx < ndp; ndx += 2) +# { +# uvec3 in_uint = in_values[ndx/2]; +# vec3 in_float = uintBitsToFloat(in_uint); +# modf_out[ndx+1] = modf(in_float, modf_out[ndx]); +# modfStructType res = modfStruct(in_float); +# modfStruct_out[ndx] = res.i; +# modfStruct_out[ndx+1] = res.x; +# } +# +# return; +# } +# END + +SHADER compute comp_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %_arr_v3uint_uint_216 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_v3float_uint_432 ArrayStride 16 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_arr_v3float_uint_432_0 ArrayStride 16 + OpMemberDecorate %block2 0 Offset 0 + OpDecorate %block2 BufferBlock + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float +%modfStructType = OpTypeStruct %v3float %v3float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v3float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %uint_432 = OpConstant %uint 432 + %bool = OpTypeBool + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_216 = OpConstant %uint 216 +%_arr_v3uint_uint_216 = OpTypeArray %v3uint %uint_216 + %block0 = OpTypeStruct %_arr_v3uint_uint_216 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint +%_arr_v3float_uint_432 = OpTypeArray %v3float %uint_432 + %block1 = OpTypeStruct %_arr_v3float_uint_432 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%_arr_v3float_uint_432_0 = OpTypeArray %v3float %uint_432 + %block2 = OpTypeStruct %_arr_v3float_uint_432_0 +%_ptr_Uniform_block2 = OpTypePointer Uniform %block2 + %__1 = OpVariable %_ptr_Uniform_block2 Uniform + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_v3uint Function + %in_float = OpVariable %_ptr_Function_v3float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + OpStore %ndx %uint_0 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %uint %ndx + %38 = OpULessThan %bool %35 %uint_432 + OpBranchConditional %38 %31 %32 + %31 = OpLabel + %49 = OpLoad %uint %ndx + %51 = OpUDiv %uint %49 %uint_2 + %53 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %51 + %54 = OpLoad %v3uint %53 + OpStore %in_uint %54 + %56 = OpLoad %v3uint %in_uint + %57 = OpBitcast %v3float %56 + OpStore %in_float %57 + %62 = OpLoad %uint %ndx + %64 = OpIAdd %uint %62 %uint_1 + %65 = OpLoad %v3float %in_float + %66 = OpLoad %uint %ndx + %68 = OpAccessChain %_ptr_Uniform_v3float %__0 %int_0 %66 + %69 = OpExtInst %v3float %1 Modf %65 %68 + %70 = OpAccessChain %_ptr_Uniform_v3float %__0 %int_0 %64 + OpStore %70 %69 + %73 = OpLoad %v3float %in_float + %74 = OpExtInst %modfStructType %1 ModfStruct %73 + OpStore %res_0 %74 + %79 = OpLoad %uint %ndx + %81 = OpAccessChain %_ptr_Function_v3float %res_0 %int_1 + %82 = OpLoad %v3float %81 + %83 = OpAccessChain %_ptr_Uniform_v3float %__1 %int_0 %79 + OpStore %83 %82 + %84 = OpLoad %uint %ndx + %85 = OpIAdd %uint %84 %uint_1 + %86 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0 + %87 = OpLoad %v3float %86 + %88 = OpAccessChain %_ptr_Uniform_v3float %__1 %int_0 %85 + OpStore %88 %87 + OpBranch %33 + %33 = OpLabel + %89 = OpLoad %uint %ndx + %90 = OpIAdd %uint %89 %uint_2 + OpStore %ndx %90 + OpBranch %30 + %32 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt + +BUFFER buf_modf DATA_TYPE vec3 SIZE 432 FILL 0.0 +BUFFER buf_modfStruct DATA_TYPE vec3 SIZE 432 FILL 1.0 + +PIPELINE compute test_pipeline + ATTACH comp_shader + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER buf_modf AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER buf_modfStruct AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN test_pipeline 1 1 1 + +EXPECT buf_modf EQ_BUFFER buf_modfStruct diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_frag.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_frag.amber new file mode 100644 index 0000000..69dbd14 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_frag.amber @@ -0,0 +1,282 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A fragment shader test for ModfStruct. + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec3 in_values[ndp]; +# }; +# +# layout (location = 0) flat in uint ndx_in; +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# struct modfStructType +# { +# vec3 x; +# vec3 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec3 orig) +# { +# vec3 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# uvec3 in_uint = in_values[ndx_in]; +# vec3 in_float = uintBitsToFloat(in_uint); +# vec3 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.rgb = x; +# modf_i_out.rgb = i; +# modfStruct_x_out.rgb = res.x; +# modfStruct_i_out.rgb = res.i; +# +# return; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out + OpExecutionMode %main OriginUpperLeft + OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float +%modfStructType = OpTypeStruct %v3float %v3float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v3float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296 + %block0 = OpTypeStruct %_arr_v3uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %ndx_in = OpVariable %_ptr_Input_uint Input +%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %59 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v3uint Function + %in_float = OpVariable %_ptr_Function_v3float Function + %x_0 = OpVariable %_ptr_Function_v3float Function + %i_0 = OpVariable %_ptr_Function_v3float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %39 = OpLoad %uint %ndx_in + %41 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %39 + %42 = OpLoad %v3uint %41 + OpStore %in_uint %42 + %44 = OpLoad %v3uint %in_uint + %45 = OpBitcast %v3float %44 + OpStore %in_float %45 + %47 = OpLoad %v3float %in_float + %49 = OpExtInst %v3float %1 Modf %47 %i_0 + OpStore %x_0 %49 + %52 = OpLoad %v3float %in_float + %53 = OpExtInst %modfStructType %1 ModfStruct %52 + OpStore %res_0 %53 + OpStore %modf_x_out %59 + OpStore %modf_i_out %59 + OpStore %modfStruct_x_out %59 + OpStore %modfStruct_i_out %59 + %63 = OpLoad %v3float %x_0 + %64 = OpLoad %v4float %modf_x_out + %65 = OpVectorShuffle %v4float %64 %63 4 5 6 3 + OpStore %modf_x_out %65 + %66 = OpLoad %v3float %i_0 + %67 = OpLoad %v4float %modf_i_out + %68 = OpVectorShuffle %v4float %67 %66 4 5 6 3 + OpStore %modf_i_out %68 + %69 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0 + %70 = OpLoad %v3float %69 + %71 = OpLoad %v4float %modfStruct_x_out + %72 = OpVectorShuffle %v4float %71 %70 4 5 6 3 + OpStore %modfStruct_x_out %72 + %74 = OpAccessChain %_ptr_Function_v3float %res_0 %int_1 + %75 = OpLoad %v3float %74 + %76 = OpLoad %v4float %modfStruct_i_out + %77 = OpVectorShuffle %v4float %76 %75 4 5 6 3 + OpStore %modfStruct_i_out %77 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_geom.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_geom.amber new file mode 100644 index 0000000..df935d5 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_geom.amber @@ -0,0 +1,425 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A geometry shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE geometryShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER geometry geom_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec3 in_values[ndp]; +# }; +# +# layout (triangles) in; +# layout (triangle_strip, max_vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec3 modf_x_out; +# layout (location = 1) flat out vec3 modf_i_out; +# layout (location = 2) flat out vec3 modfStruct_x_out; +# layout (location = 3) flat out vec3 modfStruct_i_out; +# +# struct modfStructType +# { +# vec3 x; +# vec3 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec3 orig) +# { +# vec3 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# for (int vertex = 0; vertex < 3; vertex++) +# { +# uvec3 in_uint = in_values[ndx_in[vertex]]; +# vec3 in_float = uintBitsToFloat(in_uint); +# vec3 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = x; +# modf_i_out = i; +# modfStruct_x_out = res.x; +# modfStruct_i_out = res.i; +# +# gl_Position = gl_in[vertex].gl_Position; +# EmitVertex(); +# } +# +# EndPrimitive(); +# } +# END + +SHADER geometry geom_shader SPIRV-ASM + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0 %gl_in + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float +%modfStructType = OpTypeStruct %v3float %v3float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v3float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296 + %block0 = OpTypeStruct %_arr_v3uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %uint_3 = OpConstant %uint 3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint +%_ptr_Output_v3float = OpTypePointer Output %v3float + %modf_x_out = OpVariable %_ptr_Output_v3float Output + %modf_i_out = OpVariable %_ptr_Output_v3float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v3float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v3float Output + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3 +%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %vertex = OpVariable %_ptr_Function_int Function + %in_uint = OpVariable %_ptr_Function_v3uint Function + %in_float = OpVariable %_ptr_Function_v3float Function + %x_0 = OpVariable %_ptr_Function_v3float Function + %i_0 = OpVariable %_ptr_Function_v3float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + OpStore %vertex %int_0 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %int %vertex + %38 = OpSLessThan %bool %35 %int_3 + OpBranchConditional %38 %31 %32 + %31 = OpLabel + %52 = OpLoad %int %vertex + %54 = OpAccessChain %_ptr_Input_uint %ndx_in %52 + %55 = OpLoad %uint %54 + %57 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %55 + %58 = OpLoad %v3uint %57 + OpStore %in_uint %58 + %60 = OpLoad %v3uint %in_uint + %61 = OpBitcast %v3float %60 + OpStore %in_float %61 + %63 = OpLoad %v3float %in_float + %65 = OpExtInst %v3float %1 Modf %63 %i_0 + OpStore %x_0 %65 + %68 = OpLoad %v3float %in_float + %69 = OpExtInst %modfStructType %1 ModfStruct %68 + OpStore %res_0 %69 + %72 = OpLoad %v3float %x_0 + OpStore %modf_x_out %72 + %74 = OpLoad %v3float %i_0 + OpStore %modf_i_out %74 + %76 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0 + %77 = OpLoad %v3float %76 + OpStore %modfStruct_x_out %77 + %80 = OpAccessChain %_ptr_Function_v3float %res_0 %int_1 + %81 = OpLoad %v3float %80 + OpStore %modfStruct_i_out %81 + %92 = OpLoad %int %vertex + %94 = OpAccessChain %_ptr_Input_v4float %gl_in %92 %int_0 + %95 = OpLoad %v4float %94 + %97 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %97 %95 + OpEmitVertex + OpBranch %33 + %33 = OpLabel + %98 = OpLoad %int %vertex + %99 = OpIAdd %int %98 %int_1 + OpStore %vertex %99 + OpBranch %30 + %32 = OpLabel + OpEndPrimitive + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec3 modf_x_in; +# layout (location = 1) flat in vec3 modf_i_in; +# layout (location = 2) flat in vec3 modfStruct_x_in; +# layout (location = 3) flat in vec3 modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.rgb = modf_x_in; +# modf_i_out.rgb = modf_i_in; +# modfStruct_x_out.rgb = modfStruct_x_in; +# modfStruct_i_out.rgb = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %modf_x_in = OpVariable %_ptr_Input_v3float Input + %modf_i_in = OpVariable %_ptr_Input_v3float Input +%modfStruct_x_in = OpVariable %_ptr_Input_v3float Input +%modfStruct_i_in = OpVariable %_ptr_Input_v3float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %modf_x_out %12 + OpStore %modf_i_out %12 + OpStore %modfStruct_x_out %12 + OpStore %modfStruct_i_out %12 + %19 = OpLoad %v3float %modf_x_in + %20 = OpLoad %v4float %modf_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 6 3 + OpStore %modf_x_out %21 + %23 = OpLoad %v3float %modf_i_in + %24 = OpLoad %v4float %modf_i_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 6 3 + OpStore %modf_i_out %25 + %27 = OpLoad %v3float %modfStruct_x_in + %28 = OpLoad %v4float %modfStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 6 3 + OpStore %modfStruct_x_out %29 + %31 = OpLoad %v3float %modfStruct_i_in + %32 = OpLoad %v4float %modfStruct_i_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 6 3 + OpStore %modfStruct_i_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH geom_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_tesc.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_tesc.amber new file mode 100644 index 0000000..974fdff --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_tesc.amber @@ -0,0 +1,581 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation control shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec3 modf_x_out[]; +# layout (location = 1) flat out vec3 modf_i_out[]; +# layout (location = 2) flat out vec3 modfStruct_x_out[]; +# layout (location = 3) flat out vec3 modfStruct_i_out[]; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec3 in_values[ndp]; +# }; +# +# struct modfStructType +# { +# vec3 x; +# vec3 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec3 orig) +# { +# vec3 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# uvec3 in_uint = in_values[ndx_in[gl_InvocationID]]; +# vec3 in_float = uintBitsToFloat(in_uint); +# vec3 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out[gl_InvocationID] = x; +# modf_i_out[gl_InvocationID] = i; +# modfStruct_x_out[gl_InvocationID] = res.x; +# modfStruct_i_out[gl_InvocationID] = res.i; +# +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float +%modfStructType = OpTypeStruct %v3float %v3float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v3float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296 + %block0 = OpTypeStruct %_arr_v3uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_32 = OpConstant %uint 32 +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint + %uint_3 = OpConstant %uint 3 +%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3 +%_ptr_Output__arr_v3float_uint_3 = OpTypePointer Output %_arr_v3float_uint_3 + %modf_x_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output +%_ptr_Output_v3float = OpTypePointer Output %v3float + %modf_i_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output +%modfStruct_x_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output +%modfStruct_i_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v3uint Function + %in_float = OpVariable %_ptr_Function_v3float Function + %x_0 = OpVariable %_ptr_Function_v3float Function + %i_0 = OpVariable %_ptr_Function_v3float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %43 = OpLoad %int %gl_InvocationID + %45 = OpAccessChain %_ptr_Input_uint %ndx_in %43 + %46 = OpLoad %uint %45 + %48 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %46 + %49 = OpLoad %v3uint %48 + OpStore %in_uint %49 + %51 = OpLoad %v3uint %in_uint + %52 = OpBitcast %v3float %51 + OpStore %in_float %52 + %54 = OpLoad %v3float %in_float + %56 = OpExtInst %v3float %1 Modf %54 %i_0 + OpStore %x_0 %56 + %59 = OpLoad %v3float %in_float + %60 = OpExtInst %modfStructType %1 ModfStruct %59 + OpStore %res_0 %60 + %65 = OpLoad %int %gl_InvocationID + %66 = OpLoad %v3float %x_0 + %68 = OpAccessChain %_ptr_Output_v3float %modf_x_out %65 + OpStore %68 %66 + %70 = OpLoad %int %gl_InvocationID + %71 = OpLoad %v3float %i_0 + %72 = OpAccessChain %_ptr_Output_v3float %modf_i_out %70 + OpStore %72 %71 + %74 = OpLoad %int %gl_InvocationID + %75 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0 + %76 = OpLoad %v3float %75 + %77 = OpAccessChain %_ptr_Output_v3float %modfStruct_x_out %74 + OpStore %77 %76 + %79 = OpLoad %int %gl_InvocationID + %81 = OpAccessChain %_ptr_Function_v3float %res_0 %int_1 + %82 = OpLoad %v3float %81 + %83 = OpAccessChain %_ptr_Output_v3float %modfStruct_i_out %79 + OpStore %83 %82 + %90 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %90 %float_1 + %91 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %91 %float_1 + %96 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %96 %float_1 + %97 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %97 %float_1 + %99 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %99 %float_1 + %101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %101 %float_1 + %109 = OpLoad %int %gl_InvocationID + %114 = OpLoad %int %gl_InvocationID + %116 = OpAccessChain %_ptr_Input_v4float %gl_in %114 %int_0 + %117 = OpLoad %v4float %116 + %119 = OpAccessChain %_ptr_Output_v4float %gl_out %109 %int_0 + OpStore %119 %117 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# layout (triangles) in; +# +# layout (location = 0) flat in vec3 modf_x_in[]; +# layout (location = 1) flat in vec3 modf_i_in[]; +# layout (location = 2) flat in vec3 modfStruct_x_in[]; +# layout (location = 3) flat in vec3 modfStruct_i_in[]; +# +# layout (location = 0) flat out vec3 modf_x_out; +# layout (location = 1) flat out vec3 modf_i_out; +# layout (location = 2) flat out vec3 modfStruct_x_out; +# layout (location = 3) flat out vec3 modfStruct_i_out; +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# modf_x_out = modf_x_in[0]; +# modf_i_out = modf_i_in[0]; +# modfStruct_x_out = modfStruct_x_in[0]; +# modfStruct_i_out = modfStruct_i_in[0]; +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output_v3float = OpTypePointer Output %v3float + %modf_x_out = OpVariable %_ptr_Output_v3float Output +%_arr_v3float_uint_32 = OpTypeArray %v3float %uint_32 +%_ptr_Input__arr_v3float_uint_32 = OpTypePointer Input %_arr_v3float_uint_32 + %modf_x_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input + %modf_i_out = OpVariable %_ptr_Output_v3float Output + %modf_i_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input +%modfStruct_x_out = OpVariable %_ptr_Output_v3float Output +%modfStruct_x_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input +%modfStruct_i_out = OpVariable %_ptr_Output_v3float Output +%modfStruct_i_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input + %main = OpFunction %void None %3 + %5 = OpLabel + %21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %22 = OpLoad %float %21 + %29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %30 = OpLoad %v4float %29 + %31 = OpVectorTimesScalar %v4float %30 %22 + %32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %36 = OpLoad %v4float %35 + %37 = OpVectorTimesScalar %v4float %36 %33 + %38 = OpFAdd %v4float %31 %37 + %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %44 = OpLoad %v4float %43 + %45 = OpVectorTimesScalar %v4float %44 %41 + %46 = OpFAdd %v4float %38 %45 + %48 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %48 %46 + %54 = OpAccessChain %_ptr_Input_v3float %modf_x_in %int_0 + %55 = OpLoad %v3float %54 + OpStore %modf_x_out %55 + %58 = OpAccessChain %_ptr_Input_v3float %modf_i_in %int_0 + %59 = OpLoad %v3float %58 + OpStore %modf_i_out %59 + %62 = OpAccessChain %_ptr_Input_v3float %modfStruct_x_in %int_0 + %63 = OpLoad %v3float %62 + OpStore %modfStruct_x_out %63 + %66 = OpAccessChain %_ptr_Input_v3float %modfStruct_i_in %int_0 + %67 = OpLoad %v3float %66 + OpStore %modfStruct_i_out %67 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec3 modf_x_in; +# layout (location = 1) flat in vec3 modf_i_in; +# layout (location = 2) flat in vec3 modfStruct_x_in; +# layout (location = 3) flat in vec3 modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.rgb = modf_x_in; +# modf_i_out.rgb = modf_i_in; +# modfStruct_x_out.rgb = modfStruct_x_in; +# modfStruct_i_out.rgb = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %modf_x_in = OpVariable %_ptr_Input_v3float Input + %modf_i_in = OpVariable %_ptr_Input_v3float Input +%modfStruct_x_in = OpVariable %_ptr_Input_v3float Input +%modfStruct_i_in = OpVariable %_ptr_Input_v3float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %modf_x_out %12 + OpStore %modf_i_out %12 + OpStore %modfStruct_x_out %12 + OpStore %modfStruct_i_out %12 + %19 = OpLoad %v3float %modf_x_in + %20 = OpLoad %v4float %modf_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 6 3 + OpStore %modf_x_out %21 + %23 = OpLoad %v3float %modf_i_in + %24 = OpLoad %v4float %modf_i_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 6 3 + OpStore %modf_i_out %25 + %27 = OpLoad %v3float %modfStruct_x_in + %28 = OpLoad %v4float %modfStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 6 3 + OpStore %modfStruct_x_out %29 + %31 = OpLoad %v3float %modfStruct_i_in + %32 = OpLoad %v4float %modfStruct_i_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 6 3 + OpStore %modfStruct_i_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_tese.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_tese.amber new file mode 100644 index 0000000..4ff7dc4 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_tese.amber @@ -0,0 +1,535 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation evaluation shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out uint ndx_out[]; +# +# void main () +# { +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID]; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3 + %ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output_uint = OpTypePointer Output %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %16 %float_1 + %18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %18 %float_1 + %23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %23 %float_1 + %24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %24 %float_1 + %26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %26 %float_1 + %28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %28 %float_1 + %39 = OpLoad %int %gl_InvocationID + %47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0 + %48 = OpLoad %v4float %47 + %50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0 + OpStore %50 %48 + %60 = OpAccessChain %_ptr_Input_uint %ndx_in %39 + %61 = OpLoad %uint %60 + %63 = OpAccessChain %_ptr_Output_uint %ndx_out %39 + OpStore %63 %61 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (triangles) in; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec3 modf_x_out; +# layout (location = 1) flat out vec3 modf_i_out; +# layout (location = 2) flat out vec3 modfStruct_x_out; +# layout (location = 3) flat out vec3 modfStruct_i_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec3 in_values[ndp]; +# }; +# +# struct modfStructType +# { +# vec3 x; +# vec3 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec3 orig) +# { +# vec3 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# uvec3 in_uint = in_values[ndx_in[0]]; +# vec3 in_float = uintBitsToFloat(in_uint); +# vec3 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = x; +# modf_i_out = i; +# modfStruct_x_out = res.x; +# modfStruct_i_out = res.i; +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float +%modfStructType = OpTypeStruct %v3float %v3float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v3float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296 + %block0 = OpTypeStruct %_arr_v3uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %__0 = OpVariable %_ptr_Uniform_block0 Uniform +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint +%_ptr_Output_v3float = OpTypePointer Output %v3float + %modf_x_out = OpVariable %_ptr_Output_v3float Output + %modf_i_out = OpVariable %_ptr_Output_v3float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v3float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v3float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v3uint Function + %in_float = OpVariable %_ptr_Function_v3float Function + %x_0 = OpVariable %_ptr_Function_v3float Function + %i_0 = OpVariable %_ptr_Function_v3float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %39 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %40 = OpLoad %float %39 + %47 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %48 = OpLoad %v4float %47 + %49 = OpVectorTimesScalar %v4float %48 %40 + %50 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %51 = OpLoad %float %50 + %53 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %54 = OpLoad %v4float %53 + %55 = OpVectorTimesScalar %v4float %54 %51 + %56 = OpFAdd %v4float %49 %55 + %58 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %59 = OpLoad %float %58 + %61 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %62 = OpLoad %v4float %61 + %63 = OpVectorTimesScalar %v4float %62 %59 + %64 = OpFAdd %v4float %56 %63 + %66 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %66 %64 + %79 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0 + %80 = OpLoad %uint %79 + %82 = OpAccessChain %_ptr_Uniform_v3uint %__0 %int_0 %80 + %83 = OpLoad %v3uint %82 + OpStore %in_uint %83 + %85 = OpLoad %v3uint %in_uint + %86 = OpBitcast %v3float %85 + OpStore %in_float %86 + %88 = OpLoad %v3float %in_float + %90 = OpExtInst %v3float %1 Modf %88 %i_0 + OpStore %x_0 %90 + %93 = OpLoad %v3float %in_float + %94 = OpExtInst %modfStructType %1 ModfStruct %93 + OpStore %res_0 %94 + %97 = OpLoad %v3float %x_0 + OpStore %modf_x_out %97 + %99 = OpLoad %v3float %i_0 + OpStore %modf_i_out %99 + %101 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0 + %102 = OpLoad %v3float %101 + OpStore %modfStruct_x_out %102 + %104 = OpAccessChain %_ptr_Function_v3float %res_0 %int_1 + %105 = OpLoad %v3float %104 + OpStore %modfStruct_i_out %105 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec3 modf_x_in; +# layout (location = 1) flat in vec3 modf_i_in; +# layout (location = 2) flat in vec3 modfStruct_x_in; +# layout (location = 3) flat in vec3 modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.rgb = modf_x_in; +# modf_i_out.rgb = modf_i_in; +# modfStruct_x_out.rgb = modfStruct_x_in; +# modfStruct_i_out.rgb = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %modf_x_in = OpVariable %_ptr_Input_v3float Input + %modf_i_in = OpVariable %_ptr_Input_v3float Input +%modfStruct_x_in = OpVariable %_ptr_Input_v3float Input +%modfStruct_i_in = OpVariable %_ptr_Input_v3float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %modf_x_out %12 + OpStore %modf_i_out %12 + OpStore %modfStruct_x_out %12 + OpStore %modfStruct_i_out %12 + %19 = OpLoad %v3float %modf_x_in + %20 = OpLoad %v4float %modf_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 6 3 + OpStore %modf_x_out %21 + %23 = OpLoad %v3float %modf_i_in + %24 = OpLoad %v4float %modf_i_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 6 3 + OpStore %modf_i_out %25 + %27 = OpLoad %v3float %modfStruct_x_in + %28 = OpLoad %v4float %modfStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 6 3 + OpStore %modfStruct_x_out %29 + %31 = OpLoad %v3float %modfStruct_i_in + %32 = OpLoad %v4float %modfStruct_i_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 6 3 + OpStore %modfStruct_i_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_vert.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_vert.amber new file mode 100644 index 0000000..6275e49 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_3_vert.amber @@ -0,0 +1,328 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A vertex shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out vec3 modf_x_out; +# layout (location = 1) flat out vec3 modf_i_out; +# layout (location = 2) flat out vec3 modfStruct_x_out; +# layout (location = 3) flat out vec3 modfStruct_i_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec3 in_values[ndp]; +# }; +# +# struct modfStructType +# { +# vec3 x; +# vec3 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec3 orig) +# { +# vec3 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# uint ndx = xcoord + ycoord * ndpSqrt; +# +# uvec3 in_uint = in_values[ndx]; +# vec3 in_float = uintBitsToFloat(in_uint); +# vec3 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = x; +# modf_i_out = i; +# modfStruct_x_out = res.x; +# modfStruct_i_out = i; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0 + OpDecorate %position Location 0 + OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float +%modfStructType = OpTypeStruct %v3float %v3float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v3float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float_36 = OpConstant %float 36 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0_027777778 = OpConstant %float 0.027777778 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %uint_1 = OpConstant %uint 1 + %uint_36 = OpConstant %uint 36 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296 + %block0 = OpTypeStruct %_arr_v3uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint +%_ptr_Output_v3float = OpTypePointer Output %v3float + %modf_x_out = OpVariable %_ptr_Output_v3float Output + %modf_i_out = OpVariable %_ptr_Output_v3float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v3float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v3float Output + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %xcoord = OpVariable %_ptr_Function_uint Function + %ycoord = OpVariable %_ptr_Function_uint Function + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_v3uint Function + %in_float = OpVariable %_ptr_Function_v3float Function + %x_0 = OpVariable %_ptr_Function_v3float Function + %i_0 = OpVariable %_ptr_Function_v3float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %35 = OpAccessChain %_ptr_Input_float %position %uint_0 + %36 = OpLoad %float %35 + %38 = OpFAdd %float %36 %float_0_027777778 + %40 = OpFAdd %float %38 %float_1 + %42 = OpFDiv %float %40 %float_2 + %43 = OpFMul %float %float_36 %42 + %44 = OpFSub %float %43 %float_1 + %45 = OpConvertFToU %uint %44 + OpStore %xcoord %45 + %48 = OpAccessChain %_ptr_Input_float %position %uint_1 + %49 = OpLoad %float %48 + %50 = OpFAdd %float %49 %float_0_027777778 + %51 = OpFAdd %float %50 %float_1 + %52 = OpFDiv %float %51 %float_2 + %53 = OpFMul %float %float_36 %52 + %54 = OpFSub %float %53 %float_1 + %55 = OpConvertFToU %uint %54 + OpStore %ycoord %55 + %57 = OpLoad %uint %xcoord + %58 = OpLoad %uint %ycoord + %60 = OpIMul %uint %58 %uint_36 + %61 = OpIAdd %uint %57 %60 + OpStore %ndx %61 + %72 = OpLoad %uint %ndx + %74 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %72 + %75 = OpLoad %v3uint %74 + OpStore %in_uint %75 + %77 = OpLoad %v3uint %in_uint + %78 = OpBitcast %v3float %77 + OpStore %in_float %78 + %80 = OpLoad %v3float %in_float + %82 = OpExtInst %v3float %1 Modf %80 %i_0 + OpStore %x_0 %82 + %85 = OpLoad %v3float %in_float + %86 = OpExtInst %modfStructType %1 ModfStruct %85 + OpStore %res_0 %86 + %89 = OpLoad %v3float %x_0 + OpStore %modf_x_out %89 + %91 = OpLoad %v3float %i_0 + OpStore %modf_i_out %91 + %93 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0 + %94 = OpLoad %v3float %93 + OpStore %modfStruct_x_out %94 + %96 = OpLoad %v3float %i_0 + OpStore %modfStruct_i_out %96 + %102 = OpLoad %v2float %position + %104 = OpCompositeExtract %float %102 0 + %105 = OpCompositeExtract %float %102 1 + %106 = OpCompositeConstruct %v4float %104 %105 %float_0 %float_1 + %108 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %108 %106 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec3 modf_x_in; +# layout (location = 1) flat in vec3 modf_i_in; +# layout (location = 2) flat in vec3 modfStruct_x_in; +# layout (location = 3) flat in vec3 modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0); +# +# void main () +# { +# modf_x_out = clear_value; +# modf_i_out = clear_value; +# modfStruct_x_out = clear_value; +# modfStruct_i_out = clear_value; +# modf_x_out.rgb = modf_x_in; +# modf_i_out.rgb = modf_i_in; +# modfStruct_x_out.rgb = modfStruct_x_in; +# modfStruct_i_out.rgb = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %modf_x_in = OpVariable %_ptr_Input_v3float Input + %modf_i_in = OpVariable %_ptr_Input_v3float Input +%modfStruct_x_in = OpVariable %_ptr_Input_v3float Input +%modfStruct_i_in = OpVariable %_ptr_Input_v3float Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %modf_x_out %12 + OpStore %modf_i_out %12 + OpStore %modfStruct_x_out %12 + OpStore %modfStruct_i_out %12 + %19 = OpLoad %v3float %modf_x_in + %20 = OpLoad %v4float %modf_x_out + %21 = OpVectorShuffle %v4float %20 %19 4 5 6 3 + OpStore %modf_x_out %21 + %23 = OpLoad %v3float %modf_i_in + %24 = OpLoad %v4float %modf_i_out + %25 = OpVectorShuffle %v4float %24 %23 4 5 6 3 + OpStore %modf_i_out %25 + %27 = OpLoad %v3float %modfStruct_x_in + %28 = OpLoad %v4float %modfStruct_x_out + %29 = OpVectorShuffle %v4float %28 %27 4 5 6 3 + OpStore %modfStruct_x_out %29 + %31 = OpLoad %v3float %modfStruct_i_in + %32 = OpLoad %v4float %modfStruct_i_out + %33 = OpVectorShuffle %v4float %32 %31 4 5 6 3 + OpStore %modfStruct_i_out %33 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_comp.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_comp.amber new file mode 100644 index 0000000..fed02e3 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_comp.amber @@ -0,0 +1,198 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A compute shader test for ModfStruct. + +# SHADER compute comp_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296 / 4; +# const uint half_ndp = ndp / 2; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec4 in_values[half_ndp]; +# }; +# +# layout(set = 0, binding = 1) buffer block1 { +# vec4 modf_out[ndp]; +# }; +# +# layout(set = 0, binding = 2) buffer block2 { +# vec4 modfStruct_out[ndp]; +# }; +# +# struct modfStructType +# { +# vec4 x; +# vec4 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec4 orig) +# { +# vec4 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# for (uint ndx = 0; ndx < ndp; ndx += 2) +# { +# uvec4 in_uint = in_values[ndx/2]; +# vec4 in_float = uintBitsToFloat(in_uint); +# modf_out[ndx+1] = modf(in_float, modf_out[ndx]); +# modfStructType res = modfStruct(in_float); +# modfStruct_out[ndx] = res.i; +# modfStruct_out[ndx+1] = res.x; +# } +# +# return; +# } +# END + +SHADER compute comp_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %_arr_v4uint_uint_162 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_v4float_uint_324 ArrayStride 16 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_arr_v4float_uint_324_0 ArrayStride 16 + OpMemberDecorate %block2 0 Offset 0 + OpDecorate %block2 BufferBlock + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%modfStructType = OpTypeStruct %v4float %v4float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v4float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %uint_324 = OpConstant %uint 324 + %bool = OpTypeBool + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_162 = OpConstant %uint 162 +%_arr_v4uint_uint_162 = OpTypeArray %v4uint %uint_162 + %block0 = OpTypeStruct %_arr_v4uint_uint_162 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint +%_arr_v4float_uint_324 = OpTypeArray %v4float %uint_324 + %block1 = OpTypeStruct %_arr_v4float_uint_324 +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__0 = OpVariable %_ptr_Uniform_block1 Uniform + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_arr_v4float_uint_324_0 = OpTypeArray %v4float %uint_324 + %block2 = OpTypeStruct %_arr_v4float_uint_324_0 +%_ptr_Uniform_block2 = OpTypePointer Uniform %block2 + %__1 = OpVariable %_ptr_Uniform_block2 Uniform + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_v4uint Function + %in_float = OpVariable %_ptr_Function_v4float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + OpStore %ndx %uint_0 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %uint %ndx + %38 = OpULessThan %bool %35 %uint_324 + OpBranchConditional %38 %31 %32 + %31 = OpLabel + %49 = OpLoad %uint %ndx + %51 = OpUDiv %uint %49 %uint_2 + %53 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %51 + %54 = OpLoad %v4uint %53 + OpStore %in_uint %54 + %56 = OpLoad %v4uint %in_uint + %57 = OpBitcast %v4float %56 + OpStore %in_float %57 + %62 = OpLoad %uint %ndx + %64 = OpIAdd %uint %62 %uint_1 + %65 = OpLoad %v4float %in_float + %66 = OpLoad %uint %ndx + %68 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %66 + %69 = OpExtInst %v4float %1 Modf %65 %68 + %70 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %64 + OpStore %70 %69 + %73 = OpLoad %v4float %in_float + %74 = OpExtInst %modfStructType %1 ModfStruct %73 + OpStore %res_0 %74 + %79 = OpLoad %uint %ndx + %81 = OpAccessChain %_ptr_Function_v4float %res_0 %int_1 + %82 = OpLoad %v4float %81 + %83 = OpAccessChain %_ptr_Uniform_v4float %__1 %int_0 %79 + OpStore %83 %82 + %84 = OpLoad %uint %ndx + %85 = OpIAdd %uint %84 %uint_1 + %86 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0 + %87 = OpLoad %v4float %86 + %88 = OpAccessChain %_ptr_Uniform_v4float %__1 %int_0 %85 + OpStore %88 %87 + OpBranch %33 + %33 = OpLabel + %89 = OpLoad %uint %ndx + %90 = OpIAdd %uint %89 %uint_2 + OpStore %ndx %90 + OpBranch %30 + %32 = OpLabel + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt + +BUFFER buf_modf DATA_TYPE vec4 SIZE 324 FILL 0.0 +BUFFER buf_modfStruct DATA_TYPE vec4 SIZE 324 FILL 1.0 + +PIPELINE compute test_pipeline + ATTACH comp_shader + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER buf_modf AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER buf_modfStruct AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +RUN test_pipeline 1 1 1 + +EXPECT buf_modf EQ_BUFFER buf_modfStruct diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_frag.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_frag.amber new file mode 100644 index 0000000..0285d1f --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_frag.amber @@ -0,0 +1,261 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A fragment shader test for ModfStruct. + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec4 in_values[ndp]; +# }; +# +# layout (location = 0) flat in uint ndx_in; +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# struct modfStructType +# { +# vec4 x; +# vec4 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec4 orig) +# { +# vec4 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# uvec4 in_uint = in_values[ndx_in]; +# vec4 in_float = uintBitsToFloat(in_uint); +# vec4 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out.rgba = x; +# modf_i_out.rgba = i; +# modfStruct_x_out.rgba = res.x; +# modfStruct_i_out.rgba = res.i; +# +# return; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out + OpExecutionMode %main OriginUpperLeft + OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%modfStructType = OpTypeStruct %v4float %v4float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v4float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296 + %block0 = OpTypeStruct %_arr_v4uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %ndx_in = OpVariable %_ptr_Input_uint Input +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v4uint Function + %in_float = OpVariable %_ptr_Function_v4float Function + %x_0 = OpVariable %_ptr_Function_v4float Function + %i_0 = OpVariable %_ptr_Function_v4float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %39 = OpLoad %uint %ndx_in + %41 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %39 + %42 = OpLoad %v4uint %41 + OpStore %in_uint %42 + %44 = OpLoad %v4uint %in_uint + %45 = OpBitcast %v4float %44 + OpStore %in_float %45 + %47 = OpLoad %v4float %in_float + %49 = OpExtInst %v4float %1 Modf %47 %i_0 + OpStore %x_0 %49 + %52 = OpLoad %v4float %in_float + %53 = OpExtInst %modfStructType %1 ModfStruct %52 + OpStore %res_0 %53 + %56 = OpLoad %v4float %x_0 + OpStore %modf_x_out %56 + %58 = OpLoad %v4float %i_0 + OpStore %modf_i_out %58 + %60 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0 + %61 = OpLoad %v4float %60 + OpStore %modfStruct_x_out %61 + %64 = OpAccessChain %_ptr_Function_v4float %res_0 %int_1 + %65 = OpLoad %v4float %64 + OpStore %modfStruct_i_out %65 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_geom.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_geom.amber new file mode 100644 index 0000000..0956989 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_geom.amber @@ -0,0 +1,402 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A geometry shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE geometryShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER geometry geom_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec4 in_values[ndp]; +# }; +# +# layout (triangles) in; +# layout (triangle_strip, max_vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec4 modf_x_out; +# layout (location = 1) flat out vec4 modf_i_out; +# layout (location = 2) flat out vec4 modfStruct_x_out; +# layout (location = 3) flat out vec4 modfStruct_i_out; +# +# struct modfStructType +# { +# vec4 x; +# vec4 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec4 orig) +# { +# vec4 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# for (int vertex = 0; vertex < 3; vertex++) +# { +# uvec4 in_uint = in_values[ndx_in[vertex]]; +# vec4 in_float = uintBitsToFloat(in_uint); +# vec4 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = x; +# modf_i_out = i; +# modfStruct_x_out = res.x; +# modfStruct_i_out = res.i; +# +# gl_Position = gl_in[vertex].gl_Position; +# EmitVertex(); +# } +# +# EndPrimitive(); +# } +# END + +SHADER geometry geom_shader SPIRV-ASM + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0 %gl_in + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%modfStructType = OpTypeStruct %v4float %v4float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v4float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296 + %block0 = OpTypeStruct %_arr_v4uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %uint_3 = OpConstant %uint 3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3 +%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %vertex = OpVariable %_ptr_Function_int Function + %in_uint = OpVariable %_ptr_Function_v4uint Function + %in_float = OpVariable %_ptr_Function_v4float Function + %x_0 = OpVariable %_ptr_Function_v4float Function + %i_0 = OpVariable %_ptr_Function_v4float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + OpStore %vertex %int_0 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %int %vertex + %38 = OpSLessThan %bool %35 %int_3 + OpBranchConditional %38 %31 %32 + %31 = OpLabel + %52 = OpLoad %int %vertex + %54 = OpAccessChain %_ptr_Input_uint %ndx_in %52 + %55 = OpLoad %uint %54 + %57 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %55 + %58 = OpLoad %v4uint %57 + OpStore %in_uint %58 + %60 = OpLoad %v4uint %in_uint + %61 = OpBitcast %v4float %60 + OpStore %in_float %61 + %63 = OpLoad %v4float %in_float + %65 = OpExtInst %v4float %1 Modf %63 %i_0 + OpStore %x_0 %65 + %68 = OpLoad %v4float %in_float + %69 = OpExtInst %modfStructType %1 ModfStruct %68 + OpStore %res_0 %69 + %72 = OpLoad %v4float %x_0 + OpStore %modf_x_out %72 + %74 = OpLoad %v4float %i_0 + OpStore %modf_i_out %74 + %76 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0 + %77 = OpLoad %v4float %76 + OpStore %modfStruct_x_out %77 + %80 = OpAccessChain %_ptr_Function_v4float %res_0 %int_1 + %81 = OpLoad %v4float %80 + OpStore %modfStruct_i_out %81 + %91 = OpLoad %int %vertex + %93 = OpAccessChain %_ptr_Input_v4float %gl_in %91 %int_0 + %94 = OpLoad %v4float %93 + %95 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %95 %94 + OpEmitVertex + OpBranch %33 + %33 = OpLabel + %96 = OpLoad %int %vertex + %97 = OpIAdd %int %96 %int_1 + OpStore %vertex %97 + OpBranch %30 + %32 = OpLabel + OpEndPrimitive + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec4 modf_x_in; +# layout (location = 1) flat in vec4 modf_i_in; +# layout (location = 2) flat in vec4 modfStruct_x_in; +# layout (location = 3) flat in vec4 modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# +# void main () +# { +# modf_x_out.rgba = modf_x_in; +# modf_i_out.rgba = modf_i_in; +# modfStruct_x_out.rgba = modfStruct_x_in; +# modfStruct_i_out.rgba = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %modf_x_in = OpVariable %_ptr_Input_v4float Input + %modf_i_out = OpVariable %_ptr_Output_v4float Output + %modf_i_in = OpVariable %_ptr_Input_v4float Input +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_in = OpVariable %_ptr_Input_v4float Input +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_in = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %v4float %modf_x_in + OpStore %modf_x_out %12 + %15 = OpLoad %v4float %modf_i_in + OpStore %modf_i_out %15 + %18 = OpLoad %v4float %modfStruct_x_in + OpStore %modfStruct_x_out %18 + %21 = OpLoad %v4float %modfStruct_i_in + OpStore %modfStruct_i_out %21 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH geom_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_tesc.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_tesc.amber new file mode 100644 index 0000000..15739d4 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_tesc.amber @@ -0,0 +1,557 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation control shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec4 modf_x_out[]; +# layout (location = 1) flat out vec4 modf_i_out[]; +# layout (location = 2) flat out vec4 modfStruct_x_out[]; +# layout (location = 3) flat out vec4 modfStruct_i_out[]; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec4 in_values[ndp]; +# }; +# +# struct modfStructType +# { +# vec4 x; +# vec4 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec4 orig) +# { +# vec4 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# uvec4 in_uint = in_values[ndx_in[gl_InvocationID]]; +# vec4 in_float = uintBitsToFloat(in_uint); +# vec4 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out[gl_InvocationID] = x; +# modf_i_out[gl_InvocationID] = i; +# modfStruct_x_out[gl_InvocationID] = res.x; +# modfStruct_i_out[gl_InvocationID] = res.i; +# +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%modfStructType = OpTypeStruct %v4float %v4float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v4float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296 + %block0 = OpTypeStruct %_arr_v4uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_32 = OpConstant %uint 32 +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint + %uint_3 = OpConstant %uint 3 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 + %modf_x_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_i_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%modfStruct_x_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%modfStruct_i_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v4uint Function + %in_float = OpVariable %_ptr_Function_v4float Function + %x_0 = OpVariable %_ptr_Function_v4float Function + %i_0 = OpVariable %_ptr_Function_v4float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %43 = OpLoad %int %gl_InvocationID + %45 = OpAccessChain %_ptr_Input_uint %ndx_in %43 + %46 = OpLoad %uint %45 + %48 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %46 + %49 = OpLoad %v4uint %48 + OpStore %in_uint %49 + %51 = OpLoad %v4uint %in_uint + %52 = OpBitcast %v4float %51 + OpStore %in_float %52 + %54 = OpLoad %v4float %in_float + %56 = OpExtInst %v4float %1 Modf %54 %i_0 + OpStore %x_0 %56 + %59 = OpLoad %v4float %in_float + %60 = OpExtInst %modfStructType %1 ModfStruct %59 + OpStore %res_0 %60 + %65 = OpLoad %int %gl_InvocationID + %66 = OpLoad %v4float %x_0 + %68 = OpAccessChain %_ptr_Output_v4float %modf_x_out %65 + OpStore %68 %66 + %70 = OpLoad %int %gl_InvocationID + %71 = OpLoad %v4float %i_0 + %72 = OpAccessChain %_ptr_Output_v4float %modf_i_out %70 + OpStore %72 %71 + %74 = OpLoad %int %gl_InvocationID + %75 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0 + %76 = OpLoad %v4float %75 + %77 = OpAccessChain %_ptr_Output_v4float %modfStruct_x_out %74 + OpStore %77 %76 + %79 = OpLoad %int %gl_InvocationID + %81 = OpAccessChain %_ptr_Function_v4float %res_0 %int_1 + %82 = OpLoad %v4float %81 + %83 = OpAccessChain %_ptr_Output_v4float %modfStruct_i_out %79 + OpStore %83 %82 + %90 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %90 %float_1 + %91 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %91 %float_1 + %96 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %96 %float_1 + %97 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %97 %float_1 + %99 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %99 %float_1 + %101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %101 %float_1 + %108 = OpLoad %int %gl_InvocationID + %113 = OpLoad %int %gl_InvocationID + %115 = OpAccessChain %_ptr_Input_v4float %gl_in %113 %int_0 + %116 = OpLoad %v4float %115 + %117 = OpAccessChain %_ptr_Output_v4float %gl_out %108 %int_0 + OpStore %117 %116 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# layout (triangles) in; +# +# layout (location = 0) flat in vec4 modf_x_in[]; +# layout (location = 1) flat in vec4 modf_i_in[]; +# layout (location = 2) flat in vec4 modfStruct_x_in[]; +# layout (location = 3) flat in vec4 modfStruct_i_in[]; +# +# layout (location = 0) flat out vec4 modf_x_out; +# layout (location = 1) flat out vec4 modf_i_out; +# layout (location = 2) flat out vec4 modfStruct_x_out; +# layout (location = 3) flat out vec4 modfStruct_i_out; +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# modf_x_out = modf_x_in[0]; +# modf_i_out = modf_i_in[0]; +# modfStruct_x_out = modfStruct_x_in[0]; +# modfStruct_i_out = modfStruct_i_in[0]; +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output +%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32 +%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32 + %modf_x_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input + %modf_i_out = OpVariable %_ptr_Output_v4float Output + %modf_i_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input + %main = OpFunction %void None %3 + %5 = OpLabel + %21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %22 = OpLoad %float %21 + %29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %30 = OpLoad %v4float %29 + %31 = OpVectorTimesScalar %v4float %30 %22 + %32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %36 = OpLoad %v4float %35 + %37 = OpVectorTimesScalar %v4float %36 %33 + %38 = OpFAdd %v4float %31 %37 + %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %44 = OpLoad %v4float %43 + %45 = OpVectorTimesScalar %v4float %44 %41 + %46 = OpFAdd %v4float %38 %45 + %48 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %48 %46 + %53 = OpAccessChain %_ptr_Input_v4float %modf_x_in %int_0 + %54 = OpLoad %v4float %53 + OpStore %modf_x_out %54 + %57 = OpAccessChain %_ptr_Input_v4float %modf_i_in %int_0 + %58 = OpLoad %v4float %57 + OpStore %modf_i_out %58 + %61 = OpAccessChain %_ptr_Input_v4float %modfStruct_x_in %int_0 + %62 = OpLoad %v4float %61 + OpStore %modfStruct_x_out %62 + %65 = OpAccessChain %_ptr_Input_v4float %modfStruct_i_in %int_0 + %66 = OpLoad %v4float %65 + OpStore %modfStruct_i_out %66 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec4 modf_x_in; +# layout (location = 1) flat in vec4 modf_i_in; +# layout (location = 2) flat in vec4 modfStruct_x_in; +# layout (location = 3) flat in vec4 modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# +# void main () +# { +# modf_x_out.rgba = modf_x_in; +# modf_i_out.rgba = modf_i_in; +# modfStruct_x_out.rgba = modfStruct_x_in; +# modfStruct_i_out.rgba = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %modf_x_in = OpVariable %_ptr_Input_v4float Input + %modf_i_out = OpVariable %_ptr_Output_v4float Output + %modf_i_in = OpVariable %_ptr_Input_v4float Input +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_in = OpVariable %_ptr_Input_v4float Input +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_in = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %v4float %modf_x_in + OpStore %modf_x_out %12 + %15 = OpLoad %v4float %modf_i_in + OpStore %modf_i_out %15 + %18 = OpLoad %v4float %modfStruct_x_in + OpStore %modfStruct_x_out %18 + %21 = OpLoad %v4float %modfStruct_i_in + OpStore %modfStruct_i_out %21 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_tese.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_tese.amber new file mode 100644 index 0000000..75426d1 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_tese.amber @@ -0,0 +1,513 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A tessellation evaluation shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics +DEVICE_FEATURE tessellationShader + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out uint ndx_out; +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# ndx_out = xcoord + ycoord * ndpSqrt; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %ndx_out %_ + OpDecorate %position Location 0 + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %ndx_out = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_float %position %uint_0 + %17 = OpLoad %float %16 + %21 = OpFAdd %float %17 %float_1_02777779 + %24 = OpFMul %float %21 %float_18 + %25 = OpFSub %float %24 %float_1 + %26 = OpConvertFToU %uint %25 + %29 = OpAccessChain %_ptr_Input_float %position %uint_1 + %30 = OpLoad %float %29 + %32 = OpFAdd %float %30 %float_1_02777779 + %34 = OpFMul %float %32 %float_18 + %35 = OpFSub %float %34 %float_1 + %36 = OpConvertFToU %uint %35 + %42 = OpIMul %uint %36 %uint_36 + %43 = OpIAdd %uint %26 %42 + OpStore %ndx_out %43 + %51 = OpLoad %v2float %position + %53 = OpCompositeExtract %float %51 0 + %54 = OpCompositeExtract %float %51 1 + %55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %57 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %57 %55 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_control tesc_shader GLSL +# #version 430 +# precision highp float; +# +# layout (vertices = 3) out; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out uint ndx_out[]; +# +# void main () +# { +# gl_TessLevelInner[0] = 1.0; +# gl_TessLevelInner[1] = 1.0; +# gl_TessLevelOuter[0] = 1.0; +# gl_TessLevelOuter[1] = 1.0; +# gl_TessLevelOuter[2] = 1.0; +# gl_TessLevelOuter[3] = 1.0; +# +# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID]; +# } +# END + +SHADER tessellation_control tesc_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in + OpExecutionMode %main OutputVertices 3 + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %ndx_out Flat + OpDecorate %ndx_out Location 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3 + %ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output_uint = OpTypePointer Output %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %16 %float_1 + %18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %18 %float_1 + %23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %23 %float_1 + %24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %24 %float_1 + %26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %26 %float_1 + %28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %28 %float_1 + %39 = OpLoad %int %gl_InvocationID + %47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0 + %48 = OpLoad %v4float %47 + %50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0 + OpStore %50 %48 + %60 = OpAccessChain %_ptr_Input_uint %ndx_in %39 + %61 = OpLoad %uint %60 + %63 = OpAccessChain %_ptr_Output_uint %ndx_out %39 + OpStore %63 %61 + OpReturn + OpFunctionEnd +END + +# SHADER tessellation_evaluation tese_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# +# layout (triangles) in; +# +# layout (location = 0) flat in uint ndx_in[]; +# layout (location = 0) flat out vec4 modf_x_out; +# layout (location = 1) flat out vec4 modf_i_out; +# layout (location = 2) flat out vec4 modfStruct_x_out; +# layout (location = 3) flat out vec4 modfStruct_i_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec4 in_values[ndp]; +# }; +# +# struct modfStructType +# { +# vec4 x; +# vec4 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec4 orig) +# { +# vec4 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position + +# gl_TessCoord.y * gl_in[1].gl_Position + +# gl_TessCoord.z * gl_in[2].gl_Position; +# +# uvec4 in_uint = in_values[ndx_in[0]]; +# vec4 in_float = uintBitsToFloat(in_uint); +# vec4 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = x; +# modf_i_out = i; +# modfStruct_x_out = res.x; +# modfStruct_i_out = res.i; +# } +# END + +SHADER tessellation_evaluation tese_shader SPIRV-ASM + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCcw + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %ndx_in Flat + OpDecorate %ndx_in Location 0 + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%modfStructType = OpTypeStruct %v4float %v4float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v4float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296 + %block0 = OpTypeStruct %_arr_v4uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %__0 = OpVariable %_ptr_Uniform_block0 Uniform +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32 + %ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %in_uint = OpVariable %_ptr_Function_v4uint Function + %in_float = OpVariable %_ptr_Function_v4float Function + %x_0 = OpVariable %_ptr_Function_v4float Function + %i_0 = OpVariable %_ptr_Function_v4float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %39 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %40 = OpLoad %float %39 + %47 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %48 = OpLoad %v4float %47 + %49 = OpVectorTimesScalar %v4float %48 %40 + %50 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %51 = OpLoad %float %50 + %53 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %54 = OpLoad %v4float %53 + %55 = OpVectorTimesScalar %v4float %54 %51 + %56 = OpFAdd %v4float %49 %55 + %58 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %59 = OpLoad %float %58 + %61 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %62 = OpLoad %v4float %61 + %63 = OpVectorTimesScalar %v4float %62 %59 + %64 = OpFAdd %v4float %56 %63 + %66 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %66 %64 + %79 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0 + %80 = OpLoad %uint %79 + %82 = OpAccessChain %_ptr_Uniform_v4uint %__0 %int_0 %80 + %83 = OpLoad %v4uint %82 + OpStore %in_uint %83 + %85 = OpLoad %v4uint %in_uint + %86 = OpBitcast %v4float %85 + OpStore %in_float %86 + %88 = OpLoad %v4float %in_float + %90 = OpExtInst %v4float %1 Modf %88 %i_0 + OpStore %x_0 %90 + %93 = OpLoad %v4float %in_float + %94 = OpExtInst %modfStructType %1 ModfStruct %93 + OpStore %res_0 %94 + %96 = OpLoad %v4float %x_0 + OpStore %modf_x_out %96 + %98 = OpLoad %v4float %i_0 + OpStore %modf_i_out %98 + %100 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0 + %101 = OpLoad %v4float %100 + OpStore %modfStruct_x_out %101 + %103 = OpAccessChain %_ptr_Function_v4float %res_0 %int_1 + %104 = OpLoad %v4float %103 + OpStore %modfStruct_i_out %104 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec4 modf_x_in; +# layout (location = 1) flat in vec4 modf_i_in; +# layout (location = 2) flat in vec4 modfStruct_x_in; +# layout (location = 3) flat in vec4 modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# +# void main () +# { +# modf_x_out.rgba = modf_x_in; +# modf_i_out.rgba = modf_i_in; +# modfStruct_x_out.rgba = modfStruct_x_in; +# modfStruct_i_out.rgba = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %modf_x_in = OpVariable %_ptr_Input_v4float Input + %modf_i_out = OpVariable %_ptr_Output_v4float Output + %modf_i_in = OpVariable %_ptr_Input_v4float Input +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_in = OpVariable %_ptr_Input_v4float Input +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_in = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %v4float %modf_x_in + OpStore %modf_x_out %12 + %15 = OpLoad %v4float %modf_i_in + OpStore %modf_i_out %15 + %18 = OpLoad %v4float %modfStruct_x_in + OpStore %modfStruct_x_out %18 + %21 = OpLoad %v4float %modfStruct_i_in + OpStore %modfStruct_i_out %21 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH tesc_shader + ATTACH tese_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144 +RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_vert.amber b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_vert.amber new file mode 100644 index 0000000..6e89aea --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/float32/comparison/modfstruct_4_vert.amber @@ -0,0 +1,305 @@ +#!amber + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A vertex shader test for ModfStruct. + +DEVICE_FEATURE vertexPipelineStoresAndAtomics + +# SHADER vertex vert_shader GLSL +# #version 430 +# precision highp float; +# +# const uint ndp = 1296; +# const uint ndpSqrt = uint(sqrt(ndp)); +# const float halfGridElementSize = 1.0 / float(ndpSqrt); +# +# layout (location = 0) in vec2 position; +# layout (location = 0) flat out vec4 modf_x_out; +# layout (location = 1) flat out vec4 modf_i_out; +# layout (location = 2) flat out vec4 modfStruct_x_out; +# layout (location = 3) flat out vec4 modfStruct_i_out; +# +# layout(set = 0, binding = 0) readonly buffer block0 { +# uvec4 in_values[ndp]; +# }; +# +# struct modfStructType +# { +# vec4 x; +# vec4 i; +# }; +# +# // Replaced with native function in SPIR-V. +# modfStructType modfStruct (vec4 orig) +# { +# vec4 x, i; +# x = modf(orig, i); +# modfStructType res = { x, i }; +# return res; +# } +# +# void main () +# { +# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1); +# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1); +# uint ndx = xcoord + ycoord * ndpSqrt; +# +# uvec4 in_uint = in_values[ndx]; +# vec4 in_float = uintBitsToFloat(in_uint); +# vec4 x, i; +# modfStructType res; +# +# x = modf(in_float, i); +# res = modfStruct(in_float); +# +# modf_x_out = x; +# modf_i_out = i; +# modfStruct_x_out = res.x; +# modfStruct_i_out = i; +# +# gl_Position = vec4(position, 0, 1); +# +# return; +# } +# END + +SHADER vertex vert_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0 + OpDecorate %position Location 0 + OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16 + OpMemberDecorate %block0 0 NonWritable + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %modf_x_out Flat + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_i_out Flat + OpDecorate %modf_i_out Location 1 + OpDecorate %modfStruct_x_out Flat + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_i_out Flat + OpDecorate %modfStruct_i_out Location 3 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%modfStructType = OpTypeStruct %v4float %v4float + %10 = OpTypeFunction %modfStructType %_ptr_Function_v4float +%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float_36 = OpConstant %float 36 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %position = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0_027777778 = OpConstant %float 0.027777778 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %uint_1 = OpConstant %uint 1 + %uint_36 = OpConstant %uint 36 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_1296 = OpConstant %uint 1296 +%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296 + %block0 = OpTypeStruct %_arr_v4uint_uint_1296 +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %_ = OpVariable %_ptr_Uniform_block0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output + %modf_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output + %float_0 = OpConstant %float 0 + %main = OpFunction %void None %3 + %5 = OpLabel + %xcoord = OpVariable %_ptr_Function_uint Function + %ycoord = OpVariable %_ptr_Function_uint Function + %ndx = OpVariable %_ptr_Function_uint Function + %in_uint = OpVariable %_ptr_Function_v4uint Function + %in_float = OpVariable %_ptr_Function_v4float Function + %x_0 = OpVariable %_ptr_Function_v4float Function + %i_0 = OpVariable %_ptr_Function_v4float Function + %res_0 = OpVariable %_ptr_Function_modfStructType Function + %35 = OpAccessChain %_ptr_Input_float %position %uint_0 + %36 = OpLoad %float %35 + %38 = OpFAdd %float %36 %float_0_027777778 + %40 = OpFAdd %float %38 %float_1 + %42 = OpFDiv %float %40 %float_2 + %43 = OpFMul %float %float_36 %42 + %44 = OpFSub %float %43 %float_1 + %45 = OpConvertFToU %uint %44 + OpStore %xcoord %45 + %48 = OpAccessChain %_ptr_Input_float %position %uint_1 + %49 = OpLoad %float %48 + %50 = OpFAdd %float %49 %float_0_027777778 + %51 = OpFAdd %float %50 %float_1 + %52 = OpFDiv %float %51 %float_2 + %53 = OpFMul %float %float_36 %52 + %54 = OpFSub %float %53 %float_1 + %55 = OpConvertFToU %uint %54 + OpStore %ycoord %55 + %57 = OpLoad %uint %xcoord + %58 = OpLoad %uint %ycoord + %60 = OpIMul %uint %58 %uint_36 + %61 = OpIAdd %uint %57 %60 + OpStore %ndx %61 + %72 = OpLoad %uint %ndx + %74 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %72 + %75 = OpLoad %v4uint %74 + OpStore %in_uint %75 + %77 = OpLoad %v4uint %in_uint + %78 = OpBitcast %v4float %77 + OpStore %in_float %78 + %80 = OpLoad %v4float %in_float + %82 = OpExtInst %v4float %1 Modf %80 %i_0 + OpStore %x_0 %82 + %85 = OpLoad %v4float %in_float + %86 = OpExtInst %modfStructType %1 ModfStruct %85 + OpStore %res_0 %86 + %89 = OpLoad %v4float %x_0 + OpStore %modf_x_out %89 + %91 = OpLoad %v4float %i_0 + OpStore %modf_i_out %91 + %93 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0 + %94 = OpLoad %v4float %93 + OpStore %modfStruct_x_out %94 + %96 = OpLoad %v4float %i_0 + OpStore %modfStruct_i_out %96 + %101 = OpLoad %v2float %position + %103 = OpCompositeExtract %float %101 0 + %104 = OpCompositeExtract %float %101 1 + %105 = OpCompositeConstruct %v4float %103 %104 %float_0 %float_1 + %106 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %106 %105 + OpReturn + OpFunctionEnd +END + +# SHADER fragment frag_shader GLSL +# #version 430 +# precision highp float; +# +# layout (location = 0) flat in vec4 modf_x_in; +# layout (location = 1) flat in vec4 modf_i_in; +# layout (location = 2) flat in vec4 modfStruct_x_in; +# layout (location = 3) flat in vec4 modfStruct_i_in; +# +# layout (location = 0) out vec4 modf_x_out; +# layout (location = 1) out vec4 modf_i_out; +# layout (location = 2) out vec4 modfStruct_x_out; +# layout (location = 3) out vec4 modfStruct_i_out; +# +# +# void main () +# { +# modf_x_out.rgba = modf_x_in; +# modf_i_out.rgba = modf_i_in; +# modfStruct_x_out.rgba = modfStruct_x_in; +# modfStruct_i_out.rgba = modfStruct_i_in; +# } +# END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in + OpExecutionMode %main OriginUpperLeft + OpDecorate %modf_x_out Location 0 + OpDecorate %modf_x_in Flat + OpDecorate %modf_x_in Location 0 + OpDecorate %modf_i_out Location 1 + OpDecorate %modf_i_in Flat + OpDecorate %modf_i_in Location 1 + OpDecorate %modfStruct_x_out Location 2 + OpDecorate %modfStruct_x_in Flat + OpDecorate %modfStruct_x_in Location 2 + OpDecorate %modfStruct_i_out Location 3 + OpDecorate %modfStruct_i_in Flat + OpDecorate %modfStruct_i_in Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %modf_x_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %modf_x_in = OpVariable %_ptr_Input_v4float Input + %modf_i_out = OpVariable %_ptr_Output_v4float Output + %modf_i_in = OpVariable %_ptr_Input_v4float Input +%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_x_in = OpVariable %_ptr_Input_v4float Input +%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output +%modfStruct_i_in = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %v4float %modf_x_in + OpStore %modf_x_out %12 + %15 = OpLoad %v4float %modf_i_in + OpStore %modf_i_out %15 + %18 = OpLoad %v4float %modfStruct_x_in + OpStore %modfStruct_x_out %18 + %21 = OpLoad %v4float %modfStruct_i_in + OpStore %modfStruct_i_out %21 + OpReturn + OpFunctionEnd +END + +BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt +BUFFER vertices DATA_TYPE vec2 SIZE 7776 FILE TEXT grid_vertices.txt + +BUFFER modf_x FORMAT R32G32B32A32_SFLOAT +BUFFER modf_i FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT +BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT + +PIPELINE graphics test_pipeline + FRAMEBUFFER_SIZE 144 144 + + ATTACH vert_shader + ATTACH frag_shader + + VERTEX_DATA vertices LOCATION 0 + + BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER modf_x AS color LOCATION 0 + BIND BUFFER modf_i AS color LOCATION 1 + BIND BUFFER modfStruct_x AS color LOCATION 2 + BIND BUFFER modfStruct_i AS color LOCATION 3 +END + +RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776 + +EXPECT modf_x EQ_BUFFER modfStruct_x +EXPECT modf_i EQ_BUFFER modfStruct_i diff --git a/vulkan/amber/spirv_assembly/instruction/function_params/sampler_param.amber b/vulkan/amber/spirv_assembly/instruction/function_params/sampler_param.amber new file mode 100644 index 0000000..2585c31 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/function_params/sampler_param.amber @@ -0,0 +1,130 @@ +#!amber + +# Copyright 2020 Valve Corporation. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vtx_passthrough PASSTHROUGH + +SHADER fragment frag_green GLSL +#version 450 +layout(location=0) out vec4 out_color; +void main() { + out_color = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +SHADER vertex vtx_shader GLSL +#version 450 + +layout(location = 0) in vec4 position; +layout(location = 0) out vec2 textureCoordinates; + +void main() { + gl_Position = position; + textureCoordinates = vec2(0.0, 0.0); +} +END + +SHADER fragment frag_shader SPIRV-ASM + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %fragColor %vtxTexCoords + OpExecutionMode %main OriginUpperLeft + OpDecorate %fragColor Location 0 ; Output + OpDecorate %vtxTexCoords Location 0 ; Input + OpDecorate %sampler_ptr DescriptorSet 0 + OpDecorate %sampler_ptr Binding 0 + + ; Basic types. + %void = OpTypeVoid + %void_func_t = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 + %image_2d = OpTypeImage %float 2D 0 0 0 1 Unknown + %sampled_img = OpTypeSampledImage %image_2d + %sampling_func_t = OpTypeFunction %v4float %sampled_img %v2float + + ; Pointer types. +%sampled_img_uniform_ptr = OpTypePointer UniformConstant %sampled_img + %v4float_out_ptr = OpTypePointer Output %v4float + %v2float_input_ptr = OpTypePointer Input %v2float + + ; In/Out variables. + %fragColor = OpVariable %v4float_out_ptr Output + %sampler_ptr = OpVariable %sampled_img_uniform_ptr UniformConstant + %vtxTexCoords = OpVariable %v2float_input_ptr Input + + ; Main function. + %main = OpFunction %void None %void_func_t + %main_label = OpLabel + %tex_coords = OpLoad %v2float %vtxTexCoords + %sampler_arg = OpLoad %sampled_img %sampler_ptr + %frag_color_val = OpFunctionCall %v4float %sampling_func %sampler_arg %tex_coords + OpStore %fragColor %frag_color_val + OpReturn + OpFunctionEnd + + ; Auxiliar texture sampling function, receiving a sampled image as its argument. + %sampling_func = OpFunction %v4float None %sampling_func_t + %sampler = OpFunctionParameter %sampled_img + %coords = OpFunctionParameter %v2float + %sampling_func_label = OpLabel + %retval = OpImageSampleImplicitLod %v4float %sampler %coords + OpReturnValue %retval + OpFunctionEnd +END + +# Full-screen quad. +BUFFER position_buf DATA_TYPE vec4 DATA +-1 -1 0 1 + 1 -1 0 1 +-1 1 0 1 +-1 1 0 1 + 1 -1 0 1 + 1 1 0 1 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER texture FORMAT R8G8B8A8_UNORM +SAMPLER sampler + +PIPELINE graphics texgen_pipeline + ATTACH vtx_passthrough + ATTACH frag_green + + FRAMEBUFFER_SIZE 1 1 + BIND BUFFER texture AS color LOCATION 0 +END + +PIPELINE graphics main_pipeline + ATTACH vtx_shader + ATTACH frag_shader + + VERTEX_DATA position_buf LOCATION 0 + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + + FRAMEBUFFER_SIZE 64 64 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR texgen_pipeline +RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 1 1 +EXPECT texture IDX 0 0 SIZE 1 1 EQ_RGBA 0 255 0 255 + +CLEAR_COLOR main_pipeline 0 0 0 255 +CLEAR main_pipeline +RUN main_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT framebuffer IDX 0 0 SIZE 64 64 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_equal.amber b/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_equal.amber new file mode 100644 index 0000000..8071afc --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_equal.amber @@ -0,0 +1,155 @@ +#!amber + +DEVICE_EXTENSION VK_AMD_shader_early_and_late_fragment_tests + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Early Fragment Test 'DepthEqual'. +# Polygon depth: 0.5 +# FragDepth: 0.6 +# Depth compare op: equal +# Execution mode: Any +# Depth buffer clear value: 0.5 +# Description: FragDepth < CLEAR_DEPTH. Depth test should pass. The gl_FragDepth should be overwrite, when EarlyAndLateFragmentTestsAMD mode is enabled. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.5, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# version 430 +# +# layout(early_fragment_tests) in; +# +# layout(location = 0) out vec4 color_out; +# layout(depth_any) out float gl_FragDepth; +# +# void main() +# { +# color_out = vec4(1.0, 0.0, 0.0, 1.0); +# gl_FragDepth = 0.6; +# } + +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + OpCapability Shader + OpExtension "SPV_AMD_shader_early_and_late_fragment_tests" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyAndLateFragmentTestsAMD + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthGreater + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output + %float_0_6 = OpConstant %float 0.6 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_6 + OpReturn + OpFunctionEnd +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP equal + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; + +const float expectedValue = 0.5; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); + else + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 250 250 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline + +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_greater.amber b/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_greater.amber new file mode 100644 index 0000000..87a502d --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_greater.amber @@ -0,0 +1,155 @@ +#!amber + +DEVICE_EXTENSION VK_AMD_shader_early_and_late_fragment_tests + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Early Fragment Test 'DepthGreater'. +# Polygon depth: 0.6 +# FragDepth: 0.7 +# Depth compare op: greater +# Execution mode: DepthGreater +# Depth buffer clear value: 0.5 +# Description: FragDepth > CLEAR_DEPTH. Depth test should pass. The gl_FragDepth should be overwrite, when EarlyAndLateFragmentTestsAMD mode is enabled. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.6, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# version 430 +# +# layout(early_fragment_tests) in; +# +# layout(location = 0) out vec4 color_out; +# layout(depth_greater) out float gl_FragDepth; +# +# void main() +# { +# color_out = vec4(1.0, 0.0, 0.0, 1.0); +# gl_FragDepth = 0.7; +# } + +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + OpCapability Shader + OpExtension "SPV_AMD_shader_early_and_late_fragment_tests" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyAndLateFragmentTestsAMD + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthGreater + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_0_7 = OpConstant %float 0.7 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_7 + OpReturn + OpFunctionEnd +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; + +const float expectedValue = 0.7; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); + else + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 250 250 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline + +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_greater_or_equal.amber b/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_greater_or_equal.amber new file mode 100644 index 0000000..176bb11 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_greater_or_equal.amber @@ -0,0 +1,155 @@ +#!amber + +DEVICE_EXTENSION VK_AMD_shader_early_and_late_fragment_tests + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Early Fragment Test 'DepthGreaterOrEqual'. +# Polygon depth: 0.6 +# FragDepth: 0.7 +# Depth compare op: greater_or_equal +# Execution mode: Any +# Depth buffer clear value: 0.5 +# Description: FragDepth < CLEAR_DEPTH. Depth test should pass. The gl_FragDepth should be overwrite, when EarlyAndLateFragmentTestsAMD mode is enabled. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.6, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# version 430 +# +# layout(early_fragment_tests) in; +# +# layout(location = 0) out vec4 color_out; +# layout(depth_any) out float gl_FragDepth; +# +# void main() +# { +# color_out = vec4(1.0, 0.0, 0.0, 1.0); +# gl_FragDepth = 0.7; +# } + +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + OpCapability Shader + OpExtension "SPV_AMD_shader_early_and_late_fragment_tests" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyAndLateFragmentTestsAMD + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthGreater + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output + %float_0_7 = OpConstant %float 0.7 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_7 + OpReturn + OpFunctionEnd +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP greater_or_equal + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL + +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; + +const float expectedValue = 0.7; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); + else + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 250 250 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline + +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_less.amber b/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_less.amber new file mode 100644 index 0000000..12e4e54 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_less.amber @@ -0,0 +1,155 @@ +#!amber + +DEVICE_EXTENSION VK_AMD_shader_early_and_late_fragment_tests + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Early Fragment Test 'DepthLess' execution mode. +# Polygon depth: 0.5 +# FragDepth: 0.4 +# Depth compare op: less +# Execution mode: DepthLess +# Depth buffer clear value: 0.6 +# Description: FragDepth < CLEAR_DEPTH. Depth test should pass. The gl_FragDepth should be overwrite, when EarlyAndLateFragmentTestsAMD mode is enabled. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.5, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(early_fragment_tests) in; +# +# layout(location = 0) out vec4 color_out; +# layout(depth_less) out float gl_FragDepth; +# +# void main() +# { +# color_out = vec4(1.0, 0.0, 0.0, 1.0); +# gl_FragDepth = 0.4; +# } + +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + OpCapability Shader + OpExtension "SPV_AMD_shader_early_and_late_fragment_tests" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyAndLateFragmentTestsAMD + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthLess + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_0_4 = OpConstant %float 0.4 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_4 + OpReturn + OpFunctionEnd +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.6 +CLEAR my_pipeline + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL + +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; + +const float expectedValue = 0.4; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); + else + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 250 250 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline + +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_less_or_equal.amber b/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_less_or_equal.amber new file mode 100644 index 0000000..088209b --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_less_or_equal.amber @@ -0,0 +1,155 @@ +#!amber + +DEVICE_EXTENSION VK_AMD_shader_early_and_late_fragment_tests + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Early Fragment Test 'DepthLessOrEqual'. +# Polygon depth: 0.5 +# FragDepth: 0.7 +# Depth compare op: less_or_equal +# Execution mode: Any +# Depth buffer clear value: 0.5 +# Description: FragDepth == CLEAR_DEPTH. Depth test should pass. The gl_FragDepth should be overwrite, when EarlyAndLateFragmentTestsAMD mode is enabled. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.5, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# version 430 +# +# layout(early_fragment_tests) in; +# +# layout(location = 0) out vec4 color_out; +# layout(depth_any) out float gl_FragDepth; +# +# void main() +# { +# color_out = vec4(1.0, 0.0, 0.0, 1.0); +# gl_FragDepth = 0.7; +# } + +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + OpCapability Shader + OpExtension "SPV_AMD_shader_early_and_late_fragment_tests" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyAndLateFragmentTestsAMD + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthUnchanged + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output + %float_0_7 = OpConstant %float 0.7 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_7 + OpReturn + OpFunctionEnd +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP less_or_equal + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL + +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; + +const float expectedValue = 0.5; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); + else + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 250 250 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline + +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_not_equal.amber new file mode 100644 index 0000000..0e4b83b --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/early_and_late_fragment/depth_not_equal.amber @@ -0,0 +1,155 @@ +#!amber + +DEVICE_EXTENSION VK_AMD_shader_early_and_late_fragment_tests + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Early Fragment Test 'DepthNotEqual'. +# Polygon depth: 0.3 +# FragDepth: 0.5 +# Depth compare op: not_equal +# Execution mode: Any +# Depth buffer clear value: 0.4 +# Description: FragDepth == CLEAR_DEPTH. Depth test should pass. The gl_FragDepth should be overwrite, when EarlyAndLateFragmentTestsAMD mode is enabled. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.3, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# version 430 +# +# layout(early_fragment_tests) in; +# +# layout(location = 0) out vec4 color_out; +# layout(depth_any) out float gl_FragDepth; +# +# void main() +# { +# color_out = vec4(1.0, 0.0, 0.0, 1.0); +# gl_FragDepth = 0.5; +# } + +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + OpCapability Shader + OpExtension "SPV_AMD_shader_early_and_late_fragment_tests" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyAndLateFragmentTestsAMD + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthUnchanged + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output + %float_0_5 = OpConstant %float 0.5 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_5 + OpReturn + OpFunctionEnd +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP not_equal + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.4 +CLEAR my_pipeline + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; + +const float expectedValue = 0.5; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); + else + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 250 250 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline + +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_equal.amber b/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_equal.amber new file mode 100644 index 0000000..9af8b04 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_equal.amber @@ -0,0 +1,150 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Early Fragment Test 'DepthEqual'. +# Polygon depth: 0.5 +# FragDepth: 0.3 +# Depth compare op: equal +# Execution mode: Any +# Depth buffer clear value: 0.5 +# Description: FragDepth < CLEAR_DEPTH. Depth test should pass. Overwriting the gl_FragDepth is ignored, when Early Fragment Test Mode is enabled. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.5, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# version 430 +# +# layout(early_fragment_tests) in; +# +# layout(location = 0) out vec4 color_out; +# layout(depth_any) out float gl_FragDepth; +# +# void main() +# { +# color_out = vec4(1.0, 0.0, 0.0, 1.0); +# gl_FragDepth = 0.3; +# } + +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyFragmentTests + OpExecutionMode %main DepthReplacing + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output + %float_0_3 = OpConstant %float 0.3 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_3 + OpReturn + OpFunctionEnd +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP equal + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; + +const float expectedValue = 0.5; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); + else + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 250 250 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline + +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_greater.amber b/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_greater.amber new file mode 100644 index 0000000..e24a2c4 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_greater.amber @@ -0,0 +1,151 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Early Fragment Test 'DepthGreater'. +# Polygon depth: 0.6 +# FragDepth: 0.4 +# Depth compare op: greater +# Execution mode: DepthGreater +# Depth buffer clear value: 0.5 +# Description: FragDepth < CLEAR_DEPTH. Depth test should pass. Overwriting the gl_FragDepth is ignored, when Early Fragment Test Mode is enabled. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.6, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# version 430 +# +# layout(early_fragment_tests) in; +# +# layout(location = 0) out vec4 color_out; +# layout(depth_greater) out float gl_FragDepth; +# +# void main() +# { +# color_out = vec4(1.0, 0.0, 0.0, 1.0); +# gl_FragDepth = 0.4; +# } + +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyFragmentTests + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthGreater + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_0_4 = OpConstant %float 0.4 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_4 + OpReturn + OpFunctionEnd +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; + +const float expectedValue = 0.6; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); + else + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 250 250 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline + +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_greater_or_equal.amber b/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_greater_or_equal.amber new file mode 100644 index 0000000..ee9fe0a --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_greater_or_equal.amber @@ -0,0 +1,150 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Early Fragment Test 'DepthGreaterOrEqual'. +# Polygon depth: 0.5 +# FragDepth: 0.3 +# Depth compare op: greater_or_equal +# Execution mode: Any +# Depth buffer clear value: 0.5 +# Description: FragDepth < CLEAR_DEPTH. Depth test should pass. Overwriting the gl_FragDepth is ignored, when Early Fragment Test Mode is enabled. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.5, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# version 430 +# +# layout(early_fragment_tests) in; +# +# layout(location = 0) out vec4 color_out; +# layout(depth_any) out float gl_FragDepth; +# +# void main() +# { +# color_out = vec4(1.0, 0.0, 0.0, 1.0); +# gl_FragDepth = 0.3; +# } + +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyFragmentTests + OpExecutionMode %main DepthReplacing + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output + %float_0_3 = OpConstant %float 0.3 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_3 + OpReturn + OpFunctionEnd +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP greater_or_equal + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL + +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; + +const float expectedValue = 0.5; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); + else + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 250 250 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline + +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_less.amber b/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_less.amber new file mode 100644 index 0000000..f7805ab --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_less.amber @@ -0,0 +1,151 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Early Fragment Test 'DepthLess' execution mode. +# Polygon depth: 0.4 +# FragDepth: 0.7 +# Depth compare op: less +# Execution mode: DepthLess +# Depth buffer clear value: 0.5 +# Description: FragDepth > CLEAR_DEPTH. Depth test should pass. Overwriting the gl_FragDepth is ignored, when Early Fragment Test Mode is enabled. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.4, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(early_fragment_tests) in; +# +# layout(location = 0) out vec4 color_out; +# layout(depth_less) out float gl_FragDepth; +# +# void main() +# { +# color_out = vec4(1.0, 0.0, 0.0, 1.0); +# gl_FragDepth = 0.7; +# } + +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyFragmentTests + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthLess + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_0_7 = OpConstant %float 0.7 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_7 + OpReturn + OpFunctionEnd +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL + +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; + +const float expectedValue = 0.4; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); + else + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 250 250 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline + +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal.amber b/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal.amber new file mode 100644 index 0000000..b983d96 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal.amber @@ -0,0 +1,150 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Early Fragment Test 'DepthLessOrEqual'. +# Polygon depth: 0.5 +# FragDepth: 0.7 +# Depth compare op: less_or_equal +# Execution mode: Any +# Depth buffer clear value: 0.5 +# Description: FragDepth > CLEAR_DEPTH. Depth test should pass. Overwriting the gl_FragDepth is ignored, when Early Fragment Test Mode is enabled. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.5, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# version 430 +# +# layout(early_fragment_tests) in; +# +# layout(location = 0) out vec4 color_out; +# layout(depth_any) out float gl_FragDepth; +# +# void main() +# { +# color_out = vec4(1.0, 0.0, 0.0, 1.0); +# gl_FragDepth = 0.7; +# } + +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyFragmentTests + OpExecutionMode %main DepthReplacing + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output + %float_0_7 = OpConstant %float 0.7 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_7 + OpReturn + OpFunctionEnd +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP less_or_equal + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL + +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; + +const float expectedValue = 0.5; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); + else + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 250 250 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline + +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal.amber new file mode 100644 index 0000000..f68e00e --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal.amber @@ -0,0 +1,150 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Early Fragment Test 'DepthNotEqual'. +# Polygon depth: 0.3 +# FragDepth: 0.5 +# Depth compare op: not_equal +# Execution mode: Any +# Depth buffer clear value: 0.5 +# Description: FragDepth == CLEAR_DEPTH. Depth test should pass. Overwriting the gl_FragDepth is ignored, when Early Fragment Test Mode is enabled. + +SHADER vertex vert_shader GLSL +#version 430 + +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.3, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# version 430 +# +# layout(early_fragment_tests) in; +# +# layout(location = 0) out vec4 color_out; +# layout(depth_any) out float gl_FragDepth; +# +# void main() +# { +# color_out = vec4(1.0, 0.0, 0.0, 1.0); +# gl_FragDepth = 0.5; +# } + +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyFragmentTests + OpExecutionMode %main DepthReplacing + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output + %float_0_5 = OpConstant %float 0.5 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_5 + OpReturn + OpFunctionEnd +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vert_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP not_equal + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline + +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; + +const float expectedValue = 0.3; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); + else + outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 250 250 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline + +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250 + +EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_0.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_0.amber new file mode 100644 index 0000000..52be87a --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_0.amber @@ -0,0 +1,145 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthGreater' execution mode. +# Polygon depth: 0.6 +# FragDepth: 0.7 +# Depth compare op: greater +# Execution mode: DepthGreater +# Depth buffer clear value: 0.5 +# Description: FragDepth > Polygon depth: depth test should pass. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.6, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_greater) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = 0.7; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthGreater + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_out_depth = OpConstant %float 0.7 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_out_depth + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.7; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1.amber new file mode 100644 index 0000000..0d91a49 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1.amber @@ -0,0 +1,145 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthGreater' execution mode. +# Polygon depth: 0.7 +# FragDepth: 0.6 +# Depth compare op: greater +# Execution mode: DepthGreater +# Depth buffer clear value: 0.5 +# Description: FragDepth < Polygon depth: violates the promise that FragDepth is greater than the implicit depth, but the depth test should pass. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.7, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_greater) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = 0.6; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthGreater + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_out_depth = OpConstant %float 0.6 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_out_depth + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.6; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2.amber new file mode 100644 index 0000000..1d6b0d6 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2.amber @@ -0,0 +1,145 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthGreater' execution mode. +# Polygon depth: 0.2 +# FragDepth: 0.3 +# Depth compare op: greater +# Execution mode: DepthGreater +# Depth buffer clear value: 0.5 +# Description: FragDepth > Polygon depth: depth test should fail. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.2, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_greater) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = 0.3; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthGreater + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_out_depth = OpConstant %float 0.3 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_out_depth + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.5; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_3.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_3.amber new file mode 100644 index 0000000..022b796 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_3.amber @@ -0,0 +1,145 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthGreater' execution mode. +# Polygon depth: 0.4 +# FragDepth: 0.3 +# Depth compare op: greater +# Execution mode: DepthGreater +# Depth buffer clear value: 0.5 +# Description: FragDepth > Polygon depth: violates the promise that FragDepth is greater than the implicit depth, the depth test should fail. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.4, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_greater) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = 0.3; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthGreater + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_out_depth = OpConstant %float 0.3 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_out_depth + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.5; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_4.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_4.amber new file mode 100644 index 0000000..30a9710 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthgreater_4.amber @@ -0,0 +1,145 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthGreater' execution mode. +# Polygon depth: 0.4 +# FragDepth: 0.6 +# Depth compare op: greater +# Execution mode: DepthGreater +# Depth buffer clear value: 0.5 +# Description: FragDepth > Polygon depth: depth test should pass. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.4, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_greater) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = 0.6; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthGreater + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_out_depth = OpConstant %float 0.6 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_out_depth + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.6; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_0.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_0.amber new file mode 100644 index 0000000..fc6a3af --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_0.amber @@ -0,0 +1,145 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthLess' execution mode. +# Polygon depth: 0.2 +# FragDepth: 0.1 +# Depth compare op: less +# Execution mode: DepthLess +# Depth buffer clear value: 0.5 +# Description: FragDepth < Polygon depth: depth test should pass. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.2, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_less) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = 0.1; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthLess + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_out_depth = OpConstant %float 0.1 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_out_depth + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.1; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_1.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_1.amber new file mode 100644 index 0000000..a496dbf --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_1.amber @@ -0,0 +1,145 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthLess' execution mode. +# Polygon depth: 0.2 +# FragDepth: 0.3 +# Depth compare op: less +# Execution mode: DepthLess +# Depth buffer clear value: 0.5 +# Description: FragDepth > Polygon depth: violates the promise that FragDepth is less than the implicit depth, but the depth test should pass. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.2, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_less) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = 0.3; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthLess + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_out_depth = OpConstant %float 0.3 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_out_depth + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.3; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_2.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_2.amber new file mode 100644 index 0000000..9c2facd --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_2.amber @@ -0,0 +1,145 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthLess' execution mode. +# Polygon depth: 0.7 +# FragDepth: 0.6 +# Depth compare op: less +# Execution mode: DepthLess +# Depth buffer clear value: 0.5 +# Description: FragDepth < Polygon depth: depth test should fail. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.7, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_less) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = 0.6; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthLess + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_out_depth = OpConstant %float 0.6 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_out_depth + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.5; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_3.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_3.amber new file mode 100644 index 0000000..82b1227 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_3.amber @@ -0,0 +1,145 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthLess' execution mode. +# Polygon depth: 0.6 +# FragDepth: 0.7 +# Depth compare op: less +# Execution mode: DepthLess +# Depth buffer clear value: 0.5 +# Description: FragDepth > Polygon depth: violates the promise that FragDepth is less than the implicit depth, the depth test should fail. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.6, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_less) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = 0.7; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthLess + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_out_depth = OpConstant %float 0.7 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_out_depth + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.5; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_4.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_4.amber new file mode 100644 index 0000000..92b68b2 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthless_4.amber @@ -0,0 +1,145 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthLess' execution mode. +# Polygon depth: 0.6 +# FragDepth: 0.3 +# Depth compare op: less +# Execution mode: DepthLess +# Depth buffer clear value: 0.5 +# Description: FragDepth < Polygon depth: depth test should pass. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.6, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_less) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = 0.3; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthLess + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_out_depth = OpConstant %float 0.3 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_out_depth + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP less + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.3; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0.amber new file mode 100644 index 0000000..3e83a1c --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0.amber @@ -0,0 +1,153 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthUnchanged' execution mode. +# Polygon depth: 0.6 +# FragDepth: gl_FragCoord.y +# Depth compare op: greater +# Execution mode: DepthUnchanged +# Depth buffer clear value: 0.5 +# Description: FragDepth == Polygon depth: depth test should pass. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.6, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_unchanged) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = gl_FragCoord.y; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthUnchanged + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Input_float = OpTypePointer Input %float + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + %19 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_2 + %20 = OpLoad %float %19 + OpStore %gl_FragDepth %20 + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.6; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_1.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_1.amber new file mode 100644 index 0000000..66a894e --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_1.amber @@ -0,0 +1,153 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthUnchanged' execution mode. +# Polygon depth: 0.4 +# FragDepth: gl_FragCoord.y +# Depth compare op: greater +# Execution mode: DepthUnchanged +# Depth buffer clear value: 0.5 +# Description: FragDepth == Polygon depth: depth test should fail. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.4, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_unchanged) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = gl_FragCoord.y; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthUnchanged + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Input_float = OpTypePointer Input %float + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + %19 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_2 + %20 = OpLoad %float %19 + OpStore %gl_FragDepth %20 + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.5; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2.amber new file mode 100644 index 0000000..5954e9e --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2.amber @@ -0,0 +1,145 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthUnchanged' execution mode. +# Polygon depth: 0.6 +# FragDepth: 0.7 +# Depth compare op: greater +# Execution mode: DepthUnchanged +# Depth buffer clear value: 0.5 +# Description: FragDepth != Polygon depth: violates the promise that FragDepth is equal to the implicit depth, the depth test should pass. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.6, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_unchanged) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = 0.7; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthUnchanged + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_out_depth = OpConstant %float 0.7 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_out_depth + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.7; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3.amber b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3.amber new file mode 100644 index 0000000..15cc22f --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3.amber @@ -0,0 +1,145 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test 'DepthUnchanged' execution mode. +# Polygon depth: 0.3 +# FragDepth: 0.4 +# Depth compare op: greater +# Execution mode: DepthUnchanged +# Depth buffer clear value: 0.5 +# Description: FragDepth != Polygon depth: violates the promise that FragDepth is equal to the implicit depth, the depth test should fail. + +SHADER vertex vtex_shader GLSL +#version 430 +layout(location = 0) in vec4 position; + +void main() +{ + gl_Position = vec4(position.xy, 0.3, 1.0); +} +END + +# The fragment shader is generated from following GLSL code: +# #version 430 +# +# layout(location = 0) out vec4 outColor; +# layout(depth_unchanged) out float gl_FragDepth; +# +# void main() +# { +# outColor = vec4(0.0, 0.0, 0.0, 0.0); +# gl_FragDepth = 0.4; +# } +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthUnchanged + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_out_depth = OpConstant %float 0.4 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_out_depth + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER depth_buf FORMAT D16_UNORM + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + DEPTH + TEST on + WRITE on + COMPARE_OP greater + CLAMP off + BOUNDS min 0.0 max 1.0 + BIAS constant 0.0 clamp 0.0 slope 0.0 + END + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER depth_buf AS depth_stencil +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR_DEPTH my_pipeline 0.5 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + +# ---------------- VERIFY PIPELINE ------------------ +# This pipeline verifies the dept buffer contents. +# The fragment shader writes color green if the value is expected, +# otherwise red. + +SHADER vertex vtex_shader_verify PASSTHROUGH + +SHADER fragment frag_shader_verify GLSL +#version 430 + +layout(location = 0) out vec4 outColor; +uniform layout(set=0, binding=0) sampler2D imageSampler; +const float expectedValue = 0.5; +const float tolerance = 0.01; + +void main() +{ + float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r; + if (abs(value - expectedValue) < tolerance) + outColor = vec4(0.0, 1.0, 0.0, 1.0); + else + outColor = vec4(1.0, 0.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +PIPELINE graphics verify_pipeline + ATTACH vtex_shader_verify + ATTACH frag_shader_verify + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer_verify AS color LOCATION 0 +END + +CLEAR_COLOR verify_pipeline 0 0 0 255 +CLEAR verify_pipeline +RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/graphics/fragment/mixedrelaxedprecisionoperands.amber b/vulkan/amber/spirv_assembly/instruction/graphics/fragment/mixedrelaxedprecisionoperands.amber new file mode 100644 index 0000000..d85e05d --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/graphics/fragment/mixedrelaxedprecisionoperands.amber @@ -0,0 +1,1436 @@ +#!amber + +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Test OpSelect using a mix of operands with and without RelaxedPrecision + +SHADER vertex vtex_shader GLSL +#version 450 + +layout(location = 0) out vec4 v1; +layout(location = 1) out vec4 v2; +layout(location = 2) out vec4 v3; +layout(location = 3) out vec4 v4; +layout(location = 4) out vec4 v5; +layout(location = 5) out vec4 v6; +layout(location = 6) out vec4 v7; +layout(location = 7) out vec4 v8; + +void main() +{ + v1 = vec4(1.0f); + v2 = vec4(1.0f); + v3 = vec4(1.0f); + v4 = vec4(1.0f); + v5 = vec4(1.0f); + v6 = vec4(1.0f); + v7 = vec4(1.0f); + v8 = vec4(1.0f); + vec2 pos = vec2(float(gl_VertexIndex & 1), float((gl_VertexIndex >> 1) & 1)); + gl_Position = vec4(pos, 0.0f, 1.0f); +} +END + +SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0 + + OpCapability Shader + %58 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %49 %50 %51 %52 %53 %54 %55 %56 %57 %gl_FragCoord + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 450 + OpDecorate %59 SpecId 1 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpMemberDecorate %_struct_43 0 Offset 0 + OpMemberDecorate %_struct_43 1 Offset 64 + OpMemberDecorate %_struct_43 2 Offset 128 + OpMemberDecorate %_struct_43 3 Offset 144 + OpMemberDecorate %_struct_43 4 Offset 160 + OpMemberDecorate %_struct_43 5 Offset 176 + OpMemberDecorate %_struct_43 6 Offset 192 + OpMemberDecorate %_struct_43 7 Offset 224 + OpMemberDecorate %_struct_43 8 Offset 240 + OpMemberDecorate %_struct_43 9 Offset 256 + OpMemberDecorate %_struct_43 10 Offset 272 + OpMemberDecorate %_struct_43 11 Offset 288 + OpMemberDecorate %_struct_43 12 Offset 304 + OpMemberDecorate %_struct_43 13 Offset 320 + OpMemberDecorate %_struct_43 14 Offset 336 + OpMemberDecorate %_struct_43 15 Offset 352 + OpMemberDecorate %_struct_43 16 Offset 368 + OpMemberDecorate %_struct_43 17 Offset 384 + OpMemberDecorate %_struct_43 18 Offset 400 + OpMemberDecorate %_struct_43 19 Offset 416 + OpMemberDecorate %_struct_43 20 Offset 432 + OpMemberDecorate %_struct_43 21 Offset 448 + OpMemberDecorate %_struct_43 22 Offset 464 + OpMemberDecorate %_struct_43 23 Offset 480 + OpMemberDecorate %_struct_43 24 Offset 496 + OpMemberDecorate %_struct_43 25 Offset 512 + OpMemberDecorate %_struct_43 26 Offset 576 + OpMemberDecorate %_struct_43 27 Offset 640 + OpMemberDecorate %_struct_43 3 RelaxedPrecision + OpMemberDecorate %_struct_43 5 RelaxedPrecision + OpMemberDecorate %_struct_43 6 RelaxedPrecision + OpMemberDecorate %_struct_43 8 RelaxedPrecision + OpMemberDecorate %_struct_43 9 RelaxedPrecision + OpMemberDecorate %_struct_43 18 RelaxedPrecision + OpMemberDecorate %_struct_43 19 RelaxedPrecision + OpMemberDecorate %_struct_43 20 RelaxedPrecision + OpMemberDecorate %_struct_43 21 RelaxedPrecision + OpMemberDecorate %_struct_43 22 RelaxedPrecision + OpMemberDecorate %_struct_43 23 RelaxedPrecision + OpMemberDecorate %_struct_43 24 RelaxedPrecision + OpDecorate %_struct_43 Block + OpDecorate %65 DescriptorSet 2 + OpDecorate %65 Binding 0 + OpMemberDecorate %_struct_44 0 Offset 0 + OpMemberDecorate %_struct_44 1 Offset 16 + OpMemberDecorate %_struct_44 2 Offset 32 + OpMemberDecorate %_struct_44 3 Offset 48 + OpMemberDecorate %_struct_44 2 RelaxedPrecision + OpMemberDecorate %_struct_44 3 RelaxedPrecision + OpDecorate %_struct_44 Block + OpDecorate %67 DescriptorSet 2 + OpDecorate %67 Binding 1 + OpDecorate %45 RelaxedPrecision + OpDecorate %45 DescriptorSet 1 + OpDecorate %45 Binding 0 + OpDecorate %46 RelaxedPrecision + OpDecorate %46 DescriptorSet 1 + OpDecorate %46 Binding 1 + OpDecorate %47 RelaxedPrecision + OpDecorate %47 DescriptorSet 1 + OpDecorate %47 Binding 2 + OpDecorate %48 RelaxedPrecision + OpDecorate %48 DescriptorSet 1 + OpDecorate %48 Binding 3 + OpDecorate %49 Location 4 + OpDecorate %50 Location 5 + OpDecorate %51 Location 0 + OpDecorate %52 Location 1 + OpDecorate %53 Location 6 + OpDecorate %54 Location 7 + OpDecorate %55 Location 2 + OpDecorate %56 Location 3 + OpDecorate %57 RelaxedPrecision + OpDecorate %57 Location 0 + OpDecorate %81 RelaxedPrecision + OpDecorate %86 RelaxedPrecision + OpDecorate %87 RelaxedPrecision + OpDecorate %91 RelaxedPrecision + OpDecorate %92 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %94 RelaxedPrecision + OpDecorate %103 RelaxedPrecision + OpDecorate %104 RelaxedPrecision + OpDecorate %105 RelaxedPrecision + OpMemberDecorate %_struct_36 0 Offset 0 + OpMemberDecorate %_struct_36 1 Offset 16 + OpMemberDecorate %_struct_36 2 Offset 32 + OpMemberDecorate %_struct_36 3 Offset 48 + OpMemberDecorate %_struct_36 4 Offset 64 + OpMemberDecorate %_struct_36 5 Offset 80 + OpMemberDecorate %_struct_36 6 Offset 96 + OpMemberDecorate %_struct_36 7 Offset 112 + OpMemberDecorate %_struct_36 8 Offset 176 + OpMemberDecorate %_struct_36 9 Offset 192 + OpMemberDecorate %_struct_36 10 Offset 208 + OpMemberDecorate %_struct_36 11 Offset 224 + OpMemberDecorate %_struct_36 12 Offset 240 + OpMemberDecorate %_struct_36 13 Offset 256 + OpMemberDecorate %_struct_36 1 RelaxedPrecision + OpMemberDecorate %_struct_36 6 RelaxedPrecision + OpMemberDecorate %_struct_36 8 RelaxedPrecision + OpMemberDecorate %_struct_36 9 RelaxedPrecision + OpMemberDecorate %_struct_36 10 RelaxedPrecision + OpMemberDecorate %_struct_36 11 RelaxedPrecision + OpMemberDecorate %_struct_36 12 RelaxedPrecision + OpMemberDecorate %_struct_36 13 RelaxedPrecision + OpDecorate %_struct_36 Block + OpDecorate %107 DescriptorSet 0 + OpDecorate %107 Binding 1 + OpMemberDecorate %_struct_35 0 Offset 0 + OpMemberDecorate %_struct_35 1 Offset 8 + OpMemberDecorate %_struct_35 2 Offset 16 + OpMemberDecorate %_struct_35 3 Offset 20 + OpMemberDecorate %_struct_35 4 Offset 24 + OpMemberDecorate %_struct_35 5 Offset 28 + OpDecorate %_struct_35 Block + OpDecorate %114 RelaxedPrecision + OpDecorate %121 RelaxedPrecision + OpDecorate %122 RelaxedPrecision + OpDecorate %123 RelaxedPrecision + OpDecorate %124 RelaxedPrecision + OpDecorate %128 RelaxedPrecision + OpDecorate %129 RelaxedPrecision + OpDecorate %130 RelaxedPrecision + OpDecorate %131 RelaxedPrecision + OpDecorate %132 RelaxedPrecision + OpDecorate %133 RelaxedPrecision + OpDecorate %134 RelaxedPrecision + OpDecorate %135 RelaxedPrecision + OpDecorate %136 RelaxedPrecision + OpDecorate %137 RelaxedPrecision + OpDecorate %140 RelaxedPrecision + OpDecorate %141 RelaxedPrecision + OpDecorate %143 RelaxedPrecision + OpDecorate %144 RelaxedPrecision + OpDecorate %145 RelaxedPrecision + OpDecorate %146 RelaxedPrecision + OpDecorate %147 RelaxedPrecision + OpDecorate %149 RelaxedPrecision + OpDecorate %150 RelaxedPrecision + OpDecorate %151 RelaxedPrecision + OpDecorate %153 RelaxedPrecision + OpDecorate %154 RelaxedPrecision + OpDecorate %155 RelaxedPrecision + OpDecorate %156 RelaxedPrecision + OpDecorate %158 RelaxedPrecision + OpDecorate %159 RelaxedPrecision + OpDecorate %160 RelaxedPrecision + OpDecorate %161 RelaxedPrecision + OpDecorate %163 RelaxedPrecision + OpDecorate %164 RelaxedPrecision + OpDecorate %167 RelaxedPrecision + OpDecorate %168 RelaxedPrecision + OpDecorate %171 RelaxedPrecision + OpDecorate %172 RelaxedPrecision + OpDecorate %176 RelaxedPrecision + OpDecorate %177 RelaxedPrecision + OpDecorate %178 RelaxedPrecision + OpDecorate %179 RelaxedPrecision + OpDecorate %180 RelaxedPrecision + OpDecorate %182 RelaxedPrecision + OpDecorate %183 RelaxedPrecision + OpDecorate %191 RelaxedPrecision + OpDecorate %192 RelaxedPrecision + OpDecorate %193 RelaxedPrecision + OpDecorate %196 RelaxedPrecision + OpDecorate %197 RelaxedPrecision + OpDecorate %198 RelaxedPrecision + OpDecorate %201 RelaxedPrecision + OpDecorate %202 RelaxedPrecision + OpDecorate %203 RelaxedPrecision + OpDecorate %204 RelaxedPrecision + OpDecorate %205 RelaxedPrecision + OpDecorate %206 RelaxedPrecision + OpDecorate %207 RelaxedPrecision + OpDecorate %208 RelaxedPrecision + OpDecorate %209 RelaxedPrecision + OpDecorate %210 RelaxedPrecision + OpDecorate %211 RelaxedPrecision + OpDecorate %212 RelaxedPrecision + OpDecorate %295 RelaxedPrecision + OpDecorate %301 RelaxedPrecision + OpDecorate %307 RelaxedPrecision + OpDecorate %311 RelaxedPrecision + OpDecorate %316 RelaxedPrecision + OpDecorate %317 RelaxedPrecision + OpDecorate %318 RelaxedPrecision + OpDecorate %319 RelaxedPrecision + OpDecorate %320 RelaxedPrecision + OpDecorate %325 RelaxedPrecision + OpDecorate %326 RelaxedPrecision + OpDecorate %327 RelaxedPrecision + OpDecorate %330 RelaxedPrecision + OpDecorate %331 RelaxedPrecision + OpDecorate %332 RelaxedPrecision + OpDecorate %337 RelaxedPrecision + OpDecorate %338 RelaxedPrecision + OpDecorate %339 RelaxedPrecision + OpDecorate %342 RelaxedPrecision + OpDecorate %348 RelaxedPrecision + OpDecorate %349 RelaxedPrecision + OpDecorate %355 RelaxedPrecision + OpDecorate %357 RelaxedPrecision + OpDecorate %358 RelaxedPrecision + OpDecorate %363 RelaxedPrecision + OpDecorate %365 RelaxedPrecision + OpDecorate %366 RelaxedPrecision + OpDecorate %371 RelaxedPrecision + OpDecorate %373 RelaxedPrecision + OpDecorate %374 RelaxedPrecision + OpDecorate %377 RelaxedPrecision + OpDecorate %378 RelaxedPrecision + OpDecorate %379 RelaxedPrecision + OpDecorate %382 RelaxedPrecision + OpDecorate %383 RelaxedPrecision + OpDecorate %384 RelaxedPrecision + OpDecorate %387 RelaxedPrecision + OpDecorate %388 RelaxedPrecision + OpDecorate %391 RelaxedPrecision + OpDecorate %401 RelaxedPrecision + OpDecorate %402 RelaxedPrecision + OpDecorate %413 RelaxedPrecision + OpDecorate %416 RelaxedPrecision + OpDecorate %422 RelaxedPrecision + OpDecorate %423 RelaxedPrecision + OpDecorate %433 RelaxedPrecision + OpDecorate %436 RelaxedPrecision + OpDecorate %442 RelaxedPrecision + OpDecorate %443 RelaxedPrecision + OpDecorate %453 RelaxedPrecision + OpDecorate %456 RelaxedPrecision + OpDecorate %462 RelaxedPrecision + OpDecorate %463 RelaxedPrecision + OpDecorate %473 RelaxedPrecision + OpDecorate %476 RelaxedPrecision + OpDecorate %480 RelaxedPrecision + OpDecorate %481 RelaxedPrecision + OpDecorate %490 RelaxedPrecision + OpDecorate %493 RelaxedPrecision + OpDecorate %494 RelaxedPrecision + OpDecorate %496 RelaxedPrecision + OpDecorate %497 RelaxedPrecision + OpDecorate %498 RelaxedPrecision + OpDecorate %499 RelaxedPrecision + OpDecorate %501 RelaxedPrecision + OpDecorate %502 RelaxedPrecision + OpDecorate %503 RelaxedPrecision + OpDecorate %504 RelaxedPrecision + OpDecorate %517 RelaxedPrecision + OpDecorate %518 RelaxedPrecision + OpDecorate %530 RelaxedPrecision + OpDecorate %533 RelaxedPrecision + OpDecorate %537 RelaxedPrecision + OpDecorate %538 RelaxedPrecision + OpDecorate %539 RelaxedPrecision + OpDecorate %541 RelaxedPrecision + OpDecorate %543 RelaxedPrecision + OpDecorate %550 RelaxedPrecision + OpDecorate %551 RelaxedPrecision + OpDecorate %552 RelaxedPrecision + OpDecorate %553 RelaxedPrecision + OpDecorate %554 RelaxedPrecision + OpDecorate %555 RelaxedPrecision + OpDecorate %566 RelaxedPrecision + OpDecorate %567 RelaxedPrecision + OpDecorate %568 RelaxedPrecision + OpDecorate %569 RelaxedPrecision + OpDecorate %570 RelaxedPrecision + OpDecorate %571 RelaxedPrecision + OpDecorate %572 RelaxedPrecision + OpDecorate %573 RelaxedPrecision + OpDecorate %574 RelaxedPrecision + OpDecorate %575 RelaxedPrecision + OpDecorate %576 RelaxedPrecision + OpDecorate %578 RelaxedPrecision + OpDecorate %579 RelaxedPrecision + OpDecorate %580 RelaxedPrecision + OpDecorate %583 RelaxedPrecision + OpDecorate %584 RelaxedPrecision + OpDecorate %586 RelaxedPrecision + OpDecorate %587 RelaxedPrecision + OpDecorate %588 RelaxedPrecision + OpDecorate %589 RelaxedPrecision + OpDecorate %590 RelaxedPrecision + OpDecorate %591 RelaxedPrecision + OpDecorate %592 RelaxedPrecision + OpDecorate %593 RelaxedPrecision + OpDecorate %594 RelaxedPrecision + OpDecorate %596 RelaxedPrecision + OpDecorate %597 RelaxedPrecision + OpDecorate %598 RelaxedPrecision + OpDecorate %599 RelaxedPrecision + OpDecorate %600 RelaxedPrecision + OpDecorate %602 RelaxedPrecision + OpDecorate %603 RelaxedPrecision + OpDecorate %604 RelaxedPrecision + OpDecorate %605 RelaxedPrecision + OpDecorate %606 RelaxedPrecision + OpDecorate %607 RelaxedPrecision + OpDecorate %608 RelaxedPrecision + OpDecorate %609 RelaxedPrecision + OpDecorate %610 RelaxedPrecision + OpDecorate %612 RelaxedPrecision + OpDecorate %614 RelaxedPrecision + OpDecorate %615 RelaxedPrecision + OpDecorate %618 RelaxedPrecision + OpDecorate %620 RelaxedPrecision + OpDecorate %621 RelaxedPrecision + OpDecorate %622 RelaxedPrecision + OpDecorate %623 RelaxedPrecision + OpDecorate %624 RelaxedPrecision + OpDecorate %625 RelaxedPrecision + OpDecorate %627 RelaxedPrecision + OpDecorate %628 RelaxedPrecision + OpDecorate %635 RelaxedPrecision + OpDecorate %636 RelaxedPrecision + OpDecorate %638 RelaxedPrecision + OpDecorate %640 RelaxedPrecision + OpDecorate %641 RelaxedPrecision + OpDecorate %643 RelaxedPrecision + OpDecorate %644 RelaxedPrecision + OpDecorate %645 RelaxedPrecision + OpDecorate %704 RelaxedPrecision + OpDecorate %705 RelaxedPrecision + OpDecorate %725 RelaxedPrecision + OpDecorate %726 RelaxedPrecision + OpDecorate %728 RelaxedPrecision + OpDecorate %729 RelaxedPrecision + OpDecorate %730 RelaxedPrecision + OpDecorate %731 RelaxedPrecision + OpDecorate %732 RelaxedPrecision + OpDecorate %733 RelaxedPrecision + OpDecorate %734 RelaxedPrecision + OpDecorate %735 RelaxedPrecision + OpDecorate %738 RelaxedPrecision + OpDecorate %740 RelaxedPrecision + OpDecorate %742 RelaxedPrecision + OpDecorate %744 RelaxedPrecision + OpDecorate %745 RelaxedPrecision + OpDecorate %746 RelaxedPrecision + OpDecorate %747 RelaxedPrecision + OpDecorate %748 RelaxedPrecision + OpDecorate %749 RelaxedPrecision + OpDecorate %751 RelaxedPrecision + OpDecorate %752 RelaxedPrecision + OpDecorate %753 RelaxedPrecision + OpDecorate %754 RelaxedPrecision + OpDecorate %755 RelaxedPrecision + OpDecorate %756 RelaxedPrecision + OpDecorate %759 RelaxedPrecision + OpDecorate %760 RelaxedPrecision + OpDecorate %761 RelaxedPrecision + OpDecorate %762 RelaxedPrecision + OpDecorate %763 RelaxedPrecision + OpDecorate %766 RelaxedPrecision + OpDecorate %769 RelaxedPrecision + OpDecorate %770 RelaxedPrecision + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %800 RelaxedPrecision + OpDecorate %803 RelaxedPrecision + OpDecorate %804 RelaxedPrecision + OpDecorate %809 RelaxedPrecision + OpDecorate %816 RelaxedPrecision + OpDecorate %817 RelaxedPrecision + OpDecorate %818 RelaxedPrecision + OpDecorate %819 RelaxedPrecision + OpDecorate %820 RelaxedPrecision + OpDecorate %821 RelaxedPrecision + OpDecorate %822 RelaxedPrecision + OpDecorate %823 RelaxedPrecision + OpDecorate %824 RelaxedPrecision + OpDecorate %825 RelaxedPrecision + OpDecorate %826 RelaxedPrecision + OpDecorate %827 RelaxedPrecision + OpDecorate %828 RelaxedPrecision + OpDecorate %829 RelaxedPrecision + %void = OpTypeVoid + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %59 = OpSpecConstant %uint 0 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %uint_2 = OpConstant %uint 2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 + %_struct_43 = OpTypeStruct %_arr_v4float_uint_4 %_arr_v4float_uint_4 %v4float %v4float %v4float %v4float %_arr_v4float_uint_2 %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %_arr_v4float_uint_4 %_arr_v4float_uint_4 %v4float + %_struct_44 = OpTypeStruct %v4float %v4float %float %v4float + %68 = OpTypeImage %float 3D 0 0 0 1 Unknown + %69 = OpTypeSampledImage %68 + %71 = OpTypeImage %float 2D 1 0 0 1 Unknown + %72 = OpTypeSampledImage %71 + %74 = OpTypeImage %float 2D 0 0 0 1 Unknown + %75 = OpTypeSampledImage %74 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %_struct_36 = OpTypeStruct %v4float %v4float %v3float %v4float %v2float %v4float %v4float %_arr_v4float_uint_4 %v4float %v4float %v4float %v4float %v4float %v4float + %v2uint = OpTypeVector %uint 2 + %_struct_35 = OpTypeStruct %v2uint %v2float %uint %uint %uint %uint + %uint_0 = OpConstant %uint 0 + %uint_3 = OpConstant %uint 3 +%float_9_99999975en06 = OpConstant %float 9.99999975e-06 +%float_0_125 = OpConstant %float 0.125 + %float_8 = OpConstant %float 8 + %float_0_5 = OpConstant %float 0.5 + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %190 = OpConstantComposite %v2float %float_0_125 %float_1 +%float_1_17549435en38 = OpConstant %float 1.17549435e-38 + %uint_7 = OpConstant %uint 7 + %float_0 = OpConstant %float 0 + %uint_5 = OpConstant %uint 5 + %uint_18 = OpConstant %uint 18 + %uint_19 = OpConstant %uint 19 + %uint_20 = OpConstant %uint 20 +%float_12_9200001 = OpConstant %float 12.9200001 + %315 = OpConstantComposite %v3float %float_12_9200001 %float_12_9200001 %float_12_9200001 +%float_0_416666657 = OpConstant %float 0.416666657 + %324 = OpConstantComposite %v3float %float_0_416666657 %float_0_416666657 %float_0_416666657 +%float_1_05499995 = OpConstant %float 1.05499995 + %336 = OpConstantComposite %v3float %float_1_05499995 %float_1_05499995 %float_1_05499995 +%float_n0_0549999997 = OpConstant %float -0.0549999997 + %341 = OpConstantComposite %v3float %float_n0_0549999997 %float_n0_0549999997 %float_n0_0549999997 +%float_0_00313080009 = OpConstant %float 0.00313080009 + %346 = OpConstantComposite %v4float %float_0_00313080009 %float_0_00313080009 %float_0_00313080009 %float_0_00313080009 + %v4bool = OpTypeVector %bool 4 + %376 = OpConstantNull %v3float + %uint_13 = OpConstant %uint 13 +%float_0_959999979 = OpConstant %float 0.959999979 + %386 = OpConstantComposite %v3float %float_0_959999979 %float_0_959999979 %float_0_959999979 + %uint_12 = OpConstant %uint 12 + %uint_8 = OpConstant %uint 8 + %uint_9 = OpConstant %uint 9 + %uint_10 = OpConstant %uint 10 + %uint_11 = OpConstant %uint 11 + %float_0_25 = OpConstant %float 0.25 + %479 = OpConstantComposite %v4float %float_0_25 %float_0_25 %float_0_25 %float_0_25 +%float_4_05000019 = OpConstant %float 4.05000019 + %float_n1 = OpConstant %float -1 +%float_0_0399999991 = OpConstant %float 0.0399999991 +%float_0_941176474 = OpConstant %float 0.941176474 +%float_n0_9375 = OpConstant %float -0.9375 +%float_1_00001001 = OpConstant %float 1.00001001 +%float_0_100000001 = OpConstant %float 0.100000001 + %float_3 = OpConstant %float 3 +%float_0_0625 = OpConstant %float 0.0625 +%float_n6_10351562en05 = OpConstant %float -6.10351562e-05 + %727 = OpConstantComposite %v3float %float_0_0399999991 %float_0_0399999991 %float_0_0399999991 + %uint_6 = OpConstant %uint 6 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%float_n0_01171875 = OpConstant %float -0.01171875 +%float_0_00390625 = OpConstant %float 0.00390625 +%float_0_01171875 = OpConstant %float 0.01171875 +%float_n0_00390625 = OpConstant %float -0.00390625 + %787 = OpConstantComposite %_arr_float_uint_4 %float_n0_01171875 %float_0_00390625 %float_0_01171875 %float_n0_00390625 + %float_2 = OpConstant %float 2 +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Private_v4float = OpTypePointer Private %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_ptr_Uniform__struct_43 = OpTypePointer Uniform %_struct_43 +%_ptr_Uniform__struct_44 = OpTypePointer Uniform %_struct_44 +%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69 +%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72 +%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75 +%_ptr_Private_v3float = OpTypePointer Private %v3float +%_ptr_Input_v3float = OpTypePointer Input %v3float +%_ptr_Private_v4float_0 = OpTypePointer Private %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Private_v4float_1 = OpTypePointer Private %v4float +%_ptr_Private_bool = OpTypePointer Private %bool +%_ptr_Private_v3float_0 = OpTypePointer Private %v3float +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Private_v3bool = OpTypePointer Private %v3bool +%_ptr_Uniform__struct_36 = OpTypePointer Uniform %_struct_36 +%_ptr_PushConstant__struct_35 = OpTypePointer PushConstant %_struct_35 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Private_float_0 = OpTypePointer Private %float +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%_ptr_Private_float_1 = OpTypePointer Private %float +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Private_uint = OpTypePointer Private %uint + %111 = OpTypeFunction %void + %65 = OpVariable %_ptr_Uniform__struct_43 Uniform + %67 = OpVariable %_ptr_Uniform__struct_44 Uniform + %45 = OpVariable %_ptr_UniformConstant_69 UniformConstant + %46 = OpVariable %_ptr_UniformConstant_72 UniformConstant + %47 = OpVariable %_ptr_UniformConstant_75 UniformConstant + %48 = OpVariable %_ptr_UniformConstant_75 UniformConstant + %49 = OpVariable %_ptr_Input_v3float Input + %50 = OpVariable %_ptr_Input_v3float Input + %51 = OpVariable %_ptr_Input_v4float Input + %52 = OpVariable %_ptr_Input_v4float Input + %53 = OpVariable %_ptr_Input_v3float Input + %54 = OpVariable %_ptr_Input_v3float Input + %55 = OpVariable %_ptr_Input_v4float Input + %56 = OpVariable %_ptr_Input_v4float Input + %57 = OpVariable %_ptr_Output_v4float Output + %80 = OpVariable %_ptr_Private_v4float_1 Private + %81 = OpVariable %_ptr_Private_v4float_1 Private + %84 = OpVariable %_ptr_Private_bool Private + %86 = OpVariable %_ptr_Private_v3float_0 Private + %87 = OpVariable %_ptr_Private_v3float_0 Private + %88 = OpVariable %_ptr_Private_v3float_0 Private + %90 = OpVariable %_ptr_Private_float Private + %91 = OpVariable %_ptr_Private_v3float_0 Private + %92 = OpVariable %_ptr_Private_v4float_1 Private + %93 = OpVariable %_ptr_Private_v3float_0 Private + %94 = OpVariable %_ptr_Private_v3float_0 Private + %95 = OpVariable %_ptr_Private_float Private + %96 = OpVariable %_ptr_Private_v3float_0 Private + %97 = OpVariable %_ptr_Private_v3float_0 Private + %100 = OpVariable %_ptr_Private_v3bool Private + %101 = OpVariable %_ptr_Private_float Private + %102 = OpVariable %_ptr_Private_bool Private + %103 = OpVariable %_ptr_Private_float Private + %104 = OpVariable %_ptr_Private_float Private + %105 = OpVariable %_ptr_Private_float Private + %107 = OpVariable %_ptr_Uniform__struct_36 Uniform + %110 = OpVariable %_ptr_PushConstant__struct_35 PushConstant +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %804 = OpVariable %_ptr_Private_float Private + %808 = OpVariable %_ptr_Private_uint Private + %112 = OpFunction %void None %111 + %113 = OpLabel + %412 = OpVariable %_ptr_Function_v3float Function + %432 = OpVariable %_ptr_Function_v3float Function + %452 = OpVariable %_ptr_Function_v3float Function + %472 = OpVariable %_ptr_Function_v3float Function + %489 = OpVariable %_ptr_Function_v3float Function + %114 = OpLoad %75 %47 + %115 = OpLoad %v4float %51 + %116 = OpVectorShuffle %v2float %115 %115 0 1 + %119 = OpAccessChain %_ptr_Uniform_float %107 %uint_4 %uint_0 + %120 = OpLoad %float %119 + %121 = OpImageSampleImplicitLod %v4float %114 %116 Bias %120 + OpStore %81 %121 + %122 = OpLoad %v4float %81 + %123 = OpVectorShuffle %v3float %122 %122 0 1 2 + %124 = OpFNegate %v3float %123 + %127 = OpAccessChain %_ptr_Uniform_v4float %67 %uint_3 + %128 = OpLoad %v4float %127 + %129 = OpVectorShuffle %v3float %128 %128 0 1 2 + %130 = OpFAdd %v3float %124 %129 + OpStore %86 %130 + %131 = OpLoad %v4float %81 + %132 = OpVectorShuffle %v3float %131 %131 3 3 3 + %133 = OpLoad %v3float %86 + %134 = OpFMul %v3float %132 %133 + %135 = OpLoad %v4float %81 + %136 = OpVectorShuffle %v3float %135 %135 0 1 2 + %137 = OpFAdd %v3float %134 %136 + OpStore %86 %137 + %139 = OpAccessChain %_ptr_Uniform_float %67 %uint_2 + %140 = OpLoad %float %139 + %141 = OpFAdd %float %140 %float_9_99999975en06 + OpStore %103 %141 + %143 = OpLoad %float %103 + %144 = OpFMul %float %143 %float_0_125 + OpStore %103 %144 + %145 = OpLoad %float %103 + %146 = OpFNegate %float %145 + %147 = OpLoad %float %103 + %148 = OpFOrdGreaterThanEqual %bool %147 %146 + OpStore %84 %148 + %149 = OpLoad %float %103 + %150 = OpExtInst %float %58 FAbs %149 + %151 = OpExtInst %float %58 Fract %150 + OpStore %103 %151 + %152 = OpLoad %bool %84 + %153 = OpLoad %float %103 + %154 = OpLoad %float %103 + %155 = OpFNegate %float %154 + %156 = OpSelect %float %152 %153 %155 + OpStore %103 %156 + %158 = OpLoad %float %103 + %159 = OpFMul %float %158 %float_8 + OpStore %103 %159 + %160 = OpLoad %float %103 + %161 = OpExtInst %float %58 Floor %160 + OpStore %103 %161 + %163 = OpLoad %float %103 + %164 = OpFAdd %float %163 %float_0_5 + %165 = OpAccessChain %_ptr_Private_float %87 %uint_0 + OpStore %165 %164 + %166 = OpAccessChain %_ptr_Private_float %87 %uint_0 + %167 = OpLoad %float %166 + %168 = OpFMul %float %167 %float_0_125 + %169 = OpAccessChain %_ptr_Private_float %87 %uint_0 + OpStore %169 %168 + %170 = OpAccessChain %_ptr_Private_float %87 %uint_0 + %171 = OpLoad %float %170 + %172 = OpExtInst %float %58 Floor %171 + %174 = OpAccessChain %_ptr_Private_float %87 %uint_1 + OpStore %174 %172 + %175 = OpAccessChain %_ptr_Private_float %87 %uint_1 + %176 = OpLoad %float %175 + %177 = OpFNegate %float %176 + %178 = OpFMul %float %177 %float_8 + %179 = OpLoad %float %103 + %180 = OpFAdd %float %178 %179 + %181 = OpAccessChain %_ptr_Private_float %87 %uint_0 + OpStore %181 %180 + %182 = OpLoad %v3float %87 + %183 = OpVectorShuffle %v2float %182 %182 0 1 + %184 = OpLoad %v4float %52 + %185 = OpVectorShuffle %v2float %184 %184 0 1 + %186 = OpFAdd %v2float %183 %185 + %187 = OpLoad %v3float %87 + %188 = OpVectorShuffle %v3float %187 %186 3 4 2 + OpStore %87 %188 + %191 = OpLoad %v3float %87 + %192 = OpVectorShuffle %v2float %191 %191 0 1 + %193 = OpFMul %v2float %192 %190 + %194 = OpLoad %v3float %87 + %195 = OpVectorShuffle %v3float %194 %193 3 4 2 + OpStore %87 %195 + %196 = OpLoad %75 %48 + %197 = OpLoad %v3float %87 + %198 = OpVectorShuffle %v2float %197 %197 0 1 + %199 = OpAccessChain %_ptr_Uniform_float %107 %uint_4 %uint_0 + %200 = OpLoad %float %199 + %201 = OpImageSampleImplicitLod %v4float %196 %198 Bias %200 + OpStore %81 %201 + %202 = OpLoad %v3float %86 + %203 = OpFNegate %v3float %202 + %204 = OpLoad %v4float %81 + %205 = OpVectorShuffle %v3float %204 %204 0 1 2 + %206 = OpFAdd %v3float %203 %205 + OpStore %87 %206 + %207 = OpLoad %v4float %81 + %208 = OpVectorShuffle %v3float %207 %207 3 3 3 + %209 = OpLoad %v3float %87 + %210 = OpFMul %v3float %208 %209 + %211 = OpLoad %v3float %86 + %212 = OpFAdd %v3float %210 %211 + OpStore %86 %212 + %213 = OpLoad %v3float %50 + %214 = OpLoad %v3float %50 + %215 = OpDot %float %213 %214 + %216 = OpAccessChain %_ptr_Private_float %80 %uint_0 + OpStore %216 %215 + %218 = OpAccessChain %_ptr_Private_float %80 %uint_0 + %219 = OpLoad %float %218 + %220 = OpExtInst %float %58 FMax %219 %float_1_17549435en38 + %221 = OpAccessChain %_ptr_Private_float %80 %uint_0 + OpStore %221 %220 + %222 = OpAccessChain %_ptr_Private_float %80 %uint_0 + %223 = OpLoad %float %222 + %224 = OpExtInst %float %58 InverseSqrt %223 + %225 = OpAccessChain %_ptr_Private_float %80 %uint_0 + OpStore %225 %224 + %226 = OpLoad %v4float %80 + %227 = OpVectorShuffle %v3float %226 %226 0 0 0 + %228 = OpLoad %v3float %50 + %229 = OpFMul %v3float %227 %228 + %230 = OpLoad %v4float %80 + %231 = OpVectorShuffle %v4float %230 %229 4 5 6 3 + OpStore %80 %231 + %232 = OpLoad %v3float %53 + %233 = OpLoad %v3float %53 + %234 = OpDot %float %232 %233 + %235 = OpAccessChain %_ptr_Private_float %88 %uint_0 + OpStore %235 %234 + %236 = OpAccessChain %_ptr_Private_float %88 %uint_0 + %237 = OpLoad %float %236 + %238 = OpExtInst %float %58 FMax %237 %float_1_17549435en38 + %239 = OpAccessChain %_ptr_Private_float %88 %uint_0 + OpStore %239 %238 + %240 = OpAccessChain %_ptr_Private_float %88 %uint_0 + %241 = OpLoad %float %240 + %242 = OpExtInst %float %58 InverseSqrt %241 + %243 = OpAccessChain %_ptr_Private_float %88 %uint_0 + OpStore %243 %242 + %244 = OpLoad %v3float %88 + %245 = OpVectorShuffle %v3float %244 %244 0 0 0 + %246 = OpLoad %v3float %53 + %247 = OpFMul %v3float %245 %246 + OpStore %96 %247 + %249 = OpAccessChain %_ptr_Input_float %49 %uint_1 + %250 = OpLoad %float %249 + %252 = OpAccessChain %_ptr_Uniform_float %107 %uint_7 %uint_1 %uint_2 + %253 = OpLoad %float %252 + %254 = OpFMul %float %250 %253 + OpStore %90 %254 + %255 = OpAccessChain %_ptr_Uniform_float %107 %uint_7 %uint_0 %uint_2 + %256 = OpLoad %float %255 + %257 = OpAccessChain %_ptr_Input_float %49 %uint_0 + %258 = OpLoad %float %257 + %259 = OpFMul %float %256 %258 + %260 = OpLoad %float %90 + %261 = OpFAdd %float %259 %260 + OpStore %90 %261 + %262 = OpAccessChain %_ptr_Uniform_float %107 %uint_7 %uint_2 %uint_2 + %263 = OpLoad %float %262 + %264 = OpAccessChain %_ptr_Input_float %49 %uint_2 + %265 = OpLoad %float %264 + %266 = OpFMul %float %263 %265 + %267 = OpLoad %float %90 + %268 = OpFAdd %float %266 %267 + OpStore %90 %268 + %269 = OpLoad %float %90 + %270 = OpAccessChain %_ptr_Uniform_float %107 %uint_7 %uint_3 %uint_2 + %271 = OpLoad %float %270 + %272 = OpFAdd %float %269 %271 + OpStore %90 %272 + %273 = OpLoad %float %90 + %274 = OpFNegate %float %273 + %275 = OpAccessChain %_ptr_Uniform_float %107 %uint_3 %uint_1 + %276 = OpLoad %float %275 + %277 = OpFNegate %float %276 + %278 = OpFAdd %float %274 %277 + OpStore %90 %278 + %280 = OpLoad %float %90 + %281 = OpExtInst %float %58 FMax %280 %float_0 + OpStore %90 %281 + %282 = OpLoad %float %90 + %284 = OpAccessChain %_ptr_Uniform_float %107 %uint_5 %uint_2 + %285 = OpLoad %float %284 + %286 = OpFMul %float %282 %285 + %287 = OpAccessChain %_ptr_Uniform_float %107 %uint_5 %uint_3 + %288 = OpLoad %float %287 + %289 = OpFAdd %float %286 %288 + OpStore %90 %289 + %290 = OpLoad %float %90 + %291 = OpExtInst %float %58 FClamp %290 %float_0 %float_1 + OpStore %90 %291 + %292 = OpAccessChain %_ptr_Private_float %80 %uint_3 + OpStore %292 %float_1 + %294 = OpAccessChain %_ptr_Uniform_v4float %65 %uint_18 + %295 = OpLoad %v4float %294 + %296 = OpLoad %v4float %80 + %297 = OpDot %float %295 %296 + %298 = OpAccessChain %_ptr_Private_float %87 %uint_0 + OpStore %298 %297 + %300 = OpAccessChain %_ptr_Uniform_v4float %65 %uint_19 + %301 = OpLoad %v4float %300 + %302 = OpLoad %v4float %80 + %303 = OpDot %float %301 %302 + %304 = OpAccessChain %_ptr_Private_float %87 %uint_1 + OpStore %304 %303 + %306 = OpAccessChain %_ptr_Uniform_v4float %65 %uint_20 + %307 = OpLoad %v4float %306 + %308 = OpLoad %v4float %80 + %309 = OpDot %float %307 %308 + %310 = OpAccessChain %_ptr_Private_float %87 %uint_2 + OpStore %310 %309 + %311 = OpLoad %v3float %87 + %312 = OpLoad %v3float %54 + %313 = OpFAdd %v3float %311 %312 + OpStore %87 %313 + %316 = OpLoad %v3float %87 + %317 = OpFMul %v3float %316 %315 + OpStore %91 %317 + %318 = OpLoad %v3float %87 + %319 = OpExtInst %v3float %58 FAbs %318 + %320 = OpExtInst %v3float %58 Log2 %319 + %321 = OpLoad %v4float %92 + %322 = OpVectorShuffle %v4float %321 %320 4 5 6 3 + OpStore %92 %322 + %325 = OpLoad %v4float %92 + %326 = OpVectorShuffle %v3float %325 %325 0 1 2 + %327 = OpFMul %v3float %326 %324 + %328 = OpLoad %v4float %92 + %329 = OpVectorShuffle %v4float %328 %327 4 5 6 3 + OpStore %92 %329 + %330 = OpLoad %v4float %92 + %331 = OpVectorShuffle %v3float %330 %330 0 1 2 + %332 = OpExtInst %v3float %58 Exp2 %331 + %333 = OpLoad %v4float %92 + %334 = OpVectorShuffle %v4float %333 %332 4 5 6 3 + OpStore %92 %334 + %337 = OpLoad %v4float %92 + %338 = OpVectorShuffle %v3float %337 %337 0 1 2 + %339 = OpFMul %v3float %338 %336 + %342 = OpFAdd %v3float %339 %341 + %343 = OpLoad %v4float %92 + %344 = OpVectorShuffle %v4float %343 %342 4 5 6 3 + OpStore %92 %344 + %348 = OpLoad %v3float %87 + %349 = OpVectorShuffle %v4float %348 %348 0 1 2 2 + %350 = OpFOrdGreaterThanEqual %v4bool %346 %349 + %351 = OpVectorShuffle %v3bool %350 %350 0 1 2 + OpStore %100 %351 + %352 = OpAccessChain %_ptr_Private_bool %100 %uint_0 + %353 = OpLoad %bool %352 + %354 = OpAccessChain %_ptr_Private_float %91 %uint_0 + %355 = OpLoad %float %354 + %356 = OpAccessChain %_ptr_Private_float %92 %uint_0 + %357 = OpLoad %float %356 + %358 = OpSelect %float %353 %355 %357 + %359 = OpAccessChain %_ptr_Private_float %87 %uint_0 + OpStore %359 %358 + %360 = OpAccessChain %_ptr_Private_bool %100 %uint_1 + %361 = OpLoad %bool %360 + %362 = OpAccessChain %_ptr_Private_float %91 %uint_1 + %363 = OpLoad %float %362 + %364 = OpAccessChain %_ptr_Private_float %92 %uint_1 + %365 = OpLoad %float %364 + %366 = OpSelect %float %361 %363 %365 + %367 = OpAccessChain %_ptr_Private_float %87 %uint_1 + OpStore %367 %366 + %368 = OpAccessChain %_ptr_Private_bool %100 %uint_2 + %369 = OpLoad %bool %368 + %370 = OpAccessChain %_ptr_Private_float %91 %uint_2 + %371 = OpLoad %float %370 + %372 = OpAccessChain %_ptr_Private_float %92 %uint_2 + %373 = OpLoad %float %372 + %374 = OpSelect %float %369 %371 %373 + %375 = OpAccessChain %_ptr_Private_float %87 %uint_2 + OpStore %375 %374 + %377 = OpLoad %v3float %87 + %378 = OpExtInst %v3float %58 FMax %377 %376 + OpStore %87 %378 + %379 = OpLoad %v3float %86 + %381 = OpAccessChain %_ptr_Uniform_v4float %107 %uint_13 + %382 = OpLoad %v4float %381 + %383 = OpVectorShuffle %v3float %382 %382 1 1 1 + %384 = OpFMul %v3float %379 %383 + OpStore %91 %384 + %387 = OpLoad %v3float %91 + %388 = OpFMul %v3float %387 %386 + OpStore %91 %388 + %390 = OpAccessChain %_ptr_Uniform_float %107 %uint_12 %uint_1 + %391 = OpLoad %float %390 + %392 = OpFUnordNotEqual %bool %391 %float_0 + OpStore %102 %392 + %393 = OpLoad %bool %102 + OpSelectionMerge %396 None + OpBranchConditional %393 %394 %395 + %394 = OpLabel + %397 = OpLoad %v4float %56 + %398 = OpVectorShuffle %v3float %397 %397 0 1 2 + %400 = OpAccessChain %_ptr_Uniform_v4float %107 %uint_8 + %401 = OpLoad %v4float %400 + %402 = OpVectorShuffle %v3float %401 %401 0 1 2 + %403 = OpFAdd %v3float %398 %402 + OpStore %97 %403 + %404 = OpLoad %v3float %97 + %405 = OpVectorShuffle %v2float %404 %404 0 1 + %406 = OpAccessChain %_ptr_Private_float %97 %uint_2 + %407 = OpLoad %float %406 + %408 = OpCompositeExtract %float %405 0 + %409 = OpCompositeExtract %float %405 1 + %410 = OpCompositeConstruct %v3float %408 %409 %407 + OpStore %412 %410 + %413 = OpLoad %72 %46 + %414 = OpLoad %v3float %412 + %415 = OpCompositeExtract %float %414 2 + %416 = OpImageSampleDrefExplicitLod %float %413 %414 %415 Lod %float_0 + %417 = OpAccessChain %_ptr_Private_float %92 %uint_0 + OpStore %417 %416 + %418 = OpLoad %v4float %56 + %419 = OpVectorShuffle %v3float %418 %418 0 1 2 + %421 = OpAccessChain %_ptr_Uniform_v4float %107 %uint_9 + %422 = OpLoad %v4float %421 + %423 = OpVectorShuffle %v3float %422 %422 0 1 2 + %424 = OpFAdd %v3float %419 %423 + OpStore %97 %424 + %425 = OpLoad %v3float %97 + %426 = OpVectorShuffle %v2float %425 %425 0 1 + %427 = OpAccessChain %_ptr_Private_float %97 %uint_2 + %428 = OpLoad %float %427 + %429 = OpCompositeExtract %float %426 0 + %430 = OpCompositeExtract %float %426 1 + %431 = OpCompositeConstruct %v3float %429 %430 %428 + OpStore %432 %431 + %433 = OpLoad %72 %46 + %434 = OpLoad %v3float %432 + %435 = OpCompositeExtract %float %434 2 + %436 = OpImageSampleDrefExplicitLod %float %433 %434 %435 Lod %float_0 + %437 = OpAccessChain %_ptr_Private_float %92 %uint_1 + OpStore %437 %436 + %438 = OpLoad %v4float %56 + %439 = OpVectorShuffle %v3float %438 %438 0 1 2 + %441 = OpAccessChain %_ptr_Uniform_v4float %107 %uint_10 + %442 = OpLoad %v4float %441 + %443 = OpVectorShuffle %v3float %442 %442 0 1 2 + %444 = OpFAdd %v3float %439 %443 + OpStore %97 %444 + %445 = OpLoad %v3float %97 + %446 = OpVectorShuffle %v2float %445 %445 0 1 + %447 = OpAccessChain %_ptr_Private_float %97 %uint_2 + %448 = OpLoad %float %447 + %449 = OpCompositeExtract %float %446 0 + %450 = OpCompositeExtract %float %446 1 + %451 = OpCompositeConstruct %v3float %449 %450 %448 + OpStore %452 %451 + %453 = OpLoad %72 %46 + %454 = OpLoad %v3float %452 + %455 = OpCompositeExtract %float %454 2 + %456 = OpImageSampleDrefExplicitLod %float %453 %454 %455 Lod %float_0 + %457 = OpAccessChain %_ptr_Private_float %92 %uint_2 + OpStore %457 %456 + %458 = OpLoad %v4float %56 + %459 = OpVectorShuffle %v3float %458 %458 0 1 2 + %461 = OpAccessChain %_ptr_Uniform_v4float %107 %uint_11 + %462 = OpLoad %v4float %461 + %463 = OpVectorShuffle %v3float %462 %462 0 1 2 + %464 = OpFAdd %v3float %459 %463 + OpStore %97 %464 + %465 = OpLoad %v3float %97 + %466 = OpVectorShuffle %v2float %465 %465 0 1 + %467 = OpAccessChain %_ptr_Private_float %97 %uint_2 + %468 = OpLoad %float %467 + %469 = OpCompositeExtract %float %466 0 + %470 = OpCompositeExtract %float %466 1 + %471 = OpCompositeConstruct %v3float %469 %470 %468 + OpStore %472 %471 + %473 = OpLoad %72 %46 + %474 = OpLoad %v3float %472 + %475 = OpCompositeExtract %float %474 2 + %476 = OpImageSampleDrefExplicitLod %float %473 %474 %475 Lod %float_0 + %477 = OpAccessChain %_ptr_Private_float %92 %uint_3 + OpStore %477 %476 + %480 = OpLoad %v4float %92 + %481 = OpDot %float %480 %479 + OpStore %103 %481 + OpBranch %396 + %395 = OpLabel + %482 = OpLoad %v4float %56 + %483 = OpVectorShuffle %v2float %482 %482 0 1 + %484 = OpAccessChain %_ptr_Input_float %56 %uint_2 + %485 = OpLoad %float %484 + %486 = OpCompositeExtract %float %483 0 + %487 = OpCompositeExtract %float %483 1 + %488 = OpCompositeConstruct %v3float %486 %487 %485 + OpStore %489 %488 + %490 = OpLoad %72 %46 + %491 = OpLoad %v3float %489 + %492 = OpCompositeExtract %float %491 2 + %493 = OpImageSampleDrefExplicitLod %float %490 %491 %492 Lod %float_0 + OpStore %103 %493 + %494 = OpLoad %float %103 + OpStore %103 %494 + OpBranch %396 + %396 = OpLabel + %495 = OpAccessChain %_ptr_Uniform_float %107 %uint_12 %uint_0 + %496 = OpLoad %float %495 + %497 = OpFNegate %float %496 + %498 = OpFAdd %float %497 %float_1 + OpStore %104 %498 + %499 = OpLoad %float %103 + %500 = OpAccessChain %_ptr_Uniform_float %107 %uint_12 %uint_0 + %501 = OpLoad %float %500 + %502 = OpFMul %float %499 %501 + %503 = OpLoad %float %104 + %504 = OpFAdd %float %502 %503 + OpStore %103 %504 + %505 = OpAccessChain %_ptr_Input_float %56 %uint_2 + %506 = OpLoad %float %505 + %507 = OpFOrdGreaterThanEqual %bool %float_0 %506 + OpStore %102 %507 + %508 = OpAccessChain %_ptr_Input_float %56 %uint_2 + %509 = OpLoad %float %508 + %510 = OpFOrdGreaterThanEqual %bool %509 %float_1 + %511 = OpAccessChain %_ptr_Private_bool %100 %uint_0 + OpStore %511 %510 + %512 = OpLoad %bool %102 + %513 = OpAccessChain %_ptr_Private_bool %100 %uint_0 + %514 = OpLoad %bool %513 + %515 = OpLogicalOr %bool %512 %514 + OpStore %102 %515 + %516 = OpLoad %bool %102 + %517 = OpLoad %float %103 + %518 = OpSelect %float %516 %float_1 %517 + OpStore %103 %518 + %520 = OpAccessChain %_ptr_Uniform_v3float %107 %uint_2 + %521 = OpLoad %v3float %520 + %522 = OpFNegate %v3float %521 + %523 = OpLoad %v3float %49 + %524 = OpFAdd %v3float %523 %522 + OpStore %97 %524 + %525 = OpLoad %v3float %97 + %526 = OpLoad %v3float %97 + %527 = OpDot %float %525 %526 + OpStore %101 %527 + %528 = OpLoad %float %101 + %529 = OpAccessChain %_ptr_Uniform_float %107 %uint_12 %uint_2 + %530 = OpLoad %float %529 + %531 = OpFMul %float %528 %530 + %532 = OpAccessChain %_ptr_Uniform_float %107 %uint_12 %uint_3 + %533 = OpLoad %float %532 + %534 = OpFAdd %float %531 %533 + OpStore %101 %534 + %535 = OpLoad %float %101 + %536 = OpExtInst %float %58 FClamp %535 %float_0 %float_1 + OpStore %101 %536 + %537 = OpLoad %float %103 + %538 = OpFNegate %float %537 + %539 = OpFAdd %float %538 %float_1 + OpStore %104 %539 + %540 = OpLoad %float %101 + %541 = OpLoad %float %104 + %542 = OpFMul %float %540 %541 + %543 = OpLoad %float %103 + %544 = OpFAdd %float %542 %543 + OpStore %103 %544 + %545 = OpLoad %v3float %96 + %546 = OpFNegate %v3float %545 + %547 = OpLoad %v4float %80 + %548 = OpVectorShuffle %v3float %547 %547 0 1 2 + %549 = OpDot %float %546 %548 + OpStore %104 %549 + %550 = OpLoad %float %104 + %551 = OpLoad %float %104 + %552 = OpFAdd %float %550 %551 + OpStore %104 %552 + %553 = OpLoad %float %104 + %554 = OpCompositeConstruct %v3float %553 %553 %553 + %555 = OpFNegate %v3float %554 + %556 = OpLoad %v4float %80 + %557 = OpVectorShuffle %v3float %556 %556 0 1 2 + %558 = OpFMul %v3float %557 %555 + %559 = OpLoad %v3float %96 + %560 = OpFNegate %v3float %559 + %561 = OpFAdd %v3float %558 %560 + OpStore %93 %561 + %562 = OpLoad %v4float %80 + %563 = OpVectorShuffle %v3float %562 %562 0 1 2 + %564 = OpLoad %v3float %96 + %565 = OpDot %float %563 %564 + OpStore %104 %565 + %566 = OpLoad %float %104 + %567 = OpExtInst %float %58 FClamp %566 %float_0 %float_1 + OpStore %104 %567 + %568 = OpLoad %float %104 + %569 = OpFNegate %float %568 + %570 = OpFAdd %float %569 %float_1 + OpStore %104 %570 + %571 = OpLoad %float %104 + %572 = OpLoad %float %104 + %573 = OpFMul %float %571 %572 + OpStore %104 %573 + %574 = OpLoad %float %104 + %575 = OpLoad %float %104 + %576 = OpFMul %float %574 %575 + OpStore %104 %576 + %578 = OpLoad %69 %45 + %579 = OpLoad %v3float %93 + %580 = OpImageSampleExplicitLod %v4float %578 %579 Lod %float_4_05000019 + OpStore %92 %580 + %582 = OpAccessChain %_ptr_Private_float %92 %uint_3 + %583 = OpLoad %float %582 + %584 = OpFAdd %float %583 %float_n1 + OpStore %105 %584 + %585 = OpAccessChain %_ptr_Uniform_float %65 %uint_8 %uint_3 + %586 = OpLoad %float %585 + %587 = OpLoad %float %105 + %588 = OpFMul %float %586 %587 + %589 = OpFAdd %float %588 %float_1 + OpStore %105 %589 + %590 = OpLoad %float %105 + %591 = OpExtInst %float %58 FMax %590 %float_0 + OpStore %105 %591 + %592 = OpLoad %float %105 + %593 = OpExtInst %float %58 Log2 %592 + OpStore %105 %593 + %594 = OpLoad %float %105 + %595 = OpAccessChain %_ptr_Uniform_float %65 %uint_8 %uint_1 + %596 = OpLoad %float %595 + %597 = OpFMul %float %594 %596 + OpStore %105 %597 + %598 = OpLoad %float %105 + %599 = OpExtInst %float %58 Exp2 %598 + OpStore %105 %599 + %600 = OpLoad %float %105 + %601 = OpAccessChain %_ptr_Uniform_float %65 %uint_8 %uint_0 + %602 = OpLoad %float %601 + %603 = OpFMul %float %600 %602 + OpStore %105 %603 + %604 = OpLoad %float %105 + %605 = OpCompositeConstruct %v3float %604 %604 %604 + %606 = OpLoad %v4float %92 + %607 = OpVectorShuffle %v3float %606 %606 0 1 2 + %608 = OpFMul %v3float %607 %605 + OpStore %93 %608 + %609 = OpLoad %float %104 + %610 = OpFMul %float %609 %float_0_5 + %612 = OpFAdd %float %610 %float_0_0399999991 + OpStore %104 %612 + %614 = OpLoad %float %104 + %615 = OpFMul %float %614 %float_0_941176474 + OpStore %101 %615 + %616 = OpLoad %float %101 + %617 = OpCompositeConstruct %v3float %616 %616 %616 + %618 = OpLoad %v3float %93 + %619 = OpFMul %v3float %617 %618 + OpStore %93 %619 + %620 = OpLoad %v3float %87 + %621 = OpLoad %v3float %91 + %622 = OpFMul %v3float %620 %621 + %623 = OpLoad %v3float %93 + %624 = OpFAdd %v3float %622 %623 + OpStore %87 %624 + %625 = OpLoad %float %103 + %626 = OpAccessChain %_ptr_Uniform_float %65 %uint_5 %uint_2 + %627 = OpLoad %float %626 + %628 = OpFMul %float %625 %627 + OpStore %101 %628 + %629 = OpLoad %v4float %80 + %630 = OpVectorShuffle %v3float %629 %629 0 1 2 + %631 = OpAccessChain %_ptr_Uniform_v4float %107 %uint_0 + %632 = OpLoad %v4float %631 + %633 = OpVectorShuffle %v3float %632 %632 0 1 2 + %634 = OpDot %float %630 %633 + OpStore %103 %634 + %635 = OpLoad %float %103 + %636 = OpExtInst %float %58 FClamp %635 %float_0 %float_1 + OpStore %103 %636 + %637 = OpLoad %float %101 + %638 = OpLoad %float %103 + %639 = OpFMul %float %637 %638 + OpStore %103 %639 + %640 = OpLoad %float %103 + %641 = OpCompositeConstruct %v3float %640 %640 %640 + %642 = OpAccessChain %_ptr_Uniform_v4float %107 %uint_1 + %643 = OpLoad %v4float %642 + %644 = OpVectorShuffle %v3float %643 %643 0 1 2 + %645 = OpFMul %v3float %641 %644 + OpStore %93 %645 + %646 = OpLoad %v3float %53 + %647 = OpLoad %v3float %88 + %648 = OpVectorShuffle %v3float %647 %647 0 0 0 + %649 = OpFMul %v3float %646 %648 + %650 = OpAccessChain %_ptr_Uniform_v4float %107 %uint_0 + %651 = OpLoad %v4float %650 + %652 = OpVectorShuffle %v3float %651 %651 0 1 2 + %653 = OpFAdd %v3float %649 %652 + OpStore %88 %653 + %654 = OpLoad %v3float %88 + %655 = OpLoad %v3float %88 + %656 = OpDot %float %654 %655 + OpStore %101 %656 + %657 = OpLoad %float %101 + %658 = OpExtInst %float %58 FMax %657 %float_1_17549435en38 + OpStore %101 %658 + %659 = OpLoad %float %101 + %660 = OpExtInst %float %58 InverseSqrt %659 + OpStore %101 %660 + %661 = OpLoad %float %101 + %662 = OpCompositeConstruct %v3float %661 %661 %661 + %663 = OpLoad %v3float %88 + %664 = OpFMul %v3float %662 %663 + OpStore %88 %664 + %665 = OpLoad %v4float %80 + %666 = OpVectorShuffle %v3float %665 %665 0 1 2 + %667 = OpLoad %v3float %88 + %668 = OpDot %float %666 %667 + %669 = OpAccessChain %_ptr_Private_float %80 %uint_0 + OpStore %669 %668 + %670 = OpAccessChain %_ptr_Private_float %80 %uint_0 + %671 = OpLoad %float %670 + %672 = OpExtInst %float %58 FClamp %671 %float_0 %float_1 + %673 = OpAccessChain %_ptr_Private_float %80 %uint_0 + OpStore %673 %672 + %674 = OpAccessChain %_ptr_Uniform_v4float %107 %uint_0 + %675 = OpLoad %v4float %674 + %676 = OpVectorShuffle %v3float %675 %675 0 1 2 + %677 = OpLoad %v3float %88 + %678 = OpDot %float %676 %677 + OpStore %95 %678 + %679 = OpLoad %float %95 + %680 = OpExtInst %float %58 FClamp %679 %float_0 %float_1 + OpStore %95 %680 + %681 = OpAccessChain %_ptr_Private_float %80 %uint_0 + %682 = OpLoad %float %681 + %683 = OpAccessChain %_ptr_Private_float %80 %uint_0 + %684 = OpLoad %float %683 + %685 = OpFMul %float %682 %684 + %686 = OpAccessChain %_ptr_Private_float %80 %uint_0 + OpStore %686 %685 + %688 = OpAccessChain %_ptr_Private_float %80 %uint_0 + %689 = OpLoad %float %688 + %690 = OpFMul %float %689 %float_n0_9375 + %692 = OpFAdd %float %690 %float_1_00001001 + %693 = OpAccessChain %_ptr_Private_float %80 %uint_0 + OpStore %693 %692 + %694 = OpLoad %float %95 + %695 = OpLoad %float %95 + %696 = OpFMul %float %694 %695 + OpStore %103 %696 + %697 = OpAccessChain %_ptr_Private_float %80 %uint_0 + %698 = OpLoad %float %697 + %699 = OpAccessChain %_ptr_Private_float %80 %uint_0 + %700 = OpLoad %float %699 + %701 = OpFMul %float %698 %700 + %702 = OpAccessChain %_ptr_Private_float %80 %uint_0 + OpStore %702 %701 + %704 = OpLoad %float %103 + %705 = OpExtInst %float %58 FMax %704 %float_0_100000001 + OpStore %95 %705 + %706 = OpLoad %float %95 + %707 = OpAccessChain %_ptr_Private_float %80 %uint_0 + %708 = OpLoad %float %707 + %709 = OpFMul %float %706 %708 + %710 = OpAccessChain %_ptr_Private_float %80 %uint_0 + OpStore %710 %709 + %712 = OpAccessChain %_ptr_Private_float %80 %uint_0 + %713 = OpLoad %float %712 + %714 = OpFMul %float %713 %float_3 + %715 = OpAccessChain %_ptr_Private_float %80 %uint_0 + OpStore %715 %714 + %717 = OpAccessChain %_ptr_Private_float %80 %uint_0 + %718 = OpLoad %float %717 + %719 = OpFDiv %float %float_0_0625 %718 + %720 = OpAccessChain %_ptr_Private_float %80 %uint_0 + OpStore %720 %719 + %722 = OpAccessChain %_ptr_Private_float %80 %uint_0 + %723 = OpLoad %float %722 + %724 = OpFAdd %float %723 %float_n6_10351562en05 + OpStore %103 %724 + %725 = OpLoad %float %103 + %726 = OpCompositeConstruct %v3float %725 %725 %725 + %728 = OpFMul %v3float %726 %727 + %729 = OpLoad %v3float %91 + %730 = OpFAdd %v3float %728 %729 + OpStore %94 %730 + %731 = OpLoad %v3float %94 + %732 = OpLoad %v3float %93 + %733 = OpFMul %v3float %731 %732 + %734 = OpLoad %v3float %87 + %735 = OpFAdd %v3float %733 %734 + OpStore %87 %735 + %736 = OpLoad %v4float %55 + %737 = OpVectorShuffle %v3float %736 %736 1 2 3 + %738 = OpLoad %v3float %91 + %739 = OpFMul %v3float %737 %738 + %740 = OpLoad %v3float %87 + %741 = OpFAdd %v3float %739 %740 + OpStore %87 %741 + %742 = OpLoad %v3float %86 + %743 = OpAccessChain %_ptr_Uniform_v4float %107 %uint_13 + %744 = OpLoad %v4float %743 + %745 = OpVectorShuffle %v3float %744 %744 1 1 1 + %746 = OpFMul %v3float %742 %745 + %747 = OpLoad %v3float %87 + %748 = OpFNegate %v3float %747 + %749 = OpFAdd %v3float %746 %748 + OpStore %86 %749 + %750 = OpAccessChain %_ptr_Uniform_v4float %107 %uint_13 + %751 = OpLoad %v4float %750 + %752 = OpVectorShuffle %v3float %751 %751 0 0 0 + %753 = OpLoad %v3float %86 + %754 = OpFMul %v3float %752 %753 + %755 = OpLoad %v3float %87 + %756 = OpFAdd %v3float %754 %755 + OpStore %86 %756 + %758 = OpAccessChain %_ptr_Uniform_v4float %107 %uint_6 + %759 = OpLoad %v4float %758 + %760 = OpVectorShuffle %v3float %759 %759 0 1 2 + %761 = OpFNegate %v3float %760 + %762 = OpLoad %v3float %86 + %763 = OpFAdd %v3float %762 %761 + OpStore %86 %763 + %764 = OpLoad %float %90 + %765 = OpCompositeConstruct %v3float %764 %764 %764 + %766 = OpLoad %v3float %86 + %767 = OpFMul %v3float %765 %766 + %768 = OpAccessChain %_ptr_Uniform_v4float %107 %uint_6 + %769 = OpLoad %v4float %768 + %770 = OpVectorShuffle %v3float %769 %769 0 1 2 + %771 = OpFAdd %v3float %767 %770 + %772 = OpLoad %v4float %57 + %773 = OpVectorShuffle %v4float %772 %771 4 5 6 3 + OpStore %57 %773 + %775 = OpAccessChain %_ptr_Output_float %57 %uint_3 + OpStore %775 %float_1 + OpReturn + OpFunctionEnd + %2 = OpFunction %void None %111 + %776 = OpLabel + %800 = OpVariable %_ptr_Function__arr_float_uint_4 Function + %809 = OpVariable %_ptr_Function_v3float Function %376 + %778 = OpFunctionCall %void %112 + %779 = OpINotEqual %bool %59 %uint_0 + OpSelectionMerge %781 None + OpBranchConditional %779 %780 %781 + %780 = OpLabel + %789 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %790 = OpLoad %float %789 + %791 = OpConvertFToU %uint %790 + %792 = OpBitwiseAnd %uint %791 %uint_1 + %793 = OpShiftLeftLogical %uint %792 %uint_1 + %794 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %795 = OpLoad %float %794 + %796 = OpConvertFToU %uint %795 + %797 = OpBitwiseAnd %uint %796 %uint_1 + %798 = OpBitwiseOr %uint %793 %797 + OpStore %800 %787 + %802 = OpAccessChain %_ptr_Function_float %800 %798 + %803 = OpLoad %float %802 + OpStore %804 %803 + %805 = OpShiftRightLogical %uint %59 %uint_0 + %806 = OpBitwiseAnd %uint %805 %uint_3 + OpStore %808 %806 + %810 = OpLoad %uint %808 + OpSelectionMerge %814 None + OpSwitch %810 %814 1 %811 2 %812 3 %813 + %811 = OpLabel + %816 = OpLoad %float %804 + %817 = OpFMul %float %816 %float_2 + %818 = OpCompositeConstruct %v3float %817 %817 %817 + OpStore %809 %818 + OpBranch %814 + %812 = OpLabel + %819 = OpLoad %float %804 + %820 = OpCompositeConstruct %v3float %819 %819 %819 + OpStore %809 %820 + OpBranch %814 + %813 = OpLabel + %821 = OpLoad %float %804 + %822 = OpFMul %float %821 %float_0_5 + %823 = OpLoad %float %804 + %824 = OpLoad %float %804 + %825 = OpCompositeConstruct %v3float %823 %822 %824 + OpStore %809 %825 + OpBranch %814 + %814 = OpLabel + %826 = OpLoad %v4float %57 + %827 = OpVectorShuffle %v3float %826 %826 0 1 2 + %828 = OpLoad %v3float %809 + %829 = OpFAdd %v3float %827 %828 + %830 = OpLoad %v4float %57 + %831 = OpVectorShuffle %v4float %830 %829 4 5 6 3 + OpStore %57 %831 + OpBranch %781 + %781 = OpLabel + OpReturn + OpFunctionEnd + +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +BUFFER buf1 DATA_TYPE uint32 SIZE 1024 FILL 0 +BUFFER buf2 DATA_TYPE uint32 SIZE 1024 FILL 0 +BUFFER buf3 DATA_TYPE uint32 SIZE 1024 FILL 0 +BUFFER tex FORMAT B8G8R8A8_UNORM + +IMAGE texture1 FORMAT R8G8B8A8_UNORM DIM_3D WIDTH 256 HEIGHT 256 DEPTH 6 FILL 0 +IMAGE texture2 FORMAT D16_UNORM DIM_2D WIDTH 256 HEIGHT 256 FILL 0 +IMAGE texture3 FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 256 HEIGHT 256 FILL 0 +IMAGE texture4 FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 256 HEIGHT 256 FILL 0 +SAMPLER sampler + +PIPELINE graphics my_pipeline + ATTACH vtex_shader + ATTACH frag_shader + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 + BIND BUFFER buf1 AS uniform DESCRIPTOR_SET 2 BINDING 0 + BIND BUFFER buf2 AS uniform DESCRIPTOR_SET 2 BINDING 1 + BIND BUFFER buf3 AS uniform DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER texture1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 1 BINDING 0 + BIND BUFFER texture2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 1 BINDING 1 + BIND BUFFER texture3 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 1 BINDING 2 + BIND BUFFER texture4 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 1 BINDING 3 +END + +CLEAR_COLOR my_pipeline 0 0 0 255 +CLEAR my_pipeline +RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256 + diff --git a/vulkan/amber/spirv_assembly/instruction/image_query/samples_storage.amber b/vulkan/amber/spirv_assembly/instruction/image_query/samples_storage.amber new file mode 100644 index 0000000..429c820 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/image_query/samples_storage.amber @@ -0,0 +1,89 @@ +#!amber + +# SPIR-V Spec: OpImageQuerySamples must have a MS of 1 +DEVICE_FEATURE shaderStorageImageMultisample + +SHADER compute compute_shader SPIRV-ASM +; Test OpImageQuerySamples can be used with +; an OpTypeImage with Sampled set to 2 (storage image) +; +;#version 450 +;layout(local_size_x = 1, local_size_y = 1) in; +; +;layout(set = 0, binding = 0, rgba8) uniform image2DMS storageImageMS; +;layout(set = 0, binding = 1) buffer dataBuffer { +; int outValue; +;}; +; +;void main() +;{ +; outValue = imageSamples(storageImageMS); +;} +; +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageMultisample + OpCapability ImageQuery + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %dataBuffer "dataBuffer" + OpMemberName %dataBuffer 0 "outValue" + OpName %_ "" + OpName %storageImageMS "storageImageMS" + OpMemberDecorate %dataBuffer 0 Offset 0 + OpDecorate %dataBuffer BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %storageImageMS DescriptorSet 0 + OpDecorate %storageImageMS Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %dataBuffer = OpTypeStruct %int +%_ptr_Uniform_dataBuffer = OpTypePointer Uniform %dataBuffer + %_ = OpVariable %_ptr_Uniform_dataBuffer Uniform + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %12 = OpTypeImage %float 2D 0 0 1 2 Rgba8 +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 +%storageImageMS = OpVariable %_ptr_UniformConstant_12 UniformConstant +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_16 = OpConstant %uint 16 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %15 = OpLoad %12 %storageImageMS + %16 = OpImageQuerySamples %int %15 + %18 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + OpStore %18 %16 + OpReturn + OpFunctionEnd +END + +IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 256 HEIGHT 256 SAMPLES 4 +BUFFER dataBuffer DATA_TYPE int32 SIZE 1 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER dataBuffer AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +BUFFER result DATA_TYPE int32 DATA + 4 +END +EXPECT dataBuffer EQ_BUFFER result \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_pc_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_pc_entry_point.amber new file mode 100644 index 0000000..302db96 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_pc_entry_point.amber @@ -0,0 +1,79 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Compute shader with push constnat. +; +; #version 430 +; +; layout(push_constant) uniform pushConstants { +; int in_val; +; } u_pushConstants; +; +; layout(std430, binding = 0) buffer output_buffer +; { +; int out_SSBO[]; +; }; +; +; void main() { +; out_SSBO[gl_GlobalInvocationID.z] = u_pushConstants.in_val; +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ %gl_GlobalInvocationID %u_pushConstants + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %pushConstants "pushConstants" + OpMemberName %pushConstants 0 "in_val" + OpName %u_pushConstants "u_pushConstants" + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpMemberDecorate %pushConstants 0 Offset 0 + OpDecorate %pushConstants Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int +%output_buffer = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_2 = OpConstant %uint 2 +%_ptr_Input_uint = OpTypePointer Input %uint +%pushConstants = OpTypeStruct %int +%_ptr_PushConstant_pushConstants = OpTypePointer PushConstant %pushConstants +%u_pushConstants = OpVariable %_ptr_PushConstant_pushConstants PushConstant +%_ptr_PushConstant_int = OpTypePointer PushConstant %int +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %19 = OpLoad %uint %18 + %24 = OpAccessChain %_ptr_PushConstant_int %u_pushConstants %int_0 + %25 = OpLoad %int %24 + %27 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 %19 + OpStore %27 %25 + OpReturn + OpFunctionEnd +[test] +uniform int 0 1 +ssbo 0:0 subdata int 0 -1 -1 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:0 0 == 1 -1 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_ssbo_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_ssbo_entry_point.amber new file mode 100644 index 0000000..225a469 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_ssbo_entry_point.amber @@ -0,0 +1,84 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Compute shader with SSBO input and output. +; #version 430 +; +; layout(std430, binding = 0) buffer input_buffer +; { +; int data_SSBO[]; +; }; +; +; layout(std430, binding = 1) buffer output_buffer +; { +; int out_SSBO[]; +; }; +; +; void main() { +; out_SSBO[gl_GlobalInvocationID.z] = data_SSBO[gl_GlobalInvocationID.z]; +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ %gl_GlobalInvocationID %__0 + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "data_SSBO" + OpName %__0 "" + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_int_0 ArrayStride 4 + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int +%output_buffer = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_2 = OpConstant %uint 2 +%_ptr_Input_uint = OpTypePointer Input %uint +%_runtimearr_int_0 = OpTypeRuntimeArray %int +%input_buffer = OpTypeStruct %_runtimearr_int_0 +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %__0 = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %19 = OpLoad %uint %18 + %24 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_StorageBuffer_int %__0 %int_0 %25 + %28 = OpLoad %int %27 + %29 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 %19 + OpStore %29 %28 + OpReturn + OpFunctionEnd +[test] +ssbo 0:0 subdata int 0 0 1 +ssbo 0:1 subdata int 0 -1 -1 + +compute entrypoint main +compute 1 1 2 + +probe ssbo int 0:1 0 == 0 1 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_ubo_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_ubo_entry_point.amber new file mode 100644 index 0000000..11da462 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_ubo_entry_point.amber @@ -0,0 +1,87 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Compute shader with a UBO. +; +; #version 430 +; +; layout(binding = 0) uniform input_buffer +; { +; int in_data[2]; +; }; +; +; layout(std430, binding = 1) buffer output_buffer +; { +; int out_SSBO[]; +; }; +; +; void main() { +; out_SSBO[gl_GlobalInvocationID.z] = in_data[gl_GlobalInvocationID.z]; +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ %gl_GlobalInvocationID %__0 + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "in_data" + OpName %__0 "" + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int +%output_buffer = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_2 = OpConstant %uint 2 +%_ptr_Input_uint = OpTypePointer Input %uint +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%input_buffer = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_input_buffer = OpTypePointer Uniform %input_buffer + %__0 = OpVariable %_ptr_Uniform_input_buffer Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %19 = OpLoad %uint %18 + %24 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %25 + %28 = OpLoad %int %27 + %30 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 %19 + OpStore %30 %28 + OpReturn + OpFunctionEnd +[test] +uniform ubo 0:0 int 0 0 +uniform ubo 0:0 int 16 1 +ssbo 0:1 subdata int 0 -1 -1 + +compute entrypoint main +compute 1 1 2 + +probe ssbo int 0:1 0 == 0 1 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_workgroup_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_workgroup_entry_point.amber new file mode 100644 index 0000000..1993946 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/comp_workgroup_entry_point.amber @@ -0,0 +1,94 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; #version 430 +; +; layout(local_size_x = 2) in; +; layout(local_size_y = 2) in; +; layout(local_size_z = 1) in; +; +; layout(std430, binding = 1) buffer output_buffer +; { +; uint x[4]; +; }; +; +; shared uint wg_data[4]; +; +; void main() { +; atomicExchange(wg_data[gl_LocalInvocationIndex], gl_LocalInvocationIndex); +; barrier(); +; uint val = atomicExchange(wg_data[(gl_LocalInvocationIndex+1)%4], 0); +; x[gl_LocalInvocationIndex] = val; +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %wg_data %gl_LocalInvocationIndex %_ + OpExecutionMode %main LocalSize 2 2 1 + OpSource GLSL 430 + OpName %main "main" + OpName %wg_data "wg_data" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %val "val" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "x" + OpName %_ "" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %_arr_uint_uint_4_0 ArrayStride 4 + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_uint_uint_4 = OpTypeArray %uint %uint_4 +%_ptr_Workgroup__arr_uint_uint_4 = OpTypePointer Workgroup %_arr_uint_uint_4 + %wg_data = OpVariable %_ptr_Workgroup__arr_uint_uint_4 Workgroup +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_uint = OpTypePointer Function %uint +%_arr_uint_uint_4_0 = OpTypeArray %uint %uint_4 +%output_buffer = OpTypeStruct %_arr_uint_uint_4_0 +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %v3uint = OpTypeVector %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %val = OpVariable %_ptr_Function_uint Function + %13 = OpLoad %uint %gl_LocalInvocationIndex + %15 = OpAccessChain %_ptr_Workgroup_uint %wg_data %13 + %16 = OpLoad %uint %gl_LocalInvocationIndex + %19 = OpAtomicExchange %uint %15 %uint_1 %uint_0 %16 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %22 = OpLoad %uint %gl_LocalInvocationIndex + %23 = OpIAdd %uint %22 %uint_1 + %24 = OpUMod %uint %23 %uint_4 + %25 = OpAccessChain %_ptr_Workgroup_uint %wg_data %24 + %26 = OpAtomicExchange %uint %25 %uint_1 %uint_0 %uint_0 + OpStore %val %26 + %33 = OpLoad %uint %gl_LocalInvocationIndex + %34 = OpLoad %uint %val + %36 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 %33 + OpStore %36 %34 + OpReturn + OpFunctionEnd + +[test] +ssbo 0:1 subdata int 0 -1 -1 -1 -1 +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:1 0 == 1 2 3 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/frag_pc_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/frag_pc_entry_point.amber new file mode 100644 index 0000000..cd44fbf --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/frag_pc_entry_point.amber @@ -0,0 +1,57 @@ +[require] +VK_KHR_spirv_1_4 + +[vertex shader passthrough] + +[fragment shader spirv] +; A fragment shader with a push constant. +; +; #version 430 +; +; layout(push_constant) uniform pushConstants { +; vec4 in_val; +; } u_pushConstants; +; +; layout(location = 0) out vec4 outColor; +; +; void main() { +; outColor = u_pushConstants.in_val; +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %u_pushConstants + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %pushConstants "pushConstants" + OpMemberName %pushConstants 0 "in_val" + OpName %u_pushConstants "u_pushConstants" + OpDecorate %outColor Location 0 + OpMemberDecorate %pushConstants 0 Offset 0 + OpDecorate %pushConstants Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output +%pushConstants = OpTypeStruct %v4float +%_ptr_PushConstant_pushConstants = OpTypePointer PushConstant %pushConstants +%u_pushConstants = OpVariable %_ptr_PushConstant_pushConstants PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_v4float = OpTypePointer PushConstant %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_PushConstant_v4float %u_pushConstants %int_0 + %17 = OpLoad %v4float %16 + OpStore %outColor %17 + OpReturn + OpFunctionEnd +[test] +uniform float 0 0.2 0.3 0.4 0.1 +draw rect -1 -1 2 2 + +probe rect rgba (0, 0, 250, 250) (0.2 0.3 0.4 0.1) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/frag_ssbo_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/frag_ssbo_entry_point.amber new file mode 100644 index 0000000..68b1742 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/frag_ssbo_entry_point.amber @@ -0,0 +1,62 @@ +[require] +VK_KHR_spirv_1_4 + +[vertex shader passthrough] + +[fragment shader spirv] +; A fragment shader with a ubo. +; +; #version 430 +; +; layout(std430, binding = 0) buffer input_buffer +; { +; vec4 data_SSBO[]; +; }; +; +; layout(location = 0) out vec4 outColor; +; +; void main() { +; outColor = data_SSBO[0]; +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_ %outColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "data_SSBO" + OpName %_ "" + OpDecorate %outColor Location 0 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%input_buffer = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %_ = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpAccessChain %_ptr_StorageBuffer_v4float %_ %int_0 %int_0 + %18 = OpLoad %v4float %17 + OpStore %outColor %18 + OpReturn + OpFunctionEnd +[test] +ssbo 0:0 subdata float 0 0.2 0.3 0.4 0.1 +draw rect -1 -1 2 2 + +probe rect rgba (0, 0, 250, 250) (0.2 0.3 0.4 0.1) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/frag_ubo_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/frag_ubo_entry_point.amber new file mode 100644 index 0000000..bf440c9 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/frag_ubo_entry_point.amber @@ -0,0 +1,60 @@ +[require] +VK_KHR_spirv_1_4 + +[vertex shader passthrough] + +[fragment shader spirv] +; A fragment shader with a ubo. +; +; #version 430 +; +; layout(binding = 0) uniform input_buffer +; { +; vec4 in_data; +; }; +; +; layout(location = 0) out vec4 outColor; +; +; void main() { +; outColor = in_data; +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_ %outColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "in_data" + OpName %_ "" + OpDecorate %outColor Location 0 + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output +%input_buffer = OpTypeStruct %v4float +%_ptr_Uniform_input_buffer = OpTypePointer Uniform %input_buffer + %_ = OpVariable %_ptr_Uniform_input_buffer Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 + %17 = OpLoad %v4float %16 + OpStore %outColor %17 + OpReturn + OpFunctionEnd +[test] +uniform ubo 0:0 float 0 0.2 0.3 0.4 0.1 +draw rect -1 -1 2 2 + +probe rect rgba (0, 0, 250, 250) (0.2 0.3 0.4 0.1) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/geom_pc_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/geom_pc_entry_point.amber new file mode 100644 index 0000000..23734cd --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/geom_pc_entry_point.amber @@ -0,0 +1,148 @@ +[require] +VK_KHR_spirv_1_4 +geometryShader + +[vertex shader passthrough] +[geometry shader spirv] +; Test a geometry shader with a push constant in the OpEntryPoint. +; #version 450 +; +; layout(triangles) in; +; layout(triangle_strip, max_vertices = 3) out; +; +; layout(push_constant) uniform pushConstants { +; float factor; +; } u_pushConstants; +; +; void main() +; { +; for( int i = 0; i < 3; i++ ) { +; vec3 point = gl_in[i].gl_Position.xyz; +; gl_Position = vec4(point * u_pushConstants.factor, 1.0); +; EmitVertex(); +; } +; EndPrimitive(); +; } + + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %gl_in %_ %u_pushConstants + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpSource GLSL 450 + OpName %main "main" + OpName %i "i" + OpName %point "point" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %gl_in "gl_in" + OpName %gl_PerVertex_0 "gl_PerVertex" + OpMemberName %gl_PerVertex_0 0 "gl_Position" + OpMemberName %gl_PerVertex_0 1 "gl_PointSize" + OpMemberName %gl_PerVertex_0 2 "gl_ClipDistance" + OpName %_ "" + OpName %pushConstants "pushConstants" + OpMemberName %pushConstants 0 "factor" + OpName %u_pushConstants "u_pushConstants" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpMemberDecorate %pushConstants 0 Offset 0 + OpDecorate %pushConstants Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Input__arr_gl_PerVertex_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_uint_3 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0 + %_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output +%pushConstants = OpTypeStruct %float +%_ptr_PushConstant_pushConstants = OpTypePointer PushConstant %pushConstants +%u_pushConstants = OpVariable %_ptr_PushConstant_pushConstants PushConstant +%_ptr_PushConstant_float = OpTypePointer PushConstant %float + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %point = OpVariable %_ptr_Function_v3float Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %18 = OpSLessThan %bool %15 %int_3 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %32 = OpLoad %int %i + %34 = OpAccessChain %_ptr_Input_v4float %gl_in %32 %int_0 + %35 = OpLoad %v4float %34 + %36 = OpVectorShuffle %v3float %35 %35 0 1 2 + OpStore %point %36 + %40 = OpLoad %v3float %point + %45 = OpAccessChain %_ptr_PushConstant_float %u_pushConstants %int_0 + %46 = OpLoad %float %45 + %47 = OpVectorTimesScalar %v3float %40 %46 + %49 = OpCompositeExtract %float %47 0 + %50 = OpCompositeExtract %float %47 1 + %51 = OpCompositeExtract %float %47 2 + %52 = OpCompositeConstruct %v4float %49 %50 %51 %float_1 + %54 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %54 %52 + OpEmitVertex + OpBranch %13 + %13 = OpLabel + %55 = OpLoad %int %i + %57 = OpIAdd %int %55 %int_1 + OpStore %i %57 + OpBranch %10 + %12 = OpLabel + OpEndPrimitive + OpReturn + OpFunctionEnd +[fragment shader] +#version 430 +layout(location = 0) out vec4 outColor; +void main() { + outColor = vec4(0.5, 0.5, 0.5, 0.5); +} + +[test] +uniform float 0 0.5 +clear +draw rect -1 -1 2 2 + +probe rect rgba (62, 62, 125, 125) (0.5 0.5 0.5 0.5) +probe rect rgba (0, 0, 250, 62) (0.0 0.0 0.0 0.0) +probe rect rgba (0, 0, 62, 250) (0.0 0.0 0.0 0.0) +probe rect rgba (187, 0, 63, 250) (0.0 0.0 0.0 0.0) +probe rect rgba (0, 187, 250, 63) (0.0 0.0 0.0 0.0) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/geom_ssbo_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/geom_ssbo_entry_point.amber new file mode 100644 index 0000000..6e2f022 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/geom_ssbo_entry_point.amber @@ -0,0 +1,150 @@ +[require] +VK_KHR_spirv_1_4 +geometryShader + +[vertex shader passthrough] +[geometry shader spirv] +; Test a geometry shader with an SSBO on the OpEntryPoint instruction. +; #version 450 +; +; layout(triangles) in; +; layout(triangle_strip, max_vertices = 3) out; +; +; layout(std430, binding = 0) buffer input_buffer +; { +; float factor; +; }; +; +; void main() +; { +; for( int i = 0; i < 3; i++ ) { +; vec3 point = gl_in[i].gl_Position.xyz; +; gl_Position = vec4(point * factor, 1.0); +; EmitVertex(); +; } +; EndPrimitive(); +; } + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %gl_in %_ %__0 + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpSource GLSL 450 + OpName %main "main" + OpName %i "i" + OpName %point "point" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %gl_in "gl_in" + OpName %gl_PerVertex_0 "gl_PerVertex" + OpMemberName %gl_PerVertex_0 0 "gl_Position" + OpMemberName %gl_PerVertex_0 1 "gl_PointSize" + OpMemberName %gl_PerVertex_0 2 "gl_ClipDistance" + OpName %_ "" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "factor" + OpName %__0 "" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Input__arr_gl_PerVertex_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_uint_3 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0 + %_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output +%input_buffer = OpTypeStruct %float +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %__0 = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %point = OpVariable %_ptr_Function_v3float Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %18 = OpSLessThan %bool %15 %int_3 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %32 = OpLoad %int %i + %34 = OpAccessChain %_ptr_Input_v4float %gl_in %32 %int_0 + %35 = OpLoad %v4float %34 + %36 = OpVectorShuffle %v3float %35 %35 0 1 2 + OpStore %point %36 + %40 = OpLoad %v3float %point + %45 = OpAccessChain %_ptr_StorageBuffer_float %__0 %int_0 + %46 = OpLoad %float %45 + %47 = OpVectorTimesScalar %v3float %40 %46 + %49 = OpCompositeExtract %float %47 0 + %50 = OpCompositeExtract %float %47 1 + %51 = OpCompositeExtract %float %47 2 + %52 = OpCompositeConstruct %v4float %49 %50 %51 %float_1 + %54 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %54 %52 + OpEmitVertex + OpBranch %13 + %13 = OpLabel + %55 = OpLoad %int %i + %57 = OpIAdd %int %55 %int_1 + OpStore %i %57 + OpBranch %10 + %12 = OpLabel + OpEndPrimitive + OpReturn + OpFunctionEnd +[fragment shader] +#version 430 +layout(location = 0) out vec4 outColor; +void main() { + outColor = vec4(0.5, 0.5, 0.5, 0.5); +} + +[test] +ssbo 0:0 subdata float 0 0.5 +clear +draw rect -1 -1 2 2 + +probe rect rgba (62, 62, 125, 125) (0.5 0.5 0.5 0.5) +probe rect rgba (0, 0, 250, 62) (0.0 0.0 0.0 0.0) +probe rect rgba (0, 0, 62, 250) (0.0 0.0 0.0 0.0) +probe rect rgba (187, 0, 63, 250) (0.0 0.0 0.0 0.0) +probe rect rgba (0, 187, 250, 63) (0.0 0.0 0.0 0.0) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/geom_ubo_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/geom_ubo_entry_point.amber new file mode 100644 index 0000000..d7760c2 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/geom_ubo_entry_point.amber @@ -0,0 +1,151 @@ +[require] +VK_KHR_spirv_1_4 +geometryShader + +[vertex shader passthrough] +[geometry shader spirv] +; Test a geometry shader with a UBO on the OpEntryPoint instruction. +; #version 450 +; +; layout(triangles) in; +; layout(triangle_strip, max_vertices = 3) out; +; +; layout(binding = 0) uniform input_buffer +; { +; float factor; +; }; +; +; void main() +; { +; for( int i = 0; i < 3; i++ ) { +; vec3 point = gl_in[i].gl_Position.xyz; +; gl_Position = vec4(point * factor, 1.0); +; EmitVertex(); +; } +; EndPrimitive(); +; } + + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %gl_in %_ %__0 + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpSource GLSL 450 + OpName %main "main" + OpName %i "i" + OpName %point "point" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %gl_in "gl_in" + OpName %gl_PerVertex_0 "gl_PerVertex" + OpMemberName %gl_PerVertex_0 0 "gl_Position" + OpMemberName %gl_PerVertex_0 1 "gl_PointSize" + OpMemberName %gl_PerVertex_0 2 "gl_ClipDistance" + OpName %_ "" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "factor" + OpName %__0 "" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Input__arr_gl_PerVertex_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_uint_3 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0 + %_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output +%input_buffer = OpTypeStruct %float +%_ptr_Uniform_input_buffer = OpTypePointer Uniform %input_buffer + %__0 = OpVariable %_ptr_Uniform_input_buffer Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %point = OpVariable %_ptr_Function_v3float Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %18 = OpSLessThan %bool %15 %int_3 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %32 = OpLoad %int %i + %34 = OpAccessChain %_ptr_Input_v4float %gl_in %32 %int_0 + %35 = OpLoad %v4float %34 + %36 = OpVectorShuffle %v3float %35 %35 0 1 2 + OpStore %point %36 + %40 = OpLoad %v3float %point + %45 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 + %46 = OpLoad %float %45 + %47 = OpVectorTimesScalar %v3float %40 %46 + %49 = OpCompositeExtract %float %47 0 + %50 = OpCompositeExtract %float %47 1 + %51 = OpCompositeExtract %float %47 2 + %52 = OpCompositeConstruct %v4float %49 %50 %51 %float_1 + %54 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %54 %52 + OpEmitVertex + OpBranch %13 + %13 = OpLabel + %55 = OpLoad %int %i + %57 = OpIAdd %int %55 %int_1 + OpStore %i %57 + OpBranch %10 + %12 = OpLabel + OpEndPrimitive + OpReturn + OpFunctionEnd +[fragment shader] +#version 430 +layout(location = 0) out vec4 outColor; +void main() { + outColor = vec4(0.5, 0.5, 0.5, 0.5); +} + +[test] +uniform ubo 0:0 float 0 0.5 +clear +draw rect -1 -1 2 2 + +probe rect rgba (62, 62, 125, 125) (0.5 0.5 0.5 0.5) +probe rect rgba (0, 0, 250, 62) (0.0 0.0 0.0 0.0) +probe rect rgba (0, 0, 62, 250) (0.0 0.0 0.0 0.0) +probe rect rgba (187, 0, 63, 250) (0.0 0.0 0.0 0.0) +probe rect rgba (0, 187, 250, 63) (0.0 0.0 0.0 0.0) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_con_pc_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_con_pc_entry_point.amber new file mode 100644 index 0000000..a38ada6 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_con_pc_entry_point.amber @@ -0,0 +1,192 @@ +[require] +VK_KHR_spirv_1_4 +tessellationShader + +[vertex shader] +#version 450 + +layout(location = 0) in vec4 position; +layout(location = 1) in vec4 vert_color; +layout(location = 0) out vec4 tsc_color; + +void main() { + gl_Position = position; + tsc_color = vert_color; +} + +[tessellation control shader spirv] +; Test tessellation control shader with push constant on entry point. +; But also modified to set gl_TessLevelInner gl_TessLevelOuter +; #version 450 +; #extension GL_ARB_separate_shader_objects : enable +; +; layout(vertices = 3) out; +; +; layout(location = 0) in vec4 tsc_color[]; +; layout(location = 0) out vec4 tse_color[]; +; +; layout(push_constant) uniform pushConstants { +; vec4 in_val; +; } pc; +; #define ID gl_InvocationID +; +; void main() +; { +; gl_out[ID].gl_Position = gl_in[ID].gl_Position; +; tse_color[ID] = tsc_color[ID]+pc.in_val; +; } + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %gl_in %tse_color %pc %tsc_color %gl_TessLevelInner %gl_TessLevelOuter + OpExecutionMode %main OutputVertices 3 + OpSource GLSL 450 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpName %gl_PerVertex_0 "gl_PerVertex" + OpMemberName %gl_PerVertex_0 0 "gl_Position" + OpMemberName %gl_PerVertex_0 1 "gl_PointSize" + OpMemberName %gl_PerVertex_0 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex_0 3 "gl_CullDistance" + OpName %gl_in "gl_in" + OpName %tse_color "tse_color" + OpName %pushConstants "pushConstants" + OpMemberName %pushConstants 0 "in_val" + OpName %pc "pc" + OpName %tsc_color "tsc_color" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex_0 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %tse_color Location 0 + OpMemberDecorate %pushConstants 0 Offset 0 + OpDecorate %pushConstants Block + OpDecorate %tsc_color Location 0 + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelOuter Patch + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %float_1 = OpConstant %float 1.0 + %arr_2_1 = OpConstantComposite %_arr_float_uint_2 %float_1 %float_1 + %arr_4_1 = OpConstantComposite %_arr_float_uint_4 %float_1 %float_1 %float_1 %float_1 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output %arr_2_1 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output %arr_4_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 + %tse_color = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%pushConstants = OpTypeStruct %v4float +%_ptr_PushConstant_pushConstants = OpTypePointer PushConstant %pushConstants + %pc = OpVariable %_ptr_PushConstant_pushConstants PushConstant +%_ptr_PushConstant_v4float = OpTypePointer PushConstant %v4float +%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32 +%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32 + %tsc_color = OpVariable %_ptr_Input__arr_v4float_uint_32 Input + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %int %gl_InvocationID + %26 = OpLoad %int %gl_InvocationID + %28 = OpAccessChain %_ptr_Input_v4float %gl_in %26 %int_0 + %29 = OpLoad %v4float %28 + %31 = OpAccessChain %_ptr_Output_v4float %gl_out %19 %int_0 + OpStore %31 %29 + %35 = OpLoad %int %gl_InvocationID + %36 = OpLoad %int %gl_InvocationID + %37 = OpAccessChain %_ptr_Input_v4float %tsc_color %36 + %38 = OpLoad %v4float %37 + %43 = OpAccessChain %_ptr_PushConstant_v4float %pc %int_0 + %44 = OpLoad %v4float %43 + %45 = OpFAdd %v4float %38 %44 + %46 = OpAccessChain %_ptr_Output_v4float %tse_color %35 + OpStore %46 %45 + OpReturn + OpFunctionEnd +[tessellation evaluation shader] +#version 450 +#extension GL_ARB_separate_shader_objects : enable + +layout(triangles, equal_spacing, cw) in; + +layout(location = 0) in vec4 tse_color[]; +layout(location = 0) out vec4 frag_color; + +void main() +{ + vec4 p0 = gl_TessCoord.x * gl_in[0].gl_Position; + vec4 p1 = gl_TessCoord.y * gl_in[1].gl_Position; + vec4 p2 = gl_TessCoord.z * gl_in[2].gl_Position; + gl_Position = p0 + p1 + p2; + frag_color = tse_color[0]; +} + +[fragment shader] +#version 450 + +layout(location = 0) in vec4 frag_color; +layout(location = 0) out vec4 final_color; + +void main() { + final_color = frag_color; +} + +[vertex data] +# position vert_color + 0/R8G8_SNORM 1/R8G8B8A8_UNORM + +# Red for entire frame +# R8 G8 R8 G8 B8 A8 + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + -128 127 255 0 0 255 + + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + 127 -128 255 0 0 255 + +[test] +uniform float 0 0.0 0.0 0.3 0.0 +clear +draw arrays PATCH_LIST 0 6 +relative probe rect rgb (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0.3) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_con_ssbo_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_con_ssbo_entry_point.amber new file mode 100644 index 0000000..9e02e87 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_con_ssbo_entry_point.amber @@ -0,0 +1,196 @@ +[require] +VK_KHR_spirv_1_4 +tessellationShader + +[vertex shader] +#version 450 + +layout(location = 0) in vec4 position; +layout(location = 1) in vec4 vert_color; +layout(location = 0) out vec4 tsc_color; + +void main() { + gl_Position = position; + tsc_color = vert_color; +} + +[tessellation control shader spirv] +; Test tessellation control shader with an ssbo on the entry point. +; #version 450 +; #extension GL_ARB_separate_shader_objects : enable +; +; layout(vertices = 3) out; +; +; layout(location = 0) in vec4 tsc_color[]; +; layout(location = 0) out vec4 tse_color[]; +; +; #define ID gl_InvocationID +; +; layout(std430, binding = 0) buffer input_buffer +; { +; vec4 in_val; +; }; +; +; void main() +; { +; gl_out[ID].gl_Position = gl_in[ID].gl_Position; +; tse_color[ID] = tsc_color[ID]+in_val; +; } + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %gl_in %tse_color %_ %tsc_color %gl_TessLevelInner %gl_TessLevelOuter + OpExecutionMode %main OutputVertices 3 + OpSource GLSL 450 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpName %gl_PerVertex_0 "gl_PerVertex" + OpMemberName %gl_PerVertex_0 0 "gl_Position" + OpMemberName %gl_PerVertex_0 1 "gl_PointSize" + OpMemberName %gl_PerVertex_0 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex_0 3 "gl_CullDistance" + OpName %gl_in "gl_in" + OpName %tse_color "tse_color" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "in_val" + OpName %_ "" + OpName %tsc_color "tsc_color" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex_0 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %tse_color Location 0 + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %tsc_color Location 0 + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelOuter Patch + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %float_1 = OpConstant %float 1.0 + %arr_2_1 = OpConstantComposite %_arr_float_uint_2 %float_1 %float_1 + %arr_4_1 = OpConstantComposite %_arr_float_uint_4 %float_1 %float_1 %float_1 %float_1 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output %arr_2_1 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output %arr_4_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 + %tse_color = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%input_buffer = OpTypeStruct %v4float +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %_ = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float +%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32 +%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32 + %tsc_color = OpVariable %_ptr_Input__arr_v4float_uint_32 Input + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %int %gl_InvocationID + %26 = OpLoad %int %gl_InvocationID + %28 = OpAccessChain %_ptr_Input_v4float %gl_in %26 %int_0 + %29 = OpLoad %v4float %28 + %31 = OpAccessChain %_ptr_Output_v4float %gl_out %19 %int_0 + OpStore %31 %29 + %35 = OpLoad %int %gl_InvocationID + %36 = OpLoad %int %gl_InvocationID + %37 = OpAccessChain %_ptr_Input_v4float %tsc_color %36 + %38 = OpLoad %v4float %37 + %43 = OpAccessChain %_ptr_StorageBuffer_v4float %_ %int_0 + %44 = OpLoad %v4float %43 + %45 = OpFAdd %v4float %38 %44 + %46 = OpAccessChain %_ptr_Output_v4float %tse_color %35 + OpStore %46 %45 + OpReturn + OpFunctionEnd + +[tessellation evaluation shader] +#version 450 +#extension GL_ARB_separate_shader_objects : enable + +layout(triangles, equal_spacing, cw) in; + +layout(location = 0) in vec4 tse_color[]; +layout(location = 0) out vec4 frag_color; + +void main() +{ + vec4 p0 = gl_TessCoord.x * gl_in[0].gl_Position; + vec4 p1 = gl_TessCoord.y * gl_in[1].gl_Position; + vec4 p2 = gl_TessCoord.z * gl_in[2].gl_Position; + gl_Position = p0 + p1 + p2; + frag_color = tse_color[0]; +} + +[fragment shader] +#version 450 + +layout(location = 0) in vec4 frag_color; +layout(location = 0) out vec4 final_color; + +void main() { + final_color = frag_color; +} + +[vertex data] +# position vert_color + 0/R8G8_SNORM 1/R8G8B8A8_UNORM + +# Red for entire frame +# R8 G8 R8 G8 B8 A8 + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + -128 127 255 0 0 255 + + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + 127 -128 255 0 0 255 + +[test] +ssbo 0:0 subdata float 0 0.0 0.0 0.3 0.0 +clear +draw arrays PATCH_LIST 0 6 +relative probe rect rgb (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0.3) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_con_ubo_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_con_ubo_entry_point.amber new file mode 100644 index 0000000..24122fd --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_con_ubo_entry_point.amber @@ -0,0 +1,195 @@ +[require] +VK_KHR_spirv_1_4 +tessellationShader + +[vertex shader] +#version 450 + +layout(location = 0) in vec4 position; +layout(location = 1) in vec4 vert_color; +layout(location = 0) out vec4 tsc_color; + +void main() { + gl_Position = position; + tsc_color = vert_color; +} + +[tessellation control shader spirv] +; Test tessellation control shader with a ubo on the entry point. +; #version 450 +; #extension GL_ARB_separate_shader_objects : enable +; +; layout(vertices = 3) out; +; +; layout(location = 0) in vec4 tsc_color[]; +; layout(location = 0) out vec4 tse_color[]; +; +; #define ID gl_InvocationID +; +; layout(binding = 0) uniform input_buffer +; { +; vec4 in_val; +; }; +; +; void main() +; { +; gl_out[ID].gl_Position = gl_in[ID].gl_Position; +; tse_color[ID] = tsc_color[ID]+in_val; +; } + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %gl_in %tse_color %_ %tsc_color %gl_TessLevelInner %gl_TessLevelOuter + OpExecutionMode %main OutputVertices 3 + OpSource GLSL 450 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpName %gl_PerVertex_0 "gl_PerVertex" + OpMemberName %gl_PerVertex_0 0 "gl_Position" + OpMemberName %gl_PerVertex_0 1 "gl_PointSize" + OpMemberName %gl_PerVertex_0 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex_0 3 "gl_CullDistance" + OpName %gl_in "gl_in" + OpName %tse_color "tse_color" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "in_val" + OpName %_ "" + OpName %tsc_color "tsc_color" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex_0 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %tse_color Location 0 + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %tsc_color Location 0 + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelOuter Patch + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output + %int = OpTypeInt 32 1 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %float_1 = OpConstant %float 1.0 + %arr_2_1 = OpConstantComposite %_arr_float_uint_2 %float_1 %float_1 + %arr_4_1 = OpConstantComposite %_arr_float_uint_4 %float_1 %float_1 %float_1 %float_1 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output %arr_2_1 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output %arr_4_1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32 +%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 + %tse_color = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%input_buffer = OpTypeStruct %v4float +%_ptr_Uniform_input_buffer = OpTypePointer Uniform %input_buffer + %_ = OpVariable %_ptr_Uniform_input_buffer Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32 +%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32 + %tsc_color = OpVariable %_ptr_Input__arr_v4float_uint_32 Input + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %int %gl_InvocationID + %26 = OpLoad %int %gl_InvocationID + %28 = OpAccessChain %_ptr_Input_v4float %gl_in %26 %int_0 + %29 = OpLoad %v4float %28 + %31 = OpAccessChain %_ptr_Output_v4float %gl_out %19 %int_0 + OpStore %31 %29 + %35 = OpLoad %int %gl_InvocationID + %36 = OpLoad %int %gl_InvocationID + %37 = OpAccessChain %_ptr_Input_v4float %tsc_color %36 + %38 = OpLoad %v4float %37 + %43 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 + %44 = OpLoad %v4float %43 + %45 = OpFAdd %v4float %38 %44 + %46 = OpAccessChain %_ptr_Output_v4float %tse_color %35 + OpStore %46 %45 + OpReturn + OpFunctionEnd +[tessellation evaluation shader] +#version 450 +#extension GL_ARB_separate_shader_objects : enable + +layout(triangles, equal_spacing, cw) in; + +layout(location = 0) in vec4 tse_color[]; +layout(location = 0) out vec4 frag_color; + +void main() +{ + vec4 p0 = gl_TessCoord.x * gl_in[0].gl_Position; + vec4 p1 = gl_TessCoord.y * gl_in[1].gl_Position; + vec4 p2 = gl_TessCoord.z * gl_in[2].gl_Position; + gl_Position = p0 + p1 + p2; + frag_color = tse_color[0]; +} + +[fragment shader] +#version 450 + +layout(location = 0) in vec4 frag_color; +layout(location = 0) out vec4 final_color; + +void main() { + final_color = frag_color; +} + +[vertex data] +# position vert_color + 0/R8G8_SNORM 1/R8G8B8A8_UNORM + +# Red for entire frame +# R8 G8 R8 G8 B8 A8 + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + -128 127 255 0 0 255 + + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + 127 -128 255 0 0 255 + +[test] +uniform ubo 0:0 float 0 0.0 0.0 0.3 0.0 +clear +draw arrays PATCH_LIST 0 6 +relative probe rect rgb (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0.3) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_eval_pc_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_eval_pc_entry_point.amber new file mode 100644 index 0000000..2ee71ab --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_eval_pc_entry_point.amber @@ -0,0 +1,210 @@ +[require] +VK_KHR_spirv_1_4 +tessellationShader + +[vertex shader] +#version 450 + +layout(location = 0) in vec4 position; +layout(location = 1) in vec4 vert_color; +layout(location = 0) out vec4 tsc_color; + +void main() { + gl_Position = position; + tsc_color = vert_color; +} + +[tessellation control shader] +#version 450 +#extension GL_ARB_separate_shader_objects : enable + +layout(vertices = 3) out; + +layout(location = 0) in vec4 tsc_color[]; +layout(location = 0) out vec4 tse_color[]; + +#define ID gl_InvocationID + +void main() +{ + gl_out[ID].gl_Position = gl_in[ID].gl_Position; + tse_color[ID] = tsc_color[ID]; + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 1.0; + gl_TessLevelOuter[2] = 1.0; + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 1.0; +} + +[tessellation evaluation shader spirv] +; Test tessellation evaluation shader with a push constant on the entry point. +; #version 450 +; #extension GL_ARB_separate_shader_objects : enable +; +; layout(triangles, equal_spacing, cw) in; +; +; layout(location = 0) in vec4 tse_color[]; +; layout(location = 0) out vec4 frag_color; +; +; layout(push_constant) uniform pushConstants { +; vec4 in_val; +; } pc; +; +; void main() +; { +; vec4 p0 = gl_TessCoord.x * gl_in[0].gl_Position; +; vec4 p1 = gl_TessCoord.y * gl_in[1].gl_Position; +; vec4 p2 = gl_TessCoord.z * gl_in[2].gl_Position; +; gl_Position = p0 + p1 + p2; +; frag_color = tse_color[0]+pc.in_val; +; } + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %gl_TessCoord %gl_in %_ %frag_color %tse_color %pc + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCw + OpSource GLSL 450 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpName %main "main" + OpName %p0 "p0" + OpName %gl_TessCoord "gl_TessCoord" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_in "gl_in" + OpName %p1 "p1" + OpName %p2 "p2" + OpName %gl_PerVertex_0 "gl_PerVertex" + OpMemberName %gl_PerVertex_0 0 "gl_Position" + OpMemberName %gl_PerVertex_0 1 "gl_PointSize" + OpMemberName %gl_PerVertex_0 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex_0 3 "gl_CullDistance" + OpName %_ "" + OpName %frag_color "frag_color" + OpName %tse_color "tse_color" + OpName %pushConstants "pushConstants" + OpMemberName %pushConstants 0 "in_val" + OpName %pc "pc" + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex_0 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %frag_color Location 0 + OpDecorate %tse_color Location 0 + OpMemberDecorate %pushConstants 0 Offset 0 + OpDecorate %pushConstants Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_uint_32 = OpTypeArray %gl_PerVertex %uint_32 +%_ptr_Input__arr_gl_PerVertex_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_32 Input + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0 + %_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output +%_ptr_Output_v4float = OpTypePointer Output %v4float + %frag_color = OpVariable %_ptr_Output_v4float Output +%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32 +%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32 + %tse_color = OpVariable %_ptr_Input__arr_v4float_uint_32 Input +%pushConstants = OpTypeStruct %v4float +%_ptr_PushConstant_pushConstants = OpTypePointer PushConstant %pushConstants + %pc = OpVariable %_ptr_PushConstant_pushConstants PushConstant +%_ptr_PushConstant_v4float = OpTypePointer PushConstant %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %p0 = OpVariable %_ptr_Function_v4float Function + %p1 = OpVariable %_ptr_Function_v4float Function + %p2 = OpVariable %_ptr_Function_v4float Function + %16 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %17 = OpLoad %float %16 + %28 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %29 = OpLoad %v4float %28 + %30 = OpVectorTimesScalar %v4float %29 %17 + OpStore %p0 %30 + %32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %36 = OpLoad %v4float %35 + %37 = OpVectorTimesScalar %v4float %36 %33 + OpStore %p1 %37 + %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %44 = OpLoad %v4float %43 + %45 = OpVectorTimesScalar %v4float %44 %41 + OpStore %p2 %45 + %49 = OpLoad %v4float %p0 + %50 = OpLoad %v4float %p1 + %51 = OpFAdd %v4float %49 %50 + %52 = OpLoad %v4float %p2 + %53 = OpFAdd %v4float %51 %52 + %55 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %55 %53 + %60 = OpAccessChain %_ptr_Input_v4float %tse_color %int_0 + %61 = OpLoad %v4float %60 + %66 = OpAccessChain %_ptr_PushConstant_v4float %pc %int_0 + %67 = OpLoad %v4float %66 + %68 = OpFAdd %v4float %61 %67 + OpStore %frag_color %68 + OpReturn + OpFunctionEnd + +[fragment shader] +#version 450 + +layout(location = 0) in vec4 frag_color; +layout(location = 0) out vec4 final_color; + +void main() { + final_color = frag_color; +} + +[vertex data] +# position vert_color + 0/R8G8_SNORM 1/R8G8B8A8_UNORM + +# Red for entire frame +# R8 G8 R8 G8 B8 A8 + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + -128 127 255 0 0 255 + + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + 127 -128 255 0 0 255 + +[test] +uniform float 0 0.0 0.0 0.3 0.0 +clear +draw arrays PATCH_LIST 0 6 +relative probe rect rgb (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0.3) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_eval_ssbo_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_eval_ssbo_entry_point.amber new file mode 100644 index 0000000..a6148b0 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_eval_ssbo_entry_point.amber @@ -0,0 +1,213 @@ +[require] +VK_KHR_spirv_1_4 +tessellationShader + +[vertex shader] +#version 450 + +layout(location = 0) in vec4 position; +layout(location = 1) in vec4 vert_color; +layout(location = 0) out vec4 tsc_color; + +void main() { + gl_Position = position; + tsc_color = vert_color; +} + +[tessellation control shader] +#version 450 +#extension GL_ARB_separate_shader_objects : enable + +layout(vertices = 3) out; + +layout(location = 0) in vec4 tsc_color[]; +layout(location = 0) out vec4 tse_color[]; + +#define ID gl_InvocationID + +void main() +{ + gl_out[ID].gl_Position = gl_in[ID].gl_Position; + tse_color[ID] = tsc_color[ID]; + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 1.0; + gl_TessLevelOuter[2] = 1.0; + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 1.0; +} + +[tessellation evaluation shader spirv] +; Test tessellation evaluation shader with an SSBO on the entry point. +; #version 450 +; #extension GL_ARB_separate_shader_objects : enable +; +; layout(triangles, equal_spacing, cw) in; +; +; layout(location = 0) in vec4 tse_color[]; +; layout(location = 0) out vec4 frag_color; +; +; layout(std430, binding = 0) buffer input_buffer +; { +; vec4 in_val; +; }; +; +; void main() +; { +; vec4 p0 = gl_TessCoord.x * gl_in[0].gl_Position; +; vec4 p1 = gl_TessCoord.y * gl_in[1].gl_Position; +; vec4 p2 = gl_TessCoord.z * gl_in[2].gl_Position; +; gl_Position = p0 + p1 + p2; +; frag_color = tse_color[0]+in_val; +; } + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %gl_TessCoord %gl_in %_ %frag_color %tse_color %__0 + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCw + OpSource GLSL 450 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpName %main "main" + OpName %p0 "p0" + OpName %gl_TessCoord "gl_TessCoord" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_in "gl_in" + OpName %p1 "p1" + OpName %p2 "p2" + OpName %gl_PerVertex_0 "gl_PerVertex" + OpMemberName %gl_PerVertex_0 0 "gl_Position" + OpMemberName %gl_PerVertex_0 1 "gl_PointSize" + OpMemberName %gl_PerVertex_0 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex_0 3 "gl_CullDistance" + OpName %_ "" + OpName %frag_color "frag_color" + OpName %tse_color "tse_color" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "in_val" + OpName %__0 "" + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex_0 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %frag_color Location 0 + OpDecorate %tse_color Location 0 + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_uint_32 = OpTypeArray %gl_PerVertex %uint_32 +%_ptr_Input__arr_gl_PerVertex_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_32 Input + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0 + %_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output +%_ptr_Output_v4float = OpTypePointer Output %v4float + %frag_color = OpVariable %_ptr_Output_v4float Output +%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32 +%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32 + %tse_color = OpVariable %_ptr_Input__arr_v4float_uint_32 Input +%input_buffer = OpTypeStruct %v4float +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %__0 = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %p0 = OpVariable %_ptr_Function_v4float Function + %p1 = OpVariable %_ptr_Function_v4float Function + %p2 = OpVariable %_ptr_Function_v4float Function + %16 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %17 = OpLoad %float %16 + %28 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %29 = OpLoad %v4float %28 + %30 = OpVectorTimesScalar %v4float %29 %17 + OpStore %p0 %30 + %32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %36 = OpLoad %v4float %35 + %37 = OpVectorTimesScalar %v4float %36 %33 + OpStore %p1 %37 + %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %44 = OpLoad %v4float %43 + %45 = OpVectorTimesScalar %v4float %44 %41 + OpStore %p2 %45 + %49 = OpLoad %v4float %p0 + %50 = OpLoad %v4float %p1 + %51 = OpFAdd %v4float %49 %50 + %52 = OpLoad %v4float %p2 + %53 = OpFAdd %v4float %51 %52 + %55 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %55 %53 + %60 = OpAccessChain %_ptr_Input_v4float %tse_color %int_0 + %61 = OpLoad %v4float %60 + %66 = OpAccessChain %_ptr_StorageBuffer_v4float %__0 %int_0 + %67 = OpLoad %v4float %66 + %68 = OpFAdd %v4float %61 %67 + OpStore %frag_color %68 + OpReturn + OpFunctionEnd + +[fragment shader] +#version 450 + +layout(location = 0) in vec4 frag_color; +layout(location = 0) out vec4 final_color; + +void main() { + final_color = frag_color; +} + +[vertex data] +# position vert_color + 0/R8G8_SNORM 1/R8G8B8A8_UNORM + +# Red for entire frame +# R8 G8 R8 G8 B8 A8 + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + -128 127 255 0 0 255 + + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + 127 -128 255 0 0 255 + +[test] +ssbo 0:0 subdata float 0 0.0 0.0 0.3 0.0 +clear +draw arrays PATCH_LIST 0 6 +relative probe rect rgb (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0.3) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_eval_ubo_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_eval_ubo_entry_point.amber new file mode 100644 index 0000000..7d2267a --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/tess_eval_ubo_entry_point.amber @@ -0,0 +1,213 @@ +[require] +VK_KHR_spirv_1_4 +tessellationShader + +[vertex shader] +#version 450 + +layout(location = 0) in vec4 position; +layout(location = 1) in vec4 vert_color; +layout(location = 0) out vec4 tsc_color; + +void main() { + gl_Position = position; + tsc_color = vert_color; +} + +[tessellation control shader] +#version 450 +#extension GL_ARB_separate_shader_objects : enable + +layout(vertices = 3) out; + +layout(location = 0) in vec4 tsc_color[]; +layout(location = 0) out vec4 tse_color[]; + +#define ID gl_InvocationID + +void main() +{ + gl_out[ID].gl_Position = gl_in[ID].gl_Position; + tse_color[ID] = tsc_color[ID]; + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 1.0; + gl_TessLevelOuter[2] = 1.0; + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 1.0; +} + +[tessellation evaluation shader spirv] +; Test tessellation evaluation shader with a UBO on the entry point. +; #version 450 +; #extension GL_ARB_separate_shader_objects : enable +; +; layout(triangles, equal_spacing, cw) in; +; +; layout(location = 0) in vec4 tse_color[]; +; layout(location = 0) out vec4 frag_color; +; +; layout(binding = 0) uniform input_buffer +; { +; vec4 in_val; +; }; +; +; void main() +; { +; vec4 p0 = gl_TessCoord.x * gl_in[0].gl_Position; +; vec4 p1 = gl_TessCoord.y * gl_in[1].gl_Position; +; vec4 p2 = gl_TessCoord.z * gl_in[2].gl_Position; +; gl_Position = p0 + p1 + p2; +; frag_color = tse_color[0]+in_val; +; } + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %gl_TessCoord %gl_in %_ %frag_color %tse_color %__0 + OpExecutionMode %main Triangles + OpExecutionMode %main SpacingEqual + OpExecutionMode %main VertexOrderCw + OpSource GLSL 450 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpName %main "main" + OpName %p0 "p0" + OpName %gl_TessCoord "gl_TessCoord" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_in "gl_in" + OpName %p1 "p1" + OpName %p2 "p2" + OpName %gl_PerVertex_0 "gl_PerVertex" + OpMemberName %gl_PerVertex_0 0 "gl_Position" + OpMemberName %gl_PerVertex_0 1 "gl_PointSize" + OpMemberName %gl_PerVertex_0 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex_0 3 "gl_CullDistance" + OpName %_ "" + OpName %frag_color "frag_color" + OpName %tse_color "tse_color" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "in_val" + OpName %__0 "" + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex_0 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex_0 Block + OpDecorate %frag_color Location 0 + OpDecorate %tse_color Location 0 + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_32 = OpConstant %uint 32 +%_arr_gl_PerVertex_uint_32 = OpTypeArray %gl_PerVertex %uint_32 +%_ptr_Input__arr_gl_PerVertex_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_uint_32 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_32 Input + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0 + %_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output +%_ptr_Output_v4float = OpTypePointer Output %v4float + %frag_color = OpVariable %_ptr_Output_v4float Output +%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32 +%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32 + %tse_color = OpVariable %_ptr_Input__arr_v4float_uint_32 Input +%input_buffer = OpTypeStruct %v4float +%_ptr_Uniform_input_buffer = OpTypePointer Uniform %input_buffer + %__0 = OpVariable %_ptr_Uniform_input_buffer Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %p0 = OpVariable %_ptr_Function_v4float Function + %p1 = OpVariable %_ptr_Function_v4float Function + %p2 = OpVariable %_ptr_Function_v4float Function + %16 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %17 = OpLoad %float %16 + %28 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %29 = OpLoad %v4float %28 + %30 = OpVectorTimesScalar %v4float %29 %17 + OpStore %p0 %30 + %32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0 + %36 = OpLoad %v4float %35 + %37 = OpVectorTimesScalar %v4float %36 %33 + OpStore %p1 %37 + %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0 + %44 = OpLoad %v4float %43 + %45 = OpVectorTimesScalar %v4float %44 %41 + OpStore %p2 %45 + %49 = OpLoad %v4float %p0 + %50 = OpLoad %v4float %p1 + %51 = OpFAdd %v4float %49 %50 + %52 = OpLoad %v4float %p2 + %53 = OpFAdd %v4float %51 %52 + %55 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %55 %53 + %60 = OpAccessChain %_ptr_Input_v4float %tse_color %int_0 + %61 = OpLoad %v4float %60 + %66 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 + %67 = OpLoad %v4float %66 + %68 = OpFAdd %v4float %61 %67 + OpStore %frag_color %68 + OpReturn + OpFunctionEnd + +[fragment shader] +#version 450 + +layout(location = 0) in vec4 frag_color; +layout(location = 0) out vec4 final_color; + +void main() { + final_color = frag_color; +} + +[vertex data] +# position vert_color + 0/R8G8_SNORM 1/R8G8B8A8_UNORM + +# Red for entire frame +# R8 G8 R8 G8 B8 A8 + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + -128 127 255 0 0 255 + + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + 127 -128 255 0 0 255 + +[test] +uniform ubo 0:0 float 0 0.0 0.0 0.3 0.0 +clear +draw arrays PATCH_LIST 0 6 +relative probe rect rgb (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0.3) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/vert_pc_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/vert_pc_entry_point.amber new file mode 100644 index 0000000..55a517e --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/vert_pc_entry_point.amber @@ -0,0 +1,156 @@ +[require] +VK_KHR_spirv_1_4 + +[vertex shader spirv] +; Test a vertex shader with a push constant on the OpEntryPoint. +; +;#version 450 +; +;layout(push_constant) uniform pushConstants { +; vec2 in_val_0; +; vec2 in_val_1; +; vec2 in_val_2; +; vec2 in_val_3; +;} u_pushConstants; +; +;void main() +;{ +; switch(gl_VertexIndex) +; { +; case 0: +; { +; gl_Position = vec4(u_pushConstants.in_val_0, 0.0, 1.0); +; break; +; } +; case 1: +; { +; gl_Position = vec4(u_pushConstants.in_val_1, 0.0, 1.0); +; break; +; } +; case 2: +; { +; gl_Position = vec4(u_pushConstants.in_val_2, 0.0, 1.0); +; break; +; } +; case 3: +; { +; gl_Position = vec4(u_pushConstants.in_val_3, 0.0, 1.0); +; break; +; } +; } +;} + OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %gl_VertexIndex %gl_Output %u_pushConstants + OpSource GLSL 450 + OpName %main "main" + OpName %gl_VertexIndex "gl_VertexIndex" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_Output "gl_Output" + OpName %pushConstants "pushConstants" + OpMemberName %pushConstants 0 "in_val_0" + OpMemberName %pushConstants 1 "in_val_1" + OpMemberName %pushConstants 2 "in_val_2" + OpMemberName %pushConstants 3 "in_val_3" + OpName %u_pushConstants "u_pushConstants" + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %pushConstants 0 Offset 0 + OpMemberDecorate %pushConstants 1 Offset 8 + OpMemberDecorate %pushConstants 2 Offset 16 + OpMemberDecorate %pushConstants 3 Offset 24 + OpDecorate %pushConstants Block +%type_void = OpTypeVoid +%type_func_void = OpTypeFunction %type_void +%sint = OpTypeInt 32 1 +%ptr_sint_input = OpTypePointer Input %sint +%gl_VertexIndex = OpVariable %ptr_sint_input Input +%float32 = OpTypeFloat 32 +%fvec4 = OpTypeVector %float32 4 +%uint = OpTypeInt 32 0 +%const_uint_1 = OpConstant %uint 1 +%type_array_float = OpTypeArray %float32 %const_uint_1 +%gl_PerVertex = OpTypeStruct %fvec4 %float32 %type_array_float %type_array_float +%ptr_perVert_out = OpTypePointer Output %gl_PerVertex +%gl_Output = OpVariable %ptr_perVert_out Output +%const_sint_0 = OpConstant %sint 0 +%fvec2 = OpTypeVector %float32 2 +%pushConstants = OpTypeStruct %fvec2 %fvec2 %fvec2 %fvec2 +%ptr_push_const = OpTypePointer PushConstant %pushConstants +%u_pushConstants = OpVariable %ptr_push_const PushConstant +%ptr_pc_fvec2 = OpTypePointer PushConstant %fvec2 +%const_float32_0 = OpConstant %float32 0 +%const_float32_1 = OpConstant %float32 1 +%ptr_output_fvec4 = OpTypePointer Output %fvec4 +%const_sint_1 = OpConstant %sint 1 +%const_sint_2 = OpConstant %sint 2 +%const_sint_3 = OpConstant %sint 3 +%main = OpFunction %type_void None %type_func_void +%5 = OpLabel +%9 = OpLoad %sint %gl_VertexIndex + OpSelectionMerge %14 None + OpSwitch %9 %14 0 %10 1 %11 2 %12 3 %13 +%10 = OpLabel +%31 = OpAccessChain %ptr_pc_fvec2 %u_pushConstants %const_sint_0 +%32 = OpLoad %fvec2 %31 +%35 = OpCompositeExtract %float32 %32 0 +%36 = OpCompositeExtract %float32 %32 1 +%37 = OpCompositeConstruct %fvec4 %35 %36 %const_float32_0 %const_float32_1 +%39 = OpAccessChain %ptr_output_fvec4 %gl_Output %const_sint_0 + OpStore %39 %37 + OpBranch %14 +%11 = OpLabel +%42 = OpAccessChain %ptr_pc_fvec2 %u_pushConstants %const_sint_1 +%43 = OpLoad %fvec2 %42 +%44 = OpCompositeExtract %float32 %43 0 +%45 = OpCompositeExtract %float32 %43 1 +%46 = OpCompositeConstruct %fvec4 %44 %45 %const_float32_0 %const_float32_1 +%47 = OpAccessChain %ptr_output_fvec4 %gl_Output %const_sint_0 + OpStore %47 %46 + OpBranch %14 +%12 = OpLabel +%50 = OpAccessChain %ptr_pc_fvec2 %u_pushConstants %const_sint_2 +%51 = OpLoad %fvec2 %50 +%52 = OpCompositeExtract %float32 %51 0 +%53 = OpCompositeExtract %float32 %51 1 +%54 = OpCompositeConstruct %fvec4 %52 %53 %const_float32_0 %const_float32_1 +%55 = OpAccessChain %ptr_output_fvec4 %gl_Output %const_sint_0 + OpStore %55 %54 + OpBranch %14 +%13 = OpLabel +%58 = OpAccessChain %ptr_pc_fvec2 %u_pushConstants %const_sint_3 +%59 = OpLoad %fvec2 %58 +%60 = OpCompositeExtract %float32 %59 0 +%61 = OpCompositeExtract %float32 %59 1 +%62 = OpCompositeConstruct %fvec4 %60 %61 %const_float32_0 %const_float32_1 +%63 = OpAccessChain %ptr_output_fvec4 %gl_Output %const_sint_0 + OpStore %63 %62 + OpBranch %14 +%14 = OpLabel + OpReturn + OpFunctionEnd + +[fragment shader] +#version 430 +layout(location = 0) out vec4 outColor; +void main() { + outColor = vec4(0.5, 0.5, 0.5, 0.5); +} + +[test] +clear +# Draw over bottom left quadrant +uniform float 0 -1.0 -1.0 0.0 -1.0 -1.0 0.0 0.0 0.0 +draw rect -1 -1 2 2 + +probe rect rgba (0, 0, 125, 125) (0.5 0.5 0.5 0.5) +probe rect rgba (125, 125, 125, 125) (0.0 0.0 0.0 0.0) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/vert_ssbo_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/vert_ssbo_entry_point.amber new file mode 100644 index 0000000..12be351 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/vert_ssbo_entry_point.amber @@ -0,0 +1,99 @@ +[require] +VK_KHR_spirv_1_4 + +[vertex shader spirv] +; Test a vertex shader with an SSBO in the OpEntryPoint instruction. +; +; #version 450 +; +; layout(std430, binding = 0) buffer input_buffer +; { +; vec2 in_data[3]; +; }; +; +; void main() { +; gl_Position = vec4(in_data[gl_VertexIndex], 0.0, 1.0); +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %__0 %gl_VertexIndex + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "in_data" + OpName %__0 "" + OpName %gl_VertexIndex "gl_VertexIndex" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %_arr_v2float_uint_3 ArrayStride 8 + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v2float = OpTypeVector %float 2 + %uint_3 = OpConstant %uint 3 +%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 +%input_buffer = OpTypeStruct %_arr_v2float_uint_3 +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %__0 = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input +%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %24 = OpLoad %int %gl_VertexIndex + %26 = OpAccessChain %_ptr_StorageBuffer_v2float %__0 %int_0 %24 + %27 = OpLoad %v2float %26 + %30 = OpCompositeExtract %float %27 0 + %31 = OpCompositeExtract %float %27 1 + %32 = OpCompositeConstruct %v4float %30 %31 %float_0 %float_1 + %34 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %34 %32 + OpReturn + OpFunctionEnd +[fragment shader] +#version 430 +layout(location = 0) out vec4 outColor; +void main() { + outColor = vec4(0.5, 0.5, 0.5, 0.5); +} + +[vertex data] + 0/R8G8_SNORM 1/R8G8B8A8_UNORM + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + -128 127 255 0 0 255 + +[test] +ssbo 0:0 subdata float 0 -1.0 -1.0 1.0 -1.0 -1.0 1.0 +clear +draw arrays TRIANGLE_LIST 0 3 + +probe rect rgba (0, 0, 125, 125) (0.5 0.5 0.5 0.5) +probe rect rgba (125, 125, 125, 125) (0.0 0.0 0.0 0.0) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/vert_ubo_entry_point.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/vert_ubo_entry_point.amber new file mode 100644 index 0000000..cdf2f66 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/entrypoint/vert_ubo_entry_point.amber @@ -0,0 +1,99 @@ +[require] +VK_KHR_spirv_1_4 + +[vertex shader spirv] +; Test a vertex shader with a ubo on the OpEntryPoint. +; +; #version 450 +; +; layout(binding = 0) uniform input_buffer +; { +; vec2 in_data[3]; +; }; +; +; void main() { +; gl_Position = vec4(in_data[gl_VertexIndex], 0.0, 1.0); +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %__0 %gl_VertexIndex + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "in_data" + OpName %__0 "" + OpName %gl_VertexIndex "gl_VertexIndex" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %_arr_v2float_uint_3 ArrayStride 16 + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v2float = OpTypeVector %float 2 + %uint_3 = OpConstant %uint 3 +%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 +%input_buffer = OpTypeStruct %_arr_v2float_uint_3 +%_ptr_Uniform_input_buffer = OpTypePointer Uniform %input_buffer + %__0 = OpVariable %_ptr_Uniform_input_buffer Uniform +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %24 = OpLoad %int %gl_VertexIndex + %26 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %24 + %27 = OpLoad %v2float %26 + %30 = OpCompositeExtract %float %27 0 + %31 = OpCompositeExtract %float %27 1 + %32 = OpCompositeConstruct %v4float %30 %31 %float_0 %float_1 + %34 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %34 %32 + OpReturn + OpFunctionEnd +[fragment shader] +#version 430 +layout(location = 0) out vec4 outColor; +void main() { + outColor = vec4(0.5, 0.5, 0.5, 0.5); +} + +[vertex data] + 0/R8G8_SNORM 1/R8G8B8A8_UNORM + -128 -128 255 0 0 255 + 127 127 255 0 0 255 + -128 127 255 0 0 255 + +[test] +uniform ubo 0:0 float 0 -1.0 -1.0 0.0 0.0 1.0 -1.0 0.0 0.0 -1.0 1.0 +clear +draw arrays TRIANGLE_LIST 0 3 + +probe rect rgba (0, 0, 125, 125) (0.5 0.5 0.5 0.5) +probe rect rgba (125, 125, 125, 125) (0.0 0.0 0.0 0.0) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/counter_buffer.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/counter_buffer.amber new file mode 100644 index 0000000..cae890b --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/counter_buffer.amber @@ -0,0 +1,104 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Test that the HlslCounterBufferGOOGLE/CounterBuffer decoration is accepted. +; Generated with +; +; +; RWStructuredBuffer sbuf_rw_i; +; RWStructuredBuffer sbuf_rw_d; +; +; void main() +; { +; sbuf_rw_i[0].x = sbuf_rw_i.IncrementCounter(); +; sbuf_rw_d[0].x = sbuf_rw_d.DecrementCounter(); +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %sbuf_rw_i_0 %sbuf_rw_i_count_0 %sbuf_rw_d %sbuf_rw_d_count + OpExecutionMode %main LocalSize 1 1 1 + OpSource HLSL 500 + OpName %main "main" + OpName %sbuf_rw_i "sbuf_rw_i" + OpMemberName %sbuf_rw_i 0 "@data" + OpName %sbuf_rw_i_0 "sbuf_rw_i" + OpName %sbuf_rw_i_count "sbuf_rw_i@count" + OpMemberName %sbuf_rw_i_count 0 "@count" + OpName %sbuf_rw_i_count_0 "sbuf_rw_i@count" + OpName %sbuf_rw_d "sbuf_rw_d" + OpName %sbuf_rw_d_count "sbuf_rw_d@count" + OpDecorate %_runtimearr_v4uint ArrayStride 16 + OpMemberDecorate %sbuf_rw_i 0 Offset 0 + OpDecorate %sbuf_rw_i Block + OpDecorate %sbuf_rw_i_0 DescriptorSet 0 + OpDecorate %sbuf_rw_i_0 Binding 0 + OpMemberDecorate %sbuf_rw_i_count 0 Offset 0 + OpDecorate %sbuf_rw_i_count Block + OpDecorate %sbuf_rw_i_count_0 DescriptorSet 0 + OpDecorate %sbuf_rw_i_count_0 Binding 1 + OpDecorate %sbuf_rw_d DescriptorSet 0 + OpDecorate %sbuf_rw_d Binding 2 + OpDecorate %sbuf_rw_d_count DescriptorSet 0 + OpDecorate %sbuf_rw_d_count Binding 3 + OpDecorateId %sbuf_rw_i_0 CounterBuffer %sbuf_rw_i_count_0 + OpDecorateId %sbuf_rw_d CounterBuffer %sbuf_rw_d_count + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%sbuf_rw_i_count = OpTypeStruct %uint +%_ptr_StorageBuffer_sbuf_rw_i_count = OpTypePointer StorageBuffer %sbuf_rw_i_count +%sbuf_rw_i_count_0 = OpVariable %_ptr_StorageBuffer_sbuf_rw_i_count StorageBuffer +%_runtimearr_v4uint = OpTypeRuntimeArray %v4uint + %sbuf_rw_i = OpTypeStruct %_runtimearr_v4uint +%_ptr_StorageBuffer_sbuf_rw_i = OpTypePointer StorageBuffer %sbuf_rw_i +%sbuf_rw_i_0 = OpVariable %_ptr_StorageBuffer_sbuf_rw_i StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%sbuf_rw_d_count = OpVariable %_ptr_StorageBuffer_sbuf_rw_i_count StorageBuffer + %sbuf_rw_d = OpVariable %_ptr_StorageBuffer_sbuf_rw_i StorageBuffer +%uint_4294967295 = OpConstant %uint 4294967295 + %int_n1 = OpConstant %int -1 + %main = OpFunction %void None %3 + %5 = OpLabel + %34 = OpAccessChain %_ptr_StorageBuffer_uint %sbuf_rw_i_count_0 %int_0 + %35 = OpAtomicIAdd %uint %34 %uint_1 %uint_0 %uint_1 + %36 = OpAccessChain %_ptr_StorageBuffer_uint %sbuf_rw_i_0 %int_0 %int_0 %uint_0 + OpStore %36 %35 + %37 = OpAccessChain %_ptr_StorageBuffer_uint %sbuf_rw_d_count %int_0 + %38 = OpAtomicIAdd %uint %37 %uint_1 %uint_0 %uint_4294967295 + %39 = OpIAdd %uint %38 %int_n1 + %40 = OpAccessChain %_ptr_StorageBuffer_uint %sbuf_rw_d %int_0 %int_0 %uint_0 + OpStore %40 %39 + OpReturn + OpFunctionEnd +[test] +# sbuf_rw_i_0 +ssbo 0:0 16 +# sbuf_rw_i_count_0 +ssbo 0:1 4 +# sbuf_rw_d +ssbo 0:2 16 +# sbuf_rw_d_count +ssbo 0:3 4 + +ssbo 0:0 subdata uint 0 200 200 200 200 +ssbo 0:1 subdata uint 0 8 +ssbo 0:2 subdata uint 0 200 200 200 200 +ssbo 0:3 subdata uint 0 8 + +compute entrypoint main +compute 1 1 1 + +# Check the storage buffer. +probe ssbo uint 0:0 0 == 8 200 200 200 +probe ssbo uint 0:2 0 == 7 200 200 200 + +# Check the counters. +probe ssbo uint 0:1 0 == 9 +probe ssbo uint 0:3 0 == 7 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string.amber new file mode 100644 index 0000000..4a6dbda --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string.amber @@ -0,0 +1,106 @@ +[require] +VK_KHR_spirv_1_4 + +[vertex shader spirv] +; Generated with +; +; #version 450 +; layout(location = 0) flat out uint pos; +; layout(location = 0) in vec4 position; +; void main() +; { +; gl_Position = position; +; pos = 0; +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %position %pos + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %position "position" + OpName %pos "pos" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %position Location 0 + OpDecorate %pos Flat + OpDecorate %pos Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %position = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output_uint = OpTypePointer Output %uint + %pos = OpVariable %_ptr_Output_uint Output + %uint_0 = OpConstant %uint 0 + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpLoad %v4float %position + %20 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %20 %18 + OpStore %pos %uint_0 + OpReturn + OpFunctionEnd + +[fragment shader spirv] +; Test that OpDecorateStringGOOGLE/OpDecorateString is accepted. +; Generated with +; +; float4 main(uint pos : FOO) : SV_Target0 +; { +; float4 result = 0.5; +; return result; +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %pos %_entryPointOutput + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + OpName %pos "pos" + OpName %_entryPointOutput "@entryPointOutput" + OpDecorate %pos Flat + OpDecorate %pos Location 0 + OpDecorateString %pos UserSemantic "FOO" + OpDecorate %_entryPointOutput Location 0 + OpDecorateString %_entryPointOutput UserSemantic "SV_TARGET0" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_0_5 = OpConstant %float 0.5 + %17 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 +%_ptr_Input_uint = OpTypePointer Input %uint + %pos = OpVariable %_ptr_Input_uint Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %_entryPointOutput %17 + OpReturn + OpFunctionEnd +[test] +draw rect -1 -1 2 2 + +probe rect rgba (0, 0, 250, 250) (0.5, 0.5, 0.5, 0.5) diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/member_decorate_string.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/member_decorate_string.amber new file mode 100644 index 0000000..0abddc4 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/member_decorate_string.amber @@ -0,0 +1,123 @@ +#!amber + +# Copyright 2020 Valve Corporation. +# Copyright 2020 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_EXTENSION VK_KHR_spirv_1_4 + +SHADER vertex vtx_shader SPIRV-ASM +; Based on: +; +; #version 450 +; #extension GL_ARB_enhanced_layouts : require +; +; layout(location=0) in vec4 in_pos; +; +; layout(location=0) out OutputBlock +; { +; layout(location=0) vec4 out_color; +; }; +; +; void main() +; { +; gl_Position = in_pos; +; out_color = vec4(0.0, 1.0, 0.0, 1.0); +; } + +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %in_pos %__0 + OpSource GLSL 450 + OpSourceExtension "GL_ARB_enhanced_layouts" + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %in_pos "in_pos" + OpName %OutputBlock "OutputBlock" + OpMemberName %OutputBlock 0 "out_color" + OpName %__0 "" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %in_pos Location 0 + OpMemberDecorate %OutputBlock 0 Location 0 +; Testing OpMemberDecorateString below. + OpMemberDecorateString %OutputBlock 0 UserSemantic "FOO" + OpDecorate %OutputBlock Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %in_pos = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutputBlock = OpTypeStruct %v4float +%_ptr_Output_OutputBlock = OpTypePointer Output %OutputBlock + %__0 = OpVariable %_ptr_Output_OutputBlock Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %26 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpLoad %v4float %in_pos + %20 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %20 %18 + %27 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %27 %26 + OpReturn + OpFunctionEnd +END + +SHADER fragment frag_shader GLSL +#version 450 +// Ignoring input color. +layout(location=0) out vec4 out_color; + +void main() +{ + out_color = vec4(0.0, 1.0, 0.0, 1.0); +} +END + +BUFFER framebuffer_img FORMAT R8G8B8A8_UNORM + +PIPELINE graphics graphics_pipeline + ATTACH vtx_shader + ATTACH frag_shader + BIND BUFFER framebuffer_img AS color LOCATION 0 +END + +RUN graphics_pipeline DRAW_RECT POS 0 0 SIZE 250 250 +EXPECT framebuffer_img IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/iteration_multiple.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/iteration_multiple.amber new file mode 100644 index 0000000..476e06a --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/iteration_multiple.amber @@ -0,0 +1,118 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Use the IterationMultiple loop control. +; Generated from with modified loop control: +; +; #version 430 +; +; +; layout(std430, binding = 0) buffer input_buffer +; { +; int in_size; +; ivec4 data_SSBO[]; +; }; +; +; layout(std430, binding = 1) buffer output_buffer +; { +; int out_size; +; ivec4 out_SSBO[]; +; }; +; +; void main() { +; for( int i = 0; i < in_size; ++i ) { +; out_SSBO[i] = data_SSBO[i]; +; } +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ %__0 + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %i "i" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "in_size" + OpMemberName %input_buffer 1 "data_SSBO" + OpName %_ "" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_size" + OpMemberName %output_buffer 1 "out_SSBO" + OpName %__0 "" + OpDecorate %_runtimearr_v4int ArrayStride 16 + OpMemberDecorate %input_buffer 0 Offset 0 + OpMemberDecorate %input_buffer 1 Offset 16 + OpDecorate %input_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_v4int_0 ArrayStride 16 + OpMemberDecorate %output_buffer 0 Offset 0 + OpMemberDecorate %output_buffer 1 Offset 16 + OpDecorate %output_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %v4int = OpTypeVector %int 4 +%_runtimearr_v4int = OpTypeRuntimeArray %v4int +%input_buffer = OpTypeStruct %int %_runtimearr_v4int +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %_ = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %bool = OpTypeBool +%_runtimearr_v4int_0 = OpTypeRuntimeArray %v4int +%output_buffer = OpTypeStruct %int %_runtimearr_v4int_0 +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %__0 = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %int_1 = OpConstant %int 1 +%_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 IterationMultiple 3 + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %23 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 + %24 = OpLoad %int %23 + %26 = OpSLessThan %bool %15 %24 + OpBranchConditional %26 %11 %12 + %11 = OpLabel + %32 = OpLoad %int %i + %33 = OpLoad %int %i + %35 = OpAccessChain %_ptr_StorageBuffer_v4int %_ %int_1 %33 + %36 = OpLoad %v4int %35 + %37 = OpAccessChain %_ptr_StorageBuffer_v4int %__0 %int_1 %32 + OpStore %37 %36 + OpBranch %13 + %13 = OpLabel + %38 = OpLoad %int %i + %39 = OpIAdd %int %38 %int_1 + OpStore %i %39 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + +[test] +ssbo 0:0 112 +ssbo 0:0 subdata int 0 6 0 0 0 +ssbo 0:0 subdata int 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 +ssbo 0:1 112 +ssbo 0:1 subdata int 0 6 0 0 0 +ssbo 0:1 subdata int 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:1 16 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/max_iterations.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/max_iterations.amber new file mode 100644 index 0000000..e85225b --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/max_iterations.amber @@ -0,0 +1,118 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Use the MaxIterations loop control. +; Generated from with modified loop control: +; +; #version 430 +; +; +; layout(std430, binding = 0) buffer input_buffer +; { +; int in_size; +; ivec4 data_SSBO[]; +; }; +; +; layout(std430, binding = 1) buffer output_buffer +; { +; int out_size; +; ivec4 out_SSBO[]; +; }; +; +; void main() { +; for( int i = 0; i < in_size; ++i ) { +; out_SSBO[i] = data_SSBO[i]; +; } +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ %__0 + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %i "i" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "in_size" + OpMemberName %input_buffer 1 "data_SSBO" + OpName %_ "" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_size" + OpMemberName %output_buffer 1 "out_SSBO" + OpName %__0 "" + OpDecorate %_runtimearr_v4int ArrayStride 16 + OpMemberDecorate %input_buffer 0 Offset 0 + OpMemberDecorate %input_buffer 1 Offset 16 + OpDecorate %input_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_v4int_0 ArrayStride 16 + OpMemberDecorate %output_buffer 0 Offset 0 + OpMemberDecorate %output_buffer 1 Offset 16 + OpDecorate %output_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %v4int = OpTypeVector %int 4 +%_runtimearr_v4int = OpTypeRuntimeArray %v4int +%input_buffer = OpTypeStruct %int %_runtimearr_v4int +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %_ = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %bool = OpTypeBool +%_runtimearr_v4int_0 = OpTypeRuntimeArray %v4int +%output_buffer = OpTypeStruct %int %_runtimearr_v4int_0 +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %__0 = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %int_1 = OpConstant %int 1 +%_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 MaxIterations 6 + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %23 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 + %24 = OpLoad %int %23 + %26 = OpSLessThan %bool %15 %24 + OpBranchConditional %26 %11 %12 + %11 = OpLabel + %32 = OpLoad %int %i + %33 = OpLoad %int %i + %35 = OpAccessChain %_ptr_StorageBuffer_v4int %_ %int_1 %33 + %36 = OpLoad %v4int %35 + %37 = OpAccessChain %_ptr_StorageBuffer_v4int %__0 %int_1 %32 + OpStore %37 %36 + OpBranch %13 + %13 = OpLabel + %38 = OpLoad %int %i + %39 = OpIAdd %int %38 %int_1 + OpStore %i %39 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + +[test] +ssbo 0:0 112 +ssbo 0:0 subdata int 0 6 0 0 0 +ssbo 0:0 subdata int 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 +ssbo 0:1 112 +ssbo 0:1 subdata int 0 6 0 0 0 +ssbo 0:1 subdata int 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:1 16 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/min_iterations.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/min_iterations.amber new file mode 100644 index 0000000..1b3dbf8 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/min_iterations.amber @@ -0,0 +1,118 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Use the MinIterations loop control. +; Generated from with modified loop control: +; +; #version 430 +; +; +; layout(std430, binding = 0) buffer input_buffer +; { +; int in_size; +; ivec4 data_SSBO[]; +; }; +; +; layout(std430, binding = 1) buffer output_buffer +; { +; int out_size; +; ivec4 out_SSBO[]; +; }; +; +; void main() { +; for( int i = 0; i < in_size; ++i ) { +; out_SSBO[i] = data_SSBO[i]; +; } +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ %__0 + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %i "i" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "in_size" + OpMemberName %input_buffer 1 "data_SSBO" + OpName %_ "" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_size" + OpMemberName %output_buffer 1 "out_SSBO" + OpName %__0 "" + OpDecorate %_runtimearr_v4int ArrayStride 16 + OpMemberDecorate %input_buffer 0 Offset 0 + OpMemberDecorate %input_buffer 1 Offset 16 + OpDecorate %input_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_v4int_0 ArrayStride 16 + OpMemberDecorate %output_buffer 0 Offset 0 + OpMemberDecorate %output_buffer 1 Offset 16 + OpDecorate %output_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %v4int = OpTypeVector %int 4 +%_runtimearr_v4int = OpTypeRuntimeArray %v4int +%input_buffer = OpTypeStruct %int %_runtimearr_v4int +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %_ = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %bool = OpTypeBool +%_runtimearr_v4int_0 = OpTypeRuntimeArray %v4int +%output_buffer = OpTypeStruct %int %_runtimearr_v4int_0 +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %__0 = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %int_1 = OpConstant %int 1 +%_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 MinIterations 4 + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %23 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 + %24 = OpLoad %int %23 + %26 = OpSLessThan %bool %15 %24 + OpBranchConditional %26 %11 %12 + %11 = OpLabel + %32 = OpLoad %int %i + %33 = OpLoad %int %i + %35 = OpAccessChain %_ptr_StorageBuffer_v4int %_ %int_1 %33 + %36 = OpLoad %v4int %35 + %37 = OpAccessChain %_ptr_StorageBuffer_v4int %__0 %int_1 %32 + OpStore %37 %36 + OpBranch %13 + %13 = OpLabel + %38 = OpLoad %int %i + %39 = OpIAdd %int %38 %int_1 + OpStore %i %39 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + +[test] +ssbo 0:0 112 +ssbo 0:0 subdata int 0 6 0 0 0 +ssbo 0:0 subdata int 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 +ssbo 0:1 112 +ssbo 0:1 subdata int 0 6 0 0 0 +ssbo 0:1 subdata int 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:1 16 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/partial_count.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/partial_count.amber new file mode 100644 index 0000000..6dd2516 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/partial_count.amber @@ -0,0 +1,118 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Use the PartialCount loop control. +; Generated from with modified loop control: +; +; #version 430 +; +; +; layout(std430, binding = 0) buffer input_buffer +; { +; int in_size; +; ivec4 data_SSBO[]; +; }; +; +; layout(std430, binding = 1) buffer output_buffer +; { +; int out_size; +; ivec4 out_SSBO[]; +; }; +; +; void main() { +; for( int i = 0; i < in_size; ++i ) { +; out_SSBO[i] = data_SSBO[i]; +; } +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ %__0 + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %i "i" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "in_size" + OpMemberName %input_buffer 1 "data_SSBO" + OpName %_ "" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_size" + OpMemberName %output_buffer 1 "out_SSBO" + OpName %__0 "" + OpDecorate %_runtimearr_v4int ArrayStride 16 + OpMemberDecorate %input_buffer 0 Offset 0 + OpMemberDecorate %input_buffer 1 Offset 16 + OpDecorate %input_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_v4int_0 ArrayStride 16 + OpMemberDecorate %output_buffer 0 Offset 0 + OpMemberDecorate %output_buffer 1 Offset 16 + OpDecorate %output_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %v4int = OpTypeVector %int 4 +%_runtimearr_v4int = OpTypeRuntimeArray %v4int +%input_buffer = OpTypeStruct %int %_runtimearr_v4int +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %_ = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %bool = OpTypeBool +%_runtimearr_v4int_0 = OpTypeRuntimeArray %v4int +%output_buffer = OpTypeStruct %int %_runtimearr_v4int_0 +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %__0 = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %int_1 = OpConstant %int 1 +%_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 PartialCount 4 + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %23 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 + %24 = OpLoad %int %23 + %26 = OpSLessThan %bool %15 %24 + OpBranchConditional %26 %11 %12 + %11 = OpLabel + %32 = OpLoad %int %i + %33 = OpLoad %int %i + %35 = OpAccessChain %_ptr_StorageBuffer_v4int %_ %int_1 %33 + %36 = OpLoad %v4int %35 + %37 = OpAccessChain %_ptr_StorageBuffer_v4int %__0 %int_1 %32 + OpStore %37 %36 + OpBranch %13 + %13 = OpLabel + %38 = OpLoad %int %i + %39 = OpIAdd %int %38 %int_1 + OpStore %i %39 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + +[test] +ssbo 0:0 112 +ssbo 0:0 subdata int 0 6 0 0 0 +ssbo 0:0 subdata int 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 +ssbo 0:1 112 +ssbo 0:1 subdata int 0 6 0 0 0 +ssbo 0:1 subdata int 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:1 16 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/peel_count.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/peel_count.amber new file mode 100644 index 0000000..fd9d0dc --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/loop_control/peel_count.amber @@ -0,0 +1,118 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Use the PeelCount loop control. +; Generated from with modified loop control: +; +; #version 430 +; +; +; layout(std430, binding = 0) buffer input_buffer +; { +; int in_size; +; ivec4 data_SSBO[]; +; }; +; +; layout(std430, binding = 1) buffer output_buffer +; { +; int out_size; +; ivec4 out_SSBO[]; +; }; +; +; void main() { +; for( int i = 0; i < in_size; ++i ) { +; out_SSBO[i] = data_SSBO[i]; +; } +; } + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ %__0 + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %i "i" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "in_size" + OpMemberName %input_buffer 1 "data_SSBO" + OpName %_ "" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_size" + OpMemberName %output_buffer 1 "out_SSBO" + OpName %__0 "" + OpDecorate %_runtimearr_v4int ArrayStride 16 + OpMemberDecorate %input_buffer 0 Offset 0 + OpMemberDecorate %input_buffer 1 Offset 16 + OpDecorate %input_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_v4int_0 ArrayStride 16 + OpMemberDecorate %output_buffer 0 Offset 0 + OpMemberDecorate %output_buffer 1 Offset 16 + OpDecorate %output_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %v4int = OpTypeVector %int 4 +%_runtimearr_v4int = OpTypeRuntimeArray %v4int +%input_buffer = OpTypeStruct %int %_runtimearr_v4int +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %_ = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %bool = OpTypeBool +%_runtimearr_v4int_0 = OpTypeRuntimeArray %v4int +%output_buffer = OpTypeStruct %int %_runtimearr_v4int_0 +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %__0 = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %int_1 = OpConstant %int 1 +%_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 PeelCount 2 + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %int %i + %23 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 + %24 = OpLoad %int %23 + %26 = OpSLessThan %bool %15 %24 + OpBranchConditional %26 %11 %12 + %11 = OpLabel + %32 = OpLoad %int %i + %33 = OpLoad %int %i + %35 = OpAccessChain %_ptr_StorageBuffer_v4int %_ %int_1 %33 + %36 = OpLoad %v4int %35 + %37 = OpAccessChain %_ptr_StorageBuffer_v4int %__0 %int_1 %32 + OpStore %37 %36 + OpBranch %13 + %13 = OpLabel + %38 = OpLoad %int %i + %39 = OpIAdd %int %38 %int_1 + OpStore %i %39 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + +[test] +ssbo 0:0 112 +ssbo 0:0 subdata int 0 6 0 0 0 +ssbo 0:0 subdata int 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 +ssbo 0:1 112 +ssbo 0:1 subdata int 0 6 0 0 0 +ssbo 0:1 subdata int 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:1 16 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/function_2_nonwritable.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/function_2_nonwritable.amber new file mode 100644 index 0000000..3c568cc --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/function_2_nonwritable.amber @@ -0,0 +1,92 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %out_var %in_var %gid_var +OpExecutionMode %main LocalSize 4 4 1 + +OpDecorate %uint_rta ArrayStride 4 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorate %func_var NonWritable + +OpDecorate %gid_var BuiltIn GlobalInvocationId + +%void = OpTypeVoid +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%uint3 = OpTypeVector %uint 3 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_5 = OpConstant %uint 5 +%uint_6 = OpConstant %uint 6 +%uint_7 = OpConstant %uint 7 +%uint_8 = OpConstant %uint 8 +%uint_9 = OpConstant %uint 9 +%uint_10 = OpConstant %uint 10 +%uint_11 = OpConstant %uint 11 +%uint_12 = OpConstant %uint 12 +%uint_13 = OpConstant %uint 13 +%uint_14 = OpConstant %uint 14 +%uint_15 = OpConstant %uint 15 +%uint_array_4 = OpTypeArray %uint %uint_4 +%array_array_4 = OpTypeArray %uint_array_4 %uint_4 + +%const_array_r_0 = OpConstantComposite %uint_array_4 %uint_15 %uint_14 %uint_13 %uint_12 +%const_array_r_1 = OpConstantComposite %uint_array_4 %uint_11 %uint_10 %uint_9 %uint_8 +%const_array_r_2 = OpConstantComposite %uint_array_4 %uint_7 %uint_6 %uint_5 %uint_4 +%const_array_r_3 = OpConstantComposite %uint_array_4 %uint_3 %uint_2 %uint_1 %uint_0 +%const_array_r = OpConstantComposite %array_array_4 %const_array_r_0 %const_array_r_1 %const_array_r_2 %const_array_r_3 + +%ptr_array_array_function = OpTypePointer Function %array_array_4 +%ptr_func_uint = OpTypePointer Function %uint +%uint_rta = OpTypeRuntimeArray %uint +%struct = OpTypeStruct %uint_rta +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%out_var = OpVariable %ptr_ssbo_struct StorageBuffer +%in_var = OpVariable %ptr_ssbo_struct StorageBuffer +%ptr_ssbo_uint = OpTypePointer StorageBuffer %uint +%ptr_input_uint3 = OpTypePointer Input %uint3 +%gid_var = OpVariable %ptr_input_uint3 Input + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%func_var = OpVariable %ptr_array_array_function Function %const_array_r +%gid = OpLoad %uint3 %gid_var +%gid_x = OpCompositeExtract %uint %gid 0 +%gid_y = OpCompositeExtract %uint %gid 1 +%x_modifier = OpIMul %uint %gid_x %uint_4 +%idx = OpIAdd %uint %x_modifier %gid_y +%in_gep = OpAccessChain %ptr_ssbo_uint %in_var %uint_0 %idx +%ld1 = OpLoad %uint %in_gep +%v_gep = OpAccessChain %ptr_func_uint %func_var %gid_x %gid_y +%ld2 = OpLoad %uint %v_gep +%add = OpIAdd %uint %ld1 %ld2 +%out_gep = OpAccessChain %ptr_ssbo_uint %out_var %uint_0 %idx +OpStore %out_gep %add +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 +ssbo 0:1 64 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:1 0 == 16 16 16 16 +probe ssbo uint 0:1 16 == 16 16 16 16 +probe ssbo uint 0:1 32 == 16 16 16 16 +probe ssbo uint 0:1 48 == 16 16 16 16 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/function_nonwritable.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/function_nonwritable.amber new file mode 100644 index 0000000..e3a651f --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/function_nonwritable.amber @@ -0,0 +1,111 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %uint_rta ArrayStride 4 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 0 + +OpDecorate %func_var1 NonWritable +OpDecorate %func_var2 NonWritable + +%void = OpTypeVoid +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_5 = OpConstant %uint 5 +%uint_6 = OpConstant %uint 6 +%uint_7 = OpConstant %uint 7 +%uint_8 = OpConstant %uint 8 +%uint_9 = OpConstant %uint 9 +%uint_10 = OpConstant %uint 10 +%uint_11 = OpConstant %uint 11 +%uint_12 = OpConstant %uint 12 +%uint_13 = OpConstant %uint 13 +%uint_14 = OpConstant %uint 14 +%uint_15 = OpConstant %uint 15 +%uint_array_4 = OpTypeArray %uint %uint_4 +%array_array_4 = OpTypeArray %uint_array_4 %uint_4 + +%const_array_f_0 = OpConstantComposite %uint_array_4 %uint_0 %uint_1 %uint_2 %uint_3 +%const_array_f_1 = OpConstantComposite %uint_array_4 %uint_4 %uint_5 %uint_6 %uint_7 +%const_array_f_2 = OpConstantComposite %uint_array_4 %uint_8 %uint_9 %uint_10 %uint_11 +%const_array_f_3 = OpConstantComposite %uint_array_4 %uint_12 %uint_13 %uint_14 %uint_15 +%const_array_f = OpConstantComposite %array_array_4 %const_array_f_0 %const_array_f_1 %const_array_f_2 %const_array_f_3 + +%const_array_r_0 = OpConstantComposite %uint_array_4 %uint_15 %uint_14 %uint_13 %uint_12 +%const_array_r_1 = OpConstantComposite %uint_array_4 %uint_11 %uint_10 %uint_9 %uint_8 +%const_array_r_2 = OpConstantComposite %uint_array_4 %uint_7 %uint_6 %uint_5 %uint_4 +%const_array_r_3 = OpConstantComposite %uint_array_4 %uint_3 %uint_2 %uint_1 %uint_0 +%const_array_r = OpConstantComposite %array_array_4 %const_array_r_0 %const_array_r_1 %const_array_r_2 %const_array_r_3 + +%ptr_array_array_function = OpTypePointer Function %array_array_4 +%ptr_func_uint = OpTypePointer Function %uint +%uint_rta = OpTypeRuntimeArray %uint +%struct = OpTypeStruct %uint_rta +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%out_var = OpVariable %ptr_ssbo_struct StorageBuffer +%ptr_ssbo_uint = OpTypePointer StorageBuffer %uint + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%func_var1 = OpVariable %ptr_array_array_function Function %const_array_f +%func_var2 = OpVariable %ptr_array_array_function Function %const_array_r +OpBranch %outer_loop + +%outer_loop = OpLabel +%i = OpPhi %uint %uint_0 %entry %inc_i %outer_latch +%inc_i = OpIAdd %uint %i %uint_1 +%outer_eq = OpIEqual %bool %inc_i %uint_4 +OpLoopMerge %outer_merge %outer_latch None +OpBranch %inner_loop + +%inner_loop = OpLabel +%j = OpPhi %uint %uint_0 %outer_loop %inc_j %inner_loop +%inc_j = OpIAdd %uint %j %uint_1 +%v1_gep = OpAccessChain %ptr_func_uint %func_var1 %i %j +%ld1 = OpLoad %uint %v1_gep +%v2_gep = OpAccessChain %ptr_func_uint %func_var2 %i %j +%ld2 = OpLoad %uint %v2_gep +%add = OpIAdd %uint %ld1 %ld2 +%i_modifier = OpIMul %uint %i %uint_4 +%out_idx = OpIAdd %uint %i_modifier %j +%out_gep = OpAccessChain %ptr_ssbo_uint %out_var %uint_0 %out_idx +OpStore %out_gep %add +%inner_eq = OpIEqual %bool %inc_j %uint_4 +OpLoopMerge %inner_merge %inner_loop None +OpBranchConditional %inner_eq %inner_merge %inner_loop + +%inner_merge = OpLabel +OpBranch %outer_latch + +%outer_latch = OpLabel +OpBranchConditional %outer_eq %outer_merge %outer_loop + +%outer_merge = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 64 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:0 0 == 15 15 15 15 +probe ssbo uint 0:0 16 == 15 15 15 15 +probe ssbo uint 0:0 32 == 15 15 15 15 +probe ssbo uint 0:0 48 == 15 15 15 15 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/non_main_function_nonwritable.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/non_main_function_nonwritable.amber new file mode 100644 index 0000000..cb94cd5 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/non_main_function_nonwritable.amber @@ -0,0 +1,45 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %func_var NonWritable +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 0 +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_2 = OpConstant %int 2 +%block = OpTypeStruct %int +%ptr_ssbo_block = OpTypePointer StorageBuffer %block +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%out_var = OpVariable %ptr_ssbo_block StorageBuffer +%void_fn = OpTypeFunction %void +%int_fn = OpTypeFunction %int +%ptr_func_int = OpTypePointer Function %int +%main = OpFunction %void None %void_fn +%entry = OpLabel +%call = OpFunctionCall %int %func +%gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 +OpStore %gep %call +OpReturn +OpFunctionEnd +%func = OpFunction %int None %int_fn +%func_entry = OpLabel +%func_var = OpVariable %ptr_func_int Function %int_2 +%ld = OpLoad %int %func_var +OpReturnValue %ld +OpFunctionEnd + +[test] +ssbo 0:0 4 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:0 0 == 2 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/private_2_nonwritable.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/private_2_nonwritable.amber new file mode 100644 index 0000000..416976c --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/private_2_nonwritable.amber @@ -0,0 +1,93 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %out_var %in_var %gid_var %priv_var +OpExecutionMode %main LocalSize 4 4 1 + +OpDecorate %uint_rta ArrayStride 4 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorate %priv_var NonWritable + +OpDecorate %gid_var BuiltIn GlobalInvocationId + +%void = OpTypeVoid +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%uint3 = OpTypeVector %uint 3 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_5 = OpConstant %uint 5 +%uint_6 = OpConstant %uint 6 +%uint_7 = OpConstant %uint 7 +%uint_8 = OpConstant %uint 8 +%uint_9 = OpConstant %uint 9 +%uint_10 = OpConstant %uint 10 +%uint_11 = OpConstant %uint 11 +%uint_12 = OpConstant %uint 12 +%uint_13 = OpConstant %uint 13 +%uint_14 = OpConstant %uint 14 +%uint_15 = OpConstant %uint 15 +%uint_array_4 = OpTypeArray %uint %uint_4 +%array_array_4 = OpTypeArray %uint_array_4 %uint_4 + +%const_array_r_0 = OpConstantComposite %uint_array_4 %uint_15 %uint_14 %uint_13 %uint_12 +%const_array_r_1 = OpConstantComposite %uint_array_4 %uint_11 %uint_10 %uint_9 %uint_8 +%const_array_r_2 = OpConstantComposite %uint_array_4 %uint_7 %uint_6 %uint_5 %uint_4 +%const_array_r_3 = OpConstantComposite %uint_array_4 %uint_3 %uint_2 %uint_1 %uint_0 +%const_array_r = OpConstantComposite %array_array_4 %const_array_r_0 %const_array_r_1 %const_array_r_2 %const_array_r_3 + +%ptr_array_array_private = OpTypePointer Private %array_array_4 +%ptr_priv_uint = OpTypePointer Private %uint +%uint_rta = OpTypeRuntimeArray %uint +%struct = OpTypeStruct %uint_rta +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%out_var = OpVariable %ptr_ssbo_struct StorageBuffer +%in_var = OpVariable %ptr_ssbo_struct StorageBuffer +%ptr_ssbo_uint = OpTypePointer StorageBuffer %uint +%ptr_input_uint3 = OpTypePointer Input %uint3 +%gid_var = OpVariable %ptr_input_uint3 Input +%priv_var = OpVariable %ptr_array_array_private Private %const_array_r + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %uint3 %gid_var +%gid_x = OpCompositeExtract %uint %gid 0 +%gid_y = OpCompositeExtract %uint %gid 1 +%x_modifier = OpIMul %uint %gid_x %uint_4 +%idx = OpIAdd %uint %x_modifier %gid_y +%in_gep = OpAccessChain %ptr_ssbo_uint %in_var %uint_0 %idx +%ld1 = OpLoad %uint %in_gep +%v_gep = OpAccessChain %ptr_priv_uint %priv_var %gid_x %gid_y +%ld2 = OpLoad %uint %v_gep +%add = OpIAdd %uint %ld1 %ld2 +%out_gep = OpAccessChain %ptr_ssbo_uint %out_var %uint_0 %idx +OpStore %out_gep %add +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 +ssbo 0:1 64 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:1 0 == 16 16 16 16 +probe ssbo uint 0:1 16 == 16 16 16 16 +probe ssbo uint 0:1 32 == 16 16 16 16 +probe ssbo uint 0:1 48 == 16 16 16 16 + + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/private_nonwritable.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/private_nonwritable.amber new file mode 100644 index 0000000..54c3836 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/nonwritable/private_nonwritable.amber @@ -0,0 +1,111 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %out_var %priv_var1 %priv_var2 +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %uint_rta ArrayStride 4 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 0 + +OpDecorate %priv_var1 NonWritable +OpDecorate %priv_var2 NonWritable + +%void = OpTypeVoid +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_5 = OpConstant %uint 5 +%uint_6 = OpConstant %uint 6 +%uint_7 = OpConstant %uint 7 +%uint_8 = OpConstant %uint 8 +%uint_9 = OpConstant %uint 9 +%uint_10 = OpConstant %uint 10 +%uint_11 = OpConstant %uint 11 +%uint_12 = OpConstant %uint 12 +%uint_13 = OpConstant %uint 13 +%uint_14 = OpConstant %uint 14 +%uint_15 = OpConstant %uint 15 +%uint_array_4 = OpTypeArray %uint %uint_4 +%array_array_4 = OpTypeArray %uint_array_4 %uint_4 + +%const_array_f_0 = OpConstantComposite %uint_array_4 %uint_0 %uint_1 %uint_2 %uint_3 +%const_array_f_1 = OpConstantComposite %uint_array_4 %uint_4 %uint_5 %uint_6 %uint_7 +%const_array_f_2 = OpConstantComposite %uint_array_4 %uint_8 %uint_9 %uint_10 %uint_11 +%const_array_f_3 = OpConstantComposite %uint_array_4 %uint_12 %uint_13 %uint_14 %uint_15 +%const_array_f = OpConstantComposite %array_array_4 %const_array_f_0 %const_array_f_1 %const_array_f_2 %const_array_f_3 + +%const_array_r_0 = OpConstantComposite %uint_array_4 %uint_15 %uint_14 %uint_13 %uint_12 +%const_array_r_1 = OpConstantComposite %uint_array_4 %uint_11 %uint_10 %uint_9 %uint_8 +%const_array_r_2 = OpConstantComposite %uint_array_4 %uint_7 %uint_6 %uint_5 %uint_4 +%const_array_r_3 = OpConstantComposite %uint_array_4 %uint_3 %uint_2 %uint_1 %uint_0 +%const_array_r = OpConstantComposite %array_array_4 %const_array_r_0 %const_array_r_1 %const_array_r_2 %const_array_r_3 + +%ptr_array_array_private = OpTypePointer Private %array_array_4 +%priv_var1 = OpVariable %ptr_array_array_private Private %const_array_f +%priv_var2 = OpVariable %ptr_array_array_private Private %const_array_r +%ptr_priv_uint = OpTypePointer Private %uint +%uint_rta = OpTypeRuntimeArray %uint +%struct = OpTypeStruct %uint_rta +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%out_var = OpVariable %ptr_ssbo_struct StorageBuffer +%ptr_ssbo_uint = OpTypePointer StorageBuffer %uint + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpBranch %outer_loop + +%outer_loop = OpLabel +%i = OpPhi %uint %uint_0 %entry %inc_i %outer_latch +%inc_i = OpIAdd %uint %i %uint_1 +%outer_eq = OpIEqual %bool %inc_i %uint_4 +OpLoopMerge %outer_merge %outer_latch None +OpBranch %inner_loop + +%inner_loop = OpLabel +%j = OpPhi %uint %uint_0 %outer_loop %inc_j %inner_loop +%inc_j = OpIAdd %uint %j %uint_1 +%v1_gep = OpAccessChain %ptr_priv_uint %priv_var1 %i %j +%ld1 = OpLoad %uint %v1_gep +%v2_gep = OpAccessChain %ptr_priv_uint %priv_var2 %i %j +%ld2 = OpLoad %uint %v2_gep +%add = OpIAdd %uint %ld1 %ld2 +%i_modifier = OpIMul %uint %i %uint_4 +%out_idx = OpIAdd %uint %i_modifier %j +%out_gep = OpAccessChain %ptr_ssbo_uint %out_var %uint_0 %out_idx +OpStore %out_gep %add +%inner_eq = OpIEqual %bool %inc_j %uint_4 +OpLoopMerge %inner_merge %inner_loop None +OpBranchConditional %inner_eq %inner_merge %inner_loop + +%inner_merge = OpLabel +OpBranch %outer_latch + +%outer_latch = OpLabel +OpBranchConditional %outer_eq %outer_merge %outer_loop + +%outer_merge = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 64 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:0 0 == 15 15 15 15 +probe ssbo uint 0:0 16 == 15 15 15 15 +probe ssbo uint 0:0 32 == 15 15 15 15 +probe ssbo uint 0:0 48 == 15 15 15 15 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/different_matrix_layout.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/different_matrix_layout.amber new file mode 100644 index 0000000..cab34c6 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/different_matrix_layout.amber @@ -0,0 +1,59 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Tests copying column major to row major matrix. + +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %struct1 Block +OpMemberDecorate %struct1 0 Offset 0 +OpMemberDecorate %struct1 0 ColMajor +OpMemberDecorate %struct1 0 MatrixStride 16 +OpDecorate %struct2 Block +OpMemberDecorate %struct2 0 Offset 0 +OpMemberDecorate %struct2 0 RowMajor +OpMemberDecorate %struct2 0 MatrixStride 16 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +%void = OpTypeVoid +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%matrix = OpTypeMatrix %float4 4 + +%struct1 = OpTypeStruct %matrix +%ptr_struct1 = OpTypePointer StorageBuffer %struct1 + +%struct2 = OpTypeStruct %matrix +%ptr_struct2 = OpTypePointer StorageBuffer %struct2 + +%in_var = OpVariable %ptr_struct1 StorageBuffer +%out_var = OpVariable %ptr_struct2 StorageBuffer + +%func_ty = OpTypeFunction %void +%main = OpFunction %void None %func_ty +%1 = OpLabel +%in_struct = OpLoad %struct1 %in_var +%copy = OpCopyLogical %struct2 %in_struct +OpStore %out_var %copy +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata vec4 0 1 2 3 4 +ssbo 0:0 subdata vec4 16 5 6 7 8 +ssbo 0:0 subdata vec4 32 9 10 11 12 +ssbo 0:0 subdata vec4 48 13 14 15 16 +ssbo 0:1 64 + +compute entrypoint main +compute 1 1 1 + +probe ssbo vec4 0:1 0 == 1 5 9 13 +probe ssbo vec4 0:1 16 == 2 6 10 14 +probe ssbo vec4 0:1 32 == 3 7 11 15 +probe ssbo vec4 0:1 48 == 4 8 12 16 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/different_matrix_strides.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/different_matrix_strides.amber new file mode 100644 index 0000000..207d4ae --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/different_matrix_strides.amber @@ -0,0 +1,59 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Tests copying structs containing a matrix with different matrix strides. + +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %struct1 Block +OpMemberDecorate %struct1 0 Offset 0 +OpMemberDecorate %struct1 0 ColMajor +OpMemberDecorate %struct1 0 MatrixStride 16 +OpDecorate %struct2 Block +OpMemberDecorate %struct2 0 Offset 0 +OpMemberDecorate %struct2 0 ColMajor +OpMemberDecorate %struct2 0 MatrixStride 32 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +%void = OpTypeVoid +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%matrix = OpTypeMatrix %float4 4 + +%struct1 = OpTypeStruct %matrix +%ptr_struct1 = OpTypePointer StorageBuffer %struct1 + +%struct2 = OpTypeStruct %matrix +%ptr_struct2 = OpTypePointer StorageBuffer %struct2 + +%in_var = OpVariable %ptr_struct1 StorageBuffer +%out_var = OpVariable %ptr_struct2 StorageBuffer + +%func_ty = OpTypeFunction %void +%main = OpFunction %void None %func_ty +%1 = OpLabel +%in_struct = OpLoad %struct1 %in_var +%copy = OpCopyLogical %struct2 %in_struct +OpStore %out_var %copy +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata vec4 0 1 2 3 4 +ssbo 0:0 subdata vec4 16 5 6 7 8 +ssbo 0:0 subdata vec4 32 9 10 11 12 +ssbo 0:0 subdata vec4 48 13 14 15 16 +ssbo 0:1 128 + +compute entrypoint main +compute 1 1 1 + +probe ssbo vec4 0:1 0 == 1 2 3 4 +probe ssbo vec4 0:1 32 == 5 6 7 8 +probe ssbo vec4 0:1 64 == 9 10 11 12 +probe ssbo vec4 0:1 96 == 13 14 15 16 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/nested_arrays_different_inner_stride.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/nested_arrays_different_inner_stride.amber new file mode 100644 index 0000000..175d4ab --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/nested_arrays_different_inner_stride.amber @@ -0,0 +1,84 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Tests copying two nested arrays with different inner array strides. + +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %struct_stride_4 Block +OpMemberDecorate %struct_stride_4 0 Offset 0 +OpDecorate %struct_stride_8 Block +OpMemberDecorate %struct_stride_8 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +OpDecorate %float_array_32_stride_4 ArrayStride 4 +OpDecorate %float_array_32_stride_8 ArrayStride 8 +OpDecorate %array_array_stride_4 ArrayStride 256 +OpDecorate %array_array_stride_8 ArrayStride 256 +%void = OpTypeVoid +%float = OpTypeFloat 32 +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_8 = OpConstant %uint 8 +%uint_32 = OpConstant %uint 32 + +%float_array_32_stride_4 = OpTypeArray %float %uint_32 +%array_array_stride_4 = OpTypeArray %float_array_32_stride_4 %uint_8 +%ptr_array_array_stride_4 = OpTypePointer StorageBuffer %array_array_stride_4 +%struct_stride_4 = OpTypeStruct %array_array_stride_4 +%ptr_struct_stride_4 = OpTypePointer StorageBuffer %struct_stride_4 + +%float_array_32_stride_8 = OpTypeArray %float %uint_32 +%array_array_stride_8 = OpTypeArray %float_array_32_stride_8 %uint_8 +%ptr_array_array_stride_8 = OpTypePointer StorageBuffer %array_array_stride_8 +%struct_stride_8 = OpTypeStruct %array_array_stride_8 +%ptr_struct_stride_8 = OpTypePointer StorageBuffer %struct_stride_8 + +%in_var = OpVariable %ptr_struct_stride_4 StorageBuffer +%out_var = OpVariable %ptr_struct_stride_8 StorageBuffer + +%func_ty = OpTypeFunction %void +%main = OpFunction %void None %func_ty +%1 = OpLabel +%in_gep = OpAccessChain %ptr_array_array_stride_4 %in_var %uint_0 +%in_array = OpLoad %array_array_stride_4 %in_gep +%copy = OpCopyLogical %array_array_stride_8 %in_array +%out_gep = OpAccessChain %ptr_array_array_stride_8 %out_var %uint_0 +OpStore %out_gep %copy +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata float 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 256 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 512 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 768 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 1024 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 1280 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 1536 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 1792 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:1 subdata float 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 256 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 512 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 768 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 1024 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 1280 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 1536 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 1792 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo float 0:1 0 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 256 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 512 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 768 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 1024 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 1280 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 1536 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 1792 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/nested_arrays_different_outer_stride.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/nested_arrays_different_outer_stride.amber new file mode 100644 index 0000000..3c80af3 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/nested_arrays_different_outer_stride.amber @@ -0,0 +1,77 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Tests copying nested arrays with differing outer array strides. + +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %struct_stride_4 Block +OpMemberDecorate %struct_stride_4 0 Offset 0 +OpDecorate %struct_stride_8 Block +OpMemberDecorate %struct_stride_8 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +OpDecorate %float_array_32_stride_4 ArrayStride 4 +OpDecorate %float_array_32_stride_8 ArrayStride 4 ;; for ease this ID is odd +OpDecorate %array_array_stride_4 ArrayStride 128 +OpDecorate %array_array_stride_8 ArrayStride 256 +%void = OpTypeVoid +%float = OpTypeFloat 32 +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_8 = OpConstant %uint 8 +%uint_32 = OpConstant %uint 32 + +%float_array_32_stride_4 = OpTypeArray %float %uint_32 +%array_array_stride_4 = OpTypeArray %float_array_32_stride_4 %uint_8 +%ptr_array_array_stride_4 = OpTypePointer StorageBuffer %array_array_stride_4 +%struct_stride_4 = OpTypeStruct %array_array_stride_4 +%ptr_struct_stride_4 = OpTypePointer StorageBuffer %struct_stride_4 + +%float_array_32_stride_8 = OpTypeArray %float %uint_32 +%array_array_stride_8 = OpTypeArray %float_array_32_stride_4 %uint_8 +%ptr_array_array_stride_8 = OpTypePointer StorageBuffer %array_array_stride_8 +%struct_stride_8 = OpTypeStruct %array_array_stride_8 +%ptr_struct_stride_8 = OpTypePointer StorageBuffer %struct_stride_8 + +%in_var = OpVariable %ptr_struct_stride_4 StorageBuffer +%out_var = OpVariable %ptr_struct_stride_8 StorageBuffer + +%func_ty = OpTypeFunction %void +%main = OpFunction %void None %func_ty +%1 = OpLabel +%in_gep = OpAccessChain %ptr_array_array_stride_4 %in_var %uint_0 +%in_array = OpLoad %array_array_stride_4 %in_gep +%copy = OpCopyLogical %array_array_stride_8 %in_array +%out_gep = OpAccessChain %ptr_array_array_stride_8 %out_var %uint_0 +OpStore %out_gep %copy +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata float 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 128 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 256 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 384 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 512 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 640 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 768 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 896 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:1 2048 + +compute entrypoint main +compute 1 1 1 + +probe ssbo float 0:1 0 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +probe ssbo float 0:1 256 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +probe ssbo float 0:1 512 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +probe ssbo float 0:1 768 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +probe ssbo float 0:1 1024 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +probe ssbo float 0:1 1280 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +probe ssbo float 0:1 1536 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +probe ssbo float 0:1 1792 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/nested_arrays_different_strides.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/nested_arrays_different_strides.amber new file mode 100644 index 0000000..d6dbb80 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/nested_arrays_different_strides.amber @@ -0,0 +1,84 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Tests copying nested arrays with differing inner and outer array strides. + +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %struct_stride_4 Block +OpMemberDecorate %struct_stride_4 0 Offset 0 +OpDecorate %struct_stride_8 Block +OpMemberDecorate %struct_stride_8 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +OpDecorate %float_array_32_stride_4 ArrayStride 4 +OpDecorate %float_array_32_stride_8 ArrayStride 8 +OpDecorate %array_array_stride_4 ArrayStride 128 +OpDecorate %array_array_stride_8 ArrayStride 256 +%void = OpTypeVoid +%float = OpTypeFloat 32 +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_8 = OpConstant %uint 8 +%uint_32 = OpConstant %uint 32 + +%float_array_32_stride_4 = OpTypeArray %float %uint_32 +%array_array_stride_4 = OpTypeArray %float_array_32_stride_4 %uint_8 +%ptr_array_array_stride_4 = OpTypePointer StorageBuffer %array_array_stride_4 +%struct_stride_4 = OpTypeStruct %array_array_stride_4 +%ptr_struct_stride_4 = OpTypePointer StorageBuffer %struct_stride_4 + +%float_array_32_stride_8 = OpTypeArray %float %uint_32 +%array_array_stride_8 = OpTypeArray %float_array_32_stride_8 %uint_8 +%ptr_array_array_stride_8 = OpTypePointer StorageBuffer %array_array_stride_8 +%struct_stride_8 = OpTypeStruct %array_array_stride_8 +%ptr_struct_stride_8 = OpTypePointer StorageBuffer %struct_stride_8 + +%in_var = OpVariable %ptr_struct_stride_4 StorageBuffer +%out_var = OpVariable %ptr_struct_stride_8 StorageBuffer + +%func_ty = OpTypeFunction %void +%main = OpFunction %void None %func_ty +%1 = OpLabel +%in_gep = OpAccessChain %ptr_array_array_stride_4 %in_var %uint_0 +%in_array = OpLoad %array_array_stride_4 %in_gep +%copy = OpCopyLogical %array_array_stride_8 %in_array +%out_gep = OpAccessChain %ptr_array_array_stride_8 %out_var %uint_0 +OpStore %out_gep %copy +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata float 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 128 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 256 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 384 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 512 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 640 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 768 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:0 subdata float 896 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:1 subdata float 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 256 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 512 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 768 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 1024 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 1280 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 1536 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +ssbo 0:1 subdata float 1792 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo float 0:1 0 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 256 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 512 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 768 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 1024 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 1280 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 1536 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +probe ssbo float 0:1 1792 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/same_array_two_ids.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/same_array_two_ids.amber new file mode 100644 index 0000000..aa8b8f6 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/same_array_two_ids.amber @@ -0,0 +1,58 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Tests copy of same structural array given two IDs. + +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %struct1 Block +OpMemberDecorate %struct1 0 Offset 0 +OpDecorate %struct2 Block +OpMemberDecorate %struct2 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +OpDecorate %float_array1 ArrayStride 4 +OpDecorate %float_array2 ArrayStride 4 +%void = OpTypeVoid +%float = OpTypeFloat 32 +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_32 = OpConstant %uint 32 + +%float_array1 = OpTypeArray %float %uint_32 +%ptr_float_array1 = OpTypePointer StorageBuffer %float_array1 +%struct1 = OpTypeStruct %float_array1 +%ptr_struct1 = OpTypePointer StorageBuffer %struct1 + +%float_array2 = OpTypeArray %float %uint_32 +%ptr_float_array2 = OpTypePointer StorageBuffer %float_array2 +%struct2 = OpTypeStruct %float_array2 +%ptr_struct2 = OpTypePointer StorageBuffer %struct2 + +%in_var = OpVariable %ptr_struct1 StorageBuffer +%out_var = OpVariable %ptr_struct2 StorageBuffer + +%func_ty = OpTypeFunction %void +%main = OpFunction %void None %func_ty +%1 = OpLabel +%in_gep = OpAccessChain %ptr_float_array1 %in_var %uint_0 +%in_array = OpLoad %float_array1 %in_gep +%copy = OpCopyLogical %float_array2 %in_array +%out_gep = OpAccessChain %ptr_float_array2 %out_var %uint_0 +OpStore %out_gep %copy +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata float 0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 +ssbo 0:1 128 + +compute entrypoint main +compute 1 1 1 + +probe ssbo float 0:1 0 == 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/same_struct_two_ids.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/same_struct_two_ids.amber new file mode 100644 index 0000000..c5b7ea8 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/same_struct_two_ids.amber @@ -0,0 +1,53 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Tests copying same structural struct with different IDs. + +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %struct1 Block +OpMemberDecorate %struct1 0 Offset 0 +OpMemberDecorate %struct1 1 Offset 4 +OpMemberDecorate %struct1 2 Offset 8 +OpMemberDecorate %struct1 3 Offset 12 +OpDecorate %struct2 Block +OpMemberDecorate %struct2 0 Offset 0 +OpMemberDecorate %struct2 1 Offset 4 +OpMemberDecorate %struct2 2 Offset 8 +OpMemberDecorate %struct2 3 Offset 12 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +%void = OpTypeVoid +%int = OpTypeInt 32 0 + +%struct1 = OpTypeStruct %int %int %int %int +%ptr_struct1 = OpTypePointer Uniform %struct1 + +%struct2 = OpTypeStruct %int %int %int %int +%ptr_struct2 = OpTypePointer StorageBuffer %struct2 + +%in_var = OpVariable %ptr_struct1 Uniform +%out_var = OpVariable %ptr_struct2 StorageBuffer + +%func_ty = OpTypeFunction %void +%main = OpFunction %void None %func_ty +%1 = OpLabel +%in_struct = OpLoad %struct1 %in_var +%copy = OpCopyLogical %struct2 %in_struct +OpStore %out_var %copy +OpReturn +OpFunctionEnd + +[test] +uniform ubo 0:0 uvec4 0 1 2 3 4 +ssbo 0:1 subdata uvec4 0 8 8 8 8 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uvec4 0:1 0 == 1 2 3 4 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/ssbo_to_ubo.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/ssbo_to_ubo.amber new file mode 100644 index 0000000..1e4ae13 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/ssbo_to_ubo.amber @@ -0,0 +1,94 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Tests converting from SSBO layout to UBO layout. + +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %struct1 Block +OpMemberDecorate %struct1 0 Offset 0 +OpMemberDecorate %struct1 1 Offset 16 +OpMemberDecorate %struct1 2 Offset 48 +OpMemberDecorate %struct1 3 Offset 64 +OpMemberDecorate %struct1 4 Offset 80 +OpMemberDecorate %struct1 5 Offset 96 +OpMemberDecorate %struct1 6 Offset 112 + +OpDecorate %struct2 Block +OpMemberDecorate %struct2 0 Offset 0 +OpMemberDecorate %struct2 1 Offset 4 +OpMemberDecorate %struct2 2 Offset 12 +OpMemberDecorate %struct2 3 Offset 16 +OpMemberDecorate %struct2 4 Offset 32 +OpMemberDecorate %struct2 5 Offset 48 +OpMemberDecorate %struct2 6 Offset 64 + +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorate %int_array_2_stride_4 ArrayStride 4 +OpDecorate %int_array_2_stride_16 ArrayStride 16 +OpMemberDecorate %int_struct1 0 Offset 4 +OpMemberDecorate %int_struct2 0 Offset 8 + +%void = OpTypeVoid +%float = OpTypeFloat 32 +%float2 = OpTypeVector %float 2 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%matrix = OpTypeMatrix %float4 4 +%int = OpTypeInt 32 0 +%int_2 = OpConstant %int 2 +%int_array_2_stride_4 = OpTypeArray %int %int_2 +%int_array_2_stride_16 = OpTypeArray %int %int_2 +%int_struct1 = OpTypeStruct %int +%int_struct2 = OpTypeStruct %int + +%struct1 = OpTypeStruct %int %int_array_2_stride_16 %int %int_struct1 %float4 %float3 %float2 +%ptr_struct1 = OpTypePointer StorageBuffer %struct1 + +%struct2 = OpTypeStruct %int %int_array_2_stride_4 %int %int_struct2 %float4 %float3 %float2 +%ptr_struct2 = OpTypePointer StorageBuffer %struct2 + +%in_var = OpVariable %ptr_struct2 StorageBuffer +%out_var = OpVariable %ptr_struct1 StorageBuffer + +%func_ty = OpTypeFunction %void +%main = OpFunction %void None %func_ty +%1 = OpLabel +%in_struct = OpLoad %struct2 %in_var +%copy = OpCopyLogical %struct1 %in_struct +OpStore %out_var %copy +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 1 +ssbo 0:0 subdata uint 4 2 3 +ssbo 0:0 subdata uint 12 4 +ssbo 0:0 subdata uint 24 5 +# Really vec4 +ssbo 0:0 subdata uint 32 6 7 8 9 +# Really vec3 +ssbo 0:0 subdata uint 48 10 11 12 +# Really vec2 +ssbo 0:0 subdata uint 64 13 14 +ssbo 0:1 128 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:1 0 == 1 +probe ssbo uint 0:1 16 == 2 +probe ssbo uint 0:1 32 == 3 +probe ssbo uint 0:1 48 == 4 +probe ssbo uint 0:1 68 == 5 +probe ssbo uint 0:1 80 == 6 7 8 9 +probe ssbo uint 0:1 96 == 10 11 12 +probe ssbo uint 0:1 112 == 13 14 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/two_arrays_different_stride_1.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/two_arrays_different_stride_1.amber new file mode 100644 index 0000000..5018ebe --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/two_arrays_different_stride_1.amber @@ -0,0 +1,58 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Tests copying smaller array stride to larger array stride. + +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %struct_stride_4 Block +OpMemberDecorate %struct_stride_4 0 Offset 0 +OpDecorate %struct_stride_8 Block +OpMemberDecorate %struct_stride_8 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +OpDecorate %float_array_32_stride_4 ArrayStride 4 +OpDecorate %float_array_32_stride_8 ArrayStride 8 +%void = OpTypeVoid +%float = OpTypeFloat 32 +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_32 = OpConstant %uint 32 + +%float_array_32_stride_4 = OpTypeArray %float %uint_32 +%ptr_float_array_32_stride_4 = OpTypePointer StorageBuffer %float_array_32_stride_4 +%struct_stride_4 = OpTypeStruct %float_array_32_stride_4 +%ptr_struct_stride_4 = OpTypePointer StorageBuffer %struct_stride_4 + +%float_array_32_stride_8 = OpTypeArray %float %uint_32 +%ptr_float_array_32_stride_8 = OpTypePointer StorageBuffer %float_array_32_stride_8 +%struct_stride_8 = OpTypeStruct %float_array_32_stride_8 +%ptr_struct_stride_8 = OpTypePointer StorageBuffer %struct_stride_8 + +%in_var = OpVariable %ptr_struct_stride_4 StorageBuffer +%out_var = OpVariable %ptr_struct_stride_8 StorageBuffer + +%func_ty = OpTypeFunction %void +%main = OpFunction %void None %func_ty +%1 = OpLabel +%in_gep = OpAccessChain %ptr_float_array_32_stride_4 %in_var %uint_0 +%in_array = OpLoad %float_array_32_stride_4 %in_gep +%copy = OpCopyLogical %float_array_32_stride_8 %in_array +%out_gep = OpAccessChain %ptr_float_array_32_stride_8 %out_var %uint_0 +OpStore %out_gep %copy +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata float 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 +ssbo 0:1 subdata float 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo float 0:1 0 == 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/two_arrays_different_stride_2.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/two_arrays_different_stride_2.amber new file mode 100644 index 0000000..f7a3b67 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/two_arrays_different_stride_2.amber @@ -0,0 +1,58 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Tests copying larger array stride to smaller array stride. + +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %struct_stride_4 Block +OpMemberDecorate %struct_stride_4 0 Offset 0 +OpDecorate %struct_stride_8 Block +OpMemberDecorate %struct_stride_8 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +OpDecorate %float_array_32_stride_4 ArrayStride 4 +OpDecorate %float_array_32_stride_8 ArrayStride 8 +%void = OpTypeVoid +%float = OpTypeFloat 32 +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_32 = OpConstant %uint 32 + +%float_array_32_stride_4 = OpTypeArray %float %uint_32 +%ptr_float_array_32_stride_4 = OpTypePointer StorageBuffer %float_array_32_stride_4 +%struct_stride_4 = OpTypeStruct %float_array_32_stride_4 +%ptr_struct_stride_4 = OpTypePointer StorageBuffer %struct_stride_4 + +%float_array_32_stride_8 = OpTypeArray %float %uint_32 +%ptr_float_array_32_stride_8 = OpTypePointer StorageBuffer %float_array_32_stride_8 +%struct_stride_8 = OpTypeStruct %float_array_32_stride_8 +%ptr_struct_stride_8 = OpTypePointer StorageBuffer %struct_stride_8 + +%in_var = OpVariable %ptr_struct_stride_8 StorageBuffer +%out_var = OpVariable %ptr_struct_stride_4 StorageBuffer + +%func_ty = OpTypeFunction %void +%main = OpFunction %void None %func_ty +%1 = OpLabel +%in_gep = OpAccessChain %ptr_float_array_32_stride_8 %in_var %uint_0 +%in_array = OpLoad %float_array_32_stride_8 %in_gep +%copy = OpCopyLogical %float_array_32_stride_4 %in_array +%out_gep = OpAccessChain %ptr_float_array_32_stride_4 %out_var %uint_0 +OpStore %out_gep %copy +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata float 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 +ssbo 0:1 128 + +compute entrypoint main +compute 1 1 1 + +probe ssbo float 0:1 0 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/ubo_to_ssbo.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/ubo_to_ssbo.amber new file mode 100644 index 0000000..800debf --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopylogical/ubo_to_ssbo.amber @@ -0,0 +1,96 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Tests conversion from UBO layout to SSBO layout. + +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %struct1 Block +OpMemberDecorate %struct1 0 Offset 0 +OpMemberDecorate %struct1 1 Offset 16 +OpMemberDecorate %struct1 2 Offset 48 +OpMemberDecorate %struct1 3 Offset 64 +OpMemberDecorate %struct1 4 Offset 80 +OpMemberDecorate %struct1 5 Offset 96 +OpMemberDecorate %struct1 6 Offset 112 + +OpDecorate %struct2 Block +OpMemberDecorate %struct2 0 Offset 0 +OpMemberDecorate %struct2 1 Offset 4 +OpMemberDecorate %struct2 2 Offset 12 +OpMemberDecorate %struct2 3 Offset 16 +OpMemberDecorate %struct2 4 Offset 32 +OpMemberDecorate %struct2 5 Offset 48 +OpMemberDecorate %struct2 6 Offset 64 + +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorate %int_array_2_stride_4 ArrayStride 4 +OpDecorate %int_array_2_stride_16 ArrayStride 16 +OpMemberDecorate %int_struct1 0 Offset 4 +OpMemberDecorate %int_struct2 0 Offset 8 + +%void = OpTypeVoid +%float = OpTypeFloat 32 +%float2 = OpTypeVector %float 2 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%matrix = OpTypeMatrix %float4 4 +%int = OpTypeInt 32 0 +%int_2 = OpConstant %int 2 +%int_array_2_stride_4 = OpTypeArray %int %int_2 +%int_array_2_stride_16 = OpTypeArray %int %int_2 +%int_struct1 = OpTypeStruct %int +%int_struct2 = OpTypeStruct %int + +%struct1 = OpTypeStruct %int %int_array_2_stride_16 %int %int_struct1 %float4 %float3 %float2 +%ptr_struct1 = OpTypePointer Uniform %struct1 + +%struct2 = OpTypeStruct %int %int_array_2_stride_4 %int %int_struct2 %float4 %float3 %float2 +%ptr_struct2 = OpTypePointer StorageBuffer %struct2 + +%in_var = OpVariable %ptr_struct1 Uniform +%out_var = OpVariable %ptr_struct2 StorageBuffer + +%func_ty = OpTypeFunction %void +%main = OpFunction %void None %func_ty +%1 = OpLabel +%in_struct = OpLoad %struct1 %in_var +%copy = OpCopyLogical %struct2 %in_struct +OpStore %out_var %copy +OpReturn +OpFunctionEnd + +[test] +# Really uint +uniform ubo 0:0 uint 0 1 +uniform ubo 0:0 uint 16 2 +uniform ubo 0:0 uint 32 3 +uniform ubo 0:0 uint 48 4 +uniform ubo 0:0 uint 68 5 +# Really vec4 +uniform ubo 0:0 uint 80 6 7 8 9 +# Really vec3 +uniform ubo 0:0 uint 96 10 11 12 +# Really vec2 +uniform ubo 0:0 uint 112 13 14 +ssbo 0:1 72 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:1 0 == 1 +probe ssbo uint 0:1 4 == 2 +probe ssbo uint 0:1 8 == 3 +probe ssbo uint 0:1 12 == 4 +probe ssbo uint 0:1 24 == 5 +probe ssbo uint 0:1 32 == 6 7 8 9 +probe ssbo uint 0:1 48 == 10 11 12 +probe ssbo uint 0:1 64 == 13 14 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopymemory/different_alignments.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopymemory/different_alignments.amber new file mode 100644 index 0000000..8889563 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopymemory/different_alignments.amber @@ -0,0 +1,61 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %ssbo +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpMemberDecorate %struct 1 Offset 16 +OpMemberDecorate %struct 2 Offset 32 +OpMemberDecorate %struct 3 Offset 48 +OpMemberDecorate %struct 4 Offset 64 +OpDecorate %ssbo DescriptorSet 0 +OpDecorate %ssbo Binding 0 + +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_4 = OpConstant %int 4 +%int4 = OpTypeVector %int 4 +%ptr_ssbo_int = OpTypePointer StorageBuffer %int + +%struct = OpTypeStruct %int4 %int %int %int %int +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%ssbo = OpVariable %ptr_ssbo_struct StorageBuffer + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%src_gep0 = OpAccessChain %ptr_ssbo_int %ssbo %int_0 %int_0 +%dst_gep0 = OpAccessChain %ptr_ssbo_int %ssbo %int_1 +OpCopyMemory %dst_gep0 %src_gep0 Aligned 16 Aligned 4 +%src_gep1 = OpAccessChain %ptr_ssbo_int %ssbo %int_0 %int_1 +%dst_gep1 = OpAccessChain %ptr_ssbo_int %ssbo %int_2 +OpCopyMemory %dst_gep1 %src_gep1 Aligned 16 Aligned 4 +%src_gep2 = OpAccessChain %ptr_ssbo_int %ssbo %int_0 %int_2 +%dst_gep2 = OpAccessChain %ptr_ssbo_int %ssbo %int_3 +OpCopyMemory %dst_gep2 %src_gep2 Aligned 16 Aligned 4 +%src_gep3 = OpAccessChain %ptr_ssbo_int %ssbo %int_0 %int_3 +%dst_gep3 = OpAccessChain %ptr_ssbo_int %ssbo %int_4 +OpCopyMemory %dst_gep3 %src_gep3 Aligned 16 Aligned 4 +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 68 +ssbo 0:0 subdata uint 0 1 2 3 4 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:0 16 == 1 +probe ssbo uint 0:0 32 == 2 +probe ssbo uint 0:0 48 == 3 +probe ssbo uint 0:0 64 == 4 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopymemory/no_source_access_operands.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopymemory/no_source_access_operands.amber new file mode 100644 index 0000000..47207fa --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopymemory/no_source_access_operands.amber @@ -0,0 +1,62 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %ssbo +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpMemberDecorate %struct 1 Offset 16 +OpMemberDecorate %struct 2 Offset 32 +OpMemberDecorate %struct 3 Offset 48 +OpMemberDecorate %struct 4 Offset 64 +OpDecorate %ssbo DescriptorSet 0 +OpDecorate %ssbo Binding 0 + +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_4 = OpConstant %int 4 +%int4 = OpTypeVector %int 4 +%ptr_ssbo_int = OpTypePointer StorageBuffer %int + +%struct = OpTypeStruct %int4 %int %int %int %int +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%ssbo = OpVariable %ptr_ssbo_struct StorageBuffer + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%src_gep0 = OpAccessChain %ptr_ssbo_int %ssbo %int_0 %int_0 +%dst_gep0 = OpAccessChain %ptr_ssbo_int %ssbo %int_1 +OpCopyMemory %dst_gep0 %src_gep0 Aligned 16 None +%src_gep1 = OpAccessChain %ptr_ssbo_int %ssbo %int_0 %int_1 +%dst_gep1 = OpAccessChain %ptr_ssbo_int %ssbo %int_2 +OpCopyMemory %dst_gep1 %src_gep1 Aligned 16 None +%src_gep2 = OpAccessChain %ptr_ssbo_int %ssbo %int_0 %int_2 +%dst_gep2 = OpAccessChain %ptr_ssbo_int %ssbo %int_3 +OpCopyMemory %dst_gep2 %src_gep2 Aligned 16 None +%src_gep3 = OpAccessChain %ptr_ssbo_int %ssbo %int_0 %int_3 +%dst_gep3 = OpAccessChain %ptr_ssbo_int %ssbo %int_4 +OpCopyMemory %dst_gep3 %src_gep3 Aligned 16 None +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 68 +ssbo 0:0 subdata uint 0 1 2 3 4 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:0 16 == 1 +probe ssbo uint 0:0 32 == 2 +probe ssbo uint 0:0 48 == 3 +probe ssbo uint 0:0 64 == 4 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopymemory/no_target_access_operands.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopymemory/no_target_access_operands.amber new file mode 100644 index 0000000..2eb6a49 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opcopymemory/no_target_access_operands.amber @@ -0,0 +1,62 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %ssbo +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpMemberDecorate %struct 1 Offset 16 +OpMemberDecorate %struct 2 Offset 32 +OpMemberDecorate %struct 3 Offset 48 +OpMemberDecorate %struct 4 Offset 64 +OpDecorate %ssbo DescriptorSet 0 +OpDecorate %ssbo Binding 0 + +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_4 = OpConstant %int 4 +%int4 = OpTypeVector %int 4 +%ptr_ssbo_int = OpTypePointer StorageBuffer %int + +%struct = OpTypeStruct %int4 %int %int %int %int +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%ssbo = OpVariable %ptr_ssbo_struct StorageBuffer + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%src_gep0 = OpAccessChain %ptr_ssbo_int %ssbo %int_0 %int_0 +%dst_gep0 = OpAccessChain %ptr_ssbo_int %ssbo %int_1 +OpCopyMemory %dst_gep0 %src_gep0 None Aligned 4 +%src_gep1 = OpAccessChain %ptr_ssbo_int %ssbo %int_0 %int_1 +%dst_gep1 = OpAccessChain %ptr_ssbo_int %ssbo %int_2 +OpCopyMemory %dst_gep1 %src_gep1 None Aligned 4 +%src_gep2 = OpAccessChain %ptr_ssbo_int %ssbo %int_0 %int_2 +%dst_gep2 = OpAccessChain %ptr_ssbo_int %ssbo %int_3 +OpCopyMemory %dst_gep2 %src_gep2 None Aligned 4 +%src_gep3 = OpAccessChain %ptr_ssbo_int %ssbo %int_0 %int_3 +%dst_gep3 = OpAccessChain %ptr_ssbo_int %ssbo %int_4 +OpCopyMemory %dst_gep3 %src_gep3 None Aligned 4 +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 68 +ssbo 0:0 subdata uint 0 1 2 3 4 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:0 16 == 1 +probe ssbo uint 0:0 32 == 2 +probe ssbo uint 0:0 48 == 3 +probe ssbo uint 0:0 64 == 4 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/ssbo_comparisons_diff.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/ssbo_comparisons_diff.amber new file mode 100644 index 0000000..ddcf6fe --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/ssbo_comparisons_diff.amber @@ -0,0 +1,171 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +; Test operates on a SSBO (%in_var) containing a runtime array of an array of four ints. +; Size of the runtime array is passed another SSBO (%n_var). + +; Each invocation writes out the result of OpPtrDiff +; for elements of the input runtime array to index 16 of the corresponding output +; variable. Pointers are based the gid'th element vs the zero'th element. + +; Each invocation loops 4 times and writes out results each for OpPtrDiff. +; The pointers are the lid'th element of gid'th element of +; the runtime array vs the iteration count element of the gid'th element of +; the runtime array. + +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %diff_var %n_var %lid_var %gid_var +OpExecutionMode %main LocalSize 4 1 1 + +OpDecorate %struct_4 Block +OpMemberDecorate %struct_4 0 Offset 0 +OpDecorate %runtime_4 ArrayStride 16 +OpDecorate %struct_17 Block +OpMemberDecorate %struct_17 0 Offset 0 +OpDecorate %runtime_17 ArrayStride 68 +OpDecorate %n_struct Block +OpMemberDecorate %n_struct 0 Offset 0 +OpDecorate %array_4 ArrayStride 4 +OpDecorate %array_17 ArrayStride 4 + +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %diff_var DescriptorSet 0 +OpDecorate %diff_var Binding 1 +OpDecorate %n_var DescriptorSet 0 +OpDecorate %n_var Binding 2 + +OpDecorate %lid_var BuiltIn LocalInvocationId +OpDecorate %gid_var BuiltIn WorkgroupId + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_4 = OpConstant %int 4 +%int_16 = OpConstant %int 16 +%int_17 = OpConstant %int 17 +%int3 = OpTypeVector %int 3 + +%ptr_input_int3 = OpTypePointer Input %int3 + +%array_4 = OpTypeArray %int %int_4 +%runtime_4 = OpTypeRuntimeArray %array_4 +%struct_4 = OpTypeStruct %runtime_4 +%ptr_struct_4 = OpTypePointer StorageBuffer %struct_4 +%ptr_array_4 = OpTypePointer StorageBuffer %array_4 + +%array_17 = OpTypeArray %int %int_17 +%runtime_17 = OpTypeRuntimeArray %array_17 +%struct_17 = OpTypeStruct %runtime_17 +%ptr_struct_17 = OpTypePointer StorageBuffer %struct_17 +%ptr_array_17 = OpTypePointer StorageBuffer %array_17 + +%ptr_int = OpTypePointer StorageBuffer %int +%n_struct = OpTypeStruct %int +%ptr_n_struct = OpTypePointer Uniform %n_struct +%ptr_n = OpTypePointer Uniform %int + +%in_var = OpVariable %ptr_struct_4 StorageBuffer +%diff_var = OpVariable %ptr_struct_17 StorageBuffer +%n_var = OpVariable %ptr_n_struct Uniform +%lid_var = OpVariable %ptr_input_int3 Input +%gid_var = OpVariable %ptr_input_int3 Input + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%n_gep = OpAccessChain %ptr_n %n_var %int_0 +%n = OpLoad %int %n_gep +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%lid = OpLoad %int3 %lid_var +%lid_x = OpCompositeExtract %int %lid 0 +%array_gep_0 = OpAccessChain %ptr_array_4 %in_var %int_0 %int_0 +%array_gep = OpAccessChain %ptr_array_4 %in_var %int_0 %gid_x +%cmp_gid = OpSGreaterThanEqual %bool %gid_x %n +OpSelectionMerge %body None +OpBranchConditional %cmp_gid %ret %body + +%ret = OpLabel +OpReturn + +%body = OpLabel +%cmp_lid = OpIEqual %bool %lid_x %int_1 +OpSelectionMerge %loop None +OpBranchConditional %cmp_lid %then %loop + +%then = OpLabel +; Compute results for outer array +%large_diff = OpPtrDiff %int %array_gep %array_gep_0 +%large_diff_gep = OpAccessChain %ptr_int %diff_var %int_0 %gid_x %int_16 +OpStore %large_diff_gep %large_diff +; +OpBranch %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %body %int_0 %then %inc_i %loop +%inc_i = OpIAdd %int %i %int_1 +%i_cmp = OpIEqual %bool %inc_i %int_4 +%lid_offset = OpIMul %int %lid_x %int_4 +%gep_offset = OpIAdd %int %lid_offset %i +; Compute results for inner array +%ref_gep = OpAccessChain %ptr_int %array_gep %lid_x +%cmp_gep = OpAccessChain %ptr_int %array_gep %i +%diff = OpPtrDiff %int %ref_gep %cmp_gep +%diff_gep = OpAccessChain %ptr_int %diff_var %int_0 %gid_x %gep_offset +OpStore %diff_gep %diff +; +OpLoopMerge %exit %loop None +OpBranchConditional %i_cmp %exit %loop + +%exit = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 2048 +ssbo 0:1 2176 +uniform ubo 0:2 int 0 32 + +compute entrypoint main +compute 32 1 1 + +# diff var +probe ssbo int 0:1 0 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 0 +probe ssbo int 0:1 68 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 1 +probe ssbo int 0:1 136 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 2 +probe ssbo int 0:1 204 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 3 +probe ssbo int 0:1 272 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 4 +probe ssbo int 0:1 340 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 5 +probe ssbo int 0:1 408 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 6 +probe ssbo int 0:1 476 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 7 +probe ssbo int 0:1 544 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 8 +probe ssbo int 0:1 612 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 9 +probe ssbo int 0:1 680 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 10 +probe ssbo int 0:1 748 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 11 +probe ssbo int 0:1 816 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 12 +probe ssbo int 0:1 884 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 13 +probe ssbo int 0:1 952 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 14 +probe ssbo int 0:1 1020 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 15 +probe ssbo int 0:1 1088 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 16 +probe ssbo int 0:1 1156 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 17 +probe ssbo int 0:1 1224 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 18 +probe ssbo int 0:1 1292 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 19 +probe ssbo int 0:1 1360 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 20 +probe ssbo int 0:1 1428 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 21 +probe ssbo int 0:1 1496 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 22 +probe ssbo int 0:1 1564 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 23 +probe ssbo int 0:1 1632 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 24 +probe ssbo int 0:1 1700 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 25 +probe ssbo int 0:1 1768 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 26 +probe ssbo int 0:1 1836 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 27 +probe ssbo int 0:1 1904 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 28 +probe ssbo int 0:1 1972 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 29 +probe ssbo int 0:1 2040 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 30 +probe ssbo int 0:1 2108 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 31 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/variable_pointers_vars_ssbo_2_diff.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/variable_pointers_vars_ssbo_2_diff.amber new file mode 100644 index 0000000..b383f4b --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/variable_pointers_vars_ssbo_2_diff.amber @@ -0,0 +1,153 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +; Tests pointer comparisons with variable pointers + +; Stores an array of pointers in Function storage class that point into input +; SSBO. Each iteration produces an int2 result containing two OpPtrDiffs +; Pointers evolve by incrementing or decrementing by 1 each iteration (overall +; ratio is 2:1). + +; All uses of OpPtrDiff are within %in_var, so we only need +; VariablePointersStorageBuffer capability and the corresponding Vulkan +; feature bit. + +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %in_struct Block +OpMemberDecorate %in_struct 0 Offset 0 +OpMemberDecorate %in_struct 1 Offset 4 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 + +OpDecorate %int2_rta ArrayStride 8 +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorate %ptr_ssbo_int ArrayStride 4 + +%void = OpTypeVoid +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%int = OpTypeInt 32 1 +%int_n1 = OpConstant %int -1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int2 = OpTypeVector %int 2 + +%int_rta = OpTypeRuntimeArray %int +%in_struct = OpTypeStruct %int %int_rta +%ptr_ssbo_in_struct = OpTypePointer StorageBuffer %in_struct +%in_var = OpVariable %ptr_ssbo_in_struct StorageBuffer + +%int2_rta = OpTypeRuntimeArray %int2 +%out_struct = OpTypeStruct %int2_rta +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer + +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%array_ptr = OpTypeArray %ptr_ssbo_int %int_2 +%ptr_ptr = OpTypePointer Function %array_ptr +%ptr_func_ptr = OpTypePointer Function %ptr_ssbo_int + +%ptr_ssbo_n = OpTypePointer StorageBuffer %int +%ptr_ssbo_int2 = OpTypePointer StorageBuffer %int2 +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%var = OpVariable %ptr_ptr Function +%n_gep = OpAccessChain %ptr_ssbo_n %in_var %int_0 +%n = OpLoad %int %n_gep +%length = OpArrayLength %uint %in_var 1 +%length_div_2 = OpSDiv %int %length %int_2 +%mid_gep = OpAccessChain %ptr_ssbo_int %in_var %int_1 %length_div_2 +%func_gep_0 = OpAccessChain %ptr_func_ptr %var %int_0 +%func_gep_1 = OpAccessChain %ptr_func_ptr %var %int_1 +OpStore %func_gep_0 %mid_gep +OpStore %func_gep_1 %mid_gep +%cmp_n = OpSLessThanEqual %bool %n %int_0 +OpSelectionMerge %exit None +OpBranchConditional %cmp_n %exit %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %inc_i %continue +%gep_0 = OpLoad %ptr_ssbo_int %func_gep_0 +%gep_1 = OpLoad %ptr_ssbo_int %func_gep_1 +%inc_i = OpIAdd %int %i %int_1 + +%diff1 = OpPtrDiff %int %gep_0 %gep_1 +%diff2 = OpPtrDiff %int %gep_1 %gep_0 +%result = OpCompositeConstruct %int2 %diff1 %diff2 +%out_gep = OpAccessChain %ptr_ssbo_int2 %out_var %int_0 %i +OpStore %out_gep %result + +OpLoopMerge %loop_exit %continue None +OpBranch %body + +%body = OpLabel +%i_mod_3 = OpSMod %int %i %int_3 +%cmp_vs_0 = OpIEqual %bool %i_mod_3 %int_0 +OpSelectionMerge %if_merge None +OpBranchConditional %cmp_vs_0 %then %else + +%then = OpLabel +%then_0_next = OpPtrAccessChain %ptr_ssbo_int %gep_0 %int_n1 +%then_1_next = OpPtrAccessChain %ptr_ssbo_int %gep_1 %int_1 +OpBranch %if_merge +%else = OpLabel +%else_0_next = OpPtrAccessChain %ptr_ssbo_int %gep_0 %int_1 +%else_1_next = OpPtrAccessChain %ptr_ssbo_int %gep_1 %int_n1 +OpBranch %if_merge + +%if_merge = OpLabel +%next_0 = OpPhi %ptr_ssbo_int %then_0_next %then %else_0_next %else +%next_1 = OpPhi %ptr_ssbo_int %then_1_next %then %else_1_next %else +OpBranch %continue + +%continue = OpLabel +OpStore %func_gep_0 %next_0 +OpStore %func_gep_1 %next_1 +%cmp = OpSGreaterThanEqual %bool %i %n +OpBranchConditional %cmp %loop_exit %loop + +%loop_exit = OpLabel +OpBranch %exit +%exit = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 68 +ssbo 0:0 subdata uint 0 16 +ssbo 0:1 128 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:1 0 == 0 0 +probe ssbo int 0:1 8 == -2 2 +probe ssbo int 0:1 16 == 0 0 +probe ssbo int 0:1 24 == 2 -2 +probe ssbo int 0:1 32 == 0 0 +probe ssbo int 0:1 40 == 2 -2 +probe ssbo int 0:1 48 == 4 -4 +probe ssbo int 0:1 56 == 2 -2 +probe ssbo int 0:1 64 == 4 -4 +probe ssbo int 0:1 72 == 6 -6 +probe ssbo int 0:1 80 == 4 -4 +probe ssbo int 0:1 88 == 6 -6 +probe ssbo int 0:1 96 == 8 -8 +probe ssbo int 0:1 104 == 6 -6 +probe ssbo int 0:1 112 == 8 -8 +probe ssbo int 0:1 120 == 10 -10 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/variable_pointers_vars_ssbo_diff.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/variable_pointers_vars_ssbo_diff.amber new file mode 100644 index 0000000..840bc38 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/variable_pointers_vars_ssbo_diff.amber @@ -0,0 +1,141 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +; Tests use of private variables holding SSBO pointers and pointer comparisons. + +; Two iterators are each stored in Private variables: one moves forward, one +; moves backward. In each iteration an int2 result is written that contains two +; diffs. Iterators are then moved forward (or backward respectively) one index. + +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var %forward_var %backward_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %in_struct Block +OpMemberDecorate %in_struct 0 Offset 0 +OpMemberDecorate %in_struct 1 Offset 4 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 + +OpDecorate %int2_rta ArrayStride 8 +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorate %ptr_ssbo_int ArrayStride 4 + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_n1 = OpConstant %int -1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int2 = OpTypeVector %int 2 + +%int_rta = OpTypeRuntimeArray %int +%in_struct = OpTypeStruct %int %int_rta +%ptr_ssbo_in_struct = OpTypePointer StorageBuffer %in_struct +%in_var = OpVariable %ptr_ssbo_in_struct StorageBuffer + +%int2_rta = OpTypeRuntimeArray %int2 +%out_struct = OpTypeStruct %int2_rta +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer + +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%ptr_ptr = OpTypePointer Private %ptr_ssbo_int +%forward_var = OpVariable %ptr_ptr Private +%backward_var = OpVariable %ptr_ptr Private + +%ptr_ssbo_n = OpTypePointer StorageBuffer %int +%ptr_ssbo_int2 = OpTypePointer StorageBuffer %int2 +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%n_gep = OpAccessChain %ptr_ssbo_n %in_var %int_0 +%n = OpLoad %int %n_gep +%first_gep = OpAccessChain %ptr_ssbo_int %in_var %int_1 %int_0 +OpStore %forward_var %first_gep +%last_gep = OpPtrAccessChain %ptr_ssbo_int %first_gep %n +OpStore %backward_var %last_gep +%cmp_n = OpSLessThanEqual %bool %n %int_0 +OpSelectionMerge %exit None +OpBranchConditional %cmp_n %exit %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %inc_i %loop +%forward_gep = OpLoad %ptr_ssbo_int %forward_var +%backward_gep = OpLoad %ptr_ssbo_int %backward_var +%forward_next = OpPtrAccessChain %ptr_ssbo_int %forward_gep %int_1 +%backward_next = OpPtrAccessChain %ptr_ssbo_int %backward_gep %int_n1 +%inc_i = OpIAdd %int %i %int_1 +OpStore %forward_var %forward_next +OpStore %backward_var %backward_next + +%diff1 = OpPtrDiff %int %forward_gep %backward_gep +%diff2 = OpPtrDiff %int %backward_gep %forward_gep +%result = OpCompositeConstruct %int2 %diff1 %diff2 +%out_gep = OpAccessChain %ptr_ssbo_int2 %out_var %int_0 %i +OpStore %out_gep %result + +%cmp = OpSGreaterThanEqual %bool %i %n +OpLoopMerge %loop_exit %loop None +OpBranchConditional %cmp %loop_exit %loop + +%loop_exit = OpLabel +OpBranch %exit +%exit = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 132 +# Only data for number of iterations matters. +ssbo 0:0 subdata int 0 33 +ssbo 0:1 264 + +compute entrypoint main +compute 1 1 1 + +probe ssbo ivec2 0:1 0 == -33 33 +probe ssbo ivec2 0:1 8 == -31 31 +probe ssbo ivec2 0:1 16 == -29 29 +probe ssbo ivec2 0:1 24 == -27 27 +probe ssbo ivec2 0:1 32 == -25 25 +probe ssbo ivec2 0:1 40 == -23 23 +probe ssbo ivec2 0:1 48 == -21 21 +probe ssbo ivec2 0:1 56 == -19 19 +probe ssbo ivec2 0:1 64 == -17 17 +probe ssbo ivec2 0:1 72 == -15 15 +probe ssbo ivec2 0:1 80 == -13 13 +probe ssbo ivec2 0:1 88 == -11 11 +probe ssbo ivec2 0:1 96 == -9 9 +probe ssbo ivec2 0:1 104 == -7 7 +probe ssbo ivec2 0:1 112 == -5 5 +probe ssbo ivec2 0:1 120 == -3 3 +probe ssbo ivec2 0:1 128 == -1 1 +probe ssbo ivec2 0:1 136 == 1 -1 +probe ssbo ivec2 0:1 144 == 3 -3 +probe ssbo ivec2 0:1 152 == 5 -5 +probe ssbo ivec2 0:1 160 == 7 -7 +probe ssbo ivec2 0:1 168 == 9 -9 +probe ssbo ivec2 0:1 176 == 11 -11 +probe ssbo ivec2 0:1 184 == 13 -13 +probe ssbo ivec2 0:1 192 == 15 -15 +probe ssbo ivec2 0:1 200 == 17 -17 +probe ssbo ivec2 0:1 208 == 19 -19 +probe ssbo ivec2 0:1 216 == 21 -21 +probe ssbo ivec2 0:1 224 == 23 -23 +probe ssbo ivec2 0:1 232 == 25 -25 +probe ssbo ivec2 0:1 240 == 27 -27 +probe ssbo ivec2 0:1 248 == 29 -29 +probe ssbo ivec2 0:1 256 == 31 -31 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/variable_pointers_vars_wg_diff.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/variable_pointers_vars_wg_diff.amber new file mode 100644 index 0000000..75ee3ea --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/variable_pointers_vars_wg_diff.amber @@ -0,0 +1,126 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +; Tests use of private variables holding workgroup pointers and pointer comparisons. + +; Two iterators are each stored in Private variables: one moves forward, one +; moves backward. In each iteration an int2 result is written that contains +; two diffs (operands swapped). Iterators are then moved forward (or backward +; respectively) one index. + +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %wg_var %out_var %forward_var %backward_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %int2_rta ArrayStride 8 +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 0 + +OpDecorate %ptr_wg_int ArrayStride 4 + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_n1 = OpConstant %int -1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_32 = OpConstant %int 32 +%int2 = OpTypeVector %int 2 + +%int_array_32 = OpTypeArray %int %int_32 +%ptr_wg_array = OpTypePointer Workgroup %int_array_32 +%wg_var = OpVariable %ptr_wg_array Workgroup + +%int2_rta = OpTypeRuntimeArray %int2 +%out_struct = OpTypeStruct %int2_rta +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer + +%ptr_wg_int = OpTypePointer Workgroup %int +%ptr_ptr = OpTypePointer Private %ptr_wg_int +%forward_var = OpVariable %ptr_ptr Private +%backward_var = OpVariable %ptr_ptr Private + +%ptr_ssbo_int2 = OpTypePointer StorageBuffer %int2 +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%first_gep = OpAccessChain %ptr_wg_int %wg_var %int_0 +OpStore %forward_var %first_gep +%last_gep = OpPtrAccessChain %ptr_wg_int %first_gep %int_32 +OpStore %backward_var %last_gep +OpBranch %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %inc_i %loop +%forward_gep = OpLoad %ptr_wg_int %forward_var +%backward_gep = OpLoad %ptr_wg_int %backward_var +%forward_next = OpPtrAccessChain %ptr_wg_int %forward_gep %int_1 +%backward_next = OpPtrAccessChain %ptr_wg_int %backward_gep %int_n1 +%inc_i = OpIAdd %int %i %int_1 +OpStore %forward_var %forward_next +OpStore %backward_var %backward_next + +%diff1 = OpPtrDiff %int %forward_gep %backward_gep +%diff2 = OpPtrDiff %int %backward_gep %forward_gep +%result = OpCompositeConstruct %int2 %diff1 %diff2 +%out_gep = OpAccessChain %ptr_ssbo_int2 %out_var %int_0 %i +OpStore %out_gep %result + +%cmp = OpSGreaterThan %bool %i %int_32 +OpLoopMerge %exit %loop None +OpBranchConditional %cmp %exit %loop + +%exit = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 264 + +compute entrypoint main +compute 1 1 1 + +probe ssbo ivec2 0:0 0 == -32 32 +probe ssbo ivec2 0:0 8 == -30 30 +probe ssbo ivec2 0:0 16 == -28 28 +probe ssbo ivec2 0:0 24 == -26 26 +probe ssbo ivec2 0:0 32 == -24 24 +probe ssbo ivec2 0:0 40 == -22 22 +probe ssbo ivec2 0:0 48 == -20 20 +probe ssbo ivec2 0:0 56 == -18 18 +probe ssbo ivec2 0:0 64 == -16 16 +probe ssbo ivec2 0:0 72 == -14 14 +probe ssbo ivec2 0:0 80 == -12 12 +probe ssbo ivec2 0:0 88 == -10 10 +probe ssbo ivec2 0:0 96 == -8 8 +probe ssbo ivec2 0:0 104 == -6 6 +probe ssbo ivec2 0:0 112 == -4 4 +probe ssbo ivec2 0:0 120 == -2 2 +probe ssbo ivec2 0:0 128 == 0 0 +probe ssbo ivec2 0:0 136 == 2 -2 +probe ssbo ivec2 0:0 144 == 4 -4 +probe ssbo ivec2 0:0 152 == 6 -6 +probe ssbo ivec2 0:0 160 == 8 -8 +probe ssbo ivec2 0:0 168 == 10 -10 +probe ssbo ivec2 0:0 176 == 12 -12 +probe ssbo ivec2 0:0 184 == 14 -14 +probe ssbo ivec2 0:0 192 == 16 -16 +probe ssbo ivec2 0:0 200 == 18 -18 +probe ssbo ivec2 0:0 208 == 20 -20 +probe ssbo ivec2 0:0 216 == 22 -22 +probe ssbo ivec2 0:0 224 == 24 -24 +probe ssbo ivec2 0:0 232 == 26 -26 +probe ssbo ivec2 0:0 240 == 28 -28 +probe ssbo ivec2 0:0 248 == 30 -30 +probe ssbo ivec2 0:0 256 == 32 -32 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/wg_comparisons_diff.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/wg_comparisons_diff.amber new file mode 100644 index 0000000..03495e3 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrdiff/wg_comparisons_diff.amber @@ -0,0 +1,155 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +; Test operates on a Workgroup array (%wg_var) containing an array of 16 arrays of four ints. + +; Each invocation writes out the result of OpPtrDiff for elements of the +; outer array to index 16 of the corresponding output variable. Pointers are +; based the gid'th element vs the zero'th element. + +; Each invocation loops 4 times and writes out 4 results each for OpPtrDiff. +; The pointers are the lid'th element of gid'th element of the outer array vs +; the iteration count mod 4'th element of the gid'th element of the outer +; array. Results are ordered so each thread writes continguous results. + +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %wg_var %diff_var %lid_var %gid_var +OpExecutionMode %main LocalSize 16 4 1 + +OpDecorate %struct_17 Block +OpMemberDecorate %struct_17 0 Offset 0 +OpDecorate %runtime_17 ArrayStride 68 +OpDecorate %array_17 ArrayStride 4 + +OpDecorate %diff_var DescriptorSet 0 +OpDecorate %diff_var Binding 0 + +OpDecorate %lid_var BuiltIn LocalInvocationId +OpDecorate %gid_var BuiltIn GlobalInvocationId + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_4 = OpConstant %int 4 +%int_16 = OpConstant %int 16 +%int_17 = OpConstant %int 17 +%int_64 = OpConstant %int 64 +%int3 = OpTypeVector %int 3 + +%ptr_input_int3 = OpTypePointer Input %int3 + +%array_4 = OpTypeArray %int %int_4 +%array_array_4 = OpTypeArray %array_4 %int_16 +%ptr_array_array_4 = OpTypePointer Workgroup %array_array_4 +%ptr_array_4 = OpTypePointer Workgroup %array_4 +%ptr_wg_int = OpTypePointer Workgroup %int + +%array_17 = OpTypeArray %int %int_17 +%runtime_17 = OpTypeRuntimeArray %array_17 +%struct_17 = OpTypeStruct %runtime_17 +%ptr_struct_17 = OpTypePointer StorageBuffer %struct_17 +%ptr_array_17 = OpTypePointer StorageBuffer %array_17 +%ptr_int = OpTypePointer StorageBuffer %int + +%wg_var = OpVariable %ptr_array_array_4 Workgroup +%diff_var = OpVariable %ptr_struct_17 StorageBuffer +%lid_var = OpVariable %ptr_input_int3 Input +%gid_var = OpVariable %ptr_input_int3 Input + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%gid_y = OpCompositeExtract %int %gid 1 +%lid = OpLoad %int3 %lid_var +%lid_x = OpCompositeExtract %int %lid 0 +%lid_y = OpCompositeExtract %int %lid 1 +%array_gep_0 = OpAccessChain %ptr_array_4 %wg_var %int_0 +%array_gep = OpAccessChain %ptr_array_4 %wg_var %lid_x +%lid_y_is_1 = OpIEqual %bool %lid_y %int_1 +OpSelectionMerge %loop None +OpBranchConditional %lid_y_is_1 %then %loop + +%then = OpLabel +; Compute results for outer array +%large_diff = OpPtrDiff %int %array_gep %array_gep_0 +%large_diff_gep = OpAccessChain %ptr_int %diff_var %int_0 %gid_x %int_16 +OpStore %large_diff_gep %large_diff +; +OpBranch %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %int_0 %then %inc_i %loop +%inc_i = OpIAdd %int %i %int_1 +%i_cmp = OpIEqual %bool %inc_i %int_4 +%lid_offset = OpIMul %int %lid_y %int_4 +%out_gep_index = OpIAdd %int %i %lid_offset +; Compute results for inner array +%ref_gep = OpAccessChain %ptr_wg_int %array_gep %lid_y +%cmp_gep = OpAccessChain %ptr_wg_int %array_gep %i +%diff = OpPtrDiff %int %ref_gep %cmp_gep +%diff_gep = OpAccessChain %ptr_int %diff_var %int_0 %gid_x %out_gep_index +OpStore %diff_gep %diff +; +OpLoopMerge %exit %loop None +OpBranchConditional %i_cmp %exit %loop + +%exit = OpLabel +OpReturn +OpFunctionEnd + + +[test] +# 16 x 4 x 2 = 128 work items +# 4 x 4 = 16 bytes per invocation +# 2048 bytes from looping +# 16 x 2 = 32 coarse results (1 per lid) +# 128 bytes +# 2176 total bytes +ssbo 0:0 2176 + +compute entrypoint main +compute 2 1 1 + +# diff var +probe ssbo int 0:0 0 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 0 +probe ssbo int 0:0 68 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 1 +probe ssbo int 0:0 136 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 2 +probe ssbo int 0:0 204 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 3 +probe ssbo int 0:0 272 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 4 +probe ssbo int 0:0 340 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 5 +probe ssbo int 0:0 408 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 6 +probe ssbo int 0:0 476 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 7 +probe ssbo int 0:0 544 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 8 +probe ssbo int 0:0 612 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 9 +probe ssbo int 0:0 680 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 10 +probe ssbo int 0:0 748 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 11 +probe ssbo int 0:0 816 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 12 +probe ssbo int 0:0 884 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 13 +probe ssbo int 0:0 952 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 14 +probe ssbo int 0:0 1020 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 15 +probe ssbo int 0:0 1088 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 0 +probe ssbo int 0:0 1156 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 1 +probe ssbo int 0:0 1224 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 2 +probe ssbo int 0:0 1292 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 3 +probe ssbo int 0:0 1360 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 4 +probe ssbo int 0:0 1428 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 5 +probe ssbo int 0:0 1496 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 6 +probe ssbo int 0:0 1564 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 7 +probe ssbo int 0:0 1632 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 8 +probe ssbo int 0:0 1700 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 9 +probe ssbo int 0:0 1768 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 10 +probe ssbo int 0:0 1836 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 11 +probe ssbo int 0:0 1904 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 12 +probe ssbo int 0:0 1972 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 13 +probe ssbo int 0:0 2040 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 14 +probe ssbo int 0:0 2108 == 0 -1 -2 -3 1 0 -1 -2 2 1 0 -1 3 2 1 0 15 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/different_ssbos_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/different_ssbos_equal.amber new file mode 100644 index 0000000..1380767 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/different_ssbos_equal.amber @@ -0,0 +1,110 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointers +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %var1 %var2 %var3 %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %rta ArrayStride 4 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %var1 DescriptorSet 0 +OpDecorate %var1 Binding 0 +OpDecorate %var2 DescriptorSet 0 +OpDecorate %var2 Binding 1 +OpDecorate %var3 DescriptorSet 0 +OpDecorate %var3 Binding 2 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 3 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%rta = OpTypeRuntimeArray %int +%struct = OpTypeStruct %rta +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%ptr_ssbo_rta = OpTypePointer StorageBuffer %rta +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%var1 = OpVariable %ptr_ssbo_struct StorageBuffer +%var2 = OpVariable %ptr_ssbo_struct StorageBuffer +%var3 = OpVariable %ptr_ssbo_struct StorageBuffer +%out_var = OpVariable %ptr_ssbo_struct StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%out_idx0 = OpCopyObject %int %int_0 +%var1_rta_gep = OpAccessChain %ptr_ssbo_rta %var1 %int_0 +%var1_int_gep = OpAccessChain %ptr_ssbo_int %var1 %int_0 %int_0 +%var2_rta_gep = OpAccessChain %ptr_ssbo_rta %var2 %int_0 +%var2_int_gep = OpAccessChain %ptr_ssbo_int %var2 %int_0 %int_0 +%var3_rta_gep = OpAccessChain %ptr_ssbo_rta %var3 %int_0 +%var3_int_gep = OpAccessChain %ptr_ssbo_int %var3 %int_0 %int_0 +; var1 vs var2 +%v1_eq_v2 = OpPtrEqual %bool %var1 %var2 +%v1_eq_v2_sel = OpSelect %int %v1_eq_v2 %int_1 %int_0 +%out_gep1 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx0 +%out_idx1 = OpIAdd %int %out_idx0 %int_1 +OpStore %out_gep1 %v1_eq_v2_sel +%v1_eq_v2_rta = OpPtrEqual %bool %var1_rta_gep %var2_rta_gep +%v1_eq_v2_rta_sel = OpSelect %int %v1_eq_v2_rta %int_1 %int_0 +%out_gep2 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx1 +%out_idx2 = OpIAdd %int %out_idx1 %int_1 +OpStore %out_gep2 %v1_eq_v2_rta_sel +%v1_eq_v2_int = OpPtrEqual %bool %var1_int_gep %var2_int_gep +%v1_eq_v2_int_sel = OpSelect %int %v1_eq_v2_int %int_1 %int_0 +%out_gep3 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx2 +%out_idx3 = OpIAdd %int %out_idx2 %int_1 +OpStore %out_gep3 %v1_eq_v2_int_sel +; var1 vs var3 +%v1_eq_v3 = OpPtrEqual %bool %var1 %var3 +%v1_eq_v3_sel = OpSelect %int %v1_eq_v3 %int_1 %int_0 +%out_gep4 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx3 +%out_idx4 = OpIAdd %int %out_idx3 %int_1 +OpStore %out_gep4 %v1_eq_v3_sel +%v1_eq_v3_rta = OpPtrEqual %bool %var1_rta_gep %var3_rta_gep +%v1_eq_v3_rta_sel = OpSelect %int %v1_eq_v3_rta %int_1 %int_0 +%out_gep5 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx4 +%out_idx5 = OpIAdd %int %out_idx4 %int_1 +OpStore %out_gep5 %v1_eq_v3_rta_sel +%v1_eq_v3_int = OpPtrEqual %bool %var1_int_gep %var3_int_gep +%v1_eq_v3_int_sel = OpSelect %int %v1_eq_v3_int %int_1 %int_0 +%out_gep6 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx5 +%out_idx6 = OpIAdd %int %out_idx5 %int_1 +OpStore %out_gep6 %v1_eq_v3_int_sel +; var2 vs var3 +%v2_eq_v3 = OpPtrEqual %bool %var2 %var3 +%v2_eq_v3_sel = OpSelect %int %v2_eq_v3 %int_1 %int_0 +%out_gep7 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx6 +%out_idx7 = OpIAdd %int %out_idx6 %int_1 +OpStore %out_gep7 %v2_eq_v3_sel +%v2_eq_v3_rta = OpPtrEqual %bool %var2_rta_gep %var3_rta_gep +%v2_eq_v3_rta_sel = OpSelect %int %v2_eq_v3_rta %int_1 %int_0 +%out_gep8 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx7 +%out_idx8 = OpIAdd %int %out_idx7 %int_1 +OpStore %out_gep8 %v2_eq_v3_rta_sel +%v2_eq_v3_int = OpPtrEqual %bool %var2_int_gep %var3_int_gep +%v2_eq_v3_int_sel = OpSelect %int %v2_eq_v3_int %int_1 %int_0 +%out_gep9 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx8 +%out_idx9 = OpIAdd %int %out_idx8 %int_1 +OpStore %out_gep9 %v2_eq_v3_int_sel +%v1_eq_v1 = OpPtrEqual %bool %var1 %var1 +%v1_eq_v1_sel = OpSelect %int %v1_eq_v1 %int_1 %int_0 +%out_gep10 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx9 +OpStore %out_gep10 %v1_eq_v1_sel +OpReturn +OpFunctionEnd +[test] +ssbo 0:0 4 +ssbo 0:1 4 +ssbo 0:2 4 +ssbo 0:3 40 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:3 0 == 0 0 0 0 0 0 0 0 0 1 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/different_wgs_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/different_wgs_equal.amber new file mode 100644 index 0000000..0485538 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/different_wgs_equal.amber @@ -0,0 +1,105 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointers +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %var1 %var2 %var3 %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %rta ArrayStride 4 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 0 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%rta = OpTypeRuntimeArray %int +%struct = OpTypeStruct %rta +%int2 = OpTypeVector %int 2 +%wg_struct = OpTypeStruct %int2 +%ptr_wg_struct = OpTypePointer Workgroup %wg_struct +%ptr_wg_int2 = OpTypePointer Workgroup %int2 +%ptr_wg_int = OpTypePointer Workgroup %int +%var1 = OpVariable %ptr_wg_struct Workgroup +%var2 = OpVariable %ptr_wg_struct Workgroup +%var3 = OpVariable %ptr_wg_struct Workgroup +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%out_var = OpVariable %ptr_ssbo_struct StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%out_idx0 = OpCopyObject %int %int_0 +%var1_int2_gep = OpAccessChain %ptr_wg_int2 %var1 %int_0 +%var1_int_gep = OpAccessChain %ptr_wg_int %var1 %int_0 %int_0 +%var2_int2_gep = OpAccessChain %ptr_wg_int2 %var2 %int_0 +%var2_int_gep = OpAccessChain %ptr_wg_int %var2 %int_0 %int_0 +%var3_int2_gep = OpAccessChain %ptr_wg_int2 %var3 %int_0 +%var3_int_gep = OpAccessChain %ptr_wg_int %var3 %int_0 %int_0 +; var1 vs var2 +%v1_eq_v2 = OpPtrEqual %bool %var1 %var2 +%v1_eq_v2_sel = OpSelect %int %v1_eq_v2 %int_1 %int_0 +%out_gep1 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx0 +%out_idx1 = OpIAdd %int %out_idx0 %int_1 +OpStore %out_gep1 %v1_eq_v2_sel +%v1_eq_v2_rta = OpPtrEqual %bool %var1_int2_gep %var2_int2_gep +%v1_eq_v2_rta_sel = OpSelect %int %v1_eq_v2_rta %int_1 %int_0 +%out_gep2 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx1 +%out_idx2 = OpIAdd %int %out_idx1 %int_1 +OpStore %out_gep2 %v1_eq_v2_rta_sel +%v1_eq_v2_int = OpPtrEqual %bool %var1_int_gep %var2_int_gep +%v1_eq_v2_int_sel = OpSelect %int %v1_eq_v2_int %int_1 %int_0 +%out_gep3 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx2 +%out_idx3 = OpIAdd %int %out_idx2 %int_1 +OpStore %out_gep3 %v1_eq_v2_int_sel +; var1 vs var3 +%v1_eq_v3 = OpPtrEqual %bool %var1 %var3 +%v1_eq_v3_sel = OpSelect %int %v1_eq_v3 %int_1 %int_0 +%out_gep4 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx3 +%out_idx4 = OpIAdd %int %out_idx3 %int_1 +OpStore %out_gep4 %v1_eq_v3_sel +%v1_eq_v3_rta = OpPtrEqual %bool %var1_int2_gep %var3_int2_gep +%v1_eq_v3_rta_sel = OpSelect %int %v1_eq_v3_rta %int_1 %int_0 +%out_gep5 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx4 +%out_idx5 = OpIAdd %int %out_idx4 %int_1 +OpStore %out_gep5 %v1_eq_v3_rta_sel +%v1_eq_v3_int = OpPtrEqual %bool %var1_int_gep %var3_int_gep +%v1_eq_v3_int_sel = OpSelect %int %v1_eq_v3_int %int_1 %int_0 +%out_gep6 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx5 +%out_idx6 = OpIAdd %int %out_idx5 %int_1 +OpStore %out_gep6 %v1_eq_v3_int_sel +; var2 vs var3 +%v2_eq_v3 = OpPtrEqual %bool %var2 %var3 +%v2_eq_v3_sel = OpSelect %int %v2_eq_v3 %int_1 %int_0 +%out_gep7 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx6 +%out_idx7 = OpIAdd %int %out_idx6 %int_1 +OpStore %out_gep7 %v2_eq_v3_sel +%v2_eq_v3_rta = OpPtrEqual %bool %var2_int2_gep %var3_int2_gep +%v2_eq_v3_rta_sel = OpSelect %int %v2_eq_v3_rta %int_1 %int_0 +%out_gep8 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx7 +%out_idx8 = OpIAdd %int %out_idx7 %int_1 +OpStore %out_gep8 %v2_eq_v3_rta_sel +%v2_eq_v3_int = OpPtrEqual %bool %var2_int_gep %var3_int_gep +%v2_eq_v3_int_sel = OpSelect %int %v2_eq_v3_int %int_1 %int_0 +%out_gep9 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx8 +%out_idx9 = OpIAdd %int %out_idx8 %int_1 +OpStore %out_gep9 %v2_eq_v3_int_sel +%v1_eq_v1 = OpPtrEqual %bool %var1 %var1 +%v1_eq_v1_sel = OpSelect %int %v1_eq_v1 %int_1 %int_0 +%out_gep10 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx9 +OpStore %out_gep10 %v1_eq_v1_sel +OpReturn +OpFunctionEnd +[test] +ssbo 0:0 40 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:0 0 == 0 0 0 0 0 0 0 0 0 1 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/null_comparisons_ssbo_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/null_comparisons_ssbo_equal.amber new file mode 100644 index 0000000..1153321 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/null_comparisons_ssbo_equal.amber @@ -0,0 +1,86 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +; This test generates four results. + +; The results are based of OpPtrEqual comparisons of +; %ssbo_var vs null. +; 0: comparison of %ssbo_var vs null +; 1: comparison of SSBO float pointer vs null +; 2: comparison of null struct vs null struct +; 3: comparison of null float vs null float + +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %ssbo_var %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %ssbo_struct Block +OpMemberDecorate %ssbo_struct 0 Offset 0 +OpDecorate %ssbo_var DescriptorSet 0 +OpDecorate %ssbo_var Binding 0 + +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +%void = OpTypeVoid +%bool = OpTypeBool +%float = OpTypeFloat 32 +%int = OpTypeInt 32 0 +%int4 = OpTypeVector %int 4 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 + +%ssbo_struct = OpTypeStruct %float +%ptr_ssbo_struct = OpTypePointer StorageBuffer %ssbo_struct +%ssbo_var = OpVariable %ptr_ssbo_struct StorageBuffer +%ptr_ssbo_float = OpTypePointer StorageBuffer %float + +%out_struct = OpTypeStruct %int4 +%ptr_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_out_struct StorageBuffer +%ptr_ssbo_int4 = OpTypePointer StorageBuffer %int4 + +%ptr_ssbo_struct_null = OpConstantNull %ptr_ssbo_struct +%ptr_ssbo_float_null = OpConstantNull %ptr_ssbo_float +%ptr_ssbo_struct_null2 = OpConstantNull %ptr_ssbo_struct +%ptr_ssbo_float_null2 = OpConstantNull %ptr_ssbo_float + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel + +%ssbo_equal = OpPtrEqual %bool %ssbo_var %ptr_ssbo_struct_null +%ssbo_equal_int = OpSelect %int %ssbo_equal %int_1 %int_0 + +%ssbo_gep_0 = OpAccessChain %ptr_ssbo_float %ssbo_var %int_0 +%ssbo_equal_0 = OpPtrEqual %bool %ssbo_gep_0 %ptr_ssbo_float_null +%ssbo_equal_0_int = OpSelect %int %ssbo_equal_0 %int_1 %int_0 + +%null_ssbo_equal = OpPtrEqual %bool %ptr_ssbo_struct_null %ptr_ssbo_struct_null2 +%null_ssbo_equal_int = OpSelect %int %null_ssbo_equal %int_1 %int_0 + +%null_ssbo_equal_0 = OpPtrEqual %bool %ptr_ssbo_float_null %ptr_ssbo_float_null2 +%null_ssbo_equal_0_int = OpSelect %int %null_ssbo_equal_0 %int_1 %int_0 + +%combined = OpCompositeConstruct %int4 %ssbo_equal_int %ssbo_equal_0_int %null_ssbo_equal_int %null_ssbo_equal_0_int +%out_gep = OpAccessChain %ptr_ssbo_int4 %out_var %int_0 +OpStore %out_gep %combined + +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 16 +ssbo 0:1 16 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uvec4 0:1 0 == 0 0 1 1 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/null_comparisons_wg_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/null_comparisons_wg_equal.amber new file mode 100644 index 0000000..f592e8e --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/null_comparisons_wg_equal.amber @@ -0,0 +1,82 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +; This generates 4 results for OpPtrEqual + +; The workgroup variable is a struct containing a single float. + +; Results: +; 0: comparison of the workgroup var vs null +; 1: comparison of the workgroup float vs null +; 2: comparison of null struct vs null struct +; 3: comparison of null float vs null float + +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %wg_var %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 0 + +%void = OpTypeVoid +%bool = OpTypeBool +%float = OpTypeFloat 32 +%int = OpTypeInt 32 0 +%int4 = OpTypeVector %int 4 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 + +%wg_struct = OpTypeStruct %float +%ptr_wg_struct = OpTypePointer Workgroup %wg_struct +%wg_var = OpVariable %ptr_wg_struct Workgroup +%ptr_wg_float = OpTypePointer Workgroup %float + +%out_struct = OpTypeStruct %int4 +%ptr_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_out_struct StorageBuffer +%ptr_ssbo_int4 = OpTypePointer StorageBuffer %int4 + +%ptr_wg_struct_null = OpConstantNull %ptr_wg_struct +%ptr_wg_float_null = OpConstantNull %ptr_wg_float +%ptr_wg_struct_null2 = OpConstantNull %ptr_wg_struct +%ptr_wg_float_null2 = OpConstantNull %ptr_wg_float + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel + +%wg_equal = OpPtrEqual %bool %wg_var %ptr_wg_struct_null +%wg_equal_int = OpSelect %int %wg_equal %int_1 %int_0 + +%wg_gep_0 = OpAccessChain %ptr_wg_float %wg_var %int_0 +%wg_equal_0 = OpPtrEqual %bool %wg_gep_0 %ptr_wg_float_null +%wg_equal_0_int = OpSelect %int %wg_equal_0 %int_1 %int_0 + +%null_wg_equal = OpPtrEqual %bool %ptr_wg_struct_null %ptr_wg_struct_null2 +%null_wg_equal_int = OpSelect %int %null_wg_equal %int_1 %int_0 + +%null_wg_equal_0 = OpPtrEqual %bool %ptr_wg_float_null %ptr_wg_float_null2 +%null_wg_equal_0_int = OpSelect %int %null_wg_equal_0 %int_1 %int_0 + +%combined = OpCompositeConstruct %int4 %wg_equal_int %wg_equal_0_int %null_wg_equal_int %null_wg_equal_0_int +%out_gep = OpAccessChain %ptr_ssbo_int4 %out_var %int_0 +OpStore %out_gep %combined + +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 16 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uvec4 0:0 0 == 0 0 1 1 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/simple_variable_pointers_ptr_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/simple_variable_pointers_ptr_equal.amber new file mode 100644 index 0000000..d5f2432 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/simple_variable_pointers_ptr_equal.amber @@ -0,0 +1,121 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +[compute shader spirv] +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %var1 %var2 %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %irta ArrayStride 4 +OpDecorate %struct Block +OpDecorate %out_struct Block +OpMemberDecorate %struct 0 ColMajor +OpMemberDecorate %struct 0 Offset 0 +OpMemberDecorate %struct 0 MatrixStride 16 +OpMemberDecorate %struct 1 RowMajor +OpMemberDecorate %struct 1 Offset 64 +OpMemberDecorate %struct 1 MatrixStride 16 +OpMemberDecorate %struct 2 Offset 128 +OpMemberDecorate %struct 3 Offset 132 +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %var1 DescriptorSet 0 +OpDecorate %var1 Binding 0 +OpDecorate %var2 DescriptorSet 0 +OpDecorate %var2 Binding 1 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 2 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%float = OpTypeFloat 32 +%irta = OpTypeRuntimeArray %int +%v4 = OpTypeVector %float 4 +%mat4v4 = OpTypeMatrix %v4 4 +%struct = OpTypeStruct %mat4v4 %mat4v4 %float %float +%out_struct = OpTypeStruct %irta +%ptr_buffer_struct = OpTypePointer StorageBuffer %struct +%out_ptr_buffer_struct = OpTypePointer StorageBuffer %out_struct +%ptr_mat4v4 = OpTypePointer StorageBuffer %mat4v4 +%ptr_buffer_int = OpTypePointer StorageBuffer %int +%ptr_buffer_float = OpTypePointer StorageBuffer %float +%ptr_v4 = OpTypePointer StorageBuffer %v4 +%var1 = OpVariable %ptr_buffer_struct StorageBuffer +%var2 = OpVariable %ptr_buffer_struct StorageBuffer +%out_var = OpVariable %out_ptr_buffer_struct StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%out_idx0 = OpCopyObject %int %int_0 +; var 1 float 1 +%var1_float_1 = OpAccessChain %ptr_buffer_float %var1 %int_2 +; var 1 float 2 +%var1_float_2 = OpAccessChain %ptr_buffer_float %var1 %int_3 +; var 2 float 1 +%var2_float_1 = OpAccessChain %ptr_buffer_float %var2 %int_2 +; var 2 float 2 +%var2_float_2 = OpAccessChain %ptr_buffer_float %var2 %int_3 +; var 1 matrix 1 +%var1_mat_1 = OpAccessChain %ptr_mat4v4 %var1 %int_0 +; var 1 matrix 2 +%var1_mat_2 = OpAccessChain %ptr_mat4v4 %var1 %int_1 +; var 1 matrix 1 column 1 +%var1_mat_1_0 = OpAccessChain %ptr_v4 %var1 %int_0 %int_0 +; var 1 matrix 1 column 2 +%var1_mat_1_1 = OpAccessChain %ptr_v4 %var1 %int_0 %int_1 +; var 1 matrix first member +%var1_mat_1_0_0 = OpAccessChain %ptr_buffer_float %var1 %int_0 %int_0 %int_0 +; Two different members of a same uniform blocks +%var1_float_1_eq_var1_float_2 = OpPtrEqual %bool %var1_float_1 %var1_float_2 +%var1_float_1_eq_var1_float_2_sel = OpSelect %int %var1_float_1_eq_var1_float_2 %int_0 %int_1 +%out_gep1 = OpAccessChain %ptr_buffer_int %out_var %int_0 %out_idx0 +%out_idx1 = OpIAdd %int %out_idx0 %int_1 +OpStore %out_gep1 %var1_float_1_eq_var1_float_2_sel +; The same member in two separate uniform blocks +%var1_float_1_eq_var2_float_1 = OpPtrEqual %bool %var1_float_1 %var2_float_1 +%var1_float_1_eq_var2_float_1_sel = OpSelect %int %var1_float_1_eq_var2_float_1 %int_0 %int_1 +%out_gep2 = OpAccessChain %ptr_buffer_int %out_var %int_0 %out_idx1 +%out_idx2 = OpIAdd %int %out_idx1 %int_1 +OpStore %out_gep2 %var1_float_1_eq_var2_float_1_sel +; Variable pointer and one non-variable pointer +%var1_float_1_var1_float_2_sel = OpSelect %ptr_buffer_float %var1_float_1_eq_var2_float_1 %var1_float_1 %var1_float_2 +%var2_float_1_var2_float_2_sel = OpSelect %ptr_buffer_float %var1_float_1_eq_var2_float_1 %var2_float_1 %var2_float_2 +%var1_float_1_var1_float_2_sel_eq_var2_float_1_var2_float_2_sel = OpPtrEqual %bool %var1_float_1_var1_float_2_sel %var2_float_1_var2_float_2_sel +%var1_float_1_var1_float_2_sel_eq_var2_float_1_var2_float_2_sel_sel = OpSelect %int %var1_float_1_var1_float_2_sel_eq_var2_float_1_var2_float_2_sel %int_0 %int_1 +%out_gep3 = OpAccessChain %ptr_buffer_int %out_var %int_0 %out_idx2 +%out_idx3 = OpIAdd %int %out_idx2 %int_1 +OpStore %out_gep3 %var1_float_1_var1_float_2_sel_eq_var2_float_1_var2_float_2_sel_sel +; Variable pointer and first member of matrices +%var1_float_1_var1_float_2_sel_2 = OpSelect %ptr_buffer_float %var1_float_1_var1_float_2_sel_eq_var2_float_1_var2_float_2_sel %var1_float_1 %var1_float_2 +%var1_float_1_var1_float_2_sel_2_eq_var1_mat_1_0_0 = OpPtrEqual %bool %var1_float_1_var1_float_2_sel_2 %var1_mat_1_0_0 +%var1_float_1_var1_float_2_sel_2_eq_var1_mat_1_0_0_sel = OpSelect %int %var1_float_1_var1_float_2_sel_2_eq_var1_mat_1_0_0 %int_0 %int_1 +%out_gep4 = OpAccessChain %ptr_buffer_int %out_var %int_0 %out_idx3 +%out_idx4 = OpIAdd %int %out_idx3 %int_1 +OpStore %out_gep4 %var1_float_1_var1_float_2_sel_2_eq_var1_mat_1_0_0_sel +; Matrices of the same uniform blocks +%var1_mat_1_eq_var1_mat_2 = OpPtrEqual %bool %var1_mat_1 %var1_mat_2 +%var1_mat_1_eq_var1_mat_2_sel = OpSelect %int %var1_mat_1_eq_var1_mat_2 %int_0 %int_1 +%out_gep5 = OpAccessChain %ptr_buffer_int %out_var %int_0 %out_idx4 +%out_idx5 = OpIAdd %int %out_idx4 %int_1 +OpStore %out_gep5 %var1_mat_1_eq_var1_mat_2_sel +; Pointers to individual columns of row-major matrices +%var1_mat_1_0_eq_var1_mat_1_1 = OpPtrEqual %bool %var1_mat_1_0 %var1_mat_1_1 +%var1_mat_1_0_eq_var1_mat_1_1_sel = OpSelect %int %var1_mat_1_0_eq_var1_mat_1_1 %int_0 %int_1 +%out_gep6 = OpAccessChain %ptr_buffer_int %out_var %int_0 %out_idx5 +%out_idx6 = OpIAdd %int %out_idx5 %int_1 +OpStore %out_gep6 %var1_mat_1_0_eq_var1_mat_1_1_sel +OpReturn +OpFunctionEnd +[test] +ssbo 0:0 136 +ssbo 0:1 136 +ssbo 0:2 24 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:2 0 == 1 1 1 1 1 1 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/ssbo_comparisons_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/ssbo_comparisons_equal.amber new file mode 100644 index 0000000..cd71c29 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/ssbo_comparisons_equal.amber @@ -0,0 +1,174 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +; Test operates on a SSBO (%in_var) containing a runtime array of an array of four ints. +; Size of the runtime array is passed another SSBO (%n_var). + +; Each invocation writes out the result of OpPtrEqual +; for elements of the input runtime array to index 16 of the corresponding output +; variable. Pointers are based the gid'th element vs the zero'th element. + +; Each invocation loops 4 times and writes out results each for +; OpPtrEqual. The pointers are the lid'th element of gid'th element of +; the runtime array vs the iteration count element of the gid'th element of +; the runtime array. + +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %equal_var %n_var %lid_var %gid_var +OpExecutionMode %main LocalSize 4 1 1 + +OpDecorate %struct_4 Block +OpMemberDecorate %struct_4 0 Offset 0 +OpDecorate %runtime_4 ArrayStride 16 +OpDecorate %struct_17 Block +OpMemberDecorate %struct_17 0 Offset 0 +OpDecorate %runtime_17 ArrayStride 68 +OpDecorate %n_struct Block +OpMemberDecorate %n_struct 0 Offset 0 +OpDecorate %array_4 ArrayStride 4 +OpDecorate %array_17 ArrayStride 4 + +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %equal_var DescriptorSet 0 +OpDecorate %equal_var Binding 1 +OpDecorate %n_var DescriptorSet 0 +OpDecorate %n_var Binding 2 + +OpDecorate %lid_var BuiltIn LocalInvocationId +OpDecorate %gid_var BuiltIn WorkgroupId + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_4 = OpConstant %int 4 +%int_16 = OpConstant %int 16 +%int_17 = OpConstant %int 17 +%int3 = OpTypeVector %int 3 + +%ptr_input_int3 = OpTypePointer Input %int3 + +%array_4 = OpTypeArray %int %int_4 +%runtime_4 = OpTypeRuntimeArray %array_4 +%struct_4 = OpTypeStruct %runtime_4 +%ptr_struct_4 = OpTypePointer StorageBuffer %struct_4 +%ptr_array_4 = OpTypePointer StorageBuffer %array_4 + +%array_17 = OpTypeArray %int %int_17 +%runtime_17 = OpTypeRuntimeArray %array_17 +%struct_17 = OpTypeStruct %runtime_17 +%ptr_struct_17 = OpTypePointer StorageBuffer %struct_17 +%ptr_array_17 = OpTypePointer StorageBuffer %array_17 + +%ptr_int = OpTypePointer StorageBuffer %int +%n_struct = OpTypeStruct %int +%ptr_n_struct = OpTypePointer Uniform %n_struct +%ptr_n = OpTypePointer Uniform %int + +%in_var = OpVariable %ptr_struct_4 StorageBuffer +%equal_var = OpVariable %ptr_struct_17 StorageBuffer +%n_var = OpVariable %ptr_n_struct Uniform +%lid_var = OpVariable %ptr_input_int3 Input +%gid_var = OpVariable %ptr_input_int3 Input + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%n_gep = OpAccessChain %ptr_n %n_var %int_0 +%n = OpLoad %int %n_gep +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%lid = OpLoad %int3 %lid_var +%lid_x = OpCompositeExtract %int %lid 0 +%array_gep_0 = OpAccessChain %ptr_array_4 %in_var %int_0 %int_0 +%array_gep = OpAccessChain %ptr_array_4 %in_var %int_0 %gid_x +%cmp_gid = OpSGreaterThanEqual %bool %gid_x %n +OpSelectionMerge %body None +OpBranchConditional %cmp_gid %ret %body + +%ret = OpLabel +OpReturn + +%body = OpLabel +%cmp_lid = OpIEqual %bool %lid_x %int_1 +OpSelectionMerge %loop None +OpBranchConditional %cmp_lid %then %loop + +%then = OpLabel +; Compute results for outer array +%large_equal = OpPtrEqual %bool %array_gep %array_gep_0 +%large_equal_gep = OpAccessChain %ptr_int %equal_var %int_0 %gid_x %int_16 +%large_equal_int = OpSelect %int %large_equal %int_1 %int_0 +OpStore %large_equal_gep %large_equal_int +; +OpBranch %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %body %int_0 %then %inc_i %loop +%inc_i = OpIAdd %int %i %int_1 +%i_cmp = OpIEqual %bool %inc_i %int_4 +%lid_offset = OpIMul %int %lid_x %int_4 +%gep_offset = OpIAdd %int %lid_offset %i +; Compute results for inner array +%ref_gep = OpAccessChain %ptr_int %array_gep %lid_x +%cmp_gep = OpAccessChain %ptr_int %array_gep %i +%equal = OpPtrEqual %bool %ref_gep %cmp_gep +%equal_int = OpSelect %int %equal %int_1 %int_0 +%equal_gep = OpAccessChain %ptr_int %equal_var %int_0 %gid_x %gep_offset +OpStore %equal_gep %equal_int +; +OpLoopMerge %exit %loop None +OpBranchConditional %i_cmp %exit %loop + +%exit = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 2048 +ssbo 0:1 2176 +uniform ubo 0:2 int 0 32 + +compute entrypoint main +compute 32 1 1 + + +#equal var +probe ssbo int 0:1 0 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 +probe ssbo int 0:1 68 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 136 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 204 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 272 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 340 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 408 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 476 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 544 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 612 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 680 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 748 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 816 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 884 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 952 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1020 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1088 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1156 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1224 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1292 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1360 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1428 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1496 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1564 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1632 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1700 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1768 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1836 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1904 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 1972 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 2040 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:1 2108 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_ssbo_2_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_ssbo_2_equal.amber new file mode 100644 index 0000000..7ae7121 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_ssbo_2_equal.amber @@ -0,0 +1,130 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +; Tests pointer comparisons with variable pointers + +; Stores an array of pointers in Function storage class that point into input +; SSBO. Each iteration produces an OpPtrEqual comparison. Pointers evolve by +; incrementing or decrementing by 1 each iteration (overall ratio is 2:1). + +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %in_struct Block +OpMemberDecorate %in_struct 0 Offset 0 +OpMemberDecorate %in_struct 1 Offset 4 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 + +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorate %ptr_ssbo_int ArrayStride 4 + +%void = OpTypeVoid +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%int = OpTypeInt 32 1 +%int_n1 = OpConstant %int -1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 + +%int_rta = OpTypeRuntimeArray %int +%in_struct = OpTypeStruct %int %int_rta +%ptr_ssbo_in_struct = OpTypePointer StorageBuffer %in_struct +%in_var = OpVariable %ptr_ssbo_in_struct StorageBuffer + +%out_struct = OpTypeStruct %int_rta +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer + +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%array_ptr = OpTypeArray %ptr_ssbo_int %int_2 +%ptr_ptr = OpTypePointer Function %array_ptr +%ptr_func_ptr = OpTypePointer Function %ptr_ssbo_int + +%ptr_ssbo_n = OpTypePointer StorageBuffer %int +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%var = OpVariable %ptr_ptr Function +%n_gep = OpAccessChain %ptr_ssbo_n %in_var %int_0 +%n = OpLoad %int %n_gep +%length = OpArrayLength %uint %in_var 1 +%length_div_2 = OpSDiv %int %length %int_2 +%mid_gep = OpAccessChain %ptr_ssbo_int %in_var %int_1 %length_div_2 +%func_gep_0 = OpAccessChain %ptr_func_ptr %var %int_0 +%func_gep_1 = OpAccessChain %ptr_func_ptr %var %int_1 +OpStore %func_gep_0 %mid_gep +OpStore %func_gep_1 %mid_gep +%cmp_n = OpSLessThanEqual %bool %n %int_0 +OpSelectionMerge %exit None +OpBranchConditional %cmp_n %exit %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %inc_i %continue +%gep_0 = OpLoad %ptr_ssbo_int %func_gep_0 +%gep_1 = OpLoad %ptr_ssbo_int %func_gep_1 +%inc_i = OpIAdd %int %i %int_1 + +%equal = OpPtrEqual %bool %gep_0 %gep_1 +%equal_int = OpSelect %int %equal %int_1 %int_0 +%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %i +OpStore %out_gep %equal_int + +OpLoopMerge %loop_exit %continue None +OpBranch %body + +%body = OpLabel +%i_mod_3 = OpSMod %int %i %int_3 +%cmp_vs_0 = OpIEqual %bool %i_mod_3 %int_0 +OpSelectionMerge %if_merge None +OpBranchConditional %cmp_vs_0 %then %else + +%then = OpLabel +%then_0_next = OpPtrAccessChain %ptr_ssbo_int %gep_0 %int_n1 +%then_1_next = OpPtrAccessChain %ptr_ssbo_int %gep_1 %int_1 +OpBranch %if_merge +%else = OpLabel +%else_0_next = OpPtrAccessChain %ptr_ssbo_int %gep_0 %int_1 +%else_1_next = OpPtrAccessChain %ptr_ssbo_int %gep_1 %int_n1 +OpBranch %if_merge + +%if_merge = OpLabel +%next_0 = OpPhi %ptr_ssbo_int %then_0_next %then %else_0_next %else +%next_1 = OpPhi %ptr_ssbo_int %then_1_next %then %else_1_next %else +OpBranch %continue + +%continue = OpLabel +OpStore %func_gep_0 %next_0 +OpStore %func_gep_1 %next_1 +%cmp = OpSGreaterThanEqual %bool %i %n +OpBranchConditional %cmp %loop_exit %loop + +%loop_exit = OpLabel +OpBranch %exit +%exit = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 68 +ssbo 0:0 subdata uint 0 16 +ssbo 0:1 64 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:1 0 == 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_ssbo_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_ssbo_equal.amber new file mode 100644 index 0000000..f791b50 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_ssbo_equal.amber @@ -0,0 +1,110 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +; This test generates four results per iteration of the loop. The loop is executed %n times. + +; Each iteration generates a result for OpPtrEqual. One +; pointer is an iterator through the input SSBO (%in_var) and the other is a +; selection between the iterator, null or the 0'th index pointer depending on +; the value of the iterator mod 3. + +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %ptr_ssbo_int ArrayStride 4 + +OpDecorate %in_struct Block +OpMemberDecorate %in_struct 0 Offset 0 +OpMemberDecorate %in_struct 1 Offset 4 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 + +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int2 = OpTypeVector %int 2 +%int_rta = OpTypeRuntimeArray %int +%int2_rta = OpTypeRuntimeArray %int2 + +%in_struct = OpTypeStruct %int %int_rta +%ptr_ssbo_in_struct = OpTypePointer StorageBuffer %in_struct +%in_var = OpVariable %ptr_ssbo_in_struct StorageBuffer + +%out_struct = OpTypeStruct %int_rta +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer + +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%ptr_ssbo_int_null = OpConstantNull %ptr_ssbo_int +%ptr_ssbo_n = OpTypePointer StorageBuffer %int +%ptr_ssbo_int2 = OpTypePointer StorageBuffer %int2 +%void_fn = OpTypeFunction %void +%ptr_return_fn = OpTypeFunction %ptr_ssbo_int %ptr_ssbo_int %ptr_ssbo_int %int +%main = OpFunction %void None %void_fn +%entry = OpLabel +%n_gep = OpAccessChain %ptr_ssbo_n %in_var %int_0 +%n = OpLoad %int %n_gep +%base_ssbo_gep = OpAccessChain %ptr_ssbo_int %in_var %int_1 %int_0 +%n_leq_0 = OpSLessThanEqual %bool %n %int_0 +OpSelectionMerge %exit None +OpBranchConditional %n_leq_0 %exit %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %inc_i %loop +%ssbo_gep = OpPhi %ptr_ssbo_int %base_ssbo_gep %entry %next_ssbo_gep %loop +%inc_i = OpIAdd %int %i %int_1 +%next_ssbo_gep = OpPtrAccessChain %ptr_ssbo_int %ssbo_gep %int_1 + +%ptr_call = OpFunctionCall %ptr_ssbo_int %gep_func %ssbo_gep %base_ssbo_gep %i +%equal = OpPtrEqual %bool %ssbo_gep %ptr_call +%equal_int = OpSelect %int %equal %int_1 %int_0 +%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %i +OpStore %out_gep %equal_int + +%cmp = OpSGreaterThanEqual %bool %i %n +OpLoopMerge %loop_exit %loop None +OpBranchConditional %cmp %loop_exit %loop + +%loop_exit = OpLabel +OpBranch %exit +%exit = OpLabel +OpReturn +OpFunctionEnd + +%gep_func = OpFunction %ptr_ssbo_int None %ptr_return_fn +%param_ptr = OpFunctionParameter %ptr_ssbo_int +%param_alt_ptr = OpFunctionParameter %ptr_ssbo_int +%param_i = OpFunctionParameter %int +%1 = OpLabel +%i_mod_3 = OpSMod %int %param_i %int_3 +%i_mod_3_is_0 = OpIEqual %bool %i_mod_3 %int_0 +%i_mod_3_is_1 = OpIEqual %bool %i_mod_3 %int_1 +%ssbo_gep1 = OpSelect %ptr_ssbo_int %i_mod_3_is_0 %param_alt_ptr %ptr_ssbo_int_null +%ssbo_gep2 = OpSelect %ptr_ssbo_int %i_mod_3_is_1 %param_ptr %ssbo_gep1 +OpReturnValue %ssbo_gep2 +OpFunctionEnd + +[test] +ssbo 0:0 132 +ssbo 0:0 subdata int 0 33 +ssbo 0:1 132 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:1 0 == 1 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_vars_ssbo_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_vars_ssbo_equal.amber new file mode 100644 index 0000000..7261689 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_vars_ssbo_equal.amber @@ -0,0 +1,136 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +; Tests use of private variables holding SSBO pointers and pointer comparisons. + +; Two iterators are each stored in Private variables: one moves forward, one +; moves backward. In each iteration an OpPtrEqual comparison is written. +; Iterators are then moved forward (or backward respectively) one index. + +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var %forward_var %backward_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %in_struct Block +OpMemberDecorate %in_struct 0 Offset 0 +OpMemberDecorate %in_struct 1 Offset 4 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 + +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorate %ptr_ssbo_int ArrayStride 4 + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_n1 = OpConstant %int -1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 + +%int_rta = OpTypeRuntimeArray %int +%in_struct = OpTypeStruct %int %int_rta +%ptr_ssbo_in_struct = OpTypePointer StorageBuffer %in_struct +%in_var = OpVariable %ptr_ssbo_in_struct StorageBuffer + +%out_struct = OpTypeStruct %int_rta +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer + +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%ptr_ptr = OpTypePointer Private %ptr_ssbo_int +%forward_var = OpVariable %ptr_ptr Private +%backward_var = OpVariable %ptr_ptr Private + +%ptr_ssbo_n = OpTypePointer StorageBuffer %int +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%n_gep = OpAccessChain %ptr_ssbo_n %in_var %int_0 +%n = OpLoad %int %n_gep +%first_gep = OpAccessChain %ptr_ssbo_int %in_var %int_1 %int_0 +OpStore %forward_var %first_gep +%last_gep = OpPtrAccessChain %ptr_ssbo_int %first_gep %n +OpStore %backward_var %last_gep +%cmp_n = OpSLessThanEqual %bool %n %int_0 +OpSelectionMerge %exit None +OpBranchConditional %cmp_n %exit %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %inc_i %loop +%forward_gep = OpLoad %ptr_ssbo_int %forward_var +%backward_gep = OpLoad %ptr_ssbo_int %backward_var +%forward_next = OpPtrAccessChain %ptr_ssbo_int %forward_gep %int_1 +%backward_next = OpPtrAccessChain %ptr_ssbo_int %backward_gep %int_n1 +%inc_i = OpIAdd %int %i %int_1 +OpStore %forward_var %forward_next +OpStore %backward_var %backward_next + +%equal = OpPtrEqual %bool %forward_gep %backward_gep +%equal_int = OpSelect %int %equal %int_1 %int_0 +%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %i +OpStore %out_gep %equal_int + +%cmp = OpSGreaterThanEqual %bool %i %n +OpLoopMerge %loop_exit %loop None +OpBranchConditional %cmp %loop_exit %loop + +%loop_exit = OpLabel +OpBranch %exit +%exit = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 132 +# Only data for number of iterations matters. +ssbo 0:0 subdata int 0 32 +ssbo 0:1 128 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:1 0 == 0 +probe ssbo int 0:1 4 == 0 +probe ssbo int 0:1 8 == 0 +probe ssbo int 0:1 12 == 0 +probe ssbo int 0:1 16 == 0 +probe ssbo int 0:1 20 == 0 +probe ssbo int 0:1 24 == 0 +probe ssbo int 0:1 28 == 0 +probe ssbo int 0:1 32 == 0 +probe ssbo int 0:1 36 == 0 +probe ssbo int 0:1 40 == 0 +probe ssbo int 0:1 44 == 0 +probe ssbo int 0:1 48 == 0 +probe ssbo int 0:1 52 == 0 +probe ssbo int 0:1 56 == 0 +probe ssbo int 0:1 60 == 0 +probe ssbo int 0:1 64 == 1 +probe ssbo int 0:1 68 == 0 +probe ssbo int 0:1 72 == 0 +probe ssbo int 0:1 76 == 0 +probe ssbo int 0:1 80 == 0 +probe ssbo int 0:1 84 == 0 +probe ssbo int 0:1 88 == 0 +probe ssbo int 0:1 92 == 0 +probe ssbo int 0:1 96 == 0 +probe ssbo int 0:1 100 == 0 +probe ssbo int 0:1 104 == 0 +probe ssbo int 0:1 108 == 0 +probe ssbo int 0:1 112 == 0 +probe ssbo int 0:1 116 == 0 +probe ssbo int 0:1 120 == 0 +probe ssbo int 0:1 124 == 0 + + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_vars_wg_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_vars_wg_equal.amber new file mode 100644 index 0000000..a3af7e6 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_vars_wg_equal.amber @@ -0,0 +1,122 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +; Tests use of private variables holding workgroup pointers and pointer comparisons. + +; Two iterators are each stored in Private variables: one moves forward, one +; moves backward. In each iteration an equal comparison is written. Iterators +; are then moved forward (or backward respectively) one index. + +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %wg_var %out_var %forward_var %backward_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 0 + +OpDecorate %ptr_wg_int ArrayStride 4 + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_n1 = OpConstant %int -1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_32 = OpConstant %int 32 + +%int_array_32 = OpTypeArray %int %int_32 +%ptr_wg_array = OpTypePointer Workgroup %int_array_32 +%wg_var = OpVariable %ptr_wg_array Workgroup + +%int_rta = OpTypeRuntimeArray %int +%out_struct = OpTypeStruct %int_rta +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer + +%ptr_wg_int = OpTypePointer Workgroup %int +%ptr_ptr = OpTypePointer Private %ptr_wg_int +%forward_var = OpVariable %ptr_ptr Private +%backward_var = OpVariable %ptr_ptr Private + +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%first_gep = OpAccessChain %ptr_wg_int %wg_var %int_0 +OpStore %forward_var %first_gep +%last_gep = OpPtrAccessChain %ptr_wg_int %first_gep %int_32 +OpStore %backward_var %last_gep +OpBranch %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %inc_i %loop +%forward_gep = OpLoad %ptr_wg_int %forward_var +%backward_gep = OpLoad %ptr_wg_int %backward_var +%forward_next = OpPtrAccessChain %ptr_wg_int %forward_gep %int_1 +%backward_next = OpPtrAccessChain %ptr_wg_int %backward_gep %int_n1 +%inc_i = OpIAdd %int %i %int_1 +OpStore %forward_var %forward_next +OpStore %backward_var %backward_next + +%equal = OpPtrEqual %bool %forward_gep %backward_gep +%equal_int = OpSelect %int %equal %int_1 %int_0 +%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %i +OpStore %out_gep %equal_int + +%cmp = OpSGreaterThan %bool %i %int_32 +OpLoopMerge %exit %loop None +OpBranchConditional %cmp %exit %loop + +%exit = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 528 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:0 0 == 0 +probe ssbo int 0:0 4 == 0 +probe ssbo int 0:0 8 == 0 +probe ssbo int 0:0 12 == 0 +probe ssbo int 0:0 16 == 0 +probe ssbo int 0:0 20 == 0 +probe ssbo int 0:0 24 == 0 +probe ssbo int 0:0 28 == 0 +probe ssbo int 0:0 32 == 0 +probe ssbo int 0:0 36 == 0 +probe ssbo int 0:0 40 == 0 +probe ssbo int 0:0 44 == 0 +probe ssbo int 0:0 48 == 0 +probe ssbo int 0:0 52 == 0 +probe ssbo int 0:0 56 == 0 +probe ssbo int 0:0 60 == 0 +probe ssbo int 0:0 64 == 1 +probe ssbo int 0:0 68 == 0 +probe ssbo int 0:0 72 == 0 +probe ssbo int 0:0 76 == 0 +probe ssbo int 0:0 80 == 0 +probe ssbo int 0:0 84 == 0 +probe ssbo int 0:0 88 == 0 +probe ssbo int 0:0 92 == 0 +probe ssbo int 0:0 96 == 0 +probe ssbo int 0:0 100 == 0 +probe ssbo int 0:0 104 == 0 +probe ssbo int 0:0 108 == 0 +probe ssbo int 0:0 112 == 0 +probe ssbo int 0:0 116 == 0 +probe ssbo int 0:0 120 == 0 +probe ssbo int 0:0 124 == 0 +probe ssbo int 0:0 128 == 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_wg_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_wg_equal.amber new file mode 100644 index 0000000..d8dd7d5 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/variable_pointers_wg_equal.amber @@ -0,0 +1,95 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +; This test generates four results per iteration of the loop. The loop is executed 64 times. + +; Each iteration generates results for OpPtrEqual. One pointer is an iterator +; through the workgroup variable (%wg_var) and the other is a selection between +; the iterator, null or the 0'th index pointer depending on the value of the +; iterator mod 3. + +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %wg_var %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %ptr_wg_int ArrayStride 4 + +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 0 + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_32 = OpConstant %int 32 +%int_array = OpTypeArray %int %int_32 +%int_rta = OpTypeRuntimeArray %int + +%ptr_wg_int_array = OpTypePointer Workgroup %int_array +%wg_var = OpVariable %ptr_wg_int_array Workgroup + +%out_struct = OpTypeStruct %int_rta +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer + +%ptr_wg_int = OpTypePointer Workgroup %int +%ptr_wg_int_null = OpConstantNull %ptr_wg_int +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%void_fn = OpTypeFunction %void +%ptr_return_fn = OpTypeFunction %ptr_wg_int %ptr_wg_int %ptr_wg_int %int +%main = OpFunction %void None %void_fn +%entry = OpLabel +%base_wg_gep = OpAccessChain %ptr_wg_int %wg_var %int_0 +OpBranch %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %inc_i %loop +%wg_gep = OpPhi %ptr_wg_int %base_wg_gep %entry %next_wg_gep %loop +%inc_i = OpIAdd %int %i %int_1 +%next_wg_gep = OpPtrAccessChain %ptr_wg_int %wg_gep %int_1 + +%ptr_call = OpFunctionCall %ptr_wg_int %gep_func %wg_gep %base_wg_gep %i +%equal = OpPtrEqual %bool %wg_gep %ptr_call +%equal_int = OpSelect %int %equal %int_1 %int_0 +%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %i +OpStore %out_gep %equal_int + +%cmp = OpSGreaterThan %bool %i %int_32 +OpLoopMerge %exit %loop None +OpBranchConditional %cmp %exit %loop + +%exit = OpLabel +OpReturn +OpFunctionEnd + +%gep_func = OpFunction %ptr_wg_int None %ptr_return_fn +%param_ptr = OpFunctionParameter %ptr_wg_int +%param_alt_ptr = OpFunctionParameter %ptr_wg_int +%param_i = OpFunctionParameter %int +%1 = OpLabel +%i_mod_3 = OpSMod %int %param_i %int_3 +%i_mod_3_is_0 = OpIEqual %bool %i_mod_3 %int_0 +%i_mod_3_is_1 = OpIEqual %bool %i_mod_3 %int_1 +%wg_gep1 = OpSelect %ptr_wg_int %i_mod_3_is_0 %param_alt_ptr %ptr_wg_int_null +%wg_gep2 = OpSelect %ptr_wg_int %i_mod_3_is_1 %param_ptr %wg_gep1 +OpReturnValue %wg_gep2 +OpFunctionEnd + +[test] +ssbo 0:0 132 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:0 0 == 1 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/wg_comparisons_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/wg_comparisons_equal.amber new file mode 100644 index 0000000..fb0334f --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrequal/wg_comparisons_equal.amber @@ -0,0 +1,157 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +; Test operates on a Workgroup array (%wg_var) containing an array of 16 arrays of four ints. + +; Each invocation writes out the result of OpPtrEqual for elements of the +; outer array to index 16 of the corresponding output variable. Pointers are +; based the gid'th element vs the zero'th element. + +; Each invocation loops 4 times and writes out 4 results each for OpPtrEqual. +; The pointers are the lid'th element of gid'th element of the outer array vs +; the iteration count mod 4'th element of the gid'th element of the outer +; array. Results are ordered so each thread writes continguous results. + +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %wg_var %equal_var %lid_var %gid_var +OpExecutionMode %main LocalSize 16 4 1 + +OpDecorate %struct_17 Block +OpMemberDecorate %struct_17 0 Offset 0 +OpDecorate %runtime_17 ArrayStride 68 +OpDecorate %array_17 ArrayStride 4 + +OpDecorate %equal_var DescriptorSet 0 +OpDecorate %equal_var Binding 0 + +OpDecorate %lid_var BuiltIn LocalInvocationId +OpDecorate %gid_var BuiltIn GlobalInvocationId + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_4 = OpConstant %int 4 +%int_16 = OpConstant %int 16 +%int_17 = OpConstant %int 17 +%int_64 = OpConstant %int 64 +%int3 = OpTypeVector %int 3 + +%ptr_input_int3 = OpTypePointer Input %int3 + +%array_4 = OpTypeArray %int %int_4 +%array_array_4 = OpTypeArray %array_4 %int_16 +%ptr_array_array_4 = OpTypePointer Workgroup %array_array_4 +%ptr_array_4 = OpTypePointer Workgroup %array_4 +%ptr_wg_int = OpTypePointer Workgroup %int + +%array_17 = OpTypeArray %int %int_17 +%runtime_17 = OpTypeRuntimeArray %array_17 +%struct_17 = OpTypeStruct %runtime_17 +%ptr_struct_17 = OpTypePointer StorageBuffer %struct_17 +%ptr_array_17 = OpTypePointer StorageBuffer %array_17 +%ptr_int = OpTypePointer StorageBuffer %int + +%wg_var = OpVariable %ptr_array_array_4 Workgroup +%equal_var = OpVariable %ptr_struct_17 StorageBuffer +%lid_var = OpVariable %ptr_input_int3 Input +%gid_var = OpVariable %ptr_input_int3 Input + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%gid_y = OpCompositeExtract %int %gid 1 +%lid = OpLoad %int3 %lid_var +%lid_x = OpCompositeExtract %int %lid 0 +%lid_y = OpCompositeExtract %int %lid 1 +%array_gep_0 = OpAccessChain %ptr_array_4 %wg_var %int_0 +%array_gep = OpAccessChain %ptr_array_4 %wg_var %lid_x +%lid_y_is_1 = OpIEqual %bool %lid_y %int_1 +OpSelectionMerge %loop None +OpBranchConditional %lid_y_is_1 %then %loop + +%then = OpLabel +; Compute results for outer array +%large_equal = OpPtrEqual %bool %array_gep %array_gep_0 +%large_equal_gep = OpAccessChain %ptr_int %equal_var %int_0 %gid_x %int_16 +%large_equal_int = OpSelect %int %large_equal %int_1 %int_0 +OpStore %large_equal_gep %large_equal_int +; +OpBranch %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %int_0 %then %inc_i %loop +%inc_i = OpIAdd %int %i %int_1 +%i_cmp = OpIEqual %bool %inc_i %int_4 +%lid_offset = OpIMul %int %lid_y %int_4 +%out_gep_index = OpIAdd %int %i %lid_offset +; Compute results for inner array +%ref_gep = OpAccessChain %ptr_wg_int %array_gep %lid_y +%cmp_gep = OpAccessChain %ptr_wg_int %array_gep %i +%equal = OpPtrEqual %bool %ref_gep %cmp_gep +%equal_int = OpSelect %int %equal %int_1 %int_0 +%equal_gep = OpAccessChain %ptr_int %equal_var %int_0 %gid_x %out_gep_index +OpStore %equal_gep %equal_int +; +OpLoopMerge %exit %loop None +OpBranchConditional %i_cmp %exit %loop + +%exit = OpLabel +OpReturn +OpFunctionEnd + + +[test] +# 16 x 4 x 2 = 128 work items +# 4 x 4 = 16 bytes per invocation +# 2048 bytes from looping +# 16 x 2 = 32 coarse results (1 per lid) +# 128 bytes +# 2176 total bytes +ssbo 0:0 2176 + +compute entrypoint main +compute 2 1 1 + +#equal var +probe ssbo int 0:0 0 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 +probe ssbo int 0:0 68 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 136 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 204 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 272 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 340 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 408 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 476 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 544 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 612 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 680 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 748 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 816 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 884 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 952 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1020 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1088 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 +probe ssbo int 0:0 1156 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1224 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1292 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1360 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1428 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1496 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1564 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1632 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1700 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1768 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1836 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1904 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 1972 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 2040 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 +probe ssbo int 0:0 2108 == 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/different_ssbos_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/different_ssbos_not_equal.amber new file mode 100644 index 0000000..498160d --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/different_ssbos_not_equal.amber @@ -0,0 +1,110 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointers +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %var1 %var2 %var3 %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %rta ArrayStride 4 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %var1 DescriptorSet 0 +OpDecorate %var1 Binding 0 +OpDecorate %var2 DescriptorSet 0 +OpDecorate %var2 Binding 1 +OpDecorate %var3 DescriptorSet 0 +OpDecorate %var3 Binding 2 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 3 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%rta = OpTypeRuntimeArray %int +%struct = OpTypeStruct %rta +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%ptr_ssbo_rta = OpTypePointer StorageBuffer %rta +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%var1 = OpVariable %ptr_ssbo_struct StorageBuffer +%var2 = OpVariable %ptr_ssbo_struct StorageBuffer +%var3 = OpVariable %ptr_ssbo_struct StorageBuffer +%out_var = OpVariable %ptr_ssbo_struct StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%out_idx0 = OpCopyObject %int %int_0 +%var1_rta_gep = OpAccessChain %ptr_ssbo_rta %var1 %int_0 +%var1_int_gep = OpAccessChain %ptr_ssbo_int %var1 %int_0 %int_0 +%var2_rta_gep = OpAccessChain %ptr_ssbo_rta %var2 %int_0 +%var2_int_gep = OpAccessChain %ptr_ssbo_int %var2 %int_0 %int_0 +%var3_rta_gep = OpAccessChain %ptr_ssbo_rta %var3 %int_0 +%var3_int_gep = OpAccessChain %ptr_ssbo_int %var3 %int_0 %int_0 +; var1 vs var2 +%v1_neq_v2 = OpPtrNotEqual %bool %var1 %var2 +%v1_neq_v2_sel = OpSelect %int %v1_neq_v2 %int_1 %int_0 +%out_gep1 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx0 +%out_idx1 = OpIAdd %int %out_idx0 %int_1 +OpStore %out_gep1 %v1_neq_v2_sel +%v1_neq_v2_rta = OpPtrNotEqual %bool %var1_rta_gep %var2_rta_gep +%v1_neq_v2_rta_sel = OpSelect %int %v1_neq_v2_rta %int_1 %int_0 +%out_gep2 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx1 +%out_idx2 = OpIAdd %int %out_idx1 %int_1 +OpStore %out_gep2 %v1_neq_v2_rta_sel +%v1_neq_v2_int = OpPtrNotEqual %bool %var1_int_gep %var2_int_gep +%v1_neq_v2_int_sel = OpSelect %int %v1_neq_v2_int %int_1 %int_0 +%out_gep3 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx2 +%out_idx3 = OpIAdd %int %out_idx2 %int_1 +OpStore %out_gep3 %v1_neq_v2_int_sel +; var1 vs var3 +%v1_neq_v3 = OpPtrNotEqual %bool %var1 %var3 +%v1_neq_v3_sel = OpSelect %int %v1_neq_v3 %int_1 %int_0 +%out_gep4 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx3 +%out_idx4 = OpIAdd %int %out_idx3 %int_1 +OpStore %out_gep4 %v1_neq_v3_sel +%v1_neq_v3_rta = OpPtrNotEqual %bool %var1_rta_gep %var3_rta_gep +%v1_neq_v3_rta_sel = OpSelect %int %v1_neq_v3_rta %int_1 %int_0 +%out_gep5 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx4 +%out_idx5 = OpIAdd %int %out_idx4 %int_1 +OpStore %out_gep5 %v1_neq_v3_rta_sel +%v1_neq_v3_int = OpPtrNotEqual %bool %var1_int_gep %var3_int_gep +%v1_neq_v3_int_sel = OpSelect %int %v1_neq_v3_int %int_1 %int_0 +%out_gep6 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx5 +%out_idx6 = OpIAdd %int %out_idx5 %int_1 +OpStore %out_gep6 %v1_neq_v3_int_sel +; var2 vs var3 +%v2_neq_v3 = OpPtrNotEqual %bool %var2 %var3 +%v2_neq_v3_sel = OpSelect %int %v2_neq_v3 %int_1 %int_0 +%out_gep7 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx6 +%out_idx7 = OpIAdd %int %out_idx6 %int_1 +OpStore %out_gep7 %v2_neq_v3_sel +%v2_neq_v3_rta = OpPtrNotEqual %bool %var2_rta_gep %var3_rta_gep +%v2_neq_v3_rta_sel = OpSelect %int %v2_neq_v3_rta %int_1 %int_0 +%out_gep8 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx7 +%out_idx8 = OpIAdd %int %out_idx7 %int_1 +OpStore %out_gep8 %v2_neq_v3_rta_sel +%v2_neq_v3_int = OpPtrNotEqual %bool %var2_int_gep %var3_int_gep +%v2_neq_v3_int_sel = OpSelect %int %v2_neq_v3_int %int_1 %int_0 +%out_gep9 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx8 +%out_idx9 = OpIAdd %int %out_idx8 %int_1 +OpStore %out_gep9 %v2_neq_v3_int_sel +%v1_neq_v1 = OpPtrNotEqual %bool %var1 %var1 +%v1_neq_v1_sel = OpSelect %int %v1_neq_v1 %int_1 %int_0 +%out_gep10 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx9 +OpStore %out_gep10 %v1_neq_v1_sel +OpReturn +OpFunctionEnd +[test] +ssbo 0:0 4 +ssbo 0:1 4 +ssbo 0:2 4 +ssbo 0:3 40 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:3 0 == 1 1 1 1 1 1 1 1 1 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/different_wgs_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/different_wgs_not_equal.amber new file mode 100644 index 0000000..0a11801 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/different_wgs_not_equal.amber @@ -0,0 +1,107 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointers +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %var1 %var2 %var3 %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %rta ArrayStride 4 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 0 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%rta = OpTypeRuntimeArray %int +%struct = OpTypeStruct %rta +%int2 = OpTypeVector %int 2 +%wg_struct = OpTypeStruct %int2 +%ptr_wg_struct = OpTypePointer Workgroup %wg_struct +%ptr_wg_int2 = OpTypePointer Workgroup %int2 +%ptr_wg_int = OpTypePointer Workgroup %int +%var1 = OpVariable %ptr_wg_struct Workgroup +%var2 = OpVariable %ptr_wg_struct Workgroup +%var3 = OpVariable %ptr_wg_struct Workgroup +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%ptr_ssbo_rta = OpTypePointer StorageBuffer %rta +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%out_var = OpVariable %ptr_ssbo_struct StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%out_idx0 = OpCopyObject %int %int_0 +%var1_int2_gep = OpAccessChain %ptr_wg_int2 %var1 %int_0 +%var1_int_gep = OpAccessChain %ptr_wg_int %var1 %int_0 %int_0 +%var2_int2_gep = OpAccessChain %ptr_wg_int2 %var2 %int_0 +%var2_int_gep = OpAccessChain %ptr_wg_int %var2 %int_0 %int_0 +%var3_int2_gep = OpAccessChain %ptr_wg_int2 %var3 %int_0 +%var3_int_gep = OpAccessChain %ptr_wg_int %var3 %int_0 %int_0 +; var1 vs var2 +%v1_neq_v2 = OpPtrNotEqual %bool %var1 %var2 +%v1_neq_v2_sel = OpSelect %int %v1_neq_v2 %int_1 %int_0 +%out_gep1 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx0 +%out_idx1 = OpIAdd %int %out_idx0 %int_1 +OpStore %out_gep1 %v1_neq_v2_sel +%v1_neq_v2_rta = OpPtrNotEqual %bool %var1_int2_gep %var2_int2_gep +%v1_neq_v2_rta_sel = OpSelect %int %v1_neq_v2_rta %int_1 %int_0 +%out_gep2 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx1 +%out_idx2 = OpIAdd %int %out_idx1 %int_1 +OpStore %out_gep2 %v1_neq_v2_rta_sel +%v1_neq_v2_int = OpPtrNotEqual %bool %var1_int_gep %var2_int_gep +%v1_neq_v2_int_sel = OpSelect %int %v1_neq_v2_int %int_1 %int_0 +%out_gep3 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx2 +%out_idx3 = OpIAdd %int %out_idx2 %int_1 +OpStore %out_gep3 %v1_neq_v2_int_sel +; var1 vs var3 +%v1_neq_v3 = OpPtrNotEqual %bool %var1 %var3 +%v1_neq_v3_sel = OpSelect %int %v1_neq_v3 %int_1 %int_0 +%out_gep4 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx3 +%out_idx4 = OpIAdd %int %out_idx3 %int_1 +OpStore %out_gep4 %v1_neq_v3_sel +%v1_neq_v3_rta = OpPtrNotEqual %bool %var1_int2_gep %var3_int2_gep +%v1_neq_v3_rta_sel = OpSelect %int %v1_neq_v3_rta %int_1 %int_0 +%out_gep5 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx4 +%out_idx5 = OpIAdd %int %out_idx4 %int_1 +OpStore %out_gep5 %v1_neq_v3_rta_sel +%v1_neq_v3_int = OpPtrNotEqual %bool %var1_int_gep %var3_int_gep +%v1_neq_v3_int_sel = OpSelect %int %v1_neq_v3_int %int_1 %int_0 +%out_gep6 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx5 +%out_idx6 = OpIAdd %int %out_idx5 %int_1 +OpStore %out_gep6 %v1_neq_v3_int_sel +; var2 vs var3 +%v2_neq_v3 = OpPtrNotEqual %bool %var2 %var3 +%v2_neq_v3_sel = OpSelect %int %v2_neq_v3 %int_1 %int_0 +%out_gep7 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx6 +%out_idx7 = OpIAdd %int %out_idx6 %int_1 +OpStore %out_gep7 %v2_neq_v3_sel +%v2_neq_v3_rta = OpPtrNotEqual %bool %var2_int2_gep %var3_int2_gep +%v2_neq_v3_rta_sel = OpSelect %int %v2_neq_v3_rta %int_1 %int_0 +%out_gep8 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx7 +%out_idx8 = OpIAdd %int %out_idx7 %int_1 +OpStore %out_gep8 %v2_neq_v3_rta_sel +%v2_neq_v3_int = OpPtrNotEqual %bool %var2_int_gep %var3_int_gep +%v2_neq_v3_int_sel = OpSelect %int %v2_neq_v3_int %int_1 %int_0 +%out_gep9 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx8 +%out_idx9 = OpIAdd %int %out_idx8 %int_1 +OpStore %out_gep9 %v2_neq_v3_int_sel +%v1_neq_v1 = OpPtrNotEqual %bool %var1 %var1 +%v1_neq_v1_sel = OpSelect %int %v1_neq_v1 %int_1 %int_0 +%out_gep10 = OpAccessChain %ptr_ssbo_int %out_var %int_0 %out_idx9 +OpStore %out_gep10 %v1_neq_v1_sel +OpReturn +OpFunctionEnd +[test] +ssbo 0:0 40 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:0 0 == 1 1 1 1 1 1 1 1 1 0 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/null_comparisons_ssbo_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/null_comparisons_ssbo_not_equal.amber new file mode 100644 index 0000000..9720d8a --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/null_comparisons_ssbo_not_equal.amber @@ -0,0 +1,87 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +; This test generates four results. + +; The results are based of OpPtrNotEqual comparisons of +; %ssbo_var vs null. +; 0: comparison of %ssbo_var vs null +; 1: comparison of SSBO float pointer vs null +; 2: comparison of null struct vs null struct +; 3: comparison of null float vs null float + +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %ssbo_var %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %ssbo_struct Block +OpMemberDecorate %ssbo_struct 0 Offset 0 +OpDecorate %ssbo_var DescriptorSet 0 +OpDecorate %ssbo_var Binding 0 + +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +%void = OpTypeVoid +%bool = OpTypeBool +%float = OpTypeFloat 32 +%int = OpTypeInt 32 0 +%int4 = OpTypeVector %int 4 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 + +%ssbo_struct = OpTypeStruct %float +%ptr_ssbo_struct = OpTypePointer StorageBuffer %ssbo_struct +%ssbo_var = OpVariable %ptr_ssbo_struct StorageBuffer +%ptr_ssbo_float = OpTypePointer StorageBuffer %float + +%out_struct = OpTypeStruct %int4 +%ptr_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_out_struct StorageBuffer +%ptr_ssbo_int4 = OpTypePointer StorageBuffer %int4 + +%ptr_ssbo_struct_null = OpConstantNull %ptr_ssbo_struct +%ptr_ssbo_float_null = OpConstantNull %ptr_ssbo_float +%ptr_ssbo_struct_null2 = OpConstantNull %ptr_ssbo_struct +%ptr_ssbo_float_null2 = OpConstantNull %ptr_ssbo_float + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel + +%ssbo_not_equal = OpPtrNotEqual %bool %ssbo_var %ptr_ssbo_struct_null +%ssbo_not_equal_int = OpSelect %int %ssbo_not_equal %int_1 %int_0 + +%ssbo_gep_0 = OpAccessChain %ptr_ssbo_float %ssbo_var %int_0 +%ssbo_not_equal_0 = OpPtrNotEqual %bool %ssbo_gep_0 %ptr_ssbo_float_null +%ssbo_not_equal_0_int = OpSelect %int %ssbo_not_equal_0 %int_1 %int_0 + +%null_ssbo_not_equal = OpPtrNotEqual %bool %ptr_ssbo_struct_null %ptr_ssbo_struct_null2 +%null_ssbo_not_equal_int = OpSelect %int %null_ssbo_not_equal %int_1 %int_0 + +%null_ssbo_not_equal_0 = OpPtrNotEqual %bool %ptr_ssbo_float_null %ptr_ssbo_float_null2 +%null_ssbo_not_equal_0_int = OpSelect %int %null_ssbo_not_equal_0 %int_1 %int_0 + +%combined = OpCompositeConstruct %int4 %ssbo_not_equal_int %ssbo_not_equal_0_int %null_ssbo_not_equal_int %null_ssbo_not_equal_0_int +%out_gep = OpAccessChain %ptr_ssbo_int4 %out_var %int_0 +OpStore %out_gep %combined + +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 4 +ssbo 0:1 16 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uvec4 0:1 0 == 1 1 0 0 + + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/null_comparisons_wg_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/null_comparisons_wg_not_equal.amber new file mode 100644 index 0000000..86cf342 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/null_comparisons_wg_not_equal.amber @@ -0,0 +1,83 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +; This generates 4 results for OpPtrNotEqual + +; The workgroup variable is a struct containing a single float. + +; Results: +; 0: comparison of the workgroup var vs null +; 1: comparison of the workgroup float vs null +; 2: comparison of null struct vs null struct +; 3: comparison of null float vs null float + +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %wg_var %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 0 + +%void = OpTypeVoid +%bool = OpTypeBool +%float = OpTypeFloat 32 +%int = OpTypeInt 32 0 +%int4 = OpTypeVector %int 4 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 + +%wg_struct = OpTypeStruct %float +%ptr_wg_struct = OpTypePointer Workgroup %wg_struct +%wg_var = OpVariable %ptr_wg_struct Workgroup +%ptr_wg_float = OpTypePointer Workgroup %float + +%out_struct = OpTypeStruct %int4 +%ptr_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_out_struct StorageBuffer +%ptr_ssbo_int4 = OpTypePointer StorageBuffer %int4 + +%ptr_wg_struct_null = OpConstantNull %ptr_wg_struct +%ptr_wg_float_null = OpConstantNull %ptr_wg_float +%ptr_wg_struct_null2 = OpConstantNull %ptr_wg_struct +%ptr_wg_float_null2 = OpConstantNull %ptr_wg_float + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel + +%wg_not_equal = OpPtrNotEqual %bool %wg_var %ptr_wg_struct_null +%wg_not_equal_int = OpSelect %int %wg_not_equal %int_1 %int_0 + +%wg_gep_0 = OpAccessChain %ptr_wg_float %wg_var %int_0 +%wg_not_equal_0 = OpPtrNotEqual %bool %wg_gep_0 %ptr_wg_float_null +%wg_not_equal_0_int = OpSelect %int %wg_not_equal_0 %int_1 %int_0 + +%null_wg_not_equal = OpPtrNotEqual %bool %ptr_wg_struct_null %ptr_wg_struct_null2 +%null_wg_not_equal_int = OpSelect %int %null_wg_not_equal %int_1 %int_0 + +%null_wg_not_equal_0 = OpPtrNotEqual %bool %ptr_wg_float_null %ptr_wg_float_null2 +%null_wg_not_equal_0_int = OpSelect %int %null_wg_not_equal_0 %int_1 %int_0 + +%combined = OpCompositeConstruct %int4 %wg_not_equal_int %wg_not_equal_0_int %null_wg_not_equal_int %null_wg_not_equal_0_int +%out_gep = OpAccessChain %ptr_ssbo_int4 %out_var %int_0 +OpStore %out_gep %combined + +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 16 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uvec4 0:0 0 == 1 1 0 0 + + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/simple_variable_pointers_ptr_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/simple_variable_pointers_ptr_not_equal.amber new file mode 100644 index 0000000..6c0f6d5 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/simple_variable_pointers_ptr_not_equal.amber @@ -0,0 +1,121 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +[compute shader spirv] +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %var1 %var2 %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %irta ArrayStride 4 +OpDecorate %struct Block +OpDecorate %out_struct Block +OpMemberDecorate %struct 0 ColMajor +OpMemberDecorate %struct 0 Offset 0 +OpMemberDecorate %struct 0 MatrixStride 16 +OpMemberDecorate %struct 1 RowMajor +OpMemberDecorate %struct 1 Offset 64 +OpMemberDecorate %struct 1 MatrixStride 16 +OpMemberDecorate %struct 2 Offset 128 +OpMemberDecorate %struct 3 Offset 132 +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %var1 DescriptorSet 0 +OpDecorate %var1 Binding 0 +OpDecorate %var2 DescriptorSet 0 +OpDecorate %var2 Binding 1 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 2 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%float = OpTypeFloat 32 +%irta = OpTypeRuntimeArray %int +%v4 = OpTypeVector %float 4 +%mat4v4 = OpTypeMatrix %v4 4 +%struct = OpTypeStruct %mat4v4 %mat4v4 %float %float +%out_struct = OpTypeStruct %irta +%ptr_buffer_struct = OpTypePointer StorageBuffer %struct +%out_ptr_buffer_struct = OpTypePointer StorageBuffer %out_struct +%ptr_mat4v4 = OpTypePointer StorageBuffer %mat4v4 +%ptr_buffer_int = OpTypePointer StorageBuffer %int +%ptr_buffer_float = OpTypePointer StorageBuffer %float +%ptr_v4 = OpTypePointer StorageBuffer %v4 +%var1 = OpVariable %ptr_buffer_struct StorageBuffer +%var2 = OpVariable %ptr_buffer_struct StorageBuffer +%out_var = OpVariable %out_ptr_buffer_struct StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%out_idx0 = OpCopyObject %int %int_0 +; var 1 float 1 +%var1_float_1 = OpAccessChain %ptr_buffer_float %var1 %int_2 +; var 1 float 2 +%var1_float_2 = OpAccessChain %ptr_buffer_float %var1 %int_3 +; var 2 float 1 +%var2_float_1 = OpAccessChain %ptr_buffer_float %var2 %int_2 +; var 2 float 2 +%var2_float_2 = OpAccessChain %ptr_buffer_float %var2 %int_3 +; var 1 matrix 1 +%var1_mat_1 = OpAccessChain %ptr_mat4v4 %var1 %int_0 +; var 1 matrix 2 +%var1_mat_2 = OpAccessChain %ptr_mat4v4 %var1 %int_1 +; var 1 matrix 1 column 1 +%var1_mat_1_0 = OpAccessChain %ptr_v4 %var1 %int_0 %int_0 +; var 1 matrix 1 column 2 +%var1_mat_1_1 = OpAccessChain %ptr_v4 %var1 %int_0 %int_1 +; var 1 matrix first member +%var1_mat_1_0_0 = OpAccessChain %ptr_buffer_float %var1 %int_0 %int_0 %int_0 +; Two different members of a same uniform blocks +%var1_float_1_eq_var1_float_2 = OpPtrNotEqual %bool %var1_float_1 %var1_float_2 +%var1_float_1_eq_var1_float_2_sel = OpSelect %int %var1_float_1_eq_var1_float_2 %int_1 %int_0 +%out_gep1 = OpAccessChain %ptr_buffer_int %out_var %int_0 %out_idx0 +%out_idx1 = OpIAdd %int %out_idx0 %int_1 +OpStore %out_gep1 %var1_float_1_eq_var1_float_2_sel +; The same member in two separate uniform blocks +%var1_float_1_eq_var2_float_1 = OpPtrNotEqual %bool %var1_float_1 %var2_float_1 +%var1_float_1_eq_var2_float_1_sel = OpSelect %int %var1_float_1_eq_var2_float_1 %int_1 %int_0 +%out_gep2 = OpAccessChain %ptr_buffer_int %out_var %int_0 %out_idx1 +%out_idx2 = OpIAdd %int %out_idx1 %int_1 +OpStore %out_gep2 %var1_float_1_eq_var2_float_1_sel +; Variable pointer and one non-variable pointer +%var1_float_1_var1_float_2_sel = OpSelect %ptr_buffer_float %var1_float_1_eq_var2_float_1 %var1_float_1 %var1_float_2 +%var2_float_1_var2_float_2_sel = OpSelect %ptr_buffer_float %var1_float_1_eq_var2_float_1 %var2_float_1 %var2_float_2 +%var1_float_1_var1_float_2_sel_eq_var2_float_1_var2_float_2_sel = OpPtrNotEqual %bool %var1_float_1_var1_float_2_sel %var2_float_1_var2_float_2_sel +%var1_float_1_var1_float_2_sel_eq_var2_float_1_var2_float_2_sel_sel = OpSelect %int %var1_float_1_var1_float_2_sel_eq_var2_float_1_var2_float_2_sel %int_1 %int_0 +%out_gep3 = OpAccessChain %ptr_buffer_int %out_var %int_0 %out_idx2 +%out_idx3 = OpIAdd %int %out_idx2 %int_1 +OpStore %out_gep3 %var1_float_1_var1_float_2_sel_eq_var2_float_1_var2_float_2_sel_sel +; Variable pointer and first member of matrices +%var1_float_1_var1_float_2_sel_2 = OpSelect %ptr_buffer_float %var1_float_1_var1_float_2_sel_eq_var2_float_1_var2_float_2_sel %var1_float_1 %var1_float_2 +%var1_float_1_var1_float_2_sel_2_eq_var1_mat_1_0_0 = OpPtrNotEqual %bool %var1_float_1_var1_float_2_sel_2 %var1_mat_1_0_0 +%var1_float_1_var1_float_2_sel_2_eq_var1_mat_1_0_0_sel = OpSelect %int %var1_float_1_var1_float_2_sel_2_eq_var1_mat_1_0_0 %int_1 %int_0 +%out_gep4 = OpAccessChain %ptr_buffer_int %out_var %int_0 %out_idx3 +%out_idx4 = OpIAdd %int %out_idx3 %int_1 +OpStore %out_gep4 %var1_float_1_var1_float_2_sel_2_eq_var1_mat_1_0_0_sel +; Matrices of the same uniform blocks +%var1_mat_1_eq_var1_mat_2 = OpPtrNotEqual %bool %var1_mat_1 %var1_mat_2 +%var1_mat_1_eq_var1_mat_2_sel = OpSelect %int %var1_mat_1_eq_var1_mat_2 %int_1 %int_0 +%out_gep5 = OpAccessChain %ptr_buffer_int %out_var %int_0 %out_idx4 +%out_idx5 = OpIAdd %int %out_idx4 %int_1 +OpStore %out_gep5 %var1_mat_1_eq_var1_mat_2_sel +; Pointers to individual columns of row-major matrices +%var1_mat_1_0_eq_var1_mat_1_1 = OpPtrNotEqual %bool %var1_mat_1_0 %var1_mat_1_1 +%var1_mat_1_0_eq_var1_mat_1_1_sel = OpSelect %int %var1_mat_1_0_eq_var1_mat_1_1 %int_1 %int_0 +%out_gep6 = OpAccessChain %ptr_buffer_int %out_var %int_0 %out_idx5 +%out_idx6 = OpIAdd %int %out_idx5 %int_1 +OpStore %out_gep6 %var1_mat_1_0_eq_var1_mat_1_1_sel +OpReturn +OpFunctionEnd +[test] +ssbo 0:0 136 +ssbo 0:1 136 +ssbo 0:2 24 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:2 0 == 1 1 1 1 1 1 \ No newline at end of file diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/ssbo_comparisons_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/ssbo_comparisons_not_equal.amber new file mode 100644 index 0000000..dbe88fd --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/ssbo_comparisons_not_equal.amber @@ -0,0 +1,174 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +; Test operates on a SSBO (%in_var) containing a runtime array of an array of four ints. +; Size of the runtime array is passed another SSBO (%n_var). + +; Each invocation writes out the result of OpPtrNotEqual +; for elements of the input runtime array to index 16 of the corresponding output +; variable. Pointers are based the gid'th element vs the zero'th element. + +; Each invocation loops 4 times and writes out results each for +; OpPtrNotEqual. The pointers are the lid'th element of gid'th element of +; the runtime array vs the iteration count element of the gid'th element of +; the runtime array. + +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %not_equal_var %n_var %lid_var %gid_var +OpExecutionMode %main LocalSize 4 1 1 + +OpDecorate %struct_4 Block +OpMemberDecorate %struct_4 0 Offset 0 +OpDecorate %runtime_4 ArrayStride 16 +OpDecorate %struct_17 Block +OpMemberDecorate %struct_17 0 Offset 0 +OpDecorate %runtime_17 ArrayStride 68 +OpDecorate %n_struct Block +OpMemberDecorate %n_struct 0 Offset 0 +OpDecorate %array_4 ArrayStride 4 +OpDecorate %array_17 ArrayStride 4 + +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %not_equal_var DescriptorSet 0 +OpDecorate %not_equal_var Binding 1 +OpDecorate %n_var DescriptorSet 0 +OpDecorate %n_var Binding 2 + +OpDecorate %lid_var BuiltIn LocalInvocationId +OpDecorate %gid_var BuiltIn WorkgroupId + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_4 = OpConstant %int 4 +%int_16 = OpConstant %int 16 +%int_17 = OpConstant %int 17 +%int3 = OpTypeVector %int 3 + +%ptr_input_int3 = OpTypePointer Input %int3 + +%array_4 = OpTypeArray %int %int_4 +%runtime_4 = OpTypeRuntimeArray %array_4 +%struct_4 = OpTypeStruct %runtime_4 +%ptr_struct_4 = OpTypePointer StorageBuffer %struct_4 +%ptr_array_4 = OpTypePointer StorageBuffer %array_4 + +%array_17 = OpTypeArray %int %int_17 +%runtime_17 = OpTypeRuntimeArray %array_17 +%struct_17 = OpTypeStruct %runtime_17 +%ptr_struct_17 = OpTypePointer StorageBuffer %struct_17 +%ptr_array_17 = OpTypePointer StorageBuffer %array_17 + +%ptr_int = OpTypePointer StorageBuffer %int +%n_struct = OpTypeStruct %int +%ptr_n_struct = OpTypePointer Uniform %n_struct +%ptr_n = OpTypePointer Uniform %int + +%in_var = OpVariable %ptr_struct_4 StorageBuffer +%not_equal_var = OpVariable %ptr_struct_17 StorageBuffer +%n_var = OpVariable %ptr_n_struct Uniform +%lid_var = OpVariable %ptr_input_int3 Input +%gid_var = OpVariable %ptr_input_int3 Input + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%n_gep = OpAccessChain %ptr_n %n_var %int_0 +%n = OpLoad %int %n_gep +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%lid = OpLoad %int3 %lid_var +%lid_x = OpCompositeExtract %int %lid 0 +%array_gep_0 = OpAccessChain %ptr_array_4 %in_var %int_0 %int_0 +%array_gep = OpAccessChain %ptr_array_4 %in_var %int_0 %gid_x +%cmp_gid = OpSGreaterThanEqual %bool %gid_x %n +OpSelectionMerge %body None +OpBranchConditional %cmp_gid %ret %body + +%ret = OpLabel +OpReturn + +%body = OpLabel +%cmp_lid = OpIEqual %bool %lid_x %int_1 +OpSelectionMerge %loop None +OpBranchConditional %cmp_lid %then %loop + +%then = OpLabel +; Compute results for outer array +%large_not_equal = OpPtrNotEqual %bool %array_gep %array_gep_0 +%large_not_equal_gep = OpAccessChain %ptr_int %not_equal_var %int_0 %gid_x %int_16 +%large_not_equal_int = OpSelect %int %large_not_equal %int_1 %int_0 +OpStore %large_not_equal_gep %large_not_equal_int +; +OpBranch %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %body %int_0 %then %inc_i %loop +%inc_i = OpIAdd %int %i %int_1 +%i_cmp = OpIEqual %bool %inc_i %int_4 +%lid_offset = OpIMul %int %lid_x %int_4 +%gep_offset = OpIAdd %int %lid_offset %i +; Compute results for inner array +%ref_gep = OpAccessChain %ptr_int %array_gep %lid_x +%cmp_gep = OpAccessChain %ptr_int %array_gep %i +%not_equal = OpPtrNotEqual %bool %ref_gep %cmp_gep +%not_equal_int = OpSelect %int %not_equal %int_1 %int_0 +%not_equal_gep = OpAccessChain %ptr_int %not_equal_var %int_0 %gid_x %gep_offset +OpStore %not_equal_gep %not_equal_int +; +OpLoopMerge %exit %loop None +OpBranchConditional %i_cmp %exit %loop + +%exit = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 2048 +ssbo 0:1 2176 +uniform ubo 0:2 int 0 32 + +compute entrypoint main +compute 32 1 1 + +#not equal var +probe ssbo int 0:1 0 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 0 +probe ssbo int 0:1 68 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 136 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 204 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 272 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 340 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 408 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 476 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 544 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 612 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 680 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 748 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 816 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 884 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 952 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1020 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1088 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1156 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1224 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1292 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1360 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1428 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1496 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1564 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1632 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1700 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1768 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1836 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1904 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 1972 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 2040 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:1 2108 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_ssbo_2_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_ssbo_2_not_equal.amber new file mode 100644 index 0000000..ffb0500 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_ssbo_2_not_equal.amber @@ -0,0 +1,131 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +; Tests pointer comparisons with variable pointers + +; Stores an array of pointers in Function storage class that point into input +; SSBO. Each iteration produces an OpPtrNotEqual comparison. Pointers evolve by +; incrementing or decrementing by 1 each iteration (overall ratio is 2:1). + +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %in_struct Block +OpMemberDecorate %in_struct 0 Offset 0 +OpMemberDecorate %in_struct 1 Offset 4 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 + +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorate %ptr_ssbo_int ArrayStride 4 + +%void = OpTypeVoid +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%int = OpTypeInt 32 1 +%int_n1 = OpConstant %int -1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 + +%int_rta = OpTypeRuntimeArray %int +%in_struct = OpTypeStruct %int %int_rta +%ptr_ssbo_in_struct = OpTypePointer StorageBuffer %in_struct +%in_var = OpVariable %ptr_ssbo_in_struct StorageBuffer + +%out_struct = OpTypeStruct %int_rta +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer + +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%array_ptr = OpTypeArray %ptr_ssbo_int %int_2 +%ptr_ptr = OpTypePointer Function %array_ptr +%ptr_func_ptr = OpTypePointer Function %ptr_ssbo_int + +%ptr_ssbo_n = OpTypePointer StorageBuffer %int +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%var = OpVariable %ptr_ptr Function +%n_gep = OpAccessChain %ptr_ssbo_n %in_var %int_0 +%n = OpLoad %int %n_gep +%length = OpArrayLength %uint %in_var 1 +%length_div_2 = OpSDiv %int %length %int_2 +%mid_gep = OpAccessChain %ptr_ssbo_int %in_var %int_1 %length_div_2 +%func_gep_0 = OpAccessChain %ptr_func_ptr %var %int_0 +%func_gep_1 = OpAccessChain %ptr_func_ptr %var %int_1 +OpStore %func_gep_0 %mid_gep +OpStore %func_gep_1 %mid_gep +%cmp_n = OpSLessThanEqual %bool %n %int_0 +OpSelectionMerge %exit None +OpBranchConditional %cmp_n %exit %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %inc_i %continue +%gep_0 = OpLoad %ptr_ssbo_int %func_gep_0 +%gep_1 = OpLoad %ptr_ssbo_int %func_gep_1 +%inc_i = OpIAdd %int %i %int_1 + +%not_equal = OpPtrNotEqual %bool %gep_0 %gep_1 +%not_equal_int = OpSelect %int %not_equal %int_1 %int_0 +%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %i +OpStore %out_gep %not_equal_int + +OpLoopMerge %loop_exit %continue None +OpBranch %body + +%body = OpLabel +%i_mod_3 = OpSMod %int %i %int_3 +%cmp_vs_0 = OpIEqual %bool %i_mod_3 %int_0 +OpSelectionMerge %if_merge None +OpBranchConditional %cmp_vs_0 %then %else + +%then = OpLabel +%then_0_next = OpPtrAccessChain %ptr_ssbo_int %gep_0 %int_n1 +%then_1_next = OpPtrAccessChain %ptr_ssbo_int %gep_1 %int_1 +OpBranch %if_merge +%else = OpLabel +%else_0_next = OpPtrAccessChain %ptr_ssbo_int %gep_0 %int_1 +%else_1_next = OpPtrAccessChain %ptr_ssbo_int %gep_1 %int_n1 +OpBranch %if_merge + +%if_merge = OpLabel +%next_0 = OpPhi %ptr_ssbo_int %then_0_next %then %else_0_next %else +%next_1 = OpPhi %ptr_ssbo_int %then_1_next %then %else_1_next %else +OpBranch %continue + +%continue = OpLabel +OpStore %func_gep_0 %next_0 +OpStore %func_gep_1 %next_1 +%cmp = OpSGreaterThanEqual %bool %i %n +OpBranchConditional %cmp %loop_exit %loop + +%loop_exit = OpLabel +OpBranch %exit +%exit = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 68 +ssbo 0:0 subdata uint 0 16 +ssbo 0:1 64 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:1 0 == 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 + + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_ssbo_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_ssbo_not_equal.amber new file mode 100644 index 0000000..f718ef2 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_ssbo_not_equal.amber @@ -0,0 +1,112 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +; This test generates four results per iteration of the loop. The loop is executed %n times. + +; Each iteration generates a result for OpPtrEqual. One +; pointer is an iterator through the input SSBO (%in_var) and the other is a +; selection between the iterator, null or the 0'th index pointer depending on +; the value of the iterator mod 3. + +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %ptr_ssbo_int ArrayStride 4 + +OpDecorate %in_struct Block +OpMemberDecorate %in_struct 0 Offset 0 +OpMemberDecorate %in_struct 1 Offset 4 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 + +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int2 = OpTypeVector %int 2 +%int_rta = OpTypeRuntimeArray %int +%int2_rta = OpTypeRuntimeArray %int2 + +%in_struct = OpTypeStruct %int %int_rta +%ptr_ssbo_in_struct = OpTypePointer StorageBuffer %in_struct +%in_var = OpVariable %ptr_ssbo_in_struct StorageBuffer + +%out_struct = OpTypeStruct %int_rta +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer + +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%ptr_ssbo_int_null = OpConstantNull %ptr_ssbo_int +%ptr_ssbo_n = OpTypePointer StorageBuffer %int +%ptr_ssbo_int2 = OpTypePointer StorageBuffer %int2 +%void_fn = OpTypeFunction %void +%ptr_return_fn = OpTypeFunction %ptr_ssbo_int %ptr_ssbo_int %ptr_ssbo_int %int +%main = OpFunction %void None %void_fn +%entry = OpLabel +%n_gep = OpAccessChain %ptr_ssbo_n %in_var %int_0 +%n = OpLoad %int %n_gep +%base_ssbo_gep = OpAccessChain %ptr_ssbo_int %in_var %int_1 %int_0 +%n_leq_0 = OpSLessThanEqual %bool %n %int_0 +OpSelectionMerge %exit None +OpBranchConditional %n_leq_0 %exit %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %inc_i %loop +%ssbo_gep = OpPhi %ptr_ssbo_int %base_ssbo_gep %entry %next_ssbo_gep %loop +%inc_i = OpIAdd %int %i %int_1 +%next_ssbo_gep = OpPtrAccessChain %ptr_ssbo_int %ssbo_gep %int_1 + +%ptr_call = OpFunctionCall %ptr_ssbo_int %gep_func %ssbo_gep %base_ssbo_gep %i +%not_equal = OpPtrNotEqual %bool %ssbo_gep %ptr_call +%not_equal_int = OpSelect %int %not_equal %int_1 %int_0 +%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %i +OpStore %out_gep %not_equal_int + +%cmp = OpSGreaterThanEqual %bool %i %n +OpLoopMerge %loop_exit %loop None +OpBranchConditional %cmp %loop_exit %loop + +%loop_exit = OpLabel +OpBranch %exit +%exit = OpLabel +OpReturn +OpFunctionEnd + +%gep_func = OpFunction %ptr_ssbo_int None %ptr_return_fn +%param_ptr = OpFunctionParameter %ptr_ssbo_int +%param_alt_ptr = OpFunctionParameter %ptr_ssbo_int +%param_i = OpFunctionParameter %int +%1 = OpLabel +%i_mod_3 = OpSMod %int %param_i %int_3 +%i_mod_3_is_0 = OpIEqual %bool %i_mod_3 %int_0 +%i_mod_3_is_1 = OpIEqual %bool %i_mod_3 %int_1 +%ssbo_gep1 = OpSelect %ptr_ssbo_int %i_mod_3_is_0 %param_alt_ptr %ptr_ssbo_int_null +%ssbo_gep2 = OpSelect %ptr_ssbo_int %i_mod_3_is_1 %param_ptr %ssbo_gep1 +OpReturnValue %ssbo_gep2 +OpFunctionEnd + +[test] +ssbo 0:0 132 +ssbo 0:0 subdata int 0 33 +ssbo 0:1 132 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:1 0 == 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 + + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_vars_ssbo_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_vars_ssbo_not_equal.amber new file mode 100644 index 0000000..d506dcf --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_vars_ssbo_not_equal.amber @@ -0,0 +1,136 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +; Tests use of private variables holding SSBO pointers and pointer comparisons. + +; Two iterators are each stored in Private variables: one moves forward, one +; moves backward. In each iteration an OpPtrNotEqual comparison is written. +; Iterators are then moved forward (or backward respectively) one index. + +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var %forward_var %backward_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %in_struct Block +OpMemberDecorate %in_struct 0 Offset 0 +OpMemberDecorate %in_struct 1 Offset 4 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 + +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorate %ptr_ssbo_int ArrayStride 4 + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_n1 = OpConstant %int -1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 + +%int_rta = OpTypeRuntimeArray %int +%in_struct = OpTypeStruct %int %int_rta +%ptr_ssbo_in_struct = OpTypePointer StorageBuffer %in_struct +%in_var = OpVariable %ptr_ssbo_in_struct StorageBuffer + +%out_struct = OpTypeStruct %int_rta +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer + +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%ptr_ptr = OpTypePointer Private %ptr_ssbo_int +%forward_var = OpVariable %ptr_ptr Private +%backward_var = OpVariable %ptr_ptr Private + +%ptr_ssbo_n = OpTypePointer StorageBuffer %int +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%n_gep = OpAccessChain %ptr_ssbo_n %in_var %int_0 +%n = OpLoad %int %n_gep +%first_gep = OpAccessChain %ptr_ssbo_int %in_var %int_1 %int_0 +OpStore %forward_var %first_gep +%last_gep = OpPtrAccessChain %ptr_ssbo_int %first_gep %n +OpStore %backward_var %last_gep +%cmp_n = OpSLessThanEqual %bool %n %int_0 +OpSelectionMerge %exit None +OpBranchConditional %cmp_n %exit %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %inc_i %loop +%forward_gep = OpLoad %ptr_ssbo_int %forward_var +%backward_gep = OpLoad %ptr_ssbo_int %backward_var +%forward_next = OpPtrAccessChain %ptr_ssbo_int %forward_gep %int_1 +%backward_next = OpPtrAccessChain %ptr_ssbo_int %backward_gep %int_n1 +%inc_i = OpIAdd %int %i %int_1 +OpStore %forward_var %forward_next +OpStore %backward_var %backward_next + +%not_equal = OpPtrNotEqual %bool %forward_gep %backward_gep +%not_equal_int = OpSelect %int %not_equal %int_1 %int_0 +%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %i +OpStore %out_gep %not_equal_int + +%cmp = OpSGreaterThanEqual %bool %i %n +OpLoopMerge %loop_exit %loop None +OpBranchConditional %cmp %loop_exit %loop + +%loop_exit = OpLabel +OpBranch %exit +%exit = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 132 +# Only data for number of iterations matters. +ssbo 0:0 subdata int 0 32 +ssbo 0:1 128 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:1 0 == 1 +probe ssbo int 0:1 4 == 1 +probe ssbo int 0:1 8 == 1 +probe ssbo int 0:1 12 == 1 +probe ssbo int 0:1 16 == 1 +probe ssbo int 0:1 20 == 1 +probe ssbo int 0:1 24 == 1 +probe ssbo int 0:1 28 == 1 +probe ssbo int 0:1 32 == 1 +probe ssbo int 0:1 36 == 1 +probe ssbo int 0:1 40 == 1 +probe ssbo int 0:1 44 == 1 +probe ssbo int 0:1 48 == 1 +probe ssbo int 0:1 52 == 1 +probe ssbo int 0:1 56 == 1 +probe ssbo int 0:1 60 == 1 +probe ssbo int 0:1 64 == 0 +probe ssbo int 0:1 68 == 1 +probe ssbo int 0:1 72 == 1 +probe ssbo int 0:1 76 == 1 +probe ssbo int 0:1 80 == 1 +probe ssbo int 0:1 84 == 1 +probe ssbo int 0:1 88 == 1 +probe ssbo int 0:1 92 == 1 +probe ssbo int 0:1 96 == 1 +probe ssbo int 0:1 100 == 1 +probe ssbo int 0:1 104 == 1 +probe ssbo int 0:1 108 == 1 +probe ssbo int 0:1 112 == 1 +probe ssbo int 0:1 116 == 1 +probe ssbo int 0:1 120 == 1 +probe ssbo int 0:1 124 == 1 + + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_vars_wg_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_vars_wg_not_equal.amber new file mode 100644 index 0000000..ef0898e --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_vars_wg_not_equal.amber @@ -0,0 +1,122 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +; Tests use of private variables holding workgroup pointers and pointer comparisons. + +; Two iterators are each stored in Private variables: one moves forward, one +; moves backward. In each iteration a not equal comparison is written. Iterators +; are then moved forward (or backward respectively) one index. + +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %wg_var %out_var %forward_var %backward_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 0 + +OpDecorate %ptr_wg_int ArrayStride 4 + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_n1 = OpConstant %int -1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_32 = OpConstant %int 32 + +%int_array_32 = OpTypeArray %int %int_32 +%ptr_wg_array = OpTypePointer Workgroup %int_array_32 +%wg_var = OpVariable %ptr_wg_array Workgroup + +%int_rta = OpTypeRuntimeArray %int +%out_struct = OpTypeStruct %int_rta +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer + +%ptr_wg_int = OpTypePointer Workgroup %int +%ptr_ptr = OpTypePointer Private %ptr_wg_int +%forward_var = OpVariable %ptr_ptr Private +%backward_var = OpVariable %ptr_ptr Private + +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%first_gep = OpAccessChain %ptr_wg_int %wg_var %int_0 +OpStore %forward_var %first_gep +%last_gep = OpPtrAccessChain %ptr_wg_int %first_gep %int_32 +OpStore %backward_var %last_gep +OpBranch %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %inc_i %loop +%forward_gep = OpLoad %ptr_wg_int %forward_var +%backward_gep = OpLoad %ptr_wg_int %backward_var +%forward_next = OpPtrAccessChain %ptr_wg_int %forward_gep %int_1 +%backward_next = OpPtrAccessChain %ptr_wg_int %backward_gep %int_n1 +%inc_i = OpIAdd %int %i %int_1 +OpStore %forward_var %forward_next +OpStore %backward_var %backward_next + +%not_equal = OpPtrNotEqual %bool %forward_gep %backward_gep +%not_equal_int = OpSelect %int %not_equal %int_1 %int_0 +%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %i +OpStore %out_gep %not_equal_int + +%cmp = OpSGreaterThan %bool %i %int_32 +OpLoopMerge %exit %loop None +OpBranchConditional %cmp %exit %loop + +%exit = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 528 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:0 0 == 1 +probe ssbo int 0:0 4 == 1 +probe ssbo int 0:0 8 == 1 +probe ssbo int 0:0 12 == 1 +probe ssbo int 0:0 16 == 1 +probe ssbo int 0:0 20 == 1 +probe ssbo int 0:0 24 == 1 +probe ssbo int 0:0 28 == 1 +probe ssbo int 0:0 32 == 1 +probe ssbo int 0:0 36 == 1 +probe ssbo int 0:0 40 == 1 +probe ssbo int 0:0 44 == 1 +probe ssbo int 0:0 48 == 1 +probe ssbo int 0:0 52 == 1 +probe ssbo int 0:0 56 == 1 +probe ssbo int 0:0 60 == 1 +probe ssbo int 0:0 64 == 0 +probe ssbo int 0:0 68 == 1 +probe ssbo int 0:0 72 == 1 +probe ssbo int 0:0 76 == 1 +probe ssbo int 0:0 80 == 1 +probe ssbo int 0:0 84 == 1 +probe ssbo int 0:0 88 == 1 +probe ssbo int 0:0 92 == 1 +probe ssbo int 0:0 96 == 1 +probe ssbo int 0:0 100 == 1 +probe ssbo int 0:0 104 == 1 +probe ssbo int 0:0 108 == 1 +probe ssbo int 0:0 112 == 1 +probe ssbo int 0:0 116 == 1 +probe ssbo int 0:0 120 == 1 +probe ssbo int 0:0 124 == 1 +probe ssbo int 0:0 128 == 1 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_wg_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_wg_not_equal.amber new file mode 100644 index 0000000..4f6d231 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/variable_pointers_wg_not_equal.amber @@ -0,0 +1,95 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +; This test generates four results per iteration of the loop. The loop is executed 64 times. + +; Each iteration generates results for OpPtrNotEqual. One pointer is an iterator +; through the workgroup variable (%wg_var) and the other is a selection between +; the iterator, null or the 0'th index pointer depending on the value of the +; iterator mod 3. + +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %wg_var %out_var +OpExecutionMode %main LocalSize 1 1 1 + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %ptr_wg_int ArrayStride 4 + +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 0 + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_32 = OpConstant %int 32 +%int_array = OpTypeArray %int %int_32 +%int_rta = OpTypeRuntimeArray %int + +%ptr_wg_int_array = OpTypePointer Workgroup %int_array +%wg_var = OpVariable %ptr_wg_int_array Workgroup + +%out_struct = OpTypeStruct %int_rta +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer + +%ptr_wg_int = OpTypePointer Workgroup %int +%ptr_wg_int_null = OpConstantNull %ptr_wg_int +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%void_fn = OpTypeFunction %void +%ptr_return_fn = OpTypeFunction %ptr_wg_int %ptr_wg_int %ptr_wg_int %int +%main = OpFunction %void None %void_fn +%entry = OpLabel +%base_wg_gep = OpAccessChain %ptr_wg_int %wg_var %int_0 +OpBranch %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %inc_i %loop +%wg_gep = OpPhi %ptr_wg_int %base_wg_gep %entry %next_wg_gep %loop +%inc_i = OpIAdd %int %i %int_1 +%next_wg_gep = OpPtrAccessChain %ptr_wg_int %wg_gep %int_1 + +%ptr_call = OpFunctionCall %ptr_wg_int %gep_func %wg_gep %base_wg_gep %i +%not_equal = OpPtrNotEqual %bool %wg_gep %ptr_call ;;;; HEY THIS SHOULD BE PtrNotEqual +%not_equal_int = OpSelect %int %not_equal %int_1 %int_0 +%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %i +OpStore %out_gep %not_equal_int + +%cmp = OpSGreaterThan %bool %i %int_32 +OpLoopMerge %exit %loop None +OpBranchConditional %cmp %exit %loop + +%exit = OpLabel +OpReturn +OpFunctionEnd + +%gep_func = OpFunction %ptr_wg_int None %ptr_return_fn +%param_ptr = OpFunctionParameter %ptr_wg_int +%param_alt_ptr = OpFunctionParameter %ptr_wg_int +%param_i = OpFunctionParameter %int +%1 = OpLabel +%i_mod_3 = OpSMod %int %param_i %int_3 +%i_mod_3_is_0 = OpIEqual %bool %i_mod_3 %int_0 +%i_mod_3_is_1 = OpIEqual %bool %i_mod_3 %int_1 +%wg_gep1 = OpSelect %ptr_wg_int %i_mod_3_is_0 %param_alt_ptr %ptr_wg_int_null +%wg_gep2 = OpSelect %ptr_wg_int %i_mod_3_is_1 %param_ptr %wg_gep1 +OpReturnValue %wg_gep2 +OpFunctionEnd + +[test] +ssbo 0:0 132 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:0 0 == 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/wg_comparisons_not_equal.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/wg_comparisons_not_equal.amber new file mode 100644 index 0000000..5e4d6af --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opptrnotequal/wg_comparisons_not_equal.amber @@ -0,0 +1,159 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +; Test operates on a Workgroup array (%wg_var) containing an array of 16 arrays of four ints. + +; Each invocation writes out the result of OpPtrNotEqual for elements of the +; outer array to index 16 of the corresponding output variable. Pointers are +; based the gid'th element vs the zero'th element. + +; Each invocation loops 4 times and writes out 4 results each for OpPtrNotEqual. +; The pointers are the lid'th element of gid'th element of the outer array vs +; the iteration count mod 4'th element of the gid'th element of the outer +; array. Results are ordered so each thread writes continguous results. + +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %wg_var %not_equal_var %lid_var %gid_var +OpExecutionMode %main LocalSize 16 4 1 + +OpDecorate %struct_17 Block +OpMemberDecorate %struct_17 0 Offset 0 +OpDecorate %runtime_17 ArrayStride 68 +OpDecorate %array_17 ArrayStride 4 + +OpDecorate %not_equal_var DescriptorSet 0 +OpDecorate %not_equal_var Binding 0 + +OpDecorate %lid_var BuiltIn LocalInvocationId +OpDecorate %gid_var BuiltIn GlobalInvocationId + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_4 = OpConstant %int 4 +%int_16 = OpConstant %int 16 +%int_17 = OpConstant %int 17 +%int_64 = OpConstant %int 64 +%int3 = OpTypeVector %int 3 + +%input_struct = OpTypeStruct %int3 %int3 +%ptr_input_struct = OpTypePointer Input %input_struct +%ptr_input_int3 = OpTypePointer Input %int3 + +%array_4 = OpTypeArray %int %int_4 +%array_array_4 = OpTypeArray %array_4 %int_16 +%ptr_array_array_4 = OpTypePointer Workgroup %array_array_4 +%ptr_array_4 = OpTypePointer Workgroup %array_4 +%ptr_wg_int = OpTypePointer Workgroup %int + +%array_17 = OpTypeArray %int %int_17 +%runtime_17 = OpTypeRuntimeArray %array_17 +%struct_17 = OpTypeStruct %runtime_17 +%ptr_struct_17 = OpTypePointer StorageBuffer %struct_17 +%ptr_array_17 = OpTypePointer StorageBuffer %array_17 +%ptr_int = OpTypePointer StorageBuffer %int + +%wg_var = OpVariable %ptr_array_array_4 Workgroup +%not_equal_var = OpVariable %ptr_struct_17 StorageBuffer +%lid_var = OpVariable %ptr_input_int3 Input +%gid_var = OpVariable %ptr_input_int3 Input + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%gid_y = OpCompositeExtract %int %gid 1 +%lid = OpLoad %int3 %lid_var +%lid_x = OpCompositeExtract %int %lid 0 +%lid_y = OpCompositeExtract %int %lid 1 +%array_gep_0 = OpAccessChain %ptr_array_4 %wg_var %int_0 +%array_gep = OpAccessChain %ptr_array_4 %wg_var %lid_x +%lid_y_is_1 = OpIEqual %bool %lid_y %int_1 +OpSelectionMerge %loop None +OpBranchConditional %lid_y_is_1 %then %loop + +%then = OpLabel +; Compute results for outer array +%large_not_equal = OpPtrNotEqual %bool %array_gep %array_gep_0 +%large_not_equal_gep = OpAccessChain %ptr_int %not_equal_var %int_0 %gid_x %int_16 +%large_not_equal_int = OpSelect %int %large_not_equal %int_1 %int_0 +OpStore %large_not_equal_gep %large_not_equal_int +; +OpBranch %loop + +%loop = OpLabel +%i = OpPhi %int %int_0 %entry %int_0 %then %inc_i %loop +%inc_i = OpIAdd %int %i %int_1 +%i_cmp = OpIEqual %bool %inc_i %int_4 +%lid_offset = OpIMul %int %lid_y %int_4 +%out_gep_index = OpIAdd %int %i %lid_offset +; Compute results for inner array +%ref_gep = OpAccessChain %ptr_wg_int %array_gep %lid_y +%cmp_gep = OpAccessChain %ptr_wg_int %array_gep %i +%not_equal = OpPtrNotEqual %bool %ref_gep %cmp_gep +%not_equal_int = OpSelect %int %not_equal %int_1 %int_0 +%not_equal_gep = OpAccessChain %ptr_int %not_equal_var %int_0 %gid_x %out_gep_index +OpStore %not_equal_gep %not_equal_int +; +OpLoopMerge %exit %loop None +OpBranchConditional %i_cmp %exit %loop + +%exit = OpLabel +OpReturn +OpFunctionEnd + + +[test] +# 16 x 4 x 2 = 128 work items +# 4 x 4 = 16 bytes per invocation +# 2048 bytes from looping +# 16 x 2 = 32 coarse results (1 per lid) +# 128 bytes +# 2176 total bytes +ssbo 0:0 2176 + +compute entrypoint main +compute 2 1 1 + +#not equal var +probe ssbo int 0:0 0 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 0 +probe ssbo int 0:0 68 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 136 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 204 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 272 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 340 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 408 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 476 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 544 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 612 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 680 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 748 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 816 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 884 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 952 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1020 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1088 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 0 +probe ssbo int 0:0 1156 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1224 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1292 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1360 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1428 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1496 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1564 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1632 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1700 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1768 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1836 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1904 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 1972 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 2040 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 +probe ssbo int 0:0 2108 == 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/array_select.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/array_select.amber new file mode 100644 index 0000000..f8ae803 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/array_select.amber @@ -0,0 +1,66 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %gid_var BuiltIn GlobalInvocationId +OpDecorate %int_array ArrayStride 4 +OpDecorate %rta ArrayStride 4 +OpDecorate %rta_array ArrayStride 16 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_4 = OpConstant %int 4 +%int3 = OpTypeVector %int 3 +%int_array = OpTypeArray %int %int_4 +%const_array1 = OpConstantComposite %int_array %int_0 %int_1 %int_2 %int_3 +%const_array2 = OpConstantComposite %int_array %int_3 %int_2 %int_1 %int_0 +%rta_array = OpTypeRuntimeArray %int_array +%out_struct = OpTypeStruct %rta_array +%rta = OpTypeRuntimeArray %int +%struct = OpTypeStruct %rta +%ptr_input_int3 = OpTypePointer Input %int3 +%gid_var = OpVariable %ptr_input_int3 Input +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%ptr_ssbo_array = OpTypePointer StorageBuffer %int_array +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%in_var = OpVariable %ptr_ssbo_struct StorageBuffer +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%in_gep = OpAccessChain %ptr_ssbo_int %in_var %int_0 %gid_x +%ld = OpLoad %int %in_gep +%eq_0 = OpIEqual %bool %ld %int_0 +%select = OpSelect %int_array %eq_0 %const_array1 %const_array2 +%out_gep = OpAccessChain %ptr_ssbo_array %out_var %int_0 %gid_x +OpStore %out_gep %select +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 0 1 1 0 +ssbo 0:1 64 + +compute entrypoint main +compute 4 1 1 + +probe ssbo uint 0:1 0 == 0 1 2 3 3 2 1 0 3 2 1 0 0 1 2 3 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/array_stride_select.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/array_stride_select.amber new file mode 100644 index 0000000..194902a --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/array_stride_select.amber @@ -0,0 +1,74 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %gid_var BuiltIn GlobalInvocationId +OpDecorate %int_array ArrayStride 8 +OpDecorate %rta ArrayStride 4 +OpDecorate %rta_array ArrayStride 32 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %out_struct Block +OpMemberDecorate %out_struct 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_4 = OpConstant %int 4 +%int3 = OpTypeVector %int 3 +%int_array = OpTypeArray %int %int_4 +%const_array1 = OpConstantComposite %int_array %int_0 %int_1 %int_2 %int_3 +%const_array2 = OpConstantComposite %int_array %int_3 %int_2 %int_1 %int_0 +%rta_array = OpTypeRuntimeArray %int_array +%out_struct = OpTypeStruct %rta_array +%rta = OpTypeRuntimeArray %int +%struct = OpTypeStruct %rta +%ptr_input_int3 = OpTypePointer Input %int3 +%gid_var = OpVariable %ptr_input_int3 Input +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct +%ptr_ssbo_array = OpTypePointer StorageBuffer %int_array +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%in_var = OpVariable %ptr_ssbo_struct StorageBuffer +%out_var = OpVariable %ptr_ssbo_out_struct StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%in_gep = OpAccessChain %ptr_ssbo_int %in_var %int_0 %gid_x +%ld = OpLoad %int %in_gep +%eq_0 = OpIEqual %bool %ld %int_0 +%select = OpSelect %int_array %eq_0 %const_array1 %const_array2 +%out_gep = OpAccessChain %ptr_ssbo_array %out_var %int_0 %gid_x +OpStore %out_gep %select +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 0 1 +ssbo 0:1 64 + +compute entrypoint main +compute 2 1 1 + +probe ssbo uint 0:1 0 == 0 +probe ssbo uint 0:1 8 == 1 +probe ssbo uint 0:1 16 == 2 +probe ssbo uint 0:1 24 == 3 +probe ssbo uint 0:1 32 == 3 +probe ssbo uint 0:1 40 == 2 +probe ssbo uint 0:1 48 == 1 +probe ssbo uint 0:1 56 == 0 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/nested_array_select.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/nested_array_select.amber new file mode 100644 index 0000000..bf26973 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/nested_array_select.amber @@ -0,0 +1,75 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %sel_var %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %gid_var BuiltIn GlobalInvocationId +OpDecorate %inner ArrayStride 4 +OpMemberDecorate %outer 0 Offset 0 +OpMemberDecorate %outer 1 Offset 8 +OpDecorate %rta ArrayStride 4 +OpDecorate %rta_out ArrayStride 16 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +OpDecorate %out_block Block +OpMemberDecorate %out_block 0 Offset 0 +OpDecorate %sel_var DescriptorSet 0 +OpDecorate %sel_var Binding 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 1 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 2 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int3 = OpTypeVector %int 3 +%inner = OpTypeArray %int %int_2 +%outer = OpTypeStruct %inner %inner +%rta_out = OpTypeRuntimeArray %outer +%out_block = OpTypeStruct %rta_out +%rta = OpTypeRuntimeArray %int +%block = OpTypeStruct %rta +%ptr_input_int3 = OpTypePointer Input %int3 +%gid_var = OpVariable %ptr_input_int3 Input +%ptr_ssbo_block = OpTypePointer StorageBuffer %block +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%ptr_ssbo_out_block = OpTypePointer StorageBuffer %out_block +%ptr_ssbo_outer = OpTypePointer StorageBuffer %outer +%sel_var = OpVariable %ptr_ssbo_block StorageBuffer +%in_var = OpVariable %ptr_ssbo_out_block StorageBuffer +%out_var = OpVariable %ptr_ssbo_out_block StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%in_gep0 = OpAccessChain %ptr_ssbo_outer %in_var %int_0 %int_0 +%in0 = OpLoad %outer %in_gep0 +%in_gep1 = OpAccessChain %ptr_ssbo_outer %in_var %int_0 %int_1 +%in1 = OpLoad %outer %in_gep1 +%sel_gep = OpAccessChain %ptr_ssbo_int %sel_var %int_0 %gid_x +%sel_val = OpLoad %int %sel_gep +%eq_0 = OpIEqual %bool %sel_val %int_0 +%select = OpSelect %outer %eq_0 %in0 %in1 +%out_gep = OpAccessChain %ptr_ssbo_outer %out_var %int_0 %gid_x +OpStore %out_gep %select +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 1 0 +ssbo 0:1 subdata uint 0 1 1 1 1 2 2 2 2 +ssbo 0:2 32 + +compute entrypoint main +compute 2 1 1 + +probe ssbo uint 0:2 0 == 2 2 2 2 +probe ssbo uint 0:2 16 == 1 1 1 1 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/nested_struct_select.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/nested_struct_select.amber new file mode 100644 index 0000000..23bcd8f --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/nested_struct_select.amber @@ -0,0 +1,74 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %sel_var %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %gid_var BuiltIn GlobalInvocationId +OpMemberDecorate %inner 0 Offset 0 +OpMemberDecorate %inner 1 Offset 4 +OpMemberDecorate %outer 0 Offset 0 +OpMemberDecorate %outer 1 Offset 8 +OpDecorate %rta ArrayStride 4 +OpDecorate %rta_out ArrayStride 16 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +OpDecorate %out_block Block +OpMemberDecorate %out_block 0 Offset 0 +OpDecorate %sel_var DescriptorSet 0 +OpDecorate %sel_var Binding 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 1 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 2 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int3 = OpTypeVector %int 3 +%inner = OpTypeStruct %int %int +%outer = OpTypeStruct %inner %inner +%rta_out = OpTypeRuntimeArray %outer +%out_block = OpTypeStruct %rta_out +%rta = OpTypeRuntimeArray %int +%block = OpTypeStruct %rta +%ptr_input_int3 = OpTypePointer Input %int3 +%gid_var = OpVariable %ptr_input_int3 Input +%ptr_ssbo_block = OpTypePointer StorageBuffer %block +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%ptr_ssbo_out_block = OpTypePointer StorageBuffer %out_block +%ptr_ssbo_outer = OpTypePointer StorageBuffer %outer +%sel_var = OpVariable %ptr_ssbo_block StorageBuffer +%in_var = OpVariable %ptr_ssbo_out_block StorageBuffer +%out_var = OpVariable %ptr_ssbo_out_block StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%in_gep0 = OpAccessChain %ptr_ssbo_outer %in_var %int_0 %int_0 +%in0 = OpLoad %outer %in_gep0 +%in_gep1 = OpAccessChain %ptr_ssbo_outer %in_var %int_0 %int_1 +%in1 = OpLoad %outer %in_gep1 +%sel_gep = OpAccessChain %ptr_ssbo_int %sel_var %int_0 %gid_x +%sel_val = OpLoad %int %sel_gep +%eq_0 = OpIEqual %bool %sel_val %int_0 +%select = OpSelect %outer %eq_0 %in0 %in1 +%out_gep = OpAccessChain %ptr_ssbo_outer %out_var %int_0 %gid_x +OpStore %out_gep %select +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 1 0 +ssbo 0:1 subdata uint 0 1 1 1 1 2 2 2 2 +ssbo 0:2 32 + +compute entrypoint main +compute 2 1 1 + +probe ssbo uint 0:2 0 == 2 2 2 2 +probe ssbo uint 0:2 16 == 1 1 1 1 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/scalar_select.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/scalar_select.amber new file mode 100644 index 0000000..860d080 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/scalar_select.amber @@ -0,0 +1,78 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; OpSelect among scalars. This is in SPIR-V 1.0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID %_ %__0 + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "data_SSBO" + OpName %__0 "" + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_int_0 ArrayStride 4 + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int +%output_buffer = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_2 = OpConstant %uint 2 +%_ptr_Input_uint = OpTypePointer Input %uint +%_runtimearr_int_0 = OpTypeRuntimeArray %int +%input_buffer = OpTypeStruct %_runtimearr_int_0 +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %__0 = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %19 = OpLoad %uint %18 + %24 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_StorageBuffer_int %__0 %int_0 %25 + %28 = OpLoad %int %27 + %30 = OpIEqual %bool %28 %int_0 + %33 = OpSelect %int %30 %int_1 %int_2 + %34 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 %19 + OpStore %34 %33 + OpReturn + OpFunctionEnd +[test] +ssbo 0:0 8 +ssbo 0:0 subdata int 0 0 1 +ssbo 0:1 8 +ssbo 0:1 subdata int 0 -1 -1 + +compute entrypoint main +compute 1 1 2 + +probe ssbo int 0:1 0 == 1 2 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/ssbo_pointers_2_select.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/ssbo_pointers_2_select.amber new file mode 100644 index 0000000..3502313 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/ssbo_pointers_2_select.amber @@ -0,0 +1,81 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %sel_var %in1_var %in2_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %gid_var BuiltIn GlobalInvocationId +OpMemberDecorate %inner 0 Offset 0 +OpMemberDecorate %inner 1 Offset 4 +OpMemberDecorate %outer 0 Offset 0 +OpMemberDecorate %outer 1 Offset 8 +OpDecorate %rta ArrayStride 4 +OpDecorate %rta_struct ArrayStride 16 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +OpDecorate %data_block Block +OpMemberDecorate %data_block 0 Offset 0 +OpDecorate %sel_var DescriptorSet 0 +OpDecorate %sel_var Binding 0 +OpDecorate %in1_var DescriptorSet 0 +OpDecorate %in1_var Binding 1 +OpDecorate %in2_var DescriptorSet 0 +OpDecorate %in2_var Binding 2 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 3 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int3 = OpTypeVector %int 3 +%inner = OpTypeStruct %int %int +%outer = OpTypeStruct %inner %inner +%rta_struct = OpTypeRuntimeArray %outer +%rta = OpTypeRuntimeArray %int +%data_block = OpTypeStruct %rta_struct +%block = OpTypeStruct %rta +%ptr_input_int3 = OpTypePointer Input %int3 +%gid_var = OpVariable %ptr_input_int3 Input +%ptr_ssbo_block = OpTypePointer StorageBuffer %block +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%ptr_ssbo_data_block = OpTypePointer StorageBuffer %data_block +%ptr_ssbo_outer = OpTypePointer StorageBuffer %outer +%sel_var = OpVariable %ptr_ssbo_block StorageBuffer +%in1_var = OpVariable %ptr_ssbo_data_block StorageBuffer +%in2_var = OpVariable %ptr_ssbo_data_block StorageBuffer +%out_var = OpVariable %ptr_ssbo_data_block StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%in_gep0 = OpAccessChain %ptr_ssbo_outer %in1_var %int_0 %int_0 +%in_gep1 = OpAccessChain %ptr_ssbo_outer %in2_var %int_0 %int_0 +%sel_gep = OpAccessChain %ptr_ssbo_int %sel_var %int_0 %gid_x +%sel_val = OpLoad %int %sel_gep +%eq_0 = OpIEqual %bool %sel_val %int_0 +%select = OpSelect %ptr_ssbo_outer %eq_0 %in_gep0 %in_gep1 +%out_gep = OpAccessChain %ptr_ssbo_outer %out_var %int_0 %gid_x +%ld = OpLoad %outer %select +OpStore %out_gep %ld +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 1 0 +ssbo 0:1 subdata uint 0 1 1 1 1 +ssbo 0:2 subdata uint 0 2 2 2 2 +ssbo 0:3 32 + +compute entrypoint main +compute 2 1 1 + +probe ssbo uint 0:3 0 == 2 2 2 2 +probe ssbo uint 0:3 16 == 1 1 1 1 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/ssbo_pointers_select.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/ssbo_pointers_select.amber new file mode 100644 index 0000000..25462e3 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/ssbo_pointers_select.amber @@ -0,0 +1,74 @@ +[require] +VK_KHR_spirv_1_4 +VariablePointerFeatures.variablePointersStorageBuffer + +[compute shader spirv] +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %sel_var %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %gid_var BuiltIn GlobalInvocationId +OpMemberDecorate %inner 0 Offset 0 +OpMemberDecorate %inner 1 Offset 4 +OpMemberDecorate %outer 0 Offset 0 +OpMemberDecorate %outer 1 Offset 8 +OpDecorate %rta ArrayStride 4 +OpDecorate %rta_struct ArrayStride 16 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +OpDecorate %data_block Block +OpMemberDecorate %data_block 0 Offset 0 +OpDecorate %sel_var DescriptorSet 0 +OpDecorate %sel_var Binding 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 1 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 2 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int3 = OpTypeVector %int 3 +%inner = OpTypeStruct %int %int +%outer = OpTypeStruct %inner %inner +%rta_struct = OpTypeRuntimeArray %outer +%rta = OpTypeRuntimeArray %int +%data_block = OpTypeStruct %rta_struct +%block = OpTypeStruct %rta +%ptr_input_int3 = OpTypePointer Input %int3 +%gid_var = OpVariable %ptr_input_int3 Input +%ptr_ssbo_block = OpTypePointer StorageBuffer %block +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%ptr_ssbo_data_block = OpTypePointer StorageBuffer %data_block +%ptr_ssbo_outer = OpTypePointer StorageBuffer %outer +%sel_var = OpVariable %ptr_ssbo_block StorageBuffer +%in_var = OpVariable %ptr_ssbo_data_block StorageBuffer +%out_var = OpVariable %ptr_ssbo_data_block StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%in_gep0 = OpAccessChain %ptr_ssbo_outer %in_var %int_0 %int_0 +%in_gep1 = OpAccessChain %ptr_ssbo_outer %in_var %int_0 %int_1 +%sel_gep = OpAccessChain %ptr_ssbo_int %sel_var %int_0 %gid_x +%sel_val = OpLoad %int %sel_gep +%eq_0 = OpIEqual %bool %sel_val %int_0 +%select = OpSelect %ptr_ssbo_outer %eq_0 %in_gep0 %in_gep1 +%out_gep = OpAccessChain %ptr_ssbo_outer %out_var %int_0 %gid_x +OpCopyMemory %out_gep %select +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 1 0 +ssbo 0:1 subdata uint 0 1 1 1 1 2 2 2 2 +ssbo 0:2 32 + +compute entrypoint main +compute 2 1 1 + +probe ssbo uint 0:2 0 == 2 2 2 2 +probe ssbo uint 0:2 16 == 1 1 1 1 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/struct_select.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/struct_select.amber new file mode 100644 index 0000000..1fdd8d6 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/struct_select.amber @@ -0,0 +1,129 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Test OpSelect with a scalar condition and composite result type. +; Generated from the following GLSL with minor modification. +; +;#version 430 +; +;struct S {int a; int b; int c;}; +; +;layout(std430, binding = 0) buffer input_buffer +;{ +; S data_SSBO[]; +;}; +; +;layout(std430, binding = 1) buffer output_buffer +;{ +; S out_SSBO[]; +;}; +; +;void main() { +; S one = { 1, 1, 1 }; +; S two = { 2, 2, 2 }; +; +; out_SSBO[gl_GlobalInvocationID.z] = (data_SSBO[gl_GlobalInvocationID.z].a == 0 ? one : two); +;} +; +; Applying the no signed wrap decoration + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID %_ %__0 + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %S "S" + OpMemberName %S 0 "a" + OpMemberName %S 1 "b" + OpMemberName %S 2 "c" + OpName %one "one" + OpName %two "two" + OpName %S_0 "S" + OpMemberName %S_0 0 "a" + OpMemberName %S_0 1 "b" + OpMemberName %S_0 2 "c" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "data_SSBO" + OpName %__0 "" + OpMemberDecorate %S_0 0 Offset 0 + OpMemberDecorate %S_0 1 Offset 4 + OpMemberDecorate %S_0 2 Offset 8 + OpDecorate %_runtimearr_S_0 ArrayStride 12 + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_S_0_0 ArrayStride 12 + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int %int %int +%_ptr_Function_S = OpTypePointer Function %S + %int_1 = OpConstant %int 1 + %11 = OpConstantComposite %S %int_1 %int_1 %int_1 + %int_2 = OpConstant %int 2 + %14 = OpConstantComposite %S %int_2 %int_2 %int_2 + %S_0 = OpTypeStruct %int %int %int +%_runtimearr_S_0 = OpTypeRuntimeArray %S_0 +%output_buffer = OpTypeStruct %_runtimearr_S_0 +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_2 = OpConstant %uint 2 +%_ptr_Input_uint = OpTypePointer Input %uint +%_runtimearr_S_0_0 = OpTypeRuntimeArray %S_0 +%input_buffer = OpTypeStruct %_runtimearr_S_0_0 +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %__0 = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %bool = OpTypeBool +%_ptr_StorageBuffer_S_0 = OpTypePointer StorageBuffer %S_0 +%one = OpConstantComposite %S %int_1 %int_1 %int_1 +%two = OpConstantComposite %S %int_2 %int_2 %int_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %27 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %28 = OpLoad %uint %27 + %36 = OpAccessChain %_ptr_StorageBuffer_int %__0 %int_0 %28 %int_0 + %37 = OpLoad %int %36 + %39 = OpIEqual %bool %37 %int_0 + %sel = OpSelect %S %39 %one %two + %48 = OpAccessChain %_ptr_StorageBuffer_S_0 %_ %int_0 %28 + %49 = OpCompositeExtract %int %sel 0 + %50 = OpAccessChain %_ptr_StorageBuffer_int %48 %int_0 + OpStore %50 %49 + %51 = OpCompositeExtract %int %sel 1 + %52 = OpAccessChain %_ptr_StorageBuffer_int %48 %int_1 + OpStore %52 %51 + %53 = OpCompositeExtract %int %sel 2 + %54 = OpAccessChain %_ptr_StorageBuffer_int %48 %int_2 + OpStore %54 %53 + OpReturn + OpFunctionEnd +[test] +ssbo 0:0 24 +ssbo 0:0 subdata int 0 0 0 0 1 1 1 +ssbo 0:1 8 +ssbo 0:1 subdata int 0 -1 -1 -1 -1 -1 -1 + +compute entrypoint main +compute 1 1 2 + +probe ssbo int 0:1 0 == 1 1 1 2 2 2 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/vector_element_select.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/vector_element_select.amber new file mode 100644 index 0000000..88d6724 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/vector_element_select.amber @@ -0,0 +1,64 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %sel_var %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %gid_var BuiltIn GlobalInvocationId +OpDecorate %rta ArrayStride 16 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +OpDecorate %sel_var DescriptorSet 0 +OpDecorate %sel_var Binding 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 1 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 2 +%void = OpTypeVoid +%bool = OpTypeBool +%bool4 = OpTypeVector %bool 4 +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int3 = OpTypeVector %int 3 +%int4 = OpTypeVector %int 4 +%int4_0 = OpConstantNull %int4 +%rta = OpTypeRuntimeArray %int4 +%block = OpTypeStruct %rta +%ptr_input_int3 = OpTypePointer Input %int3 +%gid_var = OpVariable %ptr_input_int3 Input +%ptr_ssbo_block = OpTypePointer StorageBuffer %block +%ptr_ssbo_int4 = OpTypePointer StorageBuffer %int4 +%sel_var = OpVariable %ptr_ssbo_block StorageBuffer +%in_var = OpVariable %ptr_ssbo_block StorageBuffer +%out_var = OpVariable %ptr_ssbo_block StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%in_gep0 = OpAccessChain %ptr_ssbo_int4 %in_var %int_0 %int_0 +%in0 = OpLoad %int4 %in_gep0 +%in_gep1 = OpAccessChain %ptr_ssbo_int4 %in_var %int_0 %int_1 +%in1 = OpLoad %int4 %in_gep1 +%sel_gep = OpAccessChain %ptr_ssbo_int4 %sel_var %int_0 %gid_x +%sel_ld = OpLoad %int4 %sel_gep +%eq_0 = OpIEqual %bool4 %sel_ld %int4_0 +%select = OpSelect %int4 %eq_0 %in0 %in1 +%out_gep = OpAccessChain %ptr_ssbo_int4 %out_var %int_0 %gid_x +OpStore %out_gep %select +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 0 1 0 1 1 0 1 0 +ssbo 0:1 subdata uint 0 1 1 1 1 2 2 2 2 +ssbo 0:2 32 + +compute entrypoint main +compute 2 1 1 + +probe ssbo uint 0:2 0 == 1 2 1 2 +probe ssbo uint 0:2 16 == 2 1 2 1 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/vector_select.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/vector_select.amber new file mode 100644 index 0000000..3702248 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/vector_select.amber @@ -0,0 +1,128 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Test OpSelect with a scalar condition and vector result type. +; Generated from the following GLSL with minor modification. +; +; #version 430 +; +; +; layout(std430, binding = 0) buffer input_buffer +; { +; vec4 data_SSBO[]; +; }; +; +; layout(std430, binding = 1) buffer output_buffer +; { +; vec4 out_SSBO[]; +; }; +; +; void main() { +; bool cond = data_SSBO[gl_GlobalInvocationID.z].x == 0.0; +; vec4 a = {1.0, 3.0, 5.0, 7.0}; +; vec4 b = {2.0, 4.0, 6.0, 8.0}; +; out_SSBO[gl_GlobalInvocationID.z] = (cond ? a : b); +; } + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID %_ %__0 + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %cond "cond" + OpName %input_buffer "input_buffer" + OpMemberName %input_buffer 0 "data_SSBO" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %a "a" + OpName %b "b" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %__0 "" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %input_buffer 0 Offset 0 + OpDecorate %input_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_v4float_0 ArrayStride 16 + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%input_buffer = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer + %_ = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_2 = OpConstant %uint 2 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %float_0 = OpConstant %float 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %float_3 = OpConstant %float 3 + %float_5 = OpConstant %float 5 + %float_7 = OpConstant %float 7 + %37 = OpConstantComposite %v4float %float_1 %float_3 %float_5 %float_7 + %float_2 = OpConstant %float 2 + %float_4 = OpConstant %float 4 + %float_6 = OpConstant %float 6 + %float_8 = OpConstant %float 8 + %43 = OpConstantComposite %v4float %float_2 %float_4 %float_6 %float_8 +%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float +%output_buffer = OpTypeStruct %_runtimearr_v4float_0 +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %__0 = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %v4bool = OpTypeVector %bool 4 +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %cond = OpVariable %_ptr_Function_bool Function + %a = OpVariable %_ptr_Function_v4float Function + %b = OpVariable %_ptr_Function_v4float Function + %23 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %24 = OpLoad %uint %23 + %27 = OpAccessChain %_ptr_StorageBuffer_float %_ %int_0 %24 %uint_0 + %28 = OpLoad %float %27 + %30 = OpFOrdEqual %bool %28 %float_0 + OpStore %cond %30 + OpStore %a %37 + OpStore %b %43 + %48 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %49 = OpLoad %uint %48 + %50 = OpLoad %bool %cond + %51 = OpLoad %v4float %a + %52 = OpLoad %v4float %b + %55 = OpSelect %v4float %50 %51 %52 + %57 = OpAccessChain %_ptr_StorageBuffer_v4float %__0 %int_0 %49 + OpStore %57 %55 + OpReturn + OpFunctionEnd +[test] +ssbo 0:0 24 +ssbo 0:0 subdata float 0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 +ssbo 0:1 8 +ssbo 0:1 subdata float 0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 + +compute entrypoint main +compute 1 1 2 + +probe ssbo float 0:1 0 == 1.0 3.0 5.0 7.0 2.0 4.0 6.0 8.0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/wg_pointers_2_select.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/wg_pointers_2_select.amber new file mode 100644 index 0000000..bf44984 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/wg_pointers_2_select.amber @@ -0,0 +1,85 @@ +[require] +VK_KHR_spirv_1_4 +VK_KHR_workgroup_memory_explicit_layout +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +OpCapability Shader +OpCapability VariablePointers +OpCapability WorkgroupMemoryExplicitLayoutKHR +OpExtension "SPV_KHR_workgroup_memory_explicit_layout" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %sel_var %wg1_var %wg2_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %gid_var BuiltIn GlobalInvocationId +OpMemberDecorate %inner 0 Offset 0 +OpMemberDecorate %inner 1 Offset 4 +OpMemberDecorate %outer 0 Offset 0 +OpMemberDecorate %outer 1 Offset 8 +OpDecorate %rta ArrayStride 4 +OpDecorate %rta_struct ArrayStride 16 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +OpDecorate %data_block Block +OpMemberDecorate %data_block 0 Offset 0 +OpDecorate %sel_var DescriptorSet 0 +OpDecorate %sel_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int3 = OpTypeVector %int 3 +%inner = OpTypeStruct %int %int +%outer = OpTypeStruct %inner %inner +%rta_struct = OpTypeRuntimeArray %outer +%rta = OpTypeRuntimeArray %int +%data_block = OpTypeStruct %rta_struct +%block = OpTypeStruct %rta +%ptr_input_int3 = OpTypePointer Input %int3 +%gid_var = OpVariable %ptr_input_int3 Input +%ptr_ssbo_block = OpTypePointer StorageBuffer %block +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%ptr_ssbo_data_block = OpTypePointer StorageBuffer %data_block +%ptr_ssbo_outer = OpTypePointer StorageBuffer %outer +%sel_var = OpVariable %ptr_ssbo_block StorageBuffer +%ptr_wg_outer = OpTypePointer Workgroup %outer +%wg1_var = OpVariable %ptr_wg_outer Workgroup +%wg2_var = OpVariable %ptr_wg_outer Workgroup +%out_var = OpVariable %ptr_ssbo_data_block StorageBuffer +%inner_const0 = OpConstantComposite %inner %int_1 %int_1 +%inner_const1 = OpConstantComposite %inner %int_2 %int_2 +%outer_const0 = OpConstantComposite %outer %inner_const0 %inner_const0 +%outer_const1 = OpConstantComposite %outer %inner_const1 %inner_const1 +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +OpStore %wg1_var %outer_const0 +OpStore %wg2_var %outer_const1 +%sel_gep = OpAccessChain %ptr_ssbo_int %sel_var %int_0 %gid_x +%sel_val = OpLoad %int %sel_gep +%eq_0 = OpIEqual %bool %sel_val %int_0 +%select = OpSelect %ptr_wg_outer %eq_0 %wg1_var %wg2_var +%out_gep = OpAccessChain %ptr_ssbo_outer %out_var %int_0 %gid_x +%ld = OpLoad %outer %select +OpStore %out_gep %ld +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 1 0 +ssbo 0:1 32 + +compute entrypoint main +compute 2 1 1 + +probe ssbo uint 0:1 0 == 2 2 2 2 +probe ssbo uint 0:1 16 == 1 1 1 1 + + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/wg_pointers_select.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/wg_pointers_select.amber new file mode 100644 index 0000000..2cd7bb6 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/opselect/wg_pointers_select.amber @@ -0,0 +1,87 @@ +[require] +VK_KHR_spirv_1_4 +VK_KHR_workgroup_memory_explicit_layout +VariablePointerFeatures.variablePointersStorageBuffer +VariablePointerFeatures.variablePointers + +[compute shader spirv] +OpCapability Shader +OpCapability VariablePointers +OpCapability WorkgroupMemoryExplicitLayoutKHR +OpExtension "SPV_KHR_workgroup_memory_explicit_layout" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %sel_var %wg_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %gid_var BuiltIn GlobalInvocationId +OpMemberDecorate %inner 0 Offset 0 +OpMemberDecorate %inner 1 Offset 4 +OpMemberDecorate %outer 0 Offset 0 +OpMemberDecorate %outer 1 Offset 8 +OpDecorate %rta ArrayStride 4 +OpDecorate %rta_struct ArrayStride 16 +OpDecorate %block Block +OpMemberDecorate %block 0 Offset 0 +OpDecorate %data_block Block +OpMemberDecorate %data_block 0 Offset 0 +OpDecorate %sel_var DescriptorSet 0 +OpDecorate %sel_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int3 = OpTypeVector %int 3 +%inner = OpTypeStruct %int %int +%outer = OpTypeStruct %inner %inner +%rta_struct = OpTypeRuntimeArray %outer +%rta = OpTypeRuntimeArray %int +%data_block = OpTypeStruct %rta_struct +%block = OpTypeStruct %rta +%ptr_input_int3 = OpTypePointer Input %int3 +%gid_var = OpVariable %ptr_input_int3 Input +%ptr_ssbo_block = OpTypePointer StorageBuffer %block +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%ptr_ssbo_data_block = OpTypePointer StorageBuffer %data_block +%ptr_ssbo_outer = OpTypePointer StorageBuffer %outer +%wg_data = OpTypeArray %outer %int_2 +%ptr_wg_data = OpTypePointer Workgroup %wg_data +%ptr_wg_outer = OpTypePointer Workgroup %outer +%sel_var = OpVariable %ptr_ssbo_block StorageBuffer +%wg_var = OpVariable %ptr_wg_data Workgroup +%out_var = OpVariable %ptr_ssbo_data_block StorageBuffer +%inner_const0 = OpConstantComposite %inner %int_1 %int_1 +%inner_const1 = OpConstantComposite %inner %int_2 %int_2 +%outer_const0 = OpConstantComposite %outer %inner_const0 %inner_const0 +%outer_const1 = OpConstantComposite %outer %inner_const1 %inner_const1 +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%wg_gep0 = OpAccessChain %ptr_wg_outer %wg_var %int_0 +%wg_gep1 = OpAccessChain %ptr_wg_outer %wg_var %int_1 +OpStore %wg_gep0 %outer_const0 +OpStore %wg_gep1 %outer_const1 +%sel_gep = OpAccessChain %ptr_ssbo_int %sel_var %int_0 %gid_x +%sel_val = OpLoad %int %sel_gep +%eq_0 = OpIEqual %bool %sel_val %int_0 +%select = OpSelect %ptr_wg_outer %eq_0 %wg_gep0 %wg_gep1 +%out_gep = OpAccessChain %ptr_ssbo_outer %out_var %int_0 %gid_x +%ld = OpLoad %outer %select +OpStore %out_gep %ld +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 1 0 +ssbo 0:1 32 + +compute entrypoint main +compute 2 1 1 + +probe ssbo uint 0:1 0 == 2 2 2 2 +probe ssbo uint 0:1 16 == 1 1 1 1 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_16.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_16.amber new file mode 100644 index 0000000..50f8000 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_16.amber @@ -0,0 +1,48 @@ +[require] +VK_KHR_spirv_1_4 +shaderInt16 + +[compute shader spirv] +; SpecConstantOp zero extend 16-bit 16 value to 32-bit. + OpCapability Shader + OpCapability Int16 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %_ "" + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint16 = OpTypeInt 16 0 + %uint = OpTypeInt 32 0 +%output_buffer = OpTypeStruct %uint +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %uint +%spec_const = OpSpecConstant %uint16 16 +%op_spec_const = OpSpecConstantOp %uint UConvert %spec_const + %main = OpFunction %void None %3 + %5 = OpLabel + %34 = OpAccessChain %_ptr_StorageBuffer_int %_ %uint_0 + OpStore %34 %op_spec_const + OpReturn + OpFunctionEnd +[test] +ssbo 0:1 8 +ssbo 0:1 subdata uint 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:1 0 == 16 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_16_64_bit.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_16_64_bit.amber new file mode 100644 index 0000000..a06fd41 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_16_64_bit.amber @@ -0,0 +1,47 @@ +[require] +VK_KHR_spirv_1_4 +shaderInt64 + +[compute shader spirv] +; SpecConstantOp zero extend 32-bit 16 value to 64-bit. + OpCapability Shader + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %_ "" + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint64 = OpTypeInt 64 0 +%output_buffer = OpTypeStruct %uint64 +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int64 = OpTypePointer StorageBuffer %uint64 +%spec_const = OpSpecConstant %uint 16 +%op_spec_const = OpSpecConstantOp %uint64 UConvert %spec_const + %main = OpFunction %void None %3 + %5 = OpLabel + %34 = OpAccessChain %_ptr_StorageBuffer_int64 %_ %uint_0 + OpStore %34 %op_spec_const + OpReturn + OpFunctionEnd +[test] +ssbo 0:1 subdata uint64_t 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint64_t 0:1 0 == 16 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_251658240_64_bits.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_251658240_64_bits.amber new file mode 100644 index 0000000..02dc888 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_251658240_64_bits.amber @@ -0,0 +1,47 @@ +[require] +VK_KHR_spirv_1_4 +shaderInt64 + +[compute shader spirv] +; SpecConstantOp zero extend 32-bit 0xF0000000 value (251,658,240) to 64-bit. + OpCapability Shader + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %_ "" + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint64 = OpTypeInt 64 0 +%output_buffer = OpTypeStruct %uint64 +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %uint_0 = OpConstant %uint64 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %uint64 +%spec_const = OpSpecConstant %uint 251658240 +%op_spec_const = OpSpecConstantOp %uint64 UConvert %spec_const + %main = OpFunction %void None %3 + %5 = OpLabel + %34 = OpAccessChain %_ptr_StorageBuffer_int %_ %uint_0 + OpStore %34 %op_spec_const + OpReturn + OpFunctionEnd +[test] +ssbo 0:1 subdata uint64_t 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint64_t 0:1 0 == 251658240 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_61440.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_61440.amber new file mode 100644 index 0000000..f4d360f --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_extend_61440.amber @@ -0,0 +1,48 @@ +[require] +VK_KHR_spirv_1_4 +shaderInt16 + +[compute shader spirv] +; SpecConstantOp zero extend 16-bit 0xF000 value (61,440) to 32-bit. + OpCapability Shader + OpCapability Int16 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %_ "" + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint16 = OpTypeInt 16 0 + %uint = OpTypeInt 32 0 +%output_buffer = OpTypeStruct %uint +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %uint +%spec_const = OpSpecConstant %uint16 61440 +%op_spec_const = OpSpecConstantOp %uint UConvert %spec_const + %main = OpFunction %void None %3 + %5 = OpLabel + %34 = OpAccessChain %_ptr_StorageBuffer_int %_ %uint_0 + OpStore %34 %op_spec_const + OpReturn + OpFunctionEnd +[test] +ssbo 0:1 8 +ssbo 0:1 subdata uint 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:1 0 == 61440 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_truncate_16.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_truncate_16.amber new file mode 100644 index 0000000..0df255d --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_truncate_16.amber @@ -0,0 +1,51 @@ +[require] +VK_KHR_spirv_1_4 +VK_KHR_16bit_storage +shaderInt16 +Storage16BitFeatures.storageBuffer16BitAccess + +[compute shader spirv] +; SpecConstantOp truncate 32-bit 16 value to 16-bit. + OpCapability Shader + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %_ "" + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint16 = OpTypeInt 16 0 + %uint = OpTypeInt 32 0 +%output_buffer = OpTypeStruct %uint16 +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint16 = OpTypePointer StorageBuffer %uint16 +%spec_const = OpSpecConstant %uint 16 +%op_spec_const = OpSpecConstantOp %uint16 UConvert %spec_const + %main = OpFunction %void None %3 + %5 = OpLabel + %34 = OpAccessChain %_ptr_StorageBuffer_uint16 %_ %uint_0 + OpStore %34 %op_spec_const + OpReturn + OpFunctionEnd +[test] +ssbo 0:1 4 +ssbo 0:1 subdata uint8_t 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint8_t 0:1 0 == 16 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_truncate_16_64_bit.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_truncate_16_64_bit.amber new file mode 100644 index 0000000..422af0a --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_truncate_16_64_bit.amber @@ -0,0 +1,47 @@ +[require] +VK_KHR_spirv_1_4 +shaderInt64 + +[compute shader spirv] +; SpecConstantOp truncate 64-bit 16 value to 32-bit. + OpCapability Shader + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %_ "" + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint64 = OpTypeInt 64 0 +%output_buffer = OpTypeStruct %uint +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %uint_0 = OpConstant %uint64 0 +%_ptr_StorageBuffer_uint16 = OpTypePointer StorageBuffer %uint +%spec_const = OpSpecConstant %uint64 16 +%op_spec_const = OpSpecConstantOp %uint UConvert %spec_const + %main = OpFunction %void None %3 + %5 = OpLabel + %34 = OpAccessChain %_ptr_StorageBuffer_uint16 %_ %uint_0 + OpStore %34 %op_spec_const + OpReturn + OpFunctionEnd +[test] +ssbo 0:1 subdata uint 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:1 0 == 16 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_truncate_983040.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_truncate_983040.amber new file mode 100644 index 0000000..7bdb249 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_truncate_983040.amber @@ -0,0 +1,50 @@ +[require] +VK_KHR_spirv_1_4 +VK_KHR_16bit_storage +shaderInt16 +Storage16BitFeatures.storageBuffer16BitAccess + +[compute shader spirv] +; SpecConstantOp truncate 32-bit 983,041 value to 16-bit. + OpCapability Shader + OpCapability Int16 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %_ "" + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint16 = OpTypeInt 16 0 + %uint = OpTypeInt 32 0 +%output_buffer = OpTypeStruct %uint16 +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint16 = OpTypePointer StorageBuffer %uint16 +%spec_const = OpSpecConstant %uint 983041 +%op_spec_const = OpSpecConstantOp %uint16 UConvert %spec_const + %main = OpFunction %void None %3 + %5 = OpLabel + %34 = OpAccessChain %_ptr_StorageBuffer_uint16 %_ %uint_0 + OpStore %34 %op_spec_const + OpReturn + OpFunctionEnd +[test] +ssbo 0:1 4 +ssbo 0:1 subdata uint8_t 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint8_t 0:1 0 == 1 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_zero_extend_n4096.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_zero_extend_n4096.amber new file mode 100644 index 0000000..37a9fa7 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uconvert/spec_const_opt_zero_extend_n4096.amber @@ -0,0 +1,50 @@ +[require] +VK_KHR_spirv_1_4 +shaderInt16 + +[compute shader spirv] +; SpecConstantOp zero extend signed 16-bit 0xF000 value (-4,096) to 32-bit. +; A value that is produced as a signed value is passed to UConvert, but it +; must still be interpreted as an unsigned value. + OpCapability Shader + OpCapability Int16 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %output_buffer "output_buffer" + OpMemberName %output_buffer 0 "out_SSBO" + OpName %_ "" + OpMemberDecorate %output_buffer 0 Offset 0 + OpDecorate %output_buffer Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int16 = OpTypeInt 16 1 + %uint = OpTypeInt 32 0 +%output_buffer = OpTypeStruct %uint +%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer + %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %uint +%spec_const = OpSpecConstant %int16 -4096 +%op_spec_const = OpSpecConstantOp %uint UConvert %spec_const + %main = OpFunction %void None %3 + %5 = OpLabel + %34 = OpAccessChain %_ptr_StorageBuffer_int %_ %uint_0 + OpStore %34 %op_spec_const + OpReturn + OpFunctionEnd +[test] +ssbo 0:1 8 +ssbo 0:1 subdata uint 0 0 0 + +compute entrypoint main +compute 1 1 1 + +probe ssbo uint 0:1 0 == 61440 0 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/partially_active_uniform_id.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/partially_active_uniform_id.amber new file mode 100644 index 0000000..746d7b0 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/partially_active_uniform_id.amber @@ -0,0 +1,72 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %in_var %out_var +OpExecutionMode %main LocalSize 8 1 1 + +OpDecorate %gid_var BuiltIn GlobalInvocationId + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorateId %then_ld UniformId %workgroup + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_2 = OpConstant %int 2 +%workgroup = OpConstant %int 2 +%int3 = OpTypeVector %int 3 + +%int_rta = OpTypeRuntimeArray %int +%struct = OpTypeStruct %int_rta +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%in_var = OpVariable %ptr_ssbo_struct StorageBuffer +%out_var = OpVariable %ptr_ssbo_struct StorageBuffer + +%ptr_input_int3 = OpTypePointer Input %int3 +%gid_var = OpVariable %ptr_input_int3 Input + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%in_gep = OpAccessChain %ptr_ssbo_int %in_var %int_0 %gid_x +%mod = OpUMod %int %gid_x %int_2 +%eq = OpIEqual %bool %mod %int_0 +OpSelectionMerge %merge None +OpBranchConditional %eq %then %else + +%then = OpLabel +%then_ld = OpLoad %int %in_gep +OpBranch %merge + +%else = OpLabel +%else_ld = OpLoad %int %in_gep +OpBranch %merge + +%merge = OpLabel +%phi = OpPhi %int %then_ld %then %else_ld %else +%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %gid_x +OpStore %out_gep %phi +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 +ssbo 0:1 64 +compute entrypoint main +compute 2 1 1 + +probe ssbo uint 0:1 0 == 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/subgroup_cfg_uniform_id.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/subgroup_cfg_uniform_id.amber new file mode 100644 index 0000000..f098854 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/subgroup_cfg_uniform_id.amber @@ -0,0 +1,75 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %in_var %out_var +OpExecutionMode %main LocalSize 8 1 1 + +OpDecorate %gid_var BuiltIn GlobalInvocationId + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorateId %cmp UniformId %subgroup + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%int_100 = OpConstant %int 100 +%int_50 = OpConstant %int 50 +%subgroup = OpConstant %int 3 +%int3 = OpTypeVector %int 3 + +%int_rta = OpTypeRuntimeArray %int +%struct = OpTypeStruct %int_rta +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%in_var = OpVariable %ptr_ssbo_struct StorageBuffer +%out_var = OpVariable %ptr_ssbo_struct StorageBuffer + +%ptr_input_int3 = OpTypePointer Input %int3 +%gid_var = OpVariable %ptr_input_int3 Input + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%in_gep = OpAccessChain %ptr_ssbo_int %in_var %int_0 %gid_x +%ld = OpLoad %int %in_gep +%cmp = OpULessThan %bool %ld %int_10 +OpSelectionMerge %merge None +OpBranchConditional %cmp %then %else + +%then = OpLabel +%then_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %gid_x +OpStore %then_gep %int_100 +OpBranch %merge + +%else = OpLabel +%else_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %gid_x +OpStore %else_gep %int_50 +OpBranch %merge + +%merge = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 +ssbo 0:1 64 + +compute entrypoint main +compute 2 1 1 + +probe ssbo uint 0:1 0 == 100 100 100 100 100 100 100 100 50 50 50 50 50 50 50 50 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/subgroup_uniform.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/subgroup_uniform.amber new file mode 100644 index 0000000..afcd287 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/subgroup_uniform.amber @@ -0,0 +1,66 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %in_var %out_var +OpExecutionMode %main LocalSize 8 1 1 + +OpDecorate %lid_var BuiltIn LocalInvocationId +OpDecorate %gid_var BuiltIn GlobalInvocationId + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorateId %in_ld UniformId %subgroup + +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%subgroup = OpConstant %int 3 +%int3 = OpTypeVector %int 3 + +%int_rta = OpTypeRuntimeArray %int +%struct = OpTypeStruct %int_rta +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%in_var = OpVariable %ptr_ssbo_struct StorageBuffer +%out_var = OpVariable %ptr_ssbo_struct StorageBuffer +%ptr_ssbo_int = OpTypePointer StorageBuffer %int + +%ptr_input_int3 = OpTypePointer Input %int3 +%lid_var = OpVariable %ptr_input_int3 Input +%gid_var = OpVariable %ptr_input_int3 Input + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%in_gep = OpAccessChain %ptr_ssbo_int %in_var %int_0 %gid_x +%in_ld = OpLoad %int %in_gep +%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %gid_x +OpStore %out_gep %in_ld +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 1 1 1 1 1 1 1 1 +ssbo 0:0 subdata uint 32 2 2 2 2 2 2 2 2 +ssbo 0:0 subdata uint 64 3 3 3 3 3 3 3 3 +ssbo 0:0 subdata uint 96 4 4 4 4 4 4 4 4 +ssbo 0:1 128 + +compute entrypoint main +compute 4 1 1 + +probe ssbo uint 0:1 0 == 1 1 1 1 1 1 1 1 +probe ssbo uint 0:1 32 == 2 2 2 2 2 2 2 2 +probe ssbo uint 0:1 64 == 3 3 3 3 3 3 3 3 +probe ssbo uint 0:1 96 == 4 4 4 4 4 4 4 4 + diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/workgroup_cfg_uniform_id.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/workgroup_cfg_uniform_id.amber new file mode 100644 index 0000000..f80aa0f --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/workgroup_cfg_uniform_id.amber @@ -0,0 +1,74 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %in_var %out_var +OpExecutionMode %main LocalSize 8 1 1 + +OpDecorate %gid_var BuiltIn GlobalInvocationId + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorateId %cmp UniformId %workgroup + +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%int_100 = OpConstant %int 100 +%int_50 = OpConstant %int 50 +%workgroup = OpConstant %int 2 +%int3 = OpTypeVector %int 3 + +%int_rta = OpTypeRuntimeArray %int +%struct = OpTypeStruct %int_rta +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%ptr_ssbo_int = OpTypePointer StorageBuffer %int +%in_var = OpVariable %ptr_ssbo_struct StorageBuffer +%out_var = OpVariable %ptr_ssbo_struct StorageBuffer + +%ptr_input_int3 = OpTypePointer Input %int3 +%gid_var = OpVariable %ptr_input_int3 Input + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%in_gep = OpAccessChain %ptr_ssbo_int %in_var %int_0 %gid_x +%ld = OpLoad %int %in_gep +%cmp = OpULessThan %bool %ld %int_10 +OpSelectionMerge %merge None +OpBranchConditional %cmp %then %else + +%then = OpLabel +%then_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %gid_x +OpStore %then_gep %int_100 +OpBranch %merge + +%else = OpLabel +%else_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %gid_x +OpStore %else_gep %int_50 +OpBranch %merge + +%merge = OpLabel +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 +ssbo 0:1 64 + +compute entrypoint main +compute 2 1 1 + +probe ssbo uint 0:1 0 == 100 100 100 100 100 100 100 100 50 50 50 50 50 50 50 50 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/workgroup_uniform.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/workgroup_uniform.amber new file mode 100644 index 0000000..551a15d --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/uniformid/workgroup_uniform.amber @@ -0,0 +1,65 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %gid_var %in_var %out_var +OpExecutionMode %main LocalSize 8 1 1 + +OpDecorate %lid_var BuiltIn LocalInvocationId +OpDecorate %gid_var BuiltIn GlobalInvocationId + +OpDecorate %int_rta ArrayStride 4 +OpDecorate %struct Block +OpMemberDecorate %struct 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 + +OpDecorateId %in_ld UniformId %workgroup + +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%workgroup = OpConstant %int 2 +%int3 = OpTypeVector %int 3 + +%int_rta = OpTypeRuntimeArray %int +%struct = OpTypeStruct %int_rta +%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct +%in_var = OpVariable %ptr_ssbo_struct StorageBuffer +%out_var = OpVariable %ptr_ssbo_struct StorageBuffer +%ptr_ssbo_int = OpTypePointer StorageBuffer %int + +%ptr_input_int3 = OpTypePointer Input %int3 +%lid_var = OpVariable %ptr_input_int3 Input +%gid_var = OpVariable %ptr_input_int3 Input + +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%gid = OpLoad %int3 %gid_var +%gid_x = OpCompositeExtract %int %gid 0 +%in_gep = OpAccessChain %ptr_ssbo_int %in_var %int_0 %gid_x +%in_ld = OpLoad %int %in_gep +%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %gid_x +OpStore %out_gep %in_ld +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 subdata uint 0 1 1 1 1 1 1 1 1 +ssbo 0:0 subdata uint 32 2 2 2 2 2 2 2 2 +ssbo 0:0 subdata uint 64 3 3 3 3 3 3 3 3 +ssbo 0:0 subdata uint 96 4 4 4 4 4 4 4 4 +ssbo 0:1 128 + +compute entrypoint main +compute 4 1 1 + +probe ssbo uint 0:1 0 == 1 1 1 1 1 1 1 1 +probe ssbo uint 0:1 32 == 2 2 2 2 2 2 2 2 +probe ssbo uint 0:1 64 == 3 3 3 3 3 3 3 3 +probe ssbo uint 0:1 96 == 4 4 4 4 4 4 4 4 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/wrap/no_signed_wrap.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/wrap/no_signed_wrap.amber new file mode 100644 index 0000000..6d29dfe --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/wrap/no_signed_wrap.amber @@ -0,0 +1,47 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Applying the no signed wrap decoration + +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %struct1 Block +OpMemberDecorate %struct1 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +OpDecorate %out_int NoSignedWrap +%void = OpTypeVoid +%int = OpTypeInt 32 1 +%int_10 = OpConstant %int 10 + +%struct1 = OpTypeStruct %int +%ptr_struct1 = OpTypePointer StorageBuffer %struct1 + +%in_var = OpVariable %ptr_struct1 StorageBuffer +%out_var = OpVariable %ptr_struct1 StorageBuffer + +%func_ty = OpTypeFunction %void +%main = OpFunction %void None %func_ty +%1 = OpLabel +%in_struct = OpLoad %struct1 %in_var +%in_int = OpCompositeExtract %int %in_struct 0 +%out_int = OpIAdd %int %in_int %int_10 +%out_struct = OpCompositeConstruct %struct1 %out_int +OpStore %out_var %out_struct +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 4 +ssbo 0:0 subdata int 0 0 +ssbo 0:1 4 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:1 0 == 10 diff --git a/vulkan/amber/spirv_assembly/instruction/spirv1p4/wrap/no_unsigned_wrap.amber b/vulkan/amber/spirv_assembly/instruction/spirv1p4/wrap/no_unsigned_wrap.amber new file mode 100644 index 0000000..7d34711 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/spirv1p4/wrap/no_unsigned_wrap.amber @@ -0,0 +1,47 @@ +[require] +VK_KHR_spirv_1_4 + +[compute shader spirv] +; Applying the no signed wrap decoration + +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %in_var %out_var +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %struct1 Block +OpMemberDecorate %struct1 0 Offset 0 +OpDecorate %in_var DescriptorSet 0 +OpDecorate %in_var Binding 0 +OpDecorate %out_var DescriptorSet 0 +OpDecorate %out_var Binding 1 +OpDecorate %out_int NoUnsignedWrap +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%int_10 = OpConstant %int 10 + +%struct1 = OpTypeStruct %int +%ptr_struct1 = OpTypePointer StorageBuffer %struct1 + +%in_var = OpVariable %ptr_struct1 StorageBuffer +%out_var = OpVariable %ptr_struct1 StorageBuffer + +%func_ty = OpTypeFunction %void +%main = OpFunction %void None %func_ty +%1 = OpLabel +%in_struct = OpLoad %struct1 %in_var +%in_int = OpCompositeExtract %int %in_struct 0 +%out_int = OpIAdd %int %in_int %int_10 +%out_struct = OpCompositeConstruct %struct1 %out_int +OpStore %out_var %out_struct +OpReturn +OpFunctionEnd + +[test] +ssbo 0:0 4 +ssbo 0:0 subdata int 0 0 +ssbo 0:1 4 + +compute entrypoint main +compute 1 1 1 + +probe ssbo int 0:1 0 == 10 diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_image_atomic.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_image_atomic.amber new file mode 100644 index 0000000..c56682b --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_image_atomic.amber @@ -0,0 +1,169 @@ +#!amber + +DEVICE_FEATURE fragmentStoresAndAtomics +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;#pragma GL_EXT_terminate_invocation : enable +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;layout(set = 0, binding = 0, r32i) uniform iimage2D im2d; +;void main() { +; out_data = 1; +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int combined = (x_coord & 0x1) + (y_coord & 0x1) + in_data; +; if (combined == int(gl_FragCoord.z)) +; terminateInvocation; +; +; imageAtomicAdd(im2d, ivec2(x_coord, y_coord), x_coord); +;} +OpCapability Shader +OpExtension "SPV_KHR_terminate_invocation" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +OpDecorate %im2d DescriptorSet 0 +OpDecorate %im2d Binding 0 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_8 = OpConstant %int 8 +%device = OpConstant %int 1 +%relaxed = OpConstant %int 0 +%int2 = OpTypeVector %int 2 +%int4 = OpTypeVector %int 4 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%image = OpTypeImage %int 2D 0 0 0 2 R32i +%ptr_image_uniform = OpTypePointer UniformConstant %image +%im2d = OpVariable %ptr_image_uniform UniformConstant +%ptr_int_image = OpTypePointer Image %int +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpStore %out_data %int_1 +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +%im_coord = OpCompositeConstruct %int2 %x %y +%im_ptr = OpImageTexelPointer %ptr_int_image %im2d %im_coord %int_0 +%old = OpAtomicIAdd %int %im_ptr %device %relaxed %x +OpReturn +OpFunctionEnd +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +IMAGE a_buf DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 + BIND BUFFER a_buf AS storage_image DESCRIPTOR_SET 0 BINDING 0 +END + +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT a_buf IDX 0 EQ 0 1 0 3 0 5 0 7 +EXPECT a_buf IDX 32 EQ 0 1 2 3 4 5 6 7 +EXPECT a_buf IDX 64 EQ 0 1 0 3 0 5 0 7 +EXPECT a_buf IDX 96 EQ 0 1 2 3 4 5 6 7 +EXPECT a_buf IDX 128 EQ 0 1 0 3 0 5 0 7 +EXPECT a_buf IDX 160 EQ 0 1 2 3 4 5 6 7 +EXPECT a_buf IDX 192 EQ 0 1 0 3 0 5 0 7 +EXPECT a_buf IDX 224 EQ 0 1 2 3 4 5 6 7 + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_image_store.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_image_store.amber new file mode 100644 index 0000000..4f589e0 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_image_store.amber @@ -0,0 +1,168 @@ +#!amber + +DEVICE_FEATURE fragmentStoresAndAtomics +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;#pragma GL_EXT_terminate_invocation : enable +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;layout(set = 0, binding = 0, r32i) uniform iimage2D im2d; +;void main() { +; out_data = 1; +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int combined = (x_coord & 0x1) + (y_coord & 0x1) + in_data; +; if (combined == int(gl_FragCoord.z)) +; terminateInvocation; +; +; ivec4 data = ivec4(x_coord, 0, 0, 0); +; imageStore(im2d, ivec2(x_coord, y_coord), data); +;} +OpCapability Shader +OpExtension "SPV_KHR_terminate_invocation" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +OpDecorate %im2d DescriptorSet 0 +OpDecorate %im2d Binding 0 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_8 = OpConstant %int 8 +%int2 = OpTypeVector %int 2 +%int4 = OpTypeVector %int 4 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%image = OpTypeImage %int 2D 0 0 0 2 R32i +%ptr_image_uniform = OpTypePointer UniformConstant %image +%im2d = OpVariable %ptr_image_uniform UniformConstant +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpStore %out_data %int_1 +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +%im_data = OpCompositeConstruct %int4 %x %int_0 %int_0 %int_0 +%im_coord = OpCompositeConstruct %int2 %x %y +%ld_im2d = OpLoad %image %im2d +OpImageWrite %ld_im2d %im_coord %im_data +OpReturn +OpFunctionEnd +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +IMAGE a_buf DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 + BIND BUFFER a_buf AS storage_image DESCRIPTOR_SET 0 BINDING 0 +END + +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT a_buf IDX 0 EQ 0 1 0 3 0 5 0 7 +EXPECT a_buf IDX 32 EQ 0 1 2 3 4 5 6 7 +EXPECT a_buf IDX 64 EQ 0 1 0 3 0 5 0 7 +EXPECT a_buf IDX 96 EQ 0 1 2 3 4 5 6 7 +EXPECT a_buf IDX 128 EQ 0 1 0 3 0 5 0 7 +EXPECT a_buf IDX 160 EQ 0 1 2 3 4 5 6 7 +EXPECT a_buf IDX 192 EQ 0 1 0 3 0 5 0 7 +EXPECT a_buf IDX 224 EQ 0 1 2 3 4 5 6 7 + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_null_pointer_load.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_null_pointer_load.amber new file mode 100644 index 0000000..abd7be9 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_null_pointer_load.amber @@ -0,0 +1,189 @@ +#!amber + +DEVICE_FEATURE fragmentStoresAndAtomics +DEVICE_FEATURE VariablePointerFeatures.variablePointersStorageBuffer +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;#pragma GL_EXT_terminate_invocation : enable +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;layout(set = 0, binding = 0) buffer A { uint a[]; } a; +;layout(set = 0, binding = 1) buffer B { uint b[]; } b; +;void main() { +; out_data = 1; +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int combined = (x_coord & 0x1) + (y_coord & 0x1) + in_data; +; int* b_ptr = &b.b[x_coord + 8 * y_coord]; +; if (combined == int(gl_FragCoord.z)) { +; b_ptr = nullptr; +; terminateInvocation; +; } +; +; a.a[x_coord + 8 * y_coord] = *b_ptr;; +;} +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpExtension "SPV_KHR_terminate_invocation" +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +OpDecorate %a DescriptorSet 0 +OpDecorate %a Binding 0 +OpDecorate %b DescriptorSet 0 +OpDecorate %b Binding 1 +OpDecorate %a_block Block +OpMemberDecorate %a_block 0 Offset 0 +OpDecorate %rta ArrayStride 4 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_8 = OpConstant %int 8 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%rta = OpTypeRuntimeArray %int +%a_block = OpTypeStruct %rta +%ptr_int_ssbo = OpTypePointer StorageBuffer %int +%ptr_a_ssbo = OpTypePointer StorageBuffer %a_block +%a = OpVariable %ptr_a_ssbo StorageBuffer +%b = OpVariable %ptr_a_ssbo StorageBuffer +%nullptr = OpConstantNull %ptr_int_ssbo +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpStore %out_data %int_1 +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +%offset = OpIMul %int %y %int_8 +%idx = OpIAdd %int %x %offset +%b_ptr = OpAccessChain %ptr_int_ssbo %b %int_0 %idx +%b_sel = OpSelect %ptr_int_ssbo %cmp %nullptr %b_ptr +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +%a_gep = OpAccessChain %ptr_int_ssbo %a %int_0 %idx +OpCopyMemory %a_gep %b_sel +OpReturn +OpFunctionEnd +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +BUFFER a_buf DATA_TYPE int32 SIZE 64 FILL 0 +BUFFER b_buf DATA_TYPE int32 SIZE 64 SERIES_FROM 0 INC_BY 1 +BUFFER expect_buf DATA_TYPE int32 DATA + 0 1 0 3 0 5 0 7 + 8 9 10 11 12 13 14 15 + 0 17 0 19 0 21 0 23 +24 25 26 27 28 29 30 31 + 0 33 0 35 0 37 0 39 +40 41 42 43 44 45 46 47 + 0 49 0 51 0 53 0 55 +56 57 58 59 60 61 62 63 +END + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 + BIND BUFFER a_buf AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b_buf AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT a_buf EQ_BUFFER expect_buf + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_null_pointer_store.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_null_pointer_store.amber new file mode 100644 index 0000000..9c766d8 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_null_pointer_store.amber @@ -0,0 +1,189 @@ +#!amber + +DEVICE_FEATURE fragmentStoresAndAtomics +DEVICE_FEATURE VariablePointerFeatures.variablePointersStorageBuffer +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;#pragma GL_EXT_terminate_invocation : enable +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;layout(set = 0, binding = 0) buffer A { uint a[]; } a; +;layout(set = 0, binding = 1) buffer B { uint b[]; } b; +;void main() { +; out_data = 1; +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int combined = (x_coord & 0x1) + (y_coord & 0x1) + in_data; +; int* a_ptr = &a.a[x_coord + 8 * y_coord]; +; if (combined == int(gl_FragCoord.z)) { +; a_ptr = nullptr; +; terminateInvocation; +; } +; +; *a_ptr = b.b[x_coord + 8 * y_coord]; +;} +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpExtension "SPV_KHR_terminate_invocation" +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +OpDecorate %a DescriptorSet 0 +OpDecorate %a Binding 0 +OpDecorate %b DescriptorSet 0 +OpDecorate %b Binding 1 +OpDecorate %a_block Block +OpMemberDecorate %a_block 0 Offset 0 +OpDecorate %rta ArrayStride 4 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_8 = OpConstant %int 8 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%rta = OpTypeRuntimeArray %int +%a_block = OpTypeStruct %rta +%ptr_int_ssbo = OpTypePointer StorageBuffer %int +%ptr_a_ssbo = OpTypePointer StorageBuffer %a_block +%a = OpVariable %ptr_a_ssbo StorageBuffer +%b = OpVariable %ptr_a_ssbo StorageBuffer +%nullptr = OpConstantNull %ptr_int_ssbo +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpStore %out_data %int_1 +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +%offset = OpIMul %int %y %int_8 +%idx = OpIAdd %int %x %offset +%b_ptr = OpAccessChain %ptr_int_ssbo %b %int_0 %idx +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +%a_gep = OpAccessChain %ptr_int_ssbo %a %int_0 %idx +%a_sel = OpSelect %ptr_int_ssbo %cmp %nullptr %a_gep +OpCopyMemory %a_sel %b_ptr +OpReturn +OpFunctionEnd +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +BUFFER a_buf DATA_TYPE int32 SIZE 64 FILL 0 +BUFFER b_buf DATA_TYPE int32 SIZE 64 SERIES_FROM 0 INC_BY 1 +BUFFER expect_buf DATA_TYPE int32 DATA + 0 1 0 3 0 5 0 7 + 8 9 10 11 12 13 14 15 + 0 17 0 19 0 21 0 23 +24 25 26 27 28 29 30 31 + 0 33 0 35 0 37 0 39 +40 41 42 43 44 45 46 47 + 0 49 0 51 0 53 0 55 +56 57 58 59 60 61 62 63 +END + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 + BIND BUFFER a_buf AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b_buf AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT a_buf EQ_BUFFER expect_buf + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_out_of_bounds_atomic.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_out_of_bounds_atomic.amber new file mode 100644 index 0000000..17e5d5f --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_out_of_bounds_atomic.amber @@ -0,0 +1,198 @@ +#!amber + +DEVICE_FEATURE fragmentStoresAndAtomics +DEVICE_FEATURE VariablePointerFeatures.variablePointersStorageBuffer +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;#pragma GL_EXT_terminate_invocation : enable +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;layout(set = 0, binding = 0) buffer A { uint a[]; } a; +;layout(set = 0, binding = 1) buffer B { uint b[]; } b; +;void main() { +; out_data = 1; +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int add = (x_coord & 0x1) + (y_coord & 0x1); +; int combined = add + in_data; +; if (combined == int(gl_FragCoord.z)) { +; terminateInvocation; +; } +; +; int* a_ptr = (add == 0) ? &a.a[0] + a.a.length() : &a.a[x_coord + 8 * y_coord]; +; atomicAdd(*a_ptr, b.b[x_coord + 8 * y_coord]); +;} +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpExtension "SPV_KHR_terminate_invocation" +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +OpDecorate %a DescriptorSet 0 +OpDecorate %a Binding 0 +OpDecorate %b DescriptorSet 0 +OpDecorate %b Binding 1 +OpDecorate %a_block Block +OpMemberDecorate %a_block 0 Offset 0 +OpDecorate %rta ArrayStride 4 +OpDecorate %ptr_int_ssbo ArrayStride 4 +%void = OpTypeVoid +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_8 = OpConstant %int 8 +%device = OpConstant %int 1 +%relaxed = OpConstant %int 0 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%rta = OpTypeRuntimeArray %int +%a_block = OpTypeStruct %rta +%ptr_int_ssbo = OpTypePointer StorageBuffer %int +%ptr_a_ssbo = OpTypePointer StorageBuffer %a_block +%a = OpVariable %ptr_a_ssbo StorageBuffer +%b = OpVariable %ptr_a_ssbo StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpStore %out_data %int_1 +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +%offset = OpIMul %int %y %int_8 +%idx = OpIAdd %int %x %offset +%b_ptr = OpAccessChain %ptr_int_ssbo %b %int_0 %idx +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +%a_gep = OpAccessChain %ptr_int_ssbo %a %int_0 %idx +%a_len = OpArrayLength %uint %a 0 +%a_0_gep = OpAccessChain %ptr_int_ssbo %a %int_0 %int_0 +%oob_ptr = OpPtrAccessChain %ptr_int_ssbo %a_0_gep %a_len +%cmp2 = OpIEqual %bool %add %int_0 +%a_sel = OpSelect %ptr_int_ssbo %cmp2 %oob_ptr %a_gep +%b_val = OpLoad %int %b_ptr +%old = OpAtomicIAdd %int %a_sel %device %relaxed %b_val +OpReturn +OpFunctionEnd +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +BUFFER a_buf DATA_TYPE int32 SIZE 64 FILL 0 +BUFFER b_buf DATA_TYPE int32 SIZE 64 SERIES_FROM 0 INC_BY 1 +BUFFER expect_buf DATA_TYPE int32 DATA + 0 1 0 3 0 5 0 7 + 8 9 10 11 12 13 14 15 + 0 17 0 19 0 21 0 23 +24 25 26 27 28 29 30 31 + 0 33 0 35 0 37 0 39 +40 41 42 43 44 45 46 47 + 0 49 0 51 0 53 0 55 +56 57 58 59 60 61 62 63 +END + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 + BIND BUFFER a_buf AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b_buf AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT a_buf EQ_BUFFER expect_buf + + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_out_of_bounds_load.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_out_of_bounds_load.amber new file mode 100644 index 0000000..0b07487 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_out_of_bounds_load.amber @@ -0,0 +1,195 @@ +#!amber + +DEVICE_FEATURE fragmentStoresAndAtomics +DEVICE_FEATURE VariablePointerFeatures.variablePointersStorageBuffer +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;#pragma GL_EXT_terminate_invocation : enable +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;layout(set = 0, binding = 0) buffer A { uint a[]; } a; +;layout(set = 0, binding = 1) buffer B { uint b[]; } b; +;void main() { +; out_data = 1; +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int add = (x_coord & 0x1) + (y_coord & 0x1); +; int combined = add + in_data; +; if (combined == int(gl_FragCoord.z)) { +; terminateInvocation; +; } +; +; int* b_ptr = (add == 0) ? &b.b[0] + b.b.length() : &b.b[x_coord + 8 * y_coord]; +; a.a[x_coord + 8 * y_coord] = *b_ptr;; +;} +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpExtension "SPV_KHR_terminate_invocation" +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +OpDecorate %a DescriptorSet 0 +OpDecorate %a Binding 0 +OpDecorate %b DescriptorSet 0 +OpDecorate %b Binding 1 +OpDecorate %a_block Block +OpMemberDecorate %a_block 0 Offset 0 +OpDecorate %rta ArrayStride 4 +OpDecorate %ptr_int_ssbo ArrayStride 4 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%uint = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_8 = OpConstant %int 8 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%rta = OpTypeRuntimeArray %int +%a_block = OpTypeStruct %rta +%ptr_int_ssbo = OpTypePointer StorageBuffer %int +%ptr_a_ssbo = OpTypePointer StorageBuffer %a_block +%a = OpVariable %ptr_a_ssbo StorageBuffer +%b = OpVariable %ptr_a_ssbo StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpStore %out_data %int_1 +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +%offset = OpIMul %int %y %int_8 +%idx = OpIAdd %int %x %offset +%b_ptr = OpAccessChain %ptr_int_ssbo %b %int_0 %idx +%len = OpArrayLength %uint %b 0 +%b_0_ptr = OpAccessChain %ptr_int_ssbo %b %int_0 %int_0 +%oob_ptr = OpPtrAccessChain %ptr_int_ssbo %b_0_ptr %len +%cmp2 = OpIEqual %bool %add %int_0 +%b_sel = OpSelect %ptr_int_ssbo %cmp2 %oob_ptr %b_ptr +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +%a_gep = OpAccessChain %ptr_int_ssbo %a %int_0 %idx +OpCopyMemory %a_gep %b_sel +OpReturn +OpFunctionEnd +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +BUFFER a_buf DATA_TYPE int32 SIZE 64 FILL 0 +BUFFER b_buf DATA_TYPE int32 SIZE 64 SERIES_FROM 0 INC_BY 1 +BUFFER expect_buf DATA_TYPE int32 DATA + 0 1 0 3 0 5 0 7 + 8 9 10 11 12 13 14 15 + 0 17 0 19 0 21 0 23 +24 25 26 27 28 29 30 31 + 0 33 0 35 0 37 0 39 +40 41 42 43 44 45 46 47 + 0 49 0 51 0 53 0 55 +56 57 58 59 60 61 62 63 +END + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 + BIND BUFFER a_buf AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b_buf AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT a_buf EQ_BUFFER expect_buf + + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_out_of_bounds_store.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_out_of_bounds_store.amber new file mode 100644 index 0000000..f3bdcc2 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_out_of_bounds_store.amber @@ -0,0 +1,194 @@ +#!amber + +DEVICE_FEATURE fragmentStoresAndAtomics +DEVICE_FEATURE VariablePointerFeatures.variablePointersStorageBuffer +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;#pragma GL_EXT_terminate_invocation : enable +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;layout(set = 0, binding = 0) buffer A { uint a[]; } a; +;layout(set = 0, binding = 1) buffer B { uint b[]; } b; +;void main() { +; out_data = 1; +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int add = (x_coord & 0x1) + (y_coord & 0x1); +; int combined = add + in_data; +; if (combined == int(gl_FragCoord.z)) { +; terminateInvocation; +; } +; +; int* a_ptr = (add == 0) ? &a.a[0] + a.a.length() : &a.a[x_coord + 8 * y_coord]; +; *a_ptr = b.b[x_coord + 8 * y_coord]; +;} +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpExtension "SPV_KHR_terminate_invocation" +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +OpDecorate %a DescriptorSet 0 +OpDecorate %a Binding 0 +OpDecorate %b DescriptorSet 0 +OpDecorate %b Binding 1 +OpDecorate %a_block Block +OpMemberDecorate %a_block 0 Offset 0 +OpDecorate %rta ArrayStride 4 +OpDecorate %ptr_int_ssbo ArrayStride 4 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%uint = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_8 = OpConstant %int 8 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%rta = OpTypeRuntimeArray %int +%a_block = OpTypeStruct %rta +%ptr_int_ssbo = OpTypePointer StorageBuffer %int +%ptr_a_ssbo = OpTypePointer StorageBuffer %a_block +%a = OpVariable %ptr_a_ssbo StorageBuffer +%b = OpVariable %ptr_a_ssbo StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpStore %out_data %int_1 +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +%offset = OpIMul %int %y %int_8 +%idx = OpIAdd %int %x %offset +%b_ptr = OpAccessChain %ptr_int_ssbo %b %int_0 %idx +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +%a_gep = OpAccessChain %ptr_int_ssbo %a %int_0 %idx +%a_len = OpArrayLength %uint %a 0 +%a_0_gep = OpAccessChain %ptr_int_ssbo %a %int_0 %int_0 +%oob_ptr = OpPtrAccessChain %ptr_int_ssbo %a_0_gep %a_len +%cmp2 = OpIEqual %bool %add %int_0 +%a_sel = OpSelect %ptr_int_ssbo %cmp2 %oob_ptr %a_gep +OpCopyMemory %a_sel %b_ptr +OpReturn +OpFunctionEnd +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +BUFFER a_buf DATA_TYPE int32 SIZE 64 FILL 0 +BUFFER b_buf DATA_TYPE int32 SIZE 64 SERIES_FROM 0 INC_BY 1 +BUFFER expect_buf DATA_TYPE int32 DATA + 0 1 0 3 0 5 0 7 + 8 9 10 11 12 13 14 15 + 0 17 0 19 0 21 0 23 +24 25 26 27 28 29 30 31 + 0 33 0 35 0 37 0 39 +40 41 42 43 44 45 46 47 + 0 49 0 51 0 53 0 55 +56 57 58 59 60 61 62 63 +END + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 + BIND BUFFER a_buf AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b_buf AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT a_buf EQ_BUFFER expect_buf + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_output_write.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_output_write.amber new file mode 100644 index 0000000..55691a0 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_output_write.amber @@ -0,0 +1,163 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;void main() { +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int combined = (x_coord & 0x1) + (y_coord & 0x1) + in_data; +; if (combined == int(gl_FragCoord.z)) +; terminateInvocation; +; +; out_data = 1; +;} +OpCapability Shader +OpExtension "SPV_KHR_terminate_invocation" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +OpStore %out_data %int_1 +OpReturn +OpFunctionEnd +END + +SHADER vertex passthrough PASSTHROUGH +SHADER fragment expect_fs GLSL +#version 450 + +layout(location = 0) out int out_data; +void main() { + bool x_is_odd = (int(gl_FragCoord.x) & 0x1) == 1; + bool y_is_odd = (int(gl_FragCoord.y) & 0x1) == 1; + out_data = (x_is_odd || y_is_odd) ? 1 : 0; +} +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +IMAGE expect_frame DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 +END + +PIPELINE graphics expect_pipe + ATTACH passthrough + ATTACH expect_fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + BIND BUFFER expect_frame AS color LOCATION 0 +END + +RUN expect_pipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT out_data EQ_BUFFER expect_frame + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate.amber new file mode 100644 index 0000000..b73ceed --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate.amber @@ -0,0 +1,162 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;void main() { +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int combined = (x_coord & 0x1) + (y_coord & 0x1) + in_data; +; out_data = 1; +; if (combined == int(gl_FragCoord.z)) +; terminateInvocation; +;} +OpCapability Shader +OpExtension "SPV_KHR_terminate_invocation" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +OpStore %out_data %int_1 +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +OpReturn +OpFunctionEnd +END + +SHADER vertex passthrough PASSTHROUGH +SHADER fragment expect_fs GLSL +#version 450 + +layout(location = 0) out int out_data; +void main() { + bool x_is_odd = (int(gl_FragCoord.x) & 0x1) == 1; + bool y_is_odd = (int(gl_FragCoord.y) & 0x1) == 1; + out_data = (x_is_odd || y_is_odd) ? 1 : 0; +} +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +IMAGE expect_frame DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 +END + +PIPELINE graphics expect_pipe + ATTACH passthrough + ATTACH expect_fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + BIND BUFFER expect_frame AS color LOCATION 0 +END + +RUN expect_pipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT out_data EQ_BUFFER expect_frame + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_ssbo_atomic.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_ssbo_atomic.amber new file mode 100644 index 0000000..64f835c --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_ssbo_atomic.amber @@ -0,0 +1,176 @@ +#!amber + +DEVICE_FEATURE fragmentStoresAndAtomics +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;#pragma GL_EXT_terminate_invocation : enable +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;layout(set = 0, binding = 0) buffer A { uint a[]; } a; +;void main() { +; out_data = 1; +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int combined = (x_coord & 0x1) + (y_coord & 0x1) + in_data; +; if (combined == int(gl_FragCoord.z)) +; terminateInvocation; +; +; atomicAdd(a.a[x_coord + 8 * y_coord], x_coord); +;} +OpCapability Shader +OpExtension "SPV_KHR_terminate_invocation" +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +OpDecorate %a DescriptorSet 0 +OpDecorate %a Binding 0 +OpDecorate %a_block Block +OpMemberDecorate %a_block 0 Offset 0 +OpDecorate %rta ArrayStride 4 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_8 = OpConstant %int 8 +%device = OpConstant %int 1 +%relaxed = OpConstant %int 0 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%rta = OpTypeRuntimeArray %int +%a_block = OpTypeStruct %rta +%ptr_int_ssbo = OpTypePointer StorageBuffer %int +%ptr_a_ssbo = OpTypePointer StorageBuffer %a_block +%a = OpVariable %ptr_a_ssbo StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpStore %out_data %int_1 +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +%offset = OpIMul %int %y %int_8 +%idx = OpIAdd %int %x %offset +%a_gep = OpAccessChain %ptr_int_ssbo %a %int_0 %idx +%old = OpAtomicIAdd %int %a_gep %device %relaxed %x +OpReturn +OpFunctionEnd +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +BUFFER a_buf DATA_TYPE int32 SIZE 64 FILL 0 +BUFFER expect_buf DATA_TYPE int32 DATA +0 1 0 3 0 5 0 7 +0 1 2 3 4 5 6 7 +0 1 0 3 0 5 0 7 +0 1 2 3 4 5 6 7 +0 1 0 3 0 5 0 7 +0 1 2 3 4 5 6 7 +0 1 0 3 0 5 0 7 +0 1 2 3 4 5 6 7 +END + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 + BIND BUFFER a_buf AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT a_buf EQ_BUFFER expect_buf + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_ssbo_store.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_ssbo_store.amber new file mode 100644 index 0000000..f9c760f --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/no_ssbo_store.amber @@ -0,0 +1,174 @@ +#!amber + +DEVICE_FEATURE fragmentStoresAndAtomics +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;#pragma GL_EXT_terminate_invocation : enable +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;layout(set = 0, binding = 0) buffer A { uint a[]; } a; +;void main() { +; out_data = 1; +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int combined = (x_coord & 0x1) + (y_coord & 0x1) + in_data; +; if (combined == int(gl_FragCoord.z)) +; terminateInvocation; +; +; a.a[x_coord + 8 * y_coord] = x_coord; +;} +OpCapability Shader +OpExtension "SPV_KHR_terminate_invocation" +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +OpDecorate %a DescriptorSet 0 +OpDecorate %a Binding 0 +OpDecorate %a_block Block +OpMemberDecorate %a_block 0 Offset 0 +OpDecorate %rta ArrayStride 4 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_8 = OpConstant %int 8 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%rta = OpTypeRuntimeArray %int +%a_block = OpTypeStruct %rta +%ptr_int_ssbo = OpTypePointer StorageBuffer %int +%ptr_a_ssbo = OpTypePointer StorageBuffer %a_block +%a = OpVariable %ptr_a_ssbo StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpStore %out_data %int_1 +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +%offset = OpIMul %int %y %int_8 +%idx = OpIAdd %int %x %offset +%a_gep = OpAccessChain %ptr_int_ssbo %a %int_0 %idx +OpStore %a_gep %x +OpReturn +OpFunctionEnd +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +BUFFER a_buf DATA_TYPE int32 SIZE 64 FILL 0 +BUFFER expect_buf DATA_TYPE int32 DATA +0 1 0 3 0 5 0 7 +0 1 2 3 4 5 6 7 +0 1 0 3 0 5 0 7 +0 1 2 3 4 5 6 7 +0 1 0 3 0 5 0 7 +0 1 2 3 4 5 6 7 +0 1 0 3 0 5 0 7 +0 1 2 3 4 5 6 7 +END + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 + BIND BUFFER a_buf AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT a_buf EQ_BUFFER expect_buf + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/ssbo_atomic_before_terminate.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/ssbo_atomic_before_terminate.amber new file mode 100644 index 0000000..ac0e606 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/ssbo_atomic_before_terminate.amber @@ -0,0 +1,174 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;#pragma GL_EXT_terminate_invocation : enable +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;layout(set = 0, binding = 0) buffer A { uint a[]; } a; +;void main() { +; out_data = 1; +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int combined = (x_coord & 0x1) + (y_coord & 0x1) + in_data; +; atomicAdd(a.a[x_coord + 8 * y_coord], x_coord); +; if (combined == int(gl_FragCoord.z)) +; terminateInvocation; +;} +OpCapability Shader +OpExtension "SPV_KHR_terminate_invocation" +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +OpDecorate %a DescriptorSet 0 +OpDecorate %a Binding 0 +OpDecorate %a_block Block +OpMemberDecorate %a_block 0 Offset 0 +OpDecorate %rta ArrayStride 4 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_8 = OpConstant %int 8 +%device = OpConstant %int 1 +%relaxed = OpConstant %int 0 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%rta = OpTypeRuntimeArray %int +%a_block = OpTypeStruct %rta +%ptr_int_ssbo = OpTypePointer StorageBuffer %int +%ptr_a_ssbo = OpTypePointer StorageBuffer %a_block +%a = OpVariable %ptr_a_ssbo StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpStore %out_data %int_1 +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%offset = OpIMul %int %y %int_8 +%idx = OpIAdd %int %x %offset +%a_gep = OpAccessChain %ptr_int_ssbo %a %int_0 %idx +%old = OpAtomicIAdd %int %a_gep %device %relaxed %x +%cmp = OpIEqual %bool %combined %z +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +OpReturn +OpFunctionEnd +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +BUFFER a_buf DATA_TYPE int32 SIZE 64 FILL 0 +BUFFER expect_buf DATA_TYPE int32 DATA +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +END + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 + BIND BUFFER a_buf AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT a_buf EQ_BUFFER expect_buf + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate.amber new file mode 100644 index 0000000..3193a2e --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate.amber @@ -0,0 +1,173 @@ +#!amber + +DEVICE_FEATURE fragmentStoresAndAtomics +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;#pragma GL_EXT_terminate_invocation : enable +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;layout(set = 0, binding = 0) buffer A { uint a[]; } a; +;void main() { +; out_data = 1; +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int combined = (x_coord & 0x1) + (y_coord & 0x1) + in_data; +; a.a[x_coord + 8 * y_coord] = x_coord; +; if (combined == int(gl_FragCoord.z)) +; terminateInvocation; +;} +OpCapability Shader +OpExtension "SPV_KHR_terminate_invocation" +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +OpDecorate %a DescriptorSet 0 +OpDecorate %a Binding 0 +OpDecorate %a_block Block +OpMemberDecorate %a_block 0 Offset 0 +OpDecorate %rta ArrayStride 4 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_8 = OpConstant %int 8 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%rta = OpTypeRuntimeArray %int +%a_block = OpTypeStruct %rta +%ptr_int_ssbo = OpTypePointer StorageBuffer %int +%ptr_a_ssbo = OpTypePointer StorageBuffer %a_block +%a = OpVariable %ptr_a_ssbo StorageBuffer +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpStore %out_data %int_1 +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%offset = OpIMul %int %y %int_8 +%idx = OpIAdd %int %x %offset +%a_gep = OpAccessChain %ptr_int_ssbo %a %int_0 %idx +OpStore %a_gep %x +%cmp = OpIEqual %bool %combined %z +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +OpReturn +OpFunctionEnd +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +BUFFER a_buf DATA_TYPE int32 SIZE 64 FILL 0 +BUFFER expect_buf DATA_TYPE int32 DATA +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 +END + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 + BIND BUFFER a_buf AS storage DESCRIPTOR_SET 0 BINDING 0 +END + +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT a_buf EQ_BUFFER expect_buf + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/subgroup_ballot.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/subgroup_ballot.amber new file mode 100644 index 0000000..be30f25 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/subgroup_ballot.amber @@ -0,0 +1,230 @@ +#!amber + +DEVICE_FEATURE SubgroupSupportedOperations.ballot +DEVICE_FEATURE SubgroupSupportedStages.fragment +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;#extension GL_KHR_shader_subgroup_ballot : enable +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +; +;void main() { +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int combined = (x_coord & 0x1) + (y_coord & 0x1) + in_data; +; bool cond = combined == int(gl_FragCoord.z); +; if (combined == int(gl_FragCoord.z)) +; terminateInvocation; +; +; int quad_idx = (x_coord & 0x1) + 2 * (y_coord & 0x1); +; uvec4 b = subgroupBallot(true); +; uint element; +; if (gl_SubgroupInvocationID < 32) +; element = b.x; +; else if (gl_SubgroupInvocationID < 64) +; element = b.y; +; else if (gl_SubgroupInvocationID < 96) +; element = b.z; +; else +; element = b.w; +; uint base_bit = (gl_SubgroupInvocationID - quad_idx) % 32; +; bool check_quad_idx_0 = ((element >> base_bit) & 0x1) == 0; +; out_data = check_quad_idx_0 ? 1 : 0; +; +;} +OpCapability Shader +OpCapability GroupNonUniformBallot +OpExtension "SPV_KHR_terminate_invocation" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data %subgroupID +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +OpDecorate %subgroupID Flat +OpDecorate %subgroupID BuiltIn SubgroupLocalInvocationId +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%int = OpTypeInt 32 1 +%uint = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_32 = OpConstant %int 32 +%int_64 = OpConstant %int 64 +%int_96 = OpConstant %int 96 +%subgroup = OpConstant %int 3 +%uint4 = OpTypeVector %uint 4 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%subgroupID = OpVariable %ptr_int_input Input +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +%y_2 = OpIMul %int %int_2 %y_and_1 +%quad_idx = OpIAdd %int %x_and_1 %y_2 +%b = OpGroupNonUniformBallot %uint4 %subgroup %true +%sid = OpLoad %int %subgroupID +%less_than_32 = OpULessThan %bool %sid %int_32 +OpSelectionMerge %merge_32 None +OpBranchConditional %less_than_32 %then_32 %else_32 +%then_32 = OpLabel +%element_0 = OpCompositeExtract %uint %b 0 +OpBranch %merge_32 +%else_32 = OpLabel +%less_than_64 = OpULessThan %bool %sid %int_64 +OpSelectionMerge %merge_64 None +OpBranchConditional %less_than_64 %then_64 %else_64 +%then_64 = OpLabel +%element_1 = OpCompositeExtract %uint %b 1 +OpBranch %merge_64 +%else_64 = OpLabel +%less_than_96 = OpULessThan %bool %sid %int_96 +%element_2 = OpCompositeExtract %uint %b 2 +%element_3 = OpCompositeExtract %uint %b 3 +%sel_96 = OpSelect %uint %less_than_96 %element_2 %element_3 +OpBranch %merge_64 +%merge_64 = OpLabel +%phi_64 = OpPhi %uint %element_1 %then_64 %sel_96 %else_64 +OpBranch %merge_32 +%merge_32 = OpLabel +%phi_32 = OpPhi %uint %element_0 %then_32 %phi_64 %merge_64 +%bit = OpISub %int %sid %quad_idx +%base_bit = OpSMod %int %bit %int_32 +%idx_0_shift = OpShiftRightLogical %int %phi_32 %base_bit +%idx_0_shift_and_1 = OpBitwiseAnd %int %idx_0_shift %int_1 +%idx_0_check = OpIEqual %bool %idx_0_shift_and_1 %int_0 +%out_val = OpSelect %int %idx_0_check %int_1 %int_0 +OpStore %out_data %out_val +OpReturn +OpFunctionEnd +END + +SHADER vertex passthrough PASSTHROUGH +SHADER fragment expect_fs GLSL +#version 450 + +layout(location = 0) out int out_data; +void main() { + bool x_is_odd = (int(gl_FragCoord.x) & 0x1) == 1; + bool y_is_odd = (int(gl_FragCoord.y) & 0x1) == 1; + out_data = (x_is_odd || y_is_odd) ? 1 : 0; +} +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +IMAGE expect_frame DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 +END + +PIPELINE graphics expect_pipe + ATTACH passthrough + ATTACH expect_fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + BIND BUFFER expect_frame AS color LOCATION 0 +END + +RUN expect_pipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT out_data EQ_BUFFER expect_frame + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/subgroup_vote.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/subgroup_vote.amber new file mode 100644 index 0000000..0e322eb --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/subgroup_vote.amber @@ -0,0 +1,180 @@ +#!amber + +DEVICE_FEATURE SubgroupSupportedOperations.vote +DEVICE_FEATURE SubgroupSupportedStages.fragment +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;#extension GL_KHR_shader_subgroup_vote : enable +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +; +;void main() { +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int combined = (x_coord & 0x1) + (y_coord & 0x1) + in_data; +; bool cond = combined == int(gl_FragCoord.z); +; if (combined == int(gl_FragCoord.z)) +; terminateInvocation; +; +; bool all = subgroupAll(cond); +; out_data = all ? 1 : 0; +;} +OpCapability Shader +OpCapability GroupNonUniformVote +OpExtension "SPV_KHR_terminate_invocation" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data %subgroupID +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +OpDecorate %subgroupID Flat +OpDecorate %subgroupID BuiltIn SubgroupLocalInvocationId +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%subgroup = OpConstant %int 3 +%int4 = OpTypeVector %int 4 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%subgroupID = OpVariable %ptr_int_input Input +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +%not_cmp = OpLogicalNot %bool %cmp +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +OpTerminateInvocation +%exit = OpLabel +%all = OpGroupNonUniformAll %bool %subgroup %not_cmp +%sel = OpSelect %int %all %int_1 %int_0 +OpStore %out_data %sel +OpReturn +OpFunctionEnd +END + +SHADER vertex passthrough PASSTHROUGH +SHADER fragment expect_fs GLSL +#version 450 + +layout(location = 0) out int out_data; +void main() { + bool x_is_odd = (int(gl_FragCoord.x) & 0x1) == 1; + bool y_is_odd = (int(gl_FragCoord.y) & 0x1) == 1; + out_data = (x_is_odd || y_is_odd) ? 1 : 0; +} +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +IMAGE expect_frame DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 +END + +PIPELINE graphics expect_pipe + ATTACH passthrough + ATTACH expect_fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + BIND BUFFER expect_frame AS color LOCATION 0 +END + +RUN expect_pipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT out_data EQ_BUFFER expect_frame + diff --git a/vulkan/amber/spirv_assembly/instruction/terminate_invocation/terminate_loop.amber b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/terminate_loop.amber new file mode 100644 index 0000000..a5aaf07 --- /dev/null +++ b/vulkan/amber/spirv_assembly/instruction/terminate_invocation/terminate_loop.amber @@ -0,0 +1,176 @@ +#!amber + +DEVICE_EXTENSION VK_KHR_shader_terminate_invocation + +SHADER vertex vs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in vec3 position; +;layout(location = 1) in int in_data; +;layout(location = 0) out int out_data; +;void main() { +; gl_Position = vec4(position, 1.0); +; out_data = int(in_data); +;} +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %position %in_data %out_data %per_vertex +OpDecorate %position Location 0 +OpDecorate %in_data Location 1 +OpDecorate %out_data Location 0 +OpDecorate %block Block +OpMemberDecorate %block 0 BuiltIn Position +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%float3 = OpTypeVector %float 3 +%float4 = OpTypeVector %float 4 +%ptr_float3_input = OpTypePointer Input %float3 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%block = OpTypeStruct %float4 +%ptr_float4_output = OpTypePointer Output %float4 +%ptr_block_output = OpTypePointer Output %block +%position = OpVariable %ptr_float3_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%per_vertex = OpVariable %ptr_block_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%ld_pos = OpLoad %float3 %position +%out_pos = OpCompositeConstruct %float4 %ld_pos %float_1 +%out_pos_gep = OpAccessChain %ptr_float4_output %per_vertex %int_0 +OpStore %out_pos_gep %out_pos +OpCopyMemory %out_data %in_data +OpReturn +OpFunctionEnd +END + +SHADER fragment fs SPIRV-ASM +;#version 450 +; +;layout(location = 0) in flat int in_data; +;layout(location = 0) out int out_data; +;void main() { +; int x_coord = int(gl_FragCoord.x); +; int y_coord = int(gl_FragCoord.y); +; int combined = (x_coord & 0x1) + (y_coord & 0x1) + in_data; +; if (combined == int(gl_FragCoord.z)) +; for (int i = 0; i < 10; i += in_data) +; terminate_invocation; +; +; out_data = 1; +;} +OpCapability Shader +OpExtension "SPV_KHR_terminate_invocation" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_coord %in_data %out_data +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_coord BuiltIn FragCoord +OpDecorate %in_data Location 0 +OpDecorate %in_data Flat +OpDecorate %out_data Location 0 +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_10 = OpConstant %int 10 +%float = OpTypeFloat 32 +%float4 = OpTypeVector %float 4 +%ptr_int_input = OpTypePointer Input %int +%ptr_int_output = OpTypePointer Output %int +%ptr_float4_input = OpTypePointer Input %float4 +%frag_coord = OpVariable %ptr_float4_input Input +%in_data = OpVariable %ptr_int_input Input +%out_data = OpVariable %ptr_int_output Output +%void_fn = OpTypeFunction %void +%main = OpFunction %void None %void_fn +%entry = OpLabel +%coord = OpLoad %float4 %frag_coord +%x_coord = OpCompositeExtract %float %coord 0 +%y_coord = OpCompositeExtract %float %coord 1 +%z_coord = OpCompositeExtract %float %coord 2 +%x = OpConvertFToS %int %x_coord +%y = OpConvertFToS %int %y_coord +%z = OpConvertFToS %int %z_coord +%x_and_1 = OpBitwiseAnd %int %x %int_1 +%y_and_1 = OpBitwiseAnd %int %y %int_1 +%add = OpIAdd %int %x_and_1 %y_and_1 +%ld_in_data = OpLoad %int %in_data +%combined = OpIAdd %int %add %ld_in_data +%cmp = OpIEqual %bool %combined %z +OpSelectionMerge %exit None +OpBranchConditional %cmp %then %exit +%then = OpLabel +%i = OpPhi %int %int_0 %entry %inc %continue +%i_cmp = OpULessThan %bool %i %int_10 +OpLoopMerge %loop_merge %continue None +OpBranchConditional %i_cmp %body %loop_merge +%body = OpLabel +OpTerminateInvocation +%continue = OpLabel +%inc = OpIAdd %int %i %int_1 +OpBranch %then +%loop_merge = OpLabel +OpBranch %exit +%exit = OpLabel +OpStore %out_data %int_1 +OpReturn +OpFunctionEnd +END + +SHADER vertex passthrough PASSTHROUGH +SHADER fragment expect_fs GLSL +#version 450 + +layout(location = 0) out int out_data; +void main() { + bool x_is_odd = (int(gl_FragCoord.x) & 0x1) == 1; + bool y_is_odd = (int(gl_FragCoord.y) & 0x1) == 1; + out_data = (x_is_odd || y_is_odd) ? 1 : 0; +} +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 + +-1 1 0 + 1 -1 0 + 1 1 0 +END + +BUFFER in_data_buf DATA_TYPE int32 SIZE 6 FILL 0 + +IMAGE out_data DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 +IMAGE expect_frame DATA_TYPE int32 DIM_2D WIDTH 8 HEIGHT 8 FILL 0 + +PIPELINE graphics gpipe + ATTACH vs + ATTACH fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + VERTEX_DATA in_data_buf LOCATION 1 + BIND BUFFER out_data AS color LOCATION 0 +END + +PIPELINE graphics expect_pipe + ATTACH passthrough + ATTACH expect_fs + + FRAMEBUFFER_SIZE 8 8 + VERTEX_DATA position_buf LOCATION 0 + BIND BUFFER expect_frame AS color LOCATION 0 +END + +RUN expect_pipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +RUN gpipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT out_data EQ_BUFFER expect_frame + diff --git a/vulkan/amber/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00.amber b/vulkan/amber/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00.amber new file mode 100644 index 0000000..0e2565b --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00.amber @@ -0,0 +1,84 @@ +#!amber + +SHADER vertex vtex_shader GLSL TARGET_ENV spv1.3 +#version 430 +layout(location = 0) in vec3 position; +void main() { + gl_Position = vec4(position, 1.0); +} +END + +SHADER fragment compare_shader GLSL TARGET_ENV spv1.3 +#version 430 +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable + +layout(location = 0) out int compare; +layout(location = 1) out vec4 out1; +layout(location = 2) out vec4 out2; +void main() [[subgroup_uniform_control_flow]] { + bool inbounds = (gl_FragCoord.x < 128 || gl_FragCoord.y < 128); + bool elect = subgroupElect(); + if (elect) { + out1 = vec4(1.0, 0, 0, 1.0); + } else if (inbounds) { + out2 = vec4(0, 1.0, 0, 1.0); + } else { + discard; + } + + bool a = (!inbounds && elect); + bool b = subgroupElect() == elect; + compare = (b && !a) ? 1 : -1; +} +END + +SHADER fragment expect_shader GLSL TARGET_ENV spv1.3 +#version 430 +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable + +layout(location = 0) out int expect; +void main() { + bool inbounds = (gl_FragCoord.x < 128 || gl_FragCoord.y < 128); + expect = inbounds ? 1 : -1; +} +END + +BUFFER position_buf DATA_TYPE vec3 DATA +-1 -1 0 +-1 1 0 + 1 -1 0 +END + +BUFFER expect DATA_TYPE int32 SIZE 65536 FILL -1 +BUFFER compare DATA_TYPE int32 SIZE 65536 FILL -1 +BUFFER out1 DATA_TYPE vec4 SIZE 65536 FILL -1 +BUFFER out2 DATA_TYPE vec4 SIZE 65536 FILL -1 + +PIPELINE graphics compare_pipe + ATTACH vtex_shader + ATTACH compare_shader + + VERTEX_DATA position_buf LOCATION 0 + BIND BUFFER compare AS color LOCATION 0 + BIND BUFFER out1 AS color LOCATION 1 + BIND BUFFER out2 AS color LOCATION 2 + FRAMEBUFFER_SIZE 256 256 +END + +PIPELINE graphics expect_pipe + ATTACH vtex_shader + ATTACH expect_shader + + VERTEX_DATA position_buf LOCATION 0 + BIND BUFFER expect AS color LOCATION 0 + FRAMEBUFFER_SIZE 256 256 +END + +RUN expect_pipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3 +RUN compare_pipe DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3 +EXPECT compare EQ_BUFFER expect diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge00.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge00.amber new file mode 100644 index 0000000..43b69f0 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge00.amber @@ -0,0 +1,76 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge01.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge01.amber new file mode 100644 index 0000000..07b1c9f --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge01.amber @@ -0,0 +1,75 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + do { + c.c[idx] = d.d[idx]; + } while (!subgroupElect()); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge02.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge02.amber new file mode 100644 index 0000000..729c3b0 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge02.amber @@ -0,0 +1,77 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + while (true) { + atomicAdd(c.c[0], 1); + if (subgroupElect()) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge03.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge03.amber new file mode 100644 index 0000000..8fcb22a --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge03.amber @@ -0,0 +1,77 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + if (gl_SubgroupInvocationID == 0) { + d.d[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge04.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge04.amber new file mode 100644 index 0000000..37d2b3c --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge04.amber @@ -0,0 +1,78 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge05.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge05.amber new file mode 100644 index 0000000..8293bde --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge05.amber @@ -0,0 +1,78 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge06.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge06.amber new file mode 100644 index 0000000..bac9f63 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge06.amber @@ -0,0 +1,83 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (c.c[idx] > 5) + return; + + while (true) { + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge07.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge07.amber new file mode 100644 index 0000000..49f92cf --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge07.amber @@ -0,0 +1,82 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + while (true) { + if (c.c[idx] > 5) + return; + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge08.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge08.amber new file mode 100644 index 0000000..f24a3c1 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge08.amber @@ -0,0 +1,79 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (uint i = 0; i < c.c[idx]; ++i) { + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + atomicAdd(d.d[idx], 1); + if (i == gl_SubgroupID % 4) + break; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge09.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge09.amber new file mode 100644 index 0000000..3e73a32 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge09.amber @@ -0,0 +1,86 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge10.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge10.amber new file mode 100644 index 0000000..ca8eeae --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge10.amber @@ -0,0 +1,86 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + break; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge11.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge11.amber new file mode 100644 index 0000000..4725a77 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge11.amber @@ -0,0 +1,87 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + continue; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge12.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge12.amber new file mode 100644 index 0000000..252ffed --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge12.amber @@ -0,0 +1,86 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + case 2: + d.d[idx] = gl_SubgroupID; + break; + default: + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge13.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge13.amber new file mode 100644 index 0000000..f2d9f3b --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge13.amber @@ -0,0 +1,86 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[idx] % 2 != 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + default: + d.d[idx] = gl_SubgroupID; + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge14.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge14.amber new file mode 100644 index 0000000..85df8ae --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge14.amber @@ -0,0 +1,84 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 1: + atomicAdd(d.d[idx], 1); + // fallthrough... + case 3: + return; + default: + atomicExchange(d.d[0], gl_SubgroupID); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge15.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge15.amber new file mode 100644 index 0000000..8bea02b --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge15.amber @@ -0,0 +1,95 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 1: + atomicAdd(d.d[idx], 1); + break; + case 3: + return; + default: + switch (c.c[idx]) { + case 0: + case 1: + atomicExchange(d.d[0], gl_SubgroupID); + break; + case 2: + c.c[idx]++; + break; + default: + atomicAdd(d.d[1], 32); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + break; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge16.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge16.amber new file mode 100644 index 0000000..2e0a06b --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge16.amber @@ -0,0 +1,89 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[256 * i + idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[256 * 0 + idx] = cmp_val; + compare.x[256 * 1 + idx] = cmp_val; + compare.x[256 * 2 + idx] = cmp_val; + compare.x[256 * 3 + idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 1024 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 1024 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge17.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge17.amber new file mode 100644 index 0000000..0c26b82 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge17.amber @@ -0,0 +1,80 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + } else { + c.c[idx]++; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge18.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge18.amber new file mode 100644 index 0000000..fd5bf53 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge18.amber @@ -0,0 +1,84 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + if (!subgroupAllEqual(c_val)) { + atomicAdd(d.d[0], 1); + if (c_val % 2 == 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge19.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge19.amber new file mode 100644 index 0000000..8e4460b --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge19.amber @@ -0,0 +1,88 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + bool test = (c_val % 2) == 0; + if (subgroupAny(test)) { + atomicAdd(d.d[0], 1); + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + if (c_val % 2 == 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge20.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge20.amber new file mode 100644 index 0000000..1a1ac26 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge20.amber @@ -0,0 +1,133 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = a.a[idx]; + if (a_val < 128) { + uint c_val = c.c[idx]; + switch (c_val) { + case 0: + atomicAdd(d.d[idx], 1); + break; + case 1: + case 2: + if (a_val > 4) { + uint val = a_val; + for (uint i = 0; i < 4; ++i) { + val = atomicExchange(d.d[0], val); + if (c_val == 1) return; + } + } else if (a_val == 3) { + atomicAdd(d.d[1], gl_SubgroupID); + } else { + atomicAdd(d.d[2], gl_SubgroupInvocationID); + if (c_val == 1) return; + } + break; + default: + if (a.a[gl_SubgroupID] % 2 != 0) return; + atomicExchange(d.d[idx], c_val); + break; + } + } else if (a_val < 192) { + atomicExchange(d.d[idx], a_val); + uint c_val = c.c[idx]; + if (subgroupAny(c_val == 0)) { + return; + } else { + uint val = atomicAdd(d.d[idx], gl_SubgroupInvocationID); + while (!subgroupElect()) { + val = atomicExchange(d.d[0], val); + } + if (val > 10) { + atomicAnd(d.d[idx], 0xff00ff00); + } + } + } else { + if (a.a[gl_SubgroupID] % 2 != 0) return; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + uint c_val = c.c[idx]; + if (a.a[idx] < 128) { + if (gl_SubgroupID % 2 != 0) { + c_val = 1; + } else { + c_val = gl_SubgroupInvocationID % 4; + if (c_val == 1) c_val += 4; + } + } else if (a.a[idx] < 192) { + if (gl_SubgroupInvocationID == 0 && gl_SubgroupID % 2 != 0) { + c_val = 0; + } else { + c_val = c_val + 1; + } + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial00.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial00.amber new file mode 100644 index 0000000..0110d8c --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial00.amber @@ -0,0 +1,77 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial01.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial01.amber new file mode 100644 index 0000000..a8192eb --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial01.amber @@ -0,0 +1,75 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + do { + c.c[idx] = d.d[idx]; + } while (!subgroupElect()); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial02.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial02.amber new file mode 100644 index 0000000..61b03b7 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial02.amber @@ -0,0 +1,77 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + while (true) { + atomicAdd(c.c[0], 1); + if (subgroupElect()) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial03.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial03.amber new file mode 100644 index 0000000..88374f3 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial03.amber @@ -0,0 +1,77 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + if (gl_SubgroupInvocationID == 0) { + d.d[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial04.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial04.amber new file mode 100644 index 0000000..4235658 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial04.amber @@ -0,0 +1,78 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial05.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial05.amber new file mode 100644 index 0000000..7696ff9 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial05.amber @@ -0,0 +1,78 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial06.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial06.amber new file mode 100644 index 0000000..39dc720 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial06.amber @@ -0,0 +1,83 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (c.c[idx] > 5) + return; + + while (true) { + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial07.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial07.amber new file mode 100644 index 0000000..5d7d960 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial07.amber @@ -0,0 +1,82 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + while (true) { + if (c.c[idx] > 5) + return; + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial08.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial08.amber new file mode 100644 index 0000000..c328aa8 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial08.amber @@ -0,0 +1,79 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (uint i = 0; i < c.c[idx]; ++i) { + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + atomicAdd(d.d[idx], 1); + if (i == gl_SubgroupID % 4) + break; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial09.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial09.amber new file mode 100644 index 0000000..0b713bc --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial09.amber @@ -0,0 +1,86 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial10.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial10.amber new file mode 100644 index 0000000..9ba73ca --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial10.amber @@ -0,0 +1,87 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + break; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial11.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial11.amber new file mode 100644 index 0000000..5a7a895 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial11.amber @@ -0,0 +1,87 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + continue; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial12.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial12.amber new file mode 100644 index 0000000..a37a6fa --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial12.amber @@ -0,0 +1,86 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + case 2: + d.d[idx] = gl_SubgroupID; + break; + default: + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial13.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial13.amber new file mode 100644 index 0000000..e0c1356 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial13.amber @@ -0,0 +1,86 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[idx] % 2 == 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + default: + d.d[idx] = gl_SubgroupID; + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial14.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial14.amber new file mode 100644 index 0000000..e4f4386 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial14.amber @@ -0,0 +1,84 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 0: + atomicAdd(d.d[idx], 1); + // fallthrough... + case 2: + return; + default: + atomicExchange(d.d[0], gl_SubgroupID); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial15.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial15.amber new file mode 100644 index 0000000..8ae8a3c --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial15.amber @@ -0,0 +1,95 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 0: + atomicAdd(d.d[idx], 1); + break; + case 2: + return; + default: + switch (c.c[idx]) { + case 0: + case 1: + atomicExchange(d.d[0], gl_SubgroupID); + break; + case 2: + c.c[idx]++; + break; + default: + atomicAdd(d.d[1], 32); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + break; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial16.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial16.amber new file mode 100644 index 0000000..50e0545 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial16.amber @@ -0,0 +1,89 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[238 * i + idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[238 * 0 + idx] = cmp_val; + compare.x[238 * 1 + idx] = cmp_val; + compare.x[238 * 2 + idx] = cmp_val; + compare.x[238 * 3 + idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 952 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 952 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial17.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial17.amber new file mode 100644 index 0000000..0de1d56 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial17.amber @@ -0,0 +1,80 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + } else { + c.c[idx]++; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial18.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial18.amber new file mode 100644 index 0000000..7222c33 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial18.amber @@ -0,0 +1,84 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + if (!subgroupAllEqual(c_val)) { + atomicAdd(d.d[0], 1); + if (c_val % 2 != 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial19.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial19.amber new file mode 100644 index 0000000..5c5dfb8 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial19.amber @@ -0,0 +1,88 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + bool test = (c_val % 2) != 0; + if (subgroupAny(test)) { + atomicAdd(d.d[0], 1); + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + if (c_val % 2 != 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial20.amber b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial20.amber new file mode 100644 index 0000000..501ccfa --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large/subgroup_reconverge_partial20.amber @@ -0,0 +1,132 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = a.a[idx]; + if (a_val < 128) { + uint c_val = c.c[idx]; + switch (c_val) { + case 0: + atomicAdd(d.d[idx], 1); + break; + case 1: + case 2: + if (a_val > 4) { + uint val = a_val; + for (uint i = 0; i < 4; ++i) { + val = atomicExchange(d.d[0], val); + } + } else if (a_val == 3) { + atomicAdd(d.d[1], gl_SubgroupID); + } else { + atomicAdd(d.d[2], gl_SubgroupInvocationID); + } + if (c_val == 1) return; + break; + default: + if (a.a[gl_SubgroupID] % 2 == 0) return; + atomicExchange(d.d[idx], c_val); + break; + } + } else if (a_val < 192) { + atomicExchange(d.d[idx], a_val); + uint c_val = c.c[idx]; + if (subgroupAny(c_val == 0)) { + return; + } else { + uint val = atomicAdd(d.d[idx], gl_SubgroupInvocationID); + while (!subgroupElect()) { + val = atomicExchange(d.d[0], val); + } + if (val > 10) { + atomicAnd(d.d[idx], 0xff00ff00); + } + } + } else { + if (a.a[gl_SubgroupID] % 2 == 0) return; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + uint c_val = c.c[idx]; + if (a.a[idx] < 128) { + if (gl_SubgroupID % 2 == 0) { + c_val = 1; + } else { + c_val = gl_SubgroupInvocationID % 4; + if (c_val == 1) c_val += 4; + } + } else if (a.a[idx] < 192) { + if (gl_SubgroupInvocationID == 0 && gl_SubgroupID % 2 == 0) { + c_val = 0; + } else { + c_val = c_val + 1; + } + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge00.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge00.amber new file mode 100644 index 0000000..ad36907 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge00.amber @@ -0,0 +1,87 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge01.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge01.amber new file mode 100644 index 0000000..c6e419e --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge01.amber @@ -0,0 +1,86 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + do { + c.c[idx] = d.d[idx]; + } while (!subgroupElect()); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge02.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge02.amber new file mode 100644 index 0000000..f1ab59e --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge02.amber @@ -0,0 +1,88 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + while (true) { + atomicAdd(c.c[0], 1); + if (subgroupElect()) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge03.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge03.amber new file mode 100644 index 0000000..0571fb6 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge03.amber @@ -0,0 +1,88 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + if (gl_SubgroupInvocationID == 0) { + d.d[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge04.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge04.amber new file mode 100644 index 0000000..49ebe01 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge04.amber @@ -0,0 +1,89 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge05.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge05.amber new file mode 100644 index 0000000..1e2475f --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge05.amber @@ -0,0 +1,89 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge06.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge06.amber new file mode 100644 index 0000000..4c8e4b6 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge06.amber @@ -0,0 +1,94 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (c.c[idx] > 5) + return; + + while (true) { + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge07.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge07.amber new file mode 100644 index 0000000..1c01fa5 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge07.amber @@ -0,0 +1,93 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + while (true) { + if (c.c[idx] > 5) + return; + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge08.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge08.amber new file mode 100644 index 0000000..bba5390 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge08.amber @@ -0,0 +1,90 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (uint i = 0; i < c.c[idx]; ++i) { + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + atomicAdd(d.d[idx], 1); + if (i == gl_SubgroupID % 4) + break; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge09.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge09.amber new file mode 100644 index 0000000..507b239 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge09.amber @@ -0,0 +1,97 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge10.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge10.amber new file mode 100644 index 0000000..7e137c4 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge10.amber @@ -0,0 +1,97 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + break; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge11.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge11.amber new file mode 100644 index 0000000..1aa2f67 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge11.amber @@ -0,0 +1,98 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + continue; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge12.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge12.amber new file mode 100644 index 0000000..3b26282 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge12.amber @@ -0,0 +1,97 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + case 2: + d.d[idx] = gl_SubgroupID; + break; + default: + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge13.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge13.amber new file mode 100644 index 0000000..417500c --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge13.amber @@ -0,0 +1,97 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[idx] % 2 != 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + default: + d.d[idx] = gl_SubgroupID; + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge14.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge14.amber new file mode 100644 index 0000000..3be6066 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge14.amber @@ -0,0 +1,95 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 1: + atomicAdd(d.d[idx], 1); + // fallthrough... + case 3: + return; + default: + atomicExchange(d.d[0], gl_SubgroupID); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge15.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge15.amber new file mode 100644 index 0000000..2637090 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge15.amber @@ -0,0 +1,106 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 1: + atomicAdd(d.d[idx], 1); + break; + case 3: + return; + default: + switch (c.c[idx]) { + case 0: + case 1: + atomicExchange(d.d[0], gl_SubgroupID); + break; + case 2: + c.c[idx]++; + break; + default: + atomicAdd(d.d[1], 32); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + break; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge16.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge16.amber new file mode 100644 index 0000000..84b22dd --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge16.amber @@ -0,0 +1,100 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[256 * i + idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[256 * 0 + idx] = cmp_val; + compare.x[256 * 1 + idx] = cmp_val; + compare.x[256 * 2 + idx] = cmp_val; + compare.x[256 * 3 + idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 1024 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 1024 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge17.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge17.amber new file mode 100644 index 0000000..30a709f --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge17.amber @@ -0,0 +1,91 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + } else { + c.c[idx]++; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge18.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge18.amber new file mode 100644 index 0000000..f1e3b62 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge18.amber @@ -0,0 +1,95 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + if (!subgroupAllEqual(c_val)) { + atomicAdd(d.d[0], 1); + if (c_val % 2 == 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge19.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge19.amber new file mode 100644 index 0000000..071fcfc --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge19.amber @@ -0,0 +1,99 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + bool test = (c_val % 2) == 0; + if (subgroupAny(test)) { + atomicAdd(d.d[0], 1); + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + if (c_val % 2 == 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge20.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge20.amber new file mode 100644 index 0000000..ca98128 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge20.amber @@ -0,0 +1,144 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = a.a[idx]; + if (a_val < 128) { + uint c_val = c.c[idx]; + switch (c_val) { + case 0: + atomicAdd(d.d[idx], 1); + break; + case 1: + case 2: + if (a_val > 4) { + uint val = a_val; + for (uint i = 0; i < 4; ++i) { + val = atomicExchange(d.d[0], val); + if (c_val == 1) return; + } + } else if (a_val == 3) { + atomicAdd(d.d[1], gl_SubgroupID); + } else { + atomicAdd(d.d[2], gl_SubgroupInvocationID); + if (c_val == 1) return; + } + break; + default: + if (a.a[gl_SubgroupID] % 2 != 0) return; + atomicExchange(d.d[idx], c_val); + break; + } + } else if (a_val < 192) { + atomicExchange(d.d[idx], a_val); + uint c_val = c.c[idx]; + if (subgroupAny(c_val == 0)) { + return; + } else { + uint val = atomicAdd(d.d[idx], gl_SubgroupInvocationID); + while (!subgroupElect()) { + val = atomicExchange(d.d[0], val); + } + if (val > 10) { + atomicAnd(d.d[idx], 0xff00ff00); + } + } + } else { + if (a.a[gl_SubgroupID] % 2 != 0) return; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + uint c_val = c.c[idx]; + if (a.a[idx] < 128) { + if (gl_SubgroupID % 2 != 0) { + c_val = 1; + } else { + c_val = gl_SubgroupInvocationID % 4; + if (c_val == 1) c_val += 4; + } + } else if (a.a[idx] < 192) { + if (gl_SubgroupInvocationID == 0 && gl_SubgroupID % 2 != 0) { + c_val = 0; + } else { + c_val = c_val + 1; + } + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 256 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 256 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 256 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial00.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial00.amber new file mode 100644 index 0000000..e5069f7 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial00.amber @@ -0,0 +1,88 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial01.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial01.amber new file mode 100644 index 0000000..c48b281 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial01.amber @@ -0,0 +1,86 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + do { + c.c[idx] = d.d[idx]; + } while (!subgroupElect()); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial02.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial02.amber new file mode 100644 index 0000000..c8d9137 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial02.amber @@ -0,0 +1,88 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + while (true) { + atomicAdd(c.c[0], 1); + if (subgroupElect()) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial03.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial03.amber new file mode 100644 index 0000000..2b996b2 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial03.amber @@ -0,0 +1,88 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + if (gl_SubgroupInvocationID == 0) { + d.d[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial04.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial04.amber new file mode 100644 index 0000000..30ecad8 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial04.amber @@ -0,0 +1,89 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial05.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial05.amber new file mode 100644 index 0000000..81e51f9 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial05.amber @@ -0,0 +1,89 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial06.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial06.amber new file mode 100644 index 0000000..74e9149 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial06.amber @@ -0,0 +1,94 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (c.c[idx] > 5) + return; + + while (true) { + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial07.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial07.amber new file mode 100644 index 0000000..5b25dda --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial07.amber @@ -0,0 +1,93 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + while (true) { + if (c.c[idx] > 5) + return; + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial08.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial08.amber new file mode 100644 index 0000000..428cf17 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial08.amber @@ -0,0 +1,90 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (uint i = 0; i < c.c[idx]; ++i) { + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + atomicAdd(d.d[idx], 1); + if (i == gl_SubgroupID % 4) + break; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial09.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial09.amber new file mode 100644 index 0000000..71dc42f --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial09.amber @@ -0,0 +1,97 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial10.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial10.amber new file mode 100644 index 0000000..e49a316 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial10.amber @@ -0,0 +1,98 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + break; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial11.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial11.amber new file mode 100644 index 0000000..1b62243 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial11.amber @@ -0,0 +1,98 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + continue; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial12.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial12.amber new file mode 100644 index 0000000..b8afa2e --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial12.amber @@ -0,0 +1,97 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + case 2: + d.d[idx] = gl_SubgroupID; + break; + default: + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial13.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial13.amber new file mode 100644 index 0000000..43323d0 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial13.amber @@ -0,0 +1,97 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[idx] % 2 == 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + default: + d.d[idx] = gl_SubgroupID; + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial14.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial14.amber new file mode 100644 index 0000000..f8d9b72 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial14.amber @@ -0,0 +1,95 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 0: + atomicAdd(d.d[idx], 1); + // fallthrough... + case 2: + return; + default: + atomicExchange(d.d[0], gl_SubgroupID); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial15.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial15.amber new file mode 100644 index 0000000..7639b9d --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial15.amber @@ -0,0 +1,106 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 0: + atomicAdd(d.d[idx], 1); + break; + case 2: + return; + default: + switch (c.c[idx]) { + case 0: + case 1: + atomicExchange(d.d[0], gl_SubgroupID); + break; + case 2: + c.c[idx]++; + break; + default: + atomicAdd(d.d[1], 32); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + break; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial16.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial16.amber new file mode 100644 index 0000000..2ddddbe --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial16.amber @@ -0,0 +1,100 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[238 * i + idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[238 * 0 + idx] = cmp_val; + compare.x[238 * 1 + idx] = cmp_val; + compare.x[238 * 2 + idx] = cmp_val; + compare.x[238 * 3 + idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 952 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 952 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial17.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial17.amber new file mode 100644 index 0000000..455a26e --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial17.amber @@ -0,0 +1,91 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + } else { + c.c[idx]++; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial18.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial18.amber new file mode 100644 index 0000000..0574818 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial18.amber @@ -0,0 +1,95 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + if (!subgroupAllEqual(c_val)) { + atomicAdd(d.d[0], 1); + if (c_val % 2 != 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial19.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial19.amber new file mode 100644 index 0000000..8ba455e --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial19.amber @@ -0,0 +1,99 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + bool test = (c_val % 2) != 0; + if (subgroupAny(test)) { + atomicAdd(d.d[0], 1); + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + if (c_val % 2 != 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial20.amber b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial20.amber new file mode 100644 index 0000000..90fc5d1 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/large_control/subgroup_reconverge_partial20.amber @@ -0,0 +1,143 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = a.a[idx]; + if (a_val < 128) { + uint c_val = c.c[idx]; + switch (c_val) { + case 0: + atomicAdd(d.d[idx], 1); + break; + case 1: + case 2: + if (a_val > 4) { + uint val = a_val; + for (uint i = 0; i < 4; ++i) { + val = atomicExchange(d.d[0], val); + } + } else if (a_val == 3) { + atomicAdd(d.d[1], gl_SubgroupID); + } else { + atomicAdd(d.d[2], gl_SubgroupInvocationID); + } + if (c_val == 1) return; + break; + default: + if (a.a[gl_SubgroupID] % 2 == 0) return; + atomicExchange(d.d[idx], c_val); + break; + } + } else if (a_val < 192) { + atomicExchange(d.d[idx], a_val); + uint c_val = c.c[idx]; + if (subgroupAny(c_val == 0)) { + return; + } else { + uint val = atomicAdd(d.d[idx], gl_SubgroupInvocationID); + while (!subgroupElect()) { + val = atomicExchange(d.d[0], val); + } + if (val > 10) { + atomicAnd(d.d[idx], 0xff00ff00); + } + } + } else { + if (a.a[gl_SubgroupID] % 2 == 0) return; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 2, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + uint c_val = c.c[idx]; + if (a.a[idx] < 128) { + if (gl_SubgroupID % 2 == 0) { + c_val = 1; + } else { + c_val = gl_SubgroupInvocationID % 4; + if (c_val == 1) c_val += 4; + } + } else if (a.a[idx] < 192) { + if (gl_SubgroupInvocationID == 0 && gl_SubgroupID % 2 == 0) { + c_val = 0; + } else { + c_val = c_val + 1; + } + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge00.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge00.amber new file mode 100644 index 0000000..5a0ab48 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge00.amber @@ -0,0 +1,77 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge01.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge01.amber new file mode 100644 index 0000000..37876f3 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge01.amber @@ -0,0 +1,75 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + do { + c.c[idx] = d.d[idx]; + } while (!subgroupElect()); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge02.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge02.amber new file mode 100644 index 0000000..6146ec4 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge02.amber @@ -0,0 +1,77 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + while (true) { + atomicAdd(c.c[0], 1); + if (subgroupElect()) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge03.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge03.amber new file mode 100644 index 0000000..1dc0989 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge03.amber @@ -0,0 +1,77 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + if (gl_SubgroupInvocationID == 0) { + d.d[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge04.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge04.amber new file mode 100644 index 0000000..d4b7e10 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge04.amber @@ -0,0 +1,78 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge05.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge05.amber new file mode 100644 index 0000000..d360571 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge05.amber @@ -0,0 +1,78 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge06.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge06.amber new file mode 100644 index 0000000..48a2abc --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge06.amber @@ -0,0 +1,83 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (c.c[idx] > 5) + return; + + while (true) { + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge07.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge07.amber new file mode 100644 index 0000000..a08aa1e --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge07.amber @@ -0,0 +1,82 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + while (true) { + if (c.c[idx] > 5) + return; + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge08.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge08.amber new file mode 100644 index 0000000..73f6ea4 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge08.amber @@ -0,0 +1,79 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (uint i = 0; i < c.c[idx]; ++i) { + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + atomicAdd(d.d[idx], 1); + if (i == gl_SubgroupID % 4) + break; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge09.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge09.amber new file mode 100644 index 0000000..238382e --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge09.amber @@ -0,0 +1,86 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge10.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge10.amber new file mode 100644 index 0000000..e3703d9 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge10.amber @@ -0,0 +1,86 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + break; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge11.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge11.amber new file mode 100644 index 0000000..fecc662 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge11.amber @@ -0,0 +1,87 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + continue; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge12.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge12.amber new file mode 100644 index 0000000..c2a5027 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge12.amber @@ -0,0 +1,85 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + case 2: + d.d[idx] = gl_SubgroupID; + break; + default: + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge13.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge13.amber new file mode 100644 index 0000000..099ec06 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge13.amber @@ -0,0 +1,86 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[idx] % 2 != 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + default: + d.d[idx] = gl_SubgroupID; + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge14.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge14.amber new file mode 100644 index 0000000..6fd2d3a --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge14.amber @@ -0,0 +1,84 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 1: + atomicAdd(d.d[idx], 1); + // fallthrough... + case 3: + return; + default: + atomicExchange(d.d[0], gl_SubgroupID); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge15.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge15.amber new file mode 100644 index 0000000..a8af9c3 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge15.amber @@ -0,0 +1,95 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 1: + atomicAdd(d.d[idx], 1); + break; + case 3: + return; + default: + switch (c.c[idx]) { + case 0: + case 1: + atomicExchange(d.d[0], gl_SubgroupID); + break; + case 2: + c.c[idx]++; + break; + default: + atomicAdd(d.d[1], 32); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + break; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge16.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge16.amber new file mode 100644 index 0000000..f4cb52d --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge16.amber @@ -0,0 +1,89 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[128 * i + idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[128 * 0 + idx] = cmp_val; + compare.x[128 * 1 + idx] = cmp_val; + compare.x[128 * 2 + idx] = cmp_val; + compare.x[128 * 3 + idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 512 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 512 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge17.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge17.amber new file mode 100644 index 0000000..f087daa --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge17.amber @@ -0,0 +1,80 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + } else { + c.c[idx]++; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge18.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge18.amber new file mode 100644 index 0000000..43358a1 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge18.amber @@ -0,0 +1,84 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + if (!subgroupAllEqual(c_val)) { + atomicAdd(d.d[0], 1); + if (c_val % 2 == 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge19.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge19.amber new file mode 100644 index 0000000..9dee434 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge19.amber @@ -0,0 +1,88 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + bool test = (c_val % 2) == 0; + if (subgroupAny(test)) { + atomicAdd(d.d[0], 1); + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + if (c_val % 2 == 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge20.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge20.amber new file mode 100644 index 0000000..98e53c1 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge20.amber @@ -0,0 +1,133 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = a.a[idx]; + if (a_val < 128) { + uint c_val = c.c[idx]; + switch (c_val) { + case 0: + atomicAdd(d.d[idx], 1); + break; + case 1: + case 2: + if (a_val > 4) { + uint val = a_val; + for (uint i = 0; i < 4; ++i) { + val = atomicExchange(d.d[0], val); + if (c_val == 1) return; + } + } else if (a_val == 3) { + atomicAdd(d.d[1], gl_SubgroupID); + } else { + atomicAdd(d.d[2], gl_SubgroupInvocationID); + if (c_val == 1) return; + } + break; + default: + if (a.a[gl_SubgroupID] % 2 != 0) return; + atomicExchange(d.d[idx], c_val); + break; + } + } else if (a_val < 192) { + atomicExchange(d.d[idx], a_val); + uint c_val = c.c[idx]; + if (subgroupAny(c_val == 0)) { + return; + } else { + uint val = atomicAdd(d.d[idx], gl_SubgroupInvocationID); + while (!subgroupElect()) { + val = atomicExchange(d.d[0], val); + } + if (val > 10) { + atomicAnd(d.d[idx], 0xff00ff00); + } + } + } else { + if (a.a[gl_SubgroupID] % 2 != 0) return; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + uint c_val = c.c[idx]; + if (a.a[idx] < 128) { + if (gl_SubgroupID % 2 != 0) { + c_val = 1; + } else { + c_val = gl_SubgroupInvocationID % 4; + if (c_val == 1) c_val += 4; + } + } else if (a.a[idx] < 192) { + if (gl_SubgroupInvocationID == 0 && gl_SubgroupID % 2 != 0) { + c_val = 0; + } else { + c_val = c_val + 1; + } + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial00.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial00.amber new file mode 100644 index 0000000..556e85a --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial00.amber @@ -0,0 +1,77 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial01.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial01.amber new file mode 100644 index 0000000..bcd7ed3 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial01.amber @@ -0,0 +1,75 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + do { + c.c[idx] = d.d[idx]; + } while (!subgroupElect()); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial02.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial02.amber new file mode 100644 index 0000000..0269761 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial02.amber @@ -0,0 +1,77 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + while (true) { + atomicAdd(c.c[0], 1); + if (subgroupElect()) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial03.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial03.amber new file mode 100644 index 0000000..209e5ff --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial03.amber @@ -0,0 +1,77 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + if (gl_SubgroupInvocationID == 0) { + d.d[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial04.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial04.amber new file mode 100644 index 0000000..ded4cb0 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial04.amber @@ -0,0 +1,78 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial05.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial05.amber new file mode 100644 index 0000000..2503600 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial05.amber @@ -0,0 +1,78 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial06.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial06.amber new file mode 100644 index 0000000..651720c --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial06.amber @@ -0,0 +1,83 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (c.c[idx] > 5) + return; + + while (true) { + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial07.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial07.amber new file mode 100644 index 0000000..c903cf7 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial07.amber @@ -0,0 +1,82 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + while (true) { + if (c.c[idx] > 5) + return; + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial08.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial08.amber new file mode 100644 index 0000000..12d3116 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial08.amber @@ -0,0 +1,79 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (uint i = 0; i < c.c[idx]; ++i) { + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + atomicAdd(d.d[idx], 1); + if (i == gl_SubgroupID % 4) + break; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial09.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial09.amber new file mode 100644 index 0000000..e25f709 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial09.amber @@ -0,0 +1,86 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial10.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial10.amber new file mode 100644 index 0000000..a8f4f5f --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial10.amber @@ -0,0 +1,87 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + break; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial11.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial11.amber new file mode 100644 index 0000000..78182d2 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial11.amber @@ -0,0 +1,87 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + continue; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial12.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial12.amber new file mode 100644 index 0000000..72ffef0 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial12.amber @@ -0,0 +1,86 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + case 2: + d.d[idx] = gl_SubgroupID; + break; + default: + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial13.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial13.amber new file mode 100644 index 0000000..05a8b1f --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial13.amber @@ -0,0 +1,86 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[idx] % 2 == 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + default: + d.d[idx] = gl_SubgroupID; + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial14.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial14.amber new file mode 100644 index 0000000..a42947c --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial14.amber @@ -0,0 +1,84 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 0: + atomicAdd(d.d[idx], 1); + // fallthrough... + case 2: + return; + default: + atomicExchange(d.d[0], gl_SubgroupID); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial15.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial15.amber new file mode 100644 index 0000000..fe50de2 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial15.amber @@ -0,0 +1,95 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 0: + atomicAdd(d.d[idx], 1); + break; + case 2: + return; + default: + switch (c.c[idx]) { + case 0: + case 1: + atomicExchange(d.d[0], gl_SubgroupID); + break; + case 2: + c.c[idx]++; + break; + default: + atomicAdd(d.d[1], 32); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + break; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial16.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial16.amber new file mode 100644 index 0000000..6cac3a8 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial16.amber @@ -0,0 +1,89 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[119 * i + idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[119 * 0 + idx] = cmp_val; + compare.x[119 * 1 + idx] = cmp_val; + compare.x[119 * 2 + idx] = cmp_val; + compare.x[119 * 3 + idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 476 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 476 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial17.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial17.amber new file mode 100644 index 0000000..c471d4d --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial17.amber @@ -0,0 +1,80 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + } else { + c.c[idx]++; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial18.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial18.amber new file mode 100644 index 0000000..0c57096 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial18.amber @@ -0,0 +1,84 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + if (!subgroupAllEqual(c_val)) { + atomicAdd(d.d[0], 1); + if (c_val % 2 != 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial19.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial19.amber new file mode 100644 index 0000000..c88d65e --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial19.amber @@ -0,0 +1,88 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + bool test = (c_val % 2) != 0; + if (subgroupAny(test)) { + atomicAdd(d.d[0], 1); + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + if (c_val % 2 != 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial20.amber b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial20.amber new file mode 100644 index 0000000..e829840 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small/small_subgroup_reconverge_partial20.amber @@ -0,0 +1,132 @@ +#!amber + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = a.a[idx]; + if (a_val < 128) { + uint c_val = c.c[idx]; + switch (c_val) { + case 0: + atomicAdd(d.d[idx], 1); + break; + case 1: + case 2: + if (a_val > 4) { + uint val = a_val; + for (uint i = 0; i < 4; ++i) { + val = atomicExchange(d.d[0], val); + } + } else if (a_val == 3) { + atomicAdd(d.d[1], gl_SubgroupID); + } else { + atomicAdd(d.d[2], gl_SubgroupInvocationID); + } + if (c_val == 1) return; + break; + default: + if (a.a[gl_SubgroupID] % 2 == 0) return; + atomicExchange(d.d[idx], c_val); + break; + } + } else if (a_val < 192) { + atomicExchange(d.d[idx], a_val); + uint c_val = c.c[idx]; + if (subgroupAny(c_val == 0)) { + return; + } else { + uint val = atomicAdd(d.d[idx], gl_SubgroupInvocationID); + while (!subgroupElect()) { + val = atomicExchange(d.d[0], val); + } + if (val > 10) { + atomicAnd(d.d[idx], 0xff00ff00); + } + } + } else { + if (a.a[gl_SubgroupID] % 2 == 0) return; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + uint c_val = c.c[idx]; + if (a.a[idx] < 128) { + if (gl_SubgroupID % 2 == 0) { + c_val = 1; + } else { + c_val = gl_SubgroupInvocationID % 4; + if (c_val == 1) c_val += 4; + } + } else if (a.a[idx] < 192) { + if (gl_SubgroupInvocationID == 0 && gl_SubgroupID % 2 == 0) { + c_val = 0; + } else { + c_val = c_val + 1; + } + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge00.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge00.amber new file mode 100644 index 0000000..6dfe340 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge00.amber @@ -0,0 +1,88 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge01.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge01.amber new file mode 100644 index 0000000..6f2ce84 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge01.amber @@ -0,0 +1,86 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + do { + c.c[idx] = d.d[idx]; + } while (!subgroupElect()); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge02.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge02.amber new file mode 100644 index 0000000..5001478 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge02.amber @@ -0,0 +1,88 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + while (true) { + atomicAdd(c.c[0], 1); + if (subgroupElect()) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge03.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge03.amber new file mode 100644 index 0000000..d5310ce --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge03.amber @@ -0,0 +1,88 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) { + if (gl_SubgroupInvocationID == 0) { + d.d[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge04.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge04.amber new file mode 100644 index 0000000..fdf705d --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge04.amber @@ -0,0 +1,89 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge05.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge05.amber new file mode 100644 index 0000000..6833803 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge05.amber @@ -0,0 +1,89 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge06.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge06.amber new file mode 100644 index 0000000..e016e99 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge06.amber @@ -0,0 +1,94 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (c.c[idx] > 5) + return; + + while (true) { + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge07.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge07.amber new file mode 100644 index 0000000..9a1bdfa --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge07.amber @@ -0,0 +1,93 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + while (true) { + if (c.c[idx] > 5) + return; + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge08.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge08.amber new file mode 100644 index 0000000..652f2aa --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge08.amber @@ -0,0 +1,90 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (uint i = 0; i < c.c[idx]; ++i) { + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + atomicAdd(d.d[idx], 1); + if (i == gl_SubgroupID % 4) + break; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge09.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge09.amber new file mode 100644 index 0000000..959b7db --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge09.amber @@ -0,0 +1,97 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge10.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge10.amber new file mode 100644 index 0000000..6881380 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge10.amber @@ -0,0 +1,97 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + break; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge11.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge11.amber new file mode 100644 index 0000000..325e933 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge11.amber @@ -0,0 +1,98 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + continue; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge12.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge12.amber new file mode 100644 index 0000000..0a6de50 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge12.amber @@ -0,0 +1,96 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + case 2: + d.d[idx] = gl_SubgroupID; + break; + default: + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge13.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge13.amber new file mode 100644 index 0000000..0138580 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge13.amber @@ -0,0 +1,97 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[idx] % 2 != 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + default: + d.d[idx] = gl_SubgroupID; + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge14.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge14.amber new file mode 100644 index 0000000..2d3cd50 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge14.amber @@ -0,0 +1,95 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 1: + atomicAdd(d.d[idx], 1); + // fallthrough... + case 3: + return; + default: + atomicExchange(d.d[0], gl_SubgroupID); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge15.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge15.amber new file mode 100644 index 0000000..eccdfc8 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge15.amber @@ -0,0 +1,106 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 1: + atomicAdd(d.d[idx], 1); + break; + case 3: + return; + default: + switch (c.c[idx]) { + case 0: + case 1: + atomicExchange(d.d[0], gl_SubgroupID); + break; + case 2: + c.c[idx]++; + break; + default: + atomicAdd(d.d[1], 32); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + break; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge16.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge16.amber new file mode 100644 index 0000000..6752848 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge16.amber @@ -0,0 +1,100 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[128 * i + idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 == 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[128 * 0 + idx] = cmp_val; + compare.x[128 * 1 + idx] = cmp_val; + compare.x[128 * 2 + idx] = cmp_val; + compare.x[128 * 3 + idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 512 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 512 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge17.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge17.amber new file mode 100644 index 0000000..5f1b784 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge17.amber @@ -0,0 +1,91 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + } else { + c.c[idx]++; + if (a.a[gl_SubgroupID] % 2 != 0) + return; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge18.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge18.amber new file mode 100644 index 0000000..180f638 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge18.amber @@ -0,0 +1,95 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + if (!subgroupAllEqual(c_val)) { + atomicAdd(d.d[0], 1); + if (c_val % 2 == 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge19.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge19.amber new file mode 100644 index 0000000..651cb00 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge19.amber @@ -0,0 +1,99 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + bool test = (c_val % 2) == 0; + if (subgroupAny(test)) { + atomicAdd(d.d[0], 1); + if (a.a[gl_SubgroupID] % 2 != 0) + return; + + if (c_val % 2 == 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 != 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 != 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge20.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge20.amber new file mode 100644 index 0000000..cd5d273 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge20.amber @@ -0,0 +1,144 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = a.a[idx]; + if (a_val < 128) { + uint c_val = c.c[idx]; + switch (c_val) { + case 0: + atomicAdd(d.d[idx], 1); + break; + case 1: + case 2: + if (a_val > 4) { + uint val = a_val; + for (uint i = 0; i < 4; ++i) { + val = atomicExchange(d.d[0], val); + if (c_val == 1) return; + } + } else if (a_val == 3) { + atomicAdd(d.d[1], gl_SubgroupID); + } else { + atomicAdd(d.d[2], gl_SubgroupInvocationID); + if (c_val == 1) return; + } + break; + default: + if (a.a[gl_SubgroupID] % 2 != 0) return; + atomicExchange(d.d[idx], c_val); + break; + } + } else if (a_val < 192) { + atomicExchange(d.d[idx], a_val); + uint c_val = c.c[idx]; + if (subgroupAny(c_val == 0)) { + return; + } else { + uint val = atomicAdd(d.d[idx], gl_SubgroupInvocationID); + while (!subgroupElect()) { + val = atomicExchange(d.d[0], val); + } + if (val > 10) { + atomicAnd(d.d[idx], 0xff00ff00); + } + } + } else { + if (a.a[gl_SubgroupID] % 2 != 0) return; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 != 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + uint c_val = c.c[idx]; + if (a.a[idx] < 128) { + if (gl_SubgroupID % 2 != 0) { + c_val = 1; + } else { + c_val = gl_SubgroupInvocationID % 4; + if (c_val == 1) c_val += 4; + } + } else if (a.a[idx] < 192) { + if (gl_SubgroupInvocationID == 0 && gl_SubgroupID % 2 != 0) { + c_val = 0; + } else { + c_val = c_val + 1; + } + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 1 0 0 0 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial00.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial00.amber new file mode 100644 index 0000000..17a70df --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial00.amber @@ -0,0 +1,88 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial01.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial01.amber new file mode 100644 index 0000000..202d9f0 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial01.amber @@ -0,0 +1,86 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + do { + c.c[idx] = d.d[idx]; + } while (!subgroupElect()); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial02.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial02.amber new file mode 100644 index 0000000..fa2c7fd --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial02.amber @@ -0,0 +1,88 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + while (true) { + atomicAdd(c.c[0], 1); + if (subgroupElect()) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial03.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial03.amber new file mode 100644 index 0000000..ed597ef --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial03.amber @@ -0,0 +1,88 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 != 0) { + if (gl_SubgroupInvocationID == 0) { + d.d[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial04.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial04.amber new file mode 100644 index 0000000..7b8e706 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial04.amber @@ -0,0 +1,89 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial05.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial05.amber new file mode 100644 index 0000000..77b76da --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial05.amber @@ -0,0 +1,89 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + } else { + c.c[idx]++; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial06.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial06.amber new file mode 100644 index 0000000..a8786f1 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial06.amber @@ -0,0 +1,94 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (c.c[idx] > 5) + return; + + while (true) { + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial07.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial07.amber new file mode 100644 index 0000000..41390dc --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial07.amber @@ -0,0 +1,93 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + while (true) { + if (c.c[idx] > 5) + return; + if (d.d[idx]++ > idx) + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 1 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial08.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial08.amber new file mode 100644 index 0000000..27d35be --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial08.amber @@ -0,0 +1,90 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (uint i = 0; i < c.c[idx]; ++i) { + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + atomicAdd(d.d[idx], 1); + if (i == gl_SubgroupID % 4) + break; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial09.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial09.amber new file mode 100644 index 0000000..c8b219c --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial09.amber @@ -0,0 +1,97 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial10.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial10.amber new file mode 100644 index 0000000..9ab66ac --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial10.amber @@ -0,0 +1,98 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + break; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial11.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial11.amber new file mode 100644 index 0000000..52529e7 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial11.amber @@ -0,0 +1,98 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] >= 10) + continue; + + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 238 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 238 FILL 1 +BUFFER d DATA_TYPE uint32 SIZE 238 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 238 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial12.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial12.amber new file mode 100644 index 0000000..b902719 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial12.amber @@ -0,0 +1,97 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + case 2: + d.d[idx] = gl_SubgroupID; + break; + default: + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial13.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial13.amber new file mode 100644 index 0000000..9373c37 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial13.amber @@ -0,0 +1,97 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + if (a.a[idx] % 2 == 0) + return; + + switch (c.c[idx]) { + case 0: + case 1: + atomicAdd(d.d[idx], 1); + break; + default: + d.d[idx] = gl_SubgroupID; + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID; + + c.c[idx] = gl_SubgroupID % 4; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial14.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial14.amber new file mode 100644 index 0000000..d81e0fa --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial14.amber @@ -0,0 +1,95 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 0: + atomicAdd(d.d[idx], 1); + // fallthrough... + case 2: + return; + default: + atomicExchange(d.d[0], gl_SubgroupID); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 128 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 128 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 128 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial15.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial15.amber new file mode 100644 index 0000000..450639e --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial15.amber @@ -0,0 +1,106 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + switch (a.a[idx]) { + case 0: + atomicAdd(d.d[idx], 1); + break; + case 2: + return; + default: + switch (c.c[idx]) { + case 0: + case 1: + atomicExchange(d.d[0], gl_SubgroupID); + break; + case 2: + c.c[idx]++; + break; + default: + atomicAdd(d.d[1], 32); + break; + } + b.b[idx] = subgroupElect() ? 1 : 0; + break; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + a.a[idx] = gl_SubgroupID % 4; + + c.c[idx] = gl_SubgroupID; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial16.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial16.amber new file mode 100644 index 0000000..3bc90ea --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial16.amber @@ -0,0 +1,100 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + for (int i = 0; i < c.c[0]; ++i) { + atomicAdd(d.d[idx], 1); + if (a.a[idx] < 10) { + if (a.a[idx] == 0) + atomicAdd(d.d[idx], 2); + b.b[119 * i + idx] = subgroupElect() ? 1 : 0; + } + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = 50; + if (gl_SubgroupID % 2 != 0) { + if (gl_SubgroupInvocationID == 0) + a_val = 0; + else + a_val = 5; + } + a.a[idx] = a_val; + + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[119 * 0 + idx] = cmp_val; + compare.x[119 * 1 + idx] = cmp_val; + compare.x[119 * 2 + idx] = cmp_val; + compare.x[119 * 3 + idx] = cmp_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER b DATA_TYPE uint32 SIZE 476 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 476 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial17.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial17.amber new file mode 100644 index 0000000..65d30dc --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial17.amber @@ -0,0 +1,91 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) volatile buffer C { uint c[]; } c; +layout(set=0, binding=3) coherent buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + + if (gl_SubgroupInvocationID == 0) { + c.c[idx] += 4; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + } else { + c.c[idx]++; + if (a.a[gl_SubgroupID] % 2 == 0) + return; + } + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 0 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial18.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial18.amber new file mode 100644 index 0000000..b0f69be --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial18.amber @@ -0,0 +1,95 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + if (!subgroupAllEqual(c_val)) { + atomicAdd(d.d[0], 1); + if (c_val % 2 != 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial19.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial19.amber new file mode 100644 index 0000000..00851d9 --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial19.amber @@ -0,0 +1,99 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint c_val = c.c[idx]; + bool test = (c_val % 2) != 0; + if (subgroupAny(test)) { + atomicAdd(d.d[0], 1); + if (a.a[gl_SubgroupID] % 2 == 0) + return; + + if (c_val % 2 != 0) { + atomicAdd(d.d[idx], gl_SubgroupID); + } + b.b[idx] = subgroupElect() ? 1 : 0; + } +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = subgroupElect() ? 1 : 0; + if (a.a[gl_SubgroupID] % 2 == 0) { + a_val = 4; + } + compare.x[idx] = a_val; + + uint c_val = c.c[idx]; + if (a.a[gl_SubgroupID] % 2 == 0) { + c_val = 10; + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial20.amber b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial20.amber new file mode 100644 index 0000000..bc1c5ed --- /dev/null +++ b/vulkan/amber/subgroup_uniform_control_flow/small_control/small_subgroup_reconverge_partial20.amber @@ -0,0 +1,143 @@ +#!amber + +DEVICE_FEATURE SubgroupSizeControl.subgroupSizeControl +DEVICE_FEATURE SubgroupSizeControl.computeFullSubgroups + +SHADER compute test GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_vote : enable +#extension GL_KHR_shader_subgroup_ballot : enable +#extension GL_EXT_subgroup_uniform_control_flow : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer B { uint b[]; } b; +layout(set=0, binding=2) coherent buffer C { uint c[]; } c; +layout(set=0, binding=3) volatile buffer D { uint d[]; } d; + +void main() +[[subgroup_uniform_control_flow]] +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint a_val = a.a[idx]; + if (a_val < 128) { + uint c_val = c.c[idx]; + switch (c_val) { + case 0: + atomicAdd(d.d[idx], 1); + break; + case 1: + case 2: + if (a_val > 4) { + uint val = a_val; + for (uint i = 0; i < 4; ++i) { + val = atomicExchange(d.d[0], val); + } + } else if (a_val == 3) { + atomicAdd(d.d[1], gl_SubgroupID); + } else { + atomicAdd(d.d[2], gl_SubgroupInvocationID); + } + if (c_val == 1) return; + break; + default: + if (a.a[gl_SubgroupID] % 2 == 0) return; + atomicExchange(d.d[idx], c_val); + break; + } + } else if (a_val < 192) { + atomicExchange(d.d[idx], a_val); + uint c_val = c.c[idx]; + if (subgroupAny(c_val == 0)) { + return; + } else { + uint val = atomicAdd(d.d[idx], gl_SubgroupInvocationID); + while (!subgroupElect()) { + val = atomicExchange(d.d[0], val); + } + if (val > 10) { + atomicAnd(d.d[idx], 0xff00ff00); + } + } + } else { + if (a.a[gl_SubgroupID] % 2 == 0) return; + } + + b.b[idx] = subgroupElect() ? 1 : 0; +} +END + +SHADER compute fill GLSL TARGET_ENV spv1.3 +#version 450 core +#extension GL_KHR_shader_subgroup_basic : enable +#extension GL_KHR_shader_subgroup_ballot : enable +layout(local_size_x = 119, local_size_y = 1, local_size_z = 1) in; + +layout(set=0, binding=0) coherent buffer A { uint a[]; } a; +layout(set=0, binding=1) coherent buffer C { uint c[]; } c; +layout(set=0, binding=2) coherent buffer COMPARE { uint x[]; } compare; + +void main() +{ + uint idx = gl_SubgroupID * gl_SubgroupSize + gl_SubgroupInvocationID; + uint cmp_val = subgroupElect() ? 1 : 0; + if (gl_SubgroupID % 2 == 0) { + cmp_val = 4; + } + compare.x[idx] = cmp_val; + + uint c_val = c.c[idx]; + if (a.a[idx] < 128) { + if (gl_SubgroupID % 2 == 0) { + c_val = 1; + } else { + c_val = gl_SubgroupInvocationID % 4; + if (c_val == 1) c_val += 4; + } + } else if (a.a[idx] < 192) { + if (gl_SubgroupInvocationID == 0 && gl_SubgroupID % 2 == 0) { + c_val = 0; + } else { + c_val = c_val + 1; + } + } + c.c[idx] = c_val; +} +END + +BUFFER a DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER b DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER c DATA_TYPE uint32 SIZE 119 SERIES_FROM 0 INC_BY 1 +BUFFER d DATA_TYPE uint32 SIZE 119 FILL 4 +BUFFER compare DATA_TYPE uint32 SIZE 119 FILL 4 + +PIPELINE compute fill_pipe + ATTACH fill + SUBGROUP fill + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER compare AS storage DESCRIPTOR_SET 0 BINDING 2 +END + +PIPELINE compute test_pipe + ATTACH test + SUBGROUP test + FULLY_POPULATED on + END + + BIND BUFFER a AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER b AS storage DESCRIPTOR_SET 0 BINDING 1 + BIND BUFFER c AS storage DESCRIPTOR_SET 0 BINDING 2 + BIND BUFFER d AS storage DESCRIPTOR_SET 0 BINDING 3 +END + +RUN fill_pipe 1 1 1 +RUN test_pipe 1 1 1 + +EXPECT compare IDX 0 EQ 4 4 4 4 +EXPECT b EQ_BUFFER compare + diff --git a/vulkan/amber/tessellation/tess_factor_barrier_bug.amber b/vulkan/amber/tessellation/tess_factor_barrier_bug.amber new file mode 100644 index 0000000..a6acbd8 --- /dev/null +++ b/vulkan/amber/tessellation/tess_factor_barrier_bug.amber @@ -0,0 +1,132 @@ +#!amber +DEVICE_FEATURE tessellationShader +DEVICE_FEATURE vertexPipelineStoresAndAtomics + +SHADER vertex vert GLSL +#version 450 core + +layout(set = 0, binding = 0) buffer coherent block { + uint ssbo_val; +}; + +layout(location=0) in vec2 position; +layout(location=0) out uint patch_index; + +void main() { + gl_Position = vec4(position, 0.0, 1.0); + patch_index = gl_InstanceIndex; + + /* + * RADV groups TCS wave in workgroups similar to compute ones. + * + * This test assumes that the TCS workgroup has at most 256 invocations (64 patches). Try to + * cause the first wave of the workgroup to start the TCS much later than ones which write + * non-zero factors. + * + * This loop makes the test much more likely to fail. + */ + uint wave32_in_workgroup = patch_index % 64u / 8u; + uint threshold = patch_index / 64u % 8u; + if (wave32_in_workgroup <= threshold) { + /*for (uint i = 0; i < 8192; i++) { + patch_index += (i & 0x1) == 0 ? -1 : 1; + }*/ + for (uint i = 0; i < 512; i++) + atomicAdd(ssbo_val, i); + } +} +END + +SHADER tessellation_control tesc GLSL +#version 450 core + +/* + * For the workgroup barriers to be optimized to wave ones, each TCS output patch must be part of a + * single wave. + */ +layout(vertices = 4) out; + +layout(location=0) in uint patch_index_in[]; + +void main() { + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; + + /* The compiler must either know that all invocations define tessellation levels or that a + * workgroup barrier exists. This test ensures that both are true. + */ + barrier(); + + /* + * We assume that the TCS workgroup has 256 invocations (64 patches). All waves in the workgroup + * will discard all patches except for the last. If the timing is right, the bug causes the + * factors of the last wave to be dismissed when determining whether all waves in the workgroup + * write zero as a factor. + */ + uint patch_index = patch_index_in[gl_InvocationID]; + uint wave32_in_workgroup = patch_index % 64u / 8u; + if (wave32_in_workgroup == 7) { + uint index_in_wave32 = patch_index % 8u; + uint workgroup_index = patch_index / 64u; + uint index = (workgroup_index * 8u) + index_in_wave32; + uint grid_size = 256; + vec2 pos = (vec2(index % grid_size, index / grid_size) + gl_out[gl_InvocationID].gl_Position.xy); + gl_out[gl_InvocationID].gl_Position.xy = pos / float(grid_size) * 2.0 - 1.0; + + gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0); + } else { + gl_TessLevelOuter = float[4](0.0, 0.0, 0.0, 0.0); + } + gl_TessLevelInner = float[2](0.0, 0.0); +} +END + +SHADER tessellation_evaluation tese GLSL +#version 450 core + +layout(quads) in; + +void main() { + vec4 low = mix(gl_in[0].gl_Position, gl_in[1].gl_Position, gl_TessCoord[0]); + vec4 high = mix(gl_in[3].gl_Position, gl_in[2].gl_Position, gl_TessCoord[0]); + gl_Position = mix(low, high, gl_TessCoord[1]); +} +END + +SHADER fragment frag GLSL +#version 450 core + +layout(location = 0) out vec4 color; + +void main() { + color = vec4(0.502, 1.0, 0.502, 1.0); +} +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +BUFFER buf DATA_TYPE int32 DATA 0 END + +BUFFER position_buf DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +PIPELINE graphics pipeline + ATTACH vert + ATTACH tesc + ATTACH tese + ATTACH frag + PATCH_CONTROL_POINTS 4 + BIND BUFFER buf AS storage DESCRIPTOR_SET 0 BINDING 0 + VERTEX_DATA position_buf LOCATION 0 + FRAMEBUFFER_SIZE 128 128 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 0 255 +CLEAR pipeline +# 64 * 64 * 8 (64x64 grid, only 1/8 instances are not discarded) +RUN pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 4 START_INSTANCE 0 INSTANCE_COUNT 524288 +EXPECT framebuffer IDX 0 0 SIZE 128 128 EQ_RGBA 128 255 128 255 diff --git a/vulkan/amber/texture/conversion/snorm_clamp/a2b10g10r10-snorm-pack32.amber b/vulkan/amber/texture/conversion/snorm_clamp/a2b10g10r10-snorm-pack32.amber new file mode 100644 index 0000000..d517cbd --- /dev/null +++ b/vulkan/amber/texture/conversion/snorm_clamp/a2b10g10r10-snorm-pack32.amber @@ -0,0 +1,51 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 4; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +# The fill value has the most significant bit enabled for each component. +IMAGE texture FORMAT A2B10G10R10_SNORM_PACK32 DIM_1D WIDTH 1 FILL 2684879360 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/conversion/snorm_clamp/a2r10g10b10-snorm-pack32.amber b/vulkan/amber/texture/conversion/snorm_clamp/a2r10g10b10-snorm-pack32.amber new file mode 100644 index 0000000..271b445 --- /dev/null +++ b/vulkan/amber/texture/conversion/snorm_clamp/a2r10g10b10-snorm-pack32.amber @@ -0,0 +1,51 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 4; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +# The fill value has the most significant bit enabled for each component. +IMAGE texture FORMAT A2R10G10B10_SNORM_PACK32 DIM_1D WIDTH 1 FILL 2684879360 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/conversion/snorm_clamp/a8b8g8r8-snorm-pack32.amber b/vulkan/amber/texture/conversion/snorm_clamp/a8b8g8r8-snorm-pack32.amber new file mode 100644 index 0000000..1b9f5bb --- /dev/null +++ b/vulkan/amber/texture/conversion/snorm_clamp/a8b8g8r8-snorm-pack32.amber @@ -0,0 +1,51 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 4; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +# The fill value has the most significant bit enabled for each component. +IMAGE texture FORMAT A8B8G8R8_SNORM_PACK32 DIM_1D WIDTH 1 FILL 2155905152 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/conversion/snorm_clamp/b8g8r8-snorm.amber b/vulkan/amber/texture/conversion/snorm_clamp/b8g8r8-snorm.amber new file mode 100644 index 0000000..b46007c --- /dev/null +++ b/vulkan/amber/texture/conversion/snorm_clamp/b8g8r8-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 3; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT B8G8R8_SNORM DIM_1D WIDTH 1 FILL -128 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/conversion/snorm_clamp/b8g8r8a8-snorm.amber b/vulkan/amber/texture/conversion/snorm_clamp/b8g8r8a8-snorm.amber new file mode 100644 index 0000000..e849aea --- /dev/null +++ b/vulkan/amber/texture/conversion/snorm_clamp/b8g8r8a8-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 4; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT B8G8R8A8_SNORM DIM_1D WIDTH 1 FILL -128 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/conversion/snorm_clamp/r16-snorm.amber b/vulkan/amber/texture/conversion/snorm_clamp/r16-snorm.amber new file mode 100644 index 0000000..20df541 --- /dev/null +++ b/vulkan/amber/texture/conversion/snorm_clamp/r16-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 1; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R16_SNORM DIM_1D WIDTH 1 FILL -32768 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/conversion/snorm_clamp/r16g16-snorm.amber b/vulkan/amber/texture/conversion/snorm_clamp/r16g16-snorm.amber new file mode 100644 index 0000000..15fe4ec --- /dev/null +++ b/vulkan/amber/texture/conversion/snorm_clamp/r16g16-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 2; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R16G16_SNORM DIM_1D WIDTH 1 FILL -32768 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/conversion/snorm_clamp/r16g16b16-snorm.amber b/vulkan/amber/texture/conversion/snorm_clamp/r16g16b16-snorm.amber new file mode 100644 index 0000000..7575ef4 --- /dev/null +++ b/vulkan/amber/texture/conversion/snorm_clamp/r16g16b16-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 3; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R16G16B16_SNORM DIM_1D WIDTH 1 FILL -32768 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/conversion/snorm_clamp/r16g16b16a16-snorm.amber b/vulkan/amber/texture/conversion/snorm_clamp/r16g16b16a16-snorm.amber new file mode 100644 index 0000000..6a8dcfb --- /dev/null +++ b/vulkan/amber/texture/conversion/snorm_clamp/r16g16b16a16-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 4; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R16G16B16A16_SNORM DIM_1D WIDTH 1 FILL -32768 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/conversion/snorm_clamp/r8-snorm.amber b/vulkan/amber/texture/conversion/snorm_clamp/r8-snorm.amber new file mode 100644 index 0000000..50ae6ca --- /dev/null +++ b/vulkan/amber/texture/conversion/snorm_clamp/r8-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 1; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R8_SNORM DIM_1D WIDTH 1 FILL -128 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/conversion/snorm_clamp/r8g8-snorm.amber b/vulkan/amber/texture/conversion/snorm_clamp/r8g8-snorm.amber new file mode 100644 index 0000000..f310950 --- /dev/null +++ b/vulkan/amber/texture/conversion/snorm_clamp/r8g8-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 2; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R8G8_SNORM DIM_1D WIDTH 1 FILL -128 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/conversion/snorm_clamp/r8g8b8-snorm.amber b/vulkan/amber/texture/conversion/snorm_clamp/r8g8b8-snorm.amber new file mode 100644 index 0000000..d7b9997 --- /dev/null +++ b/vulkan/amber/texture/conversion/snorm_clamp/r8g8b8-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 3; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R8G8B8_SNORM DIM_1D WIDTH 1 FILL -128 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/conversion/snorm_clamp/r8g8b8a8-snorm.amber b/vulkan/amber/texture/conversion/snorm_clamp/r8g8b8a8-snorm.amber new file mode 100644 index 0000000..0f316dc --- /dev/null +++ b/vulkan/amber/texture/conversion/snorm_clamp/r8g8b8a8-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 4; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R8G8B8A8_SNORM DIM_1D WIDTH 1 FILL -128 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/conversion/ufloat_negative_values/b10g11r11-ufloat-pack32.amber b/vulkan/amber/texture/conversion/ufloat_negative_values/b10g11r11-ufloat-pack32.amber new file mode 100644 index 0000000..0a375d9 --- /dev/null +++ b/vulkan/amber/texture/conversion/ufloat_negative_values/b10g11r11-ufloat-pack32.amber @@ -0,0 +1,73 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER compute compute_shader GLSL +#version 430 +layout(local_size_x=10, local_size_y=10) in; +uniform layout (set=0, binding=0, r11f_g11f_b10f) image2D texture; + +void main () +{ + ivec2 uv = ivec2(gl_GlobalInvocationID.xy); + vec4 color = vec4(uv.x - uv.y, uv.y, -uv.y, 1); + imageStore(texture, uv, color); +} +END + +SHADER compute compute_shader_verify GLSL +#version 430 +layout(local_size_x=1, local_size_y=1) in; +uniform layout (set=0, binding=0, r11f_g11f_b10f) image2D texture; +layout(binding = 1) buffer Buf1 +{ + int result; +}; + +void main () +{ + result = 1; + + for (int y = 0; y < 50; y++) + for (int x = 0; x < 50; x++) + { + ivec2 uv = ivec2(x, y); + vec4 color = imageLoad(texture, uv); + // Conversion to tiny float should clamp negative values to zero, + // thus the max operation here. + vec4 ref = max(vec4(uv.x - uv.y, uv.y, -uv.y, 1), vec4(0)); + + if (color != ref) + result = 0; + } +} +END + +IMAGE texture FORMAT B10G11R11_UFLOAT_PACK32 DIM_2D WIDTH 50 HEIGHT 50 FILL 0 +BUFFER result DATA_TYPE int32 SIZE 1 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 +END + +PIPELINE compute verify + ATTACH compute_shader_verify + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 5 5 1 +RUN verify 1 1 1 +EXPECT result IDX 0 EQ 1 diff --git a/vulkan/amber/texture/multisample/atomic/storage_image_r32i.amber b/vulkan/amber/texture/multisample/atomic/storage_image_r32i.amber new file mode 100644 index 0000000..aa38b2b --- /dev/null +++ b/vulkan/amber/texture/multisample/atomic/storage_image_r32i.amber @@ -0,0 +1,98 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderStorageImageMultisample + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 16, local_size_y = 16) in; +uniform layout(set=0, binding=0, r32i) iimage2DMS texture; +uniform layout(set=0, binding=1, rgba8) image2D result; + +void main() +{ + ivec2 loc = ivec2(gl_LocalInvocationID.xy); + // Partner location is a mirror in local workgroup space. + ivec2 partnerLoc = ivec2(15) - loc; + int id = loc.y * 16 + loc.x; + int partnerId = partnerLoc.y * 16 + partnerLoc.x; + ivec2 workGroupOffset = ivec2(gl_WorkGroupID.xy) * ivec2(16); + + // Initialize texture with id + sample id + for (int s = 0; s < 4; s++) + imageStore(texture, loc + workGroupOffset, s, ivec4(s + id)); + + memoryBarrierImage(); + barrier(); + + for (int s = 0; s < 4; s++) + { + // Add id to both location and partner location. + imageAtomicAdd(texture, loc + workGroupOffset, s, id); + imageAtomicAdd(texture, partnerLoc + workGroupOffset, s, id); + + // Set MSB for location and the second MSB for partner. + imageAtomicOr(texture, loc + workGroupOffset, s, 1 << 31); + imageAtomicOr(texture, partnerLoc + workGroupOffset, s, 1 << 30); + } + + memoryBarrierImage(); + barrier(); + + for (int s = 0; s < 4; s++) + { + // XOR with two patterns in the second highest byte. Should set this + // byte to 0xc. The order of XOR operations don't matter. + imageAtomicXor(texture, loc + workGroupOffset, s, 0x0a000000); + imageAtomicXor(texture, partnerLoc + workGroupOffset, s, 0x06000000); + } + + memoryBarrierImage(); + barrier(); + + for (int s = 0; s < 4; s++) + { + // Finally mask out one of LSBs based on sample + imageAtomicAnd(texture, loc + workGroupOffset, s, ~(1 << s)); + } + + // Verification + bool ok = true; + + for (int s = 0; s < 4; s++) + { + if (imageLoad(texture, loc + workGroupOffset, s).r != (((s + id * 2 + partnerId) | 0xcc000000) & ~(1 << s))) + ok = false; + } + + vec4 color = ok ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); + imageStore(result, loc + workGroupOffset, color); +} +END + +IMAGE texture FORMAT R32_SINT DIM_2D WIDTH 64 HEIGHT 64 SAMPLES 4 +IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 4 4 1 + +EXPECT result IDX 0 0 SIZE 64 64 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/multisample/atomic/storage_image_r32ui.amber b/vulkan/amber/texture/multisample/atomic/storage_image_r32ui.amber new file mode 100644 index 0000000..8d2c584 --- /dev/null +++ b/vulkan/amber/texture/multisample/atomic/storage_image_r32ui.amber @@ -0,0 +1,98 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderStorageImageMultisample + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 16, local_size_y = 16) in; +uniform layout(set=0, binding=0, r32ui) uimage2DMS texture; +uniform layout(set=0, binding=1, rgba8) image2D result; + +void main() +{ + ivec2 loc = ivec2(gl_LocalInvocationID.xy); + // Partner location is a mirror in local workgroup space. + ivec2 partnerLoc = ivec2(15) - loc; + uint id = loc.y * 16 + loc.x; + uint partnerId = partnerLoc.y * 16 + partnerLoc.x; + ivec2 workGroupOffset = ivec2(gl_WorkGroupID.xy) * ivec2(16); + + // Initialize texture with id + sample id + for (int s = 0; s < 4; s++) + imageStore(texture, loc + workGroupOffset, s, uvec4(s + id)); + + memoryBarrierImage(); + barrier(); + + for (int s = 0; s < 4; s++) + { + // Add id to both location and partner location. + imageAtomicAdd(texture, loc + workGroupOffset, s, id); + imageAtomicAdd(texture, partnerLoc + workGroupOffset, s, id); + + // Set MSB for location and the second MSB for partner. + imageAtomicOr(texture, loc + workGroupOffset, s, 1u << 31); + imageAtomicOr(texture, partnerLoc + workGroupOffset, s, 1u << 30); + } + + memoryBarrierImage(); + barrier(); + + for (int s = 0; s < 4; s++) + { + // XOR with two patterns in the second highest byte. Should set this + // byte to 0xc. The order of XOR operations don't matter. + imageAtomicXor(texture, loc + workGroupOffset, s, 0x0a000000); + imageAtomicXor(texture, partnerLoc + workGroupOffset, s, 0x06000000); + } + + memoryBarrierImage(); + barrier(); + + for (int s = 0; s < 4; s++) + { + // Finally mask out one of LSBs based on sample + imageAtomicAnd(texture, loc + workGroupOffset, s, ~(1u << s)); + } + + // Verification + bool ok = true; + + for (int s = 0; s < 4; s++) + { + if (imageLoad(texture, loc + workGroupOffset, s).r != (((s + id * 2 + partnerId) | 0xcc000000) & ~(1u << s))) + ok = false; + } + + vec4 color = ok ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); + imageStore(result, loc + workGroupOffset, color); +} +END + +IMAGE texture FORMAT R32_UINT DIM_2D WIDTH 64 HEIGHT 64 SAMPLES 4 +IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 4 4 1 + +EXPECT result IDX 0 0 SIZE 64 64 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/multisample/atomic/storage_image_r64i.amber b/vulkan/amber/texture/multisample/atomic/storage_image_r64i.amber new file mode 100644 index 0000000..bf3cc29 --- /dev/null +++ b/vulkan/amber/texture/multisample/atomic/storage_image_r64i.amber @@ -0,0 +1,101 @@ +#!amber +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderStorageImageMultisample +DEVICE_FEATURE shaderInt64 + +SHADER compute compute_shader GLSL +#version 430 +#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require +#extension GL_EXT_shader_image_int64 : require + +layout(local_size_x = 16, local_size_y = 16) in; +uniform layout(set=0, binding=0, r64i) i64image2DMS texture; +uniform layout(set=0, binding=1, rgba8) image2D result; + +void main() +{ + ivec2 loc = ivec2(gl_LocalInvocationID.xy); + // Partner location is a mirror in local workgroup space. + ivec2 partnerLoc = ivec2(15) - loc; + int id = loc.y * 16 + loc.x; + int partnerId = partnerLoc.y * 16 + partnerLoc.x; + ivec2 workGroupOffset = ivec2(gl_WorkGroupID.xy) * ivec2(16); + + // Initialize texture with id + sample id + for (int s = 0; s < 4; s++) + imageStore(texture, loc + workGroupOffset, s, ivec4(int64_t(s + id))); + + memoryBarrierImage(); + barrier(); + + for (int s = 0; s < 4; s++) + { + // Add id to both location and partner location. + imageAtomicAdd(texture, loc + workGroupOffset, s, int64_t(id)); + imageAtomicAdd(texture, partnerLoc + workGroupOffset, s, int64_t(id)); + + // Set MSB for location and the second MSB for partner. + imageAtomicOr(texture, loc + workGroupOffset, s, int64_t(1) << 63); + imageAtomicOr(texture, partnerLoc + workGroupOffset, s, int64_t(1) << 62); + } + + memoryBarrierImage(); + barrier(); + + for (int s = 0; s < 4; s++) + { + // XOR with two patterns in the second highest byte. Should set this + // byte to 0xc. The order of XOR operations don't matter. + imageAtomicXor(texture, loc + workGroupOffset, s, 0x0a00000000000000L); + imageAtomicXor(texture, partnerLoc + workGroupOffset, s, 0x0600000000000000L); + } + + memoryBarrierImage(); + barrier(); + + for (int s = 0; s < 4; s++) + { + // Finally mask out one of LSBs based on sample + imageAtomicAnd(texture, loc + workGroupOffset, s, ~(int64_t(1) << s)); + } + + // Verification + bool ok = true; + + for (int s = 0; s < 4; s++) + { + if (imageLoad(texture, loc + workGroupOffset, s).r != int64_t(((s + id * 2 + partnerId) | 0x0a00000000000000L) & ~(int64_t(1) << s))) + ok = false; + } + + vec4 color = ok ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); + imageStore(result, loc + workGroupOffset, color); +} +END + +IMAGE texture FORMAT R64_SINT DIM_2D WIDTH 64 HEIGHT 64 SAMPLES 4 +IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 4 4 1 + +EXPECT result IDX 0 0 SIZE 64 64 EQ_RGBA 0 255 0 255 \ No newline at end of file diff --git a/vulkan/amber/texture/multisample/atomic/storage_image_r64ui.amber b/vulkan/amber/texture/multisample/atomic/storage_image_r64ui.amber new file mode 100644 index 0000000..e9b0b4f --- /dev/null +++ b/vulkan/amber/texture/multisample/atomic/storage_image_r64ui.amber @@ -0,0 +1,90 @@ +#!amber +# See the License for the specific language governing permissions and +# limitations under the License. + +DEVICE_FEATURE shaderStorageImageMultisample +DEVICE_FEATURE shaderInt64 + +SHADER compute compute_shader GLSL +#version 430 +#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require +#extension GL_EXT_shader_image_int64 : require + +layout(local_size_x = 16, local_size_y = 16) in; +uniform layout(set=0, binding=0, r64ui) u64image2DMS texture; +uniform layout(set=0, binding=1, rgba8) image2D result; + +void main() +{ + ivec2 loc = ivec2(gl_LocalInvocationID.xy); + // Partner location is a mirror in local workgroup space. + ivec2 partnerLoc = ivec2(15) - loc; + int id = loc.y * 16 + loc.x; + int partnerId = partnerLoc.y * 16 + partnerLoc.x; + ivec2 workGroupOffset = ivec2(gl_WorkGroupID.xy) * ivec2(16); + + // Initialize texture with id + sample id + for (int s = 0; s < 4; s++) + imageStore(texture, loc + workGroupOffset, s, uvec4(uint64_t(s + id))); + + memoryBarrierImage(); + barrier(); + + for (int s = 0; s < 4; s++) + { + // Add id to both location and partner location. + imageAtomicAdd(texture, loc + workGroupOffset, s, uint64_t(id)); + imageAtomicAdd(texture, partnerLoc + workGroupOffset, s, uint64_t(id)); + + // Set MSB for location and the second MSB for partner. + imageAtomicOr(texture, loc + workGroupOffset, s, uint64_t(1) << 63); + imageAtomicOr(texture, partnerLoc + workGroupOffset, s, uint64_t(1) << 62); + } + + memoryBarrierImage(); + barrier(); + + for (int s = 0; s < 4; s++) + { + // XOR with two patterns in the second highest byte. Should set this + // byte to 0xc. The order of XOR operations don't matter. + imageAtomicXor(texture, loc + workGroupOffset, s, 0x0a00000000000000L); + imageAtomicXor(texture, partnerLoc + workGroupOffset, s, 0x0600000000000000L); + } + + memoryBarrierImage(); + barrier(); + + for (int s = 0; s < 4; s++) + { + // Finally mask out one of LSBs based on sample + imageAtomicAnd(texture, loc + workGroupOffset, s, ~(uint64_t(1) << s)); + } + + // Verification + bool ok = true; + + for (int s = 0; s < 4; s++) + { + if (imageLoad(texture, loc + workGroupOffset, s).r != uint64_t(((s + id * 2 + partnerId) | 0x0a00000000000000L) & ~(uint64_t(1) << s))) + ok = false; + } + + vec4 color = ok ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); + imageStore(result, loc + workGroupOffset, color); +} +END + +IMAGE texture FORMAT R64_UINT DIM_2D WIDTH 64 HEIGHT 64 SAMPLES 4 +IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 4 4 1 + +EXPECT result IDX 0 0 SIZE 64 64 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_16.amber b/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_16.amber new file mode 100644 index 0000000..85052ba --- /dev/null +++ b/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_16.amber @@ -0,0 +1,89 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Write to an invalid sample index test +# Sample Count: 16 +# Tested Sample Min: -256 +# Tested Sample Max: 256 +# Description: All writes to invalid sample numbers should be discarded. + +DEVICE_FEATURE shaderStorageImageMultisample + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 16, local_size_y = 16) in; + +uniform layout(set=0, binding=0, rgba8) image2DMS texture; +uniform layout(set=0, binding=1, rgba8) image2D result; + + +void main() +{ + int numSamples = 16; + int distortion = 256; + vec4 ndxColors[4]; + + ndxColors[0] = vec4(1.0, 0.0, 0.0, 1.0); + ndxColors[1] = vec4(0.0, 1.0, 0.0, 1.0); + ndxColors[2] = vec4(0.0, 0.0, 1.0, 1.0); + ndxColors[3] = vec4(0.0, 1.0, 1.0, 1.0); + + ivec2 uv = ivec2(gl_GlobalInvocationID.xy); + + // Initialize texture + for (int s = -distortion; s < distortion; s++) + { + vec4 color = vec4(1); + + if (s >= 0 && s < numSamples) color = ndxColors[s % 4]; + + imageStore(texture, uv, s, color); + } + + memoryBarrierImage(); + barrier(); + + // Verification + bool imageOk = true; + + for (int s = 0; s < numSamples; s++) + { + vec4 color = vec4(1); + + if (s >= 0 && s < numSamples) color = ndxColors[s % 4]; + + if (imageLoad(texture, uv, s) != color) + imageOk = false; + } + + vec4 resultColor = imageOk ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); + imageStore(result, uv, resultColor); +} +END + +IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 SAMPLES 16 +IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT result IDX 0 0 SIZE 16 16 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_2.amber b/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_2.amber new file mode 100644 index 0000000..0de9d9f --- /dev/null +++ b/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_2.amber @@ -0,0 +1,87 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Write to an invalid sample index test +# Sample Count: 2 +# Tested Sample Min: -256 +# Tested Sample Max: 256 +# Description: All writes to invalid sample numbers should be discarded. + +DEVICE_FEATURE shaderStorageImageMultisample + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 16, local_size_y = 16) in; + +uniform layout(set=0, binding=0, rgba8) image2DMS texture; +uniform layout(set=0, binding=1, rgba8) image2D result; + + +void main() +{ + int numSamples = 2; + int distortion = 256; + vec4 ndxColors[2]; + + ndxColors[0] = vec4(1.0, 0.0, 1.0, 1.0); + ndxColors[1] = vec4(0.0, 1.0, 1.0, 1.0); + + ivec2 uv = ivec2(gl_GlobalInvocationID.xy); + + // Initialize texture + for (int s = -distortion; s < distortion; s++) + { + vec4 color = vec4(1); + + if (s >= 0 && s < numSamples) color = ndxColors[s % 2]; + + imageStore(texture, uv, s, color); + } + + memoryBarrierImage(); + barrier(); + + // Verification + bool imageOk = true; + + for (int s = 0; s < numSamples; s++) + { + vec4 color = vec4(1); + + if (s >= 0 && s < numSamples) color = ndxColors[s % 2]; + + if (imageLoad(texture, uv, s) != color) + imageOk = false; + } + + vec4 resultColor = imageOk ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); + imageStore(result, uv, resultColor); +} +END + +IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 SAMPLES 2 +IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT result IDX 0 0 SIZE 16 16 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_32.amber b/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_32.amber new file mode 100644 index 0000000..a13b112 --- /dev/null +++ b/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_32.amber @@ -0,0 +1,89 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Write to an invalid sample number test +# Sample Count: 32 +# Tested Sample Min: -256 +# Tested Sample Max: 256 +# Description: All writes to invalid sample numbers should be discarded. + +DEVICE_FEATURE shaderStorageImageMultisample + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 16, local_size_y = 16) in; + +uniform layout(set=0, binding=0, rgba8) image2DMS texture; +uniform layout(set=0, binding=1, rgba8) image2D result; + + +void main() +{ + int numSamples = 32; + int distortion = 256; + vec4 ndxColors[4]; + + ndxColors[0] = vec4(1.0, 0.0, 0.0, 1.0); + ndxColors[1] = vec4(0.0, 1.0, 0.0, 1.0); + ndxColors[2] = vec4(0.0, 0.0, 1.0, 1.0); + ndxColors[3] = vec4(0.0, 1.0, 1.0, 1.0); + + ivec2 uv = ivec2(gl_GlobalInvocationID.xy); + + // Initialize texture + for (int s = -distortion; s < distortion; s++) + { + vec4 color = vec4(1); + + if (s >= 0 && s < numSamples) color = ndxColors[s % 4]; + + imageStore(texture, uv, s, color); + } + + memoryBarrierImage(); + barrier(); + + // Verification + bool imageOk = true; + + for (int s = 0; s < numSamples; s++) + { + vec4 color = vec4(1); + + if (s >= 0 && s < numSamples) color = ndxColors[s % 4]; + + if (imageLoad(texture, uv, s) != color) + imageOk = false; + } + + vec4 resultColor = imageOk ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); + imageStore(result, uv, resultColor); +} +END + +IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 SAMPLES 32 +IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT result IDX 0 0 SIZE 16 16 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_4.amber b/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_4.amber new file mode 100644 index 0000000..c89f2fe --- /dev/null +++ b/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_4.amber @@ -0,0 +1,89 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Write to an invalid sample index test +# Sample Count: 4 +# Tested Sample Min: -256 +# Tested Sample Max: 256 +# Description: All writes to invalid sample numbers should be discarded. + +DEVICE_FEATURE shaderStorageImageMultisample + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 16, local_size_y = 16) in; + +uniform layout(set=0, binding=0, rgba8) image2DMS texture; +uniform layout(set=0, binding=1, rgba8) image2D result; + + +void main() +{ + int numSamples = 4; + int distortion = 256; + vec4 ndxColors[4]; + + ndxColors[0] = vec4(1.0, 0.0, 0.0, 1.0); + ndxColors[1] = vec4(0.0, 1.0, 0.0, 1.0); + ndxColors[2] = vec4(0.0, 0.0, 1.0, 1.0); + ndxColors[3] = vec4(0.0, 1.0, 1.0, 1.0); + + ivec2 uv = ivec2(gl_GlobalInvocationID.xy); + + // Initialize texture + for (int s = -distortion; s < distortion; s++) + { + vec4 color = vec4(1); + + if (s >= 0 && s < numSamples) color = ndxColors[s % 4]; + + imageStore(texture, uv, s, color); + } + + memoryBarrierImage(); + barrier(); + + // Verification + bool imageOk = true; + + for (int s = 0; s < numSamples; s++) + { + vec4 color = vec4(1); + + if (s >= 0 && s < numSamples) color = ndxColors[s % 4]; + + if (imageLoad(texture, uv, s) != color) + imageOk = false; + } + + vec4 resultColor = imageOk ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); + imageStore(result, uv, resultColor); +} +END + +IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 SAMPLES 4 +IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT result IDX 0 0 SIZE 16 16 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_64.amber b/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_64.amber new file mode 100644 index 0000000..cdb5649 --- /dev/null +++ b/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_64.amber @@ -0,0 +1,89 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Write to an invalid sample number test +# Sample Count: 64 +# Tested Sample Min: -256 +# Tested Sample Max: 256 +# Description: All writes to invalid sample numbers should be discarded. + +DEVICE_FEATURE shaderStorageImageMultisample + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 16, local_size_y = 16) in; + +uniform layout(set=0, binding=0, rgba8) image2DMS texture; +uniform layout(set=0, binding=1, rgba8) image2D result; + + +void main() +{ + int numSamples = 64; + int distortion = 256; + vec4 ndxColors[4]; + + ndxColors[0] = vec4(1.0, 0.0, 0.0, 1.0); + ndxColors[1] = vec4(0.0, 1.0, 0.0, 1.0); + ndxColors[2] = vec4(0.0, 0.0, 1.0, 1.0); + ndxColors[3] = vec4(0.0, 1.0, 1.0, 1.0); + + ivec2 uv = ivec2(gl_GlobalInvocationID.xy); + + // Initialize texture + for (int s = -distortion; s < distortion; s++) + { + vec4 color = vec4(1); + + if (s >= 0 && s < numSamples) color = ndxColors[s % 4]; + + imageStore(texture, uv, s, color); + } + + memoryBarrierImage(); + barrier(); + + // Verification + bool imageOk = true; + + for (int s = 0; s < numSamples; s++) + { + vec4 color = vec4(1); + + if (s >= 0 && s < numSamples) color = ndxColors[s % 4]; + + if (imageLoad(texture, uv, s) != color) + imageOk = false; + } + + vec4 resultColor = imageOk ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); + imageStore(result, uv, resultColor); +} +END + +IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 SAMPLES 64 +IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT result IDX 0 0 SIZE 16 16 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_8.amber b/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_8.amber new file mode 100644 index 0000000..ea99bb6 --- /dev/null +++ b/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_8.amber @@ -0,0 +1,89 @@ +#!amber +# Copyright 2021 Google LLC. +# Copyright 2021 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Write to an invalid sample index test +# Sample Count: 8 +# Tested Sample Min: -256 +# Tested Sample Max: 256 +# Description: All writes to invalid sample numbers should be discarded. + +DEVICE_FEATURE shaderStorageImageMultisample + +SHADER compute compute_shader GLSL +#version 430 + +layout(local_size_x = 16, local_size_y = 16) in; + +uniform layout(set=0, binding=0, rgba8) image2DMS texture; +uniform layout(set=0, binding=1, rgba8) image2D result; + + +void main() +{ + int numSamples = 8; + int distortion = 256; + vec4 ndxColors[4]; + + ndxColors[0] = vec4(1.0, 0.0, 0.0, 1.0); + ndxColors[1] = vec4(0.0, 1.0, 0.0, 1.0); + ndxColors[2] = vec4(0.0, 0.0, 1.0, 1.0); + ndxColors[3] = vec4(0.0, 1.0, 1.0, 1.0); + + ivec2 uv = ivec2(gl_GlobalInvocationID.xy); + + // Initialize texture + for (int s = -distortion; s < distortion; s++) + { + vec4 color = vec4(1); + + if (s >= 0 && s < numSamples) color = ndxColors[s % 4]; + + imageStore(texture, uv, s, color); + } + + memoryBarrierImage(); + barrier(); + + // Verification + bool imageOk = true; + + for (int s = 0; s < numSamples; s++) + { + vec4 color = vec4(1); + + if (s >= 0 && s < numSamples) color = ndxColors[s % 4]; + + if (imageLoad(texture, uv, s) != color) + imageOk = false; + } + + vec4 resultColor = imageOk ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); + imageStore(result, uv, resultColor); +} +END + +IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 SAMPLES 8 +IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 FILL 0 + +PIPELINE compute pipeline + ATTACH compute_shader + BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT result IDX 0 0 SIZE 16 16 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/shadow/texel_replacement/d32_sfloat.amber b/vulkan/amber/texture/shadow/texel_replacement/d32_sfloat.amber new file mode 100644 index 0000000..ac23211 --- /dev/null +++ b/vulkan/amber/texture/shadow/texel_replacement/d32_sfloat.amber @@ -0,0 +1,51 @@ +#!amber + +# Copyright 2022 Google LLC. +# Copyright 2022 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) sampler2DShadow tex; +void main() +{ + // Sample border color of opaque white which makes the depth comparison 0.5 > 1.0 false. + color_out = vec4(texture(tex, vec3(2.0, 2.0, 0.5)), 0.0, 0.0, 1.0); +} +END + +IMAGE texture FORMAT D32_SFLOAT DIM_2D WIDTH 32 HEIGHT 32 FILL 0.0 +IMAGE framebuffer FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 + +SAMPLER sampler_float_opaque_white \ + ADDRESS_MODE_U clamp_to_border \ + ADDRESS_MODE_V clamp_to_border \ + BORDER_COLOR float_opaque_white \ + COMPARE on \ + COMPARE_OP greater + +PIPELINE graphics pipeline_float_opaque_white + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler_float_opaque_white DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 32 32 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline_float_opaque_white DRAW_RECT POS 0 0 SIZE 32 32 + +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 0 0 255 diff --git a/vulkan/amber/texture/subgroup_lod/texel_fetch.amber b/vulkan/amber/texture/subgroup_lod/texel_fetch.amber new file mode 100644 index 0000000..a32a610 --- /dev/null +++ b/vulkan/amber/texture/subgroup_lod/texel_fetch.amber @@ -0,0 +1,105 @@ +#!amber + +# Copyright 2019 Google LLC. +# Copyright 2019 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader_mipclear PASSTHROUGH + +SHADER vertex vert_shader_lod GLSL +#version 430 + +layout(location = 0) in vec3 position_in; +layout(location = 0) out vec4 color_out; +layout(set = 0, binding = 0) uniform highp sampler2D tex; + +void main() { + gl_Position = vec4(position_in, 1.0); + // Pick a color from the center of a mipmap. Each corner point gets its own mip level. + int lod = gl_VertexIndex % 4; + int center = 256 >> lod; + color_out = texelFetch(tex, ivec2(center), lod); +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) in vec4 color_in; +layout(location = 0) out vec4 color_out; + +void main() { + color_out = color_in; +} +END + +BUFFER texture FORMAT B8G8R8A8_UNORM MIP_LEVELS 4 +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +SAMPLER sampler MAX_LOD 4.0 + +PIPELINE graphics mipclear_pipeline0 + ATTACH vert_shader_mipclear + ATTACH frag_shader + BIND BUFFER texture AS color LOCATION 0 BASE_MIP_LEVEL 0 + FRAMEBUFFER_SIZE 512 512 +END + +PIPELINE graphics mipclear_pipeline1 + ATTACH vert_shader_mipclear + ATTACH frag_shader + BIND BUFFER texture AS color LOCATION 0 BASE_MIP_LEVEL 1 + FRAMEBUFFER_SIZE 256 256 +END + +PIPELINE graphics mipclear_pipeline2 + ATTACH vert_shader_mipclear + ATTACH frag_shader + BIND BUFFER texture AS color LOCATION 0 BASE_MIP_LEVEL 2 + FRAMEBUFFER_SIZE 128 128 +END + +PIPELINE graphics mipclear_pipeline3 + ATTACH vert_shader_mipclear + ATTACH frag_shader + BIND BUFFER texture AS color LOCATION 0 BASE_MIP_LEVEL 3 + FRAMEBUFFER_SIZE 64 64 +END + +PIPELINE graphics lod_pipeline + ATTACH vert_shader_lod + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 + FRAMEBUFFER_SIZE 512 512 +END + +# Clear all mip levels to different color. +CLEAR_COLOR mipclear_pipeline0 255 0 0 255 +CLEAR mipclear_pipeline0 +CLEAR_COLOR mipclear_pipeline1 0 255 0 255 +CLEAR mipclear_pipeline1 +CLEAR_COLOR mipclear_pipeline2 0 0 255 255 +CLEAR mipclear_pipeline2 +CLEAR_COLOR mipclear_pipeline3 255 255 0 255 +CLEAR mipclear_pipeline3 + +CLEAR_COLOR lod_pipeline 0 0 0 255 +CLEAR lod_pipeline +RUN lod_pipeline DRAW_RECT POS 0 0 SIZE 512 512 + +# Check corners of the frame buffer: each should have a color from a different mip level. +EXPECT framebuffer IDX 0 511 SIZE 1 1 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 511 0 SIZE 1 1 EQ_RGBA 255 255 0 255 +EXPECT framebuffer IDX 511 511 SIZE 1 1 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/subgroup_lod/texture_grad.amber b/vulkan/amber/texture/subgroup_lod/texture_grad.amber new file mode 100644 index 0000000..d7648bc --- /dev/null +++ b/vulkan/amber/texture/subgroup_lod/texture_grad.amber @@ -0,0 +1,90 @@ +#!amber + +# Copyright 2019 Google LLC. +# Copyright 2019 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader_mipclear PASSTHROUGH + +SHADER vertex vert_shader_lod GLSL +#version 430 + +layout(location = 0) in vec3 position_in; +layout(location = 0) out vec4 color_out; +layout(set = 0, binding = 0) uniform highp sampler2D tex; + +void main() { + gl_Position = vec4(position_in, 1.0); + // Vary dPdx and dPdy based on vertex index to force + // LOD 0 or LOD 1. + vec2 v = vec2(0); + if (gl_VertexIndex % 2 != 0) + v = vec2(1); + + color_out = vec4(textureGrad(tex, vec2(0.5), v, v)); +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) in vec4 color_in; +layout(location = 0) out vec4 color_out; + +void main() { + color_out = color_in; +} +END + +BUFFER texture FORMAT B8G8R8A8_UNORM MIP_LEVELS 2 +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +SAMPLER sampler MAX_LOD 2.0 + +PIPELINE graphics mipclear_pipeline0 + ATTACH vert_shader_mipclear + ATTACH frag_shader + BIND BUFFER texture AS color LOCATION 0 BASE_MIP_LEVEL 0 + FRAMEBUFFER_SIZE 512 512 +END + +PIPELINE graphics mipclear_pipeline1 + ATTACH vert_shader_mipclear + ATTACH frag_shader + BIND BUFFER texture AS color LOCATION 0 BASE_MIP_LEVEL 1 + FRAMEBUFFER_SIZE 256 256 +END + +PIPELINE graphics lod_pipeline + ATTACH vert_shader_lod + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 + FRAMEBUFFER_SIZE 512 512 +END + +# Clear all mip levels to different color. +CLEAR_COLOR mipclear_pipeline0 255 0 0 255 +CLEAR mipclear_pipeline0 +CLEAR_COLOR mipclear_pipeline1 0 255 0 255 +CLEAR mipclear_pipeline1 + +CLEAR_COLOR lod_pipeline 0 0 0 255 +CLEAR lod_pipeline +RUN lod_pipeline DRAW_RECT POS 0 0 SIZE 512 512 + +# Check corners of the frame buffer: even vertices should have LOD 0 and odd ones LOD 1. +EXPECT framebuffer IDX 0 511 SIZE 1 1 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 511 0 SIZE 1 1 EQ_RGBA 0 255 0 255 +EXPECT framebuffer IDX 511 511 SIZE 1 1 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/subgroup_lod/texture_lod.amber b/vulkan/amber/texture/subgroup_lod/texture_lod.amber new file mode 100644 index 0000000..dc69213 --- /dev/null +++ b/vulkan/amber/texture/subgroup_lod/texture_lod.amber @@ -0,0 +1,103 @@ +#!amber + +# Copyright 2019 Google LLC. +# Copyright 2019 The Khronos Group Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader_mipclear PASSTHROUGH + +SHADER vertex vert_shader_lod GLSL +#version 430 + +layout(location = 0) in vec3 position_in; +layout(location = 0) out vec4 color_out; +layout(set = 0, binding = 0) uniform highp sampler2D tex; + +void main() { + gl_Position = vec4(position_in, 1.0); + // Pick a color from the center of a mipmap. Each corner point gets its own mip level. + color_out = vec4(textureLod(tex, vec2(0.5), float(gl_VertexIndex % 4))); +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(location = 0) in vec4 color_in; +layout(location = 0) out vec4 color_out; + +void main() { + color_out = color_in; +} +END + +BUFFER texture FORMAT B8G8R8A8_UNORM MIP_LEVELS 4 +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +SAMPLER sampler MAX_LOD 4.0 + +PIPELINE graphics mipclear_pipeline0 + ATTACH vert_shader_mipclear + ATTACH frag_shader + BIND BUFFER texture AS color LOCATION 0 BASE_MIP_LEVEL 0 + FRAMEBUFFER_SIZE 512 512 +END + +PIPELINE graphics mipclear_pipeline1 + ATTACH vert_shader_mipclear + ATTACH frag_shader + BIND BUFFER texture AS color LOCATION 0 BASE_MIP_LEVEL 1 + FRAMEBUFFER_SIZE 256 256 +END + +PIPELINE graphics mipclear_pipeline2 + ATTACH vert_shader_mipclear + ATTACH frag_shader + BIND BUFFER texture AS color LOCATION 0 BASE_MIP_LEVEL 2 + FRAMEBUFFER_SIZE 128 128 +END + +PIPELINE graphics mipclear_pipeline3 + ATTACH vert_shader_mipclear + ATTACH frag_shader + BIND BUFFER texture AS color LOCATION 0 BASE_MIP_LEVEL 3 + FRAMEBUFFER_SIZE 64 64 +END + +PIPELINE graphics lod_pipeline + ATTACH vert_shader_lod + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 + FRAMEBUFFER_SIZE 512 512 +END + +# Clear all mip levels to different color. +CLEAR_COLOR mipclear_pipeline0 255 0 0 255 +CLEAR mipclear_pipeline0 +CLEAR_COLOR mipclear_pipeline1 0 255 0 255 +CLEAR mipclear_pipeline1 +CLEAR_COLOR mipclear_pipeline2 0 0 255 255 +CLEAR mipclear_pipeline2 +CLEAR_COLOR mipclear_pipeline3 255 255 0 255 +CLEAR mipclear_pipeline3 + +CLEAR_COLOR lod_pipeline 0 0 0 255 +CLEAR lod_pipeline +RUN lod_pipeline DRAW_RECT POS 0 0 SIZE 512 512 + +# Check corners of the frame buffer: each should have a color from a different mip level. +EXPECT framebuffer IDX 0 511 SIZE 1 1 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 511 0 SIZE 1 1 EQ_RGBA 255 255 0 255 +EXPECT framebuffer IDX 511 511 SIZE 1 1 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_buffer/uniform/packed/a2b10g10r10-uint-pack32.amber b/vulkan/amber/texture/texel_buffer/uniform/packed/a2b10g10r10-uint-pack32.amber new file mode 100644 index 0000000..8ca866b --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/packed/a2b10g10r10-uint-pack32.amber @@ -0,0 +1,56 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) usamplerBuffer texels; + +void main() +{ + color_out = texelFetch(texels, int(gl_FragCoord.x) % 4); +} +END + +BUFFER texel_buffer DATA_TYPE A2B10G10R10_UINT_PACK32 DATA +0x40000001 # Unpacks to R = 1, G = 0, B = 0, A = 1 +0x40000400 # Unpacks to R = 0, G = 1, B = 0, A = 1 +0x40100000 # Unpacks to R = 0, G = 0, B = 1, A = 1 +0x40100400 # Unpacks to R = 0, G = 1, B = 1, A = 1 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 50 50 SIZE 100 100 + +EXPECT framebuffer IDX 50 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 51 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 52 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 53 50 SIZE 1 100 EQ_RGBA 0 255 0 255 +EXPECT framebuffer IDX 54 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 55 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 56 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 57 50 SIZE 1 100 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_buffer/uniform/packed/a2b10g10r10-unorm-pack32.amber b/vulkan/amber/texture/texel_buffer/uniform/packed/a2b10g10r10-unorm-pack32.amber new file mode 100644 index 0000000..3bd5e01 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/packed/a2b10g10r10-unorm-pack32.amber @@ -0,0 +1,56 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = texelFetch(texels, int(gl_FragCoord.x) % 4); +} +END + +BUFFER texel_buffer DATA_TYPE A2B10G10R10_UNORM_PACK32 DATA +0xc00003ff # Unpacks to R = 1023, G = 0, B = 0, A = 3 +0xc00ffc00 # Unpacks to R = 0, G = 1023, B = 0, A = 3 +0xfff00000 # Unpacks to R = 0, G = 0, B = 1023, A = 3 +0xfffffc00 # Unpacks to R = 0, G = 1023, B = 1023, A = 3 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 50 50 SIZE 100 100 + +EXPECT framebuffer IDX 50 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 51 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 52 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 53 50 SIZE 1 100 EQ_RGBA 0 255 0 255 +EXPECT framebuffer IDX 54 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 55 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 56 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 57 50 SIZE 1 100 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-sint-pack32.amber b/vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-sint-pack32.amber new file mode 100644 index 0000000..d877191 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-sint-pack32.amber @@ -0,0 +1,56 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) isamplerBuffer texels; + +void main() +{ + color_out = texelFetch(texels, int(gl_FragCoord.x) % 4); +} +END + +BUFFER texel_buffer DATA_TYPE A8B8G8R8_SINT_PACK32 DATA +0x01000001 # Unpacks to R = 1, G = 0, B = 0, A = 1 +0x01000100 # Unpacks to R = 0, G = 1, B = 0, A = 1 +0x01010000 # Unpacks to R = 0, G = 0, B = 1, A = 1 +0x01010100 # Unpacks to R = 0, G = 1, B = 1, A = 1 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 50 50 SIZE 100 100 + +EXPECT framebuffer IDX 50 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 51 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 52 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 53 50 SIZE 1 100 EQ_RGBA 0 255 0 255 +EXPECT framebuffer IDX 54 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 55 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 56 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 57 50 SIZE 1 100 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-snorm-pack32.amber b/vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-snorm-pack32.amber new file mode 100644 index 0000000..6e691ba --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-snorm-pack32.amber @@ -0,0 +1,56 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = texelFetch(texels, int(gl_FragCoord.x) % 4); +} +END + +BUFFER texel_buffer DATA_TYPE A8B8G8R8_SNORM_PACK32 DATA +0x7f00007f # Unpacks to R = 127, G = 0, B = 0, A = 127 +0x7f007f00 # Unpacks to R = 0, G = 127, B = 0, A = 127 +0x7f7f0000 # Unpacks to R = 0, G = 0, B = 127, A = 127 +0x7f7f7f00 # Unpacks to R = 0, G = 127, B = 127, A = 127 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 50 50 SIZE 100 100 + +EXPECT framebuffer IDX 50 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 51 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 52 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 53 50 SIZE 1 100 EQ_RGBA 0 255 0 255 +EXPECT framebuffer IDX 54 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 55 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 56 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 57 50 SIZE 1 100 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-uint-pack32.amber b/vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-uint-pack32.amber new file mode 100644 index 0000000..6a09e97 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-uint-pack32.amber @@ -0,0 +1,56 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) usamplerBuffer texels; + +void main() +{ + color_out = texelFetch(texels, int(gl_FragCoord.x) % 4); +} +END + +BUFFER texel_buffer DATA_TYPE A8B8G8R8_UINT_PACK32 DATA +0x01000001 # Unpacks to R = 1, G = 0, B = 0, A = 1 +0x01000100 # Unpacks to R = 0, G = 1, B = 0, A = 1 +0x01010000 # Unpacks to R = 0, G = 0, B = 1, A = 1 +0x01010100 # Unpacks to R = 0, G = 1, B = 1, A = 1 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 50 50 SIZE 100 100 + +EXPECT framebuffer IDX 50 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 51 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 52 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 53 50 SIZE 1 100 EQ_RGBA 0 255 0 255 +EXPECT framebuffer IDX 54 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 55 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 56 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 57 50 SIZE 1 100 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-unorm-pack32.amber b/vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-unorm-pack32.amber new file mode 100644 index 0000000..cdb25e5 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/packed/a8b8g8r8-unorm-pack32.amber @@ -0,0 +1,56 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = texelFetch(texels, int(gl_FragCoord.x) % 4); +} +END + +BUFFER texel_buffer DATA_TYPE A8B8G8R8_UNORM_PACK32 DATA +0xff0000ff # Unpacks to R = 255, G = 0, B = 0, A = 255 +0xff00ff00 # Unpacks to R = 0, G = 255, B = 0, A = 255 +0xffff0000 # Unpacks to R = 0, G = 0, B = 255, A = 255 +0xffffff00 # Unpacks to R = 0, G = 255, B = 255, A = 255 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 50 50 SIZE 100 100 + +EXPECT framebuffer IDX 50 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 51 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 52 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 53 50 SIZE 1 100 EQ_RGBA 0 255 0 255 +EXPECT framebuffer IDX 54 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 55 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 56 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 57 50 SIZE 1 100 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_buffer/uniform/packed/b10g11r11-ufloat-pack32.amber b/vulkan/amber/texture/texel_buffer/uniform/packed/b10g11r11-ufloat-pack32.amber new file mode 100644 index 0000000..5f6dda7 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/packed/b10g11r11-ufloat-pack32.amber @@ -0,0 +1,56 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = texelFetch(texels, int(gl_FragCoord.x) % 4); +} +END + +BUFFER texel_buffer DATA_TYPE B10G11R11_UFLOAT_PACK32 DATA +0x000003e0 # Unpacks to R = 1.0, G = 0.0, B = 0.0 +0x001f0000 # Unpacks to R = 0.0, G = 1.0, B = 0.0 +0x7c000000 # Unpacks to R = 0.0, G = 0.0, B = 1.0 +0x7c1f0000 # Unpacks to R = 0.0, G = 1.0, B = 1.0 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 50 50 SIZE 100 100 + +EXPECT framebuffer IDX 50 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 51 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 52 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 53 50 SIZE 1 100 EQ_RGBA 0 255 0 255 +EXPECT framebuffer IDX 54 50 SIZE 1 100 EQ_RGBA 0 0 255 255 +EXPECT framebuffer IDX 55 50 SIZE 1 100 EQ_RGBA 0 255 255 255 +EXPECT framebuffer IDX 56 50 SIZE 1 100 EQ_RGBA 255 0 0 255 +EXPECT framebuffer IDX 57 50 SIZE 1 100 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_buffer/uniform/snorm/b8g8r8-snorm.amber b/vulkan/amber/texture/texel_buffer/uniform/snorm/b8g8r8-snorm.amber new file mode 100644 index 0000000..8055f61 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/snorm/b8g8r8-snorm.amber @@ -0,0 +1,96 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = (texelFetch(texels, int(gl_FragCoord.x) % 39) + vec4(1.0)) / vec4(2.0); + color_out.a = 1; + +} +END + +BUFFER texel_buffer DATA_TYPE B8G8R8_SNORM DATA +0x81 0x88 0x8f 0x88 0x8f 0x96 0x8f 0x96 0x9d 0x96 0x9d 0xa4 +0x9d 0xa4 0xab 0xa4 0xab 0xb2 0xab 0xb2 0xb9 0xb2 0xb9 0xc0 +0xb9 0xc0 0xc7 0xc0 0xc7 0xce 0xc7 0xce 0xd5 0xce 0xd5 0xdc +0xd5 0xdc 0xe3 0xdc 0xe3 0xea 0xe3 0xea 0xf1 0xea 0xf1 0xf8 +0xf1 0xf8 0xff 0xf8 0xff 0x06 0xff 0x06 0x0d 0x06 0x0d 0x14 +0x0d 0x14 0x1b 0x14 0x1b 0x22 0x1b 0x22 0x29 0x22 0x29 0x30 +0x29 0x30 0x37 0x30 0x37 0x3e 0x37 0x3e 0x45 0x3e 0x45 0x4c +0x45 0x4c 0x53 0x4c 0x53 0x5a 0x53 0x5a 0x61 0x5a 0x61 0x68 +0x61 0x68 0x6f 0x68 0x6f 0x76 0x6f 0x76 0x7d 0x76 0x7d 0x80 +0x7d 0x80 0x00 0x80 0x00 0x81 0x00 0x81 0x88 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 100 128 + +EXPECT framebuffer IDX 0 0 SIZE 1 128 EQ_RGBA 0 7 14 255 TOLERANCE 1 +EXPECT framebuffer IDX 1 0 SIZE 1 128 EQ_RGBA 7 14 21 255 TOLERANCE 1 +EXPECT framebuffer IDX 2 0 SIZE 1 128 EQ_RGBA 14 21 28 255 TOLERANCE 1 +EXPECT framebuffer IDX 3 0 SIZE 1 128 EQ_RGBA 21 28 35 255 TOLERANCE 1 +EXPECT framebuffer IDX 4 0 SIZE 1 128 EQ_RGBA 28 35 42 255 TOLERANCE 1 +EXPECT framebuffer IDX 5 0 SIZE 1 128 EQ_RGBA 35 42 49 255 TOLERANCE 1 +EXPECT framebuffer IDX 6 0 SIZE 1 128 EQ_RGBA 42 49 56 255 TOLERANCE 1 +EXPECT framebuffer IDX 7 0 SIZE 1 128 EQ_RGBA 49 56 63 255 TOLERANCE 1 +EXPECT framebuffer IDX 8 0 SIZE 1 128 EQ_RGBA 56 63 70 255 TOLERANCE 1 +EXPECT framebuffer IDX 9 0 SIZE 1 128 EQ_RGBA 63 70 77 255 TOLERANCE 1 +EXPECT framebuffer IDX 10 0 SIZE 1 128 EQ_RGBA 70 77 84 255 TOLERANCE 1 +EXPECT framebuffer IDX 11 0 SIZE 1 128 EQ_RGBA 77 84 91 255 TOLERANCE 1 +EXPECT framebuffer IDX 12 0 SIZE 1 128 EQ_RGBA 84 91 98 255 TOLERANCE 1 +EXPECT framebuffer IDX 13 0 SIZE 1 128 EQ_RGBA 91 98 105 255 TOLERANCE 1 +EXPECT framebuffer IDX 14 0 SIZE 1 128 EQ_RGBA 98 105 112 255 TOLERANCE 1 +EXPECT framebuffer IDX 15 0 SIZE 1 128 EQ_RGBA 105 112 119 255 TOLERANCE 1 +EXPECT framebuffer IDX 16 0 SIZE 1 128 EQ_RGBA 112 119 126 255 TOLERANCE 1 +EXPECT framebuffer IDX 17 0 SIZE 1 128 EQ_RGBA 119 126 133 255 TOLERANCE 1 +EXPECT framebuffer IDX 18 0 SIZE 1 128 EQ_RGBA 126 133 140 255 TOLERANCE 1 +EXPECT framebuffer IDX 19 0 SIZE 1 128 EQ_RGBA 133 140 147 255 TOLERANCE 1 +EXPECT framebuffer IDX 20 0 SIZE 1 128 EQ_RGBA 140 147 154 255 TOLERANCE 1 +EXPECT framebuffer IDX 21 0 SIZE 1 128 EQ_RGBA 147 154 161 255 TOLERANCE 1 +EXPECT framebuffer IDX 22 0 SIZE 1 128 EQ_RGBA 154 161 168 255 TOLERANCE 1 +EXPECT framebuffer IDX 23 0 SIZE 1 128 EQ_RGBA 161 168 175 255 TOLERANCE 1 +EXPECT framebuffer IDX 24 0 SIZE 1 128 EQ_RGBA 168 175 182 255 TOLERANCE 1 +EXPECT framebuffer IDX 25 0 SIZE 1 128 EQ_RGBA 175 182 189 255 TOLERANCE 1 +EXPECT framebuffer IDX 26 0 SIZE 1 128 EQ_RGBA 182 189 196 255 TOLERANCE 1 +EXPECT framebuffer IDX 27 0 SIZE 1 128 EQ_RGBA 189 196 203 255 TOLERANCE 1 +EXPECT framebuffer IDX 28 0 SIZE 1 128 EQ_RGBA 196 203 210 255 TOLERANCE 1 +EXPECT framebuffer IDX 29 0 SIZE 1 128 EQ_RGBA 203 210 217 255 TOLERANCE 1 +EXPECT framebuffer IDX 30 0 SIZE 1 128 EQ_RGBA 210 217 224 255 TOLERANCE 1 +EXPECT framebuffer IDX 31 0 SIZE 1 128 EQ_RGBA 217 224 231 255 TOLERANCE 1 +EXPECT framebuffer IDX 32 0 SIZE 1 128 EQ_RGBA 224 231 238 255 TOLERANCE 1 +EXPECT framebuffer IDX 33 0 SIZE 1 128 EQ_RGBA 231 238 245 255 TOLERANCE 1 +EXPECT framebuffer IDX 34 0 SIZE 1 128 EQ_RGBA 238 245 252 255 TOLERANCE 1 +EXPECT framebuffer IDX 35 0 SIZE 1 128 EQ_RGBA 245 252 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 36 0 SIZE 1 128 EQ_RGBA 252 0 127 255 TOLERANCE 1 +EXPECT framebuffer IDX 37 0 SIZE 1 128 EQ_RGBA 0 127 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 38 0 SIZE 1 128 EQ_RGBA 127 0 7 255 TOLERANCE 1 + diff --git a/vulkan/amber/texture/texel_buffer/uniform/snorm/b8g8r8a8-snorm.amber b/vulkan/amber/texture/texel_buffer/uniform/snorm/b8g8r8a8-snorm.amber new file mode 100644 index 0000000..d3f0b9e --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/snorm/b8g8r8a8-snorm.amber @@ -0,0 +1,98 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = (texelFetch(texels, int(gl_FragCoord.x) % 39) + vec4(1.0)) / vec4(2.0); + +} +END + +BUFFER texel_buffer DATA_TYPE B8G8R8A8_SNORM DATA +0x81 0x88 0x8f 0x96 0x88 0x8f 0x96 0x9d 0x8f 0x96 0x9d 0xa4 +0x96 0x9d 0xa4 0xab 0x9d 0xa4 0xab 0xb2 0xa4 0xab 0xb2 0xb9 +0xab 0xb2 0xb9 0xc0 0xb2 0xb9 0xc0 0xc7 0xb9 0xc0 0xc7 0xce +0xc0 0xc7 0xce 0xd5 0xc7 0xce 0xd5 0xdc 0xce 0xd5 0xdc 0xe3 +0xd5 0xdc 0xe3 0xea 0xdc 0xe3 0xea 0xf1 0xe3 0xea 0xf1 0xf8 +0xea 0xf1 0xf8 0xff 0xf1 0xf8 0xff 0x06 0xf8 0xff 0x06 0x0d +0xff 0x06 0x0d 0x14 0x06 0x0d 0x14 0x1b 0x0d 0x14 0x1b 0x22 +0x14 0x1b 0x22 0x29 0x1b 0x22 0x29 0x30 0x22 0x29 0x30 0x37 +0x29 0x30 0x37 0x3e 0x30 0x37 0x3e 0x45 0x37 0x3e 0x45 0x4c +0x3e 0x45 0x4c 0x53 0x45 0x4c 0x53 0x5a 0x4c 0x53 0x5a 0x61 +0x53 0x5a 0x61 0x68 0x5a 0x61 0x68 0x6f 0x61 0x68 0x6f 0x76 +0x68 0x6f 0x76 0x7d 0x6f 0x76 0x7d 0x80 0x76 0x7d 0x80 0x00 +0x7d 0x80 0x00 0x81 0x80 0x00 0x81 0x88 0x00 0x81 0x88 0x8f +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 100 128 + +EXPECT framebuffer IDX 0 0 SIZE 1 128 EQ_RGBA 0 7 14 21 TOLERANCE 1 +EXPECT framebuffer IDX 1 0 SIZE 1 128 EQ_RGBA 7 14 21 28 TOLERANCE 1 +EXPECT framebuffer IDX 2 0 SIZE 1 128 EQ_RGBA 14 21 28 35 TOLERANCE 1 +EXPECT framebuffer IDX 3 0 SIZE 1 128 EQ_RGBA 21 28 35 42 TOLERANCE 1 +EXPECT framebuffer IDX 4 0 SIZE 1 128 EQ_RGBA 28 35 42 49 TOLERANCE 1 +EXPECT framebuffer IDX 5 0 SIZE 1 128 EQ_RGBA 35 42 49 56 TOLERANCE 1 +EXPECT framebuffer IDX 6 0 SIZE 1 128 EQ_RGBA 42 49 56 63 TOLERANCE 1 +EXPECT framebuffer IDX 7 0 SIZE 1 128 EQ_RGBA 49 56 63 70 TOLERANCE 1 +EXPECT framebuffer IDX 8 0 SIZE 1 128 EQ_RGBA 56 63 70 77 TOLERANCE 1 +EXPECT framebuffer IDX 9 0 SIZE 1 128 EQ_RGBA 63 70 77 84 TOLERANCE 1 +EXPECT framebuffer IDX 10 0 SIZE 1 128 EQ_RGBA 70 77 84 91 TOLERANCE 1 +EXPECT framebuffer IDX 11 0 SIZE 1 128 EQ_RGBA 77 84 91 98 TOLERANCE 1 +EXPECT framebuffer IDX 12 0 SIZE 1 128 EQ_RGBA 84 91 98 105 TOLERANCE 1 +EXPECT framebuffer IDX 13 0 SIZE 1 128 EQ_RGBA 91 98 105 112 TOLERANCE 1 +EXPECT framebuffer IDX 14 0 SIZE 1 128 EQ_RGBA 98 105 112 119 TOLERANCE 1 +EXPECT framebuffer IDX 15 0 SIZE 1 128 EQ_RGBA 105 112 119 126 TOLERANCE 1 +EXPECT framebuffer IDX 16 0 SIZE 1 128 EQ_RGBA 112 119 126 133 TOLERANCE 1 +EXPECT framebuffer IDX 17 0 SIZE 1 128 EQ_RGBA 119 126 133 140 TOLERANCE 1 +EXPECT framebuffer IDX 18 0 SIZE 1 128 EQ_RGBA 126 133 140 147 TOLERANCE 1 +EXPECT framebuffer IDX 19 0 SIZE 1 128 EQ_RGBA 133 140 147 154 TOLERANCE 1 +EXPECT framebuffer IDX 20 0 SIZE 1 128 EQ_RGBA 140 147 154 161 TOLERANCE 1 +EXPECT framebuffer IDX 21 0 SIZE 1 128 EQ_RGBA 147 154 161 168 TOLERANCE 1 +EXPECT framebuffer IDX 22 0 SIZE 1 128 EQ_RGBA 154 161 168 175 TOLERANCE 1 +EXPECT framebuffer IDX 23 0 SIZE 1 128 EQ_RGBA 161 168 175 182 TOLERANCE 1 +EXPECT framebuffer IDX 24 0 SIZE 1 128 EQ_RGBA 168 175 182 189 TOLERANCE 1 +EXPECT framebuffer IDX 25 0 SIZE 1 128 EQ_RGBA 175 182 189 196 TOLERANCE 1 +EXPECT framebuffer IDX 26 0 SIZE 1 128 EQ_RGBA 182 189 196 203 TOLERANCE 1 +EXPECT framebuffer IDX 27 0 SIZE 1 128 EQ_RGBA 189 196 203 210 TOLERANCE 1 +EXPECT framebuffer IDX 28 0 SIZE 1 128 EQ_RGBA 196 203 210 217 TOLERANCE 1 +EXPECT framebuffer IDX 29 0 SIZE 1 128 EQ_RGBA 203 210 217 224 TOLERANCE 1 +EXPECT framebuffer IDX 30 0 SIZE 1 128 EQ_RGBA 210 217 224 231 TOLERANCE 1 +EXPECT framebuffer IDX 31 0 SIZE 1 128 EQ_RGBA 217 224 231 238 TOLERANCE 1 +EXPECT framebuffer IDX 32 0 SIZE 1 128 EQ_RGBA 224 231 238 245 TOLERANCE 1 +EXPECT framebuffer IDX 33 0 SIZE 1 128 EQ_RGBA 231 238 245 252 TOLERANCE 1 +EXPECT framebuffer IDX 34 0 SIZE 1 128 EQ_RGBA 238 245 252 0 TOLERANCE 1 +EXPECT framebuffer IDX 35 0 SIZE 1 128 EQ_RGBA 245 252 0 127 TOLERANCE 1 +EXPECT framebuffer IDX 36 0 SIZE 1 128 EQ_RGBA 252 0 127 0 TOLERANCE 1 +EXPECT framebuffer IDX 37 0 SIZE 1 128 EQ_RGBA 0 127 0 7 TOLERANCE 1 +EXPECT framebuffer IDX 38 0 SIZE 1 128 EQ_RGBA 127 0 7 14 TOLERANCE 1 + diff --git a/vulkan/amber/texture/texel_buffer/uniform/snorm/r16-snorm.amber b/vulkan/amber/texture/texel_buffer/uniform/snorm/r16-snorm.amber new file mode 100644 index 0000000..db4746e --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/snorm/r16-snorm.amber @@ -0,0 +1,88 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = (texelFetch(texels, int(gl_FragCoord.x) % 35) + vec4(1.0)) / vec4(2.0); + color_out.g = 0; + color_out.b = 0; + color_out.a = 1; + +} +END + +BUFFER texel_buffer DATA_TYPE R16_SNORM DATA +0x8001 0x8800 0x8fff 0x97fe 0x9ffd 0xa7fc 0xaffb 0xb7fa 0xbff9 0xc7f8 +0xcff7 0xd7f6 0xdff5 0xe7f4 0xeff3 0xf7f2 0xfff1 0x07f0 0x0fef 0x17ee +0x1fed 0x27ec 0x2feb 0x37ea 0x3fe9 0x47e8 0x4fe7 0x57e6 0x5fe5 0x67e4 +0x6fe3 0x77e2 0x7fe1 0x8000 0x0000 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 100 128 + +EXPECT framebuffer IDX 0 0 SIZE 1 128 EQ_RGBA 0 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 1 0 SIZE 1 128 EQ_RGBA 7 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 2 0 SIZE 1 128 EQ_RGBA 15 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 3 0 SIZE 1 128 EQ_RGBA 23 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 4 0 SIZE 1 128 EQ_RGBA 31 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 5 0 SIZE 1 128 EQ_RGBA 39 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 6 0 SIZE 1 128 EQ_RGBA 47 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 7 0 SIZE 1 128 EQ_RGBA 55 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 8 0 SIZE 1 128 EQ_RGBA 63 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 9 0 SIZE 1 128 EQ_RGBA 71 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 10 0 SIZE 1 128 EQ_RGBA 79 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 11 0 SIZE 1 128 EQ_RGBA 87 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 12 0 SIZE 1 128 EQ_RGBA 95 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 13 0 SIZE 1 128 EQ_RGBA 103 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 14 0 SIZE 1 128 EQ_RGBA 111 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 15 0 SIZE 1 128 EQ_RGBA 119 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 16 0 SIZE 1 128 EQ_RGBA 127 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 17 0 SIZE 1 128 EQ_RGBA 135 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 18 0 SIZE 1 128 EQ_RGBA 143 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 19 0 SIZE 1 128 EQ_RGBA 151 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 20 0 SIZE 1 128 EQ_RGBA 159 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 21 0 SIZE 1 128 EQ_RGBA 167 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 22 0 SIZE 1 128 EQ_RGBA 175 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 23 0 SIZE 1 128 EQ_RGBA 183 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 24 0 SIZE 1 128 EQ_RGBA 191 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 25 0 SIZE 1 128 EQ_RGBA 199 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 26 0 SIZE 1 128 EQ_RGBA 207 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 27 0 SIZE 1 128 EQ_RGBA 215 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 28 0 SIZE 1 128 EQ_RGBA 223 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 29 0 SIZE 1 128 EQ_RGBA 230 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 30 0 SIZE 1 128 EQ_RGBA 238 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 31 0 SIZE 1 128 EQ_RGBA 246 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 32 0 SIZE 1 128 EQ_RGBA 254 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 33 0 SIZE 1 128 EQ_RGBA 0 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 34 0 SIZE 1 128 EQ_RGBA 127 0 0 255 TOLERANCE 1 + diff --git a/vulkan/amber/texture/texel_buffer/uniform/snorm/r16g16-snorm.amber b/vulkan/amber/texture/texel_buffer/uniform/snorm/r16g16-snorm.amber new file mode 100644 index 0000000..646ccbf --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/snorm/r16g16-snorm.amber @@ -0,0 +1,90 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = (texelFetch(texels, int(gl_FragCoord.x) % 35) + vec4(1.0)) / vec4(2.0); + color_out.b = 0; + color_out.a = 1; + +} +END + +BUFFER texel_buffer DATA_TYPE R16G16_SNORM DATA +0x8001 0x8800 0x8800 0x8fff 0x8fff 0x97fe 0x97fe 0x9ffd 0x9ffd 0xa7fc +0xa7fc 0xaffb 0xaffb 0xb7fa 0xb7fa 0xbff9 0xbff9 0xc7f8 0xc7f8 0xcff7 +0xcff7 0xd7f6 0xd7f6 0xdff5 0xdff5 0xe7f4 0xe7f4 0xeff3 0xeff3 0xf7f2 +0xf7f2 0xfff1 0xfff1 0x07f0 0x07f0 0x0fef 0x0fef 0x17ee 0x17ee 0x1fed +0x1fed 0x27ec 0x27ec 0x2feb 0x2feb 0x37ea 0x37ea 0x3fe9 0x3fe9 0x47e8 +0x47e8 0x4fe7 0x4fe7 0x57e6 0x57e6 0x5fe5 0x5fe5 0x67e4 0x67e4 0x6fe3 +0x6fe3 0x77e2 0x77e2 0x7fe1 0x7fe1 0x8000 0x8000 0x0000 0x0000 0x8001 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 100 128 + +EXPECT framebuffer IDX 0 0 SIZE 1 128 EQ_RGBA 0 7 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 1 0 SIZE 1 128 EQ_RGBA 7 15 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 2 0 SIZE 1 128 EQ_RGBA 15 23 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 3 0 SIZE 1 128 EQ_RGBA 23 31 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 4 0 SIZE 1 128 EQ_RGBA 31 39 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 5 0 SIZE 1 128 EQ_RGBA 39 47 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 6 0 SIZE 1 128 EQ_RGBA 47 55 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 7 0 SIZE 1 128 EQ_RGBA 55 63 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 8 0 SIZE 1 128 EQ_RGBA 63 71 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 9 0 SIZE 1 128 EQ_RGBA 71 79 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 10 0 SIZE 1 128 EQ_RGBA 79 87 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 11 0 SIZE 1 128 EQ_RGBA 87 95 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 12 0 SIZE 1 128 EQ_RGBA 95 103 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 13 0 SIZE 1 128 EQ_RGBA 103 111 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 14 0 SIZE 1 128 EQ_RGBA 111 119 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 15 0 SIZE 1 128 EQ_RGBA 119 127 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 16 0 SIZE 1 128 EQ_RGBA 127 135 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 17 0 SIZE 1 128 EQ_RGBA 135 143 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 18 0 SIZE 1 128 EQ_RGBA 143 151 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 19 0 SIZE 1 128 EQ_RGBA 151 159 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 20 0 SIZE 1 128 EQ_RGBA 159 167 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 21 0 SIZE 1 128 EQ_RGBA 167 175 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 22 0 SIZE 1 128 EQ_RGBA 175 183 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 23 0 SIZE 1 128 EQ_RGBA 183 191 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 24 0 SIZE 1 128 EQ_RGBA 191 199 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 25 0 SIZE 1 128 EQ_RGBA 199 207 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 26 0 SIZE 1 128 EQ_RGBA 207 215 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 27 0 SIZE 1 128 EQ_RGBA 215 223 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 28 0 SIZE 1 128 EQ_RGBA 223 230 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 29 0 SIZE 1 128 EQ_RGBA 230 238 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 30 0 SIZE 1 128 EQ_RGBA 238 246 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 31 0 SIZE 1 128 EQ_RGBA 246 254 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 32 0 SIZE 1 128 EQ_RGBA 254 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 33 0 SIZE 1 128 EQ_RGBA 0 127 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 34 0 SIZE 1 128 EQ_RGBA 127 0 0 255 TOLERANCE 1 + diff --git a/vulkan/amber/texture/texel_buffer/uniform/snorm/r16g16b16-snorm.amber b/vulkan/amber/texture/texel_buffer/uniform/snorm/r16g16b16-snorm.amber new file mode 100644 index 0000000..c041592 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/snorm/r16g16b16-snorm.amber @@ -0,0 +1,91 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = (texelFetch(texels, int(gl_FragCoord.x) % 35) + vec4(1.0)) / vec4(2.0); + color_out.a = 1; + +} +END + +BUFFER texel_buffer DATA_TYPE R16G16B16_SNORM DATA +0x8001 0x8800 0x8fff 0x8800 0x8fff 0x97fe 0x8fff 0x97fe 0x9ffd 0x97fe 0x9ffd 0xa7fc +0x9ffd 0xa7fc 0xaffb 0xa7fc 0xaffb 0xb7fa 0xaffb 0xb7fa 0xbff9 0xb7fa 0xbff9 0xc7f8 +0xbff9 0xc7f8 0xcff7 0xc7f8 0xcff7 0xd7f6 0xcff7 0xd7f6 0xdff5 0xd7f6 0xdff5 0xe7f4 +0xdff5 0xe7f4 0xeff3 0xe7f4 0xeff3 0xf7f2 0xeff3 0xf7f2 0xfff1 0xf7f2 0xfff1 0x07f0 +0xfff1 0x07f0 0x0fef 0x07f0 0x0fef 0x17ee 0x0fef 0x17ee 0x1fed 0x17ee 0x1fed 0x27ec +0x1fed 0x27ec 0x2feb 0x27ec 0x2feb 0x37ea 0x2feb 0x37ea 0x3fe9 0x37ea 0x3fe9 0x47e8 +0x3fe9 0x47e8 0x4fe7 0x47e8 0x4fe7 0x57e6 0x4fe7 0x57e6 0x5fe5 0x57e6 0x5fe5 0x67e4 +0x5fe5 0x67e4 0x6fe3 0x67e4 0x6fe3 0x77e2 0x6fe3 0x77e2 0x7fe1 0x77e2 0x7fe1 0x8000 +0x7fe1 0x8000 0x0000 0x8000 0x0000 0x8001 0x0000 0x8001 0x8800 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 100 128 + +EXPECT framebuffer IDX 0 0 SIZE 1 128 EQ_RGBA 0 7 15 255 TOLERANCE 1 +EXPECT framebuffer IDX 1 0 SIZE 1 128 EQ_RGBA 7 15 23 255 TOLERANCE 1 +EXPECT framebuffer IDX 2 0 SIZE 1 128 EQ_RGBA 15 23 31 255 TOLERANCE 1 +EXPECT framebuffer IDX 3 0 SIZE 1 128 EQ_RGBA 23 31 39 255 TOLERANCE 1 +EXPECT framebuffer IDX 4 0 SIZE 1 128 EQ_RGBA 31 39 47 255 TOLERANCE 1 +EXPECT framebuffer IDX 5 0 SIZE 1 128 EQ_RGBA 39 47 55 255 TOLERANCE 1 +EXPECT framebuffer IDX 6 0 SIZE 1 128 EQ_RGBA 47 55 63 255 TOLERANCE 1 +EXPECT framebuffer IDX 7 0 SIZE 1 128 EQ_RGBA 55 63 71 255 TOLERANCE 1 +EXPECT framebuffer IDX 8 0 SIZE 1 128 EQ_RGBA 63 71 79 255 TOLERANCE 1 +EXPECT framebuffer IDX 9 0 SIZE 1 128 EQ_RGBA 71 79 87 255 TOLERANCE 1 +EXPECT framebuffer IDX 10 0 SIZE 1 128 EQ_RGBA 79 87 95 255 TOLERANCE 1 +EXPECT framebuffer IDX 11 0 SIZE 1 128 EQ_RGBA 87 95 103 255 TOLERANCE 1 +EXPECT framebuffer IDX 12 0 SIZE 1 128 EQ_RGBA 95 103 111 255 TOLERANCE 1 +EXPECT framebuffer IDX 13 0 SIZE 1 128 EQ_RGBA 103 111 119 255 TOLERANCE 1 +EXPECT framebuffer IDX 14 0 SIZE 1 128 EQ_RGBA 111 119 127 255 TOLERANCE 1 +EXPECT framebuffer IDX 15 0 SIZE 1 128 EQ_RGBA 119 127 135 255 TOLERANCE 1 +EXPECT framebuffer IDX 16 0 SIZE 1 128 EQ_RGBA 127 135 143 255 TOLERANCE 1 +EXPECT framebuffer IDX 17 0 SIZE 1 128 EQ_RGBA 135 143 151 255 TOLERANCE 1 +EXPECT framebuffer IDX 18 0 SIZE 1 128 EQ_RGBA 143 151 159 255 TOLERANCE 1 +EXPECT framebuffer IDX 19 0 SIZE 1 128 EQ_RGBA 151 159 167 255 TOLERANCE 1 +EXPECT framebuffer IDX 20 0 SIZE 1 128 EQ_RGBA 159 167 175 255 TOLERANCE 1 +EXPECT framebuffer IDX 21 0 SIZE 1 128 EQ_RGBA 167 175 183 255 TOLERANCE 1 +EXPECT framebuffer IDX 22 0 SIZE 1 128 EQ_RGBA 175 183 191 255 TOLERANCE 1 +EXPECT framebuffer IDX 23 0 SIZE 1 128 EQ_RGBA 183 191 199 255 TOLERANCE 1 +EXPECT framebuffer IDX 24 0 SIZE 1 128 EQ_RGBA 191 199 207 255 TOLERANCE 1 +EXPECT framebuffer IDX 25 0 SIZE 1 128 EQ_RGBA 199 207 215 255 TOLERANCE 1 +EXPECT framebuffer IDX 26 0 SIZE 1 128 EQ_RGBA 207 215 223 255 TOLERANCE 1 +EXPECT framebuffer IDX 27 0 SIZE 1 128 EQ_RGBA 215 223 230 255 TOLERANCE 1 +EXPECT framebuffer IDX 28 0 SIZE 1 128 EQ_RGBA 223 230 238 255 TOLERANCE 1 +EXPECT framebuffer IDX 29 0 SIZE 1 128 EQ_RGBA 230 238 246 255 TOLERANCE 1 +EXPECT framebuffer IDX 30 0 SIZE 1 128 EQ_RGBA 238 246 254 255 TOLERANCE 1 +EXPECT framebuffer IDX 31 0 SIZE 1 128 EQ_RGBA 246 254 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 32 0 SIZE 1 128 EQ_RGBA 254 0 127 255 TOLERANCE 1 +EXPECT framebuffer IDX 33 0 SIZE 1 128 EQ_RGBA 0 127 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 34 0 SIZE 1 128 EQ_RGBA 127 0 7 255 TOLERANCE 1 + diff --git a/vulkan/amber/texture/texel_buffer/uniform/snorm/r16g16b16a16-snorm.amber b/vulkan/amber/texture/texel_buffer/uniform/snorm/r16g16b16a16-snorm.amber new file mode 100644 index 0000000..1bb4e21 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/snorm/r16g16b16a16-snorm.amber @@ -0,0 +1,93 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = (texelFetch(texels, int(gl_FragCoord.x) % 35) + vec4(1.0)) / vec4(2.0); + +} +END + +BUFFER texel_buffer DATA_TYPE R16G16B16A16_SNORM DATA +0x8001 0x8800 0x8fff 0x97fe 0x8800 0x8fff 0x97fe 0x9ffd 0x8fff 0x97fe 0x9ffd 0xa7fc +0x97fe 0x9ffd 0xa7fc 0xaffb 0x9ffd 0xa7fc 0xaffb 0xb7fa 0xa7fc 0xaffb 0xb7fa 0xbff9 +0xaffb 0xb7fa 0xbff9 0xc7f8 0xb7fa 0xbff9 0xc7f8 0xcff7 0xbff9 0xc7f8 0xcff7 0xd7f6 +0xc7f8 0xcff7 0xd7f6 0xdff5 0xcff7 0xd7f6 0xdff5 0xe7f4 0xd7f6 0xdff5 0xe7f4 0xeff3 +0xdff5 0xe7f4 0xeff3 0xf7f2 0xe7f4 0xeff3 0xf7f2 0xfff1 0xeff3 0xf7f2 0xfff1 0x07f0 +0xf7f2 0xfff1 0x07f0 0x0fef 0xfff1 0x07f0 0x0fef 0x17ee 0x07f0 0x0fef 0x17ee 0x1fed +0x0fef 0x17ee 0x1fed 0x27ec 0x17ee 0x1fed 0x27ec 0x2feb 0x1fed 0x27ec 0x2feb 0x37ea +0x27ec 0x2feb 0x37ea 0x3fe9 0x2feb 0x37ea 0x3fe9 0x47e8 0x37ea 0x3fe9 0x47e8 0x4fe7 +0x3fe9 0x47e8 0x4fe7 0x57e6 0x47e8 0x4fe7 0x57e6 0x5fe5 0x4fe7 0x57e6 0x5fe5 0x67e4 +0x57e6 0x5fe5 0x67e4 0x6fe3 0x5fe5 0x67e4 0x6fe3 0x77e2 0x67e4 0x6fe3 0x77e2 0x7fe1 +0x6fe3 0x77e2 0x7fe1 0x8000 0x77e2 0x7fe1 0x8000 0x0000 0x7fe1 0x8000 0x0000 0x8001 +0x8000 0x0000 0x8001 0x8800 0x0000 0x8001 0x8800 0x8fff +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 100 128 + +EXPECT framebuffer IDX 0 0 SIZE 1 128 EQ_RGBA 0 7 15 23 TOLERANCE 1 +EXPECT framebuffer IDX 1 0 SIZE 1 128 EQ_RGBA 7 15 23 31 TOLERANCE 1 +EXPECT framebuffer IDX 2 0 SIZE 1 128 EQ_RGBA 15 23 31 39 TOLERANCE 1 +EXPECT framebuffer IDX 3 0 SIZE 1 128 EQ_RGBA 23 31 39 47 TOLERANCE 1 +EXPECT framebuffer IDX 4 0 SIZE 1 128 EQ_RGBA 31 39 47 55 TOLERANCE 1 +EXPECT framebuffer IDX 5 0 SIZE 1 128 EQ_RGBA 39 47 55 63 TOLERANCE 1 +EXPECT framebuffer IDX 6 0 SIZE 1 128 EQ_RGBA 47 55 63 71 TOLERANCE 1 +EXPECT framebuffer IDX 7 0 SIZE 1 128 EQ_RGBA 55 63 71 79 TOLERANCE 1 +EXPECT framebuffer IDX 8 0 SIZE 1 128 EQ_RGBA 63 71 79 87 TOLERANCE 1 +EXPECT framebuffer IDX 9 0 SIZE 1 128 EQ_RGBA 71 79 87 95 TOLERANCE 1 +EXPECT framebuffer IDX 10 0 SIZE 1 128 EQ_RGBA 79 87 95 103 TOLERANCE 1 +EXPECT framebuffer IDX 11 0 SIZE 1 128 EQ_RGBA 87 95 103 111 TOLERANCE 1 +EXPECT framebuffer IDX 12 0 SIZE 1 128 EQ_RGBA 95 103 111 119 TOLERANCE 1 +EXPECT framebuffer IDX 13 0 SIZE 1 128 EQ_RGBA 103 111 119 127 TOLERANCE 1 +EXPECT framebuffer IDX 14 0 SIZE 1 128 EQ_RGBA 111 119 127 135 TOLERANCE 1 +EXPECT framebuffer IDX 15 0 SIZE 1 128 EQ_RGBA 119 127 135 143 TOLERANCE 1 +EXPECT framebuffer IDX 16 0 SIZE 1 128 EQ_RGBA 127 135 143 151 TOLERANCE 1 +EXPECT framebuffer IDX 17 0 SIZE 1 128 EQ_RGBA 135 143 151 159 TOLERANCE 1 +EXPECT framebuffer IDX 18 0 SIZE 1 128 EQ_RGBA 143 151 159 167 TOLERANCE 1 +EXPECT framebuffer IDX 19 0 SIZE 1 128 EQ_RGBA 151 159 167 175 TOLERANCE 1 +EXPECT framebuffer IDX 20 0 SIZE 1 128 EQ_RGBA 159 167 175 183 TOLERANCE 1 +EXPECT framebuffer IDX 21 0 SIZE 1 128 EQ_RGBA 167 175 183 191 TOLERANCE 1 +EXPECT framebuffer IDX 22 0 SIZE 1 128 EQ_RGBA 175 183 191 199 TOLERANCE 1 +EXPECT framebuffer IDX 23 0 SIZE 1 128 EQ_RGBA 183 191 199 207 TOLERANCE 1 +EXPECT framebuffer IDX 24 0 SIZE 1 128 EQ_RGBA 191 199 207 215 TOLERANCE 1 +EXPECT framebuffer IDX 25 0 SIZE 1 128 EQ_RGBA 199 207 215 223 TOLERANCE 1 +EXPECT framebuffer IDX 26 0 SIZE 1 128 EQ_RGBA 207 215 223 230 TOLERANCE 1 +EXPECT framebuffer IDX 27 0 SIZE 1 128 EQ_RGBA 215 223 230 238 TOLERANCE 1 +EXPECT framebuffer IDX 28 0 SIZE 1 128 EQ_RGBA 223 230 238 246 TOLERANCE 1 +EXPECT framebuffer IDX 29 0 SIZE 1 128 EQ_RGBA 230 238 246 254 TOLERANCE 1 +EXPECT framebuffer IDX 30 0 SIZE 1 128 EQ_RGBA 238 246 254 0 TOLERANCE 1 +EXPECT framebuffer IDX 31 0 SIZE 1 128 EQ_RGBA 246 254 0 127 TOLERANCE 1 +EXPECT framebuffer IDX 32 0 SIZE 1 128 EQ_RGBA 254 0 127 0 TOLERANCE 1 +EXPECT framebuffer IDX 33 0 SIZE 1 128 EQ_RGBA 0 127 0 7 TOLERANCE 1 +EXPECT framebuffer IDX 34 0 SIZE 1 128 EQ_RGBA 127 0 7 15 TOLERANCE 1 + diff --git a/vulkan/amber/texture/texel_buffer/uniform/snorm/r8-snorm.amber b/vulkan/amber/texture/texel_buffer/uniform/snorm/r8-snorm.amber new file mode 100644 index 0000000..3cb9906 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/snorm/r8-snorm.amber @@ -0,0 +1,92 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = (texelFetch(texels, int(gl_FragCoord.x) % 39) + vec4(1.0)) / vec4(2.0); + color_out.g = 0; + color_out.b = 0; + color_out.a = 1; + +} +END + +BUFFER texel_buffer DATA_TYPE R8_SNORM DATA +0x81 0x88 0x8f 0x96 0x9d 0xa4 0xab 0xb2 0xb9 0xc0 +0xc7 0xce 0xd5 0xdc 0xe3 0xea 0xf1 0xf8 0xff 0x06 +0x0d 0x14 0x1b 0x22 0x29 0x30 0x37 0x3e 0x45 0x4c +0x53 0x5a 0x61 0x68 0x6f 0x76 0x7d 0x80 0x00 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 100 128 + +EXPECT framebuffer IDX 0 0 SIZE 1 128 EQ_RGBA 0 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 1 0 SIZE 1 128 EQ_RGBA 7 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 2 0 SIZE 1 128 EQ_RGBA 14 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 3 0 SIZE 1 128 EQ_RGBA 21 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 4 0 SIZE 1 128 EQ_RGBA 28 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 5 0 SIZE 1 128 EQ_RGBA 35 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 6 0 SIZE 1 128 EQ_RGBA 42 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 7 0 SIZE 1 128 EQ_RGBA 49 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 8 0 SIZE 1 128 EQ_RGBA 56 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 9 0 SIZE 1 128 EQ_RGBA 63 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 10 0 SIZE 1 128 EQ_RGBA 70 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 11 0 SIZE 1 128 EQ_RGBA 77 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 12 0 SIZE 1 128 EQ_RGBA 84 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 13 0 SIZE 1 128 EQ_RGBA 91 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 14 0 SIZE 1 128 EQ_RGBA 98 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 15 0 SIZE 1 128 EQ_RGBA 105 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 16 0 SIZE 1 128 EQ_RGBA 112 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 17 0 SIZE 1 128 EQ_RGBA 119 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 18 0 SIZE 1 128 EQ_RGBA 126 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 19 0 SIZE 1 128 EQ_RGBA 133 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 20 0 SIZE 1 128 EQ_RGBA 140 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 21 0 SIZE 1 128 EQ_RGBA 147 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 22 0 SIZE 1 128 EQ_RGBA 154 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 23 0 SIZE 1 128 EQ_RGBA 161 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 24 0 SIZE 1 128 EQ_RGBA 168 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 25 0 SIZE 1 128 EQ_RGBA 175 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 26 0 SIZE 1 128 EQ_RGBA 182 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 27 0 SIZE 1 128 EQ_RGBA 189 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 28 0 SIZE 1 128 EQ_RGBA 196 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 29 0 SIZE 1 128 EQ_RGBA 203 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 30 0 SIZE 1 128 EQ_RGBA 210 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 31 0 SIZE 1 128 EQ_RGBA 217 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 32 0 SIZE 1 128 EQ_RGBA 224 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 33 0 SIZE 1 128 EQ_RGBA 231 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 34 0 SIZE 1 128 EQ_RGBA 238 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 35 0 SIZE 1 128 EQ_RGBA 245 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 36 0 SIZE 1 128 EQ_RGBA 252 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 37 0 SIZE 1 128 EQ_RGBA 0 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 38 0 SIZE 1 128 EQ_RGBA 127 0 0 255 TOLERANCE 1 + diff --git a/vulkan/amber/texture/texel_buffer/uniform/snorm/r8g8-snorm.amber b/vulkan/amber/texture/texel_buffer/uniform/snorm/r8g8-snorm.amber new file mode 100644 index 0000000..2c8eb2f --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/snorm/r8g8-snorm.amber @@ -0,0 +1,95 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = (texelFetch(texels, int(gl_FragCoord.x) % 39) + vec4(1.0)) / vec4(2.0); + color_out.b = 0; + color_out.a = 1; + +} +END + +BUFFER texel_buffer DATA_TYPE R8G8_SNORM DATA +0x81 0x88 0x88 0x8f 0x8f 0x96 0x96 0x9d 0x9d 0xa4 +0xa4 0xab 0xab 0xb2 0xb2 0xb9 0xb9 0xc0 0xc0 0xc7 +0xc7 0xce 0xce 0xd5 0xd5 0xdc 0xdc 0xe3 0xe3 0xea +0xea 0xf1 0xf1 0xf8 0xf8 0xff 0xff 0x06 0x06 0x0d +0x0d 0x14 0x14 0x1b 0x1b 0x22 0x22 0x29 0x29 0x30 +0x30 0x37 0x37 0x3e 0x3e 0x45 0x45 0x4c 0x4c 0x53 +0x53 0x5a 0x5a 0x61 0x61 0x68 0x68 0x6f 0x6f 0x76 +0x76 0x7d 0x7d 0x80 0x80 0x00 0x00 0x81 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 100 128 + +EXPECT framebuffer IDX 0 0 SIZE 1 128 EQ_RGBA 0 7 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 1 0 SIZE 1 128 EQ_RGBA 7 14 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 2 0 SIZE 1 128 EQ_RGBA 14 21 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 3 0 SIZE 1 128 EQ_RGBA 21 28 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 4 0 SIZE 1 128 EQ_RGBA 28 35 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 5 0 SIZE 1 128 EQ_RGBA 35 42 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 6 0 SIZE 1 128 EQ_RGBA 42 49 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 7 0 SIZE 1 128 EQ_RGBA 49 56 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 8 0 SIZE 1 128 EQ_RGBA 56 63 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 9 0 SIZE 1 128 EQ_RGBA 63 70 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 10 0 SIZE 1 128 EQ_RGBA 70 77 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 11 0 SIZE 1 128 EQ_RGBA 77 84 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 12 0 SIZE 1 128 EQ_RGBA 84 91 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 13 0 SIZE 1 128 EQ_RGBA 91 98 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 14 0 SIZE 1 128 EQ_RGBA 98 105 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 15 0 SIZE 1 128 EQ_RGBA 105 112 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 16 0 SIZE 1 128 EQ_RGBA 112 119 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 17 0 SIZE 1 128 EQ_RGBA 119 126 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 18 0 SIZE 1 128 EQ_RGBA 126 133 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 19 0 SIZE 1 128 EQ_RGBA 133 140 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 20 0 SIZE 1 128 EQ_RGBA 140 147 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 21 0 SIZE 1 128 EQ_RGBA 147 154 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 22 0 SIZE 1 128 EQ_RGBA 154 161 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 23 0 SIZE 1 128 EQ_RGBA 161 168 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 24 0 SIZE 1 128 EQ_RGBA 168 175 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 25 0 SIZE 1 128 EQ_RGBA 175 182 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 26 0 SIZE 1 128 EQ_RGBA 182 189 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 27 0 SIZE 1 128 EQ_RGBA 189 196 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 28 0 SIZE 1 128 EQ_RGBA 196 203 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 29 0 SIZE 1 128 EQ_RGBA 203 210 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 30 0 SIZE 1 128 EQ_RGBA 210 217 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 31 0 SIZE 1 128 EQ_RGBA 217 224 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 32 0 SIZE 1 128 EQ_RGBA 224 231 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 33 0 SIZE 1 128 EQ_RGBA 231 238 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 34 0 SIZE 1 128 EQ_RGBA 238 245 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 35 0 SIZE 1 128 EQ_RGBA 245 252 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 36 0 SIZE 1 128 EQ_RGBA 252 0 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 37 0 SIZE 1 128 EQ_RGBA 0 127 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 38 0 SIZE 1 128 EQ_RGBA 127 0 0 255 TOLERANCE 1 + diff --git a/vulkan/amber/texture/texel_buffer/uniform/snorm/r8g8b8-snorm.amber b/vulkan/amber/texture/texel_buffer/uniform/snorm/r8g8b8-snorm.amber new file mode 100644 index 0000000..ee3f821 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/snorm/r8g8b8-snorm.amber @@ -0,0 +1,96 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = (texelFetch(texels, int(gl_FragCoord.x) % 39) + vec4(1.0)) / vec4(2.0); + color_out.a = 1; + +} +END + +BUFFER texel_buffer DATA_TYPE R8G8B8_SNORM DATA +0x81 0x88 0x8f 0x88 0x8f 0x96 0x8f 0x96 0x9d 0x96 0x9d 0xa4 +0x9d 0xa4 0xab 0xa4 0xab 0xb2 0xab 0xb2 0xb9 0xb2 0xb9 0xc0 +0xb9 0xc0 0xc7 0xc0 0xc7 0xce 0xc7 0xce 0xd5 0xce 0xd5 0xdc +0xd5 0xdc 0xe3 0xdc 0xe3 0xea 0xe3 0xea 0xf1 0xea 0xf1 0xf8 +0xf1 0xf8 0xff 0xf8 0xff 0x06 0xff 0x06 0x0d 0x06 0x0d 0x14 +0x0d 0x14 0x1b 0x14 0x1b 0x22 0x1b 0x22 0x29 0x22 0x29 0x30 +0x29 0x30 0x37 0x30 0x37 0x3e 0x37 0x3e 0x45 0x3e 0x45 0x4c +0x45 0x4c 0x53 0x4c 0x53 0x5a 0x53 0x5a 0x61 0x5a 0x61 0x68 +0x61 0x68 0x6f 0x68 0x6f 0x76 0x6f 0x76 0x7d 0x76 0x7d 0x80 +0x7d 0x80 0x00 0x80 0x00 0x81 0x00 0x81 0x88 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 100 128 + +EXPECT framebuffer IDX 0 0 SIZE 1 128 EQ_RGBA 0 7 14 255 TOLERANCE 1 +EXPECT framebuffer IDX 1 0 SIZE 1 128 EQ_RGBA 7 14 21 255 TOLERANCE 1 +EXPECT framebuffer IDX 2 0 SIZE 1 128 EQ_RGBA 14 21 28 255 TOLERANCE 1 +EXPECT framebuffer IDX 3 0 SIZE 1 128 EQ_RGBA 21 28 35 255 TOLERANCE 1 +EXPECT framebuffer IDX 4 0 SIZE 1 128 EQ_RGBA 28 35 42 255 TOLERANCE 1 +EXPECT framebuffer IDX 5 0 SIZE 1 128 EQ_RGBA 35 42 49 255 TOLERANCE 1 +EXPECT framebuffer IDX 6 0 SIZE 1 128 EQ_RGBA 42 49 56 255 TOLERANCE 1 +EXPECT framebuffer IDX 7 0 SIZE 1 128 EQ_RGBA 49 56 63 255 TOLERANCE 1 +EXPECT framebuffer IDX 8 0 SIZE 1 128 EQ_RGBA 56 63 70 255 TOLERANCE 1 +EXPECT framebuffer IDX 9 0 SIZE 1 128 EQ_RGBA 63 70 77 255 TOLERANCE 1 +EXPECT framebuffer IDX 10 0 SIZE 1 128 EQ_RGBA 70 77 84 255 TOLERANCE 1 +EXPECT framebuffer IDX 11 0 SIZE 1 128 EQ_RGBA 77 84 91 255 TOLERANCE 1 +EXPECT framebuffer IDX 12 0 SIZE 1 128 EQ_RGBA 84 91 98 255 TOLERANCE 1 +EXPECT framebuffer IDX 13 0 SIZE 1 128 EQ_RGBA 91 98 105 255 TOLERANCE 1 +EXPECT framebuffer IDX 14 0 SIZE 1 128 EQ_RGBA 98 105 112 255 TOLERANCE 1 +EXPECT framebuffer IDX 15 0 SIZE 1 128 EQ_RGBA 105 112 119 255 TOLERANCE 1 +EXPECT framebuffer IDX 16 0 SIZE 1 128 EQ_RGBA 112 119 126 255 TOLERANCE 1 +EXPECT framebuffer IDX 17 0 SIZE 1 128 EQ_RGBA 119 126 133 255 TOLERANCE 1 +EXPECT framebuffer IDX 18 0 SIZE 1 128 EQ_RGBA 126 133 140 255 TOLERANCE 1 +EXPECT framebuffer IDX 19 0 SIZE 1 128 EQ_RGBA 133 140 147 255 TOLERANCE 1 +EXPECT framebuffer IDX 20 0 SIZE 1 128 EQ_RGBA 140 147 154 255 TOLERANCE 1 +EXPECT framebuffer IDX 21 0 SIZE 1 128 EQ_RGBA 147 154 161 255 TOLERANCE 1 +EXPECT framebuffer IDX 22 0 SIZE 1 128 EQ_RGBA 154 161 168 255 TOLERANCE 1 +EXPECT framebuffer IDX 23 0 SIZE 1 128 EQ_RGBA 161 168 175 255 TOLERANCE 1 +EXPECT framebuffer IDX 24 0 SIZE 1 128 EQ_RGBA 168 175 182 255 TOLERANCE 1 +EXPECT framebuffer IDX 25 0 SIZE 1 128 EQ_RGBA 175 182 189 255 TOLERANCE 1 +EXPECT framebuffer IDX 26 0 SIZE 1 128 EQ_RGBA 182 189 196 255 TOLERANCE 1 +EXPECT framebuffer IDX 27 0 SIZE 1 128 EQ_RGBA 189 196 203 255 TOLERANCE 1 +EXPECT framebuffer IDX 28 0 SIZE 1 128 EQ_RGBA 196 203 210 255 TOLERANCE 1 +EXPECT framebuffer IDX 29 0 SIZE 1 128 EQ_RGBA 203 210 217 255 TOLERANCE 1 +EXPECT framebuffer IDX 30 0 SIZE 1 128 EQ_RGBA 210 217 224 255 TOLERANCE 1 +EXPECT framebuffer IDX 31 0 SIZE 1 128 EQ_RGBA 217 224 231 255 TOLERANCE 1 +EXPECT framebuffer IDX 32 0 SIZE 1 128 EQ_RGBA 224 231 238 255 TOLERANCE 1 +EXPECT framebuffer IDX 33 0 SIZE 1 128 EQ_RGBA 231 238 245 255 TOLERANCE 1 +EXPECT framebuffer IDX 34 0 SIZE 1 128 EQ_RGBA 238 245 252 255 TOLERANCE 1 +EXPECT framebuffer IDX 35 0 SIZE 1 128 EQ_RGBA 245 252 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 36 0 SIZE 1 128 EQ_RGBA 252 0 127 255 TOLERANCE 1 +EXPECT framebuffer IDX 37 0 SIZE 1 128 EQ_RGBA 0 127 0 255 TOLERANCE 1 +EXPECT framebuffer IDX 38 0 SIZE 1 128 EQ_RGBA 127 0 7 255 TOLERANCE 1 + diff --git a/vulkan/amber/texture/texel_buffer/uniform/snorm/r8g8b8a8-snorm.amber b/vulkan/amber/texture/texel_buffer/uniform/snorm/r8g8b8a8-snorm.amber new file mode 100644 index 0000000..7ffc9b7 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/snorm/r8g8b8a8-snorm.amber @@ -0,0 +1,98 @@ +#!amber +# Copyright 2020 The Amber Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vert_shader PASSTHROUGH +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 color_out; +uniform layout(set=0, binding=0) samplerBuffer texels; + +void main() +{ + color_out = (texelFetch(texels, int(gl_FragCoord.x) % 39) + vec4(1.0)) / vec4(2.0); + +} +END + +BUFFER texel_buffer DATA_TYPE R8G8B8A8_SNORM DATA +0x81 0x88 0x8f 0x96 0x88 0x8f 0x96 0x9d 0x8f 0x96 0x9d 0xa4 +0x96 0x9d 0xa4 0xab 0x9d 0xa4 0xab 0xb2 0xa4 0xab 0xb2 0xb9 +0xab 0xb2 0xb9 0xc0 0xb2 0xb9 0xc0 0xc7 0xb9 0xc0 0xc7 0xce +0xc0 0xc7 0xce 0xd5 0xc7 0xce 0xd5 0xdc 0xce 0xd5 0xdc 0xe3 +0xd5 0xdc 0xe3 0xea 0xdc 0xe3 0xea 0xf1 0xe3 0xea 0xf1 0xf8 +0xea 0xf1 0xf8 0xff 0xf1 0xf8 0xff 0x06 0xf8 0xff 0x06 0x0d +0xff 0x06 0x0d 0x14 0x06 0x0d 0x14 0x1b 0x0d 0x14 0x1b 0x22 +0x14 0x1b 0x22 0x29 0x1b 0x22 0x29 0x30 0x22 0x29 0x30 0x37 +0x29 0x30 0x37 0x3e 0x30 0x37 0x3e 0x45 0x37 0x3e 0x45 0x4c +0x3e 0x45 0x4c 0x53 0x45 0x4c 0x53 0x5a 0x4c 0x53 0x5a 0x61 +0x53 0x5a 0x61 0x68 0x5a 0x61 0x68 0x6f 0x61 0x68 0x6f 0x76 +0x68 0x6f 0x76 0x7d 0x6f 0x76 0x7d 0x80 0x76 0x7d 0x80 0x00 +0x7d 0x80 0x00 0x81 0x80 0x00 0x81 0x88 0x00 0x81 0x88 0x8f +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 + FRAMEBUFFER_SIZE 256 256 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 255 255 +CLEAR pipeline +RUN pipeline DRAW_RECT POS 0 0 SIZE 100 128 + +EXPECT framebuffer IDX 0 0 SIZE 1 128 EQ_RGBA 0 7 14 21 TOLERANCE 1 +EXPECT framebuffer IDX 1 0 SIZE 1 128 EQ_RGBA 7 14 21 28 TOLERANCE 1 +EXPECT framebuffer IDX 2 0 SIZE 1 128 EQ_RGBA 14 21 28 35 TOLERANCE 1 +EXPECT framebuffer IDX 3 0 SIZE 1 128 EQ_RGBA 21 28 35 42 TOLERANCE 1 +EXPECT framebuffer IDX 4 0 SIZE 1 128 EQ_RGBA 28 35 42 49 TOLERANCE 1 +EXPECT framebuffer IDX 5 0 SIZE 1 128 EQ_RGBA 35 42 49 56 TOLERANCE 1 +EXPECT framebuffer IDX 6 0 SIZE 1 128 EQ_RGBA 42 49 56 63 TOLERANCE 1 +EXPECT framebuffer IDX 7 0 SIZE 1 128 EQ_RGBA 49 56 63 70 TOLERANCE 1 +EXPECT framebuffer IDX 8 0 SIZE 1 128 EQ_RGBA 56 63 70 77 TOLERANCE 1 +EXPECT framebuffer IDX 9 0 SIZE 1 128 EQ_RGBA 63 70 77 84 TOLERANCE 1 +EXPECT framebuffer IDX 10 0 SIZE 1 128 EQ_RGBA 70 77 84 91 TOLERANCE 1 +EXPECT framebuffer IDX 11 0 SIZE 1 128 EQ_RGBA 77 84 91 98 TOLERANCE 1 +EXPECT framebuffer IDX 12 0 SIZE 1 128 EQ_RGBA 84 91 98 105 TOLERANCE 1 +EXPECT framebuffer IDX 13 0 SIZE 1 128 EQ_RGBA 91 98 105 112 TOLERANCE 1 +EXPECT framebuffer IDX 14 0 SIZE 1 128 EQ_RGBA 98 105 112 119 TOLERANCE 1 +EXPECT framebuffer IDX 15 0 SIZE 1 128 EQ_RGBA 105 112 119 126 TOLERANCE 1 +EXPECT framebuffer IDX 16 0 SIZE 1 128 EQ_RGBA 112 119 126 133 TOLERANCE 1 +EXPECT framebuffer IDX 17 0 SIZE 1 128 EQ_RGBA 119 126 133 140 TOLERANCE 1 +EXPECT framebuffer IDX 18 0 SIZE 1 128 EQ_RGBA 126 133 140 147 TOLERANCE 1 +EXPECT framebuffer IDX 19 0 SIZE 1 128 EQ_RGBA 133 140 147 154 TOLERANCE 1 +EXPECT framebuffer IDX 20 0 SIZE 1 128 EQ_RGBA 140 147 154 161 TOLERANCE 1 +EXPECT framebuffer IDX 21 0 SIZE 1 128 EQ_RGBA 147 154 161 168 TOLERANCE 1 +EXPECT framebuffer IDX 22 0 SIZE 1 128 EQ_RGBA 154 161 168 175 TOLERANCE 1 +EXPECT framebuffer IDX 23 0 SIZE 1 128 EQ_RGBA 161 168 175 182 TOLERANCE 1 +EXPECT framebuffer IDX 24 0 SIZE 1 128 EQ_RGBA 168 175 182 189 TOLERANCE 1 +EXPECT framebuffer IDX 25 0 SIZE 1 128 EQ_RGBA 175 182 189 196 TOLERANCE 1 +EXPECT framebuffer IDX 26 0 SIZE 1 128 EQ_RGBA 182 189 196 203 TOLERANCE 1 +EXPECT framebuffer IDX 27 0 SIZE 1 128 EQ_RGBA 189 196 203 210 TOLERANCE 1 +EXPECT framebuffer IDX 28 0 SIZE 1 128 EQ_RGBA 196 203 210 217 TOLERANCE 1 +EXPECT framebuffer IDX 29 0 SIZE 1 128 EQ_RGBA 203 210 217 224 TOLERANCE 1 +EXPECT framebuffer IDX 30 0 SIZE 1 128 EQ_RGBA 210 217 224 231 TOLERANCE 1 +EXPECT framebuffer IDX 31 0 SIZE 1 128 EQ_RGBA 217 224 231 238 TOLERANCE 1 +EXPECT framebuffer IDX 32 0 SIZE 1 128 EQ_RGBA 224 231 238 245 TOLERANCE 1 +EXPECT framebuffer IDX 33 0 SIZE 1 128 EQ_RGBA 231 238 245 252 TOLERANCE 1 +EXPECT framebuffer IDX 34 0 SIZE 1 128 EQ_RGBA 238 245 252 0 TOLERANCE 1 +EXPECT framebuffer IDX 35 0 SIZE 1 128 EQ_RGBA 245 252 0 127 TOLERANCE 1 +EXPECT framebuffer IDX 36 0 SIZE 1 128 EQ_RGBA 252 0 127 0 TOLERANCE 1 +EXPECT framebuffer IDX 37 0 SIZE 1 128 EQ_RGBA 0 127 0 7 TOLERANCE 1 +EXPECT framebuffer IDX 38 0 SIZE 1 128 EQ_RGBA 127 0 7 14 TOLERANCE 1 + diff --git a/vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8_srgb.amber b/vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8_srgb.amber new file mode 100644 index 0000000..94e708e --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8_srgb.amber @@ -0,0 +1,102 @@ +#!amber +# Copyright 2022 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vertShaderTex GLSL +#version 430 +layout(location = 0) in vec4 position; +layout(location = 1) in vec2 texCoordsIn; +layout(location = 0) out vec2 texCoordsOut; +void main() { + gl_Position = position; + texCoordsOut = texCoordsIn; +} +END + +SHADER fragment fragShaderTex GLSL +#version 430 +layout(location = 0) in vec2 texCoordsIn; +layout(location = 0) out vec4 colorOut; +layout(set=0, binding=0) uniform sampler2D referenceSampler; +layout(set=0, binding=1) uniform samplerBuffer bufferSampler; +void main() { + + vec4 referenceValue = texture(referenceSampler, texCoordsIn); + vec4 bufferValue = texelFetch(bufferSampler, int((gl_FragCoord.y-0.5) * 8 + (gl_FragCoord.x-0.5))); + + if (bufferValue == referenceValue) + colorOut = vec4(0., 1., 0., 1.); + else + colorOut = vec4(1., 0., 0., 1.); +} +END + +IMAGE texture FORMAT B8G8R8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA +255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 +255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 +255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 +0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 +0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 +0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 +0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 +0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 +END + +IMAGE texture2 FORMAT B8G8R8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA +255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 +255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 +255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 +0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 +0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 +0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 +0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 +0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +BUFFER position DATA_TYPE vec2 DATA +-1. -1. + 1. -1. +-1. 1. + 1. -1. + 1. 1. +-1. 1. +END + +BUFFER texcoords DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +0.0 1.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +PIPELINE graphics pipeline + ATTACH vertShaderTex + ATTACH fragShaderTex + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER texture2 AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoords LOCATION 1 + FRAMEBUFFER_SIZE 8 8 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT framebuffer IDX 0 0 SIZE 8 8 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8a8_srgb.amber b/vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8a8_srgb.amber new file mode 100644 index 0000000..150bd37 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8a8_srgb.amber @@ -0,0 +1,110 @@ +#!amber +# Copyright 2022 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vertShaderTex GLSL +#version 430 +layout(location = 0) in vec4 position; +layout(location = 1) in vec2 texCoordsIn; +layout(location = 0) out vec2 texCoordsOut; +void main() { + gl_Position = position; + texCoordsOut = texCoordsIn; +} +END + +SHADER fragment fragShaderTex GLSL +#version 430 +layout(location = 0) in vec2 texCoordsIn; +layout(location = 0) out vec4 colorOut; +layout(set=0, binding=0) uniform sampler2D referenceSampler; +layout(set=0, binding=1) uniform samplerBuffer bufferSampler; +void main() { + + vec4 referenceValue = texture(referenceSampler, texCoordsIn); + vec4 bufferValue = texelFetch(bufferSampler, int((gl_FragCoord.y-0.5) * 8 + (gl_FragCoord.x-0.5))); + + if (bufferValue == referenceValue) + colorOut = vec4(0., 1., 0., 1.); + else + colorOut = vec4(1., 0., 0., 1.); +} +END + +IMAGE texture FORMAT B8G8R8A8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA +255 100 0 255 255 80 0 255 255 33 19 255 255 44 70 255 255 9 8 253 155 0 0 212 +255 0 0 255 255 60 60 255 255 40 17 205 255 45 120 255 255 2 8 153 250 0 0 115 +255 0 0 255 255 80 23 255 255 50 12 215 255 46 11 255 255 34 78 255 221 0 0 222 +255 0 0 255 255 80 44 255 255 80 90 155 255 13 12 255 255 32 56 255 +80 255 20 255 40 255 36 251 0 255 110 175 0 225 0 55 0 151 0 51 0 225 0 235 +20 215 32 255 30 255 34 215 20 255 32 255 220 255 0 25 0 215 0 25 0 208 0 205 +90 255 34 255 30 255 0 215 80 255 44 255 110 255 0 152 0 225 0 21 0 203 0 215 +130 215 35 255 11 255 33 251 90 255 55 255 110 +50 255 255 160 11 105 214 0 10 134 158 190 0 255 255 0 0 255 255 0 90 255 255 0 +55 151 205 170 10 103 254 20 0 123 238 35 10 215 250 10 22 255 235 33 80 255 255 0 +66 115 205 120 11 212 244 44 53 250 250 0 20 255 255 0 23 255 253 0 43 255 255 0 +68 255 255 0 0 222 233 +END + +IMAGE texture2 FORMAT B8G8R8A8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA +255 100 0 255 255 80 0 255 255 33 19 255 255 44 70 255 255 9 8 253 155 0 0 212 +255 0 0 255 255 60 60 255 255 40 17 205 255 45 120 255 255 2 8 153 250 0 0 115 +255 0 0 255 255 80 23 255 255 50 12 215 255 46 11 255 255 34 78 255 221 0 0 222 +255 0 0 255 255 80 44 255 255 80 90 155 255 13 12 255 255 32 56 255 +80 255 20 255 40 255 36 251 0 255 110 175 0 225 0 55 0 151 0 51 0 225 0 235 +20 215 32 255 30 255 34 215 20 255 32 255 220 255 0 25 0 215 0 25 0 208 0 205 +90 255 34 255 30 255 0 215 80 255 44 255 110 255 0 152 0 225 0 21 0 203 0 215 +130 215 35 255 11 255 33 251 90 255 55 255 110 +50 255 255 160 11 105 214 0 10 134 158 190 0 255 255 0 0 255 255 0 90 255 255 0 +55 151 205 170 10 103 254 20 0 123 238 35 10 215 250 10 22 255 235 33 80 255 255 0 +66 115 205 120 11 212 244 44 53 250 250 0 20 255 255 0 23 255 253 0 43 255 255 0 +68 255 255 0 0 222 233 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +BUFFER position DATA_TYPE vec2 DATA +-1. -1. + 1. -1. +-1. 1. + 1. -1. + 1. 1. +-1. 1. +END + +BUFFER texcoords DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +0.0 1.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +PIPELINE graphics pipeline + ATTACH vertShaderTex + ATTACH fragShaderTex + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER texture2 AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoords LOCATION 1 + FRAMEBUFFER_SIZE 8 8 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT framebuffer IDX 0 0 SIZE 8 8 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_buffer/uniform/srgb/r8_srgb.amber b/vulkan/amber/texture/texel_buffer/uniform/srgb/r8_srgb.amber new file mode 100644 index 0000000..b0a3f46 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/srgb/r8_srgb.amber @@ -0,0 +1,102 @@ +#!amber +# Copyright 2022 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vertShaderTex GLSL +#version 430 +layout(location = 0) in vec4 position; +layout(location = 1) in vec2 texCoordsIn; +layout(location = 0) out vec2 texCoordsOut; +void main() { + gl_Position = position; + texCoordsOut = texCoordsIn; +} +END + +SHADER fragment fragShaderTex GLSL +#version 430 +layout(location = 0) in vec2 texCoordsIn; +layout(location = 0) out vec4 colorOut; +layout(set=0, binding=0) uniform sampler2D referenceSampler; +layout(set=0, binding=1) uniform samplerBuffer bufferSampler; +void main() { + + vec4 referenceValue = texture(referenceSampler, texCoordsIn); + vec4 bufferValue = texelFetch(bufferSampler, int((gl_FragCoord.y-0.5) * 8 + (gl_FragCoord.x-0.5))); + + if (bufferValue.r == referenceValue.r) + colorOut = vec4(0., 1., 0., 1.); + else + colorOut = vec4(1., 0., 0., 1.); +} +END + +IMAGE texture FORMAT R8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA +185 120 185 20 185 120 189 120 +145 122 185 10 185 12 188 122 +135 222 15 12 185 121 186 113 +175 124 5 130 185 100 185 123 +177 221 6 140 185 101 182 29 +188 121 67 150 185 120 184 127 +189 27 88 22 185 120 15 123 +111 18 185 24 185 120 17 220 +END + +IMAGE texture2 FORMAT R8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA +185 120 185 20 185 120 189 120 +145 122 185 10 185 12 188 122 +135 222 15 12 185 121 186 113 +175 124 5 130 185 100 185 123 +177 221 6 140 185 101 182 29 +188 121 67 150 185 120 184 127 +189 27 88 22 185 120 15 123 +111 18 185 24 185 120 17 220 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +BUFFER position DATA_TYPE vec2 DATA +-1. -1. + 1. -1. +-1. 1. + 1. -1. + 1. 1. +-1. 1. +END + +BUFFER texcoords DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +0.0 1.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +PIPELINE graphics pipeline + ATTACH vertShaderTex + ATTACH fragShaderTex + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER texture2 AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoords LOCATION 1 + FRAMEBUFFER_SIZE 8 8 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT framebuffer IDX 0 0 SIZE 8 8 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8_srgb.amber b/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8_srgb.amber new file mode 100644 index 0000000..cb4f32f --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8_srgb.amber @@ -0,0 +1,102 @@ +#!amber +# Copyright 2022 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vertShaderTex GLSL +#version 430 +layout(location = 0) in vec4 position; +layout(location = 1) in vec2 texCoordsIn; +layout(location = 0) out vec2 texCoordsOut; +void main() { + gl_Position = position; + texCoordsOut = texCoordsIn; +} +END + +SHADER fragment fragShaderTex GLSL +#version 430 +layout(location = 0) in vec2 texCoordsIn; +layout(location = 0) out vec4 colorOut; +layout(set=0, binding=0) uniform sampler2D referenceSampler; +layout(set=0, binding=1) uniform samplerBuffer bufferSampler; +void main() { + + vec4 referenceValue = texture(referenceSampler, texCoordsIn); + vec4 bufferValue = texelFetch(bufferSampler, int((gl_FragCoord.y-0.5) * 8 + (gl_FragCoord.x-0.5))); + + if (bufferValue == referenceValue) + colorOut = vec4(0., 1., 0., 1.); + else + colorOut = vec4(1., 0., 0., 1.); +} +END + +IMAGE texture FORMAT R8G8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA +152 10 255 20 254 3 255 7 255 55 255 255 251 255 255 +272 81 205 22 244 20 255 20 255 155 112 255 111 215 190 255 0 +126 44 201 23 133 229 255 10 255 207 255 255 125 255 255 +56 120 101 48 177 2 255 10 255 207 0 255 132 33 0 255 0 +45 130 189 89 77 88 255 120 255 201 255 211 233 255 255 +135 134 202 42 88 76 255 9 255 41 0 255 36 244 0 255 0 +185 34 133 199 87 176 255 12 255 244 255 255 2 255 255 +142 88 177 99 150 190 255 16 17 25 39 39 11 151 23 255 0 +END + +IMAGE texture2 FORMAT R8G8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA +152 10 255 20 254 3 255 7 255 55 255 255 251 255 255 +272 81 205 22 244 20 255 20 255 155 112 255 111 215 190 255 0 +126 44 201 23 133 229 255 10 255 207 255 255 125 255 255 +56 120 101 48 177 2 255 10 255 207 0 255 132 33 0 255 0 +45 130 189 89 77 88 255 120 255 201 255 211 233 255 255 +135 134 202 42 88 76 255 9 255 41 0 255 36 244 0 255 0 +185 34 133 199 87 176 255 12 255 244 255 255 2 255 255 +142 88 177 99 150 190 255 16 17 25 39 39 11 151 23 255 0 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +BUFFER position DATA_TYPE vec2 DATA +-1. -1. + 1. -1. +-1. 1. + 1. -1. + 1. 1. +-1. 1. +END + +BUFFER texcoords DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +0.0 1.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +PIPELINE graphics pipeline + ATTACH vertShaderTex + ATTACH fragShaderTex + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER texture2 AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoords LOCATION 1 + FRAMEBUFFER_SIZE 8 8 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT framebuffer IDX 0 0 SIZE 8 8 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8_srgb.amber b/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8_srgb.amber new file mode 100644 index 0000000..f893158 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8_srgb.amber @@ -0,0 +1,104 @@ +#!amber +# Copyright 2022 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vertShaderTex GLSL +#version 430 +layout(location = 0) in vec4 position; +layout(location = 1) in vec2 texCoordsIn; +layout(location = 0) out vec2 texCoordsOut; +void main() { + gl_Position = position; + texCoordsOut = texCoordsIn; +} +END + +SHADER fragment fragShaderTex GLSL +#version 430 +layout(location = 0) in vec2 texCoordsIn; +layout(location = 0) out vec4 colorOut; +layout(set=0, binding=0) uniform sampler2D referenceSampler; +layout(set=0, binding=1) uniform samplerBuffer bufferSampler; +void main() { + + vec4 referenceValue = texture(referenceSampler, texCoordsIn); + vec4 bufferValue = texelFetch(bufferSampler, int((gl_FragCoord.y-0.5) * 8 + (gl_FragCoord.x-0.5))); + + if (bufferValue == referenceValue) + colorOut = vec4(0., 1., 0., 1.); + else + colorOut = vec4(1., 0., 0., 1.); +} +END + +IMAGE texture FORMAT R8G8B8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA +125 87 23 255 0 0 155 0 0 255 110 110 212 11 0 255 11 10 115 12 11 255 0 0 +215 8 21 255 0 0 55 0 0 255 180 230 220 22 13 215 12 231 215 44 23 255 0 0 +152 35 0 255 0 0 155 0 0 255 88 20 255 12 23 121 122 123 241 4 10 +2 255 1 0 255 0 0 255 0 0 255 77 0 255 0 0 255 0 0 255 0 0 255 0 +230 255 66 0 255 0 0 255 0 0 255 54 74 255 0 0 255 0 0 255 0 0 255 0 +33 255 0 0 255 0 0 155 0 0 255 76 75 255 0 +23 120 233 0 0 255 0 0 155 43 34 212 111 120 255 0 10 252 22 123 215 33 30 223 +44 220 35 22 24 255 0 0 215 120 33 211 122 120 255 130 12 251 22 23 221 210 211 215 +55 0 244 0 87 85 82 0 251 220 32 205 +END + +IMAGE texture2 FORMAT R8G8B8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA +125 87 23 255 0 0 155 0 0 255 110 110 212 11 0 255 11 10 115 12 11 255 0 0 +215 8 21 255 0 0 55 0 0 255 180 230 220 22 13 215 12 231 215 44 23 255 0 0 +152 35 0 255 0 0 155 0 0 255 88 20 255 12 23 121 122 123 241 4 10 +2 255 1 0 255 0 0 255 0 0 255 77 0 255 0 0 255 0 0 255 0 0 255 0 +230 255 66 0 255 0 0 255 0 0 255 54 74 255 0 0 255 0 0 255 0 0 255 0 +33 255 0 0 255 0 0 155 0 0 255 76 75 255 0 +23 120 233 0 0 255 0 0 155 43 34 212 111 120 255 0 10 252 22 123 215 33 30 223 +44 220 35 22 24 255 0 0 215 120 33 211 122 120 255 130 12 251 22 23 221 210 211 215 +55 0 244 0 87 85 82 0 251 220 32 205 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +BUFFER position DATA_TYPE vec2 DATA +-1. -1. + 1. -1. +-1. 1. + 1. -1. + 1. 1. +-1. 1. +END + +BUFFER texcoords DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +0.0 1.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +PIPELINE graphics pipeline + ATTACH vertShaderTex + ATTACH fragShaderTex + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER texture2 AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoords LOCATION 1 + FRAMEBUFFER_SIZE 8 8 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT framebuffer IDX 0 0 SIZE 8 8 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8a8_srgb.amber b/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8a8_srgb.amber new file mode 100644 index 0000000..0240d35 --- /dev/null +++ b/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8a8_srgb.amber @@ -0,0 +1,110 @@ +#!amber +# Copyright 2022 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SHADER vertex vertShaderTex GLSL +#version 430 +layout(location = 0) in vec4 position; +layout(location = 1) in vec2 texCoordsIn; +layout(location = 0) out vec2 texCoordsOut; +void main() { + gl_Position = position; + texCoordsOut = texCoordsIn; +} +END + +SHADER fragment fragShaderTex GLSL +#version 430 +layout(location = 0) in vec2 texCoordsIn; +layout(location = 0) out vec4 colorOut; +layout(set=0, binding=0) uniform sampler2D referenceSampler; +layout(set=0, binding=1) uniform samplerBuffer bufferSampler; +void main() { + + vec4 referenceValue = texture(referenceSampler, texCoordsIn); + vec4 bufferValue = texelFetch(bufferSampler, int((gl_FragCoord.y-0.5) * 8 + (gl_FragCoord.x-0.5))); + + if (bufferValue == referenceValue) + colorOut = vec4(0., 1., 0., 1.); + else + colorOut = vec4(1., 0., 0., 1.); +} +END + +IMAGE texture FORMAT R8G8B8A8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA +255 100 0 255 255 80 0 255 255 33 19 255 255 44 70 255 255 9 8 253 155 0 0 212 +255 0 0 255 255 60 60 255 255 40 17 205 255 45 120 255 255 2 8 153 250 0 0 115 +255 0 0 255 255 80 23 255 255 50 12 215 255 46 11 255 255 34 78 255 221 0 0 222 +255 0 0 255 255 80 44 255 255 80 90 155 255 13 12 255 255 32 56 255 +80 255 20 255 40 255 36 251 0 255 110 175 0 225 0 55 0 151 0 51 0 225 0 235 +20 215 32 255 30 255 34 215 20 255 32 255 220 255 0 25 0 215 0 25 0 208 0 205 +90 255 34 255 30 255 0 215 80 255 44 255 110 255 0 152 0 225 0 21 0 203 0 215 +130 215 35 255 11 255 33 251 90 255 55 255 110 +50 255 255 160 11 105 214 0 10 134 158 190 0 255 255 0 0 255 255 0 90 255 255 0 +55 151 205 170 10 103 254 20 0 123 238 35 10 215 250 10 22 255 235 33 80 255 255 0 +66 115 205 120 11 212 244 44 53 250 250 0 20 255 255 0 23 255 253 0 43 255 255 0 +68 255 255 0 0 222 233 +END + +IMAGE texture2 FORMAT R8G8B8A8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA +255 100 0 255 255 80 0 255 255 33 19 255 255 44 70 255 255 9 8 253 155 0 0 212 +255 0 0 255 255 60 60 255 255 40 17 205 255 45 120 255 255 2 8 153 250 0 0 115 +255 0 0 255 255 80 23 255 255 50 12 215 255 46 11 255 255 34 78 255 221 0 0 222 +255 0 0 255 255 80 44 255 255 80 90 155 255 13 12 255 255 32 56 255 +80 255 20 255 40 255 36 251 0 255 110 175 0 225 0 55 0 151 0 51 0 225 0 235 +20 215 32 255 30 255 34 215 20 255 32 255 220 255 0 25 0 215 0 25 0 208 0 205 +90 255 34 255 30 255 0 215 80 255 44 255 110 255 0 152 0 225 0 21 0 203 0 215 +130 215 35 255 11 255 33 251 90 255 55 255 110 +50 255 255 160 11 105 214 0 10 134 158 190 0 255 255 0 0 255 255 0 90 255 255 0 +55 151 205 170 10 103 254 20 0 123 238 35 10 215 250 10 22 255 235 33 80 255 255 0 +66 115 205 120 11 212 244 44 53 250 250 0 20 255 255 0 23 255 253 0 43 255 255 0 +68 255 255 0 0 222 233 +END + +BUFFER framebuffer FORMAT B8G8R8A8_UNORM +SAMPLER sampler + +BUFFER position DATA_TYPE vec2 DATA +-1. -1. + 1. -1. +-1. 1. + 1. -1. + 1. 1. +-1. 1. +END + +BUFFER texcoords DATA_TYPE vec2 DATA +0.0 0.0 +1.0 0.0 +0.0 1.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 +END + +PIPELINE graphics pipeline + ATTACH vertShaderTex + ATTACH fragShaderTex + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER texture2 AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 1 + VERTEX_DATA position LOCATION 0 + VERTEX_DATA texcoords LOCATION 1 + FRAMEBUFFER_SIZE 8 8 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +CLEAR_COLOR pipeline 0 0 0 0 +CLEAR pipeline +RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 +EXPECT framebuffer IDX 0 0 SIZE 8 8 EQ_RGBA 0 255 0 255 diff --git a/vulkan/amber/texture/texel_offset/texel_offset.amber b/vulkan/amber/texture/texel_offset/texel_offset.amber new file mode 100644 index 0000000..1549562 --- /dev/null +++ b/vulkan/amber/texture/texel_offset/texel_offset.amber @@ -0,0 +1,58 @@ +#!amber + +SHADER vertex vert_shader PASSTHROUGH + +SHADER fragment frag_setup GLSL +#version 430 + +layout(location = 0) out vec4 result; + +void main() { + result = vec4(floor(gl_FragCoord.x) / 255.0f, floor(gl_FragCoord.y) / 255.0f, 0, 0); +} +END + +SHADER fragment frag_shader GLSL +#version 430 + +layout(binding = 0) uniform sampler2D tex; + +layout(location = 0) out vec4 result; + +void main() { + vec2 base = floor(gl_FragCoord.xy) / 255.0f; + uint mask = 0; + mask |= textureOffset(tex, base, ivec2(0, -1)).g < base.y ? 1 : 0; + mask |= textureOffset(tex, base, ivec2(0, 1)).g > base.y ? 2 : 0; + mask |= textureOffset(tex, base, ivec2(-1, 0)).r < base.x ? 4 : 0; + mask |= textureOffset(tex, base, ivec2(1, 0)).r > base.x ? 8 : 0; + result = vec4(mask/255.0f, 0, 0, 0); +} +END + +IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 256 HEIGHT 256 +SAMPLER sampler + +PIPELINE graphics setup + ATTACH vert_shader + ATTACH frag_setup + + BIND BUFFER texture AS color LOCATION 0 + FRAMEBUFFER_SIZE 256 256 +END + +RUN setup DRAW_RECT POS 0 0 SIZE 256 256 + +BUFFER framebuffer FORMAT R8G8B8A8_UNORM + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 + FRAMEBUFFER_SIZE 256 256 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 256 256 +EXPECT framebuffer IDX 1 1 SIZE 254 254 EQ_RGBA 15 0 0 0 diff --git a/vulkan/data/copy_memory_indirect/sample_text.txt b/vulkan/data/copy_memory_indirect/sample_text.txt new file mode 100644 index 0000000..5592c3a --- /dev/null +++ b/vulkan/data/copy_memory_indirect/sample_text.txt @@ -0,0 +1,25 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris semper a mauris sed consectetur. Etiam posuere sapien est, vel facilisis lectus egestas nec. Etiam in congue odio, nec porta sem. Sed vitae velit non erat congue viverra eu non massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Sed eu pellentesque justo, eget condimentum ligula. Etiam vitae dapibus dolor. Aliquam arcu ante, mattis non aliquam ut, aliquet quis tellus. Nulla aliquam urna eget tincidunt luctus. Fusce vitae quam tristique, semper purus sed, commodo sapien. + +Nam interdum, nunc nec mattis aliquam, sapien nulla fringilla felis, ac molestie lacus tortor eu nulla. Nunc dignissim est eu nulla pulvinar vulputate. Ut dignissim ligula eu turpis scelerisque, ac aliquet turpis tempor. Vivamus eu ex et tellus bibendum rutrum eget id nibh. Etiam bibendum dolor at dolor tempus ornare. Cras feugiat felis ut quam dictum, ac aliquet mauris scelerisque. Donec malesuada, turpis vitae commodo vulputate, mi nulla imperdiet felis, a bibendum lacus justo non justo. Proin auctor leo eget tempor blandit. + +Proin ultricies diam ut dolor malesuada, vitae varius magna ultrices. In hac habitasse platea dictumst. Integer porta hendrerit lectus, sed facilisis quam maximus eu. Vestibulum interdum placerat elit nec ultrices. Nullam urna ligula, placerat non iaculis et, sollicitudin et risus. Vivamus in turpis nec arcu dignissim aliquet. Suspendisse viverra orci et diam vulputate blandit. Sed quis velit ac quam volutpat rutrum quis id leo. Nam dui elit, aliquet at nulla consequat, auctor sollicitudin mauris. Maecenas placerat vulputate ligula ac vulputate. Nullam rutrum eu turpis non sodales. Nullam vitae commodo justo. In a commodo justo, non convallis lorem. Maecenas sit amet tortor placerat, pellentesque justo sit amet, sollicitudin ipsum. + +Nullam pellentesque, turpis aliquam sagittis faucibus, quam nulla lacinia tortor, et lacinia augue nibh vitae mi. Vivamus non sollicitudin metus, id viverra justo. Phasellus sollicitudin mollis pharetra. Fusce id metus vitae libero dictum semper nec tincidunt metus. Vestibulum laoreet eu ligula non egestas. Cras magna ipsum, dapibus a lacus quis, varius hendrerit magna. Etiam sem purus, aliquet non fringilla et, feugiat ac nibh. Sed dolor purus, ullamcorper eget mauris scelerisque, sagittis varius risus. Duis feugiat erat a semper pellentesque. Mauris tristique lacus dolor, id aliquet nisl molestie a. Nullam porta tristique est id viverra. Integer ultricies lacus molestie, aliquam dui vel, porttitor magna. Sed orci orci, molestie quis est sit amet, aliquet bibendum erat. Cras mattis rutrum velit non blandit. Sed finibus nibh vel nunc consectetur, vitae facilisis massa congue. Suspendisse rutrum ex justo, sed dignissim ligula rutrum sed. + +Nulla at lacus non neque dictum lacinia tincidunt nec eros. Nullam vehicula ultrices nulla vel consectetur. Sed scelerisque nulla lobortis, mollis diam ac, molestie elit. Curabitur dictum efficitur ultricies. Donec tempus cursus sodales. Nunc sit amet elit vel neque iaculis eleifend quis ac augue. Aliquam erat volutpat. Vivamus sodales sapien a nisl euismod sagittis. Nam at iaculis arcu, vel vehicula est. Nam pulvinar quam eget felis eleifend porta. Etiam elit nisl, auctor ac tristique in, elementum efficitur risus. Duis laoreet leo sit amet risus efficitur, eget egestas ex ornare. + +Maecenas enim risus, auctor nec arcu eget, auctor ultrices ex. Nulla vel leo tortor. Vivamus id sodales lectus, sed ultricies eros. Aliquam interdum aliquet viverra. Nam cursus tempor feugiat. Mauris sed tincidunt diam. Praesent sed tincidunt nunc. Nullam vitae imperdiet ipsum, in sagittis ipsum. Vivamus eu nunc venenatis, vehicula leo sit amet, eleifend nisi. Suspendisse condimentum nibh vitae nunc varius, ac porttitor urna vestibulum. Nulla lobortis sed purus vitae pretium. Suspendisse potenti. In hac habitasse platea dictumst. + +Sed rutrum tortor id felis aliquet laoreet. Proin eget libero semper, interdum urna ac, blandit tellus. Vivamus varius tortor nibh, vel ultrices velit accumsan non. Praesent sodales nibh ante, sit amet aliquet lacus laoreet fringilla. Donec pulvinar vehicula maximus. Aliquam feugiat, ex ac ultricies tristique, ligula lorem luctus arcu, sed facilisis ligula ligula non dolor. Maecenas vestibulum dui lacus, eu aliquam augue elementum id. Aliquam sollicitudin tristique euismod. Donec vel risus eget dui convallis scelerisque quis at ipsum. Integer tristique varius nisl quis molestie. Morbi volutpat ligula ut dui lobortis, at bibendum lorem consectetur. Fusce non diam quis dolor semper fringilla. Curabitur sed condimentum lorem. Nullam viverra, nulla non pharetra vestibulum, lacus lorem mattis justo, in laoreet lectus mauris elementum massa. + +Pellentesque gravida hendrerit iaculis. Nullam sed efficitur augue, vel cursus justo. Sed et arcu risus. Fusce a magna tincidunt, pharetra quam a, tincidunt nisi. Curabitur euismod metus quam, quis mattis risus hendrerit sed. Nam sit amet feugiat orci. Integer finibus arcu id tellus aliquet, feugiat lobortis purus pulvinar. Nam sit amet massa elit. Fusce hendrerit ac ipsum nec consequat. Pellentesque gravida varius eros. Donec vitae enim hendrerit, accumsan dolor egestas, faucibus nulla. Aliquam eget neque ligula. Nullam ut justo urna. Sed fringilla diam vitae diam faucibus vestibulum. Vivamus ac maximus sem, et viverra neque. Pellentesque sapien mauris, vestibulum id augue sit amet, mollis cursus quam. + +Vestibulum non ex enim. Proin luctus varius nibh in scelerisque. Pellentesque ultrices euismod tellus eget ultrices. Pellentesque ac urna gravida, interdum eros id, placerat turpis. Sed at vehicula dui. Donec consectetur egestas tincidunt. Praesent scelerisque ac risus tempor feugiat. Sed nec dui non nibh scelerisque dictum. Nullam tempus suscipit maximus. Mauris iaculis ultricies neque, sed porta neque molestie vel. Aenean eget erat viverra, tempor sem in, maximus enim. + +Sed ac rhoncus libero. Phasellus a justo convallis, tincidunt risus et, pellentesque tellus. Maecenas non metus neque. Nunc sit amet lacus nec tortor porttitor hendrerit eget vehicula lectus. Maecenas magna velit, rhoncus et lacus non, gravida condimentum tortor. Sed faucibus augue est, in imperdiet ante lobortis sed. Duis consequat elit risus, vitae aliquet nunc luctus ut. Pellentesque laoreet mauris nisi. Curabitur vel leo a massa tristique fermentum. Nunc urna nisi, sollicitudin vitae massa sed, faucibus porta turpis. Pellentesque ut orci nisl. Pellentesque sit amet fermentum felis. In laoreet pretium augue, at pulvinar orci pellentesque in. Quisque porta augue quis metus rhoncus porta. + +Donec pharetra urna non dolor elementum mattis. Ut tincidunt lacinia placerat. Curabitur volutpat aliquam vulputate. Aenean malesuada vel tellus eget imperdiet. Mauris convallis consectetur magna. In a efficitur ex, eget fermentum eros. Duis eget volutpat sapien. Nam commodo metus et mauris convallis, a faucibus lorem accumsan. Etiam at felis accumsan leo malesuada iaculis. Phasellus facilisis tellus sed eros pretium gravida. Mauris ultricies quam orci, a viverra magna aliquet a. + +Phasellus non neque et purus cursus fringilla. Suspendisse ullamcorper hendrerit eros interdum sollicitudin. Nunc fringilla mauris facilisis, pretium justo luctus, euismod justo. Donec vitae sapien ligula. In et dolor vel mauris molestie tristique. Donec varius at arcu id suscipit. Proin ac dolor egestas, interdum dui et, blandit dui. Praesent commodo faucibus felis, aliquet fringilla mi auctor eget. Cras id lobortis sem, eget laoreet erat. Nulla ullamcorper mattis magna ut elementum. Nam feugiat convallis dignissim. Ut maximus non mi porta tristique. + +Phasellus iaculis nisl sed ligula consequat, sed posuere nunc varius. Ut egestas urna sed lorem pulvinar, nec scelerisque libero consequat. Sed enim enim, mollis ut faucibus at, pulvinar sit amet eros. Vivamus rhoncus, elit a fermentum dignissim, arcu neque eleifend nibh, quis ultrices lorem ligula. \ No newline at end of file diff --git a/vulkan/data/gdeflate/compressed_17k_level_0.gdef b/vulkan/data/gdeflate/compressed_17k_level_0.gdef new file mode 100644 index 0000000..834eac0 --- /dev/null +++ b/vulkan/data/gdeflate/compressed_17k_level_0.gdef @@ -0,0 +1,45 @@ + &b*ocirrtueees mtme uotird p dsatoudelmimo pprdioeosr lc moiiarnng gcns iaied tlia idlatuim,nqe tuts a,eu. dt c Iodlpnoass bu+{k m en n usumnonoclcr l.bai ilcP iihlqtaeuuroede titu nrrb anit abec emomnpnodovluraem ls iltediin seie mupa. ot ns Diueiselc“+ m teeurrntimt seumtnmoit rquebumuie . p troAiislnsuicueqisrud eaun mneu tcrs. ne famAe dunfigerpiciia.nst gc Siiiilnntlg 1 mSeaeimnttpd oipartum. re vutVos ul flugaptrcupaitavlatiit dsemai a soeq dcumieiaonsg a nusbat l vaeeontnldiiuiamttm p. ba¡c£c.l t upuEsemt l elesgetoen lstslteoiaslcsqli uittecue.idl tilGunurd saia vncri udaotacrr .cui imnP hptfaheeralreslmteuer›s C elimnasadc srucsesuar r ivsmtiua vssde sormalra oatur tl vitmisrat igamcneoia le.ces os Sntmegiidue e qa.auu igMisuaa euc‘«klo iiletslg ieaassmt.te. at Ms Sa.eil steDt su auipma leduatatc enforiarasmntlea. sr p eVua erclnu eestcn utairutnpsi i s››©ueedr rinvroaia v fceoaurrcrrcisailu ismss aaieugsgri.eit tstN iunisnun cn e cauv l esivlcqo eulrlauiemtsr.pui assVt qi c³{{mlenmastoctedui osbi unvvl ieunvlmie. br +lhr +o aNrm oeamnmua redsiciesead nm ca ruspir hssaauucsssce..ul mlEAsusnasttn e± aielsnsa tteniesieatb. .h d TiNmecialtbuluhrum issss ti i tcnv u earhsmsateucits b hucmaloabumtimmtt oiardssho so menno cuƒ«c«len a tm.qeo u lBiieisnsbq teunineied b uehamg . em nsaSetuiqartusi e sa d meicegautemr s.set usaIstsn mpcealostanttcg ie ›““ap Ntihu sani.ccn .Lhi aadEcb tuic stum arassslesuedess uvpmailedvataetu resfra aa am dletiisecq ltualuacumm ss t teui.ls)“ievAf oteql nuutdate mpmm apivto i rivo nedc rionromua ml foloadarco ci piluo ilsssluaiaegsmri cetmo.tar iupOsrer irnes au.a©ldu.aim cn Pu nustor enuvm sepc sooftrnai subiecudcil tbueeumuts. u nroDi risanal am er nresua ontslc ul.nsi apcDmeii ntcad££Kst iseasemlq piusoqeeru d ai omnnr icedsitii ic eatlumua mcle uornsbao.otn r .Mtv +aie +gslNn.iaa tm B elsatactine adllmiee¡“ tt.tu snFu ialusclrlian lmapic rsodeirutspii esulr.me oeTf geuvemsetpcl oe nr fu irlndile nacvg eiffllaeilcutaig liuei£››Kiqu .use e.uCt ir Usaslmsato grdsii.etc dteA islfs ie nqlieuidqas um ce eo pgnouesrrtenu casvtr eeeslt iiuattre naapemluae“s£3 raslid unipcgprtiieulstslci aiuv nmeug nr aeneenanna.iet maiA nsme. eu lt Ne tictusteriulp slie ussms ta e gcgsnreiaast st  “m.m e itMsn aa ftghatiacitcist l ihiesasn biivismit tamuasatesg .ent aeVp lilelvatuetisrea ramea l dtetiemecmeltpnluotum«›› tlqs iuevqe eu psaiotmnti ebednutitliciuat mmun. mu e.lVr loaValtimu v tveapercalr tiat t ob srlsutacsoneprdle ienvtrdi iit›› +eser nipvtcuieirtseuaqsseu elfa aaumcucauctssios brasu esepd ul o atracunueragrpruaieets. udtUtuil.int scrP iieudclluc£sktoen dt i uedert.l +eat +m oNeerenrtqtaouutrem .nao atrDm ni racairttseu u mlsa e encvnotienuva senc.r o renAause.ien sceC£ {nvDmsiiaetauqamrue ia mstsa uepmschaceauinrrpaeiistst r uantl uetenlrtcli ucucsilo etnmsrga iuumcerie i snse i gnsaeei.tq©seeei.css tuDmisuab isuasslt au.a m ts T amecpomoirpnebosnire. c botNlreeactqniuud reie tula olclriuoeqrbmuso aurdmsto i³“› ndieuitlna ecmam mensenoittnt u..em s UDtntu i ipbs lheua mtct eenorlurallntula.sar eVmp iohltlaeaerceset ttupirsuea r™«³se.s l f Liaqinuub caeeimrub o ue mslei en omibreminn batseruenemdd uspfmuua slunpvceeiiqnnbudaueirs.s setVetui.irv apejK“rcluari ascasiul riansqduuuilsepl.tia smSec igivtene tgha imseceinuttil mana. um ileNpltusa lu tlmfea al aclf iuaalscriI›iAce nmesdorauragmbti i ta ntrtaicemsum paavutlis it lqaieueaca ctmeuu llsmei.ams +le +enuSstrauunpamaid eacin ud br.nia)+itoet r uptprrao.o.t i eSnPnc rtefeilet erinrmuuiemlsn lqtvauuimemv eaflrceer.loa i Asvst eu ilsam pupoegernurcdedii i seƒ›;+ecdlt al ulualesrts cr iuinn ce deqhisuac ectt uishmnoa cdbviaiadltrueainssut ss ue at dr puceliutas it.nae omaDn. o dnsTi{+stae u amcimsodetn t dn viicembosehntn.sit ebuLcumotl reumetmamu t rrti.hip ossNn uacpmmue sldl.loi elbAnoettrr e ouss rqij«£«sa ntmctoeoe tnrl vdadauoilmrcl etiveusetm l .cis otiAn.ttv aTallomelrecitttso u rcst u evrulisrltunuasase sdipiuduti r™K«ssi o serfls a teus lcuuiisltbct.uir spiC icootinr evnasaad lriilepni itssse ucgcsieopnrneg vn qadbuliiilsbsise sena .dut ucej£c#l moudorsort nbtieiidc.t . oi DrnSu tiimetsar sdausumtame . td +v i +enaSlumiil ttlq aual amafmeoa trcn eiucellotiln sasii etmsaea. tl iueNprsus uluaalmdda ia ap f ifaasacrcmicielunsi g sc aiuec rl nsituutuls.rl pavNimies tt vaueeesgh eicescottun c;ult eeem.oma psEduslusaei .msu e.rMn nitAa uc qm eu ttisu sarp gphhiiaetsrnt edietrsgre earvs iitpttah asade ro seleetotdrr mnsiausogli nlmeaa u ms e ufgnseeoputneg..ni daNQitius sasplmer etvitiuninl ucpemius dttnua intabtenh t edeigi.peg stnOuI#kc lrpcabaomitnc .sot +ere +qpmAuepdaruit sp.s i iisVtaci.cit unaNlgeui lseal llauii rtqfn uaauec ttii ldani lesvicioq luumua{£k tdup eunlrrieeuso sl m iosvnrie.btl i P aphlmraeeerotte. it lurMumaac stlcsueoascn .tve uanCslio lmnqi susnea eqmpcu o K›#cuesnimu emmnn eutctnuoucmns .s m evaFquteultuapigtusi t anaetitn seipl mr e evuute.til u.Etm ge Telnetlil ubleshug seei sƒK£ ac siQm luapiitusstri iusvss i mvnvaeuigrnvnrceaa r sreneatid ib aahbcm lc cautrnmeadsmsiap tnop. ru i lDnovi.ria cnmFia s‘ƒKhsieauqmssupe eolutrll..ut srIE innvc ieiamsen tstni eebt qurmulieeust mtuv isolq loudureite cpmnta uutslm el adaac t ra tc£K›n necn siududliaulcdnatat.u mfvE airnmtaoeatnse vcaseoceln mistpteue crrstp ceiqetsulu.ier sr.D i ilsEceqttcu utemmu asKc£+ scrvqrieuacseset .sie blVtuieiltlnu icmuti l drlluhaanomotncr coeaurersptc e ueri s dntd o idnpgo ennslieolscdes aniultmle¡›K..ub + au +UmsVr ineevalte e rnimrufoanel cnea dsci.tcd iu Memca susaarscnsa. u issRn ah mponeinitecsunuls s f naadiluosicl‹K{srtgb unipmi u strfsiuainscmc i inlcdoiounsnn ivtesa n.lai lumAig rsupc erua a eieannscete aentnrto.d r uetUmlot er vm meedolK“Kst d Eanerpuuoilisbls uamds oo adnut el ictvn ro ailpccue etlospld aeiitnon t .det iseQaqmumupi eosu r tm l aoevsrcesctnaiue™samtttauiigsnsn c amit adeauulcrnl itups sl i audicl neta.rrl aiiAtcqe eunvseee.tas ntSr ieipbdshu ualtsruu emrft perliuaesgI›aqo tuma.emr ocCiduodo n ddneuiilimbi ehtvn ittavuotamr m tiumomsarp t.eat rriAdcsdiu ie pptfei.els llcOieirsnnn.tga e rD+{klearon.ort i uSnpmc u efrfleuaerscrm iienlsnoiqtnsuu iemes n flileemelo oi p svrv eaeilelm s poefernrrctidi ni egeplitoel rcƒ£›aqie ussnetuo ianaqd.dua ie Ip faisacsemucneliesinc sgta ucacs to t meuemtrro padnitoes t peueelsgli eltese.ttn + at +mseTa.“cqCtlaoeegnrcivdttauutlmsil. si s sTii itdcn. oc cniEovdgnaueslntelt ci vtsdee ulttiiue trlu ltapu lusoir rquinusdae. rt ie M™ “eedlc ueemnsnot ar usbat ir p cehlutae ironae omtun rr sansi aotc d omaanolmvleeaestls .ltn iieSseqa .ugp eioT tsistunoiecdsK oetbrg iceabitme .ena td S usenmcmi.e s lnlDeu orlsniluesascq c upieehpt ai prtoue drtaiurdosai ppsdieeislmaclpmiee nnrsgtI)+sgrbqeduususetm a ndscii osaenlmgs. ee vscSottelaedust t.uep rgaS etuls sitcpbaoeesmnr mdoeoi gdsieosds e ts faeiasdnu tcf+K“+iruonisdgs aiqallutele sa.u rupSnthea am espcueeo lrnsl deueimsgm eeiftnna ttuduecumgii ebsmru a satv ttis itctsaee.ell c›R+ulnnsld tu nosde ocefn.gae eucEtc u ipimbrsauemgston idasu cmlfe aelvcreuimrlneipinsuatqt uuaamett. e e qPlsuheaiaipssfi ++“{in.ss tusI sonq.d u ahiUlaslecqts ur heina cebseqiasutg eait stisstnoeicd siap.dll +uea +nstPt er uaaat er dsceieutcn ittnau kk›epltmru pomuei lrnmt orfgrierbcuaiegv siib adlmtaai n nhdtieiebntmhd p rcuseuserr.dis tuIp.snu lVriveiaisscntuuaislrb i© ›K baanhm u elnptacr c apuseusesr deuv nseat su gtgtriurabeivu.sil tduEiamgq. eu steUe ldaml laaaigmrqnccuaoue r tspn ieontrn™olaad c iriiohld oi ensvucioiu lssmum otomrpdaba.tit t Pitlrseao mcirpunhus os sn laciaguaoiscrt uetuleiritsns. a n.uEi rn3rK³miel trauad teif eatetcet il dllluiueisso i a edcmlucoeiurmsmbe sinua.ttn u. Em sn Eiisltmai gtali motaebtttoi rsint muiƒc›K bu.sua cstUe tlii endmr oioprsrobqnriuat erat e if.nne +icr +bimEhdet un vnttetuon mrea tnudoagurtui ie cs fo iancnusrtceae‹›“#daemup mian btuvu lesell laiue tlmp.teo rnrAittccut emios td eoiiuron .fmt aaeUcsmrispnlaoai r si midoos rl.nce eisQq tuuK +› imaun lttsi eiqfgtuae auramc m ieevbnteui ssmnt iipnsbuelulq lvusuieumn.s a cmrPio hpreaiblrtiee .mta erdPnaiut prudiumis Kildtni gsvi iomb lpimuebotrerpdnbaiditeu tmtl eademcuspuitus s au lcliactaourcrmiuescleaiitnes. s s.uEi rltFni aatac mK +{tien.ntc .. F peDIuuomlgnpvieeiacrnt da mirnae.ist bs Nhamu alsssleasadpa i ppetounirl ntvfctiaiinudtacuorinr bt pu mrsna©›ksos arud bmiii cd st buunlsmeap qnefudnueids tica.sel s iEeuqt tu u.ael mgtT eruvsiretcpsaeitsssi bqgcuuruliarusvsm iu idsƒ ¡i lnnqec um hienasnocqtn uu.hem a Mbsnaiaittgbtaihist sstt eiea sllp.lil uqaEsutu ae mmalo olfdbeaiosucrtcttiiuiebms us ns+«qp uqunaurumeul. sl e aPli henpai osfmseeaulnseldsru aesd otsfneoaemlucplc oiiprcbr iuentsteu icdsu.icm ne M lviaeu lrliiip‹›«ktensat t amepri oc srutat.ept +mii +petCunous.rr. s PeuFegsele rltrme iendsntoutelsuso mqra u tdem u ouisrl ibtftira iuancc{+K+bladui istpp liieasnucc ieiosrnrmagnot ad.vr ieiQt.nua ieAps ue pglerulloeeei ninitf.nee tsnIeqdnru deqpu uemmal amlvs e› sKtcareictse tqstiu utelro aprmci ausmss as esasgs eeapds l.tia adcMs ea.nrl eaeQqtsuu uaedam.ud ianIs up flsualulmamte rspcy{sn oisPnseo iqresutn.ati timE t gnopeirrss atlrea hssvoe enndlctu u ipse r liededtom ileouonrmrtn ualpmreu ecrf tuaauscrs icqc«c etsonoodtrdietaosol qreuu.ste + . +u nAtVer iccet utan ieana momt n ea smlsipiotuqd suaa almqmeeu stas .men meVp qeeeusltetI+bln uiovltnau. rm ni Niurisshsi ol sn eictstuit sn.a c meiCesdottun nsmpteae qtleutlgaieetsnt t ivennusutlqlepulrueadt muai£“eaat .iem snaP iulpmrau itrnseuu asli lndsa ii.act lt Siuacqmmeuselattem r qvisuoseilqmsuu qtefup reavi tins vgaceigorlinc£›£eannqneeuttqa uutmse o mregabtrui ar mvitaisrld.iea ss Ptuieianlqd luafee en frtsameemesnenqestuc.uet m uA hsuea gtbeu.ite ’rde oullim on pr vhelaamirr.bie +eut +rsrAo.au cnBvtuieonblrce ntucdurournnmpas i easnqt uu nnavuctan rciii dnue tsgce eu³£“sttcuu usrnl puimilsesl t auut rsifn naaacc liiiidldqui.uns atiAm m imeedotl r eabtiliefi leqtlnueudems.tp .ucS sreA admis)  a edcmhiuaipmgci nussilcosaic nidigiip ssse unnpmiaa mtra ot equauurr.eic euEpn getcen.uta r tNsgiuurblsaul vsavi mide t£³ ena . me s gMeveodisr vtbaeaidrs ir qpaiui nisotscre icgcnieog rm s mdaeoiggdaieomtt .t o iadOslir.ion q aTuarueeertn p eqin«›K#bonnhned.ecu c.mA eaDunduteii ap tnivr siiscvseiatdnmi guqa sudt eira.pir iscSstueci diqf nuecgelr iadrssii asbomuir sbn) risbeb u edsano.rdn +cue +umcL eduaoutc i. v oevLdliai vcofai rmntiuiensamg piaqolrurlci auso refvcseeitll i duseal rpl{K Kmo.ec couMtrtaup gsesn ream m ae augncreu itlps.ll. aa I cCdpeu hrroaaarrtbne iatvtrreueasr t adivribicautumla ueosm di n£c««nt rc ei egssue e.tcd u Anrvmuseenultcsi . tv m eEadnstiettgn inaasitn.sit sseVi emuil rnisn toan d ilacbaluhoer rssme uae›«£ ucFi.tad ou Ercds iotebn lueuisclt t pursulieltcdvri iievncsuae lrsip nuetttlieaengtmceeeir nd mtuqiunu mtis siia tnra.t«)gotserrsrcua im e enptgiheemalt sl neueelsgql.euu sesTt. ia ensSgc.oei lsdIltunian cstei sttotuer dlnailannurt seea crmi© s tgentioiit bstih in estmn.eai gumMer ariuu strm iactslue erlvssliuuutassad. ea e Dlunueluimtn ercnni utcvnuiecmel s ms r cKKsmseu itsc i oeacnsmovt ma tmlseolimditpos o. ar +am +eeoAntrce c afitna o cereiuttl.o i rtsL oiodrsrit egommnra i.gds nosNanK)›cteo i mmenma.ios sdsCioao nvussilaetlpqaaiuemea.cnt o Drfmipaaceuutrcru iimabs u alsnta u centutces m.mcp oooAlnrceg «££u airpssph lias srer edhet ogrsneaecs dutp sahr saim rsaseutetstdr i apst.r e ermTthpeioumunspmc u uusqsr u neauagmr e.nes a£s ncroe arqt uucaerou pngvivuisaev l eelmrgiaresuas r tpijaosuss s uatmeuoarg eeunc eeem cnon.are sbqF iuap.emh .eaA sruI ecd££iumvnleettnlertiriutdcm.ue mscU ulvtrteiarlnbiicictite duslur an eotvrr ioeatsera tcei u ni n dnuc onudncro. sn sueEescld )¡£ueudrmsippcgioensr.i. s nEsFegiacemu t cf dienibuuauglmsil aaqpt uu firnasuic ssie llni iinpsm ri.me ateVsitusuilamap mu3¡ atistib.esu lNouuudrmnin coam osucretubd ri es bnublislam an endbgdileitatt n ldnciiuubtnre.csr .uoV +s e + vnVroeeilnssu£«£cpanIamentcq oudsreiep cdeat rluc imraq a unslao.amn c Tuvceseom snpvtsoeiersbc tutcileobutmumuml roum dmoao.r beuIirld.a¡« l anpvpaueimtne aenatn teap teleileuslc etsanuc tsece losuenqrrduniieasm .qeh unaIetbn ui fmtme aelvntiitust s.am eovI r#›sislc elttqeurunsiat stept sriaqoqcuiu enef. .e n lTiViobisrht t adoneori n sceilocd n cgeaoutlne id oqiedumuiee otnc toplu++k“ nnuia ed b cldvuaierngnsdneuiinstsa stemiigamses .tse .anA imMemeon tlis emivs.tet niPaeeemn leanlttue innvscte enunse{‹s›a cstui iteps sr d euimtraiinm ua qm qu cuiquasurm as.hmu e sMnv aduesrlgsepearut it.mta +a.t +s eLsS eaedo di u gdlrnutiiirssK«›£i eamort raesntaua. sr dpeCie ucnlrtdesuicumstsssu tesi.. n s ETihtita n cmca oimhldeaeutbsn itteti saedts u saipec l uapfc+›u e gitEin na mitiam ag scnneuiudlsn.i c sd O ifrnsacu uinpc caid rbastupeusidr b.iau e sPnp eteun llamlttoerinnibttcueeesssq‰utacee i lmlslaiiuestsci. es mn Loavolsobe losaurtctticpieuas mt ns euaelnnsec tm l enavnocetnulu.sim t Vv nieeivlgbe ehrfs‘ £«algvstee.rsl itiRcatiis de eiscuc.oiu nslEgmuuuos ed m miqiu unsbi ispmbqeaeulunelrd.eiu nsmIt nevntsieeqtqruaudeeeu mm+ £sa cseSta uu csmpop lnefagnucudseeicr seams taeu u tdru uilpistls ra ricuhceloertnsarc tiug csroi areavcseii.nd. ea Va EindnsIK£mist n oucartit d nsuaeenuqmtgu uevle io vvbeieogtrreartteai sata relfcmieupqu.uug seiS taeq.tmu paCvemrir av psaae mul«c«enerncrat e.es seaPqdclu aeauc uteng reucaceot n nlsoaaermcqc.uui +sa + tnIv unisl veliemaarp crepuarel. li vlsPie ovnnset«“+‹suncqatiumebe ru ldsdau icmtgu.uns ri Spsseisudsis .mpl eiCenbunderiirsmsou.s s ee E nrtfiiiamsau umcss ie nbdaou tnsf auK«c+tr drra iamnc eientssa i mc m ulilra isctbuueessmr possu iesjtd u. is vmtSipouve serlprdaerionaerd teit.ese tslV elis uviss£+ijianust suthtsiao sc.s . eu EdlUu ltiva sumemlcuopo durs tpelaematr ce ii.vnn etiVleaeig steat rtis bevqudiul tiuuasmle l‘k ›muu cseeoprureeipn.sed mriEo sgdmse oesnr tibfasiasi u tcepiironbarcuttis ad i uimlnnpotter.ere rdmLdi auemcmtou lspsl oei›#›;.uos er M tfiqoe urrbi misaebqlneuitnequd umuea mgmo e dnsnietuoqal uslee.au + e +ffgTaeeicusnigtcliaiiasdst ui.cn otcNn ri£ ›hieu nssnt iu gtltr lraaaivmmsie tdtvia eq chuqoieumc imumsola dagbo nl iaanp nussdluiilmtta aatf.mua ercPtpir ilapsieu.›“aDeuaomsdle ionaprtli uispmqcu.uir anuUmgsr neenalno einnim uf eneencnui d mi t dmup irrc pauiiernsss. eu ensCgt re maseest£ Ksscr iipcncrogeem.stm ioQgudurmoia svao iedidnipaeos a udnami.e c nstOeuudasminp.o e snLmedoodirr sebasmide i dqpuouill›£{Krcn iarse heseod gn mecvitui svqe euseritsrs.ta hDpieiepnclsdtluruememn.rst iteMt sa vqsdeusosealt. oi urbQl uutmliraus;k©h iienavnomedn rr sresiarot id vtaai lmtdeeaostel onncreio qsnmulgae.ug ensA aoue dgueau glecee otsln. as uceAtuqr suce a£³£ rteai dcsp urpfsaue ellasviteis nn utadl rots.nre eimCccpo.eem srmB. ol +fda +eonNu degniciut al ttlci aunn rcifsibaudhcsu iq›c«i ltsclriuii rccnsieuutslsu l.dda iumPni o vrtseteahtmpiipictoeuornlr a ie ldgie epoets u ua mm ni di aisp alram.or icsUn{cs¡ edtI urdmii e satntluuiisnqq.cuu eeBm tlas aterntnidiesiscut.ts u mHsfaa esbeusitgat.i a aenAtntl i iimmqn ou nraaebmnci )ltnieogtir ftaaeotmnr.ed t aL mtadi oi rrciietnseu utmns u sslviilittav eaaprmmoreesattu eacjrduueirs.pst iuoEss.tc I› rdileisemploei nsritchnuio mnnv gcit utevsami eptm uaatsetu. tr pipMrsiio s ir inhmp oassnsuacsmgua is ft.sat +eui +dcsI i deba«ssto ialvtsli itaecamrieeat ttua dlriiiimnqsp uuetesret.dm ipnPeoeltrca.. c ueLAlrellaoiat qm auci aondmr i peasegmere m™›9fucpreuei rniddgniiitcelettlru admn u uumvlt al vramei olumrisabt li.de ustAiuiusang.dcu aieT d epuemengplteul tsea nuait“k+Kssneqsadue e ei ptdeo ltpsiehetnam trpeieeg trenr tuar.l i lpsVahuimasv r eaeirctnr r atah o esrmnutadsosrprsee.arn .idU t“›rq aepUrrrlerol aiam.nma csFgoserrauap gveeiirgad etamt o nhreiebgbniehd s rttseiaernsdic tipp duulurlenuvctsit nuovasrir.³IDlluuillisut isra icmvccoeiursembtssii a btntur elismusipmttu i slqa oumireeae tcmn u unlsluiellsdal. .a r PiRfhshaauocssn+{urbrspoi ersertts iitdsq i upgfeene liuslsgeesinniaetmtce .tsc uqrHsuaa esbe itett.lia innDtctu i iudmsluo lnrtatbrm iicl s{££si edqIr unrfe ae a lsrniocislub l heic gcuceirrttsa uusvds ei plneui ultniv isiabmnlhoai drqs .uiq etuCt ir asasm saev gtisi±+£ tscmisoesant. g +sur +aeiCp soimuneassnu e.rnc iutAsle .lta aurUmrcl ulel agocmeructero msrf upedselo rinv seis ctie atgme e £+ g neniutudn l cvln eaell qoifubtaeo.c r iatNlliiiisbsq.hiu .aCs mriP atovs re atssmtteeiidttb oufcrleo ulmmmima sosm dso{ ““bihniuoc snub csldu ausani edsdni oetala.ton r Ec vgopeenultsr eueacslrt icentuto unsdr ci eeclnltoieurmrme.i m sv.Rqa hu“z+{. sm i eVncte o lvmc imoptomradmeeoot ditoouud mrin pouli lesalc.eat n uOefsdaa incqo iu slameimods r.iib diSn iulqtleu lK £mois rd v aeea rhuioignscu uefil enamr amciueuprnrsitsusuum ms a. au t.gMu uarOeupr ricnisies q mauuacels tsagrauri cact³+Kcna uc emipl dhenuaiunsfnteec ln dldauu.lis i Dqufoutale.uot cr.Ei gbsFeueessdut gasviscia evtfle reriirrnnia gs aiqinlupt+›+ unumlemelq.tau umeHsc a olbdraiipotceratrenu.etm t P maosotrur tsbtapie e mnntpodroniir ss pstcueiol qmviumineont daesorre!ssedcitsusse epto.t ePnrteit inuuml lvaimv earcr at osrutsopre.SÁD±ß– \ No newline at end of file diff --git a/vulkan/data/gdeflate/compressed_17k_level_12.gdef b/vulkan/data/gdeflate/compressed_17k_level_12.gdef new file mode 100644 index 0000000000000000000000000000000000000000..bbf408ae3e3d1848fa2c868278d69486ba1b608f GIT binary patch literal 4076 zcmbVOWmFRm_ugm_k&*@l9T*Id5NV`C7)XPZNRE=;$k83+$A%M-kdh7s+=!u+)JSPW zkdz!XslV^}zwgKQ%ln*j&-2{-JolXY@m9ScrTL47PRLWryr9e?5a9HP>K9zt+g|1nI) z@5?GZ&*W;(_JQx6)(yF9ntcOBYYd^?(yGtd*}hG*tOjU{@EqU1&RW zw)(oG=SQduCdB3Wo~YCptq_h-ByYKzUm|vs6@Q4Z=+`xm5c)OpMzYOEk+hcTswMwj z!JMOqaUVOEsw$t$g5;GIXd4gR;&TBxl-P_$({#pX z10xED4-twpZbZI{2V~uQtVVZeUHP4})iYERZzF`>M>85Aa`ZXYIXP7dnQ(#mNo(}| z{Bl9=_GUjSU$4CTynWr__8Uq_yuv!^u;)IFLGV?ChwPZEUaO4iwOT(qlc*wZ-+0DQ zrcFMiPky-Tb*>8yNc{lVB4|vS6G9)y)X{8864b>8DnCBo$MBOv4SxwWof;D0dkk=@ zykf$SeJhjUFv;;@H9|(~KA-S%GI~hUi0XFHou5_w$jiGugE9jXgjX)4iKXMkIP(lR zZ%M`8{e|6x*Wnh$rDTgNh6VO_+$9nkK@1TkQ&qmNJjrNr*RndacaS>2d996K zz9z)%3R{~B705>LoCilY-mnF7h1}FXtv*F&nxMx@88y8Xaqrc|a~Lg;A0(T+(nh!% zv9W#EdGesY1!t7XB3*0WY! z_*O0HQo)5y{8V~*z@c{E?L89~sZUcTi(upsB*Q^RcM2p@kie4zc28^wQiSC10%?|S z&8$poT4wv7Ba4@8E<&k?Jmo%mji$6t-=puy5O=`r)HW${2QhNfmIRr9^-MoCS6)v$e^S6h%I#*Hj-9#2eGnAI{fI-Y8n)blxb3?CCznBzH z4-G^B4%M-_Im^tbblXPs$T$~B6>LBC=0hfbb`H{}*?_R(%UZ_2v;rJ>*z?AR?3ZsR z&84~Eja6~;#AwGpXykpc`0JvpUZ*ZSV&&hed%rx*U z7vI@FWt)Fo@UAMrTL_KVCWvdJg>+p}-XA0dnIih%$XAdv9?m_7mZ#bUE(l}K` z+r1~@C8GMF8!l?o$neT!JD8)Pz137(dCGE^&v)tiSm8Tcl<^0~nE2wbsslrnbXiI% zevpVDziD3~CjX~ekx753kg-@KA0WRlqR7{x%(S2cWUz0Ty=}%~XeA7KM>8iEli}w- z9|XQbU_4R0ui0I(=ZDs4GXfQH2x2tUE>eO--0mT}#NvkvW7E-<(dRed+{i0caQ}ls3I_AoZ)ig~KBecx>oHm^-4k z=5f*T9SDmQ3035uM}SQ?t07q$mRuC3q~_o8#X4%7I;-a37UX|Tod@HG$f@t&n2}~LA&VmVfpNx!UyGmY4tMs|V z5wGl9r+2uANyZQ@5tbg!O<`UCh9e*;y8VzbG zScTlKk@m4Mbj}Y9o{GmTys^2d+_#dz%LXx;`eO;wHoekF8K+X@RAD8se(&&XFUUS$ z5;v;r9p8d}>gLi-?sK#0Jn_02_`z@@#90V>dF3{pmiU?Dr{-&4jGwOUd->M4vk~UU z!Y(rt3HRai1-fxy!!Zb+6#RzxOiFf`I9#Lu^S5$5YnHd?CrqO)%*ERCNO1lnGb(_^9vnVG z?p~*InVf*ub zMMXXvp|*OWg5OjEu^2^z@3AOh`gM=1+|+5;Q27Q=&!0ui&+>wc#~+m3f6+ZNpij`b=frM4CQCBT#~jg6&Z zjJ2#ZGh&)5%yqQ%vS7UXD~(+~J9J&ue|C6I%NMSu`cvz_iRw01IiR)*&CQ`ke7aV6AGK=6dRs%ZuKbTx{`lf?)8J+?$ zPYRT{_n`yud;A)-d)|m{QmKz^Dor^h1siC{7qbU&1 zm{+)Wh->L8W<4q~B$lts2zbqjWa}X^|2`$chD*xBoS!IRdU)l$1;xaNy)0l>@(_EC zA@Cw=(Sh$;PGPgrR@R+_ovguy-9!AAs_$7adGp7K$~#5#J5C$qpTK-IFT`5h93Rtp z*&Gcv7r2a)K7J&&;gPHAnfwiBYzsQj$>XQ0#SN(Nmmg*K9r$Lx_ucE66O_?T@~hVw znuE2(_InwlJ&M6PPPj)bbyQ=LmElYnNWv_Qysn&^*(TGMRrv)^eSV!>Yf^1twIE_C zZr*G%1XpM}44?2+!dJ&G$PP-wH(AO9PEvLpv~8SVtL*HhogZA$AUJ7kItRV6((6>m z$Fcr%b1)t<=9i8AO>7#IyY%j-&_Xccfk!WLF}-JD$y({u8R9&|guPmnrRs)>@NbVF z&g~zq`=vZue$-n(imkI75tryp4KJhgZz3$wK{Z=`j(#ay|C2-~wPMoZNyX8nYE@;W z8>Mm7*px!>oi8MZ%cM3X1KftpJJ_GySouYKb%+B5AYS}B9uSvo*zn?U=jB4Pg_D?GK_QK)WIX@Ou=*+uJF|b_>B4&KvI&{7eNt%$XfDwNg;@8`1*RMBT z&5UoIZFZ}(y{bEJUIAB?{SHRdkT0sgwYg=$(Jm#&n{f=Sk9$s}skYxA*>=_V?NJkj zKSn+uxLp3HgL?;-R+*--{6KlKiaGDGeatuOgF+(n$$0LQU6)&B7%8QDl!wqRbmhtp z>b22cDb>k1*5z66K;?+q5GmuP*!RALO?|F1pUO1e%$MlE+CsBg5M^!X&}qe0#R$+U zLBy-I#%6xAnG}gpnyN9Szv`}<^l^}F&&kglv)+C}7;Pad?jkYqIDe0^_~e)C^^9E& zEBmegiW&gW*a8CTXMup>+)PCMEg(Qz5Cup9003fUlz{hW7NQwt3Y1}h43G{401Q`I z0JML1+El3kNq;l4f9qc$Ndo}Lzq~X5H}r1|{gq#+{?q+G+mZnQ0{lRV}2hU`lmjD0& literal 0 HcmV?d00001 diff --git a/vulkan/data/gdeflate/compressed_17k_level_6.gdef b/vulkan/data/gdeflate/compressed_17k_level_6.gdef new file mode 100644 index 0000000000000000000000000000000000000000..17ff98da9a16cbe5376789ef1277a8df3a95605b GIT binary patch literal 4224 zcmb_WbyyP)*B#A}4k-r`lWrI--8rNsq)Q!w0z+vDB}RiVq?>^Z1YvYZ2_r<5+9V~1 zAkuul_xs*IzW?5T-upb~+~?eTo^vnC;mkQ}*2>X=Y!M+AL|Ok({Yutv&;+k+xSL-Z z5FoIiONqM5vHmx5)NZF798LEvtWo>gFYQ`j&H5$B?+iXw;tp*%jrCxkOpv!=kyh>*Y zsS!VF3=7}H)d~e&an)NzS%sieoL6wl*d}JPSGmjU1)rxTpSi^W}+0CJ>Aj2;yUv~V)w zevIwT>sDHn7nV5WyqvQ{I{qEPx4hz8vZDYss=J zFVLF;GK={;ZG$SJTo-7l4m4F>u2|x-wD8`-Ebe;BKGHy5L@2*NG%nBMIkhR~R$^MQ&sM2&(SexUiYAf}Uu_#ji z;p~XHbZZfHQL{LeGmNy~zZ9Ily+YL6lruu}m;4i+D^zd~D-4=SW3qNsD8iU&<7wGl zkb@0kDp><6Q^)yEb3;Uww=wmBiP+;q^?r6l(w_=x#HkH)*dqc%bfLn2-xXW$M6%tM{1-c{p?ToETaw9$L?lhj zukRjXzy~$1t@e?Hb}&27prQ@sx1cVqyPLNma@4GE7^5R&mj9}H#zFWb`HS9h`%#uF z5B$+jf7{C1aqv)s7OnNl`DE{=?#1OfB$Y8byJUu-l2(|&-tfDWDBLDkqoOHnx`U|^o zk76RnW!-?=L=tJ5eRjOQ**%d^UEWCyALzZL@|h|+PR4l<3mMl(A%x4(O4< z`dC{tn&(u;VXb{89|Hw670U7dz9AS-XmoMPr!l2MgFvsxxkrK014AIGd&$yUin6_9 z%aXT~D9Ap>aXryxfFMY!7zB_L*dzEvM#-Q9$FSo?^35ot6P2A(?a^Q`YP~>V# zAjV+rHJqI!s>1k6qrbTajNsd+OBhm}Id;BU=Z4@@JMN|pQpB#76=a2R z3yW7WIDbN zXjb&O6(^!ly2{5??-03wu=UO38KtxVE>)e{=?wc3Q8Mb+<^U3H3`(P zY8{Y9QL?hw2<{?y03LLcOnIfBnWJCv1`_Tj!tL{OaCbjbM1-s%n0aF%D~yL*acJ*? zFLG!6#s@mrWXoQoh7C+Ba?njYd&x72xe(aZYtFV5yfc4ERNx_Pn0AZgLu~+)9IfZQ zksT(kK<|g9zxfv#8W)!}4?z=5b&GSB5oF2GvtGw-;GxdWJkt(r~`d z#?I9tjCT#R2Tf;LY1NZnuxda@;ihRCGXqD|gn7FD%qKM;xkwVOg_Bex0{A^@jJ=lY z^*n0fF{KQATF6sr>wwB>EOEGADF+1v{pJd5t=pQ_Xrk^Uf6kjm_vPGcw=SycWaAT8 zG49wuw^(hy2Ue~-aLI-oEl$d09@{us=awqEqvThywFxP#J}Tm9if`=oGgkrKhq@9L?YK+PxN&uKoWT^(Tyx^dbH$XdZ;WM$ zo6>wED1-^Y;9XV_Ui;D8`NNXp)oBs5!p%kVu*+2gBMZ7kEK5|qD2#w;aF8FdCKJ*{ z0vRkRYCgZ4i!&F7pF0Am*Ar>Y9I{MO_FHQvnv}KFB=Xa{a{0Dy-dNHFl~y{EWM?3a zx6_P(J*h@NSTXYLB^n9SDbAdZ8oTW0(K6#p)-JTXa^3FjnRYUS*cw8OQg&`}=f&8D z2U|uqrFR4F;Jjo;FWrCAa0>Dxv1D8;}%7&nOI^@ zc@4{5H++*8CIF@H2$TQ{;fqCWs%IPL(*0xKML;xvQUe%=s&nhOUZ1pnPFG53TvB7q zH^)v{r}jZqItB%z!MVcK(WR$mKjq}24m}2| zZKgC#fmNhptNWmIRfC8oO|+1Ub7K_D)s3rLs9plh0d37Qn&aer^Buo=S>849;Pyf5 zeOXkL42Uty8~U}PPuRIt*`f0wAO4sM$E5f~(bGEN94vZ<_Y40LB`!Ys5N2yyhax#Y z6*PnE+-rO`>(TMp`j@+Y@7nl@D1C#=kr31yp854Unc94$ZauE%8nRgm>g3h0sLD__ z<2*i96)~`h9;=o6(mw7|>mEqT_aQxaK9xt-3uDT&JzRt~@_+Hoo~<=7Ti}P)BluZH zb47!|a7U~gZ#1V%UXm6p|17*poOt7sr$x>v9povxZ%N!#d7XEn4SAc)$@wEiF(606 zZm07>yOtL3JxqtA_NU~Pa&j2b&`NS?+g<|`CC<&UodM~-a!L{#Pv znZo_t9|942o?fq6Ya>Td*9z`XJZV`Kjd>7RrhI%$USkCS%-r22Cm?QXeMN@2u9{_| z>-`O}OHMth8SWqsmCHbOk0^}=f|(W_iKXQ|>Lm-i>ZUZS8J-p6=3;(_wGBoFQ!bPh zY&|jEVZ5(csE-nBX&?eFzw`Op|2t{6fqG+iZn&D|Owm$`aDR`%C(2ZL67`E{F)U@) z#4LzmkgLbCUUa=r)A9#}Jnpi+ugJP%T3Ze7R1u56Ml8tY zKIjC0J&sUw`7`d2ePU*!{R!ek{mL82S-qa&a8A=%m-^$|iaOD=!>@=J#HW^oE1sd< zfbRBkh`5i$+4V-64(Nsd$*%Fq_GsDim)pB5d7+JW4K|z*W-y}}e(oW^x4MhFh=I@g zsQR5_f&4YuPi~gX?~NLZd>_gQ`4N36KKr9^(|l44zPP-;Z9a7GQx}9J>1ZV0ilkT? zYf<>xW)#0D!r1CHsE> DW#+zM literal 0 HcmV?d00001 diff --git a/vulkan/data/gdeflate/compressed_64k_level_0.gdef b/vulkan/data/gdeflate/compressed_64k_level_0.gdef new file mode 100644 index 0000000..0e79d12 --- /dev/null +++ b/vulkan/data/gdeflate/compressed_64k_level_0.gdef @@ -0,0 +1,173 @@ +¡úg*ocirrtueees mtme uotird p dsatoudelmimo pprdioeosr lc moiiarnng gcns iaied tlia idlatuim,nqe tuts a,eu. dt c Iodlpnoass bu+{k m en n usumnonoclcr l.bai ilcP iihlqtaeuuroede titu nrrb anit abec emomnpnodovluraem ls iltediin seie mupa. ot ns Diueiselc“+ m teeurrntimt seumtnmoit rquebumuie . p troAiislnsuicueqisrud eaun mneu tcrs. ne famAe dunfigerpiciia.nst gc Siiiilnntlg 1 mSeaeimnttpd oipartum. re vutVos ul flugaptrcupaitavlatiit dsemai a soeq dcumieiaonsg a nusbat l vaeeontnldiiuiamttm p. ba¡c£c.l t upuEsemt l elesgetoen lstslteoiaslcsqli uittecue.idl tilGunurd saia vncri udaotacrr .cui imnP hptfaheeralreslmteuer›s C elimnasadc srucsesuar r ivsmtiua vssde sormalra oatur tl vitmisrat igamcneoia le.ces os Sntmegiidue e qa.auu igMisuaa euc‘«klo iiletslg ieaassmt.te. at Ms Sa.eil steDt su auipma leduatatc enforiarasmntlea. sr p eVua erclnu eestcn utairutnpsi i s››©ueedr rinvroaia v fceoaurrcrrcisailu ismss aaieugsgri.eit tstN iunisnun cn e cauv l esivlcqo eulrlauiemtsr.pui assVt qi c³{{mlenmastoctedui osbi unvvl ieunvlmie. br +lhr +o aNrm oeamnmua redsiciesead nm ca ruspir hssaauucsssce..ul mlEAsusnasttn e± aielsnsa tteniesieatb. .h d TiNmecialtbuluhrum issss ti i tcnv u earhsmsateucits b hucmaloabumtimmtt oiardssho so menno cuƒ«c«len a tm.qeo u lBiieisnsbq teunineied b uehamg . em nsaSetuiqartusi e sa d meicegautemr s.set usaIstsn mpcealostanttcg ie ›““ap Ntihu sani.ccn .Lhi aadEcb tuic stum arassslesuedess uvpmailedvataetu resfra aa am dletiisecq ltualuacumm ss t teui.ls)“ievAf oteql nuutdate mpmm apivto i rivo nedc rionromua ml foloadarco ci piluo ilsssluaiaegsmri cetmo.tar iupOsrer irnes au.a©ldu.aim cn Pu nustor enuvm sepc sooftrnai subiecudcil tbueeumuts. u nroDi risanal am er nresua ontslc ul.nsi apcDmeii ntcad££Kst iseasemlq piusoqeeru d ai omnnr icedsitii ic eatlumua mcle uornsbao.otn r .Mtv +aie +gslNn.iaa tm B elsatactine adllmiee¡“ tt.tu snFu ialusclrlian lmapic rsodeirutspii esulr.me oeTf geuvemsetpcl oe nr fu irlndile nacvg eiffllaeilcutaig liuei£››Kiqu .use e.uCt ir Usaslmsato grdsii.etc dteA islfs ie nqlieuidqas um ce eo pgnouesrrtenu casvtr eeeslt iiuattre naapemluae“s£3 raslid unipcgprtiieulstslci aiuv nmeug nr aeneenanna.iet maiA nsme. eu lt Ne tictusteriulp slie ussms ta e gcgsnreiaast st  “m.m e itMsn aa ftghatiacitcist l ihiesasn biivismit tamuasatesg .ent aeVp lilelvatuetisrea ramea l dtetiemecmeltpnluotum«›› tlqs iuevqe eu psaiotmnti ebednutitliciuat mmun. mu e.lVr loaValtimu v tveapercalr tiat t ob srlsutacsoneprdle ienvtrdi iit›› +eser nipvtcuieirtseuaqsseu elfa aaumcucauctssios brasu esepd ul o atracunueragrpruaieets. udtUtuil.int scrP iieudclluc£sktoen dt i uedert.l +eat +m oNeerenrtqtaouutrem .nao atrDm ni racairttseu u mlsa e encvnotienuva senc.r o renAause.ien sceC£ {nvDmsiiaetauqamrue ia mstsa uepmschaceauinrrpaeiistst r uantl uetenlrtcli ucucsilo etnmsrga iuumcerie i snse i gnsaeei.tq©seeei.css tuDmisuab isuasslt au.a m ts T amecpomoirpnebosnire. c botNlreeactqniuud reie tula olclriuoeqrbmuso aurdmsto i³“› ndieuitlna ecmam mensenoittnt u..em s UDtntu i ipbs lheua mtct eenorlurallntula.sar eVmp iohltlaeaerceset ttupirsuea r™«³se.s l f Liaqinuub caeeimrub o ue mslei en omibreminn batseruenemdd uspfmuua slunpvceeiiqnnbudaueirs.s setVetui.irv apejK“rcluari ascasiul riansqduuuilsepl.tia smSec igivtene tgha imseceinuttil mana. um ileNpltusa lu tlmfea al aclf iuaalscriI›iAce nmesdorauragmbti i ta ntrtaicemsum paavutlis it lqaieueaca ctmeuu llsmei.ams +le +enuSstrauunpamaid eacin ud br.nia)+itoet r uptprrao.o.t i eSnPnc rtefeilet erinrmuuiemlsn lqtvauuimemv eaflrceer.loa i Asvst eu ilsam pupoegernurcdedii i seƒ›;+ecdlt al ulualesrts cr iuinn ce deqhisuac ectt uishmnoa cdbviaiadltrueainssut ss ue at dr puceliutas it.nae omaDn. o dnsTi{+stae u amcimsodetn t dn viicembosehntn.sit ebuLcumotl reumetmamu t rrti.hip ossNn uacpmmue sldl.loi elbAnoettrr e ouss rqij«£«sa ntmctoeoe tnrl vdadauoilmrcl etiveusetm l .cis otiAn.ttv aTallomelrecitttso u rcst u evrulisrltunuasase sdipiuduti r™K«ssi o serfls a teus lcuuiisltbct.uir spiC icootinr evnasaad lriilepni itssse ucgcsieopnrneg vn qadbuliiilsbsise sena .dut ucej£c#l moudorsort nbtieiidc.t . oi DrnSu tiimetsar sdausumtame . td +v i +enaSlumiil ttlq aual amafmeoa trcn eiucellotiln sasii etmsaea. tl iueNprsus uluaalmdda ia ap f ifaasacrcmicielunsi g sc aiuec rl nsituutuls.rl pavNimies tt vaueeesgh eicescottun c;ult eeem.oma psEduslusaei .msu e.rMn nitAa uc qm eu ttisu sarp gphhiiaetsrnt edietrsgre earvs iitpttah asade ro seleetotdrr mnsiausogli nlmeaa u ms e ufgnseeoputneg..ni daNQitius sasplmer etvitiuninl ucpemius dttnua intabtenh t edeigi.peg stnOuI#kc lrpcabaomitnc .sot +ere +qpmAuepdaruit sp.s i iisVtaci.cit unaNlgeui lseal llauii rtqfn uaauec ttii ldani lesvicioq luumua{£k tdup eunlrrieeuso sl m iosvnrie.btl i P aphlmraeeerotte. it lurMumaac stlcsueoascn .tve uanCslio lmnqi susnea eqmpcu o K›#cuesnimu emmnn eutctnuoucmns .s m evaFquteultuapigtusi t anaetitn seipl mr e evuute.til u.Etm ge Telnetlil ubleshug seei sƒK£ ac siQm luapiitusstri iusvss i mvnvaeuigrnvnrceaa r sreneatid ib aahbcm lc cautrnmeadsmsiap tnop. ru i lDnovi.ria cnmFia s‘ƒKhsieauqmssupe eolutrll..ut srIE innvc ieiamsen tstni eebt qurmulieeust mtuv isolq loudureite cpmnta uutslm el adaac t ra tc£K›n necn siududliaulcdnatat.u mfvE airnmtaoeatnse vcaseoceln mistpteue crrstp ceiqetsulu.ier sr.D i ilsEceqttcu utemmu asKc£+ scrvqrieuacseset .sie blVtuieiltlnu icmuti l drlluhaanomotncr coeaurersptc e ueri s dntd o idnpgo ennslieolscdes aniultmle¡›K..ub + au +UmsVr ineevalte e rnimrufoanel cnea dsci.tcd iu Memca susaarscnsa. u issRn ah mponeinitecsunuls s f naadiluosicl‹K{srtgb unipmi u strfsiuainscmc i inlcdoiounsnn ivtesa n.lai lumAig rsupc erua a eieannscete aentnrto.d r uetUmlot er vm meedolK“Kst d Eanerpuuoilisbls uamds oo adnut el ictvn ro ailpccue etlospld aeiitnon t .det iseQaqmumupi eosu r tm l aoevsrcesctnaiue™samtttauiigsnsn c amit adeauulcrnl itups sl i audicl neta.rrl aiiAtcqe eunvseee.tas ntSr ieipbdshu ualtsruu emrft perliuaesgI›aqo tuma.emr ocCiduodo n ddneuiilimbi ehtvn ittavuotamr m tiumomsarp t.eat rriAdcsdiu ie pptfei.els llcOieirsnnn.tga e rD+{klearon.ort i uSnpmc u efrfleuaerscrm iienlsnoiqtnsuu iemes n flileemelo oi p svrv eaeilelm s poefernrrctidi ni egeplitoel rcƒ£›aqie ussnetuo ianaqd.dua ie Ip faisacsemucneliesinc sgta ucacs to t meuemtrro padnitoes t peueelsgli eltese.ttn + at +mseTa.“cqCtlaoeegnrcivdttauutlmsil. si s sTii itdcn. oc cniEovdgnaueslntelt ci vtsdee ulttiiue trlu ltapu lusoir rquinusdae. rt ie M™ “eedlc ueemnsnot ar usbat ir p cehlutae ironae omtun rr sansi aotc d omaanolmvleeaestls .ltn iieSseqa .ugp eioT tsistunoiecdsK oetbrg iceabitme .ena td S usenmcmi.e s lnlDeu orlsniluesascq c upieehpt ai prtoue drtaiurdosai ppsdieeislmaclpmiee nnrsgtI)+sgrbqeduususetm a ndscii osaenlmgs. ee vscSottelaedust t.uep rgaS etuls sitcpbaoeesmnr mdoeoi gdsieosds e ts faeiasdnu tcf+K“+iruonisdgs aiqallutele sa.u rupSnthea am espcueeo lrnsl deueimsgm eeiftnna ttuduecumgii ebsmru a satv ttis itctsaee.ell c›R+ulnnsld tu nosde ocefn.gae eucEtc u ipimbrsauemgston idasu cmlfe aelvcreuimrlneipinsuatqt uuaamett. e e qPlsuheaiaipssfi ++“{in.ss tusI sonq.d u ahiUlaslecqts ur heina cebseqiasutg eait stisstnoeicd siap.dll +uea +nstPt er uaaat er dsceieutcn ittnau kk›epltmru pomuei lrnmt orfgrierbcuaiegv siib adlmtaai n nhdtieiebntmhd p rcuseuserr.dis tuIp.snu lVriveiaisscntuuaislrb i© ›K baanhm u elnptacr c apuseusesr deuv nseat su gtgtriurabeivu.sil tduEiamgq. eu steUe ldaml laaaigmrqnccuaoue r tspn ieontrn™olaad c iriiohld oi ensvucioiu lssmum otomrpdaba.tit t Pitlrseao mcirpunhus os sn laciaguaoiscrt uetuleiritsns. a n.uEi rn3rK³miel trauad teif eatetcet il dllluiueisso i a edcmlucoeiurmsmbe sinua.ttn u. Em sn Eiisltmai gtali motaebtttoi rsint muiƒc›K bu.sua cstUe tlii endmr oioprsrobqnriuat erat e if.nne +icr +bimEhdet un vnttetuon mrea tnudoagurtui ie cs fo iancnusrtceae‹›“#daemup mian btuvu lesell laiue tlmp.teo rnrAittccut emios td eoiiuron .fmt aaeUcsmrispnlaoai r si midoos rl.nce eisQq tuuK +› imaun lttsi eiqfgtuae auramc m ieevbnteui ssmnt iipnsbuelulq lvusuieumn.s a cmrPio hpreaiblrtiee .mta erdPnaiut prudiumis Kildtni gsvi iomb lpimuebotrerpdnbaiditeu tmtl eademcuspuitus s au lcliactaourcrmiuescleaiitnes. s s.uEi rltFni aatac mK +{tien.ntc .. F peDIuuomlgnpvieeiacrnt da mirnae.ist bs Nhamu alsssleasadpa i ppetounirl ntvfctiaiinudtacuorinr bt pu mrsna©›ksos arud bmiii cd st buunlsmeap qnefudnueids tica.sel s iEeuqt tu u.ael mgtT eruvsiretcpsaeitsssi bqgcuuruliarusvsm iu idsƒ ¡i lnnqec um hienasnocqtn uu.hem a Mbsnaiaittgbtaihist sstt eiea sllp.lil uqaEsutu ae mmalo olfdbeaiosucrtcttiiuiebms us ns+«qp uqunaurumeul. sl e aPli henpai osfmseeaulnseldsru aesd otsfneoaemlucplc oiiprcbr iuentsteu icdsu.icm ne M lviaeu lrliiip‹›«ktensat t amepri oc srutat.ept +mii +petCunous.rr. s PeuFegsele rltrme iendsntoutelsuso mqra u tdem u ouisrl ibtftira iuancc{+K+bladui istpp liieasnucc ieiosrnrmagnot ad.vr ieiQt.nua ieAps ue pglerulloeeei ninitf.nee tsnIeqdnru deqpu uemmal amlvs e› sKtcareictse tqstiu utelro aprmci ausmss as esasgs eeapds l.tia adcMs ea.nrl eaeQqtsuu uaedam.ud ianIs up flsualulmamte rspcy{sn oisPnseo iqresutn.ati timE t gnopeirrss atlrea hssvoe enndlctu u ipse r liededtom ileouonrmrtn ualpmreu ecrf tuaauscrs icqc«c etsonoodtrdietaosol qreuu.ste + . +u nAtVer iccet utan ieana momt n ea smlsipiotuqd suaa almqmeeu stas .men meVp qeeeusltetI+bln uiovltnau. rm ni Niurisshsi ol sn eictstuit sn.a c meiCesdottun nsmpteae qtleutlgaieetsnt t ivennusutlqlepulrueadt muai£“eaat .iem snaP iulpmrau itrnseuu asli lndsa ii.act lt Siuacqmmeuselattem r qvisuoseilqmsuu qtefup reavi tins vgaceigorlinc£›£eannqneeuttqa uutmse o mregabtrui ar mvitaisrld.iea ss Ptuieianlqd luafee en frtsameemesnenqestuc.uet m uA hsuea gtbeu.ite ’rde oullim on pr vhelaamirr.bie +eut +rsrAo.au cnBvtuieonblrce ntucdurournnmpas i easnqt uu nnavuctan rciii dnue tsgce eu³£“sttcuu usrnl puimilsesl t auut rsifn naaacc liiiidldqui.uns atiAm m imeedotl r eabtiliefi leqtlnueudems.tp .ucS sreA admis)  a edcmhiuaipmgci nussilcosaic nidigiip ssse unnpmiaa mtra ot equauurr.eic euEpn getcen.uta r tNsgiuurblsaul vsavi mide t£³ ena . me s gMeveodisr vtbaeaidrs ir qpaiui nisotscre icgcnieog rm s mdaeoiggdaieomtt .t o iadOslir.ion q aTuarueeertn p eqin«›K#bonnhned.ecu c.mA eaDunduteii ap tnivr siiscvseiatdnmi guqa sudt eira.pir iscSstueci diqf nuecgelr iadrssii asbomuir sbn) risbeb u edsano.rdn +cue +umcL eduaoutc i. v oevLdliai vcofai rmntiuiensamg piaqolrurlci auso refvcseeitll i duseal rpl{K Kmo.ec couMtrtaup gsesn ream m ae augncreu itlps.ll. aa I cCdpeu hrroaaarrtbne iatvtrreueasr t adivribicautumla ueosm di n£c««nt rc ei egssue e.tcd u Anrvmuseenultcsi . tv m eEadnstiettgn inaasitn.sit sseVi emuil rnisn toan d ilacbaluhoer rssme uae›«£ ucFi.tad ou Ercds iotebn lueuisclt t pursulieltcdvri iievncsuae lrsip nuetttlieaengtmceeeir nd mtuqiunu mtis siia tnra.t«)gotserrsrcua im e enptgiheemalt sl neueelsgql.euu sesTt. ia ensSgc.oei lsdIltunian cstei sttotuer dlnailannurt seea crmi© s tgentioiit bstih in estmn.eai gumMer ariuu strm iactslue erlvssliuuutassad. ea e Dlunueluimtn ercnni utcvnuiecmel s ms r cKKsmseu itsc i oeacnsmovt ma tmlseolimditpos o. ar +am +eeoAntrce c afitna o cereiuttl.o i rtsL oiodrsrit egommnra i.gds nosNanK)›cteo i mmenma.ios sdsCioao nvussilaetlpqaaiuemea.cnt o Drfmipaaceuutrcru iimabs u alsnta u centutces m.mcp oooAlnrceg «££u airpssph lias srer edhet ogrsneaecs dutp sahr saim rsaseutetstdr i apst.r e ermTthpeioumunspmc u uusqsr u neauagmr e.nes a£s ncroe arqt uucaerou pngvivuisaev l eelmrgiaresuas r tpijaosuss s uatmeuoarg eeunc eeem cnon.are sbqF iuap.emh .eaA sruI ecd££iumvnleettnlertiriutdcm.ue mscU ulvtrteiarlnbiicictite duslur an eotvrr ioeatsera tcei u ni n dnuc onudncro. sn sueEescld )¡£ueudrmsippcgioensr.i. s nEsFegiacemu t cf dienibuuauglmsil aaqpt uu firnasuic ssie llni iinpsm ri.me ateVsitusuilamap mu3¡ atistib.esu lNouuudrmnin coam osucretubd ri es bnublislam an endbgdileitatt n ldnciiuubtnre.csr .uoV +s e + vnVroeeilnssu£«£cpanIamentcq oudsreiep cdeat rluc imraq a unslao.amn c Tuvceseom snpvtsoeiersbc tutcileobutmumuml roum dmoao.r beuIirld.a¡« l anpvpaueimtne aenatn teap teleileuslc etsanuc tsece losuenqrrduniieasm .qeh unaIetbn ui fmtme aelvntiitust s.am eovI r#›sislc elttqeurunsiat stept sriaqoqcuiu enef. .e n lTiViobisrht t adoneori n sceilocd n cgeaoutlne id oqiedumuiee otnc toplu++k“ nnuia ed b cldvuaierngnsdneuiinstsa stemiigamses .tse .anA imMemeon tlis emivs.tet niPaeeemn leanlttue innvscte enunse{‹s›a cstui iteps sr d euimtraiinm ua qm qu cuiquasurm as.hmu e sMnv aduesrlgsepearut it.mta +a.t +s eLsS eaedo di u gdlrnutiiirssK«›£i eamort raesntaua. sr dpeCie ucnlrtdesuicumstsssu tesi.. n s ETihtita n cmca oimhldeaeutbsn itteti saedts u saipec l uapfc+›u e gitEin na mitiam ag scnneuiudlsn.i c sd O ifrnsacu uinpc caid rbastupeusidr b.iau e sPnp eteun llamlttoerinnibttcueeesssq‰utacee i lmlslaiiuestsci. es mn Loavolsobe losaurtctticpieuas mt ns euaelnnsec tm l enavnocetnulu.sim t Vv nieeivlgbe ehrfs‘ £«algvstee.rsl itiRcatiis de eiscuc.oiu nslEgmuuuos ed m miqiu unsbi ispmbqeaeulunelrd.eiu nsmIt nevntsieeqtqruaudeeeu mm+ £sa cseSta uu csmpop lnefagnucudseeicr seams taeu u tdru uilpistls ra ricuhceloertnsarc tiug csroi areavcseii.nd. ea Va EindnsIK£mist n oucartit d nsuaeenuqmtgu uevle io vvbeieogtrreartteai sata relfcmieupqu.uug seiS taeq.tmu paCvemrir av psaae mul«c«enerncrat e.es seaPqdclu aeauc uteng reucaceot n nlsoaaermcqc.uui +sa + tnIv unisl veliemaarp crepuarel. li vlsPie ovnnset«“+‹suncqatiumebe ru ldsdau icmtgu.uns ri Spsseisudsis .mpl eiCenbunderiirsmsou.s s ee E nrtfiiiamsau umcss ie nbdaou tnsf auK«c+tr drra iamnc eientssa i mc m ulilra isctbuueessmr possu iesjtd u. is vmtSipouve serlprdaerionaerd teit.ese tslV elis uviss£+ijianust suthtsiao sc.s . eu EdlUu ltiva sumemlcuopo durs tpelaematr ce ii.vnn etiVleaeig steat rtis bevqudiul tiuuasmle l‘k ›muu cseeoprureeipn.sed mriEo sgdmse oesnr tibfasiasi u tcepiironbarcuttis ad i uimlnnpotter.ere rdmLdi auemcmtou lspsl oei›#›;.uos er M tfiqoe urrbi misaebqlneuitnequd umuea mgmo e dnsnietuoqal uslee.au + e +ffgTaeeicusnigtcliaiiasdst ui.cn otcNn ri£ ›hieu nssnt iu gtltr lraaaivmmsie tdtvia eq chuqoieumc imumsola dagbo nl iaanp nussdluiilmtta aatf.mua ercPtpir ilapsieu.›“aDeuaomsdle ionaprtli uispmqcu.uir anuUmgsr neenalno einnim uf eneencnui d mi t dmup irrc pauiiernsss. eu ensCgt re maseest£ Ksscr iipcncrogeem.stm ioQgudurmoia svao iedidnipaeos a udnami.e c nstOeuudasminp.o e snLmedoodirr sebasmide i dqpuouill›£{Krcn iarse heseod gn mecvitui svqe euseritsrs.ta hDpieiepnclsdtluruememn.rst iteMt sa vqsdeusosealt. oi urbQl uutmliraus;k©h iienavnomedn rr sresiarot id vtaai lmtdeeaostel onncreio qsnmulgae.ug ensA aoue dgueau glecee otsln. as uceAtuqr suce a£³£ rteai dcsp urpfsaue ellasviteis nn utadl rots.nre eimCccpo.eem srmB. ol +fda +eonNu degniciut al ttlci aunn rcifsibaudhcsu iq›c«i ltsclriuii rccnsieuutslsu l.dda iumPni o vrtseteahtmpiipictoeuornlr a ie ldgie epoets u ua mm ni di aisp alram.or icsUn{cs¡ edtI urdmii e satntluuiisnqq.cuu eeBm tlas aterntnidiesiscut.ts u mHsfaa esbeusitgat.i a aenAtntl i iimmqn ou nraaebmnci )ltnieogtir ftaaeotmnr.ed t aL mtadi oi rrciietnseu utmns u sslviilittav eaaprmmoreesattu eacjrduueirs.pst iuoEss.tc I› rdileisemploei nsritchnuio mnnv gcit utevsami eptm uaatsetu. tr pipMrsiio s ir inhmp oassnsuacsmgua is ft.sat +eui +dcsI i deba«ssto ialvtsli itaecamrieeat ttua dlriiiimnqsp uuetesret.dm ipnPeoeltrca.. c ueLAlrellaoiat qm auci aondmr i peasegmere m™›9fucpreuei rniddgniiitcelettlru admn u uumvlt al vramei olumrisabt li.de ustAiuiusang.dcu aieT d epuemengplteul tsea nuait“k+Kssneqsadue e ei ptdeo ltpsiehetnam trpeieeg trenr tuar.l i lpsVahuimasv r eaeirctnr r atah o esrmnutadsosrprsee.arn .idU t“›rq aepUrrrlerol aiam.nma csFgoserrauap gveeiirgad etamt o nhreiebgbniehd s rttseiaernsdic tipp duulurlenuvctsit nuovasrir.³IDlluuillisut isra icmvccoeiursembtssii a btntur elismusipmttu i slqa oumireeae tcmn u unlsluiellsdal. .a r PiRfhshaauocssn+{urbrspoi ersertts iitdsq i upgfeene liuslsgeesinniaetmtce .tsc uqrHsuaa esbe itett.lia innDtctu i iudmsluo lnrtatbrm iicl s{££si edqIr unrfe ae a lsrniocislub l heic gcuceirrttsa uusvds ei plneui ultniv isiabmnlhoai drqs .uiq etuCt ir asasm saev gtisi±+£ tscmisoesant. g +sur +aeiCp soimuneassnu e.rnc iutAsle .lta aurUmrcl ulel agocmeructero msrf upedselo rinv seis ctie atgme e £+ g neniutudn l cvln eaell qoifubtaeo.c r iatNlliiiisbsq.hiu .aCs mriP atovs re atssmtteeiidttb oufcrleo ulmmmima sosm dso{ ““bihniuoc snub csldu ausani edsdni oetala.ton r Ec vgopeenultsr eueacslrt icentuto unsdr ci eeclnltoieurmrme.i m sv.Rqa hu“z+{. sm i eVncte o lvmc imoptomradmeeoot ditoouud mrin pouli lesalc.eat n uOefsdaa incqo iu slameimods r.iib diSn iulqtleu lK £mois rd v aeea rhuioignscu uefil enamr amciueuprnrsitsusuum ms a. au t.gMu uarOeupr ricnisies q mauuacels tsagrauri cact³+Kcna uc emipl dhenuaiunsfnteec ln dldauu.lis i Dqufoutale.uot cr.Ei gbsFeueessdut gasviscia evtfle reriirrnnia gs aiqinlupt+›+ unumlemelq.tau umeHsc a olbdraiipotceratrenu.etm t P maosotrur tsbtapie e mnntpodroniir ss pstcueiol qmviumineont daesorre!ssed +uciRmtsi ussqseuu siep stoiq.tnu e ePnh rteneinot dninr.uue mlrE ligvateim sv gteararcasr v atid odisraaut msor pruie.tnS a murn lcirlubha homc.ncu corPurslspua ester es eatdu iidpgsienmcliotlsdues mniqstmute.i s svqI eunvsetit evierebldruiurltm«ipeVqoteus seuct eoiernblesui eltlcu otmure letrlmuha romi ncpacosduruispmp e ierdss octdli ionpgrgen liselsilestini ttma.e ™«rleeapetsutu t rtas itulnesic pbioeeddnruidonoi t si.usd te Q fueiainnusitc meir.rbi dusNusuem sq n uciseose nldls. ae vocF“£“+ireanitcgs uiqnlluuilelsa l eaupl rhefnaiaasfc eeiilnldldi.u.s s iA A mfcmeacotuur cmbaisilba iuntqs eu smasipmctu e sila dkKdmaviaroau lmreu iltmsepa maepetchn eatanrucaem st t riiuannl.tct eirFgdiaeucurnic teie sbnv uiimsmti a pneeue.glq evuAtiecqIpsoll slauueclenetrtrreeai stcmq eouvsree b seiitr diol bsenu oili bunuhm.r +ntl +aoeC.rco ttnMouvarsat ltimlidais us ar plƒ+K qgsauie etmrttpu ietlsrre ucoemtrg uceqsitu. .i a sA Iqlsnuic eqeh ulenaenomrdn ir.use lqrNtuiaretsi ccpgeeurtsrau uvrssi !“iivsdeesislac i ultple luoeas uc iiemnsrutmaseot gd me dariuu.nir siAp.sue glSvuluieest npaiteenen tsdueqilrustdesru eimm  «lpn tlesracaic gcepierrtsaet ttig isrou armavc liivid uqanlu upadlumilt caamt.tau elmE e lssfeauuipasfidceeaenn d bu nitdeby+Knq adunsueu m nm.nca u eSliceldeda n .car usiTr sospuruhstsa o.rur el Attacrrt ai t.cau iurSecpostil osltr ir eciugisrettnsu £# isr nsep arlt iaemtcma epsdrosoaralt o iuridl n tm eraeuigg cneniasie tsseal gs me niteu .rnq acuAt im mseii tm.h p eeeMnsr#£#«iicte.t t oi Qrnsu eiaedsug.qge uusSeete adnms oa cnuer rratiasest l olairuumnsgpa ueroerer.d c iaiPer ltcaa uccs eedard« )er iuodbi uesvirmo.ool duSe tannppiiaimste i ns s epeedodg r eftctaar u.amc siiB blopuarrsnno daitirnute r splaeiirdsbc .«c™I .edp +s u +tclNiovienib.snh ea Ecrmut aieeustlrmueiormsd e pnclutuarurcumsis un isiun attm eaafgttaet uriqc suie ibnmsuio kc“ imcms i unbisoua nscs .ueq lduJi ausvms u telloupa .uce tugVaseot tles u umtosapdpgaientona d duifitsea.srm em E eutfntiat ««³ etirnetie sneptaueit lqisluscee en tltseeeelrsnliqeusucsqet u uiehsn.a. b mAiUedtltialupnasitm s cvcmouiorlnrppgbeu irte c£#›i.sag scnEeuit ss u selligtamero sirctceraeeassts . q ntuUoiirnnsn c acii udpirusdanu btmvi otlsluouurbst oppgreartntaid vKcK£d rtaipe diaa s ra dclciuiuc qrtausuceum.tss tSri.ein ds P uhrtsaeu ctrf ipehuiuamsgb iiltateitacn stcisuinesd. u pqnTlu« ›m at qmeiu mdasp meul msep oeeu ltril nneta no vtreietttso aqrpeu h ecat orunnerestpceri qasnu..aa mtFT .eea umlSgpieiuqda«¡£ ieiintsncr. ia fd Teumernalmtsle sunpastr uammmeaa ssupesronaist su.u e larPt ehrd aiiurcareimnte arsm a an meepicch e aqn“« Kstte .gss eeeVsddot laeuusnlt.ilp maaE mtsuc ttoc ropspmleemamroc devmorio avrstebe ridir nate .ige +neg +cseVitsedatlusas™K siae merr aibctslo uanisngm dupsieeet rd ed vuivo eulctluo ptnsupsetaedatq t.uee au Vtioi sdvamiecoor d rf.uae t lQ viueiss£)dtseo esnpmteh icanb.ruu ellEtlugramea. s. st UeaOldsrl naasamrerccdeou r tapnereomcrnpu u aoso d dliuiaoroc.n u ausS t i±£ iufabnemecnen dtdi udmnm ii c seuilsrn ts.s u uusMsl octmlireepitsicuttisi e easa d laiiicpnq itufseaecgmuie gnreig.la etsJ‘ssmaeuo dsld lilsiaeismct .t a ualLsmia.eqc tuiL.ana +mio + arNu eitqes utipi osspr iotvtrte tilaat m oeelrrto o rlscee umodysn iceNsoca m mcma oocand tvoo a dlloieldocii tsotu estam eepulnorlernua asno . rd scuMeiiod sr d baacidpo iinqpbvuiuaisslscaIsnomugn m ssdsiaiotnad. ma s lEideltosi n taen mceae qttau .dei i mUpsptioe sdrecadtiliineeagstm. udsAtuir itce utaa icm +st vo Sinnuvdiseisprmlere nanpd tuitursemusl selv uiisstne.a d em I ondsli alsvpiieis ne lennan ucapnutecsil slss eeeandd t+«ssu q rfuopeeriu csghi ia tabaiticn t ciaainnud tcua.tnn ottQr eu i iadmsu eqgatuulueeis q.nmu oaeEnutl r etirmesiel.snl ut£š«£m su daeci ugvirninaittbsaeiserti dumtur om sr votvidoetarlal ieect so n.neu dunSiicims tems noeatddmu emivt.ne lmApiaue›;ccltinerbdnihitc teit.see qslTu.lre ui Essmu ta misloqsoluabee os prtsltieaiencs ee ncreutalnutecs m deneunotitn su n mbeu lts «£sude mure iotf asemcanaipillimeie.ssn ui Maseod graleb.eti o P mtrvirae ielpss.rte +oin +iqtUnu l eets lreseidemc neelensic£ upOasidt bi euonts a mmnuo elrattbturi si l.cqe eucOsitd suii sonc outimreamnmcoapud.olo ri S soeo dnrniecuocin.t c ud.Es‘¡euettrti pisniu esmat luevisguq eluespattum at msama.tal eleE eslssueauaipadfidaeea nn fd ba nimdebeocesn n esdacauc gm pi.“£qCcFgoiaemdurmuc oniedtbno ui nsmqu unpnicues lq pvuiuiemln.pva eirArn udaegirlue eetsm aeempngaiteseutsnm a a eirttnci.tu)©driei tncl itoamurm meee mtuv adjtrouuinsruetpscoi . sd d uSoeiingstee csaa.ttm a eAsctd o ipndprsiieecstctcituiuemnmt g › #eiisnpn eitiasenncgt ieepnrghg ea qrrbu eiiftbsere uanag.dui ucaNmtti o sersls.c t es Aluutesl rctiiirnspi qictutiee el aslv© rtatiucuus ds ti eunmtr o ptrniebesmit p ueoesgrn e iesimttd. a mseTa.url + ie +nssDituisiaalqdm ua ne su fonsalceml.nei escAIkseclit ua cscvo.uon llgJiuuustes p teanouti sencigoo ennvt.si etmIqaanuegta netsar u dmsfuacemuir rpmciieostnn tsntueuemcc¡secistinmud oruad nn lttqi eube iegmsree ottv uiinsvdu e ldrfliraacaumt c uninmibo.bun hs.C ucnFrriesasuuslgs i ptaeuitulI³i thns aemtrdao lrmvetaesotlurtia itdis ad d nifaugalnnmicieq ssuss eeiatdmc .. l teVEucitrtt puanisees t.pnu rusNon ii+s› enan c ipufblsaha c teinesliatis sldpi ie ccleotltnueidmnaistmmte e sdnvqiteugusenmt.i.i s bEsHugialembut im dt niaruashlm{caqan uoteir.sse t.eL tavT ceeiulldsil tudv.soe nlRie idcfs auiucsnli ttlveriirisvdcieuesrms r vavto eilalnudictitipp dai«£› cte i senstrgcio ebsalu teli runiim ns c qlutuereecsl tulvusuas.sr imViuainsutt.rae iegPs el sraue clmfetperreuairgtc i eq³›«ki.iss nc M ilamnetagcts tisbusais b atenlenuimdlqpuluomaar m.ea +stf +t aS vuuuocsllictubirtupipsica titp e uasdrd iuiiaspnI£kealiguaqercuriue sstq .uis ineCs do a naltvuiuacqrltuploaiirmss estalei imnct.cr. ia UdsVlu itnsvrteei mrciprideae r sa a Kubuscesutr aoosdr ia jt nu nesauqtmnuoece t l vvadeioiltrc aetreeui tmst .ues smiI ptncu tosaem.mgm eeoNtrda omcm uavlrli›+³›e rurit rntra ii otsmrouanrsea creqeegun eiaqtssu advamoac lrcvoiuirumv ssem aroqnrru.aba imFo .arn ucoIcinni. b anuPri{{hsce uedmes ar vuesir avisgesoir ltrcltauii rcsisi putossuru dcmmii an.nt utaLnilocsir .qea umlNa iumdql oululealot tr pr bK›Kcbaliecunnut dspmu aemvtt.i u vdsIei aravcrmuua ll upivtusi t tvanaetuenen e.ccn + oa +sntLegieduso e a tvueeegullu.l e uf Vsr{Icnandg.tii eplEsillqsaiuc teie nsspgtcu eleulvlleiilrntaia msrpcq eouplreelp leemlnraet uneertsgieqessut qe pu neehul.all b+ J‹tuumaespnt et nr nudmeliocler atbum il.m l ataMsrmasicuasor tritipsiqe nurcce oi.smd imuVtoni dttao am neequ tuna iclrs ii p›K«+l p vuevirrinn taafar ee nu segtaciup arittpei innns.ci ibmFdhaeu.srn smtQae u.npa trmNua emeiq sdupe eonl stegu ores areivksK£dao asss uiimetnar eeafc meemernotmar esbpn iotp ruhltmaet roiee.ttt o.rAr a T peucegrolepnltive.san ltPelehgisaesqrs ueƒ+£«rruaannt actc iomasnol vliaaeqllsuilteqiituse a bmpai otbfs.eau nueVdcriuievmb e.umr sorL raopb buiior prulstseui omsi nsk™m laaclstoas mmaem .ron adoMtona tpenteliilisslti e..mn otTEleilesnesqcmtuieiedne ut anuadtm i ipefaigacsecuctili linni;«›{irurspl. et lrrSe iaoecg giiveetetstl i nmsfui rl nilqinausg ilifs la rlchhaieo lnneidcssruties .r u imlMtala tasdtmsoicalsyyr dchn ioenencisc.s u +ims + i Ep uroqrarunttia as i nmlhepoeqernurededmr i evemritoiv ltesl reidrdsoa .l e ojuUruil sstmtmra{K;+nnu aael stae .cgs ueeOstdr nseeaesnrdtie .m v siMuuvatseu prrserienasmd. i avsM isidve ie iarspmres adum maan elifcisa‹K«Kctmei euban umttseuu tmrv pinlituesalo el e avga eelflsia tqcoauirselc tiip.s r ipeA.otc ricPtuurammo. si aanEen nn fiesema“q{ snip t hi iandnr u ecintu.urr lasMl ueamst a upgtsonu sarau pleaiircsqe u pmaslamoas lcselealir ecatiitift.neu cndEidird n«ks‰ umlTe le valeimluv.u.e s rH Irerdanu dtvsrreueulsrmipi tett n eudgltirl sautsvsoei r dptpaeoo lrtrl euepntnrtrteiuet msin ««‹ƒuul isePs neqitlumelepse eqnnrutodeeni s eeqttlue ielnt lu euleuslg aeto tirm ncagcilri.ead +svu +uinMadtida a tt coepurmemtcsy+rr f mnaaeiulnbcithiqu bumiua.psm s Outndmuui rlocpl oiaens us f eiafqnceu.iua lgtOii.rsa citEi n cpidrrmaae pstsi iebfuduk™« ggpuueeletrt drlmiiaiecc teup ssrm .oai isnUns l aits aretcidiuc nlelcisiis bd deunurnuiotn csen anuspineimcde. n pa Iu+kc+v lliielnnsaa t.rni ieAsb.eah np Deimuaeainnu raseicetscd u lcmaiusdgraiusnplu iasss. ic mtiEa nstagttm iedastin atmnm{«dvotoul.nlu eptTcupi tanaatcdt iiemdp auioensdctcie ionen agguse t tt v reoninlusiultmtli paqbamult ea n.nbo dlnSia etnnd di±K›“ie o tnreiutsulitmls a slmmie atcet.tgt ueiCstso nqfasuelealiqmiqu suai atdem .g.n e iAtHsm alenb tuiv ntercali s slspuoe›puualsl a ivtesies tatna uedpn iecccl otlsnueegmndust etea. su vqgAeuueseent eielablanuic ltupu.shm a Ivrrnieh vtoiernara“)minraf egesrnnaiadgt i aqtgcutr aiapmsvl .iaa dcdSaeie rpmraiputset.crr i uNnrmigi s sqivuu isiqt suaiqienus e ph erenlonoK#s uitfn eetclr rlmtaueossnr..tt +uoE +mrlV iiiattal acideuqu luijiasusm s ttenrouui .lse ltgEaieu qt fu taemic anisgcloniil#›csiuueclmril dtaduu.omd l iIovnnra t rnesiiriubdtshu. m ss Niiputton scaau mmeceerotten smcleaooqtmrutmeaiomtsd .oii pnR›£C«oet n. Ec mguEaeslut ir atide sons leecoadorn m vmmvuooeldrlpob u ietq launitiotesn smiacimre pclseueir rtdri iisaesqmtu+s™‹ uceqaosumnqi dusqie um viehasnarqtbiuuiuemts a ivnqditu t.ada mieA.a r mscQ auuvp ieicsleu nrvq saupuraesiml u.les eu Ani¡›Kmnc oaiLdrde ucqmntuatuit ssti idnvs ui.alv lleLiaraq rcuaauet st n visrobeilhdsu utctspru aarftspe iudpsgiu ialtamvit ss©toru rucvtstei unsise n nm vaamettanitsesisn saat teatilleslim uqplsuoe arcim tn nu fesmac eu.mtc +aui +gsbAn.uma se L tfop r«cKsneilgqs iulrle hl poasun orcuduurassnl aeim snap .tou trtPit rsteo itirtinhoa ormsn acrsguhiisott n tucairumsnse a.tn. i r›+ +gmmoe.ors letIemans s tm niosieleb ldhai .ssm eaEaduul riirisqismus oaucdmsu . rn psiEruslesiet mimpeuaonmtrt ttuqiamus a+uc e omnfmaiamsmcos idaulo ti e.son idiAsimm o es nteae dect n eoedldauliniuo. s n mNucoonrrncab sibm laaqatduntiidipsisi¡™cui is ln eogptb uioerarnumtis im ds.ii ngsM ncamietasltsseisirsami . sa dqlNiuiuaeqlm ul faaqem ur fimfaseac nuietclnuiiim›ks ra Beevlt eaitlnuuidmrti p tlil esatc outmrruaepssei stsqa u icasdume r ddsi.oud ns Ie ldcie .noi nNhitianesc ri.vd iuv¢kK tmuea dlemil anuse suca.sec cn Piaolpsrai cctsie e rtdpae htlea lnsvuieesmls .ltm uiaEsbut ur elisgusoem ls altl iaedcscii t££«›s ue teemu tarn upesriqiisuts.e. . uA +Ilu +atcNcrtauiomlcr ie lssai ubaegetrur oeoes r mjaiautnus rtpcioeus lr llsaaeuuon;“££e susi eqmt upiseeno rcdadiadidlieueptnsi t.sd cuaIiirdn.c g ua I lcdnio oqmdnumo eonstdeo ocdr aieulslleuitsstr infacee+‹«Kgaroit na cetioc nm i manaod ndiatopne.it semSc eeimtdneu gtsa u dtsdir ipidcisitstcucitmiqu numage.t drFtiieeasummugp s{# nmmue tcana letficeeq uudugautimi a ptsnh.eua mnrP.cee tlBmrllaaeat nntstdiieistst q eaumnmeaie smtns. ea ac Vl euinnlqKƒ«+ani mtmq.e u sciVqrseua sesrt .iie sblOuuidslti u osmu e ledrlu haivomsuncmlcoopurdusp t elaerats cetdi inopgidenaili olsa.›£TRcsii tnslocuo isbed ogunrenutttli lsmda.aum gi Sn eeaugm te f tieo nrrftmneeealgnrietesru mlev egiicetattacu eusn l.ujiq«›+ gqeeeugutee. s amtAlaacigs qn tuasue.ert dp S inesside b dehe g lrepeisrmstaeuaenssst. eu +inm +nt Nt tuetelgrmleiparsu tsfK ›c eaieqslnu iiassmtei d li eodftb eioplaroimtrs it dsaei ggsnencitieb.slh se Mirvamiet sntdqeiiunsaea m.tr ihqCsouo nincc›“« s tn f sueserrccnmetaele netntrueuirqms u qaeiud aeivc piuiivlnsei crsdir inaecg.ut .ueE mlgE.ier ttaA tmpm eeavtlge lnlceK{stshuee msni.qep ucsQetuu umahs ma.c b oqiEnutusia esnfqqteuu uaemgt oi irandbti i sd plitr arevmite silvtu eimplq r uneqeituK ‹mudo eiretcpl teerurmim es vnuaetstlu imftt ee pumsugpeliodvar it un claiolrnma mmeaoctndoitorae.pm e.mUr el Atlmluaoismr;ie q sautteaianmnse c.aii nddE uupln hettao ur oreirptnnir asavr ieemt gaamegeasn statsa.uas +r +pepLigreseec tttm iuaeussk™£airt spts eieurtdl o lmreao lmrlecbemoioer nptatei urndm ci.via edmVlu einssttot lisolberiudncl aiuurtmleu l.dma iamPntco {“£‹euc meudp rioeagrtbn iiietsdgus eries mutg..ar saVB veiqilbud eiarns id.asu rumLcs au uo ctrao ecmte mrttoi odsnrotot inov‘KKvqeseuluraesrmr a im usemlqtatuueresci ecpaneulasris uq.ssu a aSgsmoie ltmeltpliieecsrii ftoeeurgndcediit n .m a ia C.lsu “›*imhstpat ociar bm hueoaltrbu cimfit a arceshiusol.eni csVpuiilssva etemresaratga .n d atiI ecdelt tlusiumeassmm tp i etnvr)©rmcsi sqaguulrsiia sqviquinued etah enbnnoiednbqr.eue nerVd iiuctvmo e ngrevrrnaaailv mlii idpfsasa. uc rmiOu ldtniirusosKa uieasmnd eimuapatniu. sr sciVeisedn s gata. id dbiViupialitmusa mcem i amnseogucr sebdcniiia apsbmi l tsad enotddne ieletcs‘c etuatorturs s ua asuau clgrtiuioqesru u amsuma r.uan rtaTi esunl lulatnuurcsgi ucioeedr s cn.cie u qTrauosceru .tsa +o u +k›juarisuusprscei inssnd igict su.vsr iesQt uuaisien.s peEersllotiei tina f nuesttnae dg a iilqtniut qainumsia .bma h dI pid«ƒ©clmuovcnniocsnr eapccreot rnee stlmeueaqrmlu eeapnstutu.rua umdTs.ao ruEptttro orfli ainpug oculsiliubabeu ersure lo pl a s“ otsu tini dunc ltoflenaagsumeec.rqi ubAfaudetsiu. pg niiCisaosctnli s nsetgcci etnalecteti rudiiruns n qlttui eebel eglv+« «rc titniuoiesrb hame .oum +r a +bauPiure.gil uslEe eu cn uututrel.sst uqrIsuin ec m eeahssta ttbv iiiasttn aatmneeot l aiems›{r mhbueailsr t etratricric aset tsuci roqtpnuiivensa c lsieledginuesens cttpt aouasssr u.cme uarI eednc. oe dnnVo.ain steF a ƒ+k amose lucelselicneciaiipsfti eutsnd editd ne.m l ialC luuiisrnq s umunaasumu l.rml ieaVst o uplasou stdaupileaairtmqe u o ›#›iseroani sfvptaieictlqialuleeei.n s tsiCeesosn nqemducaietum urehsina stbe uitsmt i antvne ittat umamseeo.t r sbNmaiuap lK£cauli ronfnrgaa c seiiilldtii tsva iomu letmut ot arpclbaoiitnq .sut eaeLcmmot.pre uetIsmum rpii eaparcsdduuiilmpei itsds yƒ£rarto.i i spnOuh dsafi reoser etmedreu aniv tsusumlimopt du l taelamoate cetvi. en aliVl auio lqrapuctuai tm qa putioiedrs ©#siebaacecm n sdtmauuagmrei pctaietrsnic.asu s .T.a e lElVitluq ulumspaa umlpt eeamsltaulelae ednssatau epafsidaqeamun ee bs K)Kuueu sgst e ivtane ccllci oudprmuhesnamatr.n e ttPtoroorarrt ttovtoreir lt a opltroiu sqrluupaeaicrmsue. s n aVulcanu rccu¡£c icmcqt ouepnetusture ruqb suia.abd teiN npisdibeushmmc p iieenprngs.i u memI.l p +ics +touA nmmus etent qu aunclacoit nq asun+ K+sgtfle.e s lvtOiearslsn abpdriruebei et aniirdudcum um o lrduenutcai tr tuevrs ii avsqratucmiauuqm su o eida.dir .ocE usª¡› eidlct ot premuetalmusv rsii.anp .asM ruoS.mle emTdspeotellirloe ur fs ne suuiingdtci aiantnmo tennet ir bbdclhuoa mnns #+³›e aelvtcii ttvae ectlr uarfroae r laevideisitt.p a iieDsd oc.cli oonSnrgeg .dus eiAa tmue eguatu m ecer otiln sascuceosuqn «›s“uteilistlst a ismmbe audetl.gtu eimCts u mrfaaseltulitsiqi suss a iemutg.l e latSam emendctu o nlrdcepi cecltrtou ubsvmo e ³c›#i tatsit.en dciE inlrd eiuamsnneuttns et i updmmr e eatttlueiismuq pmudu eisqtc u tearugmime.s.s u +tTs +au Ssrfe pedsiu esgpI«clemavcotitd.nu asiNr.ni spAplrue oglpiuluneer nugitsrne atsiveqniru ddemau o mmlh alevsinessdla ri netpur lnieactuc ies›“+;d ql bueiiisdbsu e asnadeduamuc pmtfe oarerm s ertesi l suiaultcst. r tiiEunctr.i p eniAsesd t iiuepnsgit eseescgttie anrms sa ercAnci tibce uosdsnqa dupiieinm.b e uonDsrto nunuamelr ctev r iaiqtccua eaeosm d .sii aonEp .uit ieeDsnmum piopo derf l ai{«sK scip ubeu hllc ltucerrrnisatcuseis se pqseuu uleliv asimcmnauoassdrs asqm euapditl stat icuvseri rpvnaieutsrn .rcd a.uA “s³Jis.it. ta A eDmd ueucitio snuc gtotu nreosi resenctuati reqcetuo uenlr se secaoqtdluuilaspit ic ssiaictctiu ndfagiem nlee £cs+inerbesehc tassucuis.st p eVeatinm tdenaitees.t s upeMsu o rsreuebtsdi mfntaairlusiecissi tubliauaqdscua ue os fr sansk +cdaoe.mrt +cb +oifLr.aep cceNitrulu lisvls eaivlmsei stnmt oaisngbe nudnal i uusemlit l imaeaamsmtct to tirsespim etpur ol arkks onrNru utndlicils ga vnmmei alset sgtrieiimtss ucfasoel nlicviqoasuml amlemoig.dse o tM.a a enlAnuecens acutn ao ldreoatty tuinorporiintst o prntu uelanlvtcli. un csaVo.ron .lgL uueTteoep manvptieu slsci o oinvrmsicpetieqa ruepda oitsre uttmsa q£uresli ulcpmaeu srdm uoasslla oegsrsie utmsatpidietasr .apo merPelcotlis e ucnaeot rnesessc eqelculoteere.ret imuUs rlqi «ƒ “d e imtepo gireesbgscieti santtsgia .nst c eVipledulluruinustts .rso uerOtdnrr acuurimle l ptamhemaalcssloseuralsp l eeup;›+klaecltt et mnipatsote rtsvtiqutsuli epte uonetriua m.tl eauV ctaeu rnstii.eum +ls +l nNusuesilc tl e adla uemaimel etinn qut«s«m m le souaab tgoa.iru ttgUtiurisens a.mu atdEt ugtlieiestsc tcfauoelsnli viqaasurl aclemuig. se b tAic uboncenutnvnoda“«cKlbsrihchs io snntigcet ul vslai umtmseaa teti tdcpi orsimo nmirtonhed orosnd acungumuis lt vltueairl.sni atAn..di isANplmK)Ktmvt pi eevosredtdri iropea lt fa oacsrceecirdila itess uaiiigsnsi mtmeotagdiue srsn itiesasu si s .vie otrQl.auu tatA mpl Kqptmuoiparuumtms a s.qqe uumEaa gmmee. ts p tAetaulosclr tetsonoertrd e nscseqoequndues e er nqiveusicaut tsan eaip mdrt )+ “limuiselqtnvuitiaqunmuma.e r p Droeiistasuimuea srmd e on.nne oecQnc u faqaemudu aigempil.iae +stm +c eSiininnttg u fmate m“ƒ+st t auaprreocpnruiet.sat niLi tinvob.ere l rC.eoo g nOeegrtnuc ieidm o mnlsauoeulrdrl iamfs oa prurebchliiol bnenucnosut™+Kst.dqa ueSce er cdado sinb gglonuarienns daseiriutem claeoirnnbciseumer. qo su Viavottol luaautmctpe patfat.et l cViso›+kmsepoarudpdtoiua emtsn ee v dfae arneuiigcumeis.sb tusPasios tr e tetaag m emelsototl raemessam.tt itmMeioa.sls lsIvianus¡cqa delCi iugtqrnouairabstmiso tiruum tr c sopvonoiddrtaitalmteeei sntn touuurntm c. l lesMaoeac dsia sn vaide ailv aiiqmttu K+squ uspvateetoll l sleeeanrmotopresees reqd tuov enis evidceti r.aar +mca + . Dv nooAanlcmeu ctul ptiea bttce orocnodos imS{k o i dttboe i labslmeeuendstd ueinmgni.e s shlAta tacs s ua hsueacggbiueipesti tateas gssae.edt .i V paiDirvisceacurmi r nd›;K#co tlAluotamr c tuvmesaam rgpvinoeuarss t ecidgobuemuitmls ou edmaso tt s. ue lldHol eraanemrdmccr oueir.rpp iseVturu m ls ƒ£up btanoatert qtemui aesoe dcvmieiaontt aatuseit..s eCFanrelialimsiq subs aleemamg npefdetair ut nc auivunboccult suol “{ƒcuoearrmlu ispdq.uou rleUuotrsr.n ansM oeopndro brevitni tivtimeit.rno rcrNai u drniuhcpno stneu cgmaue ustng uudlneooc “I£ne ntse eqlnruiidetbu hmmd ausvsiiesstla i tatprm lieeastuct ieicsrqomaumotemd. o sdiAoondl. il ppiMeicalsillcteeiusnndu;K +dnaiaald si f qpapuomhareamtsr a es atencrmi a bt ehuct.ro +pnt +ivoMsara ltleloegirses us.cat odaNnases cebm qianubeaaecmtn!«urlum ec vstaitortircae ue u .arv niMiataa aucneruu ilnesicl s ec imuadert.ns. tu AusTmm oe mrtcat utolrtruai cbsati tutm s{  v eneu cnrpuenlsnaa a tetpesioatsr tdpltieeiclcttltoueurmns.st temI sanvqg eunhseaat. ci f bErhulialenbuigimfit elarnlshd›{qdevsociun taesadcaea g piunrtluettntircisi u cvmaie lelvis.uq lulNpaeeumoct. a iftMneeutu segs giameapartiu erminian sl )3Kesssrtuimia eqdlnuaate.cu umsOs er pnnsoeaescrdute eu vrssie uv eseutprr ernnnaaed .tit useMsslo elre ubtssi e. md ta Vrlni+K³{edioritrroata ea f oaplrcrociorilie inmss aismgsaoi.glt iltQtiiutssai msae luani diqvisuoplali.mus tcNupiitans.tgi G³ƒ“#ailevnuni sida.mac Pniouenrlq cvufiiee n rpavmhroea lnseuteltulepmlma uetesn t ta eucsgm oe tlsiiltnniatccseii gdtteuuernc¡‹ un viupislut lrabauel s.aa ntiSd niiv ttom .loa ulmStleepitmas pt.pe. ur Mr Sauqigsutn i agsa r mealegveteic tdtn auie sssa£› euulcm ot brefietubmuse rcni.edp + us +imuNd me a cvtd e oflvleiaoutrrg i iuusatsit t tv noeairlmst elopt rh p.acr roeAentrtK“ a du lirvaopec ilues su t ituvsiremnpsocitdisi d blunuanulctnui cmni. id sa.Ue. ld Nl Leaaacmrc ccudousur ipns eoenrndu n{£s avgmro a lbteuitltbiepesman etden untamiuc mm e tsuiittnn .tcu eilFgdtaeururnic tcie.ibn euiAssmd iipnpnueitlqsevucgieieq“; nssqituusiaisqdsiua me a fussacuemtsneopesrec..nt duDQisius casetmetu mvin unenl.top unuMs to careotbtnei s medtacirltK++«tia usber.it +t a +an Vneeittrt uaamsteo. r nsbLaaiimp g ituaerltnia s lptueeilclqltluaueemsn c tsoueerrsnpnqeeaucr et d umC› ‹luteeaulstrlu peaiindnstat e emspraqrdsuouseima n h vtalaibirnibicteuiarsdno ut sn nitmut on.drc ub Ciicu orutnstrsu.ies s¢sivdiqautulmtel.i i sssP e lpncaueotrcneutvasua slds liieicttst uantmmeesetlttul suqv.suo ilDisuudqti upsiea n tcts oeac“;{«nllesp teup qtrpuaeuattrteiu..us m QI guplriseasucv mtia uducsaco tnqqosuureai qmseu .lai itdNt .o n nsiS esipdltu lvvav+kK›noiaaltcrlti iilncsiei sqtoiuursedc iivln.oa loaAurlcteicpequatumt as smaeu nssu tpll.eta +nrc +diuDicsose nssvee ec.sl a a:3 es ossId.ani oDie idgta eemnsm etpqqaouusrae m eo arrnlacuitilq luidaama mppp eiovrbredutsistte iitutb loustrler udimm s)cuit isedsi umsuio tsdv .opu lhtAua ctrdcpeiuatamtrms.a.a nEsT nielitlam.lc uudVssii ativmade e lv i uenflttap eculrited {«+msi mrvt ieicslnouicnstiv davlulianlvotier srea reraatce. un i.eAd a Tnpdo eorelnttleo ecrtn otudrelitstgoqrnruii ecsa ›£›“ibastim .uda simS aeeamtdr cipcunor rafatsert lcioiutrs on crabu rireebsg eueanstrd. cu dumRo .ild souEurigs e mvsuoitl³ £+rni.iis +cmi +i Neteusosl rtltt aros irips tota sitauq meuaereute c ntfsuoaolrcll ilauli ricansilaiti.suq duNmieoantng nas c«isriq bcutieau smrb plmuiailsn.t d riiVintic teecasuue r smstaiueg.smi ptVruteisiss stuq.isu b aFuamalt uu pcmuei llbmtl{“+snsuateadecmast. qe futSaeuem rnen eseac cdta iucnps ai tmseu ctrai plnniigesq t ueuealsgmi e tess tteu amtms. a. al CleAoism‹«+£teaf dejuiuutpgs iitpsaohct ai drnsoegcnt eeralcate resiininsit qm tu aeedml ielvatuam.sr ivViuuinslvt peemurgotreraarbI.iml lAnnumoesenc.t adEprunociiru mt n truniinetscqou ursme a eqtvgutoeiiltssu . td epoMnalaitosm rs a aucm t oe trntiK+scnaciusudlslulaina st.u lavPttihr taiearcreeia tetsrs ea pm meppileh.lra e rMnqeotutleiressasq tulmieeae cs atsadua is ipi K›s r clciiaumno pgrae ecrce.dot im Pemnltooa dncso ee.crd ua Irteda u biivinsot mlueourgdt e pgsnartitaas vsili adepcarou ar ££Kae. . f +aQe + urMiimaaseuc nruetilnusiim sm.c ualMrtoas btueotsrri atsmti a setp ntesiilcmsle elumnetotr leitessesqqltuul++«+sm. vedMeloosenltmeeiecsbn tutmiluaeums m sa sacma agsftiaettpuitigsiei snau tlvf liasatuemacdcei o.blr uepLsceo trreu.£›aMtemorl rielbcmaieec snub tslmu aimsn udtpsieuptmle pvncuidusnir.ass rsuD esie. at rmiSi aasvmgue islnt otaqnitu s aq umui #ƒ uiacltnov dnivisnoteal cruat tleepitlaqueturm a emmpna.ute rucAumers.nc auuUs tt b vifeobanleuiuncmtdi pubbamult sa a nbt#cqvubaaneorcrri.oeu esSet an vpiieimdle nsdp eohednag erefceta t uurmclaiit brvpuiersclo e itstnu u rtrspipeinidscs .i l dKcª+nttst i.eom sr.Dtc u iAip c ln uauotclr elcoraira ntppa.ehr laeFls ueelsnlectlceeut ssuuq stue egsp eildstait cgaaensmri ›£ƒeenilruoldl uileseau.t . + f +paUErctuoi ildsniic saefimle ercqrmruieaasnsmqt uufnemeu .rlf mleAealln iitpsquo umria tmmot!KKtbeAoumlrlpi uoqmmrua. as nmsFe aace u licfediei bufnugeesinq adupt eu m rniaui lssii lnqi unpna rummel atlvsiaesu sampt .o£™ueapessur. se s. Ge srmLoapolvebliroid rcaati uitncsuet dqofiurene u ngaceiloqainutqve ua valvimliv itausaml euta sr t icea“k£C aucacciu i.ghb uauIebsn i tetieganges etsor.er nmVpaailrlvaeeet srequrauaa ad dmati ecvnltiuluvnumecssr trvi.aen l Fo ““icstsuiium usspm ao cnrqo.tum aamI moml dpovoeru relvdmpii uvemtetoar ltrsleaei dsdm .iae geuRnciiiesssnmusaosisd m p anrsK+««s rnpoaiedbsniisdotii umsur st se vo sidietanmal. ee n sDun.ulu ilnN acui. nd sc Ee oldnre onmvnaee rnlbetil utaam nr ddccii«;£; elsmtp a upsathslaaaitr qeeeu tneoritdam i .noe +i t +bu Ehtug lepetsrnrtaiiaemcss.e e sinE ntgnt.eee tqgS ueemerda uoevrr«KsKabiireumers. o a sBeniinutben eacann md ceueotmun ismnseaemqtqoutudaie ts e elivgenuemtlseeptnruatdtsuua mmtc. eo v nLaeg“s«eQep ursqimuusemi n setcqnuouimnem.s eelFqgoeuebuasogttri atansiti s sd plisr acevmete lilieu.nrm i Tasnorqircubtueho. r1KIantst.u. s rC Eioursnrausntsea c pvtdeieulvtileuserr nr ctaaoe nsaevqdrauialeptl i iasnsdca iimcpn oigans tvca aitlln elgK©csl o aamv umeuconrtdenoonar a. et nliCeisoqt nu lveaea tclv tliiuitmssap eema.ra dgcEinrgeaaet st.f rslLieounmrcgpetiemc“ dtsto uldtroui rina scds iieudpdlui tnsvrtcii ivcineidgre rsaea ll liiiaqtpcu suepustem .l.s l eCePdonl ntatsecuesercqrptuK++£ unshs ua.vmb i iPtftraaaeeunt ctiti uubmmruo psrli besvic i tmttuaarssei s sqaatu.lia iqmNqu uueine dcts elmnneieeo cc i Kƒ«+lnvulianamrcm i.cfu oasArc mpiveeletril s csipoishmt am groaredmatoevr tian.d u +avl + elBnlaie bqtfeuuanercd.piu ilmAsi t sqK+ sumn lauipelnucltteaeanmgta eesvr e mphqihiu acisrusiel ttaa.r u aicT ptucsorourpnm iv.esa l lUielltgit esrss ietpcdaoi ss³©£etoirirsespt eimurqol urlmebao imrr cbiloiser uopts ei urnnr cenvicaed lufmineottul gesoiseratdnti a euri.len l..Ma amTA““«celuu.it srrS uiiemstg u eqsatu m.iqe sutIqi nusr e ih vsenaunorsdni r unetsure lilqltlua uamgsm r. ea qgvUueititd s aeqf t+“K+atcem ic dltsuiuiisst i a eacmtmco eurntmbe sitna uintss e lsme iptptu u smra aumilseae.tcs uuInlamuidplsael. ra fd Saifem s+ smMu aeaittcdt. i tlsBue lrovap uniildsnpi utevt giaaettlsaeite qa eustna uimirm np etintesuig laemlmraa .s e sarQalau.it‰vceQeonulniiismste cbrstliceasetnuludseri r.tsi + es +vdqVo uulveluu ptliuppntau attdt aiemtc aetoe udcomied onin aoous.nt. 1rai lusAecicci tbltuuaisscn ucnosiur dlnsulaenardt e a vvtsii uvtvseaopreler unastd epitmaseptsle elrd u issqae umdii. ns sq’ueaEnersctct u ni sodnin ot dn bo alnsmaeoencdtd a iulftlea tscmr iainlsceiseqsasui eset nisminoamcdg.ian dlaLue anseot.tI3aan mucd c otislebeomudrps o.isr di.N t is Sseaelmmd pe petlur ir cburoesinr ssoiue nsce tnmieiontml.u l rsiI espad sd nui«kƒ›itessamecs di n nduegulg ilee asli.tid at Ds oi draeunmgia esrvs eott larausirt scpftuari tiqo nudcgeioi.oml mlEuoagtd e op›Aae.esr +rea + ltFel aguvmeseet ls fi aatalu cics qictubeueulrtsep..ri isIAs nlqe iugnqeeiu ssaitlmna sned itiisicniatt muesi;esirlol.edl raaNil eseucqsr u ndeuau t ie p ueon.tru itnNatcomi n tm soasirtot td riaahslmo eenestcn .uin smeF qrduuiotenl 9{£eFgrleeilrtsum seni nunetn lucaem lm sieicqnaeutclauuemmlr iissssea qmgeu.iue t Ptnvhioiasnvr eevdrtiirrtaaaam e.mv. ae)ªc‹ urUtimtuse r nppetoinursimt m tn diulutnoiocb r of eralgtueeicotsi balsu ocsdre ieliamenm r diososrolqnloualreri. ec f.i*¡«utvudpamiam ntun sits.bee +hmd + p Otocrerrcl.ail s uB eslou ar mnnlodaolirbeteos rtlatiiriebcs eu nr euodln uecvim o enlvnoK£sk ptvbo alrlla elnocidrtsicu tist. e dulEarlrpnuoiassb . ud dsuVo iunuslel pctcu rotainaccvt eaeosl d.lei iuoNs a stmcce oe sc+ereermn iedlsnioqtsruuseemem flfieeaplousi cusvim eb.ilu m.sEp geQieruntdat imeee rstldt au pcmlru oospri oenssm uu fseiƒ“ƒ£spaeuamnmtua ssds. oe aldRco icrcsu rumsassis at cn oo armlmnmaeaoctrdu.eos .Lav iriEbcvseuetr r odrp ualvi ao mclvaeuier³ tetg uaiiieans t mu eoligdtne.r s iftRceaiirsdem iseec nrultaleutuom s. i pmmRopuisessur uedmsria eeun treu icrss ne fadve.I«Ntseuo glrmel itau rqeanuslaiti s.qn uuhEenegtcne dteir ndegi.rrm ia Mtvta iosddrsoatal o ocruru l matm tras igoacncuiai+IKssge .esn ttaM atagsolr qeaqusvueuii adspda ea in cpapustemuil.mbl .ueT snrM tiaeesetstc qiemuqnaeuag esne ileusitl t td er+;Kkce +nit +ue Snsrcc ie mslfiuea srue icgnsieuqbtluu lesma amvau a rerpigieseul tslp ehfmnaeotrlreeibstsiqr uaeee.gn eisAtmis¡“. hu valPibuovimset.ura ersGrasre.ea vaVpicild vaauet trec rauca mo d ntissecoeltcqluiuumiassst t i nsnvae etmhsopatqeciu+3 reupirlenipngsuaiqttluailetba eu e.spl heFeaiatsfm.eee lnsEld gu aesdcs o tfntaaeusucr c peipigbrseue sstet igasuescms e tc³ ³sot l asuaretmcdpeu at tt ve mimoatpdsauisesoa .euf lraMencamaile.len istSsuuaiamgsd i actm utabriuiasrbb ieiesntu du surKk©vlu ilmtta ia anef c aaincrduicunlunci.t s siSoe erdndn u avlurellelal imamt ma.vcs eosChraoip mceemurgol edamto o. ir npbV›KK£t aeameqeonu reesba aincp..oi neMEvnona rilpbmlei il fslqa eucanii tslce irscsaqoisums em s ogehdrmaoapb veioirtdd aiaano uqƒterrorcerdi i qnepuetoaq rmupt erav.o.i i +vSn +ec Drefurleiaer rmfoiearsnucqtciuui embs uaflsgee iloiti ntsv i eosilr m ne{ « lNoviiioqbnluh ua ntmtip obamrhtat..lo erMSs aauiepadcid eeaann la bisniq ebuaceec ntcsd uaulmgmesi catatntru icslsu a .pc‘«csite t v epeegelgen etafs tatgicarbisaul vsidi sudeiiats. cmvPuaoemgll nulsiteospnc.ati teiS sseeq dsun teae tuveoielqsK«k«oas dmqe ugnueeit ts.m i am Vsipes olapri rttpoa li eanluc oiesrsreemadmot. d m dIoiunlni l stip.ese l lSlalaulepsini qtei+ss›t..re rgRMaeua rttj rtufuisemstu ogqr iuhnaioetsnc qc suuucesle tlnureorirnnci aest sqen uledelqu uuivse a srovairipucviK++‹nulc.iir ssaD isivs ai smvge ermirapnrve aira.d r +aac + uuBnc ietcbqoueurrne.sd uucMsmoa nseevsunaaiil smlim idofs da n caeK‰sudiseiat tcia.ubl luiJilqusuus mate.mou Ivenmegopsenett ri ddbmiiuaaelgmtun maps hemfadoes rreebmluieli nusbtsmlu oamvd)nurnitias.c i ef Vsepe rosemrtretionabst u ullimoun rm ie camluc erumcslotuilussls i tesmuu ar aupnlrioiisnqs..u auMVmlai¡;³ etu retmra aa se dectimeec.nlt aluUsumt.ss teTi.nen im Mmpha oaebrccl eaohnnraadcbsiii t ts daevasdops lieeub ntupipslma ¡«›l g tmefraraiu ucrmceiaisslb euivssniu taeiadtaea c muunollulitnesrcs i.tnc iuiMenea cssa scsla ee fdose. au ipgMniiutea+s£c a.ps ieaDsdloc.ili qonMurgae .tts t iFiptuso s racvtmeute litipt duoc trova netlsleaei ccteut nseui ttmlu urtnc outarludt›K{sr e.Aog + de +lisLaotec aoues su d iduvsuiemisso tdiui dtbl uaodlcriuinamnam ir saeqe udaaa trma.c r uncV uueol ldlniiaotoqq¡ loFsaraem udclc oailrcbepuucesstr u.les ut Nc vutmeluoslslta ei asbactulciliueuqm musa eacmtn a ftptetoouirrgstti toauirc£¡piiaoetns duavie otril.eau ctNaupiclas.itl s C mnuaaurtens ccuee srnm aaimts a. it vptEosinlusium mt m pfobaalltuea csnbi#cku ensana ta v tpiliotesrac tetlt.uei sctC toouurnrs sn reamhc aotdgneunctiauus sr.f rdaLio unlecgortiraul.tsl aQnv uaeuas“kK m uepoeler ercpmdiuei.rne uttSsu a mpgs riepotmuitplniev srif .neo arrIrmcn ei en mttaeiu tamsum cs le nelvooeun rl.vip esub‹£Kaeacttmie t puuertduo i ivnsne c nnefeilenberahrmt ieissnsiqt tuut emea .lmf +lee +utlVs io cslio unmit.mmp opaSdetoor l ddlnKK«leublltuaeps ma fetean tcta iucmlm ai tgsiininni.tcs ei Fgddaeuiurnsc t ie pbnvauiirsmtt aupnerue.ilq evuPnieetn n avamrotoaKsctveseic sn m aeonrnla iesmmsca tetdittieuia rsmn urnvniuucdnl icpnc uoustnlea udtbs.el. a JunCutdrs.iat tsoT empdlauolss«›saa.e.m d E Ullrtiei bmsceeuornsnot s upejmrqu eusttateitomu pmslu easqmo upreaeegmree tsvv tuisalvispet ur straeaamdt e e£›s i nVms upefleneprerudcmtiteaeunttste u pemert uo e intsne c.tse uolMsleo lrreiibtcsi.iq tutGuerrd iaifsvneti lidaiqacsu )K{{rr octAritcn i apttrhooearr.s t eloVlerolo lu vusait tpedaagietea smpst ueasrdsou lsctl reifalcasliu utcosuir.dbn iuaPnsrs)› qutaulirelsc a usmm a adgetuigtitei ttsvi isfav elaplimuiqursusu a.sem g Dsefiitact ut.ncu +uim +nbsRcuti s sl.quo usbSi oes“# ss b. al edaCginrepdasiistst ac asild niipgbpr eiebrstiocib iuevnmnog.dl uueNmtni piseamlst t es suuue sldtct uircrpirpicK£K«em is ta fitian nucitcineid gbuaeunnrstt. e vi Eidmut e aatnelui issaq.llu ieAnqtduu inerpctii .ssm uciTsi u nirfgppe siua›;£ƒ euiillsnlt errtnihetcoleinlsecuqsusu s el i aanmcetaunessegs aeasnr e pdvfl.eea lucC geoeirnlaagittut. e d sIumcniae sul‘+Krn.qia usrVeq.e u lleI a noom rraaceulieri tiqp.suo arEpmtse atls lenvemoen nltf ierptsiu qnleugvgeiie lnsplatuaral svun £+#›u imimn utviseud gl.mep aruMu tormaniattslee e svss iuantapaadiseaec .neu + tl +nutDerroc in rcesiicade gispic rtuletletiuois©™a idles iu oq sruvinaotaml r uaemtm apealatret cs muuoa adsodisdaoai. .o f OaEurcgtcie.ils itAssatais gs ai dutmugtaiuiu e“Kqe ougSsseuu tseu prtaee rn fcdlauiou srcdseiiembc .utf suaI mudp c uviclabovruniissnu easicr nt dteeuetliruesdrm u eampnt ut“«mf m afoiuerncrbtimiebe guntestir un amce. in pdiRoumisn.sut ue Msroo errn.nbe aicUr leefl neamiumamgcs iosnarautp n eecirgq)st.e mseNecgeneeqtlsuuetemra isons riqpnsuuaierr. ue fs Me aelvetiinusves ea irnvmr upaele upraiudcsticmaeuottmde s paeerc«{£iuivnsuo slfu uermtrnopmarae.btn i tF lueeamunc.giu imsAa. t le Iarsaoaccrteue lleneitars mi n suoaqrntun eacl uevircada“siesptt ouuerrsg eigesdrtt a aevmsuia. dl naeDi sisaualram cd nuasu. on flcSal emimneciesi.c t +tau +ucdRs ii tnseu utrts pe Kkƒsr lleElitgeqienuustamtem as qsqnu uuatelme l leavlu.uu lstTp ieurnmtucpatiutrdseuu mnud trit ngetanlo ilresuttsso i rpmp h) #rocsen tesercaga ge pitprt hetnatiurisneu.ctm r Vsavec unemlelapnesuarsttiaais.tsq e uE uelsr eanvipaifi veecennurd rr nsa+«‘mavnasauu mlrtuliisasn .caf itaUd.clu ilnNlatiim bsclhioo rbsnpoiuertlrt l iaadsmmi e.gft ne Diucusgoisim iamamtoc dccvouKissaliarunnecg tisaulirsltc a uv a eumdnreuentina a nvtpuiiolvsrla tamlt.uei sctS toeaurdrs c rcumhr.aoa gnsAnc mauoe srtf ‘#›otmaliorobdcru u.ln uibMmsia.ibs esEpnarod aruittmd a i anmltepo qervureaedmr i.iae ultUsi t qs vueleadelm c etpvuuheisa›‘ ernutiicrumias.b. u sLsNio utren etcam m mcedootoln nesmeseactqt iutmeaia tssa sciva nu ftlseepaurupgdtiiuaeamtnt e v fs+ ++dnr . uv esaTt ri iinlnuci sigm duadulsunasit.as nAtauletnim cqpc uooparnum.sl evfAciartnuceacutri u bdrsui asclp toipur«k+smors nied sdoou ndssei.eco d E melraueisimssseuamns ot sdupa mrpl eiatteceinimu.npm iu Sasqe udaea tgma e rqsvcutuuial ssp©£tiudaui.tms e T ncrdioiibnsghvtn aiiilqsplussieius mm e. ct +co +oneEnvgusae elsfqlteuiauassgt i.tqa eutUli rlspnu rasie p#K›udvpmiee crrstrduuaism ep.mte a nEumdgraieisstsss aeni untun.ilc nt Ccrsoiicmdcemuelonsedt ro gi nrsquaqunvuicies d paviuIkc{vd oiiqnnou a aqrmmu o asremabl pieli maeqecnunu itsesu t ms.c u opsFmupamlecovnididlonii assorsid esie. ot s.iCe aodVmn e scs+ cmr t saepuetusnur eruva sina t.dsa iieApt li cisaoqcmnuiegantumg e l ueumllcatiturturi sicu.set s Ar arhslcoaiungq ciucut«›£kimansocc du oosvr ecvvliie vlrae i rfssraucacse i lmlceaioresmicimsesoqn.dua oesM avpaliucevrcseuuursmar.sda aa Cn mo nac«+c nsesdunaumagm si f taaatrucicccsuiu bmavuslisait nqav ueila tameac leume sama.lel eniSstqauuupameid.tea n Mn bieni cebi +ƒ«›l uelrl aivimsincuntosaer rrps deenurdem q svuciueotl n plsauaemtoceartttee eetr tuio rsds uiulsosi..pb + ee +NnrQodouni i siƒ›#K durfulbanaiut c utinlibulnunacscmi. cd pouIurnmlptpve eirarn.uda girFue retsi animpgnaiitselesnlra ad e uttumi t.nl cimM;{{reglbteii.rq utAfardemiiu spgetiilisaeqctiui fense gcns edeal nteme ricii tnsiu qnstu eenel.utl l uMlnseae t tiupunsost s) ««emp r ruener itnsbiaohu l mnli uiplncseciuc tmtiu uddcs io.cnn u.sTr eosFqrueutsuao gtrmi eanattitu s spla.r u evcAtettilo ‘«clac t.isr +nei +idcSa ee vsdai tvma eirqr curtuiae s mn iporpuniss su oumids mi.npo ue Lnreocdur.iie esmDtm o odlndoou lrllo “›+iltttir tida sumptieei tlqu lutcee.on. nt FseTeesuucqrgtupieeiat stuh ramn baiaisbdtshiaa pn sittes idcmn iocpnriugbdl iuvqK£nuaiassfr.ee lnpEldrgu.oes is Ontfr aangsuar craeievgb ieuqdssuat a asmhsc e evnflidrevrireenirrgsriiqatlu leola re eccpliC+™s iiaicsgni i totmurtedcitiisun. s e.aEu ln.Iii nqmU u tnae umuvl elutnalue trnprpaoiitscsiue sese r gtesee aslsgtloiaultsc£pi .rno e dEteiuiuo u ummal ieta nrebeiniacebneae snns .dev udiFm ta aaundecei iqpabuiuuescs.ct iotCnruog rm epmduioi sdaayk«“gpgduenaeril seuesstgi emult te d cnietuatulmisl a aqma u rfiscasiuc t.ie lnaEiimssmeti.t ueNnlteiliqsaaulmme c podsuK{“cuao smrn.cbo oinLr eptoceidtrniu cosvi edevluueinisttst misooberdudn l aluuramlec l.ima +nam +itcSatoe irdasp t ea.urr l cOk«“neuraucar tvevoi ordql auua.atu mpgE ausvteti vomaedanriutrorea i fsioa nrca ciunilgi iubssehai gsnmi.eat qutAuriceis s ;cmeeuamirlefseneustnsuud am md.maa it C tbuiiirnsbs eunmnsuod llumlemeas t taupirsoec s.uau leAvirliqeitu.qaa uemUa lmeelac mmtuc imods.ri. pg UenLtrio srdeseigimaem mt d doqniluuaoalmrml aqsn ueufidlas lc vaiei lnvpiieosmrri rt lateo itbitiopo“›“ nesmi abmpshaus.ura ru Aisies dn.i e nnaM enamq tauvtseeis.lsa Ieatnlle iimetqps uotsar cm ae nnlfeteaceru icfisienqbu©«;ƒiucuarimtu .spt heOvalrislnveuaelsrrl erup asem. la elsSgesoenalst lteeiasgcsqei uttte ue edlegiluenu.s s ta Sacris ut ot ““ mmeae.u t +.e + gcEMeonitmi mmqeo usdsitoes d ln houferlaneludmacr. ie fbrRauihcstoi nltdciuousrlsipo irens su mtlia lngpq+sliielstres.ini stmRqe.hus oeqDn uicmeaua msue rlsaiiiesttn epuaaelmnlle latvem encnltoi ersespllqe iurste u dsspiccugielƒc³ irdancumaumer .t d puCjeiuul rslvsteiuonvs ta demsosuinqsteu ceaa .rme cenCutir mafd.sei lcOoitrrsucn miab rissebia etgsIst e tF.vie eslAn ileesinu qa dutvoaionmsle ucplt uepercatutt su o sods diimiotao g panfemaale cltfie rlnliitunsecgistisqul©›csa tg t iuesarmetnpd ao s.rve +.ud + l LIplenueottc eatagtu eesdr i mvaqiemu s istssiio tbla ulualicmuctemiot tr.mu adeFtiletK«K+stee.u l reiI.ltp i sNtauu tmle lgidaemo tplm.eoa rrlAd edissieiupttai dsdaacum iiepn tega l cclccoeounnmmstmseeoacsdntqo.« Mmtaa eleemictpqeiuunasaam ms u ernvrnuoaallt lu eatvt pe falpatihc taib.rll eiaEtsngridea is.ctt r aTaasosl r istfqeoeudrrietsinu.btr uupLsmio..sr eQDtmuui aindmsco invudeilucvtn ertmri arcisaids e aosa r lscliaiaqp cuisueeastng isrfteiatdsui©› ciceo eunvs si vetmoqailue ua tttsep umamsptacu.uis rp Siiiistmt .p n eauRrmnidecsit ue cstvo onanlgtuuu lteulp laant.tir ™K³šo arlivcuniit d pmanae uttdl uildscai t avupmume l lupfltuue tsnvacteteene se.uqn tuaU etlp itldsrai icgtceneerilsasl tsug i“{ks. +a. + QUnDuluoitnlsrco i rlcv eiescelits tu r slia esmnoueu stli lnccatoo emnagmsteoe rdcv otom elavtuliutevrpse auratard! K+ptatirdusaimc p idifnisugacs mice nelsg ii uttbt i uabptmel.ena tdcS ueenmrmi.a s tnlG u rolsarluvcasii cd.pia hp Eaidgrtie£› ucniteunprn.aac tt N susvcneeecdsl .tes irePbidhus alqbruulemeat nrlvdaeii cvtmte aurlgsrin abam e amrauaocru irvpsiol c «ltsetu nrseti nucmimeam.su .rlV ioiPsbvl oeaurrcltretiarrs ai atcsc eccvseue lmseestrraioinbss u qiliunune m. n filQeseurlKk©n gmisi setaimtr icsisucn etavleliegitreqairues a qvmeui letme aameeleu en jstuuuulsamttd.roa i. Ac bdeNiisebp.cei nsEsdc «KKnnusg.l letSagremeidcss ottlraiepsqce utrpeu r sver etivliseiuustmst. i anbEeeunnclie umafm ne e umupga hittaaturtire sptI“{anit s moumadsogi.rno ba Ii en au tciai slnpmicloqiadudc auelmnra tacs tiea.nmu i gSafue redai tnia gnrqitculeuilr sadn u“«k£ otnvrace e lc viopetnrl.so +eir +qniNu saasumtas .g a iclQtoiutmqaimumsoa .dma o dM.sia eplMmiea sslecuetias ndutgaao drvnaK«™f laapemmhr eaissrse eqmatu cref a rt viucinrovgpneiivrlsarl laael gimuesats u.tpr aoiPsssr u emeitarniee uc.ame l nSifacqu+«›Kcv meeua rlsirtsdara i.vsc eueAlssmip eteet nr udottise s ltsiloenur. st c oLucrerr csaptusrus es at tdimuiuarpmupi risvisc›Inucggstn uaees nt.fi rmmLi ounelcgueti sulttslui arev p euianrscen. na fa.Set auiApgsrii cealunte cvfstiaeutudsac eilm + ++ldpte.eim lqeMlunaeetun urtsmiee ssnc qeupucreetal ublhsiea.tnb utiAretl saivqnqiutute ea mtepo ursnlbauvigni icntt artsrii™›« saii usdpci ui.clb ovuPnisesn leaolcrret.nne attTreuoesrr q tsupoueurs r pduveisina tdmuai tesv sofpelau uurstcuepisdab t3sqcg foisamlemmlneoaesd c.opt huJsasues sdeet ltoel gunleseas.tot uraMseso e retebt gi se mistattrl aieasssm tuefiatrqd iuac+©srou snsEu nsqii unmsat imeet ru ld aautmcmueu rtspp oidsssiuu cseetprgueeemn s dltsioaisrstse empa rmfieeapttusi.cuu immsq¡ + e +edfSu ae vmdsue elsvmp e.ual tciLa tatt ceudi.rin pgiNinaesi t.sau stsPi hmqea utrsi eosmtd ararlalie essdsuui saau dm› qsgmbi ltbna iinabbdmehien ttdt. ue nmlBi.lls ualEsn u ds miulotsol cbeciosuprtritistieu s sa n deurilnipecsim usenscno itna«¡« l culeulag t evrmtiia tclnaeeuessn ucema lidle aomt.bee onmNrtputuulimsls a.cim um Brpeiaegbbreeidtnti duefurtem l vniai›“££a u.ep +.ht + aiIDrndoec nticerducaur .nse tunT siet mlom lreduttisoua rsmp eaavllluliileqqpnuuutaatemmas tqneeuul eleu li+ 3evtdni.odv ePemrelirli alti e nona rttnce uisil qmlsupaaee.g r iadItdintie iptosi r sdnecuauiir n evga o cqlccuuouatmmmpms { kna i gmtsno ialet eg eseattsmiiteaeatm s. a t dSeiuimaitpc ouiarldm.i e sotC r uanfrtaas rcueeisr.l a imtPsa.oit rstVt iet›cKKtsvto eurilr m pmpoiaerssrc sdieai g epeitosd rt ptanraseo qiniunone nt f eaepglrueimlrqev unieatngmuae.mrt . Fl aeeAlloci‰suteaeeertstc q unui iednb ohadn.do. in IpeTaicics nucucliliintdsgru inaccttoe mslem orotbadiotonr .ctp +iie +dslLu lanfeote“©+gr.tir aaaMst a alsvleeiisdvqu auatmedeutams p efuagastem teua srus ngiaautc e e attemu gerpetpht ia.tsr e eVletilgrvuea››sI tlaN esuassnm eceu ttpf. la eauSutce eidsab e uvmdse i licaint ttup emedgslietlgr en.vni etsHsesatsiciqm bu huesal obusdim £arltthau.omm nc Fcosauracspgi eilertis.tst ii Es pn ceivrlmial tseua nteft eetersetmql eullneuet soue mled iluoteid msiue os«yenliusuo es fq eeueuual gtefi.mea eutNng utipnuarcmte . tm piaCrutremtat isins ui fmbee hnrn imiimebp nhsut utuim mp t sceouc#kƒ r rceLiotesniousu semi q ncuqtoauemtagm meon rdiv osum llav.pli uevStseeaurdtar edas a ed mdina guernnciicess nusvasies ml.s)Tleoeerrlrm liecusnosqtn uudiemin .m f +eme +nelAttimuusems t i lvmmaupaclesiprsnudaiti aaev ttiqe tu paieresuo itvsnoec rl3£ens ri eosvrslia. tt na Pieius.mri pu Eesssr ctdve iilpeveltera ricsrseeaqrd ua aetec uceiiuunsm msueoalgdnte rsniitincas)›K« n sptb o loreartgnnaeda.tir teIn dula lirflbcaaeuumr.c o in Mbovaunogs ln nuanit ispasiacl t e ptsslitean.dcc eiScrdera# £c uLuvseme c.set tluViesabm ruepilnruutosmui mnql uesnacaimtgb uihqst u.tni iisEssqn luiv emic toiuandted idtemieteal.nm¡ vmuee.eml Amiqlanuigtaqnemuag e eetsrl i entvmi iebatnhmat eeupt mr j apupeususrtleuovns it.en gatUerrtt i esemttuaii g‹›s£ai r siif nsem tramimtaqetsunisetsa u ematt le iimeaqpgcuoeuarslm.ti +asf +s.aB uiqNcbuuieinbnscud suil mpop sbuuuortmru ›£›cupresuddpti eaebnttlde ai pnserdsuoie it sn uc llefitlebrereirmrcieoesn sqtv uuogemlr uafltveepiloadi tasv . es ileVm.dup +›res antnsdie.uec m .E n uauI tnna c uv dganiuroceint u uusbmt l vanlenoeldnc.i t tcuT osemn lasalserusccsatu e metbonuilir+kaaadi.cam u Ssane redlcq auuno eira secvie.o t ll Euanltcoepunmas et cn sutaerucdam. b viiSitnovutlerelr girgecarri.a t veuJs# icecnuqo suma amcvto i dovaorec cr qirfu aeip lshvi aisist.mea pleSel iructdso i naeegmtgue.eet s Mtemaauats ut.cri oisLns ›ceisrlq ilusteee ntdgt relvaseuvqcliutpdeuua st i ardptu retno.rii ubnRmh.i sqtAuuotsir stqiqounuri e sh i endrno idnasr «+£«eesul lgavurlisait vqaoiuerda.cam i Q imuanaic.ls. e SsvMaueapaluid reaein rs bo nisaeb ucedg nousdneaue gmcni etaaqtrcKoa.edm uieIiotns mtneoeugdmle plsnoatir as fsioa rcepciroilar.itt +s a +ii.A m cmpAcoe urrcmbdosiina edntti e msmseipentudt™©Kmtod ar vnbaitidt iamqpeoui rissbscai ip cnitogerm nimd soiptdaeiomlq luodeedon intsoeee csna.qee ucnNetei uashsnla. b srk*CoviSnicecvedues sr n rmimaisa itjt tuelismastpc ouur sshn oeisncmec pduue slrv tdiurivrieenctrae r snan.u e ltqUleulalet.l‘©+snua ttmiu nmdu ithsa aampcg o iqrhtutatatbimiis.tt oavLrsio strleaee emop lemaato t ldelliaeia.osm Edasluloeiilmsql©KKcdsuiu ltniputnud ttiveanigt.tee ar Ne me qiqsu ueisemsi p tvea orual cmuqtetuotpir.as t.eN leaUiqcltu t etrs iievncdici t+³ seaan ml t igeaqrmluapiavuqmisu d anaqmu u.lha lemEan u.dp retSelierlndiec tnip tduleulesnvcqtitu nuetas or nr aetp.cor roEI££ agqmseua tels eeamsdlau igatqndeuaame ptsfu iasntm i eubasrhm n eaaptc r eaptteuu.srr eupInsint.st etPegrugeilersvs ti+Ks“aounr ee v cmol alaetucnttuiipsmsa tvdn.iiu vanIemcar crvsuauel ldivp siub ttlnaaauetnn.edc i Jutsut es ldtpi ohba aeudr;{+‹tutareuta s i.rsd ii Cstnou insabv mhave littlv.oie +rsr +t rMoaaare t natiedidais np a ipleseitclq ilutneeogntr t taelotser IKnnes.t . et FgoMaeraurtuc orieribn suic smoa nupndgueiulqmevue iennn teavuqromu l eeul ltagepcrmaiaetnvn.iit aduV amiq tui Ks“ ctefi.te. r InmTdueu lnrfltpaauiummsc. i embPtauo sssss uoanel irltseiil cn uictrtiinudnaduc ininntde ucadn cutt i io en«;›ie cdmA u mfnfeetrtu i gpncirguaairtels sluneasin stusl ti s tpem rmoaeprmtebeiritu. m td Aiiflncuictsqiucudmeau. mn i tNds)qviecebm lheni notptn ru.uam te S sneteidonb rthrt iottsrreu.ils +sl +tuuEislgq teumrteoi lcameilaseigtsqni uaete. rt ni Euscs£sidgaq iguqtieutt aitnmsiu slan ldieaisu pl ai.vls oicQlqiuuunategmpt a vvteii ntvoiaedmeri. ro pa Er flooaeircincif iles i ›››iccmse lfvmeaearuhuicirsiciqbusuul esas . iv itaNp.rus iluIulmnsa t aemf.goa ercPrbio ilsf iueeseunirgi eimn a uutnlr ulns 3 er nu aegp.cir aoNttiii.nsn lcFg ierpduarugveniittadi taup mrnh aiefebnushdse rcnseeter diis tdep mulvpleeevclriti nut ›qudteti snitsunoentr.cet .roV dreNu nempeq rnuceaeott niilsusaem oc urtvreeinetvatue rrcs ruularsi spbsueeusnrs dopei egsi+›#c loefa ga veupetcol.ir btfIutrdsii tndnogoirins lelmlc.aa s uUseltast trdi iiduca lemnls ea qqmtuuciaeonm.rc +pin +eduLru+qte.e t na Varpeschl.ua .rrI eimEtspgrueeasrs dtpciahoesamt rm seonetdudrol a lt vaemi mavmpseausrlsare asum uramansadasea puusemi l..rl ueVOtnorrtlcueuimst qpptuaheetal sleeeulslsitl.t u vsHee aglebeigittet sagetnrgataes vs mittodaeraslb li#«ita erlnsieeqssqutuueiae qd nuavee ic ft.saa emeVne eestlc eitamtucp s.ua sleS iteqq muunpaeeemttr u pssaea ulgeclittet ont“£Ksuui slti.vud ir In cdago rrnd asieveaticmidt aaevm te.aul rr Lc qaupuo.uar rmeNu eosetn l uendtmoi enafn matc uuupcmrhi aaƒ››e ntlutollurutm sr i isdvca eigaseiltstii.tqb iuuEseln tuiv mmil teluacotetr uetesmet l.psl reuNodsii bnreh il nsetiumob+“C; nnpni iisnsssi libn mhuc nosmcnua dsueiprgmeieenstnd..ti + us +NmsPu.ehl alViraune l tpperousartt ta vttaeienlt t odetri u K“kka eismmssoe arnu bttiiu.d m b Anls eaaaqngrudiceitu tt a iclcsuiu rqrvsusiuautsmsa .evv ieTetsetatl eill buecusool nuedgc««ke ru.qst uu Easogm re tnsvuaturralpespi uslst eeamcdtat esus sseda di s gtirnitiin.ssc usiOsidr munp.nar treI etnd i ulucie«+tsieutsssa q spus eeiel trlh aeaatnbm.tie ettEsa lqneiutste t m spopcurlelbalvicei erntriarasritq s uptieein lq mlueaeegun.“£)Fsltatepcamaisetl n idtasuuciim s t iiivdnno.tcl eiuFgdtaeupurnac ttie. bn euiEssmlt e pnmvueeelqnlvutiieutn m av erotg le+«k«pm au tmsqe ulvealugmule spsv utuctalraspat usest eaaudtdt ei s ppedihdisa gcrrnieiintssgrus asie mnsp.iir mteA. tm aieDm£K+tepe.giu esgEs ittta aitmsn a cilsineed.sdu u nEattnde iamim pd fu dasaim laeuimsrq nuvaaeuc.tl ptSruueitrdsap utitsesu ‘3«tVdt iuopvmrhe arearrnteai.t m ri.Eap t sN suumimlat lg nanau imnasecl t id aqialuslie iqtpqu aueeratntm iu bmrii idbte.eonq“£k au.mus +or +niePtsgre eosvti i nntn aaussenac.cge itVstuectrnei elsrne iarndtiiiisscsqlu u luerur hsnvo ainm vcuceusurs rr › k›aseetirdtmi i snsdqi iusraeihm o flnqeacurcuimusses n uetsrnuenimdam.. nlSEeougqbseuopseret.tna idsDsi i segssgnceeie sc›£asldsci esvfliore lirmuniotgsrpiqbaluitle .a t eeFplmuhepsaiucsfseee lniildadu c sduv olefnilaesiuc tc.u i rubFntuaa sc tIK{#r. at m oTafrrla.iec ssiEtultiai qdsmuaioe l fmesaosemrtnebiesiec tataucecs m tpfeuuetrsu p gniiiesaat.ctu u sNls uieels£cunqaruutnne actt eimnldiel cuvi sopu lslauulttma p muafcrtaon uralcp aieccbrouu.nss d. Ei vgmEieeuttn a tnedui umsai llsmI ›t lstp tias sruu tslpucterirlipileicentint et asemd.soi qnpEutiuees .scm iiEnn tagb s imcbbaeiegtbnnuedirnus.dm u dNmnii e›+‹³uievedre aile sigdqteiu sceett gaupesmus rtcfuaoussns gcsdueeue mi.up teiU.rdl tOeorrgricencitae .rsa +e + gsEarcsraetcc©+.ua eEn gotenot.r tmMoaargu nrcaio snf desirimmtee nnattmuemt imaacsuslai sv i£TÿÆÞy¾ \ No newline at end of file diff --git a/vulkan/data/gdeflate/compressed_64k_level_12.gdef b/vulkan/data/gdeflate/compressed_64k_level_12.gdef new file mode 100644 index 0000000000000000000000000000000000000000..b1fe83c7fdd4fe27d748023fa849202d3cc45eca GIT binary patch literal 8736 zcma)>Q*b2!lc-P32_~A@wr$(Cb7E`aWRi((+cqX=V%wPL#I|w&t-AZRTeV%))%AVd z5B=CxU8Db^d{NbVDj?}AW8nc`Cjcl`%t1&Wh;}AemuIB*>KRZguAVfI&Y9-&Y#z_8 z(kbB^CTt=;8z`+bQ@U?_bO}Hn%r_>Y;W4jVH`d|9 z$~r=*tJ{dOkr9&-@YCmxkx-X_#&94Z$!f3X94Pl`iU`gR+21D1Pl$u|nR7tKRsCMp ziq3&gQu7FY_dZy1g2@z+cYCaWuRTq@y-E9RY{mmsb(mG+ov9r>J98FBAugR=KUbvG zPWT!|T$reSpvpt-*V=_3bg~)oz}{PAu-o7HTkRmQL#N zlF;1Eb%Nz^C1Ab?XR##b@VY48>eG|9W$LNJ0;}QOhF|jy;<6>JLldw(nhz70lZs?5yq@G( zB_BiNqkX|NCpbF;Sa!ZvNqy$uzK{b7_f#2*Tw&Icfep+qWc-4;(62UCdE?H}tYyEa zf~iZwNJD}Um3|!KLKmXE^^8=EPhS&=!Nt=e*OKUh--{ML0p{L_rpP4=GICj#^xk6c z3e}tsUqL`Vnt1{a6c|Bd3kV#>q?*N*8RN8G;+9*wPL&9~*bC zfW$B!>A-kBly~ss){D(Bz``Bc&Sv6erer=1_~q~Io!EpzuK#Q1O^_9ZEw~5T_)_|t z%_@SvHbPKYzzVM`j?Av1wnZ4Jdt`oC_Wk>(F~fk;ejfMI59D%5H&ioCL@(6{NOH=m z%{{v#t8ee5W}q6qUIk)?&aoXP(uYI=03H8YR4qUc8&BheND@b-a%{9l|G=JS^=HsK zDhj>dbNte{g!RmHdp#QA&0w#BH-rrXJN~cHvD19)*64d}oD>QUT)i+3Xd75>eO5Q>#C=rt2|SBXnEY5|=e(>2{-VIJT5I)lBKHazr@cm=RtOl)Td{c;P=` zR&ijpk;@*^w4v$kaM1lawu8NrOsd41YmEK=B%=Eq4R)-?QG^t zZ%zrAQn|*Vf#A#l$(%@6=1+BO;PxavT9!l)v^-%7gSGl}x7&5&0lK-O6=4N8?}+ug zSaQveWRvn&nSuH36a<(1$}z%%lwE}O&$P|R4-5YRs`uzlw^KfUT+<__@E?O%Y~hZW?Q&6PPc(HMEHL z7Ll4Ykb1GW`+-r0_{B9jfp}YeJ+hVoA*52%+~-3VWZjM1 z%)GfTdFCxop4-<%E8PaV^28X8>%k{BPB8UUZ$S9k0jAFu_ad5JG17!?>s^sVu^)$) zN?DoQvEz&~{`y~YxdtIo&1np$Q4w;6=G_+Pg8?>~x#3xDY;F77VJ0On zZDQFfbuB-@+60Gsf6%Dmwc&C(iPFBTn$EnFTxjpOE{D=W${g`zQB$w^)ceBpuRQ!TY#lAZ{-(fElXkyb z)n{tl$$k-4vngVUU(f;RRZX&|mK_W>X;rT2Ixyy`w`V%!Bs))X1IZ624$!LQ%Zf=B zBChm4?EYW2kMz#a`y85YQzzb$cTFzQl;xLXT<=vM=F4R$H5gEr?P`sfeSm?NWuLZR zaT^}XY)}T;KZcAOBqu(IN*LV`G7mlTtI>s}Qy2}TpT|~N#)rnBnvmiAs7hD52IhyE zAsmQ-yD)M?OXYuFIOwN7mxDTaY}xD1NHvY}~@)53_vj`4Wnow5GOLeJ%PTz;@8T^O+>Xa@=bMz^ z=puy?@TF!I&QQYqc6{{hV0p!{C8fC9cErwFBAQM47)j(_=_ur((?8yab6`+VhfL^< z(va3Q-tC7LOHeZPDwBqpmH)fYoG{yh+Bp23e9nX#yMkFKKGGr<^{*3XoKd4!4_Q5m zw1%urFA`NcRu|oslX6M}sV6LSf$MqlNn<>e+vL*k_@}DQ#1JbQ%na!vXNHSH^iR3M1(and=Q#V_#>$yqyH(?cxy`% z-U{3f^gX@5RR+;@Q|c#8e81wxck{=fS2X+ahxt(w9x5P_>0Nu6um2A749PP^^Rrty zw`xI!1iQz6t+h}s7>#v_K&aAPH;Z@_ojzrgpLWq~eqaqANi-rKKL!=2+{weY2q0~k z3lYAUDu7K}$~F|2M)8mLn$WOqwT(PS!^d+;kD}N#=VEgnxxLq)v9bgK702NW#kRL9 zk%Wn$fx0OPT0scSLYBfst^vf+T#|U*hpv`w*<&5ZrPp}Ja}xcN48>zKTYX~)V!<4U zV-Tf!hg(vrJ$J-yuXS05xhcHFe}<)oWF;Z5Q8P1h#Z=W4@x;IKw|2q~kx7H@RPo}+ z4$@IhQHKpz+>l%IpBuWNg^iT&p4^FU(fB^#&33~8TE0PEL02}=p@>|g=N6bc+A~L3 zZ&5QkE+&CmE5)^Mic=9n_~iRWc3ba3Q>~=9>QGCOBH0JkD)#wg?#jaSlloMGWV^WK z)}#3ncm6YLxaafyW-n0Z>)+6dL>NuSeVIiwpUldbW}IQbs=q~Fa$5VrLsY%lx~Y7- z?{ctpsmis6*!u2mKhSVu<7EBk!>B;Y=E#)(@9(meo=;7-m+J1G2LnqK32T$y;PDnq z8i;OziO^7JAJ0SOWPUt_cBR1LkcePIRU{J;X6?piftce+=X5*O!d^_)rP^u{KRvi| zvZ`_CN%}}4MSavrn9#jPLQ_#3X(#orVznF=x`o@{B4n~gK8jigUASSYen7Td2Ho~W zvDAN~_z6`|zCIWPCO(Es2ESni=>Kiw(J}i#oFk5a-gQqMade~VgcD9$Fs0)kQEl1>6`! zJ1*~728n?P94}(_k@rIzQ+!9>kWG6>Dv ze=G9s0QX11!rPgjzgi6hOT*cn8-OmTGL!V%J!=zJ{N%B{(W{Z-w+oePQD+tp4Q_( zeaSjDeOUuRXDsuymj>Pwn9~%1NS*0=fZckazX8?W>it*k+i#JiES!U?&g&eF&L2Ae zVCgL+pH6BIN>8LEc_i<9Nqz{5)QF*q$XNQ@J6^j%?*0KxUY_ zu~Q30U-a(3USAKW&e~6D$j(riS%jvap=Ji`?GW4@xQ!Z)zqNeGF(4r|=`bXCwUsc>9WJ}FY*V@q}CLtOK;$1KfZrm-moQAH0!6FiNUefr48`5rrV!{q7Lvs z)Q1UW60;y{YWelM09FB&abXG#&!(3B)p!onw!#c9wPt#2?$ZZi&-M0nQ_azD<{~YL4j;Rfr6>35abFOB^)FgAQb-{^+^?E(V#Vvg-+?aEmJ*D2_^D{+jV&)jrCIkw?o(}|&s_GjU zlgqKL;3cZ5u3}QZDa|G@uCIO0?d|#@b1T{g4ti=GjA3i>GD~JWan?Nr7mkJn4;%(Z zmJGE4%Ja!_?~=`7)IBf^nHmr+(k#k2MjvOhk4K0!_u+3invIPbmf?zw;mcfE16?!<|m zK=ze#$GKoON#~!m2cA3!((q9B14KKq$-a?~D=Ih%Q68wRKa}Q*fQfmvJ6s%ckP@`Y z7LqWoYo?i#L+%QVAX<$B=jdiLM~tinv(;sLE_qvnH;?>nrZXz|)&z9lz9qUv)ggLU z3b7gT6iyvQInSPo$f4l1`A%h<@`22z9%;0|ep~44cuRFQLYbN|p}UDFd+Mpp<-L)5 z`{eqlyKY&sXeu!1ag3QJIJZNpfHjwz@=oZWI#oplLBJHN3FA!(z`rxM!|fJqHJlW+ zny^Q$l>YlIm0mVgCGI;dteh9FWL^xC5g2p0!8?>hE{hkn+h!gVd4`8e5y4&7^6NE= z5^N2ADr3tlF3dBe3D6&ZaFxa0Dxp%oBLx1l-@Genx}aGn6b>4f*2coYQ^G|{FDPF$)zqJY zk6XscXRQ6YC%+IeKyX!WM=2?q)ilWGD@QtlrhkAe@E#JEpFSKF7Aq^;iD^omRqmKfLi#$3l-H7E(OQu&H+j%>C+zONKquf3X1aUTgB zhjuJ1fvzBp?kD0%Ru(_>)=a-jnZ&xdhX{w~;i|m-J(}|T=rt6b(vQZo8S(k<_YFtx zWT-8DtQFM%cRB+kL$=W*e`~2GY=yzt+8?UbUy*4|Xt`RP5$f0Cny5LDZg;qAwaq2#jYr z+jDwBL5ZC<$`ly%V5X0R7`+(J-|6v7RgsW6aY!HwD&!lXbP7q7_Qx%=`b8~aJzd@B z$vfcnzSTezDB0@_sn-pToPMyO&MR9zSNNFXc~vH<+&&9XEPQpB6eU@ntv3_)V36Y- z>%?HC3bAcCr*cR+W`!(pEM8~YWruk$c;=Qaqn%2>B}WM6&QMcljdM#>kPZcTd*BPi zE@2TdB?1E+X}ywX)9bYZ*I(dLFBWDU0+)9kbF6JucZD@ z%-GNzPMEk29UXW&%t+^-N4L_Np1b1&#JE70keuuD;a_2FWa?aSb=9%3{clz2``}1N zza^U?(G-~jOfj;XSzW;>_;PRnDM)Ah!seou(;%I8b%0V&6U0}b?!a|h+Zc^_B~WLZ z<(*(3uxm2%Rw+MSqAz;WFp9Tv_7DX9`tSESsY>u1lOp`Nb?2OlC!&1A@)?BXIFTQ~ z*b4>pB|Qw;i7P;9m>;=eE??*W?RD_y7+qtKykR(pc;k~npx#aMj zKC@i*UW6+p73p{hu|~15a=AqtxPu+;GDz6)gY2F;G2R|NYj4Vq;}w>F7*Dgl6YDHV zdh-IS#!%5L3-t@A28Wx(p(c&8<6P6lMiT?V8^G?)3zTRHFS-JbN+sHC;09rlg`9Jf zWf9}SJPn9vqB?Dfnp7;FP^&yg1335-cq3w3j*=+Adma7)|S6;BV^(c+k+y($>MusU)ER7gwRi5 zPD8h*lvX?3nw6VQ#jIP|za-ErGRYYuzaper*Z98N)4)Hb_E(L(iq+_RYkH&I3wR|v z*Km155B_bxYiJhAqXYGU<E4OId*SLy z$&!O3s2ZC7)p4cZd{)gWY;fHq{sMJ-uRizL5k#ReB6QJafsG2jnQKFRqlrbX3@9*J zYsOAW$!?#xn9-IVykBrwa1%nfD!yLO+Km#zp_*wXBqd2{U}$!uS8EPXSn(lpSCS*f z;vo&&$}%t*b#a=TIr6&Wu_1R=;%P{euG(#h@}Tw`W3S%9{w|_5J@GrtC6-h~usW9= z4)+g5!WW z-L&6?Y$oeHSMncgZdXozl-FRb!@;Kai}T&WYLh>U;jN;(&#+{5bJ1AK?Uc!4-7U_t zFXz#KiJ>mq`2T4bNI4e+upWIXhp+W$D}R`y{xVV%-wG z*@ZNNoq_zTtl3>yJC6%q{&@x0w-kuaftyGN$DxFX?R?Gx*K*utK8u z15+FCVe8o%bF@w37QqcMFuxT+&eCLwN%LrX%|s)D367BX_gNplfn0NRR36vypIGg@ z=9ryLKOdt)hUce`iybA9W$Gm3PzMU?SxP{(F8NI3P5CnyByvw><;Pg}5D zCtcn9jY=yenuaH5T#b;e?TN=UG?GaIwFCN#emUrz{J_VFX3NJJIqWWNbZV7uoj=L$ ziCK$Bt}Rx0R986ni;G`6h*ZvxMoZs}y$Jyw-m3k%AY|K8u0_Z`YM^aBA_jc1vDk{U zsAucbLzTl-x`e21AnYtqpz#$+qYj_Xr~1-9bX{Lu{oa6|(r>2&?9aVVlbTX>eZdE* zTBF1-_(2l_b(X`MXF=D-Qe(}etT@OTZk^E_+l~o)HefHt+Al1&N5puL2<>VWyl4ic zH5pB`9EM6)5H^R@gR3$awF*swTg?~ zI9?^xn@K$|loqq`bQ-{=Gt;+1?FPlhBqyxTEup2p43m!a4e`!bK>yZrC)UnD8>s=l z`Y(dDn=gBc~=WL)o6MOg{v~oe6s~vPA(V@@EQ3U!8*;>Vl zap4m^@wr8%rD9&R>>li#Q?iER2N#JzX`7bE1bu5M3Vj*x<89TW`-e!C3s2VTyyxu)ZKsBo}xF)A~6ko8e-x5tAON*!J8 z%C_BYnO|Ll_H*HHSwk0I@D8|u7tZdUe_9vjqH6MLvM|R;{s+D{p>OUhoPoMj*Y2j| zG(s`mK3sj(7AbzH?o0jsNd76ocT*LIs2!hDl&7BuRHrtLk&2h@{eBGXse`xb$OwW8 zkO1vLzX(NhB)~Q*3V>AfKU~HPVc&y|$iPU3%N~vixT6FB`Y>Ps0*%lB3?@E66953f z7y1V9)1-2$kAw$={fA4KH31!?EpW$N06-Ho08q9M0qCef2Y?^|fJf&44E+E24+8!x hq5fO^4;Ax&aQ~Zv`QIA{DXnX+x!&^SR{|{HptHA&O literal 0 HcmV?d00001 diff --git a/vulkan/data/gdeflate/compressed_64k_level_6.gdef b/vulkan/data/gdeflate/compressed_64k_level_6.gdef new file mode 100644 index 0000000000000000000000000000000000000000..bff7f3b90239c771594501005b47f682d65ee77a GIT binary patch literal 9316 zcmb_-Q*b2=(B+M7+qP}nwr$(Co!mGR+n6|+*uF_7o+J}*9GSTr4iy`Wx{o`cfvmzbbvWrI4BHb^-y)7P^Uq2!&KH>Vl-3F7NjSP}@RJBM@)=&erj8a}kB_1If zeb2$%;ywA6V7j*vZ@~pyeB|&?J^*JuM~efXU)YV$WZoc-^=AD}mC(`XiD~2`SB+Qx z_R$)G0N+{%!)H|zB64Lh^2y(IBL!MRAwTy^E$E07X$ys$4p1i1Yll(HeoAaC+|Ulk zRe0f@_j|aSCpv8q8P)-W6HDBy&2BSj^@tDow80+3(eOxPE>KX+_%40HI zUw@YiL8opGB_Z{{d{D@8Y`RS394>0jCy~xSQS2_QMyu$SiWET?B1E{*Yiy#to17U* z5h`=Nny`M3&L-Ot=+dloL+w|wYU`d-1-9GH1EFqtYYSCjVvs~&-ZT&bSl0dXBsyVg@C1)c z=|qAFTcH={JYnTs+$kFF+Mq|Doay(U=s1PAR|^&{>heBK25E~X?Ns`MFQRF42N}Nq zNvI8!iW-KxdZEN$5i?3`jbug>Oq zxzhUp>_mD&Ir&%D90DlbN%Vh$XA>1+?f=r+aHs3^m}&hmoRBu1vh}( ztDR${7wGO0p+{A3+pJ_?U(M3tGz@G5USOZmmqX`%>)wixg$?;u1(qRRdrdkSoF$w0Iiw%>HN9i{Y}HDW^2jT&OZXEC zo~c(}dU!;vtMJv)oN&N28;OzaAED{FgD1D{3n<$U)($tE$W_Y{RhrliP2w0OBK_8U ze01<(;4ql+ALxl*4US+j!yFzSyx-J1)%p{HMbY|AuwOK3{T$S|eY<;uV0BJb~0#}9|S zcEoiczn(84cSIP_i78xJ;DyCX3vV+bLCnQBN2HnRgMlCz;sEznmBI{gA6?(Tn8&J71Mq8aX`Mj`i|l0@8UUEl8xKb_J{IJ+0kc%yHZ4MtA};p)X5chx&AZwFB5f{u*6wxy0SVx# zK|Ik{wCF_DvD}S;b+iXU0e%50E;=xegx-)+K9%$U`0^y09^c=Kz#*>c*xh8<2!LCtos zdSx5xA7uHirx`9KW`Hs3Q`!MYy02Q2pG`9sltzd!T4H7^XWv0>RxEpu#Vx=ZuKu$I z9(S7TQ7_bAJ6fz2fptx#wBq~Kp~|56Si{^7lO||**gtfZ*9=H}8=fXUB1dlT9A=uC zChMoMe3(*yD9H?$4tlgwMlT!BfV7ImarD8U5{!+6l(_Thp6Xr6>zlF*IpPx*<;vANqJf?KTcOO(L% z0jwPjDgiJ_bmlU_I(^)!!@Oj~nt5Te_g2Ri;YM|>_&nw3cck$xL8p>2h1Q=K_A~Fj zh*o6Y70&GECzvRwa~_Erwz!K3ZpGWMUa^FW2J?%Biz-!HvbYPOG6LswPINM++oM_? zXKeHR?4Au>>0suoRC{uI4wG@}lzCBB5J|BH^FCxq+=ffqnevEmLMu*u4HZ#>PiPYZ~dHc>h= zt<_frRZ`TtPwv|U+VL6Jaoc6Q>#p;gk#C!$4s+>P(i9WjdrWOdl@YXsm&dY)UvA=7 zj=$okZmF@oAlJ&0L~u>LeP*+=!gGkC-a6_3B?a=k zaP!p?<6kL5`HuW1HEC1QpsXcv{*y{;26P#`vJX!zMu`m5K^Nq$!H=a_zdwfsNB&pt zK5TbcID9j;%@MMKAjMi&J{`?pe@vwDZGpX1vvb~dzx`L>8U86?5#umO47DL`PD!ZC z!h!bM-uJnyj~(MQij*P+W6gUDT23bdIA&era5x+1 z?L{|EMJJX&Ara!5OWj;w}X)X{Xukb%D2I3ofl) zTF5ays4xha*S{>Zxh{H`A9i#4gjQsJ0i*Qk`0uKUyYudZr|7^^mER)Nl=O3Q+*O2!=QA&+L<{&d(avj26a zx?;#i3dABv*>`O8*mj?7I8FD`;YM#eJo6kH(kI&*9P_|_F(A%I&$3lJ8FV>S0t+;c zsu{A9=PWy=3`n0>2!72s@c=3~6?YkL|I9;Xq*>R7etc3BJi*G_*3>=r-Kt;i1|4p* zTaF%QZ52Z`nLW^9;uD_`$QW7Ielp;xPS>B*{ApT|N>x;wE}G2B7HI?T@}%nSsM5p9 z9o3(Pl{SUb5%5QVo!k0bB)*zf+N$8{m7|Zl!#9(0P2Mc{meF1XWv%kbOHH2Z6luqP z?!-lMOvFtof@u>rd!gXC$|&bO@mpEy2{O+n|5;L7yv5Ceu)Pv;JDINMGicpEHFnzB zZy?rn;>Iw7N4c_grK6GRV|%Jopi;oHd7(@^FNPxhp*c#&ulb1QR+ZhtCeo%3oWAS* z$n1?zR*fL=!FPFaU2SenC#Lg{u0|+RtcgiMVfR7jCtgZ$7XHy;#G6wqMa2MZp0?;h zrV-f59Oc=KWzoqG_TfD&NK5BmqgbaaSzP+GvAi0tLbUrfa61)6RDmA++4=^K#^C6I zv+aKl7i2&4S#7$Ur+#3)ZQ$M}$I$y18x*bch*lTbbXc=gc=@5FD=ZF)MZk6uYJ5~`|cyX5#cVe88_TLx2oCf!^)h|vuS zOlvu}Z{ye@#OlcF&&$fGih`F8wy}btS~AV+blkNKM2bar zfmWbUoJ$VlQ+N$XKXxsEF`c3rWfzI+oQNXNYqOidUSAubB3__f^ov}4hfafMmPgP| z7Wjr5_Z)YEuMCOm5RC6xim1<6lm0UJS~m=|xb!N$xxdgr64iPiKYqhcig5HQ&Q6{qpwU;LoM|t|nW{GoLC9FX49jNC-}edSN9Zc}^Uz_+pu( zpazsd{c^8d(hf?n%>Ko~KdVnfv*-ECUHNh;%-pZ0qE|^*4by4X;ziEGo1&HZD}Soolw8Ip`d~ zh#l>fMxsx1goJ~*mN}<&Y^Q}?J{f_5impL+U=tU|Qioo3&9t2-;gq-wsmBh6pAP#%{n-0F3@TXNxkh)Rlb+FaTq^jna3?Xc$sPr>P70U}l(YxR+ zy4xN16kMi&eHvPSWnX-fGQcp@xay$J9(b3uupS3;DfZ+$G57^E-UY<6T|8}3N4 zC>xm=;2NF+w3~9LWld16)=R{=^iG4A_K~EtlN>j}5Q?E9AE^an&Lfeh^SEFaT#q*1 zD530_F4sD{DO^Vx1%6C|k4|8{$7Ej3_+%FQ>E@+o{5 zB0}z#j0v@NHaMim|s&_qAWe`WdYrJ7N zUsvotM{zT@7dl*>j~$>t$fM9_bo4{WUbtzL&T6udaCpOQH1XUZzGyl{Z*?y;TLc!! zJ{9%{zGK16^*0C|$o;$c6?|VM7Ohl;t{DprG*h(sqQl?@j96`p(8GIJrxjZpxS5-b zl8?8%=RiE+Gvkq*xw00hgr8xLB`e3J={#}-a?!0VyV3&k6t)SUs(iw%EMr8@l!WZDE<0~Uyx1UvkBs(h9aO9I zP<3$Ele51K+DkA|PQB8^1!1^%4+|QbTLxLTdL7@>Wb0-8-fFTM6R7PfI3mI^@T;{+ z-pd~3+G=m5f{DK%=O0-5I}Smy0t<9FXzusFdZeA@cn1t`y{3mca!$g=zcwK)Q4l^U4PsWyBV_#A(Qo>VcClvj5 zmgjiOb#{Me_Oqd>t9T`p>Z6e4{Gh*(;XaValDIF!lVi31+eWl2%Z&h=*C8WEH8)o7 z8@K<$yb1{~LBYXoWj?f^URBY3#(+xsv4rP!#X*k)Cds8e>ub%n>xU*qZnl~zrnBQ| zF@&qwQ0+Q%zY8-H7TZL>ec7a#V$BBGe8b}gi{p-*P{^QJisMEJ2xwV|ool2F$+Cu@ zweq58PO?r3U)qS~L2?BTu&O5NlapaTJ;txLG7FLRC_yN|o7h(ny5ytvJ$;rt%YBul z1TD2*)<^s91zD^y?9DBC>-4$6NJ)Ny?mWCc4(X_->|Bqx$|OrQm&_P1?Jea&J{-%v z4uGp4sh8>g(Wh5rutEL&m8iQc)&+sHl+$2FYXO0ey4+NIEf|z;`vOixTx6Cr+}b=y z+%a)e_Yzp-gmxY2IG51%n#h@A6MP`I-?fv3MhjEWgLF?_Cg0BBMuxj)i{FR3H~kS( z!5FtT1sK0#Rr@WxyusM5Jb6uL<>S$#ibhHky1;z>_@L&0glHupoTE9CQfutd^A&1m zp=KiuSC>}>Vy||>eEZ6if3KD+Q;eRo2Y>Iold=E#8^gr&fS3oLk+HVM<6RfRVTGU9 z*wAnMjiak_UN+p}(J!UMDjJSo9^5!bCGwPWzA{z*w_k$&m|aT5I9xl_VDT#+j_BZ4 zB{}D&HD)zGe!ruQv!cjdn*I*|%jgiI;;n|NtN;8;K52!DTA`6A(-FD%!FIpll88Gu zf?YQG+yXzZ>=B`j?S7)-5P%8eMyCd>Jkf9s?chf_KSa*)X4oo^{Dir3^3ChCFtYmG z5xe(bthfmaE-sT$UO1Wa+j0s811+-BY zgj+oqX5lle6@i+aYn0f1ANcCCX_-+HW)*^q11A!BN-YKNyXfrFJaAKgEXm(WEKvW% zfvA73+wBf2vXwSOPZU6bu~I0!#xB^)+2eI$9lC}5%^!;vLC32qjJJw@tABElSdcs- zR_dAi!6*AbASam-D3)%g0*8A8G271MDqx@cRAF@2jLIj5&Z-A3N?!C=@VntNXIzC* zWd@#M+N*JCmq#MeS*dL^_@7OJR>u*l9~F96NCIw)U}7Y$1!@*`9|5WeiKjVYRdihX zalehMa0mG5)}WLV>?EY5|7Vck$3_%sorI#_GFSlyIT+&AX|Jazp;ev11GZQ#vko&o zyLsE~E_HQiaLD95R@K^La_%8jlx@VDjhHa;(vt7?QU?aLk!mXCuEIDxLRKdgE0JB% zM?K&jrtxrbk*+;mChx=V1H`2`g@k7+RZ{ie1;L0=$=5@8M)()nv+tcsa+7N4B~V!g zA#~-m3u@stA7(Sb+|$cPeEoR6Fl+!W3|vSG+WtmqPU_FQQI2)H>+-9IA81rK_p~^W z*%pdALi>0F{osa3j?EQtdc4pw`e z7$z(vCJmqQ%0h!;O&3B1dJEbF^M7cp9410UZQZ{rG%lxTiIo;$W0x;0{)f0M z?WH}%`spUBWm_@v0NA!^&>S_&0ugr*(b%}DZ)c)vqT3R&RhRzYsAmgn<{C=%FR7$D6)f8hw_$|2Z6nDa7j}j~SK$04M*(;!kEO0fk^!@w_|Umb7il7Y`8H9%{=5s7Ej-?n?Kie|48bi7BQwL2Zz=__qQQ}qL?ze zG75gzUV%;3O)!pOnntbTWq3ziM;5Q~*Qo2n@jB&Ue~X{J>0WGV#Rkq6zD6!Ud5FP< z)cqXfTq;R#5)heqc$31Yf~Zz~yD?|Lb_i!MaYkDNK+hudE^go# zIzGg-cSbxuEzWjw%(;z*khAy^@&`t9jIruTs@t)TLd&153{&q#^`p<5Lmb=|gk^4H z8~&;aIj556{3HC3W^$aob{-Ss+}79BtZGrnfg2q!lPqm+EC2wDb)9ZmkQw9TRM(07 zln7q$T=BRy;9RRTI3U2;O^POcL0HggjoRr58M}doen@~T<5bM6OoGUQ=jzuh))`yiw421#7`F(cpT&J%ebt75xceA#` zTy-F>*Yk{b>#KMS9vN1ZCH*Dh&3O)=H$z7n^kj@qe>rQ(_I!6^YRAn}ChaZE*%!|C z=a3Efr+R2os%z2jO^CKudW%_wS|wXz!x3Jlq#v z1odq4S#LgSDCC*Q=QX(483nNch6iT$joyxtf*~Q?#lO0gWn%}#7dlkFO9LF za48`~e8Cu6xek1TV9-k&@LS54qc0Fy3Sl#l_*&xTBuV5q6DQXVZtetIQH9@Zqg-PJ zT)r}@+>B$Cm`rzQY6_%msa_gwfWa!|Z^wtzdT&hGd&0FS9G*R=lSyrHIVF;t9W=|z zniS;TYx7AETOOJ1ekA5;$ zCURy>^-G;nO~0qkW|PY70YzJ4-8)Ko@F0rucU)}zQbo`tN7!V<#ouRq&8*d7C-ra5 zEri7$tr)7<{cI>@9)TH@7FiZa;R0Sd>!^0w38N5Hni52H=--M0r>2#+`U9>T7AnEd z^9q5RY4e-OhObhY?qr7rn?k`8HRHq&Irhpe$zNM_4^>j(x#-EY+?_)jF=BmJ_ONJL zo`nd6TGL`Qa~9}OCteo~=C={{UIJDW3j+c#klka2jo94FfN@m<0_Xuqs;lF_cj5+9 z%5e-31{~f}%*7S^6P?1+3Pc#(-AB!fqDV*)a6BpJ*ee2qiET@_K@f3q9KxJ?cQ)TI5fag5xsSWDR(@wX+ zqB{I@cIQXXVEAn^x&BIAf|7{`6ngF#Pz_}&S2taolL{kw60b-drOcnd*Zz3&;Ct5S z8Rz^AZ9$c!5sHd6++-~1!;$;DM{2mGKUIicnKk8B?$FY&);%Lm62CcbrJ@Fs@fy$a<5P_tfL(@HW;ZL-*=fw&V6^yzdb{~ z*?=f|NBaYZ*pEHjd0nMdJ>rnVMGN^z)%03vW_E(7MxWcPTVXQT>8F#tG|Y#!b*KdO zGQMv(0~Sd%9HrE^%EuMOh~!SV;9o@<)_a26n$=*VyE=6<+6YP=yxGmC5_2W&-vN2u zQ{r`}77Rjpq(t+fqpPwP>{oa!0Q+-G^j(Ah9KV=TH758q+n6!nD!TW!j?w8Y8}VStTqc$$pFrUt$=Fi3L}xtydT)^9mxPn2h=qNbj=^?GRS%I|bDr=Iy$Y2CtgzM6E4N?&_{ z$kT@pImM@=>bnpHQvF!gD%&$p-@-!#zW*J=v$jEnA9f51Dvx&>K0x0+ADDs#Zj4JY ze_D2e!_gJMWd1%tso3V15O~`7`jLE9u8Yx{4KR2Y(}sdSb#htH;ag+fPzyu(_T!aj z{sO&rpL?E+HSz?sW2!wYL^4^0CI3l)-_|vbz_Q%^+4rJ6$g|pB|L74TNk^3>Z&ju| zQusZu-!36Rta`ok;c{-Q$}pw(mu}p$06xi3U#A*NCBd|h!$5RD<&}GLUkbnTjC5o+ zD%cMsp%JW7p@Fa0f}1e;E@Z0r9-UmFxxp~)dNpJ(-2$*s<#5s7k1QhW)>@d@{~dp3 zwAHiJV>blnQWf8K%$fi;n~piT?>s?82c8V*(>!VUc{$h6@b< zGLNpAdY=J#gZt#M{B3MQp{+Z-9A5F@`27o>mvo4BMQgl9(HUU_n8u?X2yPC_g&gqe zZC@Cte9tg`=|LH4WcC*{a%rWXw7QxZatQtPQ4aHQz@?>hoIPD^JVVS$?2hY*6|L^1 zzyB<_a{!rNFfbOG#usb%iGB5p8RRh0u^r7PyftMLrRmnoGI8JP2zdU($OCUV+6sD4 zEG;8WUCPoe?~V$qV+_!(#{^jzKO;}gEaXqN$lGt*VJu@J3v<1u-V%#18< zhpvri^~4$GOg)RL1iX{Sa`A*WFuTTD_geg&Da=Vr?H3))A@Fa)qDbBc(cN4KHAh`= zWyi&>-P8dbt218T^%7}D-&?E_D;Ks4w|XDyJR1D@8xjMp$lvp?vDYP_O$~%pPdwqw zKpqh1A%uyORTn&q@<{!xb|0b2ZwT`7l*T>juBTut2ai3GFn)oDacZgKFu%W41s9|Qm}WuX&F3jhFyw7>xE zFaW?gkvgDl=fA{%=m!b_ET|v=)T!VAe`Ellaw7+VCj$V0`meV7{h#=M0sQ}Rl>hvH jZ2|Ev1nmH+?ze`afb0{{~szrp_lc{;cS literal 0 HcmV?d00001 diff --git a/vulkan/data/gdeflate/decompressed_17k.gdef b/vulkan/data/gdeflate/decompressed_17k.gdef new file mode 100644 index 0000000..338d984 --- /dev/null +++ b/vulkan/data/gdeflate/decompressed_17k.gdef @@ -0,0 +1,45 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ipsum nunc aliquet bibendum enim. Diam sollicitudin tempor id eu nisl nunc. Pharetra convallis posuere morbi leo urna molestie at elementum eu. Aliquam sem fringilla ut morbi tincidunt. Adipiscing tristique risus nec feugiat in fermentum posuere urna nec. Sit amet purus gravida quis blandit. Sit amet facilisis magna etiam tempor. Vulputate odio ut enim blandit volutpat maecenas volutpat. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus pellentesque. Gravida in fermentum et sollicitudin ac. Pharetra massa massa ultricies mi quis hendrerit dolor magna. Sed augue lacus viverra vitae congue. Mauris cursus mattis molestie a iaculis at. Sit amet nisl purus in mollis. Malesuada fames ac turpis egestas. Dui ut ornare lectus sit amet est placerat. Venenatis urna cursus eget nunc scelerisque viverra mauris in aliquam. Viverra orci sagittis eu volutpat odio facilisis. Nunc vel risus commodo viverra maecenas accumsan lacus vel. + +Non diam phasellus vestibulum lorem sed risus. Est ante in nibh mauris cursus. Ante in nibh mauris cursus mattis molestie. Tellus in hac habitasse platea dictumst vestibulum rhoncus est. Nibh sit amet commodo nulla. Bibendum neque egestas congue quisque egestas diam. In est ante in nibh mauris cursus mattis molestie a. Sit amet est placerat in. Et malesuada fames ac turpis. Lacus sed viverra tellus in hac habitasse platea dictumst. Nunc id cursus metus aliquam eleifend mi in nulla posuere. Ornare quam viverra orci sagittis eu volutpat odio facilisis mauris. At tempor commodo ullamcorper a lacus vestibulum. Diam sollicitudin tempor id eu nisl nunc. Dictum non consectetur a erat nam at. Purus faucibus ornare suspendisse sed nisi lacus. Magna etiam tempor orci eu lobortis. Blandit aliquam etiam erat velit scelerisque in dictum non. + +Nam at lectus urna duis. Tempor nec feugiat nisl pretium fusce id velit ut. Facilisis leo vel fringilla est ullamcorper eget nulla facilisi. Cras sed felis eget velit aliquet sagittis id consectetur purus. Ultrices neque ornare aenean euismod. Aliquam purus sit amet luctus venenatis lectus magna fringilla urna. Amet tellus cras adipiscing enim eu turpis egestas pretium aenean. Nisi est sit amet facilisis magna etiam tempor. Mattis enim ut tellus elementum sagittis vitae. Viverra tellus in hac habitasse platea dictumst vestibulum. Volutpat blandit aliquam etiam erat velit scelerisque in dictum. Viverra suspendisse potenti nullam ac tortor vitae purus faucibus ornare. Ultrices vitae auctor eu augue ut. Pellentesque massa placerat duis ultricies lacus sed turpis tincidunt id. + +Neque ornare aenean euismod elementum. Dictum non consectetur a erat nam at lectus. Aenean et tortor at risus viverra. Consequat mauris nunc congue nisi vitae suscipit tellus mauris a. Diam maecenas ultricies mi eget mauris pharetra et ultrices neque. Duis at consectetur lorem donec massa sapien. Neque aliquam vestibulum morbi blandit cursus risus at. Tempor orci eu lobortis elementum nibh tellus molestie nunc non. Ut sem nulla pharetra diam sit. Dui ut ornare lectus sit amet est placerat. Vitae purus faucibus ornare suspendisse. Vel quam elementum pulvinar etiam. Libero enim sed faucibus turpis in eu mi bibendum neque. Viverra aliquet eget sit amet tellus cras adipiscing enim. Nulla facilisi nullam vehicula ipsum a arcu cursus. Sit amet nulla facilisi morbi tempus iaculis urna id. A erat nam at lectus. + +Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Scelerisque felis imperdiet proin fermentum leo vel orci porta. Pretium viverra suspendisse potenti nullam ac. At augue eget arcu dictum varius duis. Donec ultrices tincidunt arcu non sodales neque sodales ut etiam. Tellus in hac habitasse platea dictumst vestibulum rhoncus. At urna condimentum mattis pellentesque id nibh. Lorem ipsum dolor sit amet consectetur. Nam libero justo laoreet sit amet cursus sit amet dictum. At lectus urna duis convallis convallis tellus id interdum velit. Tortor vitae purus faucibus ornare suspendisse. Nisl suscipit adipiscing bibendum est ultricies integer quis auctor elit. Convallis convallis tellus id interdum velit laoreet id donec. Sit amet nulla facilisi morbi. Duis ut diam quam nulla porttitor massa. + +Sit amet consectetur adipiscing elit. Netus et malesuada fames ac turpis egestas. Nulla facilisi nullam vehicula ipsum a arcu cursus vitae congue. Elementum sagittis vitae et leo duis. Ac turpis egestas sed tempus urna et pharetra pharetra massa. Mi quis hendrerit dolor magna eget. Nisl tincidunt eget nullam non. Quam vulputate dignissim suspendisse in est ante. Odio eu feugiat pretium nibh ipsum consequat. Vitae aliquet nec ullamcorper sit. Nulla facilisi morbi tempus iaculis urna id volutpat. + +Adipiscing elit ut aliquam purus sit amet luctus. Consequat nisl vel pretium lectus quam id leo in. Pharetra convallis posuere morbi leo. Massa enim nec dui nunc mattis enim ut tellus elementum. Feugiat pretium nibh ipsum consequat nisl vel. Tellus in metus vulputate eu. Eget egestas purus viverra accumsan in. Facilisis magna etiam tempor orci. Quis viverra nibh cras pulvinar mattis nunc sed blandit. Diam phasellus vestibulum lorem sed risus ultricies tristique nulla aliquet. In ante metus dictum at tempor. Enim neque volutpat ac tincidunt vitae semper quis lectus nulla. Erat velit scelerisque in dictum non consectetur. Et malesuada fames ac turpis. Dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Velit laoreet id donec ultrices tincidunt arcu non sodales. + +Viverra accumsan in nisl nisi. Urna nunc id cursus metus aliquam eleifend. Massa sapien faucibus et molestie ac. Rhoncus dolor purus non enim praesent elementum facilisis. Arcu ac tortor dignissim convallis aenean. Ut morbi tincidunt augue interdum velit euismod in pellentesque massa. Eros donec ac odio tempor orci dapibus ultrices in. Quis lectus nulla at volutpat diam ut venenatis tellus in. Aenean pharetra magna ac placerat vestibulum lectus mauris ultrices. Sed turpis tincidunt id aliquet risus feugiat. Condimentum mattis pellentesque id nibh tortor. Adipiscing commodo elit at imperdiet. Ornare arcu dui vivamus arcu felis. Dolor purus non enim praesent elementum facilisis leo vel fringilla. Scelerisque felis imperdiet proin fermentum leo vel orci porta non. Iaculis at erat pellentesque adipiscing commodo elit. + +Tristique senectus et netus et malesuada fames ac turpis egestas. Convallis convallis tellus id interdum. Tincidunt dui ut ornare lectus sit. Eget velit aliquet sagittis id consectetur purus. Maecenas pharetra convallis posuere morbi leo urna molestie. Tincidunt arcu non sodales neque sodales ut etiam sit amet. Sagittis orci a scelerisque purus semper eget. Sem nulla pharetra diam sit amet nisl suscipit adipiscing bibendum. Donec et odio pellentesque diam volutpat commodo sed egestas egestas. Suspendisse interdum consectetur libero id faucibus nisl. Sed egestas egestas fringilla phasellus faucibus scelerisque. Semper eget duis at tellus at urna condimentum mattis. Sodales ut eu sem integer vitae justo eget magna fermentum. Phasellus faucibus scelerisque eleifend donec pretium vulputate sapien nec. Euismod lacinia at quis risus. Ultrices tincidunt arcu non sodales neque sodales ut etiam. In hac habitasse platea dictumst quisque sagittis. + +Praesent semper feugiat nibh sed pulvinar proin gravida hendrerit. Vestibulum morbi blandit cursus risus at ultrices mi tempus. In iaculis nunc sed augue. Eget aliquet nibh praesent tristique magna sit amet purus gravida. Ullamcorper a lacus vestibulum sed arcu non odio euismod. Proin sagittis nisl rhoncus mattis rhoncus urna. Facilisi morbi tempus iaculis urna id volutpat lacus laoreet. Enim ut tellus elementum sagittis vitae et leo duis ut. Elit at imperdiet dui accumsan sit amet nulla facilisi morbi. Enim lobortis scelerisque fermentum dui faucibus in ornare. + +Et tortor consequat id porta nibh venenatis cras. Ut morbi tincidunt augue interdum velit. Ac odio tempor orci dapibus ultrices in. Urna molestie at elementum eu facilisis. Quam nulla porttitor massa id neque aliquam vestibulum morbi. Purus ut faucibus pulvinar elementum integer enim neque. Pharetra diam sit amet nisl suscipit adipiscing bibendum est ultricies. Facilisi morbi tempus iaculis urna id volutpat lacus laoreet. Elit at imperdiet dui accumsan sit amet. Feugiat nibh sed pulvinar proin. Donec massa sapien faucibus et. Imperdiet massa tincidunt nunc pulvinar. Nulla porttitor massa id neque aliquam vestibulum morbi blandit. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce ut. Turpis cursus in hac habitasse platea dictumst quisque sagittis. Eu lobortis elementum nibh tellus molestie nunc non. Mattis aliquam faucibus purus in massa tempor nec. Mi in nulla posuere sollicitudin aliquam. Phasellus faucibus scelerisque eleifend donec pretium vulputate sapien. Pellentesque sit amet porttitor eget dolor morbi non arcu. + +Cursus risus at ultrices mi tempus. Fermentum dui faucibus in ornare. Augue interdum velit euismod in pellentesque massa placerat. Quis eleifend quam adipiscing vitae proin. In pellentesque massa placerat duis ultricies lacus sed. Malesuada fames ac turpis egestas. Quam nulla porttitor massa id neque. Ipsum consequat nisl vel pretium lectus. Porttitor rhoncus dolor purus non enim praesent elementum facilisis. Egestas dui id ornare arcu odio ut. Vitae tempus quam pellentesque nec nam aliquam sem et tortor. + +Arcu non sodales neque sodales ut etiam sit amet. Vestibulum rhoncus est pellentesque elit. Nisl tincidunt eget nullam non nisi est. Consequat interdum varius sit amet mattis vulputate enim nulla. Scelerisque viverra mauris in aliquam sem fringilla. Platea dictumst quisque sagittis purus sit amet volutpat consequat mauris. Pellentesque habitant morbi tristique senectus et netus et malesuada fames. Augue neque gravida in fermentum et. Proin libero nunc consequat interdum varius. Bibendum at varius vel pharetra vel turpis nunc eget lorem. + +Auctor urna nunc id cursus metus aliquam eleifend. Sed turpis tincidunt id aliquet. Amet nulla facilisi morbi tempus iaculis urna id. Amet tellus cras adipiscing enim eu. Eget gravida cum sociis natoque penatibus et magnis dis parturient. Nullam vehicula ipsum a arcu cursus vitae. Morbi quis commodo odio aenean sed adipiscing diam. Ornare quam viverra orci sagittis. Turpis egestas integer eget aliquet nibh. Aenean sed adipiscing diam donec adipiscing tristique risus nec. Dui vivamus arcu felis bibendum ut tristique. Sed cras ornare arcu dui vivamus arcu felis bibendum ut. Lacinia quis vel eros donec ac odio tempor orci dapibus. + +Leo vel fringilla est ullamcorper eget. Id ornare arcu odio ut sem nulla pharetra diam sit. Magna ac placerat vestibulum lectus mauris. Curabitur vitae nunc sed velit dignissim sodales ut eu. Amet venenatis urna cursus eget nunc. Est ante in nibh mauris cursus mattis. Velit laoreet id donec ultrices tincidunt arcu. Est ultricies integer quis auctor elit sed vulputate mi sit. Faucibus pulvinar elementum integer enim neque. Sollicitudin ac orci phasellus egestas tellus rutrum tellus. Tincidunt ornare massa eget egestas. In est ante in nibh mauris cursus. Dui nunc mattis enim ut tellus elementum sagittis. Mauris vitae ultricies leo integer malesuada nunc vel risus commodo. + +Ac tortor dignissim convallis aenean et tortor. Nisi est sit amet facilisis magna etiam tempor orci eu. Lorem donec massa sapien faucibus et molestie. Consequat mauris nunc congue nisi vitae. Dictum at tempor commodo ullamcorper a lacus. Ac turpis egestas sed tempus urna et pharetra pharetra. Tempus egestas sed sed risus pretium quam. Nisl rhoncus mattis rhoncus urna neque viverra justo nec. Fames ac turpis egestas maecenas pharetra convallis posuere morbi. Auctor augue mauris augue neque. Id interdum velit laoreet id donec ultrices tincidunt arcu non. Elementum curabitur vitae nunc sed velit. Ultrices eros in cursus turpis. Faucibus purus in massa tempor nec feugiat nisl pretium fusce. Eget nulla facilisi etiam dignissim diam quis enim. Vulputate odio ut enim blandit. Venenatis urna cursus eget nunc. + +Vestibulum morbi blandit cursus risus. Nunc sed blandit libero volutpat sed cras. Tempor commodo ullamcorper a lacus vestibulum. Id neque aliquam vestibulum morbi. In dictum non consectetur a erat nam at lectus urna. In metus vulputate eu scelerisque felis. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Vitae congue eu consequat ac felis donec et odio pellentesque. Tortor id aliquet lectus proin nibh nisl condimentum id venenatis. Amet venenatis urna cursus eget. Molestie nunc non blandit massa enim. Pellentesque dignissim enim sit amet venenatis urna cursus eget. + +Leo duis ut diam quam. Massa massa ultricies mi quis hendrerit. Sed risus pretium quam vulputate dignissim suspendisse. Tincidunt dui ut ornare lectus sit amet est placerat. Cursus in hac habitasse platea dictumst. Et molestie ac feugiat sed. Orci dapibus ultrices in iaculis nunc sed. Penatibus et magnis dis parturient montes. Enim nunc faucibus a pellentesque sit. Lobortis elementum nibh tellus molestie nunc non. Viverra maecenas accumsan lacus vel facilisis volutpat est velit egestas. Ridiculus mus mauris vitae ultricies. Eu mi bibendum neque egestas congue quisque. Interdum velit euismod in pellentesque massa placerat duis ultricies. Vitae congue mauris rhoncus aenean. Suspendisse ultrices gravida dictum fusce ut placerat orci. Enim ut sem viverra aliquet. Cras tincidunt lobortis feugiat vivamus at augue eget arcu. Semper auctor neque vitae tempus quam pellentesque nec nam. + +In iaculis nunc sed augue lacus viverra. Posuere ac ut consequat semper viverra. Placerat orci nulla pellentesque dignissim enim. Etiam non quam lacus suspendisse faucibus interdum. Sed libero enim sed faucibus turpis. Cursus risus at ultrices mi tempus imperdiet. Viverra nam libero justo laoreet sit amet cursus sit. Suspendisse sed nisi lacus sed viverra tellus in hac. Ut eu sem integer vitae justo. Euismod lacinia at quis risus sed vulputate. Vestibulum mattis ullamcorper velit sed ullamcorper morbi tincidunt. Lacus suspendisse faucibus interdum posuere. Egestas erat imperdiet sed euismod nisi porta lorem mollis. Mi bibendum neque egestas congue quisque egestas. + +Tincidunt tortor aliquam nulla facilisi cras fermentum odio eu feugiat. Nibh sit amet commodo nulla facilisi nullam vehicula ipsum a. Praesent tristique magna sit amet purus gravida quis blandit turpis. Dolor purus non enim praesent elementum. Urna nunc id cursus metus aliquam eleifend mi in. Cras adipiscing enim eu turpis egestas pretium aenean. Odio morbi quis commodo odio aenean sed adipiscing. Quis ipsum suspendisse ultrices gravida dictum. Lorem dolor sed viverra ipsum. Massa ultricies mi quis hendrerit dolor magna eget est. Dictumst vestibulum rhoncus est pellentesque. Quis hendrerit dolor magna eget. Arcu non sodales neque sodales ut etiam sit amet nisl. Augue lacus viverra vitae congue eu consequat ac felis donec. Blandit cursus risus at ultrices. + +Nec tincidunt praesent semper feugiat nibh sed pulvinar. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Porttitor leo a diam sollicitudin tempor id eu nisl. Ultrices dui sapien eget mi proin. Id aliquet risus feugiat in ante metus. Blandit massa enim nec dui nunc mattis. Habitant morbi tristique senectus et. Aliquam eleifend mi in nulla posuere. Et tortor at risus viverra adipiscing at. Laoreet sit amet cursus sit amet dictum sit amet justo. Adipiscing vitae proin sagittis nisl rhoncus mattis rhoncus. + +Id leo in vitae turpis massa sed elementum tempus. Mi ipsum faucibus vitae aliquet nec ullamcorper sit amet risus. Placerat in egestas erat imperdiet. Leo a diam sollicitudin tempor. Aliquam sem fringilla ut morbi tincidunt augue interdum velit. Augue eget arcu dictum varius duis. Tempus imperdiet nulla malesuada pellentesque elit eget. Viverra suspendisse potenti nullam ac tortor. Urna et pharetra pharetra massa. Sed id semper risus in hendrerit. Ullamcorper morbi tincidunt ornare massa eget egestas purus viverra. Feugiat nibh sed pulvinar proin gravida hendrerit lectus. Dui accumsan sit amet nulla facilisi morbi tempus iaculis. Phasellus vestibulum lorem sed risus ultricies tristique nulla. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Habitant morbi tristique senectus et. Duis tristique sollicitudin nibh sit amet. In arcu cursus euismod quis viverra nibh cras pulvinar. Cras sed felis eget velit aliquet sagittis. + +Consectetur lorem donec massa sapien. A arcu cursus vitae congue mauris. Ullamcorper sit amet risus nullam eget felis eget nunc lobortis. Cras sed felis eget velit. Nibh sit amet commodo nulla facilisi. Porttitor massa id neque aliquam vestibulum morbi blandit. Eget arcu dictum varius duis at consectetur lorem. Rhoncus dolor purus non enim. Rhoncus aenean vel elit scelerisque. Vel pretium lectus quam id leo in vitae turpis. Odio morbi quis commodo odio aenean sed. Sit amet commodo nulla facilisi nullam vehicula ipsum a. Orci ac auctor augue mauris augue neque gravida in fermentum. Mauris ultrices eros in cursus turpis massa tincidunt dui ut. Egestas fringilla phasellus faucibus scelerisque eleifend. Dolor sed viverra ipsum nunc aliquet. Feugiat in ante metus dictum at tempor commodo ullamcorper. Porta non pulvinar neque laoreet suspendisse interdum. Habitant morbi tristique senectus et. Pretium viverra suspendisse potenti nullam ac tortor. diff --git a/vulkan/data/gdeflate/decompressed_64k.gdef b/vulkan/data/gdeflate/decompressed_64k.gdef new file mode 100644 index 0000000..c34b2e6 --- /dev/null +++ b/vulkan/data/gdeflate/decompressed_64k.gdef @@ -0,0 +1,173 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ipsum nunc aliquet bibendum enim. Diam sollicitudin tempor id eu nisl nunc. Pharetra convallis posuere morbi leo urna molestie at elementum eu. Aliquam sem fringilla ut morbi tincidunt. Adipiscing tristique risus nec feugiat in fermentum posuere urna nec. Sit amet purus gravida quis blandit. Sit amet facilisis magna etiam tempor. Vulputate odio ut enim blandit volutpat maecenas volutpat. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus pellentesque. Gravida in fermentum et sollicitudin ac. Pharetra massa massa ultricies mi quis hendrerit dolor magna. Sed augue lacus viverra vitae congue. Mauris cursus mattis molestie a iaculis at. Sit amet nisl purus in mollis. Malesuada fames ac turpis egestas. Dui ut ornare lectus sit amet est placerat. Venenatis urna cursus eget nunc scelerisque viverra mauris in aliquam. Viverra orci sagittis eu volutpat odio facilisis. Nunc vel risus commodo viverra maecenas accumsan lacus vel. + +Non diam phasellus vestibulum lorem sed risus. Est ante in nibh mauris cursus. Ante in nibh mauris cursus mattis molestie. Tellus in hac habitasse platea dictumst vestibulum rhoncus est. Nibh sit amet commodo nulla. Bibendum neque egestas congue quisque egestas diam. In est ante in nibh mauris cursus mattis molestie a. Sit amet est placerat in. Et malesuada fames ac turpis. Lacus sed viverra tellus in hac habitasse platea dictumst. Nunc id cursus metus aliquam eleifend mi in nulla posuere. Ornare quam viverra orci sagittis eu volutpat odio facilisis mauris. At tempor commodo ullamcorper a lacus vestibulum. Diam sollicitudin tempor id eu nisl nunc. Dictum non consectetur a erat nam at. Purus faucibus ornare suspendisse sed nisi lacus. Magna etiam tempor orci eu lobortis. Blandit aliquam etiam erat velit scelerisque in dictum non. + +Nam at lectus urna duis. Tempor nec feugiat nisl pretium fusce id velit ut. Facilisis leo vel fringilla est ullamcorper eget nulla facilisi. Cras sed felis eget velit aliquet sagittis id consectetur purus. Ultrices neque ornare aenean euismod. Aliquam purus sit amet luctus venenatis lectus magna fringilla urna. Amet tellus cras adipiscing enim eu turpis egestas pretium aenean. Nisi est sit amet facilisis magna etiam tempor. Mattis enim ut tellus elementum sagittis vitae. Viverra tellus in hac habitasse platea dictumst vestibulum. Volutpat blandit aliquam etiam erat velit scelerisque in dictum. Viverra suspendisse potenti nullam ac tortor vitae purus faucibus ornare. Ultrices vitae auctor eu augue ut. Pellentesque massa placerat duis ultricies lacus sed turpis tincidunt id. + +Neque ornare aenean euismod elementum. Dictum non consectetur a erat nam at lectus. Aenean et tortor at risus viverra. Consequat mauris nunc congue nisi vitae suscipit tellus mauris a. Diam maecenas ultricies mi eget mauris pharetra et ultrices neque. Duis at consectetur lorem donec massa sapien. Neque aliquam vestibulum morbi blandit cursus risus at. Tempor orci eu lobortis elementum nibh tellus molestie nunc non. Ut sem nulla pharetra diam sit. Dui ut ornare lectus sit amet est placerat. Vitae purus faucibus ornare suspendisse. Vel quam elementum pulvinar etiam. Libero enim sed faucibus turpis in eu mi bibendum neque. Viverra aliquet eget sit amet tellus cras adipiscing enim. Nulla facilisi nullam vehicula ipsum a arcu cursus. Sit amet nulla facilisi morbi tempus iaculis urna id. A erat nam at lectus. + +Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Scelerisque felis imperdiet proin fermentum leo vel orci porta. Pretium viverra suspendisse potenti nullam ac. At augue eget arcu dictum varius duis. Donec ultrices tincidunt arcu non sodales neque sodales ut etiam. Tellus in hac habitasse platea dictumst vestibulum rhoncus. At urna condimentum mattis pellentesque id nibh. Lorem ipsum dolor sit amet consectetur. Nam libero justo laoreet sit amet cursus sit amet dictum. At lectus urna duis convallis convallis tellus id interdum velit. Tortor vitae purus faucibus ornare suspendisse. Nisl suscipit adipiscing bibendum est ultricies integer quis auctor elit. Convallis convallis tellus id interdum velit laoreet id donec. Sit amet nulla facilisi morbi. Duis ut diam quam nulla porttitor massa. + +Sit amet consectetur adipiscing elit. Netus et malesuada fames ac turpis egestas. Nulla facilisi nullam vehicula ipsum a arcu cursus vitae congue. Elementum sagittis vitae et leo duis. Ac turpis egestas sed tempus urna et pharetra pharetra massa. Mi quis hendrerit dolor magna eget. Nisl tincidunt eget nullam non. Quam vulputate dignissim suspendisse in est ante. Odio eu feugiat pretium nibh ipsum consequat. Vitae aliquet nec ullamcorper sit. Nulla facilisi morbi tempus iaculis urna id volutpat. + +Adipiscing elit ut aliquam purus sit amet luctus. Consequat nisl vel pretium lectus quam id leo in. Pharetra convallis posuere morbi leo. Massa enim nec dui nunc mattis enim ut tellus elementum. Feugiat pretium nibh ipsum consequat nisl vel. Tellus in metus vulputate eu. Eget egestas purus viverra accumsan in. Facilisis magna etiam tempor orci. Quis viverra nibh cras pulvinar mattis nunc sed blandit. Diam phasellus vestibulum lorem sed risus ultricies tristique nulla aliquet. In ante metus dictum at tempor. Enim neque volutpat ac tincidunt vitae semper quis lectus nulla. Erat velit scelerisque in dictum non consectetur. Et malesuada fames ac turpis. Dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Velit laoreet id donec ultrices tincidunt arcu non sodales. + +Viverra accumsan in nisl nisi. Urna nunc id cursus metus aliquam eleifend. Massa sapien faucibus et molestie ac. Rhoncus dolor purus non enim praesent elementum facilisis. Arcu ac tortor dignissim convallis aenean. Ut morbi tincidunt augue interdum velit euismod in pellentesque massa. Eros donec ac odio tempor orci dapibus ultrices in. Quis lectus nulla at volutpat diam ut venenatis tellus in. Aenean pharetra magna ac placerat vestibulum lectus mauris ultrices. Sed turpis tincidunt id aliquet risus feugiat. Condimentum mattis pellentesque id nibh tortor. Adipiscing commodo elit at imperdiet. Ornare arcu dui vivamus arcu felis. Dolor purus non enim praesent elementum facilisis leo vel fringilla. Scelerisque felis imperdiet proin fermentum leo vel orci porta non. Iaculis at erat pellentesque adipiscing commodo elit. + +Tristique senectus et netus et malesuada fames ac turpis egestas. Convallis convallis tellus id interdum. Tincidunt dui ut ornare lectus sit. Eget velit aliquet sagittis id consectetur purus. Maecenas pharetra convallis posuere morbi leo urna molestie. Tincidunt arcu non sodales neque sodales ut etiam sit amet. Sagittis orci a scelerisque purus semper eget. Sem nulla pharetra diam sit amet nisl suscipit adipiscing bibendum. Donec et odio pellentesque diam volutpat commodo sed egestas egestas. Suspendisse interdum consectetur libero id faucibus nisl. Sed egestas egestas fringilla phasellus faucibus scelerisque. Semper eget duis at tellus at urna condimentum mattis. Sodales ut eu sem integer vitae justo eget magna fermentum. Phasellus faucibus scelerisque eleifend donec pretium vulputate sapien nec. Euismod lacinia at quis risus. Ultrices tincidunt arcu non sodales neque sodales ut etiam. In hac habitasse platea dictumst quisque sagittis. + +Praesent semper feugiat nibh sed pulvinar proin gravida hendrerit. Vestibulum morbi blandit cursus risus at ultrices mi tempus. In iaculis nunc sed augue. Eget aliquet nibh praesent tristique magna sit amet purus gravida. Ullamcorper a lacus vestibulum sed arcu non odio euismod. Proin sagittis nisl rhoncus mattis rhoncus urna. Facilisi morbi tempus iaculis urna id volutpat lacus laoreet. Enim ut tellus elementum sagittis vitae et leo duis ut. Elit at imperdiet dui accumsan sit amet nulla facilisi morbi. Enim lobortis scelerisque fermentum dui faucibus in ornare. + +Et tortor consequat id porta nibh venenatis cras. Ut morbi tincidunt augue interdum velit. Ac odio tempor orci dapibus ultrices in. Urna molestie at elementum eu facilisis. Quam nulla porttitor massa id neque aliquam vestibulum morbi. Purus ut faucibus pulvinar elementum integer enim neque. Pharetra diam sit amet nisl suscipit adipiscing bibendum est ultricies. Facilisi morbi tempus iaculis urna id volutpat lacus laoreet. Elit at imperdiet dui accumsan sit amet. Feugiat nibh sed pulvinar proin. Donec massa sapien faucibus et. Imperdiet massa tincidunt nunc pulvinar. Nulla porttitor massa id neque aliquam vestibulum morbi blandit. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce ut. Turpis cursus in hac habitasse platea dictumst quisque sagittis. Eu lobortis elementum nibh tellus molestie nunc non. Mattis aliquam faucibus purus in massa tempor nec. Mi in nulla posuere sollicitudin aliquam. Phasellus faucibus scelerisque eleifend donec pretium vulputate sapien. Pellentesque sit amet porttitor eget dolor morbi non arcu. + +Cursus risus at ultrices mi tempus. Fermentum dui faucibus in ornare. Augue interdum velit euismod in pellentesque massa placerat. Quis eleifend quam adipiscing vitae proin. In pellentesque massa placerat duis ultricies lacus sed. Malesuada fames ac turpis egestas. Quam nulla porttitor massa id neque. Ipsum consequat nisl vel pretium lectus. Porttitor rhoncus dolor purus non enim praesent elementum facilisis. Egestas dui id ornare arcu odio ut. Vitae tempus quam pellentesque nec nam aliquam sem et tortor. + +Arcu non sodales neque sodales ut etiam sit amet. Vestibulum rhoncus est pellentesque elit. Nisl tincidunt eget nullam non nisi est. Consequat interdum varius sit amet mattis vulputate enim nulla. Scelerisque viverra mauris in aliquam sem fringilla. Platea dictumst quisque sagittis purus sit amet volutpat consequat mauris. Pellentesque habitant morbi tristique senectus et netus et malesuada fames. Augue neque gravida in fermentum et. Proin libero nunc consequat interdum varius. Bibendum at varius vel pharetra vel turpis nunc eget lorem. + +Auctor urna nunc id cursus metus aliquam eleifend. Sed turpis tincidunt id aliquet. Amet nulla facilisi morbi tempus iaculis urna id. Amet tellus cras adipiscing enim eu. Eget gravida cum sociis natoque penatibus et magnis dis parturient. Nullam vehicula ipsum a arcu cursus vitae. Morbi quis commodo odio aenean sed adipiscing diam. Ornare quam viverra orci sagittis. Turpis egestas integer eget aliquet nibh. Aenean sed adipiscing diam donec adipiscing tristique risus nec. Dui vivamus arcu felis bibendum ut tristique. Sed cras ornare arcu dui vivamus arcu felis bibendum ut. Lacinia quis vel eros donec ac odio tempor orci dapibus. + +Leo vel fringilla est ullamcorper eget. Id ornare arcu odio ut sem nulla pharetra diam sit. Magna ac placerat vestibulum lectus mauris. Curabitur vitae nunc sed velit dignissim sodales ut eu. Amet venenatis urna cursus eget nunc. Est ante in nibh mauris cursus mattis. Velit laoreet id donec ultrices tincidunt arcu. Est ultricies integer quis auctor elit sed vulputate mi sit. Faucibus pulvinar elementum integer enim neque. Sollicitudin ac orci phasellus egestas tellus rutrum tellus. Tincidunt ornare massa eget egestas. In est ante in nibh mauris cursus. Dui nunc mattis enim ut tellus elementum sagittis. Mauris vitae ultricies leo integer malesuada nunc vel risus commodo. + +Ac tortor dignissim convallis aenean et tortor. Nisi est sit amet facilisis magna etiam tempor orci eu. Lorem donec massa sapien faucibus et molestie. Consequat mauris nunc congue nisi vitae. Dictum at tempor commodo ullamcorper a lacus. Ac turpis egestas sed tempus urna et pharetra pharetra. Tempus egestas sed sed risus pretium quam. Nisl rhoncus mattis rhoncus urna neque viverra justo nec. Fames ac turpis egestas maecenas pharetra convallis posuere morbi. Auctor augue mauris augue neque. Id interdum velit laoreet id donec ultrices tincidunt arcu non. Elementum curabitur vitae nunc sed velit. Ultrices eros in cursus turpis. Faucibus purus in massa tempor nec feugiat nisl pretium fusce. Eget nulla facilisi etiam dignissim diam quis enim. Vulputate odio ut enim blandit. Venenatis urna cursus eget nunc. + +Vestibulum morbi blandit cursus risus. Nunc sed blandit libero volutpat sed cras. Tempor commodo ullamcorper a lacus vestibulum. Id neque aliquam vestibulum morbi. In dictum non consectetur a erat nam at lectus urna. In metus vulputate eu scelerisque felis. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Vitae congue eu consequat ac felis donec et odio pellentesque. Tortor id aliquet lectus proin nibh nisl condimentum id venenatis. Amet venenatis urna cursus eget. Molestie nunc non blandit massa enim. Pellentesque dignissim enim sit amet venenatis urna cursus eget. + +Leo duis ut diam quam. Massa massa ultricies mi quis hendrerit. Sed risus pretium quam vulputate dignissim suspendisse. Tincidunt dui ut ornare lectus sit amet est placerat. Cursus in hac habitasse platea dictumst. Et molestie ac feugiat sed. Orci dapibus ultrices in iaculis nunc sed. Penatibus et magnis dis parturient montes. Enim nunc faucibus a pellentesque sit. Lobortis elementum nibh tellus molestie nunc non. Viverra maecenas accumsan lacus vel facilisis volutpat est velit egestas. Ridiculus mus mauris vitae ultricies. Eu mi bibendum neque egestas congue quisque. Interdum velit euismod in pellentesque massa placerat duis ultricies. Vitae congue mauris rhoncus aenean. Suspendisse ultrices gravida dictum fusce ut placerat orci. Enim ut sem viverra aliquet. Cras tincidunt lobortis feugiat vivamus at augue eget arcu. Semper auctor neque vitae tempus quam pellentesque nec nam. + +In iaculis nunc sed augue lacus viverra. Posuere ac ut consequat semper viverra. Placerat orci nulla pellentesque dignissim enim. Etiam non quam lacus suspendisse faucibus interdum. Sed libero enim sed faucibus turpis. Cursus risus at ultrices mi tempus imperdiet. Viverra nam libero justo laoreet sit amet cursus sit. Suspendisse sed nisi lacus sed viverra tellus in hac. Ut eu sem integer vitae justo. Euismod lacinia at quis risus sed vulputate. Vestibulum mattis ullamcorper velit sed ullamcorper morbi tincidunt. Lacus suspendisse faucibus interdum posuere. Egestas erat imperdiet sed euismod nisi porta lorem mollis. Mi bibendum neque egestas congue quisque egestas. + +Tincidunt tortor aliquam nulla facilisi cras fermentum odio eu feugiat. Nibh sit amet commodo nulla facilisi nullam vehicula ipsum a. Praesent tristique magna sit amet purus gravida quis blandit turpis. Dolor purus non enim praesent elementum. Urna nunc id cursus metus aliquam eleifend mi in. Cras adipiscing enim eu turpis egestas pretium aenean. Odio morbi quis commodo odio aenean sed adipiscing. Quis ipsum suspendisse ultrices gravida dictum. Lorem dolor sed viverra ipsum. Massa ultricies mi quis hendrerit dolor magna eget est. Dictumst vestibulum rhoncus est pellentesque. Quis hendrerit dolor magna eget. Arcu non sodales neque sodales ut etiam sit amet nisl. Augue lacus viverra vitae congue eu consequat ac felis donec. Blandit cursus risus at ultrices. + +Nec tincidunt praesent semper feugiat nibh sed pulvinar. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Porttitor leo a diam sollicitudin tempor id eu nisl. Ultrices dui sapien eget mi proin. Id aliquet risus feugiat in ante metus. Blandit massa enim nec dui nunc mattis. Habitant morbi tristique senectus et. Aliquam eleifend mi in nulla posuere. Et tortor at risus viverra adipiscing at. Laoreet sit amet cursus sit amet dictum sit amet justo. Adipiscing vitae proin sagittis nisl rhoncus mattis rhoncus. + +Id leo in vitae turpis massa sed elementum tempus. Mi ipsum faucibus vitae aliquet nec ullamcorper sit amet risus. Placerat in egestas erat imperdiet. Leo a diam sollicitudin tempor. Aliquam sem fringilla ut morbi tincidunt augue interdum velit. Augue eget arcu dictum varius duis. Tempus imperdiet nulla malesuada pellentesque elit eget. Viverra suspendisse potenti nullam ac tortor. Urna et pharetra pharetra massa. Sed id semper risus in hendrerit. Ullamcorper morbi tincidunt ornare massa eget egestas purus viverra. Feugiat nibh sed pulvinar proin gravida hendrerit lectus. Dui accumsan sit amet nulla facilisi morbi tempus iaculis. Phasellus vestibulum lorem sed risus ultricies tristique nulla. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Habitant morbi tristique senectus et. Duis tristique sollicitudin nibh sit amet. In arcu cursus euismod quis viverra nibh cras pulvinar. Cras sed felis eget velit aliquet sagittis. + +Consectetur lorem donec massa sapien. A arcu cursus vitae congue mauris. Ullamcorper sit amet risus nullam eget felis eget nunc lobortis. Cras sed felis eget velit. Nibh sit amet commodo nulla facilisi. Porttitor massa id neque aliquam vestibulum morbi blandit. Eget arcu dictum varius duis at consectetur lorem. Rhoncus dolor purus non enim. Rhoncus aenean vel elit scelerisque. Vel pretium lectus quam id leo in vitae turpis. Odio morbi quis commodo odio aenean sed. Sit amet commodo nulla facilisi nullam vehicula ipsum a. Orci ac auctor augue mauris augue neque gravida in fermentum. Mauris ultrices eros in cursus turpis massa tincidunt dui ut. Egestas fringilla phasellus faucibus scelerisque eleifend. Dolor sed viverra ipsum nunc aliquet. Feugiat in ante metus dictum at tempor commodo ullamcorper. Porta non pulvinar neque laoreet suspendisse interdum. Habitant morbi tristique senectus et. Pretium viverra suspendisse potenti nullam ac tortor. + +Risus in hendrerit gravida rutrum quisque non. Egestas diam in arcu cursus euismod quis viverra nibh. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim. Interdum posuere lorem ipsum dolor sit amet consectetur adipiscing elit. Vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt. Quis risus sed vulputate odio ut enim. Neque laoreet suspendisse interdum consectetur libero id faucibus nisl. Fringilla phasellus faucibus scelerisque eleifend. Accumsan sit amet nulla facilisi morbi tempus iaculis urna id. Amet aliquam id diam maecenas ultricies mi eget mauris pharetra. Faucibus pulvinar elementum integer enim neque volutpat ac tincidunt vitae. Ac placerat vestibulum lectus mauris ultrices eros in. + +Convallis posuere morbi leo urna. Mattis pellentesque id nibh tortor id aliquet lectus. Aliquam ultrices sagittis orci a scelerisque purus semper eget. In hendrerit gravida rutrum quisque non. Nascetur ridiculus mus mauris vitae ultricies leo integer. Augue interdum velit euismod in pellentesque massa placerat duis. Suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada bibendum. Sed risus ultricies tristique nulla. Tortor at auctor urna nunc id cursus. Ac turpis egestas maecenas pharetra. Sollicitudin tempor id eu nisl nunc mi. Massa massa ultricies mi quis hendrerit dolor magna eget. Amet est placerat in egestas erat imperdiet sed. Sed cras ornare arcu dui. Quisque non tellus orci ac auctor augue mauris augue. Placerat in egestas erat imperdiet sed euismod nisi porta. Blandit libero volutpat sed cras ornare arcu dui. Sapien eget mi proin sed libero enim sed faucibus turpis. Id consectetur purus ut faucibus pulvinar elementum integer enim. + +Nibh mauris cursus mattis molestie. Euismod lacinia at quis risus sed vulputate odio ut. Etiam non quam lacus suspendisse faucibus. Justo eget magna fermentum iaculis eu. Volutpat diam ut venenatis tellus in metus vulputate eu scelerisque. Adipiscing elit pellentesque habitant morbi tristique senectus. Ullamcorper dignissim cras tincidunt lobortis. Et egestas quis ipsum suspendisse ultrices. Urna id volutpat lacus laoreet non curabitur gravida arcu ac. Sed turpis tincidunt id aliquet risus feugiat in. Turpis cursus in hac habitasse platea dictumst. Pretium lectus quam id leo in vitae turpis. Tempus quam pellentesque nec nam aliquam sem et tortor consequat. Sed tempus urna et pharetra. Feugiat in fermentum posuere urna nec tincidunt praesent. Pharetra pharetra massa massa ultricies mi quis. Tellus mauris a diam maecenas sed enim ut sem viverra. + +Velit sed ullamcorper morbi tincidunt. Volutpat commodo sed egestas egestas. Est placerat in egestas erat imperdiet sed euismod. Quis risus sed vulputate odio ut enim blandit volutpat. Viverra vitae congue eu consequat ac felis donec. Egestas sed tempus urna et pharetra. Ornare arcu odio ut sem nulla. Ullamcorper a lacus vestibulum sed arcu non odio. Sit amet nisl suscipit adipiscing bibendum est ultricies integer. Nunc id cursus metus aliquam eleifend mi in. Molestie ac feugiat sed lectus. Laoreet sit amet cursus sit amet. + +Nisi porta lorem mollis aliquam ut porttitor leo a diam. Lacinia quis vel eros donec ac odio tempor orci dapibus. Nam at lectus urna duis convallis convallis tellus. Morbi quis commodo odio aenean sed adipiscing diam donec adipiscing. Arcu non sodales neque sodales ut etiam sit. Elit at imperdiet dui accumsan sit amet. Ut etiam sit amet nisl purus in mollis nunc sed. Suspendisse sed nisi lacus sed viverra tellus. Id venenatis a condimentum vitae sapien pellentesque habitant. Quisque non tellus orci ac auctor augue mauris. Turpis tincidunt id aliquet risus feugiat in ante metus. Elementum curabitur vitae nunc sed velit dignissim sodales. Sit amet massa vitae tortor condimentum. Augue interdum velit euismod in pellentesque massa placerat duis ultricies. Eu lobortis elementum nibh tellus molestie nunc non blandit. Tristique senectus et netus et malesuada. Praesent elementum facilisis leo vel. + +Ultrices dui sapien eget mi proin sed libero enim. Morbi tristique senectus et netus. Odio tempor orci dapibus ultrices in iaculis nunc. Odio morbi quis commodo odio. Erat nam at lectus urna. Senectus et netus et malesuada fames ac turpis egestas. Eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada bibendum. Commodo quis imperdiet massa tincidunt nunc pulvinar sapien et. Faucibus pulvinar elementum integer enim neque. Augue eget arcu dictum varius duis at consectetur lorem donec. Sit amet dictum sit amet justo donec. Adipiscing enim eu turpis egestas pretium aenean pharetra. Nisl suscipit adipiscing bibendum est ultricies integer quis auctor. At in tellus integer feugiat scelerisque varius morbi enim. Tristique senectus et netus et malesuada fames ac turpis egestas. + +Diam sollicitudin tempor id eu nisl nunc. Amet volutpat consequat mauris nunc congue nisi vitae suscipit tellus. Justo eget magna fermentum iaculis eu non. Interdum consectetur libero id faucibus nisl tincidunt eget nullam non. Feugiat in ante metus dictum. Cursus euismod quis viverra nibh cras pulvinar mattis nunc sed. Vitae nunc sed velit dignissim. Et netus et malesuada fames ac turpis. Nibh tortor id aliquet lectus proin nibh nisl condimentum. Habitasse platea dictumst vestibulum rhoncus est pellentesque. Eget nulla facilisi etiam dignissim diam quis. Tellus id interdum velit laoreet id donec ultrices tincidunt. Lacus vel facilisis volutpat est velit. Risus viverra adipiscing at in tellus integer feugiat scelerisque varius. Placerat vestibulum lectus mauris ultrices eros in cursus. Vitae semper quis lectus nulla at volutpat diam. Mattis aliquam faucibus purus in massa tempor. + +Suscipit adipiscing bibendum est ultricies integer quis auctor elit. Viverra mauris in aliquam sem. Ultricies lacus sed turpis tincidunt id aliquet. Convallis a cras semper auctor neque vitae tempus. Nam libero justo laoreet sit amet cursus sit amet dictum. Integer malesuada nunc vel risus commodo viverra maecenas accumsan. Faucibus in ornare quam viverra orci. Porttitor eget dolor morbi non arcu risus quis varius quam. In nibh mauris cursus mattis. Nulla posuere sollicitudin aliquam ultrices sagittis orci. Lorem dolor sed viverra ipsum nunc aliquet bibendum. Iaculis nunc sed augue lacus viverra vitae congue eu. Volutpat diam ut venenatis tellus in metus vulputate. + +Leo vel fringilla est ullamcorper eget nulla. Elit scelerisque mauris pellentesque pulvinar pellentesque. Adipiscing elit pellentesque habitant morbi tristique. Vitae aliquet nec ullamcorper sit amet risus nullam. Mauris commodo quis imperdiet massa tincidunt nunc pulvinar sapien. Fermentum posuere urna nec tincidunt praesent semper feugiat nibh. Quam id leo in vitae turpis massa. Neque gravida in fermentum et. Turpis egestas maecenas pharetra convallis posuere morbi leo. A pellentesque sit amet porttitor eget. Pharetra convallis posuere morbi leo urna molestie at. Viverra ipsum nunc aliquet bibendum. Lobortis mattis aliquam faucibus purus in massa. Mattis molestie a iaculis at erat pellentesque adipiscing commodo elit. Tincidunt eget nullam non nisi. Elementum facilisis leo vel fringilla est ullamcorper eget nulla facilisi. Massa ultricies mi quis hendrerit dolor. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo nec. + +Erat imperdiet sed euismod nisi porta lorem mollis. Ultricies mi quis hendrerit dolor magna eget est. Mauris a diam maecenas sed enim ut sem viverra aliquet. Ornare suspendisse sed nisi lacus sed viverra. Mi ipsum faucibus vitae aliquet. Accumsan sit amet nulla facilisi. Proin fermentum leo vel orci porta. Enim eu turpis egestas pretium aenean pharetra magna ac placerat. Eros in cursus turpis massa tincidunt dui. Metus aliquam eleifend mi in nulla posuere sollicitudin. Tellus rutrum tellus pellentesque eu. Id velit ut tortor pretium viverra suspendisse potenti nullam. Hendrerit gravida rutrum quisque non tellus orci. + +Mi tempus imperdiet nulla malesuada pellentesque elit eget gravida cum. Pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Odio eu feugiat pretium nibh ipsum consequat. Enim sed faucibus turpis in. Orci dapibus ultrices in iaculis nunc sed augue lacus. Ultrices dui sapien eget mi proin sed libero enim. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Est ante in nibh mauris cursus mattis molestie. Dui accumsan sit amet nulla. Aenean sed adipiscing diam donec adipiscing tristique. Sed vulputate odio ut enim blandit volutpat maecenas volutpat blandit. Tincidunt eget nullam non nisi est sit. Consequat nisl vel pretium lectus quam id. Amet risus nullam eget felis eget nunc lobortis mattis aliquam. Habitasse platea dictumst vestibulum rhoncus est pellentesque elit. In iaculis nunc sed augue lacus viverra vitae congue. Aenean pharetra magna ac placerat. Nisi quis eleifend quam adipiscing vitae proin sagittis. Semper risus in hendrerit gravida rutrum quisque non tellus. + +Vitae justo eget magna fermentum iaculis eu. Eu tincidunt tortor aliquam nulla facilisi cras. Elit duis tristique sollicitudin nibh sit amet commodo nulla. Interdum posuere lorem ipsum dolor sit. Nunc consequat interdum varius sit amet mattis. Rhoncus aenean vel elit scelerisque. Elit sed vulputate mi sit amet mauris commodo quis imperdiet. Eget dolor morbi non arcu risus quis varius quam. Quis varius quam quisque id diam vel quam. A condimentum vitae sapien pellentesque habitant. Arcu cursus euismod quis viverra nibh cras pulvinar mattis. Lacus sed turpis tincidunt id aliquet risus feugiat. Lectus nulla at volutpat diam ut venenatis tellus in metus. Lobortis mattis aliquam faucibus purus in massa tempor nec. + +Amet luctus venenatis lectus magna fringilla urna porttitor rhoncus. Neque sodales ut etiam sit amet nisl purus in. Proin sagittis nisl rhoncus mattis rhoncus urna. Egestas sed sed risus pretium quam. In nibh mauris cursus mattis molestie a. Euismod nisi porta lorem mollis aliquam. Elementum eu facilisis sed odio morbi quis commodo odio aenean. Non blandit massa enim nec dui nunc mattis enim ut. Amet tellus cras adipiscing enim. Mattis aliquam faucibus purus in massa. Nulla facilisi etiam dignissim diam quis enim lobortis scelerisque fermentum. Blandit turpis cursus in hac. Pretium lectus quam id leo in vitae turpis massa sed. Id interdum velit laoreet id donec. Nisi vitae suscipit tellus mauris a diam maecenas sed enim. Et sollicitudin ac orci phasellus egestas tellus. Placerat vestibulum lectus mauris ultrices eros in cursus turpis. Auctor augue mauris augue neque. + +Nam libero justo laoreet sit. Iaculis at erat pellentesque adipiscing commodo elit at imperdiet dui. Id donec ultrices tincidunt arcu non sodales neque sodales. Id aliquet risus feugiat in ante metus dictum. Feugiat in ante metus dictum at tempor commodo. Sed adipiscing diam donec adipiscing tristique risus nec feugiat. Pellentesque nec nam aliquam sem. Blandit massa enim nec dui nunc mattis enim. Vulputate ut pharetra sit amet aliquam. Vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras. Odio euismod lacinia at quis risus sed vulputate odio. Tincidunt dui ut ornare lectus. Risus nullam eget felis eget nunc lobortis. Sem integer vitae justo eget magna fermentum iaculis eu. Ac turpis egestas integer eget aliquet nibh praesent tristique magna. Sed elementum tempus egestas sed sed risus. + +Nulla facilisi etiam dignissim diam quis enim lobortis scelerisque. Consequat id porta nibh venenatis cras sed felis eget. Mattis rhoncus urna neque viverra. Eget magna fermentum iaculis eu. Erat velit scelerisque in dictum. Amet consectetur adipiscing elit pellentesque habitant morbi tristique senectus. Eu feugiat pretium nibh ipsum consequat nisl vel pretium. Quam quisque id diam vel quam elementum pulvinar etiam. Aliquet risus feugiat in ante metus dictum at tempor commodo. Ullamcorper velit sed ullamcorper morbi tincidunt ornare massa eget egestas. Eu turpis egestas pretium aenean pharetra magna. + +Lectus quam id leo in vitae turpis massa sed elementum. Vestibulum mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare. Porttitor leo a diam sollicitudin tempor id eu. Bibendum ut tristique et egestas quis. Laoreet non curabitur gravida arcu ac tortor dignissim. Vel risus commodo viverra maecenas. Sollicitudin aliquam ultrices sagittis orci a scelerisque purus semper eget. Cursus metus aliquam eleifend mi. Sit amet facilisis magna etiam tempor orci eu. Viverra tellus in hac habitasse platea dictumst vestibulum rhoncus est. Id semper risus in hendrerit gravida rutrum quisque non. Viverra ipsum nunc aliquet bibendum enim facilisis gravida neque convallis. Odio aenean sed adipiscing diam donec adipiscing. Vitae suscipit tellus mauris a diam maecenas sed enim ut. Vestibulum morbi blandit cursus risus at ultrices. Tortor at auctor urna nunc id cursus metus aliquam. Tellus orci ac auctor augue mauris augue neque. + +Suspendisse in est ante in nibh mauris cursus. Elit ut aliquam purus sit. Quis eleifend quam adipiscing vitae proin sagittis. Id consectetur purus ut faucibus pulvinar elementum. Et ligula ullamcorper malesuada proin libero nunc consequat. Tortor posuere ac ut consequat. Consectetur libero id faucibus nisl tincidunt eget nullam. Adipiscing at in tellus integer feugiat scelerisque varius morbi. Eu ultrices vitae auctor eu augue ut. In est ante in nibh mauris cursus mattis molestie a. + +Pellentesque habitant morbi tristique senectus. Id donec ultrices tincidunt arcu non. Fames ac turpis egestas maecenas pharetra convallis posuere. Vitae suscipit tellus mauris a diam maecenas sed. Cursus metus aliquam eleifend mi in nulla posuere sollicitudin aliquam. Volutpat odio facilisis mauris sit amet massa vitae. Condimentum vitae sapien pellentesque habitant morbi tristique senectus et netus. Nulla facilisi morbi tempus iaculis urna id volutpat. Lorem ipsum dolor sit amet consectetur adipiscing elit ut aliquam. Imperdiet proin fermentum leo vel orci porta. Odio euismod lacinia at quis risus sed vulputate. Vulputate ut pharetra sit amet aliquam id diam maecenas. Vulputate sapien nec sagittis aliquam malesuada bibendum arcu. Et malesuada fames ac turpis. Tellus pellentesque eu tincidunt tortor aliquam. Varius vel pharetra vel turpis nunc eget lorem. Porttitor lacus luctus accumsan tortor posuere ac ut consequat semper. Ipsum nunc aliquet bibendum enim. + +Amet consectetur adipiscing elit ut aliquam purus. Nibh ipsum consequat nisl vel pretium lectus quam id. Egestas dui id ornare arcu odio ut. Ornare arcu dui vivamus arcu felis bibendum ut tristique. Est lorem ipsum dolor sit amet consectetur. Molestie nunc non blandit massa. Semper feugiat nibh sed pulvinar. Tellus id interdum velit laoreet id. Sed augue lacus viverra vitae congue eu consequat ac felis. Dolor sit amet consectetur adipiscing. Amet risus nullam eget felis eget nunc lobortis mattis aliquam. Sed lectus vestibulum mattis ullamcorper velit sed. Cursus sit amet dictum sit. Elementum tempus egestas sed sed risus pretium quam. Turpis tincidunt id aliquet risus feugiat in ante metus dictum. + +Sed pulvinar proin gravida hendrerit lectus. Augue interdum velit euismod in pellentesque massa placerat. Nisl purus in mollis nunc sed id semper risus in. Adipiscing bibendum est ultricies integer quis auctor elit. Et netus et malesuada fames ac turpis egestas. A condimentum vitae sapien pellentesque. Donec ac odio tempor orci dapibus ultrices in. Dui faucibus in ornare quam. Euismod in pellentesque massa placerat duis ultricies lacus sed turpis. Arcu cursus euismod quis viverra nibh cras pulvinar mattis nunc. Vitae congue eu consequat ac felis. Dui ut ornare lectus sit amet. Amet consectetur adipiscing elit duis tristique sollicitudin nibh sit amet. Morbi tristique senectus et netus et malesuada fames ac. Vitae purus faucibus ornare suspendisse sed nisi lacus sed. + +Lectus vestibulum mattis ullamcorper velit sed ullamcorper morbi. Nullam non nisi est sit amet facilisis magna etiam tempor. Nullam eget felis eget nunc lobortis mattis aliquam. Malesuada nunc vel risus commodo. Ac tortor dignissim convallis aenean et tortor at. Volutpat consequat mauris nunc congue nisi vitae suscipit tellus. Leo vel orci porta non pulvinar. Tempus imperdiet nulla malesuada pellentesque. Ultrices sagittis orci a scelerisque purus semper. Posuere lorem ipsum dolor sit amet consectetur adipiscing. Velit sed ullamcorper morbi tincidunt ornare massa eget egestas purus. Orci phasellus egestas tellus rutrum tellus pellentesque eu. Varius sit amet mattis vulputate enim nulla aliquet porttitor lacus. + +Nec dui nunc mattis enim ut tellus elementum sagittis. Eget felis eget nunc lobortis mattis aliquam. Auctor eu augue ut lectus arcu bibendum at. Urna duis convallis convallis tellus id interdum velit. Nibh sit amet commodo nulla. Adipiscing vitae proin sagittis nisl rhoncus mattis rhoncus urna. Amet est placerat in egestas erat imperdiet sed euismod nisi. Quam viverra orci sagittis eu volutpat odio facilisis mauris sit. Aliquam sem et tortor consequat id porta. Egestas sed sed risus pretium quam. Auctor neque vitae tempus quam pellentesque nec nam aliquam. Diam donec adipiscing tristique risus nec feugiat in fermentum posuere. Quam elementum pulvinar etiam non quam. + +Sit amet porttitor eget dolor morbi non arcu. Libero enim sed faucibus turpis in. Congue mauris rhoncus aenean vel. Orci nulla pellentesque dignissim enim sit amet. Vitae congue eu consequat ac felis. Sed blandit libero volutpat sed cras ornare arcu. Volutpat commodo sed egestas egestas. Massa sapien faucibus et molestie. Interdum varius sit amet mattis vulputate enim. Porta lorem mollis aliquam ut porttitor leo a diam. Curabitur vitae nunc sed velit dignissim sodales ut. Massa vitae tortor condimentum lacinia quis vel eros donec ac. Ac ut consequat semper viverra nam libero justo laoreet sit. + +Donec et odio pellentesque diam volutpat commodo sed egestas egestas. Viverra tellus in hac habitasse. Diam sit amet nisl suscipit adipiscing bibendum. At augue eget arcu dictum varius duis at. Hendrerit dolor magna eget est lorem ipsum. At tempor commodo ullamcorper a lacus vestibulum sed arcu. Vulputate odio ut enim blandit volutpat maecenas. Cras semper auctor neque vitae. Felis eget nunc lobortis mattis aliquam faucibus purus. Urna porttitor rhoncus dolor purus non enim. Nunc eget lorem dolor sed viverra ipsum nunc aliquet. Morbi tincidunt augue interdum velit euismod in pellentesque massa placerat. Adipiscing elit duis tristique sollicitudin nibh sit amet commodo. Malesuada fames ac turpis egestas maecenas pharetra convallis. Nec nam aliquam sem et tortor consequat id porta nibh. + +Malesuada bibendum arcu vitae elementum curabitur vitae. Mauris cursus mattis molestie a iaculis at. Tortor at auctor urna nunc id. Amet luctus venenatis lectus magna fringilla urna porttitor. In hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Eleifend donec pretium vulputate sapien nec sagittis aliquam. Mus mauris vitae ultricies leo integer malesuada nunc vel. Nec feugiat in fermentum posuere urna. Morbi tristique senectus et netus et malesuada. Ornare suspendisse sed nisi lacus sed viverra tellus. Viverra orci sagittis eu volutpat odio facilisis. Quam adipiscing vitae proin sagittis nisl. Nisi porta lorem mollis aliquam ut. Gravida in fermentum et sollicitudin ac orci phasellus egestas tellus. Pulvinar elementum integer enim neque volutpat ac tincidunt vitae. Sit amet purus gravida quis blandit. Semper quis lectus nulla at volutpat. Sit amet nisl purus in mollis. Magna eget est lorem ipsum dolor sit amet consectetur. + +Nec feugiat nisl pretium fusce id velit ut tortor. Arcu bibendum at varius vel pharetra vel turpis nunc. Ullamcorper a lacus vestibulum sed arcu non odio euismod lacinia. Lacus sed turpis tincidunt id. Nec dui nunc mattis enim ut. Faucibus pulvinar elementum integer enim neque volutpat ac tincidunt. Adipiscing bibendum est ultricies integer quis auctor. Quam vulputate dignissim suspendisse in. Morbi tristique senectus et netus et malesuada fames. Dictum non consectetur a erat nam at lectus urna duis. + +Vitae sapien pellentesque habitant morbi tristique senectus et netus. Ligula ullamcorper malesuada proin libero nunc consequat interdum varius sit. Cursus turpis massa tincidunt dui ut. Pellentesque habitant morbi tristique senectus et netus. Duis convallis convallis tellus id interdum. Platea dictumst quisque sagittis purus sit amet volutpat consequat. Quis auctor elit sed vulputate. Ipsum consequat nisl vel pretium lectus quam id. Sit amet purus gravida quis. Non pulvinar neque laoreet suspendisse. Sollicitudin aliquam ultrices sagittis orci. Accumsan lacus vel facilisis volutpat est. + +Donec ac odio tempor orci dapibus ultrices. Diam quam nulla porttitor massa id neque aliquam vestibulum. In egestas erat imperdiet sed euismod. Accumsan lacus vel facilisis volutpat. Enim diam vulputate ut pharetra sit. Vitae et leo duis ut diam. Tellus id interdum velit laoreet id donec ultrices tincidunt arcu. Tortor dignissim convallis aenean et tortor at risus viverra. A pellentesque sit amet porttitor eget dolor morbi. Sed cras ornare arcu dui vivamus arcu felis bibendum. Egestas diam in arcu cursus. Risus ultricies tristique nulla aliquet enim tortor at auctor urna. Non nisi est sit amet facilisis magna. + +Nulla posuere sollicitudin aliquam ultrices sagittis. Faucibus turpis in eu mi. Vestibulum morbi blandit cursus risus at ultrices mi. Vitae tempus quam pellentesque nec nam aliquam sem. Consectetur adipiscing elit ut aliquam. Senectus et netus et malesuada fames ac turpis egestas. Amet justo donec enim diam vulputate ut pharetra sit amet. Viverra adipiscing at in tellus integer feugiat scelerisque varius morbi. Amet porttitor eget dolor morbi non arcu risus quis. Massa enim nec dui nunc mattis enim ut tellus. Enim neque volutpat ac tincidunt vitae semper quis lectus nulla. Pharetra pharetra massa massa ultricies mi. Molestie a iaculis at erat pellentesque adipiscing commodo. Id volutpat lacus laoreet non curabitur gravida arcu ac. Placerat in egestas erat imperdiet sed euismod nisi porta. + +Mauris cursus mattis molestie a iaculis at erat pellentesque. Quis enim lobortis scelerisque fermentum. Mattis enim ut tellus elementum sagittis vitae. Lorem donec massa sapien faucibus et. Molestie ac feugiat sed lectus vestibulum mattis ullamcorper. Morbi blandit cursus risus at ultrices mi tempus. Diam vel quam elementum pulvinar etiam non quam lacus suspendisse. Sagittis id consectetur purus ut faucibus pulvinar elementum. Ut enim blandit volutpat maecenas volutpat blandit aliquam. Arcu bibendum at varius vel pharetra vel turpis nunc. Sapien eget mi proin sed libero enim sed faucibus turpis. Laoreet id donec ultrices tincidunt. Dui ut ornare lectus sit amet est placerat. Fusce ut placerat orci nulla pellentesque dignissim. Ac orci phasellus egestas tellus. + +Eu scelerisque felis imperdiet proin fermentum. Aliquam nulla facilisi cras fermentum odio eu. Ut diam quam nulla porttitor massa id neque aliquam vestibulum. Faucibus purus in massa tempor nec feugiat nisl pretium. Aliquam eleifend mi in nulla posuere sollicitudin aliquam ultrices. Gravida neque convallis a cras semper auctor neque vitae tempus. Lobortis feugiat vivamus at augue eget. Viverra tellus in hac habitasse platea dictumst. Faucibus in ornare quam viverra orci. Integer malesuada nunc vel risus commodo viverra maecenas accumsan. Imperdiet sed euismod nisi porta lorem mollis. Risus pretium quam vulputate dignissim suspendisse in. Dui id ornare arcu odio ut sem nulla. Elementum curabitur vitae nunc sed velit dignissim sodales. Nunc non blandit massa enim. + +Egestas integer eget aliquet nibh praesent. Sed vulputate odio ut enim. Eget mauris pharetra et ultrices neque ornare aenean euismod elementum. Libero nunc consequat interdum varius sit amet mattis vulputate enim. Bibendum neque egestas congue quisque egestas diam in arcu. Quis enim lobortis scelerisque fermentum. Feugiat pretium nibh ipsum consequat nisl vel. Tortor at risus viverra adipiscing at in. Consectetur a erat nam at lectus urna duis convallis convallis. Erat pellentesque adipiscing commodo elit at imperdiet. Luctus venenatis lectus magna fringilla urna. Convallis a cras semper auctor neque vitae. Eget lorem dolor sed viverra ipsum. Placerat duis ultricies lacus sed turpis tincidunt id aliquet. Consectetur adipiscing elit pellentesque habitant morbi tristique senectus. Pretium lectus quam id leo in vitae turpis massa. Nunc mi ipsum faucibus vitae aliquet nec ullamcorper sit amet. + +Bibendum enim facilisis gravida neque. At varius vel pharetra vel turpis nunc. Amet commodo nulla facilisi nullam vehicula ipsum. Ultricies integer quis auctor elit sed vulputate mi sit. Turpis egestas maecenas pharetra convallis posuere morbi leo urna molestie. Mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare. Tristique risus nec feugiat in. Arcu risus quis varius quam quisque. Sit amet risus nullam eget felis eget. In hendrerit gravida rutrum quisque non tellus. Ut etiam sit amet nisl purus. Imperdiet dui accumsan sit amet nulla facilisi morbi tempus iaculis. Senectus et netus et malesuada fames ac turpis egestas integer. Quam id leo in vitae turpis massa. Mattis vulputate enim nulla aliquet. Blandit aliquam etiam erat velit scelerisque in dictum non consectetur. + +Vulputate odio ut enim blandit volutpat maecenas. Quis risus sed vulputate odio. Faucibus ornare suspendisse sed nisi lacus sed viverra tellus in. Ac tincidunt vitae semper quis lectus nulla at volutpat diam. Nunc non blandit massa enim. Laoreet id donec ultrices tincidunt arcu non sodales neque sodales. Est sit amet facilisis magna etiam tempor. Sed libero enim sed faucibus. Nisl purus in mollis nunc sed id semper risus in. Ipsum dolor sit amet consectetur adipiscing elit duis tristique. Egestas dui id ornare arcu odio ut sem nulla. Diam volutpat commodo sed egestas egestas fringilla phasellus faucibus. Aliquam etiam erat velit scelerisque in dictum. + +Fames ac turpis egestas integer eget aliquet. In nisl nisi scelerisque eu. Non sodales neque sodales ut etiam sit amet. Fringilla urna porttitor rhoncus dolor. Nec dui nunc mattis enim ut tellus elementum sagittis vitae. Fermentum iaculis eu non diam. Eget nunc scelerisque viverra mauris in aliquam sem. Pharetra vel turpis nunc eget lorem dolor. Quis enim lobortis scelerisque fermentum dui faucibus in ornare. Ut porttitor leo a diam sollicitudin tempor. Blandit libero volutpat sed cras ornare arcu dui vivamus. + +Orci eu lobortis elementum nibh tellus molestie nunc non blandit. Eros donec ac odio tempor orci dapibus ultrices. Nam at lectus urna duis convallis convallis tellus. Vulputate eu scelerisque felis imperdiet proin fermentum leo vel. Quam lacus suspendisse faucibus interdum posuere lorem ipsum. Eget est lorem ipsum dolor sit amet. Libero volutpat sed cras ornare arcu dui vivamus. Risus commodo viverra maecenas accumsan lacus. Est placerat in egestas erat imperdiet sed euismod. Ridiculus mus mauris vitae ultricies leo. Risus nec feugiat in fermentum posuere urna. Nulla aliquet enim tortor at auctor urna nunc id. Massa ultricies mi quis hendrerit dolor magna eget est. Eget gravida cum sociis natoque penatibus et magnis dis. Malesuada pellentesque elit eget gravida cum. Tristique et egestas quis ipsum. Maecenas ultricies mi eget mauris pharetra. Amet risus nullam eget felis eget. + +Scelerisque varius morbi enim nunc faucibus a pellentesque sit. Posuere ac ut consequat semper viverra. Viverra tellus in hac habitasse platea dictumst vestibulum. Gravida cum sociis natoque penatibus et. Egestas egestas fringilla phasellus faucibus scelerisque eleifend donec pretium vulputate. Fames ac turpis egestas sed tempus urna. Sagittis eu volutpat odio facilisis mauris sit amet massa. Malesuada bibendum arcu vitae elementum curabitur vitae nunc sed velit. Commodo nulla facilisi nullam vehicula ipsum a arcu. Sed ullamcorper morbi tincidunt ornare massa eget. Vitae sapien pellentesque habitant morbi. Morbi quis commodo odio aenean. Enim facilisis gravida neque convallis a cras semper auctor neque. Scelerisque felis imperdiet proin fermentum leo vel orci porta. + +Dui faucibus in ornare quam viverra orci sagittis eu volutpat. Sapien nec sagittis aliquam malesuada bibendum arcu. Nibh tortor id aliquet lectus proin nibh. Maecenas accumsan lacus vel facilisis volutpat est velit egestas dui. Pellentesque elit eget gravida cum sociis natoque penatibus et magnis. Sed euismod nisi porta lorem mollis aliquam ut. Velit euismod in pellentesque massa placerat duis. Sapien eget mi proin sed. In tellus integer feugiat scelerisque varius. Rutrum quisque non tellus orci. Mattis rhoncus urna neque viverra justo nec ultrices dui sapien. Diam in arcu cursus euismod quis viverra. + +Bibendum enim facilisis gravida neque convallis a cras semper auctor. Massa id neque aliquam vestibulum morbi blandit. Justo eget magna fermentum iaculis eu non diam phasellus vestibulum. Imperdiet sed euismod nisi porta lorem mollis aliquam ut. Vestibulum lectus mauris ultrices eros in cursus turpis. Magna fermentum iaculis eu non. Viverra tellus in hac habitasse platea dictumst. Maecenas sed enim ut sem. Ut enim blandit volutpat maecenas. Tempor orci dapibus ultrices in iaculis nunc sed. Mus mauris vitae ultricies leo integer malesuada nunc. Massa sapien faucibus et molestie ac feugiat sed. Mattis vulputate enim nulla aliquet porttitor lacus luctus. Dolor sit amet consectetur adipiscing. Fusce id velit ut tortor. + +Leo duis ut diam quam nulla. A lacus vestibulum sed arcu non odio euismod lacinia at. Velit egestas dui id ornare arcu odio. Faucibus et molestie ac feugiat sed lectus vestibulum mattis ullamcorper. Nulla aliquet porttitor lacus luctus accumsan tortor posuere ac. Cursus mattis molestie a iaculis at erat. Enim blandit volutpat maecenas volutpat blandit. Nisl nunc mi ipsum faucibus vitae. Consectetur a erat nam at lectus urna duis. Luctus venenatis lectus magna fringilla urna porttitor rhoncus dolor. Quam elementum pulvinar etiam non. Imperdiet proin fermentum leo vel orci. Sagittis orci a scelerisque purus semper. In metus vulputate eu scelerisque felis imperdiet proin fermentum. + +Volutpat diam ut venenatis tellus in. Sollicitudin nibh sit amet commodo nulla facilisi. Faucibus pulvinar elementum integer enim neque volutpat ac tincidunt vitae. Penatibus et magnis dis parturient montes nascetur ridiculus. Cras pulvinar mattis nunc sed. Justo donec enim diam vulputate ut. Tellus molestie nunc non blandit massa. Ut consequat semper viverra nam libero justo laoreet sit amet. Elementum tempus egestas sed sed risus pretium quam vulputate. Vulputate eu scelerisque felis imperdiet proin. Morbi tristique senectus et netus et. Gravida in fermentum et sollicitudin ac orci phasellus egestas tellus. Porttitor leo a diam sollicitudin. Ac tortor vitae purus faucibus ornare. Volutpat sed cras ornare arcu dui vivamus. Dictumst quisque sagittis purus sit. + +Risus nullam eget felis eget nunc lobortis mattis aliquam faucibus. Sed blandit libero volutpat sed cras. Cras adipiscing enim eu turpis egestas pretium. Nisl suscipit adipiscing bibendum est ultricies integer. Eu nisl nunc mi ipsum faucibus vitae aliquet. Turpis tincidunt id aliquet risus feugiat in ante metus. Adipiscing at in tellus integer feugiat. In pellentesque massa placerat duis ultricies lacus sed. Congue mauris rhoncus aenean vel elit scelerisque mauris pellentesque pulvinar. In aliquam sem fringilla ut. Vel orci porta non pulvinar neque laoreet. Est velit egestas dui id. Montes nascetur ridiculus mus mauris vitae ultricies leo integer malesuada. + +Donec pretium vulputate sapien nec sagittis aliquam malesuada. Orci sagittis eu volutpat odio facilisis mauris sit amet massa. Egestas dui id ornare arcu odio ut. At augue eget arcu dictum varius duis at. Suspendisse faucibus interdum posuere lorem. Id consectetur purus ut faucibus pulvinar elementum integer enim. Morbi enim nunc faucibus a. Risus nec feugiat in fermentum posuere. Ullamcorper morbi tincidunt ornare massa eget egestas purus viverra accumsan. Neque ornare aenean euismod elementum nisi. Metus vulputate eu scelerisque felis imperdiet proin fermentum. A erat nam at lectus urna. Feugiat scelerisque varius morbi enim. Iaculis urna id volutpat lacus laoreet non curabitur gravida arcu. Senectus et netus et malesuada fames ac turpis egestas. Diam sollicitudin tempor id eu nisl nunc mi. + +Risus pretium quam vulputate dignissim. Egestas tellus rutrum tellus pellentesque eu tincidunt tortor aliquam nulla. Tempus urna et pharetra pharetra massa. Eleifend donec pretium vulputate sapien nec sagittis. Venenatis urna cursus eget nunc scelerisque viverra mauris. Ullamcorper dignissim cras tincidunt lobortis feugiat vivamus at. Nibh sit amet commodo nulla facilisi nullam. Dui accumsan sit amet nulla. Sed cras ornare arcu dui vivamus arcu. Amet luctus venenatis lectus magna fringilla urna porttitor rhoncus dolor. Massa id neque aliquam vestibulum. Erat imperdiet sed euismod nisi porta lorem. Ut lectus arcu bibendum at varius vel pharetra. Nunc consequat interdum varius sit amet mattis vulputate enim. Lorem donec massa sapien faucibus et molestie ac feugiat sed. Tincidunt nunc pulvinar sapien et ligula. Aliquam faucibus purus in massa tempor. Arcu dictum varius duis at consectetur lorem donec massa sapien. Sed arcu non odio euismod lacinia at quis risus. Elementum tempus egestas sed sed risus pretium quam vulputate dignissim. + +Eu feugiat pretium nibh ipsum consequat. Urna duis convallis convallis tellus id. Tristique et egestas quis ipsum suspendisse ultrices gravida dictum. Eget nunc scelerisque viverra mauris in. Commodo quis imperdiet massa tincidunt nunc pulvinar sapien et. Facilisis sed odio morbi quis commodo odio. Vel quam elementum pulvinar etiam non quam lacus suspendisse. Consectetur adipiscing elit ut aliquam purus sit amet luctus. Arcu cursus vitae congue mauris rhoncus aenean. Aliquam ultrices sagittis orci a scelerisque purus. Commodo viverra maecenas accumsan lacus vel facilisis. Malesuada nunc vel risus commodo viverra maecenas accumsan lacus. Sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum. Mi ipsum faucibus vitae aliquet nec ullamcorper sit amet risus. + +Quis risus sed vulputate odio. Non pulvinar neque laoreet suspendisse interdum consectetur libero id faucibus. Imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper. Fringilla ut morbi tincidunt augue interdum. Morbi tristique senectus et netus et. Adipiscing at in tellus integer feugiat scelerisque. Metus aliquam eleifend mi in nulla posuere sollicitudin. Feugiat pretium nibh ipsum consequat nisl vel pretium lectus. Tortor at auctor urna nunc id cursus metus. At ultrices mi tempus imperdiet nulla. + +Sed arcu non odio euismod lacinia at quis risus. Lorem dolor sed viverra ipsum nunc. Dolor sit amet consectetur adipiscing elit pellentesque habitant morbi tristique. Turpis massa tincidunt dui ut. Feugiat nibh sed pulvinar proin gravida hendrerit lectus. Egestas egestas fringilla phasellus faucibus scelerisque eleifend. Ornare quam viverra orci sagittis eu. Ut venenatis tellus in metus. In nulla posuere sollicitudin aliquam ultrices sagittis orci. Enim eu turpis egestas pretium aenean. Faucibus turpis in eu mi bibendum neque. Commodo odio aenean sed adipiscing diam. Eu ultrices vitae auctor eu augue ut lectus arcu. Est ullamcorper eget nulla facilisi etiam dignissim diam quis enim. Neque sodales ut etiam sit amet nisl purus. Lectus vestibulum mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare. + +Sed arcu non odio euismod lacinia at. Ornare quam viverra orci sagittis eu volutpat odio facilisis. Ac auctor augue mauris augue neque gravida. Est ante in nibh mauris cursus mattis molestie. Aliquam malesuada bibendum arcu vitae elementum. Cursus metus aliquam eleifend mi in nulla posuere. Ullamcorper eget nulla facilisi etiam dignissim diam quis enim lobortis. Lorem dolor sed viverra ipsum. Ut diam quam nulla porttitor massa id neque. In est ante in nibh. Aenean vel elit scelerisque mauris. Mattis aliquam faucibus purus in massa tempor nec feugiat. Ornare massa eget egestas purus viverra. Sollicitudin ac orci phasellus egestas tellus rutrum tellus pellentesque eu. Sit amet commodo nulla facilisi nullam. + +Enim sed faucibus turpis in eu. Mi quis hendrerit dolor magna eget est lorem. Rhoncus est pellentesque elit ullamcorper dignissim. Diam sit amet nisl suscipit. Rhoncus aenean vel elit scelerisque mauris pellentesque pulvinar pellentesque. Cras ornare arcu dui vivamus arcu felis bibendum. Cursus sit amet dictum sit amet justo donec enim. Orci sagittis eu volutpat odio facilisis. Felis donec et odio pellentesque. Aliquam purus sit amet luctus venenatis lectus magna fringilla urna. + +Leo a diam sollicitudin tempor. Integer quis auctor elit sed vulputate mi sit amet. Feugiat sed lectus vestibulum mattis. Ipsum dolor sit amet consectetur. Nulla malesuada pellentesque elit eget. Adipiscing commodo elit at imperdiet dui accumsan. Maecenas volutpat blandit aliquam etiam erat velit. Egestas sed tempus urna et pharetra. Tortor aliquam nulla facilisi cras fermentum. Duis ultricies lacus sed turpis tincidunt id aliquet risus. Lorem donec massa sapien faucibus. Quam viverra orci sagittis eu volutpat. Sit amet volutpat consequat mauris nunc congue nisi vitae suscipit. Risus at ultrices mi tempus imperdiet nulla. Volutpat diam ut venenatis tellus in metus vulputate. Ultrices gravida dictum fusce ut placerat orci nulla pellentesque dignissim. Quis lectus nulla at volutpat. + +Ultricies leo integer malesuada nunc vel risus commodo viverra. Dolor sit amet consectetur adipiscing elit ut. Sem nulla pharetra diam sit amet nisl suscipit adipiscing bibendum. Gravida dictum fusce ut placerat orci. Eget nunc scelerisque viverra mauris in. Nunc sed blandit libero volutpat sed. Pharetra magna ac placerat vestibulum lectus mauris ultrices. Placerat vestibulum lectus mauris ultrices eros in. Quis enim lobortis scelerisque fermentum. Viverra accumsan in nisl nisi scelerisque eu ultrices. Eu sem integer vitae justo. Nec sagittis aliquam malesuada bibendum arcu vitae elementum. Adipiscing tristique risus nec feugiat in. Sed lectus vestibulum mattis ullamcorper velit. Enim eu turpis egestas pretium aenean pharetra magna ac placerat. Sed arcu non odio euismod lacinia at quis risus. In aliquam sem fringilla ut morbi tincidunt augue interdum velit. + +Nam aliquam sem et tortor consequat. Quam adipiscing vitae proin sagittis. Malesuada nunc vel risus commodo. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Scelerisque viverra mauris in aliquam sem fringilla ut. Pretium fusce id velit ut tortor pretium viverra suspendisse. Lectus mauris ultrices eros in cursus turpis massa. Amet tellus cras adipiscing enim eu turpis. Sapien faucibus et molestie ac feugiat sed lectus. Luctus venenatis lectus magna fringilla urna. Arcu vitae elementum curabitur vitae nunc sed. Mauris pellentesque pulvinar pellentesque habitant morbi tristique senectus. Aliquet sagittis id consectetur purus ut faucibus pulvinar. Tortor vitae purus faucibus ornare suspendisse sed nisi. Pellentesque diam volutpat commodo sed egestas egestas fringilla phasellus. Morbi tristique senectus et netus et malesuada fames. Justo laoreet sit amet cursus sit amet dictum sit amet. Non quam lacus suspendisse faucibus interdum posuere lorem ipsum. Enim eu turpis egestas pretium. + +Sed velit dignissim sodales ut eu sem. Lacinia at quis risus sed vulputate. Netus et malesuada fames ac turpis. Pharetra diam sit amet nisl suscipit adipiscing bibendum. Eu lobortis elementum nibh tellus molestie nunc non blandit. Blandit cursus risus at ultrices mi tempus imperdiet nulla malesuada. Nullam eget felis eget nunc lobortis. Bibendum arcu vitae elementum curabitur vitae. Donec enim diam vulputate ut pharetra. Tellus pellentesque eu tincidunt tortor aliquam nulla. + +Id cursus metus aliquam eleifend mi in nulla. In ornare quam viverra orci sagittis eu volutpat. Pellentesque adipiscing commodo elit at imperdiet dui accumsan sit amet. Sit amet facilisis magna etiam tempor. Cursus mattis molestie a iaculis at erat. Velit egestas dui id ornare. Porttitor massa id neque aliquam. Felis imperdiet proin fermentum leo vel orci porta non pulvinar. Ac turpis egestas integer eget aliquet nibh. Iaculis at erat pellentesque adipiscing commodo. + +Laoreet id donec ultrices tincidunt arcu non. Tincidunt lobortis feugiat vivamus at augue eget. Viverra aliquet eget sit amet tellus. Malesuada fames ac turpis egestas sed tempus urna et pharetra. Nunc faucibus a pellentesque sit amet. Sed velit dignissim sodales ut eu sem integer. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper. Enim ut tellus elementum sagittis vitae et leo duis ut. Facilisi cras fermentum odio eu feugiat pretium nibh ipsum consequat. Nunc mattis enim ut tellus elementum. Cras fermentum odio eu feugiat pretium nibh ipsum consequat nisl. Sed sed risus pretium quam vulputate dignissim. Leo integer malesuada nunc vel risus commodo viverra maecenas. Tellus in metus vulputate eu scelerisque felis imperdiet proin fermentum. + +Amet massa vitae tortor condimentum lacinia quis vel eros. Purus viverra accumsan in nisl nisi scelerisque eu ultrices vitae. Est placerat in egestas erat imperdiet sed euismod nisi porta. Id faucibus nisl tincidunt eget nullam non nisi est. Sed blandit libero volutpat sed cras ornare arcu. Magna ac placerat vestibulum lectus. Enim ut tellus elementum sagittis vitae et. Lectus proin nibh nisl condimentum. Varius quam quisque id diam vel quam elementum pulvinar etiam. Aliquet nibh praesent tristique magna sit amet purus. Ut eu sem integer vitae justo eget magna fermentum iaculis. Nunc lobortis mattis aliquam faucibus purus in massa tempor. + +Bibendum ut tristique et egestas quis ipsum suspendisse ultrices gravida. Vulputate eu scelerisque felis imperdiet proin fermentum leo vel. Sed blandit libero volutpat sed cras. Eu augue ut lectus arcu bibendum at varius vel. Tellus molestie nunc non blandit massa enim nec. In dictum non consectetur a. Sed nisi lacus sed viverra. Lacus laoreet non curabitur gravida arcu ac. Elementum integer enim neque volutpat ac. Sollicitudin ac orci phasellus egestas. Lacus viverra vitae congue eu consequat ac felis. Sit amet mauris commodo quis imperdiet. Mattis pellentesque id nibh tortor id aliquet lectus proin. At quis risus sed vulputate. Risus in hendrerit gravida rutrum quisque non tellus orci ac. Mauris augue neque gravida in. Sapien nec sagittis aliquam malesuada bibendum arcu vitae. Quis vel eros donec ac odio tempor orci. + +Accumsan sit amet nulla facilisi morbi tempus. In egestas erat imperdiet sed euismod nisi porta. A condimentum vitae sapien pellentesque habitant morbi tristique senectus. Morbi quis commodo odio aenean sed adipiscing diam donec. Nisl rhoncus mattis rhoncus urna neque viverra justo nec ultrices. Ultrices mi tempus imperdiet nulla. Sed nisi lacus sed viverra tellus in hac habitasse platea. Elementum sagittis vitae et leo duis ut diam quam. Lorem mollis aliquam ut porttitor leo a diam sollicitudin. Neque volutpat ac tincidunt vitae semper quis. Ultricies integer quis auctor elit sed vulputate mi sit amet. Neque vitae tempus quam pellentesque nec nam aliquam. Eu tincidunt tortor aliquam nulla. Sed pulvinar proin gravida hendrerit lectus a. Et malesuada fames ac turpis egestas sed tempus urna et. Integer eget aliquet nibh praesent tristique magna sit amet purus. Pulvinar mattis nunc sed blandit libero volutpat. Iaculis nunc sed augue lacus viverra vitae. Justo donec enim diam vulputate ut pharetra sit amet. + +Mattis pellentesque id nibh tortor id aliquet lectus. Convallis aenean et tortor at risus viverra adipiscing at in. Faucibus pulvinar elementum integer enim neque volutpat. Vitae tortor condimentum lacinia quis. Mauris augue neque gravida in fermentum et sollicitudin ac orci. Turpis massa tincidunt dui ut. Id faucibus nisl tincidunt eget nullam. Posuere urna nec tincidunt praesent semper. Aliquam sem fringilla ut morbi tincidunt. Amet cursus sit amet dictum. Nec feugiat nisl pretium fusce id velit ut tortor. + +Eget aliquet nibh praesent tristique magna. Elementum nibh tellus molestie nunc non. Sed risus ultricies tristique nulla aliquet enim. Eleifend quam adipiscing vitae proin sagittis nisl. Quam viverra orci sagittis eu volutpat odio facilisis mauris sit. Integer feugiat scelerisque varius morbi enim nunc faucibus. Nulla facilisi nullam vehicula ipsum a. Posuere urna nec tincidunt praesent semper feugiat. Feugiat nibh sed pulvinar proin gravida hendrerit lectus a. Nisl pretium fusce id velit ut tortor pretium viverra suspendisse. Venenatis urna cursus eget nunc. Neque laoreet suspendisse interdum consectetur libero id faucibus nisl. Ut diam quam nulla porttitor massa id neque. + +Leo vel fringilla est ullamcorper eget. Id donec ultrices tincidunt arcu. Egestas sed tempus urna et pharetra pharetra massa massa. Vel risus commodo viverra maecenas. Imperdiet nulla malesuada pellentesque elit eget gravida cum. Volutpat est velit egestas dui. Orci phasellus egestas tellus rutrum tellus. Habitant morbi tristique senectus et netus et malesuada fames ac. Semper auctor neque vitae tempus quam pellentesque nec. Velit aliquet sagittis id consectetur purus ut faucibus. Id diam vel quam elementum pulvinar etiam. Laoreet non curabitur gravida arcu. Non diam phasellus vestibulum lorem sed risus ultricies. Enim ut tellus elementum sagittis vitae et. Nibh tortor id aliquet lectus proin nibh nisl condimentum. Vulputate dignissim suspendisse in est ante in nibh mauris. + +Pharetra vel turpis nunc eget. Nulla porttitor massa id neque aliquam vestibulum morbi blandit cursus. Tellus elementum sagittis vitae et leo duis ut. A arcu cursus vitae congue. Egestas sed sed risus pretium quam vulputate dignissim. In cursus turpis massa tincidunt dui ut ornare lectus sit. Ornare lectus sit amet est placerat in egestas erat. Elit scelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique. Facilisis volutpat est velit egestas dui id. Faucibus pulvinar elementum integer enim neque volutpat ac tincidunt. Elementum tempus egestas sed sed risus pretium quam vulputate dignissim. Amet tellus cras adipiscing enim. Diam vulputate ut pharetra sit amet. Et malesuada fames ac turpis egestas sed tempus urna. Sed turpis tincidunt id aliquet risus feugiat in. Enim diam vulputate ut pharetra sit amet aliquam id. Viverra ipsum nunc aliquet bibendum enim. Nulla aliquet enim tortor at. Et magnis dis parturient montes nascetur ridiculus mus mauris vitae. Venenatis urna cursus eget nunc scelerisque viverra. + +Proin sagittis nisl rhoncus mattis rhoncus urna neque. Dignissim diam quis enim lobortis scelerisque fermentum. Suspendisse sed nisi lacus sed. Egestas egestas fringilla phasellus faucibus scelerisque eleifend donec. Facilisi morbi tempus iaculis urna id volutpat. Fusce id velit ut tortor. Et molestie ac feugiat sed. Tristique senectus et netus et malesuada fames ac turpis. Nulla facilisi morbi tempus iaculis urna id volutpat lacus. Eu nisl nunc mi ipsum faucibus vitae aliquet nec ullamcorper. Eget duis at tellus at urna condimentum mattis pellentesque. Et magnis dis parturient montes nascetur. Nisl suscipit adipiscing bibendum est ultricies. Eu mi bibendum neque egestas congue. Ultrices gravida dictum fusce ut. Orci a scelerisque purus semper eget. + +Est velit egestas dui id ornare arcu. Eget magna fermentum iaculis eu non. Mauris sit amet massa vitae tortor condiment \ No newline at end of file diff --git a/vulkan/data/geometry/position.png b/vulkan/data/geometry/position.png new file mode 100644 index 0000000000000000000000000000000000000000..093f4f44569ef75d94fec51bbfc1547259c69552 GIT binary patch literal 1772 zcmcgt{Wp{e6u$2}?~Ip*@{z9;DYkq}a|lD_qc9a|5|&b?wx)JzO>7&xn3uMeh(0!& z(oCD2Q;Ho*SZdy~QpPgvCLHqBXxfrwG8!|nI%ofd_NRN#eeONadCs}_J~^B)wxNNw z0RR|oSRWV;fXt={;I!Egn{<^2K)bmiFd!nO_)WJg={aj&P(aG`jJV!HWF))2=n8JK zthY6L=Ui&ULib~~<<)+M+3)*b>cInJz#U;;DA=6?emSkm7prgBlYS_3c}UBAjJx(r7bz(}524DI zCNl)%+AlE=$Ex(nrNNBLxWa_cZL4aPYli|Y+jiVURG0Yi`kpdFfF zH_43J1N3LHz0ItH2s2^K!3hclJ4bnW=fF~;sVjLMgpu5i!HSCNG@wVU86EKn(If3T zhDR$Z6M)W1A00~zp^*cmr;JLD|JIZ)ioXVyg&uXCDi>2&SLHeRW4;5*Wx3TVr(5($ z&Ypw)>1U0IT@Mv~+T{yi9W~EJqtq9CfMM3=aR|681S{1-AF#D85fjG)x%Jm5^7HuEBI7RJ6x?z| z8`#)RXJg`NATgOuCeL0;5?c}8EweqTZD~MylZ0~iqfc!k&&%K4twQ#1!n)X4hV#Nt z1L=VS_2d7Q?*5`P7|WCGbr!J9Qz^B>;oU8^xztZok`vxBE1|qDR^)CgE;RIyX9%^e zO+}@%nC!(W)!4J7I7IZ$FTE;ey1!6Bsoe`nbz1FZRDM2Sy`s%FcaDEN%|53-gW(3{ zR(aUyhw3i4#q*DP@oi1c)GX%;?6pMK6C_1?-B!l)3$!?C*tqqAwr4YBFatg6Y9?`V z;jwGxlM}v33d!jh5aqv{&!xoSFZO5(R5VFuz=eWU|9n~`zKU=05hsmkiK`FGi(q6A zG#^xd)F&6vhbD?O-f2|ULyIg`%(NN6ju1#f)%1{0J zrqO#R8+_awnpx6#jRD_24p&#|I#o2jJ>|~Do7U?fj3W}ID>POFzlH3pp4yg1xNu%i!-3lDVjeq5wBCbD=jzsHDPFA)1;mn2(4_G>y9L(`5sd4&SkyQqs|WCd0zSknjQNiVXtO?&8*yW658WKsqa z&1pYct&2A$f+nJ4Wl~=xy6Y76w$3VzidQOU1-1_w+Wqmg^tLVrvwL`b__i(;vuiDJ zsL=^AJ9+!w8eJV`_e5G+qw7wi65PK3_hWw^S5R9F6hu~O-N*y8E(RNd!U8MSa 3) b4 = a1 + a3; + if (gl_LocalInvocationIndex >= 0) b5 = a2 + a3; + if (gl_LocalInvocationIndex >= 3) b6 = a0 - a1 - a2; + if (gl_LocalInvocationIndex != 0) b7 = a0 - a1 + a3; + if (gl_LocalInvocationIndex > 1) b8 = a0 + a2 - a3; + if (gl_LocalInvocationIndex <= 1) b9 = a1 + a2 - a3; + if (gl_LocalInvocationIndex <= 2) c0 = b0 - b1; + if (gl_LocalInvocationIndex <= 2) c1 = b0 + b2; + if (gl_LocalInvocationIndex != 1) c10 = b1 - b3; + if (gl_LocalInvocationIndex >= 1) c100 = b1 - b5 + b7; + if (gl_LocalInvocationIndex <= 2) c1000 = b1 + b3 - b4 - b5 - b6 + b7 - b8 + b9; + if (gl_LocalInvocationIndex < 2) c1001 = b2 - b3 - b4 + b5 + b6 - b7 + b8 - b9; + if (gl_LocalInvocationIndex > 1) c1002 = b0 + b1 - b2 + b3 + b4 - b5 - b6 - b7 - b8; + if (gl_LocalInvocationIndex >= 2) c1003 = b0 - b1 - b2 + b3 + b4 + b5 + b6 - b7 - b9; + if (gl_LocalInvocationIndex < 1) c1004 = b0 - b1 - b2 + b3 + b4 + b5 + b6 + b8 + b9; + if (gl_LocalInvocationIndex > 0) c1005 = b0 + b1 - b2 + b3 + b4 - b5 + b7 + b8 + b9; + if (gl_LocalInvocationIndex == 2) c1006 = b0 + b1 + b2 + b3 - b4 - b6 - b7 - b8 - b9; + if (gl_LocalInvocationIndex < 2) c1007 = b0 - b1 + b2 - b3 - b5 - b6 - b7 + b8 + b9; + if (gl_LocalInvocationIndex < 2) c1008 = b0 + b1 + b2 - b4 + b5 + b6 + b7 - b8 - b9; + if (gl_LocalInvocationIndex > 0) c1009 = b0 - b1 - b3 - b4 + b5 - b6 - b7 - b8 - b9; + if (gl_LocalInvocationIndex == 1) c101 = b1 - b5 - b8; + if (gl_LocalInvocationIndex >= 0) c1010 = b0 - b2 + b3 + b4 + b5 + b6 + b7 - b8 + b9; + if (gl_LocalInvocationIndex != 1) c1011 = b1 + b2 + b3 - b4 - b5 - b6 + b7 - b8 - b9; + if (gl_LocalInvocationIndex > 1) c102 = b1 + b5 - b9; + if (gl_LocalInvocationIndex > 3) c103 = b1 + b6 + b7; + if (gl_LocalInvocationIndex > 3) c104 = b1 + b6 - b8; + if (gl_LocalInvocationIndex > 0) c105 = b1 + b6 + b9; + if (gl_LocalInvocationIndex < 2) c106 = b1 + b7 - b8; + if (gl_LocalInvocationIndex == 3) c107 = b1 + b7 + b9; + if (gl_LocalInvocationIndex != 3) c108 = b1 - b8 - b9; + if (gl_LocalInvocationIndex == 0) c109 = b2 + b3 - b4; + if (gl_LocalInvocationIndex < 2) c11 = b1 - b4; + if (gl_LocalInvocationIndex > 3) c110 = b2 - b3 - b5; + if (gl_LocalInvocationIndex > 1) c111 = b2 - b3 + b6; + if (gl_LocalInvocationIndex != 0) c112 = b2 + b3 + b7; + if (gl_LocalInvocationIndex > 3) c113 = b2 - b3 + b8; + if (gl_LocalInvocationIndex < 1) c114 = b2 + b3 - b9; + if (gl_LocalInvocationIndex <= 0) c115 = b2 + b4 + b5; + if (gl_LocalInvocationIndex == 3) c116 = b2 + b4 - b6; + if (gl_LocalInvocationIndex > 0) c117 = b2 - b4 + b7; + if (gl_LocalInvocationIndex != 3) c118 = b2 - b4 + b8; + if (gl_LocalInvocationIndex > 0) c119 = b2 + b4 - b9; + if (gl_LocalInvocationIndex <= 2) c12 = b1 - b5; + if (gl_LocalInvocationIndex == 0) c120 = b2 + b5 + b6; + if (gl_LocalInvocationIndex < 2) c121 = b2 + b5 - b7; + if (gl_LocalInvocationIndex <= 2) c122 = b2 + b5 + b8; + if (gl_LocalInvocationIndex < 3) c123 = b2 - b5 - b9; + if (gl_LocalInvocationIndex <= 3) c124 = b2 - b6 - b7; + if (gl_LocalInvocationIndex > 1) c125 = b2 + b6 + b8; + if (gl_LocalInvocationIndex > 1) c126 = b2 - b6 + b9; + if (gl_LocalInvocationIndex >= 0) c127 = b2 - b7 - b8; + if (gl_LocalInvocationIndex >= 2) c128 = b2 + b7 - b9; + if (gl_LocalInvocationIndex >= 1) c129 = b2 + b8 + b9; + if (gl_LocalInvocationIndex >= 2) c13 = b1 + b6; + if (gl_LocalInvocationIndex < 1) c130 = b3 + b4 - b5; + if (gl_LocalInvocationIndex != 3) c131 = b3 + b4 - b6; + if (gl_LocalInvocationIndex < 1) c132 = b3 + b4 + b7; + if (gl_LocalInvocationIndex <= 3) c133 = b3 - b4 + b8; + if (gl_LocalInvocationIndex != 3) c134 = b3 - b4 + b9; + if (gl_LocalInvocationIndex < 0) c135 = b3 + b5 - b6; + if (gl_LocalInvocationIndex > 3) c136 = b3 - b5 + b7; + if (gl_LocalInvocationIndex != 3) c137 = b3 - b5 - b8; + if (gl_LocalInvocationIndex == 0) c138 = b3 + b5 + b9; + if (gl_LocalInvocationIndex <= 2) c139 = b3 - b6 - b7; + if (gl_LocalInvocationIndex <= 2) c14 = b1 + b7; + if (gl_LocalInvocationIndex == 2) c140 = b3 - b6 - b8; + if (gl_LocalInvocationIndex < 1) c141 = b3 + b6 - b9; + if (gl_LocalInvocationIndex != 0) c142 = b3 - b7 - b8; + if (gl_LocalInvocationIndex != 2) c143 = b3 - b7 + b9; + if (gl_LocalInvocationIndex == 2) c144 = b3 - b8 - b9; + if (gl_LocalInvocationIndex < 0) c145 = b4 + b5 - b6; + if (gl_LocalInvocationIndex != 2) c146 = b4 + b5 - b7; + if (gl_LocalInvocationIndex < 1) c147 = b4 + b5 - b8; + if (gl_LocalInvocationIndex != 0) c148 = b4 + b5 - b9; + if (gl_LocalInvocationIndex == 2) c149 = b4 + b6 - b7; + if (gl_LocalInvocationIndex > 2) c15 = b1 + b8; + if (gl_LocalInvocationIndex <= 2) c150 = b4 - b6 - b8; + if (gl_LocalInvocationIndex > 1) c151 = b4 - b6 - b9; + if (gl_LocalInvocationIndex != 3) c152 = b4 - b7 - b8; + if (gl_LocalInvocationIndex == 2) c153 = b4 - b7 - b9; + if (gl_LocalInvocationIndex == 0) c154 = b4 + b8 + b9; + if (gl_LocalInvocationIndex == 3) c155 = b5 - b6 + b7; + if (gl_LocalInvocationIndex > 2) c156 = b5 - b6 + b8; + if (gl_LocalInvocationIndex >= 1) c157 = b5 + b6 - b9; + if (gl_LocalInvocationIndex <= 2) c158 = b5 - b7 - b8; + if (gl_LocalInvocationIndex <= 1) c159 = b5 + b7 + b9; + if (gl_LocalInvocationIndex >= 0) c16 = b1 + b9; + if (gl_LocalInvocationIndex >= 3) c160 = b5 + b8 - b9; + if (gl_LocalInvocationIndex != 0) c161 = b6 - b7 - b8; + if (gl_LocalInvocationIndex < 0) c162 = b6 + b7 + b9; + if (gl_LocalInvocationIndex > 0) c163 = b6 + b8 + b9; + if (gl_LocalInvocationIndex == 0) c164 = b7 + b8 + b9; + if (gl_LocalInvocationIndex < 0) c165 = b0 - b1 + b2 + b3; + if (gl_LocalInvocationIndex < 3) c166 = b0 + b1 - b2 + b4; + if (gl_LocalInvocationIndex > 2) c167 = b0 + b1 - b2 - b5; + if (gl_LocalInvocationIndex < 2) c168 = b0 - b1 + b2 - b6; + if (gl_LocalInvocationIndex > 1) c169 = b0 + b1 - b2 - b7; + if (gl_LocalInvocationIndex == 3) c17 = b2 + b3; + if (gl_LocalInvocationIndex >= 2) c170 = b0 - b1 - b2 + b8; + if (gl_LocalInvocationIndex > 3) c171 = b0 + b1 - b2 + b9; + if (gl_LocalInvocationIndex >= 2) c172 = b0 - b1 + b3 - b4; + if (gl_LocalInvocationIndex >= 3) c173 = b0 + b1 + b3 - b5; + if (gl_LocalInvocationIndex > 3) c174 = b0 - b1 + b3 + b6; + if (gl_LocalInvocationIndex == 2) c175 = b0 - b1 + b3 + b7; + if (gl_LocalInvocationIndex <= 2) c176 = b0 + b1 - b3 - b8; + if (gl_LocalInvocationIndex > 0) c177 = b0 - b1 - b3 - b9; + if (gl_LocalInvocationIndex == 1) c178 = b0 + b1 - b4 + b5; + if (gl_LocalInvocationIndex == 0) c179 = b0 + b1 - b4 - b6; + if (gl_LocalInvocationIndex <= 3) c18 = b2 - b4; + if (gl_LocalInvocationIndex > 2) c180 = b0 + b1 + b4 + b7; + if (gl_LocalInvocationIndex <= 0) c181 = b0 - b1 - b4 + b8; + if (gl_LocalInvocationIndex <= 0) c182 = b0 + b1 + b4 + b9; + if (gl_LocalInvocationIndex <= 0) c183 = b0 + b1 + b5 + b6; + if (gl_LocalInvocationIndex > 3) c184 = b0 - b1 - b5 - b7; + if (gl_LocalInvocationIndex > 3) c185 = b0 + b1 - b5 - b8; + if (gl_LocalInvocationIndex < 0) c186 = b0 - b1 + b5 - b9; + if (gl_LocalInvocationIndex <= 0) c187 = b0 + b1 + b6 + b7; + if (gl_LocalInvocationIndex <= 3) c188 = b0 - b1 + b6 + b8; + if (gl_LocalInvocationIndex == 1) c189 = b0 - b1 - b6 + b9; + if (gl_LocalInvocationIndex < 1) c19 = b2 - b5; + if (gl_LocalInvocationIndex >= 0) c190 = b0 - b1 - b7 + b8; + if (gl_LocalInvocationIndex == 3) c191 = b0 - b1 - b7 - b9; + if (gl_LocalInvocationIndex == 3) c192 = b0 - b1 + b8 + b9; + if (gl_LocalInvocationIndex < 2) c193 = b0 + b2 - b3 - b4; + if (gl_LocalInvocationIndex == 3) c194 = b0 - b2 - b3 + b5; + if (gl_LocalInvocationIndex <= 3) c195 = b0 - b2 + b3 - b6; + if (gl_LocalInvocationIndex >= 0) c196 = b0 + b2 + b3 + b7; + if (gl_LocalInvocationIndex > 1) c197 = b0 - b2 - b3 + b8; + if (gl_LocalInvocationIndex != 1) c198 = b0 - b2 + b3 + b9; + if (gl_LocalInvocationIndex < 0) c199 = b0 - b2 - b4 + b5; + if (gl_LocalInvocationIndex >= 2) c2 = b0 - b3; + if (gl_LocalInvocationIndex > 2) c20 = b2 + b6; + if (gl_LocalInvocationIndex <= 1) c200 = b0 + b2 - b4 + b6; + if (gl_LocalInvocationIndex != 0) c201 = b0 + b2 + b4 - b7; + if (gl_LocalInvocationIndex != 1) c202 = b0 - b2 + b4 - b8; + if (gl_LocalInvocationIndex < 2) c203 = b0 + b2 - b4 + b9; + if (gl_LocalInvocationIndex == 0) c204 = b0 - b2 + b5 - b6; + if (gl_LocalInvocationIndex != 3) c205 = b0 - b2 - b5 + b7; + if (gl_LocalInvocationIndex < 2) c206 = b0 - b2 + b5 + b8; + if (gl_LocalInvocationIndex <= 0) c207 = b0 + b2 - b5 + b9; + if (gl_LocalInvocationIndex == 0) c208 = b0 + b2 + b6 - b7; + if (gl_LocalInvocationIndex <= 0) c209 = b0 + b2 - b6 - b8; + if (gl_LocalInvocationIndex == 2) c21 = b2 - b7; + if (gl_LocalInvocationIndex == 3) c210 = b0 + b2 + b6 + b9; + if (gl_LocalInvocationIndex <= 2) c211 = b0 + b2 + b7 - b8; + if (gl_LocalInvocationIndex >= 0) c212 = b0 + b2 + b7 + b9; + if (gl_LocalInvocationIndex > 2) c213 = b0 - b2 + b8 - b9; + if (gl_LocalInvocationIndex <= 1) c214 = b0 - b3 - b4 - b5; + if (gl_LocalInvocationIndex < 1) c215 = b0 - b3 + b4 + b6; + if (gl_LocalInvocationIndex == 3) c216 = b0 + b3 + b4 + b7; + if (gl_LocalInvocationIndex >= 3) c217 = b0 + b3 - b4 + b8; + if (gl_LocalInvocationIndex < 0) c218 = b0 + b3 - b4 - b9; + if (gl_LocalInvocationIndex <= 0) c219 = b0 + b3 + b5 - b6; + if (gl_LocalInvocationIndex <= 0) c22 = b2 - b8; + if (gl_LocalInvocationIndex == 3) c220 = b0 + b3 + b5 - b7; + if (gl_LocalInvocationIndex == 2) c221 = b0 - b3 + b5 + b8; + if (gl_LocalInvocationIndex == 0) c222 = b0 + b3 - b5 + b9; + if (gl_LocalInvocationIndex > 3) c223 = b0 - b3 - b6 + b7; + if (gl_LocalInvocationIndex >= 0) c224 = b0 + b3 - b6 + b8; + if (gl_LocalInvocationIndex == 0) c225 = b0 - b3 + b6 + b9; + if (gl_LocalInvocationIndex == 1) c226 = b0 - b3 + b7 - b8; + if (gl_LocalInvocationIndex >= 1) c227 = b0 + b3 + b7 + b9; + if (gl_LocalInvocationIndex > 2) c228 = b0 - b3 + b8 + b9; + if (gl_LocalInvocationIndex <= 0) c229 = b0 + b4 + b5 - b6; + if (gl_LocalInvocationIndex > 0) c23 = b2 + b9; + if (gl_LocalInvocationIndex != 1) c230 = b0 + b4 + b5 + b7; + if (gl_LocalInvocationIndex < 1) c231 = b0 + b4 + b5 - b8; + if (gl_LocalInvocationIndex != 1) c232 = b0 + b4 - b5 - b9; + if (gl_LocalInvocationIndex <= 1) c233 = b0 - b4 + b6 + b7; + if (gl_LocalInvocationIndex > 1) c234 = b0 - b4 + b6 - b8; + if (gl_LocalInvocationIndex == 2) c235 = b0 + b4 - b6 + b9; + if (gl_LocalInvocationIndex >= 1) c236 = b0 - b4 - b7 - b8; + if (gl_LocalInvocationIndex == 0) c237 = b0 - b4 - b7 + b9; + if (gl_LocalInvocationIndex < 0) c238 = b0 + b4 - b8 + b9; + if (gl_LocalInvocationIndex != 1) c239 = b0 - b5 + b6 - b7; + if (gl_LocalInvocationIndex >= 3) c24 = b3 - b4; + if (gl_LocalInvocationIndex >= 0) c240 = b0 - b5 - b6 + b8; + if (gl_LocalInvocationIndex < 3) c241 = b0 - b5 + b6 - b9; + if (gl_LocalInvocationIndex > 2) c242 = b0 + b5 - b7 + b8; + if (gl_LocalInvocationIndex == 3) c243 = b0 + b5 + b7 - b9; + if (gl_LocalInvocationIndex <= 1) c244 = b0 + b5 - b8 + b9; + if (gl_LocalInvocationIndex > 3) c245 = b0 - b6 - b7 + b8; + if (gl_LocalInvocationIndex < 0) c246 = b0 + b6 + b7 + b9; + if (gl_LocalInvocationIndex >= 2) c247 = b0 - b6 + b8 - b9; + if (gl_LocalInvocationIndex <= 1) c248 = b0 - b7 - b8 - b9; + if (gl_LocalInvocationIndex <= 3) c249 = b1 - b2 - b3 - b4; + if (gl_LocalInvocationIndex != 2) c25 = b3 - b5; + if (gl_LocalInvocationIndex == 1) c250 = b1 + b2 - b3 + b5; + if (gl_LocalInvocationIndex >= 2) c251 = b1 - b2 + b3 + b6; + if (gl_LocalInvocationIndex >= 3) c252 = b1 - b2 - b3 - b7; + if (gl_LocalInvocationIndex < 3) c253 = b1 + b2 - b3 - b8; + if (gl_LocalInvocationIndex >= 3) c254 = b1 - b2 - b3 - b9; + if (gl_LocalInvocationIndex >= 3) c255 = b1 - b2 - b4 + b5; + if (gl_LocalInvocationIndex != 3) c256 = b1 + b2 - b4 - b6; + if (gl_LocalInvocationIndex < 0) c257 = b1 - b2 - b4 - b7; + if (gl_LocalInvocationIndex == 1) c258 = b1 + b2 + b4 - b8; + if (gl_LocalInvocationIndex > 1) c259 = b1 - b2 + b4 + b9; + if (gl_LocalInvocationIndex < 2) c26 = b3 - b6; + if (gl_LocalInvocationIndex > 3) c260 = b1 + b2 + b5 + b6; + if (gl_LocalInvocationIndex < 0) c261 = b1 + b2 + b5 + b7; + if (gl_LocalInvocationIndex <= 1) c262 = b1 - b2 + b5 - b8; + if (gl_LocalInvocationIndex == 3) c263 = b1 - b2 - b5 + b9; + if (gl_LocalInvocationIndex != 1) c264 = b1 - b2 + b6 - b7; + if (gl_LocalInvocationIndex != 1) c265 = b1 - b2 + b6 + b8; + if (gl_LocalInvocationIndex <= 3) c266 = b1 - b2 - b6 + b9; + if (gl_LocalInvocationIndex == 3) c267 = b1 - b2 - b7 + b8; + if (gl_LocalInvocationIndex != 0) c268 = b1 + b2 + b7 - b9; + if (gl_LocalInvocationIndex != 3) c269 = b1 - b2 - b8 - b9; + if (gl_LocalInvocationIndex > 0) c27 = b3 + b7; + if (gl_LocalInvocationIndex < 1) c270 = b1 + b3 - b4 + b5; + if (gl_LocalInvocationIndex > 0) c271 = b1 + b3 + b4 + b6; + if (gl_LocalInvocationIndex == 1) c272 = b1 - b3 + b4 - b7; + if (gl_LocalInvocationIndex > 0) c273 = b1 + b3 + b4 + b8; + if (gl_LocalInvocationIndex > 2) c274 = b1 + b3 - b4 - b9; + if (gl_LocalInvocationIndex < 1) c275 = b1 + b3 - b5 - b6; + if (gl_LocalInvocationIndex >= 0) c276 = b1 - b3 + b5 - b7; + if (gl_LocalInvocationIndex == 2) c277 = b1 - b3 + b5 + b8; + if (gl_LocalInvocationIndex <= 0) c278 = b1 + b3 + b5 - b9; + if (gl_LocalInvocationIndex >= 0) c279 = b1 + b3 + b6 - b7; + if (gl_LocalInvocationIndex < 3) c28 = b3 - b8; + if (gl_LocalInvocationIndex < 3) c280 = b1 - b3 - b6 + b8; + if (gl_LocalInvocationIndex < 2) c281 = b1 + b3 + b6 - b9; + if (gl_LocalInvocationIndex == 2) c282 = b1 - b3 - b7 - b8; + if (gl_LocalInvocationIndex < 1) c283 = b1 + b3 - b7 - b9; + if (gl_LocalInvocationIndex > 1) c284 = b1 - b3 + b8 + b9; + if (gl_LocalInvocationIndex != 1) c285 = b1 - b4 - b5 - b6; + if (gl_LocalInvocationIndex < 3) c286 = b1 - b4 + b5 - b7; + if (gl_LocalInvocationIndex != 1) c287 = b1 + b4 - b5 - b8; + if (gl_LocalInvocationIndex > 2) c288 = b1 - b4 - b5 - b9; + if (gl_LocalInvocationIndex == 0) c289 = b1 - b4 + b6 + b7; + if (gl_LocalInvocationIndex < 3) c29 = b3 - b9; + if (gl_LocalInvocationIndex == 0) c290 = b1 - b4 - b6 + b8; + if (gl_LocalInvocationIndex <= 0) c291 = b1 - b4 - b6 - b9; + if (gl_LocalInvocationIndex > 1) c292 = b1 + b4 - b7 + b8; + if (gl_LocalInvocationIndex > 2) c293 = b1 - b4 - b7 - b9; + if (gl_LocalInvocationIndex > 3) c294 = b1 + b4 + b8 - b9; + if (gl_LocalInvocationIndex >= 3) c295 = b1 - b5 + b6 + b7; + if (gl_LocalInvocationIndex > 1) c296 = b1 - b5 + b6 - b8; + if (gl_LocalInvocationIndex > 3) c297 = b1 + b5 + b6 - b9; + if (gl_LocalInvocationIndex < 2) c298 = b1 - b5 + b7 - b8; + if (gl_LocalInvocationIndex >= 0) c299 = b1 - b5 + b7 + b9; + if (gl_LocalInvocationIndex < 3) c3 = b0 + b4; + if (gl_LocalInvocationIndex <= 1) c30 = b4 + b5; + if (gl_LocalInvocationIndex >= 2) c300 = b1 + b5 + b8 - b9; + if (gl_LocalInvocationIndex == 1) c301 = b1 + b6 - b7 + b8; + if (gl_LocalInvocationIndex != 3) c302 = b1 + b6 + b7 + b9; + if (gl_LocalInvocationIndex < 2) c303 = b1 + b6 - b8 - b9; + if (gl_LocalInvocationIndex < 0) c304 = b1 - b7 + b8 - b9; + if (gl_LocalInvocationIndex > 2) c305 = b2 + b3 + b4 + b5; + if (gl_LocalInvocationIndex <= 1) c306 = b2 + b3 - b4 - b6; + if (gl_LocalInvocationIndex == 0) c307 = b2 + b3 + b4 + b7; + if (gl_LocalInvocationIndex <= 3) c308 = b2 + b3 - b4 + b8; + if (gl_LocalInvocationIndex < 1) c309 = b2 - b3 - b4 - b9; + if (gl_LocalInvocationIndex < 2) c31 = b4 + b6; + if (gl_LocalInvocationIndex != 2) c310 = b2 + b3 + b5 - b6; + if (gl_LocalInvocationIndex < 0) c311 = b2 + b3 - b5 + b7; + if (gl_LocalInvocationIndex < 2) c312 = b2 + b3 + b5 - b8; + if (gl_LocalInvocationIndex == 0) c313 = b2 + b3 + b5 + b9; + if (gl_LocalInvocationIndex > 1) c314 = b2 + b3 + b6 - b7; + if (gl_LocalInvocationIndex >= 0) c315 = b2 - b3 - b6 - b8; + if (gl_LocalInvocationIndex == 1) c316 = b2 - b3 + b6 - b9; + if (gl_LocalInvocationIndex != 3) c317 = b2 - b3 - b7 - b8; + if (gl_LocalInvocationIndex >= 2) c318 = b2 + b3 - b7 + b9; + if (gl_LocalInvocationIndex > 0) c319 = b2 + b3 - b8 + b9; + if (gl_LocalInvocationIndex > 2) c32 = b4 - b7; + if (gl_LocalInvocationIndex == 3) c320 = b2 - b4 - b5 + b6; + if (gl_LocalInvocationIndex < 1) c321 = b2 - b4 - b5 + b7; + if (gl_LocalInvocationIndex < 2) c322 = b2 - b4 - b5 + b8; + if (gl_LocalInvocationIndex <= 2) c323 = b2 - b4 + b5 - b9; + if (gl_LocalInvocationIndex <= 1) c324 = b2 + b4 + b6 - b7; + if (gl_LocalInvocationIndex > 2) c325 = b2 - b4 + b6 + b8; + if (gl_LocalInvocationIndex < 0) c326 = b2 + b4 + b6 + b9; + if (gl_LocalInvocationIndex <= 1) c327 = b2 - b4 + b7 + b8; + if (gl_LocalInvocationIndex < 3) c328 = b2 + b4 + b7 + b9; + if (gl_LocalInvocationIndex == 0) c329 = b2 + b4 + b8 - b9; + if (gl_LocalInvocationIndex >= 3) c33 = b4 - b8; + if (gl_LocalInvocationIndex >= 3) c330 = b2 - b5 - b6 + b7; + if (gl_LocalInvocationIndex <= 3) c331 = b2 + b5 + b6 + b8; + if (gl_LocalInvocationIndex > 0) c332 = b2 - b5 + b6 - b9; + if (gl_LocalInvocationIndex >= 0) c333 = b2 - b5 - b7 + b8; + if (gl_LocalInvocationIndex == 3) c334 = b2 + b5 + b7 + b9; + if (gl_LocalInvocationIndex > 1) c335 = b2 - b5 + b8 + b9; + if (gl_LocalInvocationIndex >= 1) c336 = b2 - b6 + b7 - b8; + if (gl_LocalInvocationIndex >= 3) c337 = b2 + b6 + b7 + b9; + if (gl_LocalInvocationIndex == 1) c338 = b2 + b6 + b8 - b9; + if (gl_LocalInvocationIndex <= 2) c339 = b2 - b7 + b8 + b9; + if (gl_LocalInvocationIndex > 0) c34 = b4 + b9; + if (gl_LocalInvocationIndex > 0) c340 = b3 + b4 + b5 - b6; + if (gl_LocalInvocationIndex <= 1) c341 = b3 + b4 + b5 + b7; + if (gl_LocalInvocationIndex < 0) c342 = b3 + b4 + b5 - b8; + if (gl_LocalInvocationIndex >= 3) c343 = b3 - b4 - b5 - b9; + if (gl_LocalInvocationIndex == 3) c344 = b3 + b4 + b6 - b7; + if (gl_LocalInvocationIndex != 1) c345 = b3 - b4 - b6 - b8; + if (gl_LocalInvocationIndex <= 1) c346 = b3 - b4 - b6 + b9; + if (gl_LocalInvocationIndex >= 3) c347 = b3 + b4 - b7 - b8; + if (gl_LocalInvocationIndex <= 2) c348 = b3 - b4 + b7 + b9; + if (gl_LocalInvocationIndex > 2) c349 = b3 - b4 - b8 - b9; + if (gl_LocalInvocationIndex >= 3) c35 = b5 - b6; + if (gl_LocalInvocationIndex == 0) c350 = b3 - b5 + b6 + b7; + if (gl_LocalInvocationIndex < 3) c351 = b3 - b5 - b6 + b8; + if (gl_LocalInvocationIndex <= 3) c352 = b3 - b5 + b6 + b9; + if (gl_LocalInvocationIndex <= 0) c353 = b3 - b5 + b7 + b8; + if (gl_LocalInvocationIndex >= 2) c354 = b3 - b5 - b7 + b9; + if (gl_LocalInvocationIndex <= 3) c355 = b3 + b5 + b8 - b9; + if (gl_LocalInvocationIndex == 1) c356 = b3 + b6 + b7 - b8; + if (gl_LocalInvocationIndex > 2) c357 = b3 + b6 + b7 + b9; + if (gl_LocalInvocationIndex <= 3) c358 = b3 + b6 + b8 + b9; + if (gl_LocalInvocationIndex < 0) c359 = b3 + b7 + b8 - b9; + if (gl_LocalInvocationIndex != 3) c36 = b5 - b7; + if (gl_LocalInvocationIndex >= 3) c360 = b4 - b5 + b6 - b7; + if (gl_LocalInvocationIndex > 2) c361 = b4 + b5 + b6 - b8; + if (gl_LocalInvocationIndex == 1) c362 = b4 + b5 - b6 - b9; + if (gl_LocalInvocationIndex >= 0) c363 = b4 - b5 - b7 - b8; + if (gl_LocalInvocationIndex < 0) c364 = b4 - b5 - b7 + b9; + if (gl_LocalInvocationIndex >= 3) c365 = b4 + b5 - b8 + b9; + if (gl_LocalInvocationIndex == 3) c366 = b4 + b6 - b7 - b8; + if (gl_LocalInvocationIndex != 0) c367 = b4 + b6 + b7 - b9; + if (gl_LocalInvocationIndex >= 0) c368 = b4 + b6 - b8 + b9; + if (gl_LocalInvocationIndex >= 2) c369 = b4 - b7 + b8 + b9; + if (gl_LocalInvocationIndex <= 1) c37 = b5 + b8; + if (gl_LocalInvocationIndex >= 0) c370 = b5 - b6 - b7 - b8; + if (gl_LocalInvocationIndex == 1) c371 = b5 - b6 - b7 + b9; + if (gl_LocalInvocationIndex != 2) c372 = b5 - b6 + b8 - b9; + if (gl_LocalInvocationIndex <= 3) c373 = b5 - b7 - b8 + b9; + if (gl_LocalInvocationIndex <= 0) c374 = b6 + b7 + b8 + b9; + if (gl_LocalInvocationIndex <= 2) c375 = b0 + b1 + b2 + b3 - b4; + if (gl_LocalInvocationIndex < 0) c376 = b0 + b1 + b2 - b3 - b5; + if (gl_LocalInvocationIndex > 3) c377 = b0 + b1 - b2 + b3 + b6; + if (gl_LocalInvocationIndex != 0) c378 = b0 - b1 - b2 - b3 + b7; + if (gl_LocalInvocationIndex >= 3) c379 = b0 - b1 - b2 + b3 - b8; + if (gl_LocalInvocationIndex <= 3) c38 = b5 - b9; + if (gl_LocalInvocationIndex <= 0) c380 = b0 - b1 - b2 - b3 - b9; + if (gl_LocalInvocationIndex < 3) c381 = b0 + b1 + b2 + b4 - b5; + if (gl_LocalInvocationIndex >= 0) c382 = b0 - b1 + b2 + b4 + b6; + if (gl_LocalInvocationIndex <= 1) c383 = b0 - b1 + b2 - b4 - b7; + if (gl_LocalInvocationIndex != 1) c384 = b0 + b1 - b2 + b4 - b8; + if (gl_LocalInvocationIndex != 2) c385 = b0 - b1 + b2 + b4 - b9; + if (gl_LocalInvocationIndex <= 3) c386 = b0 + b1 + b2 - b5 + b6; + if (gl_LocalInvocationIndex < 1) c387 = b0 - b1 - b2 + b5 - b7; + if (gl_LocalInvocationIndex > 1) c388 = b0 + b1 + b2 - b5 - b8; + if (gl_LocalInvocationIndex <= 2) c389 = b0 + b1 - b2 - b5 - b9; + if (gl_LocalInvocationIndex <= 2) c39 = b6 - b7; + if (gl_LocalInvocationIndex == 3) c390 = b0 + b1 + b2 + b6 - b7; + if (gl_LocalInvocationIndex != 1) c391 = b0 + b1 - b2 - b6 + b8; + if (gl_LocalInvocationIndex == 0) c392 = b0 - b1 + b2 - b6 - b9; + if (gl_LocalInvocationIndex != 0) c393 = b0 + b1 - b2 - b7 + b8; + if (gl_LocalInvocationIndex <= 0) c394 = b0 + b1 + b2 - b7 + b9; + if (gl_LocalInvocationIndex >= 0) c395 = b0 + b1 + b2 + b8 + b9; + if (gl_LocalInvocationIndex == 3) c396 = b0 + b1 + b3 - b4 + b5; + if (gl_LocalInvocationIndex == 1) c397 = b0 + b1 - b3 + b4 - b6; + if (gl_LocalInvocationIndex > 0) c398 = b0 + b1 - b3 - b4 - b7; + if (gl_LocalInvocationIndex >= 1) c399 = b0 - b1 + b3 - b4 + b8; + if (gl_LocalInvocationIndex <= 1) c4 = b0 - b5; + if (gl_LocalInvocationIndex != 1) c40 = b6 + b8; + if (gl_LocalInvocationIndex > 0) c400 = b0 - b1 + b3 - b4 - b9; + if (gl_LocalInvocationIndex != 1) c401 = b0 + b1 - b3 - b5 + b6; + if (gl_LocalInvocationIndex >= 3) c402 = b0 - b1 + b3 - b5 + b7; + if (gl_LocalInvocationIndex < 0) c403 = b0 + b1 + b3 - b5 + b8; + if (gl_LocalInvocationIndex < 3) c404 = b0 + b1 - b3 - b5 - b9; + if (gl_LocalInvocationIndex < 0) c405 = b0 - b1 + b3 + b6 + b7; + if (gl_LocalInvocationIndex == 3) c406 = b0 + b1 - b3 - b6 + b8; + if (gl_LocalInvocationIndex == 2) c407 = b0 - b1 + b3 - b6 - b9; + if (gl_LocalInvocationIndex != 3) c408 = b0 - b1 + b3 - b7 + b8; + if (gl_LocalInvocationIndex != 1) c409 = b0 - b1 + b3 + b7 - b9; + if (gl_LocalInvocationIndex != 1) c41 = b6 - b9; + if (gl_LocalInvocationIndex != 2) c410 = b0 - b1 + b3 + b8 + b9; + if (gl_LocalInvocationIndex < 3) c411 = b0 - b1 - b4 + b5 + b6; + if (gl_LocalInvocationIndex < 0) c412 = b0 + b1 - b4 - b5 - b7; + if (gl_LocalInvocationIndex < 0) c413 = b0 + b1 + b4 - b5 + b8; + if (gl_LocalInvocationIndex < 3) c414 = b0 + b1 - b4 - b5 + b9; + if (gl_LocalInvocationIndex > 1) c415 = b0 + b1 - b4 - b6 + b7; + if (gl_LocalInvocationIndex > 2) c416 = b0 + b1 - b4 - b6 + b8; + if (gl_LocalInvocationIndex <= 0) c417 = b0 - b1 - b4 + b6 - b9; + if (gl_LocalInvocationIndex >= 0) c418 = b0 - b1 + b4 + b7 - b8; + if (gl_LocalInvocationIndex != 3) c419 = b0 + b1 + b4 + b7 - b9; + if (gl_LocalInvocationIndex < 2) c42 = b7 - b8; + if (gl_LocalInvocationIndex != 0) c420 = b0 - b1 + b4 - b8 + b9; + if (gl_LocalInvocationIndex > 0) c421 = b0 + b1 - b5 - b6 - b7; + if (gl_LocalInvocationIndex <= 0) c422 = b0 + b1 - b5 + b6 - b8; + if (gl_LocalInvocationIndex <= 3) c423 = b0 + b1 - b5 + b6 + b9; + if (gl_LocalInvocationIndex >= 3) c424 = b0 + b1 - b5 - b7 - b8; + if (gl_LocalInvocationIndex > 3) c425 = b0 + b1 - b5 + b7 + b9; + if (gl_LocalInvocationIndex <= 0) c426 = b0 - b1 - b5 + b8 + b9; + if (gl_LocalInvocationIndex < 1) c427 = b0 - b1 + b6 - b7 + b8; + if (gl_LocalInvocationIndex != 1) c428 = b0 - b1 - b6 - b7 - b9; + if (gl_LocalInvocationIndex <= 0) c429 = b0 + b1 + b6 - b8 + b9; + if (gl_LocalInvocationIndex != 1) c43 = b7 - b9; + if (gl_LocalInvocationIndex == 1) c430 = b0 + b1 - b7 + b8 + b9; + if (gl_LocalInvocationIndex == 3) c431 = b0 + b2 + b3 - b4 + b5; + if (gl_LocalInvocationIndex < 0) c432 = b0 + b2 - b3 - b4 + b6; + if (gl_LocalInvocationIndex > 1) c433 = b0 + b2 + b3 - b4 - b7; + if (gl_LocalInvocationIndex < 2) c434 = b0 + b2 + b3 + b4 - b8; + if (gl_LocalInvocationIndex < 2) c435 = b0 + b2 - b3 - b4 - b9; + if (gl_LocalInvocationIndex > 0) c436 = b0 + b2 + b3 + b5 - b6; + if (gl_LocalInvocationIndex >= 2) c437 = b0 - b2 + b3 + b5 - b7; + if (gl_LocalInvocationIndex != 3) c438 = b0 - b2 + b3 - b5 + b8; + if (gl_LocalInvocationIndex <= 0) c439 = b0 + b2 + b3 - b5 + b9; + if (gl_LocalInvocationIndex != 1) c44 = b8 - b9; + if (gl_LocalInvocationIndex > 3) c440 = b0 - b2 + b3 + b6 - b7; + if (gl_LocalInvocationIndex == 1) c441 = b0 + b2 + b3 - b6 + b8; + if (gl_LocalInvocationIndex <= 2) c442 = b0 + b2 + b3 - b6 + b9; + if (gl_LocalInvocationIndex != 2) c443 = b0 + b2 + b3 + b7 - b8; + if (gl_LocalInvocationIndex < 1) c444 = b0 - b2 - b3 - b7 - b9; + if (gl_LocalInvocationIndex != 0) c445 = b0 - b2 + b3 + b8 - b9; + if (gl_LocalInvocationIndex <= 2) c446 = b0 - b2 - b4 + b5 - b6; + if (gl_LocalInvocationIndex == 0) c447 = b0 + b2 + b4 - b5 - b7; + if (gl_LocalInvocationIndex >= 2) c448 = b0 + b2 - b4 - b5 - b8; + if (gl_LocalInvocationIndex > 3) c449 = b0 - b2 + b4 - b5 + b9; + if (gl_LocalInvocationIndex < 3) c45 = b0 + b1 - b2; + if (gl_LocalInvocationIndex == 1) c450 = b0 + b2 + b4 + b6 - b7; + if (gl_LocalInvocationIndex > 0) c451 = b0 + b2 + b4 + b6 + b8; + if (gl_LocalInvocationIndex <= 0) c452 = b0 + b2 + b4 + b6 + b9; + if (gl_LocalInvocationIndex <= 0) c453 = b0 + b2 + b4 + b7 - b8; + if (gl_LocalInvocationIndex <= 1) c454 = b0 - b2 + b4 + b7 + b9; + if (gl_LocalInvocationIndex != 3) c455 = b0 + b2 + b4 + b8 + b9; + if (gl_LocalInvocationIndex >= 0) c456 = b0 - b2 + b5 - b6 - b7; + if (gl_LocalInvocationIndex != 2) c457 = b0 - b2 - b5 - b6 + b8; + if (gl_LocalInvocationIndex >= 2) c458 = b0 + b2 + b5 + b6 + b9; + if (gl_LocalInvocationIndex == 2) c459 = b0 - b2 - b5 + b7 - b8; + if (gl_LocalInvocationIndex <= 2) c46 = b0 + b1 - b3; + if (gl_LocalInvocationIndex < 0) c460 = b0 - b2 + b5 + b7 - b9; + if (gl_LocalInvocationIndex != 0) c461 = b0 - b2 + b5 - b8 + b9; + if (gl_LocalInvocationIndex >= 2) c462 = b0 - b2 - b6 + b7 - b8; + if (gl_LocalInvocationIndex < 2) c463 = b0 - b2 - b6 - b7 + b9; + if (gl_LocalInvocationIndex <= 3) c464 = b0 + b2 + b6 + b8 + b9; + if (gl_LocalInvocationIndex != 0) c465 = b0 - b2 + b7 + b8 - b9; + if (gl_LocalInvocationIndex == 1) c466 = b0 + b3 + b4 - b5 + b6; + if (gl_LocalInvocationIndex >= 1) c467 = b0 - b3 - b4 - b5 - b7; + if (gl_LocalInvocationIndex == 0) c468 = b0 - b3 + b4 - b5 - b8; + if (gl_LocalInvocationIndex <= 3) c469 = b0 - b3 - b4 - b5 - b9; + if (gl_LocalInvocationIndex != 3) c47 = b0 + b1 + b4; + if (gl_LocalInvocationIndex == 0) c470 = b0 - b3 + b4 - b6 - b7; + if (gl_LocalInvocationIndex <= 3) c471 = b0 + b3 + b4 - b6 + b8; + if (gl_LocalInvocationIndex > 1) c472 = b0 - b3 - b4 + b6 - b9; + if (gl_LocalInvocationIndex >= 2) c473 = b0 - b3 - b4 - b7 + b8; + if (gl_LocalInvocationIndex <= 1) c474 = b0 + b3 + b4 - b7 + b9; + if (gl_LocalInvocationIndex == 2) c475 = b0 + b3 - b4 - b8 - b9; + if (gl_LocalInvocationIndex > 2) c476 = b0 + b3 - b5 - b6 + b7; + if (gl_LocalInvocationIndex != 3) c477 = b0 - b3 - b5 + b6 + b8; + if (gl_LocalInvocationIndex == 3) c478 = b0 + b3 - b5 + b6 + b9; + if (gl_LocalInvocationIndex != 3) c479 = b0 + b3 - b5 + b7 + b8; + if (gl_LocalInvocationIndex != 0) c48 = b0 + b1 - b5; + if (gl_LocalInvocationIndex <= 3) c480 = b0 - b3 + b5 + b7 - b9; + if (gl_LocalInvocationIndex != 2) c481 = b0 + b3 + b5 - b8 - b9; + if (gl_LocalInvocationIndex != 0) c482 = b0 - b3 - b6 + b7 - b8; + if (gl_LocalInvocationIndex <= 3) c483 = b0 + b3 + b6 - b7 - b9; + if (gl_LocalInvocationIndex <= 1) c484 = b0 + b3 - b6 + b8 - b9; + if (gl_LocalInvocationIndex > 1) c485 = b0 - b3 - b7 + b8 - b9; + if (gl_LocalInvocationIndex == 0) c486 = b0 + b4 + b5 + b6 + b7; + if (gl_LocalInvocationIndex != 2) c487 = b0 - b4 - b5 + b6 - b8; + if (gl_LocalInvocationIndex <= 0) c488 = b0 - b4 + b5 - b6 + b9; + if (gl_LocalInvocationIndex >= 3) c489 = b0 - b4 - b5 - b7 - b8; + if (gl_LocalInvocationIndex <= 2) c49 = b0 - b1 - b6; + if (gl_LocalInvocationIndex <= 1) c490 = b0 + b4 - b5 - b7 + b9; + if (gl_LocalInvocationIndex > 2) c491 = b0 + b4 - b5 + b8 - b9; + if (gl_LocalInvocationIndex > 2) c492 = b0 - b4 - b6 + b7 - b8; + if (gl_LocalInvocationIndex > 3) c493 = b0 - b4 - b6 - b7 - b9; + if (gl_LocalInvocationIndex > 0) c494 = b0 + b4 + b6 + b8 - b9; + if (gl_LocalInvocationIndex > 2) c495 = b0 + b4 + b7 - b8 - b9; + if (gl_LocalInvocationIndex <= 0) c496 = b0 + b5 - b6 - b7 + b8; + if (gl_LocalInvocationIndex != 2) c497 = b0 - b5 + b6 + b7 + b9; + if (gl_LocalInvocationIndex <= 0) c498 = b0 + b5 - b6 - b8 - b9; + if (gl_LocalInvocationIndex >= 0) c499 = b0 - b5 + b7 - b8 - b9; + if (gl_LocalInvocationIndex >= 0) c5 = b0 + b6; + if (gl_LocalInvocationIndex < 0) c50 = b0 + b1 + b7; + if (gl_LocalInvocationIndex == 0) c500 = b0 + b6 + b7 - b8 + b9; + if (gl_LocalInvocationIndex == 0) c501 = b1 + b2 - b3 + b4 + b5; + if (gl_LocalInvocationIndex <= 1) c502 = b1 - b2 - b3 - b4 + b6; + if (gl_LocalInvocationIndex > 0) c503 = b1 + b2 + b3 + b4 - b7; + if (gl_LocalInvocationIndex >= 1) c504 = b1 + b2 - b3 - b4 - b8; + if (gl_LocalInvocationIndex != 1) c505 = b1 - b2 + b3 + b4 + b9; + if (gl_LocalInvocationIndex == 2) c506 = b1 + b2 + b3 + b5 + b6; + if (gl_LocalInvocationIndex == 2) c507 = b1 - b2 + b3 - b5 - b7; + if (gl_LocalInvocationIndex > 2) c508 = b1 + b2 + b3 - b5 - b8; + if (gl_LocalInvocationIndex == 1) c509 = b1 + b2 - b3 - b5 - b9; + if (gl_LocalInvocationIndex > 2) c51 = b0 + b1 + b8; + if (gl_LocalInvocationIndex >= 3) c510 = b1 - b2 + b3 - b6 - b7; + if (gl_LocalInvocationIndex == 0) c511 = b1 + b2 + b3 - b6 + b8; + if (gl_LocalInvocationIndex < 1) c512 = b1 + b2 - b3 - b6 + b9; + if (gl_LocalInvocationIndex < 0) c513 = b1 - b2 - b3 - b7 - b8; + if (gl_LocalInvocationIndex < 3) c514 = b1 + b2 - b3 - b7 + b9; + if (gl_LocalInvocationIndex > 3) c515 = b1 - b2 - b3 - b8 - b9; + if (gl_LocalInvocationIndex != 2) c516 = b1 - b2 + b4 + b5 + b6; + if (gl_LocalInvocationIndex < 0) c517 = b1 - b2 - b4 + b5 - b7; + if (gl_LocalInvocationIndex <= 0) c518 = b1 + b2 + b4 - b5 + b8; + if (gl_LocalInvocationIndex == 3) c519 = b1 - b2 + b4 + b5 + b9; + if (gl_LocalInvocationIndex != 0) c52 = b0 - b1 + b9; + if (gl_LocalInvocationIndex < 2) c520 = b1 + b2 - b4 - b6 - b7; + if (gl_LocalInvocationIndex >= 3) c521 = b1 - b2 - b4 - b6 - b8; + if (gl_LocalInvocationIndex < 2) c522 = b1 - b2 - b4 - b6 - b9; + if (gl_LocalInvocationIndex >= 0) c523 = b1 - b2 - b4 - b7 - b8; + if (gl_LocalInvocationIndex <= 1) c524 = b1 + b2 - b4 + b7 + b9; + if (gl_LocalInvocationIndex <= 2) c525 = b1 - b2 - b4 + b8 + b9; + if (gl_LocalInvocationIndex != 3) c526 = b1 - b2 - b5 + b6 - b7; + if (gl_LocalInvocationIndex < 3) c527 = b1 + b2 + b5 + b6 + b8; + if (gl_LocalInvocationIndex == 3) c528 = b1 + b2 - b5 - b6 + b9; + if (gl_LocalInvocationIndex == 2) c529 = b1 - b2 - b5 - b7 + b8; + if (gl_LocalInvocationIndex < 2) c53 = b0 - b2 + b3; + if (gl_LocalInvocationIndex <= 2) c530 = b1 + b2 + b5 - b7 + b9; + if (gl_LocalInvocationIndex != 1) c531 = b1 - b2 - b5 + b8 - b9; + if (gl_LocalInvocationIndex != 2) c532 = b1 - b2 + b6 - b7 + b8; + if (gl_LocalInvocationIndex <= 2) c533 = b1 + b2 - b6 + b7 + b9; + if (gl_LocalInvocationIndex != 2) c534 = b1 + b2 + b6 + b8 + b9; + if (gl_LocalInvocationIndex >= 0) c535 = b1 - b2 - b7 - b8 + b9; + if (gl_LocalInvocationIndex > 0) c536 = b1 - b3 - b4 + b5 + b6; + if (gl_LocalInvocationIndex >= 1) c537 = b1 - b3 + b4 + b5 - b7; + if (gl_LocalInvocationIndex >= 3) c538 = b1 - b3 + b4 - b5 - b8; + if (gl_LocalInvocationIndex > 1) c539 = b1 - b3 + b4 - b5 + b9; + if (gl_LocalInvocationIndex >= 1) c54 = b0 + b2 + b4; + if (gl_LocalInvocationIndex <= 0) c540 = b1 + b3 - b4 - b6 + b7; + if (gl_LocalInvocationIndex < 1) c541 = b1 - b3 + b4 - b6 + b8; + if (gl_LocalInvocationIndex <= 1) c542 = b1 + b3 + b4 - b6 + b9; + if (gl_LocalInvocationIndex <= 1) c543 = b1 - b3 + b4 + b7 + b8; + if (gl_LocalInvocationIndex < 1) c544 = b1 + b3 - b4 + b7 - b9; + if (gl_LocalInvocationIndex > 1) c545 = b1 + b3 - b4 + b8 - b9; + if (gl_LocalInvocationIndex > 2) c546 = b1 - b3 + b5 + b6 + b7; + if (gl_LocalInvocationIndex <= 2) c547 = b1 + b3 + b5 + b6 + b8; + if (gl_LocalInvocationIndex < 1) c548 = b1 + b3 + b5 - b6 - b9; + if (gl_LocalInvocationIndex > 3) c549 = b1 + b3 + b5 - b7 - b8; + if (gl_LocalInvocationIndex < 1) c55 = b0 - b2 + b5; + if (gl_LocalInvocationIndex != 2) c550 = b1 - b3 + b5 + b7 + b9; + if (gl_LocalInvocationIndex != 2) c551 = b1 + b3 + b5 - b8 + b9; + if (gl_LocalInvocationIndex < 0) c552 = b1 - b3 - b6 - b7 + b8; + if (gl_LocalInvocationIndex == 0) c553 = b1 + b3 + b6 + b7 - b9; + if (gl_LocalInvocationIndex >= 2) c554 = b1 + b3 - b6 - b8 + b9; + if (gl_LocalInvocationIndex != 3) c555 = b1 - b3 - b7 + b8 - b9; + if (gl_LocalInvocationIndex >= 0) c556 = b1 + b4 - b5 - b6 - b7; + if (gl_LocalInvocationIndex < 2) c557 = b1 - b4 + b5 - b6 - b8; + if (gl_LocalInvocationIndex <= 1) c558 = b1 - b4 - b5 - b6 + b9; + if (gl_LocalInvocationIndex > 2) c559 = b1 + b4 + b5 - b7 + b8; + if (gl_LocalInvocationIndex == 2) c56 = b0 - b2 - b6; + if (gl_LocalInvocationIndex < 1) c560 = b1 + b4 - b5 + b7 + b9; + if (gl_LocalInvocationIndex <= 0) c561 = b1 - b4 - b5 + b8 + b9; + if (gl_LocalInvocationIndex == 2) c562 = b1 - b4 - b6 + b7 + b8; + if (gl_LocalInvocationIndex == 1) c563 = b1 + b4 - b6 - b7 - b9; + if (gl_LocalInvocationIndex > 1) c564 = b1 - b4 - b6 - b8 - b9; + if (gl_LocalInvocationIndex == 2) c565 = b1 + b4 - b7 + b8 + b9; + if (gl_LocalInvocationIndex == 2) c566 = b1 + b5 - b6 - b7 - b8; + if (gl_LocalInvocationIndex == 0) c567 = b1 - b5 - b6 - b7 + b9; + if (gl_LocalInvocationIndex <= 3) c568 = b1 - b5 - b6 + b8 + b9; + if (gl_LocalInvocationIndex > 0) c569 = b1 + b5 - b7 - b8 - b9; + if (gl_LocalInvocationIndex > 2) c57 = b0 - b2 + b7; + if (gl_LocalInvocationIndex == 0) c570 = b1 - b6 - b7 - b8 + b9; + if (gl_LocalInvocationIndex > 3) c571 = b2 - b3 + b4 + b5 - b6; + if (gl_LocalInvocationIndex < 2) c572 = b2 - b3 - b4 - b5 + b7; + if (gl_LocalInvocationIndex != 3) c573 = b2 + b3 + b4 + b5 - b8; + if (gl_LocalInvocationIndex <= 1) c574 = b2 - b3 - b4 - b5 + b9; + if (gl_LocalInvocationIndex < 0) c575 = b2 - b3 + b4 + b6 - b7; + if (gl_LocalInvocationIndex < 1) c576 = b2 + b3 + b4 + b6 + b8; + if (gl_LocalInvocationIndex == 2) c577 = b2 - b3 + b4 - b6 - b9; + if (gl_LocalInvocationIndex < 0) c578 = b2 - b3 - b4 + b7 - b8; + if (gl_LocalInvocationIndex <= 3) c579 = b2 + b3 - b4 + b7 - b9; + if (gl_LocalInvocationIndex > 3) c58 = b0 - b2 + b8; + if (gl_LocalInvocationIndex <= 2) c580 = b2 - b3 + b4 - b8 - b9; + if (gl_LocalInvocationIndex >= 2) c581 = b2 + b3 - b5 + b6 - b7; + if (gl_LocalInvocationIndex != 1) c582 = b2 + b3 + b5 - b6 + b8; + if (gl_LocalInvocationIndex == 3) c583 = b2 - b3 + b5 - b6 - b9; + if (gl_LocalInvocationIndex != 0) c584 = b2 - b3 + b5 + b7 + b8; + if (gl_LocalInvocationIndex > 1) c585 = b2 + b3 + b5 + b7 - b9; + if (gl_LocalInvocationIndex >= 0) c586 = b2 - b3 + b5 - b8 - b9; + if (gl_LocalInvocationIndex <= 0) c587 = b2 - b3 - b6 + b7 - b8; + if (gl_LocalInvocationIndex < 0) c588 = b2 - b3 - b6 + b7 - b9; + if (gl_LocalInvocationIndex >= 3) c589 = b2 - b3 - b6 + b8 - b9; + if (gl_LocalInvocationIndex >= 0) c59 = b0 + b2 + b9; + if (gl_LocalInvocationIndex > 1) c590 = b2 - b3 - b7 + b8 + b9; + if (gl_LocalInvocationIndex >= 0) c591 = b2 + b4 - b5 + b6 - b7; + if (gl_LocalInvocationIndex > 1) c592 = b2 - b4 + b5 - b6 - b8; + if (gl_LocalInvocationIndex > 1) c593 = b2 + b4 + b5 + b6 + b9; + if (gl_LocalInvocationIndex < 1) c594 = b2 + b4 - b5 + b7 - b8; + if (gl_LocalInvocationIndex == 0) c595 = b2 - b4 + b5 + b7 - b9; + if (gl_LocalInvocationIndex == 1) c596 = b2 - b4 - b5 + b8 - b9; + if (gl_LocalInvocationIndex < 1) c597 = b2 + b4 + b6 + b7 - b8; + if (gl_LocalInvocationIndex < 0) c598 = b2 + b4 + b6 - b7 - b9; + if (gl_LocalInvocationIndex < 2) c599 = b2 + b4 + b6 - b8 - b9; + if (gl_LocalInvocationIndex != 3) c6 = b0 - b7; + if (gl_LocalInvocationIndex <= 3) c60 = b0 + b3 + b4; + if (gl_LocalInvocationIndex < 1) c600 = b2 + b4 + b7 - b8 + b9; + if (gl_LocalInvocationIndex >= 3) c601 = b2 - b5 - b6 - b7 - b8; + if (gl_LocalInvocationIndex >= 0) c602 = b2 - b5 + b6 + b7 - b9; + if (gl_LocalInvocationIndex < 0) c603 = b2 + b5 - b6 + b8 - b9; + if (gl_LocalInvocationIndex > 1) c604 = b2 - b5 - b7 - b8 + b9; + if (gl_LocalInvocationIndex > 2) c605 = b2 - b6 + b7 - b8 - b9; + if (gl_LocalInvocationIndex <= 0) c606 = b3 + b4 + b5 - b6 - b7; + if (gl_LocalInvocationIndex < 3) c607 = b3 - b4 - b5 + b6 + b8; + if (gl_LocalInvocationIndex == 2) c608 = b3 - b4 + b5 + b6 - b9; + if (gl_LocalInvocationIndex != 1) c609 = b3 + b4 + b5 - b7 - b8; + if (gl_LocalInvocationIndex < 3) c61 = b0 + b3 - b5; + if (gl_LocalInvocationIndex != 0) c610 = b3 + b4 + b5 + b7 + b9; + if (gl_LocalInvocationIndex <= 3) c611 = b3 - b4 - b5 + b8 + b9; + if (gl_LocalInvocationIndex == 3) c612 = b3 + b4 - b6 - b7 - b8; + if (gl_LocalInvocationIndex > 3) c613 = b3 + b4 - b6 + b7 + b9; + if (gl_LocalInvocationIndex < 0) c614 = b3 + b4 - b6 + b8 - b9; + if (gl_LocalInvocationIndex > 3) c615 = b3 + b4 + b7 - b8 + b9; + if (gl_LocalInvocationIndex >= 3) c616 = b3 + b5 + b6 - b7 - b8; + if (gl_LocalInvocationIndex == 0) c617 = b3 + b5 + b6 + b7 + b9; + if (gl_LocalInvocationIndex != 3) c618 = b3 - b5 + b6 - b8 - b9; + if (gl_LocalInvocationIndex >= 1) c619 = b3 - b5 + b7 - b8 - b9; + if (gl_LocalInvocationIndex < 2) c62 = b0 + b3 - b6; + if (gl_LocalInvocationIndex > 1) c620 = b3 + b6 + b7 + b8 - b9; + if (gl_LocalInvocationIndex > 0) c621 = b4 - b5 + b6 + b7 - b8; + if (gl_LocalInvocationIndex != 1) c622 = b4 + b5 - b6 - b7 + b9; + if (gl_LocalInvocationIndex >= 1) c623 = b4 + b5 + b6 - b8 + b9; + if (gl_LocalInvocationIndex == 2) c624 = b4 - b5 + b7 + b8 + b9; + if (gl_LocalInvocationIndex < 0) c625 = b4 + b6 + b7 + b8 + b9; + if (gl_LocalInvocationIndex >= 3) c626 = b5 + b6 - b7 - b8 + b9; + if (gl_LocalInvocationIndex < 0) c627 = b0 - b1 - b2 + b3 + b4 - b5; + if (gl_LocalInvocationIndex < 1) c628 = b0 + b1 + b2 - b3 + b4 - b6; + if (gl_LocalInvocationIndex != 1) c629 = b0 + b1 - b2 + b3 - b4 - b7; + if (gl_LocalInvocationIndex != 0) c63 = b0 + b3 - b7; + if (gl_LocalInvocationIndex == 1) c630 = b0 + b1 - b2 - b3 + b4 - b8; + if (gl_LocalInvocationIndex >= 2) c631 = b0 - b1 + b2 + b3 - b4 + b9; + if (gl_LocalInvocationIndex <= 2) c632 = b0 - b1 + b2 - b3 - b5 + b6; + if (gl_LocalInvocationIndex != 1) c633 = b0 + b1 + b2 - b3 + b5 - b7; + if (gl_LocalInvocationIndex >= 1) c634 = b0 + b1 - b2 + b3 + b5 - b8; + if (gl_LocalInvocationIndex <= 0) c635 = b0 - b1 - b2 - b3 + b5 + b9; + if (gl_LocalInvocationIndex <= 1) c636 = b0 + b1 - b2 + b3 - b6 - b7; + if (gl_LocalInvocationIndex <= 1) c637 = b0 - b1 + b2 + b3 - b6 - b8; + if (gl_LocalInvocationIndex == 0) c638 = b0 + b1 - b2 - b3 - b6 - b9; + if (gl_LocalInvocationIndex != 0) c639 = b0 + b1 + b2 + b3 - b7 - b8; + if (gl_LocalInvocationIndex <= 3) c64 = b0 + b3 + b8; + if (gl_LocalInvocationIndex >= 2) c640 = b0 + b1 - b2 - b3 + b7 + b9; + if (gl_LocalInvocationIndex <= 2) c641 = b0 - b1 - b2 + b3 + b8 - b9; + if (gl_LocalInvocationIndex >= 3) c642 = b0 + b1 - b2 + b4 - b5 - b6; + if (gl_LocalInvocationIndex == 2) c643 = b0 + b1 - b2 - b4 + b5 + b7; + if (gl_LocalInvocationIndex != 2) c644 = b0 + b1 + b2 - b4 - b5 + b8; + if (gl_LocalInvocationIndex == 3) c645 = b0 - b1 - b2 + b4 + b5 + b9; + if (gl_LocalInvocationIndex != 3) c646 = b0 - b1 - b2 - b4 - b6 + b7; + if (gl_LocalInvocationIndex == 2) c647 = b0 + b1 + b2 - b4 - b6 - b8; + if (gl_LocalInvocationIndex > 2) c648 = b0 + b1 + b2 + b4 + b6 + b9; + if (gl_LocalInvocationIndex >= 0) c649 = b0 + b1 + b2 - b4 - b7 - b8; + if (gl_LocalInvocationIndex >= 1) c65 = b0 - b3 + b9; + if (gl_LocalInvocationIndex > 0) c650 = b0 + b1 + b2 + b4 + b7 - b9; + if (gl_LocalInvocationIndex >= 0) c651 = b0 - b1 + b2 - b4 - b8 + b9; + if (gl_LocalInvocationIndex != 0) c652 = b0 + b1 + b2 - b5 + b6 - b7; + if (gl_LocalInvocationIndex != 3) c653 = b0 - b1 - b2 - b5 + b6 - b8; + if (gl_LocalInvocationIndex == 1) c654 = b0 + b1 + b2 - b5 + b6 - b9; + if (gl_LocalInvocationIndex == 3) c655 = b0 + b1 - b2 + b5 - b7 + b8; + if (gl_LocalInvocationIndex < 0) c656 = b0 - b1 - b2 - b5 + b7 + b9; + if (gl_LocalInvocationIndex == 2) c657 = b0 + b1 - b2 + b5 + b8 - b9; + if (gl_LocalInvocationIndex <= 3) c658 = b0 + b1 + b2 - b6 - b7 - b8; + if (gl_LocalInvocationIndex <= 2) c659 = b0 - b1 - b2 + b6 - b7 + b9; + if (gl_LocalInvocationIndex <= 0) c66 = b0 - b4 - b5; + if (gl_LocalInvocationIndex != 2) c660 = b0 + b1 + b2 - b6 - b8 + b9; + if (gl_LocalInvocationIndex == 2) c661 = b0 - b1 - b2 + b7 - b8 - b9; + if (gl_LocalInvocationIndex == 0) c662 = b0 + b1 + b3 + b4 - b5 - b6; + if (gl_LocalInvocationIndex != 2) c663 = b0 - b1 - b3 + b4 - b5 - b7; + if (gl_LocalInvocationIndex < 2) c664 = b0 - b1 + b3 - b4 + b5 + b8; + if (gl_LocalInvocationIndex <= 1) c665 = b0 - b1 + b3 - b4 + b5 - b9; + if (gl_LocalInvocationIndex >= 0) c666 = b0 + b1 - b3 - b4 + b6 - b7; + if (gl_LocalInvocationIndex <= 2) c667 = b0 - b1 - b3 - b4 + b6 - b8; + if (gl_LocalInvocationIndex == 2) c668 = b0 - b1 + b3 + b4 - b6 - b9; + if (gl_LocalInvocationIndex != 3) c669 = b0 + b1 + b3 + b4 + b7 - b8; + if (gl_LocalInvocationIndex != 2) c67 = b0 - b4 + b6; + if (gl_LocalInvocationIndex != 0) c670 = b0 + b1 + b3 - b4 + b7 - b9; + if (gl_LocalInvocationIndex != 2) c671 = b0 - b1 + b3 + b4 + b8 - b9; + if (gl_LocalInvocationIndex <= 2) c672 = b0 + b1 + b3 + b5 + b6 + b7; + if (gl_LocalInvocationIndex > 1) c673 = b0 + b1 + b3 - b5 - b6 + b8; + if (gl_LocalInvocationIndex < 3) c674 = b0 + b1 + b3 - b5 + b6 + b9; + if (gl_LocalInvocationIndex > 0) c675 = b0 + b1 - b3 + b5 + b7 - b8; + if (gl_LocalInvocationIndex >= 0) c676 = b0 + b1 + b3 - b5 + b7 + b9; + if (gl_LocalInvocationIndex < 1) c677 = b0 - b1 - b3 - b5 - b8 - b9; + if (gl_LocalInvocationIndex >= 0) c678 = b0 + b1 - b3 - b6 + b7 - b8; + if (gl_LocalInvocationIndex < 2) c679 = b0 - b1 - b3 - b6 + b7 + b9; + if (gl_LocalInvocationIndex < 0) c68 = b0 + b4 - b7; + if (gl_LocalInvocationIndex == 2) c680 = b0 - b1 - b3 + b6 - b8 + b9; + if (gl_LocalInvocationIndex > 2) c681 = b0 - b1 + b3 + b7 + b8 - b9; + if (gl_LocalInvocationIndex < 3) c682 = b0 - b1 + b4 - b5 + b6 + b7; + if (gl_LocalInvocationIndex > 1) c683 = b0 + b1 - b4 - b5 - b6 + b8; + if (gl_LocalInvocationIndex == 1) c684 = b0 - b1 - b4 - b5 - b6 - b9; + if (gl_LocalInvocationIndex <= 0) c685 = b0 + b1 - b4 + b5 + b7 + b8; + if (gl_LocalInvocationIndex > 2) c686 = b0 + b1 - b4 + b5 + b7 - b9; + if (gl_LocalInvocationIndex == 3) c687 = b0 - b1 + b4 - b5 - b8 + b9; + if (gl_LocalInvocationIndex != 0) c688 = b0 - b1 - b4 + b6 + b7 - b8; + if (gl_LocalInvocationIndex != 2) c689 = b0 - b1 + b4 + b6 + b7 - b9; + if (gl_LocalInvocationIndex == 1) c69 = b0 - b4 + b8; + if (gl_LocalInvocationIndex != 1) c690 = b0 - b1 + b4 + b6 - b8 + b9; + if (gl_LocalInvocationIndex != 3) c691 = b0 + b1 - b4 - b7 + b8 - b9; + if (gl_LocalInvocationIndex >= 1) c692 = b0 - b1 + b5 + b6 + b7 - b8; + if (gl_LocalInvocationIndex == 0) c693 = b0 - b1 + b5 + b6 + b7 + b9; + if (gl_LocalInvocationIndex != 1) c694 = b0 + b1 + b5 + b6 + b8 - b9; + if (gl_LocalInvocationIndex < 2) c695 = b0 + b1 + b5 + b7 + b8 + b9; + if (gl_LocalInvocationIndex == 0) c696 = b0 - b1 - b6 + b7 - b8 + b9; + if (gl_LocalInvocationIndex < 0) c697 = b0 - b2 + b3 - b4 - b5 + b6; + if (gl_LocalInvocationIndex <= 3) c698 = b0 + b2 - b3 - b4 + b5 + b7; + if (gl_LocalInvocationIndex > 2) c699 = b0 - b2 - b3 + b4 + b5 + b8; + if (gl_LocalInvocationIndex >= 2) c7 = b0 - b8; + if (gl_LocalInvocationIndex <= 1) c70 = b0 - b4 + b9; + if (gl_LocalInvocationIndex < 1) c700 = b0 - b2 - b3 - b4 + b5 - b9; + if (gl_LocalInvocationIndex == 1) c701 = b0 + b2 + b3 - b4 + b6 - b7; + if (gl_LocalInvocationIndex == 2) c702 = b0 - b2 - b3 + b4 - b6 - b8; + if (gl_LocalInvocationIndex >= 0) c703 = b0 + b2 + b3 + b4 + b6 + b9; + if (gl_LocalInvocationIndex >= 3) c704 = b0 + b2 + b3 + b4 + b7 - b8; + if (gl_LocalInvocationIndex < 1) c705 = b0 + b2 - b3 + b4 + b7 - b9; + if (gl_LocalInvocationIndex > 3) c706 = b0 - b2 + b3 - b4 + b8 - b9; + if (gl_LocalInvocationIndex < 2) c707 = b0 + b2 + b3 + b5 + b6 + b7; + if (gl_LocalInvocationIndex >= 2) c708 = b0 + b2 + b3 - b5 - b6 + b8; + if (gl_LocalInvocationIndex != 3) c709 = b0 - b2 - b3 + b5 - b6 + b9; + if (gl_LocalInvocationIndex < 1) c71 = b0 + b5 + b6; + if (gl_LocalInvocationIndex != 0) c710 = b0 - b2 - b3 - b5 - b7 + b8; + if (gl_LocalInvocationIndex == 0) c711 = b0 + b2 + b3 - b5 + b7 + b9; + if (gl_LocalInvocationIndex == 2) c712 = b0 + b2 + b3 - b5 + b8 + b9; + if (gl_LocalInvocationIndex == 1) c713 = b0 - b2 - b3 - b6 + b7 + b8; + if (gl_LocalInvocationIndex >= 2) c714 = b0 - b2 - b3 + b6 - b7 + b9; + if (gl_LocalInvocationIndex < 3) c715 = b0 - b2 - b3 - b6 + b8 - b9; + if (gl_LocalInvocationIndex != 2) c716 = b0 - b2 - b3 + b7 - b8 + b9; + if (gl_LocalInvocationIndex == 0) c717 = b0 - b2 - b4 - b5 + b6 + b7; + if (gl_LocalInvocationIndex >= 3) c718 = b0 + b2 + b4 - b5 - b6 + b8; + if (gl_LocalInvocationIndex <= 3) c719 = b0 - b2 - b4 - b5 + b6 - b9; + if (gl_LocalInvocationIndex > 0) c72 = b0 - b5 - b7; + if (gl_LocalInvocationIndex == 3) c720 = b0 - b2 + b4 + b5 + b7 + b8; + if (gl_LocalInvocationIndex <= 2) c721 = b0 - b2 + b4 + b5 + b7 - b9; + if (gl_LocalInvocationIndex <= 0) c722 = b0 + b2 - b4 - b5 - b8 + b9; + if (gl_LocalInvocationIndex > 1) c723 = b0 + b2 + b4 - b6 + b7 + b8; + if (gl_LocalInvocationIndex > 3) c724 = b0 + b2 - b4 - b6 - b7 - b9; + if (gl_LocalInvocationIndex == 0) c725 = b0 - b2 + b4 - b6 - b8 - b9; + if (gl_LocalInvocationIndex != 2) c726 = b0 + b2 + b4 + b7 - b8 + b9; + if (gl_LocalInvocationIndex < 3) c727 = b0 - b2 + b5 - b6 - b7 + b8; + if (gl_LocalInvocationIndex <= 3) c728 = b0 + b2 - b5 - b6 - b7 + b9; + if (gl_LocalInvocationIndex != 1) c729 = b0 + b2 + b5 + b6 - b8 - b9; + if (gl_LocalInvocationIndex == 2) c73 = b0 - b5 + b8; + if (gl_LocalInvocationIndex >= 2) c730 = b0 - b2 - b5 - b7 - b8 + b9; + if (gl_LocalInvocationIndex < 3) c731 = b0 + b2 - b6 + b7 - b8 + b9; + if (gl_LocalInvocationIndex >= 1) c732 = b0 + b3 + b4 - b5 + b6 + b7; + if (gl_LocalInvocationIndex != 1) c733 = b0 + b3 + b4 - b5 + b6 - b8; + if (gl_LocalInvocationIndex != 0) c734 = b0 + b3 - b4 + b5 - b6 + b9; + if (gl_LocalInvocationIndex == 1) c735 = b0 + b3 - b4 - b5 + b7 + b8; + if (gl_LocalInvocationIndex == 0) c736 = b0 - b3 - b4 + b5 + b7 + b9; + if (gl_LocalInvocationIndex != 3) c737 = b0 + b3 - b4 + b5 + b8 - b9; + if (gl_LocalInvocationIndex != 3) c738 = b0 + b3 + b4 + b6 - b7 - b8; + if (gl_LocalInvocationIndex == 0) c739 = b0 - b3 - b4 - b6 - b7 + b9; + if (gl_LocalInvocationIndex <= 2) c74 = b0 - b5 + b9; + if (gl_LocalInvocationIndex <= 2) c740 = b0 + b3 + b4 - b6 - b8 - b9; + if (gl_LocalInvocationIndex > 1) c741 = b0 - b3 + b4 + b7 + b8 + b9; + if (gl_LocalInvocationIndex == 3) c742 = b0 + b3 - b5 + b6 + b7 - b8; + if (gl_LocalInvocationIndex < 1) c743 = b0 - b3 - b5 + b6 + b7 - b9; + if (gl_LocalInvocationIndex >= 3) c744 = b0 - b3 + b5 + b6 + b8 + b9; + if (gl_LocalInvocationIndex <= 0) c745 = b0 + b3 + b5 + b7 + b8 + b9; + if (gl_LocalInvocationIndex > 2) c746 = b0 + b3 + b6 + b7 - b8 + b9; + if (gl_LocalInvocationIndex != 1) c747 = b0 + b4 - b5 - b6 + b7 - b8; + if (gl_LocalInvocationIndex != 1) c748 = b0 - b4 - b5 + b6 + b7 + b9; + if (gl_LocalInvocationIndex == 2) c749 = b0 - b4 - b5 + b6 + b8 + b9; + if (gl_LocalInvocationIndex >= 2) c75 = b0 - b6 + b7; + if (gl_LocalInvocationIndex >= 1) c750 = b0 + b4 - b5 - b7 + b8 - b9; + if (gl_LocalInvocationIndex < 1) c751 = b0 + b4 + b6 + b7 + b8 + b9; + if (gl_LocalInvocationIndex < 0) c752 = b0 - b5 - b6 + b7 + b8 + b9; + if (gl_LocalInvocationIndex > 3) c753 = b1 + b2 + b3 + b4 - b5 - b6; + if (gl_LocalInvocationIndex > 0) c754 = b1 - b2 - b3 + b4 + b5 - b7; + if (gl_LocalInvocationIndex < 1) c755 = b1 + b2 - b3 + b4 + b5 - b8; + if (gl_LocalInvocationIndex > 3) c756 = b1 - b2 - b3 - b4 + b5 - b9; + if (gl_LocalInvocationIndex <= 3) c757 = b1 - b2 + b3 - b4 + b6 - b7; + if (gl_LocalInvocationIndex < 3) c758 = b1 + b2 - b3 + b4 - b6 + b8; + if (gl_LocalInvocationIndex > 2) c759 = b1 - b2 + b3 - b4 - b6 + b9; + if (gl_LocalInvocationIndex < 3) c76 = b0 - b6 + b8; + if (gl_LocalInvocationIndex < 3) c760 = b1 + b2 + b3 + b4 + b7 - b8; + if (gl_LocalInvocationIndex == 1) c761 = b1 - b2 - b3 - b4 + b7 - b9; + if (gl_LocalInvocationIndex >= 2) c762 = b1 - b2 - b3 + b4 + b8 - b9; + if (gl_LocalInvocationIndex <= 0) c763 = b1 + b2 - b3 + b5 + b6 - b7; + if (gl_LocalInvocationIndex == 0) c764 = b1 + b2 - b3 - b5 + b6 + b8; + if (gl_LocalInvocationIndex > 2) c765 = b1 + b2 + b3 + b5 + b6 - b9; + if (gl_LocalInvocationIndex != 2) c766 = b1 + b2 + b3 - b5 + b7 + b8; + if (gl_LocalInvocationIndex <= 3) c767 = b1 + b2 - b3 + b5 + b7 - b9; + if (gl_LocalInvocationIndex == 2) c768 = b1 - b2 + b3 - b5 - b8 + b9; + if (gl_LocalInvocationIndex < 3) c769 = b1 + b2 - b3 - b6 - b7 - b8; + if (gl_LocalInvocationIndex >= 0) c77 = b0 + b6 + b9; + if (gl_LocalInvocationIndex > 0) c770 = b1 - b2 + b3 + b6 - b7 - b9; + if (gl_LocalInvocationIndex < 1) c771 = b1 - b2 - b3 + b6 - b8 + b9; + if (gl_LocalInvocationIndex == 1) c772 = b1 - b2 - b3 - b7 - b8 + b9; + if (gl_LocalInvocationIndex > 3) c773 = b1 - b2 - b4 + b5 + b6 + b7; + if (gl_LocalInvocationIndex == 3) c774 = b1 + b2 + b4 - b5 - b6 - b8; + if (gl_LocalInvocationIndex == 0) c775 = b1 + b2 + b4 - b5 - b6 + b9; + if (gl_LocalInvocationIndex >= 1) c776 = b1 - b2 - b4 + b5 + b7 - b8; + if (gl_LocalInvocationIndex == 2) c777 = b1 - b2 + b4 - b5 + b7 - b9; + if (gl_LocalInvocationIndex > 2) c778 = b1 + b2 + b4 - b5 + b8 + b9; + if (gl_LocalInvocationIndex != 3) c779 = b1 - b2 - b4 + b6 + b7 - b8; + if (gl_LocalInvocationIndex < 3) c78 = b0 + b7 + b8; + if (gl_LocalInvocationIndex >= 3) c780 = b1 + b2 - b4 - b6 + b7 - b9; + if (gl_LocalInvocationIndex != 0) c781 = b1 + b2 - b4 + b6 + b8 - b9; + if (gl_LocalInvocationIndex != 2) c782 = b1 - b2 - b4 - b7 + b8 + b9; + if (gl_LocalInvocationIndex != 2) c783 = b1 + b2 + b5 - b6 - b7 + b8; + if (gl_LocalInvocationIndex > 2) c784 = b1 + b2 - b5 + b6 + b7 + b9; + if (gl_LocalInvocationIndex <= 2) c785 = b1 - b2 - b5 + b6 + b8 + b9; + if (gl_LocalInvocationIndex == 1) c786 = b1 + b2 - b5 + b7 + b8 + b9; + if (gl_LocalInvocationIndex >= 0) c787 = b1 - b2 - b6 - b7 - b8 + b9; + if (gl_LocalInvocationIndex != 3) c788 = b1 + b3 - b4 - b5 - b6 + b7; + if (gl_LocalInvocationIndex == 0) c789 = b1 - b3 - b4 + b5 + b6 - b8; + if (gl_LocalInvocationIndex != 3) c79 = b0 + b7 + b9; + if (gl_LocalInvocationIndex <= 1) c790 = b1 - b3 + b4 + b5 + b6 + b9; + if (gl_LocalInvocationIndex != 3) c791 = b1 + b3 - b4 + b5 - b7 - b8; + if (gl_LocalInvocationIndex == 1) c792 = b1 + b3 - b4 + b5 + b7 + b9; + if (gl_LocalInvocationIndex >= 2) c793 = b1 + b3 + b4 + b5 - b8 + b9; + if (gl_LocalInvocationIndex == 2) c794 = b1 + b3 - b4 - b6 - b7 - b8; + if (gl_LocalInvocationIndex < 0) c795 = b1 - b3 - b4 - b6 - b7 - b9; + if (gl_LocalInvocationIndex < 3) c796 = b1 + b3 + b4 + b6 - b8 - b9; + if (gl_LocalInvocationIndex > 3) c797 = b1 - b3 + b4 + b7 + b8 - b9; + if (gl_LocalInvocationIndex == 0) c798 = b1 - b3 + b5 + b6 - b7 - b8; + if (gl_LocalInvocationIndex <= 0) c799 = b1 + b3 + b5 + b6 + b7 - b9; + if (gl_LocalInvocationIndex == 3) c8 = b0 - b9; + if (gl_LocalInvocationIndex >= 3) c80 = b0 + b8 + b9; + if (gl_LocalInvocationIndex >= 1) c800 = b1 + b3 + b5 - b6 + b8 - b9; + if (gl_LocalInvocationIndex == 3) c801 = b1 + b3 - b5 + b7 + b8 + b9; + if (gl_LocalInvocationIndex == 0) c802 = b1 + b3 - b6 + b7 + b8 + b9; + if (gl_LocalInvocationIndex != 0) c803 = b1 - b4 + b5 - b6 + b7 + b8; + if (gl_LocalInvocationIndex >= 1) c804 = b1 - b4 - b5 - b6 - b7 + b9; + if (gl_LocalInvocationIndex != 1) c805 = b1 + b4 - b5 - b6 - b8 + b9; + if (gl_LocalInvocationIndex < 3) c806 = b1 + b4 + b5 - b7 - b8 + b9; + if (gl_LocalInvocationIndex != 0) c807 = b1 - b4 + b6 - b7 + b8 + b9; + if (gl_LocalInvocationIndex <= 1) c808 = b1 - b5 + b6 + b7 + b8 + b9; + if (gl_LocalInvocationIndex != 1) c809 = b2 - b3 + b4 + b5 - b6 + b7; + if (gl_LocalInvocationIndex <= 3) c81 = b1 + b2 + b3; + if (gl_LocalInvocationIndex != 0) c810 = b2 + b3 + b4 - b5 - b6 - b8; + if (gl_LocalInvocationIndex >= 0) c811 = b2 + b3 - b4 + b5 - b6 - b9; + if (gl_LocalInvocationIndex != 1) c812 = b2 + b3 - b4 - b5 + b7 - b8; + if (gl_LocalInvocationIndex < 1) c813 = b2 - b3 + b4 - b5 + b7 + b9; + if (gl_LocalInvocationIndex >= 3) c814 = b2 - b3 - b4 + b5 - b8 + b9; + if (gl_LocalInvocationIndex != 1) c815 = b2 + b3 + b4 + b6 + b7 + b8; + if (gl_LocalInvocationIndex >= 0) c816 = b2 + b3 - b4 + b6 + b7 + b9; + if (gl_LocalInvocationIndex >= 1) c817 = b2 - b3 + b4 - b6 - b8 - b9; + if (gl_LocalInvocationIndex < 3) c818 = b2 + b3 + b4 + b7 - b8 + b9; + if (gl_LocalInvocationIndex < 3) c819 = b2 + b3 - b5 + b6 + b7 - b8; + if (gl_LocalInvocationIndex < 1) c82 = b1 - b2 + b4; + if (gl_LocalInvocationIndex < 0) c820 = b2 - b3 - b5 + b6 + b7 - b9; + if (gl_LocalInvocationIndex <= 1) c821 = b2 + b3 - b5 - b6 - b8 - b9; + if (gl_LocalInvocationIndex != 3) c822 = b2 - b3 + b5 - b7 - b8 - b9; + if (gl_LocalInvocationIndex <= 1) c823 = b2 - b3 + b6 - b7 + b8 + b9; + if (gl_LocalInvocationIndex <= 3) c824 = b2 + b4 - b5 + b6 - b7 - b8; + if (gl_LocalInvocationIndex < 2) c825 = b2 + b4 + b5 - b6 + b7 - b9; + if (gl_LocalInvocationIndex != 0) c826 = b2 - b4 + b5 + b6 - b8 - b9; + if (gl_LocalInvocationIndex > 1) c827 = b2 + b4 - b5 + b7 + b8 - b9; + if (gl_LocalInvocationIndex > 3) c828 = b2 + b4 + b6 - b7 - b8 + b9; + if (gl_LocalInvocationIndex < 1) c829 = b2 + b5 - b6 + b7 - b8 - b9; + if (gl_LocalInvocationIndex < 1) c83 = b1 - b2 + b5; + if (gl_LocalInvocationIndex > 0) c830 = b3 - b4 - b5 - b6 + b7 + b8; + if (gl_LocalInvocationIndex >= 0) c831 = b3 - b4 - b5 - b6 - b7 + b9; + if (gl_LocalInvocationIndex == 0) c832 = b3 - b4 - b5 - b6 + b8 + b9; + if (gl_LocalInvocationIndex <= 1) c833 = b3 - b4 - b5 + b7 - b8 + b9; + if (gl_LocalInvocationIndex <= 3) c834 = b3 + b4 - b6 - b7 - b8 + b9; + if (gl_LocalInvocationIndex <= 2) c835 = b3 + b5 - b6 - b7 + b8 - b9; + if (gl_LocalInvocationIndex < 0) c836 = b4 + b5 - b6 + b7 - b8 + b9; + if (gl_LocalInvocationIndex <= 3) c837 = b0 + b1 - b2 + b3 + b4 + b5 + b6; + if (gl_LocalInvocationIndex == 0) c838 = b0 - b1 - b2 + b3 + b4 - b5 - b7; + if (gl_LocalInvocationIndex == 3) c839 = b0 - b1 - b2 + b3 - b4 + b5 - b8; + if (gl_LocalInvocationIndex <= 3) c84 = b1 - b2 + b6; + if (gl_LocalInvocationIndex > 3) c840 = b0 - b1 - b2 + b3 + b4 + b5 + b9; + if (gl_LocalInvocationIndex < 2) c841 = b0 + b1 + b2 - b3 + b4 - b6 - b7; + if (gl_LocalInvocationIndex <= 2) c842 = b0 - b1 + b2 - b3 + b4 + b6 + b8; + if (gl_LocalInvocationIndex >= 1) c843 = b0 + b1 + b2 + b3 - b4 + b6 + b9; + if (gl_LocalInvocationIndex != 1) c844 = b0 + b1 - b2 - b3 + b4 + b7 - b8; + if (gl_LocalInvocationIndex > 2) c845 = b0 + b1 - b2 + b3 - b4 - b7 - b9; + if (gl_LocalInvocationIndex < 0) c846 = b0 + b1 + b2 - b3 + b4 - b8 - b9; + if (gl_LocalInvocationIndex < 3) c847 = b0 + b1 + b2 + b3 + b5 + b6 - b7; + if (gl_LocalInvocationIndex == 1) c848 = b0 + b1 + b2 + b3 - b5 + b6 - b8; + if (gl_LocalInvocationIndex == 2) c849 = b0 - b1 + b2 - b3 - b5 - b6 - b9; + if (gl_LocalInvocationIndex != 1) c85 = b1 - b2 - b7; + if (gl_LocalInvocationIndex <= 3) c850 = b0 + b1 + b2 - b3 + b5 + b7 - b8; + if (gl_LocalInvocationIndex <= 3) c851 = b0 - b1 + b2 - b3 - b5 + b7 - b9; + if (gl_LocalInvocationIndex >= 2) c852 = b0 - b1 - b2 + b3 - b5 + b8 + b9; + if (gl_LocalInvocationIndex <= 0) c853 = b0 - b1 + b2 - b3 - b6 - b7 + b8; + if (gl_LocalInvocationIndex != 3) c854 = b0 + b1 - b2 - b3 - b6 + b7 + b9; + if (gl_LocalInvocationIndex == 2) c855 = b0 + b1 - b2 - b3 + b6 + b8 - b9; + if (gl_LocalInvocationIndex == 1) c856 = b0 - b1 + b2 + b3 + b7 - b8 + b9; + if (gl_LocalInvocationIndex < 1) c857 = b0 - b1 + b2 - b4 + b5 + b6 - b7; + if (gl_LocalInvocationIndex <= 0) c858 = b0 + b1 - b2 - b4 - b5 + b6 - b8; + if (gl_LocalInvocationIndex <= 2) c859 = b0 - b1 + b2 - b4 + b5 + b6 - b9; + if (gl_LocalInvocationIndex <= 3) c86 = b1 - b2 - b8; + if (gl_LocalInvocationIndex >= 1) c860 = b0 + b1 - b2 - b4 + b5 - b7 - b8; + if (gl_LocalInvocationIndex == 1) c861 = b0 - b1 - b2 - b4 - b5 - b7 - b9; + if (gl_LocalInvocationIndex == 1) c862 = b0 + b1 + b2 - b4 - b5 + b8 - b9; + if (gl_LocalInvocationIndex != 0) c863 = b0 - b1 - b2 - b4 + b6 - b7 + b8; + if (gl_LocalInvocationIndex != 1) c864 = b0 + b1 - b2 - b4 + b6 - b7 + b9; + if (gl_LocalInvocationIndex < 2) c865 = b0 - b1 + b2 + b4 + b6 + b8 - b9; + if (gl_LocalInvocationIndex < 2) c866 = b0 + b1 + b2 + b4 - b7 + b8 + b9; + if (gl_LocalInvocationIndex < 2) c867 = b0 + b1 - b2 + b5 - b6 + b7 + b8; + if (gl_LocalInvocationIndex != 0) c868 = b0 - b1 + b2 + b5 - b6 + b7 + b9; + if (gl_LocalInvocationIndex <= 0) c869 = b0 - b1 + b2 - b5 + b6 - b8 + b9; + if (gl_LocalInvocationIndex < 1) c87 = b1 - b2 - b9; + if (gl_LocalInvocationIndex >= 2) c870 = b0 - b1 - b2 + b5 + b7 - b8 - b9; + if (gl_LocalInvocationIndex <= 2) c871 = b0 + b1 + b2 - b6 + b7 + b8 + b9; + if (gl_LocalInvocationIndex > 0) c872 = b0 + b1 + b3 + b4 + b5 + b6 - b7; + if (gl_LocalInvocationIndex >= 2) c873 = b0 - b1 + b3 + b4 + b5 - b6 - b8; + if (gl_LocalInvocationIndex != 0) c874 = b0 + b1 + b3 - b4 - b5 + b6 - b9; + if (gl_LocalInvocationIndex != 3) c875 = b0 - b1 + b3 - b4 + b5 + b7 + b8; + if (gl_LocalInvocationIndex > 0) c876 = b0 - b1 + b3 - b4 - b5 + b7 - b9; + if (gl_LocalInvocationIndex >= 0) c877 = b0 - b1 - b3 - b4 - b5 + b8 - b9; + if (gl_LocalInvocationIndex < 1) c878 = b0 - b1 + b3 - b4 + b6 + b7 - b8; + if (gl_LocalInvocationIndex <= 1) c879 = b0 + b1 + b3 - b4 + b6 - b7 + b9; + if (gl_LocalInvocationIndex < 2) c88 = b1 - b3 - b4; + if (gl_LocalInvocationIndex == 0) c880 = b0 + b1 - b3 + b4 + b6 - b8 - b9; + if (gl_LocalInvocationIndex == 3) c881 = b0 - b1 + b3 + b4 - b7 - b8 - b9; + if (gl_LocalInvocationIndex >= 3) c882 = b0 - b1 - b3 + b5 - b6 + b7 + b8; + if (gl_LocalInvocationIndex != 2) c883 = b0 - b1 - b3 - b5 + b6 - b7 + b9; + if (gl_LocalInvocationIndex == 0) c884 = b0 + b1 - b3 + b5 - b6 + b8 - b9; + if (gl_LocalInvocationIndex < 2) c885 = b0 + b1 - b3 - b5 + b7 + b8 + b9; + if (gl_LocalInvocationIndex != 3) c886 = b0 + b1 - b3 + b6 - b7 - b8 - b9; + if (gl_LocalInvocationIndex >= 1) c887 = b0 + b1 - b4 + b5 - b6 + b7 + b8; + if (gl_LocalInvocationIndex != 1) c888 = b0 + b1 + b4 - b5 + b6 - b7 + b9; + if (gl_LocalInvocationIndex < 2) c889 = b0 - b1 + b4 + b5 - b6 + b8 + b9; + if (gl_LocalInvocationIndex <= 0) c89 = b1 + b3 - b5; + if (gl_LocalInvocationIndex == 1) c890 = b0 - b1 + b4 + b5 + b7 - b8 - b9; + if (gl_LocalInvocationIndex >= 2) c891 = b0 + b1 + b4 - b6 + b7 - b8 + b9; + if (gl_LocalInvocationIndex < 1) c892 = b0 + b1 + b5 + b6 - b7 - b8 - b9; + if (gl_LocalInvocationIndex > 0) c893 = b0 + b2 + b3 - b4 - b5 - b6 - b7; + if (gl_LocalInvocationIndex <= 0) c894 = b0 - b2 - b3 - b4 - b5 - b6 - b8; + if (gl_LocalInvocationIndex > 2) c895 = b0 - b2 + b3 - b4 + b5 - b6 - b9; + if (gl_LocalInvocationIndex != 1) c896 = b0 - b2 - b3 - b4 + b5 - b7 + b8; + if (gl_LocalInvocationIndex <= 1) c897 = b0 - b2 - b3 - b4 + b5 - b7 + b9; + if (gl_LocalInvocationIndex <= 0) c898 = b0 - b2 + b3 - b4 + b5 - b8 - b9; + if (gl_LocalInvocationIndex != 2) c899 = b0 + b2 - b3 - b4 + b6 + b7 + b8; + if (gl_LocalInvocationIndex >= 1) c9 = b1 + b2; + if (gl_LocalInvocationIndex != 0) c90 = b1 + b3 + b6; + if (gl_LocalInvocationIndex > 2) c900 = b0 - b2 - b3 + b4 - b6 + b7 - b9; + if (gl_LocalInvocationIndex != 1) c901 = b0 + b2 - b3 - b4 - b6 + b8 - b9; + if (gl_LocalInvocationIndex == 0) c902 = b0 - b2 + b3 + b4 + b7 + b8 + b9; + if (gl_LocalInvocationIndex <= 3) c903 = b0 + b2 - b3 - b5 - b6 + b7 + b8; + if (gl_LocalInvocationIndex >= 0) c904 = b0 - b2 + b3 + b5 - b6 + b7 + b9; + if (gl_LocalInvocationIndex != 2) c905 = b0 - b2 + b3 + b5 + b6 - b8 - b9; + if (gl_LocalInvocationIndex == 0) c906 = b0 - b2 + b3 - b5 + b7 - b8 - b9; + if (gl_LocalInvocationIndex < 2) c907 = b0 + b2 - b3 - b6 + b7 - b8 + b9; + if (gl_LocalInvocationIndex >= 0) c908 = b0 - b2 - b4 + b5 + b6 + b7 + b8; + if (gl_LocalInvocationIndex < 1) c909 = b0 + b2 + b4 - b5 + b6 + b7 - b9; + if (gl_LocalInvocationIndex > 1) c91 = b1 - b3 + b7; + if (gl_LocalInvocationIndex == 2) c910 = b0 - b2 - b4 - b5 - b6 - b8 - b9; + if (gl_LocalInvocationIndex <= 1) c911 = b0 - b2 + b4 + b5 + b7 + b8 - b9; + if (gl_LocalInvocationIndex < 3) c912 = b0 + b2 + b4 - b6 + b7 - b8 - b9; + if (gl_LocalInvocationIndex != 3) c913 = b0 - b2 - b5 - b6 - b7 - b8 + b9; + if (gl_LocalInvocationIndex != 0) c914 = b0 - b3 - b4 + b5 + b6 - b7 + b8; + if (gl_LocalInvocationIndex > 3) c915 = b0 - b3 - b4 + b5 - b6 - b7 + b9; + if (gl_LocalInvocationIndex > 1) c916 = b0 + b3 + b4 + b5 - b6 - b8 + b9; + if (gl_LocalInvocationIndex < 0) c917 = b0 - b3 + b4 + b5 - b7 - b8 - b9; + if (gl_LocalInvocationIndex <= 1) c918 = b0 - b3 + b4 + b6 + b7 + b8 + b9; + if (gl_LocalInvocationIndex == 0) c919 = b0 + b3 + b5 - b6 - b7 - b8 + b9; + if (gl_LocalInvocationIndex != 3) c92 = b1 - b3 + b8; + if (gl_LocalInvocationIndex > 2) c920 = b0 + b4 + b5 + b6 - b7 + b8 - b9; + if (gl_LocalInvocationIndex != 3) c921 = b1 - b2 - b3 + b4 + b5 - b6 + b7; + if (gl_LocalInvocationIndex <= 0) c922 = b1 - b2 - b3 + b4 - b5 + b6 + b8; + if (gl_LocalInvocationIndex > 3) c923 = b1 - b2 - b3 + b4 + b5 + b6 + b9; + if (gl_LocalInvocationIndex >= 1) c924 = b1 + b2 + b3 + b4 - b5 + b7 + b8; + if (gl_LocalInvocationIndex <= 1) c925 = b1 - b2 + b3 + b4 + b5 + b7 + b9; + if (gl_LocalInvocationIndex != 3) c926 = b1 - b2 + b3 + b4 + b5 + b8 + b9; + if (gl_LocalInvocationIndex < 2) c927 = b1 + b2 - b3 + b4 - b6 + b7 - b8; + if (gl_LocalInvocationIndex >= 1) c928 = b1 + b2 + b3 + b4 + b6 - b7 + b9; + if (gl_LocalInvocationIndex <= 1) c929 = b1 - b2 - b3 + b4 + b6 - b8 - b9; + if (gl_LocalInvocationIndex == 0) c93 = b1 + b3 - b9; + if (gl_LocalInvocationIndex != 3) c930 = b1 + b2 + b3 + b4 - b7 - b8 + b9; + if (gl_LocalInvocationIndex == 2) c931 = b1 + b2 + b3 + b5 - b6 - b7 - b8; + if (gl_LocalInvocationIndex <= 1) c932 = b1 - b2 - b3 + b5 + b6 - b7 - b9; + if (gl_LocalInvocationIndex == 3) c933 = b1 + b2 + b3 - b5 + b6 - b8 - b9; + if (gl_LocalInvocationIndex == 3) c934 = b1 + b2 + b3 - b5 + b7 + b8 - b9; + if (gl_LocalInvocationIndex >= 2) c935 = b1 + b2 + b3 - b6 + b7 - b8 + b9; + if (gl_LocalInvocationIndex < 2) c936 = b1 - b2 + b4 - b5 + b6 - b7 + b8; + if (gl_LocalInvocationIndex > 0) c937 = b1 + b2 + b4 - b5 - b6 - b7 - b9; + if (gl_LocalInvocationIndex == 0) c938 = b1 + b2 + b4 - b5 - b6 - b8 - b9; + if (gl_LocalInvocationIndex < 0) c939 = b1 + b2 - b4 + b5 - b7 - b8 + b9; + if (gl_LocalInvocationIndex >= 3) c94 = b1 - b4 + b5; + if (gl_LocalInvocationIndex > 1) c940 = b1 + b2 - b4 - b6 - b7 + b8 - b9; + if (gl_LocalInvocationIndex <= 3) c941 = b1 + b2 - b5 - b6 + b7 + b8 + b9; + if (gl_LocalInvocationIndex != 3) c942 = b1 + b3 - b4 - b5 + b6 + b7 - b8; + if (gl_LocalInvocationIndex < 2) c943 = b1 - b3 - b4 - b5 - b6 - b7 - b9; + if (gl_LocalInvocationIndex > 0) c944 = b1 + b3 - b4 - b5 - b6 + b8 - b9; + if (gl_LocalInvocationIndex <= 0) c945 = b1 - b3 - b4 + b5 - b7 - b8 + b9; + if (gl_LocalInvocationIndex > 1) c946 = b1 - b3 + b4 + b6 - b7 + b8 + b9; + if (gl_LocalInvocationIndex != 0) c947 = b1 + b3 - b5 + b6 - b7 + b8 + b9; + if (gl_LocalInvocationIndex == 2) c948 = b1 - b4 - b5 + b6 - b7 + b8 - b9; + if (gl_LocalInvocationIndex >= 1) c949 = b2 + b3 - b4 - b5 + b6 - b7 - b8; + if (gl_LocalInvocationIndex < 3) c95 = b1 + b4 - b6; + if (gl_LocalInvocationIndex <= 2) c950 = b2 + b3 + b4 - b5 - b6 + b7 + b9; + if (gl_LocalInvocationIndex > 0) c951 = b2 + b3 + b4 + b5 + b6 + b8 - b9; + if (gl_LocalInvocationIndex <= 3) c952 = b2 - b3 - b4 + b5 + b7 + b8 - b9; + if (gl_LocalInvocationIndex == 1) c953 = b2 - b3 - b4 - b6 + b7 - b8 + b9; + if (gl_LocalInvocationIndex >= 0) c954 = b2 - b3 + b5 - b6 - b7 + b8 + b9; + if (gl_LocalInvocationIndex == 0) c955 = b2 - b4 - b5 - b6 - b7 - b8 + b9; + if (gl_LocalInvocationIndex > 1) c956 = b3 + b4 + b5 + b6 + b7 + b8 + b9; + if (gl_LocalInvocationIndex > 1) c957 = b0 - b1 + b2 - b3 + b4 + b5 + b6 + b7; + if (gl_LocalInvocationIndex != 3) c958 = b0 + b1 + b2 - b3 - b4 - b5 - b6 - b8; + if (gl_LocalInvocationIndex <= 3) c959 = b0 + b1 - b2 - b3 - b4 - b5 + b6 - b9; + if (gl_LocalInvocationIndex <= 0) c96 = b1 + b4 + b7; + if (gl_LocalInvocationIndex < 3) c960 = b0 + b1 + b2 + b3 - b4 + b5 - b7 + b8; + if (gl_LocalInvocationIndex < 3) c961 = b0 + b1 + b2 + b3 + b4 - b5 - b7 - b9; + if (gl_LocalInvocationIndex < 3) c962 = b0 + b1 + b2 - b3 + b4 + b5 + b8 - b9; + if (gl_LocalInvocationIndex != 0) c963 = b0 - b1 - b2 - b3 - b4 - b6 - b7 + b8; + if (gl_LocalInvocationIndex <= 0) c964 = b0 + b1 - b2 - b3 + b4 - b6 - b7 + b9; + if (gl_LocalInvocationIndex != 2) c965 = b0 - b1 - b2 + b3 - b4 + b6 + b8 - b9; + if (gl_LocalInvocationIndex > 0) c966 = b0 - b1 - b2 + b3 + b4 + b7 + b8 - b9; + if (gl_LocalInvocationIndex < 2) c967 = b0 - b1 + b2 + b3 - b5 + b6 + b7 + b8; + if (gl_LocalInvocationIndex != 1) c968 = b0 + b1 + b2 + b3 - b5 + b6 - b7 - b9; + if (gl_LocalInvocationIndex == 1) c969 = b0 - b1 - b2 - b3 - b5 + b6 + b8 + b9; + if (gl_LocalInvocationIndex > 3) c97 = b1 - b4 - b8; + if (gl_LocalInvocationIndex <= 2) c970 = b0 - b1 - b2 - b3 - b5 - b7 - b8 - b9; + if (gl_LocalInvocationIndex < 1) c971 = b0 - b1 - b2 - b3 - b6 - b7 - b8 + b9; + if (gl_LocalInvocationIndex <= 1) c972 = b0 - b1 + b2 + b4 + b5 - b6 - b7 + b8; + if (gl_LocalInvocationIndex == 2) c973 = b0 + b1 - b2 - b4 + b5 - b6 + b7 + b9; + if (gl_LocalInvocationIndex != 0) c974 = b0 - b1 + b2 - b4 - b5 - b6 - b8 + b9; + if (gl_LocalInvocationIndex == 2) c975 = b0 - b1 + b2 + b4 + b5 + b7 - b8 - b9; + if (gl_LocalInvocationIndex < 0) c976 = b0 + b1 - b2 - b4 + b6 + b7 - b8 - b9; + if (gl_LocalInvocationIndex < 0) c977 = b0 - b1 - b2 + b5 + b6 - b7 - b8 - b9; + if (gl_LocalInvocationIndex < 2) c978 = b0 - b1 - b3 + b4 + b5 + b6 + b7 - b8; + if (gl_LocalInvocationIndex != 2) c979 = b0 - b1 + b3 + b4 - b5 - b6 + b7 - b9; + if (gl_LocalInvocationIndex > 2) c98 = b1 - b4 + b9; + if (gl_LocalInvocationIndex < 2) c980 = b0 - b1 - b3 - b4 - b5 - b6 + b8 - b9; + if (gl_LocalInvocationIndex < 2) c981 = b0 - b1 + b3 + b4 + b5 + b7 - b8 + b9; + if (gl_LocalInvocationIndex <= 0) c982 = b0 + b1 - b3 + b4 + b6 - b7 - b8 - b9; + if (gl_LocalInvocationIndex >= 3) c983 = b0 + b1 - b3 - b5 + b6 - b7 + b8 - b9; + if (gl_LocalInvocationIndex <= 3) c984 = b0 + b1 - b4 + b5 - b6 - b7 - b8 + b9; + if (gl_LocalInvocationIndex >= 2) c985 = b0 - b2 - b3 + b4 - b5 - b6 + b7 - b8; + if (gl_LocalInvocationIndex > 1) c986 = b0 + b2 - b3 - b4 - b5 - b6 - b7 + b9; + if (gl_LocalInvocationIndex != 0) c987 = b0 + b2 + b3 + b4 + b5 + b6 + b8 + b9; + if (gl_LocalInvocationIndex != 3) c988 = b0 + b2 - b3 + b4 + b5 + b7 - b8 + b9; + if (gl_LocalInvocationIndex < 0) c989 = b0 + b2 - b3 + b4 + b6 - b7 + b8 + b9; + if (gl_LocalInvocationIndex == 0) c99 = b1 - b5 - b6; + if (gl_LocalInvocationIndex < 1) c990 = b0 - b2 + b3 + b5 - b6 - b7 - b8 + b9; + if (gl_LocalInvocationIndex == 2) c991 = b0 - b2 - b4 + b5 + b6 - b7 - b8 + b9; + if (gl_LocalInvocationIndex > 0) c992 = b0 + b3 - b4 - b5 - b6 + b7 + b8 + b9; + if (gl_LocalInvocationIndex <= 0) c993 = b1 + b2 + b3 - b4 - b5 - b6 - b7 + b8; + if (gl_LocalInvocationIndex > 1) c994 = b1 - b2 + b3 + b4 + b5 + b6 + b7 - b9; + if (gl_LocalInvocationIndex > 1) c995 = b1 + b2 - b3 + b4 + b5 - b6 + b8 + b9; + if (gl_LocalInvocationIndex <= 1) c996 = b1 + b2 + b3 + b4 + b5 - b7 - b8 - b9; + if (gl_LocalInvocationIndex != 3) c997 = b1 + b2 + b3 + b4 + b6 - b7 - b8 - b9; + if (gl_LocalInvocationIndex == 2) c998 = b1 + b2 + b3 - b5 - b6 + b7 - b8 - b9; + if (gl_LocalInvocationIndex != 2) c999 = b1 - b2 + b4 + b5 - b6 - b7 + b8 + b9; + + const int result + = c0 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + + c10 + c11 + c12 + c13 + c14 + c15 + c16 + c17 + c18 + c19 + + c20 + c21 + c22 + c23 + c24 + c25 + c26 + c27 + c28 + c29 + + c30 + c31 + c32 + c33 + c34 + c35 + c36 + c37 + c38 + c39 + + c40 + c41 + c42 + c43 + c44 + c45 + c46 + c47 + c48 + c49 + + c50 + c51 + c52 + c53 + c54 + c55 + c56 + c57 + c58 + c59 + + c60 + c61 + c62 + c63 + c64 + c65 + c66 + c67 + c68 + c69 + + c70 + c71 + c72 + c73 + c74 + c75 + c76 + c77 + c78 + c79 + + c80 + c81 + c82 + c83 + c84 + c85 + c86 + c87 + c88 + c89 + + c90 + c91 + c92 + c93 + c94 + c95 + c96 + c97 + c98 + c99 + + c100 + c101 + c102 + c103 + c104 + c105 + c106 + c107 + c108 + c109 + + c110 + c111 + c112 + c113 + c114 + c115 + c116 + c117 + c118 + c119 + + c120 + c121 + c122 + c123 + c124 + c125 + c126 + c127 + c128 + c129 + + c130 + c131 + c132 + c133 + c134 + c135 + c136 + c137 + c138 + c139 + + c140 + c141 + c142 + c143 + c144 + c145 + c146 + c147 + c148 + c149 + + c150 + c151 + c152 + c153 + c154 + c155 + c156 + c157 + c158 + c159 + + c160 + c161 + c162 + c163 + c164 + c165 + c166 + c167 + c168 + c169 + + c170 + c171 + c172 + c173 + c174 + c175 + c176 + c177 + c178 + c179 + + c180 + c181 + c182 + c183 + c184 + c185 + c186 + c187 + c188 + c189 + + c190 + c191 + c192 + c193 + c194 + c195 + c196 + c197 + c198 + c199 + + c200 + c201 + c202 + c203 + c204 + c205 + c206 + c207 + c208 + c209 + + c210 + c211 + c212 + c213 + c214 + c215 + c216 + c217 + c218 + c219 + + c220 + c221 + c222 + c223 + c224 + c225 + c226 + c227 + c228 + c229 + + c230 + c231 + c232 + c233 + c234 + c235 + c236 + c237 + c238 + c239 + + c240 + c241 + c242 + c243 + c244 + c245 + c246 + c247 + c248 + c249 + + c250 + c251 + c252 + c253 + c254 + c255 + c256 + c257 + c258 + c259 + + c260 + c261 + c262 + c263 + c264 + c265 + c266 + c267 + c268 + c269 + + c270 + c271 + c272 + c273 + c274 + c275 + c276 + c277 + c278 + c279 + + c280 + c281 + c282 + c283 + c284 + c285 + c286 + c287 + c288 + c289 + + c290 + c291 + c292 + c293 + c294 + c295 + c296 + c297 + c298 + c299 + + c300 + c301 + c302 + c303 + c304 + c305 + c306 + c307 + c308 + c309 + + c310 + c311 + c312 + c313 + c314 + c315 + c316 + c317 + c318 + c319 + + c320 + c321 + c322 + c323 + c324 + c325 + c326 + c327 + c328 + c329 + + c330 + c331 + c332 + c333 + c334 + c335 + c336 + c337 + c338 + c339 + + c340 + c341 + c342 + c343 + c344 + c345 + c346 + c347 + c348 + c349 + + c350 + c351 + c352 + c353 + c354 + c355 + c356 + c357 + c358 + c359 + + c360 + c361 + c362 + c363 + c364 + c365 + c366 + c367 + c368 + c369 + + c370 + c371 + c372 + c373 + c374 + c375 + c376 + c377 + c378 + c379 + + c380 + c381 + c382 + c383 + c384 + c385 + c386 + c387 + c388 + c389 + + c390 + c391 + c392 + c393 + c394 + c395 + c396 + c397 + c398 + c399 + + c400 + c401 + c402 + c403 + c404 + c405 + c406 + c407 + c408 + c409 + + c410 + c411 + c412 + c413 + c414 + c415 + c416 + c417 + c418 + c419 + + c420 + c421 + c422 + c423 + c424 + c425 + c426 + c427 + c428 + c429 + + c430 + c431 + c432 + c433 + c434 + c435 + c436 + c437 + c438 + c439 + + c440 + c441 + c442 + c443 + c444 + c445 + c446 + c447 + c448 + c449 + + c450 + c451 + c452 + c453 + c454 + c455 + c456 + c457 + c458 + c459 + + c460 + c461 + c462 + c463 + c464 + c465 + c466 + c467 + c468 + c469 + + c470 + c471 + c472 + c473 + c474 + c475 + c476 + c477 + c478 + c479 + + c480 + c481 + c482 + c483 + c484 + c485 + c486 + c487 + c488 + c489 + + c490 + c491 + c492 + c493 + c494 + c495 + c496 + c497 + c498 + c499 + + c500 + c501 + c502 + c503 + c504 + c505 + c506 + c507 + c508 + c509 + + c510 + c511 + c512 + c513 + c514 + c515 + c516 + c517 + c518 + c519 + + c520 + c521 + c522 + c523 + c524 + c525 + c526 + c527 + c528 + c529 + + c530 + c531 + c532 + c533 + c534 + c535 + c536 + c537 + c538 + c539 + + c540 + c541 + c542 + c543 + c544 + c545 + c546 + c547 + c548 + c549 + + c550 + c551 + c552 + c553 + c554 + c555 + c556 + c557 + c558 + c559 + + c560 + c561 + c562 + c563 + c564 + c565 + c566 + c567 + c568 + c569 + + c570 + c571 + c572 + c573 + c574 + c575 + c576 + c577 + c578 + c579 + + c580 + c581 + c582 + c583 + c584 + c585 + c586 + c587 + c588 + c589 + + c590 + c591 + c592 + c593 + c594 + c595 + c596 + c597 + c598 + c599 + + c600 + c601 + c602 + c603 + c604 + c605 + c606 + c607 + c608 + c609 + + c610 + c611 + c612 + c613 + c614 + c615 + c616 + c617 + c618 + c619 + + c620 + c621 + c622 + c623 + c624 + c625 + c626 + c627 + c628 + c629 + + c630 + c631 + c632 + c633 + c634 + c635 + c636 + c637 + c638 + c639 + + c640 + c641 + c642 + c643 + c644 + c645 + c646 + c647 + c648 + c649 + + c650 + c651 + c652 + c653 + c654 + c655 + c656 + c657 + c658 + c659 + + c660 + c661 + c662 + c663 + c664 + c665 + c666 + c667 + c668 + c669 + + c670 + c671 + c672 + c673 + c674 + c675 + c676 + c677 + c678 + c679 + + c680 + c681 + c682 + c683 + c684 + c685 + c686 + c687 + c688 + c689 + + c690 + c691 + c692 + c693 + c694 + c695 + c696 + c697 + c698 + c699 + + c700 + c701 + c702 + c703 + c704 + c705 + c706 + c707 + c708 + c709 + + c710 + c711 + c712 + c713 + c714 + c715 + c716 + c717 + c718 + c719 + + c720 + c721 + c722 + c723 + c724 + c725 + c726 + c727 + c728 + c729 + + c730 + c731 + c732 + c733 + c734 + c735 + c736 + c737 + c738 + c739 + + c740 + c741 + c742 + c743 + c744 + c745 + c746 + c747 + c748 + c749 + + c750 + c751 + c752 + c753 + c754 + c755 + c756 + c757 + c758 + c759 + + c760 + c761 + c762 + c763 + c764 + c765 + c766 + c767 + c768 + c769 + + c770 + c771 + c772 + c773 + c774 + c775 + c776 + c777 + c778 + c779 + + c780 + c781 + c782 + c783 + c784 + c785 + c786 + c787 + c788 + c789 + + c790 + c791 + c792 + c793 + c794 + c795 + c796 + c797 + c798 + c799 + + c800 + c801 + c802 + c803 + c804 + c805 + c806 + c807 + c808 + c809 + + c810 + c811 + c812 + c813 + c814 + c815 + c816 + c817 + c818 + c819 + + c820 + c821 + c822 + c823 + c824 + c825 + c826 + c827 + c828 + c829 + + c830 + c831 + c832 + c833 + c834 + c835 + c836 + c837 + c838 + c839 + + c840 + c841 + c842 + c843 + c844 + c845 + c846 + c847 + c848 + c849 + + c850 + c851 + c852 + c853 + c854 + c855 + c856 + c857 + c858 + c859 + + c860 + c861 + c862 + c863 + c864 + c865 + c866 + c867 + c868 + c869 + + c870 + c871 + c872 + c873 + c874 + c875 + c876 + c877 + c878 + c879 + + c880 + c881 + c882 + c883 + c884 + c885 + c886 + c887 + c888 + c889 + + c890 + c891 + c892 + c893 + c894 + c895 + c896 + c897 + c898 + c899 + + c900 + c901 + c902 + c903 + c904 + c905 + c906 + c907 + c908 + c909 + + c910 + c911 + c912 + c913 + c914 + c915 + c916 + c917 + c918 + c919 + + c920 + c921 + c922 + c923 + c924 + c925 + c926 + c927 + c928 + c929 + + c930 + c931 + c932 + c933 + c934 + c935 + c936 + c937 + c938 + c939 + + c940 + c941 + c942 + c943 + c944 + c945 + c946 + c947 + c948 + c949 + + c950 + c951 + c952 + c953 + c954 + c955 + c956 + c957 + c958 + c959 + + c960 + c961 + c962 + c963 + c964 + c965 + c966 + c967 + c968 + c969 + + c970 + c971 + c972 + c973 + c974 + c975 + c976 + c977 + c978 + c979 + + c980 + c981 + c982 + c983 + c984 + c985 + c986 + c987 + c988 + c989 + + c990 + c991 + c992 + c993 + c994 + c995 + c996 + c997 + c998 + c999 + + c1000 + c1001 + c1002 + c1003 + c1004 + c1005 + c1006 + c1007 + c1008 + c1009 + + c1010 + c1011; + + ob.values[gl_LocalInvocationIndex] = result; +} diff --git a/vulkan/device_generated_commands/ScratchSpace.comp.spvasm b/vulkan/device_generated_commands/ScratchSpace.comp.spvasm new file mode 100644 index 0000000..c2a8ab5 --- /dev/null +++ b/vulkan/device_generated_commands/ScratchSpace.comp.spvasm @@ -0,0 +1,22585 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 16407 +; Schema: 0 +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %4 "main" %1054 +OpExecutionMode %4 LocalSize 4 1 1 +OpSource GLSL 460 +OpName %4 "main" +OpName %8 "a0" +OpName %10 "a1" +OpName %11 "a2" +OpName %12 "a3" +OpName %13 "b0" +OpName %14 "b1" +OpName %15 "b2" +OpName %16 "b3" +OpName %17 "b4" +OpName %18 "b5" +OpName %19 "b6" +OpName %20 "b7" +OpName %21 "b8" +OpName %22 "b9" +OpName %23 "c0" +OpName %24 "c1" +OpName %25 "c10" +OpName %26 "c100" +OpName %27 "c1000" +OpName %28 "c1001" +OpName %29 "c1002" +OpName %30 "c1003" +OpName %31 "c1004" +OpName %32 "c1005" +OpName %33 "c1006" +OpName %34 "c1007" +OpName %35 "c1008" +OpName %36 "c1009" +OpName %37 "c101" +OpName %38 "c1010" +OpName %39 "c1011" +OpName %40 "c102" +OpName %41 "c103" +OpName %42 "c104" +OpName %43 "c105" +OpName %44 "c106" +OpName %45 "c107" +OpName %46 "c108" +OpName %47 "c109" +OpName %48 "c11" +OpName %49 "c110" +OpName %50 "c111" +OpName %51 "c112" +OpName %52 "c113" +OpName %53 "c114" +OpName %54 "c115" +OpName %55 "c116" +OpName %56 "c117" +OpName %57 "c118" +OpName %58 "c119" +OpName %59 "c12" +OpName %60 "c120" +OpName %61 "c121" +OpName %62 "c122" +OpName %63 "c123" +OpName %64 "c124" +OpName %65 "c125" +OpName %66 "c126" +OpName %67 "c127" +OpName %68 "c128" +OpName %69 "c129" +OpName %70 "c13" +OpName %71 "c130" +OpName %72 "c131" +OpName %73 "c132" +OpName %74 "c133" +OpName %75 "c134" +OpName %76 "c135" +OpName %77 "c136" +OpName %78 "c137" +OpName %79 "c138" +OpName %80 "c139" +OpName %81 "c14" +OpName %82 "c140" +OpName %83 "c141" +OpName %84 "c142" +OpName %85 "c143" +OpName %86 "c144" +OpName %87 "c145" +OpName %88 "c146" +OpName %89 "c147" +OpName %90 "c148" +OpName %91 "c149" +OpName %92 "c15" +OpName %93 "c150" +OpName %94 "c151" +OpName %95 "c152" +OpName %96 "c153" +OpName %97 "c154" +OpName %98 "c155" +OpName %99 "c156" +OpName %100 "c157" +OpName %101 "c158" +OpName %102 "c159" +OpName %103 "c16" +OpName %104 "c160" +OpName %105 "c161" +OpName %106 "c162" +OpName %107 "c163" +OpName %108 "c164" +OpName %109 "c165" +OpName %110 "c166" +OpName %111 "c167" +OpName %112 "c168" +OpName %113 "c169" +OpName %114 "c17" +OpName %115 "c170" +OpName %116 "c171" +OpName %117 "c172" +OpName %118 "c173" +OpName %119 "c174" +OpName %120 "c175" +OpName %121 "c176" +OpName %122 "c177" +OpName %123 "c178" +OpName %124 "c179" +OpName %125 "c18" +OpName %126 "c180" +OpName %127 "c181" +OpName %128 "c182" +OpName %129 "c183" +OpName %130 "c184" +OpName %131 "c185" +OpName %132 "c186" +OpName %133 "c187" +OpName %134 "c188" +OpName %135 "c189" +OpName %136 "c19" +OpName %137 "c190" +OpName %138 "c191" +OpName %139 "c192" +OpName %140 "c193" +OpName %141 "c194" +OpName %142 "c195" +OpName %143 "c196" +OpName %144 "c197" +OpName %145 "c198" +OpName %146 "c199" +OpName %147 "c2" +OpName %148 "c20" +OpName %149 "c200" +OpName %150 "c201" +OpName %151 "c202" +OpName %152 "c203" +OpName %153 "c204" +OpName %154 "c205" +OpName %155 "c206" +OpName %156 "c207" +OpName %157 "c208" +OpName %158 "c209" +OpName %159 "c21" +OpName %160 "c210" +OpName %161 "c211" +OpName %162 "c212" +OpName %163 "c213" +OpName %164 "c214" +OpName %165 "c215" +OpName %166 "c216" +OpName %167 "c217" +OpName %168 "c218" +OpName %169 "c219" +OpName %170 "c22" +OpName %171 "c220" +OpName %172 "c221" +OpName %173 "c222" +OpName %174 "c223" +OpName %175 "c224" +OpName %176 "c225" +OpName %177 "c226" +OpName %178 "c227" +OpName %179 "c228" +OpName %180 "c229" +OpName %181 "c23" +OpName %182 "c230" +OpName %183 "c231" +OpName %184 "c232" +OpName %185 "c233" +OpName %186 "c234" +OpName %187 "c235" +OpName %188 "c236" +OpName %189 "c237" +OpName %190 "c238" +OpName %191 "c239" +OpName %192 "c24" +OpName %193 "c240" +OpName %194 "c241" +OpName %195 "c242" +OpName %196 "c243" +OpName %197 "c244" +OpName %198 "c245" +OpName %199 "c246" +OpName %200 "c247" +OpName %201 "c248" +OpName %202 "c249" +OpName %203 "c25" +OpName %204 "c250" +OpName %205 "c251" +OpName %206 "c252" +OpName %207 "c253" +OpName %208 "c254" +OpName %209 "c255" +OpName %210 "c256" +OpName %211 "c257" +OpName %212 "c258" +OpName %213 "c259" +OpName %214 "c26" +OpName %215 "c260" +OpName %216 "c261" +OpName %217 "c262" +OpName %218 "c263" +OpName %219 "c264" +OpName %220 "c265" +OpName %221 "c266" +OpName %222 "c267" +OpName %223 "c268" +OpName %224 "c269" +OpName %225 "c27" +OpName %226 "c270" +OpName %227 "c271" +OpName %228 "c272" +OpName %229 "c273" +OpName %230 "c274" +OpName %231 "c275" +OpName %232 "c276" +OpName %233 "c277" +OpName %234 "c278" +OpName %235 "c279" +OpName %236 "c28" +OpName %237 "c280" +OpName %238 "c281" +OpName %239 "c282" +OpName %240 "c283" +OpName %241 "c284" +OpName %242 "c285" +OpName %243 "c286" +OpName %244 "c287" +OpName %245 "c288" +OpName %246 "c289" +OpName %247 "c29" +OpName %248 "c290" +OpName %249 "c291" +OpName %250 "c292" +OpName %251 "c293" +OpName %252 "c294" +OpName %253 "c295" +OpName %254 "c296" +OpName %255 "c297" +OpName %256 "c298" +OpName %257 "c299" +OpName %258 "c3" +OpName %259 "c30" +OpName %260 "c300" +OpName %261 "c301" +OpName %262 "c302" +OpName %263 "c303" +OpName %264 "c304" +OpName %265 "c305" +OpName %266 "c306" +OpName %267 "c307" +OpName %268 "c308" +OpName %269 "c309" +OpName %270 "c31" +OpName %271 "c310" +OpName %272 "c311" +OpName %273 "c312" +OpName %274 "c313" +OpName %275 "c314" +OpName %276 "c315" +OpName %277 "c316" +OpName %278 "c317" +OpName %279 "c318" +OpName %280 "c319" +OpName %281 "c32" +OpName %282 "c320" +OpName %283 "c321" +OpName %284 "c322" +OpName %285 "c323" +OpName %286 "c324" +OpName %287 "c325" +OpName %288 "c326" +OpName %289 "c327" +OpName %290 "c328" +OpName %291 "c329" +OpName %292 "c33" +OpName %293 "c330" +OpName %294 "c331" +OpName %295 "c332" +OpName %296 "c333" +OpName %297 "c334" +OpName %298 "c335" +OpName %299 "c336" +OpName %300 "c337" +OpName %301 "c338" +OpName %302 "c339" +OpName %303 "c34" +OpName %304 "c340" +OpName %305 "c341" +OpName %306 "c342" +OpName %307 "c343" +OpName %308 "c344" +OpName %309 "c345" +OpName %310 "c346" +OpName %311 "c347" +OpName %312 "c348" +OpName %313 "c349" +OpName %314 "c35" +OpName %315 "c350" +OpName %316 "c351" +OpName %317 "c352" +OpName %318 "c353" +OpName %319 "c354" +OpName %320 "c355" +OpName %321 "c356" +OpName %322 "c357" +OpName %323 "c358" +OpName %324 "c359" +OpName %325 "c36" +OpName %326 "c360" +OpName %327 "c361" +OpName %328 "c362" +OpName %329 "c363" +OpName %330 "c364" +OpName %331 "c365" +OpName %332 "c366" +OpName %333 "c367" +OpName %334 "c368" +OpName %335 "c369" +OpName %336 "c37" +OpName %337 "c370" +OpName %338 "c371" +OpName %339 "c372" +OpName %340 "c373" +OpName %341 "c374" +OpName %342 "c375" +OpName %343 "c376" +OpName %344 "c377" +OpName %345 "c378" +OpName %346 "c379" +OpName %347 "c38" +OpName %348 "c380" +OpName %349 "c381" +OpName %350 "c382" +OpName %351 "c383" +OpName %352 "c384" +OpName %353 "c385" +OpName %354 "c386" +OpName %355 "c387" +OpName %356 "c388" +OpName %357 "c389" +OpName %358 "c39" +OpName %359 "c390" +OpName %360 "c391" +OpName %361 "c392" +OpName %362 "c393" +OpName %363 "c394" +OpName %364 "c395" +OpName %365 "c396" +OpName %366 "c397" +OpName %367 "c398" +OpName %368 "c399" +OpName %369 "c4" +OpName %370 "c40" +OpName %371 "c400" +OpName %372 "c401" +OpName %373 "c402" +OpName %374 "c403" +OpName %375 "c404" +OpName %376 "c405" +OpName %377 "c406" +OpName %378 "c407" +OpName %379 "c408" +OpName %380 "c409" +OpName %381 "c41" +OpName %382 "c410" +OpName %383 "c411" +OpName %384 "c412" +OpName %385 "c413" +OpName %386 "c414" +OpName %387 "c415" +OpName %388 "c416" +OpName %389 "c417" +OpName %390 "c418" +OpName %391 "c419" +OpName %392 "c42" +OpName %393 "c420" +OpName %394 "c421" +OpName %395 "c422" +OpName %396 "c423" +OpName %397 "c424" +OpName %398 "c425" +OpName %399 "c426" +OpName %400 "c427" +OpName %401 "c428" +OpName %402 "c429" +OpName %403 "c43" +OpName %404 "c430" +OpName %405 "c431" +OpName %406 "c432" +OpName %407 "c433" +OpName %408 "c434" +OpName %409 "c435" +OpName %410 "c436" +OpName %411 "c437" +OpName %412 "c438" +OpName %413 "c439" +OpName %414 "c44" +OpName %415 "c440" +OpName %416 "c441" +OpName %417 "c442" +OpName %418 "c443" +OpName %419 "c444" +OpName %420 "c445" +OpName %421 "c446" +OpName %422 "c447" +OpName %423 "c448" +OpName %424 "c449" +OpName %425 "c45" +OpName %426 "c450" +OpName %427 "c451" +OpName %428 "c452" +OpName %429 "c453" +OpName %430 "c454" +OpName %431 "c455" +OpName %432 "c456" +OpName %433 "c457" +OpName %434 "c458" +OpName %435 "c459" +OpName %436 "c46" +OpName %437 "c460" +OpName %438 "c461" +OpName %439 "c462" +OpName %440 "c463" +OpName %441 "c464" +OpName %442 "c465" +OpName %443 "c466" +OpName %444 "c467" +OpName %445 "c468" +OpName %446 "c469" +OpName %447 "c47" +OpName %448 "c470" +OpName %449 "c471" +OpName %450 "c472" +OpName %451 "c473" +OpName %452 "c474" +OpName %453 "c475" +OpName %454 "c476" +OpName %455 "c477" +OpName %456 "c478" +OpName %457 "c479" +OpName %458 "c48" +OpName %459 "c480" +OpName %460 "c481" +OpName %461 "c482" +OpName %462 "c483" +OpName %463 "c484" +OpName %464 "c485" +OpName %465 "c486" +OpName %466 "c487" +OpName %467 "c488" +OpName %468 "c489" +OpName %469 "c49" +OpName %470 "c490" +OpName %471 "c491" +OpName %472 "c492" +OpName %473 "c493" +OpName %474 "c494" +OpName %475 "c495" +OpName %476 "c496" +OpName %477 "c497" +OpName %478 "c498" +OpName %479 "c499" +OpName %480 "c5" +OpName %481 "c50" +OpName %482 "c500" +OpName %483 "c501" +OpName %484 "c502" +OpName %485 "c503" +OpName %486 "c504" +OpName %487 "c505" +OpName %488 "c506" +OpName %489 "c507" +OpName %490 "c508" +OpName %491 "c509" +OpName %492 "c51" +OpName %493 "c510" +OpName %494 "c511" +OpName %495 "c512" +OpName %496 "c513" +OpName %497 "c514" +OpName %498 "c515" +OpName %499 "c516" +OpName %500 "c517" +OpName %501 "c518" +OpName %502 "c519" +OpName %503 "c52" +OpName %504 "c520" +OpName %505 "c521" +OpName %506 "c522" +OpName %507 "c523" +OpName %508 "c524" +OpName %509 "c525" +OpName %510 "c526" +OpName %511 "c527" +OpName %512 "c528" +OpName %513 "c529" +OpName %514 "c53" +OpName %515 "c530" +OpName %516 "c531" +OpName %517 "c532" +OpName %518 "c533" +OpName %519 "c534" +OpName %520 "c535" +OpName %521 "c536" +OpName %522 "c537" +OpName %523 "c538" +OpName %524 "c539" +OpName %525 "c54" +OpName %526 "c540" +OpName %527 "c541" +OpName %528 "c542" +OpName %529 "c543" +OpName %530 "c544" +OpName %531 "c545" +OpName %532 "c546" +OpName %533 "c547" +OpName %534 "c548" +OpName %535 "c549" +OpName %536 "c55" +OpName %537 "c550" +OpName %538 "c551" +OpName %539 "c552" +OpName %540 "c553" +OpName %541 "c554" +OpName %542 "c555" +OpName %543 "c556" +OpName %544 "c557" +OpName %545 "c558" +OpName %546 "c559" +OpName %547 "c56" +OpName %548 "c560" +OpName %549 "c561" +OpName %550 "c562" +OpName %551 "c563" +OpName %552 "c564" +OpName %553 "c565" +OpName %554 "c566" +OpName %555 "c567" +OpName %556 "c568" +OpName %557 "c569" +OpName %558 "c57" +OpName %559 "c570" +OpName %560 "c571" +OpName %561 "c572" +OpName %562 "c573" +OpName %563 "c574" +OpName %564 "c575" +OpName %565 "c576" +OpName %566 "c577" +OpName %567 "c578" +OpName %568 "c579" +OpName %569 "c58" +OpName %570 "c580" +OpName %571 "c581" +OpName %572 "c582" +OpName %573 "c583" +OpName %574 "c584" +OpName %575 "c585" +OpName %576 "c586" +OpName %577 "c587" +OpName %578 "c588" +OpName %579 "c589" +OpName %580 "c59" +OpName %581 "c590" +OpName %582 "c591" +OpName %583 "c592" +OpName %584 "c593" +OpName %585 "c594" +OpName %586 "c595" +OpName %587 "c596" +OpName %588 "c597" +OpName %589 "c598" +OpName %590 "c599" +OpName %591 "c6" +OpName %592 "c60" +OpName %593 "c600" +OpName %594 "c601" +OpName %595 "c602" +OpName %596 "c603" +OpName %597 "c604" +OpName %598 "c605" +OpName %599 "c606" +OpName %600 "c607" +OpName %601 "c608" +OpName %602 "c609" +OpName %603 "c61" +OpName %604 "c610" +OpName %605 "c611" +OpName %606 "c612" +OpName %607 "c613" +OpName %608 "c614" +OpName %609 "c615" +OpName %610 "c616" +OpName %611 "c617" +OpName %612 "c618" +OpName %613 "c619" +OpName %614 "c62" +OpName %615 "c620" +OpName %616 "c621" +OpName %617 "c622" +OpName %618 "c623" +OpName %619 "c624" +OpName %620 "c625" +OpName %621 "c626" +OpName %622 "c627" +OpName %623 "c628" +OpName %624 "c629" +OpName %625 "c63" +OpName %626 "c630" +OpName %627 "c631" +OpName %628 "c632" +OpName %629 "c633" +OpName %630 "c634" +OpName %631 "c635" +OpName %632 "c636" +OpName %633 "c637" +OpName %634 "c638" +OpName %635 "c639" +OpName %636 "c64" +OpName %637 "c640" +OpName %638 "c641" +OpName %639 "c642" +OpName %640 "c643" +OpName %641 "c644" +OpName %642 "c645" +OpName %643 "c646" +OpName %644 "c647" +OpName %645 "c648" +OpName %646 "c649" +OpName %647 "c65" +OpName %648 "c650" +OpName %649 "c651" +OpName %650 "c652" +OpName %651 "c653" +OpName %652 "c654" +OpName %653 "c655" +OpName %654 "c656" +OpName %655 "c657" +OpName %656 "c658" +OpName %657 "c659" +OpName %658 "c66" +OpName %659 "c660" +OpName %660 "c661" +OpName %661 "c662" +OpName %662 "c663" +OpName %663 "c664" +OpName %664 "c665" +OpName %665 "c666" +OpName %666 "c667" +OpName %667 "c668" +OpName %668 "c669" +OpName %669 "c67" +OpName %670 "c670" +OpName %671 "c671" +OpName %672 "c672" +OpName %673 "c673" +OpName %674 "c674" +OpName %675 "c675" +OpName %676 "c676" +OpName %677 "c677" +OpName %678 "c678" +OpName %679 "c679" +OpName %680 "c68" +OpName %681 "c680" +OpName %682 "c681" +OpName %683 "c682" +OpName %684 "c683" +OpName %685 "c684" +OpName %686 "c685" +OpName %687 "c686" +OpName %688 "c687" +OpName %689 "c688" +OpName %690 "c689" +OpName %691 "c69" +OpName %692 "c690" +OpName %693 "c691" +OpName %694 "c692" +OpName %695 "c693" +OpName %696 "c694" +OpName %697 "c695" +OpName %698 "c696" +OpName %699 "c697" +OpName %700 "c698" +OpName %701 "c699" +OpName %702 "c7" +OpName %703 "c70" +OpName %704 "c700" +OpName %705 "c701" +OpName %706 "c702" +OpName %707 "c703" +OpName %708 "c704" +OpName %709 "c705" +OpName %710 "c706" +OpName %711 "c707" +OpName %712 "c708" +OpName %713 "c709" +OpName %714 "c71" +OpName %715 "c710" +OpName %716 "c711" +OpName %717 "c712" +OpName %718 "c713" +OpName %719 "c714" +OpName %720 "c715" +OpName %721 "c716" +OpName %722 "c717" +OpName %723 "c718" +OpName %724 "c719" +OpName %725 "c72" +OpName %726 "c720" +OpName %727 "c721" +OpName %728 "c722" +OpName %729 "c723" +OpName %730 "c724" +OpName %731 "c725" +OpName %732 "c726" +OpName %733 "c727" +OpName %734 "c728" +OpName %735 "c729" +OpName %736 "c73" +OpName %737 "c730" +OpName %738 "c731" +OpName %739 "c732" +OpName %740 "c733" +OpName %741 "c734" +OpName %742 "c735" +OpName %743 "c736" +OpName %744 "c737" +OpName %745 "c738" +OpName %746 "c739" +OpName %747 "c74" +OpName %748 "c740" +OpName %749 "c741" +OpName %750 "c742" +OpName %751 "c743" +OpName %752 "c744" +OpName %753 "c745" +OpName %754 "c746" +OpName %755 "c747" +OpName %756 "c748" +OpName %757 "c749" +OpName %758 "c75" +OpName %759 "c750" +OpName %760 "c751" +OpName %761 "c752" +OpName %762 "c753" +OpName %763 "c754" +OpName %764 "c755" +OpName %765 "c756" +OpName %766 "c757" +OpName %767 "c758" +OpName %768 "c759" +OpName %769 "c76" +OpName %770 "c760" +OpName %771 "c761" +OpName %772 "c762" +OpName %773 "c763" +OpName %774 "c764" +OpName %775 "c765" +OpName %776 "c766" +OpName %777 "c767" +OpName %778 "c768" +OpName %779 "c769" +OpName %780 "c77" +OpName %781 "c770" +OpName %782 "c771" +OpName %783 "c772" +OpName %784 "c773" +OpName %785 "c774" +OpName %786 "c775" +OpName %787 "c776" +OpName %788 "c777" +OpName %789 "c778" +OpName %790 "c779" +OpName %791 "c78" +OpName %792 "c780" +OpName %793 "c781" +OpName %794 "c782" +OpName %795 "c783" +OpName %796 "c784" +OpName %797 "c785" +OpName %798 "c786" +OpName %799 "c787" +OpName %800 "c788" +OpName %801 "c789" +OpName %802 "c79" +OpName %803 "c790" +OpName %804 "c791" +OpName %805 "c792" +OpName %806 "c793" +OpName %807 "c794" +OpName %808 "c795" +OpName %809 "c796" +OpName %810 "c797" +OpName %811 "c798" +OpName %812 "c799" +OpName %813 "c8" +OpName %814 "c80" +OpName %815 "c800" +OpName %816 "c801" +OpName %817 "c802" +OpName %818 "c803" +OpName %819 "c804" +OpName %820 "c805" +OpName %821 "c806" +OpName %822 "c807" +OpName %823 "c808" +OpName %824 "c809" +OpName %825 "c81" +OpName %826 "c810" +OpName %827 "c811" +OpName %828 "c812" +OpName %829 "c813" +OpName %830 "c814" +OpName %831 "c815" +OpName %832 "c816" +OpName %833 "c817" +OpName %834 "c818" +OpName %835 "c819" +OpName %836 "c82" +OpName %837 "c820" +OpName %838 "c821" +OpName %839 "c822" +OpName %840 "c823" +OpName %841 "c824" +OpName %842 "c825" +OpName %843 "c826" +OpName %844 "c827" +OpName %845 "c828" +OpName %846 "c829" +OpName %847 "c83" +OpName %848 "c830" +OpName %849 "c831" +OpName %850 "c832" +OpName %851 "c833" +OpName %852 "c834" +OpName %853 "c835" +OpName %854 "c836" +OpName %855 "c837" +OpName %856 "c838" +OpName %857 "c839" +OpName %858 "c84" +OpName %859 "c840" +OpName %860 "c841" +OpName %861 "c842" +OpName %862 "c843" +OpName %863 "c844" +OpName %864 "c845" +OpName %865 "c846" +OpName %866 "c847" +OpName %867 "c848" +OpName %868 "c849" +OpName %869 "c85" +OpName %870 "c850" +OpName %871 "c851" +OpName %872 "c852" +OpName %873 "c853" +OpName %874 "c854" +OpName %875 "c855" +OpName %876 "c856" +OpName %877 "c857" +OpName %878 "c858" +OpName %879 "c859" +OpName %880 "c86" +OpName %881 "c860" +OpName %882 "c861" +OpName %883 "c862" +OpName %884 "c863" +OpName %885 "c864" +OpName %886 "c865" +OpName %887 "c866" +OpName %888 "c867" +OpName %889 "c868" +OpName %890 "c869" +OpName %891 "c87" +OpName %892 "c870" +OpName %893 "c871" +OpName %894 "c872" +OpName %895 "c873" +OpName %896 "c874" +OpName %897 "c875" +OpName %898 "c876" +OpName %899 "c877" +OpName %900 "c878" +OpName %901 "c879" +OpName %902 "c88" +OpName %903 "c880" +OpName %904 "c881" +OpName %905 "c882" +OpName %906 "c883" +OpName %907 "c884" +OpName %908 "c885" +OpName %909 "c886" +OpName %910 "c887" +OpName %911 "c888" +OpName %912 "c889" +OpName %913 "c89" +OpName %914 "c890" +OpName %915 "c891" +OpName %916 "c892" +OpName %917 "c893" +OpName %918 "c894" +OpName %919 "c895" +OpName %920 "c896" +OpName %921 "c897" +OpName %922 "c898" +OpName %923 "c899" +OpName %924 "c9" +OpName %925 "c90" +OpName %926 "c900" +OpName %927 "c901" +OpName %928 "c902" +OpName %929 "c903" +OpName %930 "c904" +OpName %931 "c905" +OpName %932 "c906" +OpName %933 "c907" +OpName %934 "c908" +OpName %935 "c909" +OpName %936 "c91" +OpName %937 "c910" +OpName %938 "c911" +OpName %939 "c912" +OpName %940 "c913" +OpName %941 "c914" +OpName %942 "c915" +OpName %943 "c916" +OpName %944 "c917" +OpName %945 "c918" +OpName %946 "c919" +OpName %947 "c92" +OpName %948 "c920" +OpName %949 "c921" +OpName %950 "c922" +OpName %951 "c923" +OpName %952 "c924" +OpName %953 "c925" +OpName %954 "c926" +OpName %955 "c927" +OpName %956 "c928" +OpName %957 "c929" +OpName %958 "c93" +OpName %959 "c930" +OpName %960 "c931" +OpName %961 "c932" +OpName %962 "c933" +OpName %963 "c934" +OpName %964 "c935" +OpName %965 "c936" +OpName %966 "c937" +OpName %967 "c938" +OpName %968 "c939" +OpName %969 "c94" +OpName %970 "c940" +OpName %971 "c941" +OpName %972 "c942" +OpName %973 "c943" +OpName %974 "c944" +OpName %975 "c945" +OpName %976 "c946" +OpName %977 "c947" +OpName %978 "c948" +OpName %979 "c949" +OpName %980 "c95" +OpName %981 "c950" +OpName %982 "c951" +OpName %983 "c952" +OpName %984 "c953" +OpName %985 "c954" +OpName %986 "c955" +OpName %987 "c956" +OpName %988 "c957" +OpName %989 "c958" +OpName %990 "c959" +OpName %991 "c96" +OpName %992 "c960" +OpName %993 "c961" +OpName %994 "c962" +OpName %995 "c963" +OpName %996 "c964" +OpName %997 "c965" +OpName %998 "c966" +OpName %999 "c967" +OpName %1000 "c968" +OpName %1001 "c969" +OpName %1002 "c97" +OpName %1003 "c970" +OpName %1004 "c971" +OpName %1005 "c972" +OpName %1006 "c973" +OpName %1007 "c974" +OpName %1008 "c975" +OpName %1009 "c976" +OpName %1010 "c977" +OpName %1011 "c978" +OpName %1012 "c979" +OpName %1013 "c98" +OpName %1014 "c980" +OpName %1015 "c981" +OpName %1016 "c982" +OpName %1017 "c983" +OpName %1018 "c984" +OpName %1019 "c985" +OpName %1020 "c986" +OpName %1021 "c987" +OpName %1022 "c988" +OpName %1023 "c989" +OpName %1024 "c99" +OpName %1025 "c990" +OpName %1026 "c991" +OpName %1027 "c992" +OpName %1028 "c993" +OpName %1029 "c994" +OpName %1030 "c995" +OpName %1031 "c996" +OpName %1032 "c997" +OpName %1033 "c998" +OpName %1034 "c999" +OpName %1038 "InputBlock" +OpMemberName %1038 0 "values" +OpName %1040 "ib" +OpName %1054 "gl_LocalInvocationIndex" +OpName %14374 "result" +OpName %16399 "OutputBlock" +OpMemberName %16399 0 "values" +OpName %16401 "ob" +OpDecorate %1037 ArrayStride 4 +OpMemberDecorate %1038 0 Offset 0 +OpDecorate %1038 BufferBlock +OpDecorate %1040 DescriptorSet 0 +OpDecorate %1040 Binding 0 +OpDecorate %1054 BuiltIn LocalInvocationIndex +OpDecorate %16398 ArrayStride 4 +OpMemberDecorate %16399 0 Offset 0 +OpDecorate %16399 BufferBlock +OpDecorate %16401 DescriptorSet 0 +OpDecorate %16401 Binding 1 +OpDecorate %16406 BuiltIn WorkgroupSize +%2 = OpTypeVoid +%3 = OpTypeFunction %2 +%6 = OpTypeInt 32 1 +%7 = OpTypePointer Function %6 +%9 = OpConstant %6 0 +%1035 = OpTypeInt 32 0 +%1036 = OpConstant %1035 4 +%1037 = OpTypeArray %6 %1036 +%1038 = OpTypeStruct %1037 +%1039 = OpTypePointer Uniform %1038 +%1040 = OpVariable %1039 Uniform +%1041 = OpTypePointer Uniform %6 +%1044 = OpConstant %6 1 +%1047 = OpConstant %6 2 +%1050 = OpConstant %6 3 +%1053 = OpTypePointer Input %1035 +%1054 = OpVariable %1053 Input +%1056 = OpConstant %1035 3 +%1057 = OpTypeBool +%1072 = OpConstant %1035 1 +%1094 = OpConstant %1035 0 +%1138 = OpConstant %1035 2 +%16398 = OpTypeArray %6 %1036 +%16399 = OpTypeStruct %16398 +%16400 = OpTypePointer Uniform %16399 +%16401 = OpVariable %16400 Uniform +%16405 = OpTypeVector %1035 3 +%16406 = OpConstantComposite %16405 %1036 %1072 %1072 +%4 = OpFunction %2 None %3 +%5 = OpLabel +%8 = OpVariable %7 Function +%10 = OpVariable %7 Function +%11 = OpVariable %7 Function +%12 = OpVariable %7 Function +%13 = OpVariable %7 Function +%14 = OpVariable %7 Function +%15 = OpVariable %7 Function +%16 = OpVariable %7 Function +%17 = OpVariable %7 Function +%18 = OpVariable %7 Function +%19 = OpVariable %7 Function +%20 = OpVariable %7 Function +%21 = OpVariable %7 Function +%22 = OpVariable %7 Function +%23 = OpVariable %7 Function +%24 = OpVariable %7 Function +%25 = OpVariable %7 Function +%26 = OpVariable %7 Function +%27 = OpVariable %7 Function +%28 = OpVariable %7 Function +%29 = OpVariable %7 Function +%30 = OpVariable %7 Function +%31 = OpVariable %7 Function +%32 = OpVariable %7 Function +%33 = OpVariable %7 Function +%34 = OpVariable %7 Function +%35 = OpVariable %7 Function +%36 = OpVariable %7 Function +%37 = OpVariable %7 Function +%38 = OpVariable %7 Function +%39 = OpVariable %7 Function +%40 = OpVariable %7 Function +%41 = OpVariable %7 Function +%42 = OpVariable %7 Function +%43 = OpVariable %7 Function +%44 = OpVariable %7 Function +%45 = OpVariable %7 Function +%46 = OpVariable %7 Function +%47 = OpVariable %7 Function +%48 = OpVariable %7 Function +%49 = OpVariable %7 Function +%50 = OpVariable %7 Function +%51 = OpVariable %7 Function +%52 = OpVariable %7 Function +%53 = OpVariable %7 Function +%54 = OpVariable %7 Function +%55 = OpVariable %7 Function +%56 = OpVariable %7 Function +%57 = OpVariable %7 Function +%58 = OpVariable %7 Function +%59 = OpVariable %7 Function +%60 = OpVariable %7 Function +%61 = OpVariable %7 Function +%62 = OpVariable %7 Function +%63 = OpVariable %7 Function +%64 = OpVariable %7 Function +%65 = OpVariable %7 Function +%66 = OpVariable %7 Function +%67 = OpVariable %7 Function +%68 = OpVariable %7 Function +%69 = OpVariable %7 Function +%70 = OpVariable %7 Function +%71 = OpVariable %7 Function +%72 = OpVariable %7 Function +%73 = OpVariable %7 Function +%74 = OpVariable %7 Function +%75 = OpVariable %7 Function +%76 = OpVariable %7 Function +%77 = OpVariable %7 Function +%78 = OpVariable %7 Function +%79 = OpVariable %7 Function +%80 = OpVariable %7 Function +%81 = OpVariable %7 Function +%82 = OpVariable %7 Function +%83 = OpVariable %7 Function +%84 = OpVariable %7 Function +%85 = OpVariable %7 Function +%86 = OpVariable %7 Function +%87 = OpVariable %7 Function +%88 = OpVariable %7 Function +%89 = OpVariable %7 Function +%90 = OpVariable %7 Function +%91 = OpVariable %7 Function +%92 = OpVariable %7 Function +%93 = OpVariable %7 Function +%94 = OpVariable %7 Function +%95 = OpVariable %7 Function +%96 = OpVariable %7 Function +%97 = OpVariable %7 Function +%98 = OpVariable %7 Function +%99 = OpVariable %7 Function +%100 = OpVariable %7 Function +%101 = OpVariable %7 Function +%102 = OpVariable %7 Function +%103 = OpVariable %7 Function +%104 = OpVariable %7 Function +%105 = OpVariable %7 Function +%106 = OpVariable %7 Function +%107 = OpVariable %7 Function +%108 = OpVariable %7 Function +%109 = OpVariable %7 Function +%110 = OpVariable %7 Function +%111 = OpVariable %7 Function +%112 = OpVariable %7 Function +%113 = OpVariable %7 Function +%114 = OpVariable %7 Function +%115 = OpVariable %7 Function +%116 = OpVariable %7 Function +%117 = OpVariable %7 Function +%118 = OpVariable %7 Function +%119 = OpVariable %7 Function +%120 = OpVariable %7 Function +%121 = OpVariable %7 Function +%122 = OpVariable %7 Function +%123 = OpVariable %7 Function +%124 = OpVariable %7 Function +%125 = OpVariable %7 Function +%126 = OpVariable %7 Function +%127 = OpVariable %7 Function +%128 = OpVariable %7 Function +%129 = OpVariable %7 Function +%130 = OpVariable %7 Function +%131 = OpVariable %7 Function +%132 = OpVariable %7 Function +%133 = OpVariable %7 Function +%134 = OpVariable %7 Function +%135 = OpVariable %7 Function +%136 = OpVariable %7 Function +%137 = OpVariable %7 Function +%138 = OpVariable %7 Function +%139 = OpVariable %7 Function +%140 = OpVariable %7 Function +%141 = OpVariable %7 Function +%142 = OpVariable %7 Function +%143 = OpVariable %7 Function +%144 = OpVariable %7 Function +%145 = OpVariable %7 Function +%146 = OpVariable %7 Function +%147 = OpVariable %7 Function +%148 = OpVariable %7 Function +%149 = OpVariable %7 Function +%150 = OpVariable %7 Function +%151 = OpVariable %7 Function +%152 = OpVariable %7 Function +%153 = OpVariable %7 Function +%154 = OpVariable %7 Function +%155 = OpVariable %7 Function +%156 = OpVariable %7 Function +%157 = OpVariable %7 Function +%158 = OpVariable %7 Function +%159 = OpVariable %7 Function +%160 = OpVariable %7 Function +%161 = OpVariable %7 Function +%162 = OpVariable %7 Function +%163 = OpVariable %7 Function +%164 = OpVariable %7 Function +%165 = OpVariable %7 Function +%166 = OpVariable %7 Function +%167 = OpVariable %7 Function +%168 = OpVariable %7 Function +%169 = OpVariable %7 Function +%170 = OpVariable %7 Function +%171 = OpVariable %7 Function +%172 = OpVariable %7 Function +%173 = OpVariable %7 Function +%174 = OpVariable %7 Function +%175 = OpVariable %7 Function +%176 = OpVariable %7 Function +%177 = OpVariable %7 Function +%178 = OpVariable %7 Function +%179 = OpVariable %7 Function +%180 = OpVariable %7 Function +%181 = OpVariable %7 Function +%182 = OpVariable %7 Function +%183 = OpVariable %7 Function +%184 = OpVariable %7 Function +%185 = OpVariable %7 Function +%186 = OpVariable %7 Function +%187 = OpVariable %7 Function +%188 = OpVariable %7 Function +%189 = OpVariable %7 Function +%190 = OpVariable %7 Function +%191 = OpVariable %7 Function +%192 = OpVariable %7 Function +%193 = OpVariable %7 Function +%194 = OpVariable %7 Function +%195 = OpVariable %7 Function +%196 = OpVariable %7 Function +%197 = OpVariable %7 Function +%198 = OpVariable %7 Function +%199 = OpVariable %7 Function +%200 = OpVariable %7 Function +%201 = OpVariable %7 Function +%202 = OpVariable %7 Function +%203 = OpVariable %7 Function +%204 = OpVariable %7 Function +%205 = OpVariable %7 Function +%206 = OpVariable %7 Function +%207 = OpVariable %7 Function +%208 = OpVariable %7 Function +%209 = OpVariable %7 Function +%210 = OpVariable %7 Function +%211 = OpVariable %7 Function +%212 = OpVariable %7 Function +%213 = OpVariable %7 Function +%214 = OpVariable %7 Function +%215 = OpVariable %7 Function +%216 = OpVariable %7 Function +%217 = OpVariable %7 Function +%218 = OpVariable %7 Function +%219 = OpVariable %7 Function +%220 = OpVariable %7 Function +%221 = OpVariable %7 Function +%222 = OpVariable %7 Function +%223 = OpVariable %7 Function +%224 = OpVariable %7 Function +%225 = OpVariable %7 Function +%226 = OpVariable %7 Function +%227 = OpVariable %7 Function +%228 = OpVariable %7 Function +%229 = OpVariable %7 Function +%230 = OpVariable %7 Function +%231 = OpVariable %7 Function +%232 = OpVariable %7 Function +%233 = OpVariable %7 Function +%234 = OpVariable %7 Function +%235 = OpVariable %7 Function +%236 = OpVariable %7 Function +%237 = OpVariable %7 Function +%238 = OpVariable %7 Function +%239 = OpVariable %7 Function +%240 = OpVariable %7 Function +%241 = OpVariable %7 Function +%242 = OpVariable %7 Function +%243 = OpVariable %7 Function +%244 = OpVariable %7 Function +%245 = OpVariable %7 Function +%246 = OpVariable %7 Function +%247 = OpVariable %7 Function +%248 = OpVariable %7 Function +%249 = OpVariable %7 Function +%250 = OpVariable %7 Function +%251 = OpVariable %7 Function +%252 = OpVariable %7 Function +%253 = OpVariable %7 Function +%254 = OpVariable %7 Function +%255 = OpVariable %7 Function +%256 = OpVariable %7 Function +%257 = OpVariable %7 Function +%258 = OpVariable %7 Function +%259 = OpVariable %7 Function +%260 = OpVariable %7 Function +%261 = OpVariable %7 Function +%262 = OpVariable %7 Function +%263 = OpVariable %7 Function +%264 = OpVariable %7 Function +%265 = OpVariable %7 Function +%266 = OpVariable %7 Function +%267 = OpVariable %7 Function +%268 = OpVariable %7 Function +%269 = OpVariable %7 Function +%270 = OpVariable %7 Function +%271 = OpVariable %7 Function +%272 = OpVariable %7 Function +%273 = OpVariable %7 Function +%274 = OpVariable %7 Function +%275 = OpVariable %7 Function +%276 = OpVariable %7 Function +%277 = OpVariable %7 Function +%278 = OpVariable %7 Function +%279 = OpVariable %7 Function +%280 = OpVariable %7 Function +%281 = OpVariable %7 Function +%282 = OpVariable %7 Function +%283 = OpVariable %7 Function +%284 = OpVariable %7 Function +%285 = OpVariable %7 Function +%286 = OpVariable %7 Function +%287 = OpVariable %7 Function +%288 = OpVariable %7 Function +%289 = OpVariable %7 Function +%290 = OpVariable %7 Function +%291 = OpVariable %7 Function +%292 = OpVariable %7 Function +%293 = OpVariable %7 Function +%294 = OpVariable %7 Function +%295 = OpVariable %7 Function +%296 = OpVariable %7 Function +%297 = OpVariable %7 Function +%298 = OpVariable %7 Function +%299 = OpVariable %7 Function +%300 = OpVariable %7 Function +%301 = OpVariable %7 Function +%302 = OpVariable %7 Function +%303 = OpVariable %7 Function +%304 = OpVariable %7 Function +%305 = OpVariable %7 Function +%306 = OpVariable %7 Function +%307 = OpVariable %7 Function +%308 = OpVariable %7 Function +%309 = OpVariable %7 Function +%310 = OpVariable %7 Function +%311 = OpVariable %7 Function +%312 = OpVariable %7 Function +%313 = OpVariable %7 Function +%314 = OpVariable %7 Function +%315 = OpVariable %7 Function +%316 = OpVariable %7 Function +%317 = OpVariable %7 Function +%318 = OpVariable %7 Function +%319 = OpVariable %7 Function +%320 = OpVariable %7 Function +%321 = OpVariable %7 Function +%322 = OpVariable %7 Function +%323 = OpVariable %7 Function +%324 = OpVariable %7 Function +%325 = OpVariable %7 Function +%326 = OpVariable %7 Function +%327 = OpVariable %7 Function +%328 = OpVariable %7 Function +%329 = OpVariable %7 Function +%330 = OpVariable %7 Function +%331 = OpVariable %7 Function +%332 = OpVariable %7 Function +%333 = OpVariable %7 Function +%334 = OpVariable %7 Function +%335 = OpVariable %7 Function +%336 = OpVariable %7 Function +%337 = OpVariable %7 Function +%338 = OpVariable %7 Function +%339 = OpVariable %7 Function +%340 = OpVariable %7 Function +%341 = OpVariable %7 Function +%342 = OpVariable %7 Function +%343 = OpVariable %7 Function +%344 = OpVariable %7 Function +%345 = OpVariable %7 Function +%346 = OpVariable %7 Function +%347 = OpVariable %7 Function +%348 = OpVariable %7 Function +%349 = OpVariable %7 Function +%350 = OpVariable %7 Function +%351 = OpVariable %7 Function +%352 = OpVariable %7 Function +%353 = OpVariable %7 Function +%354 = OpVariable %7 Function +%355 = OpVariable %7 Function +%356 = OpVariable %7 Function +%357 = OpVariable %7 Function +%358 = OpVariable %7 Function +%359 = OpVariable %7 Function +%360 = OpVariable %7 Function +%361 = OpVariable %7 Function +%362 = OpVariable %7 Function +%363 = OpVariable %7 Function +%364 = OpVariable %7 Function +%365 = OpVariable %7 Function +%366 = OpVariable %7 Function +%367 = OpVariable %7 Function +%368 = OpVariable %7 Function +%369 = OpVariable %7 Function +%370 = OpVariable %7 Function +%371 = OpVariable %7 Function +%372 = OpVariable %7 Function +%373 = OpVariable %7 Function +%374 = OpVariable %7 Function +%375 = OpVariable %7 Function +%376 = OpVariable %7 Function +%377 = OpVariable %7 Function +%378 = OpVariable %7 Function +%379 = OpVariable %7 Function +%380 = OpVariable %7 Function +%381 = OpVariable %7 Function +%382 = OpVariable %7 Function +%383 = OpVariable %7 Function +%384 = OpVariable %7 Function +%385 = OpVariable %7 Function +%386 = OpVariable %7 Function +%387 = OpVariable %7 Function +%388 = OpVariable %7 Function +%389 = OpVariable %7 Function +%390 = OpVariable %7 Function +%391 = OpVariable %7 Function +%392 = OpVariable %7 Function +%393 = OpVariable %7 Function +%394 = OpVariable %7 Function +%395 = OpVariable %7 Function +%396 = OpVariable %7 Function +%397 = OpVariable %7 Function +%398 = OpVariable %7 Function +%399 = OpVariable %7 Function +%400 = OpVariable %7 Function +%401 = OpVariable %7 Function +%402 = OpVariable %7 Function +%403 = OpVariable %7 Function +%404 = OpVariable %7 Function +%405 = OpVariable %7 Function +%406 = OpVariable %7 Function +%407 = OpVariable %7 Function +%408 = OpVariable %7 Function +%409 = OpVariable %7 Function +%410 = OpVariable %7 Function +%411 = OpVariable %7 Function +%412 = OpVariable %7 Function +%413 = OpVariable %7 Function +%414 = OpVariable %7 Function +%415 = OpVariable %7 Function +%416 = OpVariable %7 Function +%417 = OpVariable %7 Function +%418 = OpVariable %7 Function +%419 = OpVariable %7 Function +%420 = OpVariable %7 Function +%421 = OpVariable %7 Function +%422 = OpVariable %7 Function +%423 = OpVariable %7 Function +%424 = OpVariable %7 Function +%425 = OpVariable %7 Function +%426 = OpVariable %7 Function +%427 = OpVariable %7 Function +%428 = OpVariable %7 Function +%429 = OpVariable %7 Function +%430 = OpVariable %7 Function +%431 = OpVariable %7 Function +%432 = OpVariable %7 Function +%433 = OpVariable %7 Function +%434 = OpVariable %7 Function +%435 = OpVariable %7 Function +%436 = OpVariable %7 Function +%437 = OpVariable %7 Function +%438 = OpVariable %7 Function +%439 = OpVariable %7 Function +%440 = OpVariable %7 Function +%441 = OpVariable %7 Function +%442 = OpVariable %7 Function +%443 = OpVariable %7 Function +%444 = OpVariable %7 Function +%445 = OpVariable %7 Function +%446 = OpVariable %7 Function +%447 = OpVariable %7 Function +%448 = OpVariable %7 Function +%449 = OpVariable %7 Function +%450 = OpVariable %7 Function +%451 = OpVariable %7 Function +%452 = OpVariable %7 Function +%453 = OpVariable %7 Function +%454 = OpVariable %7 Function +%455 = OpVariable %7 Function +%456 = OpVariable %7 Function +%457 = OpVariable %7 Function +%458 = OpVariable %7 Function +%459 = OpVariable %7 Function +%460 = OpVariable %7 Function +%461 = OpVariable %7 Function +%462 = OpVariable %7 Function +%463 = OpVariable %7 Function +%464 = OpVariable %7 Function +%465 = OpVariable %7 Function +%466 = OpVariable %7 Function +%467 = OpVariable %7 Function +%468 = OpVariable %7 Function +%469 = OpVariable %7 Function +%470 = OpVariable %7 Function +%471 = OpVariable %7 Function +%472 = OpVariable %7 Function +%473 = OpVariable %7 Function +%474 = OpVariable %7 Function +%475 = OpVariable %7 Function +%476 = OpVariable %7 Function +%477 = OpVariable %7 Function +%478 = OpVariable %7 Function +%479 = OpVariable %7 Function +%480 = OpVariable %7 Function +%481 = OpVariable %7 Function +%482 = OpVariable %7 Function +%483 = OpVariable %7 Function +%484 = OpVariable %7 Function +%485 = OpVariable %7 Function +%486 = OpVariable %7 Function +%487 = OpVariable %7 Function +%488 = OpVariable %7 Function +%489 = OpVariable %7 Function +%490 = OpVariable %7 Function +%491 = OpVariable %7 Function +%492 = OpVariable %7 Function +%493 = OpVariable %7 Function +%494 = OpVariable %7 Function +%495 = OpVariable %7 Function +%496 = OpVariable %7 Function +%497 = OpVariable %7 Function +%498 = OpVariable %7 Function +%499 = OpVariable %7 Function +%500 = OpVariable %7 Function +%501 = OpVariable %7 Function +%502 = OpVariable %7 Function +%503 = OpVariable %7 Function +%504 = OpVariable %7 Function +%505 = OpVariable %7 Function +%506 = OpVariable %7 Function +%507 = OpVariable %7 Function +%508 = OpVariable %7 Function +%509 = OpVariable %7 Function +%510 = OpVariable %7 Function +%511 = OpVariable %7 Function +%512 = OpVariable %7 Function +%513 = OpVariable %7 Function +%514 = OpVariable %7 Function +%515 = OpVariable %7 Function +%516 = OpVariable %7 Function +%517 = OpVariable %7 Function +%518 = OpVariable %7 Function +%519 = OpVariable %7 Function +%520 = OpVariable %7 Function +%521 = OpVariable %7 Function +%522 = OpVariable %7 Function +%523 = OpVariable %7 Function +%524 = OpVariable %7 Function +%525 = OpVariable %7 Function +%526 = OpVariable %7 Function +%527 = OpVariable %7 Function +%528 = OpVariable %7 Function +%529 = OpVariable %7 Function +%530 = OpVariable %7 Function +%531 = OpVariable %7 Function +%532 = OpVariable %7 Function +%533 = OpVariable %7 Function +%534 = OpVariable %7 Function +%535 = OpVariable %7 Function +%536 = OpVariable %7 Function +%537 = OpVariable %7 Function +%538 = OpVariable %7 Function +%539 = OpVariable %7 Function +%540 = OpVariable %7 Function +%541 = OpVariable %7 Function +%542 = OpVariable %7 Function +%543 = OpVariable %7 Function +%544 = OpVariable %7 Function +%545 = OpVariable %7 Function +%546 = OpVariable %7 Function +%547 = OpVariable %7 Function +%548 = OpVariable %7 Function +%549 = OpVariable %7 Function +%550 = OpVariable %7 Function +%551 = OpVariable %7 Function +%552 = OpVariable %7 Function +%553 = OpVariable %7 Function +%554 = OpVariable %7 Function +%555 = OpVariable %7 Function +%556 = OpVariable %7 Function +%557 = OpVariable %7 Function +%558 = OpVariable %7 Function +%559 = OpVariable %7 Function +%560 = OpVariable %7 Function +%561 = OpVariable %7 Function +%562 = OpVariable %7 Function +%563 = OpVariable %7 Function +%564 = OpVariable %7 Function +%565 = OpVariable %7 Function +%566 = OpVariable %7 Function +%567 = OpVariable %7 Function +%568 = OpVariable %7 Function +%569 = OpVariable %7 Function +%570 = OpVariable %7 Function +%571 = OpVariable %7 Function +%572 = OpVariable %7 Function +%573 = OpVariable %7 Function +%574 = OpVariable %7 Function +%575 = OpVariable %7 Function +%576 = OpVariable %7 Function +%577 = OpVariable %7 Function +%578 = OpVariable %7 Function +%579 = OpVariable %7 Function +%580 = OpVariable %7 Function +%581 = OpVariable %7 Function +%582 = OpVariable %7 Function +%583 = OpVariable %7 Function +%584 = OpVariable %7 Function +%585 = OpVariable %7 Function +%586 = OpVariable %7 Function +%587 = OpVariable %7 Function +%588 = OpVariable %7 Function +%589 = OpVariable %7 Function +%590 = OpVariable %7 Function +%591 = OpVariable %7 Function +%592 = OpVariable %7 Function +%593 = OpVariable %7 Function +%594 = OpVariable %7 Function +%595 = OpVariable %7 Function +%596 = OpVariable %7 Function +%597 = OpVariable %7 Function +%598 = OpVariable %7 Function +%599 = OpVariable %7 Function +%600 = OpVariable %7 Function +%601 = OpVariable %7 Function +%602 = OpVariable %7 Function +%603 = OpVariable %7 Function +%604 = OpVariable %7 Function +%605 = OpVariable %7 Function +%606 = OpVariable %7 Function +%607 = OpVariable %7 Function +%608 = OpVariable %7 Function +%609 = OpVariable %7 Function +%610 = OpVariable %7 Function +%611 = OpVariable %7 Function +%612 = OpVariable %7 Function +%613 = OpVariable %7 Function +%614 = OpVariable %7 Function +%615 = OpVariable %7 Function +%616 = OpVariable %7 Function +%617 = OpVariable %7 Function +%618 = OpVariable %7 Function +%619 = OpVariable %7 Function +%620 = OpVariable %7 Function +%621 = OpVariable %7 Function +%622 = OpVariable %7 Function +%623 = OpVariable %7 Function +%624 = OpVariable %7 Function +%625 = OpVariable %7 Function +%626 = OpVariable %7 Function +%627 = OpVariable %7 Function +%628 = OpVariable %7 Function +%629 = OpVariable %7 Function +%630 = OpVariable %7 Function +%631 = OpVariable %7 Function +%632 = OpVariable %7 Function +%633 = OpVariable %7 Function +%634 = OpVariable %7 Function +%635 = OpVariable %7 Function +%636 = OpVariable %7 Function +%637 = OpVariable %7 Function +%638 = OpVariable %7 Function +%639 = OpVariable %7 Function +%640 = OpVariable %7 Function +%641 = OpVariable %7 Function +%642 = OpVariable %7 Function +%643 = OpVariable %7 Function +%644 = OpVariable %7 Function +%645 = OpVariable %7 Function +%646 = OpVariable %7 Function +%647 = OpVariable %7 Function +%648 = OpVariable %7 Function +%649 = OpVariable %7 Function +%650 = OpVariable %7 Function +%651 = OpVariable %7 Function +%652 = OpVariable %7 Function +%653 = OpVariable %7 Function +%654 = OpVariable %7 Function +%655 = OpVariable %7 Function +%656 = OpVariable %7 Function +%657 = OpVariable %7 Function +%658 = OpVariable %7 Function +%659 = OpVariable %7 Function +%660 = OpVariable %7 Function +%661 = OpVariable %7 Function +%662 = OpVariable %7 Function +%663 = OpVariable %7 Function +%664 = OpVariable %7 Function +%665 = OpVariable %7 Function +%666 = OpVariable %7 Function +%667 = OpVariable %7 Function +%668 = OpVariable %7 Function +%669 = OpVariable %7 Function +%670 = OpVariable %7 Function +%671 = OpVariable %7 Function +%672 = OpVariable %7 Function +%673 = OpVariable %7 Function +%674 = OpVariable %7 Function +%675 = OpVariable %7 Function +%676 = OpVariable %7 Function +%677 = OpVariable %7 Function +%678 = OpVariable %7 Function +%679 = OpVariable %7 Function +%680 = OpVariable %7 Function +%681 = OpVariable %7 Function +%682 = OpVariable %7 Function +%683 = OpVariable %7 Function +%684 = OpVariable %7 Function +%685 = OpVariable %7 Function +%686 = OpVariable %7 Function +%687 = OpVariable %7 Function +%688 = OpVariable %7 Function +%689 = OpVariable %7 Function +%690 = OpVariable %7 Function +%691 = OpVariable %7 Function +%692 = OpVariable %7 Function +%693 = OpVariable %7 Function +%694 = OpVariable %7 Function +%695 = OpVariable %7 Function +%696 = OpVariable %7 Function +%697 = OpVariable %7 Function +%698 = OpVariable %7 Function +%699 = OpVariable %7 Function +%700 = OpVariable %7 Function +%701 = OpVariable %7 Function +%702 = OpVariable %7 Function +%703 = OpVariable %7 Function +%704 = OpVariable %7 Function +%705 = OpVariable %7 Function +%706 = OpVariable %7 Function +%707 = OpVariable %7 Function +%708 = OpVariable %7 Function +%709 = OpVariable %7 Function +%710 = OpVariable %7 Function +%711 = OpVariable %7 Function +%712 = OpVariable %7 Function +%713 = OpVariable %7 Function +%714 = OpVariable %7 Function +%715 = OpVariable %7 Function +%716 = OpVariable %7 Function +%717 = OpVariable %7 Function +%718 = OpVariable %7 Function +%719 = OpVariable %7 Function +%720 = OpVariable %7 Function +%721 = OpVariable %7 Function +%722 = OpVariable %7 Function +%723 = OpVariable %7 Function +%724 = OpVariable %7 Function +%725 = OpVariable %7 Function +%726 = OpVariable %7 Function +%727 = OpVariable %7 Function +%728 = OpVariable %7 Function +%729 = OpVariable %7 Function +%730 = OpVariable %7 Function +%731 = OpVariable %7 Function +%732 = OpVariable %7 Function +%733 = OpVariable %7 Function +%734 = OpVariable %7 Function +%735 = OpVariable %7 Function +%736 = OpVariable %7 Function +%737 = OpVariable %7 Function +%738 = OpVariable %7 Function +%739 = OpVariable %7 Function +%740 = OpVariable %7 Function +%741 = OpVariable %7 Function +%742 = OpVariable %7 Function +%743 = OpVariable %7 Function +%744 = OpVariable %7 Function +%745 = OpVariable %7 Function +%746 = OpVariable %7 Function +%747 = OpVariable %7 Function +%748 = OpVariable %7 Function +%749 = OpVariable %7 Function +%750 = OpVariable %7 Function +%751 = OpVariable %7 Function +%752 = OpVariable %7 Function +%753 = OpVariable %7 Function +%754 = OpVariable %7 Function +%755 = OpVariable %7 Function +%756 = OpVariable %7 Function +%757 = OpVariable %7 Function +%758 = OpVariable %7 Function +%759 = OpVariable %7 Function +%760 = OpVariable %7 Function +%761 = OpVariable %7 Function +%762 = OpVariable %7 Function +%763 = OpVariable %7 Function +%764 = OpVariable %7 Function +%765 = OpVariable %7 Function +%766 = OpVariable %7 Function +%767 = OpVariable %7 Function +%768 = OpVariable %7 Function +%769 = OpVariable %7 Function +%770 = OpVariable %7 Function +%771 = OpVariable %7 Function +%772 = OpVariable %7 Function +%773 = OpVariable %7 Function +%774 = OpVariable %7 Function +%775 = OpVariable %7 Function +%776 = OpVariable %7 Function +%777 = OpVariable %7 Function +%778 = OpVariable %7 Function +%779 = OpVariable %7 Function +%780 = OpVariable %7 Function +%781 = OpVariable %7 Function +%782 = OpVariable %7 Function +%783 = OpVariable %7 Function +%784 = OpVariable %7 Function +%785 = OpVariable %7 Function +%786 = OpVariable %7 Function +%787 = OpVariable %7 Function +%788 = OpVariable %7 Function +%789 = OpVariable %7 Function +%790 = OpVariable %7 Function +%791 = OpVariable %7 Function +%792 = OpVariable %7 Function +%793 = OpVariable %7 Function +%794 = OpVariable %7 Function +%795 = OpVariable %7 Function +%796 = OpVariable %7 Function +%797 = OpVariable %7 Function +%798 = OpVariable %7 Function +%799 = OpVariable %7 Function +%800 = OpVariable %7 Function +%801 = OpVariable %7 Function +%802 = OpVariable %7 Function +%803 = OpVariable %7 Function +%804 = OpVariable %7 Function +%805 = OpVariable %7 Function +%806 = OpVariable %7 Function +%807 = OpVariable %7 Function +%808 = OpVariable %7 Function +%809 = OpVariable %7 Function +%810 = OpVariable %7 Function +%811 = OpVariable %7 Function +%812 = OpVariable %7 Function +%813 = OpVariable %7 Function +%814 = OpVariable %7 Function +%815 = OpVariable %7 Function +%816 = OpVariable %7 Function +%817 = OpVariable %7 Function +%818 = OpVariable %7 Function +%819 = OpVariable %7 Function +%820 = OpVariable %7 Function +%821 = OpVariable %7 Function +%822 = OpVariable %7 Function +%823 = OpVariable %7 Function +%824 = OpVariable %7 Function +%825 = OpVariable %7 Function +%826 = OpVariable %7 Function +%827 = OpVariable %7 Function +%828 = OpVariable %7 Function +%829 = OpVariable %7 Function +%830 = OpVariable %7 Function +%831 = OpVariable %7 Function +%832 = OpVariable %7 Function +%833 = OpVariable %7 Function +%834 = OpVariable %7 Function +%835 = OpVariable %7 Function +%836 = OpVariable %7 Function +%837 = OpVariable %7 Function +%838 = OpVariable %7 Function +%839 = OpVariable %7 Function +%840 = OpVariable %7 Function +%841 = OpVariable %7 Function +%842 = OpVariable %7 Function +%843 = OpVariable %7 Function +%844 = OpVariable %7 Function +%845 = OpVariable %7 Function +%846 = OpVariable %7 Function +%847 = OpVariable %7 Function +%848 = OpVariable %7 Function +%849 = OpVariable %7 Function +%850 = OpVariable %7 Function +%851 = OpVariable %7 Function +%852 = OpVariable %7 Function +%853 = OpVariable %7 Function +%854 = OpVariable %7 Function +%855 = OpVariable %7 Function +%856 = OpVariable %7 Function +%857 = OpVariable %7 Function +%858 = OpVariable %7 Function +%859 = OpVariable %7 Function +%860 = OpVariable %7 Function +%861 = OpVariable %7 Function +%862 = OpVariable %7 Function +%863 = OpVariable %7 Function +%864 = OpVariable %7 Function +%865 = OpVariable %7 Function +%866 = OpVariable %7 Function +%867 = OpVariable %7 Function +%868 = OpVariable %7 Function +%869 = OpVariable %7 Function +%870 = OpVariable %7 Function +%871 = OpVariable %7 Function +%872 = OpVariable %7 Function +%873 = OpVariable %7 Function +%874 = OpVariable %7 Function +%875 = OpVariable %7 Function +%876 = OpVariable %7 Function +%877 = OpVariable %7 Function +%878 = OpVariable %7 Function +%879 = OpVariable %7 Function +%880 = OpVariable %7 Function +%881 = OpVariable %7 Function +%882 = OpVariable %7 Function +%883 = OpVariable %7 Function +%884 = OpVariable %7 Function +%885 = OpVariable %7 Function +%886 = OpVariable %7 Function +%887 = OpVariable %7 Function +%888 = OpVariable %7 Function +%889 = OpVariable %7 Function +%890 = OpVariable %7 Function +%891 = OpVariable %7 Function +%892 = OpVariable %7 Function +%893 = OpVariable %7 Function +%894 = OpVariable %7 Function +%895 = OpVariable %7 Function +%896 = OpVariable %7 Function +%897 = OpVariable %7 Function +%898 = OpVariable %7 Function +%899 = OpVariable %7 Function +%900 = OpVariable %7 Function +%901 = OpVariable %7 Function +%902 = OpVariable %7 Function +%903 = OpVariable %7 Function +%904 = OpVariable %7 Function +%905 = OpVariable %7 Function +%906 = OpVariable %7 Function +%907 = OpVariable %7 Function +%908 = OpVariable %7 Function +%909 = OpVariable %7 Function +%910 = OpVariable %7 Function +%911 = OpVariable %7 Function +%912 = OpVariable %7 Function +%913 = OpVariable %7 Function +%914 = OpVariable %7 Function +%915 = OpVariable %7 Function +%916 = OpVariable %7 Function +%917 = OpVariable %7 Function +%918 = OpVariable %7 Function +%919 = OpVariable %7 Function +%920 = OpVariable %7 Function +%921 = OpVariable %7 Function +%922 = OpVariable %7 Function +%923 = OpVariable %7 Function +%924 = OpVariable %7 Function +%925 = OpVariable %7 Function +%926 = OpVariable %7 Function +%927 = OpVariable %7 Function +%928 = OpVariable %7 Function +%929 = OpVariable %7 Function +%930 = OpVariable %7 Function +%931 = OpVariable %7 Function +%932 = OpVariable %7 Function +%933 = OpVariable %7 Function +%934 = OpVariable %7 Function +%935 = OpVariable %7 Function +%936 = OpVariable %7 Function +%937 = OpVariable %7 Function +%938 = OpVariable %7 Function +%939 = OpVariable %7 Function +%940 = OpVariable %7 Function +%941 = OpVariable %7 Function +%942 = OpVariable %7 Function +%943 = OpVariable %7 Function +%944 = OpVariable %7 Function +%945 = OpVariable %7 Function +%946 = OpVariable %7 Function +%947 = OpVariable %7 Function +%948 = OpVariable %7 Function +%949 = OpVariable %7 Function +%950 = OpVariable %7 Function +%951 = OpVariable %7 Function +%952 = OpVariable %7 Function +%953 = OpVariable %7 Function +%954 = OpVariable %7 Function +%955 = OpVariable %7 Function +%956 = OpVariable %7 Function +%957 = OpVariable %7 Function +%958 = OpVariable %7 Function +%959 = OpVariable %7 Function +%960 = OpVariable %7 Function +%961 = OpVariable %7 Function +%962 = OpVariable %7 Function +%963 = OpVariable %7 Function +%964 = OpVariable %7 Function +%965 = OpVariable %7 Function +%966 = OpVariable %7 Function +%967 = OpVariable %7 Function +%968 = OpVariable %7 Function +%969 = OpVariable %7 Function +%970 = OpVariable %7 Function +%971 = OpVariable %7 Function +%972 = OpVariable %7 Function +%973 = OpVariable %7 Function +%974 = OpVariable %7 Function +%975 = OpVariable %7 Function +%976 = OpVariable %7 Function +%977 = OpVariable %7 Function +%978 = OpVariable %7 Function +%979 = OpVariable %7 Function +%980 = OpVariable %7 Function +%981 = OpVariable %7 Function +%982 = OpVariable %7 Function +%983 = OpVariable %7 Function +%984 = OpVariable %7 Function +%985 = OpVariable %7 Function +%986 = OpVariable %7 Function +%987 = OpVariable %7 Function +%988 = OpVariable %7 Function +%989 = OpVariable %7 Function +%990 = OpVariable %7 Function +%991 = OpVariable %7 Function +%992 = OpVariable %7 Function +%993 = OpVariable %7 Function +%994 = OpVariable %7 Function +%995 = OpVariable %7 Function +%996 = OpVariable %7 Function +%997 = OpVariable %7 Function +%998 = OpVariable %7 Function +%999 = OpVariable %7 Function +%1000 = OpVariable %7 Function +%1001 = OpVariable %7 Function +%1002 = OpVariable %7 Function +%1003 = OpVariable %7 Function +%1004 = OpVariable %7 Function +%1005 = OpVariable %7 Function +%1006 = OpVariable %7 Function +%1007 = OpVariable %7 Function +%1008 = OpVariable %7 Function +%1009 = OpVariable %7 Function +%1010 = OpVariable %7 Function +%1011 = OpVariable %7 Function +%1012 = OpVariable %7 Function +%1013 = OpVariable %7 Function +%1014 = OpVariable %7 Function +%1015 = OpVariable %7 Function +%1016 = OpVariable %7 Function +%1017 = OpVariable %7 Function +%1018 = OpVariable %7 Function +%1019 = OpVariable %7 Function +%1020 = OpVariable %7 Function +%1021 = OpVariable %7 Function +%1022 = OpVariable %7 Function +%1023 = OpVariable %7 Function +%1024 = OpVariable %7 Function +%1025 = OpVariable %7 Function +%1026 = OpVariable %7 Function +%1027 = OpVariable %7 Function +%1028 = OpVariable %7 Function +%1029 = OpVariable %7 Function +%1030 = OpVariable %7 Function +%1031 = OpVariable %7 Function +%1032 = OpVariable %7 Function +%1033 = OpVariable %7 Function +%1034 = OpVariable %7 Function +%14374 = OpVariable %7 Function +OpStore %8 %9 +OpStore %10 %9 +OpStore %11 %9 +OpStore %12 %9 +OpStore %13 %9 +OpStore %14 %9 +OpStore %15 %9 +OpStore %16 %9 +OpStore %17 %9 +OpStore %18 %9 +OpStore %19 %9 +OpStore %20 %9 +OpStore %21 %9 +OpStore %22 %9 +OpStore %23 %9 +OpStore %24 %9 +OpStore %25 %9 +OpStore %26 %9 +OpStore %27 %9 +OpStore %28 %9 +OpStore %29 %9 +OpStore %30 %9 +OpStore %31 %9 +OpStore %32 %9 +OpStore %33 %9 +OpStore %34 %9 +OpStore %35 %9 +OpStore %36 %9 +OpStore %37 %9 +OpStore %38 %9 +OpStore %39 %9 +OpStore %40 %9 +OpStore %41 %9 +OpStore %42 %9 +OpStore %43 %9 +OpStore %44 %9 +OpStore %45 %9 +OpStore %46 %9 +OpStore %47 %9 +OpStore %48 %9 +OpStore %49 %9 +OpStore %50 %9 +OpStore %51 %9 +OpStore %52 %9 +OpStore %53 %9 +OpStore %54 %9 +OpStore %55 %9 +OpStore %56 %9 +OpStore %57 %9 +OpStore %58 %9 +OpStore %59 %9 +OpStore %60 %9 +OpStore %61 %9 +OpStore %62 %9 +OpStore %63 %9 +OpStore %64 %9 +OpStore %65 %9 +OpStore %66 %9 +OpStore %67 %9 +OpStore %68 %9 +OpStore %69 %9 +OpStore %70 %9 +OpStore %71 %9 +OpStore %72 %9 +OpStore %73 %9 +OpStore %74 %9 +OpStore %75 %9 +OpStore %76 %9 +OpStore %77 %9 +OpStore %78 %9 +OpStore %79 %9 +OpStore %80 %9 +OpStore %81 %9 +OpStore %82 %9 +OpStore %83 %9 +OpStore %84 %9 +OpStore %85 %9 +OpStore %86 %9 +OpStore %87 %9 +OpStore %88 %9 +OpStore %89 %9 +OpStore %90 %9 +OpStore %91 %9 +OpStore %92 %9 +OpStore %93 %9 +OpStore %94 %9 +OpStore %95 %9 +OpStore %96 %9 +OpStore %97 %9 +OpStore %98 %9 +OpStore %99 %9 +OpStore %100 %9 +OpStore %101 %9 +OpStore %102 %9 +OpStore %103 %9 +OpStore %104 %9 +OpStore %105 %9 +OpStore %106 %9 +OpStore %107 %9 +OpStore %108 %9 +OpStore %109 %9 +OpStore %110 %9 +OpStore %111 %9 +OpStore %112 %9 +OpStore %113 %9 +OpStore %114 %9 +OpStore %115 %9 +OpStore %116 %9 +OpStore %117 %9 +OpStore %118 %9 +OpStore %119 %9 +OpStore %120 %9 +OpStore %121 %9 +OpStore %122 %9 +OpStore %123 %9 +OpStore %124 %9 +OpStore %125 %9 +OpStore %126 %9 +OpStore %127 %9 +OpStore %128 %9 +OpStore %129 %9 +OpStore %130 %9 +OpStore %131 %9 +OpStore %132 %9 +OpStore %133 %9 +OpStore %134 %9 +OpStore %135 %9 +OpStore %136 %9 +OpStore %137 %9 +OpStore %138 %9 +OpStore %139 %9 +OpStore %140 %9 +OpStore %141 %9 +OpStore %142 %9 +OpStore %143 %9 +OpStore %144 %9 +OpStore %145 %9 +OpStore %146 %9 +OpStore %147 %9 +OpStore %148 %9 +OpStore %149 %9 +OpStore %150 %9 +OpStore %151 %9 +OpStore %152 %9 +OpStore %153 %9 +OpStore %154 %9 +OpStore %155 %9 +OpStore %156 %9 +OpStore %157 %9 +OpStore %158 %9 +OpStore %159 %9 +OpStore %160 %9 +OpStore %161 %9 +OpStore %162 %9 +OpStore %163 %9 +OpStore %164 %9 +OpStore %165 %9 +OpStore %166 %9 +OpStore %167 %9 +OpStore %168 %9 +OpStore %169 %9 +OpStore %170 %9 +OpStore %171 %9 +OpStore %172 %9 +OpStore %173 %9 +OpStore %174 %9 +OpStore %175 %9 +OpStore %176 %9 +OpStore %177 %9 +OpStore %178 %9 +OpStore %179 %9 +OpStore %180 %9 +OpStore %181 %9 +OpStore %182 %9 +OpStore %183 %9 +OpStore %184 %9 +OpStore %185 %9 +OpStore %186 %9 +OpStore %187 %9 +OpStore %188 %9 +OpStore %189 %9 +OpStore %190 %9 +OpStore %191 %9 +OpStore %192 %9 +OpStore %193 %9 +OpStore %194 %9 +OpStore %195 %9 +OpStore %196 %9 +OpStore %197 %9 +OpStore %198 %9 +OpStore %199 %9 +OpStore %200 %9 +OpStore %201 %9 +OpStore %202 %9 +OpStore %203 %9 +OpStore %204 %9 +OpStore %205 %9 +OpStore %206 %9 +OpStore %207 %9 +OpStore %208 %9 +OpStore %209 %9 +OpStore %210 %9 +OpStore %211 %9 +OpStore %212 %9 +OpStore %213 %9 +OpStore %214 %9 +OpStore %215 %9 +OpStore %216 %9 +OpStore %217 %9 +OpStore %218 %9 +OpStore %219 %9 +OpStore %220 %9 +OpStore %221 %9 +OpStore %222 %9 +OpStore %223 %9 +OpStore %224 %9 +OpStore %225 %9 +OpStore %226 %9 +OpStore %227 %9 +OpStore %228 %9 +OpStore %229 %9 +OpStore %230 %9 +OpStore %231 %9 +OpStore %232 %9 +OpStore %233 %9 +OpStore %234 %9 +OpStore %235 %9 +OpStore %236 %9 +OpStore %237 %9 +OpStore %238 %9 +OpStore %239 %9 +OpStore %240 %9 +OpStore %241 %9 +OpStore %242 %9 +OpStore %243 %9 +OpStore %244 %9 +OpStore %245 %9 +OpStore %246 %9 +OpStore %247 %9 +OpStore %248 %9 +OpStore %249 %9 +OpStore %250 %9 +OpStore %251 %9 +OpStore %252 %9 +OpStore %253 %9 +OpStore %254 %9 +OpStore %255 %9 +OpStore %256 %9 +OpStore %257 %9 +OpStore %258 %9 +OpStore %259 %9 +OpStore %260 %9 +OpStore %261 %9 +OpStore %262 %9 +OpStore %263 %9 +OpStore %264 %9 +OpStore %265 %9 +OpStore %266 %9 +OpStore %267 %9 +OpStore %268 %9 +OpStore %269 %9 +OpStore %270 %9 +OpStore %271 %9 +OpStore %272 %9 +OpStore %273 %9 +OpStore %274 %9 +OpStore %275 %9 +OpStore %276 %9 +OpStore %277 %9 +OpStore %278 %9 +OpStore %279 %9 +OpStore %280 %9 +OpStore %281 %9 +OpStore %282 %9 +OpStore %283 %9 +OpStore %284 %9 +OpStore %285 %9 +OpStore %286 %9 +OpStore %287 %9 +OpStore %288 %9 +OpStore %289 %9 +OpStore %290 %9 +OpStore %291 %9 +OpStore %292 %9 +OpStore %293 %9 +OpStore %294 %9 +OpStore %295 %9 +OpStore %296 %9 +OpStore %297 %9 +OpStore %298 %9 +OpStore %299 %9 +OpStore %300 %9 +OpStore %301 %9 +OpStore %302 %9 +OpStore %303 %9 +OpStore %304 %9 +OpStore %305 %9 +OpStore %306 %9 +OpStore %307 %9 +OpStore %308 %9 +OpStore %309 %9 +OpStore %310 %9 +OpStore %311 %9 +OpStore %312 %9 +OpStore %313 %9 +OpStore %314 %9 +OpStore %315 %9 +OpStore %316 %9 +OpStore %317 %9 +OpStore %318 %9 +OpStore %319 %9 +OpStore %320 %9 +OpStore %321 %9 +OpStore %322 %9 +OpStore %323 %9 +OpStore %324 %9 +OpStore %325 %9 +OpStore %326 %9 +OpStore %327 %9 +OpStore %328 %9 +OpStore %329 %9 +OpStore %330 %9 +OpStore %331 %9 +OpStore %332 %9 +OpStore %333 %9 +OpStore %334 %9 +OpStore %335 %9 +OpStore %336 %9 +OpStore %337 %9 +OpStore %338 %9 +OpStore %339 %9 +OpStore %340 %9 +OpStore %341 %9 +OpStore %342 %9 +OpStore %343 %9 +OpStore %344 %9 +OpStore %345 %9 +OpStore %346 %9 +OpStore %347 %9 +OpStore %348 %9 +OpStore %349 %9 +OpStore %350 %9 +OpStore %351 %9 +OpStore %352 %9 +OpStore %353 %9 +OpStore %354 %9 +OpStore %355 %9 +OpStore %356 %9 +OpStore %357 %9 +OpStore %358 %9 +OpStore %359 %9 +OpStore %360 %9 +OpStore %361 %9 +OpStore %362 %9 +OpStore %363 %9 +OpStore %364 %9 +OpStore %365 %9 +OpStore %366 %9 +OpStore %367 %9 +OpStore %368 %9 +OpStore %369 %9 +OpStore %370 %9 +OpStore %371 %9 +OpStore %372 %9 +OpStore %373 %9 +OpStore %374 %9 +OpStore %375 %9 +OpStore %376 %9 +OpStore %377 %9 +OpStore %378 %9 +OpStore %379 %9 +OpStore %380 %9 +OpStore %381 %9 +OpStore %382 %9 +OpStore %383 %9 +OpStore %384 %9 +OpStore %385 %9 +OpStore %386 %9 +OpStore %387 %9 +OpStore %388 %9 +OpStore %389 %9 +OpStore %390 %9 +OpStore %391 %9 +OpStore %392 %9 +OpStore %393 %9 +OpStore %394 %9 +OpStore %395 %9 +OpStore %396 %9 +OpStore %397 %9 +OpStore %398 %9 +OpStore %399 %9 +OpStore %400 %9 +OpStore %401 %9 +OpStore %402 %9 +OpStore %403 %9 +OpStore %404 %9 +OpStore %405 %9 +OpStore %406 %9 +OpStore %407 %9 +OpStore %408 %9 +OpStore %409 %9 +OpStore %410 %9 +OpStore %411 %9 +OpStore %412 %9 +OpStore %413 %9 +OpStore %414 %9 +OpStore %415 %9 +OpStore %416 %9 +OpStore %417 %9 +OpStore %418 %9 +OpStore %419 %9 +OpStore %420 %9 +OpStore %421 %9 +OpStore %422 %9 +OpStore %423 %9 +OpStore %424 %9 +OpStore %425 %9 +OpStore %426 %9 +OpStore %427 %9 +OpStore %428 %9 +OpStore %429 %9 +OpStore %430 %9 +OpStore %431 %9 +OpStore %432 %9 +OpStore %433 %9 +OpStore %434 %9 +OpStore %435 %9 +OpStore %436 %9 +OpStore %437 %9 +OpStore %438 %9 +OpStore %439 %9 +OpStore %440 %9 +OpStore %441 %9 +OpStore %442 %9 +OpStore %443 %9 +OpStore %444 %9 +OpStore %445 %9 +OpStore %446 %9 +OpStore %447 %9 +OpStore %448 %9 +OpStore %449 %9 +OpStore %450 %9 +OpStore %451 %9 +OpStore %452 %9 +OpStore %453 %9 +OpStore %454 %9 +OpStore %455 %9 +OpStore %456 %9 +OpStore %457 %9 +OpStore %458 %9 +OpStore %459 %9 +OpStore %460 %9 +OpStore %461 %9 +OpStore %462 %9 +OpStore %463 %9 +OpStore %464 %9 +OpStore %465 %9 +OpStore %466 %9 +OpStore %467 %9 +OpStore %468 %9 +OpStore %469 %9 +OpStore %470 %9 +OpStore %471 %9 +OpStore %472 %9 +OpStore %473 %9 +OpStore %474 %9 +OpStore %475 %9 +OpStore %476 %9 +OpStore %477 %9 +OpStore %478 %9 +OpStore %479 %9 +OpStore %480 %9 +OpStore %481 %9 +OpStore %482 %9 +OpStore %483 %9 +OpStore %484 %9 +OpStore %485 %9 +OpStore %486 %9 +OpStore %487 %9 +OpStore %488 %9 +OpStore %489 %9 +OpStore %490 %9 +OpStore %491 %9 +OpStore %492 %9 +OpStore %493 %9 +OpStore %494 %9 +OpStore %495 %9 +OpStore %496 %9 +OpStore %497 %9 +OpStore %498 %9 +OpStore %499 %9 +OpStore %500 %9 +OpStore %501 %9 +OpStore %502 %9 +OpStore %503 %9 +OpStore %504 %9 +OpStore %505 %9 +OpStore %506 %9 +OpStore %507 %9 +OpStore %508 %9 +OpStore %509 %9 +OpStore %510 %9 +OpStore %511 %9 +OpStore %512 %9 +OpStore %513 %9 +OpStore %514 %9 +OpStore %515 %9 +OpStore %516 %9 +OpStore %517 %9 +OpStore %518 %9 +OpStore %519 %9 +OpStore %520 %9 +OpStore %521 %9 +OpStore %522 %9 +OpStore %523 %9 +OpStore %524 %9 +OpStore %525 %9 +OpStore %526 %9 +OpStore %527 %9 +OpStore %528 %9 +OpStore %529 %9 +OpStore %530 %9 +OpStore %531 %9 +OpStore %532 %9 +OpStore %533 %9 +OpStore %534 %9 +OpStore %535 %9 +OpStore %536 %9 +OpStore %537 %9 +OpStore %538 %9 +OpStore %539 %9 +OpStore %540 %9 +OpStore %541 %9 +OpStore %542 %9 +OpStore %543 %9 +OpStore %544 %9 +OpStore %545 %9 +OpStore %546 %9 +OpStore %547 %9 +OpStore %548 %9 +OpStore %549 %9 +OpStore %550 %9 +OpStore %551 %9 +OpStore %552 %9 +OpStore %553 %9 +OpStore %554 %9 +OpStore %555 %9 +OpStore %556 %9 +OpStore %557 %9 +OpStore %558 %9 +OpStore %559 %9 +OpStore %560 %9 +OpStore %561 %9 +OpStore %562 %9 +OpStore %563 %9 +OpStore %564 %9 +OpStore %565 %9 +OpStore %566 %9 +OpStore %567 %9 +OpStore %568 %9 +OpStore %569 %9 +OpStore %570 %9 +OpStore %571 %9 +OpStore %572 %9 +OpStore %573 %9 +OpStore %574 %9 +OpStore %575 %9 +OpStore %576 %9 +OpStore %577 %9 +OpStore %578 %9 +OpStore %579 %9 +OpStore %580 %9 +OpStore %581 %9 +OpStore %582 %9 +OpStore %583 %9 +OpStore %584 %9 +OpStore %585 %9 +OpStore %586 %9 +OpStore %587 %9 +OpStore %588 %9 +OpStore %589 %9 +OpStore %590 %9 +OpStore %591 %9 +OpStore %592 %9 +OpStore %593 %9 +OpStore %594 %9 +OpStore %595 %9 +OpStore %596 %9 +OpStore %597 %9 +OpStore %598 %9 +OpStore %599 %9 +OpStore %600 %9 +OpStore %601 %9 +OpStore %602 %9 +OpStore %603 %9 +OpStore %604 %9 +OpStore %605 %9 +OpStore %606 %9 +OpStore %607 %9 +OpStore %608 %9 +OpStore %609 %9 +OpStore %610 %9 +OpStore %611 %9 +OpStore %612 %9 +OpStore %613 %9 +OpStore %614 %9 +OpStore %615 %9 +OpStore %616 %9 +OpStore %617 %9 +OpStore %618 %9 +OpStore %619 %9 +OpStore %620 %9 +OpStore %621 %9 +OpStore %622 %9 +OpStore %623 %9 +OpStore %624 %9 +OpStore %625 %9 +OpStore %626 %9 +OpStore %627 %9 +OpStore %628 %9 +OpStore %629 %9 +OpStore %630 %9 +OpStore %631 %9 +OpStore %632 %9 +OpStore %633 %9 +OpStore %634 %9 +OpStore %635 %9 +OpStore %636 %9 +OpStore %637 %9 +OpStore %638 %9 +OpStore %639 %9 +OpStore %640 %9 +OpStore %641 %9 +OpStore %642 %9 +OpStore %643 %9 +OpStore %644 %9 +OpStore %645 %9 +OpStore %646 %9 +OpStore %647 %9 +OpStore %648 %9 +OpStore %649 %9 +OpStore %650 %9 +OpStore %651 %9 +OpStore %652 %9 +OpStore %653 %9 +OpStore %654 %9 +OpStore %655 %9 +OpStore %656 %9 +OpStore %657 %9 +OpStore %658 %9 +OpStore %659 %9 +OpStore %660 %9 +OpStore %661 %9 +OpStore %662 %9 +OpStore %663 %9 +OpStore %664 %9 +OpStore %665 %9 +OpStore %666 %9 +OpStore %667 %9 +OpStore %668 %9 +OpStore %669 %9 +OpStore %670 %9 +OpStore %671 %9 +OpStore %672 %9 +OpStore %673 %9 +OpStore %674 %9 +OpStore %675 %9 +OpStore %676 %9 +OpStore %677 %9 +OpStore %678 %9 +OpStore %679 %9 +OpStore %680 %9 +OpStore %681 %9 +OpStore %682 %9 +OpStore %683 %9 +OpStore %684 %9 +OpStore %685 %9 +OpStore %686 %9 +OpStore %687 %9 +OpStore %688 %9 +OpStore %689 %9 +OpStore %690 %9 +OpStore %691 %9 +OpStore %692 %9 +OpStore %693 %9 +OpStore %694 %9 +OpStore %695 %9 +OpStore %696 %9 +OpStore %697 %9 +OpStore %698 %9 +OpStore %699 %9 +OpStore %700 %9 +OpStore %701 %9 +OpStore %702 %9 +OpStore %703 %9 +OpStore %704 %9 +OpStore %705 %9 +OpStore %706 %9 +OpStore %707 %9 +OpStore %708 %9 +OpStore %709 %9 +OpStore %710 %9 +OpStore %711 %9 +OpStore %712 %9 +OpStore %713 %9 +OpStore %714 %9 +OpStore %715 %9 +OpStore %716 %9 +OpStore %717 %9 +OpStore %718 %9 +OpStore %719 %9 +OpStore %720 %9 +OpStore %721 %9 +OpStore %722 %9 +OpStore %723 %9 +OpStore %724 %9 +OpStore %725 %9 +OpStore %726 %9 +OpStore %727 %9 +OpStore %728 %9 +OpStore %729 %9 +OpStore %730 %9 +OpStore %731 %9 +OpStore %732 %9 +OpStore %733 %9 +OpStore %734 %9 +OpStore %735 %9 +OpStore %736 %9 +OpStore %737 %9 +OpStore %738 %9 +OpStore %739 %9 +OpStore %740 %9 +OpStore %741 %9 +OpStore %742 %9 +OpStore %743 %9 +OpStore %744 %9 +OpStore %745 %9 +OpStore %746 %9 +OpStore %747 %9 +OpStore %748 %9 +OpStore %749 %9 +OpStore %750 %9 +OpStore %751 %9 +OpStore %752 %9 +OpStore %753 %9 +OpStore %754 %9 +OpStore %755 %9 +OpStore %756 %9 +OpStore %757 %9 +OpStore %758 %9 +OpStore %759 %9 +OpStore %760 %9 +OpStore %761 %9 +OpStore %762 %9 +OpStore %763 %9 +OpStore %764 %9 +OpStore %765 %9 +OpStore %766 %9 +OpStore %767 %9 +OpStore %768 %9 +OpStore %769 %9 +OpStore %770 %9 +OpStore %771 %9 +OpStore %772 %9 +OpStore %773 %9 +OpStore %774 %9 +OpStore %775 %9 +OpStore %776 %9 +OpStore %777 %9 +OpStore %778 %9 +OpStore %779 %9 +OpStore %780 %9 +OpStore %781 %9 +OpStore %782 %9 +OpStore %783 %9 +OpStore %784 %9 +OpStore %785 %9 +OpStore %786 %9 +OpStore %787 %9 +OpStore %788 %9 +OpStore %789 %9 +OpStore %790 %9 +OpStore %791 %9 +OpStore %792 %9 +OpStore %793 %9 +OpStore %794 %9 +OpStore %795 %9 +OpStore %796 %9 +OpStore %797 %9 +OpStore %798 %9 +OpStore %799 %9 +OpStore %800 %9 +OpStore %801 %9 +OpStore %802 %9 +OpStore %803 %9 +OpStore %804 %9 +OpStore %805 %9 +OpStore %806 %9 +OpStore %807 %9 +OpStore %808 %9 +OpStore %809 %9 +OpStore %810 %9 +OpStore %811 %9 +OpStore %812 %9 +OpStore %813 %9 +OpStore %814 %9 +OpStore %815 %9 +OpStore %816 %9 +OpStore %817 %9 +OpStore %818 %9 +OpStore %819 %9 +OpStore %820 %9 +OpStore %821 %9 +OpStore %822 %9 +OpStore %823 %9 +OpStore %824 %9 +OpStore %825 %9 +OpStore %826 %9 +OpStore %827 %9 +OpStore %828 %9 +OpStore %829 %9 +OpStore %830 %9 +OpStore %831 %9 +OpStore %832 %9 +OpStore %833 %9 +OpStore %834 %9 +OpStore %835 %9 +OpStore %836 %9 +OpStore %837 %9 +OpStore %838 %9 +OpStore %839 %9 +OpStore %840 %9 +OpStore %841 %9 +OpStore %842 %9 +OpStore %843 %9 +OpStore %844 %9 +OpStore %845 %9 +OpStore %846 %9 +OpStore %847 %9 +OpStore %848 %9 +OpStore %849 %9 +OpStore %850 %9 +OpStore %851 %9 +OpStore %852 %9 +OpStore %853 %9 +OpStore %854 %9 +OpStore %855 %9 +OpStore %856 %9 +OpStore %857 %9 +OpStore %858 %9 +OpStore %859 %9 +OpStore %860 %9 +OpStore %861 %9 +OpStore %862 %9 +OpStore %863 %9 +OpStore %864 %9 +OpStore %865 %9 +OpStore %866 %9 +OpStore %867 %9 +OpStore %868 %9 +OpStore %869 %9 +OpStore %870 %9 +OpStore %871 %9 +OpStore %872 %9 +OpStore %873 %9 +OpStore %874 %9 +OpStore %875 %9 +OpStore %876 %9 +OpStore %877 %9 +OpStore %878 %9 +OpStore %879 %9 +OpStore %880 %9 +OpStore %881 %9 +OpStore %882 %9 +OpStore %883 %9 +OpStore %884 %9 +OpStore %885 %9 +OpStore %886 %9 +OpStore %887 %9 +OpStore %888 %9 +OpStore %889 %9 +OpStore %890 %9 +OpStore %891 %9 +OpStore %892 %9 +OpStore %893 %9 +OpStore %894 %9 +OpStore %895 %9 +OpStore %896 %9 +OpStore %897 %9 +OpStore %898 %9 +OpStore %899 %9 +OpStore %900 %9 +OpStore %901 %9 +OpStore %902 %9 +OpStore %903 %9 +OpStore %904 %9 +OpStore %905 %9 +OpStore %906 %9 +OpStore %907 %9 +OpStore %908 %9 +OpStore %909 %9 +OpStore %910 %9 +OpStore %911 %9 +OpStore %912 %9 +OpStore %913 %9 +OpStore %914 %9 +OpStore %915 %9 +OpStore %916 %9 +OpStore %917 %9 +OpStore %918 %9 +OpStore %919 %9 +OpStore %920 %9 +OpStore %921 %9 +OpStore %922 %9 +OpStore %923 %9 +OpStore %924 %9 +OpStore %925 %9 +OpStore %926 %9 +OpStore %927 %9 +OpStore %928 %9 +OpStore %929 %9 +OpStore %930 %9 +OpStore %931 %9 +OpStore %932 %9 +OpStore %933 %9 +OpStore %934 %9 +OpStore %935 %9 +OpStore %936 %9 +OpStore %937 %9 +OpStore %938 %9 +OpStore %939 %9 +OpStore %940 %9 +OpStore %941 %9 +OpStore %942 %9 +OpStore %943 %9 +OpStore %944 %9 +OpStore %945 %9 +OpStore %946 %9 +OpStore %947 %9 +OpStore %948 %9 +OpStore %949 %9 +OpStore %950 %9 +OpStore %951 %9 +OpStore %952 %9 +OpStore %953 %9 +OpStore %954 %9 +OpStore %955 %9 +OpStore %956 %9 +OpStore %957 %9 +OpStore %958 %9 +OpStore %959 %9 +OpStore %960 %9 +OpStore %961 %9 +OpStore %962 %9 +OpStore %963 %9 +OpStore %964 %9 +OpStore %965 %9 +OpStore %966 %9 +OpStore %967 %9 +OpStore %968 %9 +OpStore %969 %9 +OpStore %970 %9 +OpStore %971 %9 +OpStore %972 %9 +OpStore %973 %9 +OpStore %974 %9 +OpStore %975 %9 +OpStore %976 %9 +OpStore %977 %9 +OpStore %978 %9 +OpStore %979 %9 +OpStore %980 %9 +OpStore %981 %9 +OpStore %982 %9 +OpStore %983 %9 +OpStore %984 %9 +OpStore %985 %9 +OpStore %986 %9 +OpStore %987 %9 +OpStore %988 %9 +OpStore %989 %9 +OpStore %990 %9 +OpStore %991 %9 +OpStore %992 %9 +OpStore %993 %9 +OpStore %994 %9 +OpStore %995 %9 +OpStore %996 %9 +OpStore %997 %9 +OpStore %998 %9 +OpStore %999 %9 +OpStore %1000 %9 +OpStore %1001 %9 +OpStore %1002 %9 +OpStore %1003 %9 +OpStore %1004 %9 +OpStore %1005 %9 +OpStore %1006 %9 +OpStore %1007 %9 +OpStore %1008 %9 +OpStore %1009 %9 +OpStore %1010 %9 +OpStore %1011 %9 +OpStore %1012 %9 +OpStore %1013 %9 +OpStore %1014 %9 +OpStore %1015 %9 +OpStore %1016 %9 +OpStore %1017 %9 +OpStore %1018 %9 +OpStore %1019 %9 +OpStore %1020 %9 +OpStore %1021 %9 +OpStore %1022 %9 +OpStore %1023 %9 +OpStore %1024 %9 +OpStore %1025 %9 +OpStore %1026 %9 +OpStore %1027 %9 +OpStore %1028 %9 +OpStore %1029 %9 +OpStore %1030 %9 +OpStore %1031 %9 +OpStore %1032 %9 +OpStore %1033 %9 +OpStore %1034 %9 +%1042 = OpAccessChain %1041 %1040 %9 %9 +%1043 = OpLoad %6 %1042 +OpStore %8 %1043 +%1045 = OpAccessChain %1041 %1040 %9 %1044 +%1046 = OpLoad %6 %1045 +OpStore %10 %1046 +%1048 = OpAccessChain %1041 %1040 %9 %1047 +%1049 = OpLoad %6 %1048 +OpStore %11 %1049 +%1051 = OpAccessChain %1041 %1040 %9 %1050 +%1052 = OpLoad %6 %1051 +OpStore %12 %1052 +%1055 = OpLoad %1035 %1054 +%1058 = OpIEqual %1057 %1055 %1056 +OpSelectionMerge %1060 None +OpBranchConditional %1058 %1059 %1060 +%1059 = OpLabel +%1061 = OpLoad %6 %8 +%1062 = OpLoad %6 %10 +%1063 = OpISub %6 %1061 %1062 +OpStore %13 %1063 +OpBranch %1060 +%1060 = OpLabel +%1064 = OpLoad %1035 %1054 +%1065 = OpIEqual %1057 %1064 %1056 +OpSelectionMerge %1067 None +OpBranchConditional %1065 %1066 %1067 +%1066 = OpLabel +%1068 = OpLoad %6 %8 +%1069 = OpLoad %6 %11 +%1070 = OpISub %6 %1068 %1069 +OpStore %14 %1070 +OpBranch %1067 +%1067 = OpLabel +%1071 = OpLoad %1035 %1054 +%1073 = OpINotEqual %1057 %1071 %1072 +OpSelectionMerge %1075 None +OpBranchConditional %1073 %1074 %1075 +%1074 = OpLabel +%1076 = OpLoad %6 %8 +%1077 = OpLoad %6 %12 +%1078 = OpISub %6 %1076 %1077 +OpStore %15 %1078 +OpBranch %1075 +%1075 = OpLabel +%1079 = OpLoad %1035 %1054 +%1080 = OpULessThan %1057 %1079 %1056 +OpSelectionMerge %1082 None +OpBranchConditional %1080 %1081 %1082 +%1081 = OpLabel +%1083 = OpLoad %6 %10 +%1084 = OpLoad %6 %11 +%1085 = OpISub %6 %1083 %1084 +OpStore %16 %1085 +OpBranch %1082 +%1082 = OpLabel +%1086 = OpLoad %1035 %1054 +%1087 = OpUGreaterThan %1057 %1086 %1056 +OpSelectionMerge %1089 None +OpBranchConditional %1087 %1088 %1089 +%1088 = OpLabel +%1090 = OpLoad %6 %10 +%1091 = OpLoad %6 %12 +%1092 = OpIAdd %6 %1090 %1091 +OpStore %17 %1092 +OpBranch %1089 +%1089 = OpLabel +%1093 = OpLoad %1035 %1054 +%1095 = OpUGreaterThanEqual %1057 %1093 %1094 +OpSelectionMerge %1097 None +OpBranchConditional %1095 %1096 %1097 +%1096 = OpLabel +%1098 = OpLoad %6 %11 +%1099 = OpLoad %6 %12 +%1100 = OpIAdd %6 %1098 %1099 +OpStore %18 %1100 +OpBranch %1097 +%1097 = OpLabel +%1101 = OpLoad %1035 %1054 +%1102 = OpUGreaterThanEqual %1057 %1101 %1056 +OpSelectionMerge %1104 None +OpBranchConditional %1102 %1103 %1104 +%1103 = OpLabel +%1105 = OpLoad %6 %8 +%1106 = OpLoad %6 %10 +%1107 = OpISub %6 %1105 %1106 +%1108 = OpLoad %6 %11 +%1109 = OpISub %6 %1107 %1108 +OpStore %19 %1109 +OpBranch %1104 +%1104 = OpLabel +%1110 = OpLoad %1035 %1054 +%1111 = OpINotEqual %1057 %1110 %1094 +OpSelectionMerge %1113 None +OpBranchConditional %1111 %1112 %1113 +%1112 = OpLabel +%1114 = OpLoad %6 %8 +%1115 = OpLoad %6 %10 +%1116 = OpISub %6 %1114 %1115 +%1117 = OpLoad %6 %12 +%1118 = OpIAdd %6 %1116 %1117 +OpStore %20 %1118 +OpBranch %1113 +%1113 = OpLabel +%1119 = OpLoad %1035 %1054 +%1120 = OpUGreaterThan %1057 %1119 %1072 +OpSelectionMerge %1122 None +OpBranchConditional %1120 %1121 %1122 +%1121 = OpLabel +%1123 = OpLoad %6 %8 +%1124 = OpLoad %6 %11 +%1125 = OpIAdd %6 %1123 %1124 +%1126 = OpLoad %6 %12 +%1127 = OpISub %6 %1125 %1126 +OpStore %21 %1127 +OpBranch %1122 +%1122 = OpLabel +%1128 = OpLoad %1035 %1054 +%1129 = OpULessThanEqual %1057 %1128 %1072 +OpSelectionMerge %1131 None +OpBranchConditional %1129 %1130 %1131 +%1130 = OpLabel +%1132 = OpLoad %6 %10 +%1133 = OpLoad %6 %11 +%1134 = OpIAdd %6 %1132 %1133 +%1135 = OpLoad %6 %12 +%1136 = OpISub %6 %1134 %1135 +OpStore %22 %1136 +OpBranch %1131 +%1131 = OpLabel +%1137 = OpLoad %1035 %1054 +%1139 = OpULessThanEqual %1057 %1137 %1138 +OpSelectionMerge %1141 None +OpBranchConditional %1139 %1140 %1141 +%1140 = OpLabel +%1142 = OpLoad %6 %13 +%1143 = OpLoad %6 %14 +%1144 = OpISub %6 %1142 %1143 +OpStore %23 %1144 +OpBranch %1141 +%1141 = OpLabel +%1145 = OpLoad %1035 %1054 +%1146 = OpULessThanEqual %1057 %1145 %1138 +OpSelectionMerge %1148 None +OpBranchConditional %1146 %1147 %1148 +%1147 = OpLabel +%1149 = OpLoad %6 %13 +%1150 = OpLoad %6 %15 +%1151 = OpIAdd %6 %1149 %1150 +OpStore %24 %1151 +OpBranch %1148 +%1148 = OpLabel +%1152 = OpLoad %1035 %1054 +%1153 = OpINotEqual %1057 %1152 %1072 +OpSelectionMerge %1155 None +OpBranchConditional %1153 %1154 %1155 +%1154 = OpLabel +%1156 = OpLoad %6 %14 +%1157 = OpLoad %6 %16 +%1158 = OpISub %6 %1156 %1157 +OpStore %25 %1158 +OpBranch %1155 +%1155 = OpLabel +%1159 = OpLoad %1035 %1054 +%1160 = OpUGreaterThanEqual %1057 %1159 %1072 +OpSelectionMerge %1162 None +OpBranchConditional %1160 %1161 %1162 +%1161 = OpLabel +%1163 = OpLoad %6 %14 +%1164 = OpLoad %6 %18 +%1165 = OpISub %6 %1163 %1164 +%1166 = OpLoad %6 %20 +%1167 = OpIAdd %6 %1165 %1166 +OpStore %26 %1167 +OpBranch %1162 +%1162 = OpLabel +%1168 = OpLoad %1035 %1054 +%1169 = OpULessThanEqual %1057 %1168 %1138 +OpSelectionMerge %1171 None +OpBranchConditional %1169 %1170 %1171 +%1170 = OpLabel +%1172 = OpLoad %6 %14 +%1173 = OpLoad %6 %16 +%1174 = OpIAdd %6 %1172 %1173 +%1175 = OpLoad %6 %17 +%1176 = OpISub %6 %1174 %1175 +%1177 = OpLoad %6 %18 +%1178 = OpISub %6 %1176 %1177 +%1179 = OpLoad %6 %19 +%1180 = OpISub %6 %1178 %1179 +%1181 = OpLoad %6 %20 +%1182 = OpIAdd %6 %1180 %1181 +%1183 = OpLoad %6 %21 +%1184 = OpISub %6 %1182 %1183 +%1185 = OpLoad %6 %22 +%1186 = OpIAdd %6 %1184 %1185 +OpStore %27 %1186 +OpBranch %1171 +%1171 = OpLabel +%1187 = OpLoad %1035 %1054 +%1188 = OpULessThan %1057 %1187 %1138 +OpSelectionMerge %1190 None +OpBranchConditional %1188 %1189 %1190 +%1189 = OpLabel +%1191 = OpLoad %6 %15 +%1192 = OpLoad %6 %16 +%1193 = OpISub %6 %1191 %1192 +%1194 = OpLoad %6 %17 +%1195 = OpISub %6 %1193 %1194 +%1196 = OpLoad %6 %18 +%1197 = OpIAdd %6 %1195 %1196 +%1198 = OpLoad %6 %19 +%1199 = OpIAdd %6 %1197 %1198 +%1200 = OpLoad %6 %20 +%1201 = OpISub %6 %1199 %1200 +%1202 = OpLoad %6 %21 +%1203 = OpIAdd %6 %1201 %1202 +%1204 = OpLoad %6 %22 +%1205 = OpISub %6 %1203 %1204 +OpStore %28 %1205 +OpBranch %1190 +%1190 = OpLabel +%1206 = OpLoad %1035 %1054 +%1207 = OpUGreaterThan %1057 %1206 %1072 +OpSelectionMerge %1209 None +OpBranchConditional %1207 %1208 %1209 +%1208 = OpLabel +%1210 = OpLoad %6 %13 +%1211 = OpLoad %6 %14 +%1212 = OpIAdd %6 %1210 %1211 +%1213 = OpLoad %6 %15 +%1214 = OpISub %6 %1212 %1213 +%1215 = OpLoad %6 %16 +%1216 = OpIAdd %6 %1214 %1215 +%1217 = OpLoad %6 %17 +%1218 = OpIAdd %6 %1216 %1217 +%1219 = OpLoad %6 %18 +%1220 = OpISub %6 %1218 %1219 +%1221 = OpLoad %6 %19 +%1222 = OpISub %6 %1220 %1221 +%1223 = OpLoad %6 %20 +%1224 = OpISub %6 %1222 %1223 +%1225 = OpLoad %6 %21 +%1226 = OpISub %6 %1224 %1225 +OpStore %29 %1226 +OpBranch %1209 +%1209 = OpLabel +%1227 = OpLoad %1035 %1054 +%1228 = OpUGreaterThanEqual %1057 %1227 %1138 +OpSelectionMerge %1230 None +OpBranchConditional %1228 %1229 %1230 +%1229 = OpLabel +%1231 = OpLoad %6 %13 +%1232 = OpLoad %6 %14 +%1233 = OpISub %6 %1231 %1232 +%1234 = OpLoad %6 %15 +%1235 = OpISub %6 %1233 %1234 +%1236 = OpLoad %6 %16 +%1237 = OpIAdd %6 %1235 %1236 +%1238 = OpLoad %6 %17 +%1239 = OpIAdd %6 %1237 %1238 +%1240 = OpLoad %6 %18 +%1241 = OpIAdd %6 %1239 %1240 +%1242 = OpLoad %6 %19 +%1243 = OpIAdd %6 %1241 %1242 +%1244 = OpLoad %6 %20 +%1245 = OpISub %6 %1243 %1244 +%1246 = OpLoad %6 %22 +%1247 = OpISub %6 %1245 %1246 +OpStore %30 %1247 +OpBranch %1230 +%1230 = OpLabel +%1248 = OpLoad %1035 %1054 +%1249 = OpULessThan %1057 %1248 %1072 +OpSelectionMerge %1251 None +OpBranchConditional %1249 %1250 %1251 +%1250 = OpLabel +%1252 = OpLoad %6 %13 +%1253 = OpLoad %6 %14 +%1254 = OpISub %6 %1252 %1253 +%1255 = OpLoad %6 %15 +%1256 = OpISub %6 %1254 %1255 +%1257 = OpLoad %6 %16 +%1258 = OpIAdd %6 %1256 %1257 +%1259 = OpLoad %6 %17 +%1260 = OpIAdd %6 %1258 %1259 +%1261 = OpLoad %6 %18 +%1262 = OpIAdd %6 %1260 %1261 +%1263 = OpLoad %6 %19 +%1264 = OpIAdd %6 %1262 %1263 +%1265 = OpLoad %6 %21 +%1266 = OpIAdd %6 %1264 %1265 +%1267 = OpLoad %6 %22 +%1268 = OpIAdd %6 %1266 %1267 +OpStore %31 %1268 +OpBranch %1251 +%1251 = OpLabel +%1269 = OpLoad %1035 %1054 +%1270 = OpUGreaterThan %1057 %1269 %1094 +OpSelectionMerge %1272 None +OpBranchConditional %1270 %1271 %1272 +%1271 = OpLabel +%1273 = OpLoad %6 %13 +%1274 = OpLoad %6 %14 +%1275 = OpIAdd %6 %1273 %1274 +%1276 = OpLoad %6 %15 +%1277 = OpISub %6 %1275 %1276 +%1278 = OpLoad %6 %16 +%1279 = OpIAdd %6 %1277 %1278 +%1280 = OpLoad %6 %17 +%1281 = OpIAdd %6 %1279 %1280 +%1282 = OpLoad %6 %18 +%1283 = OpISub %6 %1281 %1282 +%1284 = OpLoad %6 %20 +%1285 = OpIAdd %6 %1283 %1284 +%1286 = OpLoad %6 %21 +%1287 = OpIAdd %6 %1285 %1286 +%1288 = OpLoad %6 %22 +%1289 = OpIAdd %6 %1287 %1288 +OpStore %32 %1289 +OpBranch %1272 +%1272 = OpLabel +%1290 = OpLoad %1035 %1054 +%1291 = OpIEqual %1057 %1290 %1138 +OpSelectionMerge %1293 None +OpBranchConditional %1291 %1292 %1293 +%1292 = OpLabel +%1294 = OpLoad %6 %13 +%1295 = OpLoad %6 %14 +%1296 = OpIAdd %6 %1294 %1295 +%1297 = OpLoad %6 %15 +%1298 = OpIAdd %6 %1296 %1297 +%1299 = OpLoad %6 %16 +%1300 = OpIAdd %6 %1298 %1299 +%1301 = OpLoad %6 %17 +%1302 = OpISub %6 %1300 %1301 +%1303 = OpLoad %6 %19 +%1304 = OpISub %6 %1302 %1303 +%1305 = OpLoad %6 %20 +%1306 = OpISub %6 %1304 %1305 +%1307 = OpLoad %6 %21 +%1308 = OpISub %6 %1306 %1307 +%1309 = OpLoad %6 %22 +%1310 = OpISub %6 %1308 %1309 +OpStore %33 %1310 +OpBranch %1293 +%1293 = OpLabel +%1311 = OpLoad %1035 %1054 +%1312 = OpULessThan %1057 %1311 %1138 +OpSelectionMerge %1314 None +OpBranchConditional %1312 %1313 %1314 +%1313 = OpLabel +%1315 = OpLoad %6 %13 +%1316 = OpLoad %6 %14 +%1317 = OpISub %6 %1315 %1316 +%1318 = OpLoad %6 %15 +%1319 = OpIAdd %6 %1317 %1318 +%1320 = OpLoad %6 %16 +%1321 = OpISub %6 %1319 %1320 +%1322 = OpLoad %6 %18 +%1323 = OpISub %6 %1321 %1322 +%1324 = OpLoad %6 %19 +%1325 = OpISub %6 %1323 %1324 +%1326 = OpLoad %6 %20 +%1327 = OpISub %6 %1325 %1326 +%1328 = OpLoad %6 %21 +%1329 = OpIAdd %6 %1327 %1328 +%1330 = OpLoad %6 %22 +%1331 = OpIAdd %6 %1329 %1330 +OpStore %34 %1331 +OpBranch %1314 +%1314 = OpLabel +%1332 = OpLoad %1035 %1054 +%1333 = OpULessThan %1057 %1332 %1138 +OpSelectionMerge %1335 None +OpBranchConditional %1333 %1334 %1335 +%1334 = OpLabel +%1336 = OpLoad %6 %13 +%1337 = OpLoad %6 %14 +%1338 = OpIAdd %6 %1336 %1337 +%1339 = OpLoad %6 %15 +%1340 = OpIAdd %6 %1338 %1339 +%1341 = OpLoad %6 %17 +%1342 = OpISub %6 %1340 %1341 +%1343 = OpLoad %6 %18 +%1344 = OpIAdd %6 %1342 %1343 +%1345 = OpLoad %6 %19 +%1346 = OpIAdd %6 %1344 %1345 +%1347 = OpLoad %6 %20 +%1348 = OpIAdd %6 %1346 %1347 +%1349 = OpLoad %6 %21 +%1350 = OpISub %6 %1348 %1349 +%1351 = OpLoad %6 %22 +%1352 = OpISub %6 %1350 %1351 +OpStore %35 %1352 +OpBranch %1335 +%1335 = OpLabel +%1353 = OpLoad %1035 %1054 +%1354 = OpUGreaterThan %1057 %1353 %1094 +OpSelectionMerge %1356 None +OpBranchConditional %1354 %1355 %1356 +%1355 = OpLabel +%1357 = OpLoad %6 %13 +%1358 = OpLoad %6 %14 +%1359 = OpISub %6 %1357 %1358 +%1360 = OpLoad %6 %16 +%1361 = OpISub %6 %1359 %1360 +%1362 = OpLoad %6 %17 +%1363 = OpISub %6 %1361 %1362 +%1364 = OpLoad %6 %18 +%1365 = OpIAdd %6 %1363 %1364 +%1366 = OpLoad %6 %19 +%1367 = OpISub %6 %1365 %1366 +%1368 = OpLoad %6 %20 +%1369 = OpISub %6 %1367 %1368 +%1370 = OpLoad %6 %21 +%1371 = OpISub %6 %1369 %1370 +%1372 = OpLoad %6 %22 +%1373 = OpISub %6 %1371 %1372 +OpStore %36 %1373 +OpBranch %1356 +%1356 = OpLabel +%1374 = OpLoad %1035 %1054 +%1375 = OpIEqual %1057 %1374 %1072 +OpSelectionMerge %1377 None +OpBranchConditional %1375 %1376 %1377 +%1376 = OpLabel +%1378 = OpLoad %6 %14 +%1379 = OpLoad %6 %18 +%1380 = OpISub %6 %1378 %1379 +%1381 = OpLoad %6 %21 +%1382 = OpISub %6 %1380 %1381 +OpStore %37 %1382 +OpBranch %1377 +%1377 = OpLabel +%1383 = OpLoad %1035 %1054 +%1384 = OpUGreaterThanEqual %1057 %1383 %1094 +OpSelectionMerge %1386 None +OpBranchConditional %1384 %1385 %1386 +%1385 = OpLabel +%1387 = OpLoad %6 %13 +%1388 = OpLoad %6 %15 +%1389 = OpISub %6 %1387 %1388 +%1390 = OpLoad %6 %16 +%1391 = OpIAdd %6 %1389 %1390 +%1392 = OpLoad %6 %17 +%1393 = OpIAdd %6 %1391 %1392 +%1394 = OpLoad %6 %18 +%1395 = OpIAdd %6 %1393 %1394 +%1396 = OpLoad %6 %19 +%1397 = OpIAdd %6 %1395 %1396 +%1398 = OpLoad %6 %20 +%1399 = OpIAdd %6 %1397 %1398 +%1400 = OpLoad %6 %21 +%1401 = OpISub %6 %1399 %1400 +%1402 = OpLoad %6 %22 +%1403 = OpIAdd %6 %1401 %1402 +OpStore %38 %1403 +OpBranch %1386 +%1386 = OpLabel +%1404 = OpLoad %1035 %1054 +%1405 = OpINotEqual %1057 %1404 %1072 +OpSelectionMerge %1407 None +OpBranchConditional %1405 %1406 %1407 +%1406 = OpLabel +%1408 = OpLoad %6 %14 +%1409 = OpLoad %6 %15 +%1410 = OpIAdd %6 %1408 %1409 +%1411 = OpLoad %6 %16 +%1412 = OpIAdd %6 %1410 %1411 +%1413 = OpLoad %6 %17 +%1414 = OpISub %6 %1412 %1413 +%1415 = OpLoad %6 %18 +%1416 = OpISub %6 %1414 %1415 +%1417 = OpLoad %6 %19 +%1418 = OpISub %6 %1416 %1417 +%1419 = OpLoad %6 %20 +%1420 = OpIAdd %6 %1418 %1419 +%1421 = OpLoad %6 %21 +%1422 = OpISub %6 %1420 %1421 +%1423 = OpLoad %6 %22 +%1424 = OpISub %6 %1422 %1423 +OpStore %39 %1424 +OpBranch %1407 +%1407 = OpLabel +%1425 = OpLoad %1035 %1054 +%1426 = OpUGreaterThan %1057 %1425 %1072 +OpSelectionMerge %1428 None +OpBranchConditional %1426 %1427 %1428 +%1427 = OpLabel +%1429 = OpLoad %6 %14 +%1430 = OpLoad %6 %18 +%1431 = OpIAdd %6 %1429 %1430 +%1432 = OpLoad %6 %22 +%1433 = OpISub %6 %1431 %1432 +OpStore %40 %1433 +OpBranch %1428 +%1428 = OpLabel +%1434 = OpLoad %1035 %1054 +%1435 = OpUGreaterThan %1057 %1434 %1056 +OpSelectionMerge %1437 None +OpBranchConditional %1435 %1436 %1437 +%1436 = OpLabel +%1438 = OpLoad %6 %14 +%1439 = OpLoad %6 %19 +%1440 = OpIAdd %6 %1438 %1439 +%1441 = OpLoad %6 %20 +%1442 = OpIAdd %6 %1440 %1441 +OpStore %41 %1442 +OpBranch %1437 +%1437 = OpLabel +%1443 = OpLoad %1035 %1054 +%1444 = OpUGreaterThan %1057 %1443 %1056 +OpSelectionMerge %1446 None +OpBranchConditional %1444 %1445 %1446 +%1445 = OpLabel +%1447 = OpLoad %6 %14 +%1448 = OpLoad %6 %19 +%1449 = OpIAdd %6 %1447 %1448 +%1450 = OpLoad %6 %21 +%1451 = OpISub %6 %1449 %1450 +OpStore %42 %1451 +OpBranch %1446 +%1446 = OpLabel +%1452 = OpLoad %1035 %1054 +%1453 = OpUGreaterThan %1057 %1452 %1094 +OpSelectionMerge %1455 None +OpBranchConditional %1453 %1454 %1455 +%1454 = OpLabel +%1456 = OpLoad %6 %14 +%1457 = OpLoad %6 %19 +%1458 = OpIAdd %6 %1456 %1457 +%1459 = OpLoad %6 %22 +%1460 = OpIAdd %6 %1458 %1459 +OpStore %43 %1460 +OpBranch %1455 +%1455 = OpLabel +%1461 = OpLoad %1035 %1054 +%1462 = OpULessThan %1057 %1461 %1138 +OpSelectionMerge %1464 None +OpBranchConditional %1462 %1463 %1464 +%1463 = OpLabel +%1465 = OpLoad %6 %14 +%1466 = OpLoad %6 %20 +%1467 = OpIAdd %6 %1465 %1466 +%1468 = OpLoad %6 %21 +%1469 = OpISub %6 %1467 %1468 +OpStore %44 %1469 +OpBranch %1464 +%1464 = OpLabel +%1470 = OpLoad %1035 %1054 +%1471 = OpIEqual %1057 %1470 %1056 +OpSelectionMerge %1473 None +OpBranchConditional %1471 %1472 %1473 +%1472 = OpLabel +%1474 = OpLoad %6 %14 +%1475 = OpLoad %6 %20 +%1476 = OpIAdd %6 %1474 %1475 +%1477 = OpLoad %6 %22 +%1478 = OpIAdd %6 %1476 %1477 +OpStore %45 %1478 +OpBranch %1473 +%1473 = OpLabel +%1479 = OpLoad %1035 %1054 +%1480 = OpINotEqual %1057 %1479 %1056 +OpSelectionMerge %1482 None +OpBranchConditional %1480 %1481 %1482 +%1481 = OpLabel +%1483 = OpLoad %6 %14 +%1484 = OpLoad %6 %21 +%1485 = OpISub %6 %1483 %1484 +%1486 = OpLoad %6 %22 +%1487 = OpISub %6 %1485 %1486 +OpStore %46 %1487 +OpBranch %1482 +%1482 = OpLabel +%1488 = OpLoad %1035 %1054 +%1489 = OpIEqual %1057 %1488 %1094 +OpSelectionMerge %1491 None +OpBranchConditional %1489 %1490 %1491 +%1490 = OpLabel +%1492 = OpLoad %6 %15 +%1493 = OpLoad %6 %16 +%1494 = OpIAdd %6 %1492 %1493 +%1495 = OpLoad %6 %17 +%1496 = OpISub %6 %1494 %1495 +OpStore %47 %1496 +OpBranch %1491 +%1491 = OpLabel +%1497 = OpLoad %1035 %1054 +%1498 = OpULessThan %1057 %1497 %1138 +OpSelectionMerge %1500 None +OpBranchConditional %1498 %1499 %1500 +%1499 = OpLabel +%1501 = OpLoad %6 %14 +%1502 = OpLoad %6 %17 +%1503 = OpISub %6 %1501 %1502 +OpStore %48 %1503 +OpBranch %1500 +%1500 = OpLabel +%1504 = OpLoad %1035 %1054 +%1505 = OpUGreaterThan %1057 %1504 %1056 +OpSelectionMerge %1507 None +OpBranchConditional %1505 %1506 %1507 +%1506 = OpLabel +%1508 = OpLoad %6 %15 +%1509 = OpLoad %6 %16 +%1510 = OpISub %6 %1508 %1509 +%1511 = OpLoad %6 %18 +%1512 = OpISub %6 %1510 %1511 +OpStore %49 %1512 +OpBranch %1507 +%1507 = OpLabel +%1513 = OpLoad %1035 %1054 +%1514 = OpUGreaterThan %1057 %1513 %1072 +OpSelectionMerge %1516 None +OpBranchConditional %1514 %1515 %1516 +%1515 = OpLabel +%1517 = OpLoad %6 %15 +%1518 = OpLoad %6 %16 +%1519 = OpISub %6 %1517 %1518 +%1520 = OpLoad %6 %19 +%1521 = OpIAdd %6 %1519 %1520 +OpStore %50 %1521 +OpBranch %1516 +%1516 = OpLabel +%1522 = OpLoad %1035 %1054 +%1523 = OpINotEqual %1057 %1522 %1094 +OpSelectionMerge %1525 None +OpBranchConditional %1523 %1524 %1525 +%1524 = OpLabel +%1526 = OpLoad %6 %15 +%1527 = OpLoad %6 %16 +%1528 = OpIAdd %6 %1526 %1527 +%1529 = OpLoad %6 %20 +%1530 = OpIAdd %6 %1528 %1529 +OpStore %51 %1530 +OpBranch %1525 +%1525 = OpLabel +%1531 = OpLoad %1035 %1054 +%1532 = OpUGreaterThan %1057 %1531 %1056 +OpSelectionMerge %1534 None +OpBranchConditional %1532 %1533 %1534 +%1533 = OpLabel +%1535 = OpLoad %6 %15 +%1536 = OpLoad %6 %16 +%1537 = OpISub %6 %1535 %1536 +%1538 = OpLoad %6 %21 +%1539 = OpIAdd %6 %1537 %1538 +OpStore %52 %1539 +OpBranch %1534 +%1534 = OpLabel +%1540 = OpLoad %1035 %1054 +%1541 = OpULessThan %1057 %1540 %1072 +OpSelectionMerge %1543 None +OpBranchConditional %1541 %1542 %1543 +%1542 = OpLabel +%1544 = OpLoad %6 %15 +%1545 = OpLoad %6 %16 +%1546 = OpIAdd %6 %1544 %1545 +%1547 = OpLoad %6 %22 +%1548 = OpISub %6 %1546 %1547 +OpStore %53 %1548 +OpBranch %1543 +%1543 = OpLabel +%1549 = OpLoad %1035 %1054 +%1550 = OpULessThanEqual %1057 %1549 %1094 +OpSelectionMerge %1552 None +OpBranchConditional %1550 %1551 %1552 +%1551 = OpLabel +%1553 = OpLoad %6 %15 +%1554 = OpLoad %6 %17 +%1555 = OpIAdd %6 %1553 %1554 +%1556 = OpLoad %6 %18 +%1557 = OpIAdd %6 %1555 %1556 +OpStore %54 %1557 +OpBranch %1552 +%1552 = OpLabel +%1558 = OpLoad %1035 %1054 +%1559 = OpIEqual %1057 %1558 %1056 +OpSelectionMerge %1561 None +OpBranchConditional %1559 %1560 %1561 +%1560 = OpLabel +%1562 = OpLoad %6 %15 +%1563 = OpLoad %6 %17 +%1564 = OpIAdd %6 %1562 %1563 +%1565 = OpLoad %6 %19 +%1566 = OpISub %6 %1564 %1565 +OpStore %55 %1566 +OpBranch %1561 +%1561 = OpLabel +%1567 = OpLoad %1035 %1054 +%1568 = OpUGreaterThan %1057 %1567 %1094 +OpSelectionMerge %1570 None +OpBranchConditional %1568 %1569 %1570 +%1569 = OpLabel +%1571 = OpLoad %6 %15 +%1572 = OpLoad %6 %17 +%1573 = OpISub %6 %1571 %1572 +%1574 = OpLoad %6 %20 +%1575 = OpIAdd %6 %1573 %1574 +OpStore %56 %1575 +OpBranch %1570 +%1570 = OpLabel +%1576 = OpLoad %1035 %1054 +%1577 = OpINotEqual %1057 %1576 %1056 +OpSelectionMerge %1579 None +OpBranchConditional %1577 %1578 %1579 +%1578 = OpLabel +%1580 = OpLoad %6 %15 +%1581 = OpLoad %6 %17 +%1582 = OpISub %6 %1580 %1581 +%1583 = OpLoad %6 %21 +%1584 = OpIAdd %6 %1582 %1583 +OpStore %57 %1584 +OpBranch %1579 +%1579 = OpLabel +%1585 = OpLoad %1035 %1054 +%1586 = OpUGreaterThan %1057 %1585 %1094 +OpSelectionMerge %1588 None +OpBranchConditional %1586 %1587 %1588 +%1587 = OpLabel +%1589 = OpLoad %6 %15 +%1590 = OpLoad %6 %17 +%1591 = OpIAdd %6 %1589 %1590 +%1592 = OpLoad %6 %22 +%1593 = OpISub %6 %1591 %1592 +OpStore %58 %1593 +OpBranch %1588 +%1588 = OpLabel +%1594 = OpLoad %1035 %1054 +%1595 = OpULessThanEqual %1057 %1594 %1138 +OpSelectionMerge %1597 None +OpBranchConditional %1595 %1596 %1597 +%1596 = OpLabel +%1598 = OpLoad %6 %14 +%1599 = OpLoad %6 %18 +%1600 = OpISub %6 %1598 %1599 +OpStore %59 %1600 +OpBranch %1597 +%1597 = OpLabel +%1601 = OpLoad %1035 %1054 +%1602 = OpIEqual %1057 %1601 %1094 +OpSelectionMerge %1604 None +OpBranchConditional %1602 %1603 %1604 +%1603 = OpLabel +%1605 = OpLoad %6 %15 +%1606 = OpLoad %6 %18 +%1607 = OpIAdd %6 %1605 %1606 +%1608 = OpLoad %6 %19 +%1609 = OpIAdd %6 %1607 %1608 +OpStore %60 %1609 +OpBranch %1604 +%1604 = OpLabel +%1610 = OpLoad %1035 %1054 +%1611 = OpULessThan %1057 %1610 %1138 +OpSelectionMerge %1613 None +OpBranchConditional %1611 %1612 %1613 +%1612 = OpLabel +%1614 = OpLoad %6 %15 +%1615 = OpLoad %6 %18 +%1616 = OpIAdd %6 %1614 %1615 +%1617 = OpLoad %6 %20 +%1618 = OpISub %6 %1616 %1617 +OpStore %61 %1618 +OpBranch %1613 +%1613 = OpLabel +%1619 = OpLoad %1035 %1054 +%1620 = OpULessThanEqual %1057 %1619 %1138 +OpSelectionMerge %1622 None +OpBranchConditional %1620 %1621 %1622 +%1621 = OpLabel +%1623 = OpLoad %6 %15 +%1624 = OpLoad %6 %18 +%1625 = OpIAdd %6 %1623 %1624 +%1626 = OpLoad %6 %21 +%1627 = OpIAdd %6 %1625 %1626 +OpStore %62 %1627 +OpBranch %1622 +%1622 = OpLabel +%1628 = OpLoad %1035 %1054 +%1629 = OpULessThan %1057 %1628 %1056 +OpSelectionMerge %1631 None +OpBranchConditional %1629 %1630 %1631 +%1630 = OpLabel +%1632 = OpLoad %6 %15 +%1633 = OpLoad %6 %18 +%1634 = OpISub %6 %1632 %1633 +%1635 = OpLoad %6 %22 +%1636 = OpISub %6 %1634 %1635 +OpStore %63 %1636 +OpBranch %1631 +%1631 = OpLabel +%1637 = OpLoad %1035 %1054 +%1638 = OpULessThanEqual %1057 %1637 %1056 +OpSelectionMerge %1640 None +OpBranchConditional %1638 %1639 %1640 +%1639 = OpLabel +%1641 = OpLoad %6 %15 +%1642 = OpLoad %6 %19 +%1643 = OpISub %6 %1641 %1642 +%1644 = OpLoad %6 %20 +%1645 = OpISub %6 %1643 %1644 +OpStore %64 %1645 +OpBranch %1640 +%1640 = OpLabel +%1646 = OpLoad %1035 %1054 +%1647 = OpUGreaterThan %1057 %1646 %1072 +OpSelectionMerge %1649 None +OpBranchConditional %1647 %1648 %1649 +%1648 = OpLabel +%1650 = OpLoad %6 %15 +%1651 = OpLoad %6 %19 +%1652 = OpIAdd %6 %1650 %1651 +%1653 = OpLoad %6 %21 +%1654 = OpIAdd %6 %1652 %1653 +OpStore %65 %1654 +OpBranch %1649 +%1649 = OpLabel +%1655 = OpLoad %1035 %1054 +%1656 = OpUGreaterThan %1057 %1655 %1072 +OpSelectionMerge %1658 None +OpBranchConditional %1656 %1657 %1658 +%1657 = OpLabel +%1659 = OpLoad %6 %15 +%1660 = OpLoad %6 %19 +%1661 = OpISub %6 %1659 %1660 +%1662 = OpLoad %6 %22 +%1663 = OpIAdd %6 %1661 %1662 +OpStore %66 %1663 +OpBranch %1658 +%1658 = OpLabel +%1664 = OpLoad %1035 %1054 +%1665 = OpUGreaterThanEqual %1057 %1664 %1094 +OpSelectionMerge %1667 None +OpBranchConditional %1665 %1666 %1667 +%1666 = OpLabel +%1668 = OpLoad %6 %15 +%1669 = OpLoad %6 %20 +%1670 = OpISub %6 %1668 %1669 +%1671 = OpLoad %6 %21 +%1672 = OpISub %6 %1670 %1671 +OpStore %67 %1672 +OpBranch %1667 +%1667 = OpLabel +%1673 = OpLoad %1035 %1054 +%1674 = OpUGreaterThanEqual %1057 %1673 %1138 +OpSelectionMerge %1676 None +OpBranchConditional %1674 %1675 %1676 +%1675 = OpLabel +%1677 = OpLoad %6 %15 +%1678 = OpLoad %6 %20 +%1679 = OpIAdd %6 %1677 %1678 +%1680 = OpLoad %6 %22 +%1681 = OpISub %6 %1679 %1680 +OpStore %68 %1681 +OpBranch %1676 +%1676 = OpLabel +%1682 = OpLoad %1035 %1054 +%1683 = OpUGreaterThanEqual %1057 %1682 %1072 +OpSelectionMerge %1685 None +OpBranchConditional %1683 %1684 %1685 +%1684 = OpLabel +%1686 = OpLoad %6 %15 +%1687 = OpLoad %6 %21 +%1688 = OpIAdd %6 %1686 %1687 +%1689 = OpLoad %6 %22 +%1690 = OpIAdd %6 %1688 %1689 +OpStore %69 %1690 +OpBranch %1685 +%1685 = OpLabel +%1691 = OpLoad %1035 %1054 +%1692 = OpUGreaterThanEqual %1057 %1691 %1138 +OpSelectionMerge %1694 None +OpBranchConditional %1692 %1693 %1694 +%1693 = OpLabel +%1695 = OpLoad %6 %14 +%1696 = OpLoad %6 %19 +%1697 = OpIAdd %6 %1695 %1696 +OpStore %70 %1697 +OpBranch %1694 +%1694 = OpLabel +%1698 = OpLoad %1035 %1054 +%1699 = OpULessThan %1057 %1698 %1072 +OpSelectionMerge %1701 None +OpBranchConditional %1699 %1700 %1701 +%1700 = OpLabel +%1702 = OpLoad %6 %16 +%1703 = OpLoad %6 %17 +%1704 = OpIAdd %6 %1702 %1703 +%1705 = OpLoad %6 %18 +%1706 = OpISub %6 %1704 %1705 +OpStore %71 %1706 +OpBranch %1701 +%1701 = OpLabel +%1707 = OpLoad %1035 %1054 +%1708 = OpINotEqual %1057 %1707 %1056 +OpSelectionMerge %1710 None +OpBranchConditional %1708 %1709 %1710 +%1709 = OpLabel +%1711 = OpLoad %6 %16 +%1712 = OpLoad %6 %17 +%1713 = OpIAdd %6 %1711 %1712 +%1714 = OpLoad %6 %19 +%1715 = OpISub %6 %1713 %1714 +OpStore %72 %1715 +OpBranch %1710 +%1710 = OpLabel +%1716 = OpLoad %1035 %1054 +%1717 = OpULessThan %1057 %1716 %1072 +OpSelectionMerge %1719 None +OpBranchConditional %1717 %1718 %1719 +%1718 = OpLabel +%1720 = OpLoad %6 %16 +%1721 = OpLoad %6 %17 +%1722 = OpIAdd %6 %1720 %1721 +%1723 = OpLoad %6 %20 +%1724 = OpIAdd %6 %1722 %1723 +OpStore %73 %1724 +OpBranch %1719 +%1719 = OpLabel +%1725 = OpLoad %1035 %1054 +%1726 = OpULessThanEqual %1057 %1725 %1056 +OpSelectionMerge %1728 None +OpBranchConditional %1726 %1727 %1728 +%1727 = OpLabel +%1729 = OpLoad %6 %16 +%1730 = OpLoad %6 %17 +%1731 = OpISub %6 %1729 %1730 +%1732 = OpLoad %6 %21 +%1733 = OpIAdd %6 %1731 %1732 +OpStore %74 %1733 +OpBranch %1728 +%1728 = OpLabel +%1734 = OpLoad %1035 %1054 +%1735 = OpINotEqual %1057 %1734 %1056 +OpSelectionMerge %1737 None +OpBranchConditional %1735 %1736 %1737 +%1736 = OpLabel +%1738 = OpLoad %6 %16 +%1739 = OpLoad %6 %17 +%1740 = OpISub %6 %1738 %1739 +%1741 = OpLoad %6 %22 +%1742 = OpIAdd %6 %1740 %1741 +OpStore %75 %1742 +OpBranch %1737 +%1737 = OpLabel +%1743 = OpLoad %1035 %1054 +%1744 = OpULessThan %1057 %1743 %1094 +OpSelectionMerge %1746 None +OpBranchConditional %1744 %1745 %1746 +%1745 = OpLabel +%1747 = OpLoad %6 %16 +%1748 = OpLoad %6 %18 +%1749 = OpIAdd %6 %1747 %1748 +%1750 = OpLoad %6 %19 +%1751 = OpISub %6 %1749 %1750 +OpStore %76 %1751 +OpBranch %1746 +%1746 = OpLabel +%1752 = OpLoad %1035 %1054 +%1753 = OpUGreaterThan %1057 %1752 %1056 +OpSelectionMerge %1755 None +OpBranchConditional %1753 %1754 %1755 +%1754 = OpLabel +%1756 = OpLoad %6 %16 +%1757 = OpLoad %6 %18 +%1758 = OpISub %6 %1756 %1757 +%1759 = OpLoad %6 %20 +%1760 = OpIAdd %6 %1758 %1759 +OpStore %77 %1760 +OpBranch %1755 +%1755 = OpLabel +%1761 = OpLoad %1035 %1054 +%1762 = OpINotEqual %1057 %1761 %1056 +OpSelectionMerge %1764 None +OpBranchConditional %1762 %1763 %1764 +%1763 = OpLabel +%1765 = OpLoad %6 %16 +%1766 = OpLoad %6 %18 +%1767 = OpISub %6 %1765 %1766 +%1768 = OpLoad %6 %21 +%1769 = OpISub %6 %1767 %1768 +OpStore %78 %1769 +OpBranch %1764 +%1764 = OpLabel +%1770 = OpLoad %1035 %1054 +%1771 = OpIEqual %1057 %1770 %1094 +OpSelectionMerge %1773 None +OpBranchConditional %1771 %1772 %1773 +%1772 = OpLabel +%1774 = OpLoad %6 %16 +%1775 = OpLoad %6 %18 +%1776 = OpIAdd %6 %1774 %1775 +%1777 = OpLoad %6 %22 +%1778 = OpIAdd %6 %1776 %1777 +OpStore %79 %1778 +OpBranch %1773 +%1773 = OpLabel +%1779 = OpLoad %1035 %1054 +%1780 = OpULessThanEqual %1057 %1779 %1138 +OpSelectionMerge %1782 None +OpBranchConditional %1780 %1781 %1782 +%1781 = OpLabel +%1783 = OpLoad %6 %16 +%1784 = OpLoad %6 %19 +%1785 = OpISub %6 %1783 %1784 +%1786 = OpLoad %6 %20 +%1787 = OpISub %6 %1785 %1786 +OpStore %80 %1787 +OpBranch %1782 +%1782 = OpLabel +%1788 = OpLoad %1035 %1054 +%1789 = OpULessThanEqual %1057 %1788 %1138 +OpSelectionMerge %1791 None +OpBranchConditional %1789 %1790 %1791 +%1790 = OpLabel +%1792 = OpLoad %6 %14 +%1793 = OpLoad %6 %20 +%1794 = OpIAdd %6 %1792 %1793 +OpStore %81 %1794 +OpBranch %1791 +%1791 = OpLabel +%1795 = OpLoad %1035 %1054 +%1796 = OpIEqual %1057 %1795 %1138 +OpSelectionMerge %1798 None +OpBranchConditional %1796 %1797 %1798 +%1797 = OpLabel +%1799 = OpLoad %6 %16 +%1800 = OpLoad %6 %19 +%1801 = OpISub %6 %1799 %1800 +%1802 = OpLoad %6 %21 +%1803 = OpISub %6 %1801 %1802 +OpStore %82 %1803 +OpBranch %1798 +%1798 = OpLabel +%1804 = OpLoad %1035 %1054 +%1805 = OpULessThan %1057 %1804 %1072 +OpSelectionMerge %1807 None +OpBranchConditional %1805 %1806 %1807 +%1806 = OpLabel +%1808 = OpLoad %6 %16 +%1809 = OpLoad %6 %19 +%1810 = OpIAdd %6 %1808 %1809 +%1811 = OpLoad %6 %22 +%1812 = OpISub %6 %1810 %1811 +OpStore %83 %1812 +OpBranch %1807 +%1807 = OpLabel +%1813 = OpLoad %1035 %1054 +%1814 = OpINotEqual %1057 %1813 %1094 +OpSelectionMerge %1816 None +OpBranchConditional %1814 %1815 %1816 +%1815 = OpLabel +%1817 = OpLoad %6 %16 +%1818 = OpLoad %6 %20 +%1819 = OpISub %6 %1817 %1818 +%1820 = OpLoad %6 %21 +%1821 = OpISub %6 %1819 %1820 +OpStore %84 %1821 +OpBranch %1816 +%1816 = OpLabel +%1822 = OpLoad %1035 %1054 +%1823 = OpINotEqual %1057 %1822 %1138 +OpSelectionMerge %1825 None +OpBranchConditional %1823 %1824 %1825 +%1824 = OpLabel +%1826 = OpLoad %6 %16 +%1827 = OpLoad %6 %20 +%1828 = OpISub %6 %1826 %1827 +%1829 = OpLoad %6 %22 +%1830 = OpIAdd %6 %1828 %1829 +OpStore %85 %1830 +OpBranch %1825 +%1825 = OpLabel +%1831 = OpLoad %1035 %1054 +%1832 = OpIEqual %1057 %1831 %1138 +OpSelectionMerge %1834 None +OpBranchConditional %1832 %1833 %1834 +%1833 = OpLabel +%1835 = OpLoad %6 %16 +%1836 = OpLoad %6 %21 +%1837 = OpISub %6 %1835 %1836 +%1838 = OpLoad %6 %22 +%1839 = OpISub %6 %1837 %1838 +OpStore %86 %1839 +OpBranch %1834 +%1834 = OpLabel +%1840 = OpLoad %1035 %1054 +%1841 = OpULessThan %1057 %1840 %1094 +OpSelectionMerge %1843 None +OpBranchConditional %1841 %1842 %1843 +%1842 = OpLabel +%1844 = OpLoad %6 %17 +%1845 = OpLoad %6 %18 +%1846 = OpIAdd %6 %1844 %1845 +%1847 = OpLoad %6 %19 +%1848 = OpISub %6 %1846 %1847 +OpStore %87 %1848 +OpBranch %1843 +%1843 = OpLabel +%1849 = OpLoad %1035 %1054 +%1850 = OpINotEqual %1057 %1849 %1138 +OpSelectionMerge %1852 None +OpBranchConditional %1850 %1851 %1852 +%1851 = OpLabel +%1853 = OpLoad %6 %17 +%1854 = OpLoad %6 %18 +%1855 = OpIAdd %6 %1853 %1854 +%1856 = OpLoad %6 %20 +%1857 = OpISub %6 %1855 %1856 +OpStore %88 %1857 +OpBranch %1852 +%1852 = OpLabel +%1858 = OpLoad %1035 %1054 +%1859 = OpULessThan %1057 %1858 %1072 +OpSelectionMerge %1861 None +OpBranchConditional %1859 %1860 %1861 +%1860 = OpLabel +%1862 = OpLoad %6 %17 +%1863 = OpLoad %6 %18 +%1864 = OpIAdd %6 %1862 %1863 +%1865 = OpLoad %6 %21 +%1866 = OpISub %6 %1864 %1865 +OpStore %89 %1866 +OpBranch %1861 +%1861 = OpLabel +%1867 = OpLoad %1035 %1054 +%1868 = OpINotEqual %1057 %1867 %1094 +OpSelectionMerge %1870 None +OpBranchConditional %1868 %1869 %1870 +%1869 = OpLabel +%1871 = OpLoad %6 %17 +%1872 = OpLoad %6 %18 +%1873 = OpIAdd %6 %1871 %1872 +%1874 = OpLoad %6 %22 +%1875 = OpISub %6 %1873 %1874 +OpStore %90 %1875 +OpBranch %1870 +%1870 = OpLabel +%1876 = OpLoad %1035 %1054 +%1877 = OpIEqual %1057 %1876 %1138 +OpSelectionMerge %1879 None +OpBranchConditional %1877 %1878 %1879 +%1878 = OpLabel +%1880 = OpLoad %6 %17 +%1881 = OpLoad %6 %19 +%1882 = OpIAdd %6 %1880 %1881 +%1883 = OpLoad %6 %20 +%1884 = OpISub %6 %1882 %1883 +OpStore %91 %1884 +OpBranch %1879 +%1879 = OpLabel +%1885 = OpLoad %1035 %1054 +%1886 = OpUGreaterThan %1057 %1885 %1138 +OpSelectionMerge %1888 None +OpBranchConditional %1886 %1887 %1888 +%1887 = OpLabel +%1889 = OpLoad %6 %14 +%1890 = OpLoad %6 %21 +%1891 = OpIAdd %6 %1889 %1890 +OpStore %92 %1891 +OpBranch %1888 +%1888 = OpLabel +%1892 = OpLoad %1035 %1054 +%1893 = OpULessThanEqual %1057 %1892 %1138 +OpSelectionMerge %1895 None +OpBranchConditional %1893 %1894 %1895 +%1894 = OpLabel +%1896 = OpLoad %6 %17 +%1897 = OpLoad %6 %19 +%1898 = OpISub %6 %1896 %1897 +%1899 = OpLoad %6 %21 +%1900 = OpISub %6 %1898 %1899 +OpStore %93 %1900 +OpBranch %1895 +%1895 = OpLabel +%1901 = OpLoad %1035 %1054 +%1902 = OpUGreaterThan %1057 %1901 %1072 +OpSelectionMerge %1904 None +OpBranchConditional %1902 %1903 %1904 +%1903 = OpLabel +%1905 = OpLoad %6 %17 +%1906 = OpLoad %6 %19 +%1907 = OpISub %6 %1905 %1906 +%1908 = OpLoad %6 %22 +%1909 = OpISub %6 %1907 %1908 +OpStore %94 %1909 +OpBranch %1904 +%1904 = OpLabel +%1910 = OpLoad %1035 %1054 +%1911 = OpINotEqual %1057 %1910 %1056 +OpSelectionMerge %1913 None +OpBranchConditional %1911 %1912 %1913 +%1912 = OpLabel +%1914 = OpLoad %6 %17 +%1915 = OpLoad %6 %20 +%1916 = OpISub %6 %1914 %1915 +%1917 = OpLoad %6 %21 +%1918 = OpISub %6 %1916 %1917 +OpStore %95 %1918 +OpBranch %1913 +%1913 = OpLabel +%1919 = OpLoad %1035 %1054 +%1920 = OpIEqual %1057 %1919 %1138 +OpSelectionMerge %1922 None +OpBranchConditional %1920 %1921 %1922 +%1921 = OpLabel +%1923 = OpLoad %6 %17 +%1924 = OpLoad %6 %20 +%1925 = OpISub %6 %1923 %1924 +%1926 = OpLoad %6 %22 +%1927 = OpISub %6 %1925 %1926 +OpStore %96 %1927 +OpBranch %1922 +%1922 = OpLabel +%1928 = OpLoad %1035 %1054 +%1929 = OpIEqual %1057 %1928 %1094 +OpSelectionMerge %1931 None +OpBranchConditional %1929 %1930 %1931 +%1930 = OpLabel +%1932 = OpLoad %6 %17 +%1933 = OpLoad %6 %21 +%1934 = OpIAdd %6 %1932 %1933 +%1935 = OpLoad %6 %22 +%1936 = OpIAdd %6 %1934 %1935 +OpStore %97 %1936 +OpBranch %1931 +%1931 = OpLabel +%1937 = OpLoad %1035 %1054 +%1938 = OpIEqual %1057 %1937 %1056 +OpSelectionMerge %1940 None +OpBranchConditional %1938 %1939 %1940 +%1939 = OpLabel +%1941 = OpLoad %6 %18 +%1942 = OpLoad %6 %19 +%1943 = OpISub %6 %1941 %1942 +%1944 = OpLoad %6 %20 +%1945 = OpIAdd %6 %1943 %1944 +OpStore %98 %1945 +OpBranch %1940 +%1940 = OpLabel +%1946 = OpLoad %1035 %1054 +%1947 = OpUGreaterThan %1057 %1946 %1138 +OpSelectionMerge %1949 None +OpBranchConditional %1947 %1948 %1949 +%1948 = OpLabel +%1950 = OpLoad %6 %18 +%1951 = OpLoad %6 %19 +%1952 = OpISub %6 %1950 %1951 +%1953 = OpLoad %6 %21 +%1954 = OpIAdd %6 %1952 %1953 +OpStore %99 %1954 +OpBranch %1949 +%1949 = OpLabel +%1955 = OpLoad %1035 %1054 +%1956 = OpUGreaterThanEqual %1057 %1955 %1072 +OpSelectionMerge %1958 None +OpBranchConditional %1956 %1957 %1958 +%1957 = OpLabel +%1959 = OpLoad %6 %18 +%1960 = OpLoad %6 %19 +%1961 = OpIAdd %6 %1959 %1960 +%1962 = OpLoad %6 %22 +%1963 = OpISub %6 %1961 %1962 +OpStore %100 %1963 +OpBranch %1958 +%1958 = OpLabel +%1964 = OpLoad %1035 %1054 +%1965 = OpULessThanEqual %1057 %1964 %1138 +OpSelectionMerge %1967 None +OpBranchConditional %1965 %1966 %1967 +%1966 = OpLabel +%1968 = OpLoad %6 %18 +%1969 = OpLoad %6 %20 +%1970 = OpISub %6 %1968 %1969 +%1971 = OpLoad %6 %21 +%1972 = OpISub %6 %1970 %1971 +OpStore %101 %1972 +OpBranch %1967 +%1967 = OpLabel +%1973 = OpLoad %1035 %1054 +%1974 = OpULessThanEqual %1057 %1973 %1072 +OpSelectionMerge %1976 None +OpBranchConditional %1974 %1975 %1976 +%1975 = OpLabel +%1977 = OpLoad %6 %18 +%1978 = OpLoad %6 %20 +%1979 = OpIAdd %6 %1977 %1978 +%1980 = OpLoad %6 %22 +%1981 = OpIAdd %6 %1979 %1980 +OpStore %102 %1981 +OpBranch %1976 +%1976 = OpLabel +%1982 = OpLoad %1035 %1054 +%1983 = OpUGreaterThanEqual %1057 %1982 %1094 +OpSelectionMerge %1985 None +OpBranchConditional %1983 %1984 %1985 +%1984 = OpLabel +%1986 = OpLoad %6 %14 +%1987 = OpLoad %6 %22 +%1988 = OpIAdd %6 %1986 %1987 +OpStore %103 %1988 +OpBranch %1985 +%1985 = OpLabel +%1989 = OpLoad %1035 %1054 +%1990 = OpUGreaterThanEqual %1057 %1989 %1056 +OpSelectionMerge %1992 None +OpBranchConditional %1990 %1991 %1992 +%1991 = OpLabel +%1993 = OpLoad %6 %18 +%1994 = OpLoad %6 %21 +%1995 = OpIAdd %6 %1993 %1994 +%1996 = OpLoad %6 %22 +%1997 = OpISub %6 %1995 %1996 +OpStore %104 %1997 +OpBranch %1992 +%1992 = OpLabel +%1998 = OpLoad %1035 %1054 +%1999 = OpINotEqual %1057 %1998 %1094 +OpSelectionMerge %2001 None +OpBranchConditional %1999 %2000 %2001 +%2000 = OpLabel +%2002 = OpLoad %6 %19 +%2003 = OpLoad %6 %20 +%2004 = OpISub %6 %2002 %2003 +%2005 = OpLoad %6 %21 +%2006 = OpISub %6 %2004 %2005 +OpStore %105 %2006 +OpBranch %2001 +%2001 = OpLabel +%2007 = OpLoad %1035 %1054 +%2008 = OpULessThan %1057 %2007 %1094 +OpSelectionMerge %2010 None +OpBranchConditional %2008 %2009 %2010 +%2009 = OpLabel +%2011 = OpLoad %6 %19 +%2012 = OpLoad %6 %20 +%2013 = OpIAdd %6 %2011 %2012 +%2014 = OpLoad %6 %22 +%2015 = OpIAdd %6 %2013 %2014 +OpStore %106 %2015 +OpBranch %2010 +%2010 = OpLabel +%2016 = OpLoad %1035 %1054 +%2017 = OpUGreaterThan %1057 %2016 %1094 +OpSelectionMerge %2019 None +OpBranchConditional %2017 %2018 %2019 +%2018 = OpLabel +%2020 = OpLoad %6 %19 +%2021 = OpLoad %6 %21 +%2022 = OpIAdd %6 %2020 %2021 +%2023 = OpLoad %6 %22 +%2024 = OpIAdd %6 %2022 %2023 +OpStore %107 %2024 +OpBranch %2019 +%2019 = OpLabel +%2025 = OpLoad %1035 %1054 +%2026 = OpIEqual %1057 %2025 %1094 +OpSelectionMerge %2028 None +OpBranchConditional %2026 %2027 %2028 +%2027 = OpLabel +%2029 = OpLoad %6 %20 +%2030 = OpLoad %6 %21 +%2031 = OpIAdd %6 %2029 %2030 +%2032 = OpLoad %6 %22 +%2033 = OpIAdd %6 %2031 %2032 +OpStore %108 %2033 +OpBranch %2028 +%2028 = OpLabel +%2034 = OpLoad %1035 %1054 +%2035 = OpULessThan %1057 %2034 %1094 +OpSelectionMerge %2037 None +OpBranchConditional %2035 %2036 %2037 +%2036 = OpLabel +%2038 = OpLoad %6 %13 +%2039 = OpLoad %6 %14 +%2040 = OpISub %6 %2038 %2039 +%2041 = OpLoad %6 %15 +%2042 = OpIAdd %6 %2040 %2041 +%2043 = OpLoad %6 %16 +%2044 = OpIAdd %6 %2042 %2043 +OpStore %109 %2044 +OpBranch %2037 +%2037 = OpLabel +%2045 = OpLoad %1035 %1054 +%2046 = OpULessThan %1057 %2045 %1056 +OpSelectionMerge %2048 None +OpBranchConditional %2046 %2047 %2048 +%2047 = OpLabel +%2049 = OpLoad %6 %13 +%2050 = OpLoad %6 %14 +%2051 = OpIAdd %6 %2049 %2050 +%2052 = OpLoad %6 %15 +%2053 = OpISub %6 %2051 %2052 +%2054 = OpLoad %6 %17 +%2055 = OpIAdd %6 %2053 %2054 +OpStore %110 %2055 +OpBranch %2048 +%2048 = OpLabel +%2056 = OpLoad %1035 %1054 +%2057 = OpUGreaterThan %1057 %2056 %1138 +OpSelectionMerge %2059 None +OpBranchConditional %2057 %2058 %2059 +%2058 = OpLabel +%2060 = OpLoad %6 %13 +%2061 = OpLoad %6 %14 +%2062 = OpIAdd %6 %2060 %2061 +%2063 = OpLoad %6 %15 +%2064 = OpISub %6 %2062 %2063 +%2065 = OpLoad %6 %18 +%2066 = OpISub %6 %2064 %2065 +OpStore %111 %2066 +OpBranch %2059 +%2059 = OpLabel +%2067 = OpLoad %1035 %1054 +%2068 = OpULessThan %1057 %2067 %1138 +OpSelectionMerge %2070 None +OpBranchConditional %2068 %2069 %2070 +%2069 = OpLabel +%2071 = OpLoad %6 %13 +%2072 = OpLoad %6 %14 +%2073 = OpISub %6 %2071 %2072 +%2074 = OpLoad %6 %15 +%2075 = OpIAdd %6 %2073 %2074 +%2076 = OpLoad %6 %19 +%2077 = OpISub %6 %2075 %2076 +OpStore %112 %2077 +OpBranch %2070 +%2070 = OpLabel +%2078 = OpLoad %1035 %1054 +%2079 = OpUGreaterThan %1057 %2078 %1072 +OpSelectionMerge %2081 None +OpBranchConditional %2079 %2080 %2081 +%2080 = OpLabel +%2082 = OpLoad %6 %13 +%2083 = OpLoad %6 %14 +%2084 = OpIAdd %6 %2082 %2083 +%2085 = OpLoad %6 %15 +%2086 = OpISub %6 %2084 %2085 +%2087 = OpLoad %6 %20 +%2088 = OpISub %6 %2086 %2087 +OpStore %113 %2088 +OpBranch %2081 +%2081 = OpLabel +%2089 = OpLoad %1035 %1054 +%2090 = OpIEqual %1057 %2089 %1056 +OpSelectionMerge %2092 None +OpBranchConditional %2090 %2091 %2092 +%2091 = OpLabel +%2093 = OpLoad %6 %15 +%2094 = OpLoad %6 %16 +%2095 = OpIAdd %6 %2093 %2094 +OpStore %114 %2095 +OpBranch %2092 +%2092 = OpLabel +%2096 = OpLoad %1035 %1054 +%2097 = OpUGreaterThanEqual %1057 %2096 %1138 +OpSelectionMerge %2099 None +OpBranchConditional %2097 %2098 %2099 +%2098 = OpLabel +%2100 = OpLoad %6 %13 +%2101 = OpLoad %6 %14 +%2102 = OpISub %6 %2100 %2101 +%2103 = OpLoad %6 %15 +%2104 = OpISub %6 %2102 %2103 +%2105 = OpLoad %6 %21 +%2106 = OpIAdd %6 %2104 %2105 +OpStore %115 %2106 +OpBranch %2099 +%2099 = OpLabel +%2107 = OpLoad %1035 %1054 +%2108 = OpUGreaterThan %1057 %2107 %1056 +OpSelectionMerge %2110 None +OpBranchConditional %2108 %2109 %2110 +%2109 = OpLabel +%2111 = OpLoad %6 %13 +%2112 = OpLoad %6 %14 +%2113 = OpIAdd %6 %2111 %2112 +%2114 = OpLoad %6 %15 +%2115 = OpISub %6 %2113 %2114 +%2116 = OpLoad %6 %22 +%2117 = OpIAdd %6 %2115 %2116 +OpStore %116 %2117 +OpBranch %2110 +%2110 = OpLabel +%2118 = OpLoad %1035 %1054 +%2119 = OpUGreaterThanEqual %1057 %2118 %1138 +OpSelectionMerge %2121 None +OpBranchConditional %2119 %2120 %2121 +%2120 = OpLabel +%2122 = OpLoad %6 %13 +%2123 = OpLoad %6 %14 +%2124 = OpISub %6 %2122 %2123 +%2125 = OpLoad %6 %16 +%2126 = OpIAdd %6 %2124 %2125 +%2127 = OpLoad %6 %17 +%2128 = OpISub %6 %2126 %2127 +OpStore %117 %2128 +OpBranch %2121 +%2121 = OpLabel +%2129 = OpLoad %1035 %1054 +%2130 = OpUGreaterThanEqual %1057 %2129 %1056 +OpSelectionMerge %2132 None +OpBranchConditional %2130 %2131 %2132 +%2131 = OpLabel +%2133 = OpLoad %6 %13 +%2134 = OpLoad %6 %14 +%2135 = OpIAdd %6 %2133 %2134 +%2136 = OpLoad %6 %16 +%2137 = OpIAdd %6 %2135 %2136 +%2138 = OpLoad %6 %18 +%2139 = OpISub %6 %2137 %2138 +OpStore %118 %2139 +OpBranch %2132 +%2132 = OpLabel +%2140 = OpLoad %1035 %1054 +%2141 = OpUGreaterThan %1057 %2140 %1056 +OpSelectionMerge %2143 None +OpBranchConditional %2141 %2142 %2143 +%2142 = OpLabel +%2144 = OpLoad %6 %13 +%2145 = OpLoad %6 %14 +%2146 = OpISub %6 %2144 %2145 +%2147 = OpLoad %6 %16 +%2148 = OpIAdd %6 %2146 %2147 +%2149 = OpLoad %6 %19 +%2150 = OpIAdd %6 %2148 %2149 +OpStore %119 %2150 +OpBranch %2143 +%2143 = OpLabel +%2151 = OpLoad %1035 %1054 +%2152 = OpIEqual %1057 %2151 %1138 +OpSelectionMerge %2154 None +OpBranchConditional %2152 %2153 %2154 +%2153 = OpLabel +%2155 = OpLoad %6 %13 +%2156 = OpLoad %6 %14 +%2157 = OpISub %6 %2155 %2156 +%2158 = OpLoad %6 %16 +%2159 = OpIAdd %6 %2157 %2158 +%2160 = OpLoad %6 %20 +%2161 = OpIAdd %6 %2159 %2160 +OpStore %120 %2161 +OpBranch %2154 +%2154 = OpLabel +%2162 = OpLoad %1035 %1054 +%2163 = OpULessThanEqual %1057 %2162 %1138 +OpSelectionMerge %2165 None +OpBranchConditional %2163 %2164 %2165 +%2164 = OpLabel +%2166 = OpLoad %6 %13 +%2167 = OpLoad %6 %14 +%2168 = OpIAdd %6 %2166 %2167 +%2169 = OpLoad %6 %16 +%2170 = OpISub %6 %2168 %2169 +%2171 = OpLoad %6 %21 +%2172 = OpISub %6 %2170 %2171 +OpStore %121 %2172 +OpBranch %2165 +%2165 = OpLabel +%2173 = OpLoad %1035 %1054 +%2174 = OpUGreaterThan %1057 %2173 %1094 +OpSelectionMerge %2176 None +OpBranchConditional %2174 %2175 %2176 +%2175 = OpLabel +%2177 = OpLoad %6 %13 +%2178 = OpLoad %6 %14 +%2179 = OpISub %6 %2177 %2178 +%2180 = OpLoad %6 %16 +%2181 = OpISub %6 %2179 %2180 +%2182 = OpLoad %6 %22 +%2183 = OpISub %6 %2181 %2182 +OpStore %122 %2183 +OpBranch %2176 +%2176 = OpLabel +%2184 = OpLoad %1035 %1054 +%2185 = OpIEqual %1057 %2184 %1072 +OpSelectionMerge %2187 None +OpBranchConditional %2185 %2186 %2187 +%2186 = OpLabel +%2188 = OpLoad %6 %13 +%2189 = OpLoad %6 %14 +%2190 = OpIAdd %6 %2188 %2189 +%2191 = OpLoad %6 %17 +%2192 = OpISub %6 %2190 %2191 +%2193 = OpLoad %6 %18 +%2194 = OpIAdd %6 %2192 %2193 +OpStore %123 %2194 +OpBranch %2187 +%2187 = OpLabel +%2195 = OpLoad %1035 %1054 +%2196 = OpIEqual %1057 %2195 %1094 +OpSelectionMerge %2198 None +OpBranchConditional %2196 %2197 %2198 +%2197 = OpLabel +%2199 = OpLoad %6 %13 +%2200 = OpLoad %6 %14 +%2201 = OpIAdd %6 %2199 %2200 +%2202 = OpLoad %6 %17 +%2203 = OpISub %6 %2201 %2202 +%2204 = OpLoad %6 %19 +%2205 = OpISub %6 %2203 %2204 +OpStore %124 %2205 +OpBranch %2198 +%2198 = OpLabel +%2206 = OpLoad %1035 %1054 +%2207 = OpULessThanEqual %1057 %2206 %1056 +OpSelectionMerge %2209 None +OpBranchConditional %2207 %2208 %2209 +%2208 = OpLabel +%2210 = OpLoad %6 %15 +%2211 = OpLoad %6 %17 +%2212 = OpISub %6 %2210 %2211 +OpStore %125 %2212 +OpBranch %2209 +%2209 = OpLabel +%2213 = OpLoad %1035 %1054 +%2214 = OpUGreaterThan %1057 %2213 %1138 +OpSelectionMerge %2216 None +OpBranchConditional %2214 %2215 %2216 +%2215 = OpLabel +%2217 = OpLoad %6 %13 +%2218 = OpLoad %6 %14 +%2219 = OpIAdd %6 %2217 %2218 +%2220 = OpLoad %6 %17 +%2221 = OpIAdd %6 %2219 %2220 +%2222 = OpLoad %6 %20 +%2223 = OpIAdd %6 %2221 %2222 +OpStore %126 %2223 +OpBranch %2216 +%2216 = OpLabel +%2224 = OpLoad %1035 %1054 +%2225 = OpULessThanEqual %1057 %2224 %1094 +OpSelectionMerge %2227 None +OpBranchConditional %2225 %2226 %2227 +%2226 = OpLabel +%2228 = OpLoad %6 %13 +%2229 = OpLoad %6 %14 +%2230 = OpISub %6 %2228 %2229 +%2231 = OpLoad %6 %17 +%2232 = OpISub %6 %2230 %2231 +%2233 = OpLoad %6 %21 +%2234 = OpIAdd %6 %2232 %2233 +OpStore %127 %2234 +OpBranch %2227 +%2227 = OpLabel +%2235 = OpLoad %1035 %1054 +%2236 = OpULessThanEqual %1057 %2235 %1094 +OpSelectionMerge %2238 None +OpBranchConditional %2236 %2237 %2238 +%2237 = OpLabel +%2239 = OpLoad %6 %13 +%2240 = OpLoad %6 %14 +%2241 = OpIAdd %6 %2239 %2240 +%2242 = OpLoad %6 %17 +%2243 = OpIAdd %6 %2241 %2242 +%2244 = OpLoad %6 %22 +%2245 = OpIAdd %6 %2243 %2244 +OpStore %128 %2245 +OpBranch %2238 +%2238 = OpLabel +%2246 = OpLoad %1035 %1054 +%2247 = OpULessThanEqual %1057 %2246 %1094 +OpSelectionMerge %2249 None +OpBranchConditional %2247 %2248 %2249 +%2248 = OpLabel +%2250 = OpLoad %6 %13 +%2251 = OpLoad %6 %14 +%2252 = OpIAdd %6 %2250 %2251 +%2253 = OpLoad %6 %18 +%2254 = OpIAdd %6 %2252 %2253 +%2255 = OpLoad %6 %19 +%2256 = OpIAdd %6 %2254 %2255 +OpStore %129 %2256 +OpBranch %2249 +%2249 = OpLabel +%2257 = OpLoad %1035 %1054 +%2258 = OpUGreaterThan %1057 %2257 %1056 +OpSelectionMerge %2260 None +OpBranchConditional %2258 %2259 %2260 +%2259 = OpLabel +%2261 = OpLoad %6 %13 +%2262 = OpLoad %6 %14 +%2263 = OpISub %6 %2261 %2262 +%2264 = OpLoad %6 %18 +%2265 = OpISub %6 %2263 %2264 +%2266 = OpLoad %6 %20 +%2267 = OpISub %6 %2265 %2266 +OpStore %130 %2267 +OpBranch %2260 +%2260 = OpLabel +%2268 = OpLoad %1035 %1054 +%2269 = OpUGreaterThan %1057 %2268 %1056 +OpSelectionMerge %2271 None +OpBranchConditional %2269 %2270 %2271 +%2270 = OpLabel +%2272 = OpLoad %6 %13 +%2273 = OpLoad %6 %14 +%2274 = OpIAdd %6 %2272 %2273 +%2275 = OpLoad %6 %18 +%2276 = OpISub %6 %2274 %2275 +%2277 = OpLoad %6 %21 +%2278 = OpISub %6 %2276 %2277 +OpStore %131 %2278 +OpBranch %2271 +%2271 = OpLabel +%2279 = OpLoad %1035 %1054 +%2280 = OpULessThan %1057 %2279 %1094 +OpSelectionMerge %2282 None +OpBranchConditional %2280 %2281 %2282 +%2281 = OpLabel +%2283 = OpLoad %6 %13 +%2284 = OpLoad %6 %14 +%2285 = OpISub %6 %2283 %2284 +%2286 = OpLoad %6 %18 +%2287 = OpIAdd %6 %2285 %2286 +%2288 = OpLoad %6 %22 +%2289 = OpISub %6 %2287 %2288 +OpStore %132 %2289 +OpBranch %2282 +%2282 = OpLabel +%2290 = OpLoad %1035 %1054 +%2291 = OpULessThanEqual %1057 %2290 %1094 +OpSelectionMerge %2293 None +OpBranchConditional %2291 %2292 %2293 +%2292 = OpLabel +%2294 = OpLoad %6 %13 +%2295 = OpLoad %6 %14 +%2296 = OpIAdd %6 %2294 %2295 +%2297 = OpLoad %6 %19 +%2298 = OpIAdd %6 %2296 %2297 +%2299 = OpLoad %6 %20 +%2300 = OpIAdd %6 %2298 %2299 +OpStore %133 %2300 +OpBranch %2293 +%2293 = OpLabel +%2301 = OpLoad %1035 %1054 +%2302 = OpULessThanEqual %1057 %2301 %1056 +OpSelectionMerge %2304 None +OpBranchConditional %2302 %2303 %2304 +%2303 = OpLabel +%2305 = OpLoad %6 %13 +%2306 = OpLoad %6 %14 +%2307 = OpISub %6 %2305 %2306 +%2308 = OpLoad %6 %19 +%2309 = OpIAdd %6 %2307 %2308 +%2310 = OpLoad %6 %21 +%2311 = OpIAdd %6 %2309 %2310 +OpStore %134 %2311 +OpBranch %2304 +%2304 = OpLabel +%2312 = OpLoad %1035 %1054 +%2313 = OpIEqual %1057 %2312 %1072 +OpSelectionMerge %2315 None +OpBranchConditional %2313 %2314 %2315 +%2314 = OpLabel +%2316 = OpLoad %6 %13 +%2317 = OpLoad %6 %14 +%2318 = OpISub %6 %2316 %2317 +%2319 = OpLoad %6 %19 +%2320 = OpISub %6 %2318 %2319 +%2321 = OpLoad %6 %22 +%2322 = OpIAdd %6 %2320 %2321 +OpStore %135 %2322 +OpBranch %2315 +%2315 = OpLabel +%2323 = OpLoad %1035 %1054 +%2324 = OpULessThan %1057 %2323 %1072 +OpSelectionMerge %2326 None +OpBranchConditional %2324 %2325 %2326 +%2325 = OpLabel +%2327 = OpLoad %6 %15 +%2328 = OpLoad %6 %18 +%2329 = OpISub %6 %2327 %2328 +OpStore %136 %2329 +OpBranch %2326 +%2326 = OpLabel +%2330 = OpLoad %1035 %1054 +%2331 = OpUGreaterThanEqual %1057 %2330 %1094 +OpSelectionMerge %2333 None +OpBranchConditional %2331 %2332 %2333 +%2332 = OpLabel +%2334 = OpLoad %6 %13 +%2335 = OpLoad %6 %14 +%2336 = OpISub %6 %2334 %2335 +%2337 = OpLoad %6 %20 +%2338 = OpISub %6 %2336 %2337 +%2339 = OpLoad %6 %21 +%2340 = OpIAdd %6 %2338 %2339 +OpStore %137 %2340 +OpBranch %2333 +%2333 = OpLabel +%2341 = OpLoad %1035 %1054 +%2342 = OpIEqual %1057 %2341 %1056 +OpSelectionMerge %2344 None +OpBranchConditional %2342 %2343 %2344 +%2343 = OpLabel +%2345 = OpLoad %6 %13 +%2346 = OpLoad %6 %14 +%2347 = OpISub %6 %2345 %2346 +%2348 = OpLoad %6 %20 +%2349 = OpISub %6 %2347 %2348 +%2350 = OpLoad %6 %22 +%2351 = OpISub %6 %2349 %2350 +OpStore %138 %2351 +OpBranch %2344 +%2344 = OpLabel +%2352 = OpLoad %1035 %1054 +%2353 = OpIEqual %1057 %2352 %1056 +OpSelectionMerge %2355 None +OpBranchConditional %2353 %2354 %2355 +%2354 = OpLabel +%2356 = OpLoad %6 %13 +%2357 = OpLoad %6 %14 +%2358 = OpISub %6 %2356 %2357 +%2359 = OpLoad %6 %21 +%2360 = OpIAdd %6 %2358 %2359 +%2361 = OpLoad %6 %22 +%2362 = OpIAdd %6 %2360 %2361 +OpStore %139 %2362 +OpBranch %2355 +%2355 = OpLabel +%2363 = OpLoad %1035 %1054 +%2364 = OpULessThan %1057 %2363 %1138 +OpSelectionMerge %2366 None +OpBranchConditional %2364 %2365 %2366 +%2365 = OpLabel +%2367 = OpLoad %6 %13 +%2368 = OpLoad %6 %15 +%2369 = OpIAdd %6 %2367 %2368 +%2370 = OpLoad %6 %16 +%2371 = OpISub %6 %2369 %2370 +%2372 = OpLoad %6 %17 +%2373 = OpISub %6 %2371 %2372 +OpStore %140 %2373 +OpBranch %2366 +%2366 = OpLabel +%2374 = OpLoad %1035 %1054 +%2375 = OpIEqual %1057 %2374 %1056 +OpSelectionMerge %2377 None +OpBranchConditional %2375 %2376 %2377 +%2376 = OpLabel +%2378 = OpLoad %6 %13 +%2379 = OpLoad %6 %15 +%2380 = OpISub %6 %2378 %2379 +%2381 = OpLoad %6 %16 +%2382 = OpISub %6 %2380 %2381 +%2383 = OpLoad %6 %18 +%2384 = OpIAdd %6 %2382 %2383 +OpStore %141 %2384 +OpBranch %2377 +%2377 = OpLabel +%2385 = OpLoad %1035 %1054 +%2386 = OpULessThanEqual %1057 %2385 %1056 +OpSelectionMerge %2388 None +OpBranchConditional %2386 %2387 %2388 +%2387 = OpLabel +%2389 = OpLoad %6 %13 +%2390 = OpLoad %6 %15 +%2391 = OpISub %6 %2389 %2390 +%2392 = OpLoad %6 %16 +%2393 = OpIAdd %6 %2391 %2392 +%2394 = OpLoad %6 %19 +%2395 = OpISub %6 %2393 %2394 +OpStore %142 %2395 +OpBranch %2388 +%2388 = OpLabel +%2396 = OpLoad %1035 %1054 +%2397 = OpUGreaterThanEqual %1057 %2396 %1094 +OpSelectionMerge %2399 None +OpBranchConditional %2397 %2398 %2399 +%2398 = OpLabel +%2400 = OpLoad %6 %13 +%2401 = OpLoad %6 %15 +%2402 = OpIAdd %6 %2400 %2401 +%2403 = OpLoad %6 %16 +%2404 = OpIAdd %6 %2402 %2403 +%2405 = OpLoad %6 %20 +%2406 = OpIAdd %6 %2404 %2405 +OpStore %143 %2406 +OpBranch %2399 +%2399 = OpLabel +%2407 = OpLoad %1035 %1054 +%2408 = OpUGreaterThan %1057 %2407 %1072 +OpSelectionMerge %2410 None +OpBranchConditional %2408 %2409 %2410 +%2409 = OpLabel +%2411 = OpLoad %6 %13 +%2412 = OpLoad %6 %15 +%2413 = OpISub %6 %2411 %2412 +%2414 = OpLoad %6 %16 +%2415 = OpISub %6 %2413 %2414 +%2416 = OpLoad %6 %21 +%2417 = OpIAdd %6 %2415 %2416 +OpStore %144 %2417 +OpBranch %2410 +%2410 = OpLabel +%2418 = OpLoad %1035 %1054 +%2419 = OpINotEqual %1057 %2418 %1072 +OpSelectionMerge %2421 None +OpBranchConditional %2419 %2420 %2421 +%2420 = OpLabel +%2422 = OpLoad %6 %13 +%2423 = OpLoad %6 %15 +%2424 = OpISub %6 %2422 %2423 +%2425 = OpLoad %6 %16 +%2426 = OpIAdd %6 %2424 %2425 +%2427 = OpLoad %6 %22 +%2428 = OpIAdd %6 %2426 %2427 +OpStore %145 %2428 +OpBranch %2421 +%2421 = OpLabel +%2429 = OpLoad %1035 %1054 +%2430 = OpULessThan %1057 %2429 %1094 +OpSelectionMerge %2432 None +OpBranchConditional %2430 %2431 %2432 +%2431 = OpLabel +%2433 = OpLoad %6 %13 +%2434 = OpLoad %6 %15 +%2435 = OpISub %6 %2433 %2434 +%2436 = OpLoad %6 %17 +%2437 = OpISub %6 %2435 %2436 +%2438 = OpLoad %6 %18 +%2439 = OpIAdd %6 %2437 %2438 +OpStore %146 %2439 +OpBranch %2432 +%2432 = OpLabel +%2440 = OpLoad %1035 %1054 +%2441 = OpUGreaterThanEqual %1057 %2440 %1138 +OpSelectionMerge %2443 None +OpBranchConditional %2441 %2442 %2443 +%2442 = OpLabel +%2444 = OpLoad %6 %13 +%2445 = OpLoad %6 %16 +%2446 = OpISub %6 %2444 %2445 +OpStore %147 %2446 +OpBranch %2443 +%2443 = OpLabel +%2447 = OpLoad %1035 %1054 +%2448 = OpUGreaterThan %1057 %2447 %1138 +OpSelectionMerge %2450 None +OpBranchConditional %2448 %2449 %2450 +%2449 = OpLabel +%2451 = OpLoad %6 %15 +%2452 = OpLoad %6 %19 +%2453 = OpIAdd %6 %2451 %2452 +OpStore %148 %2453 +OpBranch %2450 +%2450 = OpLabel +%2454 = OpLoad %1035 %1054 +%2455 = OpULessThanEqual %1057 %2454 %1072 +OpSelectionMerge %2457 None +OpBranchConditional %2455 %2456 %2457 +%2456 = OpLabel +%2458 = OpLoad %6 %13 +%2459 = OpLoad %6 %15 +%2460 = OpIAdd %6 %2458 %2459 +%2461 = OpLoad %6 %17 +%2462 = OpISub %6 %2460 %2461 +%2463 = OpLoad %6 %19 +%2464 = OpIAdd %6 %2462 %2463 +OpStore %149 %2464 +OpBranch %2457 +%2457 = OpLabel +%2465 = OpLoad %1035 %1054 +%2466 = OpINotEqual %1057 %2465 %1094 +OpSelectionMerge %2468 None +OpBranchConditional %2466 %2467 %2468 +%2467 = OpLabel +%2469 = OpLoad %6 %13 +%2470 = OpLoad %6 %15 +%2471 = OpIAdd %6 %2469 %2470 +%2472 = OpLoad %6 %17 +%2473 = OpIAdd %6 %2471 %2472 +%2474 = OpLoad %6 %20 +%2475 = OpISub %6 %2473 %2474 +OpStore %150 %2475 +OpBranch %2468 +%2468 = OpLabel +%2476 = OpLoad %1035 %1054 +%2477 = OpINotEqual %1057 %2476 %1072 +OpSelectionMerge %2479 None +OpBranchConditional %2477 %2478 %2479 +%2478 = OpLabel +%2480 = OpLoad %6 %13 +%2481 = OpLoad %6 %15 +%2482 = OpISub %6 %2480 %2481 +%2483 = OpLoad %6 %17 +%2484 = OpIAdd %6 %2482 %2483 +%2485 = OpLoad %6 %21 +%2486 = OpISub %6 %2484 %2485 +OpStore %151 %2486 +OpBranch %2479 +%2479 = OpLabel +%2487 = OpLoad %1035 %1054 +%2488 = OpULessThan %1057 %2487 %1138 +OpSelectionMerge %2490 None +OpBranchConditional %2488 %2489 %2490 +%2489 = OpLabel +%2491 = OpLoad %6 %13 +%2492 = OpLoad %6 %15 +%2493 = OpIAdd %6 %2491 %2492 +%2494 = OpLoad %6 %17 +%2495 = OpISub %6 %2493 %2494 +%2496 = OpLoad %6 %22 +%2497 = OpIAdd %6 %2495 %2496 +OpStore %152 %2497 +OpBranch %2490 +%2490 = OpLabel +%2498 = OpLoad %1035 %1054 +%2499 = OpIEqual %1057 %2498 %1094 +OpSelectionMerge %2501 None +OpBranchConditional %2499 %2500 %2501 +%2500 = OpLabel +%2502 = OpLoad %6 %13 +%2503 = OpLoad %6 %15 +%2504 = OpISub %6 %2502 %2503 +%2505 = OpLoad %6 %18 +%2506 = OpIAdd %6 %2504 %2505 +%2507 = OpLoad %6 %19 +%2508 = OpISub %6 %2506 %2507 +OpStore %153 %2508 +OpBranch %2501 +%2501 = OpLabel +%2509 = OpLoad %1035 %1054 +%2510 = OpINotEqual %1057 %2509 %1056 +OpSelectionMerge %2512 None +OpBranchConditional %2510 %2511 %2512 +%2511 = OpLabel +%2513 = OpLoad %6 %13 +%2514 = OpLoad %6 %15 +%2515 = OpISub %6 %2513 %2514 +%2516 = OpLoad %6 %18 +%2517 = OpISub %6 %2515 %2516 +%2518 = OpLoad %6 %20 +%2519 = OpIAdd %6 %2517 %2518 +OpStore %154 %2519 +OpBranch %2512 +%2512 = OpLabel +%2520 = OpLoad %1035 %1054 +%2521 = OpULessThan %1057 %2520 %1138 +OpSelectionMerge %2523 None +OpBranchConditional %2521 %2522 %2523 +%2522 = OpLabel +%2524 = OpLoad %6 %13 +%2525 = OpLoad %6 %15 +%2526 = OpISub %6 %2524 %2525 +%2527 = OpLoad %6 %18 +%2528 = OpIAdd %6 %2526 %2527 +%2529 = OpLoad %6 %21 +%2530 = OpIAdd %6 %2528 %2529 +OpStore %155 %2530 +OpBranch %2523 +%2523 = OpLabel +%2531 = OpLoad %1035 %1054 +%2532 = OpULessThanEqual %1057 %2531 %1094 +OpSelectionMerge %2534 None +OpBranchConditional %2532 %2533 %2534 +%2533 = OpLabel +%2535 = OpLoad %6 %13 +%2536 = OpLoad %6 %15 +%2537 = OpIAdd %6 %2535 %2536 +%2538 = OpLoad %6 %18 +%2539 = OpISub %6 %2537 %2538 +%2540 = OpLoad %6 %22 +%2541 = OpIAdd %6 %2539 %2540 +OpStore %156 %2541 +OpBranch %2534 +%2534 = OpLabel +%2542 = OpLoad %1035 %1054 +%2543 = OpIEqual %1057 %2542 %1094 +OpSelectionMerge %2545 None +OpBranchConditional %2543 %2544 %2545 +%2544 = OpLabel +%2546 = OpLoad %6 %13 +%2547 = OpLoad %6 %15 +%2548 = OpIAdd %6 %2546 %2547 +%2549 = OpLoad %6 %19 +%2550 = OpIAdd %6 %2548 %2549 +%2551 = OpLoad %6 %20 +%2552 = OpISub %6 %2550 %2551 +OpStore %157 %2552 +OpBranch %2545 +%2545 = OpLabel +%2553 = OpLoad %1035 %1054 +%2554 = OpULessThanEqual %1057 %2553 %1094 +OpSelectionMerge %2556 None +OpBranchConditional %2554 %2555 %2556 +%2555 = OpLabel +%2557 = OpLoad %6 %13 +%2558 = OpLoad %6 %15 +%2559 = OpIAdd %6 %2557 %2558 +%2560 = OpLoad %6 %19 +%2561 = OpISub %6 %2559 %2560 +%2562 = OpLoad %6 %21 +%2563 = OpISub %6 %2561 %2562 +OpStore %158 %2563 +OpBranch %2556 +%2556 = OpLabel +%2564 = OpLoad %1035 %1054 +%2565 = OpIEqual %1057 %2564 %1138 +OpSelectionMerge %2567 None +OpBranchConditional %2565 %2566 %2567 +%2566 = OpLabel +%2568 = OpLoad %6 %15 +%2569 = OpLoad %6 %20 +%2570 = OpISub %6 %2568 %2569 +OpStore %159 %2570 +OpBranch %2567 +%2567 = OpLabel +%2571 = OpLoad %1035 %1054 +%2572 = OpIEqual %1057 %2571 %1056 +OpSelectionMerge %2574 None +OpBranchConditional %2572 %2573 %2574 +%2573 = OpLabel +%2575 = OpLoad %6 %13 +%2576 = OpLoad %6 %15 +%2577 = OpIAdd %6 %2575 %2576 +%2578 = OpLoad %6 %19 +%2579 = OpIAdd %6 %2577 %2578 +%2580 = OpLoad %6 %22 +%2581 = OpIAdd %6 %2579 %2580 +OpStore %160 %2581 +OpBranch %2574 +%2574 = OpLabel +%2582 = OpLoad %1035 %1054 +%2583 = OpULessThanEqual %1057 %2582 %1138 +OpSelectionMerge %2585 None +OpBranchConditional %2583 %2584 %2585 +%2584 = OpLabel +%2586 = OpLoad %6 %13 +%2587 = OpLoad %6 %15 +%2588 = OpIAdd %6 %2586 %2587 +%2589 = OpLoad %6 %20 +%2590 = OpIAdd %6 %2588 %2589 +%2591 = OpLoad %6 %21 +%2592 = OpISub %6 %2590 %2591 +OpStore %161 %2592 +OpBranch %2585 +%2585 = OpLabel +%2593 = OpLoad %1035 %1054 +%2594 = OpUGreaterThanEqual %1057 %2593 %1094 +OpSelectionMerge %2596 None +OpBranchConditional %2594 %2595 %2596 +%2595 = OpLabel +%2597 = OpLoad %6 %13 +%2598 = OpLoad %6 %15 +%2599 = OpIAdd %6 %2597 %2598 +%2600 = OpLoad %6 %20 +%2601 = OpIAdd %6 %2599 %2600 +%2602 = OpLoad %6 %22 +%2603 = OpIAdd %6 %2601 %2602 +OpStore %162 %2603 +OpBranch %2596 +%2596 = OpLabel +%2604 = OpLoad %1035 %1054 +%2605 = OpUGreaterThan %1057 %2604 %1138 +OpSelectionMerge %2607 None +OpBranchConditional %2605 %2606 %2607 +%2606 = OpLabel +%2608 = OpLoad %6 %13 +%2609 = OpLoad %6 %15 +%2610 = OpISub %6 %2608 %2609 +%2611 = OpLoad %6 %21 +%2612 = OpIAdd %6 %2610 %2611 +%2613 = OpLoad %6 %22 +%2614 = OpISub %6 %2612 %2613 +OpStore %163 %2614 +OpBranch %2607 +%2607 = OpLabel +%2615 = OpLoad %1035 %1054 +%2616 = OpULessThanEqual %1057 %2615 %1072 +OpSelectionMerge %2618 None +OpBranchConditional %2616 %2617 %2618 +%2617 = OpLabel +%2619 = OpLoad %6 %13 +%2620 = OpLoad %6 %16 +%2621 = OpISub %6 %2619 %2620 +%2622 = OpLoad %6 %17 +%2623 = OpISub %6 %2621 %2622 +%2624 = OpLoad %6 %18 +%2625 = OpISub %6 %2623 %2624 +OpStore %164 %2625 +OpBranch %2618 +%2618 = OpLabel +%2626 = OpLoad %1035 %1054 +%2627 = OpULessThan %1057 %2626 %1072 +OpSelectionMerge %2629 None +OpBranchConditional %2627 %2628 %2629 +%2628 = OpLabel +%2630 = OpLoad %6 %13 +%2631 = OpLoad %6 %16 +%2632 = OpISub %6 %2630 %2631 +%2633 = OpLoad %6 %17 +%2634 = OpIAdd %6 %2632 %2633 +%2635 = OpLoad %6 %19 +%2636 = OpIAdd %6 %2634 %2635 +OpStore %165 %2636 +OpBranch %2629 +%2629 = OpLabel +%2637 = OpLoad %1035 %1054 +%2638 = OpIEqual %1057 %2637 %1056 +OpSelectionMerge %2640 None +OpBranchConditional %2638 %2639 %2640 +%2639 = OpLabel +%2641 = OpLoad %6 %13 +%2642 = OpLoad %6 %16 +%2643 = OpIAdd %6 %2641 %2642 +%2644 = OpLoad %6 %17 +%2645 = OpIAdd %6 %2643 %2644 +%2646 = OpLoad %6 %20 +%2647 = OpIAdd %6 %2645 %2646 +OpStore %166 %2647 +OpBranch %2640 +%2640 = OpLabel +%2648 = OpLoad %1035 %1054 +%2649 = OpUGreaterThanEqual %1057 %2648 %1056 +OpSelectionMerge %2651 None +OpBranchConditional %2649 %2650 %2651 +%2650 = OpLabel +%2652 = OpLoad %6 %13 +%2653 = OpLoad %6 %16 +%2654 = OpIAdd %6 %2652 %2653 +%2655 = OpLoad %6 %17 +%2656 = OpISub %6 %2654 %2655 +%2657 = OpLoad %6 %21 +%2658 = OpIAdd %6 %2656 %2657 +OpStore %167 %2658 +OpBranch %2651 +%2651 = OpLabel +%2659 = OpLoad %1035 %1054 +%2660 = OpULessThan %1057 %2659 %1094 +OpSelectionMerge %2662 None +OpBranchConditional %2660 %2661 %2662 +%2661 = OpLabel +%2663 = OpLoad %6 %13 +%2664 = OpLoad %6 %16 +%2665 = OpIAdd %6 %2663 %2664 +%2666 = OpLoad %6 %17 +%2667 = OpISub %6 %2665 %2666 +%2668 = OpLoad %6 %22 +%2669 = OpISub %6 %2667 %2668 +OpStore %168 %2669 +OpBranch %2662 +%2662 = OpLabel +%2670 = OpLoad %1035 %1054 +%2671 = OpULessThanEqual %1057 %2670 %1094 +OpSelectionMerge %2673 None +OpBranchConditional %2671 %2672 %2673 +%2672 = OpLabel +%2674 = OpLoad %6 %13 +%2675 = OpLoad %6 %16 +%2676 = OpIAdd %6 %2674 %2675 +%2677 = OpLoad %6 %18 +%2678 = OpIAdd %6 %2676 %2677 +%2679 = OpLoad %6 %19 +%2680 = OpISub %6 %2678 %2679 +OpStore %169 %2680 +OpBranch %2673 +%2673 = OpLabel +%2681 = OpLoad %1035 %1054 +%2682 = OpULessThanEqual %1057 %2681 %1094 +OpSelectionMerge %2684 None +OpBranchConditional %2682 %2683 %2684 +%2683 = OpLabel +%2685 = OpLoad %6 %15 +%2686 = OpLoad %6 %21 +%2687 = OpISub %6 %2685 %2686 +OpStore %170 %2687 +OpBranch %2684 +%2684 = OpLabel +%2688 = OpLoad %1035 %1054 +%2689 = OpIEqual %1057 %2688 %1056 +OpSelectionMerge %2691 None +OpBranchConditional %2689 %2690 %2691 +%2690 = OpLabel +%2692 = OpLoad %6 %13 +%2693 = OpLoad %6 %16 +%2694 = OpIAdd %6 %2692 %2693 +%2695 = OpLoad %6 %18 +%2696 = OpIAdd %6 %2694 %2695 +%2697 = OpLoad %6 %20 +%2698 = OpISub %6 %2696 %2697 +OpStore %171 %2698 +OpBranch %2691 +%2691 = OpLabel +%2699 = OpLoad %1035 %1054 +%2700 = OpIEqual %1057 %2699 %1138 +OpSelectionMerge %2702 None +OpBranchConditional %2700 %2701 %2702 +%2701 = OpLabel +%2703 = OpLoad %6 %13 +%2704 = OpLoad %6 %16 +%2705 = OpISub %6 %2703 %2704 +%2706 = OpLoad %6 %18 +%2707 = OpIAdd %6 %2705 %2706 +%2708 = OpLoad %6 %21 +%2709 = OpIAdd %6 %2707 %2708 +OpStore %172 %2709 +OpBranch %2702 +%2702 = OpLabel +%2710 = OpLoad %1035 %1054 +%2711 = OpIEqual %1057 %2710 %1094 +OpSelectionMerge %2713 None +OpBranchConditional %2711 %2712 %2713 +%2712 = OpLabel +%2714 = OpLoad %6 %13 +%2715 = OpLoad %6 %16 +%2716 = OpIAdd %6 %2714 %2715 +%2717 = OpLoad %6 %18 +%2718 = OpISub %6 %2716 %2717 +%2719 = OpLoad %6 %22 +%2720 = OpIAdd %6 %2718 %2719 +OpStore %173 %2720 +OpBranch %2713 +%2713 = OpLabel +%2721 = OpLoad %1035 %1054 +%2722 = OpUGreaterThan %1057 %2721 %1056 +OpSelectionMerge %2724 None +OpBranchConditional %2722 %2723 %2724 +%2723 = OpLabel +%2725 = OpLoad %6 %13 +%2726 = OpLoad %6 %16 +%2727 = OpISub %6 %2725 %2726 +%2728 = OpLoad %6 %19 +%2729 = OpISub %6 %2727 %2728 +%2730 = OpLoad %6 %20 +%2731 = OpIAdd %6 %2729 %2730 +OpStore %174 %2731 +OpBranch %2724 +%2724 = OpLabel +%2732 = OpLoad %1035 %1054 +%2733 = OpUGreaterThanEqual %1057 %2732 %1094 +OpSelectionMerge %2735 None +OpBranchConditional %2733 %2734 %2735 +%2734 = OpLabel +%2736 = OpLoad %6 %13 +%2737 = OpLoad %6 %16 +%2738 = OpIAdd %6 %2736 %2737 +%2739 = OpLoad %6 %19 +%2740 = OpISub %6 %2738 %2739 +%2741 = OpLoad %6 %21 +%2742 = OpIAdd %6 %2740 %2741 +OpStore %175 %2742 +OpBranch %2735 +%2735 = OpLabel +%2743 = OpLoad %1035 %1054 +%2744 = OpIEqual %1057 %2743 %1094 +OpSelectionMerge %2746 None +OpBranchConditional %2744 %2745 %2746 +%2745 = OpLabel +%2747 = OpLoad %6 %13 +%2748 = OpLoad %6 %16 +%2749 = OpISub %6 %2747 %2748 +%2750 = OpLoad %6 %19 +%2751 = OpIAdd %6 %2749 %2750 +%2752 = OpLoad %6 %22 +%2753 = OpIAdd %6 %2751 %2752 +OpStore %176 %2753 +OpBranch %2746 +%2746 = OpLabel +%2754 = OpLoad %1035 %1054 +%2755 = OpIEqual %1057 %2754 %1072 +OpSelectionMerge %2757 None +OpBranchConditional %2755 %2756 %2757 +%2756 = OpLabel +%2758 = OpLoad %6 %13 +%2759 = OpLoad %6 %16 +%2760 = OpISub %6 %2758 %2759 +%2761 = OpLoad %6 %20 +%2762 = OpIAdd %6 %2760 %2761 +%2763 = OpLoad %6 %21 +%2764 = OpISub %6 %2762 %2763 +OpStore %177 %2764 +OpBranch %2757 +%2757 = OpLabel +%2765 = OpLoad %1035 %1054 +%2766 = OpUGreaterThanEqual %1057 %2765 %1072 +OpSelectionMerge %2768 None +OpBranchConditional %2766 %2767 %2768 +%2767 = OpLabel +%2769 = OpLoad %6 %13 +%2770 = OpLoad %6 %16 +%2771 = OpIAdd %6 %2769 %2770 +%2772 = OpLoad %6 %20 +%2773 = OpIAdd %6 %2771 %2772 +%2774 = OpLoad %6 %22 +%2775 = OpIAdd %6 %2773 %2774 +OpStore %178 %2775 +OpBranch %2768 +%2768 = OpLabel +%2776 = OpLoad %1035 %1054 +%2777 = OpUGreaterThan %1057 %2776 %1138 +OpSelectionMerge %2779 None +OpBranchConditional %2777 %2778 %2779 +%2778 = OpLabel +%2780 = OpLoad %6 %13 +%2781 = OpLoad %6 %16 +%2782 = OpISub %6 %2780 %2781 +%2783 = OpLoad %6 %21 +%2784 = OpIAdd %6 %2782 %2783 +%2785 = OpLoad %6 %22 +%2786 = OpIAdd %6 %2784 %2785 +OpStore %179 %2786 +OpBranch %2779 +%2779 = OpLabel +%2787 = OpLoad %1035 %1054 +%2788 = OpULessThanEqual %1057 %2787 %1094 +OpSelectionMerge %2790 None +OpBranchConditional %2788 %2789 %2790 +%2789 = OpLabel +%2791 = OpLoad %6 %13 +%2792 = OpLoad %6 %17 +%2793 = OpIAdd %6 %2791 %2792 +%2794 = OpLoad %6 %18 +%2795 = OpIAdd %6 %2793 %2794 +%2796 = OpLoad %6 %19 +%2797 = OpISub %6 %2795 %2796 +OpStore %180 %2797 +OpBranch %2790 +%2790 = OpLabel +%2798 = OpLoad %1035 %1054 +%2799 = OpUGreaterThan %1057 %2798 %1094 +OpSelectionMerge %2801 None +OpBranchConditional %2799 %2800 %2801 +%2800 = OpLabel +%2802 = OpLoad %6 %15 +%2803 = OpLoad %6 %22 +%2804 = OpIAdd %6 %2802 %2803 +OpStore %181 %2804 +OpBranch %2801 +%2801 = OpLabel +%2805 = OpLoad %1035 %1054 +%2806 = OpINotEqual %1057 %2805 %1072 +OpSelectionMerge %2808 None +OpBranchConditional %2806 %2807 %2808 +%2807 = OpLabel +%2809 = OpLoad %6 %13 +%2810 = OpLoad %6 %17 +%2811 = OpIAdd %6 %2809 %2810 +%2812 = OpLoad %6 %18 +%2813 = OpIAdd %6 %2811 %2812 +%2814 = OpLoad %6 %20 +%2815 = OpIAdd %6 %2813 %2814 +OpStore %182 %2815 +OpBranch %2808 +%2808 = OpLabel +%2816 = OpLoad %1035 %1054 +%2817 = OpULessThan %1057 %2816 %1072 +OpSelectionMerge %2819 None +OpBranchConditional %2817 %2818 %2819 +%2818 = OpLabel +%2820 = OpLoad %6 %13 +%2821 = OpLoad %6 %17 +%2822 = OpIAdd %6 %2820 %2821 +%2823 = OpLoad %6 %18 +%2824 = OpIAdd %6 %2822 %2823 +%2825 = OpLoad %6 %21 +%2826 = OpISub %6 %2824 %2825 +OpStore %183 %2826 +OpBranch %2819 +%2819 = OpLabel +%2827 = OpLoad %1035 %1054 +%2828 = OpINotEqual %1057 %2827 %1072 +OpSelectionMerge %2830 None +OpBranchConditional %2828 %2829 %2830 +%2829 = OpLabel +%2831 = OpLoad %6 %13 +%2832 = OpLoad %6 %17 +%2833 = OpIAdd %6 %2831 %2832 +%2834 = OpLoad %6 %18 +%2835 = OpISub %6 %2833 %2834 +%2836 = OpLoad %6 %22 +%2837 = OpISub %6 %2835 %2836 +OpStore %184 %2837 +OpBranch %2830 +%2830 = OpLabel +%2838 = OpLoad %1035 %1054 +%2839 = OpULessThanEqual %1057 %2838 %1072 +OpSelectionMerge %2841 None +OpBranchConditional %2839 %2840 %2841 +%2840 = OpLabel +%2842 = OpLoad %6 %13 +%2843 = OpLoad %6 %17 +%2844 = OpISub %6 %2842 %2843 +%2845 = OpLoad %6 %19 +%2846 = OpIAdd %6 %2844 %2845 +%2847 = OpLoad %6 %20 +%2848 = OpIAdd %6 %2846 %2847 +OpStore %185 %2848 +OpBranch %2841 +%2841 = OpLabel +%2849 = OpLoad %1035 %1054 +%2850 = OpUGreaterThan %1057 %2849 %1072 +OpSelectionMerge %2852 None +OpBranchConditional %2850 %2851 %2852 +%2851 = OpLabel +%2853 = OpLoad %6 %13 +%2854 = OpLoad %6 %17 +%2855 = OpISub %6 %2853 %2854 +%2856 = OpLoad %6 %19 +%2857 = OpIAdd %6 %2855 %2856 +%2858 = OpLoad %6 %21 +%2859 = OpISub %6 %2857 %2858 +OpStore %186 %2859 +OpBranch %2852 +%2852 = OpLabel +%2860 = OpLoad %1035 %1054 +%2861 = OpIEqual %1057 %2860 %1138 +OpSelectionMerge %2863 None +OpBranchConditional %2861 %2862 %2863 +%2862 = OpLabel +%2864 = OpLoad %6 %13 +%2865 = OpLoad %6 %17 +%2866 = OpIAdd %6 %2864 %2865 +%2867 = OpLoad %6 %19 +%2868 = OpISub %6 %2866 %2867 +%2869 = OpLoad %6 %22 +%2870 = OpIAdd %6 %2868 %2869 +OpStore %187 %2870 +OpBranch %2863 +%2863 = OpLabel +%2871 = OpLoad %1035 %1054 +%2872 = OpUGreaterThanEqual %1057 %2871 %1072 +OpSelectionMerge %2874 None +OpBranchConditional %2872 %2873 %2874 +%2873 = OpLabel +%2875 = OpLoad %6 %13 +%2876 = OpLoad %6 %17 +%2877 = OpISub %6 %2875 %2876 +%2878 = OpLoad %6 %20 +%2879 = OpISub %6 %2877 %2878 +%2880 = OpLoad %6 %21 +%2881 = OpISub %6 %2879 %2880 +OpStore %188 %2881 +OpBranch %2874 +%2874 = OpLabel +%2882 = OpLoad %1035 %1054 +%2883 = OpIEqual %1057 %2882 %1094 +OpSelectionMerge %2885 None +OpBranchConditional %2883 %2884 %2885 +%2884 = OpLabel +%2886 = OpLoad %6 %13 +%2887 = OpLoad %6 %17 +%2888 = OpISub %6 %2886 %2887 +%2889 = OpLoad %6 %20 +%2890 = OpISub %6 %2888 %2889 +%2891 = OpLoad %6 %22 +%2892 = OpIAdd %6 %2890 %2891 +OpStore %189 %2892 +OpBranch %2885 +%2885 = OpLabel +%2893 = OpLoad %1035 %1054 +%2894 = OpULessThan %1057 %2893 %1094 +OpSelectionMerge %2896 None +OpBranchConditional %2894 %2895 %2896 +%2895 = OpLabel +%2897 = OpLoad %6 %13 +%2898 = OpLoad %6 %17 +%2899 = OpIAdd %6 %2897 %2898 +%2900 = OpLoad %6 %21 +%2901 = OpISub %6 %2899 %2900 +%2902 = OpLoad %6 %22 +%2903 = OpIAdd %6 %2901 %2902 +OpStore %190 %2903 +OpBranch %2896 +%2896 = OpLabel +%2904 = OpLoad %1035 %1054 +%2905 = OpINotEqual %1057 %2904 %1072 +OpSelectionMerge %2907 None +OpBranchConditional %2905 %2906 %2907 +%2906 = OpLabel +%2908 = OpLoad %6 %13 +%2909 = OpLoad %6 %18 +%2910 = OpISub %6 %2908 %2909 +%2911 = OpLoad %6 %19 +%2912 = OpIAdd %6 %2910 %2911 +%2913 = OpLoad %6 %20 +%2914 = OpISub %6 %2912 %2913 +OpStore %191 %2914 +OpBranch %2907 +%2907 = OpLabel +%2915 = OpLoad %1035 %1054 +%2916 = OpUGreaterThanEqual %1057 %2915 %1056 +OpSelectionMerge %2918 None +OpBranchConditional %2916 %2917 %2918 +%2917 = OpLabel +%2919 = OpLoad %6 %16 +%2920 = OpLoad %6 %17 +%2921 = OpISub %6 %2919 %2920 +OpStore %192 %2921 +OpBranch %2918 +%2918 = OpLabel +%2922 = OpLoad %1035 %1054 +%2923 = OpUGreaterThanEqual %1057 %2922 %1094 +OpSelectionMerge %2925 None +OpBranchConditional %2923 %2924 %2925 +%2924 = OpLabel +%2926 = OpLoad %6 %13 +%2927 = OpLoad %6 %18 +%2928 = OpISub %6 %2926 %2927 +%2929 = OpLoad %6 %19 +%2930 = OpISub %6 %2928 %2929 +%2931 = OpLoad %6 %21 +%2932 = OpIAdd %6 %2930 %2931 +OpStore %193 %2932 +OpBranch %2925 +%2925 = OpLabel +%2933 = OpLoad %1035 %1054 +%2934 = OpULessThan %1057 %2933 %1056 +OpSelectionMerge %2936 None +OpBranchConditional %2934 %2935 %2936 +%2935 = OpLabel +%2937 = OpLoad %6 %13 +%2938 = OpLoad %6 %18 +%2939 = OpISub %6 %2937 %2938 +%2940 = OpLoad %6 %19 +%2941 = OpIAdd %6 %2939 %2940 +%2942 = OpLoad %6 %22 +%2943 = OpISub %6 %2941 %2942 +OpStore %194 %2943 +OpBranch %2936 +%2936 = OpLabel +%2944 = OpLoad %1035 %1054 +%2945 = OpUGreaterThan %1057 %2944 %1138 +OpSelectionMerge %2947 None +OpBranchConditional %2945 %2946 %2947 +%2946 = OpLabel +%2948 = OpLoad %6 %13 +%2949 = OpLoad %6 %18 +%2950 = OpIAdd %6 %2948 %2949 +%2951 = OpLoad %6 %20 +%2952 = OpISub %6 %2950 %2951 +%2953 = OpLoad %6 %21 +%2954 = OpIAdd %6 %2952 %2953 +OpStore %195 %2954 +OpBranch %2947 +%2947 = OpLabel +%2955 = OpLoad %1035 %1054 +%2956 = OpIEqual %1057 %2955 %1056 +OpSelectionMerge %2958 None +OpBranchConditional %2956 %2957 %2958 +%2957 = OpLabel +%2959 = OpLoad %6 %13 +%2960 = OpLoad %6 %18 +%2961 = OpIAdd %6 %2959 %2960 +%2962 = OpLoad %6 %20 +%2963 = OpIAdd %6 %2961 %2962 +%2964 = OpLoad %6 %22 +%2965 = OpISub %6 %2963 %2964 +OpStore %196 %2965 +OpBranch %2958 +%2958 = OpLabel +%2966 = OpLoad %1035 %1054 +%2967 = OpULessThanEqual %1057 %2966 %1072 +OpSelectionMerge %2969 None +OpBranchConditional %2967 %2968 %2969 +%2968 = OpLabel +%2970 = OpLoad %6 %13 +%2971 = OpLoad %6 %18 +%2972 = OpIAdd %6 %2970 %2971 +%2973 = OpLoad %6 %21 +%2974 = OpISub %6 %2972 %2973 +%2975 = OpLoad %6 %22 +%2976 = OpIAdd %6 %2974 %2975 +OpStore %197 %2976 +OpBranch %2969 +%2969 = OpLabel +%2977 = OpLoad %1035 %1054 +%2978 = OpUGreaterThan %1057 %2977 %1056 +OpSelectionMerge %2980 None +OpBranchConditional %2978 %2979 %2980 +%2979 = OpLabel +%2981 = OpLoad %6 %13 +%2982 = OpLoad %6 %19 +%2983 = OpISub %6 %2981 %2982 +%2984 = OpLoad %6 %20 +%2985 = OpISub %6 %2983 %2984 +%2986 = OpLoad %6 %21 +%2987 = OpIAdd %6 %2985 %2986 +OpStore %198 %2987 +OpBranch %2980 +%2980 = OpLabel +%2988 = OpLoad %1035 %1054 +%2989 = OpULessThan %1057 %2988 %1094 +OpSelectionMerge %2991 None +OpBranchConditional %2989 %2990 %2991 +%2990 = OpLabel +%2992 = OpLoad %6 %13 +%2993 = OpLoad %6 %19 +%2994 = OpIAdd %6 %2992 %2993 +%2995 = OpLoad %6 %20 +%2996 = OpIAdd %6 %2994 %2995 +%2997 = OpLoad %6 %22 +%2998 = OpIAdd %6 %2996 %2997 +OpStore %199 %2998 +OpBranch %2991 +%2991 = OpLabel +%2999 = OpLoad %1035 %1054 +%3000 = OpUGreaterThanEqual %1057 %2999 %1138 +OpSelectionMerge %3002 None +OpBranchConditional %3000 %3001 %3002 +%3001 = OpLabel +%3003 = OpLoad %6 %13 +%3004 = OpLoad %6 %19 +%3005 = OpISub %6 %3003 %3004 +%3006 = OpLoad %6 %21 +%3007 = OpIAdd %6 %3005 %3006 +%3008 = OpLoad %6 %22 +%3009 = OpISub %6 %3007 %3008 +OpStore %200 %3009 +OpBranch %3002 +%3002 = OpLabel +%3010 = OpLoad %1035 %1054 +%3011 = OpULessThanEqual %1057 %3010 %1072 +OpSelectionMerge %3013 None +OpBranchConditional %3011 %3012 %3013 +%3012 = OpLabel +%3014 = OpLoad %6 %13 +%3015 = OpLoad %6 %20 +%3016 = OpISub %6 %3014 %3015 +%3017 = OpLoad %6 %21 +%3018 = OpISub %6 %3016 %3017 +%3019 = OpLoad %6 %22 +%3020 = OpISub %6 %3018 %3019 +OpStore %201 %3020 +OpBranch %3013 +%3013 = OpLabel +%3021 = OpLoad %1035 %1054 +%3022 = OpULessThanEqual %1057 %3021 %1056 +OpSelectionMerge %3024 None +OpBranchConditional %3022 %3023 %3024 +%3023 = OpLabel +%3025 = OpLoad %6 %14 +%3026 = OpLoad %6 %15 +%3027 = OpISub %6 %3025 %3026 +%3028 = OpLoad %6 %16 +%3029 = OpISub %6 %3027 %3028 +%3030 = OpLoad %6 %17 +%3031 = OpISub %6 %3029 %3030 +OpStore %202 %3031 +OpBranch %3024 +%3024 = OpLabel +%3032 = OpLoad %1035 %1054 +%3033 = OpINotEqual %1057 %3032 %1138 +OpSelectionMerge %3035 None +OpBranchConditional %3033 %3034 %3035 +%3034 = OpLabel +%3036 = OpLoad %6 %16 +%3037 = OpLoad %6 %18 +%3038 = OpISub %6 %3036 %3037 +OpStore %203 %3038 +OpBranch %3035 +%3035 = OpLabel +%3039 = OpLoad %1035 %1054 +%3040 = OpIEqual %1057 %3039 %1072 +OpSelectionMerge %3042 None +OpBranchConditional %3040 %3041 %3042 +%3041 = OpLabel +%3043 = OpLoad %6 %14 +%3044 = OpLoad %6 %15 +%3045 = OpIAdd %6 %3043 %3044 +%3046 = OpLoad %6 %16 +%3047 = OpISub %6 %3045 %3046 +%3048 = OpLoad %6 %18 +%3049 = OpIAdd %6 %3047 %3048 +OpStore %204 %3049 +OpBranch %3042 +%3042 = OpLabel +%3050 = OpLoad %1035 %1054 +%3051 = OpUGreaterThanEqual %1057 %3050 %1138 +OpSelectionMerge %3053 None +OpBranchConditional %3051 %3052 %3053 +%3052 = OpLabel +%3054 = OpLoad %6 %14 +%3055 = OpLoad %6 %15 +%3056 = OpISub %6 %3054 %3055 +%3057 = OpLoad %6 %16 +%3058 = OpIAdd %6 %3056 %3057 +%3059 = OpLoad %6 %19 +%3060 = OpIAdd %6 %3058 %3059 +OpStore %205 %3060 +OpBranch %3053 +%3053 = OpLabel +%3061 = OpLoad %1035 %1054 +%3062 = OpUGreaterThanEqual %1057 %3061 %1056 +OpSelectionMerge %3064 None +OpBranchConditional %3062 %3063 %3064 +%3063 = OpLabel +%3065 = OpLoad %6 %14 +%3066 = OpLoad %6 %15 +%3067 = OpISub %6 %3065 %3066 +%3068 = OpLoad %6 %16 +%3069 = OpISub %6 %3067 %3068 +%3070 = OpLoad %6 %20 +%3071 = OpISub %6 %3069 %3070 +OpStore %206 %3071 +OpBranch %3064 +%3064 = OpLabel +%3072 = OpLoad %1035 %1054 +%3073 = OpULessThan %1057 %3072 %1056 +OpSelectionMerge %3075 None +OpBranchConditional %3073 %3074 %3075 +%3074 = OpLabel +%3076 = OpLoad %6 %14 +%3077 = OpLoad %6 %15 +%3078 = OpIAdd %6 %3076 %3077 +%3079 = OpLoad %6 %16 +%3080 = OpISub %6 %3078 %3079 +%3081 = OpLoad %6 %21 +%3082 = OpISub %6 %3080 %3081 +OpStore %207 %3082 +OpBranch %3075 +%3075 = OpLabel +%3083 = OpLoad %1035 %1054 +%3084 = OpUGreaterThanEqual %1057 %3083 %1056 +OpSelectionMerge %3086 None +OpBranchConditional %3084 %3085 %3086 +%3085 = OpLabel +%3087 = OpLoad %6 %14 +%3088 = OpLoad %6 %15 +%3089 = OpISub %6 %3087 %3088 +%3090 = OpLoad %6 %16 +%3091 = OpISub %6 %3089 %3090 +%3092 = OpLoad %6 %22 +%3093 = OpISub %6 %3091 %3092 +OpStore %208 %3093 +OpBranch %3086 +%3086 = OpLabel +%3094 = OpLoad %1035 %1054 +%3095 = OpUGreaterThanEqual %1057 %3094 %1056 +OpSelectionMerge %3097 None +OpBranchConditional %3095 %3096 %3097 +%3096 = OpLabel +%3098 = OpLoad %6 %14 +%3099 = OpLoad %6 %15 +%3100 = OpISub %6 %3098 %3099 +%3101 = OpLoad %6 %17 +%3102 = OpISub %6 %3100 %3101 +%3103 = OpLoad %6 %18 +%3104 = OpIAdd %6 %3102 %3103 +OpStore %209 %3104 +OpBranch %3097 +%3097 = OpLabel +%3105 = OpLoad %1035 %1054 +%3106 = OpINotEqual %1057 %3105 %1056 +OpSelectionMerge %3108 None +OpBranchConditional %3106 %3107 %3108 +%3107 = OpLabel +%3109 = OpLoad %6 %14 +%3110 = OpLoad %6 %15 +%3111 = OpIAdd %6 %3109 %3110 +%3112 = OpLoad %6 %17 +%3113 = OpISub %6 %3111 %3112 +%3114 = OpLoad %6 %19 +%3115 = OpISub %6 %3113 %3114 +OpStore %210 %3115 +OpBranch %3108 +%3108 = OpLabel +%3116 = OpLoad %1035 %1054 +%3117 = OpULessThan %1057 %3116 %1094 +OpSelectionMerge %3119 None +OpBranchConditional %3117 %3118 %3119 +%3118 = OpLabel +%3120 = OpLoad %6 %14 +%3121 = OpLoad %6 %15 +%3122 = OpISub %6 %3120 %3121 +%3123 = OpLoad %6 %17 +%3124 = OpISub %6 %3122 %3123 +%3125 = OpLoad %6 %20 +%3126 = OpISub %6 %3124 %3125 +OpStore %211 %3126 +OpBranch %3119 +%3119 = OpLabel +%3127 = OpLoad %1035 %1054 +%3128 = OpIEqual %1057 %3127 %1072 +OpSelectionMerge %3130 None +OpBranchConditional %3128 %3129 %3130 +%3129 = OpLabel +%3131 = OpLoad %6 %14 +%3132 = OpLoad %6 %15 +%3133 = OpIAdd %6 %3131 %3132 +%3134 = OpLoad %6 %17 +%3135 = OpIAdd %6 %3133 %3134 +%3136 = OpLoad %6 %21 +%3137 = OpISub %6 %3135 %3136 +OpStore %212 %3137 +OpBranch %3130 +%3130 = OpLabel +%3138 = OpLoad %1035 %1054 +%3139 = OpUGreaterThan %1057 %3138 %1072 +OpSelectionMerge %3141 None +OpBranchConditional %3139 %3140 %3141 +%3140 = OpLabel +%3142 = OpLoad %6 %14 +%3143 = OpLoad %6 %15 +%3144 = OpISub %6 %3142 %3143 +%3145 = OpLoad %6 %17 +%3146 = OpIAdd %6 %3144 %3145 +%3147 = OpLoad %6 %22 +%3148 = OpIAdd %6 %3146 %3147 +OpStore %213 %3148 +OpBranch %3141 +%3141 = OpLabel +%3149 = OpLoad %1035 %1054 +%3150 = OpULessThan %1057 %3149 %1138 +OpSelectionMerge %3152 None +OpBranchConditional %3150 %3151 %3152 +%3151 = OpLabel +%3153 = OpLoad %6 %16 +%3154 = OpLoad %6 %19 +%3155 = OpISub %6 %3153 %3154 +OpStore %214 %3155 +OpBranch %3152 +%3152 = OpLabel +%3156 = OpLoad %1035 %1054 +%3157 = OpUGreaterThan %1057 %3156 %1056 +OpSelectionMerge %3159 None +OpBranchConditional %3157 %3158 %3159 +%3158 = OpLabel +%3160 = OpLoad %6 %14 +%3161 = OpLoad %6 %15 +%3162 = OpIAdd %6 %3160 %3161 +%3163 = OpLoad %6 %18 +%3164 = OpIAdd %6 %3162 %3163 +%3165 = OpLoad %6 %19 +%3166 = OpIAdd %6 %3164 %3165 +OpStore %215 %3166 +OpBranch %3159 +%3159 = OpLabel +%3167 = OpLoad %1035 %1054 +%3168 = OpULessThan %1057 %3167 %1094 +OpSelectionMerge %3170 None +OpBranchConditional %3168 %3169 %3170 +%3169 = OpLabel +%3171 = OpLoad %6 %14 +%3172 = OpLoad %6 %15 +%3173 = OpIAdd %6 %3171 %3172 +%3174 = OpLoad %6 %18 +%3175 = OpIAdd %6 %3173 %3174 +%3176 = OpLoad %6 %20 +%3177 = OpIAdd %6 %3175 %3176 +OpStore %216 %3177 +OpBranch %3170 +%3170 = OpLabel +%3178 = OpLoad %1035 %1054 +%3179 = OpULessThanEqual %1057 %3178 %1072 +OpSelectionMerge %3181 None +OpBranchConditional %3179 %3180 %3181 +%3180 = OpLabel +%3182 = OpLoad %6 %14 +%3183 = OpLoad %6 %15 +%3184 = OpISub %6 %3182 %3183 +%3185 = OpLoad %6 %18 +%3186 = OpIAdd %6 %3184 %3185 +%3187 = OpLoad %6 %21 +%3188 = OpISub %6 %3186 %3187 +OpStore %217 %3188 +OpBranch %3181 +%3181 = OpLabel +%3189 = OpLoad %1035 %1054 +%3190 = OpIEqual %1057 %3189 %1056 +OpSelectionMerge %3192 None +OpBranchConditional %3190 %3191 %3192 +%3191 = OpLabel +%3193 = OpLoad %6 %14 +%3194 = OpLoad %6 %15 +%3195 = OpISub %6 %3193 %3194 +%3196 = OpLoad %6 %18 +%3197 = OpISub %6 %3195 %3196 +%3198 = OpLoad %6 %22 +%3199 = OpIAdd %6 %3197 %3198 +OpStore %218 %3199 +OpBranch %3192 +%3192 = OpLabel +%3200 = OpLoad %1035 %1054 +%3201 = OpINotEqual %1057 %3200 %1072 +OpSelectionMerge %3203 None +OpBranchConditional %3201 %3202 %3203 +%3202 = OpLabel +%3204 = OpLoad %6 %14 +%3205 = OpLoad %6 %15 +%3206 = OpISub %6 %3204 %3205 +%3207 = OpLoad %6 %19 +%3208 = OpIAdd %6 %3206 %3207 +%3209 = OpLoad %6 %20 +%3210 = OpISub %6 %3208 %3209 +OpStore %219 %3210 +OpBranch %3203 +%3203 = OpLabel +%3211 = OpLoad %1035 %1054 +%3212 = OpINotEqual %1057 %3211 %1072 +OpSelectionMerge %3214 None +OpBranchConditional %3212 %3213 %3214 +%3213 = OpLabel +%3215 = OpLoad %6 %14 +%3216 = OpLoad %6 %15 +%3217 = OpISub %6 %3215 %3216 +%3218 = OpLoad %6 %19 +%3219 = OpIAdd %6 %3217 %3218 +%3220 = OpLoad %6 %21 +%3221 = OpIAdd %6 %3219 %3220 +OpStore %220 %3221 +OpBranch %3214 +%3214 = OpLabel +%3222 = OpLoad %1035 %1054 +%3223 = OpULessThanEqual %1057 %3222 %1056 +OpSelectionMerge %3225 None +OpBranchConditional %3223 %3224 %3225 +%3224 = OpLabel +%3226 = OpLoad %6 %14 +%3227 = OpLoad %6 %15 +%3228 = OpISub %6 %3226 %3227 +%3229 = OpLoad %6 %19 +%3230 = OpISub %6 %3228 %3229 +%3231 = OpLoad %6 %22 +%3232 = OpIAdd %6 %3230 %3231 +OpStore %221 %3232 +OpBranch %3225 +%3225 = OpLabel +%3233 = OpLoad %1035 %1054 +%3234 = OpIEqual %1057 %3233 %1056 +OpSelectionMerge %3236 None +OpBranchConditional %3234 %3235 %3236 +%3235 = OpLabel +%3237 = OpLoad %6 %14 +%3238 = OpLoad %6 %15 +%3239 = OpISub %6 %3237 %3238 +%3240 = OpLoad %6 %20 +%3241 = OpISub %6 %3239 %3240 +%3242 = OpLoad %6 %21 +%3243 = OpIAdd %6 %3241 %3242 +OpStore %222 %3243 +OpBranch %3236 +%3236 = OpLabel +%3244 = OpLoad %1035 %1054 +%3245 = OpINotEqual %1057 %3244 %1094 +OpSelectionMerge %3247 None +OpBranchConditional %3245 %3246 %3247 +%3246 = OpLabel +%3248 = OpLoad %6 %14 +%3249 = OpLoad %6 %15 +%3250 = OpIAdd %6 %3248 %3249 +%3251 = OpLoad %6 %20 +%3252 = OpIAdd %6 %3250 %3251 +%3253 = OpLoad %6 %22 +%3254 = OpISub %6 %3252 %3253 +OpStore %223 %3254 +OpBranch %3247 +%3247 = OpLabel +%3255 = OpLoad %1035 %1054 +%3256 = OpINotEqual %1057 %3255 %1056 +OpSelectionMerge %3258 None +OpBranchConditional %3256 %3257 %3258 +%3257 = OpLabel +%3259 = OpLoad %6 %14 +%3260 = OpLoad %6 %15 +%3261 = OpISub %6 %3259 %3260 +%3262 = OpLoad %6 %21 +%3263 = OpISub %6 %3261 %3262 +%3264 = OpLoad %6 %22 +%3265 = OpISub %6 %3263 %3264 +OpStore %224 %3265 +OpBranch %3258 +%3258 = OpLabel +%3266 = OpLoad %1035 %1054 +%3267 = OpUGreaterThan %1057 %3266 %1094 +OpSelectionMerge %3269 None +OpBranchConditional %3267 %3268 %3269 +%3268 = OpLabel +%3270 = OpLoad %6 %16 +%3271 = OpLoad %6 %20 +%3272 = OpIAdd %6 %3270 %3271 +OpStore %225 %3272 +OpBranch %3269 +%3269 = OpLabel +%3273 = OpLoad %1035 %1054 +%3274 = OpULessThan %1057 %3273 %1072 +OpSelectionMerge %3276 None +OpBranchConditional %3274 %3275 %3276 +%3275 = OpLabel +%3277 = OpLoad %6 %14 +%3278 = OpLoad %6 %16 +%3279 = OpIAdd %6 %3277 %3278 +%3280 = OpLoad %6 %17 +%3281 = OpISub %6 %3279 %3280 +%3282 = OpLoad %6 %18 +%3283 = OpIAdd %6 %3281 %3282 +OpStore %226 %3283 +OpBranch %3276 +%3276 = OpLabel +%3284 = OpLoad %1035 %1054 +%3285 = OpUGreaterThan %1057 %3284 %1094 +OpSelectionMerge %3287 None +OpBranchConditional %3285 %3286 %3287 +%3286 = OpLabel +%3288 = OpLoad %6 %14 +%3289 = OpLoad %6 %16 +%3290 = OpIAdd %6 %3288 %3289 +%3291 = OpLoad %6 %17 +%3292 = OpIAdd %6 %3290 %3291 +%3293 = OpLoad %6 %19 +%3294 = OpIAdd %6 %3292 %3293 +OpStore %227 %3294 +OpBranch %3287 +%3287 = OpLabel +%3295 = OpLoad %1035 %1054 +%3296 = OpIEqual %1057 %3295 %1072 +OpSelectionMerge %3298 None +OpBranchConditional %3296 %3297 %3298 +%3297 = OpLabel +%3299 = OpLoad %6 %14 +%3300 = OpLoad %6 %16 +%3301 = OpISub %6 %3299 %3300 +%3302 = OpLoad %6 %17 +%3303 = OpIAdd %6 %3301 %3302 +%3304 = OpLoad %6 %20 +%3305 = OpISub %6 %3303 %3304 +OpStore %228 %3305 +OpBranch %3298 +%3298 = OpLabel +%3306 = OpLoad %1035 %1054 +%3307 = OpUGreaterThan %1057 %3306 %1094 +OpSelectionMerge %3309 None +OpBranchConditional %3307 %3308 %3309 +%3308 = OpLabel +%3310 = OpLoad %6 %14 +%3311 = OpLoad %6 %16 +%3312 = OpIAdd %6 %3310 %3311 +%3313 = OpLoad %6 %17 +%3314 = OpIAdd %6 %3312 %3313 +%3315 = OpLoad %6 %21 +%3316 = OpIAdd %6 %3314 %3315 +OpStore %229 %3316 +OpBranch %3309 +%3309 = OpLabel +%3317 = OpLoad %1035 %1054 +%3318 = OpUGreaterThan %1057 %3317 %1138 +OpSelectionMerge %3320 None +OpBranchConditional %3318 %3319 %3320 +%3319 = OpLabel +%3321 = OpLoad %6 %14 +%3322 = OpLoad %6 %16 +%3323 = OpIAdd %6 %3321 %3322 +%3324 = OpLoad %6 %17 +%3325 = OpISub %6 %3323 %3324 +%3326 = OpLoad %6 %22 +%3327 = OpISub %6 %3325 %3326 +OpStore %230 %3327 +OpBranch %3320 +%3320 = OpLabel +%3328 = OpLoad %1035 %1054 +%3329 = OpULessThan %1057 %3328 %1072 +OpSelectionMerge %3331 None +OpBranchConditional %3329 %3330 %3331 +%3330 = OpLabel +%3332 = OpLoad %6 %14 +%3333 = OpLoad %6 %16 +%3334 = OpIAdd %6 %3332 %3333 +%3335 = OpLoad %6 %18 +%3336 = OpISub %6 %3334 %3335 +%3337 = OpLoad %6 %19 +%3338 = OpISub %6 %3336 %3337 +OpStore %231 %3338 +OpBranch %3331 +%3331 = OpLabel +%3339 = OpLoad %1035 %1054 +%3340 = OpUGreaterThanEqual %1057 %3339 %1094 +OpSelectionMerge %3342 None +OpBranchConditional %3340 %3341 %3342 +%3341 = OpLabel +%3343 = OpLoad %6 %14 +%3344 = OpLoad %6 %16 +%3345 = OpISub %6 %3343 %3344 +%3346 = OpLoad %6 %18 +%3347 = OpIAdd %6 %3345 %3346 +%3348 = OpLoad %6 %20 +%3349 = OpISub %6 %3347 %3348 +OpStore %232 %3349 +OpBranch %3342 +%3342 = OpLabel +%3350 = OpLoad %1035 %1054 +%3351 = OpIEqual %1057 %3350 %1138 +OpSelectionMerge %3353 None +OpBranchConditional %3351 %3352 %3353 +%3352 = OpLabel +%3354 = OpLoad %6 %14 +%3355 = OpLoad %6 %16 +%3356 = OpISub %6 %3354 %3355 +%3357 = OpLoad %6 %18 +%3358 = OpIAdd %6 %3356 %3357 +%3359 = OpLoad %6 %21 +%3360 = OpIAdd %6 %3358 %3359 +OpStore %233 %3360 +OpBranch %3353 +%3353 = OpLabel +%3361 = OpLoad %1035 %1054 +%3362 = OpULessThanEqual %1057 %3361 %1094 +OpSelectionMerge %3364 None +OpBranchConditional %3362 %3363 %3364 +%3363 = OpLabel +%3365 = OpLoad %6 %14 +%3366 = OpLoad %6 %16 +%3367 = OpIAdd %6 %3365 %3366 +%3368 = OpLoad %6 %18 +%3369 = OpIAdd %6 %3367 %3368 +%3370 = OpLoad %6 %22 +%3371 = OpISub %6 %3369 %3370 +OpStore %234 %3371 +OpBranch %3364 +%3364 = OpLabel +%3372 = OpLoad %1035 %1054 +%3373 = OpUGreaterThanEqual %1057 %3372 %1094 +OpSelectionMerge %3375 None +OpBranchConditional %3373 %3374 %3375 +%3374 = OpLabel +%3376 = OpLoad %6 %14 +%3377 = OpLoad %6 %16 +%3378 = OpIAdd %6 %3376 %3377 +%3379 = OpLoad %6 %19 +%3380 = OpIAdd %6 %3378 %3379 +%3381 = OpLoad %6 %20 +%3382 = OpISub %6 %3380 %3381 +OpStore %235 %3382 +OpBranch %3375 +%3375 = OpLabel +%3383 = OpLoad %1035 %1054 +%3384 = OpULessThan %1057 %3383 %1056 +OpSelectionMerge %3386 None +OpBranchConditional %3384 %3385 %3386 +%3385 = OpLabel +%3387 = OpLoad %6 %16 +%3388 = OpLoad %6 %21 +%3389 = OpISub %6 %3387 %3388 +OpStore %236 %3389 +OpBranch %3386 +%3386 = OpLabel +%3390 = OpLoad %1035 %1054 +%3391 = OpULessThan %1057 %3390 %1056 +OpSelectionMerge %3393 None +OpBranchConditional %3391 %3392 %3393 +%3392 = OpLabel +%3394 = OpLoad %6 %14 +%3395 = OpLoad %6 %16 +%3396 = OpISub %6 %3394 %3395 +%3397 = OpLoad %6 %19 +%3398 = OpISub %6 %3396 %3397 +%3399 = OpLoad %6 %21 +%3400 = OpIAdd %6 %3398 %3399 +OpStore %237 %3400 +OpBranch %3393 +%3393 = OpLabel +%3401 = OpLoad %1035 %1054 +%3402 = OpULessThan %1057 %3401 %1138 +OpSelectionMerge %3404 None +OpBranchConditional %3402 %3403 %3404 +%3403 = OpLabel +%3405 = OpLoad %6 %14 +%3406 = OpLoad %6 %16 +%3407 = OpIAdd %6 %3405 %3406 +%3408 = OpLoad %6 %19 +%3409 = OpIAdd %6 %3407 %3408 +%3410 = OpLoad %6 %22 +%3411 = OpISub %6 %3409 %3410 +OpStore %238 %3411 +OpBranch %3404 +%3404 = OpLabel +%3412 = OpLoad %1035 %1054 +%3413 = OpIEqual %1057 %3412 %1138 +OpSelectionMerge %3415 None +OpBranchConditional %3413 %3414 %3415 +%3414 = OpLabel +%3416 = OpLoad %6 %14 +%3417 = OpLoad %6 %16 +%3418 = OpISub %6 %3416 %3417 +%3419 = OpLoad %6 %20 +%3420 = OpISub %6 %3418 %3419 +%3421 = OpLoad %6 %21 +%3422 = OpISub %6 %3420 %3421 +OpStore %239 %3422 +OpBranch %3415 +%3415 = OpLabel +%3423 = OpLoad %1035 %1054 +%3424 = OpULessThan %1057 %3423 %1072 +OpSelectionMerge %3426 None +OpBranchConditional %3424 %3425 %3426 +%3425 = OpLabel +%3427 = OpLoad %6 %14 +%3428 = OpLoad %6 %16 +%3429 = OpIAdd %6 %3427 %3428 +%3430 = OpLoad %6 %20 +%3431 = OpISub %6 %3429 %3430 +%3432 = OpLoad %6 %22 +%3433 = OpISub %6 %3431 %3432 +OpStore %240 %3433 +OpBranch %3426 +%3426 = OpLabel +%3434 = OpLoad %1035 %1054 +%3435 = OpUGreaterThan %1057 %3434 %1072 +OpSelectionMerge %3437 None +OpBranchConditional %3435 %3436 %3437 +%3436 = OpLabel +%3438 = OpLoad %6 %14 +%3439 = OpLoad %6 %16 +%3440 = OpISub %6 %3438 %3439 +%3441 = OpLoad %6 %21 +%3442 = OpIAdd %6 %3440 %3441 +%3443 = OpLoad %6 %22 +%3444 = OpIAdd %6 %3442 %3443 +OpStore %241 %3444 +OpBranch %3437 +%3437 = OpLabel +%3445 = OpLoad %1035 %1054 +%3446 = OpINotEqual %1057 %3445 %1072 +OpSelectionMerge %3448 None +OpBranchConditional %3446 %3447 %3448 +%3447 = OpLabel +%3449 = OpLoad %6 %14 +%3450 = OpLoad %6 %17 +%3451 = OpISub %6 %3449 %3450 +%3452 = OpLoad %6 %18 +%3453 = OpISub %6 %3451 %3452 +%3454 = OpLoad %6 %19 +%3455 = OpISub %6 %3453 %3454 +OpStore %242 %3455 +OpBranch %3448 +%3448 = OpLabel +%3456 = OpLoad %1035 %1054 +%3457 = OpULessThan %1057 %3456 %1056 +OpSelectionMerge %3459 None +OpBranchConditional %3457 %3458 %3459 +%3458 = OpLabel +%3460 = OpLoad %6 %14 +%3461 = OpLoad %6 %17 +%3462 = OpISub %6 %3460 %3461 +%3463 = OpLoad %6 %18 +%3464 = OpIAdd %6 %3462 %3463 +%3465 = OpLoad %6 %20 +%3466 = OpISub %6 %3464 %3465 +OpStore %243 %3466 +OpBranch %3459 +%3459 = OpLabel +%3467 = OpLoad %1035 %1054 +%3468 = OpINotEqual %1057 %3467 %1072 +OpSelectionMerge %3470 None +OpBranchConditional %3468 %3469 %3470 +%3469 = OpLabel +%3471 = OpLoad %6 %14 +%3472 = OpLoad %6 %17 +%3473 = OpIAdd %6 %3471 %3472 +%3474 = OpLoad %6 %18 +%3475 = OpISub %6 %3473 %3474 +%3476 = OpLoad %6 %21 +%3477 = OpISub %6 %3475 %3476 +OpStore %244 %3477 +OpBranch %3470 +%3470 = OpLabel +%3478 = OpLoad %1035 %1054 +%3479 = OpUGreaterThan %1057 %3478 %1138 +OpSelectionMerge %3481 None +OpBranchConditional %3479 %3480 %3481 +%3480 = OpLabel +%3482 = OpLoad %6 %14 +%3483 = OpLoad %6 %17 +%3484 = OpISub %6 %3482 %3483 +%3485 = OpLoad %6 %18 +%3486 = OpISub %6 %3484 %3485 +%3487 = OpLoad %6 %22 +%3488 = OpISub %6 %3486 %3487 +OpStore %245 %3488 +OpBranch %3481 +%3481 = OpLabel +%3489 = OpLoad %1035 %1054 +%3490 = OpIEqual %1057 %3489 %1094 +OpSelectionMerge %3492 None +OpBranchConditional %3490 %3491 %3492 +%3491 = OpLabel +%3493 = OpLoad %6 %14 +%3494 = OpLoad %6 %17 +%3495 = OpISub %6 %3493 %3494 +%3496 = OpLoad %6 %19 +%3497 = OpIAdd %6 %3495 %3496 +%3498 = OpLoad %6 %20 +%3499 = OpIAdd %6 %3497 %3498 +OpStore %246 %3499 +OpBranch %3492 +%3492 = OpLabel +%3500 = OpLoad %1035 %1054 +%3501 = OpULessThan %1057 %3500 %1056 +OpSelectionMerge %3503 None +OpBranchConditional %3501 %3502 %3503 +%3502 = OpLabel +%3504 = OpLoad %6 %16 +%3505 = OpLoad %6 %22 +%3506 = OpISub %6 %3504 %3505 +OpStore %247 %3506 +OpBranch %3503 +%3503 = OpLabel +%3507 = OpLoad %1035 %1054 +%3508 = OpIEqual %1057 %3507 %1094 +OpSelectionMerge %3510 None +OpBranchConditional %3508 %3509 %3510 +%3509 = OpLabel +%3511 = OpLoad %6 %14 +%3512 = OpLoad %6 %17 +%3513 = OpISub %6 %3511 %3512 +%3514 = OpLoad %6 %19 +%3515 = OpISub %6 %3513 %3514 +%3516 = OpLoad %6 %21 +%3517 = OpIAdd %6 %3515 %3516 +OpStore %248 %3517 +OpBranch %3510 +%3510 = OpLabel +%3518 = OpLoad %1035 %1054 +%3519 = OpULessThanEqual %1057 %3518 %1094 +OpSelectionMerge %3521 None +OpBranchConditional %3519 %3520 %3521 +%3520 = OpLabel +%3522 = OpLoad %6 %14 +%3523 = OpLoad %6 %17 +%3524 = OpISub %6 %3522 %3523 +%3525 = OpLoad %6 %19 +%3526 = OpISub %6 %3524 %3525 +%3527 = OpLoad %6 %22 +%3528 = OpISub %6 %3526 %3527 +OpStore %249 %3528 +OpBranch %3521 +%3521 = OpLabel +%3529 = OpLoad %1035 %1054 +%3530 = OpUGreaterThan %1057 %3529 %1072 +OpSelectionMerge %3532 None +OpBranchConditional %3530 %3531 %3532 +%3531 = OpLabel +%3533 = OpLoad %6 %14 +%3534 = OpLoad %6 %17 +%3535 = OpIAdd %6 %3533 %3534 +%3536 = OpLoad %6 %20 +%3537 = OpISub %6 %3535 %3536 +%3538 = OpLoad %6 %21 +%3539 = OpIAdd %6 %3537 %3538 +OpStore %250 %3539 +OpBranch %3532 +%3532 = OpLabel +%3540 = OpLoad %1035 %1054 +%3541 = OpUGreaterThan %1057 %3540 %1138 +OpSelectionMerge %3543 None +OpBranchConditional %3541 %3542 %3543 +%3542 = OpLabel +%3544 = OpLoad %6 %14 +%3545 = OpLoad %6 %17 +%3546 = OpISub %6 %3544 %3545 +%3547 = OpLoad %6 %20 +%3548 = OpISub %6 %3546 %3547 +%3549 = OpLoad %6 %22 +%3550 = OpISub %6 %3548 %3549 +OpStore %251 %3550 +OpBranch %3543 +%3543 = OpLabel +%3551 = OpLoad %1035 %1054 +%3552 = OpUGreaterThan %1057 %3551 %1056 +OpSelectionMerge %3554 None +OpBranchConditional %3552 %3553 %3554 +%3553 = OpLabel +%3555 = OpLoad %6 %14 +%3556 = OpLoad %6 %17 +%3557 = OpIAdd %6 %3555 %3556 +%3558 = OpLoad %6 %21 +%3559 = OpIAdd %6 %3557 %3558 +%3560 = OpLoad %6 %22 +%3561 = OpISub %6 %3559 %3560 +OpStore %252 %3561 +OpBranch %3554 +%3554 = OpLabel +%3562 = OpLoad %1035 %1054 +%3563 = OpUGreaterThanEqual %1057 %3562 %1056 +OpSelectionMerge %3565 None +OpBranchConditional %3563 %3564 %3565 +%3564 = OpLabel +%3566 = OpLoad %6 %14 +%3567 = OpLoad %6 %18 +%3568 = OpISub %6 %3566 %3567 +%3569 = OpLoad %6 %19 +%3570 = OpIAdd %6 %3568 %3569 +%3571 = OpLoad %6 %20 +%3572 = OpIAdd %6 %3570 %3571 +OpStore %253 %3572 +OpBranch %3565 +%3565 = OpLabel +%3573 = OpLoad %1035 %1054 +%3574 = OpUGreaterThan %1057 %3573 %1072 +OpSelectionMerge %3576 None +OpBranchConditional %3574 %3575 %3576 +%3575 = OpLabel +%3577 = OpLoad %6 %14 +%3578 = OpLoad %6 %18 +%3579 = OpISub %6 %3577 %3578 +%3580 = OpLoad %6 %19 +%3581 = OpIAdd %6 %3579 %3580 +%3582 = OpLoad %6 %21 +%3583 = OpISub %6 %3581 %3582 +OpStore %254 %3583 +OpBranch %3576 +%3576 = OpLabel +%3584 = OpLoad %1035 %1054 +%3585 = OpUGreaterThan %1057 %3584 %1056 +OpSelectionMerge %3587 None +OpBranchConditional %3585 %3586 %3587 +%3586 = OpLabel +%3588 = OpLoad %6 %14 +%3589 = OpLoad %6 %18 +%3590 = OpIAdd %6 %3588 %3589 +%3591 = OpLoad %6 %19 +%3592 = OpIAdd %6 %3590 %3591 +%3593 = OpLoad %6 %22 +%3594 = OpISub %6 %3592 %3593 +OpStore %255 %3594 +OpBranch %3587 +%3587 = OpLabel +%3595 = OpLoad %1035 %1054 +%3596 = OpULessThan %1057 %3595 %1138 +OpSelectionMerge %3598 None +OpBranchConditional %3596 %3597 %3598 +%3597 = OpLabel +%3599 = OpLoad %6 %14 +%3600 = OpLoad %6 %18 +%3601 = OpISub %6 %3599 %3600 +%3602 = OpLoad %6 %20 +%3603 = OpIAdd %6 %3601 %3602 +%3604 = OpLoad %6 %21 +%3605 = OpISub %6 %3603 %3604 +OpStore %256 %3605 +OpBranch %3598 +%3598 = OpLabel +%3606 = OpLoad %1035 %1054 +%3607 = OpUGreaterThanEqual %1057 %3606 %1094 +OpSelectionMerge %3609 None +OpBranchConditional %3607 %3608 %3609 +%3608 = OpLabel +%3610 = OpLoad %6 %14 +%3611 = OpLoad %6 %18 +%3612 = OpISub %6 %3610 %3611 +%3613 = OpLoad %6 %20 +%3614 = OpIAdd %6 %3612 %3613 +%3615 = OpLoad %6 %22 +%3616 = OpIAdd %6 %3614 %3615 +OpStore %257 %3616 +OpBranch %3609 +%3609 = OpLabel +%3617 = OpLoad %1035 %1054 +%3618 = OpULessThan %1057 %3617 %1056 +OpSelectionMerge %3620 None +OpBranchConditional %3618 %3619 %3620 +%3619 = OpLabel +%3621 = OpLoad %6 %13 +%3622 = OpLoad %6 %17 +%3623 = OpIAdd %6 %3621 %3622 +OpStore %258 %3623 +OpBranch %3620 +%3620 = OpLabel +%3624 = OpLoad %1035 %1054 +%3625 = OpULessThanEqual %1057 %3624 %1072 +OpSelectionMerge %3627 None +OpBranchConditional %3625 %3626 %3627 +%3626 = OpLabel +%3628 = OpLoad %6 %17 +%3629 = OpLoad %6 %18 +%3630 = OpIAdd %6 %3628 %3629 +OpStore %259 %3630 +OpBranch %3627 +%3627 = OpLabel +%3631 = OpLoad %1035 %1054 +%3632 = OpUGreaterThanEqual %1057 %3631 %1138 +OpSelectionMerge %3634 None +OpBranchConditional %3632 %3633 %3634 +%3633 = OpLabel +%3635 = OpLoad %6 %14 +%3636 = OpLoad %6 %18 +%3637 = OpIAdd %6 %3635 %3636 +%3638 = OpLoad %6 %21 +%3639 = OpIAdd %6 %3637 %3638 +%3640 = OpLoad %6 %22 +%3641 = OpISub %6 %3639 %3640 +OpStore %260 %3641 +OpBranch %3634 +%3634 = OpLabel +%3642 = OpLoad %1035 %1054 +%3643 = OpIEqual %1057 %3642 %1072 +OpSelectionMerge %3645 None +OpBranchConditional %3643 %3644 %3645 +%3644 = OpLabel +%3646 = OpLoad %6 %14 +%3647 = OpLoad %6 %19 +%3648 = OpIAdd %6 %3646 %3647 +%3649 = OpLoad %6 %20 +%3650 = OpISub %6 %3648 %3649 +%3651 = OpLoad %6 %21 +%3652 = OpIAdd %6 %3650 %3651 +OpStore %261 %3652 +OpBranch %3645 +%3645 = OpLabel +%3653 = OpLoad %1035 %1054 +%3654 = OpINotEqual %1057 %3653 %1056 +OpSelectionMerge %3656 None +OpBranchConditional %3654 %3655 %3656 +%3655 = OpLabel +%3657 = OpLoad %6 %14 +%3658 = OpLoad %6 %19 +%3659 = OpIAdd %6 %3657 %3658 +%3660 = OpLoad %6 %20 +%3661 = OpIAdd %6 %3659 %3660 +%3662 = OpLoad %6 %22 +%3663 = OpIAdd %6 %3661 %3662 +OpStore %262 %3663 +OpBranch %3656 +%3656 = OpLabel +%3664 = OpLoad %1035 %1054 +%3665 = OpULessThan %1057 %3664 %1138 +OpSelectionMerge %3667 None +OpBranchConditional %3665 %3666 %3667 +%3666 = OpLabel +%3668 = OpLoad %6 %14 +%3669 = OpLoad %6 %19 +%3670 = OpIAdd %6 %3668 %3669 +%3671 = OpLoad %6 %21 +%3672 = OpISub %6 %3670 %3671 +%3673 = OpLoad %6 %22 +%3674 = OpISub %6 %3672 %3673 +OpStore %263 %3674 +OpBranch %3667 +%3667 = OpLabel +%3675 = OpLoad %1035 %1054 +%3676 = OpULessThan %1057 %3675 %1094 +OpSelectionMerge %3678 None +OpBranchConditional %3676 %3677 %3678 +%3677 = OpLabel +%3679 = OpLoad %6 %14 +%3680 = OpLoad %6 %20 +%3681 = OpISub %6 %3679 %3680 +%3682 = OpLoad %6 %21 +%3683 = OpIAdd %6 %3681 %3682 +%3684 = OpLoad %6 %22 +%3685 = OpISub %6 %3683 %3684 +OpStore %264 %3685 +OpBranch %3678 +%3678 = OpLabel +%3686 = OpLoad %1035 %1054 +%3687 = OpUGreaterThan %1057 %3686 %1138 +OpSelectionMerge %3689 None +OpBranchConditional %3687 %3688 %3689 +%3688 = OpLabel +%3690 = OpLoad %6 %15 +%3691 = OpLoad %6 %16 +%3692 = OpIAdd %6 %3690 %3691 +%3693 = OpLoad %6 %17 +%3694 = OpIAdd %6 %3692 %3693 +%3695 = OpLoad %6 %18 +%3696 = OpIAdd %6 %3694 %3695 +OpStore %265 %3696 +OpBranch %3689 +%3689 = OpLabel +%3697 = OpLoad %1035 %1054 +%3698 = OpULessThanEqual %1057 %3697 %1072 +OpSelectionMerge %3700 None +OpBranchConditional %3698 %3699 %3700 +%3699 = OpLabel +%3701 = OpLoad %6 %15 +%3702 = OpLoad %6 %16 +%3703 = OpIAdd %6 %3701 %3702 +%3704 = OpLoad %6 %17 +%3705 = OpISub %6 %3703 %3704 +%3706 = OpLoad %6 %19 +%3707 = OpISub %6 %3705 %3706 +OpStore %266 %3707 +OpBranch %3700 +%3700 = OpLabel +%3708 = OpLoad %1035 %1054 +%3709 = OpIEqual %1057 %3708 %1094 +OpSelectionMerge %3711 None +OpBranchConditional %3709 %3710 %3711 +%3710 = OpLabel +%3712 = OpLoad %6 %15 +%3713 = OpLoad %6 %16 +%3714 = OpIAdd %6 %3712 %3713 +%3715 = OpLoad %6 %17 +%3716 = OpIAdd %6 %3714 %3715 +%3717 = OpLoad %6 %20 +%3718 = OpIAdd %6 %3716 %3717 +OpStore %267 %3718 +OpBranch %3711 +%3711 = OpLabel +%3719 = OpLoad %1035 %1054 +%3720 = OpULessThanEqual %1057 %3719 %1056 +OpSelectionMerge %3722 None +OpBranchConditional %3720 %3721 %3722 +%3721 = OpLabel +%3723 = OpLoad %6 %15 +%3724 = OpLoad %6 %16 +%3725 = OpIAdd %6 %3723 %3724 +%3726 = OpLoad %6 %17 +%3727 = OpISub %6 %3725 %3726 +%3728 = OpLoad %6 %21 +%3729 = OpIAdd %6 %3727 %3728 +OpStore %268 %3729 +OpBranch %3722 +%3722 = OpLabel +%3730 = OpLoad %1035 %1054 +%3731 = OpULessThan %1057 %3730 %1072 +OpSelectionMerge %3733 None +OpBranchConditional %3731 %3732 %3733 +%3732 = OpLabel +%3734 = OpLoad %6 %15 +%3735 = OpLoad %6 %16 +%3736 = OpISub %6 %3734 %3735 +%3737 = OpLoad %6 %17 +%3738 = OpISub %6 %3736 %3737 +%3739 = OpLoad %6 %22 +%3740 = OpISub %6 %3738 %3739 +OpStore %269 %3740 +OpBranch %3733 +%3733 = OpLabel +%3741 = OpLoad %1035 %1054 +%3742 = OpULessThan %1057 %3741 %1138 +OpSelectionMerge %3744 None +OpBranchConditional %3742 %3743 %3744 +%3743 = OpLabel +%3745 = OpLoad %6 %17 +%3746 = OpLoad %6 %19 +%3747 = OpIAdd %6 %3745 %3746 +OpStore %270 %3747 +OpBranch %3744 +%3744 = OpLabel +%3748 = OpLoad %1035 %1054 +%3749 = OpINotEqual %1057 %3748 %1138 +OpSelectionMerge %3751 None +OpBranchConditional %3749 %3750 %3751 +%3750 = OpLabel +%3752 = OpLoad %6 %15 +%3753 = OpLoad %6 %16 +%3754 = OpIAdd %6 %3752 %3753 +%3755 = OpLoad %6 %18 +%3756 = OpIAdd %6 %3754 %3755 +%3757 = OpLoad %6 %19 +%3758 = OpISub %6 %3756 %3757 +OpStore %271 %3758 +OpBranch %3751 +%3751 = OpLabel +%3759 = OpLoad %1035 %1054 +%3760 = OpULessThan %1057 %3759 %1094 +OpSelectionMerge %3762 None +OpBranchConditional %3760 %3761 %3762 +%3761 = OpLabel +%3763 = OpLoad %6 %15 +%3764 = OpLoad %6 %16 +%3765 = OpIAdd %6 %3763 %3764 +%3766 = OpLoad %6 %18 +%3767 = OpISub %6 %3765 %3766 +%3768 = OpLoad %6 %20 +%3769 = OpIAdd %6 %3767 %3768 +OpStore %272 %3769 +OpBranch %3762 +%3762 = OpLabel +%3770 = OpLoad %1035 %1054 +%3771 = OpULessThan %1057 %3770 %1138 +OpSelectionMerge %3773 None +OpBranchConditional %3771 %3772 %3773 +%3772 = OpLabel +%3774 = OpLoad %6 %15 +%3775 = OpLoad %6 %16 +%3776 = OpIAdd %6 %3774 %3775 +%3777 = OpLoad %6 %18 +%3778 = OpIAdd %6 %3776 %3777 +%3779 = OpLoad %6 %21 +%3780 = OpISub %6 %3778 %3779 +OpStore %273 %3780 +OpBranch %3773 +%3773 = OpLabel +%3781 = OpLoad %1035 %1054 +%3782 = OpIEqual %1057 %3781 %1094 +OpSelectionMerge %3784 None +OpBranchConditional %3782 %3783 %3784 +%3783 = OpLabel +%3785 = OpLoad %6 %15 +%3786 = OpLoad %6 %16 +%3787 = OpIAdd %6 %3785 %3786 +%3788 = OpLoad %6 %18 +%3789 = OpIAdd %6 %3787 %3788 +%3790 = OpLoad %6 %22 +%3791 = OpIAdd %6 %3789 %3790 +OpStore %274 %3791 +OpBranch %3784 +%3784 = OpLabel +%3792 = OpLoad %1035 %1054 +%3793 = OpUGreaterThan %1057 %3792 %1072 +OpSelectionMerge %3795 None +OpBranchConditional %3793 %3794 %3795 +%3794 = OpLabel +%3796 = OpLoad %6 %15 +%3797 = OpLoad %6 %16 +%3798 = OpIAdd %6 %3796 %3797 +%3799 = OpLoad %6 %19 +%3800 = OpIAdd %6 %3798 %3799 +%3801 = OpLoad %6 %20 +%3802 = OpISub %6 %3800 %3801 +OpStore %275 %3802 +OpBranch %3795 +%3795 = OpLabel +%3803 = OpLoad %1035 %1054 +%3804 = OpUGreaterThanEqual %1057 %3803 %1094 +OpSelectionMerge %3806 None +OpBranchConditional %3804 %3805 %3806 +%3805 = OpLabel +%3807 = OpLoad %6 %15 +%3808 = OpLoad %6 %16 +%3809 = OpISub %6 %3807 %3808 +%3810 = OpLoad %6 %19 +%3811 = OpISub %6 %3809 %3810 +%3812 = OpLoad %6 %21 +%3813 = OpISub %6 %3811 %3812 +OpStore %276 %3813 +OpBranch %3806 +%3806 = OpLabel +%3814 = OpLoad %1035 %1054 +%3815 = OpIEqual %1057 %3814 %1072 +OpSelectionMerge %3817 None +OpBranchConditional %3815 %3816 %3817 +%3816 = OpLabel +%3818 = OpLoad %6 %15 +%3819 = OpLoad %6 %16 +%3820 = OpISub %6 %3818 %3819 +%3821 = OpLoad %6 %19 +%3822 = OpIAdd %6 %3820 %3821 +%3823 = OpLoad %6 %22 +%3824 = OpISub %6 %3822 %3823 +OpStore %277 %3824 +OpBranch %3817 +%3817 = OpLabel +%3825 = OpLoad %1035 %1054 +%3826 = OpINotEqual %1057 %3825 %1056 +OpSelectionMerge %3828 None +OpBranchConditional %3826 %3827 %3828 +%3827 = OpLabel +%3829 = OpLoad %6 %15 +%3830 = OpLoad %6 %16 +%3831 = OpISub %6 %3829 %3830 +%3832 = OpLoad %6 %20 +%3833 = OpISub %6 %3831 %3832 +%3834 = OpLoad %6 %21 +%3835 = OpISub %6 %3833 %3834 +OpStore %278 %3835 +OpBranch %3828 +%3828 = OpLabel +%3836 = OpLoad %1035 %1054 +%3837 = OpUGreaterThanEqual %1057 %3836 %1138 +OpSelectionMerge %3839 None +OpBranchConditional %3837 %3838 %3839 +%3838 = OpLabel +%3840 = OpLoad %6 %15 +%3841 = OpLoad %6 %16 +%3842 = OpIAdd %6 %3840 %3841 +%3843 = OpLoad %6 %20 +%3844 = OpISub %6 %3842 %3843 +%3845 = OpLoad %6 %22 +%3846 = OpIAdd %6 %3844 %3845 +OpStore %279 %3846 +OpBranch %3839 +%3839 = OpLabel +%3847 = OpLoad %1035 %1054 +%3848 = OpUGreaterThan %1057 %3847 %1094 +OpSelectionMerge %3850 None +OpBranchConditional %3848 %3849 %3850 +%3849 = OpLabel +%3851 = OpLoad %6 %15 +%3852 = OpLoad %6 %16 +%3853 = OpIAdd %6 %3851 %3852 +%3854 = OpLoad %6 %21 +%3855 = OpISub %6 %3853 %3854 +%3856 = OpLoad %6 %22 +%3857 = OpIAdd %6 %3855 %3856 +OpStore %280 %3857 +OpBranch %3850 +%3850 = OpLabel +%3858 = OpLoad %1035 %1054 +%3859 = OpUGreaterThan %1057 %3858 %1138 +OpSelectionMerge %3861 None +OpBranchConditional %3859 %3860 %3861 +%3860 = OpLabel +%3862 = OpLoad %6 %17 +%3863 = OpLoad %6 %20 +%3864 = OpISub %6 %3862 %3863 +OpStore %281 %3864 +OpBranch %3861 +%3861 = OpLabel +%3865 = OpLoad %1035 %1054 +%3866 = OpIEqual %1057 %3865 %1056 +OpSelectionMerge %3868 None +OpBranchConditional %3866 %3867 %3868 +%3867 = OpLabel +%3869 = OpLoad %6 %15 +%3870 = OpLoad %6 %17 +%3871 = OpISub %6 %3869 %3870 +%3872 = OpLoad %6 %18 +%3873 = OpISub %6 %3871 %3872 +%3874 = OpLoad %6 %19 +%3875 = OpIAdd %6 %3873 %3874 +OpStore %282 %3875 +OpBranch %3868 +%3868 = OpLabel +%3876 = OpLoad %1035 %1054 +%3877 = OpULessThan %1057 %3876 %1072 +OpSelectionMerge %3879 None +OpBranchConditional %3877 %3878 %3879 +%3878 = OpLabel +%3880 = OpLoad %6 %15 +%3881 = OpLoad %6 %17 +%3882 = OpISub %6 %3880 %3881 +%3883 = OpLoad %6 %18 +%3884 = OpISub %6 %3882 %3883 +%3885 = OpLoad %6 %20 +%3886 = OpIAdd %6 %3884 %3885 +OpStore %283 %3886 +OpBranch %3879 +%3879 = OpLabel +%3887 = OpLoad %1035 %1054 +%3888 = OpULessThan %1057 %3887 %1138 +OpSelectionMerge %3890 None +OpBranchConditional %3888 %3889 %3890 +%3889 = OpLabel +%3891 = OpLoad %6 %15 +%3892 = OpLoad %6 %17 +%3893 = OpISub %6 %3891 %3892 +%3894 = OpLoad %6 %18 +%3895 = OpISub %6 %3893 %3894 +%3896 = OpLoad %6 %21 +%3897 = OpIAdd %6 %3895 %3896 +OpStore %284 %3897 +OpBranch %3890 +%3890 = OpLabel +%3898 = OpLoad %1035 %1054 +%3899 = OpULessThanEqual %1057 %3898 %1138 +OpSelectionMerge %3901 None +OpBranchConditional %3899 %3900 %3901 +%3900 = OpLabel +%3902 = OpLoad %6 %15 +%3903 = OpLoad %6 %17 +%3904 = OpISub %6 %3902 %3903 +%3905 = OpLoad %6 %18 +%3906 = OpIAdd %6 %3904 %3905 +%3907 = OpLoad %6 %22 +%3908 = OpISub %6 %3906 %3907 +OpStore %285 %3908 +OpBranch %3901 +%3901 = OpLabel +%3909 = OpLoad %1035 %1054 +%3910 = OpULessThanEqual %1057 %3909 %1072 +OpSelectionMerge %3912 None +OpBranchConditional %3910 %3911 %3912 +%3911 = OpLabel +%3913 = OpLoad %6 %15 +%3914 = OpLoad %6 %17 +%3915 = OpIAdd %6 %3913 %3914 +%3916 = OpLoad %6 %19 +%3917 = OpIAdd %6 %3915 %3916 +%3918 = OpLoad %6 %20 +%3919 = OpISub %6 %3917 %3918 +OpStore %286 %3919 +OpBranch %3912 +%3912 = OpLabel +%3920 = OpLoad %1035 %1054 +%3921 = OpUGreaterThan %1057 %3920 %1138 +OpSelectionMerge %3923 None +OpBranchConditional %3921 %3922 %3923 +%3922 = OpLabel +%3924 = OpLoad %6 %15 +%3925 = OpLoad %6 %17 +%3926 = OpISub %6 %3924 %3925 +%3927 = OpLoad %6 %19 +%3928 = OpIAdd %6 %3926 %3927 +%3929 = OpLoad %6 %21 +%3930 = OpIAdd %6 %3928 %3929 +OpStore %287 %3930 +OpBranch %3923 +%3923 = OpLabel +%3931 = OpLoad %1035 %1054 +%3932 = OpULessThan %1057 %3931 %1094 +OpSelectionMerge %3934 None +OpBranchConditional %3932 %3933 %3934 +%3933 = OpLabel +%3935 = OpLoad %6 %15 +%3936 = OpLoad %6 %17 +%3937 = OpIAdd %6 %3935 %3936 +%3938 = OpLoad %6 %19 +%3939 = OpIAdd %6 %3937 %3938 +%3940 = OpLoad %6 %22 +%3941 = OpIAdd %6 %3939 %3940 +OpStore %288 %3941 +OpBranch %3934 +%3934 = OpLabel +%3942 = OpLoad %1035 %1054 +%3943 = OpULessThanEqual %1057 %3942 %1072 +OpSelectionMerge %3945 None +OpBranchConditional %3943 %3944 %3945 +%3944 = OpLabel +%3946 = OpLoad %6 %15 +%3947 = OpLoad %6 %17 +%3948 = OpISub %6 %3946 %3947 +%3949 = OpLoad %6 %20 +%3950 = OpIAdd %6 %3948 %3949 +%3951 = OpLoad %6 %21 +%3952 = OpIAdd %6 %3950 %3951 +OpStore %289 %3952 +OpBranch %3945 +%3945 = OpLabel +%3953 = OpLoad %1035 %1054 +%3954 = OpULessThan %1057 %3953 %1056 +OpSelectionMerge %3956 None +OpBranchConditional %3954 %3955 %3956 +%3955 = OpLabel +%3957 = OpLoad %6 %15 +%3958 = OpLoad %6 %17 +%3959 = OpIAdd %6 %3957 %3958 +%3960 = OpLoad %6 %20 +%3961 = OpIAdd %6 %3959 %3960 +%3962 = OpLoad %6 %22 +%3963 = OpIAdd %6 %3961 %3962 +OpStore %290 %3963 +OpBranch %3956 +%3956 = OpLabel +%3964 = OpLoad %1035 %1054 +%3965 = OpIEqual %1057 %3964 %1094 +OpSelectionMerge %3967 None +OpBranchConditional %3965 %3966 %3967 +%3966 = OpLabel +%3968 = OpLoad %6 %15 +%3969 = OpLoad %6 %17 +%3970 = OpIAdd %6 %3968 %3969 +%3971 = OpLoad %6 %21 +%3972 = OpIAdd %6 %3970 %3971 +%3973 = OpLoad %6 %22 +%3974 = OpISub %6 %3972 %3973 +OpStore %291 %3974 +OpBranch %3967 +%3967 = OpLabel +%3975 = OpLoad %1035 %1054 +%3976 = OpUGreaterThanEqual %1057 %3975 %1056 +OpSelectionMerge %3978 None +OpBranchConditional %3976 %3977 %3978 +%3977 = OpLabel +%3979 = OpLoad %6 %17 +%3980 = OpLoad %6 %21 +%3981 = OpISub %6 %3979 %3980 +OpStore %292 %3981 +OpBranch %3978 +%3978 = OpLabel +%3982 = OpLoad %1035 %1054 +%3983 = OpUGreaterThanEqual %1057 %3982 %1056 +OpSelectionMerge %3985 None +OpBranchConditional %3983 %3984 %3985 +%3984 = OpLabel +%3986 = OpLoad %6 %15 +%3987 = OpLoad %6 %18 +%3988 = OpISub %6 %3986 %3987 +%3989 = OpLoad %6 %19 +%3990 = OpISub %6 %3988 %3989 +%3991 = OpLoad %6 %20 +%3992 = OpIAdd %6 %3990 %3991 +OpStore %293 %3992 +OpBranch %3985 +%3985 = OpLabel +%3993 = OpLoad %1035 %1054 +%3994 = OpULessThanEqual %1057 %3993 %1056 +OpSelectionMerge %3996 None +OpBranchConditional %3994 %3995 %3996 +%3995 = OpLabel +%3997 = OpLoad %6 %15 +%3998 = OpLoad %6 %18 +%3999 = OpIAdd %6 %3997 %3998 +%4000 = OpLoad %6 %19 +%4001 = OpIAdd %6 %3999 %4000 +%4002 = OpLoad %6 %21 +%4003 = OpIAdd %6 %4001 %4002 +OpStore %294 %4003 +OpBranch %3996 +%3996 = OpLabel +%4004 = OpLoad %1035 %1054 +%4005 = OpUGreaterThan %1057 %4004 %1094 +OpSelectionMerge %4007 None +OpBranchConditional %4005 %4006 %4007 +%4006 = OpLabel +%4008 = OpLoad %6 %15 +%4009 = OpLoad %6 %18 +%4010 = OpISub %6 %4008 %4009 +%4011 = OpLoad %6 %19 +%4012 = OpIAdd %6 %4010 %4011 +%4013 = OpLoad %6 %22 +%4014 = OpISub %6 %4012 %4013 +OpStore %295 %4014 +OpBranch %4007 +%4007 = OpLabel +%4015 = OpLoad %1035 %1054 +%4016 = OpUGreaterThanEqual %1057 %4015 %1094 +OpSelectionMerge %4018 None +OpBranchConditional %4016 %4017 %4018 +%4017 = OpLabel +%4019 = OpLoad %6 %15 +%4020 = OpLoad %6 %18 +%4021 = OpISub %6 %4019 %4020 +%4022 = OpLoad %6 %20 +%4023 = OpISub %6 %4021 %4022 +%4024 = OpLoad %6 %21 +%4025 = OpIAdd %6 %4023 %4024 +OpStore %296 %4025 +OpBranch %4018 +%4018 = OpLabel +%4026 = OpLoad %1035 %1054 +%4027 = OpIEqual %1057 %4026 %1056 +OpSelectionMerge %4029 None +OpBranchConditional %4027 %4028 %4029 +%4028 = OpLabel +%4030 = OpLoad %6 %15 +%4031 = OpLoad %6 %18 +%4032 = OpIAdd %6 %4030 %4031 +%4033 = OpLoad %6 %20 +%4034 = OpIAdd %6 %4032 %4033 +%4035 = OpLoad %6 %22 +%4036 = OpIAdd %6 %4034 %4035 +OpStore %297 %4036 +OpBranch %4029 +%4029 = OpLabel +%4037 = OpLoad %1035 %1054 +%4038 = OpUGreaterThan %1057 %4037 %1072 +OpSelectionMerge %4040 None +OpBranchConditional %4038 %4039 %4040 +%4039 = OpLabel +%4041 = OpLoad %6 %15 +%4042 = OpLoad %6 %18 +%4043 = OpISub %6 %4041 %4042 +%4044 = OpLoad %6 %21 +%4045 = OpIAdd %6 %4043 %4044 +%4046 = OpLoad %6 %22 +%4047 = OpIAdd %6 %4045 %4046 +OpStore %298 %4047 +OpBranch %4040 +%4040 = OpLabel +%4048 = OpLoad %1035 %1054 +%4049 = OpUGreaterThanEqual %1057 %4048 %1072 +OpSelectionMerge %4051 None +OpBranchConditional %4049 %4050 %4051 +%4050 = OpLabel +%4052 = OpLoad %6 %15 +%4053 = OpLoad %6 %19 +%4054 = OpISub %6 %4052 %4053 +%4055 = OpLoad %6 %20 +%4056 = OpIAdd %6 %4054 %4055 +%4057 = OpLoad %6 %21 +%4058 = OpISub %6 %4056 %4057 +OpStore %299 %4058 +OpBranch %4051 +%4051 = OpLabel +%4059 = OpLoad %1035 %1054 +%4060 = OpUGreaterThanEqual %1057 %4059 %1056 +OpSelectionMerge %4062 None +OpBranchConditional %4060 %4061 %4062 +%4061 = OpLabel +%4063 = OpLoad %6 %15 +%4064 = OpLoad %6 %19 +%4065 = OpIAdd %6 %4063 %4064 +%4066 = OpLoad %6 %20 +%4067 = OpIAdd %6 %4065 %4066 +%4068 = OpLoad %6 %22 +%4069 = OpIAdd %6 %4067 %4068 +OpStore %300 %4069 +OpBranch %4062 +%4062 = OpLabel +%4070 = OpLoad %1035 %1054 +%4071 = OpIEqual %1057 %4070 %1072 +OpSelectionMerge %4073 None +OpBranchConditional %4071 %4072 %4073 +%4072 = OpLabel +%4074 = OpLoad %6 %15 +%4075 = OpLoad %6 %19 +%4076 = OpIAdd %6 %4074 %4075 +%4077 = OpLoad %6 %21 +%4078 = OpIAdd %6 %4076 %4077 +%4079 = OpLoad %6 %22 +%4080 = OpISub %6 %4078 %4079 +OpStore %301 %4080 +OpBranch %4073 +%4073 = OpLabel +%4081 = OpLoad %1035 %1054 +%4082 = OpULessThanEqual %1057 %4081 %1138 +OpSelectionMerge %4084 None +OpBranchConditional %4082 %4083 %4084 +%4083 = OpLabel +%4085 = OpLoad %6 %15 +%4086 = OpLoad %6 %20 +%4087 = OpISub %6 %4085 %4086 +%4088 = OpLoad %6 %21 +%4089 = OpIAdd %6 %4087 %4088 +%4090 = OpLoad %6 %22 +%4091 = OpIAdd %6 %4089 %4090 +OpStore %302 %4091 +OpBranch %4084 +%4084 = OpLabel +%4092 = OpLoad %1035 %1054 +%4093 = OpUGreaterThan %1057 %4092 %1094 +OpSelectionMerge %4095 None +OpBranchConditional %4093 %4094 %4095 +%4094 = OpLabel +%4096 = OpLoad %6 %17 +%4097 = OpLoad %6 %22 +%4098 = OpIAdd %6 %4096 %4097 +OpStore %303 %4098 +OpBranch %4095 +%4095 = OpLabel +%4099 = OpLoad %1035 %1054 +%4100 = OpUGreaterThan %1057 %4099 %1094 +OpSelectionMerge %4102 None +OpBranchConditional %4100 %4101 %4102 +%4101 = OpLabel +%4103 = OpLoad %6 %16 +%4104 = OpLoad %6 %17 +%4105 = OpIAdd %6 %4103 %4104 +%4106 = OpLoad %6 %18 +%4107 = OpIAdd %6 %4105 %4106 +%4108 = OpLoad %6 %19 +%4109 = OpISub %6 %4107 %4108 +OpStore %304 %4109 +OpBranch %4102 +%4102 = OpLabel +%4110 = OpLoad %1035 %1054 +%4111 = OpULessThanEqual %1057 %4110 %1072 +OpSelectionMerge %4113 None +OpBranchConditional %4111 %4112 %4113 +%4112 = OpLabel +%4114 = OpLoad %6 %16 +%4115 = OpLoad %6 %17 +%4116 = OpIAdd %6 %4114 %4115 +%4117 = OpLoad %6 %18 +%4118 = OpIAdd %6 %4116 %4117 +%4119 = OpLoad %6 %20 +%4120 = OpIAdd %6 %4118 %4119 +OpStore %305 %4120 +OpBranch %4113 +%4113 = OpLabel +%4121 = OpLoad %1035 %1054 +%4122 = OpULessThan %1057 %4121 %1094 +OpSelectionMerge %4124 None +OpBranchConditional %4122 %4123 %4124 +%4123 = OpLabel +%4125 = OpLoad %6 %16 +%4126 = OpLoad %6 %17 +%4127 = OpIAdd %6 %4125 %4126 +%4128 = OpLoad %6 %18 +%4129 = OpIAdd %6 %4127 %4128 +%4130 = OpLoad %6 %21 +%4131 = OpISub %6 %4129 %4130 +OpStore %306 %4131 +OpBranch %4124 +%4124 = OpLabel +%4132 = OpLoad %1035 %1054 +%4133 = OpUGreaterThanEqual %1057 %4132 %1056 +OpSelectionMerge %4135 None +OpBranchConditional %4133 %4134 %4135 +%4134 = OpLabel +%4136 = OpLoad %6 %16 +%4137 = OpLoad %6 %17 +%4138 = OpISub %6 %4136 %4137 +%4139 = OpLoad %6 %18 +%4140 = OpISub %6 %4138 %4139 +%4141 = OpLoad %6 %22 +%4142 = OpISub %6 %4140 %4141 +OpStore %307 %4142 +OpBranch %4135 +%4135 = OpLabel +%4143 = OpLoad %1035 %1054 +%4144 = OpIEqual %1057 %4143 %1056 +OpSelectionMerge %4146 None +OpBranchConditional %4144 %4145 %4146 +%4145 = OpLabel +%4147 = OpLoad %6 %16 +%4148 = OpLoad %6 %17 +%4149 = OpIAdd %6 %4147 %4148 +%4150 = OpLoad %6 %19 +%4151 = OpIAdd %6 %4149 %4150 +%4152 = OpLoad %6 %20 +%4153 = OpISub %6 %4151 %4152 +OpStore %308 %4153 +OpBranch %4146 +%4146 = OpLabel +%4154 = OpLoad %1035 %1054 +%4155 = OpINotEqual %1057 %4154 %1072 +OpSelectionMerge %4157 None +OpBranchConditional %4155 %4156 %4157 +%4156 = OpLabel +%4158 = OpLoad %6 %16 +%4159 = OpLoad %6 %17 +%4160 = OpISub %6 %4158 %4159 +%4161 = OpLoad %6 %19 +%4162 = OpISub %6 %4160 %4161 +%4163 = OpLoad %6 %21 +%4164 = OpISub %6 %4162 %4163 +OpStore %309 %4164 +OpBranch %4157 +%4157 = OpLabel +%4165 = OpLoad %1035 %1054 +%4166 = OpULessThanEqual %1057 %4165 %1072 +OpSelectionMerge %4168 None +OpBranchConditional %4166 %4167 %4168 +%4167 = OpLabel +%4169 = OpLoad %6 %16 +%4170 = OpLoad %6 %17 +%4171 = OpISub %6 %4169 %4170 +%4172 = OpLoad %6 %19 +%4173 = OpISub %6 %4171 %4172 +%4174 = OpLoad %6 %22 +%4175 = OpIAdd %6 %4173 %4174 +OpStore %310 %4175 +OpBranch %4168 +%4168 = OpLabel +%4176 = OpLoad %1035 %1054 +%4177 = OpUGreaterThanEqual %1057 %4176 %1056 +OpSelectionMerge %4179 None +OpBranchConditional %4177 %4178 %4179 +%4178 = OpLabel +%4180 = OpLoad %6 %16 +%4181 = OpLoad %6 %17 +%4182 = OpIAdd %6 %4180 %4181 +%4183 = OpLoad %6 %20 +%4184 = OpISub %6 %4182 %4183 +%4185 = OpLoad %6 %21 +%4186 = OpISub %6 %4184 %4185 +OpStore %311 %4186 +OpBranch %4179 +%4179 = OpLabel +%4187 = OpLoad %1035 %1054 +%4188 = OpULessThanEqual %1057 %4187 %1138 +OpSelectionMerge %4190 None +OpBranchConditional %4188 %4189 %4190 +%4189 = OpLabel +%4191 = OpLoad %6 %16 +%4192 = OpLoad %6 %17 +%4193 = OpISub %6 %4191 %4192 +%4194 = OpLoad %6 %20 +%4195 = OpIAdd %6 %4193 %4194 +%4196 = OpLoad %6 %22 +%4197 = OpIAdd %6 %4195 %4196 +OpStore %312 %4197 +OpBranch %4190 +%4190 = OpLabel +%4198 = OpLoad %1035 %1054 +%4199 = OpUGreaterThan %1057 %4198 %1138 +OpSelectionMerge %4201 None +OpBranchConditional %4199 %4200 %4201 +%4200 = OpLabel +%4202 = OpLoad %6 %16 +%4203 = OpLoad %6 %17 +%4204 = OpISub %6 %4202 %4203 +%4205 = OpLoad %6 %21 +%4206 = OpISub %6 %4204 %4205 +%4207 = OpLoad %6 %22 +%4208 = OpISub %6 %4206 %4207 +OpStore %313 %4208 +OpBranch %4201 +%4201 = OpLabel +%4209 = OpLoad %1035 %1054 +%4210 = OpUGreaterThanEqual %1057 %4209 %1056 +OpSelectionMerge %4212 None +OpBranchConditional %4210 %4211 %4212 +%4211 = OpLabel +%4213 = OpLoad %6 %18 +%4214 = OpLoad %6 %19 +%4215 = OpISub %6 %4213 %4214 +OpStore %314 %4215 +OpBranch %4212 +%4212 = OpLabel +%4216 = OpLoad %1035 %1054 +%4217 = OpIEqual %1057 %4216 %1094 +OpSelectionMerge %4219 None +OpBranchConditional %4217 %4218 %4219 +%4218 = OpLabel +%4220 = OpLoad %6 %16 +%4221 = OpLoad %6 %18 +%4222 = OpISub %6 %4220 %4221 +%4223 = OpLoad %6 %19 +%4224 = OpIAdd %6 %4222 %4223 +%4225 = OpLoad %6 %20 +%4226 = OpIAdd %6 %4224 %4225 +OpStore %315 %4226 +OpBranch %4219 +%4219 = OpLabel +%4227 = OpLoad %1035 %1054 +%4228 = OpULessThan %1057 %4227 %1056 +OpSelectionMerge %4230 None +OpBranchConditional %4228 %4229 %4230 +%4229 = OpLabel +%4231 = OpLoad %6 %16 +%4232 = OpLoad %6 %18 +%4233 = OpISub %6 %4231 %4232 +%4234 = OpLoad %6 %19 +%4235 = OpISub %6 %4233 %4234 +%4236 = OpLoad %6 %21 +%4237 = OpIAdd %6 %4235 %4236 +OpStore %316 %4237 +OpBranch %4230 +%4230 = OpLabel +%4238 = OpLoad %1035 %1054 +%4239 = OpULessThanEqual %1057 %4238 %1056 +OpSelectionMerge %4241 None +OpBranchConditional %4239 %4240 %4241 +%4240 = OpLabel +%4242 = OpLoad %6 %16 +%4243 = OpLoad %6 %18 +%4244 = OpISub %6 %4242 %4243 +%4245 = OpLoad %6 %19 +%4246 = OpIAdd %6 %4244 %4245 +%4247 = OpLoad %6 %22 +%4248 = OpIAdd %6 %4246 %4247 +OpStore %317 %4248 +OpBranch %4241 +%4241 = OpLabel +%4249 = OpLoad %1035 %1054 +%4250 = OpULessThanEqual %1057 %4249 %1094 +OpSelectionMerge %4252 None +OpBranchConditional %4250 %4251 %4252 +%4251 = OpLabel +%4253 = OpLoad %6 %16 +%4254 = OpLoad %6 %18 +%4255 = OpISub %6 %4253 %4254 +%4256 = OpLoad %6 %20 +%4257 = OpIAdd %6 %4255 %4256 +%4258 = OpLoad %6 %21 +%4259 = OpIAdd %6 %4257 %4258 +OpStore %318 %4259 +OpBranch %4252 +%4252 = OpLabel +%4260 = OpLoad %1035 %1054 +%4261 = OpUGreaterThanEqual %1057 %4260 %1138 +OpSelectionMerge %4263 None +OpBranchConditional %4261 %4262 %4263 +%4262 = OpLabel +%4264 = OpLoad %6 %16 +%4265 = OpLoad %6 %18 +%4266 = OpISub %6 %4264 %4265 +%4267 = OpLoad %6 %20 +%4268 = OpISub %6 %4266 %4267 +%4269 = OpLoad %6 %22 +%4270 = OpIAdd %6 %4268 %4269 +OpStore %319 %4270 +OpBranch %4263 +%4263 = OpLabel +%4271 = OpLoad %1035 %1054 +%4272 = OpULessThanEqual %1057 %4271 %1056 +OpSelectionMerge %4274 None +OpBranchConditional %4272 %4273 %4274 +%4273 = OpLabel +%4275 = OpLoad %6 %16 +%4276 = OpLoad %6 %18 +%4277 = OpIAdd %6 %4275 %4276 +%4278 = OpLoad %6 %21 +%4279 = OpIAdd %6 %4277 %4278 +%4280 = OpLoad %6 %22 +%4281 = OpISub %6 %4279 %4280 +OpStore %320 %4281 +OpBranch %4274 +%4274 = OpLabel +%4282 = OpLoad %1035 %1054 +%4283 = OpIEqual %1057 %4282 %1072 +OpSelectionMerge %4285 None +OpBranchConditional %4283 %4284 %4285 +%4284 = OpLabel +%4286 = OpLoad %6 %16 +%4287 = OpLoad %6 %19 +%4288 = OpIAdd %6 %4286 %4287 +%4289 = OpLoad %6 %20 +%4290 = OpIAdd %6 %4288 %4289 +%4291 = OpLoad %6 %21 +%4292 = OpISub %6 %4290 %4291 +OpStore %321 %4292 +OpBranch %4285 +%4285 = OpLabel +%4293 = OpLoad %1035 %1054 +%4294 = OpUGreaterThan %1057 %4293 %1138 +OpSelectionMerge %4296 None +OpBranchConditional %4294 %4295 %4296 +%4295 = OpLabel +%4297 = OpLoad %6 %16 +%4298 = OpLoad %6 %19 +%4299 = OpIAdd %6 %4297 %4298 +%4300 = OpLoad %6 %20 +%4301 = OpIAdd %6 %4299 %4300 +%4302 = OpLoad %6 %22 +%4303 = OpIAdd %6 %4301 %4302 +OpStore %322 %4303 +OpBranch %4296 +%4296 = OpLabel +%4304 = OpLoad %1035 %1054 +%4305 = OpULessThanEqual %1057 %4304 %1056 +OpSelectionMerge %4307 None +OpBranchConditional %4305 %4306 %4307 +%4306 = OpLabel +%4308 = OpLoad %6 %16 +%4309 = OpLoad %6 %19 +%4310 = OpIAdd %6 %4308 %4309 +%4311 = OpLoad %6 %21 +%4312 = OpIAdd %6 %4310 %4311 +%4313 = OpLoad %6 %22 +%4314 = OpIAdd %6 %4312 %4313 +OpStore %323 %4314 +OpBranch %4307 +%4307 = OpLabel +%4315 = OpLoad %1035 %1054 +%4316 = OpULessThan %1057 %4315 %1094 +OpSelectionMerge %4318 None +OpBranchConditional %4316 %4317 %4318 +%4317 = OpLabel +%4319 = OpLoad %6 %16 +%4320 = OpLoad %6 %20 +%4321 = OpIAdd %6 %4319 %4320 +%4322 = OpLoad %6 %21 +%4323 = OpIAdd %6 %4321 %4322 +%4324 = OpLoad %6 %22 +%4325 = OpISub %6 %4323 %4324 +OpStore %324 %4325 +OpBranch %4318 +%4318 = OpLabel +%4326 = OpLoad %1035 %1054 +%4327 = OpINotEqual %1057 %4326 %1056 +OpSelectionMerge %4329 None +OpBranchConditional %4327 %4328 %4329 +%4328 = OpLabel +%4330 = OpLoad %6 %18 +%4331 = OpLoad %6 %20 +%4332 = OpISub %6 %4330 %4331 +OpStore %325 %4332 +OpBranch %4329 +%4329 = OpLabel +%4333 = OpLoad %1035 %1054 +%4334 = OpUGreaterThanEqual %1057 %4333 %1056 +OpSelectionMerge %4336 None +OpBranchConditional %4334 %4335 %4336 +%4335 = OpLabel +%4337 = OpLoad %6 %17 +%4338 = OpLoad %6 %18 +%4339 = OpISub %6 %4337 %4338 +%4340 = OpLoad %6 %19 +%4341 = OpIAdd %6 %4339 %4340 +%4342 = OpLoad %6 %20 +%4343 = OpISub %6 %4341 %4342 +OpStore %326 %4343 +OpBranch %4336 +%4336 = OpLabel +%4344 = OpLoad %1035 %1054 +%4345 = OpUGreaterThan %1057 %4344 %1138 +OpSelectionMerge %4347 None +OpBranchConditional %4345 %4346 %4347 +%4346 = OpLabel +%4348 = OpLoad %6 %17 +%4349 = OpLoad %6 %18 +%4350 = OpIAdd %6 %4348 %4349 +%4351 = OpLoad %6 %19 +%4352 = OpIAdd %6 %4350 %4351 +%4353 = OpLoad %6 %21 +%4354 = OpISub %6 %4352 %4353 +OpStore %327 %4354 +OpBranch %4347 +%4347 = OpLabel +%4355 = OpLoad %1035 %1054 +%4356 = OpIEqual %1057 %4355 %1072 +OpSelectionMerge %4358 None +OpBranchConditional %4356 %4357 %4358 +%4357 = OpLabel +%4359 = OpLoad %6 %17 +%4360 = OpLoad %6 %18 +%4361 = OpIAdd %6 %4359 %4360 +%4362 = OpLoad %6 %19 +%4363 = OpISub %6 %4361 %4362 +%4364 = OpLoad %6 %22 +%4365 = OpISub %6 %4363 %4364 +OpStore %328 %4365 +OpBranch %4358 +%4358 = OpLabel +%4366 = OpLoad %1035 %1054 +%4367 = OpUGreaterThanEqual %1057 %4366 %1094 +OpSelectionMerge %4369 None +OpBranchConditional %4367 %4368 %4369 +%4368 = OpLabel +%4370 = OpLoad %6 %17 +%4371 = OpLoad %6 %18 +%4372 = OpISub %6 %4370 %4371 +%4373 = OpLoad %6 %20 +%4374 = OpISub %6 %4372 %4373 +%4375 = OpLoad %6 %21 +%4376 = OpISub %6 %4374 %4375 +OpStore %329 %4376 +OpBranch %4369 +%4369 = OpLabel +%4377 = OpLoad %1035 %1054 +%4378 = OpULessThan %1057 %4377 %1094 +OpSelectionMerge %4380 None +OpBranchConditional %4378 %4379 %4380 +%4379 = OpLabel +%4381 = OpLoad %6 %17 +%4382 = OpLoad %6 %18 +%4383 = OpISub %6 %4381 %4382 +%4384 = OpLoad %6 %20 +%4385 = OpISub %6 %4383 %4384 +%4386 = OpLoad %6 %22 +%4387 = OpIAdd %6 %4385 %4386 +OpStore %330 %4387 +OpBranch %4380 +%4380 = OpLabel +%4388 = OpLoad %1035 %1054 +%4389 = OpUGreaterThanEqual %1057 %4388 %1056 +OpSelectionMerge %4391 None +OpBranchConditional %4389 %4390 %4391 +%4390 = OpLabel +%4392 = OpLoad %6 %17 +%4393 = OpLoad %6 %18 +%4394 = OpIAdd %6 %4392 %4393 +%4395 = OpLoad %6 %21 +%4396 = OpISub %6 %4394 %4395 +%4397 = OpLoad %6 %22 +%4398 = OpIAdd %6 %4396 %4397 +OpStore %331 %4398 +OpBranch %4391 +%4391 = OpLabel +%4399 = OpLoad %1035 %1054 +%4400 = OpIEqual %1057 %4399 %1056 +OpSelectionMerge %4402 None +OpBranchConditional %4400 %4401 %4402 +%4401 = OpLabel +%4403 = OpLoad %6 %17 +%4404 = OpLoad %6 %19 +%4405 = OpIAdd %6 %4403 %4404 +%4406 = OpLoad %6 %20 +%4407 = OpISub %6 %4405 %4406 +%4408 = OpLoad %6 %21 +%4409 = OpISub %6 %4407 %4408 +OpStore %332 %4409 +OpBranch %4402 +%4402 = OpLabel +%4410 = OpLoad %1035 %1054 +%4411 = OpINotEqual %1057 %4410 %1094 +OpSelectionMerge %4413 None +OpBranchConditional %4411 %4412 %4413 +%4412 = OpLabel +%4414 = OpLoad %6 %17 +%4415 = OpLoad %6 %19 +%4416 = OpIAdd %6 %4414 %4415 +%4417 = OpLoad %6 %20 +%4418 = OpIAdd %6 %4416 %4417 +%4419 = OpLoad %6 %22 +%4420 = OpISub %6 %4418 %4419 +OpStore %333 %4420 +OpBranch %4413 +%4413 = OpLabel +%4421 = OpLoad %1035 %1054 +%4422 = OpUGreaterThanEqual %1057 %4421 %1094 +OpSelectionMerge %4424 None +OpBranchConditional %4422 %4423 %4424 +%4423 = OpLabel +%4425 = OpLoad %6 %17 +%4426 = OpLoad %6 %19 +%4427 = OpIAdd %6 %4425 %4426 +%4428 = OpLoad %6 %21 +%4429 = OpISub %6 %4427 %4428 +%4430 = OpLoad %6 %22 +%4431 = OpIAdd %6 %4429 %4430 +OpStore %334 %4431 +OpBranch %4424 +%4424 = OpLabel +%4432 = OpLoad %1035 %1054 +%4433 = OpUGreaterThanEqual %1057 %4432 %1138 +OpSelectionMerge %4435 None +OpBranchConditional %4433 %4434 %4435 +%4434 = OpLabel +%4436 = OpLoad %6 %17 +%4437 = OpLoad %6 %20 +%4438 = OpISub %6 %4436 %4437 +%4439 = OpLoad %6 %21 +%4440 = OpIAdd %6 %4438 %4439 +%4441 = OpLoad %6 %22 +%4442 = OpIAdd %6 %4440 %4441 +OpStore %335 %4442 +OpBranch %4435 +%4435 = OpLabel +%4443 = OpLoad %1035 %1054 +%4444 = OpULessThanEqual %1057 %4443 %1072 +OpSelectionMerge %4446 None +OpBranchConditional %4444 %4445 %4446 +%4445 = OpLabel +%4447 = OpLoad %6 %18 +%4448 = OpLoad %6 %21 +%4449 = OpIAdd %6 %4447 %4448 +OpStore %336 %4449 +OpBranch %4446 +%4446 = OpLabel +%4450 = OpLoad %1035 %1054 +%4451 = OpUGreaterThanEqual %1057 %4450 %1094 +OpSelectionMerge %4453 None +OpBranchConditional %4451 %4452 %4453 +%4452 = OpLabel +%4454 = OpLoad %6 %18 +%4455 = OpLoad %6 %19 +%4456 = OpISub %6 %4454 %4455 +%4457 = OpLoad %6 %20 +%4458 = OpISub %6 %4456 %4457 +%4459 = OpLoad %6 %21 +%4460 = OpISub %6 %4458 %4459 +OpStore %337 %4460 +OpBranch %4453 +%4453 = OpLabel +%4461 = OpLoad %1035 %1054 +%4462 = OpIEqual %1057 %4461 %1072 +OpSelectionMerge %4464 None +OpBranchConditional %4462 %4463 %4464 +%4463 = OpLabel +%4465 = OpLoad %6 %18 +%4466 = OpLoad %6 %19 +%4467 = OpISub %6 %4465 %4466 +%4468 = OpLoad %6 %20 +%4469 = OpISub %6 %4467 %4468 +%4470 = OpLoad %6 %22 +%4471 = OpIAdd %6 %4469 %4470 +OpStore %338 %4471 +OpBranch %4464 +%4464 = OpLabel +%4472 = OpLoad %1035 %1054 +%4473 = OpINotEqual %1057 %4472 %1138 +OpSelectionMerge %4475 None +OpBranchConditional %4473 %4474 %4475 +%4474 = OpLabel +%4476 = OpLoad %6 %18 +%4477 = OpLoad %6 %19 +%4478 = OpISub %6 %4476 %4477 +%4479 = OpLoad %6 %21 +%4480 = OpIAdd %6 %4478 %4479 +%4481 = OpLoad %6 %22 +%4482 = OpISub %6 %4480 %4481 +OpStore %339 %4482 +OpBranch %4475 +%4475 = OpLabel +%4483 = OpLoad %1035 %1054 +%4484 = OpULessThanEqual %1057 %4483 %1056 +OpSelectionMerge %4486 None +OpBranchConditional %4484 %4485 %4486 +%4485 = OpLabel +%4487 = OpLoad %6 %18 +%4488 = OpLoad %6 %20 +%4489 = OpISub %6 %4487 %4488 +%4490 = OpLoad %6 %21 +%4491 = OpISub %6 %4489 %4490 +%4492 = OpLoad %6 %22 +%4493 = OpIAdd %6 %4491 %4492 +OpStore %340 %4493 +OpBranch %4486 +%4486 = OpLabel +%4494 = OpLoad %1035 %1054 +%4495 = OpULessThanEqual %1057 %4494 %1094 +OpSelectionMerge %4497 None +OpBranchConditional %4495 %4496 %4497 +%4496 = OpLabel +%4498 = OpLoad %6 %19 +%4499 = OpLoad %6 %20 +%4500 = OpIAdd %6 %4498 %4499 +%4501 = OpLoad %6 %21 +%4502 = OpIAdd %6 %4500 %4501 +%4503 = OpLoad %6 %22 +%4504 = OpIAdd %6 %4502 %4503 +OpStore %341 %4504 +OpBranch %4497 +%4497 = OpLabel +%4505 = OpLoad %1035 %1054 +%4506 = OpULessThanEqual %1057 %4505 %1138 +OpSelectionMerge %4508 None +OpBranchConditional %4506 %4507 %4508 +%4507 = OpLabel +%4509 = OpLoad %6 %13 +%4510 = OpLoad %6 %14 +%4511 = OpIAdd %6 %4509 %4510 +%4512 = OpLoad %6 %15 +%4513 = OpIAdd %6 %4511 %4512 +%4514 = OpLoad %6 %16 +%4515 = OpIAdd %6 %4513 %4514 +%4516 = OpLoad %6 %17 +%4517 = OpISub %6 %4515 %4516 +OpStore %342 %4517 +OpBranch %4508 +%4508 = OpLabel +%4518 = OpLoad %1035 %1054 +%4519 = OpULessThan %1057 %4518 %1094 +OpSelectionMerge %4521 None +OpBranchConditional %4519 %4520 %4521 +%4520 = OpLabel +%4522 = OpLoad %6 %13 +%4523 = OpLoad %6 %14 +%4524 = OpIAdd %6 %4522 %4523 +%4525 = OpLoad %6 %15 +%4526 = OpIAdd %6 %4524 %4525 +%4527 = OpLoad %6 %16 +%4528 = OpISub %6 %4526 %4527 +%4529 = OpLoad %6 %18 +%4530 = OpISub %6 %4528 %4529 +OpStore %343 %4530 +OpBranch %4521 +%4521 = OpLabel +%4531 = OpLoad %1035 %1054 +%4532 = OpUGreaterThan %1057 %4531 %1056 +OpSelectionMerge %4534 None +OpBranchConditional %4532 %4533 %4534 +%4533 = OpLabel +%4535 = OpLoad %6 %13 +%4536 = OpLoad %6 %14 +%4537 = OpIAdd %6 %4535 %4536 +%4538 = OpLoad %6 %15 +%4539 = OpISub %6 %4537 %4538 +%4540 = OpLoad %6 %16 +%4541 = OpIAdd %6 %4539 %4540 +%4542 = OpLoad %6 %19 +%4543 = OpIAdd %6 %4541 %4542 +OpStore %344 %4543 +OpBranch %4534 +%4534 = OpLabel +%4544 = OpLoad %1035 %1054 +%4545 = OpINotEqual %1057 %4544 %1094 +OpSelectionMerge %4547 None +OpBranchConditional %4545 %4546 %4547 +%4546 = OpLabel +%4548 = OpLoad %6 %13 +%4549 = OpLoad %6 %14 +%4550 = OpISub %6 %4548 %4549 +%4551 = OpLoad %6 %15 +%4552 = OpISub %6 %4550 %4551 +%4553 = OpLoad %6 %16 +%4554 = OpISub %6 %4552 %4553 +%4555 = OpLoad %6 %20 +%4556 = OpIAdd %6 %4554 %4555 +OpStore %345 %4556 +OpBranch %4547 +%4547 = OpLabel +%4557 = OpLoad %1035 %1054 +%4558 = OpUGreaterThanEqual %1057 %4557 %1056 +OpSelectionMerge %4560 None +OpBranchConditional %4558 %4559 %4560 +%4559 = OpLabel +%4561 = OpLoad %6 %13 +%4562 = OpLoad %6 %14 +%4563 = OpISub %6 %4561 %4562 +%4564 = OpLoad %6 %15 +%4565 = OpISub %6 %4563 %4564 +%4566 = OpLoad %6 %16 +%4567 = OpIAdd %6 %4565 %4566 +%4568 = OpLoad %6 %21 +%4569 = OpISub %6 %4567 %4568 +OpStore %346 %4569 +OpBranch %4560 +%4560 = OpLabel +%4570 = OpLoad %1035 %1054 +%4571 = OpULessThanEqual %1057 %4570 %1056 +OpSelectionMerge %4573 None +OpBranchConditional %4571 %4572 %4573 +%4572 = OpLabel +%4574 = OpLoad %6 %18 +%4575 = OpLoad %6 %22 +%4576 = OpISub %6 %4574 %4575 +OpStore %347 %4576 +OpBranch %4573 +%4573 = OpLabel +%4577 = OpLoad %1035 %1054 +%4578 = OpULessThanEqual %1057 %4577 %1094 +OpSelectionMerge %4580 None +OpBranchConditional %4578 %4579 %4580 +%4579 = OpLabel +%4581 = OpLoad %6 %13 +%4582 = OpLoad %6 %14 +%4583 = OpISub %6 %4581 %4582 +%4584 = OpLoad %6 %15 +%4585 = OpISub %6 %4583 %4584 +%4586 = OpLoad %6 %16 +%4587 = OpISub %6 %4585 %4586 +%4588 = OpLoad %6 %22 +%4589 = OpISub %6 %4587 %4588 +OpStore %348 %4589 +OpBranch %4580 +%4580 = OpLabel +%4590 = OpLoad %1035 %1054 +%4591 = OpULessThan %1057 %4590 %1056 +OpSelectionMerge %4593 None +OpBranchConditional %4591 %4592 %4593 +%4592 = OpLabel +%4594 = OpLoad %6 %13 +%4595 = OpLoad %6 %14 +%4596 = OpIAdd %6 %4594 %4595 +%4597 = OpLoad %6 %15 +%4598 = OpIAdd %6 %4596 %4597 +%4599 = OpLoad %6 %17 +%4600 = OpIAdd %6 %4598 %4599 +%4601 = OpLoad %6 %18 +%4602 = OpISub %6 %4600 %4601 +OpStore %349 %4602 +OpBranch %4593 +%4593 = OpLabel +%4603 = OpLoad %1035 %1054 +%4604 = OpUGreaterThanEqual %1057 %4603 %1094 +OpSelectionMerge %4606 None +OpBranchConditional %4604 %4605 %4606 +%4605 = OpLabel +%4607 = OpLoad %6 %13 +%4608 = OpLoad %6 %14 +%4609 = OpISub %6 %4607 %4608 +%4610 = OpLoad %6 %15 +%4611 = OpIAdd %6 %4609 %4610 +%4612 = OpLoad %6 %17 +%4613 = OpIAdd %6 %4611 %4612 +%4614 = OpLoad %6 %19 +%4615 = OpIAdd %6 %4613 %4614 +OpStore %350 %4615 +OpBranch %4606 +%4606 = OpLabel +%4616 = OpLoad %1035 %1054 +%4617 = OpULessThanEqual %1057 %4616 %1072 +OpSelectionMerge %4619 None +OpBranchConditional %4617 %4618 %4619 +%4618 = OpLabel +%4620 = OpLoad %6 %13 +%4621 = OpLoad %6 %14 +%4622 = OpISub %6 %4620 %4621 +%4623 = OpLoad %6 %15 +%4624 = OpIAdd %6 %4622 %4623 +%4625 = OpLoad %6 %17 +%4626 = OpISub %6 %4624 %4625 +%4627 = OpLoad %6 %20 +%4628 = OpISub %6 %4626 %4627 +OpStore %351 %4628 +OpBranch %4619 +%4619 = OpLabel +%4629 = OpLoad %1035 %1054 +%4630 = OpINotEqual %1057 %4629 %1072 +OpSelectionMerge %4632 None +OpBranchConditional %4630 %4631 %4632 +%4631 = OpLabel +%4633 = OpLoad %6 %13 +%4634 = OpLoad %6 %14 +%4635 = OpIAdd %6 %4633 %4634 +%4636 = OpLoad %6 %15 +%4637 = OpISub %6 %4635 %4636 +%4638 = OpLoad %6 %17 +%4639 = OpIAdd %6 %4637 %4638 +%4640 = OpLoad %6 %21 +%4641 = OpISub %6 %4639 %4640 +OpStore %352 %4641 +OpBranch %4632 +%4632 = OpLabel +%4642 = OpLoad %1035 %1054 +%4643 = OpINotEqual %1057 %4642 %1138 +OpSelectionMerge %4645 None +OpBranchConditional %4643 %4644 %4645 +%4644 = OpLabel +%4646 = OpLoad %6 %13 +%4647 = OpLoad %6 %14 +%4648 = OpISub %6 %4646 %4647 +%4649 = OpLoad %6 %15 +%4650 = OpIAdd %6 %4648 %4649 +%4651 = OpLoad %6 %17 +%4652 = OpIAdd %6 %4650 %4651 +%4653 = OpLoad %6 %22 +%4654 = OpISub %6 %4652 %4653 +OpStore %353 %4654 +OpBranch %4645 +%4645 = OpLabel +%4655 = OpLoad %1035 %1054 +%4656 = OpULessThanEqual %1057 %4655 %1056 +OpSelectionMerge %4658 None +OpBranchConditional %4656 %4657 %4658 +%4657 = OpLabel +%4659 = OpLoad %6 %13 +%4660 = OpLoad %6 %14 +%4661 = OpIAdd %6 %4659 %4660 +%4662 = OpLoad %6 %15 +%4663 = OpIAdd %6 %4661 %4662 +%4664 = OpLoad %6 %18 +%4665 = OpISub %6 %4663 %4664 +%4666 = OpLoad %6 %19 +%4667 = OpIAdd %6 %4665 %4666 +OpStore %354 %4667 +OpBranch %4658 +%4658 = OpLabel +%4668 = OpLoad %1035 %1054 +%4669 = OpULessThan %1057 %4668 %1072 +OpSelectionMerge %4671 None +OpBranchConditional %4669 %4670 %4671 +%4670 = OpLabel +%4672 = OpLoad %6 %13 +%4673 = OpLoad %6 %14 +%4674 = OpISub %6 %4672 %4673 +%4675 = OpLoad %6 %15 +%4676 = OpISub %6 %4674 %4675 +%4677 = OpLoad %6 %18 +%4678 = OpIAdd %6 %4676 %4677 +%4679 = OpLoad %6 %20 +%4680 = OpISub %6 %4678 %4679 +OpStore %355 %4680 +OpBranch %4671 +%4671 = OpLabel +%4681 = OpLoad %1035 %1054 +%4682 = OpUGreaterThan %1057 %4681 %1072 +OpSelectionMerge %4684 None +OpBranchConditional %4682 %4683 %4684 +%4683 = OpLabel +%4685 = OpLoad %6 %13 +%4686 = OpLoad %6 %14 +%4687 = OpIAdd %6 %4685 %4686 +%4688 = OpLoad %6 %15 +%4689 = OpIAdd %6 %4687 %4688 +%4690 = OpLoad %6 %18 +%4691 = OpISub %6 %4689 %4690 +%4692 = OpLoad %6 %21 +%4693 = OpISub %6 %4691 %4692 +OpStore %356 %4693 +OpBranch %4684 +%4684 = OpLabel +%4694 = OpLoad %1035 %1054 +%4695 = OpULessThanEqual %1057 %4694 %1138 +OpSelectionMerge %4697 None +OpBranchConditional %4695 %4696 %4697 +%4696 = OpLabel +%4698 = OpLoad %6 %13 +%4699 = OpLoad %6 %14 +%4700 = OpIAdd %6 %4698 %4699 +%4701 = OpLoad %6 %15 +%4702 = OpISub %6 %4700 %4701 +%4703 = OpLoad %6 %18 +%4704 = OpISub %6 %4702 %4703 +%4705 = OpLoad %6 %22 +%4706 = OpISub %6 %4704 %4705 +OpStore %357 %4706 +OpBranch %4697 +%4697 = OpLabel +%4707 = OpLoad %1035 %1054 +%4708 = OpULessThanEqual %1057 %4707 %1138 +OpSelectionMerge %4710 None +OpBranchConditional %4708 %4709 %4710 +%4709 = OpLabel +%4711 = OpLoad %6 %19 +%4712 = OpLoad %6 %20 +%4713 = OpISub %6 %4711 %4712 +OpStore %358 %4713 +OpBranch %4710 +%4710 = OpLabel +%4714 = OpLoad %1035 %1054 +%4715 = OpIEqual %1057 %4714 %1056 +OpSelectionMerge %4717 None +OpBranchConditional %4715 %4716 %4717 +%4716 = OpLabel +%4718 = OpLoad %6 %13 +%4719 = OpLoad %6 %14 +%4720 = OpIAdd %6 %4718 %4719 +%4721 = OpLoad %6 %15 +%4722 = OpIAdd %6 %4720 %4721 +%4723 = OpLoad %6 %19 +%4724 = OpIAdd %6 %4722 %4723 +%4725 = OpLoad %6 %20 +%4726 = OpISub %6 %4724 %4725 +OpStore %359 %4726 +OpBranch %4717 +%4717 = OpLabel +%4727 = OpLoad %1035 %1054 +%4728 = OpINotEqual %1057 %4727 %1072 +OpSelectionMerge %4730 None +OpBranchConditional %4728 %4729 %4730 +%4729 = OpLabel +%4731 = OpLoad %6 %13 +%4732 = OpLoad %6 %14 +%4733 = OpIAdd %6 %4731 %4732 +%4734 = OpLoad %6 %15 +%4735 = OpISub %6 %4733 %4734 +%4736 = OpLoad %6 %19 +%4737 = OpISub %6 %4735 %4736 +%4738 = OpLoad %6 %21 +%4739 = OpIAdd %6 %4737 %4738 +OpStore %360 %4739 +OpBranch %4730 +%4730 = OpLabel +%4740 = OpLoad %1035 %1054 +%4741 = OpIEqual %1057 %4740 %1094 +OpSelectionMerge %4743 None +OpBranchConditional %4741 %4742 %4743 +%4742 = OpLabel +%4744 = OpLoad %6 %13 +%4745 = OpLoad %6 %14 +%4746 = OpISub %6 %4744 %4745 +%4747 = OpLoad %6 %15 +%4748 = OpIAdd %6 %4746 %4747 +%4749 = OpLoad %6 %19 +%4750 = OpISub %6 %4748 %4749 +%4751 = OpLoad %6 %22 +%4752 = OpISub %6 %4750 %4751 +OpStore %361 %4752 +OpBranch %4743 +%4743 = OpLabel +%4753 = OpLoad %1035 %1054 +%4754 = OpINotEqual %1057 %4753 %1094 +OpSelectionMerge %4756 None +OpBranchConditional %4754 %4755 %4756 +%4755 = OpLabel +%4757 = OpLoad %6 %13 +%4758 = OpLoad %6 %14 +%4759 = OpIAdd %6 %4757 %4758 +%4760 = OpLoad %6 %15 +%4761 = OpISub %6 %4759 %4760 +%4762 = OpLoad %6 %20 +%4763 = OpISub %6 %4761 %4762 +%4764 = OpLoad %6 %21 +%4765 = OpIAdd %6 %4763 %4764 +OpStore %362 %4765 +OpBranch %4756 +%4756 = OpLabel +%4766 = OpLoad %1035 %1054 +%4767 = OpULessThanEqual %1057 %4766 %1094 +OpSelectionMerge %4769 None +OpBranchConditional %4767 %4768 %4769 +%4768 = OpLabel +%4770 = OpLoad %6 %13 +%4771 = OpLoad %6 %14 +%4772 = OpIAdd %6 %4770 %4771 +%4773 = OpLoad %6 %15 +%4774 = OpIAdd %6 %4772 %4773 +%4775 = OpLoad %6 %20 +%4776 = OpISub %6 %4774 %4775 +%4777 = OpLoad %6 %22 +%4778 = OpIAdd %6 %4776 %4777 +OpStore %363 %4778 +OpBranch %4769 +%4769 = OpLabel +%4779 = OpLoad %1035 %1054 +%4780 = OpUGreaterThanEqual %1057 %4779 %1094 +OpSelectionMerge %4782 None +OpBranchConditional %4780 %4781 %4782 +%4781 = OpLabel +%4783 = OpLoad %6 %13 +%4784 = OpLoad %6 %14 +%4785 = OpIAdd %6 %4783 %4784 +%4786 = OpLoad %6 %15 +%4787 = OpIAdd %6 %4785 %4786 +%4788 = OpLoad %6 %21 +%4789 = OpIAdd %6 %4787 %4788 +%4790 = OpLoad %6 %22 +%4791 = OpIAdd %6 %4789 %4790 +OpStore %364 %4791 +OpBranch %4782 +%4782 = OpLabel +%4792 = OpLoad %1035 %1054 +%4793 = OpIEqual %1057 %4792 %1056 +OpSelectionMerge %4795 None +OpBranchConditional %4793 %4794 %4795 +%4794 = OpLabel +%4796 = OpLoad %6 %13 +%4797 = OpLoad %6 %14 +%4798 = OpIAdd %6 %4796 %4797 +%4799 = OpLoad %6 %16 +%4800 = OpIAdd %6 %4798 %4799 +%4801 = OpLoad %6 %17 +%4802 = OpISub %6 %4800 %4801 +%4803 = OpLoad %6 %18 +%4804 = OpIAdd %6 %4802 %4803 +OpStore %365 %4804 +OpBranch %4795 +%4795 = OpLabel +%4805 = OpLoad %1035 %1054 +%4806 = OpIEqual %1057 %4805 %1072 +OpSelectionMerge %4808 None +OpBranchConditional %4806 %4807 %4808 +%4807 = OpLabel +%4809 = OpLoad %6 %13 +%4810 = OpLoad %6 %14 +%4811 = OpIAdd %6 %4809 %4810 +%4812 = OpLoad %6 %16 +%4813 = OpISub %6 %4811 %4812 +%4814 = OpLoad %6 %17 +%4815 = OpIAdd %6 %4813 %4814 +%4816 = OpLoad %6 %19 +%4817 = OpISub %6 %4815 %4816 +OpStore %366 %4817 +OpBranch %4808 +%4808 = OpLabel +%4818 = OpLoad %1035 %1054 +%4819 = OpUGreaterThan %1057 %4818 %1094 +OpSelectionMerge %4821 None +OpBranchConditional %4819 %4820 %4821 +%4820 = OpLabel +%4822 = OpLoad %6 %13 +%4823 = OpLoad %6 %14 +%4824 = OpIAdd %6 %4822 %4823 +%4825 = OpLoad %6 %16 +%4826 = OpISub %6 %4824 %4825 +%4827 = OpLoad %6 %17 +%4828 = OpISub %6 %4826 %4827 +%4829 = OpLoad %6 %20 +%4830 = OpISub %6 %4828 %4829 +OpStore %367 %4830 +OpBranch %4821 +%4821 = OpLabel +%4831 = OpLoad %1035 %1054 +%4832 = OpUGreaterThanEqual %1057 %4831 %1072 +OpSelectionMerge %4834 None +OpBranchConditional %4832 %4833 %4834 +%4833 = OpLabel +%4835 = OpLoad %6 %13 +%4836 = OpLoad %6 %14 +%4837 = OpISub %6 %4835 %4836 +%4838 = OpLoad %6 %16 +%4839 = OpIAdd %6 %4837 %4838 +%4840 = OpLoad %6 %17 +%4841 = OpISub %6 %4839 %4840 +%4842 = OpLoad %6 %21 +%4843 = OpIAdd %6 %4841 %4842 +OpStore %368 %4843 +OpBranch %4834 +%4834 = OpLabel +%4844 = OpLoad %1035 %1054 +%4845 = OpULessThanEqual %1057 %4844 %1072 +OpSelectionMerge %4847 None +OpBranchConditional %4845 %4846 %4847 +%4846 = OpLabel +%4848 = OpLoad %6 %13 +%4849 = OpLoad %6 %18 +%4850 = OpISub %6 %4848 %4849 +OpStore %369 %4850 +OpBranch %4847 +%4847 = OpLabel +%4851 = OpLoad %1035 %1054 +%4852 = OpINotEqual %1057 %4851 %1072 +OpSelectionMerge %4854 None +OpBranchConditional %4852 %4853 %4854 +%4853 = OpLabel +%4855 = OpLoad %6 %19 +%4856 = OpLoad %6 %21 +%4857 = OpIAdd %6 %4855 %4856 +OpStore %370 %4857 +OpBranch %4854 +%4854 = OpLabel +%4858 = OpLoad %1035 %1054 +%4859 = OpUGreaterThan %1057 %4858 %1094 +OpSelectionMerge %4861 None +OpBranchConditional %4859 %4860 %4861 +%4860 = OpLabel +%4862 = OpLoad %6 %13 +%4863 = OpLoad %6 %14 +%4864 = OpISub %6 %4862 %4863 +%4865 = OpLoad %6 %16 +%4866 = OpIAdd %6 %4864 %4865 +%4867 = OpLoad %6 %17 +%4868 = OpISub %6 %4866 %4867 +%4869 = OpLoad %6 %22 +%4870 = OpISub %6 %4868 %4869 +OpStore %371 %4870 +OpBranch %4861 +%4861 = OpLabel +%4871 = OpLoad %1035 %1054 +%4872 = OpINotEqual %1057 %4871 %1072 +OpSelectionMerge %4874 None +OpBranchConditional %4872 %4873 %4874 +%4873 = OpLabel +%4875 = OpLoad %6 %13 +%4876 = OpLoad %6 %14 +%4877 = OpIAdd %6 %4875 %4876 +%4878 = OpLoad %6 %16 +%4879 = OpISub %6 %4877 %4878 +%4880 = OpLoad %6 %18 +%4881 = OpISub %6 %4879 %4880 +%4882 = OpLoad %6 %19 +%4883 = OpIAdd %6 %4881 %4882 +OpStore %372 %4883 +OpBranch %4874 +%4874 = OpLabel +%4884 = OpLoad %1035 %1054 +%4885 = OpUGreaterThanEqual %1057 %4884 %1056 +OpSelectionMerge %4887 None +OpBranchConditional %4885 %4886 %4887 +%4886 = OpLabel +%4888 = OpLoad %6 %13 +%4889 = OpLoad %6 %14 +%4890 = OpISub %6 %4888 %4889 +%4891 = OpLoad %6 %16 +%4892 = OpIAdd %6 %4890 %4891 +%4893 = OpLoad %6 %18 +%4894 = OpISub %6 %4892 %4893 +%4895 = OpLoad %6 %20 +%4896 = OpIAdd %6 %4894 %4895 +OpStore %373 %4896 +OpBranch %4887 +%4887 = OpLabel +%4897 = OpLoad %1035 %1054 +%4898 = OpULessThan %1057 %4897 %1094 +OpSelectionMerge %4900 None +OpBranchConditional %4898 %4899 %4900 +%4899 = OpLabel +%4901 = OpLoad %6 %13 +%4902 = OpLoad %6 %14 +%4903 = OpIAdd %6 %4901 %4902 +%4904 = OpLoad %6 %16 +%4905 = OpIAdd %6 %4903 %4904 +%4906 = OpLoad %6 %18 +%4907 = OpISub %6 %4905 %4906 +%4908 = OpLoad %6 %21 +%4909 = OpIAdd %6 %4907 %4908 +OpStore %374 %4909 +OpBranch %4900 +%4900 = OpLabel +%4910 = OpLoad %1035 %1054 +%4911 = OpULessThan %1057 %4910 %1056 +OpSelectionMerge %4913 None +OpBranchConditional %4911 %4912 %4913 +%4912 = OpLabel +%4914 = OpLoad %6 %13 +%4915 = OpLoad %6 %14 +%4916 = OpIAdd %6 %4914 %4915 +%4917 = OpLoad %6 %16 +%4918 = OpISub %6 %4916 %4917 +%4919 = OpLoad %6 %18 +%4920 = OpISub %6 %4918 %4919 +%4921 = OpLoad %6 %22 +%4922 = OpISub %6 %4920 %4921 +OpStore %375 %4922 +OpBranch %4913 +%4913 = OpLabel +%4923 = OpLoad %1035 %1054 +%4924 = OpULessThan %1057 %4923 %1094 +OpSelectionMerge %4926 None +OpBranchConditional %4924 %4925 %4926 +%4925 = OpLabel +%4927 = OpLoad %6 %13 +%4928 = OpLoad %6 %14 +%4929 = OpISub %6 %4927 %4928 +%4930 = OpLoad %6 %16 +%4931 = OpIAdd %6 %4929 %4930 +%4932 = OpLoad %6 %19 +%4933 = OpIAdd %6 %4931 %4932 +%4934 = OpLoad %6 %20 +%4935 = OpIAdd %6 %4933 %4934 +OpStore %376 %4935 +OpBranch %4926 +%4926 = OpLabel +%4936 = OpLoad %1035 %1054 +%4937 = OpIEqual %1057 %4936 %1056 +OpSelectionMerge %4939 None +OpBranchConditional %4937 %4938 %4939 +%4938 = OpLabel +%4940 = OpLoad %6 %13 +%4941 = OpLoad %6 %14 +%4942 = OpIAdd %6 %4940 %4941 +%4943 = OpLoad %6 %16 +%4944 = OpISub %6 %4942 %4943 +%4945 = OpLoad %6 %19 +%4946 = OpISub %6 %4944 %4945 +%4947 = OpLoad %6 %21 +%4948 = OpIAdd %6 %4946 %4947 +OpStore %377 %4948 +OpBranch %4939 +%4939 = OpLabel +%4949 = OpLoad %1035 %1054 +%4950 = OpIEqual %1057 %4949 %1138 +OpSelectionMerge %4952 None +OpBranchConditional %4950 %4951 %4952 +%4951 = OpLabel +%4953 = OpLoad %6 %13 +%4954 = OpLoad %6 %14 +%4955 = OpISub %6 %4953 %4954 +%4956 = OpLoad %6 %16 +%4957 = OpIAdd %6 %4955 %4956 +%4958 = OpLoad %6 %19 +%4959 = OpISub %6 %4957 %4958 +%4960 = OpLoad %6 %22 +%4961 = OpISub %6 %4959 %4960 +OpStore %378 %4961 +OpBranch %4952 +%4952 = OpLabel +%4962 = OpLoad %1035 %1054 +%4963 = OpINotEqual %1057 %4962 %1056 +OpSelectionMerge %4965 None +OpBranchConditional %4963 %4964 %4965 +%4964 = OpLabel +%4966 = OpLoad %6 %13 +%4967 = OpLoad %6 %14 +%4968 = OpISub %6 %4966 %4967 +%4969 = OpLoad %6 %16 +%4970 = OpIAdd %6 %4968 %4969 +%4971 = OpLoad %6 %20 +%4972 = OpISub %6 %4970 %4971 +%4973 = OpLoad %6 %21 +%4974 = OpIAdd %6 %4972 %4973 +OpStore %379 %4974 +OpBranch %4965 +%4965 = OpLabel +%4975 = OpLoad %1035 %1054 +%4976 = OpINotEqual %1057 %4975 %1072 +OpSelectionMerge %4978 None +OpBranchConditional %4976 %4977 %4978 +%4977 = OpLabel +%4979 = OpLoad %6 %13 +%4980 = OpLoad %6 %14 +%4981 = OpISub %6 %4979 %4980 +%4982 = OpLoad %6 %16 +%4983 = OpIAdd %6 %4981 %4982 +%4984 = OpLoad %6 %20 +%4985 = OpIAdd %6 %4983 %4984 +%4986 = OpLoad %6 %22 +%4987 = OpISub %6 %4985 %4986 +OpStore %380 %4987 +OpBranch %4978 +%4978 = OpLabel +%4988 = OpLoad %1035 %1054 +%4989 = OpINotEqual %1057 %4988 %1072 +OpSelectionMerge %4991 None +OpBranchConditional %4989 %4990 %4991 +%4990 = OpLabel +%4992 = OpLoad %6 %19 +%4993 = OpLoad %6 %22 +%4994 = OpISub %6 %4992 %4993 +OpStore %381 %4994 +OpBranch %4991 +%4991 = OpLabel +%4995 = OpLoad %1035 %1054 +%4996 = OpINotEqual %1057 %4995 %1138 +OpSelectionMerge %4998 None +OpBranchConditional %4996 %4997 %4998 +%4997 = OpLabel +%4999 = OpLoad %6 %13 +%5000 = OpLoad %6 %14 +%5001 = OpISub %6 %4999 %5000 +%5002 = OpLoad %6 %16 +%5003 = OpIAdd %6 %5001 %5002 +%5004 = OpLoad %6 %21 +%5005 = OpIAdd %6 %5003 %5004 +%5006 = OpLoad %6 %22 +%5007 = OpIAdd %6 %5005 %5006 +OpStore %382 %5007 +OpBranch %4998 +%4998 = OpLabel +%5008 = OpLoad %1035 %1054 +%5009 = OpULessThan %1057 %5008 %1056 +OpSelectionMerge %5011 None +OpBranchConditional %5009 %5010 %5011 +%5010 = OpLabel +%5012 = OpLoad %6 %13 +%5013 = OpLoad %6 %14 +%5014 = OpISub %6 %5012 %5013 +%5015 = OpLoad %6 %17 +%5016 = OpISub %6 %5014 %5015 +%5017 = OpLoad %6 %18 +%5018 = OpIAdd %6 %5016 %5017 +%5019 = OpLoad %6 %19 +%5020 = OpIAdd %6 %5018 %5019 +OpStore %383 %5020 +OpBranch %5011 +%5011 = OpLabel +%5021 = OpLoad %1035 %1054 +%5022 = OpULessThan %1057 %5021 %1094 +OpSelectionMerge %5024 None +OpBranchConditional %5022 %5023 %5024 +%5023 = OpLabel +%5025 = OpLoad %6 %13 +%5026 = OpLoad %6 %14 +%5027 = OpIAdd %6 %5025 %5026 +%5028 = OpLoad %6 %17 +%5029 = OpISub %6 %5027 %5028 +%5030 = OpLoad %6 %18 +%5031 = OpISub %6 %5029 %5030 +%5032 = OpLoad %6 %20 +%5033 = OpISub %6 %5031 %5032 +OpStore %384 %5033 +OpBranch %5024 +%5024 = OpLabel +%5034 = OpLoad %1035 %1054 +%5035 = OpULessThan %1057 %5034 %1094 +OpSelectionMerge %5037 None +OpBranchConditional %5035 %5036 %5037 +%5036 = OpLabel +%5038 = OpLoad %6 %13 +%5039 = OpLoad %6 %14 +%5040 = OpIAdd %6 %5038 %5039 +%5041 = OpLoad %6 %17 +%5042 = OpIAdd %6 %5040 %5041 +%5043 = OpLoad %6 %18 +%5044 = OpISub %6 %5042 %5043 +%5045 = OpLoad %6 %21 +%5046 = OpIAdd %6 %5044 %5045 +OpStore %385 %5046 +OpBranch %5037 +%5037 = OpLabel +%5047 = OpLoad %1035 %1054 +%5048 = OpULessThan %1057 %5047 %1056 +OpSelectionMerge %5050 None +OpBranchConditional %5048 %5049 %5050 +%5049 = OpLabel +%5051 = OpLoad %6 %13 +%5052 = OpLoad %6 %14 +%5053 = OpIAdd %6 %5051 %5052 +%5054 = OpLoad %6 %17 +%5055 = OpISub %6 %5053 %5054 +%5056 = OpLoad %6 %18 +%5057 = OpISub %6 %5055 %5056 +%5058 = OpLoad %6 %22 +%5059 = OpIAdd %6 %5057 %5058 +OpStore %386 %5059 +OpBranch %5050 +%5050 = OpLabel +%5060 = OpLoad %1035 %1054 +%5061 = OpUGreaterThan %1057 %5060 %1072 +OpSelectionMerge %5063 None +OpBranchConditional %5061 %5062 %5063 +%5062 = OpLabel +%5064 = OpLoad %6 %13 +%5065 = OpLoad %6 %14 +%5066 = OpIAdd %6 %5064 %5065 +%5067 = OpLoad %6 %17 +%5068 = OpISub %6 %5066 %5067 +%5069 = OpLoad %6 %19 +%5070 = OpISub %6 %5068 %5069 +%5071 = OpLoad %6 %20 +%5072 = OpIAdd %6 %5070 %5071 +OpStore %387 %5072 +OpBranch %5063 +%5063 = OpLabel +%5073 = OpLoad %1035 %1054 +%5074 = OpUGreaterThan %1057 %5073 %1138 +OpSelectionMerge %5076 None +OpBranchConditional %5074 %5075 %5076 +%5075 = OpLabel +%5077 = OpLoad %6 %13 +%5078 = OpLoad %6 %14 +%5079 = OpIAdd %6 %5077 %5078 +%5080 = OpLoad %6 %17 +%5081 = OpISub %6 %5079 %5080 +%5082 = OpLoad %6 %19 +%5083 = OpISub %6 %5081 %5082 +%5084 = OpLoad %6 %21 +%5085 = OpIAdd %6 %5083 %5084 +OpStore %388 %5085 +OpBranch %5076 +%5076 = OpLabel +%5086 = OpLoad %1035 %1054 +%5087 = OpULessThanEqual %1057 %5086 %1094 +OpSelectionMerge %5089 None +OpBranchConditional %5087 %5088 %5089 +%5088 = OpLabel +%5090 = OpLoad %6 %13 +%5091 = OpLoad %6 %14 +%5092 = OpISub %6 %5090 %5091 +%5093 = OpLoad %6 %17 +%5094 = OpISub %6 %5092 %5093 +%5095 = OpLoad %6 %19 +%5096 = OpIAdd %6 %5094 %5095 +%5097 = OpLoad %6 %22 +%5098 = OpISub %6 %5096 %5097 +OpStore %389 %5098 +OpBranch %5089 +%5089 = OpLabel +%5099 = OpLoad %1035 %1054 +%5100 = OpUGreaterThanEqual %1057 %5099 %1094 +OpSelectionMerge %5102 None +OpBranchConditional %5100 %5101 %5102 +%5101 = OpLabel +%5103 = OpLoad %6 %13 +%5104 = OpLoad %6 %14 +%5105 = OpISub %6 %5103 %5104 +%5106 = OpLoad %6 %17 +%5107 = OpIAdd %6 %5105 %5106 +%5108 = OpLoad %6 %20 +%5109 = OpIAdd %6 %5107 %5108 +%5110 = OpLoad %6 %21 +%5111 = OpISub %6 %5109 %5110 +OpStore %390 %5111 +OpBranch %5102 +%5102 = OpLabel +%5112 = OpLoad %1035 %1054 +%5113 = OpINotEqual %1057 %5112 %1056 +OpSelectionMerge %5115 None +OpBranchConditional %5113 %5114 %5115 +%5114 = OpLabel +%5116 = OpLoad %6 %13 +%5117 = OpLoad %6 %14 +%5118 = OpIAdd %6 %5116 %5117 +%5119 = OpLoad %6 %17 +%5120 = OpIAdd %6 %5118 %5119 +%5121 = OpLoad %6 %20 +%5122 = OpIAdd %6 %5120 %5121 +%5123 = OpLoad %6 %22 +%5124 = OpISub %6 %5122 %5123 +OpStore %391 %5124 +OpBranch %5115 +%5115 = OpLabel +%5125 = OpLoad %1035 %1054 +%5126 = OpULessThan %1057 %5125 %1138 +OpSelectionMerge %5128 None +OpBranchConditional %5126 %5127 %5128 +%5127 = OpLabel +%5129 = OpLoad %6 %20 +%5130 = OpLoad %6 %21 +%5131 = OpISub %6 %5129 %5130 +OpStore %392 %5131 +OpBranch %5128 +%5128 = OpLabel +%5132 = OpLoad %1035 %1054 +%5133 = OpINotEqual %1057 %5132 %1094 +OpSelectionMerge %5135 None +OpBranchConditional %5133 %5134 %5135 +%5134 = OpLabel +%5136 = OpLoad %6 %13 +%5137 = OpLoad %6 %14 +%5138 = OpISub %6 %5136 %5137 +%5139 = OpLoad %6 %17 +%5140 = OpIAdd %6 %5138 %5139 +%5141 = OpLoad %6 %21 +%5142 = OpISub %6 %5140 %5141 +%5143 = OpLoad %6 %22 +%5144 = OpIAdd %6 %5142 %5143 +OpStore %393 %5144 +OpBranch %5135 +%5135 = OpLabel +%5145 = OpLoad %1035 %1054 +%5146 = OpUGreaterThan %1057 %5145 %1094 +OpSelectionMerge %5148 None +OpBranchConditional %5146 %5147 %5148 +%5147 = OpLabel +%5149 = OpLoad %6 %13 +%5150 = OpLoad %6 %14 +%5151 = OpIAdd %6 %5149 %5150 +%5152 = OpLoad %6 %18 +%5153 = OpISub %6 %5151 %5152 +%5154 = OpLoad %6 %19 +%5155 = OpISub %6 %5153 %5154 +%5156 = OpLoad %6 %20 +%5157 = OpISub %6 %5155 %5156 +OpStore %394 %5157 +OpBranch %5148 +%5148 = OpLabel +%5158 = OpLoad %1035 %1054 +%5159 = OpULessThanEqual %1057 %5158 %1094 +OpSelectionMerge %5161 None +OpBranchConditional %5159 %5160 %5161 +%5160 = OpLabel +%5162 = OpLoad %6 %13 +%5163 = OpLoad %6 %14 +%5164 = OpIAdd %6 %5162 %5163 +%5165 = OpLoad %6 %18 +%5166 = OpISub %6 %5164 %5165 +%5167 = OpLoad %6 %19 +%5168 = OpIAdd %6 %5166 %5167 +%5169 = OpLoad %6 %21 +%5170 = OpISub %6 %5168 %5169 +OpStore %395 %5170 +OpBranch %5161 +%5161 = OpLabel +%5171 = OpLoad %1035 %1054 +%5172 = OpULessThanEqual %1057 %5171 %1056 +OpSelectionMerge %5174 None +OpBranchConditional %5172 %5173 %5174 +%5173 = OpLabel +%5175 = OpLoad %6 %13 +%5176 = OpLoad %6 %14 +%5177 = OpIAdd %6 %5175 %5176 +%5178 = OpLoad %6 %18 +%5179 = OpISub %6 %5177 %5178 +%5180 = OpLoad %6 %19 +%5181 = OpIAdd %6 %5179 %5180 +%5182 = OpLoad %6 %22 +%5183 = OpIAdd %6 %5181 %5182 +OpStore %396 %5183 +OpBranch %5174 +%5174 = OpLabel +%5184 = OpLoad %1035 %1054 +%5185 = OpUGreaterThanEqual %1057 %5184 %1056 +OpSelectionMerge %5187 None +OpBranchConditional %5185 %5186 %5187 +%5186 = OpLabel +%5188 = OpLoad %6 %13 +%5189 = OpLoad %6 %14 +%5190 = OpIAdd %6 %5188 %5189 +%5191 = OpLoad %6 %18 +%5192 = OpISub %6 %5190 %5191 +%5193 = OpLoad %6 %20 +%5194 = OpISub %6 %5192 %5193 +%5195 = OpLoad %6 %21 +%5196 = OpISub %6 %5194 %5195 +OpStore %397 %5196 +OpBranch %5187 +%5187 = OpLabel +%5197 = OpLoad %1035 %1054 +%5198 = OpUGreaterThan %1057 %5197 %1056 +OpSelectionMerge %5200 None +OpBranchConditional %5198 %5199 %5200 +%5199 = OpLabel +%5201 = OpLoad %6 %13 +%5202 = OpLoad %6 %14 +%5203 = OpIAdd %6 %5201 %5202 +%5204 = OpLoad %6 %18 +%5205 = OpISub %6 %5203 %5204 +%5206 = OpLoad %6 %20 +%5207 = OpIAdd %6 %5205 %5206 +%5208 = OpLoad %6 %22 +%5209 = OpIAdd %6 %5207 %5208 +OpStore %398 %5209 +OpBranch %5200 +%5200 = OpLabel +%5210 = OpLoad %1035 %1054 +%5211 = OpULessThanEqual %1057 %5210 %1094 +OpSelectionMerge %5213 None +OpBranchConditional %5211 %5212 %5213 +%5212 = OpLabel +%5214 = OpLoad %6 %13 +%5215 = OpLoad %6 %14 +%5216 = OpISub %6 %5214 %5215 +%5217 = OpLoad %6 %18 +%5218 = OpISub %6 %5216 %5217 +%5219 = OpLoad %6 %21 +%5220 = OpIAdd %6 %5218 %5219 +%5221 = OpLoad %6 %22 +%5222 = OpIAdd %6 %5220 %5221 +OpStore %399 %5222 +OpBranch %5213 +%5213 = OpLabel +%5223 = OpLoad %1035 %1054 +%5224 = OpULessThan %1057 %5223 %1072 +OpSelectionMerge %5226 None +OpBranchConditional %5224 %5225 %5226 +%5225 = OpLabel +%5227 = OpLoad %6 %13 +%5228 = OpLoad %6 %14 +%5229 = OpISub %6 %5227 %5228 +%5230 = OpLoad %6 %19 +%5231 = OpIAdd %6 %5229 %5230 +%5232 = OpLoad %6 %20 +%5233 = OpISub %6 %5231 %5232 +%5234 = OpLoad %6 %21 +%5235 = OpIAdd %6 %5233 %5234 +OpStore %400 %5235 +OpBranch %5226 +%5226 = OpLabel +%5236 = OpLoad %1035 %1054 +%5237 = OpINotEqual %1057 %5236 %1072 +OpSelectionMerge %5239 None +OpBranchConditional %5237 %5238 %5239 +%5238 = OpLabel +%5240 = OpLoad %6 %13 +%5241 = OpLoad %6 %14 +%5242 = OpISub %6 %5240 %5241 +%5243 = OpLoad %6 %19 +%5244 = OpISub %6 %5242 %5243 +%5245 = OpLoad %6 %20 +%5246 = OpISub %6 %5244 %5245 +%5247 = OpLoad %6 %22 +%5248 = OpISub %6 %5246 %5247 +OpStore %401 %5248 +OpBranch %5239 +%5239 = OpLabel +%5249 = OpLoad %1035 %1054 +%5250 = OpULessThanEqual %1057 %5249 %1094 +OpSelectionMerge %5252 None +OpBranchConditional %5250 %5251 %5252 +%5251 = OpLabel +%5253 = OpLoad %6 %13 +%5254 = OpLoad %6 %14 +%5255 = OpIAdd %6 %5253 %5254 +%5256 = OpLoad %6 %19 +%5257 = OpIAdd %6 %5255 %5256 +%5258 = OpLoad %6 %21 +%5259 = OpISub %6 %5257 %5258 +%5260 = OpLoad %6 %22 +%5261 = OpIAdd %6 %5259 %5260 +OpStore %402 %5261 +OpBranch %5252 +%5252 = OpLabel +%5262 = OpLoad %1035 %1054 +%5263 = OpINotEqual %1057 %5262 %1072 +OpSelectionMerge %5265 None +OpBranchConditional %5263 %5264 %5265 +%5264 = OpLabel +%5266 = OpLoad %6 %20 +%5267 = OpLoad %6 %22 +%5268 = OpISub %6 %5266 %5267 +OpStore %403 %5268 +OpBranch %5265 +%5265 = OpLabel +%5269 = OpLoad %1035 %1054 +%5270 = OpIEqual %1057 %5269 %1072 +OpSelectionMerge %5272 None +OpBranchConditional %5270 %5271 %5272 +%5271 = OpLabel +%5273 = OpLoad %6 %13 +%5274 = OpLoad %6 %14 +%5275 = OpIAdd %6 %5273 %5274 +%5276 = OpLoad %6 %20 +%5277 = OpISub %6 %5275 %5276 +%5278 = OpLoad %6 %21 +%5279 = OpIAdd %6 %5277 %5278 +%5280 = OpLoad %6 %22 +%5281 = OpIAdd %6 %5279 %5280 +OpStore %404 %5281 +OpBranch %5272 +%5272 = OpLabel +%5282 = OpLoad %1035 %1054 +%5283 = OpIEqual %1057 %5282 %1056 +OpSelectionMerge %5285 None +OpBranchConditional %5283 %5284 %5285 +%5284 = OpLabel +%5286 = OpLoad %6 %13 +%5287 = OpLoad %6 %15 +%5288 = OpIAdd %6 %5286 %5287 +%5289 = OpLoad %6 %16 +%5290 = OpIAdd %6 %5288 %5289 +%5291 = OpLoad %6 %17 +%5292 = OpISub %6 %5290 %5291 +%5293 = OpLoad %6 %18 +%5294 = OpIAdd %6 %5292 %5293 +OpStore %405 %5294 +OpBranch %5285 +%5285 = OpLabel +%5295 = OpLoad %1035 %1054 +%5296 = OpULessThan %1057 %5295 %1094 +OpSelectionMerge %5298 None +OpBranchConditional %5296 %5297 %5298 +%5297 = OpLabel +%5299 = OpLoad %6 %13 +%5300 = OpLoad %6 %15 +%5301 = OpIAdd %6 %5299 %5300 +%5302 = OpLoad %6 %16 +%5303 = OpISub %6 %5301 %5302 +%5304 = OpLoad %6 %17 +%5305 = OpISub %6 %5303 %5304 +%5306 = OpLoad %6 %19 +%5307 = OpIAdd %6 %5305 %5306 +OpStore %406 %5307 +OpBranch %5298 +%5298 = OpLabel +%5308 = OpLoad %1035 %1054 +%5309 = OpUGreaterThan %1057 %5308 %1072 +OpSelectionMerge %5311 None +OpBranchConditional %5309 %5310 %5311 +%5310 = OpLabel +%5312 = OpLoad %6 %13 +%5313 = OpLoad %6 %15 +%5314 = OpIAdd %6 %5312 %5313 +%5315 = OpLoad %6 %16 +%5316 = OpIAdd %6 %5314 %5315 +%5317 = OpLoad %6 %17 +%5318 = OpISub %6 %5316 %5317 +%5319 = OpLoad %6 %20 +%5320 = OpISub %6 %5318 %5319 +OpStore %407 %5320 +OpBranch %5311 +%5311 = OpLabel +%5321 = OpLoad %1035 %1054 +%5322 = OpULessThan %1057 %5321 %1138 +OpSelectionMerge %5324 None +OpBranchConditional %5322 %5323 %5324 +%5323 = OpLabel +%5325 = OpLoad %6 %13 +%5326 = OpLoad %6 %15 +%5327 = OpIAdd %6 %5325 %5326 +%5328 = OpLoad %6 %16 +%5329 = OpIAdd %6 %5327 %5328 +%5330 = OpLoad %6 %17 +%5331 = OpIAdd %6 %5329 %5330 +%5332 = OpLoad %6 %21 +%5333 = OpISub %6 %5331 %5332 +OpStore %408 %5333 +OpBranch %5324 +%5324 = OpLabel +%5334 = OpLoad %1035 %1054 +%5335 = OpULessThan %1057 %5334 %1138 +OpSelectionMerge %5337 None +OpBranchConditional %5335 %5336 %5337 +%5336 = OpLabel +%5338 = OpLoad %6 %13 +%5339 = OpLoad %6 %15 +%5340 = OpIAdd %6 %5338 %5339 +%5341 = OpLoad %6 %16 +%5342 = OpISub %6 %5340 %5341 +%5343 = OpLoad %6 %17 +%5344 = OpISub %6 %5342 %5343 +%5345 = OpLoad %6 %22 +%5346 = OpISub %6 %5344 %5345 +OpStore %409 %5346 +OpBranch %5337 +%5337 = OpLabel +%5347 = OpLoad %1035 %1054 +%5348 = OpUGreaterThan %1057 %5347 %1094 +OpSelectionMerge %5350 None +OpBranchConditional %5348 %5349 %5350 +%5349 = OpLabel +%5351 = OpLoad %6 %13 +%5352 = OpLoad %6 %15 +%5353 = OpIAdd %6 %5351 %5352 +%5354 = OpLoad %6 %16 +%5355 = OpIAdd %6 %5353 %5354 +%5356 = OpLoad %6 %18 +%5357 = OpIAdd %6 %5355 %5356 +%5358 = OpLoad %6 %19 +%5359 = OpISub %6 %5357 %5358 +OpStore %410 %5359 +OpBranch %5350 +%5350 = OpLabel +%5360 = OpLoad %1035 %1054 +%5361 = OpUGreaterThanEqual %1057 %5360 %1138 +OpSelectionMerge %5363 None +OpBranchConditional %5361 %5362 %5363 +%5362 = OpLabel +%5364 = OpLoad %6 %13 +%5365 = OpLoad %6 %15 +%5366 = OpISub %6 %5364 %5365 +%5367 = OpLoad %6 %16 +%5368 = OpIAdd %6 %5366 %5367 +%5369 = OpLoad %6 %18 +%5370 = OpIAdd %6 %5368 %5369 +%5371 = OpLoad %6 %20 +%5372 = OpISub %6 %5370 %5371 +OpStore %411 %5372 +OpBranch %5363 +%5363 = OpLabel +%5373 = OpLoad %1035 %1054 +%5374 = OpINotEqual %1057 %5373 %1056 +OpSelectionMerge %5376 None +OpBranchConditional %5374 %5375 %5376 +%5375 = OpLabel +%5377 = OpLoad %6 %13 +%5378 = OpLoad %6 %15 +%5379 = OpISub %6 %5377 %5378 +%5380 = OpLoad %6 %16 +%5381 = OpIAdd %6 %5379 %5380 +%5382 = OpLoad %6 %18 +%5383 = OpISub %6 %5381 %5382 +%5384 = OpLoad %6 %21 +%5385 = OpIAdd %6 %5383 %5384 +OpStore %412 %5385 +OpBranch %5376 +%5376 = OpLabel +%5386 = OpLoad %1035 %1054 +%5387 = OpULessThanEqual %1057 %5386 %1094 +OpSelectionMerge %5389 None +OpBranchConditional %5387 %5388 %5389 +%5388 = OpLabel +%5390 = OpLoad %6 %13 +%5391 = OpLoad %6 %15 +%5392 = OpIAdd %6 %5390 %5391 +%5393 = OpLoad %6 %16 +%5394 = OpIAdd %6 %5392 %5393 +%5395 = OpLoad %6 %18 +%5396 = OpISub %6 %5394 %5395 +%5397 = OpLoad %6 %22 +%5398 = OpIAdd %6 %5396 %5397 +OpStore %413 %5398 +OpBranch %5389 +%5389 = OpLabel +%5399 = OpLoad %1035 %1054 +%5400 = OpINotEqual %1057 %5399 %1072 +OpSelectionMerge %5402 None +OpBranchConditional %5400 %5401 %5402 +%5401 = OpLabel +%5403 = OpLoad %6 %21 +%5404 = OpLoad %6 %22 +%5405 = OpISub %6 %5403 %5404 +OpStore %414 %5405 +OpBranch %5402 +%5402 = OpLabel +%5406 = OpLoad %1035 %1054 +%5407 = OpUGreaterThan %1057 %5406 %1056 +OpSelectionMerge %5409 None +OpBranchConditional %5407 %5408 %5409 +%5408 = OpLabel +%5410 = OpLoad %6 %13 +%5411 = OpLoad %6 %15 +%5412 = OpISub %6 %5410 %5411 +%5413 = OpLoad %6 %16 +%5414 = OpIAdd %6 %5412 %5413 +%5415 = OpLoad %6 %19 +%5416 = OpIAdd %6 %5414 %5415 +%5417 = OpLoad %6 %20 +%5418 = OpISub %6 %5416 %5417 +OpStore %415 %5418 +OpBranch %5409 +%5409 = OpLabel +%5419 = OpLoad %1035 %1054 +%5420 = OpIEqual %1057 %5419 %1072 +OpSelectionMerge %5422 None +OpBranchConditional %5420 %5421 %5422 +%5421 = OpLabel +%5423 = OpLoad %6 %13 +%5424 = OpLoad %6 %15 +%5425 = OpIAdd %6 %5423 %5424 +%5426 = OpLoad %6 %16 +%5427 = OpIAdd %6 %5425 %5426 +%5428 = OpLoad %6 %19 +%5429 = OpISub %6 %5427 %5428 +%5430 = OpLoad %6 %21 +%5431 = OpIAdd %6 %5429 %5430 +OpStore %416 %5431 +OpBranch %5422 +%5422 = OpLabel +%5432 = OpLoad %1035 %1054 +%5433 = OpULessThanEqual %1057 %5432 %1138 +OpSelectionMerge %5435 None +OpBranchConditional %5433 %5434 %5435 +%5434 = OpLabel +%5436 = OpLoad %6 %13 +%5437 = OpLoad %6 %15 +%5438 = OpIAdd %6 %5436 %5437 +%5439 = OpLoad %6 %16 +%5440 = OpIAdd %6 %5438 %5439 +%5441 = OpLoad %6 %19 +%5442 = OpISub %6 %5440 %5441 +%5443 = OpLoad %6 %22 +%5444 = OpIAdd %6 %5442 %5443 +OpStore %417 %5444 +OpBranch %5435 +%5435 = OpLabel +%5445 = OpLoad %1035 %1054 +%5446 = OpINotEqual %1057 %5445 %1138 +OpSelectionMerge %5448 None +OpBranchConditional %5446 %5447 %5448 +%5447 = OpLabel +%5449 = OpLoad %6 %13 +%5450 = OpLoad %6 %15 +%5451 = OpIAdd %6 %5449 %5450 +%5452 = OpLoad %6 %16 +%5453 = OpIAdd %6 %5451 %5452 +%5454 = OpLoad %6 %20 +%5455 = OpIAdd %6 %5453 %5454 +%5456 = OpLoad %6 %21 +%5457 = OpISub %6 %5455 %5456 +OpStore %418 %5457 +OpBranch %5448 +%5448 = OpLabel +%5458 = OpLoad %1035 %1054 +%5459 = OpULessThan %1057 %5458 %1072 +OpSelectionMerge %5461 None +OpBranchConditional %5459 %5460 %5461 +%5460 = OpLabel +%5462 = OpLoad %6 %13 +%5463 = OpLoad %6 %15 +%5464 = OpISub %6 %5462 %5463 +%5465 = OpLoad %6 %16 +%5466 = OpISub %6 %5464 %5465 +%5467 = OpLoad %6 %20 +%5468 = OpISub %6 %5466 %5467 +%5469 = OpLoad %6 %22 +%5470 = OpISub %6 %5468 %5469 +OpStore %419 %5470 +OpBranch %5461 +%5461 = OpLabel +%5471 = OpLoad %1035 %1054 +%5472 = OpINotEqual %1057 %5471 %1094 +OpSelectionMerge %5474 None +OpBranchConditional %5472 %5473 %5474 +%5473 = OpLabel +%5475 = OpLoad %6 %13 +%5476 = OpLoad %6 %15 +%5477 = OpISub %6 %5475 %5476 +%5478 = OpLoad %6 %16 +%5479 = OpIAdd %6 %5477 %5478 +%5480 = OpLoad %6 %21 +%5481 = OpIAdd %6 %5479 %5480 +%5482 = OpLoad %6 %22 +%5483 = OpISub %6 %5481 %5482 +OpStore %420 %5483 +OpBranch %5474 +%5474 = OpLabel +%5484 = OpLoad %1035 %1054 +%5485 = OpULessThanEqual %1057 %5484 %1138 +OpSelectionMerge %5487 None +OpBranchConditional %5485 %5486 %5487 +%5486 = OpLabel +%5488 = OpLoad %6 %13 +%5489 = OpLoad %6 %15 +%5490 = OpISub %6 %5488 %5489 +%5491 = OpLoad %6 %17 +%5492 = OpISub %6 %5490 %5491 +%5493 = OpLoad %6 %18 +%5494 = OpIAdd %6 %5492 %5493 +%5495 = OpLoad %6 %19 +%5496 = OpISub %6 %5494 %5495 +OpStore %421 %5496 +OpBranch %5487 +%5487 = OpLabel +%5497 = OpLoad %1035 %1054 +%5498 = OpIEqual %1057 %5497 %1094 +OpSelectionMerge %5500 None +OpBranchConditional %5498 %5499 %5500 +%5499 = OpLabel +%5501 = OpLoad %6 %13 +%5502 = OpLoad %6 %15 +%5503 = OpIAdd %6 %5501 %5502 +%5504 = OpLoad %6 %17 +%5505 = OpIAdd %6 %5503 %5504 +%5506 = OpLoad %6 %18 +%5507 = OpISub %6 %5505 %5506 +%5508 = OpLoad %6 %20 +%5509 = OpISub %6 %5507 %5508 +OpStore %422 %5509 +OpBranch %5500 +%5500 = OpLabel +%5510 = OpLoad %1035 %1054 +%5511 = OpUGreaterThanEqual %1057 %5510 %1138 +OpSelectionMerge %5513 None +OpBranchConditional %5511 %5512 %5513 +%5512 = OpLabel +%5514 = OpLoad %6 %13 +%5515 = OpLoad %6 %15 +%5516 = OpIAdd %6 %5514 %5515 +%5517 = OpLoad %6 %17 +%5518 = OpISub %6 %5516 %5517 +%5519 = OpLoad %6 %18 +%5520 = OpISub %6 %5518 %5519 +%5521 = OpLoad %6 %21 +%5522 = OpISub %6 %5520 %5521 +OpStore %423 %5522 +OpBranch %5513 +%5513 = OpLabel +%5523 = OpLoad %1035 %1054 +%5524 = OpUGreaterThan %1057 %5523 %1056 +OpSelectionMerge %5526 None +OpBranchConditional %5524 %5525 %5526 +%5525 = OpLabel +%5527 = OpLoad %6 %13 +%5528 = OpLoad %6 %15 +%5529 = OpISub %6 %5527 %5528 +%5530 = OpLoad %6 %17 +%5531 = OpIAdd %6 %5529 %5530 +%5532 = OpLoad %6 %18 +%5533 = OpISub %6 %5531 %5532 +%5534 = OpLoad %6 %22 +%5535 = OpIAdd %6 %5533 %5534 +OpStore %424 %5535 +OpBranch %5526 +%5526 = OpLabel +%5536 = OpLoad %1035 %1054 +%5537 = OpULessThan %1057 %5536 %1056 +OpSelectionMerge %5539 None +OpBranchConditional %5537 %5538 %5539 +%5538 = OpLabel +%5540 = OpLoad %6 %13 +%5541 = OpLoad %6 %14 +%5542 = OpIAdd %6 %5540 %5541 +%5543 = OpLoad %6 %15 +%5544 = OpISub %6 %5542 %5543 +OpStore %425 %5544 +OpBranch %5539 +%5539 = OpLabel +%5545 = OpLoad %1035 %1054 +%5546 = OpIEqual %1057 %5545 %1072 +OpSelectionMerge %5548 None +OpBranchConditional %5546 %5547 %5548 +%5547 = OpLabel +%5549 = OpLoad %6 %13 +%5550 = OpLoad %6 %15 +%5551 = OpIAdd %6 %5549 %5550 +%5552 = OpLoad %6 %17 +%5553 = OpIAdd %6 %5551 %5552 +%5554 = OpLoad %6 %19 +%5555 = OpIAdd %6 %5553 %5554 +%5556 = OpLoad %6 %20 +%5557 = OpISub %6 %5555 %5556 +OpStore %426 %5557 +OpBranch %5548 +%5548 = OpLabel +%5558 = OpLoad %1035 %1054 +%5559 = OpUGreaterThan %1057 %5558 %1094 +OpSelectionMerge %5561 None +OpBranchConditional %5559 %5560 %5561 +%5560 = OpLabel +%5562 = OpLoad %6 %13 +%5563 = OpLoad %6 %15 +%5564 = OpIAdd %6 %5562 %5563 +%5565 = OpLoad %6 %17 +%5566 = OpIAdd %6 %5564 %5565 +%5567 = OpLoad %6 %19 +%5568 = OpIAdd %6 %5566 %5567 +%5569 = OpLoad %6 %21 +%5570 = OpIAdd %6 %5568 %5569 +OpStore %427 %5570 +OpBranch %5561 +%5561 = OpLabel +%5571 = OpLoad %1035 %1054 +%5572 = OpULessThanEqual %1057 %5571 %1094 +OpSelectionMerge %5574 None +OpBranchConditional %5572 %5573 %5574 +%5573 = OpLabel +%5575 = OpLoad %6 %13 +%5576 = OpLoad %6 %15 +%5577 = OpIAdd %6 %5575 %5576 +%5578 = OpLoad %6 %17 +%5579 = OpIAdd %6 %5577 %5578 +%5580 = OpLoad %6 %19 +%5581 = OpIAdd %6 %5579 %5580 +%5582 = OpLoad %6 %22 +%5583 = OpIAdd %6 %5581 %5582 +OpStore %428 %5583 +OpBranch %5574 +%5574 = OpLabel +%5584 = OpLoad %1035 %1054 +%5585 = OpULessThanEqual %1057 %5584 %1094 +OpSelectionMerge %5587 None +OpBranchConditional %5585 %5586 %5587 +%5586 = OpLabel +%5588 = OpLoad %6 %13 +%5589 = OpLoad %6 %15 +%5590 = OpIAdd %6 %5588 %5589 +%5591 = OpLoad %6 %17 +%5592 = OpIAdd %6 %5590 %5591 +%5593 = OpLoad %6 %20 +%5594 = OpIAdd %6 %5592 %5593 +%5595 = OpLoad %6 %21 +%5596 = OpISub %6 %5594 %5595 +OpStore %429 %5596 +OpBranch %5587 +%5587 = OpLabel +%5597 = OpLoad %1035 %1054 +%5598 = OpULessThanEqual %1057 %5597 %1072 +OpSelectionMerge %5600 None +OpBranchConditional %5598 %5599 %5600 +%5599 = OpLabel +%5601 = OpLoad %6 %13 +%5602 = OpLoad %6 %15 +%5603 = OpISub %6 %5601 %5602 +%5604 = OpLoad %6 %17 +%5605 = OpIAdd %6 %5603 %5604 +%5606 = OpLoad %6 %20 +%5607 = OpIAdd %6 %5605 %5606 +%5608 = OpLoad %6 %22 +%5609 = OpIAdd %6 %5607 %5608 +OpStore %430 %5609 +OpBranch %5600 +%5600 = OpLabel +%5610 = OpLoad %1035 %1054 +%5611 = OpINotEqual %1057 %5610 %1056 +OpSelectionMerge %5613 None +OpBranchConditional %5611 %5612 %5613 +%5612 = OpLabel +%5614 = OpLoad %6 %13 +%5615 = OpLoad %6 %15 +%5616 = OpIAdd %6 %5614 %5615 +%5617 = OpLoad %6 %17 +%5618 = OpIAdd %6 %5616 %5617 +%5619 = OpLoad %6 %21 +%5620 = OpIAdd %6 %5618 %5619 +%5621 = OpLoad %6 %22 +%5622 = OpIAdd %6 %5620 %5621 +OpStore %431 %5622 +OpBranch %5613 +%5613 = OpLabel +%5623 = OpLoad %1035 %1054 +%5624 = OpUGreaterThanEqual %1057 %5623 %1094 +OpSelectionMerge %5626 None +OpBranchConditional %5624 %5625 %5626 +%5625 = OpLabel +%5627 = OpLoad %6 %13 +%5628 = OpLoad %6 %15 +%5629 = OpISub %6 %5627 %5628 +%5630 = OpLoad %6 %18 +%5631 = OpIAdd %6 %5629 %5630 +%5632 = OpLoad %6 %19 +%5633 = OpISub %6 %5631 %5632 +%5634 = OpLoad %6 %20 +%5635 = OpISub %6 %5633 %5634 +OpStore %432 %5635 +OpBranch %5626 +%5626 = OpLabel +%5636 = OpLoad %1035 %1054 +%5637 = OpINotEqual %1057 %5636 %1138 +OpSelectionMerge %5639 None +OpBranchConditional %5637 %5638 %5639 +%5638 = OpLabel +%5640 = OpLoad %6 %13 +%5641 = OpLoad %6 %15 +%5642 = OpISub %6 %5640 %5641 +%5643 = OpLoad %6 %18 +%5644 = OpISub %6 %5642 %5643 +%5645 = OpLoad %6 %19 +%5646 = OpISub %6 %5644 %5645 +%5647 = OpLoad %6 %21 +%5648 = OpIAdd %6 %5646 %5647 +OpStore %433 %5648 +OpBranch %5639 +%5639 = OpLabel +%5649 = OpLoad %1035 %1054 +%5650 = OpUGreaterThanEqual %1057 %5649 %1138 +OpSelectionMerge %5652 None +OpBranchConditional %5650 %5651 %5652 +%5651 = OpLabel +%5653 = OpLoad %6 %13 +%5654 = OpLoad %6 %15 +%5655 = OpIAdd %6 %5653 %5654 +%5656 = OpLoad %6 %18 +%5657 = OpIAdd %6 %5655 %5656 +%5658 = OpLoad %6 %19 +%5659 = OpIAdd %6 %5657 %5658 +%5660 = OpLoad %6 %22 +%5661 = OpIAdd %6 %5659 %5660 +OpStore %434 %5661 +OpBranch %5652 +%5652 = OpLabel +%5662 = OpLoad %1035 %1054 +%5663 = OpIEqual %1057 %5662 %1138 +OpSelectionMerge %5665 None +OpBranchConditional %5663 %5664 %5665 +%5664 = OpLabel +%5666 = OpLoad %6 %13 +%5667 = OpLoad %6 %15 +%5668 = OpISub %6 %5666 %5667 +%5669 = OpLoad %6 %18 +%5670 = OpISub %6 %5668 %5669 +%5671 = OpLoad %6 %20 +%5672 = OpIAdd %6 %5670 %5671 +%5673 = OpLoad %6 %21 +%5674 = OpISub %6 %5672 %5673 +OpStore %435 %5674 +OpBranch %5665 +%5665 = OpLabel +%5675 = OpLoad %1035 %1054 +%5676 = OpULessThanEqual %1057 %5675 %1138 +OpSelectionMerge %5678 None +OpBranchConditional %5676 %5677 %5678 +%5677 = OpLabel +%5679 = OpLoad %6 %13 +%5680 = OpLoad %6 %14 +%5681 = OpIAdd %6 %5679 %5680 +%5682 = OpLoad %6 %16 +%5683 = OpISub %6 %5681 %5682 +OpStore %436 %5683 +OpBranch %5678 +%5678 = OpLabel +%5684 = OpLoad %1035 %1054 +%5685 = OpULessThan %1057 %5684 %1094 +OpSelectionMerge %5687 None +OpBranchConditional %5685 %5686 %5687 +%5686 = OpLabel +%5688 = OpLoad %6 %13 +%5689 = OpLoad %6 %15 +%5690 = OpISub %6 %5688 %5689 +%5691 = OpLoad %6 %18 +%5692 = OpIAdd %6 %5690 %5691 +%5693 = OpLoad %6 %20 +%5694 = OpIAdd %6 %5692 %5693 +%5695 = OpLoad %6 %22 +%5696 = OpISub %6 %5694 %5695 +OpStore %437 %5696 +OpBranch %5687 +%5687 = OpLabel +%5697 = OpLoad %1035 %1054 +%5698 = OpINotEqual %1057 %5697 %1094 +OpSelectionMerge %5700 None +OpBranchConditional %5698 %5699 %5700 +%5699 = OpLabel +%5701 = OpLoad %6 %13 +%5702 = OpLoad %6 %15 +%5703 = OpISub %6 %5701 %5702 +%5704 = OpLoad %6 %18 +%5705 = OpIAdd %6 %5703 %5704 +%5706 = OpLoad %6 %21 +%5707 = OpISub %6 %5705 %5706 +%5708 = OpLoad %6 %22 +%5709 = OpIAdd %6 %5707 %5708 +OpStore %438 %5709 +OpBranch %5700 +%5700 = OpLabel +%5710 = OpLoad %1035 %1054 +%5711 = OpUGreaterThanEqual %1057 %5710 %1138 +OpSelectionMerge %5713 None +OpBranchConditional %5711 %5712 %5713 +%5712 = OpLabel +%5714 = OpLoad %6 %13 +%5715 = OpLoad %6 %15 +%5716 = OpISub %6 %5714 %5715 +%5717 = OpLoad %6 %19 +%5718 = OpISub %6 %5716 %5717 +%5719 = OpLoad %6 %20 +%5720 = OpIAdd %6 %5718 %5719 +%5721 = OpLoad %6 %21 +%5722 = OpISub %6 %5720 %5721 +OpStore %439 %5722 +OpBranch %5713 +%5713 = OpLabel +%5723 = OpLoad %1035 %1054 +%5724 = OpULessThan %1057 %5723 %1138 +OpSelectionMerge %5726 None +OpBranchConditional %5724 %5725 %5726 +%5725 = OpLabel +%5727 = OpLoad %6 %13 +%5728 = OpLoad %6 %15 +%5729 = OpISub %6 %5727 %5728 +%5730 = OpLoad %6 %19 +%5731 = OpISub %6 %5729 %5730 +%5732 = OpLoad %6 %20 +%5733 = OpISub %6 %5731 %5732 +%5734 = OpLoad %6 %22 +%5735 = OpIAdd %6 %5733 %5734 +OpStore %440 %5735 +OpBranch %5726 +%5726 = OpLabel +%5736 = OpLoad %1035 %1054 +%5737 = OpULessThanEqual %1057 %5736 %1056 +OpSelectionMerge %5739 None +OpBranchConditional %5737 %5738 %5739 +%5738 = OpLabel +%5740 = OpLoad %6 %13 +%5741 = OpLoad %6 %15 +%5742 = OpIAdd %6 %5740 %5741 +%5743 = OpLoad %6 %19 +%5744 = OpIAdd %6 %5742 %5743 +%5745 = OpLoad %6 %21 +%5746 = OpIAdd %6 %5744 %5745 +%5747 = OpLoad %6 %22 +%5748 = OpIAdd %6 %5746 %5747 +OpStore %441 %5748 +OpBranch %5739 +%5739 = OpLabel +%5749 = OpLoad %1035 %1054 +%5750 = OpINotEqual %1057 %5749 %1094 +OpSelectionMerge %5752 None +OpBranchConditional %5750 %5751 %5752 +%5751 = OpLabel +%5753 = OpLoad %6 %13 +%5754 = OpLoad %6 %15 +%5755 = OpISub %6 %5753 %5754 +%5756 = OpLoad %6 %20 +%5757 = OpIAdd %6 %5755 %5756 +%5758 = OpLoad %6 %21 +%5759 = OpIAdd %6 %5757 %5758 +%5760 = OpLoad %6 %22 +%5761 = OpISub %6 %5759 %5760 +OpStore %442 %5761 +OpBranch %5752 +%5752 = OpLabel +%5762 = OpLoad %1035 %1054 +%5763 = OpIEqual %1057 %5762 %1072 +OpSelectionMerge %5765 None +OpBranchConditional %5763 %5764 %5765 +%5764 = OpLabel +%5766 = OpLoad %6 %13 +%5767 = OpLoad %6 %16 +%5768 = OpIAdd %6 %5766 %5767 +%5769 = OpLoad %6 %17 +%5770 = OpIAdd %6 %5768 %5769 +%5771 = OpLoad %6 %18 +%5772 = OpISub %6 %5770 %5771 +%5773 = OpLoad %6 %19 +%5774 = OpIAdd %6 %5772 %5773 +OpStore %443 %5774 +OpBranch %5765 +%5765 = OpLabel +%5775 = OpLoad %1035 %1054 +%5776 = OpUGreaterThanEqual %1057 %5775 %1072 +OpSelectionMerge %5778 None +OpBranchConditional %5776 %5777 %5778 +%5777 = OpLabel +%5779 = OpLoad %6 %13 +%5780 = OpLoad %6 %16 +%5781 = OpISub %6 %5779 %5780 +%5782 = OpLoad %6 %17 +%5783 = OpISub %6 %5781 %5782 +%5784 = OpLoad %6 %18 +%5785 = OpISub %6 %5783 %5784 +%5786 = OpLoad %6 %20 +%5787 = OpISub %6 %5785 %5786 +OpStore %444 %5787 +OpBranch %5778 +%5778 = OpLabel +%5788 = OpLoad %1035 %1054 +%5789 = OpIEqual %1057 %5788 %1094 +OpSelectionMerge %5791 None +OpBranchConditional %5789 %5790 %5791 +%5790 = OpLabel +%5792 = OpLoad %6 %13 +%5793 = OpLoad %6 %16 +%5794 = OpISub %6 %5792 %5793 +%5795 = OpLoad %6 %17 +%5796 = OpIAdd %6 %5794 %5795 +%5797 = OpLoad %6 %18 +%5798 = OpISub %6 %5796 %5797 +%5799 = OpLoad %6 %21 +%5800 = OpISub %6 %5798 %5799 +OpStore %445 %5800 +OpBranch %5791 +%5791 = OpLabel +%5801 = OpLoad %1035 %1054 +%5802 = OpULessThanEqual %1057 %5801 %1056 +OpSelectionMerge %5804 None +OpBranchConditional %5802 %5803 %5804 +%5803 = OpLabel +%5805 = OpLoad %6 %13 +%5806 = OpLoad %6 %16 +%5807 = OpISub %6 %5805 %5806 +%5808 = OpLoad %6 %17 +%5809 = OpISub %6 %5807 %5808 +%5810 = OpLoad %6 %18 +%5811 = OpISub %6 %5809 %5810 +%5812 = OpLoad %6 %22 +%5813 = OpISub %6 %5811 %5812 +OpStore %446 %5813 +OpBranch %5804 +%5804 = OpLabel +%5814 = OpLoad %1035 %1054 +%5815 = OpINotEqual %1057 %5814 %1056 +OpSelectionMerge %5817 None +OpBranchConditional %5815 %5816 %5817 +%5816 = OpLabel +%5818 = OpLoad %6 %13 +%5819 = OpLoad %6 %14 +%5820 = OpIAdd %6 %5818 %5819 +%5821 = OpLoad %6 %17 +%5822 = OpIAdd %6 %5820 %5821 +OpStore %447 %5822 +OpBranch %5817 +%5817 = OpLabel +%5823 = OpLoad %1035 %1054 +%5824 = OpIEqual %1057 %5823 %1094 +OpSelectionMerge %5826 None +OpBranchConditional %5824 %5825 %5826 +%5825 = OpLabel +%5827 = OpLoad %6 %13 +%5828 = OpLoad %6 %16 +%5829 = OpISub %6 %5827 %5828 +%5830 = OpLoad %6 %17 +%5831 = OpIAdd %6 %5829 %5830 +%5832 = OpLoad %6 %19 +%5833 = OpISub %6 %5831 %5832 +%5834 = OpLoad %6 %20 +%5835 = OpISub %6 %5833 %5834 +OpStore %448 %5835 +OpBranch %5826 +%5826 = OpLabel +%5836 = OpLoad %1035 %1054 +%5837 = OpULessThanEqual %1057 %5836 %1056 +OpSelectionMerge %5839 None +OpBranchConditional %5837 %5838 %5839 +%5838 = OpLabel +%5840 = OpLoad %6 %13 +%5841 = OpLoad %6 %16 +%5842 = OpIAdd %6 %5840 %5841 +%5843 = OpLoad %6 %17 +%5844 = OpIAdd %6 %5842 %5843 +%5845 = OpLoad %6 %19 +%5846 = OpISub %6 %5844 %5845 +%5847 = OpLoad %6 %21 +%5848 = OpIAdd %6 %5846 %5847 +OpStore %449 %5848 +OpBranch %5839 +%5839 = OpLabel +%5849 = OpLoad %1035 %1054 +%5850 = OpUGreaterThan %1057 %5849 %1072 +OpSelectionMerge %5852 None +OpBranchConditional %5850 %5851 %5852 +%5851 = OpLabel +%5853 = OpLoad %6 %13 +%5854 = OpLoad %6 %16 +%5855 = OpISub %6 %5853 %5854 +%5856 = OpLoad %6 %17 +%5857 = OpISub %6 %5855 %5856 +%5858 = OpLoad %6 %19 +%5859 = OpIAdd %6 %5857 %5858 +%5860 = OpLoad %6 %22 +%5861 = OpISub %6 %5859 %5860 +OpStore %450 %5861 +OpBranch %5852 +%5852 = OpLabel +%5862 = OpLoad %1035 %1054 +%5863 = OpUGreaterThanEqual %1057 %5862 %1138 +OpSelectionMerge %5865 None +OpBranchConditional %5863 %5864 %5865 +%5864 = OpLabel +%5866 = OpLoad %6 %13 +%5867 = OpLoad %6 %16 +%5868 = OpISub %6 %5866 %5867 +%5869 = OpLoad %6 %17 +%5870 = OpISub %6 %5868 %5869 +%5871 = OpLoad %6 %20 +%5872 = OpISub %6 %5870 %5871 +%5873 = OpLoad %6 %21 +%5874 = OpIAdd %6 %5872 %5873 +OpStore %451 %5874 +OpBranch %5865 +%5865 = OpLabel +%5875 = OpLoad %1035 %1054 +%5876 = OpULessThanEqual %1057 %5875 %1072 +OpSelectionMerge %5878 None +OpBranchConditional %5876 %5877 %5878 +%5877 = OpLabel +%5879 = OpLoad %6 %13 +%5880 = OpLoad %6 %16 +%5881 = OpIAdd %6 %5879 %5880 +%5882 = OpLoad %6 %17 +%5883 = OpIAdd %6 %5881 %5882 +%5884 = OpLoad %6 %20 +%5885 = OpISub %6 %5883 %5884 +%5886 = OpLoad %6 %22 +%5887 = OpIAdd %6 %5885 %5886 +OpStore %452 %5887 +OpBranch %5878 +%5878 = OpLabel +%5888 = OpLoad %1035 %1054 +%5889 = OpIEqual %1057 %5888 %1138 +OpSelectionMerge %5891 None +OpBranchConditional %5889 %5890 %5891 +%5890 = OpLabel +%5892 = OpLoad %6 %13 +%5893 = OpLoad %6 %16 +%5894 = OpIAdd %6 %5892 %5893 +%5895 = OpLoad %6 %17 +%5896 = OpISub %6 %5894 %5895 +%5897 = OpLoad %6 %21 +%5898 = OpISub %6 %5896 %5897 +%5899 = OpLoad %6 %22 +%5900 = OpISub %6 %5898 %5899 +OpStore %453 %5900 +OpBranch %5891 +%5891 = OpLabel +%5901 = OpLoad %1035 %1054 +%5902 = OpUGreaterThan %1057 %5901 %1138 +OpSelectionMerge %5904 None +OpBranchConditional %5902 %5903 %5904 +%5903 = OpLabel +%5905 = OpLoad %6 %13 +%5906 = OpLoad %6 %16 +%5907 = OpIAdd %6 %5905 %5906 +%5908 = OpLoad %6 %18 +%5909 = OpISub %6 %5907 %5908 +%5910 = OpLoad %6 %19 +%5911 = OpISub %6 %5909 %5910 +%5912 = OpLoad %6 %20 +%5913 = OpIAdd %6 %5911 %5912 +OpStore %454 %5913 +OpBranch %5904 +%5904 = OpLabel +%5914 = OpLoad %1035 %1054 +%5915 = OpINotEqual %1057 %5914 %1056 +OpSelectionMerge %5917 None +OpBranchConditional %5915 %5916 %5917 +%5916 = OpLabel +%5918 = OpLoad %6 %13 +%5919 = OpLoad %6 %16 +%5920 = OpISub %6 %5918 %5919 +%5921 = OpLoad %6 %18 +%5922 = OpISub %6 %5920 %5921 +%5923 = OpLoad %6 %19 +%5924 = OpIAdd %6 %5922 %5923 +%5925 = OpLoad %6 %21 +%5926 = OpIAdd %6 %5924 %5925 +OpStore %455 %5926 +OpBranch %5917 +%5917 = OpLabel +%5927 = OpLoad %1035 %1054 +%5928 = OpIEqual %1057 %5927 %1056 +OpSelectionMerge %5930 None +OpBranchConditional %5928 %5929 %5930 +%5929 = OpLabel +%5931 = OpLoad %6 %13 +%5932 = OpLoad %6 %16 +%5933 = OpIAdd %6 %5931 %5932 +%5934 = OpLoad %6 %18 +%5935 = OpISub %6 %5933 %5934 +%5936 = OpLoad %6 %19 +%5937 = OpIAdd %6 %5935 %5936 +%5938 = OpLoad %6 %22 +%5939 = OpIAdd %6 %5937 %5938 +OpStore %456 %5939 +OpBranch %5930 +%5930 = OpLabel +%5940 = OpLoad %1035 %1054 +%5941 = OpINotEqual %1057 %5940 %1056 +OpSelectionMerge %5943 None +OpBranchConditional %5941 %5942 %5943 +%5942 = OpLabel +%5944 = OpLoad %6 %13 +%5945 = OpLoad %6 %16 +%5946 = OpIAdd %6 %5944 %5945 +%5947 = OpLoad %6 %18 +%5948 = OpISub %6 %5946 %5947 +%5949 = OpLoad %6 %20 +%5950 = OpIAdd %6 %5948 %5949 +%5951 = OpLoad %6 %21 +%5952 = OpIAdd %6 %5950 %5951 +OpStore %457 %5952 +OpBranch %5943 +%5943 = OpLabel +%5953 = OpLoad %1035 %1054 +%5954 = OpINotEqual %1057 %5953 %1094 +OpSelectionMerge %5956 None +OpBranchConditional %5954 %5955 %5956 +%5955 = OpLabel +%5957 = OpLoad %6 %13 +%5958 = OpLoad %6 %14 +%5959 = OpIAdd %6 %5957 %5958 +%5960 = OpLoad %6 %18 +%5961 = OpISub %6 %5959 %5960 +OpStore %458 %5961 +OpBranch %5956 +%5956 = OpLabel +%5962 = OpLoad %1035 %1054 +%5963 = OpULessThanEqual %1057 %5962 %1056 +OpSelectionMerge %5965 None +OpBranchConditional %5963 %5964 %5965 +%5964 = OpLabel +%5966 = OpLoad %6 %13 +%5967 = OpLoad %6 %16 +%5968 = OpISub %6 %5966 %5967 +%5969 = OpLoad %6 %18 +%5970 = OpIAdd %6 %5968 %5969 +%5971 = OpLoad %6 %20 +%5972 = OpIAdd %6 %5970 %5971 +%5973 = OpLoad %6 %22 +%5974 = OpISub %6 %5972 %5973 +OpStore %459 %5974 +OpBranch %5965 +%5965 = OpLabel +%5975 = OpLoad %1035 %1054 +%5976 = OpINotEqual %1057 %5975 %1138 +OpSelectionMerge %5978 None +OpBranchConditional %5976 %5977 %5978 +%5977 = OpLabel +%5979 = OpLoad %6 %13 +%5980 = OpLoad %6 %16 +%5981 = OpIAdd %6 %5979 %5980 +%5982 = OpLoad %6 %18 +%5983 = OpIAdd %6 %5981 %5982 +%5984 = OpLoad %6 %21 +%5985 = OpISub %6 %5983 %5984 +%5986 = OpLoad %6 %22 +%5987 = OpISub %6 %5985 %5986 +OpStore %460 %5987 +OpBranch %5978 +%5978 = OpLabel +%5988 = OpLoad %1035 %1054 +%5989 = OpINotEqual %1057 %5988 %1094 +OpSelectionMerge %5991 None +OpBranchConditional %5989 %5990 %5991 +%5990 = OpLabel +%5992 = OpLoad %6 %13 +%5993 = OpLoad %6 %16 +%5994 = OpISub %6 %5992 %5993 +%5995 = OpLoad %6 %19 +%5996 = OpISub %6 %5994 %5995 +%5997 = OpLoad %6 %20 +%5998 = OpIAdd %6 %5996 %5997 +%5999 = OpLoad %6 %21 +%6000 = OpISub %6 %5998 %5999 +OpStore %461 %6000 +OpBranch %5991 +%5991 = OpLabel +%6001 = OpLoad %1035 %1054 +%6002 = OpULessThanEqual %1057 %6001 %1056 +OpSelectionMerge %6004 None +OpBranchConditional %6002 %6003 %6004 +%6003 = OpLabel +%6005 = OpLoad %6 %13 +%6006 = OpLoad %6 %16 +%6007 = OpIAdd %6 %6005 %6006 +%6008 = OpLoad %6 %19 +%6009 = OpIAdd %6 %6007 %6008 +%6010 = OpLoad %6 %20 +%6011 = OpISub %6 %6009 %6010 +%6012 = OpLoad %6 %22 +%6013 = OpISub %6 %6011 %6012 +OpStore %462 %6013 +OpBranch %6004 +%6004 = OpLabel +%6014 = OpLoad %1035 %1054 +%6015 = OpULessThanEqual %1057 %6014 %1072 +OpSelectionMerge %6017 None +OpBranchConditional %6015 %6016 %6017 +%6016 = OpLabel +%6018 = OpLoad %6 %13 +%6019 = OpLoad %6 %16 +%6020 = OpIAdd %6 %6018 %6019 +%6021 = OpLoad %6 %19 +%6022 = OpISub %6 %6020 %6021 +%6023 = OpLoad %6 %21 +%6024 = OpIAdd %6 %6022 %6023 +%6025 = OpLoad %6 %22 +%6026 = OpISub %6 %6024 %6025 +OpStore %463 %6026 +OpBranch %6017 +%6017 = OpLabel +%6027 = OpLoad %1035 %1054 +%6028 = OpUGreaterThan %1057 %6027 %1072 +OpSelectionMerge %6030 None +OpBranchConditional %6028 %6029 %6030 +%6029 = OpLabel +%6031 = OpLoad %6 %13 +%6032 = OpLoad %6 %16 +%6033 = OpISub %6 %6031 %6032 +%6034 = OpLoad %6 %20 +%6035 = OpISub %6 %6033 %6034 +%6036 = OpLoad %6 %21 +%6037 = OpIAdd %6 %6035 %6036 +%6038 = OpLoad %6 %22 +%6039 = OpISub %6 %6037 %6038 +OpStore %464 %6039 +OpBranch %6030 +%6030 = OpLabel +%6040 = OpLoad %1035 %1054 +%6041 = OpIEqual %1057 %6040 %1094 +OpSelectionMerge %6043 None +OpBranchConditional %6041 %6042 %6043 +%6042 = OpLabel +%6044 = OpLoad %6 %13 +%6045 = OpLoad %6 %17 +%6046 = OpIAdd %6 %6044 %6045 +%6047 = OpLoad %6 %18 +%6048 = OpIAdd %6 %6046 %6047 +%6049 = OpLoad %6 %19 +%6050 = OpIAdd %6 %6048 %6049 +%6051 = OpLoad %6 %20 +%6052 = OpIAdd %6 %6050 %6051 +OpStore %465 %6052 +OpBranch %6043 +%6043 = OpLabel +%6053 = OpLoad %1035 %1054 +%6054 = OpINotEqual %1057 %6053 %1138 +OpSelectionMerge %6056 None +OpBranchConditional %6054 %6055 %6056 +%6055 = OpLabel +%6057 = OpLoad %6 %13 +%6058 = OpLoad %6 %17 +%6059 = OpISub %6 %6057 %6058 +%6060 = OpLoad %6 %18 +%6061 = OpISub %6 %6059 %6060 +%6062 = OpLoad %6 %19 +%6063 = OpIAdd %6 %6061 %6062 +%6064 = OpLoad %6 %21 +%6065 = OpISub %6 %6063 %6064 +OpStore %466 %6065 +OpBranch %6056 +%6056 = OpLabel +%6066 = OpLoad %1035 %1054 +%6067 = OpULessThanEqual %1057 %6066 %1094 +OpSelectionMerge %6069 None +OpBranchConditional %6067 %6068 %6069 +%6068 = OpLabel +%6070 = OpLoad %6 %13 +%6071 = OpLoad %6 %17 +%6072 = OpISub %6 %6070 %6071 +%6073 = OpLoad %6 %18 +%6074 = OpIAdd %6 %6072 %6073 +%6075 = OpLoad %6 %19 +%6076 = OpISub %6 %6074 %6075 +%6077 = OpLoad %6 %22 +%6078 = OpIAdd %6 %6076 %6077 +OpStore %467 %6078 +OpBranch %6069 +%6069 = OpLabel +%6079 = OpLoad %1035 %1054 +%6080 = OpUGreaterThanEqual %1057 %6079 %1056 +OpSelectionMerge %6082 None +OpBranchConditional %6080 %6081 %6082 +%6081 = OpLabel +%6083 = OpLoad %6 %13 +%6084 = OpLoad %6 %17 +%6085 = OpISub %6 %6083 %6084 +%6086 = OpLoad %6 %18 +%6087 = OpISub %6 %6085 %6086 +%6088 = OpLoad %6 %20 +%6089 = OpISub %6 %6087 %6088 +%6090 = OpLoad %6 %21 +%6091 = OpISub %6 %6089 %6090 +OpStore %468 %6091 +OpBranch %6082 +%6082 = OpLabel +%6092 = OpLoad %1035 %1054 +%6093 = OpULessThanEqual %1057 %6092 %1138 +OpSelectionMerge %6095 None +OpBranchConditional %6093 %6094 %6095 +%6094 = OpLabel +%6096 = OpLoad %6 %13 +%6097 = OpLoad %6 %14 +%6098 = OpISub %6 %6096 %6097 +%6099 = OpLoad %6 %19 +%6100 = OpISub %6 %6098 %6099 +OpStore %469 %6100 +OpBranch %6095 +%6095 = OpLabel +%6101 = OpLoad %1035 %1054 +%6102 = OpULessThanEqual %1057 %6101 %1072 +OpSelectionMerge %6104 None +OpBranchConditional %6102 %6103 %6104 +%6103 = OpLabel +%6105 = OpLoad %6 %13 +%6106 = OpLoad %6 %17 +%6107 = OpIAdd %6 %6105 %6106 +%6108 = OpLoad %6 %18 +%6109 = OpISub %6 %6107 %6108 +%6110 = OpLoad %6 %20 +%6111 = OpISub %6 %6109 %6110 +%6112 = OpLoad %6 %22 +%6113 = OpIAdd %6 %6111 %6112 +OpStore %470 %6113 +OpBranch %6104 +%6104 = OpLabel +%6114 = OpLoad %1035 %1054 +%6115 = OpUGreaterThan %1057 %6114 %1138 +OpSelectionMerge %6117 None +OpBranchConditional %6115 %6116 %6117 +%6116 = OpLabel +%6118 = OpLoad %6 %13 +%6119 = OpLoad %6 %17 +%6120 = OpIAdd %6 %6118 %6119 +%6121 = OpLoad %6 %18 +%6122 = OpISub %6 %6120 %6121 +%6123 = OpLoad %6 %21 +%6124 = OpIAdd %6 %6122 %6123 +%6125 = OpLoad %6 %22 +%6126 = OpISub %6 %6124 %6125 +OpStore %471 %6126 +OpBranch %6117 +%6117 = OpLabel +%6127 = OpLoad %1035 %1054 +%6128 = OpUGreaterThan %1057 %6127 %1138 +OpSelectionMerge %6130 None +OpBranchConditional %6128 %6129 %6130 +%6129 = OpLabel +%6131 = OpLoad %6 %13 +%6132 = OpLoad %6 %17 +%6133 = OpISub %6 %6131 %6132 +%6134 = OpLoad %6 %19 +%6135 = OpISub %6 %6133 %6134 +%6136 = OpLoad %6 %20 +%6137 = OpIAdd %6 %6135 %6136 +%6138 = OpLoad %6 %21 +%6139 = OpISub %6 %6137 %6138 +OpStore %472 %6139 +OpBranch %6130 +%6130 = OpLabel +%6140 = OpLoad %1035 %1054 +%6141 = OpUGreaterThan %1057 %6140 %1056 +OpSelectionMerge %6143 None +OpBranchConditional %6141 %6142 %6143 +%6142 = OpLabel +%6144 = OpLoad %6 %13 +%6145 = OpLoad %6 %17 +%6146 = OpISub %6 %6144 %6145 +%6147 = OpLoad %6 %19 +%6148 = OpISub %6 %6146 %6147 +%6149 = OpLoad %6 %20 +%6150 = OpISub %6 %6148 %6149 +%6151 = OpLoad %6 %22 +%6152 = OpISub %6 %6150 %6151 +OpStore %473 %6152 +OpBranch %6143 +%6143 = OpLabel +%6153 = OpLoad %1035 %1054 +%6154 = OpUGreaterThan %1057 %6153 %1094 +OpSelectionMerge %6156 None +OpBranchConditional %6154 %6155 %6156 +%6155 = OpLabel +%6157 = OpLoad %6 %13 +%6158 = OpLoad %6 %17 +%6159 = OpIAdd %6 %6157 %6158 +%6160 = OpLoad %6 %19 +%6161 = OpIAdd %6 %6159 %6160 +%6162 = OpLoad %6 %21 +%6163 = OpIAdd %6 %6161 %6162 +%6164 = OpLoad %6 %22 +%6165 = OpISub %6 %6163 %6164 +OpStore %474 %6165 +OpBranch %6156 +%6156 = OpLabel +%6166 = OpLoad %1035 %1054 +%6167 = OpUGreaterThan %1057 %6166 %1138 +OpSelectionMerge %6169 None +OpBranchConditional %6167 %6168 %6169 +%6168 = OpLabel +%6170 = OpLoad %6 %13 +%6171 = OpLoad %6 %17 +%6172 = OpIAdd %6 %6170 %6171 +%6173 = OpLoad %6 %20 +%6174 = OpIAdd %6 %6172 %6173 +%6175 = OpLoad %6 %21 +%6176 = OpISub %6 %6174 %6175 +%6177 = OpLoad %6 %22 +%6178 = OpISub %6 %6176 %6177 +OpStore %475 %6178 +OpBranch %6169 +%6169 = OpLabel +%6179 = OpLoad %1035 %1054 +%6180 = OpULessThanEqual %1057 %6179 %1094 +OpSelectionMerge %6182 None +OpBranchConditional %6180 %6181 %6182 +%6181 = OpLabel +%6183 = OpLoad %6 %13 +%6184 = OpLoad %6 %18 +%6185 = OpIAdd %6 %6183 %6184 +%6186 = OpLoad %6 %19 +%6187 = OpISub %6 %6185 %6186 +%6188 = OpLoad %6 %20 +%6189 = OpISub %6 %6187 %6188 +%6190 = OpLoad %6 %21 +%6191 = OpIAdd %6 %6189 %6190 +OpStore %476 %6191 +OpBranch %6182 +%6182 = OpLabel +%6192 = OpLoad %1035 %1054 +%6193 = OpINotEqual %1057 %6192 %1138 +OpSelectionMerge %6195 None +OpBranchConditional %6193 %6194 %6195 +%6194 = OpLabel +%6196 = OpLoad %6 %13 +%6197 = OpLoad %6 %18 +%6198 = OpISub %6 %6196 %6197 +%6199 = OpLoad %6 %19 +%6200 = OpIAdd %6 %6198 %6199 +%6201 = OpLoad %6 %20 +%6202 = OpIAdd %6 %6200 %6201 +%6203 = OpLoad %6 %22 +%6204 = OpIAdd %6 %6202 %6203 +OpStore %477 %6204 +OpBranch %6195 +%6195 = OpLabel +%6205 = OpLoad %1035 %1054 +%6206 = OpULessThanEqual %1057 %6205 %1094 +OpSelectionMerge %6208 None +OpBranchConditional %6206 %6207 %6208 +%6207 = OpLabel +%6209 = OpLoad %6 %13 +%6210 = OpLoad %6 %18 +%6211 = OpIAdd %6 %6209 %6210 +%6212 = OpLoad %6 %19 +%6213 = OpISub %6 %6211 %6212 +%6214 = OpLoad %6 %21 +%6215 = OpISub %6 %6213 %6214 +%6216 = OpLoad %6 %22 +%6217 = OpISub %6 %6215 %6216 +OpStore %478 %6217 +OpBranch %6208 +%6208 = OpLabel +%6218 = OpLoad %1035 %1054 +%6219 = OpUGreaterThanEqual %1057 %6218 %1094 +OpSelectionMerge %6221 None +OpBranchConditional %6219 %6220 %6221 +%6220 = OpLabel +%6222 = OpLoad %6 %13 +%6223 = OpLoad %6 %18 +%6224 = OpISub %6 %6222 %6223 +%6225 = OpLoad %6 %20 +%6226 = OpIAdd %6 %6224 %6225 +%6227 = OpLoad %6 %21 +%6228 = OpISub %6 %6226 %6227 +%6229 = OpLoad %6 %22 +%6230 = OpISub %6 %6228 %6229 +OpStore %479 %6230 +OpBranch %6221 +%6221 = OpLabel +%6231 = OpLoad %1035 %1054 +%6232 = OpUGreaterThanEqual %1057 %6231 %1094 +OpSelectionMerge %6234 None +OpBranchConditional %6232 %6233 %6234 +%6233 = OpLabel +%6235 = OpLoad %6 %13 +%6236 = OpLoad %6 %19 +%6237 = OpIAdd %6 %6235 %6236 +OpStore %480 %6237 +OpBranch %6234 +%6234 = OpLabel +%6238 = OpLoad %1035 %1054 +%6239 = OpULessThan %1057 %6238 %1094 +OpSelectionMerge %6241 None +OpBranchConditional %6239 %6240 %6241 +%6240 = OpLabel +%6242 = OpLoad %6 %13 +%6243 = OpLoad %6 %14 +%6244 = OpIAdd %6 %6242 %6243 +%6245 = OpLoad %6 %20 +%6246 = OpIAdd %6 %6244 %6245 +OpStore %481 %6246 +OpBranch %6241 +%6241 = OpLabel +%6247 = OpLoad %1035 %1054 +%6248 = OpIEqual %1057 %6247 %1094 +OpSelectionMerge %6250 None +OpBranchConditional %6248 %6249 %6250 +%6249 = OpLabel +%6251 = OpLoad %6 %13 +%6252 = OpLoad %6 %19 +%6253 = OpIAdd %6 %6251 %6252 +%6254 = OpLoad %6 %20 +%6255 = OpIAdd %6 %6253 %6254 +%6256 = OpLoad %6 %21 +%6257 = OpISub %6 %6255 %6256 +%6258 = OpLoad %6 %22 +%6259 = OpIAdd %6 %6257 %6258 +OpStore %482 %6259 +OpBranch %6250 +%6250 = OpLabel +%6260 = OpLoad %1035 %1054 +%6261 = OpIEqual %1057 %6260 %1094 +OpSelectionMerge %6263 None +OpBranchConditional %6261 %6262 %6263 +%6262 = OpLabel +%6264 = OpLoad %6 %14 +%6265 = OpLoad %6 %15 +%6266 = OpIAdd %6 %6264 %6265 +%6267 = OpLoad %6 %16 +%6268 = OpISub %6 %6266 %6267 +%6269 = OpLoad %6 %17 +%6270 = OpIAdd %6 %6268 %6269 +%6271 = OpLoad %6 %18 +%6272 = OpIAdd %6 %6270 %6271 +OpStore %483 %6272 +OpBranch %6263 +%6263 = OpLabel +%6273 = OpLoad %1035 %1054 +%6274 = OpULessThanEqual %1057 %6273 %1072 +OpSelectionMerge %6276 None +OpBranchConditional %6274 %6275 %6276 +%6275 = OpLabel +%6277 = OpLoad %6 %14 +%6278 = OpLoad %6 %15 +%6279 = OpISub %6 %6277 %6278 +%6280 = OpLoad %6 %16 +%6281 = OpISub %6 %6279 %6280 +%6282 = OpLoad %6 %17 +%6283 = OpISub %6 %6281 %6282 +%6284 = OpLoad %6 %19 +%6285 = OpIAdd %6 %6283 %6284 +OpStore %484 %6285 +OpBranch %6276 +%6276 = OpLabel +%6286 = OpLoad %1035 %1054 +%6287 = OpUGreaterThan %1057 %6286 %1094 +OpSelectionMerge %6289 None +OpBranchConditional %6287 %6288 %6289 +%6288 = OpLabel +%6290 = OpLoad %6 %14 +%6291 = OpLoad %6 %15 +%6292 = OpIAdd %6 %6290 %6291 +%6293 = OpLoad %6 %16 +%6294 = OpIAdd %6 %6292 %6293 +%6295 = OpLoad %6 %17 +%6296 = OpIAdd %6 %6294 %6295 +%6297 = OpLoad %6 %20 +%6298 = OpISub %6 %6296 %6297 +OpStore %485 %6298 +OpBranch %6289 +%6289 = OpLabel +%6299 = OpLoad %1035 %1054 +%6300 = OpUGreaterThanEqual %1057 %6299 %1072 +OpSelectionMerge %6302 None +OpBranchConditional %6300 %6301 %6302 +%6301 = OpLabel +%6303 = OpLoad %6 %14 +%6304 = OpLoad %6 %15 +%6305 = OpIAdd %6 %6303 %6304 +%6306 = OpLoad %6 %16 +%6307 = OpISub %6 %6305 %6306 +%6308 = OpLoad %6 %17 +%6309 = OpISub %6 %6307 %6308 +%6310 = OpLoad %6 %21 +%6311 = OpISub %6 %6309 %6310 +OpStore %486 %6311 +OpBranch %6302 +%6302 = OpLabel +%6312 = OpLoad %1035 %1054 +%6313 = OpINotEqual %1057 %6312 %1072 +OpSelectionMerge %6315 None +OpBranchConditional %6313 %6314 %6315 +%6314 = OpLabel +%6316 = OpLoad %6 %14 +%6317 = OpLoad %6 %15 +%6318 = OpISub %6 %6316 %6317 +%6319 = OpLoad %6 %16 +%6320 = OpIAdd %6 %6318 %6319 +%6321 = OpLoad %6 %17 +%6322 = OpIAdd %6 %6320 %6321 +%6323 = OpLoad %6 %22 +%6324 = OpIAdd %6 %6322 %6323 +OpStore %487 %6324 +OpBranch %6315 +%6315 = OpLabel +%6325 = OpLoad %1035 %1054 +%6326 = OpIEqual %1057 %6325 %1138 +OpSelectionMerge %6328 None +OpBranchConditional %6326 %6327 %6328 +%6327 = OpLabel +%6329 = OpLoad %6 %14 +%6330 = OpLoad %6 %15 +%6331 = OpIAdd %6 %6329 %6330 +%6332 = OpLoad %6 %16 +%6333 = OpIAdd %6 %6331 %6332 +%6334 = OpLoad %6 %18 +%6335 = OpIAdd %6 %6333 %6334 +%6336 = OpLoad %6 %19 +%6337 = OpIAdd %6 %6335 %6336 +OpStore %488 %6337 +OpBranch %6328 +%6328 = OpLabel +%6338 = OpLoad %1035 %1054 +%6339 = OpIEqual %1057 %6338 %1138 +OpSelectionMerge %6341 None +OpBranchConditional %6339 %6340 %6341 +%6340 = OpLabel +%6342 = OpLoad %6 %14 +%6343 = OpLoad %6 %15 +%6344 = OpISub %6 %6342 %6343 +%6345 = OpLoad %6 %16 +%6346 = OpIAdd %6 %6344 %6345 +%6347 = OpLoad %6 %18 +%6348 = OpISub %6 %6346 %6347 +%6349 = OpLoad %6 %20 +%6350 = OpISub %6 %6348 %6349 +OpStore %489 %6350 +OpBranch %6341 +%6341 = OpLabel +%6351 = OpLoad %1035 %1054 +%6352 = OpUGreaterThan %1057 %6351 %1138 +OpSelectionMerge %6354 None +OpBranchConditional %6352 %6353 %6354 +%6353 = OpLabel +%6355 = OpLoad %6 %14 +%6356 = OpLoad %6 %15 +%6357 = OpIAdd %6 %6355 %6356 +%6358 = OpLoad %6 %16 +%6359 = OpIAdd %6 %6357 %6358 +%6360 = OpLoad %6 %18 +%6361 = OpISub %6 %6359 %6360 +%6362 = OpLoad %6 %21 +%6363 = OpISub %6 %6361 %6362 +OpStore %490 %6363 +OpBranch %6354 +%6354 = OpLabel +%6364 = OpLoad %1035 %1054 +%6365 = OpIEqual %1057 %6364 %1072 +OpSelectionMerge %6367 None +OpBranchConditional %6365 %6366 %6367 +%6366 = OpLabel +%6368 = OpLoad %6 %14 +%6369 = OpLoad %6 %15 +%6370 = OpIAdd %6 %6368 %6369 +%6371 = OpLoad %6 %16 +%6372 = OpISub %6 %6370 %6371 +%6373 = OpLoad %6 %18 +%6374 = OpISub %6 %6372 %6373 +%6375 = OpLoad %6 %22 +%6376 = OpISub %6 %6374 %6375 +OpStore %491 %6376 +OpBranch %6367 +%6367 = OpLabel +%6377 = OpLoad %1035 %1054 +%6378 = OpUGreaterThan %1057 %6377 %1138 +OpSelectionMerge %6380 None +OpBranchConditional %6378 %6379 %6380 +%6379 = OpLabel +%6381 = OpLoad %6 %13 +%6382 = OpLoad %6 %14 +%6383 = OpIAdd %6 %6381 %6382 +%6384 = OpLoad %6 %21 +%6385 = OpIAdd %6 %6383 %6384 +OpStore %492 %6385 +OpBranch %6380 +%6380 = OpLabel +%6386 = OpLoad %1035 %1054 +%6387 = OpUGreaterThanEqual %1057 %6386 %1056 +OpSelectionMerge %6389 None +OpBranchConditional %6387 %6388 %6389 +%6388 = OpLabel +%6390 = OpLoad %6 %14 +%6391 = OpLoad %6 %15 +%6392 = OpISub %6 %6390 %6391 +%6393 = OpLoad %6 %16 +%6394 = OpIAdd %6 %6392 %6393 +%6395 = OpLoad %6 %19 +%6396 = OpISub %6 %6394 %6395 +%6397 = OpLoad %6 %20 +%6398 = OpISub %6 %6396 %6397 +OpStore %493 %6398 +OpBranch %6389 +%6389 = OpLabel +%6399 = OpLoad %1035 %1054 +%6400 = OpIEqual %1057 %6399 %1094 +OpSelectionMerge %6402 None +OpBranchConditional %6400 %6401 %6402 +%6401 = OpLabel +%6403 = OpLoad %6 %14 +%6404 = OpLoad %6 %15 +%6405 = OpIAdd %6 %6403 %6404 +%6406 = OpLoad %6 %16 +%6407 = OpIAdd %6 %6405 %6406 +%6408 = OpLoad %6 %19 +%6409 = OpISub %6 %6407 %6408 +%6410 = OpLoad %6 %21 +%6411 = OpIAdd %6 %6409 %6410 +OpStore %494 %6411 +OpBranch %6402 +%6402 = OpLabel +%6412 = OpLoad %1035 %1054 +%6413 = OpULessThan %1057 %6412 %1072 +OpSelectionMerge %6415 None +OpBranchConditional %6413 %6414 %6415 +%6414 = OpLabel +%6416 = OpLoad %6 %14 +%6417 = OpLoad %6 %15 +%6418 = OpIAdd %6 %6416 %6417 +%6419 = OpLoad %6 %16 +%6420 = OpISub %6 %6418 %6419 +%6421 = OpLoad %6 %19 +%6422 = OpISub %6 %6420 %6421 +%6423 = OpLoad %6 %22 +%6424 = OpIAdd %6 %6422 %6423 +OpStore %495 %6424 +OpBranch %6415 +%6415 = OpLabel +%6425 = OpLoad %1035 %1054 +%6426 = OpULessThan %1057 %6425 %1094 +OpSelectionMerge %6428 None +OpBranchConditional %6426 %6427 %6428 +%6427 = OpLabel +%6429 = OpLoad %6 %14 +%6430 = OpLoad %6 %15 +%6431 = OpISub %6 %6429 %6430 +%6432 = OpLoad %6 %16 +%6433 = OpISub %6 %6431 %6432 +%6434 = OpLoad %6 %20 +%6435 = OpISub %6 %6433 %6434 +%6436 = OpLoad %6 %21 +%6437 = OpISub %6 %6435 %6436 +OpStore %496 %6437 +OpBranch %6428 +%6428 = OpLabel +%6438 = OpLoad %1035 %1054 +%6439 = OpULessThan %1057 %6438 %1056 +OpSelectionMerge %6441 None +OpBranchConditional %6439 %6440 %6441 +%6440 = OpLabel +%6442 = OpLoad %6 %14 +%6443 = OpLoad %6 %15 +%6444 = OpIAdd %6 %6442 %6443 +%6445 = OpLoad %6 %16 +%6446 = OpISub %6 %6444 %6445 +%6447 = OpLoad %6 %20 +%6448 = OpISub %6 %6446 %6447 +%6449 = OpLoad %6 %22 +%6450 = OpIAdd %6 %6448 %6449 +OpStore %497 %6450 +OpBranch %6441 +%6441 = OpLabel +%6451 = OpLoad %1035 %1054 +%6452 = OpUGreaterThan %1057 %6451 %1056 +OpSelectionMerge %6454 None +OpBranchConditional %6452 %6453 %6454 +%6453 = OpLabel +%6455 = OpLoad %6 %14 +%6456 = OpLoad %6 %15 +%6457 = OpISub %6 %6455 %6456 +%6458 = OpLoad %6 %16 +%6459 = OpISub %6 %6457 %6458 +%6460 = OpLoad %6 %21 +%6461 = OpISub %6 %6459 %6460 +%6462 = OpLoad %6 %22 +%6463 = OpISub %6 %6461 %6462 +OpStore %498 %6463 +OpBranch %6454 +%6454 = OpLabel +%6464 = OpLoad %1035 %1054 +%6465 = OpINotEqual %1057 %6464 %1138 +OpSelectionMerge %6467 None +OpBranchConditional %6465 %6466 %6467 +%6466 = OpLabel +%6468 = OpLoad %6 %14 +%6469 = OpLoad %6 %15 +%6470 = OpISub %6 %6468 %6469 +%6471 = OpLoad %6 %17 +%6472 = OpIAdd %6 %6470 %6471 +%6473 = OpLoad %6 %18 +%6474 = OpIAdd %6 %6472 %6473 +%6475 = OpLoad %6 %19 +%6476 = OpIAdd %6 %6474 %6475 +OpStore %499 %6476 +OpBranch %6467 +%6467 = OpLabel +%6477 = OpLoad %1035 %1054 +%6478 = OpULessThan %1057 %6477 %1094 +OpSelectionMerge %6480 None +OpBranchConditional %6478 %6479 %6480 +%6479 = OpLabel +%6481 = OpLoad %6 %14 +%6482 = OpLoad %6 %15 +%6483 = OpISub %6 %6481 %6482 +%6484 = OpLoad %6 %17 +%6485 = OpISub %6 %6483 %6484 +%6486 = OpLoad %6 %18 +%6487 = OpIAdd %6 %6485 %6486 +%6488 = OpLoad %6 %20 +%6489 = OpISub %6 %6487 %6488 +OpStore %500 %6489 +OpBranch %6480 +%6480 = OpLabel +%6490 = OpLoad %1035 %1054 +%6491 = OpULessThanEqual %1057 %6490 %1094 +OpSelectionMerge %6493 None +OpBranchConditional %6491 %6492 %6493 +%6492 = OpLabel +%6494 = OpLoad %6 %14 +%6495 = OpLoad %6 %15 +%6496 = OpIAdd %6 %6494 %6495 +%6497 = OpLoad %6 %17 +%6498 = OpIAdd %6 %6496 %6497 +%6499 = OpLoad %6 %18 +%6500 = OpISub %6 %6498 %6499 +%6501 = OpLoad %6 %21 +%6502 = OpIAdd %6 %6500 %6501 +OpStore %501 %6502 +OpBranch %6493 +%6493 = OpLabel +%6503 = OpLoad %1035 %1054 +%6504 = OpIEqual %1057 %6503 %1056 +OpSelectionMerge %6506 None +OpBranchConditional %6504 %6505 %6506 +%6505 = OpLabel +%6507 = OpLoad %6 %14 +%6508 = OpLoad %6 %15 +%6509 = OpISub %6 %6507 %6508 +%6510 = OpLoad %6 %17 +%6511 = OpIAdd %6 %6509 %6510 +%6512 = OpLoad %6 %18 +%6513 = OpIAdd %6 %6511 %6512 +%6514 = OpLoad %6 %22 +%6515 = OpIAdd %6 %6513 %6514 +OpStore %502 %6515 +OpBranch %6506 +%6506 = OpLabel +%6516 = OpLoad %1035 %1054 +%6517 = OpINotEqual %1057 %6516 %1094 +OpSelectionMerge %6519 None +OpBranchConditional %6517 %6518 %6519 +%6518 = OpLabel +%6520 = OpLoad %6 %13 +%6521 = OpLoad %6 %14 +%6522 = OpISub %6 %6520 %6521 +%6523 = OpLoad %6 %22 +%6524 = OpIAdd %6 %6522 %6523 +OpStore %503 %6524 +OpBranch %6519 +%6519 = OpLabel +%6525 = OpLoad %1035 %1054 +%6526 = OpULessThan %1057 %6525 %1138 +OpSelectionMerge %6528 None +OpBranchConditional %6526 %6527 %6528 +%6527 = OpLabel +%6529 = OpLoad %6 %14 +%6530 = OpLoad %6 %15 +%6531 = OpIAdd %6 %6529 %6530 +%6532 = OpLoad %6 %17 +%6533 = OpISub %6 %6531 %6532 +%6534 = OpLoad %6 %19 +%6535 = OpISub %6 %6533 %6534 +%6536 = OpLoad %6 %20 +%6537 = OpISub %6 %6535 %6536 +OpStore %504 %6537 +OpBranch %6528 +%6528 = OpLabel +%6538 = OpLoad %1035 %1054 +%6539 = OpUGreaterThanEqual %1057 %6538 %1056 +OpSelectionMerge %6541 None +OpBranchConditional %6539 %6540 %6541 +%6540 = OpLabel +%6542 = OpLoad %6 %14 +%6543 = OpLoad %6 %15 +%6544 = OpISub %6 %6542 %6543 +%6545 = OpLoad %6 %17 +%6546 = OpISub %6 %6544 %6545 +%6547 = OpLoad %6 %19 +%6548 = OpISub %6 %6546 %6547 +%6549 = OpLoad %6 %21 +%6550 = OpISub %6 %6548 %6549 +OpStore %505 %6550 +OpBranch %6541 +%6541 = OpLabel +%6551 = OpLoad %1035 %1054 +%6552 = OpULessThan %1057 %6551 %1138 +OpSelectionMerge %6554 None +OpBranchConditional %6552 %6553 %6554 +%6553 = OpLabel +%6555 = OpLoad %6 %14 +%6556 = OpLoad %6 %15 +%6557 = OpISub %6 %6555 %6556 +%6558 = OpLoad %6 %17 +%6559 = OpISub %6 %6557 %6558 +%6560 = OpLoad %6 %19 +%6561 = OpISub %6 %6559 %6560 +%6562 = OpLoad %6 %22 +%6563 = OpISub %6 %6561 %6562 +OpStore %506 %6563 +OpBranch %6554 +%6554 = OpLabel +%6564 = OpLoad %1035 %1054 +%6565 = OpUGreaterThanEqual %1057 %6564 %1094 +OpSelectionMerge %6567 None +OpBranchConditional %6565 %6566 %6567 +%6566 = OpLabel +%6568 = OpLoad %6 %14 +%6569 = OpLoad %6 %15 +%6570 = OpISub %6 %6568 %6569 +%6571 = OpLoad %6 %17 +%6572 = OpISub %6 %6570 %6571 +%6573 = OpLoad %6 %20 +%6574 = OpISub %6 %6572 %6573 +%6575 = OpLoad %6 %21 +%6576 = OpISub %6 %6574 %6575 +OpStore %507 %6576 +OpBranch %6567 +%6567 = OpLabel +%6577 = OpLoad %1035 %1054 +%6578 = OpULessThanEqual %1057 %6577 %1072 +OpSelectionMerge %6580 None +OpBranchConditional %6578 %6579 %6580 +%6579 = OpLabel +%6581 = OpLoad %6 %14 +%6582 = OpLoad %6 %15 +%6583 = OpIAdd %6 %6581 %6582 +%6584 = OpLoad %6 %17 +%6585 = OpISub %6 %6583 %6584 +%6586 = OpLoad %6 %20 +%6587 = OpIAdd %6 %6585 %6586 +%6588 = OpLoad %6 %22 +%6589 = OpIAdd %6 %6587 %6588 +OpStore %508 %6589 +OpBranch %6580 +%6580 = OpLabel +%6590 = OpLoad %1035 %1054 +%6591 = OpULessThanEqual %1057 %6590 %1138 +OpSelectionMerge %6593 None +OpBranchConditional %6591 %6592 %6593 +%6592 = OpLabel +%6594 = OpLoad %6 %14 +%6595 = OpLoad %6 %15 +%6596 = OpISub %6 %6594 %6595 +%6597 = OpLoad %6 %17 +%6598 = OpISub %6 %6596 %6597 +%6599 = OpLoad %6 %21 +%6600 = OpIAdd %6 %6598 %6599 +%6601 = OpLoad %6 %22 +%6602 = OpIAdd %6 %6600 %6601 +OpStore %509 %6602 +OpBranch %6593 +%6593 = OpLabel +%6603 = OpLoad %1035 %1054 +%6604 = OpINotEqual %1057 %6603 %1056 +OpSelectionMerge %6606 None +OpBranchConditional %6604 %6605 %6606 +%6605 = OpLabel +%6607 = OpLoad %6 %14 +%6608 = OpLoad %6 %15 +%6609 = OpISub %6 %6607 %6608 +%6610 = OpLoad %6 %18 +%6611 = OpISub %6 %6609 %6610 +%6612 = OpLoad %6 %19 +%6613 = OpIAdd %6 %6611 %6612 +%6614 = OpLoad %6 %20 +%6615 = OpISub %6 %6613 %6614 +OpStore %510 %6615 +OpBranch %6606 +%6606 = OpLabel +%6616 = OpLoad %1035 %1054 +%6617 = OpULessThan %1057 %6616 %1056 +OpSelectionMerge %6619 None +OpBranchConditional %6617 %6618 %6619 +%6618 = OpLabel +%6620 = OpLoad %6 %14 +%6621 = OpLoad %6 %15 +%6622 = OpIAdd %6 %6620 %6621 +%6623 = OpLoad %6 %18 +%6624 = OpIAdd %6 %6622 %6623 +%6625 = OpLoad %6 %19 +%6626 = OpIAdd %6 %6624 %6625 +%6627 = OpLoad %6 %21 +%6628 = OpIAdd %6 %6626 %6627 +OpStore %511 %6628 +OpBranch %6619 +%6619 = OpLabel +%6629 = OpLoad %1035 %1054 +%6630 = OpIEqual %1057 %6629 %1056 +OpSelectionMerge %6632 None +OpBranchConditional %6630 %6631 %6632 +%6631 = OpLabel +%6633 = OpLoad %6 %14 +%6634 = OpLoad %6 %15 +%6635 = OpIAdd %6 %6633 %6634 +%6636 = OpLoad %6 %18 +%6637 = OpISub %6 %6635 %6636 +%6638 = OpLoad %6 %19 +%6639 = OpISub %6 %6637 %6638 +%6640 = OpLoad %6 %22 +%6641 = OpIAdd %6 %6639 %6640 +OpStore %512 %6641 +OpBranch %6632 +%6632 = OpLabel +%6642 = OpLoad %1035 %1054 +%6643 = OpIEqual %1057 %6642 %1138 +OpSelectionMerge %6645 None +OpBranchConditional %6643 %6644 %6645 +%6644 = OpLabel +%6646 = OpLoad %6 %14 +%6647 = OpLoad %6 %15 +%6648 = OpISub %6 %6646 %6647 +%6649 = OpLoad %6 %18 +%6650 = OpISub %6 %6648 %6649 +%6651 = OpLoad %6 %20 +%6652 = OpISub %6 %6650 %6651 +%6653 = OpLoad %6 %21 +%6654 = OpIAdd %6 %6652 %6653 +OpStore %513 %6654 +OpBranch %6645 +%6645 = OpLabel +%6655 = OpLoad %1035 %1054 +%6656 = OpULessThan %1057 %6655 %1138 +OpSelectionMerge %6658 None +OpBranchConditional %6656 %6657 %6658 +%6657 = OpLabel +%6659 = OpLoad %6 %13 +%6660 = OpLoad %6 %15 +%6661 = OpISub %6 %6659 %6660 +%6662 = OpLoad %6 %16 +%6663 = OpIAdd %6 %6661 %6662 +OpStore %514 %6663 +OpBranch %6658 +%6658 = OpLabel +%6664 = OpLoad %1035 %1054 +%6665 = OpULessThanEqual %1057 %6664 %1138 +OpSelectionMerge %6667 None +OpBranchConditional %6665 %6666 %6667 +%6666 = OpLabel +%6668 = OpLoad %6 %14 +%6669 = OpLoad %6 %15 +%6670 = OpIAdd %6 %6668 %6669 +%6671 = OpLoad %6 %18 +%6672 = OpIAdd %6 %6670 %6671 +%6673 = OpLoad %6 %20 +%6674 = OpISub %6 %6672 %6673 +%6675 = OpLoad %6 %22 +%6676 = OpIAdd %6 %6674 %6675 +OpStore %515 %6676 +OpBranch %6667 +%6667 = OpLabel +%6677 = OpLoad %1035 %1054 +%6678 = OpINotEqual %1057 %6677 %1072 +OpSelectionMerge %6680 None +OpBranchConditional %6678 %6679 %6680 +%6679 = OpLabel +%6681 = OpLoad %6 %14 +%6682 = OpLoad %6 %15 +%6683 = OpISub %6 %6681 %6682 +%6684 = OpLoad %6 %18 +%6685 = OpISub %6 %6683 %6684 +%6686 = OpLoad %6 %21 +%6687 = OpIAdd %6 %6685 %6686 +%6688 = OpLoad %6 %22 +%6689 = OpISub %6 %6687 %6688 +OpStore %516 %6689 +OpBranch %6680 +%6680 = OpLabel +%6690 = OpLoad %1035 %1054 +%6691 = OpINotEqual %1057 %6690 %1138 +OpSelectionMerge %6693 None +OpBranchConditional %6691 %6692 %6693 +%6692 = OpLabel +%6694 = OpLoad %6 %14 +%6695 = OpLoad %6 %15 +%6696 = OpISub %6 %6694 %6695 +%6697 = OpLoad %6 %19 +%6698 = OpIAdd %6 %6696 %6697 +%6699 = OpLoad %6 %20 +%6700 = OpISub %6 %6698 %6699 +%6701 = OpLoad %6 %21 +%6702 = OpIAdd %6 %6700 %6701 +OpStore %517 %6702 +OpBranch %6693 +%6693 = OpLabel +%6703 = OpLoad %1035 %1054 +%6704 = OpULessThanEqual %1057 %6703 %1138 +OpSelectionMerge %6706 None +OpBranchConditional %6704 %6705 %6706 +%6705 = OpLabel +%6707 = OpLoad %6 %14 +%6708 = OpLoad %6 %15 +%6709 = OpIAdd %6 %6707 %6708 +%6710 = OpLoad %6 %19 +%6711 = OpISub %6 %6709 %6710 +%6712 = OpLoad %6 %20 +%6713 = OpIAdd %6 %6711 %6712 +%6714 = OpLoad %6 %22 +%6715 = OpIAdd %6 %6713 %6714 +OpStore %518 %6715 +OpBranch %6706 +%6706 = OpLabel +%6716 = OpLoad %1035 %1054 +%6717 = OpINotEqual %1057 %6716 %1138 +OpSelectionMerge %6719 None +OpBranchConditional %6717 %6718 %6719 +%6718 = OpLabel +%6720 = OpLoad %6 %14 +%6721 = OpLoad %6 %15 +%6722 = OpIAdd %6 %6720 %6721 +%6723 = OpLoad %6 %19 +%6724 = OpIAdd %6 %6722 %6723 +%6725 = OpLoad %6 %21 +%6726 = OpIAdd %6 %6724 %6725 +%6727 = OpLoad %6 %22 +%6728 = OpIAdd %6 %6726 %6727 +OpStore %519 %6728 +OpBranch %6719 +%6719 = OpLabel +%6729 = OpLoad %1035 %1054 +%6730 = OpUGreaterThanEqual %1057 %6729 %1094 +OpSelectionMerge %6732 None +OpBranchConditional %6730 %6731 %6732 +%6731 = OpLabel +%6733 = OpLoad %6 %14 +%6734 = OpLoad %6 %15 +%6735 = OpISub %6 %6733 %6734 +%6736 = OpLoad %6 %20 +%6737 = OpISub %6 %6735 %6736 +%6738 = OpLoad %6 %21 +%6739 = OpISub %6 %6737 %6738 +%6740 = OpLoad %6 %22 +%6741 = OpIAdd %6 %6739 %6740 +OpStore %520 %6741 +OpBranch %6732 +%6732 = OpLabel +%6742 = OpLoad %1035 %1054 +%6743 = OpUGreaterThan %1057 %6742 %1094 +OpSelectionMerge %6745 None +OpBranchConditional %6743 %6744 %6745 +%6744 = OpLabel +%6746 = OpLoad %6 %14 +%6747 = OpLoad %6 %16 +%6748 = OpISub %6 %6746 %6747 +%6749 = OpLoad %6 %17 +%6750 = OpISub %6 %6748 %6749 +%6751 = OpLoad %6 %18 +%6752 = OpIAdd %6 %6750 %6751 +%6753 = OpLoad %6 %19 +%6754 = OpIAdd %6 %6752 %6753 +OpStore %521 %6754 +OpBranch %6745 +%6745 = OpLabel +%6755 = OpLoad %1035 %1054 +%6756 = OpUGreaterThanEqual %1057 %6755 %1072 +OpSelectionMerge %6758 None +OpBranchConditional %6756 %6757 %6758 +%6757 = OpLabel +%6759 = OpLoad %6 %14 +%6760 = OpLoad %6 %16 +%6761 = OpISub %6 %6759 %6760 +%6762 = OpLoad %6 %17 +%6763 = OpIAdd %6 %6761 %6762 +%6764 = OpLoad %6 %18 +%6765 = OpIAdd %6 %6763 %6764 +%6766 = OpLoad %6 %20 +%6767 = OpISub %6 %6765 %6766 +OpStore %522 %6767 +OpBranch %6758 +%6758 = OpLabel +%6768 = OpLoad %1035 %1054 +%6769 = OpUGreaterThanEqual %1057 %6768 %1056 +OpSelectionMerge %6771 None +OpBranchConditional %6769 %6770 %6771 +%6770 = OpLabel +%6772 = OpLoad %6 %14 +%6773 = OpLoad %6 %16 +%6774 = OpISub %6 %6772 %6773 +%6775 = OpLoad %6 %17 +%6776 = OpIAdd %6 %6774 %6775 +%6777 = OpLoad %6 %18 +%6778 = OpISub %6 %6776 %6777 +%6779 = OpLoad %6 %21 +%6780 = OpISub %6 %6778 %6779 +OpStore %523 %6780 +OpBranch %6771 +%6771 = OpLabel +%6781 = OpLoad %1035 %1054 +%6782 = OpUGreaterThan %1057 %6781 %1072 +OpSelectionMerge %6784 None +OpBranchConditional %6782 %6783 %6784 +%6783 = OpLabel +%6785 = OpLoad %6 %14 +%6786 = OpLoad %6 %16 +%6787 = OpISub %6 %6785 %6786 +%6788 = OpLoad %6 %17 +%6789 = OpIAdd %6 %6787 %6788 +%6790 = OpLoad %6 %18 +%6791 = OpISub %6 %6789 %6790 +%6792 = OpLoad %6 %22 +%6793 = OpIAdd %6 %6791 %6792 +OpStore %524 %6793 +OpBranch %6784 +%6784 = OpLabel +%6794 = OpLoad %1035 %1054 +%6795 = OpUGreaterThanEqual %1057 %6794 %1072 +OpSelectionMerge %6797 None +OpBranchConditional %6795 %6796 %6797 +%6796 = OpLabel +%6798 = OpLoad %6 %13 +%6799 = OpLoad %6 %15 +%6800 = OpIAdd %6 %6798 %6799 +%6801 = OpLoad %6 %17 +%6802 = OpIAdd %6 %6800 %6801 +OpStore %525 %6802 +OpBranch %6797 +%6797 = OpLabel +%6803 = OpLoad %1035 %1054 +%6804 = OpULessThanEqual %1057 %6803 %1094 +OpSelectionMerge %6806 None +OpBranchConditional %6804 %6805 %6806 +%6805 = OpLabel +%6807 = OpLoad %6 %14 +%6808 = OpLoad %6 %16 +%6809 = OpIAdd %6 %6807 %6808 +%6810 = OpLoad %6 %17 +%6811 = OpISub %6 %6809 %6810 +%6812 = OpLoad %6 %19 +%6813 = OpISub %6 %6811 %6812 +%6814 = OpLoad %6 %20 +%6815 = OpIAdd %6 %6813 %6814 +OpStore %526 %6815 +OpBranch %6806 +%6806 = OpLabel +%6816 = OpLoad %1035 %1054 +%6817 = OpULessThan %1057 %6816 %1072 +OpSelectionMerge %6819 None +OpBranchConditional %6817 %6818 %6819 +%6818 = OpLabel +%6820 = OpLoad %6 %14 +%6821 = OpLoad %6 %16 +%6822 = OpISub %6 %6820 %6821 +%6823 = OpLoad %6 %17 +%6824 = OpIAdd %6 %6822 %6823 +%6825 = OpLoad %6 %19 +%6826 = OpISub %6 %6824 %6825 +%6827 = OpLoad %6 %21 +%6828 = OpIAdd %6 %6826 %6827 +OpStore %527 %6828 +OpBranch %6819 +%6819 = OpLabel +%6829 = OpLoad %1035 %1054 +%6830 = OpULessThanEqual %1057 %6829 %1072 +OpSelectionMerge %6832 None +OpBranchConditional %6830 %6831 %6832 +%6831 = OpLabel +%6833 = OpLoad %6 %14 +%6834 = OpLoad %6 %16 +%6835 = OpIAdd %6 %6833 %6834 +%6836 = OpLoad %6 %17 +%6837 = OpIAdd %6 %6835 %6836 +%6838 = OpLoad %6 %19 +%6839 = OpISub %6 %6837 %6838 +%6840 = OpLoad %6 %22 +%6841 = OpIAdd %6 %6839 %6840 +OpStore %528 %6841 +OpBranch %6832 +%6832 = OpLabel +%6842 = OpLoad %1035 %1054 +%6843 = OpULessThanEqual %1057 %6842 %1072 +OpSelectionMerge %6845 None +OpBranchConditional %6843 %6844 %6845 +%6844 = OpLabel +%6846 = OpLoad %6 %14 +%6847 = OpLoad %6 %16 +%6848 = OpISub %6 %6846 %6847 +%6849 = OpLoad %6 %17 +%6850 = OpIAdd %6 %6848 %6849 +%6851 = OpLoad %6 %20 +%6852 = OpIAdd %6 %6850 %6851 +%6853 = OpLoad %6 %21 +%6854 = OpIAdd %6 %6852 %6853 +OpStore %529 %6854 +OpBranch %6845 +%6845 = OpLabel +%6855 = OpLoad %1035 %1054 +%6856 = OpULessThan %1057 %6855 %1072 +OpSelectionMerge %6858 None +OpBranchConditional %6856 %6857 %6858 +%6857 = OpLabel +%6859 = OpLoad %6 %14 +%6860 = OpLoad %6 %16 +%6861 = OpIAdd %6 %6859 %6860 +%6862 = OpLoad %6 %17 +%6863 = OpISub %6 %6861 %6862 +%6864 = OpLoad %6 %20 +%6865 = OpIAdd %6 %6863 %6864 +%6866 = OpLoad %6 %22 +%6867 = OpISub %6 %6865 %6866 +OpStore %530 %6867 +OpBranch %6858 +%6858 = OpLabel +%6868 = OpLoad %1035 %1054 +%6869 = OpUGreaterThan %1057 %6868 %1072 +OpSelectionMerge %6871 None +OpBranchConditional %6869 %6870 %6871 +%6870 = OpLabel +%6872 = OpLoad %6 %14 +%6873 = OpLoad %6 %16 +%6874 = OpIAdd %6 %6872 %6873 +%6875 = OpLoad %6 %17 +%6876 = OpISub %6 %6874 %6875 +%6877 = OpLoad %6 %21 +%6878 = OpIAdd %6 %6876 %6877 +%6879 = OpLoad %6 %22 +%6880 = OpISub %6 %6878 %6879 +OpStore %531 %6880 +OpBranch %6871 +%6871 = OpLabel +%6881 = OpLoad %1035 %1054 +%6882 = OpUGreaterThan %1057 %6881 %1138 +OpSelectionMerge %6884 None +OpBranchConditional %6882 %6883 %6884 +%6883 = OpLabel +%6885 = OpLoad %6 %14 +%6886 = OpLoad %6 %16 +%6887 = OpISub %6 %6885 %6886 +%6888 = OpLoad %6 %18 +%6889 = OpIAdd %6 %6887 %6888 +%6890 = OpLoad %6 %19 +%6891 = OpIAdd %6 %6889 %6890 +%6892 = OpLoad %6 %20 +%6893 = OpIAdd %6 %6891 %6892 +OpStore %532 %6893 +OpBranch %6884 +%6884 = OpLabel +%6894 = OpLoad %1035 %1054 +%6895 = OpULessThanEqual %1057 %6894 %1138 +OpSelectionMerge %6897 None +OpBranchConditional %6895 %6896 %6897 +%6896 = OpLabel +%6898 = OpLoad %6 %14 +%6899 = OpLoad %6 %16 +%6900 = OpIAdd %6 %6898 %6899 +%6901 = OpLoad %6 %18 +%6902 = OpIAdd %6 %6900 %6901 +%6903 = OpLoad %6 %19 +%6904 = OpIAdd %6 %6902 %6903 +%6905 = OpLoad %6 %21 +%6906 = OpIAdd %6 %6904 %6905 +OpStore %533 %6906 +OpBranch %6897 +%6897 = OpLabel +%6907 = OpLoad %1035 %1054 +%6908 = OpULessThan %1057 %6907 %1072 +OpSelectionMerge %6910 None +OpBranchConditional %6908 %6909 %6910 +%6909 = OpLabel +%6911 = OpLoad %6 %14 +%6912 = OpLoad %6 %16 +%6913 = OpIAdd %6 %6911 %6912 +%6914 = OpLoad %6 %18 +%6915 = OpIAdd %6 %6913 %6914 +%6916 = OpLoad %6 %19 +%6917 = OpISub %6 %6915 %6916 +%6918 = OpLoad %6 %22 +%6919 = OpISub %6 %6917 %6918 +OpStore %534 %6919 +OpBranch %6910 +%6910 = OpLabel +%6920 = OpLoad %1035 %1054 +%6921 = OpUGreaterThan %1057 %6920 %1056 +OpSelectionMerge %6923 None +OpBranchConditional %6921 %6922 %6923 +%6922 = OpLabel +%6924 = OpLoad %6 %14 +%6925 = OpLoad %6 %16 +%6926 = OpIAdd %6 %6924 %6925 +%6927 = OpLoad %6 %18 +%6928 = OpIAdd %6 %6926 %6927 +%6929 = OpLoad %6 %20 +%6930 = OpISub %6 %6928 %6929 +%6931 = OpLoad %6 %21 +%6932 = OpISub %6 %6930 %6931 +OpStore %535 %6932 +OpBranch %6923 +%6923 = OpLabel +%6933 = OpLoad %1035 %1054 +%6934 = OpULessThan %1057 %6933 %1072 +OpSelectionMerge %6936 None +OpBranchConditional %6934 %6935 %6936 +%6935 = OpLabel +%6937 = OpLoad %6 %13 +%6938 = OpLoad %6 %15 +%6939 = OpISub %6 %6937 %6938 +%6940 = OpLoad %6 %18 +%6941 = OpIAdd %6 %6939 %6940 +OpStore %536 %6941 +OpBranch %6936 +%6936 = OpLabel +%6942 = OpLoad %1035 %1054 +%6943 = OpINotEqual %1057 %6942 %1138 +OpSelectionMerge %6945 None +OpBranchConditional %6943 %6944 %6945 +%6944 = OpLabel +%6946 = OpLoad %6 %14 +%6947 = OpLoad %6 %16 +%6948 = OpISub %6 %6946 %6947 +%6949 = OpLoad %6 %18 +%6950 = OpIAdd %6 %6948 %6949 +%6951 = OpLoad %6 %20 +%6952 = OpIAdd %6 %6950 %6951 +%6953 = OpLoad %6 %22 +%6954 = OpIAdd %6 %6952 %6953 +OpStore %537 %6954 +OpBranch %6945 +%6945 = OpLabel +%6955 = OpLoad %1035 %1054 +%6956 = OpINotEqual %1057 %6955 %1138 +OpSelectionMerge %6958 None +OpBranchConditional %6956 %6957 %6958 +%6957 = OpLabel +%6959 = OpLoad %6 %14 +%6960 = OpLoad %6 %16 +%6961 = OpIAdd %6 %6959 %6960 +%6962 = OpLoad %6 %18 +%6963 = OpIAdd %6 %6961 %6962 +%6964 = OpLoad %6 %21 +%6965 = OpISub %6 %6963 %6964 +%6966 = OpLoad %6 %22 +%6967 = OpIAdd %6 %6965 %6966 +OpStore %538 %6967 +OpBranch %6958 +%6958 = OpLabel +%6968 = OpLoad %1035 %1054 +%6969 = OpULessThan %1057 %6968 %1094 +OpSelectionMerge %6971 None +OpBranchConditional %6969 %6970 %6971 +%6970 = OpLabel +%6972 = OpLoad %6 %14 +%6973 = OpLoad %6 %16 +%6974 = OpISub %6 %6972 %6973 +%6975 = OpLoad %6 %19 +%6976 = OpISub %6 %6974 %6975 +%6977 = OpLoad %6 %20 +%6978 = OpISub %6 %6976 %6977 +%6979 = OpLoad %6 %21 +%6980 = OpIAdd %6 %6978 %6979 +OpStore %539 %6980 +OpBranch %6971 +%6971 = OpLabel +%6981 = OpLoad %1035 %1054 +%6982 = OpIEqual %1057 %6981 %1094 +OpSelectionMerge %6984 None +OpBranchConditional %6982 %6983 %6984 +%6983 = OpLabel +%6985 = OpLoad %6 %14 +%6986 = OpLoad %6 %16 +%6987 = OpIAdd %6 %6985 %6986 +%6988 = OpLoad %6 %19 +%6989 = OpIAdd %6 %6987 %6988 +%6990 = OpLoad %6 %20 +%6991 = OpIAdd %6 %6989 %6990 +%6992 = OpLoad %6 %22 +%6993 = OpISub %6 %6991 %6992 +OpStore %540 %6993 +OpBranch %6984 +%6984 = OpLabel +%6994 = OpLoad %1035 %1054 +%6995 = OpUGreaterThanEqual %1057 %6994 %1138 +OpSelectionMerge %6997 None +OpBranchConditional %6995 %6996 %6997 +%6996 = OpLabel +%6998 = OpLoad %6 %14 +%6999 = OpLoad %6 %16 +%7000 = OpIAdd %6 %6998 %6999 +%7001 = OpLoad %6 %19 +%7002 = OpISub %6 %7000 %7001 +%7003 = OpLoad %6 %21 +%7004 = OpISub %6 %7002 %7003 +%7005 = OpLoad %6 %22 +%7006 = OpIAdd %6 %7004 %7005 +OpStore %541 %7006 +OpBranch %6997 +%6997 = OpLabel +%7007 = OpLoad %1035 %1054 +%7008 = OpINotEqual %1057 %7007 %1056 +OpSelectionMerge %7010 None +OpBranchConditional %7008 %7009 %7010 +%7009 = OpLabel +%7011 = OpLoad %6 %14 +%7012 = OpLoad %6 %16 +%7013 = OpISub %6 %7011 %7012 +%7014 = OpLoad %6 %20 +%7015 = OpISub %6 %7013 %7014 +%7016 = OpLoad %6 %21 +%7017 = OpIAdd %6 %7015 %7016 +%7018 = OpLoad %6 %22 +%7019 = OpISub %6 %7017 %7018 +OpStore %542 %7019 +OpBranch %7010 +%7010 = OpLabel +%7020 = OpLoad %1035 %1054 +%7021 = OpUGreaterThanEqual %1057 %7020 %1094 +OpSelectionMerge %7023 None +OpBranchConditional %7021 %7022 %7023 +%7022 = OpLabel +%7024 = OpLoad %6 %14 +%7025 = OpLoad %6 %17 +%7026 = OpIAdd %6 %7024 %7025 +%7027 = OpLoad %6 %18 +%7028 = OpISub %6 %7026 %7027 +%7029 = OpLoad %6 %19 +%7030 = OpISub %6 %7028 %7029 +%7031 = OpLoad %6 %20 +%7032 = OpISub %6 %7030 %7031 +OpStore %543 %7032 +OpBranch %7023 +%7023 = OpLabel +%7033 = OpLoad %1035 %1054 +%7034 = OpULessThan %1057 %7033 %1138 +OpSelectionMerge %7036 None +OpBranchConditional %7034 %7035 %7036 +%7035 = OpLabel +%7037 = OpLoad %6 %14 +%7038 = OpLoad %6 %17 +%7039 = OpISub %6 %7037 %7038 +%7040 = OpLoad %6 %18 +%7041 = OpIAdd %6 %7039 %7040 +%7042 = OpLoad %6 %19 +%7043 = OpISub %6 %7041 %7042 +%7044 = OpLoad %6 %21 +%7045 = OpISub %6 %7043 %7044 +OpStore %544 %7045 +OpBranch %7036 +%7036 = OpLabel +%7046 = OpLoad %1035 %1054 +%7047 = OpULessThanEqual %1057 %7046 %1072 +OpSelectionMerge %7049 None +OpBranchConditional %7047 %7048 %7049 +%7048 = OpLabel +%7050 = OpLoad %6 %14 +%7051 = OpLoad %6 %17 +%7052 = OpISub %6 %7050 %7051 +%7053 = OpLoad %6 %18 +%7054 = OpISub %6 %7052 %7053 +%7055 = OpLoad %6 %19 +%7056 = OpISub %6 %7054 %7055 +%7057 = OpLoad %6 %22 +%7058 = OpIAdd %6 %7056 %7057 +OpStore %545 %7058 +OpBranch %7049 +%7049 = OpLabel +%7059 = OpLoad %1035 %1054 +%7060 = OpUGreaterThan %1057 %7059 %1138 +OpSelectionMerge %7062 None +OpBranchConditional %7060 %7061 %7062 +%7061 = OpLabel +%7063 = OpLoad %6 %14 +%7064 = OpLoad %6 %17 +%7065 = OpIAdd %6 %7063 %7064 +%7066 = OpLoad %6 %18 +%7067 = OpIAdd %6 %7065 %7066 +%7068 = OpLoad %6 %20 +%7069 = OpISub %6 %7067 %7068 +%7070 = OpLoad %6 %21 +%7071 = OpIAdd %6 %7069 %7070 +OpStore %546 %7071 +OpBranch %7062 +%7062 = OpLabel +%7072 = OpLoad %1035 %1054 +%7073 = OpIEqual %1057 %7072 %1138 +OpSelectionMerge %7075 None +OpBranchConditional %7073 %7074 %7075 +%7074 = OpLabel +%7076 = OpLoad %6 %13 +%7077 = OpLoad %6 %15 +%7078 = OpISub %6 %7076 %7077 +%7079 = OpLoad %6 %19 +%7080 = OpISub %6 %7078 %7079 +OpStore %547 %7080 +OpBranch %7075 +%7075 = OpLabel +%7081 = OpLoad %1035 %1054 +%7082 = OpULessThan %1057 %7081 %1072 +OpSelectionMerge %7084 None +OpBranchConditional %7082 %7083 %7084 +%7083 = OpLabel +%7085 = OpLoad %6 %14 +%7086 = OpLoad %6 %17 +%7087 = OpIAdd %6 %7085 %7086 +%7088 = OpLoad %6 %18 +%7089 = OpISub %6 %7087 %7088 +%7090 = OpLoad %6 %20 +%7091 = OpIAdd %6 %7089 %7090 +%7092 = OpLoad %6 %22 +%7093 = OpIAdd %6 %7091 %7092 +OpStore %548 %7093 +OpBranch %7084 +%7084 = OpLabel +%7094 = OpLoad %1035 %1054 +%7095 = OpULessThanEqual %1057 %7094 %1094 +OpSelectionMerge %7097 None +OpBranchConditional %7095 %7096 %7097 +%7096 = OpLabel +%7098 = OpLoad %6 %14 +%7099 = OpLoad %6 %17 +%7100 = OpISub %6 %7098 %7099 +%7101 = OpLoad %6 %18 +%7102 = OpISub %6 %7100 %7101 +%7103 = OpLoad %6 %21 +%7104 = OpIAdd %6 %7102 %7103 +%7105 = OpLoad %6 %22 +%7106 = OpIAdd %6 %7104 %7105 +OpStore %549 %7106 +OpBranch %7097 +%7097 = OpLabel +%7107 = OpLoad %1035 %1054 +%7108 = OpIEqual %1057 %7107 %1138 +OpSelectionMerge %7110 None +OpBranchConditional %7108 %7109 %7110 +%7109 = OpLabel +%7111 = OpLoad %6 %14 +%7112 = OpLoad %6 %17 +%7113 = OpISub %6 %7111 %7112 +%7114 = OpLoad %6 %19 +%7115 = OpISub %6 %7113 %7114 +%7116 = OpLoad %6 %20 +%7117 = OpIAdd %6 %7115 %7116 +%7118 = OpLoad %6 %21 +%7119 = OpIAdd %6 %7117 %7118 +OpStore %550 %7119 +OpBranch %7110 +%7110 = OpLabel +%7120 = OpLoad %1035 %1054 +%7121 = OpIEqual %1057 %7120 %1072 +OpSelectionMerge %7123 None +OpBranchConditional %7121 %7122 %7123 +%7122 = OpLabel +%7124 = OpLoad %6 %14 +%7125 = OpLoad %6 %17 +%7126 = OpIAdd %6 %7124 %7125 +%7127 = OpLoad %6 %19 +%7128 = OpISub %6 %7126 %7127 +%7129 = OpLoad %6 %20 +%7130 = OpISub %6 %7128 %7129 +%7131 = OpLoad %6 %22 +%7132 = OpISub %6 %7130 %7131 +OpStore %551 %7132 +OpBranch %7123 +%7123 = OpLabel +%7133 = OpLoad %1035 %1054 +%7134 = OpUGreaterThan %1057 %7133 %1072 +OpSelectionMerge %7136 None +OpBranchConditional %7134 %7135 %7136 +%7135 = OpLabel +%7137 = OpLoad %6 %14 +%7138 = OpLoad %6 %17 +%7139 = OpISub %6 %7137 %7138 +%7140 = OpLoad %6 %19 +%7141 = OpISub %6 %7139 %7140 +%7142 = OpLoad %6 %21 +%7143 = OpISub %6 %7141 %7142 +%7144 = OpLoad %6 %22 +%7145 = OpISub %6 %7143 %7144 +OpStore %552 %7145 +OpBranch %7136 +%7136 = OpLabel +%7146 = OpLoad %1035 %1054 +%7147 = OpIEqual %1057 %7146 %1138 +OpSelectionMerge %7149 None +OpBranchConditional %7147 %7148 %7149 +%7148 = OpLabel +%7150 = OpLoad %6 %14 +%7151 = OpLoad %6 %17 +%7152 = OpIAdd %6 %7150 %7151 +%7153 = OpLoad %6 %20 +%7154 = OpISub %6 %7152 %7153 +%7155 = OpLoad %6 %21 +%7156 = OpIAdd %6 %7154 %7155 +%7157 = OpLoad %6 %22 +%7158 = OpIAdd %6 %7156 %7157 +OpStore %553 %7158 +OpBranch %7149 +%7149 = OpLabel +%7159 = OpLoad %1035 %1054 +%7160 = OpIEqual %1057 %7159 %1138 +OpSelectionMerge %7162 None +OpBranchConditional %7160 %7161 %7162 +%7161 = OpLabel +%7163 = OpLoad %6 %14 +%7164 = OpLoad %6 %18 +%7165 = OpIAdd %6 %7163 %7164 +%7166 = OpLoad %6 %19 +%7167 = OpISub %6 %7165 %7166 +%7168 = OpLoad %6 %20 +%7169 = OpISub %6 %7167 %7168 +%7170 = OpLoad %6 %21 +%7171 = OpISub %6 %7169 %7170 +OpStore %554 %7171 +OpBranch %7162 +%7162 = OpLabel +%7172 = OpLoad %1035 %1054 +%7173 = OpIEqual %1057 %7172 %1094 +OpSelectionMerge %7175 None +OpBranchConditional %7173 %7174 %7175 +%7174 = OpLabel +%7176 = OpLoad %6 %14 +%7177 = OpLoad %6 %18 +%7178 = OpISub %6 %7176 %7177 +%7179 = OpLoad %6 %19 +%7180 = OpISub %6 %7178 %7179 +%7181 = OpLoad %6 %20 +%7182 = OpISub %6 %7180 %7181 +%7183 = OpLoad %6 %22 +%7184 = OpIAdd %6 %7182 %7183 +OpStore %555 %7184 +OpBranch %7175 +%7175 = OpLabel +%7185 = OpLoad %1035 %1054 +%7186 = OpULessThanEqual %1057 %7185 %1056 +OpSelectionMerge %7188 None +OpBranchConditional %7186 %7187 %7188 +%7187 = OpLabel +%7189 = OpLoad %6 %14 +%7190 = OpLoad %6 %18 +%7191 = OpISub %6 %7189 %7190 +%7192 = OpLoad %6 %19 +%7193 = OpISub %6 %7191 %7192 +%7194 = OpLoad %6 %21 +%7195 = OpIAdd %6 %7193 %7194 +%7196 = OpLoad %6 %22 +%7197 = OpIAdd %6 %7195 %7196 +OpStore %556 %7197 +OpBranch %7188 +%7188 = OpLabel +%7198 = OpLoad %1035 %1054 +%7199 = OpUGreaterThan %1057 %7198 %1094 +OpSelectionMerge %7201 None +OpBranchConditional %7199 %7200 %7201 +%7200 = OpLabel +%7202 = OpLoad %6 %14 +%7203 = OpLoad %6 %18 +%7204 = OpIAdd %6 %7202 %7203 +%7205 = OpLoad %6 %20 +%7206 = OpISub %6 %7204 %7205 +%7207 = OpLoad %6 %21 +%7208 = OpISub %6 %7206 %7207 +%7209 = OpLoad %6 %22 +%7210 = OpISub %6 %7208 %7209 +OpStore %557 %7210 +OpBranch %7201 +%7201 = OpLabel +%7211 = OpLoad %1035 %1054 +%7212 = OpUGreaterThan %1057 %7211 %1138 +OpSelectionMerge %7214 None +OpBranchConditional %7212 %7213 %7214 +%7213 = OpLabel +%7215 = OpLoad %6 %13 +%7216 = OpLoad %6 %15 +%7217 = OpISub %6 %7215 %7216 +%7218 = OpLoad %6 %20 +%7219 = OpIAdd %6 %7217 %7218 +OpStore %558 %7219 +OpBranch %7214 +%7214 = OpLabel +%7220 = OpLoad %1035 %1054 +%7221 = OpIEqual %1057 %7220 %1094 +OpSelectionMerge %7223 None +OpBranchConditional %7221 %7222 %7223 +%7222 = OpLabel +%7224 = OpLoad %6 %14 +%7225 = OpLoad %6 %19 +%7226 = OpISub %6 %7224 %7225 +%7227 = OpLoad %6 %20 +%7228 = OpISub %6 %7226 %7227 +%7229 = OpLoad %6 %21 +%7230 = OpISub %6 %7228 %7229 +%7231 = OpLoad %6 %22 +%7232 = OpIAdd %6 %7230 %7231 +OpStore %559 %7232 +OpBranch %7223 +%7223 = OpLabel +%7233 = OpLoad %1035 %1054 +%7234 = OpUGreaterThan %1057 %7233 %1056 +OpSelectionMerge %7236 None +OpBranchConditional %7234 %7235 %7236 +%7235 = OpLabel +%7237 = OpLoad %6 %15 +%7238 = OpLoad %6 %16 +%7239 = OpISub %6 %7237 %7238 +%7240 = OpLoad %6 %17 +%7241 = OpIAdd %6 %7239 %7240 +%7242 = OpLoad %6 %18 +%7243 = OpIAdd %6 %7241 %7242 +%7244 = OpLoad %6 %19 +%7245 = OpISub %6 %7243 %7244 +OpStore %560 %7245 +OpBranch %7236 +%7236 = OpLabel +%7246 = OpLoad %1035 %1054 +%7247 = OpULessThan %1057 %7246 %1138 +OpSelectionMerge %7249 None +OpBranchConditional %7247 %7248 %7249 +%7248 = OpLabel +%7250 = OpLoad %6 %15 +%7251 = OpLoad %6 %16 +%7252 = OpISub %6 %7250 %7251 +%7253 = OpLoad %6 %17 +%7254 = OpISub %6 %7252 %7253 +%7255 = OpLoad %6 %18 +%7256 = OpISub %6 %7254 %7255 +%7257 = OpLoad %6 %20 +%7258 = OpIAdd %6 %7256 %7257 +OpStore %561 %7258 +OpBranch %7249 +%7249 = OpLabel +%7259 = OpLoad %1035 %1054 +%7260 = OpINotEqual %1057 %7259 %1056 +OpSelectionMerge %7262 None +OpBranchConditional %7260 %7261 %7262 +%7261 = OpLabel +%7263 = OpLoad %6 %15 +%7264 = OpLoad %6 %16 +%7265 = OpIAdd %6 %7263 %7264 +%7266 = OpLoad %6 %17 +%7267 = OpIAdd %6 %7265 %7266 +%7268 = OpLoad %6 %18 +%7269 = OpIAdd %6 %7267 %7268 +%7270 = OpLoad %6 %21 +%7271 = OpISub %6 %7269 %7270 +OpStore %562 %7271 +OpBranch %7262 +%7262 = OpLabel +%7272 = OpLoad %1035 %1054 +%7273 = OpULessThanEqual %1057 %7272 %1072 +OpSelectionMerge %7275 None +OpBranchConditional %7273 %7274 %7275 +%7274 = OpLabel +%7276 = OpLoad %6 %15 +%7277 = OpLoad %6 %16 +%7278 = OpISub %6 %7276 %7277 +%7279 = OpLoad %6 %17 +%7280 = OpISub %6 %7278 %7279 +%7281 = OpLoad %6 %18 +%7282 = OpISub %6 %7280 %7281 +%7283 = OpLoad %6 %22 +%7284 = OpIAdd %6 %7282 %7283 +OpStore %563 %7284 +OpBranch %7275 +%7275 = OpLabel +%7285 = OpLoad %1035 %1054 +%7286 = OpULessThan %1057 %7285 %1094 +OpSelectionMerge %7288 None +OpBranchConditional %7286 %7287 %7288 +%7287 = OpLabel +%7289 = OpLoad %6 %15 +%7290 = OpLoad %6 %16 +%7291 = OpISub %6 %7289 %7290 +%7292 = OpLoad %6 %17 +%7293 = OpIAdd %6 %7291 %7292 +%7294 = OpLoad %6 %19 +%7295 = OpIAdd %6 %7293 %7294 +%7296 = OpLoad %6 %20 +%7297 = OpISub %6 %7295 %7296 +OpStore %564 %7297 +OpBranch %7288 +%7288 = OpLabel +%7298 = OpLoad %1035 %1054 +%7299 = OpULessThan %1057 %7298 %1072 +OpSelectionMerge %7301 None +OpBranchConditional %7299 %7300 %7301 +%7300 = OpLabel +%7302 = OpLoad %6 %15 +%7303 = OpLoad %6 %16 +%7304 = OpIAdd %6 %7302 %7303 +%7305 = OpLoad %6 %17 +%7306 = OpIAdd %6 %7304 %7305 +%7307 = OpLoad %6 %19 +%7308 = OpIAdd %6 %7306 %7307 +%7309 = OpLoad %6 %21 +%7310 = OpIAdd %6 %7308 %7309 +OpStore %565 %7310 +OpBranch %7301 +%7301 = OpLabel +%7311 = OpLoad %1035 %1054 +%7312 = OpIEqual %1057 %7311 %1138 +OpSelectionMerge %7314 None +OpBranchConditional %7312 %7313 %7314 +%7313 = OpLabel +%7315 = OpLoad %6 %15 +%7316 = OpLoad %6 %16 +%7317 = OpISub %6 %7315 %7316 +%7318 = OpLoad %6 %17 +%7319 = OpIAdd %6 %7317 %7318 +%7320 = OpLoad %6 %19 +%7321 = OpISub %6 %7319 %7320 +%7322 = OpLoad %6 %22 +%7323 = OpISub %6 %7321 %7322 +OpStore %566 %7323 +OpBranch %7314 +%7314 = OpLabel +%7324 = OpLoad %1035 %1054 +%7325 = OpULessThan %1057 %7324 %1094 +OpSelectionMerge %7327 None +OpBranchConditional %7325 %7326 %7327 +%7326 = OpLabel +%7328 = OpLoad %6 %15 +%7329 = OpLoad %6 %16 +%7330 = OpISub %6 %7328 %7329 +%7331 = OpLoad %6 %17 +%7332 = OpISub %6 %7330 %7331 +%7333 = OpLoad %6 %20 +%7334 = OpIAdd %6 %7332 %7333 +%7335 = OpLoad %6 %21 +%7336 = OpISub %6 %7334 %7335 +OpStore %567 %7336 +OpBranch %7327 +%7327 = OpLabel +%7337 = OpLoad %1035 %1054 +%7338 = OpULessThanEqual %1057 %7337 %1056 +OpSelectionMerge %7340 None +OpBranchConditional %7338 %7339 %7340 +%7339 = OpLabel +%7341 = OpLoad %6 %15 +%7342 = OpLoad %6 %16 +%7343 = OpIAdd %6 %7341 %7342 +%7344 = OpLoad %6 %17 +%7345 = OpISub %6 %7343 %7344 +%7346 = OpLoad %6 %20 +%7347 = OpIAdd %6 %7345 %7346 +%7348 = OpLoad %6 %22 +%7349 = OpISub %6 %7347 %7348 +OpStore %568 %7349 +OpBranch %7340 +%7340 = OpLabel +%7350 = OpLoad %1035 %1054 +%7351 = OpUGreaterThan %1057 %7350 %1056 +OpSelectionMerge %7353 None +OpBranchConditional %7351 %7352 %7353 +%7352 = OpLabel +%7354 = OpLoad %6 %13 +%7355 = OpLoad %6 %15 +%7356 = OpISub %6 %7354 %7355 +%7357 = OpLoad %6 %21 +%7358 = OpIAdd %6 %7356 %7357 +OpStore %569 %7358 +OpBranch %7353 +%7353 = OpLabel +%7359 = OpLoad %1035 %1054 +%7360 = OpULessThanEqual %1057 %7359 %1138 +OpSelectionMerge %7362 None +OpBranchConditional %7360 %7361 %7362 +%7361 = OpLabel +%7363 = OpLoad %6 %15 +%7364 = OpLoad %6 %16 +%7365 = OpISub %6 %7363 %7364 +%7366 = OpLoad %6 %17 +%7367 = OpIAdd %6 %7365 %7366 +%7368 = OpLoad %6 %21 +%7369 = OpISub %6 %7367 %7368 +%7370 = OpLoad %6 %22 +%7371 = OpISub %6 %7369 %7370 +OpStore %570 %7371 +OpBranch %7362 +%7362 = OpLabel +%7372 = OpLoad %1035 %1054 +%7373 = OpUGreaterThanEqual %1057 %7372 %1138 +OpSelectionMerge %7375 None +OpBranchConditional %7373 %7374 %7375 +%7374 = OpLabel +%7376 = OpLoad %6 %15 +%7377 = OpLoad %6 %16 +%7378 = OpIAdd %6 %7376 %7377 +%7379 = OpLoad %6 %18 +%7380 = OpISub %6 %7378 %7379 +%7381 = OpLoad %6 %19 +%7382 = OpIAdd %6 %7380 %7381 +%7383 = OpLoad %6 %20 +%7384 = OpISub %6 %7382 %7383 +OpStore %571 %7384 +OpBranch %7375 +%7375 = OpLabel +%7385 = OpLoad %1035 %1054 +%7386 = OpINotEqual %1057 %7385 %1072 +OpSelectionMerge %7388 None +OpBranchConditional %7386 %7387 %7388 +%7387 = OpLabel +%7389 = OpLoad %6 %15 +%7390 = OpLoad %6 %16 +%7391 = OpIAdd %6 %7389 %7390 +%7392 = OpLoad %6 %18 +%7393 = OpIAdd %6 %7391 %7392 +%7394 = OpLoad %6 %19 +%7395 = OpISub %6 %7393 %7394 +%7396 = OpLoad %6 %21 +%7397 = OpIAdd %6 %7395 %7396 +OpStore %572 %7397 +OpBranch %7388 +%7388 = OpLabel +%7398 = OpLoad %1035 %1054 +%7399 = OpIEqual %1057 %7398 %1056 +OpSelectionMerge %7401 None +OpBranchConditional %7399 %7400 %7401 +%7400 = OpLabel +%7402 = OpLoad %6 %15 +%7403 = OpLoad %6 %16 +%7404 = OpISub %6 %7402 %7403 +%7405 = OpLoad %6 %18 +%7406 = OpIAdd %6 %7404 %7405 +%7407 = OpLoad %6 %19 +%7408 = OpISub %6 %7406 %7407 +%7409 = OpLoad %6 %22 +%7410 = OpISub %6 %7408 %7409 +OpStore %573 %7410 +OpBranch %7401 +%7401 = OpLabel +%7411 = OpLoad %1035 %1054 +%7412 = OpINotEqual %1057 %7411 %1094 +OpSelectionMerge %7414 None +OpBranchConditional %7412 %7413 %7414 +%7413 = OpLabel +%7415 = OpLoad %6 %15 +%7416 = OpLoad %6 %16 +%7417 = OpISub %6 %7415 %7416 +%7418 = OpLoad %6 %18 +%7419 = OpIAdd %6 %7417 %7418 +%7420 = OpLoad %6 %20 +%7421 = OpIAdd %6 %7419 %7420 +%7422 = OpLoad %6 %21 +%7423 = OpIAdd %6 %7421 %7422 +OpStore %574 %7423 +OpBranch %7414 +%7414 = OpLabel +%7424 = OpLoad %1035 %1054 +%7425 = OpUGreaterThan %1057 %7424 %1072 +OpSelectionMerge %7427 None +OpBranchConditional %7425 %7426 %7427 +%7426 = OpLabel +%7428 = OpLoad %6 %15 +%7429 = OpLoad %6 %16 +%7430 = OpIAdd %6 %7428 %7429 +%7431 = OpLoad %6 %18 +%7432 = OpIAdd %6 %7430 %7431 +%7433 = OpLoad %6 %20 +%7434 = OpIAdd %6 %7432 %7433 +%7435 = OpLoad %6 %22 +%7436 = OpISub %6 %7434 %7435 +OpStore %575 %7436 +OpBranch %7427 +%7427 = OpLabel +%7437 = OpLoad %1035 %1054 +%7438 = OpUGreaterThanEqual %1057 %7437 %1094 +OpSelectionMerge %7440 None +OpBranchConditional %7438 %7439 %7440 +%7439 = OpLabel +%7441 = OpLoad %6 %15 +%7442 = OpLoad %6 %16 +%7443 = OpISub %6 %7441 %7442 +%7444 = OpLoad %6 %18 +%7445 = OpIAdd %6 %7443 %7444 +%7446 = OpLoad %6 %21 +%7447 = OpISub %6 %7445 %7446 +%7448 = OpLoad %6 %22 +%7449 = OpISub %6 %7447 %7448 +OpStore %576 %7449 +OpBranch %7440 +%7440 = OpLabel +%7450 = OpLoad %1035 %1054 +%7451 = OpULessThanEqual %1057 %7450 %1094 +OpSelectionMerge %7453 None +OpBranchConditional %7451 %7452 %7453 +%7452 = OpLabel +%7454 = OpLoad %6 %15 +%7455 = OpLoad %6 %16 +%7456 = OpISub %6 %7454 %7455 +%7457 = OpLoad %6 %19 +%7458 = OpISub %6 %7456 %7457 +%7459 = OpLoad %6 %20 +%7460 = OpIAdd %6 %7458 %7459 +%7461 = OpLoad %6 %21 +%7462 = OpISub %6 %7460 %7461 +OpStore %577 %7462 +OpBranch %7453 +%7453 = OpLabel +%7463 = OpLoad %1035 %1054 +%7464 = OpULessThan %1057 %7463 %1094 +OpSelectionMerge %7466 None +OpBranchConditional %7464 %7465 %7466 +%7465 = OpLabel +%7467 = OpLoad %6 %15 +%7468 = OpLoad %6 %16 +%7469 = OpISub %6 %7467 %7468 +%7470 = OpLoad %6 %19 +%7471 = OpISub %6 %7469 %7470 +%7472 = OpLoad %6 %20 +%7473 = OpIAdd %6 %7471 %7472 +%7474 = OpLoad %6 %22 +%7475 = OpISub %6 %7473 %7474 +OpStore %578 %7475 +OpBranch %7466 +%7466 = OpLabel +%7476 = OpLoad %1035 %1054 +%7477 = OpUGreaterThanEqual %1057 %7476 %1056 +OpSelectionMerge %7479 None +OpBranchConditional %7477 %7478 %7479 +%7478 = OpLabel +%7480 = OpLoad %6 %15 +%7481 = OpLoad %6 %16 +%7482 = OpISub %6 %7480 %7481 +%7483 = OpLoad %6 %19 +%7484 = OpISub %6 %7482 %7483 +%7485 = OpLoad %6 %21 +%7486 = OpIAdd %6 %7484 %7485 +%7487 = OpLoad %6 %22 +%7488 = OpISub %6 %7486 %7487 +OpStore %579 %7488 +OpBranch %7479 +%7479 = OpLabel +%7489 = OpLoad %1035 %1054 +%7490 = OpUGreaterThanEqual %1057 %7489 %1094 +OpSelectionMerge %7492 None +OpBranchConditional %7490 %7491 %7492 +%7491 = OpLabel +%7493 = OpLoad %6 %13 +%7494 = OpLoad %6 %15 +%7495 = OpIAdd %6 %7493 %7494 +%7496 = OpLoad %6 %22 +%7497 = OpIAdd %6 %7495 %7496 +OpStore %580 %7497 +OpBranch %7492 +%7492 = OpLabel +%7498 = OpLoad %1035 %1054 +%7499 = OpUGreaterThan %1057 %7498 %1072 +OpSelectionMerge %7501 None +OpBranchConditional %7499 %7500 %7501 +%7500 = OpLabel +%7502 = OpLoad %6 %15 +%7503 = OpLoad %6 %16 +%7504 = OpISub %6 %7502 %7503 +%7505 = OpLoad %6 %20 +%7506 = OpISub %6 %7504 %7505 +%7507 = OpLoad %6 %21 +%7508 = OpIAdd %6 %7506 %7507 +%7509 = OpLoad %6 %22 +%7510 = OpIAdd %6 %7508 %7509 +OpStore %581 %7510 +OpBranch %7501 +%7501 = OpLabel +%7511 = OpLoad %1035 %1054 +%7512 = OpUGreaterThanEqual %1057 %7511 %1094 +OpSelectionMerge %7514 None +OpBranchConditional %7512 %7513 %7514 +%7513 = OpLabel +%7515 = OpLoad %6 %15 +%7516 = OpLoad %6 %17 +%7517 = OpIAdd %6 %7515 %7516 +%7518 = OpLoad %6 %18 +%7519 = OpISub %6 %7517 %7518 +%7520 = OpLoad %6 %19 +%7521 = OpIAdd %6 %7519 %7520 +%7522 = OpLoad %6 %20 +%7523 = OpISub %6 %7521 %7522 +OpStore %582 %7523 +OpBranch %7514 +%7514 = OpLabel +%7524 = OpLoad %1035 %1054 +%7525 = OpUGreaterThan %1057 %7524 %1072 +OpSelectionMerge %7527 None +OpBranchConditional %7525 %7526 %7527 +%7526 = OpLabel +%7528 = OpLoad %6 %15 +%7529 = OpLoad %6 %17 +%7530 = OpISub %6 %7528 %7529 +%7531 = OpLoad %6 %18 +%7532 = OpIAdd %6 %7530 %7531 +%7533 = OpLoad %6 %19 +%7534 = OpISub %6 %7532 %7533 +%7535 = OpLoad %6 %21 +%7536 = OpISub %6 %7534 %7535 +OpStore %583 %7536 +OpBranch %7527 +%7527 = OpLabel +%7537 = OpLoad %1035 %1054 +%7538 = OpUGreaterThan %1057 %7537 %1072 +OpSelectionMerge %7540 None +OpBranchConditional %7538 %7539 %7540 +%7539 = OpLabel +%7541 = OpLoad %6 %15 +%7542 = OpLoad %6 %17 +%7543 = OpIAdd %6 %7541 %7542 +%7544 = OpLoad %6 %18 +%7545 = OpIAdd %6 %7543 %7544 +%7546 = OpLoad %6 %19 +%7547 = OpIAdd %6 %7545 %7546 +%7548 = OpLoad %6 %22 +%7549 = OpIAdd %6 %7547 %7548 +OpStore %584 %7549 +OpBranch %7540 +%7540 = OpLabel +%7550 = OpLoad %1035 %1054 +%7551 = OpULessThan %1057 %7550 %1072 +OpSelectionMerge %7553 None +OpBranchConditional %7551 %7552 %7553 +%7552 = OpLabel +%7554 = OpLoad %6 %15 +%7555 = OpLoad %6 %17 +%7556 = OpIAdd %6 %7554 %7555 +%7557 = OpLoad %6 %18 +%7558 = OpISub %6 %7556 %7557 +%7559 = OpLoad %6 %20 +%7560 = OpIAdd %6 %7558 %7559 +%7561 = OpLoad %6 %21 +%7562 = OpISub %6 %7560 %7561 +OpStore %585 %7562 +OpBranch %7553 +%7553 = OpLabel +%7563 = OpLoad %1035 %1054 +%7564 = OpIEqual %1057 %7563 %1094 +OpSelectionMerge %7566 None +OpBranchConditional %7564 %7565 %7566 +%7565 = OpLabel +%7567 = OpLoad %6 %15 +%7568 = OpLoad %6 %17 +%7569 = OpISub %6 %7567 %7568 +%7570 = OpLoad %6 %18 +%7571 = OpIAdd %6 %7569 %7570 +%7572 = OpLoad %6 %20 +%7573 = OpIAdd %6 %7571 %7572 +%7574 = OpLoad %6 %22 +%7575 = OpISub %6 %7573 %7574 +OpStore %586 %7575 +OpBranch %7566 +%7566 = OpLabel +%7576 = OpLoad %1035 %1054 +%7577 = OpIEqual %1057 %7576 %1072 +OpSelectionMerge %7579 None +OpBranchConditional %7577 %7578 %7579 +%7578 = OpLabel +%7580 = OpLoad %6 %15 +%7581 = OpLoad %6 %17 +%7582 = OpISub %6 %7580 %7581 +%7583 = OpLoad %6 %18 +%7584 = OpISub %6 %7582 %7583 +%7585 = OpLoad %6 %21 +%7586 = OpIAdd %6 %7584 %7585 +%7587 = OpLoad %6 %22 +%7588 = OpISub %6 %7586 %7587 +OpStore %587 %7588 +OpBranch %7579 +%7579 = OpLabel +%7589 = OpLoad %1035 %1054 +%7590 = OpULessThan %1057 %7589 %1072 +OpSelectionMerge %7592 None +OpBranchConditional %7590 %7591 %7592 +%7591 = OpLabel +%7593 = OpLoad %6 %15 +%7594 = OpLoad %6 %17 +%7595 = OpIAdd %6 %7593 %7594 +%7596 = OpLoad %6 %19 +%7597 = OpIAdd %6 %7595 %7596 +%7598 = OpLoad %6 %20 +%7599 = OpIAdd %6 %7597 %7598 +%7600 = OpLoad %6 %21 +%7601 = OpISub %6 %7599 %7600 +OpStore %588 %7601 +OpBranch %7592 +%7592 = OpLabel +%7602 = OpLoad %1035 %1054 +%7603 = OpULessThan %1057 %7602 %1094 +OpSelectionMerge %7605 None +OpBranchConditional %7603 %7604 %7605 +%7604 = OpLabel +%7606 = OpLoad %6 %15 +%7607 = OpLoad %6 %17 +%7608 = OpIAdd %6 %7606 %7607 +%7609 = OpLoad %6 %19 +%7610 = OpIAdd %6 %7608 %7609 +%7611 = OpLoad %6 %20 +%7612 = OpISub %6 %7610 %7611 +%7613 = OpLoad %6 %22 +%7614 = OpISub %6 %7612 %7613 +OpStore %589 %7614 +OpBranch %7605 +%7605 = OpLabel +%7615 = OpLoad %1035 %1054 +%7616 = OpULessThan %1057 %7615 %1138 +OpSelectionMerge %7618 None +OpBranchConditional %7616 %7617 %7618 +%7617 = OpLabel +%7619 = OpLoad %6 %15 +%7620 = OpLoad %6 %17 +%7621 = OpIAdd %6 %7619 %7620 +%7622 = OpLoad %6 %19 +%7623 = OpIAdd %6 %7621 %7622 +%7624 = OpLoad %6 %21 +%7625 = OpISub %6 %7623 %7624 +%7626 = OpLoad %6 %22 +%7627 = OpISub %6 %7625 %7626 +OpStore %590 %7627 +OpBranch %7618 +%7618 = OpLabel +%7628 = OpLoad %1035 %1054 +%7629 = OpINotEqual %1057 %7628 %1056 +OpSelectionMerge %7631 None +OpBranchConditional %7629 %7630 %7631 +%7630 = OpLabel +%7632 = OpLoad %6 %13 +%7633 = OpLoad %6 %20 +%7634 = OpISub %6 %7632 %7633 +OpStore %591 %7634 +OpBranch %7631 +%7631 = OpLabel +%7635 = OpLoad %1035 %1054 +%7636 = OpULessThanEqual %1057 %7635 %1056 +OpSelectionMerge %7638 None +OpBranchConditional %7636 %7637 %7638 +%7637 = OpLabel +%7639 = OpLoad %6 %13 +%7640 = OpLoad %6 %16 +%7641 = OpIAdd %6 %7639 %7640 +%7642 = OpLoad %6 %17 +%7643 = OpIAdd %6 %7641 %7642 +OpStore %592 %7643 +OpBranch %7638 +%7638 = OpLabel +%7644 = OpLoad %1035 %1054 +%7645 = OpULessThan %1057 %7644 %1072 +OpSelectionMerge %7647 None +OpBranchConditional %7645 %7646 %7647 +%7646 = OpLabel +%7648 = OpLoad %6 %15 +%7649 = OpLoad %6 %17 +%7650 = OpIAdd %6 %7648 %7649 +%7651 = OpLoad %6 %20 +%7652 = OpIAdd %6 %7650 %7651 +%7653 = OpLoad %6 %21 +%7654 = OpISub %6 %7652 %7653 +%7655 = OpLoad %6 %22 +%7656 = OpIAdd %6 %7654 %7655 +OpStore %593 %7656 +OpBranch %7647 +%7647 = OpLabel +%7657 = OpLoad %1035 %1054 +%7658 = OpUGreaterThanEqual %1057 %7657 %1056 +OpSelectionMerge %7660 None +OpBranchConditional %7658 %7659 %7660 +%7659 = OpLabel +%7661 = OpLoad %6 %15 +%7662 = OpLoad %6 %18 +%7663 = OpISub %6 %7661 %7662 +%7664 = OpLoad %6 %19 +%7665 = OpISub %6 %7663 %7664 +%7666 = OpLoad %6 %20 +%7667 = OpISub %6 %7665 %7666 +%7668 = OpLoad %6 %21 +%7669 = OpISub %6 %7667 %7668 +OpStore %594 %7669 +OpBranch %7660 +%7660 = OpLabel +%7670 = OpLoad %1035 %1054 +%7671 = OpUGreaterThanEqual %1057 %7670 %1094 +OpSelectionMerge %7673 None +OpBranchConditional %7671 %7672 %7673 +%7672 = OpLabel +%7674 = OpLoad %6 %15 +%7675 = OpLoad %6 %18 +%7676 = OpISub %6 %7674 %7675 +%7677 = OpLoad %6 %19 +%7678 = OpIAdd %6 %7676 %7677 +%7679 = OpLoad %6 %20 +%7680 = OpIAdd %6 %7678 %7679 +%7681 = OpLoad %6 %22 +%7682 = OpISub %6 %7680 %7681 +OpStore %595 %7682 +OpBranch %7673 +%7673 = OpLabel +%7683 = OpLoad %1035 %1054 +%7684 = OpULessThan %1057 %7683 %1094 +OpSelectionMerge %7686 None +OpBranchConditional %7684 %7685 %7686 +%7685 = OpLabel +%7687 = OpLoad %6 %15 +%7688 = OpLoad %6 %18 +%7689 = OpIAdd %6 %7687 %7688 +%7690 = OpLoad %6 %19 +%7691 = OpISub %6 %7689 %7690 +%7692 = OpLoad %6 %21 +%7693 = OpIAdd %6 %7691 %7692 +%7694 = OpLoad %6 %22 +%7695 = OpISub %6 %7693 %7694 +OpStore %596 %7695 +OpBranch %7686 +%7686 = OpLabel +%7696 = OpLoad %1035 %1054 +%7697 = OpUGreaterThan %1057 %7696 %1072 +OpSelectionMerge %7699 None +OpBranchConditional %7697 %7698 %7699 +%7698 = OpLabel +%7700 = OpLoad %6 %15 +%7701 = OpLoad %6 %18 +%7702 = OpISub %6 %7700 %7701 +%7703 = OpLoad %6 %20 +%7704 = OpISub %6 %7702 %7703 +%7705 = OpLoad %6 %21 +%7706 = OpISub %6 %7704 %7705 +%7707 = OpLoad %6 %22 +%7708 = OpIAdd %6 %7706 %7707 +OpStore %597 %7708 +OpBranch %7699 +%7699 = OpLabel +%7709 = OpLoad %1035 %1054 +%7710 = OpUGreaterThan %1057 %7709 %1138 +OpSelectionMerge %7712 None +OpBranchConditional %7710 %7711 %7712 +%7711 = OpLabel +%7713 = OpLoad %6 %15 +%7714 = OpLoad %6 %19 +%7715 = OpISub %6 %7713 %7714 +%7716 = OpLoad %6 %20 +%7717 = OpIAdd %6 %7715 %7716 +%7718 = OpLoad %6 %21 +%7719 = OpISub %6 %7717 %7718 +%7720 = OpLoad %6 %22 +%7721 = OpISub %6 %7719 %7720 +OpStore %598 %7721 +OpBranch %7712 +%7712 = OpLabel +%7722 = OpLoad %1035 %1054 +%7723 = OpULessThanEqual %1057 %7722 %1094 +OpSelectionMerge %7725 None +OpBranchConditional %7723 %7724 %7725 +%7724 = OpLabel +%7726 = OpLoad %6 %16 +%7727 = OpLoad %6 %17 +%7728 = OpIAdd %6 %7726 %7727 +%7729 = OpLoad %6 %18 +%7730 = OpIAdd %6 %7728 %7729 +%7731 = OpLoad %6 %19 +%7732 = OpISub %6 %7730 %7731 +%7733 = OpLoad %6 %20 +%7734 = OpISub %6 %7732 %7733 +OpStore %599 %7734 +OpBranch %7725 +%7725 = OpLabel +%7735 = OpLoad %1035 %1054 +%7736 = OpULessThan %1057 %7735 %1056 +OpSelectionMerge %7738 None +OpBranchConditional %7736 %7737 %7738 +%7737 = OpLabel +%7739 = OpLoad %6 %16 +%7740 = OpLoad %6 %17 +%7741 = OpISub %6 %7739 %7740 +%7742 = OpLoad %6 %18 +%7743 = OpISub %6 %7741 %7742 +%7744 = OpLoad %6 %19 +%7745 = OpIAdd %6 %7743 %7744 +%7746 = OpLoad %6 %21 +%7747 = OpIAdd %6 %7745 %7746 +OpStore %600 %7747 +OpBranch %7738 +%7738 = OpLabel +%7748 = OpLoad %1035 %1054 +%7749 = OpIEqual %1057 %7748 %1138 +OpSelectionMerge %7751 None +OpBranchConditional %7749 %7750 %7751 +%7750 = OpLabel +%7752 = OpLoad %6 %16 +%7753 = OpLoad %6 %17 +%7754 = OpISub %6 %7752 %7753 +%7755 = OpLoad %6 %18 +%7756 = OpIAdd %6 %7754 %7755 +%7757 = OpLoad %6 %19 +%7758 = OpIAdd %6 %7756 %7757 +%7759 = OpLoad %6 %22 +%7760 = OpISub %6 %7758 %7759 +OpStore %601 %7760 +OpBranch %7751 +%7751 = OpLabel +%7761 = OpLoad %1035 %1054 +%7762 = OpINotEqual %1057 %7761 %1072 +OpSelectionMerge %7764 None +OpBranchConditional %7762 %7763 %7764 +%7763 = OpLabel +%7765 = OpLoad %6 %16 +%7766 = OpLoad %6 %17 +%7767 = OpIAdd %6 %7765 %7766 +%7768 = OpLoad %6 %18 +%7769 = OpIAdd %6 %7767 %7768 +%7770 = OpLoad %6 %20 +%7771 = OpISub %6 %7769 %7770 +%7772 = OpLoad %6 %21 +%7773 = OpISub %6 %7771 %7772 +OpStore %602 %7773 +OpBranch %7764 +%7764 = OpLabel +%7774 = OpLoad %1035 %1054 +%7775 = OpULessThan %1057 %7774 %1056 +OpSelectionMerge %7777 None +OpBranchConditional %7775 %7776 %7777 +%7776 = OpLabel +%7778 = OpLoad %6 %13 +%7779 = OpLoad %6 %16 +%7780 = OpIAdd %6 %7778 %7779 +%7781 = OpLoad %6 %18 +%7782 = OpISub %6 %7780 %7781 +OpStore %603 %7782 +OpBranch %7777 +%7777 = OpLabel +%7783 = OpLoad %1035 %1054 +%7784 = OpINotEqual %1057 %7783 %1094 +OpSelectionMerge %7786 None +OpBranchConditional %7784 %7785 %7786 +%7785 = OpLabel +%7787 = OpLoad %6 %16 +%7788 = OpLoad %6 %17 +%7789 = OpIAdd %6 %7787 %7788 +%7790 = OpLoad %6 %18 +%7791 = OpIAdd %6 %7789 %7790 +%7792 = OpLoad %6 %20 +%7793 = OpIAdd %6 %7791 %7792 +%7794 = OpLoad %6 %22 +%7795 = OpIAdd %6 %7793 %7794 +OpStore %604 %7795 +OpBranch %7786 +%7786 = OpLabel +%7796 = OpLoad %1035 %1054 +%7797 = OpULessThanEqual %1057 %7796 %1056 +OpSelectionMerge %7799 None +OpBranchConditional %7797 %7798 %7799 +%7798 = OpLabel +%7800 = OpLoad %6 %16 +%7801 = OpLoad %6 %17 +%7802 = OpISub %6 %7800 %7801 +%7803 = OpLoad %6 %18 +%7804 = OpISub %6 %7802 %7803 +%7805 = OpLoad %6 %21 +%7806 = OpIAdd %6 %7804 %7805 +%7807 = OpLoad %6 %22 +%7808 = OpIAdd %6 %7806 %7807 +OpStore %605 %7808 +OpBranch %7799 +%7799 = OpLabel +%7809 = OpLoad %1035 %1054 +%7810 = OpIEqual %1057 %7809 %1056 +OpSelectionMerge %7812 None +OpBranchConditional %7810 %7811 %7812 +%7811 = OpLabel +%7813 = OpLoad %6 %16 +%7814 = OpLoad %6 %17 +%7815 = OpIAdd %6 %7813 %7814 +%7816 = OpLoad %6 %19 +%7817 = OpISub %6 %7815 %7816 +%7818 = OpLoad %6 %20 +%7819 = OpISub %6 %7817 %7818 +%7820 = OpLoad %6 %21 +%7821 = OpISub %6 %7819 %7820 +OpStore %606 %7821 +OpBranch %7812 +%7812 = OpLabel +%7822 = OpLoad %1035 %1054 +%7823 = OpUGreaterThan %1057 %7822 %1056 +OpSelectionMerge %7825 None +OpBranchConditional %7823 %7824 %7825 +%7824 = OpLabel +%7826 = OpLoad %6 %16 +%7827 = OpLoad %6 %17 +%7828 = OpIAdd %6 %7826 %7827 +%7829 = OpLoad %6 %19 +%7830 = OpISub %6 %7828 %7829 +%7831 = OpLoad %6 %20 +%7832 = OpIAdd %6 %7830 %7831 +%7833 = OpLoad %6 %22 +%7834 = OpIAdd %6 %7832 %7833 +OpStore %607 %7834 +OpBranch %7825 +%7825 = OpLabel +%7835 = OpLoad %1035 %1054 +%7836 = OpULessThan %1057 %7835 %1094 +OpSelectionMerge %7838 None +OpBranchConditional %7836 %7837 %7838 +%7837 = OpLabel +%7839 = OpLoad %6 %16 +%7840 = OpLoad %6 %17 +%7841 = OpIAdd %6 %7839 %7840 +%7842 = OpLoad %6 %19 +%7843 = OpISub %6 %7841 %7842 +%7844 = OpLoad %6 %21 +%7845 = OpIAdd %6 %7843 %7844 +%7846 = OpLoad %6 %22 +%7847 = OpISub %6 %7845 %7846 +OpStore %608 %7847 +OpBranch %7838 +%7838 = OpLabel +%7848 = OpLoad %1035 %1054 +%7849 = OpUGreaterThan %1057 %7848 %1056 +OpSelectionMerge %7851 None +OpBranchConditional %7849 %7850 %7851 +%7850 = OpLabel +%7852 = OpLoad %6 %16 +%7853 = OpLoad %6 %17 +%7854 = OpIAdd %6 %7852 %7853 +%7855 = OpLoad %6 %20 +%7856 = OpIAdd %6 %7854 %7855 +%7857 = OpLoad %6 %21 +%7858 = OpISub %6 %7856 %7857 +%7859 = OpLoad %6 %22 +%7860 = OpIAdd %6 %7858 %7859 +OpStore %609 %7860 +OpBranch %7851 +%7851 = OpLabel +%7861 = OpLoad %1035 %1054 +%7862 = OpUGreaterThanEqual %1057 %7861 %1056 +OpSelectionMerge %7864 None +OpBranchConditional %7862 %7863 %7864 +%7863 = OpLabel +%7865 = OpLoad %6 %16 +%7866 = OpLoad %6 %18 +%7867 = OpIAdd %6 %7865 %7866 +%7868 = OpLoad %6 %19 +%7869 = OpIAdd %6 %7867 %7868 +%7870 = OpLoad %6 %20 +%7871 = OpISub %6 %7869 %7870 +%7872 = OpLoad %6 %21 +%7873 = OpISub %6 %7871 %7872 +OpStore %610 %7873 +OpBranch %7864 +%7864 = OpLabel +%7874 = OpLoad %1035 %1054 +%7875 = OpIEqual %1057 %7874 %1094 +OpSelectionMerge %7877 None +OpBranchConditional %7875 %7876 %7877 +%7876 = OpLabel +%7878 = OpLoad %6 %16 +%7879 = OpLoad %6 %18 +%7880 = OpIAdd %6 %7878 %7879 +%7881 = OpLoad %6 %19 +%7882 = OpIAdd %6 %7880 %7881 +%7883 = OpLoad %6 %20 +%7884 = OpIAdd %6 %7882 %7883 +%7885 = OpLoad %6 %22 +%7886 = OpIAdd %6 %7884 %7885 +OpStore %611 %7886 +OpBranch %7877 +%7877 = OpLabel +%7887 = OpLoad %1035 %1054 +%7888 = OpINotEqual %1057 %7887 %1056 +OpSelectionMerge %7890 None +OpBranchConditional %7888 %7889 %7890 +%7889 = OpLabel +%7891 = OpLoad %6 %16 +%7892 = OpLoad %6 %18 +%7893 = OpISub %6 %7891 %7892 +%7894 = OpLoad %6 %19 +%7895 = OpIAdd %6 %7893 %7894 +%7896 = OpLoad %6 %21 +%7897 = OpISub %6 %7895 %7896 +%7898 = OpLoad %6 %22 +%7899 = OpISub %6 %7897 %7898 +OpStore %612 %7899 +OpBranch %7890 +%7890 = OpLabel +%7900 = OpLoad %1035 %1054 +%7901 = OpUGreaterThanEqual %1057 %7900 %1072 +OpSelectionMerge %7903 None +OpBranchConditional %7901 %7902 %7903 +%7902 = OpLabel +%7904 = OpLoad %6 %16 +%7905 = OpLoad %6 %18 +%7906 = OpISub %6 %7904 %7905 +%7907 = OpLoad %6 %20 +%7908 = OpIAdd %6 %7906 %7907 +%7909 = OpLoad %6 %21 +%7910 = OpISub %6 %7908 %7909 +%7911 = OpLoad %6 %22 +%7912 = OpISub %6 %7910 %7911 +OpStore %613 %7912 +OpBranch %7903 +%7903 = OpLabel +%7913 = OpLoad %1035 %1054 +%7914 = OpULessThan %1057 %7913 %1138 +OpSelectionMerge %7916 None +OpBranchConditional %7914 %7915 %7916 +%7915 = OpLabel +%7917 = OpLoad %6 %13 +%7918 = OpLoad %6 %16 +%7919 = OpIAdd %6 %7917 %7918 +%7920 = OpLoad %6 %19 +%7921 = OpISub %6 %7919 %7920 +OpStore %614 %7921 +OpBranch %7916 +%7916 = OpLabel +%7922 = OpLoad %1035 %1054 +%7923 = OpUGreaterThan %1057 %7922 %1072 +OpSelectionMerge %7925 None +OpBranchConditional %7923 %7924 %7925 +%7924 = OpLabel +%7926 = OpLoad %6 %16 +%7927 = OpLoad %6 %19 +%7928 = OpIAdd %6 %7926 %7927 +%7929 = OpLoad %6 %20 +%7930 = OpIAdd %6 %7928 %7929 +%7931 = OpLoad %6 %21 +%7932 = OpIAdd %6 %7930 %7931 +%7933 = OpLoad %6 %22 +%7934 = OpISub %6 %7932 %7933 +OpStore %615 %7934 +OpBranch %7925 +%7925 = OpLabel +%7935 = OpLoad %1035 %1054 +%7936 = OpUGreaterThan %1057 %7935 %1094 +OpSelectionMerge %7938 None +OpBranchConditional %7936 %7937 %7938 +%7937 = OpLabel +%7939 = OpLoad %6 %17 +%7940 = OpLoad %6 %18 +%7941 = OpISub %6 %7939 %7940 +%7942 = OpLoad %6 %19 +%7943 = OpIAdd %6 %7941 %7942 +%7944 = OpLoad %6 %20 +%7945 = OpIAdd %6 %7943 %7944 +%7946 = OpLoad %6 %21 +%7947 = OpISub %6 %7945 %7946 +OpStore %616 %7947 +OpBranch %7938 +%7938 = OpLabel +%7948 = OpLoad %1035 %1054 +%7949 = OpINotEqual %1057 %7948 %1072 +OpSelectionMerge %7951 None +OpBranchConditional %7949 %7950 %7951 +%7950 = OpLabel +%7952 = OpLoad %6 %17 +%7953 = OpLoad %6 %18 +%7954 = OpIAdd %6 %7952 %7953 +%7955 = OpLoad %6 %19 +%7956 = OpISub %6 %7954 %7955 +%7957 = OpLoad %6 %20 +%7958 = OpISub %6 %7956 %7957 +%7959 = OpLoad %6 %22 +%7960 = OpIAdd %6 %7958 %7959 +OpStore %617 %7960 +OpBranch %7951 +%7951 = OpLabel +%7961 = OpLoad %1035 %1054 +%7962 = OpUGreaterThanEqual %1057 %7961 %1072 +OpSelectionMerge %7964 None +OpBranchConditional %7962 %7963 %7964 +%7963 = OpLabel +%7965 = OpLoad %6 %17 +%7966 = OpLoad %6 %18 +%7967 = OpIAdd %6 %7965 %7966 +%7968 = OpLoad %6 %19 +%7969 = OpIAdd %6 %7967 %7968 +%7970 = OpLoad %6 %21 +%7971 = OpISub %6 %7969 %7970 +%7972 = OpLoad %6 %22 +%7973 = OpIAdd %6 %7971 %7972 +OpStore %618 %7973 +OpBranch %7964 +%7964 = OpLabel +%7974 = OpLoad %1035 %1054 +%7975 = OpIEqual %1057 %7974 %1138 +OpSelectionMerge %7977 None +OpBranchConditional %7975 %7976 %7977 +%7976 = OpLabel +%7978 = OpLoad %6 %17 +%7979 = OpLoad %6 %18 +%7980 = OpISub %6 %7978 %7979 +%7981 = OpLoad %6 %20 +%7982 = OpIAdd %6 %7980 %7981 +%7983 = OpLoad %6 %21 +%7984 = OpIAdd %6 %7982 %7983 +%7985 = OpLoad %6 %22 +%7986 = OpIAdd %6 %7984 %7985 +OpStore %619 %7986 +OpBranch %7977 +%7977 = OpLabel +%7987 = OpLoad %1035 %1054 +%7988 = OpULessThan %1057 %7987 %1094 +OpSelectionMerge %7990 None +OpBranchConditional %7988 %7989 %7990 +%7989 = OpLabel +%7991 = OpLoad %6 %17 +%7992 = OpLoad %6 %19 +%7993 = OpIAdd %6 %7991 %7992 +%7994 = OpLoad %6 %20 +%7995 = OpIAdd %6 %7993 %7994 +%7996 = OpLoad %6 %21 +%7997 = OpIAdd %6 %7995 %7996 +%7998 = OpLoad %6 %22 +%7999 = OpIAdd %6 %7997 %7998 +OpStore %620 %7999 +OpBranch %7990 +%7990 = OpLabel +%8000 = OpLoad %1035 %1054 +%8001 = OpUGreaterThanEqual %1057 %8000 %1056 +OpSelectionMerge %8003 None +OpBranchConditional %8001 %8002 %8003 +%8002 = OpLabel +%8004 = OpLoad %6 %18 +%8005 = OpLoad %6 %19 +%8006 = OpIAdd %6 %8004 %8005 +%8007 = OpLoad %6 %20 +%8008 = OpISub %6 %8006 %8007 +%8009 = OpLoad %6 %21 +%8010 = OpISub %6 %8008 %8009 +%8011 = OpLoad %6 %22 +%8012 = OpIAdd %6 %8010 %8011 +OpStore %621 %8012 +OpBranch %8003 +%8003 = OpLabel +%8013 = OpLoad %1035 %1054 +%8014 = OpULessThan %1057 %8013 %1094 +OpSelectionMerge %8016 None +OpBranchConditional %8014 %8015 %8016 +%8015 = OpLabel +%8017 = OpLoad %6 %13 +%8018 = OpLoad %6 %14 +%8019 = OpISub %6 %8017 %8018 +%8020 = OpLoad %6 %15 +%8021 = OpISub %6 %8019 %8020 +%8022 = OpLoad %6 %16 +%8023 = OpIAdd %6 %8021 %8022 +%8024 = OpLoad %6 %17 +%8025 = OpIAdd %6 %8023 %8024 +%8026 = OpLoad %6 %18 +%8027 = OpISub %6 %8025 %8026 +OpStore %622 %8027 +OpBranch %8016 +%8016 = OpLabel +%8028 = OpLoad %1035 %1054 +%8029 = OpULessThan %1057 %8028 %1072 +OpSelectionMerge %8031 None +OpBranchConditional %8029 %8030 %8031 +%8030 = OpLabel +%8032 = OpLoad %6 %13 +%8033 = OpLoad %6 %14 +%8034 = OpIAdd %6 %8032 %8033 +%8035 = OpLoad %6 %15 +%8036 = OpIAdd %6 %8034 %8035 +%8037 = OpLoad %6 %16 +%8038 = OpISub %6 %8036 %8037 +%8039 = OpLoad %6 %17 +%8040 = OpIAdd %6 %8038 %8039 +%8041 = OpLoad %6 %19 +%8042 = OpISub %6 %8040 %8041 +OpStore %623 %8042 +OpBranch %8031 +%8031 = OpLabel +%8043 = OpLoad %1035 %1054 +%8044 = OpINotEqual %1057 %8043 %1072 +OpSelectionMerge %8046 None +OpBranchConditional %8044 %8045 %8046 +%8045 = OpLabel +%8047 = OpLoad %6 %13 +%8048 = OpLoad %6 %14 +%8049 = OpIAdd %6 %8047 %8048 +%8050 = OpLoad %6 %15 +%8051 = OpISub %6 %8049 %8050 +%8052 = OpLoad %6 %16 +%8053 = OpIAdd %6 %8051 %8052 +%8054 = OpLoad %6 %17 +%8055 = OpISub %6 %8053 %8054 +%8056 = OpLoad %6 %20 +%8057 = OpISub %6 %8055 %8056 +OpStore %624 %8057 +OpBranch %8046 +%8046 = OpLabel +%8058 = OpLoad %1035 %1054 +%8059 = OpINotEqual %1057 %8058 %1094 +OpSelectionMerge %8061 None +OpBranchConditional %8059 %8060 %8061 +%8060 = OpLabel +%8062 = OpLoad %6 %13 +%8063 = OpLoad %6 %16 +%8064 = OpIAdd %6 %8062 %8063 +%8065 = OpLoad %6 %20 +%8066 = OpISub %6 %8064 %8065 +OpStore %625 %8066 +OpBranch %8061 +%8061 = OpLabel +%8067 = OpLoad %1035 %1054 +%8068 = OpIEqual %1057 %8067 %1072 +OpSelectionMerge %8070 None +OpBranchConditional %8068 %8069 %8070 +%8069 = OpLabel +%8071 = OpLoad %6 %13 +%8072 = OpLoad %6 %14 +%8073 = OpIAdd %6 %8071 %8072 +%8074 = OpLoad %6 %15 +%8075 = OpISub %6 %8073 %8074 +%8076 = OpLoad %6 %16 +%8077 = OpISub %6 %8075 %8076 +%8078 = OpLoad %6 %17 +%8079 = OpIAdd %6 %8077 %8078 +%8080 = OpLoad %6 %21 +%8081 = OpISub %6 %8079 %8080 +OpStore %626 %8081 +OpBranch %8070 +%8070 = OpLabel +%8082 = OpLoad %1035 %1054 +%8083 = OpUGreaterThanEqual %1057 %8082 %1138 +OpSelectionMerge %8085 None +OpBranchConditional %8083 %8084 %8085 +%8084 = OpLabel +%8086 = OpLoad %6 %13 +%8087 = OpLoad %6 %14 +%8088 = OpISub %6 %8086 %8087 +%8089 = OpLoad %6 %15 +%8090 = OpIAdd %6 %8088 %8089 +%8091 = OpLoad %6 %16 +%8092 = OpIAdd %6 %8090 %8091 +%8093 = OpLoad %6 %17 +%8094 = OpISub %6 %8092 %8093 +%8095 = OpLoad %6 %22 +%8096 = OpIAdd %6 %8094 %8095 +OpStore %627 %8096 +OpBranch %8085 +%8085 = OpLabel +%8097 = OpLoad %1035 %1054 +%8098 = OpULessThanEqual %1057 %8097 %1138 +OpSelectionMerge %8100 None +OpBranchConditional %8098 %8099 %8100 +%8099 = OpLabel +%8101 = OpLoad %6 %13 +%8102 = OpLoad %6 %14 +%8103 = OpISub %6 %8101 %8102 +%8104 = OpLoad %6 %15 +%8105 = OpIAdd %6 %8103 %8104 +%8106 = OpLoad %6 %16 +%8107 = OpISub %6 %8105 %8106 +%8108 = OpLoad %6 %18 +%8109 = OpISub %6 %8107 %8108 +%8110 = OpLoad %6 %19 +%8111 = OpIAdd %6 %8109 %8110 +OpStore %628 %8111 +OpBranch %8100 +%8100 = OpLabel +%8112 = OpLoad %1035 %1054 +%8113 = OpINotEqual %1057 %8112 %1072 +OpSelectionMerge %8115 None +OpBranchConditional %8113 %8114 %8115 +%8114 = OpLabel +%8116 = OpLoad %6 %13 +%8117 = OpLoad %6 %14 +%8118 = OpIAdd %6 %8116 %8117 +%8119 = OpLoad %6 %15 +%8120 = OpIAdd %6 %8118 %8119 +%8121 = OpLoad %6 %16 +%8122 = OpISub %6 %8120 %8121 +%8123 = OpLoad %6 %18 +%8124 = OpIAdd %6 %8122 %8123 +%8125 = OpLoad %6 %20 +%8126 = OpISub %6 %8124 %8125 +OpStore %629 %8126 +OpBranch %8115 +%8115 = OpLabel +%8127 = OpLoad %1035 %1054 +%8128 = OpUGreaterThanEqual %1057 %8127 %1072 +OpSelectionMerge %8130 None +OpBranchConditional %8128 %8129 %8130 +%8129 = OpLabel +%8131 = OpLoad %6 %13 +%8132 = OpLoad %6 %14 +%8133 = OpIAdd %6 %8131 %8132 +%8134 = OpLoad %6 %15 +%8135 = OpISub %6 %8133 %8134 +%8136 = OpLoad %6 %16 +%8137 = OpIAdd %6 %8135 %8136 +%8138 = OpLoad %6 %18 +%8139 = OpIAdd %6 %8137 %8138 +%8140 = OpLoad %6 %21 +%8141 = OpISub %6 %8139 %8140 +OpStore %630 %8141 +OpBranch %8130 +%8130 = OpLabel +%8142 = OpLoad %1035 %1054 +%8143 = OpULessThanEqual %1057 %8142 %1094 +OpSelectionMerge %8145 None +OpBranchConditional %8143 %8144 %8145 +%8144 = OpLabel +%8146 = OpLoad %6 %13 +%8147 = OpLoad %6 %14 +%8148 = OpISub %6 %8146 %8147 +%8149 = OpLoad %6 %15 +%8150 = OpISub %6 %8148 %8149 +%8151 = OpLoad %6 %16 +%8152 = OpISub %6 %8150 %8151 +%8153 = OpLoad %6 %18 +%8154 = OpIAdd %6 %8152 %8153 +%8155 = OpLoad %6 %22 +%8156 = OpIAdd %6 %8154 %8155 +OpStore %631 %8156 +OpBranch %8145 +%8145 = OpLabel +%8157 = OpLoad %1035 %1054 +%8158 = OpULessThanEqual %1057 %8157 %1072 +OpSelectionMerge %8160 None +OpBranchConditional %8158 %8159 %8160 +%8159 = OpLabel +%8161 = OpLoad %6 %13 +%8162 = OpLoad %6 %14 +%8163 = OpIAdd %6 %8161 %8162 +%8164 = OpLoad %6 %15 +%8165 = OpISub %6 %8163 %8164 +%8166 = OpLoad %6 %16 +%8167 = OpIAdd %6 %8165 %8166 +%8168 = OpLoad %6 %19 +%8169 = OpISub %6 %8167 %8168 +%8170 = OpLoad %6 %20 +%8171 = OpISub %6 %8169 %8170 +OpStore %632 %8171 +OpBranch %8160 +%8160 = OpLabel +%8172 = OpLoad %1035 %1054 +%8173 = OpULessThanEqual %1057 %8172 %1072 +OpSelectionMerge %8175 None +OpBranchConditional %8173 %8174 %8175 +%8174 = OpLabel +%8176 = OpLoad %6 %13 +%8177 = OpLoad %6 %14 +%8178 = OpISub %6 %8176 %8177 +%8179 = OpLoad %6 %15 +%8180 = OpIAdd %6 %8178 %8179 +%8181 = OpLoad %6 %16 +%8182 = OpIAdd %6 %8180 %8181 +%8183 = OpLoad %6 %19 +%8184 = OpISub %6 %8182 %8183 +%8185 = OpLoad %6 %21 +%8186 = OpISub %6 %8184 %8185 +OpStore %633 %8186 +OpBranch %8175 +%8175 = OpLabel +%8187 = OpLoad %1035 %1054 +%8188 = OpIEqual %1057 %8187 %1094 +OpSelectionMerge %8190 None +OpBranchConditional %8188 %8189 %8190 +%8189 = OpLabel +%8191 = OpLoad %6 %13 +%8192 = OpLoad %6 %14 +%8193 = OpIAdd %6 %8191 %8192 +%8194 = OpLoad %6 %15 +%8195 = OpISub %6 %8193 %8194 +%8196 = OpLoad %6 %16 +%8197 = OpISub %6 %8195 %8196 +%8198 = OpLoad %6 %19 +%8199 = OpISub %6 %8197 %8198 +%8200 = OpLoad %6 %22 +%8201 = OpISub %6 %8199 %8200 +OpStore %634 %8201 +OpBranch %8190 +%8190 = OpLabel +%8202 = OpLoad %1035 %1054 +%8203 = OpINotEqual %1057 %8202 %1094 +OpSelectionMerge %8205 None +OpBranchConditional %8203 %8204 %8205 +%8204 = OpLabel +%8206 = OpLoad %6 %13 +%8207 = OpLoad %6 %14 +%8208 = OpIAdd %6 %8206 %8207 +%8209 = OpLoad %6 %15 +%8210 = OpIAdd %6 %8208 %8209 +%8211 = OpLoad %6 %16 +%8212 = OpIAdd %6 %8210 %8211 +%8213 = OpLoad %6 %20 +%8214 = OpISub %6 %8212 %8213 +%8215 = OpLoad %6 %21 +%8216 = OpISub %6 %8214 %8215 +OpStore %635 %8216 +OpBranch %8205 +%8205 = OpLabel +%8217 = OpLoad %1035 %1054 +%8218 = OpULessThanEqual %1057 %8217 %1056 +OpSelectionMerge %8220 None +OpBranchConditional %8218 %8219 %8220 +%8219 = OpLabel +%8221 = OpLoad %6 %13 +%8222 = OpLoad %6 %16 +%8223 = OpIAdd %6 %8221 %8222 +%8224 = OpLoad %6 %21 +%8225 = OpIAdd %6 %8223 %8224 +OpStore %636 %8225 +OpBranch %8220 +%8220 = OpLabel +%8226 = OpLoad %1035 %1054 +%8227 = OpUGreaterThanEqual %1057 %8226 %1138 +OpSelectionMerge %8229 None +OpBranchConditional %8227 %8228 %8229 +%8228 = OpLabel +%8230 = OpLoad %6 %13 +%8231 = OpLoad %6 %14 +%8232 = OpIAdd %6 %8230 %8231 +%8233 = OpLoad %6 %15 +%8234 = OpISub %6 %8232 %8233 +%8235 = OpLoad %6 %16 +%8236 = OpISub %6 %8234 %8235 +%8237 = OpLoad %6 %20 +%8238 = OpIAdd %6 %8236 %8237 +%8239 = OpLoad %6 %22 +%8240 = OpIAdd %6 %8238 %8239 +OpStore %637 %8240 +OpBranch %8229 +%8229 = OpLabel +%8241 = OpLoad %1035 %1054 +%8242 = OpULessThanEqual %1057 %8241 %1138 +OpSelectionMerge %8244 None +OpBranchConditional %8242 %8243 %8244 +%8243 = OpLabel +%8245 = OpLoad %6 %13 +%8246 = OpLoad %6 %14 +%8247 = OpISub %6 %8245 %8246 +%8248 = OpLoad %6 %15 +%8249 = OpISub %6 %8247 %8248 +%8250 = OpLoad %6 %16 +%8251 = OpIAdd %6 %8249 %8250 +%8252 = OpLoad %6 %21 +%8253 = OpIAdd %6 %8251 %8252 +%8254 = OpLoad %6 %22 +%8255 = OpISub %6 %8253 %8254 +OpStore %638 %8255 +OpBranch %8244 +%8244 = OpLabel +%8256 = OpLoad %1035 %1054 +%8257 = OpUGreaterThanEqual %1057 %8256 %1056 +OpSelectionMerge %8259 None +OpBranchConditional %8257 %8258 %8259 +%8258 = OpLabel +%8260 = OpLoad %6 %13 +%8261 = OpLoad %6 %14 +%8262 = OpIAdd %6 %8260 %8261 +%8263 = OpLoad %6 %15 +%8264 = OpISub %6 %8262 %8263 +%8265 = OpLoad %6 %17 +%8266 = OpIAdd %6 %8264 %8265 +%8267 = OpLoad %6 %18 +%8268 = OpISub %6 %8266 %8267 +%8269 = OpLoad %6 %19 +%8270 = OpISub %6 %8268 %8269 +OpStore %639 %8270 +OpBranch %8259 +%8259 = OpLabel +%8271 = OpLoad %1035 %1054 +%8272 = OpIEqual %1057 %8271 %1138 +OpSelectionMerge %8274 None +OpBranchConditional %8272 %8273 %8274 +%8273 = OpLabel +%8275 = OpLoad %6 %13 +%8276 = OpLoad %6 %14 +%8277 = OpIAdd %6 %8275 %8276 +%8278 = OpLoad %6 %15 +%8279 = OpISub %6 %8277 %8278 +%8280 = OpLoad %6 %17 +%8281 = OpISub %6 %8279 %8280 +%8282 = OpLoad %6 %18 +%8283 = OpIAdd %6 %8281 %8282 +%8284 = OpLoad %6 %20 +%8285 = OpIAdd %6 %8283 %8284 +OpStore %640 %8285 +OpBranch %8274 +%8274 = OpLabel +%8286 = OpLoad %1035 %1054 +%8287 = OpINotEqual %1057 %8286 %1138 +OpSelectionMerge %8289 None +OpBranchConditional %8287 %8288 %8289 +%8288 = OpLabel +%8290 = OpLoad %6 %13 +%8291 = OpLoad %6 %14 +%8292 = OpIAdd %6 %8290 %8291 +%8293 = OpLoad %6 %15 +%8294 = OpIAdd %6 %8292 %8293 +%8295 = OpLoad %6 %17 +%8296 = OpISub %6 %8294 %8295 +%8297 = OpLoad %6 %18 +%8298 = OpISub %6 %8296 %8297 +%8299 = OpLoad %6 %21 +%8300 = OpIAdd %6 %8298 %8299 +OpStore %641 %8300 +OpBranch %8289 +%8289 = OpLabel +%8301 = OpLoad %1035 %1054 +%8302 = OpIEqual %1057 %8301 %1056 +OpSelectionMerge %8304 None +OpBranchConditional %8302 %8303 %8304 +%8303 = OpLabel +%8305 = OpLoad %6 %13 +%8306 = OpLoad %6 %14 +%8307 = OpISub %6 %8305 %8306 +%8308 = OpLoad %6 %15 +%8309 = OpISub %6 %8307 %8308 +%8310 = OpLoad %6 %17 +%8311 = OpIAdd %6 %8309 %8310 +%8312 = OpLoad %6 %18 +%8313 = OpIAdd %6 %8311 %8312 +%8314 = OpLoad %6 %22 +%8315 = OpIAdd %6 %8313 %8314 +OpStore %642 %8315 +OpBranch %8304 +%8304 = OpLabel +%8316 = OpLoad %1035 %1054 +%8317 = OpINotEqual %1057 %8316 %1056 +OpSelectionMerge %8319 None +OpBranchConditional %8317 %8318 %8319 +%8318 = OpLabel +%8320 = OpLoad %6 %13 +%8321 = OpLoad %6 %14 +%8322 = OpISub %6 %8320 %8321 +%8323 = OpLoad %6 %15 +%8324 = OpISub %6 %8322 %8323 +%8325 = OpLoad %6 %17 +%8326 = OpISub %6 %8324 %8325 +%8327 = OpLoad %6 %19 +%8328 = OpISub %6 %8326 %8327 +%8329 = OpLoad %6 %20 +%8330 = OpIAdd %6 %8328 %8329 +OpStore %643 %8330 +OpBranch %8319 +%8319 = OpLabel +%8331 = OpLoad %1035 %1054 +%8332 = OpIEqual %1057 %8331 %1138 +OpSelectionMerge %8334 None +OpBranchConditional %8332 %8333 %8334 +%8333 = OpLabel +%8335 = OpLoad %6 %13 +%8336 = OpLoad %6 %14 +%8337 = OpIAdd %6 %8335 %8336 +%8338 = OpLoad %6 %15 +%8339 = OpIAdd %6 %8337 %8338 +%8340 = OpLoad %6 %17 +%8341 = OpISub %6 %8339 %8340 +%8342 = OpLoad %6 %19 +%8343 = OpISub %6 %8341 %8342 +%8344 = OpLoad %6 %21 +%8345 = OpISub %6 %8343 %8344 +OpStore %644 %8345 +OpBranch %8334 +%8334 = OpLabel +%8346 = OpLoad %1035 %1054 +%8347 = OpUGreaterThan %1057 %8346 %1138 +OpSelectionMerge %8349 None +OpBranchConditional %8347 %8348 %8349 +%8348 = OpLabel +%8350 = OpLoad %6 %13 +%8351 = OpLoad %6 %14 +%8352 = OpIAdd %6 %8350 %8351 +%8353 = OpLoad %6 %15 +%8354 = OpIAdd %6 %8352 %8353 +%8355 = OpLoad %6 %17 +%8356 = OpIAdd %6 %8354 %8355 +%8357 = OpLoad %6 %19 +%8358 = OpIAdd %6 %8356 %8357 +%8359 = OpLoad %6 %22 +%8360 = OpIAdd %6 %8358 %8359 +OpStore %645 %8360 +OpBranch %8349 +%8349 = OpLabel +%8361 = OpLoad %1035 %1054 +%8362 = OpUGreaterThanEqual %1057 %8361 %1094 +OpSelectionMerge %8364 None +OpBranchConditional %8362 %8363 %8364 +%8363 = OpLabel +%8365 = OpLoad %6 %13 +%8366 = OpLoad %6 %14 +%8367 = OpIAdd %6 %8365 %8366 +%8368 = OpLoad %6 %15 +%8369 = OpIAdd %6 %8367 %8368 +%8370 = OpLoad %6 %17 +%8371 = OpISub %6 %8369 %8370 +%8372 = OpLoad %6 %20 +%8373 = OpISub %6 %8371 %8372 +%8374 = OpLoad %6 %21 +%8375 = OpISub %6 %8373 %8374 +OpStore %646 %8375 +OpBranch %8364 +%8364 = OpLabel +%8376 = OpLoad %1035 %1054 +%8377 = OpUGreaterThanEqual %1057 %8376 %1072 +OpSelectionMerge %8379 None +OpBranchConditional %8377 %8378 %8379 +%8378 = OpLabel +%8380 = OpLoad %6 %13 +%8381 = OpLoad %6 %16 +%8382 = OpISub %6 %8380 %8381 +%8383 = OpLoad %6 %22 +%8384 = OpIAdd %6 %8382 %8383 +OpStore %647 %8384 +OpBranch %8379 +%8379 = OpLabel +%8385 = OpLoad %1035 %1054 +%8386 = OpUGreaterThan %1057 %8385 %1094 +OpSelectionMerge %8388 None +OpBranchConditional %8386 %8387 %8388 +%8387 = OpLabel +%8389 = OpLoad %6 %13 +%8390 = OpLoad %6 %14 +%8391 = OpIAdd %6 %8389 %8390 +%8392 = OpLoad %6 %15 +%8393 = OpIAdd %6 %8391 %8392 +%8394 = OpLoad %6 %17 +%8395 = OpIAdd %6 %8393 %8394 +%8396 = OpLoad %6 %20 +%8397 = OpIAdd %6 %8395 %8396 +%8398 = OpLoad %6 %22 +%8399 = OpISub %6 %8397 %8398 +OpStore %648 %8399 +OpBranch %8388 +%8388 = OpLabel +%8400 = OpLoad %1035 %1054 +%8401 = OpUGreaterThanEqual %1057 %8400 %1094 +OpSelectionMerge %8403 None +OpBranchConditional %8401 %8402 %8403 +%8402 = OpLabel +%8404 = OpLoad %6 %13 +%8405 = OpLoad %6 %14 +%8406 = OpISub %6 %8404 %8405 +%8407 = OpLoad %6 %15 +%8408 = OpIAdd %6 %8406 %8407 +%8409 = OpLoad %6 %17 +%8410 = OpISub %6 %8408 %8409 +%8411 = OpLoad %6 %21 +%8412 = OpISub %6 %8410 %8411 +%8413 = OpLoad %6 %22 +%8414 = OpIAdd %6 %8412 %8413 +OpStore %649 %8414 +OpBranch %8403 +%8403 = OpLabel +%8415 = OpLoad %1035 %1054 +%8416 = OpINotEqual %1057 %8415 %1094 +OpSelectionMerge %8418 None +OpBranchConditional %8416 %8417 %8418 +%8417 = OpLabel +%8419 = OpLoad %6 %13 +%8420 = OpLoad %6 %14 +%8421 = OpIAdd %6 %8419 %8420 +%8422 = OpLoad %6 %15 +%8423 = OpIAdd %6 %8421 %8422 +%8424 = OpLoad %6 %18 +%8425 = OpISub %6 %8423 %8424 +%8426 = OpLoad %6 %19 +%8427 = OpIAdd %6 %8425 %8426 +%8428 = OpLoad %6 %20 +%8429 = OpISub %6 %8427 %8428 +OpStore %650 %8429 +OpBranch %8418 +%8418 = OpLabel +%8430 = OpLoad %1035 %1054 +%8431 = OpINotEqual %1057 %8430 %1056 +OpSelectionMerge %8433 None +OpBranchConditional %8431 %8432 %8433 +%8432 = OpLabel +%8434 = OpLoad %6 %13 +%8435 = OpLoad %6 %14 +%8436 = OpISub %6 %8434 %8435 +%8437 = OpLoad %6 %15 +%8438 = OpISub %6 %8436 %8437 +%8439 = OpLoad %6 %18 +%8440 = OpISub %6 %8438 %8439 +%8441 = OpLoad %6 %19 +%8442 = OpIAdd %6 %8440 %8441 +%8443 = OpLoad %6 %21 +%8444 = OpISub %6 %8442 %8443 +OpStore %651 %8444 +OpBranch %8433 +%8433 = OpLabel +%8445 = OpLoad %1035 %1054 +%8446 = OpIEqual %1057 %8445 %1072 +OpSelectionMerge %8448 None +OpBranchConditional %8446 %8447 %8448 +%8447 = OpLabel +%8449 = OpLoad %6 %13 +%8450 = OpLoad %6 %14 +%8451 = OpIAdd %6 %8449 %8450 +%8452 = OpLoad %6 %15 +%8453 = OpIAdd %6 %8451 %8452 +%8454 = OpLoad %6 %18 +%8455 = OpISub %6 %8453 %8454 +%8456 = OpLoad %6 %19 +%8457 = OpIAdd %6 %8455 %8456 +%8458 = OpLoad %6 %22 +%8459 = OpISub %6 %8457 %8458 +OpStore %652 %8459 +OpBranch %8448 +%8448 = OpLabel +%8460 = OpLoad %1035 %1054 +%8461 = OpIEqual %1057 %8460 %1056 +OpSelectionMerge %8463 None +OpBranchConditional %8461 %8462 %8463 +%8462 = OpLabel +%8464 = OpLoad %6 %13 +%8465 = OpLoad %6 %14 +%8466 = OpIAdd %6 %8464 %8465 +%8467 = OpLoad %6 %15 +%8468 = OpISub %6 %8466 %8467 +%8469 = OpLoad %6 %18 +%8470 = OpIAdd %6 %8468 %8469 +%8471 = OpLoad %6 %20 +%8472 = OpISub %6 %8470 %8471 +%8473 = OpLoad %6 %21 +%8474 = OpIAdd %6 %8472 %8473 +OpStore %653 %8474 +OpBranch %8463 +%8463 = OpLabel +%8475 = OpLoad %1035 %1054 +%8476 = OpULessThan %1057 %8475 %1094 +OpSelectionMerge %8478 None +OpBranchConditional %8476 %8477 %8478 +%8477 = OpLabel +%8479 = OpLoad %6 %13 +%8480 = OpLoad %6 %14 +%8481 = OpISub %6 %8479 %8480 +%8482 = OpLoad %6 %15 +%8483 = OpISub %6 %8481 %8482 +%8484 = OpLoad %6 %18 +%8485 = OpISub %6 %8483 %8484 +%8486 = OpLoad %6 %20 +%8487 = OpIAdd %6 %8485 %8486 +%8488 = OpLoad %6 %22 +%8489 = OpIAdd %6 %8487 %8488 +OpStore %654 %8489 +OpBranch %8478 +%8478 = OpLabel +%8490 = OpLoad %1035 %1054 +%8491 = OpIEqual %1057 %8490 %1138 +OpSelectionMerge %8493 None +OpBranchConditional %8491 %8492 %8493 +%8492 = OpLabel +%8494 = OpLoad %6 %13 +%8495 = OpLoad %6 %14 +%8496 = OpIAdd %6 %8494 %8495 +%8497 = OpLoad %6 %15 +%8498 = OpISub %6 %8496 %8497 +%8499 = OpLoad %6 %18 +%8500 = OpIAdd %6 %8498 %8499 +%8501 = OpLoad %6 %21 +%8502 = OpIAdd %6 %8500 %8501 +%8503 = OpLoad %6 %22 +%8504 = OpISub %6 %8502 %8503 +OpStore %655 %8504 +OpBranch %8493 +%8493 = OpLabel +%8505 = OpLoad %1035 %1054 +%8506 = OpULessThanEqual %1057 %8505 %1056 +OpSelectionMerge %8508 None +OpBranchConditional %8506 %8507 %8508 +%8507 = OpLabel +%8509 = OpLoad %6 %13 +%8510 = OpLoad %6 %14 +%8511 = OpIAdd %6 %8509 %8510 +%8512 = OpLoad %6 %15 +%8513 = OpIAdd %6 %8511 %8512 +%8514 = OpLoad %6 %19 +%8515 = OpISub %6 %8513 %8514 +%8516 = OpLoad %6 %20 +%8517 = OpISub %6 %8515 %8516 +%8518 = OpLoad %6 %21 +%8519 = OpISub %6 %8517 %8518 +OpStore %656 %8519 +OpBranch %8508 +%8508 = OpLabel +%8520 = OpLoad %1035 %1054 +%8521 = OpULessThanEqual %1057 %8520 %1138 +OpSelectionMerge %8523 None +OpBranchConditional %8521 %8522 %8523 +%8522 = OpLabel +%8524 = OpLoad %6 %13 +%8525 = OpLoad %6 %14 +%8526 = OpISub %6 %8524 %8525 +%8527 = OpLoad %6 %15 +%8528 = OpISub %6 %8526 %8527 +%8529 = OpLoad %6 %19 +%8530 = OpIAdd %6 %8528 %8529 +%8531 = OpLoad %6 %20 +%8532 = OpISub %6 %8530 %8531 +%8533 = OpLoad %6 %22 +%8534 = OpIAdd %6 %8532 %8533 +OpStore %657 %8534 +OpBranch %8523 +%8523 = OpLabel +%8535 = OpLoad %1035 %1054 +%8536 = OpULessThanEqual %1057 %8535 %1094 +OpSelectionMerge %8538 None +OpBranchConditional %8536 %8537 %8538 +%8537 = OpLabel +%8539 = OpLoad %6 %13 +%8540 = OpLoad %6 %17 +%8541 = OpISub %6 %8539 %8540 +%8542 = OpLoad %6 %18 +%8543 = OpISub %6 %8541 %8542 +OpStore %658 %8543 +OpBranch %8538 +%8538 = OpLabel +%8544 = OpLoad %1035 %1054 +%8545 = OpINotEqual %1057 %8544 %1138 +OpSelectionMerge %8547 None +OpBranchConditional %8545 %8546 %8547 +%8546 = OpLabel +%8548 = OpLoad %6 %13 +%8549 = OpLoad %6 %14 +%8550 = OpIAdd %6 %8548 %8549 +%8551 = OpLoad %6 %15 +%8552 = OpIAdd %6 %8550 %8551 +%8553 = OpLoad %6 %19 +%8554 = OpISub %6 %8552 %8553 +%8555 = OpLoad %6 %21 +%8556 = OpISub %6 %8554 %8555 +%8557 = OpLoad %6 %22 +%8558 = OpIAdd %6 %8556 %8557 +OpStore %659 %8558 +OpBranch %8547 +%8547 = OpLabel +%8559 = OpLoad %1035 %1054 +%8560 = OpIEqual %1057 %8559 %1138 +OpSelectionMerge %8562 None +OpBranchConditional %8560 %8561 %8562 +%8561 = OpLabel +%8563 = OpLoad %6 %13 +%8564 = OpLoad %6 %14 +%8565 = OpISub %6 %8563 %8564 +%8566 = OpLoad %6 %15 +%8567 = OpISub %6 %8565 %8566 +%8568 = OpLoad %6 %20 +%8569 = OpIAdd %6 %8567 %8568 +%8570 = OpLoad %6 %21 +%8571 = OpISub %6 %8569 %8570 +%8572 = OpLoad %6 %22 +%8573 = OpISub %6 %8571 %8572 +OpStore %660 %8573 +OpBranch %8562 +%8562 = OpLabel +%8574 = OpLoad %1035 %1054 +%8575 = OpIEqual %1057 %8574 %1094 +OpSelectionMerge %8577 None +OpBranchConditional %8575 %8576 %8577 +%8576 = OpLabel +%8578 = OpLoad %6 %13 +%8579 = OpLoad %6 %14 +%8580 = OpIAdd %6 %8578 %8579 +%8581 = OpLoad %6 %16 +%8582 = OpIAdd %6 %8580 %8581 +%8583 = OpLoad %6 %17 +%8584 = OpIAdd %6 %8582 %8583 +%8585 = OpLoad %6 %18 +%8586 = OpISub %6 %8584 %8585 +%8587 = OpLoad %6 %19 +%8588 = OpISub %6 %8586 %8587 +OpStore %661 %8588 +OpBranch %8577 +%8577 = OpLabel +%8589 = OpLoad %1035 %1054 +%8590 = OpINotEqual %1057 %8589 %1138 +OpSelectionMerge %8592 None +OpBranchConditional %8590 %8591 %8592 +%8591 = OpLabel +%8593 = OpLoad %6 %13 +%8594 = OpLoad %6 %14 +%8595 = OpISub %6 %8593 %8594 +%8596 = OpLoad %6 %16 +%8597 = OpISub %6 %8595 %8596 +%8598 = OpLoad %6 %17 +%8599 = OpIAdd %6 %8597 %8598 +%8600 = OpLoad %6 %18 +%8601 = OpISub %6 %8599 %8600 +%8602 = OpLoad %6 %20 +%8603 = OpISub %6 %8601 %8602 +OpStore %662 %8603 +OpBranch %8592 +%8592 = OpLabel +%8604 = OpLoad %1035 %1054 +%8605 = OpULessThan %1057 %8604 %1138 +OpSelectionMerge %8607 None +OpBranchConditional %8605 %8606 %8607 +%8606 = OpLabel +%8608 = OpLoad %6 %13 +%8609 = OpLoad %6 %14 +%8610 = OpISub %6 %8608 %8609 +%8611 = OpLoad %6 %16 +%8612 = OpIAdd %6 %8610 %8611 +%8613 = OpLoad %6 %17 +%8614 = OpISub %6 %8612 %8613 +%8615 = OpLoad %6 %18 +%8616 = OpIAdd %6 %8614 %8615 +%8617 = OpLoad %6 %21 +%8618 = OpIAdd %6 %8616 %8617 +OpStore %663 %8618 +OpBranch %8607 +%8607 = OpLabel +%8619 = OpLoad %1035 %1054 +%8620 = OpULessThanEqual %1057 %8619 %1072 +OpSelectionMerge %8622 None +OpBranchConditional %8620 %8621 %8622 +%8621 = OpLabel +%8623 = OpLoad %6 %13 +%8624 = OpLoad %6 %14 +%8625 = OpISub %6 %8623 %8624 +%8626 = OpLoad %6 %16 +%8627 = OpIAdd %6 %8625 %8626 +%8628 = OpLoad %6 %17 +%8629 = OpISub %6 %8627 %8628 +%8630 = OpLoad %6 %18 +%8631 = OpIAdd %6 %8629 %8630 +%8632 = OpLoad %6 %22 +%8633 = OpISub %6 %8631 %8632 +OpStore %664 %8633 +OpBranch %8622 +%8622 = OpLabel +%8634 = OpLoad %1035 %1054 +%8635 = OpUGreaterThanEqual %1057 %8634 %1094 +OpSelectionMerge %8637 None +OpBranchConditional %8635 %8636 %8637 +%8636 = OpLabel +%8638 = OpLoad %6 %13 +%8639 = OpLoad %6 %14 +%8640 = OpIAdd %6 %8638 %8639 +%8641 = OpLoad %6 %16 +%8642 = OpISub %6 %8640 %8641 +%8643 = OpLoad %6 %17 +%8644 = OpISub %6 %8642 %8643 +%8645 = OpLoad %6 %19 +%8646 = OpIAdd %6 %8644 %8645 +%8647 = OpLoad %6 %20 +%8648 = OpISub %6 %8646 %8647 +OpStore %665 %8648 +OpBranch %8637 +%8637 = OpLabel +%8649 = OpLoad %1035 %1054 +%8650 = OpULessThanEqual %1057 %8649 %1138 +OpSelectionMerge %8652 None +OpBranchConditional %8650 %8651 %8652 +%8651 = OpLabel +%8653 = OpLoad %6 %13 +%8654 = OpLoad %6 %14 +%8655 = OpISub %6 %8653 %8654 +%8656 = OpLoad %6 %16 +%8657 = OpISub %6 %8655 %8656 +%8658 = OpLoad %6 %17 +%8659 = OpISub %6 %8657 %8658 +%8660 = OpLoad %6 %19 +%8661 = OpIAdd %6 %8659 %8660 +%8662 = OpLoad %6 %21 +%8663 = OpISub %6 %8661 %8662 +OpStore %666 %8663 +OpBranch %8652 +%8652 = OpLabel +%8664 = OpLoad %1035 %1054 +%8665 = OpIEqual %1057 %8664 %1138 +OpSelectionMerge %8667 None +OpBranchConditional %8665 %8666 %8667 +%8666 = OpLabel +%8668 = OpLoad %6 %13 +%8669 = OpLoad %6 %14 +%8670 = OpISub %6 %8668 %8669 +%8671 = OpLoad %6 %16 +%8672 = OpIAdd %6 %8670 %8671 +%8673 = OpLoad %6 %17 +%8674 = OpIAdd %6 %8672 %8673 +%8675 = OpLoad %6 %19 +%8676 = OpISub %6 %8674 %8675 +%8677 = OpLoad %6 %22 +%8678 = OpISub %6 %8676 %8677 +OpStore %667 %8678 +OpBranch %8667 +%8667 = OpLabel +%8679 = OpLoad %1035 %1054 +%8680 = OpINotEqual %1057 %8679 %1056 +OpSelectionMerge %8682 None +OpBranchConditional %8680 %8681 %8682 +%8681 = OpLabel +%8683 = OpLoad %6 %13 +%8684 = OpLoad %6 %14 +%8685 = OpIAdd %6 %8683 %8684 +%8686 = OpLoad %6 %16 +%8687 = OpIAdd %6 %8685 %8686 +%8688 = OpLoad %6 %17 +%8689 = OpIAdd %6 %8687 %8688 +%8690 = OpLoad %6 %20 +%8691 = OpIAdd %6 %8689 %8690 +%8692 = OpLoad %6 %21 +%8693 = OpISub %6 %8691 %8692 +OpStore %668 %8693 +OpBranch %8682 +%8682 = OpLabel +%8694 = OpLoad %1035 %1054 +%8695 = OpINotEqual %1057 %8694 %1138 +OpSelectionMerge %8697 None +OpBranchConditional %8695 %8696 %8697 +%8696 = OpLabel +%8698 = OpLoad %6 %13 +%8699 = OpLoad %6 %17 +%8700 = OpISub %6 %8698 %8699 +%8701 = OpLoad %6 %19 +%8702 = OpIAdd %6 %8700 %8701 +OpStore %669 %8702 +OpBranch %8697 +%8697 = OpLabel +%8703 = OpLoad %1035 %1054 +%8704 = OpINotEqual %1057 %8703 %1094 +OpSelectionMerge %8706 None +OpBranchConditional %8704 %8705 %8706 +%8705 = OpLabel +%8707 = OpLoad %6 %13 +%8708 = OpLoad %6 %14 +%8709 = OpIAdd %6 %8707 %8708 +%8710 = OpLoad %6 %16 +%8711 = OpIAdd %6 %8709 %8710 +%8712 = OpLoad %6 %17 +%8713 = OpISub %6 %8711 %8712 +%8714 = OpLoad %6 %20 +%8715 = OpIAdd %6 %8713 %8714 +%8716 = OpLoad %6 %22 +%8717 = OpISub %6 %8715 %8716 +OpStore %670 %8717 +OpBranch %8706 +%8706 = OpLabel +%8718 = OpLoad %1035 %1054 +%8719 = OpINotEqual %1057 %8718 %1138 +OpSelectionMerge %8721 None +OpBranchConditional %8719 %8720 %8721 +%8720 = OpLabel +%8722 = OpLoad %6 %13 +%8723 = OpLoad %6 %14 +%8724 = OpISub %6 %8722 %8723 +%8725 = OpLoad %6 %16 +%8726 = OpIAdd %6 %8724 %8725 +%8727 = OpLoad %6 %17 +%8728 = OpIAdd %6 %8726 %8727 +%8729 = OpLoad %6 %21 +%8730 = OpIAdd %6 %8728 %8729 +%8731 = OpLoad %6 %22 +%8732 = OpISub %6 %8730 %8731 +OpStore %671 %8732 +OpBranch %8721 +%8721 = OpLabel +%8733 = OpLoad %1035 %1054 +%8734 = OpULessThanEqual %1057 %8733 %1138 +OpSelectionMerge %8736 None +OpBranchConditional %8734 %8735 %8736 +%8735 = OpLabel +%8737 = OpLoad %6 %13 +%8738 = OpLoad %6 %14 +%8739 = OpIAdd %6 %8737 %8738 +%8740 = OpLoad %6 %16 +%8741 = OpIAdd %6 %8739 %8740 +%8742 = OpLoad %6 %18 +%8743 = OpIAdd %6 %8741 %8742 +%8744 = OpLoad %6 %19 +%8745 = OpIAdd %6 %8743 %8744 +%8746 = OpLoad %6 %20 +%8747 = OpIAdd %6 %8745 %8746 +OpStore %672 %8747 +OpBranch %8736 +%8736 = OpLabel +%8748 = OpLoad %1035 %1054 +%8749 = OpUGreaterThan %1057 %8748 %1072 +OpSelectionMerge %8751 None +OpBranchConditional %8749 %8750 %8751 +%8750 = OpLabel +%8752 = OpLoad %6 %13 +%8753 = OpLoad %6 %14 +%8754 = OpIAdd %6 %8752 %8753 +%8755 = OpLoad %6 %16 +%8756 = OpIAdd %6 %8754 %8755 +%8757 = OpLoad %6 %18 +%8758 = OpISub %6 %8756 %8757 +%8759 = OpLoad %6 %19 +%8760 = OpISub %6 %8758 %8759 +%8761 = OpLoad %6 %21 +%8762 = OpIAdd %6 %8760 %8761 +OpStore %673 %8762 +OpBranch %8751 +%8751 = OpLabel +%8763 = OpLoad %1035 %1054 +%8764 = OpULessThan %1057 %8763 %1056 +OpSelectionMerge %8766 None +OpBranchConditional %8764 %8765 %8766 +%8765 = OpLabel +%8767 = OpLoad %6 %13 +%8768 = OpLoad %6 %14 +%8769 = OpIAdd %6 %8767 %8768 +%8770 = OpLoad %6 %16 +%8771 = OpIAdd %6 %8769 %8770 +%8772 = OpLoad %6 %18 +%8773 = OpISub %6 %8771 %8772 +%8774 = OpLoad %6 %19 +%8775 = OpIAdd %6 %8773 %8774 +%8776 = OpLoad %6 %22 +%8777 = OpIAdd %6 %8775 %8776 +OpStore %674 %8777 +OpBranch %8766 +%8766 = OpLabel +%8778 = OpLoad %1035 %1054 +%8779 = OpUGreaterThan %1057 %8778 %1094 +OpSelectionMerge %8781 None +OpBranchConditional %8779 %8780 %8781 +%8780 = OpLabel +%8782 = OpLoad %6 %13 +%8783 = OpLoad %6 %14 +%8784 = OpIAdd %6 %8782 %8783 +%8785 = OpLoad %6 %16 +%8786 = OpISub %6 %8784 %8785 +%8787 = OpLoad %6 %18 +%8788 = OpIAdd %6 %8786 %8787 +%8789 = OpLoad %6 %20 +%8790 = OpIAdd %6 %8788 %8789 +%8791 = OpLoad %6 %21 +%8792 = OpISub %6 %8790 %8791 +OpStore %675 %8792 +OpBranch %8781 +%8781 = OpLabel +%8793 = OpLoad %1035 %1054 +%8794 = OpUGreaterThanEqual %1057 %8793 %1094 +OpSelectionMerge %8796 None +OpBranchConditional %8794 %8795 %8796 +%8795 = OpLabel +%8797 = OpLoad %6 %13 +%8798 = OpLoad %6 %14 +%8799 = OpIAdd %6 %8797 %8798 +%8800 = OpLoad %6 %16 +%8801 = OpIAdd %6 %8799 %8800 +%8802 = OpLoad %6 %18 +%8803 = OpISub %6 %8801 %8802 +%8804 = OpLoad %6 %20 +%8805 = OpIAdd %6 %8803 %8804 +%8806 = OpLoad %6 %22 +%8807 = OpIAdd %6 %8805 %8806 +OpStore %676 %8807 +OpBranch %8796 +%8796 = OpLabel +%8808 = OpLoad %1035 %1054 +%8809 = OpULessThan %1057 %8808 %1072 +OpSelectionMerge %8811 None +OpBranchConditional %8809 %8810 %8811 +%8810 = OpLabel +%8812 = OpLoad %6 %13 +%8813 = OpLoad %6 %14 +%8814 = OpISub %6 %8812 %8813 +%8815 = OpLoad %6 %16 +%8816 = OpISub %6 %8814 %8815 +%8817 = OpLoad %6 %18 +%8818 = OpISub %6 %8816 %8817 +%8819 = OpLoad %6 %21 +%8820 = OpISub %6 %8818 %8819 +%8821 = OpLoad %6 %22 +%8822 = OpISub %6 %8820 %8821 +OpStore %677 %8822 +OpBranch %8811 +%8811 = OpLabel +%8823 = OpLoad %1035 %1054 +%8824 = OpUGreaterThanEqual %1057 %8823 %1094 +OpSelectionMerge %8826 None +OpBranchConditional %8824 %8825 %8826 +%8825 = OpLabel +%8827 = OpLoad %6 %13 +%8828 = OpLoad %6 %14 +%8829 = OpIAdd %6 %8827 %8828 +%8830 = OpLoad %6 %16 +%8831 = OpISub %6 %8829 %8830 +%8832 = OpLoad %6 %19 +%8833 = OpISub %6 %8831 %8832 +%8834 = OpLoad %6 %20 +%8835 = OpIAdd %6 %8833 %8834 +%8836 = OpLoad %6 %21 +%8837 = OpISub %6 %8835 %8836 +OpStore %678 %8837 +OpBranch %8826 +%8826 = OpLabel +%8838 = OpLoad %1035 %1054 +%8839 = OpULessThan %1057 %8838 %1138 +OpSelectionMerge %8841 None +OpBranchConditional %8839 %8840 %8841 +%8840 = OpLabel +%8842 = OpLoad %6 %13 +%8843 = OpLoad %6 %14 +%8844 = OpISub %6 %8842 %8843 +%8845 = OpLoad %6 %16 +%8846 = OpISub %6 %8844 %8845 +%8847 = OpLoad %6 %19 +%8848 = OpISub %6 %8846 %8847 +%8849 = OpLoad %6 %20 +%8850 = OpIAdd %6 %8848 %8849 +%8851 = OpLoad %6 %22 +%8852 = OpIAdd %6 %8850 %8851 +OpStore %679 %8852 +OpBranch %8841 +%8841 = OpLabel +%8853 = OpLoad %1035 %1054 +%8854 = OpULessThan %1057 %8853 %1094 +OpSelectionMerge %8856 None +OpBranchConditional %8854 %8855 %8856 +%8855 = OpLabel +%8857 = OpLoad %6 %13 +%8858 = OpLoad %6 %17 +%8859 = OpIAdd %6 %8857 %8858 +%8860 = OpLoad %6 %20 +%8861 = OpISub %6 %8859 %8860 +OpStore %680 %8861 +OpBranch %8856 +%8856 = OpLabel +%8862 = OpLoad %1035 %1054 +%8863 = OpIEqual %1057 %8862 %1138 +OpSelectionMerge %8865 None +OpBranchConditional %8863 %8864 %8865 +%8864 = OpLabel +%8866 = OpLoad %6 %13 +%8867 = OpLoad %6 %14 +%8868 = OpISub %6 %8866 %8867 +%8869 = OpLoad %6 %16 +%8870 = OpISub %6 %8868 %8869 +%8871 = OpLoad %6 %19 +%8872 = OpIAdd %6 %8870 %8871 +%8873 = OpLoad %6 %21 +%8874 = OpISub %6 %8872 %8873 +%8875 = OpLoad %6 %22 +%8876 = OpIAdd %6 %8874 %8875 +OpStore %681 %8876 +OpBranch %8865 +%8865 = OpLabel +%8877 = OpLoad %1035 %1054 +%8878 = OpUGreaterThan %1057 %8877 %1138 +OpSelectionMerge %8880 None +OpBranchConditional %8878 %8879 %8880 +%8879 = OpLabel +%8881 = OpLoad %6 %13 +%8882 = OpLoad %6 %14 +%8883 = OpISub %6 %8881 %8882 +%8884 = OpLoad %6 %16 +%8885 = OpIAdd %6 %8883 %8884 +%8886 = OpLoad %6 %20 +%8887 = OpIAdd %6 %8885 %8886 +%8888 = OpLoad %6 %21 +%8889 = OpIAdd %6 %8887 %8888 +%8890 = OpLoad %6 %22 +%8891 = OpISub %6 %8889 %8890 +OpStore %682 %8891 +OpBranch %8880 +%8880 = OpLabel +%8892 = OpLoad %1035 %1054 +%8893 = OpULessThan %1057 %8892 %1056 +OpSelectionMerge %8895 None +OpBranchConditional %8893 %8894 %8895 +%8894 = OpLabel +%8896 = OpLoad %6 %13 +%8897 = OpLoad %6 %14 +%8898 = OpISub %6 %8896 %8897 +%8899 = OpLoad %6 %17 +%8900 = OpIAdd %6 %8898 %8899 +%8901 = OpLoad %6 %18 +%8902 = OpISub %6 %8900 %8901 +%8903 = OpLoad %6 %19 +%8904 = OpIAdd %6 %8902 %8903 +%8905 = OpLoad %6 %20 +%8906 = OpIAdd %6 %8904 %8905 +OpStore %683 %8906 +OpBranch %8895 +%8895 = OpLabel +%8907 = OpLoad %1035 %1054 +%8908 = OpUGreaterThan %1057 %8907 %1072 +OpSelectionMerge %8910 None +OpBranchConditional %8908 %8909 %8910 +%8909 = OpLabel +%8911 = OpLoad %6 %13 +%8912 = OpLoad %6 %14 +%8913 = OpIAdd %6 %8911 %8912 +%8914 = OpLoad %6 %17 +%8915 = OpISub %6 %8913 %8914 +%8916 = OpLoad %6 %18 +%8917 = OpISub %6 %8915 %8916 +%8918 = OpLoad %6 %19 +%8919 = OpISub %6 %8917 %8918 +%8920 = OpLoad %6 %21 +%8921 = OpIAdd %6 %8919 %8920 +OpStore %684 %8921 +OpBranch %8910 +%8910 = OpLabel +%8922 = OpLoad %1035 %1054 +%8923 = OpIEqual %1057 %8922 %1072 +OpSelectionMerge %8925 None +OpBranchConditional %8923 %8924 %8925 +%8924 = OpLabel +%8926 = OpLoad %6 %13 +%8927 = OpLoad %6 %14 +%8928 = OpISub %6 %8926 %8927 +%8929 = OpLoad %6 %17 +%8930 = OpISub %6 %8928 %8929 +%8931 = OpLoad %6 %18 +%8932 = OpISub %6 %8930 %8931 +%8933 = OpLoad %6 %19 +%8934 = OpISub %6 %8932 %8933 +%8935 = OpLoad %6 %22 +%8936 = OpISub %6 %8934 %8935 +OpStore %685 %8936 +OpBranch %8925 +%8925 = OpLabel +%8937 = OpLoad %1035 %1054 +%8938 = OpULessThanEqual %1057 %8937 %1094 +OpSelectionMerge %8940 None +OpBranchConditional %8938 %8939 %8940 +%8939 = OpLabel +%8941 = OpLoad %6 %13 +%8942 = OpLoad %6 %14 +%8943 = OpIAdd %6 %8941 %8942 +%8944 = OpLoad %6 %17 +%8945 = OpISub %6 %8943 %8944 +%8946 = OpLoad %6 %18 +%8947 = OpIAdd %6 %8945 %8946 +%8948 = OpLoad %6 %20 +%8949 = OpIAdd %6 %8947 %8948 +%8950 = OpLoad %6 %21 +%8951 = OpIAdd %6 %8949 %8950 +OpStore %686 %8951 +OpBranch %8940 +%8940 = OpLabel +%8952 = OpLoad %1035 %1054 +%8953 = OpUGreaterThan %1057 %8952 %1138 +OpSelectionMerge %8955 None +OpBranchConditional %8953 %8954 %8955 +%8954 = OpLabel +%8956 = OpLoad %6 %13 +%8957 = OpLoad %6 %14 +%8958 = OpIAdd %6 %8956 %8957 +%8959 = OpLoad %6 %17 +%8960 = OpISub %6 %8958 %8959 +%8961 = OpLoad %6 %18 +%8962 = OpIAdd %6 %8960 %8961 +%8963 = OpLoad %6 %20 +%8964 = OpIAdd %6 %8962 %8963 +%8965 = OpLoad %6 %22 +%8966 = OpISub %6 %8964 %8965 +OpStore %687 %8966 +OpBranch %8955 +%8955 = OpLabel +%8967 = OpLoad %1035 %1054 +%8968 = OpIEqual %1057 %8967 %1056 +OpSelectionMerge %8970 None +OpBranchConditional %8968 %8969 %8970 +%8969 = OpLabel +%8971 = OpLoad %6 %13 +%8972 = OpLoad %6 %14 +%8973 = OpISub %6 %8971 %8972 +%8974 = OpLoad %6 %17 +%8975 = OpIAdd %6 %8973 %8974 +%8976 = OpLoad %6 %18 +%8977 = OpISub %6 %8975 %8976 +%8978 = OpLoad %6 %21 +%8979 = OpISub %6 %8977 %8978 +%8980 = OpLoad %6 %22 +%8981 = OpIAdd %6 %8979 %8980 +OpStore %688 %8981 +OpBranch %8970 +%8970 = OpLabel +%8982 = OpLoad %1035 %1054 +%8983 = OpINotEqual %1057 %8982 %1094 +OpSelectionMerge %8985 None +OpBranchConditional %8983 %8984 %8985 +%8984 = OpLabel +%8986 = OpLoad %6 %13 +%8987 = OpLoad %6 %14 +%8988 = OpISub %6 %8986 %8987 +%8989 = OpLoad %6 %17 +%8990 = OpISub %6 %8988 %8989 +%8991 = OpLoad %6 %19 +%8992 = OpIAdd %6 %8990 %8991 +%8993 = OpLoad %6 %20 +%8994 = OpIAdd %6 %8992 %8993 +%8995 = OpLoad %6 %21 +%8996 = OpISub %6 %8994 %8995 +OpStore %689 %8996 +OpBranch %8985 +%8985 = OpLabel +%8997 = OpLoad %1035 %1054 +%8998 = OpINotEqual %1057 %8997 %1138 +OpSelectionMerge %9000 None +OpBranchConditional %8998 %8999 %9000 +%8999 = OpLabel +%9001 = OpLoad %6 %13 +%9002 = OpLoad %6 %14 +%9003 = OpISub %6 %9001 %9002 +%9004 = OpLoad %6 %17 +%9005 = OpIAdd %6 %9003 %9004 +%9006 = OpLoad %6 %19 +%9007 = OpIAdd %6 %9005 %9006 +%9008 = OpLoad %6 %20 +%9009 = OpIAdd %6 %9007 %9008 +%9010 = OpLoad %6 %22 +%9011 = OpISub %6 %9009 %9010 +OpStore %690 %9011 +OpBranch %9000 +%9000 = OpLabel +%9012 = OpLoad %1035 %1054 +%9013 = OpIEqual %1057 %9012 %1072 +OpSelectionMerge %9015 None +OpBranchConditional %9013 %9014 %9015 +%9014 = OpLabel +%9016 = OpLoad %6 %13 +%9017 = OpLoad %6 %17 +%9018 = OpISub %6 %9016 %9017 +%9019 = OpLoad %6 %21 +%9020 = OpIAdd %6 %9018 %9019 +OpStore %691 %9020 +OpBranch %9015 +%9015 = OpLabel +%9021 = OpLoad %1035 %1054 +%9022 = OpINotEqual %1057 %9021 %1072 +OpSelectionMerge %9024 None +OpBranchConditional %9022 %9023 %9024 +%9023 = OpLabel +%9025 = OpLoad %6 %13 +%9026 = OpLoad %6 %14 +%9027 = OpISub %6 %9025 %9026 +%9028 = OpLoad %6 %17 +%9029 = OpIAdd %6 %9027 %9028 +%9030 = OpLoad %6 %19 +%9031 = OpIAdd %6 %9029 %9030 +%9032 = OpLoad %6 %21 +%9033 = OpISub %6 %9031 %9032 +%9034 = OpLoad %6 %22 +%9035 = OpIAdd %6 %9033 %9034 +OpStore %692 %9035 +OpBranch %9024 +%9024 = OpLabel +%9036 = OpLoad %1035 %1054 +%9037 = OpINotEqual %1057 %9036 %1056 +OpSelectionMerge %9039 None +OpBranchConditional %9037 %9038 %9039 +%9038 = OpLabel +%9040 = OpLoad %6 %13 +%9041 = OpLoad %6 %14 +%9042 = OpIAdd %6 %9040 %9041 +%9043 = OpLoad %6 %17 +%9044 = OpISub %6 %9042 %9043 +%9045 = OpLoad %6 %20 +%9046 = OpISub %6 %9044 %9045 +%9047 = OpLoad %6 %21 +%9048 = OpIAdd %6 %9046 %9047 +%9049 = OpLoad %6 %22 +%9050 = OpISub %6 %9048 %9049 +OpStore %693 %9050 +OpBranch %9039 +%9039 = OpLabel +%9051 = OpLoad %1035 %1054 +%9052 = OpUGreaterThanEqual %1057 %9051 %1072 +OpSelectionMerge %9054 None +OpBranchConditional %9052 %9053 %9054 +%9053 = OpLabel +%9055 = OpLoad %6 %13 +%9056 = OpLoad %6 %14 +%9057 = OpISub %6 %9055 %9056 +%9058 = OpLoad %6 %18 +%9059 = OpIAdd %6 %9057 %9058 +%9060 = OpLoad %6 %19 +%9061 = OpIAdd %6 %9059 %9060 +%9062 = OpLoad %6 %20 +%9063 = OpIAdd %6 %9061 %9062 +%9064 = OpLoad %6 %21 +%9065 = OpISub %6 %9063 %9064 +OpStore %694 %9065 +OpBranch %9054 +%9054 = OpLabel +%9066 = OpLoad %1035 %1054 +%9067 = OpIEqual %1057 %9066 %1094 +OpSelectionMerge %9069 None +OpBranchConditional %9067 %9068 %9069 +%9068 = OpLabel +%9070 = OpLoad %6 %13 +%9071 = OpLoad %6 %14 +%9072 = OpISub %6 %9070 %9071 +%9073 = OpLoad %6 %18 +%9074 = OpIAdd %6 %9072 %9073 +%9075 = OpLoad %6 %19 +%9076 = OpIAdd %6 %9074 %9075 +%9077 = OpLoad %6 %20 +%9078 = OpIAdd %6 %9076 %9077 +%9079 = OpLoad %6 %22 +%9080 = OpIAdd %6 %9078 %9079 +OpStore %695 %9080 +OpBranch %9069 +%9069 = OpLabel +%9081 = OpLoad %1035 %1054 +%9082 = OpINotEqual %1057 %9081 %1072 +OpSelectionMerge %9084 None +OpBranchConditional %9082 %9083 %9084 +%9083 = OpLabel +%9085 = OpLoad %6 %13 +%9086 = OpLoad %6 %14 +%9087 = OpIAdd %6 %9085 %9086 +%9088 = OpLoad %6 %18 +%9089 = OpIAdd %6 %9087 %9088 +%9090 = OpLoad %6 %19 +%9091 = OpIAdd %6 %9089 %9090 +%9092 = OpLoad %6 %21 +%9093 = OpIAdd %6 %9091 %9092 +%9094 = OpLoad %6 %22 +%9095 = OpISub %6 %9093 %9094 +OpStore %696 %9095 +OpBranch %9084 +%9084 = OpLabel +%9096 = OpLoad %1035 %1054 +%9097 = OpULessThan %1057 %9096 %1138 +OpSelectionMerge %9099 None +OpBranchConditional %9097 %9098 %9099 +%9098 = OpLabel +%9100 = OpLoad %6 %13 +%9101 = OpLoad %6 %14 +%9102 = OpIAdd %6 %9100 %9101 +%9103 = OpLoad %6 %18 +%9104 = OpIAdd %6 %9102 %9103 +%9105 = OpLoad %6 %20 +%9106 = OpIAdd %6 %9104 %9105 +%9107 = OpLoad %6 %21 +%9108 = OpIAdd %6 %9106 %9107 +%9109 = OpLoad %6 %22 +%9110 = OpIAdd %6 %9108 %9109 +OpStore %697 %9110 +OpBranch %9099 +%9099 = OpLabel +%9111 = OpLoad %1035 %1054 +%9112 = OpIEqual %1057 %9111 %1094 +OpSelectionMerge %9114 None +OpBranchConditional %9112 %9113 %9114 +%9113 = OpLabel +%9115 = OpLoad %6 %13 +%9116 = OpLoad %6 %14 +%9117 = OpISub %6 %9115 %9116 +%9118 = OpLoad %6 %19 +%9119 = OpISub %6 %9117 %9118 +%9120 = OpLoad %6 %20 +%9121 = OpIAdd %6 %9119 %9120 +%9122 = OpLoad %6 %21 +%9123 = OpISub %6 %9121 %9122 +%9124 = OpLoad %6 %22 +%9125 = OpIAdd %6 %9123 %9124 +OpStore %698 %9125 +OpBranch %9114 +%9114 = OpLabel +%9126 = OpLoad %1035 %1054 +%9127 = OpULessThan %1057 %9126 %1094 +OpSelectionMerge %9129 None +OpBranchConditional %9127 %9128 %9129 +%9128 = OpLabel +%9130 = OpLoad %6 %13 +%9131 = OpLoad %6 %15 +%9132 = OpISub %6 %9130 %9131 +%9133 = OpLoad %6 %16 +%9134 = OpIAdd %6 %9132 %9133 +%9135 = OpLoad %6 %17 +%9136 = OpISub %6 %9134 %9135 +%9137 = OpLoad %6 %18 +%9138 = OpISub %6 %9136 %9137 +%9139 = OpLoad %6 %19 +%9140 = OpIAdd %6 %9138 %9139 +OpStore %699 %9140 +OpBranch %9129 +%9129 = OpLabel +%9141 = OpLoad %1035 %1054 +%9142 = OpULessThanEqual %1057 %9141 %1056 +OpSelectionMerge %9144 None +OpBranchConditional %9142 %9143 %9144 +%9143 = OpLabel +%9145 = OpLoad %6 %13 +%9146 = OpLoad %6 %15 +%9147 = OpIAdd %6 %9145 %9146 +%9148 = OpLoad %6 %16 +%9149 = OpISub %6 %9147 %9148 +%9150 = OpLoad %6 %17 +%9151 = OpISub %6 %9149 %9150 +%9152 = OpLoad %6 %18 +%9153 = OpIAdd %6 %9151 %9152 +%9154 = OpLoad %6 %20 +%9155 = OpIAdd %6 %9153 %9154 +OpStore %700 %9155 +OpBranch %9144 +%9144 = OpLabel +%9156 = OpLoad %1035 %1054 +%9157 = OpUGreaterThan %1057 %9156 %1138 +OpSelectionMerge %9159 None +OpBranchConditional %9157 %9158 %9159 +%9158 = OpLabel +%9160 = OpLoad %6 %13 +%9161 = OpLoad %6 %15 +%9162 = OpISub %6 %9160 %9161 +%9163 = OpLoad %6 %16 +%9164 = OpISub %6 %9162 %9163 +%9165 = OpLoad %6 %17 +%9166 = OpIAdd %6 %9164 %9165 +%9167 = OpLoad %6 %18 +%9168 = OpIAdd %6 %9166 %9167 +%9169 = OpLoad %6 %21 +%9170 = OpIAdd %6 %9168 %9169 +OpStore %701 %9170 +OpBranch %9159 +%9159 = OpLabel +%9171 = OpLoad %1035 %1054 +%9172 = OpUGreaterThanEqual %1057 %9171 %1138 +OpSelectionMerge %9174 None +OpBranchConditional %9172 %9173 %9174 +%9173 = OpLabel +%9175 = OpLoad %6 %13 +%9176 = OpLoad %6 %21 +%9177 = OpISub %6 %9175 %9176 +OpStore %702 %9177 +OpBranch %9174 +%9174 = OpLabel +%9178 = OpLoad %1035 %1054 +%9179 = OpULessThanEqual %1057 %9178 %1072 +OpSelectionMerge %9181 None +OpBranchConditional %9179 %9180 %9181 +%9180 = OpLabel +%9182 = OpLoad %6 %13 +%9183 = OpLoad %6 %17 +%9184 = OpISub %6 %9182 %9183 +%9185 = OpLoad %6 %22 +%9186 = OpIAdd %6 %9184 %9185 +OpStore %703 %9186 +OpBranch %9181 +%9181 = OpLabel +%9187 = OpLoad %1035 %1054 +%9188 = OpULessThan %1057 %9187 %1072 +OpSelectionMerge %9190 None +OpBranchConditional %9188 %9189 %9190 +%9189 = OpLabel +%9191 = OpLoad %6 %13 +%9192 = OpLoad %6 %15 +%9193 = OpISub %6 %9191 %9192 +%9194 = OpLoad %6 %16 +%9195 = OpISub %6 %9193 %9194 +%9196 = OpLoad %6 %17 +%9197 = OpISub %6 %9195 %9196 +%9198 = OpLoad %6 %18 +%9199 = OpIAdd %6 %9197 %9198 +%9200 = OpLoad %6 %22 +%9201 = OpISub %6 %9199 %9200 +OpStore %704 %9201 +OpBranch %9190 +%9190 = OpLabel +%9202 = OpLoad %1035 %1054 +%9203 = OpIEqual %1057 %9202 %1072 +OpSelectionMerge %9205 None +OpBranchConditional %9203 %9204 %9205 +%9204 = OpLabel +%9206 = OpLoad %6 %13 +%9207 = OpLoad %6 %15 +%9208 = OpIAdd %6 %9206 %9207 +%9209 = OpLoad %6 %16 +%9210 = OpIAdd %6 %9208 %9209 +%9211 = OpLoad %6 %17 +%9212 = OpISub %6 %9210 %9211 +%9213 = OpLoad %6 %19 +%9214 = OpIAdd %6 %9212 %9213 +%9215 = OpLoad %6 %20 +%9216 = OpISub %6 %9214 %9215 +OpStore %705 %9216 +OpBranch %9205 +%9205 = OpLabel +%9217 = OpLoad %1035 %1054 +%9218 = OpIEqual %1057 %9217 %1138 +OpSelectionMerge %9220 None +OpBranchConditional %9218 %9219 %9220 +%9219 = OpLabel +%9221 = OpLoad %6 %13 +%9222 = OpLoad %6 %15 +%9223 = OpISub %6 %9221 %9222 +%9224 = OpLoad %6 %16 +%9225 = OpISub %6 %9223 %9224 +%9226 = OpLoad %6 %17 +%9227 = OpIAdd %6 %9225 %9226 +%9228 = OpLoad %6 %19 +%9229 = OpISub %6 %9227 %9228 +%9230 = OpLoad %6 %21 +%9231 = OpISub %6 %9229 %9230 +OpStore %706 %9231 +OpBranch %9220 +%9220 = OpLabel +%9232 = OpLoad %1035 %1054 +%9233 = OpUGreaterThanEqual %1057 %9232 %1094 +OpSelectionMerge %9235 None +OpBranchConditional %9233 %9234 %9235 +%9234 = OpLabel +%9236 = OpLoad %6 %13 +%9237 = OpLoad %6 %15 +%9238 = OpIAdd %6 %9236 %9237 +%9239 = OpLoad %6 %16 +%9240 = OpIAdd %6 %9238 %9239 +%9241 = OpLoad %6 %17 +%9242 = OpIAdd %6 %9240 %9241 +%9243 = OpLoad %6 %19 +%9244 = OpIAdd %6 %9242 %9243 +%9245 = OpLoad %6 %22 +%9246 = OpIAdd %6 %9244 %9245 +OpStore %707 %9246 +OpBranch %9235 +%9235 = OpLabel +%9247 = OpLoad %1035 %1054 +%9248 = OpUGreaterThanEqual %1057 %9247 %1056 +OpSelectionMerge %9250 None +OpBranchConditional %9248 %9249 %9250 +%9249 = OpLabel +%9251 = OpLoad %6 %13 +%9252 = OpLoad %6 %15 +%9253 = OpIAdd %6 %9251 %9252 +%9254 = OpLoad %6 %16 +%9255 = OpIAdd %6 %9253 %9254 +%9256 = OpLoad %6 %17 +%9257 = OpIAdd %6 %9255 %9256 +%9258 = OpLoad %6 %20 +%9259 = OpIAdd %6 %9257 %9258 +%9260 = OpLoad %6 %21 +%9261 = OpISub %6 %9259 %9260 +OpStore %708 %9261 +OpBranch %9250 +%9250 = OpLabel +%9262 = OpLoad %1035 %1054 +%9263 = OpULessThan %1057 %9262 %1072 +OpSelectionMerge %9265 None +OpBranchConditional %9263 %9264 %9265 +%9264 = OpLabel +%9266 = OpLoad %6 %13 +%9267 = OpLoad %6 %15 +%9268 = OpIAdd %6 %9266 %9267 +%9269 = OpLoad %6 %16 +%9270 = OpISub %6 %9268 %9269 +%9271 = OpLoad %6 %17 +%9272 = OpIAdd %6 %9270 %9271 +%9273 = OpLoad %6 %20 +%9274 = OpIAdd %6 %9272 %9273 +%9275 = OpLoad %6 %22 +%9276 = OpISub %6 %9274 %9275 +OpStore %709 %9276 +OpBranch %9265 +%9265 = OpLabel +%9277 = OpLoad %1035 %1054 +%9278 = OpUGreaterThan %1057 %9277 %1056 +OpSelectionMerge %9280 None +OpBranchConditional %9278 %9279 %9280 +%9279 = OpLabel +%9281 = OpLoad %6 %13 +%9282 = OpLoad %6 %15 +%9283 = OpISub %6 %9281 %9282 +%9284 = OpLoad %6 %16 +%9285 = OpIAdd %6 %9283 %9284 +%9286 = OpLoad %6 %17 +%9287 = OpISub %6 %9285 %9286 +%9288 = OpLoad %6 %21 +%9289 = OpIAdd %6 %9287 %9288 +%9290 = OpLoad %6 %22 +%9291 = OpISub %6 %9289 %9290 +OpStore %710 %9291 +OpBranch %9280 +%9280 = OpLabel +%9292 = OpLoad %1035 %1054 +%9293 = OpULessThan %1057 %9292 %1138 +OpSelectionMerge %9295 None +OpBranchConditional %9293 %9294 %9295 +%9294 = OpLabel +%9296 = OpLoad %6 %13 +%9297 = OpLoad %6 %15 +%9298 = OpIAdd %6 %9296 %9297 +%9299 = OpLoad %6 %16 +%9300 = OpIAdd %6 %9298 %9299 +%9301 = OpLoad %6 %18 +%9302 = OpIAdd %6 %9300 %9301 +%9303 = OpLoad %6 %19 +%9304 = OpIAdd %6 %9302 %9303 +%9305 = OpLoad %6 %20 +%9306 = OpIAdd %6 %9304 %9305 +OpStore %711 %9306 +OpBranch %9295 +%9295 = OpLabel +%9307 = OpLoad %1035 %1054 +%9308 = OpUGreaterThanEqual %1057 %9307 %1138 +OpSelectionMerge %9310 None +OpBranchConditional %9308 %9309 %9310 +%9309 = OpLabel +%9311 = OpLoad %6 %13 +%9312 = OpLoad %6 %15 +%9313 = OpIAdd %6 %9311 %9312 +%9314 = OpLoad %6 %16 +%9315 = OpIAdd %6 %9313 %9314 +%9316 = OpLoad %6 %18 +%9317 = OpISub %6 %9315 %9316 +%9318 = OpLoad %6 %19 +%9319 = OpISub %6 %9317 %9318 +%9320 = OpLoad %6 %21 +%9321 = OpIAdd %6 %9319 %9320 +OpStore %712 %9321 +OpBranch %9310 +%9310 = OpLabel +%9322 = OpLoad %1035 %1054 +%9323 = OpINotEqual %1057 %9322 %1056 +OpSelectionMerge %9325 None +OpBranchConditional %9323 %9324 %9325 +%9324 = OpLabel +%9326 = OpLoad %6 %13 +%9327 = OpLoad %6 %15 +%9328 = OpISub %6 %9326 %9327 +%9329 = OpLoad %6 %16 +%9330 = OpISub %6 %9328 %9329 +%9331 = OpLoad %6 %18 +%9332 = OpIAdd %6 %9330 %9331 +%9333 = OpLoad %6 %19 +%9334 = OpISub %6 %9332 %9333 +%9335 = OpLoad %6 %22 +%9336 = OpIAdd %6 %9334 %9335 +OpStore %713 %9336 +OpBranch %9325 +%9325 = OpLabel +%9337 = OpLoad %1035 %1054 +%9338 = OpULessThan %1057 %9337 %1072 +OpSelectionMerge %9340 None +OpBranchConditional %9338 %9339 %9340 +%9339 = OpLabel +%9341 = OpLoad %6 %13 +%9342 = OpLoad %6 %18 +%9343 = OpIAdd %6 %9341 %9342 +%9344 = OpLoad %6 %19 +%9345 = OpIAdd %6 %9343 %9344 +OpStore %714 %9345 +OpBranch %9340 +%9340 = OpLabel +%9346 = OpLoad %1035 %1054 +%9347 = OpINotEqual %1057 %9346 %1094 +OpSelectionMerge %9349 None +OpBranchConditional %9347 %9348 %9349 +%9348 = OpLabel +%9350 = OpLoad %6 %13 +%9351 = OpLoad %6 %15 +%9352 = OpISub %6 %9350 %9351 +%9353 = OpLoad %6 %16 +%9354 = OpISub %6 %9352 %9353 +%9355 = OpLoad %6 %18 +%9356 = OpISub %6 %9354 %9355 +%9357 = OpLoad %6 %20 +%9358 = OpISub %6 %9356 %9357 +%9359 = OpLoad %6 %21 +%9360 = OpIAdd %6 %9358 %9359 +OpStore %715 %9360 +OpBranch %9349 +%9349 = OpLabel +%9361 = OpLoad %1035 %1054 +%9362 = OpIEqual %1057 %9361 %1094 +OpSelectionMerge %9364 None +OpBranchConditional %9362 %9363 %9364 +%9363 = OpLabel +%9365 = OpLoad %6 %13 +%9366 = OpLoad %6 %15 +%9367 = OpIAdd %6 %9365 %9366 +%9368 = OpLoad %6 %16 +%9369 = OpIAdd %6 %9367 %9368 +%9370 = OpLoad %6 %18 +%9371 = OpISub %6 %9369 %9370 +%9372 = OpLoad %6 %20 +%9373 = OpIAdd %6 %9371 %9372 +%9374 = OpLoad %6 %22 +%9375 = OpIAdd %6 %9373 %9374 +OpStore %716 %9375 +OpBranch %9364 +%9364 = OpLabel +%9376 = OpLoad %1035 %1054 +%9377 = OpIEqual %1057 %9376 %1138 +OpSelectionMerge %9379 None +OpBranchConditional %9377 %9378 %9379 +%9378 = OpLabel +%9380 = OpLoad %6 %13 +%9381 = OpLoad %6 %15 +%9382 = OpIAdd %6 %9380 %9381 +%9383 = OpLoad %6 %16 +%9384 = OpIAdd %6 %9382 %9383 +%9385 = OpLoad %6 %18 +%9386 = OpISub %6 %9384 %9385 +%9387 = OpLoad %6 %21 +%9388 = OpIAdd %6 %9386 %9387 +%9389 = OpLoad %6 %22 +%9390 = OpIAdd %6 %9388 %9389 +OpStore %717 %9390 +OpBranch %9379 +%9379 = OpLabel +%9391 = OpLoad %1035 %1054 +%9392 = OpIEqual %1057 %9391 %1072 +OpSelectionMerge %9394 None +OpBranchConditional %9392 %9393 %9394 +%9393 = OpLabel +%9395 = OpLoad %6 %13 +%9396 = OpLoad %6 %15 +%9397 = OpISub %6 %9395 %9396 +%9398 = OpLoad %6 %16 +%9399 = OpISub %6 %9397 %9398 +%9400 = OpLoad %6 %19 +%9401 = OpISub %6 %9399 %9400 +%9402 = OpLoad %6 %20 +%9403 = OpIAdd %6 %9401 %9402 +%9404 = OpLoad %6 %21 +%9405 = OpIAdd %6 %9403 %9404 +OpStore %718 %9405 +OpBranch %9394 +%9394 = OpLabel +%9406 = OpLoad %1035 %1054 +%9407 = OpUGreaterThanEqual %1057 %9406 %1138 +OpSelectionMerge %9409 None +OpBranchConditional %9407 %9408 %9409 +%9408 = OpLabel +%9410 = OpLoad %6 %13 +%9411 = OpLoad %6 %15 +%9412 = OpISub %6 %9410 %9411 +%9413 = OpLoad %6 %16 +%9414 = OpISub %6 %9412 %9413 +%9415 = OpLoad %6 %19 +%9416 = OpIAdd %6 %9414 %9415 +%9417 = OpLoad %6 %20 +%9418 = OpISub %6 %9416 %9417 +%9419 = OpLoad %6 %22 +%9420 = OpIAdd %6 %9418 %9419 +OpStore %719 %9420 +OpBranch %9409 +%9409 = OpLabel +%9421 = OpLoad %1035 %1054 +%9422 = OpULessThan %1057 %9421 %1056 +OpSelectionMerge %9424 None +OpBranchConditional %9422 %9423 %9424 +%9423 = OpLabel +%9425 = OpLoad %6 %13 +%9426 = OpLoad %6 %15 +%9427 = OpISub %6 %9425 %9426 +%9428 = OpLoad %6 %16 +%9429 = OpISub %6 %9427 %9428 +%9430 = OpLoad %6 %19 +%9431 = OpISub %6 %9429 %9430 +%9432 = OpLoad %6 %21 +%9433 = OpIAdd %6 %9431 %9432 +%9434 = OpLoad %6 %22 +%9435 = OpISub %6 %9433 %9434 +OpStore %720 %9435 +OpBranch %9424 +%9424 = OpLabel +%9436 = OpLoad %1035 %1054 +%9437 = OpINotEqual %1057 %9436 %1138 +OpSelectionMerge %9439 None +OpBranchConditional %9437 %9438 %9439 +%9438 = OpLabel +%9440 = OpLoad %6 %13 +%9441 = OpLoad %6 %15 +%9442 = OpISub %6 %9440 %9441 +%9443 = OpLoad %6 %16 +%9444 = OpISub %6 %9442 %9443 +%9445 = OpLoad %6 %20 +%9446 = OpIAdd %6 %9444 %9445 +%9447 = OpLoad %6 %21 +%9448 = OpISub %6 %9446 %9447 +%9449 = OpLoad %6 %22 +%9450 = OpIAdd %6 %9448 %9449 +OpStore %721 %9450 +OpBranch %9439 +%9439 = OpLabel +%9451 = OpLoad %1035 %1054 +%9452 = OpIEqual %1057 %9451 %1094 +OpSelectionMerge %9454 None +OpBranchConditional %9452 %9453 %9454 +%9453 = OpLabel +%9455 = OpLoad %6 %13 +%9456 = OpLoad %6 %15 +%9457 = OpISub %6 %9455 %9456 +%9458 = OpLoad %6 %17 +%9459 = OpISub %6 %9457 %9458 +%9460 = OpLoad %6 %18 +%9461 = OpISub %6 %9459 %9460 +%9462 = OpLoad %6 %19 +%9463 = OpIAdd %6 %9461 %9462 +%9464 = OpLoad %6 %20 +%9465 = OpIAdd %6 %9463 %9464 +OpStore %722 %9465 +OpBranch %9454 +%9454 = OpLabel +%9466 = OpLoad %1035 %1054 +%9467 = OpUGreaterThanEqual %1057 %9466 %1056 +OpSelectionMerge %9469 None +OpBranchConditional %9467 %9468 %9469 +%9468 = OpLabel +%9470 = OpLoad %6 %13 +%9471 = OpLoad %6 %15 +%9472 = OpIAdd %6 %9470 %9471 +%9473 = OpLoad %6 %17 +%9474 = OpIAdd %6 %9472 %9473 +%9475 = OpLoad %6 %18 +%9476 = OpISub %6 %9474 %9475 +%9477 = OpLoad %6 %19 +%9478 = OpISub %6 %9476 %9477 +%9479 = OpLoad %6 %21 +%9480 = OpIAdd %6 %9478 %9479 +OpStore %723 %9480 +OpBranch %9469 +%9469 = OpLabel +%9481 = OpLoad %1035 %1054 +%9482 = OpULessThanEqual %1057 %9481 %1056 +OpSelectionMerge %9484 None +OpBranchConditional %9482 %9483 %9484 +%9483 = OpLabel +%9485 = OpLoad %6 %13 +%9486 = OpLoad %6 %15 +%9487 = OpISub %6 %9485 %9486 +%9488 = OpLoad %6 %17 +%9489 = OpISub %6 %9487 %9488 +%9490 = OpLoad %6 %18 +%9491 = OpISub %6 %9489 %9490 +%9492 = OpLoad %6 %19 +%9493 = OpIAdd %6 %9491 %9492 +%9494 = OpLoad %6 %22 +%9495 = OpISub %6 %9493 %9494 +OpStore %724 %9495 +OpBranch %9484 +%9484 = OpLabel +%9496 = OpLoad %1035 %1054 +%9497 = OpUGreaterThan %1057 %9496 %1094 +OpSelectionMerge %9499 None +OpBranchConditional %9497 %9498 %9499 +%9498 = OpLabel +%9500 = OpLoad %6 %13 +%9501 = OpLoad %6 %18 +%9502 = OpISub %6 %9500 %9501 +%9503 = OpLoad %6 %20 +%9504 = OpISub %6 %9502 %9503 +OpStore %725 %9504 +OpBranch %9499 +%9499 = OpLabel +%9505 = OpLoad %1035 %1054 +%9506 = OpIEqual %1057 %9505 %1056 +OpSelectionMerge %9508 None +OpBranchConditional %9506 %9507 %9508 +%9507 = OpLabel +%9509 = OpLoad %6 %13 +%9510 = OpLoad %6 %15 +%9511 = OpISub %6 %9509 %9510 +%9512 = OpLoad %6 %17 +%9513 = OpIAdd %6 %9511 %9512 +%9514 = OpLoad %6 %18 +%9515 = OpIAdd %6 %9513 %9514 +%9516 = OpLoad %6 %20 +%9517 = OpIAdd %6 %9515 %9516 +%9518 = OpLoad %6 %21 +%9519 = OpIAdd %6 %9517 %9518 +OpStore %726 %9519 +OpBranch %9508 +%9508 = OpLabel +%9520 = OpLoad %1035 %1054 +%9521 = OpULessThanEqual %1057 %9520 %1138 +OpSelectionMerge %9523 None +OpBranchConditional %9521 %9522 %9523 +%9522 = OpLabel +%9524 = OpLoad %6 %13 +%9525 = OpLoad %6 %15 +%9526 = OpISub %6 %9524 %9525 +%9527 = OpLoad %6 %17 +%9528 = OpIAdd %6 %9526 %9527 +%9529 = OpLoad %6 %18 +%9530 = OpIAdd %6 %9528 %9529 +%9531 = OpLoad %6 %20 +%9532 = OpIAdd %6 %9530 %9531 +%9533 = OpLoad %6 %22 +%9534 = OpISub %6 %9532 %9533 +OpStore %727 %9534 +OpBranch %9523 +%9523 = OpLabel +%9535 = OpLoad %1035 %1054 +%9536 = OpULessThanEqual %1057 %9535 %1094 +OpSelectionMerge %9538 None +OpBranchConditional %9536 %9537 %9538 +%9537 = OpLabel +%9539 = OpLoad %6 %13 +%9540 = OpLoad %6 %15 +%9541 = OpIAdd %6 %9539 %9540 +%9542 = OpLoad %6 %17 +%9543 = OpISub %6 %9541 %9542 +%9544 = OpLoad %6 %18 +%9545 = OpISub %6 %9543 %9544 +%9546 = OpLoad %6 %21 +%9547 = OpISub %6 %9545 %9546 +%9548 = OpLoad %6 %22 +%9549 = OpIAdd %6 %9547 %9548 +OpStore %728 %9549 +OpBranch %9538 +%9538 = OpLabel +%9550 = OpLoad %1035 %1054 +%9551 = OpUGreaterThan %1057 %9550 %1072 +OpSelectionMerge %9553 None +OpBranchConditional %9551 %9552 %9553 +%9552 = OpLabel +%9554 = OpLoad %6 %13 +%9555 = OpLoad %6 %15 +%9556 = OpIAdd %6 %9554 %9555 +%9557 = OpLoad %6 %17 +%9558 = OpIAdd %6 %9556 %9557 +%9559 = OpLoad %6 %19 +%9560 = OpISub %6 %9558 %9559 +%9561 = OpLoad %6 %20 +%9562 = OpIAdd %6 %9560 %9561 +%9563 = OpLoad %6 %21 +%9564 = OpIAdd %6 %9562 %9563 +OpStore %729 %9564 +OpBranch %9553 +%9553 = OpLabel +%9565 = OpLoad %1035 %1054 +%9566 = OpUGreaterThan %1057 %9565 %1056 +OpSelectionMerge %9568 None +OpBranchConditional %9566 %9567 %9568 +%9567 = OpLabel +%9569 = OpLoad %6 %13 +%9570 = OpLoad %6 %15 +%9571 = OpIAdd %6 %9569 %9570 +%9572 = OpLoad %6 %17 +%9573 = OpISub %6 %9571 %9572 +%9574 = OpLoad %6 %19 +%9575 = OpISub %6 %9573 %9574 +%9576 = OpLoad %6 %20 +%9577 = OpISub %6 %9575 %9576 +%9578 = OpLoad %6 %22 +%9579 = OpISub %6 %9577 %9578 +OpStore %730 %9579 +OpBranch %9568 +%9568 = OpLabel +%9580 = OpLoad %1035 %1054 +%9581 = OpIEqual %1057 %9580 %1094 +OpSelectionMerge %9583 None +OpBranchConditional %9581 %9582 %9583 +%9582 = OpLabel +%9584 = OpLoad %6 %13 +%9585 = OpLoad %6 %15 +%9586 = OpISub %6 %9584 %9585 +%9587 = OpLoad %6 %17 +%9588 = OpIAdd %6 %9586 %9587 +%9589 = OpLoad %6 %19 +%9590 = OpISub %6 %9588 %9589 +%9591 = OpLoad %6 %21 +%9592 = OpISub %6 %9590 %9591 +%9593 = OpLoad %6 %22 +%9594 = OpISub %6 %9592 %9593 +OpStore %731 %9594 +OpBranch %9583 +%9583 = OpLabel +%9595 = OpLoad %1035 %1054 +%9596 = OpINotEqual %1057 %9595 %1138 +OpSelectionMerge %9598 None +OpBranchConditional %9596 %9597 %9598 +%9597 = OpLabel +%9599 = OpLoad %6 %13 +%9600 = OpLoad %6 %15 +%9601 = OpIAdd %6 %9599 %9600 +%9602 = OpLoad %6 %17 +%9603 = OpIAdd %6 %9601 %9602 +%9604 = OpLoad %6 %20 +%9605 = OpIAdd %6 %9603 %9604 +%9606 = OpLoad %6 %21 +%9607 = OpISub %6 %9605 %9606 +%9608 = OpLoad %6 %22 +%9609 = OpIAdd %6 %9607 %9608 +OpStore %732 %9609 +OpBranch %9598 +%9598 = OpLabel +%9610 = OpLoad %1035 %1054 +%9611 = OpULessThan %1057 %9610 %1056 +OpSelectionMerge %9613 None +OpBranchConditional %9611 %9612 %9613 +%9612 = OpLabel +%9614 = OpLoad %6 %13 +%9615 = OpLoad %6 %15 +%9616 = OpISub %6 %9614 %9615 +%9617 = OpLoad %6 %18 +%9618 = OpIAdd %6 %9616 %9617 +%9619 = OpLoad %6 %19 +%9620 = OpISub %6 %9618 %9619 +%9621 = OpLoad %6 %20 +%9622 = OpISub %6 %9620 %9621 +%9623 = OpLoad %6 %21 +%9624 = OpIAdd %6 %9622 %9623 +OpStore %733 %9624 +OpBranch %9613 +%9613 = OpLabel +%9625 = OpLoad %1035 %1054 +%9626 = OpULessThanEqual %1057 %9625 %1056 +OpSelectionMerge %9628 None +OpBranchConditional %9626 %9627 %9628 +%9627 = OpLabel +%9629 = OpLoad %6 %13 +%9630 = OpLoad %6 %15 +%9631 = OpIAdd %6 %9629 %9630 +%9632 = OpLoad %6 %18 +%9633 = OpISub %6 %9631 %9632 +%9634 = OpLoad %6 %19 +%9635 = OpISub %6 %9633 %9634 +%9636 = OpLoad %6 %20 +%9637 = OpISub %6 %9635 %9636 +%9638 = OpLoad %6 %22 +%9639 = OpIAdd %6 %9637 %9638 +OpStore %734 %9639 +OpBranch %9628 +%9628 = OpLabel +%9640 = OpLoad %1035 %1054 +%9641 = OpINotEqual %1057 %9640 %1072 +OpSelectionMerge %9643 None +OpBranchConditional %9641 %9642 %9643 +%9642 = OpLabel +%9644 = OpLoad %6 %13 +%9645 = OpLoad %6 %15 +%9646 = OpIAdd %6 %9644 %9645 +%9647 = OpLoad %6 %18 +%9648 = OpIAdd %6 %9646 %9647 +%9649 = OpLoad %6 %19 +%9650 = OpIAdd %6 %9648 %9649 +%9651 = OpLoad %6 %21 +%9652 = OpISub %6 %9650 %9651 +%9653 = OpLoad %6 %22 +%9654 = OpISub %6 %9652 %9653 +OpStore %735 %9654 +OpBranch %9643 +%9643 = OpLabel +%9655 = OpLoad %1035 %1054 +%9656 = OpIEqual %1057 %9655 %1138 +OpSelectionMerge %9658 None +OpBranchConditional %9656 %9657 %9658 +%9657 = OpLabel +%9659 = OpLoad %6 %13 +%9660 = OpLoad %6 %18 +%9661 = OpISub %6 %9659 %9660 +%9662 = OpLoad %6 %21 +%9663 = OpIAdd %6 %9661 %9662 +OpStore %736 %9663 +OpBranch %9658 +%9658 = OpLabel +%9664 = OpLoad %1035 %1054 +%9665 = OpUGreaterThanEqual %1057 %9664 %1138 +OpSelectionMerge %9667 None +OpBranchConditional %9665 %9666 %9667 +%9666 = OpLabel +%9668 = OpLoad %6 %13 +%9669 = OpLoad %6 %15 +%9670 = OpISub %6 %9668 %9669 +%9671 = OpLoad %6 %18 +%9672 = OpISub %6 %9670 %9671 +%9673 = OpLoad %6 %20 +%9674 = OpISub %6 %9672 %9673 +%9675 = OpLoad %6 %21 +%9676 = OpISub %6 %9674 %9675 +%9677 = OpLoad %6 %22 +%9678 = OpIAdd %6 %9676 %9677 +OpStore %737 %9678 +OpBranch %9667 +%9667 = OpLabel +%9679 = OpLoad %1035 %1054 +%9680 = OpULessThan %1057 %9679 %1056 +OpSelectionMerge %9682 None +OpBranchConditional %9680 %9681 %9682 +%9681 = OpLabel +%9683 = OpLoad %6 %13 +%9684 = OpLoad %6 %15 +%9685 = OpIAdd %6 %9683 %9684 +%9686 = OpLoad %6 %19 +%9687 = OpISub %6 %9685 %9686 +%9688 = OpLoad %6 %20 +%9689 = OpIAdd %6 %9687 %9688 +%9690 = OpLoad %6 %21 +%9691 = OpISub %6 %9689 %9690 +%9692 = OpLoad %6 %22 +%9693 = OpIAdd %6 %9691 %9692 +OpStore %738 %9693 +OpBranch %9682 +%9682 = OpLabel +%9694 = OpLoad %1035 %1054 +%9695 = OpUGreaterThanEqual %1057 %9694 %1072 +OpSelectionMerge %9697 None +OpBranchConditional %9695 %9696 %9697 +%9696 = OpLabel +%9698 = OpLoad %6 %13 +%9699 = OpLoad %6 %16 +%9700 = OpIAdd %6 %9698 %9699 +%9701 = OpLoad %6 %17 +%9702 = OpIAdd %6 %9700 %9701 +%9703 = OpLoad %6 %18 +%9704 = OpISub %6 %9702 %9703 +%9705 = OpLoad %6 %19 +%9706 = OpIAdd %6 %9704 %9705 +%9707 = OpLoad %6 %20 +%9708 = OpIAdd %6 %9706 %9707 +OpStore %739 %9708 +OpBranch %9697 +%9697 = OpLabel +%9709 = OpLoad %1035 %1054 +%9710 = OpINotEqual %1057 %9709 %1072 +OpSelectionMerge %9712 None +OpBranchConditional %9710 %9711 %9712 +%9711 = OpLabel +%9713 = OpLoad %6 %13 +%9714 = OpLoad %6 %16 +%9715 = OpIAdd %6 %9713 %9714 +%9716 = OpLoad %6 %17 +%9717 = OpIAdd %6 %9715 %9716 +%9718 = OpLoad %6 %18 +%9719 = OpISub %6 %9717 %9718 +%9720 = OpLoad %6 %19 +%9721 = OpIAdd %6 %9719 %9720 +%9722 = OpLoad %6 %21 +%9723 = OpISub %6 %9721 %9722 +OpStore %740 %9723 +OpBranch %9712 +%9712 = OpLabel +%9724 = OpLoad %1035 %1054 +%9725 = OpINotEqual %1057 %9724 %1094 +OpSelectionMerge %9727 None +OpBranchConditional %9725 %9726 %9727 +%9726 = OpLabel +%9728 = OpLoad %6 %13 +%9729 = OpLoad %6 %16 +%9730 = OpIAdd %6 %9728 %9729 +%9731 = OpLoad %6 %17 +%9732 = OpISub %6 %9730 %9731 +%9733 = OpLoad %6 %18 +%9734 = OpIAdd %6 %9732 %9733 +%9735 = OpLoad %6 %19 +%9736 = OpISub %6 %9734 %9735 +%9737 = OpLoad %6 %22 +%9738 = OpIAdd %6 %9736 %9737 +OpStore %741 %9738 +OpBranch %9727 +%9727 = OpLabel +%9739 = OpLoad %1035 %1054 +%9740 = OpIEqual %1057 %9739 %1072 +OpSelectionMerge %9742 None +OpBranchConditional %9740 %9741 %9742 +%9741 = OpLabel +%9743 = OpLoad %6 %13 +%9744 = OpLoad %6 %16 +%9745 = OpIAdd %6 %9743 %9744 +%9746 = OpLoad %6 %17 +%9747 = OpISub %6 %9745 %9746 +%9748 = OpLoad %6 %18 +%9749 = OpISub %6 %9747 %9748 +%9750 = OpLoad %6 %20 +%9751 = OpIAdd %6 %9749 %9750 +%9752 = OpLoad %6 %21 +%9753 = OpIAdd %6 %9751 %9752 +OpStore %742 %9753 +OpBranch %9742 +%9742 = OpLabel +%9754 = OpLoad %1035 %1054 +%9755 = OpIEqual %1057 %9754 %1094 +OpSelectionMerge %9757 None +OpBranchConditional %9755 %9756 %9757 +%9756 = OpLabel +%9758 = OpLoad %6 %13 +%9759 = OpLoad %6 %16 +%9760 = OpISub %6 %9758 %9759 +%9761 = OpLoad %6 %17 +%9762 = OpISub %6 %9760 %9761 +%9763 = OpLoad %6 %18 +%9764 = OpIAdd %6 %9762 %9763 +%9765 = OpLoad %6 %20 +%9766 = OpIAdd %6 %9764 %9765 +%9767 = OpLoad %6 %22 +%9768 = OpIAdd %6 %9766 %9767 +OpStore %743 %9768 +OpBranch %9757 +%9757 = OpLabel +%9769 = OpLoad %1035 %1054 +%9770 = OpINotEqual %1057 %9769 %1056 +OpSelectionMerge %9772 None +OpBranchConditional %9770 %9771 %9772 +%9771 = OpLabel +%9773 = OpLoad %6 %13 +%9774 = OpLoad %6 %16 +%9775 = OpIAdd %6 %9773 %9774 +%9776 = OpLoad %6 %17 +%9777 = OpISub %6 %9775 %9776 +%9778 = OpLoad %6 %18 +%9779 = OpIAdd %6 %9777 %9778 +%9780 = OpLoad %6 %21 +%9781 = OpIAdd %6 %9779 %9780 +%9782 = OpLoad %6 %22 +%9783 = OpISub %6 %9781 %9782 +OpStore %744 %9783 +OpBranch %9772 +%9772 = OpLabel +%9784 = OpLoad %1035 %1054 +%9785 = OpINotEqual %1057 %9784 %1056 +OpSelectionMerge %9787 None +OpBranchConditional %9785 %9786 %9787 +%9786 = OpLabel +%9788 = OpLoad %6 %13 +%9789 = OpLoad %6 %16 +%9790 = OpIAdd %6 %9788 %9789 +%9791 = OpLoad %6 %17 +%9792 = OpIAdd %6 %9790 %9791 +%9793 = OpLoad %6 %19 +%9794 = OpIAdd %6 %9792 %9793 +%9795 = OpLoad %6 %20 +%9796 = OpISub %6 %9794 %9795 +%9797 = OpLoad %6 %21 +%9798 = OpISub %6 %9796 %9797 +OpStore %745 %9798 +OpBranch %9787 +%9787 = OpLabel +%9799 = OpLoad %1035 %1054 +%9800 = OpIEqual %1057 %9799 %1094 +OpSelectionMerge %9802 None +OpBranchConditional %9800 %9801 %9802 +%9801 = OpLabel +%9803 = OpLoad %6 %13 +%9804 = OpLoad %6 %16 +%9805 = OpISub %6 %9803 %9804 +%9806 = OpLoad %6 %17 +%9807 = OpISub %6 %9805 %9806 +%9808 = OpLoad %6 %19 +%9809 = OpISub %6 %9807 %9808 +%9810 = OpLoad %6 %20 +%9811 = OpISub %6 %9809 %9810 +%9812 = OpLoad %6 %22 +%9813 = OpIAdd %6 %9811 %9812 +OpStore %746 %9813 +OpBranch %9802 +%9802 = OpLabel +%9814 = OpLoad %1035 %1054 +%9815 = OpULessThanEqual %1057 %9814 %1138 +OpSelectionMerge %9817 None +OpBranchConditional %9815 %9816 %9817 +%9816 = OpLabel +%9818 = OpLoad %6 %13 +%9819 = OpLoad %6 %18 +%9820 = OpISub %6 %9818 %9819 +%9821 = OpLoad %6 %22 +%9822 = OpIAdd %6 %9820 %9821 +OpStore %747 %9822 +OpBranch %9817 +%9817 = OpLabel +%9823 = OpLoad %1035 %1054 +%9824 = OpULessThanEqual %1057 %9823 %1138 +OpSelectionMerge %9826 None +OpBranchConditional %9824 %9825 %9826 +%9825 = OpLabel +%9827 = OpLoad %6 %13 +%9828 = OpLoad %6 %16 +%9829 = OpIAdd %6 %9827 %9828 +%9830 = OpLoad %6 %17 +%9831 = OpIAdd %6 %9829 %9830 +%9832 = OpLoad %6 %19 +%9833 = OpISub %6 %9831 %9832 +%9834 = OpLoad %6 %21 +%9835 = OpISub %6 %9833 %9834 +%9836 = OpLoad %6 %22 +%9837 = OpISub %6 %9835 %9836 +OpStore %748 %9837 +OpBranch %9826 +%9826 = OpLabel +%9838 = OpLoad %1035 %1054 +%9839 = OpUGreaterThan %1057 %9838 %1072 +OpSelectionMerge %9841 None +OpBranchConditional %9839 %9840 %9841 +%9840 = OpLabel +%9842 = OpLoad %6 %13 +%9843 = OpLoad %6 %16 +%9844 = OpISub %6 %9842 %9843 +%9845 = OpLoad %6 %17 +%9846 = OpIAdd %6 %9844 %9845 +%9847 = OpLoad %6 %20 +%9848 = OpIAdd %6 %9846 %9847 +%9849 = OpLoad %6 %21 +%9850 = OpIAdd %6 %9848 %9849 +%9851 = OpLoad %6 %22 +%9852 = OpIAdd %6 %9850 %9851 +OpStore %749 %9852 +OpBranch %9841 +%9841 = OpLabel +%9853 = OpLoad %1035 %1054 +%9854 = OpIEqual %1057 %9853 %1056 +OpSelectionMerge %9856 None +OpBranchConditional %9854 %9855 %9856 +%9855 = OpLabel +%9857 = OpLoad %6 %13 +%9858 = OpLoad %6 %16 +%9859 = OpIAdd %6 %9857 %9858 +%9860 = OpLoad %6 %18 +%9861 = OpISub %6 %9859 %9860 +%9862 = OpLoad %6 %19 +%9863 = OpIAdd %6 %9861 %9862 +%9864 = OpLoad %6 %20 +%9865 = OpIAdd %6 %9863 %9864 +%9866 = OpLoad %6 %21 +%9867 = OpISub %6 %9865 %9866 +OpStore %750 %9867 +OpBranch %9856 +%9856 = OpLabel +%9868 = OpLoad %1035 %1054 +%9869 = OpULessThan %1057 %9868 %1072 +OpSelectionMerge %9871 None +OpBranchConditional %9869 %9870 %9871 +%9870 = OpLabel +%9872 = OpLoad %6 %13 +%9873 = OpLoad %6 %16 +%9874 = OpISub %6 %9872 %9873 +%9875 = OpLoad %6 %18 +%9876 = OpISub %6 %9874 %9875 +%9877 = OpLoad %6 %19 +%9878 = OpIAdd %6 %9876 %9877 +%9879 = OpLoad %6 %20 +%9880 = OpIAdd %6 %9878 %9879 +%9881 = OpLoad %6 %22 +%9882 = OpISub %6 %9880 %9881 +OpStore %751 %9882 +OpBranch %9871 +%9871 = OpLabel +%9883 = OpLoad %1035 %1054 +%9884 = OpUGreaterThanEqual %1057 %9883 %1056 +OpSelectionMerge %9886 None +OpBranchConditional %9884 %9885 %9886 +%9885 = OpLabel +%9887 = OpLoad %6 %13 +%9888 = OpLoad %6 %16 +%9889 = OpISub %6 %9887 %9888 +%9890 = OpLoad %6 %18 +%9891 = OpIAdd %6 %9889 %9890 +%9892 = OpLoad %6 %19 +%9893 = OpIAdd %6 %9891 %9892 +%9894 = OpLoad %6 %21 +%9895 = OpIAdd %6 %9893 %9894 +%9896 = OpLoad %6 %22 +%9897 = OpIAdd %6 %9895 %9896 +OpStore %752 %9897 +OpBranch %9886 +%9886 = OpLabel +%9898 = OpLoad %1035 %1054 +%9899 = OpULessThanEqual %1057 %9898 %1094 +OpSelectionMerge %9901 None +OpBranchConditional %9899 %9900 %9901 +%9900 = OpLabel +%9902 = OpLoad %6 %13 +%9903 = OpLoad %6 %16 +%9904 = OpIAdd %6 %9902 %9903 +%9905 = OpLoad %6 %18 +%9906 = OpIAdd %6 %9904 %9905 +%9907 = OpLoad %6 %20 +%9908 = OpIAdd %6 %9906 %9907 +%9909 = OpLoad %6 %21 +%9910 = OpIAdd %6 %9908 %9909 +%9911 = OpLoad %6 %22 +%9912 = OpIAdd %6 %9910 %9911 +OpStore %753 %9912 +OpBranch %9901 +%9901 = OpLabel +%9913 = OpLoad %1035 %1054 +%9914 = OpUGreaterThan %1057 %9913 %1138 +OpSelectionMerge %9916 None +OpBranchConditional %9914 %9915 %9916 +%9915 = OpLabel +%9917 = OpLoad %6 %13 +%9918 = OpLoad %6 %16 +%9919 = OpIAdd %6 %9917 %9918 +%9920 = OpLoad %6 %19 +%9921 = OpIAdd %6 %9919 %9920 +%9922 = OpLoad %6 %20 +%9923 = OpIAdd %6 %9921 %9922 +%9924 = OpLoad %6 %21 +%9925 = OpISub %6 %9923 %9924 +%9926 = OpLoad %6 %22 +%9927 = OpIAdd %6 %9925 %9926 +OpStore %754 %9927 +OpBranch %9916 +%9916 = OpLabel +%9928 = OpLoad %1035 %1054 +%9929 = OpINotEqual %1057 %9928 %1072 +OpSelectionMerge %9931 None +OpBranchConditional %9929 %9930 %9931 +%9930 = OpLabel +%9932 = OpLoad %6 %13 +%9933 = OpLoad %6 %17 +%9934 = OpIAdd %6 %9932 %9933 +%9935 = OpLoad %6 %18 +%9936 = OpISub %6 %9934 %9935 +%9937 = OpLoad %6 %19 +%9938 = OpISub %6 %9936 %9937 +%9939 = OpLoad %6 %20 +%9940 = OpIAdd %6 %9938 %9939 +%9941 = OpLoad %6 %21 +%9942 = OpISub %6 %9940 %9941 +OpStore %755 %9942 +OpBranch %9931 +%9931 = OpLabel +%9943 = OpLoad %1035 %1054 +%9944 = OpINotEqual %1057 %9943 %1072 +OpSelectionMerge %9946 None +OpBranchConditional %9944 %9945 %9946 +%9945 = OpLabel +%9947 = OpLoad %6 %13 +%9948 = OpLoad %6 %17 +%9949 = OpISub %6 %9947 %9948 +%9950 = OpLoad %6 %18 +%9951 = OpISub %6 %9949 %9950 +%9952 = OpLoad %6 %19 +%9953 = OpIAdd %6 %9951 %9952 +%9954 = OpLoad %6 %20 +%9955 = OpIAdd %6 %9953 %9954 +%9956 = OpLoad %6 %22 +%9957 = OpIAdd %6 %9955 %9956 +OpStore %756 %9957 +OpBranch %9946 +%9946 = OpLabel +%9958 = OpLoad %1035 %1054 +%9959 = OpIEqual %1057 %9958 %1138 +OpSelectionMerge %9961 None +OpBranchConditional %9959 %9960 %9961 +%9960 = OpLabel +%9962 = OpLoad %6 %13 +%9963 = OpLoad %6 %17 +%9964 = OpISub %6 %9962 %9963 +%9965 = OpLoad %6 %18 +%9966 = OpISub %6 %9964 %9965 +%9967 = OpLoad %6 %19 +%9968 = OpIAdd %6 %9966 %9967 +%9969 = OpLoad %6 %21 +%9970 = OpIAdd %6 %9968 %9969 +%9971 = OpLoad %6 %22 +%9972 = OpIAdd %6 %9970 %9971 +OpStore %757 %9972 +OpBranch %9961 +%9961 = OpLabel +%9973 = OpLoad %1035 %1054 +%9974 = OpUGreaterThanEqual %1057 %9973 %1138 +OpSelectionMerge %9976 None +OpBranchConditional %9974 %9975 %9976 +%9975 = OpLabel +%9977 = OpLoad %6 %13 +%9978 = OpLoad %6 %19 +%9979 = OpISub %6 %9977 %9978 +%9980 = OpLoad %6 %20 +%9981 = OpIAdd %6 %9979 %9980 +OpStore %758 %9981 +OpBranch %9976 +%9976 = OpLabel +%9982 = OpLoad %1035 %1054 +%9983 = OpUGreaterThanEqual %1057 %9982 %1072 +OpSelectionMerge %9985 None +OpBranchConditional %9983 %9984 %9985 +%9984 = OpLabel +%9986 = OpLoad %6 %13 +%9987 = OpLoad %6 %17 +%9988 = OpIAdd %6 %9986 %9987 +%9989 = OpLoad %6 %18 +%9990 = OpISub %6 %9988 %9989 +%9991 = OpLoad %6 %20 +%9992 = OpISub %6 %9990 %9991 +%9993 = OpLoad %6 %21 +%9994 = OpIAdd %6 %9992 %9993 +%9995 = OpLoad %6 %22 +%9996 = OpISub %6 %9994 %9995 +OpStore %759 %9996 +OpBranch %9985 +%9985 = OpLabel +%9997 = OpLoad %1035 %1054 +%9998 = OpULessThan %1057 %9997 %1072 +OpSelectionMerge %10000 None +OpBranchConditional %9998 %9999 %10000 +%9999 = OpLabel +%10001 = OpLoad %6 %13 +%10002 = OpLoad %6 %17 +%10003 = OpIAdd %6 %10001 %10002 +%10004 = OpLoad %6 %19 +%10005 = OpIAdd %6 %10003 %10004 +%10006 = OpLoad %6 %20 +%10007 = OpIAdd %6 %10005 %10006 +%10008 = OpLoad %6 %21 +%10009 = OpIAdd %6 %10007 %10008 +%10010 = OpLoad %6 %22 +%10011 = OpIAdd %6 %10009 %10010 +OpStore %760 %10011 +OpBranch %10000 +%10000 = OpLabel +%10012 = OpLoad %1035 %1054 +%10013 = OpULessThan %1057 %10012 %1094 +OpSelectionMerge %10015 None +OpBranchConditional %10013 %10014 %10015 +%10014 = OpLabel +%10016 = OpLoad %6 %13 +%10017 = OpLoad %6 %18 +%10018 = OpISub %6 %10016 %10017 +%10019 = OpLoad %6 %19 +%10020 = OpISub %6 %10018 %10019 +%10021 = OpLoad %6 %20 +%10022 = OpIAdd %6 %10020 %10021 +%10023 = OpLoad %6 %21 +%10024 = OpIAdd %6 %10022 %10023 +%10025 = OpLoad %6 %22 +%10026 = OpIAdd %6 %10024 %10025 +OpStore %761 %10026 +OpBranch %10015 +%10015 = OpLabel +%10027 = OpLoad %1035 %1054 +%10028 = OpUGreaterThan %1057 %10027 %1056 +OpSelectionMerge %10030 None +OpBranchConditional %10028 %10029 %10030 +%10029 = OpLabel +%10031 = OpLoad %6 %14 +%10032 = OpLoad %6 %15 +%10033 = OpIAdd %6 %10031 %10032 +%10034 = OpLoad %6 %16 +%10035 = OpIAdd %6 %10033 %10034 +%10036 = OpLoad %6 %17 +%10037 = OpIAdd %6 %10035 %10036 +%10038 = OpLoad %6 %18 +%10039 = OpISub %6 %10037 %10038 +%10040 = OpLoad %6 %19 +%10041 = OpISub %6 %10039 %10040 +OpStore %762 %10041 +OpBranch %10030 +%10030 = OpLabel +%10042 = OpLoad %1035 %1054 +%10043 = OpUGreaterThan %1057 %10042 %1094 +OpSelectionMerge %10045 None +OpBranchConditional %10043 %10044 %10045 +%10044 = OpLabel +%10046 = OpLoad %6 %14 +%10047 = OpLoad %6 %15 +%10048 = OpISub %6 %10046 %10047 +%10049 = OpLoad %6 %16 +%10050 = OpISub %6 %10048 %10049 +%10051 = OpLoad %6 %17 +%10052 = OpIAdd %6 %10050 %10051 +%10053 = OpLoad %6 %18 +%10054 = OpIAdd %6 %10052 %10053 +%10055 = OpLoad %6 %20 +%10056 = OpISub %6 %10054 %10055 +OpStore %763 %10056 +OpBranch %10045 +%10045 = OpLabel +%10057 = OpLoad %1035 %1054 +%10058 = OpULessThan %1057 %10057 %1072 +OpSelectionMerge %10060 None +OpBranchConditional %10058 %10059 %10060 +%10059 = OpLabel +%10061 = OpLoad %6 %14 +%10062 = OpLoad %6 %15 +%10063 = OpIAdd %6 %10061 %10062 +%10064 = OpLoad %6 %16 +%10065 = OpISub %6 %10063 %10064 +%10066 = OpLoad %6 %17 +%10067 = OpIAdd %6 %10065 %10066 +%10068 = OpLoad %6 %18 +%10069 = OpIAdd %6 %10067 %10068 +%10070 = OpLoad %6 %21 +%10071 = OpISub %6 %10069 %10070 +OpStore %764 %10071 +OpBranch %10060 +%10060 = OpLabel +%10072 = OpLoad %1035 %1054 +%10073 = OpUGreaterThan %1057 %10072 %1056 +OpSelectionMerge %10075 None +OpBranchConditional %10073 %10074 %10075 +%10074 = OpLabel +%10076 = OpLoad %6 %14 +%10077 = OpLoad %6 %15 +%10078 = OpISub %6 %10076 %10077 +%10079 = OpLoad %6 %16 +%10080 = OpISub %6 %10078 %10079 +%10081 = OpLoad %6 %17 +%10082 = OpISub %6 %10080 %10081 +%10083 = OpLoad %6 %18 +%10084 = OpIAdd %6 %10082 %10083 +%10085 = OpLoad %6 %22 +%10086 = OpISub %6 %10084 %10085 +OpStore %765 %10086 +OpBranch %10075 +%10075 = OpLabel +%10087 = OpLoad %1035 %1054 +%10088 = OpULessThanEqual %1057 %10087 %1056 +OpSelectionMerge %10090 None +OpBranchConditional %10088 %10089 %10090 +%10089 = OpLabel +%10091 = OpLoad %6 %14 +%10092 = OpLoad %6 %15 +%10093 = OpISub %6 %10091 %10092 +%10094 = OpLoad %6 %16 +%10095 = OpIAdd %6 %10093 %10094 +%10096 = OpLoad %6 %17 +%10097 = OpISub %6 %10095 %10096 +%10098 = OpLoad %6 %19 +%10099 = OpIAdd %6 %10097 %10098 +%10100 = OpLoad %6 %20 +%10101 = OpISub %6 %10099 %10100 +OpStore %766 %10101 +OpBranch %10090 +%10090 = OpLabel +%10102 = OpLoad %1035 %1054 +%10103 = OpULessThan %1057 %10102 %1056 +OpSelectionMerge %10105 None +OpBranchConditional %10103 %10104 %10105 +%10104 = OpLabel +%10106 = OpLoad %6 %14 +%10107 = OpLoad %6 %15 +%10108 = OpIAdd %6 %10106 %10107 +%10109 = OpLoad %6 %16 +%10110 = OpISub %6 %10108 %10109 +%10111 = OpLoad %6 %17 +%10112 = OpIAdd %6 %10110 %10111 +%10113 = OpLoad %6 %19 +%10114 = OpISub %6 %10112 %10113 +%10115 = OpLoad %6 %21 +%10116 = OpIAdd %6 %10114 %10115 +OpStore %767 %10116 +OpBranch %10105 +%10105 = OpLabel +%10117 = OpLoad %1035 %1054 +%10118 = OpUGreaterThan %1057 %10117 %1138 +OpSelectionMerge %10120 None +OpBranchConditional %10118 %10119 %10120 +%10119 = OpLabel +%10121 = OpLoad %6 %14 +%10122 = OpLoad %6 %15 +%10123 = OpISub %6 %10121 %10122 +%10124 = OpLoad %6 %16 +%10125 = OpIAdd %6 %10123 %10124 +%10126 = OpLoad %6 %17 +%10127 = OpISub %6 %10125 %10126 +%10128 = OpLoad %6 %19 +%10129 = OpISub %6 %10127 %10128 +%10130 = OpLoad %6 %22 +%10131 = OpIAdd %6 %10129 %10130 +OpStore %768 %10131 +OpBranch %10120 +%10120 = OpLabel +%10132 = OpLoad %1035 %1054 +%10133 = OpULessThan %1057 %10132 %1056 +OpSelectionMerge %10135 None +OpBranchConditional %10133 %10134 %10135 +%10134 = OpLabel +%10136 = OpLoad %6 %13 +%10137 = OpLoad %6 %19 +%10138 = OpISub %6 %10136 %10137 +%10139 = OpLoad %6 %21 +%10140 = OpIAdd %6 %10138 %10139 +OpStore %769 %10140 +OpBranch %10135 +%10135 = OpLabel +%10141 = OpLoad %1035 %1054 +%10142 = OpULessThan %1057 %10141 %1056 +OpSelectionMerge %10144 None +OpBranchConditional %10142 %10143 %10144 +%10143 = OpLabel +%10145 = OpLoad %6 %14 +%10146 = OpLoad %6 %15 +%10147 = OpIAdd %6 %10145 %10146 +%10148 = OpLoad %6 %16 +%10149 = OpIAdd %6 %10147 %10148 +%10150 = OpLoad %6 %17 +%10151 = OpIAdd %6 %10149 %10150 +%10152 = OpLoad %6 %20 +%10153 = OpIAdd %6 %10151 %10152 +%10154 = OpLoad %6 %21 +%10155 = OpISub %6 %10153 %10154 +OpStore %770 %10155 +OpBranch %10144 +%10144 = OpLabel +%10156 = OpLoad %1035 %1054 +%10157 = OpIEqual %1057 %10156 %1072 +OpSelectionMerge %10159 None +OpBranchConditional %10157 %10158 %10159 +%10158 = OpLabel +%10160 = OpLoad %6 %14 +%10161 = OpLoad %6 %15 +%10162 = OpISub %6 %10160 %10161 +%10163 = OpLoad %6 %16 +%10164 = OpISub %6 %10162 %10163 +%10165 = OpLoad %6 %17 +%10166 = OpISub %6 %10164 %10165 +%10167 = OpLoad %6 %20 +%10168 = OpIAdd %6 %10166 %10167 +%10169 = OpLoad %6 %22 +%10170 = OpISub %6 %10168 %10169 +OpStore %771 %10170 +OpBranch %10159 +%10159 = OpLabel +%10171 = OpLoad %1035 %1054 +%10172 = OpUGreaterThanEqual %1057 %10171 %1138 +OpSelectionMerge %10174 None +OpBranchConditional %10172 %10173 %10174 +%10173 = OpLabel +%10175 = OpLoad %6 %14 +%10176 = OpLoad %6 %15 +%10177 = OpISub %6 %10175 %10176 +%10178 = OpLoad %6 %16 +%10179 = OpISub %6 %10177 %10178 +%10180 = OpLoad %6 %17 +%10181 = OpIAdd %6 %10179 %10180 +%10182 = OpLoad %6 %21 +%10183 = OpIAdd %6 %10181 %10182 +%10184 = OpLoad %6 %22 +%10185 = OpISub %6 %10183 %10184 +OpStore %772 %10185 +OpBranch %10174 +%10174 = OpLabel +%10186 = OpLoad %1035 %1054 +%10187 = OpULessThanEqual %1057 %10186 %1094 +OpSelectionMerge %10189 None +OpBranchConditional %10187 %10188 %10189 +%10188 = OpLabel +%10190 = OpLoad %6 %14 +%10191 = OpLoad %6 %15 +%10192 = OpIAdd %6 %10190 %10191 +%10193 = OpLoad %6 %16 +%10194 = OpISub %6 %10192 %10193 +%10195 = OpLoad %6 %18 +%10196 = OpIAdd %6 %10194 %10195 +%10197 = OpLoad %6 %19 +%10198 = OpIAdd %6 %10196 %10197 +%10199 = OpLoad %6 %20 +%10200 = OpISub %6 %10198 %10199 +OpStore %773 %10200 +OpBranch %10189 +%10189 = OpLabel +%10201 = OpLoad %1035 %1054 +%10202 = OpIEqual %1057 %10201 %1094 +OpSelectionMerge %10204 None +OpBranchConditional %10202 %10203 %10204 +%10203 = OpLabel +%10205 = OpLoad %6 %14 +%10206 = OpLoad %6 %15 +%10207 = OpIAdd %6 %10205 %10206 +%10208 = OpLoad %6 %16 +%10209 = OpISub %6 %10207 %10208 +%10210 = OpLoad %6 %18 +%10211 = OpISub %6 %10209 %10210 +%10212 = OpLoad %6 %19 +%10213 = OpIAdd %6 %10211 %10212 +%10214 = OpLoad %6 %21 +%10215 = OpIAdd %6 %10213 %10214 +OpStore %774 %10215 +OpBranch %10204 +%10204 = OpLabel +%10216 = OpLoad %1035 %1054 +%10217 = OpUGreaterThan %1057 %10216 %1138 +OpSelectionMerge %10219 None +OpBranchConditional %10217 %10218 %10219 +%10218 = OpLabel +%10220 = OpLoad %6 %14 +%10221 = OpLoad %6 %15 +%10222 = OpIAdd %6 %10220 %10221 +%10223 = OpLoad %6 %16 +%10224 = OpIAdd %6 %10222 %10223 +%10225 = OpLoad %6 %18 +%10226 = OpIAdd %6 %10224 %10225 +%10227 = OpLoad %6 %19 +%10228 = OpIAdd %6 %10226 %10227 +%10229 = OpLoad %6 %22 +%10230 = OpISub %6 %10228 %10229 +OpStore %775 %10230 +OpBranch %10219 +%10219 = OpLabel +%10231 = OpLoad %1035 %1054 +%10232 = OpINotEqual %1057 %10231 %1138 +OpSelectionMerge %10234 None +OpBranchConditional %10232 %10233 %10234 +%10233 = OpLabel +%10235 = OpLoad %6 %14 +%10236 = OpLoad %6 %15 +%10237 = OpIAdd %6 %10235 %10236 +%10238 = OpLoad %6 %16 +%10239 = OpIAdd %6 %10237 %10238 +%10240 = OpLoad %6 %18 +%10241 = OpISub %6 %10239 %10240 +%10242 = OpLoad %6 %20 +%10243 = OpIAdd %6 %10241 %10242 +%10244 = OpLoad %6 %21 +%10245 = OpIAdd %6 %10243 %10244 +OpStore %776 %10245 +OpBranch %10234 +%10234 = OpLabel +%10246 = OpLoad %1035 %1054 +%10247 = OpULessThanEqual %1057 %10246 %1056 +OpSelectionMerge %10249 None +OpBranchConditional %10247 %10248 %10249 +%10248 = OpLabel +%10250 = OpLoad %6 %14 +%10251 = OpLoad %6 %15 +%10252 = OpIAdd %6 %10250 %10251 +%10253 = OpLoad %6 %16 +%10254 = OpISub %6 %10252 %10253 +%10255 = OpLoad %6 %18 +%10256 = OpIAdd %6 %10254 %10255 +%10257 = OpLoad %6 %20 +%10258 = OpIAdd %6 %10256 %10257 +%10259 = OpLoad %6 %22 +%10260 = OpISub %6 %10258 %10259 +OpStore %777 %10260 +OpBranch %10249 +%10249 = OpLabel +%10261 = OpLoad %1035 %1054 +%10262 = OpIEqual %1057 %10261 %1138 +OpSelectionMerge %10264 None +OpBranchConditional %10262 %10263 %10264 +%10263 = OpLabel +%10265 = OpLoad %6 %14 +%10266 = OpLoad %6 %15 +%10267 = OpISub %6 %10265 %10266 +%10268 = OpLoad %6 %16 +%10269 = OpIAdd %6 %10267 %10268 +%10270 = OpLoad %6 %18 +%10271 = OpISub %6 %10269 %10270 +%10272 = OpLoad %6 %21 +%10273 = OpISub %6 %10271 %10272 +%10274 = OpLoad %6 %22 +%10275 = OpIAdd %6 %10273 %10274 +OpStore %778 %10275 +OpBranch %10264 +%10264 = OpLabel +%10276 = OpLoad %1035 %1054 +%10277 = OpULessThan %1057 %10276 %1056 +OpSelectionMerge %10279 None +OpBranchConditional %10277 %10278 %10279 +%10278 = OpLabel +%10280 = OpLoad %6 %14 +%10281 = OpLoad %6 %15 +%10282 = OpIAdd %6 %10280 %10281 +%10283 = OpLoad %6 %16 +%10284 = OpISub %6 %10282 %10283 +%10285 = OpLoad %6 %19 +%10286 = OpISub %6 %10284 %10285 +%10287 = OpLoad %6 %20 +%10288 = OpISub %6 %10286 %10287 +%10289 = OpLoad %6 %21 +%10290 = OpISub %6 %10288 %10289 +OpStore %779 %10290 +OpBranch %10279 +%10279 = OpLabel +%10291 = OpLoad %1035 %1054 +%10292 = OpUGreaterThanEqual %1057 %10291 %1094 +OpSelectionMerge %10294 None +OpBranchConditional %10292 %10293 %10294 +%10293 = OpLabel +%10295 = OpLoad %6 %13 +%10296 = OpLoad %6 %19 +%10297 = OpIAdd %6 %10295 %10296 +%10298 = OpLoad %6 %22 +%10299 = OpIAdd %6 %10297 %10298 +OpStore %780 %10299 +OpBranch %10294 +%10294 = OpLabel +%10300 = OpLoad %1035 %1054 +%10301 = OpUGreaterThan %1057 %10300 %1094 +OpSelectionMerge %10303 None +OpBranchConditional %10301 %10302 %10303 +%10302 = OpLabel +%10304 = OpLoad %6 %14 +%10305 = OpLoad %6 %15 +%10306 = OpISub %6 %10304 %10305 +%10307 = OpLoad %6 %16 +%10308 = OpIAdd %6 %10306 %10307 +%10309 = OpLoad %6 %19 +%10310 = OpIAdd %6 %10308 %10309 +%10311 = OpLoad %6 %20 +%10312 = OpISub %6 %10310 %10311 +%10313 = OpLoad %6 %22 +%10314 = OpISub %6 %10312 %10313 +OpStore %781 %10314 +OpBranch %10303 +%10303 = OpLabel +%10315 = OpLoad %1035 %1054 +%10316 = OpULessThan %1057 %10315 %1072 +OpSelectionMerge %10318 None +OpBranchConditional %10316 %10317 %10318 +%10317 = OpLabel +%10319 = OpLoad %6 %14 +%10320 = OpLoad %6 %15 +%10321 = OpISub %6 %10319 %10320 +%10322 = OpLoad %6 %16 +%10323 = OpISub %6 %10321 %10322 +%10324 = OpLoad %6 %19 +%10325 = OpIAdd %6 %10323 %10324 +%10326 = OpLoad %6 %21 +%10327 = OpISub %6 %10325 %10326 +%10328 = OpLoad %6 %22 +%10329 = OpIAdd %6 %10327 %10328 +OpStore %782 %10329 +OpBranch %10318 +%10318 = OpLabel +%10330 = OpLoad %1035 %1054 +%10331 = OpIEqual %1057 %10330 %1072 +OpSelectionMerge %10333 None +OpBranchConditional %10331 %10332 %10333 +%10332 = OpLabel +%10334 = OpLoad %6 %14 +%10335 = OpLoad %6 %15 +%10336 = OpISub %6 %10334 %10335 +%10337 = OpLoad %6 %16 +%10338 = OpISub %6 %10336 %10337 +%10339 = OpLoad %6 %20 +%10340 = OpISub %6 %10338 %10339 +%10341 = OpLoad %6 %21 +%10342 = OpISub %6 %10340 %10341 +%10343 = OpLoad %6 %22 +%10344 = OpIAdd %6 %10342 %10343 +OpStore %783 %10344 +OpBranch %10333 +%10333 = OpLabel +%10345 = OpLoad %1035 %1054 +%10346 = OpUGreaterThan %1057 %10345 %1056 +OpSelectionMerge %10348 None +OpBranchConditional %10346 %10347 %10348 +%10347 = OpLabel +%10349 = OpLoad %6 %14 +%10350 = OpLoad %6 %15 +%10351 = OpISub %6 %10349 %10350 +%10352 = OpLoad %6 %17 +%10353 = OpISub %6 %10351 %10352 +%10354 = OpLoad %6 %18 +%10355 = OpIAdd %6 %10353 %10354 +%10356 = OpLoad %6 %19 +%10357 = OpIAdd %6 %10355 %10356 +%10358 = OpLoad %6 %20 +%10359 = OpIAdd %6 %10357 %10358 +OpStore %784 %10359 +OpBranch %10348 +%10348 = OpLabel +%10360 = OpLoad %1035 %1054 +%10361 = OpIEqual %1057 %10360 %1056 +OpSelectionMerge %10363 None +OpBranchConditional %10361 %10362 %10363 +%10362 = OpLabel +%10364 = OpLoad %6 %14 +%10365 = OpLoad %6 %15 +%10366 = OpIAdd %6 %10364 %10365 +%10367 = OpLoad %6 %17 +%10368 = OpIAdd %6 %10366 %10367 +%10369 = OpLoad %6 %18 +%10370 = OpISub %6 %10368 %10369 +%10371 = OpLoad %6 %19 +%10372 = OpISub %6 %10370 %10371 +%10373 = OpLoad %6 %21 +%10374 = OpISub %6 %10372 %10373 +OpStore %785 %10374 +OpBranch %10363 +%10363 = OpLabel +%10375 = OpLoad %1035 %1054 +%10376 = OpIEqual %1057 %10375 %1094 +OpSelectionMerge %10378 None +OpBranchConditional %10376 %10377 %10378 +%10377 = OpLabel +%10379 = OpLoad %6 %14 +%10380 = OpLoad %6 %15 +%10381 = OpIAdd %6 %10379 %10380 +%10382 = OpLoad %6 %17 +%10383 = OpIAdd %6 %10381 %10382 +%10384 = OpLoad %6 %18 +%10385 = OpISub %6 %10383 %10384 +%10386 = OpLoad %6 %19 +%10387 = OpISub %6 %10385 %10386 +%10388 = OpLoad %6 %22 +%10389 = OpIAdd %6 %10387 %10388 +OpStore %786 %10389 +OpBranch %10378 +%10378 = OpLabel +%10390 = OpLoad %1035 %1054 +%10391 = OpUGreaterThanEqual %1057 %10390 %1072 +OpSelectionMerge %10393 None +OpBranchConditional %10391 %10392 %10393 +%10392 = OpLabel +%10394 = OpLoad %6 %14 +%10395 = OpLoad %6 %15 +%10396 = OpISub %6 %10394 %10395 +%10397 = OpLoad %6 %17 +%10398 = OpISub %6 %10396 %10397 +%10399 = OpLoad %6 %18 +%10400 = OpIAdd %6 %10398 %10399 +%10401 = OpLoad %6 %20 +%10402 = OpIAdd %6 %10400 %10401 +%10403 = OpLoad %6 %21 +%10404 = OpISub %6 %10402 %10403 +OpStore %787 %10404 +OpBranch %10393 +%10393 = OpLabel +%10405 = OpLoad %1035 %1054 +%10406 = OpIEqual %1057 %10405 %1138 +OpSelectionMerge %10408 None +OpBranchConditional %10406 %10407 %10408 +%10407 = OpLabel +%10409 = OpLoad %6 %14 +%10410 = OpLoad %6 %15 +%10411 = OpISub %6 %10409 %10410 +%10412 = OpLoad %6 %17 +%10413 = OpIAdd %6 %10411 %10412 +%10414 = OpLoad %6 %18 +%10415 = OpISub %6 %10413 %10414 +%10416 = OpLoad %6 %20 +%10417 = OpIAdd %6 %10415 %10416 +%10418 = OpLoad %6 %22 +%10419 = OpISub %6 %10417 %10418 +OpStore %788 %10419 +OpBranch %10408 +%10408 = OpLabel +%10420 = OpLoad %1035 %1054 +%10421 = OpUGreaterThan %1057 %10420 %1138 +OpSelectionMerge %10423 None +OpBranchConditional %10421 %10422 %10423 +%10422 = OpLabel +%10424 = OpLoad %6 %14 +%10425 = OpLoad %6 %15 +%10426 = OpIAdd %6 %10424 %10425 +%10427 = OpLoad %6 %17 +%10428 = OpIAdd %6 %10426 %10427 +%10429 = OpLoad %6 %18 +%10430 = OpISub %6 %10428 %10429 +%10431 = OpLoad %6 %21 +%10432 = OpIAdd %6 %10430 %10431 +%10433 = OpLoad %6 %22 +%10434 = OpIAdd %6 %10432 %10433 +OpStore %789 %10434 +OpBranch %10423 +%10423 = OpLabel +%10435 = OpLoad %1035 %1054 +%10436 = OpINotEqual %1057 %10435 %1056 +OpSelectionMerge %10438 None +OpBranchConditional %10436 %10437 %10438 +%10437 = OpLabel +%10439 = OpLoad %6 %14 +%10440 = OpLoad %6 %15 +%10441 = OpISub %6 %10439 %10440 +%10442 = OpLoad %6 %17 +%10443 = OpISub %6 %10441 %10442 +%10444 = OpLoad %6 %19 +%10445 = OpIAdd %6 %10443 %10444 +%10446 = OpLoad %6 %20 +%10447 = OpIAdd %6 %10445 %10446 +%10448 = OpLoad %6 %21 +%10449 = OpISub %6 %10447 %10448 +OpStore %790 %10449 +OpBranch %10438 +%10438 = OpLabel +%10450 = OpLoad %1035 %1054 +%10451 = OpULessThan %1057 %10450 %1056 +OpSelectionMerge %10453 None +OpBranchConditional %10451 %10452 %10453 +%10452 = OpLabel +%10454 = OpLoad %6 %13 +%10455 = OpLoad %6 %20 +%10456 = OpIAdd %6 %10454 %10455 +%10457 = OpLoad %6 %21 +%10458 = OpIAdd %6 %10456 %10457 +OpStore %791 %10458 +OpBranch %10453 +%10453 = OpLabel +%10459 = OpLoad %1035 %1054 +%10460 = OpUGreaterThanEqual %1057 %10459 %1056 +OpSelectionMerge %10462 None +OpBranchConditional %10460 %10461 %10462 +%10461 = OpLabel +%10463 = OpLoad %6 %14 +%10464 = OpLoad %6 %15 +%10465 = OpIAdd %6 %10463 %10464 +%10466 = OpLoad %6 %17 +%10467 = OpISub %6 %10465 %10466 +%10468 = OpLoad %6 %19 +%10469 = OpISub %6 %10467 %10468 +%10470 = OpLoad %6 %20 +%10471 = OpIAdd %6 %10469 %10470 +%10472 = OpLoad %6 %22 +%10473 = OpISub %6 %10471 %10472 +OpStore %792 %10473 +OpBranch %10462 +%10462 = OpLabel +%10474 = OpLoad %1035 %1054 +%10475 = OpINotEqual %1057 %10474 %1094 +OpSelectionMerge %10477 None +OpBranchConditional %10475 %10476 %10477 +%10476 = OpLabel +%10478 = OpLoad %6 %14 +%10479 = OpLoad %6 %15 +%10480 = OpIAdd %6 %10478 %10479 +%10481 = OpLoad %6 %17 +%10482 = OpISub %6 %10480 %10481 +%10483 = OpLoad %6 %19 +%10484 = OpIAdd %6 %10482 %10483 +%10485 = OpLoad %6 %21 +%10486 = OpIAdd %6 %10484 %10485 +%10487 = OpLoad %6 %22 +%10488 = OpISub %6 %10486 %10487 +OpStore %793 %10488 +OpBranch %10477 +%10477 = OpLabel +%10489 = OpLoad %1035 %1054 +%10490 = OpINotEqual %1057 %10489 %1138 +OpSelectionMerge %10492 None +OpBranchConditional %10490 %10491 %10492 +%10491 = OpLabel +%10493 = OpLoad %6 %14 +%10494 = OpLoad %6 %15 +%10495 = OpISub %6 %10493 %10494 +%10496 = OpLoad %6 %17 +%10497 = OpISub %6 %10495 %10496 +%10498 = OpLoad %6 %20 +%10499 = OpISub %6 %10497 %10498 +%10500 = OpLoad %6 %21 +%10501 = OpIAdd %6 %10499 %10500 +%10502 = OpLoad %6 %22 +%10503 = OpIAdd %6 %10501 %10502 +OpStore %794 %10503 +OpBranch %10492 +%10492 = OpLabel +%10504 = OpLoad %1035 %1054 +%10505 = OpINotEqual %1057 %10504 %1138 +OpSelectionMerge %10507 None +OpBranchConditional %10505 %10506 %10507 +%10506 = OpLabel +%10508 = OpLoad %6 %14 +%10509 = OpLoad %6 %15 +%10510 = OpIAdd %6 %10508 %10509 +%10511 = OpLoad %6 %18 +%10512 = OpIAdd %6 %10510 %10511 +%10513 = OpLoad %6 %19 +%10514 = OpISub %6 %10512 %10513 +%10515 = OpLoad %6 %20 +%10516 = OpISub %6 %10514 %10515 +%10517 = OpLoad %6 %21 +%10518 = OpIAdd %6 %10516 %10517 +OpStore %795 %10518 +OpBranch %10507 +%10507 = OpLabel +%10519 = OpLoad %1035 %1054 +%10520 = OpUGreaterThan %1057 %10519 %1138 +OpSelectionMerge %10522 None +OpBranchConditional %10520 %10521 %10522 +%10521 = OpLabel +%10523 = OpLoad %6 %14 +%10524 = OpLoad %6 %15 +%10525 = OpIAdd %6 %10523 %10524 +%10526 = OpLoad %6 %18 +%10527 = OpISub %6 %10525 %10526 +%10528 = OpLoad %6 %19 +%10529 = OpIAdd %6 %10527 %10528 +%10530 = OpLoad %6 %20 +%10531 = OpIAdd %6 %10529 %10530 +%10532 = OpLoad %6 %22 +%10533 = OpIAdd %6 %10531 %10532 +OpStore %796 %10533 +OpBranch %10522 +%10522 = OpLabel +%10534 = OpLoad %1035 %1054 +%10535 = OpULessThanEqual %1057 %10534 %1138 +OpSelectionMerge %10537 None +OpBranchConditional %10535 %10536 %10537 +%10536 = OpLabel +%10538 = OpLoad %6 %14 +%10539 = OpLoad %6 %15 +%10540 = OpISub %6 %10538 %10539 +%10541 = OpLoad %6 %18 +%10542 = OpISub %6 %10540 %10541 +%10543 = OpLoad %6 %19 +%10544 = OpIAdd %6 %10542 %10543 +%10545 = OpLoad %6 %21 +%10546 = OpIAdd %6 %10544 %10545 +%10547 = OpLoad %6 %22 +%10548 = OpIAdd %6 %10546 %10547 +OpStore %797 %10548 +OpBranch %10537 +%10537 = OpLabel +%10549 = OpLoad %1035 %1054 +%10550 = OpIEqual %1057 %10549 %1072 +OpSelectionMerge %10552 None +OpBranchConditional %10550 %10551 %10552 +%10551 = OpLabel +%10553 = OpLoad %6 %14 +%10554 = OpLoad %6 %15 +%10555 = OpIAdd %6 %10553 %10554 +%10556 = OpLoad %6 %18 +%10557 = OpISub %6 %10555 %10556 +%10558 = OpLoad %6 %20 +%10559 = OpIAdd %6 %10557 %10558 +%10560 = OpLoad %6 %21 +%10561 = OpIAdd %6 %10559 %10560 +%10562 = OpLoad %6 %22 +%10563 = OpIAdd %6 %10561 %10562 +OpStore %798 %10563 +OpBranch %10552 +%10552 = OpLabel +%10564 = OpLoad %1035 %1054 +%10565 = OpUGreaterThanEqual %1057 %10564 %1094 +OpSelectionMerge %10567 None +OpBranchConditional %10565 %10566 %10567 +%10566 = OpLabel +%10568 = OpLoad %6 %14 +%10569 = OpLoad %6 %15 +%10570 = OpISub %6 %10568 %10569 +%10571 = OpLoad %6 %19 +%10572 = OpISub %6 %10570 %10571 +%10573 = OpLoad %6 %20 +%10574 = OpISub %6 %10572 %10573 +%10575 = OpLoad %6 %21 +%10576 = OpISub %6 %10574 %10575 +%10577 = OpLoad %6 %22 +%10578 = OpIAdd %6 %10576 %10577 +OpStore %799 %10578 +OpBranch %10567 +%10567 = OpLabel +%10579 = OpLoad %1035 %1054 +%10580 = OpINotEqual %1057 %10579 %1056 +OpSelectionMerge %10582 None +OpBranchConditional %10580 %10581 %10582 +%10581 = OpLabel +%10583 = OpLoad %6 %14 +%10584 = OpLoad %6 %16 +%10585 = OpIAdd %6 %10583 %10584 +%10586 = OpLoad %6 %17 +%10587 = OpISub %6 %10585 %10586 +%10588 = OpLoad %6 %18 +%10589 = OpISub %6 %10587 %10588 +%10590 = OpLoad %6 %19 +%10591 = OpISub %6 %10589 %10590 +%10592 = OpLoad %6 %20 +%10593 = OpIAdd %6 %10591 %10592 +OpStore %800 %10593 +OpBranch %10582 +%10582 = OpLabel +%10594 = OpLoad %1035 %1054 +%10595 = OpIEqual %1057 %10594 %1094 +OpSelectionMerge %10597 None +OpBranchConditional %10595 %10596 %10597 +%10596 = OpLabel +%10598 = OpLoad %6 %14 +%10599 = OpLoad %6 %16 +%10600 = OpISub %6 %10598 %10599 +%10601 = OpLoad %6 %17 +%10602 = OpISub %6 %10600 %10601 +%10603 = OpLoad %6 %18 +%10604 = OpIAdd %6 %10602 %10603 +%10605 = OpLoad %6 %19 +%10606 = OpIAdd %6 %10604 %10605 +%10607 = OpLoad %6 %21 +%10608 = OpISub %6 %10606 %10607 +OpStore %801 %10608 +OpBranch %10597 +%10597 = OpLabel +%10609 = OpLoad %1035 %1054 +%10610 = OpINotEqual %1057 %10609 %1056 +OpSelectionMerge %10612 None +OpBranchConditional %10610 %10611 %10612 +%10611 = OpLabel +%10613 = OpLoad %6 %13 +%10614 = OpLoad %6 %20 +%10615 = OpIAdd %6 %10613 %10614 +%10616 = OpLoad %6 %22 +%10617 = OpIAdd %6 %10615 %10616 +OpStore %802 %10617 +OpBranch %10612 +%10612 = OpLabel +%10618 = OpLoad %1035 %1054 +%10619 = OpULessThanEqual %1057 %10618 %1072 +OpSelectionMerge %10621 None +OpBranchConditional %10619 %10620 %10621 +%10620 = OpLabel +%10622 = OpLoad %6 %14 +%10623 = OpLoad %6 %16 +%10624 = OpISub %6 %10622 %10623 +%10625 = OpLoad %6 %17 +%10626 = OpIAdd %6 %10624 %10625 +%10627 = OpLoad %6 %18 +%10628 = OpIAdd %6 %10626 %10627 +%10629 = OpLoad %6 %19 +%10630 = OpIAdd %6 %10628 %10629 +%10631 = OpLoad %6 %22 +%10632 = OpIAdd %6 %10630 %10631 +OpStore %803 %10632 +OpBranch %10621 +%10621 = OpLabel +%10633 = OpLoad %1035 %1054 +%10634 = OpINotEqual %1057 %10633 %1056 +OpSelectionMerge %10636 None +OpBranchConditional %10634 %10635 %10636 +%10635 = OpLabel +%10637 = OpLoad %6 %14 +%10638 = OpLoad %6 %16 +%10639 = OpIAdd %6 %10637 %10638 +%10640 = OpLoad %6 %17 +%10641 = OpISub %6 %10639 %10640 +%10642 = OpLoad %6 %18 +%10643 = OpIAdd %6 %10641 %10642 +%10644 = OpLoad %6 %20 +%10645 = OpISub %6 %10643 %10644 +%10646 = OpLoad %6 %21 +%10647 = OpISub %6 %10645 %10646 +OpStore %804 %10647 +OpBranch %10636 +%10636 = OpLabel +%10648 = OpLoad %1035 %1054 +%10649 = OpIEqual %1057 %10648 %1072 +OpSelectionMerge %10651 None +OpBranchConditional %10649 %10650 %10651 +%10650 = OpLabel +%10652 = OpLoad %6 %14 +%10653 = OpLoad %6 %16 +%10654 = OpIAdd %6 %10652 %10653 +%10655 = OpLoad %6 %17 +%10656 = OpISub %6 %10654 %10655 +%10657 = OpLoad %6 %18 +%10658 = OpIAdd %6 %10656 %10657 +%10659 = OpLoad %6 %20 +%10660 = OpIAdd %6 %10658 %10659 +%10661 = OpLoad %6 %22 +%10662 = OpIAdd %6 %10660 %10661 +OpStore %805 %10662 +OpBranch %10651 +%10651 = OpLabel +%10663 = OpLoad %1035 %1054 +%10664 = OpUGreaterThanEqual %1057 %10663 %1138 +OpSelectionMerge %10666 None +OpBranchConditional %10664 %10665 %10666 +%10665 = OpLabel +%10667 = OpLoad %6 %14 +%10668 = OpLoad %6 %16 +%10669 = OpIAdd %6 %10667 %10668 +%10670 = OpLoad %6 %17 +%10671 = OpIAdd %6 %10669 %10670 +%10672 = OpLoad %6 %18 +%10673 = OpIAdd %6 %10671 %10672 +%10674 = OpLoad %6 %21 +%10675 = OpISub %6 %10673 %10674 +%10676 = OpLoad %6 %22 +%10677 = OpIAdd %6 %10675 %10676 +OpStore %806 %10677 +OpBranch %10666 +%10666 = OpLabel +%10678 = OpLoad %1035 %1054 +%10679 = OpIEqual %1057 %10678 %1138 +OpSelectionMerge %10681 None +OpBranchConditional %10679 %10680 %10681 +%10680 = OpLabel +%10682 = OpLoad %6 %14 +%10683 = OpLoad %6 %16 +%10684 = OpIAdd %6 %10682 %10683 +%10685 = OpLoad %6 %17 +%10686 = OpISub %6 %10684 %10685 +%10687 = OpLoad %6 %19 +%10688 = OpISub %6 %10686 %10687 +%10689 = OpLoad %6 %20 +%10690 = OpISub %6 %10688 %10689 +%10691 = OpLoad %6 %21 +%10692 = OpISub %6 %10690 %10691 +OpStore %807 %10692 +OpBranch %10681 +%10681 = OpLabel +%10693 = OpLoad %1035 %1054 +%10694 = OpULessThan %1057 %10693 %1094 +OpSelectionMerge %10696 None +OpBranchConditional %10694 %10695 %10696 +%10695 = OpLabel +%10697 = OpLoad %6 %14 +%10698 = OpLoad %6 %16 +%10699 = OpISub %6 %10697 %10698 +%10700 = OpLoad %6 %17 +%10701 = OpISub %6 %10699 %10700 +%10702 = OpLoad %6 %19 +%10703 = OpISub %6 %10701 %10702 +%10704 = OpLoad %6 %20 +%10705 = OpISub %6 %10703 %10704 +%10706 = OpLoad %6 %22 +%10707 = OpISub %6 %10705 %10706 +OpStore %808 %10707 +OpBranch %10696 +%10696 = OpLabel +%10708 = OpLoad %1035 %1054 +%10709 = OpULessThan %1057 %10708 %1056 +OpSelectionMerge %10711 None +OpBranchConditional %10709 %10710 %10711 +%10710 = OpLabel +%10712 = OpLoad %6 %14 +%10713 = OpLoad %6 %16 +%10714 = OpIAdd %6 %10712 %10713 +%10715 = OpLoad %6 %17 +%10716 = OpIAdd %6 %10714 %10715 +%10717 = OpLoad %6 %19 +%10718 = OpIAdd %6 %10716 %10717 +%10719 = OpLoad %6 %21 +%10720 = OpISub %6 %10718 %10719 +%10721 = OpLoad %6 %22 +%10722 = OpISub %6 %10720 %10721 +OpStore %809 %10722 +OpBranch %10711 +%10711 = OpLabel +%10723 = OpLoad %1035 %1054 +%10724 = OpUGreaterThan %1057 %10723 %1056 +OpSelectionMerge %10726 None +OpBranchConditional %10724 %10725 %10726 +%10725 = OpLabel +%10727 = OpLoad %6 %14 +%10728 = OpLoad %6 %16 +%10729 = OpISub %6 %10727 %10728 +%10730 = OpLoad %6 %17 +%10731 = OpIAdd %6 %10729 %10730 +%10732 = OpLoad %6 %20 +%10733 = OpIAdd %6 %10731 %10732 +%10734 = OpLoad %6 %21 +%10735 = OpIAdd %6 %10733 %10734 +%10736 = OpLoad %6 %22 +%10737 = OpISub %6 %10735 %10736 +OpStore %810 %10737 +OpBranch %10726 +%10726 = OpLabel +%10738 = OpLoad %1035 %1054 +%10739 = OpIEqual %1057 %10738 %1094 +OpSelectionMerge %10741 None +OpBranchConditional %10739 %10740 %10741 +%10740 = OpLabel +%10742 = OpLoad %6 %14 +%10743 = OpLoad %6 %16 +%10744 = OpISub %6 %10742 %10743 +%10745 = OpLoad %6 %18 +%10746 = OpIAdd %6 %10744 %10745 +%10747 = OpLoad %6 %19 +%10748 = OpIAdd %6 %10746 %10747 +%10749 = OpLoad %6 %20 +%10750 = OpISub %6 %10748 %10749 +%10751 = OpLoad %6 %21 +%10752 = OpISub %6 %10750 %10751 +OpStore %811 %10752 +OpBranch %10741 +%10741 = OpLabel +%10753 = OpLoad %1035 %1054 +%10754 = OpULessThanEqual %1057 %10753 %1094 +OpSelectionMerge %10756 None +OpBranchConditional %10754 %10755 %10756 +%10755 = OpLabel +%10757 = OpLoad %6 %14 +%10758 = OpLoad %6 %16 +%10759 = OpIAdd %6 %10757 %10758 +%10760 = OpLoad %6 %18 +%10761 = OpIAdd %6 %10759 %10760 +%10762 = OpLoad %6 %19 +%10763 = OpIAdd %6 %10761 %10762 +%10764 = OpLoad %6 %20 +%10765 = OpIAdd %6 %10763 %10764 +%10766 = OpLoad %6 %22 +%10767 = OpISub %6 %10765 %10766 +OpStore %812 %10767 +OpBranch %10756 +%10756 = OpLabel +%10768 = OpLoad %1035 %1054 +%10769 = OpIEqual %1057 %10768 %1056 +OpSelectionMerge %10771 None +OpBranchConditional %10769 %10770 %10771 +%10770 = OpLabel +%10772 = OpLoad %6 %13 +%10773 = OpLoad %6 %22 +%10774 = OpISub %6 %10772 %10773 +OpStore %813 %10774 +OpBranch %10771 +%10771 = OpLabel +%10775 = OpLoad %1035 %1054 +%10776 = OpUGreaterThanEqual %1057 %10775 %1056 +OpSelectionMerge %10778 None +OpBranchConditional %10776 %10777 %10778 +%10777 = OpLabel +%10779 = OpLoad %6 %13 +%10780 = OpLoad %6 %21 +%10781 = OpIAdd %6 %10779 %10780 +%10782 = OpLoad %6 %22 +%10783 = OpIAdd %6 %10781 %10782 +OpStore %814 %10783 +OpBranch %10778 +%10778 = OpLabel +%10784 = OpLoad %1035 %1054 +%10785 = OpUGreaterThanEqual %1057 %10784 %1072 +OpSelectionMerge %10787 None +OpBranchConditional %10785 %10786 %10787 +%10786 = OpLabel +%10788 = OpLoad %6 %14 +%10789 = OpLoad %6 %16 +%10790 = OpIAdd %6 %10788 %10789 +%10791 = OpLoad %6 %18 +%10792 = OpIAdd %6 %10790 %10791 +%10793 = OpLoad %6 %19 +%10794 = OpISub %6 %10792 %10793 +%10795 = OpLoad %6 %21 +%10796 = OpIAdd %6 %10794 %10795 +%10797 = OpLoad %6 %22 +%10798 = OpISub %6 %10796 %10797 +OpStore %815 %10798 +OpBranch %10787 +%10787 = OpLabel +%10799 = OpLoad %1035 %1054 +%10800 = OpIEqual %1057 %10799 %1056 +OpSelectionMerge %10802 None +OpBranchConditional %10800 %10801 %10802 +%10801 = OpLabel +%10803 = OpLoad %6 %14 +%10804 = OpLoad %6 %16 +%10805 = OpIAdd %6 %10803 %10804 +%10806 = OpLoad %6 %18 +%10807 = OpISub %6 %10805 %10806 +%10808 = OpLoad %6 %20 +%10809 = OpIAdd %6 %10807 %10808 +%10810 = OpLoad %6 %21 +%10811 = OpIAdd %6 %10809 %10810 +%10812 = OpLoad %6 %22 +%10813 = OpIAdd %6 %10811 %10812 +OpStore %816 %10813 +OpBranch %10802 +%10802 = OpLabel +%10814 = OpLoad %1035 %1054 +%10815 = OpIEqual %1057 %10814 %1094 +OpSelectionMerge %10817 None +OpBranchConditional %10815 %10816 %10817 +%10816 = OpLabel +%10818 = OpLoad %6 %14 +%10819 = OpLoad %6 %16 +%10820 = OpIAdd %6 %10818 %10819 +%10821 = OpLoad %6 %19 +%10822 = OpISub %6 %10820 %10821 +%10823 = OpLoad %6 %20 +%10824 = OpIAdd %6 %10822 %10823 +%10825 = OpLoad %6 %21 +%10826 = OpIAdd %6 %10824 %10825 +%10827 = OpLoad %6 %22 +%10828 = OpIAdd %6 %10826 %10827 +OpStore %817 %10828 +OpBranch %10817 +%10817 = OpLabel +%10829 = OpLoad %1035 %1054 +%10830 = OpINotEqual %1057 %10829 %1094 +OpSelectionMerge %10832 None +OpBranchConditional %10830 %10831 %10832 +%10831 = OpLabel +%10833 = OpLoad %6 %14 +%10834 = OpLoad %6 %17 +%10835 = OpISub %6 %10833 %10834 +%10836 = OpLoad %6 %18 +%10837 = OpIAdd %6 %10835 %10836 +%10838 = OpLoad %6 %19 +%10839 = OpISub %6 %10837 %10838 +%10840 = OpLoad %6 %20 +%10841 = OpIAdd %6 %10839 %10840 +%10842 = OpLoad %6 %21 +%10843 = OpIAdd %6 %10841 %10842 +OpStore %818 %10843 +OpBranch %10832 +%10832 = OpLabel +%10844 = OpLoad %1035 %1054 +%10845 = OpUGreaterThanEqual %1057 %10844 %1072 +OpSelectionMerge %10847 None +OpBranchConditional %10845 %10846 %10847 +%10846 = OpLabel +%10848 = OpLoad %6 %14 +%10849 = OpLoad %6 %17 +%10850 = OpISub %6 %10848 %10849 +%10851 = OpLoad %6 %18 +%10852 = OpISub %6 %10850 %10851 +%10853 = OpLoad %6 %19 +%10854 = OpISub %6 %10852 %10853 +%10855 = OpLoad %6 %20 +%10856 = OpISub %6 %10854 %10855 +%10857 = OpLoad %6 %22 +%10858 = OpIAdd %6 %10856 %10857 +OpStore %819 %10858 +OpBranch %10847 +%10847 = OpLabel +%10859 = OpLoad %1035 %1054 +%10860 = OpINotEqual %1057 %10859 %1072 +OpSelectionMerge %10862 None +OpBranchConditional %10860 %10861 %10862 +%10861 = OpLabel +%10863 = OpLoad %6 %14 +%10864 = OpLoad %6 %17 +%10865 = OpIAdd %6 %10863 %10864 +%10866 = OpLoad %6 %18 +%10867 = OpISub %6 %10865 %10866 +%10868 = OpLoad %6 %19 +%10869 = OpISub %6 %10867 %10868 +%10870 = OpLoad %6 %21 +%10871 = OpISub %6 %10869 %10870 +%10872 = OpLoad %6 %22 +%10873 = OpIAdd %6 %10871 %10872 +OpStore %820 %10873 +OpBranch %10862 +%10862 = OpLabel +%10874 = OpLoad %1035 %1054 +%10875 = OpULessThan %1057 %10874 %1056 +OpSelectionMerge %10877 None +OpBranchConditional %10875 %10876 %10877 +%10876 = OpLabel +%10878 = OpLoad %6 %14 +%10879 = OpLoad %6 %17 +%10880 = OpIAdd %6 %10878 %10879 +%10881 = OpLoad %6 %18 +%10882 = OpIAdd %6 %10880 %10881 +%10883 = OpLoad %6 %20 +%10884 = OpISub %6 %10882 %10883 +%10885 = OpLoad %6 %21 +%10886 = OpISub %6 %10884 %10885 +%10887 = OpLoad %6 %22 +%10888 = OpIAdd %6 %10886 %10887 +OpStore %821 %10888 +OpBranch %10877 +%10877 = OpLabel +%10889 = OpLoad %1035 %1054 +%10890 = OpINotEqual %1057 %10889 %1094 +OpSelectionMerge %10892 None +OpBranchConditional %10890 %10891 %10892 +%10891 = OpLabel +%10893 = OpLoad %6 %14 +%10894 = OpLoad %6 %17 +%10895 = OpISub %6 %10893 %10894 +%10896 = OpLoad %6 %19 +%10897 = OpIAdd %6 %10895 %10896 +%10898 = OpLoad %6 %20 +%10899 = OpISub %6 %10897 %10898 +%10900 = OpLoad %6 %21 +%10901 = OpIAdd %6 %10899 %10900 +%10902 = OpLoad %6 %22 +%10903 = OpIAdd %6 %10901 %10902 +OpStore %822 %10903 +OpBranch %10892 +%10892 = OpLabel +%10904 = OpLoad %1035 %1054 +%10905 = OpULessThanEqual %1057 %10904 %1072 +OpSelectionMerge %10907 None +OpBranchConditional %10905 %10906 %10907 +%10906 = OpLabel +%10908 = OpLoad %6 %14 +%10909 = OpLoad %6 %18 +%10910 = OpISub %6 %10908 %10909 +%10911 = OpLoad %6 %19 +%10912 = OpIAdd %6 %10910 %10911 +%10913 = OpLoad %6 %20 +%10914 = OpIAdd %6 %10912 %10913 +%10915 = OpLoad %6 %21 +%10916 = OpIAdd %6 %10914 %10915 +%10917 = OpLoad %6 %22 +%10918 = OpIAdd %6 %10916 %10917 +OpStore %823 %10918 +OpBranch %10907 +%10907 = OpLabel +%10919 = OpLoad %1035 %1054 +%10920 = OpINotEqual %1057 %10919 %1072 +OpSelectionMerge %10922 None +OpBranchConditional %10920 %10921 %10922 +%10921 = OpLabel +%10923 = OpLoad %6 %15 +%10924 = OpLoad %6 %16 +%10925 = OpISub %6 %10923 %10924 +%10926 = OpLoad %6 %17 +%10927 = OpIAdd %6 %10925 %10926 +%10928 = OpLoad %6 %18 +%10929 = OpIAdd %6 %10927 %10928 +%10930 = OpLoad %6 %19 +%10931 = OpISub %6 %10929 %10930 +%10932 = OpLoad %6 %20 +%10933 = OpIAdd %6 %10931 %10932 +OpStore %824 %10933 +OpBranch %10922 +%10922 = OpLabel +%10934 = OpLoad %1035 %1054 +%10935 = OpULessThanEqual %1057 %10934 %1056 +OpSelectionMerge %10937 None +OpBranchConditional %10935 %10936 %10937 +%10936 = OpLabel +%10938 = OpLoad %6 %14 +%10939 = OpLoad %6 %15 +%10940 = OpIAdd %6 %10938 %10939 +%10941 = OpLoad %6 %16 +%10942 = OpIAdd %6 %10940 %10941 +OpStore %825 %10942 +OpBranch %10937 +%10937 = OpLabel +%10943 = OpLoad %1035 %1054 +%10944 = OpINotEqual %1057 %10943 %1094 +OpSelectionMerge %10946 None +OpBranchConditional %10944 %10945 %10946 +%10945 = OpLabel +%10947 = OpLoad %6 %15 +%10948 = OpLoad %6 %16 +%10949 = OpIAdd %6 %10947 %10948 +%10950 = OpLoad %6 %17 +%10951 = OpIAdd %6 %10949 %10950 +%10952 = OpLoad %6 %18 +%10953 = OpISub %6 %10951 %10952 +%10954 = OpLoad %6 %19 +%10955 = OpISub %6 %10953 %10954 +%10956 = OpLoad %6 %21 +%10957 = OpISub %6 %10955 %10956 +OpStore %826 %10957 +OpBranch %10946 +%10946 = OpLabel +%10958 = OpLoad %1035 %1054 +%10959 = OpUGreaterThanEqual %1057 %10958 %1094 +OpSelectionMerge %10961 None +OpBranchConditional %10959 %10960 %10961 +%10960 = OpLabel +%10962 = OpLoad %6 %15 +%10963 = OpLoad %6 %16 +%10964 = OpIAdd %6 %10962 %10963 +%10965 = OpLoad %6 %17 +%10966 = OpISub %6 %10964 %10965 +%10967 = OpLoad %6 %18 +%10968 = OpIAdd %6 %10966 %10967 +%10969 = OpLoad %6 %19 +%10970 = OpISub %6 %10968 %10969 +%10971 = OpLoad %6 %22 +%10972 = OpISub %6 %10970 %10971 +OpStore %827 %10972 +OpBranch %10961 +%10961 = OpLabel +%10973 = OpLoad %1035 %1054 +%10974 = OpINotEqual %1057 %10973 %1072 +OpSelectionMerge %10976 None +OpBranchConditional %10974 %10975 %10976 +%10975 = OpLabel +%10977 = OpLoad %6 %15 +%10978 = OpLoad %6 %16 +%10979 = OpIAdd %6 %10977 %10978 +%10980 = OpLoad %6 %17 +%10981 = OpISub %6 %10979 %10980 +%10982 = OpLoad %6 %18 +%10983 = OpISub %6 %10981 %10982 +%10984 = OpLoad %6 %20 +%10985 = OpIAdd %6 %10983 %10984 +%10986 = OpLoad %6 %21 +%10987 = OpISub %6 %10985 %10986 +OpStore %828 %10987 +OpBranch %10976 +%10976 = OpLabel +%10988 = OpLoad %1035 %1054 +%10989 = OpULessThan %1057 %10988 %1072 +OpSelectionMerge %10991 None +OpBranchConditional %10989 %10990 %10991 +%10990 = OpLabel +%10992 = OpLoad %6 %15 +%10993 = OpLoad %6 %16 +%10994 = OpISub %6 %10992 %10993 +%10995 = OpLoad %6 %17 +%10996 = OpIAdd %6 %10994 %10995 +%10997 = OpLoad %6 %18 +%10998 = OpISub %6 %10996 %10997 +%10999 = OpLoad %6 %20 +%11000 = OpIAdd %6 %10998 %10999 +%11001 = OpLoad %6 %22 +%11002 = OpIAdd %6 %11000 %11001 +OpStore %829 %11002 +OpBranch %10991 +%10991 = OpLabel +%11003 = OpLoad %1035 %1054 +%11004 = OpUGreaterThanEqual %1057 %11003 %1056 +OpSelectionMerge %11006 None +OpBranchConditional %11004 %11005 %11006 +%11005 = OpLabel +%11007 = OpLoad %6 %15 +%11008 = OpLoad %6 %16 +%11009 = OpISub %6 %11007 %11008 +%11010 = OpLoad %6 %17 +%11011 = OpISub %6 %11009 %11010 +%11012 = OpLoad %6 %18 +%11013 = OpIAdd %6 %11011 %11012 +%11014 = OpLoad %6 %21 +%11015 = OpISub %6 %11013 %11014 +%11016 = OpLoad %6 %22 +%11017 = OpIAdd %6 %11015 %11016 +OpStore %830 %11017 +OpBranch %11006 +%11006 = OpLabel +%11018 = OpLoad %1035 %1054 +%11019 = OpINotEqual %1057 %11018 %1072 +OpSelectionMerge %11021 None +OpBranchConditional %11019 %11020 %11021 +%11020 = OpLabel +%11022 = OpLoad %6 %15 +%11023 = OpLoad %6 %16 +%11024 = OpIAdd %6 %11022 %11023 +%11025 = OpLoad %6 %17 +%11026 = OpIAdd %6 %11024 %11025 +%11027 = OpLoad %6 %19 +%11028 = OpIAdd %6 %11026 %11027 +%11029 = OpLoad %6 %20 +%11030 = OpIAdd %6 %11028 %11029 +%11031 = OpLoad %6 %21 +%11032 = OpIAdd %6 %11030 %11031 +OpStore %831 %11032 +OpBranch %11021 +%11021 = OpLabel +%11033 = OpLoad %1035 %1054 +%11034 = OpUGreaterThanEqual %1057 %11033 %1094 +OpSelectionMerge %11036 None +OpBranchConditional %11034 %11035 %11036 +%11035 = OpLabel +%11037 = OpLoad %6 %15 +%11038 = OpLoad %6 %16 +%11039 = OpIAdd %6 %11037 %11038 +%11040 = OpLoad %6 %17 +%11041 = OpISub %6 %11039 %11040 +%11042 = OpLoad %6 %19 +%11043 = OpIAdd %6 %11041 %11042 +%11044 = OpLoad %6 %20 +%11045 = OpIAdd %6 %11043 %11044 +%11046 = OpLoad %6 %22 +%11047 = OpIAdd %6 %11045 %11046 +OpStore %832 %11047 +OpBranch %11036 +%11036 = OpLabel +%11048 = OpLoad %1035 %1054 +%11049 = OpUGreaterThanEqual %1057 %11048 %1072 +OpSelectionMerge %11051 None +OpBranchConditional %11049 %11050 %11051 +%11050 = OpLabel +%11052 = OpLoad %6 %15 +%11053 = OpLoad %6 %16 +%11054 = OpISub %6 %11052 %11053 +%11055 = OpLoad %6 %17 +%11056 = OpIAdd %6 %11054 %11055 +%11057 = OpLoad %6 %19 +%11058 = OpISub %6 %11056 %11057 +%11059 = OpLoad %6 %21 +%11060 = OpISub %6 %11058 %11059 +%11061 = OpLoad %6 %22 +%11062 = OpISub %6 %11060 %11061 +OpStore %833 %11062 +OpBranch %11051 +%11051 = OpLabel +%11063 = OpLoad %1035 %1054 +%11064 = OpULessThan %1057 %11063 %1056 +OpSelectionMerge %11066 None +OpBranchConditional %11064 %11065 %11066 +%11065 = OpLabel +%11067 = OpLoad %6 %15 +%11068 = OpLoad %6 %16 +%11069 = OpIAdd %6 %11067 %11068 +%11070 = OpLoad %6 %17 +%11071 = OpIAdd %6 %11069 %11070 +%11072 = OpLoad %6 %20 +%11073 = OpIAdd %6 %11071 %11072 +%11074 = OpLoad %6 %21 +%11075 = OpISub %6 %11073 %11074 +%11076 = OpLoad %6 %22 +%11077 = OpIAdd %6 %11075 %11076 +OpStore %834 %11077 +OpBranch %11066 +%11066 = OpLabel +%11078 = OpLoad %1035 %1054 +%11079 = OpULessThan %1057 %11078 %1056 +OpSelectionMerge %11081 None +OpBranchConditional %11079 %11080 %11081 +%11080 = OpLabel +%11082 = OpLoad %6 %15 +%11083 = OpLoad %6 %16 +%11084 = OpIAdd %6 %11082 %11083 +%11085 = OpLoad %6 %18 +%11086 = OpISub %6 %11084 %11085 +%11087 = OpLoad %6 %19 +%11088 = OpIAdd %6 %11086 %11087 +%11089 = OpLoad %6 %20 +%11090 = OpIAdd %6 %11088 %11089 +%11091 = OpLoad %6 %21 +%11092 = OpISub %6 %11090 %11091 +OpStore %835 %11092 +OpBranch %11081 +%11081 = OpLabel +%11093 = OpLoad %1035 %1054 +%11094 = OpULessThan %1057 %11093 %1072 +OpSelectionMerge %11096 None +OpBranchConditional %11094 %11095 %11096 +%11095 = OpLabel +%11097 = OpLoad %6 %14 +%11098 = OpLoad %6 %15 +%11099 = OpISub %6 %11097 %11098 +%11100 = OpLoad %6 %17 +%11101 = OpIAdd %6 %11099 %11100 +OpStore %836 %11101 +OpBranch %11096 +%11096 = OpLabel +%11102 = OpLoad %1035 %1054 +%11103 = OpULessThan %1057 %11102 %1094 +OpSelectionMerge %11105 None +OpBranchConditional %11103 %11104 %11105 +%11104 = OpLabel +%11106 = OpLoad %6 %15 +%11107 = OpLoad %6 %16 +%11108 = OpISub %6 %11106 %11107 +%11109 = OpLoad %6 %18 +%11110 = OpISub %6 %11108 %11109 +%11111 = OpLoad %6 %19 +%11112 = OpIAdd %6 %11110 %11111 +%11113 = OpLoad %6 %20 +%11114 = OpIAdd %6 %11112 %11113 +%11115 = OpLoad %6 %22 +%11116 = OpISub %6 %11114 %11115 +OpStore %837 %11116 +OpBranch %11105 +%11105 = OpLabel +%11117 = OpLoad %1035 %1054 +%11118 = OpULessThanEqual %1057 %11117 %1072 +OpSelectionMerge %11120 None +OpBranchConditional %11118 %11119 %11120 +%11119 = OpLabel +%11121 = OpLoad %6 %15 +%11122 = OpLoad %6 %16 +%11123 = OpIAdd %6 %11121 %11122 +%11124 = OpLoad %6 %18 +%11125 = OpISub %6 %11123 %11124 +%11126 = OpLoad %6 %19 +%11127 = OpISub %6 %11125 %11126 +%11128 = OpLoad %6 %21 +%11129 = OpISub %6 %11127 %11128 +%11130 = OpLoad %6 %22 +%11131 = OpISub %6 %11129 %11130 +OpStore %838 %11131 +OpBranch %11120 +%11120 = OpLabel +%11132 = OpLoad %1035 %1054 +%11133 = OpINotEqual %1057 %11132 %1056 +OpSelectionMerge %11135 None +OpBranchConditional %11133 %11134 %11135 +%11134 = OpLabel +%11136 = OpLoad %6 %15 +%11137 = OpLoad %6 %16 +%11138 = OpISub %6 %11136 %11137 +%11139 = OpLoad %6 %18 +%11140 = OpIAdd %6 %11138 %11139 +%11141 = OpLoad %6 %20 +%11142 = OpISub %6 %11140 %11141 +%11143 = OpLoad %6 %21 +%11144 = OpISub %6 %11142 %11143 +%11145 = OpLoad %6 %22 +%11146 = OpISub %6 %11144 %11145 +OpStore %839 %11146 +OpBranch %11135 +%11135 = OpLabel +%11147 = OpLoad %1035 %1054 +%11148 = OpULessThanEqual %1057 %11147 %1072 +OpSelectionMerge %11150 None +OpBranchConditional %11148 %11149 %11150 +%11149 = OpLabel +%11151 = OpLoad %6 %15 +%11152 = OpLoad %6 %16 +%11153 = OpISub %6 %11151 %11152 +%11154 = OpLoad %6 %19 +%11155 = OpIAdd %6 %11153 %11154 +%11156 = OpLoad %6 %20 +%11157 = OpISub %6 %11155 %11156 +%11158 = OpLoad %6 %21 +%11159 = OpIAdd %6 %11157 %11158 +%11160 = OpLoad %6 %22 +%11161 = OpIAdd %6 %11159 %11160 +OpStore %840 %11161 +OpBranch %11150 +%11150 = OpLabel +%11162 = OpLoad %1035 %1054 +%11163 = OpULessThanEqual %1057 %11162 %1056 +OpSelectionMerge %11165 None +OpBranchConditional %11163 %11164 %11165 +%11164 = OpLabel +%11166 = OpLoad %6 %15 +%11167 = OpLoad %6 %17 +%11168 = OpIAdd %6 %11166 %11167 +%11169 = OpLoad %6 %18 +%11170 = OpISub %6 %11168 %11169 +%11171 = OpLoad %6 %19 +%11172 = OpIAdd %6 %11170 %11171 +%11173 = OpLoad %6 %20 +%11174 = OpISub %6 %11172 %11173 +%11175 = OpLoad %6 %21 +%11176 = OpISub %6 %11174 %11175 +OpStore %841 %11176 +OpBranch %11165 +%11165 = OpLabel +%11177 = OpLoad %1035 %1054 +%11178 = OpULessThan %1057 %11177 %1138 +OpSelectionMerge %11180 None +OpBranchConditional %11178 %11179 %11180 +%11179 = OpLabel +%11181 = OpLoad %6 %15 +%11182 = OpLoad %6 %17 +%11183 = OpIAdd %6 %11181 %11182 +%11184 = OpLoad %6 %18 +%11185 = OpIAdd %6 %11183 %11184 +%11186 = OpLoad %6 %19 +%11187 = OpISub %6 %11185 %11186 +%11188 = OpLoad %6 %20 +%11189 = OpIAdd %6 %11187 %11188 +%11190 = OpLoad %6 %22 +%11191 = OpISub %6 %11189 %11190 +OpStore %842 %11191 +OpBranch %11180 +%11180 = OpLabel +%11192 = OpLoad %1035 %1054 +%11193 = OpINotEqual %1057 %11192 %1094 +OpSelectionMerge %11195 None +OpBranchConditional %11193 %11194 %11195 +%11194 = OpLabel +%11196 = OpLoad %6 %15 +%11197 = OpLoad %6 %17 +%11198 = OpISub %6 %11196 %11197 +%11199 = OpLoad %6 %18 +%11200 = OpIAdd %6 %11198 %11199 +%11201 = OpLoad %6 %19 +%11202 = OpIAdd %6 %11200 %11201 +%11203 = OpLoad %6 %21 +%11204 = OpISub %6 %11202 %11203 +%11205 = OpLoad %6 %22 +%11206 = OpISub %6 %11204 %11205 +OpStore %843 %11206 +OpBranch %11195 +%11195 = OpLabel +%11207 = OpLoad %1035 %1054 +%11208 = OpUGreaterThan %1057 %11207 %1072 +OpSelectionMerge %11210 None +OpBranchConditional %11208 %11209 %11210 +%11209 = OpLabel +%11211 = OpLoad %6 %15 +%11212 = OpLoad %6 %17 +%11213 = OpIAdd %6 %11211 %11212 +%11214 = OpLoad %6 %18 +%11215 = OpISub %6 %11213 %11214 +%11216 = OpLoad %6 %20 +%11217 = OpIAdd %6 %11215 %11216 +%11218 = OpLoad %6 %21 +%11219 = OpIAdd %6 %11217 %11218 +%11220 = OpLoad %6 %22 +%11221 = OpISub %6 %11219 %11220 +OpStore %844 %11221 +OpBranch %11210 +%11210 = OpLabel +%11222 = OpLoad %1035 %1054 +%11223 = OpUGreaterThan %1057 %11222 %1056 +OpSelectionMerge %11225 None +OpBranchConditional %11223 %11224 %11225 +%11224 = OpLabel +%11226 = OpLoad %6 %15 +%11227 = OpLoad %6 %17 +%11228 = OpIAdd %6 %11226 %11227 +%11229 = OpLoad %6 %19 +%11230 = OpIAdd %6 %11228 %11229 +%11231 = OpLoad %6 %20 +%11232 = OpISub %6 %11230 %11231 +%11233 = OpLoad %6 %21 +%11234 = OpISub %6 %11232 %11233 +%11235 = OpLoad %6 %22 +%11236 = OpIAdd %6 %11234 %11235 +OpStore %845 %11236 +OpBranch %11225 +%11225 = OpLabel +%11237 = OpLoad %1035 %1054 +%11238 = OpULessThan %1057 %11237 %1072 +OpSelectionMerge %11240 None +OpBranchConditional %11238 %11239 %11240 +%11239 = OpLabel +%11241 = OpLoad %6 %15 +%11242 = OpLoad %6 %18 +%11243 = OpIAdd %6 %11241 %11242 +%11244 = OpLoad %6 %19 +%11245 = OpISub %6 %11243 %11244 +%11246 = OpLoad %6 %20 +%11247 = OpIAdd %6 %11245 %11246 +%11248 = OpLoad %6 %21 +%11249 = OpISub %6 %11247 %11248 +%11250 = OpLoad %6 %22 +%11251 = OpISub %6 %11249 %11250 +OpStore %846 %11251 +OpBranch %11240 +%11240 = OpLabel +%11252 = OpLoad %1035 %1054 +%11253 = OpULessThan %1057 %11252 %1072 +OpSelectionMerge %11255 None +OpBranchConditional %11253 %11254 %11255 +%11254 = OpLabel +%11256 = OpLoad %6 %14 +%11257 = OpLoad %6 %15 +%11258 = OpISub %6 %11256 %11257 +%11259 = OpLoad %6 %18 +%11260 = OpIAdd %6 %11258 %11259 +OpStore %847 %11260 +OpBranch %11255 +%11255 = OpLabel +%11261 = OpLoad %1035 %1054 +%11262 = OpUGreaterThan %1057 %11261 %1094 +OpSelectionMerge %11264 None +OpBranchConditional %11262 %11263 %11264 +%11263 = OpLabel +%11265 = OpLoad %6 %16 +%11266 = OpLoad %6 %17 +%11267 = OpISub %6 %11265 %11266 +%11268 = OpLoad %6 %18 +%11269 = OpISub %6 %11267 %11268 +%11270 = OpLoad %6 %19 +%11271 = OpISub %6 %11269 %11270 +%11272 = OpLoad %6 %20 +%11273 = OpIAdd %6 %11271 %11272 +%11274 = OpLoad %6 %21 +%11275 = OpIAdd %6 %11273 %11274 +OpStore %848 %11275 +OpBranch %11264 +%11264 = OpLabel +%11276 = OpLoad %1035 %1054 +%11277 = OpUGreaterThanEqual %1057 %11276 %1094 +OpSelectionMerge %11279 None +OpBranchConditional %11277 %11278 %11279 +%11278 = OpLabel +%11280 = OpLoad %6 %16 +%11281 = OpLoad %6 %17 +%11282 = OpISub %6 %11280 %11281 +%11283 = OpLoad %6 %18 +%11284 = OpISub %6 %11282 %11283 +%11285 = OpLoad %6 %19 +%11286 = OpISub %6 %11284 %11285 +%11287 = OpLoad %6 %20 +%11288 = OpISub %6 %11286 %11287 +%11289 = OpLoad %6 %22 +%11290 = OpIAdd %6 %11288 %11289 +OpStore %849 %11290 +OpBranch %11279 +%11279 = OpLabel +%11291 = OpLoad %1035 %1054 +%11292 = OpIEqual %1057 %11291 %1094 +OpSelectionMerge %11294 None +OpBranchConditional %11292 %11293 %11294 +%11293 = OpLabel +%11295 = OpLoad %6 %16 +%11296 = OpLoad %6 %17 +%11297 = OpISub %6 %11295 %11296 +%11298 = OpLoad %6 %18 +%11299 = OpISub %6 %11297 %11298 +%11300 = OpLoad %6 %19 +%11301 = OpISub %6 %11299 %11300 +%11302 = OpLoad %6 %21 +%11303 = OpIAdd %6 %11301 %11302 +%11304 = OpLoad %6 %22 +%11305 = OpIAdd %6 %11303 %11304 +OpStore %850 %11305 +OpBranch %11294 +%11294 = OpLabel +%11306 = OpLoad %1035 %1054 +%11307 = OpULessThanEqual %1057 %11306 %1072 +OpSelectionMerge %11309 None +OpBranchConditional %11307 %11308 %11309 +%11308 = OpLabel +%11310 = OpLoad %6 %16 +%11311 = OpLoad %6 %17 +%11312 = OpISub %6 %11310 %11311 +%11313 = OpLoad %6 %18 +%11314 = OpISub %6 %11312 %11313 +%11315 = OpLoad %6 %20 +%11316 = OpIAdd %6 %11314 %11315 +%11317 = OpLoad %6 %21 +%11318 = OpISub %6 %11316 %11317 +%11319 = OpLoad %6 %22 +%11320 = OpIAdd %6 %11318 %11319 +OpStore %851 %11320 +OpBranch %11309 +%11309 = OpLabel +%11321 = OpLoad %1035 %1054 +%11322 = OpULessThanEqual %1057 %11321 %1056 +OpSelectionMerge %11324 None +OpBranchConditional %11322 %11323 %11324 +%11323 = OpLabel +%11325 = OpLoad %6 %16 +%11326 = OpLoad %6 %17 +%11327 = OpIAdd %6 %11325 %11326 +%11328 = OpLoad %6 %19 +%11329 = OpISub %6 %11327 %11328 +%11330 = OpLoad %6 %20 +%11331 = OpISub %6 %11329 %11330 +%11332 = OpLoad %6 %21 +%11333 = OpISub %6 %11331 %11332 +%11334 = OpLoad %6 %22 +%11335 = OpIAdd %6 %11333 %11334 +OpStore %852 %11335 +OpBranch %11324 +%11324 = OpLabel +%11336 = OpLoad %1035 %1054 +%11337 = OpULessThanEqual %1057 %11336 %1138 +OpSelectionMerge %11339 None +OpBranchConditional %11337 %11338 %11339 +%11338 = OpLabel +%11340 = OpLoad %6 %16 +%11341 = OpLoad %6 %18 +%11342 = OpIAdd %6 %11340 %11341 +%11343 = OpLoad %6 %19 +%11344 = OpISub %6 %11342 %11343 +%11345 = OpLoad %6 %20 +%11346 = OpISub %6 %11344 %11345 +%11347 = OpLoad %6 %21 +%11348 = OpIAdd %6 %11346 %11347 +%11349 = OpLoad %6 %22 +%11350 = OpISub %6 %11348 %11349 +OpStore %853 %11350 +OpBranch %11339 +%11339 = OpLabel +%11351 = OpLoad %1035 %1054 +%11352 = OpULessThan %1057 %11351 %1094 +OpSelectionMerge %11354 None +OpBranchConditional %11352 %11353 %11354 +%11353 = OpLabel +%11355 = OpLoad %6 %17 +%11356 = OpLoad %6 %18 +%11357 = OpIAdd %6 %11355 %11356 +%11358 = OpLoad %6 %19 +%11359 = OpISub %6 %11357 %11358 +%11360 = OpLoad %6 %20 +%11361 = OpIAdd %6 %11359 %11360 +%11362 = OpLoad %6 %21 +%11363 = OpISub %6 %11361 %11362 +%11364 = OpLoad %6 %22 +%11365 = OpIAdd %6 %11363 %11364 +OpStore %854 %11365 +OpBranch %11354 +%11354 = OpLabel +%11366 = OpLoad %1035 %1054 +%11367 = OpULessThanEqual %1057 %11366 %1056 +OpSelectionMerge %11369 None +OpBranchConditional %11367 %11368 %11369 +%11368 = OpLabel +%11370 = OpLoad %6 %13 +%11371 = OpLoad %6 %14 +%11372 = OpIAdd %6 %11370 %11371 +%11373 = OpLoad %6 %15 +%11374 = OpISub %6 %11372 %11373 +%11375 = OpLoad %6 %16 +%11376 = OpIAdd %6 %11374 %11375 +%11377 = OpLoad %6 %17 +%11378 = OpIAdd %6 %11376 %11377 +%11379 = OpLoad %6 %18 +%11380 = OpIAdd %6 %11378 %11379 +%11381 = OpLoad %6 %19 +%11382 = OpIAdd %6 %11380 %11381 +OpStore %855 %11382 +OpBranch %11369 +%11369 = OpLabel +%11383 = OpLoad %1035 %1054 +%11384 = OpIEqual %1057 %11383 %1094 +OpSelectionMerge %11386 None +OpBranchConditional %11384 %11385 %11386 +%11385 = OpLabel +%11387 = OpLoad %6 %13 +%11388 = OpLoad %6 %14 +%11389 = OpISub %6 %11387 %11388 +%11390 = OpLoad %6 %15 +%11391 = OpISub %6 %11389 %11390 +%11392 = OpLoad %6 %16 +%11393 = OpIAdd %6 %11391 %11392 +%11394 = OpLoad %6 %17 +%11395 = OpIAdd %6 %11393 %11394 +%11396 = OpLoad %6 %18 +%11397 = OpISub %6 %11395 %11396 +%11398 = OpLoad %6 %20 +%11399 = OpISub %6 %11397 %11398 +OpStore %856 %11399 +OpBranch %11386 +%11386 = OpLabel +%11400 = OpLoad %1035 %1054 +%11401 = OpIEqual %1057 %11400 %1056 +OpSelectionMerge %11403 None +OpBranchConditional %11401 %11402 %11403 +%11402 = OpLabel +%11404 = OpLoad %6 %13 +%11405 = OpLoad %6 %14 +%11406 = OpISub %6 %11404 %11405 +%11407 = OpLoad %6 %15 +%11408 = OpISub %6 %11406 %11407 +%11409 = OpLoad %6 %16 +%11410 = OpIAdd %6 %11408 %11409 +%11411 = OpLoad %6 %17 +%11412 = OpISub %6 %11410 %11411 +%11413 = OpLoad %6 %18 +%11414 = OpIAdd %6 %11412 %11413 +%11415 = OpLoad %6 %21 +%11416 = OpISub %6 %11414 %11415 +OpStore %857 %11416 +OpBranch %11403 +%11403 = OpLabel +%11417 = OpLoad %1035 %1054 +%11418 = OpULessThanEqual %1057 %11417 %1056 +OpSelectionMerge %11420 None +OpBranchConditional %11418 %11419 %11420 +%11419 = OpLabel +%11421 = OpLoad %6 %14 +%11422 = OpLoad %6 %15 +%11423 = OpISub %6 %11421 %11422 +%11424 = OpLoad %6 %19 +%11425 = OpIAdd %6 %11423 %11424 +OpStore %858 %11425 +OpBranch %11420 +%11420 = OpLabel +%11426 = OpLoad %1035 %1054 +%11427 = OpUGreaterThan %1057 %11426 %1056 +OpSelectionMerge %11429 None +OpBranchConditional %11427 %11428 %11429 +%11428 = OpLabel +%11430 = OpLoad %6 %13 +%11431 = OpLoad %6 %14 +%11432 = OpISub %6 %11430 %11431 +%11433 = OpLoad %6 %15 +%11434 = OpISub %6 %11432 %11433 +%11435 = OpLoad %6 %16 +%11436 = OpIAdd %6 %11434 %11435 +%11437 = OpLoad %6 %17 +%11438 = OpIAdd %6 %11436 %11437 +%11439 = OpLoad %6 %18 +%11440 = OpIAdd %6 %11438 %11439 +%11441 = OpLoad %6 %22 +%11442 = OpIAdd %6 %11440 %11441 +OpStore %859 %11442 +OpBranch %11429 +%11429 = OpLabel +%11443 = OpLoad %1035 %1054 +%11444 = OpULessThan %1057 %11443 %1138 +OpSelectionMerge %11446 None +OpBranchConditional %11444 %11445 %11446 +%11445 = OpLabel +%11447 = OpLoad %6 %13 +%11448 = OpLoad %6 %14 +%11449 = OpIAdd %6 %11447 %11448 +%11450 = OpLoad %6 %15 +%11451 = OpIAdd %6 %11449 %11450 +%11452 = OpLoad %6 %16 +%11453 = OpISub %6 %11451 %11452 +%11454 = OpLoad %6 %17 +%11455 = OpIAdd %6 %11453 %11454 +%11456 = OpLoad %6 %19 +%11457 = OpISub %6 %11455 %11456 +%11458 = OpLoad %6 %20 +%11459 = OpISub %6 %11457 %11458 +OpStore %860 %11459 +OpBranch %11446 +%11446 = OpLabel +%11460 = OpLoad %1035 %1054 +%11461 = OpULessThanEqual %1057 %11460 %1138 +OpSelectionMerge %11463 None +OpBranchConditional %11461 %11462 %11463 +%11462 = OpLabel +%11464 = OpLoad %6 %13 +%11465 = OpLoad %6 %14 +%11466 = OpISub %6 %11464 %11465 +%11467 = OpLoad %6 %15 +%11468 = OpIAdd %6 %11466 %11467 +%11469 = OpLoad %6 %16 +%11470 = OpISub %6 %11468 %11469 +%11471 = OpLoad %6 %17 +%11472 = OpIAdd %6 %11470 %11471 +%11473 = OpLoad %6 %19 +%11474 = OpIAdd %6 %11472 %11473 +%11475 = OpLoad %6 %21 +%11476 = OpIAdd %6 %11474 %11475 +OpStore %861 %11476 +OpBranch %11463 +%11463 = OpLabel +%11477 = OpLoad %1035 %1054 +%11478 = OpUGreaterThanEqual %1057 %11477 %1072 +OpSelectionMerge %11480 None +OpBranchConditional %11478 %11479 %11480 +%11479 = OpLabel +%11481 = OpLoad %6 %13 +%11482 = OpLoad %6 %14 +%11483 = OpIAdd %6 %11481 %11482 +%11484 = OpLoad %6 %15 +%11485 = OpIAdd %6 %11483 %11484 +%11486 = OpLoad %6 %16 +%11487 = OpIAdd %6 %11485 %11486 +%11488 = OpLoad %6 %17 +%11489 = OpISub %6 %11487 %11488 +%11490 = OpLoad %6 %19 +%11491 = OpIAdd %6 %11489 %11490 +%11492 = OpLoad %6 %22 +%11493 = OpIAdd %6 %11491 %11492 +OpStore %862 %11493 +OpBranch %11480 +%11480 = OpLabel +%11494 = OpLoad %1035 %1054 +%11495 = OpINotEqual %1057 %11494 %1072 +OpSelectionMerge %11497 None +OpBranchConditional %11495 %11496 %11497 +%11496 = OpLabel +%11498 = OpLoad %6 %13 +%11499 = OpLoad %6 %14 +%11500 = OpIAdd %6 %11498 %11499 +%11501 = OpLoad %6 %15 +%11502 = OpISub %6 %11500 %11501 +%11503 = OpLoad %6 %16 +%11504 = OpISub %6 %11502 %11503 +%11505 = OpLoad %6 %17 +%11506 = OpIAdd %6 %11504 %11505 +%11507 = OpLoad %6 %20 +%11508 = OpIAdd %6 %11506 %11507 +%11509 = OpLoad %6 %21 +%11510 = OpISub %6 %11508 %11509 +OpStore %863 %11510 +OpBranch %11497 +%11497 = OpLabel +%11511 = OpLoad %1035 %1054 +%11512 = OpUGreaterThan %1057 %11511 %1138 +OpSelectionMerge %11514 None +OpBranchConditional %11512 %11513 %11514 +%11513 = OpLabel +%11515 = OpLoad %6 %13 +%11516 = OpLoad %6 %14 +%11517 = OpIAdd %6 %11515 %11516 +%11518 = OpLoad %6 %15 +%11519 = OpISub %6 %11517 %11518 +%11520 = OpLoad %6 %16 +%11521 = OpIAdd %6 %11519 %11520 +%11522 = OpLoad %6 %17 +%11523 = OpISub %6 %11521 %11522 +%11524 = OpLoad %6 %20 +%11525 = OpISub %6 %11523 %11524 +%11526 = OpLoad %6 %22 +%11527 = OpISub %6 %11525 %11526 +OpStore %864 %11527 +OpBranch %11514 +%11514 = OpLabel +%11528 = OpLoad %1035 %1054 +%11529 = OpULessThan %1057 %11528 %1094 +OpSelectionMerge %11531 None +OpBranchConditional %11529 %11530 %11531 +%11530 = OpLabel +%11532 = OpLoad %6 %13 +%11533 = OpLoad %6 %14 +%11534 = OpIAdd %6 %11532 %11533 +%11535 = OpLoad %6 %15 +%11536 = OpIAdd %6 %11534 %11535 +%11537 = OpLoad %6 %16 +%11538 = OpISub %6 %11536 %11537 +%11539 = OpLoad %6 %17 +%11540 = OpIAdd %6 %11538 %11539 +%11541 = OpLoad %6 %21 +%11542 = OpISub %6 %11540 %11541 +%11543 = OpLoad %6 %22 +%11544 = OpISub %6 %11542 %11543 +OpStore %865 %11544 +OpBranch %11531 +%11531 = OpLabel +%11545 = OpLoad %1035 %1054 +%11546 = OpULessThan %1057 %11545 %1056 +OpSelectionMerge %11548 None +OpBranchConditional %11546 %11547 %11548 +%11547 = OpLabel +%11549 = OpLoad %6 %13 +%11550 = OpLoad %6 %14 +%11551 = OpIAdd %6 %11549 %11550 +%11552 = OpLoad %6 %15 +%11553 = OpIAdd %6 %11551 %11552 +%11554 = OpLoad %6 %16 +%11555 = OpIAdd %6 %11553 %11554 +%11556 = OpLoad %6 %18 +%11557 = OpIAdd %6 %11555 %11556 +%11558 = OpLoad %6 %19 +%11559 = OpIAdd %6 %11557 %11558 +%11560 = OpLoad %6 %20 +%11561 = OpISub %6 %11559 %11560 +OpStore %866 %11561 +OpBranch %11548 +%11548 = OpLabel +%11562 = OpLoad %1035 %1054 +%11563 = OpIEqual %1057 %11562 %1072 +OpSelectionMerge %11565 None +OpBranchConditional %11563 %11564 %11565 +%11564 = OpLabel +%11566 = OpLoad %6 %13 +%11567 = OpLoad %6 %14 +%11568 = OpIAdd %6 %11566 %11567 +%11569 = OpLoad %6 %15 +%11570 = OpIAdd %6 %11568 %11569 +%11571 = OpLoad %6 %16 +%11572 = OpIAdd %6 %11570 %11571 +%11573 = OpLoad %6 %18 +%11574 = OpISub %6 %11572 %11573 +%11575 = OpLoad %6 %19 +%11576 = OpIAdd %6 %11574 %11575 +%11577 = OpLoad %6 %21 +%11578 = OpISub %6 %11576 %11577 +OpStore %867 %11578 +OpBranch %11565 +%11565 = OpLabel +%11579 = OpLoad %1035 %1054 +%11580 = OpIEqual %1057 %11579 %1138 +OpSelectionMerge %11582 None +OpBranchConditional %11580 %11581 %11582 +%11581 = OpLabel +%11583 = OpLoad %6 %13 +%11584 = OpLoad %6 %14 +%11585 = OpISub %6 %11583 %11584 +%11586 = OpLoad %6 %15 +%11587 = OpIAdd %6 %11585 %11586 +%11588 = OpLoad %6 %16 +%11589 = OpISub %6 %11587 %11588 +%11590 = OpLoad %6 %18 +%11591 = OpISub %6 %11589 %11590 +%11592 = OpLoad %6 %19 +%11593 = OpISub %6 %11591 %11592 +%11594 = OpLoad %6 %22 +%11595 = OpISub %6 %11593 %11594 +OpStore %868 %11595 +OpBranch %11582 +%11582 = OpLabel +%11596 = OpLoad %1035 %1054 +%11597 = OpINotEqual %1057 %11596 %1072 +OpSelectionMerge %11599 None +OpBranchConditional %11597 %11598 %11599 +%11598 = OpLabel +%11600 = OpLoad %6 %14 +%11601 = OpLoad %6 %15 +%11602 = OpISub %6 %11600 %11601 +%11603 = OpLoad %6 %20 +%11604 = OpISub %6 %11602 %11603 +OpStore %869 %11604 +OpBranch %11599 +%11599 = OpLabel +%11605 = OpLoad %1035 %1054 +%11606 = OpULessThanEqual %1057 %11605 %1056 +OpSelectionMerge %11608 None +OpBranchConditional %11606 %11607 %11608 +%11607 = OpLabel +%11609 = OpLoad %6 %13 +%11610 = OpLoad %6 %14 +%11611 = OpIAdd %6 %11609 %11610 +%11612 = OpLoad %6 %15 +%11613 = OpIAdd %6 %11611 %11612 +%11614 = OpLoad %6 %16 +%11615 = OpISub %6 %11613 %11614 +%11616 = OpLoad %6 %18 +%11617 = OpIAdd %6 %11615 %11616 +%11618 = OpLoad %6 %20 +%11619 = OpIAdd %6 %11617 %11618 +%11620 = OpLoad %6 %21 +%11621 = OpISub %6 %11619 %11620 +OpStore %870 %11621 +OpBranch %11608 +%11608 = OpLabel +%11622 = OpLoad %1035 %1054 +%11623 = OpULessThanEqual %1057 %11622 %1056 +OpSelectionMerge %11625 None +OpBranchConditional %11623 %11624 %11625 +%11624 = OpLabel +%11626 = OpLoad %6 %13 +%11627 = OpLoad %6 %14 +%11628 = OpISub %6 %11626 %11627 +%11629 = OpLoad %6 %15 +%11630 = OpIAdd %6 %11628 %11629 +%11631 = OpLoad %6 %16 +%11632 = OpISub %6 %11630 %11631 +%11633 = OpLoad %6 %18 +%11634 = OpISub %6 %11632 %11633 +%11635 = OpLoad %6 %20 +%11636 = OpIAdd %6 %11634 %11635 +%11637 = OpLoad %6 %22 +%11638 = OpISub %6 %11636 %11637 +OpStore %871 %11638 +OpBranch %11625 +%11625 = OpLabel +%11639 = OpLoad %1035 %1054 +%11640 = OpUGreaterThanEqual %1057 %11639 %1138 +OpSelectionMerge %11642 None +OpBranchConditional %11640 %11641 %11642 +%11641 = OpLabel +%11643 = OpLoad %6 %13 +%11644 = OpLoad %6 %14 +%11645 = OpISub %6 %11643 %11644 +%11646 = OpLoad %6 %15 +%11647 = OpISub %6 %11645 %11646 +%11648 = OpLoad %6 %16 +%11649 = OpIAdd %6 %11647 %11648 +%11650 = OpLoad %6 %18 +%11651 = OpISub %6 %11649 %11650 +%11652 = OpLoad %6 %21 +%11653 = OpIAdd %6 %11651 %11652 +%11654 = OpLoad %6 %22 +%11655 = OpIAdd %6 %11653 %11654 +OpStore %872 %11655 +OpBranch %11642 +%11642 = OpLabel +%11656 = OpLoad %1035 %1054 +%11657 = OpULessThanEqual %1057 %11656 %1094 +OpSelectionMerge %11659 None +OpBranchConditional %11657 %11658 %11659 +%11658 = OpLabel +%11660 = OpLoad %6 %13 +%11661 = OpLoad %6 %14 +%11662 = OpISub %6 %11660 %11661 +%11663 = OpLoad %6 %15 +%11664 = OpIAdd %6 %11662 %11663 +%11665 = OpLoad %6 %16 +%11666 = OpISub %6 %11664 %11665 +%11667 = OpLoad %6 %19 +%11668 = OpISub %6 %11666 %11667 +%11669 = OpLoad %6 %20 +%11670 = OpISub %6 %11668 %11669 +%11671 = OpLoad %6 %21 +%11672 = OpIAdd %6 %11670 %11671 +OpStore %873 %11672 +OpBranch %11659 +%11659 = OpLabel +%11673 = OpLoad %1035 %1054 +%11674 = OpINotEqual %1057 %11673 %1056 +OpSelectionMerge %11676 None +OpBranchConditional %11674 %11675 %11676 +%11675 = OpLabel +%11677 = OpLoad %6 %13 +%11678 = OpLoad %6 %14 +%11679 = OpIAdd %6 %11677 %11678 +%11680 = OpLoad %6 %15 +%11681 = OpISub %6 %11679 %11680 +%11682 = OpLoad %6 %16 +%11683 = OpISub %6 %11681 %11682 +%11684 = OpLoad %6 %19 +%11685 = OpISub %6 %11683 %11684 +%11686 = OpLoad %6 %20 +%11687 = OpIAdd %6 %11685 %11686 +%11688 = OpLoad %6 %22 +%11689 = OpIAdd %6 %11687 %11688 +OpStore %874 %11689 +OpBranch %11676 +%11676 = OpLabel +%11690 = OpLoad %1035 %1054 +%11691 = OpIEqual %1057 %11690 %1138 +OpSelectionMerge %11693 None +OpBranchConditional %11691 %11692 %11693 +%11692 = OpLabel +%11694 = OpLoad %6 %13 +%11695 = OpLoad %6 %14 +%11696 = OpIAdd %6 %11694 %11695 +%11697 = OpLoad %6 %15 +%11698 = OpISub %6 %11696 %11697 +%11699 = OpLoad %6 %16 +%11700 = OpISub %6 %11698 %11699 +%11701 = OpLoad %6 %19 +%11702 = OpIAdd %6 %11700 %11701 +%11703 = OpLoad %6 %21 +%11704 = OpIAdd %6 %11702 %11703 +%11705 = OpLoad %6 %22 +%11706 = OpISub %6 %11704 %11705 +OpStore %875 %11706 +OpBranch %11693 +%11693 = OpLabel +%11707 = OpLoad %1035 %1054 +%11708 = OpIEqual %1057 %11707 %1072 +OpSelectionMerge %11710 None +OpBranchConditional %11708 %11709 %11710 +%11709 = OpLabel +%11711 = OpLoad %6 %13 +%11712 = OpLoad %6 %14 +%11713 = OpISub %6 %11711 %11712 +%11714 = OpLoad %6 %15 +%11715 = OpIAdd %6 %11713 %11714 +%11716 = OpLoad %6 %16 +%11717 = OpIAdd %6 %11715 %11716 +%11718 = OpLoad %6 %20 +%11719 = OpIAdd %6 %11717 %11718 +%11720 = OpLoad %6 %21 +%11721 = OpISub %6 %11719 %11720 +%11722 = OpLoad %6 %22 +%11723 = OpIAdd %6 %11721 %11722 +OpStore %876 %11723 +OpBranch %11710 +%11710 = OpLabel +%11724 = OpLoad %1035 %1054 +%11725 = OpULessThan %1057 %11724 %1072 +OpSelectionMerge %11727 None +OpBranchConditional %11725 %11726 %11727 +%11726 = OpLabel +%11728 = OpLoad %6 %13 +%11729 = OpLoad %6 %14 +%11730 = OpISub %6 %11728 %11729 +%11731 = OpLoad %6 %15 +%11732 = OpIAdd %6 %11730 %11731 +%11733 = OpLoad %6 %17 +%11734 = OpISub %6 %11732 %11733 +%11735 = OpLoad %6 %18 +%11736 = OpIAdd %6 %11734 %11735 +%11737 = OpLoad %6 %19 +%11738 = OpIAdd %6 %11736 %11737 +%11739 = OpLoad %6 %20 +%11740 = OpISub %6 %11738 %11739 +OpStore %877 %11740 +OpBranch %11727 +%11727 = OpLabel +%11741 = OpLoad %1035 %1054 +%11742 = OpULessThanEqual %1057 %11741 %1094 +OpSelectionMerge %11744 None +OpBranchConditional %11742 %11743 %11744 +%11743 = OpLabel +%11745 = OpLoad %6 %13 +%11746 = OpLoad %6 %14 +%11747 = OpIAdd %6 %11745 %11746 +%11748 = OpLoad %6 %15 +%11749 = OpISub %6 %11747 %11748 +%11750 = OpLoad %6 %17 +%11751 = OpISub %6 %11749 %11750 +%11752 = OpLoad %6 %18 +%11753 = OpISub %6 %11751 %11752 +%11754 = OpLoad %6 %19 +%11755 = OpIAdd %6 %11753 %11754 +%11756 = OpLoad %6 %21 +%11757 = OpISub %6 %11755 %11756 +OpStore %878 %11757 +OpBranch %11744 +%11744 = OpLabel +%11758 = OpLoad %1035 %1054 +%11759 = OpULessThanEqual %1057 %11758 %1138 +OpSelectionMerge %11761 None +OpBranchConditional %11759 %11760 %11761 +%11760 = OpLabel +%11762 = OpLoad %6 %13 +%11763 = OpLoad %6 %14 +%11764 = OpISub %6 %11762 %11763 +%11765 = OpLoad %6 %15 +%11766 = OpIAdd %6 %11764 %11765 +%11767 = OpLoad %6 %17 +%11768 = OpISub %6 %11766 %11767 +%11769 = OpLoad %6 %18 +%11770 = OpIAdd %6 %11768 %11769 +%11771 = OpLoad %6 %19 +%11772 = OpIAdd %6 %11770 %11771 +%11773 = OpLoad %6 %22 +%11774 = OpISub %6 %11772 %11773 +OpStore %879 %11774 +OpBranch %11761 +%11761 = OpLabel +%11775 = OpLoad %1035 %1054 +%11776 = OpULessThanEqual %1057 %11775 %1056 +OpSelectionMerge %11778 None +OpBranchConditional %11776 %11777 %11778 +%11777 = OpLabel +%11779 = OpLoad %6 %14 +%11780 = OpLoad %6 %15 +%11781 = OpISub %6 %11779 %11780 +%11782 = OpLoad %6 %21 +%11783 = OpISub %6 %11781 %11782 +OpStore %880 %11783 +OpBranch %11778 +%11778 = OpLabel +%11784 = OpLoad %1035 %1054 +%11785 = OpUGreaterThanEqual %1057 %11784 %1072 +OpSelectionMerge %11787 None +OpBranchConditional %11785 %11786 %11787 +%11786 = OpLabel +%11788 = OpLoad %6 %13 +%11789 = OpLoad %6 %14 +%11790 = OpIAdd %6 %11788 %11789 +%11791 = OpLoad %6 %15 +%11792 = OpISub %6 %11790 %11791 +%11793 = OpLoad %6 %17 +%11794 = OpISub %6 %11792 %11793 +%11795 = OpLoad %6 %18 +%11796 = OpIAdd %6 %11794 %11795 +%11797 = OpLoad %6 %20 +%11798 = OpISub %6 %11796 %11797 +%11799 = OpLoad %6 %21 +%11800 = OpISub %6 %11798 %11799 +OpStore %881 %11800 +OpBranch %11787 +%11787 = OpLabel +%11801 = OpLoad %1035 %1054 +%11802 = OpIEqual %1057 %11801 %1072 +OpSelectionMerge %11804 None +OpBranchConditional %11802 %11803 %11804 +%11803 = OpLabel +%11805 = OpLoad %6 %13 +%11806 = OpLoad %6 %14 +%11807 = OpISub %6 %11805 %11806 +%11808 = OpLoad %6 %15 +%11809 = OpISub %6 %11807 %11808 +%11810 = OpLoad %6 %17 +%11811 = OpISub %6 %11809 %11810 +%11812 = OpLoad %6 %18 +%11813 = OpISub %6 %11811 %11812 +%11814 = OpLoad %6 %20 +%11815 = OpISub %6 %11813 %11814 +%11816 = OpLoad %6 %22 +%11817 = OpISub %6 %11815 %11816 +OpStore %882 %11817 +OpBranch %11804 +%11804 = OpLabel +%11818 = OpLoad %1035 %1054 +%11819 = OpIEqual %1057 %11818 %1072 +OpSelectionMerge %11821 None +OpBranchConditional %11819 %11820 %11821 +%11820 = OpLabel +%11822 = OpLoad %6 %13 +%11823 = OpLoad %6 %14 +%11824 = OpIAdd %6 %11822 %11823 +%11825 = OpLoad %6 %15 +%11826 = OpIAdd %6 %11824 %11825 +%11827 = OpLoad %6 %17 +%11828 = OpISub %6 %11826 %11827 +%11829 = OpLoad %6 %18 +%11830 = OpISub %6 %11828 %11829 +%11831 = OpLoad %6 %21 +%11832 = OpIAdd %6 %11830 %11831 +%11833 = OpLoad %6 %22 +%11834 = OpISub %6 %11832 %11833 +OpStore %883 %11834 +OpBranch %11821 +%11821 = OpLabel +%11835 = OpLoad %1035 %1054 +%11836 = OpINotEqual %1057 %11835 %1094 +OpSelectionMerge %11838 None +OpBranchConditional %11836 %11837 %11838 +%11837 = OpLabel +%11839 = OpLoad %6 %13 +%11840 = OpLoad %6 %14 +%11841 = OpISub %6 %11839 %11840 +%11842 = OpLoad %6 %15 +%11843 = OpISub %6 %11841 %11842 +%11844 = OpLoad %6 %17 +%11845 = OpISub %6 %11843 %11844 +%11846 = OpLoad %6 %19 +%11847 = OpIAdd %6 %11845 %11846 +%11848 = OpLoad %6 %20 +%11849 = OpISub %6 %11847 %11848 +%11850 = OpLoad %6 %21 +%11851 = OpIAdd %6 %11849 %11850 +OpStore %884 %11851 +OpBranch %11838 +%11838 = OpLabel +%11852 = OpLoad %1035 %1054 +%11853 = OpINotEqual %1057 %11852 %1072 +OpSelectionMerge %11855 None +OpBranchConditional %11853 %11854 %11855 +%11854 = OpLabel +%11856 = OpLoad %6 %13 +%11857 = OpLoad %6 %14 +%11858 = OpIAdd %6 %11856 %11857 +%11859 = OpLoad %6 %15 +%11860 = OpISub %6 %11858 %11859 +%11861 = OpLoad %6 %17 +%11862 = OpISub %6 %11860 %11861 +%11863 = OpLoad %6 %19 +%11864 = OpIAdd %6 %11862 %11863 +%11865 = OpLoad %6 %20 +%11866 = OpISub %6 %11864 %11865 +%11867 = OpLoad %6 %22 +%11868 = OpIAdd %6 %11866 %11867 +OpStore %885 %11868 +OpBranch %11855 +%11855 = OpLabel +%11869 = OpLoad %1035 %1054 +%11870 = OpULessThan %1057 %11869 %1138 +OpSelectionMerge %11872 None +OpBranchConditional %11870 %11871 %11872 +%11871 = OpLabel +%11873 = OpLoad %6 %13 +%11874 = OpLoad %6 %14 +%11875 = OpISub %6 %11873 %11874 +%11876 = OpLoad %6 %15 +%11877 = OpIAdd %6 %11875 %11876 +%11878 = OpLoad %6 %17 +%11879 = OpIAdd %6 %11877 %11878 +%11880 = OpLoad %6 %19 +%11881 = OpIAdd %6 %11879 %11880 +%11882 = OpLoad %6 %21 +%11883 = OpIAdd %6 %11881 %11882 +%11884 = OpLoad %6 %22 +%11885 = OpISub %6 %11883 %11884 +OpStore %886 %11885 +OpBranch %11872 +%11872 = OpLabel +%11886 = OpLoad %1035 %1054 +%11887 = OpULessThan %1057 %11886 %1138 +OpSelectionMerge %11889 None +OpBranchConditional %11887 %11888 %11889 +%11888 = OpLabel +%11890 = OpLoad %6 %13 +%11891 = OpLoad %6 %14 +%11892 = OpIAdd %6 %11890 %11891 +%11893 = OpLoad %6 %15 +%11894 = OpIAdd %6 %11892 %11893 +%11895 = OpLoad %6 %17 +%11896 = OpIAdd %6 %11894 %11895 +%11897 = OpLoad %6 %20 +%11898 = OpISub %6 %11896 %11897 +%11899 = OpLoad %6 %21 +%11900 = OpIAdd %6 %11898 %11899 +%11901 = OpLoad %6 %22 +%11902 = OpIAdd %6 %11900 %11901 +OpStore %887 %11902 +OpBranch %11889 +%11889 = OpLabel +%11903 = OpLoad %1035 %1054 +%11904 = OpULessThan %1057 %11903 %1138 +OpSelectionMerge %11906 None +OpBranchConditional %11904 %11905 %11906 +%11905 = OpLabel +%11907 = OpLoad %6 %13 +%11908 = OpLoad %6 %14 +%11909 = OpIAdd %6 %11907 %11908 +%11910 = OpLoad %6 %15 +%11911 = OpISub %6 %11909 %11910 +%11912 = OpLoad %6 %18 +%11913 = OpIAdd %6 %11911 %11912 +%11914 = OpLoad %6 %19 +%11915 = OpISub %6 %11913 %11914 +%11916 = OpLoad %6 %20 +%11917 = OpIAdd %6 %11915 %11916 +%11918 = OpLoad %6 %21 +%11919 = OpIAdd %6 %11917 %11918 +OpStore %888 %11919 +OpBranch %11906 +%11906 = OpLabel +%11920 = OpLoad %1035 %1054 +%11921 = OpINotEqual %1057 %11920 %1094 +OpSelectionMerge %11923 None +OpBranchConditional %11921 %11922 %11923 +%11922 = OpLabel +%11924 = OpLoad %6 %13 +%11925 = OpLoad %6 %14 +%11926 = OpISub %6 %11924 %11925 +%11927 = OpLoad %6 %15 +%11928 = OpIAdd %6 %11926 %11927 +%11929 = OpLoad %6 %18 +%11930 = OpIAdd %6 %11928 %11929 +%11931 = OpLoad %6 %19 +%11932 = OpISub %6 %11930 %11931 +%11933 = OpLoad %6 %20 +%11934 = OpIAdd %6 %11932 %11933 +%11935 = OpLoad %6 %22 +%11936 = OpIAdd %6 %11934 %11935 +OpStore %889 %11936 +OpBranch %11923 +%11923 = OpLabel +%11937 = OpLoad %1035 %1054 +%11938 = OpULessThanEqual %1057 %11937 %1094 +OpSelectionMerge %11940 None +OpBranchConditional %11938 %11939 %11940 +%11939 = OpLabel +%11941 = OpLoad %6 %13 +%11942 = OpLoad %6 %14 +%11943 = OpISub %6 %11941 %11942 +%11944 = OpLoad %6 %15 +%11945 = OpIAdd %6 %11943 %11944 +%11946 = OpLoad %6 %18 +%11947 = OpISub %6 %11945 %11946 +%11948 = OpLoad %6 %19 +%11949 = OpIAdd %6 %11947 %11948 +%11950 = OpLoad %6 %21 +%11951 = OpISub %6 %11949 %11950 +%11952 = OpLoad %6 %22 +%11953 = OpIAdd %6 %11951 %11952 +OpStore %890 %11953 +OpBranch %11940 +%11940 = OpLabel +%11954 = OpLoad %1035 %1054 +%11955 = OpULessThan %1057 %11954 %1072 +OpSelectionMerge %11957 None +OpBranchConditional %11955 %11956 %11957 +%11956 = OpLabel +%11958 = OpLoad %6 %14 +%11959 = OpLoad %6 %15 +%11960 = OpISub %6 %11958 %11959 +%11961 = OpLoad %6 %22 +%11962 = OpISub %6 %11960 %11961 +OpStore %891 %11962 +OpBranch %11957 +%11957 = OpLabel +%11963 = OpLoad %1035 %1054 +%11964 = OpUGreaterThanEqual %1057 %11963 %1138 +OpSelectionMerge %11966 None +OpBranchConditional %11964 %11965 %11966 +%11965 = OpLabel +%11967 = OpLoad %6 %13 +%11968 = OpLoad %6 %14 +%11969 = OpISub %6 %11967 %11968 +%11970 = OpLoad %6 %15 +%11971 = OpISub %6 %11969 %11970 +%11972 = OpLoad %6 %18 +%11973 = OpIAdd %6 %11971 %11972 +%11974 = OpLoad %6 %20 +%11975 = OpIAdd %6 %11973 %11974 +%11976 = OpLoad %6 %21 +%11977 = OpISub %6 %11975 %11976 +%11978 = OpLoad %6 %22 +%11979 = OpISub %6 %11977 %11978 +OpStore %892 %11979 +OpBranch %11966 +%11966 = OpLabel +%11980 = OpLoad %1035 %1054 +%11981 = OpULessThanEqual %1057 %11980 %1138 +OpSelectionMerge %11983 None +OpBranchConditional %11981 %11982 %11983 +%11982 = OpLabel +%11984 = OpLoad %6 %13 +%11985 = OpLoad %6 %14 +%11986 = OpIAdd %6 %11984 %11985 +%11987 = OpLoad %6 %15 +%11988 = OpIAdd %6 %11986 %11987 +%11989 = OpLoad %6 %19 +%11990 = OpISub %6 %11988 %11989 +%11991 = OpLoad %6 %20 +%11992 = OpIAdd %6 %11990 %11991 +%11993 = OpLoad %6 %21 +%11994 = OpIAdd %6 %11992 %11993 +%11995 = OpLoad %6 %22 +%11996 = OpIAdd %6 %11994 %11995 +OpStore %893 %11996 +OpBranch %11983 +%11983 = OpLabel +%11997 = OpLoad %1035 %1054 +%11998 = OpUGreaterThan %1057 %11997 %1094 +OpSelectionMerge %12000 None +OpBranchConditional %11998 %11999 %12000 +%11999 = OpLabel +%12001 = OpLoad %6 %13 +%12002 = OpLoad %6 %14 +%12003 = OpIAdd %6 %12001 %12002 +%12004 = OpLoad %6 %16 +%12005 = OpIAdd %6 %12003 %12004 +%12006 = OpLoad %6 %17 +%12007 = OpIAdd %6 %12005 %12006 +%12008 = OpLoad %6 %18 +%12009 = OpIAdd %6 %12007 %12008 +%12010 = OpLoad %6 %19 +%12011 = OpIAdd %6 %12009 %12010 +%12012 = OpLoad %6 %20 +%12013 = OpISub %6 %12011 %12012 +OpStore %894 %12013 +OpBranch %12000 +%12000 = OpLabel +%12014 = OpLoad %1035 %1054 +%12015 = OpUGreaterThanEqual %1057 %12014 %1138 +OpSelectionMerge %12017 None +OpBranchConditional %12015 %12016 %12017 +%12016 = OpLabel +%12018 = OpLoad %6 %13 +%12019 = OpLoad %6 %14 +%12020 = OpISub %6 %12018 %12019 +%12021 = OpLoad %6 %16 +%12022 = OpIAdd %6 %12020 %12021 +%12023 = OpLoad %6 %17 +%12024 = OpIAdd %6 %12022 %12023 +%12025 = OpLoad %6 %18 +%12026 = OpIAdd %6 %12024 %12025 +%12027 = OpLoad %6 %19 +%12028 = OpISub %6 %12026 %12027 +%12029 = OpLoad %6 %21 +%12030 = OpISub %6 %12028 %12029 +OpStore %895 %12030 +OpBranch %12017 +%12017 = OpLabel +%12031 = OpLoad %1035 %1054 +%12032 = OpINotEqual %1057 %12031 %1094 +OpSelectionMerge %12034 None +OpBranchConditional %12032 %12033 %12034 +%12033 = OpLabel +%12035 = OpLoad %6 %13 +%12036 = OpLoad %6 %14 +%12037 = OpIAdd %6 %12035 %12036 +%12038 = OpLoad %6 %16 +%12039 = OpIAdd %6 %12037 %12038 +%12040 = OpLoad %6 %17 +%12041 = OpISub %6 %12039 %12040 +%12042 = OpLoad %6 %18 +%12043 = OpISub %6 %12041 %12042 +%12044 = OpLoad %6 %19 +%12045 = OpIAdd %6 %12043 %12044 +%12046 = OpLoad %6 %22 +%12047 = OpISub %6 %12045 %12046 +OpStore %896 %12047 +OpBranch %12034 +%12034 = OpLabel +%12048 = OpLoad %1035 %1054 +%12049 = OpINotEqual %1057 %12048 %1056 +OpSelectionMerge %12051 None +OpBranchConditional %12049 %12050 %12051 +%12050 = OpLabel +%12052 = OpLoad %6 %13 +%12053 = OpLoad %6 %14 +%12054 = OpISub %6 %12052 %12053 +%12055 = OpLoad %6 %16 +%12056 = OpIAdd %6 %12054 %12055 +%12057 = OpLoad %6 %17 +%12058 = OpISub %6 %12056 %12057 +%12059 = OpLoad %6 %18 +%12060 = OpIAdd %6 %12058 %12059 +%12061 = OpLoad %6 %20 +%12062 = OpIAdd %6 %12060 %12061 +%12063 = OpLoad %6 %21 +%12064 = OpIAdd %6 %12062 %12063 +OpStore %897 %12064 +OpBranch %12051 +%12051 = OpLabel +%12065 = OpLoad %1035 %1054 +%12066 = OpUGreaterThan %1057 %12065 %1094 +OpSelectionMerge %12068 None +OpBranchConditional %12066 %12067 %12068 +%12067 = OpLabel +%12069 = OpLoad %6 %13 +%12070 = OpLoad %6 %14 +%12071 = OpISub %6 %12069 %12070 +%12072 = OpLoad %6 %16 +%12073 = OpIAdd %6 %12071 %12072 +%12074 = OpLoad %6 %17 +%12075 = OpISub %6 %12073 %12074 +%12076 = OpLoad %6 %18 +%12077 = OpISub %6 %12075 %12076 +%12078 = OpLoad %6 %20 +%12079 = OpIAdd %6 %12077 %12078 +%12080 = OpLoad %6 %22 +%12081 = OpISub %6 %12079 %12080 +OpStore %898 %12081 +OpBranch %12068 +%12068 = OpLabel +%12082 = OpLoad %1035 %1054 +%12083 = OpUGreaterThanEqual %1057 %12082 %1094 +OpSelectionMerge %12085 None +OpBranchConditional %12083 %12084 %12085 +%12084 = OpLabel +%12086 = OpLoad %6 %13 +%12087 = OpLoad %6 %14 +%12088 = OpISub %6 %12086 %12087 +%12089 = OpLoad %6 %16 +%12090 = OpISub %6 %12088 %12089 +%12091 = OpLoad %6 %17 +%12092 = OpISub %6 %12090 %12091 +%12093 = OpLoad %6 %18 +%12094 = OpISub %6 %12092 %12093 +%12095 = OpLoad %6 %21 +%12096 = OpIAdd %6 %12094 %12095 +%12097 = OpLoad %6 %22 +%12098 = OpISub %6 %12096 %12097 +OpStore %899 %12098 +OpBranch %12085 +%12085 = OpLabel +%12099 = OpLoad %1035 %1054 +%12100 = OpULessThan %1057 %12099 %1072 +OpSelectionMerge %12102 None +OpBranchConditional %12100 %12101 %12102 +%12101 = OpLabel +%12103 = OpLoad %6 %13 +%12104 = OpLoad %6 %14 +%12105 = OpISub %6 %12103 %12104 +%12106 = OpLoad %6 %16 +%12107 = OpIAdd %6 %12105 %12106 +%12108 = OpLoad %6 %17 +%12109 = OpISub %6 %12107 %12108 +%12110 = OpLoad %6 %19 +%12111 = OpIAdd %6 %12109 %12110 +%12112 = OpLoad %6 %20 +%12113 = OpIAdd %6 %12111 %12112 +%12114 = OpLoad %6 %21 +%12115 = OpISub %6 %12113 %12114 +OpStore %900 %12115 +OpBranch %12102 +%12102 = OpLabel +%12116 = OpLoad %1035 %1054 +%12117 = OpULessThanEqual %1057 %12116 %1072 +OpSelectionMerge %12119 None +OpBranchConditional %12117 %12118 %12119 +%12118 = OpLabel +%12120 = OpLoad %6 %13 +%12121 = OpLoad %6 %14 +%12122 = OpIAdd %6 %12120 %12121 +%12123 = OpLoad %6 %16 +%12124 = OpIAdd %6 %12122 %12123 +%12125 = OpLoad %6 %17 +%12126 = OpISub %6 %12124 %12125 +%12127 = OpLoad %6 %19 +%12128 = OpIAdd %6 %12126 %12127 +%12129 = OpLoad %6 %20 +%12130 = OpISub %6 %12128 %12129 +%12131 = OpLoad %6 %22 +%12132 = OpIAdd %6 %12130 %12131 +OpStore %901 %12132 +OpBranch %12119 +%12119 = OpLabel +%12133 = OpLoad %1035 %1054 +%12134 = OpULessThan %1057 %12133 %1138 +OpSelectionMerge %12136 None +OpBranchConditional %12134 %12135 %12136 +%12135 = OpLabel +%12137 = OpLoad %6 %14 +%12138 = OpLoad %6 %16 +%12139 = OpISub %6 %12137 %12138 +%12140 = OpLoad %6 %17 +%12141 = OpISub %6 %12139 %12140 +OpStore %902 %12141 +OpBranch %12136 +%12136 = OpLabel +%12142 = OpLoad %1035 %1054 +%12143 = OpIEqual %1057 %12142 %1094 +OpSelectionMerge %12145 None +OpBranchConditional %12143 %12144 %12145 +%12144 = OpLabel +%12146 = OpLoad %6 %13 +%12147 = OpLoad %6 %14 +%12148 = OpIAdd %6 %12146 %12147 +%12149 = OpLoad %6 %16 +%12150 = OpISub %6 %12148 %12149 +%12151 = OpLoad %6 %17 +%12152 = OpIAdd %6 %12150 %12151 +%12153 = OpLoad %6 %19 +%12154 = OpIAdd %6 %12152 %12153 +%12155 = OpLoad %6 %21 +%12156 = OpISub %6 %12154 %12155 +%12157 = OpLoad %6 %22 +%12158 = OpISub %6 %12156 %12157 +OpStore %903 %12158 +OpBranch %12145 +%12145 = OpLabel +%12159 = OpLoad %1035 %1054 +%12160 = OpIEqual %1057 %12159 %1056 +OpSelectionMerge %12162 None +OpBranchConditional %12160 %12161 %12162 +%12161 = OpLabel +%12163 = OpLoad %6 %13 +%12164 = OpLoad %6 %14 +%12165 = OpISub %6 %12163 %12164 +%12166 = OpLoad %6 %16 +%12167 = OpIAdd %6 %12165 %12166 +%12168 = OpLoad %6 %17 +%12169 = OpIAdd %6 %12167 %12168 +%12170 = OpLoad %6 %20 +%12171 = OpISub %6 %12169 %12170 +%12172 = OpLoad %6 %21 +%12173 = OpISub %6 %12171 %12172 +%12174 = OpLoad %6 %22 +%12175 = OpISub %6 %12173 %12174 +OpStore %904 %12175 +OpBranch %12162 +%12162 = OpLabel +%12176 = OpLoad %1035 %1054 +%12177 = OpUGreaterThanEqual %1057 %12176 %1056 +OpSelectionMerge %12179 None +OpBranchConditional %12177 %12178 %12179 +%12178 = OpLabel +%12180 = OpLoad %6 %13 +%12181 = OpLoad %6 %14 +%12182 = OpISub %6 %12180 %12181 +%12183 = OpLoad %6 %16 +%12184 = OpISub %6 %12182 %12183 +%12185 = OpLoad %6 %18 +%12186 = OpIAdd %6 %12184 %12185 +%12187 = OpLoad %6 %19 +%12188 = OpISub %6 %12186 %12187 +%12189 = OpLoad %6 %20 +%12190 = OpIAdd %6 %12188 %12189 +%12191 = OpLoad %6 %21 +%12192 = OpIAdd %6 %12190 %12191 +OpStore %905 %12192 +OpBranch %12179 +%12179 = OpLabel +%12193 = OpLoad %1035 %1054 +%12194 = OpINotEqual %1057 %12193 %1138 +OpSelectionMerge %12196 None +OpBranchConditional %12194 %12195 %12196 +%12195 = OpLabel +%12197 = OpLoad %6 %13 +%12198 = OpLoad %6 %14 +%12199 = OpISub %6 %12197 %12198 +%12200 = OpLoad %6 %16 +%12201 = OpISub %6 %12199 %12200 +%12202 = OpLoad %6 %18 +%12203 = OpISub %6 %12201 %12202 +%12204 = OpLoad %6 %19 +%12205 = OpIAdd %6 %12203 %12204 +%12206 = OpLoad %6 %20 +%12207 = OpISub %6 %12205 %12206 +%12208 = OpLoad %6 %22 +%12209 = OpIAdd %6 %12207 %12208 +OpStore %906 %12209 +OpBranch %12196 +%12196 = OpLabel +%12210 = OpLoad %1035 %1054 +%12211 = OpIEqual %1057 %12210 %1094 +OpSelectionMerge %12213 None +OpBranchConditional %12211 %12212 %12213 +%12212 = OpLabel +%12214 = OpLoad %6 %13 +%12215 = OpLoad %6 %14 +%12216 = OpIAdd %6 %12214 %12215 +%12217 = OpLoad %6 %16 +%12218 = OpISub %6 %12216 %12217 +%12219 = OpLoad %6 %18 +%12220 = OpIAdd %6 %12218 %12219 +%12221 = OpLoad %6 %19 +%12222 = OpISub %6 %12220 %12221 +%12223 = OpLoad %6 %21 +%12224 = OpIAdd %6 %12222 %12223 +%12225 = OpLoad %6 %22 +%12226 = OpISub %6 %12224 %12225 +OpStore %907 %12226 +OpBranch %12213 +%12213 = OpLabel +%12227 = OpLoad %1035 %1054 +%12228 = OpULessThan %1057 %12227 %1138 +OpSelectionMerge %12230 None +OpBranchConditional %12228 %12229 %12230 +%12229 = OpLabel +%12231 = OpLoad %6 %13 +%12232 = OpLoad %6 %14 +%12233 = OpIAdd %6 %12231 %12232 +%12234 = OpLoad %6 %16 +%12235 = OpISub %6 %12233 %12234 +%12236 = OpLoad %6 %18 +%12237 = OpISub %6 %12235 %12236 +%12238 = OpLoad %6 %20 +%12239 = OpIAdd %6 %12237 %12238 +%12240 = OpLoad %6 %21 +%12241 = OpIAdd %6 %12239 %12240 +%12242 = OpLoad %6 %22 +%12243 = OpIAdd %6 %12241 %12242 +OpStore %908 %12243 +OpBranch %12230 +%12230 = OpLabel +%12244 = OpLoad %1035 %1054 +%12245 = OpINotEqual %1057 %12244 %1056 +OpSelectionMerge %12247 None +OpBranchConditional %12245 %12246 %12247 +%12246 = OpLabel +%12248 = OpLoad %6 %13 +%12249 = OpLoad %6 %14 +%12250 = OpIAdd %6 %12248 %12249 +%12251 = OpLoad %6 %16 +%12252 = OpISub %6 %12250 %12251 +%12253 = OpLoad %6 %19 +%12254 = OpIAdd %6 %12252 %12253 +%12255 = OpLoad %6 %20 +%12256 = OpISub %6 %12254 %12255 +%12257 = OpLoad %6 %21 +%12258 = OpISub %6 %12256 %12257 +%12259 = OpLoad %6 %22 +%12260 = OpISub %6 %12258 %12259 +OpStore %909 %12260 +OpBranch %12247 +%12247 = OpLabel +%12261 = OpLoad %1035 %1054 +%12262 = OpUGreaterThanEqual %1057 %12261 %1072 +OpSelectionMerge %12264 None +OpBranchConditional %12262 %12263 %12264 +%12263 = OpLabel +%12265 = OpLoad %6 %13 +%12266 = OpLoad %6 %14 +%12267 = OpIAdd %6 %12265 %12266 +%12268 = OpLoad %6 %17 +%12269 = OpISub %6 %12267 %12268 +%12270 = OpLoad %6 %18 +%12271 = OpIAdd %6 %12269 %12270 +%12272 = OpLoad %6 %19 +%12273 = OpISub %6 %12271 %12272 +%12274 = OpLoad %6 %20 +%12275 = OpIAdd %6 %12273 %12274 +%12276 = OpLoad %6 %21 +%12277 = OpIAdd %6 %12275 %12276 +OpStore %910 %12277 +OpBranch %12264 +%12264 = OpLabel +%12278 = OpLoad %1035 %1054 +%12279 = OpINotEqual %1057 %12278 %1072 +OpSelectionMerge %12281 None +OpBranchConditional %12279 %12280 %12281 +%12280 = OpLabel +%12282 = OpLoad %6 %13 +%12283 = OpLoad %6 %14 +%12284 = OpIAdd %6 %12282 %12283 +%12285 = OpLoad %6 %17 +%12286 = OpIAdd %6 %12284 %12285 +%12287 = OpLoad %6 %18 +%12288 = OpISub %6 %12286 %12287 +%12289 = OpLoad %6 %19 +%12290 = OpIAdd %6 %12288 %12289 +%12291 = OpLoad %6 %20 +%12292 = OpISub %6 %12290 %12291 +%12293 = OpLoad %6 %22 +%12294 = OpIAdd %6 %12292 %12293 +OpStore %911 %12294 +OpBranch %12281 +%12281 = OpLabel +%12295 = OpLoad %1035 %1054 +%12296 = OpULessThan %1057 %12295 %1138 +OpSelectionMerge %12298 None +OpBranchConditional %12296 %12297 %12298 +%12297 = OpLabel +%12299 = OpLoad %6 %13 +%12300 = OpLoad %6 %14 +%12301 = OpISub %6 %12299 %12300 +%12302 = OpLoad %6 %17 +%12303 = OpIAdd %6 %12301 %12302 +%12304 = OpLoad %6 %18 +%12305 = OpIAdd %6 %12303 %12304 +%12306 = OpLoad %6 %19 +%12307 = OpISub %6 %12305 %12306 +%12308 = OpLoad %6 %21 +%12309 = OpIAdd %6 %12307 %12308 +%12310 = OpLoad %6 %22 +%12311 = OpIAdd %6 %12309 %12310 +OpStore %912 %12311 +OpBranch %12298 +%12298 = OpLabel +%12312 = OpLoad %1035 %1054 +%12313 = OpULessThanEqual %1057 %12312 %1094 +OpSelectionMerge %12315 None +OpBranchConditional %12313 %12314 %12315 +%12314 = OpLabel +%12316 = OpLoad %6 %14 +%12317 = OpLoad %6 %16 +%12318 = OpIAdd %6 %12316 %12317 +%12319 = OpLoad %6 %18 +%12320 = OpISub %6 %12318 %12319 +OpStore %913 %12320 +OpBranch %12315 +%12315 = OpLabel +%12321 = OpLoad %1035 %1054 +%12322 = OpIEqual %1057 %12321 %1072 +OpSelectionMerge %12324 None +OpBranchConditional %12322 %12323 %12324 +%12323 = OpLabel +%12325 = OpLoad %6 %13 +%12326 = OpLoad %6 %14 +%12327 = OpISub %6 %12325 %12326 +%12328 = OpLoad %6 %17 +%12329 = OpIAdd %6 %12327 %12328 +%12330 = OpLoad %6 %18 +%12331 = OpIAdd %6 %12329 %12330 +%12332 = OpLoad %6 %20 +%12333 = OpIAdd %6 %12331 %12332 +%12334 = OpLoad %6 %21 +%12335 = OpISub %6 %12333 %12334 +%12336 = OpLoad %6 %22 +%12337 = OpISub %6 %12335 %12336 +OpStore %914 %12337 +OpBranch %12324 +%12324 = OpLabel +%12338 = OpLoad %1035 %1054 +%12339 = OpUGreaterThanEqual %1057 %12338 %1138 +OpSelectionMerge %12341 None +OpBranchConditional %12339 %12340 %12341 +%12340 = OpLabel +%12342 = OpLoad %6 %13 +%12343 = OpLoad %6 %14 +%12344 = OpIAdd %6 %12342 %12343 +%12345 = OpLoad %6 %17 +%12346 = OpIAdd %6 %12344 %12345 +%12347 = OpLoad %6 %19 +%12348 = OpISub %6 %12346 %12347 +%12349 = OpLoad %6 %20 +%12350 = OpIAdd %6 %12348 %12349 +%12351 = OpLoad %6 %21 +%12352 = OpISub %6 %12350 %12351 +%12353 = OpLoad %6 %22 +%12354 = OpIAdd %6 %12352 %12353 +OpStore %915 %12354 +OpBranch %12341 +%12341 = OpLabel +%12355 = OpLoad %1035 %1054 +%12356 = OpULessThan %1057 %12355 %1072 +OpSelectionMerge %12358 None +OpBranchConditional %12356 %12357 %12358 +%12357 = OpLabel +%12359 = OpLoad %6 %13 +%12360 = OpLoad %6 %14 +%12361 = OpIAdd %6 %12359 %12360 +%12362 = OpLoad %6 %18 +%12363 = OpIAdd %6 %12361 %12362 +%12364 = OpLoad %6 %19 +%12365 = OpIAdd %6 %12363 %12364 +%12366 = OpLoad %6 %20 +%12367 = OpISub %6 %12365 %12366 +%12368 = OpLoad %6 %21 +%12369 = OpISub %6 %12367 %12368 +%12370 = OpLoad %6 %22 +%12371 = OpISub %6 %12369 %12370 +OpStore %916 %12371 +OpBranch %12358 +%12358 = OpLabel +%12372 = OpLoad %1035 %1054 +%12373 = OpUGreaterThan %1057 %12372 %1094 +OpSelectionMerge %12375 None +OpBranchConditional %12373 %12374 %12375 +%12374 = OpLabel +%12376 = OpLoad %6 %13 +%12377 = OpLoad %6 %15 +%12378 = OpIAdd %6 %12376 %12377 +%12379 = OpLoad %6 %16 +%12380 = OpIAdd %6 %12378 %12379 +%12381 = OpLoad %6 %17 +%12382 = OpISub %6 %12380 %12381 +%12383 = OpLoad %6 %18 +%12384 = OpISub %6 %12382 %12383 +%12385 = OpLoad %6 %19 +%12386 = OpISub %6 %12384 %12385 +%12387 = OpLoad %6 %20 +%12388 = OpISub %6 %12386 %12387 +OpStore %917 %12388 +OpBranch %12375 +%12375 = OpLabel +%12389 = OpLoad %1035 %1054 +%12390 = OpULessThanEqual %1057 %12389 %1094 +OpSelectionMerge %12392 None +OpBranchConditional %12390 %12391 %12392 +%12391 = OpLabel +%12393 = OpLoad %6 %13 +%12394 = OpLoad %6 %15 +%12395 = OpISub %6 %12393 %12394 +%12396 = OpLoad %6 %16 +%12397 = OpISub %6 %12395 %12396 +%12398 = OpLoad %6 %17 +%12399 = OpISub %6 %12397 %12398 +%12400 = OpLoad %6 %18 +%12401 = OpISub %6 %12399 %12400 +%12402 = OpLoad %6 %19 +%12403 = OpISub %6 %12401 %12402 +%12404 = OpLoad %6 %21 +%12405 = OpISub %6 %12403 %12404 +OpStore %918 %12405 +OpBranch %12392 +%12392 = OpLabel +%12406 = OpLoad %1035 %1054 +%12407 = OpUGreaterThan %1057 %12406 %1138 +OpSelectionMerge %12409 None +OpBranchConditional %12407 %12408 %12409 +%12408 = OpLabel +%12410 = OpLoad %6 %13 +%12411 = OpLoad %6 %15 +%12412 = OpISub %6 %12410 %12411 +%12413 = OpLoad %6 %16 +%12414 = OpIAdd %6 %12412 %12413 +%12415 = OpLoad %6 %17 +%12416 = OpISub %6 %12414 %12415 +%12417 = OpLoad %6 %18 +%12418 = OpIAdd %6 %12416 %12417 +%12419 = OpLoad %6 %19 +%12420 = OpISub %6 %12418 %12419 +%12421 = OpLoad %6 %22 +%12422 = OpISub %6 %12420 %12421 +OpStore %919 %12422 +OpBranch %12409 +%12409 = OpLabel +%12423 = OpLoad %1035 %1054 +%12424 = OpINotEqual %1057 %12423 %1072 +OpSelectionMerge %12426 None +OpBranchConditional %12424 %12425 %12426 +%12425 = OpLabel +%12427 = OpLoad %6 %13 +%12428 = OpLoad %6 %15 +%12429 = OpISub %6 %12427 %12428 +%12430 = OpLoad %6 %16 +%12431 = OpISub %6 %12429 %12430 +%12432 = OpLoad %6 %17 +%12433 = OpISub %6 %12431 %12432 +%12434 = OpLoad %6 %18 +%12435 = OpIAdd %6 %12433 %12434 +%12436 = OpLoad %6 %20 +%12437 = OpISub %6 %12435 %12436 +%12438 = OpLoad %6 %21 +%12439 = OpIAdd %6 %12437 %12438 +OpStore %920 %12439 +OpBranch %12426 +%12426 = OpLabel +%12440 = OpLoad %1035 %1054 +%12441 = OpULessThanEqual %1057 %12440 %1072 +OpSelectionMerge %12443 None +OpBranchConditional %12441 %12442 %12443 +%12442 = OpLabel +%12444 = OpLoad %6 %13 +%12445 = OpLoad %6 %15 +%12446 = OpISub %6 %12444 %12445 +%12447 = OpLoad %6 %16 +%12448 = OpISub %6 %12446 %12447 +%12449 = OpLoad %6 %17 +%12450 = OpISub %6 %12448 %12449 +%12451 = OpLoad %6 %18 +%12452 = OpIAdd %6 %12450 %12451 +%12453 = OpLoad %6 %20 +%12454 = OpISub %6 %12452 %12453 +%12455 = OpLoad %6 %22 +%12456 = OpIAdd %6 %12454 %12455 +OpStore %921 %12456 +OpBranch %12443 +%12443 = OpLabel +%12457 = OpLoad %1035 %1054 +%12458 = OpULessThanEqual %1057 %12457 %1094 +OpSelectionMerge %12460 None +OpBranchConditional %12458 %12459 %12460 +%12459 = OpLabel +%12461 = OpLoad %6 %13 +%12462 = OpLoad %6 %15 +%12463 = OpISub %6 %12461 %12462 +%12464 = OpLoad %6 %16 +%12465 = OpIAdd %6 %12463 %12464 +%12466 = OpLoad %6 %17 +%12467 = OpISub %6 %12465 %12466 +%12468 = OpLoad %6 %18 +%12469 = OpIAdd %6 %12467 %12468 +%12470 = OpLoad %6 %21 +%12471 = OpISub %6 %12469 %12470 +%12472 = OpLoad %6 %22 +%12473 = OpISub %6 %12471 %12472 +OpStore %922 %12473 +OpBranch %12460 +%12460 = OpLabel +%12474 = OpLoad %1035 %1054 +%12475 = OpINotEqual %1057 %12474 %1138 +OpSelectionMerge %12477 None +OpBranchConditional %12475 %12476 %12477 +%12476 = OpLabel +%12478 = OpLoad %6 %13 +%12479 = OpLoad %6 %15 +%12480 = OpIAdd %6 %12478 %12479 +%12481 = OpLoad %6 %16 +%12482 = OpISub %6 %12480 %12481 +%12483 = OpLoad %6 %17 +%12484 = OpISub %6 %12482 %12483 +%12485 = OpLoad %6 %19 +%12486 = OpIAdd %6 %12484 %12485 +%12487 = OpLoad %6 %20 +%12488 = OpIAdd %6 %12486 %12487 +%12489 = OpLoad %6 %21 +%12490 = OpIAdd %6 %12488 %12489 +OpStore %923 %12490 +OpBranch %12477 +%12477 = OpLabel +%12491 = OpLoad %1035 %1054 +%12492 = OpUGreaterThanEqual %1057 %12491 %1072 +OpSelectionMerge %12494 None +OpBranchConditional %12492 %12493 %12494 +%12493 = OpLabel +%12495 = OpLoad %6 %14 +%12496 = OpLoad %6 %15 +%12497 = OpIAdd %6 %12495 %12496 +OpStore %924 %12497 +OpBranch %12494 +%12494 = OpLabel +%12498 = OpLoad %1035 %1054 +%12499 = OpINotEqual %1057 %12498 %1094 +OpSelectionMerge %12501 None +OpBranchConditional %12499 %12500 %12501 +%12500 = OpLabel +%12502 = OpLoad %6 %14 +%12503 = OpLoad %6 %16 +%12504 = OpIAdd %6 %12502 %12503 +%12505 = OpLoad %6 %19 +%12506 = OpIAdd %6 %12504 %12505 +OpStore %925 %12506 +OpBranch %12501 +%12501 = OpLabel +%12507 = OpLoad %1035 %1054 +%12508 = OpUGreaterThan %1057 %12507 %1138 +OpSelectionMerge %12510 None +OpBranchConditional %12508 %12509 %12510 +%12509 = OpLabel +%12511 = OpLoad %6 %13 +%12512 = OpLoad %6 %15 +%12513 = OpISub %6 %12511 %12512 +%12514 = OpLoad %6 %16 +%12515 = OpISub %6 %12513 %12514 +%12516 = OpLoad %6 %17 +%12517 = OpIAdd %6 %12515 %12516 +%12518 = OpLoad %6 %19 +%12519 = OpISub %6 %12517 %12518 +%12520 = OpLoad %6 %20 +%12521 = OpIAdd %6 %12519 %12520 +%12522 = OpLoad %6 %22 +%12523 = OpISub %6 %12521 %12522 +OpStore %926 %12523 +OpBranch %12510 +%12510 = OpLabel +%12524 = OpLoad %1035 %1054 +%12525 = OpINotEqual %1057 %12524 %1072 +OpSelectionMerge %12527 None +OpBranchConditional %12525 %12526 %12527 +%12526 = OpLabel +%12528 = OpLoad %6 %13 +%12529 = OpLoad %6 %15 +%12530 = OpIAdd %6 %12528 %12529 +%12531 = OpLoad %6 %16 +%12532 = OpISub %6 %12530 %12531 +%12533 = OpLoad %6 %17 +%12534 = OpISub %6 %12532 %12533 +%12535 = OpLoad %6 %19 +%12536 = OpISub %6 %12534 %12535 +%12537 = OpLoad %6 %21 +%12538 = OpIAdd %6 %12536 %12537 +%12539 = OpLoad %6 %22 +%12540 = OpISub %6 %12538 %12539 +OpStore %927 %12540 +OpBranch %12527 +%12527 = OpLabel +%12541 = OpLoad %1035 %1054 +%12542 = OpIEqual %1057 %12541 %1094 +OpSelectionMerge %12544 None +OpBranchConditional %12542 %12543 %12544 +%12543 = OpLabel +%12545 = OpLoad %6 %13 +%12546 = OpLoad %6 %15 +%12547 = OpISub %6 %12545 %12546 +%12548 = OpLoad %6 %16 +%12549 = OpIAdd %6 %12547 %12548 +%12550 = OpLoad %6 %17 +%12551 = OpIAdd %6 %12549 %12550 +%12552 = OpLoad %6 %20 +%12553 = OpIAdd %6 %12551 %12552 +%12554 = OpLoad %6 %21 +%12555 = OpIAdd %6 %12553 %12554 +%12556 = OpLoad %6 %22 +%12557 = OpIAdd %6 %12555 %12556 +OpStore %928 %12557 +OpBranch %12544 +%12544 = OpLabel +%12558 = OpLoad %1035 %1054 +%12559 = OpULessThanEqual %1057 %12558 %1056 +OpSelectionMerge %12561 None +OpBranchConditional %12559 %12560 %12561 +%12560 = OpLabel +%12562 = OpLoad %6 %13 +%12563 = OpLoad %6 %15 +%12564 = OpIAdd %6 %12562 %12563 +%12565 = OpLoad %6 %16 +%12566 = OpISub %6 %12564 %12565 +%12567 = OpLoad %6 %18 +%12568 = OpISub %6 %12566 %12567 +%12569 = OpLoad %6 %19 +%12570 = OpISub %6 %12568 %12569 +%12571 = OpLoad %6 %20 +%12572 = OpIAdd %6 %12570 %12571 +%12573 = OpLoad %6 %21 +%12574 = OpIAdd %6 %12572 %12573 +OpStore %929 %12574 +OpBranch %12561 +%12561 = OpLabel +%12575 = OpLoad %1035 %1054 +%12576 = OpUGreaterThanEqual %1057 %12575 %1094 +OpSelectionMerge %12578 None +OpBranchConditional %12576 %12577 %12578 +%12577 = OpLabel +%12579 = OpLoad %6 %13 +%12580 = OpLoad %6 %15 +%12581 = OpISub %6 %12579 %12580 +%12582 = OpLoad %6 %16 +%12583 = OpIAdd %6 %12581 %12582 +%12584 = OpLoad %6 %18 +%12585 = OpIAdd %6 %12583 %12584 +%12586 = OpLoad %6 %19 +%12587 = OpISub %6 %12585 %12586 +%12588 = OpLoad %6 %20 +%12589 = OpIAdd %6 %12587 %12588 +%12590 = OpLoad %6 %22 +%12591 = OpIAdd %6 %12589 %12590 +OpStore %930 %12591 +OpBranch %12578 +%12578 = OpLabel +%12592 = OpLoad %1035 %1054 +%12593 = OpINotEqual %1057 %12592 %1138 +OpSelectionMerge %12595 None +OpBranchConditional %12593 %12594 %12595 +%12594 = OpLabel +%12596 = OpLoad %6 %13 +%12597 = OpLoad %6 %15 +%12598 = OpISub %6 %12596 %12597 +%12599 = OpLoad %6 %16 +%12600 = OpIAdd %6 %12598 %12599 +%12601 = OpLoad %6 %18 +%12602 = OpIAdd %6 %12600 %12601 +%12603 = OpLoad %6 %19 +%12604 = OpIAdd %6 %12602 %12603 +%12605 = OpLoad %6 %21 +%12606 = OpISub %6 %12604 %12605 +%12607 = OpLoad %6 %22 +%12608 = OpISub %6 %12606 %12607 +OpStore %931 %12608 +OpBranch %12595 +%12595 = OpLabel +%12609 = OpLoad %1035 %1054 +%12610 = OpIEqual %1057 %12609 %1094 +OpSelectionMerge %12612 None +OpBranchConditional %12610 %12611 %12612 +%12611 = OpLabel +%12613 = OpLoad %6 %13 +%12614 = OpLoad %6 %15 +%12615 = OpISub %6 %12613 %12614 +%12616 = OpLoad %6 %16 +%12617 = OpIAdd %6 %12615 %12616 +%12618 = OpLoad %6 %18 +%12619 = OpISub %6 %12617 %12618 +%12620 = OpLoad %6 %20 +%12621 = OpIAdd %6 %12619 %12620 +%12622 = OpLoad %6 %21 +%12623 = OpISub %6 %12621 %12622 +%12624 = OpLoad %6 %22 +%12625 = OpISub %6 %12623 %12624 +OpStore %932 %12625 +OpBranch %12612 +%12612 = OpLabel +%12626 = OpLoad %1035 %1054 +%12627 = OpULessThan %1057 %12626 %1138 +OpSelectionMerge %12629 None +OpBranchConditional %12627 %12628 %12629 +%12628 = OpLabel +%12630 = OpLoad %6 %13 +%12631 = OpLoad %6 %15 +%12632 = OpIAdd %6 %12630 %12631 +%12633 = OpLoad %6 %16 +%12634 = OpISub %6 %12632 %12633 +%12635 = OpLoad %6 %19 +%12636 = OpISub %6 %12634 %12635 +%12637 = OpLoad %6 %20 +%12638 = OpIAdd %6 %12636 %12637 +%12639 = OpLoad %6 %21 +%12640 = OpISub %6 %12638 %12639 +%12641 = OpLoad %6 %22 +%12642 = OpIAdd %6 %12640 %12641 +OpStore %933 %12642 +OpBranch %12629 +%12629 = OpLabel +%12643 = OpLoad %1035 %1054 +%12644 = OpUGreaterThanEqual %1057 %12643 %1094 +OpSelectionMerge %12646 None +OpBranchConditional %12644 %12645 %12646 +%12645 = OpLabel +%12647 = OpLoad %6 %13 +%12648 = OpLoad %6 %15 +%12649 = OpISub %6 %12647 %12648 +%12650 = OpLoad %6 %17 +%12651 = OpISub %6 %12649 %12650 +%12652 = OpLoad %6 %18 +%12653 = OpIAdd %6 %12651 %12652 +%12654 = OpLoad %6 %19 +%12655 = OpIAdd %6 %12653 %12654 +%12656 = OpLoad %6 %20 +%12657 = OpIAdd %6 %12655 %12656 +%12658 = OpLoad %6 %21 +%12659 = OpIAdd %6 %12657 %12658 +OpStore %934 %12659 +OpBranch %12646 +%12646 = OpLabel +%12660 = OpLoad %1035 %1054 +%12661 = OpULessThan %1057 %12660 %1072 +OpSelectionMerge %12663 None +OpBranchConditional %12661 %12662 %12663 +%12662 = OpLabel +%12664 = OpLoad %6 %13 +%12665 = OpLoad %6 %15 +%12666 = OpIAdd %6 %12664 %12665 +%12667 = OpLoad %6 %17 +%12668 = OpIAdd %6 %12666 %12667 +%12669 = OpLoad %6 %18 +%12670 = OpISub %6 %12668 %12669 +%12671 = OpLoad %6 %19 +%12672 = OpIAdd %6 %12670 %12671 +%12673 = OpLoad %6 %20 +%12674 = OpIAdd %6 %12672 %12673 +%12675 = OpLoad %6 %22 +%12676 = OpISub %6 %12674 %12675 +OpStore %935 %12676 +OpBranch %12663 +%12663 = OpLabel +%12677 = OpLoad %1035 %1054 +%12678 = OpUGreaterThan %1057 %12677 %1072 +OpSelectionMerge %12680 None +OpBranchConditional %12678 %12679 %12680 +%12679 = OpLabel +%12681 = OpLoad %6 %14 +%12682 = OpLoad %6 %16 +%12683 = OpISub %6 %12681 %12682 +%12684 = OpLoad %6 %20 +%12685 = OpIAdd %6 %12683 %12684 +OpStore %936 %12685 +OpBranch %12680 +%12680 = OpLabel +%12686 = OpLoad %1035 %1054 +%12687 = OpIEqual %1057 %12686 %1138 +OpSelectionMerge %12689 None +OpBranchConditional %12687 %12688 %12689 +%12688 = OpLabel +%12690 = OpLoad %6 %13 +%12691 = OpLoad %6 %15 +%12692 = OpISub %6 %12690 %12691 +%12693 = OpLoad %6 %17 +%12694 = OpISub %6 %12692 %12693 +%12695 = OpLoad %6 %18 +%12696 = OpISub %6 %12694 %12695 +%12697 = OpLoad %6 %19 +%12698 = OpISub %6 %12696 %12697 +%12699 = OpLoad %6 %21 +%12700 = OpISub %6 %12698 %12699 +%12701 = OpLoad %6 %22 +%12702 = OpISub %6 %12700 %12701 +OpStore %937 %12702 +OpBranch %12689 +%12689 = OpLabel +%12703 = OpLoad %1035 %1054 +%12704 = OpULessThanEqual %1057 %12703 %1072 +OpSelectionMerge %12706 None +OpBranchConditional %12704 %12705 %12706 +%12705 = OpLabel +%12707 = OpLoad %6 %13 +%12708 = OpLoad %6 %15 +%12709 = OpISub %6 %12707 %12708 +%12710 = OpLoad %6 %17 +%12711 = OpIAdd %6 %12709 %12710 +%12712 = OpLoad %6 %18 +%12713 = OpIAdd %6 %12711 %12712 +%12714 = OpLoad %6 %20 +%12715 = OpIAdd %6 %12713 %12714 +%12716 = OpLoad %6 %21 +%12717 = OpIAdd %6 %12715 %12716 +%12718 = OpLoad %6 %22 +%12719 = OpISub %6 %12717 %12718 +OpStore %938 %12719 +OpBranch %12706 +%12706 = OpLabel +%12720 = OpLoad %1035 %1054 +%12721 = OpULessThan %1057 %12720 %1056 +OpSelectionMerge %12723 None +OpBranchConditional %12721 %12722 %12723 +%12722 = OpLabel +%12724 = OpLoad %6 %13 +%12725 = OpLoad %6 %15 +%12726 = OpIAdd %6 %12724 %12725 +%12727 = OpLoad %6 %17 +%12728 = OpIAdd %6 %12726 %12727 +%12729 = OpLoad %6 %19 +%12730 = OpISub %6 %12728 %12729 +%12731 = OpLoad %6 %20 +%12732 = OpIAdd %6 %12730 %12731 +%12733 = OpLoad %6 %21 +%12734 = OpISub %6 %12732 %12733 +%12735 = OpLoad %6 %22 +%12736 = OpISub %6 %12734 %12735 +OpStore %939 %12736 +OpBranch %12723 +%12723 = OpLabel +%12737 = OpLoad %1035 %1054 +%12738 = OpINotEqual %1057 %12737 %1056 +OpSelectionMerge %12740 None +OpBranchConditional %12738 %12739 %12740 +%12739 = OpLabel +%12741 = OpLoad %6 %13 +%12742 = OpLoad %6 %15 +%12743 = OpISub %6 %12741 %12742 +%12744 = OpLoad %6 %18 +%12745 = OpISub %6 %12743 %12744 +%12746 = OpLoad %6 %19 +%12747 = OpISub %6 %12745 %12746 +%12748 = OpLoad %6 %20 +%12749 = OpISub %6 %12747 %12748 +%12750 = OpLoad %6 %21 +%12751 = OpISub %6 %12749 %12750 +%12752 = OpLoad %6 %22 +%12753 = OpIAdd %6 %12751 %12752 +OpStore %940 %12753 +OpBranch %12740 +%12740 = OpLabel +%12754 = OpLoad %1035 %1054 +%12755 = OpINotEqual %1057 %12754 %1094 +OpSelectionMerge %12757 None +OpBranchConditional %12755 %12756 %12757 +%12756 = OpLabel +%12758 = OpLoad %6 %13 +%12759 = OpLoad %6 %16 +%12760 = OpISub %6 %12758 %12759 +%12761 = OpLoad %6 %17 +%12762 = OpISub %6 %12760 %12761 +%12763 = OpLoad %6 %18 +%12764 = OpIAdd %6 %12762 %12763 +%12765 = OpLoad %6 %19 +%12766 = OpIAdd %6 %12764 %12765 +%12767 = OpLoad %6 %20 +%12768 = OpISub %6 %12766 %12767 +%12769 = OpLoad %6 %21 +%12770 = OpIAdd %6 %12768 %12769 +OpStore %941 %12770 +OpBranch %12757 +%12757 = OpLabel +%12771 = OpLoad %1035 %1054 +%12772 = OpUGreaterThan %1057 %12771 %1056 +OpSelectionMerge %12774 None +OpBranchConditional %12772 %12773 %12774 +%12773 = OpLabel +%12775 = OpLoad %6 %13 +%12776 = OpLoad %6 %16 +%12777 = OpISub %6 %12775 %12776 +%12778 = OpLoad %6 %17 +%12779 = OpISub %6 %12777 %12778 +%12780 = OpLoad %6 %18 +%12781 = OpIAdd %6 %12779 %12780 +%12782 = OpLoad %6 %19 +%12783 = OpISub %6 %12781 %12782 +%12784 = OpLoad %6 %20 +%12785 = OpISub %6 %12783 %12784 +%12786 = OpLoad %6 %22 +%12787 = OpIAdd %6 %12785 %12786 +OpStore %942 %12787 +OpBranch %12774 +%12774 = OpLabel +%12788 = OpLoad %1035 %1054 +%12789 = OpUGreaterThan %1057 %12788 %1072 +OpSelectionMerge %12791 None +OpBranchConditional %12789 %12790 %12791 +%12790 = OpLabel +%12792 = OpLoad %6 %13 +%12793 = OpLoad %6 %16 +%12794 = OpIAdd %6 %12792 %12793 +%12795 = OpLoad %6 %17 +%12796 = OpIAdd %6 %12794 %12795 +%12797 = OpLoad %6 %18 +%12798 = OpIAdd %6 %12796 %12797 +%12799 = OpLoad %6 %19 +%12800 = OpISub %6 %12798 %12799 +%12801 = OpLoad %6 %21 +%12802 = OpISub %6 %12800 %12801 +%12803 = OpLoad %6 %22 +%12804 = OpIAdd %6 %12802 %12803 +OpStore %943 %12804 +OpBranch %12791 +%12791 = OpLabel +%12805 = OpLoad %1035 %1054 +%12806 = OpULessThan %1057 %12805 %1094 +OpSelectionMerge %12808 None +OpBranchConditional %12806 %12807 %12808 +%12807 = OpLabel +%12809 = OpLoad %6 %13 +%12810 = OpLoad %6 %16 +%12811 = OpISub %6 %12809 %12810 +%12812 = OpLoad %6 %17 +%12813 = OpIAdd %6 %12811 %12812 +%12814 = OpLoad %6 %18 +%12815 = OpIAdd %6 %12813 %12814 +%12816 = OpLoad %6 %20 +%12817 = OpISub %6 %12815 %12816 +%12818 = OpLoad %6 %21 +%12819 = OpISub %6 %12817 %12818 +%12820 = OpLoad %6 %22 +%12821 = OpISub %6 %12819 %12820 +OpStore %944 %12821 +OpBranch %12808 +%12808 = OpLabel +%12822 = OpLoad %1035 %1054 +%12823 = OpULessThanEqual %1057 %12822 %1072 +OpSelectionMerge %12825 None +OpBranchConditional %12823 %12824 %12825 +%12824 = OpLabel +%12826 = OpLoad %6 %13 +%12827 = OpLoad %6 %16 +%12828 = OpISub %6 %12826 %12827 +%12829 = OpLoad %6 %17 +%12830 = OpIAdd %6 %12828 %12829 +%12831 = OpLoad %6 %19 +%12832 = OpIAdd %6 %12830 %12831 +%12833 = OpLoad %6 %20 +%12834 = OpIAdd %6 %12832 %12833 +%12835 = OpLoad %6 %21 +%12836 = OpIAdd %6 %12834 %12835 +%12837 = OpLoad %6 %22 +%12838 = OpIAdd %6 %12836 %12837 +OpStore %945 %12838 +OpBranch %12825 +%12825 = OpLabel +%12839 = OpLoad %1035 %1054 +%12840 = OpIEqual %1057 %12839 %1094 +OpSelectionMerge %12842 None +OpBranchConditional %12840 %12841 %12842 +%12841 = OpLabel +%12843 = OpLoad %6 %13 +%12844 = OpLoad %6 %16 +%12845 = OpIAdd %6 %12843 %12844 +%12846 = OpLoad %6 %18 +%12847 = OpIAdd %6 %12845 %12846 +%12848 = OpLoad %6 %19 +%12849 = OpISub %6 %12847 %12848 +%12850 = OpLoad %6 %20 +%12851 = OpISub %6 %12849 %12850 +%12852 = OpLoad %6 %21 +%12853 = OpISub %6 %12851 %12852 +%12854 = OpLoad %6 %22 +%12855 = OpIAdd %6 %12853 %12854 +OpStore %946 %12855 +OpBranch %12842 +%12842 = OpLabel +%12856 = OpLoad %1035 %1054 +%12857 = OpINotEqual %1057 %12856 %1056 +OpSelectionMerge %12859 None +OpBranchConditional %12857 %12858 %12859 +%12858 = OpLabel +%12860 = OpLoad %6 %14 +%12861 = OpLoad %6 %16 +%12862 = OpISub %6 %12860 %12861 +%12863 = OpLoad %6 %21 +%12864 = OpIAdd %6 %12862 %12863 +OpStore %947 %12864 +OpBranch %12859 +%12859 = OpLabel +%12865 = OpLoad %1035 %1054 +%12866 = OpUGreaterThan %1057 %12865 %1138 +OpSelectionMerge %12868 None +OpBranchConditional %12866 %12867 %12868 +%12867 = OpLabel +%12869 = OpLoad %6 %13 +%12870 = OpLoad %6 %17 +%12871 = OpIAdd %6 %12869 %12870 +%12872 = OpLoad %6 %18 +%12873 = OpIAdd %6 %12871 %12872 +%12874 = OpLoad %6 %19 +%12875 = OpIAdd %6 %12873 %12874 +%12876 = OpLoad %6 %20 +%12877 = OpISub %6 %12875 %12876 +%12878 = OpLoad %6 %21 +%12879 = OpIAdd %6 %12877 %12878 +%12880 = OpLoad %6 %22 +%12881 = OpISub %6 %12879 %12880 +OpStore %948 %12881 +OpBranch %12868 +%12868 = OpLabel +%12882 = OpLoad %1035 %1054 +%12883 = OpINotEqual %1057 %12882 %1056 +OpSelectionMerge %12885 None +OpBranchConditional %12883 %12884 %12885 +%12884 = OpLabel +%12886 = OpLoad %6 %14 +%12887 = OpLoad %6 %15 +%12888 = OpISub %6 %12886 %12887 +%12889 = OpLoad %6 %16 +%12890 = OpISub %6 %12888 %12889 +%12891 = OpLoad %6 %17 +%12892 = OpIAdd %6 %12890 %12891 +%12893 = OpLoad %6 %18 +%12894 = OpIAdd %6 %12892 %12893 +%12895 = OpLoad %6 %19 +%12896 = OpISub %6 %12894 %12895 +%12897 = OpLoad %6 %20 +%12898 = OpIAdd %6 %12896 %12897 +OpStore %949 %12898 +OpBranch %12885 +%12885 = OpLabel +%12899 = OpLoad %1035 %1054 +%12900 = OpULessThanEqual %1057 %12899 %1094 +OpSelectionMerge %12902 None +OpBranchConditional %12900 %12901 %12902 +%12901 = OpLabel +%12903 = OpLoad %6 %14 +%12904 = OpLoad %6 %15 +%12905 = OpISub %6 %12903 %12904 +%12906 = OpLoad %6 %16 +%12907 = OpISub %6 %12905 %12906 +%12908 = OpLoad %6 %17 +%12909 = OpIAdd %6 %12907 %12908 +%12910 = OpLoad %6 %18 +%12911 = OpISub %6 %12909 %12910 +%12912 = OpLoad %6 %19 +%12913 = OpIAdd %6 %12911 %12912 +%12914 = OpLoad %6 %21 +%12915 = OpIAdd %6 %12913 %12914 +OpStore %950 %12915 +OpBranch %12902 +%12902 = OpLabel +%12916 = OpLoad %1035 %1054 +%12917 = OpUGreaterThan %1057 %12916 %1056 +OpSelectionMerge %12919 None +OpBranchConditional %12917 %12918 %12919 +%12918 = OpLabel +%12920 = OpLoad %6 %14 +%12921 = OpLoad %6 %15 +%12922 = OpISub %6 %12920 %12921 +%12923 = OpLoad %6 %16 +%12924 = OpISub %6 %12922 %12923 +%12925 = OpLoad %6 %17 +%12926 = OpIAdd %6 %12924 %12925 +%12927 = OpLoad %6 %18 +%12928 = OpIAdd %6 %12926 %12927 +%12929 = OpLoad %6 %19 +%12930 = OpIAdd %6 %12928 %12929 +%12931 = OpLoad %6 %22 +%12932 = OpIAdd %6 %12930 %12931 +OpStore %951 %12932 +OpBranch %12919 +%12919 = OpLabel +%12933 = OpLoad %1035 %1054 +%12934 = OpUGreaterThanEqual %1057 %12933 %1072 +OpSelectionMerge %12936 None +OpBranchConditional %12934 %12935 %12936 +%12935 = OpLabel +%12937 = OpLoad %6 %14 +%12938 = OpLoad %6 %15 +%12939 = OpIAdd %6 %12937 %12938 +%12940 = OpLoad %6 %16 +%12941 = OpIAdd %6 %12939 %12940 +%12942 = OpLoad %6 %17 +%12943 = OpIAdd %6 %12941 %12942 +%12944 = OpLoad %6 %18 +%12945 = OpISub %6 %12943 %12944 +%12946 = OpLoad %6 %20 +%12947 = OpIAdd %6 %12945 %12946 +%12948 = OpLoad %6 %21 +%12949 = OpIAdd %6 %12947 %12948 +OpStore %952 %12949 +OpBranch %12936 +%12936 = OpLabel +%12950 = OpLoad %1035 %1054 +%12951 = OpULessThanEqual %1057 %12950 %1072 +OpSelectionMerge %12953 None +OpBranchConditional %12951 %12952 %12953 +%12952 = OpLabel +%12954 = OpLoad %6 %14 +%12955 = OpLoad %6 %15 +%12956 = OpISub %6 %12954 %12955 +%12957 = OpLoad %6 %16 +%12958 = OpIAdd %6 %12956 %12957 +%12959 = OpLoad %6 %17 +%12960 = OpIAdd %6 %12958 %12959 +%12961 = OpLoad %6 %18 +%12962 = OpIAdd %6 %12960 %12961 +%12963 = OpLoad %6 %20 +%12964 = OpIAdd %6 %12962 %12963 +%12965 = OpLoad %6 %22 +%12966 = OpIAdd %6 %12964 %12965 +OpStore %953 %12966 +OpBranch %12953 +%12953 = OpLabel +%12967 = OpLoad %1035 %1054 +%12968 = OpINotEqual %1057 %12967 %1056 +OpSelectionMerge %12970 None +OpBranchConditional %12968 %12969 %12970 +%12969 = OpLabel +%12971 = OpLoad %6 %14 +%12972 = OpLoad %6 %15 +%12973 = OpISub %6 %12971 %12972 +%12974 = OpLoad %6 %16 +%12975 = OpIAdd %6 %12973 %12974 +%12976 = OpLoad %6 %17 +%12977 = OpIAdd %6 %12975 %12976 +%12978 = OpLoad %6 %18 +%12979 = OpIAdd %6 %12977 %12978 +%12980 = OpLoad %6 %21 +%12981 = OpIAdd %6 %12979 %12980 +%12982 = OpLoad %6 %22 +%12983 = OpIAdd %6 %12981 %12982 +OpStore %954 %12983 +OpBranch %12970 +%12970 = OpLabel +%12984 = OpLoad %1035 %1054 +%12985 = OpULessThan %1057 %12984 %1138 +OpSelectionMerge %12987 None +OpBranchConditional %12985 %12986 %12987 +%12986 = OpLabel +%12988 = OpLoad %6 %14 +%12989 = OpLoad %6 %15 +%12990 = OpIAdd %6 %12988 %12989 +%12991 = OpLoad %6 %16 +%12992 = OpISub %6 %12990 %12991 +%12993 = OpLoad %6 %17 +%12994 = OpIAdd %6 %12992 %12993 +%12995 = OpLoad %6 %19 +%12996 = OpISub %6 %12994 %12995 +%12997 = OpLoad %6 %20 +%12998 = OpIAdd %6 %12996 %12997 +%12999 = OpLoad %6 %21 +%13000 = OpISub %6 %12998 %12999 +OpStore %955 %13000 +OpBranch %12987 +%12987 = OpLabel +%13001 = OpLoad %1035 %1054 +%13002 = OpUGreaterThanEqual %1057 %13001 %1072 +OpSelectionMerge %13004 None +OpBranchConditional %13002 %13003 %13004 +%13003 = OpLabel +%13005 = OpLoad %6 %14 +%13006 = OpLoad %6 %15 +%13007 = OpIAdd %6 %13005 %13006 +%13008 = OpLoad %6 %16 +%13009 = OpIAdd %6 %13007 %13008 +%13010 = OpLoad %6 %17 +%13011 = OpIAdd %6 %13009 %13010 +%13012 = OpLoad %6 %19 +%13013 = OpIAdd %6 %13011 %13012 +%13014 = OpLoad %6 %20 +%13015 = OpISub %6 %13013 %13014 +%13016 = OpLoad %6 %22 +%13017 = OpIAdd %6 %13015 %13016 +OpStore %956 %13017 +OpBranch %13004 +%13004 = OpLabel +%13018 = OpLoad %1035 %1054 +%13019 = OpULessThanEqual %1057 %13018 %1072 +OpSelectionMerge %13021 None +OpBranchConditional %13019 %13020 %13021 +%13020 = OpLabel +%13022 = OpLoad %6 %14 +%13023 = OpLoad %6 %15 +%13024 = OpISub %6 %13022 %13023 +%13025 = OpLoad %6 %16 +%13026 = OpISub %6 %13024 %13025 +%13027 = OpLoad %6 %17 +%13028 = OpIAdd %6 %13026 %13027 +%13029 = OpLoad %6 %19 +%13030 = OpIAdd %6 %13028 %13029 +%13031 = OpLoad %6 %21 +%13032 = OpISub %6 %13030 %13031 +%13033 = OpLoad %6 %22 +%13034 = OpISub %6 %13032 %13033 +OpStore %957 %13034 +OpBranch %13021 +%13021 = OpLabel +%13035 = OpLoad %1035 %1054 +%13036 = OpIEqual %1057 %13035 %1094 +OpSelectionMerge %13038 None +OpBranchConditional %13036 %13037 %13038 +%13037 = OpLabel +%13039 = OpLoad %6 %14 +%13040 = OpLoad %6 %16 +%13041 = OpIAdd %6 %13039 %13040 +%13042 = OpLoad %6 %22 +%13043 = OpISub %6 %13041 %13042 +OpStore %958 %13043 +OpBranch %13038 +%13038 = OpLabel +%13044 = OpLoad %1035 %1054 +%13045 = OpINotEqual %1057 %13044 %1056 +OpSelectionMerge %13047 None +OpBranchConditional %13045 %13046 %13047 +%13046 = OpLabel +%13048 = OpLoad %6 %14 +%13049 = OpLoad %6 %15 +%13050 = OpIAdd %6 %13048 %13049 +%13051 = OpLoad %6 %16 +%13052 = OpIAdd %6 %13050 %13051 +%13053 = OpLoad %6 %17 +%13054 = OpIAdd %6 %13052 %13053 +%13055 = OpLoad %6 %20 +%13056 = OpISub %6 %13054 %13055 +%13057 = OpLoad %6 %21 +%13058 = OpISub %6 %13056 %13057 +%13059 = OpLoad %6 %22 +%13060 = OpIAdd %6 %13058 %13059 +OpStore %959 %13060 +OpBranch %13047 +%13047 = OpLabel +%13061 = OpLoad %1035 %1054 +%13062 = OpIEqual %1057 %13061 %1138 +OpSelectionMerge %13064 None +OpBranchConditional %13062 %13063 %13064 +%13063 = OpLabel +%13065 = OpLoad %6 %14 +%13066 = OpLoad %6 %15 +%13067 = OpIAdd %6 %13065 %13066 +%13068 = OpLoad %6 %16 +%13069 = OpIAdd %6 %13067 %13068 +%13070 = OpLoad %6 %18 +%13071 = OpIAdd %6 %13069 %13070 +%13072 = OpLoad %6 %19 +%13073 = OpISub %6 %13071 %13072 +%13074 = OpLoad %6 %20 +%13075 = OpISub %6 %13073 %13074 +%13076 = OpLoad %6 %21 +%13077 = OpISub %6 %13075 %13076 +OpStore %960 %13077 +OpBranch %13064 +%13064 = OpLabel +%13078 = OpLoad %1035 %1054 +%13079 = OpULessThanEqual %1057 %13078 %1072 +OpSelectionMerge %13081 None +OpBranchConditional %13079 %13080 %13081 +%13080 = OpLabel +%13082 = OpLoad %6 %14 +%13083 = OpLoad %6 %15 +%13084 = OpISub %6 %13082 %13083 +%13085 = OpLoad %6 %16 +%13086 = OpISub %6 %13084 %13085 +%13087 = OpLoad %6 %18 +%13088 = OpIAdd %6 %13086 %13087 +%13089 = OpLoad %6 %19 +%13090 = OpIAdd %6 %13088 %13089 +%13091 = OpLoad %6 %20 +%13092 = OpISub %6 %13090 %13091 +%13093 = OpLoad %6 %22 +%13094 = OpISub %6 %13092 %13093 +OpStore %961 %13094 +OpBranch %13081 +%13081 = OpLabel +%13095 = OpLoad %1035 %1054 +%13096 = OpIEqual %1057 %13095 %1056 +OpSelectionMerge %13098 None +OpBranchConditional %13096 %13097 %13098 +%13097 = OpLabel +%13099 = OpLoad %6 %14 +%13100 = OpLoad %6 %15 +%13101 = OpIAdd %6 %13099 %13100 +%13102 = OpLoad %6 %16 +%13103 = OpIAdd %6 %13101 %13102 +%13104 = OpLoad %6 %18 +%13105 = OpISub %6 %13103 %13104 +%13106 = OpLoad %6 %19 +%13107 = OpIAdd %6 %13105 %13106 +%13108 = OpLoad %6 %21 +%13109 = OpISub %6 %13107 %13108 +%13110 = OpLoad %6 %22 +%13111 = OpISub %6 %13109 %13110 +OpStore %962 %13111 +OpBranch %13098 +%13098 = OpLabel +%13112 = OpLoad %1035 %1054 +%13113 = OpIEqual %1057 %13112 %1056 +OpSelectionMerge %13115 None +OpBranchConditional %13113 %13114 %13115 +%13114 = OpLabel +%13116 = OpLoad %6 %14 +%13117 = OpLoad %6 %15 +%13118 = OpIAdd %6 %13116 %13117 +%13119 = OpLoad %6 %16 +%13120 = OpIAdd %6 %13118 %13119 +%13121 = OpLoad %6 %18 +%13122 = OpISub %6 %13120 %13121 +%13123 = OpLoad %6 %20 +%13124 = OpIAdd %6 %13122 %13123 +%13125 = OpLoad %6 %21 +%13126 = OpIAdd %6 %13124 %13125 +%13127 = OpLoad %6 %22 +%13128 = OpISub %6 %13126 %13127 +OpStore %963 %13128 +OpBranch %13115 +%13115 = OpLabel +%13129 = OpLoad %1035 %1054 +%13130 = OpUGreaterThanEqual %1057 %13129 %1138 +OpSelectionMerge %13132 None +OpBranchConditional %13130 %13131 %13132 +%13131 = OpLabel +%13133 = OpLoad %6 %14 +%13134 = OpLoad %6 %15 +%13135 = OpIAdd %6 %13133 %13134 +%13136 = OpLoad %6 %16 +%13137 = OpIAdd %6 %13135 %13136 +%13138 = OpLoad %6 %19 +%13139 = OpISub %6 %13137 %13138 +%13140 = OpLoad %6 %20 +%13141 = OpIAdd %6 %13139 %13140 +%13142 = OpLoad %6 %21 +%13143 = OpISub %6 %13141 %13142 +%13144 = OpLoad %6 %22 +%13145 = OpIAdd %6 %13143 %13144 +OpStore %964 %13145 +OpBranch %13132 +%13132 = OpLabel +%13146 = OpLoad %1035 %1054 +%13147 = OpULessThan %1057 %13146 %1138 +OpSelectionMerge %13149 None +OpBranchConditional %13147 %13148 %13149 +%13148 = OpLabel +%13150 = OpLoad %6 %14 +%13151 = OpLoad %6 %15 +%13152 = OpISub %6 %13150 %13151 +%13153 = OpLoad %6 %17 +%13154 = OpIAdd %6 %13152 %13153 +%13155 = OpLoad %6 %18 +%13156 = OpISub %6 %13154 %13155 +%13157 = OpLoad %6 %19 +%13158 = OpIAdd %6 %13156 %13157 +%13159 = OpLoad %6 %20 +%13160 = OpISub %6 %13158 %13159 +%13161 = OpLoad %6 %21 +%13162 = OpIAdd %6 %13160 %13161 +OpStore %965 %13162 +OpBranch %13149 +%13149 = OpLabel +%13163 = OpLoad %1035 %1054 +%13164 = OpUGreaterThan %1057 %13163 %1094 +OpSelectionMerge %13166 None +OpBranchConditional %13164 %13165 %13166 +%13165 = OpLabel +%13167 = OpLoad %6 %14 +%13168 = OpLoad %6 %15 +%13169 = OpIAdd %6 %13167 %13168 +%13170 = OpLoad %6 %17 +%13171 = OpIAdd %6 %13169 %13170 +%13172 = OpLoad %6 %18 +%13173 = OpISub %6 %13171 %13172 +%13174 = OpLoad %6 %19 +%13175 = OpISub %6 %13173 %13174 +%13176 = OpLoad %6 %20 +%13177 = OpISub %6 %13175 %13176 +%13178 = OpLoad %6 %22 +%13179 = OpISub %6 %13177 %13178 +OpStore %966 %13179 +OpBranch %13166 +%13166 = OpLabel +%13180 = OpLoad %1035 %1054 +%13181 = OpIEqual %1057 %13180 %1094 +OpSelectionMerge %13183 None +OpBranchConditional %13181 %13182 %13183 +%13182 = OpLabel +%13184 = OpLoad %6 %14 +%13185 = OpLoad %6 %15 +%13186 = OpIAdd %6 %13184 %13185 +%13187 = OpLoad %6 %17 +%13188 = OpIAdd %6 %13186 %13187 +%13189 = OpLoad %6 %18 +%13190 = OpISub %6 %13188 %13189 +%13191 = OpLoad %6 %19 +%13192 = OpISub %6 %13190 %13191 +%13193 = OpLoad %6 %21 +%13194 = OpISub %6 %13192 %13193 +%13195 = OpLoad %6 %22 +%13196 = OpISub %6 %13194 %13195 +OpStore %967 %13196 +OpBranch %13183 +%13183 = OpLabel +%13197 = OpLoad %1035 %1054 +%13198 = OpULessThan %1057 %13197 %1094 +OpSelectionMerge %13200 None +OpBranchConditional %13198 %13199 %13200 +%13199 = OpLabel +%13201 = OpLoad %6 %14 +%13202 = OpLoad %6 %15 +%13203 = OpIAdd %6 %13201 %13202 +%13204 = OpLoad %6 %17 +%13205 = OpISub %6 %13203 %13204 +%13206 = OpLoad %6 %18 +%13207 = OpIAdd %6 %13205 %13206 +%13208 = OpLoad %6 %20 +%13209 = OpISub %6 %13207 %13208 +%13210 = OpLoad %6 %21 +%13211 = OpISub %6 %13209 %13210 +%13212 = OpLoad %6 %22 +%13213 = OpIAdd %6 %13211 %13212 +OpStore %968 %13213 +OpBranch %13200 +%13200 = OpLabel +%13214 = OpLoad %1035 %1054 +%13215 = OpUGreaterThanEqual %1057 %13214 %1056 +OpSelectionMerge %13217 None +OpBranchConditional %13215 %13216 %13217 +%13216 = OpLabel +%13218 = OpLoad %6 %14 +%13219 = OpLoad %6 %17 +%13220 = OpISub %6 %13218 %13219 +%13221 = OpLoad %6 %18 +%13222 = OpIAdd %6 %13220 %13221 +OpStore %969 %13222 +OpBranch %13217 +%13217 = OpLabel +%13223 = OpLoad %1035 %1054 +%13224 = OpUGreaterThan %1057 %13223 %1072 +OpSelectionMerge %13226 None +OpBranchConditional %13224 %13225 %13226 +%13225 = OpLabel +%13227 = OpLoad %6 %14 +%13228 = OpLoad %6 %15 +%13229 = OpIAdd %6 %13227 %13228 +%13230 = OpLoad %6 %17 +%13231 = OpISub %6 %13229 %13230 +%13232 = OpLoad %6 %19 +%13233 = OpISub %6 %13231 %13232 +%13234 = OpLoad %6 %20 +%13235 = OpISub %6 %13233 %13234 +%13236 = OpLoad %6 %21 +%13237 = OpIAdd %6 %13235 %13236 +%13238 = OpLoad %6 %22 +%13239 = OpISub %6 %13237 %13238 +OpStore %970 %13239 +OpBranch %13226 +%13226 = OpLabel +%13240 = OpLoad %1035 %1054 +%13241 = OpULessThanEqual %1057 %13240 %1056 +OpSelectionMerge %13243 None +OpBranchConditional %13241 %13242 %13243 +%13242 = OpLabel +%13244 = OpLoad %6 %14 +%13245 = OpLoad %6 %15 +%13246 = OpIAdd %6 %13244 %13245 +%13247 = OpLoad %6 %18 +%13248 = OpISub %6 %13246 %13247 +%13249 = OpLoad %6 %19 +%13250 = OpISub %6 %13248 %13249 +%13251 = OpLoad %6 %20 +%13252 = OpIAdd %6 %13250 %13251 +%13253 = OpLoad %6 %21 +%13254 = OpIAdd %6 %13252 %13253 +%13255 = OpLoad %6 %22 +%13256 = OpIAdd %6 %13254 %13255 +OpStore %971 %13256 +OpBranch %13243 +%13243 = OpLabel +%13257 = OpLoad %1035 %1054 +%13258 = OpINotEqual %1057 %13257 %1056 +OpSelectionMerge %13260 None +OpBranchConditional %13258 %13259 %13260 +%13259 = OpLabel +%13261 = OpLoad %6 %14 +%13262 = OpLoad %6 %16 +%13263 = OpIAdd %6 %13261 %13262 +%13264 = OpLoad %6 %17 +%13265 = OpISub %6 %13263 %13264 +%13266 = OpLoad %6 %18 +%13267 = OpISub %6 %13265 %13266 +%13268 = OpLoad %6 %19 +%13269 = OpIAdd %6 %13267 %13268 +%13270 = OpLoad %6 %20 +%13271 = OpIAdd %6 %13269 %13270 +%13272 = OpLoad %6 %21 +%13273 = OpISub %6 %13271 %13272 +OpStore %972 %13273 +OpBranch %13260 +%13260 = OpLabel +%13274 = OpLoad %1035 %1054 +%13275 = OpULessThan %1057 %13274 %1138 +OpSelectionMerge %13277 None +OpBranchConditional %13275 %13276 %13277 +%13276 = OpLabel +%13278 = OpLoad %6 %14 +%13279 = OpLoad %6 %16 +%13280 = OpISub %6 %13278 %13279 +%13281 = OpLoad %6 %17 +%13282 = OpISub %6 %13280 %13281 +%13283 = OpLoad %6 %18 +%13284 = OpISub %6 %13282 %13283 +%13285 = OpLoad %6 %19 +%13286 = OpISub %6 %13284 %13285 +%13287 = OpLoad %6 %20 +%13288 = OpISub %6 %13286 %13287 +%13289 = OpLoad %6 %22 +%13290 = OpISub %6 %13288 %13289 +OpStore %973 %13290 +OpBranch %13277 +%13277 = OpLabel +%13291 = OpLoad %1035 %1054 +%13292 = OpUGreaterThan %1057 %13291 %1094 +OpSelectionMerge %13294 None +OpBranchConditional %13292 %13293 %13294 +%13293 = OpLabel +%13295 = OpLoad %6 %14 +%13296 = OpLoad %6 %16 +%13297 = OpIAdd %6 %13295 %13296 +%13298 = OpLoad %6 %17 +%13299 = OpISub %6 %13297 %13298 +%13300 = OpLoad %6 %18 +%13301 = OpISub %6 %13299 %13300 +%13302 = OpLoad %6 %19 +%13303 = OpISub %6 %13301 %13302 +%13304 = OpLoad %6 %21 +%13305 = OpIAdd %6 %13303 %13304 +%13306 = OpLoad %6 %22 +%13307 = OpISub %6 %13305 %13306 +OpStore %974 %13307 +OpBranch %13294 +%13294 = OpLabel +%13308 = OpLoad %1035 %1054 +%13309 = OpULessThanEqual %1057 %13308 %1094 +OpSelectionMerge %13311 None +OpBranchConditional %13309 %13310 %13311 +%13310 = OpLabel +%13312 = OpLoad %6 %14 +%13313 = OpLoad %6 %16 +%13314 = OpISub %6 %13312 %13313 +%13315 = OpLoad %6 %17 +%13316 = OpISub %6 %13314 %13315 +%13317 = OpLoad %6 %18 +%13318 = OpIAdd %6 %13316 %13317 +%13319 = OpLoad %6 %20 +%13320 = OpISub %6 %13318 %13319 +%13321 = OpLoad %6 %21 +%13322 = OpISub %6 %13320 %13321 +%13323 = OpLoad %6 %22 +%13324 = OpIAdd %6 %13322 %13323 +OpStore %975 %13324 +OpBranch %13311 +%13311 = OpLabel +%13325 = OpLoad %1035 %1054 +%13326 = OpUGreaterThan %1057 %13325 %1072 +OpSelectionMerge %13328 None +OpBranchConditional %13326 %13327 %13328 +%13327 = OpLabel +%13329 = OpLoad %6 %14 +%13330 = OpLoad %6 %16 +%13331 = OpISub %6 %13329 %13330 +%13332 = OpLoad %6 %17 +%13333 = OpIAdd %6 %13331 %13332 +%13334 = OpLoad %6 %19 +%13335 = OpIAdd %6 %13333 %13334 +%13336 = OpLoad %6 %20 +%13337 = OpISub %6 %13335 %13336 +%13338 = OpLoad %6 %21 +%13339 = OpIAdd %6 %13337 %13338 +%13340 = OpLoad %6 %22 +%13341 = OpIAdd %6 %13339 %13340 +OpStore %976 %13341 +OpBranch %13328 +%13328 = OpLabel +%13342 = OpLoad %1035 %1054 +%13343 = OpINotEqual %1057 %13342 %1094 +OpSelectionMerge %13345 None +OpBranchConditional %13343 %13344 %13345 +%13344 = OpLabel +%13346 = OpLoad %6 %14 +%13347 = OpLoad %6 %16 +%13348 = OpIAdd %6 %13346 %13347 +%13349 = OpLoad %6 %18 +%13350 = OpISub %6 %13348 %13349 +%13351 = OpLoad %6 %19 +%13352 = OpIAdd %6 %13350 %13351 +%13353 = OpLoad %6 %20 +%13354 = OpISub %6 %13352 %13353 +%13355 = OpLoad %6 %21 +%13356 = OpIAdd %6 %13354 %13355 +%13357 = OpLoad %6 %22 +%13358 = OpIAdd %6 %13356 %13357 +OpStore %977 %13358 +OpBranch %13345 +%13345 = OpLabel +%13359 = OpLoad %1035 %1054 +%13360 = OpIEqual %1057 %13359 %1138 +OpSelectionMerge %13362 None +OpBranchConditional %13360 %13361 %13362 +%13361 = OpLabel +%13363 = OpLoad %6 %14 +%13364 = OpLoad %6 %17 +%13365 = OpISub %6 %13363 %13364 +%13366 = OpLoad %6 %18 +%13367 = OpISub %6 %13365 %13366 +%13368 = OpLoad %6 %19 +%13369 = OpIAdd %6 %13367 %13368 +%13370 = OpLoad %6 %20 +%13371 = OpISub %6 %13369 %13370 +%13372 = OpLoad %6 %21 +%13373 = OpIAdd %6 %13371 %13372 +%13374 = OpLoad %6 %22 +%13375 = OpISub %6 %13373 %13374 +OpStore %978 %13375 +OpBranch %13362 +%13362 = OpLabel +%13376 = OpLoad %1035 %1054 +%13377 = OpUGreaterThanEqual %1057 %13376 %1072 +OpSelectionMerge %13379 None +OpBranchConditional %13377 %13378 %13379 +%13378 = OpLabel +%13380 = OpLoad %6 %15 +%13381 = OpLoad %6 %16 +%13382 = OpIAdd %6 %13380 %13381 +%13383 = OpLoad %6 %17 +%13384 = OpISub %6 %13382 %13383 +%13385 = OpLoad %6 %18 +%13386 = OpISub %6 %13384 %13385 +%13387 = OpLoad %6 %19 +%13388 = OpIAdd %6 %13386 %13387 +%13389 = OpLoad %6 %20 +%13390 = OpISub %6 %13388 %13389 +%13391 = OpLoad %6 %21 +%13392 = OpISub %6 %13390 %13391 +OpStore %979 %13392 +OpBranch %13379 +%13379 = OpLabel +%13393 = OpLoad %1035 %1054 +%13394 = OpULessThan %1057 %13393 %1056 +OpSelectionMerge %13396 None +OpBranchConditional %13394 %13395 %13396 +%13395 = OpLabel +%13397 = OpLoad %6 %14 +%13398 = OpLoad %6 %17 +%13399 = OpIAdd %6 %13397 %13398 +%13400 = OpLoad %6 %19 +%13401 = OpISub %6 %13399 %13400 +OpStore %980 %13401 +OpBranch %13396 +%13396 = OpLabel +%13402 = OpLoad %1035 %1054 +%13403 = OpULessThanEqual %1057 %13402 %1138 +OpSelectionMerge %13405 None +OpBranchConditional %13403 %13404 %13405 +%13404 = OpLabel +%13406 = OpLoad %6 %15 +%13407 = OpLoad %6 %16 +%13408 = OpIAdd %6 %13406 %13407 +%13409 = OpLoad %6 %17 +%13410 = OpIAdd %6 %13408 %13409 +%13411 = OpLoad %6 %18 +%13412 = OpISub %6 %13410 %13411 +%13413 = OpLoad %6 %19 +%13414 = OpISub %6 %13412 %13413 +%13415 = OpLoad %6 %20 +%13416 = OpIAdd %6 %13414 %13415 +%13417 = OpLoad %6 %22 +%13418 = OpIAdd %6 %13416 %13417 +OpStore %981 %13418 +OpBranch %13405 +%13405 = OpLabel +%13419 = OpLoad %1035 %1054 +%13420 = OpUGreaterThan %1057 %13419 %1094 +OpSelectionMerge %13422 None +OpBranchConditional %13420 %13421 %13422 +%13421 = OpLabel +%13423 = OpLoad %6 %15 +%13424 = OpLoad %6 %16 +%13425 = OpIAdd %6 %13423 %13424 +%13426 = OpLoad %6 %17 +%13427 = OpIAdd %6 %13425 %13426 +%13428 = OpLoad %6 %18 +%13429 = OpIAdd %6 %13427 %13428 +%13430 = OpLoad %6 %19 +%13431 = OpIAdd %6 %13429 %13430 +%13432 = OpLoad %6 %21 +%13433 = OpIAdd %6 %13431 %13432 +%13434 = OpLoad %6 %22 +%13435 = OpISub %6 %13433 %13434 +OpStore %982 %13435 +OpBranch %13422 +%13422 = OpLabel +%13436 = OpLoad %1035 %1054 +%13437 = OpULessThanEqual %1057 %13436 %1056 +OpSelectionMerge %13439 None +OpBranchConditional %13437 %13438 %13439 +%13438 = OpLabel +%13440 = OpLoad %6 %15 +%13441 = OpLoad %6 %16 +%13442 = OpISub %6 %13440 %13441 +%13443 = OpLoad %6 %17 +%13444 = OpISub %6 %13442 %13443 +%13445 = OpLoad %6 %18 +%13446 = OpIAdd %6 %13444 %13445 +%13447 = OpLoad %6 %20 +%13448 = OpIAdd %6 %13446 %13447 +%13449 = OpLoad %6 %21 +%13450 = OpIAdd %6 %13448 %13449 +%13451 = OpLoad %6 %22 +%13452 = OpISub %6 %13450 %13451 +OpStore %983 %13452 +OpBranch %13439 +%13439 = OpLabel +%13453 = OpLoad %1035 %1054 +%13454 = OpIEqual %1057 %13453 %1072 +OpSelectionMerge %13456 None +OpBranchConditional %13454 %13455 %13456 +%13455 = OpLabel +%13457 = OpLoad %6 %15 +%13458 = OpLoad %6 %16 +%13459 = OpISub %6 %13457 %13458 +%13460 = OpLoad %6 %17 +%13461 = OpISub %6 %13459 %13460 +%13462 = OpLoad %6 %19 +%13463 = OpISub %6 %13461 %13462 +%13464 = OpLoad %6 %20 +%13465 = OpIAdd %6 %13463 %13464 +%13466 = OpLoad %6 %21 +%13467 = OpISub %6 %13465 %13466 +%13468 = OpLoad %6 %22 +%13469 = OpIAdd %6 %13467 %13468 +OpStore %984 %13469 +OpBranch %13456 +%13456 = OpLabel +%13470 = OpLoad %1035 %1054 +%13471 = OpUGreaterThanEqual %1057 %13470 %1094 +OpSelectionMerge %13473 None +OpBranchConditional %13471 %13472 %13473 +%13472 = OpLabel +%13474 = OpLoad %6 %15 +%13475 = OpLoad %6 %16 +%13476 = OpISub %6 %13474 %13475 +%13477 = OpLoad %6 %18 +%13478 = OpIAdd %6 %13476 %13477 +%13479 = OpLoad %6 %19 +%13480 = OpISub %6 %13478 %13479 +%13481 = OpLoad %6 %20 +%13482 = OpISub %6 %13480 %13481 +%13483 = OpLoad %6 %21 +%13484 = OpIAdd %6 %13482 %13483 +%13485 = OpLoad %6 %22 +%13486 = OpIAdd %6 %13484 %13485 +OpStore %985 %13486 +OpBranch %13473 +%13473 = OpLabel +%13487 = OpLoad %1035 %1054 +%13488 = OpIEqual %1057 %13487 %1094 +OpSelectionMerge %13490 None +OpBranchConditional %13488 %13489 %13490 +%13489 = OpLabel +%13491 = OpLoad %6 %15 +%13492 = OpLoad %6 %17 +%13493 = OpISub %6 %13491 %13492 +%13494 = OpLoad %6 %18 +%13495 = OpISub %6 %13493 %13494 +%13496 = OpLoad %6 %19 +%13497 = OpISub %6 %13495 %13496 +%13498 = OpLoad %6 %20 +%13499 = OpISub %6 %13497 %13498 +%13500 = OpLoad %6 %21 +%13501 = OpISub %6 %13499 %13500 +%13502 = OpLoad %6 %22 +%13503 = OpIAdd %6 %13501 %13502 +OpStore %986 %13503 +OpBranch %13490 +%13490 = OpLabel +%13504 = OpLoad %1035 %1054 +%13505 = OpUGreaterThan %1057 %13504 %1072 +OpSelectionMerge %13507 None +OpBranchConditional %13505 %13506 %13507 +%13506 = OpLabel +%13508 = OpLoad %6 %16 +%13509 = OpLoad %6 %17 +%13510 = OpIAdd %6 %13508 %13509 +%13511 = OpLoad %6 %18 +%13512 = OpIAdd %6 %13510 %13511 +%13513 = OpLoad %6 %19 +%13514 = OpIAdd %6 %13512 %13513 +%13515 = OpLoad %6 %20 +%13516 = OpIAdd %6 %13514 %13515 +%13517 = OpLoad %6 %21 +%13518 = OpIAdd %6 %13516 %13517 +%13519 = OpLoad %6 %22 +%13520 = OpIAdd %6 %13518 %13519 +OpStore %987 %13520 +OpBranch %13507 +%13507 = OpLabel +%13521 = OpLoad %1035 %1054 +%13522 = OpUGreaterThan %1057 %13521 %1072 +OpSelectionMerge %13524 None +OpBranchConditional %13522 %13523 %13524 +%13523 = OpLabel +%13525 = OpLoad %6 %13 +%13526 = OpLoad %6 %14 +%13527 = OpISub %6 %13525 %13526 +%13528 = OpLoad %6 %15 +%13529 = OpIAdd %6 %13527 %13528 +%13530 = OpLoad %6 %16 +%13531 = OpISub %6 %13529 %13530 +%13532 = OpLoad %6 %17 +%13533 = OpIAdd %6 %13531 %13532 +%13534 = OpLoad %6 %18 +%13535 = OpIAdd %6 %13533 %13534 +%13536 = OpLoad %6 %19 +%13537 = OpIAdd %6 %13535 %13536 +%13538 = OpLoad %6 %20 +%13539 = OpIAdd %6 %13537 %13538 +OpStore %988 %13539 +OpBranch %13524 +%13524 = OpLabel +%13540 = OpLoad %1035 %1054 +%13541 = OpINotEqual %1057 %13540 %1056 +OpSelectionMerge %13543 None +OpBranchConditional %13541 %13542 %13543 +%13542 = OpLabel +%13544 = OpLoad %6 %13 +%13545 = OpLoad %6 %14 +%13546 = OpIAdd %6 %13544 %13545 +%13547 = OpLoad %6 %15 +%13548 = OpIAdd %6 %13546 %13547 +%13549 = OpLoad %6 %16 +%13550 = OpISub %6 %13548 %13549 +%13551 = OpLoad %6 %17 +%13552 = OpISub %6 %13550 %13551 +%13553 = OpLoad %6 %18 +%13554 = OpISub %6 %13552 %13553 +%13555 = OpLoad %6 %19 +%13556 = OpISub %6 %13554 %13555 +%13557 = OpLoad %6 %21 +%13558 = OpISub %6 %13556 %13557 +OpStore %989 %13558 +OpBranch %13543 +%13543 = OpLabel +%13559 = OpLoad %1035 %1054 +%13560 = OpULessThanEqual %1057 %13559 %1056 +OpSelectionMerge %13562 None +OpBranchConditional %13560 %13561 %13562 +%13561 = OpLabel +%13563 = OpLoad %6 %13 +%13564 = OpLoad %6 %14 +%13565 = OpIAdd %6 %13563 %13564 +%13566 = OpLoad %6 %15 +%13567 = OpISub %6 %13565 %13566 +%13568 = OpLoad %6 %16 +%13569 = OpISub %6 %13567 %13568 +%13570 = OpLoad %6 %17 +%13571 = OpISub %6 %13569 %13570 +%13572 = OpLoad %6 %18 +%13573 = OpISub %6 %13571 %13572 +%13574 = OpLoad %6 %19 +%13575 = OpIAdd %6 %13573 %13574 +%13576 = OpLoad %6 %22 +%13577 = OpISub %6 %13575 %13576 +OpStore %990 %13577 +OpBranch %13562 +%13562 = OpLabel +%13578 = OpLoad %1035 %1054 +%13579 = OpULessThanEqual %1057 %13578 %1094 +OpSelectionMerge %13581 None +OpBranchConditional %13579 %13580 %13581 +%13580 = OpLabel +%13582 = OpLoad %6 %14 +%13583 = OpLoad %6 %17 +%13584 = OpIAdd %6 %13582 %13583 +%13585 = OpLoad %6 %20 +%13586 = OpIAdd %6 %13584 %13585 +OpStore %991 %13586 +OpBranch %13581 +%13581 = OpLabel +%13587 = OpLoad %1035 %1054 +%13588 = OpULessThan %1057 %13587 %1056 +OpSelectionMerge %13590 None +OpBranchConditional %13588 %13589 %13590 +%13589 = OpLabel +%13591 = OpLoad %6 %13 +%13592 = OpLoad %6 %14 +%13593 = OpIAdd %6 %13591 %13592 +%13594 = OpLoad %6 %15 +%13595 = OpIAdd %6 %13593 %13594 +%13596 = OpLoad %6 %16 +%13597 = OpIAdd %6 %13595 %13596 +%13598 = OpLoad %6 %17 +%13599 = OpISub %6 %13597 %13598 +%13600 = OpLoad %6 %18 +%13601 = OpIAdd %6 %13599 %13600 +%13602 = OpLoad %6 %20 +%13603 = OpISub %6 %13601 %13602 +%13604 = OpLoad %6 %21 +%13605 = OpIAdd %6 %13603 %13604 +OpStore %992 %13605 +OpBranch %13590 +%13590 = OpLabel +%13606 = OpLoad %1035 %1054 +%13607 = OpULessThan %1057 %13606 %1056 +OpSelectionMerge %13609 None +OpBranchConditional %13607 %13608 %13609 +%13608 = OpLabel +%13610 = OpLoad %6 %13 +%13611 = OpLoad %6 %14 +%13612 = OpIAdd %6 %13610 %13611 +%13613 = OpLoad %6 %15 +%13614 = OpIAdd %6 %13612 %13613 +%13615 = OpLoad %6 %16 +%13616 = OpIAdd %6 %13614 %13615 +%13617 = OpLoad %6 %17 +%13618 = OpIAdd %6 %13616 %13617 +%13619 = OpLoad %6 %18 +%13620 = OpISub %6 %13618 %13619 +%13621 = OpLoad %6 %20 +%13622 = OpISub %6 %13620 %13621 +%13623 = OpLoad %6 %22 +%13624 = OpISub %6 %13622 %13623 +OpStore %993 %13624 +OpBranch %13609 +%13609 = OpLabel +%13625 = OpLoad %1035 %1054 +%13626 = OpULessThan %1057 %13625 %1056 +OpSelectionMerge %13628 None +OpBranchConditional %13626 %13627 %13628 +%13627 = OpLabel +%13629 = OpLoad %6 %13 +%13630 = OpLoad %6 %14 +%13631 = OpIAdd %6 %13629 %13630 +%13632 = OpLoad %6 %15 +%13633 = OpIAdd %6 %13631 %13632 +%13634 = OpLoad %6 %16 +%13635 = OpISub %6 %13633 %13634 +%13636 = OpLoad %6 %17 +%13637 = OpIAdd %6 %13635 %13636 +%13638 = OpLoad %6 %18 +%13639 = OpIAdd %6 %13637 %13638 +%13640 = OpLoad %6 %21 +%13641 = OpIAdd %6 %13639 %13640 +%13642 = OpLoad %6 %22 +%13643 = OpISub %6 %13641 %13642 +OpStore %994 %13643 +OpBranch %13628 +%13628 = OpLabel +%13644 = OpLoad %1035 %1054 +%13645 = OpINotEqual %1057 %13644 %1094 +OpSelectionMerge %13647 None +OpBranchConditional %13645 %13646 %13647 +%13646 = OpLabel +%13648 = OpLoad %6 %13 +%13649 = OpLoad %6 %14 +%13650 = OpISub %6 %13648 %13649 +%13651 = OpLoad %6 %15 +%13652 = OpISub %6 %13650 %13651 +%13653 = OpLoad %6 %16 +%13654 = OpISub %6 %13652 %13653 +%13655 = OpLoad %6 %17 +%13656 = OpISub %6 %13654 %13655 +%13657 = OpLoad %6 %19 +%13658 = OpISub %6 %13656 %13657 +%13659 = OpLoad %6 %20 +%13660 = OpISub %6 %13658 %13659 +%13661 = OpLoad %6 %21 +%13662 = OpIAdd %6 %13660 %13661 +OpStore %995 %13662 +OpBranch %13647 +%13647 = OpLabel +%13663 = OpLoad %1035 %1054 +%13664 = OpULessThanEqual %1057 %13663 %1094 +OpSelectionMerge %13666 None +OpBranchConditional %13664 %13665 %13666 +%13665 = OpLabel +%13667 = OpLoad %6 %13 +%13668 = OpLoad %6 %14 +%13669 = OpIAdd %6 %13667 %13668 +%13670 = OpLoad %6 %15 +%13671 = OpISub %6 %13669 %13670 +%13672 = OpLoad %6 %16 +%13673 = OpISub %6 %13671 %13672 +%13674 = OpLoad %6 %17 +%13675 = OpIAdd %6 %13673 %13674 +%13676 = OpLoad %6 %19 +%13677 = OpISub %6 %13675 %13676 +%13678 = OpLoad %6 %20 +%13679 = OpISub %6 %13677 %13678 +%13680 = OpLoad %6 %22 +%13681 = OpIAdd %6 %13679 %13680 +OpStore %996 %13681 +OpBranch %13666 +%13666 = OpLabel +%13682 = OpLoad %1035 %1054 +%13683 = OpINotEqual %1057 %13682 %1138 +OpSelectionMerge %13685 None +OpBranchConditional %13683 %13684 %13685 +%13684 = OpLabel +%13686 = OpLoad %6 %13 +%13687 = OpLoad %6 %14 +%13688 = OpISub %6 %13686 %13687 +%13689 = OpLoad %6 %15 +%13690 = OpISub %6 %13688 %13689 +%13691 = OpLoad %6 %16 +%13692 = OpIAdd %6 %13690 %13691 +%13693 = OpLoad %6 %17 +%13694 = OpISub %6 %13692 %13693 +%13695 = OpLoad %6 %19 +%13696 = OpIAdd %6 %13694 %13695 +%13697 = OpLoad %6 %21 +%13698 = OpIAdd %6 %13696 %13697 +%13699 = OpLoad %6 %22 +%13700 = OpISub %6 %13698 %13699 +OpStore %997 %13700 +OpBranch %13685 +%13685 = OpLabel +%13701 = OpLoad %1035 %1054 +%13702 = OpUGreaterThan %1057 %13701 %1094 +OpSelectionMerge %13704 None +OpBranchConditional %13702 %13703 %13704 +%13703 = OpLabel +%13705 = OpLoad %6 %13 +%13706 = OpLoad %6 %14 +%13707 = OpISub %6 %13705 %13706 +%13708 = OpLoad %6 %15 +%13709 = OpISub %6 %13707 %13708 +%13710 = OpLoad %6 %16 +%13711 = OpIAdd %6 %13709 %13710 +%13712 = OpLoad %6 %17 +%13713 = OpIAdd %6 %13711 %13712 +%13714 = OpLoad %6 %20 +%13715 = OpIAdd %6 %13713 %13714 +%13716 = OpLoad %6 %21 +%13717 = OpIAdd %6 %13715 %13716 +%13718 = OpLoad %6 %22 +%13719 = OpISub %6 %13717 %13718 +OpStore %998 %13719 +OpBranch %13704 +%13704 = OpLabel +%13720 = OpLoad %1035 %1054 +%13721 = OpULessThan %1057 %13720 %1138 +OpSelectionMerge %13723 None +OpBranchConditional %13721 %13722 %13723 +%13722 = OpLabel +%13724 = OpLoad %6 %13 +%13725 = OpLoad %6 %14 +%13726 = OpISub %6 %13724 %13725 +%13727 = OpLoad %6 %15 +%13728 = OpIAdd %6 %13726 %13727 +%13729 = OpLoad %6 %16 +%13730 = OpIAdd %6 %13728 %13729 +%13731 = OpLoad %6 %18 +%13732 = OpISub %6 %13730 %13731 +%13733 = OpLoad %6 %19 +%13734 = OpIAdd %6 %13732 %13733 +%13735 = OpLoad %6 %20 +%13736 = OpIAdd %6 %13734 %13735 +%13737 = OpLoad %6 %21 +%13738 = OpIAdd %6 %13736 %13737 +OpStore %999 %13738 +OpBranch %13723 +%13723 = OpLabel +%13739 = OpLoad %1035 %1054 +%13740 = OpINotEqual %1057 %13739 %1072 +OpSelectionMerge %13742 None +OpBranchConditional %13740 %13741 %13742 +%13741 = OpLabel +%13743 = OpLoad %6 %13 +%13744 = OpLoad %6 %14 +%13745 = OpIAdd %6 %13743 %13744 +%13746 = OpLoad %6 %15 +%13747 = OpIAdd %6 %13745 %13746 +%13748 = OpLoad %6 %16 +%13749 = OpIAdd %6 %13747 %13748 +%13750 = OpLoad %6 %18 +%13751 = OpISub %6 %13749 %13750 +%13752 = OpLoad %6 %19 +%13753 = OpIAdd %6 %13751 %13752 +%13754 = OpLoad %6 %20 +%13755 = OpISub %6 %13753 %13754 +%13756 = OpLoad %6 %22 +%13757 = OpISub %6 %13755 %13756 +OpStore %1000 %13757 +OpBranch %13742 +%13742 = OpLabel +%13758 = OpLoad %1035 %1054 +%13759 = OpIEqual %1057 %13758 %1072 +OpSelectionMerge %13761 None +OpBranchConditional %13759 %13760 %13761 +%13760 = OpLabel +%13762 = OpLoad %6 %13 +%13763 = OpLoad %6 %14 +%13764 = OpISub %6 %13762 %13763 +%13765 = OpLoad %6 %15 +%13766 = OpISub %6 %13764 %13765 +%13767 = OpLoad %6 %16 +%13768 = OpISub %6 %13766 %13767 +%13769 = OpLoad %6 %18 +%13770 = OpISub %6 %13768 %13769 +%13771 = OpLoad %6 %19 +%13772 = OpIAdd %6 %13770 %13771 +%13773 = OpLoad %6 %21 +%13774 = OpIAdd %6 %13772 %13773 +%13775 = OpLoad %6 %22 +%13776 = OpIAdd %6 %13774 %13775 +OpStore %1001 %13776 +OpBranch %13761 +%13761 = OpLabel +%13777 = OpLoad %1035 %1054 +%13778 = OpUGreaterThan %1057 %13777 %1056 +OpSelectionMerge %13780 None +OpBranchConditional %13778 %13779 %13780 +%13779 = OpLabel +%13781 = OpLoad %6 %14 +%13782 = OpLoad %6 %17 +%13783 = OpISub %6 %13781 %13782 +%13784 = OpLoad %6 %21 +%13785 = OpISub %6 %13783 %13784 +OpStore %1002 %13785 +OpBranch %13780 +%13780 = OpLabel +%13786 = OpLoad %1035 %1054 +%13787 = OpULessThanEqual %1057 %13786 %1138 +OpSelectionMerge %13789 None +OpBranchConditional %13787 %13788 %13789 +%13788 = OpLabel +%13790 = OpLoad %6 %13 +%13791 = OpLoad %6 %14 +%13792 = OpISub %6 %13790 %13791 +%13793 = OpLoad %6 %15 +%13794 = OpISub %6 %13792 %13793 +%13795 = OpLoad %6 %16 +%13796 = OpISub %6 %13794 %13795 +%13797 = OpLoad %6 %18 +%13798 = OpISub %6 %13796 %13797 +%13799 = OpLoad %6 %20 +%13800 = OpISub %6 %13798 %13799 +%13801 = OpLoad %6 %21 +%13802 = OpISub %6 %13800 %13801 +%13803 = OpLoad %6 %22 +%13804 = OpISub %6 %13802 %13803 +OpStore %1003 %13804 +OpBranch %13789 +%13789 = OpLabel +%13805 = OpLoad %1035 %1054 +%13806 = OpULessThan %1057 %13805 %1072 +OpSelectionMerge %13808 None +OpBranchConditional %13806 %13807 %13808 +%13807 = OpLabel +%13809 = OpLoad %6 %13 +%13810 = OpLoad %6 %14 +%13811 = OpISub %6 %13809 %13810 +%13812 = OpLoad %6 %15 +%13813 = OpISub %6 %13811 %13812 +%13814 = OpLoad %6 %16 +%13815 = OpISub %6 %13813 %13814 +%13816 = OpLoad %6 %19 +%13817 = OpISub %6 %13815 %13816 +%13818 = OpLoad %6 %20 +%13819 = OpISub %6 %13817 %13818 +%13820 = OpLoad %6 %21 +%13821 = OpISub %6 %13819 %13820 +%13822 = OpLoad %6 %22 +%13823 = OpIAdd %6 %13821 %13822 +OpStore %1004 %13823 +OpBranch %13808 +%13808 = OpLabel +%13824 = OpLoad %1035 %1054 +%13825 = OpULessThanEqual %1057 %13824 %1072 +OpSelectionMerge %13827 None +OpBranchConditional %13825 %13826 %13827 +%13826 = OpLabel +%13828 = OpLoad %6 %13 +%13829 = OpLoad %6 %14 +%13830 = OpISub %6 %13828 %13829 +%13831 = OpLoad %6 %15 +%13832 = OpIAdd %6 %13830 %13831 +%13833 = OpLoad %6 %17 +%13834 = OpIAdd %6 %13832 %13833 +%13835 = OpLoad %6 %18 +%13836 = OpIAdd %6 %13834 %13835 +%13837 = OpLoad %6 %19 +%13838 = OpISub %6 %13836 %13837 +%13839 = OpLoad %6 %20 +%13840 = OpISub %6 %13838 %13839 +%13841 = OpLoad %6 %21 +%13842 = OpIAdd %6 %13840 %13841 +OpStore %1005 %13842 +OpBranch %13827 +%13827 = OpLabel +%13843 = OpLoad %1035 %1054 +%13844 = OpIEqual %1057 %13843 %1138 +OpSelectionMerge %13846 None +OpBranchConditional %13844 %13845 %13846 +%13845 = OpLabel +%13847 = OpLoad %6 %13 +%13848 = OpLoad %6 %14 +%13849 = OpIAdd %6 %13847 %13848 +%13850 = OpLoad %6 %15 +%13851 = OpISub %6 %13849 %13850 +%13852 = OpLoad %6 %17 +%13853 = OpISub %6 %13851 %13852 +%13854 = OpLoad %6 %18 +%13855 = OpIAdd %6 %13853 %13854 +%13856 = OpLoad %6 %19 +%13857 = OpISub %6 %13855 %13856 +%13858 = OpLoad %6 %20 +%13859 = OpIAdd %6 %13857 %13858 +%13860 = OpLoad %6 %22 +%13861 = OpIAdd %6 %13859 %13860 +OpStore %1006 %13861 +OpBranch %13846 +%13846 = OpLabel +%13862 = OpLoad %1035 %1054 +%13863 = OpINotEqual %1057 %13862 %1094 +OpSelectionMerge %13865 None +OpBranchConditional %13863 %13864 %13865 +%13864 = OpLabel +%13866 = OpLoad %6 %13 +%13867 = OpLoad %6 %14 +%13868 = OpISub %6 %13866 %13867 +%13869 = OpLoad %6 %15 +%13870 = OpIAdd %6 %13868 %13869 +%13871 = OpLoad %6 %17 +%13872 = OpISub %6 %13870 %13871 +%13873 = OpLoad %6 %18 +%13874 = OpISub %6 %13872 %13873 +%13875 = OpLoad %6 %19 +%13876 = OpISub %6 %13874 %13875 +%13877 = OpLoad %6 %21 +%13878 = OpISub %6 %13876 %13877 +%13879 = OpLoad %6 %22 +%13880 = OpIAdd %6 %13878 %13879 +OpStore %1007 %13880 +OpBranch %13865 +%13865 = OpLabel +%13881 = OpLoad %1035 %1054 +%13882 = OpIEqual %1057 %13881 %1138 +OpSelectionMerge %13884 None +OpBranchConditional %13882 %13883 %13884 +%13883 = OpLabel +%13885 = OpLoad %6 %13 +%13886 = OpLoad %6 %14 +%13887 = OpISub %6 %13885 %13886 +%13888 = OpLoad %6 %15 +%13889 = OpIAdd %6 %13887 %13888 +%13890 = OpLoad %6 %17 +%13891 = OpIAdd %6 %13889 %13890 +%13892 = OpLoad %6 %18 +%13893 = OpIAdd %6 %13891 %13892 +%13894 = OpLoad %6 %20 +%13895 = OpIAdd %6 %13893 %13894 +%13896 = OpLoad %6 %21 +%13897 = OpISub %6 %13895 %13896 +%13898 = OpLoad %6 %22 +%13899 = OpISub %6 %13897 %13898 +OpStore %1008 %13899 +OpBranch %13884 +%13884 = OpLabel +%13900 = OpLoad %1035 %1054 +%13901 = OpULessThan %1057 %13900 %1094 +OpSelectionMerge %13903 None +OpBranchConditional %13901 %13902 %13903 +%13902 = OpLabel +%13904 = OpLoad %6 %13 +%13905 = OpLoad %6 %14 +%13906 = OpIAdd %6 %13904 %13905 +%13907 = OpLoad %6 %15 +%13908 = OpISub %6 %13906 %13907 +%13909 = OpLoad %6 %17 +%13910 = OpISub %6 %13908 %13909 +%13911 = OpLoad %6 %19 +%13912 = OpIAdd %6 %13910 %13911 +%13913 = OpLoad %6 %20 +%13914 = OpIAdd %6 %13912 %13913 +%13915 = OpLoad %6 %21 +%13916 = OpISub %6 %13914 %13915 +%13917 = OpLoad %6 %22 +%13918 = OpISub %6 %13916 %13917 +OpStore %1009 %13918 +OpBranch %13903 +%13903 = OpLabel +%13919 = OpLoad %1035 %1054 +%13920 = OpULessThan %1057 %13919 %1094 +OpSelectionMerge %13922 None +OpBranchConditional %13920 %13921 %13922 +%13921 = OpLabel +%13923 = OpLoad %6 %13 +%13924 = OpLoad %6 %14 +%13925 = OpISub %6 %13923 %13924 +%13926 = OpLoad %6 %15 +%13927 = OpISub %6 %13925 %13926 +%13928 = OpLoad %6 %18 +%13929 = OpIAdd %6 %13927 %13928 +%13930 = OpLoad %6 %19 +%13931 = OpIAdd %6 %13929 %13930 +%13932 = OpLoad %6 %20 +%13933 = OpISub %6 %13931 %13932 +%13934 = OpLoad %6 %21 +%13935 = OpISub %6 %13933 %13934 +%13936 = OpLoad %6 %22 +%13937 = OpISub %6 %13935 %13936 +OpStore %1010 %13937 +OpBranch %13922 +%13922 = OpLabel +%13938 = OpLoad %1035 %1054 +%13939 = OpULessThan %1057 %13938 %1138 +OpSelectionMerge %13941 None +OpBranchConditional %13939 %13940 %13941 +%13940 = OpLabel +%13942 = OpLoad %6 %13 +%13943 = OpLoad %6 %14 +%13944 = OpISub %6 %13942 %13943 +%13945 = OpLoad %6 %16 +%13946 = OpISub %6 %13944 %13945 +%13947 = OpLoad %6 %17 +%13948 = OpIAdd %6 %13946 %13947 +%13949 = OpLoad %6 %18 +%13950 = OpIAdd %6 %13948 %13949 +%13951 = OpLoad %6 %19 +%13952 = OpIAdd %6 %13950 %13951 +%13953 = OpLoad %6 %20 +%13954 = OpIAdd %6 %13952 %13953 +%13955 = OpLoad %6 %21 +%13956 = OpISub %6 %13954 %13955 +OpStore %1011 %13956 +OpBranch %13941 +%13941 = OpLabel +%13957 = OpLoad %1035 %1054 +%13958 = OpINotEqual %1057 %13957 %1138 +OpSelectionMerge %13960 None +OpBranchConditional %13958 %13959 %13960 +%13959 = OpLabel +%13961 = OpLoad %6 %13 +%13962 = OpLoad %6 %14 +%13963 = OpISub %6 %13961 %13962 +%13964 = OpLoad %6 %16 +%13965 = OpIAdd %6 %13963 %13964 +%13966 = OpLoad %6 %17 +%13967 = OpIAdd %6 %13965 %13966 +%13968 = OpLoad %6 %18 +%13969 = OpISub %6 %13967 %13968 +%13970 = OpLoad %6 %19 +%13971 = OpISub %6 %13969 %13970 +%13972 = OpLoad %6 %20 +%13973 = OpIAdd %6 %13971 %13972 +%13974 = OpLoad %6 %22 +%13975 = OpISub %6 %13973 %13974 +OpStore %1012 %13975 +OpBranch %13960 +%13960 = OpLabel +%13976 = OpLoad %1035 %1054 +%13977 = OpUGreaterThan %1057 %13976 %1138 +OpSelectionMerge %13979 None +OpBranchConditional %13977 %13978 %13979 +%13978 = OpLabel +%13980 = OpLoad %6 %14 +%13981 = OpLoad %6 %17 +%13982 = OpISub %6 %13980 %13981 +%13983 = OpLoad %6 %22 +%13984 = OpIAdd %6 %13982 %13983 +OpStore %1013 %13984 +OpBranch %13979 +%13979 = OpLabel +%13985 = OpLoad %1035 %1054 +%13986 = OpULessThan %1057 %13985 %1138 +OpSelectionMerge %13988 None +OpBranchConditional %13986 %13987 %13988 +%13987 = OpLabel +%13989 = OpLoad %6 %13 +%13990 = OpLoad %6 %14 +%13991 = OpISub %6 %13989 %13990 +%13992 = OpLoad %6 %16 +%13993 = OpISub %6 %13991 %13992 +%13994 = OpLoad %6 %17 +%13995 = OpISub %6 %13993 %13994 +%13996 = OpLoad %6 %18 +%13997 = OpISub %6 %13995 %13996 +%13998 = OpLoad %6 %19 +%13999 = OpISub %6 %13997 %13998 +%14000 = OpLoad %6 %21 +%14001 = OpIAdd %6 %13999 %14000 +%14002 = OpLoad %6 %22 +%14003 = OpISub %6 %14001 %14002 +OpStore %1014 %14003 +OpBranch %13988 +%13988 = OpLabel +%14004 = OpLoad %1035 %1054 +%14005 = OpULessThan %1057 %14004 %1138 +OpSelectionMerge %14007 None +OpBranchConditional %14005 %14006 %14007 +%14006 = OpLabel +%14008 = OpLoad %6 %13 +%14009 = OpLoad %6 %14 +%14010 = OpISub %6 %14008 %14009 +%14011 = OpLoad %6 %16 +%14012 = OpIAdd %6 %14010 %14011 +%14013 = OpLoad %6 %17 +%14014 = OpIAdd %6 %14012 %14013 +%14015 = OpLoad %6 %18 +%14016 = OpIAdd %6 %14014 %14015 +%14017 = OpLoad %6 %20 +%14018 = OpIAdd %6 %14016 %14017 +%14019 = OpLoad %6 %21 +%14020 = OpISub %6 %14018 %14019 +%14021 = OpLoad %6 %22 +%14022 = OpIAdd %6 %14020 %14021 +OpStore %1015 %14022 +OpBranch %14007 +%14007 = OpLabel +%14023 = OpLoad %1035 %1054 +%14024 = OpULessThanEqual %1057 %14023 %1094 +OpSelectionMerge %14026 None +OpBranchConditional %14024 %14025 %14026 +%14025 = OpLabel +%14027 = OpLoad %6 %13 +%14028 = OpLoad %6 %14 +%14029 = OpIAdd %6 %14027 %14028 +%14030 = OpLoad %6 %16 +%14031 = OpISub %6 %14029 %14030 +%14032 = OpLoad %6 %17 +%14033 = OpIAdd %6 %14031 %14032 +%14034 = OpLoad %6 %19 +%14035 = OpIAdd %6 %14033 %14034 +%14036 = OpLoad %6 %20 +%14037 = OpISub %6 %14035 %14036 +%14038 = OpLoad %6 %21 +%14039 = OpISub %6 %14037 %14038 +%14040 = OpLoad %6 %22 +%14041 = OpISub %6 %14039 %14040 +OpStore %1016 %14041 +OpBranch %14026 +%14026 = OpLabel +%14042 = OpLoad %1035 %1054 +%14043 = OpUGreaterThanEqual %1057 %14042 %1056 +OpSelectionMerge %14045 None +OpBranchConditional %14043 %14044 %14045 +%14044 = OpLabel +%14046 = OpLoad %6 %13 +%14047 = OpLoad %6 %14 +%14048 = OpIAdd %6 %14046 %14047 +%14049 = OpLoad %6 %16 +%14050 = OpISub %6 %14048 %14049 +%14051 = OpLoad %6 %18 +%14052 = OpISub %6 %14050 %14051 +%14053 = OpLoad %6 %19 +%14054 = OpIAdd %6 %14052 %14053 +%14055 = OpLoad %6 %20 +%14056 = OpISub %6 %14054 %14055 +%14057 = OpLoad %6 %21 +%14058 = OpIAdd %6 %14056 %14057 +%14059 = OpLoad %6 %22 +%14060 = OpISub %6 %14058 %14059 +OpStore %1017 %14060 +OpBranch %14045 +%14045 = OpLabel +%14061 = OpLoad %1035 %1054 +%14062 = OpULessThanEqual %1057 %14061 %1056 +OpSelectionMerge %14064 None +OpBranchConditional %14062 %14063 %14064 +%14063 = OpLabel +%14065 = OpLoad %6 %13 +%14066 = OpLoad %6 %14 +%14067 = OpIAdd %6 %14065 %14066 +%14068 = OpLoad %6 %17 +%14069 = OpISub %6 %14067 %14068 +%14070 = OpLoad %6 %18 +%14071 = OpIAdd %6 %14069 %14070 +%14072 = OpLoad %6 %19 +%14073 = OpISub %6 %14071 %14072 +%14074 = OpLoad %6 %20 +%14075 = OpISub %6 %14073 %14074 +%14076 = OpLoad %6 %21 +%14077 = OpISub %6 %14075 %14076 +%14078 = OpLoad %6 %22 +%14079 = OpIAdd %6 %14077 %14078 +OpStore %1018 %14079 +OpBranch %14064 +%14064 = OpLabel +%14080 = OpLoad %1035 %1054 +%14081 = OpUGreaterThanEqual %1057 %14080 %1138 +OpSelectionMerge %14083 None +OpBranchConditional %14081 %14082 %14083 +%14082 = OpLabel +%14084 = OpLoad %6 %13 +%14085 = OpLoad %6 %15 +%14086 = OpISub %6 %14084 %14085 +%14087 = OpLoad %6 %16 +%14088 = OpISub %6 %14086 %14087 +%14089 = OpLoad %6 %17 +%14090 = OpIAdd %6 %14088 %14089 +%14091 = OpLoad %6 %18 +%14092 = OpISub %6 %14090 %14091 +%14093 = OpLoad %6 %19 +%14094 = OpISub %6 %14092 %14093 +%14095 = OpLoad %6 %20 +%14096 = OpIAdd %6 %14094 %14095 +%14097 = OpLoad %6 %21 +%14098 = OpISub %6 %14096 %14097 +OpStore %1019 %14098 +OpBranch %14083 +%14083 = OpLabel +%14099 = OpLoad %1035 %1054 +%14100 = OpUGreaterThan %1057 %14099 %1072 +OpSelectionMerge %14102 None +OpBranchConditional %14100 %14101 %14102 +%14101 = OpLabel +%14103 = OpLoad %6 %13 +%14104 = OpLoad %6 %15 +%14105 = OpIAdd %6 %14103 %14104 +%14106 = OpLoad %6 %16 +%14107 = OpISub %6 %14105 %14106 +%14108 = OpLoad %6 %17 +%14109 = OpISub %6 %14107 %14108 +%14110 = OpLoad %6 %18 +%14111 = OpISub %6 %14109 %14110 +%14112 = OpLoad %6 %19 +%14113 = OpISub %6 %14111 %14112 +%14114 = OpLoad %6 %20 +%14115 = OpISub %6 %14113 %14114 +%14116 = OpLoad %6 %22 +%14117 = OpIAdd %6 %14115 %14116 +OpStore %1020 %14117 +OpBranch %14102 +%14102 = OpLabel +%14118 = OpLoad %1035 %1054 +%14119 = OpINotEqual %1057 %14118 %1094 +OpSelectionMerge %14121 None +OpBranchConditional %14119 %14120 %14121 +%14120 = OpLabel +%14122 = OpLoad %6 %13 +%14123 = OpLoad %6 %15 +%14124 = OpIAdd %6 %14122 %14123 +%14125 = OpLoad %6 %16 +%14126 = OpIAdd %6 %14124 %14125 +%14127 = OpLoad %6 %17 +%14128 = OpIAdd %6 %14126 %14127 +%14129 = OpLoad %6 %18 +%14130 = OpIAdd %6 %14128 %14129 +%14131 = OpLoad %6 %19 +%14132 = OpIAdd %6 %14130 %14131 +%14133 = OpLoad %6 %21 +%14134 = OpIAdd %6 %14132 %14133 +%14135 = OpLoad %6 %22 +%14136 = OpIAdd %6 %14134 %14135 +OpStore %1021 %14136 +OpBranch %14121 +%14121 = OpLabel +%14137 = OpLoad %1035 %1054 +%14138 = OpINotEqual %1057 %14137 %1056 +OpSelectionMerge %14140 None +OpBranchConditional %14138 %14139 %14140 +%14139 = OpLabel +%14141 = OpLoad %6 %13 +%14142 = OpLoad %6 %15 +%14143 = OpIAdd %6 %14141 %14142 +%14144 = OpLoad %6 %16 +%14145 = OpISub %6 %14143 %14144 +%14146 = OpLoad %6 %17 +%14147 = OpIAdd %6 %14145 %14146 +%14148 = OpLoad %6 %18 +%14149 = OpIAdd %6 %14147 %14148 +%14150 = OpLoad %6 %20 +%14151 = OpIAdd %6 %14149 %14150 +%14152 = OpLoad %6 %21 +%14153 = OpISub %6 %14151 %14152 +%14154 = OpLoad %6 %22 +%14155 = OpIAdd %6 %14153 %14154 +OpStore %1022 %14155 +OpBranch %14140 +%14140 = OpLabel +%14156 = OpLoad %1035 %1054 +%14157 = OpULessThan %1057 %14156 %1094 +OpSelectionMerge %14159 None +OpBranchConditional %14157 %14158 %14159 +%14158 = OpLabel +%14160 = OpLoad %6 %13 +%14161 = OpLoad %6 %15 +%14162 = OpIAdd %6 %14160 %14161 +%14163 = OpLoad %6 %16 +%14164 = OpISub %6 %14162 %14163 +%14165 = OpLoad %6 %17 +%14166 = OpIAdd %6 %14164 %14165 +%14167 = OpLoad %6 %19 +%14168 = OpIAdd %6 %14166 %14167 +%14169 = OpLoad %6 %20 +%14170 = OpISub %6 %14168 %14169 +%14171 = OpLoad %6 %21 +%14172 = OpIAdd %6 %14170 %14171 +%14173 = OpLoad %6 %22 +%14174 = OpIAdd %6 %14172 %14173 +OpStore %1023 %14174 +OpBranch %14159 +%14159 = OpLabel +%14175 = OpLoad %1035 %1054 +%14176 = OpIEqual %1057 %14175 %1094 +OpSelectionMerge %14178 None +OpBranchConditional %14176 %14177 %14178 +%14177 = OpLabel +%14179 = OpLoad %6 %14 +%14180 = OpLoad %6 %18 +%14181 = OpISub %6 %14179 %14180 +%14182 = OpLoad %6 %19 +%14183 = OpISub %6 %14181 %14182 +OpStore %1024 %14183 +OpBranch %14178 +%14178 = OpLabel +%14184 = OpLoad %1035 %1054 +%14185 = OpULessThan %1057 %14184 %1072 +OpSelectionMerge %14187 None +OpBranchConditional %14185 %14186 %14187 +%14186 = OpLabel +%14188 = OpLoad %6 %13 +%14189 = OpLoad %6 %15 +%14190 = OpISub %6 %14188 %14189 +%14191 = OpLoad %6 %16 +%14192 = OpIAdd %6 %14190 %14191 +%14193 = OpLoad %6 %18 +%14194 = OpIAdd %6 %14192 %14193 +%14195 = OpLoad %6 %19 +%14196 = OpISub %6 %14194 %14195 +%14197 = OpLoad %6 %20 +%14198 = OpISub %6 %14196 %14197 +%14199 = OpLoad %6 %21 +%14200 = OpISub %6 %14198 %14199 +%14201 = OpLoad %6 %22 +%14202 = OpIAdd %6 %14200 %14201 +OpStore %1025 %14202 +OpBranch %14187 +%14187 = OpLabel +%14203 = OpLoad %1035 %1054 +%14204 = OpIEqual %1057 %14203 %1138 +OpSelectionMerge %14206 None +OpBranchConditional %14204 %14205 %14206 +%14205 = OpLabel +%14207 = OpLoad %6 %13 +%14208 = OpLoad %6 %15 +%14209 = OpISub %6 %14207 %14208 +%14210 = OpLoad %6 %17 +%14211 = OpISub %6 %14209 %14210 +%14212 = OpLoad %6 %18 +%14213 = OpIAdd %6 %14211 %14212 +%14214 = OpLoad %6 %19 +%14215 = OpIAdd %6 %14213 %14214 +%14216 = OpLoad %6 %20 +%14217 = OpISub %6 %14215 %14216 +%14218 = OpLoad %6 %21 +%14219 = OpISub %6 %14217 %14218 +%14220 = OpLoad %6 %22 +%14221 = OpIAdd %6 %14219 %14220 +OpStore %1026 %14221 +OpBranch %14206 +%14206 = OpLabel +%14222 = OpLoad %1035 %1054 +%14223 = OpUGreaterThan %1057 %14222 %1094 +OpSelectionMerge %14225 None +OpBranchConditional %14223 %14224 %14225 +%14224 = OpLabel +%14226 = OpLoad %6 %13 +%14227 = OpLoad %6 %16 +%14228 = OpIAdd %6 %14226 %14227 +%14229 = OpLoad %6 %17 +%14230 = OpISub %6 %14228 %14229 +%14231 = OpLoad %6 %18 +%14232 = OpISub %6 %14230 %14231 +%14233 = OpLoad %6 %19 +%14234 = OpISub %6 %14232 %14233 +%14235 = OpLoad %6 %20 +%14236 = OpIAdd %6 %14234 %14235 +%14237 = OpLoad %6 %21 +%14238 = OpIAdd %6 %14236 %14237 +%14239 = OpLoad %6 %22 +%14240 = OpIAdd %6 %14238 %14239 +OpStore %1027 %14240 +OpBranch %14225 +%14225 = OpLabel +%14241 = OpLoad %1035 %1054 +%14242 = OpULessThanEqual %1057 %14241 %1094 +OpSelectionMerge %14244 None +OpBranchConditional %14242 %14243 %14244 +%14243 = OpLabel +%14245 = OpLoad %6 %14 +%14246 = OpLoad %6 %15 +%14247 = OpIAdd %6 %14245 %14246 +%14248 = OpLoad %6 %16 +%14249 = OpIAdd %6 %14247 %14248 +%14250 = OpLoad %6 %17 +%14251 = OpISub %6 %14249 %14250 +%14252 = OpLoad %6 %18 +%14253 = OpISub %6 %14251 %14252 +%14254 = OpLoad %6 %19 +%14255 = OpISub %6 %14253 %14254 +%14256 = OpLoad %6 %20 +%14257 = OpISub %6 %14255 %14256 +%14258 = OpLoad %6 %21 +%14259 = OpIAdd %6 %14257 %14258 +OpStore %1028 %14259 +OpBranch %14244 +%14244 = OpLabel +%14260 = OpLoad %1035 %1054 +%14261 = OpUGreaterThan %1057 %14260 %1072 +OpSelectionMerge %14263 None +OpBranchConditional %14261 %14262 %14263 +%14262 = OpLabel +%14264 = OpLoad %6 %14 +%14265 = OpLoad %6 %15 +%14266 = OpISub %6 %14264 %14265 +%14267 = OpLoad %6 %16 +%14268 = OpIAdd %6 %14266 %14267 +%14269 = OpLoad %6 %17 +%14270 = OpIAdd %6 %14268 %14269 +%14271 = OpLoad %6 %18 +%14272 = OpIAdd %6 %14270 %14271 +%14273 = OpLoad %6 %19 +%14274 = OpIAdd %6 %14272 %14273 +%14275 = OpLoad %6 %20 +%14276 = OpIAdd %6 %14274 %14275 +%14277 = OpLoad %6 %22 +%14278 = OpISub %6 %14276 %14277 +OpStore %1029 %14278 +OpBranch %14263 +%14263 = OpLabel +%14279 = OpLoad %1035 %1054 +%14280 = OpUGreaterThan %1057 %14279 %1072 +OpSelectionMerge %14282 None +OpBranchConditional %14280 %14281 %14282 +%14281 = OpLabel +%14283 = OpLoad %6 %14 +%14284 = OpLoad %6 %15 +%14285 = OpIAdd %6 %14283 %14284 +%14286 = OpLoad %6 %16 +%14287 = OpISub %6 %14285 %14286 +%14288 = OpLoad %6 %17 +%14289 = OpIAdd %6 %14287 %14288 +%14290 = OpLoad %6 %18 +%14291 = OpIAdd %6 %14289 %14290 +%14292 = OpLoad %6 %19 +%14293 = OpISub %6 %14291 %14292 +%14294 = OpLoad %6 %21 +%14295 = OpIAdd %6 %14293 %14294 +%14296 = OpLoad %6 %22 +%14297 = OpIAdd %6 %14295 %14296 +OpStore %1030 %14297 +OpBranch %14282 +%14282 = OpLabel +%14298 = OpLoad %1035 %1054 +%14299 = OpULessThanEqual %1057 %14298 %1072 +OpSelectionMerge %14301 None +OpBranchConditional %14299 %14300 %14301 +%14300 = OpLabel +%14302 = OpLoad %6 %14 +%14303 = OpLoad %6 %15 +%14304 = OpIAdd %6 %14302 %14303 +%14305 = OpLoad %6 %16 +%14306 = OpIAdd %6 %14304 %14305 +%14307 = OpLoad %6 %17 +%14308 = OpIAdd %6 %14306 %14307 +%14309 = OpLoad %6 %18 +%14310 = OpIAdd %6 %14308 %14309 +%14311 = OpLoad %6 %20 +%14312 = OpISub %6 %14310 %14311 +%14313 = OpLoad %6 %21 +%14314 = OpISub %6 %14312 %14313 +%14315 = OpLoad %6 %22 +%14316 = OpISub %6 %14314 %14315 +OpStore %1031 %14316 +OpBranch %14301 +%14301 = OpLabel +%14317 = OpLoad %1035 %1054 +%14318 = OpINotEqual %1057 %14317 %1056 +OpSelectionMerge %14320 None +OpBranchConditional %14318 %14319 %14320 +%14319 = OpLabel +%14321 = OpLoad %6 %14 +%14322 = OpLoad %6 %15 +%14323 = OpIAdd %6 %14321 %14322 +%14324 = OpLoad %6 %16 +%14325 = OpIAdd %6 %14323 %14324 +%14326 = OpLoad %6 %17 +%14327 = OpIAdd %6 %14325 %14326 +%14328 = OpLoad %6 %19 +%14329 = OpIAdd %6 %14327 %14328 +%14330 = OpLoad %6 %20 +%14331 = OpISub %6 %14329 %14330 +%14332 = OpLoad %6 %21 +%14333 = OpISub %6 %14331 %14332 +%14334 = OpLoad %6 %22 +%14335 = OpISub %6 %14333 %14334 +OpStore %1032 %14335 +OpBranch %14320 +%14320 = OpLabel +%14336 = OpLoad %1035 %1054 +%14337 = OpIEqual %1057 %14336 %1138 +OpSelectionMerge %14339 None +OpBranchConditional %14337 %14338 %14339 +%14338 = OpLabel +%14340 = OpLoad %6 %14 +%14341 = OpLoad %6 %15 +%14342 = OpIAdd %6 %14340 %14341 +%14343 = OpLoad %6 %16 +%14344 = OpIAdd %6 %14342 %14343 +%14345 = OpLoad %6 %18 +%14346 = OpISub %6 %14344 %14345 +%14347 = OpLoad %6 %19 +%14348 = OpISub %6 %14346 %14347 +%14349 = OpLoad %6 %20 +%14350 = OpIAdd %6 %14348 %14349 +%14351 = OpLoad %6 %21 +%14352 = OpISub %6 %14350 %14351 +%14353 = OpLoad %6 %22 +%14354 = OpISub %6 %14352 %14353 +OpStore %1033 %14354 +OpBranch %14339 +%14339 = OpLabel +%14355 = OpLoad %1035 %1054 +%14356 = OpINotEqual %1057 %14355 %1138 +OpSelectionMerge %14358 None +OpBranchConditional %14356 %14357 %14358 +%14357 = OpLabel +%14359 = OpLoad %6 %14 +%14360 = OpLoad %6 %15 +%14361 = OpISub %6 %14359 %14360 +%14362 = OpLoad %6 %17 +%14363 = OpIAdd %6 %14361 %14362 +%14364 = OpLoad %6 %18 +%14365 = OpIAdd %6 %14363 %14364 +%14366 = OpLoad %6 %19 +%14367 = OpISub %6 %14365 %14366 +%14368 = OpLoad %6 %20 +%14369 = OpISub %6 %14367 %14368 +%14370 = OpLoad %6 %21 +%14371 = OpIAdd %6 %14369 %14370 +%14372 = OpLoad %6 %22 +%14373 = OpIAdd %6 %14371 %14372 +OpStore %1034 %14373 +OpBranch %14358 +%14358 = OpLabel +%14375 = OpLoad %6 %23 +%14376 = OpLoad %6 %24 +%14377 = OpIAdd %6 %14375 %14376 +%14378 = OpLoad %6 %147 +%14379 = OpIAdd %6 %14377 %14378 +%14380 = OpLoad %6 %258 +%14381 = OpIAdd %6 %14379 %14380 +%14382 = OpLoad %6 %369 +%14383 = OpIAdd %6 %14381 %14382 +%14384 = OpLoad %6 %480 +%14385 = OpIAdd %6 %14383 %14384 +%14386 = OpLoad %6 %591 +%14387 = OpIAdd %6 %14385 %14386 +%14388 = OpLoad %6 %702 +%14389 = OpIAdd %6 %14387 %14388 +%14390 = OpLoad %6 %813 +%14391 = OpIAdd %6 %14389 %14390 +%14392 = OpLoad %6 %924 +%14393 = OpIAdd %6 %14391 %14392 +%14394 = OpLoad %6 %25 +%14395 = OpIAdd %6 %14393 %14394 +%14396 = OpLoad %6 %48 +%14397 = OpIAdd %6 %14395 %14396 +%14398 = OpLoad %6 %59 +%14399 = OpIAdd %6 %14397 %14398 +%14400 = OpLoad %6 %70 +%14401 = OpIAdd %6 %14399 %14400 +%14402 = OpLoad %6 %81 +%14403 = OpIAdd %6 %14401 %14402 +%14404 = OpLoad %6 %92 +%14405 = OpIAdd %6 %14403 %14404 +%14406 = OpLoad %6 %103 +%14407 = OpIAdd %6 %14405 %14406 +%14408 = OpLoad %6 %114 +%14409 = OpIAdd %6 %14407 %14408 +%14410 = OpLoad %6 %125 +%14411 = OpIAdd %6 %14409 %14410 +%14412 = OpLoad %6 %136 +%14413 = OpIAdd %6 %14411 %14412 +%14414 = OpLoad %6 %148 +%14415 = OpIAdd %6 %14413 %14414 +%14416 = OpLoad %6 %159 +%14417 = OpIAdd %6 %14415 %14416 +%14418 = OpLoad %6 %170 +%14419 = OpIAdd %6 %14417 %14418 +%14420 = OpLoad %6 %181 +%14421 = OpIAdd %6 %14419 %14420 +%14422 = OpLoad %6 %192 +%14423 = OpIAdd %6 %14421 %14422 +%14424 = OpLoad %6 %203 +%14425 = OpIAdd %6 %14423 %14424 +%14426 = OpLoad %6 %214 +%14427 = OpIAdd %6 %14425 %14426 +%14428 = OpLoad %6 %225 +%14429 = OpIAdd %6 %14427 %14428 +%14430 = OpLoad %6 %236 +%14431 = OpIAdd %6 %14429 %14430 +%14432 = OpLoad %6 %247 +%14433 = OpIAdd %6 %14431 %14432 +%14434 = OpLoad %6 %259 +%14435 = OpIAdd %6 %14433 %14434 +%14436 = OpLoad %6 %270 +%14437 = OpIAdd %6 %14435 %14436 +%14438 = OpLoad %6 %281 +%14439 = OpIAdd %6 %14437 %14438 +%14440 = OpLoad %6 %292 +%14441 = OpIAdd %6 %14439 %14440 +%14442 = OpLoad %6 %303 +%14443 = OpIAdd %6 %14441 %14442 +%14444 = OpLoad %6 %314 +%14445 = OpIAdd %6 %14443 %14444 +%14446 = OpLoad %6 %325 +%14447 = OpIAdd %6 %14445 %14446 +%14448 = OpLoad %6 %336 +%14449 = OpIAdd %6 %14447 %14448 +%14450 = OpLoad %6 %347 +%14451 = OpIAdd %6 %14449 %14450 +%14452 = OpLoad %6 %358 +%14453 = OpIAdd %6 %14451 %14452 +%14454 = OpLoad %6 %370 +%14455 = OpIAdd %6 %14453 %14454 +%14456 = OpLoad %6 %381 +%14457 = OpIAdd %6 %14455 %14456 +%14458 = OpLoad %6 %392 +%14459 = OpIAdd %6 %14457 %14458 +%14460 = OpLoad %6 %403 +%14461 = OpIAdd %6 %14459 %14460 +%14462 = OpLoad %6 %414 +%14463 = OpIAdd %6 %14461 %14462 +%14464 = OpLoad %6 %425 +%14465 = OpIAdd %6 %14463 %14464 +%14466 = OpLoad %6 %436 +%14467 = OpIAdd %6 %14465 %14466 +%14468 = OpLoad %6 %447 +%14469 = OpIAdd %6 %14467 %14468 +%14470 = OpLoad %6 %458 +%14471 = OpIAdd %6 %14469 %14470 +%14472 = OpLoad %6 %469 +%14473 = OpIAdd %6 %14471 %14472 +%14474 = OpLoad %6 %481 +%14475 = OpIAdd %6 %14473 %14474 +%14476 = OpLoad %6 %492 +%14477 = OpIAdd %6 %14475 %14476 +%14478 = OpLoad %6 %503 +%14479 = OpIAdd %6 %14477 %14478 +%14480 = OpLoad %6 %514 +%14481 = OpIAdd %6 %14479 %14480 +%14482 = OpLoad %6 %525 +%14483 = OpIAdd %6 %14481 %14482 +%14484 = OpLoad %6 %536 +%14485 = OpIAdd %6 %14483 %14484 +%14486 = OpLoad %6 %547 +%14487 = OpIAdd %6 %14485 %14486 +%14488 = OpLoad %6 %558 +%14489 = OpIAdd %6 %14487 %14488 +%14490 = OpLoad %6 %569 +%14491 = OpIAdd %6 %14489 %14490 +%14492 = OpLoad %6 %580 +%14493 = OpIAdd %6 %14491 %14492 +%14494 = OpLoad %6 %592 +%14495 = OpIAdd %6 %14493 %14494 +%14496 = OpLoad %6 %603 +%14497 = OpIAdd %6 %14495 %14496 +%14498 = OpLoad %6 %614 +%14499 = OpIAdd %6 %14497 %14498 +%14500 = OpLoad %6 %625 +%14501 = OpIAdd %6 %14499 %14500 +%14502 = OpLoad %6 %636 +%14503 = OpIAdd %6 %14501 %14502 +%14504 = OpLoad %6 %647 +%14505 = OpIAdd %6 %14503 %14504 +%14506 = OpLoad %6 %658 +%14507 = OpIAdd %6 %14505 %14506 +%14508 = OpLoad %6 %669 +%14509 = OpIAdd %6 %14507 %14508 +%14510 = OpLoad %6 %680 +%14511 = OpIAdd %6 %14509 %14510 +%14512 = OpLoad %6 %691 +%14513 = OpIAdd %6 %14511 %14512 +%14514 = OpLoad %6 %703 +%14515 = OpIAdd %6 %14513 %14514 +%14516 = OpLoad %6 %714 +%14517 = OpIAdd %6 %14515 %14516 +%14518 = OpLoad %6 %725 +%14519 = OpIAdd %6 %14517 %14518 +%14520 = OpLoad %6 %736 +%14521 = OpIAdd %6 %14519 %14520 +%14522 = OpLoad %6 %747 +%14523 = OpIAdd %6 %14521 %14522 +%14524 = OpLoad %6 %758 +%14525 = OpIAdd %6 %14523 %14524 +%14526 = OpLoad %6 %769 +%14527 = OpIAdd %6 %14525 %14526 +%14528 = OpLoad %6 %780 +%14529 = OpIAdd %6 %14527 %14528 +%14530 = OpLoad %6 %791 +%14531 = OpIAdd %6 %14529 %14530 +%14532 = OpLoad %6 %802 +%14533 = OpIAdd %6 %14531 %14532 +%14534 = OpLoad %6 %814 +%14535 = OpIAdd %6 %14533 %14534 +%14536 = OpLoad %6 %825 +%14537 = OpIAdd %6 %14535 %14536 +%14538 = OpLoad %6 %836 +%14539 = OpIAdd %6 %14537 %14538 +%14540 = OpLoad %6 %847 +%14541 = OpIAdd %6 %14539 %14540 +%14542 = OpLoad %6 %858 +%14543 = OpIAdd %6 %14541 %14542 +%14544 = OpLoad %6 %869 +%14545 = OpIAdd %6 %14543 %14544 +%14546 = OpLoad %6 %880 +%14547 = OpIAdd %6 %14545 %14546 +%14548 = OpLoad %6 %891 +%14549 = OpIAdd %6 %14547 %14548 +%14550 = OpLoad %6 %902 +%14551 = OpIAdd %6 %14549 %14550 +%14552 = OpLoad %6 %913 +%14553 = OpIAdd %6 %14551 %14552 +%14554 = OpLoad %6 %925 +%14555 = OpIAdd %6 %14553 %14554 +%14556 = OpLoad %6 %936 +%14557 = OpIAdd %6 %14555 %14556 +%14558 = OpLoad %6 %947 +%14559 = OpIAdd %6 %14557 %14558 +%14560 = OpLoad %6 %958 +%14561 = OpIAdd %6 %14559 %14560 +%14562 = OpLoad %6 %969 +%14563 = OpIAdd %6 %14561 %14562 +%14564 = OpLoad %6 %980 +%14565 = OpIAdd %6 %14563 %14564 +%14566 = OpLoad %6 %991 +%14567 = OpIAdd %6 %14565 %14566 +%14568 = OpLoad %6 %1002 +%14569 = OpIAdd %6 %14567 %14568 +%14570 = OpLoad %6 %1013 +%14571 = OpIAdd %6 %14569 %14570 +%14572 = OpLoad %6 %1024 +%14573 = OpIAdd %6 %14571 %14572 +%14574 = OpLoad %6 %26 +%14575 = OpIAdd %6 %14573 %14574 +%14576 = OpLoad %6 %37 +%14577 = OpIAdd %6 %14575 %14576 +%14578 = OpLoad %6 %40 +%14579 = OpIAdd %6 %14577 %14578 +%14580 = OpLoad %6 %41 +%14581 = OpIAdd %6 %14579 %14580 +%14582 = OpLoad %6 %42 +%14583 = OpIAdd %6 %14581 %14582 +%14584 = OpLoad %6 %43 +%14585 = OpIAdd %6 %14583 %14584 +%14586 = OpLoad %6 %44 +%14587 = OpIAdd %6 %14585 %14586 +%14588 = OpLoad %6 %45 +%14589 = OpIAdd %6 %14587 %14588 +%14590 = OpLoad %6 %46 +%14591 = OpIAdd %6 %14589 %14590 +%14592 = OpLoad %6 %47 +%14593 = OpIAdd %6 %14591 %14592 +%14594 = OpLoad %6 %49 +%14595 = OpIAdd %6 %14593 %14594 +%14596 = OpLoad %6 %50 +%14597 = OpIAdd %6 %14595 %14596 +%14598 = OpLoad %6 %51 +%14599 = OpIAdd %6 %14597 %14598 +%14600 = OpLoad %6 %52 +%14601 = OpIAdd %6 %14599 %14600 +%14602 = OpLoad %6 %53 +%14603 = OpIAdd %6 %14601 %14602 +%14604 = OpLoad %6 %54 +%14605 = OpIAdd %6 %14603 %14604 +%14606 = OpLoad %6 %55 +%14607 = OpIAdd %6 %14605 %14606 +%14608 = OpLoad %6 %56 +%14609 = OpIAdd %6 %14607 %14608 +%14610 = OpLoad %6 %57 +%14611 = OpIAdd %6 %14609 %14610 +%14612 = OpLoad %6 %58 +%14613 = OpIAdd %6 %14611 %14612 +%14614 = OpLoad %6 %60 +%14615 = OpIAdd %6 %14613 %14614 +%14616 = OpLoad %6 %61 +%14617 = OpIAdd %6 %14615 %14616 +%14618 = OpLoad %6 %62 +%14619 = OpIAdd %6 %14617 %14618 +%14620 = OpLoad %6 %63 +%14621 = OpIAdd %6 %14619 %14620 +%14622 = OpLoad %6 %64 +%14623 = OpIAdd %6 %14621 %14622 +%14624 = OpLoad %6 %65 +%14625 = OpIAdd %6 %14623 %14624 +%14626 = OpLoad %6 %66 +%14627 = OpIAdd %6 %14625 %14626 +%14628 = OpLoad %6 %67 +%14629 = OpIAdd %6 %14627 %14628 +%14630 = OpLoad %6 %68 +%14631 = OpIAdd %6 %14629 %14630 +%14632 = OpLoad %6 %69 +%14633 = OpIAdd %6 %14631 %14632 +%14634 = OpLoad %6 %71 +%14635 = OpIAdd %6 %14633 %14634 +%14636 = OpLoad %6 %72 +%14637 = OpIAdd %6 %14635 %14636 +%14638 = OpLoad %6 %73 +%14639 = OpIAdd %6 %14637 %14638 +%14640 = OpLoad %6 %74 +%14641 = OpIAdd %6 %14639 %14640 +%14642 = OpLoad %6 %75 +%14643 = OpIAdd %6 %14641 %14642 +%14644 = OpLoad %6 %76 +%14645 = OpIAdd %6 %14643 %14644 +%14646 = OpLoad %6 %77 +%14647 = OpIAdd %6 %14645 %14646 +%14648 = OpLoad %6 %78 +%14649 = OpIAdd %6 %14647 %14648 +%14650 = OpLoad %6 %79 +%14651 = OpIAdd %6 %14649 %14650 +%14652 = OpLoad %6 %80 +%14653 = OpIAdd %6 %14651 %14652 +%14654 = OpLoad %6 %82 +%14655 = OpIAdd %6 %14653 %14654 +%14656 = OpLoad %6 %83 +%14657 = OpIAdd %6 %14655 %14656 +%14658 = OpLoad %6 %84 +%14659 = OpIAdd %6 %14657 %14658 +%14660 = OpLoad %6 %85 +%14661 = OpIAdd %6 %14659 %14660 +%14662 = OpLoad %6 %86 +%14663 = OpIAdd %6 %14661 %14662 +%14664 = OpLoad %6 %87 +%14665 = OpIAdd %6 %14663 %14664 +%14666 = OpLoad %6 %88 +%14667 = OpIAdd %6 %14665 %14666 +%14668 = OpLoad %6 %89 +%14669 = OpIAdd %6 %14667 %14668 +%14670 = OpLoad %6 %90 +%14671 = OpIAdd %6 %14669 %14670 +%14672 = OpLoad %6 %91 +%14673 = OpIAdd %6 %14671 %14672 +%14674 = OpLoad %6 %93 +%14675 = OpIAdd %6 %14673 %14674 +%14676 = OpLoad %6 %94 +%14677 = OpIAdd %6 %14675 %14676 +%14678 = OpLoad %6 %95 +%14679 = OpIAdd %6 %14677 %14678 +%14680 = OpLoad %6 %96 +%14681 = OpIAdd %6 %14679 %14680 +%14682 = OpLoad %6 %97 +%14683 = OpIAdd %6 %14681 %14682 +%14684 = OpLoad %6 %98 +%14685 = OpIAdd %6 %14683 %14684 +%14686 = OpLoad %6 %99 +%14687 = OpIAdd %6 %14685 %14686 +%14688 = OpLoad %6 %100 +%14689 = OpIAdd %6 %14687 %14688 +%14690 = OpLoad %6 %101 +%14691 = OpIAdd %6 %14689 %14690 +%14692 = OpLoad %6 %102 +%14693 = OpIAdd %6 %14691 %14692 +%14694 = OpLoad %6 %104 +%14695 = OpIAdd %6 %14693 %14694 +%14696 = OpLoad %6 %105 +%14697 = OpIAdd %6 %14695 %14696 +%14698 = OpLoad %6 %106 +%14699 = OpIAdd %6 %14697 %14698 +%14700 = OpLoad %6 %107 +%14701 = OpIAdd %6 %14699 %14700 +%14702 = OpLoad %6 %108 +%14703 = OpIAdd %6 %14701 %14702 +%14704 = OpLoad %6 %109 +%14705 = OpIAdd %6 %14703 %14704 +%14706 = OpLoad %6 %110 +%14707 = OpIAdd %6 %14705 %14706 +%14708 = OpLoad %6 %111 +%14709 = OpIAdd %6 %14707 %14708 +%14710 = OpLoad %6 %112 +%14711 = OpIAdd %6 %14709 %14710 +%14712 = OpLoad %6 %113 +%14713 = OpIAdd %6 %14711 %14712 +%14714 = OpLoad %6 %115 +%14715 = OpIAdd %6 %14713 %14714 +%14716 = OpLoad %6 %116 +%14717 = OpIAdd %6 %14715 %14716 +%14718 = OpLoad %6 %117 +%14719 = OpIAdd %6 %14717 %14718 +%14720 = OpLoad %6 %118 +%14721 = OpIAdd %6 %14719 %14720 +%14722 = OpLoad %6 %119 +%14723 = OpIAdd %6 %14721 %14722 +%14724 = OpLoad %6 %120 +%14725 = OpIAdd %6 %14723 %14724 +%14726 = OpLoad %6 %121 +%14727 = OpIAdd %6 %14725 %14726 +%14728 = OpLoad %6 %122 +%14729 = OpIAdd %6 %14727 %14728 +%14730 = OpLoad %6 %123 +%14731 = OpIAdd %6 %14729 %14730 +%14732 = OpLoad %6 %124 +%14733 = OpIAdd %6 %14731 %14732 +%14734 = OpLoad %6 %126 +%14735 = OpIAdd %6 %14733 %14734 +%14736 = OpLoad %6 %127 +%14737 = OpIAdd %6 %14735 %14736 +%14738 = OpLoad %6 %128 +%14739 = OpIAdd %6 %14737 %14738 +%14740 = OpLoad %6 %129 +%14741 = OpIAdd %6 %14739 %14740 +%14742 = OpLoad %6 %130 +%14743 = OpIAdd %6 %14741 %14742 +%14744 = OpLoad %6 %131 +%14745 = OpIAdd %6 %14743 %14744 +%14746 = OpLoad %6 %132 +%14747 = OpIAdd %6 %14745 %14746 +%14748 = OpLoad %6 %133 +%14749 = OpIAdd %6 %14747 %14748 +%14750 = OpLoad %6 %134 +%14751 = OpIAdd %6 %14749 %14750 +%14752 = OpLoad %6 %135 +%14753 = OpIAdd %6 %14751 %14752 +%14754 = OpLoad %6 %137 +%14755 = OpIAdd %6 %14753 %14754 +%14756 = OpLoad %6 %138 +%14757 = OpIAdd %6 %14755 %14756 +%14758 = OpLoad %6 %139 +%14759 = OpIAdd %6 %14757 %14758 +%14760 = OpLoad %6 %140 +%14761 = OpIAdd %6 %14759 %14760 +%14762 = OpLoad %6 %141 +%14763 = OpIAdd %6 %14761 %14762 +%14764 = OpLoad %6 %142 +%14765 = OpIAdd %6 %14763 %14764 +%14766 = OpLoad %6 %143 +%14767 = OpIAdd %6 %14765 %14766 +%14768 = OpLoad %6 %144 +%14769 = OpIAdd %6 %14767 %14768 +%14770 = OpLoad %6 %145 +%14771 = OpIAdd %6 %14769 %14770 +%14772 = OpLoad %6 %146 +%14773 = OpIAdd %6 %14771 %14772 +%14774 = OpLoad %6 %149 +%14775 = OpIAdd %6 %14773 %14774 +%14776 = OpLoad %6 %150 +%14777 = OpIAdd %6 %14775 %14776 +%14778 = OpLoad %6 %151 +%14779 = OpIAdd %6 %14777 %14778 +%14780 = OpLoad %6 %152 +%14781 = OpIAdd %6 %14779 %14780 +%14782 = OpLoad %6 %153 +%14783 = OpIAdd %6 %14781 %14782 +%14784 = OpLoad %6 %154 +%14785 = OpIAdd %6 %14783 %14784 +%14786 = OpLoad %6 %155 +%14787 = OpIAdd %6 %14785 %14786 +%14788 = OpLoad %6 %156 +%14789 = OpIAdd %6 %14787 %14788 +%14790 = OpLoad %6 %157 +%14791 = OpIAdd %6 %14789 %14790 +%14792 = OpLoad %6 %158 +%14793 = OpIAdd %6 %14791 %14792 +%14794 = OpLoad %6 %160 +%14795 = OpIAdd %6 %14793 %14794 +%14796 = OpLoad %6 %161 +%14797 = OpIAdd %6 %14795 %14796 +%14798 = OpLoad %6 %162 +%14799 = OpIAdd %6 %14797 %14798 +%14800 = OpLoad %6 %163 +%14801 = OpIAdd %6 %14799 %14800 +%14802 = OpLoad %6 %164 +%14803 = OpIAdd %6 %14801 %14802 +%14804 = OpLoad %6 %165 +%14805 = OpIAdd %6 %14803 %14804 +%14806 = OpLoad %6 %166 +%14807 = OpIAdd %6 %14805 %14806 +%14808 = OpLoad %6 %167 +%14809 = OpIAdd %6 %14807 %14808 +%14810 = OpLoad %6 %168 +%14811 = OpIAdd %6 %14809 %14810 +%14812 = OpLoad %6 %169 +%14813 = OpIAdd %6 %14811 %14812 +%14814 = OpLoad %6 %171 +%14815 = OpIAdd %6 %14813 %14814 +%14816 = OpLoad %6 %172 +%14817 = OpIAdd %6 %14815 %14816 +%14818 = OpLoad %6 %173 +%14819 = OpIAdd %6 %14817 %14818 +%14820 = OpLoad %6 %174 +%14821 = OpIAdd %6 %14819 %14820 +%14822 = OpLoad %6 %175 +%14823 = OpIAdd %6 %14821 %14822 +%14824 = OpLoad %6 %176 +%14825 = OpIAdd %6 %14823 %14824 +%14826 = OpLoad %6 %177 +%14827 = OpIAdd %6 %14825 %14826 +%14828 = OpLoad %6 %178 +%14829 = OpIAdd %6 %14827 %14828 +%14830 = OpLoad %6 %179 +%14831 = OpIAdd %6 %14829 %14830 +%14832 = OpLoad %6 %180 +%14833 = OpIAdd %6 %14831 %14832 +%14834 = OpLoad %6 %182 +%14835 = OpIAdd %6 %14833 %14834 +%14836 = OpLoad %6 %183 +%14837 = OpIAdd %6 %14835 %14836 +%14838 = OpLoad %6 %184 +%14839 = OpIAdd %6 %14837 %14838 +%14840 = OpLoad %6 %185 +%14841 = OpIAdd %6 %14839 %14840 +%14842 = OpLoad %6 %186 +%14843 = OpIAdd %6 %14841 %14842 +%14844 = OpLoad %6 %187 +%14845 = OpIAdd %6 %14843 %14844 +%14846 = OpLoad %6 %188 +%14847 = OpIAdd %6 %14845 %14846 +%14848 = OpLoad %6 %189 +%14849 = OpIAdd %6 %14847 %14848 +%14850 = OpLoad %6 %190 +%14851 = OpIAdd %6 %14849 %14850 +%14852 = OpLoad %6 %191 +%14853 = OpIAdd %6 %14851 %14852 +%14854 = OpLoad %6 %193 +%14855 = OpIAdd %6 %14853 %14854 +%14856 = OpLoad %6 %194 +%14857 = OpIAdd %6 %14855 %14856 +%14858 = OpLoad %6 %195 +%14859 = OpIAdd %6 %14857 %14858 +%14860 = OpLoad %6 %196 +%14861 = OpIAdd %6 %14859 %14860 +%14862 = OpLoad %6 %197 +%14863 = OpIAdd %6 %14861 %14862 +%14864 = OpLoad %6 %198 +%14865 = OpIAdd %6 %14863 %14864 +%14866 = OpLoad %6 %199 +%14867 = OpIAdd %6 %14865 %14866 +%14868 = OpLoad %6 %200 +%14869 = OpIAdd %6 %14867 %14868 +%14870 = OpLoad %6 %201 +%14871 = OpIAdd %6 %14869 %14870 +%14872 = OpLoad %6 %202 +%14873 = OpIAdd %6 %14871 %14872 +%14874 = OpLoad %6 %204 +%14875 = OpIAdd %6 %14873 %14874 +%14876 = OpLoad %6 %205 +%14877 = OpIAdd %6 %14875 %14876 +%14878 = OpLoad %6 %206 +%14879 = OpIAdd %6 %14877 %14878 +%14880 = OpLoad %6 %207 +%14881 = OpIAdd %6 %14879 %14880 +%14882 = OpLoad %6 %208 +%14883 = OpIAdd %6 %14881 %14882 +%14884 = OpLoad %6 %209 +%14885 = OpIAdd %6 %14883 %14884 +%14886 = OpLoad %6 %210 +%14887 = OpIAdd %6 %14885 %14886 +%14888 = OpLoad %6 %211 +%14889 = OpIAdd %6 %14887 %14888 +%14890 = OpLoad %6 %212 +%14891 = OpIAdd %6 %14889 %14890 +%14892 = OpLoad %6 %213 +%14893 = OpIAdd %6 %14891 %14892 +%14894 = OpLoad %6 %215 +%14895 = OpIAdd %6 %14893 %14894 +%14896 = OpLoad %6 %216 +%14897 = OpIAdd %6 %14895 %14896 +%14898 = OpLoad %6 %217 +%14899 = OpIAdd %6 %14897 %14898 +%14900 = OpLoad %6 %218 +%14901 = OpIAdd %6 %14899 %14900 +%14902 = OpLoad %6 %219 +%14903 = OpIAdd %6 %14901 %14902 +%14904 = OpLoad %6 %220 +%14905 = OpIAdd %6 %14903 %14904 +%14906 = OpLoad %6 %221 +%14907 = OpIAdd %6 %14905 %14906 +%14908 = OpLoad %6 %222 +%14909 = OpIAdd %6 %14907 %14908 +%14910 = OpLoad %6 %223 +%14911 = OpIAdd %6 %14909 %14910 +%14912 = OpLoad %6 %224 +%14913 = OpIAdd %6 %14911 %14912 +%14914 = OpLoad %6 %226 +%14915 = OpIAdd %6 %14913 %14914 +%14916 = OpLoad %6 %227 +%14917 = OpIAdd %6 %14915 %14916 +%14918 = OpLoad %6 %228 +%14919 = OpIAdd %6 %14917 %14918 +%14920 = OpLoad %6 %229 +%14921 = OpIAdd %6 %14919 %14920 +%14922 = OpLoad %6 %230 +%14923 = OpIAdd %6 %14921 %14922 +%14924 = OpLoad %6 %231 +%14925 = OpIAdd %6 %14923 %14924 +%14926 = OpLoad %6 %232 +%14927 = OpIAdd %6 %14925 %14926 +%14928 = OpLoad %6 %233 +%14929 = OpIAdd %6 %14927 %14928 +%14930 = OpLoad %6 %234 +%14931 = OpIAdd %6 %14929 %14930 +%14932 = OpLoad %6 %235 +%14933 = OpIAdd %6 %14931 %14932 +%14934 = OpLoad %6 %237 +%14935 = OpIAdd %6 %14933 %14934 +%14936 = OpLoad %6 %238 +%14937 = OpIAdd %6 %14935 %14936 +%14938 = OpLoad %6 %239 +%14939 = OpIAdd %6 %14937 %14938 +%14940 = OpLoad %6 %240 +%14941 = OpIAdd %6 %14939 %14940 +%14942 = OpLoad %6 %241 +%14943 = OpIAdd %6 %14941 %14942 +%14944 = OpLoad %6 %242 +%14945 = OpIAdd %6 %14943 %14944 +%14946 = OpLoad %6 %243 +%14947 = OpIAdd %6 %14945 %14946 +%14948 = OpLoad %6 %244 +%14949 = OpIAdd %6 %14947 %14948 +%14950 = OpLoad %6 %245 +%14951 = OpIAdd %6 %14949 %14950 +%14952 = OpLoad %6 %246 +%14953 = OpIAdd %6 %14951 %14952 +%14954 = OpLoad %6 %248 +%14955 = OpIAdd %6 %14953 %14954 +%14956 = OpLoad %6 %249 +%14957 = OpIAdd %6 %14955 %14956 +%14958 = OpLoad %6 %250 +%14959 = OpIAdd %6 %14957 %14958 +%14960 = OpLoad %6 %251 +%14961 = OpIAdd %6 %14959 %14960 +%14962 = OpLoad %6 %252 +%14963 = OpIAdd %6 %14961 %14962 +%14964 = OpLoad %6 %253 +%14965 = OpIAdd %6 %14963 %14964 +%14966 = OpLoad %6 %254 +%14967 = OpIAdd %6 %14965 %14966 +%14968 = OpLoad %6 %255 +%14969 = OpIAdd %6 %14967 %14968 +%14970 = OpLoad %6 %256 +%14971 = OpIAdd %6 %14969 %14970 +%14972 = OpLoad %6 %257 +%14973 = OpIAdd %6 %14971 %14972 +%14974 = OpLoad %6 %260 +%14975 = OpIAdd %6 %14973 %14974 +%14976 = OpLoad %6 %261 +%14977 = OpIAdd %6 %14975 %14976 +%14978 = OpLoad %6 %262 +%14979 = OpIAdd %6 %14977 %14978 +%14980 = OpLoad %6 %263 +%14981 = OpIAdd %6 %14979 %14980 +%14982 = OpLoad %6 %264 +%14983 = OpIAdd %6 %14981 %14982 +%14984 = OpLoad %6 %265 +%14985 = OpIAdd %6 %14983 %14984 +%14986 = OpLoad %6 %266 +%14987 = OpIAdd %6 %14985 %14986 +%14988 = OpLoad %6 %267 +%14989 = OpIAdd %6 %14987 %14988 +%14990 = OpLoad %6 %268 +%14991 = OpIAdd %6 %14989 %14990 +%14992 = OpLoad %6 %269 +%14993 = OpIAdd %6 %14991 %14992 +%14994 = OpLoad %6 %271 +%14995 = OpIAdd %6 %14993 %14994 +%14996 = OpLoad %6 %272 +%14997 = OpIAdd %6 %14995 %14996 +%14998 = OpLoad %6 %273 +%14999 = OpIAdd %6 %14997 %14998 +%15000 = OpLoad %6 %274 +%15001 = OpIAdd %6 %14999 %15000 +%15002 = OpLoad %6 %275 +%15003 = OpIAdd %6 %15001 %15002 +%15004 = OpLoad %6 %276 +%15005 = OpIAdd %6 %15003 %15004 +%15006 = OpLoad %6 %277 +%15007 = OpIAdd %6 %15005 %15006 +%15008 = OpLoad %6 %278 +%15009 = OpIAdd %6 %15007 %15008 +%15010 = OpLoad %6 %279 +%15011 = OpIAdd %6 %15009 %15010 +%15012 = OpLoad %6 %280 +%15013 = OpIAdd %6 %15011 %15012 +%15014 = OpLoad %6 %282 +%15015 = OpIAdd %6 %15013 %15014 +%15016 = OpLoad %6 %283 +%15017 = OpIAdd %6 %15015 %15016 +%15018 = OpLoad %6 %284 +%15019 = OpIAdd %6 %15017 %15018 +%15020 = OpLoad %6 %285 +%15021 = OpIAdd %6 %15019 %15020 +%15022 = OpLoad %6 %286 +%15023 = OpIAdd %6 %15021 %15022 +%15024 = OpLoad %6 %287 +%15025 = OpIAdd %6 %15023 %15024 +%15026 = OpLoad %6 %288 +%15027 = OpIAdd %6 %15025 %15026 +%15028 = OpLoad %6 %289 +%15029 = OpIAdd %6 %15027 %15028 +%15030 = OpLoad %6 %290 +%15031 = OpIAdd %6 %15029 %15030 +%15032 = OpLoad %6 %291 +%15033 = OpIAdd %6 %15031 %15032 +%15034 = OpLoad %6 %293 +%15035 = OpIAdd %6 %15033 %15034 +%15036 = OpLoad %6 %294 +%15037 = OpIAdd %6 %15035 %15036 +%15038 = OpLoad %6 %295 +%15039 = OpIAdd %6 %15037 %15038 +%15040 = OpLoad %6 %296 +%15041 = OpIAdd %6 %15039 %15040 +%15042 = OpLoad %6 %297 +%15043 = OpIAdd %6 %15041 %15042 +%15044 = OpLoad %6 %298 +%15045 = OpIAdd %6 %15043 %15044 +%15046 = OpLoad %6 %299 +%15047 = OpIAdd %6 %15045 %15046 +%15048 = OpLoad %6 %300 +%15049 = OpIAdd %6 %15047 %15048 +%15050 = OpLoad %6 %301 +%15051 = OpIAdd %6 %15049 %15050 +%15052 = OpLoad %6 %302 +%15053 = OpIAdd %6 %15051 %15052 +%15054 = OpLoad %6 %304 +%15055 = OpIAdd %6 %15053 %15054 +%15056 = OpLoad %6 %305 +%15057 = OpIAdd %6 %15055 %15056 +%15058 = OpLoad %6 %306 +%15059 = OpIAdd %6 %15057 %15058 +%15060 = OpLoad %6 %307 +%15061 = OpIAdd %6 %15059 %15060 +%15062 = OpLoad %6 %308 +%15063 = OpIAdd %6 %15061 %15062 +%15064 = OpLoad %6 %309 +%15065 = OpIAdd %6 %15063 %15064 +%15066 = OpLoad %6 %310 +%15067 = OpIAdd %6 %15065 %15066 +%15068 = OpLoad %6 %311 +%15069 = OpIAdd %6 %15067 %15068 +%15070 = OpLoad %6 %312 +%15071 = OpIAdd %6 %15069 %15070 +%15072 = OpLoad %6 %313 +%15073 = OpIAdd %6 %15071 %15072 +%15074 = OpLoad %6 %315 +%15075 = OpIAdd %6 %15073 %15074 +%15076 = OpLoad %6 %316 +%15077 = OpIAdd %6 %15075 %15076 +%15078 = OpLoad %6 %317 +%15079 = OpIAdd %6 %15077 %15078 +%15080 = OpLoad %6 %318 +%15081 = OpIAdd %6 %15079 %15080 +%15082 = OpLoad %6 %319 +%15083 = OpIAdd %6 %15081 %15082 +%15084 = OpLoad %6 %320 +%15085 = OpIAdd %6 %15083 %15084 +%15086 = OpLoad %6 %321 +%15087 = OpIAdd %6 %15085 %15086 +%15088 = OpLoad %6 %322 +%15089 = OpIAdd %6 %15087 %15088 +%15090 = OpLoad %6 %323 +%15091 = OpIAdd %6 %15089 %15090 +%15092 = OpLoad %6 %324 +%15093 = OpIAdd %6 %15091 %15092 +%15094 = OpLoad %6 %326 +%15095 = OpIAdd %6 %15093 %15094 +%15096 = OpLoad %6 %327 +%15097 = OpIAdd %6 %15095 %15096 +%15098 = OpLoad %6 %328 +%15099 = OpIAdd %6 %15097 %15098 +%15100 = OpLoad %6 %329 +%15101 = OpIAdd %6 %15099 %15100 +%15102 = OpLoad %6 %330 +%15103 = OpIAdd %6 %15101 %15102 +%15104 = OpLoad %6 %331 +%15105 = OpIAdd %6 %15103 %15104 +%15106 = OpLoad %6 %332 +%15107 = OpIAdd %6 %15105 %15106 +%15108 = OpLoad %6 %333 +%15109 = OpIAdd %6 %15107 %15108 +%15110 = OpLoad %6 %334 +%15111 = OpIAdd %6 %15109 %15110 +%15112 = OpLoad %6 %335 +%15113 = OpIAdd %6 %15111 %15112 +%15114 = OpLoad %6 %337 +%15115 = OpIAdd %6 %15113 %15114 +%15116 = OpLoad %6 %338 +%15117 = OpIAdd %6 %15115 %15116 +%15118 = OpLoad %6 %339 +%15119 = OpIAdd %6 %15117 %15118 +%15120 = OpLoad %6 %340 +%15121 = OpIAdd %6 %15119 %15120 +%15122 = OpLoad %6 %341 +%15123 = OpIAdd %6 %15121 %15122 +%15124 = OpLoad %6 %342 +%15125 = OpIAdd %6 %15123 %15124 +%15126 = OpLoad %6 %343 +%15127 = OpIAdd %6 %15125 %15126 +%15128 = OpLoad %6 %344 +%15129 = OpIAdd %6 %15127 %15128 +%15130 = OpLoad %6 %345 +%15131 = OpIAdd %6 %15129 %15130 +%15132 = OpLoad %6 %346 +%15133 = OpIAdd %6 %15131 %15132 +%15134 = OpLoad %6 %348 +%15135 = OpIAdd %6 %15133 %15134 +%15136 = OpLoad %6 %349 +%15137 = OpIAdd %6 %15135 %15136 +%15138 = OpLoad %6 %350 +%15139 = OpIAdd %6 %15137 %15138 +%15140 = OpLoad %6 %351 +%15141 = OpIAdd %6 %15139 %15140 +%15142 = OpLoad %6 %352 +%15143 = OpIAdd %6 %15141 %15142 +%15144 = OpLoad %6 %353 +%15145 = OpIAdd %6 %15143 %15144 +%15146 = OpLoad %6 %354 +%15147 = OpIAdd %6 %15145 %15146 +%15148 = OpLoad %6 %355 +%15149 = OpIAdd %6 %15147 %15148 +%15150 = OpLoad %6 %356 +%15151 = OpIAdd %6 %15149 %15150 +%15152 = OpLoad %6 %357 +%15153 = OpIAdd %6 %15151 %15152 +%15154 = OpLoad %6 %359 +%15155 = OpIAdd %6 %15153 %15154 +%15156 = OpLoad %6 %360 +%15157 = OpIAdd %6 %15155 %15156 +%15158 = OpLoad %6 %361 +%15159 = OpIAdd %6 %15157 %15158 +%15160 = OpLoad %6 %362 +%15161 = OpIAdd %6 %15159 %15160 +%15162 = OpLoad %6 %363 +%15163 = OpIAdd %6 %15161 %15162 +%15164 = OpLoad %6 %364 +%15165 = OpIAdd %6 %15163 %15164 +%15166 = OpLoad %6 %365 +%15167 = OpIAdd %6 %15165 %15166 +%15168 = OpLoad %6 %366 +%15169 = OpIAdd %6 %15167 %15168 +%15170 = OpLoad %6 %367 +%15171 = OpIAdd %6 %15169 %15170 +%15172 = OpLoad %6 %368 +%15173 = OpIAdd %6 %15171 %15172 +%15174 = OpLoad %6 %371 +%15175 = OpIAdd %6 %15173 %15174 +%15176 = OpLoad %6 %372 +%15177 = OpIAdd %6 %15175 %15176 +%15178 = OpLoad %6 %373 +%15179 = OpIAdd %6 %15177 %15178 +%15180 = OpLoad %6 %374 +%15181 = OpIAdd %6 %15179 %15180 +%15182 = OpLoad %6 %375 +%15183 = OpIAdd %6 %15181 %15182 +%15184 = OpLoad %6 %376 +%15185 = OpIAdd %6 %15183 %15184 +%15186 = OpLoad %6 %377 +%15187 = OpIAdd %6 %15185 %15186 +%15188 = OpLoad %6 %378 +%15189 = OpIAdd %6 %15187 %15188 +%15190 = OpLoad %6 %379 +%15191 = OpIAdd %6 %15189 %15190 +%15192 = OpLoad %6 %380 +%15193 = OpIAdd %6 %15191 %15192 +%15194 = OpLoad %6 %382 +%15195 = OpIAdd %6 %15193 %15194 +%15196 = OpLoad %6 %383 +%15197 = OpIAdd %6 %15195 %15196 +%15198 = OpLoad %6 %384 +%15199 = OpIAdd %6 %15197 %15198 +%15200 = OpLoad %6 %385 +%15201 = OpIAdd %6 %15199 %15200 +%15202 = OpLoad %6 %386 +%15203 = OpIAdd %6 %15201 %15202 +%15204 = OpLoad %6 %387 +%15205 = OpIAdd %6 %15203 %15204 +%15206 = OpLoad %6 %388 +%15207 = OpIAdd %6 %15205 %15206 +%15208 = OpLoad %6 %389 +%15209 = OpIAdd %6 %15207 %15208 +%15210 = OpLoad %6 %390 +%15211 = OpIAdd %6 %15209 %15210 +%15212 = OpLoad %6 %391 +%15213 = OpIAdd %6 %15211 %15212 +%15214 = OpLoad %6 %393 +%15215 = OpIAdd %6 %15213 %15214 +%15216 = OpLoad %6 %394 +%15217 = OpIAdd %6 %15215 %15216 +%15218 = OpLoad %6 %395 +%15219 = OpIAdd %6 %15217 %15218 +%15220 = OpLoad %6 %396 +%15221 = OpIAdd %6 %15219 %15220 +%15222 = OpLoad %6 %397 +%15223 = OpIAdd %6 %15221 %15222 +%15224 = OpLoad %6 %398 +%15225 = OpIAdd %6 %15223 %15224 +%15226 = OpLoad %6 %399 +%15227 = OpIAdd %6 %15225 %15226 +%15228 = OpLoad %6 %400 +%15229 = OpIAdd %6 %15227 %15228 +%15230 = OpLoad %6 %401 +%15231 = OpIAdd %6 %15229 %15230 +%15232 = OpLoad %6 %402 +%15233 = OpIAdd %6 %15231 %15232 +%15234 = OpLoad %6 %404 +%15235 = OpIAdd %6 %15233 %15234 +%15236 = OpLoad %6 %405 +%15237 = OpIAdd %6 %15235 %15236 +%15238 = OpLoad %6 %406 +%15239 = OpIAdd %6 %15237 %15238 +%15240 = OpLoad %6 %407 +%15241 = OpIAdd %6 %15239 %15240 +%15242 = OpLoad %6 %408 +%15243 = OpIAdd %6 %15241 %15242 +%15244 = OpLoad %6 %409 +%15245 = OpIAdd %6 %15243 %15244 +%15246 = OpLoad %6 %410 +%15247 = OpIAdd %6 %15245 %15246 +%15248 = OpLoad %6 %411 +%15249 = OpIAdd %6 %15247 %15248 +%15250 = OpLoad %6 %412 +%15251 = OpIAdd %6 %15249 %15250 +%15252 = OpLoad %6 %413 +%15253 = OpIAdd %6 %15251 %15252 +%15254 = OpLoad %6 %415 +%15255 = OpIAdd %6 %15253 %15254 +%15256 = OpLoad %6 %416 +%15257 = OpIAdd %6 %15255 %15256 +%15258 = OpLoad %6 %417 +%15259 = OpIAdd %6 %15257 %15258 +%15260 = OpLoad %6 %418 +%15261 = OpIAdd %6 %15259 %15260 +%15262 = OpLoad %6 %419 +%15263 = OpIAdd %6 %15261 %15262 +%15264 = OpLoad %6 %420 +%15265 = OpIAdd %6 %15263 %15264 +%15266 = OpLoad %6 %421 +%15267 = OpIAdd %6 %15265 %15266 +%15268 = OpLoad %6 %422 +%15269 = OpIAdd %6 %15267 %15268 +%15270 = OpLoad %6 %423 +%15271 = OpIAdd %6 %15269 %15270 +%15272 = OpLoad %6 %424 +%15273 = OpIAdd %6 %15271 %15272 +%15274 = OpLoad %6 %426 +%15275 = OpIAdd %6 %15273 %15274 +%15276 = OpLoad %6 %427 +%15277 = OpIAdd %6 %15275 %15276 +%15278 = OpLoad %6 %428 +%15279 = OpIAdd %6 %15277 %15278 +%15280 = OpLoad %6 %429 +%15281 = OpIAdd %6 %15279 %15280 +%15282 = OpLoad %6 %430 +%15283 = OpIAdd %6 %15281 %15282 +%15284 = OpLoad %6 %431 +%15285 = OpIAdd %6 %15283 %15284 +%15286 = OpLoad %6 %432 +%15287 = OpIAdd %6 %15285 %15286 +%15288 = OpLoad %6 %433 +%15289 = OpIAdd %6 %15287 %15288 +%15290 = OpLoad %6 %434 +%15291 = OpIAdd %6 %15289 %15290 +%15292 = OpLoad %6 %435 +%15293 = OpIAdd %6 %15291 %15292 +%15294 = OpLoad %6 %437 +%15295 = OpIAdd %6 %15293 %15294 +%15296 = OpLoad %6 %438 +%15297 = OpIAdd %6 %15295 %15296 +%15298 = OpLoad %6 %439 +%15299 = OpIAdd %6 %15297 %15298 +%15300 = OpLoad %6 %440 +%15301 = OpIAdd %6 %15299 %15300 +%15302 = OpLoad %6 %441 +%15303 = OpIAdd %6 %15301 %15302 +%15304 = OpLoad %6 %442 +%15305 = OpIAdd %6 %15303 %15304 +%15306 = OpLoad %6 %443 +%15307 = OpIAdd %6 %15305 %15306 +%15308 = OpLoad %6 %444 +%15309 = OpIAdd %6 %15307 %15308 +%15310 = OpLoad %6 %445 +%15311 = OpIAdd %6 %15309 %15310 +%15312 = OpLoad %6 %446 +%15313 = OpIAdd %6 %15311 %15312 +%15314 = OpLoad %6 %448 +%15315 = OpIAdd %6 %15313 %15314 +%15316 = OpLoad %6 %449 +%15317 = OpIAdd %6 %15315 %15316 +%15318 = OpLoad %6 %450 +%15319 = OpIAdd %6 %15317 %15318 +%15320 = OpLoad %6 %451 +%15321 = OpIAdd %6 %15319 %15320 +%15322 = OpLoad %6 %452 +%15323 = OpIAdd %6 %15321 %15322 +%15324 = OpLoad %6 %453 +%15325 = OpIAdd %6 %15323 %15324 +%15326 = OpLoad %6 %454 +%15327 = OpIAdd %6 %15325 %15326 +%15328 = OpLoad %6 %455 +%15329 = OpIAdd %6 %15327 %15328 +%15330 = OpLoad %6 %456 +%15331 = OpIAdd %6 %15329 %15330 +%15332 = OpLoad %6 %457 +%15333 = OpIAdd %6 %15331 %15332 +%15334 = OpLoad %6 %459 +%15335 = OpIAdd %6 %15333 %15334 +%15336 = OpLoad %6 %460 +%15337 = OpIAdd %6 %15335 %15336 +%15338 = OpLoad %6 %461 +%15339 = OpIAdd %6 %15337 %15338 +%15340 = OpLoad %6 %462 +%15341 = OpIAdd %6 %15339 %15340 +%15342 = OpLoad %6 %463 +%15343 = OpIAdd %6 %15341 %15342 +%15344 = OpLoad %6 %464 +%15345 = OpIAdd %6 %15343 %15344 +%15346 = OpLoad %6 %465 +%15347 = OpIAdd %6 %15345 %15346 +%15348 = OpLoad %6 %466 +%15349 = OpIAdd %6 %15347 %15348 +%15350 = OpLoad %6 %467 +%15351 = OpIAdd %6 %15349 %15350 +%15352 = OpLoad %6 %468 +%15353 = OpIAdd %6 %15351 %15352 +%15354 = OpLoad %6 %470 +%15355 = OpIAdd %6 %15353 %15354 +%15356 = OpLoad %6 %471 +%15357 = OpIAdd %6 %15355 %15356 +%15358 = OpLoad %6 %472 +%15359 = OpIAdd %6 %15357 %15358 +%15360 = OpLoad %6 %473 +%15361 = OpIAdd %6 %15359 %15360 +%15362 = OpLoad %6 %474 +%15363 = OpIAdd %6 %15361 %15362 +%15364 = OpLoad %6 %475 +%15365 = OpIAdd %6 %15363 %15364 +%15366 = OpLoad %6 %476 +%15367 = OpIAdd %6 %15365 %15366 +%15368 = OpLoad %6 %477 +%15369 = OpIAdd %6 %15367 %15368 +%15370 = OpLoad %6 %478 +%15371 = OpIAdd %6 %15369 %15370 +%15372 = OpLoad %6 %479 +%15373 = OpIAdd %6 %15371 %15372 +%15374 = OpLoad %6 %482 +%15375 = OpIAdd %6 %15373 %15374 +%15376 = OpLoad %6 %483 +%15377 = OpIAdd %6 %15375 %15376 +%15378 = OpLoad %6 %484 +%15379 = OpIAdd %6 %15377 %15378 +%15380 = OpLoad %6 %485 +%15381 = OpIAdd %6 %15379 %15380 +%15382 = OpLoad %6 %486 +%15383 = OpIAdd %6 %15381 %15382 +%15384 = OpLoad %6 %487 +%15385 = OpIAdd %6 %15383 %15384 +%15386 = OpLoad %6 %488 +%15387 = OpIAdd %6 %15385 %15386 +%15388 = OpLoad %6 %489 +%15389 = OpIAdd %6 %15387 %15388 +%15390 = OpLoad %6 %490 +%15391 = OpIAdd %6 %15389 %15390 +%15392 = OpLoad %6 %491 +%15393 = OpIAdd %6 %15391 %15392 +%15394 = OpLoad %6 %493 +%15395 = OpIAdd %6 %15393 %15394 +%15396 = OpLoad %6 %494 +%15397 = OpIAdd %6 %15395 %15396 +%15398 = OpLoad %6 %495 +%15399 = OpIAdd %6 %15397 %15398 +%15400 = OpLoad %6 %496 +%15401 = OpIAdd %6 %15399 %15400 +%15402 = OpLoad %6 %497 +%15403 = OpIAdd %6 %15401 %15402 +%15404 = OpLoad %6 %498 +%15405 = OpIAdd %6 %15403 %15404 +%15406 = OpLoad %6 %499 +%15407 = OpIAdd %6 %15405 %15406 +%15408 = OpLoad %6 %500 +%15409 = OpIAdd %6 %15407 %15408 +%15410 = OpLoad %6 %501 +%15411 = OpIAdd %6 %15409 %15410 +%15412 = OpLoad %6 %502 +%15413 = OpIAdd %6 %15411 %15412 +%15414 = OpLoad %6 %504 +%15415 = OpIAdd %6 %15413 %15414 +%15416 = OpLoad %6 %505 +%15417 = OpIAdd %6 %15415 %15416 +%15418 = OpLoad %6 %506 +%15419 = OpIAdd %6 %15417 %15418 +%15420 = OpLoad %6 %507 +%15421 = OpIAdd %6 %15419 %15420 +%15422 = OpLoad %6 %508 +%15423 = OpIAdd %6 %15421 %15422 +%15424 = OpLoad %6 %509 +%15425 = OpIAdd %6 %15423 %15424 +%15426 = OpLoad %6 %510 +%15427 = OpIAdd %6 %15425 %15426 +%15428 = OpLoad %6 %511 +%15429 = OpIAdd %6 %15427 %15428 +%15430 = OpLoad %6 %512 +%15431 = OpIAdd %6 %15429 %15430 +%15432 = OpLoad %6 %513 +%15433 = OpIAdd %6 %15431 %15432 +%15434 = OpLoad %6 %515 +%15435 = OpIAdd %6 %15433 %15434 +%15436 = OpLoad %6 %516 +%15437 = OpIAdd %6 %15435 %15436 +%15438 = OpLoad %6 %517 +%15439 = OpIAdd %6 %15437 %15438 +%15440 = OpLoad %6 %518 +%15441 = OpIAdd %6 %15439 %15440 +%15442 = OpLoad %6 %519 +%15443 = OpIAdd %6 %15441 %15442 +%15444 = OpLoad %6 %520 +%15445 = OpIAdd %6 %15443 %15444 +%15446 = OpLoad %6 %521 +%15447 = OpIAdd %6 %15445 %15446 +%15448 = OpLoad %6 %522 +%15449 = OpIAdd %6 %15447 %15448 +%15450 = OpLoad %6 %523 +%15451 = OpIAdd %6 %15449 %15450 +%15452 = OpLoad %6 %524 +%15453 = OpIAdd %6 %15451 %15452 +%15454 = OpLoad %6 %526 +%15455 = OpIAdd %6 %15453 %15454 +%15456 = OpLoad %6 %527 +%15457 = OpIAdd %6 %15455 %15456 +%15458 = OpLoad %6 %528 +%15459 = OpIAdd %6 %15457 %15458 +%15460 = OpLoad %6 %529 +%15461 = OpIAdd %6 %15459 %15460 +%15462 = OpLoad %6 %530 +%15463 = OpIAdd %6 %15461 %15462 +%15464 = OpLoad %6 %531 +%15465 = OpIAdd %6 %15463 %15464 +%15466 = OpLoad %6 %532 +%15467 = OpIAdd %6 %15465 %15466 +%15468 = OpLoad %6 %533 +%15469 = OpIAdd %6 %15467 %15468 +%15470 = OpLoad %6 %534 +%15471 = OpIAdd %6 %15469 %15470 +%15472 = OpLoad %6 %535 +%15473 = OpIAdd %6 %15471 %15472 +%15474 = OpLoad %6 %537 +%15475 = OpIAdd %6 %15473 %15474 +%15476 = OpLoad %6 %538 +%15477 = OpIAdd %6 %15475 %15476 +%15478 = OpLoad %6 %539 +%15479 = OpIAdd %6 %15477 %15478 +%15480 = OpLoad %6 %540 +%15481 = OpIAdd %6 %15479 %15480 +%15482 = OpLoad %6 %541 +%15483 = OpIAdd %6 %15481 %15482 +%15484 = OpLoad %6 %542 +%15485 = OpIAdd %6 %15483 %15484 +%15486 = OpLoad %6 %543 +%15487 = OpIAdd %6 %15485 %15486 +%15488 = OpLoad %6 %544 +%15489 = OpIAdd %6 %15487 %15488 +%15490 = OpLoad %6 %545 +%15491 = OpIAdd %6 %15489 %15490 +%15492 = OpLoad %6 %546 +%15493 = OpIAdd %6 %15491 %15492 +%15494 = OpLoad %6 %548 +%15495 = OpIAdd %6 %15493 %15494 +%15496 = OpLoad %6 %549 +%15497 = OpIAdd %6 %15495 %15496 +%15498 = OpLoad %6 %550 +%15499 = OpIAdd %6 %15497 %15498 +%15500 = OpLoad %6 %551 +%15501 = OpIAdd %6 %15499 %15500 +%15502 = OpLoad %6 %552 +%15503 = OpIAdd %6 %15501 %15502 +%15504 = OpLoad %6 %553 +%15505 = OpIAdd %6 %15503 %15504 +%15506 = OpLoad %6 %554 +%15507 = OpIAdd %6 %15505 %15506 +%15508 = OpLoad %6 %555 +%15509 = OpIAdd %6 %15507 %15508 +%15510 = OpLoad %6 %556 +%15511 = OpIAdd %6 %15509 %15510 +%15512 = OpLoad %6 %557 +%15513 = OpIAdd %6 %15511 %15512 +%15514 = OpLoad %6 %559 +%15515 = OpIAdd %6 %15513 %15514 +%15516 = OpLoad %6 %560 +%15517 = OpIAdd %6 %15515 %15516 +%15518 = OpLoad %6 %561 +%15519 = OpIAdd %6 %15517 %15518 +%15520 = OpLoad %6 %562 +%15521 = OpIAdd %6 %15519 %15520 +%15522 = OpLoad %6 %563 +%15523 = OpIAdd %6 %15521 %15522 +%15524 = OpLoad %6 %564 +%15525 = OpIAdd %6 %15523 %15524 +%15526 = OpLoad %6 %565 +%15527 = OpIAdd %6 %15525 %15526 +%15528 = OpLoad %6 %566 +%15529 = OpIAdd %6 %15527 %15528 +%15530 = OpLoad %6 %567 +%15531 = OpIAdd %6 %15529 %15530 +%15532 = OpLoad %6 %568 +%15533 = OpIAdd %6 %15531 %15532 +%15534 = OpLoad %6 %570 +%15535 = OpIAdd %6 %15533 %15534 +%15536 = OpLoad %6 %571 +%15537 = OpIAdd %6 %15535 %15536 +%15538 = OpLoad %6 %572 +%15539 = OpIAdd %6 %15537 %15538 +%15540 = OpLoad %6 %573 +%15541 = OpIAdd %6 %15539 %15540 +%15542 = OpLoad %6 %574 +%15543 = OpIAdd %6 %15541 %15542 +%15544 = OpLoad %6 %575 +%15545 = OpIAdd %6 %15543 %15544 +%15546 = OpLoad %6 %576 +%15547 = OpIAdd %6 %15545 %15546 +%15548 = OpLoad %6 %577 +%15549 = OpIAdd %6 %15547 %15548 +%15550 = OpLoad %6 %578 +%15551 = OpIAdd %6 %15549 %15550 +%15552 = OpLoad %6 %579 +%15553 = OpIAdd %6 %15551 %15552 +%15554 = OpLoad %6 %581 +%15555 = OpIAdd %6 %15553 %15554 +%15556 = OpLoad %6 %582 +%15557 = OpIAdd %6 %15555 %15556 +%15558 = OpLoad %6 %583 +%15559 = OpIAdd %6 %15557 %15558 +%15560 = OpLoad %6 %584 +%15561 = OpIAdd %6 %15559 %15560 +%15562 = OpLoad %6 %585 +%15563 = OpIAdd %6 %15561 %15562 +%15564 = OpLoad %6 %586 +%15565 = OpIAdd %6 %15563 %15564 +%15566 = OpLoad %6 %587 +%15567 = OpIAdd %6 %15565 %15566 +%15568 = OpLoad %6 %588 +%15569 = OpIAdd %6 %15567 %15568 +%15570 = OpLoad %6 %589 +%15571 = OpIAdd %6 %15569 %15570 +%15572 = OpLoad %6 %590 +%15573 = OpIAdd %6 %15571 %15572 +%15574 = OpLoad %6 %593 +%15575 = OpIAdd %6 %15573 %15574 +%15576 = OpLoad %6 %594 +%15577 = OpIAdd %6 %15575 %15576 +%15578 = OpLoad %6 %595 +%15579 = OpIAdd %6 %15577 %15578 +%15580 = OpLoad %6 %596 +%15581 = OpIAdd %6 %15579 %15580 +%15582 = OpLoad %6 %597 +%15583 = OpIAdd %6 %15581 %15582 +%15584 = OpLoad %6 %598 +%15585 = OpIAdd %6 %15583 %15584 +%15586 = OpLoad %6 %599 +%15587 = OpIAdd %6 %15585 %15586 +%15588 = OpLoad %6 %600 +%15589 = OpIAdd %6 %15587 %15588 +%15590 = OpLoad %6 %601 +%15591 = OpIAdd %6 %15589 %15590 +%15592 = OpLoad %6 %602 +%15593 = OpIAdd %6 %15591 %15592 +%15594 = OpLoad %6 %604 +%15595 = OpIAdd %6 %15593 %15594 +%15596 = OpLoad %6 %605 +%15597 = OpIAdd %6 %15595 %15596 +%15598 = OpLoad %6 %606 +%15599 = OpIAdd %6 %15597 %15598 +%15600 = OpLoad %6 %607 +%15601 = OpIAdd %6 %15599 %15600 +%15602 = OpLoad %6 %608 +%15603 = OpIAdd %6 %15601 %15602 +%15604 = OpLoad %6 %609 +%15605 = OpIAdd %6 %15603 %15604 +%15606 = OpLoad %6 %610 +%15607 = OpIAdd %6 %15605 %15606 +%15608 = OpLoad %6 %611 +%15609 = OpIAdd %6 %15607 %15608 +%15610 = OpLoad %6 %612 +%15611 = OpIAdd %6 %15609 %15610 +%15612 = OpLoad %6 %613 +%15613 = OpIAdd %6 %15611 %15612 +%15614 = OpLoad %6 %615 +%15615 = OpIAdd %6 %15613 %15614 +%15616 = OpLoad %6 %616 +%15617 = OpIAdd %6 %15615 %15616 +%15618 = OpLoad %6 %617 +%15619 = OpIAdd %6 %15617 %15618 +%15620 = OpLoad %6 %618 +%15621 = OpIAdd %6 %15619 %15620 +%15622 = OpLoad %6 %619 +%15623 = OpIAdd %6 %15621 %15622 +%15624 = OpLoad %6 %620 +%15625 = OpIAdd %6 %15623 %15624 +%15626 = OpLoad %6 %621 +%15627 = OpIAdd %6 %15625 %15626 +%15628 = OpLoad %6 %622 +%15629 = OpIAdd %6 %15627 %15628 +%15630 = OpLoad %6 %623 +%15631 = OpIAdd %6 %15629 %15630 +%15632 = OpLoad %6 %624 +%15633 = OpIAdd %6 %15631 %15632 +%15634 = OpLoad %6 %626 +%15635 = OpIAdd %6 %15633 %15634 +%15636 = OpLoad %6 %627 +%15637 = OpIAdd %6 %15635 %15636 +%15638 = OpLoad %6 %628 +%15639 = OpIAdd %6 %15637 %15638 +%15640 = OpLoad %6 %629 +%15641 = OpIAdd %6 %15639 %15640 +%15642 = OpLoad %6 %630 +%15643 = OpIAdd %6 %15641 %15642 +%15644 = OpLoad %6 %631 +%15645 = OpIAdd %6 %15643 %15644 +%15646 = OpLoad %6 %632 +%15647 = OpIAdd %6 %15645 %15646 +%15648 = OpLoad %6 %633 +%15649 = OpIAdd %6 %15647 %15648 +%15650 = OpLoad %6 %634 +%15651 = OpIAdd %6 %15649 %15650 +%15652 = OpLoad %6 %635 +%15653 = OpIAdd %6 %15651 %15652 +%15654 = OpLoad %6 %637 +%15655 = OpIAdd %6 %15653 %15654 +%15656 = OpLoad %6 %638 +%15657 = OpIAdd %6 %15655 %15656 +%15658 = OpLoad %6 %639 +%15659 = OpIAdd %6 %15657 %15658 +%15660 = OpLoad %6 %640 +%15661 = OpIAdd %6 %15659 %15660 +%15662 = OpLoad %6 %641 +%15663 = OpIAdd %6 %15661 %15662 +%15664 = OpLoad %6 %642 +%15665 = OpIAdd %6 %15663 %15664 +%15666 = OpLoad %6 %643 +%15667 = OpIAdd %6 %15665 %15666 +%15668 = OpLoad %6 %644 +%15669 = OpIAdd %6 %15667 %15668 +%15670 = OpLoad %6 %645 +%15671 = OpIAdd %6 %15669 %15670 +%15672 = OpLoad %6 %646 +%15673 = OpIAdd %6 %15671 %15672 +%15674 = OpLoad %6 %648 +%15675 = OpIAdd %6 %15673 %15674 +%15676 = OpLoad %6 %649 +%15677 = OpIAdd %6 %15675 %15676 +%15678 = OpLoad %6 %650 +%15679 = OpIAdd %6 %15677 %15678 +%15680 = OpLoad %6 %651 +%15681 = OpIAdd %6 %15679 %15680 +%15682 = OpLoad %6 %652 +%15683 = OpIAdd %6 %15681 %15682 +%15684 = OpLoad %6 %653 +%15685 = OpIAdd %6 %15683 %15684 +%15686 = OpLoad %6 %654 +%15687 = OpIAdd %6 %15685 %15686 +%15688 = OpLoad %6 %655 +%15689 = OpIAdd %6 %15687 %15688 +%15690 = OpLoad %6 %656 +%15691 = OpIAdd %6 %15689 %15690 +%15692 = OpLoad %6 %657 +%15693 = OpIAdd %6 %15691 %15692 +%15694 = OpLoad %6 %659 +%15695 = OpIAdd %6 %15693 %15694 +%15696 = OpLoad %6 %660 +%15697 = OpIAdd %6 %15695 %15696 +%15698 = OpLoad %6 %661 +%15699 = OpIAdd %6 %15697 %15698 +%15700 = OpLoad %6 %662 +%15701 = OpIAdd %6 %15699 %15700 +%15702 = OpLoad %6 %663 +%15703 = OpIAdd %6 %15701 %15702 +%15704 = OpLoad %6 %664 +%15705 = OpIAdd %6 %15703 %15704 +%15706 = OpLoad %6 %665 +%15707 = OpIAdd %6 %15705 %15706 +%15708 = OpLoad %6 %666 +%15709 = OpIAdd %6 %15707 %15708 +%15710 = OpLoad %6 %667 +%15711 = OpIAdd %6 %15709 %15710 +%15712 = OpLoad %6 %668 +%15713 = OpIAdd %6 %15711 %15712 +%15714 = OpLoad %6 %670 +%15715 = OpIAdd %6 %15713 %15714 +%15716 = OpLoad %6 %671 +%15717 = OpIAdd %6 %15715 %15716 +%15718 = OpLoad %6 %672 +%15719 = OpIAdd %6 %15717 %15718 +%15720 = OpLoad %6 %673 +%15721 = OpIAdd %6 %15719 %15720 +%15722 = OpLoad %6 %674 +%15723 = OpIAdd %6 %15721 %15722 +%15724 = OpLoad %6 %675 +%15725 = OpIAdd %6 %15723 %15724 +%15726 = OpLoad %6 %676 +%15727 = OpIAdd %6 %15725 %15726 +%15728 = OpLoad %6 %677 +%15729 = OpIAdd %6 %15727 %15728 +%15730 = OpLoad %6 %678 +%15731 = OpIAdd %6 %15729 %15730 +%15732 = OpLoad %6 %679 +%15733 = OpIAdd %6 %15731 %15732 +%15734 = OpLoad %6 %681 +%15735 = OpIAdd %6 %15733 %15734 +%15736 = OpLoad %6 %682 +%15737 = OpIAdd %6 %15735 %15736 +%15738 = OpLoad %6 %683 +%15739 = OpIAdd %6 %15737 %15738 +%15740 = OpLoad %6 %684 +%15741 = OpIAdd %6 %15739 %15740 +%15742 = OpLoad %6 %685 +%15743 = OpIAdd %6 %15741 %15742 +%15744 = OpLoad %6 %686 +%15745 = OpIAdd %6 %15743 %15744 +%15746 = OpLoad %6 %687 +%15747 = OpIAdd %6 %15745 %15746 +%15748 = OpLoad %6 %688 +%15749 = OpIAdd %6 %15747 %15748 +%15750 = OpLoad %6 %689 +%15751 = OpIAdd %6 %15749 %15750 +%15752 = OpLoad %6 %690 +%15753 = OpIAdd %6 %15751 %15752 +%15754 = OpLoad %6 %692 +%15755 = OpIAdd %6 %15753 %15754 +%15756 = OpLoad %6 %693 +%15757 = OpIAdd %6 %15755 %15756 +%15758 = OpLoad %6 %694 +%15759 = OpIAdd %6 %15757 %15758 +%15760 = OpLoad %6 %695 +%15761 = OpIAdd %6 %15759 %15760 +%15762 = OpLoad %6 %696 +%15763 = OpIAdd %6 %15761 %15762 +%15764 = OpLoad %6 %697 +%15765 = OpIAdd %6 %15763 %15764 +%15766 = OpLoad %6 %698 +%15767 = OpIAdd %6 %15765 %15766 +%15768 = OpLoad %6 %699 +%15769 = OpIAdd %6 %15767 %15768 +%15770 = OpLoad %6 %700 +%15771 = OpIAdd %6 %15769 %15770 +%15772 = OpLoad %6 %701 +%15773 = OpIAdd %6 %15771 %15772 +%15774 = OpLoad %6 %704 +%15775 = OpIAdd %6 %15773 %15774 +%15776 = OpLoad %6 %705 +%15777 = OpIAdd %6 %15775 %15776 +%15778 = OpLoad %6 %706 +%15779 = OpIAdd %6 %15777 %15778 +%15780 = OpLoad %6 %707 +%15781 = OpIAdd %6 %15779 %15780 +%15782 = OpLoad %6 %708 +%15783 = OpIAdd %6 %15781 %15782 +%15784 = OpLoad %6 %709 +%15785 = OpIAdd %6 %15783 %15784 +%15786 = OpLoad %6 %710 +%15787 = OpIAdd %6 %15785 %15786 +%15788 = OpLoad %6 %711 +%15789 = OpIAdd %6 %15787 %15788 +%15790 = OpLoad %6 %712 +%15791 = OpIAdd %6 %15789 %15790 +%15792 = OpLoad %6 %713 +%15793 = OpIAdd %6 %15791 %15792 +%15794 = OpLoad %6 %715 +%15795 = OpIAdd %6 %15793 %15794 +%15796 = OpLoad %6 %716 +%15797 = OpIAdd %6 %15795 %15796 +%15798 = OpLoad %6 %717 +%15799 = OpIAdd %6 %15797 %15798 +%15800 = OpLoad %6 %718 +%15801 = OpIAdd %6 %15799 %15800 +%15802 = OpLoad %6 %719 +%15803 = OpIAdd %6 %15801 %15802 +%15804 = OpLoad %6 %720 +%15805 = OpIAdd %6 %15803 %15804 +%15806 = OpLoad %6 %721 +%15807 = OpIAdd %6 %15805 %15806 +%15808 = OpLoad %6 %722 +%15809 = OpIAdd %6 %15807 %15808 +%15810 = OpLoad %6 %723 +%15811 = OpIAdd %6 %15809 %15810 +%15812 = OpLoad %6 %724 +%15813 = OpIAdd %6 %15811 %15812 +%15814 = OpLoad %6 %726 +%15815 = OpIAdd %6 %15813 %15814 +%15816 = OpLoad %6 %727 +%15817 = OpIAdd %6 %15815 %15816 +%15818 = OpLoad %6 %728 +%15819 = OpIAdd %6 %15817 %15818 +%15820 = OpLoad %6 %729 +%15821 = OpIAdd %6 %15819 %15820 +%15822 = OpLoad %6 %730 +%15823 = OpIAdd %6 %15821 %15822 +%15824 = OpLoad %6 %731 +%15825 = OpIAdd %6 %15823 %15824 +%15826 = OpLoad %6 %732 +%15827 = OpIAdd %6 %15825 %15826 +%15828 = OpLoad %6 %733 +%15829 = OpIAdd %6 %15827 %15828 +%15830 = OpLoad %6 %734 +%15831 = OpIAdd %6 %15829 %15830 +%15832 = OpLoad %6 %735 +%15833 = OpIAdd %6 %15831 %15832 +%15834 = OpLoad %6 %737 +%15835 = OpIAdd %6 %15833 %15834 +%15836 = OpLoad %6 %738 +%15837 = OpIAdd %6 %15835 %15836 +%15838 = OpLoad %6 %739 +%15839 = OpIAdd %6 %15837 %15838 +%15840 = OpLoad %6 %740 +%15841 = OpIAdd %6 %15839 %15840 +%15842 = OpLoad %6 %741 +%15843 = OpIAdd %6 %15841 %15842 +%15844 = OpLoad %6 %742 +%15845 = OpIAdd %6 %15843 %15844 +%15846 = OpLoad %6 %743 +%15847 = OpIAdd %6 %15845 %15846 +%15848 = OpLoad %6 %744 +%15849 = OpIAdd %6 %15847 %15848 +%15850 = OpLoad %6 %745 +%15851 = OpIAdd %6 %15849 %15850 +%15852 = OpLoad %6 %746 +%15853 = OpIAdd %6 %15851 %15852 +%15854 = OpLoad %6 %748 +%15855 = OpIAdd %6 %15853 %15854 +%15856 = OpLoad %6 %749 +%15857 = OpIAdd %6 %15855 %15856 +%15858 = OpLoad %6 %750 +%15859 = OpIAdd %6 %15857 %15858 +%15860 = OpLoad %6 %751 +%15861 = OpIAdd %6 %15859 %15860 +%15862 = OpLoad %6 %752 +%15863 = OpIAdd %6 %15861 %15862 +%15864 = OpLoad %6 %753 +%15865 = OpIAdd %6 %15863 %15864 +%15866 = OpLoad %6 %754 +%15867 = OpIAdd %6 %15865 %15866 +%15868 = OpLoad %6 %755 +%15869 = OpIAdd %6 %15867 %15868 +%15870 = OpLoad %6 %756 +%15871 = OpIAdd %6 %15869 %15870 +%15872 = OpLoad %6 %757 +%15873 = OpIAdd %6 %15871 %15872 +%15874 = OpLoad %6 %759 +%15875 = OpIAdd %6 %15873 %15874 +%15876 = OpLoad %6 %760 +%15877 = OpIAdd %6 %15875 %15876 +%15878 = OpLoad %6 %761 +%15879 = OpIAdd %6 %15877 %15878 +%15880 = OpLoad %6 %762 +%15881 = OpIAdd %6 %15879 %15880 +%15882 = OpLoad %6 %763 +%15883 = OpIAdd %6 %15881 %15882 +%15884 = OpLoad %6 %764 +%15885 = OpIAdd %6 %15883 %15884 +%15886 = OpLoad %6 %765 +%15887 = OpIAdd %6 %15885 %15886 +%15888 = OpLoad %6 %766 +%15889 = OpIAdd %6 %15887 %15888 +%15890 = OpLoad %6 %767 +%15891 = OpIAdd %6 %15889 %15890 +%15892 = OpLoad %6 %768 +%15893 = OpIAdd %6 %15891 %15892 +%15894 = OpLoad %6 %770 +%15895 = OpIAdd %6 %15893 %15894 +%15896 = OpLoad %6 %771 +%15897 = OpIAdd %6 %15895 %15896 +%15898 = OpLoad %6 %772 +%15899 = OpIAdd %6 %15897 %15898 +%15900 = OpLoad %6 %773 +%15901 = OpIAdd %6 %15899 %15900 +%15902 = OpLoad %6 %774 +%15903 = OpIAdd %6 %15901 %15902 +%15904 = OpLoad %6 %775 +%15905 = OpIAdd %6 %15903 %15904 +%15906 = OpLoad %6 %776 +%15907 = OpIAdd %6 %15905 %15906 +%15908 = OpLoad %6 %777 +%15909 = OpIAdd %6 %15907 %15908 +%15910 = OpLoad %6 %778 +%15911 = OpIAdd %6 %15909 %15910 +%15912 = OpLoad %6 %779 +%15913 = OpIAdd %6 %15911 %15912 +%15914 = OpLoad %6 %781 +%15915 = OpIAdd %6 %15913 %15914 +%15916 = OpLoad %6 %782 +%15917 = OpIAdd %6 %15915 %15916 +%15918 = OpLoad %6 %783 +%15919 = OpIAdd %6 %15917 %15918 +%15920 = OpLoad %6 %784 +%15921 = OpIAdd %6 %15919 %15920 +%15922 = OpLoad %6 %785 +%15923 = OpIAdd %6 %15921 %15922 +%15924 = OpLoad %6 %786 +%15925 = OpIAdd %6 %15923 %15924 +%15926 = OpLoad %6 %787 +%15927 = OpIAdd %6 %15925 %15926 +%15928 = OpLoad %6 %788 +%15929 = OpIAdd %6 %15927 %15928 +%15930 = OpLoad %6 %789 +%15931 = OpIAdd %6 %15929 %15930 +%15932 = OpLoad %6 %790 +%15933 = OpIAdd %6 %15931 %15932 +%15934 = OpLoad %6 %792 +%15935 = OpIAdd %6 %15933 %15934 +%15936 = OpLoad %6 %793 +%15937 = OpIAdd %6 %15935 %15936 +%15938 = OpLoad %6 %794 +%15939 = OpIAdd %6 %15937 %15938 +%15940 = OpLoad %6 %795 +%15941 = OpIAdd %6 %15939 %15940 +%15942 = OpLoad %6 %796 +%15943 = OpIAdd %6 %15941 %15942 +%15944 = OpLoad %6 %797 +%15945 = OpIAdd %6 %15943 %15944 +%15946 = OpLoad %6 %798 +%15947 = OpIAdd %6 %15945 %15946 +%15948 = OpLoad %6 %799 +%15949 = OpIAdd %6 %15947 %15948 +%15950 = OpLoad %6 %800 +%15951 = OpIAdd %6 %15949 %15950 +%15952 = OpLoad %6 %801 +%15953 = OpIAdd %6 %15951 %15952 +%15954 = OpLoad %6 %803 +%15955 = OpIAdd %6 %15953 %15954 +%15956 = OpLoad %6 %804 +%15957 = OpIAdd %6 %15955 %15956 +%15958 = OpLoad %6 %805 +%15959 = OpIAdd %6 %15957 %15958 +%15960 = OpLoad %6 %806 +%15961 = OpIAdd %6 %15959 %15960 +%15962 = OpLoad %6 %807 +%15963 = OpIAdd %6 %15961 %15962 +%15964 = OpLoad %6 %808 +%15965 = OpIAdd %6 %15963 %15964 +%15966 = OpLoad %6 %809 +%15967 = OpIAdd %6 %15965 %15966 +%15968 = OpLoad %6 %810 +%15969 = OpIAdd %6 %15967 %15968 +%15970 = OpLoad %6 %811 +%15971 = OpIAdd %6 %15969 %15970 +%15972 = OpLoad %6 %812 +%15973 = OpIAdd %6 %15971 %15972 +%15974 = OpLoad %6 %815 +%15975 = OpIAdd %6 %15973 %15974 +%15976 = OpLoad %6 %816 +%15977 = OpIAdd %6 %15975 %15976 +%15978 = OpLoad %6 %817 +%15979 = OpIAdd %6 %15977 %15978 +%15980 = OpLoad %6 %818 +%15981 = OpIAdd %6 %15979 %15980 +%15982 = OpLoad %6 %819 +%15983 = OpIAdd %6 %15981 %15982 +%15984 = OpLoad %6 %820 +%15985 = OpIAdd %6 %15983 %15984 +%15986 = OpLoad %6 %821 +%15987 = OpIAdd %6 %15985 %15986 +%15988 = OpLoad %6 %822 +%15989 = OpIAdd %6 %15987 %15988 +%15990 = OpLoad %6 %823 +%15991 = OpIAdd %6 %15989 %15990 +%15992 = OpLoad %6 %824 +%15993 = OpIAdd %6 %15991 %15992 +%15994 = OpLoad %6 %826 +%15995 = OpIAdd %6 %15993 %15994 +%15996 = OpLoad %6 %827 +%15997 = OpIAdd %6 %15995 %15996 +%15998 = OpLoad %6 %828 +%15999 = OpIAdd %6 %15997 %15998 +%16000 = OpLoad %6 %829 +%16001 = OpIAdd %6 %15999 %16000 +%16002 = OpLoad %6 %830 +%16003 = OpIAdd %6 %16001 %16002 +%16004 = OpLoad %6 %831 +%16005 = OpIAdd %6 %16003 %16004 +%16006 = OpLoad %6 %832 +%16007 = OpIAdd %6 %16005 %16006 +%16008 = OpLoad %6 %833 +%16009 = OpIAdd %6 %16007 %16008 +%16010 = OpLoad %6 %834 +%16011 = OpIAdd %6 %16009 %16010 +%16012 = OpLoad %6 %835 +%16013 = OpIAdd %6 %16011 %16012 +%16014 = OpLoad %6 %837 +%16015 = OpIAdd %6 %16013 %16014 +%16016 = OpLoad %6 %838 +%16017 = OpIAdd %6 %16015 %16016 +%16018 = OpLoad %6 %839 +%16019 = OpIAdd %6 %16017 %16018 +%16020 = OpLoad %6 %840 +%16021 = OpIAdd %6 %16019 %16020 +%16022 = OpLoad %6 %841 +%16023 = OpIAdd %6 %16021 %16022 +%16024 = OpLoad %6 %842 +%16025 = OpIAdd %6 %16023 %16024 +%16026 = OpLoad %6 %843 +%16027 = OpIAdd %6 %16025 %16026 +%16028 = OpLoad %6 %844 +%16029 = OpIAdd %6 %16027 %16028 +%16030 = OpLoad %6 %845 +%16031 = OpIAdd %6 %16029 %16030 +%16032 = OpLoad %6 %846 +%16033 = OpIAdd %6 %16031 %16032 +%16034 = OpLoad %6 %848 +%16035 = OpIAdd %6 %16033 %16034 +%16036 = OpLoad %6 %849 +%16037 = OpIAdd %6 %16035 %16036 +%16038 = OpLoad %6 %850 +%16039 = OpIAdd %6 %16037 %16038 +%16040 = OpLoad %6 %851 +%16041 = OpIAdd %6 %16039 %16040 +%16042 = OpLoad %6 %852 +%16043 = OpIAdd %6 %16041 %16042 +%16044 = OpLoad %6 %853 +%16045 = OpIAdd %6 %16043 %16044 +%16046 = OpLoad %6 %854 +%16047 = OpIAdd %6 %16045 %16046 +%16048 = OpLoad %6 %855 +%16049 = OpIAdd %6 %16047 %16048 +%16050 = OpLoad %6 %856 +%16051 = OpIAdd %6 %16049 %16050 +%16052 = OpLoad %6 %857 +%16053 = OpIAdd %6 %16051 %16052 +%16054 = OpLoad %6 %859 +%16055 = OpIAdd %6 %16053 %16054 +%16056 = OpLoad %6 %860 +%16057 = OpIAdd %6 %16055 %16056 +%16058 = OpLoad %6 %861 +%16059 = OpIAdd %6 %16057 %16058 +%16060 = OpLoad %6 %862 +%16061 = OpIAdd %6 %16059 %16060 +%16062 = OpLoad %6 %863 +%16063 = OpIAdd %6 %16061 %16062 +%16064 = OpLoad %6 %864 +%16065 = OpIAdd %6 %16063 %16064 +%16066 = OpLoad %6 %865 +%16067 = OpIAdd %6 %16065 %16066 +%16068 = OpLoad %6 %866 +%16069 = OpIAdd %6 %16067 %16068 +%16070 = OpLoad %6 %867 +%16071 = OpIAdd %6 %16069 %16070 +%16072 = OpLoad %6 %868 +%16073 = OpIAdd %6 %16071 %16072 +%16074 = OpLoad %6 %870 +%16075 = OpIAdd %6 %16073 %16074 +%16076 = OpLoad %6 %871 +%16077 = OpIAdd %6 %16075 %16076 +%16078 = OpLoad %6 %872 +%16079 = OpIAdd %6 %16077 %16078 +%16080 = OpLoad %6 %873 +%16081 = OpIAdd %6 %16079 %16080 +%16082 = OpLoad %6 %874 +%16083 = OpIAdd %6 %16081 %16082 +%16084 = OpLoad %6 %875 +%16085 = OpIAdd %6 %16083 %16084 +%16086 = OpLoad %6 %876 +%16087 = OpIAdd %6 %16085 %16086 +%16088 = OpLoad %6 %877 +%16089 = OpIAdd %6 %16087 %16088 +%16090 = OpLoad %6 %878 +%16091 = OpIAdd %6 %16089 %16090 +%16092 = OpLoad %6 %879 +%16093 = OpIAdd %6 %16091 %16092 +%16094 = OpLoad %6 %881 +%16095 = OpIAdd %6 %16093 %16094 +%16096 = OpLoad %6 %882 +%16097 = OpIAdd %6 %16095 %16096 +%16098 = OpLoad %6 %883 +%16099 = OpIAdd %6 %16097 %16098 +%16100 = OpLoad %6 %884 +%16101 = OpIAdd %6 %16099 %16100 +%16102 = OpLoad %6 %885 +%16103 = OpIAdd %6 %16101 %16102 +%16104 = OpLoad %6 %886 +%16105 = OpIAdd %6 %16103 %16104 +%16106 = OpLoad %6 %887 +%16107 = OpIAdd %6 %16105 %16106 +%16108 = OpLoad %6 %888 +%16109 = OpIAdd %6 %16107 %16108 +%16110 = OpLoad %6 %889 +%16111 = OpIAdd %6 %16109 %16110 +%16112 = OpLoad %6 %890 +%16113 = OpIAdd %6 %16111 %16112 +%16114 = OpLoad %6 %892 +%16115 = OpIAdd %6 %16113 %16114 +%16116 = OpLoad %6 %893 +%16117 = OpIAdd %6 %16115 %16116 +%16118 = OpLoad %6 %894 +%16119 = OpIAdd %6 %16117 %16118 +%16120 = OpLoad %6 %895 +%16121 = OpIAdd %6 %16119 %16120 +%16122 = OpLoad %6 %896 +%16123 = OpIAdd %6 %16121 %16122 +%16124 = OpLoad %6 %897 +%16125 = OpIAdd %6 %16123 %16124 +%16126 = OpLoad %6 %898 +%16127 = OpIAdd %6 %16125 %16126 +%16128 = OpLoad %6 %899 +%16129 = OpIAdd %6 %16127 %16128 +%16130 = OpLoad %6 %900 +%16131 = OpIAdd %6 %16129 %16130 +%16132 = OpLoad %6 %901 +%16133 = OpIAdd %6 %16131 %16132 +%16134 = OpLoad %6 %903 +%16135 = OpIAdd %6 %16133 %16134 +%16136 = OpLoad %6 %904 +%16137 = OpIAdd %6 %16135 %16136 +%16138 = OpLoad %6 %905 +%16139 = OpIAdd %6 %16137 %16138 +%16140 = OpLoad %6 %906 +%16141 = OpIAdd %6 %16139 %16140 +%16142 = OpLoad %6 %907 +%16143 = OpIAdd %6 %16141 %16142 +%16144 = OpLoad %6 %908 +%16145 = OpIAdd %6 %16143 %16144 +%16146 = OpLoad %6 %909 +%16147 = OpIAdd %6 %16145 %16146 +%16148 = OpLoad %6 %910 +%16149 = OpIAdd %6 %16147 %16148 +%16150 = OpLoad %6 %911 +%16151 = OpIAdd %6 %16149 %16150 +%16152 = OpLoad %6 %912 +%16153 = OpIAdd %6 %16151 %16152 +%16154 = OpLoad %6 %914 +%16155 = OpIAdd %6 %16153 %16154 +%16156 = OpLoad %6 %915 +%16157 = OpIAdd %6 %16155 %16156 +%16158 = OpLoad %6 %916 +%16159 = OpIAdd %6 %16157 %16158 +%16160 = OpLoad %6 %917 +%16161 = OpIAdd %6 %16159 %16160 +%16162 = OpLoad %6 %918 +%16163 = OpIAdd %6 %16161 %16162 +%16164 = OpLoad %6 %919 +%16165 = OpIAdd %6 %16163 %16164 +%16166 = OpLoad %6 %920 +%16167 = OpIAdd %6 %16165 %16166 +%16168 = OpLoad %6 %921 +%16169 = OpIAdd %6 %16167 %16168 +%16170 = OpLoad %6 %922 +%16171 = OpIAdd %6 %16169 %16170 +%16172 = OpLoad %6 %923 +%16173 = OpIAdd %6 %16171 %16172 +%16174 = OpLoad %6 %926 +%16175 = OpIAdd %6 %16173 %16174 +%16176 = OpLoad %6 %927 +%16177 = OpIAdd %6 %16175 %16176 +%16178 = OpLoad %6 %928 +%16179 = OpIAdd %6 %16177 %16178 +%16180 = OpLoad %6 %929 +%16181 = OpIAdd %6 %16179 %16180 +%16182 = OpLoad %6 %930 +%16183 = OpIAdd %6 %16181 %16182 +%16184 = OpLoad %6 %931 +%16185 = OpIAdd %6 %16183 %16184 +%16186 = OpLoad %6 %932 +%16187 = OpIAdd %6 %16185 %16186 +%16188 = OpLoad %6 %933 +%16189 = OpIAdd %6 %16187 %16188 +%16190 = OpLoad %6 %934 +%16191 = OpIAdd %6 %16189 %16190 +%16192 = OpLoad %6 %935 +%16193 = OpIAdd %6 %16191 %16192 +%16194 = OpLoad %6 %937 +%16195 = OpIAdd %6 %16193 %16194 +%16196 = OpLoad %6 %938 +%16197 = OpIAdd %6 %16195 %16196 +%16198 = OpLoad %6 %939 +%16199 = OpIAdd %6 %16197 %16198 +%16200 = OpLoad %6 %940 +%16201 = OpIAdd %6 %16199 %16200 +%16202 = OpLoad %6 %941 +%16203 = OpIAdd %6 %16201 %16202 +%16204 = OpLoad %6 %942 +%16205 = OpIAdd %6 %16203 %16204 +%16206 = OpLoad %6 %943 +%16207 = OpIAdd %6 %16205 %16206 +%16208 = OpLoad %6 %944 +%16209 = OpIAdd %6 %16207 %16208 +%16210 = OpLoad %6 %945 +%16211 = OpIAdd %6 %16209 %16210 +%16212 = OpLoad %6 %946 +%16213 = OpIAdd %6 %16211 %16212 +%16214 = OpLoad %6 %948 +%16215 = OpIAdd %6 %16213 %16214 +%16216 = OpLoad %6 %949 +%16217 = OpIAdd %6 %16215 %16216 +%16218 = OpLoad %6 %950 +%16219 = OpIAdd %6 %16217 %16218 +%16220 = OpLoad %6 %951 +%16221 = OpIAdd %6 %16219 %16220 +%16222 = OpLoad %6 %952 +%16223 = OpIAdd %6 %16221 %16222 +%16224 = OpLoad %6 %953 +%16225 = OpIAdd %6 %16223 %16224 +%16226 = OpLoad %6 %954 +%16227 = OpIAdd %6 %16225 %16226 +%16228 = OpLoad %6 %955 +%16229 = OpIAdd %6 %16227 %16228 +%16230 = OpLoad %6 %956 +%16231 = OpIAdd %6 %16229 %16230 +%16232 = OpLoad %6 %957 +%16233 = OpIAdd %6 %16231 %16232 +%16234 = OpLoad %6 %959 +%16235 = OpIAdd %6 %16233 %16234 +%16236 = OpLoad %6 %960 +%16237 = OpIAdd %6 %16235 %16236 +%16238 = OpLoad %6 %961 +%16239 = OpIAdd %6 %16237 %16238 +%16240 = OpLoad %6 %962 +%16241 = OpIAdd %6 %16239 %16240 +%16242 = OpLoad %6 %963 +%16243 = OpIAdd %6 %16241 %16242 +%16244 = OpLoad %6 %964 +%16245 = OpIAdd %6 %16243 %16244 +%16246 = OpLoad %6 %965 +%16247 = OpIAdd %6 %16245 %16246 +%16248 = OpLoad %6 %966 +%16249 = OpIAdd %6 %16247 %16248 +%16250 = OpLoad %6 %967 +%16251 = OpIAdd %6 %16249 %16250 +%16252 = OpLoad %6 %968 +%16253 = OpIAdd %6 %16251 %16252 +%16254 = OpLoad %6 %970 +%16255 = OpIAdd %6 %16253 %16254 +%16256 = OpLoad %6 %971 +%16257 = OpIAdd %6 %16255 %16256 +%16258 = OpLoad %6 %972 +%16259 = OpIAdd %6 %16257 %16258 +%16260 = OpLoad %6 %973 +%16261 = OpIAdd %6 %16259 %16260 +%16262 = OpLoad %6 %974 +%16263 = OpIAdd %6 %16261 %16262 +%16264 = OpLoad %6 %975 +%16265 = OpIAdd %6 %16263 %16264 +%16266 = OpLoad %6 %976 +%16267 = OpIAdd %6 %16265 %16266 +%16268 = OpLoad %6 %977 +%16269 = OpIAdd %6 %16267 %16268 +%16270 = OpLoad %6 %978 +%16271 = OpIAdd %6 %16269 %16270 +%16272 = OpLoad %6 %979 +%16273 = OpIAdd %6 %16271 %16272 +%16274 = OpLoad %6 %981 +%16275 = OpIAdd %6 %16273 %16274 +%16276 = OpLoad %6 %982 +%16277 = OpIAdd %6 %16275 %16276 +%16278 = OpLoad %6 %983 +%16279 = OpIAdd %6 %16277 %16278 +%16280 = OpLoad %6 %984 +%16281 = OpIAdd %6 %16279 %16280 +%16282 = OpLoad %6 %985 +%16283 = OpIAdd %6 %16281 %16282 +%16284 = OpLoad %6 %986 +%16285 = OpIAdd %6 %16283 %16284 +%16286 = OpLoad %6 %987 +%16287 = OpIAdd %6 %16285 %16286 +%16288 = OpLoad %6 %988 +%16289 = OpIAdd %6 %16287 %16288 +%16290 = OpLoad %6 %989 +%16291 = OpIAdd %6 %16289 %16290 +%16292 = OpLoad %6 %990 +%16293 = OpIAdd %6 %16291 %16292 +%16294 = OpLoad %6 %992 +%16295 = OpIAdd %6 %16293 %16294 +%16296 = OpLoad %6 %993 +%16297 = OpIAdd %6 %16295 %16296 +%16298 = OpLoad %6 %994 +%16299 = OpIAdd %6 %16297 %16298 +%16300 = OpLoad %6 %995 +%16301 = OpIAdd %6 %16299 %16300 +%16302 = OpLoad %6 %996 +%16303 = OpIAdd %6 %16301 %16302 +%16304 = OpLoad %6 %997 +%16305 = OpIAdd %6 %16303 %16304 +%16306 = OpLoad %6 %998 +%16307 = OpIAdd %6 %16305 %16306 +%16308 = OpLoad %6 %999 +%16309 = OpIAdd %6 %16307 %16308 +%16310 = OpLoad %6 %1000 +%16311 = OpIAdd %6 %16309 %16310 +%16312 = OpLoad %6 %1001 +%16313 = OpIAdd %6 %16311 %16312 +%16314 = OpLoad %6 %1003 +%16315 = OpIAdd %6 %16313 %16314 +%16316 = OpLoad %6 %1004 +%16317 = OpIAdd %6 %16315 %16316 +%16318 = OpLoad %6 %1005 +%16319 = OpIAdd %6 %16317 %16318 +%16320 = OpLoad %6 %1006 +%16321 = OpIAdd %6 %16319 %16320 +%16322 = OpLoad %6 %1007 +%16323 = OpIAdd %6 %16321 %16322 +%16324 = OpLoad %6 %1008 +%16325 = OpIAdd %6 %16323 %16324 +%16326 = OpLoad %6 %1009 +%16327 = OpIAdd %6 %16325 %16326 +%16328 = OpLoad %6 %1010 +%16329 = OpIAdd %6 %16327 %16328 +%16330 = OpLoad %6 %1011 +%16331 = OpIAdd %6 %16329 %16330 +%16332 = OpLoad %6 %1012 +%16333 = OpIAdd %6 %16331 %16332 +%16334 = OpLoad %6 %1014 +%16335 = OpIAdd %6 %16333 %16334 +%16336 = OpLoad %6 %1015 +%16337 = OpIAdd %6 %16335 %16336 +%16338 = OpLoad %6 %1016 +%16339 = OpIAdd %6 %16337 %16338 +%16340 = OpLoad %6 %1017 +%16341 = OpIAdd %6 %16339 %16340 +%16342 = OpLoad %6 %1018 +%16343 = OpIAdd %6 %16341 %16342 +%16344 = OpLoad %6 %1019 +%16345 = OpIAdd %6 %16343 %16344 +%16346 = OpLoad %6 %1020 +%16347 = OpIAdd %6 %16345 %16346 +%16348 = OpLoad %6 %1021 +%16349 = OpIAdd %6 %16347 %16348 +%16350 = OpLoad %6 %1022 +%16351 = OpIAdd %6 %16349 %16350 +%16352 = OpLoad %6 %1023 +%16353 = OpIAdd %6 %16351 %16352 +%16354 = OpLoad %6 %1025 +%16355 = OpIAdd %6 %16353 %16354 +%16356 = OpLoad %6 %1026 +%16357 = OpIAdd %6 %16355 %16356 +%16358 = OpLoad %6 %1027 +%16359 = OpIAdd %6 %16357 %16358 +%16360 = OpLoad %6 %1028 +%16361 = OpIAdd %6 %16359 %16360 +%16362 = OpLoad %6 %1029 +%16363 = OpIAdd %6 %16361 %16362 +%16364 = OpLoad %6 %1030 +%16365 = OpIAdd %6 %16363 %16364 +%16366 = OpLoad %6 %1031 +%16367 = OpIAdd %6 %16365 %16366 +%16368 = OpLoad %6 %1032 +%16369 = OpIAdd %6 %16367 %16368 +%16370 = OpLoad %6 %1033 +%16371 = OpIAdd %6 %16369 %16370 +%16372 = OpLoad %6 %1034 +%16373 = OpIAdd %6 %16371 %16372 +%16374 = OpLoad %6 %27 +%16375 = OpIAdd %6 %16373 %16374 +%16376 = OpLoad %6 %28 +%16377 = OpIAdd %6 %16375 %16376 +%16378 = OpLoad %6 %29 +%16379 = OpIAdd %6 %16377 %16378 +%16380 = OpLoad %6 %30 +%16381 = OpIAdd %6 %16379 %16380 +%16382 = OpLoad %6 %31 +%16383 = OpIAdd %6 %16381 %16382 +%16384 = OpLoad %6 %32 +%16385 = OpIAdd %6 %16383 %16384 +%16386 = OpLoad %6 %33 +%16387 = OpIAdd %6 %16385 %16386 +%16388 = OpLoad %6 %34 +%16389 = OpIAdd %6 %16387 %16388 +%16390 = OpLoad %6 %35 +%16391 = OpIAdd %6 %16389 %16390 +%16392 = OpLoad %6 %36 +%16393 = OpIAdd %6 %16391 %16392 +%16394 = OpLoad %6 %38 +%16395 = OpIAdd %6 %16393 %16394 +%16396 = OpLoad %6 %39 +%16397 = OpIAdd %6 %16395 %16396 +OpStore %14374 %16397 +%16402 = OpLoad %1035 %1054 +%16403 = OpLoad %6 %14374 +%16404 = OpAccessChain %1041 %16401 %9 %16402 +OpStore %16404 %16403 +OpReturn +OpFunctionEnd diff --git a/vulkan/draw/ConcurrentPayload.comp b/vulkan/draw/ConcurrentPayload.comp new file mode 100644 index 0000000..c633292 --- /dev/null +++ b/vulkan/draw/ConcurrentPayload.comp @@ -0,0 +1,16 @@ +#version 310 es + +layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +layout(binding = 0) buffer InOut { + uint values[1024]; +} sb_inout; + +void main (void) { + uvec3 size = gl_NumWorkGroups * gl_WorkGroupSize; + uint numValuesPerInv = uint(sb_inout.values.length()) / (size.x*size.y*size.z); + uint groupNdx = size.x*size.y*gl_GlobalInvocationID.z + size.x*gl_GlobalInvocationID.y + gl_GlobalInvocationID.x; + uint offset = numValuesPerInv*groupNdx; + + for (uint ndx = 0u; ndx < numValuesPerInv; ndx++) + sb_inout.values[offset + ndx] = ~sb_inout.values[offset + ndx]; +} diff --git a/vulkan/draw/NegateData.comp b/vulkan/draw/NegateData.comp new file mode 100644 index 0000000..0c56e9f --- /dev/null +++ b/vulkan/draw/NegateData.comp @@ -0,0 +1,18 @@ +#version 310 es + +layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +layout(binding = 0) buffer InOut +{ + uint values[]; +} sb_inout; + +void main (void) +{ + uvec3 size = gl_NumWorkGroups * gl_WorkGroupSize; + uint numValuesPerInv = uint(sb_inout.values.length()) / (size.x*size.y*size.z); + uint groupNdx = size.x*size.y*gl_GlobalInvocationID.z + size.x*gl_GlobalInvocationID.y + gl_GlobalInvocationID.x; + uint offset = numValuesPerInv*groupNdx; + + for (uint ndx = 0u; ndx < numValuesPerInv; ndx++) + sb_inout.values[offset + ndx] = ~sb_inout.values[offset + ndx]; +} diff --git a/vulkan/draw/VertexFetch.frag b/vulkan/draw/VertexFetch.frag new file mode 100644 index 0000000..6506a3e --- /dev/null +++ b/vulkan/draw/VertexFetch.frag @@ -0,0 +1,7 @@ +#version 430 +layout(location = 0) in vec4 in_color; +layout(location = 0) out vec4 out_color; +void main() +{ + out_color = in_color; +} \ No newline at end of file diff --git a/vulkan/draw/VertexFetch.vert b/vulkan/draw/VertexFetch.vert new file mode 100644 index 0000000..c2b101b --- /dev/null +++ b/vulkan/draw/VertexFetch.vert @@ -0,0 +1,19 @@ +#version 430 + +layout(location = 0) in vec4 in_position; +layout(location = 1) in vec4 in_color; +layout(location = 2) in int in_refVertexIndex; + +layout(location = 0) out vec4 out_color; + +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() { + gl_Position = in_position; + if (gl_VertexIndex == in_refVertexIndex) + out_color = in_color; + else + out_color = vec4(1.0, 0.0, 0.0, 1.0); +} \ No newline at end of file diff --git a/vulkan/draw/VertexFetchCount.frag b/vulkan/draw/VertexFetchCount.frag new file mode 100644 index 0000000..8a2ed8a --- /dev/null +++ b/vulkan/draw/VertexFetchCount.frag @@ -0,0 +1,14 @@ +#version 430 + +layout(location = 0) in vec4 in_color; +layout(location = 0) out vec4 out_color; +layout (set=0, binding=0, std430) buffer StorageBlock +{ + uint counter; +} ssbo; + +void main() +{ + out_color = in_color; + atomicAdd(ssbo.counter, 1); +} \ No newline at end of file diff --git a/vulkan/draw/VertexFetchCount.vert b/vulkan/draw/VertexFetchCount.vert new file mode 100644 index 0000000..518075e --- /dev/null +++ b/vulkan/draw/VertexFetchCount.vert @@ -0,0 +1,26 @@ +#version 430 + +vec4 positions[3] = vec4[]( + vec4(0.5f, 0.5f, 1.0f, 1.0f), + vec4(-0.3f, 0.3f, 1.0f, 1.0f), + vec4(-1.0f, 1.0f, 1.0f, 1.0f) +); + +vec4 colors[3] = vec4[]( + vec4(0.0f, 0.0f, 1.0f, 1.0f), // blue + vec4(0.0f, 1.0f, 0.0f, 1.0f), // green + vec4(0.0f, 0.0f, 0.0f, 1.0f) // black +); + +layout(location = 0) out vec4 out_color; + +out gl_PerVertex { + vec4 gl_Position; + float gl_PointSize; +}; + +void main() { + gl_Position = positions[gl_VertexIndex]; + gl_PointSize = 1.0f; + out_color = colors[gl_VertexIndex]; +} \ No newline at end of file diff --git a/vulkan/draw/VertexFetchInstanceIndex.vert b/vulkan/draw/VertexFetchInstanceIndex.vert new file mode 100644 index 0000000..3ed625a --- /dev/null +++ b/vulkan/draw/VertexFetchInstanceIndex.vert @@ -0,0 +1,19 @@ +#version 430 + +layout(location = 0) in vec4 in_position; +layout(location = 1) in vec4 in_color; +layout(location = 2) in int in_refInstanceIndex; + +layout(location = 0) out vec4 out_color; + +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() { + gl_Position = in_position; + if (gl_InstanceIndex == in_refInstanceIndex) + out_color = in_color; + else + out_color = vec4(1.0, 0.0, 0.0, 1.0); +} \ No newline at end of file diff --git a/vulkan/draw/VertexFetchInstanced.vert b/vulkan/draw/VertexFetchInstanced.vert new file mode 100644 index 0000000..df0e5ca --- /dev/null +++ b/vulkan/draw/VertexFetchInstanced.vert @@ -0,0 +1,23 @@ +#version 430 + +layout(location = 0) in vec4 in_position; +layout(location = 1) in vec4 in_color; +layout(location = 2) in int in_refVertexIndex; + +layout(location = 0) out vec4 out_color; + +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() { + vec2 perVertex = vec2(in_position.x, in_position.y); + vec2 perInstance[6] = vec2[6](vec2(0.0, 0.0), vec2(0.3, 0.0), vec2(0.0, -0.3),vec2(0.3, -0.3), vec2(0.7, -0.7), vec2(-0.75, 0.8)); + + gl_Position = vec4(perVertex + perInstance[gl_InstanceIndex], 0.0, 1.0); + + if (gl_VertexIndex == in_refVertexIndex) + out_color = in_color; + else + out_color = vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/vulkan/draw/VertexFetchInstancedFirstInstance.vert b/vulkan/draw/VertexFetchInstancedFirstInstance.vert new file mode 100644 index 0000000..1f1ae0e --- /dev/null +++ b/vulkan/draw/VertexFetchInstancedFirstInstance.vert @@ -0,0 +1,23 @@ +#version 430 + +layout(location = 0) in vec4 in_position; +layout(location = 1) in vec4 in_color; +layout(location = 2) in int in_refVertexIndex; + +layout(location = 0) out vec4 out_color; + +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() { + vec2 perVertex = vec2(in_position.x, in_position.y); + vec2 perInstance[6] = vec2[6](vec2(0.7, -0.7), vec2(-0.75, 0.8), vec2(0.0, 0.0), vec2(0.3, 0.0), vec2(0.0, -0.3),vec2(0.3, -0.3) ); + + gl_Position = vec4(perVertex + perInstance[gl_InstanceIndex], 0.0, 1.0); + + if (gl_VertexIndex == in_refVertexIndex) + out_color = in_color; + else + out_color = vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/vulkan/draw/VertexFetchShaderDrawParameters.vert b/vulkan/draw/VertexFetchShaderDrawParameters.vert new file mode 100644 index 0000000..0be6bda --- /dev/null +++ b/vulkan/draw/VertexFetchShaderDrawParameters.vert @@ -0,0 +1,26 @@ +#version 450 core +#extension GL_ARB_shader_draw_parameters : require + +layout(location = 0) in vec4 in_position; +layout(location = 1) in vec4 in_color; +layout(location = 2) in int in_refVertexIndex; + +layout(location = 0) out vec4 out_color; + +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() { + vec2 perVertex = vec2(in_position.x, in_position.y); + vec2 perInstance[5] = vec2[5](vec2(0.0, 0.0), vec2(-0.3, 0.0), vec2(0.0, 0.3), vec2(0.5, 0.5), vec2(0.75, -0.8)); + vec4 colors[4] = vec4[4](vec4(1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0)); + int baseInstanceIndex = gl_InstanceIndex - gl_BaseInstanceARB; + + gl_Position = vec4(perVertex + perInstance[baseInstanceIndex], 0.0, 1.0); + + if ((gl_VertexIndex - gl_BaseVertexARB) == in_refVertexIndex && gl_DrawIDARB == 0) + out_color = in_color * colors[baseInstanceIndex]; + else + out_color = vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/vulkan/draw/VertexFetchShaderDrawParametersBaseInst.vert b/vulkan/draw/VertexFetchShaderDrawParametersBaseInst.vert new file mode 100644 index 0000000..9d6cdcb --- /dev/null +++ b/vulkan/draw/VertexFetchShaderDrawParametersBaseInst.vert @@ -0,0 +1,26 @@ +#version 450 core +#extension GL_ARB_shader_draw_parameters : require + +layout(location = 0) in vec4 in_position; +layout(location = 1) in vec4 in_color; +layout(location = 2) in int in_refVertexIndex; + +layout(location = 0) out vec4 out_color; + +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() { + vec2 perVertex = vec2(in_position.x, in_position.y); + vec2 perInstance[5] = vec2[5](vec2(0.0, 0.0), vec2(-0.3, 0.0), vec2(0.0, 0.3), vec2(0.5, 0.5), vec2(0.75, -0.8)); + vec4 colors[4] = vec4[4](vec4(1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0)); + int baseInstanceIndex = gl_InstanceIndex - gl_BaseInstanceARB; + + gl_Position = vec4(perVertex + perInstance[baseInstanceIndex], 0.0, 1.0); + + if ((gl_VertexIndex - 2) == in_refVertexIndex && gl_DrawIDARB == 0) + out_color = in_color * colors[baseInstanceIndex]; + else + out_color = vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/vulkan/draw/VertexFetchShaderDrawParametersBaseVert.vert b/vulkan/draw/VertexFetchShaderDrawParametersBaseVert.vert new file mode 100644 index 0000000..cafe469 --- /dev/null +++ b/vulkan/draw/VertexFetchShaderDrawParametersBaseVert.vert @@ -0,0 +1,20 @@ +#version 450 core +#extension GL_ARB_shader_draw_parameters : require + +layout(location = 0) in vec4 in_position; +layout(location = 1) in vec4 in_color; +layout(location = 2) in int in_refVertexIndex; + +layout(location = 0) out vec4 out_color; + +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() { + gl_Position = vec4(in_position.xy, 0.0, 1.0); + + out_color = vec4(1.0, 0.0, 0.0, 1.0); + if ((gl_VertexIndex - gl_BaseVertexARB) == in_refVertexIndex && gl_DrawIDARB == 0) + out_color = in_color; +} diff --git a/vulkan/draw/VertexFetchShaderDrawParametersDrawIndex.vert b/vulkan/draw/VertexFetchShaderDrawParametersDrawIndex.vert new file mode 100644 index 0000000..596287c --- /dev/null +++ b/vulkan/draw/VertexFetchShaderDrawParametersDrawIndex.vert @@ -0,0 +1,26 @@ +#version 450 core +#extension GL_ARB_shader_draw_parameters : require + +layout(location = 0) in vec4 in_position; +layout(location = 1) in vec4 in_color; +layout(location = 2) in int in_refVertexIndex; + +layout(location = 0) out vec4 out_color; + +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() { + vec2 perVertex = vec2(in_position.x, in_position.y); + vec2 perInstance[5] = vec2[5](vec2(0.0, 0.0), vec2(-0.3, 0.0), vec2(0.0, 0.3), vec2(0.5, 0.5), vec2(0.75, -0.8)); + vec2 perDraw[4] = vec2[4](vec2(0.0, 0.0), vec2(-0.3, -0.3), vec2(0.3, 0.3), vec2(1.0, 0.5)); + vec4 colors[4] = vec4[4](vec4(1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0)); + + gl_Position = vec4(perVertex + perInstance[gl_InstanceIndex - gl_BaseInstanceARB] + perDraw[gl_DrawIDARB], 0.0, 1.0); + + if ((gl_VertexIndex - gl_BaseVertexARB) == in_refVertexIndex) + out_color = in_color * colors[gl_DrawIDARB]; + else + out_color = vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/vulkan/dynamic_state/VertexFetch.frag b/vulkan/dynamic_state/VertexFetch.frag new file mode 100644 index 0000000..cf2b27c --- /dev/null +++ b/vulkan/dynamic_state/VertexFetch.frag @@ -0,0 +1,10 @@ +#version 310 es +precision highp float; + +layout(location = 0) in vec4 in_color; +layout(location = 0) out vec4 out_color; + +void main() +{ + out_color = in_color; +} diff --git a/vulkan/dynamic_state/VertexFetch.mesh b/vulkan/dynamic_state/VertexFetch.mesh new file mode 100644 index 0000000..4c4cba9 --- /dev/null +++ b/vulkan/dynamic_state/VertexFetch.mesh @@ -0,0 +1,33 @@ +#version 450 +#extension GL_EXT_mesh_shader : enable + +struct PositionColor { + vec4 position; + vec4 color; +}; + +layout(set=0, binding=0, std430) readonly buffer PositionColorBlock { + PositionColor posColor[]; +} vtxData; + +layout(push_constant, std430) uniform PushConstantBlock { + uint vertexOffset; +} pc; + +layout(local_size_x=1) in; +layout(triangles) out; +layout(max_vertices=3, max_primitives=1) out; + +layout(location = 0) out vec4 outColor[]; + +void main() { + SetMeshOutputsEXT(3u, 1u); + const uint firstVertex = uint(gl_WorkGroupID.x) + pc.vertexOffset; + for (uint i = 0u; i < 3u; ++i) + { + const uint srcIdx = firstVertex + i; + gl_MeshVerticesEXT[i].gl_Position = vtxData.posColor[srcIdx].position; + outColor[i] = vtxData.posColor[srcIdx].color; + } + gl_PrimitiveTriangleIndicesEXT[0] = uvec3(0, 1, 2); +} diff --git a/vulkan/dynamic_state/VertexFetch.vert b/vulkan/dynamic_state/VertexFetch.vert new file mode 100644 index 0000000..2387227 --- /dev/null +++ b/vulkan/dynamic_state/VertexFetch.vert @@ -0,0 +1,13 @@ +#version 450 +precision highp float; + +layout(location = 0) in vec4 in_position; +layout(location = 1) in vec4 in_color; + +layout(location = 0) out vec4 out_color; +out gl_PerVertex { vec4 gl_Position; }; + +void main() { + gl_Position = in_position; + out_color = in_color; +} diff --git a/vulkan/dynamic_state/VertexFetchLines.mesh b/vulkan/dynamic_state/VertexFetchLines.mesh new file mode 100644 index 0000000..e0b9d52 --- /dev/null +++ b/vulkan/dynamic_state/VertexFetchLines.mesh @@ -0,0 +1,33 @@ +#version 450 +#extension GL_EXT_mesh_shader : enable + +struct PositionColor { + vec4 position; + vec4 color; +}; + +layout(set=0, binding=0, std430) readonly buffer PositionColorBlock { + PositionColor posColor[]; +} vtxData; + +layout(push_constant, std430) uniform PushConstantBlock { + uint vertexOffset; +} pc; + +layout(local_size_x=1) in; +layout(lines) out; +layout(max_vertices=2, max_primitives=1) out; + +layout(location = 0) out vec4 outColor[]; + +void main() { + SetMeshOutputsEXT(2u, 1u); + const uint firstVertex = uint(gl_WorkGroupID.x) + pc.vertexOffset; + for (uint i = 0u; i < 2u; ++i) + { + const uint srcIdx = firstVertex + i; + gl_MeshVerticesEXT[i].gl_Position = vtxData.posColor[srcIdx].position; + outColor[i] = vtxData.posColor[srcIdx].color; + } + gl_PrimitiveLineIndicesEXT[0] = uvec2(0, 1); +} diff --git a/vulkan/dynamic_state/VertexFetchViewportArray.mesh b/vulkan/dynamic_state/VertexFetchViewportArray.mesh new file mode 100644 index 0000000..c7e3f0b --- /dev/null +++ b/vulkan/dynamic_state/VertexFetchViewportArray.mesh @@ -0,0 +1,34 @@ +#version 450 +#extension GL_EXT_mesh_shader : enable + +struct PositionColor { + vec4 position; + vec4 color; +}; + +layout(set=0, binding=0, std430) readonly buffer PositionColorBlock { + PositionColor posColor[]; +} vtxData; + +layout(push_constant, std430) uniform PushConstantBlock { + uint vertexOffset; +} pc; + +layout(local_size_x=1) in; +layout(triangles) out; +layout(max_vertices=3, max_primitives=1) out; + +layout(location = 0) out vec4 outColor[]; + +void main() { + SetMeshOutputsEXT(3u, 1u); + const uint firstVertex = uint(gl_WorkGroupID.x) + pc.vertexOffset; + for (uint i = 0u; i < 3u; ++i) + { + const uint srcIdx = firstVertex + i; + gl_MeshVerticesEXT[i].gl_Position = vtxData.posColor[srcIdx].position; + outColor[i] = vtxData.posColor[srcIdx].color; + } + gl_PrimitiveTriangleIndicesEXT[0] = uvec3(0, 1, 2); + gl_MeshPrimitivesEXT[0].gl_ViewportIndex = int(round(vtxData.posColor[firstVertex].position.z * 3.0)); +} diff --git a/vulkan/dynamic_state/ViewportArray.geom b/vulkan/dynamic_state/ViewportArray.geom new file mode 100644 index 0000000..eb3c3f2 --- /dev/null +++ b/vulkan/dynamic_state/ViewportArray.geom @@ -0,0 +1,18 @@ +#version 450 +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in gl_PerVertex { vec4 gl_Position; } gl_in[]; +out gl_PerVertex { vec4 gl_Position; }; +layout(location = 0) in vec4 in_color[]; +layout(location = 0) out vec4 out_color; + +void main() { + for (int i=0; i str: + md5 = hashlib.md5() + md5.update(bs) + return md5.hexdigest() + +file_size = os.path.getsize(yuv_filename) + +# This assumes the YCrCb format is YV12, as produced by the Fraunhofer +# reference decoders. +frame_size = int(width * height * 1.5) +n_frames = file_size // frame_size + +# Apply frame limit if specified +if frame_limit is not None: + n_frames = min(n_frames, frame_limit) + +md5_hashes = [] +with open(yuv_filename, 'rb') as f: + print("Computing checksums for ", n_frames, " frames", file=sys.stderr) + for frame in range(n_frames): + md5_hashes.append(checksum(f.read(frame_size))) + +# Output in C array format (3 hashes per line) +print(f"static const char *{array_name}[{n_frames}] = {{") + +for i in range(0, n_frames, 3): + # Get up to 3 hashes for this line + line_hashes = md5_hashes[i:i+3] + formatted_hashes = ', '.join(f'"{h}"' for h in line_hashes) + + # Add comma after line unless it's the last line + line_end = ',' if i + 3 < n_frames else '' + print(f" {formatted_hashes}{line_end}") + +print("};") +print("", file=sys.stderr) diff --git a/vulkan/video/frame_checksums_ffmpeg.py b/vulkan/video/frame_checksums_ffmpeg.py new file mode 100644 index 0000000..bacaf2f --- /dev/null +++ b/vulkan/video/frame_checksums_ffmpeg.py @@ -0,0 +1,157 @@ +# -*- coding: utf-8 -*- + +#------------------------------------------------------------------------- +# +# Copyright (C) 2023 The Khronos Group Inc +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#------------------------------------------------------------------------- +# +# Generate MD5 checksums from video frames using ffmpeg. +# +# This script uses ffmpeg's framemd5 muxer to calculate MD5 checksums +# for each frame. This provides an alternative to the Fraunhofer reference +# decoder approach used in frame_checksums.py. +# +# Usage: +# python frame_checksums_ffmpeg.py +# +# Example: +# python frame_checksums_ffmpeg.py clip-a.h264 +# +# Requirements: +# - ffmpeg must be installed and available in PATH +# +# The script outputs MD5 checksums in C array format, matching the style +# used in vktVideoClipInfo.cpp (3 checksums per line). +# + +import sys +import subprocess +import os + +def print_help(): + help_text = """Usage: frame_checksums_ffmpeg.py [OPTIONS] videoFile + +Generate MD5 checksums from video frames using ffmpeg in C array format. + +Arguments: + videoFile Video file to process (H.264, H.265, etc.) + +Options: + -a NAME C array name (default: frameChecksums) + -n NUM Process only first NUM frames + -h, --help Show this help message and exit + +Requirements: + - ffmpeg must be installed and available in PATH + +Examples: + python frame_checksums_ffmpeg.py clip-a.h264 +""" + print(help_text) + sys.exit(0) + +# Parse command line arguments +video_filename = None +array_name = "frameChecksums" +frame_limit = None + +i = 1 +while i < len(sys.argv): + if sys.argv[i] in ('-h', '--help'): + print_help() + elif sys.argv[i] == '-n' and i + 1 < len(sys.argv): + frame_limit = int(sys.argv[i + 1]) + i += 2 + elif sys.argv[i] == '-a' and i + 1 < len(sys.argv): + array_name = sys.argv[i + 1] + i += 2 + elif video_filename is None: + video_filename = sys.argv[i] + i += 1 + else: + i += 1 + +if video_filename is None: + print("Usage: frame_checksums_ffmpeg.py [OPTIONS] videoFile") + print("Use -h or --help for more information") + sys.exit(1) + +if not os.path.exists(video_filename): + print(f"Error: File '{video_filename}' not found", file=sys.stderr) + sys.exit(1) + +try: + # Use ffmpeg to generate frame MD5 checksums + # The -f framemd5 output format generates MD5 for each frame + # Output to stdout (-) so we can parse it directly + cmd = [ + 'ffmpeg', + '-i', video_filename, + ] + + # Add frame limit if specified + if frame_limit is not None: + cmd.extend(['-vframes', str(frame_limit)]) + + cmd.extend(['-f', 'framemd5', '-']) + + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + + # Parse the framemd5 output + # Format is: stream#, frame#, pts, duration, size, md5 + # Example: 0, 0, 0, 1, 38016, 6b5e29f8f5f4e3d4f8c9e7b8a4d6c3f2 + md5_hashes = [] + for line in result.stdout.split('\n'): + line = line.strip() + # Skip comments and empty lines + if not line or line.startswith('#'): + continue + + # Parse the line and extract the MD5 (last field) + parts = line.split(',') + if len(parts) >= 6: + md5_hash = parts[-1].strip() + md5_hashes.append(md5_hash) + + frame_count = len(md5_hashes) + print(f"Computing checksums for {frame_count} frames", file=sys.stderr) + + # Output in C array format (3 hashes per line) + print(f"static const char *{array_name}[{frame_count}] = {{") + + for i in range(0, frame_count, 3): + # Get up to 3 hashes for this line + line_hashes = md5_hashes[i:i+3] + formatted_hashes = ', '.join(f'"{h}"' for h in line_hashes) + + # Add comma after line unless it's the last line + line_end = ',' if i + 3 < frame_count else '' + print(f" {formatted_hashes}{line_end}") + + print("};") + print(f"", file=sys.stderr) + +except subprocess.CalledProcessError as e: + print(f"Error running ffmpeg: {e}", file=sys.stderr) + if e.stderr: + print(f"ffmpeg stderr: {e.stderr}", file=sys.stderr) + sys.exit(1) +except FileNotFoundError: + print("Error: ffmpeg not found. Please install ffmpeg.", file=sys.stderr) + sys.exit(1) +except Exception as e: + print(f"Error processing video: {e}", file=sys.stderr) + sys.exit(1)